@hatchet-dev/typescript-sdk 1.16.0 → 1.17.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.
Files changed (97) hide show
  1. package/README.md +14 -2
  2. package/clients/admin/admin-client.d.ts +2 -2
  3. package/clients/dispatcher/action-listener.d.ts +3 -6
  4. package/clients/dispatcher/action-listener.js +12 -17
  5. package/clients/listeners/durable-listener/durable-listener-client.d.ts +116 -15
  6. package/clients/listeners/durable-listener/durable-listener-client.js +770 -19
  7. package/clients/listeners/durable-listener/pooled-durable-listener-client.js +1 -14
  8. package/clients/listeners/run-listener/pooled-child-listener-client.js +1 -14
  9. package/clients/rest/generated/Api.d.ts +5 -1
  10. package/clients/rest/generated/data-contracts.d.ts +16 -2
  11. package/clients/rest/generated/data-contracts.js +7 -3
  12. package/legacy/examples/affinity-workers.js +2 -2
  13. package/legacy/legacy-client.js +1 -1
  14. package/legacy/step.d.ts +2 -2
  15. package/legacy/step.js +3 -2
  16. package/legacy/workflow.d.ts +25 -25
  17. package/package.json +1 -1
  18. package/protoc/dispatcher/dispatcher.d.ts +20 -0
  19. package/protoc/dispatcher/dispatcher.js +535 -100
  20. package/protoc/events/events.js +54 -14
  21. package/protoc/google/protobuf/timestamp.js +1 -1
  22. package/protoc/v1/dispatcher.d.ts +169 -0
  23. package/protoc/v1/dispatcher.js +2096 -8
  24. package/protoc/v1/shared/condition.js +37 -11
  25. package/protoc/v1/shared/trigger.d.ts +89 -0
  26. package/protoc/v1/shared/trigger.js +524 -0
  27. package/protoc/v1/workflows.d.ts +34 -34
  28. package/protoc/v1/workflows.js +452 -254
  29. package/protoc/workflows/workflows.d.ts +2 -75
  30. package/protoc/workflows/workflows.js +157 -529
  31. package/util/abort-error.d.ts +10 -0
  32. package/util/abort-error.js +15 -0
  33. package/util/errors/eviction-not-supported-error.d.ts +5 -0
  34. package/util/errors/eviction-not-supported-error.js +18 -0
  35. package/util/errors/non-determinism-error.d.ts +7 -0
  36. package/util/errors/non-determinism-error.js +21 -0
  37. package/util/errors/task-run-terminated-error.d.ts +6 -0
  38. package/util/errors/task-run-terminated-error.js +15 -0
  39. package/util/hatchet-promise/hatchet-promise.d.ts +2 -1
  40. package/util/hatchet-promise/hatchet-promise.js +10 -1
  41. package/util/sleep.d.ts +3 -2
  42. package/util/sleep.js +6 -4
  43. package/v1/client/admin.d.ts +2 -2
  44. package/v1/client/client.js +1 -1
  45. package/v1/client/duration.d.ts +11 -1
  46. package/v1/client/duration.js +44 -0
  47. package/v1/client/features/runs.d.ts +16 -3
  48. package/v1/client/features/runs.js +38 -3
  49. package/v1/client/worker/context.d.ts +101 -6
  50. package/v1/client/worker/context.js +247 -21
  51. package/v1/client/worker/deprecated/index.d.ts +1 -1
  52. package/v1/client/worker/deprecated/index.js +2 -1
  53. package/v1/client/worker/deprecated/legacy-worker.d.ts +5 -0
  54. package/v1/client/worker/deprecated/legacy-worker.js +32 -23
  55. package/v1/client/worker/deprecated/pre-eviction.d.ts +12 -0
  56. package/v1/client/worker/deprecated/pre-eviction.js +37 -0
  57. package/v1/client/worker/engine-version.d.ts +5 -0
  58. package/v1/client/worker/engine-version.js +14 -0
  59. package/v1/client/worker/eviction/eviction-cache.d.ts +33 -0
  60. package/v1/client/worker/eviction/eviction-cache.js +139 -0
  61. package/v1/client/worker/eviction/eviction-manager.d.ts +42 -0
  62. package/v1/client/worker/eviction/eviction-manager.js +132 -0
  63. package/v1/client/worker/eviction/eviction-policy.d.ts +19 -0
  64. package/v1/client/worker/eviction/eviction-policy.js +8 -0
  65. package/v1/client/worker/eviction/index.d.ts +3 -0
  66. package/v1/client/worker/eviction/index.js +11 -0
  67. package/v1/client/worker/worker-internal.d.ts +23 -4
  68. package/v1/client/worker/worker-internal.js +177 -138
  69. package/v1/client/worker/worker.d.ts +1 -0
  70. package/v1/client/worker/worker.js +34 -1
  71. package/v1/conditions/sleep-condition.js +2 -1
  72. package/v1/conditions/transformer.js +2 -1
  73. package/v1/declaration.d.ts +5 -3
  74. package/v1/declaration.js +8 -0
  75. package/v1/examples/__e2e__/harness.d.ts +5 -0
  76. package/v1/examples/__e2e__/harness.js +13 -0
  77. package/v1/examples/concurrency_workflow_level/workflow.d.ts +1 -1
  78. package/v1/examples/concurrency_workflow_level/workflow.js +1 -1
  79. package/v1/examples/durable/workflow.d.ts +57 -0
  80. package/v1/examples/durable/workflow.js +162 -7
  81. package/v1/examples/durable-event/workflow.js +2 -7
  82. package/v1/examples/durable_event/workflow.d.ts +1 -0
  83. package/v1/examples/durable_event/workflow.js +4 -9
  84. package/v1/examples/durable_eviction/capacity-worker.d.ts +1 -0
  85. package/v1/examples/durable_eviction/capacity-worker.js +31 -0
  86. package/v1/examples/durable_eviction/worker.d.ts +1 -0
  87. package/v1/examples/durable_eviction/worker.js +34 -0
  88. package/v1/examples/durable_eviction/workflow.d.ts +44 -0
  89. package/v1/examples/durable_eviction/workflow.js +129 -0
  90. package/v1/examples/e2e-worker.js +42 -19
  91. package/v1/index.d.ts +5 -0
  92. package/v1/index.js +10 -0
  93. package/v1/parent-run-context-vars.d.ts +6 -0
  94. package/v1/task.d.ts +10 -2
  95. package/v1/task.js +2 -1
  96. package/version.d.ts +1 -1
  97. package/version.js +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
