@hatchet-dev/typescript-sdk 1.0.0-alpha1 → 1.0.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/clients/admin/admin-client.d.ts +15 -20
- package/clients/admin/admin-client.js +21 -17
- package/clients/hatchet-client/hatchet-client.d.ts +5 -4
- package/clients/hatchet-client/hatchet-client.js +6 -4
- package/clients/listeners/durable-listener/durable-listener-client.d.ts +25 -0
- package/clients/listeners/durable-listener/durable-listener-client.js +30 -0
- package/clients/listeners/durable-listener/pooled-durable-listener-client.d.ts +43 -0
- package/clients/listeners/durable-listener/pooled-durable-listener-client.js +241 -0
- package/clients/{listener/listener-client.d.ts → listeners/run-listener/child-listener-client.d.ts} +8 -8
- package/clients/{listener/listener-client.js → listeners/run-listener/child-listener-client.js} +8 -19
- package/clients/{listener/child-listener-client.d.ts → listeners/run-listener/pooled-child-listener-client.d.ts} +5 -5
- package/clients/{listener/child-listener-client.js → listeners/run-listener/pooled-child-listener-client.js} +5 -5
- package/clients/rest/generated/Api.d.ts +49 -2
- package/clients/rest/generated/Api.js +30 -0
- package/clients/rest/generated/data-contracts.d.ts +88 -82
- package/clients/rest/generated/data-contracts.js +8 -1
- package/clients/worker/worker.d.ts +5 -1
- package/clients/worker/worker.js +173 -2
- package/examples/affinity-workers.js +5 -1
- package/examples/api.js +1 -1
- package/examples/bulk-fanout-worker.js +1 -1
- package/examples/byo-logger.js +4 -0
- package/examples/concurrency/cancel-in-progress/concurrency-event.js +2 -2
- package/examples/concurrency/group-round-robin/concurrency-event.js +1 -1
- package/examples/crons/programatic-crons.js +4 -4
- package/examples/dag-worker.js +0 -1
- package/examples/example-event.js +2 -2
- package/examples/logger.js +2 -0
- package/examples/on-failure.js +1 -1
- package/examples/rate-limit/events.js +3 -3
- package/examples/scheduled-runs/programatic-schedules.js +4 -4
- package/examples/sticky-worker-with-check.js +2 -2
- package/examples/sticky-worker.js +5 -0
- package/index.d.ts +1 -3
- package/index.js +1 -3
- package/package.json +2 -2
- package/protoc/dispatcher/dispatcher.d.ts +2 -0
- package/protoc/dispatcher/dispatcher.js +1 -1
- package/protoc/events/events.js +1 -1
- package/protoc/google/protobuf/timestamp.js +1 -1
- package/protoc/v1/dispatcher.d.ts +77 -0
- package/protoc/v1/dispatcher.js +341 -0
- package/protoc/v1/shared/condition.d.ts +59 -0
- package/protoc/v1/shared/condition.js +549 -0
- package/protoc/v1/workflows.d.ts +263 -0
- package/protoc/v1/workflows.js +1823 -0
- package/protoc/workflows/workflows.js +1 -1
- package/step.d.ts +173 -47
- package/step.js +208 -64
- package/util/sleep.d.ts +7 -0
- package/util/sleep.js +7 -0
- package/util/workflow-run-ref.d.ts +8 -2
- package/util/workflow-run-ref.js +13 -0
- package/v1/client/client.d.ts +125 -7
- package/v1/client/client.interface.d.ts +9 -1
- package/v1/client/client.js +148 -17
- package/v1/client/duration.d.ts +7 -0
- package/v1/client/duration.js +2 -0
- package/v1/client/features/index.d.ts +5 -0
- package/v1/client/features/index.js +21 -0
- package/v1/client/features/metrics.d.ts +14 -0
- package/v1/client/features/metrics.js +45 -0
- package/v1/client/features/ratelimits.d.ts +20 -0
- package/v1/client/features/ratelimits.js +40 -0
- package/v1/client/features/runs.d.ts +15 -0
- package/v1/client/features/runs.js +60 -0
- package/v1/client/features/workers.d.ts +14 -0
- package/v1/client/features/workers.js +56 -0
- package/v1/client/features/workflows.d.ts +17 -0
- package/v1/client/features/workflows.js +93 -0
- package/v1/client/worker.d.ts +25 -15
- package/v1/client/worker.js +76 -47
- package/v1/conditions/base.d.ts +18 -0
- package/v1/conditions/base.js +18 -0
- package/v1/conditions/index.d.ts +31 -0
- package/v1/conditions/index.js +91 -0
- package/v1/conditions/parent-condition.d.ts +40 -0
- package/v1/conditions/parent-condition.js +36 -0
- package/v1/conditions/sleep-condition.d.ts +47 -0
- package/v1/conditions/sleep-condition.js +38 -0
- package/v1/conditions/transformer.d.ts +5 -0
- package/v1/conditions/transformer.js +52 -0
- package/v1/conditions/user-event-condition.d.ts +50 -0
- package/v1/conditions/user-event-condition.js +39 -0
- package/v1/declaration.d.ts +309 -0
- package/v1/declaration.js +296 -0
- package/v1/examples/child_workflows/worker.js +2 -2
- package/v1/examples/child_workflows/workflow.d.ts +2 -2
- package/v1/examples/child_workflows/workflow.js +5 -3
- package/v1/examples/concurrency-rr/load.js +2 -2
- package/v1/examples/concurrency-rr/worker.js +2 -2
- package/v1/examples/concurrency-rr/workflow.d.ts +1 -1
- package/v1/examples/concurrency-rr/workflow.js +2 -3
- package/v1/examples/dag/worker.js +2 -2
- package/v1/examples/dag/workflow.d.ts +1 -1
- package/v1/examples/dag/workflow.js +3 -3
- package/v1/examples/dag_match_condition/event.js +28 -0
- package/v1/examples/dag_match_condition/run.d.ts +1 -0
- package/v1/examples/dag_match_condition/run.js +25 -0
- package/v1/examples/dag_match_condition/worker.d.ts +1 -0
- package/{examples/playground.js → v1/examples/dag_match_condition/worker.js} +7 -22
- package/v1/examples/dag_match_condition/workflow.d.ts +11 -0
- package/v1/examples/dag_match_condition/workflow.js +41 -0
- package/v1/examples/deep/worker.js +2 -2
- package/v1/examples/deep/workflow.d.ts +6 -6
- package/v1/examples/deep/workflow.js +7 -7
- package/v1/examples/durable-sleep/event.d.ts +1 -0
- package/v1/examples/durable-sleep/event.js +28 -0
- package/v1/examples/durable-sleep/run.d.ts +1 -0
- package/v1/examples/durable-sleep/run.js +30 -0
- package/v1/examples/durable-sleep/worker.d.ts +1 -0
- package/v1/examples/durable-sleep/worker.js +24 -0
- package/v1/examples/durable-sleep/workflow.d.ts +1 -0
- package/v1/examples/durable-sleep/workflow.js +37 -0
- package/v1/examples/inferred-typing/run.d.ts +1 -0
- package/v1/examples/inferred-typing/run.js +41 -0
- package/v1/examples/inferred-typing/worker.d.ts +1 -0
- package/v1/examples/inferred-typing/worker.js +24 -0
- package/v1/examples/inferred-typing/workflow.d.ts +15 -0
- package/v1/examples/inferred-typing/workflow.js +44 -0
- package/v1/examples/landing_page/durable-excution.d.ts +3 -0
- package/v1/examples/landing_page/durable-excution.js +40 -0
- package/v1/examples/landing_page/event-signaling.d.ts +6 -0
- package/v1/examples/landing_page/event-signaling.js +16 -0
- package/v1/examples/landing_page/flow-control.d.ts +6 -0
- package/v1/examples/landing_page/flow-control.js +26 -0
- package/v1/examples/landing_page/queues.d.ts +3 -0
- package/v1/examples/landing_page/queues.js +33 -0
- package/v1/examples/landing_page/scheduling.d.ts +1 -0
- package/v1/examples/landing_page/scheduling.js +12 -0
- package/v1/examples/landing_page/task-routing.d.ts +6 -0
- package/v1/examples/landing_page/task-routing.js +25 -0
- package/v1/examples/legacy/run.js +2 -2
- package/v1/examples/legacy/worker.js +2 -2
- package/v1/examples/on_cron/worker.d.ts +1 -0
- package/v1/examples/on_cron/worker.js +24 -0
- package/v1/examples/on_cron/workflow.d.ts +10 -0
- package/v1/examples/on_cron/workflow.js +21 -0
- package/v1/examples/on_event/event.js +3 -2
- package/v1/examples/on_event/worker.js +2 -2
- package/v1/examples/on_event/workflow.d.ts +4 -4
- package/v1/examples/on_event/workflow.js +6 -3
- package/v1/examples/on_event copy/event.d.ts +1 -0
- package/v1/examples/on_event copy/event.js +26 -0
- package/v1/examples/on_event copy/worker.d.ts +1 -0
- package/v1/examples/on_event copy/worker.js +24 -0
- package/v1/examples/on_event copy/workflow.d.ts +16 -0
- package/v1/examples/on_event copy/workflow.js +35 -0
- package/v1/examples/on_failure/worker.js +2 -2
- package/v1/examples/on_failure/workflow.d.ts +1 -1
- package/v1/examples/on_failure/workflow.js +18 -8
- package/v1/examples/on_success/run.d.ts +1 -0
- package/v1/examples/on_success/run.js +31 -0
- package/v1/examples/on_success/worker.d.ts +1 -0
- package/v1/examples/on_success/worker.js +24 -0
- package/v1/examples/on_success/workflow.d.ts +4 -0
- package/v1/examples/on_success/workflow.js +59 -0
- package/v1/examples/retries/run.d.ts +1 -0
- package/v1/examples/retries/run.js +29 -0
- package/v1/examples/retries/worker.d.ts +1 -0
- package/v1/examples/retries/worker.js +24 -0
- package/v1/examples/retries/workflow.d.ts +5 -0
- package/v1/examples/retries/workflow.js +53 -0
- package/v1/examples/simple/client-run.d.ts +1 -0
- package/v1/examples/simple/client-run.js +16 -0
- package/v1/examples/simple/cron.js +6 -2
- package/v1/examples/simple/delay.js +2 -2
- package/v1/examples/simple/enqueue.d.ts +1 -0
- package/v1/examples/simple/enqueue.js +43 -0
- package/v1/examples/simple/run.js +8 -3
- package/v1/examples/simple/schedule.js +11 -5
- package/v1/examples/simple/stub-workflow.d.ts +9 -0
- package/v1/examples/simple/stub-workflow.js +17 -0
- package/v1/examples/simple/worker.js +7 -2
- package/v1/examples/simple/workflow.d.ts +4 -3
- package/v1/examples/simple/workflow.js +5 -5
- package/v1/examples/sticky/run.d.ts +1 -0
- package/v1/examples/sticky/run.js +29 -0
- package/v1/examples/sticky/worker.d.ts +1 -0
- package/v1/examples/sticky/worker.js +24 -0
- package/v1/examples/sticky/workflow.d.ts +7 -0
- package/v1/examples/sticky/workflow.js +32 -0
- package/v1/examples/with_timeouts/workflow.d.ts +9 -0
- package/v1/examples/with_timeouts/workflow.js +62 -0
- package/v1/index.d.ts +5 -0
- package/v1/index.js +20 -0
- package/v1/task.d.ts +144 -14
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/v1/workflow.d.ts +0 -158
- package/v1/workflow.js +0 -145
- /package/{examples/playground.d.ts → v1/examples/dag_match_condition/event.d.ts} +0 -0
- /package/v1/examples/{client.d.ts → hatchet-client.d.ts} +0 -0
- /package/v1/examples/{client.js → hatchet-client.js} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
|
2
|
+
import { type CallContext, type CallOptions } from 'nice-grpc-common';
|
|
3
|
+
import { DurableEventListenerConditions } from './shared/condition';
|
|
4
|
+
export declare const protobufPackage = "v1";
|
|
5
|
+
export interface RegisterDurableEventRequest {
|
|
6
|
+
/** external uuid for the task run */
|
|
7
|
+
taskId: string;
|
|
8
|
+
/** the signal key for the event */
|
|
9
|
+
signalKey: string;
|
|
10
|
+
/** the task conditions for creating the task */
|
|
11
|
+
conditions: DurableEventListenerConditions | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface RegisterDurableEventResponse {
|
|
14
|
+
}
|
|
15
|
+
export interface ListenForDurableEventRequest {
|
|
16
|
+
/** single listener per worker */
|
|
17
|
+
taskId: string;
|
|
18
|
+
/** the match id for the listener */
|
|
19
|
+
signalKey: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DurableEvent {
|
|
22
|
+
taskId: string;
|
|
23
|
+
signalKey: string;
|
|
24
|
+
/** the data for the event */
|
|
25
|
+
data: Uint8Array;
|
|
26
|
+
}
|
|
27
|
+
export declare const RegisterDurableEventRequest: MessageFns<RegisterDurableEventRequest>;
|
|
28
|
+
export declare const RegisterDurableEventResponse: MessageFns<RegisterDurableEventResponse>;
|
|
29
|
+
export declare const ListenForDurableEventRequest: MessageFns<ListenForDurableEventRequest>;
|
|
30
|
+
export declare const DurableEvent: MessageFns<DurableEvent>;
|
|
31
|
+
export type V1DispatcherDefinition = typeof V1DispatcherDefinition;
|
|
32
|
+
export declare const V1DispatcherDefinition: {
|
|
33
|
+
readonly name: "V1Dispatcher";
|
|
34
|
+
readonly fullName: "v1.V1Dispatcher";
|
|
35
|
+
readonly methods: {
|
|
36
|
+
readonly registerDurableEvent: {
|
|
37
|
+
readonly name: "RegisterDurableEvent";
|
|
38
|
+
readonly requestType: MessageFns<RegisterDurableEventRequest>;
|
|
39
|
+
readonly requestStream: false;
|
|
40
|
+
readonly responseType: MessageFns<RegisterDurableEventResponse>;
|
|
41
|
+
readonly responseStream: false;
|
|
42
|
+
readonly options: {};
|
|
43
|
+
};
|
|
44
|
+
readonly listenForDurableEvent: {
|
|
45
|
+
readonly name: "ListenForDurableEvent";
|
|
46
|
+
readonly requestType: MessageFns<ListenForDurableEventRequest>;
|
|
47
|
+
readonly requestStream: true;
|
|
48
|
+
readonly responseType: MessageFns<DurableEvent>;
|
|
49
|
+
readonly responseStream: true;
|
|
50
|
+
readonly options: {};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export interface V1DispatcherServiceImplementation<CallContextExt = {}> {
|
|
55
|
+
registerDurableEvent(request: RegisterDurableEventRequest, context: CallContext & CallContextExt): Promise<DeepPartial<RegisterDurableEventResponse>>;
|
|
56
|
+
listenForDurableEvent(request: AsyncIterable<ListenForDurableEventRequest>, context: CallContext & CallContextExt): ServerStreamingMethodResult<DeepPartial<DurableEvent>>;
|
|
57
|
+
}
|
|
58
|
+
export interface V1DispatcherClient<CallOptionsExt = {}> {
|
|
59
|
+
registerDurableEvent(request: DeepPartial<RegisterDurableEventRequest>, options?: CallOptions & CallOptionsExt): Promise<RegisterDurableEventResponse>;
|
|
60
|
+
listenForDurableEvent(request: AsyncIterable<DeepPartial<ListenForDurableEventRequest>>, options?: CallOptions & CallOptionsExt): AsyncIterable<DurableEvent>;
|
|
61
|
+
}
|
|
62
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
63
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
64
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
65
|
+
} : Partial<T>;
|
|
66
|
+
export type ServerStreamingMethodResult<Response> = {
|
|
67
|
+
[Symbol.asyncIterator](): AsyncIterator<Response, void>;
|
|
68
|
+
};
|
|
69
|
+
export interface MessageFns<T> {
|
|
70
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
71
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
72
|
+
fromJSON(object: any): T;
|
|
73
|
+
toJSON(message: T): unknown;
|
|
74
|
+
create(base?: DeepPartial<T>): T;
|
|
75
|
+
fromPartial(object: DeepPartial<T>): T;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.6.1
|
|
5
|
+
// protoc v3.19.1
|
|
6
|
+
// source: v1/dispatcher.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.V1DispatcherDefinition = exports.DurableEvent = exports.ListenForDurableEventRequest = exports.RegisterDurableEventResponse = exports.RegisterDurableEventRequest = exports.protobufPackage = void 0;
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const condition_1 = require("./shared/condition");
|
|
12
|
+
exports.protobufPackage = 'v1';
|
|
13
|
+
function createBaseRegisterDurableEventRequest() {
|
|
14
|
+
return { taskId: '', signalKey: '', conditions: undefined };
|
|
15
|
+
}
|
|
16
|
+
exports.RegisterDurableEventRequest = {
|
|
17
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
18
|
+
if (message.taskId !== '') {
|
|
19
|
+
writer.uint32(10).string(message.taskId);
|
|
20
|
+
}
|
|
21
|
+
if (message.signalKey !== '') {
|
|
22
|
+
writer.uint32(18).string(message.signalKey);
|
|
23
|
+
}
|
|
24
|
+
if (message.conditions !== undefined) {
|
|
25
|
+
condition_1.DurableEventListenerConditions.encode(message.conditions, writer.uint32(26).fork()).join();
|
|
26
|
+
}
|
|
27
|
+
return writer;
|
|
28
|
+
},
|
|
29
|
+
decode(input, length) {
|
|
30
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
31
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
32
|
+
const message = createBaseRegisterDurableEventRequest();
|
|
33
|
+
while (reader.pos < end) {
|
|
34
|
+
const tag = reader.uint32();
|
|
35
|
+
switch (tag >>> 3) {
|
|
36
|
+
case 1: {
|
|
37
|
+
if (tag !== 10) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
message.taskId = reader.string();
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
case 2: {
|
|
44
|
+
if (tag !== 18) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
message.signalKey = reader.string();
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
case 3: {
|
|
51
|
+
if (tag !== 26) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
message.conditions = condition_1.DurableEventListenerConditions.decode(reader, reader.uint32());
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
reader.skip(tag & 7);
|
|
62
|
+
}
|
|
63
|
+
return message;
|
|
64
|
+
},
|
|
65
|
+
fromJSON(object) {
|
|
66
|
+
return {
|
|
67
|
+
taskId: isSet(object.taskId) ? globalThis.String(object.taskId) : '',
|
|
68
|
+
signalKey: isSet(object.signalKey) ? globalThis.String(object.signalKey) : '',
|
|
69
|
+
conditions: isSet(object.conditions)
|
|
70
|
+
? condition_1.DurableEventListenerConditions.fromJSON(object.conditions)
|
|
71
|
+
: undefined,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
toJSON(message) {
|
|
75
|
+
const obj = {};
|
|
76
|
+
if (message.taskId !== '') {
|
|
77
|
+
obj.taskId = message.taskId;
|
|
78
|
+
}
|
|
79
|
+
if (message.signalKey !== '') {
|
|
80
|
+
obj.signalKey = message.signalKey;
|
|
81
|
+
}
|
|
82
|
+
if (message.conditions !== undefined) {
|
|
83
|
+
obj.conditions = condition_1.DurableEventListenerConditions.toJSON(message.conditions);
|
|
84
|
+
}
|
|
85
|
+
return obj;
|
|
86
|
+
},
|
|
87
|
+
create(base) {
|
|
88
|
+
return exports.RegisterDurableEventRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
89
|
+
},
|
|
90
|
+
fromPartial(object) {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
const message = createBaseRegisterDurableEventRequest();
|
|
93
|
+
message.taskId = (_a = object.taskId) !== null && _a !== void 0 ? _a : '';
|
|
94
|
+
message.signalKey = (_b = object.signalKey) !== null && _b !== void 0 ? _b : '';
|
|
95
|
+
message.conditions =
|
|
96
|
+
object.conditions !== undefined && object.conditions !== null
|
|
97
|
+
? condition_1.DurableEventListenerConditions.fromPartial(object.conditions)
|
|
98
|
+
: undefined;
|
|
99
|
+
return message;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
function createBaseRegisterDurableEventResponse() {
|
|
103
|
+
return {};
|
|
104
|
+
}
|
|
105
|
+
exports.RegisterDurableEventResponse = {
|
|
106
|
+
encode(_, writer = new wire_1.BinaryWriter()) {
|
|
107
|
+
return writer;
|
|
108
|
+
},
|
|
109
|
+
decode(input, length) {
|
|
110
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
111
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
112
|
+
const message = createBaseRegisterDurableEventResponse();
|
|
113
|
+
while (reader.pos < end) {
|
|
114
|
+
const tag = reader.uint32();
|
|
115
|
+
switch (tag >>> 3) {
|
|
116
|
+
}
|
|
117
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
reader.skip(tag & 7);
|
|
121
|
+
}
|
|
122
|
+
return message;
|
|
123
|
+
},
|
|
124
|
+
fromJSON(_) {
|
|
125
|
+
return {};
|
|
126
|
+
},
|
|
127
|
+
toJSON(_) {
|
|
128
|
+
const obj = {};
|
|
129
|
+
return obj;
|
|
130
|
+
},
|
|
131
|
+
create(base) {
|
|
132
|
+
return exports.RegisterDurableEventResponse.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
133
|
+
},
|
|
134
|
+
fromPartial(_) {
|
|
135
|
+
const message = createBaseRegisterDurableEventResponse();
|
|
136
|
+
return message;
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
function createBaseListenForDurableEventRequest() {
|
|
140
|
+
return { taskId: '', signalKey: '' };
|
|
141
|
+
}
|
|
142
|
+
exports.ListenForDurableEventRequest = {
|
|
143
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
144
|
+
if (message.taskId !== '') {
|
|
145
|
+
writer.uint32(10).string(message.taskId);
|
|
146
|
+
}
|
|
147
|
+
if (message.signalKey !== '') {
|
|
148
|
+
writer.uint32(18).string(message.signalKey);
|
|
149
|
+
}
|
|
150
|
+
return writer;
|
|
151
|
+
},
|
|
152
|
+
decode(input, length) {
|
|
153
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
154
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
155
|
+
const message = createBaseListenForDurableEventRequest();
|
|
156
|
+
while (reader.pos < end) {
|
|
157
|
+
const tag = reader.uint32();
|
|
158
|
+
switch (tag >>> 3) {
|
|
159
|
+
case 1: {
|
|
160
|
+
if (tag !== 10) {
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
message.taskId = reader.string();
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
case 2: {
|
|
167
|
+
if (tag !== 18) {
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
message.signalKey = reader.string();
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
reader.skip(tag & 7);
|
|
178
|
+
}
|
|
179
|
+
return message;
|
|
180
|
+
},
|
|
181
|
+
fromJSON(object) {
|
|
182
|
+
return {
|
|
183
|
+
taskId: isSet(object.taskId) ? globalThis.String(object.taskId) : '',
|
|
184
|
+
signalKey: isSet(object.signalKey) ? globalThis.String(object.signalKey) : '',
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
toJSON(message) {
|
|
188
|
+
const obj = {};
|
|
189
|
+
if (message.taskId !== '') {
|
|
190
|
+
obj.taskId = message.taskId;
|
|
191
|
+
}
|
|
192
|
+
if (message.signalKey !== '') {
|
|
193
|
+
obj.signalKey = message.signalKey;
|
|
194
|
+
}
|
|
195
|
+
return obj;
|
|
196
|
+
},
|
|
197
|
+
create(base) {
|
|
198
|
+
return exports.ListenForDurableEventRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
199
|
+
},
|
|
200
|
+
fromPartial(object) {
|
|
201
|
+
var _a, _b;
|
|
202
|
+
const message = createBaseListenForDurableEventRequest();
|
|
203
|
+
message.taskId = (_a = object.taskId) !== null && _a !== void 0 ? _a : '';
|
|
204
|
+
message.signalKey = (_b = object.signalKey) !== null && _b !== void 0 ? _b : '';
|
|
205
|
+
return message;
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
function createBaseDurableEvent() {
|
|
209
|
+
return { taskId: '', signalKey: '', data: new Uint8Array(0) };
|
|
210
|
+
}
|
|
211
|
+
exports.DurableEvent = {
|
|
212
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
213
|
+
if (message.taskId !== '') {
|
|
214
|
+
writer.uint32(10).string(message.taskId);
|
|
215
|
+
}
|
|
216
|
+
if (message.signalKey !== '') {
|
|
217
|
+
writer.uint32(18).string(message.signalKey);
|
|
218
|
+
}
|
|
219
|
+
if (message.data.length !== 0) {
|
|
220
|
+
writer.uint32(26).bytes(message.data);
|
|
221
|
+
}
|
|
222
|
+
return writer;
|
|
223
|
+
},
|
|
224
|
+
decode(input, length) {
|
|
225
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
226
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
227
|
+
const message = createBaseDurableEvent();
|
|
228
|
+
while (reader.pos < end) {
|
|
229
|
+
const tag = reader.uint32();
|
|
230
|
+
switch (tag >>> 3) {
|
|
231
|
+
case 1: {
|
|
232
|
+
if (tag !== 10) {
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
message.taskId = reader.string();
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
case 2: {
|
|
239
|
+
if (tag !== 18) {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
message.signalKey = reader.string();
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
case 3: {
|
|
246
|
+
if (tag !== 26) {
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
message.data = reader.bytes();
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
reader.skip(tag & 7);
|
|
257
|
+
}
|
|
258
|
+
return message;
|
|
259
|
+
},
|
|
260
|
+
fromJSON(object) {
|
|
261
|
+
return {
|
|
262
|
+
taskId: isSet(object.taskId) ? globalThis.String(object.taskId) : '',
|
|
263
|
+
signalKey: isSet(object.signalKey) ? globalThis.String(object.signalKey) : '',
|
|
264
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
|
|
265
|
+
};
|
|
266
|
+
},
|
|
267
|
+
toJSON(message) {
|
|
268
|
+
const obj = {};
|
|
269
|
+
if (message.taskId !== '') {
|
|
270
|
+
obj.taskId = message.taskId;
|
|
271
|
+
}
|
|
272
|
+
if (message.signalKey !== '') {
|
|
273
|
+
obj.signalKey = message.signalKey;
|
|
274
|
+
}
|
|
275
|
+
if (message.data.length !== 0) {
|
|
276
|
+
obj.data = base64FromBytes(message.data);
|
|
277
|
+
}
|
|
278
|
+
return obj;
|
|
279
|
+
},
|
|
280
|
+
create(base) {
|
|
281
|
+
return exports.DurableEvent.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
282
|
+
},
|
|
283
|
+
fromPartial(object) {
|
|
284
|
+
var _a, _b, _c;
|
|
285
|
+
const message = createBaseDurableEvent();
|
|
286
|
+
message.taskId = (_a = object.taskId) !== null && _a !== void 0 ? _a : '';
|
|
287
|
+
message.signalKey = (_b = object.signalKey) !== null && _b !== void 0 ? _b : '';
|
|
288
|
+
message.data = (_c = object.data) !== null && _c !== void 0 ? _c : new Uint8Array(0);
|
|
289
|
+
return message;
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
exports.V1DispatcherDefinition = {
|
|
293
|
+
name: 'V1Dispatcher',
|
|
294
|
+
fullName: 'v1.V1Dispatcher',
|
|
295
|
+
methods: {
|
|
296
|
+
registerDurableEvent: {
|
|
297
|
+
name: 'RegisterDurableEvent',
|
|
298
|
+
requestType: exports.RegisterDurableEventRequest,
|
|
299
|
+
requestStream: false,
|
|
300
|
+
responseType: exports.RegisterDurableEventResponse,
|
|
301
|
+
responseStream: false,
|
|
302
|
+
options: {},
|
|
303
|
+
},
|
|
304
|
+
listenForDurableEvent: {
|
|
305
|
+
name: 'ListenForDurableEvent',
|
|
306
|
+
requestType: exports.ListenForDurableEventRequest,
|
|
307
|
+
requestStream: true,
|
|
308
|
+
responseType: exports.DurableEvent,
|
|
309
|
+
responseStream: true,
|
|
310
|
+
options: {},
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
function bytesFromBase64(b64) {
|
|
315
|
+
if (globalThis.Buffer) {
|
|
316
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, 'base64'));
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
const bin = globalThis.atob(b64);
|
|
320
|
+
const arr = new Uint8Array(bin.length);
|
|
321
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
322
|
+
arr[i] = bin.charCodeAt(i);
|
|
323
|
+
}
|
|
324
|
+
return arr;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function base64FromBytes(arr) {
|
|
328
|
+
if (globalThis.Buffer) {
|
|
329
|
+
return globalThis.Buffer.from(arr).toString('base64');
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
const bin = [];
|
|
333
|
+
arr.forEach((byte) => {
|
|
334
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
335
|
+
});
|
|
336
|
+
return globalThis.btoa(bin.join(''));
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function isSet(value) {
|
|
340
|
+
return value !== null && value !== undefined;
|
|
341
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
|
2
|
+
export declare const protobufPackage = "v1";
|
|
3
|
+
export declare enum Action {
|
|
4
|
+
CREATE = 0,
|
|
5
|
+
QUEUE = 1,
|
|
6
|
+
CANCEL = 2,
|
|
7
|
+
SKIP = 3,
|
|
8
|
+
UNRECOGNIZED = -1
|
|
9
|
+
}
|
|
10
|
+
export declare function actionFromJSON(object: any): Action;
|
|
11
|
+
export declare function actionToJSON(object: Action): string;
|
|
12
|
+
export interface BaseMatchCondition {
|
|
13
|
+
readableDataKey: string;
|
|
14
|
+
action: Action;
|
|
15
|
+
/** a UUID defining the OR group for this condition */
|
|
16
|
+
orGroupId: string;
|
|
17
|
+
expression: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ParentOverrideMatchCondition {
|
|
20
|
+
base: BaseMatchCondition | undefined;
|
|
21
|
+
parentReadableId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SleepMatchCondition {
|
|
24
|
+
base: BaseMatchCondition | undefined;
|
|
25
|
+
/** a duration string indicating how long to sleep */
|
|
26
|
+
sleepFor: string;
|
|
27
|
+
}
|
|
28
|
+
export interface UserEventMatchCondition {
|
|
29
|
+
base: BaseMatchCondition | undefined;
|
|
30
|
+
userEventKey: string;
|
|
31
|
+
}
|
|
32
|
+
export interface TaskConditions {
|
|
33
|
+
parentOverrideConditions: ParentOverrideMatchCondition[];
|
|
34
|
+
sleepConditions: SleepMatchCondition[];
|
|
35
|
+
userEventConditions: UserEventMatchCondition[];
|
|
36
|
+
}
|
|
37
|
+
export interface DurableEventListenerConditions {
|
|
38
|
+
sleepConditions: SleepMatchCondition[];
|
|
39
|
+
userEventConditions: UserEventMatchCondition[];
|
|
40
|
+
}
|
|
41
|
+
export declare const BaseMatchCondition: MessageFns<BaseMatchCondition>;
|
|
42
|
+
export declare const ParentOverrideMatchCondition: MessageFns<ParentOverrideMatchCondition>;
|
|
43
|
+
export declare const SleepMatchCondition: MessageFns<SleepMatchCondition>;
|
|
44
|
+
export declare const UserEventMatchCondition: MessageFns<UserEventMatchCondition>;
|
|
45
|
+
export declare const TaskConditions: MessageFns<TaskConditions>;
|
|
46
|
+
export declare const DurableEventListenerConditions: MessageFns<DurableEventListenerConditions>;
|
|
47
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
48
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
49
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
50
|
+
} : Partial<T>;
|
|
51
|
+
export interface MessageFns<T> {
|
|
52
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
53
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
54
|
+
fromJSON(object: any): T;
|
|
55
|
+
toJSON(message: T): unknown;
|
|
56
|
+
create(base?: DeepPartial<T>): T;
|
|
57
|
+
fromPartial(object: DeepPartial<T>): T;
|
|
58
|
+
}
|
|
59
|
+
export {};
|