diff options
| author | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
|---|---|---|
| committer | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
| commit | bce557cc2dc767628bed6aac87301a1be7c5431b (patch) | |
| tree | b51a051228d01fe3306cd7626d4a96768aadb944 /shared/metrics-8/node_modules/@jet/engine | |
init commit
Diffstat (limited to 'shared/metrics-8/node_modules/@jet/engine')
66 files changed, 1743 insertions, 0 deletions
diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/actions/action-dispatcher.js b/shared/metrics-8/node_modules/@jet/engine/lib/actions/action-dispatcher.js new file mode 100644 index 0000000..1280b06 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/actions/action-dispatcher.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ActionDispatcher = void 0; +const optional_1 = require("@jet/environment/types/optional"); +class ActionDispatcher { + constructor(metricsPipeline) { + this.implementations = {}; + this.metricsPipeline = metricsPipeline; + } + register(type, implementation) { + if (type in this.implementations) { + console.error(`An implementation is already registered for ${type}`); + } + this.implementations[type] = implementation; + } + async perform(action, metricsBehavior) { + if (!(action.$kind in this.implementations)) { + // 1. If there is no implementation registered for the type of action + // we were passed, we check for a chained dispatcher to forward to. + // If one is found, we forward this call without doing any work. + // If none is found, we give up. + if (optional_1.isSome(this.next)) { + return await this.next.perform(action, metricsBehavior); + } + else { + return "unsupported"; + } + } + // 2. We have an implementation for the action we were given. + // We are responsible for processing metrics for that action. + this.processMetrics(action, metricsBehavior); + if (optional_1.isSome(this.next)) { + // 3a. If we have another dispatcher we are chained to, we forward to it + // if the implementation we have for the given action decides it cannot + // support performing it. + const outcome = await this.implementations[action.$kind](action); + if (outcome === "unsupported") { + return await this.next.perform(action, { behavior: "notProcessed" }); + } + else { + return outcome; + } + } + else { + // 3b. We hand off control to the implementation we have for the given action type. + // If the implementation cannot perform the action, we give up. + return await this.implementations[action.$kind](action); + } + } + processMetrics(action, metricsBehavior) { + if (metricsBehavior.behavior === "notProcessed") { + return; + } + const actionMetrics = action.actionMetrics; + const context = { + customMetrics: actionMetrics.custom, + pageFields: metricsBehavior.context.pageFields, + }; + action.actionMetrics.data.forEach((data) => { + this.metricsPipeline.process(data, context); + }); + } +} +exports.ActionDispatcher = ActionDispatcher; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/actions/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/actions/index.js new file mode 100644 index 0000000..303d3bb --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/actions/index.js @@ -0,0 +1,13 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./action-dispatcher"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/index.js new file mode 100644 index 0000000..c4bd837 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/index.js @@ -0,0 +1,17 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./jet-bag"), exports); +__exportStar(require("./jet-host"), exports); +__exportStar(require("./jet-network-fetch"), exports); +__exportStar(require("./localized-strings-bundle"), exports); +__exportStar(require("./localized-strings-json-object"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-bag.js b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-bag.js new file mode 100644 index 0000000..0ea378c --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-bag.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JetBag = void 0; +class JetBag { + constructor(backing) { + this.backing = backing; + } + registerBagKeys() { + // do nothing. + } + string(key) { + const value = this.backing[key]; + return typeof value === "string" || value === null ? value : undefined; + } + double(key) { + const value = this.backing[key]; + return typeof value === "number" || value === null ? value : undefined; + } + integer(key) { + const value = this.backing[key]; + return typeof value === "number" || value === null ? value : undefined; + } + boolean(key) { + const value = this.backing[key]; + return typeof value === "boolean" || value === null ? value : undefined; + } + array(key) { + const value = this.backing[key]; + return Array.isArray(value) || value === null ? value : undefined; + } + dictionary(key) { + const value = this.backing[key]; + return typeof value === "object" ? value : undefined; + } + url(key) { + const value = this.backing[key]; + return typeof value === "string" ? value : undefined; + } +} +exports.JetBag = JetBag; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-host.js b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-host.js new file mode 100644 index 0000000..ed816b4 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-host.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JetHost = void 0; +class JetHost { + constructor(options) { + this.osBuild = "unknown"; + this.deviceModel = "unknown"; + this.deviceModelFamily = "unknown"; + this.devicePhysicalModel = "unknown"; + this.deviceLocalizedModel = "unknown"; + this.clientIdentifier = "unknown"; + this.clientVersion = "unknown"; + this.platform = options.platform; + } + isOSAtLeast() { + return false; + } +} +exports.JetHost = JetHost; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-network-fetch.js b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-network-fetch.js new file mode 100644 index 0000000..8330737 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/jet-network-fetch.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JetNetworkFetch = void 0; +const optional_1 = require("@jet/environment/types/optional"); +class JetNetworkFetch { + async fetch(request) { + var _a, _b, _c; + if (optional_1.isNothing(process === null || process === void 0 ? void 0 : process.env.MEDIA_API_TOKEN)) { + return await Promise.reject(new Error("process.env.MEDIA_API_TOKEN must be specified")); + } + const headers = { + ...((_a = request.headers) !== null && _a !== void 0 ? _a : {}), + authorization: `Bearer ${process === null || process === void 0 ? void 0 : process.env.MEDIA_API_TOKEN}`, + }; + const response = await fetch(request.url, { + body: request.body, + method: (_b = request.method) !== null && _b !== void 0 ? _b : undefined, + cache: (_c = request.cache) !== null && _c !== void 0 ? _c : undefined, + headers: headers, + }); + return { + ok: response.ok, + headers: Array.from(response.headers.keys()).reduce((previous, key) => { + const value = response.headers.get(key); + if (optional_1.isSome(value)) { + previous[key] = value; + } + return previous; + }, {}), + redirected: response.redirected, + status: response.status, + statusText: response.statusText, + url: response.url, + body: await response.text(), + metrics: [], + }; + } +} +exports.JetNetworkFetch = JetNetworkFetch; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/localized-strings-bundle.js b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/localized-strings-bundle.js new file mode 100644 index 0000000..0c4bf44 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/localized-strings-bundle.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LocalizedStringsBundle = void 0; +const environment_1 = require("@jet/environment"); +const localized_strings_json_object_1 = require("./localized-strings-json-object"); +/** + * A localized string data source which loads strings from the application bundle. + * + * The bundle used by this data source can be a web app webpack bundle + * or a native app bundle bridged over to JS code. + */ +class LocalizedStringsBundle { + // MARK: - Initialization + /** + * Create localized strings bundle with all required attributes. + * + * @param bundle - The app bundle object. + */ + constructor(bundle) { + this.bundle = bundle; + } + // MARK: - LocalizedStringsDataSource + async fetchStrings(language) { + var _a; + // Load the strings from bundle and cache them. + const localizations = this.bundle.localizationsProperty; + if (environment_1.isNothing(localizations)) { + throw new Error("Localized strings bundle index file is missing 'localizations' property"); + } + let strings; + const format = (_a = localizations.format) !== null && _a !== void 0 ? _a : "json/inline" /* jsonInline */; + if (format === "json/inline" /* jsonInline */) { + const inlineLocalizations = localizations; + strings = inlineLocalizations[language]; + } + else { + const externalLocalizations = localizations; + switch (externalLocalizations.format) { + case "json/multi-file" /* jsonMultiFile */: + { + // The path points to directory where JSON files are located. + // We don't even have to list a directory, just construct a final path. + // The path is also not an OS path but a bundle (e.g. JetPack) path. + // Bundle APIs always use "/" in the path, same as the paths used in the + // index.json (manifest) files. + const jsonPath = `${externalLocalizations.path}/${language}.json`; + strings = (await this.bundle.loadResource(jsonPath)); + } + break; + case "json/single-file" /* jsonSingleFile */: + // The bundle contains single JSON file with all strings dictionary in it. + strings = (await this.bundle.loadResource(externalLocalizations.path))[language]; + break; + case "loctable" /* loctable */: + throw new Error("Loctable format not supported in JS implementation"); + case "js" /* js */: + throw new Error("Not yet implemented"); + default: + throw new Error(`Unknown localization format: ${JSON.stringify(format)}`); + } + } + if (environment_1.isNothing(strings)) { + throw new Error(`Missing strings for ${language}`); + } + return new localized_strings_json_object_1.LocalizedStringsJSONObject(strings); + } +} +exports.LocalizedStringsBundle = LocalizedStringsBundle; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/localized-strings-json-object.js b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/localized-strings-json-object.js new file mode 100644 index 0000000..eb7a9dd --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/dependencies/localized-strings-json-object.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LocalizedStringsJSONObject = void 0; +/** + * A type providing access to underlying localized strings JSON object. + */ +class LocalizedStringsJSONObject { + /** + * Create localized strings JSON object. + * + * @param strings - A dictionary containing localized strings. + */ + constructor(strings) { + this.strings = strings; + } + // MARK: - Localized Strings + string(key) { + return this.strings[key]; + } +} +exports.LocalizedStringsJSONObject = LocalizedStringsJSONObject; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/index.js new file mode 100644 index 0000000..624ce25 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/index.js @@ -0,0 +1,15 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./actions"), exports); +__exportStar(require("./dependencies"), exports); +__exportStar(require("./metrics"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/index.js new file mode 100644 index 0000000..e8d9f32 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/index.js @@ -0,0 +1,16 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./metrics-fields-aggregator"), exports); +__exportStar(require("./metrics-fields-builder"), exports); +__exportStar(require("./metrics-fields-context"), exports); +__exportStar(require("./metrics-fields-provider"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-aggregator.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-aggregator.js new file mode 100644 index 0000000..b53d7a9 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-aggregator.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MetricsFieldsAggregator = void 0; +const optional_1 = require("@jet/environment/types/optional"); +const page_metrics_fields_provider_1 = require("../field-providers/page-metrics-fields-provider"); +class MetricsFieldsAggregator { + constructor() { + this.optInProviders = new Map(); + this.optOutProviders = new Map(); + } + static makeDefaultAggregator() { + const aggregator = new MetricsFieldsAggregator(); + aggregator.addOptInProvider(new page_metrics_fields_provider_1.PageMetricsFieldsProvider(), "pageFields"); + return aggregator; + } + addOptInProvider(provider, request) { + this.optInProviders.set(request, provider); + } + addOptOutProvider(provider, request) { + this.optOutProviders.set(request, provider); + } + removeOptInProvider(request) { + this.optInProviders.delete(request); + } + removeOptOutProvider(request) { + this.optOutProviders.delete(request); + } + addMetricsFields(options) { + options.including.forEach((request) => { + const provider = this.optInProviders.get(request); + if (optional_1.isNothing(provider)) { + // No provider registered + return; + } + provider.addMetricsFields(options.builder, options.context); + }); + this.optOutProviders.forEach((provider, request) => { + if (optional_1.isNothing(provider) || options.excluding.includes(request)) { + return; + } + provider.addMetricsFields(options.builder, options.context); + }); + } +} +exports.MetricsFieldsAggregator = MetricsFieldsAggregator; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-builder.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-builder.js new file mode 100644 index 0000000..d00e47b --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-builder.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SimpleMetricsFieldsBuilder = void 0; +class SimpleMetricsFieldsBuilder { + constructor(baseFields) { + this.fields = baseFields; + } + addValue(value, field) { + this.fields[field] = value; + } + get allMetricsFields() { + return this.fields; + } +} +exports.SimpleMetricsFieldsBuilder = SimpleMetricsFieldsBuilder; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-context.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-context.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-context.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-provider.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-provider.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/aggregating/metrics-fields-provider.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/field-providers/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/field-providers/index.js new file mode 100644 index 0000000..250f6dc --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/field-providers/index.js @@ -0,0 +1,13 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./page-metrics-fields-provider"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/field-providers/page-metrics-fields-provider.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/field-providers/page-metrics-fields-provider.js new file mode 100644 index 0000000..67e0f53 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/field-providers/page-metrics-fields-provider.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageMetricsFieldsProvider = void 0; +const optional_1 = require("@jet/environment/types/optional"); +class PageMetricsFieldsProvider { + addMetricsFields(builder, context) { + const pageFields = context.pageFields; + if (optional_1.isNothing(pageFields)) { + // No page fields + return; + } + for (const field in pageFields) { + if (Object.prototype.hasOwnProperty.call(pageFields, field)) { + builder.addValue(pageFields[field], field); + } + } + } +} +exports.PageMetricsFieldsProvider = PageMetricsFieldsProvider; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/index.js new file mode 100644 index 0000000..469a960 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./aggregating"), exports); +__exportStar(require("./field-providers"), exports); +__exportStar(require("./linting"), exports); +__exportStar(require("./presenters"), exports); +__exportStar(require("./metrics-pipeline"), exports); +__exportStar(require("./recording"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/linting/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/linting/index.js new file mode 100644 index 0000000..7fb1fcf --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/linting/index.js @@ -0,0 +1,13 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./metrics-event-linter"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/linting/metrics-event-linter.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/linting/metrics-event-linter.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/linting/metrics-event-linter.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/metrics-pipeline.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/metrics-pipeline.js new file mode 100644 index 0000000..ea32424 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/metrics-pipeline.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MetricsPipeline = exports.FlushBehavior = void 0; +const metrics_fields_builder_1 = require("./aggregating/metrics-fields-builder"); +// eslint-disable-next-line @typescript-eslint/no-shadow +var FlushBehavior; +(function (FlushBehavior) { + FlushBehavior[FlushBehavior["automatic"] = 0] = "automatic"; + FlushBehavior[FlushBehavior["never"] = 1] = "never"; +})(FlushBehavior = exports.FlushBehavior || (exports.FlushBehavior = {})); +class MetricsPipeline { + constructor(options) { + var _a; + this.aggregator = options.aggregator; + this.linter = options.linter; + this.recorder = options.recorder; + this.flushBehavior = (_a = options.flushBehavior) !== null && _a !== void 0 ? _a : FlushBehavior.automatic; + } + async process(data, context) { + const builder = new metrics_fields_builder_1.SimpleMetricsFieldsBuilder(data.fields); + this.aggregator.addMetricsFields({ + including: data.includingFields, + excluding: data.excludingFields, + builder: builder, + context: context, + }); + const lintedEvent = await this.linter.processEvent(builder.allMetricsFields); + this.recorder.record(lintedEvent, data.topic); + if (data.shouldFlush && this.flushBehavior === FlushBehavior.automatic) { + this.recorder.flush(); + } + return lintedEvent; + } +} +exports.MetricsPipeline = MetricsPipeline; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/presenters/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/presenters/index.js new file mode 100644 index 0000000..56e55cf --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/presenters/index.js @@ -0,0 +1,13 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./page-metrics-presenter"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/presenters/page-metrics-presenter.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/presenters/page-metrics-presenter.js new file mode 100644 index 0000000..c04bbd6 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/presenters/page-metrics-presenter.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageMetricsPresenter = void 0; +const optional_1 = require("@jet/environment/types/optional"); +class PageMetricsPresenter { + constructor(metricsPipeline) { + this.metricsPipeline = metricsPipeline; + this.isViewAppeared = false; + } + set pageMetrics(pageMetrics) { + this.pageMetricsStore = pageMetrics; + if (optional_1.isSome(pageMetrics) && this.isViewAppeared) { + this.processInstructions("pageEnter"); + } + } + get pageMetrics() { + return this.pageMetricsStore; + } + async processInstructions(invocationPoint) { + var _a, _b, _c; + if (optional_1.isNothing(this.pageMetrics)) { + return; + } + // istanbul ignore next + const invocationContext = { + customMetrics: (_a = this.baseContext) === null || _a === void 0 ? void 0 : _a.customMetrics, + pageFields: { + ...(_b = this.baseContext) === null || _b === void 0 ? void 0 : _b.pageFields, + ...(_c = this.pageMetrics) === null || _c === void 0 ? void 0 : _c.pageFields, + }, + }; + await Promise.all(this.pageMetrics.instructions.map((instruction) => { + const { invocationPoints } = instruction; + if (invocationPoints.length === 0 || !invocationPoints.includes(invocationPoint)) { + return; + } + return this.metricsPipeline.process(instruction.data, invocationContext); + })); + } + async didEnterPage() { + this.isViewAppeared = true; + if (optional_1.isSome(this.pageMetrics)) { + await this.processInstructions("pageEnter"); + } + } + async didLeavePage() { + await this.processInstructions("pageExit"); + this.isViewAppeared = false; + } +} +exports.PageMetricsPresenter = PageMetricsPresenter; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/index.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/index.js new file mode 100644 index 0000000..dad3b1c --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/index.js @@ -0,0 +1,14 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./logging-event-recorder"), exports); +__exportStar(require("./metrics-event-recorder"), exports); diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/logging-event-recorder.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/logging-event-recorder.js new file mode 100644 index 0000000..0e5ba43 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/logging-event-recorder.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LoggingEventRecorder = void 0; +class LoggingEventRecorder { + record(event) { + console.log(`Record Event [${String(event.fields.eventType)}]`, event); + } + async flush() { + console.log("Flushing"); + return 0; + } +} +exports.LoggingEventRecorder = LoggingEventRecorder; diff --git a/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/metrics-event-recorder.js b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/metrics-event-recorder.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/lib/metrics/recording/metrics-event-recorder.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/index.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/index.js new file mode 100644 index 0000000..3f77177 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/index.js @@ -0,0 +1,19 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./models"), exports); +__exportStar(require("./types/globals"), exports); +__exportStar(require("./types/javascriptcore"), exports); +__exportStar(require("./types/metrics"), exports); +__exportStar(require("./types/models"), exports); +__exportStar(require("./types/optional"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/json/validation.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/json/validation.js new file mode 100644 index 0000000..1351ad7 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/json/validation.js @@ -0,0 +1,250 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unexpectedNull = exports.catchingContext = exports.context = exports.recordValidationIncidents = exports.endContext = exports.getContextNames = exports.beginContext = exports.messageForRecoveryAction = exports.isValidatable = exports.unexpectedType = exports.extendedTypeof = void 0; +const optional_1 = require("../types/optional"); +/** + * Returns a string containing the type of a given value. + * This function augments the built in `typeof` operator + * to return sensible values for arrays and null values. + * + * @privateRemarks + * This function is exported for testing. + * + * @param value - The value to find the type of. + * @returns A string containing the type of `value`. + */ +function extendedTypeof(value) { + if (Array.isArray(value)) { + return "array"; + } + else if (value === null) { + return "null"; + } + else { + return typeof value; + } +} +exports.extendedTypeof = extendedTypeof; +/** + * Reports a non-fatal validation failure, logging a message to the console. + * @param recovery - The recovery action taken when the bad type was found. + * @param expected - The expected type of the value. + * @param actual - The actual value. + * @param pathString - A string containing the path to the value on the object which failed type validation. + */ +function unexpectedType(recovery, expected, actual, pathString) { + const actualType = extendedTypeof(actual); + const prettyPath = optional_1.isSome(pathString) && pathString.length > 0 ? pathString : "<this>"; + trackIncident({ + type: "badType", + expected: expected, + // Our test assertions are matching the string interpolation of ${actual} value. + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + actual: `${actualType} (${actual})`, + objectPath: prettyPath, + contextNames: getContextNames(), + recoveryAction: recovery, + stack: new Error().stack, + }); +} +exports.unexpectedType = unexpectedType; +// endregion +/** + * Determines if a given object conforms to the Validatable interface + * @param possibleValidatable - An object that might be considered validatable + * + * @returns `true` if it is an instance of Validatable, `false` if not + */ +function isValidatable(possibleValidatable) { + if (optional_1.isNothing(possibleValidatable)) { + return false; + } + // MAINTAINER'S NOTE: We must check for either the existence of a pre-existing incidents + // property *or* the ability to add one. Failure to do so will cause + // problems for clients that either a) use interfaces to define their + // view models; or b) return collections from their service routes. + return (Object.prototype.hasOwnProperty.call(possibleValidatable, "$incidents") || + Object.isExtensible(possibleValidatable)); +} +exports.isValidatable = isValidatable; +/** + * Returns a developer-readable diagnostic message for a given recovery action. + * @param action - The recovery action to get the message for. + * @returns The message for `action`. + */ +function messageForRecoveryAction(action) { + switch (action) { + case "coercedValue": + return "Coerced format"; + case "defaultValue": + return "Default value used"; + case "ignoredValue": + return "Ignored value"; + default: + return "Unknown"; + } +} +exports.messageForRecoveryAction = messageForRecoveryAction; +// region Contexts +/** + * Shared validation context "stack". + * + * Because validation incidents propagate up the context stack, + * the representation used here is optimized for memory usage. + * A more literal representation of this would be a singly linked + * list describing a basic stack, but that will produce a large + * amount of unnecessary garbage and require copying `incidents` + * arrays backwards. + */ +const contextState = { + /// The names of each validation context on the stack. + nameStack: Array(), + /// All incidents reported so far. Cleared when the + /// context stack is emptied. + incidents: Array(), + // TODO: Removal of this is being tracked here: + // <rdar://problem/35015460> Intro Pricing: Un-suppress missing parent 'offers' error when server address missing key + /// The paths for incidents we wish to forgo tracking. + suppressedIncidentPaths: Array(), +}; +/** + * Begin a new validation context with a given name, + * pushing it onto the validation context stack. + * @param name - The name for the validation context. + */ +function beginContext(name) { + contextState.nameStack.push(name); +} +exports.beginContext = beginContext; +/** + * Traverses the validation context stack and collects all of the context names. + * @returns The names of all validation contexts on the stack, from oldest to newest. + */ +function getContextNames() { + if (contextState.nameStack.length === 0) { + return ["<empty stack>"]; + } + return contextState.nameStack.slice(0); +} +exports.getContextNames = getContextNames; +/** + * Ends the current validation context + */ +function endContext() { + if (contextState.nameStack.length === 0) { + console.warn("endContext() called without active validation context, ignoring"); + } + contextState.nameStack.pop(); +} +exports.endContext = endContext; +/** + * Records validation incidents back into an object that implements Validatable. + * + * Note: This method has a side-effect that the incident queue and name stack are cleared + * to prepare for the next thread's invocation. + * + * @param possibleValidatable - An object that may conform to Validatable, onto which we + * want to stash our validation incidents + */ +function recordValidationIncidents(possibleValidatable) { + if (isValidatable(possibleValidatable)) { + possibleValidatable.$incidents = contextState.incidents; + } + contextState.incidents = []; + contextState.nameStack = []; + contextState.suppressedIncidentPaths = []; +} +exports.recordValidationIncidents = recordValidationIncidents; +/** + * Create a transient validation context, and call a function that will return a value. + * + * Prefer this function over manually calling begin/endContext, + * it is exception safe. + * + * @param name - The name of the context + * @param producer - A function that produces a result + * @returns <Result> The resulting type + */ +function context(name, producer, suppressingPath) { + let suppressingName = null; + if (optional_1.isSome(suppressingPath) && suppressingPath.length > 0) { + suppressingName = name; + contextState.suppressedIncidentPaths.push(suppressingPath); + } + let result = null; + try { + beginContext(name); + result = producer(); + } + catch (e) { + // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions + if (!e.hasThrown) { + unexpectedType("defaultValue", "no exception", e.message); + e.hasThrown = true; + } + throw e; + } + finally { + if (name === suppressingName) { + contextState.suppressedIncidentPaths.pop(); + } + endContext(); + } + return result; +} +exports.context = context; +/** + * Create a transient validation context, that catches errors and returns null + * + * @param name - The name of the context + * @param producer - A function that produces a result + * @param caught - An optional handler to provide a value when an error is caught + * @returns <Result> The resulting type + */ +function catchingContext(name, producer, caught) { + let result = null; + try { + result = context(name, producer); + } + catch (e) { + result = null; + if (optional_1.isSome(caught)) { + result = caught(e); + } + } + return result; +} +exports.catchingContext = catchingContext; +/** + * Track an incident within the current validation context. + * @param incident - An incident object describing the problem. + */ +function trackIncident(incident) { + if (contextState.suppressedIncidentPaths.includes(incident.objectPath)) { + return; + } + contextState.incidents.push(incident); +} +// endregion +// region Nullability +/** + * Reports a non-fatal error indicating a value was unexpectedly null. + * @param recovery - The recovery action taken when the null value was found. + * @param expected - The expected type of the value. + * @param pathString - A string containing the path to the value on the object which was null. + */ +function unexpectedNull(recovery, expected, pathString) { + const prettyPath = optional_1.isSome(pathString) && pathString.length > 0 ? pathString : "<this>"; + trackIncident({ + type: "nullValue", + expected: expected, + actual: "null", + objectPath: prettyPath, + contextNames: getContextNames(), + recoveryAction: recovery, + stack: new Error().stack, + }); +} +exports.unexpectedNull = unexpectedNull; +// endregion +//# sourceMappingURL=validation.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/alert-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/alert-action.js new file mode 100644 index 0000000..fcc6ea5 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/alert-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=alert-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/compound-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/compound-action.js new file mode 100644 index 0000000..b3546e5 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/compound-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=compound-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/empty-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/empty-action.js new file mode 100644 index 0000000..efb4d70 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/empty-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=empty-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/external-url-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/external-url-action.js new file mode 100644 index 0000000..479a640 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/external-url-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=external-url-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/flow-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/flow-action.js new file mode 100644 index 0000000..6f70d98 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/flow-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=flow-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/flow-back-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/flow-back-action.js new file mode 100644 index 0000000..75c66a2 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/flow-back-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=flow-back-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/http-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/http-action.js new file mode 100644 index 0000000..e1fb6c3 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/http-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=http-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/http-template-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/http-template-action.js new file mode 100644 index 0000000..6cb84d4 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/http-template-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=http-template-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/index.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/index.js new file mode 100644 index 0000000..5e729a0 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/index.js @@ -0,0 +1,22 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./alert-action"), exports); +__exportStar(require("./compound-action"), exports); +__exportStar(require("./empty-action"), exports); +__exportStar(require("./external-url-action"), exports); +__exportStar(require("./flow-action"), exports); +__exportStar(require("./flow-back-action"), exports); +__exportStar(require("./http-action"), exports); +__exportStar(require("./http-template-action"), exports); +__exportStar(require("./toast-action"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/toast-action.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/toast-action.js new file mode 100644 index 0000000..5d6a299 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/actions/toast-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=toast-action.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/artwork.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/artwork.js new file mode 100644 index 0000000..f13a40c --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/artwork.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeArtworkURLTemplate = void 0; +const validation = require("../json/validation"); +const optional_1 = require("../types/optional"); +const urls_1 = require("../util/urls"); +/** + * Regex to parse artwork URL template string. + */ +const URL_TEMPLATE_PARSER = new RegExp("^({w}|[0-9]+(?:.[0-9]*)?)x({h}|[0-9]+(?:.[0-9]*)?)({c}|[a-z]{2}).({f}|[a-z]+)$"); +/** + * Create an instance of artwork URL template from string. + * @param fromString - String to create artwork URL template from. + * @returns A new artwork URL template or `null` if string + * does not represent a valid artwork URL template. + */ +function makeArtworkURLTemplate(fromString) { + // A valid URL that ends with '{w}x{h}{c}.{f}' + // with any of placeholders possibly resolved to an actual value. + const url = new urls_1.URL(fromString); + if (url.pathname === undefined) { + validation.context("makeArtworkURLTemplate", () => { + validation.unexpectedType("ignoredValue", "A valid URL string", fromString); + }); + return null; + } + // Expecting 5 matches: whole string + width, height, crop code and format. + const lastPathComponent = fromString.substring(fromString.lastIndexOf("/") + 1); + const matches = URL_TEMPLATE_PARSER.exec(lastPathComponent); + if (optional_1.isNothing(matches) || matches.length !== 5) { + validation.context("makeArtworkURLTemplate", () => { + validation.unexpectedType("ignoredValue", "A valid artwork URL template ending with {w}x{h}{c}.{f} format", lastPathComponent); + }); + return null; + } + return fromString; +} +exports.makeArtworkURLTemplate = makeArtworkURLTemplate; +//# sourceMappingURL=artwork.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/button.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/button.js new file mode 100644 index 0000000..036c19a --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/button.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=button.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/color.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/color.js new file mode 100644 index 0000000..c68a1df --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/color.js @@ -0,0 +1,131 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.areEqual = exports.luminanceFrom = exports.dynamicWith = exports.named = exports.rgbWith = exports.htmlWith = void 0; +const optional_1 = require("../types/optional"); +// endregion +// region Constructors +/** + * Create new `HTMLColor` from hexadecimal string representation. + * + * @param hexString - Hexadecimal string representation. + */ +function htmlWith(hexString) { + if (optional_1.isNothing(hexString)) { + return null; + } + return { + $kind: "html", + value: hexString, + }; +} +exports.htmlWith = htmlWith; +/** + * Create new `RBGColor` with RGB components and opacity value. + * + * @param red - Red color value. + * @param green - Green color value. + * @param blue - Blue color value. + * @param alpha - Opacity value. + */ +function rgbWith(red, green, blue, alpha = 1.0) { + const newColor = { + $kind: "rgb", + red: red, + green: green, + blue: blue, + alpha: alpha, + }; + return newColor; +} +exports.rgbWith = rgbWith; +/** + * Create new named color using the color name. + * + * @param name - The name of the color. + */ +function named(name) { + const newColor = { + $kind: "named", + name: name, + }; + return newColor; +} +exports.named = named; +/** + * Create new dynamic color with light and dark color variants. + * + * @param lightColor - The light color variant. + * @param lightHighContrastColor - The light hight-contrast color variant. + * @param darkColor - The dark color variant. + * @param darkHighContrastColor - The dark hight-contrast color variant. + */ +function dynamicWith(lightColor, lightHighContrastColor, darkColor, darkHighContrastColor) { + const newColor = { + $kind: "dynamic", + lightColor: lightColor, + lightHighContrastColor: lightHighContrastColor, + darkColor: darkColor, + darkHighContrastColor: darkHighContrastColor, + }; + return newColor; +} +exports.dynamicWith = dynamicWith; +// endregion +// region Properties +/** + * Get the luminance of the color. + * + * @param rgbColor - The RGB color to get luminance for. + */ +function luminanceFrom(rgbColor) { + // Note: This is lifted from UIColor_Private + // Using RGB color components, calculates and returns (0.2126 * r) + (0.7152 * g) + (0.0722 * b). + return rgbColor.red * 0.2126 + rgbColor.green * 0.7152 + rgbColor.blue * 0.0722; +} +exports.luminanceFrom = luminanceFrom; +// endregion +// region Identity +/** + * Compare two colors for equality. + * + * @param color1 - Left hand side color to compare. + * @param color2 - Right hand side color to compare. + * @returns A Boolean indicating whether the colors are equal. + */ +function areEqual(color1, color2) { + if (optional_1.isNothing(color1)) { + return optional_1.isNothing(color2); + } + else if (optional_1.isNothing(color2)) { + return optional_1.isNothing(color1); + } + const kind1 = color1.$kind; + const kind2 = color2.$kind; + if (kind1 === "named" && kind2 === "named") { + const namedColor1 = color1; + const namedColor2 = color2; + return namedColor1.name === namedColor2.name; + } + else if (kind1 === "rgb" && kind2 === "rgb") { + const rgbColor1 = color1; + const rgbColor2 = color2; + return (rgbColor1.red === rgbColor2.red && + rgbColor1.green === rgbColor2.green && + rgbColor1.blue === rgbColor2.blue && + rgbColor1.alpha === rgbColor2.alpha); + } + else if (kind1 === "dynamic" && kind2 === "dynamic") { + const dynamicColor1 = color1; + const dynamicColor2 = color2; + return (areEqual(dynamicColor1.lightColor, dynamicColor2.lightColor) && + areEqual(dynamicColor1.lightHighContrastColor, dynamicColor2.lightHighContrastColor) && + areEqual(dynamicColor1.darkColor, dynamicColor2.darkColor) && + areEqual(dynamicColor1.darkHighContrastColor, dynamicColor2.darkHighContrastColor)); + } + else { + return false; + } +} +exports.areEqual = areEqual; +// endregion +//# sourceMappingURL=color.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/index.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/index.js new file mode 100644 index 0000000..19009ad --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/index.js @@ -0,0 +1,21 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./actions"), exports); +__exportStar(require("./artwork"), exports); +__exportStar(require("./button"), exports); +__exportStar(require("./color"), exports); +__exportStar(require("./menu"), exports); +__exportStar(require("./paragraph"), exports); +__exportStar(require("./programmed-text"), exports); +__exportStar(require("./video"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/menu.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/menu.js new file mode 100644 index 0000000..200dc6b --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/menu.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.menuSeparatorID = void 0; +/** + * A standard identifier for including a separator in a menu. + */ +exports.menuSeparatorID = "com.apple.JetEngine.separator"; +//# sourceMappingURL=menu.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/paragraph.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/paragraph.js new file mode 100644 index 0000000..3518ea7 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/paragraph.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// endregion +//# sourceMappingURL=paragraph.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/programmed-text.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/programmed-text.js new file mode 100644 index 0000000..18a8337 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/programmed-text.js @@ -0,0 +1,5 @@ +"use strict"; +// region ProgrammedText +Object.defineProperty(exports, "__esModule", { value: true }); +// endregion +//# sourceMappingURL=programmed-text.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/video.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/video.js new file mode 100644 index 0000000..0f0031f --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/models/video.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=video.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/bag.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/bag.js new file mode 100644 index 0000000..ffe6106 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/bag.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=bag.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/bundle.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/bundle.js new file mode 100644 index 0000000..9a818e7 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/bundle.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=bundle.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/cookie-provider.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/cookie-provider.js new file mode 100644 index 0000000..e681941 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/cookie-provider.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=cookie-provider.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/cryptography.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/cryptography.js new file mode 100644 index 0000000..de648d8 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/cryptography.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=cryptography.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/host.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/host.js new file mode 100644 index 0000000..9dbd12d --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/host.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=host.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/index.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/index.js new file mode 100644 index 0000000..028f856 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/index.js @@ -0,0 +1,51 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +/* `preprocessor` and `testContent` are normally replaced by inline literals while bundling an app's JS. + * + * If these values have not been set we want to provide defaults however + * attempting to access them can trigger a ReferenceError as the + * variables are undefined (distinct from a defined variable being set to + * `undefined`). + * + * `typeof` checks can safely test undefined variables, note that these checks will become: + * `typeof { DEBUG_BUILD: true, ... }` when webpack's DefinePlugin is used in @jet/build's webpack task. + * When these variables have not been replaced we need to use `globalThis` to set them on the global scope + * in order to avoid ReferenceErrors attempting to access them. + */ +if (typeof preprocessor === "undefined") { + globalThis.preprocessor = { + PRODUCTION_BUILD: false, + CARRY_BUILD: false, + DEBUG_BUILD: false, + INTERNAL_BUILD: false, + }; +} +if (typeof testContent === "undefined") { + globalThis.testContent = { + INCLUDE_TEST_CONTENT: false, + }; +} +__exportStar(require("./bag"), exports); +__exportStar(require("./bundle"), exports); +__exportStar(require("./cookie-provider"), exports); +__exportStar(require("./cryptography"), exports); +__exportStar(require("./host"), exports); +__exportStar(require("./jscookie"), exports); +__exportStar(require("./net"), exports); +__exportStar(require("./platform"), exports); +__exportStar(require("./plist"), exports); +__exportStar(require("./preprocessor"), exports); +__exportStar(require("./random"), exports); +__exportStar(require("./service"), exports); +__exportStar(require("./types"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/jscookie.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/jscookie.js new file mode 100644 index 0000000..bfd5e29 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/jscookie.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=jscookie.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/net.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/net.js new file mode 100644 index 0000000..6b810d4 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/net.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=net.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/platform.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/platform.js new file mode 100644 index 0000000..eafaa33 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/platform.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=platform.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/plist.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/plist.js new file mode 100644 index 0000000..29503e6 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/plist.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=plist.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/preprocessor.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/preprocessor.js new file mode 100644 index 0000000..a04398d --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/preprocessor.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=preprocessor.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/random.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/random.js new file mode 100644 index 0000000..3484776 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/random.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=random.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/service.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/service.js new file mode 100644 index 0000000..a4b3c49 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/service.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=service.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/types.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/types.js new file mode 100644 index 0000000..62c2e70 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/globals/types.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.services = exports.random = exports.plist = exports.platform = exports.net = exports.localizer = exports.host = exports.cryptography = exports.cookieProvider = exports.bundle = exports.bag = void 0; +const metatype_1 = require("../../util/metatype"); +exports.bag = metatype_1.makeMetatype("jet-engine:bag"); +exports.bundle = metatype_1.makeMetatype("jet-engine:bundle"); +exports.cookieProvider = metatype_1.makeMetatype("jet-engine:cookieProvider"); +exports.cryptography = metatype_1.makeMetatype("jet-engine:cryptography"); +exports.host = metatype_1.makeMetatype("jet-engine:host"); +exports.localizer = metatype_1.makeMetatype("jet-engine:localizer"); +exports.net = metatype_1.makeMetatype("jet-engine:net"); +exports.platform = metatype_1.makeMetatype("jet-engine:platform"); +exports.plist = metatype_1.makeMetatype("jet-engine:plist"); +exports.random = metatype_1.makeMetatype("jet-engine:random"); +exports.services = metatype_1.makeMetatype("jet-engine:services"); +//# sourceMappingURL=types.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/javascriptcore/console.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/javascriptcore/console.js new file mode 100644 index 0000000..c4fb39a --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/javascriptcore/console.js @@ -0,0 +1,14 @@ +"use strict"; +/* + * Describes standard functionality available in JSContexts + * + * Types are defined here to allow us to match the behavior available in JSContext in the target OS + * which may not exactly match the definitions in standard TypeScript lib files, particularly on a + * pre-release OS. + * + * The living standard for the Console API is available at https://console.spec.whatwg.org + * The WebKit team has documented their interfaces at https://webkit.org/web-inspector/console-object-api/ + * The equivalent interface in Node is https://nodejs.org/api/console.html + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=console.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/javascriptcore/index.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/javascriptcore/index.js new file mode 100644 index 0000000..ee0a3fc --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/javascriptcore/index.js @@ -0,0 +1,14 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./console"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/metrics.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/metrics.js new file mode 100644 index 0000000..565e4b9 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/metrics.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.notInstrumented = exports.PageInvocationPoint = exports.EMPTY_LINTED_METRICS_EVENT = void 0; +/** + * An empty linted metrics event. + * + * The empty events should be skipped from recording + * by metrics event recorders. + */ +exports.EMPTY_LINTED_METRICS_EVENT = { + fields: {}, + issues: [], +}; +var PageInvocationPoint; +(function (PageInvocationPoint) { + PageInvocationPoint["pageEnter"] = "pageEnter"; + PageInvocationPoint["pageExit"] = "pageExit"; + PageInvocationPoint["appExit"] = "appExit"; + PageInvocationPoint["appEnter"] = "appEnter"; + PageInvocationPoint["backButton"] = "backButton"; +})(PageInvocationPoint = exports.PageInvocationPoint || (exports.PageInvocationPoint = {})); +/** + * Returns an empty metrics instance of the specified metrics type. + * @param metricsType - Type of the metrics data to return. + * + * @deprecated Do not use, all metrics events should be instrumented. + */ +function notInstrumented(metricsType) { + switch (metricsType) { + case 0 /* ActionMetrics */: + return { + data: [], + custom: {}, + }; + case 1 /* FetchTimingMetrics */: + return {}; + case 2 /* PageMetrics */: + return { + instructions: [], + custom: {}, + }; + case 3 /* ImpressionMetrics */: + return { + id: { + id: "", + impressionIndex: NaN, + }, + fields: {}, + custom: {}, + }; + default: + return {}; + } +} +exports.notInstrumented = notInstrumented; +// endregion +//# sourceMappingURL=metrics.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/models.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/models.js new file mode 100644 index 0000000..b2dccd6 --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/models.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=models.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/optional.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/optional.js new file mode 100644 index 0000000..ea3aaeb --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/types/optional.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.flatMapOptional = exports.mapOptional = exports.unsafeUnwrapOptional = exports.unwrapOptional = exports.isSome = exports.isNothing = exports.unsafeUninitialized = void 0; +/** + * Bypass the protection provided by the `Optional` type + * and pretend to produce a value of `Some<T>` while + * actually returning `Nothing`. + */ +function unsafeUninitialized() { + return undefined; +} +exports.unsafeUninitialized = unsafeUninitialized; +/** + * Test whether an optional does not contain a value. + * + * @param value - An optional value to test. + */ +function isNothing(value) { + return value === undefined || value === null; +} +exports.isNothing = isNothing; +/** + * Test whether an optional contains a value. + * @param value - An optional value to test. + */ +function isSome(value) { + return value !== undefined && value !== null; +} +exports.isSome = isSome; +/** + * Unwrap the value contained in a given optional, + * throwing an error if there is no value. + * + * @param value - A value to unwrap. + */ +function unwrapOptional(value) { + if (isNothing(value)) { + throw new ReferenceError(); + } + return value; +} +exports.unwrapOptional = unwrapOptional; +/** + * Unwrap the value contained in a given optional + * without checking if the value exists. + * + * @param value - A value to unwrap. + */ +function unsafeUnwrapOptional(value) { + return value; +} +exports.unsafeUnwrapOptional = unsafeUnwrapOptional; +function mapOptional(value, body) { + if (isSome(value)) { + return body(value); + } + else { + return value; + } +} +exports.mapOptional = mapOptional; +function flatMapOptional(value, body) { + if (isSome(value)) { + return body(value); + } + else { + return value; + } +} +exports.flatMapOptional = flatMapOptional; +//# sourceMappingURL=optional.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/util/metatype.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/util/metatype.js new file mode 100644 index 0000000..372f58f --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/util/metatype.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeMetatype = void 0; +function makeMetatype(name) { + return { + name: name, + }; +} +exports.makeMetatype = makeMetatype; +//# sourceMappingURL=metatype.js.map
\ No newline at end of file diff --git a/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/util/urls.js b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/util/urls.js new file mode 100644 index 0000000..fd7ec3e --- /dev/null +++ b/shared/metrics-8/node_modules/@jet/engine/node_modules/@jet/environment/util/urls.js @@ -0,0 +1,370 @@ +"use strict"; +// MARK: - Parsing Regular Expressions +Object.defineProperty(exports, "__esModule", { value: true }); +exports.URL = void 0; +const optional_1 = require("../types/optional"); +const protocolRegex = /^([a-z][a-z0-9.+-]*:)(\/\/)?([\S\s]*)/i; +const queryParamRegex = /([^=?&]+)=?([^&]*)/g; +const componentOrder = ["hash", "query", "pathname", "host"]; +class URL { + constructor(url) { + var _a; + this.query = {}; + if (optional_1.isNothing(url)) { + return; + } + // Split the protocol from the rest of the urls + let remainder = url; + const match = protocolRegex.exec(url); + if (optional_1.isSome(match)) { + // Pull out the protocol + let protocol = match[1]; + if (protocol !== null && protocol !== undefined) { + protocol = protocol.split(":")[0]; + } + this.protocol = protocol !== null && protocol !== void 0 ? protocol : undefined; + // Save the remainder + remainder = (_a = match[3]) !== null && _a !== void 0 ? _a : undefined; + } + // Then match each component in a specific order + let parse = { remainder: remainder, result: undefined }; + for (const component of componentOrder) { + if (parse === undefined || parse.remainder === undefined) { + break; + } + switch (component) { + case "hash": { + parse = splitUrlComponent(parse.remainder, "#", "suffix"); + this.hash = parse === null || parse === void 0 ? void 0 : parse.result; + break; + } + case "query": { + parse = splitUrlComponent(parse.remainder, "?", "suffix"); + if ((parse === null || parse === void 0 ? void 0 : parse.result) !== undefined) { + this.query = URL.queryFromString(parse.result); + } + break; + } + case "pathname": { + parse = splitUrlComponent(parse.remainder, "/", "suffix"); + if ((parse === null || parse === void 0 ? void 0 : parse.result) !== undefined) { + // Replace the initial /, since paths require it + this.pathname = "/" + parse.result; + } + break; + } + case "host": { + const authorityParse = splitUrlComponent(parse.remainder, "@", "prefix"); + const userInfo = authorityParse === null || authorityParse === void 0 ? void 0 : authorityParse.result; + const hostPort = authorityParse === null || authorityParse === void 0 ? void 0 : authorityParse.remainder; + if (userInfo !== undefined) { + const userInfoSplit = userInfo.split(":"); + this.username = decodeURIComponent(userInfoSplit[0]); + this.password = decodeURIComponent(userInfoSplit[1]); + } + if (hostPort !== undefined) { + const hostPortSplit = hostPort.split(":"); + this.host = hostPortSplit[0]; + this.port = hostPortSplit[1]; + } + break; + } + default: { + throw new Error("Unhandled case!"); + } + } + } + } + get(component) { + switch (component) { + // Exhaustive match to make sure TS property minifiers and other + // transformer plugins do not break this code. + case "protocol": + return this.protocol; + case "username": + return this.username; + case "password": + return this.password; + case "port": + return this.port; + case "pathname": + return this.pathname; + case "query": + return this.query; + case "hash": + return this.hash; + default: + // The fallback for component which is not a property of URL object. + return this[component]; + } + } + set(component, value) { + if (value === undefined) { + return this; + } + if (component === "query") { + if (typeof value === "string") { + value = URL.queryFromString(value); + } + } + switch (component) { + // Exhaustive match to make sure TS property minifiers and other + // transformer plugins do not break this code. + case "protocol": + this.protocol = value; + break; + case "username": + this.username = value; + break; + case "password": + this.password = value; + break; + case "port": + this.port = value; + break; + case "pathname": + this.pathname = value; + break; + case "query": + this.query = value; + break; + case "hash": + this.hash = value; + break; + default: + // The fallback for component which is not a property of URL object. + this[component] = value; + break; + } + return this; + } + append(component, value) { + let existingValue = this.get(component); + let newValue; + if (component === "query") { + if (existingValue === undefined) { + existingValue = {}; + } + if (typeof value === "string") { + value = URL.queryFromString(value); + } + if (typeof existingValue === "string") { + newValue = { existingValue, ...value }; + } + else { + newValue = { ...existingValue, ...value }; + } + } + else { + if (existingValue === undefined) { + existingValue = ""; + } + let existingValueString = existingValue; + if (existingValueString === undefined) { + existingValueString = ""; + } + let newValueString = existingValueString; + if (component === "pathname") { + const pathLength = existingValueString.length; + if (pathLength === 0 || existingValue[pathLength - 1] !== "/") { + newValueString += "/"; + } + } + // The component is not "query" so we treat value as string. + // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-plus-operands + newValueString += value; + newValue = newValueString; + } + return this.set(component, newValue); + } + param(key, value) { + if (key === null) { + return this; + } + if (this.query === undefined) { + this.query = {}; + } + if (value === undefined) { + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete this.query[key]; + } + else { + this.query[key] = value; + } + return this; + } + removeParam(key) { + if (key === undefined || this.query === undefined) { + return this; + } + if (key in this.query) { + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete this.query[key]; + } + return this; + } + path(value) { + return this.append("pathname", value); + } + pathExtension() { + var _a, _b; + // Extract path extension if one exists + if (this.pathname === undefined) { + return undefined; + } + const lastFilenameComponents = (_b = (_a = this.pathname + .split("/") + .filter((item) => item.length > 0) // Remove any double or trailing slashes + .pop()) === null || _a === void 0 ? void 0 : _a.split(".")) !== null && _b !== void 0 ? _b : []; + if (lastFilenameComponents.filter(function (part) { + return part !== ""; + }).length < 2 // Remove any empty parts (e.g. .ssh_config -> ["ssh_config"]) + ) { + return undefined; + } + return lastFilenameComponents.pop(); + } + /** + * Returns the path components of the URL + * @returns An array of non-empty path components from `urls`. + */ + pathComponents() { + if (this.pathname === undefined) { + return []; + } + return this.pathname.split("/").filter((component) => component.length > 0); + } + /** + * Same as toString + * + * @returns A string representation of the URL + */ + build() { + return this.toString(); + } + /** + * Converts the URL to a string + * + * @returns A string representation of the URL + */ + toString() { + let url = ""; + if (this.protocol !== undefined) { + url += this.protocol + "://"; + } + if (this.username !== undefined) { + url += encodeURIComponent(this.username); + if (this.password !== undefined) { + url += ":" + encodeURIComponent(this.password); + } + url += "@"; + } + if (this.host !== undefined) { + url += this.host; + if (this.port !== undefined) { + url += ":" + this.port; + } + } + if (this.pathname !== undefined) { + url += this.pathname; + } + if (this.query !== undefined && Object.keys(this.query).length !== 0) { + url += "?" + URL.toQueryString(this.query); + } + if (this.hash !== undefined) { + url += "#" + this.hash; + } + return url; + } + // ---------------- + // Static API + // ---------------- + /** + * Converts a string into a query dictionary + * @param query - The string to parse + * @returns The query dictionary containing the key-value pairs in the query string + */ + static queryFromString(query) { + const result = {}; + let parseResult = queryParamRegex.exec(query); + while (parseResult !== null) { + const key = decodeURIComponent(parseResult[1]); + const value = decodeURIComponent(parseResult[2]); + result[key] = value; + parseResult = queryParamRegex.exec(query); + } + return result; + } + /** + * Converts a query dictionary into a query string + * + * @param query - The query dictionary + * @returns The string representation of the query dictionary + */ + static toQueryString(query) { + let queryString = ""; + let first = true; + for (const key of Object.keys(query)) { + if (!first) { + queryString += "&"; + } + first = false; + queryString += encodeURIComponent(key); + const value = query[key]; + if (value !== null && value.length > 0) { + queryString += "=" + encodeURIComponent(value); + } + } + return queryString; + } + /** + * Convenience method to instantiate a URL from a string + * @param url - The URL string to parse + * @returns The new URL object representing the URL + */ + static from(url) { + return new URL(url); + } + /** + * Convenience method to instantiate a URL from numerous (optional) components + * @param protocol - The protocol type + * @param host - The host name + * @param path - The path + * @param query - The query + * @param hash - The hash + * @returns The new URL object representing the URL + */ + static fromComponents(protocol, host, path, query, hash) { + const url = new URL(); + url.protocol = protocol; + url.host = host; + url.pathname = path; + url.query = query !== null && query !== void 0 ? query : {}; + url.hash = hash; + return url; + } +} +exports.URL = URL; +// MARK: - Helpers +function splitUrlComponent(input, marker, style) { + const index = input.indexOf(marker); + let result; + let remainder = input; + if (index !== -1) { + const prefix = input.slice(0, index); + const suffix = input.slice(index + marker.length, input.length); + if (style === "prefix") { + result = prefix; + remainder = suffix; + } + else { + result = suffix; + remainder = prefix; + } + } + return { + result: result, + remainder: remainder, + }; +} +//# sourceMappingURL=urls.js.map
\ No newline at end of file |
