Auto-commit 2026-05-02 09:37
This commit is contained in:
21
node_modules/@segment/analytics-core/LICENSE.MD
generated
vendored
Normal file
21
node_modules/@segment/analytics-core/LICENSE.MD
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2021 Segment
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
3
node_modules/@segment/analytics-core/README.md
generated
vendored
Normal file
3
node_modules/@segment/analytics-core/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @segment/analytics-core
|
||||
|
||||
This package represents core 'shared' functionality that is shared by analytics packages. This is not designed to be used directly, but internal to analytics-node and analytics-browser.
|
||||
54
node_modules/@segment/analytics-core/dist/cjs/analytics/dispatch.js
generated
vendored
Normal file
54
node_modules/@segment/analytics-core/dist/cjs/analytics/dispatch.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dispatch = exports.getDelay = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var callback_1 = require("../callback");
|
||||
/* The amount of time in ms to wait before invoking the callback. */
|
||||
var getDelay = function (startTimeInEpochMS, timeoutInMS) {
|
||||
var elapsedTime = Date.now() - startTimeInEpochMS;
|
||||
// increasing the timeout increases the delay by almost the same amount -- this is weird legacy behavior.
|
||||
return Math.max((timeoutInMS !== null && timeoutInMS !== void 0 ? timeoutInMS : 300) - elapsedTime, 0);
|
||||
};
|
||||
exports.getDelay = getDelay;
|
||||
/**
|
||||
* Push an event into the dispatch queue and invoke any callbacks.
|
||||
*
|
||||
* @param event - Segment event to enqueue.
|
||||
* @param queue - Queue to dispatch against.
|
||||
* @param emitter - This is typically an instance of "Analytics" -- used for metrics / progress information.
|
||||
* @param options
|
||||
*/
|
||||
function dispatch(ctx, queue, emitter, options) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var startTime, dispatched;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
emitter.emit('dispatch_start', ctx);
|
||||
startTime = Date.now();
|
||||
if (!queue.isEmpty()) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, queue.dispatchSingle(ctx)];
|
||||
case 1:
|
||||
dispatched = _a.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 2: return [4 /*yield*/, queue.dispatch(ctx)];
|
||||
case 3:
|
||||
dispatched = _a.sent();
|
||||
_a.label = 4;
|
||||
case 4:
|
||||
if (!(options === null || options === void 0 ? void 0 : options.callback)) return [3 /*break*/, 6];
|
||||
return [4 /*yield*/, (0, callback_1.invokeCallback)(dispatched, options.callback, (0, exports.getDelay)(startTime, options.timeout))];
|
||||
case 5:
|
||||
dispatched = _a.sent();
|
||||
_a.label = 6;
|
||||
case 6:
|
||||
if (options === null || options === void 0 ? void 0 : options.debug) {
|
||||
dispatched.flush();
|
||||
}
|
||||
return [2 /*return*/, dispatched];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.dispatch = dispatch;
|
||||
//# sourceMappingURL=dispatch.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/analytics/dispatch.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/analytics/dispatch.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../src/analytics/dispatch.ts"],"names":[],"mappings":";;;;AAGA,wCAA4C;AAS5C,oEAAoE;AAC7D,IAAM,QAAQ,GAAG,UAAC,kBAA0B,EAAE,WAAoB;IACvE,IAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAA;IACnD,yGAAyG;IACzG,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC,CAAC,CAAA;AACxD,CAAC,CAAA;AAJY,QAAA,QAAQ,YAIpB;AACD;;;;;;;GAOG;AACH,SAAsB,QAAQ,CAI5B,GAAQ,EACR,KAAS,EACT,OAAgB,EAChB,OAA8B;;;;;;oBAE9B,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;oBAE7B,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;yBAExB,KAAK,CAAC,OAAO,EAAE,EAAf,wBAAe;oBACJ,qBAAM,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,EAAA;;oBAA5C,UAAU,GAAG,SAA+B,CAAA;;wBAE/B,qBAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAA;;oBAAtC,UAAU,GAAG,SAAyB,CAAA;;;yBAGpC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAA,EAAjB,wBAAiB;oBACN,qBAAM,IAAA,yBAAc,EAC/B,UAAU,EACV,OAAO,CAAC,QAAQ,EAChB,IAAA,gBAAQ,EAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CACrC,EAAA;;oBAJD,UAAU,GAAG,SAIZ,CAAA;;;oBAEH,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,EAAE;wBAClB,UAAU,CAAC,KAAK,EAAE,CAAA;qBACnB;oBAED,sBAAO,UAAU,EAAA;;;;CAClB;AA/BD,4BA+BC"}
|
||||
3
node_modules/@segment/analytics-core/dist/cjs/analytics/index.js
generated
vendored
Normal file
3
node_modules/@segment/analytics-core/dist/cjs/analytics/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/analytics/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/analytics/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/analytics/index.ts"],"names":[],"mappings":""}
|
||||
46
node_modules/@segment/analytics-core/dist/cjs/callback/index.js
generated
vendored
Normal file
46
node_modules/@segment/analytics-core/dist/cjs/callback/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.invokeCallback = exports.sleep = exports.pTimeout = void 0;
|
||||
function pTimeout(promise, timeout) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var timeoutId = setTimeout(function () {
|
||||
reject(Error('Promise timed out'));
|
||||
}, timeout);
|
||||
promise
|
||||
.then(function (val) {
|
||||
clearTimeout(timeoutId);
|
||||
return resolve(val);
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
exports.pTimeout = pTimeout;
|
||||
function sleep(timeoutInMs) {
|
||||
return new Promise(function (resolve) { return setTimeout(resolve, timeoutInMs); });
|
||||
}
|
||||
exports.sleep = sleep;
|
||||
/**
|
||||
* @param ctx
|
||||
* @param callback - the function to invoke
|
||||
* @param delay - aka "timeout". The amount of time in ms to wait before invoking the callback.
|
||||
*/
|
||||
function invokeCallback(ctx, callback, delay) {
|
||||
var cb = function () {
|
||||
try {
|
||||
return Promise.resolve(callback(ctx));
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
};
|
||||
return (sleep(delay)
|
||||
// pTimeout ensures that the callback can't cause the context to hang
|
||||
.then(function () { return pTimeout(cb(), 1000); })
|
||||
.catch(function (err) {
|
||||
ctx === null || ctx === void 0 ? void 0 : ctx.log('warn', 'Callback Error', { error: err });
|
||||
ctx === null || ctx === void 0 ? void 0 : ctx.stats.increment('callback_error');
|
||||
})
|
||||
.then(function () { return ctx; }));
|
||||
}
|
||||
exports.invokeCallback = invokeCallback;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/callback/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/callback/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/callback/index.ts"],"names":[],"mappings":";;;AAGA,SAAgB,QAAQ,CAAI,OAAmB,EAAE,OAAe;IAC9D,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACjC,IAAM,SAAS,GAAG,UAAU,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAA;QACpC,CAAC,EAAE,OAAO,CAAC,CAAA;QAEX,OAAO;aACJ,IAAI,CAAC,UAAC,GAAG;YACR,YAAY,CAAC,SAAS,CAAC,CAAA;YACvB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAA;QACrB,CAAC,CAAC;aACD,KAAK,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC;AAbD,4BAaC;AAED,SAAgB,KAAK,CAAC,WAAmB;IACvC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,IAAK,OAAA,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,EAAhC,CAAgC,CAAC,CAAA;AACnE,CAAC;AAFD,sBAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAC5B,GAAQ,EACR,QAAuB,EACvB,KAAa;IAEb,IAAM,EAAE,GAAG;QACT,IAAI;YACF,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;SACtC;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SAC3B;IACH,CAAC,CAAA;IAED,OAAO,CACL,KAAK,CAAC,KAAK,CAAC;QACV,qEAAqE;SACpE,IAAI,CAAC,cAAM,OAAA,QAAQ,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAApB,CAAoB,CAAC;SAChC,KAAK,CAAC,UAAC,GAAG;QACT,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QAClD,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;IACxC,CAAC,CAAC;SACD,IAAI,CAAC,cAAM,OAAA,GAAG,EAAH,CAAG,CAAC,CACnB,CAAA;AACH,CAAC;AAvBD,wCAuBC"}
|
||||
87
node_modules/@segment/analytics-core/dist/cjs/context/index.js
generated
vendored
Normal file
87
node_modules/@segment/analytics-core/dist/cjs/context/index.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoreContext = exports.ContextCancelation = void 0;
|
||||
var uuid_1 = require("@lukeed/uuid");
|
||||
var dset_1 = require("dset");
|
||||
var logger_1 = require("../logger");
|
||||
var stats_1 = require("../stats");
|
||||
var ContextCancelation = /** @class */ (function () {
|
||||
function ContextCancelation(options) {
|
||||
var _a, _b, _c;
|
||||
this.retry = (_a = options.retry) !== null && _a !== void 0 ? _a : true;
|
||||
this.type = (_b = options.type) !== null && _b !== void 0 ? _b : 'plugin Error';
|
||||
this.reason = (_c = options.reason) !== null && _c !== void 0 ? _c : '';
|
||||
}
|
||||
return ContextCancelation;
|
||||
}());
|
||||
exports.ContextCancelation = ContextCancelation;
|
||||
var CoreContext = /** @class */ (function () {
|
||||
function CoreContext(event, id, stats, logger) {
|
||||
if (id === void 0) { id = (0, uuid_1.v4)(); }
|
||||
if (stats === void 0) { stats = new stats_1.NullStats(); }
|
||||
if (logger === void 0) { logger = new logger_1.CoreLogger(); }
|
||||
this.attempts = 0;
|
||||
this.event = event;
|
||||
this._id = id;
|
||||
this.logger = logger;
|
||||
this.stats = stats;
|
||||
}
|
||||
CoreContext.system = function () {
|
||||
// This should be overridden by the subclass to return an instance of the subclass.
|
||||
};
|
||||
CoreContext.prototype.isSame = function (other) {
|
||||
return other.id === this.id;
|
||||
};
|
||||
CoreContext.prototype.cancel = function (error) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
throw new ContextCancelation({ reason: 'Context Cancel' });
|
||||
};
|
||||
CoreContext.prototype.log = function (level, message, extras) {
|
||||
this.logger.log(level, message, extras);
|
||||
};
|
||||
Object.defineProperty(CoreContext.prototype, "id", {
|
||||
get: function () {
|
||||
return this._id;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
CoreContext.prototype.updateEvent = function (path, val) {
|
||||
var _a;
|
||||
// Don't allow integrations that are set to false to be overwritten with integration settings.
|
||||
if (path.split('.')[0] === 'integrations') {
|
||||
var integrationName = path.split('.')[1];
|
||||
if (((_a = this.event.integrations) === null || _a === void 0 ? void 0 : _a[integrationName]) === false) {
|
||||
return this.event;
|
||||
}
|
||||
}
|
||||
(0, dset_1.dset)(this.event, path, val);
|
||||
return this.event;
|
||||
};
|
||||
CoreContext.prototype.failedDelivery = function () {
|
||||
return this._failedDelivery;
|
||||
};
|
||||
CoreContext.prototype.setFailedDelivery = function (options) {
|
||||
this._failedDelivery = options;
|
||||
};
|
||||
CoreContext.prototype.logs = function () {
|
||||
return this.logger.logs;
|
||||
};
|
||||
CoreContext.prototype.flush = function () {
|
||||
this.logger.flush();
|
||||
this.stats.flush();
|
||||
};
|
||||
CoreContext.prototype.toJSON = function () {
|
||||
return {
|
||||
id: this._id,
|
||||
event: this.event,
|
||||
logs: this.logger.logs,
|
||||
metrics: this.stats.metrics,
|
||||
};
|
||||
};
|
||||
return CoreContext;
|
||||
}());
|
||||
exports.CoreContext = CoreContext;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/context/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/context/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":";;;AAEA,qCAAyC;AACzC,6BAA2B;AAC3B,oCAA4D;AAC5D,kCAA2D;AAmB3D;IAKE,4BAAY,OAA2B;;QACrC,IAAI,CAAC,KAAK,GAAG,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,MAAA,OAAO,CAAC,IAAI,mCAAI,cAAc,CAAA;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,EAAE,CAAA;IACpC,CAAC;IACH,yBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,gDAAkB;AAY/B;IAWE,qBACE,KAAY,EACZ,EAAW,EACX,KAAkC,EAClC,MAAyB;QAFzB,mBAAA,EAAA,SAAK,SAAI,GAAE;QACX,sBAAA,EAAA,YAAuB,iBAAS,EAAE;QAClC,uBAA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CAAA;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,oCAAc,GAAd;QACE,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IAED,uCAAiB,GAAjB,UAAkB,OAA8B;QAC9C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAA;IAChC,CAAC;IAED,0BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;IACzB,CAAC;IAED,2BAAK,GAAL;QACE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QACnB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,4BAAM,GAAN;QACE,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACtB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;SAC5B,CAAA;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAtFD,IAsFC;AAtFqB,kCAAW"}
|
||||
3
node_modules/@segment/analytics-core/dist/cjs/emitter/interface.js
generated
vendored
Normal file
3
node_modules/@segment/analytics-core/dist/cjs/emitter/interface.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=interface.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/emitter/interface.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/emitter/interface.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/emitter/interface.ts"],"names":[],"mappings":""}
|
||||
149
node_modules/@segment/analytics-core/dist/cjs/events/index.js
generated
vendored
Normal file
149
node_modules/@segment/analytics-core/dist/cjs/events/index.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EventFactory = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./interfaces"), exports);
|
||||
var dset_1 = require("dset");
|
||||
var pick_1 = require("../utils/pick");
|
||||
var assertions_1 = require("../validation/assertions");
|
||||
var EventFactory = /** @class */ (function () {
|
||||
function EventFactory(settings) {
|
||||
this.user = settings.user;
|
||||
this.createMessageId = settings.createMessageId;
|
||||
}
|
||||
EventFactory.prototype.track = function (event, properties, options, globalIntegrations) {
|
||||
return this.normalize(tslib_1.__assign(tslib_1.__assign({}, this.baseEvent()), { event: event, type: 'track', properties: properties !== null && properties !== void 0 ? properties : {}, options: tslib_1.__assign({}, options), integrations: tslib_1.__assign({}, globalIntegrations) }));
|
||||
};
|
||||
EventFactory.prototype.page = function (category, page, properties, options, globalIntegrations) {
|
||||
var _a;
|
||||
var event = {
|
||||
type: 'page',
|
||||
properties: tslib_1.__assign({}, properties),
|
||||
options: tslib_1.__assign({}, options),
|
||||
integrations: tslib_1.__assign({}, globalIntegrations),
|
||||
};
|
||||
if (category !== null) {
|
||||
event.category = category;
|
||||
event.properties = (_a = event.properties) !== null && _a !== void 0 ? _a : {};
|
||||
event.properties.category = category;
|
||||
}
|
||||
if (page !== null) {
|
||||
event.name = page;
|
||||
}
|
||||
return this.normalize(tslib_1.__assign(tslib_1.__assign({}, this.baseEvent()), event));
|
||||
};
|
||||
EventFactory.prototype.screen = function (category, screen, properties, options, globalIntegrations) {
|
||||
var event = {
|
||||
type: 'screen',
|
||||
properties: tslib_1.__assign({}, properties),
|
||||
options: tslib_1.__assign({}, options),
|
||||
integrations: tslib_1.__assign({}, globalIntegrations),
|
||||
};
|
||||
if (category !== null) {
|
||||
event.category = category;
|
||||
}
|
||||
if (screen !== null) {
|
||||
event.name = screen;
|
||||
}
|
||||
return this.normalize(tslib_1.__assign(tslib_1.__assign({}, this.baseEvent()), event));
|
||||
};
|
||||
EventFactory.prototype.identify = function (userId, traits, options, globalIntegrations) {
|
||||
return this.normalize(tslib_1.__assign(tslib_1.__assign({}, this.baseEvent()), { type: 'identify', userId: userId, traits: traits !== null && traits !== void 0 ? traits : {}, options: tslib_1.__assign({}, options), integrations: globalIntegrations }));
|
||||
};
|
||||
EventFactory.prototype.group = function (groupId, traits, options, globalIntegrations) {
|
||||
return this.normalize(tslib_1.__assign(tslib_1.__assign({}, this.baseEvent()), { type: 'group', traits: traits !== null && traits !== void 0 ? traits : {}, options: tslib_1.__assign({}, options), integrations: tslib_1.__assign({}, globalIntegrations), //
|
||||
groupId: groupId }));
|
||||
};
|
||||
EventFactory.prototype.alias = function (to, from, // TODO: can we make this undefined?
|
||||
options, globalIntegrations) {
|
||||
var base = {
|
||||
userId: to,
|
||||
type: 'alias',
|
||||
options: tslib_1.__assign({}, options),
|
||||
integrations: tslib_1.__assign({}, globalIntegrations),
|
||||
};
|
||||
if (from !== null) {
|
||||
base.previousId = from;
|
||||
}
|
||||
if (to === undefined) {
|
||||
return this.normalize(tslib_1.__assign(tslib_1.__assign({}, base), this.baseEvent()));
|
||||
}
|
||||
return this.normalize(tslib_1.__assign(tslib_1.__assign({}, this.baseEvent()), base));
|
||||
};
|
||||
EventFactory.prototype.baseEvent = function () {
|
||||
var base = {
|
||||
integrations: {},
|
||||
options: {},
|
||||
};
|
||||
if (!this.user)
|
||||
return base;
|
||||
var user = this.user;
|
||||
if (user.id()) {
|
||||
base.userId = user.id();
|
||||
}
|
||||
if (user.anonymousId()) {
|
||||
base.anonymousId = user.anonymousId();
|
||||
}
|
||||
return base;
|
||||
};
|
||||
/**
|
||||
* Builds the context part of an event based on "foreign" keys that
|
||||
* are provided in the `Options` parameter for an Event
|
||||
*/
|
||||
EventFactory.prototype.context = function (options) {
|
||||
var _a;
|
||||
/**
|
||||
* If the event options are known keys from this list, we move them to the top level of the event.
|
||||
* Any other options are moved to context.
|
||||
*/
|
||||
var eventOverrideKeys = [
|
||||
'userId',
|
||||
'anonymousId',
|
||||
'timestamp',
|
||||
];
|
||||
delete options['integrations'];
|
||||
var providedOptionsKeys = Object.keys(options);
|
||||
var context = (_a = options.context) !== null && _a !== void 0 ? _a : {};
|
||||
var eventOverrides = {};
|
||||
providedOptionsKeys.forEach(function (key) {
|
||||
if (key === 'context') {
|
||||
return;
|
||||
}
|
||||
if (eventOverrideKeys.includes(key)) {
|
||||
(0, dset_1.dset)(eventOverrides, key, options[key]);
|
||||
}
|
||||
else {
|
||||
(0, dset_1.dset)(context, key, options[key]);
|
||||
}
|
||||
});
|
||||
return [context, eventOverrides];
|
||||
};
|
||||
EventFactory.prototype.normalize = function (event) {
|
||||
var _a, _b;
|
||||
var integrationBooleans = Object.keys((_a = event.integrations) !== null && _a !== void 0 ? _a : {}).reduce(function (integrationNames, name) {
|
||||
var _a;
|
||||
var _b;
|
||||
return tslib_1.__assign(tslib_1.__assign({}, integrationNames), (_a = {}, _a[name] = Boolean((_b = event.integrations) === null || _b === void 0 ? void 0 : _b[name]), _a));
|
||||
}, {});
|
||||
// filter out any undefined options
|
||||
event.options = (0, pick_1.pickBy)(event.options || {}, function (_, value) {
|
||||
return value !== undefined;
|
||||
});
|
||||
// This is pretty trippy, but here's what's going on:
|
||||
// - a) We don't pass initial integration options as part of the event, only if they're true or false
|
||||
// - b) We do accept per integration overrides (like integrations.Amplitude.sessionId) at the event level
|
||||
// Hence the need to convert base integration options to booleans, but maintain per event integration overrides
|
||||
var allIntegrations = tslib_1.__assign(tslib_1.__assign({}, integrationBooleans), (_b = event.options) === null || _b === void 0 ? void 0 : _b.integrations);
|
||||
var _c = event.options
|
||||
? this.context(event.options)
|
||||
: [], context = _c[0], overrides = _c[1];
|
||||
var options = event.options, rest = tslib_1.__rest(event, ["options"]);
|
||||
var body = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ timestamp: new Date() }, rest), { integrations: allIntegrations, context: context }), overrides);
|
||||
var evt = tslib_1.__assign(tslib_1.__assign({}, body), { messageId: this.createMessageId() });
|
||||
(0, assertions_1.validateEvent)(evt);
|
||||
return evt;
|
||||
};
|
||||
return EventFactory;
|
||||
}());
|
||||
exports.EventFactory = EventFactory;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/events/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/events/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":";;;;AAAA,uDAA4B;AAC5B,6BAA2B;AAW3B,sCAAsC;AACtC,uDAAwD;AAQxD;IAIE,sBAAY,QAA8B;QACxC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAA;QACzB,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;IACjD,CAAC;IAED,4BAAK,GAAL,UACE,KAAa,EACb,UAA4B,EAC5B,OAAqB,EACrB,kBAAiC;QAEjC,OAAO,IAAI,CAAC,SAAS,uCAChB,IAAI,CAAC,SAAS,EAAE,KACnB,KAAK,OAAA,EACL,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,EAC5B,OAAO,uBAAO,OAAO,GACrB,YAAY,uBAAO,kBAAkB,KACrC,CAAA;IACJ,CAAC;IAED,2BAAI,GAAJ,UACE,QAAuB,EACvB,IAAmB,EACnB,UAA4B,EAC5B,OAAqB,EACrB,kBAAiC;;QAEjC,IAAM,KAAK,GAAqB;YAC9B,IAAI,EAAE,MAAM;YACZ,UAAU,uBAAO,UAAU,CAAE;YAC7B,OAAO,uBAAO,OAAO,CAAE;YACvB,YAAY,uBAAO,kBAAkB,CAAE;SACxC,CAAA;QAED,IAAI,QAAQ,KAAK,IAAI,EAAE;YACrB,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;YACzB,KAAK,CAAC,UAAU,GAAG,MAAA,KAAK,CAAC,U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qDAAqD;QACrD,qGAAqG;QACrG,yGAAyG;QACzG,+GAA+G;QAC/G,IAAM,eAAe,yCAEhB,mBAAmB,GAGnB,MAAA,KAAK,CAAC,OAAO,0CAAE,YAAY,CAC/B,CAAA;QAEK,IAAA,KAAuB,KAAK,CAAC,OAAO;YACxC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;YAC7B,CAAC,CAAC,EAAE,EAFC,OAAO,QAAA,EAAE,SAAS,QAEnB,CAAA;QAEE,IAAA,OAAO,GAAc,KAAK,QAAnB,EAAK,IAAI,kBAAK,KAAK,EAA5B,WAAoB,CAAF,CAAU;QAElC,IAAM,IAAI,wDACR,SAAS,EAAE,IAAI,IAAI,EAAE,IAClB,IAAI,KACP,YAAY,EAAE,eAAe,EAC7B,OAAO,SAAA,KACJ,SAAS,CACb,CAAA;QAED,IAAM,GAAG,yCACJ,IAAI,KACP,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,GAClC,CAAA;QAED,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAA;QAClB,OAAO,GAAG,CAAA;IACZ,CAAC;IACH,mBAAC;AAAD,CAAC,AAlQD,IAkQC;AAlQY,oCAAY"}
|
||||
3
node_modules/@segment/analytics-core/dist/cjs/events/interfaces.js
generated
vendored
Normal file
3
node_modules/@segment/analytics-core/dist/cjs/events/interfaces.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=interfaces.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/events/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/events/interfaces.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/events/interfaces.ts"],"names":[],"mappings":""}
|
||||
25
node_modules/@segment/analytics-core/dist/cjs/index.js
generated
vendored
Normal file
25
node_modules/@segment/analytics-core/dist/cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoreLogger = exports.backoff = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./emitter/interface"), exports);
|
||||
tslib_1.__exportStar(require("./plugins"), exports);
|
||||
tslib_1.__exportStar(require("./events/interfaces"), exports);
|
||||
tslib_1.__exportStar(require("./events"), exports);
|
||||
tslib_1.__exportStar(require("./callback"), exports);
|
||||
tslib_1.__exportStar(require("./priority-queue"), exports);
|
||||
var backoff_1 = require("./priority-queue/backoff");
|
||||
Object.defineProperty(exports, "backoff", { enumerable: true, get: function () { return backoff_1.backoff; } });
|
||||
tslib_1.__exportStar(require("./context"), exports);
|
||||
tslib_1.__exportStar(require("./queue/event-queue"), exports);
|
||||
tslib_1.__exportStar(require("./analytics"), exports);
|
||||
tslib_1.__exportStar(require("./analytics/dispatch"), exports);
|
||||
tslib_1.__exportStar(require("./validation/helpers"), exports);
|
||||
tslib_1.__exportStar(require("./validation/errors"), exports);
|
||||
tslib_1.__exportStar(require("./validation/assertions"), exports);
|
||||
tslib_1.__exportStar(require("./utils/bind-all"), exports);
|
||||
tslib_1.__exportStar(require("./stats"), exports);
|
||||
var logger_1 = require("./logger");
|
||||
Object.defineProperty(exports, "CoreLogger", { enumerable: true, get: function () { return logger_1.CoreLogger; } });
|
||||
tslib_1.__exportStar(require("./queue/delivery"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,8DAAmC;AACnC,oDAAyB;AACzB,8DAAmC;AACnC,mDAAwB;AACxB,qDAA0B;AAC1B,2DAAgC;AAChC,oDAAkD;AAAzC,kGAAA,OAAO,OAAA;AAChB,oDAAyB;AACzB,8DAAmC;AACnC,sDAA2B;AAC3B,+DAAoC;AACpC,+DAAoC;AACpC,8DAAmC;AACnC,kEAAuC;AACvC,2DAAgC;AAChC,kDAAuB;AACvB,mCAAqC;AAA5B,oGAAA,UAAU,OAAA;AACnB,2DAAgC"}
|
||||
62
node_modules/@segment/analytics-core/dist/cjs/logger/index.js
generated
vendored
Normal file
62
node_modules/@segment/analytics-core/dist/cjs/logger/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoreLogger = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var CoreLogger = /** @class */ (function () {
|
||||
function CoreLogger() {
|
||||
this._logs = [];
|
||||
}
|
||||
CoreLogger.prototype.log = function (level, message, extras) {
|
||||
var time = new Date();
|
||||
this._logs.push({
|
||||
level: level,
|
||||
message: message,
|
||||
time: time,
|
||||
extras: extras,
|
||||
});
|
||||
};
|
||||
Object.defineProperty(CoreLogger.prototype, "logs", {
|
||||
get: function () {
|
||||
return this._logs;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
CoreLogger.prototype.flush = function () {
|
||||
if (this.logs.length > 1) {
|
||||
var formatted = this._logs.reduce(function (logs, log) {
|
||||
var _a;
|
||||
var _b, _c;
|
||||
var line = tslib_1.__assign(tslib_1.__assign({}, log), { json: JSON.stringify(log.extras, null, ' '), extras: log.extras });
|
||||
delete line['time'];
|
||||
var key = (_c = (_b = log.time) === null || _b === void 0 ? void 0 : _b.toISOString()) !== null && _c !== void 0 ? _c : '';
|
||||
if (logs[key]) {
|
||||
key = "".concat(key, "-").concat(Math.random());
|
||||
}
|
||||
return tslib_1.__assign(tslib_1.__assign({}, logs), (_a = {}, _a[key] = line, _a));
|
||||
}, {});
|
||||
// ie doesn't like console.table
|
||||
if (console.table) {
|
||||
console.table(formatted);
|
||||
}
|
||||
else {
|
||||
console.log(formatted);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.logs.forEach(function (logEntry) {
|
||||
var level = logEntry.level, message = logEntry.message, extras = logEntry.extras;
|
||||
if (level === 'info' || level === 'debug') {
|
||||
console.log(message, extras !== null && extras !== void 0 ? extras : '');
|
||||
}
|
||||
else {
|
||||
console[level](message, extras !== null && extras !== void 0 ? extras : '');
|
||||
}
|
||||
});
|
||||
}
|
||||
this._logs = [];
|
||||
};
|
||||
return CoreLogger;
|
||||
}());
|
||||
exports.CoreLogger = CoreLogger;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/logger/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/logger/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/logger/index.ts"],"names":[],"mappings":";;;;AAcA;IAAA;QACU,UAAK,GAAiB,EAAE,CAAA;IA0DlC,CAAC;IAxDC,wBAAG,GAAH,UAAI,KAAe,EAAE,OAAe,EAAE,MAAe;QACnD,IAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,KAAK,OAAA;YACL,OAAO,SAAA;YACP,IAAI,MAAA;YACJ,MAAM,QAAA;SACP,CAAC,CAAA;IACJ,CAAC;IAED,sBAAW,4BAAI;aAAf;YACE,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;;;OAAA;IAEM,0BAAK,GAAZ;QACE,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,IAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,EAAE,GAAG;;;gBAC5C,IAAM,IAAI,yCACL,GAAG,KACN,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,G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/cjs/plugins/index.js
generated
vendored
Normal file
3
node_modules/@segment/analytics-core/dist/cjs/plugins/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/plugins/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/plugins/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":""}
|
||||
10
node_modules/@segment/analytics-core/dist/cjs/priority-queue/backoff.js
generated
vendored
Normal file
10
node_modules/@segment/analytics-core/dist/cjs/priority-queue/backoff.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.backoff = void 0;
|
||||
function backoff(params) {
|
||||
var random = Math.random() + 1;
|
||||
var _a = params.minTimeout, minTimeout = _a === void 0 ? 500 : _a, _b = params.factor, factor = _b === void 0 ? 2 : _b, attempt = params.attempt, _c = params.maxTimeout, maxTimeout = _c === void 0 ? Infinity : _c;
|
||||
return Math.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout);
|
||||
}
|
||||
exports.backoff = backoff;
|
||||
//# sourceMappingURL=backoff.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/priority-queue/backoff.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/priority-queue/backoff.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../../src/priority-queue/backoff.ts"],"names":[],"mappings":";;;AAcA,SAAgB,OAAO,CAAC,MAAqB;IAC3C,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE9B,IAAA,KAIE,MAAM,WAJQ,EAAhB,UAAU,mBAAG,GAAG,KAAA,EAChB,KAGE,MAAM,OAHE,EAAV,MAAM,mBAAG,CAAC,KAAA,EACV,OAAO,GAEL,MAAM,QAFD,EACP,KACE,MAAM,WADa,EAArB,UAAU,mBAAG,QAAQ,KAAA,CACb;IACV,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,CAAA;AAC9E,CAAC;AATD,0BASC"}
|
||||
92
node_modules/@segment/analytics-core/dist/cjs/priority-queue/index.js
generated
vendored
Normal file
92
node_modules/@segment/analytics-core/dist/cjs/priority-queue/index.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PriorityQueue = exports.ON_REMOVE_FROM_FUTURE = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var analytics_generic_utils_1 = require("@segment/analytics-generic-utils");
|
||||
var backoff_1 = require("./backoff");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.ON_REMOVE_FROM_FUTURE = 'onRemoveFromFuture';
|
||||
var PriorityQueue = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(PriorityQueue, _super);
|
||||
function PriorityQueue(maxAttempts, queue, seen) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.future = [];
|
||||
_this.maxAttempts = maxAttempts;
|
||||
_this.queue = queue;
|
||||
_this.seen = seen !== null && seen !== void 0 ? seen : {};
|
||||
return _this;
|
||||
}
|
||||
PriorityQueue.prototype.push = function () {
|
||||
var _this = this;
|
||||
var items = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
items[_i] = arguments[_i];
|
||||
}
|
||||
var accepted = items.map(function (operation) {
|
||||
var attempts = _this.updateAttempts(operation);
|
||||
if (attempts > _this.maxAttempts || _this.includes(operation)) {
|
||||
return false;
|
||||
}
|
||||
_this.queue.push(operation);
|
||||
return true;
|
||||
});
|
||||
this.queue = this.queue.sort(function (a, b) { return _this.getAttempts(a) - _this.getAttempts(b); });
|
||||
return accepted;
|
||||
};
|
||||
PriorityQueue.prototype.pushWithBackoff = function (item) {
|
||||
var _this = this;
|
||||
if (this.getAttempts(item) === 0) {
|
||||
return this.push(item)[0];
|
||||
}
|
||||
var attempt = this.updateAttempts(item);
|
||||
if (attempt > this.maxAttempts || this.includes(item)) {
|
||||
return false;
|
||||
}
|
||||
var timeout = (0, backoff_1.backoff)({ attempt: attempt - 1 });
|
||||
setTimeout(function () {
|
||||
_this.queue.push(item);
|
||||
// remove from future list
|
||||
_this.future = _this.future.filter(function (f) { return f.id !== item.id; });
|
||||
// Lets listeners know that a 'future' message is now available in the queue
|
||||
_this.emit(exports.ON_REMOVE_FROM_FUTURE);
|
||||
}, timeout);
|
||||
this.future.push(item);
|
||||
return true;
|
||||
};
|
||||
PriorityQueue.prototype.getAttempts = function (item) {
|
||||
var _a;
|
||||
return (_a = this.seen[item.id]) !== null && _a !== void 0 ? _a : 0;
|
||||
};
|
||||
PriorityQueue.prototype.updateAttempts = function (item) {
|
||||
this.seen[item.id] = this.getAttempts(item) + 1;
|
||||
return this.getAttempts(item);
|
||||
};
|
||||
PriorityQueue.prototype.includes = function (item) {
|
||||
return (this.queue.includes(item) ||
|
||||
this.future.includes(item) ||
|
||||
Boolean(this.queue.find(function (i) { return i.id === item.id; })) ||
|
||||
Boolean(this.future.find(function (i) { return i.id === item.id; })));
|
||||
};
|
||||
PriorityQueue.prototype.pop = function () {
|
||||
return this.queue.shift();
|
||||
};
|
||||
Object.defineProperty(PriorityQueue.prototype, "length", {
|
||||
get: function () {
|
||||
return this.queue.length;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(PriorityQueue.prototype, "todo", {
|
||||
get: function () {
|
||||
return this.queue.length + this.future.length;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return PriorityQueue;
|
||||
}(analytics_generic_utils_1.Emitter));
|
||||
exports.PriorityQueue = PriorityQueue;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/priority-queue/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/priority-queue/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/priority-queue/index.ts"],"names":[],"mappings":";;;;AAAA,4EAA0D;AAC1D,qCAAmC;AAEnC;;GAEG;AACU,QAAA,qBAAqB,GAAG,oBAAoB,CAAA;AAMzD;IAAuE,yCAAO;IAO5E,uBACE,WAAmB,EACnB,KAAa,EACb,IAA6B;QAH/B,YAKE,iBAAO,SAIR;QAfS,YAAM,GAAW,EAAE,CAAA;QAY3B,KAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,KAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,KAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAA;;IACxB,CAAC;IAED,4BAAI,GAAJ;QAAA,iBAgBC;QAhBI,eAAgB;aAAhB,UAAgB,EAAhB,qBAAgB,EAAhB,IAAgB;YAAhB,0BAAgB;;QACnB,IAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,SAAS;YACnC,IAAM,QAAQ,GAAG,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;YAE/C,IAAI,QAAQ,GAAG,KAAI,CAAC,WAAW,IAAI,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;gBAC3D,OAAO,KAAK,CAAA;aACb;YAED,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC1B,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,C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AChC,CAAC;IAEM,sCAAc,GAArB,UAAsB,IAAU;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,gCAAQ,GAAR,UAAS,IAAU;QACjB,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,EAAhB,CAAgB,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,EAAhB,CAAgB,CAAC,CAAC,CACnD,CAAA;IACH,CAAC;IAED,2BAAG,GAAH;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC3B,CAAC;IAED,sBAAW,iCAAM;aAAjB;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;QAC1B,CAAC;;;OAAA;IAED,sBAAW,+BAAI;aAAf;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;QAC/C,CAAC;;;OAAA;IACH,oBAAC;AAAD,CAAC,AA1FD,CAAuE,iCAAO,GA0F7E;AA1FY,sCAAa"}
|
||||
69
node_modules/@segment/analytics-core/dist/cjs/queue/delivery.js
generated
vendored
Normal file
69
node_modules/@segment/analytics-core/dist/cjs/queue/delivery.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ensure = exports.attempt = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var context_1 = require("../context");
|
||||
function tryAsync(fn) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var err_1;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 2, , 3]);
|
||||
return [4 /*yield*/, fn()];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
case 2:
|
||||
err_1 = _a.sent();
|
||||
return [2 /*return*/, Promise.reject(err_1)];
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function attempt(ctx, plugin) {
|
||||
ctx.log('debug', 'plugin', { plugin: plugin.name });
|
||||
var start = new Date().getTime();
|
||||
var hook = plugin[ctx.event.type];
|
||||
if (hook === undefined) {
|
||||
return Promise.resolve(ctx);
|
||||
}
|
||||
var newCtx = tryAsync(function () { return hook.apply(plugin, [ctx]); })
|
||||
.then(function (ctx) {
|
||||
var done = new Date().getTime() - start;
|
||||
ctx.stats.gauge('plugin_time', done, ["plugin:".concat(plugin.name)]);
|
||||
return ctx;
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (err instanceof context_1.ContextCancelation &&
|
||||
err.type === 'middleware_cancellation') {
|
||||
throw err;
|
||||
}
|
||||
if (err instanceof context_1.ContextCancelation) {
|
||||
ctx.log('warn', err.type, {
|
||||
plugin: plugin.name,
|
||||
error: err,
|
||||
});
|
||||
return err;
|
||||
}
|
||||
ctx.log('error', 'plugin Error', {
|
||||
plugin: plugin.name,
|
||||
error: err,
|
||||
});
|
||||
ctx.stats.increment('plugin_error', 1, ["plugin:".concat(plugin.name)]);
|
||||
return err;
|
||||
});
|
||||
return newCtx;
|
||||
}
|
||||
exports.attempt = attempt;
|
||||
function ensure(ctx, plugin) {
|
||||
return attempt(ctx, plugin).then(function (newContext) {
|
||||
if (newContext instanceof context_1.CoreContext) {
|
||||
return newContext;
|
||||
}
|
||||
ctx.log('debug', 'Context canceled');
|
||||
ctx.stats.increment('context_canceled');
|
||||
ctx.cancel(newContext);
|
||||
});
|
||||
}
|
||||
exports.ensure = ensure;
|
||||
//# sourceMappingURL=delivery.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/queue/delivery.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/queue/delivery.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../../src/queue/delivery.ts"],"names":[],"mappings":";;;;AAAA,sCAA4D;AAG5D,SAAe,QAAQ,CAAI,EAAwB;;;;;;;oBAExC,qBAAM,EAAE,EAAE,EAAA;wBAAjB,sBAAO,SAAU,EAAA;;;oBAEjB,sBAAO,OAAO,CAAC,MAAM,CAAC,KAAG,CAAC,EAAA;;;;;CAE7B;AAED,SAAgB,OAAO,CACrB,GAAQ,EACR,MAAuB;IAEvB,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IACnD,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAElC,IAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACnC,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;KAC5B;IAED,IAAM,MAAM,GAAG,QAAQ,CAAC,cAAM,OAAA,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAzB,CAAyB,CAAC;SACrD,IAAI,CAAC,UAAC,GAAG;QACR,IAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,CAAA;QACzC,GAAG,CAAC,K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ACJ,CAAC;AAbD,wBAaC"}
|
||||
338
node_modules/@segment/analytics-core/dist/cjs/queue/event-queue.js
generated
vendored
Normal file
338
node_modules/@segment/analytics-core/dist/cjs/queue/event-queue.js
generated
vendored
Normal file
@@ -0,0 +1,338 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CoreEventQueue = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var group_by_1 = require("../utils/group-by");
|
||||
var priority_queue_1 = require("../priority-queue");
|
||||
var context_1 = require("../context");
|
||||
var analytics_generic_utils_1 = require("@segment/analytics-generic-utils");
|
||||
var task_group_1 = require("../task/task-group");
|
||||
var delivery_1 = require("./delivery");
|
||||
var CoreEventQueue = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(CoreEventQueue, _super);
|
||||
function CoreEventQueue(priorityQueue) {
|
||||
var _this = _super.call(this) || this;
|
||||
/**
|
||||
* All event deliveries get suspended until all the tasks in this task group are complete.
|
||||
* For example: a middleware that augments the event object should be loaded safely as a
|
||||
* critical task, this way, event queue will wait for it to be ready before sending events.
|
||||
*
|
||||
* This applies to all the events already in the queue, and the upcoming ones
|
||||
*/
|
||||
_this.criticalTasks = (0, task_group_1.createTaskGroup)();
|
||||
_this.plugins = [];
|
||||
_this.failedInitializations = [];
|
||||
_this.flushing = false;
|
||||
_this.queue = priorityQueue;
|
||||
_this.queue.on(priority_queue_1.ON_REMOVE_FROM_FUTURE, function () {
|
||||
_this.scheduleFlush(0);
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
CoreEventQueue.prototype.register = function (ctx, plugin, instance) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, Promise.resolve(plugin.load(ctx, instance))
|
||||
.then(function () {
|
||||
_this.plugins.push(plugin);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (plugin.type === 'destination') {
|
||||
_this.failedInitializations.push(plugin.name);
|
||||
console.warn(plugin.name, err);
|
||||
ctx.log('warn', 'Failed to load destination', {
|
||||
plugin: plugin.name,
|
||||
error: err,
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
})];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.deregister = function (ctx, plugin, instance) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var e_1;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 3, , 4]);
|
||||
if (!plugin.unload) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, Promise.resolve(plugin.unload(ctx, instance))];
|
||||
case 1:
|
||||
_a.sent();
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
this.plugins = this.plugins.filter(function (p) { return p.name !== plugin.name; });
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
e_1 = _a.sent();
|
||||
ctx.log('warn', 'Failed to unload destination', {
|
||||
plugin: plugin.name,
|
||||
error: e_1,
|
||||
});
|
||||
return [3 /*break*/, 4];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.dispatch = function (ctx) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var willDeliver;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
ctx.log('debug', 'Dispatching');
|
||||
ctx.stats.increment('message_dispatched');
|
||||
this.queue.push(ctx);
|
||||
willDeliver = this.subscribeToDelivery(ctx);
|
||||
this.scheduleFlush(0);
|
||||
return [2 /*return*/, willDeliver];
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.subscribeToDelivery = function (ctx) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
return [2 /*return*/, new Promise(function (resolve) {
|
||||
var onDeliver = function (flushed, delivered) {
|
||||
if (flushed.isSame(ctx)) {
|
||||
_this.off('flush', onDeliver);
|
||||
if (delivered) {
|
||||
resolve(flushed);
|
||||
}
|
||||
else {
|
||||
resolve(flushed);
|
||||
}
|
||||
}
|
||||
};
|
||||
_this.on('flush', onDeliver);
|
||||
})];
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.dispatchSingle = function (ctx) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
ctx.log('debug', 'Dispatching');
|
||||
ctx.stats.increment('message_dispatched');
|
||||
this.queue.updateAttempts(ctx);
|
||||
ctx.attempts = 1;
|
||||
return [2 /*return*/, this.deliver(ctx).catch(function (err) {
|
||||
var accepted = _this.enqueuRetry(err, ctx);
|
||||
if (!accepted) {
|
||||
ctx.setFailedDelivery({ reason: err });
|
||||
return ctx;
|
||||
}
|
||||
return _this.subscribeToDelivery(ctx);
|
||||
})];
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.isEmpty = function () {
|
||||
return this.queue.length === 0;
|
||||
};
|
||||
CoreEventQueue.prototype.scheduleFlush = function (timeout) {
|
||||
var _this = this;
|
||||
if (timeout === void 0) { timeout = 500; }
|
||||
if (this.flushing) {
|
||||
return;
|
||||
}
|
||||
this.flushing = true;
|
||||
setTimeout(function () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
_this.flush().then(function () {
|
||||
setTimeout(function () {
|
||||
_this.flushing = false;
|
||||
if (_this.queue.length) {
|
||||
_this.scheduleFlush(0);
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
}, timeout);
|
||||
};
|
||||
CoreEventQueue.prototype.deliver = function (ctx) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var start, done, err_1, error;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.criticalTasks.done()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
start = Date.now();
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
_a.trys.push([2, 4, , 5]);
|
||||
return [4 /*yield*/, this.flushOne(ctx)];
|
||||
case 3:
|
||||
ctx = _a.sent();
|
||||
done = Date.now() - start;
|
||||
this.emit('delivery_success', ctx);
|
||||
ctx.stats.gauge('delivered', done);
|
||||
ctx.log('debug', 'Delivered', ctx.event);
|
||||
return [2 /*return*/, ctx];
|
||||
case 4:
|
||||
err_1 = _a.sent();
|
||||
error = err_1;
|
||||
ctx.log('error', 'Failed to deliver', error);
|
||||
this.emit('delivery_failure', ctx, error);
|
||||
ctx.stats.increment('delivery_failed');
|
||||
throw err_1;
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.enqueuRetry = function (err, ctx) {
|
||||
var retriable = !(err instanceof context_1.ContextCancelation) || err.retry;
|
||||
if (!retriable) {
|
||||
return false;
|
||||
}
|
||||
return this.queue.pushWithBackoff(ctx);
|
||||
};
|
||||
CoreEventQueue.prototype.flush = function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var ctx, err_2, accepted;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (this.queue.length === 0) {
|
||||
return [2 /*return*/, []];
|
||||
}
|
||||
ctx = this.queue.pop();
|
||||
if (!ctx) {
|
||||
return [2 /*return*/, []];
|
||||
}
|
||||
ctx.attempts = this.queue.getAttempts(ctx);
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, this.deliver(ctx)];
|
||||
case 2:
|
||||
ctx = _a.sent();
|
||||
this.emit('flush', ctx, true);
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
err_2 = _a.sent();
|
||||
accepted = this.enqueuRetry(err_2, ctx);
|
||||
if (!accepted) {
|
||||
ctx.setFailedDelivery({ reason: err_2 });
|
||||
this.emit('flush', ctx, false);
|
||||
}
|
||||
return [2 /*return*/, []];
|
||||
case 4: return [2 /*return*/, [ctx]];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.isReady = function () {
|
||||
// return this.plugins.every((p) => p.isLoaded())
|
||||
// should we wait for every plugin to load?
|
||||
return true;
|
||||
};
|
||||
CoreEventQueue.prototype.availableExtensions = function (denyList) {
|
||||
var available = this.plugins.filter(function (p) {
|
||||
var _a, _b, _c;
|
||||
// Only filter out destination plugins or the Segment.io plugin
|
||||
if (p.type !== 'destination' && p.name !== 'Segment.io') {
|
||||
return true;
|
||||
}
|
||||
var alternativeNameMatch = undefined;
|
||||
(_a = p.alternativeNames) === null || _a === void 0 ? void 0 : _a.forEach(function (name) {
|
||||
if (denyList[name] !== undefined) {
|
||||
alternativeNameMatch = denyList[name];
|
||||
}
|
||||
});
|
||||
// Explicit integration option takes precedence, `All: false` does not apply to Segment.io
|
||||
return ((_c = (_b = denyList[p.name]) !== null && _b !== void 0 ? _b : alternativeNameMatch) !== null && _c !== void 0 ? _c : (p.name === 'Segment.io' ? true : denyList.All) !== false);
|
||||
});
|
||||
var _a = (0, group_by_1.groupBy)(available, 'type'), _b = _a.before, before = _b === void 0 ? [] : _b, _c = _a.enrichment, enrichment = _c === void 0 ? [] : _c, _d = _a.destination, destination = _d === void 0 ? [] : _d, _e = _a.after, after = _e === void 0 ? [] : _e;
|
||||
return {
|
||||
before: before,
|
||||
enrichment: enrichment,
|
||||
destinations: destination,
|
||||
after: after,
|
||||
};
|
||||
};
|
||||
CoreEventQueue.prototype.flushOne = function (ctx) {
|
||||
var _a, _b;
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _c, before, enrichment, _i, before_1, beforeWare, temp, _d, enrichment_1, enrichmentWare, temp, _e, destinations, after, afterCalls;
|
||||
return tslib_1.__generator(this, function (_f) {
|
||||
switch (_f.label) {
|
||||
case 0:
|
||||
if (!this.isReady()) {
|
||||
throw new Error('Not ready');
|
||||
}
|
||||
if (ctx.attempts > 1) {
|
||||
this.emit('delivery_retry', ctx);
|
||||
}
|
||||
_c = this.availableExtensions((_a = ctx.event.integrations) !== null && _a !== void 0 ? _a : {}), before = _c.before, enrichment = _c.enrichment;
|
||||
_i = 0, before_1 = before;
|
||||
_f.label = 1;
|
||||
case 1:
|
||||
if (!(_i < before_1.length)) return [3 /*break*/, 4];
|
||||
beforeWare = before_1[_i];
|
||||
return [4 /*yield*/, (0, delivery_1.ensure)(ctx, beforeWare)];
|
||||
case 2:
|
||||
temp = _f.sent();
|
||||
if (temp instanceof context_1.CoreContext) {
|
||||
ctx = temp;
|
||||
}
|
||||
this.emit('message_enriched', ctx, beforeWare);
|
||||
_f.label = 3;
|
||||
case 3:
|
||||
_i++;
|
||||
return [3 /*break*/, 1];
|
||||
case 4:
|
||||
_d = 0, enrichment_1 = enrichment;
|
||||
_f.label = 5;
|
||||
case 5:
|
||||
if (!(_d < enrichment_1.length)) return [3 /*break*/, 8];
|
||||
enrichmentWare = enrichment_1[_d];
|
||||
return [4 /*yield*/, (0, delivery_1.attempt)(ctx, enrichmentWare)];
|
||||
case 6:
|
||||
temp = _f.sent();
|
||||
if (temp instanceof context_1.CoreContext) {
|
||||
ctx = temp;
|
||||
}
|
||||
this.emit('message_enriched', ctx, enrichmentWare);
|
||||
_f.label = 7;
|
||||
case 7:
|
||||
_d++;
|
||||
return [3 /*break*/, 5];
|
||||
case 8:
|
||||
_e = this.availableExtensions((_b = ctx.event.integrations) !== null && _b !== void 0 ? _b : {}), destinations = _e.destinations, after = _e.after;
|
||||
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
var attempts = destinations.map(function (destination) {
|
||||
return (0, delivery_1.attempt)(ctx, destination);
|
||||
});
|
||||
Promise.all(attempts).then(resolve).catch(reject);
|
||||
}, 0);
|
||||
})];
|
||||
case 9:
|
||||
_f.sent();
|
||||
ctx.stats.increment('message_delivered');
|
||||
this.emit('message_delivered', ctx);
|
||||
afterCalls = after.map(function (after) { return (0, delivery_1.attempt)(ctx, after); });
|
||||
return [4 /*yield*/, Promise.all(afterCalls)];
|
||||
case 10:
|
||||
_f.sent();
|
||||
return [2 /*return*/, ctx];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return CoreEventQueue;
|
||||
}(analytics_generic_utils_1.Emitter));
|
||||
exports.CoreEventQueue = CoreEventQueue;
|
||||
//# sourceMappingURL=event-queue.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/queue/event-queue.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/queue/event-queue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
96
node_modules/@segment/analytics-core/dist/cjs/stats/index.js
generated
vendored
Normal file
96
node_modules/@segment/analytics-core/dist/cjs/stats/index.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NullStats = exports.CoreStats = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var compactMetricType = function (type) {
|
||||
var enums = {
|
||||
gauge: 'g',
|
||||
counter: 'c',
|
||||
};
|
||||
return enums[type];
|
||||
};
|
||||
var CoreStats = /** @class */ (function () {
|
||||
function CoreStats() {
|
||||
this.metrics = [];
|
||||
}
|
||||
CoreStats.prototype.increment = function (metric, by, tags) {
|
||||
if (by === void 0) { by = 1; }
|
||||
this.metrics.push({
|
||||
metric: metric,
|
||||
value: by,
|
||||
tags: tags !== null && tags !== void 0 ? tags : [],
|
||||
type: 'counter',
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
};
|
||||
CoreStats.prototype.gauge = function (metric, value, tags) {
|
||||
this.metrics.push({
|
||||
metric: metric,
|
||||
value: value,
|
||||
tags: tags !== null && tags !== void 0 ? tags : [],
|
||||
type: 'gauge',
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
};
|
||||
CoreStats.prototype.flush = function () {
|
||||
var formatted = this.metrics.map(function (m) { return (tslib_1.__assign(tslib_1.__assign({}, m), { tags: m.tags.join(',') })); });
|
||||
// ie doesn't like console.table
|
||||
if (console.table) {
|
||||
console.table(formatted);
|
||||
}
|
||||
else {
|
||||
console.log(formatted);
|
||||
}
|
||||
this.metrics = [];
|
||||
};
|
||||
/**
|
||||
* compact keys for smaller payload
|
||||
*/
|
||||
CoreStats.prototype.serialize = function () {
|
||||
return this.metrics.map(function (m) {
|
||||
return {
|
||||
m: m.metric,
|
||||
v: m.value,
|
||||
t: m.tags,
|
||||
k: compactMetricType(m.type),
|
||||
e: m.timestamp,
|
||||
};
|
||||
});
|
||||
};
|
||||
return CoreStats;
|
||||
}());
|
||||
exports.CoreStats = CoreStats;
|
||||
var NullStats = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(NullStats, _super);
|
||||
function NullStats() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NullStats.prototype.gauge = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
};
|
||||
NullStats.prototype.increment = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
};
|
||||
NullStats.prototype.flush = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
};
|
||||
NullStats.prototype.serialize = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
return [];
|
||||
};
|
||||
return NullStats;
|
||||
}(CoreStats));
|
||||
exports.NullStats = NullStats;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/stats/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/stats/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stats/index.ts"],"names":[],"mappings":";;;;AAoBA,IAAM,iBAAiB,GAAG,UAAC,IAAoB;IAC7C,IAAM,KAAK,GAA8C;QACvD,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,GAAG;KACb,CAAA;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAA;AACpB,CAAC,CAAA;AAED;IAAA;QACE,YAAO,GAAiB,EAAE,CAAA;IAiD5B,CAAC;IAhDC,6BAAS,GAAT,UAAU,MAAc,EAAE,EAAM,EAAE,IAAe;QAAvB,mBAAA,EAAA,MAAM;QAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,MAAM,QAAA;YACN,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE;YAChB,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,yBAAK,GAAL,UAAM,MAAc,EAAE,KAAa,EAAE,IAAe;QAClD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,MAAM,QAAA;YACN,KAAK,OAAA;YACL,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE;YAChB,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,yBAAK,GAAL;QACE,IAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,uCACrC,CAAC,KACJ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IA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"}
|
||||
24
node_modules/@segment/analytics-core/dist/cjs/task/task-group.js
generated
vendored
Normal file
24
node_modules/@segment/analytics-core/dist/cjs/task/task-group.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createTaskGroup = void 0;
|
||||
var is_thenable_1 = require("../utils/is-thenable");
|
||||
var createTaskGroup = function () {
|
||||
var taskCompletionPromise;
|
||||
var resolvePromise;
|
||||
var count = 0;
|
||||
return {
|
||||
done: function () { return taskCompletionPromise; },
|
||||
run: function (op) {
|
||||
var returnValue = op();
|
||||
if ((0, is_thenable_1.isThenable)(returnValue)) {
|
||||
if (++count === 1) {
|
||||
taskCompletionPromise = new Promise(function (res) { return (resolvePromise = res); });
|
||||
}
|
||||
returnValue.finally(function () { return --count === 0 && resolvePromise(); });
|
||||
}
|
||||
return returnValue;
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.createTaskGroup = createTaskGroup;
|
||||
//# sourceMappingURL=task-group.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/task/task-group.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/task/task-group.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"task-group.js","sourceRoot":"","sources":["../../../src/task/task-group.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAS1C,IAAM,eAAe,GAAG;IAC7B,IAAI,qBAAoC,CAAA;IACxC,IAAI,cAA0B,CAAA;IAC9B,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,OAAO;QACL,IAAI,EAAE,cAAM,OAAA,qBAAqB,EAArB,CAAqB;QACjC,GAAG,EAAE,UAAC,EAAE;YACN,IAAM,WAAW,GAAG,EAAE,EAAE,CAAA;YAExB,IAAI,IAAA,wBAAU,EAAC,WAAW,CAAC,EAAE;gBAC3B,IAAI,EAAE,KAAK,KAAK,CAAC,EAAE;oBACjB,qBAAqB,GAAG,IAAI,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,CAAC,cAAc,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAA;iBACrE;gBAED,WAAW,CAAC,OAAO,CAAC,cAAM,OAAA,EAAE,KAAK,KAAK,CAAC,IAAI,cAAc,EAAE,EAAjC,CAAiC,CAAC,CAAA;aAC7D;YAED,OAAO,WAAW,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AArBY,QAAA,eAAe,mBAqB3B"}
|
||||
3
node_modules/@segment/analytics-core/dist/cjs/user/index.js
generated
vendored
Normal file
3
node_modules/@segment/analytics-core/dist/cjs/user/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/user/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/user/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/user/index.ts"],"names":[],"mappings":""}
|
||||
18
node_modules/@segment/analytics-core/dist/cjs/utils/bind-all.js
generated
vendored
Normal file
18
node_modules/@segment/analytics-core/dist/cjs/utils/bind-all.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.bindAll = void 0;
|
||||
function bindAll(obj) {
|
||||
var proto = obj.constructor.prototype;
|
||||
for (var _i = 0, _a = Object.getOwnPropertyNames(proto); _i < _a.length; _i++) {
|
||||
var key = _a[_i];
|
||||
if (key !== 'constructor') {
|
||||
var desc = Object.getOwnPropertyDescriptor(obj.constructor.prototype, key);
|
||||
if (!!desc && typeof desc.value === 'function') {
|
||||
obj[key] = obj[key].bind(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
exports.bindAll = bindAll;
|
||||
//# sourceMappingURL=bind-all.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/bind-all.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/bind-all.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bind-all.js","sourceRoot":"","sources":["../../../src/utils/bind-all.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAGrB,GAAY;IACZ,IAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAA;IACvC,KAAkB,UAAiC,EAAjC,KAAA,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAjC,cAAiC,EAAjC,IAAiC,EAAE;QAAhD,IAAM,GAAG,SAAA;QACZ,IAAI,GAAG,KAAK,aAAa,EAAE;YACzB,IAAM,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAC1C,GAAG,CAAC,WAAW,CAAC,SAAS,EACzB,GAAG,CACJ,CAAA;YACD,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,UAAU,EAAE;gBAC9C,GAAG,CAAC,GAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;aACzC;SACF;KACF;IAED,OAAO,GAAG,CAAA;AACZ,CAAC;AAlBD,0BAkBC"}
|
||||
22
node_modules/@segment/analytics-core/dist/cjs/utils/get-global.js
generated
vendored
Normal file
22
node_modules/@segment/analytics-core/dist/cjs/utils/get-global.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getGlobal = void 0;
|
||||
/* eslint-disable no-restricted-globals */
|
||||
// This an imperfect polyfill for globalThis
|
||||
var getGlobal = function () {
|
||||
if (typeof globalThis !== 'undefined') {
|
||||
return globalThis;
|
||||
}
|
||||
if (typeof self !== 'undefined') {
|
||||
return self;
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
return window;
|
||||
}
|
||||
if (typeof global !== 'undefined') {
|
||||
return global;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
exports.getGlobal = getGlobal;
|
||||
//# sourceMappingURL=get-global.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/get-global.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/get-global.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-global.js","sourceRoot":"","sources":["../../../src/utils/get-global.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC1C,4CAA4C;AACrC,IAAM,SAAS,GAAG;IACvB,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;QACrC,OAAO,UAAU,CAAA;KAClB;IACD,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAA;KACZ;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAA;KACd;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAA;KACd;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAdY,QAAA,SAAS,aAcrB"}
|
||||
28
node_modules/@segment/analytics-core/dist/cjs/utils/group-by.js
generated
vendored
Normal file
28
node_modules/@segment/analytics-core/dist/cjs/utils/group-by.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.groupBy = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
function groupBy(collection, grouper) {
|
||||
var results = {};
|
||||
collection.forEach(function (item) {
|
||||
var _a;
|
||||
var key = undefined;
|
||||
if (typeof grouper === 'string') {
|
||||
var suggestedKey = item[grouper];
|
||||
key =
|
||||
typeof suggestedKey !== 'string'
|
||||
? JSON.stringify(suggestedKey)
|
||||
: suggestedKey;
|
||||
}
|
||||
else if (grouper instanceof Function) {
|
||||
key = grouper(item);
|
||||
}
|
||||
if (key === undefined) {
|
||||
return;
|
||||
}
|
||||
results[key] = tslib_1.__spreadArray(tslib_1.__spreadArray([], ((_a = results[key]) !== null && _a !== void 0 ? _a : []), true), [item], false);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
exports.groupBy = groupBy;
|
||||
//# sourceMappingURL=group-by.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/group-by.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/group-by.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"group-by.js","sourceRoot":"","sources":["../../../src/utils/group-by.ts"],"names":[],"mappings":";;;;AAEA,SAAgB,OAAO,CACrB,UAAe,EACf,OAA6B;IAE7B,IAAM,OAAO,GAAwB,EAAE,CAAA;IAEvC,UAAU,CAAC,OAAO,CAAC,UAAC,IAAI;;QACtB,IAAI,GAAG,GAAgC,SAAS,CAAA;QAEhD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,CAAA;YAClC,GAAG;gBACD,OAAO,YAAY,KAAK,QAAQ;oBAC9B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;oBAC9B,CAAC,CAAC,YAAY,CAAA;SACnB;aAAM,IAAI,OAAO,YAAY,QAAQ,EAAE;YACtC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;SACpB;QAED,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAM;SACP;QAED,OAAO,CAAC,GAAG,CAAC,mDAAO,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC,UAAE,IAAI,SAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC;AA3BD,0BA2BC"}
|
||||
13
node_modules/@segment/analytics-core/dist/cjs/utils/has-properties.js
generated
vendored
Normal file
13
node_modules/@segment/analytics-core/dist/cjs/utils/has-properties.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hasProperties = void 0;
|
||||
function hasProperties(obj) {
|
||||
var keys = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
keys[_i - 1] = arguments[_i];
|
||||
}
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
return !!obj && keys.every(function (key) { return obj.hasOwnProperty(key); });
|
||||
}
|
||||
exports.hasProperties = hasProperties;
|
||||
//# sourceMappingURL=has-properties.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/has-properties.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/has-properties.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"has-properties.js","sourceRoot":"","sources":["../../../src/utils/has-properties.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAC3B,GAAM;IACN,cAAY;SAAZ,UAAY,EAAZ,qBAAY,EAAZ,IAAY;QAAZ,6BAAY;;IAEZ,iDAAiD;IACjD,OAAO,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,EAAvB,CAAuB,CAAC,CAAA;AAC9D,CAAC;AAND,sCAMC"}
|
||||
28
node_modules/@segment/analytics-core/dist/cjs/utils/is-plain-object.js
generated
vendored
Normal file
28
node_modules/@segment/analytics-core/dist/cjs/utils/is-plain-object.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
// Code derived from https://github.com/jonschlinkert/is-plain-object/blob/master/is-plain-object.js
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isPlainObject = void 0;
|
||||
function isObject(o) {
|
||||
return Object.prototype.toString.call(o) === '[object Object]';
|
||||
}
|
||||
function isPlainObject(o) {
|
||||
if (isObject(o) === false)
|
||||
return false;
|
||||
// If has modified constructor
|
||||
var ctor = o.constructor;
|
||||
if (ctor === undefined)
|
||||
return true;
|
||||
// If has modified prototype
|
||||
var prot = ctor.prototype;
|
||||
if (isObject(prot) === false)
|
||||
return false;
|
||||
// If constructor does not have an Object-specific method
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (prot.hasOwnProperty('isPrototypeOf') === false) {
|
||||
return false;
|
||||
}
|
||||
// Most likely a plain Object
|
||||
return true;
|
||||
}
|
||||
exports.isPlainObject = isPlainObject;
|
||||
//# sourceMappingURL=is-plain-object.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/is-plain-object.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/is-plain-object.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"is-plain-object.js","sourceRoot":"","sources":["../../../src/utils/is-plain-object.ts"],"names":[],"mappings":";AAAA,oGAAoG;;;AAEpG,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAA;AAChE,CAAC;AAED,SAAgB,aAAa,CAAC,CAAU;IACtC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAA;IAEvC,8BAA8B;IAC9B,IAAM,IAAI,GAAI,CAAS,CAAC,WAAW,CAAA;IACnC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IAEnC,4BAA4B;IAC5B,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAA;IAC3B,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAA;IAE1C,yDAAyD;IACzD,iDAAiD;IACjD,IAAK,IAAe,CAAC,cAAc,CAAC,eAAe,CAAC,KAAK,KAAK,EAAE;QAC9D,OAAO,KAAK,CAAA;KACb;IAED,6BAA6B;IAC7B,OAAO,IAAI,CAAA;AACb,CAAC;AAnBD,sCAmBC"}
|
||||
15
node_modules/@segment/analytics-core/dist/cjs/utils/is-thenable.js
generated
vendored
Normal file
15
node_modules/@segment/analytics-core/dist/cjs/utils/is-thenable.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isThenable = void 0;
|
||||
/**
|
||||
* Check if thenable
|
||||
* (instanceof Promise doesn't respect realms)
|
||||
*/
|
||||
var isThenable = function (value) {
|
||||
return typeof value === 'object' &&
|
||||
value !== null &&
|
||||
'then' in value &&
|
||||
typeof value.then === 'function';
|
||||
};
|
||||
exports.isThenable = isThenable;
|
||||
//# sourceMappingURL=is-thenable.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/is-thenable.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/is-thenable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"is-thenable.js","sourceRoot":"","sources":["../../../src/utils/is-thenable.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,IAAM,UAAU,GAAG,UAAC,KAAc;IACvC,OAAA,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU;AAHzC,CAGyC,CAAA;AAJ9B,QAAA,UAAU,cAIoB"}
|
||||
25
node_modules/@segment/analytics-core/dist/cjs/utils/p-while.js
generated
vendored
Normal file
25
node_modules/@segment/analytics-core/dist/cjs/utils/p-while.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pWhile = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var pWhile = function (condition, action) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
||||
var loop;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
loop = function (actionResult) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
||||
var _a;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
if (!condition(actionResult)) return [3 /*break*/, 2];
|
||||
_a = loop;
|
||||
return [4 /*yield*/, action()];
|
||||
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
||||
case 2: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
return [2 /*return*/, loop(undefined)];
|
||||
});
|
||||
}); };
|
||||
exports.pWhile = pWhile;
|
||||
//# sourceMappingURL=p-while.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/p-while.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/p-while.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"p-while.js","sourceRoot":"","sources":["../../../src/utils/p-while.ts"],"names":[],"mappings":";;;;AAAO,IAAM,MAAM,GAAG,UACpB,SAA4C,EAC5C,MAAgC;;;QAE1B,IAAI,GAAG,UAAO,YAA2B;;;;;6BACzC,SAAS,CAAC,YAAY,CAAC,EAAvB,wBAAuB;wBAClB,KAAA,IAAI,CAAA;wBAAC,qBAAM,MAAM,EAAE,EAAA;4BAA1B,sBAAO,kBAAK,SAAc,EAAC,EAAA;;;;aAE9B,CAAA;QAED,sBAAO,IAAI,CAAC,SAAS,CAAC,EAAA;;KACvB,CAAA;AAXY,QAAA,MAAM,UAWlB"}
|
||||
10
node_modules/@segment/analytics-core/dist/cjs/utils/pick.js
generated
vendored
Normal file
10
node_modules/@segment/analytics-core/dist/cjs/utils/pick.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pickBy = void 0;
|
||||
var pickBy = function (obj, fn) {
|
||||
return Object.keys(obj)
|
||||
.filter(function (k) { return fn(k, obj[k]); })
|
||||
.reduce(function (acc, key) { return ((acc[key] = obj[key]), acc); }, {});
|
||||
};
|
||||
exports.pickBy = pickBy;
|
||||
//# sourceMappingURL=pick.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/pick.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/pick.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../../src/utils/pick.ts"],"names":[],"mappings":";;;AAAO,IAAM,MAAM,GAAG,UACpB,GAAM,EACN,EAAgC;IAEhC,OAAQ,MAAM,CAAC,IAAI,CAAC,GAAG,CAAS;SAC7B,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAb,CAAa,CAAC;SAC5B,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG,IAAK,OAAA,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAA5B,CAA4B,EAAE,EAAgB,CAAC,CAAA;AACzE,CAAC,CAAA;AAPY,QAAA,MAAM,UAOlB"}
|
||||
3
node_modules/@segment/analytics-core/dist/cjs/utils/ts-helpers.js
generated
vendored
Normal file
3
node_modules/@segment/analytics-core/dist/cjs/utils/ts-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ts-helpers.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/utils/ts-helpers.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/utils/ts-helpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ts-helpers.js","sourceRoot":"","sources":["../../../src/utils/ts-helpers.ts"],"names":[],"mappings":""}
|
||||
67
node_modules/@segment/analytics-core/dist/cjs/validation/assertions.js
generated
vendored
Normal file
67
node_modules/@segment/analytics-core/dist/cjs/validation/assertions.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateEvent = exports.assertTraits = exports.assertTrackEventProperties = exports.assertTrackEventName = exports.assertEventType = exports.assertEventExists = exports.assertUserIdentity = void 0;
|
||||
var errors_1 = require("./errors");
|
||||
var helpers_1 = require("./helpers");
|
||||
var stringError = 'is not a string';
|
||||
var objError = 'is not an object';
|
||||
var nilError = 'is nil';
|
||||
function assertUserIdentity(event) {
|
||||
var USER_FIELD_NAME = '.userId/anonymousId/previousId/groupId';
|
||||
var getAnyUserId = function (event) { var _a, _b, _c; return (_c = (_b = (_a = event.userId) !== null && _a !== void 0 ? _a : event.anonymousId) !== null && _b !== void 0 ? _b : event.groupId) !== null && _c !== void 0 ? _c : event.previousId; };
|
||||
var id = getAnyUserId(event);
|
||||
if (!(0, helpers_1.exists)(id)) {
|
||||
throw new errors_1.ValidationError(USER_FIELD_NAME, nilError);
|
||||
}
|
||||
else if (!(0, helpers_1.isString)(id)) {
|
||||
throw new errors_1.ValidationError(USER_FIELD_NAME, stringError);
|
||||
}
|
||||
}
|
||||
exports.assertUserIdentity = assertUserIdentity;
|
||||
function assertEventExists(event) {
|
||||
if (!(0, helpers_1.exists)(event)) {
|
||||
throw new errors_1.ValidationError('Event', nilError);
|
||||
}
|
||||
if (typeof event !== 'object') {
|
||||
throw new errors_1.ValidationError('Event', objError);
|
||||
}
|
||||
}
|
||||
exports.assertEventExists = assertEventExists;
|
||||
function assertEventType(event) {
|
||||
if (!(0, helpers_1.isString)(event.type)) {
|
||||
throw new errors_1.ValidationError('.type', stringError);
|
||||
}
|
||||
}
|
||||
exports.assertEventType = assertEventType;
|
||||
function assertTrackEventName(event) {
|
||||
if (!(0, helpers_1.isString)(event.event)) {
|
||||
throw new errors_1.ValidationError('.event', stringError);
|
||||
}
|
||||
}
|
||||
exports.assertTrackEventName = assertTrackEventName;
|
||||
function assertTrackEventProperties(event) {
|
||||
if (!(0, helpers_1.isPlainObject)(event.properties)) {
|
||||
throw new errors_1.ValidationError('.properties', objError);
|
||||
}
|
||||
}
|
||||
exports.assertTrackEventProperties = assertTrackEventProperties;
|
||||
function assertTraits(event) {
|
||||
if (!(0, helpers_1.isPlainObject)(event.traits)) {
|
||||
throw new errors_1.ValidationError('.traits', objError);
|
||||
}
|
||||
}
|
||||
exports.assertTraits = assertTraits;
|
||||
function validateEvent(event) {
|
||||
assertEventExists(event);
|
||||
assertEventType(event);
|
||||
if (event.type === 'track') {
|
||||
assertTrackEventName(event);
|
||||
assertTrackEventProperties(event);
|
||||
}
|
||||
if (['group', 'identify'].includes(event.type)) {
|
||||
assertTraits(event);
|
||||
}
|
||||
assertUserIdentity(event);
|
||||
}
|
||||
exports.validateEvent = validateEvent;
|
||||
//# sourceMappingURL=assertions.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/validation/assertions.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/validation/assertions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../../src/validation/assertions.ts"],"names":[],"mappings":";;;AACA,mCAA0C;AAC1C,qCAA2D;AAE3D,IAAM,WAAW,GAAG,iBAAiB,CAAA;AACrC,IAAM,QAAQ,GAAG,kBAAkB,CAAA;AACnC,IAAM,QAAQ,GAAG,QAAQ,CAAA;AAEzB,SAAgB,kBAAkB,CAAC,KAAuB;IACxD,IAAM,eAAe,GAAG,wCAAwC,CAAA;IAEhE,IAAM,YAAY,GAAG,UAAC,KAAuB,oBAC3C,OAAA,MAAA,MAAA,MAAA,KAAK,CAAC,MAAM,mCAAI,KAA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EAAE,QAAQ,CAAC,CAAA;KACnD;AACH,CAAC;AAJD,gEAIC;AAED,SAAgB,YAAY,CAAC,KAAuB;IAClD,IAAI,CAAC,IAAA,uBAAa,EAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QAChC,MAAM,IAAI,wBAAe,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;KAC/C;AACH,CAAC;AAJD,oCAIC;AAED,SAAgB,aAAa,CAAC,KAA+B;IAC3D,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACxB,eAAe,CAAC,KAAK,CAAC,CAAA;IAEtB,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;QAC1B,oBAAoB,CAAC,KAAK,CAAC,CAAA;QAC3B,0BAA0B,CAAC,KAAK,CAAC,CAAA;KAClC;IAED,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QAC9C,YAAY,CAAC,KAAK,CAAC,CAAA;KACpB;IAED,kBAAkB,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC;AAdD,sCAcC"}
|
||||
15
node_modules/@segment/analytics-core/dist/cjs/validation/errors.js
generated
vendored
Normal file
15
node_modules/@segment/analytics-core/dist/cjs/validation/errors.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValidationError = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var ValidationError = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(ValidationError, _super);
|
||||
function ValidationError(field, message) {
|
||||
var _this = _super.call(this, "".concat(field, " ").concat(message)) || this;
|
||||
_this.field = field;
|
||||
return _this;
|
||||
}
|
||||
return ValidationError;
|
||||
}(Error));
|
||||
exports.ValidationError = ValidationError;
|
||||
//# sourceMappingURL=errors.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/validation/errors.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/validation/errors.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/validation/errors.ts"],"names":[],"mappings":";;;;AAAA;IAAqC,2CAAK;IAGxC,yBAAY,KAAa,EAAE,OAAe;QAA1C,YACE,kBAAM,UAAG,KAAK,cAAI,OAAO,CAAE,CAAC,SAE7B;QADC,KAAI,CAAC,KAAK,GAAG,KAAK,CAAA;;IACpB,CAAC;IACH,sBAAC;AAAD,CAAC,AAPD,CAAqC,KAAK,GAOzC;AAPY,0CAAe"}
|
||||
24
node_modules/@segment/analytics-core/dist/cjs/validation/helpers.js
generated
vendored
Normal file
24
node_modules/@segment/analytics-core/dist/cjs/validation/helpers.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isPlainObject = exports.exists = exports.isFunction = exports.isNumber = exports.isString = void 0;
|
||||
function isString(obj) {
|
||||
return typeof obj === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
function isNumber(obj) {
|
||||
return typeof obj === 'number';
|
||||
}
|
||||
exports.isNumber = isNumber;
|
||||
function isFunction(obj) {
|
||||
return typeof obj === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
function exists(val) {
|
||||
return val !== undefined && val !== null;
|
||||
}
|
||||
exports.exists = exists;
|
||||
function isPlainObject(obj) {
|
||||
return (Object.prototype.toString.call(obj).slice(8, -1).toLowerCase() === 'object');
|
||||
}
|
||||
exports.isPlainObject = isPlainObject;
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/cjs/validation/helpers.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/cjs/validation/helpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/validation/helpers.ts"],"names":[],"mappings":";;;AAAA,SAAgB,QAAQ,CAAC,GAAY;IACnC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAA;AAChC,CAAC;AAFD,4BAEC;AAED,SAAgB,QAAQ,CAAC,GAAY;IACnC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAA;AAChC,CAAC;AAFD,4BAEC;AAED,SAAgB,UAAU,CAAC,GAAY;IACrC,OAAO,OAAO,GAAG,KAAK,UAAU,CAAA;AAClC,CAAC;AAFD,gCAEC;AAED,SAAgB,MAAM,CAAI,GAAY;IACpC,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAA;AAC1C,CAAC;AAFD,wBAEC;AAED,SAAgB,aAAa,CAC3B,GAAY;IAEZ,OAAO,CACL,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,QAAQ,CAC5E,CAAA;AACH,CAAC;AAND,sCAMC"}
|
||||
49
node_modules/@segment/analytics-core/dist/esm/analytics/dispatch.js
generated
vendored
Normal file
49
node_modules/@segment/analytics-core/dist/esm/analytics/dispatch.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { __awaiter, __generator } from "tslib";
|
||||
import { invokeCallback } from '../callback';
|
||||
/* The amount of time in ms to wait before invoking the callback. */
|
||||
export var getDelay = function (startTimeInEpochMS, timeoutInMS) {
|
||||
var elapsedTime = Date.now() - startTimeInEpochMS;
|
||||
// increasing the timeout increases the delay by almost the same amount -- this is weird legacy behavior.
|
||||
return Math.max((timeoutInMS !== null && timeoutInMS !== void 0 ? timeoutInMS : 300) - elapsedTime, 0);
|
||||
};
|
||||
/**
|
||||
* Push an event into the dispatch queue and invoke any callbacks.
|
||||
*
|
||||
* @param event - Segment event to enqueue.
|
||||
* @param queue - Queue to dispatch against.
|
||||
* @param emitter - This is typically an instance of "Analytics" -- used for metrics / progress information.
|
||||
* @param options
|
||||
*/
|
||||
export function dispatch(ctx, queue, emitter, options) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var startTime, dispatched;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
emitter.emit('dispatch_start', ctx);
|
||||
startTime = Date.now();
|
||||
if (!queue.isEmpty()) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, queue.dispatchSingle(ctx)];
|
||||
case 1:
|
||||
dispatched = _a.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 2: return [4 /*yield*/, queue.dispatch(ctx)];
|
||||
case 3:
|
||||
dispatched = _a.sent();
|
||||
_a.label = 4;
|
||||
case 4:
|
||||
if (!(options === null || options === void 0 ? void 0 : options.callback)) return [3 /*break*/, 6];
|
||||
return [4 /*yield*/, invokeCallback(dispatched, options.callback, getDelay(startTime, options.timeout))];
|
||||
case 5:
|
||||
dispatched = _a.sent();
|
||||
_a.label = 6;
|
||||
case 6:
|
||||
if (options === null || options === void 0 ? void 0 : options.debug) {
|
||||
dispatched.flush();
|
||||
}
|
||||
return [2 /*return*/, dispatched];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=dispatch.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/analytics/dispatch.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/analytics/dispatch.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../src/analytics/dispatch.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAS5C,oEAAoE;AACpE,MAAM,CAAC,IAAM,QAAQ,GAAG,UAAC,kBAA0B,EAAE,WAAoB;IACvE,IAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAA;IACnD,yGAAyG;IACzG,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC,CAAC,CAAA;AACxD,CAAC,CAAA;AACD;;;;;;;GAOG;AACH,MAAM,UAAgB,QAAQ,CAI5B,GAAQ,EACR,KAAS,EACT,OAAgB,EAChB,OAA8B;;;;;;oBAE9B,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;oBAE7B,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;yBAExB,KAAK,CAAC,OAAO,EAAE,EAAf,wBAAe;oBACJ,qBAAM,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,EAAA;;oBAA5C,UAAU,GAAG,SAA+B,CAAA;;wBAE/B,qBAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAA;;oBAAtC,UAAU,GAAG,SAAyB,CAAA;;;yBAGpC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAA,EAAjB,wBAAiB;oBACN,qBAAM,cAAc,CAC/B,UAAU,EACV,OAAO,CAAC,QAAQ,EAChB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CACrC,EAAA;;oBAJD,UAAU,GAAG,SAIZ,CAAA;;;oBAEH,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,EAAE;wBAClB,UAAU,CAAC,KAAK,EAAE,CAAA;qBACnB;oBAED,sBAAO,UAAU,EAAA;;;;CAClB"}
|
||||
2
node_modules/@segment/analytics-core/dist/esm/analytics/index.js
generated
vendored
Normal file
2
node_modules/@segment/analytics-core/dist/esm/analytics/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/analytics/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/analytics/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/analytics/index.ts"],"names":[],"mappings":""}
|
||||
40
node_modules/@segment/analytics-core/dist/esm/callback/index.js
generated
vendored
Normal file
40
node_modules/@segment/analytics-core/dist/esm/callback/index.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
export function pTimeout(promise, timeout) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var timeoutId = setTimeout(function () {
|
||||
reject(Error('Promise timed out'));
|
||||
}, timeout);
|
||||
promise
|
||||
.then(function (val) {
|
||||
clearTimeout(timeoutId);
|
||||
return resolve(val);
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
export function sleep(timeoutInMs) {
|
||||
return new Promise(function (resolve) { return setTimeout(resolve, timeoutInMs); });
|
||||
}
|
||||
/**
|
||||
* @param ctx
|
||||
* @param callback - the function to invoke
|
||||
* @param delay - aka "timeout". The amount of time in ms to wait before invoking the callback.
|
||||
*/
|
||||
export function invokeCallback(ctx, callback, delay) {
|
||||
var cb = function () {
|
||||
try {
|
||||
return Promise.resolve(callback(ctx));
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
};
|
||||
return (sleep(delay)
|
||||
// pTimeout ensures that the callback can't cause the context to hang
|
||||
.then(function () { return pTimeout(cb(), 1000); })
|
||||
.catch(function (err) {
|
||||
ctx === null || ctx === void 0 ? void 0 : ctx.log('warn', 'Callback Error', { error: err });
|
||||
ctx === null || ctx === void 0 ? void 0 : ctx.stats.increment('callback_error');
|
||||
})
|
||||
.then(function () { return ctx; }));
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/callback/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/callback/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/callback/index.ts"],"names":[],"mappings":"AAGA,MA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,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;IACxC,CAAC,CAAC;SACD,IAAI,CAAC,cAAM,OAAA,GAAG,EAAH,CAAG,CAAC,CACnB,CAAA;AACH,CAAC"}
|
||||
84
node_modules/@segment/analytics-core/dist/esm/context/index.js
generated
vendored
Normal file
84
node_modules/@segment/analytics-core/dist/esm/context/index.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
import { v4 as uuid } from '@lukeed/uuid';
|
||||
import { dset } from 'dset';
|
||||
import { CoreLogger } from '../logger';
|
||||
import { NullStats } from '../stats';
|
||||
var ContextCancelation = /** @class */ (function () {
|
||||
function ContextCancelation(options) {
|
||||
var _a, _b, _c;
|
||||
this.retry = (_a = options.retry) !== null && _a !== void 0 ? _a : true;
|
||||
this.type = (_b = options.type) !== null && _b !== void 0 ? _b : 'plugin Error';
|
||||
this.reason = (_c = options.reason) !== null && _c !== void 0 ? _c : '';
|
||||
}
|
||||
return ContextCancelation;
|
||||
}());
|
||||
export { ContextCancelation };
|
||||
var CoreContext = /** @class */ (function () {
|
||||
function CoreContext(event, id, stats, logger) {
|
||||
if (id === void 0) { id = uuid(); }
|
||||
if (stats === void 0) { stats = new NullStats(); }
|
||||
if (logger === void 0) { logger = new CoreLogger(); }
|
||||
this.attempts = 0;
|
||||
this.event = event;
|
||||
this._id = id;
|
||||
this.logger = logger;
|
||||
this.stats = stats;
|
||||
}
|
||||
CoreContext.system = function () {
|
||||
// This should be overridden by the subclass to return an instance of the subclass.
|
||||
};
|
||||
CoreContext.prototype.isSame = function (other) {
|
||||
return other.id === this.id;
|
||||
};
|
||||
CoreContext.prototype.cancel = function (error) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
throw new ContextCancelation({ reason: 'Context Cancel' });
|
||||
};
|
||||
CoreContext.prototype.log = function (level, message, extras) {
|
||||
this.logger.log(level, message, extras);
|
||||
};
|
||||
Object.defineProperty(CoreContext.prototype, "id", {
|
||||
get: function () {
|
||||
return this._id;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
CoreContext.prototype.updateEvent = function (path, val) {
|
||||
var _a;
|
||||
// Don't allow integrations that are set to false to be overwritten with integration settings.
|
||||
if (path.split('.')[0] === 'integrations') {
|
||||
var integrationName = path.split('.')[1];
|
||||
if (((_a = this.event.integrations) === null || _a === void 0 ? void 0 : _a[integrationName]) === false) {
|
||||
return this.event;
|
||||
}
|
||||
}
|
||||
dset(this.event, path, val);
|
||||
return this.event;
|
||||
};
|
||||
CoreContext.prototype.failedDelivery = function () {
|
||||
return this._failedDelivery;
|
||||
};
|
||||
CoreContext.prototype.setFailedDelivery = function (options) {
|
||||
this._failedDelivery = options;
|
||||
};
|
||||
CoreContext.prototype.logs = function () {
|
||||
return this.logger.logs;
|
||||
};
|
||||
CoreContext.prototype.flush = function () {
|
||||
this.logger.flush();
|
||||
this.stats.flush();
|
||||
};
|
||||
CoreContext.prototype.toJSON = function () {
|
||||
return {
|
||||
id: this._id,
|
||||
event: this.event,
|
||||
logs: this.logger.logs,
|
||||
metrics: this.stats.metrics,
|
||||
};
|
||||
};
|
||||
return CoreContext;
|
||||
}());
|
||||
export { CoreContext };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/context/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/context/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAwB,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAyB,SAAS,EAAE,MAAM,UAAU,CAAA;AAmB3D;IAKE,4BAAY,OAA2B;;QACrC,IAAI,CAAC,KAAK,GAAG,MA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F;QAC9F,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,cAAc,EAAE;YACzC,IAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YAE1C,IAAI,CAAA,MAAA,IAAI,CAAC,KAAK,CAAC,YAAY,0CAAG,eAAe,CAAC,MAAK,KAAK,EAAE;gBACxD,OAAO,IAAI,CAAC,KAAK,CAAA;aAClB;SACF;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,oCAAc,GAAd;QACE,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IAED,uCAAiB,GAAjB,UAAkB,OAA8B;QAC9C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAA;IAChC,CAAC;IAED,0BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;IACzB,CAAC;IAED,2BAAK,GAAL;QACE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QACnB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,4BAAM,GAAN;QACE,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACtB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;SAC5B,CAAA;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAtFD,IAsFC"}
|
||||
2
node_modules/@segment/analytics-core/dist/esm/emitter/interface.js
generated
vendored
Normal file
2
node_modules/@segment/analytics-core/dist/esm/emitter/interface.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=interface.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/emitter/interface.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/emitter/interface.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/emitter/interface.ts"],"names":[],"mappings":""}
|
||||
146
node_modules/@segment/analytics-core/dist/esm/events/index.js
generated
vendored
Normal file
146
node_modules/@segment/analytics-core/dist/esm/events/index.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
import { __assign, __rest } from "tslib";
|
||||
export * from './interfaces';
|
||||
import { dset } from 'dset';
|
||||
import { pickBy } from '../utils/pick';
|
||||
import { validateEvent } from '../validation/assertions';
|
||||
var EventFactory = /** @class */ (function () {
|
||||
function EventFactory(settings) {
|
||||
this.user = settings.user;
|
||||
this.createMessageId = settings.createMessageId;
|
||||
}
|
||||
EventFactory.prototype.track = function (event, properties, options, globalIntegrations) {
|
||||
return this.normalize(__assign(__assign({}, this.baseEvent()), { event: event, type: 'track', properties: properties !== null && properties !== void 0 ? properties : {}, options: __assign({}, options), integrations: __assign({}, globalIntegrations) }));
|
||||
};
|
||||
EventFactory.prototype.page = function (category, page, properties, options, globalIntegrations) {
|
||||
var _a;
|
||||
var event = {
|
||||
type: 'page',
|
||||
properties: __assign({}, properties),
|
||||
options: __assign({}, options),
|
||||
integrations: __assign({}, globalIntegrations),
|
||||
};
|
||||
if (category !== null) {
|
||||
event.category = category;
|
||||
event.properties = (_a = event.properties) !== null && _a !== void 0 ? _a : {};
|
||||
event.properties.category = category;
|
||||
}
|
||||
if (page !== null) {
|
||||
event.name = page;
|
||||
}
|
||||
return this.normalize(__assign(__assign({}, this.baseEvent()), event));
|
||||
};
|
||||
EventFactory.prototype.screen = function (category, screen, properties, options, globalIntegrations) {
|
||||
var event = {
|
||||
type: 'screen',
|
||||
properties: __assign({}, properties),
|
||||
options: __assign({}, options),
|
||||
integrations: __assign({}, globalIntegrations),
|
||||
};
|
||||
if (category !== null) {
|
||||
event.category = category;
|
||||
}
|
||||
if (screen !== null) {
|
||||
event.name = screen;
|
||||
}
|
||||
return this.normalize(__assign(__assign({}, this.baseEvent()), event));
|
||||
};
|
||||
EventFactory.prototype.identify = function (userId, traits, options, globalIntegrations) {
|
||||
return this.normalize(__assign(__assign({}, this.baseEvent()), { type: 'identify', userId: userId, traits: traits !== null && traits !== void 0 ? traits : {}, options: __assign({}, options), integrations: globalIntegrations }));
|
||||
};
|
||||
EventFactory.prototype.group = function (groupId, traits, options, globalIntegrations) {
|
||||
return this.normalize(__assign(__assign({}, this.baseEvent()), { type: 'group', traits: traits !== null && traits !== void 0 ? traits : {}, options: __assign({}, options), integrations: __assign({}, globalIntegrations), //
|
||||
groupId: groupId }));
|
||||
};
|
||||
EventFactory.prototype.alias = function (to, from, // TODO: can we make this undefined?
|
||||
options, globalIntegrations) {
|
||||
var base = {
|
||||
userId: to,
|
||||
type: 'alias',
|
||||
options: __assign({}, options),
|
||||
integrations: __assign({}, globalIntegrations),
|
||||
};
|
||||
if (from !== null) {
|
||||
base.previousId = from;
|
||||
}
|
||||
if (to === undefined) {
|
||||
return this.normalize(__assign(__assign({}, base), this.baseEvent()));
|
||||
}
|
||||
return this.normalize(__assign(__assign({}, this.baseEvent()), base));
|
||||
};
|
||||
EventFactory.prototype.baseEvent = function () {
|
||||
var base = {
|
||||
integrations: {},
|
||||
options: {},
|
||||
};
|
||||
if (!this.user)
|
||||
return base;
|
||||
var user = this.user;
|
||||
if (user.id()) {
|
||||
base.userId = user.id();
|
||||
}
|
||||
if (user.anonymousId()) {
|
||||
base.anonymousId = user.anonymousId();
|
||||
}
|
||||
return base;
|
||||
};
|
||||
/**
|
||||
* Builds the context part of an event based on "foreign" keys that
|
||||
* are provided in the `Options` parameter for an Event
|
||||
*/
|
||||
EventFactory.prototype.context = function (options) {
|
||||
var _a;
|
||||
/**
|
||||
* If the event options are known keys from this list, we move them to the top level of the event.
|
||||
* Any other options are moved to context.
|
||||
*/
|
||||
var eventOverrideKeys = [
|
||||
'userId',
|
||||
'anonymousId',
|
||||
'timestamp',
|
||||
];
|
||||
delete options['integrations'];
|
||||
var providedOptionsKeys = Object.keys(options);
|
||||
var context = (_a = options.context) !== null && _a !== void 0 ? _a : {};
|
||||
var eventOverrides = {};
|
||||
providedOptionsKeys.forEach(function (key) {
|
||||
if (key === 'context') {
|
||||
return;
|
||||
}
|
||||
if (eventOverrideKeys.includes(key)) {
|
||||
dset(eventOverrides, key, options[key]);
|
||||
}
|
||||
else {
|
||||
dset(context, key, options[key]);
|
||||
}
|
||||
});
|
||||
return [context, eventOverrides];
|
||||
};
|
||||
EventFactory.prototype.normalize = function (event) {
|
||||
var _a, _b;
|
||||
var integrationBooleans = Object.keys((_a = event.integrations) !== null && _a !== void 0 ? _a : {}).reduce(function (integrationNames, name) {
|
||||
var _a;
|
||||
var _b;
|
||||
return __assign(__assign({}, integrationNames), (_a = {}, _a[name] = Boolean((_b = event.integrations) === null || _b === void 0 ? void 0 : _b[name]), _a));
|
||||
}, {});
|
||||
// filter out any undefined options
|
||||
event.options = pickBy(event.options || {}, function (_, value) {
|
||||
return value !== undefined;
|
||||
});
|
||||
// This is pretty trippy, but here's what's going on:
|
||||
// - a) We don't pass initial integration options as part of the event, only if they're true or false
|
||||
// - b) We do accept per integration overrides (like integrations.Amplitude.sessionId) at the event level
|
||||
// Hence the need to convert base integration options to booleans, but maintain per event integration overrides
|
||||
var allIntegrations = __assign(__assign({}, integrationBooleans), (_b = event.options) === null || _b === void 0 ? void 0 : _b.integrations);
|
||||
var _c = event.options
|
||||
? this.context(event.options)
|
||||
: [], context = _c[0], overrides = _c[1];
|
||||
var options = event.options, rest = __rest(event, ["options"]);
|
||||
var body = __assign(__assign(__assign({ timestamp: new Date() }, rest), { integrations: allIntegrations, context: context }), overrides);
|
||||
var evt = __assign(__assign({}, body), { messageId: this.createMessageId() });
|
||||
validateEvent(evt);
|
||||
return evt;
|
||||
};
|
||||
return EventFactory;
|
||||
}());
|
||||
export { EventFactory };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/events/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/events/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":";AAAA,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAW3B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAQxD;IAIE,sBAAY,QAA8B;QACxC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAA;QACzB,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;IACjD,CAAC;IAED,4BAAK,GAAL,UACE,KAAa,EACb,UAA4B,EAC5B,OAAqB,EACrB,kBAAiC;QAEjC,OAAO,IAAI,CAAC,SAAS,uBAChB,IAAI,CAAC,SAAS,EAAE,KACnB,KAAK,OAAA,EACL,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,EAC5B,OAAO,eAAO,OAAO,GACrB,YAAY,eAAO,kBAAkB,KACrC,CAAA;IACJ,CAAC;IAED,2BAAI,GAAJ,UACE,QAAuB,EACvB,IAAmB,EACnB,UAA4B,EAC5B,OAAqB,EACrB,kBAAiC;;QAEjC,IAAM,KAAK,GAAqB;YAC9B,IAAI,EAAE,MAAM;YACZ,UAAU,eAAO,UAAU,CAAE;YAC7B,OAAO,eAAO,OAAO,CAAE;YACvB,YAAY,eAAO,kBAAkB,CAAE;SACxC,CAAA;QAED,IAAI,QAAQ,KAAK,IAAI,EAAE;YACrB,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;YACzB,KAAK,CAAC,UAAU,GAAG,MAAA,KA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AAqG;QACrG,yGAAyG;QACzG,+GAA+G;QAC/G,IAAM,eAAe,yBAEhB,mBAAmB,GAGnB,MAAA,KAAK,CAAC,OAAO,0CAAE,YAAY,CAC/B,CAAA;QAEK,IAAA,KAAuB,KAAK,CAAC,OAAO;YACxC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;YAC7B,CAAC,CAAC,EAAE,EAFC,OAAO,QAAA,EAAE,SAAS,QAEnB,CAAA;QAEE,IAAA,OAAO,GAAc,KAAK,QAAnB,EAAK,IAAI,UAAK,KAAK,EAA5B,WAAoB,CAAF,CAAU;QAElC,IAAM,IAAI,gCACR,SAAS,EAAE,IAAI,IAAI,EAAE,IAClB,IAAI,KACP,YAAY,EAAE,eAAe,EAC7B,OAAO,SAAA,KACJ,SAAS,CACb,CAAA;QAED,IAAM,GAAG,yBACJ,IAAI,KACP,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,GAClC,CAAA;QAED,aAAa,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,GAAG,CAAA;IACZ,CAAC;IACH,mBAAC;AAAD,CAAC,AAlQD,IAkQC"}
|
||||
2
node_modules/@segment/analytics-core/dist/esm/events/interfaces.js
generated
vendored
Normal file
2
node_modules/@segment/analytics-core/dist/esm/events/interfaces.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=interfaces.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/events/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/events/interfaces.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/events/interfaces.ts"],"names":[],"mappings":""}
|
||||
19
node_modules/@segment/analytics-core/dist/esm/index.js
generated
vendored
Normal file
19
node_modules/@segment/analytics-core/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export * from './emitter/interface';
|
||||
export * from './plugins';
|
||||
export * from './events/interfaces';
|
||||
export * from './events';
|
||||
export * from './callback';
|
||||
export * from './priority-queue';
|
||||
export { backoff } from './priority-queue/backoff';
|
||||
export * from './context';
|
||||
export * from './queue/event-queue';
|
||||
export * from './analytics';
|
||||
export * from './analytics/dispatch';
|
||||
export * from './validation/helpers';
|
||||
export * from './validation/errors';
|
||||
export * from './validation/assertions';
|
||||
export * from './utils/bind-all';
|
||||
export * from './stats';
|
||||
export { CoreLogger } from './logger';
|
||||
export * from './queue/delivery';
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
|
||||
59
node_modules/@segment/analytics-core/dist/esm/logger/index.js
generated
vendored
Normal file
59
node_modules/@segment/analytics-core/dist/esm/logger/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import { __assign } from "tslib";
|
||||
var CoreLogger = /** @class */ (function () {
|
||||
function CoreLogger() {
|
||||
this._logs = [];
|
||||
}
|
||||
CoreLogger.prototype.log = function (level, message, extras) {
|
||||
var time = new Date();
|
||||
this._logs.push({
|
||||
level: level,
|
||||
message: message,
|
||||
time: time,
|
||||
extras: extras,
|
||||
});
|
||||
};
|
||||
Object.defineProperty(CoreLogger.prototype, "logs", {
|
||||
get: function () {
|
||||
return this._logs;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
CoreLogger.prototype.flush = function () {
|
||||
if (this.logs.length > 1) {
|
||||
var formatted = this._logs.reduce(function (logs, log) {
|
||||
var _a;
|
||||
var _b, _c;
|
||||
var line = __assign(__assign({}, log), { json: JSON.stringify(log.extras, null, ' '), extras: log.extras });
|
||||
delete line['time'];
|
||||
var key = (_c = (_b = log.time) === null || _b === void 0 ? void 0 : _b.toISOString()) !== null && _c !== void 0 ? _c : '';
|
||||
if (logs[key]) {
|
||||
key = "".concat(key, "-").concat(Math.random());
|
||||
}
|
||||
return __assign(__assign({}, logs), (_a = {}, _a[key] = line, _a));
|
||||
}, {});
|
||||
// ie doesn't like console.table
|
||||
if (console.table) {
|
||||
console.table(formatted);
|
||||
}
|
||||
else {
|
||||
console.log(formatted);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.logs.forEach(function (logEntry) {
|
||||
var level = logEntry.level, message = logEntry.message, extras = logEntry.extras;
|
||||
if (level === 'info' || level === 'debug') {
|
||||
console.log(message, extras !== null && extras !== void 0 ? extras : '');
|
||||
}
|
||||
else {
|
||||
console[level](message, extras !== null && extras !== void 0 ? extras : '');
|
||||
}
|
||||
});
|
||||
}
|
||||
this._logs = [];
|
||||
};
|
||||
return CoreLogger;
|
||||
}());
|
||||
export { CoreLogger };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/logger/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/logger/index.js.map
generated
vendored
Normal file
@@ -0,0 +1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AAA;aACzB;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;aACvB;SACF;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,QAAQ;gBACjB,IAAA,KAAK,GAAsB,QAAQ,MAA9B,EAAE,OAAO,GAAa,QAAQ,QAArB,EAAE,MAAM,GAAK,QAAQ,OAAb,CAAa;gBAE3C,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,EAAE;oBACzC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAA;iBACnC;qBAAM;oBACL,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAA;iBACtC;YACH,CAAC,CAAC,CAAA;SACH;QAED,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;IACjB,CAAC;IACH,iBAAC;AAAD,CAAC,AA3DD,IA2DC"}
|
||||
2
node_modules/@segment/analytics-core/dist/esm/plugins/index.js
generated
vendored
Normal file
2
node_modules/@segment/analytics-core/dist/esm/plugins/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/plugins/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/plugins/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":""}
|
||||
6
node_modules/@segment/analytics-core/dist/esm/priority-queue/backoff.js
generated
vendored
Normal file
6
node_modules/@segment/analytics-core/dist/esm/priority-queue/backoff.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export function backoff(params) {
|
||||
var random = Math.random() + 1;
|
||||
var _a = params.minTimeout, minTimeout = _a === void 0 ? 500 : _a, _b = params.factor, factor = _b === void 0 ? 2 : _b, attempt = params.attempt, _c = params.maxTimeout, maxTimeout = _c === void 0 ? Infinity : _c;
|
||||
return Math.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout);
|
||||
}
|
||||
//# sourceMappingURL=backoff.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/priority-queue/backoff.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/priority-queue/backoff.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../../src/priority-queue/backoff.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,OAAO,CAAC,MAAqB;IAC3C,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE9B,IAAA,KAIE,MAAM,WAJQ,EAAhB,UAAU,mBAAG,GAAG,KAAA,EAChB,KAGE,MAAM,OAHE,EAAV,MAAM,mBAAG,CAAC,KAAA,EACV,OAAO,GAEL,MAAM,QAFD,EACP,KACE,MAAM,WADa,EAArB,UAAU,mBAAG,QAAQ,KAAA,CACb;IACV,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,CAAA;AAC9E,CAAC"}
|
||||
89
node_modules/@segment/analytics-core/dist/esm/priority-queue/index.js
generated
vendored
Normal file
89
node_modules/@segment/analytics-core/dist/esm/priority-queue/index.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import { __extends } from "tslib";
|
||||
import { Emitter } from '@segment/analytics-generic-utils';
|
||||
import { backoff } from './backoff';
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export var ON_REMOVE_FROM_FUTURE = 'onRemoveFromFuture';
|
||||
var PriorityQueue = /** @class */ (function (_super) {
|
||||
__extends(PriorityQueue, _super);
|
||||
function PriorityQueue(maxAttempts, queue, seen) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.future = [];
|
||||
_this.maxAttempts = maxAttempts;
|
||||
_this.queue = queue;
|
||||
_this.seen = seen !== null && seen !== void 0 ? seen : {};
|
||||
return _this;
|
||||
}
|
||||
PriorityQueue.prototype.push = function () {
|
||||
var _this = this;
|
||||
var items = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
items[_i] = arguments[_i];
|
||||
}
|
||||
var accepted = items.map(function (operation) {
|
||||
var attempts = _this.updateAttempts(operation);
|
||||
if (attempts > _this.maxAttempts || _this.includes(operation)) {
|
||||
return false;
|
||||
}
|
||||
_this.queue.push(operation);
|
||||
return true;
|
||||
});
|
||||
this.queue = this.queue.sort(function (a, b) { return _this.getAttempts(a) - _this.getAttempts(b); });
|
||||
return accepted;
|
||||
};
|
||||
PriorityQueue.prototype.pushWithBackoff = function (item) {
|
||||
var _this = this;
|
||||
if (this.getAttempts(item) === 0) {
|
||||
return this.push(item)[0];
|
||||
}
|
||||
var attempt = this.updateAttempts(item);
|
||||
if (attempt > this.maxAttempts || this.includes(item)) {
|
||||
return false;
|
||||
}
|
||||
var timeout = backoff({ attempt: attempt - 1 });
|
||||
setTimeout(function () {
|
||||
_this.queue.push(item);
|
||||
// remove from future list
|
||||
_this.future = _this.future.filter(function (f) { return f.id !== item.id; });
|
||||
// Lets listeners know that a 'future' message is now available in the queue
|
||||
_this.emit(ON_REMOVE_FROM_FUTURE);
|
||||
}, timeout);
|
||||
this.future.push(item);
|
||||
return true;
|
||||
};
|
||||
PriorityQueue.prototype.getAttempts = function (item) {
|
||||
var _a;
|
||||
return (_a = this.seen[item.id]) !== null && _a !== void 0 ? _a : 0;
|
||||
};
|
||||
PriorityQueue.prototype.updateAttempts = function (item) {
|
||||
this.seen[item.id] = this.getAttempts(item) + 1;
|
||||
return this.getAttempts(item);
|
||||
};
|
||||
PriorityQueue.prototype.includes = function (item) {
|
||||
return (this.queue.includes(item) ||
|
||||
this.future.includes(item) ||
|
||||
Boolean(this.queue.find(function (i) { return i.id === item.id; })) ||
|
||||
Boolean(this.future.find(function (i) { return i.id === item.id; })));
|
||||
};
|
||||
PriorityQueue.prototype.pop = function () {
|
||||
return this.queue.shift();
|
||||
};
|
||||
Object.defineProperty(PriorityQueue.prototype, "length", {
|
||||
get: function () {
|
||||
return this.queue.length;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(PriorityQueue.prototype, "todo", {
|
||||
get: function () {
|
||||
return this.queue.length + this.future.length;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return PriorityQueue;
|
||||
}(Emitter));
|
||||
export { PriorityQueue };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/priority-queue/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/priority-queue/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/priority-queue/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG,oBAAoB,CAAA;AAMzD;IAAuE,iCAAO;IAO5E,uBACE,WAAmB,EACnB,KAAa,EACb,IAA6B;QAH/B,YAKE,iBAAO,SAIR;QAfS,YAAM,GAAW,EAAE,CAAA;QAY3B,KAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,KAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,KAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAA;;IACxB,CAAC;IAED,4BAAI,GAAJ;QAAA,iBAgBC;QAhBI,eAAgB;aAAhB,UAAgB,EAAhB,qBAAgB,EAAhB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W,iCAAM;aAAjB;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;QAC1B,CAAC;;;OAAA;IAED,sBAAW,+BAAI;aAAf;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;QAC/C,CAAC;;;OAAA;IACH,oBAAC;AAAD,CAAC,AA1FD,CAAuE,OAAO,GA0F7E"}
|
||||
64
node_modules/@segment/analytics-core/dist/esm/queue/delivery.js
generated
vendored
Normal file
64
node_modules/@segment/analytics-core/dist/esm/queue/delivery.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import { __awaiter, __generator } from "tslib";
|
||||
import { CoreContext, ContextCancelation } from '../context';
|
||||
function tryAsync(fn) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var err_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 2, , 3]);
|
||||
return [4 /*yield*/, fn()];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
case 2:
|
||||
err_1 = _a.sent();
|
||||
return [2 /*return*/, Promise.reject(err_1)];
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
export function attempt(ctx, plugin) {
|
||||
ctx.log('debug', 'plugin', { plugin: plugin.name });
|
||||
var start = new Date().getTime();
|
||||
var hook = plugin[ctx.event.type];
|
||||
if (hook === undefined) {
|
||||
return Promise.resolve(ctx);
|
||||
}
|
||||
var newCtx = tryAsync(function () { return hook.apply(plugin, [ctx]); })
|
||||
.then(function (ctx) {
|
||||
var done = new Date().getTime() - start;
|
||||
ctx.stats.gauge('plugin_time', done, ["plugin:".concat(plugin.name)]);
|
||||
return ctx;
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (err instanceof ContextCancelation &&
|
||||
err.type === 'middleware_cancellation') {
|
||||
throw err;
|
||||
}
|
||||
if (err instanceof ContextCancelation) {
|
||||
ctx.log('warn', err.type, {
|
||||
plugin: plugin.name,
|
||||
error: err,
|
||||
});
|
||||
return err;
|
||||
}
|
||||
ctx.log('error', 'plugin Error', {
|
||||
plugin: plugin.name,
|
||||
error: err,
|
||||
});
|
||||
ctx.stats.increment('plugin_error', 1, ["plugin:".concat(plugin.name)]);
|
||||
return err;
|
||||
});
|
||||
return newCtx;
|
||||
}
|
||||
export function ensure(ctx, plugin) {
|
||||
return attempt(ctx, plugin).then(function (newContext) {
|
||||
if (newContext instanceof CoreContext) {
|
||||
return newContext;
|
||||
}
|
||||
ctx.log('debug', 'Context canceled');
|
||||
ctx.stats.increment('context_canceled');
|
||||
ctx.cancel(newContext);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=delivery.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/queue/delivery.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/queue/delivery.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../../src/queue/delivery.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAG5D,SAAe,QAAQ,CAAI,EAAwB;;;;;;;oBAExC,qBAAM,EAAE,EAAE,EAAA;wBAAjB,sBAAO,SAAU,EAAA;;;oBAEjB,sBAAO,OAAO,CAAC,MAAM,CAAC,KAAG,CAAC,EAAA;;;;;CAE7B;AAED,MAAM,UAAU,OAAO,CACrB,GAAQ,EACR,MAAuB;IAEvB,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IACnD,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAElC,IAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACnC,IAAI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AAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,UAAC,UAAU;QAC1C,IAAI,UAAU,YAAY,WAAW,EAAE;YACrC,OAAO,UAAU,CAAA;SAClB;QAED,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;QACpC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAA;QACvC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACxB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
||||
335
node_modules/@segment/analytics-core/dist/esm/queue/event-queue.js
generated
vendored
Normal file
335
node_modules/@segment/analytics-core/dist/esm/queue/event-queue.js
generated
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
import { __awaiter, __extends, __generator } from "tslib";
|
||||
import { groupBy } from '../utils/group-by';
|
||||
import { ON_REMOVE_FROM_FUTURE } from '../priority-queue';
|
||||
import { CoreContext, ContextCancelation } from '../context';
|
||||
import { Emitter } from '@segment/analytics-generic-utils';
|
||||
import { createTaskGroup } from '../task/task-group';
|
||||
import { attempt, ensure } from './delivery';
|
||||
var CoreEventQueue = /** @class */ (function (_super) {
|
||||
__extends(CoreEventQueue, _super);
|
||||
function CoreEventQueue(priorityQueue) {
|
||||
var _this = _super.call(this) || this;
|
||||
/**
|
||||
* All event deliveries get suspended until all the tasks in this task group are complete.
|
||||
* For example: a middleware that augments the event object should be loaded safely as a
|
||||
* critical task, this way, event queue will wait for it to be ready before sending events.
|
||||
*
|
||||
* This applies to all the events already in the queue, and the upcoming ones
|
||||
*/
|
||||
_this.criticalTasks = createTaskGroup();
|
||||
_this.plugins = [];
|
||||
_this.failedInitializations = [];
|
||||
_this.flushing = false;
|
||||
_this.queue = priorityQueue;
|
||||
_this.queue.on(ON_REMOVE_FROM_FUTURE, function () {
|
||||
_this.scheduleFlush(0);
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
CoreEventQueue.prototype.register = function (ctx, plugin, instance) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, Promise.resolve(plugin.load(ctx, instance))
|
||||
.then(function () {
|
||||
_this.plugins.push(plugin);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (plugin.type === 'destination') {
|
||||
_this.failedInitializations.push(plugin.name);
|
||||
console.warn(plugin.name, err);
|
||||
ctx.log('warn', 'Failed to load destination', {
|
||||
plugin: plugin.name,
|
||||
error: err,
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
})];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.deregister = function (ctx, plugin, instance) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var e_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 3, , 4]);
|
||||
if (!plugin.unload) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, Promise.resolve(plugin.unload(ctx, instance))];
|
||||
case 1:
|
||||
_a.sent();
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
this.plugins = this.plugins.filter(function (p) { return p.name !== plugin.name; });
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
e_1 = _a.sent();
|
||||
ctx.log('warn', 'Failed to unload destination', {
|
||||
plugin: plugin.name,
|
||||
error: e_1,
|
||||
});
|
||||
return [3 /*break*/, 4];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.dispatch = function (ctx) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var willDeliver;
|
||||
return __generator(this, function (_a) {
|
||||
ctx.log('debug', 'Dispatching');
|
||||
ctx.stats.increment('message_dispatched');
|
||||
this.queue.push(ctx);
|
||||
willDeliver = this.subscribeToDelivery(ctx);
|
||||
this.scheduleFlush(0);
|
||||
return [2 /*return*/, willDeliver];
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.subscribeToDelivery = function (ctx) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
return [2 /*return*/, new Promise(function (resolve) {
|
||||
var onDeliver = function (flushed, delivered) {
|
||||
if (flushed.isSame(ctx)) {
|
||||
_this.off('flush', onDeliver);
|
||||
if (delivered) {
|
||||
resolve(flushed);
|
||||
}
|
||||
else {
|
||||
resolve(flushed);
|
||||
}
|
||||
}
|
||||
};
|
||||
_this.on('flush', onDeliver);
|
||||
})];
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.dispatchSingle = function (ctx) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
ctx.log('debug', 'Dispatching');
|
||||
ctx.stats.increment('message_dispatched');
|
||||
this.queue.updateAttempts(ctx);
|
||||
ctx.attempts = 1;
|
||||
return [2 /*return*/, this.deliver(ctx).catch(function (err) {
|
||||
var accepted = _this.enqueuRetry(err, ctx);
|
||||
if (!accepted) {
|
||||
ctx.setFailedDelivery({ reason: err });
|
||||
return ctx;
|
||||
}
|
||||
return _this.subscribeToDelivery(ctx);
|
||||
})];
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.isEmpty = function () {
|
||||
return this.queue.length === 0;
|
||||
};
|
||||
CoreEventQueue.prototype.scheduleFlush = function (timeout) {
|
||||
var _this = this;
|
||||
if (timeout === void 0) { timeout = 500; }
|
||||
if (this.flushing) {
|
||||
return;
|
||||
}
|
||||
this.flushing = true;
|
||||
setTimeout(function () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
_this.flush().then(function () {
|
||||
setTimeout(function () {
|
||||
_this.flushing = false;
|
||||
if (_this.queue.length) {
|
||||
_this.scheduleFlush(0);
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
}, timeout);
|
||||
};
|
||||
CoreEventQueue.prototype.deliver = function (ctx) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var start, done, err_1, error;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.criticalTasks.done()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
start = Date.now();
|
||||
_a.label = 2;
|
||||
case 2:
|
||||
_a.trys.push([2, 4, , 5]);
|
||||
return [4 /*yield*/, this.flushOne(ctx)];
|
||||
case 3:
|
||||
ctx = _a.sent();
|
||||
done = Date.now() - start;
|
||||
this.emit('delivery_success', ctx);
|
||||
ctx.stats.gauge('delivered', done);
|
||||
ctx.log('debug', 'Delivered', ctx.event);
|
||||
return [2 /*return*/, ctx];
|
||||
case 4:
|
||||
err_1 = _a.sent();
|
||||
error = err_1;
|
||||
ctx.log('error', 'Failed to deliver', error);
|
||||
this.emit('delivery_failure', ctx, error);
|
||||
ctx.stats.increment('delivery_failed');
|
||||
throw err_1;
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.enqueuRetry = function (err, ctx) {
|
||||
var retriable = !(err instanceof ContextCancelation) || err.retry;
|
||||
if (!retriable) {
|
||||
return false;
|
||||
}
|
||||
return this.queue.pushWithBackoff(ctx);
|
||||
};
|
||||
CoreEventQueue.prototype.flush = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var ctx, err_2, accepted;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (this.queue.length === 0) {
|
||||
return [2 /*return*/, []];
|
||||
}
|
||||
ctx = this.queue.pop();
|
||||
if (!ctx) {
|
||||
return [2 /*return*/, []];
|
||||
}
|
||||
ctx.attempts = this.queue.getAttempts(ctx);
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, this.deliver(ctx)];
|
||||
case 2:
|
||||
ctx = _a.sent();
|
||||
this.emit('flush', ctx, true);
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
err_2 = _a.sent();
|
||||
accepted = this.enqueuRetry(err_2, ctx);
|
||||
if (!accepted) {
|
||||
ctx.setFailedDelivery({ reason: err_2 });
|
||||
this.emit('flush', ctx, false);
|
||||
}
|
||||
return [2 /*return*/, []];
|
||||
case 4: return [2 /*return*/, [ctx]];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
CoreEventQueue.prototype.isReady = function () {
|
||||
// return this.plugins.every((p) => p.isLoaded())
|
||||
// should we wait for every plugin to load?
|
||||
return true;
|
||||
};
|
||||
CoreEventQueue.prototype.availableExtensions = function (denyList) {
|
||||
var available = this.plugins.filter(function (p) {
|
||||
var _a, _b, _c;
|
||||
// Only filter out destination plugins or the Segment.io plugin
|
||||
if (p.type !== 'destination' && p.name !== 'Segment.io') {
|
||||
return true;
|
||||
}
|
||||
var alternativeNameMatch = undefined;
|
||||
(_a = p.alternativeNames) === null || _a === void 0 ? void 0 : _a.forEach(function (name) {
|
||||
if (denyList[name] !== undefined) {
|
||||
alternativeNameMatch = denyList[name];
|
||||
}
|
||||
});
|
||||
// Explicit integration option takes precedence, `All: false` does not apply to Segment.io
|
||||
return ((_c = (_b = denyList[p.name]) !== null && _b !== void 0 ? _b : alternativeNameMatch) !== null && _c !== void 0 ? _c : (p.name === 'Segment.io' ? true : denyList.All) !== false);
|
||||
});
|
||||
var _a = groupBy(available, 'type'), _b = _a.before, before = _b === void 0 ? [] : _b, _c = _a.enrichment, enrichment = _c === void 0 ? [] : _c, _d = _a.destination, destination = _d === void 0 ? [] : _d, _e = _a.after, after = _e === void 0 ? [] : _e;
|
||||
return {
|
||||
before: before,
|
||||
enrichment: enrichment,
|
||||
destinations: destination,
|
||||
after: after,
|
||||
};
|
||||
};
|
||||
CoreEventQueue.prototype.flushOne = function (ctx) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _c, before, enrichment, _i, before_1, beforeWare, temp, _d, enrichment_1, enrichmentWare, temp, _e, destinations, after, afterCalls;
|
||||
return __generator(this, function (_f) {
|
||||
switch (_f.label) {
|
||||
case 0:
|
||||
if (!this.isReady()) {
|
||||
throw new Error('Not ready');
|
||||
}
|
||||
if (ctx.attempts > 1) {
|
||||
this.emit('delivery_retry', ctx);
|
||||
}
|
||||
_c = this.availableExtensions((_a = ctx.event.integrations) !== null && _a !== void 0 ? _a : {}), before = _c.before, enrichment = _c.enrichment;
|
||||
_i = 0, before_1 = before;
|
||||
_f.label = 1;
|
||||
case 1:
|
||||
if (!(_i < before_1.length)) return [3 /*break*/, 4];
|
||||
beforeWare = before_1[_i];
|
||||
return [4 /*yield*/, ensure(ctx, beforeWare)];
|
||||
case 2:
|
||||
temp = _f.sent();
|
||||
if (temp instanceof CoreContext) {
|
||||
ctx = temp;
|
||||
}
|
||||
this.emit('message_enriched', ctx, beforeWare);
|
||||
_f.label = 3;
|
||||
case 3:
|
||||
_i++;
|
||||
return [3 /*break*/, 1];
|
||||
case 4:
|
||||
_d = 0, enrichment_1 = enrichment;
|
||||
_f.label = 5;
|
||||
case 5:
|
||||
if (!(_d < enrichment_1.length)) return [3 /*break*/, 8];
|
||||
enrichmentWare = enrichment_1[_d];
|
||||
return [4 /*yield*/, attempt(ctx, enrichmentWare)];
|
||||
case 6:
|
||||
temp = _f.sent();
|
||||
if (temp instanceof CoreContext) {
|
||||
ctx = temp;
|
||||
}
|
||||
this.emit('message_enriched', ctx, enrichmentWare);
|
||||
_f.label = 7;
|
||||
case 7:
|
||||
_d++;
|
||||
return [3 /*break*/, 5];
|
||||
case 8:
|
||||
_e = this.availableExtensions((_b = ctx.event.integrations) !== null && _b !== void 0 ? _b : {}), destinations = _e.destinations, after = _e.after;
|
||||
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
var attempts = destinations.map(function (destination) {
|
||||
return attempt(ctx, destination);
|
||||
});
|
||||
Promise.all(attempts).then(resolve).catch(reject);
|
||||
}, 0);
|
||||
})];
|
||||
case 9:
|
||||
_f.sent();
|
||||
ctx.stats.increment('message_delivered');
|
||||
this.emit('message_delivered', ctx);
|
||||
afterCalls = after.map(function (after) { return attempt(ctx, after); });
|
||||
return [4 /*yield*/, Promise.all(afterCalls)];
|
||||
case 10:
|
||||
_f.sent();
|
||||
return [2 /*return*/, ctx];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return CoreEventQueue;
|
||||
}(Emitter));
|
||||
export { CoreEventQueue };
|
||||
//# sourceMappingURL=event-queue.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/queue/event-queue.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/queue/event-queue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
93
node_modules/@segment/analytics-core/dist/esm/stats/index.js
generated
vendored
Normal file
93
node_modules/@segment/analytics-core/dist/esm/stats/index.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
import { __assign, __extends } from "tslib";
|
||||
var compactMetricType = function (type) {
|
||||
var enums = {
|
||||
gauge: 'g',
|
||||
counter: 'c',
|
||||
};
|
||||
return enums[type];
|
||||
};
|
||||
var CoreStats = /** @class */ (function () {
|
||||
function CoreStats() {
|
||||
this.metrics = [];
|
||||
}
|
||||
CoreStats.prototype.increment = function (metric, by, tags) {
|
||||
if (by === void 0) { by = 1; }
|
||||
this.metrics.push({
|
||||
metric: metric,
|
||||
value: by,
|
||||
tags: tags !== null && tags !== void 0 ? tags : [],
|
||||
type: 'counter',
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
};
|
||||
CoreStats.prototype.gauge = function (metric, value, tags) {
|
||||
this.metrics.push({
|
||||
metric: metric,
|
||||
value: value,
|
||||
tags: tags !== null && tags !== void 0 ? tags : [],
|
||||
type: 'gauge',
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
};
|
||||
CoreStats.prototype.flush = function () {
|
||||
var formatted = this.metrics.map(function (m) { return (__assign(__assign({}, m), { tags: m.tags.join(',') })); });
|
||||
// ie doesn't like console.table
|
||||
if (console.table) {
|
||||
console.table(formatted);
|
||||
}
|
||||
else {
|
||||
console.log(formatted);
|
||||
}
|
||||
this.metrics = [];
|
||||
};
|
||||
/**
|
||||
* compact keys for smaller payload
|
||||
*/
|
||||
CoreStats.prototype.serialize = function () {
|
||||
return this.metrics.map(function (m) {
|
||||
return {
|
||||
m: m.metric,
|
||||
v: m.value,
|
||||
t: m.tags,
|
||||
k: compactMetricType(m.type),
|
||||
e: m.timestamp,
|
||||
};
|
||||
});
|
||||
};
|
||||
return CoreStats;
|
||||
}());
|
||||
export { CoreStats };
|
||||
var NullStats = /** @class */ (function (_super) {
|
||||
__extends(NullStats, _super);
|
||||
function NullStats() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
NullStats.prototype.gauge = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
};
|
||||
NullStats.prototype.increment = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
};
|
||||
NullStats.prototype.flush = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
};
|
||||
NullStats.prototype.serialize = function () {
|
||||
var _args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
_args[_i] = arguments[_i];
|
||||
}
|
||||
return [];
|
||||
};
|
||||
return NullStats;
|
||||
}(CoreStats));
|
||||
export { NullStats };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/stats/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/stats/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stats/index.ts"],"names":[],"mappings":";AAoBA,IAAM,iBAAiB,GAAG,UAAC,IAAoB;IAC7C,IAAM,KAAK,GAA8C;QACvD,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,GAAG;KACb,CAAA;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAA;AACpB,CAAC,CAAA;AAED;IAAA;QACE,YAAO,GAAiB,EAAE,CAAA;IAiD5B,CAAC;IAhDC,6BAAS,GAAT,UAAU,MAAc,EAAE,EAAM,EAAE,IAAe;QAAvB,mBAAA,EAAA,MAAM;QAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,MAAM,QAAA;YACN,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE;YAChB,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,yBAAK,GAAL,UAAM,MAAc,EAAE,KAAa,EAAE,IAAe;QAClD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,MAAM,QAAA;YACN,KAAK,OAAA;YACL,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE;YAChB,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,yBAAK,GAAL;QACE,IAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,uBACrC,CAAC,KACJ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IACtB,EAHwC,CAGxC,CAAC,CAAA;QACH,gCAAgC;QAChC,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;SACzB;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;SACvB;QACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,6BAAS,GAAT;QACE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,CAAC;YACxB,OAAO;gBACL,CAAC,EAAE,CAAC,CAAC,MAAM;gBACX,CAAC,EAAE,CAAC,CAAC,KAAK;gBACV,CAAC,EAAE,CAAC,CAAC,IAAI;gBACT,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC5B,CAAC,EAAE,CAAC,CAAC,SAAS;aACf,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,gBAAC;AAAD,CAAC,AAlDD,IAkDC;;AAED;IAA+B,6BAAS;IAAxC;;IAOA,CAAC;IANU,yBAAK,GAAd;QAAe,eAAwC;aAAxC,UAAwC,EAAxC,qBAAwC,EAAxC,IAAwC;YAAxC,0BAAwC;;IAAG,CAAC;IAClD,6BAAS,GAAlB;QAAmB,eAA4C;aAA5C,UAA4C,EAA5C,qBAA4C,EAA5C,IAA4C;YAA5C,0BAA4C;;IAAG,CAAC;IAC1D,yBAAK,GAAd;QAAe,eAAwC;aAAxC,UAAwC,EAAxC,qBAAwC,EAAxC,IAAwC;YAAxC,0BAAwC;;IAAG,CAAC;IAClD,6BAAS,GAAlB;QAAmB,eAA4C;aAA5C,UAA4C,EAA5C,qBAA4C,EAA5C,IAA4C;YAA5C,0BAA4C;;QAC7D,OAAO,EAAE,CAAA;IACX,CAAC;IACH,gBAAC;AAAD,CAAC,AAPD,CAA+B,SAAS,GAOvC"}
|
||||
20
node_modules/@segment/analytics-core/dist/esm/task/task-group.js
generated
vendored
Normal file
20
node_modules/@segment/analytics-core/dist/esm/task/task-group.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { isThenable } from '../utils/is-thenable';
|
||||
export var createTaskGroup = function () {
|
||||
var taskCompletionPromise;
|
||||
var resolvePromise;
|
||||
var count = 0;
|
||||
return {
|
||||
done: function () { return taskCompletionPromise; },
|
||||
run: function (op) {
|
||||
var returnValue = op();
|
||||
if (isThenable(returnValue)) {
|
||||
if (++count === 1) {
|
||||
taskCompletionPromise = new Promise(function (res) { return (resolvePromise = res); });
|
||||
}
|
||||
returnValue.finally(function () { return --count === 0 && resolvePromise(); });
|
||||
}
|
||||
return returnValue;
|
||||
},
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=task-group.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/task/task-group.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/task/task-group.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"task-group.js","sourceRoot":"","sources":["../../../src/task/task-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AASjD,MAAM,CAAC,IAAM,eAAe,GAAG;IAC7B,IAAI,qBAAoC,CAAA;IACxC,IAAI,cAA0B,CAAA;IAC9B,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,OAAO;QACL,IAAI,EAAE,cAAM,OAAA,qBAAqB,EAArB,CAAqB;QACjC,GAAG,EAAE,UAAC,EAAE;YACN,IAAM,WAAW,GAAG,EAAE,EAAE,CAAA;YAExB,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE;gBAC3B,IAAI,EAAE,KAAK,KAAK,CAAC,EAAE;oBACjB,qBAAqB,GAAG,IAAI,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,CAAC,cAAc,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAA;iBACrE;gBAED,WAAW,CAAC,OAAO,CAAC,cAAM,OAAA,EAAE,KAAK,KAAK,CAAC,IAAI,cAAc,EAAE,EAAjC,CAAiC,CAAC,CAAA;aAC7D;YAED,OAAO,WAAW,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
||||
2
node_modules/@segment/analytics-core/dist/esm/user/index.js
generated
vendored
Normal file
2
node_modules/@segment/analytics-core/dist/esm/user/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/user/index.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/user/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/user/index.ts"],"names":[],"mappings":""}
|
||||
14
node_modules/@segment/analytics-core/dist/esm/utils/bind-all.js
generated
vendored
Normal file
14
node_modules/@segment/analytics-core/dist/esm/utils/bind-all.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export function bindAll(obj) {
|
||||
var proto = obj.constructor.prototype;
|
||||
for (var _i = 0, _a = Object.getOwnPropertyNames(proto); _i < _a.length; _i++) {
|
||||
var key = _a[_i];
|
||||
if (key !== 'constructor') {
|
||||
var desc = Object.getOwnPropertyDescriptor(obj.constructor.prototype, key);
|
||||
if (!!desc && typeof desc.value === 'function') {
|
||||
obj[key] = obj[key].bind(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
//# sourceMappingURL=bind-all.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/utils/bind-all.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/utils/bind-all.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bind-all.js","sourceRoot":"","sources":["../../../src/utils/bind-all.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAGrB,GAAY;IACZ,IAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAA;IACvC,KAAkB,UAAiC,EAAjC,KAAA,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAjC,cAAiC,EAAjC,IAAiC,EAAE;QAAhD,IAAM,GAAG,SAAA;QACZ,IAAI,GAAG,KAAK,aAAa,EAAE;YACzB,IAAM,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAC1C,GAAG,CAAC,WAAW,CAAC,SAAS,EACzB,GAAG,CACJ,CAAA;YACD,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,UAAU,EAAE;gBAC9C,GAAG,CAAC,GAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;aACzC;SACF;KACF;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
||||
18
node_modules/@segment/analytics-core/dist/esm/utils/get-global.js
generated
vendored
Normal file
18
node_modules/@segment/analytics-core/dist/esm/utils/get-global.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/* eslint-disable no-restricted-globals */
|
||||
// This an imperfect polyfill for globalThis
|
||||
export var getGlobal = function () {
|
||||
if (typeof globalThis !== 'undefined') {
|
||||
return globalThis;
|
||||
}
|
||||
if (typeof self !== 'undefined') {
|
||||
return self;
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
return window;
|
||||
}
|
||||
if (typeof global !== 'undefined') {
|
||||
return global;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
//# sourceMappingURL=get-global.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/utils/get-global.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/utils/get-global.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-global.js","sourceRoot":"","sources":["../../../src/utils/get-global.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,4CAA4C;AAC5C,MAAM,CAAC,IAAM,SAAS,GAAG;IACvB,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;QACrC,OAAO,UAAU,CAAA;KAClB;IACD,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAA;KACZ;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAA;KACd;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAA;KACd;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
||||
24
node_modules/@segment/analytics-core/dist/esm/utils/group-by.js
generated
vendored
Normal file
24
node_modules/@segment/analytics-core/dist/esm/utils/group-by.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { __spreadArray } from "tslib";
|
||||
export function groupBy(collection, grouper) {
|
||||
var results = {};
|
||||
collection.forEach(function (item) {
|
||||
var _a;
|
||||
var key = undefined;
|
||||
if (typeof grouper === 'string') {
|
||||
var suggestedKey = item[grouper];
|
||||
key =
|
||||
typeof suggestedKey !== 'string'
|
||||
? JSON.stringify(suggestedKey)
|
||||
: suggestedKey;
|
||||
}
|
||||
else if (grouper instanceof Function) {
|
||||
key = grouper(item);
|
||||
}
|
||||
if (key === undefined) {
|
||||
return;
|
||||
}
|
||||
results[key] = __spreadArray(__spreadArray([], ((_a = results[key]) !== null && _a !== void 0 ? _a : []), true), [item], false);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
//# sourceMappingURL=group-by.js.map
|
||||
1
node_modules/@segment/analytics-core/dist/esm/utils/group-by.js.map
generated
vendored
Normal file
1
node_modules/@segment/analytics-core/dist/esm/utils/group-by.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"group-by.js","sourceRoot":"","sources":["../../../src/utils/group-by.ts"],"names":[],"mappings":";AAEA,MAAM,UAAU,OAAO,CACrB,UAAe,EACf,OAA6B;IAE7B,IAAM,OAAO,GAAwB,EAAE,CAAA;IAEvC,UAAU,CAAC,OAAO,CAAC,UAAC,IAAI;;QACtB,IAAI,GAAG,GAAgC,SAAS,CAAA;QAEhD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,CAAA;YAClC,GAAG;gBACD,OAAO,YAAY,KAAK,QAAQ;oBAC9B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;oBAC9B,CAAC,CAAC,YAAY,CAAA;SACnB;aAAM,IAAI,OAAO,YAAY,QAAQ,EAAE;YACtC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;SACpB;QAED,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAM;SACP;QAED,OAAO,CAAC,GAAG,CAAC,mCAAO,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC,UAAE,IAAI,SAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user