@k8slens/extensions 5.3.1-git.5591f8dca5.0 → 5.3.1-git.56c15e6b0f.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/common/catalog-entities/kubernetes-cluster.d.ts +1 -2
- package/dist/src/common/vars.d.ts +1 -0
- package/dist/src/extensions/extension-api.js +39 -85
- package/dist/src/extensions/registries/base-registry.d.ts +1 -1
- package/dist/src/main/routes/port-forward-route.d.ts +0 -1
- package/dist/src/renderer/api/__tests__/catalog-entity-registry.test.d.ts +1 -1
- package/dist/src/renderer/api/catalog-entity-registry.d.ts +4 -0
- package/dist/src/renderer/api/catalog-entity.d.ts +1 -5
- package/dist/src/renderer/components/+network-port-forwards/port-forward-menu.d.ts +2 -0
- package/dist/src/renderer/components/+network-services/service-port-component.d.ts +1 -0
- package/dist/src/renderer/components/+workloads-pods/pod-container-port.d.ts +1 -0
- package/dist/src/renderer/components/kube-object-menu/dependencies/hide-details.injectable.d.ts +1 -1
- package/dist/src/renderer/components/menu/menu-actions.d.ts +1 -1
- package/dist/src/renderer/components/monaco-editor/monaco-editor.d.ts +1 -1
- package/dist/src/renderer/port-forward/port-forward-dialog.d.ts +1 -1
- package/dist/src/renderer/port-forward/port-forward-item.d.ts +4 -4
- package/dist/src/renderer/port-forward/port-forward-notify.d.ts +1 -0
- package/dist/src/renderer/port-forward/port-forward.store.d.ts +56 -6
- package/dist/src/renderer/theme.store.d.ts +0 -1
- package/package.json +1 -1
|
@@ -14180,7 +14180,7 @@ eval("/* eslint-env browser */\n\n/**\n * This is the web browser implementation
|
|
|
14180
14180
|
/*! no static exports found */
|
|
14181
14181
|
/***/ (function(module, exports, __webpack_require__) {
|
|
14182
14182
|
|
|
14183
|
-
eval("\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = __webpack_require__(/*! ms */ \"./node_modules/ms/index.js\");\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\
|
|
14183
|
+
eval("\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = __webpack_require__(/*! ms */ \"./node_modules/ms/index.js\");\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n\n\n//# sourceURL=webpack:///./node_modules/debug/src/common.js?");
|
|
14184
14184
|
|
|
14185
14185
|
/***/ }),
|
|
14186
14186
|
|
|
@@ -15540,7 +15540,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst
|
|
|
15540
15540
|
/***/ (function(module, exports, __webpack_require__) {
|
|
15541
15541
|
|
|
15542
15542
|
"use strict";
|
|
15543
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CancelError = exports.ParseError = void 0;\nconst core_1 = __webpack_require__(/*! ../core */ \"./node_modules/got/dist/source/core/index.js\");\n/**\nAn error to be thrown when server response code is 2xx, and parsing body fails.\nIncludes a `response` property.\n*/\nclass ParseError extends core_1.RequestError {\n constructor(error, response) {\n const { options } = response.request;\n super(`${error.message} in \"${options.url.toString()}\"`, error, response.request);\n this.name = 'ParseError';\n }\n}\nexports.ParseError = ParseError;\n/**\nAn error to be thrown when the request is aborted with `.cancel()`.\n*/\nclass CancelError extends core_1.RequestError {\n constructor(request) {\n super('Promise was canceled', {}, request);\n this.name = 'CancelError';\n }\n get isCanceled() {\n return true;\n }\n}\nexports.CancelError = CancelError;\n__exportStar(__webpack_require__(/*! ../core */ \"./node_modules/got/dist/source/core/index.js\"), exports);\n\n\n//# sourceURL=webpack:///./node_modules/got/dist/source/as-promise/types.js?");
|
|
15543
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CancelError = exports.ParseError = void 0;\nconst core_1 = __webpack_require__(/*! ../core */ \"./node_modules/got/dist/source/core/index.js\");\n/**\nAn error to be thrown when server response code is 2xx, and parsing body fails.\nIncludes a `response` property.\n*/\nclass ParseError extends core_1.RequestError {\n constructor(error, response) {\n const { options } = response.request;\n super(`${error.message} in \"${options.url.toString()}\"`, error, response.request);\n this.name = 'ParseError';\n this.code = this.code === 'ERR_GOT_REQUEST_ERROR' ? 'ERR_BODY_PARSE_FAILURE' : this.code;\n }\n}\nexports.ParseError = ParseError;\n/**\nAn error to be thrown when the request is aborted with `.cancel()`.\n*/\nclass CancelError extends core_1.RequestError {\n constructor(request) {\n super('Promise was canceled', {}, request);\n this.name = 'CancelError';\n this.code = 'ERR_CANCELED';\n }\n get isCanceled() {\n return true;\n }\n}\nexports.CancelError = CancelError;\n__exportStar(__webpack_require__(/*! ../core */ \"./node_modules/got/dist/source/core/index.js\"), exports);\n\n\n//# sourceURL=webpack:///./node_modules/got/dist/source/as-promise/types.js?");
|
|
15544
15544
|
|
|
15545
15545
|
/***/ }),
|
|
15546
15546
|
|
|
@@ -15564,7 +15564,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexport
|
|
|
15564
15564
|
/***/ (function(module, exports, __webpack_require__) {
|
|
15565
15565
|
|
|
15566
15566
|
"use strict";
|
|
15567
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UnsupportedProtocolError = exports.ReadError = exports.TimeoutError = exports.UploadError = exports.CacheError = exports.HTTPError = exports.MaxRedirectsError = exports.RequestError = exports.setNonEnumerableProperties = exports.knownHookEvents = exports.withoutBody = exports.kIsNormalizedAlready = void 0;\nconst util_1 = __webpack_require__(/*! util */ \"util\");\nconst stream_1 = __webpack_require__(/*! stream */ \"stream\");\nconst fs_1 = __webpack_require__(/*! fs */ \"fs\");\nconst url_1 = __webpack_require__(/*! url */ \"url\");\nconst http = __webpack_require__(/*! http */ \"http\");\nconst http_1 = __webpack_require__(/*! http */ \"http\");\nconst https = __webpack_require__(/*! https */ \"https\");\nconst http_timer_1 = __webpack_require__(/*! @szmarczak/http-timer */ \"./node_modules/@szmarczak/http-timer/dist/source/index.js\");\nconst cacheable_lookup_1 = __webpack_require__(/*! cacheable-lookup */ \"./node_modules/cacheable-lookup/source/index.js\");\nconst CacheableRequest = __webpack_require__(/*! cacheable-request */ \"./node_modules/cacheable-request/src/index.js\");\nconst decompressResponse = __webpack_require__(/*! decompress-response */ \"./node_modules/decompress-response/index.js\");\n// @ts-expect-error Missing types\nconst http2wrapper = __webpack_require__(/*! http2-wrapper */ \"./node_modules/http2-wrapper/source/index.js\");\nconst lowercaseKeys = __webpack_require__(/*! lowercase-keys */ \"./node_modules/lowercase-keys/index.js\");\nconst is_1 = __webpack_require__(/*! @sindresorhus/is */ \"./node_modules/@sindresorhus/is/dist/index.js\");\nconst get_body_size_1 = __webpack_require__(/*! ./utils/get-body-size */ \"./node_modules/got/dist/source/core/utils/get-body-size.js\");\nconst is_form_data_1 = __webpack_require__(/*! ./utils/is-form-data */ \"./node_modules/got/dist/source/core/utils/is-form-data.js\");\nconst proxy_events_1 = __webpack_require__(/*! ./utils/proxy-events */ \"./node_modules/got/dist/source/core/utils/proxy-events.js\");\nconst timed_out_1 = __webpack_require__(/*! ./utils/timed-out */ \"./node_modules/got/dist/source/core/utils/timed-out.js\");\nconst url_to_options_1 = __webpack_require__(/*! ./utils/url-to-options */ \"./node_modules/got/dist/source/core/utils/url-to-options.js\");\nconst options_to_url_1 = __webpack_require__(/*! ./utils/options-to-url */ \"./node_modules/got/dist/source/core/utils/options-to-url.js\");\nconst weakable_map_1 = __webpack_require__(/*! ./utils/weakable-map */ \"./node_modules/got/dist/source/core/utils/weakable-map.js\");\nconst get_buffer_1 = __webpack_require__(/*! ./utils/get-buffer */ \"./node_modules/got/dist/source/core/utils/get-buffer.js\");\nconst dns_ip_version_1 = __webpack_require__(/*! ./utils/dns-ip-version */ \"./node_modules/got/dist/source/core/utils/dns-ip-version.js\");\nconst is_response_ok_1 = __webpack_require__(/*! ./utils/is-response-ok */ \"./node_modules/got/dist/source/core/utils/is-response-ok.js\");\nconst deprecation_warning_1 = __webpack_require__(/*! ../utils/deprecation-warning */ \"./node_modules/got/dist/source/utils/deprecation-warning.js\");\nconst normalize_arguments_1 = __webpack_require__(/*! ../as-promise/normalize-arguments */ \"./node_modules/got/dist/source/as-promise/normalize-arguments.js\");\nconst calculate_retry_delay_1 = __webpack_require__(/*! ./calculate-retry-delay */ \"./node_modules/got/dist/source/core/calculate-retry-delay.js\");\nlet globalDnsCache;\nconst kRequest = Symbol('request');\nconst kResponse = Symbol('response');\nconst kResponseSize = Symbol('responseSize');\nconst kDownloadedSize = Symbol('downloadedSize');\nconst kBodySize = Symbol('bodySize');\nconst kUploadedSize = Symbol('uploadedSize');\nconst kServerResponsesPiped = Symbol('serverResponsesPiped');\nconst kUnproxyEvents = Symbol('unproxyEvents');\nconst kIsFromCache = Symbol('isFromCache');\nconst kCancelTimeouts = Symbol('cancelTimeouts');\nconst kStartedReading = Symbol('startedReading');\nconst kStopReading = Symbol('stopReading');\nconst kTriggerRead = Symbol('triggerRead');\nconst kBody = Symbol('body');\nconst kJobs = Symbol('jobs');\nconst kOriginalResponse = Symbol('originalResponse');\nconst kRetryTimeout = Symbol('retryTimeout');\nexports.kIsNormalizedAlready = Symbol('isNormalizedAlready');\nconst supportsBrotli = is_1.default.string(process.versions.brotli);\nexports.withoutBody = new Set(['GET', 'HEAD']);\nexports.knownHookEvents = [\n 'init',\n 'beforeRequest',\n 'beforeRedirect',\n 'beforeError',\n 'beforeRetry',\n // Promise-Only\n 'afterResponse'\n];\nfunction validateSearchParameters(searchParameters) {\n // eslint-disable-next-line guard-for-in\n for (const key in searchParameters) {\n const value = searchParameters[key];\n if (!is_1.default.string(value) && !is_1.default.number(value) && !is_1.default.boolean(value) && !is_1.default.null_(value) && !is_1.default.undefined(value)) {\n throw new TypeError(`The \\`searchParams\\` value '${String(value)}' must be a string, number, boolean or null`);\n }\n }\n}\nfunction isClientRequest(clientRequest) {\n return is_1.default.object(clientRequest) && !('statusCode' in clientRequest);\n}\nconst cacheableStore = new weakable_map_1.default();\nconst waitForOpenFile = async (file) => new Promise((resolve, reject) => {\n const onError = (error) => {\n reject(error);\n };\n // Node.js 12 has incomplete types\n if (!file.pending) {\n resolve();\n }\n file.once('error', onError);\n file.once('ready', () => {\n file.off('error', onError);\n resolve();\n });\n});\nconst redirectCodes = new Set([300, 301, 302, 303, 304, 307, 308]);\nconst nonEnumerableProperties = [\n 'context',\n 'body',\n 'json',\n 'form'\n];\nexports.setNonEnumerableProperties = (sources, to) => {\n // Non enumerable properties shall not be merged\n const properties = {};\n for (const source of sources) {\n if (!source) {\n continue;\n }\n for (const name of nonEnumerableProperties) {\n if (!(name in source)) {\n continue;\n }\n properties[name] = {\n writable: true,\n configurable: true,\n enumerable: false,\n // @ts-expect-error TS doesn't see the check above\n value: source[name]\n };\n }\n }\n Object.defineProperties(to, properties);\n};\n/**\nAn error to be thrown when a request fails.\nContains a `code` property with error class code, like `ECONNREFUSED`.\n*/\nclass RequestError extends Error {\n constructor(message, error, self) {\n var _a;\n super(message);\n Error.captureStackTrace(this, this.constructor);\n this.name = 'RequestError';\n this.code = error.code;\n if (self instanceof Request) {\n Object.defineProperty(this, 'request', {\n enumerable: false,\n value: self\n });\n Object.defineProperty(this, 'response', {\n enumerable: false,\n value: self[kResponse]\n });\n Object.defineProperty(this, 'options', {\n // This fails because of TS 3.7.2 useDefineForClassFields\n // Ref: https://github.com/microsoft/TypeScript/issues/34972\n enumerable: false,\n value: self.options\n });\n }\n else {\n Object.defineProperty(this, 'options', {\n // This fails because of TS 3.7.2 useDefineForClassFields\n // Ref: https://github.com/microsoft/TypeScript/issues/34972\n enumerable: false,\n value: self\n });\n }\n this.timings = (_a = this.request) === null || _a === void 0 ? void 0 : _a.timings;\n // Recover the original stacktrace\n if (is_1.default.string(error.stack) && is_1.default.string(this.stack)) {\n const indexOfMessage = this.stack.indexOf(this.message) + this.message.length;\n const thisStackTrace = this.stack.slice(indexOfMessage).split('\\n').reverse();\n const errorStackTrace = error.stack.slice(error.stack.indexOf(error.message) + error.message.length).split('\\n').reverse();\n // Remove duplicated traces\n while (errorStackTrace.length !== 0 && errorStackTrace[0] === thisStackTrace[0]) {\n thisStackTrace.shift();\n }\n this.stack = `${this.stack.slice(0, indexOfMessage)}${thisStackTrace.reverse().join('\\n')}${errorStackTrace.reverse().join('\\n')}`;\n }\n }\n}\nexports.RequestError = RequestError;\n/**\nAn error to be thrown when the server redirects you more than ten times.\nIncludes a `response` property.\n*/\nclass MaxRedirectsError extends RequestError {\n constructor(request) {\n super(`Redirected ${request.options.maxRedirects} times. Aborting.`, {}, request);\n this.name = 'MaxRedirectsError';\n }\n}\nexports.MaxRedirectsError = MaxRedirectsError;\n/**\nAn error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304.\nIncludes a `response` property.\n*/\nclass HTTPError extends RequestError {\n constructor(response) {\n super(`Response code ${response.statusCode} (${response.statusMessage})`, {}, response.request);\n this.name = 'HTTPError';\n }\n}\nexports.HTTPError = HTTPError;\n/**\nAn error to be thrown when a cache method fails.\nFor example, if the database goes down or there's a filesystem error.\n*/\nclass CacheError extends RequestError {\n constructor(error, request) {\n super(error.message, error, request);\n this.name = 'CacheError';\n }\n}\nexports.CacheError = CacheError;\n/**\nAn error to be thrown when the request body is a stream and an error occurs while reading from that stream.\n*/\nclass UploadError extends RequestError {\n constructor(error, request) {\n super(error.message, error, request);\n this.name = 'UploadError';\n }\n}\nexports.UploadError = UploadError;\n/**\nAn error to be thrown when the request is aborted due to a timeout.\nIncludes an `event` and `timings` property.\n*/\nclass TimeoutError extends RequestError {\n constructor(error, timings, request) {\n super(error.message, error, request);\n this.name = 'TimeoutError';\n this.event = error.event;\n this.timings = timings;\n }\n}\nexports.TimeoutError = TimeoutError;\n/**\nAn error to be thrown when reading from response stream fails.\n*/\nclass ReadError extends RequestError {\n constructor(error, request) {\n super(error.message, error, request);\n this.name = 'ReadError';\n }\n}\nexports.ReadError = ReadError;\n/**\nAn error to be thrown when given an unsupported protocol.\n*/\nclass UnsupportedProtocolError extends RequestError {\n constructor(options) {\n super(`Unsupported protocol \"${options.url.protocol}\"`, {}, options);\n this.name = 'UnsupportedProtocolError';\n }\n}\nexports.UnsupportedProtocolError = UnsupportedProtocolError;\nconst proxiedRequestEvents = [\n 'socket',\n 'connect',\n 'continue',\n 'information',\n 'upgrade',\n 'timeout'\n];\nclass Request extends stream_1.Duplex {\n constructor(url, options = {}, defaults) {\n super({\n // This must be false, to enable throwing after destroy\n // It is used for retry logic in Promise API\n autoDestroy: false,\n // It needs to be zero because we're just proxying the data to another stream\n highWaterMark: 0\n });\n this[kDownloadedSize] = 0;\n this[kUploadedSize] = 0;\n this.requestInitialized = false;\n this[kServerResponsesPiped] = new Set();\n this.redirects = [];\n this[kStopReading] = false;\n this[kTriggerRead] = false;\n this[kJobs] = [];\n this.retryCount = 0;\n // TODO: Remove this when targeting Node.js >= 12\n this._progressCallbacks = [];\n const unlockWrite = () => this._unlockWrite();\n const lockWrite = () => this._lockWrite();\n this.on('pipe', (source) => {\n source.prependListener('data', unlockWrite);\n source.on('data', lockWrite);\n source.prependListener('end', unlockWrite);\n source.on('end', lockWrite);\n });\n this.on('unpipe', (source) => {\n source.off('data', unlockWrite);\n source.off('data', lockWrite);\n source.off('end', unlockWrite);\n source.off('end', lockWrite);\n });\n this.on('pipe', source => {\n if (source instanceof http_1.IncomingMessage) {\n this.options.headers = {\n ...source.headers,\n ...this.options.headers\n };\n }\n });\n const { json, body, form } = options;\n if (json || body || form) {\n this._lockWrite();\n }\n if (exports.kIsNormalizedAlready in options) {\n this.options = options;\n }\n else {\n try {\n // @ts-expect-error Common TypeScript bug saying that `this.constructor` is not accessible\n this.options = this.constructor.normalizeArguments(url, options, defaults);\n }\n catch (error) {\n // TODO: Move this to `_destroy()`\n if (is_1.default.nodeStream(options.body)) {\n options.body.destroy();\n }\n this.destroy(error);\n return;\n }\n }\n (async () => {\n var _a;\n try {\n if (this.options.body instanceof fs_1.ReadStream) {\n await waitForOpenFile(this.options.body);\n }\n const { url: normalizedURL } = this.options;\n if (!normalizedURL) {\n throw new TypeError('Missing `url` property');\n }\n this.requestUrl = normalizedURL.toString();\n decodeURI(this.requestUrl);\n await this._finalizeBody();\n await this._makeRequest();\n if (this.destroyed) {\n (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroy();\n return;\n }\n // Queued writes etc.\n for (const job of this[kJobs]) {\n job();\n }\n // Prevent memory leak\n this[kJobs].length = 0;\n this.requestInitialized = true;\n }\n catch (error) {\n if (error instanceof RequestError) {\n this._beforeError(error);\n return;\n }\n // This is a workaround for https://github.com/nodejs/node/issues/33335\n if (!this.destroyed) {\n this.destroy(error);\n }\n }\n })();\n }\n static normalizeArguments(url, options, defaults) {\n var _a, _b, _c, _d, _e;\n const rawOptions = options;\n if (is_1.default.object(url) && !is_1.default.urlInstance(url)) {\n options = { ...defaults, ...url, ...options };\n }\n else {\n if (url && options && options.url !== undefined) {\n throw new TypeError('The `url` option is mutually exclusive with the `input` argument');\n }\n options = { ...defaults, ...options };\n if (url !== undefined) {\n options.url = url;\n }\n if (is_1.default.urlInstance(options.url)) {\n options.url = new url_1.URL(options.url.toString());\n }\n }\n // TODO: Deprecate URL options in Got 12.\n // Support extend-specific options\n if (options.cache === false) {\n options.cache = undefined;\n }\n if (options.dnsCache === false) {\n options.dnsCache = undefined;\n }\n // Nice type assertions\n is_1.assert.any([is_1.default.string, is_1.default.undefined], options.method);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.headers);\n is_1.assert.any([is_1.default.string, is_1.default.urlInstance, is_1.default.undefined], options.prefixUrl);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.cookieJar);\n is_1.assert.any([is_1.default.object, is_1.default.string, is_1.default.undefined], options.searchParams);\n is_1.assert.any([is_1.default.object, is_1.default.string, is_1.default.undefined], options.cache);\n is_1.assert.any([is_1.default.object, is_1.default.number, is_1.default.undefined], options.timeout);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.context);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.hooks);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.decompress);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.ignoreInvalidCookies);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.followRedirect);\n is_1.assert.any([is_1.default.number, is_1.default.undefined], options.maxRedirects);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.throwHttpErrors);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.http2);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.allowGetBody);\n is_1.assert.any([is_1.default.string, is_1.default.undefined], options.localAddress);\n is_1.assert.any([dns_ip_version_1.isDnsLookupIpVersion, is_1.default.undefined], options.dnsLookupIpVersion);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.https);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.rejectUnauthorized);\n if (options.https) {\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.https.rejectUnauthorized);\n is_1.assert.any([is_1.default.function_, is_1.default.undefined], options.https.checkServerIdentity);\n is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.certificateAuthority);\n is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.key);\n is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.certificate);\n is_1.assert.any([is_1.default.string, is_1.default.undefined], options.https.passphrase);\n is_1.assert.any([is_1.default.string, is_1.default.buffer, is_1.default.array, is_1.default.undefined], options.https.pfx);\n }\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.cacheOptions);\n // `options.method`\n if (is_1.default.string(options.method)) {\n options.method = options.method.toUpperCase();\n }\n else {\n options.method = 'GET';\n }\n // `options.headers`\n if (options.headers === (defaults === null || defaults === void 0 ? void 0 : defaults.headers)) {\n options.headers = { ...options.headers };\n }\n else {\n options.headers = lowercaseKeys({ ...(defaults === null || defaults === void 0 ? void 0 : defaults.headers), ...options.headers });\n }\n // Disallow legacy `url.Url`\n if ('slashes' in options) {\n throw new TypeError('The legacy `url.Url` has been deprecated. Use `URL` instead.');\n }\n // `options.auth`\n if ('auth' in options) {\n throw new TypeError('Parameter `auth` is deprecated. Use `username` / `password` instead.');\n }\n // `options.searchParams`\n if ('searchParams' in options) {\n if (options.searchParams && options.searchParams !== (defaults === null || defaults === void 0 ? void 0 : defaults.searchParams)) {\n let searchParameters;\n if (is_1.default.string(options.searchParams) || (options.searchParams instanceof url_1.URLSearchParams)) {\n searchParameters = new url_1.URLSearchParams(options.searchParams);\n }\n else {\n validateSearchParameters(options.searchParams);\n searchParameters = new url_1.URLSearchParams();\n // eslint-disable-next-line guard-for-in\n for (const key in options.searchParams) {\n const value = options.searchParams[key];\n if (value === null) {\n searchParameters.append(key, '');\n }\n else if (value !== undefined) {\n searchParameters.append(key, value);\n }\n }\n }\n // `normalizeArguments()` is also used to merge options\n (_a = defaults === null || defaults === void 0 ? void 0 : defaults.searchParams) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {\n // Only use default if one isn't already defined\n if (!searchParameters.has(key)) {\n searchParameters.append(key, value);\n }\n });\n options.searchParams = searchParameters;\n }\n }\n // `options.username` & `options.password`\n options.username = (_b = options.username) !== null && _b !== void 0 ? _b : '';\n options.password = (_c = options.password) !== null && _c !== void 0 ? _c : '';\n // `options.prefixUrl` & `options.url`\n if (is_1.default.undefined(options.prefixUrl)) {\n options.prefixUrl = (_d = defaults === null || defaults === void 0 ? void 0 : defaults.prefixUrl) !== null && _d !== void 0 ? _d : '';\n }\n else {\n options.prefixUrl = options.prefixUrl.toString();\n if (options.prefixUrl !== '' && !options.prefixUrl.endsWith('/')) {\n options.prefixUrl += '/';\n }\n }\n if (is_1.default.string(options.url)) {\n if (options.url.startsWith('/')) {\n throw new Error('`input` must not start with a slash when using `prefixUrl`');\n }\n options.url = options_to_url_1.default(options.prefixUrl + options.url, options);\n }\n else if ((is_1.default.undefined(options.url) && options.prefixUrl !== '') || options.protocol) {\n options.url = options_to_url_1.default(options.prefixUrl, options);\n }\n if (options.url) {\n if ('port' in options) {\n delete options.port;\n }\n // Make it possible to change `options.prefixUrl`\n let { prefixUrl } = options;\n Object.defineProperty(options, 'prefixUrl', {\n set: (value) => {\n const url = options.url;\n if (!url.href.startsWith(value)) {\n throw new Error(`Cannot change \\`prefixUrl\\` from ${prefixUrl} to ${value}: ${url.href}`);\n }\n options.url = new url_1.URL(value + url.href.slice(prefixUrl.length));\n prefixUrl = value;\n },\n get: () => prefixUrl\n });\n // Support UNIX sockets\n let { protocol } = options.url;\n if (protocol === 'unix:') {\n protocol = 'http:';\n options.url = new url_1.URL(`http://unix${options.url.pathname}${options.url.search}`);\n }\n // Set search params\n if (options.searchParams) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n options.url.search = options.searchParams.toString();\n }\n // Protocol check\n if (protocol !== 'http:' && protocol !== 'https:') {\n throw new UnsupportedProtocolError(options);\n }\n // Update `username`\n if (options.username === '') {\n options.username = options.url.username;\n }\n else {\n options.url.username = options.username;\n }\n // Update `password`\n if (options.password === '') {\n options.password = options.url.password;\n }\n else {\n options.url.password = options.password;\n }\n }\n // `options.cookieJar`\n const { cookieJar } = options;\n if (cookieJar) {\n let { setCookie, getCookieString } = cookieJar;\n is_1.assert.function_(setCookie);\n is_1.assert.function_(getCookieString);\n /* istanbul ignore next: Horrible `tough-cookie` v3 check */\n if (setCookie.length === 4 && getCookieString.length === 0) {\n setCookie = util_1.promisify(setCookie.bind(options.cookieJar));\n getCookieString = util_1.promisify(getCookieString.bind(options.cookieJar));\n options.cookieJar = {\n setCookie,\n getCookieString: getCookieString\n };\n }\n }\n // `options.cache`\n const { cache } = options;\n if (cache) {\n if (!cacheableStore.has(cache)) {\n cacheableStore.set(cache, new CacheableRequest(((requestOptions, handler) => {\n const result = requestOptions[kRequest](requestOptions, handler);\n // TODO: remove this when `cacheable-request` supports async request functions.\n if (is_1.default.promise(result)) {\n // @ts-expect-error\n // We only need to implement the error handler in order to support HTTP2 caching.\n // The result will be a promise anyway.\n result.once = (event, handler) => {\n if (event === 'error') {\n result.catch(handler);\n }\n else if (event === 'abort') {\n // The empty catch is needed here in case when\n // it rejects before it's `await`ed in `_makeRequest`.\n (async () => {\n try {\n const request = (await result);\n request.once('abort', handler);\n }\n catch (_a) { }\n })();\n }\n else {\n /* istanbul ignore next: safety check */\n throw new Error(`Unknown HTTP2 promise event: ${event}`);\n }\n return result;\n };\n }\n return result;\n }), cache));\n }\n }\n // `options.cacheOptions`\n options.cacheOptions = { ...options.cacheOptions };\n // `options.dnsCache`\n if (options.dnsCache === true) {\n if (!globalDnsCache) {\n globalDnsCache = new cacheable_lookup_1.default();\n }\n options.dnsCache = globalDnsCache;\n }\n else if (!is_1.default.undefined(options.dnsCache) && !options.dnsCache.lookup) {\n throw new TypeError(`Parameter \\`dnsCache\\` must be a CacheableLookup instance or a boolean, got ${is_1.default(options.dnsCache)}`);\n }\n // `options.timeout`\n if (is_1.default.number(options.timeout)) {\n options.timeout = { request: options.timeout };\n }\n else if (defaults && options.timeout !== defaults.timeout) {\n options.timeout = {\n ...defaults.timeout,\n ...options.timeout\n };\n }\n else {\n options.timeout = { ...options.timeout };\n }\n // `options.context`\n if (!options.context) {\n options.context = {};\n }\n // `options.hooks`\n const areHooksDefault = options.hooks === (defaults === null || defaults === void 0 ? void 0 : defaults.hooks);\n options.hooks = { ...options.hooks };\n for (const event of exports.knownHookEvents) {\n if (event in options.hooks) {\n if (is_1.default.array(options.hooks[event])) {\n // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044\n options.hooks[event] = [...options.hooks[event]];\n }\n else {\n throw new TypeError(`Parameter \\`${event}\\` must be an Array, got ${is_1.default(options.hooks[event])}`);\n }\n }\n else {\n options.hooks[event] = [];\n }\n }\n if (defaults && !areHooksDefault) {\n for (const event of exports.knownHookEvents) {\n const defaultHooks = defaults.hooks[event];\n if (defaultHooks.length > 0) {\n // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044\n options.hooks[event] = [\n ...defaults.hooks[event],\n ...options.hooks[event]\n ];\n }\n }\n }\n // DNS options\n if ('family' in options) {\n deprecation_warning_1.default('\"options.family\" was never documented, please use \"options.dnsLookupIpVersion\"');\n }\n // HTTPS options\n if (defaults === null || defaults === void 0 ? void 0 : defaults.https) {\n options.https = { ...defaults.https, ...options.https };\n }\n if ('rejectUnauthorized' in options) {\n deprecation_warning_1.default('\"options.rejectUnauthorized\" is now deprecated, please use \"options.https.rejectUnauthorized\"');\n }\n if ('checkServerIdentity' in options) {\n deprecation_warning_1.default('\"options.checkServerIdentity\" was never documented, please use \"options.https.checkServerIdentity\"');\n }\n if ('ca' in options) {\n deprecation_warning_1.default('\"options.ca\" was never documented, please use \"options.https.certificateAuthority\"');\n }\n if ('key' in options) {\n deprecation_warning_1.default('\"options.key\" was never documented, please use \"options.https.key\"');\n }\n if ('cert' in options) {\n deprecation_warning_1.default('\"options.cert\" was never documented, please use \"options.https.certificate\"');\n }\n if ('passphrase' in options) {\n deprecation_warning_1.default('\"options.passphrase\" was never documented, please use \"options.https.passphrase\"');\n }\n if ('pfx' in options) {\n deprecation_warning_1.default('\"options.pfx\" was never documented, please use \"options.https.pfx\"');\n }\n // Other options\n if ('followRedirects' in options) {\n throw new TypeError('The `followRedirects` option does not exist. Use `followRedirect` instead.');\n }\n if (options.agent) {\n for (const key in options.agent) {\n if (key !== 'http' && key !== 'https' && key !== 'http2') {\n throw new TypeError(`Expected the \\`options.agent\\` properties to be \\`http\\`, \\`https\\` or \\`http2\\`, got \\`${key}\\``);\n }\n }\n }\n options.maxRedirects = (_e = options.maxRedirects) !== null && _e !== void 0 ? _e : 0;\n // Set non-enumerable properties\n exports.setNonEnumerableProperties([defaults, rawOptions], options);\n return normalize_arguments_1.default(options, defaults);\n }\n _lockWrite() {\n const onLockedWrite = () => {\n throw new TypeError('The payload has been already provided');\n };\n this.write = onLockedWrite;\n this.end = onLockedWrite;\n }\n _unlockWrite() {\n this.write = super.write;\n this.end = super.end;\n }\n async _finalizeBody() {\n const { options } = this;\n const { headers } = options;\n const isForm = !is_1.default.undefined(options.form);\n const isJSON = !is_1.default.undefined(options.json);\n const isBody = !is_1.default.undefined(options.body);\n const hasPayload = isForm || isJSON || isBody;\n const cannotHaveBody = exports.withoutBody.has(options.method) && !(options.method === 'GET' && options.allowGetBody);\n this._cannotHaveBody = cannotHaveBody;\n if (hasPayload) {\n if (cannotHaveBody) {\n throw new TypeError(`The \\`${options.method}\\` method cannot be used with a body`);\n }\n if ([isBody, isForm, isJSON].filter(isTrue => isTrue).length > 1) {\n throw new TypeError('The `body`, `json` and `form` options are mutually exclusive');\n }\n if (isBody &&\n !(options.body instanceof stream_1.Readable) &&\n !is_1.default.string(options.body) &&\n !is_1.default.buffer(options.body) &&\n !is_form_data_1.default(options.body)) {\n throw new TypeError('The `body` option must be a stream.Readable, string or Buffer');\n }\n if (isForm && !is_1.default.object(options.form)) {\n throw new TypeError('The `form` option must be an Object');\n }\n {\n // Serialize body\n const noContentType = !is_1.default.string(headers['content-type']);\n if (isBody) {\n // Special case for https://github.com/form-data/form-data\n if (is_form_data_1.default(options.body) && noContentType) {\n headers['content-type'] = `multipart/form-data; boundary=${options.body.getBoundary()}`;\n }\n this[kBody] = options.body;\n }\n else if (isForm) {\n if (noContentType) {\n headers['content-type'] = 'application/x-www-form-urlencoded';\n }\n this[kBody] = (new url_1.URLSearchParams(options.form)).toString();\n }\n else {\n if (noContentType) {\n headers['content-type'] = 'application/json';\n }\n this[kBody] = options.stringifyJson(options.json);\n }\n const uploadBodySize = await get_body_size_1.default(this[kBody], options.headers);\n // See https://tools.ietf.org/html/rfc7230#section-3.3.2\n // A user agent SHOULD send a Content-Length in a request message when\n // no Transfer-Encoding is sent and the request method defines a meaning\n // for an enclosed payload body. For example, a Content-Length header\n // field is normally sent in a POST request even when the value is 0\n // (indicating an empty payload body). A user agent SHOULD NOT send a\n // Content-Length header field when the request message does not contain\n // a payload body and the method semantics do not anticipate such a\n // body.\n if (is_1.default.undefined(headers['content-length']) && is_1.default.undefined(headers['transfer-encoding'])) {\n if (!cannotHaveBody && !is_1.default.undefined(uploadBodySize)) {\n headers['content-length'] = String(uploadBodySize);\n }\n }\n }\n }\n else if (cannotHaveBody) {\n this._lockWrite();\n }\n else {\n this._unlockWrite();\n }\n this[kBodySize] = Number(headers['content-length']) || undefined;\n }\n async _onResponseBase(response) {\n const { options } = this;\n const { url } = options;\n this[kOriginalResponse] = response;\n if (options.decompress) {\n response = decompressResponse(response);\n }\n const statusCode = response.statusCode;\n const typedResponse = response;\n typedResponse.statusMessage = typedResponse.statusMessage ? typedResponse.statusMessage : http.STATUS_CODES[statusCode];\n typedResponse.url = options.url.toString();\n typedResponse.requestUrl = this.requestUrl;\n typedResponse.redirectUrls = this.redirects;\n typedResponse.request = this;\n typedResponse.isFromCache = response.fromCache || false;\n typedResponse.ip = this.ip;\n typedResponse.retryCount = this.retryCount;\n this[kIsFromCache] = typedResponse.isFromCache;\n this[kResponseSize] = Number(response.headers['content-length']) || undefined;\n this[kResponse] = response;\n response.once('end', () => {\n this[kResponseSize] = this[kDownloadedSize];\n this.emit('downloadProgress', this.downloadProgress);\n });\n response.once('error', (error) => {\n // Force clean-up, because some packages don't do this.\n // TODO: Fix decompress-response\n response.destroy();\n this._beforeError(new ReadError(error, this));\n });\n response.once('aborted', () => {\n this._beforeError(new ReadError({\n name: 'Error',\n message: 'The server aborted pending request',\n code: 'ECONNRESET'\n }, this));\n });\n this.emit('downloadProgress', this.downloadProgress);\n const rawCookies = response.headers['set-cookie'];\n if (is_1.default.object(options.cookieJar) && rawCookies) {\n let promises = rawCookies.map(async (rawCookie) => options.cookieJar.setCookie(rawCookie, url.toString()));\n if (options.ignoreInvalidCookies) {\n promises = promises.map(async (p) => p.catch(() => { }));\n }\n try {\n await Promise.all(promises);\n }\n catch (error) {\n this._beforeError(error);\n return;\n }\n }\n if (options.followRedirect && response.headers.location && redirectCodes.has(statusCode)) {\n // We're being redirected, we don't care about the response.\n // It'd be best to abort the request, but we can't because\n // we would have to sacrifice the TCP connection. We don't want that.\n response.resume();\n if (this[kRequest]) {\n this[kCancelTimeouts]();\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this[kRequest];\n this[kUnproxyEvents]();\n }\n const shouldBeGet = statusCode === 303 && options.method !== 'GET' && options.method !== 'HEAD';\n if (shouldBeGet || !options.methodRewriting) {\n // Server responded with \"see other\", indicating that the resource exists at another location,\n // and the client should request it from that location via GET or HEAD.\n options.method = 'GET';\n if ('body' in options) {\n delete options.body;\n }\n if ('json' in options) {\n delete options.json;\n }\n if ('form' in options) {\n delete options.form;\n }\n this[kBody] = undefined;\n delete options.headers['content-length'];\n }\n if (this.redirects.length >= options.maxRedirects) {\n this._beforeError(new MaxRedirectsError(this));\n return;\n }\n try {\n // Do not remove. See https://github.com/sindresorhus/got/pull/214\n const redirectBuffer = Buffer.from(response.headers.location, 'binary').toString();\n // Handles invalid URLs. See https://github.com/sindresorhus/got/issues/604\n const redirectUrl = new url_1.URL(redirectBuffer, url);\n const redirectString = redirectUrl.toString();\n decodeURI(redirectString);\n // Redirecting to a different site, clear sensitive data.\n if (redirectUrl.hostname !== url.hostname || redirectUrl.port !== url.port) {\n if ('host' in options.headers) {\n delete options.headers.host;\n }\n if ('cookie' in options.headers) {\n delete options.headers.cookie;\n }\n if ('authorization' in options.headers) {\n delete options.headers.authorization;\n }\n if (options.username || options.password) {\n options.username = '';\n options.password = '';\n }\n }\n else {\n redirectUrl.username = options.username;\n redirectUrl.password = options.password;\n }\n this.redirects.push(redirectString);\n options.url = redirectUrl;\n for (const hook of options.hooks.beforeRedirect) {\n // eslint-disable-next-line no-await-in-loop\n await hook(options, typedResponse);\n }\n this.emit('redirect', typedResponse, options);\n await this._makeRequest();\n }\n catch (error) {\n this._beforeError(error);\n return;\n }\n return;\n }\n if (options.isStream && options.throwHttpErrors && !is_response_ok_1.isResponseOk(typedResponse)) {\n this._beforeError(new HTTPError(typedResponse));\n return;\n }\n response.on('readable', () => {\n if (this[kTriggerRead]) {\n this._read();\n }\n });\n this.on('resume', () => {\n response.resume();\n });\n this.on('pause', () => {\n response.pause();\n });\n response.once('end', () => {\n this.push(null);\n });\n this.emit('response', response);\n for (const destination of this[kServerResponsesPiped]) {\n if (destination.headersSent) {\n continue;\n }\n // eslint-disable-next-line guard-for-in\n for (const key in response.headers) {\n const isAllowed = options.decompress ? key !== 'content-encoding' : true;\n const value = response.headers[key];\n if (isAllowed) {\n destination.setHeader(key, value);\n }\n }\n destination.statusCode = statusCode;\n }\n }\n async _onResponse(response) {\n try {\n await this._onResponseBase(response);\n }\n catch (error) {\n /* istanbul ignore next: better safe than sorry */\n this._beforeError(error);\n }\n }\n _onRequest(request) {\n const { options } = this;\n const { timeout, url } = options;\n http_timer_1.default(request);\n this[kCancelTimeouts] = timed_out_1.default(request, timeout, url);\n const responseEventName = options.cache ? 'cacheableResponse' : 'response';\n request.once(responseEventName, (response) => {\n void this._onResponse(response);\n });\n request.once('error', (error) => {\n var _a;\n // Force clean-up, because some packages (e.g. nock) don't do this.\n request.destroy();\n // Node.js <= 12.18.2 mistakenly emits the response `end` first.\n (_a = request.res) === null || _a === void 0 ? void 0 : _a.removeAllListeners('end');\n error = error instanceof timed_out_1.TimeoutError ? new TimeoutError(error, this.timings, this) : new RequestError(error.message, error, this);\n this._beforeError(error);\n });\n this[kUnproxyEvents] = proxy_events_1.default(request, this, proxiedRequestEvents);\n this[kRequest] = request;\n this.emit('uploadProgress', this.uploadProgress);\n // Send body\n const body = this[kBody];\n const currentRequest = this.redirects.length === 0 ? this : request;\n if (is_1.default.nodeStream(body)) {\n body.pipe(currentRequest);\n body.once('error', (error) => {\n this._beforeError(new UploadError(error, this));\n });\n }\n else {\n this._unlockWrite();\n if (!is_1.default.undefined(body)) {\n this._writeRequest(body, undefined, () => { });\n currentRequest.end();\n this._lockWrite();\n }\n else if (this._cannotHaveBody || this._noPipe) {\n currentRequest.end();\n this._lockWrite();\n }\n }\n this.emit('request', request);\n }\n async _createCacheableRequest(url, options) {\n return new Promise((resolve, reject) => {\n // TODO: Remove `utils/url-to-options.ts` when `cacheable-request` is fixed\n Object.assign(options, url_to_options_1.default(url));\n // `http-cache-semantics` checks this\n // TODO: Fix this ignore.\n // @ts-expect-error\n delete options.url;\n let request;\n // This is ugly\n const cacheRequest = cacheableStore.get(options.cache)(options, async (response) => {\n // TODO: Fix `cacheable-response`\n response._readableState.autoDestroy = false;\n if (request) {\n (await request).emit('cacheableResponse', response);\n }\n resolve(response);\n });\n // Restore options\n options.url = url;\n cacheRequest.once('error', reject);\n cacheRequest.once('request', async (requestOrPromise) => {\n request = requestOrPromise;\n resolve(request);\n });\n });\n }\n async _makeRequest() {\n var _a, _b, _c, _d, _e;\n const { options } = this;\n const { headers } = options;\n for (const key in headers) {\n if (is_1.default.undefined(headers[key])) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete headers[key];\n }\n else if (is_1.default.null_(headers[key])) {\n throw new TypeError(`Use \\`undefined\\` instead of \\`null\\` to delete the \\`${key}\\` header`);\n }\n }\n if (options.decompress && is_1.default.undefined(headers['accept-encoding'])) {\n headers['accept-encoding'] = supportsBrotli ? 'gzip, deflate, br' : 'gzip, deflate';\n }\n // Set cookies\n if (options.cookieJar) {\n const cookieString = await options.cookieJar.getCookieString(options.url.toString());\n if (is_1.default.nonEmptyString(cookieString)) {\n options.headers.cookie = cookieString;\n }\n }\n for (const hook of options.hooks.beforeRequest) {\n // eslint-disable-next-line no-await-in-loop\n const result = await hook(options);\n if (!is_1.default.undefined(result)) {\n // @ts-expect-error Skip the type mismatch to support abstract responses\n options.request = () => result;\n break;\n }\n }\n if (options.body && this[kBody] !== options.body) {\n this[kBody] = options.body;\n }\n const { agent, request, timeout, url } = options;\n if (options.dnsCache && !('lookup' in options)) {\n options.lookup = options.dnsCache.lookup;\n }\n // UNIX sockets\n if (url.hostname === 'unix') {\n const matches = /(?<socketPath>.+?):(?<path>.+)/.exec(`${url.pathname}${url.search}`);\n if (matches === null || matches === void 0 ? void 0 : matches.groups) {\n const { socketPath, path } = matches.groups;\n Object.assign(options, {\n socketPath,\n path,\n host: ''\n });\n }\n }\n const isHttps = url.protocol === 'https:';\n // Fallback function\n let fallbackFn;\n if (options.http2) {\n fallbackFn = http2wrapper.auto;\n }\n else {\n fallbackFn = isHttps ? https.request : http.request;\n }\n const realFn = (_a = options.request) !== null && _a !== void 0 ? _a : fallbackFn;\n // Cache support\n const fn = options.cache ? this._createCacheableRequest : realFn;\n // Pass an agent directly when HTTP2 is disabled\n if (agent && !options.http2) {\n options.agent = agent[isHttps ? 'https' : 'http'];\n }\n // Prepare plain HTTP request options\n options[kRequest] = realFn;\n delete options.request;\n // TODO: Fix this ignore.\n // @ts-expect-error\n delete options.timeout;\n const requestOptions = options;\n requestOptions.shared = (_b = options.cacheOptions) === null || _b === void 0 ? void 0 : _b.shared;\n requestOptions.cacheHeuristic = (_c = options.cacheOptions) === null || _c === void 0 ? void 0 : _c.cacheHeuristic;\n requestOptions.immutableMinTimeToLive = (_d = options.cacheOptions) === null || _d === void 0 ? void 0 : _d.immutableMinTimeToLive;\n requestOptions.ignoreCargoCult = (_e = options.cacheOptions) === null || _e === void 0 ? void 0 : _e.ignoreCargoCult;\n // If `dnsLookupIpVersion` is not present do not override `family`\n if (options.dnsLookupIpVersion !== undefined) {\n try {\n requestOptions.family = dns_ip_version_1.dnsLookupIpVersionToFamily(options.dnsLookupIpVersion);\n }\n catch (_f) {\n throw new Error('Invalid `dnsLookupIpVersion` option value');\n }\n }\n // HTTPS options remapping\n if (options.https) {\n if ('rejectUnauthorized' in options.https) {\n requestOptions.rejectUnauthorized = options.https.rejectUnauthorized;\n }\n if (options.https.checkServerIdentity) {\n requestOptions.checkServerIdentity = options.https.checkServerIdentity;\n }\n if (options.https.certificateAuthority) {\n requestOptions.ca = options.https.certificateAuthority;\n }\n if (options.https.certificate) {\n requestOptions.cert = options.https.certificate;\n }\n if (options.https.key) {\n requestOptions.key = options.https.key;\n }\n if (options.https.passphrase) {\n requestOptions.passphrase = options.https.passphrase;\n }\n if (options.https.pfx) {\n requestOptions.pfx = options.https.pfx;\n }\n }\n try {\n let requestOrResponse = await fn(url, requestOptions);\n if (is_1.default.undefined(requestOrResponse)) {\n requestOrResponse = fallbackFn(url, requestOptions);\n }\n // Restore options\n options.request = request;\n options.timeout = timeout;\n options.agent = agent;\n // HTTPS options restore\n if (options.https) {\n if ('rejectUnauthorized' in options.https) {\n delete requestOptions.rejectUnauthorized;\n }\n if (options.https.checkServerIdentity) {\n // @ts-expect-error - This one will be removed when we remove the alias.\n delete requestOptions.checkServerIdentity;\n }\n if (options.https.certificateAuthority) {\n delete requestOptions.ca;\n }\n if (options.https.certificate) {\n delete requestOptions.cert;\n }\n if (options.https.key) {\n delete requestOptions.key;\n }\n if (options.https.passphrase) {\n delete requestOptions.passphrase;\n }\n if (options.https.pfx) {\n delete requestOptions.pfx;\n }\n }\n if (isClientRequest(requestOrResponse)) {\n this._onRequest(requestOrResponse);\n // Emit the response after the stream has been ended\n }\n else if (this.writable) {\n this.once('finish', () => {\n void this._onResponse(requestOrResponse);\n });\n this._unlockWrite();\n this.end();\n this._lockWrite();\n }\n else {\n void this._onResponse(requestOrResponse);\n }\n }\n catch (error) {\n if (error instanceof CacheableRequest.CacheError) {\n throw new CacheError(error, this);\n }\n throw new RequestError(error.message, error, this);\n }\n }\n async _error(error) {\n try {\n for (const hook of this.options.hooks.beforeError) {\n // eslint-disable-next-line no-await-in-loop\n error = await hook(error);\n }\n }\n catch (error_) {\n error = new RequestError(error_.message, error_, this);\n }\n this.destroy(error);\n }\n _beforeError(error) {\n if (this[kStopReading]) {\n return;\n }\n const { options } = this;\n const retryCount = this.retryCount + 1;\n this[kStopReading] = true;\n if (!(error instanceof RequestError)) {\n error = new RequestError(error.message, error, this);\n }\n const typedError = error;\n const { response } = typedError;\n void (async () => {\n if (response && !response.body) {\n response.setEncoding(this._readableState.encoding);\n try {\n response.rawBody = await get_buffer_1.default(response);\n response.body = response.rawBody.toString();\n }\n catch (_a) { }\n }\n if (this.listenerCount('retry') !== 0) {\n let backoff;\n try {\n let retryAfter;\n if (response && 'retry-after' in response.headers) {\n retryAfter = Number(response.headers['retry-after']);\n if (Number.isNaN(retryAfter)) {\n retryAfter = Date.parse(response.headers['retry-after']) - Date.now();\n if (retryAfter <= 0) {\n retryAfter = 1;\n }\n }\n else {\n retryAfter *= 1000;\n }\n }\n backoff = await options.retry.calculateDelay({\n attemptCount: retryCount,\n retryOptions: options.retry,\n error: typedError,\n retryAfter,\n computedValue: calculate_retry_delay_1.default({\n attemptCount: retryCount,\n retryOptions: options.retry,\n error: typedError,\n retryAfter,\n computedValue: 0\n })\n });\n }\n catch (error_) {\n void this._error(new RequestError(error_.message, error_, this));\n return;\n }\n if (backoff) {\n const retry = async () => {\n try {\n for (const hook of this.options.hooks.beforeRetry) {\n // eslint-disable-next-line no-await-in-loop\n await hook(this.options, typedError, retryCount);\n }\n }\n catch (error_) {\n void this._error(new RequestError(error_.message, error, this));\n return;\n }\n // Something forced us to abort the retry\n if (this.destroyed) {\n return;\n }\n this.destroy();\n this.emit('retry', retryCount, error);\n };\n this[kRetryTimeout] = setTimeout(retry, backoff);\n return;\n }\n }\n void this._error(typedError);\n })();\n }\n _read() {\n this[kTriggerRead] = true;\n const response = this[kResponse];\n if (response && !this[kStopReading]) {\n // We cannot put this in the `if` above\n // because `.read()` also triggers the `end` event\n if (response.readableLength) {\n this[kTriggerRead] = false;\n }\n let data;\n while ((data = response.read()) !== null) {\n this[kDownloadedSize] += data.length;\n this[kStartedReading] = true;\n const progress = this.downloadProgress;\n if (progress.percent < 1) {\n this.emit('downloadProgress', progress);\n }\n this.push(data);\n }\n }\n }\n // Node.js 12 has incorrect types, so the encoding must be a string\n _write(chunk, encoding, callback) {\n const write = () => {\n this._writeRequest(chunk, encoding, callback);\n };\n if (this.requestInitialized) {\n write();\n }\n else {\n this[kJobs].push(write);\n }\n }\n _writeRequest(chunk, encoding, callback) {\n if (this[kRequest].destroyed) {\n // Probably the `ClientRequest` instance will throw\n return;\n }\n this._progressCallbacks.push(() => {\n this[kUploadedSize] += Buffer.byteLength(chunk, encoding);\n const progress = this.uploadProgress;\n if (progress.percent < 1) {\n this.emit('uploadProgress', progress);\n }\n });\n // TODO: What happens if it's from cache? Then this[kRequest] won't be defined.\n this[kRequest].write(chunk, encoding, (error) => {\n if (!error && this._progressCallbacks.length > 0) {\n this._progressCallbacks.shift()();\n }\n callback(error);\n });\n }\n _final(callback) {\n const endRequest = () => {\n // FIX: Node.js 10 calls the write callback AFTER the end callback!\n while (this._progressCallbacks.length !== 0) {\n this._progressCallbacks.shift()();\n }\n // We need to check if `this[kRequest]` is present,\n // because it isn't when we use cache.\n if (!(kRequest in this)) {\n callback();\n return;\n }\n if (this[kRequest].destroyed) {\n callback();\n return;\n }\n this[kRequest].end((error) => {\n if (!error) {\n this[kBodySize] = this[kUploadedSize];\n this.emit('uploadProgress', this.uploadProgress);\n this[kRequest].emit('upload-complete');\n }\n callback(error);\n });\n };\n if (this.requestInitialized) {\n endRequest();\n }\n else {\n this[kJobs].push(endRequest);\n }\n }\n _destroy(error, callback) {\n var _a;\n this[kStopReading] = true;\n // Prevent further retries\n clearTimeout(this[kRetryTimeout]);\n if (kRequest in this) {\n this[kCancelTimeouts]();\n // TODO: Remove the next `if` when these get fixed:\n // - https://github.com/nodejs/node/issues/32851\n if (!((_a = this[kResponse]) === null || _a === void 0 ? void 0 : _a.complete)) {\n this[kRequest].destroy();\n }\n }\n if (error !== null && !is_1.default.undefined(error) && !(error instanceof RequestError)) {\n error = new RequestError(error.message, error, this);\n }\n callback(error);\n }\n get _isAboutToError() {\n return this[kStopReading];\n }\n /**\n The remote IP address.\n */\n get ip() {\n var _a;\n return (_a = this.socket) === null || _a === void 0 ? void 0 : _a.remoteAddress;\n }\n /**\n Indicates whether the request has been aborted or not.\n */\n get aborted() {\n var _a, _b, _c;\n return ((_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroyed) !== null && _b !== void 0 ? _b : this.destroyed) && !((_c = this[kOriginalResponse]) === null || _c === void 0 ? void 0 : _c.complete);\n }\n get socket() {\n var _a, _b;\n return (_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.socket) !== null && _b !== void 0 ? _b : undefined;\n }\n /**\n Progress event for downloading (receiving a response).\n */\n get downloadProgress() {\n let percent;\n if (this[kResponseSize]) {\n percent = this[kDownloadedSize] / this[kResponseSize];\n }\n else if (this[kResponseSize] === this[kDownloadedSize]) {\n percent = 1;\n }\n else {\n percent = 0;\n }\n return {\n percent,\n transferred: this[kDownloadedSize],\n total: this[kResponseSize]\n };\n }\n /**\n Progress event for uploading (sending a request).\n */\n get uploadProgress() {\n let percent;\n if (this[kBodySize]) {\n percent = this[kUploadedSize] / this[kBodySize];\n }\n else if (this[kBodySize] === this[kUploadedSize]) {\n percent = 1;\n }\n else {\n percent = 0;\n }\n return {\n percent,\n transferred: this[kUploadedSize],\n total: this[kBodySize]\n };\n }\n /**\n The object contains the following properties:\n\n - `start` - Time when the request started.\n - `socket` - Time when a socket was assigned to the request.\n - `lookup` - Time when the DNS lookup finished.\n - `connect` - Time when the socket successfully connected.\n - `secureConnect` - Time when the socket securely connected.\n - `upload` - Time when the request finished uploading.\n - `response` - Time when the request fired `response` event.\n - `end` - Time when the response fired `end` event.\n - `error` - Time when the request fired `error` event.\n - `abort` - Time when the request fired `abort` event.\n - `phases`\n - `wait` - `timings.socket - timings.start`\n - `dns` - `timings.lookup - timings.socket`\n - `tcp` - `timings.connect - timings.lookup`\n - `tls` - `timings.secureConnect - timings.connect`\n - `request` - `timings.upload - (timings.secureConnect || timings.connect)`\n - `firstByte` - `timings.response - timings.upload`\n - `download` - `timings.end - timings.response`\n - `total` - `(timings.end || timings.error || timings.abort) - timings.start`\n\n If something has not been measured yet, it will be `undefined`.\n\n __Note__: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.\n */\n get timings() {\n var _a;\n return (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.timings;\n }\n /**\n Whether the response was retrieved from the cache.\n */\n get isFromCache() {\n return this[kIsFromCache];\n }\n pipe(destination, options) {\n if (this[kStartedReading]) {\n throw new Error('Failed to pipe. The response has been emitted already.');\n }\n if (destination instanceof http_1.ServerResponse) {\n this[kServerResponsesPiped].add(destination);\n }\n return super.pipe(destination, options);\n }\n unpipe(destination) {\n if (destination instanceof http_1.ServerResponse) {\n this[kServerResponsesPiped].delete(destination);\n }\n super.unpipe(destination);\n return this;\n }\n}\nexports.default = Request;\n\n\n//# sourceURL=webpack:///./node_modules/got/dist/source/core/index.js?");
|
|
15567
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UnsupportedProtocolError = exports.ReadError = exports.TimeoutError = exports.UploadError = exports.CacheError = exports.HTTPError = exports.MaxRedirectsError = exports.RequestError = exports.setNonEnumerableProperties = exports.knownHookEvents = exports.withoutBody = exports.kIsNormalizedAlready = void 0;\nconst util_1 = __webpack_require__(/*! util */ \"util\");\nconst stream_1 = __webpack_require__(/*! stream */ \"stream\");\nconst fs_1 = __webpack_require__(/*! fs */ \"fs\");\nconst url_1 = __webpack_require__(/*! url */ \"url\");\nconst http = __webpack_require__(/*! http */ \"http\");\nconst http_1 = __webpack_require__(/*! http */ \"http\");\nconst https = __webpack_require__(/*! https */ \"https\");\nconst http_timer_1 = __webpack_require__(/*! @szmarczak/http-timer */ \"./node_modules/@szmarczak/http-timer/dist/source/index.js\");\nconst cacheable_lookup_1 = __webpack_require__(/*! cacheable-lookup */ \"./node_modules/cacheable-lookup/source/index.js\");\nconst CacheableRequest = __webpack_require__(/*! cacheable-request */ \"./node_modules/cacheable-request/src/index.js\");\nconst decompressResponse = __webpack_require__(/*! decompress-response */ \"./node_modules/decompress-response/index.js\");\n// @ts-expect-error Missing types\nconst http2wrapper = __webpack_require__(/*! http2-wrapper */ \"./node_modules/http2-wrapper/source/index.js\");\nconst lowercaseKeys = __webpack_require__(/*! lowercase-keys */ \"./node_modules/lowercase-keys/index.js\");\nconst is_1 = __webpack_require__(/*! @sindresorhus/is */ \"./node_modules/@sindresorhus/is/dist/index.js\");\nconst get_body_size_1 = __webpack_require__(/*! ./utils/get-body-size */ \"./node_modules/got/dist/source/core/utils/get-body-size.js\");\nconst is_form_data_1 = __webpack_require__(/*! ./utils/is-form-data */ \"./node_modules/got/dist/source/core/utils/is-form-data.js\");\nconst proxy_events_1 = __webpack_require__(/*! ./utils/proxy-events */ \"./node_modules/got/dist/source/core/utils/proxy-events.js\");\nconst timed_out_1 = __webpack_require__(/*! ./utils/timed-out */ \"./node_modules/got/dist/source/core/utils/timed-out.js\");\nconst url_to_options_1 = __webpack_require__(/*! ./utils/url-to-options */ \"./node_modules/got/dist/source/core/utils/url-to-options.js\");\nconst options_to_url_1 = __webpack_require__(/*! ./utils/options-to-url */ \"./node_modules/got/dist/source/core/utils/options-to-url.js\");\nconst weakable_map_1 = __webpack_require__(/*! ./utils/weakable-map */ \"./node_modules/got/dist/source/core/utils/weakable-map.js\");\nconst get_buffer_1 = __webpack_require__(/*! ./utils/get-buffer */ \"./node_modules/got/dist/source/core/utils/get-buffer.js\");\nconst dns_ip_version_1 = __webpack_require__(/*! ./utils/dns-ip-version */ \"./node_modules/got/dist/source/core/utils/dns-ip-version.js\");\nconst is_response_ok_1 = __webpack_require__(/*! ./utils/is-response-ok */ \"./node_modules/got/dist/source/core/utils/is-response-ok.js\");\nconst deprecation_warning_1 = __webpack_require__(/*! ../utils/deprecation-warning */ \"./node_modules/got/dist/source/utils/deprecation-warning.js\");\nconst normalize_arguments_1 = __webpack_require__(/*! ../as-promise/normalize-arguments */ \"./node_modules/got/dist/source/as-promise/normalize-arguments.js\");\nconst calculate_retry_delay_1 = __webpack_require__(/*! ./calculate-retry-delay */ \"./node_modules/got/dist/source/core/calculate-retry-delay.js\");\nlet globalDnsCache;\nconst kRequest = Symbol('request');\nconst kResponse = Symbol('response');\nconst kResponseSize = Symbol('responseSize');\nconst kDownloadedSize = Symbol('downloadedSize');\nconst kBodySize = Symbol('bodySize');\nconst kUploadedSize = Symbol('uploadedSize');\nconst kServerResponsesPiped = Symbol('serverResponsesPiped');\nconst kUnproxyEvents = Symbol('unproxyEvents');\nconst kIsFromCache = Symbol('isFromCache');\nconst kCancelTimeouts = Symbol('cancelTimeouts');\nconst kStartedReading = Symbol('startedReading');\nconst kStopReading = Symbol('stopReading');\nconst kTriggerRead = Symbol('triggerRead');\nconst kBody = Symbol('body');\nconst kJobs = Symbol('jobs');\nconst kOriginalResponse = Symbol('originalResponse');\nconst kRetryTimeout = Symbol('retryTimeout');\nexports.kIsNormalizedAlready = Symbol('isNormalizedAlready');\nconst supportsBrotli = is_1.default.string(process.versions.brotli);\nexports.withoutBody = new Set(['GET', 'HEAD']);\nexports.knownHookEvents = [\n 'init',\n 'beforeRequest',\n 'beforeRedirect',\n 'beforeError',\n 'beforeRetry',\n // Promise-Only\n 'afterResponse'\n];\nfunction validateSearchParameters(searchParameters) {\n // eslint-disable-next-line guard-for-in\n for (const key in searchParameters) {\n const value = searchParameters[key];\n if (!is_1.default.string(value) && !is_1.default.number(value) && !is_1.default.boolean(value) && !is_1.default.null_(value) && !is_1.default.undefined(value)) {\n throw new TypeError(`The \\`searchParams\\` value '${String(value)}' must be a string, number, boolean or null`);\n }\n }\n}\nfunction isClientRequest(clientRequest) {\n return is_1.default.object(clientRequest) && !('statusCode' in clientRequest);\n}\nconst cacheableStore = new weakable_map_1.default();\nconst waitForOpenFile = async (file) => new Promise((resolve, reject) => {\n const onError = (error) => {\n reject(error);\n };\n // Node.js 12 has incomplete types\n if (!file.pending) {\n resolve();\n }\n file.once('error', onError);\n file.once('ready', () => {\n file.off('error', onError);\n resolve();\n });\n});\nconst redirectCodes = new Set([300, 301, 302, 303, 304, 307, 308]);\nconst nonEnumerableProperties = [\n 'context',\n 'body',\n 'json',\n 'form'\n];\nexports.setNonEnumerableProperties = (sources, to) => {\n // Non enumerable properties shall not be merged\n const properties = {};\n for (const source of sources) {\n if (!source) {\n continue;\n }\n for (const name of nonEnumerableProperties) {\n if (!(name in source)) {\n continue;\n }\n properties[name] = {\n writable: true,\n configurable: true,\n enumerable: false,\n // @ts-expect-error TS doesn't see the check above\n value: source[name]\n };\n }\n }\n Object.defineProperties(to, properties);\n};\n/**\nAn error to be thrown when a request fails.\nContains a `code` property with error class code, like `ECONNREFUSED`.\n*/\nclass RequestError extends Error {\n constructor(message, error, self) {\n var _a, _b;\n super(message);\n Error.captureStackTrace(this, this.constructor);\n this.name = 'RequestError';\n this.code = (_a = error.code) !== null && _a !== void 0 ? _a : 'ERR_GOT_REQUEST_ERROR';\n if (self instanceof Request) {\n Object.defineProperty(this, 'request', {\n enumerable: false,\n value: self\n });\n Object.defineProperty(this, 'response', {\n enumerable: false,\n value: self[kResponse]\n });\n Object.defineProperty(this, 'options', {\n // This fails because of TS 3.7.2 useDefineForClassFields\n // Ref: https://github.com/microsoft/TypeScript/issues/34972\n enumerable: false,\n value: self.options\n });\n }\n else {\n Object.defineProperty(this, 'options', {\n // This fails because of TS 3.7.2 useDefineForClassFields\n // Ref: https://github.com/microsoft/TypeScript/issues/34972\n enumerable: false,\n value: self\n });\n }\n this.timings = (_b = this.request) === null || _b === void 0 ? void 0 : _b.timings;\n // Recover the original stacktrace\n if (is_1.default.string(error.stack) && is_1.default.string(this.stack)) {\n const indexOfMessage = this.stack.indexOf(this.message) + this.message.length;\n const thisStackTrace = this.stack.slice(indexOfMessage).split('\\n').reverse();\n const errorStackTrace = error.stack.slice(error.stack.indexOf(error.message) + error.message.length).split('\\n').reverse();\n // Remove duplicated traces\n while (errorStackTrace.length !== 0 && errorStackTrace[0] === thisStackTrace[0]) {\n thisStackTrace.shift();\n }\n this.stack = `${this.stack.slice(0, indexOfMessage)}${thisStackTrace.reverse().join('\\n')}${errorStackTrace.reverse().join('\\n')}`;\n }\n }\n}\nexports.RequestError = RequestError;\n/**\nAn error to be thrown when the server redirects you more than ten times.\nIncludes a `response` property.\n*/\nclass MaxRedirectsError extends RequestError {\n constructor(request) {\n super(`Redirected ${request.options.maxRedirects} times. Aborting.`, {}, request);\n this.name = 'MaxRedirectsError';\n this.code = 'ERR_TOO_MANY_REDIRECTS';\n }\n}\nexports.MaxRedirectsError = MaxRedirectsError;\n/**\nAn error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304.\nIncludes a `response` property.\n*/\nclass HTTPError extends RequestError {\n constructor(response) {\n super(`Response code ${response.statusCode} (${response.statusMessage})`, {}, response.request);\n this.name = 'HTTPError';\n this.code = 'ERR_NON_2XX_3XX_RESPONSE';\n }\n}\nexports.HTTPError = HTTPError;\n/**\nAn error to be thrown when a cache method fails.\nFor example, if the database goes down or there's a filesystem error.\n*/\nclass CacheError extends RequestError {\n constructor(error, request) {\n super(error.message, error, request);\n this.name = 'CacheError';\n this.code = this.code === 'ERR_GOT_REQUEST_ERROR' ? 'ERR_CACHE_ACCESS' : this.code;\n }\n}\nexports.CacheError = CacheError;\n/**\nAn error to be thrown when the request body is a stream and an error occurs while reading from that stream.\n*/\nclass UploadError extends RequestError {\n constructor(error, request) {\n super(error.message, error, request);\n this.name = 'UploadError';\n this.code = this.code === 'ERR_GOT_REQUEST_ERROR' ? 'ERR_UPLOAD' : this.code;\n }\n}\nexports.UploadError = UploadError;\n/**\nAn error to be thrown when the request is aborted due to a timeout.\nIncludes an `event` and `timings` property.\n*/\nclass TimeoutError extends RequestError {\n constructor(error, timings, request) {\n super(error.message, error, request);\n this.name = 'TimeoutError';\n this.event = error.event;\n this.timings = timings;\n }\n}\nexports.TimeoutError = TimeoutError;\n/**\nAn error to be thrown when reading from response stream fails.\n*/\nclass ReadError extends RequestError {\n constructor(error, request) {\n super(error.message, error, request);\n this.name = 'ReadError';\n this.code = this.code === 'ERR_GOT_REQUEST_ERROR' ? 'ERR_READING_RESPONSE_STREAM' : this.code;\n }\n}\nexports.ReadError = ReadError;\n/**\nAn error to be thrown when given an unsupported protocol.\n*/\nclass UnsupportedProtocolError extends RequestError {\n constructor(options) {\n super(`Unsupported protocol \"${options.url.protocol}\"`, {}, options);\n this.name = 'UnsupportedProtocolError';\n this.code = 'ERR_UNSUPPORTED_PROTOCOL';\n }\n}\nexports.UnsupportedProtocolError = UnsupportedProtocolError;\nconst proxiedRequestEvents = [\n 'socket',\n 'connect',\n 'continue',\n 'information',\n 'upgrade',\n 'timeout'\n];\nclass Request extends stream_1.Duplex {\n constructor(url, options = {}, defaults) {\n super({\n // This must be false, to enable throwing after destroy\n // It is used for retry logic in Promise API\n autoDestroy: false,\n // It needs to be zero because we're just proxying the data to another stream\n highWaterMark: 0\n });\n this[kDownloadedSize] = 0;\n this[kUploadedSize] = 0;\n this.requestInitialized = false;\n this[kServerResponsesPiped] = new Set();\n this.redirects = [];\n this[kStopReading] = false;\n this[kTriggerRead] = false;\n this[kJobs] = [];\n this.retryCount = 0;\n // TODO: Remove this when targeting Node.js >= 12\n this._progressCallbacks = [];\n const unlockWrite = () => this._unlockWrite();\n const lockWrite = () => this._lockWrite();\n this.on('pipe', (source) => {\n source.prependListener('data', unlockWrite);\n source.on('data', lockWrite);\n source.prependListener('end', unlockWrite);\n source.on('end', lockWrite);\n });\n this.on('unpipe', (source) => {\n source.off('data', unlockWrite);\n source.off('data', lockWrite);\n source.off('end', unlockWrite);\n source.off('end', lockWrite);\n });\n this.on('pipe', source => {\n if (source instanceof http_1.IncomingMessage) {\n this.options.headers = {\n ...source.headers,\n ...this.options.headers\n };\n }\n });\n const { json, body, form } = options;\n if (json || body || form) {\n this._lockWrite();\n }\n if (exports.kIsNormalizedAlready in options) {\n this.options = options;\n }\n else {\n try {\n // @ts-expect-error Common TypeScript bug saying that `this.constructor` is not accessible\n this.options = this.constructor.normalizeArguments(url, options, defaults);\n }\n catch (error) {\n // TODO: Move this to `_destroy()`\n if (is_1.default.nodeStream(options.body)) {\n options.body.destroy();\n }\n this.destroy(error);\n return;\n }\n }\n (async () => {\n var _a;\n try {\n if (this.options.body instanceof fs_1.ReadStream) {\n await waitForOpenFile(this.options.body);\n }\n const { url: normalizedURL } = this.options;\n if (!normalizedURL) {\n throw new TypeError('Missing `url` property');\n }\n this.requestUrl = normalizedURL.toString();\n decodeURI(this.requestUrl);\n await this._finalizeBody();\n await this._makeRequest();\n if (this.destroyed) {\n (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroy();\n return;\n }\n // Queued writes etc.\n for (const job of this[kJobs]) {\n job();\n }\n // Prevent memory leak\n this[kJobs].length = 0;\n this.requestInitialized = true;\n }\n catch (error) {\n if (error instanceof RequestError) {\n this._beforeError(error);\n return;\n }\n // This is a workaround for https://github.com/nodejs/node/issues/33335\n if (!this.destroyed) {\n this.destroy(error);\n }\n }\n })();\n }\n static normalizeArguments(url, options, defaults) {\n var _a, _b, _c, _d, _e;\n const rawOptions = options;\n if (is_1.default.object(url) && !is_1.default.urlInstance(url)) {\n options = { ...defaults, ...url, ...options };\n }\n else {\n if (url && options && options.url !== undefined) {\n throw new TypeError('The `url` option is mutually exclusive with the `input` argument');\n }\n options = { ...defaults, ...options };\n if (url !== undefined) {\n options.url = url;\n }\n if (is_1.default.urlInstance(options.url)) {\n options.url = new url_1.URL(options.url.toString());\n }\n }\n // TODO: Deprecate URL options in Got 12.\n // Support extend-specific options\n if (options.cache === false) {\n options.cache = undefined;\n }\n if (options.dnsCache === false) {\n options.dnsCache = undefined;\n }\n // Nice type assertions\n is_1.assert.any([is_1.default.string, is_1.default.undefined], options.method);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.headers);\n is_1.assert.any([is_1.default.string, is_1.default.urlInstance, is_1.default.undefined], options.prefixUrl);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.cookieJar);\n is_1.assert.any([is_1.default.object, is_1.default.string, is_1.default.undefined], options.searchParams);\n is_1.assert.any([is_1.default.object, is_1.default.string, is_1.default.undefined], options.cache);\n is_1.assert.any([is_1.default.object, is_1.default.number, is_1.default.undefined], options.timeout);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.context);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.hooks);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.decompress);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.ignoreInvalidCookies);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.followRedirect);\n is_1.assert.any([is_1.default.number, is_1.default.undefined], options.maxRedirects);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.throwHttpErrors);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.http2);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.allowGetBody);\n is_1.assert.any([is_1.default.string, is_1.default.undefined], options.localAddress);\n is_1.assert.any([dns_ip_version_1.isDnsLookupIpVersion, is_1.default.undefined], options.dnsLookupIpVersion);\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.https);\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.rejectUnauthorized);\n if (options.https) {\n is_1.assert.any([is_1.default.boolean, is_1.default.undefined], options.https.rejectUnauthorized);\n is_1.assert.any([is_1.default.function_, is_1.default.undefined], options.https.checkServerIdentity);\n is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.certificateAuthority);\n is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.key);\n is_1.assert.any([is_1.default.string, is_1.default.object, is_1.default.array, is_1.default.undefined], options.https.certificate);\n is_1.assert.any([is_1.default.string, is_1.default.undefined], options.https.passphrase);\n is_1.assert.any([is_1.default.string, is_1.default.buffer, is_1.default.array, is_1.default.undefined], options.https.pfx);\n }\n is_1.assert.any([is_1.default.object, is_1.default.undefined], options.cacheOptions);\n // `options.method`\n if (is_1.default.string(options.method)) {\n options.method = options.method.toUpperCase();\n }\n else {\n options.method = 'GET';\n }\n // `options.headers`\n if (options.headers === (defaults === null || defaults === void 0 ? void 0 : defaults.headers)) {\n options.headers = { ...options.headers };\n }\n else {\n options.headers = lowercaseKeys({ ...(defaults === null || defaults === void 0 ? void 0 : defaults.headers), ...options.headers });\n }\n // Disallow legacy `url.Url`\n if ('slashes' in options) {\n throw new TypeError('The legacy `url.Url` has been deprecated. Use `URL` instead.');\n }\n // `options.auth`\n if ('auth' in options) {\n throw new TypeError('Parameter `auth` is deprecated. Use `username` / `password` instead.');\n }\n // `options.searchParams`\n if ('searchParams' in options) {\n if (options.searchParams && options.searchParams !== (defaults === null || defaults === void 0 ? void 0 : defaults.searchParams)) {\n let searchParameters;\n if (is_1.default.string(options.searchParams) || (options.searchParams instanceof url_1.URLSearchParams)) {\n searchParameters = new url_1.URLSearchParams(options.searchParams);\n }\n else {\n validateSearchParameters(options.searchParams);\n searchParameters = new url_1.URLSearchParams();\n // eslint-disable-next-line guard-for-in\n for (const key in options.searchParams) {\n const value = options.searchParams[key];\n if (value === null) {\n searchParameters.append(key, '');\n }\n else if (value !== undefined) {\n searchParameters.append(key, value);\n }\n }\n }\n // `normalizeArguments()` is also used to merge options\n (_a = defaults === null || defaults === void 0 ? void 0 : defaults.searchParams) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {\n // Only use default if one isn't already defined\n if (!searchParameters.has(key)) {\n searchParameters.append(key, value);\n }\n });\n options.searchParams = searchParameters;\n }\n }\n // `options.username` & `options.password`\n options.username = (_b = options.username) !== null && _b !== void 0 ? _b : '';\n options.password = (_c = options.password) !== null && _c !== void 0 ? _c : '';\n // `options.prefixUrl` & `options.url`\n if (is_1.default.undefined(options.prefixUrl)) {\n options.prefixUrl = (_d = defaults === null || defaults === void 0 ? void 0 : defaults.prefixUrl) !== null && _d !== void 0 ? _d : '';\n }\n else {\n options.prefixUrl = options.prefixUrl.toString();\n if (options.prefixUrl !== '' && !options.prefixUrl.endsWith('/')) {\n options.prefixUrl += '/';\n }\n }\n if (is_1.default.string(options.url)) {\n if (options.url.startsWith('/')) {\n throw new Error('`input` must not start with a slash when using `prefixUrl`');\n }\n options.url = options_to_url_1.default(options.prefixUrl + options.url, options);\n }\n else if ((is_1.default.undefined(options.url) && options.prefixUrl !== '') || options.protocol) {\n options.url = options_to_url_1.default(options.prefixUrl, options);\n }\n if (options.url) {\n if ('port' in options) {\n delete options.port;\n }\n // Make it possible to change `options.prefixUrl`\n let { prefixUrl } = options;\n Object.defineProperty(options, 'prefixUrl', {\n set: (value) => {\n const url = options.url;\n if (!url.href.startsWith(value)) {\n throw new Error(`Cannot change \\`prefixUrl\\` from ${prefixUrl} to ${value}: ${url.href}`);\n }\n options.url = new url_1.URL(value + url.href.slice(prefixUrl.length));\n prefixUrl = value;\n },\n get: () => prefixUrl\n });\n // Support UNIX sockets\n let { protocol } = options.url;\n if (protocol === 'unix:') {\n protocol = 'http:';\n options.url = new url_1.URL(`http://unix${options.url.pathname}${options.url.search}`);\n }\n // Set search params\n if (options.searchParams) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n options.url.search = options.searchParams.toString();\n }\n // Protocol check\n if (protocol !== 'http:' && protocol !== 'https:') {\n throw new UnsupportedProtocolError(options);\n }\n // Update `username`\n if (options.username === '') {\n options.username = options.url.username;\n }\n else {\n options.url.username = options.username;\n }\n // Update `password`\n if (options.password === '') {\n options.password = options.url.password;\n }\n else {\n options.url.password = options.password;\n }\n }\n // `options.cookieJar`\n const { cookieJar } = options;\n if (cookieJar) {\n let { setCookie, getCookieString } = cookieJar;\n is_1.assert.function_(setCookie);\n is_1.assert.function_(getCookieString);\n /* istanbul ignore next: Horrible `tough-cookie` v3 check */\n if (setCookie.length === 4 && getCookieString.length === 0) {\n setCookie = util_1.promisify(setCookie.bind(options.cookieJar));\n getCookieString = util_1.promisify(getCookieString.bind(options.cookieJar));\n options.cookieJar = {\n setCookie,\n getCookieString: getCookieString\n };\n }\n }\n // `options.cache`\n const { cache } = options;\n if (cache) {\n if (!cacheableStore.has(cache)) {\n cacheableStore.set(cache, new CacheableRequest(((requestOptions, handler) => {\n const result = requestOptions[kRequest](requestOptions, handler);\n // TODO: remove this when `cacheable-request` supports async request functions.\n if (is_1.default.promise(result)) {\n // @ts-expect-error\n // We only need to implement the error handler in order to support HTTP2 caching.\n // The result will be a promise anyway.\n result.once = (event, handler) => {\n if (event === 'error') {\n result.catch(handler);\n }\n else if (event === 'abort') {\n // The empty catch is needed here in case when\n // it rejects before it's `await`ed in `_makeRequest`.\n (async () => {\n try {\n const request = (await result);\n request.once('abort', handler);\n }\n catch (_a) { }\n })();\n }\n else {\n /* istanbul ignore next: safety check */\n throw new Error(`Unknown HTTP2 promise event: ${event}`);\n }\n return result;\n };\n }\n return result;\n }), cache));\n }\n }\n // `options.cacheOptions`\n options.cacheOptions = { ...options.cacheOptions };\n // `options.dnsCache`\n if (options.dnsCache === true) {\n if (!globalDnsCache) {\n globalDnsCache = new cacheable_lookup_1.default();\n }\n options.dnsCache = globalDnsCache;\n }\n else if (!is_1.default.undefined(options.dnsCache) && !options.dnsCache.lookup) {\n throw new TypeError(`Parameter \\`dnsCache\\` must be a CacheableLookup instance or a boolean, got ${is_1.default(options.dnsCache)}`);\n }\n // `options.timeout`\n if (is_1.default.number(options.timeout)) {\n options.timeout = { request: options.timeout };\n }\n else if (defaults && options.timeout !== defaults.timeout) {\n options.timeout = {\n ...defaults.timeout,\n ...options.timeout\n };\n }\n else {\n options.timeout = { ...options.timeout };\n }\n // `options.context`\n if (!options.context) {\n options.context = {};\n }\n // `options.hooks`\n const areHooksDefault = options.hooks === (defaults === null || defaults === void 0 ? void 0 : defaults.hooks);\n options.hooks = { ...options.hooks };\n for (const event of exports.knownHookEvents) {\n if (event in options.hooks) {\n if (is_1.default.array(options.hooks[event])) {\n // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044\n options.hooks[event] = [...options.hooks[event]];\n }\n else {\n throw new TypeError(`Parameter \\`${event}\\` must be an Array, got ${is_1.default(options.hooks[event])}`);\n }\n }\n else {\n options.hooks[event] = [];\n }\n }\n if (defaults && !areHooksDefault) {\n for (const event of exports.knownHookEvents) {\n const defaultHooks = defaults.hooks[event];\n if (defaultHooks.length > 0) {\n // See https://github.com/microsoft/TypeScript/issues/31445#issuecomment-576929044\n options.hooks[event] = [\n ...defaults.hooks[event],\n ...options.hooks[event]\n ];\n }\n }\n }\n // DNS options\n if ('family' in options) {\n deprecation_warning_1.default('\"options.family\" was never documented, please use \"options.dnsLookupIpVersion\"');\n }\n // HTTPS options\n if (defaults === null || defaults === void 0 ? void 0 : defaults.https) {\n options.https = { ...defaults.https, ...options.https };\n }\n if ('rejectUnauthorized' in options) {\n deprecation_warning_1.default('\"options.rejectUnauthorized\" is now deprecated, please use \"options.https.rejectUnauthorized\"');\n }\n if ('checkServerIdentity' in options) {\n deprecation_warning_1.default('\"options.checkServerIdentity\" was never documented, please use \"options.https.checkServerIdentity\"');\n }\n if ('ca' in options) {\n deprecation_warning_1.default('\"options.ca\" was never documented, please use \"options.https.certificateAuthority\"');\n }\n if ('key' in options) {\n deprecation_warning_1.default('\"options.key\" was never documented, please use \"options.https.key\"');\n }\n if ('cert' in options) {\n deprecation_warning_1.default('\"options.cert\" was never documented, please use \"options.https.certificate\"');\n }\n if ('passphrase' in options) {\n deprecation_warning_1.default('\"options.passphrase\" was never documented, please use \"options.https.passphrase\"');\n }\n if ('pfx' in options) {\n deprecation_warning_1.default('\"options.pfx\" was never documented, please use \"options.https.pfx\"');\n }\n // Other options\n if ('followRedirects' in options) {\n throw new TypeError('The `followRedirects` option does not exist. Use `followRedirect` instead.');\n }\n if (options.agent) {\n for (const key in options.agent) {\n if (key !== 'http' && key !== 'https' && key !== 'http2') {\n throw new TypeError(`Expected the \\`options.agent\\` properties to be \\`http\\`, \\`https\\` or \\`http2\\`, got \\`${key}\\``);\n }\n }\n }\n options.maxRedirects = (_e = options.maxRedirects) !== null && _e !== void 0 ? _e : 0;\n // Set non-enumerable properties\n exports.setNonEnumerableProperties([defaults, rawOptions], options);\n return normalize_arguments_1.default(options, defaults);\n }\n _lockWrite() {\n const onLockedWrite = () => {\n throw new TypeError('The payload has been already provided');\n };\n this.write = onLockedWrite;\n this.end = onLockedWrite;\n }\n _unlockWrite() {\n this.write = super.write;\n this.end = super.end;\n }\n async _finalizeBody() {\n const { options } = this;\n const { headers } = options;\n const isForm = !is_1.default.undefined(options.form);\n const isJSON = !is_1.default.undefined(options.json);\n const isBody = !is_1.default.undefined(options.body);\n const hasPayload = isForm || isJSON || isBody;\n const cannotHaveBody = exports.withoutBody.has(options.method) && !(options.method === 'GET' && options.allowGetBody);\n this._cannotHaveBody = cannotHaveBody;\n if (hasPayload) {\n if (cannotHaveBody) {\n throw new TypeError(`The \\`${options.method}\\` method cannot be used with a body`);\n }\n if ([isBody, isForm, isJSON].filter(isTrue => isTrue).length > 1) {\n throw new TypeError('The `body`, `json` and `form` options are mutually exclusive');\n }\n if (isBody &&\n !(options.body instanceof stream_1.Readable) &&\n !is_1.default.string(options.body) &&\n !is_1.default.buffer(options.body) &&\n !is_form_data_1.default(options.body)) {\n throw new TypeError('The `body` option must be a stream.Readable, string or Buffer');\n }\n if (isForm && !is_1.default.object(options.form)) {\n throw new TypeError('The `form` option must be an Object');\n }\n {\n // Serialize body\n const noContentType = !is_1.default.string(headers['content-type']);\n if (isBody) {\n // Special case for https://github.com/form-data/form-data\n if (is_form_data_1.default(options.body) && noContentType) {\n headers['content-type'] = `multipart/form-data; boundary=${options.body.getBoundary()}`;\n }\n this[kBody] = options.body;\n }\n else if (isForm) {\n if (noContentType) {\n headers['content-type'] = 'application/x-www-form-urlencoded';\n }\n this[kBody] = (new url_1.URLSearchParams(options.form)).toString();\n }\n else {\n if (noContentType) {\n headers['content-type'] = 'application/json';\n }\n this[kBody] = options.stringifyJson(options.json);\n }\n const uploadBodySize = await get_body_size_1.default(this[kBody], options.headers);\n // See https://tools.ietf.org/html/rfc7230#section-3.3.2\n // A user agent SHOULD send a Content-Length in a request message when\n // no Transfer-Encoding is sent and the request method defines a meaning\n // for an enclosed payload body. For example, a Content-Length header\n // field is normally sent in a POST request even when the value is 0\n // (indicating an empty payload body). A user agent SHOULD NOT send a\n // Content-Length header field when the request message does not contain\n // a payload body and the method semantics do not anticipate such a\n // body.\n if (is_1.default.undefined(headers['content-length']) && is_1.default.undefined(headers['transfer-encoding'])) {\n if (!cannotHaveBody && !is_1.default.undefined(uploadBodySize)) {\n headers['content-length'] = String(uploadBodySize);\n }\n }\n }\n }\n else if (cannotHaveBody) {\n this._lockWrite();\n }\n else {\n this._unlockWrite();\n }\n this[kBodySize] = Number(headers['content-length']) || undefined;\n }\n async _onResponseBase(response) {\n const { options } = this;\n const { url } = options;\n this[kOriginalResponse] = response;\n if (options.decompress) {\n response = decompressResponse(response);\n }\n const statusCode = response.statusCode;\n const typedResponse = response;\n typedResponse.statusMessage = typedResponse.statusMessage ? typedResponse.statusMessage : http.STATUS_CODES[statusCode];\n typedResponse.url = options.url.toString();\n typedResponse.requestUrl = this.requestUrl;\n typedResponse.redirectUrls = this.redirects;\n typedResponse.request = this;\n typedResponse.isFromCache = response.fromCache || false;\n typedResponse.ip = this.ip;\n typedResponse.retryCount = this.retryCount;\n this[kIsFromCache] = typedResponse.isFromCache;\n this[kResponseSize] = Number(response.headers['content-length']) || undefined;\n this[kResponse] = response;\n response.once('end', () => {\n this[kResponseSize] = this[kDownloadedSize];\n this.emit('downloadProgress', this.downloadProgress);\n });\n response.once('error', (error) => {\n // Force clean-up, because some packages don't do this.\n // TODO: Fix decompress-response\n response.destroy();\n this._beforeError(new ReadError(error, this));\n });\n response.once('aborted', () => {\n this._beforeError(new ReadError({\n name: 'Error',\n message: 'The server aborted pending request',\n code: 'ECONNRESET'\n }, this));\n });\n this.emit('downloadProgress', this.downloadProgress);\n const rawCookies = response.headers['set-cookie'];\n if (is_1.default.object(options.cookieJar) && rawCookies) {\n let promises = rawCookies.map(async (rawCookie) => options.cookieJar.setCookie(rawCookie, url.toString()));\n if (options.ignoreInvalidCookies) {\n promises = promises.map(async (p) => p.catch(() => { }));\n }\n try {\n await Promise.all(promises);\n }\n catch (error) {\n this._beforeError(error);\n return;\n }\n }\n if (options.followRedirect && response.headers.location && redirectCodes.has(statusCode)) {\n // We're being redirected, we don't care about the response.\n // It'd be best to abort the request, but we can't because\n // we would have to sacrifice the TCP connection. We don't want that.\n response.resume();\n if (this[kRequest]) {\n this[kCancelTimeouts]();\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this[kRequest];\n this[kUnproxyEvents]();\n }\n const shouldBeGet = statusCode === 303 && options.method !== 'GET' && options.method !== 'HEAD';\n if (shouldBeGet || !options.methodRewriting) {\n // Server responded with \"see other\", indicating that the resource exists at another location,\n // and the client should request it from that location via GET or HEAD.\n options.method = 'GET';\n if ('body' in options) {\n delete options.body;\n }\n if ('json' in options) {\n delete options.json;\n }\n if ('form' in options) {\n delete options.form;\n }\n this[kBody] = undefined;\n delete options.headers['content-length'];\n }\n if (this.redirects.length >= options.maxRedirects) {\n this._beforeError(new MaxRedirectsError(this));\n return;\n }\n try {\n // Do not remove. See https://github.com/sindresorhus/got/pull/214\n const redirectBuffer = Buffer.from(response.headers.location, 'binary').toString();\n // Handles invalid URLs. See https://github.com/sindresorhus/got/issues/604\n const redirectUrl = new url_1.URL(redirectBuffer, url);\n const redirectString = redirectUrl.toString();\n decodeURI(redirectString);\n // Redirecting to a different site, clear sensitive data.\n if (redirectUrl.hostname !== url.hostname || redirectUrl.port !== url.port) {\n if ('host' in options.headers) {\n delete options.headers.host;\n }\n if ('cookie' in options.headers) {\n delete options.headers.cookie;\n }\n if ('authorization' in options.headers) {\n delete options.headers.authorization;\n }\n if (options.username || options.password) {\n options.username = '';\n options.password = '';\n }\n }\n else {\n redirectUrl.username = options.username;\n redirectUrl.password = options.password;\n }\n this.redirects.push(redirectString);\n options.url = redirectUrl;\n for (const hook of options.hooks.beforeRedirect) {\n // eslint-disable-next-line no-await-in-loop\n await hook(options, typedResponse);\n }\n this.emit('redirect', typedResponse, options);\n await this._makeRequest();\n }\n catch (error) {\n this._beforeError(error);\n return;\n }\n return;\n }\n if (options.isStream && options.throwHttpErrors && !is_response_ok_1.isResponseOk(typedResponse)) {\n this._beforeError(new HTTPError(typedResponse));\n return;\n }\n response.on('readable', () => {\n if (this[kTriggerRead]) {\n this._read();\n }\n });\n this.on('resume', () => {\n response.resume();\n });\n this.on('pause', () => {\n response.pause();\n });\n response.once('end', () => {\n this.push(null);\n });\n this.emit('response', response);\n for (const destination of this[kServerResponsesPiped]) {\n if (destination.headersSent) {\n continue;\n }\n // eslint-disable-next-line guard-for-in\n for (const key in response.headers) {\n const isAllowed = options.decompress ? key !== 'content-encoding' : true;\n const value = response.headers[key];\n if (isAllowed) {\n destination.setHeader(key, value);\n }\n }\n destination.statusCode = statusCode;\n }\n }\n async _onResponse(response) {\n try {\n await this._onResponseBase(response);\n }\n catch (error) {\n /* istanbul ignore next: better safe than sorry */\n this._beforeError(error);\n }\n }\n _onRequest(request) {\n const { options } = this;\n const { timeout, url } = options;\n http_timer_1.default(request);\n this[kCancelTimeouts] = timed_out_1.default(request, timeout, url);\n const responseEventName = options.cache ? 'cacheableResponse' : 'response';\n request.once(responseEventName, (response) => {\n void this._onResponse(response);\n });\n request.once('error', (error) => {\n var _a;\n // Force clean-up, because some packages (e.g. nock) don't do this.\n request.destroy();\n // Node.js <= 12.18.2 mistakenly emits the response `end` first.\n (_a = request.res) === null || _a === void 0 ? void 0 : _a.removeAllListeners('end');\n error = error instanceof timed_out_1.TimeoutError ? new TimeoutError(error, this.timings, this) : new RequestError(error.message, error, this);\n this._beforeError(error);\n });\n this[kUnproxyEvents] = proxy_events_1.default(request, this, proxiedRequestEvents);\n this[kRequest] = request;\n this.emit('uploadProgress', this.uploadProgress);\n // Send body\n const body = this[kBody];\n const currentRequest = this.redirects.length === 0 ? this : request;\n if (is_1.default.nodeStream(body)) {\n body.pipe(currentRequest);\n body.once('error', (error) => {\n this._beforeError(new UploadError(error, this));\n });\n }\n else {\n this._unlockWrite();\n if (!is_1.default.undefined(body)) {\n this._writeRequest(body, undefined, () => { });\n currentRequest.end();\n this._lockWrite();\n }\n else if (this._cannotHaveBody || this._noPipe) {\n currentRequest.end();\n this._lockWrite();\n }\n }\n this.emit('request', request);\n }\n async _createCacheableRequest(url, options) {\n return new Promise((resolve, reject) => {\n // TODO: Remove `utils/url-to-options.ts` when `cacheable-request` is fixed\n Object.assign(options, url_to_options_1.default(url));\n // `http-cache-semantics` checks this\n // TODO: Fix this ignore.\n // @ts-expect-error\n delete options.url;\n let request;\n // This is ugly\n const cacheRequest = cacheableStore.get(options.cache)(options, async (response) => {\n // TODO: Fix `cacheable-response`\n response._readableState.autoDestroy = false;\n if (request) {\n (await request).emit('cacheableResponse', response);\n }\n resolve(response);\n });\n // Restore options\n options.url = url;\n cacheRequest.once('error', reject);\n cacheRequest.once('request', async (requestOrPromise) => {\n request = requestOrPromise;\n resolve(request);\n });\n });\n }\n async _makeRequest() {\n var _a, _b, _c, _d, _e;\n const { options } = this;\n const { headers } = options;\n for (const key in headers) {\n if (is_1.default.undefined(headers[key])) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete headers[key];\n }\n else if (is_1.default.null_(headers[key])) {\n throw new TypeError(`Use \\`undefined\\` instead of \\`null\\` to delete the \\`${key}\\` header`);\n }\n }\n if (options.decompress && is_1.default.undefined(headers['accept-encoding'])) {\n headers['accept-encoding'] = supportsBrotli ? 'gzip, deflate, br' : 'gzip, deflate';\n }\n // Set cookies\n if (options.cookieJar) {\n const cookieString = await options.cookieJar.getCookieString(options.url.toString());\n if (is_1.default.nonEmptyString(cookieString)) {\n options.headers.cookie = cookieString;\n }\n }\n for (const hook of options.hooks.beforeRequest) {\n // eslint-disable-next-line no-await-in-loop\n const result = await hook(options);\n if (!is_1.default.undefined(result)) {\n // @ts-expect-error Skip the type mismatch to support abstract responses\n options.request = () => result;\n break;\n }\n }\n if (options.body && this[kBody] !== options.body) {\n this[kBody] = options.body;\n }\n const { agent, request, timeout, url } = options;\n if (options.dnsCache && !('lookup' in options)) {\n options.lookup = options.dnsCache.lookup;\n }\n // UNIX sockets\n if (url.hostname === 'unix') {\n const matches = /(?<socketPath>.+?):(?<path>.+)/.exec(`${url.pathname}${url.search}`);\n if (matches === null || matches === void 0 ? void 0 : matches.groups) {\n const { socketPath, path } = matches.groups;\n Object.assign(options, {\n socketPath,\n path,\n host: ''\n });\n }\n }\n const isHttps = url.protocol === 'https:';\n // Fallback function\n let fallbackFn;\n if (options.http2) {\n fallbackFn = http2wrapper.auto;\n }\n else {\n fallbackFn = isHttps ? https.request : http.request;\n }\n const realFn = (_a = options.request) !== null && _a !== void 0 ? _a : fallbackFn;\n // Cache support\n const fn = options.cache ? this._createCacheableRequest : realFn;\n // Pass an agent directly when HTTP2 is disabled\n if (agent && !options.http2) {\n options.agent = agent[isHttps ? 'https' : 'http'];\n }\n // Prepare plain HTTP request options\n options[kRequest] = realFn;\n delete options.request;\n // TODO: Fix this ignore.\n // @ts-expect-error\n delete options.timeout;\n const requestOptions = options;\n requestOptions.shared = (_b = options.cacheOptions) === null || _b === void 0 ? void 0 : _b.shared;\n requestOptions.cacheHeuristic = (_c = options.cacheOptions) === null || _c === void 0 ? void 0 : _c.cacheHeuristic;\n requestOptions.immutableMinTimeToLive = (_d = options.cacheOptions) === null || _d === void 0 ? void 0 : _d.immutableMinTimeToLive;\n requestOptions.ignoreCargoCult = (_e = options.cacheOptions) === null || _e === void 0 ? void 0 : _e.ignoreCargoCult;\n // If `dnsLookupIpVersion` is not present do not override `family`\n if (options.dnsLookupIpVersion !== undefined) {\n try {\n requestOptions.family = dns_ip_version_1.dnsLookupIpVersionToFamily(options.dnsLookupIpVersion);\n }\n catch (_f) {\n throw new Error('Invalid `dnsLookupIpVersion` option value');\n }\n }\n // HTTPS options remapping\n if (options.https) {\n if ('rejectUnauthorized' in options.https) {\n requestOptions.rejectUnauthorized = options.https.rejectUnauthorized;\n }\n if (options.https.checkServerIdentity) {\n requestOptions.checkServerIdentity = options.https.checkServerIdentity;\n }\n if (options.https.certificateAuthority) {\n requestOptions.ca = options.https.certificateAuthority;\n }\n if (options.https.certificate) {\n requestOptions.cert = options.https.certificate;\n }\n if (options.https.key) {\n requestOptions.key = options.https.key;\n }\n if (options.https.passphrase) {\n requestOptions.passphrase = options.https.passphrase;\n }\n if (options.https.pfx) {\n requestOptions.pfx = options.https.pfx;\n }\n }\n try {\n let requestOrResponse = await fn(url, requestOptions);\n if (is_1.default.undefined(requestOrResponse)) {\n requestOrResponse = fallbackFn(url, requestOptions);\n }\n // Restore options\n options.request = request;\n options.timeout = timeout;\n options.agent = agent;\n // HTTPS options restore\n if (options.https) {\n if ('rejectUnauthorized' in options.https) {\n delete requestOptions.rejectUnauthorized;\n }\n if (options.https.checkServerIdentity) {\n // @ts-expect-error - This one will be removed when we remove the alias.\n delete requestOptions.checkServerIdentity;\n }\n if (options.https.certificateAuthority) {\n delete requestOptions.ca;\n }\n if (options.https.certificate) {\n delete requestOptions.cert;\n }\n if (options.https.key) {\n delete requestOptions.key;\n }\n if (options.https.passphrase) {\n delete requestOptions.passphrase;\n }\n if (options.https.pfx) {\n delete requestOptions.pfx;\n }\n }\n if (isClientRequest(requestOrResponse)) {\n this._onRequest(requestOrResponse);\n // Emit the response after the stream has been ended\n }\n else if (this.writable) {\n this.once('finish', () => {\n void this._onResponse(requestOrResponse);\n });\n this._unlockWrite();\n this.end();\n this._lockWrite();\n }\n else {\n void this._onResponse(requestOrResponse);\n }\n }\n catch (error) {\n if (error instanceof CacheableRequest.CacheError) {\n throw new CacheError(error, this);\n }\n throw new RequestError(error.message, error, this);\n }\n }\n async _error(error) {\n try {\n for (const hook of this.options.hooks.beforeError) {\n // eslint-disable-next-line no-await-in-loop\n error = await hook(error);\n }\n }\n catch (error_) {\n error = new RequestError(error_.message, error_, this);\n }\n this.destroy(error);\n }\n _beforeError(error) {\n if (this[kStopReading]) {\n return;\n }\n const { options } = this;\n const retryCount = this.retryCount + 1;\n this[kStopReading] = true;\n if (!(error instanceof RequestError)) {\n error = new RequestError(error.message, error, this);\n }\n const typedError = error;\n const { response } = typedError;\n void (async () => {\n if (response && !response.body) {\n response.setEncoding(this._readableState.encoding);\n try {\n response.rawBody = await get_buffer_1.default(response);\n response.body = response.rawBody.toString();\n }\n catch (_a) { }\n }\n if (this.listenerCount('retry') !== 0) {\n let backoff;\n try {\n let retryAfter;\n if (response && 'retry-after' in response.headers) {\n retryAfter = Number(response.headers['retry-after']);\n if (Number.isNaN(retryAfter)) {\n retryAfter = Date.parse(response.headers['retry-after']) - Date.now();\n if (retryAfter <= 0) {\n retryAfter = 1;\n }\n }\n else {\n retryAfter *= 1000;\n }\n }\n backoff = await options.retry.calculateDelay({\n attemptCount: retryCount,\n retryOptions: options.retry,\n error: typedError,\n retryAfter,\n computedValue: calculate_retry_delay_1.default({\n attemptCount: retryCount,\n retryOptions: options.retry,\n error: typedError,\n retryAfter,\n computedValue: 0\n })\n });\n }\n catch (error_) {\n void this._error(new RequestError(error_.message, error_, this));\n return;\n }\n if (backoff) {\n const retry = async () => {\n try {\n for (const hook of this.options.hooks.beforeRetry) {\n // eslint-disable-next-line no-await-in-loop\n await hook(this.options, typedError, retryCount);\n }\n }\n catch (error_) {\n void this._error(new RequestError(error_.message, error, this));\n return;\n }\n // Something forced us to abort the retry\n if (this.destroyed) {\n return;\n }\n this.destroy();\n this.emit('retry', retryCount, error);\n };\n this[kRetryTimeout] = setTimeout(retry, backoff);\n return;\n }\n }\n void this._error(typedError);\n })();\n }\n _read() {\n this[kTriggerRead] = true;\n const response = this[kResponse];\n if (response && !this[kStopReading]) {\n // We cannot put this in the `if` above\n // because `.read()` also triggers the `end` event\n if (response.readableLength) {\n this[kTriggerRead] = false;\n }\n let data;\n while ((data = response.read()) !== null) {\n this[kDownloadedSize] += data.length;\n this[kStartedReading] = true;\n const progress = this.downloadProgress;\n if (progress.percent < 1) {\n this.emit('downloadProgress', progress);\n }\n this.push(data);\n }\n }\n }\n // Node.js 12 has incorrect types, so the encoding must be a string\n _write(chunk, encoding, callback) {\n const write = () => {\n this._writeRequest(chunk, encoding, callback);\n };\n if (this.requestInitialized) {\n write();\n }\n else {\n this[kJobs].push(write);\n }\n }\n _writeRequest(chunk, encoding, callback) {\n if (this[kRequest].destroyed) {\n // Probably the `ClientRequest` instance will throw\n return;\n }\n this._progressCallbacks.push(() => {\n this[kUploadedSize] += Buffer.byteLength(chunk, encoding);\n const progress = this.uploadProgress;\n if (progress.percent < 1) {\n this.emit('uploadProgress', progress);\n }\n });\n // TODO: What happens if it's from cache? Then this[kRequest] won't be defined.\n this[kRequest].write(chunk, encoding, (error) => {\n if (!error && this._progressCallbacks.length > 0) {\n this._progressCallbacks.shift()();\n }\n callback(error);\n });\n }\n _final(callback) {\n const endRequest = () => {\n // FIX: Node.js 10 calls the write callback AFTER the end callback!\n while (this._progressCallbacks.length !== 0) {\n this._progressCallbacks.shift()();\n }\n // We need to check if `this[kRequest]` is present,\n // because it isn't when we use cache.\n if (!(kRequest in this)) {\n callback();\n return;\n }\n if (this[kRequest].destroyed) {\n callback();\n return;\n }\n this[kRequest].end((error) => {\n if (!error) {\n this[kBodySize] = this[kUploadedSize];\n this.emit('uploadProgress', this.uploadProgress);\n this[kRequest].emit('upload-complete');\n }\n callback(error);\n });\n };\n if (this.requestInitialized) {\n endRequest();\n }\n else {\n this[kJobs].push(endRequest);\n }\n }\n _destroy(error, callback) {\n var _a;\n this[kStopReading] = true;\n // Prevent further retries\n clearTimeout(this[kRetryTimeout]);\n if (kRequest in this) {\n this[kCancelTimeouts]();\n // TODO: Remove the next `if` when these get fixed:\n // - https://github.com/nodejs/node/issues/32851\n if (!((_a = this[kResponse]) === null || _a === void 0 ? void 0 : _a.complete)) {\n this[kRequest].destroy();\n }\n }\n if (error !== null && !is_1.default.undefined(error) && !(error instanceof RequestError)) {\n error = new RequestError(error.message, error, this);\n }\n callback(error);\n }\n get _isAboutToError() {\n return this[kStopReading];\n }\n /**\n The remote IP address.\n */\n get ip() {\n var _a;\n return (_a = this.socket) === null || _a === void 0 ? void 0 : _a.remoteAddress;\n }\n /**\n Indicates whether the request has been aborted or not.\n */\n get aborted() {\n var _a, _b, _c;\n return ((_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroyed) !== null && _b !== void 0 ? _b : this.destroyed) && !((_c = this[kOriginalResponse]) === null || _c === void 0 ? void 0 : _c.complete);\n }\n get socket() {\n var _a, _b;\n return (_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.socket) !== null && _b !== void 0 ? _b : undefined;\n }\n /**\n Progress event for downloading (receiving a response).\n */\n get downloadProgress() {\n let percent;\n if (this[kResponseSize]) {\n percent = this[kDownloadedSize] / this[kResponseSize];\n }\n else if (this[kResponseSize] === this[kDownloadedSize]) {\n percent = 1;\n }\n else {\n percent = 0;\n }\n return {\n percent,\n transferred: this[kDownloadedSize],\n total: this[kResponseSize]\n };\n }\n /**\n Progress event for uploading (sending a request).\n */\n get uploadProgress() {\n let percent;\n if (this[kBodySize]) {\n percent = this[kUploadedSize] / this[kBodySize];\n }\n else if (this[kBodySize] === this[kUploadedSize]) {\n percent = 1;\n }\n else {\n percent = 0;\n }\n return {\n percent,\n transferred: this[kUploadedSize],\n total: this[kBodySize]\n };\n }\n /**\n The object contains the following properties:\n\n - `start` - Time when the request started.\n - `socket` - Time when a socket was assigned to the request.\n - `lookup` - Time when the DNS lookup finished.\n - `connect` - Time when the socket successfully connected.\n - `secureConnect` - Time when the socket securely connected.\n - `upload` - Time when the request finished uploading.\n - `response` - Time when the request fired `response` event.\n - `end` - Time when the response fired `end` event.\n - `error` - Time when the request fired `error` event.\n - `abort` - Time when the request fired `abort` event.\n - `phases`\n - `wait` - `timings.socket - timings.start`\n - `dns` - `timings.lookup - timings.socket`\n - `tcp` - `timings.connect - timings.lookup`\n - `tls` - `timings.secureConnect - timings.connect`\n - `request` - `timings.upload - (timings.secureConnect || timings.connect)`\n - `firstByte` - `timings.response - timings.upload`\n - `download` - `timings.end - timings.response`\n - `total` - `(timings.end || timings.error || timings.abort) - timings.start`\n\n If something has not been measured yet, it will be `undefined`.\n\n __Note__: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.\n */\n get timings() {\n var _a;\n return (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.timings;\n }\n /**\n Whether the response was retrieved from the cache.\n */\n get isFromCache() {\n return this[kIsFromCache];\n }\n pipe(destination, options) {\n if (this[kStartedReading]) {\n throw new Error('Failed to pipe. The response has been emitted already.');\n }\n if (destination instanceof http_1.ServerResponse) {\n this[kServerResponsesPiped].add(destination);\n }\n return super.pipe(destination, options);\n }\n unpipe(destination) {\n if (destination instanceof http_1.ServerResponse) {\n this[kServerResponsesPiped].delete(destination);\n }\n super.unpipe(destination);\n return this;\n }\n}\nexports.default = Request;\n\n\n//# sourceURL=webpack:///./node_modules/got/dist/source/core/index.js?");
|
|
15568
15568
|
|
|
15569
15569
|
/***/ }),
|
|
15570
15570
|
|
|
@@ -31238,7 +31238,7 @@ eval("\n\n// ref: https://github.com/tc39/proposal-global\nvar getGlobal = funct
|
|
|
31238
31238
|
/***/ (function(module, exports, __webpack_require__) {
|
|
31239
31239
|
|
|
31240
31240
|
"use strict";
|
|
31241
|
-
eval("\n
|
|
31241
|
+
eval("\n\n// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\nconst DATA_URL_DEFAULT_MIME_TYPE = 'text/plain';\nconst DATA_URL_DEFAULT_CHARSET = 'us-ascii';\n\nconst testParameter = (name, filters) => {\n\treturn filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);\n};\n\nconst normalizeDataURL = (urlString, {stripHash}) => {\n\tconst match = /^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(urlString);\n\n\tif (!match) {\n\t\tthrow new Error(`Invalid URL: ${urlString}`);\n\t}\n\n\tlet {type, data, hash} = match.groups;\n\tconst mediaType = type.split(';');\n\thash = stripHash ? '' : hash;\n\n\tlet isBase64 = false;\n\tif (mediaType[mediaType.length - 1] === 'base64') {\n\t\tmediaType.pop();\n\t\tisBase64 = true;\n\t}\n\n\t// Lowercase MIME type\n\tconst mimeType = (mediaType.shift() || '').toLowerCase();\n\tconst attributes = mediaType\n\t\t.map(attribute => {\n\t\t\tlet [key, value = ''] = attribute.split('=').map(string => string.trim());\n\n\t\t\t// Lowercase `charset`\n\t\t\tif (key === 'charset') {\n\t\t\t\tvalue = value.toLowerCase();\n\n\t\t\t\tif (value === DATA_URL_DEFAULT_CHARSET) {\n\t\t\t\t\treturn '';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn `${key}${value ? `=${value}` : ''}`;\n\t\t})\n\t\t.filter(Boolean);\n\n\tconst normalizedMediaType = [\n\t\t...attributes\n\t];\n\n\tif (isBase64) {\n\t\tnormalizedMediaType.push('base64');\n\t}\n\n\tif (normalizedMediaType.length !== 0 || (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE)) {\n\t\tnormalizedMediaType.unshift(mimeType);\n\t}\n\n\treturn `data:${normalizedMediaType.join(';')},${isBase64 ? data.trim() : data}${hash ? `#${hash}` : ''}`;\n};\n\nconst normalizeUrl = (urlString, options) => {\n\toptions = {\n\t\tdefaultProtocol: 'http:',\n\t\tnormalizeProtocol: true,\n\t\tforceHttp: false,\n\t\tforceHttps: false,\n\t\tstripAuthentication: true,\n\t\tstripHash: false,\n\t\tstripTextFragment: true,\n\t\tstripWWW: true,\n\t\tremoveQueryParameters: [/^utm_\\w+/i],\n\t\tremoveTrailingSlash: true,\n\t\tremoveSingleSlash: true,\n\t\tremoveDirectoryIndex: false,\n\t\tsortQueryParameters: true,\n\t\t...options\n\t};\n\n\turlString = urlString.trim();\n\n\t// Data URL\n\tif (/^data:/i.test(urlString)) {\n\t\treturn normalizeDataURL(urlString, options);\n\t}\n\n\tif (/^view-source:/i.test(urlString)) {\n\t\tthrow new Error('`view-source:` is not supported as it is a non-standard protocol');\n\t}\n\n\tconst hasRelativeProtocol = urlString.startsWith('//');\n\tconst isRelativeUrl = !hasRelativeProtocol && /^\\.*\\//.test(urlString);\n\n\t// Prepend protocol\n\tif (!isRelativeUrl) {\n\t\turlString = urlString.replace(/^(?!(?:\\w+:)?\\/\\/)|^\\/\\//, options.defaultProtocol);\n\t}\n\n\tconst urlObj = new URL(urlString);\n\n\tif (options.forceHttp && options.forceHttps) {\n\t\tthrow new Error('The `forceHttp` and `forceHttps` options cannot be used together');\n\t}\n\n\tif (options.forceHttp && urlObj.protocol === 'https:') {\n\t\turlObj.protocol = 'http:';\n\t}\n\n\tif (options.forceHttps && urlObj.protocol === 'http:') {\n\t\turlObj.protocol = 'https:';\n\t}\n\n\t// Remove auth\n\tif (options.stripAuthentication) {\n\t\turlObj.username = '';\n\t\turlObj.password = '';\n\t}\n\n\t// Remove hash\n\tif (options.stripHash) {\n\t\turlObj.hash = '';\n\t} else if (options.stripTextFragment) {\n\t\turlObj.hash = urlObj.hash.replace(/#?:~:text.*?$/i, '');\n\t}\n\n\t// Remove duplicate slashes if not preceded by a protocol\n\tif (urlObj.pathname) {\n\t\turlObj.pathname = urlObj.pathname.replace(/(?<!\\b(?:[a-z][a-z\\d+\\-.]{1,50}:))\\/{2,}/g, '/');\n\t}\n\n\t// Decode URI octets\n\tif (urlObj.pathname) {\n\t\ttry {\n\t\t\turlObj.pathname = decodeURI(urlObj.pathname);\n\t\t} catch (_) {}\n\t}\n\n\t// Remove directory index\n\tif (options.removeDirectoryIndex === true) {\n\t\toptions.removeDirectoryIndex = [/^index\\.[a-z]+$/];\n\t}\n\n\tif (Array.isArray(options.removeDirectoryIndex) && options.removeDirectoryIndex.length > 0) {\n\t\tlet pathComponents = urlObj.pathname.split('/');\n\t\tconst lastComponent = pathComponents[pathComponents.length - 1];\n\n\t\tif (testParameter(lastComponent, options.removeDirectoryIndex)) {\n\t\t\tpathComponents = pathComponents.slice(0, pathComponents.length - 1);\n\t\t\turlObj.pathname = pathComponents.slice(1).join('/') + '/';\n\t\t}\n\t}\n\n\tif (urlObj.hostname) {\n\t\t// Remove trailing dot\n\t\turlObj.hostname = urlObj.hostname.replace(/\\.$/, '');\n\n\t\t// Remove `www.`\n\t\tif (options.stripWWW && /^www\\.(?!www\\.)(?:[a-z\\-\\d]{1,63})\\.(?:[a-z.\\-\\d]{2,63})$/.test(urlObj.hostname)) {\n\t\t\t// Each label should be max 63 at length (min: 1).\n\t\t\t// Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names\n\t\t\t// Each TLD should be up to 63 characters long (min: 2).\n\t\t\t// It is technically possible to have a single character TLD, but none currently exist.\n\t\t\turlObj.hostname = urlObj.hostname.replace(/^www\\./, '');\n\t\t}\n\t}\n\n\t// Remove query unwanted parameters\n\tif (Array.isArray(options.removeQueryParameters)) {\n\t\tfor (const key of [...urlObj.searchParams.keys()]) {\n\t\t\tif (testParameter(key, options.removeQueryParameters)) {\n\t\t\t\turlObj.searchParams.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (options.removeQueryParameters === true) {\n\t\turlObj.search = '';\n\t}\n\n\t// Sort query parameters\n\tif (options.sortQueryParameters) {\n\t\turlObj.searchParams.sort();\n\t}\n\n\tif (options.removeTrailingSlash) {\n\t\turlObj.pathname = urlObj.pathname.replace(/\\/$/, '');\n\t}\n\n\tconst oldUrlString = urlString;\n\n\t// Take advantage of many of the Node `url` normalizations\n\turlString = urlObj.toString();\n\n\tif (!options.removeSingleSlash && urlObj.pathname === '/' && !oldUrlString.endsWith('/') && urlObj.hash === '') {\n\t\turlString = urlString.replace(/\\/$/, '');\n\t}\n\n\t// Remove ending `/` unless removeSingleSlash is false\n\tif ((options.removeTrailingSlash || urlObj.pathname === '/') && urlObj.hash === '' && options.removeSingleSlash) {\n\t\turlString = urlString.replace(/\\/$/, '');\n\t}\n\n\t// Restore relative protocol, if applicable\n\tif (hasRelativeProtocol && !options.normalizeProtocol) {\n\t\turlString = urlString.replace(/^http:\\/\\//, '//');\n\t}\n\n\t// Remove http/https\n\tif (options.stripProtocol) {\n\t\turlString = urlString.replace(/^(?:https?:)?\\/\\//, '');\n\t}\n\n\treturn urlString;\n};\n\nmodule.exports = normalizeUrl;\n\n\n//# sourceURL=webpack:///./node_modules/normalize-url/index.js?");
|
|
31242
31242
|
|
|
31243
31243
|
/***/ }),
|
|
31244
31244
|
|
|
@@ -35352,29 +35352,7 @@ eval("const fs = __webpack_require__(/*! fs */ \"fs\")\n\nconst version = proces
|
|
|
35352
35352
|
/***/ (function(module, exports, __webpack_require__) {
|
|
35353
35353
|
|
|
35354
35354
|
"use strict";
|
|
35355
|
-
eval("/**\n * @fileOverview\n * A simple promises-based check to see if a TCP port is already in use.\n */\n\n\n// define the exports first to avoid cyclic dependencies.\nexports.check = check;\nexports.waitUntilFreeOnHost = waitUntilFreeOnHost;\nexports.waitUntilFree = waitUntilFree;\nexports.waitUntilUsedOnHost = waitUntilUsedOnHost;\nexports.waitUntilUsed = waitUntilUsed;\nexports.waitForStatus = waitForStatus;\n\nvar is = __webpack_require__(/*! is2 */ \"./node_modules/is2/index.js\");\nvar net = __webpack_require__(/*! net */ \"net\");\nvar util = __webpack_require__(/*! util */ \"util\");\nvar debug = __webpack_require__(/*! debug */ \"./node_modules/tcp-port-used/node_modules/debug/src/browser.js\")('tcp-port-used');\n\n// Global Values\nvar TIMEOUT = 2000;\nvar RETRYTIME = 250;\n\nfunction getDeferred() {\n var resolve, reject, promise = new Promise(function(res, rej) {\n resolve = res;\n reject = rej;\n });\n\n return {\n resolve: resolve,\n reject: reject,\n promise: promise\n };\n}\n\n/**\n * Creates an options object from all the possible arguments\n * @private\n * @param {Number} port a valid TCP port number\n * @param {String} host The DNS name or IP address.\n * @param {Boolean} status The desired in use status to wait for: false === not in use, true === in use\n * @param {Number} retryTimeMs the retry interval in milliseconds - defaultis is 200ms\n * @param {Number} timeOutMs the amount of time to wait until port is free default is 1000ms\n * @return {Object} An options object with all the above parameters as properties.\n */\nfunction makeOptionsObj(port, host, inUse, retryTimeMs, timeOutMs) {\n var opts = {};\n opts.port = port;\n opts.host = host;\n opts.inUse = inUse;\n opts.retryTimeMs = retryTimeMs;\n opts.timeOutMs = timeOutMs;\n return opts;\n}\n\n/**\n * Checks if a TCP port is in use by creating the socket and binding it to the\n * target port. Once bound, successfully, it's assume the port is availble.\n * After the socket is closed or in error, the promise is resolved.\n * Note: you have to be super user to correctly test system ports (0-1023).\n * @param {Number|Object} port The port you are curious to see if available. If an object, must have the parameters as properties.\n * @param {String} [host] May be a DNS name or IP address. Default '127.0.0.1'\n * @return {Object} A deferred Q promise.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.check(22, '127.0.0.1')\n * .then(function(inUse) {\n * debug('Port 22 usage: '+inUse);\n * }, function(err) {\n * console.error('Error on check: '+util.inspect(err));\n * });\n */\nfunction check(port, host) {\n\n var deferred = getDeferred();\n var inUse = true;\n var client;\n\n var opts;\n if (!is.obj(port)) {\n opts = makeOptionsObj(port, host);\n } else {\n opts = port;\n }\n\n if (!is.port(opts.port)) {\n debug('Error invalid port: '+util.inspect(opts.port));\n deferred.reject(new Error('invalid port: '+util.inspect(opts.port)));\n return deferred.promise;\n }\n\n if (is.nullOrUndefined(opts.host)) {\n debug('set host address to default 127.0.0.1');\n opts.host = '127.0.0.1';\n }\n\n function cleanUp() {\n if (client) {\n client.removeAllListeners('connect');\n client.removeAllListeners('error');\n client.end();\n client.destroy();\n client.unref();\n }\n //debug('listeners removed from client socket');\n }\n\n function onConnectCb() {\n //debug('check - promise resolved - in use');\n deferred.resolve(inUse);\n cleanUp();\n }\n\n function onErrorCb(err) {\n if (err.code !== 'ECONNREFUSED') {\n //debug('check - promise rejected, error: '+err.message);\n deferred.reject(err);\n } else {\n //debug('ECONNREFUSED');\n inUse = false;\n //debug('check - promise resolved - not in use');\n deferred.resolve(inUse);\n }\n cleanUp();\n }\n\n client = new net.Socket();\n client.once('connect', onConnectCb);\n client.once('error', onErrorCb);\n client.connect({port: opts.port, host: opts.host}, function() {});\n\n return deferred.promise;\n}\n\n/**\n * Creates a deferred promise and fulfills it only when the socket's usage\n * equals status in terms of 'in use' (false === not in use, true === in use).\n * Will retry on an interval specified in retryTimeMs. Note: you have to be\n * super user to correctly test system ports (0-1023).\n * @param {Number|Object} port a valid TCP port number, if an object, has all the parameters described as properties.\n * @param {String} host The DNS name or IP address.\n * @param {Boolean} status The desired in use status to wait for false === not in use, true === in use\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 200ms\n * @param {Number} [timeOutMs] the amount of time to wait until port is free default is 1000ms\n * @return {Object} A deferred promise from the Q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitForStatus(44204, 'some.host.com', true, 500, 4000)\n * .then(function() {\n * console.log('Port 44204 is now in use.');\n * }, function(err) {\n * console.log('Error: ', error.message);\n * });\n */\nfunction waitForStatus(port, host, inUse, retryTimeMs, timeOutMs) {\n\n var deferred = getDeferred();\n var timeoutId;\n var timedout = false;\n var retryId;\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n } else {\n opts = makeOptionsObj(port, host, inUse, retryTimeMs, timeOutMs);\n }\n\n //debug('opts:'+util.inspect(opts);\n\n if (!is.bool(opts.inUse)) {\n deferred.reject(new Error('inUse must be a boolean'));\n return deferred.promise;\n }\n\n if (!is.positiveInt(opts.retryTimeMs)) {\n opts.retryTimeMs = RETRYTIME;\n debug('set retryTime to default '+RETRYTIME+'ms');\n }\n\n if (!is.positiveInt(opts.timeOutMs)) {\n opts.timeOutMs = TIMEOUT;\n debug('set timeOutMs to default '+TIMEOUT+'ms');\n }\n\n function cleanUp() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (retryId) {\n clearTimeout(retryId);\n }\n }\n\n function timeoutFunc() {\n timedout = true;\n cleanUp();\n deferred.reject(new Error('timeout'));\n }\n timeoutId = setTimeout(timeoutFunc, opts.timeOutMs);\n\n function doCheck() {\n check(opts.port, opts.host)\n .then(function(inUse) {\n if (timedout) {\n return;\n }\n //debug('doCheck inUse: '+inUse);\n //debug('doCheck opts.inUse: '+opts.inUse);\n if (inUse === opts.inUse) {\n deferred.resolve();\n cleanUp();\n return;\n } else {\n retryId = setTimeout(function() { doCheck(); }, opts.retryTimeMs);\n return;\n }\n }, function(err) {\n if (timedout) {\n return;\n }\n deferred.reject(err);\n cleanUp();\n });\n }\n\n doCheck();\n return deferred.promise;\n}\n\n/**\n * Creates a deferred promise and fulfills it only when the socket is free.\n * Will retry on an interval specified in retryTimeMs.\n * Note: you have to be super user to correctly test system ports (0-1023).\n * @param {Number} port a valid TCP port number\n * @param {String} [host] The hostname or IP address of where the socket is.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 100ms.\n * @param {Number} [timeOutMs] the amount of time to wait until port is free. Default 300ms.\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilFreeOnHost(44203, 'some.host.com', 500, 4000)\n * .then(function() {\n * console.log('Port 44203 is now free.');\n * }, function(err) {\n * console.loh('Error: ', error.message);\n * });\n */\nfunction waitUntilFreeOnHost(port, host, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.inUse = false;\n } else {\n opts = makeOptionsObj(port, host, false, retryTimeMs, timeOutMs);\n }\n\n return waitForStatus(opts);\n}\n\n/**\n * For compatibility with previous version of the module, that did not provide\n * arguements for hostnames. The host is set to the localhost '127.0.0.1'.\n * @param {Number|Object} port a valid TCP port number. If an object, must contain all the parameters as properties.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 100ms.\n * @param {Number} [timeOutMs] the amount of time to wait until port is free. Default 300ms.\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilFree(44203, 500, 4000)\n * .then(function() {\n * console.log('Port 44203 is now free.');\n * }, function(err) {\n * console.loh('Error: ', error.message);\n * });\n */\nfunction waitUntilFree(port, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.host = '127.0.0.1';\n opts.inUse = false;\n } else {\n opts = makeOptionsObj(port, '127.0.0.1', false, retryTimeMs, timeOutMs);\n }\n\n return waitForStatus(opts);\n}\n\n/**\n * Creates a deferred promise and fulfills it only when the socket is used.\n * Will retry on an interval specified in retryTimeMs.\n * Note: you have to be super user to correctly test system ports (0-1023).\n * @param {Number|Object} port a valid TCP port number. If an object, must contain all the parameters as properties.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 500ms\n * @param {Number} [timeOutMs] the amount of time to wait until port is free\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilUsedOnHost(44204, 'some.host.com', 500, 4000)\n * .then(function() {\n * console.log('Port 44204 is now in use.');\n * }, function(err) {\n * console.log('Error: ', error.message);\n * });\n */\nfunction waitUntilUsedOnHost(port, host, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.inUse = true;\n } else {\n opts = makeOptionsObj(port, host, true, retryTimeMs, timeOutMs);\n }\n\n return waitForStatus(opts);\n}\n\n/**\n * For compatibility to previous version of module which did not have support\n * for host addresses. This function works only for localhost.\n * @param {Number} port a valid TCP port number. If an Object, must contain all the parameters as properties.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 500ms\n * @param {Number} [timeOutMs] the amount of time to wait until port is free\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilUsed(44204, 500, 4000)\n * .then(function() {\n * console.log('Port 44204 is now in use.');\n * }, function(err) {\n * console.log('Error: ', error.message);\n * });\n */\nfunction waitUntilUsed(port, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.host = '127.0.0.1';\n opts.inUse = true;\n } else {\n opts = makeOptionsObj(port, '127.0.0.1', true, retryTimeMs, timeOutMs);\n }\n\n return waitUntilUsedOnHost(opts);\n}\n\n\n\n//# sourceURL=webpack:///./node_modules/tcp-port-used/index.js?");
|
|
35356
|
-
|
|
35357
|
-
/***/ }),
|
|
35358
|
-
|
|
35359
|
-
/***/ "./node_modules/tcp-port-used/node_modules/debug/src/browser.js":
|
|
35360
|
-
/*!**********************************************************************!*\
|
|
35361
|
-
!*** ./node_modules/tcp-port-used/node_modules/debug/src/browser.js ***!
|
|
35362
|
-
\**********************************************************************/
|
|
35363
|
-
/*! no static exports found */
|
|
35364
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
35365
|
-
|
|
35366
|
-
eval("/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = __webpack_require__(/*! ./common */ \"./node_modules/tcp-port-used/node_modules/debug/src/common.js\")(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n\n\n//# sourceURL=webpack:///./node_modules/tcp-port-used/node_modules/debug/src/browser.js?");
|
|
35367
|
-
|
|
35368
|
-
/***/ }),
|
|
35369
|
-
|
|
35370
|
-
/***/ "./node_modules/tcp-port-used/node_modules/debug/src/common.js":
|
|
35371
|
-
/*!*********************************************************************!*\
|
|
35372
|
-
!*** ./node_modules/tcp-port-used/node_modules/debug/src/common.js ***!
|
|
35373
|
-
\*********************************************************************/
|
|
35374
|
-
/*! no static exports found */
|
|
35375
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
35376
|
-
|
|
35377
|
-
eval("\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = __webpack_require__(/*! ms */ \"./node_modules/ms/index.js\");\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n\n\n//# sourceURL=webpack:///./node_modules/tcp-port-used/node_modules/debug/src/common.js?");
|
|
35355
|
+
eval("/**\n * @fileOverview\n * A simple promises-based check to see if a TCP port is already in use.\n */\n\n\n// define the exports first to avoid cyclic dependencies.\nexports.check = check;\nexports.waitUntilFreeOnHost = waitUntilFreeOnHost;\nexports.waitUntilFree = waitUntilFree;\nexports.waitUntilUsedOnHost = waitUntilUsedOnHost;\nexports.waitUntilUsed = waitUntilUsed;\nexports.waitForStatus = waitForStatus;\n\nvar is = __webpack_require__(/*! is2 */ \"./node_modules/is2/index.js\");\nvar net = __webpack_require__(/*! net */ \"net\");\nvar util = __webpack_require__(/*! util */ \"util\");\nvar debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('tcp-port-used');\n\n// Global Values\nvar TIMEOUT = 2000;\nvar RETRYTIME = 250;\n\nfunction getDeferred() {\n var resolve, reject, promise = new Promise(function(res, rej) {\n resolve = res;\n reject = rej;\n });\n\n return {\n resolve: resolve,\n reject: reject,\n promise: promise\n };\n}\n\n/**\n * Creates an options object from all the possible arguments\n * @private\n * @param {Number} port a valid TCP port number\n * @param {String} host The DNS name or IP address.\n * @param {Boolean} status The desired in use status to wait for: false === not in use, true === in use\n * @param {Number} retryTimeMs the retry interval in milliseconds - defaultis is 200ms\n * @param {Number} timeOutMs the amount of time to wait until port is free default is 1000ms\n * @return {Object} An options object with all the above parameters as properties.\n */\nfunction makeOptionsObj(port, host, inUse, retryTimeMs, timeOutMs) {\n var opts = {};\n opts.port = port;\n opts.host = host;\n opts.inUse = inUse;\n opts.retryTimeMs = retryTimeMs;\n opts.timeOutMs = timeOutMs;\n return opts;\n}\n\n/**\n * Checks if a TCP port is in use by creating the socket and binding it to the\n * target port. Once bound, successfully, it's assume the port is availble.\n * After the socket is closed or in error, the promise is resolved.\n * Note: you have to be super user to correctly test system ports (0-1023).\n * @param {Number|Object} port The port you are curious to see if available. If an object, must have the parameters as properties.\n * @param {String} [host] May be a DNS name or IP address. Default '127.0.0.1'\n * @return {Object} A deferred Q promise.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.check(22, '127.0.0.1')\n * .then(function(inUse) {\n * debug('Port 22 usage: '+inUse);\n * }, function(err) {\n * console.error('Error on check: '+util.inspect(err));\n * });\n */\nfunction check(port, host) {\n\n var deferred = getDeferred();\n var inUse = true;\n var client;\n\n var opts;\n if (!is.obj(port)) {\n opts = makeOptionsObj(port, host);\n } else {\n opts = port;\n }\n\n if (!is.port(opts.port)) {\n debug('Error invalid port: '+util.inspect(opts.port));\n deferred.reject(new Error('invalid port: '+util.inspect(opts.port)));\n return deferred.promise;\n }\n\n if (is.nullOrUndefined(opts.host)) {\n debug('set host address to default 127.0.0.1');\n opts.host = '127.0.0.1';\n }\n\n function cleanUp() {\n if (client) {\n client.removeAllListeners('connect');\n client.removeAllListeners('error');\n client.end();\n client.destroy();\n client.unref();\n }\n //debug('listeners removed from client socket');\n }\n\n function onConnectCb() {\n //debug('check - promise resolved - in use');\n deferred.resolve(inUse);\n cleanUp();\n }\n\n function onErrorCb(err) {\n if (err.code !== 'ECONNREFUSED') {\n //debug('check - promise rejected, error: '+err.message);\n deferred.reject(err);\n } else {\n //debug('ECONNREFUSED');\n inUse = false;\n //debug('check - promise resolved - not in use');\n deferred.resolve(inUse);\n }\n cleanUp();\n }\n\n client = new net.Socket();\n client.once('connect', onConnectCb);\n client.once('error', onErrorCb);\n client.connect({port: opts.port, host: opts.host}, function() {});\n\n return deferred.promise;\n}\n\n/**\n * Creates a deferred promise and fulfills it only when the socket's usage\n * equals status in terms of 'in use' (false === not in use, true === in use).\n * Will retry on an interval specified in retryTimeMs. Note: you have to be\n * super user to correctly test system ports (0-1023).\n * @param {Number|Object} port a valid TCP port number, if an object, has all the parameters described as properties.\n * @param {String} host The DNS name or IP address.\n * @param {Boolean} status The desired in use status to wait for false === not in use, true === in use\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 200ms\n * @param {Number} [timeOutMs] the amount of time to wait until port is free default is 1000ms\n * @return {Object} A deferred promise from the Q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitForStatus(44204, 'some.host.com', true, 500, 4000)\n * .then(function() {\n * console.log('Port 44204 is now in use.');\n * }, function(err) {\n * console.log('Error: ', error.message);\n * });\n */\nfunction waitForStatus(port, host, inUse, retryTimeMs, timeOutMs) {\n\n var deferred = getDeferred();\n var timeoutId;\n var timedout = false;\n var retryId;\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n } else {\n opts = makeOptionsObj(port, host, inUse, retryTimeMs, timeOutMs);\n }\n\n //debug('opts:'+util.inspect(opts);\n\n if (!is.bool(opts.inUse)) {\n deferred.reject(new Error('inUse must be a boolean'));\n return deferred.promise;\n }\n\n if (!is.positiveInt(opts.retryTimeMs)) {\n opts.retryTimeMs = RETRYTIME;\n debug('set retryTime to default '+RETRYTIME+'ms');\n }\n\n if (!is.positiveInt(opts.timeOutMs)) {\n opts.timeOutMs = TIMEOUT;\n debug('set timeOutMs to default '+TIMEOUT+'ms');\n }\n\n function cleanUp() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (retryId) {\n clearTimeout(retryId);\n }\n }\n\n function timeoutFunc() {\n timedout = true;\n cleanUp();\n deferred.reject(new Error('timeout'));\n }\n timeoutId = setTimeout(timeoutFunc, opts.timeOutMs);\n\n function doCheck() {\n check(opts.port, opts.host)\n .then(function(inUse) {\n if (timedout) {\n return;\n }\n //debug('doCheck inUse: '+inUse);\n //debug('doCheck opts.inUse: '+opts.inUse);\n if (inUse === opts.inUse) {\n deferred.resolve();\n cleanUp();\n return;\n } else {\n retryId = setTimeout(function() { doCheck(); }, opts.retryTimeMs);\n return;\n }\n }, function(err) {\n if (timedout) {\n return;\n }\n deferred.reject(err);\n cleanUp();\n });\n }\n\n doCheck();\n return deferred.promise;\n}\n\n/**\n * Creates a deferred promise and fulfills it only when the socket is free.\n * Will retry on an interval specified in retryTimeMs.\n * Note: you have to be super user to correctly test system ports (0-1023).\n * @param {Number} port a valid TCP port number\n * @param {String} [host] The hostname or IP address of where the socket is.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 100ms.\n * @param {Number} [timeOutMs] the amount of time to wait until port is free. Default 300ms.\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilFreeOnHost(44203, 'some.host.com', 500, 4000)\n * .then(function() {\n * console.log('Port 44203 is now free.');\n * }, function(err) {\n * console.loh('Error: ', error.message);\n * });\n */\nfunction waitUntilFreeOnHost(port, host, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.inUse = false;\n } else {\n opts = makeOptionsObj(port, host, false, retryTimeMs, timeOutMs);\n }\n\n return waitForStatus(opts);\n}\n\n/**\n * For compatibility with previous version of the module, that did not provide\n * arguements for hostnames. The host is set to the localhost '127.0.0.1'.\n * @param {Number|Object} port a valid TCP port number. If an object, must contain all the parameters as properties.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 100ms.\n * @param {Number} [timeOutMs] the amount of time to wait until port is free. Default 300ms.\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilFree(44203, 500, 4000)\n * .then(function() {\n * console.log('Port 44203 is now free.');\n * }, function(err) {\n * console.loh('Error: ', error.message);\n * });\n */\nfunction waitUntilFree(port, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.host = '127.0.0.1';\n opts.inUse = false;\n } else {\n opts = makeOptionsObj(port, '127.0.0.1', false, retryTimeMs, timeOutMs);\n }\n\n return waitForStatus(opts);\n}\n\n/**\n * Creates a deferred promise and fulfills it only when the socket is used.\n * Will retry on an interval specified in retryTimeMs.\n * Note: you have to be super user to correctly test system ports (0-1023).\n * @param {Number|Object} port a valid TCP port number. If an object, must contain all the parameters as properties.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 500ms\n * @param {Number} [timeOutMs] the amount of time to wait until port is free\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilUsedOnHost(44204, 'some.host.com', 500, 4000)\n * .then(function() {\n * console.log('Port 44204 is now in use.');\n * }, function(err) {\n * console.log('Error: ', error.message);\n * });\n */\nfunction waitUntilUsedOnHost(port, host, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.inUse = true;\n } else {\n opts = makeOptionsObj(port, host, true, retryTimeMs, timeOutMs);\n }\n\n return waitForStatus(opts);\n}\n\n/**\n * For compatibility to previous version of module which did not have support\n * for host addresses. This function works only for localhost.\n * @param {Number} port a valid TCP port number. If an Object, must contain all the parameters as properties.\n * @param {Number} [retryTimeMs] the retry interval in milliseconds - defaultis is 500ms\n * @param {Number} [timeOutMs] the amount of time to wait until port is free\n * @return {Object} A deferred promise from the q library.\n *\n * Example usage:\n *\n * var tcpPortUsed = require('tcp-port-used');\n * tcpPortUsed.waitUntilUsed(44204, 500, 4000)\n * .then(function() {\n * console.log('Port 44204 is now in use.');\n * }, function(err) {\n * console.log('Error: ', error.message);\n * });\n */\nfunction waitUntilUsed(port, retryTimeMs, timeOutMs) {\n\n // the first arument may be an object, if it is not, make an object\n var opts;\n if (is.obj(port)) {\n opts = port;\n opts.host = '127.0.0.1';\n opts.inUse = true;\n } else {\n opts = makeOptionsObj(port, '127.0.0.1', true, retryTimeMs, timeOutMs);\n }\n\n return waitUntilUsedOnHost(opts);\n}\n\n\n\n//# sourceURL=webpack:///./node_modules/tcp-port-used/index.js?");
|
|
35378
35356
|
|
|
35379
35357
|
/***/ }),
|
|
35380
35358
|
|
|
@@ -38376,7 +38354,7 @@ eval("class Node {\n\t/// value;\n\t/// next;\n\n\tconstructor(value) {\n\t\tthi
|
|
|
38376
38354
|
/*! exports provided: name, productName, description, homepage, version, main, copyright, license, author, scripts, config, engines, jest, build, dependencies, devDependencies, default */
|
|
38377
38355
|
/***/ (function(module) {
|
|
38378
38356
|
|
|
38379
|
-
eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"open-lens\\\",\\\"productName\\\":\\\"OpenLens\\\",\\\"description\\\":\\\"OpenLens - Open Source IDE for Kubernetes\\\",\\\"homepage\\\":\\\"https://github.com/lensapp/lens\\\",\\\"version\\\":\\\"5.3.0\\\",\\\"main\\\":\\\"static/build/main.js\\\",\\\"copyright\\\":\\\"© 2021 OpenLens Authors\\\",\\\"license\\\":\\\"MIT\\\",\\\"author\\\":{\\\"name\\\":\\\"OpenLens Authors\\\",\\\"email\\\":\\\"info@k8slens.dev\\\"},\\\"scripts\\\":{\\\"dev\\\":\\\"concurrently -i -k \\\\\\\"yarn run dev-run -C\\\\\\\" yarn:dev:*\\\",\\\"dev-build\\\":\\\"concurrently yarn:compile:*\\\",\\\"debug-build\\\":\\\"concurrently yarn:compile:main yarn:compile:extension-types\\\",\\\"dev-run\\\":\\\"nodemon --watch static/build/main.js --exec \\\\\\\"electron --remote-debugging-port=9223 --inspect .\\\\\\\"\\\",\\\"dev:main\\\":\\\"yarn run compile:main --watch\\\",\\\"dev:renderer\\\":\\\"yarn run webpack-dev-server --config webpack.renderer.ts\\\",\\\"dev:extension-types\\\":\\\"yarn run compile:extension-types --watch\\\",\\\"compile\\\":\\\"env NODE_ENV=production concurrently yarn:compile:*\\\",\\\"compile:main\\\":\\\"yarn run webpack --config webpack.main.ts\\\",\\\"compile:renderer\\\":\\\"yarn run webpack --config webpack.renderer.ts\\\",\\\"compile:extension-types\\\":\\\"yarn run webpack --config webpack.extensions.ts\\\",\\\"npm:fix-build-version\\\":\\\"yarn run ts-node build/set_build_version.ts\\\",\\\"npm:fix-package-version\\\":\\\"yarn run ts-node build/set_npm_version.ts\\\",\\\"build:linux\\\":\\\"yarn run compile && electron-builder --linux --dir\\\",\\\"build:mac\\\":\\\"yarn run compile && electron-builder --mac --dir\\\",\\\"build:win\\\":\\\"yarn run compile && electron-builder --win --dir\\\",\\\"integration\\\":\\\"jest --runInBand --detectOpenHandles --forceExit integration\\\",\\\"dist\\\":\\\"yarn run compile && electron-builder --publish onTag\\\",\\\"dist:dir\\\":\\\"yarn run dist --dir -c.compression=store -c.mac.identity=null\\\",\\\"download-bins\\\":\\\"concurrently yarn:download:*\\\",\\\"download:kubectl\\\":\\\"yarn run ts-node build/download_kubectl.ts\\\",\\\"download:helm\\\":\\\"yarn run ts-node build/download_helm.ts\\\",\\\"build:tray-icons\\\":\\\"yarn run ts-node build/build_tray_icon.ts\\\",\\\"build:theme-vars\\\":\\\"yarn run ts-node build/build_theme_vars.ts\\\",\\\"lint\\\":\\\"PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .\\\",\\\"lint:fix\\\":\\\"yarn run lint --fix\\\",\\\"mkdocs-serve-local\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest\\\",\\\"verify-docs\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict\\\",\\\"typedocs-extensions-api\\\":\\\"yarn run typedoc src/extensions/extension-api.ts\\\",\\\"version-checkout\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release/v%s\\\\\\\" | xargs git checkout -b\\\",\\\"version-commit\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release v%s\\\\\\\" | git commit --no-edit -s -F -\\\",\\\"version\\\":\\\"yarn run version-checkout && git add package.json && yarn run version-commit\\\",\\\"postversion\\\":\\\"git push --set-upstream ${GIT_REMOTE:-origin} release/v$npm_package_version\\\"},\\\"config\\\":{\\\"bundledKubectlVersion\\\":\\\"1.21.2\\\",\\\"bundledHelmVersion\\\":\\\"3.6.3\\\",\\\"sentryDsn\\\":\\\"\\\"},\\\"engines\\\":{\\\"node\\\":\\\">=14 <15\\\"},\\\"jest\\\":{\\\"collectCoverage\\\":false,\\\"verbose\\\":true,\\\"transform\\\":{\\\"^.+\\\\\\\\.tsx?$\\\":\\\"ts-jest\\\"},\\\"moduleNameMapper\\\":{\\\"\\\\\\\\.(css|scss)$\\\":\\\"<rootDir>/__mocks__/styleMock.ts\\\",\\\"\\\\\\\\.(svg)$\\\":\\\"<rootDir>/__mocks__/imageMock.ts\\\",\\\"src/(.*)\\\":\\\"<rootDir>/__mocks__/windowMock.ts\\\"},\\\"modulePathIgnorePatterns\\\":[\\\"<rootDir>/dist\\\",\\\"<rootDir>/src/extensions/npm\\\"],\\\"setupFiles\\\":[\\\"<rootDir>/src/jest.setup.ts\\\",\\\"jest-canvas-mock\\\"],\\\"globals\\\":{\\\"ts-jest\\\":{\\\"isolatedModules\\\":true}}},\\\"build\\\":{\\\"generateUpdatesFilesForAllChannels\\\":true,\\\"files\\\":[\\\"static/build/main.js\\\"],\\\"afterSign\\\":\\\"build/notarize.js\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"locales/\\\",\\\"to\\\":\\\"locales/\\\",\\\"filter\\\":\\\"**/*.js\\\"},{\\\"from\\\":\\\"static/\\\",\\\"to\\\":\\\"static/\\\",\\\"filter\\\":\\\"!**/main.js\\\"},{\\\"from\\\":\\\"build/tray\\\",\\\"to\\\":\\\"static/icons\\\",\\\"filter\\\":\\\"*.png\\\"},{\\\"from\\\":\\\"extensions/\\\",\\\"to\\\":\\\"./extensions/\\\",\\\"filter\\\":[\\\"**/*.tgz\\\",\\\"**/package.json\\\",\\\"!**/node_modules\\\"]},{\\\"from\\\":\\\"templates/\\\",\\\"to\\\":\\\"./templates/\\\",\\\"filter\\\":\\\"**/*.yaml\\\"},\\\"LICENSE\\\"],\\\"linux\\\":{\\\"category\\\":\\\"Network\\\",\\\"artifactName\\\":\\\"${productName}-${version}.${arch}.${ext}\\\",\\\"target\\\":[\\\"deb\\\",\\\"rpm\\\",\\\"AppImage\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/linux/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"rpm\\\":{\\\"fpm\\\":[\\\"--rpm-rpmbuild-define=%define _build_id_links none\\\"]},\\\"mac\\\":{\\\"hardenedRuntime\\\":true,\\\"gatekeeperAssess\\\":false,\\\"entitlements\\\":\\\"build/entitlements.mac.plist\\\",\\\"entitlementsInherit\\\":\\\"build/entitlements.mac.plist\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/darwin/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"win\\\":{\\\"target\\\":[\\\"nsis\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/windows/x64/kubectl.exe\\\",\\\"to\\\":\\\"./x64/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/windows/ia32/kubectl.exe\\\",\\\"to\\\":\\\"./ia32/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/x64/helm3/helm3.exe\\\",\\\"to\\\":\\\"./helm3/helm3.exe\\\"}]},\\\"nsis\\\":{\\\"include\\\":\\\"build/installer.nsh\\\",\\\"oneClick\\\":false,\\\"allowElevation\\\":true,\\\"createStartMenuShortcut\\\":true,\\\"allowToChangeInstallationDirectory\\\":true},\\\"protocols\\\":{\\\"name\\\":\\\"Lens Protocol Handler\\\",\\\"schemes\\\":[\\\"lens\\\"],\\\"role\\\":\\\"Viewer\\\"}},\\\"dependencies\\\":{\\\"@electron/remote\\\":\\\"^1.2.2\\\",\\\"@hapi/call\\\":\\\"^8.0.1\\\",\\\"@hapi/subtext\\\":\\\"^7.0.3\\\",\\\"@kubernetes/client-node\\\":\\\"^0.16.1\\\",\\\"@ogre-tools/injectable\\\":\\\"2.0.0\\\",\\\"@ogre-tools/injectable-react\\\":\\\"2.0.0\\\",\\\"@sentry/electron\\\":\\\"^2.5.4\\\",\\\"@sentry/integrations\\\":\\\"^6.15.0\\\",\\\"abort-controller\\\":\\\"^3.0.0\\\",\\\"auto-bind\\\":\\\"^4.0.0\\\",\\\"autobind-decorator\\\":\\\"^2.4.0\\\",\\\"await-lock\\\":\\\"^2.1.0\\\",\\\"byline\\\":\\\"^5.0.0\\\",\\\"chokidar\\\":\\\"^3.4.3\\\",\\\"conf\\\":\\\"^7.1.2\\\",\\\"crypto-js\\\":\\\"^4.1.1\\\",\\\"electron-devtools-installer\\\":\\\"^3.2.0\\\",\\\"electron-updater\\\":\\\"^4.6.1\\\",\\\"electron-window-state\\\":\\\"^5.0.3\\\",\\\"filehound\\\":\\\"^1.17.5\\\",\\\"fs-extra\\\":\\\"^9.0.1\\\",\\\"glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"got\\\":\\\"^11.8.2\\\",\\\"grapheme-splitter\\\":\\\"^1.0.4\\\",\\\"handlebars\\\":\\\"^4.7.7\\\",\\\"http-proxy\\\":\\\"^1.18.1\\\",\\\"immer\\\":\\\"^9.0.6\\\",\\\"joi\\\":\\\"^17.5.0\\\",\\\"js-yaml\\\":\\\"^4.1.0\\\",\\\"jsdom\\\":\\\"^16.7.0\\\",\\\"jsonpath\\\":\\\"^1.1.1\\\",\\\"lodash\\\":\\\"^4.17.15\\\",\\\"mac-ca\\\":\\\"^1.0.6\\\",\\\"marked\\\":\\\"^2.1.3\\\",\\\"md5-file\\\":\\\"^5.0.0\\\",\\\"mobx\\\":\\\"^6.3.7\\\",\\\"mobx-observable-history\\\":\\\"^2.0.3\\\",\\\"mobx-react\\\":\\\"^7.2.1\\\",\\\"mock-fs\\\":\\\"^5.1.2\\\",\\\"moment\\\":\\\"^2.29.1\\\",\\\"moment-timezone\\\":\\\"^0.5.34\\\",\\\"monaco-editor\\\":\\\"^0.29.1\\\",\\\"monaco-editor-webpack-plugin\\\":\\\"^5.0.0\\\",\\\"node-fetch\\\":\\\"lensapp/node-fetch#2.x\\\",\\\"node-pty\\\":\\\"^0.10.1\\\",\\\"npm\\\":\\\"^6.14.15\\\",\\\"p-limit\\\":\\\"^3.1.0\\\",\\\"path-to-regexp\\\":\\\"^6.2.0\\\",\\\"proper-lockfile\\\":\\\"^4.1.2\\\",\\\"react\\\":\\\"^17.0.2\\\",\\\"react-dom\\\":\\\"^17.0.2\\\",\\\"react-material-ui-carousel\\\":\\\"^2.3.8\\\",\\\"react-router\\\":\\\"^5.2.0\\\",\\\"react-virtualized-auto-sizer\\\":\\\"^1.0.6\\\",\\\"readable-stream\\\":\\\"^3.6.0\\\",\\\"request\\\":\\\"^2.88.2\\\",\\\"request-promise-native\\\":\\\"^1.0.9\\\",\\\"rfc6902\\\":\\\"^4.0.2\\\",\\\"semver\\\":\\\"^7.3.2\\\",\\\"shell-env\\\":\\\"^3.0.1\\\",\\\"spdy\\\":\\\"^4.0.2\\\",\\\"tar\\\":\\\"^6.1.11\\\",\\\"tcp-port-used\\\":\\\"^1.0.2\\\",\\\"tempy\\\":\\\"1.0.1\\\",\\\"url-parse\\\":\\\"^1.5.3\\\",\\\"uuid\\\":\\\"^8.3.2\\\",\\\"win-ca\\\":\\\"^3.4.5\\\",\\\"winston\\\":\\\"^3.3.3\\\",\\\"winston-console-format\\\":\\\"^1.0.8\\\",\\\"winston-transport-browserconsole\\\":\\\"^1.0.5\\\",\\\"ws\\\":\\\"^7.5.5\\\"},\\\"devDependencies\\\":{\\\"@async-fn/jest\\\":\\\"1.5.3\\\",\\\"@material-ui/core\\\":\\\"^4.12.3\\\",\\\"@material-ui/icons\\\":\\\"^4.11.2\\\",\\\"@material-ui/lab\\\":\\\"^4.0.0-alpha.60\\\",\\\"@pmmmwh/react-refresh-webpack-plugin\\\":\\\"^0.4.3\\\",\\\"@sentry/types\\\":\\\"^6.14.1\\\",\\\"@testing-library/jest-dom\\\":\\\"^5.16.1\\\",\\\"@testing-library/react\\\":\\\"^11.2.7\\\",\\\"@testing-library/user-event\\\":\\\"^13.5.0\\\",\\\"@types/byline\\\":\\\"^4.2.33\\\",\\\"@types/chart.js\\\":\\\"^2.9.34\\\",\\\"@types/color\\\":\\\"^3.0.2\\\",\\\"@types/crypto-js\\\":\\\"^3.1.47\\\",\\\"@types/dompurify\\\":\\\"^2.3.1\\\",\\\"@types/electron-devtools-installer\\\":\\\"^2.2.0\\\",\\\"@types/fs-extra\\\":\\\"^9.0.13\\\",\\\"@types/glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"@types/hoist-non-react-statics\\\":\\\"^3.3.1\\\",\\\"@types/html-webpack-plugin\\\":\\\"^3.2.6\\\",\\\"@types/http-proxy\\\":\\\"^1.17.7\\\",\\\"@types/jest\\\":\\\"^26.0.24\\\",\\\"@types/js-yaml\\\":\\\"^4.0.5\\\",\\\"@types/jsdom\\\":\\\"^16.2.13\\\",\\\"@types/jsonpath\\\":\\\"^0.2.0\\\",\\\"@types/lodash\\\":\\\"^4.14.177\\\",\\\"@types/marked\\\":\\\"^2.0.5\\\",\\\"@types/md5-file\\\":\\\"^4.0.2\\\",\\\"@types/mini-css-extract-plugin\\\":\\\"^0.9.1\\\",\\\"@types/mock-fs\\\":\\\"^4.13.1\\\",\\\"@types/node\\\":\\\"14.17.33\\\",\\\"@types/node-fetch\\\":\\\"^2.5.12\\\",\\\"@types/npm\\\":\\\"^2.0.32\\\",\\\"@types/progress-bar-webpack-plugin\\\":\\\"^2.1.2\\\",\\\"@types/proper-lockfile\\\":\\\"^4.1.2\\\",\\\"@types/randomcolor\\\":\\\"^0.5.6\\\",\\\"@types/react\\\":\\\"^17.0.34\\\",\\\"@types/react-beautiful-dnd\\\":\\\"^13.1.2\\\",\\\"@types/react-dom\\\":\\\"^17.0.11\\\",\\\"@types/react-router-dom\\\":\\\"^5.3.2\\\",\\\"@types/react-select\\\":\\\"3.1.2\\\",\\\"@types/react-table\\\":\\\"^7.7.8\\\",\\\"@types/react-virtualized-auto-sizer\\\":\\\"^1.0.1\\\",\\\"@types/react-window\\\":\\\"^1.8.5\\\",\\\"@types/readable-stream\\\":\\\"^2.3.12\\\",\\\"@types/request\\\":\\\"^2.48.7\\\",\\\"@types/request-promise-native\\\":\\\"^1.0.18\\\",\\\"@types/semver\\\":\\\"^7.3.9\\\",\\\"@types/sharp\\\":\\\"^0.29.4\\\",\\\"@types/spdy\\\":\\\"^3.4.5\\\",\\\"@types/tar\\\":\\\"^4.0.5\\\",\\\"@types/tcp-port-used\\\":\\\"^1.0.0\\\",\\\"@types/tempy\\\":\\\"^0.3.0\\\",\\\"@types/triple-beam\\\":\\\"^1.3.2\\\",\\\"@types/url-parse\\\":\\\"^1.4.5\\\",\\\"@types/uuid\\\":\\\"^8.3.3\\\",\\\"@types/webpack\\\":\\\"^4.41.32\\\",\\\"@types/webpack-dev-server\\\":\\\"^3.11.6\\\",\\\"@types/webpack-env\\\":\\\"^1.16.3\\\",\\\"@types/webpack-node-externals\\\":\\\"^1.7.1\\\",\\\"@typescript-eslint/eslint-plugin\\\":\\\"^5.7.0\\\",\\\"@typescript-eslint/parser\\\":\\\"^5.7.0\\\",\\\"ansi_up\\\":\\\"^5.1.0\\\",\\\"chart.js\\\":\\\"^2.9.4\\\",\\\"circular-dependency-plugin\\\":\\\"^5.2.2\\\",\\\"color\\\":\\\"^3.2.1\\\",\\\"concurrently\\\":\\\"^5.3.0\\\",\\\"css-loader\\\":\\\"^5.2.7\\\",\\\"deepdash\\\":\\\"^5.3.9\\\",\\\"dompurify\\\":\\\"^2.3.4\\\",\\\"electron\\\":\\\"^13.6.1\\\",\\\"electron-builder\\\":\\\"^22.14.5\\\",\\\"electron-notarize\\\":\\\"^0.3.0\\\",\\\"esbuild\\\":\\\"^0.13.15\\\",\\\"esbuild-loader\\\":\\\"^2.16.0\\\",\\\"eslint\\\":\\\"^7.32.0\\\",\\\"eslint-plugin-header\\\":\\\"^3.1.1\\\",\\\"eslint-plugin-react\\\":\\\"^7.27.1\\\",\\\"eslint-plugin-react-hooks\\\":\\\"^4.3.0\\\",\\\"eslint-plugin-unused-imports\\\":\\\"^1.1.5\\\",\\\"file-loader\\\":\\\"^6.2.0\\\",\\\"flex.box\\\":\\\"^3.4.4\\\",\\\"fork-ts-checker-webpack-plugin\\\":\\\"^5.2.1\\\",\\\"hoist-non-react-statics\\\":\\\"^3.3.2\\\",\\\"html-webpack-plugin\\\":\\\"^4.5.2\\\",\\\"include-media\\\":\\\"^1.4.9\\\",\\\"jest\\\":\\\"26.6.3\\\",\\\"jest-canvas-mock\\\":\\\"^2.3.1\\\",\\\"jest-fetch-mock\\\":\\\"^3.0.3\\\",\\\"jest-mock-extended\\\":\\\"^1.0.18\\\",\\\"make-plural\\\":\\\"^6.2.2\\\",\\\"mini-css-extract-plugin\\\":\\\"^1.6.2\\\",\\\"node-gyp\\\":\\\"7.1.2\\\",\\\"node-loader\\\":\\\"^1.0.3\\\",\\\"nodemon\\\":\\\"^2.0.14\\\",\\\"playwright\\\":\\\"^1.17.1\\\",\\\"postcss\\\":\\\"^8.4.5\\\",\\\"postcss-loader\\\":\\\"^4.3.0\\\",\\\"progress-bar-webpack-plugin\\\":\\\"^2.1.0\\\",\\\"randomcolor\\\":\\\"^0.6.2\\\",\\\"raw-loader\\\":\\\"^4.0.2\\\",\\\"react-beautiful-dnd\\\":\\\"^13.1.0\\\",\\\"react-refresh\\\":\\\"^0.9.0\\\",\\\"react-router-dom\\\":\\\"^5.3.0\\\",\\\"react-select\\\":\\\"3.2.0\\\",\\\"react-select-event\\\":\\\"^5.1.0\\\",\\\"react-table\\\":\\\"^7.7.0\\\",\\\"react-window\\\":\\\"^1.8.6\\\",\\\"sass\\\":\\\"^1.45.1\\\",\\\"sass-loader\\\":\\\"^10.2.0\\\",\\\"sharp\\\":\\\"^0.29.3\\\",\\\"style-loader\\\":\\\"^2.0.0\\\",\\\"tailwindcss\\\":\\\"^3.0.7\\\",\\\"ts-jest\\\":\\\"26.5.6\\\",\\\"ts-loader\\\":\\\"^7.0.5\\\",\\\"ts-node\\\":\\\"^10.4.0\\\",\\\"type-fest\\\":\\\"^1.0.2\\\",\\\"typed-emitter\\\":\\\"^1.4.0\\\",\\\"typedoc\\\":\\\"0.22.10\\\",\\\"typedoc-plugin-markdown\\\":\\\"^3.11.3\\\",\\\"typeface-roboto\\\":\\\"^1.1.13\\\",\\\"typescript\\\":\\\"^4.5.2\\\",\\\"typescript-plugin-css-modules\\\":\\\"^3.4.0\\\",\\\"url-loader\\\":\\\"^4.1.1\\\",\\\"webpack\\\":\\\"^4.46.0\\\",\\\"webpack-cli\\\":\\\"^3.3.12\\\",\\\"webpack-dev-server\\\":\\\"^3.11.3\\\",\\\"webpack-node-externals\\\":\\\"^1.7.2\\\",\\\"xterm\\\":\\\"^4.15.0\\\",\\\"xterm-addon-fit\\\":\\\"^0.5.0\\\"}}\");\n\n//# sourceURL=webpack:///./package.json?");
|
|
38357
|
+
eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"open-lens\\\",\\\"productName\\\":\\\"OpenLens\\\",\\\"description\\\":\\\"OpenLens - Open Source IDE for Kubernetes\\\",\\\"homepage\\\":\\\"https://github.com/lensapp/lens\\\",\\\"version\\\":\\\"5.3.0\\\",\\\"main\\\":\\\"static/build/main.js\\\",\\\"copyright\\\":\\\"© 2021 OpenLens Authors\\\",\\\"license\\\":\\\"MIT\\\",\\\"author\\\":{\\\"name\\\":\\\"OpenLens Authors\\\",\\\"email\\\":\\\"info@k8slens.dev\\\"},\\\"scripts\\\":{\\\"dev\\\":\\\"concurrently -i -k \\\\\\\"yarn run dev-run -C\\\\\\\" yarn:dev:*\\\",\\\"dev-build\\\":\\\"concurrently yarn:compile:*\\\",\\\"debug-build\\\":\\\"concurrently yarn:compile:main yarn:compile:extension-types\\\",\\\"dev-run\\\":\\\"nodemon --watch static/build/main.js --exec \\\\\\\"electron --remote-debugging-port=9223 --inspect .\\\\\\\"\\\",\\\"dev:main\\\":\\\"yarn run compile:main --watch\\\",\\\"dev:renderer\\\":\\\"yarn run webpack-dev-server --config webpack.renderer.ts\\\",\\\"dev:extension-types\\\":\\\"yarn run compile:extension-types --watch\\\",\\\"compile\\\":\\\"env NODE_ENV=production concurrently yarn:compile:*\\\",\\\"compile:main\\\":\\\"yarn run webpack --config webpack.main.ts\\\",\\\"compile:renderer\\\":\\\"yarn run webpack --config webpack.renderer.ts\\\",\\\"compile:extension-types\\\":\\\"yarn run webpack --config webpack.extensions.ts\\\",\\\"npm:fix-build-version\\\":\\\"yarn run ts-node build/set_build_version.ts\\\",\\\"npm:fix-package-version\\\":\\\"yarn run ts-node build/set_npm_version.ts\\\",\\\"build:linux\\\":\\\"yarn run compile && electron-builder --linux --dir\\\",\\\"build:mac\\\":\\\"yarn run compile && electron-builder --mac --dir\\\",\\\"build:win\\\":\\\"yarn run compile && electron-builder --win --dir\\\",\\\"integration\\\":\\\"jest --runInBand --detectOpenHandles --forceExit integration\\\",\\\"dist\\\":\\\"yarn run compile && electron-builder --publish onTag\\\",\\\"dist:dir\\\":\\\"yarn run dist --dir -c.compression=store -c.mac.identity=null\\\",\\\"download-bins\\\":\\\"concurrently yarn:download:*\\\",\\\"download:kubectl\\\":\\\"yarn run ts-node build/download_kubectl.ts\\\",\\\"download:helm\\\":\\\"yarn run ts-node build/download_helm.ts\\\",\\\"build:tray-icons\\\":\\\"yarn run ts-node build/build_tray_icon.ts\\\",\\\"build:theme-vars\\\":\\\"yarn run ts-node build/build_theme_vars.ts\\\",\\\"lint\\\":\\\"PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .\\\",\\\"lint:fix\\\":\\\"yarn run lint --fix\\\",\\\"mkdocs-serve-local\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest\\\",\\\"verify-docs\\\":\\\"docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict\\\",\\\"typedocs-extensions-api\\\":\\\"yarn run typedoc src/extensions/extension-api.ts\\\",\\\"version-checkout\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release/v%s\\\\\\\" | xargs git checkout -b\\\",\\\"version-commit\\\":\\\"cat package.json | jq '.version' -r | xargs printf \\\\\\\"release v%s\\\\\\\" | git commit --no-edit -s -F -\\\",\\\"version\\\":\\\"yarn run version-checkout && git add package.json && yarn run version-commit\\\",\\\"postversion\\\":\\\"git push --set-upstream ${GIT_REMOTE:-origin} release/v$npm_package_version\\\"},\\\"config\\\":{\\\"bundledKubectlVersion\\\":\\\"1.21.2\\\",\\\"bundledHelmVersion\\\":\\\"3.6.3\\\",\\\"sentryDsn\\\":\\\"\\\"},\\\"engines\\\":{\\\"node\\\":\\\">=14 <15\\\"},\\\"jest\\\":{\\\"collectCoverage\\\":false,\\\"verbose\\\":true,\\\"transform\\\":{\\\"^.+\\\\\\\\.tsx?$\\\":\\\"ts-jest\\\"},\\\"moduleNameMapper\\\":{\\\"\\\\\\\\.(css|scss)$\\\":\\\"<rootDir>/__mocks__/styleMock.ts\\\",\\\"\\\\\\\\.(svg)$\\\":\\\"<rootDir>/__mocks__/imageMock.ts\\\"},\\\"modulePathIgnorePatterns\\\":[\\\"<rootDir>/dist\\\",\\\"<rootDir>/src/extensions/npm\\\"],\\\"setupFiles\\\":[\\\"<rootDir>/src/jest.setup.ts\\\",\\\"jest-canvas-mock\\\"],\\\"globals\\\":{\\\"ts-jest\\\":{\\\"isolatedModules\\\":true}}},\\\"build\\\":{\\\"generateUpdatesFilesForAllChannels\\\":true,\\\"files\\\":[\\\"static/build/main.js\\\"],\\\"afterSign\\\":\\\"build/notarize.js\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"locales/\\\",\\\"to\\\":\\\"locales/\\\",\\\"filter\\\":\\\"**/*.js\\\"},{\\\"from\\\":\\\"static/\\\",\\\"to\\\":\\\"static/\\\",\\\"filter\\\":\\\"!**/main.js\\\"},{\\\"from\\\":\\\"build/tray\\\",\\\"to\\\":\\\"static/icons\\\",\\\"filter\\\":\\\"*.png\\\"},{\\\"from\\\":\\\"extensions/\\\",\\\"to\\\":\\\"./extensions/\\\",\\\"filter\\\":[\\\"**/*.tgz\\\",\\\"**/package.json\\\",\\\"!**/node_modules\\\"]},{\\\"from\\\":\\\"templates/\\\",\\\"to\\\":\\\"./templates/\\\",\\\"filter\\\":\\\"**/*.yaml\\\"},\\\"LICENSE\\\"],\\\"linux\\\":{\\\"category\\\":\\\"Network\\\",\\\"artifactName\\\":\\\"${productName}-${version}.${arch}.${ext}\\\",\\\"target\\\":[\\\"deb\\\",\\\"rpm\\\",\\\"AppImage\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/linux/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"rpm\\\":{\\\"fpm\\\":[\\\"--rpm-rpmbuild-define=%define _build_id_links none\\\"]},\\\"mac\\\":{\\\"hardenedRuntime\\\":true,\\\"gatekeeperAssess\\\":false,\\\"entitlements\\\":\\\"build/entitlements.mac.plist\\\",\\\"entitlementsInherit\\\":\\\"build/entitlements.mac.plist\\\",\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/darwin/${arch}/kubectl\\\",\\\"to\\\":\\\"./${arch}/kubectl\\\"},{\\\"from\\\":\\\"binaries/client/${arch}/helm3/helm3\\\",\\\"to\\\":\\\"./helm3/helm3\\\"}]},\\\"win\\\":{\\\"target\\\":[\\\"nsis\\\"],\\\"extraResources\\\":[{\\\"from\\\":\\\"binaries/client/windows/x64/kubectl.exe\\\",\\\"to\\\":\\\"./x64/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/windows/ia32/kubectl.exe\\\",\\\"to\\\":\\\"./ia32/kubectl.exe\\\"},{\\\"from\\\":\\\"binaries/client/x64/helm3/helm3.exe\\\",\\\"to\\\":\\\"./helm3/helm3.exe\\\"}]},\\\"nsis\\\":{\\\"include\\\":\\\"build/installer.nsh\\\",\\\"oneClick\\\":false,\\\"allowElevation\\\":true,\\\"createStartMenuShortcut\\\":true,\\\"allowToChangeInstallationDirectory\\\":true},\\\"protocols\\\":{\\\"name\\\":\\\"Lens Protocol Handler\\\",\\\"schemes\\\":[\\\"lens\\\"],\\\"role\\\":\\\"Viewer\\\"}},\\\"dependencies\\\":{\\\"@electron/remote\\\":\\\"^1.2.2\\\",\\\"@hapi/call\\\":\\\"^8.0.1\\\",\\\"@hapi/subtext\\\":\\\"^7.0.3\\\",\\\"@kubernetes/client-node\\\":\\\"^0.16.1\\\",\\\"@ogre-tools/injectable\\\":\\\"2.0.0\\\",\\\"@ogre-tools/injectable-react\\\":\\\"2.0.0\\\",\\\"@sentry/electron\\\":\\\"^2.5.4\\\",\\\"@sentry/integrations\\\":\\\"^6.15.0\\\",\\\"@types/circular-dependency-plugin\\\":\\\"5.0.4\\\",\\\"abort-controller\\\":\\\"^3.0.0\\\",\\\"auto-bind\\\":\\\"^4.0.0\\\",\\\"autobind-decorator\\\":\\\"^2.4.0\\\",\\\"await-lock\\\":\\\"^2.1.0\\\",\\\"byline\\\":\\\"^5.0.0\\\",\\\"chokidar\\\":\\\"^3.4.3\\\",\\\"conf\\\":\\\"^7.1.2\\\",\\\"crypto-js\\\":\\\"^4.1.1\\\",\\\"electron-devtools-installer\\\":\\\"^3.2.0\\\",\\\"electron-updater\\\":\\\"^4.6.1\\\",\\\"electron-window-state\\\":\\\"^5.0.3\\\",\\\"filehound\\\":\\\"^1.17.5\\\",\\\"fs-extra\\\":\\\"^9.0.1\\\",\\\"glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"got\\\":\\\"^11.8.3\\\",\\\"grapheme-splitter\\\":\\\"^1.0.4\\\",\\\"handlebars\\\":\\\"^4.7.7\\\",\\\"http-proxy\\\":\\\"^1.18.1\\\",\\\"immer\\\":\\\"^9.0.6\\\",\\\"joi\\\":\\\"^17.5.0\\\",\\\"js-yaml\\\":\\\"^4.1.0\\\",\\\"jsdom\\\":\\\"^16.7.0\\\",\\\"jsonpath\\\":\\\"^1.1.1\\\",\\\"lodash\\\":\\\"^4.17.15\\\",\\\"mac-ca\\\":\\\"^1.0.6\\\",\\\"marked\\\":\\\"^2.1.3\\\",\\\"md5-file\\\":\\\"^5.0.0\\\",\\\"mobx\\\":\\\"^6.3.7\\\",\\\"mobx-observable-history\\\":\\\"^2.0.3\\\",\\\"mobx-react\\\":\\\"^7.2.1\\\",\\\"mock-fs\\\":\\\"^5.1.2\\\",\\\"moment\\\":\\\"^2.29.1\\\",\\\"moment-timezone\\\":\\\"^0.5.34\\\",\\\"monaco-editor\\\":\\\"^0.29.1\\\",\\\"monaco-editor-webpack-plugin\\\":\\\"^5.0.0\\\",\\\"node-fetch\\\":\\\"lensapp/node-fetch#2.x\\\",\\\"node-pty\\\":\\\"^0.10.1\\\",\\\"npm\\\":\\\"^6.14.15\\\",\\\"p-limit\\\":\\\"^3.1.0\\\",\\\"path-to-regexp\\\":\\\"^6.2.0\\\",\\\"proper-lockfile\\\":\\\"^4.1.2\\\",\\\"react\\\":\\\"^17.0.2\\\",\\\"react-dom\\\":\\\"^17.0.2\\\",\\\"react-material-ui-carousel\\\":\\\"^2.3.8\\\",\\\"react-router\\\":\\\"^5.2.0\\\",\\\"react-virtualized-auto-sizer\\\":\\\"^1.0.6\\\",\\\"readable-stream\\\":\\\"^3.6.0\\\",\\\"request\\\":\\\"^2.88.2\\\",\\\"request-promise-native\\\":\\\"^1.0.9\\\",\\\"rfc6902\\\":\\\"^4.0.2\\\",\\\"semver\\\":\\\"^7.3.2\\\",\\\"shell-env\\\":\\\"^3.0.1\\\",\\\"spdy\\\":\\\"^4.0.2\\\",\\\"tar\\\":\\\"^6.1.11\\\",\\\"tcp-port-used\\\":\\\"^1.0.2\\\",\\\"tempy\\\":\\\"1.0.1\\\",\\\"url-parse\\\":\\\"^1.5.3\\\",\\\"uuid\\\":\\\"^8.3.2\\\",\\\"win-ca\\\":\\\"^3.4.5\\\",\\\"winston\\\":\\\"^3.3.3\\\",\\\"winston-console-format\\\":\\\"^1.0.8\\\",\\\"winston-transport-browserconsole\\\":\\\"^1.0.5\\\",\\\"ws\\\":\\\"^7.5.5\\\"},\\\"devDependencies\\\":{\\\"@async-fn/jest\\\":\\\"1.5.3\\\",\\\"@material-ui/core\\\":\\\"^4.12.3\\\",\\\"@material-ui/icons\\\":\\\"^4.11.2\\\",\\\"@material-ui/lab\\\":\\\"^4.0.0-alpha.60\\\",\\\"@pmmmwh/react-refresh-webpack-plugin\\\":\\\"^0.4.3\\\",\\\"@sentry/types\\\":\\\"^6.14.1\\\",\\\"@testing-library/jest-dom\\\":\\\"^5.16.1\\\",\\\"@testing-library/react\\\":\\\"^11.2.7\\\",\\\"@testing-library/user-event\\\":\\\"^13.5.0\\\",\\\"@types/byline\\\":\\\"^4.2.33\\\",\\\"@types/chart.js\\\":\\\"^2.9.34\\\",\\\"@types/color\\\":\\\"^3.0.2\\\",\\\"@types/crypto-js\\\":\\\"^3.1.47\\\",\\\"@types/dompurify\\\":\\\"^2.3.1\\\",\\\"@types/electron-devtools-installer\\\":\\\"^2.2.0\\\",\\\"@types/fs-extra\\\":\\\"^9.0.13\\\",\\\"@types/glob-to-regexp\\\":\\\"^0.4.1\\\",\\\"@types/hoist-non-react-statics\\\":\\\"^3.3.1\\\",\\\"@types/html-webpack-plugin\\\":\\\"^3.2.6\\\",\\\"@types/http-proxy\\\":\\\"^1.17.7\\\",\\\"@types/jest\\\":\\\"^26.0.24\\\",\\\"@types/js-yaml\\\":\\\"^4.0.5\\\",\\\"@types/jsdom\\\":\\\"^16.2.13\\\",\\\"@types/jsonpath\\\":\\\"^0.2.0\\\",\\\"@types/lodash\\\":\\\"^4.14.177\\\",\\\"@types/marked\\\":\\\"^2.0.5\\\",\\\"@types/md5-file\\\":\\\"^4.0.2\\\",\\\"@types/mini-css-extract-plugin\\\":\\\"^0.9.1\\\",\\\"@types/mock-fs\\\":\\\"^4.13.1\\\",\\\"@types/node\\\":\\\"14.17.33\\\",\\\"@types/node-fetch\\\":\\\"^2.5.12\\\",\\\"@types/npm\\\":\\\"^2.0.32\\\",\\\"@types/progress-bar-webpack-plugin\\\":\\\"^2.1.2\\\",\\\"@types/proper-lockfile\\\":\\\"^4.1.2\\\",\\\"@types/randomcolor\\\":\\\"^0.5.6\\\",\\\"@types/react\\\":\\\"^17.0.34\\\",\\\"@types/react-beautiful-dnd\\\":\\\"^13.1.2\\\",\\\"@types/react-dom\\\":\\\"^17.0.11\\\",\\\"@types/react-router-dom\\\":\\\"^5.3.2\\\",\\\"@types/react-select\\\":\\\"3.1.2\\\",\\\"@types/react-table\\\":\\\"^7.7.8\\\",\\\"@types/react-virtualized-auto-sizer\\\":\\\"^1.0.1\\\",\\\"@types/react-window\\\":\\\"^1.8.5\\\",\\\"@types/readable-stream\\\":\\\"^2.3.12\\\",\\\"@types/request\\\":\\\"^2.48.7\\\",\\\"@types/request-promise-native\\\":\\\"^1.0.18\\\",\\\"@types/semver\\\":\\\"^7.3.9\\\",\\\"@types/sharp\\\":\\\"^0.29.4\\\",\\\"@types/spdy\\\":\\\"^3.4.5\\\",\\\"@types/tar\\\":\\\"^4.0.5\\\",\\\"@types/tcp-port-used\\\":\\\"^1.0.0\\\",\\\"@types/tempy\\\":\\\"^0.3.0\\\",\\\"@types/triple-beam\\\":\\\"^1.3.2\\\",\\\"@types/url-parse\\\":\\\"^1.4.5\\\",\\\"@types/uuid\\\":\\\"^8.3.3\\\",\\\"@types/webpack\\\":\\\"^4.41.32\\\",\\\"@types/webpack-dev-server\\\":\\\"^3.11.6\\\",\\\"@types/webpack-env\\\":\\\"^1.16.3\\\",\\\"@types/webpack-node-externals\\\":\\\"^1.7.1\\\",\\\"@typescript-eslint/eslint-plugin\\\":\\\"^5.7.0\\\",\\\"@typescript-eslint/parser\\\":\\\"^5.7.0\\\",\\\"ansi_up\\\":\\\"^5.1.0\\\",\\\"chart.js\\\":\\\"^2.9.4\\\",\\\"circular-dependency-plugin\\\":\\\"^5.2.2\\\",\\\"color\\\":\\\"^3.2.1\\\",\\\"concurrently\\\":\\\"^5.3.0\\\",\\\"css-loader\\\":\\\"^5.2.7\\\",\\\"deepdash\\\":\\\"^5.3.9\\\",\\\"dompurify\\\":\\\"^2.3.4\\\",\\\"electron\\\":\\\"^13.6.1\\\",\\\"electron-builder\\\":\\\"^22.14.5\\\",\\\"electron-notarize\\\":\\\"^0.3.0\\\",\\\"esbuild\\\":\\\"^0.13.15\\\",\\\"esbuild-loader\\\":\\\"^2.16.0\\\",\\\"eslint\\\":\\\"^7.32.0\\\",\\\"eslint-plugin-header\\\":\\\"^3.1.1\\\",\\\"eslint-plugin-import\\\":\\\"^2.25.3\\\",\\\"eslint-plugin-react\\\":\\\"^7.27.1\\\",\\\"eslint-plugin-react-hooks\\\":\\\"^4.3.0\\\",\\\"eslint-plugin-unused-imports\\\":\\\"^1.1.5\\\",\\\"file-loader\\\":\\\"^6.2.0\\\",\\\"flex.box\\\":\\\"^3.4.4\\\",\\\"fork-ts-checker-webpack-plugin\\\":\\\"^5.2.1\\\",\\\"hoist-non-react-statics\\\":\\\"^3.3.2\\\",\\\"html-webpack-plugin\\\":\\\"^4.5.2\\\",\\\"include-media\\\":\\\"^1.4.9\\\",\\\"jest\\\":\\\"26.6.3\\\",\\\"jest-canvas-mock\\\":\\\"^2.3.1\\\",\\\"jest-fetch-mock\\\":\\\"^3.0.3\\\",\\\"jest-mock-extended\\\":\\\"^1.0.18\\\",\\\"make-plural\\\":\\\"^6.2.2\\\",\\\"mini-css-extract-plugin\\\":\\\"^1.6.2\\\",\\\"node-gyp\\\":\\\"7.1.2\\\",\\\"node-loader\\\":\\\"^1.0.3\\\",\\\"nodemon\\\":\\\"^2.0.14\\\",\\\"playwright\\\":\\\"^1.17.1\\\",\\\"postcss\\\":\\\"^8.4.5\\\",\\\"postcss-loader\\\":\\\"^4.3.0\\\",\\\"progress-bar-webpack-plugin\\\":\\\"^2.1.0\\\",\\\"randomcolor\\\":\\\"^0.6.2\\\",\\\"raw-loader\\\":\\\"^4.0.2\\\",\\\"react-beautiful-dnd\\\":\\\"^13.1.0\\\",\\\"react-refresh\\\":\\\"^0.9.0\\\",\\\"react-router-dom\\\":\\\"^5.3.0\\\",\\\"react-select\\\":\\\"3.2.0\\\",\\\"react-select-event\\\":\\\"^5.1.0\\\",\\\"react-table\\\":\\\"^7.7.0\\\",\\\"react-window\\\":\\\"^1.8.6\\\",\\\"sass\\\":\\\"^1.45.1\\\",\\\"sass-loader\\\":\\\"^10.2.0\\\",\\\"sharp\\\":\\\"^0.29.3\\\",\\\"style-loader\\\":\\\"^2.0.0\\\",\\\"tailwindcss\\\":\\\"^3.0.7\\\",\\\"ts-jest\\\":\\\"26.5.6\\\",\\\"ts-loader\\\":\\\"^7.0.5\\\",\\\"ts-node\\\":\\\"^10.4.0\\\",\\\"type-fest\\\":\\\"^1.0.2\\\",\\\"typed-emitter\\\":\\\"^1.4.0\\\",\\\"typedoc\\\":\\\"0.22.10\\\",\\\"typedoc-plugin-markdown\\\":\\\"^3.11.3\\\",\\\"typeface-roboto\\\":\\\"^1.1.13\\\",\\\"typescript\\\":\\\"^4.5.2\\\",\\\"typescript-plugin-css-modules\\\":\\\"^3.4.0\\\",\\\"url-loader\\\":\\\"^4.1.1\\\",\\\"webpack\\\":\\\"^4.46.0\\\",\\\"webpack-cli\\\":\\\"^3.3.12\\\",\\\"webpack-dev-server\\\":\\\"^3.11.3\\\",\\\"webpack-node-externals\\\":\\\"^1.7.2\\\",\\\"xterm\\\":\\\"^4.15.0\\\",\\\"xterm-addon-fit\\\":\\\"^0.5.0\\\"}}\");\n\n//# sourceURL=webpack:///./package.json?");
|
|
38380
38358
|
|
|
38381
38359
|
/***/ }),
|
|
38382
38360
|
|
|
@@ -38388,7 +38366,7 @@ eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"open-lens\\\",\\\"productN
|
|
|
38388
38366
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
38389
38367
|
|
|
38390
38368
|
"use strict";
|
|
38391
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AppPaths\", function() { return AppPaths; });\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ \"./src/common/logger.ts\");\n/* harmony import */ var
|
|
38369
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AppPaths\", function() { return AppPaths; });\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ \"./src/common/logger.ts\");\n/* harmony import */ var _utils_objects__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/objects */ \"./src/common/utils/objects.ts\");\n/* harmony import */ var _utils_toJS__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/toJS */ \"./src/common/utils/toJS.ts\");\n/* harmony import */ var _vars__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./vars */ \"./src/common/vars.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\nconst pathNames = [\n \"home\",\n \"appData\",\n \"userData\",\n \"cache\",\n \"temp\",\n \"exe\",\n \"module\",\n \"desktop\",\n \"documents\",\n \"downloads\",\n \"music\",\n \"pictures\",\n \"videos\",\n \"logs\",\n \"crashDumps\",\n];\nif (_vars__WEBPACK_IMPORTED_MODULE_6__[\"isWindows\"]) {\n pathNames.push(\"recent\");\n}\nclass AppPaths {\n /**\n * Initializes the local copy of the paths from electron.\n */\n static async init() {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[APP-PATHS]: initializing`);\n if (AppPaths.paths.get()) {\n return void _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(\"[APP-PATHS]: init called more than once\");\n }\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"]) {\n AppPaths.initMain();\n }\n else {\n await AppPaths.initRenderer();\n }\n }\n static initMain() {\n if (process.env.CICD) {\n electron__WEBPACK_IMPORTED_MODULE_0__[\"app\"].setPath(\"appData\", process.env.CICD);\n }\n electron__WEBPACK_IMPORTED_MODULE_0__[\"app\"].setPath(\"userData\", path__WEBPACK_IMPORTED_MODULE_2___default.a.join(electron__WEBPACK_IMPORTED_MODULE_0__[\"app\"].getPath(\"appData\"), electron__WEBPACK_IMPORTED_MODULE_0__[\"app\"].getName()));\n const getPath = (pathName) => {\n try {\n return electron__WEBPACK_IMPORTED_MODULE_0__[\"app\"].getPath(pathName);\n }\n catch (_a) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`[APP-PATHS] No path found for ${pathName}`);\n return \"\";\n }\n };\n AppPaths.paths.set(Object(_utils_objects__WEBPACK_IMPORTED_MODULE_4__[\"fromEntries\"])(pathNames.map(pathName => [pathName, getPath(pathName)]).filter(([, path]) => path)));\n electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"].handle(AppPaths.ipcChannel, () => Object(_utils_toJS__WEBPACK_IMPORTED_MODULE_5__[\"toJS\"])(AppPaths.paths.get()));\n }\n static async initRenderer() {\n const paths = await electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"].invoke(AppPaths.ipcChannel);\n if (!paths || typeof paths !== \"object\") {\n throw Object.assign(new Error(\"[APP-PATHS]: ipc handler returned unexpected data\"), { data: paths });\n }\n AppPaths.paths.set(paths);\n }\n /**\n * An alternative to `app.getPath()` for use in renderer and common.\n * This function throws if called before initialization.\n * @param name The name of the path field\n */\n static get(name) {\n if (!AppPaths.paths.get()) {\n throw new Error(\"AppPaths.init() has not been called\");\n }\n return AppPaths.paths.get()[name];\n }\n /**\n * An async version of `AppPaths.get()` which waits for `AppPaths.init()` to\n * be called before returning\n */\n static async getAsync(name) {\n await Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"when\"])(() => Boolean(AppPaths.paths.get()));\n return AppPaths.paths.get()[name];\n }\n}\nObject.defineProperty(AppPaths, \"paths\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_1__[\"observable\"].box()\n});\nObject.defineProperty(AppPaths, \"ipcChannel\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"get-app-paths\"\n});\n\n\n//# sourceURL=webpack:///./src/common/app-paths.ts?");
|
|
38392
38370
|
|
|
38393
38371
|
/***/ }),
|
|
38394
38372
|
|
|
@@ -38436,7 +38414,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _gen
|
|
|
38436
38414
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
38437
38415
|
|
|
38438
38416
|
"use strict";
|
|
38439
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensKubernetesClusterStatus\", function() { return LensKubernetesClusterStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubernetesCluster\", function() { return KubernetesCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kubernetesClusterCategory\", function() { return kubernetesClusterCategory; });\n/* harmony import */ var _catalog_catalog_category_registry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../catalog/catalog-category-registry */ \"./src/common/catalog/catalog-category-registry.ts\");\n/* harmony import */ var _catalog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../catalog */ \"./src/common/catalog/index.ts\");\n/* harmony import */ var _cluster_ipc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../cluster-ipc */ \"./src/common/cluster-ipc.ts\");\n/* harmony import */ var _cluster_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../cluster-store */ \"./src/common/cluster-store.ts\");\n/* harmony import */ var _ipc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ipc */ \"./src/common/ipc/index.ts\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _renderer_navigation_events__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../renderer/navigation/events */ \"./src/renderer/navigation/events.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\
|
|
38417
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensKubernetesClusterStatus\", function() { return LensKubernetesClusterStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubernetesCluster\", function() { return KubernetesCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kubernetesClusterCategory\", function() { return kubernetesClusterCategory; });\n/* harmony import */ var _catalog_catalog_category_registry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../catalog/catalog-category-registry */ \"./src/common/catalog/catalog-category-registry.ts\");\n/* harmony import */ var _catalog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../catalog */ \"./src/common/catalog/index.ts\");\n/* harmony import */ var _cluster_ipc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../cluster-ipc */ \"./src/common/cluster-ipc.ts\");\n/* harmony import */ var _cluster_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../cluster-store */ \"./src/common/cluster-store.ts\");\n/* harmony import */ var _ipc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ipc */ \"./src/common/ipc/index.ts\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _renderer_navigation_events__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../renderer/navigation/events */ \"./src/renderer/navigation/events.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\nvar LensKubernetesClusterStatus;\n(function (LensKubernetesClusterStatus) {\n LensKubernetesClusterStatus[\"DELETING\"] = \"deleting\";\n LensKubernetesClusterStatus[\"CONNECTING\"] = \"connecting\";\n LensKubernetesClusterStatus[\"CONNECTED\"] = \"connected\";\n LensKubernetesClusterStatus[\"DISCONNECTED\"] = \"disconnected\";\n})(LensKubernetesClusterStatus || (LensKubernetesClusterStatus = {}));\nclass KubernetesCluster extends _catalog__WEBPACK_IMPORTED_MODULE_1__[\"CatalogEntity\"] {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"apiVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KubernetesCluster.apiVersion\n });\n Object.defineProperty(this, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KubernetesCluster.kind\n });\n }\n async connect() {\n var _a;\n if (electron__WEBPACK_IMPORTED_MODULE_5__[\"app\"]) {\n await ((_a = _cluster_store__WEBPACK_IMPORTED_MODULE_3__[\"ClusterStore\"].getInstance().getById(this.metadata.uid)) === null || _a === void 0 ? void 0 : _a.activate());\n }\n else {\n await Object(_ipc__WEBPACK_IMPORTED_MODULE_4__[\"requestMain\"])(_cluster_ipc__WEBPACK_IMPORTED_MODULE_2__[\"clusterActivateHandler\"], this.metadata.uid, false);\n }\n }\n async disconnect() {\n var _a;\n if (electron__WEBPACK_IMPORTED_MODULE_5__[\"app\"]) {\n (_a = _cluster_store__WEBPACK_IMPORTED_MODULE_3__[\"ClusterStore\"].getInstance().getById(this.metadata.uid)) === null || _a === void 0 ? void 0 : _a.disconnect();\n }\n else {\n await Object(_ipc__WEBPACK_IMPORTED_MODULE_4__[\"requestMain\"])(_cluster_ipc__WEBPACK_IMPORTED_MODULE_2__[\"clusterDisconnectHandler\"], this.metadata.uid, false);\n }\n }\n async onRun(context) {\n context.navigate(`/cluster/${this.metadata.uid}`);\n }\n onDetailsOpen() {\n //\n }\n onSettingsOpen() {\n //\n }\n async onContextMenuOpen(context) {\n var _a;\n if (!this.metadata.source || this.metadata.source === \"local\") {\n context.menuItems.push({\n title: \"Settings\",\n icon: \"settings\",\n onClick: () => Object(_ipc__WEBPACK_IMPORTED_MODULE_4__[\"broadcastMessage\"])(_renderer_navigation_events__WEBPACK_IMPORTED_MODULE_6__[\"IpcRendererNavigationEvents\"].NAVIGATE_IN_APP, `/entity/${this.metadata.uid}/settings`),\n });\n }\n switch (this.status.phase) {\n case LensKubernetesClusterStatus.CONNECTED:\n case LensKubernetesClusterStatus.CONNECTING:\n context.menuItems.push({\n title: \"Disconnect\",\n icon: \"link_off\",\n onClick: () => Object(_ipc__WEBPACK_IMPORTED_MODULE_4__[\"requestMain\"])(_cluster_ipc__WEBPACK_IMPORTED_MODULE_2__[\"clusterDisconnectHandler\"], this.metadata.uid),\n });\n break;\n case LensKubernetesClusterStatus.DISCONNECTED:\n context.menuItems.push({\n title: \"Connect\",\n icon: \"link\",\n onClick: () => context.navigate(`/cluster/${this.metadata.uid}`),\n });\n break;\n }\n (_a = _catalog_catalog_category_registry__WEBPACK_IMPORTED_MODULE_0__[\"catalogCategoryRegistry\"]\n .getCategoryForEntity(this)) === null || _a === void 0 ? void 0 : _a.emit(\"contextMenuOpen\", this, context);\n }\n}\nObject.defineProperty(KubernetesCluster, \"apiVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"entity.k8slens.dev/v1alpha1\"\n});\nObject.defineProperty(KubernetesCluster, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"KubernetesCluster\"\n});\nclass KubernetesClusterCategory extends _catalog__WEBPACK_IMPORTED_MODULE_1__[\"CatalogCategory\"] {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"apiVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"catalog.k8slens.dev/v1alpha1\"\n });\n Object.defineProperty(this, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"CatalogCategory\"\n });\n Object.defineProperty(this, \"metadata\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"Clusters\",\n icon: __webpack_require__(/*! !raw-loader!./icons/kubernetes.svg */ \"./node_modules/raw-loader/dist/cjs.js!./src/common/catalog-entities/icons/kubernetes.svg\").default, // eslint-disable-line\n }\n });\n Object.defineProperty(this, \"spec\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n group: \"entity.k8slens.dev\",\n versions: [\n {\n name: \"v1alpha1\",\n entityClass: KubernetesCluster,\n },\n ],\n names: {\n kind: \"KubernetesCluster\",\n },\n }\n });\n }\n}\nconst kubernetesClusterCategory = new KubernetesClusterCategory();\n_catalog_catalog_category_registry__WEBPACK_IMPORTED_MODULE_0__[\"catalogCategoryRegistry\"].add(kubernetesClusterCategory);\n\n\n//# sourceURL=webpack:///./src/common/catalog-entities/kubernetes-cluster.ts?");
|
|
38440
38418
|
|
|
38441
38419
|
/***/ }),
|
|
38442
38420
|
|
|
@@ -38652,7 +38630,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
38652
38630
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
38653
38631
|
|
|
38654
38632
|
"use strict";
|
|
38655
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestMain\", function() { return requestMain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ipcMainHandle\", function() { return ipcMainHandle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"broadcastMessage\", function() { return broadcastMessage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ipcMainOn\", function() { return ipcMainOn; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ipcRendererOn\", function() { return ipcRendererOn; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bindBroadcastHandlers\", function() { return bindBroadcastHandlers; });\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_toJS__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/toJS */ \"./src/common/utils/toJS.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _cluster_frames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../cluster-frames */ \"./src/common/cluster-frames.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Inter-process communications (main <-> renderer)\n// https://www.electronjs.org/docs/api/ipc-main\n// https://www.electronjs.org/docs/api/ipc-renderer\n\n\n\n\nconst electronRemote = electron__WEBPACK_IMPORTED_MODULE_0__[\"
|
|
38633
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestMain\", function() { return requestMain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ipcMainHandle\", function() { return ipcMainHandle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"broadcastMessage\", function() { return broadcastMessage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ipcMainOn\", function() { return ipcMainOn; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ipcRendererOn\", function() { return ipcRendererOn; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bindBroadcastHandlers\", function() { return bindBroadcastHandlers; });\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_toJS__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/toJS */ \"./src/common/utils/toJS.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _cluster_frames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../cluster-frames */ \"./src/common/cluster-frames.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Inter-process communications (main <-> renderer)\n// https://www.electronjs.org/docs/api/ipc-main\n// https://www.electronjs.org/docs/api/ipc-renderer\n\n\n\n\nconst electronRemote = (() => {\n if (electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"]) {\n try {\n return __webpack_require__(/*! @electron/remote */ \"./node_modules/@electron/remote/renderer/index.js\");\n }\n catch (_a) {\n // ignore temp\n }\n }\n return null;\n})();\nconst subFramesChannel = \"ipc:get-sub-frames\";\nasync function requestMain(channel, ...args) {\n return electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"].invoke(channel, ...args.map(sanitizePayload));\n}\nfunction ipcMainHandle(channel, listener) {\n electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"].handle(channel, async (event, ...args) => {\n return sanitizePayload(await listener(event, ...args));\n });\n}\nfunction getSubFrames() {\n return Array.from(_cluster_frames__WEBPACK_IMPORTED_MODULE_3__[\"clusterFrameMap\"].values());\n}\nfunction broadcastMessage(channel, ...args) {\n const subFramesP = electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"]\n ? requestMain(subFramesChannel)\n : Promise.resolve(getSubFrames());\n subFramesP\n .then(subFrames => {\n var _a;\n const views = (_a = (electron__WEBPACK_IMPORTED_MODULE_0__[\"webContents\"] || (electronRemote === null || electronRemote === void 0 ? void 0 : electronRemote.webContents))) === null || _a === void 0 ? void 0 : _a.getAllWebContents();\n if (!views || !Array.isArray(views) || views.length === 0)\n return;\n args = args.map(sanitizePayload);\n electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"] === null || electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"] === void 0 ? void 0 : electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"].send(channel, ...args);\n electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"] === null || electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"] === void 0 ? void 0 : electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"].emit(channel, ...args);\n for (const view of views) {\n let viewType = \"unknown\";\n // There will be a uncaught exception if the view is destroyed.\n try {\n viewType = view.getType();\n }\n catch (_b) {\n // We can ignore the view destroyed exception as viewType is only used for logging.\n }\n // Send message to views.\n try {\n _main_logger__WEBPACK_IMPORTED_MODULE_2__[\"default\"].silly(`[IPC]: broadcasting \"${channel}\" to ${viewType}=${view.id}`, { args });\n view.send(channel, ...args);\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_2__[\"default\"].error(`[IPC]: failed to send IPC message \"${channel}\" to view \"${viewType}=${view.id}\"`, { error: String(error) });\n }\n // Send message to subFrames of views.\n for (const frameInfo of subFrames) {\n _main_logger__WEBPACK_IMPORTED_MODULE_2__[\"default\"].silly(`[IPC]: broadcasting \"${channel}\" to subframe \"frameInfo.processId\"=${frameInfo.processId} \"frameInfo.frameId\"=${frameInfo.frameId}`, { args });\n try {\n view.sendToFrame([frameInfo.processId, frameInfo.frameId], channel, ...args);\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_2__[\"default\"].error(`[IPC]: failed to send IPC message \"${channel}\" to view \"${viewType}=${view.id}\"'s subframe \"frameInfo.processId\"=${frameInfo.processId} \"frameInfo.frameId\"=${frameInfo.frameId}`, { error: String(error) });\n }\n }\n }\n });\n}\nfunction ipcMainOn(channel, listener) {\n electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"].on(channel, listener);\n return () => electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcMain\"].off(channel, listener);\n}\nfunction ipcRendererOn(channel, listener) {\n electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"].on(channel, listener);\n return () => electron__WEBPACK_IMPORTED_MODULE_0__[\"ipcRenderer\"].off(channel, listener);\n}\nfunction bindBroadcastHandlers() {\n ipcMainHandle(subFramesChannel, () => getSubFrames());\n}\n/**\n * Sanitizing data for IPC-messaging before send.\n * Removes possible observable values to avoid exceptions like \"can't clone object\".\n */\nfunction sanitizePayload(data) {\n return Object(_utils_toJS__WEBPACK_IMPORTED_MODULE_1__[\"toJS\"])(data);\n}\n\n\n//# sourceURL=webpack:///./src/common/ipc/ipc.ts?");
|
|
38656
38634
|
|
|
38657
38635
|
/***/ }),
|
|
38658
38636
|
|
|
@@ -38760,7 +38738,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
38760
38738
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
38761
38739
|
|
|
38762
38740
|
"use strict";
|
|
38763
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CustomResourceDefinition\", function() { return CustomResourceDefinition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"crdApi\", function() { return crdApi; });\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _routes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../routes */ \"./src/common/routes/index.ts\");\n/* harmony import */ var _utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/cluster-id-url-parsing */ \"./src/common/utils/cluster-id-url-parsing.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\nclass CustomResourceDefinition extends _kube_object__WEBPACK_IMPORTED_MODULE_0__[\"KubeObject\"] {\n constructor(data) {\n super(data);\n if (!data.spec || typeof data.spec !== \"object\") {\n throw new _kube_object__WEBPACK_IMPORTED_MODULE_0__[\"KubeCreationError\"](\"Cannot create a CustomResourceDefinition from an object without spec\", data);\n }\n }\n getResourceUrl() {\n return Object(_routes__WEBPACK_IMPORTED_MODULE_2__[\"crdResourcesURL\"])({\n params: {\n group: this.getGroup(),\n name: this.getPluralName(),\n },\n });\n }\n getResourceApiBase() {\n const { group } = this.spec;\n return `/apis/${group}/${this.getVersion()}/${this.getPluralName()}`;\n }\n getPluralName() {\n return this.getNames().plural;\n }\n getResourceKind() {\n return this.spec.names.kind;\n }\n getResourceTitle() {\n const name = this.getPluralName();\n return name[0].toUpperCase() + name.substr(1);\n }\n getGroup() {\n return this.spec.group;\n }\n getScope() {\n return this.spec.scope;\n }\n getPreferedVersion() {\n const { apiVersion } = this;\n switch (apiVersion) {\n case \"apiextensions.k8s.io/v1\":\n for (const version of this.spec.versions) {\n if (version.storage) {\n return version;\n }\n }\n break;\n case \"apiextensions.k8s.io/v1beta1\"
|
|
38741
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CustomResourceDefinition\", function() { return CustomResourceDefinition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"crdApi\", function() { return crdApi; });\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _routes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../routes */ \"./src/common/routes/index.ts\");\n/* harmony import */ var _utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/cluster-id-url-parsing */ \"./src/common/utils/cluster-id-url-parsing.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\nclass CustomResourceDefinition extends _kube_object__WEBPACK_IMPORTED_MODULE_0__[\"KubeObject\"] {\n constructor(data) {\n super(data);\n if (!data.spec || typeof data.spec !== \"object\") {\n throw new _kube_object__WEBPACK_IMPORTED_MODULE_0__[\"KubeCreationError\"](\"Cannot create a CustomResourceDefinition from an object without spec\", data);\n }\n }\n getResourceUrl() {\n return Object(_routes__WEBPACK_IMPORTED_MODULE_2__[\"crdResourcesURL\"])({\n params: {\n group: this.getGroup(),\n name: this.getPluralName(),\n },\n });\n }\n getResourceApiBase() {\n const { group } = this.spec;\n return `/apis/${group}/${this.getVersion()}/${this.getPluralName()}`;\n }\n getPluralName() {\n return this.getNames().plural;\n }\n getResourceKind() {\n return this.spec.names.kind;\n }\n getResourceTitle() {\n const name = this.getPluralName();\n return name[0].toUpperCase() + name.substr(1);\n }\n getGroup() {\n return this.spec.group;\n }\n getScope() {\n return this.spec.scope;\n }\n getPreferedVersion() {\n const { apiVersion } = this;\n switch (apiVersion) {\n case \"apiextensions.k8s.io/v1\":\n for (const version of this.spec.versions) {\n if (version.storage) {\n return version;\n }\n }\n break;\n case \"apiextensions.k8s.io/v1beta1\": {\n const { additionalPrinterColumns: apc } = this.spec;\n const additionalPrinterColumns = apc === null || apc === void 0 ? void 0 : apc.map((_a) => {\n var { JSONPath } = _a, apc = __rest(_a, [\"JSONPath\"]);\n return (Object.assign(Object.assign({}, apc), { jsonPath: JSONPath }));\n });\n return {\n name: this.spec.version,\n served: true,\n storage: true,\n schema: this.spec.validation,\n additionalPrinterColumns,\n };\n }\n }\n throw new Error(`Unknown apiVersion=${apiVersion}: Failed to find a version for CustomResourceDefinition ${this.metadata.name}`);\n }\n getVersion() {\n return this.getPreferedVersion().name;\n }\n isNamespaced() {\n return this.getScope() === \"Namespaced\";\n }\n getStoredVersions() {\n return this.status.storedVersions.join(\", \");\n }\n getNames() {\n return this.spec.names;\n }\n getConversion() {\n return JSON.stringify(this.spec.conversion);\n }\n getPrinterColumns(ignorePriority = true) {\n var _a;\n const columns = (_a = this.getPreferedVersion().additionalPrinterColumns) !== null && _a !== void 0 ? _a : [];\n return columns\n .filter(column => column.name.toLowerCase() != \"age\" && (ignorePriority || !column.priority));\n }\n getValidation() {\n return JSON.stringify(this.getPreferedVersion().schema, null, 2);\n }\n getConditions() {\n var _a;\n if (!((_a = this.status) === null || _a === void 0 ? void 0 : _a.conditions))\n return [];\n return this.status.conditions.map(condition => {\n const { message, reason, lastTransitionTime, status } = condition;\n return Object.assign(Object.assign({}, condition), { isReady: status === \"True\", tooltip: `${message || reason} (${lastTransitionTime})` });\n });\n }\n}\nObject.defineProperty(CustomResourceDefinition, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"CustomResourceDefinition\"\n});\nObject.defineProperty(CustomResourceDefinition, \"namespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n});\nObject.defineProperty(CustomResourceDefinition, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"/apis/apiextensions.k8s.io/v1/customresourcedefinitions\"\n});\n/**\n * Only available within kubernetes cluster pages\n */\nlet crdApi;\nif (Object(_utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_3__[\"isClusterPageContext\"])()) {\n crdApi = new _kube_api__WEBPACK_IMPORTED_MODULE_1__[\"KubeApi\"]({\n objectConstructor: CustomResourceDefinition,\n checkPreferredVersion: true,\n });\n}\n\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/endpoints/crd.api.ts?");
|
|
38764
38742
|
|
|
38765
38743
|
/***/ }),
|
|
38766
38744
|
|
|
@@ -38856,7 +38834,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _clu
|
|
|
38856
38834
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
38857
38835
|
|
|
38858
38836
|
"use strict";
|
|
38859
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IngressApi\", function() { return IngressApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMetricsForIngress\", function() { return getMetricsForIngress; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBackendServiceNamePort\", function() { return getBackendServiceNamePort; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Ingress\", function() { return Ingress; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ingressApi\", function() { return ingressApi; });\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _metrics_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./metrics.api */ \"./src/common/k8s-api/endpoints/metrics.api.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/cluster-id-url-parsing */ \"./src/common/utils/cluster-id-url-parsing.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\nclass IngressApi extends _kube_api__WEBPACK_IMPORTED_MODULE_3__[\"KubeApi\"] {\n}\nfunction getMetricsForIngress(ingress, namespace) {\n const opts = { category: \"ingress\", ingress, namespace };\n return _metrics_api__WEBPACK_IMPORTED_MODULE_2__[\"metricsApi\"].getMetrics({\n bytesSentSuccess: opts,\n bytesSentFailure: opts,\n requestDurationSeconds: opts,\n responseDurationSeconds: opts,\n }, {\n namespace,\n });\n}\nconst getBackendServiceNamePort = (backend) => {\n var _a;\n // .service is available with networking.k8s.io/v1, otherwise using extensions/v1beta1 interface\n const serviceName = \"service\" in backend ? backend.service.name : backend.serviceName;\n // Port is specified either with a number or name\n const servicePort = \"service\" in backend ? (_a = backend.service.port.number) !== null && _a !== void 0 ? _a : backend.service.port.name : backend.servicePort;\n return { serviceName, servicePort };\n};\nclass Ingress extends _kube_object__WEBPACK_IMPORTED_MODULE_0__[\"KubeObject\"] {\n constructor(data) {\n super(data);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n }\n getRoutes() {\n const { spec: { tls, rules } } = this;\n if (!rules)\n return [];\n let protocol = \"http\";\n const routes = [];\n if (tls && tls.length > 0) {\n protocol += \"s\";\n }\n rules.map(rule => {\n const host = rule.host ? rule.host : \"*\";\n if (rule.http && rule.http.paths) {\n rule.http.paths.forEach(path => {\n const { serviceName, servicePort } = getBackendServiceNamePort(path.backend);\n routes.push(`${protocol}://${host}${path.path || \"/\"} ⇢ ${serviceName}:${servicePort}`);\n });\n }\n });\n return routes;\n }\n getServiceNamePort() {\n var _a, _b, _c, _d, _e, _f;\n const { spec: { backend, defaultBackend } = {} } = this;\n const serviceName = (_b = (_a = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : backend === null || backend === void 0 ? void 0 : backend.serviceName;\n const servicePort = (_f = (_d = (_c = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service) === null || _c === void 0 ? void 0 : _c.port.number) !== null && _d !== void 0 ? _d : (_e = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service) === null || _e === void 0 ? void 0 : _e.port.name) !== null && _f !== void 0 ? _f : backend === null || backend === void 0 ? void 0 : backend.servicePort;\n return {\n serviceName,\n servicePort,\n };\n }\n getHosts() {\n const { spec: { rules } } = this;\n if (!rules)\n return [];\n return rules.filter(rule => rule.host).map(rule => rule.host);\n }\n getPorts() {\n var _a;\n const ports = [];\n const { spec: { tls, rules, backend, defaultBackend } } = this;\n const httpPort = 80;\n const tlsPort = 443;\n // Note: not using the port name (string)\n const servicePort = (_a = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service.port.number) !== null && _a !== void 0 ? _a : backend === null || backend === void 0 ? void 0 : backend.servicePort;\n if (rules && rules.length > 0) {\n if (rules.some(rule =>
|
|
38837
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IngressApi\", function() { return IngressApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMetricsForIngress\", function() { return getMetricsForIngress; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBackendServiceNamePort\", function() { return getBackendServiceNamePort; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Ingress\", function() { return Ingress; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ingressApi\", function() { return ingressApi; });\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _metrics_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./metrics.api */ \"./src/common/k8s-api/endpoints/metrics.api.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/cluster-id-url-parsing */ \"./src/common/utils/cluster-id-url-parsing.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\nclass IngressApi extends _kube_api__WEBPACK_IMPORTED_MODULE_3__[\"KubeApi\"] {\n}\nfunction getMetricsForIngress(ingress, namespace) {\n const opts = { category: \"ingress\", ingress, namespace };\n return _metrics_api__WEBPACK_IMPORTED_MODULE_2__[\"metricsApi\"].getMetrics({\n bytesSentSuccess: opts,\n bytesSentFailure: opts,\n requestDurationSeconds: opts,\n responseDurationSeconds: opts,\n }, {\n namespace,\n });\n}\nconst getBackendServiceNamePort = (backend) => {\n var _a;\n // .service is available with networking.k8s.io/v1, otherwise using extensions/v1beta1 interface\n const serviceName = \"service\" in backend ? backend.service.name : backend.serviceName;\n // Port is specified either with a number or name\n const servicePort = \"service\" in backend ? (_a = backend.service.port.number) !== null && _a !== void 0 ? _a : backend.service.port.name : backend.servicePort;\n return { serviceName, servicePort };\n};\nclass Ingress extends _kube_object__WEBPACK_IMPORTED_MODULE_0__[\"KubeObject\"] {\n constructor(data) {\n super(data);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n }\n getRoutes() {\n const { spec: { tls, rules } } = this;\n if (!rules)\n return [];\n let protocol = \"http\";\n const routes = [];\n if (tls && tls.length > 0) {\n protocol += \"s\";\n }\n rules.map(rule => {\n const host = rule.host ? rule.host : \"*\";\n if (rule.http && rule.http.paths) {\n rule.http.paths.forEach(path => {\n const { serviceName, servicePort } = getBackendServiceNamePort(path.backend);\n routes.push(`${protocol}://${host}${path.path || \"/\"} ⇢ ${serviceName}:${servicePort}`);\n });\n }\n });\n return routes;\n }\n getServiceNamePort() {\n var _a, _b, _c, _d, _e, _f;\n const { spec: { backend, defaultBackend } = {} } = this;\n const serviceName = (_b = (_a = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : backend === null || backend === void 0 ? void 0 : backend.serviceName;\n const servicePort = (_f = (_d = (_c = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service) === null || _c === void 0 ? void 0 : _c.port.number) !== null && _d !== void 0 ? _d : (_e = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service) === null || _e === void 0 ? void 0 : _e.port.name) !== null && _f !== void 0 ? _f : backend === null || backend === void 0 ? void 0 : backend.servicePort;\n return {\n serviceName,\n servicePort,\n };\n }\n getHosts() {\n const { spec: { rules } } = this;\n if (!rules)\n return [];\n return rules.filter(rule => rule.host).map(rule => rule.host);\n }\n getPorts() {\n var _a;\n const ports = [];\n const { spec: { tls, rules, backend, defaultBackend } } = this;\n const httpPort = 80;\n const tlsPort = 443;\n // Note: not using the port name (string)\n const servicePort = (_a = defaultBackend === null || defaultBackend === void 0 ? void 0 : defaultBackend.service.port.number) !== null && _a !== void 0 ? _a : backend === null || backend === void 0 ? void 0 : backend.servicePort;\n if (rules && rules.length > 0) {\n if (rules.some(rule => Object.prototype.hasOwnProperty.call(rule, \"http\"))) {\n ports.push(httpPort);\n }\n }\n else if (servicePort !== undefined) {\n ports.push(Number(servicePort));\n }\n if (tls && tls.length > 0) {\n ports.push(tlsPort);\n }\n return ports.join(\", \");\n }\n getLoadBalancers() {\n var _a;\n const { status: { loadBalancer = { ingress: [] } } } = this;\n return ((_a = loadBalancer.ingress) !== null && _a !== void 0 ? _a : []).map(address => (address.hostname || address.ip));\n }\n}\nObject.defineProperty(Ingress, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"Ingress\"\n});\nObject.defineProperty(Ingress, \"namespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n});\nObject.defineProperty(Ingress, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"/apis/networking.k8s.io/v1/ingresses\"\n});\nlet ingressApi;\nif (Object(_utils_cluster_id_url_parsing__WEBPACK_IMPORTED_MODULE_4__[\"isClusterPageContext\"])()) {\n ingressApi = new IngressApi({\n objectConstructor: Ingress,\n // Add fallback for Kubernetes <1.19\n checkPreferredVersion: true,\n fallbackApiBases: [\"/apis/extensions/v1beta1/ingresses\"],\n });\n}\n\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/endpoints/ingress.api.ts?");
|
|
38860
38838
|
|
|
38861
38839
|
/***/ }),
|
|
38862
38840
|
|
|
@@ -38892,7 +38870,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
38892
38870
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
38893
38871
|
|
|
38894
38872
|
"use strict";
|
|
38895
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"metricsApi\", function() { return metricsApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"normalizeMetrics\", function() { return normalizeMetrics; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isMetricsEmpty\", function() { return isMetricsEmpty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getItemMetrics\", function() { return getItemMetrics; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMetricLastPoints\", function() { return getMetricLastPoints; });\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index */ \"./src/common/k8s-api/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Metrics api\n\n\nconst metricsApi = {\n async getMetrics(query, reqParams = {}) {\n const { range = 3600, step = 60, namespace } = reqParams;\n let { start, end } = reqParams;\n if (!start && !end) {\n const timeNow = Date.now() / 1000;\n const now = moment__WEBPACK_IMPORTED_MODULE_0___default.a.unix(timeNow).startOf(\"minute\").unix(); // round date to minutes\n start = now - range;\n end = now;\n }\n return _index__WEBPACK_IMPORTED_MODULE_1__[\"apiBase\"].post(\"/metrics\", {\n data: query,\n query: {\n start, end, step,\n \"kubernetes_namespace\": namespace,\n },\n });\n },\n async getMetricProviders() {\n return _index__WEBPACK_IMPORTED_MODULE_1__[\"apiBase\"].get(\"/metrics/providers\");\n },\n};\nfunction normalizeMetrics(metrics, frames = 60) {\n var _a;\n if (!((_a = metrics === null || metrics === void 0 ? void 0 : metrics.data) === null || _a === void 0 ? void 0 : _a.result)) {\n return {\n data: {\n resultType: \"\",\n result: [{\n metric: {},\n values: [],\n }],\n },\n status: \"\",\n };\n }\n const { result } = metrics.data;\n if (result.length) {\n if (frames > 0) {\n // fill the gaps\n result.forEach(res => {\n if (!res.values || !res.values.length)\n return;\n let now = moment__WEBPACK_IMPORTED_MODULE_0___default()().startOf(\"minute\").subtract(1, \"minute\").unix();\n let timestamp = res.values[0][0];\n while (timestamp <= now) {\n timestamp = moment__WEBPACK_IMPORTED_MODULE_0___default.a.unix(timestamp).add(1, \"minute\").unix();\n if (!res.values.find((value) => value[0] === timestamp)) {\n res.values.push([timestamp, \"0\"]);\n }\n }\n while (res.values.length < frames) {\n const timestamp = moment__WEBPACK_IMPORTED_MODULE_0___default.a.unix(res.values[0][0]).subtract(1, \"minute\").unix();\n if (!res.values.find((value) => value[0] === timestamp)) {\n res.values.unshift([timestamp, \"0\"]);\n }\n now = timestamp;\n }\n });\n }\n }\n else {\n // always return at least empty values array\n result.push({\n metric: {},\n values: [],\n });\n }\n return metrics;\n}\nfunction isMetricsEmpty(metrics) {\n return Object.values(metrics).every(metric => { var _a, _b; return !((_b = (_a = metric === null || metric === void 0 ? void 0 : metric.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.length); });\n}\nfunction getItemMetrics(metrics, itemName) {\n var _a, _b;\n if (!metrics)\n return;\n const itemMetrics = Object.assign({}, metrics);\n for (const metric in metrics) {\n if (!((_b = (_a = metrics[metric]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.result)) {\n continue;\n }\n const results = metrics[metric].data.result;\n const result = results.find(res => Object.values(res.metric)[0] == itemName);\n itemMetrics[metric].data.result = result ? [result] : [];\n }\n return itemMetrics;\n}\nfunction getMetricLastPoints(metrics) {\n const result = {};\n Object.keys(metrics).forEach(metricName => {\n try {\n const metric = metrics[metricName];\n if (metric.data.result.length) {\n result[metricName] = +metric.data.result[0].values.slice(-1)[0][1];\n }\n }\n catch (
|
|
38873
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"metricsApi\", function() { return metricsApi; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"normalizeMetrics\", function() { return normalizeMetrics; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isMetricsEmpty\", function() { return isMetricsEmpty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getItemMetrics\", function() { return getItemMetrics; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMetricLastPoints\", function() { return getMetricLastPoints; });\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index */ \"./src/common/k8s-api/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Metrics api\n\n\nconst metricsApi = {\n async getMetrics(query, reqParams = {}) {\n const { range = 3600, step = 60, namespace } = reqParams;\n let { start, end } = reqParams;\n if (!start && !end) {\n const timeNow = Date.now() / 1000;\n const now = moment__WEBPACK_IMPORTED_MODULE_0___default.a.unix(timeNow).startOf(\"minute\").unix(); // round date to minutes\n start = now - range;\n end = now;\n }\n return _index__WEBPACK_IMPORTED_MODULE_1__[\"apiBase\"].post(\"/metrics\", {\n data: query,\n query: {\n start, end, step,\n \"kubernetes_namespace\": namespace,\n },\n });\n },\n async getMetricProviders() {\n return _index__WEBPACK_IMPORTED_MODULE_1__[\"apiBase\"].get(\"/metrics/providers\");\n },\n};\nfunction normalizeMetrics(metrics, frames = 60) {\n var _a;\n if (!((_a = metrics === null || metrics === void 0 ? void 0 : metrics.data) === null || _a === void 0 ? void 0 : _a.result)) {\n return {\n data: {\n resultType: \"\",\n result: [{\n metric: {},\n values: [],\n }],\n },\n status: \"\",\n };\n }\n const { result } = metrics.data;\n if (result.length) {\n if (frames > 0) {\n // fill the gaps\n result.forEach(res => {\n if (!res.values || !res.values.length)\n return;\n let now = moment__WEBPACK_IMPORTED_MODULE_0___default()().startOf(\"minute\").subtract(1, \"minute\").unix();\n let timestamp = res.values[0][0];\n while (timestamp <= now) {\n timestamp = moment__WEBPACK_IMPORTED_MODULE_0___default.a.unix(timestamp).add(1, \"minute\").unix();\n if (!res.values.find((value) => value[0] === timestamp)) {\n res.values.push([timestamp, \"0\"]);\n }\n }\n while (res.values.length < frames) {\n const timestamp = moment__WEBPACK_IMPORTED_MODULE_0___default.a.unix(res.values[0][0]).subtract(1, \"minute\").unix();\n if (!res.values.find((value) => value[0] === timestamp)) {\n res.values.unshift([timestamp, \"0\"]);\n }\n now = timestamp;\n }\n });\n }\n }\n else {\n // always return at least empty values array\n result.push({\n metric: {},\n values: [],\n });\n }\n return metrics;\n}\nfunction isMetricsEmpty(metrics) {\n return Object.values(metrics).every(metric => { var _a, _b; return !((_b = (_a = metric === null || metric === void 0 ? void 0 : metric.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.length); });\n}\nfunction getItemMetrics(metrics, itemName) {\n var _a, _b;\n if (!metrics)\n return;\n const itemMetrics = Object.assign({}, metrics);\n for (const metric in metrics) {\n if (!((_b = (_a = metrics[metric]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.result)) {\n continue;\n }\n const results = metrics[metric].data.result;\n const result = results.find(res => Object.values(res.metric)[0] == itemName);\n itemMetrics[metric].data.result = result ? [result] : [];\n }\n return itemMetrics;\n}\nfunction getMetricLastPoints(metrics) {\n const result = {};\n Object.keys(metrics).forEach(metricName => {\n try {\n const metric = metrics[metricName];\n if (metric.data.result.length) {\n result[metricName] = +metric.data.result[0].values.slice(-1)[0][1];\n }\n }\n catch (_a) {\n // ignore error\n }\n return result;\n }, {});\n return result;\n}\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/endpoints/metrics.api.ts?");
|
|
38896
38874
|
|
|
38897
38875
|
/***/ }),
|
|
38898
38876
|
|
|
@@ -39180,7 +39158,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
39180
39158
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
39181
39159
|
|
|
39182
39160
|
"use strict";
|
|
39183
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forCluster\", function() { return forCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forRemoteCluster\", function() { return forRemoteCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureObjectSelfLink\", function() { return ensureObjectSelfLink; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeApi\", function() { return KubeApi; });\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! querystring */ \"querystring\");\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(querystring__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _api_manager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index */ \"./src/common/k8s-api/index.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! byline */ \"./node_modules/byline/lib/byline.js\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(byline__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _kube_json_api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./kube-json-api */ \"./src/common/k8s-api/kube-json-api.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! https */ \"https\");\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(https__WEBPACK_IMPORTED_MODULE_12__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n// Base class for building all kubernetes apis\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction forCluster(cluster, kubeClass, apiClass = null) {\n const url = new URL(_index__WEBPACK_IMPORTED_MODULE_5__[\"apiBase\"].config.serverAddress);\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_9__[\"KubeJsonApi\"]({\n serverAddress: _index__WEBPACK_IMPORTED_MODULE_5__[\"apiBase\"].config.serverAddress,\n apiBase: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiKubePrefix\"],\n debug: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"isDevelopment\"],\n }, {\n headers: {\n \"Host\": `${cluster.metadata.uid}.localhost:${url.port}`,\n },\n });\n if (!apiClass) {\n apiClass = KubeApi;\n }\n return new apiClass({\n objectConstructor: kubeClass,\n request,\n });\n}\nfunction forRemoteCluster(config, kubeClass, apiClass = null) {\n const reqInit = {};\n const agentOptions = {};\n if (config.cluster.skipTLSVerify === true) {\n agentOptions.rejectUnauthorized = false;\n }\n if (config.user.clientCertificateData) {\n agentOptions.cert = config.user.clientCertificateData;\n }\n if (config.user.clientKeyData) {\n agentOptions.key = config.user.clientKeyData;\n }\n if (config.cluster.caData) {\n agentOptions.ca = config.cluster.caData;\n }\n if (Object.keys(agentOptions).length > 0) {\n reqInit.agent = new https__WEBPACK_IMPORTED_MODULE_12__[\"Agent\"](agentOptions);\n }\n const token = config.user.token;\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_9__[\"KubeJsonApi\"](Object.assign({ serverAddress: config.cluster.server, apiBase: \"\", debug: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"isDevelopment\"] }, (token ? {\n getRequestOptions: async () => ({\n headers: {\n \"Authorization\": `Bearer ${Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"isFunction\"])(token) ? await token() : token}`,\n },\n }),\n } : {})), reqInit);\n if (!apiClass) {\n apiClass = KubeApi;\n }\n return new apiClass({\n objectConstructor: kubeClass,\n request,\n });\n}\nfunction ensureObjectSelfLink(api, object) {\n if (!object.metadata.selfLink) {\n object.metadata.selfLink = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: api.apiPrefix,\n apiVersion: api.apiVersionWithGroup,\n resource: api.apiResource,\n namespace: api.isNamespaced ? object.metadata.namespace : undefined,\n name: object.metadata.name,\n });\n }\n}\nconst patchTypeHeaders = {\n \"merge\": \"application/merge-patch+json\",\n \"json\": \"application/json-patch+json\",\n \"strategic\": \"application/strategic-merge-patch+json\",\n};\nclass KubeApi {\n constructor(options) {\n var _a;\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiPrefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiGroup\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersionPreferred\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiResource\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"isNamespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"objectConstructor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"request\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"resourceVersions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Map()\n });\n Object.defineProperty(this, \"watchDisposer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"watchId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 1\n });\n const { objectConstructor, request, kind, isNamespaced } = options;\n const { apiBase, apiPrefix, apiGroup, apiVersion, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"parseKubeApi\"])(options.apiBase || objectConstructor.apiBase);\n this.options = options;\n this.kind = kind !== null && kind !== void 0 ? kind : objectConstructor.kind;\n this.isNamespaced = (_a = isNamespaced !== null && isNamespaced !== void 0 ? isNamespaced : objectConstructor.namespaced) !== null && _a !== void 0 ? _a : false;\n this.apiBase = apiBase;\n this.apiPrefix = apiPrefix;\n this.apiGroup = apiGroup;\n this.apiVersion = apiVersion;\n this.apiResource = resource;\n this.request = request !== null && request !== void 0 ? request : _index__WEBPACK_IMPORTED_MODULE_5__[\"apiKube\"];\n this.objectConstructor = objectConstructor;\n this.parseResponse = this.parseResponse.bind(this);\n _api_manager__WEBPACK_IMPORTED_MODULE_4__[\"apiManager\"].registerApi(apiBase, this);\n }\n get apiVersionWithGroup() {\n var _a;\n return [this.apiGroup, (_a = this.apiVersionPreferred) !== null && _a !== void 0 ? _a : this.apiVersion]\n .filter(Boolean)\n .join(\"/\");\n }\n /**\n * Returns the latest API prefix/group that contains the required resource.\n * First tries options.apiBase, then urls in order from options.fallbackApiBases.\n */\n async getLatestApiPrefixGroup() {\n var _a;\n // Note that this.options.apiBase is the \"full\" url, whereas this.apiBase is parsed\n const apiBases = [this.options.apiBase, this.objectConstructor.apiBase, ...this.options.fallbackApiBases];\n for (const apiUrl of apiBases) {\n if (!apiUrl) {\n continue;\n }\n try {\n // Split e.g. \"/apis/extensions/v1beta1/ingresses\" to parts\n const { apiPrefix, apiGroup, apiVersionWithGroup, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"parseKubeApi\"])(apiUrl);\n // Request available resources\n const response = await this.request.get(`${apiPrefix}/${apiVersionWithGroup}`);\n // If the resource is found in the group, use this apiUrl\n if ((_a = response.resources) === null || _a === void 0 ? void 0 : _a.find(kubeResource => kubeResource.name === resource)) {\n return { apiPrefix, apiGroup };\n }\n }\n catch (error) {\n // Exception is ignored as we can try the next url\n }\n }\n throw new Error(`Can't find working API for the Kubernetes resource ${this.apiResource}`);\n }\n /**\n * Get the apiPrefix and apiGroup to be used for fetching the preferred version.\n */\n async getPreferredVersionPrefixGroup() {\n if (this.options.fallbackApiBases) {\n try {\n return await this.getLatestApiPrefixGroup();\n }\n catch (error) {\n // If valid API wasn't found, log the error and return defaults below\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBE-API]: ${error}`);\n }\n }\n return {\n apiPrefix: this.apiPrefix,\n apiGroup: this.apiGroup,\n };\n }\n async checkPreferredVersion() {\n var _a, _b;\n if (this.options.fallbackApiBases && !this.options.checkPreferredVersion) {\n throw new Error(\"checkPreferredVersion must be enabled if fallbackApiBases is set in KubeApi\");\n }\n if (this.options.checkPreferredVersion && this.apiVersionPreferred === undefined) {\n const { apiPrefix, apiGroup } = await this.getPreferredVersionPrefixGroup();\n // The apiPrefix and apiGroup might change due to fallbackApiBases, so we must override them\n this.apiPrefix = apiPrefix;\n this.apiGroup = apiGroup;\n const url = [apiPrefix, apiGroup].filter(Boolean).join(\"/\");\n const res = await this.request.get(url);\n this.apiVersionPreferred = (_b = (_a = res === null || res === void 0 ? void 0 : res.preferredVersion) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : null;\n if (this.apiVersionPreferred) {\n this.apiBase = this.computeApiBase();\n _api_manager__WEBPACK_IMPORTED_MODULE_4__[\"apiManager\"].registerApi(this.apiBase, this);\n }\n }\n }\n setResourceVersion(namespace = \"\", newVersion) {\n this.resourceVersions.set(namespace, newVersion);\n }\n getResourceVersion(namespace = \"\") {\n return this.resourceVersions.get(namespace);\n }\n async refreshResourceVersion(params) {\n return this.list(params, { limit: 1 });\n }\n computeApiBase() {\n return Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: this.apiPrefix,\n apiVersion: this.apiVersionWithGroup,\n resource: this.apiResource,\n });\n }\n getUrl({ name, namespace } = {}, query) {\n const resourcePath = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: this.apiPrefix,\n apiVersion: this.apiVersionWithGroup,\n resource: this.apiResource,\n namespace: this.isNamespaced ? namespace !== null && namespace !== void 0 ? namespace : \"default\" : undefined,\n name,\n });\n return resourcePath + (query ? `?${Object(querystring__WEBPACK_IMPORTED_MODULE_1__[\"stringify\"])(this.normalizeQuery(query))}` : \"\");\n }\n normalizeQuery(query = {}) {\n if (query.labelSelector) {\n query.labelSelector = [query.labelSelector].flat().join(\",\");\n }\n if (query.fieldSelector) {\n query.fieldSelector = [query.fieldSelector].flat().join(\",\");\n }\n return query;\n }\n parseResponse(data, namespace) {\n if (!data)\n return null;\n const KubeObjectConstructor = this.objectConstructor;\n // process items list response, check before single item since there is overlap\n if (_kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isJsonApiDataList(data, _kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isPartialJsonApiData)) {\n const { apiVersion, items, metadata } = data;\n this.setResourceVersion(namespace, metadata.resourceVersion);\n this.setResourceVersion(\"\", metadata.resourceVersion);\n return items.map((item) => {\n const object = new KubeObjectConstructor(Object.assign({ kind: this.kind, apiVersion }, item));\n ensureObjectSelfLink(this, object);\n return object;\n });\n }\n // process a single item\n if (_kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isJsonApiData(data)) {\n const object = new KubeObjectConstructor(data);\n ensureObjectSelfLink(this, object);\n return object;\n }\n // custom apis might return array for list response, e.g. users, groups, etc.\n if (Array.isArray(data)) {\n return data.map(data => new KubeObjectConstructor(data));\n }\n return null;\n }\n async list({ namespace = \"\", reqInit } = {}, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl({ namespace });\n const res = await this.request.get(url, { query }, reqInit);\n const parsed = this.parseResponse(res, namespace);\n if (Array.isArray(parsed)) {\n return parsed;\n }\n if (!parsed) {\n return null;\n }\n throw new Error(`GET multiple request to ${url} returned not an array: ${JSON.stringify(parsed)}`);\n }\n async get(desc, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl(desc);\n const res = await this.request.get(url, { query });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`GET single request to ${url} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async create({ name, namespace }, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace });\n const res = await this.request.post(apiUrl, {\n data: Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])(data, {\n kind: this.kind,\n apiVersion: this.apiVersionWithGroup,\n metadata: {\n name,\n namespace,\n },\n }),\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`POST request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async update({ name, namespace }, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace, name });\n const res = await this.request.put(apiUrl, {\n data: Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])(data, {\n metadata: {\n name,\n namespace,\n },\n }),\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`PUT request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async patch(desc, data, strategy = \"strategic\") {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl(desc);\n const res = await this.request.patch(apiUrl, { data }, {\n headers: {\n \"content-type\": patchTypeHeaders[strategy],\n },\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`PATCH request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async delete(_a) {\n var { propagationPolicy = \"Background\" } = _a, desc = __rest(_a, [\"propagationPolicy\"]);\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl(desc);\n return this.request.del(apiUrl, {\n query: {\n propagationPolicy,\n },\n });\n }\n getWatchUrl(namespace = \"\", query = {}) {\n return this.getUrl({ namespace }, Object.assign({ watch: 1, resourceVersion: this.getResourceVersion(namespace) }, query));\n }\n watch(opts = { namespace: \"\", retry: false }) {\n let errorReceived = false;\n let timedRetry;\n const { namespace, callback = _utils__WEBPACK_IMPORTED_MODULE_10__[\"noop\"], retry, timeout } = opts;\n const { watchId = `${this.kind.toLowerCase()}-${this.watchId++}` } = opts;\n // Create AbortController for this request\n const abortController = new abort_controller__WEBPACK_IMPORTED_MODULE_11___default.a();\n // If caller aborts, abort using request's abortController\n if (opts.abortController) {\n opts.abortController.signal.addEventListener(\"abort\", () => {\n abortController.abort();\n });\n }\n abortController.signal.addEventListener(\"abort\", () => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) aborted ${watchUrl}`);\n clearTimeout(timedRetry);\n });\n const requestParams = timeout ? { query: { timeoutSeconds: timeout } } : {};\n const watchUrl = this.getWatchUrl(namespace);\n const responsePromise = this.request.getResponse(watchUrl, requestParams, {\n signal: abortController.signal,\n timeout: 600000,\n });\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${retry === true ? \"retried\" : \"started\"} ${watchUrl}`);\n responsePromise\n .then(response => {\n // True if the current watch request was retried\n let requestRetried = false;\n if (!response.ok) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].warn(`[KUBE-API] watch (${watchId}) error response ${watchUrl}`, { status: response.status });\n return callback(null, response);\n }\n // Add mechanism to retry in case timeoutSeconds is set but the watch wasn't timed out.\n // This can happen if e.g. network is offline and AWS NLB is used.\n if (timeout) {\n setTimeout(() => {\n // We only retry if we haven't retried, haven't aborted and haven't received k8s error\n if (requestRetried || abortController.signal.aborted || errorReceived) {\n return;\n }\n // Close current request\n abortController.abort();\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] Watch timeout set, but not retried, retrying now`);\n requestRetried = true;\n // Clearing out any possible timeout, although we don't expect this to be set\n clearTimeout(timedRetry);\n this.watch(Object.assign(Object.assign({}, opts), { namespace, callback, watchId, retry: true }));\n // We wait longer than the timeout, as we expect the request to be retried with timeoutSeconds\n }, timeout * 1000 * 1.1);\n }\n [\"end\", \"close\", \"error\"].forEach((eventName) => {\n response.body.on(eventName, () => {\n // We only retry if we haven't retried, haven't aborted and haven't received k8s error\n // kubernetes errors (=errorReceived set) should be handled in a callback\n if (requestRetried || abortController.signal.aborted || errorReceived) {\n return;\n }\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${eventName} ${watchUrl}`);\n requestRetried = true;\n clearTimeout(timedRetry);\n timedRetry = setTimeout(() => {\n this.watch(Object.assign(Object.assign({}, opts), { namespace, callback, watchId, retry: true }));\n }, 1000);\n });\n });\n byline__WEBPACK_IMPORTED_MODULE_8___default()(response.body).on(\"data\", (line) => {\n try {\n const event = JSON.parse(line);\n if (event.type === \"ERROR\" && event.object.kind === \"Status\") {\n errorReceived = true;\n return callback(null, new _kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeStatus\"](event.object));\n }\n this.modifyWatchEvent(event);\n callback(event, null);\n }\n catch (ignore) {\n // ignore parse errors\n }\n });\n })\n .catch(error => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBE-API] watch (${watchId}) throwed ${watchUrl}`, error);\n callback(null, error);\n });\n return abortController.abort;\n }\n modifyWatchEvent(event) {\n switch (event.type) {\n case \"ADDED\":\n case \"DELETED\":\n case \"MODIFIED\": {\n ensureObjectSelfLink(this, event.object);\n const { namespace, resourceVersion } = event.object.metadata;\n this.setResourceVersion(namespace, resourceVersion);\n this.setResourceVersion(\"\", resourceVersion);\n break;\n }\n }\n }\n}\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-api.ts?");
|
|
39161
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forCluster\", function() { return forCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"forRemoteCluster\", function() { return forRemoteCluster; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureObjectSelfLink\", function() { return ensureObjectSelfLink; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeApi\", function() { return KubeApi; });\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! querystring */ \"querystring\");\n/* harmony import */ var querystring__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(querystring__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _api_manager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index */ \"./src/common/k8s-api/index.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! byline */ \"./node_modules/byline/lib/byline.js\");\n/* harmony import */ var byline__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(byline__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _kube_json_api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./kube-json-api */ \"./src/common/k8s-api/kube-json-api.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! https */ \"https\");\n/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(https__WEBPACK_IMPORTED_MODULE_12__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n// Base class for building all kubernetes apis\n\n\n\n\n\n\n\n\n\n\n\n// BUG: https://github.com/mysticatea/abort-controller/pull/22\n// eslint-disable-next-line import/no-named-as-default\n\n\nfunction forCluster(cluster, kubeClass, apiClass = null) {\n const url = new URL(_index__WEBPACK_IMPORTED_MODULE_5__[\"apiBase\"].config.serverAddress);\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_9__[\"KubeJsonApi\"]({\n serverAddress: _index__WEBPACK_IMPORTED_MODULE_5__[\"apiBase\"].config.serverAddress,\n apiBase: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"apiKubePrefix\"],\n debug: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"isDevelopment\"],\n }, {\n headers: {\n \"Host\": `${cluster.metadata.uid}.localhost:${url.port}`,\n },\n });\n if (!apiClass) {\n apiClass = KubeApi;\n }\n return new apiClass({\n objectConstructor: kubeClass,\n request,\n });\n}\nfunction forRemoteCluster(config, kubeClass, apiClass = null) {\n const reqInit = {};\n const agentOptions = {};\n if (config.cluster.skipTLSVerify === true) {\n agentOptions.rejectUnauthorized = false;\n }\n if (config.user.clientCertificateData) {\n agentOptions.cert = config.user.clientCertificateData;\n }\n if (config.user.clientKeyData) {\n agentOptions.key = config.user.clientKeyData;\n }\n if (config.cluster.caData) {\n agentOptions.ca = config.cluster.caData;\n }\n if (Object.keys(agentOptions).length > 0) {\n reqInit.agent = new https__WEBPACK_IMPORTED_MODULE_12__[\"Agent\"](agentOptions);\n }\n const token = config.user.token;\n const request = new _kube_json_api__WEBPACK_IMPORTED_MODULE_9__[\"KubeJsonApi\"](Object.assign({ serverAddress: config.cluster.server, apiBase: \"\", debug: _common_vars__WEBPACK_IMPORTED_MODULE_2__[\"isDevelopment\"] }, (token ? {\n getRequestOptions: async () => ({\n headers: {\n \"Authorization\": `Bearer ${Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"isFunction\"])(token) ? await token() : token}`,\n },\n }),\n } : {})), reqInit);\n if (!apiClass) {\n apiClass = KubeApi;\n }\n return new apiClass({\n objectConstructor: kubeClass,\n request,\n });\n}\nfunction ensureObjectSelfLink(api, object) {\n if (!object.metadata.selfLink) {\n object.metadata.selfLink = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: api.apiPrefix,\n apiVersion: api.apiVersionWithGroup,\n resource: api.apiResource,\n namespace: api.isNamespaced ? object.metadata.namespace : undefined,\n name: object.metadata.name,\n });\n }\n}\nconst patchTypeHeaders = {\n \"merge\": \"application/merge-patch+json\",\n \"json\": \"application/json-patch+json\",\n \"strategic\": \"application/strategic-merge-patch+json\",\n};\nclass KubeApi {\n constructor(options) {\n var _a;\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiPrefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiGroup\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiVersionPreferred\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"apiResource\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"isNamespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"objectConstructor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"request\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"resourceVersions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Map()\n });\n Object.defineProperty(this, \"watchDisposer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"watchId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 1\n });\n const { objectConstructor, request, kind, isNamespaced } = options;\n const { apiBase, apiPrefix, apiGroup, apiVersion, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"parseKubeApi\"])(options.apiBase || objectConstructor.apiBase);\n this.options = options;\n this.kind = kind !== null && kind !== void 0 ? kind : objectConstructor.kind;\n this.isNamespaced = (_a = isNamespaced !== null && isNamespaced !== void 0 ? isNamespaced : objectConstructor.namespaced) !== null && _a !== void 0 ? _a : false;\n this.apiBase = apiBase;\n this.apiPrefix = apiPrefix;\n this.apiGroup = apiGroup;\n this.apiVersion = apiVersion;\n this.apiResource = resource;\n this.request = request !== null && request !== void 0 ? request : _index__WEBPACK_IMPORTED_MODULE_5__[\"apiKube\"];\n this.objectConstructor = objectConstructor;\n this.parseResponse = this.parseResponse.bind(this);\n _api_manager__WEBPACK_IMPORTED_MODULE_4__[\"apiManager\"].registerApi(apiBase, this);\n }\n get apiVersionWithGroup() {\n var _a;\n return [this.apiGroup, (_a = this.apiVersionPreferred) !== null && _a !== void 0 ? _a : this.apiVersion]\n .filter(Boolean)\n .join(\"/\");\n }\n /**\n * Returns the latest API prefix/group that contains the required resource.\n * First tries options.apiBase, then urls in order from options.fallbackApiBases.\n */\n async getLatestApiPrefixGroup() {\n var _a;\n // Note that this.options.apiBase is the \"full\" url, whereas this.apiBase is parsed\n const apiBases = [this.options.apiBase, this.objectConstructor.apiBase, ...this.options.fallbackApiBases];\n for (const apiUrl of apiBases) {\n if (!apiUrl) {\n continue;\n }\n try {\n // Split e.g. \"/apis/extensions/v1beta1/ingresses\" to parts\n const { apiPrefix, apiGroup, apiVersionWithGroup, resource } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"parseKubeApi\"])(apiUrl);\n // Request available resources\n const response = await this.request.get(`${apiPrefix}/${apiVersionWithGroup}`);\n // If the resource is found in the group, use this apiUrl\n if ((_a = response.resources) === null || _a === void 0 ? void 0 : _a.find(kubeResource => kubeResource.name === resource)) {\n return { apiPrefix, apiGroup };\n }\n }\n catch (error) {\n // Exception is ignored as we can try the next url\n }\n }\n throw new Error(`Can't find working API for the Kubernetes resource ${this.apiResource}`);\n }\n /**\n * Get the apiPrefix and apiGroup to be used for fetching the preferred version.\n */\n async getPreferredVersionPrefixGroup() {\n if (this.options.fallbackApiBases) {\n try {\n return await this.getLatestApiPrefixGroup();\n }\n catch (error) {\n // If valid API wasn't found, log the error and return defaults below\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBE-API]: ${error}`);\n }\n }\n return {\n apiPrefix: this.apiPrefix,\n apiGroup: this.apiGroup,\n };\n }\n async checkPreferredVersion() {\n var _a, _b;\n if (this.options.fallbackApiBases && !this.options.checkPreferredVersion) {\n throw new Error(\"checkPreferredVersion must be enabled if fallbackApiBases is set in KubeApi\");\n }\n if (this.options.checkPreferredVersion && this.apiVersionPreferred === undefined) {\n const { apiPrefix, apiGroup } = await this.getPreferredVersionPrefixGroup();\n // The apiPrefix and apiGroup might change due to fallbackApiBases, so we must override them\n this.apiPrefix = apiPrefix;\n this.apiGroup = apiGroup;\n const url = [apiPrefix, apiGroup].filter(Boolean).join(\"/\");\n const res = await this.request.get(url);\n this.apiVersionPreferred = (_b = (_a = res === null || res === void 0 ? void 0 : res.preferredVersion) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : null;\n if (this.apiVersionPreferred) {\n this.apiBase = this.computeApiBase();\n _api_manager__WEBPACK_IMPORTED_MODULE_4__[\"apiManager\"].registerApi(this.apiBase, this);\n }\n }\n }\n setResourceVersion(namespace = \"\", newVersion) {\n this.resourceVersions.set(namespace, newVersion);\n }\n getResourceVersion(namespace = \"\") {\n return this.resourceVersions.get(namespace);\n }\n async refreshResourceVersion(params) {\n return this.list(params, { limit: 1 });\n }\n computeApiBase() {\n return Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: this.apiPrefix,\n apiVersion: this.apiVersionWithGroup,\n resource: this.apiResource,\n });\n }\n getUrl({ name, namespace } = {}, query) {\n const resourcePath = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_6__[\"createKubeApiURL\"])({\n apiPrefix: this.apiPrefix,\n apiVersion: this.apiVersionWithGroup,\n resource: this.apiResource,\n namespace: this.isNamespaced ? namespace !== null && namespace !== void 0 ? namespace : \"default\" : undefined,\n name,\n });\n return resourcePath + (query ? `?${Object(querystring__WEBPACK_IMPORTED_MODULE_1__[\"stringify\"])(this.normalizeQuery(query))}` : \"\");\n }\n normalizeQuery(query = {}) {\n if (query.labelSelector) {\n query.labelSelector = [query.labelSelector].flat().join(\",\");\n }\n if (query.fieldSelector) {\n query.fieldSelector = [query.fieldSelector].flat().join(\",\");\n }\n return query;\n }\n parseResponse(data, namespace) {\n if (!data)\n return null;\n const KubeObjectConstructor = this.objectConstructor;\n // process items list response, check before single item since there is overlap\n if (_kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isJsonApiDataList(data, _kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isPartialJsonApiData)) {\n const { apiVersion, items, metadata } = data;\n this.setResourceVersion(namespace, metadata.resourceVersion);\n this.setResourceVersion(\"\", metadata.resourceVersion);\n return items.map((item) => {\n const object = new KubeObjectConstructor(Object.assign({ kind: this.kind, apiVersion }, item));\n ensureObjectSelfLink(this, object);\n return object;\n });\n }\n // process a single item\n if (_kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeObject\"].isJsonApiData(data)) {\n const object = new KubeObjectConstructor(data);\n ensureObjectSelfLink(this, object);\n return object;\n }\n // custom apis might return array for list response, e.g. users, groups, etc.\n if (Array.isArray(data)) {\n return data.map(data => new KubeObjectConstructor(data));\n }\n return null;\n }\n async list({ namespace = \"\", reqInit } = {}, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl({ namespace });\n const res = await this.request.get(url, { query }, reqInit);\n const parsed = this.parseResponse(res, namespace);\n if (Array.isArray(parsed)) {\n return parsed;\n }\n if (!parsed) {\n return null;\n }\n throw new Error(`GET multiple request to ${url} returned not an array: ${JSON.stringify(parsed)}`);\n }\n async get(desc, query) {\n await this.checkPreferredVersion();\n const url = this.getUrl(desc);\n const res = await this.request.get(url, { query });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`GET single request to ${url} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async create({ name, namespace }, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace });\n const res = await this.request.post(apiUrl, {\n data: Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])(data, {\n kind: this.kind,\n apiVersion: this.apiVersionWithGroup,\n metadata: {\n name,\n namespace,\n },\n }),\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`POST request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async update({ name, namespace }, data) {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl({ namespace, name });\n const res = await this.request.put(apiUrl, {\n data: Object(lodash__WEBPACK_IMPORTED_MODULE_0__[\"merge\"])(data, {\n metadata: {\n name,\n namespace,\n },\n }),\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`PUT request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async patch(desc, data, strategy = \"strategic\") {\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl(desc);\n const res = await this.request.patch(apiUrl, { data }, {\n headers: {\n \"content-type\": patchTypeHeaders[strategy],\n },\n });\n const parsed = this.parseResponse(res);\n if (Array.isArray(parsed)) {\n throw new Error(`PATCH request to ${apiUrl} returned an array: ${JSON.stringify(parsed)}`);\n }\n return parsed;\n }\n async delete(_a) {\n var { propagationPolicy = \"Background\" } = _a, desc = __rest(_a, [\"propagationPolicy\"]);\n await this.checkPreferredVersion();\n const apiUrl = this.getUrl(desc);\n return this.request.del(apiUrl, {\n query: {\n propagationPolicy,\n },\n });\n }\n getWatchUrl(namespace = \"\", query = {}) {\n return this.getUrl({ namespace }, Object.assign({ watch: 1, resourceVersion: this.getResourceVersion(namespace) }, query));\n }\n watch(opts = { namespace: \"\", retry: false }) {\n let errorReceived = false;\n let timedRetry;\n const { namespace, callback = _utils__WEBPACK_IMPORTED_MODULE_10__[\"noop\"], retry, timeout } = opts;\n const { watchId = `${this.kind.toLowerCase()}-${this.watchId++}` } = opts;\n // Create AbortController for this request\n const abortController = new abort_controller__WEBPACK_IMPORTED_MODULE_11___default.a();\n // If caller aborts, abort using request's abortController\n if (opts.abortController) {\n opts.abortController.signal.addEventListener(\"abort\", () => {\n abortController.abort();\n });\n }\n abortController.signal.addEventListener(\"abort\", () => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) aborted ${watchUrl}`);\n clearTimeout(timedRetry);\n });\n const requestParams = timeout ? { query: { timeoutSeconds: timeout } } : {};\n const watchUrl = this.getWatchUrl(namespace);\n const responsePromise = this.request.getResponse(watchUrl, requestParams, {\n signal: abortController.signal,\n timeout: 600000,\n });\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${retry === true ? \"retried\" : \"started\"} ${watchUrl}`);\n responsePromise\n .then(response => {\n // True if the current watch request was retried\n let requestRetried = false;\n if (!response.ok) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].warn(`[KUBE-API] watch (${watchId}) error response ${watchUrl}`, { status: response.status });\n return callback(null, response);\n }\n // Add mechanism to retry in case timeoutSeconds is set but the watch wasn't timed out.\n // This can happen if e.g. network is offline and AWS NLB is used.\n if (timeout) {\n setTimeout(() => {\n // We only retry if we haven't retried, haven't aborted and haven't received k8s error\n if (requestRetried || abortController.signal.aborted || errorReceived) {\n return;\n }\n // Close current request\n abortController.abort();\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] Watch timeout set, but not retried, retrying now`);\n requestRetried = true;\n // Clearing out any possible timeout, although we don't expect this to be set\n clearTimeout(timedRetry);\n this.watch(Object.assign(Object.assign({}, opts), { namespace, callback, watchId, retry: true }));\n // We wait longer than the timeout, as we expect the request to be retried with timeoutSeconds\n }, timeout * 1000 * 1.1);\n }\n [\"end\", \"close\", \"error\"].forEach((eventName) => {\n response.body.on(eventName, () => {\n // We only retry if we haven't retried, haven't aborted and haven't received k8s error\n // kubernetes errors (=errorReceived set) should be handled in a callback\n if (requestRetried || abortController.signal.aborted || errorReceived) {\n return;\n }\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`[KUBE-API] watch (${watchId}) ${eventName} ${watchUrl}`);\n requestRetried = true;\n clearTimeout(timedRetry);\n timedRetry = setTimeout(() => {\n this.watch(Object.assign(Object.assign({}, opts), { namespace, callback, watchId, retry: true }));\n }, 1000);\n });\n });\n byline__WEBPACK_IMPORTED_MODULE_8___default()(response.body).on(\"data\", (line) => {\n try {\n const event = JSON.parse(line);\n if (event.type === \"ERROR\" && event.object.kind === \"Status\") {\n errorReceived = true;\n return callback(null, new _kube_object__WEBPACK_IMPORTED_MODULE_7__[\"KubeStatus\"](event.object));\n }\n this.modifyWatchEvent(event);\n callback(event, null);\n }\n catch (ignore) {\n // ignore parse errors\n }\n });\n })\n .catch(error => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBE-API] watch (${watchId}) throwed ${watchUrl}`, error);\n callback(null, error);\n });\n return abortController.abort;\n }\n modifyWatchEvent(event) {\n if (event.type === \"ERROR\") {\n return;\n }\n ensureObjectSelfLink(this, event.object);\n const { namespace, resourceVersion } = event.object.metadata;\n this.setResourceVersion(namespace, resourceVersion);\n this.setResourceVersion(\"\", resourceVersion);\n }\n}\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-api.ts?");
|
|
39184
39162
|
|
|
39185
39163
|
/***/ }),
|
|
39186
39164
|
|
|
@@ -39204,7 +39182,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
39204
39182
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
39205
39183
|
|
|
39206
39184
|
"use strict";
|
|
39207
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeObjectStore\", function() { return KubeObjectStore; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _item_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../item.store */ \"./src/common/item.store.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\nclass KubeObjectStore extends _item_store__WEBPACK_IMPORTED_MODULE_3__[\"ItemStore\"] {\n constructor(api) {\n super();\n Object.defineProperty(this, \"api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"limit\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"bufferSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 50000\n });\n Object.defineProperty(this, \"loadedNamespaces\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // collect items from watch-api events to avoid UI blowing up with huge streams of data\n Object.defineProperty(this, \"eventsBuffer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].array([], { deep: false })\n });\n if (api)\n this.api = api;\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n this.bindWatchEventsUpdater();\n }\n get contextReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.context));\n }\n get namespacesReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.loadedNamespaces));\n }\n get context() {\n return KubeObjectStore.defaultContext.get();\n }\n get contextItems() {\n var _a, _b;\n const namespaces = (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.contextNamespaces) !== null && _b !== void 0 ? _b : [];\n return this.items.filter(item => {\n const itemNamespace = item.getNs();\n return !itemNamespace /* cluster-wide */ || namespaces.includes(itemNamespace);\n });\n }\n getTotalCount() {\n return this.contextItems.length;\n }\n get query() {\n const { limit } = this;\n if (!limit) {\n return {};\n }\n return { limit };\n }\n getAllByNs(namespace, strict = false) {\n const namespaces = [].concat(namespace);\n if (namespaces.length) {\n return this.items.filter(item => namespaces.includes(item.getNs()));\n }\n if (!strict) {\n return this.items;\n }\n return [];\n }\n getById(id) {\n return this.items.find(item => item.getId() === id);\n }\n getByName(name, namespace) {\n return this.items.find(item => {\n return item.getName() === name && (namespace ? item.getNs() === namespace : true);\n });\n }\n getByPath(path) {\n return this.items.find(item => item.selfLink === path);\n }\n getByLabel(labels) {\n if (Array.isArray(labels)) {\n return this.items.filter((item) => {\n const itemLabels = item.getLabels();\n return labels.every(label => itemLabels.includes(label));\n });\n }\n else {\n return this.items.filter((item) => {\n const itemLabels = item.metadata.labels || {};\n return Object.entries(labels)\n .every(([key, value]) => itemLabels[key] === value);\n });\n }\n }\n async loadItems({ namespaces, reqInit, onLoadFailure }) {\n var _a, _b;\n if (!((_a = this.context) === null || _a === void 0 ? void 0 : _a.cluster.isAllowedResource(this.api.kind))) {\n return [];\n }\n const isLoadingAll = ((_b = this.context.allNamespaces) === null || _b === void 0 ? void 0 : _b.length) > 1\n && this.context.cluster.accessibleNamespaces.length === 0\n && this.context.allNamespaces.every(ns => namespaces.includes(ns));\n if (!this.api.isNamespaced || isLoadingAll) {\n if (this.api.isNamespaced) {\n this.loadedNamespaces = [];\n }\n const res = this.api.list({ reqInit }, this.query);\n if (onLoadFailure) {\n try {\n return await res;\n }\n catch (error) {\n onLoadFailure((error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString()) || \"Unknown error\");\n // reset the store because we are loading all, so that nothing is displayed\n this.items.clear();\n this.selectedItemsIds.clear();\n return [];\n }\n }\n return res;\n }\n this.loadedNamespaces = namespaces;\n const results = await Promise.allSettled(namespaces.map(namespace => this.api.list({ namespace, reqInit }, this.query)));\n const res = [];\n for (const result of results) {\n switch (result.status) {\n case \"fulfilled\":\n res.push(...result.value);\n break;\n case \"rejected\":\n if (onLoadFailure) {\n onLoadFailure(result.reason.message || result.reason);\n }\n else {\n // if onLoadFailure is not provided then preserve old behaviour\n throw result.reason;\n }\n }\n }\n return res;\n }\n filterItemsOnLoad(items) {\n return items;\n }\n async loadAll({ namespaces = this.context.contextNamespaces, merge = true, reqInit, onLoadFailure } = {}) {\n await this.contextReady;\n this.isLoading = true;\n try {\n const items = await this.loadItems({ namespaces, reqInit, onLoadFailure });\n this.mergeItems(items, { merge });\n this.isLoaded = true;\n this.failedLoading = false;\n return items;\n }\n catch (error) {\n console.warn(\"[KubeObjectStore] loadAll failed\", this.api.apiBase, error);\n this.resetOnError(error);\n this.failedLoading = true;\n }\n finally {\n this.isLoading = false;\n }\n }\n async reloadAll(opts = {}) {\n const { force = false } = opts, loadingOptions = __rest(opts, [\"force\"]);\n if (this.isLoading || (this.isLoaded && !force)) {\n return;\n }\n return this.loadAll(loadingOptions);\n }\n mergeItems(partialItems, { merge = true, updateStore = true, sort = true, filter = true } = {}) {\n let items = partialItems;\n // update existing items\n if (merge) {\n const namespaces = partialItems.map(item => item.getNs());\n items = [\n ...this.items.filter(existingItem => !namespaces.includes(existingItem.getNs())),\n ...partialItems,\n ];\n }\n if (filter)\n items = this.filterItemsOnLoad(items);\n if (sort)\n items = this.sortItems(items);\n if (updateStore)\n this.items.replace(items);\n return items;\n }\n resetOnError(error) {\n if (error)\n this.reset();\n }\n async loadItem(params) {\n return this.api.get(params);\n }\n async load(params) {\n const { name, namespace } = params;\n let item = this.getByName(name, namespace);\n if (!item) {\n item = await this.loadItem(params);\n const newItems = this.sortItems([...this.items, item]);\n this.items.replace(newItems);\n }\n return item;\n }\n async loadFromPath(resourcePath) {\n const { namespace, name } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_5__[\"parseKubeApi\"])(resourcePath);\n return this.load({ name, namespace });\n }\n async createItem(params, data) {\n return this.api.create(params, data);\n }\n async create(params, data) {\n const newItem = await this.createItem(params, data);\n const items = this.sortItems([...this.items, newItem]);\n this.items.replace(items);\n return newItem;\n }\n postUpdate(rawItem) {\n const newItem = new this.api.objectConstructor(rawItem);\n const index = this.items.findIndex(item => item.getId() === newItem.getId());\n Object(_kube_api__WEBPACK_IMPORTED_MODULE_4__[\"ensureObjectSelfLink\"])(this.api, newItem);\n if (index < 0) {\n this.items.push(newItem);\n }\n else {\n this.items[index] = newItem;\n }\n return newItem;\n }\n async patch(item, patch) {\n return this.postUpdate(await this.api.patch({\n name: item.getName(), namespace: item.getNs(),\n }, patch, \"json\"));\n }\n async update(item, data) {\n return this.postUpdate(await this.api.update({\n name: item.getName(),\n namespace: item.getNs(),\n }, data));\n }\n async remove(item) {\n await this.api.delete({ name: item.getName(), namespace: item.getNs() });\n this.selectedItemsIds.delete(item.getId());\n }\n async removeSelectedItems() {\n return Promise.all(this.selectedItems.map(this.remove));\n }\n bindWatchEventsUpdater(delay = 1000) {\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"reaction\"])(() => this.eventsBuffer.length, this.updateFromEventsBuffer, {\n delay,\n });\n }\n subscribe({ onLoadFailure, abortController = new abort_controller__WEBPACK_IMPORTED_MODULE_6___default.a() } = {}) {\n if (this.api.isNamespaced) {\n Promise.race([Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"rejectPromiseBy\"])(abortController.signal), Promise.all([this.contextReady, this.namespacesReady])])\n .then(() => {\n if (this.context.cluster.isGlobalWatchEnabled && this.loadedNamespaces.length === 0) {\n return this.watchNamespace(\"\", abortController, { onLoadFailure });\n }\n for (const namespace of this.loadedNamespaces) {\n this.watchNamespace(namespace, abortController, { onLoadFailure });\n }\n })\n .catch(_utils__WEBPACK_IMPORTED_MODULE_1__[\"noop\"]); // ignore DOMExceptions\n }\n else {\n this.watchNamespace(\"\", abortController, { onLoadFailure });\n }\n return () => abortController.abort();\n }\n watchNamespace(namespace, abortController, opts) {\n if (!this.api.getResourceVersion(namespace)) {\n return;\n }\n let timedRetry;\n const watch = () => this.api.watch({\n namespace,\n abortController,\n callback,\n });\n const { signal } = abortController;\n const callback = (data, error) => {\n if (!this.isLoaded || (error === null || error === void 0 ? void 0 : error.type) === \"aborted\")\n return;\n if (error instanceof Response) {\n if (error.status === 404 || error.status === 401) {\n // api has gone, or credentials are not permitted, let's not retry\n return;\n }\n // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n else if (error instanceof _kube_object__WEBPACK_IMPORTED_MODULE_2__[\"KubeStatus\"] && error.code === 410) {\n clearTimeout(timedRetry);\n // resourceVersion has gone, let's try to reload\n timedRetry = setTimeout(() => {\n (namespace\n ? this.loadAll(Object.assign({ namespaces: [namespace], reqInit: { signal } }, opts))\n : this.loadAll(Object.assign({ merge: false, reqInit: { signal } }, opts))).then(watch);\n }, 1000);\n }\n else if (error) { // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n if (data) {\n this.eventsBuffer.push(data);\n }\n };\n signal.addEventListener(\"abort\", () => clearTimeout(timedRetry));\n watch();\n }\n updateFromEventsBuffer() {\n const items = this.getItems();\n for (const { type, object } of this.eventsBuffer.clear()) {\n const index = items.findIndex(item => { var _a; return item.getId() === ((_a = object.metadata) === null || _a === void 0 ? void 0 : _a.uid); });\n const item = items[index];\n switch (type) {\n case \"ADDED\":\n case \"MODIFIED\":\n const newItem = new this.api.objectConstructor(object);\n if (!item) {\n items.push(newItem);\n }\n else {\n items[index] = newItem;\n }\n break;\n case \"DELETED\":\n if (item) {\n items.splice(index, 1);\n }\n break;\n }\n }\n // update items\n this.items.replace(this.sortItems(items.slice(-this.bufferSize)));\n }\n}\nObject.defineProperty(KubeObjectStore, \"defaultContext\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box()\n}); // TODO: support multiple cluster contexts\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", Array)\n], KubeObjectStore.prototype, \"loadedNamespaces\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectStore.prototype, \"contextItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"reloadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Array, Object]),\n __metadata(\"design:returntype\", Array)\n], KubeObjectStore.prototype, \"mergeItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"load\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadFromPath\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], KubeObjectStore.prototype, \"updateFromEventsBuffer\", null);\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-object.store.ts?");
|
|
39185
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeObjectStore\", function() { return KubeObjectStore; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _item_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../item.store */ \"./src/common/item.store.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/* harmony import */ var _kube_api_parse__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./kube-api-parse */ \"./src/common/k8s-api/kube-api-parse.ts\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! abort-controller */ \"./node_modules/abort-controller/browser.js\");\n/* harmony import */ var abort_controller__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(abort_controller__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n// BUG: https://github.com/mysticatea/abort-controller/pull/22\n// eslint-disable-next-line import/no-named-as-default\n\nclass KubeObjectStore extends _item_store__WEBPACK_IMPORTED_MODULE_3__[\"ItemStore\"] {\n constructor(api) {\n super();\n Object.defineProperty(this, \"api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"limit\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"bufferSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 50000\n });\n Object.defineProperty(this, \"loadedNamespaces\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // collect items from watch-api events to avoid UI blowing up with huge streams of data\n Object.defineProperty(this, \"eventsBuffer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].array([], { deep: false })\n });\n if (api)\n this.api = api;\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n this.bindWatchEventsUpdater();\n }\n get contextReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.context));\n }\n get namespacesReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => Boolean(this.loadedNamespaces));\n }\n get context() {\n return KubeObjectStore.defaultContext.get();\n }\n get contextItems() {\n var _a, _b;\n const namespaces = (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.contextNamespaces) !== null && _b !== void 0 ? _b : [];\n return this.items.filter(item => {\n const itemNamespace = item.getNs();\n return !itemNamespace /* cluster-wide */ || namespaces.includes(itemNamespace);\n });\n }\n getTotalCount() {\n return this.contextItems.length;\n }\n get query() {\n const { limit } = this;\n if (!limit) {\n return {};\n }\n return { limit };\n }\n getAllByNs(namespace, strict = false) {\n const namespaces = [].concat(namespace);\n if (namespaces.length) {\n return this.items.filter(item => namespaces.includes(item.getNs()));\n }\n if (!strict) {\n return this.items;\n }\n return [];\n }\n getById(id) {\n return this.items.find(item => item.getId() === id);\n }\n getByName(name, namespace) {\n return this.items.find(item => {\n return item.getName() === name && (namespace ? item.getNs() === namespace : true);\n });\n }\n getByPath(path) {\n return this.items.find(item => item.selfLink === path);\n }\n getByLabel(labels) {\n if (Array.isArray(labels)) {\n return this.items.filter((item) => {\n const itemLabels = item.getLabels();\n return labels.every(label => itemLabels.includes(label));\n });\n }\n else {\n return this.items.filter((item) => {\n const itemLabels = item.metadata.labels || {};\n return Object.entries(labels)\n .every(([key, value]) => itemLabels[key] === value);\n });\n }\n }\n async loadItems({ namespaces, reqInit, onLoadFailure }) {\n var _a, _b;\n if (!((_a = this.context) === null || _a === void 0 ? void 0 : _a.cluster.isAllowedResource(this.api.kind))) {\n return [];\n }\n const isLoadingAll = ((_b = this.context.allNamespaces) === null || _b === void 0 ? void 0 : _b.length) > 1\n && this.context.cluster.accessibleNamespaces.length === 0\n && this.context.allNamespaces.every(ns => namespaces.includes(ns));\n if (!this.api.isNamespaced || isLoadingAll) {\n if (this.api.isNamespaced) {\n this.loadedNamespaces = [];\n }\n const res = this.api.list({ reqInit }, this.query);\n if (onLoadFailure) {\n try {\n return await res;\n }\n catch (error) {\n onLoadFailure((error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString()) || \"Unknown error\");\n // reset the store because we are loading all, so that nothing is displayed\n this.items.clear();\n this.selectedItemsIds.clear();\n return [];\n }\n }\n return res;\n }\n this.loadedNamespaces = namespaces;\n const results = await Promise.allSettled(namespaces.map(namespace => this.api.list({ namespace, reqInit }, this.query)));\n const res = [];\n for (const result of results) {\n switch (result.status) {\n case \"fulfilled\":\n res.push(...result.value);\n break;\n case \"rejected\":\n if (onLoadFailure) {\n onLoadFailure(result.reason.message || result.reason);\n }\n else {\n // if onLoadFailure is not provided then preserve old behaviour\n throw result.reason;\n }\n }\n }\n return res;\n }\n filterItemsOnLoad(items) {\n return items;\n }\n async loadAll({ namespaces = this.context.contextNamespaces, merge = true, reqInit, onLoadFailure } = {}) {\n await this.contextReady;\n this.isLoading = true;\n try {\n const items = await this.loadItems({ namespaces, reqInit, onLoadFailure });\n this.mergeItems(items, { merge });\n this.isLoaded = true;\n this.failedLoading = false;\n return items;\n }\n catch (error) {\n console.warn(\"[KubeObjectStore] loadAll failed\", this.api.apiBase, error);\n this.resetOnError(error);\n this.failedLoading = true;\n }\n finally {\n this.isLoading = false;\n }\n }\n async reloadAll(opts = {}) {\n const { force = false } = opts, loadingOptions = __rest(opts, [\"force\"]);\n if (this.isLoading || (this.isLoaded && !force)) {\n return;\n }\n return this.loadAll(loadingOptions);\n }\n mergeItems(partialItems, { merge = true, updateStore = true, sort = true, filter = true } = {}) {\n let items = partialItems;\n // update existing items\n if (merge) {\n const namespaces = partialItems.map(item => item.getNs());\n items = [\n ...this.items.filter(existingItem => !namespaces.includes(existingItem.getNs())),\n ...partialItems,\n ];\n }\n if (filter)\n items = this.filterItemsOnLoad(items);\n if (sort)\n items = this.sortItems(items);\n if (updateStore)\n this.items.replace(items);\n return items;\n }\n resetOnError(error) {\n if (error)\n this.reset();\n }\n async loadItem(params) {\n return this.api.get(params);\n }\n async load(params) {\n const { name, namespace } = params;\n let item = this.getByName(name, namespace);\n if (!item) {\n item = await this.loadItem(params);\n const newItems = this.sortItems([...this.items, item]);\n this.items.replace(newItems);\n }\n return item;\n }\n async loadFromPath(resourcePath) {\n const { namespace, name } = Object(_kube_api_parse__WEBPACK_IMPORTED_MODULE_5__[\"parseKubeApi\"])(resourcePath);\n return this.load({ name, namespace });\n }\n async createItem(params, data) {\n return this.api.create(params, data);\n }\n async create(params, data) {\n const newItem = await this.createItem(params, data);\n const items = this.sortItems([...this.items, newItem]);\n this.items.replace(items);\n return newItem;\n }\n postUpdate(rawItem) {\n const newItem = new this.api.objectConstructor(rawItem);\n const index = this.items.findIndex(item => item.getId() === newItem.getId());\n Object(_kube_api__WEBPACK_IMPORTED_MODULE_4__[\"ensureObjectSelfLink\"])(this.api, newItem);\n if (index < 0) {\n this.items.push(newItem);\n }\n else {\n this.items[index] = newItem;\n }\n return newItem;\n }\n async patch(item, patch) {\n return this.postUpdate(await this.api.patch({\n name: item.getName(), namespace: item.getNs(),\n }, patch, \"json\"));\n }\n async update(item, data) {\n return this.postUpdate(await this.api.update({\n name: item.getName(),\n namespace: item.getNs(),\n }, data));\n }\n async remove(item) {\n await this.api.delete({ name: item.getName(), namespace: item.getNs() });\n this.selectedItemsIds.delete(item.getId());\n }\n async removeSelectedItems() {\n return Promise.all(this.selectedItems.map(this.remove));\n }\n bindWatchEventsUpdater(delay = 1000) {\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"reaction\"])(() => this.eventsBuffer.length, this.updateFromEventsBuffer, {\n delay,\n });\n }\n subscribe({ onLoadFailure, abortController = new abort_controller__WEBPACK_IMPORTED_MODULE_6___default.a() } = {}) {\n if (this.api.isNamespaced) {\n Promise.race([Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"rejectPromiseBy\"])(abortController.signal), Promise.all([this.contextReady, this.namespacesReady])])\n .then(() => {\n if (this.context.cluster.isGlobalWatchEnabled && this.loadedNamespaces.length === 0) {\n return this.watchNamespace(\"\", abortController, { onLoadFailure });\n }\n for (const namespace of this.loadedNamespaces) {\n this.watchNamespace(namespace, abortController, { onLoadFailure });\n }\n })\n .catch(_utils__WEBPACK_IMPORTED_MODULE_1__[\"noop\"]); // ignore DOMExceptions\n }\n else {\n this.watchNamespace(\"\", abortController, { onLoadFailure });\n }\n return () => abortController.abort();\n }\n watchNamespace(namespace, abortController, opts) {\n if (!this.api.getResourceVersion(namespace)) {\n return;\n }\n let timedRetry;\n const watch = () => this.api.watch({\n namespace,\n abortController,\n callback,\n });\n const { signal } = abortController;\n const callback = (data, error) => {\n if (!this.isLoaded || (error === null || error === void 0 ? void 0 : error.type) === \"aborted\")\n return;\n if (error instanceof Response) {\n if (error.status === 404 || error.status === 401) {\n // api has gone, or credentials are not permitted, let's not retry\n return;\n }\n // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n else if (error instanceof _kube_object__WEBPACK_IMPORTED_MODULE_2__[\"KubeStatus\"] && error.code === 410) {\n clearTimeout(timedRetry);\n // resourceVersion has gone, let's try to reload\n timedRetry = setTimeout(() => {\n (namespace\n ? this.loadAll(Object.assign({ namespaces: [namespace], reqInit: { signal } }, opts))\n : this.loadAll(Object.assign({ merge: false, reqInit: { signal } }, opts))).then(watch);\n }, 1000);\n }\n else if (error) { // not sure what to do, best to retry\n clearTimeout(timedRetry);\n timedRetry = setTimeout(watch, 5000);\n }\n if (data) {\n this.eventsBuffer.push(data);\n }\n };\n signal.addEventListener(\"abort\", () => clearTimeout(timedRetry));\n watch();\n }\n updateFromEventsBuffer() {\n const items = this.getItems();\n for (const { type, object } of this.eventsBuffer.clear()) {\n const index = items.findIndex(item => { var _a; return item.getId() === ((_a = object.metadata) === null || _a === void 0 ? void 0 : _a.uid); });\n const item = items[index];\n switch (type) {\n case \"ADDED\":\n // falls through\n case \"MODIFIED\": {\n const newItem = new this.api.objectConstructor(object);\n if (!item) {\n items.push(newItem);\n }\n else {\n items[index] = newItem;\n }\n break;\n }\n case \"DELETED\":\n if (item) {\n items.splice(index, 1);\n }\n break;\n }\n }\n // update items\n this.items.replace(this.sortItems(items.slice(-this.bufferSize)));\n }\n}\nObject.defineProperty(KubeObjectStore, \"defaultContext\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box()\n}); // TODO: support multiple cluster contexts\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", Array)\n], KubeObjectStore.prototype, \"loadedNamespaces\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectStore.prototype, \"contextItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"reloadAll\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Array, Object]),\n __metadata(\"design:returntype\", Array)\n], KubeObjectStore.prototype, \"mergeItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"load\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [String]),\n __metadata(\"design:returntype\", Promise)\n], KubeObjectStore.prototype, \"loadFromPath\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], KubeObjectStore.prototype, \"updateFromEventsBuffer\", null);\n\n\n//# sourceURL=webpack:///./src/common/k8s-api/kube-object.store.ts?");
|
|
39208
39186
|
|
|
39209
39187
|
/***/ }),
|
|
39210
39188
|
|
|
@@ -39292,18 +39270,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
39292
39270
|
|
|
39293
39271
|
/***/ }),
|
|
39294
39272
|
|
|
39295
|
-
/***/ "./src/common/request.ts":
|
|
39296
|
-
/*!*******************************!*\
|
|
39297
|
-
!*** ./src/common/request.ts ***!
|
|
39298
|
-
\*******************************/
|
|
39299
|
-
/*! exports provided: customRequest, customRequestPromise */
|
|
39300
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
39301
|
-
|
|
39302
|
-
"use strict";
|
|
39303
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"customRequest\", function() { return customRequest; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"customRequestPromise\", function() { return customRequestPromise; });\n/* harmony import */ var request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! request */ \"./node_modules/request/index.js\");\n/* harmony import */ var request__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(request__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var request_promise_native__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! request-promise-native */ \"./node_modules/request-promise-native/lib/rp.js\");\n/* harmony import */ var request_promise_native__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(request_promise_native__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _user_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./user-store */ \"./src/common/user-store/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n// todo: get rid of \"request\" (deprecated)\n// https://github.com/lensapp/lens/issues/459\nfunction getDefaultRequestOpts() {\n const { httpsProxy, allowUntrustedCAs } = _user_store__WEBPACK_IMPORTED_MODULE_2__[\"UserStore\"].getInstance();\n return {\n proxy: httpsProxy || undefined,\n rejectUnauthorized: !allowUntrustedCAs,\n };\n}\n/**\n * @deprecated\n */\nfunction customRequest(opts) {\n return request__WEBPACK_IMPORTED_MODULE_0___default.a.defaults(getDefaultRequestOpts())(opts);\n}\n/**\n * @deprecated\n */\nfunction customRequestPromise(opts) {\n return request_promise_native__WEBPACK_IMPORTED_MODULE_1___default.a.defaults(getDefaultRequestOpts())(opts);\n}\n\n\n//# sourceURL=webpack:///./src/common/request.ts?");
|
|
39304
|
-
|
|
39305
|
-
/***/ }),
|
|
39306
|
-
|
|
39307
39273
|
/***/ "./src/common/routes/add-cluster.ts":
|
|
39308
39274
|
/*!******************************************!*\
|
|
39309
39275
|
!*** ./src/common/routes/add-cluster.ts ***!
|
|
@@ -39744,7 +39710,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _use
|
|
|
39744
39710
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
39745
39711
|
|
|
39746
39712
|
"use strict";
|
|
39747
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultEditorConfig\", function() { return defaultEditorConfig; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultPackageMirror\", function() { return defaultPackageMirror; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"packageMirrors\", function() { return packageMirrors; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtensionRegistryLocation\", function() { return ExtensionRegistryLocation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultExtensionRegistryUrl\", function() { return defaultExtensionRegistryUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DESCRIPTORS\", function() { return DESCRIPTORS; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CONSTANTS\", function() { return CONSTANTS; });\n/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-timezone */ \"./node_modules/moment-timezone/index.js\");\n/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_timezone__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! os */ \"os\");\n/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _renderer_theme_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../renderer/theme.store */ \"./src/renderer/theme.store.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! semver */ \"./node_modules/semver/index.js\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar _a;\n\n\n\n\n\n\n\nconst defaultEditorConfig = {\n tabSize: 2,\n lineNumbers: \"on\",\n minimap: {\n enabled: true,\n side: \"right\",\n },\n};\nconst httpsProxy = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n return val || undefined;\n },\n};\nconst shell = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n return val || undefined;\n },\n};\nconst colorTheme = {\n fromStore(val) {\n return val || _renderer_theme_store__WEBPACK_IMPORTED_MODULE_3__[\"ThemeStore\"].defaultTheme;\n },\n toStore(val) {\n if (!val || val === _renderer_theme_store__WEBPACK_IMPORTED_MODULE_3__[\"ThemeStore\"].defaultTheme) {\n return undefined;\n }\n return val;\n },\n};\nconst localeTimezone = {\n fromStore(val) {\n return val || moment_timezone__WEBPACK_IMPORTED_MODULE_0___default.a.tz.guess(true) || \"UTC\";\n },\n toStore(val) {\n if (!val || val === moment_timezone__WEBPACK_IMPORTED_MODULE_0___default.a.tz.guess(true) || val === \"UTC\") {\n return undefined;\n }\n return val;\n },\n};\nconst allowUntrustedCAs = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : false;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst allowTelemetry = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : true;\n },\n toStore(val) {\n if (val === true) {\n return undefined;\n }\n return val;\n },\n};\nconst allowErrorReporting = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : true;\n },\n toStore(val) {\n if (val === true) {\n return undefined;\n }\n return val;\n },\n};\nconst defaultPackageMirror = \"default\";\nconst packageMirrors = new Map([\n [defaultPackageMirror, {\n url: \"https://storage.googleapis.com/kubernetes-release/release\",\n label: \"Default (Google)\",\n platforms: new Set([\"darwin\", \"win32\", \"linux\"]),\n }],\n [\"china\", {\n url: \"https://mirror.azure.cn/kubernetes/kubectl\",\n label: \"China (Azure)\",\n platforms: new Set([\"win32\", \"linux\"]),\n }],\n]);\nconst downloadMirror = {\n fromStore(val) {\n return packageMirrors.has(val) ? val : defaultPackageMirror;\n },\n toStore(val) {\n if (!val || val === defaultPackageMirror) {\n return undefined;\n }\n return val;\n },\n};\nconst downloadKubectlBinaries = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : true;\n },\n toStore(val) {\n if (val === true) {\n return undefined;\n }\n return val;\n },\n};\nconst downloadBinariesPath = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst kubectlBinariesPath = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst openAtLogin = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : false;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst terminalCopyOnSelect = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : false;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst hiddenTableColumns = {\n fromStore(val) {\n return new Map((val !== null && val !== void 0 ? val : []).map(([tableId, columnIds]) => [tableId, new _utils__WEBPACK_IMPORTED_MODULE_4__[\"ObservableToggleSet\"](columnIds)]));\n },\n toStore(val) {\n const res = [];\n for (const [table, columns] of val) {\n if (columns.size) {\n res.push([table, Array.from(columns)]);\n }\n }\n return res.length ? res : undefined;\n },\n};\nconst mainKubeFolder = path__WEBPACK_IMPORTED_MODULE_1___default.a.join(os__WEBPACK_IMPORTED_MODULE_2___default.a.homedir(), \".kube\");\nconst syncKubeconfigEntries = {\n fromStore(val) {\n var _a;\n return new Map((_a = val === null || val === void 0 ? void 0 : val.map((_a) => {\n var { filePath } = _a, rest = __rest(_a, [\"filePath\"]);\n return [filePath, rest];\n })) !== null && _a !== void 0 ? _a : [[mainKubeFolder, {}]]);\n },\n toStore(val) {\n if (val.size === 1 && val.has(mainKubeFolder)) {\n return undefined;\n }\n return Array.from(val, ([filePath, rest]) => (Object.assign({ filePath }, rest)));\n },\n};\nconst editorConfiguration = {\n fromStore(val) {\n return lodash_merge__WEBPACK_IMPORTED_MODULE_5___default()(defaultEditorConfig, val);\n },\n toStore(val) {\n return val;\n },\n};\nconst updateChannels = new Map([\n [\"latest\", {\n label: \"Stable\",\n }],\n [\"beta\", {\n label: \"Beta\",\n }],\n [\"alpha\", {\n label: \"Alpha\",\n }],\n]);\nconst defaultUpdateChannel = ((_a = new semver__WEBPACK_IMPORTED_MODULE_6__[\"SemVer\"](Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"getAppVersion\"])()).prerelease[0]) === null || _a === void 0 ? void 0 : _a.toString()) || \"latest\";\nconst updateChannel = {\n fromStore(val) {\n return updateChannels.has(val) ? val : defaultUpdateChannel;\n },\n toStore(val) {\n if (!updateChannels.has(val) || val === defaultUpdateChannel) {\n return undefined;\n }\n return val;\n },\n};\nvar ExtensionRegistryLocation;\n(function (ExtensionRegistryLocation) {\n ExtensionRegistryLocation[\"DEFAULT\"] = \"default\";\n ExtensionRegistryLocation[\"NPMRC\"] = \"npmrc\";\n ExtensionRegistryLocation[\"CUSTOM\"] = \"custom\";\n})(ExtensionRegistryLocation || (ExtensionRegistryLocation = {}));\nconst defaultExtensionRegistryUrl = \"https://registry.npmjs.org\";\nconst extensionRegistryUrl = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : {\n location: ExtensionRegistryLocation.DEFAULT,\n };\n },\n toStore(val) {\n if (val.location === ExtensionRegistryLocation.DEFAULT) {\n return undefined;\n }\n return val;\n },\n};\nconst DESCRIPTORS = {\n httpsProxy,\n shell,\n colorTheme,\n localeTimezone,\n allowUntrustedCAs,\n allowTelemetry,\n allowErrorReporting,\n downloadMirror,\n downloadKubectlBinaries,\n downloadBinariesPath,\n kubectlBinariesPath,\n openAtLogin,\n hiddenTableColumns,\n syncKubeconfigEntries,\n editorConfiguration,\n terminalCopyOnSelect,\n updateChannel,\n extensionRegistryUrl,\n};\nconst CONSTANTS = {\n updateChannels,\n};\n\n\n//# sourceURL=webpack:///./src/common/user-store/preferences-helpers.ts?");
|
|
39713
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultEditorConfig\", function() { return defaultEditorConfig; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultPackageMirror\", function() { return defaultPackageMirror; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"packageMirrors\", function() { return packageMirrors; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtensionRegistryLocation\", function() { return ExtensionRegistryLocation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultExtensionRegistryUrl\", function() { return defaultExtensionRegistryUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DESCRIPTORS\", function() { return DESCRIPTORS; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CONSTANTS\", function() { return CONSTANTS; });\n/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-timezone */ \"./node_modules/moment-timezone/index.js\");\n/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_timezone__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! os */ \"os\");\n/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! semver */ \"./node_modules/semver/index.js\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _vars__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../vars */ \"./src/common/vars.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar _a;\n\n\n\n\n\n\n\nconst defaultEditorConfig = {\n tabSize: 2,\n lineNumbers: \"on\",\n minimap: {\n enabled: true,\n side: \"right\",\n },\n};\nconst httpsProxy = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n return val || undefined;\n },\n};\nconst shell = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n return val || undefined;\n },\n};\nconst colorTheme = {\n fromStore(val) {\n return val || _vars__WEBPACK_IMPORTED_MODULE_6__[\"defaultTheme\"];\n },\n toStore(val) {\n if (!val || val === _vars__WEBPACK_IMPORTED_MODULE_6__[\"defaultTheme\"]) {\n return undefined;\n }\n return val;\n },\n};\nconst localeTimezone = {\n fromStore(val) {\n return val || moment_timezone__WEBPACK_IMPORTED_MODULE_0___default.a.tz.guess(true) || \"UTC\";\n },\n toStore(val) {\n if (!val || val === moment_timezone__WEBPACK_IMPORTED_MODULE_0___default.a.tz.guess(true) || val === \"UTC\") {\n return undefined;\n }\n return val;\n },\n};\nconst allowUntrustedCAs = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : false;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst allowTelemetry = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : true;\n },\n toStore(val) {\n if (val === true) {\n return undefined;\n }\n return val;\n },\n};\nconst allowErrorReporting = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : true;\n },\n toStore(val) {\n if (val === true) {\n return undefined;\n }\n return val;\n },\n};\nconst defaultPackageMirror = \"default\";\nconst packageMirrors = new Map([\n [defaultPackageMirror, {\n url: \"https://storage.googleapis.com/kubernetes-release/release\",\n label: \"Default (Google)\",\n platforms: new Set([\"darwin\", \"win32\", \"linux\"]),\n }],\n [\"china\", {\n url: \"https://mirror.azure.cn/kubernetes/kubectl\",\n label: \"China (Azure)\",\n platforms: new Set([\"win32\", \"linux\"]),\n }],\n]);\nconst downloadMirror = {\n fromStore(val) {\n return packageMirrors.has(val) ? val : defaultPackageMirror;\n },\n toStore(val) {\n if (!val || val === defaultPackageMirror) {\n return undefined;\n }\n return val;\n },\n};\nconst downloadKubectlBinaries = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : true;\n },\n toStore(val) {\n if (val === true) {\n return undefined;\n }\n return val;\n },\n};\nconst downloadBinariesPath = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst kubectlBinariesPath = {\n fromStore(val) {\n return val;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst openAtLogin = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : false;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst terminalCopyOnSelect = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : false;\n },\n toStore(val) {\n if (!val) {\n return undefined;\n }\n return val;\n },\n};\nconst hiddenTableColumns = {\n fromStore(val) {\n return new Map((val !== null && val !== void 0 ? val : []).map(([tableId, columnIds]) => [tableId, new _utils__WEBPACK_IMPORTED_MODULE_3__[\"ObservableToggleSet\"](columnIds)]));\n },\n toStore(val) {\n const res = [];\n for (const [table, columns] of val) {\n if (columns.size) {\n res.push([table, Array.from(columns)]);\n }\n }\n return res.length ? res : undefined;\n },\n};\nconst mainKubeFolder = path__WEBPACK_IMPORTED_MODULE_1___default.a.join(os__WEBPACK_IMPORTED_MODULE_2___default.a.homedir(), \".kube\");\nconst syncKubeconfigEntries = {\n fromStore(val) {\n var _a;\n return new Map((_a = val === null || val === void 0 ? void 0 : val.map((_a) => {\n var { filePath } = _a, rest = __rest(_a, [\"filePath\"]);\n return [filePath, rest];\n })) !== null && _a !== void 0 ? _a : [[mainKubeFolder, {}]]);\n },\n toStore(val) {\n if (val.size === 1 && val.has(mainKubeFolder)) {\n return undefined;\n }\n return Array.from(val, ([filePath, rest]) => (Object.assign({ filePath }, rest)));\n },\n};\nconst editorConfiguration = {\n fromStore(val) {\n return lodash_merge__WEBPACK_IMPORTED_MODULE_4___default()(defaultEditorConfig, val);\n },\n toStore(val) {\n return val;\n },\n};\nconst updateChannels = new Map([\n [\"latest\", {\n label: \"Stable\",\n }],\n [\"beta\", {\n label: \"Beta\",\n }],\n [\"alpha\", {\n label: \"Alpha\",\n }],\n]);\nconst defaultUpdateChannel = ((_a = new semver__WEBPACK_IMPORTED_MODULE_5__[\"SemVer\"](Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"getAppVersion\"])()).prerelease[0]) === null || _a === void 0 ? void 0 : _a.toString()) || \"latest\";\nconst updateChannel = {\n fromStore(val) {\n return updateChannels.has(val) ? val : defaultUpdateChannel;\n },\n toStore(val) {\n if (!updateChannels.has(val) || val === defaultUpdateChannel) {\n return undefined;\n }\n return val;\n },\n};\nvar ExtensionRegistryLocation;\n(function (ExtensionRegistryLocation) {\n ExtensionRegistryLocation[\"DEFAULT\"] = \"default\";\n ExtensionRegistryLocation[\"NPMRC\"] = \"npmrc\";\n ExtensionRegistryLocation[\"CUSTOM\"] = \"custom\";\n})(ExtensionRegistryLocation || (ExtensionRegistryLocation = {}));\nconst defaultExtensionRegistryUrl = \"https://registry.npmjs.org\";\nconst extensionRegistryUrl = {\n fromStore(val) {\n return val !== null && val !== void 0 ? val : {\n location: ExtensionRegistryLocation.DEFAULT,\n };\n },\n toStore(val) {\n if (val.location === ExtensionRegistryLocation.DEFAULT) {\n return undefined;\n }\n return val;\n },\n};\nconst DESCRIPTORS = {\n httpsProxy,\n shell,\n colorTheme,\n localeTimezone,\n allowUntrustedCAs,\n allowTelemetry,\n allowErrorReporting,\n downloadMirror,\n downloadKubectlBinaries,\n downloadBinariesPath,\n kubectlBinariesPath,\n openAtLogin,\n hiddenTableColumns,\n syncKubeconfigEntries,\n editorConfiguration,\n terminalCopyOnSelect,\n updateChannel,\n extensionRegistryUrl,\n};\nconst CONSTANTS = {\n updateChannels,\n};\n\n\n//# sourceURL=webpack:///./src/common/user-store/preferences-helpers.ts?");
|
|
39748
39714
|
|
|
39749
39715
|
/***/ }),
|
|
39750
39716
|
|
|
@@ -39912,7 +39878,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
39912
39878
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
39913
39879
|
|
|
39914
39880
|
"use strict";
|
|
39915
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defineGlobal\", function() { return defineGlobal; });\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Setup variable in global scope (top-level object)\n// Global type definition must be added separately to `mocks.d.ts` in form:\n// declare const __globalName: any;\nfunction defineGlobal(propName, descriptor) {\n const scope = typeof global !== \"undefined\" ? global : window;\n if (
|
|
39881
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defineGlobal\", function() { return defineGlobal; });\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Setup variable in global scope (top-level object)\n// Global type definition must be added separately to `mocks.d.ts` in form:\n// declare const __globalName: any;\nfunction defineGlobal(propName, descriptor) {\n const scope = typeof global !== \"undefined\" ? global : window;\n if (Object.prototype.hasOwnProperty.call(scope, propName)) {\n return;\n }\n Object.defineProperty(scope, propName, descriptor);\n}\n\n\n//# sourceURL=webpack:///./src/common/utils/defineGlobal.ts?");
|
|
39916
39882
|
|
|
39917
39883
|
/***/ }),
|
|
39918
39884
|
|
|
@@ -40032,7 +39998,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
40032
39998
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40033
39999
|
|
|
40034
40000
|
"use strict";
|
|
40035
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"newEmpty\", function() { return newEmpty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"take\", function() { return take; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"map\", function() { return map; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterFlatMap\", function() { return filterFlatMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"flatMap\", function() { return flatMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filter\", function() { return filter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterMap\", function() { return filterMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterMapStrict\", function() { return filterMapStrict; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"find\", function() { return find; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"reduce\", function() { return reduce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"join\", function() { return join; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"every\", function() { return every; });\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n/**\n * Create a new type safe empty Iterable\n * @returns An `Iterable` that yields 0 items\n */\nfunction* newEmpty() {\n return;\n}\n/**\n * Creates a new `Iterable` that yields at most n items from src.\n * Does not modify `src` which can be used later.\n * @param src An initial iterator\n * @param n The maximum number of elements to take from src. Yields up to the floor of `n` and 0 items if n < 0\n */\nfunction* take(src, n) {\n outer: for (let i = 0; i < n; i += 1) {\n for (const item of src) {\n yield item;\n continue outer;\n }\n // if we are here that means that `src` has been exhausted. Don't bother trying again.\n break outer;\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * result of `fn` for each item.\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* map(src, fn) {\n for (const from of src) {\n yield fn(from);\n }\n}\n/**\n * The single layer flattening of an iterator, discarding `Falsey` values.\n * @param src A type that can be iterated over\n * @param fn The function that returns either an iterable over items that should be filtered out or a `Falsey` value indicating that it should be ignored\n */\nfunction* filterFlatMap(src, fn) {\n for (const from of src) {\n if (!from) {\n continue;\n }\n const mapping = fn(from);\n if (!mapping) {\n continue;\n }\n for (const mapped of mapping) {\n if (mapped) {\n yield mapped;\n }\n }\n }\n}\n/**\n * Returns a new iterator that yields the items that each call to `fn` would produce\n * @param src A type that can be iterated over\n * @param fn A function that returns an iterator\n */\nfunction* flatMap(src, fn) {\n for (const from of src) {\n yield* fn(from);\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * items that return a `truthy` value from `fn`.\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* filter(src, fn) {\n for (const from of src) {\n if (fn(from)) {\n yield from;\n }\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * result of `fn` when it is `truthy`\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* filterMap(src, fn) {\n for (const from of src) {\n const res = fn(from);\n if (res) {\n yield res;\n }\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * result of `fn` when it is not null or undefined\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* filterMapStrict(src, fn) {\n for (const from of src) {\n const res = fn(from);\n if (res != null) {\n yield res;\n }\n }\n}\n/**\n * Iterate through `src` until `match` returns a truthy value\n * @param src A type that can be iterated over\n * @param match A function that should return a truthy value for the item that you want to find\n * @returns The first entry that `match` returns a truthy value for, or `undefined`\n */\nfunction find(src, match) {\n for (const from of src) {\n if (match(from)) {\n return from;\n }\n }\n return void 0;\n}\nfunction reduce(src, reducer, initial) {\n let acc = initial;\n for (const item of src) {\n acc = reducer(acc, item);\n }\n return acc;\n}\n/**\n * A convenience function for reducing over an iterator of strings and concatenating them together\n * @param src The value to iterate over\n * @param connector The string value to intersperse between the yielded values\n * @returns The concatenated entries of `src` interspersed with copies of `connector`\n */\nfunction join(src, connector = \",\") {\n return reduce(src, (acc, cur) => `${acc}${connector}${cur}`, \"\");\n}\n/**\n * Iterate through `src` and return `true` if `fn` returns a thruthy value for every yielded value.\n * Otherwise, return `false`. This function short circuits.\n * @param src The type to be iterated over\n * @param fn A function to check each iteration\n */\nfunction every(src, fn) {\n for (const val of src) {\n if (!fn(val)) {\n return false;\n }\n }\n return true;\n}\n\n\n//# sourceURL=webpack:///./src/common/utils/iter.ts?");
|
|
40001
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"newEmpty\", function() { return newEmpty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"take\", function() { return take; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"map\", function() { return map; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterFlatMap\", function() { return filterFlatMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"flatMap\", function() { return flatMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filter\", function() { return filter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterMap\", function() { return filterMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterMapStrict\", function() { return filterMapStrict; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"find\", function() { return find; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"reduce\", function() { return reduce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"join\", function() { return join; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"every\", function() { return every; });\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n/**\n * Create a new type safe empty Iterable\n * @returns An `Iterable` that yields 0 items\n */\n// eslint-disable-next-line require-yield\nfunction* newEmpty() {\n return;\n}\n/**\n * Creates a new `Iterable` that yields at most n items from src.\n * Does not modify `src` which can be used later.\n * @param src An initial iterator\n * @param n The maximum number of elements to take from src. Yields up to the floor of `n` and 0 items if n < 0\n */\nfunction* take(src, n) {\n outer: for (let i = 0; i < n; i += 1) {\n for (const item of src) {\n yield item;\n continue outer;\n }\n // if we are here that means that `src` has been exhausted. Don't bother trying again.\n break outer;\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * result of `fn` for each item.\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* map(src, fn) {\n for (const from of src) {\n yield fn(from);\n }\n}\n/**\n * The single layer flattening of an iterator, discarding `Falsey` values.\n * @param src A type that can be iterated over\n * @param fn The function that returns either an iterable over items that should be filtered out or a `Falsey` value indicating that it should be ignored\n */\nfunction* filterFlatMap(src, fn) {\n for (const from of src) {\n if (!from) {\n continue;\n }\n const mapping = fn(from);\n if (!mapping) {\n continue;\n }\n for (const mapped of mapping) {\n if (mapped) {\n yield mapped;\n }\n }\n }\n}\n/**\n * Returns a new iterator that yields the items that each call to `fn` would produce\n * @param src A type that can be iterated over\n * @param fn A function that returns an iterator\n */\nfunction* flatMap(src, fn) {\n for (const from of src) {\n yield* fn(from);\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * items that return a `truthy` value from `fn`.\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* filter(src, fn) {\n for (const from of src) {\n if (fn(from)) {\n yield from;\n }\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * result of `fn` when it is `truthy`\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* filterMap(src, fn) {\n for (const from of src) {\n const res = fn(from);\n if (res) {\n yield res;\n }\n }\n}\n/**\n * Creates a new iterator that iterates (lazily) over its input and yields the\n * result of `fn` when it is not null or undefined\n * @param src A type that can be iterated over\n * @param fn The function that is called for each value\n */\nfunction* filterMapStrict(src, fn) {\n for (const from of src) {\n const res = fn(from);\n if (res != null) {\n yield res;\n }\n }\n}\n/**\n * Iterate through `src` until `match` returns a truthy value\n * @param src A type that can be iterated over\n * @param match A function that should return a truthy value for the item that you want to find\n * @returns The first entry that `match` returns a truthy value for, or `undefined`\n */\nfunction find(src, match) {\n for (const from of src) {\n if (match(from)) {\n return from;\n }\n }\n return void 0;\n}\nfunction reduce(src, reducer, initial) {\n let acc = initial;\n for (const item of src) {\n acc = reducer(acc, item);\n }\n return acc;\n}\n/**\n * A convenience function for reducing over an iterator of strings and concatenating them together\n * @param src The value to iterate over\n * @param connector The string value to intersperse between the yielded values\n * @returns The concatenated entries of `src` interspersed with copies of `connector`\n */\nfunction join(src, connector = \",\") {\n return reduce(src, (acc, cur) => `${acc}${connector}${cur}`, \"\");\n}\n/**\n * Iterate through `src` and return `true` if `fn` returns a thruthy value for every yielded value.\n * Otherwise, return `false`. This function short circuits.\n * @param src The type to be iterated over\n * @param fn A function to check each iteration\n */\nfunction every(src, fn) {\n for (const val of src) {\n if (!fn(val)) {\n return false;\n }\n }\n return true;\n}\n\n\n//# sourceURL=webpack:///./src/common/utils/iter.ts?");
|
|
40036
40002
|
|
|
40037
40003
|
/***/ }),
|
|
40038
40004
|
|
|
@@ -40164,7 +40130,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
40164
40130
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40165
40131
|
|
|
40166
40132
|
"use strict";
|
|
40167
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"readFileFromTar\", function() { return readFileFromTar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"listTarEntries\", function() { return listTarEntries; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractTar\", function() { return extractTar; });\n/* harmony import */ var tar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tar */ \"./node_modules/tar/index.js\");\n/* harmony import */ var tar__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tar__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Helper for working with tarball files (.tar, .tgz)\n// Docs: https://github.com/npm/node-tar\n\n\nfunction readFileFromTar({ tarPath, filePath, parseJson }) {\n return new Promise(
|
|
40133
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"readFileFromTar\", function() { return readFileFromTar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"listTarEntries\", function() { return listTarEntries; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractTar\", function() { return extractTar; });\n/* harmony import */ var tar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tar */ \"./node_modules/tar/index.js\");\n/* harmony import */ var tar__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tar__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Helper for working with tarball files (.tar, .tgz)\n// Docs: https://github.com/npm/node-tar\n\n\nfunction readFileFromTar({ tarPath, filePath, parseJson }) {\n return new Promise((resolve, reject) => {\n const fileChunks = [];\n tar__WEBPACK_IMPORTED_MODULE_0___default.a.list({\n file: tarPath,\n filter: entryPath => path__WEBPACK_IMPORTED_MODULE_1___default.a.normalize(entryPath) === filePath,\n sync: true,\n onentry(entry) {\n entry.on(\"data\", chunk => {\n fileChunks.push(chunk);\n });\n entry.once(\"error\", err => {\n reject(new Error(`reading file has failed ${entry.path}: ${err}`));\n });\n entry.once(\"end\", () => {\n const data = Buffer.concat(fileChunks);\n const result = parseJson ? JSON.parse(data.toString(\"utf8\")) : data;\n resolve(result);\n });\n },\n });\n if (!fileChunks.length) {\n reject(new Error(\"Not found\"));\n }\n });\n}\nasync function listTarEntries(filePath) {\n const entries = [];\n await tar__WEBPACK_IMPORTED_MODULE_0___default.a.list({\n file: filePath,\n onentry: (entry) => {\n entries.push(path__WEBPACK_IMPORTED_MODULE_1___default.a.normalize(entry.path));\n },\n });\n return entries;\n}\nfunction extractTar(filePath, opts = {}) {\n return tar__WEBPACK_IMPORTED_MODULE_0___default.a.extract(Object.assign({ file: filePath, cwd: path__WEBPACK_IMPORTED_MODULE_1___default.a.dirname(filePath) }, opts));\n}\n\n\n//# sourceURL=webpack:///./src/common/utils/tar.ts?");
|
|
40168
40134
|
|
|
40169
40135
|
/***/ }),
|
|
40170
40136
|
|
|
@@ -40200,7 +40166,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
40200
40166
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40201
40167
|
|
|
40202
40168
|
"use strict";
|
|
40203
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"zip\", function() { return zip; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filled\", function() { return filled; });\n/* harmony import */ var
|
|
40169
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"zip\", function() { return zip; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filled\", function() { return filled; });\n/* harmony import */ var _utils_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/array */ \"./src/common/utils/array.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * Iterates over `sources` yielding full tuples until one of the tuple arrays\n * is empty. Then it returns a tuple with the rest of each of tuples\n * @param sources The source arrays\n * @yields A tuple of the next element from each of the sources\n * @returns The tuple of all the sources as soon as at least one of the sources is exausted\n */\nfunction* zip(...sources) {\n const maxSafeLength = Math.min(...sources.map(source => source.length));\n for (let i = 0; i < maxSafeLength; i += 1) {\n yield sources.map(source => source[i]);\n }\n return sources.map(source => source.slice(maxSafeLength));\n}\n/**\n * Returns a `length` tuple filled with copies of `value`\n * @param length The size of the tuple\n * @param value The value for each of the tuple entries\n */\nfunction filled(length, value) {\n return _utils_array__WEBPACK_IMPORTED_MODULE_0__[\"filled\"](length, value);\n}\n\n\n//# sourceURL=webpack:///./src/common/utils/tuple.ts?");
|
|
40204
40170
|
|
|
40205
40171
|
/***/ }),
|
|
40206
40172
|
|
|
@@ -40232,11 +40198,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/**\n * Copyright (c) 2021 Op
|
|
|
40232
40198
|
/*!****************************!*\
|
|
40233
40199
|
!*** ./src/common/vars.ts ***!
|
|
40234
40200
|
\****************************/
|
|
40235
|
-
/*! exports provided: isMac, isWindows, isLinux, isDebugging, isSnap, isProduction, isTestEnv, isDevelopment, isPublishConfigured, integrationTestingArg, isIntegrationTesting, productName, appName, publicPath, contextDir, buildDir, preloadEntrypoint, mainDir, rendererDir, htmlTemplate, sassCommonVars, webpackDevServerPort, apiPrefix, apiKubePrefix, issuesTrackerUrl, slackUrl, supportUrl, appSemVer, docsUrl, sentryDsn */
|
|
40201
|
+
/*! exports provided: isMac, isWindows, isLinux, isDebugging, isSnap, isProduction, isTestEnv, isDevelopment, isPublishConfigured, integrationTestingArg, isIntegrationTesting, productName, appName, publicPath, defaultTheme, contextDir, buildDir, preloadEntrypoint, mainDir, rendererDir, htmlTemplate, sassCommonVars, webpackDevServerPort, apiPrefix, apiKubePrefix, issuesTrackerUrl, slackUrl, supportUrl, appSemVer, docsUrl, sentryDsn */
|
|
40236
40202
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40237
40203
|
|
|
40238
40204
|
"use strict";
|
|
40239
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isMac\", function() { return isMac; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isWindows\", function() { return isWindows; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isLinux\", function() { return isLinux; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isDebugging\", function() { return isDebugging; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isSnap\", function() { return isSnap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isProduction\", function() { return isProduction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isTestEnv\", function() { return isTestEnv; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isDevelopment\", function() { return isDevelopment; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPublishConfigured\", function() { return isPublishConfigured; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"integrationTestingArg\", function() { return integrationTestingArg; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isIntegrationTesting\", function() { return isIntegrationTesting; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"productName\", function() { return productName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"appName\", function() { return appName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"publicPath\", function() { return publicPath; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"contextDir\", function() { return contextDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"buildDir\", function() { return buildDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"preloadEntrypoint\", function() { return preloadEntrypoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mainDir\", function() { return mainDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rendererDir\", function() { return rendererDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"htmlTemplate\", function() { return htmlTemplate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sassCommonVars\", function() { return sassCommonVars; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"webpackDevServerPort\", function() { return webpackDevServerPort; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"apiPrefix\", function() { return apiPrefix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"apiKubePrefix\", function() { return apiKubePrefix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"issuesTrackerUrl\", function() { return issuesTrackerUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"slackUrl\", function() { return slackUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"supportUrl\", function() { return supportUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"appSemVer\", function() { return appSemVer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"docsUrl\", function() { return docsUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sentryDsn\", function() { return sentryDsn; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! semver */ \"./node_modules/semver/index.js\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../package.json */ \"./package.json\");\nvar _package_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ../../package.json */ \"./package.json\", 1);\n/* harmony import */ var _utils_defineGlobal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/defineGlobal */ \"./src/common/utils/defineGlobal.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar _a, _b, _c;\n// App's common configuration for any process (main, renderer, build pipeline, etc.)\n\n\n\n\nconst isMac = process.platform === \"darwin\";\nconst isWindows = process.platform === \"win32\";\nconst isLinux = process.platform === \"linux\";\nconst isDebugging = [\"true\", \"1\", \"yes\", \"y\", \"on\"].includes(((_a = process.env.DEBUG) !== null && _a !== void 0 ? _a : \"\").toLowerCase());\nconst isSnap = !!process.env.SNAP;\nconst isProduction = \"development\" === \"production\";\nconst isTestEnv = !!process.env.JEST_WORKER_ID;\nconst isDevelopment = !isTestEnv && !isProduction;\nconst isPublishConfigured = Object.keys(_package_json__WEBPACK_IMPORTED_MODULE_2__.build).includes(\"publish\");\nconst integrationTestingArg = \"--integration-testing\";\nconst isIntegrationTesting = process.argv.includes(integrationTestingArg);\nconst productName = _package_json__WEBPACK_IMPORTED_MODULE_2__.productName;\nconst appName = `${_package_json__WEBPACK_IMPORTED_MODULE_2__.productName}${isDevelopment ? \"Dev\" : \"\"}`;\nconst publicPath = \"/build/\";\n// Webpack build paths\nconst contextDir = process.cwd();\nconst buildDir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"static\", publicPath);\nconst preloadEntrypoint = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"src/preload.ts\");\nconst mainDir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"src/main\");\nconst rendererDir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"src/renderer\");\nconst htmlTemplate = path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(rendererDir, \"template.html\");\nconst sassCommonVars = path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(rendererDir, \"components/vars.scss\");\nconst webpackDevServerPort = 9009;\n// Special runtime paths\nObject(_utils_defineGlobal__WEBPACK_IMPORTED_MODULE_3__[\"defineGlobal\"])(\"__static\", {\n get() {\n var _a;\n const root = isDevelopment\n ? contextDir\n : ((_a = process.resourcesPath) !== null && _a !== void 0 ? _a : contextDir);\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(root, \"static\");\n },\n});\n// Apis\nconst apiPrefix = \"/api\"; // local router apis\nconst apiKubePrefix = \"/api-kube\"; // k8s cluster apis\n// Links\nconst issuesTrackerUrl = \"https://github.com/lensapp/lens/issues\";\nconst slackUrl = \"https://join.slack.com/t/k8slens/shared_invite/zt-wcl8jq3k-68R5Wcmk1o95MLBE5igUDQ\";\nconst supportUrl = \"https://docs.k8slens.dev/latest/support/\";\nconst appSemVer = new semver__WEBPACK_IMPORTED_MODULE_1__[\"SemVer\"](_package_json__WEBPACK_IMPORTED_MODULE_2__.version);\nconst docsUrl = \"https://docs.k8slens.dev/main/\";\nconst sentryDsn = (_c = (_b = _package_json__WEBPACK_IMPORTED_MODULE_2__.config) === null || _b === void 0 ? void 0 : _b.sentryDsn) !== null && _c !== void 0 ? _c : \"\";\n\n\n//# sourceURL=webpack:///./src/common/vars.ts?");
|
|
40205
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isMac\", function() { return isMac; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isWindows\", function() { return isWindows; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isLinux\", function() { return isLinux; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isDebugging\", function() { return isDebugging; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isSnap\", function() { return isSnap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isProduction\", function() { return isProduction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isTestEnv\", function() { return isTestEnv; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isDevelopment\", function() { return isDevelopment; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPublishConfigured\", function() { return isPublishConfigured; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"integrationTestingArg\", function() { return integrationTestingArg; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isIntegrationTesting\", function() { return isIntegrationTesting; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"productName\", function() { return productName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"appName\", function() { return appName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"publicPath\", function() { return publicPath; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultTheme\", function() { return defaultTheme; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"contextDir\", function() { return contextDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"buildDir\", function() { return buildDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"preloadEntrypoint\", function() { return preloadEntrypoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mainDir\", function() { return mainDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rendererDir\", function() { return rendererDir; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"htmlTemplate\", function() { return htmlTemplate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sassCommonVars\", function() { return sassCommonVars; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"webpackDevServerPort\", function() { return webpackDevServerPort; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"apiPrefix\", function() { return apiPrefix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"apiKubePrefix\", function() { return apiKubePrefix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"issuesTrackerUrl\", function() { return issuesTrackerUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"slackUrl\", function() { return slackUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"supportUrl\", function() { return supportUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"appSemVer\", function() { return appSemVer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"docsUrl\", function() { return docsUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sentryDsn\", function() { return sentryDsn; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! semver */ \"./node_modules/semver/index.js\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../package.json */ \"./package.json\");\nvar _package_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ../../package.json */ \"./package.json\", 1);\n/* harmony import */ var _utils_defineGlobal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/defineGlobal */ \"./src/common/utils/defineGlobal.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar _a, _b, _c;\n// App's common configuration for any process (main, renderer, build pipeline, etc.)\n\n\n\n\nconst isMac = process.platform === \"darwin\";\nconst isWindows = process.platform === \"win32\";\nconst isLinux = process.platform === \"linux\";\nconst isDebugging = [\"true\", \"1\", \"yes\", \"y\", \"on\"].includes(((_a = process.env.DEBUG) !== null && _a !== void 0 ? _a : \"\").toLowerCase());\nconst isSnap = !!process.env.SNAP;\nconst isProduction = \"development\" === \"production\";\nconst isTestEnv = !!process.env.JEST_WORKER_ID;\nconst isDevelopment = !isTestEnv && !isProduction;\nconst isPublishConfigured = Object.keys(_package_json__WEBPACK_IMPORTED_MODULE_2__.build).includes(\"publish\");\nconst integrationTestingArg = \"--integration-testing\";\nconst isIntegrationTesting = process.argv.includes(integrationTestingArg);\nconst productName = _package_json__WEBPACK_IMPORTED_MODULE_2__.productName;\nconst appName = `${_package_json__WEBPACK_IMPORTED_MODULE_2__.productName}${isDevelopment ? \"Dev\" : \"\"}`;\nconst publicPath = \"/build/\";\nconst defaultTheme = \"lens-dark\";\n// Webpack build paths\nconst contextDir = process.cwd();\nconst buildDir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"static\", publicPath);\nconst preloadEntrypoint = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"src/preload.ts\");\nconst mainDir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"src/main\");\nconst rendererDir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(contextDir, \"src/renderer\");\nconst htmlTemplate = path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(rendererDir, \"template.html\");\nconst sassCommonVars = path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(rendererDir, \"components/vars.scss\");\nconst webpackDevServerPort = 9009;\n// Special runtime paths\nObject(_utils_defineGlobal__WEBPACK_IMPORTED_MODULE_3__[\"defineGlobal\"])(\"__static\", {\n get() {\n var _a;\n const root = isDevelopment\n ? contextDir\n : ((_a = process.resourcesPath) !== null && _a !== void 0 ? _a : contextDir);\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.resolve(root, \"static\");\n },\n});\n// Apis\nconst apiPrefix = \"/api\"; // local router apis\nconst apiKubePrefix = \"/api-kube\"; // k8s cluster apis\n// Links\nconst issuesTrackerUrl = \"https://github.com/lensapp/lens/issues\";\nconst slackUrl = \"https://join.slack.com/t/k8slens/shared_invite/zt-wcl8jq3k-68R5Wcmk1o95MLBE5igUDQ\";\nconst supportUrl = \"https://docs.k8slens.dev/latest/support/\";\nconst appSemVer = new semver__WEBPACK_IMPORTED_MODULE_1__[\"SemVer\"](_package_json__WEBPACK_IMPORTED_MODULE_2__.version);\nconst docsUrl = \"https://docs.k8slens.dev/main/\";\nconst sentryDsn = (_c = (_b = _package_json__WEBPACK_IMPORTED_MODULE_2__.config) === null || _b === void 0 ? void 0 : _b.sentryDsn) !== null && _c !== void 0 ? _c : \"\";\n\n\n//# sourceURL=webpack:///./src/common/vars.ts?");
|
|
40240
40206
|
|
|
40241
40207
|
/***/ }),
|
|
40242
40208
|
|
|
@@ -40536,7 +40502,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
40536
40502
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40537
40503
|
|
|
40538
40504
|
"use strict";
|
|
40539
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseRegistry\", function() { return BaseRegistry; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/utils */ \"./src/common/utils/index.ts\");\n
|
|
40505
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseRegistry\", function() { return BaseRegistry; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/utils */ \"./src/common/utils/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n// Base class for extensions-api registries\n\n\nclass BaseRegistry extends _common_utils__WEBPACK_IMPORTED_MODULE_1__[\"Singleton\"] {\n constructor() {\n super();\n Object.defineProperty(this, \"items\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].map([], { deep: false })\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n }\n getItems() {\n return Array.from(this.items.values());\n }\n add(items, extension) {\n const itemArray = [items].flat();\n itemArray.forEach(item => {\n this.items.set(item, this.getRegisteredItem(item, extension));\n });\n return () => this.remove(...itemArray);\n }\n // eslint-disable-next-line unused-imports/no-unused-vars-ts\n getRegisteredItem(item, extension) {\n return item;\n }\n remove(...items) {\n items.forEach(item => {\n this.items.delete(item);\n });\n }\n}\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object, Function]),\n __metadata(\"design:returntype\", void 0)\n], BaseRegistry.prototype, \"add\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], BaseRegistry.prototype, \"remove\", null);\n\n\n//# sourceURL=webpack:///./src/extensions/registries/base-registry.ts?");
|
|
40540
40506
|
|
|
40541
40507
|
/***/ }),
|
|
40542
40508
|
|
|
@@ -40920,7 +40886,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
40920
40886
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40921
40887
|
|
|
40922
40888
|
"use strict";
|
|
40923
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bundledKubectlPath\", function() { return bundledKubectlPath; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Kubectl\", function() { return Kubectl; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ \"fs\");\n/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/utils/promise-exec */ \"./src/common/utils/promise-exec.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ \"./src/main/logger.ts\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var proper_lockfile__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! proper-lockfile */ \"./node_modules/proper-lockfile/index.js\");\n/* harmony import */ var proper_lockfile__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(proper_lockfile__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _helm_helm_cli__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helm/helm-cli */ \"./src/main/helm/helm-cli.ts\");\n/* harmony import */ var _common_user_store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/user-store */ \"./src/common/user-store/index.ts\");\n/* harmony import */ var _common_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/request */ \"./src/common/request.ts\");\n/* harmony import */ var _common_utils_app_version__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../common/utils/app-version */ \"./src/common/utils/app-version.ts\");\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! semver */ \"./node_modules/semver/index.js\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var _common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../common/user-store/preferences-helpers */ \"./src/common/user-store/preferences-helpers.ts\");\n/* harmony import */ var _common_app_paths__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/app-paths */ \"./src/common/app-paths.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst bundledVersion = Object(_common_utils_app_version__WEBPACK_IMPORTED_MODULE_9__[\"getBundledKubectlVersion\"])();\nconst kubectlMap = new Map([\n [\"1.7\", \"1.8.15\"],\n [\"1.8\", \"1.9.10\"],\n [\"1.9\", \"1.10.13\"],\n [\"1.10\", \"1.11.10\"],\n [\"1.11\", \"1.12.10\"],\n [\"1.12\", \"1.13.12\"],\n [\"1.13\", \"1.13.12\"],\n [\"1.14\", \"1.14.10\"],\n [\"1.15\", \"1.15.11\"],\n [\"1.16\", \"1.16.15\"],\n [\"1.17\", \"1.17.17\"],\n [\"1.18\", \"1.18.20\"],\n [\"1.19\", \"1.19.12\"],\n [\"1.20\", \"1.20.8\"],\n [\"1.21\", bundledVersion],\n]);\nlet bundledPath;\nconst initScriptVersionString = \"# lens-initscript v3\\n\";\nfunction bundledKubectlPath() {\n if (bundledPath) {\n return bundledPath;\n }\n if (_common_vars__WEBPACK_IMPORTED_MODULE_10__[\"isDevelopment\"] || _common_vars__WEBPACK_IMPORTED_MODULE_10__[\"isTestEnv\"]) {\n const platformName = _common_vars__WEBPACK_IMPORTED_MODULE_10__[\"isWindows\"] ? \"windows\" : process.platform;\n bundledPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(process.cwd(), \"binaries\", \"client\", platformName, process.arch, \"kubectl\");\n }\n else {\n bundledPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(process.resourcesPath, process.arch, \"kubectl\");\n }\n if (_common_vars__WEBPACK_IMPORTED_MODULE_10__[\"isWindows\"]) {\n bundledPath = `${bundledPath}.exe`;\n }\n return bundledPath;\n}\nclass Kubectl {\n constructor(clusterVersion) {\n Object.defineProperty(this, \"kubectlVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"directory\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"url\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"path\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"dirname\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n let version;\n try {\n version = new semver__WEBPACK_IMPORTED_MODULE_11__[\"SemVer\"](clusterVersion, { includePrerelease: false });\n }\n catch (_a) {\n version = new semver__WEBPACK_IMPORTED_MODULE_11__[\"SemVer\"](Kubectl.bundledKubectlVersion);\n }\n const minorVersion = `${version.major}.${version.minor}`;\n /* minorVersion is the first two digits of kube server version\n if the version map includes that, use that version, if not, fallback to the exact x.y.z of kube version */\n if (kubectlMap.has(minorVersion)) {\n this.kubectlVersion = kubectlMap.get(minorVersion);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Set kubectl version ${this.kubectlVersion} for cluster version ${clusterVersion} using version map`);\n }\n else {\n this.kubectlVersion = version.format();\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Set kubectl version ${this.kubectlVersion} for cluster version ${clusterVersion} using fallback`);\n }\n let arch = null;\n if (process.arch == \"x64\") {\n arch = \"amd64\";\n }\n else if (process.arch == \"x86\" || process.arch == \"ia32\") {\n arch = \"386\";\n }\n else {\n arch = process.arch;\n }\n const platformName = _common_vars__WEBPACK_IMPORTED_MODULE_10__[\"isWindows\"] ? \"windows\" : process.platform;\n const binaryName = _common_vars__WEBPACK_IMPORTED_MODULE_10__[\"isWindows\"] ? \"kubectl.exe\" : \"kubectl\";\n this.url = `${this.getDownloadMirror()}/v${this.kubectlVersion}/bin/${platformName}/${arch}/${binaryName}`;\n this.dirname = path__WEBPACK_IMPORTED_MODULE_0___default.a.normalize(path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.getDownloadDir(), this.kubectlVersion));\n this.path = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.dirname, binaryName);\n }\n static get kubectlDir() {\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.join(_common_app_paths__WEBPACK_IMPORTED_MODULE_13__[\"AppPaths\"].get(\"userData\"), \"binaries\", \"kubectl\");\n }\n // Returns the single bundled Kubectl instance\n static bundled() {\n var _a;\n return (_a = Kubectl.bundledInstance) !== null && _a !== void 0 ? _a : (Kubectl.bundledInstance = new Kubectl(Kubectl.bundledKubectlVersion));\n }\n getBundledPath() {\n return bundledKubectlPath();\n }\n getPathFromPreferences() {\n return _common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().kubectlBinariesPath || this.getBundledPath();\n }\n getDownloadDir() {\n if (_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadBinariesPath) {\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.join(_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadBinariesPath, \"kubectl\");\n }\n return Kubectl.kubectlDir;\n }\n async getPath(bundled = false) {\n if (bundled) {\n return this.getBundledPath();\n }\n if (_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadKubectlBinaries === false) {\n return this.getPathFromPreferences();\n }\n // return binary name if bundled path is not functional\n if (!await this.checkBinary(this.getBundledPath(), false)) {\n Kubectl.invalidBundle = true;\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.basename(this.getBundledPath());\n }\n try {\n if (!await this.ensureKubectl()) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(\"Failed to ensure kubectl, fallback to the bundled version\");\n return this.getBundledPath();\n }\n return this.path;\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(\"Failed to ensure kubectl, fallback to the bundled version\");\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(err);\n return this.getBundledPath();\n }\n }\n async binDir() {\n try {\n await this.ensureKubectl();\n await this.writeInitScripts();\n return this.dirname;\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(err);\n return \"\";\n }\n }\n async checkBinary(path, checkVersion = true) {\n const exists = await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"pathExists\"])(path);\n if (exists) {\n try {\n const args = [\n \"version\",\n \"--client\", \"true\",\n \"--output\", \"json\",\n ];\n const { stdout } = await Object(_common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_2__[\"promiseExecFile\"])(path, args);\n const output = JSON.parse(stdout);\n if (!checkVersion) {\n return true;\n }\n let version = output.clientVersion.gitVersion;\n if (version[0] === \"v\") {\n version = version.slice(1);\n }\n if (version === this.kubectlVersion) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Local kubectl is version ${this.kubectlVersion}`);\n return true;\n }\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Local kubectl is version ${version}, expected ${this.kubectlVersion}, unlinking`);\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Local kubectl failed to run properly (${err.message}), unlinking`);\n }\n await fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.unlink(this.path);\n }\n return false;\n }\n async checkBundled() {\n if (this.kubectlVersion === Kubectl.bundledKubectlVersion) {\n try {\n const exist = await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"pathExists\"])(this.path);\n if (!exist) {\n await fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.copyFile(this.getBundledPath(), this.path);\n await fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.chmod(this.path, 0o755);\n }\n return true;\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Could not copy the bundled kubectl to app-data: ${err}`);\n return false;\n }\n }\n else {\n return false;\n }\n }\n async ensureKubectl() {\n if (_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadKubectlBinaries === false) {\n return true;\n }\n if (Kubectl.invalidBundle) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Detected invalid bundle binary, returning ...`);\n return false;\n }\n await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"ensureDir\"])(this.dirname, 0o755);\n try {\n const release = await proper_lockfile__WEBPACK_IMPORTED_MODULE_5__[\"lock\"](this.dirname);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Acquired a lock for ${this.kubectlVersion}`);\n const bundled = await this.checkBundled();\n let isValid = await this.checkBinary(this.path, !bundled);\n if (!isValid && !bundled) {\n try {\n await this.downloadKubectl();\n }\n catch (error) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBECTL]: failed to download kubectl`, error);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`[KUBECTL]: Releasing lock for ${this.kubectlVersion}`);\n await release();\n return false;\n }\n isValid = await this.checkBinary(this.path, false);\n }\n if (!isValid) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`[KUBECTL]: Releasing lock for ${this.kubectlVersion}`);\n await release();\n return false;\n }\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`[KUBECTL]: Releasing lock for ${this.kubectlVersion}`);\n await release();\n return true;\n }\n catch (error) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBECTL]: Failed to get a lock for ${this.kubectlVersion}`, error);\n return false;\n }\n }\n async downloadKubectl() {\n await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"ensureDir\"])(path__WEBPACK_IMPORTED_MODULE_0___default.a.dirname(this.path), 0o755);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`Downloading kubectl ${this.kubectlVersion} from ${this.url} to ${this.path}`);\n return new Promise((resolve, reject) => {\n const stream = Object(_common_request__WEBPACK_IMPORTED_MODULE_8__[\"customRequest\"])({\n url: this.url,\n gzip: true,\n });\n const file = fs__WEBPACK_IMPORTED_MODULE_1___default.a.createWriteStream(this.path);\n stream.on(\"complete\", () => {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(\"kubectl binary download finished\");\n file.end();\n });\n stream.on(\"error\", (error) => {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(error);\n fs__WEBPACK_IMPORTED_MODULE_1___default.a.unlink(this.path, () => {\n // do nothing\n });\n reject(error);\n });\n file.on(\"close\", () => {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(\"kubectl binary download closed\");\n fs__WEBPACK_IMPORTED_MODULE_1___default.a.chmod(this.path, 0o755, (err) => {\n if (err)\n reject(err);\n });\n resolve();\n });\n stream.pipe(file);\n });\n }\n async writeInitScripts() {\n const kubectlPath = _common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadKubectlBinaries ? this.dirname : path__WEBPACK_IMPORTED_MODULE_0___default.a.dirname(this.getPathFromPreferences());\n const helmPath = _helm_helm_cli__WEBPACK_IMPORTED_MODULE_6__[\"helmCli\"].getBinaryDir();\n const fsPromises = fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises;\n const bashScriptPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.dirname, \".bash_set_path\");\n let bashScript = `${initScriptVersionString}`;\n bashScript += \"tempkubeconfig=\\\"$KUBECONFIG\\\"\\n\";\n bashScript += \"test -f \\\"/etc/profile\\\" && . \\\"/etc/profile\\\"\\n\";\n bashScript += \"if test -f \\\"$HOME/.bash_profile\\\"; then\\n\";\n bashScript += \" . \\\"$HOME/.bash_profile\\\"\\n\";\n bashScript += \"elif test -f \\\"$HOME/.bash_login\\\"; then\\n\";\n bashScript += \" . \\\"$HOME/.bash_login\\\"\\n\";\n bashScript += \"elif test -f \\\"$HOME/.profile\\\"; then\\n\";\n bashScript += \" . \\\"$HOME/.profile\\\"\\n\";\n bashScript += \"fi\\n\";\n bashScript += `export PATH=\"${helmPath}:${kubectlPath}:$PATH\"\\n`;\n bashScript += \"export KUBECONFIG=\\\"$tempkubeconfig\\\"\\n\";\n bashScript += `NO_PROXY=\\\",\\${NO_PROXY:-localhost},\\\"\\n`;\n bashScript += `NO_PROXY=\\\"\\${NO_PROXY//,localhost,/,}\\\"\\n`;\n bashScript += `NO_PROXY=\\\"\\${NO_PROXY//,127.0.0.1,/,}\\\"\\n`;\n bashScript += `NO_PROXY=\\\"localhost,127.0.0.1\\${NO_PROXY%,}\\\"\\n`;\n bashScript += \"export NO_PROXY\\n\";\n bashScript += \"unset tempkubeconfig\\n\";\n await fsPromises.writeFile(bashScriptPath, bashScript.toString(), { mode: 0o644 });\n const zshScriptPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.dirname, \".zlogin\");\n let zshScript = `${initScriptVersionString}`;\n zshScript += \"tempkubeconfig=\\\"$KUBECONFIG\\\"\\n\";\n // restore previous ZDOTDIR\n zshScript += \"export ZDOTDIR=\\\"$OLD_ZDOTDIR\\\"\\n\";\n // source all the files\n zshScript += \"test -f \\\"$OLD_ZDOTDIR/.zshenv\\\" && . \\\"$OLD_ZDOTDIR/.zshenv\\\"\\n\";\n zshScript += \"test -f \\\"$OLD_ZDOTDIR/.zprofile\\\" && . \\\"$OLD_ZDOTDIR/.zprofile\\\"\\n\";\n zshScript += \"test -f \\\"$OLD_ZDOTDIR/.zlogin\\\" && . \\\"$OLD_ZDOTDIR/.zlogin\\\"\\n\";\n zshScript += \"test -f \\\"$OLD_ZDOTDIR/.zshrc\\\" && . \\\"$OLD_ZDOTDIR/.zshrc\\\"\\n\";\n // voodoo to replace any previous occurrences of kubectl path in the PATH\n zshScript += `kubectlpath=\\\"${kubectlPath}\"\\n`;\n zshScript += `helmpath=\\\"${helmPath}\"\\n`;\n zshScript += \"p=\\\":$kubectlpath:\\\"\\n\";\n zshScript += \"d=\\\":$PATH:\\\"\\n\";\n zshScript += `d=\\${d//$p/:}\\n`;\n zshScript += `d=\\${d/#:/}\\n`;\n zshScript += `export PATH=\\\"$helmpath:$kubectlpath:\\${d/%:/}\\\"\\n`;\n zshScript += \"export KUBECONFIG=\\\"$tempkubeconfig\\\"\\n\";\n zshScript += `NO_PROXY=\\\",\\${NO_PROXY:-localhost},\\\"\\n`;\n zshScript += `NO_PROXY=\\\"\\${NO_PROXY//,localhost,/,}\\\"\\n`;\n zshScript += `NO_PROXY=\\\"\\${NO_PROXY//,127.0.0.1,/,}\\\"\\n`;\n zshScript += `NO_PROXY=\\\"localhost,127.0.0.1\\${NO_PROXY%,}\\\"\\n`;\n zshScript += \"export NO_PROXY\\n\";\n zshScript += \"unset tempkubeconfig\\n\";\n zshScript += \"unset OLD_ZDOTDIR\\n\";\n await fsPromises.writeFile(zshScriptPath, zshScript.toString(), { mode: 0o644 });\n }\n getDownloadMirror() {\n // MacOS packages are only available from default\n var _a;\n const mirror = (_a = _common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_12__[\"packageMirrors\"].get(_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadMirror)) !== null && _a !== void 0 ? _a : _common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_12__[\"packageMirrors\"].get(_common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_12__[\"defaultPackageMirror\"]);\n return mirror.url;\n }\n}\nObject.defineProperty(Kubectl, \"bundledKubectlVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: bundledVersion\n});\nObject.defineProperty(Kubectl, \"invalidBundle\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n});\n\n\n//# sourceURL=webpack:///./src/main/kubectl.ts?");
|
|
40889
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bundledKubectlPath\", function() { return bundledKubectlPath; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Kubectl\", function() { return Kubectl; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ \"fs\");\n/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/utils/promise-exec */ \"./src/common/utils/promise-exec.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ \"./src/main/logger.ts\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var proper_lockfile__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! proper-lockfile */ \"./node_modules/proper-lockfile/index.js\");\n/* harmony import */ var proper_lockfile__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(proper_lockfile__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _helm_helm_cli__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helm/helm-cli */ \"./src/main/helm/helm-cli.ts\");\n/* harmony import */ var _common_user_store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/user-store */ \"./src/common/user-store/index.ts\");\n/* harmony import */ var _common_utils_app_version__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/utils/app-version */ \"./src/common/utils/app-version.ts\");\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../common/vars */ \"./src/common/vars.ts\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! semver */ \"./node_modules/semver/index.js\");\n/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var _common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../common/user-store/preferences-helpers */ \"./src/common/user-store/preferences-helpers.ts\");\n/* harmony import */ var _common_app_paths__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../common/app-paths */ \"./src/common/app-paths.ts\");\n/* harmony import */ var got_dist_source__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! got/dist/source */ \"./node_modules/got/dist/source/index.js\");\n/* harmony import */ var got_dist_source__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(got_dist_source__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! util */ \"util\");\n/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_14__);\n/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! stream */ \"stream\");\n/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(stream__WEBPACK_IMPORTED_MODULE_15__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst bundledVersion = Object(_common_utils_app_version__WEBPACK_IMPORTED_MODULE_8__[\"getBundledKubectlVersion\"])();\nconst kubectlMap = new Map([\n [\"1.7\", \"1.8.15\"],\n [\"1.8\", \"1.9.10\"],\n [\"1.9\", \"1.10.13\"],\n [\"1.10\", \"1.11.10\"],\n [\"1.11\", \"1.12.10\"],\n [\"1.12\", \"1.13.12\"],\n [\"1.13\", \"1.13.12\"],\n [\"1.14\", \"1.14.10\"],\n [\"1.15\", \"1.15.11\"],\n [\"1.16\", \"1.16.15\"],\n [\"1.17\", \"1.17.17\"],\n [\"1.18\", \"1.18.20\"],\n [\"1.19\", \"1.19.12\"],\n [\"1.20\", \"1.20.8\"],\n [\"1.21\", bundledVersion],\n]);\nlet bundledPath;\nconst initScriptVersionString = \"# lens-initscript v3\";\nfunction bundledKubectlPath() {\n if (bundledPath) {\n return bundledPath;\n }\n if (_common_vars__WEBPACK_IMPORTED_MODULE_9__[\"isDevelopment\"] || _common_vars__WEBPACK_IMPORTED_MODULE_9__[\"isTestEnv\"]) {\n const platformName = _common_vars__WEBPACK_IMPORTED_MODULE_9__[\"isWindows\"] ? \"windows\" : process.platform;\n bundledPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(process.cwd(), \"binaries\", \"client\", platformName, process.arch, \"kubectl\");\n }\n else {\n bundledPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(process.resourcesPath, process.arch, \"kubectl\");\n }\n if (_common_vars__WEBPACK_IMPORTED_MODULE_9__[\"isWindows\"]) {\n bundledPath = `${bundledPath}.exe`;\n }\n return bundledPath;\n}\nclass Kubectl {\n constructor(clusterVersion) {\n Object.defineProperty(this, \"kubectlVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"directory\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"url\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"path\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"dirname\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n let version;\n try {\n version = new semver__WEBPACK_IMPORTED_MODULE_10__[\"SemVer\"](clusterVersion, { includePrerelease: false });\n }\n catch (_a) {\n version = new semver__WEBPACK_IMPORTED_MODULE_10__[\"SemVer\"](Kubectl.bundledKubectlVersion);\n }\n const minorVersion = `${version.major}.${version.minor}`;\n /* minorVersion is the first two digits of kube server version\n if the version map includes that, use that version, if not, fallback to the exact x.y.z of kube version */\n if (kubectlMap.has(minorVersion)) {\n this.kubectlVersion = kubectlMap.get(minorVersion);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Set kubectl version ${this.kubectlVersion} for cluster version ${clusterVersion} using version map`);\n }\n else {\n this.kubectlVersion = version.format();\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Set kubectl version ${this.kubectlVersion} for cluster version ${clusterVersion} using fallback`);\n }\n let arch = null;\n if (process.arch == \"x64\") {\n arch = \"amd64\";\n }\n else if (process.arch == \"x86\" || process.arch == \"ia32\") {\n arch = \"386\";\n }\n else {\n arch = process.arch;\n }\n const platformName = _common_vars__WEBPACK_IMPORTED_MODULE_9__[\"isWindows\"] ? \"windows\" : process.platform;\n const binaryName = _common_vars__WEBPACK_IMPORTED_MODULE_9__[\"isWindows\"] ? \"kubectl.exe\" : \"kubectl\";\n this.url = `${this.getDownloadMirror()}/v${this.kubectlVersion}/bin/${platformName}/${arch}/${binaryName}`;\n this.dirname = path__WEBPACK_IMPORTED_MODULE_0___default.a.normalize(path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.getDownloadDir(), this.kubectlVersion));\n this.path = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.dirname, binaryName);\n }\n static get kubectlDir() {\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.join(_common_app_paths__WEBPACK_IMPORTED_MODULE_12__[\"AppPaths\"].get(\"userData\"), \"binaries\", \"kubectl\");\n }\n // Returns the single bundled Kubectl instance\n static bundled() {\n var _a;\n return (_a = Kubectl.bundledInstance) !== null && _a !== void 0 ? _a : (Kubectl.bundledInstance = new Kubectl(Kubectl.bundledKubectlVersion));\n }\n getBundledPath() {\n return bundledKubectlPath();\n }\n getPathFromPreferences() {\n return _common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().kubectlBinariesPath || this.getBundledPath();\n }\n getDownloadDir() {\n if (_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadBinariesPath) {\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.join(_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadBinariesPath, \"kubectl\");\n }\n return Kubectl.kubectlDir;\n }\n async getPath(bundled = false) {\n if (bundled) {\n return this.getBundledPath();\n }\n if (_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadKubectlBinaries === false) {\n return this.getPathFromPreferences();\n }\n // return binary name if bundled path is not functional\n if (!await this.checkBinary(this.getBundledPath(), false)) {\n Kubectl.invalidBundle = true;\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.basename(this.getBundledPath());\n }\n try {\n if (!await this.ensureKubectl()) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(\"Failed to ensure kubectl, fallback to the bundled version\");\n return this.getBundledPath();\n }\n return this.path;\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(\"Failed to ensure kubectl, fallback to the bundled version\");\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(err);\n return this.getBundledPath();\n }\n }\n async binDir() {\n try {\n await this.ensureKubectl();\n await this.writeInitScripts();\n return this.dirname;\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(err);\n return \"\";\n }\n }\n async checkBinary(path, checkVersion = true) {\n const exists = await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"pathExists\"])(path);\n if (exists) {\n try {\n const args = [\n \"version\",\n \"--client\", \"true\",\n \"--output\", \"json\",\n ];\n const { stdout } = await Object(_common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_2__[\"promiseExecFile\"])(path, args);\n const output = JSON.parse(stdout);\n if (!checkVersion) {\n return true;\n }\n let version = output.clientVersion.gitVersion;\n if (version[0] === \"v\") {\n version = version.slice(1);\n }\n if (version === this.kubectlVersion) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Local kubectl is version ${this.kubectlVersion}`);\n return true;\n }\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Local kubectl is version ${version}, expected ${this.kubectlVersion}, unlinking`);\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Local kubectl failed to run properly (${err.message}), unlinking`);\n }\n await fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.unlink(this.path);\n }\n return false;\n }\n async checkBundled() {\n if (this.kubectlVersion === Kubectl.bundledKubectlVersion) {\n try {\n const exist = await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"pathExists\"])(this.path);\n if (!exist) {\n await fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.copyFile(this.getBundledPath(), this.path);\n await fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.chmod(this.path, 0o755);\n }\n return true;\n }\n catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Could not copy the bundled kubectl to app-data: ${err}`);\n return false;\n }\n }\n else {\n return false;\n }\n }\n async ensureKubectl() {\n if (_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadKubectlBinaries === false) {\n return true;\n }\n if (Kubectl.invalidBundle) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`Detected invalid bundle binary, returning ...`);\n return false;\n }\n await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"ensureDir\"])(this.dirname, 0o755);\n try {\n const release = await proper_lockfile__WEBPACK_IMPORTED_MODULE_5__[\"lock\"](this.dirname);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`Acquired a lock for ${this.kubectlVersion}`);\n const bundled = await this.checkBundled();\n let isValid = await this.checkBinary(this.path, !bundled);\n if (!isValid && !bundled) {\n try {\n await this.downloadKubectl();\n }\n catch (error) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBECTL]: failed to download kubectl`, error);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`[KUBECTL]: Releasing lock for ${this.kubectlVersion}`);\n await release();\n return false;\n }\n isValid = await this.checkBinary(this.path, false);\n }\n if (!isValid) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`[KUBECTL]: Releasing lock for ${this.kubectlVersion}`);\n await release();\n return false;\n }\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(`[KUBECTL]: Releasing lock for ${this.kubectlVersion}`);\n await release();\n return true;\n }\n catch (error) {\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`[KUBECTL]: Failed to get a lock for ${this.kubectlVersion}`, error);\n return false;\n }\n }\n async downloadKubectl() {\n await Object(fs_extra__WEBPACK_IMPORTED_MODULE_4__[\"ensureDir\"])(path__WEBPACK_IMPORTED_MODULE_0___default.a.dirname(this.path), 0o755);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].info(`Downloading kubectl ${this.kubectlVersion} from ${this.url} to ${this.path}`);\n const downloadStream = got_dist_source__WEBPACK_IMPORTED_MODULE_13___default.a.stream({ url: this.url, decompress: true });\n const fileWriteStream = fs__WEBPACK_IMPORTED_MODULE_1___default.a.createWriteStream(this.path, { mode: 0o755 });\n const pipeline = Object(util__WEBPACK_IMPORTED_MODULE_14__[\"promisify\"])(stream__WEBPACK_IMPORTED_MODULE_15___default.a.pipeline);\n await pipeline(downloadStream, fileWriteStream);\n _logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].debug(\"kubectl binary download finished\");\n }\n async writeInitScripts() {\n const kubectlPath = _common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadKubectlBinaries\n ? this.dirname\n : path__WEBPACK_IMPORTED_MODULE_0___default.a.dirname(this.getPathFromPreferences());\n const helmPath = _helm_helm_cli__WEBPACK_IMPORTED_MODULE_6__[\"helmCli\"].getBinaryDir();\n const bashScriptPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.dirname, \".bash_set_path\");\n const bashScript = [\n initScriptVersionString,\n \"tempkubeconfig=\\\"$KUBECONFIG\\\"\",\n \"test -f \\\"/etc/profile\\\" && . \\\"/etc/profile\\\"\",\n \"if test -f \\\"$HOME/.bash_profile\\\"; then\",\n \" . \\\"$HOME/.bash_profile\\\"\",\n \"elif test -f \\\"$HOME/.bash_login\\\"; then\",\n \" . \\\"$HOME/.bash_login\\\"\",\n \"elif test -f \\\"$HOME/.profile\\\"; then\",\n \" . \\\"$HOME/.profile\\\"\",\n \"fi\",\n `export PATH=\"${helmPath}:${kubectlPath}:$PATH\"`,\n 'export KUBECONFIG=\"$tempkubeconfig\"',\n `NO_PROXY=\",\\${NO_PROXY:-localhost},\"`,\n `NO_PROXY=\"\\${NO_PROXY//,localhost,/,}\"`,\n `NO_PROXY=\"\\${NO_PROXY//,127.0.0.1,/,}\"`,\n `NO_PROXY=\"localhost,127.0.0.1\\${NO_PROXY%,}\"`,\n \"export NO_PROXY\",\n \"unset tempkubeconfig\",\n ].join(\"\\n\");\n const zshScriptPath = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(this.dirname, \".zlogin\");\n const zshScript = [\n initScriptVersionString,\n \"tempkubeconfig=\\\"$KUBECONFIG\\\"\",\n // restore previous ZDOTDIR\n \"export ZDOTDIR=\\\"$OLD_ZDOTDIR\\\"\",\n // source all the files\n \"test -f \\\"$OLD_ZDOTDIR/.zshenv\\\" && . \\\"$OLD_ZDOTDIR/.zshenv\\\"\",\n \"test -f \\\"$OLD_ZDOTDIR/.zprofile\\\" && . \\\"$OLD_ZDOTDIR/.zprofile\\\"\",\n \"test -f \\\"$OLD_ZDOTDIR/.zlogin\\\" && . \\\"$OLD_ZDOTDIR/.zlogin\\\"\",\n \"test -f \\\"$OLD_ZDOTDIR/.zshrc\\\" && . \\\"$OLD_ZDOTDIR/.zshrc\\\"\",\n // voodoo to replace any previous occurrences of kubectl path in the PATH\n `kubectlpath=\"${kubectlPath}\"`,\n `helmpath=\"${helmPath}\"`,\n \"p=\\\":$kubectlpath:\\\"\",\n \"d=\\\":$PATH:\\\"\",\n `d=\\${d//$p/:}`,\n `d=\\${d/#:/}`,\n `export PATH=\"$helmpath:$kubectlpath:\\${d/%:/}\"`,\n \"export KUBECONFIG=\\\"$tempkubeconfig\\\"\",\n `NO_PROXY=\",\\${NO_PROXY:-localhost},\"`,\n `NO_PROXY=\"\\${NO_PROXY//,localhost,/,}\"`,\n `NO_PROXY=\"\\${NO_PROXY//,127.0.0.1,/,}\"`,\n `NO_PROXY=\"localhost,127.0.0.1\\${NO_PROXY%,}\"`,\n \"export NO_PROXY\",\n \"unset tempkubeconfig\",\n \"unset OLD_ZDOTDIR\",\n ].join(\"\\n\");\n await Promise.all([\n fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.writeFile(bashScriptPath, bashScript, { mode: 0o644 }),\n fs__WEBPACK_IMPORTED_MODULE_1___default.a.promises.writeFile(zshScriptPath, zshScript, { mode: 0o644 }),\n ]);\n }\n getDownloadMirror() {\n // MacOS packages are only available from default\n var _a;\n const { url } = (_a = _common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_11__[\"packageMirrors\"].get(_common_user_store__WEBPACK_IMPORTED_MODULE_7__[\"UserStore\"].getInstance().downloadMirror)) !== null && _a !== void 0 ? _a : _common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_11__[\"packageMirrors\"].get(_common_user_store_preferences_helpers__WEBPACK_IMPORTED_MODULE_11__[\"defaultPackageMirror\"]);\n return url;\n }\n}\nObject.defineProperty(Kubectl, \"bundledKubectlVersion\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: bundledVersion\n});\nObject.defineProperty(Kubectl, \"invalidBundle\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n});\n\n\n//# sourceURL=webpack:///./src/main/kubectl.ts?");
|
|
40924
40890
|
|
|
40925
40891
|
/***/ }),
|
|
40926
40892
|
|
|
@@ -40980,7 +40946,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
40980
40946
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
40981
40947
|
|
|
40982
40948
|
"use strict";
|
|
40983
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ResourceApplier\", function() { return ResourceApplier; });\n/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! child_process */ \"child_process\");\n/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var js_yaml__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! js-yaml */ \"./node_modules/js-yaml/dist/js-yaml.mjs\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var tempy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tempy */ \"./node_modules/tempy/index.js\");\n/* harmony import */ var tempy__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(tempy__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_event_bus__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/event-bus */ \"./src/common/event-bus.ts\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/utils/promise-exec */ \"./src/common/utils/promise-exec.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\n\n\nclass ResourceApplier {\n constructor(cluster) {\n Object.defineProperty(this, \"cluster\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: cluster\n });\n }\n /**\n * Patch a kube resource's manifest, throwing any error that occurs.\n * @param name The name of the kube resource\n * @param kind The kind of the kube resource\n * @param patch The list of JSON operations\n * @param ns The optional namespace of the kube resource\n */\n async patch(name, kind, patch, ns) {\n var _a;\n _common_event_bus__WEBPACK_IMPORTED_MODULE_6__[\"appEventBus\"].emit({ name: \"resource\", action: \"patch\" });\n const kubectl = await this.cluster.ensureKubectl();\n const kubectlPath = await kubectl.getPath();\n const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath();\n const args = [\n \"--kubeconfig\", proxyKubeconfigPath,\n \"patch\",\n kind,\n name,\n ];\n if (ns) {\n args.push(\"--namespace\", ns);\n }\n args.push(\"--type\", \"json\", \"--patch\", JSON.stringify(patch), \"-o\", \"json\");\n try {\n const { stdout } = await Object(_common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_8__[\"promiseExecFile\"])(kubectlPath, args);\n return stdout;\n }\n catch (error) {\n throw (_a = error.stderr) !== null && _a !== void 0 ? _a : error;\n }\n }\n async apply(resource) {\n resource = this.sanitizeObject(resource);\n _common_event_bus__WEBPACK_IMPORTED_MODULE_6__[\"appEventBus\"].emit({ name: \"resource\", action: \"apply\" });\n return this.kubectlApply(js_yaml__WEBPACK_IMPORTED_MODULE_2__[\"dump\"](resource));\n }\n async kubectlApply(content) {\n var _a, _b;\n const kubectl = await this.cluster.ensureKubectl();\n const kubectlPath = await kubectl.getPath();\n const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath();\n const fileName =
|
|
40949
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ResourceApplier\", function() { return ResourceApplier; });\n/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! child_process */ \"child_process\");\n/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var js_yaml__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! js-yaml */ \"./node_modules/js-yaml/dist/js-yaml.mjs\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var tempy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tempy */ \"./node_modules/tempy/index.js\");\n/* harmony import */ var tempy__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(tempy__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_event_bus__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/event-bus */ \"./src/common/event-bus.ts\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var _common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/utils/promise-exec */ \"./src/common/utils/promise-exec.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\n\n\n\n\n\n\nclass ResourceApplier {\n constructor(cluster) {\n Object.defineProperty(this, \"cluster\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: cluster\n });\n }\n /**\n * Patch a kube resource's manifest, throwing any error that occurs.\n * @param name The name of the kube resource\n * @param kind The kind of the kube resource\n * @param patch The list of JSON operations\n * @param ns The optional namespace of the kube resource\n */\n async patch(name, kind, patch, ns) {\n var _a;\n _common_event_bus__WEBPACK_IMPORTED_MODULE_6__[\"appEventBus\"].emit({ name: \"resource\", action: \"patch\" });\n const kubectl = await this.cluster.ensureKubectl();\n const kubectlPath = await kubectl.getPath();\n const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath();\n const args = [\n \"--kubeconfig\", proxyKubeconfigPath,\n \"patch\",\n kind,\n name,\n ];\n if (ns) {\n args.push(\"--namespace\", ns);\n }\n args.push(\"--type\", \"json\", \"--patch\", JSON.stringify(patch), \"-o\", \"json\");\n try {\n const { stdout } = await Object(_common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_8__[\"promiseExecFile\"])(kubectlPath, args);\n return stdout;\n }\n catch (error) {\n throw (_a = error.stderr) !== null && _a !== void 0 ? _a : error;\n }\n }\n async apply(resource) {\n resource = this.sanitizeObject(resource);\n _common_event_bus__WEBPACK_IMPORTED_MODULE_6__[\"appEventBus\"].emit({ name: \"resource\", action: \"apply\" });\n return this.kubectlApply(js_yaml__WEBPACK_IMPORTED_MODULE_2__[\"dump\"](resource));\n }\n async kubectlApply(content) {\n var _a, _b;\n const kubectl = await this.cluster.ensureKubectl();\n const kubectlPath = await kubectl.getPath();\n const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath();\n const fileName = tempy__WEBPACK_IMPORTED_MODULE_4___default.a.file({ name: \"resource.yaml\" });\n const args = [\n \"apply\",\n \"--kubeconfig\", proxyKubeconfigPath,\n \"-o\", \"json\",\n \"-f\", fileName,\n ];\n _logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].debug(`shooting manifests with ${kubectlPath}`, { args });\n const execEnv = Object.assign({}, process.env);\n const httpsProxy = (_a = this.cluster.preferences) === null || _a === void 0 ? void 0 : _a.httpsProxy;\n if (httpsProxy) {\n execEnv.HTTPS_PROXY = httpsProxy;\n }\n try {\n await fs_extra__WEBPACK_IMPORTED_MODULE_1___default.a.writeFile(fileName, content);\n const { stdout } = await Object(_common_utils_promise_exec__WEBPACK_IMPORTED_MODULE_8__[\"promiseExecFile\"])(kubectlPath, args);\n return stdout;\n }\n catch (error) {\n throw (_b = error === null || error === void 0 ? void 0 : error.stderr) !== null && _b !== void 0 ? _b : error;\n }\n finally {\n await fs_extra__WEBPACK_IMPORTED_MODULE_1___default.a.unlink(fileName);\n }\n }\n async kubectlApplyAll(resources, extraArgs = [\"-o\", \"json\"]) {\n return this.kubectlCmdAll(\"apply\", resources, extraArgs);\n }\n async kubectlDeleteAll(resources, extraArgs) {\n return this.kubectlCmdAll(\"delete\", resources, extraArgs);\n }\n async kubectlCmdAll(subCmd, resources, args = []) {\n const kubectl = await this.cluster.ensureKubectl();\n const kubectlPath = await kubectl.getPath();\n const proxyKubeconfigPath = await this.cluster.getProxyKubeconfigPath();\n return new Promise((resolve, reject) => {\n const tmpDir = tempy__WEBPACK_IMPORTED_MODULE_4___default.a.directory();\n // Dump each resource into tmpDir\n resources.forEach((resource, index) => {\n fs_extra__WEBPACK_IMPORTED_MODULE_1___default.a.writeFileSync(path__WEBPACK_IMPORTED_MODULE_3___default.a.join(tmpDir, `${index}.yaml`), resource);\n });\n args.push(\"-f\", `\"${tmpDir}\"`);\n const cmd = `\"${kubectlPath}\" ${subCmd} --kubeconfig \"${proxyKubeconfigPath}\" ${args.join(\" \")}`;\n _logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].info(`[RESOURCE-APPLIER] running cmd ${cmd}`);\n Object(child_process__WEBPACK_IMPORTED_MODULE_0__[\"exec\"])(cmd, (error, stdout) => {\n if (error) {\n _logger__WEBPACK_IMPORTED_MODULE_5__[\"default\"].error(`[RESOURCE-APPLIER] cmd errored: ${error}`);\n const splitError = error.toString().split(`.yaml\": `);\n if (splitError[1]) {\n reject(splitError[1]);\n }\n else {\n reject(error);\n }\n return;\n }\n resolve(stdout);\n });\n });\n }\n sanitizeObject(resource) {\n var _a, _b;\n resource = Object(_common_utils__WEBPACK_IMPORTED_MODULE_7__[\"cloneJsonObject\"])(resource);\n delete resource.status;\n (_a = resource.metadata) === null || _a === void 0 ? true : delete _a.resourceVersion;\n const annotations = (_b = resource.metadata) === null || _b === void 0 ? void 0 : _b.annotations;\n if (annotations) {\n delete annotations[\"kubectl.kubernetes.io/last-applied-configuration\"];\n }\n return resource;\n }\n}\n\n\n//# sourceURL=webpack:///./src/main/resource-applier.ts?");
|
|
40984
40950
|
|
|
40985
40951
|
/***/ }),
|
|
40986
40952
|
|
|
@@ -41028,7 +40994,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
41028
40994
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41029
40995
|
|
|
41030
40996
|
"use strict";
|
|
41031
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n/**\n * Early store format had the kubeconfig directly under context name, this moves\n * it under the kubeConfig key\n */\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n version: \"2.0.0-beta.2\",\n run(store) {\n for (const value of store) {\n const contextName = value[0];\n // Looping all the keys gives out the store internal stuff too...\n if (contextName === \"__internal__\" || value[1]
|
|
40997
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n/**\n * Early store format had the kubeconfig directly under context name, this moves\n * it under the kubeConfig key\n */\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n version: \"2.0.0-beta.2\",\n run(store) {\n for (const value of store) {\n const contextName = value[0];\n // Looping all the keys gives out the store internal stuff too...\n if (contextName === \"__internal__\" || Object.prototype.hasOwnProperty.call(value[1], \"kubeConfig\"))\n continue;\n store.set(contextName, { kubeConfig: value[1] });\n }\n },\n});\n\n\n//# sourceURL=webpack:///./src/migrations/cluster-store/2.0.0-beta.2.ts?");
|
|
41032
40998
|
|
|
41033
40999
|
/***/ }),
|
|
41034
41000
|
|
|
@@ -41064,7 +41030,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/**\n * Copyright (c) 2021 Op
|
|
|
41064
41030
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41065
41031
|
|
|
41066
41032
|
"use strict";
|
|
41067
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var js_yaml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-yaml */ \"./node_modules/js-yaml/dist/js-yaml.mjs\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ \"./src/migrations/helpers.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n version: \"2.6.0-beta.3\",\n run(store) {\n for (const value of store) {\n const clusterKey = value[0];\n if (clusterKey === \"__internal__\")\n continue;\n const cluster = value[1];\n if (!cluster.kubeConfig)\n continue;\n const config = js_yaml__WEBPACK_IMPORTED_MODULE_0__[\"default\"].load(cluster.kubeConfig);\n if (!config || typeof config !== \"object\" || !
|
|
41033
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var js_yaml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-yaml */ \"./node_modules/js-yaml/dist/js-yaml.mjs\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ \"./src/migrations/helpers.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n version: \"2.6.0-beta.3\",\n run(store) {\n for (const value of store) {\n const clusterKey = value[0];\n if (clusterKey === \"__internal__\")\n continue;\n const cluster = value[1];\n if (!cluster.kubeConfig)\n continue;\n const config = js_yaml__WEBPACK_IMPORTED_MODULE_0__[\"default\"].load(cluster.kubeConfig);\n if (!config || typeof config !== \"object\" || !Object.prototype.hasOwnProperty.call(config, \"users\")) {\n continue;\n }\n const kubeConfig = config;\n const userObj = kubeConfig.users[0];\n if (userObj) {\n const user = userObj.user;\n if (user[\"auth-provider\"] && user[\"auth-provider\"].config) {\n const authConfig = user[\"auth-provider\"].config;\n if (authConfig[\"access-token\"]) {\n authConfig[\"access-token\"] = `${authConfig[\"access-token\"]}`;\n }\n if (authConfig.expiry) {\n authConfig.expiry = `${authConfig.expiry}`;\n }\n Object(_helpers__WEBPACK_IMPORTED_MODULE_1__[\"migrationLog\"])(authConfig);\n user[\"auth-provider\"].config = authConfig;\n kubeConfig.users = [{\n name: userObj.name,\n user,\n }];\n cluster.kubeConfig = js_yaml__WEBPACK_IMPORTED_MODULE_0__[\"default\"].dump(kubeConfig);\n store.set(clusterKey, cluster);\n }\n }\n }\n },\n});\n\n\n//# sourceURL=webpack:///./src/migrations/cluster-store/2.6.0-beta.3.ts?");
|
|
41068
41034
|
|
|
41069
41035
|
/***/ }),
|
|
41070
41036
|
|
|
@@ -41276,23 +41242,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _com
|
|
|
41276
41242
|
/*!*****************************************************!*\
|
|
41277
41243
|
!*** ./src/renderer/api/catalog-entity-registry.ts ***!
|
|
41278
41244
|
\*****************************************************/
|
|
41279
|
-
/*! exports provided: CatalogEntityRegistry, catalogEntityRegistry, getActiveClusterEntity */
|
|
41280
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41281
|
-
|
|
41282
|
-
"use strict";
|
|
41283
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CatalogEntityRegistry\", function() { return CatalogEntityRegistry; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"catalogEntityRegistry\", function() { return catalogEntityRegistry; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getActiveClusterEntity\", function() { return getActiveClusterEntity; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _common_ipc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/ipc */ \"./src/common/ipc/index.ts\");\n/* harmony import */ var _common_catalog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/catalog */ \"./src/common/catalog/index.ts\");\n/* harmony import */ var _common_catalog_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../common/catalog-entities */ \"./src/common/catalog-entities/index.ts\");\n/* harmony import */ var _common_cluster_store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../common/cluster-store */ \"./src/common/cluster-store.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _common_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../common/logger */ \"./src/common/logger.ts\");\n/* harmony import */ var _catalog_entity__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./catalog-entity */ \"./src/renderer/api/catalog-entity.ts\");\n/* harmony import */ var _common_catalog_catalog_run_event__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../common/catalog/catalog-run-event */ \"./src/common/catalog/catalog-run-event.ts\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var _common_ipc_catalog__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../common/ipc/catalog */ \"./src/common/ipc/catalog.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\n\nclass CatalogEntityRegistry {\n constructor(categoryRegistry) {\n Object.defineProperty(this, \"categoryRegistry\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: categoryRegistry\n });\n Object.defineProperty(this, \"activeEntityId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n Object.defineProperty(this, \"_entities\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].map([], { deep: true })\n });\n Object.defineProperty(this, \"filters\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].set([], {\n deep: false,\n })\n });\n Object.defineProperty(this, \"onBeforeRunHooks\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].set([], {\n deep: false,\n })\n });\n /**\n * Buffer for keeping entities that don't yet have CatalogCategory synced\n */\n Object.defineProperty(this, \"rawEntities\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n }\n get activeEntity() {\n return this._entities.get(this.activeEntityId) || null;\n }\n set activeEntity(raw) {\n if (raw) {\n const id = typeof raw === \"string\"\n ? raw\n : raw.getId();\n this.activeEntityId = id;\n }\n else {\n this.activeEntityId = undefined;\n }\n }\n init() {\n Object(_common_ipc__WEBPACK_IMPORTED_MODULE_1__[\"ipcRendererOn\"])(_common_ipc_catalog__WEBPACK_IMPORTED_MODULE_11__[\"CatalogIpcEvents\"].ITEMS, (event, items) => {\n this.updateItems(items);\n });\n // Make sure that we get items ASAP and not the next time one of them changes\n electron__WEBPACK_IMPORTED_MODULE_10__[\"ipcRenderer\"].send(_common_ipc_catalog__WEBPACK_IMPORTED_MODULE_11__[\"CatalogIpcEvents\"].INIT);\n }\n updateItems(items) {\n this.rawEntities.length = 0;\n const newIds = new Set(items.map((item) => item.metadata.uid));\n for (const uid of this._entities.keys()) {\n if (!newIds.has(uid)) {\n this._entities.delete(uid);\n }\n }\n for (const item of items) {\n this.updateItem(item);\n }\n }\n updateItem(item) {\n const existing = this._entities.get(item.metadata.uid);\n if (!existing) {\n const entity = this.categoryRegistry.getEntityForData(item);\n if (entity) {\n this._entities.set(entity.metadata.uid, entity);\n }\n else {\n this.rawEntities.push(item);\n }\n }\n else {\n existing.metadata = item.metadata;\n existing.spec = item.spec;\n existing.status = item.status;\n }\n }\n processRawEntities() {\n const items = [...this.rawEntities];\n this.rawEntities.length = 0;\n for (const item of items) {\n this.updateItem(item);\n }\n }\n get items() {\n this.processRawEntities();\n return Array.from(this._entities.values());\n }\n get filteredItems() {\n return Array.from(_utils__WEBPACK_IMPORTED_MODULE_5__[\"iter\"].reduce(this.filters, _utils__WEBPACK_IMPORTED_MODULE_5__[\"iter\"].filter, this.items.values()));\n }\n get entities() {\n return new Map(this.items.map(entity => [entity.getId(), entity]));\n }\n get filteredEntities() {\n return new Map(this.filteredItems.map(entity => [entity.getId(), entity]));\n }\n getById(id) {\n return this.entities.get(id);\n }\n getItemsForApiKind(apiVersion, kind, { filtered = false } = {}) {\n const byApiKind = (item) => item.apiVersion === apiVersion && item.kind === kind;\n const entities = filtered ? this.filteredItems : this.items;\n return entities.filter(byApiKind);\n }\n getItemsForCategory(category, { filtered = false } = {}) {\n const supportedVersions = new Set(category.spec.versions.map((v) => `${category.spec.group}/${v.name}`));\n const byApiVersionKind = (item) => supportedVersions.has(item.apiVersion) && item.kind === category.spec.names.kind;\n const entities = filtered ? this.filteredItems : this.items;\n return entities.filter(byApiVersionKind);\n }\n /**\n * Add a new filter to the set of item filters\n * @param fn The function that should return a truthy value if that entity should be sent currently \"active\"\n * @returns A function to remove that filter\n */\n addCatalogFilter(fn) {\n this.filters.add(fn);\n return Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"once\"])(() => void this.filters.delete(fn));\n }\n /**\n * Add a onBeforeRun hook. If `onBeforeRun` was previously added then it will not be added again\n * @param onBeforeRun The function that should return a boolean if the onRun of catalog entity should be triggered.\n * @returns A function to remove that hook\n */\n addOnBeforeRun(onBeforeRun) {\n this.onBeforeRunHooks.add(onBeforeRun);\n return Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"once\"])(() => void this.onBeforeRunHooks.delete(onBeforeRun));\n }\n /**\n * Runs all the registered `onBeforeRun` hooks, short circuiting on the first event that's preventDefaulted\n * @param entity The entity to run the hooks on\n * @returns Whether the entities `onRun` method should be executed\n */\n async onBeforeRun(entity) {\n _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].debug(`[CATALOG-ENTITY-REGISTRY]: run onBeforeRun on ${entity.getId()}`);\n const runEvent = new _common_catalog_catalog_run_event__WEBPACK_IMPORTED_MODULE_9__[\"CatalogRunEvent\"]({ target: entity });\n for (const onBeforeRun of this.onBeforeRunHooks) {\n try {\n await onBeforeRun(runEvent);\n }\n catch (error) {\n _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].warn(`[CATALOG-ENTITY-REGISTRY]: entity ${entity.getId()} onBeforeRun threw an error`, error);\n }\n if (runEvent.defaultPrevented) {\n return false;\n }\n }\n return true;\n }\n /**\n * Perform the onBeforeRun check and, if successful, then proceed to call `entity`'s onRun method\n * @param entity The instance to invoke the hooks and then execute the onRun\n */\n onRun(entity) {\n this.onBeforeRun(entity)\n .then(doOnRun => {\n var _a;\n if (doOnRun) {\n return (_a = entity.onRun) === null || _a === void 0 ? void 0 : _a.call(entity, _catalog_entity__WEBPACK_IMPORTED_MODULE_8__[\"catalogEntityRunContext\"]);\n }\n else {\n _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].debug(`onBeforeRun for ${entity.getId()} returned false`);\n }\n })\n .catch(error => _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].error(`[CATALOG-ENTITY-REGISTRY]: entity ${entity.getId()} onRun threw an error`, error));\n }\n}\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", String)\n], CatalogEntityRegistry.prototype, \"activeEntityId\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Array]),\n __metadata(\"design:returntype\", void 0)\n], CatalogEntityRegistry.prototype, \"updateItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], CatalogEntityRegistry.prototype, \"updateItem\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"items\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"filteredItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Map),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"entities\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Map),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"filteredEntities\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Function]),\n __metadata(\"design:returntype\", Function)\n], CatalogEntityRegistry.prototype, \"addCatalogFilter\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Function]),\n __metadata(\"design:returntype\", Function)\n], CatalogEntityRegistry.prototype, \"addOnBeforeRun\", null);\nconst catalogEntityRegistry = new CatalogEntityRegistry(_common_catalog__WEBPACK_IMPORTED_MODULE_2__[\"catalogCategoryRegistry\"]);\nfunction getActiveClusterEntity() {\n var _a;\n return _common_cluster_store__WEBPACK_IMPORTED_MODULE_4__[\"ClusterStore\"].getInstance().getById((_a = catalogEntityRegistry.activeEntity) === null || _a === void 0 ? void 0 : _a.getId());\n}\n\n\n//# sourceURL=webpack:///./src/renderer/api/catalog-entity-registry.ts?");
|
|
41284
|
-
|
|
41285
|
-
/***/ }),
|
|
41286
|
-
|
|
41287
|
-
/***/ "./src/renderer/api/catalog-entity.ts":
|
|
41288
|
-
/*!********************************************!*\
|
|
41289
|
-
!*** ./src/renderer/api/catalog-entity.ts ***!
|
|
41290
|
-
\********************************************/
|
|
41291
|
-
/*! exports provided: CatalogCategory, CatalogEntity, catalogEntityRunContext */
|
|
41245
|
+
/*! exports provided: catalogEntityRunContext, CatalogEntityRegistry, catalogEntityRegistry, getActiveClusterEntity */
|
|
41292
41246
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41293
41247
|
|
|
41294
41248
|
"use strict";
|
|
41295
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"catalogEntityRunContext\", function() { return catalogEntityRunContext; });\n/* harmony import */ var _navigation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../navigation */ \"./src/renderer/navigation/index.ts\");\n/* harmony import */ var _catalog_entity_registry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./catalog-entity-registry */ \"./src/renderer/api/catalog-entity-registry.ts\");\n/* harmony import */ var _common_catalog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/catalog */ \"./src/common/catalog/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CatalogCategory\", function() { return _common_catalog__WEBPACK_IMPORTED_MODULE_2__[\"CatalogCategory\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CatalogEntity\", function() { return _common_catalog__WEBPACK_IMPORTED_MODULE_2__[\"CatalogEntity\"]; });\n\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\n\nconst catalogEntityRunContext = {\n navigate: (url) => Object(_navigation__WEBPACK_IMPORTED_MODULE_0__[\"navigate\"])(url),\n setCommandPaletteContext: (entity) => {\n _catalog_entity_registry__WEBPACK_IMPORTED_MODULE_1__[\"catalogEntityRegistry\"].activeEntity = entity;\n },\n};\n\n\n//# sourceURL=webpack:///./src/renderer/api/catalog-entity.ts?");
|
|
41249
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"catalogEntityRunContext\", function() { return catalogEntityRunContext; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CatalogEntityRegistry\", function() { return CatalogEntityRegistry; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"catalogEntityRegistry\", function() { return catalogEntityRegistry; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getActiveClusterEntity\", function() { return getActiveClusterEntity; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _common_ipc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/ipc */ \"./src/common/ipc/index.ts\");\n/* harmony import */ var _common_catalog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/catalog */ \"./src/common/catalog/index.ts\");\n/* harmony import */ var _common_catalog_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../common/catalog-entities */ \"./src/common/catalog-entities/index.ts\");\n/* harmony import */ var _common_cluster_store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../common/cluster-store */ \"./src/common/cluster-store.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _common_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../common/logger */ \"./src/common/logger.ts\");\n/* harmony import */ var _common_catalog_catalog_run_event__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../common/catalog/catalog-run-event */ \"./src/common/catalog/catalog-run-event.ts\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _common_ipc_catalog__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../common/ipc/catalog */ \"./src/common/ipc/catalog.ts\");\n/* harmony import */ var _navigation__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../navigation */ \"./src/renderer/navigation/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\n\nconst catalogEntityRunContext = {\n navigate: (url) => Object(_navigation__WEBPACK_IMPORTED_MODULE_11__[\"navigate\"])(url),\n setCommandPaletteContext: (entity) => {\n catalogEntityRegistry.activeEntity = entity;\n },\n};\nclass CatalogEntityRegistry {\n constructor(categoryRegistry) {\n Object.defineProperty(this, \"categoryRegistry\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: categoryRegistry\n });\n Object.defineProperty(this, \"activeEntityId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n Object.defineProperty(this, \"_entities\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].map([], { deep: true })\n });\n Object.defineProperty(this, \"filters\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].set([], {\n deep: false,\n })\n });\n Object.defineProperty(this, \"onBeforeRunHooks\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].set([], {\n deep: false,\n })\n });\n /**\n * Buffer for keeping entities that don't yet have CatalogCategory synced\n */\n Object.defineProperty(this, \"rawEntities\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n }\n get activeEntity() {\n return this._entities.get(this.activeEntityId) || null;\n }\n set activeEntity(raw) {\n if (raw) {\n const id = typeof raw === \"string\"\n ? raw\n : raw.getId();\n this.activeEntityId = id;\n }\n else {\n this.activeEntityId = undefined;\n }\n }\n init() {\n Object(_common_ipc__WEBPACK_IMPORTED_MODULE_1__[\"ipcRendererOn\"])(_common_ipc_catalog__WEBPACK_IMPORTED_MODULE_10__[\"CatalogIpcEvents\"].ITEMS, (event, items) => {\n this.updateItems(items);\n });\n // Make sure that we get items ASAP and not the next time one of them changes\n electron__WEBPACK_IMPORTED_MODULE_9__[\"ipcRenderer\"].send(_common_ipc_catalog__WEBPACK_IMPORTED_MODULE_10__[\"CatalogIpcEvents\"].INIT);\n }\n updateItems(items) {\n this.rawEntities.length = 0;\n const newIds = new Set(items.map((item) => item.metadata.uid));\n for (const uid of this._entities.keys()) {\n if (!newIds.has(uid)) {\n this._entities.delete(uid);\n }\n }\n for (const item of items) {\n this.updateItem(item);\n }\n }\n updateItem(item) {\n const existing = this._entities.get(item.metadata.uid);\n if (!existing) {\n const entity = this.categoryRegistry.getEntityForData(item);\n if (entity) {\n this._entities.set(entity.metadata.uid, entity);\n }\n else {\n this.rawEntities.push(item);\n }\n }\n else {\n existing.metadata = item.metadata;\n existing.spec = item.spec;\n existing.status = item.status;\n }\n }\n processRawEntities() {\n const items = [...this.rawEntities];\n this.rawEntities.length = 0;\n for (const item of items) {\n this.updateItem(item);\n }\n }\n get items() {\n this.processRawEntities();\n return Array.from(this._entities.values());\n }\n get filteredItems() {\n return Array.from(_utils__WEBPACK_IMPORTED_MODULE_5__[\"iter\"].reduce(this.filters, _utils__WEBPACK_IMPORTED_MODULE_5__[\"iter\"].filter, this.items.values()));\n }\n get entities() {\n return new Map(this.items.map(entity => [entity.getId(), entity]));\n }\n get filteredEntities() {\n return new Map(this.filteredItems.map(entity => [entity.getId(), entity]));\n }\n getById(id) {\n return this.entities.get(id);\n }\n getItemsForApiKind(apiVersion, kind, { filtered = false } = {}) {\n const byApiKind = (item) => item.apiVersion === apiVersion && item.kind === kind;\n const entities = filtered ? this.filteredItems : this.items;\n return entities.filter(byApiKind);\n }\n getItemsForCategory(category, { filtered = false } = {}) {\n const supportedVersions = new Set(category.spec.versions.map((v) => `${category.spec.group}/${v.name}`));\n const byApiVersionKind = (item) => supportedVersions.has(item.apiVersion) && item.kind === category.spec.names.kind;\n const entities = filtered ? this.filteredItems : this.items;\n return entities.filter(byApiVersionKind);\n }\n /**\n * Add a new filter to the set of item filters\n * @param fn The function that should return a truthy value if that entity should be sent currently \"active\"\n * @returns A function to remove that filter\n */\n addCatalogFilter(fn) {\n this.filters.add(fn);\n return Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"once\"])(() => void this.filters.delete(fn));\n }\n /**\n * Add a onBeforeRun hook. If `onBeforeRun` was previously added then it will not be added again\n * @param onBeforeRun The function that should return a boolean if the onRun of catalog entity should be triggered.\n * @returns A function to remove that hook\n */\n addOnBeforeRun(onBeforeRun) {\n this.onBeforeRunHooks.add(onBeforeRun);\n return Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"once\"])(() => void this.onBeforeRunHooks.delete(onBeforeRun));\n }\n /**\n * Runs all the registered `onBeforeRun` hooks, short circuiting on the first event that's preventDefaulted\n * @param entity The entity to run the hooks on\n * @returns Whether the entities `onRun` method should be executed\n */\n async onBeforeRun(entity) {\n _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].debug(`[CATALOG-ENTITY-REGISTRY]: run onBeforeRun on ${entity.getId()}`);\n const runEvent = new _common_catalog_catalog_run_event__WEBPACK_IMPORTED_MODULE_8__[\"CatalogRunEvent\"]({ target: entity });\n for (const onBeforeRun of this.onBeforeRunHooks) {\n try {\n await onBeforeRun(runEvent);\n }\n catch (error) {\n _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].warn(`[CATALOG-ENTITY-REGISTRY]: entity ${entity.getId()} onBeforeRun threw an error`, error);\n }\n if (runEvent.defaultPrevented) {\n return false;\n }\n }\n return true;\n }\n /**\n * Perform the onBeforeRun check and, if successful, then proceed to call `entity`'s onRun method\n * @param entity The instance to invoke the hooks and then execute the onRun\n */\n onRun(entity) {\n this.onBeforeRun(entity)\n .then(doOnRun => {\n var _a;\n if (doOnRun) {\n return (_a = entity.onRun) === null || _a === void 0 ? void 0 : _a.call(entity, catalogEntityRunContext);\n }\n else {\n _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].debug(`onBeforeRun for ${entity.getId()} returned false`);\n }\n })\n .catch(error => _common_logger__WEBPACK_IMPORTED_MODULE_7__[\"default\"].error(`[CATALOG-ENTITY-REGISTRY]: entity ${entity.getId()} onRun threw an error`, error));\n }\n}\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", String)\n], CatalogEntityRegistry.prototype, \"activeEntityId\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Array]),\n __metadata(\"design:returntype\", void 0)\n], CatalogEntityRegistry.prototype, \"updateItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], CatalogEntityRegistry.prototype, \"updateItem\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"items\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"filteredItems\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Map),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"entities\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Map),\n __metadata(\"design:paramtypes\", [])\n], CatalogEntityRegistry.prototype, \"filteredEntities\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Function]),\n __metadata(\"design:returntype\", Function)\n], CatalogEntityRegistry.prototype, \"addCatalogFilter\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Function]),\n __metadata(\"design:returntype\", Function)\n], CatalogEntityRegistry.prototype, \"addOnBeforeRun\", null);\nconst catalogEntityRegistry = new CatalogEntityRegistry(_common_catalog__WEBPACK_IMPORTED_MODULE_2__[\"catalogCategoryRegistry\"]);\nfunction getActiveClusterEntity() {\n var _a;\n return _common_cluster_store__WEBPACK_IMPORTED_MODULE_4__[\"ClusterStore\"].getInstance().getById((_a = catalogEntityRegistry.activeEntity) === null || _a === void 0 ? void 0 : _a.getId());\n}\n\n\n//# sourceURL=webpack:///./src/renderer/api/catalog-entity-registry.ts?");
|
|
41296
41250
|
|
|
41297
41251
|
/***/ }),
|
|
41298
41252
|
|
|
@@ -42251,7 +42205,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
42251
42205
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42252
42206
|
|
|
42253
42207
|
"use strict";
|
|
42254
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Icon\", function() { return Icon; });\n/* harmony import */ var _icon_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./icon.scss */ \"./src/renderer/components/icon/icon.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tooltip */ \"./src/renderer/components/tooltip/index.ts\");\n/* harmony import */ var lodash_isNumber__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isNumber */ \"./node_modules/lodash/isNumber.js\");\n/* harmony import */ var lodash_isNumber__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isNumber__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\nlet Icon = class Icon extends react__WEBPACK_IMPORTED_MODULE_1___default.a.PureComponent {\n get isInteractive() {\n const { interactive, onClick, href, link } = this.props;\n return interactive !== null && interactive !== void 0 ? interactive : !!(onClick || href || link);\n }\n onClick(evt) {\n if (this.props.disabled) {\n return;\n }\n if (this.props.onClick) {\n this.props.onClick(evt);\n }\n }\n onKeyDown(evt) {\n switch (evt.nativeEvent.code) {\n case \"Space\":\n case \"Enter\": {\n // eslint-disable-next-line react/no-find-dom-node\n const icon = Object(react_dom__WEBPACK_IMPORTED_MODULE_2__[\"findDOMNode\"])(this);\n setTimeout(() => icon.click());\n evt.preventDefault();\n break;\n }\n }\n if (this.props.onKeyDown) {\n this.props.onKeyDown(evt);\n }\n }\n render() {\n const { isInteractive } = this;\n const _a = this.props, { \n // skip passing props to icon's html element\n className, href, link, material, svg, size, smallest, small, big, disabled, sticker, active, focusable, children, interactive: _interactive, onClick: _onClick, onKeyDown: _onKeyDown } = _a, elemProps = __rest(_a, [\"className\", \"href\", \"link\", \"material\", \"svg\", \"size\", \"smallest\", \"small\", \"big\", \"disabled\", \"sticker\", \"active\", \"focusable\", \"children\", \"interactive\", \"onClick\", \"onKeyDown\"]);\n let iconContent;\n const iconProps = Object.assign({ className: Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"cssNames\"])(\"Icon\", className, { svg, material, interactive: isInteractive, disabled, sticker, active, focusable }, !size ? { smallest, small, big } : {}), onClick: isInteractive ? this.onClick : undefined, onKeyDown: isInteractive ? this.onKeyDown : undefined, tabIndex: isInteractive && focusable && !disabled ? 0 : undefined, style: size ? { \"--size\": size + (lodash_isNumber__WEBPACK_IMPORTED_MODULE_6___default()(size) ? \"px\" : \"\") } : undefined }, elemProps);\n // render as inline svg-icon\n if (typeof svg === \"string\") {\n const svgIconText = svg.includes(\"<svg\") ? svg : __webpack_require__(\"./src/renderer/components/icon sync recursive ./!./!./node_modules/raw-loader/dist/cjs.js!./ ^\\\\.\\\\/.*\\\\.svg$\")(`./${svg}.svg`).default;\n iconContent = react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"icon\", dangerouslySetInnerHTML: { __html: svgIconText } });\n }\n // render as material-icon\n if (typeof material === \"string\") {\n iconContent = react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"icon\", \"data-icon-name\": material }, material);\n }\n // wrap icon's content passed from decorator\n iconProps.children = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n iconContent,\n children));\n // render icon type\n if (link) {\n const { className, children } = iconProps;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"NavLink\"], { className: className, to: link }, children));\n }\n if (href) {\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"a\", Object.assign({}, iconProps, { href: href }));\n }\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"i\", Object.assign({}, iconProps));\n }\n};\nObject.defineProperty(Icon, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n focusable: true,\n }\n});\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_4__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], Icon.prototype, \"onClick\", null);\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_4__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], Icon.prototype, \"onKeyDown\", null);\nIcon = __decorate([\n _tooltip__WEBPACK_IMPORTED_MODULE_5__[\"withTooltip\"]\n], Icon);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/icon/icon.tsx?");
|
|
42208
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Icon\", function() { return Icon; });\n/* harmony import */ var _icon_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./icon.scss */ \"./src/renderer/components/icon/icon.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tooltip */ \"./src/renderer/components/tooltip/index.ts\");\n/* harmony import */ var lodash_isNumber__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isNumber */ \"./node_modules/lodash/isNumber.js\");\n/* harmony import */ var lodash_isNumber__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isNumber__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\nlet Icon = class Icon extends react__WEBPACK_IMPORTED_MODULE_1___default.a.PureComponent {\n get isInteractive() {\n const { interactive, onClick, href, link } = this.props;\n return interactive !== null && interactive !== void 0 ? interactive : !!(onClick || href || link);\n }\n onClick(evt) {\n if (this.props.disabled) {\n return;\n }\n if (this.props.onClick) {\n this.props.onClick(evt);\n }\n }\n onKeyDown(evt) {\n switch (evt.nativeEvent.code) {\n case \"Space\":\n // fallthrough\n case \"Enter\": {\n // eslint-disable-next-line react/no-find-dom-node\n const icon = Object(react_dom__WEBPACK_IMPORTED_MODULE_2__[\"findDOMNode\"])(this);\n setTimeout(() => icon.click());\n evt.preventDefault();\n break;\n }\n }\n if (this.props.onKeyDown) {\n this.props.onKeyDown(evt);\n }\n }\n render() {\n const { isInteractive } = this;\n const _a = this.props, { \n // skip passing props to icon's html element\n className, href, link, material, svg, size, smallest, small, big, disabled, sticker, active, focusable, children, interactive: _interactive, onClick: _onClick, onKeyDown: _onKeyDown } = _a, elemProps = __rest(_a, [\"className\", \"href\", \"link\", \"material\", \"svg\", \"size\", \"smallest\", \"small\", \"big\", \"disabled\", \"sticker\", \"active\", \"focusable\", \"children\", \"interactive\", \"onClick\", \"onKeyDown\"]);\n let iconContent;\n const iconProps = Object.assign({ className: Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"cssNames\"])(\"Icon\", className, { svg, material, interactive: isInteractive, disabled, sticker, active, focusable }, !size ? { smallest, small, big } : {}), onClick: isInteractive ? this.onClick : undefined, onKeyDown: isInteractive ? this.onKeyDown : undefined, tabIndex: isInteractive && focusable && !disabled ? 0 : undefined, style: size ? { \"--size\": size + (lodash_isNumber__WEBPACK_IMPORTED_MODULE_6___default()(size) ? \"px\" : \"\") } : undefined }, elemProps);\n // render as inline svg-icon\n if (typeof svg === \"string\") {\n const svgIconText = svg.includes(\"<svg\") ? svg : __webpack_require__(\"./src/renderer/components/icon sync recursive ./!./!./node_modules/raw-loader/dist/cjs.js!./ ^\\\\.\\\\/.*\\\\.svg$\")(`./${svg}.svg`).default;\n iconContent = react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"icon\", dangerouslySetInnerHTML: { __html: svgIconText } });\n }\n // render as material-icon\n if (typeof material === \"string\") {\n iconContent = react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"icon\", \"data-icon-name\": material }, material);\n }\n // wrap icon's content passed from decorator\n iconProps.children = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n iconContent,\n children));\n // render icon type\n if (link) {\n const { className, children } = iconProps;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"NavLink\"], { className: className, to: link }, children));\n }\n if (href) {\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"a\", Object.assign({}, iconProps, { href: href }));\n }\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"i\", Object.assign({}, iconProps));\n }\n};\nObject.defineProperty(Icon, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n focusable: true,\n }\n});\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_4__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], Icon.prototype, \"onClick\", null);\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_4__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], Icon.prototype, \"onKeyDown\", null);\nIcon = __decorate([\n _tooltip__WEBPACK_IMPORTED_MODULE_5__[\"withTooltip\"]\n], Icon);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/icon/icon.tsx?");
|
|
42255
42209
|
|
|
42256
42210
|
/***/ }),
|
|
42257
42211
|
|
|
@@ -42347,7 +42301,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
42347
42301
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42348
42302
|
|
|
42349
42303
|
"use strict";
|
|
42350
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isRequired\", function() { return isRequired; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isEmail\", function() { return isEmail; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isNumber\", function() { return isNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isUrl\", function() { return isUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isExtensionNameInstallRegex\", function() { return isExtensionNameInstallRegex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isExtensionNameInstall\", function() { return isExtensionNameInstall; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPath\", function() { return isPath; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"minLength\", function() { return minLength; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"maxLength\", function() { return maxLength; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"systemName\", function() { return systemName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"accountId\", function() { return accountId; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"conditionalValidators\", function() { return conditionalValidators; });\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nconst isRequired = {\n condition: ({ required }) => required,\n message: () => `This field is required`,\n validate: value => !!value.trim(),\n};\nconst isEmail = {\n condition: ({ type }) => type === \"email\",\n message: () => `Wrong email format`,\n validate: value => !!value.match(/^(([^<>()
|
|
42304
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isRequired\", function() { return isRequired; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isEmail\", function() { return isEmail; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isNumber\", function() { return isNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isUrl\", function() { return isUrl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isExtensionNameInstallRegex\", function() { return isExtensionNameInstallRegex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isExtensionNameInstall\", function() { return isExtensionNameInstall; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isPath\", function() { return isPath; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"minLength\", function() { return minLength; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"maxLength\", function() { return maxLength; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"systemName\", function() { return systemName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"accountId\", function() { return accountId; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"conditionalValidators\", function() { return conditionalValidators; });\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nconst isRequired = {\n condition: ({ required }) => required,\n message: () => `This field is required`,\n validate: value => !!value.trim(),\n};\nconst isEmail = {\n condition: ({ type }) => type === \"email\",\n message: () => `Wrong email format`,\n validate: value => !!value.match(/^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/),\n};\nconst isNumber = {\n condition: ({ type }) => type === \"number\",\n message: () => `Invalid number`,\n validate: (value, { min, max }) => {\n const numVal = +value;\n return !(isNaN(numVal) ||\n (min != null && numVal < min) ||\n (max != null && numVal > max));\n },\n};\nconst isUrl = {\n condition: ({ type }) => type === \"url\",\n message: () => `Wrong url format`,\n validate: value => {\n try {\n return Boolean(new URL(value));\n }\n catch (err) {\n return false;\n }\n },\n};\nconst isExtensionNameInstallRegex = /^(?<name>(@[-\\w]+\\/)?[-\\w]+)(@(?<version>[a-z0-9-_.]+))?$/gi;\nconst isExtensionNameInstall = {\n condition: ({ type }) => type === \"text\",\n message: () => \"Not an extension name with optional version\",\n validate: value => value.match(isExtensionNameInstallRegex) !== null,\n};\nconst isPath = {\n condition: ({ type }) => type === \"text\",\n message: () => `This field must be a valid path`,\n validate: value => value && fs_extra__WEBPACK_IMPORTED_MODULE_0___default.a.pathExistsSync(value),\n};\nconst minLength = {\n condition: ({ minLength }) => !!minLength,\n message: (value, { minLength }) => `Minimum length is ${minLength}`,\n validate: (value, { minLength }) => value.length >= minLength,\n};\nconst maxLength = {\n condition: ({ maxLength }) => !!maxLength,\n message: (value, { maxLength }) => `Maximum length is ${maxLength}`,\n validate: (value, { maxLength }) => value.length <= maxLength,\n};\nconst systemNameMatcher = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/;\nconst systemName = {\n message: () => `A System Name must be lowercase DNS labels separated by dots. DNS labels are alphanumerics and dashes enclosed by alphanumerics.`,\n validate: value => !!value.match(systemNameMatcher),\n};\nconst accountId = {\n message: () => `Invalid account ID`,\n validate: value => (isEmail.validate(value) || systemName.validate(value)),\n};\nconst conditionalValidators = [\n isRequired, isEmail, isNumber, isUrl, minLength, maxLength,\n];\n\n\n//# sourceURL=webpack:///./src/renderer/components/input/input_validators.ts?");
|
|
42351
42305
|
|
|
42352
42306
|
/***/ }),
|
|
42353
42307
|
|
|
@@ -42515,7 +42469,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
42515
42469
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42516
42470
|
|
|
42517
42471
|
"use strict";
|
|
42518
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeObjectDetails\", function() { return KubeObjectDetails; });\n/* harmony import */ var _kube_object_details_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kube-object-details.scss */ \"./src/renderer/components/kube-object-details/kube-object-details.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _drawer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../drawer */ \"./src/renderer/components/drawer/index.ts\");\n/* harmony import */ var _spinner__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../spinner */ \"./src/renderer/components/spinner/index.ts\");\n/* harmony import */ var _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../common/k8s-api/api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _custom_resources_crd_store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../+custom-resources/crd.store */ \"./src/renderer/components/+custom-resources/crd.store.ts\");\n/* harmony import */ var _kube_object_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../kube-object-menu */ \"./src/renderer/components/kube-object-menu/index.ts\");\n/* harmony import */ var _api_kube_object_detail_registry__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../api/kube-object-detail-registry */ \"./src/renderer/api/kube-object-detail-registry.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _custom_resources__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../+custom-resources */ \"./src/renderer/components/+custom-resources/index.ts\");\n/* harmony import */ var _kube_object_meta__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../kube-object-meta */ \"./src/renderer/components/kube-object-meta/index.ts\");\n/* harmony import */ var _kube_detail_params__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../kube-detail-params */ \"./src/renderer/components/kube-detail-params/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nlet KubeObjectDetails = class KubeObjectDetails extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"isLoading\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"loadingError\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"loader\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => [\n this.path,\n this.object,\n _custom_resources_crd_store__WEBPACK_IMPORTED_MODULE_7__[\"crdStore\"].items.length, // crd stores initialized after loading\n ], async () => {\n this.loadingError = \"\";\n const { path, object } = this;\n if (!object) {\n const store = _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_6__[\"apiManager\"].getStore(path);\n if (store) {\n this.isLoading = true;\n try {\n await store.loadFromPath(path);\n }\n catch (err) {\n this.loadingError = react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n \"Resource loading has failed: \",\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"b\", null, err.toString()));\n }\n finally {\n this.isLoading = false;\n }\n }\n }\n })\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"makeObservable\"])(this);\n }\n get path() {\n return _kube_detail_params__WEBPACK_IMPORTED_MODULE_13__[\"kubeDetailsUrlParam\"].get();\n }\n get object() {\n var _a;\n try {\n return (_a = _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_6__[\"apiManager\"]\n .getStore(this.path)) === null || _a === void 0 ? void 0 : _a.getByPath(this.path);\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_10__[\"default\"].error(`[KUBE-OBJECT-DETAILS]: failed to get store or object: ${error}`, { path: this.path });\n return undefined;\n }\n }\n render() {\n const { object, isLoading, loadingError } = this;\n const isOpen = !!(object || isLoading || loadingError);\n if (!object) {\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_drawer__WEBPACK_IMPORTED_MODULE_4__[\"Drawer\"], { className: \"KubeObjectDetails flex column\", open: isOpen, title: \"\", toolbar: react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_menu__WEBPACK_IMPORTED_MODULE_8__[\"KubeObjectMenu\"], { object: object, toolbar: true }), onClose: _kube_detail_params__WEBPACK_IMPORTED_MODULE_13__[\"hideDetails\"] },\n isLoading && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_spinner__WEBPACK_IMPORTED_MODULE_5__[\"Spinner\"], { center: true }),\n loadingError && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"box center\" }, loadingError)));\n }\n const { kind, getName } = object;\n const title = `${kind}: ${getName()}`;\n const details = _api_kube_object_detail_registry__WEBPACK_IMPORTED_MODULE_9__[\"KubeObjectDetailRegistry\"]\n .getInstance()\n .getItemsForKind(object.kind, object.apiVersion)\n .map((item, index) => (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(item.components.Details, { object: object, key: `object-details-${index}` })));\n if (details.length === 0) {\n const crd = _custom_resources_crd_store__WEBPACK_IMPORTED_MODULE_7__[\"crdStore\"].getByObject(object);\n /**\n * This is a fallback so that if a custom resource object doesn't have\n * any defined details we should try and display at least some details\n */\n if (crd) {\n details.push(react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_custom_resources__WEBPACK_IMPORTED_MODULE_11__[\"CrdResourceDetails\"], { key: object.getId(), object: object, crd: crd }));\n }\n }\n if (details.length === 0) {\n // if we still don't have any details to show, just show the standard object metadata\n details.push(react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_meta__WEBPACK_IMPORTED_MODULE_12__[\"KubeObjectMeta\"], { key: object.getId(), object: object }));\n }\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_drawer__WEBPACK_IMPORTED_MODULE_4__[\"Drawer\"], { className: \"KubeObjectDetails flex column\", open: isOpen, title: title, toolbar: react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_menu__WEBPACK_IMPORTED_MODULE_8__[\"KubeObjectMenu\"], { object: object, toolbar: true }), onClose: _kube_detail_params__WEBPACK_IMPORTED_MODULE_13__[\"hideDetails\"] },\n isLoading && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_spinner__WEBPACK_IMPORTED_MODULE_5__[\"Spinner\"], { center: true }),\n loadingError && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"box center\" }, loadingError),\n details));\n }\n};\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"],\n __metadata(\"design:type\", Object)\n], KubeObjectDetails.prototype, \"isLoading\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"].ref,\n __metadata(\"design:type\", Object)\n], KubeObjectDetails.prototype, \"loadingError\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectDetails.prototype, \"path\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectDetails.prototype, \"object\", null);\n__decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"disposeOnUnmount\"],\n __metadata(\"design:type\", Object)\n], KubeObjectDetails.prototype, \"loader\", void 0);\nKubeObjectDetails = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], KubeObjectDetails);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/kube-object-details/kube-object-details.tsx?");
|
|
42472
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KubeObjectDetails\", function() { return KubeObjectDetails; });\n/* harmony import */ var _kube_object_details_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kube-object-details.scss */ \"./src/renderer/components/kube-object-details/kube-object-details.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _drawer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../drawer */ \"./src/renderer/components/drawer/index.ts\");\n/* harmony import */ var _spinner__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../spinner */ \"./src/renderer/components/spinner/index.ts\");\n/* harmony import */ var _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../common/k8s-api/api-manager */ \"./src/common/k8s-api/api-manager.ts\");\n/* harmony import */ var _custom_resources_crd_store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../+custom-resources/crd.store */ \"./src/renderer/components/+custom-resources/crd.store.ts\");\n/* harmony import */ var _kube_object_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../kube-object-menu */ \"./src/renderer/components/kube-object-menu/index.ts\");\n/* harmony import */ var _api_kube_object_detail_registry__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../api/kube-object-detail-registry */ \"./src/renderer/api/kube-object-detail-registry.ts\");\n/* harmony import */ var _custom_resources__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../+custom-resources */ \"./src/renderer/components/+custom-resources/index.ts\");\n/* harmony import */ var _kube_object_meta__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../kube-object-meta */ \"./src/renderer/components/kube-object-meta/index.ts\");\n/* harmony import */ var _kube_detail_params__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../kube-detail-params */ \"./src/renderer/components/kube-detail-params/index.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\nlet KubeObjectDetails = class KubeObjectDetails extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"isLoading\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"loadingError\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"loader\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => [\n this.path,\n this.object,\n _custom_resources_crd_store__WEBPACK_IMPORTED_MODULE_7__[\"crdStore\"].items.length, // crd stores initialized after loading\n ], async () => {\n this.loadingError = \"\";\n const { path, object } = this;\n if (!object) {\n const store = _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_6__[\"apiManager\"].getStore(path);\n if (store) {\n this.isLoading = true;\n try {\n await store.loadFromPath(path);\n }\n catch (err) {\n this.loadingError = react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n \"Resource loading has failed: \",\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"b\", null, err.toString()));\n }\n finally {\n this.isLoading = false;\n }\n }\n }\n })\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"makeObservable\"])(this);\n }\n get path() {\n return _kube_detail_params__WEBPACK_IMPORTED_MODULE_12__[\"kubeDetailsUrlParam\"].get();\n }\n get object() {\n var _a;\n try {\n return (_a = _common_k8s_api_api_manager__WEBPACK_IMPORTED_MODULE_6__[\"apiManager\"]\n .getStore(this.path)) === null || _a === void 0 ? void 0 : _a.getByPath(this.path);\n }\n catch (error) {\n console.error(`[KUBE-OBJECT-DETAILS]: failed to get store or object: ${error}`, { path: this.path });\n return undefined;\n }\n }\n render() {\n const { object, isLoading, loadingError } = this;\n const isOpen = !!(object || isLoading || loadingError);\n if (!object) {\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_drawer__WEBPACK_IMPORTED_MODULE_4__[\"Drawer\"], { className: \"KubeObjectDetails flex column\", open: isOpen, title: \"\", toolbar: react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_menu__WEBPACK_IMPORTED_MODULE_8__[\"KubeObjectMenu\"], { object: object, toolbar: true }), onClose: _kube_detail_params__WEBPACK_IMPORTED_MODULE_12__[\"hideDetails\"] },\n isLoading && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_spinner__WEBPACK_IMPORTED_MODULE_5__[\"Spinner\"], { center: true }),\n loadingError && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"box center\" }, loadingError)));\n }\n const { kind, getName } = object;\n const title = `${kind}: ${getName()}`;\n const details = _api_kube_object_detail_registry__WEBPACK_IMPORTED_MODULE_9__[\"KubeObjectDetailRegistry\"]\n .getInstance()\n .getItemsForKind(object.kind, object.apiVersion)\n .map((item, index) => (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(item.components.Details, { object: object, key: `object-details-${index}` })));\n if (details.length === 0) {\n const crd = _custom_resources_crd_store__WEBPACK_IMPORTED_MODULE_7__[\"crdStore\"].getByObject(object);\n /**\n * This is a fallback so that if a custom resource object doesn't have\n * any defined details we should try and display at least some details\n */\n if (crd) {\n details.push(react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_custom_resources__WEBPACK_IMPORTED_MODULE_10__[\"CrdResourceDetails\"], { key: object.getId(), object: object, crd: crd }));\n }\n }\n if (details.length === 0) {\n // if we still don't have any details to show, just show the standard object metadata\n details.push(react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_meta__WEBPACK_IMPORTED_MODULE_11__[\"KubeObjectMeta\"], { key: object.getId(), object: object }));\n }\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_drawer__WEBPACK_IMPORTED_MODULE_4__[\"Drawer\"], { className: \"KubeObjectDetails flex column\", open: isOpen, title: title, toolbar: react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_kube_object_menu__WEBPACK_IMPORTED_MODULE_8__[\"KubeObjectMenu\"], { object: object, toolbar: true }), onClose: _kube_detail_params__WEBPACK_IMPORTED_MODULE_12__[\"hideDetails\"] },\n isLoading && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_spinner__WEBPACK_IMPORTED_MODULE_5__[\"Spinner\"], { center: true }),\n loadingError && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { className: \"box center\" }, loadingError),\n details));\n }\n};\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"],\n __metadata(\"design:type\", Object)\n], KubeObjectDetails.prototype, \"isLoading\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"].ref,\n __metadata(\"design:type\", Object)\n], KubeObjectDetails.prototype, \"loadingError\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectDetails.prototype, \"path\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], KubeObjectDetails.prototype, \"object\", null);\n__decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"disposeOnUnmount\"],\n __metadata(\"design:type\", Object)\n], KubeObjectDetails.prototype, \"loader\", void 0);\nKubeObjectDetails = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], KubeObjectDetails);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/kube-object-details/kube-object-details.tsx?");
|
|
42519
42473
|
|
|
42520
42474
|
/***/ }),
|
|
42521
42475
|
|
|
@@ -42607,11 +42561,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _doc
|
|
|
42607
42561
|
/*!******************************************************************************************!*\
|
|
42608
42562
|
!*** ./src/renderer/components/kube-object-menu/dependencies/hide-details.injectable.ts ***!
|
|
42609
42563
|
\******************************************************************************************/
|
|
42610
|
-
/*! exports provided:
|
|
42564
|
+
/*! exports provided: default */
|
|
42611
42565
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42612
42566
|
|
|
42613
42567
|
"use strict";
|
|
42614
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony
|
|
42568
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _kube_detail_params__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../kube-detail-params */ \"./src/renderer/components/kube-detail-params/index.ts\");\n/* harmony import */ var _ogre_tools_injectable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ogre-tools/injectable */ \"./node_modules/@ogre-tools/injectable/build/index.js\");\n/* harmony import */ var _ogre_tools_injectable__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_ogre_tools_injectable__WEBPACK_IMPORTED_MODULE_1__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n\nconst hideDetailsInjectable = Object(_ogre_tools_injectable__WEBPACK_IMPORTED_MODULE_1__[\"getInjectable\"])({\n instantiate: () => _kube_detail_params__WEBPACK_IMPORTED_MODULE_0__[\"hideDetails\"],\n lifecycle: _ogre_tools_injectable__WEBPACK_IMPORTED_MODULE_1__[\"lifecycleEnum\"].singleton,\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = (hideDetailsInjectable);\n\n\n//# sourceURL=webpack:///./src/renderer/components/kube-object-menu/dependencies/hide-details.injectable.ts?");
|
|
42615
42569
|
|
|
42616
42570
|
/***/ }),
|
|
42617
42571
|
|
|
@@ -42995,7 +42949,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
42995
42949
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
42996
42950
|
|
|
42997
42951
|
"use strict";
|
|
42998
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MenuActions\", function() { return MenuActions; });\n/* harmony import */ var _menu_actions_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./menu-actions.scss */ \"./src/renderer/components/menu/menu-actions.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _confirm_dialog__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../confirm-dialog */ \"./src/renderer/components/confirm-dialog/index.ts\");\n/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../icon */ \"./src/renderer/components/icon/index.ts\");\n/* harmony import */ var _menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../menu */ \"./src/renderer/components/menu/index.ts\");\n/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash/uniqueId */ \"./node_modules/lodash/uniqueId.js\");\n/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\");\n/* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(lodash_isString__WEBPACK_IMPORTED_MODULE_9__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n\n\nlet MenuActions = class MenuActions extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8___default()(\"menu_actions_\")\n });\n Object.defineProperty(this, \"isOpen\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: !!this.props.toolbar\n });\n Object.defineProperty(this, \"toggle\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: () => {\n if (this.props.toolbar)\n return;\n this.isOpen = !this.isOpen;\n }\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_2__[\"makeObservable\"])(this);\n }\n remove() {\n const { removeAction } = this.props;\n let { removeConfirmationMessage } = this.props;\n if (typeof removeConfirmationMessage === \"function\") {\n removeConfirmationMessage = removeConfirmationMessage();\n }\n _confirm_dialog__WEBPACK_IMPORTED_MODULE_5__[\"ConfirmDialog\"].open({\n ok: removeAction,\n labelOk: `Remove`,\n message: react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", null, removeConfirmationMessage),\n });\n }\n renderTriggerIcon() {\n if (this.props.toolbar)\n return null;\n const { triggerIcon = \"more_vert\" } = this.props;\n let className;\n if (Object(react__WEBPACK_IMPORTED_MODULE_1__[\"isValidElement\"])(triggerIcon)) {\n className = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"cssNames\"])(triggerIcon.props.className, { active: this.isOpen });\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(triggerIcon, { id: this.id, className });\n }\n const iconProps = Object.assign({ id: this.id, interactive: true, material: lodash_isString__WEBPACK_IMPORTED_MODULE_9___default()(triggerIcon) ? triggerIcon : undefined, active: this.isOpen }, (typeof triggerIcon === \"object\" ? triggerIcon : {}));\n if (this.props.onOpen) {\n iconProps.onClick = this.props.onOpen;\n }\n if (iconProps.tooltip && this.isOpen) {\n delete iconProps.tooltip; // don't show tooltip for icon when menu is open\n }\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_6__[\"Icon\"], Object.assign({}, iconProps)));\n }\n render() {\n const _a = this.props, { className, toolbar, autoCloseOnSelect, children, updateAction, removeAction, triggerIcon, removeConfirmationMessage } = _a, menuProps = __rest(_a, [\"className\", \"toolbar\", \"autoCloseOnSelect\", \"children\", \"updateAction\", \"removeAction\", \"triggerIcon\", \"removeConfirmationMessage\"]);\n const menuClassName = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"cssNames\"])(\"MenuActions flex\", className, {\n toolbar,\n gaps: toolbar, // add spacing for .flex\n });\n const autoClose = !toolbar;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n this.renderTriggerIcon(),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_menu__WEBPACK_IMPORTED_MODULE_7__[\"Menu\"], Object.assign({ htmlFor: this.id, isOpen: this.isOpen, open: this.toggle, close: this.toggle, className: menuClassName, usePortal: autoClose, closeOnScroll: autoClose, closeOnClickItem: autoCloseOnSelect !== null && autoCloseOnSelect !== void 0 ? autoCloseOnSelect : autoClose, closeOnClickOutside: autoClose }, menuProps),\n children,\n updateAction && (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_menu__WEBPACK_IMPORTED_MODULE_7__[\"MenuItem\"], { onClick: updateAction },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_6__[\"Icon\"], { material: \"edit\", interactive: toolbar, tooltip: \"Edit\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"title\" }, \"Edit\"))),\n removeAction && (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_menu__WEBPACK_IMPORTED_MODULE_7__[\"MenuItem\"], { onClick: this.remove, \"data-testid\": \"menu-action-remove\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_6__[\"Icon\"], { material: \"delete\", interactive: toolbar, tooltip: \"Delete\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"title\" }, \"Delete\"))))));\n }\n};\nObject.defineProperty(MenuActions, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n get removeConfirmationMessage() {\n return `Remove item?`;\n },\n }\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_2__[\"observable\"],\n __metadata(\"design:type\", Object)\n], MenuActions.prototype, \"isOpen\", void 0);\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_4__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], MenuActions.prototype, \"remove\", null);\nMenuActions = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_3__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], MenuActions);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/menu/menu-actions.tsx?");
|
|
42952
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MenuActions\", function() { return MenuActions; });\n/* harmony import */ var _menu_actions_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./menu-actions.scss */ \"./src/renderer/components/menu/menu-actions.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _confirm_dialog__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../confirm-dialog */ \"./src/renderer/components/confirm-dialog/index.ts\");\n/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../icon */ \"./src/renderer/components/icon/index.ts\");\n/* harmony import */ var _menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./menu */ \"./src/renderer/components/menu/menu.tsx\");\n/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash/uniqueId */ \"./node_modules/lodash/uniqueId.js\");\n/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\");\n/* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(lodash_isString__WEBPACK_IMPORTED_MODULE_9__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n\n\nlet MenuActions = class MenuActions extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: lodash_uniqueId__WEBPACK_IMPORTED_MODULE_8___default()(\"menu_actions_\")\n });\n Object.defineProperty(this, \"isOpen\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: !!this.props.toolbar\n });\n Object.defineProperty(this, \"toggle\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: () => {\n if (this.props.toolbar)\n return;\n this.isOpen = !this.isOpen;\n }\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_2__[\"makeObservable\"])(this);\n }\n remove() {\n const { removeAction } = this.props;\n let { removeConfirmationMessage } = this.props;\n if (typeof removeConfirmationMessage === \"function\") {\n removeConfirmationMessage = removeConfirmationMessage();\n }\n _confirm_dialog__WEBPACK_IMPORTED_MODULE_5__[\"ConfirmDialog\"].open({\n ok: removeAction,\n labelOk: `Remove`,\n message: react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", null, removeConfirmationMessage),\n });\n }\n renderTriggerIcon() {\n if (this.props.toolbar)\n return null;\n const { triggerIcon = \"more_vert\" } = this.props;\n let className;\n if (Object(react__WEBPACK_IMPORTED_MODULE_1__[\"isValidElement\"])(triggerIcon)) {\n className = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"cssNames\"])(triggerIcon.props.className, { active: this.isOpen });\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(triggerIcon, { id: this.id, className });\n }\n const iconProps = Object.assign({ id: this.id, interactive: true, material: lodash_isString__WEBPACK_IMPORTED_MODULE_9___default()(triggerIcon) ? triggerIcon : undefined, active: this.isOpen }, (typeof triggerIcon === \"object\" ? triggerIcon : {}));\n if (this.props.onOpen) {\n iconProps.onClick = this.props.onOpen;\n }\n if (iconProps.tooltip && this.isOpen) {\n delete iconProps.tooltip; // don't show tooltip for icon when menu is open\n }\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_6__[\"Icon\"], Object.assign({}, iconProps)));\n }\n render() {\n const _a = this.props, { className, toolbar, autoCloseOnSelect, children, updateAction, removeAction, triggerIcon, removeConfirmationMessage } = _a, menuProps = __rest(_a, [\"className\", \"toolbar\", \"autoCloseOnSelect\", \"children\", \"updateAction\", \"removeAction\", \"triggerIcon\", \"removeConfirmationMessage\"]);\n const menuClassName = Object(_utils__WEBPACK_IMPORTED_MODULE_4__[\"cssNames\"])(\"MenuActions flex\", className, {\n toolbar,\n gaps: toolbar, // add spacing for .flex\n });\n const autoClose = !toolbar;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n this.renderTriggerIcon(),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_menu__WEBPACK_IMPORTED_MODULE_7__[\"Menu\"], Object.assign({ htmlFor: this.id, isOpen: this.isOpen, open: this.toggle, close: this.toggle, className: menuClassName, usePortal: autoClose, closeOnScroll: autoClose, closeOnClickItem: autoCloseOnSelect !== null && autoCloseOnSelect !== void 0 ? autoCloseOnSelect : autoClose, closeOnClickOutside: autoClose }, menuProps),\n children,\n updateAction && (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_menu__WEBPACK_IMPORTED_MODULE_7__[\"MenuItem\"], { onClick: updateAction },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_6__[\"Icon\"], { material: \"edit\", interactive: toolbar, tooltip: \"Edit\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"title\" }, \"Edit\"))),\n removeAction && (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_menu__WEBPACK_IMPORTED_MODULE_7__[\"MenuItem\"], { onClick: this.remove, \"data-testid\": \"menu-action-remove\" },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_6__[\"Icon\"], { material: \"delete\", interactive: toolbar, tooltip: \"Delete\" }),\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"span\", { className: \"title\" }, \"Delete\"))))));\n }\n};\nObject.defineProperty(MenuActions, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n get removeConfirmationMessage() {\n return `Remove item?`;\n },\n }\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_2__[\"observable\"],\n __metadata(\"design:type\", Object)\n], MenuActions.prototype, \"isOpen\", void 0);\n__decorate([\n _utils__WEBPACK_IMPORTED_MODULE_4__[\"boundMethod\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], MenuActions.prototype, \"remove\", null);\nMenuActions = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_3__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], MenuActions);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/menu/menu-actions.tsx?");
|
|
42999
42953
|
|
|
43000
42954
|
/***/ }),
|
|
43001
42955
|
|
|
@@ -43019,7 +42973,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
43019
42973
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
43020
42974
|
|
|
43021
42975
|
"use strict";
|
|
43022
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MenuContext\", function() { return MenuContext; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Menu\", function() { return Menu; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubMenu\", function() { return SubMenu; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MenuItem\", function() { return MenuItem; });\n/* harmony import */ var _menu_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./menu.scss */ \"./src/renderer/components/menu/menu.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _animate__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../animate */ \"./src/renderer/components/animate/index.ts\");\n/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../icon */ \"./src/renderer/components/icon/index.ts\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isEqual */ \"./node_modules/lodash/isEqual.js\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\nconst MenuContext = react__WEBPACK_IMPORTED_MODULE_1___default.a.createContext(null);\nconst defaultPropsMenu = {\n position: { right: true, bottom: true },\n autoFocus: false,\n usePortal: false,\n closeOnClickItem: true,\n closeOnClickOutside: true,\n closeOnScroll: false,\n toggleEvent: \"click\",\n};\nclass Menu extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"opener\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"elem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"items\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"refreshPosition\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: () => {\n if (!this.props.usePortal || !this.opener || !this.elem) {\n return;\n }\n const openerClientRect = this.opener.getBoundingClientRect();\n let { left: openerLeft, top: openerTop, bottom: openerBottom, right: openerRight } = this.opener.getBoundingClientRect();\n const withScroll = window.getComputedStyle(this.elem).position !== \"fixed\";\n // window global scroll corrections\n if (withScroll) {\n openerLeft += window.pageXOffset;\n openerTop += window.pageYOffset;\n openerRight = openerLeft + openerClientRect.width;\n openerBottom = openerTop + openerClientRect.height;\n }\n const extraMargin = this.props.usePortal ? 8 : 0;\n const { width: menuWidth, height: menuHeight } = this.elem.getBoundingClientRect();\n const rightSideOfMenu = openerLeft + menuWidth;\n const renderMenuLeft = rightSideOfMenu > window.innerWidth;\n const menuOnLeftSidePosition = `${openerRight - this.elem.offsetWidth}px`;\n const menuOnRightSidePosition = `${openerLeft}px`;\n const bottomOfMenu = openerBottom + extraMargin + menuHeight;\n const renderMenuOnTop = bottomOfMenu > window.innerHeight;\n const menuOnTopPosition = `${openerTop - this.elem.offsetHeight - extraMargin}px`;\n const menuOnBottomPosition = `${openerBottom + extraMargin}px`;\n this.setState({\n position: {\n top: renderMenuOnTop,\n bottom: !renderMenuOnTop,\n left: renderMenuLeft,\n right: !renderMenuLeft,\n },\n menuStyle: {\n top: renderMenuOnTop ? menuOnTopPosition : menuOnBottomPosition,\n left: renderMenuLeft ? menuOnLeftSidePosition : menuOnRightSidePosition,\n },\n });\n }\n });\n Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"autoBind\"])(this);\n }\n get isOpen() {\n return !!this.props.isOpen;\n }\n get isClosed() {\n return !this.isOpen;\n }\n componentDidMount() {\n if (!this.props.usePortal) {\n const parent = this.elem.parentElement;\n const position = window.getComputedStyle(parent).position;\n if (position === \"static\")\n parent.style.position = \"relative\";\n }\n else if (this.isOpen) {\n this.refreshPosition();\n }\n this.opener = document.getElementById(this.props.htmlFor); // might not exist in sub-menus\n if (this.opener) {\n this.opener.addEventListener(this.props.toggleEvent, this.toggle);\n this.opener.addEventListener(\"keydown\", this.onKeyDown);\n }\n this.elem.addEventListener(\"keydown\", this.onKeyDown);\n window.addEventListener(\"resize\", this.onWindowResize);\n window.addEventListener(\"click\", this.onClickOutside, true);\n window.addEventListener(\"scroll\", this.onScrollOutside, true);\n window.addEventListener(\"contextmenu\", this.onContextMenu, true);\n window.addEventListener(\"blur\", this.onBlur, true);\n }\n componentWillUnmount() {\n if (this.opener) {\n this.opener.removeEventListener(this.props.toggleEvent, this.toggle);\n this.opener.removeEventListener(\"keydown\", this.onKeyDown);\n }\n this.elem.removeEventListener(\"keydown\", this.onKeyDown);\n window.removeEventListener(\"resize\", this.onWindowResize);\n window.removeEventListener(\"click\", this.onClickOutside, true);\n window.removeEventListener(\"scroll\", this.onScrollOutside, true);\n }\n componentDidUpdate(prevProps) {\n if (!lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default()(prevProps.children, this.props.children)) {\n this.refreshPosition();\n }\n }\n get focusableItems() {\n return Object.values(this.items).filter(item => item.isFocusable);\n }\n get focusedItem() {\n return this.focusableItems.find(item => item.elem === document.activeElement);\n }\n focusNextItem(reverse = false) {\n const items = this.focusableItems;\n const activeIndex = items.findIndex(item => item === this.focusedItem);\n if (!items.length) {\n return;\n }\n if (activeIndex > -1) {\n let nextItem = reverse ? items[activeIndex - 1] : items[activeIndex + 1];\n if (!nextItem)\n nextItem = items[activeIndex];\n nextItem.elem.focus();\n }\n else {\n items[0].elem.focus();\n }\n }\n open() {\n if (this.isOpen) {\n return;\n }\n this.props.open();\n this.refreshPosition();\n if (this.props.autoFocus) {\n this.focusNextItem();\n }\n }\n close() {\n if (this.isClosed) {\n return;\n }\n this.props.close();\n }\n toggle() {\n if (this.isOpen) {\n this.close();\n }\n else {\n this.open();\n }\n }\n onKeyDown(evt) {\n if (!this.isOpen)\n return;\n switch (evt.code) {\n case \"Escape\":\n this.close();\n break;\n case \"Space\":\n case \"Enter\":\n const focusedItem = this.focusedItem;\n if (focusedItem) {\n focusedItem.elem.click();\n evt.preventDefault();\n }\n break;\n case \"ArrowUp\":\n this.focusNextItem(true);\n break;\n case \"ArrowDown\":\n this.focusNextItem();\n break;\n }\n }\n onContextMenu() {\n this.close();\n }\n onWindowResize() {\n if (!this.isOpen)\n return;\n this.refreshPosition();\n }\n onScrollOutside(evt) {\n if (!this.isOpen)\n return;\n const target = evt.target;\n const { usePortal, closeOnScroll } = this.props;\n if (usePortal && closeOnScroll && !target.contains(this.elem)) {\n this.close();\n }\n }\n onClickOutside(evt) {\n if (!this.props.closeOnClickOutside)\n return;\n if (!this.isOpen || evt.target === document.body)\n return;\n const target = evt.target;\n const clickInsideMenu = this.elem.contains(target);\n const clickOnOpener = this.opener && this.opener.contains(target);\n if (!clickInsideMenu && !clickOnOpener) {\n this.close();\n }\n }\n onBlur() {\n var _a;\n if (!this.isOpen)\n return; // Prevents triggering document.activeElement for each <Menu/> instance\n if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName) == \"IFRAME\") {\n this.close();\n }\n }\n bindRef(elem) {\n this.elem = elem;\n }\n bindItemRef(item, index) {\n this.items[index] = item;\n }\n render() {\n var _a, _b, _c, _d;\n const { position, id } = this.props;\n let { className, usePortal } = this.props;\n className = Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"Menu\", className, this.state.position || position, {\n portal: usePortal,\n });\n let children = this.props.children;\n if (children.type === react__WEBPACK_IMPORTED_MODULE_1__[\"Fragment\"]) {\n children = children.props.children;\n }\n const menuItems = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(children).map((item, index) => {\n if (item.type === MenuItem) {\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(item, {\n ref: (item) => this.bindItemRef(item, index),\n });\n }\n return item;\n });\n const menu = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MenuContext.Provider, { value: this },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_animate__WEBPACK_IMPORTED_MODULE_4__[\"Animate\"], { enter: this.isOpen },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"ul\", { id: id, ref: this.bindRef, className: className, style: {\n left: (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.menuStyle) === null || _b === void 0 ? void 0 : _b.left,\n top: (_d = (_c = this.state) === null || _c === void 0 ? void 0 : _c.menuStyle) === null || _d === void 0 ? void 0 : _d.top,\n } }, menuItems))));\n if (usePortal === true)\n usePortal = document.body;\n return usePortal instanceof HTMLElement ? Object(react_dom__WEBPACK_IMPORTED_MODULE_2__[\"createPortal\"])(menu, usePortal) : menu;\n }\n}\nObject.defineProperty(Menu, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: defaultPropsMenu\n});\nfunction SubMenu(props) {\n const { className } = props, menuProps = __rest(props, [\"className\"]);\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Menu, Object.assign({ className: Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"SubMenu\", className), isOpen: true, open: _utils__WEBPACK_IMPORTED_MODULE_3__[\"noop\"], close: _utils__WEBPACK_IMPORTED_MODULE_3__[\"noop\"], position: {}, closeOnClickOutside: false, closeOnClickItem: false }, menuProps)));\n}\nconst defaultPropsMenuItem = {\n onClick: _utils__WEBPACK_IMPORTED_MODULE_3__[\"noop\"],\n};\nclass MenuItem extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"elem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"autoBind\"])(this);\n }\n get isFocusable() {\n const { disabled, spacer } = this.props;\n return !(disabled || spacer);\n }\n get isLink() {\n return !!this.props.href;\n }\n onClick(evt) {\n const menu = this.context;\n const { spacer, onClick } = this.props;\n if (spacer)\n return;\n onClick(evt);\n if (menu.props.closeOnClickItem && !evt.defaultPrevented) {\n menu.close();\n }\n }\n bindRef(elem) {\n this.elem = elem;\n }\n render() {\n const _a = this.props, { className, disabled, active, spacer, icon, children } = _a, props = __rest(_a, [\"className\", \"disabled\", \"active\", \"spacer\", \"icon\", \"children\"]);\n let iconProps;\n if (icon) {\n iconProps = {};\n if (typeof icon === \"string\")\n iconProps.material = icon;\n else\n Object.assign(iconProps, icon);\n }\n const elemProps = Object.assign(Object.assign({ tabIndex: this.isFocusable ? 0 : -1 }, props), { className: Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"MenuItem\", className, { disabled, active, spacer }), onClick: this.onClick, children: icon ? react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_5__[\"Icon\"], Object.assign({}, iconProps)),\n \" \",\n children) : children, ref: this.bindRef });\n if (this.isLink) {\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"a\", Object.assign({}, elemProps));\n }\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"li\", Object.assign({}, elemProps));\n }\n}\nObject.defineProperty(MenuItem, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: defaultPropsMenuItem\n});\nObject.defineProperty(MenuItem, \"contextType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: MenuContext\n});\n\n\n//# sourceURL=webpack:///./src/renderer/components/menu/menu.tsx?");
|
|
42976
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MenuContext\", function() { return MenuContext; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Menu\", function() { return Menu; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubMenu\", function() { return SubMenu; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MenuItem\", function() { return MenuItem; });\n/* harmony import */ var _menu_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./menu.scss */ \"./src/renderer/components/menu/menu.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _animate__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../animate */ \"./src/renderer/components/animate/index.ts\");\n/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../icon */ \"./src/renderer/components/icon/index.ts\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isEqual */ \"./node_modules/lodash/isEqual.js\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isEqual__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __rest = (undefined && undefined.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\nconst MenuContext = react__WEBPACK_IMPORTED_MODULE_1___default.a.createContext(null);\nconst defaultPropsMenu = {\n position: { right: true, bottom: true },\n autoFocus: false,\n usePortal: false,\n closeOnClickItem: true,\n closeOnClickOutside: true,\n closeOnScroll: false,\n toggleEvent: \"click\",\n};\nclass Menu extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"opener\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"elem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"items\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"refreshPosition\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: () => {\n if (!this.props.usePortal || !this.opener || !this.elem) {\n return;\n }\n const openerClientRect = this.opener.getBoundingClientRect();\n let { left: openerLeft, top: openerTop, bottom: openerBottom, right: openerRight } = this.opener.getBoundingClientRect();\n const withScroll = window.getComputedStyle(this.elem).position !== \"fixed\";\n // window global scroll corrections\n if (withScroll) {\n openerLeft += window.pageXOffset;\n openerTop += window.pageYOffset;\n openerRight = openerLeft + openerClientRect.width;\n openerBottom = openerTop + openerClientRect.height;\n }\n const extraMargin = this.props.usePortal ? 8 : 0;\n const { width: menuWidth, height: menuHeight } = this.elem.getBoundingClientRect();\n const rightSideOfMenu = openerLeft + menuWidth;\n const renderMenuLeft = rightSideOfMenu > window.innerWidth;\n const menuOnLeftSidePosition = `${openerRight - this.elem.offsetWidth}px`;\n const menuOnRightSidePosition = `${openerLeft}px`;\n const bottomOfMenu = openerBottom + extraMargin + menuHeight;\n const renderMenuOnTop = bottomOfMenu > window.innerHeight;\n const menuOnTopPosition = `${openerTop - this.elem.offsetHeight - extraMargin}px`;\n const menuOnBottomPosition = `${openerBottom + extraMargin}px`;\n this.setState({\n position: {\n top: renderMenuOnTop,\n bottom: !renderMenuOnTop,\n left: renderMenuLeft,\n right: !renderMenuLeft,\n },\n menuStyle: {\n top: renderMenuOnTop ? menuOnTopPosition : menuOnBottomPosition,\n left: renderMenuLeft ? menuOnLeftSidePosition : menuOnRightSidePosition,\n },\n });\n }\n });\n Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"autoBind\"])(this);\n }\n get isOpen() {\n return !!this.props.isOpen;\n }\n get isClosed() {\n return !this.isOpen;\n }\n componentDidMount() {\n if (!this.props.usePortal) {\n const parent = this.elem.parentElement;\n const position = window.getComputedStyle(parent).position;\n if (position === \"static\")\n parent.style.position = \"relative\";\n }\n else if (this.isOpen) {\n this.refreshPosition();\n }\n this.opener = document.getElementById(this.props.htmlFor); // might not exist in sub-menus\n if (this.opener) {\n this.opener.addEventListener(this.props.toggleEvent, this.toggle);\n this.opener.addEventListener(\"keydown\", this.onKeyDown);\n }\n this.elem.addEventListener(\"keydown\", this.onKeyDown);\n window.addEventListener(\"resize\", this.onWindowResize);\n window.addEventListener(\"click\", this.onClickOutside, true);\n window.addEventListener(\"scroll\", this.onScrollOutside, true);\n window.addEventListener(\"contextmenu\", this.onContextMenu, true);\n window.addEventListener(\"blur\", this.onBlur, true);\n }\n componentWillUnmount() {\n if (this.opener) {\n this.opener.removeEventListener(this.props.toggleEvent, this.toggle);\n this.opener.removeEventListener(\"keydown\", this.onKeyDown);\n }\n this.elem.removeEventListener(\"keydown\", this.onKeyDown);\n window.removeEventListener(\"resize\", this.onWindowResize);\n window.removeEventListener(\"click\", this.onClickOutside, true);\n window.removeEventListener(\"scroll\", this.onScrollOutside, true);\n }\n componentDidUpdate(prevProps) {\n if (!lodash_isEqual__WEBPACK_IMPORTED_MODULE_6___default()(prevProps.children, this.props.children)) {\n this.refreshPosition();\n }\n }\n get focusableItems() {\n return Object.values(this.items).filter(item => item.isFocusable);\n }\n get focusedItem() {\n return this.focusableItems.find(item => item.elem === document.activeElement);\n }\n focusNextItem(reverse = false) {\n const items = this.focusableItems;\n const activeIndex = items.findIndex(item => item === this.focusedItem);\n if (!items.length) {\n return;\n }\n if (activeIndex > -1) {\n let nextItem = reverse ? items[activeIndex - 1] : items[activeIndex + 1];\n if (!nextItem)\n nextItem = items[activeIndex];\n nextItem.elem.focus();\n }\n else {\n items[0].elem.focus();\n }\n }\n open() {\n if (this.isOpen) {\n return;\n }\n this.props.open();\n this.refreshPosition();\n if (this.props.autoFocus) {\n this.focusNextItem();\n }\n }\n close() {\n if (this.isClosed) {\n return;\n }\n this.props.close();\n }\n toggle() {\n if (this.isOpen) {\n this.close();\n }\n else {\n this.open();\n }\n }\n onKeyDown(evt) {\n if (!this.isOpen)\n return;\n switch (evt.code) {\n case \"Escape\":\n this.close();\n break;\n case \"Space\":\n // fallthrough\n case \"Enter\": {\n const focusedItem = this.focusedItem;\n if (focusedItem) {\n focusedItem.elem.click();\n evt.preventDefault();\n }\n break;\n }\n case \"ArrowUp\":\n this.focusNextItem(true);\n break;\n case \"ArrowDown\":\n this.focusNextItem();\n break;\n }\n }\n onContextMenu() {\n this.close();\n }\n onWindowResize() {\n if (!this.isOpen)\n return;\n this.refreshPosition();\n }\n onScrollOutside(evt) {\n if (!this.isOpen)\n return;\n const target = evt.target;\n const { usePortal, closeOnScroll } = this.props;\n if (usePortal && closeOnScroll && !target.contains(this.elem)) {\n this.close();\n }\n }\n onClickOutside(evt) {\n if (!this.props.closeOnClickOutside)\n return;\n if (!this.isOpen || evt.target === document.body)\n return;\n const target = evt.target;\n const clickInsideMenu = this.elem.contains(target);\n const clickOnOpener = this.opener && this.opener.contains(target);\n if (!clickInsideMenu && !clickOnOpener) {\n this.close();\n }\n }\n onBlur() {\n var _a;\n if (!this.isOpen)\n return; // Prevents triggering document.activeElement for each <Menu/> instance\n if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName) == \"IFRAME\") {\n this.close();\n }\n }\n bindRef(elem) {\n this.elem = elem;\n }\n bindItemRef(item, index) {\n this.items[index] = item;\n }\n render() {\n var _a, _b, _c, _d;\n const { position, id } = this.props;\n let { className, usePortal } = this.props;\n className = Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"Menu\", className, this.state.position || position, {\n portal: usePortal,\n });\n let children = this.props.children;\n if (children.type === react__WEBPACK_IMPORTED_MODULE_1__[\"Fragment\"]) {\n children = children.props.children;\n }\n const menuItems = react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.toArray(children).map((item, index) => {\n if (item.type === MenuItem) {\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(item, {\n ref: (item) => this.bindItemRef(item, index),\n });\n }\n return item;\n });\n const menu = (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MenuContext.Provider, { value: this },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_animate__WEBPACK_IMPORTED_MODULE_4__[\"Animate\"], { enter: this.isOpen },\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"ul\", { id: id, ref: this.bindRef, className: className, style: {\n left: (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.menuStyle) === null || _b === void 0 ? void 0 : _b.left,\n top: (_d = (_c = this.state) === null || _c === void 0 ? void 0 : _c.menuStyle) === null || _d === void 0 ? void 0 : _d.top,\n } }, menuItems))));\n if (usePortal === true)\n usePortal = document.body;\n return usePortal instanceof HTMLElement ? Object(react_dom__WEBPACK_IMPORTED_MODULE_2__[\"createPortal\"])(menu, usePortal) : menu;\n }\n}\nObject.defineProperty(Menu, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: defaultPropsMenu\n});\nfunction SubMenu(props) {\n const { className } = props, menuProps = __rest(props, [\"className\"]);\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Menu, Object.assign({ className: Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"SubMenu\", className), isOpen: true, open: _utils__WEBPACK_IMPORTED_MODULE_3__[\"noop\"], close: _utils__WEBPACK_IMPORTED_MODULE_3__[\"noop\"], position: {}, closeOnClickOutside: false, closeOnClickItem: false }, menuProps)));\n}\nconst defaultPropsMenuItem = {\n onClick: _utils__WEBPACK_IMPORTED_MODULE_3__[\"noop\"],\n};\nclass MenuItem extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"elem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"autoBind\"])(this);\n }\n get isFocusable() {\n const { disabled, spacer } = this.props;\n return !(disabled || spacer);\n }\n get isLink() {\n return !!this.props.href;\n }\n onClick(evt) {\n const menu = this.context;\n const { spacer, onClick } = this.props;\n if (spacer)\n return;\n onClick(evt);\n if (menu.props.closeOnClickItem && !evt.defaultPrevented) {\n menu.close();\n }\n }\n bindRef(elem) {\n this.elem = elem;\n }\n render() {\n const _a = this.props, { className, disabled, active, spacer, icon, children } = _a, props = __rest(_a, [\"className\", \"disabled\", \"active\", \"spacer\", \"icon\", \"children\"]);\n let iconProps;\n if (icon) {\n iconProps = {};\n if (typeof icon === \"string\")\n iconProps.material = icon;\n else\n Object.assign(iconProps, icon);\n }\n const elemProps = Object.assign(Object.assign({ tabIndex: this.isFocusable ? 0 : -1 }, props), { className: Object(_utils__WEBPACK_IMPORTED_MODULE_3__[\"cssNames\"])(\"MenuItem\", className, { disabled, active, spacer }), onClick: this.onClick, children: icon ? react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_icon__WEBPACK_IMPORTED_MODULE_5__[\"Icon\"], Object.assign({}, iconProps)),\n \" \",\n children) : children, ref: this.bindRef });\n if (this.isLink) {\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"a\", Object.assign({}, elemProps));\n }\n return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"li\", Object.assign({}, elemProps));\n }\n}\nObject.defineProperty(MenuItem, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: defaultPropsMenuItem\n});\nObject.defineProperty(MenuItem, \"contextType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: MenuContext\n});\n\n\n//# sourceURL=webpack:///./src/renderer/components/menu/menu.tsx?");
|
|
43023
42977
|
|
|
43024
42978
|
/***/ }),
|
|
43025
42979
|
|
|
@@ -43055,7 +43009,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
43055
43009
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
43056
43010
|
|
|
43057
43011
|
"use strict";
|
|
43058
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultEditorProps\", function() { return defaultEditorProps; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MonacoEditor\", function() { return MonacoEditor; });\n/* harmony import */ var _monaco_editor_module_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./monaco-editor.module.scss */ \"./src/renderer/components/monaco-editor/monaco-editor.module.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var monaco_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! monaco-editor */ \"./node_modules/monaco-editor/esm/vs/editor/editor.main.js\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index */ \"./src/renderer/components/monaco-editor/index.ts\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _common_user_store__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../common/user-store */ \"./src/common/user-store/index.ts\");\n/* harmony import */ var _theme_store__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../theme.store */ \"./src/renderer/theme.store.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar MonacoEditor_1;\n\n\n\n\n\n\n\n\n\n\nconst defaultEditorProps = {\n language: \"yaml\",\n get theme() {\n // theme for monaco-editor defined in `src/renderer/themes/lens-*.json`\n return _theme_store__WEBPACK_IMPORTED_MODULE_9__[\"ThemeStore\"].getInstance().activeTheme.monacoTheme;\n },\n};\nlet MonacoEditor = MonacoEditor_1 = class MonacoEditor extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"staticId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: `editor-id#${Math.round(1e7 * Math.random())}`\n });\n Object.defineProperty(this, \"dispose\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(_utils__WEBPACK_IMPORTED_MODULE_7__[\"disposer\"])()\n });\n // TODO: investigate how to replace with \"common/logger\"\n // currently leads for stucking UI forever & infinite loop.\n // e.g. happens on tab change/create, maybe some other cases too.\n Object.defineProperty(this, \"logger\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: console\n });\n Object.defineProperty(this, \"containerElem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"editor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"dimensions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"unmounting\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"onModelChange\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (model, oldModel) => {\n var _a, _b, _c;\n (_a = this.logger) === null || _a === void 0 ? void 0 : _a.info(\"[MONACO]: model change\", { model, oldModel }, this.logMetadata);\n if (oldModel) {\n this.saveViewState(oldModel);\n }\n this.editor.setModel(model);\n this.restoreViewState(model);\n this.editor.layout();\n this.editor.focus(); // keep focus in editor, e.g. when clicking between dock-tabs\n (_c = (_b = this.props).onModelChange) === null || _c === void 0 ? void 0 : _c.call(_b, model, oldModel);\n this.validateLazy();\n }\n });\n Object.defineProperty(this, \"validate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (value = this.getValue()) => {\n var _a, _b;\n const validators = [\n _index__WEBPACK_IMPORTED_MODULE_5__[\"monacoValidators\"][this.props.language], // parsing syntax check\n ].filter(Boolean);\n for (const validate of validators) {\n try {\n validate(value);\n }\n catch (error) {\n (_b = (_a = this.props).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error); // emit error outside\n }\n }\n }\n });\n // avoid excessive validations during typing\n Object.defineProperty(this, \"validateLazy\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"debounce\"])(this.validate, 250)\n });\n Object.defineProperty(this, \"bindRef\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (elem) => this.containerElem = elem\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"makeObservable\"])(this);\n }\n static createUri(id) {\n return monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"Uri\"].file(`/monaco-editor/${id}`);\n }\n get id() {\n var _a;\n return (_a = this.props.id) !== null && _a !== void 0 ? _a : this.staticId;\n }\n get model() {\n const uri = MonacoEditor_1.createUri(this.id);\n const model = monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].getModel(uri);\n if (model) {\n return model; // already exists\n }\n const { language, value } = this.props;\n return monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].createModel(value, language, uri);\n }\n get options() {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"merge\"])({}, _common_user_store__WEBPACK_IMPORTED_MODULE_8__[\"UserStore\"].getInstance().editorConfiguration, this.props.options);\n }\n get logMetadata() {\n return {\n editorId: this.id,\n model: this.model,\n };\n }\n /**\n * Monitor editor's dom container element box-size and sync with monaco's dimensions\n * @private\n */\n bindResizeObserver() {\n const resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n this.setDimensions(width, height);\n }\n });\n const containerElem = this.editor.getContainerDomNode();\n resizeObserver.observe(containerElem);\n return () => resizeObserver.unobserve(containerElem);\n }\n /**\n * Save current view-model state in the editor.\n * This will allow restore cursor position, selected text, etc.\n * @param {editor.ITextModel} model\n */\n saveViewState(model) {\n MonacoEditor_1.viewStates.set(model.uri, this.editor.saveViewState());\n }\n restoreViewState(model) {\n const viewState = MonacoEditor_1.viewStates.get(model.uri);\n if (viewState) {\n this.editor.restoreViewState(viewState);\n }\n }\n componentDidMount() {\n var _a, _b;\n try {\n this.createEditor();\n (_a = this.logger) === null || _a === void 0 ? void 0 : _a.info(`[MONACO]: editor did mount`, this.logMetadata);\n }\n catch (error) {\n (_b = this.logger) === null || _b === void 0 ? void 0 : _b.error(`[MONACO]: mounting failed: ${error}`, this.logMetadata);\n }\n }\n componentWillUnmount() {\n this.unmounting = true;\n this.saveViewState(this.model);\n this.destroy();\n }\n createEditor() {\n var _a;\n if (!this.containerElem || this.editor || this.unmounting) {\n return;\n }\n const { language, theme, readOnly, value: defaultValue } = this.props;\n this.editor = monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].create(this.containerElem, Object.assign({ model: this.model, detectIndentation: false, value: defaultValue, language,\n theme,\n readOnly }, this.options));\n (_a = this.logger) === null || _a === void 0 ? void 0 : _a.info(`[MONACO]: editor created for language=${language}, theme=${theme}`, this.logMetadata);\n this.validateLazy(); // validate initial value\n this.restoreViewState(this.model); // restore previous state if any\n if (this.props.autoFocus) {\n this.editor.focus();\n }\n const onDidLayoutChangeDisposer = this.editor.onDidLayoutChange(layoutInfo => {\n var _a, _b;\n (_b = (_a = this.props).onDidLayoutChange) === null || _b === void 0 ? void 0 : _b.call(_a, layoutInfo);\n });\n const onValueChangeDisposer = this.editor.onDidChangeModelContent(event => {\n var _a, _b;\n const value = this.editor.getValue();\n (_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, value, event);\n this.validateLazy(value);\n });\n const onContentSizeChangeDisposer = this.editor.onDidContentSizeChange((params) => {\n var _a, _b;\n (_b = (_a = this.props).onDidContentSizeChange) === null || _b === void 0 ? void 0 : _b.call(_a, params);\n });\n this.dispose.push(Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.model, this.onModelChange), Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.props.theme, monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].setTheme), Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.props.value, value => this.setValue(value)), Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.options, opts => this.editor.updateOptions(opts)), () => onDidLayoutChangeDisposer.dispose(), () => onValueChangeDisposer.dispose(), () => onContentSizeChangeDisposer.dispose(), this.bindResizeObserver());\n }\n destroy() {\n if (!this.editor)\n return;\n this.dispose();\n this.editor.dispose();\n this.editor = null;\n }\n setDimensions(width, height) {\n var _a;\n this.dimensions.width = width;\n this.dimensions.height = height;\n (_a = this.editor) === null || _a === void 0 ? void 0 : _a.layout({ width, height });\n }\n setValue(value = \"\") {\n if (value == this.getValue())\n return;\n this.editor.setValue(value);\n this.validate(value);\n }\n getValue(opts) {\n var _a, _b;\n return (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue(opts)) !== null && _b !== void 0 ? _b : \"\";\n }\n focus() {\n var _a;\n (_a = this.editor) === null || _a === void 0 ? void 0 : _a.focus();\n }\n render() {\n const { className, style } = this.props;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { \"data-test-component\": \"monaco-editor\", className: Object(_utils__WEBPACK_IMPORTED_MODULE_7__[\"cssNames\"])(_monaco_editor_module_scss__WEBPACK_IMPORTED_MODULE_0__[\"default\"].MonacoEditor, className), style: style, ref: this.bindRef }));\n }\n};\nObject.defineProperty(MonacoEditor, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: defaultEditorProps\n});\nObject.defineProperty(MonacoEditor, \"viewStates\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new WeakMap()\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"].ref,\n __metadata(\"design:type\", HTMLElement)\n], MonacoEditor.prototype, \"containerElem\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"].ref,\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"editor\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"],\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"dimensions\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"],\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"unmounting\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"id\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"model\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"options\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"logMetadata\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Number, Number]),\n __metadata(\"design:returntype\", void 0)\n], MonacoEditor.prototype, \"setDimensions\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"action\"],\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"validate\", void 0);\nMonacoEditor = MonacoEditor_1 = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], MonacoEditor);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/monaco-editor/monaco-editor.tsx?");
|
|
43012
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultEditorProps\", function() { return defaultEditorProps; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MonacoEditor\", function() { return MonacoEditor; });\n/* harmony import */ var _monaco_editor_module_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./monaco-editor.module.scss */ \"./src/renderer/components/monaco-editor/monaco-editor.module.scss\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mobx-react */ \"./node_modules/mobx-react/dist/mobxreact.esm.js\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var monaco_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! monaco-editor */ \"./node_modules/monaco-editor/esm/vs/editor/editor.main.js\");\n/* harmony import */ var _monaco_validators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./monaco-validators */ \"./src/renderer/components/monaco-editor/monaco-validators.ts\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _common_user_store__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../common/user-store */ \"./src/common/user-store/index.ts\");\n/* harmony import */ var _theme_store__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../theme.store */ \"./src/renderer/theme.store.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar MonacoEditor_1;\n\n\n\n\n\n\n\n\n\n\nconst defaultEditorProps = {\n language: \"yaml\",\n get theme() {\n // theme for monaco-editor defined in `src/renderer/themes/lens-*.json`\n return _theme_store__WEBPACK_IMPORTED_MODULE_9__[\"ThemeStore\"].getInstance().activeTheme.monacoTheme;\n },\n};\nlet MonacoEditor = MonacoEditor_1 = class MonacoEditor extends react__WEBPACK_IMPORTED_MODULE_1___default.a.Component {\n constructor(props) {\n super(props);\n Object.defineProperty(this, \"staticId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: `editor-id#${Math.round(1e7 * Math.random())}`\n });\n Object.defineProperty(this, \"dispose\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(_utils__WEBPACK_IMPORTED_MODULE_7__[\"disposer\"])()\n });\n // TODO: investigate how to replace with \"common/logger\"\n // currently leads for stucking UI forever & infinite loop.\n // e.g. happens on tab change/create, maybe some other cases too.\n Object.defineProperty(this, \"logger\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: console\n });\n Object.defineProperty(this, \"containerElem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"editor\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"dimensions\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {}\n });\n Object.defineProperty(this, \"unmounting\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"onModelChange\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (model, oldModel) => {\n var _a, _b, _c;\n (_a = this.logger) === null || _a === void 0 ? void 0 : _a.info(\"[MONACO]: model change\", { model, oldModel }, this.logMetadata);\n if (oldModel) {\n this.saveViewState(oldModel);\n }\n this.editor.setModel(model);\n this.restoreViewState(model);\n this.editor.layout();\n this.editor.focus(); // keep focus in editor, e.g. when clicking between dock-tabs\n (_c = (_b = this.props).onModelChange) === null || _c === void 0 ? void 0 : _c.call(_b, model, oldModel);\n this.validateLazy();\n }\n });\n Object.defineProperty(this, \"validate\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (value = this.getValue()) => {\n var _a, _b;\n const validators = [\n _monaco_validators__WEBPACK_IMPORTED_MODULE_5__[\"monacoValidators\"][this.props.language], // parsing syntax check\n ].filter(Boolean);\n for (const validate of validators) {\n try {\n validate(value);\n }\n catch (error) {\n (_b = (_a = this.props).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error); // emit error outside\n }\n }\n }\n });\n // avoid excessive validations during typing\n Object.defineProperty(this, \"validateLazy\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"debounce\"])(this.validate, 250)\n });\n Object.defineProperty(this, \"bindRef\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (elem) => this.containerElem = elem\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"makeObservable\"])(this);\n }\n static createUri(id) {\n return monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"Uri\"].file(`/monaco-editor/${id}`);\n }\n get id() {\n var _a;\n return (_a = this.props.id) !== null && _a !== void 0 ? _a : this.staticId;\n }\n get model() {\n const uri = MonacoEditor_1.createUri(this.id);\n const model = monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].getModel(uri);\n if (model) {\n return model; // already exists\n }\n const { language, value } = this.props;\n return monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].createModel(value, language, uri);\n }\n get options() {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"merge\"])({}, _common_user_store__WEBPACK_IMPORTED_MODULE_8__[\"UserStore\"].getInstance().editorConfiguration, this.props.options);\n }\n get logMetadata() {\n return {\n editorId: this.id,\n model: this.model,\n };\n }\n /**\n * Monitor editor's dom container element box-size and sync with monaco's dimensions\n * @private\n */\n bindResizeObserver() {\n const resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n this.setDimensions(width, height);\n }\n });\n const containerElem = this.editor.getContainerDomNode();\n resizeObserver.observe(containerElem);\n return () => resizeObserver.unobserve(containerElem);\n }\n /**\n * Save current view-model state in the editor.\n * This will allow restore cursor position, selected text, etc.\n * @param {editor.ITextModel} model\n */\n saveViewState(model) {\n MonacoEditor_1.viewStates.set(model.uri, this.editor.saveViewState());\n }\n restoreViewState(model) {\n const viewState = MonacoEditor_1.viewStates.get(model.uri);\n if (viewState) {\n this.editor.restoreViewState(viewState);\n }\n }\n componentDidMount() {\n var _a, _b;\n try {\n this.createEditor();\n (_a = this.logger) === null || _a === void 0 ? void 0 : _a.info(`[MONACO]: editor did mount`, this.logMetadata);\n }\n catch (error) {\n (_b = this.logger) === null || _b === void 0 ? void 0 : _b.error(`[MONACO]: mounting failed: ${error}`, this.logMetadata);\n }\n }\n componentWillUnmount() {\n this.unmounting = true;\n this.saveViewState(this.model);\n this.destroy();\n }\n createEditor() {\n var _a;\n if (!this.containerElem || this.editor || this.unmounting) {\n return;\n }\n const { language, theme, readOnly, value: defaultValue } = this.props;\n this.editor = monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].create(this.containerElem, Object.assign({ model: this.model, detectIndentation: false, value: defaultValue, language,\n theme,\n readOnly }, this.options));\n (_a = this.logger) === null || _a === void 0 ? void 0 : _a.info(`[MONACO]: editor created for language=${language}, theme=${theme}`, this.logMetadata);\n this.validateLazy(); // validate initial value\n this.restoreViewState(this.model); // restore previous state if any\n if (this.props.autoFocus) {\n this.editor.focus();\n }\n const onDidLayoutChangeDisposer = this.editor.onDidLayoutChange(layoutInfo => {\n var _a, _b;\n (_b = (_a = this.props).onDidLayoutChange) === null || _b === void 0 ? void 0 : _b.call(_a, layoutInfo);\n });\n const onValueChangeDisposer = this.editor.onDidChangeModelContent(event => {\n var _a, _b;\n const value = this.editor.getValue();\n (_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, value, event);\n this.validateLazy(value);\n });\n const onContentSizeChangeDisposer = this.editor.onDidContentSizeChange((params) => {\n var _a, _b;\n (_b = (_a = this.props).onDidContentSizeChange) === null || _b === void 0 ? void 0 : _b.call(_a, params);\n });\n this.dispose.push(Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.model, this.onModelChange), Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.props.theme, monaco_editor__WEBPACK_IMPORTED_MODULE_4__[\"editor\"].setTheme), Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.props.value, value => this.setValue(value)), Object(mobx__WEBPACK_IMPORTED_MODULE_3__[\"reaction\"])(() => this.options, opts => this.editor.updateOptions(opts)), () => onDidLayoutChangeDisposer.dispose(), () => onValueChangeDisposer.dispose(), () => onContentSizeChangeDisposer.dispose(), this.bindResizeObserver());\n }\n destroy() {\n if (!this.editor)\n return;\n this.dispose();\n this.editor.dispose();\n this.editor = null;\n }\n setDimensions(width, height) {\n var _a;\n this.dimensions.width = width;\n this.dimensions.height = height;\n (_a = this.editor) === null || _a === void 0 ? void 0 : _a.layout({ width, height });\n }\n setValue(value = \"\") {\n if (value == this.getValue())\n return;\n this.editor.setValue(value);\n this.validate(value);\n }\n getValue(opts) {\n var _a, _b;\n return (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue(opts)) !== null && _b !== void 0 ? _b : \"\";\n }\n focus() {\n var _a;\n (_a = this.editor) === null || _a === void 0 ? void 0 : _a.focus();\n }\n render() {\n const { className, style } = this.props;\n return (react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(\"div\", { \"data-test-component\": \"monaco-editor\", className: Object(_utils__WEBPACK_IMPORTED_MODULE_7__[\"cssNames\"])(_monaco_editor_module_scss__WEBPACK_IMPORTED_MODULE_0__[\"default\"].MonacoEditor, className), style: style, ref: this.bindRef }));\n }\n};\nObject.defineProperty(MonacoEditor, \"defaultProps\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: defaultEditorProps\n});\nObject.defineProperty(MonacoEditor, \"viewStates\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new WeakMap()\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"].ref,\n __metadata(\"design:type\", HTMLElement)\n], MonacoEditor.prototype, \"containerElem\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"].ref,\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"editor\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"],\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"dimensions\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"observable\"],\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"unmounting\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"id\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"model\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"options\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], MonacoEditor.prototype, \"logMetadata\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Number, Number]),\n __metadata(\"design:returntype\", void 0)\n], MonacoEditor.prototype, \"setDimensions\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_3__[\"action\"],\n __metadata(\"design:type\", Object)\n], MonacoEditor.prototype, \"validate\", void 0);\nMonacoEditor = MonacoEditor_1 = __decorate([\n mobx_react__WEBPACK_IMPORTED_MODULE_2__[\"observer\"],\n __metadata(\"design:paramtypes\", [Object])\n], MonacoEditor);\n\n\n\n//# sourceURL=webpack:///./src/renderer/components/monaco-editor/monaco-editor.tsx?");
|
|
43059
43013
|
|
|
43060
43014
|
/***/ }),
|
|
43061
43015
|
|
|
@@ -43869,7 +43823,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
43869
43823
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
43870
43824
|
|
|
43871
43825
|
"use strict";
|
|
43872
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ThemeStore\", function() { return ThemeStore; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _common_user_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/user-store */ \"./src/common/user-store/index.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _themes_lens_dark_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./themes/lens-dark.json */ \"./src/renderer/themes/lens-dark.json\");\nvar _themes_lens_dark_json__WEBPACK_IMPORTED_MODULE_4___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./themes/lens-dark.json */ \"./src/renderer/themes/lens-dark.json\", 1);\n/* harmony import */ var _themes_lens_light_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./themes/lens-light.json */ \"./src/renderer/themes/lens-light.json\");\nvar _themes_lens_light_json__WEBPACK_IMPORTED_MODULE_5___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./themes/lens-light.json */ \"./src/renderer/themes/lens-light.json\", 1);\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\nclass ThemeStore extends _utils__WEBPACK_IMPORTED_MODULE_1__[\"Singleton\"] {\n constructor() {\n super();\n Object.defineProperty(this, \"styles\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // bundled themes from `themes/${themeId}.json`\n Object.defineProperty(this, \"themes\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].map({\n \"lens-dark\": _themes_lens_dark_json__WEBPACK_IMPORTED_MODULE_4__,\n \"lens-light\": _themes_lens_light_json__WEBPACK_IMPORTED_MODULE_5__,\n })\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n // auto-apply active theme\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"reaction\"])(() => this.activeThemeId, themeId => {\n try {\n this.applyTheme(this.getThemeById(themeId));\n }\n catch (err) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(err);\n _common_user_store__WEBPACK_IMPORTED_MODULE_2__[\"UserStore\"].getInstance().resetTheme();\n }\n }, {\n fireImmediately: true,\n });\n }\n get activeThemeId() {\n return _common_user_store__WEBPACK_IMPORTED_MODULE_2__[\"UserStore\"].getInstance().colorTheme;\n }\n get activeTheme() {\n var _a;\n return (_a = this.themes.get(this.activeThemeId)) !== null && _a !== void 0 ? _a : this.themes.get(
|
|
43826
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ThemeStore\", function() { return ThemeStore; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./src/renderer/utils/index.ts\");\n/* harmony import */ var _common_user_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/user-store */ \"./src/common/user-store/index.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _themes_lens_dark_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./themes/lens-dark.json */ \"./src/renderer/themes/lens-dark.json\");\nvar _themes_lens_dark_json__WEBPACK_IMPORTED_MODULE_4___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./themes/lens-dark.json */ \"./src/renderer/themes/lens-dark.json\", 1);\n/* harmony import */ var _themes_lens_light_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./themes/lens-light.json */ \"./src/renderer/themes/lens-light.json\");\nvar _themes_lens_light_json__WEBPACK_IMPORTED_MODULE_5___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./themes/lens-light.json */ \"./src/renderer/themes/lens-light.json\", 1);\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/vars */ \"./src/common/vars.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n\n\n\n\n\n\n\nclass ThemeStore extends _utils__WEBPACK_IMPORTED_MODULE_1__[\"Singleton\"] {\n constructor() {\n super();\n Object.defineProperty(this, \"styles\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // bundled themes from `themes/${themeId}.json`\n Object.defineProperty(this, \"themes\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].map({\n \"lens-dark\": _themes_lens_dark_json__WEBPACK_IMPORTED_MODULE_4__,\n \"lens-light\": _themes_lens_light_json__WEBPACK_IMPORTED_MODULE_5__,\n })\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n Object(_utils__WEBPACK_IMPORTED_MODULE_1__[\"autoBind\"])(this);\n // auto-apply active theme\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"reaction\"])(() => this.activeThemeId, themeId => {\n try {\n this.applyTheme(this.getThemeById(themeId));\n }\n catch (err) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(err);\n _common_user_store__WEBPACK_IMPORTED_MODULE_2__[\"UserStore\"].getInstance().resetTheme();\n }\n }, {\n fireImmediately: true,\n });\n }\n get activeThemeId() {\n return _common_user_store__WEBPACK_IMPORTED_MODULE_2__[\"UserStore\"].getInstance().colorTheme;\n }\n get activeTheme() {\n var _a;\n return (_a = this.themes.get(this.activeThemeId)) !== null && _a !== void 0 ? _a : this.themes.get(_common_vars__WEBPACK_IMPORTED_MODULE_6__[\"defaultTheme\"]);\n }\n get themeOptions() {\n return Array.from(this.themes).map(([themeId, theme]) => ({\n label: theme.name,\n value: themeId,\n }));\n }\n getThemeById(themeId) {\n return this.themes.get(themeId);\n }\n applyTheme(theme) {\n if (!this.styles) {\n this.styles = document.createElement(\"style\");\n this.styles.id = \"lens-theme\";\n document.head.append(this.styles);\n }\n const cssVars = Object.entries(theme.colors).map(([cssName, color]) => {\n return `--${cssName}: ${color};`;\n });\n this.styles.textContent = `:root {\\n${cssVars.join(\"\\n\")}}`;\n // Adding universal theme flag which can be used in component styles\n const body = document.querySelector(\"body\");\n body.classList.toggle(\"theme-light\", theme.type === \"light\");\n }\n}\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", String),\n __metadata(\"design:paramtypes\", [])\n], ThemeStore.prototype, \"activeThemeId\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Object),\n __metadata(\"design:paramtypes\", [])\n], ThemeStore.prototype, \"activeTheme\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"],\n __metadata(\"design:type\", Array),\n __metadata(\"design:paramtypes\", [])\n], ThemeStore.prototype, \"themeOptions\", null);\n\n\n//# sourceURL=webpack:///./src/renderer/theme.store.ts?");
|
|
43873
43827
|
|
|
43874
43828
|
/***/ }),
|
|
43875
43829
|
|
|
@@ -43903,7 +43857,7 @@ eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"Light (Lens)\\\",\\\"type\
|
|
|
43903
43857
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
43904
43858
|
|
|
43905
43859
|
"use strict";
|
|
43906
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createStorage\", function() { return createStorage; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _storageHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./storageHelper */ \"./src/renderer/utils/storageHelper.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../common/vars */ \"./src/common/vars.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Keeps window.localStorage state in external JSON-files.\n// Because app creates random port between restarts => storage session wiped out each time.\n\n\n\n\n\n\nconst storage = Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"observable\"])({\n initialized: false,\n loaded: false,\n data: {}, // json-serializable\n});\n/**\n * Creates a helper for saving data under the \"key\" intended for window.localStorage\n * @param key The descriptor of the data\n * @param defaultValue The default value of the data, must be JSON serializable\n */\nfunction createStorage(key, defaultValue) {\n const { logPrefix } = _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"];\n if (!storage.initialized) {\n storage.initialized = true;\n (async () => {\n const filePath = await _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"].getLocalStoragePath();\n try {\n storage.data = await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.readJson(filePath);\n }\n catch (_a) { }\n finally {\n if (!_common_vars__WEBPACK_IMPORTED_MODULE_5__[\"isTestEnv\"]) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`${logPrefix} loading finished for ${filePath}`);\n }\n storage.loaded = true;\n }\n // bind auto-saving data changes to %storage-file.json\n Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"reaction\"])(() => Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"toJS\"])(storage.data), saveFile, {\n delay: 250,\n equals: mobx__WEBPACK_IMPORTED_MODULE_1__[\"comparer\"].structural, // save only when something really changed\n });\n async function saveFile(state = {}) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`${logPrefix} saving ${filePath}`);\n try {\n await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.ensureDir(path__WEBPACK_IMPORTED_MODULE_0___default.a.dirname(filePath), { mode: 0o755 });\n await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.writeJson(filePath, state, { spaces: 2 });\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(`${logPrefix} saving failed: ${error}`, {\n json: state, jsonFilePath: filePath,\n });\n }\n }\n })()\n .catch(error => _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(`${logPrefix} Failed to initialize storage: ${error}`));\n }\n return new _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"](key, {\n autoInit: true,\n defaultValue,\n storage: {\n async getItem(key) {\n await Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"when\"])(() => storage.loaded);\n return storage.data[key];\n },\n setItem(key, value) {\n storage.data[key] = value;\n },\n removeItem(key) {\n delete storage.data[key];\n },\n },\n });\n}\n\n\n//# sourceURL=webpack:///./src/renderer/utils/createStorage.ts?");
|
|
43860
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createStorage\", function() { return createStorage; });\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fs-extra */ \"./node_modules/fs-extra/lib/index.js\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _storageHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./storageHelper */ \"./src/renderer/utils/storageHelper.ts\");\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_vars__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../common/vars */ \"./src/common/vars.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n// Keeps window.localStorage state in external JSON-files.\n// Because app creates random port between restarts => storage session wiped out each time.\n\n\n\n\n\n\nconst storage = Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"observable\"])({\n initialized: false,\n loaded: false,\n data: {}, // json-serializable\n});\n/**\n * Creates a helper for saving data under the \"key\" intended for window.localStorage\n * @param key The descriptor of the data\n * @param defaultValue The default value of the data, must be JSON serializable\n */\nfunction createStorage(key, defaultValue) {\n const { logPrefix } = _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"];\n if (!storage.initialized) {\n storage.initialized = true;\n (async () => {\n const filePath = await _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"].getLocalStoragePath();\n try {\n storage.data = await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.readJson(filePath);\n }\n catch (_a) {\n // ignore error\n }\n finally {\n if (!_common_vars__WEBPACK_IMPORTED_MODULE_5__[\"isTestEnv\"]) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`${logPrefix} loading finished for ${filePath}`);\n }\n storage.loaded = true;\n }\n // bind auto-saving data changes to %storage-file.json\n Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"reaction\"])(() => Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"toJS\"])(storage.data), saveFile, {\n delay: 250,\n equals: mobx__WEBPACK_IMPORTED_MODULE_1__[\"comparer\"].structural, // save only when something really changed\n });\n async function saveFile(state = {}) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`${logPrefix} saving ${filePath}`);\n try {\n await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.ensureDir(path__WEBPACK_IMPORTED_MODULE_0___default.a.dirname(filePath), { mode: 0o755 });\n await fs_extra__WEBPACK_IMPORTED_MODULE_2___default.a.writeJson(filePath, state, { spaces: 2 });\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(`${logPrefix} saving failed: ${error}`, {\n json: state, jsonFilePath: filePath,\n });\n }\n }\n })()\n .catch(error => _main_logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(`${logPrefix} Failed to initialize storage: ${error}`));\n }\n return new _storageHelper__WEBPACK_IMPORTED_MODULE_3__[\"StorageHelper\"](key, {\n autoInit: true,\n defaultValue,\n storage: {\n async getItem(key) {\n await Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"when\"])(() => storage.loaded);\n return storage.data[key];\n },\n setItem(key, value) {\n storage.data[key] = value;\n },\n removeItem(key) {\n delete storage.data[key];\n },\n },\n });\n}\n\n\n//# sourceURL=webpack:///./src/renderer/utils/createStorage.ts?");
|
|
43907
43861
|
|
|
43908
43862
|
/***/ }),
|
|
43909
43863
|
|
|
@@ -44071,7 +44025,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
|
44071
44025
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
44072
44026
|
|
|
44073
44027
|
"use strict";
|
|
44074
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StorageHelper\", function() { return StorageHelper; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! immer */ \"./node_modules/immer/dist/immer.esm.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../common/utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _common_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../common/app-paths */ \"./src/common/app-paths.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n// Helper for working with storages (e.g. window.localStorage, NodeJS/file-system, etc.)\n\n\n\n\n\n\n\nclass StorageHelper {\n constructor(key, options) {\n Object.defineProperty(this, \"key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: key\n });\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"storage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box(undefined, {\n deep: true,\n equals: mobx__WEBPACK_IMPORTED_MODULE_0__[\"comparer\"].structural,\n })\n });\n Object.defineProperty(this, \"initialized\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"onData\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (data) => {\n const notEmpty = data != null;\n const notDefault = !this.isDefaultValue(data);\n if (notEmpty && notDefault) {\n this.set(data);\n }\n this.initialized = true;\n }\n });\n Object.defineProperty(this, \"onError\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (error) => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`${StorageHelper.logPrefix} loading error: ${error}`, this);\n }\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n const { storage, autoInit = true } = options;\n this.storage = storage;\n this.data.observe_(({ newValue, oldValue }) => {\n this.onChange(newValue, oldValue);\n });\n if (autoInit) {\n this.init();\n }\n }\n static async getLocalStoragePath() {\n return path__WEBPACK_IMPORTED_MODULE_5___default.a.resolve(await _common_app_paths__WEBPACK_IMPORTED_MODULE_6__[\"AppPaths\"].getAsync(\"userData\"), \"lens-local-storage\", `${Object(_common_utils__WEBPACK_IMPORTED_MODULE_4__[\"getHostedClusterId\"])() || \"app\"}.json`);\n }\n get whenReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => this.initialized);\n }\n get defaultValue() {\n // return as-is since options.defaultValue might be a getter too\n return this.options.defaultValue;\n }\n init({ force = false } = {}) {\n if (this.initialized && !force) {\n return;\n }\n try {\n const data = this.storage.getItem(this.key);\n if (data instanceof Promise) {\n data.then(this.onData, this.onError);\n }\n else {\n this.onData(data);\n }\n }\n catch (error) {\n this.onError(error);\n }\n }\n isDefaultValue(value) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEqual\"])(value, this.defaultValue);\n }\n onChange(value, oldValue) {\n var _a, _b;\n if (!this.initialized)\n return;\n try {\n if (value == null) {\n this.storage.removeItem(this.key);\n }\n else {\n this.storage.setItem(this.key, value);\n }\n (_b = (_a = this.storage).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, { value, oldValue, key: this.key });\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`${StorageHelper.logPrefix} updating storage: ${error}`, this, { value, oldValue });\n }\n }\n get() {\n var _a;\n return (_a = this.data.get()) !== null && _a !== void 0 ? _a : this.defaultValue;\n }\n set(value) {\n if (this.isDefaultValue(value)) {\n this.reset();\n }\n else {\n this.data.set(value);\n }\n }\n reset() {\n this.data.set(undefined);\n }\n merge(value) {\n const nextValue = Object(immer__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.toJSON(), (draft) => {\n if (typeof value == \"function\") {\n const newValue = value(draft);\n // merge returned plain objects from `value-as-callback` usage\n // otherwise `draft` can be just modified inside a callback without returning any value (void)\n if (newValue && !Object(immer__WEBPACK_IMPORTED_MODULE_1__[\"isDraft\"])(newValue)) {\n Object.assign(draft, newValue);\n }\n }\n else if (Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isPlainObject\"])(value)) {\n Object.assign(draft, value);\n }\n return draft;\n });\n this.set(nextValue);\n }\n toJSON() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"toJS\"])(this.get());\n }\n}\nObject.defineProperty(StorageHelper, \"logPrefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"[StorageHelper]:\"\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", Object)\n], StorageHelper.prototype, \"initialized\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"init\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"set\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"reset\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"merge\", null);\n\n\n//# sourceURL=webpack:///./src/renderer/utils/storageHelper.ts?");
|
|
44028
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StorageHelper\", function() { return StorageHelper; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/dist/mobx.esm.js\");\n/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! immer */ \"./node_modules/immer/dist/immer.esm.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _main_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../main/logger */ \"./src/main/logger.ts\");\n/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../common/utils */ \"./src/common/utils/index.ts\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _common_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../common/app-paths */ \"./src/common/app-paths.ts\");\n/**\n * Copyright (c) 2021 OpenLens Authors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\n// Helper for working with storages (e.g. window.localStorage, NodeJS/file-system, etc.)\n\n\n\n\n\n\n\nclass StorageHelper {\n constructor(key, options) {\n Object.defineProperty(this, \"key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: key\n });\n Object.defineProperty(this, \"options\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: options\n });\n Object.defineProperty(this, \"storage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"].box(undefined, {\n deep: true,\n equals: mobx__WEBPACK_IMPORTED_MODULE_0__[\"comparer\"].structural,\n })\n });\n Object.defineProperty(this, \"initialized\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"onData\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (data) => {\n const notEmpty = data != null;\n const notDefault = !this.isDefaultValue(data);\n if (notEmpty && notDefault) {\n this.set(data);\n }\n this.initialized = true;\n }\n });\n Object.defineProperty(this, \"onError\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (error) => {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`${StorageHelper.logPrefix} loading error: ${error}`, this);\n }\n });\n Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"makeObservable\"])(this);\n const { storage, autoInit = true } = options;\n this.storage = storage;\n this.data.observe_(({ newValue, oldValue }) => {\n this.onChange(newValue, oldValue);\n });\n if (autoInit) {\n this.init();\n }\n }\n static async getLocalStoragePath() {\n return path__WEBPACK_IMPORTED_MODULE_5___default.a.resolve(await _common_app_paths__WEBPACK_IMPORTED_MODULE_6__[\"AppPaths\"].getAsync(\"userData\"), \"lens-local-storage\", `${Object(_common_utils__WEBPACK_IMPORTED_MODULE_4__[\"getHostedClusterId\"])() || \"app\"}.json`);\n }\n get whenReady() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(() => this.initialized);\n }\n get defaultValue() {\n // return as-is since options.defaultValue might be a getter too\n return this.options.defaultValue;\n }\n init({ force = false } = {}) {\n if (this.initialized && !force) {\n return;\n }\n try {\n const data = this.storage.getItem(this.key);\n if (data instanceof Promise) {\n data.then(this.onData, this.onError);\n }\n else {\n this.onData(data);\n }\n }\n catch (error) {\n this.onError(error);\n }\n }\n isDefaultValue(value) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEqual\"])(value, this.defaultValue);\n }\n onChange(value, oldValue) {\n var _a, _b;\n if (!this.initialized)\n return;\n try {\n if (value == null) {\n this.storage.removeItem(this.key);\n }\n else {\n this.storage.setItem(this.key, value);\n }\n (_b = (_a = this.storage).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, { value, oldValue, key: this.key });\n }\n catch (error) {\n _main_logger__WEBPACK_IMPORTED_MODULE_3__[\"default\"].error(`${StorageHelper.logPrefix} updating storage: ${error}`, this, { value, oldValue });\n }\n }\n get() {\n var _a;\n return (_a = this.data.get()) !== null && _a !== void 0 ? _a : this.defaultValue;\n }\n set(value) {\n if (this.isDefaultValue(value)) {\n this.reset();\n }\n else {\n this.data.set(value);\n }\n }\n reset() {\n this.data.set(undefined);\n }\n merge(value) {\n const nextValue = Object(immer__WEBPACK_IMPORTED_MODULE_1__[\"produce\"])(this.toJSON(), (draft) => {\n if (typeof value == \"function\") {\n const newValue = value(draft);\n // merge returned plain objects from `value-as-callback` usage\n // otherwise `draft` can be just modified inside a callback without returning any value (void)\n if (newValue && !Object(immer__WEBPACK_IMPORTED_MODULE_1__[\"isDraft\"])(newValue)) {\n Object.assign(draft, newValue);\n }\n }\n else if (Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isPlainObject\"])(value)) {\n Object.assign(draft, value);\n }\n return draft;\n });\n this.set(nextValue);\n }\n toJSON() {\n return Object(mobx__WEBPACK_IMPORTED_MODULE_0__[\"toJS\"])(this.get());\n }\n}\nObject.defineProperty(StorageHelper, \"logPrefix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"[StorageHelper]:\"\n});\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"],\n __metadata(\"design:type\", Object)\n], StorageHelper.prototype, \"initialized\", void 0);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"init\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"set\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", []),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"reset\", null);\n__decorate([\n mobx__WEBPACK_IMPORTED_MODULE_0__[\"action\"],\n __metadata(\"design:type\", Function),\n __metadata(\"design:paramtypes\", [Object]),\n __metadata(\"design:returntype\", void 0)\n], StorageHelper.prototype, \"merge\", null);\n\n\n//# sourceURL=webpack:///./src/renderer/utils/storageHelper.ts?");
|
|
44075
44029
|
|
|
44076
44030
|
/***/ }),
|
|
44077
44031
|
|