@temporalio/common 1.11.8 → 1.12.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/activity-options.d.ts +6 -1
- package/lib/activity-options.js.map +1 -1
- package/lib/converter/failure-converter.d.ts +3 -3
- package/lib/converter/failure-converter.js +3 -1
- package/lib/converter/failure-converter.js.map +1 -1
- package/lib/converter/payload-converter.d.ts +2 -15
- package/lib/converter/payload-converter.js +6 -69
- package/lib/converter/payload-converter.js.map +1 -1
- package/lib/converter/payload-search-attributes.d.ts +26 -0
- package/lib/converter/payload-search-attributes.js +171 -0
- package/lib/converter/payload-search-attributes.js.map +1 -0
- package/lib/converter/protobuf-payload-converters.js +3 -2
- package/lib/converter/protobuf-payload-converters.js.map +1 -1
- package/lib/errors.d.ts +2 -1
- package/lib/errors.js +6 -1
- package/lib/errors.js.map +1 -1
- package/lib/failure.d.ts +20 -1
- package/lib/failure.js +47 -5
- package/lib/failure.js.map +1 -1
- package/lib/index.d.ts +7 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +0 -7
- package/lib/interfaces.js.map +1 -1
- package/lib/internal-non-workflow/codec-helpers.d.ts +2 -2
- package/lib/internal-non-workflow/index.d.ts +0 -1
- package/lib/internal-non-workflow/index.js +0 -1
- package/lib/internal-non-workflow/index.js.map +1 -1
- package/lib/internal-workflow/index.d.ts +1 -0
- package/lib/internal-workflow/index.js +1 -0
- package/lib/internal-workflow/index.js.map +1 -1
- package/lib/internal-workflow/objects-helpers.d.ts +15 -0
- package/lib/internal-workflow/objects-helpers.js +29 -0
- package/lib/internal-workflow/objects-helpers.js.map +1 -0
- package/lib/logger.d.ts +32 -0
- package/lib/logger.js +91 -1
- package/lib/logger.js.map +1 -1
- package/lib/metrics.d.ts +181 -0
- package/lib/metrics.js +240 -0
- package/lib/metrics.js.map +1 -0
- package/lib/priority.d.ts +36 -0
- package/lib/priority.js +27 -0
- package/lib/priority.js.map +1 -0
- package/lib/search-attributes.d.ts +77 -0
- package/lib/search-attributes.js +233 -0
- package/lib/search-attributes.js.map +1 -0
- package/lib/type-helpers.d.ts +5 -1
- package/lib/type-helpers.js +0 -22
- package/lib/type-helpers.js.map +1 -1
- package/lib/versioning-intent-enum.d.ts +1 -1
- package/lib/versioning-intent-enum.js +1 -1
- package/lib/versioning-intent.d.ts +1 -1
- package/lib/worker-deployments.d.ts +47 -0
- package/lib/worker-deployments.js +32 -0
- package/lib/worker-deployments.js.map +1 -0
- package/lib/workflow-definition-options.d.ts +18 -0
- package/lib/workflow-definition-options.js +3 -0
- package/lib/workflow-definition-options.js.map +1 -0
- package/lib/workflow-options.d.ts +22 -2
- package/lib/workflow-options.js.map +1 -1
- package/package.json +6 -3
- package/src/activity-options.ts +7 -1
- package/src/converter/failure-converter.ts +9 -4
- package/src/converter/payload-converter.ts +7 -71
- package/src/converter/payload-search-attributes.ts +220 -0
- package/src/errors.ts +2 -1
- package/src/failure.ts +38 -3
- package/src/index.ts +13 -0
- package/src/interfaces.ts +0 -8
- package/src/internal-non-workflow/codec-helpers.ts +2 -2
- package/src/internal-non-workflow/index.ts +0 -1
- package/src/internal-workflow/index.ts +1 -0
- package/src/internal-workflow/objects-helpers.ts +37 -0
- package/src/logger.ts +108 -0
- package/src/metrics.ts +443 -0
- package/src/priority.ts +54 -0
- package/src/search-attributes.ts +292 -0
- package/src/type-helpers.ts +11 -23
- package/src/versioning-intent-enum.ts +1 -1
- package/src/versioning-intent.ts +1 -1
- package/src/worker-deployments.ts +70 -0
- package/src/workflow-definition-options.ts +20 -0
- package/src/workflow-options.ts +27 -3
- package/lib/internal-non-workflow/utils.d.ts +0 -4
- package/lib/internal-non-workflow/utils.js +0 -10
- package/lib/internal-non-workflow/utils.js.map +0 -1
- package/src/internal-non-workflow/utils.ts +0 -6
package/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":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,GAA5B,MAAM,sBAAuB,SAAQ,KAAK;IACnB;IAA5B,YAA4B,SAAiB;QAC3C,KAAK,CAAC,yBAAyB,SAAS,GAAG,CAAC,CAAC;QADnB,cAAS,GAAT,SAAS,CAAQ;IAE7C,CAAC;CACF,CAAA;AAJY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,yCAA0B,EAAC,wBAAwB,CAAC;GACxC,sBAAsB,CAIlC"}
|
package/lib/failure.d.ts
CHANGED
|
@@ -47,6 +47,19 @@ export declare const RetryState: {
|
|
|
47
47
|
};
|
|
48
48
|
export type RetryState = (typeof RetryState)[keyof typeof RetryState];
|
|
49
49
|
export declare const encodeRetryState: (input: "IN_PROGRESS" | "NON_RETRYABLE_FAILURE" | "TIMEOUT" | "MAXIMUM_ATTEMPTS_REACHED" | "RETRY_POLICY_NOT_SET" | "INTERNAL_SERVER_ERROR" | "CANCEL_REQUESTED" | "RETRY_STATE_IN_PROGRESS" | "RETRY_STATE_NON_RETRYABLE_FAILURE" | "RETRY_STATE_TIMEOUT" | "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | "RETRY_STATE_RETRY_POLICY_NOT_SET" | "RETRY_STATE_INTERNAL_SERVER_ERROR" | "RETRY_STATE_CANCEL_REQUESTED" | temporal.api.enums.v1.RetryState | null | undefined) => temporal.api.enums.v1.RetryState | undefined, decodeRetryState: (input: temporal.api.enums.v1.RetryState | null | undefined) => "IN_PROGRESS" | "NON_RETRYABLE_FAILURE" | "TIMEOUT" | "MAXIMUM_ATTEMPTS_REACHED" | "RETRY_POLICY_NOT_SET" | "INTERNAL_SERVER_ERROR" | "CANCEL_REQUESTED" | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* A category to describe the severity and change the observability behavior of an application failure.
|
|
52
|
+
*
|
|
53
|
+
* Currently, observability behaviour changes are limited to:
|
|
54
|
+
* - activities that fail due to a BENIGN application failure emit DEBUG level logs and do not record metrics
|
|
55
|
+
*
|
|
56
|
+
* @experimental Category is a new feature and may be subject to change.
|
|
57
|
+
*/
|
|
58
|
+
export declare const ApplicationFailureCategory: {
|
|
59
|
+
readonly BENIGN: "BENIGN";
|
|
60
|
+
};
|
|
61
|
+
export type ApplicationFailureCategory = (typeof ApplicationFailureCategory)[keyof typeof ApplicationFailureCategory];
|
|
62
|
+
export declare const encodeApplicationFailureCategory: (input: "BENIGN" | temporal.api.enums.v1.ApplicationErrorCategory | "APPLICATION_ERROR_CATEGORY_BENIGN" | null | undefined) => temporal.api.enums.v1.ApplicationErrorCategory | undefined, decodeApplicationFailureCategory: (input: temporal.api.enums.v1.ApplicationErrorCategory | null | undefined) => "BENIGN" | undefined;
|
|
50
63
|
export type WorkflowExecution = temporal.api.common.v1.IWorkflowExecution;
|
|
51
64
|
/**
|
|
52
65
|
* Represents failures that can cross Workflow and Activity boundaries.
|
|
@@ -97,10 +110,11 @@ export declare class ApplicationFailure extends TemporalFailure {
|
|
|
97
110
|
readonly nonRetryable?: boolean | undefined | null;
|
|
98
111
|
readonly details?: unknown[] | undefined | null;
|
|
99
112
|
readonly nextRetryDelay?: Duration | undefined | null;
|
|
113
|
+
readonly category?: ApplicationFailureCategory | undefined | null;
|
|
100
114
|
/**
|
|
101
115
|
* Alternatively, use {@link fromError} or {@link create}.
|
|
102
116
|
*/
|
|
103
|
-
constructor(message?: string | undefined | null, type?: string | undefined | null, nonRetryable?: boolean | undefined | null, details?: unknown[] | undefined | null, cause?: Error, nextRetryDelay?: Duration | undefined | null);
|
|
117
|
+
constructor(message?: string | undefined | null, type?: string | undefined | null, nonRetryable?: boolean | undefined | null, details?: unknown[] | undefined | null, cause?: Error, nextRetryDelay?: Duration | undefined | null, category?: ApplicationFailureCategory | undefined | null);
|
|
104
118
|
/**
|
|
105
119
|
* Create a new `ApplicationFailure` from an Error object.
|
|
106
120
|
*
|
|
@@ -165,6 +179,11 @@ export interface ApplicationFailureOptions {
|
|
|
165
179
|
* Cause of the failure
|
|
166
180
|
*/
|
|
167
181
|
cause?: Error;
|
|
182
|
+
/**
|
|
183
|
+
* Severity category of the application error.
|
|
184
|
+
* Affects worker-side logging and metrics behavior of this failure.
|
|
185
|
+
*/
|
|
186
|
+
category?: ApplicationFailureCategory;
|
|
168
187
|
}
|
|
169
188
|
/**
|
|
170
189
|
* This error is thrown when Cancellation has been requested. To allow Cancellation to happen, let it propagate. To
|
package/lib/failure.js
CHANGED
|
@@ -5,9 +5,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
-
var _a, _b;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.WorkflowExecutionAlreadyStartedError = exports.ChildWorkflowFailure = exports.ActivityFailure = exports.TimeoutFailure = exports.TerminatedFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ServerFailure = exports.TemporalFailure = exports.decodeRetryState = exports.encodeRetryState = exports.RetryState = exports.decodeTimeoutType = exports.encodeTimeoutType = exports.TimeoutType = exports.FAILURE_SOURCE = void 0;
|
|
10
|
+
exports.WorkflowExecutionAlreadyStartedError = exports.ChildWorkflowFailure = exports.ActivityFailure = exports.TimeoutFailure = exports.TerminatedFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ServerFailure = exports.TemporalFailure = exports.decodeApplicationFailureCategory = exports.encodeApplicationFailureCategory = exports.ApplicationFailureCategory = exports.decodeRetryState = exports.encodeRetryState = exports.RetryState = exports.decodeTimeoutType = exports.encodeTimeoutType = exports.TimeoutType = exports.FAILURE_SOURCE = void 0;
|
|
11
11
|
exports.ensureApplicationFailure = ensureApplicationFailure;
|
|
12
12
|
exports.ensureTemporalFailure = ensureTemporalFailure;
|
|
13
13
|
exports.rootCause = rootCause;
|
|
@@ -72,6 +72,21 @@ _b = (0, internal_workflow_1.makeProtoEnumConverters)({
|
|
|
72
72
|
[exports.RetryState.CANCEL_REQUESTED]: 7,
|
|
73
73
|
UNSPECIFIED: 0,
|
|
74
74
|
}, 'RETRY_STATE_'), exports.encodeRetryState = _b[0], exports.decodeRetryState = _b[1];
|
|
75
|
+
/**
|
|
76
|
+
* A category to describe the severity and change the observability behavior of an application failure.
|
|
77
|
+
*
|
|
78
|
+
* Currently, observability behaviour changes are limited to:
|
|
79
|
+
* - activities that fail due to a BENIGN application failure emit DEBUG level logs and do not record metrics
|
|
80
|
+
*
|
|
81
|
+
* @experimental Category is a new feature and may be subject to change.
|
|
82
|
+
*/
|
|
83
|
+
exports.ApplicationFailureCategory = {
|
|
84
|
+
BENIGN: 'BENIGN',
|
|
85
|
+
};
|
|
86
|
+
_c = (0, internal_workflow_1.makeProtoEnumConverters)({
|
|
87
|
+
[exports.ApplicationFailureCategory.BENIGN]: 1,
|
|
88
|
+
UNSPECIFIED: 0,
|
|
89
|
+
}, 'APPLICATION_ERROR_CATEGORY_'), exports.encodeApplicationFailureCategory = _c[0], exports.decodeApplicationFailureCategory = _c[1];
|
|
75
90
|
/**
|
|
76
91
|
* Represents failures that can cross Workflow and Activity boundaries.
|
|
77
92
|
*
|
|
@@ -80,6 +95,13 @@ _b = (0, internal_workflow_1.makeProtoEnumConverters)({
|
|
|
80
95
|
* The only child class you should ever throw from your code is {@link ApplicationFailure}.
|
|
81
96
|
*/
|
|
82
97
|
let TemporalFailure = class TemporalFailure extends Error {
|
|
98
|
+
cause;
|
|
99
|
+
/**
|
|
100
|
+
* The original failure that constructed this error.
|
|
101
|
+
*
|
|
102
|
+
* Only present if this error was generated from an external operation.
|
|
103
|
+
*/
|
|
104
|
+
failure;
|
|
83
105
|
constructor(message, cause) {
|
|
84
106
|
super(message ?? undefined);
|
|
85
107
|
this.cause = cause;
|
|
@@ -91,6 +113,7 @@ exports.TemporalFailure = TemporalFailure = __decorate([
|
|
|
91
113
|
], TemporalFailure);
|
|
92
114
|
/** Exceptions originated at the Temporal service. */
|
|
93
115
|
let ServerFailure = class ServerFailure extends TemporalFailure {
|
|
116
|
+
nonRetryable;
|
|
94
117
|
constructor(message, nonRetryable, cause) {
|
|
95
118
|
super(message, cause);
|
|
96
119
|
this.nonRetryable = nonRetryable;
|
|
@@ -123,15 +146,21 @@ exports.ServerFailure = ServerFailure = __decorate([
|
|
|
123
146
|
* Workflow.
|
|
124
147
|
*/
|
|
125
148
|
let ApplicationFailure = class ApplicationFailure extends TemporalFailure {
|
|
149
|
+
type;
|
|
150
|
+
nonRetryable;
|
|
151
|
+
details;
|
|
152
|
+
nextRetryDelay;
|
|
153
|
+
category;
|
|
126
154
|
/**
|
|
127
155
|
* Alternatively, use {@link fromError} or {@link create}.
|
|
128
156
|
*/
|
|
129
|
-
constructor(message, type, nonRetryable, details, cause, nextRetryDelay) {
|
|
157
|
+
constructor(message, type, nonRetryable, details, cause, nextRetryDelay, category) {
|
|
130
158
|
super(message, cause);
|
|
131
159
|
this.type = type;
|
|
132
160
|
this.nonRetryable = nonRetryable;
|
|
133
161
|
this.details = details;
|
|
134
162
|
this.nextRetryDelay = nextRetryDelay;
|
|
163
|
+
this.category = category;
|
|
135
164
|
}
|
|
136
165
|
/**
|
|
137
166
|
* Create a new `ApplicationFailure` from an Error object.
|
|
@@ -150,8 +179,8 @@ let ApplicationFailure = class ApplicationFailure extends TemporalFailure {
|
|
|
150
179
|
* By default, will be retryable (unless its `type` is included in {@link RetryPolicy.nonRetryableErrorTypes}).
|
|
151
180
|
*/
|
|
152
181
|
static create(options) {
|
|
153
|
-
const { message, type, nonRetryable = false, details, nextRetryDelay, cause } = options;
|
|
154
|
-
return new this(message, type, nonRetryable, details, cause, nextRetryDelay);
|
|
182
|
+
const { message, type, nonRetryable = false, details, nextRetryDelay, cause, category } = options;
|
|
183
|
+
return new this(message, type, nonRetryable, details, cause, nextRetryDelay, category);
|
|
155
184
|
}
|
|
156
185
|
/**
|
|
157
186
|
* Get a new `ApplicationFailure` with the {@link nonRetryable} flag set to false. Note that this error will still
|
|
@@ -190,6 +219,7 @@ exports.ApplicationFailure = ApplicationFailure = __decorate([
|
|
|
190
219
|
* When a Workflow or Activity has been successfully cancelled, a `CancelledFailure` will be the `cause`.
|
|
191
220
|
*/
|
|
192
221
|
let CancelledFailure = class CancelledFailure extends TemporalFailure {
|
|
222
|
+
details;
|
|
193
223
|
constructor(message, details = [], cause) {
|
|
194
224
|
super(message, cause);
|
|
195
225
|
this.details = details;
|
|
@@ -215,6 +245,8 @@ exports.TerminatedFailure = TerminatedFailure = __decorate([
|
|
|
215
245
|
* Used to represent timeouts of Activities and Workflows
|
|
216
246
|
*/
|
|
217
247
|
let TimeoutFailure = class TimeoutFailure extends TemporalFailure {
|
|
248
|
+
lastHeartbeatDetails;
|
|
249
|
+
timeoutType;
|
|
218
250
|
constructor(message, lastHeartbeatDetails, timeoutType) {
|
|
219
251
|
super(message);
|
|
220
252
|
this.lastHeartbeatDetails = lastHeartbeatDetails;
|
|
@@ -232,6 +264,10 @@ exports.TimeoutFailure = TimeoutFailure = __decorate([
|
|
|
232
264
|
* This exception is expected to be thrown only by the framework code.
|
|
233
265
|
*/
|
|
234
266
|
let ActivityFailure = class ActivityFailure extends TemporalFailure {
|
|
267
|
+
activityType;
|
|
268
|
+
activityId;
|
|
269
|
+
retryState;
|
|
270
|
+
identity;
|
|
235
271
|
constructor(message, activityType, activityId, retryState, identity, cause) {
|
|
236
272
|
super(message, cause);
|
|
237
273
|
this.activityType = activityType;
|
|
@@ -251,6 +287,10 @@ exports.ActivityFailure = ActivityFailure = __decorate([
|
|
|
251
287
|
* This exception is expected to be thrown only by the framework code.
|
|
252
288
|
*/
|
|
253
289
|
let ChildWorkflowFailure = class ChildWorkflowFailure extends TemporalFailure {
|
|
290
|
+
namespace;
|
|
291
|
+
execution;
|
|
292
|
+
workflowType;
|
|
293
|
+
retryState;
|
|
254
294
|
constructor(namespace, execution, workflowType, retryState, cause) {
|
|
255
295
|
super('Child Workflow execution failed', cause);
|
|
256
296
|
this.namespace = namespace;
|
|
@@ -272,6 +312,8 @@ exports.ChildWorkflowFailure = ChildWorkflowFailure = __decorate([
|
|
|
272
312
|
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
|
|
273
313
|
*/
|
|
274
314
|
let WorkflowExecutionAlreadyStartedError = class WorkflowExecutionAlreadyStartedError extends TemporalFailure {
|
|
315
|
+
workflowId;
|
|
316
|
+
workflowType;
|
|
275
317
|
constructor(message, workflowId, workflowType) {
|
|
276
318
|
super(message);
|
|
277
319
|
this.workflowId = workflowId;
|
package/lib/failure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":";;;;;;;;;;AAyZA,4DAUC;AASD,sDAKC;AAQD,8BAKC;AA7bD,iDAAoF;AAEpF,2DAA8D;AAEjD,QAAA,cAAc,GAAG,eAAe,CAAC;AAGjC,QAAA,WAAW,GAAG;IACzB,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,iBAAiB,EAAE,mBAAmB;IACtC,SAAS,EAAE,WAAW;IAEtB,sDAAsD;IACtD,2BAA2B,EAAE,gBAAgB,EAAE,8CAA8C;IAE7F,yDAAyD;IACzD,8BAA8B,EAAE,mBAAmB,EAAE,8CAA8C;IAEnG,yDAAyD;IACzD,8BAA8B,EAAE,mBAAmB,EAAE,8CAA8C;IAEnG,iDAAiD;IACjD,sBAAsB,EAAE,WAAW,EAAE,8CAA8C;IAEnF,2CAA2C;IAC3C,wBAAwB,EAAE,SAAS,EAAE,8CAA8C;CAC3E,CAAC;AAGE,KAAyC,IAAA,2CAAuB,EAO3E;IACE,CAAC,mBAAW,CAAC,cAAc,CAAC,EAAE,CAA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,IAAA,uBAAQ,EAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,IAAI,GAAG,CAAC,IAAA,uBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,SAAS,CAAC;IACvF,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,OAAO,CAAC,KAAK,GAAG,CAAC,IAAA,uBAAQ,EAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,GAAY;IAChD,IAAI,GAAG,YAAY,eAAe,EAAE,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,KAAc;IACtC,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9D,CAAC;IACD,OAAO,IAAA,2BAAY,EAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -15,11 +15,18 @@ export * from './failure';
|
|
|
15
15
|
export { Headers, Next } from './interceptors';
|
|
16
16
|
export * from './interfaces';
|
|
17
17
|
export * from './logger';
|
|
18
|
+
export * from './priority';
|
|
19
|
+
export * from './metrics';
|
|
18
20
|
export * from './retry-policy';
|
|
19
21
|
export type { Timestamp, Duration, StringValue } from './time';
|
|
22
|
+
export * from './worker-deployments';
|
|
23
|
+
export * from './workflow-definition-options';
|
|
20
24
|
export * from './workflow-handle';
|
|
21
25
|
export * from './workflow-options';
|
|
22
26
|
export * from './versioning-intent';
|
|
27
|
+
export { SearchAttributes, // eslint-disable-line deprecation/deprecation
|
|
28
|
+
SearchAttributeValue, // eslint-disable-line deprecation/deprecation
|
|
29
|
+
SearchAttributeType, SearchAttributePair, SearchAttributeUpdatePair, TypedSearchAttributes, defineSearchAttributeKey, } from './search-attributes';
|
|
23
30
|
/**
|
|
24
31
|
* Encode a UTF-8 string into a Uint8Array
|
|
25
32
|
*
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
31
31
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.defineSearchAttributeKey = exports.TypedSearchAttributes = exports.SearchAttributeType = void 0;
|
|
34
35
|
exports.u8 = u8;
|
|
35
36
|
exports.str = str;
|
|
36
37
|
exports.errorMessage = errorMessage;
|
|
@@ -48,10 +49,18 @@ __exportStar(require("./errors"), exports);
|
|
|
48
49
|
__exportStar(require("./failure"), exports);
|
|
49
50
|
__exportStar(require("./interfaces"), exports);
|
|
50
51
|
__exportStar(require("./logger"), exports);
|
|
52
|
+
__exportStar(require("./priority"), exports);
|
|
53
|
+
__exportStar(require("./metrics"), exports);
|
|
51
54
|
__exportStar(require("./retry-policy"), exports);
|
|
55
|
+
__exportStar(require("./worker-deployments"), exports);
|
|
56
|
+
__exportStar(require("./workflow-definition-options"), exports);
|
|
52
57
|
__exportStar(require("./workflow-handle"), exports);
|
|
53
58
|
__exportStar(require("./workflow-options"), exports);
|
|
54
59
|
__exportStar(require("./versioning-intent"), exports);
|
|
60
|
+
var search_attributes_1 = require("./search-attributes");
|
|
61
|
+
Object.defineProperty(exports, "SearchAttributeType", { enumerable: true, get: function () { return search_attributes_1.SearchAttributeType; } });
|
|
62
|
+
Object.defineProperty(exports, "TypedSearchAttributes", { enumerable: true, get: function () { return search_attributes_1.TypedSearchAttributes; } });
|
|
63
|
+
Object.defineProperty(exports, "defineSearchAttributeKey", { enumerable: true, get: function () { return search_attributes_1.defineSearchAttributeKey; } });
|
|
55
64
|
/**
|
|
56
65
|
* Encode a UTF-8 string into a Uint8Array
|
|
57
66
|
*
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CH,gBAEC;AAQD,kBAEC;AAQD,oCAEC;AAQD,8BAEC;AAxED,qDAAuC;AACvC,wDAA0C;AAE1C,qDAAmC;AACnC,6DAA2C;AAC3C,gEAA8C;AAC9C,4DAA0C;AAC1C,gEAA8C;AAC9C,oDAAkC;AAClC,oDAAkC;AAClC,2CAAyB;AACzB,4CAA0B;AAE1B,+CAA6B;AAC7B,2CAAyB;AACzB,6CAA2B;AAC3B,4CAA0B;AAC1B,iDAA+B;AAE/B,uDAAqC;AACrC,gEAA8C;AAC9C,oDAAkC;AAClC,qDAAmC;AACnC,sDAAoC;AACpC,yDAQ6B;AAL3B,wHAAA,mBAAmB,OAAA;AAGnB,0HAAA,qBAAqB,OAAA;AACrB,6HAAA,wBAAwB,OAAA;AAG1B;;;;;GAKG;AACH,SAAgB,EAAE,CAAC,CAAS;IAC1B,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,GAAG,CAAC,GAAe;IACjC,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC"}
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -87,13 +87,6 @@ export interface QueryDefinition<Ret, Args extends any[] = [], Name extends stri
|
|
|
87
87
|
}
|
|
88
88
|
/** Get the "unwrapped" return type (without Promise) of the execute handler from Workflow type `W` */
|
|
89
89
|
export type WorkflowResultType<W extends Workflow> = ReturnType<W> extends Promise<infer R> ? R : never;
|
|
90
|
-
/**
|
|
91
|
-
* If another SDK creates a Search Attribute that's not an array, we wrap it in an array.
|
|
92
|
-
*
|
|
93
|
-
* Dates are serialized as ISO strings.
|
|
94
|
-
*/
|
|
95
|
-
export type SearchAttributes = Record<string, SearchAttributeValue | Readonly<SearchAttributeValue> | undefined>;
|
|
96
|
-
export type SearchAttributeValue = string[] | number[] | boolean[] | Date[];
|
|
97
90
|
export interface ActivityFunction<P extends any[] = any[], R = any> {
|
|
98
91
|
(...args: P): Promise<R>;
|
|
99
92
|
}
|
package/lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AAsHA;;;GAGG;AACU,QAAA,uBAAuB,GAAG;IACrC;;OAEG;IACH,gBAAgB,EAAE,kBAAkB;IAEpC;;;;;OAKG;IACH,OAAO,EAAE,SAAS;CACV,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Payload } from '../interfaces';
|
|
2
2
|
import { PayloadCodec } from '../converter/payload-codec';
|
|
3
|
-
import { ProtoFailure
|
|
3
|
+
import { ProtoFailure } from '../failure';
|
|
4
4
|
import { LoadedDataConverter } from '../converter/data-converter';
|
|
5
5
|
import { DecodedPayload, DecodedProtoFailure, EncodedPayload, EncodedProtoFailure } from './codec-types';
|
|
6
6
|
/**
|
|
@@ -34,7 +34,7 @@ export declare function decodeFromPayloadsAtIndex<T>(converter: LoadedDataConver
|
|
|
34
34
|
/**
|
|
35
35
|
* Run {@link decodeFailure} and then return {@link failureToError}.
|
|
36
36
|
*/
|
|
37
|
-
export declare function decodeOptionalFailureToOptionalError(converter: LoadedDataConverter, failure: ProtoFailure | undefined | null): Promise<
|
|
37
|
+
export declare function decodeOptionalFailureToOptionalError(converter: LoadedDataConverter, failure: ProtoFailure | undefined | null): Promise<Error | undefined>;
|
|
38
38
|
export declare function decodeOptionalMap(codecs: PayloadCodec[], payloads: Record<string, Payload> | null | undefined): Promise<Record<string, DecodedPayload> | null | undefined>;
|
|
39
39
|
/**
|
|
40
40
|
* Run {@link PayloadConverter.toPayload} on values, and then encode them.
|
|
@@ -25,5 +25,4 @@ __exportStar(require("./data-converter-helpers"), exports);
|
|
|
25
25
|
__exportStar(require("./parse-host-uri"), exports);
|
|
26
26
|
__exportStar(require("./proxy-config"), exports);
|
|
27
27
|
__exportStar(require("./tls-config"), exports);
|
|
28
|
-
__exportStar(require("./utils"), exports);
|
|
29
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal-non-workflow/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,kDAAgC;AAChC,gDAA8B;AAC9B,2DAAyC;AACzC,mDAAiC;AACjC,iDAA+B;AAC/B,+CAA6B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal-non-workflow/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,kDAAgC;AAChC,gDAA8B;AAC9B,2DAAyC;AACzC,mDAAiC;AACjC,iDAA+B;AAC/B,+CAA6B"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./enums-helpers"), exports);
|
|
18
|
+
__exportStar(require("./objects-helpers"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal-workflow/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal-workflow/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,oDAAkC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper to prevent `undefined` and `null` values overriding defaults when merging maps.
|
|
3
|
+
*/
|
|
4
|
+
export declare function filterNullAndUndefined<T extends Record<string, any>>(obj: T): T;
|
|
5
|
+
/**
|
|
6
|
+
* Merge two objects, possibly removing keys.
|
|
7
|
+
*
|
|
8
|
+
* More specifically:
|
|
9
|
+
* - Any key/value pair in `delta` overrides the corresponding key/value pair in `original`;
|
|
10
|
+
* - A key present in `delta` with value `undefined` removes the key from the resulting object;
|
|
11
|
+
* - If `original` is `undefined` or empty, return `delta`;
|
|
12
|
+
* - If `delta` is `undefined` or empty, return `original` (or undefined if `original` is also undefined);
|
|
13
|
+
* - If there are no changes, then return `original`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mergeObjects<T extends Record<string, any>>(original: T, delta: T | undefined): T;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterNullAndUndefined = filterNullAndUndefined;
|
|
4
|
+
exports.mergeObjects = mergeObjects;
|
|
5
|
+
/**
|
|
6
|
+
* Helper to prevent `undefined` and `null` values overriding defaults when merging maps.
|
|
7
|
+
*/
|
|
8
|
+
function filterNullAndUndefined(obj) {
|
|
9
|
+
return Object.fromEntries(Object.entries(obj).filter(([_k, v]) => v != null));
|
|
10
|
+
}
|
|
11
|
+
function mergeObjects(original, delta) {
|
|
12
|
+
if (original == null)
|
|
13
|
+
return delta;
|
|
14
|
+
if (delta == null)
|
|
15
|
+
return original;
|
|
16
|
+
const merged = { ...original };
|
|
17
|
+
let changed = false;
|
|
18
|
+
for (const [k, v] of Object.entries(delta)) {
|
|
19
|
+
if (v !== merged[k]) {
|
|
20
|
+
if (v == null)
|
|
21
|
+
delete merged[k];
|
|
22
|
+
else
|
|
23
|
+
merged[k] = v;
|
|
24
|
+
changed = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return changed ? merged : original;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=objects-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects-helpers.js","sourceRoot":"","sources":["../../src/internal-workflow/objects-helpers.ts"],"names":[],"mappings":";;AAGA,wDAEC;AAaD,oCAkBC;AApCD;;GAEG;AACH,SAAgB,sBAAsB,CAAgC,GAAM;IAC1E,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAQ,CAAC;AACvF,CAAC;AAaD,SAAgB,YAAY,CAC1B,QAAuB,EACvB,KAAoB;IAEpB,IAAI,QAAQ,IAAI,IAAI;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,QAAQ,CAAC;IAEnC,MAAM,MAAM,GAAwB,EAAE,GAAG,QAAQ,EAAE,CAAC;IACpD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,IAAI;gBAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;;gBAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAE,MAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5C,CAAC"}
|
package/lib/logger.d.ts
CHANGED
|
@@ -47,3 +47,35 @@ export declare enum SdkComponent {
|
|
|
47
47
|
*/
|
|
48
48
|
core = "core"
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
* @hidden
|
|
53
|
+
*/
|
|
54
|
+
export type LogMetaOrFunc = LogMetadata | (() => LogMetadata);
|
|
55
|
+
/**
|
|
56
|
+
* A logger implementation that adds metadata before delegating calls to a parent logger.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
* @hidden
|
|
60
|
+
*/
|
|
61
|
+
export declare class LoggerWithComposedMetadata implements Logger {
|
|
62
|
+
private readonly parentLogger;
|
|
63
|
+
private readonly contributors;
|
|
64
|
+
/**
|
|
65
|
+
* Return a {@link Logger} that adds metadata before delegating calls to a parent logger.
|
|
66
|
+
*
|
|
67
|
+
* New metadata may either be specified statically as a delta object, or as a function evaluated
|
|
68
|
+
* every time a log is emitted that will return a delta object.
|
|
69
|
+
*
|
|
70
|
+
* Some optimizations are performed to avoid creating unnecessary objects and to keep runtime
|
|
71
|
+
* overhead associated with resolving metadata as low as possible.
|
|
72
|
+
*/
|
|
73
|
+
static compose(logger: Logger, metaOrFunc: LogMetaOrFunc): Logger;
|
|
74
|
+
constructor(parentLogger: Logger, contributors: LogMetaOrFunc[]);
|
|
75
|
+
log(level: LogLevel, message: string, extraMeta?: LogMetadata): void;
|
|
76
|
+
trace(message: string, extraMeta?: LogMetadata): void;
|
|
77
|
+
debug(message: string, extraMeta?: LogMetadata): void;
|
|
78
|
+
info(message: string, extraMeta?: LogMetadata): void;
|
|
79
|
+
warn(message: string, extraMeta?: LogMetadata): void;
|
|
80
|
+
error(message: string, extraMeta?: LogMetadata): void;
|
|
81
|
+
}
|
package/lib/logger.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SdkComponent = void 0;
|
|
3
|
+
exports.LoggerWithComposedMetadata = exports.SdkComponent = void 0;
|
|
4
|
+
const internal_workflow_1 = require("./internal-workflow");
|
|
4
5
|
/**
|
|
5
6
|
* Possible values of the `sdkComponent` meta attributes on log messages. This
|
|
6
7
|
* attribute indicates which subsystem emitted the log message; this may for
|
|
@@ -38,4 +39,93 @@ var SdkComponent;
|
|
|
38
39
|
*/
|
|
39
40
|
SdkComponent["core"] = "core";
|
|
40
41
|
})(SdkComponent || (exports.SdkComponent = SdkComponent = {}));
|
|
42
|
+
/**
|
|
43
|
+
* A logger implementation that adds metadata before delegating calls to a parent logger.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
class LoggerWithComposedMetadata {
|
|
49
|
+
parentLogger;
|
|
50
|
+
contributors;
|
|
51
|
+
/**
|
|
52
|
+
* Return a {@link Logger} that adds metadata before delegating calls to a parent logger.
|
|
53
|
+
*
|
|
54
|
+
* New metadata may either be specified statically as a delta object, or as a function evaluated
|
|
55
|
+
* every time a log is emitted that will return a delta object.
|
|
56
|
+
*
|
|
57
|
+
* Some optimizations are performed to avoid creating unnecessary objects and to keep runtime
|
|
58
|
+
* overhead associated with resolving metadata as low as possible.
|
|
59
|
+
*/
|
|
60
|
+
static compose(logger, metaOrFunc) {
|
|
61
|
+
// Flatten recursive LoggerWithComposedMetadata instances
|
|
62
|
+
if (logger instanceof LoggerWithComposedMetadata) {
|
|
63
|
+
const contributors = appendToChain(logger.contributors, metaOrFunc);
|
|
64
|
+
// If the new contributor results in no actual change to the chain, then we don't need a new logger
|
|
65
|
+
if (contributors === undefined)
|
|
66
|
+
return logger;
|
|
67
|
+
return new LoggerWithComposedMetadata(logger.parentLogger, contributors);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const contributors = appendToChain(undefined, metaOrFunc);
|
|
71
|
+
if (contributors === undefined)
|
|
72
|
+
return logger;
|
|
73
|
+
return new LoggerWithComposedMetadata(logger, contributors);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
constructor(parentLogger, contributors) {
|
|
77
|
+
this.parentLogger = parentLogger;
|
|
78
|
+
this.contributors = contributors;
|
|
79
|
+
}
|
|
80
|
+
log(level, message, extraMeta) {
|
|
81
|
+
this.parentLogger.log(level, message, resolveMetadata(this.contributors, extraMeta));
|
|
82
|
+
}
|
|
83
|
+
trace(message, extraMeta) {
|
|
84
|
+
this.parentLogger.trace(message, resolveMetadata(this.contributors, extraMeta));
|
|
85
|
+
}
|
|
86
|
+
debug(message, extraMeta) {
|
|
87
|
+
this.parentLogger.debug(message, resolveMetadata(this.contributors, extraMeta));
|
|
88
|
+
}
|
|
89
|
+
info(message, extraMeta) {
|
|
90
|
+
this.parentLogger.info(message, resolveMetadata(this.contributors, extraMeta));
|
|
91
|
+
}
|
|
92
|
+
warn(message, extraMeta) {
|
|
93
|
+
this.parentLogger.warn(message, resolveMetadata(this.contributors, extraMeta));
|
|
94
|
+
}
|
|
95
|
+
error(message, extraMeta) {
|
|
96
|
+
this.parentLogger.error(message, resolveMetadata(this.contributors, extraMeta));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.LoggerWithComposedMetadata = LoggerWithComposedMetadata;
|
|
100
|
+
function resolveMetadata(contributors, extraMeta) {
|
|
101
|
+
const resolved = {};
|
|
102
|
+
for (const contributor of contributors) {
|
|
103
|
+
Object.assign(resolved, typeof contributor === 'function' ? contributor() : contributor);
|
|
104
|
+
}
|
|
105
|
+
Object.assign(resolved, extraMeta);
|
|
106
|
+
return (0, internal_workflow_1.filterNullAndUndefined)(resolved);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Append a metadata contributor to the chain, merging it with the former last contributor if both are plain objects
|
|
110
|
+
*/
|
|
111
|
+
function appendToChain(existingContributors, newContributor) {
|
|
112
|
+
// If the new contributor is an empty object, then it results in no actual change to the chain
|
|
113
|
+
if (typeof newContributor === 'object' && Object.keys(newContributor).length === 0) {
|
|
114
|
+
return existingContributors;
|
|
115
|
+
}
|
|
116
|
+
// If existing chain is empty, then the new contributor is the chain
|
|
117
|
+
if (existingContributors == null || existingContributors.length === 0) {
|
|
118
|
+
return [newContributor];
|
|
119
|
+
}
|
|
120
|
+
// If both last contributor and new contributor are plain objects, merge them to a single object.
|
|
121
|
+
const last = existingContributors[existingContributors.length - 1];
|
|
122
|
+
if (typeof last === 'object' && typeof newContributor === 'object') {
|
|
123
|
+
const merged = (0, internal_workflow_1.mergeObjects)(last, newContributor);
|
|
124
|
+
if (merged === last)
|
|
125
|
+
return existingContributors;
|
|
126
|
+
return [...existingContributors.slice(0, -1), merged];
|
|
127
|
+
}
|
|
128
|
+
// Otherwise, just append the new contributor to the chain.
|
|
129
|
+
return [...existingContributors, newContributor];
|
|
130
|
+
}
|
|
41
131
|
//# sourceMappingURL=logger.js.map
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":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