@temporalio/client 1.4.4 → 1.5.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 (57) hide show
  1. package/lib/async-completion-client.d.ts +5 -32
  2. package/lib/async-completion-client.js +6 -20
  3. package/lib/async-completion-client.js.map +1 -1
  4. package/lib/base-client.d.ts +53 -0
  5. package/lib/base-client.js +45 -0
  6. package/lib/base-client.js.map +1 -0
  7. package/lib/client.d.ts +12 -52
  8. package/lib/client.js +30 -49
  9. package/lib/client.js.map +1 -1
  10. package/lib/connection.d.ts +9 -9
  11. package/lib/connection.js +4 -3
  12. package/lib/connection.js.map +1 -1
  13. package/lib/errors.d.ts +0 -1
  14. package/lib/errors.js +1 -3
  15. package/lib/errors.js.map +1 -1
  16. package/lib/helpers.d.ts +3 -0
  17. package/lib/helpers.js +63 -0
  18. package/lib/helpers.js.map +1 -0
  19. package/lib/index.d.ts +2 -0
  20. package/lib/index.js +2 -0
  21. package/lib/index.js.map +1 -1
  22. package/lib/interceptors.d.ts +46 -10
  23. package/lib/iterators-utils.d.ts +31 -0
  24. package/lib/iterators-utils.js +80 -0
  25. package/lib/iterators-utils.js.map +1 -0
  26. package/lib/schedule-client.d.ts +175 -0
  27. package/lib/schedule-client.js +383 -0
  28. package/lib/schedule-client.js.map +1 -0
  29. package/lib/schedule-helpers.d.ts +20 -0
  30. package/lib/schedule-helpers.js +290 -0
  31. package/lib/schedule-helpers.js.map +1 -0
  32. package/lib/schedule-types.d.ts +691 -0
  33. package/lib/schedule-types.js +74 -0
  34. package/lib/schedule-types.js.map +1 -0
  35. package/lib/types.d.ts +8 -3
  36. package/lib/types.js.map +1 -1
  37. package/lib/workflow-client.d.ts +76 -59
  38. package/lib/workflow-client.js +87 -101
  39. package/lib/workflow-client.js.map +1 -1
  40. package/lib/workflow-options.d.ts +5 -1
  41. package/lib/workflow-options.js.map +1 -1
  42. package/package.json +7 -5
  43. package/src/async-completion-client.ts +16 -55
  44. package/src/base-client.ts +84 -0
  45. package/src/client.ts +41 -93
  46. package/src/connection.ts +12 -11
  47. package/src/errors.ts +0 -1
  48. package/src/helpers.ts +75 -0
  49. package/src/index.ts +2 -0
  50. package/src/interceptors.ts +54 -10
  51. package/src/iterators-utils.ts +116 -0
  52. package/src/schedule-client.ts +541 -0
  53. package/src/schedule-helpers.ts +414 -0
  54. package/src/schedule-types.ts +866 -0
  55. package/src/types.ts +12 -3
  56. package/src/workflow-client.ts +178 -180
  57. package/src/workflow-options.ts +12 -1
