@hatchet-dev/typescript-sdk 1.0.0-alpha1 → 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 (194) hide show
  1. package/clients/admin/admin-client.d.ts +15 -20
  2. package/clients/admin/admin-client.js +21 -17
  3. package/clients/hatchet-client/hatchet-client.d.ts +5 -4
  4. package/clients/hatchet-client/hatchet-client.js +6 -4
  5. package/clients/listeners/durable-listener/durable-listener-client.d.ts +25 -0
  6. package/clients/listeners/durable-listener/durable-listener-client.js +30 -0
  7. package/clients/listeners/durable-listener/pooled-durable-listener-client.d.ts +43 -0
  8. package/clients/listeners/durable-listener/pooled-durable-listener-client.js +241 -0
  9. package/clients/{listener/listener-client.d.ts → listeners/run-listener/child-listener-client.d.ts} +8 -8
  10. package/clients/{listener/listener-client.js → listeners/run-listener/child-listener-client.js} +8 -19
  11. package/clients/{listener/child-listener-client.d.ts → listeners/run-listener/pooled-child-listener-client.d.ts} +5 -5
  12. package/clients/{listener/child-listener-client.js → listeners/run-listener/pooled-child-listener-client.js} +5 -5
  13. package/clients/rest/generated/Api.d.ts +49 -2
  14. package/clients/rest/generated/Api.js +30 -0
  15. package/clients/rest/generated/data-contracts.d.ts +88 -82
  16. package/clients/rest/generated/data-contracts.js +8 -1
  17. package/clients/worker/worker.d.ts +5 -1
  18. package/clients/worker/worker.js +173 -2
  19. package/examples/affinity-workers.js +5 -1
  20. package/examples/api.js +1 -1
  21. package/examples/bulk-fanout-worker.js +1 -1
  22. package/examples/byo-logger.js +4 -0
  23. package/examples/concurrency/cancel-in-progress/concurrency-event.js +2 -2
  24. package/examples/concurrency/group-round-robin/concurrency-event.js +1 -1
  25. package/examples/crons/programatic-crons.js +4 -4
  26. package/examples/dag-worker.js +0 -1
  27. package/examples/example-event.js +2 -2
  28. package/examples/logger.js +2 -0
  29. package/examples/on-failure.js +1 -1
  30. package/examples/rate-limit/events.js +3 -3
  31. package/examples/scheduled-runs/programatic-schedules.js +4 -4
  32. package/examples/sticky-worker-with-check.js +2 -2
  33. package/examples/sticky-worker.js +5 -0
  34. package/index.d.ts +1 -3
  35. package/index.js +1 -3
  36. package/package.json +2 -2
  37. package/protoc/dispatcher/dispatcher.d.ts +2 -0
  38. package/protoc/dispatcher/dispatcher.js +1 -1
  39. package/protoc/events/events.js +1 -1
  40. package/protoc/google/protobuf/timestamp.js +1 -1
  41. package/protoc/v1/dispatcher.d.ts +77 -0
  42. package/protoc/v1/dispatcher.js +341 -0
  43. package/protoc/v1/shared/condition.d.ts +59 -0
  44. package/protoc/v1/shared/condition.js +549 -0
  45. package/protoc/v1/workflows.d.ts +263 -0
  46. package/protoc/v1/workflows.js +1823 -0
  47. package/protoc/workflows/workflows.js +1 -1
  48. package/step.d.ts +173 -47
  49. package/step.js +208 -64
  50. package/util/sleep.d.ts +7 -0
  51. package/util/sleep.js +7 -0
  52. package/util/workflow-run-ref.d.ts +8 -2
  53. package/util/workflow-run-ref.js +13 -0
  54. package/v1/client/client.d.ts +125 -7
  55. package/v1/client/client.interface.d.ts +9 -1
  56. package/v1/client/client.js +148 -17
  57. package/v1/client/duration.d.ts +7 -0
  58. package/v1/client/duration.js +2 -0
  59. package/v1/client/features/index.d.ts +5 -0
  60. package/v1/client/features/index.js +21 -0
  61. package/v1/client/features/metrics.d.ts +14 -0
  62. package/v1/client/features/metrics.js +45 -0
  63. package/v1/client/features/ratelimits.d.ts +20 -0
  64. package/v1/client/features/ratelimits.js +40 -0
  65. package/v1/client/features/runs.d.ts +15 -0
  66. package/v1/client/features/runs.js +60 -0
  67. package/v1/client/features/workers.d.ts +14 -0
  68. package/v1/client/features/workers.js +56 -0
  69. package/v1/client/features/workflows.d.ts +17 -0
  70. package/v1/client/features/workflows.js +93 -0
  71. package/v1/client/worker.d.ts +25 -15
  72. package/v1/client/worker.js +76 -47
  73. package/v1/conditions/base.d.ts +18 -0
  74. package/v1/conditions/base.js +18 -0
  75. package/v1/conditions/index.d.ts +31 -0
  76. package/v1/conditions/index.js +91 -0
  77. package/v1/conditions/parent-condition.d.ts +40 -0
  78. package/v1/conditions/parent-condition.js +36 -0
  79. package/v1/conditions/sleep-condition.d.ts +47 -0
  80. package/v1/conditions/sleep-condition.js +38 -0
  81. package/v1/conditions/transformer.d.ts +5 -0
  82. package/v1/conditions/transformer.js +52 -0
  83. package/v1/conditions/user-event-condition.d.ts +50 -0
  84. package/v1/conditions/user-event-condition.js +39 -0
  85. package/v1/declaration.d.ts +309 -0
  86. package/v1/declaration.js +296 -0
  87. package/v1/examples/child_workflows/worker.js +2 -2
  88. package/v1/examples/child_workflows/workflow.d.ts +2 -2
  89. package/v1/examples/child_workflows/workflow.js +5 -3
  90. package/v1/examples/concurrency-rr/load.js +2 -2
  91. package/v1/examples/concurrency-rr/worker.js +2 -2
  92. package/v1/examples/concurrency-rr/workflow.d.ts +1 -1
  93. package/v1/examples/concurrency-rr/workflow.js +2 -3
  94. package/v1/examples/dag/worker.js +2 -2
  95. package/v1/examples/dag/workflow.d.ts +1 -1
  96. package/v1/examples/dag/workflow.js +3 -3
  97. package/v1/examples/dag_match_condition/event.js +28 -0
  98. package/v1/examples/dag_match_condition/run.d.ts +1 -0
  99. package/v1/examples/dag_match_condition/run.js +25 -0
  100. package/v1/examples/dag_match_condition/worker.d.ts +1 -0
  101. package/{examples/playground.js → v1/examples/dag_match_condition/worker.js} +7 -22
  102. package/v1/examples/dag_match_condition/workflow.d.ts +11 -0
  103. package/v1/examples/dag_match_condition/workflow.js +41 -0
  104. package/v1/examples/deep/worker.js +2 -2
  105. package/v1/examples/deep/workflow.d.ts +6 -6
  106. package/v1/examples/deep/workflow.js +7 -7
  107. package/v1/examples/durable-sleep/event.d.ts +1 -0
  108. package/v1/examples/durable-sleep/event.js +28 -0
  109. package/v1/examples/durable-sleep/run.d.ts +1 -0
  110. package/v1/examples/durable-sleep/run.js +30 -0
  111. package/v1/examples/durable-sleep/worker.d.ts +1 -0
  112. package/v1/examples/durable-sleep/worker.js +24 -0
  113. package/v1/examples/durable-sleep/workflow.d.ts +1 -0
  114. package/v1/examples/durable-sleep/workflow.js +37 -0
  115. package/v1/examples/inferred-typing/run.d.ts +1 -0
  116. package/v1/examples/inferred-typing/run.js +41 -0
  117. package/v1/examples/inferred-typing/worker.d.ts +1 -0
  118. package/v1/examples/inferred-typing/worker.js +24 -0
  119. package/v1/examples/inferred-typing/workflow.d.ts +15 -0
  120. package/v1/examples/inferred-typing/workflow.js +44 -0
  121. package/v1/examples/landing_page/durable-excution.d.ts +3 -0
  122. package/v1/examples/landing_page/durable-excution.js +40 -0
  123. package/v1/examples/landing_page/event-signaling.d.ts +6 -0
  124. package/v1/examples/landing_page/event-signaling.js +16 -0
  125. package/v1/examples/landing_page/flow-control.d.ts +6 -0
  126. package/v1/examples/landing_page/flow-control.js +26 -0
  127. package/v1/examples/landing_page/queues.d.ts +3 -0
  128. package/v1/examples/landing_page/queues.js +33 -0
  129. package/v1/examples/landing_page/scheduling.d.ts +1 -0
  130. package/v1/examples/landing_page/scheduling.js +12 -0
  131. package/v1/examples/landing_page/task-routing.d.ts +6 -0
  132. package/v1/examples/landing_page/task-routing.js +25 -0
  133. package/v1/examples/legacy/run.js +2 -2
  134. package/v1/examples/legacy/worker.js +2 -2
  135. package/v1/examples/on_cron/worker.d.ts +1 -0
  136. package/v1/examples/on_cron/worker.js +24 -0
  137. package/v1/examples/on_cron/workflow.d.ts +10 -0
  138. package/v1/examples/on_cron/workflow.js +21 -0
  139. package/v1/examples/on_event/event.js +3 -2
  140. package/v1/examples/on_event/worker.js +2 -2
  141. package/v1/examples/on_event/workflow.d.ts +4 -4
  142. package/v1/examples/on_event/workflow.js +6 -3
  143. package/v1/examples/on_event copy/event.d.ts +1 -0
  144. package/v1/examples/on_event copy/event.js +26 -0
  145. package/v1/examples/on_event copy/worker.d.ts +1 -0
  146. package/v1/examples/on_event copy/worker.js +24 -0
  147. package/v1/examples/on_event copy/workflow.d.ts +16 -0
  148. package/v1/examples/on_event copy/workflow.js +35 -0
  149. package/v1/examples/on_failure/worker.js +2 -2
  150. package/v1/examples/on_failure/workflow.d.ts +1 -1
  151. package/v1/examples/on_failure/workflow.js +18 -8
  152. package/v1/examples/on_success/run.d.ts +1 -0
  153. package/v1/examples/on_success/run.js +31 -0
  154. package/v1/examples/on_success/worker.d.ts +1 -0
  155. package/v1/examples/on_success/worker.js +24 -0
  156. package/v1/examples/on_success/workflow.d.ts +4 -0
  157. package/v1/examples/on_success/workflow.js +59 -0
  158. package/v1/examples/retries/run.d.ts +1 -0
  159. package/v1/examples/retries/run.js +29 -0
  160. package/v1/examples/retries/worker.d.ts +1 -0
  161. package/v1/examples/retries/worker.js +24 -0
  162. package/v1/examples/retries/workflow.d.ts +5 -0
  163. package/v1/examples/retries/workflow.js +53 -0
  164. package/v1/examples/simple/client-run.d.ts +1 -0
  165. package/v1/examples/simple/client-run.js +16 -0
  166. package/v1/examples/simple/cron.js +6 -2
  167. package/v1/examples/simple/delay.js +2 -2
  168. package/v1/examples/simple/enqueue.d.ts +1 -0
  169. package/v1/examples/simple/enqueue.js +43 -0
  170. package/v1/examples/simple/run.js +8 -3
  171. package/v1/examples/simple/schedule.js +11 -5
  172. package/v1/examples/simple/stub-workflow.d.ts +9 -0
  173. package/v1/examples/simple/stub-workflow.js +17 -0
  174. package/v1/examples/simple/worker.js +7 -2
  175. package/v1/examples/simple/workflow.d.ts +4 -3
  176. package/v1/examples/simple/workflow.js +5 -5
  177. package/v1/examples/sticky/run.d.ts +1 -0
  178. package/v1/examples/sticky/run.js +29 -0
  179. package/v1/examples/sticky/worker.d.ts +1 -0
  180. package/v1/examples/sticky/worker.js +24 -0
  181. package/v1/examples/sticky/workflow.d.ts +7 -0
  182. package/v1/examples/sticky/workflow.js +32 -0
  183. package/v1/examples/with_timeouts/workflow.d.ts +9 -0
  184. package/v1/examples/with_timeouts/workflow.js +62 -0
  185. package/v1/index.d.ts +5 -0
  186. package/v1/index.js +20 -0
  187. package/v1/task.d.ts +144 -14
  188. package/version.d.ts +1 -1
  189. package/version.js +1 -1
  190. package/v1/workflow.d.ts +0 -158
  191. package/v1/workflow.js +0 -145
  192. /package/{examples/playground.d.ts → v1/examples/dag_match_condition/event.d.ts} +0 -0
  193. /package/v1/examples/{client.d.ts → hatchet-client.d.ts} +0 -0
  194. /package/v1/examples/{client.js → hatchet-client.js} +0 -0
