@helmr/sdk 0.1.0-preview.g52eb0eef.b35190749915
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/LICENSE +190 -0
- package/README.md +65 -0
- package/dist/actor.d.ts +3 -0
- package/dist/client-actor.d.ts +32 -0
- package/dist/client-deployment.d.ts +30 -0
- package/dist/client-sandbox.d.ts +26 -0
- package/dist/client-schedule.d.ts +44 -0
- package/dist/client-secret.d.ts +51 -0
- package/dist/client-session.d.ts +38 -0
- package/dist/client-workspace.d.ts +36 -0
- package/dist/client.d.ts +153 -0
- package/dist/config.d.ts +11 -0
- package/dist/contract.d.ts +341 -0
- package/dist/definitions.d.ts +42 -0
- package/dist/fuzzy.d.ts +1 -0
- package/dist/fuzzy.js +29 -0
- package/dist/image.d.ts +63 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +3029 -0
- package/dist/internal/abort.d.ts +1 -0
- package/dist/internal/definition-query.d.ts +10 -0
- package/dist/internal/id.d.ts +1 -0
- package/dist/internal/jsoncanon.d.ts +5 -0
- package/dist/internal/origin.d.ts +1 -0
- package/dist/internal/program.d.ts +10 -0
- package/dist/internal/run-failure.d.ts +2 -0
- package/dist/internal/run-handle.d.ts +3 -0
- package/dist/internal/runtime.d.ts +43 -0
- package/dist/internal/session.d.ts +5 -0
- package/dist/internal/strings.d.ts +1 -0
- package/dist/internal/timestamp.d.ts +1 -0
- package/dist/internal/utf8.d.ts +3 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +994 -0
- package/dist/logger.d.ts +9 -0
- package/dist/metadata.d.ts +6 -0
- package/dist/request.d.ts +3 -0
- package/dist/schedules.d.ts +33 -0
- package/dist/schema/payload.d.ts +39 -0
- package/dist/schema/task.d.ts +3 -0
- package/dist/secret.d.ts +1 -0
- package/dist/session.d.ts +5 -0
- package/dist/task.d.ts +2 -0
- package/dist/timers.d.ts +6 -0
- package/dist/tokens.d.ts +77 -0
- package/dist/workspace.d.ts +142 -0
- package/package.json +49 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface HelmrConfigInput {
|
|
2
|
+
readonly dirs?: readonly string[];
|
|
3
|
+
readonly ignorePatterns?: readonly string[];
|
|
4
|
+
}
|
|
5
|
+
export interface HelmrConfig {
|
|
6
|
+
readonly dirs: readonly string[];
|
|
7
|
+
readonly ignorePatterns: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function defineConfig(input: HelmrConfigInput): HelmrConfig;
|
|
10
|
+
export declare function inspectConfig(value: unknown): HelmrConfig;
|
|
11
|
+
export declare function matchesIgnorePattern(pattern: string, path: string): boolean;
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import type { PayloadSchema } from "./schema/payload.js";
|
|
2
|
+
import type { RequestOptions } from "./request.js";
|
|
3
|
+
import type { WorkspaceRef } from "./workspace.js";
|
|
4
|
+
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
5
|
+
readonly [key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
export type Serializable = JsonValue;
|
|
8
|
+
export type Metadata = Readonly<Record<string, JsonValue>>;
|
|
9
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
export type { PayloadSchema };
|
|
11
|
+
export interface CursorPage<T> {
|
|
12
|
+
readonly items: readonly T[];
|
|
13
|
+
readonly nextCursor?: string;
|
|
14
|
+
}
|
|
15
|
+
export type Duration = string;
|
|
16
|
+
export type RetryPolicy = Readonly<{
|
|
17
|
+
enabled?: true;
|
|
18
|
+
maxAttempts: number;
|
|
19
|
+
backoff?: Readonly<{
|
|
20
|
+
minDelay?: Duration;
|
|
21
|
+
maxDelay?: Duration;
|
|
22
|
+
factor?: number;
|
|
23
|
+
jitter?: "none" | "full";
|
|
24
|
+
}>;
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
enabled: false;
|
|
27
|
+
}>;
|
|
28
|
+
declare const queueTypeBrand: unique symbol;
|
|
29
|
+
export interface QueueConfig {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly concurrencyLimit?: number | null;
|
|
32
|
+
}
|
|
33
|
+
export interface Queue extends QueueConfig {
|
|
34
|
+
readonly [queueTypeBrand]: true;
|
|
35
|
+
}
|
|
36
|
+
export interface RunOptions {
|
|
37
|
+
readonly queue?: string;
|
|
38
|
+
readonly concurrencyKey?: string;
|
|
39
|
+
readonly priority?: number;
|
|
40
|
+
readonly ttl?: Duration;
|
|
41
|
+
readonly retry?: RetryPolicy;
|
|
42
|
+
readonly metadata?: Metadata;
|
|
43
|
+
readonly tags?: readonly string[];
|
|
44
|
+
}
|
|
45
|
+
export interface RunDefaults {
|
|
46
|
+
readonly queue?: Queue | string;
|
|
47
|
+
readonly maxDuration?: Duration;
|
|
48
|
+
readonly ttl?: Duration;
|
|
49
|
+
readonly retry?: RetryPolicy;
|
|
50
|
+
}
|
|
51
|
+
declare const workspaceAddressTypeBrand: unique symbol;
|
|
52
|
+
export interface WorkspaceAddress {
|
|
53
|
+
readonly [workspaceAddressTypeBrand]: true;
|
|
54
|
+
readonly id: string;
|
|
55
|
+
}
|
|
56
|
+
export type RunCause = Readonly<{
|
|
57
|
+
type: "api" | "manual";
|
|
58
|
+
}> | Readonly<{
|
|
59
|
+
type: "child";
|
|
60
|
+
parentRunId: string;
|
|
61
|
+
}> | Readonly<{
|
|
62
|
+
type: "schedule";
|
|
63
|
+
scheduleId: string;
|
|
64
|
+
scheduledAt: string;
|
|
65
|
+
lastScheduledAt?: string;
|
|
66
|
+
timezone: string;
|
|
67
|
+
}> | Readonly<{
|
|
68
|
+
type: "actor_start" | "continuation";
|
|
69
|
+
}>;
|
|
70
|
+
interface RunContext {
|
|
71
|
+
readonly signal: AbortSignal;
|
|
72
|
+
readonly run: Readonly<{
|
|
73
|
+
id: string;
|
|
74
|
+
attemptNumber: number;
|
|
75
|
+
cause: RunCause;
|
|
76
|
+
}>;
|
|
77
|
+
readonly deployment: Readonly<{
|
|
78
|
+
id: string;
|
|
79
|
+
version: string;
|
|
80
|
+
}>;
|
|
81
|
+
readonly workspace: WorkspaceRef;
|
|
82
|
+
}
|
|
83
|
+
export interface TaskContext extends RunContext {
|
|
84
|
+
readonly task: Readonly<{
|
|
85
|
+
id: string;
|
|
86
|
+
}>;
|
|
87
|
+
readonly actor?: never;
|
|
88
|
+
}
|
|
89
|
+
export interface ActorContext extends RunContext {
|
|
90
|
+
readonly task?: never;
|
|
91
|
+
readonly actor: Readonly<{
|
|
92
|
+
id: string;
|
|
93
|
+
}>;
|
|
94
|
+
}
|
|
95
|
+
export interface HelmrError extends Error {
|
|
96
|
+
readonly code: string;
|
|
97
|
+
readonly requestId?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface APIError extends HelmrError {
|
|
100
|
+
readonly details?: Readonly<Record<string, JsonValue>>;
|
|
101
|
+
}
|
|
102
|
+
export type RunStatus = "queued" | "running" | "waiting" | "retry_delayed" | "cancel_requested" | "succeeded" | "failed" | "cancelled" | "expired" | "system_failed";
|
|
103
|
+
declare const runHandleOutputBrand: unique symbol;
|
|
104
|
+
export interface RunHandle<TOutput extends JsonValue = JsonValue> {
|
|
105
|
+
readonly id: string;
|
|
106
|
+
readonly [runHandleOutputBrand]: TOutput;
|
|
107
|
+
}
|
|
108
|
+
export interface RunFailure {
|
|
109
|
+
readonly code: string;
|
|
110
|
+
readonly message: string;
|
|
111
|
+
readonly details: Readonly<Record<string, JsonValue>>;
|
|
112
|
+
}
|
|
113
|
+
export interface Run<TOutput extends JsonValue = JsonValue> extends RunHandle<TOutput> {
|
|
114
|
+
readonly status: RunStatus;
|
|
115
|
+
readonly entrypoint: Readonly<{
|
|
116
|
+
kind: "task" | "actor";
|
|
117
|
+
id: string;
|
|
118
|
+
}>;
|
|
119
|
+
readonly deployment: Readonly<{
|
|
120
|
+
id: string;
|
|
121
|
+
version: string;
|
|
122
|
+
}>;
|
|
123
|
+
readonly workspaceId: string;
|
|
124
|
+
readonly sessionId?: string;
|
|
125
|
+
readonly parentRunId?: string;
|
|
126
|
+
readonly currentAttemptNumber: number;
|
|
127
|
+
readonly cause: RunCause;
|
|
128
|
+
readonly metadata: Metadata;
|
|
129
|
+
readonly tags: readonly string[];
|
|
130
|
+
readonly output?: TOutput;
|
|
131
|
+
readonly failure?: RunFailure;
|
|
132
|
+
readonly createdAt: string;
|
|
133
|
+
readonly startedAt?: string;
|
|
134
|
+
readonly terminalAt?: string;
|
|
135
|
+
}
|
|
136
|
+
export type TaskResult<T extends JsonValue> = Readonly<{
|
|
137
|
+
ok: true;
|
|
138
|
+
output: T;
|
|
139
|
+
run: RunHandle<T>;
|
|
140
|
+
}> | Readonly<{
|
|
141
|
+
ok: false;
|
|
142
|
+
failure: RunFailure;
|
|
143
|
+
run: RunHandle<T>;
|
|
144
|
+
}>;
|
|
145
|
+
export interface TaskWait<T extends JsonValue> extends PromiseLike<TaskResult<T>> {
|
|
146
|
+
unwrap(): Promise<T>;
|
|
147
|
+
}
|
|
148
|
+
export interface TaskStartOptions extends RunOptions {
|
|
149
|
+
readonly idempotencyKey?: string;
|
|
150
|
+
readonly workspace: WorkspaceRef;
|
|
151
|
+
readonly signal?: AbortSignal;
|
|
152
|
+
}
|
|
153
|
+
export interface TaskCallOptions extends RunOptions {
|
|
154
|
+
readonly idempotencyKey: string;
|
|
155
|
+
readonly workspace: WorkspaceRef;
|
|
156
|
+
readonly signal?: AbortSignal;
|
|
157
|
+
}
|
|
158
|
+
declare const taskBrand: unique symbol;
|
|
159
|
+
interface TaskTypeInfo<TIdentifier extends string, TInput extends JsonValue, TOutput extends JsonValue> {
|
|
160
|
+
readonly identifier: TIdentifier;
|
|
161
|
+
readonly input: TInput;
|
|
162
|
+
readonly output: TOutput;
|
|
163
|
+
}
|
|
164
|
+
export interface Task<TIdentifier extends string = string, TInput extends JsonValue = JsonValue, TOutput extends JsonValue = JsonValue> {
|
|
165
|
+
readonly [taskBrand]: TaskTypeInfo<TIdentifier, TInput, TOutput>;
|
|
166
|
+
readonly id: TIdentifier;
|
|
167
|
+
readonly hasPayload: boolean;
|
|
168
|
+
start(...args: [TInput] extends [never] ? [options: TaskStartOptions] : [payload: TInput, options: TaskStartOptions]): Promise<RunHandle<TOutput>>;
|
|
169
|
+
call(...args: [TInput] extends [never] ? [options: TaskCallOptions] : [payload: TInput, options: TaskCallOptions]): TaskWait<TOutput>;
|
|
170
|
+
}
|
|
171
|
+
export type TaskInput<TTask extends Task> = TTask[typeof taskBrand]["input"];
|
|
172
|
+
export type TaskOutput<TTask extends Task> = TTask[typeof taskBrand]["output"];
|
|
173
|
+
export type TaskConfigWithPayload<TIdentifier extends string, TInput extends JsonValue, TPayload, TOutput extends JsonValue> = RunDefaults & Readonly<{
|
|
174
|
+
id: TIdentifier;
|
|
175
|
+
payload: PayloadSchema<TInput, TPayload>;
|
|
176
|
+
run(payload: TPayload, ctx: TaskContext): MaybePromise<TOutput>;
|
|
177
|
+
}>;
|
|
178
|
+
export type TaskConfigWithoutPayload<TIdentifier extends string, TOutput extends JsonValue> = RunDefaults & Readonly<{
|
|
179
|
+
id: TIdentifier;
|
|
180
|
+
payload?: never;
|
|
181
|
+
run(ctx: TaskContext): MaybePromise<TOutput>;
|
|
182
|
+
}>;
|
|
183
|
+
export type TaskConfig<TIdentifier extends string = string, TInput extends JsonValue = never, TPayload = never, TOutput extends JsonValue = JsonValue> = TaskConfigWithPayload<TIdentifier, TInput, TPayload, TOutput> | TaskConfigWithoutPayload<TIdentifier, TOutput>;
|
|
184
|
+
export type SessionInputSource = Readonly<{
|
|
185
|
+
type: "external";
|
|
186
|
+
}> | Readonly<{
|
|
187
|
+
type: "run";
|
|
188
|
+
runId: string;
|
|
189
|
+
}>;
|
|
190
|
+
export interface WaitTimeoutError extends HelmrError {
|
|
191
|
+
readonly code: "wait_timeout";
|
|
192
|
+
}
|
|
193
|
+
export interface SessionClosedError extends HelmrError {
|
|
194
|
+
readonly code: "session_closed";
|
|
195
|
+
}
|
|
196
|
+
export interface SessionInputMetadata {
|
|
197
|
+
readonly id: string;
|
|
198
|
+
readonly sequence: number;
|
|
199
|
+
readonly createdAt: string;
|
|
200
|
+
readonly source: SessionInputSource;
|
|
201
|
+
}
|
|
202
|
+
export interface SessionInputRecord extends SessionInputMetadata {
|
|
203
|
+
readonly data: JsonValue;
|
|
204
|
+
}
|
|
205
|
+
export type ActorSessionInputResult = Readonly<{
|
|
206
|
+
ok: true;
|
|
207
|
+
value: JsonValue;
|
|
208
|
+
record: SessionInputMetadata;
|
|
209
|
+
}> | Readonly<{
|
|
210
|
+
ok: false;
|
|
211
|
+
error: WaitTimeoutError | SessionClosedError;
|
|
212
|
+
}>;
|
|
213
|
+
export interface ActorSessionReceive extends PromiseLike<ActorSessionInputResult> {
|
|
214
|
+
unwrap(): Promise<JsonValue>;
|
|
215
|
+
}
|
|
216
|
+
export interface SessionInputSendRequest {
|
|
217
|
+
readonly idempotencyKey?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface ActorSessionReceiveOptions {
|
|
220
|
+
readonly timeout?: Duration;
|
|
221
|
+
readonly idleTimeout?: Duration;
|
|
222
|
+
readonly metadata?: Metadata;
|
|
223
|
+
readonly tags?: readonly string[];
|
|
224
|
+
}
|
|
225
|
+
export interface ActorSessionInput {
|
|
226
|
+
receive(options?: ActorSessionReceiveOptions): ActorSessionReceive;
|
|
227
|
+
}
|
|
228
|
+
export interface SessionOutputRecord {
|
|
229
|
+
readonly id: string;
|
|
230
|
+
readonly sequence: number;
|
|
231
|
+
readonly data: unknown;
|
|
232
|
+
readonly contentType: string;
|
|
233
|
+
readonly createdAt: string;
|
|
234
|
+
readonly provenance: Readonly<{
|
|
235
|
+
runId: string;
|
|
236
|
+
attemptNumber: number;
|
|
237
|
+
deploymentId: string;
|
|
238
|
+
}>;
|
|
239
|
+
}
|
|
240
|
+
export interface ActorSessionOutputAppendOptions {
|
|
241
|
+
readonly contentType?: string;
|
|
242
|
+
readonly idempotencyKey?: string;
|
|
243
|
+
}
|
|
244
|
+
export interface ActorSessionOutputSequenceOptions {
|
|
245
|
+
readonly contentType?: string;
|
|
246
|
+
}
|
|
247
|
+
export interface SessionOutputQuery {
|
|
248
|
+
readonly after?: number;
|
|
249
|
+
readonly limit?: number;
|
|
250
|
+
}
|
|
251
|
+
export interface SessionInputQuery {
|
|
252
|
+
readonly after?: number;
|
|
253
|
+
readonly limit?: number;
|
|
254
|
+
}
|
|
255
|
+
export interface SessionOutputWriter {
|
|
256
|
+
write(value: Serializable): Promise<SessionOutputRecord>;
|
|
257
|
+
close(): Promise<void>;
|
|
258
|
+
}
|
|
259
|
+
export interface ActorSessionOutput {
|
|
260
|
+
append(value: Serializable, options?: ActorSessionOutputAppendOptions): Promise<SessionOutputRecord>;
|
|
261
|
+
pipe(source: AsyncIterable<Serializable> | Iterable<Serializable>, options?: ActorSessionOutputSequenceOptions): Promise<void>;
|
|
262
|
+
writer(options?: ActorSessionOutputSequenceOptions): SessionOutputWriter;
|
|
263
|
+
}
|
|
264
|
+
export interface SessionOutputPage {
|
|
265
|
+
readonly records: readonly SessionOutputRecord[];
|
|
266
|
+
readonly nextAfter: number;
|
|
267
|
+
readonly hasMore: boolean;
|
|
268
|
+
}
|
|
269
|
+
export interface SessionInputPage {
|
|
270
|
+
readonly records: readonly SessionInputRecord[];
|
|
271
|
+
readonly nextAfter: number;
|
|
272
|
+
readonly hasMore: boolean;
|
|
273
|
+
}
|
|
274
|
+
export interface ActorSession {
|
|
275
|
+
readonly id: string;
|
|
276
|
+
readonly key?: string;
|
|
277
|
+
readonly input: ActorSessionInput;
|
|
278
|
+
readonly output: ActorSessionOutput;
|
|
279
|
+
}
|
|
280
|
+
export interface ActorConfig extends RunDefaults {
|
|
281
|
+
readonly id: string;
|
|
282
|
+
readonly idleTimeout?: Duration;
|
|
283
|
+
readonly run: (session: ActorSession, ctx: ActorContext) => MaybePromise<void>;
|
|
284
|
+
}
|
|
285
|
+
export interface ActorStartOptions {
|
|
286
|
+
readonly key?: string;
|
|
287
|
+
readonly input?: JsonValue;
|
|
288
|
+
readonly idempotencyKey?: string;
|
|
289
|
+
readonly workspace: WorkspaceRef;
|
|
290
|
+
readonly run?: RunOptions;
|
|
291
|
+
readonly signal?: AbortSignal;
|
|
292
|
+
}
|
|
293
|
+
export type SessionStatus = "open" | "closed" | "cancelled" | "failed";
|
|
294
|
+
export type SessionFailureCode = string;
|
|
295
|
+
export interface SessionFailure {
|
|
296
|
+
readonly code: SessionFailureCode;
|
|
297
|
+
readonly message: string;
|
|
298
|
+
readonly details: Readonly<{
|
|
299
|
+
runId?: string;
|
|
300
|
+
}>;
|
|
301
|
+
}
|
|
302
|
+
export interface Session {
|
|
303
|
+
readonly id: string;
|
|
304
|
+
readonly actorId: string;
|
|
305
|
+
readonly deploymentId: string;
|
|
306
|
+
readonly workspaceId: string;
|
|
307
|
+
readonly key?: string;
|
|
308
|
+
readonly status: SessionStatus;
|
|
309
|
+
readonly createdAt: string;
|
|
310
|
+
readonly updatedAt: string;
|
|
311
|
+
readonly currentRunId?: string;
|
|
312
|
+
readonly failure?: SessionFailure;
|
|
313
|
+
}
|
|
314
|
+
export interface SessionCloseRequest {
|
|
315
|
+
readonly idempotencyKey?: string;
|
|
316
|
+
}
|
|
317
|
+
export interface SessionCloseReceipt {
|
|
318
|
+
readonly sessionId: string;
|
|
319
|
+
readonly acceptedAt: string;
|
|
320
|
+
}
|
|
321
|
+
export interface SessionRef {
|
|
322
|
+
readonly id: string;
|
|
323
|
+
readonly input: Readonly<{
|
|
324
|
+
send(input: JsonValue, request?: SessionInputSendRequest, options?: RequestOptions): Promise<SessionInputRecord>;
|
|
325
|
+
}>;
|
|
326
|
+
readonly output: Readonly<{
|
|
327
|
+
list(query?: SessionOutputQuery, options?: RequestOptions): Promise<SessionOutputPage>;
|
|
328
|
+
}>;
|
|
329
|
+
retrieve(options?: RequestOptions): Promise<Session>;
|
|
330
|
+
close(request?: SessionCloseRequest, options?: RequestOptions): Promise<SessionCloseReceipt>;
|
|
331
|
+
}
|
|
332
|
+
declare const actorTypeBrand: unique symbol;
|
|
333
|
+
export interface ActorStartResult {
|
|
334
|
+
readonly session: SessionRef;
|
|
335
|
+
readonly run: RunHandle<null>;
|
|
336
|
+
}
|
|
337
|
+
export interface Actor {
|
|
338
|
+
readonly [actorTypeBrand]: true;
|
|
339
|
+
readonly id: string;
|
|
340
|
+
start(options: ActorStartOptions): Promise<ActorStartResult>;
|
|
341
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ActorConfig, type Actor, type JsonValue, type Queue, type QueueConfig, type Task, type TaskConfigWithPayload, type TaskConfigWithoutPayload } from "./contract.js";
|
|
2
|
+
import { type PayloadSchema } from "./schema/payload.js";
|
|
3
|
+
export type InternalTaskDefinition = Readonly<{
|
|
4
|
+
kind: "task";
|
|
5
|
+
id: string;
|
|
6
|
+
hasPayload: boolean;
|
|
7
|
+
handler: (...args: readonly unknown[]) => unknown;
|
|
8
|
+
payloadSchema?: PayloadSchema;
|
|
9
|
+
queue?: Queue | string;
|
|
10
|
+
maxDuration?: import("./contract.js").Duration;
|
|
11
|
+
ttl?: import("./contract.js").Duration;
|
|
12
|
+
retry?: ActorConfig["retry"];
|
|
13
|
+
schedule?: Readonly<{
|
|
14
|
+
cron: string;
|
|
15
|
+
timezone: string;
|
|
16
|
+
workspace: Readonly<{
|
|
17
|
+
sandbox: import("./workspace.js").Sandbox;
|
|
18
|
+
secrets: readonly import("./workspace.js").EncodedWorkspaceSecret[];
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
export type InternalActorDefinition = Readonly<{
|
|
23
|
+
kind: "actor";
|
|
24
|
+
id: string;
|
|
25
|
+
handler: ActorConfig["run"];
|
|
26
|
+
queue?: Queue | string;
|
|
27
|
+
maxDuration?: import("./contract.js").Duration;
|
|
28
|
+
ttl?: import("./contract.js").Duration;
|
|
29
|
+
retry?: ActorConfig["retry"];
|
|
30
|
+
idleTimeout?: ActorConfig["idleTimeout"];
|
|
31
|
+
}>;
|
|
32
|
+
export type InternalDefinition = InternalTaskDefinition | InternalActorDefinition;
|
|
33
|
+
export declare function inspectDefinition(value: unknown): InternalDefinition | undefined;
|
|
34
|
+
export declare function isQueue(value: unknown): value is Queue;
|
|
35
|
+
export declare function queue(config: QueueConfig): Queue;
|
|
36
|
+
export declare function task<TIdentifier extends string, TInput extends JsonValue, TPayload, TOutput extends JsonValue>(config: TaskConfigWithPayload<TIdentifier, TInput, TPayload, TOutput>): Task<TIdentifier, TInput, TOutput>;
|
|
37
|
+
export declare function task<TIdentifier extends string, TOutput extends JsonValue>(config: TaskConfigWithoutPayload<TIdentifier, TOutput>): Task<TIdentifier, never, TOutput>;
|
|
38
|
+
export declare function actor(config: ActorConfig): Actor;
|
|
39
|
+
export declare function createScheduledTask<TIdentifier extends string, TInput extends JsonValue, TPayload, TOutput extends JsonValue>(config: Omit<TaskConfigWithPayload<TIdentifier, TInput, TPayload, TOutput>, "payload"> & {
|
|
40
|
+
readonly payload: PayloadSchema<TInput, TPayload>;
|
|
41
|
+
readonly schedule: NonNullable<InternalTaskDefinition["schedule"]>;
|
|
42
|
+
}): Task<TIdentifier, TInput, TOutput>;
|
package/dist/fuzzy.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function levenshteinDistance(left: string, right: string): number;
|
package/dist/fuzzy.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// sdk/typescript/src/fuzzy.ts
|
|
2
|
+
function levenshteinDistance(left, right) {
|
|
3
|
+
if (left === right) {
|
|
4
|
+
return 0;
|
|
5
|
+
}
|
|
6
|
+
if (left.length === 0) {
|
|
7
|
+
return right.length;
|
|
8
|
+
}
|
|
9
|
+
if (right.length === 0) {
|
|
10
|
+
return left.length;
|
|
11
|
+
}
|
|
12
|
+
const previous = new Array(right.length + 1);
|
|
13
|
+
const current = new Array(right.length + 1);
|
|
14
|
+
for (let column = 0;column <= right.length; column += 1) {
|
|
15
|
+
previous[column] = column;
|
|
16
|
+
}
|
|
17
|
+
for (let row = 1;row <= left.length; row += 1) {
|
|
18
|
+
current[0] = row;
|
|
19
|
+
for (let column = 1;column <= right.length; column += 1) {
|
|
20
|
+
const cost = left[row - 1] === right[column - 1] ? 0 : 1;
|
|
21
|
+
current[column] = Math.min(current[column - 1] + 1, previous[column] + 1, previous[column - 1] + cost);
|
|
22
|
+
}
|
|
23
|
+
previous.splice(0, previous.length, ...current);
|
|
24
|
+
}
|
|
25
|
+
return previous[right.length] ?? right.length;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
levenshteinDistance
|
|
29
|
+
};
|
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
declare const sourceFileTypeBrand: unique symbol;
|
|
2
|
+
declare const sourceDirectoryTypeBrand: unique symbol;
|
|
3
|
+
declare const imageBuilderTypeBrand: unique symbol;
|
|
4
|
+
export interface SourceFile {
|
|
5
|
+
readonly [sourceFileTypeBrand]: true;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SourceDirectory {
|
|
9
|
+
readonly [sourceDirectoryTypeBrand]: true;
|
|
10
|
+
readonly path: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ImageBuilder {
|
|
13
|
+
readonly [imageBuilderTypeBrand]: true;
|
|
14
|
+
readonly key: string;
|
|
15
|
+
from(ref: string): ImageBuilder;
|
|
16
|
+
run(argv: readonly string[]): ImageBuilder;
|
|
17
|
+
copy(destination: string, source: SourceFile | SourceDirectory): ImageBuilder;
|
|
18
|
+
copyFrom(destination: string, source: ImageBuilder, sourcePath: string): ImageBuilder;
|
|
19
|
+
workdir(path: string): ImageBuilder;
|
|
20
|
+
env(key: string, value: string): ImageBuilder;
|
|
21
|
+
user(name: string): ImageBuilder;
|
|
22
|
+
}
|
|
23
|
+
export type InternalImageStep = Readonly<{
|
|
24
|
+
kind: "from";
|
|
25
|
+
ref: string;
|
|
26
|
+
}> | Readonly<{
|
|
27
|
+
kind: "run";
|
|
28
|
+
argv: readonly string[];
|
|
29
|
+
}> | Readonly<{
|
|
30
|
+
kind: "copy_source_file";
|
|
31
|
+
destination: string;
|
|
32
|
+
source: SourceFile;
|
|
33
|
+
}> | Readonly<{
|
|
34
|
+
kind: "copy_source_directory";
|
|
35
|
+
destination: string;
|
|
36
|
+
source: SourceDirectory;
|
|
37
|
+
}> | Readonly<{
|
|
38
|
+
kind: "copy_from_image";
|
|
39
|
+
destination: string;
|
|
40
|
+
source: ImageBuilder;
|
|
41
|
+
sourcePath: string;
|
|
42
|
+
}> | Readonly<{
|
|
43
|
+
kind: "workdir";
|
|
44
|
+
path: string;
|
|
45
|
+
}> | Readonly<{
|
|
46
|
+
kind: "env";
|
|
47
|
+
key: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}> | Readonly<{
|
|
50
|
+
kind: "user";
|
|
51
|
+
name: string;
|
|
52
|
+
}>;
|
|
53
|
+
export interface InternalImage {
|
|
54
|
+
readonly key: string;
|
|
55
|
+
readonly steps: readonly InternalImageStep[];
|
|
56
|
+
}
|
|
57
|
+
export declare function image(key: string): ImageBuilder;
|
|
58
|
+
export declare const source: Readonly<{
|
|
59
|
+
file(path: string): SourceFile;
|
|
60
|
+
directory(path: string): SourceDirectory;
|
|
61
|
+
}>;
|
|
62
|
+
export declare function inspectImage(value: unknown): InternalImage | undefined;
|
|
63
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { actor } from "./actor.js";
|
|
2
|
+
export { sessions } from "./session.js";
|
|
3
|
+
export { HelmrClient } from "./client.js";
|
|
4
|
+
export { image, source } from "./image.js";
|
|
5
|
+
export { logger } from "./logger.js";
|
|
6
|
+
export { metadata } from "./metadata.js";
|
|
7
|
+
export { defineConfig } from "./config.js";
|
|
8
|
+
export { schedules } from "./schedules.js";
|
|
9
|
+
export { queue, task } from "./task.js";
|
|
10
|
+
export { timers } from "./timers.js";
|
|
11
|
+
export { tokens } from "./tokens.js";
|
|
12
|
+
export { sandbox, workspaces } from "./workspace.js";
|
|
13
|
+
export type { ActorInfo, ActorListItem, ActorListQuery, ActorPage, ActorRetrieveQuery, ActorStartRequest, } from "./client-actor.js";
|
|
14
|
+
export type { ClientSessionRef, SessionListQuery, } from "./client-session.js";
|
|
15
|
+
export type { SandboxInfo, SandboxListItem, SandboxListQuery, SandboxPage, SandboxRetrieveQuery, } from "./client-sandbox.js";
|
|
16
|
+
export type { WorkspaceListItem, WorkspaceListQuery, } from "./client-workspace.js";
|
|
17
|
+
export type { DeploymentListItem, DeploymentListQuery, Deployment, } from "./client-deployment.js";
|
|
18
|
+
export type { ScheduleFailure, ScheduleListQuery, Schedule, ScheduleStatus, } from "./client-schedule.js";
|
|
19
|
+
export type { SecretRef, SecretCreateRequest, SecretListQuery, SecretRevokeRequest, SecretRotateRequest, Secret, SecretStatus, } from "./client-secret.js";
|
|
20
|
+
export type { RunEntrypointKind, RunListQuery, RunLogQuery, RunEventQuery, TaskStartRequest, HelmrClientOptions, TaskInfo, TaskListItem, TaskListQuery, TaskPage, TaskRetrieveQuery, RunEventRecord, RunListItem, RunLogRecord, StreamRunLogRecord, StructuredRunLogRecord, TokenCancelRequest, TokenCompleteRequest, } from "./client.js";
|
|
21
|
+
export type { RequestOptions } from "./request.js";
|
|
22
|
+
export type { LogAttributes, RunLogLevel, } from "./logger.js";
|
|
23
|
+
export type { HelmrConfig, HelmrConfigInput, } from "./config.js";
|
|
24
|
+
export type { SessionClosedError, APIError, ActorConfig, Actor, ActorContext, ActorSession, ActorSessionInput, ActorSessionOutput, ActorSessionOutputAppendOptions, ActorSessionOutputSequenceOptions, ActorSessionInputResult, ActorSessionReceiveOptions, ActorSessionReceive, SessionInputMetadata, SessionInputPage, SessionInputQuery, SessionInputRecord, SessionInputSendRequest, SessionInputSource, SessionFailure, SessionFailureCode, SessionStatus, SessionCloseRequest, SessionCloseReceipt, SessionOutputRecord, SessionOutputPage, SessionOutputQuery, SessionOutputWriter, SessionRef, ActorStartOptions, ActorStartResult, Session, CursorPage, Duration, HelmrError, JsonValue, MaybePromise, Metadata, PayloadSchema, Queue, QueueConfig, RetryPolicy, RunCause, RunFailure, RunHandle, RunOptions, Run, RunStatus, Serializable, TaskCallOptions, TaskConfig, TaskConfigWithPayload, TaskConfigWithoutPayload, Task, TaskContext, TaskInput, TaskOutput, TaskResult, TaskStartOptions, TaskWait, WaitTimeoutError, } from "./contract.js";
|
|
25
|
+
export type { ImageBuilder, SourceDirectory, SourceFile, } from "./image.js";
|
|
26
|
+
export type { Cron, ScheduledTaskConfig, ScheduledTaskInput, ScheduledTaskPayload, } from "./schedules.js";
|
|
27
|
+
export type { TokenCreateRequest, TokenCreateResult, TokenCancelledError, TokenExpiredError, TokenRef, TokenListItem, TokenListQuery, Token, TokenStatus, TokenWait, TokenWaitError, TokenWaitOptions, TokenWaitResult, } from "./tokens.js";
|
|
28
|
+
export type { SandboxBuilder, SandboxConfig, SandboxResourceBuilder, WorkspaceCreateRequest, WorkspaceDeleteRequest, WorkspaceDeleteReceipt, Sandbox, WorkspaceExecRequest, WorkspaceExecResult, WorkspaceMemory, WorkspaceRef, WorkspaceResources, WorkspaceSecretBinding, Workspace, WorkspaceOwner, WorkspaceStatus, } from "./workspace.js";
|
|
29
|
+
export type { PayloadSchemaInput, PayloadSchemaOutput, StandardSchemaV1, } from "./schema/payload.js";
|