@@ -0,0 +1,691 @@
1
+ import { Replace, RequireAtLeastOne } from '@temporalio/common/lib/type-helpers';
2
+ import { SearchAttributes, Workflow } from '@temporalio/common';
3
+ import type { temporal } from '@temporalio/proto';
4
+ import { WorkflowStartOptions } from './workflow-options';
5
+ /**
6
+ * The specification of a Schedule to be created, as expected by {@link ScheduleClient.create}.
7
+ *
8
+ * @experimental
9
+ */
10
+ export interface ScheduleOptions {
11
+ /**
12
+ * Schedule Id
13
+ *
14
+ * We recommend using a meaningful business identifier.
15
+ */
16
+ scheduleId: string;
17
+ /**
18
+ * When Actions should be taken
19
+ */
20
+ spec: RequireAtLeastOne<ScheduleSpec, 'calendars' | 'intervals' | 'cronExpressions'>;
21
+ /**
22
+ * Which Action to take
23
+ */
24
+ action: ScheduleOptionsAction;
25
+ policies?: {
26
+ /**
27
+ * Controls what happens when an Action would be started by a Schedule at the same time that an older Action is still
28
+ * running. This can be changed after a Schedule has taken some Actions, and some changes might produce
29
+ * unintuitive results. In general, the later policy overrides the earlier policy.
30
+ *
31
+ * @default {@link ScheduleOverlapPolicy.SKIP}
32
+ */
33
+ overlap?: ScheduleOverlapPolicy;
34
+ /**
35
+ * The Temporal Server might be down or unavailable at the time when a Schedule should take an Action. When the Server
36
+ * comes back up, `catchupWindow` controls which missed Actions should be taken at that point. The default is one
37
+ * minute, which means that the Schedule attempts to take any Actions that wouldn't be more than one minute late. It
38
+ * takes those Actions according to the {@link ScheduleOverlapPolicy}. An outage that lasts longer than the Catchup
39
+ * Window could lead to missed Actions. (But you can always {@link ScheduleHandle.backfill}.)
40
+ *
41
+ * @default 1 minute
42
+ * @format number of milliseconds or {@link https://www.npmjs.com/package/ms | ms-formatted string}
43
+ */
44
+ catchupWindow?: number | string;
45
+ /**
46
+ * When an Action times out or reaches the end of its Retry Policy, {@link pause}.
47
+ *
48
+ * With {@link ScheduleOverlapPolicy.ALLOW_ALL}, this pause might not apply to the next Action, because the next Action
49
+ * might have already started previous to the failed one finishing. Pausing applies only to Actions that are scheduled
50
+ * to start after the failed one finishes.
51
+ *
52
+ * @default false
53
+ */
54
+ pauseOnFailure?: boolean;
55
+ };
56
+ /**
57
+ * Additional non-indexed information attached to the Schedule. The values can be anything that is
58
+ * serializable by the {@link DataConverter}.
59
+ */
60
+ memo?: Record<string, unknown>;
61
+ /**
62
+ * Additional indexed information attached to the Schedule. More info:
63
+ * https://docs.temporal.io/docs/typescript/search-attributes
64
+ *
65
+ * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided.
66
+ */
67
+ searchAttributes?: SearchAttributes;
68
+ /**
69
+ * The initial state of the schedule, right after creation or update.
70
+ */
71
+ state?: {
72
+ /**
73
+ * Start in paused state.
74
+ *
75
+ * @default false
76
+ */
77
+ paused?: boolean;
78
+ /**
79
+ * Informative human-readable message with contextual notes, e.g. the reason
80
+ * a Schedule is paused. The system may overwrite this message on certain
81
+ * conditions, e.g. when pause-on-failure happens.
82
+ */
83
+ note?: string;
84
+ /**
85
+ * Limit the number of Actions to take.
86
+ *
87
+ * This number is decremented after each Action is taken, and Actions are not
88
+ * taken when the number is `0` (unless {@link ScheduleHandle.trigger} is called).
89
+ *
90
+ * If `undefined`, then no such limit applies.
91
+ *
92
+ * @default undefined, which allows for unlimited exections
93
+ */
94
+ remainingActions?: number;
95
+ /**
96
+ * Trigger one Action immediately on create.
97
+ *
98
+ * @default false
99
+ */
100
+ triggerImmediately?: boolean;
101
+ /**
102
+ * Runs though the specified time periods and takes Actions as if that time passed by right now, all at once. The
103
+ * overlap policy can be overridden for the scope of the backfill.
104
+ */
105
+ backfill?: Backfill[];
106
+ };
107
+ }
108
+ /** @experimental */
109
+ export declare type CompiledScheduleOptions = Replace<ScheduleOptions, {
110
+ action: CompiledScheduleAction;
111
+ }>;
112
+ /**
113
+ * The specification of an updated Schedule, as expected by {@link ScheduleHandle.update}.
114
+ *
115
+ * @experimental
116
+ */
117
+ export declare type ScheduleUpdateOptions = Replace<Omit<ScheduleOptions, 'scheduleId' | 'memo' | 'searchAttributes'>, {
118
+ action: Replace<ScheduleOptions['action'], {
119
+ workflowId: string;
120
+ }>;
121
+ state: Omit<ScheduleOptions['state'], 'triggerImmediately' | 'backfill'>;
122
+ }>;
123
+ /** @experimental */
124
+ export declare type CompiledScheduleUpdateOptions = Replace<ScheduleUpdateOptions, {
125
+ action: CompiledScheduleAction;
126
+ }>;
127
+ /**
128
+ * A summary description of an existing Schedule, as returned by {@link ScheduleClient.list}.
129
+ *
130
+ * @experimental
131
+ */
132
+ export interface ScheduleSummary {
133
+ /**
134
+ * The Schedule Id. We recommend using a meaningful business identifier.
135
+ */
136
+ scheduleId: string;
137
+ /**
138
+ * When will Actions be taken.
139
+ */
140
+ spec: RequireAtLeastOne<ScheduleSpecDescription, 'calendars' | 'intervals'>;
141
+ /**
142
+ * The Action that will be taken.
143
+ */
144
+ action: ScheduleSummaryAction;
145
+ /**
146
+ * Additional non-indexed information attached to the Schedule.
147
+ * The values can be anything that is serializable by the {@link DataConverter}.
148
+ */
149
+ memo?: Record<string, unknown>;
150
+ /**
151
+ * Additional indexed information attached to the Schedule.
152
+ * More info: https://docs.temporal.io/docs/typescript/search-attributes
153
+ *
154
+ * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided.
155
+ */
156
+ searchAttributes: SearchAttributes;
157
+ state: {
158
+ /**
159
+ * Whether Schedule is currently paused.
160
+ */
161
+ paused: boolean;
162
+ /**
163
+ * Informative human-readable message with contextual notes, e.g. the reason a Schedule is paused.
164
+ * The system may overwrite this message on certain conditions, e.g. when pause-on-failure happens.
165
+ */
166
+ note?: string;
167
+ };
168
+ info: {
169
+ /**
170
+ * Most recent 10 Actions started (including manual triggers), sorted from older start time to newer.
171
+ */
172
+ recentActions: ScheduleExecutionResult[];
173
+ /**
174
+ * Scheduled time of the next 10 executions of this Schedule
175
+ */
176
+ nextActionTimes: Date[];
177
+ };
178
+ }
179
+ /** @experimental */
180
+ export interface ScheduleExecutionResult {
181
+ /** Time that the Action was scheduled for, including jitter */
182
+ scheduledAt: Date;
183
+ /** Time that the Action was actually taken */
184
+ takenAt: Date;
185
+ /** The Action that was taken */
186
+ action: ScheduleExecutionActionResult;
187
+ }
188
+ /** @experimental */
189
+ export declare type ScheduleExecutionActionResult = ScheduleExecutionStartWorkflowActionResult;
190
+ /** @experimental */
191
+ export interface ScheduleExecutionStartWorkflowActionResult {
192
+ type: 'startWorkflow';
193
+ workflow: {
194
+ workflowId: string;
195
+ /**
196
+ * The Run Id of the original execution that was started by the Schedule. If the Workflow retried, did
197
+ * Continue-As-New, or was Reset, the following runs would have different Run Ids.
198
+ */
199
+ firstExecutionRunId: string;
200
+ };
201
+ }
202
+ /**
203
+ * A detailed description of an exisiting Schedule, as returned by {@link ScheduleHandle.describe}.
204
+ *
205
+ * @experimental
206
+ */
207
+ export declare type ScheduleDescription = ScheduleSummary & {
208
+ /**
209
+ * The Action that will be taken.
210
+ */
211
+ action: ScheduleDescriptionAction;
212
+ policies: {
213
+ /**
214
+ * Controls what happens when an Action would be started by a Schedule at the same time that an older Action is still
215
+ * running.
216
+ */
217
+ overlap: ScheduleOverlapPolicy;
218
+ /**
219
+ * The Temporal Server might be down or unavailable at the time when a Schedule should take an Action.
220
+ * When the Server comes back up, `catchupWindow` controls which missed Actions should be taken at that point.
221
+ * It takes those Actions according to the {@link ScheduleOverlapPolicy}. An outage that lasts longer than the
222
+ * Catchup Window could lead to missed Actions. (But you can always {@link ScheduleHandle.backfill}.)
223
+ *
224
+ * Unit is miliseconds.
225
+ */
226
+ catchupWindow: number;
227
+ /**
228
+ * When an Action times out or reaches the end of its Retry Policy, {@link pause}.
229
+ *
230
+ * With {@link ScheduleOverlapPolicy.ALLOW_ALL}, this pause might not apply to the next Action, because the next Action
231
+ * might have already started previous to the failed one finishing. Pausing applies only to Actions that are scheduled
232
+ * to start after the failed one finishes.
233
+ */
234
+ pauseOnFailure: boolean;
235
+ };
236
+ state: ScheduleSummary['state'] & {
237
+ /**
238
+ * The Actions remaining in this Schedule.
239
+ * Once this number hits `0`, no further Actions are taken (unless {@link ScheduleHandle.trigger} is called).
240
+ *
241
+ * If `undefined`, then no such limit applies.
242
+ */
243
+ remainingActions?: number;
244
+ };
245
+ info: ScheduleSummary['info'] & {
246
+ /**
247
+ * Number of Actions taken so far.
248
+ */
249
+ numActionsTaken: number;
250
+ /**
251
+ * Number of times a scheduled Action was skipped due to missing the catchup window.
252
+ */
253
+ numActionsMissedCatchupWindow: number;
254
+ /**
255
+ * Number of Actions skipped due to overlap.
256
+ */
257
+ numActionsSkippedOverlap: number;
258
+ createdAt: Date;
259
+ lastUpdatedAt: Date | undefined;
260
+ /**
261
+ * Currently-running workflows started by this schedule. (There might be
262
+ * more than one if the overlap policy allows overlaps.)
263
+ */
264
+ runningActions: ScheduleExecutionActionResult[];
265
+ };
266
+ /** @internal */
267
+ raw: temporal.api.workflowservice.v1.IDescribeScheduleResponse;
268
+ };
269
+ /**
270
+ * A complete description of a set of absolute times (possibly infinite) that an Action should occur at.
271
+ * The times are the union of `calendars`, `intervals`, and `cronExpressions`, minus the `skip` times. These times
272
+ * never change, except that the definition of a time zone can change over time (most commonly, when daylight saving
273
+ * time policy changes for an area). To create a totally self-contained `ScheduleSpec`, use UTC.
274
+ *
275
+ * @experimental
276
+ */
277
+ export interface ScheduleSpec {
278
+ /** Calendar-based specifications of times. */
279
+ calendars?: CalendarSpec[];
280
+ /** Interval-based specifications of times. */
281
+ intervals?: IntervalSpec[];
282
+ /**
283
+ * [Cron expressions](https://crontab.guru/). This is provided for easy migration from legacy Cron Workflows. For new
284
+ * use cases, we recommend using {@link calendars} or {@link intervals} for readability and maintainability.
285
+ *
286
+ * For example, `0 12 * * MON-WED,FRI` is every M/Tu/W/F at noon, and is equivalent to this {@link CalendarSpec}:
287
+ *
288
+ * ```ts
289
+ * {
290
+ * hour: 12,
291
+ * dayOfWeek: [{
292
+ * start: 'MONDAY'
293
+ * end: 'WEDNESDAY'
294
+ * }, 'FRIDAY']
295
+ * }
296
+ * ```
297
+ *
298
+ * The string can have 5, 6, or 7 fields, separated by spaces, and they are interpreted in the
299
+ * same way as a {@link CalendarSpec}.
300
+ *
301
+ * - 5 fields: minute, hour, day_of_month, month, day_of_week
302
+ * - 6 fields: minute, hour, day_of_month, month, day_of_week, year
303
+ * - 7 fields: second, minute, hour, day_of_month, month, day_of_week, year
304
+ *
305
+ * Notes:
306
+ *
307
+ * - If year is not given, it defaults to *.
308
+ * - If second is not given, it defaults to 0.
309
+ * - Shorthands `@yearly`, `@monthly`, `@weekly`, `@daily`, and `@hourly` are also
310
+ * accepted instead of the 5-7 time fields.
311
+ * - `@every interval[/<phase>]` is accepted and gets compiled into an
312
+ * IntervalSpec instead. `<interval>` and `<phase>` should be a decimal integer
313
+ * with a unit suffix s, m, h, or d.
314
+ * - Optionally, the string can be preceded by `CRON_TZ=<timezone name>` or
315
+ * `TZ=<timezone name>`, which will get copied to {@link timezone}.
316
+ * (In which case the {@link timezone} field should be left empty.)
317
+ * - Optionally, "#" followed by a comment can appear at the end of the string.
318
+ * - Note that the special case that some cron implementations have for
319
+ * treating day_of_month and day_of_week as "or" instead of "and" when both
320
+ * are set is not implemented.
321
+ */
322
+ cronExpressions?: string[];
323
+ /**
324
+ * Any matching times will be skipped.
325
+ *
326
+ * All aspects of the CalendarSpec—including seconds—must match a time for the time to be skipped.
327
+ */
328
+ skip?: CalendarSpec[];
329
+ /**
330
+ * Any times before `startAt` will be skipped. Together, `startAt` and `endAt` make an inclusive interval.
331
+ *
332
+ * @default The beginning of time
333
+ */
334
+ startAt?: Date;
335
+ /**
336
+ * Any times after `endAt` will be skipped.
337
+ *
338
+ * @default The end of time
339
+ */
340
+ endAt?: Date;
341
+ /**
342
+ * All times will be incremented by a random value from 0 to this amount of jitter.
343
+ *
344
+ * @default 0
345
+ * @format number of milliseconds or {@link https://www.npmjs.com/package/ms | ms-formatted string}
346
+ */
347
+ jitter?: number | string;
348
+ /**
349
+ * IANA timezone name, for example `US/Pacific`.
350
+ *
351
+ * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
352
+ *
353
+ * The definition will be loaded by Temporal Server from the environment it runs in.
354
+ *
355
+ * Calendar spec matching is based on literal matching of the clock time
356
+ * with no special handling of DST: if you write a calendar spec that fires
357
+ * at 2:30am and specify a time zone that follows DST, that action will not
358
+ * be triggered on the day that has no 2:30am. Similarly, an action that
359
+ * fires at 1:30am will be triggered twice on the day that has two 1:30s.
360
+ *
361
+ * Also note that no actions are taken on leap-seconds (e.g. 23:59:60 UTC).
362
+ *
363
+ * @default UTC
364
+ */
365
+ timezone?: string;
366
+ }
367
+ /**
368
+ * The version of {@link ScheduleSpec} that you get back from {@link ScheduleHandle.describe} and {@link ScheduleClient.list}
369
+ *
370
+ * @experimental
371
+ */
372
+ export declare type ScheduleSpecDescription = Omit<ScheduleSpec, 'calendars' | 'intervals' | 'cronExpressions' | 'skip' | 'jitter'> & {
373
+ /** Calendar-based specifications of times. */
374
+ calendars?: CalendarSpecDescription[];
375
+ /** Interval-based specifications of times. */
376
+ intervals?: IntervalSpecDescription[];
377
+ /** Any matching times will be skipped. */
378
+ skip?: CalendarSpecDescription[];
379
+ /**
380
+ * All times will be incremented by a random value from 0 to this amount of jitter.
381
+ *
382
+ * @default 1 second
383
+ * @format number of milliseconds
384
+ */
385
+ jitter?: number;
386
+ };
387
+ /**
388
+ * An event specification relative to the calendar, similar to a traditional cron specification.
389
+ *
390
+ * A second in time matches if all fields match. This includes `dayOfMonth` and `dayOfWeek`.
391
+ *
392
+ * @experimental
393
+ */
394
+ export interface CalendarSpec {
395
+ /**
396
+ * Valid values: 0–59
397
+ *
398
+ * @default 0
399
+ */
400
+ second?: LooseRange<number> | LooseRange<number>[] | '*';
401
+ /**
402
+ * Valid values: 0–59
403
+ *
404
+ * @default 0
405
+ */
406
+ minute?: LooseRange<number> | LooseRange<number>[] | '*';
407
+ /**
408
+ * Valid values: 0–59
409
+ *
410
+ * @default 0
411
+ */
412
+ hour?: LooseRange<number> | LooseRange<number>[] | '*';
413
+ /**
414
+ * Valid values: 1–31
415
+ *
416
+ * @default '*'
417
+ */
418
+ dayOfMonth?: LooseRange<number> | LooseRange<number>[] | '*';
419
+ /**
420
+ * @default '*'
421
+ */
422
+ month?: LooseRange<Month> | LooseRange<Month>[] | '*';
423
+ /**
424
+ * Use full years, like `2030`
425
+ *
426
+ * @default '*'
427
+ */
428
+ year?: LooseRange<number> | LooseRange<number>[] | '*';
429
+ /**
430
+ * @default '*'
431
+ */
432
+ dayOfWeek?: LooseRange<DayOfWeek> | LooseRange<DayOfWeek>[] | '*';
433
+ /**
434
+ * Description of the intention of this spec.
435
+ */
436
+ comment?: string;
437
+ }
438
+ /**
439
+ * An event specification relative to the calendar, similar to a traditional cron specification.
440
+ *
441
+ * A second in time matches if all fields match. This includes `dayOfMonth` and `dayOfWeek`.
442
+ *
443
+ * @experimental
444
+ */
445
+ export interface CalendarSpecDescription {
446
+ /**
447
+ * Valid values: 0–59
448
+ *
449
+ * @default Match only when second is 0 (ie. `[{ start: 0, end: 0, step: 0 }]`)
450
+ */
451
+ second: Range<number>[];
452
+ /**
453
+ * Valid values: 0–59
454
+ *
455
+ * @default Match only when minute is 0 (ie. `[{ start: 0, end: 0, step: 0 }]`)
456
+ */
457
+ minute: Range<number>[];
458
+ /**
459
+ * Valid values: 0–23
460
+ *
461
+ * @default Match only when hour is 0 (ie. `[{ start: 0, end: 0, step: 0 }]`)
462
+ */
463
+ hour: Range<number>[];
464
+ /**
465
+ * Valid values: 1–31
466
+ *
467
+ * @default Match on any day (ie. `[{ start: 1, end: 31, step: 1 }]`)
468
+ */
469
+ dayOfMonth: Range<number>[];
470
+ /**
471
+ * Valid values are 'JANUARY' to 'DECEMBER'.
472
+ *
473
+ * @default Match on any month (ie. `[{ start: 'JANUARY', end: 'DECEMBER', step: 1 }]`)
474
+ */
475
+ month: Range<Month>[];
476
+ /**
477
+ * Use full years, like `2030`
478
+ *
479
+ * @default Match on any year
480
+ */
481
+ year: Range<number>[];
482
+ /**
483
+ * Valid values are 'SUNDAY' to 'SATURDAY'.
484
+ *
485
+ * @default Match on any day of the week (ie. `[{ start: 'SUNDAY', end: 'SATURDAY', step: 1 }]`)
486
+ */
487
+ dayOfWeek: Range<DayOfWeek>[];
488
+ /**
489
+ * Description of the intention of this spec.
490
+ */
491
+ comment?: string;
492
+ }
493
+ /**
494
+ * IntervalSpec matches times that can be expressed as:
495
+ *
496
+ * `Epoch + (n * every) + offset`
497
+ *
498
+ * where `n` is all integers ≥ 0.
499
+ *
500
+ * For example, an `every` of 1 hour with `offset` of zero would match every hour, on the hour. The same `every` but an `offset`
501
+ * of 19 minutes would match every `xx:19:00`. An `every` of 28 days with `offset` zero would match `2022-02-17T00:00:00Z`
502
+ * (among other times). The same `every` with `offset` of 3 days, 5 hours, and 23 minutes would match `2022-02-20T05:23:00Z`
503
+ * instead.
504
+ *
505
+ * @experimental
506
+ */
507
+ export interface IntervalSpec {
508
+ /**
509
+ * Value is rounded to the nearest second.
510
+ *
511
+ * @format number of milliseconds or {@link https://www.npmjs.com/package/ms | ms-formatted string}
512
+ */
513
+ every: number | string;
514
+ /**
515
+ * Value is rounded to the nearest second.
516
+ *
517
+ * @default 0
518
+ * @format number of milliseconds or {@link https://www.npmjs.com/package/ms | ms-formatted string}
519
+ */
520
+ offset?: number | string;
521
+ }
522
+ /**
523
+ * IntervalSpec matches times that can be expressed as:
524
+ *
525
+ * `Epoch + (n * every) + offset`
526
+ *
527
+ * where `n` is all integers ≥ 0.
528
+ *
529
+ * For example, an `every` of 1 hour with `offset` of zero would match every hour, on the hour. The same `every` but an `offset`
530
+ * of 19 minutes would match every `xx:19:00`. An `every` of 28 days with `offset` zero would match `2022-02-17T00:00:00Z`
531
+ * (among other times). The same `every` with `offset` of 3 days, 5 hours, and 23 minutes would match `2022-02-20T05:23:00Z`
532
+ * instead.
533
+ *
534
+ * This is the version of {@link IntervalSpec} that you get back from {@link ScheduleHandle.describe} and {@link ScheduleClient.list}
535
+ *
536
+ * @experimental
537
+ */
538
+ export interface IntervalSpecDescription {
539
+ /**
540
+ * Value is rounded to the nearest second.
541
+ *
542
+ * @format number of milliseconds
543
+ */
544
+ every: number;
545
+ /**
546
+ * Value is rounded to the nearest second.
547
+ *
548
+ * @format number of milliseconds
549
+ */
550
+ offset: number;
551
+ }
552
+ /**
553
+ * Range represents a set of values, used to match fields of a calendar. If end < start, then end is
554
+ * interpreted as equal to start. Similarly, if step is less than 1, then step is interpreted as 1.
555
+ *
556
+ * @experimental
557
+ */
558
+ export interface Range<Unit> {
559
+ /**
560
+ * Start of range (inclusive)
561
+ */
562
+ start: Unit;
563
+ /**
564
+ * End of range (inclusive)
565
+ *
566
+ * @default `start`
567
+ */
568
+ end: Unit;
569
+ /**
570
+ * The step to take between each value.
571
+ *
572
+ * @default 1
573
+ */
574
+ step: number;
575
+ }
576
+ /**
577
+ * A {@link Range} definition, with support for loose syntax.
578
+ *
579
+ * For example:
580
+ * ```
581
+ * 3 ➡️ 3
582
+ * { start: 2 } ➡️ 2
583
+ * { start: 2, end: 4 } ➡️ 2, 3, 4
584
+ * { start: 2, end: 10, step: 3 } ➡️ 2, 5, 8
585
+ * ```
586
+ *
587
+ * @experimental
588
+ */
589
+ export declare type LooseRange<Unit> = Range<Unit> | {
590
+ start: Range<Unit>['start'];
591
+ end?: Range<Unit>['end'];
592
+ step?: never;
593
+ } | Unit;
594
+ /** @experimental */
595
+ export declare const MONTHS: readonly ["JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"];
596
+ /** @experimental */
597
+ export declare type Month = typeof MONTHS[number];
598
+ /** @experimental */
599
+ export declare const DAYS_OF_WEEK: readonly ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"];
600
+ /** @experimental */
601
+ export declare type DayOfWeek = typeof DAYS_OF_WEEK[number];
602
+ /** @experimental */
603
+ export declare type ScheduleOptionsAction = ScheduleOptionsStartWorkflowAction<Workflow>;
604
+ /** @experimental */
605
+ export declare type ScheduleOptionsStartWorkflowAction<W extends Workflow> = {
606
+ type: 'startWorkflow';
607
+ workflowType: string | W;
608
+ } & Pick<WorkflowStartOptions<W>, 'taskQueue' | 'args' | 'memo' | 'searchAttributes' | 'retry' | 'workflowExecutionTimeout' | 'workflowRunTimeout' | 'workflowTaskTimeout'> & {
609
+ /**
610
+ * Workflow id to use when starting. Assign a meaningful business id.
611
+ * This ID can be used to ensure starting Workflows is idempotent.
612
+ *
613
+ * @default `${scheduleId}-workflow`
614
+ */
615
+ workflowId?: string;
616
+ };
617
+ /** @experimental */
618
+ export declare type ScheduleSummaryAction = ScheduleSummaryStartWorkflowAction;
619
+ /** @experimental */
620
+ export interface ScheduleSummaryStartWorkflowAction {
621
+ type: 'startWorkflow';
622
+ workflowType: string;
623
+ }
624
+ /** @experimental */
625
+ export declare type ScheduleDescriptionAction = ScheduleDescriptionStartWorkflowAction;
626
+ /** @experimental */
627
+ export declare type ScheduleDescriptionStartWorkflowAction = ScheduleSummaryStartWorkflowAction & Pick<WorkflowStartOptions<Workflow>, 'taskQueue' | 'workflowId' | 'args' | 'memo' | 'searchAttributes' | 'retry' | 'workflowExecutionTimeout' | 'workflowRunTimeout' | 'workflowTaskTimeout'>;
628
+ /** @experimental */
629
+ export declare type CompiledScheduleAction = Replace<ScheduleDescriptionAction, {
630
+ workflowType: string;
631
+ args: unknown[];
632
+ }>;
633
+ /**
634
+ * Policy for overlapping Actions.
635
+ *
636
+ * @experimental
637
+ */
638
+ export declare enum ScheduleOverlapPolicy {
639
+ /**
640
+ * Use server default (currently SKIP).
641
+ *
642
+ * FIXME: remove this field if this issue is implemented: https://github.com/temporalio/temporal/issues/3240
643
+ */
644
+ UNSPECIFIED = 0,
645
+ /**
646
+ * Don't start a new Action.
647
+ */
648
+ SKIP = 1,
649
+ /**
650
+ * Start another Action as soon as the current Action completes, but only buffer one Action in this way. If another
651
+ * Action is supposed to start, but one Action is running and one is already buffered, then only the buffered one will
652
+ * be started after the running Action finishes.
653
+ */
654
+ BUFFER_ONE = 2,
655
+ /**
656
+ * Allows an unlimited number of Actions to buffer. They are started sequentially.
657
+ */
658
+ BUFFER_ALL = 3,
659
+ /**
660
+ * Cancels the running Action, and then starts the new Action once the cancelled one completes.
661
+ */
662
+ CANCEL_OTHER = 4,
663
+ /**
664
+ * Terminate the running Action and start the new Action immediately.
665
+ */
666
+ TERMINATE_OTHER = 5,
667
+ /**
668
+ * Allow any number of Actions to start immediately.
669
+ *
670
+ * This is the only policy under which multiple Actions can run concurrently.
671
+ */
672
+ ALLOW_ALL = 6
673
+ }
674
+ export declare type ScheduleOverlapPolicy2 = keyof typeof temporal.api.enums.v1.ScheduleOverlapPolicy;
675
+ /** @experimental */
676
+ export interface Backfill {
677
+ /**
678
+ * Start of the time range to evaluate Schedule in.
679
+ */
680
+ start: Date;
681
+ /**
682
+ * End of the time range to evaluate Schedule in.
683
+ */
684
+ end: Date;
685
+ /**
686
+ * Override the Overlap Policy for this request.
687
+ *
688
+ * @default SKIP
689
+ */
690
+ overlap?: ScheduleOverlapPolicy;
691
+ }