@slicemachine/manager 0.24.15-beta.8 → 0.24.15-beta.9
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/_node_modules/@amplitude/analytics-core/_node_modules/tslib/tslib.es6.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-core/_node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/debug.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-node/_node_modules/tslib/tslib.es6.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-node/_node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-core/dist/experiment-core.esm.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-core/dist/experiment-core.esm.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-service.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-service.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/cookie.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/cookie.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cache.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cache.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.cjs +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/poller.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/remote/client.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js.map +1 -1
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.cjs.map +1 -1
- package/dist/_node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.js.map +1 -1
- package/dist/_node_modules/cross-spawn/index.cjs +1 -1
- package/dist/_node_modules/cross-spawn/index.js +1 -1
- package/dist/_node_modules/cross-spawn/lib/enoent.cjs.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/enoent.js.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/parse.cjs.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/parse.js.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/util/escape.cjs.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/util/escape.js.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/util/readShebang.cjs.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/util/readShebang.js.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/util/resolveCommand.cjs.map +1 -1
- package/dist/_node_modules/cross-spawn/lib/util/resolveCommand.js.map +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -1
- package/dist/_node_modules/execa/_node_modules/onetime/index.cjs.map +1 -1
- package/dist/_node_modules/execa/_node_modules/onetime/index.js.map +1 -1
- package/dist/_node_modules/execa/index.cjs.map +1 -1
- package/dist/_node_modules/execa/index.js.map +1 -1
- package/dist/_node_modules/execa/lib/command.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/command.js.map +1 -1
- package/dist/_node_modules/execa/lib/error.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/error.js.map +1 -1
- package/dist/_node_modules/execa/lib/kill.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/kill.js.map +1 -1
- package/dist/_node_modules/execa/lib/promise.cjs +2 -2
- package/dist/_node_modules/execa/lib/promise.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/promise.js +2 -2
- package/dist/_node_modules/execa/lib/promise.js.map +1 -1
- package/dist/_node_modules/execa/lib/stdio.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/stdio.js.map +1 -1
- package/dist/_node_modules/execa/lib/stream.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/stream.js.map +1 -1
- package/dist/_node_modules/execa/lib/verbose.cjs.map +1 -1
- package/dist/_node_modules/execa/lib/verbose.js.map +1 -1
- package/dist/_node_modules/fetch-blob/file.cjs.map +1 -1
- package/dist/_node_modules/fetch-blob/file.js.map +1 -1
- package/dist/_node_modules/fetch-blob/index.cjs.map +1 -1
- package/dist/_node_modules/fetch-blob/index.js.map +1 -1
- package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -1
- package/dist/_node_modules/fetch-blob/streams.js.map +1 -1
- package/dist/_node_modules/file-type/core.cjs.map +1 -1
- package/dist/_node_modules/file-type/core.js.map +1 -1
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -1
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -1
- package/dist/_node_modules/get-port/index.cjs.map +1 -1
- package/dist/_node_modules/get-port/index.js.map +1 -1
- package/dist/_node_modules/get-stream/index.cjs.map +1 -1
- package/dist/_node_modules/get-stream/index.js.map +1 -1
- package/dist/_node_modules/human-signals/build/src/realtime.cjs.map +1 -1
- package/dist/_node_modules/human-signals/build/src/realtime.js.map +1 -1
- package/dist/_node_modules/isexe/index.cjs.map +1 -1
- package/dist/_node_modules/isexe/index.js.map +1 -1
- package/dist/_node_modules/mimic-fn/index.cjs.map +1 -1
- package/dist/_node_modules/mimic-fn/index.js.map +1 -1
- package/dist/_node_modules/node-domexception/index.cjs.map +1 -1
- package/dist/_node_modules/node-domexception/index.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/body.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/headers.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/request.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/is.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -1
- package/dist/_node_modules/p-limit/index.cjs.map +1 -1
- package/dist/_node_modules/p-limit/index.js.map +1 -1
- package/dist/_node_modules/r19/dist/handleRPCRequest.cjs.map +1 -1
- package/dist/_node_modules/r19/dist/handleRPCRequest.js.map +1 -1
- package/dist/_node_modules/shebang-command/index.cjs.map +1 -1
- package/dist/_node_modules/shebang-command/index.js.map +1 -1
- package/dist/_node_modules/signal-exit/index.cjs.map +1 -1
- package/dist/_node_modules/signal-exit/index.js.map +1 -1
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -1
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -1
- package/dist/_node_modules/which/which.cjs.map +1 -1
- package/dist/_node_modules/which/which.js.map +1 -1
- package/dist/_node_modules/zod/lib/index.cjs.map +1 -1
- package/dist/_node_modules/zod/lib/index.js.map +1 -1
- package/dist/_virtual/_commonjsHelpers.cjs +1 -4
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -1
- package/dist/_virtual/_commonjsHelpers.js +1 -4
- package/dist/_virtual/_commonjsHelpers.js.map +1 -1
- package/dist/_virtual/index2.cjs +3 -4
- package/dist/_virtual/index2.cjs.map +1 -1
- package/dist/_virtual/index2.js +2 -4
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/_virtual/index3.cjs +4 -3
- package/dist/_virtual/index3.cjs.map +1 -1
- package/dist/_virtual/index3.js +4 -2
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/auth/PrismicAuthManager.cjs.map +1 -1
- package/dist/auth/PrismicAuthManager.js.map +1 -1
- package/dist/auth/createPrismicAuthManagerMiddleware.cjs.map +1 -1
- package/dist/auth/createPrismicAuthManagerMiddleware.js.map +1 -1
- package/dist/constants/API_ENDPOINTS.cjs.map +1 -1
- package/dist/constants/API_ENDPOINTS.js.map +1 -1
- package/dist/constants/API_TOKENS.cjs.map +1 -1
- package/dist/constants/API_TOKENS.js.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/getEnvironmentInfo.cjs.map +1 -1
- package/dist/getEnvironmentInfo.js.map +1 -1
- package/dist/lib/DecodeError.cjs.map +1 -1
- package/dist/lib/DecodeError.js.map +1 -1
- package/dist/lib/buildPrismicRepositoryAPIEndpoint.cjs.map +1 -1
- package/dist/lib/buildPrismicRepositoryAPIEndpoint.js.map +1 -1
- package/dist/lib/fetchGitHubReleaseBodyForRelease.cjs.map +1 -1
- package/dist/lib/fetchGitHubReleaseBodyForRelease.js.map +1 -1
- package/dist/lib/fetchNPMPackageVersions.cjs.map +1 -1
- package/dist/lib/fetchNPMPackageVersions.js.map +1 -1
- package/dist/lib/installDependencies.cjs.map +1 -1
- package/dist/lib/installDependencies.js.map +1 -1
- package/dist/lib/locateFileUpward.cjs.map +1 -1
- package/dist/lib/locateFileUpward.js.map +1 -1
- package/dist/lib/prismicrc.cjs.map +1 -1
- package/dist/lib/prismicrc.js.map +1 -1
- package/dist/managers/SliceMachineManager.cjs.map +1 -1
- package/dist/managers/SliceMachineManager.js.map +1 -1
- package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -1
- package/dist/managers/customTypes/CustomTypesManager.js.map +1 -1
- package/dist/managers/git/GitManager.cjs.map +1 -1
- package/dist/managers/git/GitManager.js.map +1 -1
- package/dist/managers/git/buildGitRepoSpecifier.cjs.map +1 -1
- package/dist/managers/git/buildGitRepoSpecifier.js.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.cjs.map +1 -1
- package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -1
- package/dist/managers/project/ProjectManager.cjs.map +1 -1
- package/dist/managers/project/ProjectManager.js.map +1 -1
- package/dist/managers/screenshots/ScreenshotsManager.cjs.map +1 -1
- package/dist/managers/screenshots/ScreenshotsManager.js.map +1 -1
- package/dist/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.cjs.map +1 -1
- package/dist/managers/sliceTemplateLibrary/SliceTemplateLibraryManager.js.map +1 -1
- package/dist/managers/slices/SlicesManager.cjs.map +1 -1
- package/dist/managers/slices/SlicesManager.js.map +1 -1
- package/dist/managers/telemetry/TelemetryManager.cjs.map +1 -1
- package/dist/managers/telemetry/TelemetryManager.js.map +1 -1
- package/dist/managers/versions/VersionsManager.cjs.map +1 -1
- package/dist/managers/versions/VersionsManager.js.map +1 -1
- package/package.json +3 -3
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("../../../../../../_virtual/_commonjsHelpers.cjs");
|
3
3
|
const client = require("../../../../../../_virtual/client2.cjs");
|
4
|
-
const index = require("../../../../../../_virtual/
|
4
|
+
const index = require("../../../../../../_virtual/index3.cjs");
|
5
5
|
const experimentCore_esm = require("../../../../../../_virtual/experiment-core.esm.cjs");
|
6
6
|
require("../assignment/assignment.cjs");
|
7
7
|
require("../assignment/assignment-filter.cjs");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/client.js"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __rest = (this && this.__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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LocalEvaluationClient = void 0;\nconst amplitude = __importStar(require(\"@amplitude/analytics-node\"));\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst assignment_1 = require(\"../assignment/assignment\");\nconst assignment_filter_1 = require(\"../assignment/assignment-filter\");\nconst assignment_service_1 = require(\"../assignment/assignment-service\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst user_1 = require(\"../util/user\");\nconst variant_1 = require(\"../util/variant\");\nconst cache_1 = require(\"./cache\");\nconst fetcher_1 = require(\"./fetcher\");\nconst poller_1 = require(\"./poller\");\n/**\n * Experiment client for evaluating variants for a user locally.\n * @category Core Usage\n */\nclass LocalEvaluationClient {\n constructor(apiKey, config, flagConfigCache, httpClient = new http_1.FetchHttpClient(config === null || config === void 0 ? void 0 : config.httpAgent)) {\n this.config = Object.assign(Object.assign({}, config_1.LocalEvaluationDefaults), config);\n const fetcher = new fetcher_1.FlagConfigFetcher(apiKey, httpClient, this.config.serverUrl, this.config.debug);\n this.cache = new cache_1.InMemoryFlagConfigCache(flagConfigCache, this.config.bootstrap);\n this.logger = new logger_1.ConsoleLogger(this.config.debug);\n this.poller = new poller_1.FlagConfigPoller(fetcher, this.cache, this.config.flagConfigPollingIntervalMillis, this.config.debug);\n if (this.config.assignmentConfig) {\n this.config.assignmentConfig = Object.assign(Object.assign({}, config_1.AssignmentConfigDefaults), this.config.assignmentConfig);\n this.assignmentService = this.createAssignmentService(this.config.assignmentConfig);\n }\n this.evaluation = new experiment_core_1.EvaluationEngine();\n }\n createAssignmentService(assignmentConfig) {\n const instance = amplitude.createInstance();\n const { apiKey, cacheCapacity } = assignmentConfig, ampConfig = __rest(assignmentConfig, [\"apiKey\", \"cacheCapacity\"]);\n instance.init(apiKey, ampConfig);\n return new assignment_service_1.AmplitudeAssignmentService(instance, new assignment_filter_1.InMemoryAssignmentFilter(cacheCapacity));\n }\n /**\n * Locally evaluate varints for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * Unlike {@link evaluate}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n */\n evaluateV2(user, flagKeys) {\n var _a;\n const flags = this.cache.getAllCached();\n this.logger.debug('[Experiment] evaluate - user:', user, 'flags:', flags);\n const context = (0, user_1.convertUserToEvaluationContext)(user);\n const sortedFlags = (0, experiment_core_1.topologicalSort)(flags, flagKeys);\n const results = this.evaluation.evaluate(context, sortedFlags);\n void ((_a = this.assignmentService) === null || _a === void 0 ? void 0 : _a.track(new assignment_1.Assignment(user, results)));\n this.logger.debug('[Experiment] evaluate - variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n }\n /**\n * Locally evaluates flag variants for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n * @deprecated use evaluateV2 instead\n */\n evaluate(user, flagKeys) {\n return __awaiter(this, void 0, void 0, function* () {\n const results = this.evaluateV2(user, flagKeys);\n return (0, variant_1.filterDefaultVariants)(results);\n });\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.poller.start();\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n return this.poller.stop();\n }\n}\nexports.LocalEvaluationClient = LocalEvaluationClient;\n"],"names":["this","client","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","require$$6","require$$7","require$$8","require$$9","require$$10","require$$11","require$$12","config","fetcher","user"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAI,kBAAmBA,iBAAAA,kBAAQA,iBAAI,eAAC,oBAAqB,OAAO,SAAU,SAAS,GAAG,GAAG,GAAG,IAAI;AAC5F,MAAI,OAAO;AAAW,SAAK;AAC3B,MAAI,OAAO,OAAO,yBAAyB,GAAG,CAAC;AAC/C,MAAI,CAAC,SAAS,SAAS,OAAO,CAAC,EAAE,aAAa,KAAK,YAAY,KAAK,eAAe;AACjF,WAAO,EAAE,YAAY,MAAM,KAAK,WAAW;AAAE,aAAO,EAAE,CAAC;AAAA,IAAE;E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AAK;AACxE,UAAM,WAAc,GAAA,OAAO,gCAAgCA,KAAI;AAC/D,UAAM,eAAc,GAAI,kBAAkB,iBAAiB,OAAO,QAAQ;AAC1E,UAAM,UAAU,KAAK,WAAW,SAAS,SAAS,WAAW;AAC7D,WAAO,KAAK,KAAK,uBAAuB,QAAQ,OAAO,SAAS,SAAS,GAAG,MAAM,IAAI,aAAa,WAAWA,OAAM,OAAO,CAAC;AAC5H,SAAK,OAAO,MAAM,sCAAsC,OAAO;AAC/D,eAAW,UAAU,8BAA8B,OAAO;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcD,SAASA,OAAM,UAAU;AACrB,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,YAAM,UAAU,KAAK,WAAWA,OAAM,QAAQ;AAC9C,iBAAW,UAAU,uBAAuB,OAAO;AAAA,IAC/D,CAAS;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,QAAQ;AACJ,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,aAAO,MAAM,KAAK,OAAO;IACrC,CAAS;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMD,OAAO;AACH,WAAO,KAAK,OAAO;EACtB;AACL;AACAhB,OAAA,UAAA,wBAAgC;;","x_google_ignoreList":[0]}
|
1
|
+
{"version":3,"file":"client.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/client.js"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __rest = (this && this.__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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LocalEvaluationClient = void 0;\nconst amplitude = __importStar(require(\"@amplitude/analytics-node\"));\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst assignment_1 = require(\"../assignment/assignment\");\nconst assignment_filter_1 = require(\"../assignment/assignment-filter\");\nconst assignment_service_1 = require(\"../assignment/assignment-service\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst user_1 = require(\"../util/user\");\nconst variant_1 = require(\"../util/variant\");\nconst cache_1 = require(\"./cache\");\nconst fetcher_1 = require(\"./fetcher\");\nconst poller_1 = require(\"./poller\");\n/**\n * Experiment client for evaluating variants for a user locally.\n * @category Core Usage\n */\nclass LocalEvaluationClient {\n constructor(apiKey, config, flagConfigCache, httpClient = new http_1.FetchHttpClient(config === null || config === void 0 ? void 0 : config.httpAgent)) {\n this.config = Object.assign(Object.assign({}, config_1.LocalEvaluationDefaults), config);\n const fetcher = new fetcher_1.FlagConfigFetcher(apiKey, httpClient, this.config.serverUrl, this.config.debug);\n this.cache = new cache_1.InMemoryFlagConfigCache(flagConfigCache, this.config.bootstrap);\n this.logger = new logger_1.ConsoleLogger(this.config.debug);\n this.poller = new poller_1.FlagConfigPoller(fetcher, this.cache, this.config.flagConfigPollingIntervalMillis, this.config.debug);\n if (this.config.assignmentConfig) {\n this.config.assignmentConfig = Object.assign(Object.assign({}, config_1.AssignmentConfigDefaults), this.config.assignmentConfig);\n this.assignmentService = this.createAssignmentService(this.config.assignmentConfig);\n }\n this.evaluation = new experiment_core_1.EvaluationEngine();\n }\n createAssignmentService(assignmentConfig) {\n const instance = amplitude.createInstance();\n const { apiKey, cacheCapacity } = assignmentConfig, ampConfig = __rest(assignmentConfig, [\"apiKey\", \"cacheCapacity\"]);\n instance.init(apiKey, ampConfig);\n return new assignment_service_1.AmplitudeAssignmentService(instance, new assignment_filter_1.InMemoryAssignmentFilter(cacheCapacity));\n }\n /**\n * Locally evaluate varints for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * Unlike {@link evaluate}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n */\n evaluateV2(user, flagKeys) {\n var _a;\n const flags = this.cache.getAllCached();\n this.logger.debug('[Experiment] evaluate - user:', user, 'flags:', flags);\n const context = (0, user_1.convertUserToEvaluationContext)(user);\n const sortedFlags = (0, experiment_core_1.topologicalSort)(flags, flagKeys);\n const results = this.evaluation.evaluate(context, sortedFlags);\n void ((_a = this.assignmentService) === null || _a === void 0 ? void 0 : _a.track(new assignment_1.Assignment(user, results)));\n this.logger.debug('[Experiment] evaluate - variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n }\n /**\n * Locally evaluates flag variants for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n * @deprecated use evaluateV2 instead\n */\n evaluate(user, flagKeys) {\n return __awaiter(this, void 0, void 0, function* () {\n const results = this.evaluateV2(user, flagKeys);\n return (0, variant_1.filterDefaultVariants)(results);\n });\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.poller.start();\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n return this.poller.stop();\n }\n}\nexports.LocalEvaluationClient = LocalEvaluationClient;\n"],"names":["this","client","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","require$$6","require$$7","require$$8","require$$9","require$$10","require$$11","require$$12","config","fetcher","user"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAI,kBAAmBA,iBAAAA,kBAAQA,iBAAI,eAAC,oBAAqB,OAAO,SAAU,SAAS,GAAG,GAAG,GA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pers.js";
|
2
2
|
import { __exports as client } from "../../../../../../_virtual/client2.js";
|
3
|
-
import require$$0 from "../../../../../../_virtual/
|
3
|
+
import require$$0 from "../../../../../../_virtual/index3.js";
|
4
4
|
import require$$1 from "../../../../../../_virtual/experiment-core.esm.js";
|
5
5
|
import "../assignment/assignment.js";
|
6
6
|
import "../assignment/assignment-filter.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/client.js"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __rest = (this && this.__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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LocalEvaluationClient = void 0;\nconst amplitude = __importStar(require(\"@amplitude/analytics-node\"));\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst assignment_1 = require(\"../assignment/assignment\");\nconst assignment_filter_1 = require(\"../assignment/assignment-filter\");\nconst assignment_service_1 = require(\"../assignment/assignment-service\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst user_1 = require(\"../util/user\");\nconst variant_1 = require(\"../util/variant\");\nconst cache_1 = require(\"./cache\");\nconst fetcher_1 = require(\"./fetcher\");\nconst poller_1 = require(\"./poller\");\n/**\n * Experiment client for evaluating variants for a user locally.\n * @category Core Usage\n */\nclass LocalEvaluationClient {\n constructor(apiKey, config, flagConfigCache, httpClient = new http_1.FetchHttpClient(config === null || config === void 0 ? void 0 : config.httpAgent)) {\n this.config = Object.assign(Object.assign({}, config_1.LocalEvaluationDefaults), config);\n const fetcher = new fetcher_1.FlagConfigFetcher(apiKey, httpClient, this.config.serverUrl, this.config.debug);\n this.cache = new cache_1.InMemoryFlagConfigCache(flagConfigCache, this.config.bootstrap);\n this.logger = new logger_1.ConsoleLogger(this.config.debug);\n this.poller = new poller_1.FlagConfigPoller(fetcher, this.cache, this.config.flagConfigPollingIntervalMillis, this.config.debug);\n if (this.config.assignmentConfig) {\n this.config.assignmentConfig = Object.assign(Object.assign({}, config_1.AssignmentConfigDefaults), this.config.assignmentConfig);\n this.assignmentService = this.createAssignmentService(this.config.assignmentConfig);\n }\n this.evaluation = new experiment_core_1.EvaluationEngine();\n }\n createAssignmentService(assignmentConfig) {\n const instance = amplitude.createInstance();\n const { apiKey, cacheCapacity } = assignmentConfig, ampConfig = __rest(assignmentConfig, [\"apiKey\", \"cacheCapacity\"]);\n instance.init(apiKey, ampConfig);\n return new assignment_service_1.AmplitudeAssignmentService(instance, new assignment_filter_1.InMemoryAssignmentFilter(cacheCapacity));\n }\n /**\n * Locally evaluate varints for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * Unlike {@link evaluate}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n */\n evaluateV2(user, flagKeys) {\n var _a;\n const flags = this.cache.getAllCached();\n this.logger.debug('[Experiment] evaluate - user:', user, 'flags:', flags);\n const context = (0, user_1.convertUserToEvaluationContext)(user);\n const sortedFlags = (0, experiment_core_1.topologicalSort)(flags, flagKeys);\n const results = this.evaluation.evaluate(context, sortedFlags);\n void ((_a = this.assignmentService) === null || _a === void 0 ? void 0 : _a.track(new assignment_1.Assignment(user, results)));\n this.logger.debug('[Experiment] evaluate - variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n }\n /**\n * Locally evaluates flag variants for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n * @deprecated use evaluateV2 instead\n */\n evaluate(user, flagKeys) {\n return __awaiter(this, void 0, void 0, function* () {\n const results = this.evaluateV2(user, flagKeys);\n return (0, variant_1.filterDefaultVariants)(results);\n });\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.poller.start();\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n return this.poller.stop();\n }\n}\nexports.LocalEvaluationClient = LocalEvaluationClient;\n"],"names":["this","require$$2","require$$3","require$$4","require$$5","require$$6","require$$7","require$$8","require$$9","require$$10","require$$11","require$$12","config","fetcher","user"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAI,kBAAmBA,kBAAQA,eAAK,oBAAqB,OAAO,SAAU,SAAS,GAAG,GAAG,GAAG,IAAI;AAC5F,MAAI,OAAO;AAAW,SAAK;AAC3B,MAAI,OAAO,OAAO,yBAAyB,GAAG,CAAC;AAC/C,MAAI,CAAC,SAAS,SAAS,OAAO,CAAC,EAAE,aAAa,KAAK,YAAY,KAAK,eAAe;AACjF,WAAO,EAAE,YAAY,MAAM,KAAK,WAAW;AAAE,aAAO,EAAE,CAAC;AAAA,IAAE;EAC1D;AACD,SAAO,eAAe,GAAG,IAAI,IAAI;AACrC,IAAM,SAAS,GAAG,GAAG,GAAG,IAAI;AACxB,MAAI,OAAO;AAAW,SAAK;AAC3B,IAAE,EAAE,IAAI,EAAE,CAAC;AACf;AACA,IAAI,qBAAsBA,kBAAQA,eAAK,uBAAwB,OAAO,SAAU,SAAS,GAAG,GAAG;AAC3F,SAAO,eAAe,GAAG,WAAW,EAAE,YAAY,MAAM,OAAO,EAAC,CAAE;AACtE,IAAK,SAAS,GAAG,GAAG;AAChB,IAAE,SAAS,IAAI;AACnB;AACA,IAAI,eAAgBA,kBAAQA,eAAK,gBAAiB,SAAU,KAAK;AAC7D,MAAI,OAAO,IAAI;AAAY,WAAO;AAClC,MAAI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EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,QAAQ;AACJ,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,aAAO,MAAM,KAAK,OAAO;IACrC,CAAS;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMD,OAAO;AACH,WAAO,KAAK,OAAO;EACtB;AACL;AACA,OAAA,wBAAgC;","x_google_ignoreList":[0]}
|
1
|
+
{"version":3,"file":"client.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/client.js"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __rest = (this && this.__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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LocalEvaluationClient = void 0;\nconst amplitude = __importStar(require(\"@amplitude/analytics-node\"));\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst assignment_1 = require(\"../assignment/assignment\");\nconst assignment_filter_1 = require(\"../assignment/assignment-filter\");\nconst assignment_service_1 = require(\"../assignment/assignment-service\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst user_1 = require(\"../util/user\");\nconst variant_1 = require(\"../util/variant\");\nconst cache_1 = require(\"./cache\");\nconst fetcher_1 = require(\"./fetcher\");\nconst poller_1 = require(\"./poller\");\n/**\n * Experiment client for evaluating variants for a user locally.\n * @category Core Usage\n */\nclass LocalEvaluationClient {\n constructor(apiKey, config, flagConfigCache, httpClient = new http_1.FetchHttpClient(config === null || config === void 0 ? void 0 : config.httpAgent)) {\n this.config = Object.assign(Object.assign({}, config_1.LocalEvaluationDefaults), config);\n const fetcher = new fetcher_1.FlagConfigFetcher(apiKey, httpClient, this.config.serverUrl, this.config.debug);\n this.cache = new cache_1.InMemoryFlagConfigCache(flagConfigCache, this.config.bootstrap);\n this.logger = new logger_1.ConsoleLogger(this.config.debug);\n this.poller = new poller_1.FlagConfigPoller(fetcher, this.cache, this.config.flagConfigPollingIntervalMillis, this.config.debug);\n if (this.config.assignmentConfig) {\n this.config.assignmentConfig = Object.assign(Object.assign({}, config_1.AssignmentConfigDefaults), this.config.assignmentConfig);\n this.assignmentService = this.createAssignmentService(this.config.assignmentConfig);\n }\n this.evaluation = new experiment_core_1.EvaluationEngine();\n }\n createAssignmentService(assignmentConfig) {\n const instance = amplitude.createInstance();\n const { apiKey, cacheCapacity } = assignmentConfig, ampConfig = __rest(assignmentConfig, [\"apiKey\", \"cacheCapacity\"]);\n instance.init(apiKey, ampConfig);\n return new assignment_service_1.AmplitudeAssignmentService(instance, new assignment_filter_1.InMemoryAssignmentFilter(cacheCapacity));\n }\n /**\n * Locally evaluate varints for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * Unlike {@link evaluate}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n */\n evaluateV2(user, flagKeys) {\n var _a;\n const flags = this.cache.getAllCached();\n this.logger.debug('[Experiment] evaluate - user:', user, 'flags:', flags);\n const context = (0, user_1.convertUserToEvaluationContext)(user);\n const sortedFlags = (0, experiment_core_1.topologicalSort)(flags, flagKeys);\n const results = this.evaluation.evaluate(context, sortedFlags);\n void ((_a = this.assignmentService) === null || _a === void 0 ? void 0 : _a.track(new assignment_1.Assignment(user, results)));\n this.logger.debug('[Experiment] evaluate - variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n }\n /**\n * Locally evaluates flag variants for a user.\n *\n * This function will only evaluate flags for the keys specified in the\n * {@link flagKeys} argument. If {@link flagKeys} is missing, all flags in the\n * {@link FlagConfigCache} will be evaluated.\n *\n * @param user The user to evaluate\n * @param flagKeys The flags to evaluate with the user. If empty, all flags\n * from the flag cache are evaluated.\n * @returns The evaluated variants\n * @deprecated use evaluateV2 instead\n */\n evaluate(user, flagKeys) {\n return __awaiter(this, void 0, void 0, function* () {\n const results = this.evaluateV2(user, flagKeys);\n return (0, variant_1.filterDefaultVariants)(results);\n });\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.poller.start();\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n return this.poller.stop();\n }\n}\nexports.LocalEvaluationClient = LocalEvaluationClient;\n"],"names":["this","require$$2","require$$3","require$$4","require$$5","require$$6","require$$7","require$$8","require$$9","require$$10","require$$11","require$$12","config","fetcher","user"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAI,kBAAmBA,kBAAQA,eAAK,oBAAqB,OAAO,SAAU,SAAS,GAAG,GAAG,GAAG,IAAI;AAC5F,MAAI,OAAO;AAAW,SAAK;AAC3B,MAAI,OAAO,OAAO,yBAAyB,GAAG,CAAC;AAC/C,MAAI,CAAC,SAAS,SAAS,OAAO,CAAC,EAAE,aAAa,KAAK,YAAY,KAAK,eAAe;AACjF,WAAO,EAAE,YAAY,MAAM,KAAK,WAAW;AAAE,aAAO,EAAE,CAAC;AAAA,IAAE;EAC1D;AACD,SAAO,eAAe,GAAG,IAAI,IAAI;AACrC,IAAM,SAAS,GAAG,GAAG,GAAG,IAAI;AACxB,MAAI,OAAO;AAAW,SAAK;AAC3B,IAAE,EAAE,IAAI,EAAE,CAAC;AACf;AACA,IAAI,qBAAsBA,kBAAQA,eAAK,uBAAwB,OAAO,SAAU,SAAS,GAAG,GAAG;AAC3F,SAAO,eAAe,GAAG,WAAW,EAAE,YAAY,MAAM,OAAO,EAAC,CAAE;AACtE,IAAK,SAAS,GAAG,GAAG;AAChB,IAAE,SAAS,IAAI;AACnB;AACA,IAAI,eAAgBA,kBAAQA,eAAK,gBAAiB,SAAU,K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iBAAW,UAAU,uBAAuB,OAAO;AAAA,IAC/D,CAAS;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,QAAQ;AACJ,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,aAAO,MAAM,KAAK,OAAO;IACrC,CAAS;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMD,OAAO;AACH,WAAO,KAAK,OAAO;EACtB;AACL;AACA,OAAA,wBAAgC;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetcher.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigFetcher = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst FLAG_CONFIG_TIMEOUT = 5000;\nclass FlagConfigFetcher {\n constructor(apiKey, httpClient, serverUrl = config_1.LocalEvaluationDefaults.serverUrl, debug = false) {\n this.apiKey = apiKey;\n this.serverUrl = serverUrl;\n this.flagApi = new experiment_core_1.SdkFlagApi(apiKey, serverUrl, new http_1.WrapperClient(httpClient));\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch local evaluation mode flag configs from the Experiment API server.\n * These flag configs can be used to perform local evaluation.\n *\n * @returns The local evaluation mode flag configs for the initialized\n * environment\n */\n fetch() {\n return __awaiter(this, void 0, void 0, function* () {\n const flags = this.flagApi.getFlags({\n libraryName: 'experiment-node-server',\n libraryVersion: version_1.version,\n evaluationMode: 'local',\n timeoutMillis: FLAG_CONFIG_TIMEOUT,\n });\n if (this.receiver) {\n this.receiver(JSON.stringify(flags));\n }\n return flags;\n });\n }\n setRawReceiver(rawReceiver) {\n this.receiver = rawReceiver;\n }\n}\nexports.FlagConfigFetcher = FlagConfigFetcher;\n"],"names":["this","fetcher","require$$0","require$$1","require$$2","require$$3","require$$4"],"mappings":";;;;;;;;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"fetcher.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigFetcher = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst FLAG_CONFIG_TIMEOUT = 5000;\nclass FlagConfigFetcher {\n constructor(apiKey, httpClient, serverUrl = config_1.LocalEvaluationDefaults.serverUrl, debug = false) {\n this.apiKey = apiKey;\n this.serverUrl = serverUrl;\n this.flagApi = new experiment_core_1.SdkFlagApi(apiKey, serverUrl, new http_1.WrapperClient(httpClient));\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch local evaluation mode flag configs from the Experiment API server.\n * These flag configs can be used to perform local evaluation.\n *\n * @returns The local evaluation mode flag configs for the initialized\n * environment\n */\n fetch() {\n return __awaiter(this, void 0, void 0, function* () {\n const flags = this.flagApi.getFlags({\n libraryName: 'experiment-node-server',\n libraryVersion: version_1.version,\n evaluationMode: 'local',\n timeoutMillis: FLAG_CONFIG_TIMEOUT,\n });\n if (this.receiver) {\n this.receiver(JSON.stringify(flags));\n }\n return flags;\n });\n }\n setRawReceiver(rawReceiver) {\n this.receiver = rawReceiver;\n }\n}\nexports.FlagConfigFetcher = FlagConfigFetcher;\n"],"names":["this","fetcher","require$$0","require$$1","require$$2","require$$3","require$$4"],"mappings":";;;;;;;;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;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C;AACD,aAAO;AAAA,IACnB,CAAS;AAAA,EACJ;AAAA,EACD,eAAe,aAAa;AACxB,SAAK,WAAW;AAAA,EACnB;AACL;AACAL,QAAA,UAAA,oBAA4B;;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetcher.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigFetcher = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst FLAG_CONFIG_TIMEOUT = 5000;\nclass FlagConfigFetcher {\n constructor(apiKey, httpClient, serverUrl = config_1.LocalEvaluationDefaults.serverUrl, debug = false) {\n this.apiKey = apiKey;\n this.serverUrl = serverUrl;\n this.flagApi = new experiment_core_1.SdkFlagApi(apiKey, serverUrl, new http_1.WrapperClient(httpClient));\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch local evaluation mode flag configs from the Experiment API server.\n * These flag configs can be used to perform local evaluation.\n *\n * @returns The local evaluation mode flag configs for the initialized\n * environment\n */\n fetch() {\n return __awaiter(this, void 0, void 0, function* () {\n const flags = this.flagApi.getFlags({\n libraryName: 'experiment-node-server',\n libraryVersion: version_1.version,\n evaluationMode: 'local',\n timeoutMillis: FLAG_CONFIG_TIMEOUT,\n });\n if (this.receiver) {\n this.receiver(JSON.stringify(flags));\n }\n return flags;\n });\n }\n setRawReceiver(rawReceiver) {\n this.receiver = rawReceiver;\n }\n}\nexports.FlagConfigFetcher = FlagConfigFetcher;\n"],"names":["this","require$$0","require$$1","require$$2","require$$3","require$$4"],"mappings":";;;;;;;;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"fetcher.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigFetcher = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst logger_1 = require(\"../util/logger\");\nconst FLAG_CONFIG_TIMEOUT = 5000;\nclass FlagConfigFetcher {\n constructor(apiKey, httpClient, serverUrl = config_1.LocalEvaluationDefaults.serverUrl, debug = false) {\n this.apiKey = apiKey;\n this.serverUrl = serverUrl;\n this.flagApi = new experiment_core_1.SdkFlagApi(apiKey, serverUrl, new http_1.WrapperClient(httpClient));\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch local evaluation mode flag configs from the Experiment API server.\n * These flag configs can be used to perform local evaluation.\n *\n * @returns The local evaluation mode flag configs for the initialized\n * environment\n */\n fetch() {\n return __awaiter(this, void 0, void 0, function* () {\n const flags = this.flagApi.getFlags({\n libraryName: 'experiment-node-server',\n libraryVersion: version_1.version,\n evaluationMode: 'local',\n timeoutMillis: FLAG_CONFIG_TIMEOUT,\n });\n if (this.receiver) {\n this.receiver(JSON.stringify(flags));\n }\n return flags;\n });\n }\n setRawReceiver(rawReceiver) {\n this.receiver = rawReceiver;\n }\n}\nexports.FlagConfigFetcher = FlagConfigFetcher;\n"],"names":["this","require$$0","require$$1","require$$2","require$$3","require$$4"],"mappings":";;;;;;;;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU,MAAM,SAAS,cAAc,CAAE,CAAA,GAAG,KAAI,CAAE;AAAA,EAC5E,CAAK;AACL;AACA,OAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AACnC,QAAA,oBAAG;AAC5B,MAAM,oBAAoBC;AAC1B,MAAM,YAAYC;AAClB,MAAM,SAASC;AACf,MAAM,WAAWC;AACjB,MAAM,WAAWC;AACjB,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AAAA,EACpB,YAAY,QAAQ,YAAY,YAAY,SAAS,wBAAwB,WAAW,QAAQ,OAAO;AACnG,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,SAAK,UAAU,IAAI,kBAAkB,WAAW,QAAQ,WAAW,IAAI,OAAO,cAAc,UAAU,CAAC;AACvG,SAAK,SAAS,IAAI,SAAS,cAAc,KAAK;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQD,QAAQ;AACJ,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,YAAM,QAAQ,KAAK,QAAQ,SAAS;AAAA,QAChC,aAAa;AAAA,QACb,gBAAgB,UAAU;AAAA,QAC1B,gBAAgB;AAAA,QAChB,eAAe;AAAA,MAC/B,CAAa;AACD,UAAI,KAAK,UAAU;AACf,aAAK,SAAS,KAAK,UAAU,KAAK,CAAC;AAAA,MACtC;AACD,aAAO;AAAA,IACnB,CAAS;AAAA,EACJ;AAAA,EACD,eAAe,aAAa;AACxB,SAAK,WAAW;AAAA,EACnB;AACL;AACA,QAAA,oBAA4B;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poller.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigPoller = void 0;\nconst config_1 = require(\"../types/config\");\nconst backoff_1 = require(\"../util/backoff\");\nconst logger_1 = require(\"../util/logger\");\nconst BACKOFF_POLICY = {\n attempts: 5,\n min: 1,\n max: 1,\n scalar: 1,\n};\nclass FlagConfigPoller {\n constructor(fetcher, cache, pollingIntervalMillis = config_1.LocalEvaluationDefaults.flagConfigPollingIntervalMillis, debug = false) {\n this.fetcher = fetcher;\n this.cache = cache;\n this.pollingIntervalMillis = pollingIntervalMillis;\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.poller) {\n this.logger.debug('[Experiment] poller - start');\n this.poller = setInterval(() => __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.update(onChange);\n }\n catch (e) {\n this.logger.debug('[Experiment] flag config update failed', e);\n }\n }), this.pollingIntervalMillis);\n // Fetch initial flag configs and await the result.\n yield (0, backoff_1.doWithBackoff)(() => __awaiter(this, void 0, void 0, function* () {\n yield this.update(onChange);\n }), BACKOFF_POLICY);\n }\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n if (this.poller) {\n this.logger.debug('[Experiment] poller - stop');\n clearTimeout(this.poller);\n this.poller = undefined;\n }\n }\n /**\n * Force a flag config fetch and cache the update with an optional callback\n * which gets called if the flag configs change in any way.\n *\n * @param onChange optional callback which will get called if the flag configs\n * in the cache have changed.\n */\n update(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n this.logger.debug('[Experiment] updating flag configs');\n const flagConfigs = yield this.fetcher.fetch();\n let changed = false;\n if (onChange) {\n const current = yield this.cache.getAll();\n if (!Object.is(current, flagConfigs)) {\n changed = true;\n }\n }\n yield this.cache.clear();\n yield this.cache.putAll(flagConfigs);\n if (changed) {\n yield onChange(this.cache);\n }\n });\n }\n}\nexports.FlagConfigPoller = FlagConfigPoller;\n"],"names":["this","poller","require$$0","require$$1","require$$2"],"mappings":";;;;;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"poller.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigPoller = void 0;\nconst config_1 = require(\"../types/config\");\nconst backoff_1 = require(\"../util/backoff\");\nconst logger_1 = require(\"../util/logger\");\nconst BACKOFF_POLICY = {\n attempts: 5,\n min: 1,\n max: 1,\n scalar: 1,\n};\nclass FlagConfigPoller {\n constructor(fetcher, cache, pollingIntervalMillis = config_1.LocalEvaluationDefaults.flagConfigPollingIntervalMillis, debug = false) {\n this.fetcher = fetcher;\n this.cache = cache;\n this.pollingIntervalMillis = pollingIntervalMillis;\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.poller) {\n this.logger.debug('[Experiment] poller - start');\n this.poller = setInterval(() => __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.update(onChange);\n }\n catch (e) {\n this.logger.debug('[Experiment] flag config update failed', e);\n }\n }), this.pollingIntervalMillis);\n // Fetch initial flag configs and await the result.\n yield (0, backoff_1.doWithBackoff)(() => __awaiter(this, void 0, void 0, function* () {\n yield this.update(onChange);\n }), BACKOFF_POLICY);\n }\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n if (this.poller) {\n this.logger.debug('[Experiment] poller - stop');\n clearTimeout(this.poller);\n this.poller = undefined;\n }\n }\n /**\n * Force a flag config fetch and cache the update with an optional callback\n * which gets called if the flag configs change in any way.\n *\n * @param onChange optional callback which will get called if the flag configs\n * in the cache have changed.\n */\n update(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n this.logger.debug('[Experiment] updating flag configs');\n const flagConfigs = yield this.fetcher.fetch();\n let changed = false;\n if (onChange) {\n const current = yield this.cache.getAll();\n if (!Object.is(current, flagConfigs)) {\n changed = true;\n }\n }\n yield this.cache.clear();\n yield this.cache.putAll(flagConfigs);\n if (changed) {\n yield onChange(this.cache);\n }\n });\n }\n}\nexports.FlagConfigPoller = FlagConfigPoller;\n"],"names":["this","poller","require$$0","require$$1","require$$2"],"mappings":";;;;;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU,MAAM,SAAS,cAAc,CAAE,CAAA,GAAG,KAAI,CAAE;AAAA,EAC5E,CAAK;AACL;AACA,OAAO,eAAeC,OAAAA,WAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AACpCA,OAAAA,UAAA,mBAAG;AAC3B,MAAM,WAAWC,OAAAA;AACjB,MAAM,YAAYC,QAAAA;AAClB,MAAM,WAAWC,OAAAA;AACjB,MAAM,iBAAiB;AAAA,EACnB,UAAU;AAAA,EACV,KAAK;AAAA,EACL,KAAK;AAAA,EACL,QAAQ;AACZ;AACA,MAAM,iBAAiB;AAAA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,WAAW,GAAG;AAClC,oBAAU;AAAA,QACb;AAAA,MACJ;AACD,YAAM,KAAK,MAAM;AACjB,YAAM,KAAK,MAAM,OAAO,WAAW;AACnC,UAAI,SAAS;AACT,cAAM,SAAS,KAAK,KAAK;AAAA,MAC5B;AAAA,IACb,CAAS;AAAA,EACJ;AACL;AACAH,OAAA,UAAA,mBAA2B;;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poller.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigPoller = void 0;\nconst config_1 = require(\"../types/config\");\nconst backoff_1 = require(\"../util/backoff\");\nconst logger_1 = require(\"../util/logger\");\nconst BACKOFF_POLICY = {\n attempts: 5,\n min: 1,\n max: 1,\n scalar: 1,\n};\nclass FlagConfigPoller {\n constructor(fetcher, cache, pollingIntervalMillis = config_1.LocalEvaluationDefaults.flagConfigPollingIntervalMillis, debug = false) {\n this.fetcher = fetcher;\n this.cache = cache;\n this.pollingIntervalMillis = pollingIntervalMillis;\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.poller) {\n this.logger.debug('[Experiment] poller - start');\n this.poller = setInterval(() => __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.update(onChange);\n }\n catch (e) {\n this.logger.debug('[Experiment] flag config update failed', e);\n }\n }), this.pollingIntervalMillis);\n // Fetch initial flag configs and await the result.\n yield (0, backoff_1.doWithBackoff)(() => __awaiter(this, void 0, void 0, function* () {\n yield this.update(onChange);\n }), BACKOFF_POLICY);\n }\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n if (this.poller) {\n this.logger.debug('[Experiment] poller - stop');\n clearTimeout(this.poller);\n this.poller = undefined;\n }\n }\n /**\n * Force a flag config fetch and cache the update with an optional callback\n * which gets called if the flag configs change in any way.\n *\n * @param onChange optional callback which will get called if the flag configs\n * in the cache have changed.\n */\n update(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n this.logger.debug('[Experiment] updating flag configs');\n const flagConfigs = yield this.fetcher.fetch();\n let changed = false;\n if (onChange) {\n const current = yield this.cache.getAll();\n if (!Object.is(current, flagConfigs)) {\n changed = true;\n }\n }\n yield this.cache.clear();\n yield this.cache.putAll(flagConfigs);\n if (changed) {\n yield onChange(this.cache);\n }\n });\n }\n}\nexports.FlagConfigPoller = FlagConfigPoller;\n"],"names":["this","require$$0","require$$1","require$$2"],"mappings":";;;;;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"poller.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FlagConfigPoller = void 0;\nconst config_1 = require(\"../types/config\");\nconst backoff_1 = require(\"../util/backoff\");\nconst logger_1 = require(\"../util/logger\");\nconst BACKOFF_POLICY = {\n attempts: 5,\n min: 1,\n max: 1,\n scalar: 1,\n};\nclass FlagConfigPoller {\n constructor(fetcher, cache, pollingIntervalMillis = config_1.LocalEvaluationDefaults.flagConfigPollingIntervalMillis, debug = false) {\n this.fetcher = fetcher;\n this.cache = cache;\n this.pollingIntervalMillis = pollingIntervalMillis;\n this.logger = new logger_1.ConsoleLogger(debug);\n }\n /**\n * Fetch initial flag configurations and start polling for updates.\n *\n * You must call this function to begin polling for flag config updates.\n * The promise returned by this function is resolved when the initial call\n * to fetch the flag configuration completes.\n *\n * Calling this function while the poller is already running does nothing.\n */\n start(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.poller) {\n this.logger.debug('[Experiment] poller - start');\n this.poller = setInterval(() => __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.update(onChange);\n }\n catch (e) {\n this.logger.debug('[Experiment] flag config update failed', e);\n }\n }), this.pollingIntervalMillis);\n // Fetch initial flag configs and await the result.\n yield (0, backoff_1.doWithBackoff)(() => __awaiter(this, void 0, void 0, function* () {\n yield this.update(onChange);\n }), BACKOFF_POLICY);\n }\n });\n }\n /**\n * Stop polling for flag configurations.\n *\n * Calling this function while the poller is not running will do nothing.\n */\n stop() {\n if (this.poller) {\n this.logger.debug('[Experiment] poller - stop');\n clearTimeout(this.poller);\n this.poller = undefined;\n }\n }\n /**\n * Force a flag config fetch and cache the update with an optional callback\n * which gets called if the flag configs change in any way.\n *\n * @param onChange optional callback which will get called if the flag configs\n * in the cache have changed.\n */\n update(onChange) {\n return __awaiter(this, void 0, void 0, function* () {\n this.logger.debug('[Experiment] updating flag configs');\n const flagConfigs = yield this.fetcher.fetch();\n let changed = false;\n if (onChange) {\n const current = yield this.cache.getAll();\n if (!Object.is(current, flagConfigs)) {\n changed = true;\n }\n }\n yield this.cache.clear();\n yield this.cache.putAll(flagConfigs);\n if (changed) {\n yield onChange(this.cache);\n }\n });\n }\n}\nexports.FlagConfigPoller = FlagConfigPoller;\n"],"names":["this","require$$0","require$$1","require$$2"],"mappings":";;;;;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU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AS;AAAA,IACjB;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQD,OAAO,UAAU;AACb,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,WAAK,OAAO,MAAM,oCAAoC;AACtD,YAAM,cAAc,MAAM,KAAK,QAAQ,MAAK;AAC5C,UAAI,UAAU;AACd,UAAI,UAAU;AACV,cAAM,UAAU,MAAM,KAAK,MAAM,OAAM;AACvC,YAAI,CAAC,OAAO,GAAG,SAAS,WAAW,GAAG;AAClC,oBAAU;AAAA,QACb;AAAA,MACJ;AACD,YAAM,KAAK,MAAM;AACjB,YAAM,KAAK,MAAM,OAAO,WAAW;AACnC,UAAI,SAAS;AACT,cAAM,SAAS,KAAK,KAAK;AAAA,MAC5B;AAAA,IACb,CAAS;AAAA,EACJ;AACL;AACA,OAAA,mBAA2B;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ExperimentClient = exports.RemoteEvaluationClient = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst time_1 = require(\"../util/time\");\nconst variant_1 = require(\"../util/variant\");\n/**\n * Experiment client for fetching variants for a user remotely.\n * @category Core Usage\n */\nclass RemoteEvaluationClient {\n /**\n * Creates a new RemoteEvaluationClient instance.\n *\n * @param apiKey The environment API Key\n * @param config See {@link ExperimentConfig} for config options\n */\n constructor(apiKey, config) {\n var _a;\n this.apiKey = apiKey;\n this.config = Object.assign(Object.assign({}, config_1.RemoteEvaluationDefaults), config);\n this.evaluationApi = new experiment_core_1.SdkEvaluationApi(apiKey, this.config.serverUrl, new http_1.WrapperClient(new http_1.FetchHttpClient((_a = this.config) === null || _a === void 0 ? void 0 : _a.httpAgent)));\n }\n /**\n * Fetch remote evaluated variants for a user. This function can\n * automatically retry the request on failure (if configured), and will\n * throw the original error if all retries fail.\n *\n * Unlike {@link fetch}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to fetch variants for.\n * @param options Options to configure the fetch request.\n */\n fetchV2(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.apiKey) {\n throw Error('Experiment API key is empty');\n }\n this.debug('[Experiment] Fetching variants for user: ', user);\n try {\n return yield this.doFetch(user, this.config.fetchTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Fetch failed: ', e);\n try {\n return yield this.retryFetch(user, options);\n }\n catch (e) {\n console.error(e);\n }\n throw e;\n }\n });\n }\n /**\n * Fetch all variants for a user.\n *\n * This method will automatically retry if configured (default).\n *\n * @param user The {@link ExperimentUser} context\n * @param options The {@link FetchOptions} for this specific fetch request.\n * @return The {@link Variants} for the user on success, empty\n * {@link Variants} on error.\n * @deprecated use fetchV2 instead\n */\n fetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = yield this.fetchV2(user, options);\n return (0, variant_1.filterDefaultVariants)(results);\n }\n catch (e) {\n console.error('[Experiment] Failed to fetch variants: ', e);\n return {};\n }\n });\n }\n doFetch(user, timeoutMillis, options) {\n return __awaiter(this, void 0, void 0, function* () {\n const userContext = this.addContext(user || {});\n const results = yield this.evaluationApi.getVariants(userContext, {\n flagKeys: options === null || options === void 0 ? void 0 : options.flagKeys,\n timeoutMillis: timeoutMillis,\n });\n this.debug('[Experiment] Fetched variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n });\n }\n retryFetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.config.fetchRetries == 0) {\n return {};\n }\n this.debug('[Experiment] Retrying fetch');\n let err = null;\n let delayMillis = this.config.fetchRetryBackoffMinMillis;\n for (let i = 0; i < this.config.fetchRetries; i++) {\n yield (0, time_1.sleep)(delayMillis);\n try {\n return yield this.doFetch(user, this.config.fetchRetryTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Retry falied: ', e);\n err = e;\n }\n delayMillis = Math.min(delayMillis * this.config.fetchRetryBackoffScalar, this.config.fetchRetryBackoffMaxMillis);\n }\n throw err;\n });\n }\n addContext(user) {\n return Object.assign({ library: `experiment-node-server/${version_1.version}` }, user);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n debug(message, ...optionalParams) {\n if (this.config.debug) {\n console.debug(message, ...optionalParams);\n }\n }\n}\nexports.RemoteEvaluationClient = RemoteEvaluationClient;\n/**\n * @deprecated use {@link RemoteEvaluationClient}.\n */\nclass ExperimentClient extends RemoteEvaluationClient {\n constructor(apiKey, config) {\n super(apiKey, config);\n }\n}\nexports.ExperimentClient = ExperimentClient;\n"],"names":["this","client","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","config","e"],"mappings":";;;;;;;;;;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"client.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ExperimentClient = exports.RemoteEvaluationClient = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst time_1 = require(\"../util/time\");\nconst variant_1 = require(\"../util/variant\");\n/**\n * Experiment client for fetching variants for a user remotely.\n * @category Core Usage\n */\nclass RemoteEvaluationClient {\n /**\n * Creates a new RemoteEvaluationClient instance.\n *\n * @param apiKey The environment API Key\n * @param config See {@link ExperimentConfig} for config options\n */\n constructor(apiKey, config) {\n var _a;\n this.apiKey = apiKey;\n this.config = Object.assign(Object.assign({}, config_1.RemoteEvaluationDefaults), config);\n this.evaluationApi = new experiment_core_1.SdkEvaluationApi(apiKey, this.config.serverUrl, new http_1.WrapperClient(new http_1.FetchHttpClient((_a = this.config) === null || _a === void 0 ? void 0 : _a.httpAgent)));\n }\n /**\n * Fetch remote evaluated variants for a user. This function can\n * automatically retry the request on failure (if configured), and will\n * throw the original error if all retries fail.\n *\n * Unlike {@link fetch}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to fetch variants for.\n * @param options Options to configure the fetch request.\n */\n fetchV2(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.apiKey) {\n throw Error('Experiment API key is empty');\n }\n this.debug('[Experiment] Fetching variants for user: ', user);\n try {\n return yield this.doFetch(user, this.config.fetchTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Fetch failed: ', e);\n try {\n return yield this.retryFetch(user, options);\n }\n catch (e) {\n console.error(e);\n }\n throw e;\n }\n });\n }\n /**\n * Fetch all variants for a user.\n *\n * This method will automatically retry if configured (default).\n *\n * @param user The {@link ExperimentUser} context\n * @param options The {@link FetchOptions} for this specific fetch request.\n * @return The {@link Variants} for the user on success, empty\n * {@link Variants} on error.\n * @deprecated use fetchV2 instead\n */\n fetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = yield this.fetchV2(user, options);\n return (0, variant_1.filterDefaultVariants)(results);\n }\n catch (e) {\n console.error('[Experiment] Failed to fetch variants: ', e);\n return {};\n }\n });\n }\n doFetch(user, timeoutMillis, options) {\n return __awaiter(this, void 0, void 0, function* () {\n const userContext = this.addContext(user || {});\n const results = yield this.evaluationApi.getVariants(userContext, {\n flagKeys: options === null || options === void 0 ? void 0 : options.flagKeys,\n timeoutMillis: timeoutMillis,\n });\n this.debug('[Experiment] Fetched variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n });\n }\n retryFetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.config.fetchRetries == 0) {\n return {};\n }\n this.debug('[Experiment] Retrying fetch');\n let err = null;\n let delayMillis = this.config.fetchRetryBackoffMinMillis;\n for (let i = 0; i < this.config.fetchRetries; i++) {\n yield (0, time_1.sleep)(delayMillis);\n try {\n return yield this.doFetch(user, this.config.fetchRetryTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Retry falied: ', e);\n err = e;\n }\n delayMillis = Math.min(delayMillis * this.config.fetchRetryBackoffScalar, this.config.fetchRetryBackoffMaxMillis);\n }\n throw err;\n });\n }\n addContext(user) {\n return Object.assign({ library: `experiment-node-server/${version_1.version}` }, user);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n debug(message, ...optionalParams) {\n if (this.config.debug) {\n console.debug(message, ...optionalParams);\n }\n }\n}\nexports.RemoteEvaluationClient = RemoteEvaluationClient;\n/**\n * @deprecated use {@link RemoteEvaluationClient}.\n */\nclass ExperimentClient extends RemoteEvaluationClient {\n constructor(apiKey, config) {\n super(apiKey, config);\n }\n}\nexports.ExperimentClient = ExperimentClient;\n"],"names":["this","client","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","config","e"],"mappings":";;;;;;;;;;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU,MAAM,SAAS,cAAc,CAAE,CAAA,GAAG,KAAI,CAAE;AAAA,EAC5E,CAAK;AACL;AACA,OAAO,eAAeC,OAAAA,WAAS,cAAc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W,MAAM;AACb,WAAO,OAAO,OAAO,EAAE,SAAS,0BAA0B,UAAU,OAAO,MAAM,IAAI;AAAA,EACxF;AAAA;AAAA,EAED,MAAM,YAAY,gBAAgB;AAC9B,QAAI,KAAK,OAAO,OAAO;AACnB,cAAQ,MAAM,SAAS,GAAG,cAAc;AAAA,IAC3C;AAAA,EACJ;AACL;AAC8BR,OAAA,UAAA,yBAAG;AAIjC,MAAM,yBAAyB,uBAAuB;AAAA,EAClD,YAAY,QAAQO,SAAQ;AACxB,UAAM,QAAQA,OAAM;AAAA,EACvB;AACL;AACAP,OAAA,UAAA,mBAA2B;;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ExperimentClient = exports.RemoteEvaluationClient = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst time_1 = require(\"../util/time\");\nconst variant_1 = require(\"../util/variant\");\n/**\n * Experiment client for fetching variants for a user remotely.\n * @category Core Usage\n */\nclass RemoteEvaluationClient {\n /**\n * Creates a new RemoteEvaluationClient instance.\n *\n * @param apiKey The environment API Key\n * @param config See {@link ExperimentConfig} for config options\n */\n constructor(apiKey, config) {\n var _a;\n this.apiKey = apiKey;\n this.config = Object.assign(Object.assign({}, config_1.RemoteEvaluationDefaults), config);\n this.evaluationApi = new experiment_core_1.SdkEvaluationApi(apiKey, this.config.serverUrl, new http_1.WrapperClient(new http_1.FetchHttpClient((_a = this.config) === null || _a === void 0 ? void 0 : _a.httpAgent)));\n }\n /**\n * Fetch remote evaluated variants for a user. This function can\n * automatically retry the request on failure (if configured), and will\n * throw the original error if all retries fail.\n *\n * Unlike {@link fetch}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to fetch variants for.\n * @param options Options to configure the fetch request.\n */\n fetchV2(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.apiKey) {\n throw Error('Experiment API key is empty');\n }\n this.debug('[Experiment] Fetching variants for user: ', user);\n try {\n return yield this.doFetch(user, this.config.fetchTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Fetch failed: ', e);\n try {\n return yield this.retryFetch(user, options);\n }\n catch (e) {\n console.error(e);\n }\n throw e;\n }\n });\n }\n /**\n * Fetch all variants for a user.\n *\n * This method will automatically retry if configured (default).\n *\n * @param user The {@link ExperimentUser} context\n * @param options The {@link FetchOptions} for this specific fetch request.\n * @return The {@link Variants} for the user on success, empty\n * {@link Variants} on error.\n * @deprecated use fetchV2 instead\n */\n fetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = yield this.fetchV2(user, options);\n return (0, variant_1.filterDefaultVariants)(results);\n }\n catch (e) {\n console.error('[Experiment] Failed to fetch variants: ', e);\n return {};\n }\n });\n }\n doFetch(user, timeoutMillis, options) {\n return __awaiter(this, void 0, void 0, function* () {\n const userContext = this.addContext(user || {});\n const results = yield this.evaluationApi.getVariants(userContext, {\n flagKeys: options === null || options === void 0 ? void 0 : options.flagKeys,\n timeoutMillis: timeoutMillis,\n });\n this.debug('[Experiment] Fetched variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n });\n }\n retryFetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.config.fetchRetries == 0) {\n return {};\n }\n this.debug('[Experiment] Retrying fetch');\n let err = null;\n let delayMillis = this.config.fetchRetryBackoffMinMillis;\n for (let i = 0; i < this.config.fetchRetries; i++) {\n yield (0, time_1.sleep)(delayMillis);\n try {\n return yield this.doFetch(user, this.config.fetchRetryTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Retry falied: ', e);\n err = e;\n }\n delayMillis = Math.min(delayMillis * this.config.fetchRetryBackoffScalar, this.config.fetchRetryBackoffMaxMillis);\n }\n throw err;\n });\n }\n addContext(user) {\n return Object.assign({ library: `experiment-node-server/${version_1.version}` }, user);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n debug(message, ...optionalParams) {\n if (this.config.debug) {\n console.debug(message, ...optionalParams);\n }\n }\n}\nexports.RemoteEvaluationClient = RemoteEvaluationClient;\n/**\n * @deprecated use {@link RemoteEvaluationClient}.\n */\nclass ExperimentClient extends RemoteEvaluationClient {\n constructor(apiKey, config) {\n super(apiKey, config);\n }\n}\nexports.ExperimentClient = ExperimentClient;\n"],"names":["this","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","config","e"],"mappings":";;;;;;;;;;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"client.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ExperimentClient = exports.RemoteEvaluationClient = void 0;\nconst experiment_core_1 = require(\"@amplitude/experiment-core\");\nconst version_1 = require(\"../../gen/version\");\nconst http_1 = require(\"../transport/http\");\nconst config_1 = require(\"../types/config\");\nconst time_1 = require(\"../util/time\");\nconst variant_1 = require(\"../util/variant\");\n/**\n * Experiment client for fetching variants for a user remotely.\n * @category Core Usage\n */\nclass RemoteEvaluationClient {\n /**\n * Creates a new RemoteEvaluationClient instance.\n *\n * @param apiKey The environment API Key\n * @param config See {@link ExperimentConfig} for config options\n */\n constructor(apiKey, config) {\n var _a;\n this.apiKey = apiKey;\n this.config = Object.assign(Object.assign({}, config_1.RemoteEvaluationDefaults), config);\n this.evaluationApi = new experiment_core_1.SdkEvaluationApi(apiKey, this.config.serverUrl, new http_1.WrapperClient(new http_1.FetchHttpClient((_a = this.config) === null || _a === void 0 ? void 0 : _a.httpAgent)));\n }\n /**\n * Fetch remote evaluated variants for a user. This function can\n * automatically retry the request on failure (if configured), and will\n * throw the original error if all retries fail.\n *\n * Unlike {@link fetch}, this function returns a default variant object\n * if the flag or experiment was evaluated, but the user was not assigned a\n * variant (i.e. 'off').\n *\n * @param user The user to fetch variants for.\n * @param options Options to configure the fetch request.\n */\n fetchV2(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.apiKey) {\n throw Error('Experiment API key is empty');\n }\n this.debug('[Experiment] Fetching variants for user: ', user);\n try {\n return yield this.doFetch(user, this.config.fetchTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Fetch failed: ', e);\n try {\n return yield this.retryFetch(user, options);\n }\n catch (e) {\n console.error(e);\n }\n throw e;\n }\n });\n }\n /**\n * Fetch all variants for a user.\n *\n * This method will automatically retry if configured (default).\n *\n * @param user The {@link ExperimentUser} context\n * @param options The {@link FetchOptions} for this specific fetch request.\n * @return The {@link Variants} for the user on success, empty\n * {@link Variants} on error.\n * @deprecated use fetchV2 instead\n */\n fetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = yield this.fetchV2(user, options);\n return (0, variant_1.filterDefaultVariants)(results);\n }\n catch (e) {\n console.error('[Experiment] Failed to fetch variants: ', e);\n return {};\n }\n });\n }\n doFetch(user, timeoutMillis, options) {\n return __awaiter(this, void 0, void 0, function* () {\n const userContext = this.addContext(user || {});\n const results = yield this.evaluationApi.getVariants(userContext, {\n flagKeys: options === null || options === void 0 ? void 0 : options.flagKeys,\n timeoutMillis: timeoutMillis,\n });\n this.debug('[Experiment] Fetched variants: ', results);\n return (0, variant_1.evaluationVariantsToVariants)(results);\n });\n }\n retryFetch(user, options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.config.fetchRetries == 0) {\n return {};\n }\n this.debug('[Experiment] Retrying fetch');\n let err = null;\n let delayMillis = this.config.fetchRetryBackoffMinMillis;\n for (let i = 0; i < this.config.fetchRetries; i++) {\n yield (0, time_1.sleep)(delayMillis);\n try {\n return yield this.doFetch(user, this.config.fetchRetryTimeoutMillis, options);\n }\n catch (e) {\n console.error('[Experiment] Retry falied: ', e);\n err = e;\n }\n delayMillis = Math.min(delayMillis * this.config.fetchRetryBackoffScalar, this.config.fetchRetryBackoffMaxMillis);\n }\n throw err;\n });\n }\n addContext(user) {\n return Object.assign({ library: `experiment-node-server/${version_1.version}` }, user);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n debug(message, ...optionalParams) {\n if (this.config.debug) {\n console.debug(message, ...optionalParams);\n }\n }\n}\nexports.RemoteEvaluationClient = RemoteEvaluationClient;\n/**\n * @deprecated use {@link RemoteEvaluationClient}.\n */\nclass ExperimentClient extends RemoteEvaluationClient {\n constructor(apiKey, config) {\n super(apiKey, config);\n }\n}\nexports.ExperimentClient = ExperimentClient;\n"],"names":["this","require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","config","e"],"mappings":";;;;;;;;;;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU,MAAM,SAAS,cAAc,CAAE,CAAA,GAAG,KAAI,CAAE;AAAA,EAC5E,CAAK;AACL;AACA,OAAO,eAAe,QAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AAC5D,OAAA,mBAA2B,OAAA,yBAAiC;AAC5D,MAAM,oBAAoBC;AAC1B,MAAM,YAAYC;AAClB,MAAM,SAASC;AACf,MAAM,WAAWC;AACjB,MAAM,SAASC;AACf,MAAM,YAAYC;AAKlB,MAAM,uBAAuB;A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MAAM,yBAAyB,uBAAuB;AAAA,EAClD,YAAY,QAAQD,SAAQ;AACxB,UAAM,QAAQA,OAAM;AAAA,EACvB;AACL;AACA,OAAA,mBAA2B;","x_google_ignoreList":[0]}
|
package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"http.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WrapperClient = exports.FetchHttpClient = void 0;\nconst http_1 = __importDefault(require(\"http\"));\nconst https_1 = __importDefault(require(\"https\"));\nconst url_1 = __importDefault(require(\"url\"));\nconst defaultHttpAgent = new https_1.default.Agent({\n keepAlive: true,\n});\nclass FetchHttpClient {\n constructor(httpAgent) {\n this.httpAgent = httpAgent || defaultHttpAgent;\n }\n /**\n * Wraps the http and https libraries in a fetch()-like interface\n * @param requestUrl\n * @param method HTTP Method (GET, POST, etc.)\n * @param headers HTTP Headers\n * @param Request body\n */\n request(requestUrl, method, headers, body, timeoutMillis) {\n return new Promise((resolve, reject) => {\n if (timeoutMillis === 0) {\n reject(Error('Response timed out'));\n return;\n }\n const urlParams = url_1.default.parse(requestUrl);\n const options = Object.assign(Object.assign({}, urlParams), { method: method, headers: headers, body: body, agent: this.httpAgent, timeout: timeoutMillis });\n const protocol = urlParams.protocol === 'http:' ? http_1.default : https_1.default;\n const req = protocol.request(options);\n req.on('response', (res) => {\n res.setEncoding('utf-8');\n let responseBody = '';\n res.on('data', (chunk) => {\n responseBody += chunk;\n });\n res.on('end', () => {\n resolve({\n status: res.statusCode,\n body: responseBody,\n });\n });\n });\n req.on('timeout', () => {\n req.destroy(Error('Socket connection timed out'));\n });\n req.on('error', (e) => {\n reject(e);\n });\n if (method !== 'GET' && body) {\n req.write(body);\n }\n req.end();\n });\n }\n}\nexports.FetchHttpClient = FetchHttpClient;\n/**\n * Wrap the exposed HttpClient in a CoreClient implementation to work with\n * FlagApi and EvaluationApi.\n */\nclass WrapperClient {\n constructor(client) {\n this.client = client;\n }\n request(request) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.client.request(request.requestUrl, request.method, request.headers, null, request.timeoutMillis);\n });\n }\n}\nexports.WrapperClient = WrapperClient;\n"],"names":["this","http"],"mappings":";;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"http.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WrapperClient = exports.FetchHttpClient = void 0;\nconst http_1 = __importDefault(require(\"http\"));\nconst https_1 = __importDefault(require(\"https\"));\nconst url_1 = __importDefault(require(\"url\"));\nconst defaultHttpAgent = new https_1.default.Agent({\n keepAlive: true,\n});\nclass FetchHttpClient {\n constructor(httpAgent) {\n this.httpAgent = httpAgent || defaultHttpAgent;\n }\n /**\n * Wraps the http and https libraries in a fetch()-like interface\n * @param requestUrl\n * @param method HTTP Method (GET, POST, etc.)\n * @param headers HTTP Headers\n * @param Request body\n */\n request(requestUrl, method, headers, body, timeoutMillis) {\n return new Promise((resolve, reject) => {\n if (timeoutMillis === 0) {\n reject(Error('Response timed out'));\n return;\n }\n const urlParams = url_1.default.parse(requestUrl);\n const options = Object.assign(Object.assign({}, urlParams), { method: method, headers: headers, body: body, agent: this.httpAgent, timeout: timeoutMillis });\n const protocol = urlParams.protocol === 'http:' ? http_1.default : https_1.default;\n const req = protocol.request(options);\n req.on('response', (res) => {\n res.setEncoding('utf-8');\n let responseBody = '';\n res.on('data', (chunk) => {\n responseBody += chunk;\n });\n res.on('end', () => {\n resolve({\n status: res.statusCode,\n body: responseBody,\n });\n });\n });\n req.on('timeout', () => {\n req.destroy(Error('Socket connection timed out'));\n });\n req.on('error', (e) => {\n reject(e);\n });\n if (method !== 'GET' && body) {\n req.write(body);\n }\n req.end();\n });\n }\n}\nexports.FetchHttpClient = FetchHttpClient;\n/**\n * Wrap the exposed HttpClient in a CoreClient implementation to work with\n * FlagApi and EvaluationApi.\n */\nclass WrapperClient {\n constructor(client) {\n this.client = client;\n }\n request(request) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.client.request(request.requestUrl, request.method, request.headers, null, request.timeoutMillis);\n });\n }\n}\nexports.WrapperClient = WrapperClient;\n"],"names":["this","http"],"mappings":";;;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU,MAAM,SAAS,cAAc,CAAE,CAAA,GAAG,KAAI,CAAE;AAAA,EAC5E,CAAK;AACL;AACA,IAAI,kBAAmBA,iBAAI,kBAAIA,iBAAI,eAAC,mBAAoB,SAAU,KAAK;AACnE,SAAQ,OAAO,IAAI,aAAc,MAAM,EAAE,WAAW;AACxD;AACA,OAAO,eAAeC,KAAAA,WAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AAC5DA,KAAA,UAAA,gBAAwBA,KAAAA,UAAA,kBAA0B;AAClD,MAAM,SAAS,gBAAgB,UAAe;AAC9C,MAAM,UAAU,gBAAgB,UAAgB;AAChD,MAAM,QAAQ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AA,kBAAG;AAK1B,MAAM,cAAc;AAAA,EAChB,YAAY,QAAQ;AAChB,SAAK,SAAS;AAAA,EACjB;AAAA,EACD,QAAQ,SAAS;AACb,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,aAAO,MAAM,KAAK,OAAO,QAAQ,QAAQ,YAAY,QAAQ,QAAQ,QAAQ,SAAS,MAAM,QAAQ,aAAa;AAAA,IAC7H,CAAS;AAAA,EACJ;AACL;AACAA,KAAA,UAAA,gBAAwB;;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"http.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WrapperClient = exports.FetchHttpClient = void 0;\nconst http_1 = __importDefault(require(\"http\"));\nconst https_1 = __importDefault(require(\"https\"));\nconst url_1 = __importDefault(require(\"url\"));\nconst defaultHttpAgent = new https_1.default.Agent({\n keepAlive: true,\n});\nclass FetchHttpClient {\n constructor(httpAgent) {\n this.httpAgent = httpAgent || defaultHttpAgent;\n }\n /**\n * Wraps the http and https libraries in a fetch()-like interface\n * @param requestUrl\n * @param method HTTP Method (GET, POST, etc.)\n * @param headers HTTP Headers\n * @param Request body\n */\n request(requestUrl, method, headers, body, timeoutMillis) {\n return new Promise((resolve, reject) => {\n if (timeoutMillis === 0) {\n reject(Error('Response timed out'));\n return;\n }\n const urlParams = url_1.default.parse(requestUrl);\n const options = Object.assign(Object.assign({}, urlParams), { method: method, headers: headers, body: body, agent: this.httpAgent, timeout: timeoutMillis });\n const protocol = urlParams.protocol === 'http:' ? http_1.default : https_1.default;\n const req = protocol.request(options);\n req.on('response', (res) => {\n res.setEncoding('utf-8');\n let responseBody = '';\n res.on('data', (chunk) => {\n responseBody += chunk;\n });\n res.on('end', () => {\n resolve({\n status: res.statusCode,\n body: responseBody,\n });\n });\n });\n req.on('timeout', () => {\n req.destroy(Error('Socket connection timed out'));\n });\n req.on('error', (e) => {\n reject(e);\n });\n if (method !== 'GET' && body) {\n req.write(body);\n }\n req.end();\n });\n }\n}\nexports.FetchHttpClient = FetchHttpClient;\n/**\n * Wrap the exposed HttpClient in a CoreClient implementation to work with\n * FlagApi and EvaluationApi.\n */\nclass WrapperClient {\n constructor(client) {\n this.client = client;\n }\n request(request) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.client.request(request.requestUrl, request.method, request.headers, null, request.timeoutMillis);\n });\n }\n}\nexports.WrapperClient = WrapperClient;\n"],"names":["this","require$$0","require$$1"],"mappings":";;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"http.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WrapperClient = exports.FetchHttpClient = void 0;\nconst http_1 = __importDefault(require(\"http\"));\nconst https_1 = __importDefault(require(\"https\"));\nconst url_1 = __importDefault(require(\"url\"));\nconst defaultHttpAgent = new https_1.default.Agent({\n keepAlive: true,\n});\nclass FetchHttpClient {\n constructor(httpAgent) {\n this.httpAgent = httpAgent || defaultHttpAgent;\n }\n /**\n * Wraps the http and https libraries in a fetch()-like interface\n * @param requestUrl\n * @param method HTTP Method (GET, POST, etc.)\n * @param headers HTTP Headers\n * @param Request body\n */\n request(requestUrl, method, headers, body, timeoutMillis) {\n return new Promise((resolve, reject) => {\n if (timeoutMillis === 0) {\n reject(Error('Response timed out'));\n return;\n }\n const urlParams = url_1.default.parse(requestUrl);\n const options = Object.assign(Object.assign({}, urlParams), { method: method, headers: headers, body: body, agent: this.httpAgent, timeout: timeoutMillis });\n const protocol = urlParams.protocol === 'http:' ? http_1.default : https_1.default;\n const req = protocol.request(options);\n req.on('response', (res) => {\n res.setEncoding('utf-8');\n let responseBody = '';\n res.on('data', (chunk) => {\n responseBody += chunk;\n });\n res.on('end', () => {\n resolve({\n status: res.statusCode,\n body: responseBody,\n });\n });\n });\n req.on('timeout', () => {\n req.destroy(Error('Socket connection timed out'));\n });\n req.on('error', (e) => {\n reject(e);\n });\n if (method !== 'GET' && body) {\n req.write(body);\n }\n req.end();\n });\n }\n}\nexports.FetchHttpClient = FetchHttpClient;\n/**\n * Wrap the exposed HttpClient in a CoreClient implementation to work with\n * FlagApi and EvaluationApi.\n */\nclass WrapperClient {\n constructor(client) {\n this.client = client;\n }\n request(request) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.client.request(request.requestUrl, request.method, request.headers, null, request.timeoutMillis);\n });\n }\n}\nexports.WrapperClient = WrapperClient;\n"],"names":["this","require$$0","require$$1"],"mappings":";;;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU,MAAM,SAAS,cAAc,CAAE,CAAA,GAAG,KAAI,CAAE;AAAA,EAC5E,CAAK;AACL;AACA,IAAI,kBAAmBA,kBAAQA,eAAK,mBAAoB,SAAU,KAAK;AACnE,SAAQ,OAAO,IAAI,aAAc,MAAM,EAAE,WAAW;AACxD;AACA,OAAO,eAAe,MAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AAC5D,KAAA,gBAAwB,K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C1B,YAAI,MAAM,IAAI;AAAA,MACjB;AACD,UAAI,IAAG;AAAA,IACnB,CAAS;AAAA,EACJ;AACL;AACuB,KAAA,kBAAG;AAK1B,MAAM,cAAc;AAAA,EAChB,YAAY,QAAQ;AAChB,SAAK,SAAS;AAAA,EACjB;AAAA,EACD,QAAQ,SAAS;AACb,WAAO,UAAU,MAAM,QAAQ,QAAQ,aAAa;AAChD,aAAO,MAAM,KAAK,OAAO,QAAQ,QAAQ,YAAY,QAAQ,QAAQ,QAAQ,SAAS,MAAM,QAAQ,aAAa;AAAA,IAC7H,CAAS;AAAA,EACJ;AACL;AACA,KAAA,gBAAwB;","x_google_ignoreList":[0]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"backoff.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.doWithBackoff = void 0;\nconst time_1 = require(\"./time\");\nfunction doWithBackoff(action, backoffPolicy) {\n return __awaiter(this, void 0, void 0, function* () {\n let delay = backoffPolicy.min;\n for (let i = 0; i < backoffPolicy.attempts; i++) {\n try {\n return yield action();\n }\n catch (e) {\n yield (0, time_1.sleep)(delay);\n delay = Math.min(delay * backoffPolicy.scalar, backoffPolicy.max);\n }\n }\n });\n}\nexports.doWithBackoff = doWithBackoff;\n"],"names":["this","backoff","require$$0"],"mappings":";;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"backoff.cjs","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.doWithBackoff = void 0;\nconst time_1 = require(\"./time\");\nfunction doWithBackoff(action, backoffPolicy) {\n return __awaiter(this, void 0, void 0, function* () {\n let delay = backoffPolicy.min;\n for (let i = 0; i < backoffPolicy.attempts; i++) {\n try {\n return yield action();\n }\n catch (e) {\n yield (0, time_1.sleep)(delay);\n delay = Math.min(delay * backoffPolicy.scalar, backoffPolicy.max);\n }\n }\n });\n}\nexports.doWithBackoff = doWithBackoff;\n"],"names":["this","backoff","require$$0"],"mappings":";;;;;AACA,IAAI,YAAaA,iBAAI,kBAAIA,gCAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,Q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ourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.doWithBackoff = void 0;\nconst time_1 = require(\"./time\");\nfunction doWithBackoff(action, backoffPolicy) {\n return __awaiter(this, void 0, void 0, function* () {\n let delay = backoffPolicy.min;\n for (let i = 0; i < backoffPolicy.attempts; i++) {\n try {\n return yield action();\n }\n catch (e) {\n yield (0, time_1.sleep)(delay);\n delay = Math.min(delay * backoffPolicy.scalar, backoffPolicy.max);\n }\n }\n });\n}\nexports.doWithBackoff = doWithBackoff;\n"],"names":["this","require$$0"],"mappings":";;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,
|
1
|
+
{"version":3,"file":"backoff.js","sources":["../../../../../../../../../node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.doWithBackoff = void 0;\nconst time_1 = require(\"./time\");\nfunction doWithBackoff(action, backoffPolicy) {\n return __awaiter(this, void 0, void 0, function* () {\n let delay = backoffPolicy.min;\n for (let i = 0; i < backoffPolicy.attempts; i++) {\n try {\n return yield action();\n }\n catch (e) {\n yield (0, time_1.sleep)(delay);\n delay = Math.min(delay * backoffPolicy.scalar, backoffPolicy.max);\n }\n }\n });\n}\nexports.doWithBackoff = doWithBackoff;\n"],"names":["this","require$$0"],"mappings":";;;;AACA,IAAI,YAAaA,kBAAQA,eAAK,aAAc,SAAU,SAAS,YAAY,GAAG,WAAW;AACrF,WAAS,MAAM,OAAO;AAAE,WAAO,iBAAiB,IAAI,QAAQ,IAAI,EAAE,SAAU,SAAS;AAAE,cAAQ,KAAK;AAAA,IAAE,CAAE;AAAA,EAAI;AAC5G,SAAO,KAAK,MAAM,IAAI,UAAU,SAAU,SAAS,QAAQ;AACvD,aAAS,UAAU,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MAAE,SAAU,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC3F,aAAS,SAAS,OAAO;AAAE,UAAI;AAAE,aAAK,UAAU,OAAO,EAAE,KAAK,CAAC;AAAA,MAAI,SAAQ,GAAG;AAAE,eAAO,CAAC;AAAA;IAAM;AAC9F,aAAS,KAAK,QAAQ;AAAE,aAAO,OAAO,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,KAAK,EAAE,KAAK,WAAW,QAAQ;AAAA,IAAI;AAC9G,UAAM,YAAY,UAAU,MAAM,SAAS,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