@temporalio/common 0.17.2 → 0.19.0-rc.1
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/README.md +5 -11
- package/lib/converter/data-converter.d.ts +34 -62
- package/lib/converter/data-converter.js +0 -101
- package/lib/converter/data-converter.js.map +1 -1
- package/lib/{encoding.d.ts → converter/encoding.d.ts} +0 -0
- package/lib/{encoding.js → converter/encoding.js} +0 -0
- package/lib/converter/encoding.js.map +1 -0
- package/lib/converter/patch-protobuf-root.d.ts +8 -0
- package/lib/converter/patch-protobuf-root.js +43 -0
- package/lib/converter/patch-protobuf-root.js.map +1 -0
- package/lib/converter/payload-codec.d.ts +27 -0
- package/lib/converter/payload-codec.js +11 -0
- package/lib/converter/payload-codec.js.map +1 -0
- package/lib/converter/payload-converter.d.ts +63 -62
- package/lib/converter/payload-converter.js +113 -68
- package/lib/converter/payload-converter.js.map +1 -1
- package/lib/converter/payload-converters.d.ts +31 -0
- package/lib/converter/payload-converters.js +85 -0
- package/lib/converter/payload-converters.js.map +1 -0
- package/lib/converter/protobuf-payload-converters.d.ts +53 -0
- package/lib/converter/protobuf-payload-converters.js +159 -0
- package/lib/converter/protobuf-payload-converters.js.map +1 -0
- package/lib/converter/types.d.ts +2 -0
- package/lib/converter/types.js +3 -2
- package/lib/converter/types.js.map +1 -1
- package/lib/failure.d.ts +6 -6
- package/lib/failure.js +37 -35
- package/lib/failure.js.map +1 -1
- package/lib/index.d.ts +9 -11
- package/lib/index.js +12 -16
- package/lib/index.js.map +1 -1
- package/lib/protobufs.d.ts +13 -0
- package/lib/protobufs.js +31 -0
- package/lib/protobufs.js.map +1 -0
- package/package.json +11 -8
- package/src/converter/data-converter.ts +35 -176
- package/src/{encoding.ts → converter/encoding.ts} +0 -0
- package/src/converter/patch-protobuf-root.ts +49 -0
- package/src/converter/payload-codec.ts +30 -0
- package/src/converter/payload-converter.ts +122 -102
- package/src/converter/payload-converters.ts +89 -0
- package/src/converter/protobuf-payload-converters.ts +192 -0
- package/src/converter/types.ts +4 -1
- package/src/failure.ts +44 -43
- package/src/index.ts +9 -11
- package/src/protobufs.ts +15 -0
- package/tsconfig.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/activity-options.d.ts +0 -81
- package/lib/activity-options.js +0 -14
- package/lib/activity-options.js.map +0 -1
- package/lib/encoding.js.map +0 -1
- package/lib/errors.d.ts +0 -16
- package/lib/errors.js +0 -41
- package/lib/errors.js.map +0 -1
- package/lib/interceptors.d.ts +0 -18
- package/lib/interceptors.js +0 -24
- package/lib/interceptors.js.map +0 -1
- package/lib/interfaces.d.ts +0 -31
- package/lib/interfaces.js +0 -3
- package/lib/interfaces.js.map +0 -1
- package/lib/otel.d.ts +0 -26
- package/lib/otel.js +0 -82
- package/lib/otel.js.map +0 -1
- package/lib/retry-policy.d.ts +0 -43
- package/lib/retry-policy.js +0 -36
- package/lib/retry-policy.js.map +0 -1
- package/lib/time.d.ts +0 -16
- package/lib/time.js +0 -73
- package/lib/time.js.map +0 -1
- package/lib/tls-config.d.ts +0 -32
- package/lib/tls-config.js +0 -11
- package/lib/tls-config.js.map +0 -1
- package/lib/type-helpers.d.ts +0 -8
- package/lib/type-helpers.js +0 -9
- package/lib/type-helpers.js.map +0 -1
- package/lib/utils.d.ts +0 -4
- package/lib/utils.js +0 -11
- package/lib/utils.js.map +0 -1
- package/lib/workflow-handle.d.ts +0 -27
- package/lib/workflow-handle.js +0 -3
- package/lib/workflow-handle.js.map +0 -1
- package/lib/workflow-options.d.ts +0 -91
- package/lib/workflow-options.js +0 -26
- package/lib/workflow-options.js.map +0 -1
- package/src/activity-options.ts +0 -97
- package/src/errors.ts +0 -27
- package/src/interceptors.ts +0 -32
- package/src/interfaces.ts +0 -37
- package/src/otel.ts +0 -61
- package/src/retry-policy.ts +0 -73
- package/src/time.ts +0 -72
- package/src/tls-config.ts +0 -35
- package/src/type-helpers.ts +0 -11
- package/src/utils.ts +0 -6
- package/src/workflow-handle.ts +0 -30
- package/src/workflow-options.ts +0 -127
package/src/workflow-options.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { coresdk, google } from '@temporalio/proto/lib/coresdk';
|
|
2
|
-
import { Workflow } from './interfaces';
|
|
3
|
-
import { RetryPolicy } from './retry-policy';
|
|
4
|
-
import { msToTs } from './time';
|
|
5
|
-
import { checkExtends } from './type-helpers';
|
|
6
|
-
|
|
7
|
-
// Avoid importing the proto implementation to reduce workflow bundle size
|
|
8
|
-
// Copied from coresdk.common.WorkflowIdReusePolicy
|
|
9
|
-
export enum WorkflowIdReusePolicy {
|
|
10
|
-
WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED = 0,
|
|
11
|
-
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE = 1,
|
|
12
|
-
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY = 2,
|
|
13
|
-
WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE = 3,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
checkExtends<coresdk.common.WorkflowIdReusePolicy, WorkflowIdReusePolicy>();
|
|
17
|
-
|
|
18
|
-
export interface BaseWorkflowOptions {
|
|
19
|
-
/**
|
|
20
|
-
* Specifies server behavior if a completed workflow with the same id exists. Note that under no
|
|
21
|
-
* conditions Temporal allows two workflows with the same namespace and workflow id run
|
|
22
|
-
* simultaneously.
|
|
23
|
-
* ALLOW_DUPLICATE_FAILED_ONLY is a default value. It means that workflow can start if
|
|
24
|
-
* previous run failed or was canceled or terminated.
|
|
25
|
-
* ALLOW_DUPLICATE allows new run independently of the previous run closure status.
|
|
26
|
-
* REJECT_DUPLICATE doesn't allow new run independently of the previous run closure status.
|
|
27
|
-
*/
|
|
28
|
-
workflowIdReusePolicy?: WorkflowIdReusePolicy;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Controls how a Workflow is retried.
|
|
32
|
-
*
|
|
33
|
-
* Workflows should typically use the system default, do not set this unless
|
|
34
|
-
* you know what you're doing.
|
|
35
|
-
*/
|
|
36
|
-
retry?: RetryPolicy;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Optional cron schedule for Workflow. If a cron schedule is specified, the Workflow will run
|
|
40
|
-
* as a cron based on the schedule. The scheduling will be based on UTC time. The schedule for the next run only happens
|
|
41
|
-
* after the current run is completed/failed/timeout. If a RetryPolicy is also supplied, and the Workflow failed
|
|
42
|
-
* or timed out, the Workflow will be retried based on the retry policy. While the Workflow is retrying, it won't
|
|
43
|
-
* schedule its next run. If the next schedule is due while the Workflow is running (or retrying), then it will skip that
|
|
44
|
-
* schedule. Cron Workflow will not stop until it is terminated or cancelled (by returning temporal.CanceledError).
|
|
45
|
-
* https://crontab.guru/ is useful for testing your cron expressions.
|
|
46
|
-
*/
|
|
47
|
-
cronSchedule?: string;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Specifies additional non-indexed information in result of list workflow. The type of value
|
|
51
|
-
* can be any object that are serializable by `DataConverter`.
|
|
52
|
-
*/
|
|
53
|
-
memo?: Record<string, any>;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Specifies additional indexed information in result of list workflow. The type of value should
|
|
57
|
-
* be a primitive (e.g. string, number, boolean), for dates use Date.toISOString();
|
|
58
|
-
*/
|
|
59
|
-
searchAttributes?: Record<string, string | number | boolean>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type WithWorkflowArgs<W extends Workflow, T> = T &
|
|
63
|
-
(Parameters<W> extends [any, ...any[]]
|
|
64
|
-
? {
|
|
65
|
-
/**
|
|
66
|
-
* Arguments to pass to the Workflow
|
|
67
|
-
*/
|
|
68
|
-
args: Parameters<W>;
|
|
69
|
-
}
|
|
70
|
-
: {
|
|
71
|
-
/**
|
|
72
|
-
* Arguments to pass to the Workflow
|
|
73
|
-
*/
|
|
74
|
-
args?: Parameters<W>;
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export interface WorkflowDurationOptions {
|
|
78
|
-
/**
|
|
79
|
-
* The time after which workflow run is automatically terminated by Temporal service. Do not
|
|
80
|
-
* rely on run timeout for business level timeouts. It is preferred to use in workflow timers
|
|
81
|
-
* for this purpose.
|
|
82
|
-
*
|
|
83
|
-
* @format {@link https://www.npmjs.com/package/ms | ms} formatted string or number of milliseconds
|
|
84
|
-
*/
|
|
85
|
-
workflowRunTimeout?: string | number;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* The time after which workflow execution (which includes run retries and continue as new) is
|
|
90
|
-
* automatically terminated by Temporal service. Do not rely on execution timeout for business
|
|
91
|
-
* level timeouts. It is preferred to use in workflow timers for this purpose.
|
|
92
|
-
*
|
|
93
|
-
* @format {@link https://www.npmjs.com/package/ms | ms} formatted string or number of milliseconds
|
|
94
|
-
*/
|
|
95
|
-
workflowExecutionTimeout?: string | number;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Maximum execution time of a single workflow task. Default is 10 seconds.
|
|
99
|
-
*
|
|
100
|
-
* @format {@link https://www.npmjs.com/package/ms | ms} formatted string or number of milliseconds
|
|
101
|
-
*/
|
|
102
|
-
workflowTaskTimeout?: string | number;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type CommonWorkflowOptions = BaseWorkflowOptions & WorkflowDurationOptions;
|
|
106
|
-
|
|
107
|
-
export type WithCompiledWorkflowDurationOptions<T extends WorkflowDurationOptions> = Omit<
|
|
108
|
-
T,
|
|
109
|
-
'workflowExecutionTimeout' | 'workflowRunTimeout' | 'workflowTaskTimeout'
|
|
110
|
-
> & {
|
|
111
|
-
workflowExecutionTimeout?: google.protobuf.IDuration;
|
|
112
|
-
workflowRunTimeout?: google.protobuf.IDuration;
|
|
113
|
-
workflowTaskTimeout?: google.protobuf.IDuration;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export function compileWorkflowOptions<T extends WorkflowDurationOptions>(
|
|
117
|
-
options: T
|
|
118
|
-
): WithCompiledWorkflowDurationOptions<T> {
|
|
119
|
-
const { workflowExecutionTimeout, workflowRunTimeout, workflowTaskTimeout, ...rest } = options;
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
...rest,
|
|
123
|
-
workflowExecutionTimeout: workflowExecutionTimeout ? msToTs(workflowExecutionTimeout) : undefined,
|
|
124
|
-
workflowRunTimeout: workflowRunTimeout ? msToTs(workflowRunTimeout) : undefined,
|
|
125
|
-
workflowTaskTimeout: workflowTaskTimeout ? msToTs(workflowTaskTimeout) : undefined,
|
|
126
|
-
};
|
|
127
|
-
}
|