@hatchet-dev/typescript-sdk 1.31.0 → 1.32.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.
- package/README.md +46 -0
- package/clients/dispatcher/action-listener.d.ts +3 -8
- package/clients/dispatcher/action-listener.js +7 -25
- package/clients/dispatcher/action.d.ts +19 -0
- package/clients/dispatcher/action.js +35 -0
- package/clients/dispatcher/dispatcher-client.d.ts +2 -2
- package/clients/dispatcher/heartbeat/heartbeat-controller.d.ts +1 -1
- package/clients/listeners/durable-listener/durable-events.d.ts +56 -0
- package/clients/listeners/durable-listener/durable-events.js +2 -0
- package/clients/listeners/durable-listener/durable-listener-client.d.ts +3 -52
- package/clients/listeners/durable-listener/durable-listener-client.js +3 -2
- package/clients/listeners/durable-listener/pooled-durable-listener-client.js +2 -1
- package/clients/listeners/run-listener/pooled-child-listener-client.js +2 -1
- package/clients/rest/generated/Api.d.ts +1 -62
- package/clients/rest/generated/Api.js +0 -50
- package/clients/rest/generated/data-contracts.d.ts +0 -52
- package/dist/check-edge-entry.mjs +84 -0
- package/edge/declarations.d.ts +49 -0
- package/edge/declarations.js +21 -0
- package/edge/index.d.ts +49 -0
- package/edge/index.js +115 -0
- package/package.json +21 -16
- package/scripts/check-edge-entry.mjs +84 -0
- package/util/abort-error.d.ts +0 -10
- package/util/abort-error.js +0 -15
- package/util/abort-signal.d.ts +12 -0
- package/util/abort-signal.js +19 -0
- package/util/logger/logger.d.ts +1 -1
- package/v1/client/worker/context.d.ts +58 -12
- package/v1/client/worker/context.js +79 -51
- package/v1/client/worker/deprecated/pre-eviction.d.ts +5 -2
- package/v1/client/worker/deprecated/pre-eviction.js +5 -0
- package/v1/client/worker/runtime.d.ts +118 -0
- package/v1/client/worker/runtime.js +9 -0
- package/v1/client/worker/worker-internal.d.ts +3 -39
- package/v1/client/worker/worker-internal.js +22 -393
- package/v1/client/worker/worker-runtime.d.ts +8 -0
- package/v1/client/worker/worker-runtime.js +67 -0
- package/v1/client/worker/workflow-proto.d.ts +76 -0
- package/v1/client/worker/workflow-proto.js +482 -0
- package/v1/parent-run-context-storage.d.ts +11 -0
- package/v1/parent-run-context-storage.js +28 -0
- package/v1/parent-run-context-vars.d.ts +15 -1
- package/v1/parent-run-context-vars.js +13 -4
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,52 @@
|
|
|
10
10
|
|
|
11
11
|
This is the official TypeScript SDK for [Hatchet](https://hatchet.run), a distributed, fault-tolerant task queue. The SDK provides a type-safe way to integrate Hatchet's task scheduling and workflow orchestration capabilities into your TypeScript/JavaScript applications.
|
|
12
12
|
|
|
13
|
+
<!-- hatchet-agent-docs:start -->
|
|
14
|
+
<!-- Generated by the SDK docs pipeline from frontend/docs/reference-map.json. Do not edit by hand. -->
|
|
15
|
+
|
|
16
|
+
## Documentation for agents
|
|
17
|
+
|
|
18
|
+
The linked pages serve plain markdown for tools and agents. Full docs index: https://docs.hatchet.run/llms.txt
|
|
19
|
+
|
|
20
|
+
Setup and local development:
|
|
21
|
+
|
|
22
|
+
- Quickstart: https://docs.hatchet.run/v1/quickstart.md
|
|
23
|
+
- Running Hatchet locally: https://docs.hatchet.run/v1/running-locally.md
|
|
24
|
+
- Embedded mode: https://docs.hatchet.run/v1/embedded.md
|
|
25
|
+
|
|
26
|
+
Core concepts:
|
|
27
|
+
|
|
28
|
+
- Tasks: https://docs.hatchet.run/v1/tasks.md
|
|
29
|
+
- Workers: https://docs.hatchet.run/v1/workers.md
|
|
30
|
+
- Running tasks: https://docs.hatchet.run/v1/running-your-task.md
|
|
31
|
+
- DAGs: https://docs.hatchet.run/v1/directed-acyclic-graphs.md
|
|
32
|
+
- Durable execution: https://docs.hatchet.run/v1/durable-execution.md
|
|
33
|
+
|
|
34
|
+
Flow control:
|
|
35
|
+
|
|
36
|
+
- Concurrency: https://docs.hatchet.run/v1/concurrency.md
|
|
37
|
+
- Rate limits: https://docs.hatchet.run/v1/rate-limits.md
|
|
38
|
+
- Retries: https://docs.hatchet.run/v1/retry-policies.md
|
|
39
|
+
- Idempotency: https://docs.hatchet.run/v1/idempotency.md
|
|
40
|
+
- CEL expressions: https://docs.hatchet.run/v1/cel-expressions.md
|
|
41
|
+
|
|
42
|
+
TypeScript SDK reference (overview: https://docs.hatchet.run/reference/typescript.md):
|
|
43
|
+
|
|
44
|
+
- CEL: https://docs.hatchet.run/reference/typescript/feature-clients/cel.md (guide: https://docs.hatchet.run/v1/cel-expressions.md)
|
|
45
|
+
- Crons: https://docs.hatchet.run/reference/typescript/feature-clients/crons.md (guide: https://docs.hatchet.run/v1/cron-runs.md)
|
|
46
|
+
- Filters: https://docs.hatchet.run/reference/typescript/feature-clients/filters.md (guide: https://docs.hatchet.run/v1/events.md)
|
|
47
|
+
- Logs: https://docs.hatchet.run/reference/typescript/feature-clients/logs.md (guide: https://docs.hatchet.run/v1/logging.md)
|
|
48
|
+
- Metrics: https://docs.hatchet.run/reference/typescript/feature-clients/metrics.md (guide: https://docs.hatchet.run/v1/prometheus-metrics.md)
|
|
49
|
+
- Rate Limits: https://docs.hatchet.run/reference/typescript/feature-clients/ratelimits.md (guide: https://docs.hatchet.run/v1/rate-limits.md)
|
|
50
|
+
- Runs: https://docs.hatchet.run/reference/typescript/feature-clients/runs.md (guide: https://docs.hatchet.run/v1/running-your-task.md)
|
|
51
|
+
- Scheduled Runs: https://docs.hatchet.run/reference/typescript/feature-clients/schedules.md (guide: https://docs.hatchet.run/v1/scheduled-runs.md)
|
|
52
|
+
- Tenant: https://docs.hatchet.run/reference/typescript/feature-clients/tenant.md
|
|
53
|
+
- Webhooks: https://docs.hatchet.run/reference/typescript/feature-clients/webhooks.md (guide: https://docs.hatchet.run/v1/webhooks.md)
|
|
54
|
+
- Workers: https://docs.hatchet.run/reference/typescript/feature-clients/workers.md (guide: https://docs.hatchet.run/v1/workers.md)
|
|
55
|
+
- Workflows: https://docs.hatchet.run/reference/typescript/feature-clients/workflows.md (guide: https://docs.hatchet.run/v1/tasks.md)
|
|
56
|
+
|
|
57
|
+
<!-- hatchet-agent-docs:end -->
|
|
58
|
+
|
|
13
59
|
## Installation
|
|
14
60
|
|
|
15
61
|
Install the SDK using npm:
|
|
@@ -7,12 +7,8 @@ declare enum ListenStrategy {
|
|
|
7
7
|
LISTEN_STRATEGY_V1 = 1,
|
|
8
8
|
LISTEN_STRATEGY_V2 = 2
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
export type Action
|
|
12
|
-
readonly key: ActionKey;
|
|
13
|
-
};
|
|
14
|
-
export declare function workflowNameFromAction(action: Pick<AssignedAction, 'actionId' | 'jobName'>): string;
|
|
15
|
-
export declare function createAction(assignedAction: AssignedAction): Action;
|
|
10
|
+
export { createAction, createActionId, workflowNameFromAction } from './action';
|
|
11
|
+
export type { Action, ActionKey } from './action';
|
|
16
12
|
export declare class ActionListener {
|
|
17
13
|
config: ClientConfig;
|
|
18
14
|
client: PbDispatcherClient;
|
|
@@ -27,11 +23,10 @@ export declare class ActionListener {
|
|
|
27
23
|
heartbeat: Heartbeat;
|
|
28
24
|
abortController?: AbortController;
|
|
29
25
|
constructor(client: DispatcherClient, workerId: string, retryInterval?: number, retryCount?: number);
|
|
30
|
-
actions: () => AsyncGenerator<Action, void, unknown>;
|
|
26
|
+
actions: () => AsyncGenerator<import("./action").Action, void, unknown>;
|
|
31
27
|
setListenStrategy(strategy: ListenStrategy): Promise<void>;
|
|
32
28
|
getListenStrategy(): Promise<ListenStrategy>;
|
|
33
29
|
incrementRetries(): Promise<void>;
|
|
34
30
|
getListenClient(): Promise<AsyncIterable<AssignedAction>>;
|
|
35
31
|
unregister(): Promise<import("../../protoc/dispatcher").WorkerUnsubscribeResponse>;
|
|
36
32
|
}
|
|
37
|
-
export {};
|
|
@@ -65,15 +65,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
65
65
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
66
|
};
|
|
67
67
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
|
-
exports.ActionListener = void 0;
|
|
69
|
-
exports.workflowNameFromAction = workflowNameFromAction;
|
|
70
|
-
exports.createAction = createAction;
|
|
68
|
+
exports.ActionListener = exports.workflowNameFromAction = exports.createActionId = exports.createAction = void 0;
|
|
71
69
|
const nice_grpc_1 = require("nice-grpc");
|
|
72
70
|
const grpc_error_1 = require("../../util/grpc-error");
|
|
73
71
|
const abort_controller_x_1 = require("abort-controller-x");
|
|
74
72
|
const sleep_1 = __importDefault(require("../../util/sleep"));
|
|
75
73
|
const hatchet_error_1 = __importStar(require("../../util/errors/hatchet-error"));
|
|
76
74
|
const heartbeat_controller_1 = require("./heartbeat/heartbeat-controller");
|
|
75
|
+
const action_1 = require("./action");
|
|
77
76
|
const listener_severity_1 = require("./listener-severity");
|
|
78
77
|
const DEFAULT_ACTION_LISTENER_RETRY_INTERVAL = 5000; // milliseconds
|
|
79
78
|
const DEFAULT_ACTION_LISTENER_RETRY_COUNT = 20;
|
|
@@ -82,27 +81,10 @@ var ListenStrategy;
|
|
|
82
81
|
ListenStrategy[ListenStrategy["LISTEN_STRATEGY_V1"] = 1] = "LISTEN_STRATEGY_V1";
|
|
83
82
|
ListenStrategy[ListenStrategy["LISTEN_STRATEGY_V2"] = 2] = "LISTEN_STRATEGY_V2";
|
|
84
83
|
})(ListenStrategy || (ListenStrategy = {}));
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
function createAction(assignedAction) {
|
|
90
|
-
const action = assignedAction;
|
|
91
|
-
Object.defineProperty(action, 'key', {
|
|
92
|
-
get() {
|
|
93
|
-
// Durable task invocations each get a distinct key so a restored
|
|
94
|
-
// invocation never collides with the one it replaces in contexts,
|
|
95
|
-
// futures, or eviction state.
|
|
96
|
-
if (this.durableTaskInvocationCount !== undefined) {
|
|
97
|
-
return `${this.taskRunExternalId}/${this.retryCount}/${this.durableTaskInvocationCount}`;
|
|
98
|
-
}
|
|
99
|
-
return `${this.taskRunExternalId}/${this.retryCount}`;
|
|
100
|
-
},
|
|
101
|
-
enumerable: true,
|
|
102
|
-
configurable: true,
|
|
103
|
-
});
|
|
104
|
-
return action;
|
|
105
|
-
}
|
|
84
|
+
var action_2 = require("./action");
|
|
85
|
+
Object.defineProperty(exports, "createAction", { enumerable: true, get: function () { return action_2.createAction; } });
|
|
86
|
+
Object.defineProperty(exports, "createActionId", { enumerable: true, get: function () { return action_2.createActionId; } });
|
|
87
|
+
Object.defineProperty(exports, "workflowNameFromAction", { enumerable: true, get: function () { return action_2.workflowNameFromAction; } });
|
|
106
88
|
class ActionListener {
|
|
107
89
|
constructor(client, workerId, retryInterval = DEFAULT_ACTION_LISTENER_RETRY_INTERVAL, retryCount = DEFAULT_ACTION_LISTENER_RETRY_COUNT) {
|
|
108
90
|
this.lastConnectionAttempt = 0;
|
|
@@ -125,7 +107,7 @@ class ActionListener {
|
|
|
125
107
|
_c = listenClient_1_1.value;
|
|
126
108
|
_d = false;
|
|
127
109
|
const assignedAction = _c;
|
|
128
|
-
yield yield __await(createAction(assignedAction));
|
|
110
|
+
yield yield __await((0, action_1.createAction)(assignedAction));
|
|
129
111
|
}
|
|
130
112
|
}
|
|
131
113
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-neutral helpers for the actions a worker receives from the dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* This module imports nothing from Node so it can be used from the edge entry point.
|
|
5
|
+
*/
|
|
6
|
+
import type { AssignedAction } from '../../protoc/dispatcher';
|
|
7
|
+
export type ActionKey = `${string}/${number}` | `${string}/${number}/${number}`;
|
|
8
|
+
export type Action = AssignedAction & {
|
|
9
|
+
readonly key: ActionKey;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Builds the canonical action id for a task: `<workflow name>:<task name>`, fully
|
|
13
|
+
* lowercased. The engine lowercases action ids on registration and the Go SDK sends
|
|
14
|
+
* them lowercased, so this is the one form used for registration, the worker's
|
|
15
|
+
* action registries and the ids the dispatcher assigns.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createActionId(workflowName: string, taskName: string): string;
|
|
18
|
+
export declare function workflowNameFromAction(action: Pick<AssignedAction, 'actionId' | 'jobName'>): string;
|
|
19
|
+
export declare function createAction(assignedAction: AssignedAction): Action;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createActionId = createActionId;
|
|
4
|
+
exports.workflowNameFromAction = workflowNameFromAction;
|
|
5
|
+
exports.createAction = createAction;
|
|
6
|
+
/**
|
|
7
|
+
* Builds the canonical action id for a task: `<workflow name>:<task name>`, fully
|
|
8
|
+
* lowercased. The engine lowercases action ids on registration and the Go SDK sends
|
|
9
|
+
* them lowercased, so this is the one form used for registration, the worker's
|
|
10
|
+
* action registries and the ids the dispatcher assigns.
|
|
11
|
+
*/
|
|
12
|
+
function createActionId(workflowName, taskName) {
|
|
13
|
+
return `${workflowName}:${taskName}`.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
function workflowNameFromAction(action) {
|
|
16
|
+
const separatorIndex = action.actionId.lastIndexOf(':');
|
|
17
|
+
return separatorIndex === -1 ? action.jobName : action.actionId.substring(0, separatorIndex);
|
|
18
|
+
}
|
|
19
|
+
function createAction(assignedAction) {
|
|
20
|
+
const action = assignedAction;
|
|
21
|
+
Object.defineProperty(action, 'key', {
|
|
22
|
+
get() {
|
|
23
|
+
// Durable task invocations each get a distinct key so a restored
|
|
24
|
+
// invocation never collides with the one it replaces in contexts,
|
|
25
|
+
// futures, or eviction state.
|
|
26
|
+
if (this.durableTaskInvocationCount !== undefined) {
|
|
27
|
+
return `${this.taskRunExternalId}/${this.retryCount}/${this.durableTaskInvocationCount}`;
|
|
28
|
+
}
|
|
29
|
+
return `${this.taskRunExternalId}/${this.retryCount}`;
|
|
30
|
+
},
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
});
|
|
34
|
+
return action;
|
|
35
|
+
}
|
|
@@ -4,7 +4,8 @@ import { ClientConfig } from '../hatchet-client/client-config';
|
|
|
4
4
|
import { Logger } from '../../util/logger';
|
|
5
5
|
import { SlotConfig } from '../../v1/slot-types';
|
|
6
6
|
import { ActionListener } from './action-listener';
|
|
7
|
-
|
|
7
|
+
import type { WorkerLabels } from '../../v1/client/worker/runtime';
|
|
8
|
+
export type { WorkerLabels } from '../../v1/client/worker/runtime';
|
|
8
9
|
interface GetActionListenerOptions {
|
|
9
10
|
workerName: string;
|
|
10
11
|
services: string[];
|
|
@@ -48,4 +49,3 @@ export declare class DispatcherClient {
|
|
|
48
49
|
upsertWorkerLabels(workerId: string, labels: WorkerLabels): Promise<import("../../protoc/dispatcher").UpsertWorkerLabelsResponse>;
|
|
49
50
|
}
|
|
50
51
|
export declare function mapLabels(in_: WorkerLabels): Record<string, PbWorkerAffinityConfig>;
|
|
51
|
-
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event and acknowledgement shapes exchanged between a durable task and the durable
|
|
3
|
+
* transport it runs on. Runtime-neutral: nothing here imports from Node.
|
|
4
|
+
*/
|
|
5
|
+
import type { DurableEventListenerConditions } from '../../../protoc/v1/shared/condition';
|
|
6
|
+
import type { TriggerWorkflowRequest } from '../../../protoc/v1/shared/trigger';
|
|
7
|
+
export interface DurableTaskRunAckEntryResult {
|
|
8
|
+
nodeId: number;
|
|
9
|
+
branchId: number;
|
|
10
|
+
workflowRunExternalId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DurableTaskEventRunAck {
|
|
13
|
+
ackType: 'run';
|
|
14
|
+
invocationCount: number;
|
|
15
|
+
durableTaskExternalId: string;
|
|
16
|
+
runEntries: DurableTaskRunAckEntryResult[];
|
|
17
|
+
}
|
|
18
|
+
export interface DurableTaskEventMemoAck {
|
|
19
|
+
ackType: 'memo';
|
|
20
|
+
invocationCount: number;
|
|
21
|
+
durableTaskExternalId: string;
|
|
22
|
+
branchId: number;
|
|
23
|
+
nodeId: number;
|
|
24
|
+
memoAlreadyExisted: boolean;
|
|
25
|
+
memoResultPayload?: Uint8Array;
|
|
26
|
+
}
|
|
27
|
+
export interface DurableTaskEventWaitForAck {
|
|
28
|
+
ackType: 'waitFor';
|
|
29
|
+
invocationCount: number;
|
|
30
|
+
durableTaskExternalId: string;
|
|
31
|
+
branchId: number;
|
|
32
|
+
nodeId: number;
|
|
33
|
+
}
|
|
34
|
+
export type DurableTaskEventAck = DurableTaskEventRunAck | DurableTaskEventMemoAck | DurableTaskEventWaitForAck;
|
|
35
|
+
export interface DurableTaskEventLogEntryResult {
|
|
36
|
+
durableTaskExternalId: string;
|
|
37
|
+
nodeId: number;
|
|
38
|
+
payload: Record<string, unknown> | undefined;
|
|
39
|
+
isFailure: boolean;
|
|
40
|
+
errorMessage: string | undefined;
|
|
41
|
+
}
|
|
42
|
+
export interface WaitForEvent {
|
|
43
|
+
kind: 'waitFor';
|
|
44
|
+
waitForConditions: DurableEventListenerConditions;
|
|
45
|
+
label?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface RunChildrenEvent {
|
|
48
|
+
kind: 'runChildren';
|
|
49
|
+
triggerOpts: TriggerWorkflowRequest[];
|
|
50
|
+
}
|
|
51
|
+
export interface MemoEvent {
|
|
52
|
+
kind: 'memo';
|
|
53
|
+
memoKey: Uint8Array;
|
|
54
|
+
payload?: Uint8Array;
|
|
55
|
+
}
|
|
56
|
+
export type DurableTaskSendEvent = WaitForEvent | RunChildrenEvent | MemoEvent;
|
|
@@ -3,58 +3,9 @@ import { Channel, ClientFactory } from 'nice-grpc';
|
|
|
3
3
|
import { ClientConfig } from '../../hatchet-client/client-config';
|
|
4
4
|
import { Logger } from '../../../util/logger';
|
|
5
5
|
import { V1DispatcherClient, DurableEvent, RegisterDurableEventResponse } from '../../../protoc/v1/dispatcher';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export
|
|
9
|
-
nodeId: number;
|
|
10
|
-
branchId: number;
|
|
11
|
-
workflowRunExternalId: string;
|
|
12
|
-
}
|
|
13
|
-
export interface DurableTaskEventRunAck {
|
|
14
|
-
ackType: 'run';
|
|
15
|
-
invocationCount: number;
|
|
16
|
-
durableTaskExternalId: string;
|
|
17
|
-
runEntries: DurableTaskRunAckEntryResult[];
|
|
18
|
-
}
|
|
19
|
-
export interface DurableTaskEventMemoAck {
|
|
20
|
-
ackType: 'memo';
|
|
21
|
-
invocationCount: number;
|
|
22
|
-
durableTaskExternalId: string;
|
|
23
|
-
branchId: number;
|
|
24
|
-
nodeId: number;
|
|
25
|
-
memoAlreadyExisted: boolean;
|
|
26
|
-
memoResultPayload?: Uint8Array;
|
|
27
|
-
}
|
|
28
|
-
export interface DurableTaskEventWaitForAck {
|
|
29
|
-
ackType: 'waitFor';
|
|
30
|
-
invocationCount: number;
|
|
31
|
-
durableTaskExternalId: string;
|
|
32
|
-
branchId: number;
|
|
33
|
-
nodeId: number;
|
|
34
|
-
}
|
|
35
|
-
export type DurableTaskEventAck = DurableTaskEventRunAck | DurableTaskEventMemoAck | DurableTaskEventWaitForAck;
|
|
36
|
-
export interface DurableTaskEventLogEntryResult {
|
|
37
|
-
durableTaskExternalId: string;
|
|
38
|
-
nodeId: number;
|
|
39
|
-
payload: Record<string, unknown> | undefined;
|
|
40
|
-
isFailure: boolean;
|
|
41
|
-
errorMessage: string | undefined;
|
|
42
|
-
}
|
|
43
|
-
export interface WaitForEvent {
|
|
44
|
-
kind: 'waitFor';
|
|
45
|
-
waitForConditions: DurableEventListenerConditions;
|
|
46
|
-
label?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface RunChildrenEvent {
|
|
49
|
-
kind: 'runChildren';
|
|
50
|
-
triggerOpts: TriggerWorkflowRequest[];
|
|
51
|
-
}
|
|
52
|
-
export interface MemoEvent {
|
|
53
|
-
kind: 'memo';
|
|
54
|
-
memoKey: Uint8Array;
|
|
55
|
-
payload?: Uint8Array;
|
|
56
|
-
}
|
|
57
|
-
export type DurableTaskSendEvent = WaitForEvent | RunChildrenEvent | MemoEvent;
|
|
6
|
+
import { SleepMatchCondition, UserEventMatchCondition } from '../../../protoc/v1/shared/condition';
|
|
7
|
+
import { DurableTaskEventLogEntryResult, DurableTaskEventMemoAck, DurableTaskEventRunAck, DurableTaskEventWaitForAck, MemoEvent, RunChildrenEvent, WaitForEvent } from './durable-events';
|
|
8
|
+
export type { DurableTaskEventAck, DurableTaskEventLogEntryResult, DurableTaskEventMemoAck, DurableTaskEventRunAck, DurableTaskEventWaitForAck, DurableTaskRunAckEntryResult, DurableTaskSendEvent, MemoEvent, RunChildrenEvent, WaitForEvent, } from './durable-events';
|
|
58
9
|
export declare class DurableListenerClient {
|
|
59
10
|
config: ClientConfig;
|
|
60
11
|
client: V1DispatcherClient;
|
|
@@ -40,6 +40,7 @@ const dispatcher_1 = require("../../../protoc/v1/dispatcher");
|
|
|
40
40
|
const non_determinism_error_1 = require("../../../util/errors/non-determinism-error");
|
|
41
41
|
const task_run_terminated_error_1 = require("../../../util/errors/task-run-terminated-error");
|
|
42
42
|
const abort_error_1 = require("../../../util/abort-error");
|
|
43
|
+
const abort_signal_1 = require("../../../util/abort-signal");
|
|
43
44
|
const sleep_1 = __importDefault(require("../../../util/sleep"));
|
|
44
45
|
const listener_severity_1 = require("../../dispatcher/listener-severity");
|
|
45
46
|
class TTLMap {
|
|
@@ -609,7 +610,7 @@ class DurableListenerClient {
|
|
|
609
610
|
settled = true;
|
|
610
611
|
reject((0, abort_error_1.createAbortError)('Operation cancelled by AbortSignal'));
|
|
611
612
|
};
|
|
612
|
-
(0,
|
|
613
|
+
(0, abort_signal_1.bindAbortSignalHandler)(signal, onAbort);
|
|
613
614
|
d.promise.then((value) => {
|
|
614
615
|
if (settled)
|
|
615
616
|
return;
|
|
@@ -763,7 +764,7 @@ class LegacyDurableEventStreamable {
|
|
|
763
764
|
}
|
|
764
765
|
this.responseEmitter.once('response', onResponse);
|
|
765
766
|
if (signal) {
|
|
766
|
-
(0,
|
|
767
|
+
(0, abort_signal_1.bindAbortSignalHandler)(signal, onAbort);
|
|
767
768
|
}
|
|
768
769
|
});
|
|
769
770
|
});
|
|
@@ -38,6 +38,7 @@ const abort_controller_x_1 = require("abort-controller-x");
|
|
|
38
38
|
const hatchet_error_1 = require("../../../util/errors/hatchet-error");
|
|
39
39
|
const sleep_1 = __importDefault(require("../../../util/sleep"));
|
|
40
40
|
const abort_error_1 = require("../../../util/abort-error");
|
|
41
|
+
const abort_signal_1 = require("../../../util/abort-signal");
|
|
41
42
|
class DurableEventStreamable {
|
|
42
43
|
constructor(listener, taskId, signalKey, subscriptionId, onCleanup) {
|
|
43
44
|
this.responseEmitter = new events_1.EventEmitter();
|
|
@@ -77,7 +78,7 @@ class DurableEventStreamable {
|
|
|
77
78
|
}
|
|
78
79
|
this.responseEmitter.once('response', onResponse);
|
|
79
80
|
if (signal) {
|
|
80
|
-
(0,
|
|
81
|
+
(0, abort_signal_1.bindAbortSignalHandler)(signal, onAbort);
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
84
|
});
|
|
@@ -39,6 +39,7 @@ const abort_controller_x_1 = require("abort-controller-x");
|
|
|
39
39
|
const hatchet_error_1 = require("../../../util/errors/hatchet-error");
|
|
40
40
|
const sleep_1 = __importDefault(require("../../../util/sleep"));
|
|
41
41
|
const abort_error_1 = require("../../../util/abort-error");
|
|
42
|
+
const abort_signal_1 = require("../../../util/abort-signal");
|
|
42
43
|
class Streamable {
|
|
43
44
|
constructor(listener, id, onCleanup) {
|
|
44
45
|
this.cleanedUp = false;
|
|
@@ -79,7 +80,7 @@ class Streamable {
|
|
|
79
80
|
}
|
|
80
81
|
this.responseEmitter.once('response', onResponse);
|
|
81
82
|
if (signal) {
|
|
82
|
-
(0,
|
|
83
|
+
(0, abort_signal_1.bindAbortSignalHandler)(signal, onAbort);
|
|
83
84
|
}
|
|
84
85
|
});
|
|
85
86
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIErrors, APIMeta, AcceptInviteRequest, BulkCreateEventRequest, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, Events, FeatureFlagEvaluationResult, FeatureFlagId, ListAPIMetaIntegration, ListAPITokensResponse, ListSNSIntegrations, ListSlackWebhooks, OtelSpanList, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, SNSIntegration, ScheduleWorkflowRunRequest, ScheduledRunStatus, ScheduledWorkflows, ScheduledWorkflowsBulkDeleteRequest, ScheduledWorkflowsBulkDeleteResponse, ScheduledWorkflowsBulkUpdateRequest, ScheduledWorkflowsBulkUpdateResponse, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, StepRun, StepRunArchiveList, StepRunEventList, TaskStats, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerRunResult, TriggerWorkflowRunRequest, UpdateCronWorkflowTriggerRequest, UpdateScheduledWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantMemberRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, V1AdditionalMetadataOperator, V1BranchDurableTaskRequest, V1BranchDurableTaskResponse, V1CELDebugRequest, V1CELDebugResponse, V1CancelTaskRequest, V1CancelledTasks, V1CreateFilterRequest,
|
|
1
|
+
import { APIErrors, APIMeta, AcceptInviteRequest, BulkCreateEventRequest, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, Events, FeatureFlagEvaluationResult, FeatureFlagId, ListAPIMetaIntegration, ListAPITokensResponse, ListSNSIntegrations, ListSlackWebhooks, OtelSpanList, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, SNSIntegration, ScheduleWorkflowRunRequest, ScheduledRunStatus, ScheduledWorkflows, ScheduledWorkflowsBulkDeleteRequest, ScheduledWorkflowsBulkDeleteResponse, ScheduledWorkflowsBulkUpdateRequest, ScheduledWorkflowsBulkUpdateResponse, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, StepRun, StepRunArchiveList, StepRunEventList, TaskStats, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerRunResult, TriggerWorkflowRunRequest, UpdateCronWorkflowTriggerRequest, UpdateScheduledWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantMemberRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, V1AdditionalMetadataOperator, V1BranchDurableTaskRequest, V1BranchDurableTaskResponse, V1CELDebugRequest, V1CELDebugResponse, V1CancelTaskRequest, V1CancelledTasks, V1CreateFilterRequest, V1CreateWebhookRequest, V1DagChildren, V1DurableEventLogList, V1Event, V1EventList, V1Filter, V1FilterList, V1LogLineLevel, V1LogLineList, V1LogLineOrderByDirection, V1LogsPointMetrics, V1ReplayTaskRequest, V1ReplayedTasks, V1RestoreTaskResponse, V1RunningFilter, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummary, V1TaskSummaryList, V1TaskTimingList, V1TriggerWorkflowRunRequest, V1UpdateFilterRequest, V1UpdateWebhookRequest, V1Webhook, V1WebhookList, V1WebhookResponse, V1WebhookSourceName, V1WorkflowRunDetails, V1WorkflowRunDisplayNameList, V1WorkflowRunExternalIdList, WebhookWorkerCreateRequest, WebhookWorkerCreated, WebhookWorkerListResponse, WebhookWorkerRequestListResponse, Worker, WorkerList, WorkerStatus, Workflow, WorkflowID, WorkflowKindList, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunOrderByDirection, WorkflowRunOrderByField, WorkflowRunShape, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowUpdateRequest, WorkflowVersion, WorkflowWorkersCount } from './data-contracts';
|
|
2
2
|
import { HttpClient, RequestParams } from './http-client';
|
|
3
3
|
export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
4
4
|
/**
|
|
@@ -693,67 +693,6 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
693
693
|
* @secure
|
|
694
694
|
*/
|
|
695
695
|
v1WebhookUpdate: (tenant: string, v1Webhook: string, data: V1UpdateWebhookRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1Webhook, any, {}>>;
|
|
696
|
-
/**
|
|
697
|
-
* @description Lists all HTTP operators for a tenant.
|
|
698
|
-
*
|
|
699
|
-
* @tags Operator
|
|
700
|
-
* @name V1HttpOperatorList
|
|
701
|
-
* @summary List HTTP operators
|
|
702
|
-
* @request GET:/api/v1/stable/tenants/{tenant}/operators/http
|
|
703
|
-
* @secure
|
|
704
|
-
*/
|
|
705
|
-
v1HttpOperatorList: (tenant: string, query?: {
|
|
706
|
-
/**
|
|
707
|
-
* The number to skip
|
|
708
|
-
* @format int64
|
|
709
|
-
*/
|
|
710
|
-
offset?: number;
|
|
711
|
-
/**
|
|
712
|
-
* The number to limit by
|
|
713
|
-
* @format int64
|
|
714
|
-
*/
|
|
715
|
-
limit?: number;
|
|
716
|
-
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1HTTPOperatorList, any, {}>>;
|
|
717
|
-
/**
|
|
718
|
-
* @description Create a new HTTP operator
|
|
719
|
-
*
|
|
720
|
-
* @tags Operator
|
|
721
|
-
* @name V1HttpOperatorCreate
|
|
722
|
-
* @summary Create an HTTP operator
|
|
723
|
-
* @request POST:/api/v1/stable/tenants/{tenant}/operators/http
|
|
724
|
-
* @secure
|
|
725
|
-
*/
|
|
726
|
-
v1HttpOperatorCreate: (tenant: string, data: V1CreateHTTPOperatorRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1HTTPOperator, any, {}>>;
|
|
727
|
-
/**
|
|
728
|
-
* @description Get an HTTP operator by its id
|
|
729
|
-
*
|
|
730
|
-
* @tags Operator
|
|
731
|
-
* @name V1HttpOperatorGet
|
|
732
|
-
* @summary Get an HTTP operator
|
|
733
|
-
* @request GET:/api/v1/stable/operators/http/{v1-http-operator}
|
|
734
|
-
* @secure
|
|
735
|
-
*/
|
|
736
|
-
v1HttpOperatorGet: (v1HttpOperator: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1HTTPOperator, any, {}>>;
|
|
737
|
-
/**
|
|
738
|
-
* @description Update an HTTP operator
|
|
739
|
-
*
|
|
740
|
-
* @tags Operator
|
|
741
|
-
* @name V1HttpOperatorUpdate
|
|
742
|
-
* @summary Update an HTTP operator
|
|
743
|
-
* @request PATCH:/api/v1/stable/operators/http/{v1-http-operator}
|
|
744
|
-
* @secure
|
|
745
|
-
*/
|
|
746
|
-
v1HttpOperatorUpdate: (v1HttpOperator: string, data: V1UpdateHTTPOperatorRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1HTTPOperator, any, {}>>;
|
|
747
|
-
/**
|
|
748
|
-
* @description Delete an HTTP operator
|
|
749
|
-
*
|
|
750
|
-
* @tags Operator
|
|
751
|
-
* @name V1HttpOperatorDelete
|
|
752
|
-
* @summary Delete an HTTP operator
|
|
753
|
-
* @request DELETE:/api/v1/stable/operators/http/{v1-http-operator}
|
|
754
|
-
* @secure
|
|
755
|
-
*/
|
|
756
|
-
v1HttpOperatorDelete: (v1HttpOperator: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1HTTPOperator, any, {}>>;
|
|
757
696
|
/**
|
|
758
697
|
* @description Evaluate a CEL expression against provided input data.
|
|
759
698
|
*
|
|
@@ -375,56 +375,6 @@ class Api extends http_client_1.HttpClient {
|
|
|
375
375
|
* @secure
|
|
376
376
|
*/
|
|
377
377
|
this.v1WebhookUpdate = (tenant, v1Webhook, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/webhooks/${v1Webhook}`, method: 'PATCH', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
378
|
-
/**
|
|
379
|
-
* @description Lists all HTTP operators for a tenant.
|
|
380
|
-
*
|
|
381
|
-
* @tags Operator
|
|
382
|
-
* @name V1HttpOperatorList
|
|
383
|
-
* @summary List HTTP operators
|
|
384
|
-
* @request GET:/api/v1/stable/tenants/{tenant}/operators/http
|
|
385
|
-
* @secure
|
|
386
|
-
*/
|
|
387
|
-
this.v1HttpOperatorList = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/operators/http`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
388
|
-
/**
|
|
389
|
-
* @description Create a new HTTP operator
|
|
390
|
-
*
|
|
391
|
-
* @tags Operator
|
|
392
|
-
* @name V1HttpOperatorCreate
|
|
393
|
-
* @summary Create an HTTP operator
|
|
394
|
-
* @request POST:/api/v1/stable/tenants/{tenant}/operators/http
|
|
395
|
-
* @secure
|
|
396
|
-
*/
|
|
397
|
-
this.v1HttpOperatorCreate = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/tenants/${tenant}/operators/http`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
398
|
-
/**
|
|
399
|
-
* @description Get an HTTP operator by its id
|
|
400
|
-
*
|
|
401
|
-
* @tags Operator
|
|
402
|
-
* @name V1HttpOperatorGet
|
|
403
|
-
* @summary Get an HTTP operator
|
|
404
|
-
* @request GET:/api/v1/stable/operators/http/{v1-http-operator}
|
|
405
|
-
* @secure
|
|
406
|
-
*/
|
|
407
|
-
this.v1HttpOperatorGet = (v1HttpOperator, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/operators/http/${v1HttpOperator}`, method: 'GET', secure: true, format: 'json' }, params));
|
|
408
|
-
/**
|
|
409
|
-
* @description Update an HTTP operator
|
|
410
|
-
*
|
|
411
|
-
* @tags Operator
|
|
412
|
-
* @name V1HttpOperatorUpdate
|
|
413
|
-
* @summary Update an HTTP operator
|
|
414
|
-
* @request PATCH:/api/v1/stable/operators/http/{v1-http-operator}
|
|
415
|
-
* @secure
|
|
416
|
-
*/
|
|
417
|
-
this.v1HttpOperatorUpdate = (v1HttpOperator, data, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/operators/http/${v1HttpOperator}`, method: 'PATCH', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
418
|
-
/**
|
|
419
|
-
* @description Delete an HTTP operator
|
|
420
|
-
*
|
|
421
|
-
* @tags Operator
|
|
422
|
-
* @name V1HttpOperatorDelete
|
|
423
|
-
* @summary Delete an HTTP operator
|
|
424
|
-
* @request DELETE:/api/v1/stable/operators/http/{v1-http-operator}
|
|
425
|
-
* @secure
|
|
426
|
-
*/
|
|
427
|
-
this.v1HttpOperatorDelete = (v1HttpOperator, params = {}) => this.request(Object.assign({ path: `/api/v1/stable/operators/http/${v1HttpOperator}`, method: 'DELETE', secure: true, format: 'json' }, params));
|
|
428
378
|
/**
|
|
429
379
|
* @description Evaluate a CEL expression against provided input data.
|
|
430
380
|
*
|
|
@@ -1116,58 +1116,6 @@ export interface V1UpdateWebhookRequest {
|
|
|
1116
1116
|
/** Whether to return the triggered event as the response payload when this webhook is triggered */
|
|
1117
1117
|
returnEventAsResponsePayload?: boolean;
|
|
1118
1118
|
}
|
|
1119
|
-
export interface V1HTTPOperator {
|
|
1120
|
-
metadata: APIResourceMeta;
|
|
1121
|
-
/**
|
|
1122
|
-
* The ID of the tenant associated with this operator.
|
|
1123
|
-
* @format uuid
|
|
1124
|
-
*/
|
|
1125
|
-
tenantId: string;
|
|
1126
|
-
/** The name of the operator. */
|
|
1127
|
-
name: string;
|
|
1128
|
-
/** The HTTPS endpoint (https, port 443) that assigned tasks are delivered to. */
|
|
1129
|
-
triggerEndpoint: string;
|
|
1130
|
-
/** The HTTPS endpoint polled periodically to discover the actions this operator handles. */
|
|
1131
|
-
healthcheckEndpoint: string;
|
|
1132
|
-
/**
|
|
1133
|
-
* The per-request timeout backstop, in seconds.
|
|
1134
|
-
* @format int32
|
|
1135
|
-
*/
|
|
1136
|
-
requestTimeoutSeconds: number;
|
|
1137
|
-
}
|
|
1138
|
-
export interface V1HTTPOperatorList {
|
|
1139
|
-
pagination?: PaginationResponse;
|
|
1140
|
-
rows?: V1HTTPOperator[];
|
|
1141
|
-
}
|
|
1142
|
-
export interface V1CreateHTTPOperatorRequest {
|
|
1143
|
-
/** The name of the operator. */
|
|
1144
|
-
name: string;
|
|
1145
|
-
/** The HTTPS endpoint (https, port 443) that assigned tasks are delivered to. */
|
|
1146
|
-
triggerEndpoint: string;
|
|
1147
|
-
/** The HTTPS endpoint polled periodically to discover the actions this operator handles. */
|
|
1148
|
-
healthcheckEndpoint: string;
|
|
1149
|
-
/** The secret used to HMAC-sign delivered requests (sent in the X-Hatchet-Signature header). Write-only: it is never returned in responses. */
|
|
1150
|
-
signingSecret: string;
|
|
1151
|
-
/**
|
|
1152
|
-
* The per-request timeout backstop, in seconds.
|
|
1153
|
-
* @format int32
|
|
1154
|
-
*/
|
|
1155
|
-
requestTimeoutSeconds: number;
|
|
1156
|
-
}
|
|
1157
|
-
/** Fields to update on an HTTP operator. Omitted fields are left unchanged. */
|
|
1158
|
-
export interface V1UpdateHTTPOperatorRequest {
|
|
1159
|
-
/** The HTTPS endpoint (https, port 443) that assigned tasks are delivered to. */
|
|
1160
|
-
triggerEndpoint?: string;
|
|
1161
|
-
/** An optional HTTPS endpoint polled to verify the operator endpoint is reachable. */
|
|
1162
|
-
healthcheckEndpoint?: string;
|
|
1163
|
-
/** The secret used to HMAC-sign delivered requests. Write-only: it is never returned in responses. Provide a new value to rotate it. */
|
|
1164
|
-
signingSecret?: string;
|
|
1165
|
-
/**
|
|
1166
|
-
* Optional override for the per-request timeout backstop, in seconds.
|
|
1167
|
-
* @format int32
|
|
1168
|
-
*/
|
|
1169
|
-
requestTimeoutSeconds?: number;
|
|
1170
|
-
}
|
|
1171
1119
|
export interface V1CELDebugRequest {
|
|
1172
1120
|
/** The CEL expression to evaluate */
|
|
1173
1121
|
expression: string;
|