@hatchet-dev/typescript-sdk 1.10.0 → 1.10.2

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.
@@ -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.0
4
+ // protoc-gen-ts_proto v2.7.7
5
5
  // protoc v3.19.1
6
6
  // source: workflows/workflows.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -267,7 +267,7 @@ exports.PutWorkflowRequest = {
267
267
  },
268
268
  decode(input, length) {
269
269
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
270
- let end = length === undefined ? reader.len : reader.pos + length;
270
+ const end = length === undefined ? reader.len : reader.pos + length;
271
271
  const message = createBasePutWorkflowRequest();
272
272
  while (reader.pos < end) {
273
273
  const tag = reader.uint32();
@@ -377,7 +377,7 @@ exports.CreateWorkflowVersionOpts = {
377
377
  },
378
378
  decode(input, length) {
379
379
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
380
- let end = length === undefined ? reader.len : reader.pos + length;
380
+ const end = length === undefined ? reader.len : reader.pos + length;
381
381
  const message = createBaseCreateWorkflowVersionOpts();
382
382
  while (reader.pos < end) {
383
383
  const tag = reader.uint32();
@@ -619,7 +619,7 @@ exports.WorkflowConcurrencyOpts = {
619
619
  },
620
620
  decode(input, length) {
621
621
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
622
- let end = length === undefined ? reader.len : reader.pos + length;
622
+ const end = length === undefined ? reader.len : reader.pos + length;
623
623
  const message = createBaseWorkflowConcurrencyOpts();
624
624
  while (reader.pos < end) {
625
625
  const tag = reader.uint32();
@@ -717,7 +717,7 @@ exports.CreateWorkflowJobOpts = {
717
717
  },
718
718
  decode(input, length) {
719
719
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
720
- let end = length === undefined ? reader.len : reader.pos + length;
720
+ const end = length === undefined ? reader.len : reader.pos + length;
721
721
  const message = createBaseCreateWorkflowJobOpts();
722
722
  while (reader.pos < end) {
723
723
  const tag = reader.uint32();
@@ -816,7 +816,7 @@ exports.DesiredWorkerLabels = {
816
816
  },
817
817
  decode(input, length) {
818
818
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
819
- let end = length === undefined ? reader.len : reader.pos + length;
819
+ const end = length === undefined ? reader.len : reader.pos + length;
820
820
  const message = createBaseDesiredWorkerLabels();
821
821
  while (reader.pos < end) {
822
822
  const tag = reader.uint32();
@@ -962,7 +962,7 @@ exports.CreateWorkflowStepOpts = {
962
962
  },
963
963
  decode(input, length) {
964
964
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
965
- let end = length === undefined ? reader.len : reader.pos + length;
965
+ const end = length === undefined ? reader.len : reader.pos + length;
966
966
  const message = createBaseCreateWorkflowStepOpts();
967
967
  while (reader.pos < end) {
968
968
  const tag = reader.uint32();
@@ -1167,7 +1167,7 @@ exports.CreateWorkflowStepOpts_WorkerLabelsEntry = {
1167
1167
  },
1168
1168
  decode(input, length) {
1169
1169
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1170
- let end = length === undefined ? reader.len : reader.pos + length;
1170
+ const end = length === undefined ? reader.len : reader.pos + length;
1171
1171
  const message = createBaseCreateWorkflowStepOpts_WorkerLabelsEntry();
1172
1172
  while (reader.pos < end) {
1173
1173
  const tag = reader.uint32();
@@ -1258,7 +1258,7 @@ exports.CreateStepRateLimit = {
1258
1258
  },
1259
1259
  decode(input, length) {
1260
1260
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1261
- let end = length === undefined ? reader.len : reader.pos + length;
1261
+ const end = length === undefined ? reader.len : reader.pos + length;
1262
1262
  const message = createBaseCreateStepRateLimit();
1263
1263
  while (reader.pos < end) {
1264
1264
  const tag = reader.uint32();
@@ -1371,7 +1371,7 @@ exports.ListWorkflowsRequest = {
1371
1371
  },
1372
1372
  decode(input, length) {
1373
1373
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1374
- let end = length === undefined ? reader.len : reader.pos + length;
1374
+ const end = length === undefined ? reader.len : reader.pos + length;
1375
1375
  const message = createBaseListWorkflowsRequest();
1376
1376
  while (reader.pos < end) {
1377
1377
  const tag = reader.uint32();
@@ -1445,7 +1445,7 @@ exports.ScheduleWorkflowRequest = {
1445
1445
  },
1446
1446
  decode(input, length) {
1447
1447
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1448
- let end = length === undefined ? reader.len : reader.pos + length;
1448
+ const end = length === undefined ? reader.len : reader.pos + length;
1449
1449
  const message = createBaseScheduleWorkflowRequest();
1450
1450
  while (reader.pos < end) {
1451
1451
  const tag = reader.uint32();
@@ -1605,7 +1605,7 @@ exports.ScheduledWorkflow = {
1605
1605
  },
1606
1606
  decode(input, length) {
1607
1607
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1608
- let end = length === undefined ? reader.len : reader.pos + length;
1608
+ const end = length === undefined ? reader.len : reader.pos + length;
1609
1609
  const message = createBaseScheduledWorkflow();
1610
1610
  while (reader.pos < end) {
1611
1611
  const tag = reader.uint32();
@@ -1697,7 +1697,7 @@ exports.WorkflowVersion = {
1697
1697
  },
1698
1698
  decode(input, length) {
1699
1699
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1700
- let end = length === undefined ? reader.len : reader.pos + length;
1700
+ const end = length === undefined ? reader.len : reader.pos + length;
1701
1701
  const message = createBaseWorkflowVersion();
1702
1702
  while (reader.pos < end) {
1703
1703
  const tag = reader.uint32();
@@ -1830,7 +1830,7 @@ exports.WorkflowTriggerEventRef = {
1830
1830
  },
1831
1831
  decode(input, length) {
1832
1832
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1833
- let end = length === undefined ? reader.len : reader.pos + length;
1833
+ const end = length === undefined ? reader.len : reader.pos + length;
1834
1834
  const message = createBaseWorkflowTriggerEventRef();
1835
1835
  while (reader.pos < end) {
1836
1836
  const tag = reader.uint32();
@@ -1899,7 +1899,7 @@ exports.WorkflowTriggerCronRef = {
1899
1899
  },
1900
1900
  decode(input, length) {
1901
1901
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1902
- let end = length === undefined ? reader.len : reader.pos + length;
1902
+ const end = length === undefined ? reader.len : reader.pos + length;
1903
1903
  const message = createBaseWorkflowTriggerCronRef();
1904
1904
  while (reader.pos < end) {
1905
1905
  const tag = reader.uint32();
@@ -1965,7 +1965,7 @@ exports.BulkTriggerWorkflowRequest = {
1965
1965
  },
1966
1966
  decode(input, length) {
1967
1967
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1968
- let end = length === undefined ? reader.len : reader.pos + length;
1968
+ const end = length === undefined ? reader.len : reader.pos + length;
1969
1969
  const message = createBaseBulkTriggerWorkflowRequest();
1970
1970
  while (reader.pos < end) {
1971
1971
  const tag = reader.uint32();
@@ -2022,7 +2022,7 @@ exports.BulkTriggerWorkflowResponse = {
2022
2022
  },
2023
2023
  decode(input, length) {
2024
2024
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2025
- let end = length === undefined ? reader.len : reader.pos + length;
2025
+ const end = length === undefined ? reader.len : reader.pos + length;
2026
2026
  const message = createBaseBulkTriggerWorkflowResponse();
2027
2027
  while (reader.pos < end) {
2028
2028
  const tag = reader.uint32();
@@ -2113,7 +2113,7 @@ exports.TriggerWorkflowRequest = {
2113
2113
  },
2114
2114
  decode(input, length) {
2115
2115
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2116
- let end = length === undefined ? reader.len : reader.pos + length;
2116
+ const end = length === undefined ? reader.len : reader.pos + length;
2117
2117
  const message = createBaseTriggerWorkflowRequest();
2118
2118
  while (reader.pos < end) {
2119
2119
  const tag = reader.uint32();
@@ -2269,7 +2269,7 @@ exports.TriggerWorkflowResponse = {
2269
2269
  },
2270
2270
  decode(input, length) {
2271
2271
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2272
- let end = length === undefined ? reader.len : reader.pos + length;
2272
+ const end = length === undefined ? reader.len : reader.pos + length;
2273
2273
  const message = createBaseTriggerWorkflowResponse();
2274
2274
  while (reader.pos < end) {
2275
2275
  const tag = reader.uint32();
@@ -2329,7 +2329,7 @@ exports.PutRateLimitRequest = {
2329
2329
  },
2330
2330
  decode(input, length) {
2331
2331
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2332
- let end = length === undefined ? reader.len : reader.pos + length;
2332
+ const end = length === undefined ? reader.len : reader.pos + length;
2333
2333
  const message = createBasePutRateLimitRequest();
2334
2334
  while (reader.pos < end) {
2335
2335
  const tag = reader.uint32();
@@ -2404,7 +2404,7 @@ exports.PutRateLimitResponse = {
2404
2404
  },
2405
2405
  decode(input, length) {
2406
2406
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2407
- let end = length === undefined ? reader.len : reader.pos + length;
2407
+ const end = length === undefined ? reader.len : reader.pos + length;
2408
2408
  const message = createBasePutRateLimitResponse();
2409
2409
  while (reader.pos < end) {
2410
2410
  const tag = reader.uint32();
@@ -18,6 +18,7 @@ const workflow_run_ref_1 = __importDefault(require("../../util/workflow-run-ref"
18
18
  const grpc_helpers_1 = require("../../util/grpc-helpers");
19
19
  const child_listener_client_1 = require("../../clients/listeners/run-listener/child-listener-client");
20
20
  const workflows_1 = require("../../protoc/workflows");
21
+ const retrier_1 = require("../../util/retrier");
21
22
  const batch_1 = require("../../util/batch");
22
23
  const apply_namespace_1 = require("../../util/apply-namespace");
23
24
  class AdminClient {
@@ -42,9 +43,10 @@ class AdminClient {
42
43
  try {
43
44
  const computedName = (0, apply_namespace_1.applyNamespace)(workflowName, this.config.namespace);
44
45
  const inputStr = JSON.stringify(input);
45
- const resp = yield this.grpc.triggerWorkflow(Object.assign(Object.assign({ name: computedName, input: inputStr }, options), { additionalMetadata: (options === null || options === void 0 ? void 0 : options.additionalMetadata)
46
+ const request = Object.assign(Object.assign({ name: computedName, input: inputStr }, options), { additionalMetadata: (options === null || options === void 0 ? void 0 : options.additionalMetadata)
46
47
  ? JSON.stringify(options === null || options === void 0 ? void 0 : options.additionalMetadata)
47
- : undefined, priority: options === null || options === void 0 ? void 0 : options.priority }));
48
+ : undefined, priority: options === null || options === void 0 ? void 0 : options.priority });
49
+ const resp = yield (0, retrier_1.retrier)(() => __awaiter(this, void 0, void 0, function* () { return this.grpc.triggerWorkflow(request); }), this.logger);
48
50
  const id = resp.workflowRunId;
49
51
  const ref = new workflow_run_ref_1.default(id, this.listenerClient, this.runs, options === null || options === void 0 ? void 0 : options.parentId,
50
52
  // eslint-disable-next-line no-underscore-dangle
@@ -80,10 +82,11 @@ class AdminClient {
80
82
  const results = [];
81
83
  // for loop to ensure serial execution of batches
82
84
  for (const { payloads, originalIndices, batchIndex } of batches) {
83
- // Call the bulk trigger workflow method for this batch
84
- const bulkTriggerWorkflowResponse = yield this.grpc.bulkTriggerWorkflow(workflows_1.BulkTriggerWorkflowRequest.create({
85
+ const request = workflows_1.BulkTriggerWorkflowRequest.create({
85
86
  workflows: payloads,
86
- }));
87
+ });
88
+ // Call the bulk trigger workflow method for this batch
89
+ const bulkTriggerWorkflowResponse = yield (0, retrier_1.retrier)(() => __awaiter(this, void 0, void 0, function* () { return this.grpc.bulkTriggerWorkflow(request); }), this.logger);
87
90
  this.logger.debug(`batch ${batchIndex + 1} of ${batches.length}`);
88
91
  // Map the results back to their original indices
89
92
  const batchResults = bulkTriggerWorkflowResponse.workflowRunIds.map((resp, index) => {
@@ -104,11 +107,12 @@ class AdminClient {
104
107
  }
105
108
  putRateLimit(key, limit, duration) {
106
109
  return __awaiter(this, void 0, void 0, function* () {
107
- yield this.grpc.putRateLimit({
110
+ const request = {
108
111
  key,
109
112
  limit,
110
113
  duration,
111
- });
114
+ };
115
+ yield (0, retrier_1.retrier)(() => __awaiter(this, void 0, void 0, function* () { return this.grpc.putRateLimit(request); }), this.logger);
112
116
  });
113
117
  }
114
118
  }
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const HATCHET_VERSION = "1.10.0";
1
+ export declare const HATCHET_VERSION = "1.10.2";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HATCHET_VERSION = void 0;
4
- exports.HATCHET_VERSION = '1.10.0';
4
+ exports.HATCHET_VERSION = '1.10.2';