- // protoc-gen-ts_proto v2.7.7
4
+ // protoc-gen-ts_proto v2.11.4
5
5
  // protoc v3.19.1
6
6
  // source: v1/shared/condition.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -120,9 +120,15 @@ exports.BaseMatchCondition = {
120
120
  return {
121
121
  readableDataKey: isSet(object.readableDataKey)
122
122
  ? globalThis.String(object.readableDataKey)
123
- : '',
123
+ : isSet(object.readable_data_key)
124
+ ? globalThis.String(object.readable_data_key)
125
+ : '',
124
126
  action: isSet(object.action) ? actionFromJSON(object.action) : 0,
125
- orGroupId: isSet(object.orGroupId) ? globalThis.String(object.orGroupId) : '',
127
+ orGroupId: isSet(object.orGroupId)
128
+ ? globalThis.String(object.orGroupId)
129
+ : isSet(object.or_group_id)
130
+ ? globalThis.String(object.or_group_id)
131
+ : '',
126
132
  expression: isSet(object.expression) ? globalThis.String(object.expression) : '',
127
133
  };
128
134
  },
@@ -202,7 +208,9 @@ exports.ParentOverrideMatchCondition = {
202
208
  base: isSet(object.base) ? exports.BaseMatchCondition.fromJSON(object.base) : undefined,
203
209
  parentReadableId: isSet(object.parentReadableId)
204
210
  ? globalThis.String(object.parentReadableId)
205
- : '',
211
+ : isSet(object.parent_readable_id)
212
+ ? globalThis.String(object.parent_readable_id)
213
+ : '',
206
214
  };
