@abinnovision/nestjs-hatchet 0.5.0-beta.1 → 0.5.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 (66) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/abstracts/hosts.d.ts +3 -3
  3. package/dist/client/client.cjs +2 -2
  4. package/dist/client/client.d.ts +1 -1
  5. package/dist/client/client.mjs +1 -1
  6. package/dist/execution/context/types.d.ts +1 -1
  7. package/dist/execution/host-run/adapter-factory.d.ts +1 -1
  8. package/dist/execution/host-run/function-type.d.ts +1 -1
  9. package/dist/explorer/declaration-builder.service.cjs +3 -3
  10. package/dist/explorer/declaration-builder.service.d.ts +1 -1
  11. package/dist/explorer/declaration-builder.service.mjs +1 -1
  12. package/dist/explorer/worker-management.service.cjs +2 -2
  13. package/dist/explorer/worker-management.service.d.ts +1 -1
  14. package/dist/explorer/worker-management.service.mjs +1 -1
  15. package/dist/hatchet.module-config.d.ts +1 -1
  16. package/dist/metadata/decorators/host.decorator.d.ts +1 -1
  17. package/dist/metadata/decorators/task.decorator.d.ts +1 -1
  18. package/dist/metadata/decorators/workflow-task.decorator.d.ts +1 -1
  19. package/dist/metadata/translator.d.ts +1 -1
  20. package/dist/sdk/hatchet-client.factory.cjs +3 -3
  21. package/dist/sdk/hatchet-client.factory.mjs +1 -1
  22. package/dist/sdk/types.d.ts +1 -1
  23. package/dist/sdk-export/index.cjs +3 -3
  24. package/dist/sdk-export/index.d.ts +3 -4
  25. package/dist/sdk-export/index.mjs +1 -1
  26. package/package.json +5 -5
  27. package/dist/__fixtures__/test-hosts.d.cts +0 -76
  28. package/dist/__fixtures__/test-hosts.d.ts +0 -76
  29. package/dist/abstracts/hosts.d.cts +0 -66
  30. package/dist/abstracts/index.d.cts +0 -1
  31. package/dist/client/client.d.cts +0 -48
  32. package/dist/client/index.d.cts +0 -1
  33. package/dist/events/event-definition.d.cts +0 -71
  34. package/dist/events/index.d.cts +0 -2
  35. package/dist/execution/context/factory.d.cts +0 -22
  36. package/dist/execution/context/index.d.cts +0 -4
  37. package/dist/execution/context/types.d.cts +0 -108
  38. package/dist/execution/host-run/adapter-factory.d.cts +0 -12
  39. package/dist/execution/host-run/function-type.d.cts +0 -24
  40. package/dist/execution/host-run/index.d.cts +0 -2
  41. package/dist/execution/index.d.cts +0 -2
  42. package/dist/explorer/declaration-builder.service.d.cts +0 -70
  43. package/dist/explorer/index.d.cts +0 -1
  44. package/dist/explorer/worker-management.service.d.cts +0 -34
  45. package/dist/hatchet.module-config.d.cts +0 -31
  46. package/dist/hatchet.module.d.cts +0 -23
  47. package/dist/index.d.cts +0 -9
  48. package/dist/interceptor/index.d.cts +0 -1
  49. package/dist/interceptor/interceptor.d.cts +0 -13
  50. package/dist/internal/registrations.d.cts +0 -19
  51. package/dist/metadata/accessor.d.cts +0 -33
  52. package/dist/metadata/decorators/host.decorator.d.cts +0 -19
  53. package/dist/metadata/decorators/index.d.cts +0 -6
  54. package/dist/metadata/decorators/task.decorator.d.cts +0 -6
  55. package/dist/metadata/decorators/workflow-task.decorator.d.cts +0 -10
  56. package/dist/metadata/index.d.cts +0 -6
  57. package/dist/metadata/keys.d.cts +0 -3
  58. package/dist/metadata/translator.d.cts +0 -10
  59. package/dist/references/helpers.d.cts +0 -27
  60. package/dist/references/index.d.cts +0 -3
  61. package/dist/references/refs.d.cts +0 -27
  62. package/dist/references/shared.d.cts +0 -172
  63. package/dist/sdk/hatchet-client.factory.d.cts +0 -5
  64. package/dist/sdk/index.d.cts +0 -1
  65. package/dist/sdk/types.d.cts +0 -7
  66. package/dist/sdk-export/index.d.cts +0 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.0](https://github.com/abinnovision/nestjs-commons/compare/nestjs-hatchet-v0.4.0...nestjs-hatchet-v0.5.0) (2026-03-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * use pinned Hatchet SDK and re-export ([#102](https://github.com/abinnovision/nestjs-commons/issues/102)) ([6651fb1](https://github.com/abinnovision/nestjs-commons/commit/6651fb1a9dd9fd4d51ae6b02bc23b6de8b735e04))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * align nestjs-hatchet export ([#104](https://github.com/abinnovision/nestjs-commons/issues/104)) ([9e32d5d](https://github.com/abinnovision/nestjs-commons/commit/9e32d5d97936c2e2b1106e2bc9a6900bc5668b9c))
14
+
3
15
  ## [0.4.0](https://github.com/abinnovision/nestjs-commons/compare/nestjs-hatchet-v0.3.2...nestjs-hatchet-v0.4.0) (2026-03-21)
4
16
 
5
17
 
@@ -1,4 +1,4 @@
1
- import type { InputType } from "@hatchet-dev/typescript-sdk/v1";
1
+ import type { InputType } from "@hatchet-dev/typescript-sdk";
2
2
  import type { StandardSchemaV1 } from "@standard-schema/spec";
3
3
  /**
4
4
  * Interface for classes that provide a schema for their input.
@@ -49,7 +49,7 @@ export declare function workflowHost<I>(input?: ReturnType<InputSchemaProvider<I
49
49
  new (): {
50
50
  readonly __workflow_host_brand: void;
51
51
  readonly __workflow_host_input: I;
52
- readonly inputSchema: () => StandardSchemaV1<import("@hatchet-dev/typescript-sdk/v1").JsonObject, I> | undefined;
52
+ readonly inputSchema: () => StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, I> | undefined;
53
53
  };
54
54
  };
55
55
  /**
@@ -61,6 +61,6 @@ export declare function taskHost<I>(input?: ReturnType<InputSchemaProvider<I>["i
61
61
  new (): {
62
62
  readonly __task_host_brand: void;
63
63
  readonly __task_host_input: I;
64
- readonly inputSchema: () => StandardSchemaV1<import("@hatchet-dev/typescript-sdk/v1").JsonObject, I> | undefined;
64
+ readonly inputSchema: () => StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, I> | undefined;
65
65
  };
66
66
  };
@@ -1,7 +1,7 @@
1
1
  const require_event_definition = require("../events/event-definition.cjs");
2
2
  const require_adapter_factory = require("../execution/host-run/adapter-factory.cjs");
3
3
  let _nestjs_common = require("@nestjs/common");
4
- let _hatchet_dev_typescript_sdk_v1 = require("@hatchet-dev/typescript-sdk/v1");
4
+ let _hatchet_dev_typescript_sdk = require("@hatchet-dev/typescript-sdk");
5
5
  //#region src/client/client.ts
6
6
  function _ts_decorate(decorators, target, key, desc) {
7
7
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -69,7 +69,7 @@ var Client = class {
69
69
  Client = _ts_decorate([
70
70
  (0, _nestjs_common.Injectable)(),
71
71
  _ts_metadata("design:type", Function),
72
- _ts_metadata("design:paramtypes", [typeof _hatchet_dev_typescript_sdk_v1.HatchetClient === "undefined" ? Object : _hatchet_dev_typescript_sdk_v1.HatchetClient])
72
+ _ts_metadata("design:paramtypes", [typeof _hatchet_dev_typescript_sdk.HatchetClient === "undefined" ? Object : _hatchet_dev_typescript_sdk.HatchetClient])
73
73
  ], Client);
74
74
  //#endregion
75
75
  Object.defineProperty(exports, "Client", {
@@ -1,4 +1,4 @@
1
- import { HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
1
+ import { HatchetClient } from "@hatchet-dev/typescript-sdk";
2
2
  import type { AnyEventDefinition, EventInput } from "../events/index.js";
3
3
  import type { HostRunFn } from "../execution/index.js";
4
4
  type EventClient = HatchetClient["events"];
@@ -1,7 +1,7 @@
1
1
  import { EVENT_MARKER } from "../events/event-definition.mjs";
2
2
  import { createHostRunForAdmin } from "../execution/host-run/adapter-factory.mjs";
3
3
  import { Injectable } from "@nestjs/common";
4
- import { HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
4
+ import { HatchetClient } from "@hatchet-dev/typescript-sdk";
5
5
  //#region src/client/client.ts
6
6
  function _ts_decorate(decorators, target, key, desc) {
7
7
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2,7 +2,7 @@ import type { TaskHost, WorkflowHost } from "../../abstracts/index.js";
2
2
  import type { AnyEventDefinition, EventOutput } from "../../events/index.js";
3
3
  import type { AnyTaskFn, OutputOfTaskFn } from "../../references/shared.js";
4
4
  import type { HostRunFn } from "../host-run/index.js";
5
- import type { Context } from "@hatchet-dev/typescript-sdk/v1";
5
+ import type { Context } from "@hatchet-dev/typescript-sdk";
6
6
  export declare const TASK_MARKER: unique symbol;
7
7
  export type TaskMarker = typeof TASK_MARKER;
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  import type { HostRunFn } from "./function-type.js";
2
- import type { Context, HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
2
+ import type { Context, HatchetClient } from "@hatchet-dev/typescript-sdk";
3
3
  /**
4
4
  * Creates a HostRunFn that uses SDK Context for spawning child workflows.
5
5
  * Used within task execution contexts.
@@ -1,6 +1,6 @@
1
1
  import type { AnyCallableRef, InputOfRef, OutputOfRef } from "../../references/index.js";
2
2
  import type { WorkflowRunRef } from "../../sdk/types.js";
3
- import type { RunOpts } from "@hatchet-dev/typescript-sdk/v1";
3
+ import type { RunOpts } from "@hatchet-dev/typescript-sdk";
4
4
  /**
5
5
  * Describes the return type of the {@link HostRunFn} function.
6
6
  *
@@ -3,7 +3,7 @@ const require_accessor = require("../metadata/accessor.cjs");
3
3
  const require_factory = require("../execution/context/factory.cjs");
4
4
  const require_registrations = require("../internal/registrations.cjs");
5
5
  let _nestjs_common = require("@nestjs/common");
6
- let _hatchet_dev_typescript_sdk_v1 = require("@hatchet-dev/typescript-sdk/v1");
6
+ let _hatchet_dev_typescript_sdk = require("@hatchet-dev/typescript-sdk");
7
7
  let _nestjs_core = require("@nestjs/core");
8
8
  let directed_graph_typed = require("directed-graph-typed");
9
9
  //#region src/explorer/declaration-builder.service.ts
@@ -47,7 +47,7 @@ var DeclarationBuilderService = class {
47
47
  if (!methodName) throw new Error("Could not find method name for TaskHost");
48
48
  const taskOpts = accessor.getTaskMeta(methodName);
49
49
  const proto = Object.getPrototypeOf(host);
50
- return new _hatchet_dev_typescript_sdk_v1.TaskWorkflowDeclaration({
50
+ return new _hatchet_dev_typescript_sdk.TaskWorkflowDeclaration({
51
51
  ...hostOpts,
52
52
  ...taskOpts,
53
53
  fn: async (_, ctx) => {
@@ -65,7 +65,7 @@ var DeclarationBuilderService = class {
65
65
  this.validateWorkflowHost(host);
66
66
  const accessor = require_accessor.fromInstance(host);
67
67
  const graph = this.buildWorkflowHostGraph(host);
68
- const workflowDec = new _hatchet_dev_typescript_sdk_v1.WorkflowDeclaration(accessor.sdkOpts);
68
+ const workflowDec = new _hatchet_dev_typescript_sdk.WorkflowDeclaration(accessor.sdkOpts);
69
69
  const proto = Object.getPrototypeOf(host);
70
70
  const taskDecls = /* @__PURE__ */ new Map();
71
71
  const topoSorted = graph.topologicalSort("key");
@@ -1,4 +1,4 @@
1
- import { TaskWorkflowDeclaration, WorkflowDeclaration } from "@hatchet-dev/typescript-sdk/v1";
1
+ import { TaskWorkflowDeclaration, WorkflowDeclaration } from "@hatchet-dev/typescript-sdk";
2
2
  import { ModuleRef } from "@nestjs/core";
3
3
  import { InterceptorRegistration } from "../internal/registrations.js";
4
4
  import { AnyHost } from "../references/shared.js";
@@ -3,7 +3,7 @@ import { fromInstance } from "../metadata/accessor.mjs";
3
3
  import { createTaskCtx, createWorkflowCtx } from "../execution/context/factory.mjs";
4
4
  import { InterceptorRegistration } from "../internal/registrations.mjs";
5
5
  import { Inject, Injectable, Optional } from "@nestjs/common";
6
- import { TaskWorkflowDeclaration, WorkflowDeclaration } from "@hatchet-dev/typescript-sdk/v1";
6
+ import { TaskWorkflowDeclaration, WorkflowDeclaration } from "@hatchet-dev/typescript-sdk";
7
7
  import { ModuleRef } from "@nestjs/core";
8
8
  import { DirectedGraph } from "directed-graph-typed";
9
9
  //#region src/explorer/declaration-builder.service.ts
@@ -3,7 +3,7 @@ const require_registrations = require("../internal/registrations.cjs");
3
3
  const require_declaration_builder_service = require("./declaration-builder.service.cjs");
4
4
  const require_hatchet_module_config = require("../hatchet.module-config.cjs");
5
5
  let _nestjs_common = require("@nestjs/common");
6
- let _hatchet_dev_typescript_sdk_v1 = require("@hatchet-dev/typescript-sdk/v1");
6
+ let _hatchet_dev_typescript_sdk = require("@hatchet-dev/typescript-sdk");
7
7
  let _nestjs_core = require("@nestjs/core");
8
8
  //#region src/explorer/worker-management.service.ts
9
9
  function _ts_decorate(decorators, target, key, desc) {
@@ -111,7 +111,7 @@ WorkerManagementService = _ts_decorate([
111
111
  _ts_param(2, (0, _nestjs_common.Inject)(require_hatchet_module_config.hatchetModuleConfigToken)),
112
112
  _ts_metadata("design:type", Function),
113
113
  _ts_metadata("design:paramtypes", [
114
- typeof _hatchet_dev_typescript_sdk_v1.HatchetClient === "undefined" ? Object : _hatchet_dev_typescript_sdk_v1.HatchetClient,
114
+ typeof _hatchet_dev_typescript_sdk.HatchetClient === "undefined" ? Object : _hatchet_dev_typescript_sdk.HatchetClient,
115
115
  typeof require_declaration_builder_service.DeclarationBuilderService === "undefined" ? Object : require_declaration_builder_service.DeclarationBuilderService,
116
116
  typeof HatchetModuleConfig === "undefined" ? Object : HatchetModuleConfig,
117
117
  typeof _nestjs_core.ModuleRef === "undefined" ? Object : _nestjs_core.ModuleRef
@@ -1,4 +1,4 @@
1
- import { HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
1
+ import { HatchetClient } from "@hatchet-dev/typescript-sdk";
2
2
  import { OnApplicationBootstrap } from "@nestjs/common";
3
3
  import { ModuleRef } from "@nestjs/core";
4
4
  import { type HatchetModuleConfig } from "../hatchet.module-config.js";
@@ -3,7 +3,7 @@ import { HatchetFeatureRegistration } from "../internal/registrations.mjs";
3
3
  import { DeclarationBuilderService } from "./declaration-builder.service.mjs";
4
4
  import { hatchetModuleConfigToken } from "../hatchet.module-config.mjs";
5
5
  import { Inject, Injectable, Logger } from "@nestjs/common";
6
- import { HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
6
+ import { HatchetClient } from "@hatchet-dev/typescript-sdk";
7
7
  import { ModuleRef } from "@nestjs/core";
8
8
  //#region src/explorer/worker-management.service.ts
9
9
  function _ts_decorate(decorators, target, key, desc) {
@@ -1,4 +1,4 @@
1
- import type { CreateWorkerOpts, HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
1
+ import type { CreateWorkerOpts, HatchetClient } from "@hatchet-dev/typescript-sdk";
2
2
  type ClientConfig = HatchetClient["config"];
3
3
  /**
4
4
  * Configuration for the Hatchet worker.
@@ -1,5 +1,5 @@
1
1
  import type { AnyEventDefinition } from "../../events/index.js";
2
- import type { CreateBaseWorkflowOpts } from "@hatchet-dev/typescript-sdk/v1";
2
+ import type { CreateBaseWorkflowOpts } from "@hatchet-dev/typescript-sdk";
3
3
  /**
4
4
  * Properties we enhance beyond SDK types.
5
5
  */
@@ -1,4 +1,4 @@
1
- import type { CreateBaseWorkflowOpts, CreateTaskWorkflowOpts } from "@hatchet-dev/typescript-sdk/v1";
1
+ import type { CreateBaseWorkflowOpts, CreateTaskWorkflowOpts } from "@hatchet-dev/typescript-sdk";
2
2
  export type TaskOpts = Omit<CreateTaskWorkflowOpts, "fn" | "name" | keyof CreateBaseWorkflowOpts>;
3
3
  /**
4
4
  * Decorator to mark a method as a Hatchet task.
@@ -1,6 +1,6 @@
1
1
  import type { WorkflowCtx } from "../../execution/index.js";
2
2
  import type { ContextMethodKeys, WorkflowHostCtor } from "../../references/shared.js";
3
- import type { CreateWorkflowTaskOpts } from "@hatchet-dev/typescript-sdk/v1";
3
+ import type { CreateWorkflowTaskOpts } from "@hatchet-dev/typescript-sdk";
4
4
  export type WorkflowTaskOpts<C extends WorkflowHostCtor<any>> = Omit<CreateWorkflowTaskOpts, "fn" | "parents" | "name"> & {
5
5
  parents?: ContextMethodKeys<InstanceType<C>, WorkflowCtx<any>>[];
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import type { HostOpts } from "./decorators/index.js";
2
- import type { CreateBaseWorkflowOpts } from "@hatchet-dev/typescript-sdk/v1";
2
+ import type { CreateBaseWorkflowOpts } from "@hatchet-dev/typescript-sdk";
3
3
  /**
4
4
  * SDK-compatible host options.
5
5
  */
@@ -1,6 +1,6 @@
1
1
  const require_hatchet_module_config = require("../hatchet.module-config.cjs");
2
2
  let _nestjs_common = require("@nestjs/common");
3
- let _hatchet_dev_typescript_sdk_v1 = require("@hatchet-dev/typescript-sdk/v1");
3
+ let _hatchet_dev_typescript_sdk = require("@hatchet-dev/typescript-sdk");
4
4
  //#region src/sdk/hatchet-client.factory.ts
5
5
  /**
6
6
  * Creates a logger that matches the Hatchet logger interface based on the given context.
@@ -35,9 +35,9 @@ let _hatchet_dev_typescript_sdk_v1 = require("@hatchet-dev/typescript-sdk/v1");
35
35
  /**
36
36
  * Factory provider for the HatchetClient.
37
37
  */ const hatchetClientFactory = {
38
- provide: _hatchet_dev_typescript_sdk_v1.HatchetClient,
38
+ provide: _hatchet_dev_typescript_sdk.HatchetClient,
39
39
  inject: [require_hatchet_module_config.hatchetModuleConfigToken],
40
- useFactory: (opts) => new _hatchet_dev_typescript_sdk_v1.HatchetClient({
40
+ useFactory: (opts) => new _hatchet_dev_typescript_sdk.HatchetClient({
41
41
  ...opts.config,
42
42
  logger: loggerFactory
43
43
  })
@@ -1,6 +1,6 @@
1
1
  import { hatchetModuleConfigToken } from "../hatchet.module-config.mjs";
2
2
  import { Logger } from "@nestjs/common";
3
- import { HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
3
+ import { HatchetClient } from "@hatchet-dev/typescript-sdk";
4
4
  //#region src/sdk/hatchet-client.factory.ts
5
5
  /**
6
6
  * Creates a logger that matches the Hatchet logger interface based on the given context.
@@ -3,5 +3,5 @@
3
3
  * Used internally to avoid deep subpath imports from the SDK.
4
4
  */
5
5
  export interface WorkflowRunRef<T> {
6
- get output(): Promise<T>;
6
+ readonly output: Promise<T>;
7
7
  }
@@ -1,9 +1,9 @@
1
- var _hatchet_dev_typescript_sdk_v1 = require("@hatchet-dev/typescript-sdk/v1");
2
- Object.keys(_hatchet_dev_typescript_sdk_v1).forEach(function(k) {
1
+ var _hatchet_dev_typescript_sdk = require("@hatchet-dev/typescript-sdk");
2
+ Object.keys(_hatchet_dev_typescript_sdk).forEach(function(k) {
3
3
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
4
4
  enumerable: true,
5
5
  get: function() {
6
- return _hatchet_dev_typescript_sdk_v1[k];
6
+ return _hatchet_dev_typescript_sdk[k];
7
7
  }
8
8
  });
9
9
  });
@@ -1,8 +1,7 @@
1
1
  /**
2
- * Re-exports the patched @hatchet-dev/typescript-sdk/v1 entrypoint.
2
+ * Re-exports the @hatchet-dev/typescript-sdk entrypoint.
3
3
  *
4
4
  * This allows consumers to import SDK types and classes from @abinnovision/nestjs-hatchet/sdk
5
- * without depending on the hatchet SDK directly, ensuring they use the patched version
6
- * that properly exports the v1 subdirectory.
5
+ * without depending on the Hatchet SDK directly.
7
6
  */
8
- export * from "@hatchet-dev/typescript-sdk/v1";
7
+ export * from "@hatchet-dev/typescript-sdk";
@@ -1,2 +1,2 @@
1
- export * from "@hatchet-dev/typescript-sdk/v1";
1
+ export * from "@hatchet-dev/typescript-sdk";
2
2
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@abinnovision/nestjs-hatchet",
4
- "version": "0.5.0-beta.1",
4
+ "version": "0.5.0",
5
5
  "keywords": [
6
6
  "nestjs",
7
7
  "hatchet"
@@ -25,7 +25,7 @@
25
25
  "default": "./dist/index.mjs"
26
26
  },
27
27
  "require": {
28
- "types": "./dist/index.d.cts",
28
+ "types": "./dist/index.d.ts",
29
29
  "default": "./dist/index.cjs"
30
30
  }
31
31
  },
@@ -35,7 +35,7 @@
35
35
  "default": "./dist/sdk-export/index.mjs"
36
36
  },
37
37
  "require": {
38
- "types": "./dist/sdk-export/index.d.cts",
38
+ "types": "./dist/sdk-export/index.d.ts",
39
39
  "default": "./dist/sdk-export/index.cjs"
40
40
  }
41
41
  }
@@ -48,7 +48,7 @@
48
48
  "README.md"
49
49
  ],
50
50
  "scripts": {
51
- "build": "tsdown && tsc --project tsconfig.build.json --emitDeclarationOnly && find dist -name '*.d.ts' -exec sh -c 'cp \"$1\" \"${1%.d.ts}.d.cts\"' _ {} \\; && publint",
51
+ "build": "tsdown && tsc --project tsconfig.build.json --emitDeclarationOnly && publint",
52
52
  "format:check": "prettier --check '{{src,test}/**/*,*}.{js,jsx,ts,tsx,json,json5,yml,yaml,md}'",
53
53
  "format:fix": "prettier --write '{{src,test}/**/*,*}.{js,jsx,ts,tsx,json,json5,yml,yaml,md}'",
54
54
  "lint:check": "eslint '{{src,test}/**/*,*}.{js,jsx,ts,tsx}'",
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "prettier": "@abinnovision/prettier-config",
69
69
  "dependencies": {
70
- "@hatchet-dev/typescript-sdk": "patch:@hatchet-dev/typescript-sdk@npm%3A1.17.2#~/.yarn/patches/@hatchet-dev-typescript-sdk-npm-1.17.2-eac4b79d71.patch",
70
+ "@hatchet-dev/typescript-sdk": "^1.17.2",
71
71
  "@standard-schema/spec": "^1.0.0",
72
72
  "directed-graph-typed": "^2.1.0"
73
73
  },
@@ -1,76 +0,0 @@
1
- import type { TaskCtx, WorkflowCtx } from "../execution/index.js";
2
- declare const TestTask_base: {
3
- new (): {
4
- readonly __task_host_brand: void;
5
- readonly __task_host_input: {
6
- data: string;
7
- };
8
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, {
9
- data: string;
10
- }> | undefined;
11
- };
12
- };
13
- /** Standard TaskHost with string data schema */
14
- export declare class TestTask extends TestTask_base {
15
- execute(ctx: TaskCtx<typeof this>): {
16
- result: string;
17
- };
18
- }
19
- declare const NoMethodsTask_base: {
20
- new (): {
21
- readonly __task_host_brand: void;
22
- readonly __task_host_input: unknown;
23
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, unknown> | undefined;
24
- };
25
- };
26
- /** TaskHost without any decorated methods (invalid) */
27
- export declare class NoMethodsTask extends NoMethodsTask_base {
28
- notDecorated(): {};
29
- }
30
- declare const NoSchemaTask_base: {
31
- new (): {
32
- readonly __task_host_brand: void;
33
- readonly __task_host_input: unknown;
34
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, unknown> | undefined;
35
- };
36
- };
37
- /** TaskHost without input schema */
38
- export declare class NoSchemaTask extends NoSchemaTask_base {
39
- execute(_ctx: TaskCtx<typeof this>): {
40
- result: string;
41
- };
42
- }
43
- declare const TestWorkflow_base: {
44
- new (): {
45
- readonly __workflow_host_brand: void;
46
- readonly __workflow_host_input: {
47
- id: string;
48
- };
49
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, {
50
- id: string;
51
- }> | undefined;
52
- };
53
- };
54
- /** Standard WorkflowHost with two-step DAG */
55
- export declare class TestWorkflow extends TestWorkflow_base {
56
- step1(_ctx: WorkflowCtx<typeof this>): {
57
- step: number;
58
- };
59
- step2(_ctx: WorkflowCtx<typeof this>): {
60
- step: number;
61
- };
62
- }
63
- declare const NoMethodsWorkflow_base: {
64
- new (): {
65
- readonly __workflow_host_brand: void;
66
- readonly __workflow_host_input: unknown;
67
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, unknown> | undefined;
68
- };
69
- };
70
- /** WorkflowHost without any decorated methods (invalid) */
71
- export declare class NoMethodsWorkflow extends NoMethodsWorkflow_base {
72
- notDecorated(): {};
73
- }
74
- /** Sets design:paramtypes metadata for a method (needed in vitest) */
75
- export declare function setParamTypes(target: object, method: string, types: unknown[]): void;
76
- export {};
@@ -1,76 +0,0 @@
1
- import type { TaskCtx, WorkflowCtx } from "../execution/index.js";
2
- declare const TestTask_base: {
3
- new (): {
4
- readonly __task_host_brand: void;
5
- readonly __task_host_input: {
6
- data: string;
7
- };
8
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, {
9
- data: string;
10
- }> | undefined;
11
- };
12
- };
13
- /** Standard TaskHost with string data schema */
14
- export declare class TestTask extends TestTask_base {
15
- execute(ctx: TaskCtx<typeof this>): {
16
- result: string;
17
- };
18
- }
19
- declare const NoMethodsTask_base: {
20
- new (): {
21
- readonly __task_host_brand: void;
22
- readonly __task_host_input: unknown;
23
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, unknown> | undefined;
24
- };
25
- };
26
- /** TaskHost without any decorated methods (invalid) */
27
- export declare class NoMethodsTask extends NoMethodsTask_base {
28
- notDecorated(): {};
29
- }
30
- declare const NoSchemaTask_base: {
31
- new (): {
32
- readonly __task_host_brand: void;
33
- readonly __task_host_input: unknown;
34
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, unknown> | undefined;
35
- };
36
- };
37
- /** TaskHost without input schema */
38
- export declare class NoSchemaTask extends NoSchemaTask_base {
39
- execute(_ctx: TaskCtx<typeof this>): {
40
- result: string;
41
- };
42
- }
43
- declare const TestWorkflow_base: {
44
- new (): {
45
- readonly __workflow_host_brand: void;
46
- readonly __workflow_host_input: {
47
- id: string;
48
- };
49
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, {
50
- id: string;
51
- }> | undefined;
52
- };
53
- };
54
- /** Standard WorkflowHost with two-step DAG */
55
- export declare class TestWorkflow extends TestWorkflow_base {
56
- step1(_ctx: WorkflowCtx<typeof this>): {
57
- step: number;
58
- };
59
- step2(_ctx: WorkflowCtx<typeof this>): {
60
- step: number;
61
- };
62
- }
63
- declare const NoMethodsWorkflow_base: {
64
- new (): {
65
- readonly __workflow_host_brand: void;
66
- readonly __workflow_host_input: unknown;
67
- readonly inputSchema: () => import("@standard-schema/spec").StandardSchemaV1<import("@hatchet-dev/typescript-sdk").JsonObject, unknown> | undefined;
68
- };
69
- };
70
- /** WorkflowHost without any decorated methods (invalid) */
71
- export declare class NoMethodsWorkflow extends NoMethodsWorkflow_base {
72
- notDecorated(): {};
73
- }
74
- /** Sets design:paramtypes metadata for a method (needed in vitest) */
75
- export declare function setParamTypes(target: object, method: string, types: unknown[]): void;
76
- export {};
@@ -1,66 +0,0 @@
1
- import type { InputType } from "@hatchet-dev/typescript-sdk/v1";
2
- import type { StandardSchemaV1 } from "@standard-schema/spec";
3
- /**
4
- * Interface for classes that provide a schema for their input.
5
- */
6
- export interface InputSchemaProvider<T> {
7
- /**
8
- * Returns the schema for the input of the host.
9
- * If undefined, the input is not validated.
10
- */
11
- inputSchema: () => StandardSchemaV1<InputType, T> | undefined;
12
- }
13
- /**
14
- * Marker class for Hatchet workflow host classes.
15
- */
16
- export declare abstract class WorkflowHost<I> implements InputSchemaProvider<I> {
17
- readonly inputSchema: InputSchemaProvider<I>["inputSchema"];
18
- readonly __workflow_host_brand: void;
19
- readonly __workflow_host_input: I;
20
- /**
21
- * Constructor for the WorkflowHost class.
22
- *
23
- * @param inputSchema
24
- * @protected
25
- */
26
- protected constructor(inputSchema: InputSchemaProvider<I>["inputSchema"]);
27
- }
28
- /**
29
- * Marker class for Hatchet task host classes.
30
- */
31
- export declare abstract class TaskHost<I> implements InputSchemaProvider<I> {
32
- readonly inputSchema: InputSchemaProvider<I>["inputSchema"];
33
- readonly __task_host_brand: void;
34
- readonly __task_host_input: I;
35
- /**
36
- * Constructor for the TaskHost class.
37
- *
38
- * @param inputSchema
39
- * @protected
40
- */
41
- protected constructor(inputSchema: InputSchemaProvider<I>["inputSchema"]);
42
- }
43
- /**
44
- * Creates a new WorkflowHost class with the provided input schema.
45
- *
46
- * @param input The input schema.
47
- */
48
- export declare function workflowHost<I>(input?: ReturnType<InputSchemaProvider<I>["inputSchema"]>): {
49
- new (): {
50
- readonly __workflow_host_brand: void;
51
- readonly __workflow_host_input: I;
52
- readonly inputSchema: () => StandardSchemaV1<import("@hatchet-dev/typescript-sdk/v1").JsonObject, I> | undefined;
53
- };
54
- };
55
- /**
56
- * Creates a new TaskHost class with the provided input schema.
57
- *
58
- * @param input The input schema.
59
- */
60
- export declare function taskHost<I>(input?: ReturnType<InputSchemaProvider<I>["inputSchema"]>): {
61
- new (): {
62
- readonly __task_host_brand: void;
63
- readonly __task_host_input: I;
64
- readonly inputSchema: () => StandardSchemaV1<import("@hatchet-dev/typescript-sdk/v1").JsonObject, I> | undefined;
65
- };
66
- };
@@ -1 +0,0 @@
1
- export * from "./hosts.js";
@@ -1,48 +0,0 @@
1
- import { HatchetClient } from "@hatchet-dev/typescript-sdk/v1";
2
- import type { AnyEventDefinition, EventInput } from "../events/index.js";
3
- import type { HostRunFn } from "../execution/index.js";
4
- type EventClient = HatchetClient["events"];
5
- type EventEmitOptions = Parameters<EventClient["push"]>[2];
6
- type Event = Awaited<ReturnType<EventClient["push"]>>;
7
- export declare class Client {
8
- private readonly client;
9
- readonly run: HostRunFn;
10
- constructor(client: HatchetClient);
11
- /**
12
- * Access to the underlying HatchetClient SDK.
13
- * Use for advanced features not wrapped by this library.
14
- */
15
- get sdk(): HatchetClient;
16
- /**
17
- * Emit a single event.
18
- *
19
- * @param event The event definition to emit.
20
- * @param input The event payload (must match the event's schema).
21
- * @param options Optional emit configuration.
22
- * @returns The emitted event.
23
- *
24
- * @example
25
- * ```typescript
26
- * await client.emit(UserCreatedEvent, { userId: "123", email: "user@example.com" });
27
- * ```
28
- */
29
- emit<E extends AnyEventDefinition>(event: E, input: EventInput<E>, options?: EventEmitOptions): Promise<Event>;
30
- /**
31
- * Emit multiple events of the same type.
32
- *
33
- * @param event The event definition to emit.
34
- * @param inputs Array of event payloads.
35
- * @param options Optional emit configuration.
36
- * @returns Array of emitted events.
37
- *
38
- * @example
39
- * ```typescript
40
- * await client.emitBulk(OrderPlacedEvent, [
41
- * { orderId: "1", userId: "123", total: 100 },
42
- * { orderId: "2", userId: "456", total: 200 },
43
- * ]);
44
- * ```
45
- */
46
- emitBulk<E extends AnyEventDefinition>(event: E, inputs: EventInput<E>[], options?: EventEmitOptions): Promise<Event[]>;
47
- }
48
- export {};
@@ -1 +0,0 @@
1
- export * from "./client.js";