@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.
@@ -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 childWorkflowRunIdPromise = this.client.admin.run_workflow(workflowName, input, {
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.