207
215
  },
208
216
  toJSON(message) {
@@ -274,7 +282,11 @@ exports.SleepMatchCondition = {
274
282
  fromJSON(object) {
275
283
  return {
276
284
  base: isSet(object.base) ? exports.BaseMatchCondition.fromJSON(object.base) : undefined,
277
- sleepFor: isSet(object.sleepFor) ? globalThis.String(object.sleepFor) : '',
285
+ sleepFor: isSet(object.sleepFor)
286
+ ? globalThis.String(object.sleepFor)
287
+ : isSet(object.sleep_for)
288
+ ? globalThis.String(object.sleep_for)
289
+ : '',
278
290
  };
279
291
  },
280
292
  toJSON(message) {
@@ -346,7 +358,11 @@ exports.UserEventMatchCondition = {
346
358
  fromJSON(object) {
347
359
  return {
348
360
  base: isSet(object.base) ? exports.BaseMatchCondition.fromJSON(object.base) : undefined,
349
- userEventKey: isSet(object.userEventKey) ? globalThis.String(object.userEventKey) : '',
361
+ userEventKey: isSet(object.userEventKey)
362
+ ? globalThis.String(object.userEventKey)
363
+ : isSet(object.user_event_key)
364
+ ? globalThis.String(object.user_event_key)
365
+ : '',
350
366
  };
351
367
  },
352
368
  toJSON(message) {
@@ -429,13 +445,19 @@ exports.TaskConditions = {
429
445
  return {
430
446
  parentOverrideConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.parentOverrideConditions)
431
447
  ? object.parentOverrideConditions.map((e) => exports.ParentOverrideMatchCondition.fromJSON(e))
432
- : [],
448
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.parent_override_conditions)
449
+ ? object.parent_override_conditions.map((e) => exports.ParentOverrideMatchCondition.fromJSON(e))
450
+ : [],
433
451
  sleepConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sleepConditions)
434
452
  ? object.sleepConditions.map((e) => exports.SleepMatchCondition.fromJSON(e))
435
- : [],
453
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sleep_conditions)
454
+ ? object.sleep_conditions.map((e) => exports.SleepMatchCondition.fromJSON(e))
455
+ : [],
436
456
  userEventConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.userEventConditions)
437
457
  ? object.userEventConditions.map((e) => exports.UserEventMatchCondition.fromJSON(e))
438
- : [],
458
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_event_conditions)
459
+ ? object.user_event_conditions.map((e) => exports.UserEventMatchCondition.fromJSON(e))
460
+ : [],
439
461
  };
440
462
  },
441
463
  toJSON(message) {
@@ -514,10 +536,14 @@ exports.DurableEventListenerConditions = {
514
536
  return {
515
537
  sleepConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sleepConditions)
516
538
  ? object.sleepConditions.map((e) => exports.SleepMatchCondition.fromJSON(e))
517
- : [],
539
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sleep_conditions)
540
+ ? object.sleep_conditions.map((e) => exports.SleepMatchCondition.fromJSON(e))
541
+ : [],
518
542
  userEventConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.userEventConditions)
519
543
  ? object.userEventConditions.map((e) => exports.UserEventMatchCondition.fromJSON(e))
520
- : [],
544
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_event_conditions)
545
+ ? object.user_event_conditions.map((e) => exports.UserEventMatchCondition.fromJSON(e))
546
+ : [],
521
547
  };
522
548
  },
