@hatchet-dev/typescript-sdk 1.1.6 → 1.1.8-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.
@@ -46,6 +46,8 @@ export declare const ClientConfigSchema: z.ZodObject<{
46
46
  log_level: z.ZodOptional<z.ZodEnum<["OFF", "DEBUG", "INFO", "WARN", "ERROR"]>>;
47
47
  tenant_id: z.ZodString;
48
48
  namespace: z.ZodOptional<z.ZodString>;
49
+ grpc_max_send_message_length: z.ZodOptional<z.ZodNumber>;
50
+ grpc_max_recv_message_length: z.ZodOptional<z.ZodNumber>;
49
51
  }, "strip", z.ZodTypeAny, {
50
52
  token: string;
51
53
  tls_config: {
@@ -60,6 +62,8 @@ export declare const ClientConfigSchema: z.ZodObject<{
60
62
  tenant_id: string;
61
63
  log_level?: "OFF" | "DEBUG" | "INFO" | "WARN" | "ERROR" | undefined;
62
64
  namespace?: string | undefined;
65
+ grpc_max_send_message_length?: number | undefined;
66
+ grpc_max_recv_message_length?: number | undefined;
63
67
  }, {
64
68
  token: string;
65
69
  tls_config: {
@@ -74,6 +78,8 @@ export declare const ClientConfigSchema: z.ZodObject<{
74
78
  tenant_id: string;
75
79
  log_level?: "OFF" | "DEBUG" | "INFO" | "WARN" | "ERROR" | undefined;
76
80
  namespace?: string | undefined;
81
+ grpc_max_send_message_length?: number | undefined;
82
+ grpc_max_recv_message_length?: number | undefined;
77
83
  }>;
78
84
  export type LogConstructor = (context: string, logLevel?: LogLevel) => Logger;
79
85
  export type ClientConfig = z.infer<typeof ClientConfigSchema> & {
@@ -17,4 +17,6 @@ exports.ClientConfigSchema = zod_1.z.object({
17
17
  log_level: zod_1.z.enum(['OFF', 'DEBUG', 'INFO', 'WARN', 'ERROR']).optional(),
18
18
  tenant_id: zod_1.z.string(),
19
19
  namespace: zod_1.z.string().optional(),
20
+ grpc_max_send_message_length: zod_1.z.number().optional(),
21
+ grpc_max_recv_message_length: zod_1.z.number().optional(),
20
22
  });
@@ -53,6 +53,8 @@ const cron_client_1 = require("./features/cron-client");
53
53
  const schedule_client_1 = require("./features/schedule-client");
54
54
  const durable_listener_client_1 = require("../listeners/durable-listener/durable-listener-client");
55
55
  const channelFactory = (config, credentials) => (0, nice_grpc_1.createChannel)(config.host_port, credentials, {
56
+ 'grpc.max_send_message_length': config.grpc_max_send_message_length,
57
+ 'grpc.max_receive_message_length': config.grpc_max_recv_message_length,
56
58
  'grpc.ssl_target_name_override': config.tls_config.server_name,
57
59
  'grpc.keepalive_timeout_ms': 60 * 1000,
58
60
  'grpc.client_idle_timeout_ms': 60 * 1000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "1.1.6",
3
+ "version": "1.1.8-alpha.0",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -44,7 +44,7 @@ const token_1 = require("./token");
44
44
  const DEFAULT_CONFIG_FILE = '.hatchet.yaml';
45
45
  class ConfigLoader {
46
46
  static loadClientConfig(override, config) {
47
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
47
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
48
48
  const yaml = this.loadYamlConfig(config === null || config === void 0 ? void 0 : config.path);
49
49
  const tlsConfig = (_a = override === null || override === void 0 ? void 0 : override.tls_config) !== null && _a !== void 0 ? _a : {
50
50
  tls_strategy: (_d = (_c = (_b = yaml === null || yaml === void 0 ? void 0 : yaml.tls_config) === null || _b === void 0 ? void 0 : _b.tls_strategy) !== null && _c !== void 0 ? _c : this.env('HATCHET_CLIENT_TLS_STRATEGY')) !== null && _d !== void 0 ? _d : 'tls',
@@ -76,14 +76,18 @@ class ConfigLoader {
76
76
  apiUrl = (_z = (_y = override === null || override === void 0 ? void 0 : override.api_url) !== null && _y !== void 0 ? _y : yaml === null || yaml === void 0 ? void 0 : yaml.api_url) !== null && _z !== void 0 ? _z : this.env('HATCHET_CLIENT_API_URL');
77
77
  }
78
78
  const namespace = (_1 = (_0 = override === null || override === void 0 ? void 0 : override.namespace) !== null && _0 !== void 0 ? _0 : yaml === null || yaml === void 0 ? void 0 : yaml.namespace) !== null && _1 !== void 0 ? _1 : this.env('HATCHET_CLIENT_NAMESPACE');
79
+ const grpcMaxSendMessageLength = (_3 = (_2 = override === null || override === void 0 ? void 0 : override.grpc_max_send_message_length) !== null && _2 !== void 0 ? _2 : yaml === null || yaml === void 0 ? void 0 : yaml.grpc_max_send_message_length) !== null && _3 !== void 0 ? _3 : parseInt((_4 = this.env('HATCHET_CLIENT_GRPC_MAX_SEND_MESSAGE_LENGTH')) !== null && _4 !== void 0 ? _4 : '-1', 10);
80
+ const grpcMaxRecvMessageLength = (_6 = (_5 = override === null || override === void 0 ? void 0 : override.grpc_max_recv_message_length) !== null && _5 !== void 0 ? _5 : yaml === null || yaml === void 0 ? void 0 : yaml.grpc_max_recv_message_length) !== null && _6 !== void 0 ? _6 : parseInt((_7 = this.env('HATCHET_CLIENT_GRPC_MAX_RECV_MESSAGE_LENGTH')) !== null && _7 !== void 0 ? _7 : '-1', 10);
79
81
  return {
80
- token: (_3 = (_2 = override === null || override === void 0 ? void 0 : override.token) !== null && _2 !== void 0 ? _2 : yaml === null || yaml === void 0 ? void 0 : yaml.token) !== null && _3 !== void 0 ? _3 : this.env('HATCHET_CLIENT_TOKEN'),
82
+ token: (_9 = (_8 = override === null || override === void 0 ? void 0 : override.token) !== null && _8 !== void 0 ? _8 : yaml === null || yaml === void 0 ? void 0 : yaml.token) !== null && _9 !== void 0 ? _9 : this.env('HATCHET_CLIENT_TOKEN'),
81
83
  host_port: grpcBroadcastAddress,
82
84
  api_url: apiUrl,
83
85
  tls_config: tlsConfig,
84
- log_level: (_6 = (_5 = (_4 = override === null || override === void 0 ? void 0 : override.log_level) !== null && _4 !== void 0 ? _4 : yaml === null || yaml === void 0 ? void 0 : yaml.log_level) !== null && _5 !== void 0 ? _5 : this.env('HATCHET_CLIENT_LOG_LEVEL')) !== null && _6 !== void 0 ? _6 : 'INFO',
86
+ log_level: (_12 = (_11 = (_10 = override === null || override === void 0 ? void 0 : override.log_level) !== null && _10 !== void 0 ? _10 : yaml === null || yaml === void 0 ? void 0 : yaml.log_level) !== null && _11 !== void 0 ? _11 : this.env('HATCHET_CLIENT_LOG_LEVEL')) !== null && _12 !== void 0 ? _12 : 'INFO',
85
87
  tenant_id: tenantId,
86
88
  namespace: namespace ? `${namespace}_`.toLowerCase() : '',
89
+ grpc_max_send_message_length: grpcMaxSendMessageLength > 0 ? grpcMaxSendMessageLength : undefined,
90
+ grpc_max_recv_message_length: grpcMaxRecvMessageLength > 0 ? grpcMaxRecvMessageLength : undefined,
87
91
  };
88
92
  }
89
93
  static get default_yaml_config_path() {
@@ -4,14 +4,13 @@ import WorkflowRunRef from '../../util/workflow-run-ref';
4
4
  import { Workflow as V0Workflow } from '../../workflow';
5
5
  import { DurableContext } from '../../step';
6
6
  import { Api } from '../../clients/rest';
7
- import { CreateTaskWorkflowOpts, CreateWorkflowOpts, RunOpts, BaseWorkflowDeclaration, WorkflowDeclaration, TaskWorkflowDeclaration } from '../declaration';
7
+ import { CreateTaskWorkflowOpts, CreateWorkflowOpts, RunOpts, BaseWorkflowDeclaration, WorkflowDeclaration, TaskWorkflowDeclaration, CreateDurableTaskWorkflowOpts } from '../declaration';
8
8
  import { IHatchetClient } from './client.interface';
9
9
  import { CreateWorkerOpts, Worker } from './worker';
10
10
  import { MetricsClient } from './features/metrics';
11
11
  import { WorkersClient } from './features/workers';
12
12
  import { WorkflowsClient } from './features/workflows';
13
13
  import { RunsClient } from './features/runs';
14
- import { CreateStandaloneDurableTaskOpts } from '../task';
15
14
  import { InputType, OutputType, UnknownInputType, StrictWorkflowOutputType } from '../types';
16
15
  import { RatelimitsClient } from './features';
17
16
  /**
@@ -80,7 +79,7 @@ export declare class HatchetClient implements IHatchetClient {
80
79
  * @param options Durable task configuration options
81
80
  * @returns A TaskWorkflowDeclaration instance for a durable task
82
81
  */
83
- durableTask<I extends InputType, O extends OutputType>(options: CreateStandaloneDurableTaskOpts<I, O>): TaskWorkflowDeclaration<I, O>;
82
+ durableTask<I extends InputType, O extends OutputType>(options: CreateDurableTaskWorkflowOpts<I, O>): TaskWorkflowDeclaration<I, O>;
84
83
  /**
85
84
  * Creates a new durable task workflow with types inferred from the function parameter.
86
85
  * @template Fn The type of the durable task function with input and output extending JsonObject
@@ -89,7 +88,7 @@ export declare class HatchetClient implements IHatchetClient {
89
88
  */
90
89
  durableTask<Fn extends (input: I, ctx: DurableContext<I>) => O | Promise<O>, I extends InputType = Parameters<Fn>[0], O extends OutputType = ReturnType<Fn> extends Promise<infer P> ? P extends OutputType ? P : void : ReturnType<Fn> extends OutputType ? ReturnType<Fn> : void>(options: {
91
90
  fn: Fn;
92
- } & Omit<CreateStandaloneDurableTaskOpts<I, O>, 'fn'>): TaskWorkflowDeclaration<I, O>;
91
+ } & Omit<CreateDurableTaskWorkflowOpts<I, O>, 'fn'>): TaskWorkflowDeclaration<I, O>;
93
92
  /**
94
93
  * Triggers a workflow run without waiting for completion.
95
94
  * @template I - The input type for the workflow
@@ -3,7 +3,7 @@ import { Context, DurableContext } from '../step';
3
3
  import { CronWorkflows, ScheduledWorkflows } from '../clients/rest/generated/data-contracts';
4
4
  import { Workflow as WorkflowV0 } from '../workflow';
5
5
  import { IHatchetClient } from './client/client.interface';
6
- import { CreateWorkflowTaskOpts, CreateOnFailureTaskOpts, TaskConcurrency, TaskFn, CreateWorkflowDurableTaskOpts, CreateBaseTaskOpts, CreateOnSuccessTaskOpts } from './task';
6
+ import { CreateWorkflowTaskOpts, CreateOnFailureTaskOpts, TaskConcurrency, TaskFn, CreateWorkflowDurableTaskOpts, CreateBaseTaskOpts, CreateOnSuccessTaskOpts, DurableTaskFn } from './task';
7
7
  import { Duration } from './client/duration';
8
8
  import { MetricsClient } from './client/features/metrics';
9
9
  import { InputType, OutputType, UnknownInputType, JsonObject } from './types';
@@ -61,6 +61,7 @@ export type CreateBaseWorkflowOpts = {
61
61
  concurrency?: TaskConcurrency;
62
62
  };
63
63
  export type CreateTaskWorkflowOpts<I extends InputType = UnknownInputType, O extends OutputType = void> = CreateBaseWorkflowOpts & CreateBaseTaskOpts<I, O, TaskFn<I, O>>;
64
+ export type CreateDurableTaskWorkflowOpts<I extends InputType = UnknownInputType, O extends OutputType = void> = CreateBaseWorkflowOpts & CreateBaseTaskOpts<I, O, DurableTaskFn<I, O>>;
64
65
  /**
65
66
  * Options for creating a new workflow.
66
67
  */
package/v1/task.d.ts CHANGED
@@ -158,19 +158,12 @@ export type CreateWorkflowTaskOpts<I extends InputType = UnknownInputType, O ext
158
158
  */
159
159
  skipIf?: Conditions | Conditions[];
160
160
  };
161
- export type CreateStandaloneTaskOpts<I extends InputType = UnknownInputType, O extends OutputType = void, C extends TaskFn<I, O> = TaskFn<I, O>> = CreateBaseTaskOpts<I, O, C>;
162
161
  /**
163
162
  * Options for creating a hatchet durable task which is an atomic unit of work in a workflow.
164
163
  * @template I The input type for the task function.
165
164
  * @template O The return type of the task function (can be inferred from the return value of fn).
166
165
  */
167
166
  export type CreateWorkflowDurableTaskOpts<I extends InputType = UnknownInputType, O extends OutputType = void, C extends DurableTaskFn<I, O> = DurableTaskFn<I, O>> = CreateWorkflowTaskOpts<I, O, C>;
168
- /**
169
- * Options for creating a hatchet task which is an atomic unit of work in a workflow.
170
- * @template I The input type for the task function.
171
- * @template O The return type of the task function (can be inferred from the return value of fn).
172
- */
173
- export type CreateStandaloneDurableTaskOpts<I extends InputType = UnknownInputType, O extends OutputType = void, C extends DurableTaskFn<I, O> = DurableTaskFn<I, O>> = CreateBaseTaskOpts<I, O, C>;
174
167
  /**
175
168
  * Options for configuring the onSuccess task that is invoked when a task succeeds.
176
169
  * @template I The input type for the task function.
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const HATCHET_VERSION = "1.1.6";
1
+ export declare const HATCHET_VERSION = "1.1.8-alpha.0";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HATCHET_VERSION = void 0;
4
- exports.HATCHET_VERSION = '1.1.6';
4
+ exports.HATCHET_VERSION = '1.1.8-alpha.0';