@hatchet-dev/typescript-sdk 0.7.1 → 0.8.0-alpha.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.
- package/clients/admin/admin-client.d.ts +2 -1
- package/clients/admin/admin-client.js +10 -1
- package/clients/dispatcher/action-listener.d.ts +47 -6
- package/clients/dispatcher/action-listener.js +17 -1
- package/clients/hatchet-client/hatchet-client.d.ts +1 -0
- package/clients/hatchet-client/hatchet-client.js +6 -0
- package/clients/rest/generated/Api.d.ts +38 -1
- package/clients/rest/generated/Api.js +37 -0
- package/clients/rest/generated/data-contracts.d.ts +72 -0
- package/clients/rest/generated/data-contracts.js +9 -1
- package/clients/worker/handler.d.ts +56 -0
- package/clients/worker/handler.js +160 -0
- package/clients/worker/worker.d.ts +10 -3
- package/clients/worker/worker.js +189 -149
- package/package.json +5 -5
- package/protoc/dispatcher/dispatcher.d.ts +3 -1
- package/protoc/dispatcher/dispatcher.js +23 -3
- package/protoc/events/events.d.ts +1 -1
- package/protoc/events/events.js +5 -0
- package/protoc/google/protobuf/timestamp.js +8 -0
- package/protoc/workflows/workflows.d.ts +1 -1
- package/protoc/workflows/workflows.js +5 -0
- package/step.d.ts +1 -1
- package/step.js +2 -1
- package/util/parse.js +5 -0
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v1.178.0
|
|
5
|
+
// protoc v3.19.1
|
|
6
|
+
// source: workflows/workflows.proto
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/step.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare class Context<T, K> {
|
|
|
97
97
|
putStream(data: string | Uint8Array): Promise<void>;
|
|
98
98
|
spawnWorkflow<P = unknown, Q = unknown>(workflowName: string, input: Q, key?: string): ChildWorkflowRef<P>;
|
|
99
99
|
}
|
|
100
|
-
export type StepRunFunction<T, K> = (ctx: Context<T, K>) => Promise<NextStep> | NextStep | void;
|
|
100
|
+
export type StepRunFunction<T, K> = (ctx: Context<T, K>) => Promise<NextStep | void> | NextStep | void;
|
|
101
101
|
export interface CreateStep<T, K> extends z.infer<typeof CreateStepSchema> {
|
|
102
102
|
run: StepRunFunction<T, K>;
|
|
103
103
|
}
|
package/step.js
CHANGED
|
@@ -225,7 +225,8 @@ class Context {
|
|
|
225
225
|
}
|
|
226
226
|
spawnWorkflow(workflowName, input, key) {
|
|
227
227
|
const { workflowRunId, stepRunId } = this.action;
|
|
228
|
-
const
|
|
228
|
+
const name = this.client.config.namespace + workflowName;
|
|
229
|
+
const childWorkflowRunIdPromise = this.client.admin.run_workflow(name, input, {
|
|
229
230
|
parentId: workflowRunId,
|
|
230
231
|
parentStepRunId: stepRunId,
|
|
231
232
|
childKey: key,
|
package/util/parse.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseJSON = void 0;
|
|
4
4
|
function parseJSON(json) {
|
|
5
|
+
// TODO why is this needed?
|
|
6
|
+
if (json.startsWith('ey')) {
|
|
7
|
+
const decoded = Buffer.from(json, 'base64').toString('utf8');
|
|
8
|
+
return JSON.parse(decoded);
|
|
9
|
+
}
|
|
5
10
|
try {
|
|
6
11
|
const firstParse = JSON.parse(json);
|
|
7
12
|
// Hatchet engine versions <=0.14.0 return JSON as a quoted string which needs to be parsed again.
|