523
549
  toJSON(message) {
@@ -0,0 +1,89 @@
1
+ import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
2
+ export declare const protobufPackage = "v1";
3
+ export declare enum WorkerLabelComparator {
4
+ EQUAL = 0,
5
+ NOT_EQUAL = 1,
6
+ GREATER_THAN = 2,
7
+ GREATER_THAN_OR_EQUAL = 3,
8
+ LESS_THAN = 4,
9
+ LESS_THAN_OR_EQUAL = 5,
10
+ UNRECOGNIZED = -1
11
+ }
12
+ export declare function workerLabelComparatorFromJSON(object: any): WorkerLabelComparator;
13
+ export declare function workerLabelComparatorToJSON(object: WorkerLabelComparator): string;
14
+ export interface DesiredWorkerLabels {
15
+ /** value of the affinity */
16
+ strValue?: string | undefined;
17
+ intValue?: number | undefined;
18
+ /**
19
+ * (optional) Specifies whether the affinity setting is required.
20
+ * If required, the worker will not accept actions that do not have a truthy affinity setting.
21
+ *
22
+ * Defaults to false.
23
+ */
24
+ required?: boolean | undefined;
25
+ /**
26
+ * (optional) Specifies the comparator for the affinity setting.
27
+ * If not set, the default is EQUAL.
28
+ */
29
+ comparator?: WorkerLabelComparator | undefined;
30
+ /**
31
+ * (optional) Specifies the weight of the affinity setting.
32
+ * If not set, the default is 100.
33
+ */
34
+ weight?: number | undefined;
35
+ }
36
+ export interface TriggerWorkflowRequest {
37
+ name: string;
38
+ /** (optional) the input data for the workflow */
39
+ input: string;
40
+ /** (optional) the parent workflow run id */
41
+ parentId?: string | undefined;
42
+ /** (optional) the parent task external run id */
43
+ parentTaskRunExternalId?: string | undefined;
44
+ /**
45
+ * (optional) the index of the child workflow. if this is set, matches on the index or the
46
+ * child key will return an existing workflow run if the parent id, parent task run id, and
47
+ * child index/key match an existing workflow run.
48
+ */
49
+ childIndex?: number | undefined;
50
+ /**
51
+ * (optional) the key for the child. if this is set, matches on the index or the
52
+ * child key will return an existing workflow run if the parent id, parent task run id, and
53
+ * child index/key match an existing workflow run.
54
+ */
55
+ childKey?: string | undefined;
56
+ /** (optional) additional metadata for the workflow */
57
+ additionalMetadata?: string | undefined;
58
+ /**
59
+ * (optional) desired worker id for the workflow run,
60
+ * requires the workflow definition to have a sticky strategy
61
+ */
62
+ desiredWorkerId?: string | undefined;
63
+ /** (optional) override for the priority of the workflow tasks, will set all tasks to this priority */
64
+ priority?: number | undefined;
65
+ /** (optional) the desired worker labels for the workflow run, which will be used to determine which workers can pick up the workflow's tasks. if not set, defaults to an empty set of labels, which means any worker can pick up the tasks. */
66
+ desiredWorkerLabels: {
67
+ [key: string]: DesiredWorkerLabels;
68
+ };
69
+ }
70
+ export interface TriggerWorkflowRequest_DesiredWorkerLabelsEntry {
71
+ key: string;
72
+ value: DesiredWorkerLabels | undefined;
73
+ }
74
+ export declare const DesiredWorkerLabels: MessageFns<DesiredWorkerLabels>;
75
+ export declare const TriggerWorkflowRequest: MessageFns<TriggerWorkflowRequest>;
76
+ export declare const TriggerWorkflowRequest_DesiredWorkerLabelsEntry: MessageFns<TriggerWorkflowRequest_DesiredWorkerLabelsEntry>;
77
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
78
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
79
+ [K in keyof T]?: DeepPartial<T[K]>;
80
+ } : Partial<T>;
81
+ export interface MessageFns<T> {
82
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
83
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
84
+ fromJSON(object: any): T;
85
+ toJSON(message: T): unknown;
86
+ create(base?: DeepPartial<T>): T;
87
+ fromPartial(object: DeepPartial<T>): T;
88
+ }
89
+ export {};