@hatchet-dev/typescript-sdk 0.0.3 → 0.1.1

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.
Files changed (58) hide show
  1. package/package.json +23 -18
  2. package/README.md +0 -3
  3. package/dist/clients/admin/admin-client.d.ts +0 -14
  4. package/dist/clients/admin/admin-client.js +0 -50
  5. package/dist/clients/dispatcher/action-listener.d.ts +0 -24
  6. package/dist/clients/dispatcher/action-listener.js +0 -113
  7. package/dist/clients/dispatcher/dispatcher-client.d.ts +0 -17
  8. package/dist/clients/dispatcher/dispatcher-client.js +0 -46
  9. package/dist/clients/event/event-client.d.ts +0 -9
  10. package/dist/clients/event/event-client.js +0 -28
  11. package/dist/clients/hatchet-client/client-config.d.ts +0 -72
  12. package/dist/clients/hatchet-client/client-config.js +0 -17
  13. package/dist/clients/hatchet-client/hatchet-client.d.ts +0 -26
  14. package/dist/clients/hatchet-client/hatchet-client.js +0 -133
  15. package/dist/clients/hatchet-client/index.d.ts +0 -2
  16. package/dist/clients/hatchet-client/index.js +0 -18
  17. package/dist/clients/worker/index.d.ts +0 -1
  18. package/dist/clients/worker/index.js +0 -17
  19. package/dist/clients/worker/worker.d.ts +0 -31
  20. package/dist/clients/worker/worker.js +0 -228
  21. package/dist/index.d.ts +0 -2
  22. package/dist/index.js +0 -4
  23. package/dist/protoc/dispatcher/dispatcher.d.ts +0 -273
  24. package/dist/protoc/dispatcher/dispatcher.js +0 -918
  25. package/dist/protoc/dispatcher/index.d.ts +0 -1
  26. package/dist/protoc/dispatcher/index.js +0 -17
  27. package/dist/protoc/events/events.d.ts +0 -165
  28. package/dist/protoc/events/events.js +0 -443
  29. package/dist/protoc/events/index.d.ts +0 -1
  30. package/dist/protoc/events/index.js +0 -17
  31. package/dist/protoc/google/protobuf/timestamp.d.ts +0 -121
  32. package/dist/protoc/google/protobuf/timestamp.js +0 -110
  33. package/dist/protoc/google/protobuf/wrappers.d.ts +0 -160
  34. package/dist/protoc/google/protobuf/wrappers.js +0 -527
  35. package/dist/protoc/workflows/index.d.ts +0 -1
  36. package/dist/protoc/workflows/index.js +0 -17
  37. package/dist/protoc/workflows/workflows.d.ts +0 -438
  38. package/dist/protoc/workflows/workflows.js +0 -1814
  39. package/dist/sdk.d.ts +0 -2
  40. package/dist/sdk.js +0 -4
  41. package/dist/step.d.ts +0 -30
  42. package/dist/step.js +0 -63
  43. package/dist/util/config-loader/config-loader.d.ts +0 -13
  44. package/dist/util/config-loader/config-loader.js +0 -85
  45. package/dist/util/config-loader/index.d.ts +0 -1
  46. package/dist/util/config-loader/index.js +0 -17
  47. package/dist/util/errors/hatchet-error.d.ts +0 -4
  48. package/dist/util/errors/hatchet-error.js +0 -9
  49. package/dist/util/hatchet-promise/hatchet-promise.d.ts +0 -6
  50. package/dist/util/hatchet-promise/hatchet-promise.js +0 -12
  51. package/dist/util/logger/index.d.ts +0 -1
  52. package/dist/util/logger/index.js +0 -17
  53. package/dist/util/logger/logger.d.ts +0 -12
  54. package/dist/util/logger/logger.js +0 -37
  55. package/dist/util/sleep.d.ts +0 -2
  56. package/dist/util/sleep.js +0 -6
  57. package/dist/workflow.d.ts +0 -78
  58. package/dist/workflow.js +0 -44
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./worker"), exports);
@@ -1,31 +0,0 @@
1
- import { HatchetClient } from '../hatchet-client';
2
- import { Action, ActionListener } from '../dispatcher/action-listener';
3
- import { ActionEvent, ActionEventType } from '../../protoc/dispatcher';
4
- import HatchetPromise from '../../util/hatchet-promise/hatchet-promise';
5
- import { Workflow } from '../../workflow';
6
- import { Logger } from '../../util/logger';
7
- export type ActionRegistry = Record<Action['actionId'], Function>;
8
- export declare class Worker {
9
- serviceName: string;
10
- client: HatchetClient;
11
- name: string;
12
- killing: boolean;
13
- handle_kill: boolean;
14
- action_registry: ActionRegistry;
15
- listener: ActionListener | undefined;
16
- futures: Record<Action['stepRunId'], HatchetPromise<any>>;
17
- logger: Logger;
18
- constructor(client: HatchetClient, options: {
19
- name: string;
20
- handleKill?: boolean;
21
- });
22
- register_workflow(workflow: Workflow, options?: {
23
- autoVersion?: boolean;
24
- }): Promise<void>;
25
- handle_start_step_run(action: Action): void;
26
- get_action_event(action: Action, eventType: ActionEventType, payload?: any): ActionEvent;
27
- handle_cancel_step_run(action: Action): void;
28
- stop(): Promise<void>;
29
- exit_gracefully(): Promise<void>;
30
- start(): Promise<void>;
31
- }
@@ -1,228 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __asyncValues = (this && this.__asyncValues) || function (o) {
12
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
- var m = o[Symbol.asyncIterator], i;
14
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.Worker = void 0;
23
- const hatchet_error_1 = __importDefault(require("../../util/errors/hatchet-error"));
24
- const dispatcher_1 = require("../../protoc/dispatcher");
25
- const hatchet_promise_1 = __importDefault(require("../../util/hatchet-promise/hatchet-promise"));
26
- const logger_1 = require("../../util/logger");
27
- const sleep_1 = __importDefault(require("../../util/sleep"));
28
- const step_1 = require("../../step");
29
- class Worker {
30
- constructor(client, options) {
31
- this.serviceName = 'default';
32
- this.futures = {};
33
- this.client = client;
34
- this.name = options.name;
35
- this.action_registry = {};
36
- process.on('SIGTERM', () => this.exit_gracefully());
37
- process.on('SIGINT', () => this.exit_gracefully());
38
- this.killing = false;
39
- this.handle_kill = options.handleKill === undefined ? true : options.handleKill;
40
- this.logger = new logger_1.Logger(`Worker/${this.name}`, this.client.config.log_level);
41
- }
42
- register_workflow(workflow, options) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- try {
45
- yield this.client.admin.put_workflow({
46
- name: workflow.id,
47
- description: workflow.description,
48
- version: 'v0.55.0', // FIXME workflow.version,
49
- eventTriggers: workflow.on.event ? [workflow.on.event] : [],
50
- cronTriggers: workflow.on.cron ? [workflow.on.cron] : [],
51
- scheduledTriggers: [],
52
- jobs: [
53
- {
54
- name: 'my-job', // FIXME variable names
55
- timeout: '60s',
56
- description: 'my-job',
57
- steps: workflow.steps.map((step) => {
58
- var _a;
59
- return ({
60
- readableId: step.name,
61
- action: `${this.serviceName}:${step.name}`,
62
- timeout: '60s',
63
- inputs: '{}',
64
- parents: (_a = step.parents) !== null && _a !== void 0 ? _a : [],
65
- });
66
- }),
67
- },
68
- ],
69
- }, {
70
- autoVersion: !(options === null || options === void 0 ? void 0 : options.autoVersion),
71
- });
72
- }
73
- catch (e) {
74
- throw new hatchet_error_1.default(`Could not register workflow: ${e.message}`);
75
- }
76
- this.action_registry = workflow.steps.reduce((acc, step) => {
77
- acc[`${this.serviceName}:${step.name}`] = step.run;
78
- return acc;
79
- }, {});
80
- });
81
- }
82
- handle_start_step_run(action) {
83
- const { actionId } = action;
84
- const context = new step_1.Context(action.actionPayload);
85
- const step = this.action_registry[actionId];
86
- if (!step) {
87
- this.logger.error(`Could not find step '${actionId}'`);
88
- return;
89
- }
90
- const run = () => __awaiter(this, void 0, void 0, function* () {
91
- return step(context);
92
- });
93
- const success = (result) => {
94
- this.logger.info(`Step run ${action.stepRunId} succeeded`);
95
- try {
96
- // Send the action event to the dispatcher
97
- const event = this.get_action_event(action, dispatcher_1.ActionEventType.STEP_EVENT_TYPE_COMPLETED, result);
98
- this.client.dispatcher.send_action_event(event);
99
- // delete the run from the futures
100
- delete this.futures[action.stepRunId];
101
- }
102
- catch (e) {
103
- this.logger.error(`Could not send action event: ${e.message}`);
104
- }
105
- };
106
- const failure = (error) => {
107
- this.logger.error(`Step run ${action.stepRunId} failed: ${error.message}`);
108
- try {
109
- // Send the action event to the dispatcher
110
- const event = this.get_action_event(action, dispatcher_1.ActionEventType.STEP_EVENT_TYPE_FAILED, error);
111
- this.client.dispatcher.send_action_event(event);
112
- // delete the run from the futures
113
- delete this.futures[action.stepRunId];
114
- }
115
- catch (e) {
116
- this.logger.error(`Could not send action event: ${e.message}`);
117
- }
118
- };
119
- const future = new hatchet_promise_1.default(run().then(success).catch(failure));
120
- this.futures[action.stepRunId] = future;
121
- try {
122
- // Send the action event to the dispatcher
123
- const event = this.get_action_event(action, dispatcher_1.ActionEventType.STEP_EVENT_TYPE_STARTED);
124
- this.client.dispatcher.send_action_event(event);
125
- }
126
- catch (e) {
127
- this.logger.error(`Could not send action event: ${e.message}`);
128
- }
129
- }
130
- get_action_event(action, eventType, payload = '') {
131
- return {
132
- workerId: this.name,
133
- jobId: action.jobId,
134
- jobRunId: action.jobRunId,
135
- stepId: action.stepId,
136
- stepRunId: action.stepRunId,
137
- actionId: action.actionId,
138
- eventTimestamp: new Date(),
139
- eventType,
140
- eventPayload: JSON.stringify(payload),
141
- };
142
- }
143
- handle_cancel_step_run(action) {
144
- const { stepRunId } = action;
145
- const future = this.futures[stepRunId];
146
- if (future) {
147
- future.cancel();
148
- delete this.futures[stepRunId];
149
- }
150
- }
151
- stop() {
152
- return __awaiter(this, void 0, void 0, function* () {
153
- yield this.exit_gracefully();
154
- });
155
- }
156
- exit_gracefully() {
157
- var _a;
158
- return __awaiter(this, void 0, void 0, function* () {
159
- this.killing = true;
160
- this.logger.info('Starting to exit...');
161
- try {
162
- (_a = this.listener) === null || _a === void 0 ? void 0 : _a.unregister();
163
- }
164
- catch (e) {
165
- this.logger.error(`Could not unregister listener: ${e.message}`);
166
- }
167
- this.logger.info('Gracefully exiting hatchet worker, running tasks will attempt to finish...');
168
- // attempt to wait for futures to finish
169
- yield Promise.all(Object.values(this.futures).map(({ promise }) => promise));
170
- if (this.handle_kill) {
171
- this.logger.info('Exiting hatchet worker...');
172
- process.exit(0);
173
- }
174
- });
175
- }
176
- start() {
177
- var _a, e_1, _b, _c;
178
- return __awaiter(this, void 0, void 0, function* () {
179
- let retries = 0;
180
- while (retries < 5) {
181
- try {
182
- this.listener = yield this.client.dispatcher.get_action_listener({
183
- workerName: this.name,
184
- services: ['default'],
185
- actions: Object.keys(this.action_registry),
186
- });
187
- const generator = this.listener.actions();
188
- this.logger.info(`Worker ${this.name} listening for actions`);
189
- try {
190
- for (var _d = true, generator_1 = (e_1 = void 0, __asyncValues(generator)), generator_1_1; generator_1_1 = yield generator_1.next(), _a = generator_1_1.done, !_a; _d = true) {
191
- _c = generator_1_1.value;
192
- _d = false;
193
- const action = _c;
194
- this.logger.info(`Worker ${this.name} received action ${action.actionId}`);
195
- if (action.actionType === dispatcher_1.ActionType.START_STEP_RUN) {
196
- this.handle_start_step_run(action);
197
- }
198
- else if (action.actionType === dispatcher_1.ActionType.CANCEL_STEP_RUN) {
199
- this.handle_cancel_step_run(action);
200
- }
201
- }
202
- }
203
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
204
- finally {
205
- try {
206
- if (!_d && !_a && (_b = generator_1.return)) yield _b.call(generator_1);
207
- }
208
- finally { if (e_1) throw e_1.error; }
209
- }
210
- break;
211
- }
212
- catch (e) {
213
- this.logger.error(`Could not start worker: ${e.message}`);
214
- retries += 1;
215
- const wait = 500;
216
- this.logger.error(`Could not start worker, retrying in ${500} seconds`);
217
- yield (0, sleep_1.default)(wait);
218
- }
219
- }
220
- if (this.killing)
221
- return;
222
- if (retries > 5) {
223
- throw new hatchet_error_1.default('Could not start worker after 5 retries');
224
- }
225
- });
226
- }
227
- }
228
- exports.Worker = Worker;
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { HatchetClient as Hatchet } from './clients/hatchet-client';
2
- export default Hatchet;
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const hatchet_client_1 = require("./clients/hatchet-client");
4
- exports.default = hatchet_client_1.HatchetClient;
@@ -1,273 +0,0 @@
1
- import type { CallContext, CallOptions } from "nice-grpc-common";
2
- import * as _m0 from "protobufjs/minimal";
3
- export declare const protobufPackage = "";
4
- export declare enum ActionType {
5
- START_STEP_RUN = 0,
6
- CANCEL_STEP_RUN = 1,
7
- UNRECOGNIZED = -1
8
- }
9
- export declare function actionTypeFromJSON(object: any): ActionType;
10
- export declare function actionTypeToJSON(object: ActionType): string;
11
- export declare enum ActionEventType {
12
- STEP_EVENT_TYPE_UNKNOWN = 0,
13
- STEP_EVENT_TYPE_STARTED = 1,
14
- STEP_EVENT_TYPE_COMPLETED = 2,
15
- STEP_EVENT_TYPE_FAILED = 3,
16
- UNRECOGNIZED = -1
17
- }
18
- export declare function actionEventTypeFromJSON(object: any): ActionEventType;
19
- export declare function actionEventTypeToJSON(object: ActionEventType): string;
20
- export interface WorkerRegisterRequest {
21
- /** the name of the worker */
22
- workerName: string;
23
- /** a list of actions that this worker can run */
24
- actions: string[];
25
- /** (optional) the services for this worker */
26
- services: string[];
27
- }
28
- export interface WorkerRegisterResponse {
29
- /** the tenant id */
30
- tenantId: string;
31
- /** the id of the worker */
32
- workerId: string;
33
- /** the name of the worker */
34
- workerName: string;
35
- }
36
- export interface AssignedAction {
37
- /** the tenant id */
38
- tenantId: string;
39
- /** the job id */
40
- jobId: string;
41
- /** the job name */
42
- jobName: string;
43
- /** the job run id */
44
- jobRunId: string;
45
- /** the step id */
46
- stepId: string;
47
- /** the step run id */
48
- stepRunId: string;
49
- /** the action id */
50
- actionId: string;
51
- /** the action type */
52
- actionType: ActionType;
53
- /** the action payload */
54
- actionPayload: string;
55
- }
56
- export interface WorkerListenRequest {
57
- /** the id of the worker */
58
- workerId: string;
59
- }
60
- export interface WorkerUnsubscribeRequest {
61
- /** the id of the worker */
62
- workerId: string;
63
- }
64
- export interface WorkerUnsubscribeResponse {
65
- /** the tenant id to unsubscribe from */
66
- tenantId: string;
67
- /** the id of the worker */
68
- workerId: string;
69
- }
70
- export interface ActionEvent {
71
- /** the id of the worker */
72
- workerId: string;
73
- /** the id of the job */
74
- jobId: string;
75
- /** the job run id */
76
- jobRunId: string;
77
- /** the id of the step */
78
- stepId: string;
79
- /** the step run id */
80
- stepRunId: string;
81
- /** the action id */
82
- actionId: string;
83
- eventTimestamp: Date | undefined;
84
- /** the step event type */
85
- eventType: ActionEventType;
86
- /** the event payload */
87
- eventPayload: string;
88
- }
89
- export interface ActionEventResponse {
90
- /** the tenant id */
91
- tenantId: string;
92
- /** the id of the worker */
93
- workerId: string;
94
- }
95
- export declare const WorkerRegisterRequest: {
96
- encode(message: WorkerRegisterRequest, writer?: _m0.Writer): _m0.Writer;
97
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerRegisterRequest;
98
- fromJSON(object: any): WorkerRegisterRequest;
99
- toJSON(message: WorkerRegisterRequest): unknown;
100
- create(base?: DeepPartial<WorkerRegisterRequest>): WorkerRegisterRequest;
101
- fromPartial(object: DeepPartial<WorkerRegisterRequest>): WorkerRegisterRequest;
102
- };
103
- export declare const WorkerRegisterResponse: {
104
- encode(message: WorkerRegisterResponse, writer?: _m0.Writer): _m0.Writer;
105
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerRegisterResponse;
106
- fromJSON(object: any): WorkerRegisterResponse;
107
- toJSON(message: WorkerRegisterResponse): unknown;
108
- create(base?: DeepPartial<WorkerRegisterResponse>): WorkerRegisterResponse;
109
- fromPartial(object: DeepPartial<WorkerRegisterResponse>): WorkerRegisterResponse;
110
- };
111
- export declare const AssignedAction: {
112
- encode(message: AssignedAction, writer?: _m0.Writer): _m0.Writer;
113
- decode(input: _m0.Reader | Uint8Array, length?: number): AssignedAction;
114
- fromJSON(object: any): AssignedAction;
115
- toJSON(message: AssignedAction): unknown;
116
- create(base?: DeepPartial<AssignedAction>): AssignedAction;
117
- fromPartial(object: DeepPartial<AssignedAction>): AssignedAction;
118
- };
119
- export declare const WorkerListenRequest: {
120
- encode(message: WorkerListenRequest, writer?: _m0.Writer): _m0.Writer;
121
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerListenRequest;
122
- fromJSON(object: any): WorkerListenRequest;
123
- toJSON(message: WorkerListenRequest): unknown;
124
- create(base?: DeepPartial<WorkerListenRequest>): WorkerListenRequest;
125
- fromPartial(object: DeepPartial<WorkerListenRequest>): WorkerListenRequest;
126
- };
127
- export declare const WorkerUnsubscribeRequest: {
128
- encode(message: WorkerUnsubscribeRequest, writer?: _m0.Writer): _m0.Writer;
129
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerUnsubscribeRequest;
130
- fromJSON(object: any): WorkerUnsubscribeRequest;
131
- toJSON(message: WorkerUnsubscribeRequest): unknown;
132
- create(base?: DeepPartial<WorkerUnsubscribeRequest>): WorkerUnsubscribeRequest;
133
- fromPartial(object: DeepPartial<WorkerUnsubscribeRequest>): WorkerUnsubscribeRequest;
134
- };
135
- export declare const WorkerUnsubscribeResponse: {
136
- encode(message: WorkerUnsubscribeResponse, writer?: _m0.Writer): _m0.Writer;
137
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerUnsubscribeResponse;
138
- fromJSON(object: any): WorkerUnsubscribeResponse;
139
- toJSON(message: WorkerUnsubscribeResponse): unknown;
140
- create(base?: DeepPartial<WorkerUnsubscribeResponse>): WorkerUnsubscribeResponse;
141
- fromPartial(object: DeepPartial<WorkerUnsubscribeResponse>): WorkerUnsubscribeResponse;
142
- };
143
- export declare const ActionEvent: {
144
- encode(message: ActionEvent, writer?: _m0.Writer): _m0.Writer;
145
- decode(input: _m0.Reader | Uint8Array, length?: number): ActionEvent;
146
- fromJSON(object: any): ActionEvent;
147
- toJSON(message: ActionEvent): unknown;
148
- create(base?: DeepPartial<ActionEvent>): ActionEvent;
149
- fromPartial(object: DeepPartial<ActionEvent>): ActionEvent;
150
- };
151
- export declare const ActionEventResponse: {
152
- encode(message: ActionEventResponse, writer?: _m0.Writer): _m0.Writer;
153
- decode(input: _m0.Reader | Uint8Array, length?: number): ActionEventResponse;
154
- fromJSON(object: any): ActionEventResponse;
155
- toJSON(message: ActionEventResponse): unknown;
156
- create(base?: DeepPartial<ActionEventResponse>): ActionEventResponse;
157
- fromPartial(object: DeepPartial<ActionEventResponse>): ActionEventResponse;
158
- };
159
- export type DispatcherDefinition = typeof DispatcherDefinition;
160
- export declare const DispatcherDefinition: {
161
- readonly name: "Dispatcher";
162
- readonly fullName: "Dispatcher";
163
- readonly methods: {
164
- readonly register: {
165
- readonly name: "Register";
166
- readonly requestType: {
167
- encode(message: WorkerRegisterRequest, writer?: _m0.Writer): _m0.Writer;
168
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerRegisterRequest;
169
- fromJSON(object: any): WorkerRegisterRequest;
170
- toJSON(message: WorkerRegisterRequest): unknown;
171
- create(base?: DeepPartial<WorkerRegisterRequest>): WorkerRegisterRequest;
172
- fromPartial(object: DeepPartial<WorkerRegisterRequest>): WorkerRegisterRequest;
173
- };
174
- readonly requestStream: false;
175
- readonly responseType: {
176
- encode(message: WorkerRegisterResponse, writer?: _m0.Writer): _m0.Writer;
177
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerRegisterResponse;
178
- fromJSON(object: any): WorkerRegisterResponse;
179
- toJSON(message: WorkerRegisterResponse): unknown;
180
- create(base?: DeepPartial<WorkerRegisterResponse>): WorkerRegisterResponse;
181
- fromPartial(object: DeepPartial<WorkerRegisterResponse>): WorkerRegisterResponse;
182
- };
183
- readonly responseStream: false;
184
- readonly options: {};
185
- };
186
- readonly listen: {
187
- readonly name: "Listen";
188
- readonly requestType: {
189
- encode(message: WorkerListenRequest, writer?: _m0.Writer): _m0.Writer;
190
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerListenRequest;
191
- fromJSON(object: any): WorkerListenRequest;
192
- toJSON(message: WorkerListenRequest): unknown;
193
- create(base?: DeepPartial<WorkerListenRequest>): WorkerListenRequest;
194
- fromPartial(object: DeepPartial<WorkerListenRequest>): WorkerListenRequest;
195
- };
196
- readonly requestStream: false;
197
- readonly responseType: {
198
- encode(message: AssignedAction, writer?: _m0.Writer): _m0.Writer;
199
- decode(input: _m0.Reader | Uint8Array, length?: number): AssignedAction;
200
- fromJSON(object: any): AssignedAction;
201
- toJSON(message: AssignedAction): unknown;
202
- create(base?: DeepPartial<AssignedAction>): AssignedAction;
203
- fromPartial(object: DeepPartial<AssignedAction>): AssignedAction;
204
- };
205
- readonly responseStream: true;
206
- readonly options: {};
207
- };
208
- readonly sendActionEvent: {
209
- readonly name: "SendActionEvent";
210
- readonly requestType: {
211
- encode(message: ActionEvent, writer?: _m0.Writer): _m0.Writer;
212
- decode(input: _m0.Reader | Uint8Array, length?: number): ActionEvent;
213
- fromJSON(object: any): ActionEvent;
214
- toJSON(message: ActionEvent): unknown;
215
- create(base?: DeepPartial<ActionEvent>): ActionEvent;
216
- fromPartial(object: DeepPartial<ActionEvent>): ActionEvent;
217
- };
218
- readonly requestStream: false;
219
- readonly responseType: {
220
- encode(message: ActionEventResponse, writer?: _m0.Writer): _m0.Writer;
221
- decode(input: _m0.Reader | Uint8Array, length?: number): ActionEventResponse;
222
- fromJSON(object: any): ActionEventResponse;
223
- toJSON(message: ActionEventResponse): unknown;
224
- create(base?: DeepPartial<ActionEventResponse>): ActionEventResponse;
225
- fromPartial(object: DeepPartial<ActionEventResponse>): ActionEventResponse;
226
- };
227
- readonly responseStream: false;
228
- readonly options: {};
229
- };
230
- readonly unsubscribe: {
231
- readonly name: "Unsubscribe";
232
- readonly requestType: {
233
- encode(message: WorkerUnsubscribeRequest, writer?: _m0.Writer): _m0.Writer;
234
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerUnsubscribeRequest;
235
- fromJSON(object: any): WorkerUnsubscribeRequest;
236
- toJSON(message: WorkerUnsubscribeRequest): unknown;
237
- create(base?: DeepPartial<WorkerUnsubscribeRequest>): WorkerUnsubscribeRequest;
238
- fromPartial(object: DeepPartial<WorkerUnsubscribeRequest>): WorkerUnsubscribeRequest;
239
- };
240
- readonly requestStream: false;
241
- readonly responseType: {
242
- encode(message: WorkerUnsubscribeResponse, writer?: _m0.Writer): _m0.Writer;
243
- decode(input: _m0.Reader | Uint8Array, length?: number): WorkerUnsubscribeResponse;
244
- fromJSON(object: any): WorkerUnsubscribeResponse;
245
- toJSON(message: WorkerUnsubscribeResponse): unknown;
246
- create(base?: DeepPartial<WorkerUnsubscribeResponse>): WorkerUnsubscribeResponse;
247
- fromPartial(object: DeepPartial<WorkerUnsubscribeResponse>): WorkerUnsubscribeResponse;
248
- };
249
- readonly responseStream: false;
250
- readonly options: {};
251
- };
252
- };
253
- };
254
- export interface DispatcherServiceImplementation<CallContextExt = {}> {
255
- register(request: WorkerRegisterRequest, context: CallContext & CallContextExt): Promise<DeepPartial<WorkerRegisterResponse>>;
256
- listen(request: WorkerListenRequest, context: CallContext & CallContextExt): ServerStreamingMethodResult<DeepPartial<AssignedAction>>;
257
- sendActionEvent(request: ActionEvent, context: CallContext & CallContextExt): Promise<DeepPartial<ActionEventResponse>>;
258
- unsubscribe(request: WorkerUnsubscribeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<WorkerUnsubscribeResponse>>;
259
- }
260
- export interface DispatcherClient<CallOptionsExt = {}> {
261
- register(request: DeepPartial<WorkerRegisterRequest>, options?: CallOptions & CallOptionsExt): Promise<WorkerRegisterResponse>;
262
- listen(request: DeepPartial<WorkerListenRequest>, options?: CallOptions & CallOptionsExt): AsyncIterable<AssignedAction>;
263
- sendActionEvent(request: DeepPartial<ActionEvent>, options?: CallOptions & CallOptionsExt): Promise<ActionEventResponse>;
264
- unsubscribe(request: DeepPartial<WorkerUnsubscribeRequest>, options?: CallOptions & CallOptionsExt): Promise<WorkerUnsubscribeResponse>;
265
- }
266
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
267
- 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 {} ? {
268
- [K in keyof T]?: DeepPartial<T[K]>;
269
- } : Partial<T>;
270
- export type ServerStreamingMethodResult<Response> = {
271
- [Symbol.asyncIterator](): AsyncIterator<Response, void>;
272
- };
273
- export {};