@segment/actions-shared 1.104.0 → 1.105.0-staging-b963b9484
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum CachedResponseType {
|
|
2
|
+
Success = 0,
|
|
3
|
+
Error = 1
|
|
4
|
+
}
|
|
5
|
+
export declare class CachedValueError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class CachedValue {
|
|
9
|
+
status: number;
|
|
10
|
+
type: CachedResponseType;
|
|
11
|
+
protected seperator: string;
|
|
12
|
+
constructor(status: number);
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
|
+
export declare class CachedError extends CachedValue {
|
|
16
|
+
message: string;
|
|
17
|
+
code: string;
|
|
18
|
+
constructor(status: number, message: string, code: string);
|
|
19
|
+
toString(): string;
|
|
20
|
+
}
|
|
21
|
+
export declare class CachedValueFactory {
|
|
22
|
+
static fromString(value: string): CachedValue | CachedError;
|
|
23
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CachedValueFactory = exports.CachedError = exports.CachedValue = exports.CachedValueError = exports.CachedResponseType = void 0;
|
|
4
|
+
var CachedResponseType;
|
|
5
|
+
(function (CachedResponseType) {
|
|
6
|
+
CachedResponseType[CachedResponseType["Success"] = 0] = "Success";
|
|
7
|
+
CachedResponseType[CachedResponseType["Error"] = 1] = "Error";
|
|
8
|
+
})(CachedResponseType = exports.CachedResponseType || (exports.CachedResponseType = {}));
|
|
9
|
+
class CachedValueError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'CachedValueError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.CachedValueError = CachedValueError;
|
|
16
|
+
class CachedValue {
|
|
17
|
+
constructor(status) {
|
|
18
|
+
this.seperator = ':-:';
|
|
19
|
+
this.status = status;
|
|
20
|
+
this.type = CachedResponseType.Success;
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
|
+
return `${this.type}${this.seperator}${this.status}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.CachedValue = CachedValue;
|
|
27
|
+
class CachedError extends CachedValue {
|
|
28
|
+
constructor(status, message, code) {
|
|
29
|
+
super(status);
|
|
30
|
+
this.type = CachedResponseType.Error;
|
|
31
|
+
this.code = code;
|
|
32
|
+
this.message = message;
|
|
33
|
+
}
|
|
34
|
+
toString() {
|
|
35
|
+
return `${super.toString()}${this.seperator}${this.message}${this.seperator}${this.code}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.CachedError = CachedError;
|
|
39
|
+
class CachedValueFactory {
|
|
40
|
+
static fromString(value) {
|
|
41
|
+
const parts = value.split(':-:');
|
|
42
|
+
if (parts.length < 2) {
|
|
43
|
+
throw new CachedValueError('Invalid cached value');
|
|
44
|
+
}
|
|
45
|
+
const [type, status] = parts;
|
|
46
|
+
if (CachedResponseType.Success === +type) {
|
|
47
|
+
return new CachedValue(+status);
|
|
48
|
+
}
|
|
49
|
+
else if (CachedResponseType.Error === +type) {
|
|
50
|
+
if (parts.length < 4) {
|
|
51
|
+
throw new CachedValueError('Invalid cached value');
|
|
52
|
+
}
|
|
53
|
+
const [message, code] = parts.slice(2);
|
|
54
|
+
return new CachedError(+status, message, code);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw new CachedValueError('Invalid cached value');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.CachedValueFactory = CachedValueFactory;
|
|
62
|
+
//# sourceMappingURL=CachedResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CachedResponse.js","sourceRoot":"","sources":["../../../src/engage/utils/CachedResponse.ts"],"names":[],"mappings":";;;AA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,EAAE;YACpB,MAAM,IAAI,gBAAgB,CAAC,sBAAsB,CAAC,CAAA;SACnD;QACD,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,KAAK,CAAA;QAC5B,IAAI,kBAAkB,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE;YACxC,OAAO,IAAI,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;SAChC;aAAM,IAAI,kBAAkB,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE;YAC7C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpB,MAAM,IAAI,gBAAgB,CAAC,sBAAsB,CAAC,CAAA;aACnD;YACD,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACtC,OAAO,IAAI,WAAW,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;SAC/C;aAAM;YACL,MAAM,IAAI,gBAAgB,CAAC,sBAAsB,CAAC,CAAA;SACnD;IACH,CAAC;CACF;AAnBD,gDAmBC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ContextFromDecorator } from './operationTracking';
|
|
2
2
|
export declare const track: ((decoratorArgs?: ({
|
|
3
3
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
4
|
-
} &
|
|
4
|
+
} & {
|
|
5
5
|
onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
6
6
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
7
|
-
} & {
|
|
7
|
+
} & import("./operationTracking").OperationLoggerDecoratorArgs & {
|
|
8
8
|
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
9
9
|
} & {
|
|
10
10
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
@@ -15,9 +15,6 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
15
15
|
}) | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
_contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
18
|
-
start?: number | undefined;
|
|
19
|
-
duration?: number | undefined;
|
|
20
|
-
} & {
|
|
21
18
|
decoratorArgs?: {
|
|
22
19
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
23
20
|
} | undefined;
|
|
@@ -25,16 +22,19 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
25
22
|
parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
|
|
26
23
|
sharedContext: {};
|
|
27
24
|
} & {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
31
|
-
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
25
|
+
start?: number | undefined;
|
|
26
|
+
duration?: number | undefined;
|
|
32
27
|
} & {
|
|
33
28
|
onFinally: (() => void)[];
|
|
34
29
|
decoratorArgs?: {
|
|
35
30
|
onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
36
31
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
37
32
|
} | undefined;
|
|
33
|
+
} & {
|
|
34
|
+
logs: string[];
|
|
35
|
+
logMetadata?: Record<string, unknown> | undefined;
|
|
36
|
+
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
37
|
+
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
38
38
|
} & {
|
|
39
39
|
tags: string[];
|
|
40
40
|
sharedContext: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/actions-shared",
|
|
3
3
|
"description": "Shared destination action methods and definitions.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.105.0-staging-b963b9484",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
40
|
-
"@segment/actions-core": "
|
|
40
|
+
"@segment/actions-core": "3.124.0-staging-b963b9484",
|
|
41
41
|
"cheerio": "^1.0.0-rc.10",
|
|
42
42
|
"dayjs": "^1.10.7",
|
|
43
43
|
"escape-goat": "^3",
|
|
@@ -63,6 +63,5 @@
|
|
|
63
63
|
"setupFilesAfterEnv": [
|
|
64
64
|
"<rootDir>/test/setup-after-env.ts"
|
|
65
65
|
]
|
|
66
|
-
}
|
|
67
|
-
"gitHead": "c7fb79014cb06763decebaa06044d0d5588b2942"
|
|
66
|
+
}
|
|
68
67
|
}
|