@hatchet-dev/typescript-sdk 1.10.1 → 1.10.3
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/package.json +1 -1
- package/util/grpc-helpers.js +2 -0
- package/v1/client/admin.js +11 -7
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
package/util/grpc-helpers.js
CHANGED
|
@@ -37,6 +37,8 @@ const channelFactory = (config, credentials) => (0, nice_grpc_1.createChannel)(c
|
|
|
37
37
|
'grpc.keepalive_time_ms': 10 * 1000,
|
|
38
38
|
// Allow keepalive pings when there are no gRPC calls.
|
|
39
39
|
'grpc.keepalive_permit_without_calls': 1,
|
|
40
|
+
// Enable gzip compression for all calls on this channel
|
|
41
|
+
'grpc.default_compression_algorithm': 2, // 2 = Gzip compression
|
|
40
42
|
});
|
|
41
43
|
exports.channelFactory = channelFactory;
|
|
42
44
|
const addTokenMiddleware = (token) => function _(call, options) {
|
package/v1/client/admin.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
1
|
+
export declare const HATCHET_VERSION = "1.10.3";
|
package/version.js
CHANGED