@hatchet-dev/typescript-sdk 0.1.0 → 0.1.1

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 (59) hide show
  1. package/package.json +23 -21
  2. package/README.md +0 -3
  3. package/dist/clients/admin/admin-client.d.ts +0 -12
  4. package/dist/clients/admin/admin-client.js +0 -47
  5. package/dist/clients/dispatcher/action-listener.d.ts +0 -26
  6. package/dist/clients/dispatcher/action-listener.js +0 -113
  7. package/dist/clients/dispatcher/dispatcher-client.d.ts +0 -20
  8. package/dist/clients/dispatcher/dispatcher-client.js +0 -58
  9. package/dist/clients/event/event-client.d.ts +0 -11
  10. package/dist/clients/event/event-client.js +0 -32
  11. package/dist/clients/hatchet-client/client-config.d.ts +0 -72
  12. package/dist/clients/hatchet-client/client-config.js +0 -17
  13. package/dist/clients/hatchet-client/hatchet-client.d.ts +0 -26
  14. package/dist/clients/hatchet-client/hatchet-client.js +0 -133
  15. package/dist/clients/hatchet-client/index.d.ts +0 -2
  16. package/dist/clients/hatchet-client/index.js +0 -18
  17. package/dist/clients/worker/index.d.ts +0 -1
  18. package/dist/clients/worker/index.js +0 -17
  19. package/dist/clients/worker/worker.d.ts +0 -34
  20. package/dist/clients/worker/worker.js +0 -317
  21. package/dist/index.d.ts +0 -2
  22. package/dist/index.js +0 -4
  23. package/dist/package.json +0 -73
  24. package/dist/protoc/dispatcher/dispatcher.d.ts +0 -333
  25. package/dist/protoc/dispatcher/dispatcher.js +0 -1152
  26. package/dist/protoc/dispatcher/index.d.ts +0 -1
  27. package/dist/protoc/dispatcher/index.js +0 -17
  28. package/dist/protoc/events/events.d.ts +0 -165
  29. package/dist/protoc/events/events.js +0 -443
  30. package/dist/protoc/events/index.d.ts +0 -1
  31. package/dist/protoc/events/index.js +0 -17
  32. package/dist/protoc/google/protobuf/timestamp.d.ts +0 -121
  33. package/dist/protoc/google/protobuf/timestamp.js +0 -110
  34. package/dist/protoc/google/protobuf/wrappers.d.ts +0 -160
  35. package/dist/protoc/google/protobuf/wrappers.js +0 -527
  36. package/dist/protoc/workflows/index.d.ts +0 -1
  37. package/dist/protoc/workflows/index.js +0 -17
  38. package/dist/protoc/workflows/workflows.d.ts +0 -464
  39. package/dist/protoc/workflows/workflows.js +0 -1951
  40. package/dist/sdk.d.ts +0 -2
  41. package/dist/sdk.js +0 -4
  42. package/dist/step.d.ts +0 -33
  43. package/dist/step.js +0 -65
  44. package/dist/util/config-loader/config-loader.d.ts +0 -13
  45. package/dist/util/config-loader/config-loader.js +0 -85
  46. package/dist/util/config-loader/index.d.ts +0 -1
  47. package/dist/util/config-loader/index.js +0 -17
  48. package/dist/util/errors/hatchet-error.d.ts +0 -4
  49. package/dist/util/errors/hatchet-error.js +0 -9
  50. package/dist/util/hatchet-promise/hatchet-promise.d.ts +0 -6
  51. package/dist/util/hatchet-promise/hatchet-promise.js +0 -12
  52. package/dist/util/logger/index.d.ts +0 -1
  53. package/dist/util/logger/index.js +0 -17
  54. package/dist/util/logger/logger.d.ts +0 -12
  55. package/dist/util/logger/logger.js +0 -37
  56. package/dist/util/sleep.d.ts +0 -2
  57. package/dist/util/sleep.js +0 -6
  58. package/dist/workflow.d.ts +0 -111
  59. package/dist/workflow.js +0 -54