@@ -0,0 +1,549 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.6.1
5
+ // protoc v3.19.1
6
+ // source: v1/shared/condition.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.DurableEventListenerConditions = exports.TaskConditions = exports.UserEventMatchCondition = exports.SleepMatchCondition = exports.ParentOverrideMatchCondition = exports.BaseMatchCondition = exports.Action = exports.protobufPackage = void 0;
9
+ exports.actionFromJSON = actionFromJSON;
10
+ exports.actionToJSON = actionToJSON;
11
+ /* eslint-disable */
12
+ const wire_1 = require("@bufbuild/protobuf/wire");
13
+ exports.protobufPackage = 'v1';
14
+ var Action;
15
+ (function (Action) {
16
+ Action[Action["CREATE"] = 0] = "CREATE";
17
+ Action[Action["QUEUE"] = 1] = "QUEUE";
18
+ Action[Action["CANCEL"] = 2] = "CANCEL";
19
+ Action[Action["SKIP"] = 3] = "SKIP";
20
+ Action[Action["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
21
+ })(Action || (exports.Action = Action = {}));
22
+ function actionFromJSON(object) {
23
+ switch (object) {
24
+ case 0:
25
+ case 'CREATE':
26
+ return Action.CREATE;
27
+ case 1:
28
+ case 'QUEUE':
29
+ return Action.QUEUE;
30
+ case 2:
31
+ case 'CANCEL':
32
+ return Action.CANCEL;
33
+ case 3:
34
+ case 'SKIP':
35
+ return Action.SKIP;
36
+ case -1:
37
+ case 'UNRECOGNIZED':
38
+ default:
39
+ return Action.UNRECOGNIZED;
40
+ }
41
+ }
42
+ function actionToJSON(object) {
43
+ switch (object) {
44
+ case Action.CREATE:
45
+ return 'CREATE';
46
+ case Action.QUEUE:
47
+ return 'QUEUE';
48
+ case Action.CANCEL:
49
+ return 'CANCEL';
50
+ case Action.SKIP:
51
+ return 'SKIP';
52
+ case Action.UNRECOGNIZED:
53
+ default:
54
+ return 'UNRECOGNIZED';
55
+ }
56
+ }
57
+ function createBaseBaseMatchCondition() {
58
+ return { readableDataKey: '', action: 0, orGroupId: '', expression: '' };
59
+ }
60
+ exports.BaseMatchCondition = {
61
+ encode(message, writer = new wire_1.BinaryWriter()) {
62
+ if (message.readableDataKey !== '') {
63
+ writer.uint32(10).string(message.readableDataKey);
64
+ }
65
+ if (message.action !== 0) {
66
+ writer.uint32(16).int32(message.action);
67
+ }
68
+ if (message.orGroupId !== '') {
69
+ writer.uint32(26).string(message.orGroupId);
70
+ }
71
+ if (message.expression !== '') {
72
+ writer.uint32(34).string(message.expression);
73
+ }
74
+ return writer;
75
+ },
76
+ decode(input, length) {
77
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
78
+ let end = length === undefined ? reader.len : reader.pos + length;
79
+ const message = createBaseBaseMatchCondition();
80
+ while (reader.pos < end) {
81
+ const tag = reader.uint32();
82
+ switch (tag >>> 3) {
83
+ case 1: {
84
+ if (tag !== 10) {
85
+ break;
86
+ }
87
+ message.readableDataKey = reader.string();
88
+ continue;
89
+ }
90
+ case 2: {
91
+ if (tag !== 16) {
92
+ break;
93
+ }
94
+ message.action = reader.int32();
95
+ continue;
96
+ }
97
+ case 3: {
98
+ if (tag !== 26) {
99
+ break;
100
+ }
101
+ message.orGroupId = reader.string();
102
+ continue;
103
+ }
104
+ case 4: {
105
+ if (tag !== 34) {
106
+ break;
107
+ }
108
+ message.expression = reader.string();
109
+ continue;
110
+ }
111
+ }
112
+ if ((tag & 7) === 4 || tag === 0) {
113
+ break;
114
+ }
115
+ reader.skip(tag & 7);
116
+ }
117
+ return message;
118
+ },
119
+ fromJSON(object) {
120
+ return {
121
+ readableDataKey: isSet(object.readableDataKey)
122
+ ? globalThis.String(object.readableDataKey)
123
+ : '',
124
+ action: isSet(object.action) ? actionFromJSON(object.action) : 0,
125
+ orGroupId: isSet(object.orGroupId) ? globalThis.String(object.orGroupId) : '',
126
+ expression: isSet(object.expression) ? globalThis.String(object.expression) : '',
127
+ };
128
+ },
129
+ toJSON(message) {
130
+ const obj = {};
131
+ if (message.readableDataKey !== '') {
132
+ obj.readableDataKey = message.readableDataKey;
133
+ }
134
+ if (message.action !== 0) {
135
+ obj.action = actionToJSON(message.action);
136
+ }
137
+ if (message.orGroupId !== '') {
138
+ obj.orGroupId = message.orGroupId;
139
+ }
140
+ if (message.expression !== '') {
141
+ obj.expression = message.expression;
142
+ }
143
+ return obj;
144
+ },
145
+ create(base) {
146
+ return exports.BaseMatchCondition.fromPartial(base !== null && base !== void 0 ? base : {});
147
+ },
148
+ fromPartial(object) {
149
+ var _a, _b, _c, _d;
150
+ const message = createBaseBaseMatchCondition();
151
+ message.readableDataKey = (_a = object.readableDataKey) !== null && _a !== void 0 ? _a : '';
152
+ message.action = (_b = object.action) !== null && _b !== void 0 ? _b : 0;
153
+ message.orGroupId = (_c = object.orGroupId) !== null && _c !== void 0 ? _c : '';
154
+ message.expression = (_d = object.expression) !== null && _d !== void 0 ? _d : '';
155
+ return message;
156
+ },
157
+ };
158
+ function createBaseParentOverrideMatchCondition() {
159
+ return { base: undefined, parentReadableId: '' };
160
+ }
161
+ exports.ParentOverrideMatchCondition = {
162
+ encode(message, writer = new wire_1.BinaryWriter()) {
163
+ if (message.base !== undefined) {
164
+ exports.BaseMatchCondition.encode(message.base, writer.uint32(10).fork()).join();
165
+ }
166
+ if (message.parentReadableId !== '') {
167
+ writer.uint32(18).string(message.parentReadableId);
168
+ }
169
+ return writer;
170
+ },
171
+ decode(input, length) {
172
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
173
+ let end = length === undefined ? reader.len : reader.pos + length;
174
+ const message = createBaseParentOverrideMatchCondition();
175
+ while (reader.pos < end) {
176
+ const tag = reader.uint32();
177
+ switch (tag >>> 3) {
178
+ case 1: {
179
+ if (tag !== 10) {
180
+ break;
181
+ }
182
+ message.base = exports.BaseMatchCondition.decode(reader, reader.uint32());
183
+ continue;
184
+ }
185
+ case 2: {
186
+ if (tag !== 18) {
187
+ break;
188
+ }
189
+ message.parentReadableId = reader.string();
190
+ continue;
191
+ }
192
+ }
193
+ if ((tag & 7) === 4 || tag === 0) {
194
+ break;
195
+ }
196
+ reader.skip(tag & 7);
197
+ }
198
+ return message;
199
+ },
200
+ fromJSON(object) {
201
+ return {
202
+ base: isSet(object.base) ? exports.BaseMatchCondition.fromJSON(object.base) : undefined,
203
+ parentReadableId: isSet(object.parentReadableId)
204
+ ? globalThis.String(object.parentReadableId)
205
+ : '',
206
+ };
207
+ },
208
+ toJSON(message) {
209
+ const obj = {};
210
+ if (message.base !== undefined) {
211
+ obj.base = exports.BaseMatchCondition.toJSON(message.base);
212
+ }
213
+ if (message.parentReadableId !== '') {
214
+ obj.parentReadableId = message.parentReadableId;
215
+ }
216
+ return obj;
217
+ },
218
+ create(base) {
219
+ return exports.ParentOverrideMatchCondition.fromPartial(base !== null && base !== void 0 ? base : {});
220
+ },
221
+ fromPartial(object) {
222
+ var _a;
223
+ const message = createBaseParentOverrideMatchCondition();
224
+ message.base =
225
+ object.base !== undefined && object.base !== null
226
+ ? exports.BaseMatchCondition.fromPartial(object.base)
227
+ : undefined;
228
+ message.parentReadableId = (_a = object.parentReadableId) !== null && _a !== void 0 ? _a : '';
229
+ return message;
230
+ },
231
+ };
232
+ function createBaseSleepMatchCondition() {
233
+ return { base: undefined, sleepFor: '' };
234
+ }
235
+ exports.SleepMatchCondition = {
236
+ encode(message, writer = new wire_1.BinaryWriter()) {
237
+ if (message.base !== undefined) {
238
+ exports.BaseMatchCondition.encode(message.base, writer.uint32(10).fork()).join();
239
+ }
240
+ if (message.sleepFor !== '') {
241
+ writer.uint32(18).string(message.sleepFor);
242
+ }
243
+ return writer;
244
+ },
245
+ decode(input, length) {
246
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
247
+ let end = length === undefined ? reader.len : reader.pos + length;
248
+ const message = createBaseSleepMatchCondition();
249
+ while (reader.pos < end) {
250
+ const tag = reader.uint32();
251
+ switch (tag >>> 3) {
252
+ case 1: {
253
+ if (tag !== 10) {
254
+ break;
255
+ }
256
+ message.base = exports.BaseMatchCondition.decode(reader, reader.uint32());
257
+ continue;
258
+ }
259
+ case 2: {
260
+ if (tag !== 18) {
261
+ break;
262
+ }
263
+ message.sleepFor = reader.string();
264
+ continue;
265
+ }
266
+ }
267
+ if ((tag & 7) === 4 || tag === 0) {
268
+ break;
269
+ }
270
+ reader.skip(tag & 7);
271
+ }
272
+ return message;
273
+ },
274
+ fromJSON(object) {
275
+ return {
276
+ base: isSet(object.base) ? exports.BaseMatchCondition.fromJSON(object.base) : undefined,
277
+ sleepFor: isSet(object.sleepFor) ? globalThis.String(object.sleepFor) : '',
278
+ };
279
+ },
280
+ toJSON(message) {
281
+ const obj = {};
282
+ if (message.base !== undefined) {
283
+ obj.base = exports.BaseMatchCondition.toJSON(message.base);
284
+ }
285
+ if (message.sleepFor !== '') {
286
+ obj.sleepFor = message.sleepFor;
287
+ }
288
+ return obj;
289
+ },
290
+ create(base) {
291
+ return exports.SleepMatchCondition.fromPartial(base !== null && base !== void 0 ? base : {});
292
+ },
293
+ fromPartial(object) {
294
+ var _a;
295
+ const message = createBaseSleepMatchCondition();
296
+ message.base =
297
+ object.base !== undefined && object.base !== null
298
+ ? exports.BaseMatchCondition.fromPartial(object.base)
299
+ : undefined;
300
+ message.sleepFor = (_a = object.sleepFor) !== null && _a !== void 0 ? _a : '';
301
+ return message;
302
+ },
303
+ };
304
+ function createBaseUserEventMatchCondition() {
305
+ return { base: undefined, userEventKey: '' };
306
+ }
307
+ exports.UserEventMatchCondition = {
308
+ encode(message, writer = new wire_1.BinaryWriter()) {
309
+ if (message.base !== undefined) {
310
+ exports.BaseMatchCondition.encode(message.base, writer.uint32(10).fork()).join();
311
+ }
312
+ if (message.userEventKey !== '') {
313
+ writer.uint32(18).string(message.userEventKey);
314
+ }
315
+ return writer;
316
+ },
317
+ decode(input, length) {
318
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
319
+ let end = length === undefined ? reader.len : reader.pos + length;
320
+ const message = createBaseUserEventMatchCondition();
321
+ while (reader.pos < end) {
322
+ const tag = reader.uint32();
323
+ switch (tag >>> 3) {
324
+ case 1: {
325
+ if (tag !== 10) {
326
+ break;
327
+ }
328
+ message.base = exports.BaseMatchCondition.decode(reader, reader.uint32());
329
+ continue;
330
+ }
331
+ case 2: {
332
+ if (tag !== 18) {
333
+ break;
334
+ }
335
+ message.userEventKey = reader.string();
336
+ continue;
337
+ }
338
+ }
339
+ if ((tag & 7) === 4 || tag === 0) {
340
+ break;
341
+ }
342
+ reader.skip(tag & 7);
343
+ }
344
+ return message;
345
+ },
346
+ fromJSON(object) {
347
+ return {
348
+ base: isSet(object.base) ? exports.BaseMatchCondition.fromJSON(object.base) : undefined,
349
+ userEventKey: isSet(object.userEventKey) ? globalThis.String(object.userEventKey) : '',
350
+ };
351
+ },
352
+ toJSON(message) {
353
+ const obj = {};
354
+ if (message.base !== undefined) {
355
+ obj.base = exports.BaseMatchCondition.toJSON(message.base);
356
+ }
357
+ if (message.userEventKey !== '') {
358
+ obj.userEventKey = message.userEventKey;
359
+ }
360
+ return obj;
361
+ },
362
+ create(base) {
363
+ return exports.UserEventMatchCondition.fromPartial(base !== null && base !== void 0 ? base : {});
364
+ },
365
+ fromPartial(object) {
366
+ var _a;
367
+ const message = createBaseUserEventMatchCondition();
368
+ message.base =
369
+ object.base !== undefined && object.base !== null
370
+ ? exports.BaseMatchCondition.fromPartial(object.base)
371
+ : undefined;
372
+ message.userEventKey = (_a = object.userEventKey) !== null && _a !== void 0 ? _a : '';
373
+ return message;
374
+ },
375
+ };
376
+ function createBaseTaskConditions() {
377
+ return { parentOverrideConditions: [], sleepConditions: [], userEventConditions: [] };
378
+ }
379
+ exports.TaskConditions = {
380
+ encode(message, writer = new wire_1.BinaryWriter()) {
381
+ for (const v of message.parentOverrideConditions) {
382
+ exports.ParentOverrideMatchCondition.encode(v, writer.uint32(10).fork()).join();
383
+ }
384
+ for (const v of message.sleepConditions) {
385
+ exports.SleepMatchCondition.encode(v, writer.uint32(18).fork()).join();
386
+ }
387
+ for (const v of message.userEventConditions) {
388
+ exports.UserEventMatchCondition.encode(v, writer.uint32(26).fork()).join();
389
+ }
390
+ return writer;
391
+ },
392
+ decode(input, length) {
393
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
394
+ let end = length === undefined ? reader.len : reader.pos + length;
395
+ const message = createBaseTaskConditions();
396
+ while (reader.pos < end) {
397
+ const tag = reader.uint32();
398
+ switch (tag >>> 3) {
399
+ case 1: {
400
+ if (tag !== 10) {
401
+ break;
402
+ }
403
+ message.parentOverrideConditions.push(exports.ParentOverrideMatchCondition.decode(reader, reader.uint32()));
404
+ continue;
405
+ }
406
+ case 2: {
407
+ if (tag !== 18) {
408
+ break;
409
+ }
410
+ message.sleepConditions.push(exports.SleepMatchCondition.decode(reader, reader.uint32()));
411
+ continue;
412
+ }
413
+ case 3: {
414
+ if (tag !== 26) {
415
+ break;
416
+ }
417
+ message.userEventConditions.push(exports.UserEventMatchCondition.decode(reader, reader.uint32()));
418
+ continue;
419
+ }
420
+ }
421
+ if ((tag & 7) === 4 || tag === 0) {
422
+ break;
423
+ }
424
+ reader.skip(tag & 7);
425
+ }
426
+ return message;
427
+ },
428
+ fromJSON(object) {
429
+ return {
430
+ parentOverrideConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.parentOverrideConditions)
431
+ ? object.parentOverrideConditions.map((e) => exports.ParentOverrideMatchCondition.fromJSON(e))
432
+ : [],
433
+ sleepConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sleepConditions)
434
+ ? object.sleepConditions.map((e) => exports.SleepMatchCondition.fromJSON(e))
435
+ : [],
436
+ userEventConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.userEventConditions)
437
+ ? object.userEventConditions.map((e) => exports.UserEventMatchCondition.fromJSON(e))
438
+ : [],
439
+ };
440
+ },
441
+ toJSON(message) {
442
+ var _a, _b, _c;
443
+ const obj = {};
444
+ if ((_a = message.parentOverrideConditions) === null || _a === void 0 ? void 0 : _a.length) {
445
+ obj.parentOverrideConditions = message.parentOverrideConditions.map((e) => exports.ParentOverrideMatchCondition.toJSON(e));
446
+ }
447
+ if ((_b = message.sleepConditions) === null || _b === void 0 ? void 0 : _b.length) {
448
+ obj.sleepConditions = message.sleepConditions.map((e) => exports.SleepMatchCondition.toJSON(e));
449
+ }
450
+ if ((_c = message.userEventConditions) === null || _c === void 0 ? void 0 : _c.length) {
451
+ obj.userEventConditions = message.userEventConditions.map((e) => exports.UserEventMatchCondition.toJSON(e));
452
+ }
453
+ return obj;
454
+ },
455
+ create(base) {
456
+ return exports.TaskConditions.fromPartial(base !== null && base !== void 0 ? base : {});
457
+ },
458
+ fromPartial(object) {
459
+ var _a, _b, _c;
460
+ const message = createBaseTaskConditions();
461
+ message.parentOverrideConditions =
462
+ ((_a = object.parentOverrideConditions) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ParentOverrideMatchCondition.fromPartial(e))) ||
463
+ [];
464
+ message.sleepConditions =
465
+ ((_b = object.sleepConditions) === null || _b === void 0 ? void 0 : _b.map((e) => exports.SleepMatchCondition.fromPartial(e))) || [];
466
+ message.userEventConditions =
467
+ ((_c = object.userEventConditions) === null || _c === void 0 ? void 0 : _c.map((e) => exports.UserEventMatchCondition.fromPartial(e))) || [];
468
+ return message;
469
+ },
470
+ };
471
+ function createBaseDurableEventListenerConditions() {
472
+ return { sleepConditions: [], userEventConditions: [] };
473
+ }
474
+ exports.DurableEventListenerConditions = {
475
+ encode(message, writer = new wire_1.BinaryWriter()) {
476
+ for (const v of message.sleepConditions) {
477
+ exports.SleepMatchCondition.encode(v, writer.uint32(10).fork()).join();
478
+ }
479
+ for (const v of message.userEventConditions) {
480
+ exports.UserEventMatchCondition.encode(v, writer.uint32(18).fork()).join();
481
+ }
482
+ return writer;
483
+ },
484
+ decode(input, length) {
485
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
486
+ let end = length === undefined ? reader.len : reader.pos + length;
487
+ const message = createBaseDurableEventListenerConditions();
488
+ while (reader.pos < end) {
489
+ const tag = reader.uint32();
490
+ switch (tag >>> 3) {
491
+ case 1: {
492
+ if (tag !== 10) {
493
+ break;
494
+ }
495
+ message.sleepConditions.push(exports.SleepMatchCondition.decode(reader, reader.uint32()));
496
+ continue;
497
+ }
498
+ case 2: {
499
+ if (tag !== 18) {
500
+ break;
501
+ }
502
+ message.userEventConditions.push(exports.UserEventMatchCondition.decode(reader, reader.uint32()));
503
+ continue;
504
+ }
505
+ }
506
+ if ((tag & 7) === 4 || tag === 0) {
507
+ break;
508
+ }
509
+ reader.skip(tag & 7);
510
+ }
511
+ return message;
512
+ },
513
+ fromJSON(object) {
514
+ return {
515
+ sleepConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sleepConditions)
516
+ ? object.sleepConditions.map((e) => exports.SleepMatchCondition.fromJSON(e))
517
+ : [],
518
+ userEventConditions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.userEventConditions)
519
+ ? object.userEventConditions.map((e) => exports.UserEventMatchCondition.fromJSON(e))
520
+ : [],
521
+ };
522
+ },
523
+ toJSON(message) {
524
+ var _a, _b;
525
+ const obj = {};
526
+ if ((_a = message.sleepConditions) === null || _a === void 0 ? void 0 : _a.length) {
527
+ obj.sleepConditions = message.sleepConditions.map((e) => exports.SleepMatchCondition.toJSON(e));
528
+ }
529
+ if ((_b = message.userEventConditions) === null || _b === void 0 ? void 0 : _b.length) {
530
+ obj.userEventConditions = message.userEventConditions.map((e) => exports.UserEventMatchCondition.toJSON(e));
531
+ }
532
+ return obj;
533
+ },
534
+ create(base) {
535
+ return exports.DurableEventListenerConditions.fromPartial(base !== null && base !== void 0 ? base : {});
536
+ },
537
+ fromPartial(object) {
538
+ var _a, _b;
539
+ const message = createBaseDurableEventListenerConditions();
540
+ message.sleepConditions =
541
+ ((_a = object.sleepConditions) === null || _a === void 0 ? void 0 : _a.map((e) => exports.SleepMatchCondition.fromPartial(e))) || [];
542
+ message.userEventConditions =
543
+ ((_b = object.userEventConditions) === null || _b === void 0 ? void 0 : _b.map((e) => exports.UserEventMatchCondition.fromPartial(e))) || [];
544
+ return message;
545
+ },
546
+ };
547
+ function isSet(value) {
548
+ return value !== null && value !== undefined;
549
+ }