@temporalio/common 0.23.0 → 1.0.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.
Files changed (59) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -3
  3. package/lib/converter/data-converter.d.ts +5 -5
  4. package/lib/converter/data-converter.js +1 -2
  5. package/lib/converter/data-converter.js.map +1 -1
  6. package/lib/converter/json-payload-converter.d.ts +10 -0
  7. package/lib/converter/json-payload-converter.js +39 -0
  8. package/lib/converter/json-payload-converter.js.map +1 -0
  9. package/lib/converter/payload-converter.d.ts +11 -15
  10. package/lib/converter/payload-converter.js +5 -14
  11. package/lib/converter/payload-converter.js.map +1 -1
  12. package/lib/converter/payload-converters.d.ts +19 -15
  13. package/lib/converter/payload-converters.js +10 -41
  14. package/lib/converter/payload-converters.js.map +1 -1
  15. package/lib/converter/protobuf-payload-converters.js +2 -1
  16. package/lib/converter/protobuf-payload-converters.js.map +1 -1
  17. package/lib/converter/search-attribute-payload-converter.d.ts +12 -0
  18. package/lib/converter/search-attribute-payload-converter.js +64 -0
  19. package/lib/converter/search-attribute-payload-converter.js.map +1 -0
  20. package/lib/converter/types.d.ts +1 -2
  21. package/lib/converter/types.js.map +1 -1
  22. package/lib/failure.d.ts +58 -46
  23. package/lib/failure.js +85 -56
  24. package/lib/failure.js.map +1 -1
  25. package/lib/index.d.ts +1 -0
  26. package/lib/index.js +1 -0
  27. package/lib/index.js.map +1 -1
  28. package/lib/otel.d.ts +26 -0
  29. package/lib/otel.js +87 -0
  30. package/lib/otel.js.map +1 -0
  31. package/lib/proto-utils.d.ts +28 -0
  32. package/lib/proto-utils.js +85 -0
  33. package/lib/proto-utils.js.map +1 -0
  34. package/lib/protobufs.d.ts +2 -2
  35. package/lib/protobufs.js +4 -2
  36. package/lib/protobufs.js.map +1 -1
  37. package/package.json +12 -9
  38. package/src/converter/data-converter.ts +6 -6
  39. package/src/converter/json-payload-converter.ts +37 -0
  40. package/src/converter/payload-converter.ts +15 -29
  41. package/src/converter/payload-converters.ts +24 -43
  42. package/src/converter/protobuf-payload-converters.ts +1 -1
  43. package/src/converter/search-attribute-payload-converter.ts +71 -0
  44. package/src/converter/types.ts +1 -2
  45. package/src/failure.ts +92 -62
  46. package/src/index.ts +1 -0
  47. package/src/otel.ts +63 -0
  48. package/src/proto-utils.ts +103 -0
  49. package/src/protobufs.ts +2 -2
  50. package/lib/converter/patch-protobuf-root.d.ts +0 -1
  51. package/lib/converter/patch-protobuf-root.js +0 -6
  52. package/lib/converter/patch-protobuf-root.js.map +0 -1
  53. package/lib/converter/wrapped-payload-converter.d.ts +0 -12
  54. package/lib/converter/wrapped-payload-converter.js +0 -28
  55. package/lib/converter/wrapped-payload-converter.js.map +0 -1
  56. package/src/converter/patch-protobuf-root.ts +0 -1
  57. package/src/converter/wrapped-payload-converter.ts +0 -31
  58. package/tsconfig.json +0 -9
  59. package/tsconfig.tsbuildinfo +0 -1
package/lib/failure.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { temporal } from '@temporalio/proto';
2
- import { WrappedPayloadConverter } from './converter/wrapped-payload-converter';
2
+ import { PayloadConverter } from './converter/payload-converter';
3
3
  export declare const FAILURE_SOURCE = "TypeScriptSDK";
4
4
  export declare type ProtoFailure = temporal.api.failure.v1.IFailure;