package/dist/sdk.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { HatchetClient as Hatchet } from './clients/hatchet-client';
2
- export default Hatchet;
package/dist/sdk.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const hatchet_client_1 = require("./clients/hatchet-client");
4
- exports.default = hatchet_client_1.HatchetClient;
package/dist/step.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import * as z from 'zod';
2
- export declare const CreateStepSchema: z.ZodObject<{
3
- name: z.ZodString;
4
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5
- timeout: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- name: string;
8
- parents?: string[] | undefined;
9
- timeout?: string | undefined;
10
- }, {
11
- name: string;
12
- parents?: string[] | undefined;
13
- timeout?: string | undefined;
14
- }>;
15
- export type NextStep = {
16
- [key: string]: string;
17
- };
18
- interface ContextData<T = unknown> {
19
- input: T;
20
- parents: Record<string, any>;
21
- triggered_by_event: string;
22
- }
23
- export declare class Context<T = unknown> {
24
- data: ContextData<T>;
25
- constructor(payload: string);
26
- stepOutput(step: string): string;
27
- triggeredByEvent(): boolean;
28
- workflowInput(): any;
29
- }
30
- export interface CreateStep<T> extends z.infer<typeof CreateStepSchema> {
31
- run: (ctx: Context) => Promise<NextStep> | NextStep | void;
32
- }
33
- export {};
package/dist/step.js DELETED
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Context = exports.CreateStepSchema = void 0;
30
- const hatchet_error_1 = __importDefault(require("./util/errors/hatchet-error"));
31
- const z = __importStar(require("zod"));
32
- const workflow_1 = require("./workflow");
33
- exports.CreateStepSchema = z.object({
34
- name: z.string(),
35
- parents: z.array(z.string()).optional(),
36
- timeout: workflow_1.HatchetTimeoutSchema.optional(),
37
- });
38
- class Context {
39
- constructor(payload) {
40
- try {
41
- this.data = JSON.parse(JSON.parse(payload));
42
- }
43
- catch (e) {
44
- throw new hatchet_error_1.default(`Could not parse payload: ${e.message}`);
45
- }
46
- }
47
- stepOutput(step) {
48
- if (!this.data.parents) {
49
- throw new hatchet_error_1.default('Step output not found');
50
- }
51
- if (!this.data.parents[step]) {
52
- throw new hatchet_error_1.default(`Step output for '${step}' not found`);
53
- }
54
- return this.data.parents[step];
55
- }
56
- triggeredByEvent() {
57
- var _a;
58
- return ((_a = this.data) === null || _a === void 0 ? void 0 : _a.triggered_by_event) === 'event';
59
- }
60
- workflowInput() {
61
- var _a;
62
- return ((_a = this.data) === null || _a === void 0 ? void 0 : _a.input) || {};
63
- }
64
- }
65
- exports.Context = Context;
@@ -1,13 +0,0 @@
1
- import { ClientConfig } from '../../clients/hatchet-client';
2
- import { ChannelCredentials } from 'nice-grpc';
3
- interface LoadClientConfigOptions {
4
- path?: string;
5
- }
6
- export declare class ConfigLoader {
7
- static load_client_config(config?: LoadClientConfigOptions): Partial<ClientConfig>;
8
- static get default_yaml_config_path(): string;
9
- static createCredentials(config: ClientConfig['tls_config']): ChannelCredentials;
10
- static load_yaml_config(path?: string): ClientConfig | undefined;
11
- private static env;
12
- }
13
- export {};
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ConfigLoader = void 0;
27
- const yaml_1 = require("yaml");
28
- const fs_1 = require("fs");
29
- const p = __importStar(require("path"));
30
- const zod_1 = require("zod");
31
- const hatchet_client_1 = require("../../clients/hatchet-client");
32
- const nice_grpc_1 = require("nice-grpc");
33
- const DEFAULT_CONFIG_FILE = '.hatchet.yaml';
34
- class ConfigLoader {
35
- static load_client_config(config) {
36
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
37
- const yaml = this.load_yaml_config(config === null || config === void 0 ? void 0 : config.path);
38
- const tlsConfig = {
39
- tls_strategy: (_c = (_b = (_a = yaml === null || yaml === void 0 ? void 0 : yaml.tls_config) === null || _a === void 0 ? void 0 : _a.tls_strategy) !== null && _b !== void 0 ? _b : this.env('HATCHET_CLIENT_TLS_STRATEGY')) !== null && _c !== void 0 ? _c : 'tls',
40
- cert_file: (_e = (_d = yaml === null || yaml === void 0 ? void 0 : yaml.tls_config) === null || _d === void 0 ? void 0 : _d.cert_file) !== null && _e !== void 0 ? _e : this.env('HATCHET_CLIENT_TLS_CERT_FILE'),
41
- key_file: (_g = (_f = yaml === null || yaml === void 0 ? void 0 : yaml.tls_config) === null || _f === void 0 ? void 0 : _f.key_file) !== null && _g !== void 0 ? _g : this.env('HATCHET_CLIENT_TLS_KEY_FILE'),
42
- ca_file: (_j = (_h = yaml === null || yaml === void 0 ? void 0 : yaml.tls_config) === null || _h === void 0 ? void 0 : _h.ca_file) !== null && _j !== void 0 ? _j : this.env('HATCHET_CLIENT_TLS_ROOT_CA_FILE'),
43
- server_name: (_l = (_k = yaml === null || yaml === void 0 ? void 0 : yaml.tls_config) === null || _k === void 0 ? void 0 : _k.server_name) !== null && _l !== void 0 ? _l : this.env('HATCHET_CLIENT_TLS_SERVER_NAME'),
44
- };
45
- return {
46
- token: (_m = yaml === null || yaml === void 0 ? void 0 : yaml.token) !== null && _m !== void 0 ? _m : this.env('HATCHET_CLIENT_TOKEN'),
47
- host_port: (_o = yaml === null || yaml === void 0 ? void 0 : yaml.host_port) !== null && _o !== void 0 ? _o : this.env('HATCHET_CLIENT_HOST_PORT'),
48
- tls_config: tlsConfig,
49
- log_level: (_q = (_p = yaml === null || yaml === void 0 ? void 0 : yaml.log_level) !== null && _p !== void 0 ? _p : this.env('HATCHET_CLIENT_LOG_LEVEL')) !== null && _q !== void 0 ? _q : 'INFO',
50
- };
51
- }
52
- static get default_yaml_config_path() {
53
- return p.join(process.cwd(), DEFAULT_CONFIG_FILE);
54
- }
55
- static createCredentials(config) {
56
- if (config.tls_strategy === 'tls') {
57
- const rootCerts = config.ca_file ? (0, fs_1.readFileSync)(config.ca_file) : undefined;
58
- return nice_grpc_1.ChannelCredentials.createSsl(rootCerts);
59
- }
60
- const rootCerts = config.ca_file ? (0, fs_1.readFileSync)(config.ca_file) : null;
61
- const privateKey = config.key_file ? (0, fs_1.readFileSync)(config.key_file) : null;
62
- const certChain = config.cert_file ? (0, fs_1.readFileSync)(config.cert_file) : null;
63
- return nice_grpc_1.ChannelCredentials.createSsl(rootCerts, privateKey, certChain);
64
- }
65
- static load_yaml_config(path) {
66
- try {
67
- const configFile = (0, fs_1.readFileSync)(p.join(__dirname, path !== null && path !== void 0 ? path : this.default_yaml_config_path), 'utf8');
68
- const config = (0, yaml_1.parse)(configFile);
69
- hatchet_client_1.ClientConfigSchema.partial().parse(config);
70
- return config;
71
- }
72
- catch (e) {
73
- if (!path)
74
- return undefined;
75
- if (e instanceof zod_1.z.ZodError) {
76
- throw new Error(`Invalid yaml config: ${e.message}`);
77
- }
78
- throw e;
79
- }
80
- }
81
- static env(name) {
82
- return process.env[name];
83
- }
84
- }
85
- exports.ConfigLoader = ConfigLoader;
@@ -1 +0,0 @@
1
- export * from './config-loader';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./config-loader"), exports);
@@ -1,4 +0,0 @@
1
- declare class HatchetError extends Error {
2
- constructor(message: string);
3
- }
4
- export default HatchetError;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class HatchetError extends Error {
4
- constructor(message) {
5
- super(message);
6
- this.name = 'HatchetError';
7
- }
8
- }
9
- exports.default = HatchetError;
@@ -1,6 +0,0 @@
1
- declare class HatchetPromise<T> {
2
- cancel: Function;
3
- promise: Promise<T>;
4
- constructor(promise: Promise<T>);
5
- }
6
- export default HatchetPromise;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class HatchetPromise {
4
- constructor(promise) {
5
- this.cancel = (reason) => { };
6
- this.promise = new Promise((resolve, reject) => {
7
- this.cancel = reject;
8
- Promise.resolve(promise).then(resolve).catch(reject);
9
- });
10
- }
11
- }
12
- exports.default = HatchetPromise;
@@ -1 +0,0 @@
1
- export * from './logger';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./logger"), exports);
@@ -1,12 +0,0 @@
1
- export type LogLevel = 'OFF' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
2
- export declare class Logger {
3
- private logLevel;
4
- private context;
5
- constructor(context: string, logLevel?: LogLevel);
6
- private log;
7
- debug(message: string): void;
8
- info(message: string): void;
9
- warn(message: string): void;
10
- error(message: string): void;
11
- }
12
- export default Logger;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Logger = void 0;
4
- // eslint-disable-next-line no-shadow
5
- var LogLevelEnum;
6
- (function (LogLevelEnum) {
7
- LogLevelEnum[LogLevelEnum["OFF"] = -1] = "OFF";
8
- LogLevelEnum[LogLevelEnum["DEBUG"] = 0] = "DEBUG";
9
- LogLevelEnum[LogLevelEnum["INFO"] = 1] = "INFO";
10
- LogLevelEnum[LogLevelEnum["WARN"] = 2] = "WARN";
11
- LogLevelEnum[LogLevelEnum["ERROR"] = 3] = "ERROR";
12
- })(LogLevelEnum || (LogLevelEnum = {}));
13
- class Logger {
14
- constructor(context, logLevel = 'INFO') {
15
- this.logLevel = logLevel;
16
- this.context = context;
17
- }
18
- log(level, message) {
19
- if (LogLevelEnum[level] >= LogLevelEnum[this.logLevel]) {
20
- console.log(`🪓 [${level}/${this.context}] ${message}`);
21
- }
22
- }
23
- debug(message) {
24
- this.log('DEBUG', message);
25
- }
26
- info(message) {
27
- this.log('INFO', message);
28
- }
29
- warn(message) {
30
- this.log('WARN', message);
31
- }
32
- error(message) {
33
- this.log('ERROR', message);
34
- }
35
- }
36
- exports.Logger = Logger;
37
- exports.default = Logger;
@@ -1,2 +0,0 @@
1
- declare const sleep: (ms: number) => Promise<unknown>;
2
- export default sleep;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const sleep = (ms) => new Promise((resolve) => {
4
- setTimeout(resolve, ms);
5
- });
6
- exports.default = sleep;
@@ -1,111 +0,0 @@
1
- import * as z from 'zod';
2
- import { CreateStep } from './step';
3
- import { ConcurrencyLimitStrategy as PbConcurrencyLimitStrategy } from './protoc/workflows';
4
- declare const StepsSchema: z.ZodArray<z.ZodObject<{
5
- name: z.ZodString;
6
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
7
- timeout: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- name: string;
10
- parents?: string[] | undefined;
11
- timeout?: string | undefined;
12
- }, {
13
- name: string;
14
- parents?: string[] | undefined;
15
- timeout?: string | undefined;
16
- }>, "many">;
17
- export type Steps = z.infer<typeof StepsSchema>;
18
- export declare const ConcurrencyLimitStrategy: typeof PbConcurrencyLimitStrategy;
19
- export declare const WorkflowConcurrency: z.ZodObject<{
20
- action: z.ZodOptional<z.ZodString>;
21
- maxRuns: z.ZodOptional<z.ZodNumber>;
22
- limitStrategy: z.ZodOptional<z.ZodNativeEnum<typeof PbConcurrencyLimitStrategy>>;
23
- }, "strip", z.ZodTypeAny, {
24
- action?: string | undefined;
25
- maxRuns?: number | undefined;
26
- limitStrategy?: PbConcurrencyLimitStrategy | undefined;
27
- }, {
28
- action?: string | undefined;
29
- maxRuns?: number | undefined;
30
- limitStrategy?: PbConcurrencyLimitStrategy | undefined;
31
- }>;
32
- export declare const HatchetTimeoutSchema: z.ZodString;
33
- export declare const CreateWorkflowSchema: z.ZodObject<{
34
- id: z.ZodString;
35
- description: z.ZodString;
36
- version: z.ZodOptional<z.ZodString>;
37
- timeout: z.ZodOptional<z.ZodString>;
38
- on: z.ZodUnion<[z.ZodObject<{
39
- cron: z.ZodString;
40
- event: z.ZodUndefined;
41
- }, "strip", z.ZodTypeAny, {
42
- cron: string;
43
- event?: undefined;
44
- }, {
45
- cron: string;
46
- event?: undefined;
47
- }>, z.ZodObject<{
48
- cron: z.ZodUndefined;
49
- event: z.ZodString;
50
- }, "strip", z.ZodTypeAny, {
51
- event: string;
52
- cron?: undefined;
53
- }, {
54
- event: string;
55
- cron?: undefined;
56
- }>]>;
57
- steps: z.ZodArray<z.ZodObject<{
58
- name: z.ZodString;
59
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
60
- timeout: z.ZodOptional<z.ZodString>;
61
- }, "strip", z.ZodTypeAny, {
62
- name: string;
63
- parents?: string[] | undefined;
64
- timeout?: string | undefined;
65
- }, {
66
- name: string;
67
- parents?: string[] | undefined;
68
- timeout?: string | undefined;
69
- }>, "many">;
70
- }, "strip", z.ZodTypeAny, {
71
- description: string;
72
- steps: {
73
- name: string;
74
- parents?: string[] | undefined;
75
- timeout?: string | undefined;
76
- }[];
77
- id: string;
78
- on: {
79
- cron: string;
80
- event?: undefined;
81
- } | {
82
- event: string;
83
- cron?: undefined;
84
- };
85
- version?: string | undefined;
86
- timeout?: string | undefined;
87
- }, {
88
- description: string;
89
- steps: {
90
- name: string;
91
- parents?: string[] | undefined;
92
- timeout?: string | undefined;
93
- }[];
94
- id: string;
95
- on: {
96
- cron: string;
97
- event?: undefined;
98
- } | {
99
- event: string;
100
- cron?: undefined;
101
- };
102
- version?: string | undefined;
103
- timeout?: string | undefined;
104
- }>;
105
- export interface Workflow extends z.infer<typeof CreateWorkflowSchema> {
106
- concurrency?: z.infer<typeof WorkflowConcurrency> & {
107
- key: (ctx: any) => string;
108
- };
109
- steps: CreateStep<any>[];
110
- }
111
- export {};
package/dist/workflow.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.CreateWorkflowSchema = exports.HatchetTimeoutSchema = exports.WorkflowConcurrency = exports.ConcurrencyLimitStrategy = void 0;
27
- const z = __importStar(require("zod"));
28
- const step_1 = require("./step");
29
- const workflows_1 = require("./protoc/workflows");
30
- const CronConfigSchema = z.object({
31
- cron: z.string(),
32
- event: z.undefined(),
33
- });
34
- const EventConfigSchema = z.object({
35
- cron: z.undefined(),
36
- event: z.string(),
37
- });
38
- const OnConfigSchema = z.union([CronConfigSchema, EventConfigSchema]);
39
- const StepsSchema = z.array(step_1.CreateStepSchema);
40
- exports.ConcurrencyLimitStrategy = workflows_1.ConcurrencyLimitStrategy;
41
- exports.WorkflowConcurrency = z.object({
42
- action: z.string().optional(),
43
- maxRuns: z.number().optional(),
44
- limitStrategy: z.nativeEnum(exports.ConcurrencyLimitStrategy).optional(),
45
- });
46
- exports.HatchetTimeoutSchema = z.string();
47
- exports.CreateWorkflowSchema = z.object({
48
- id: z.string(),
49
- description: z.string(),
50
- version: z.string().optional(),
51
- timeout: exports.HatchetTimeoutSchema.optional(),
52
- on: OnConfigSchema,
53
- steps: StepsSchema,
54
- });