@segment/analytics-core
Advanced tools
Comparing version 1.1.2 to 1.1.3
# @segment/analytics-core | ||
## 1.1.3 | ||
### Patch Changes | ||
- [#699](https://github.com/segmentio/analytics-next/pull/699) [`0b9f4d7`](https://github.com/segmentio/analytics-next/commit/0b9f4d7e82662f7d5fda3590e93b10b3fd2e9833) Thanks [@silesky](https://github.com/silesky)! - Fix missing core dependency (@lukeed/uuid) | ||
## 1.1.2 | ||
@@ -4,0 +10,0 @@ |
@@ -7,43 +7,36 @@ "use strict"; | ||
/* Dispatch function, but swallow promise rejections and use event emitter instead */ | ||
var dispatchAndEmit = function () { | ||
var _a = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_a[_i] = arguments[_i]; | ||
} | ||
var event = _a[0], queue = _a[1], emitter = _a[2], options = _a[3]; | ||
return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var ctx, err_1; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, (0, dispatch_1.dispatch)(event, queue, emitter, options)]; | ||
case 1: | ||
ctx = _b.sent(); | ||
if (ctx.failedDelivery()) { | ||
emitter.emit('error', { | ||
code: 'delivery_failure', | ||
message: 'failed to deliver event', | ||
ctx: ctx, | ||
}); | ||
} | ||
else { | ||
emitter.emit(event.type, ctx); | ||
return [2 /*return*/, ctx]; | ||
} | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
err_1 = _b.sent(); | ||
var dispatchAndEmit = function (event, queue, emitter, options) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var ctx, err_1; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, (0, dispatch_1.dispatch)(event, queue, emitter, options)]; | ||
case 1: | ||
ctx = _a.sent(); | ||
if (ctx.failedDelivery()) { | ||
emitter.emit('error', { | ||
code: 'unknown', | ||
message: 'an unknown error occurred when dispatching an event.', | ||
err: err_1, | ||
code: 'delivery_failure', | ||
message: 'failed to deliver event', | ||
ctx: ctx, | ||
}); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
} | ||
else { | ||
emitter.emit(event.type, ctx); | ||
return [2 /*return*/, ctx]; | ||
} | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
err_1 = _a.sent(); | ||
emitter.emit('error', { | ||
code: 'unknown', | ||
message: 'an unknown error occurred when dispatching an event.', | ||
err: err_1, | ||
}); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}; | ||
}); }; | ||
exports.dispatchAndEmit = dispatchAndEmit; | ||
//# sourceMappingURL=dispatch-emit.js.map |
import { __awaiter, __generator } from "tslib"; | ||
import { dispatch } from './dispatch'; | ||
/* Dispatch function, but swallow promise rejections and use event emitter instead */ | ||
export var dispatchAndEmit = function () { | ||
var _a = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_a[_i] = arguments[_i]; | ||
} | ||
var event = _a[0], queue = _a[1], emitter = _a[2], options = _a[3]; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var ctx, err_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, dispatch(event, queue, emitter, options)]; | ||
case 1: | ||
ctx = _b.sent(); | ||
if (ctx.failedDelivery()) { | ||
emitter.emit('error', { | ||
code: 'delivery_failure', | ||
message: 'failed to deliver event', | ||
ctx: ctx, | ||
}); | ||
} | ||
else { | ||
emitter.emit(event.type, ctx); | ||
return [2 /*return*/, ctx]; | ||
} | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
err_1 = _b.sent(); | ||
export var dispatchAndEmit = function (event, queue, emitter, options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var ctx, err_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, dispatch(event, queue, emitter, options)]; | ||
case 1: | ||
ctx = _a.sent(); | ||
if (ctx.failedDelivery()) { | ||
emitter.emit('error', { | ||
code: 'unknown', | ||
message: 'an unknown error occurred when dispatching an event.', | ||
err: err_1, | ||
code: 'delivery_failure', | ||
message: 'failed to deliver event', | ||
ctx: ctx, | ||
}); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
} | ||
else { | ||
emitter.emit(event.type, ctx); | ||
return [2 /*return*/, ctx]; | ||
} | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
err_1 = _a.sent(); | ||
emitter.emit('error', { | ||
code: 'unknown', | ||
message: 'an unknown error occurred when dispatching an event.', | ||
err: err_1, | ||
}); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}; | ||
}); }; | ||
//# sourceMappingURL=dispatch-emit.js.map |
@@ -1,4 +0,6 @@ | ||
export declare const dispatchAndEmit: (event: import("..").CoreSegmentEvent, queue: import("..").EventQueue, emitter: import("..").Emitter<{ | ||
[x: string]: any[]; | ||
}>, options?: import("./dispatch").DispatchOptions | undefined) => Promise<import("..").CoreContext<import("..").CoreSegmentEvent> | undefined>; | ||
import { CoreContext } from '../context'; | ||
import { dispatch } from './dispatch'; | ||
declare type DispatchAndEmitFn = (...args: Parameters<typeof dispatch>) => Promise<CoreContext | undefined>; | ||
export declare const dispatchAndEmit: DispatchAndEmitFn; | ||
export {}; | ||
//# sourceMappingURL=dispatch-emit.d.ts.map |
{ | ||
"name": "@segment/analytics-core", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"repository": { | ||
@@ -35,2 +35,3 @@ "type": "git", | ||
"dependencies": { | ||
"@lukeed/uuid": "^2.0.0", | ||
"dset": "^3.1.2", | ||
@@ -37,0 +38,0 @@ "tslib": "^2.4.0" |
@@ -0,6 +1,14 @@ | ||
import { CoreContext } from '../context' | ||
import { dispatch } from './dispatch' | ||
type DispatchAndEmitFn = ( | ||
...args: Parameters<typeof dispatch> | ||
) => Promise<CoreContext | undefined> | ||
/* Dispatch function, but swallow promise rejections and use event emitter instead */ | ||
export const dispatchAndEmit = async ( | ||
...[event, queue, emitter, options]: Parameters<typeof dispatch> | ||
export const dispatchAndEmit: DispatchAndEmitFn = async ( | ||
event, | ||
queue, | ||
emitter, | ||
options | ||
) => { | ||
@@ -7,0 +15,0 @@ try { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
268164
3
214
4668
+ Added@lukeed/uuid@^2.0.0
+ Added@lukeed/csprng@1.1.0(transitive)
+ Added@lukeed/uuid@2.0.1(transitive)