5
5
  export declare enum TimeoutType {
@@ -50,27 +50,28 @@ export declare class ServerFailure extends TemporalFailure {
50
50
  constructor(message: string | undefined, nonRetryable: boolean, cause?: Error);
51
51
  }
52
52
  /**
53
- * Application failure is used to communicate application specific failures between Workflows and
54
- * Activities.
53
+ * `ApplicationFailure`s are used to communicate application-specific failures in Workflows and Activities.
55
54
  *
56
- * Throw this exception to have full control over type and details if the exception delivered to
57
- * the caller workflow or client.
55
+ * The {@link type} property is matched against {@link RetryPolicy.nonRetryableErrorTypes} to determine if an instance
56
+ * of this error is retryable. Another way to avoid retrying is by setting the {@link nonRetryable} flag to `true`.
58
57
  *
59
- * Any unhandled exception which doesn't extend {@link TemporalFailure} is converted to an
60
- * instance of this class before being returned to a caller.
58
+ * In Workflows, if you throw a non-`ApplicationFailure`, the Workflow Task will fail and be retried. If you throw an
59
+ * `ApplicationFailure`, the Workflow Execution will fail.
61
60
  *
62
- * The {@link type} property is used by {@link temporal.common.RetryOptions} to determine if
63
- * an instance of this exception is non retryable. Another way to avoid retrying an exception of
64
- * this type is by setting {@link nonRetryable} flag to `true`.
61
+ * In Activities, you can either throw an `ApplicationFailure` or another `Error` to fail the Activity Task. In the
62
+ * latter case, the `Error` will be converted to an `ApplicationFailure`. If the
63
+ * {@link https://docs.temporal.io/concepts/what-is-an-activity-execution | Activity Execution} fails, the
64
+ * `ApplicationFailure` from the last Activity Task will be the `cause` of the {@link ActivityFailure} thrown in the
65
+ * Workflow.
65
66
  *
66
- * The conversion of an exception that doesn't extend {@link TemporalFailure} to an
67
- * ApplicationFailure is done as following:
67
+ * The conversion of an error that doesn't extend {@link TemporalFailure} to an `ApplicationFailure` is done as
68
+ * following:
68
69
  *
69
- * - type is set to the exception full type name.
70
- * - message is set to the exception message
71
- * - nonRetryable is set to false
72
- * - details are set to null
73
- * - stack trace is copied from the original exception
70
+ * - `type` is set to `error.constructor?.name ?? error.name`
71
+ * - `message` is set to `error.message`
72
+ * - `nonRetryable` is set to false
73
+ * - `details` are set to null
74
+ * - stack trace is copied from the original error
74
75
  */
75
76
  export declare class ApplicationFailure extends TemporalFailure {
76
77
  readonly type: string | undefined | null;
@@ -79,31 +80,32 @@ export declare class ApplicationFailure extends TemporalFailure {
79
80
  readonly name: string;
80
81
  constructor(message: string | undefined, type: string | undefined | null, nonRetryable: boolean, details?: unknown[] | undefined, cause?: Error);
81
82
  /**
82
- * New ApplicationFailure with {@link nonRetryable} flag set to false. Note that this
83
- * exception still can be not retried by the service if its type is included into doNotRetry
84
- * property of the correspondent retry policy.
83
+ * Get a new `ApplicationFailure` with the {@link nonRetryable} flag set to false. Note that this error will still
84
+ * not be retried if its `type` is included in {@link RetryPolicy.nonRetryableErrorTypes}.
85
85
  *
86
- * @param message optional error message
87
- * @param type optional error type that is used by {@link RetryOptions.nonRetryableErrorTypes}.
88
- * @param details optional details about the failure. They are serialized using the same approach
89
- * as arguments and results.
86
+ * @param message Optional error message
87
+ * @param type Optional error type (used by {@link RetryPolicy.nonRetryableErrorTypes})
88
+ * @param details Optional details about the failure. Serialized by the Worker's {@link PayloadConverter}.
90
89
  */
91
90
  static retryable(message: string | undefined, type?: string, ...details: unknown[]): ApplicationFailure;
92
91
  /**
93
- * New ApplicationFailure with {@link nonRetryable} flag set to true.
92
+ * Get a new `ApplicationFailure` with the {@link nonRetryable} flag set to true.
94
93
  *
95
- * It means that this exception is not going to be retried even if it is not included into
96
- * retry policy doNotRetry list.
94
+ * When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if `type` is not
95
+ * listed in {@link RetryPolicy.nonRetryableErrorTypes}).
97
96
  *
98
- * @param message optional error message
99
- * @param type optional error type
100
- * @param details optional details about the failure. They are serialized using the same approach
101
- * as arguments and results.
97
+ * @param message Optional error message
98
+ * @param type Optional error type
99
+ * @param details Optional details about the failure. Serialized by the Worker's {@link PayloadConverter}.
102
100
  */
103
101
  static nonRetryable(message: string | undefined, type?: string, ...details: unknown[]): ApplicationFailure;
104
102
  }
105
103
  /**
106
- * Used as the cause for when a Workflow or Activity has been cancelled
104
+ * This error is thrown when Cancellation has been requested. To allow Cancellation to happen, let it propagate. To
105
+ * ignore Cancellation, catch it and continue executing. Note that Cancellation can only be requested a single time, so
106
+ * your Workflow/Activity Execution will not receive further Cancellation requests.
107
+ *
108
+ * When a Workflow or Activity has been successfully cancelled, a `CancelledFailure` will be the `cause`.
107
109
  */
108
110
  export declare class CancelledFailure extends TemporalFailure {
109
111
  readonly details: unknown[];
@@ -111,7 +113,7 @@ export declare class CancelledFailure extends TemporalFailure {
111
113
  constructor(message: string | undefined, details?: unknown[], cause?: Error);
112
114
  }
113
115
  /**
114
- * Used as the cause for when a Workflow has been terminated
116
+ * Used as the `cause` when a Workflow has been terminated
115
117
  */
116
118
  export declare class TerminatedFailure extends TemporalFailure {
117
119
  readonly name: string;
@@ -127,8 +129,8 @@ export declare class TimeoutFailure extends TemporalFailure {
127
129
  constructor(message: string | undefined, lastHeartbeatDetails: unknown, timeoutType: TimeoutType);
128
130
  }
129
131
  /**
130
- * Contains information about an activity failure. Always contains the original reason for the
131
- * failure as its cause. For example if an activity timed out the cause is {@link TimeoutFailure}.
132
+ * Contains information about an Activity failure. Always contains the original reason for the failure as its `cause`.
133
+ * For example, if an Activity timed out, the cause will be a {@link TimeoutFailure}.
132
134
  *
133
135
  * This exception is expected to be thrown only by the framework code.
134
136
  */
@@ -137,11 +139,12 @@ export declare class ActivityFailure extends TemporalFailure {
137
139
  readonly activityId: string | undefined;
138
140
  readonly retryState: RetryState;
139
141
  readonly identity: string | undefined;
142
+ readonly name: string;
140
143
  constructor(activityType: string, activityId: string | undefined, retryState: RetryState, identity: string | undefined, cause?: Error);
141
144
  }
142
145
  /**
143
- * Contains information about an child workflow failure. Always contains the original reason for the
144
- * failure as its cause. For example if a child workflow was terminated the cause is {@link TerminatedFailure}.
146
+ * Contains information about a Child Workflow failure. Always contains the reason for the failure as its {@link cause}.
147
+ * For example, if the Child was Terminated, the `cause` is a {@link TerminatedFailure}.
145
148
  *
146
149
  * This exception is expected to be thrown only by the framework code.
147
150
  */
@@ -150,12 +153,13 @@ export declare class ChildWorkflowFailure extends TemporalFailure {
150
153
  readonly execution: WorkflowExecution;
151
154
  readonly workflowType: string;
152
155
  readonly retryState: RetryState;
156
+ readonly name: string;
153
157
  constructor(namespace: string | undefined, execution: WorkflowExecution, workflowType: string, retryState: RetryState, cause?: Error);
154
158
  }
155
159
  /**
156
160
  * Converts an error to a Failure proto message if defined or returns undefined
157
161
  */
158
- export declare function optionalErrorToOptionalFailure(err: unknown, payloadConverter: WrappedPayloadConverter): ProtoFailure | undefined;
162
+ export declare function optionalErrorToOptionalFailure(err: unknown, payloadConverter: PayloadConverter): ProtoFailure | undefined;
159
163
  /**
160
164
  * Cuts out the framework part of a stack trace, leaving only user code entries
161
165
  */
@@ -163,7 +167,15 @@ export declare function cutoffStackTrace(stack?: string): string;
163
167
  /**
164
168
  * Converts a caught error to a Failure proto message
165
169
  */
166
- export declare function errorToFailure(err: unknown, payloadConverter: WrappedPayloadConverter): ProtoFailure;
170
+ export declare function errorToFailure(err: unknown, payloadConverter: PayloadConverter): ProtoFailure;
171
+ /**
172
+ * If `err` is an Error it is turned into an `ApplicationFailure`.
173
+ *
174
+ * If `err` was already a `ApplicationFailure`, returns the original error.
175
+ *
176
+ * Otherwise returns an `ApplicationFailure` with `String(err)` as the message.
177
+ */
178
+ export declare function ensureApplicationFailure(err: unknown): ApplicationFailure;
167
179
  /**
168
180
  * If `err` is an Error it is turned into an `ApplicationFailure`.
169
181
  *
@@ -175,21 +187,21 @@ export declare function ensureTemporalFailure(err: unknown): TemporalFailure;
175
187
  /**
176
188
  * Converts a Failure proto message to a JS Error object if defined or returns undefined.
177
189
  */
178
- export declare function optionalFailureToOptionalError(failure: ProtoFailure | undefined | null, payloadConverter: WrappedPayloadConverter): TemporalFailure | undefined;
190
+ export declare function optionalFailureToOptionalError(failure: ProtoFailure | undefined | null, payloadConverter: PayloadConverter): TemporalFailure | undefined;
179
191
  /**
180
192
  * Converts a Failure proto message to a JS Error object.
181
193
  *
182
194
  * Does not set common properties, that is done in {@link failureToError}.
183
195
  */
184
- export declare function failureToErrorInner(failure: ProtoFailure, payloadConverter: WrappedPayloadConverter): TemporalFailure;
196
+ export declare function failureToErrorInner(failure: ProtoFailure, payloadConverter: PayloadConverter): TemporalFailure;
185
197
  /**
186
198
  * Converts a Failure proto message to a JS Error object.
187
199
  */
188
- export declare function failureToError(failure: ProtoFailure, payloadConverter: WrappedPayloadConverter): TemporalFailure;
200
+ export declare function failureToError(failure: ProtoFailure, payloadConverter: PayloadConverter): TemporalFailure;
189
201
  /**
190
- * Get the root cause (string) of given error `err`.
202
+ * Get the root cause message of given `error`.
191
203
  *
192
- * In case `err` is a {@link TemporalFailure}, recurse the cause chain and return the root's message.
193
- * Otherwise, return `err.message`.
204
+ * In case `error` is a {@link TemporalFailure}, recurse the `cause` chain and return the root `cause.message`.
205
+ * Otherwise, return `error.message`.
194
206
  */
195
- export declare function rootCause(err: unknown): string | undefined;
207
+ export declare function rootCause(error: unknown): string | undefined;
package/lib/failure.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rootCause = exports.failureToError = exports.failureToErrorInner = exports.optionalFailureToOptionalError = exports.ensureTemporalFailure = exports.errorToFailure = exports.cutoffStackTrace = exports.optionalErrorToOptionalFailure = exports.ChildWorkflowFailure = exports.ActivityFailure = exports.TimeoutFailure = exports.TerminatedFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ServerFailure = exports.TemporalFailure = exports.RetryState = exports.TimeoutType = exports.FAILURE_SOURCE = void 0;
3
+ exports.rootCause = exports.failureToError = exports.failureToErrorInner = exports.optionalFailureToOptionalError = exports.ensureTemporalFailure = exports.ensureApplicationFailure = exports.errorToFailure = exports.cutoffStackTrace = exports.optionalErrorToOptionalFailure = exports.ChildWorkflowFailure = exports.ActivityFailure = exports.TimeoutFailure = exports.TerminatedFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ServerFailure = exports.TemporalFailure = exports.RetryState = exports.TimeoutType = exports.FAILURE_SOURCE = void 0;
4
4
  const internal_workflow_common_1 = require("@temporalio/internal-workflow-common");
5
5
  const payload_converter_1 = require("./converter/payload-converter");
6
6
  exports.FAILURE_SOURCE = 'TypeScriptSDK';
@@ -59,27 +59,28 @@ class ServerFailure extends TemporalFailure {
59
59
  }
60
60
  exports.ServerFailure = ServerFailure;
61
61
  /**
62
- * Application failure is used to communicate application specific failures between Workflows and
63
- * Activities.
62
+ * `ApplicationFailure`s are used to communicate application-specific failures in Workflows and Activities.
64
63
  *
65
- * Throw this exception to have full control over type and details if the exception delivered to
66
- * the caller workflow or client.
64
+ * The {@link type} property is matched against {@link RetryPolicy.nonRetryableErrorTypes} to determine if an instance
65
+ * of this error is retryable. Another way to avoid retrying is by setting the {@link nonRetryable} flag to `true`.
67
66
  *
68
- * Any unhandled exception which doesn't extend {@link TemporalFailure} is converted to an
69
- * instance of this class before being returned to a caller.
67
+ * In Workflows, if you throw a non-`ApplicationFailure`, the Workflow Task will fail and be retried. If you throw an
68
+ * `ApplicationFailure`, the Workflow Execution will fail.
70
69
  *
71
- * The {@link type} property is used by {@link temporal.common.RetryOptions} to determine if
72
- * an instance of this exception is non retryable. Another way to avoid retrying an exception of
73
- * this type is by setting {@link nonRetryable} flag to `true`.
70
+ * In Activities, you can either throw an `ApplicationFailure` or another `Error` to fail the Activity Task. In the
71
+ * latter case, the `Error` will be converted to an `ApplicationFailure`. If the
72
+ * {@link https://docs.temporal.io/concepts/what-is-an-activity-execution | Activity Execution} fails, the
73
+ * `ApplicationFailure` from the last Activity Task will be the `cause` of the {@link ActivityFailure} thrown in the
74
+ * Workflow.
74
75
  *
75
- * The conversion of an exception that doesn't extend {@link TemporalFailure} to an
76
- * ApplicationFailure is done as following:
76
+ * The conversion of an error that doesn't extend {@link TemporalFailure} to an `ApplicationFailure` is done as
77
+ * following:
77
78
  *
78
- * - type is set to the exception full type name.
79
- * - message is set to the exception message
80
- * - nonRetryable is set to false
81
- * - details are set to null
82
- * - stack trace is copied from the original exception
79
+ * - `type` is set to `error.constructor?.name ?? error.name`
80
+ * - `message` is set to `error.message`
81
+ * - `nonRetryable` is set to false
82
+ * - `details` are set to null
83
+ * - stack trace is copied from the original error
83
84
  */
84
85
  class ApplicationFailure extends TemporalFailure {
85
86
  constructor(message, type, nonRetryable, details, cause) {
@@ -90,28 +91,25 @@ class ApplicationFailure extends TemporalFailure {
90
91
  this.name = 'ApplicationFailure';
91
92
  }
92
93
  /**
93
- * New ApplicationFailure with {@link nonRetryable} flag set to false. Note that this
94
- * exception still can be not retried by the service if its type is included into doNotRetry
95
- * property of the correspondent retry policy.
94
+ * Get a new `ApplicationFailure` with the {@link nonRetryable} flag set to false. Note that this error will still
95
+ * not be retried if its `type` is included in {@link RetryPolicy.nonRetryableErrorTypes}.
96
96
  *
97
- * @param message optional error message
98
- * @param type optional error type that is used by {@link RetryOptions.nonRetryableErrorTypes}.
99
- * @param details optional details about the failure. They are serialized using the same approach
100
- * as arguments and results.
97
+ * @param message Optional error message
98
+ * @param type Optional error type (used by {@link RetryPolicy.nonRetryableErrorTypes})
99
+ * @param details Optional details about the failure. Serialized by the Worker's {@link PayloadConverter}.
101
100
  */
102
101
  static retryable(message, type, ...details) {
103
102
  return new this(message, type ?? 'Error', false, details);
104
103
  }
105
104
  /**
106
- * New ApplicationFailure with {@link nonRetryable} flag set to true.
105
+ * Get a new `ApplicationFailure` with the {@link nonRetryable} flag set to true.
107
106
  *
108
- * It means that this exception is not going to be retried even if it is not included into
109
- * retry policy doNotRetry list.
107
+ * When thrown from an Activity or Workflow, the Activity or Workflow will not be retried (even if `type` is not
108
+ * listed in {@link RetryPolicy.nonRetryableErrorTypes}).
110
109
  *
111
- * @param message optional error message
112
- * @param type optional error type
113
- * @param details optional details about the failure. They are serialized using the same approach
114
- * as arguments and results.
110
+ * @param message Optional error message
111
+ * @param type Optional error type
112
+ * @param details Optional details about the failure. Serialized by the Worker's {@link PayloadConverter}.
115
113
  */
116
114
  static nonRetryable(message, type, ...details) {
117
115
  return new this(message, type ?? 'Error', true, details);
@@ -119,7 +117,11 @@ class ApplicationFailure extends TemporalFailure {
119
117
  }
120
118
  exports.ApplicationFailure = ApplicationFailure;
121
119
  /**
122
- * Used as the cause for when a Workflow or Activity has been cancelled
120
+ * This error is thrown when Cancellation has been requested. To allow Cancellation to happen, let it propagate. To
121
+ * ignore Cancellation, catch it and continue executing. Note that Cancellation can only be requested a single time, so
122
+ * your Workflow/Activity Execution will not receive further Cancellation requests.
123
+ *
124
+ * When a Workflow or Activity has been successfully cancelled, a `CancelledFailure` will be the `cause`.
123
125
  */
124
126
  class CancelledFailure extends TemporalFailure {
125
127
  constructor(message, details = [], cause) {
@@ -130,7 +132,7 @@ class CancelledFailure extends TemporalFailure {
130
132
  }
131
133
  exports.CancelledFailure = CancelledFailure;
132
134
  /**
133
- * Used as the cause for when a Workflow has been terminated
135
+ * Used as the `cause` when a Workflow has been terminated
134
136
  */
135
137
  class TerminatedFailure extends TemporalFailure {
136
138
  constructor(message, cause) {
@@ -152,8 +154,8 @@ class TimeoutFailure extends TemporalFailure {
152
154
  }
153
155
  exports.TimeoutFailure = TimeoutFailure;
154
156
  /**
155
- * Contains information about an activity failure. Always contains the original reason for the
156
- * failure as its cause. For example if an activity timed out the cause is {@link TimeoutFailure}.
157
+ * Contains information about an Activity failure. Always contains the original reason for the failure as its `cause`.
158
+ * For example, if an Activity timed out, the cause will be a {@link TimeoutFailure}.
157
159
  *
158
160
  * This exception is expected to be thrown only by the framework code.
159
161
  */
@@ -164,12 +166,13 @@ class ActivityFailure extends TemporalFailure {
164
166
  this.activityId = activityId;
165
167
  this.retryState = retryState;
166
168
  this.identity = identity;
169
+ this.name = 'ActivityFailure';
167
170
  }
168
171
  }
169
172
  exports.ActivityFailure = ActivityFailure;
170
173
  /**
171
- * Contains information about an child workflow failure. Always contains the original reason for the
172
- * failure as its cause. For example if a child workflow was terminated the cause is {@link TerminatedFailure}.
174
+ * Contains information about a Child Workflow failure. Always contains the reason for the failure as its {@link cause}.
175
+ * For example, if the Child was Terminated, the `cause` is a {@link TerminatedFailure}.
173
176
  *
174
177
  * This exception is expected to be thrown only by the framework code.
175
178
  */
@@ -180,6 +183,7 @@ class ChildWorkflowFailure extends TemporalFailure {
180
183
  this.execution = execution;
181
184
  this.workflowType = workflowType;
182
185
  this.retryState = retryState;
186
+ this.name = 'ChildWorkflowFailure';
183
187
  }
184
188
  }
185
189
  exports.ChildWorkflowFailure = ChildWorkflowFailure;
@@ -197,9 +201,9 @@ const CUTOFF_STACK_PATTERNS = [
197
201
  /** Activity execution */
198
202
  /\s+at Activity\.execute \(.*[\\/]worker[\\/](?:src|lib)[\\/]activity\.[jt]s:\d+:\d+\)/,
199
203
  /** Workflow activation */
200
- /\s+at Activator\.\S+NextHandler \(webpack-internal:\/\/\/.*\/internals\.[jt]s:\d+:\d+\)/,
204
+ /\s+at Activator\.\S+NextHandler \(.*[\\/]workflow[\\/](?:src|lib)[\\/]internals\.[jt]s:\d+:\d+\)/,
201
205
  /** Workflow run anything in context */
202
- /\s+at Script\.runInContext/,
206
+ /\s+at Script\.runInContext \((?:node:vm|vm\.js):\d+:\d+\)/,
203
207
  ];
204
208
  /**
205
209
  * Cuts out the framework part of a stack trace, leaving only user code entries
@@ -304,26 +308,37 @@ function errorToFailure(err, payloadConverter) {
304
308
  cause: optionalErrorToOptionalFailure(err.cause, payloadConverter),
305
309
  };
306
310
  }
307
- const recommendation = ` [A non-Error value was thrown from your code. We recommend throwing Error objects so that we can provide a stack trace.]`;
311
+ const recommendation = ` [A non-Error value was thrown from your code. We recommend throwing Error objects so that we can provide a stack trace]`;
308
312
  if (typeof err === 'string') {
309
313
  return { ...base, message: err + recommendation };
310
314
  }
311
- return { ...base, message: JSON.stringify(err) + recommendation };
315
+ if (typeof err === 'object') {
316
+ let message = '';
317
+ try {
318
+ message = JSON.stringify(err);
319
+ }
320
+ catch (_err) {
321
+ message = String(err);
322
+ }
323
+ return { ...base, message: message + recommendation };
324
+ }
325
+ return { ...base, message: String(err) + recommendation };
312
326
  }
313
327
  exports.errorToFailure = errorToFailure;
314
328
  /**
315
329
  * If `err` is an Error it is turned into an `ApplicationFailure`.
316
330
  *
317
- * If `err` was already a `TemporalFailure`, returns the original error.
331
+ * If `err` was already a `ApplicationFailure`, returns the original error.
318
332
  *
319
333
  * Otherwise returns an `ApplicationFailure` with `String(err)` as the message.
320
334
  */
321
- function ensureTemporalFailure(err) {
322
- if (err instanceof TemporalFailure) {
335
+ function ensureApplicationFailure(err) {
336
+ if (err instanceof ApplicationFailure) {
323
337
  return err;
324
338
  }
325
- else if (err instanceof Error) {
326
- const failure = new ApplicationFailure(err.message, err.name, false);
339
+ if (err instanceof Error) {
340
+ const name = err.constructor?.name ?? err.name;
341
+ const failure = new ApplicationFailure(err.message, name, false);
327
342
  failure.stack = err.stack;
328
343
  return failure;
329
344
  }
@@ -333,6 +348,20 @@ function ensureTemporalFailure(err) {
333
348
  return failure;
334
349
  }
335
350
  }
351
+ exports.ensureApplicationFailure = ensureApplicationFailure;
352
+ /**
353
+ * If `err` is an Error it is turned into an `ApplicationFailure`.
354
+ *
355
+ * If `err` was already a `TemporalFailure`, returns the original error.
356
+ *
357
+ * Otherwise returns an `ApplicationFailure` with `String(err)` as the message.
358
+ */
359
+ function ensureTemporalFailure(err) {
360
+ if (err instanceof TemporalFailure) {
361
+ return err;
362
+ }
363
+ return ensureApplicationFailure(err);
364
+ }
336
365
  exports.ensureTemporalFailure = ensureTemporalFailure;
337
366
  /**
338
367
  * Converts a Failure proto message to a JS Error object if defined or returns undefined.
@@ -392,20 +421,20 @@ function failureToError(failure, payloadConverter) {
392
421
  }
393
422
  exports.failureToError = failureToError;
394
423
  /**
395
- * Get the root cause (string) of given error `err`.
424
+ * Get the root cause message of given `error`.
396
425
  *
397
- * In case `err` is a {@link TemporalFailure}, recurse the cause chain and return the root's message.
398
- * Otherwise, return `err.message`.
426
+ * In case `error` is a {@link TemporalFailure}, recurse the `cause` chain and return the root `cause.message`.
427
+ * Otherwise, return `error.message`.
399
428
  */
400
- function rootCause(err) {
401
- if (err instanceof TemporalFailure) {
402
- return err.cause ? rootCause(err.cause) : err.message;
429
+ function rootCause(error) {
430
+ if (error instanceof TemporalFailure) {
431
+ return error.cause ? rootCause(error.cause) : error.message;
403
432
  }
404
- if (err instanceof Error) {
405
- return err.message;
433
+ if (error instanceof Error) {
434
+ return error.message;
406
435
  }
407
- if (typeof err === 'string') {
408
- return err;
436
+ if (typeof error === 'string') {
437
+ return error;
409
438
  }
410
439
  return undefined;
411
440
  }
@@ -1 +1 @@
1
- {"version":3,"file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E,gBAAgB,CAAC,CAChE,CAAC;KACH;IACD,OAAO,IAAI,eAAe,CACxB,OAAO,CAAC,OAAO,IAAI,SAAS,EAC5B,8BAA8B,CAAC,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAChE,CAAC;AACJ,CAAC;AA3ED,kDA2EC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,OAAqB,EAAE,gBAAkC;IACtF,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAC3D,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;IACrC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IACtB,OAAO,GAAG,CAAC;AACb,CAAC;AALD,wCAKC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,KAAc;IACtC,IAAI,KAAK,YAAY,eAAe,EAAE;QACpC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;KAC7D;IACD,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,OAAO,KAAK,CAAC,OAAO,CAAC;KACtB;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAXD,8BAWC"}
package/lib/index.d.ts CHANGED
@@ -13,5 +13,6 @@ export * from './converter/data-converter';
13
13
  export * from './converter/payload-codec';
14
14
  export * from './converter/payload-converter';
15
15
  export * from './converter/payload-converters';
16
+ export * from './converter/json-payload-converter';
16
17
  export * from './converter/types';
17
18
  export * from './failure';
package/lib/index.js CHANGED
@@ -23,6 +23,7 @@ __exportStar(require("./converter/data-converter"), exports);
23
23
  __exportStar(require("./converter/payload-codec"), exports);
24
24
  __exportStar(require("./converter/payload-converter"), exports);
25
25
  __exportStar(require("./converter/payload-converters"), exports);
26
+ __exportStar(require("./converter/json-payload-converter"), exports);
26
27
  __exportStar(require("./converter/types"), exports);
27
28
  __exportStar(require("./failure"), exports);
28
29
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAMA,4FAA0E;AAC1E,kFAAgE;AAChE,sFAAoE;AACpE,gFAA8D;AAC9D,4FAA0E;AAC1E,6DAA2C;AAC3C,4DAA0C;AAC1C,gEAA8C;AAC9C,iEAA+C;AAC/C,oDAAkC;AAClC,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAMA,4FAA0E;AAC1E,kFAAgE;AAChE,sFAAoE;AACpE,gFAA8D;AAC9D,4FAA0E;AAC1E,6DAA2C;AAC3C,4DAA0C;AAC1C,gEAA8C;AAC9C,iEAA+C;AAC/C,qEAAmD;AACnD,oDAAkC;AAClC,4CAA0B"}
package/lib/otel.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import * as otel from '@opentelemetry/api';
2
+ import { Headers } from '@temporalio/internal-workflow-common';
3
+ /** Default trace header for opentelemetry interceptors */
4
+ export declare const TRACE_HEADER = "_tracer-data";
5
+ /** As in workflow run id */
6
+ export declare const RUN_ID_ATTR_KEY = "run_id";
7
+ /** For a workflow or activity task */
8
+ export declare const TASK_TOKEN_ATTR_KEY = "task_token";
9
+ /** Number of jobs in a workflow activation */
10
+ export declare const NUM_JOBS_ATTR_KEY = "num_jobs";
11
+ /**
12
+ * If found, return an otel Context deserialized from the provided headers
13
+ */
14
+ export declare function extractContextFromHeaders(headers: Headers): Promise<otel.Context | undefined>;
15
+ /**
16
+ * If found, return an otel SpanContext deserialized from the provided headers
17
+ */
18
+ export declare function extractSpanContextFromHeaders(headers: Headers): Promise<otel.SpanContext | undefined>;
19
+ /**
20
+ * Given headers, return new headers with the current otel context inserted
21
+ */
22
+ export declare function headersWithContext(headers: Headers): Promise<Headers>;
23
+ /**
24
+ * Link a span to an maybe-existing span context
25
+ */
26
+ export declare function linkSpans(fromSpan: otel.Span, toContext?: otel.SpanContext): void;