@temporalio/common 1.14.2-canary-release-testing.0 → 1.16.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 +67 -16
- package/lib/activity-options.js +47 -1
- package/lib/activity-options.js.map +1 -1
- package/lib/continue-as-new.d.ts +14 -0
- package/lib/continue-as-new.js +41 -0
- package/lib/continue-as-new.js.map +1 -0
- package/lib/converter/failure-converter.d.ts +2 -0
- package/lib/converter/failure-converter.js +69 -29
- package/lib/converter/failure-converter.js.map +1 -1
- package/lib/converter/payload-search-attributes.d.ts +1 -1
- package/lib/converter/payload-search-attributes.js +3 -3
- package/lib/converter/payload-search-attributes.js.map +1 -1
- package/lib/errors.d.ts +19 -0
- package/lib/errors.js +24 -1
- package/lib/errors.js.map +1 -1
- package/lib/failure.d.ts +1 -1
- package/lib/failure.js +14 -14
- package/lib/failure.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/internal-non-workflow/codec-helpers.d.ts +1 -0
- package/lib/internal-non-workflow/codec-helpers.js +9 -0
- package/lib/internal-non-workflow/codec-helpers.js.map +1 -1
- package/lib/internal-workflow/enums-helpers.d.ts +1 -1
- package/lib/internal-workflow/enums-helpers.js +1 -1
- package/lib/metrics.d.ts +34 -15
- package/lib/metrics.js +11 -3
- package/lib/metrics.js.map +1 -1
- package/lib/search-attributes.js +10 -1
- package/lib/search-attributes.js.map +1 -1
- package/lib/time.js +1 -1
- package/lib/time.js.map +1 -1
- package/lib/versioning-intent-enum.d.ts +4 -2
- package/lib/versioning-intent-enum.js +5 -3
- package/lib/versioning-intent-enum.js.map +1 -1
- package/lib/versioning-intent.d.ts +1 -2
- package/lib/worker-deployments.d.ts +20 -4
- package/lib/worker-deployments.js +24 -4
- package/lib/worker-deployments.js.map +1 -1
- package/lib/workflow-options.d.ts +3 -3
- package/lib/workflow-options.js +15 -7
- package/lib/workflow-options.js.map +1 -1
- package/package.json +4 -4
- package/src/activity-options.ts +78 -16
- package/src/continue-as-new.ts +52 -0
- package/src/converter/failure-converter.ts +74 -37
- package/src/converter/payload-search-attributes.ts +3 -3
- package/src/errors.ts +20 -0
- package/src/failure.ts +14 -15
- package/src/index.ts +3 -2
- package/src/internal-non-workflow/codec-helpers.ts +11 -0
- package/src/internal-workflow/enums-helpers.ts +1 -1
- package/src/metrics.ts +64 -22
- package/src/search-attributes.ts +13 -5
- package/src/time.ts +1 -1
- package/src/versioning-intent-enum.ts +5 -3
- package/src/versioning-intent.ts +1 -2
- package/src/worker-deployments.ts +34 -4
- package/src/workflow-options.ts +11 -11
package/src/failure.ts
CHANGED
|
@@ -13,19 +13,19 @@ export const TimeoutType = {
|
|
|
13
13
|
HEARTBEAT: 'HEARTBEAT',
|
|
14
14
|
|
|
15
15
|
/** @deprecated Use {@link START_TO_CLOSE} instead. */
|
|
16
|
-
TIMEOUT_TYPE_START_TO_CLOSE: 'START_TO_CLOSE',
|
|
16
|
+
TIMEOUT_TYPE_START_TO_CLOSE: 'START_TO_CLOSE',
|
|
17
17
|
|
|
18
18
|
/** @deprecated Use {@link SCHEDULE_TO_START} instead. */
|
|
19
|
-
TIMEOUT_TYPE_SCHEDULE_TO_START: 'SCHEDULE_TO_START',
|
|
19
|
+
TIMEOUT_TYPE_SCHEDULE_TO_START: 'SCHEDULE_TO_START',
|
|
20
20
|
|
|
21
21
|
/** @deprecated Use {@link SCHEDULE_TO_CLOSE} instead. */
|
|
22
|
-
TIMEOUT_TYPE_SCHEDULE_TO_CLOSE: 'SCHEDULE_TO_CLOSE',
|
|
22
|
+
TIMEOUT_TYPE_SCHEDULE_TO_CLOSE: 'SCHEDULE_TO_CLOSE',
|
|
23
23
|
|
|
24
24
|
/** @deprecated Use {@link HEARTBEAT} instead. */
|
|
25
|
-
TIMEOUT_TYPE_HEARTBEAT: 'HEARTBEAT',
|
|
25
|
+
TIMEOUT_TYPE_HEARTBEAT: 'HEARTBEAT',
|
|
26
26
|
|
|
27
27
|
/** @deprecated Use `undefined` instead. */
|
|
28
|
-
TIMEOUT_TYPE_UNSPECIFIED: undefined,
|
|
28
|
+
TIMEOUT_TYPE_UNSPECIFIED: undefined,
|
|
29
29
|
} as const;
|
|
30
30
|
export type TimeoutType = (typeof TimeoutType)[keyof typeof TimeoutType];
|
|
31
31
|
|
|
@@ -56,28 +56,28 @@ export const RetryState = {
|
|
|
56
56
|
CANCEL_REQUESTED: 'CANCEL_REQUESTED',
|
|
57
57
|
|
|
58
58
|
/** @deprecated Use {@link IN_PROGRESS} instead. */
|
|
59
|
-
RETRY_STATE_IN_PROGRESS: 'IN_PROGRESS',
|
|
59
|
+
RETRY_STATE_IN_PROGRESS: 'IN_PROGRESS',
|
|
60
60
|
|
|
61
61
|
/** @deprecated Use {@link NON_RETRYABLE_FAILURE} instead. */
|
|
62
|
-
RETRY_STATE_NON_RETRYABLE_FAILURE: 'NON_RETRYABLE_FAILURE',
|
|
62
|
+
RETRY_STATE_NON_RETRYABLE_FAILURE: 'NON_RETRYABLE_FAILURE',
|
|
63
63
|
|
|
64
64
|
/** @deprecated Use {@link TIMEOUT} instead. */
|
|
65
|
-
RETRY_STATE_TIMEOUT: 'TIMEOUT',
|
|
65
|
+
RETRY_STATE_TIMEOUT: 'TIMEOUT',
|
|
66
66
|
|
|
67
67
|
/** @deprecated Use {@link MAXIMUM_ATTEMPTS_REACHED} instead. */
|
|
68
|
-
RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED: 'MAXIMUM_ATTEMPTS_REACHED',
|
|
68
|
+
RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED: 'MAXIMUM_ATTEMPTS_REACHED',
|
|
69
69
|
|
|
70
70
|
/** @deprecated Use {@link RETRY_POLICY_NOT_SET} instead. */
|
|
71
|
-
RETRY_STATE_RETRY_POLICY_NOT_SET: 'RETRY_POLICY_NOT_SET',
|
|
71
|
+
RETRY_STATE_RETRY_POLICY_NOT_SET: 'RETRY_POLICY_NOT_SET',
|
|
72
72
|
|
|
73
73
|
/** @deprecated Use {@link INTERNAL_SERVER_ERROR} instead. */
|
|
74
|
-
RETRY_STATE_INTERNAL_SERVER_ERROR: 'INTERNAL_SERVER_ERROR',
|
|
74
|
+
RETRY_STATE_INTERNAL_SERVER_ERROR: 'INTERNAL_SERVER_ERROR',
|
|
75
75
|
|
|
76
76
|
/** @deprecated Use {@link CANCEL_REQUESTED} instead. */
|
|
77
|
-
RETRY_STATE_CANCEL_REQUESTED: 'CANCEL_REQUESTED',
|
|
77
|
+
RETRY_STATE_CANCEL_REQUESTED: 'CANCEL_REQUESTED',
|
|
78
78
|
|
|
79
79
|
/** @deprecated Use `undefined` instead. */
|
|
80
|
-
RETRY_STATE_UNSPECIFIED: undefined,
|
|
80
|
+
RETRY_STATE_UNSPECIFIED: undefined,
|
|
81
81
|
} as const;
|
|
82
82
|
export type RetryState = (typeof RetryState)[keyof typeof RetryState];
|
|
83
83
|
|
|
@@ -104,7 +104,7 @@ export const [encodeRetryState, decodeRetryState] = makeProtoEnumConverters<
|
|
|
104
104
|
/**
|
|
105
105
|
* A category to describe the severity and change the observability behavior of an application failure.
|
|
106
106
|
*
|
|
107
|
-
* Currently, observability
|
|
107
|
+
* Currently, observability behavior changes are limited to:
|
|
108
108
|
* - activities that fail due to a BENIGN application failure emit DEBUG level logs and do not record metrics
|
|
109
109
|
*
|
|
110
110
|
* @experimental Category is a new feature and may be subject to change.
|
|
@@ -112,7 +112,6 @@ export const [encodeRetryState, decodeRetryState] = makeProtoEnumConverters<
|
|
|
112
112
|
export const ApplicationFailureCategory = {
|
|
113
113
|
BENIGN: 'BENIGN',
|
|
114
114
|
} as const;
|
|
115
|
-
|
|
116
115
|
export type ApplicationFailureCategory = (typeof ApplicationFailureCategory)[keyof typeof ApplicationFailureCategory];
|
|
117
116
|
|
|
118
117
|
export const [encodeApplicationFailureCategory, decodeApplicationFailureCategory] = makeProtoEnumConverters<
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import * as helpers from './type-helpers';
|
|
|
9
9
|
|
|
10
10
|
export * from './activity-options';
|
|
11
11
|
export { ActivityCancellationDetailsOptions, ActivityCancellationDetails } from './activity-cancellation-details';
|
|
12
|
+
export { SuggestContinueAsNewReason } from './continue-as-new';
|
|
12
13
|
export * from './converter/data-converter';
|
|
13
14
|
export * from './converter/failure-converter';
|
|
14
15
|
export * from './converter/payload-codec';
|
|
@@ -30,8 +31,8 @@ export * from './workflow-handle';
|
|
|
30
31
|
export * from './workflow-options';
|
|
31
32
|
export * from './versioning-intent';
|
|
32
33
|
export {
|
|
33
|
-
SearchAttributes, // eslint-disable-line
|
|
34
|
-
SearchAttributeValue, // eslint-disable-line
|
|
34
|
+
SearchAttributes, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
35
|
+
SearchAttributeValue, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
35
36
|
SearchAttributeType,
|
|
36
37
|
SearchAttributePair,
|
|
37
38
|
SearchAttributeUpdatePair,
|
|
@@ -357,6 +357,17 @@ export function noopEncodeMap<K extends string>(
|
|
|
357
357
|
return map as Record<K, EncodedPayload> | null | undefined;
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
+
export function noopEncodeSearchAttrs<K extends string>(
|
|
361
|
+
attrs: temporal.api.common.v1.ISearchAttributes | null | undefined
|
|
362
|
+
): temporal.api.common.v1.ISearchAttributes | null | undefined {
|
|
363
|
+
if (!attrs) {
|
|
364
|
+
return attrs;
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
indexedFields: noopEncodeMap(attrs.indexedFields),
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
360
371
|
/**
|
|
361
372
|
* Mark all values in the map as decoded.
|
|
362
373
|
* Use this for headers, which we don't encode.
|
|
@@ -10,12 +10,12 @@ import { Exact, RemovePrefix, UnionToIntersection } from '../type-helpers';
|
|
|
10
10
|
* Newly introduced enums should follow the following pattern:
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
|
-
* type ParentClosePolicy = (typeof ParentClosePolicy)[keyof typeof ParentClosePolicy];
|
|
14
13
|
* const ParentClosePolicy = {
|
|
15
14
|
* TERMINATE: 'TERMINATE',
|
|
16
15
|
* ABANDON: 'ABANDON',
|
|
17
16
|
* REQUEST_CANCEL: 'REQUEST_CANCEL',
|
|
18
17
|
* } as const;
|
|
18
|
+
* type ParentClosePolicy = (typeof ParentClosePolicy)[keyof typeof ParentClosePolicy];
|
|
19
19
|
*
|
|
20
20
|
* const [encodeParentClosePolicy, decodeParentClosePolicy] = //
|
|
21
21
|
* makeProtoEnumConverters<
|
package/src/metrics.ts
CHANGED
|
@@ -69,8 +69,43 @@ export interface Metric {
|
|
|
69
69
|
* The description of the metric, if any.
|
|
70
70
|
*/
|
|
71
71
|
description?: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The kind of the metric (e.g. `counter`, `histogram`, `gauge`).
|
|
75
|
+
*/
|
|
76
|
+
kind: MetricKind;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The type of value recorded by the metric. Either `int` or `float`.
|
|
80
|
+
*/
|
|
81
|
+
valueType: NumericMetricValueType;
|
|
72
82
|
}
|
|
73
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Tags to be attached to some metrics.
|
|
86
|
+
*
|
|
87
|
+
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
88
|
+
*/
|
|
89
|
+
export type MetricTags = Record<string, string | number | boolean>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Type of numerical values recorded by a metric.
|
|
93
|
+
*
|
|
94
|
+
* Note that this represents the _configuration_ of the metric; however, since JavaScript doesn't
|
|
95
|
+
* have different runtime representation for integers and floats, the actual value type is always
|
|
96
|
+
* a JS 'number'.
|
|
97
|
+
*
|
|
98
|
+
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
99
|
+
*/
|
|
100
|
+
export type NumericMetricValueType = 'int' | 'float';
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The kind of a metric.
|
|
104
|
+
*
|
|
105
|
+
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
106
|
+
*/
|
|
107
|
+
export type MetricKind = 'counter' | 'histogram' | 'gauge';
|
|
108
|
+
|
|
74
109
|
/**
|
|
75
110
|
* A metric that supports adding values as a counter.
|
|
76
111
|
*
|
|
@@ -91,6 +126,9 @@ export interface MetricCounter extends Metric {
|
|
|
91
126
|
* @param tags Tags to append to existing tags.
|
|
92
127
|
*/
|
|
93
128
|
withTags(tags: MetricTags): MetricCounter;
|
|
129
|
+
|
|
130
|
+
kind: 'counter';
|
|
131
|
+
valueType: 'int';
|
|
94
132
|
}
|
|
95
133
|
|
|
96
134
|
/**
|
|
@@ -99,11 +137,6 @@ export interface MetricCounter extends Metric {
|
|
|
99
137
|
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
100
138
|
*/
|
|
101
139
|
export interface MetricHistogram extends Metric {
|
|
102
|
-
/**
|
|
103
|
-
* The type of value to record. Either `int` or `float`.
|
|
104
|
-
*/
|
|
105
|
-
valueType: NumericMetricValueType;
|
|
106
|
-
|
|
107
140
|
/**
|
|
108
141
|
* Record the given value on the histogram.
|
|
109
142
|
*
|
|
@@ -120,6 +153,8 @@ export interface MetricHistogram extends Metric {
|
|
|
120
153
|
* @param tags Tags to append to existing tags.
|
|
121
154
|
*/
|
|
122
155
|
withTags(tags: MetricTags): MetricHistogram;
|
|
156
|
+
|
|
157
|
+
kind: 'histogram';
|
|
123
158
|
}
|
|
124
159
|
|
|
125
160
|
/**
|
|
@@ -128,11 +163,6 @@ export interface MetricHistogram extends Metric {
|
|
|
128
163
|
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
129
164
|
*/
|
|
130
165
|
export interface MetricGauge extends Metric {
|
|
131
|
-
/**
|
|
132
|
-
* The type of value to set. Either `int` or `float`.
|
|
133
|
-
*/
|
|
134
|
-
valueType: NumericMetricValueType;
|
|
135
|
-
|
|
136
166
|
/**
|
|
137
167
|
* Set the given value on the gauge.
|
|
138
168
|
*
|
|
@@ -147,16 +177,9 @@ export interface MetricGauge extends Metric {
|
|
|
147
177
|
* @param tags Tags to append to existing tags.
|
|
148
178
|
*/
|
|
149
179
|
withTags(tags: MetricTags): MetricGauge;
|
|
150
|
-
}
|
|
151
180
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
*
|
|
155
|
-
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
156
|
-
*/
|
|
157
|
-
export type MetricTags = Record<string, string | number | boolean>;
|
|
158
|
-
|
|
159
|
-
export type NumericMetricValueType = 'int' | 'float';
|
|
181
|
+
kind: 'gauge';
|
|
182
|
+
}
|
|
160
183
|
|
|
161
184
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
162
185
|
|
|
@@ -170,6 +193,9 @@ class NoopMetricMeter implements MetricMeter {
|
|
|
170
193
|
unit,
|
|
171
194
|
description,
|
|
172
195
|
|
|
196
|
+
kind: 'counter',
|
|
197
|
+
valueType: 'int',
|
|
198
|
+
|
|
173
199
|
add(_value, _extraTags) {},
|
|
174
200
|
|
|
175
201
|
withTags(_extraTags) {
|
|
@@ -186,10 +212,12 @@ class NoopMetricMeter implements MetricMeter {
|
|
|
186
212
|
): MetricHistogram {
|
|
187
213
|
return {
|
|
188
214
|
name,
|
|
189
|
-
valueType,
|
|
190
215
|
unit,
|
|
191
216
|
description,
|
|
192
217
|
|
|
218
|
+
kind: 'histogram',
|
|
219
|
+
valueType,
|
|
220
|
+
|
|
193
221
|
record(_value, _extraTags) {},
|
|
194
222
|
|
|
195
223
|
withTags(_extraTags) {
|
|
@@ -198,13 +226,20 @@ class NoopMetricMeter implements MetricMeter {
|
|
|
198
226
|
};
|
|
199
227
|
}
|
|
200
228
|
|
|
201
|
-
createGauge(
|
|
229
|
+
createGauge(
|
|
230
|
+
name: string,
|
|
231
|
+
valueType: NumericMetricValueType = 'int',
|
|
232
|
+
unit?: string,
|
|
233
|
+
description?: string
|
|
234
|
+
): MetricGauge {
|
|
202
235
|
return {
|
|
203
236
|
name,
|
|
204
|
-
valueType: valueType ?? 'int',
|
|
205
237
|
unit,
|
|
206
238
|
description,
|
|
207
239
|
|
|
240
|
+
kind: 'gauge',
|
|
241
|
+
valueType,
|
|
242
|
+
|
|
208
243
|
set(_value, _extraTags) {},
|
|
209
244
|
|
|
210
245
|
withTags(_extraTags) {
|
|
@@ -300,6 +335,9 @@ export class MetricMeterWithComposedTags implements MetricMeter {
|
|
|
300
335
|
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
301
336
|
*/
|
|
302
337
|
class MetricCounterWithComposedTags implements MetricCounter {
|
|
338
|
+
public readonly kind = 'counter';
|
|
339
|
+
public readonly valueType = 'int';
|
|
340
|
+
|
|
303
341
|
constructor(
|
|
304
342
|
private parentCounter: MetricCounter,
|
|
305
343
|
private contributors: MetricTagsOrFunc[]
|
|
@@ -332,6 +370,8 @@ class MetricCounterWithComposedTags implements MetricCounter {
|
|
|
332
370
|
* @experimental The Metric API is an experimental feature and may be subject to change.
|
|
333
371
|
*/
|
|
334
372
|
class MetricHistogramWithComposedTags implements MetricHistogram {
|
|
373
|
+
public readonly kind = 'histogram';
|
|
374
|
+
|
|
335
375
|
constructor(
|
|
336
376
|
private parentHistogram: MetricHistogram,
|
|
337
377
|
private contributors: MetricTagsOrFunc[]
|
|
@@ -369,6 +409,8 @@ class MetricHistogramWithComposedTags implements MetricHistogram {
|
|
|
369
409
|
* @hidden
|
|
370
410
|
*/
|
|
371
411
|
class MetricGaugeWithComposedTags implements MetricGauge {
|
|
412
|
+
public readonly kind = 'gauge';
|
|
413
|
+
|
|
372
414
|
constructor(
|
|
373
415
|
private parentGauge: MetricGauge,
|
|
374
416
|
private contributors: MetricTagsOrFunc[]
|
package/src/search-attributes.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { temporal } from '@temporalio/proto';
|
|
|
2
2
|
import { makeProtoEnumConverters } from './internal-workflow';
|
|
3
3
|
|
|
4
4
|
/** @deprecated: Use {@link TypedSearchAttributes} instead */
|
|
5
|
-
export type SearchAttributeValueOrReadonly = SearchAttributeValue | Readonly<SearchAttributeValue> | undefined; // eslint-disable-line
|
|
5
|
+
export type SearchAttributeValueOrReadonly = SearchAttributeValue | Readonly<SearchAttributeValue> | undefined; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
6
6
|
/** @deprecated: Use {@link TypedSearchAttributes} instead */
|
|
7
|
-
export type SearchAttributes = Record<string, SearchAttributeValueOrReadonly>; // eslint-disable-line
|
|
7
|
+
export type SearchAttributes = Record<string, SearchAttributeValueOrReadonly>; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
8
8
|
/** @deprecated: Use {@link TypedSearchAttributes} instead */
|
|
9
|
-
export type SearchAttributeValue = string[] | number[] | boolean[] | Date[];
|
|
9
|
+
export type SearchAttributeValue = string[] | number[] | boolean[] | Date[];
|
|
10
10
|
|
|
11
11
|
export const SearchAttributeType = {
|
|
12
12
|
TEXT: 'TEXT',
|
|
@@ -17,7 +17,6 @@ export const SearchAttributeType = {
|
|
|
17
17
|
DATETIME: 'DATETIME',
|
|
18
18
|
KEYWORD_LIST: 'KEYWORD_LIST',
|
|
19
19
|
} as const;
|
|
20
|
-
|
|
21
20
|
export type SearchAttributeType = (typeof SearchAttributeType)[keyof typeof SearchAttributeType];
|
|
22
21
|
|
|
23
22
|
// Note: encodeSearchAttributeIndexedValueType exported for use in tests to register search attributes
|
|
@@ -213,7 +212,7 @@ export class TypedSearchAttributes {
|
|
|
213
212
|
|
|
214
213
|
static getKeyFromUntyped(
|
|
215
214
|
key: string,
|
|
216
|
-
value: SearchAttributeValueOrReadonly // eslint-disable-line
|
|
215
|
+
value: SearchAttributeValueOrReadonly // eslint-disable-line @typescript-eslint/no-deprecated
|
|
217
216
|
): SearchAttributeKey<SearchAttributeType> | undefined {
|
|
218
217
|
if (value == null) {
|
|
219
218
|
return;
|
|
@@ -270,20 +269,29 @@ export class TypedSearchAttributes {
|
|
|
270
269
|
}
|
|
271
270
|
|
|
272
271
|
static toSearchAttributeType(type: string): SearchAttributeType | undefined {
|
|
272
|
+
// The type metadata is usually in PascalCase (e.g. "KeywordList") but in
|
|
273
|
+
// rare cases may be in SCREAMING_SNAKE_CASE (e.g. "INDEXED_VALUE_TYPE_KEYWORD_LIST").
|
|
273
274
|
switch (type) {
|
|
274
275
|
case 'Text':
|
|
276
|
+
case 'INDEXED_VALUE_TYPE_TEXT':
|
|
275
277
|
return SearchAttributeType.TEXT;
|
|
276
278
|
case 'Keyword':
|
|
279
|
+
case 'INDEXED_VALUE_TYPE_KEYWORD':
|
|
277
280
|
return SearchAttributeType.KEYWORD;
|
|
278
281
|
case 'Int':
|
|
282
|
+
case 'INDEXED_VALUE_TYPE_INT':
|
|
279
283
|
return SearchAttributeType.INT;
|
|
280
284
|
case 'Double':
|
|
285
|
+
case 'INDEXED_VALUE_TYPE_DOUBLE':
|
|
281
286
|
return SearchAttributeType.DOUBLE;
|
|
282
287
|
case 'Bool':
|
|
288
|
+
case 'INDEXED_VALUE_TYPE_BOOL':
|
|
283
289
|
return SearchAttributeType.BOOL;
|
|
284
290
|
case 'Datetime':
|
|
291
|
+
case 'INDEXED_VALUE_TYPE_DATETIME':
|
|
285
292
|
return SearchAttributeType.DATETIME;
|
|
286
293
|
case 'KeywordList':
|
|
294
|
+
case 'INDEXED_VALUE_TYPE_KEYWORD_LIST':
|
|
287
295
|
return SearchAttributeType.KEYWORD_LIST;
|
|
288
296
|
default:
|
|
289
297
|
return;
|
package/src/time.ts
CHANGED
|
@@ -2,15 +2,14 @@ import type { coresdk } from '@temporalio/proto';
|
|
|
2
2
|
import type { VersioningIntent as VersioningIntentString } from './versioning-intent';
|
|
3
3
|
import { assertNever, checkExtends } from './type-helpers';
|
|
4
4
|
|
|
5
|
-
/* eslint-disable
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
6
6
|
|
|
7
7
|
// Avoid importing the proto implementation to reduce workflow bundle size
|
|
8
8
|
// Copied from coresdk.common.VersioningIntent
|
|
9
9
|
/**
|
|
10
10
|
* Protobuf enum representation of {@link VersioningIntentString}.
|
|
11
11
|
*
|
|
12
|
-
* @deprecated
|
|
13
|
-
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
12
|
+
* @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
|
|
14
13
|
*/
|
|
15
14
|
export enum VersioningIntent {
|
|
16
15
|
UNSPECIFIED = 0,
|
|
@@ -21,6 +20,9 @@ export enum VersioningIntent {
|
|
|
21
20
|
checkExtends<coresdk.common.VersioningIntent, VersioningIntent>();
|
|
22
21
|
checkExtends<VersioningIntent, coresdk.common.VersioningIntent>();
|
|
23
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
|
|
25
|
+
*/
|
|
24
26
|
export function versioningIntentToProto(intent: VersioningIntentString | undefined): VersioningIntent {
|
|
25
27
|
switch (intent) {
|
|
26
28
|
case 'DEFAULT':
|
package/src/versioning-intent.ts
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
* current worker. The default behavior for starting Workflows is `DEFAULT`. The default behavior for Workflows starting
|
|
12
12
|
* Activities, starting Child Workflows, or Continuing As New is `COMPATIBLE`.
|
|
13
13
|
*
|
|
14
|
-
* @deprecated
|
|
15
|
-
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
14
|
+
* @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
|
|
16
15
|
*/
|
|
17
16
|
export type VersioningIntent = 'COMPATIBLE' | 'DEFAULT';
|
|
@@ -3,8 +3,6 @@ import { makeProtoEnumConverters } from './internal-workflow';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents the version of a specific worker deployment.
|
|
6
|
-
*
|
|
7
|
-
* @experimental Deployment based versioning is experimental and may change in the future.
|
|
8
6
|
*/
|
|
9
7
|
export interface WorkerDeploymentVersion {
|
|
10
8
|
readonly buildId: string;
|
|
@@ -25,8 +23,6 @@ export function toCanonicalString(version: WorkerDeploymentVersion): string {
|
|
|
25
23
|
* * 'PINNED' - The workflow will be pinned to the current Build ID unless manually moved.
|
|
26
24
|
* * 'AUTO_UPGRADE' - The workflow will automatically move to the latest version (default Build ID
|
|
27
25
|
* of the task queue) when the next task is dispatched.
|
|
28
|
-
*
|
|
29
|
-
* @experimental Deployment based versioning is experimental and may change in the future.
|
|
30
26
|
*/
|
|
31
27
|
export const VersioningBehavior = {
|
|
32
28
|
PINNED: 'PINNED',
|
|
@@ -68,3 +64,37 @@ export interface PinnedVersioningOverride {
|
|
|
68
64
|
* The workflow will auto-upgrade to the current deployment version on the next workflow task.
|
|
69
65
|
*/
|
|
70
66
|
export type AutoUpgradeVersioningOverride = 'AUTO_UPGRADE';
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Defines the versioning behavior to be used by the first task of a new workflow run in a continue-as-new chain.
|
|
70
|
+
*
|
|
71
|
+
* AUTO_UPGRADE - Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at
|
|
72
|
+
* start-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever
|
|
73
|
+
* Versioning Behavior the workflow is annotated with in the workflow code.
|
|
74
|
+
*
|
|
75
|
+
* Note that if the previous workflow had a Pinned override, that override will be inherited by the
|
|
76
|
+
* new workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new
|
|
77
|
+
* command. If a Pinned override is inherited by the new run, and the new run starts with AutoUpgrade
|
|
78
|
+
* behavior, the base version of the new run will be the Target Version as described above, but the
|
|
79
|
+
* effective version will be whatever is specified by the Versioning Override until the override is removed.
|
|
80
|
+
*
|
|
81
|
+
* @experimental Versioning semantics with continue-as-new are experimental and may change in the future.
|
|
82
|
+
*/
|
|
83
|
+
export const InitialVersioningBehavior = {
|
|
84
|
+
AUTO_UPGRADE: 'AUTO_UPGRADE',
|
|
85
|
+
} as const;
|
|
86
|
+
export type InitialVersioningBehavior = (typeof InitialVersioningBehavior)[keyof typeof InitialVersioningBehavior];
|
|
87
|
+
|
|
88
|
+
export const [encodeInitialVersioningBehavior, decodeInitialVersioningBehavior] = makeProtoEnumConverters<
|
|
89
|
+
temporal.api.enums.v1.ContinueAsNewVersioningBehavior,
|
|
90
|
+
typeof temporal.api.enums.v1.ContinueAsNewVersioningBehavior,
|
|
91
|
+
keyof typeof temporal.api.enums.v1.ContinueAsNewVersioningBehavior,
|
|
92
|
+
typeof InitialVersioningBehavior,
|
|
93
|
+
'CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_'
|
|
94
|
+
>(
|
|
95
|
+
{
|
|
96
|
+
[InitialVersioningBehavior.AUTO_UPGRADE]: 1,
|
|
97
|
+
UNSPECIFIED: 0,
|
|
98
|
+
} as const,
|
|
99
|
+
'CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_'
|
|
100
|
+
);
|
package/src/workflow-options.ts
CHANGED
|
@@ -43,7 +43,7 @@ export const WorkflowIdReusePolicy = {
|
|
|
43
43
|
* {@link WorkflowIdConflictPolicy.WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING}.
|
|
44
44
|
* When using this option, `WorkflowOptions.workflowIdConflictPolicy` must be left unspecified.
|
|
45
45
|
*/
|
|
46
|
-
TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING',
|
|
46
|
+
TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING',
|
|
47
47
|
|
|
48
48
|
/// Anything below this line has been deprecated
|
|
49
49
|
|
|
@@ -52,19 +52,19 @@ export const WorkflowIdReusePolicy = {
|
|
|
52
52
|
*
|
|
53
53
|
* @deprecated Either leave property `undefined`, or use {@link ALLOW_DUPLICATE} instead.
|
|
54
54
|
*/
|
|
55
|
-
WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED: undefined,
|
|
55
|
+
WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED: undefined,
|
|
56
56
|
|
|
57
57
|
/** @deprecated Use {@link ALLOW_DUPLICATE} instead. */
|
|
58
|
-
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE: 'ALLOW_DUPLICATE',
|
|
58
|
+
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE: 'ALLOW_DUPLICATE',
|
|
59
59
|
|
|
60
60
|
/** @deprecated Use {@link ALLOW_DUPLICATE_FAILED_ONLY} instead. */
|
|
61
|
-
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY: 'ALLOW_DUPLICATE_FAILED_ONLY',
|
|
61
|
+
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY: 'ALLOW_DUPLICATE_FAILED_ONLY',
|
|
62
62
|
|
|
63
63
|
/** @deprecated Use {@link REJECT_DUPLICATE} instead. */
|
|
64
|
-
WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE: 'REJECT_DUPLICATE',
|
|
64
|
+
WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE: 'REJECT_DUPLICATE',
|
|
65
65
|
|
|
66
66
|
/** @deprecated Use {@link TERMINATE_IF_RUNNING} instead. */
|
|
67
|
-
WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING',
|
|
67
|
+
WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING',
|
|
68
68
|
} as const;
|
|
69
69
|
export type WorkflowIdReusePolicy = (typeof WorkflowIdReusePolicy)[keyof typeof WorkflowIdReusePolicy];
|
|
70
70
|
|
|
@@ -79,7 +79,7 @@ export const [encodeWorkflowIdReusePolicy, decodeWorkflowIdReusePolicy] = makePr
|
|
|
79
79
|
[WorkflowIdReusePolicy.ALLOW_DUPLICATE]: 1,
|
|
80
80
|
[WorkflowIdReusePolicy.ALLOW_DUPLICATE_FAILED_ONLY]: 2,
|
|
81
81
|
[WorkflowIdReusePolicy.REJECT_DUPLICATE]: 3,
|
|
82
|
-
[WorkflowIdReusePolicy.TERMINATE_IF_RUNNING]: 4, // eslint-disable-line
|
|
82
|
+
[WorkflowIdReusePolicy.TERMINATE_IF_RUNNING]: 4, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
83
83
|
UNSPECIFIED: 0,
|
|
84
84
|
} as const,
|
|
85
85
|
'WORKFLOW_ID_REUSE_POLICY_'
|
|
@@ -93,7 +93,6 @@ export const [encodeWorkflowIdReusePolicy, decodeWorkflowIdReusePolicy] = makePr
|
|
|
93
93
|
*
|
|
94
94
|
* *Note: It is never possible to have two _actively running_ Workflows with the same ID.*
|
|
95
95
|
*/
|
|
96
|
-
export type WorkflowIdConflictPolicy = (typeof WorkflowIdConflictPolicy)[keyof typeof WorkflowIdConflictPolicy];
|
|
97
96
|
export const WorkflowIdConflictPolicy = {
|
|
98
97
|
/**
|
|
99
98
|
* Do not start a new Workflow. Instead raise a `WorkflowExecutionAlreadyStartedError`.
|
|
@@ -110,6 +109,7 @@ export const WorkflowIdConflictPolicy = {
|
|
|
110
109
|
*/
|
|
111
110
|
TERMINATE_EXISTING: 'TERMINATE_EXISTING',
|
|
112
111
|
} as const;
|
|
112
|
+
export type WorkflowIdConflictPolicy = (typeof WorkflowIdConflictPolicy)[keyof typeof WorkflowIdConflictPolicy];
|
|
113
113
|
|
|
114
114
|
export const [encodeWorkflowIdConflictPolicy, decodeWorkflowIdConflictPolicy] = makeProtoEnumConverters<
|
|
115
115
|
temporal.api.enums.v1.WorkflowIdConflictPolicy,
|
|
@@ -133,7 +133,7 @@ export interface BaseWorkflowOptions {
|
|
|
133
133
|
*
|
|
134
134
|
* *Note: It is not possible to have two actively running Workflows with the same ID.*
|
|
135
135
|
*
|
|
136
|
-
* @default
|
|
136
|
+
* @default WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE
|
|
137
137
|
*/
|
|
138
138
|
workflowIdReusePolicy?: WorkflowIdReusePolicy;
|
|
139
139
|
|
|
@@ -142,7 +142,7 @@ export interface BaseWorkflowOptions {
|
|
|
142
142
|
*
|
|
143
143
|
* *Note: It is not possible to have two actively running Workflows with the same ID.*
|
|
144
144
|
*
|
|
145
|
-
* @default
|
|
145
|
+
* @default WorkflowIdConflictPolicy.WORKFLOW_ID_CONFLICT_POLICY_UNSPECIFIED
|
|
146
146
|
*/
|
|
147
147
|
workflowIdConflictPolicy?: WorkflowIdConflictPolicy;
|
|
148
148
|
|
|
@@ -179,7 +179,7 @@ export interface BaseWorkflowOptions {
|
|
|
179
179
|
*
|
|
180
180
|
* @deprecated Use {@link typedSearchAttributes} instead.
|
|
181
181
|
*/
|
|
182
|
-
searchAttributes?: SearchAttributes; // eslint-disable-line
|
|
182
|
+
searchAttributes?: SearchAttributes; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* Specifies additional indexed information to attach to the Workflow Execution. More info:
|