diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-10-24 17:43:37 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-10-24 17:43:37 +0200 |
commit | ae187b6d75c8079da0be1dc288613bad8466fe61 (patch) | |
tree | 5ea0d34185a2270f29ffaa65e1f5258028d7d5d0 /desktop/node_modules/@electron/notarize/lib/helpers.js | |
download | mist-ae187b6d75c8079da0be1dc288613bad8466fe61.tar.gz mist-ae187b6d75c8079da0be1dc288613bad8466fe61.tar.bz2 mist-ae187b6d75c8079da0be1dc288613bad8466fe61.zip |
Initial commit
Diffstat (limited to 'desktop/node_modules/@electron/notarize/lib/helpers.js')
-rw-r--r-- | desktop/node_modules/@electron/notarize/lib/helpers.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/desktop/node_modules/@electron/notarize/lib/helpers.js b/desktop/node_modules/@electron/notarize/lib/helpers.js new file mode 100644 index 0000000..875894f --- /dev/null +++ b/desktop/node_modules/@electron/notarize/lib/helpers.js @@ -0,0 +1,79 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.delay = exports.parseNotarizationInfo = exports.isSecret = exports.makeSecret = exports.withTempDir = void 0; +const debug = require("debug"); +const fs = require("fs-extra"); +const os = require("os"); +const path = require("path"); +const d = debug('electron-notarize:helpers'); +function withTempDir(fn) { + return __awaiter(this, void 0, void 0, function* () { + const dir = yield fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-notarize-')); + d('doing work inside temp dir:', dir); + let result; + try { + result = yield fn(dir); + } + catch (err) { + d('work failed'); + yield fs.remove(dir); + throw err; + } + d('work succeeded'); + yield fs.remove(dir); + return result; + }); +} +exports.withTempDir = withTempDir; +class Secret { + constructor(value) { + this.value = value; + } + toString() { + return this.value; + } + inspect() { + return '******'; + } +} +function makeSecret(s) { + return new Secret(s); +} +exports.makeSecret = makeSecret; +function isSecret(s) { + return s instanceof Secret; +} +exports.isSecret = isSecret; +function parseNotarizationInfo(info) { + const out = {}; + const matchToProperty = (key, r, modifier) => { + const exec = r.exec(info); + if (exec) { + out[key] = modifier ? modifier(exec[1]) : exec[1]; + } + }; + matchToProperty('uuid', /\n *RequestUUID: (.+?)\n/); + matchToProperty('date', /\n *Date: (.+?)\n/, d => new Date(d)); + matchToProperty('status', /\n *Status: (.+?)\n/); + matchToProperty('logFileUrl', /\n *LogFileURL: (.+?)\n/); + matchToProperty('statusCode', /\n *Status Code: (.+?)\n/, n => parseInt(n, 10)); + matchToProperty('statusMessage', /\n *Status Message: (.+?)\n/); + if (out.logFileUrl === '(null)') { + out.logFileUrl = null; + } + return out; +} +exports.parseNotarizationInfo = parseNotarizationInfo; +function delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} +exports.delay = delay; +//# sourceMappingURL=helpers.js.map
\ No newline at end of file |