@hatchet-dev/typescript-sdk 0.15.0 → 0.16.0-alpha.2
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/hatchet-client/client-config.d.ts +6 -0
- package/clients/hatchet-client/client-config.js +2 -0
- package/clients/hatchet-client/hatchet-client.d.ts +2 -0
- package/clients/hatchet-client/hatchet-client.js +25 -1
- package/clients/rest/api.d.ts +3 -0
- package/clients/rest/api.js +10 -0
- package/clients/rest/generated/cloud/Api.d.ts +377 -0
- package/clients/rest/generated/cloud/Api.js +326 -0
- package/clients/rest/generated/cloud/data-contracts.d.ts +468 -0
- package/clients/rest/generated/cloud/data-contracts.js +68 -0
- package/clients/rest/generated/cloud/http-client.d.ts +41 -0
- package/clients/rest/generated/cloud/http-client.js +102 -0
- package/clients/rest/index.d.ts +2 -2
- package/clients/rest/index.js +4 -5
- package/clients/worker/compute/compute-config.d.ts +150 -0
- package/clients/worker/compute/compute-config.js +76 -0
- package/clients/worker/compute/managed-compute.d.ts +15 -0
- package/clients/worker/compute/managed-compute.js +100 -0
- package/clients/worker/worker.d.ts +10 -2
- package/clients/worker/worker.js +31 -10
- package/examples/managed-worker.d.ts +1 -0
- package/examples/managed-worker.js +65 -0
- package/package.json +4 -1
- package/protoc/dispatcher/dispatcher.d.ts +19 -0
- package/protoc/dispatcher/dispatcher.js +368 -92
- package/protoc/events/events.js +45 -23
- package/protoc/google/protobuf/timestamp.js +5 -3
- package/protoc/workflows/workflows.js +153 -77
- package/step.d.ts +117 -0
- package/step.js +2 -0
- package/util/config-loader/config-loader.js +19 -1
- package/workflow.d.ts +443 -0
package/step.d.ts
CHANGED
|
@@ -89,11 +89,105 @@ export declare const CreateStepSchema: z.ZodObject<{
|
|
|
89
89
|
comparator?: WorkerLabelComparator | undefined;
|
|
90
90
|
weight?: number | undefined;
|
|
91
91
|
}>]>>>>>;
|
|
92
|
+
compute: z.ZodOptional<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
93
|
+
pool: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
94
|
+
numReplicas: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
regions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion>, "many">>;
|
|
96
|
+
cpus: z.ZodNumber;
|
|
97
|
+
}, {
|
|
98
|
+
cpuKind: z.ZodLiteral<"shared">;
|
|
99
|
+
memoryMb: z.ZodEffects<z.ZodNumber, number, number>;
|
|
100
|
+
}>, "strip", z.ZodTypeAny, {
|
|
101
|
+
numReplicas: number;
|
|
102
|
+
cpus: number;
|
|
103
|
+
cpuKind: "shared";
|
|
104
|
+
memoryMb: number;
|
|
105
|
+
pool?: string | undefined;
|
|
106
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
cpus: number;
|
|
109
|
+
cpuKind: "shared";
|
|
110
|
+
memoryMb: number;
|
|
111
|
+
pool?: string | undefined;
|
|
112
|
+
numReplicas?: number | undefined;
|
|
113
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
114
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
115
|
+
pool: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
116
|
+
numReplicas: z.ZodDefault<z.ZodNumber>;
|
|
117
|
+
regions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion>, "many">>;
|
|
118
|
+
cpus: z.ZodNumber;
|
|
119
|
+
}, {
|
|
120
|
+
cpuKind: z.ZodLiteral<"performance">;
|
|
121
|
+
memoryMb: z.ZodEffects<z.ZodNumber, number, number>;
|
|
122
|
+
}>, "strip", z.ZodTypeAny, {
|
|
123
|
+
numReplicas: number;
|
|
124
|
+
cpus: number;
|
|
125
|
+
cpuKind: "performance";
|
|
126
|
+
memoryMb: number;
|
|
127
|
+
pool?: string | undefined;
|
|
128
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
129
|
+
}, {
|
|
130
|
+
cpus: number;
|
|
131
|
+
cpuKind: "performance";
|
|
132
|
+
memoryMb: number;
|
|
133
|
+
pool?: string | undefined;
|
|
134
|
+
numReplicas?: number | undefined;
|
|
135
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
136
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
137
|
+
pool: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
138
|
+
numReplicas: z.ZodDefault<z.ZodNumber>;
|
|
139
|
+
regions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion>, "many">>;
|
|
140
|
+
cpus: z.ZodNumber;
|
|
141
|
+
}, {
|
|
142
|
+
cpuKind: z.ZodLiteral<"shared">;
|
|
143
|
+
gpuKind: z.ZodEnum<["a10", "l40s", "a100-40gb", "a100-80gb"]>;
|
|
144
|
+
regions: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodNativeEnum<typeof import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion>, "many">, import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[], import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[]>>;
|
|
145
|
+
memoryMb: z.ZodEffects<z.ZodNumber, number, number>;
|
|
146
|
+
}>, "strip", z.ZodTypeAny, {
|
|
147
|
+
numReplicas: number;
|
|
148
|
+
cpus: number;
|
|
149
|
+
cpuKind: "shared";
|
|
150
|
+
memoryMb: number;
|
|
151
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
152
|
+
pool?: string | undefined;
|
|
153
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
cpus: number;
|
|
156
|
+
cpuKind: "shared";
|
|
157
|
+
memoryMb: number;
|
|
158
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
159
|
+
pool?: string | undefined;
|
|
160
|
+
numReplicas?: number | undefined;
|
|
161
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
162
|
+
}>]>>;
|
|
92
163
|
}, "strip", z.ZodTypeAny, {
|
|
93
164
|
name: string;
|
|
94
165
|
timeout?: string | undefined;
|
|
95
166
|
parents?: string[] | undefined;
|
|
96
167
|
retries?: number | undefined;
|
|
168
|
+
compute?: {
|
|
169
|
+
numReplicas: number;
|
|
170
|
+
cpus: number;
|
|
171
|
+
cpuKind: "shared";
|
|
172
|
+
memoryMb: number;
|
|
173
|
+
pool?: string | undefined;
|
|
174
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
175
|
+
} | {
|
|
176
|
+
numReplicas: number;
|
|
177
|
+
cpus: number;
|
|
178
|
+
cpuKind: "performance";
|
|
179
|
+
memoryMb: number;
|
|
180
|
+
pool?: string | undefined;
|
|
181
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
numReplicas: number;
|
|
184
|
+
cpus: number;
|
|
185
|
+
cpuKind: "shared";
|
|
186
|
+
memoryMb: number;
|
|
187
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
188
|
+
pool?: string | undefined;
|
|
189
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
190
|
+
} | undefined;
|
|
97
191
|
rate_limits?: {
|
|
98
192
|
units: string | number;
|
|
99
193
|
key?: string | undefined;
|
|
@@ -113,6 +207,29 @@ export declare const CreateStepSchema: z.ZodObject<{
|
|
|
113
207
|
timeout?: string | undefined;
|
|
114
208
|
parents?: string[] | undefined;
|
|
115
209
|
retries?: number | undefined;
|
|
210
|
+
compute?: {
|
|
211
|
+
cpus: number;
|
|
212
|
+
cpuKind: "shared";
|
|
213
|
+
memoryMb: number;
|
|
214
|
+
pool?: string | undefined;
|
|
215
|
+
numReplicas?: number | undefined;
|
|
216
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
217
|
+
} | {
|
|
218
|
+
cpus: number;
|
|
219
|
+
cpuKind: "performance";
|
|
220
|
+
memoryMb: number;
|
|
221
|
+
pool?: string | undefined;
|
|
222
|
+
numReplicas?: number | undefined;
|
|
223
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
224
|
+
} | {
|
|
225
|
+
cpus: number;
|
|
226
|
+
cpuKind: "shared";
|
|
227
|
+
memoryMb: number;
|
|
228
|
+
gpuKind: "a10" | "l40s" | "a100-40gb" | "a100-80gb";
|
|
229
|
+
pool?: string | undefined;
|
|
230
|
+
numReplicas?: number | undefined;
|
|
231
|
+
regions?: import("./clients/rest/generated/cloud/data-contracts").ManagedWorkerRegion[] | undefined;
|
|
232
|
+
} | undefined;
|
|
116
233
|
rate_limits?: {
|
|
117
234
|
units: string | number;
|
|
118
235
|
key?: string | undefined;
|
package/step.js
CHANGED
|
@@ -44,6 +44,7 @@ const workflow_1 = require("./workflow");
|
|
|
44
44
|
const logger_1 = require("./util/logger");
|
|
45
45
|
const parse_1 = require("./util/parse");
|
|
46
46
|
const workflows_1 = require("./protoc/workflows");
|
|
47
|
+
const compute_config_1 = require("./clients/worker/compute/compute-config");
|
|
47
48
|
exports.CreateRateLimitSchema = z.object({
|
|
48
49
|
key: z.string().optional(),
|
|
49
50
|
staticKey: z.string().optional(),
|
|
@@ -74,6 +75,7 @@ exports.CreateStepSchema = z.object({
|
|
|
74
75
|
retries: z.number().optional(),
|
|
75
76
|
rate_limits: z.array(exports.CreateRateLimitSchema).optional(),
|
|
76
77
|
worker_labels: z.record(z.lazy(() => exports.DesiredWorkerLabelSchema)).optional(),
|
|
78
|
+
compute: compute_config_1.ComputeSchema.optional(),
|
|
77
79
|
});
|
|
78
80
|
class ContextWorker {
|
|
79
81
|
constructor(worker) {
|
|
@@ -66,6 +66,22 @@ class ConfigLoader {
|
|
|
66
66
|
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');
|
|
67
67
|
}
|
|
68
68
|
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');
|
|
69
|
+
let rawRunnableActions;
|
|
70
|
+
if (override === null || override === void 0 ? void 0 : override.runnable_actions) {
|
|
71
|
+
rawRunnableActions = override.runnable_actions;
|
|
72
|
+
}
|
|
73
|
+
else if (yaml === null || yaml === void 0 ? void 0 : yaml.runnable_actions) {
|
|
74
|
+
rawRunnableActions = yaml.runnable_actions;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const envActions = this.env('HATCHET_CLOUD_ACTIONS');
|
|
78
|
+
if (envActions) {
|
|
79
|
+
rawRunnableActions = envActions.split(',');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const registerId = this.env('HATCHET_CLOUD_REGISTER_ID');
|
|
83
|
+
const namespacePrefix = namespace ? `${namespace}_`.toLowerCase() : '';
|
|
84
|
+
const runnableActions = rawRunnableActions === null || rawRunnableActions === void 0 ? void 0 : rawRunnableActions.map((action) => namespacePrefix + action.trim());
|
|
69
85
|
return {
|
|
70
86
|
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'),
|
|
71
87
|
host_port: grpcBroadcastAddress,
|
|
@@ -73,7 +89,9 @@ class ConfigLoader {
|
|
|
73
89
|
tls_config: tlsConfig,
|
|
74
90
|
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',
|
|
75
91
|
tenant_id: tenantId,
|
|
76
|
-
namespace:
|
|
92
|
+
namespace: namespacePrefix,
|
|
93
|
+
runnable_actions: runnableActions,
|
|
94
|
+
cloud_register_id: registerId,
|
|
77
95
|
};
|
|
78
96
|
}
|
|
79
97
|
static get default_yaml_config_path() {
|