@alienplatform/bindings 1.0.0 → 2.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.
Files changed (56) hide show
  1. package/LICENSE.md +105 -0
  2. package/README.md +59 -0
  3. package/dist/errors.d.ts +56 -0
  4. package/dist/errors.d.ts.map +1 -0
  5. package/dist/factories.d.ts +26 -0
  6. package/dist/factories.d.ts.map +1 -0
  7. package/dist/index.d.ts +19 -1768
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +23 -44772
  10. package/dist/loader.d.ts +171 -0
  11. package/dist/loader.d.ts.map +1 -0
  12. package/dist/loader.js +3712 -0
  13. package/dist/native.d.ts +41 -0
  14. package/dist/native.d.ts.map +1 -0
  15. package/dist/native.js +46 -0
  16. package/dist/types.d.ts +150 -0
  17. package/dist/types.d.ts.map +1 -0
  18. package/package.json +39 -21
  19. package/AGENTS.md +0 -70
  20. package/dist/index.js.map +0 -1
  21. package/scripts/generate-proto.sh +0 -46
  22. package/src/bindings/AGENTS.md +0 -105
  23. package/src/bindings/artifact-registry.ts +0 -314
  24. package/src/bindings/build.ts +0 -195
  25. package/src/bindings/function.ts +0 -164
  26. package/src/bindings/index.ts +0 -12
  27. package/src/bindings/kv.ts +0 -240
  28. package/src/bindings/queue.ts +0 -191
  29. package/src/bindings/service-account.ts +0 -113
  30. package/src/bindings/storage.ts +0 -535
  31. package/src/bindings/vault.ts +0 -133
  32. package/src/channel.ts +0 -94
  33. package/src/commands.ts +0 -76
  34. package/src/context.ts +0 -368
  35. package/src/errors.ts +0 -259
  36. package/src/events.ts +0 -463
  37. package/src/generated/artifact_registry.ts +0 -1934
  38. package/src/generated/build.ts +0 -1263
  39. package/src/generated/container.ts +0 -485
  40. package/src/generated/control.ts +0 -1574
  41. package/src/generated/function.ts +0 -741
  42. package/src/generated/google/protobuf/duration.ts +0 -196
  43. package/src/generated/google/protobuf/timestamp.ts +0 -225
  44. package/src/generated/kv.ts +0 -1137
  45. package/src/generated/queue.ts +0 -729
  46. package/src/generated/service_account.ts +0 -766
  47. package/src/generated/storage.ts +0 -3653
  48. package/src/generated/vault.ts +0 -519
  49. package/src/generated/wait_until.ts +0 -781
  50. package/src/global.ts +0 -316
  51. package/src/grpc-utils.ts +0 -159
  52. package/src/index.ts +0 -156
  53. package/src/types.ts +0 -384
  54. package/src/wait-until.ts +0 -257
  55. package/tsconfig.json +0 -8
  56. package/tsdown.config.ts +0 -14
@@ -1,781 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.10.1
4
- // protoc v5.29.3
5
- // source: wait_until.proto
6
-
7
- /* eslint-disable */
8
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
- import type { CallContext, CallOptions } from "nice-grpc-common";
10
- import { Duration } from "./google/protobuf/duration.js";
11
-
12
- export const protobufPackage = "alien_bindings.wait_until";
13
-
14
- /** Request to notify runtime about a new registered task. */
15
- export interface NotifyTaskRegisteredRequest {
16
- /** Unique identifier for the application instance. */
17
- applicationId: string;
18
- /** Optional task description for debugging. */
19
- taskDescription?: string | undefined;
20
- }
21
-
22
- export interface NotifyTaskRegisteredResponse {
23
- /** Success confirmation. */
24
- success: boolean;
25
- }
26
-
27
- /** Request to wait for drain signal from runtime. */
28
- export interface WaitForDrainSignalRequest {
29
- /** Unique identifier for the application instance. */
30
- applicationId: string;
31
- /** Optional timeout for how long to wait for drain signal. */
32
- timeout: Duration | undefined;
33
- }
34
-
35
- export interface WaitForDrainSignalResponse {
36
- /** Whether a drain was requested. */
37
- shouldDrain: boolean;
38
- /** Optional timeout for how long the application has to drain. */
39
- drainTimeout:
40
- | Duration
41
- | undefined;
42
- /** Reason for the drain request (e.g., "lambda_invoke_end", "sigterm"). */
43
- drainReason: string;
44
- }
45
-
46
- /** Request to notify that draining is complete. */
47
- export interface NotifyDrainCompleteRequest {
48
- /** Unique identifier for the application instance. */
49
- applicationId: string;
50
- /** Number of tasks that were drained. */
51
- tasksDrained: number;
52
- /** Whether all tasks completed successfully. */
53
- success: boolean;
54
- /** Optional error message if draining failed. */
55
- errorMessage?: string | undefined;
56
- }
57
-
58
- export interface NotifyDrainCompleteResponse {
59
- /** Acknowledgment from runtime. */
60
- acknowledged: boolean;
61
- }
62
-
63
- /** Request to get current task count. */
64
- export interface GetTaskCountRequest {
65
- /** Unique identifier for the application instance. */
66
- applicationId: string;
67
- }
68
-
69
- export interface GetTaskCountResponse {
70
- /** Number of currently registered tasks. */
71
- taskCount: number;
72
- }
73
-
74
- function createBaseNotifyTaskRegisteredRequest(): NotifyTaskRegisteredRequest {
75
- return { applicationId: "", taskDescription: undefined };
76
- }
77
-
78
- export const NotifyTaskRegisteredRequest: MessageFns<NotifyTaskRegisteredRequest> = {
79
- encode(message: NotifyTaskRegisteredRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
80
- if (message.applicationId !== "") {
81
- writer.uint32(10).string(message.applicationId);
82
- }
83
- if (message.taskDescription !== undefined) {
84
- writer.uint32(18).string(message.taskDescription);
85
- }
86
- return writer;
87
- },
88
-
89
- decode(input: BinaryReader | Uint8Array, length?: number): NotifyTaskRegisteredRequest {
90
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
91
- const end = length === undefined ? reader.len : reader.pos + length;
92
- const message = createBaseNotifyTaskRegisteredRequest();
93
- while (reader.pos < end) {
94
- const tag = reader.uint32();
95
- switch (tag >>> 3) {
96
- case 1: {
97
- if (tag !== 10) {
98
- break;
99
- }
100
-
101
- message.applicationId = reader.string();
102
- continue;
103
- }
104
- case 2: {
105
- if (tag !== 18) {
106
- break;
107
- }
108
-
109
- message.taskDescription = reader.string();
110
- continue;
111
- }
112
- }
113
- if ((tag & 7) === 4 || tag === 0) {
114
- break;
115
- }
116
- reader.skip(tag & 7);
117
- }
118
- return message;
119
- },
120
-
121
- fromJSON(object: any): NotifyTaskRegisteredRequest {
122
- return {
123
- applicationId: isSet(object.applicationId) ? globalThis.String(object.applicationId) : "",
124
- taskDescription: isSet(object.taskDescription) ? globalThis.String(object.taskDescription) : undefined,
125
- };
126
- },
127
-
128
- toJSON(message: NotifyTaskRegisteredRequest): unknown {
129
- const obj: any = {};
130
- if (message.applicationId !== "") {
131
- obj.applicationId = message.applicationId;
132
- }
133
- if (message.taskDescription !== undefined) {
134
- obj.taskDescription = message.taskDescription;
135
- }
136
- return obj;
137
- },
138
-
139
- create(base?: DeepPartial<NotifyTaskRegisteredRequest>): NotifyTaskRegisteredRequest {
140
- return NotifyTaskRegisteredRequest.fromPartial(base ?? {});
141
- },
142
- fromPartial(object: DeepPartial<NotifyTaskRegisteredRequest>): NotifyTaskRegisteredRequest {
143
- const message = createBaseNotifyTaskRegisteredRequest();
144
- message.applicationId = object.applicationId ?? "";
145
- message.taskDescription = object.taskDescription ?? undefined;
146
- return message;
147
- },
148
- };
149
-
150
- function createBaseNotifyTaskRegisteredResponse(): NotifyTaskRegisteredResponse {
151
- return { success: false };
152
- }
153
-
154
- export const NotifyTaskRegisteredResponse: MessageFns<NotifyTaskRegisteredResponse> = {
155
- encode(message: NotifyTaskRegisteredResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
156
- if (message.success !== false) {
157
- writer.uint32(8).bool(message.success);
158
- }
159
- return writer;
160
- },
161
-
162
- decode(input: BinaryReader | Uint8Array, length?: number): NotifyTaskRegisteredResponse {
163
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
164
- const end = length === undefined ? reader.len : reader.pos + length;
165
- const message = createBaseNotifyTaskRegisteredResponse();
166
- while (reader.pos < end) {
167
- const tag = reader.uint32();
168
- switch (tag >>> 3) {
169
- case 1: {
170
- if (tag !== 8) {
171
- break;
172
- }
173
-
174
- message.success = reader.bool();
175
- continue;
176
- }
177
- }
178
- if ((tag & 7) === 4 || tag === 0) {
179
- break;
180
- }
181
- reader.skip(tag & 7);
182
- }
183
- return message;
184
- },
185
-
186
- fromJSON(object: any): NotifyTaskRegisteredResponse {
187
- return { success: isSet(object.success) ? globalThis.Boolean(object.success) : false };
188
- },
189
-
190
- toJSON(message: NotifyTaskRegisteredResponse): unknown {
191
- const obj: any = {};
192
- if (message.success !== false) {
193
- obj.success = message.success;
194
- }
195
- return obj;
196
- },
197
-
198
- create(base?: DeepPartial<NotifyTaskRegisteredResponse>): NotifyTaskRegisteredResponse {
199
- return NotifyTaskRegisteredResponse.fromPartial(base ?? {});
200
- },
201
- fromPartial(object: DeepPartial<NotifyTaskRegisteredResponse>): NotifyTaskRegisteredResponse {
202
- const message = createBaseNotifyTaskRegisteredResponse();
203
- message.success = object.success ?? false;
204
- return message;
205
- },
206
- };
207
-
208
- function createBaseWaitForDrainSignalRequest(): WaitForDrainSignalRequest {
209
- return { applicationId: "", timeout: undefined };
210
- }
211
-
212
- export const WaitForDrainSignalRequest: MessageFns<WaitForDrainSignalRequest> = {
213
- encode(message: WaitForDrainSignalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
214
- if (message.applicationId !== "") {
215
- writer.uint32(10).string(message.applicationId);
216
- }
217
- if (message.timeout !== undefined) {
218
- Duration.encode(message.timeout, writer.uint32(18).fork()).join();
219
- }
220
- return writer;
221
- },
222
-
223
- decode(input: BinaryReader | Uint8Array, length?: number): WaitForDrainSignalRequest {
224
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
225
- const end = length === undefined ? reader.len : reader.pos + length;
226
- const message = createBaseWaitForDrainSignalRequest();
227
- while (reader.pos < end) {
228
- const tag = reader.uint32();
229
- switch (tag >>> 3) {
230
- case 1: {
231
- if (tag !== 10) {
232
- break;
233
- }
234
-
235
- message.applicationId = reader.string();
236
- continue;
237
- }
238
- case 2: {
239
- if (tag !== 18) {
240
- break;
241
- }
242
-
243
- message.timeout = Duration.decode(reader, reader.uint32());
244
- continue;
245
- }
246
- }
247
- if ((tag & 7) === 4 || tag === 0) {
248
- break;
249
- }
250
- reader.skip(tag & 7);
251
- }
252
- return message;
253
- },
254
-
255
- fromJSON(object: any): WaitForDrainSignalRequest {
256
- return {
257
- applicationId: isSet(object.applicationId) ? globalThis.String(object.applicationId) : "",
258
- timeout: isSet(object.timeout) ? Duration.fromJSON(object.timeout) : undefined,
259
- };
260
- },
261
-
262
- toJSON(message: WaitForDrainSignalRequest): unknown {
263
- const obj: any = {};
264
- if (message.applicationId !== "") {
265
- obj.applicationId = message.applicationId;
266
- }
267
- if (message.timeout !== undefined) {
268
- obj.timeout = Duration.toJSON(message.timeout);
269
- }
270
- return obj;
271
- },
272
-
273
- create(base?: DeepPartial<WaitForDrainSignalRequest>): WaitForDrainSignalRequest {
274
- return WaitForDrainSignalRequest.fromPartial(base ?? {});
275
- },
276
- fromPartial(object: DeepPartial<WaitForDrainSignalRequest>): WaitForDrainSignalRequest {
277
- const message = createBaseWaitForDrainSignalRequest();
278
- message.applicationId = object.applicationId ?? "";
279
- message.timeout = (object.timeout !== undefined && object.timeout !== null)
280
- ? Duration.fromPartial(object.timeout)
281
- : undefined;
282
- return message;
283
- },
284
- };
285
-
286
- function createBaseWaitForDrainSignalResponse(): WaitForDrainSignalResponse {
287
- return { shouldDrain: false, drainTimeout: undefined, drainReason: "" };
288
- }
289
-
290
- export const WaitForDrainSignalResponse: MessageFns<WaitForDrainSignalResponse> = {
291
- encode(message: WaitForDrainSignalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
292
- if (message.shouldDrain !== false) {
293
- writer.uint32(8).bool(message.shouldDrain);
294
- }
295
- if (message.drainTimeout !== undefined) {
296
- Duration.encode(message.drainTimeout, writer.uint32(18).fork()).join();
297
- }
298
- if (message.drainReason !== "") {
299
- writer.uint32(26).string(message.drainReason);
300
- }
301
- return writer;
302
- },
303
-
304
- decode(input: BinaryReader | Uint8Array, length?: number): WaitForDrainSignalResponse {
305
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
306
- const end = length === undefined ? reader.len : reader.pos + length;
307
- const message = createBaseWaitForDrainSignalResponse();
308
- while (reader.pos < end) {
309
- const tag = reader.uint32();
310
- switch (tag >>> 3) {
311
- case 1: {
312
- if (tag !== 8) {
313
- break;
314
- }
315
-
316
- message.shouldDrain = reader.bool();
317
- continue;
318
- }
319
- case 2: {
320
- if (tag !== 18) {
321
- break;
322
- }
323
-
324
- message.drainTimeout = Duration.decode(reader, reader.uint32());
325
- continue;
326
- }
327
- case 3: {
328
- if (tag !== 26) {
329
- break;
330
- }
331
-
332
- message.drainReason = reader.string();
333
- continue;
334
- }
335
- }
336
- if ((tag & 7) === 4 || tag === 0) {
337
- break;
338
- }
339
- reader.skip(tag & 7);
340
- }
341
- return message;
342
- },
343
-
344
- fromJSON(object: any): WaitForDrainSignalResponse {
345
- return {
346
- shouldDrain: isSet(object.shouldDrain) ? globalThis.Boolean(object.shouldDrain) : false,
347
- drainTimeout: isSet(object.drainTimeout) ? Duration.fromJSON(object.drainTimeout) : undefined,
348
- drainReason: isSet(object.drainReason) ? globalThis.String(object.drainReason) : "",
349
- };
350
- },
351
-
352
- toJSON(message: WaitForDrainSignalResponse): unknown {
353
- const obj: any = {};
354
- if (message.shouldDrain !== false) {
355
- obj.shouldDrain = message.shouldDrain;
356
- }
357
- if (message.drainTimeout !== undefined) {
358
- obj.drainTimeout = Duration.toJSON(message.drainTimeout);
359
- }
360
- if (message.drainReason !== "") {
361
- obj.drainReason = message.drainReason;
362
- }
363
- return obj;
364
- },
365
-
366
- create(base?: DeepPartial<WaitForDrainSignalResponse>): WaitForDrainSignalResponse {
367
- return WaitForDrainSignalResponse.fromPartial(base ?? {});
368
- },
369
- fromPartial(object: DeepPartial<WaitForDrainSignalResponse>): WaitForDrainSignalResponse {
370
- const message = createBaseWaitForDrainSignalResponse();
371
- message.shouldDrain = object.shouldDrain ?? false;
372
- message.drainTimeout = (object.drainTimeout !== undefined && object.drainTimeout !== null)
373
- ? Duration.fromPartial(object.drainTimeout)
374
- : undefined;
375
- message.drainReason = object.drainReason ?? "";
376
- return message;
377
- },
378
- };
379
-
380
- function createBaseNotifyDrainCompleteRequest(): NotifyDrainCompleteRequest {
381
- return { applicationId: "", tasksDrained: 0, success: false, errorMessage: undefined };
382
- }
383
-
384
- export const NotifyDrainCompleteRequest: MessageFns<NotifyDrainCompleteRequest> = {
385
- encode(message: NotifyDrainCompleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
386
- if (message.applicationId !== "") {
387
- writer.uint32(10).string(message.applicationId);
388
- }
389
- if (message.tasksDrained !== 0) {
390
- writer.uint32(16).uint32(message.tasksDrained);
391
- }
392
- if (message.success !== false) {
393
- writer.uint32(24).bool(message.success);
394
- }
395
- if (message.errorMessage !== undefined) {
396
- writer.uint32(34).string(message.errorMessage);
397
- }
398
- return writer;
399
- },
400
-
401
- decode(input: BinaryReader | Uint8Array, length?: number): NotifyDrainCompleteRequest {
402
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
403
- const end = length === undefined ? reader.len : reader.pos + length;
404
- const message = createBaseNotifyDrainCompleteRequest();
405
- while (reader.pos < end) {
406
- const tag = reader.uint32();
407
- switch (tag >>> 3) {
408
- case 1: {
409
- if (tag !== 10) {
410
- break;
411
- }
412
-
413
- message.applicationId = reader.string();
414
- continue;
415
- }
416
- case 2: {
417
- if (tag !== 16) {
418
- break;
419
- }
420
-
421
- message.tasksDrained = reader.uint32();
422
- continue;
423
- }
424
- case 3: {
425
- if (tag !== 24) {
426
- break;
427
- }
428
-
429
- message.success = reader.bool();
430
- continue;
431
- }
432
- case 4: {
433
- if (tag !== 34) {
434
- break;
435
- }
436
-
437
- message.errorMessage = reader.string();
438
- continue;
439
- }
440
- }
441
- if ((tag & 7) === 4 || tag === 0) {
442
- break;
443
- }
444
- reader.skip(tag & 7);
445
- }
446
- return message;
447
- },
448
-
449
- fromJSON(object: any): NotifyDrainCompleteRequest {
450
- return {
451
- applicationId: isSet(object.applicationId) ? globalThis.String(object.applicationId) : "",
452
- tasksDrained: isSet(object.tasksDrained) ? globalThis.Number(object.tasksDrained) : 0,
453
- success: isSet(object.success) ? globalThis.Boolean(object.success) : false,
454
- errorMessage: isSet(object.errorMessage) ? globalThis.String(object.errorMessage) : undefined,
455
- };
456
- },
457
-
458
- toJSON(message: NotifyDrainCompleteRequest): unknown {
459
- const obj: any = {};
460
- if (message.applicationId !== "") {
461
- obj.applicationId = message.applicationId;
462
- }
463
- if (message.tasksDrained !== 0) {
464
- obj.tasksDrained = Math.round(message.tasksDrained);
465
- }
466
- if (message.success !== false) {
467
- obj.success = message.success;
468
- }
469
- if (message.errorMessage !== undefined) {
470
- obj.errorMessage = message.errorMessage;
471
- }
472
- return obj;
473
- },
474
-
475
- create(base?: DeepPartial<NotifyDrainCompleteRequest>): NotifyDrainCompleteRequest {
476
- return NotifyDrainCompleteRequest.fromPartial(base ?? {});
477
- },
478
- fromPartial(object: DeepPartial<NotifyDrainCompleteRequest>): NotifyDrainCompleteRequest {
479
- const message = createBaseNotifyDrainCompleteRequest();
480
- message.applicationId = object.applicationId ?? "";
481
- message.tasksDrained = object.tasksDrained ?? 0;
482
- message.success = object.success ?? false;
483
- message.errorMessage = object.errorMessage ?? undefined;
484
- return message;
485
- },
486
- };
487
-
488
- function createBaseNotifyDrainCompleteResponse(): NotifyDrainCompleteResponse {
489
- return { acknowledged: false };
490
- }
491
-
492
- export const NotifyDrainCompleteResponse: MessageFns<NotifyDrainCompleteResponse> = {
493
- encode(message: NotifyDrainCompleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
494
- if (message.acknowledged !== false) {
495
- writer.uint32(8).bool(message.acknowledged);
496
- }
497
- return writer;
498
- },
499
-
500
- decode(input: BinaryReader | Uint8Array, length?: number): NotifyDrainCompleteResponse {
501
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
502
- const end = length === undefined ? reader.len : reader.pos + length;
503
- const message = createBaseNotifyDrainCompleteResponse();
504
- while (reader.pos < end) {
505
- const tag = reader.uint32();
506
- switch (tag >>> 3) {
507
- case 1: {
508
- if (tag !== 8) {
509
- break;
510
- }
511
-
512
- message.acknowledged = reader.bool();
513
- continue;
514
- }
515
- }
516
- if ((tag & 7) === 4 || tag === 0) {
517
- break;
518
- }
519
- reader.skip(tag & 7);
520
- }
521
- return message;
522
- },
523
-
524
- fromJSON(object: any): NotifyDrainCompleteResponse {
525
- return { acknowledged: isSet(object.acknowledged) ? globalThis.Boolean(object.acknowledged) : false };
526
- },
527
-
528
- toJSON(message: NotifyDrainCompleteResponse): unknown {
529
- const obj: any = {};
530
- if (message.acknowledged !== false) {
531
- obj.acknowledged = message.acknowledged;
532
- }
533
- return obj;
534
- },
535
-
536
- create(base?: DeepPartial<NotifyDrainCompleteResponse>): NotifyDrainCompleteResponse {
537
- return NotifyDrainCompleteResponse.fromPartial(base ?? {});
538
- },
539
- fromPartial(object: DeepPartial<NotifyDrainCompleteResponse>): NotifyDrainCompleteResponse {
540
- const message = createBaseNotifyDrainCompleteResponse();
541
- message.acknowledged = object.acknowledged ?? false;
542
- return message;
543
- },
544
- };
545
-
546
- function createBaseGetTaskCountRequest(): GetTaskCountRequest {
547
- return { applicationId: "" };
548
- }
549
-
550
- export const GetTaskCountRequest: MessageFns<GetTaskCountRequest> = {
551
- encode(message: GetTaskCountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
552
- if (message.applicationId !== "") {
553
- writer.uint32(10).string(message.applicationId);
554
- }
555
- return writer;
556
- },
557
-
558
- decode(input: BinaryReader | Uint8Array, length?: number): GetTaskCountRequest {
559
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
560
- const end = length === undefined ? reader.len : reader.pos + length;
561
- const message = createBaseGetTaskCountRequest();
562
- while (reader.pos < end) {
563
- const tag = reader.uint32();
564
- switch (tag >>> 3) {
565
- case 1: {
566
- if (tag !== 10) {
567
- break;
568
- }
569
-
570
- message.applicationId = reader.string();
571
- continue;
572
- }
573
- }
574
- if ((tag & 7) === 4 || tag === 0) {
575
- break;
576
- }
577
- reader.skip(tag & 7);
578
- }
579
- return message;
580
- },
581
-
582
- fromJSON(object: any): GetTaskCountRequest {
583
- return { applicationId: isSet(object.applicationId) ? globalThis.String(object.applicationId) : "" };
584
- },
585
-
586
- toJSON(message: GetTaskCountRequest): unknown {
587
- const obj: any = {};
588
- if (message.applicationId !== "") {
589
- obj.applicationId = message.applicationId;
590
- }
591
- return obj;
592
- },
593
-
594
- create(base?: DeepPartial<GetTaskCountRequest>): GetTaskCountRequest {
595
- return GetTaskCountRequest.fromPartial(base ?? {});
596
- },
597
- fromPartial(object: DeepPartial<GetTaskCountRequest>): GetTaskCountRequest {
598
- const message = createBaseGetTaskCountRequest();
599
- message.applicationId = object.applicationId ?? "";
600
- return message;
601
- },
602
- };
603
-
604
- function createBaseGetTaskCountResponse(): GetTaskCountResponse {
605
- return { taskCount: 0 };
606
- }
607
-
608
- export const GetTaskCountResponse: MessageFns<GetTaskCountResponse> = {
609
- encode(message: GetTaskCountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
610
- if (message.taskCount !== 0) {
611
- writer.uint32(8).uint32(message.taskCount);
612
- }
613
- return writer;
614
- },
615
-
616
- decode(input: BinaryReader | Uint8Array, length?: number): GetTaskCountResponse {
617
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
618
- const end = length === undefined ? reader.len : reader.pos + length;
619
- const message = createBaseGetTaskCountResponse();
620
- while (reader.pos < end) {
621
- const tag = reader.uint32();
622
- switch (tag >>> 3) {
623
- case 1: {
624
- if (tag !== 8) {
625
- break;
626
- }
627
-
628
- message.taskCount = reader.uint32();
629
- continue;
630
- }
631
- }
632
- if ((tag & 7) === 4 || tag === 0) {
633
- break;
634
- }
635
- reader.skip(tag & 7);
636
- }
637
- return message;
638
- },
639
-
640
- fromJSON(object: any): GetTaskCountResponse {
641
- return { taskCount: isSet(object.taskCount) ? globalThis.Number(object.taskCount) : 0 };
642
- },
643
-
644
- toJSON(message: GetTaskCountResponse): unknown {
645
- const obj: any = {};
646
- if (message.taskCount !== 0) {
647
- obj.taskCount = Math.round(message.taskCount);
648
- }
649
- return obj;
650
- },
651
-
652
- create(base?: DeepPartial<GetTaskCountResponse>): GetTaskCountResponse {
653
- return GetTaskCountResponse.fromPartial(base ?? {});
654
- },
655
- fromPartial(object: DeepPartial<GetTaskCountResponse>): GetTaskCountResponse {
656
- const message = createBaseGetTaskCountResponse();
657
- message.taskCount = object.taskCount ?? 0;
658
- return message;
659
- },
660
- };
661
-
662
- /** Service for coordinating wait_until tasks between application and runtime. */
663
- export type WaitUntilServiceDefinition = typeof WaitUntilServiceDefinition;
664
- export const WaitUntilServiceDefinition = {
665
- name: "WaitUntilService",
666
- fullName: "alien_bindings.wait_until.WaitUntilService",
667
- methods: {
668
- /** Application notifies runtime that it has registered a new task. */
669
- notifyTaskRegistered: {
670
- name: "NotifyTaskRegistered",
671
- requestType: NotifyTaskRegisteredRequest,
672
- requestStream: false,
673
- responseType: NotifyTaskRegisteredResponse,
674
- responseStream: false,
675
- options: {},
676
- },
677
- /**
678
- * Application calls this to wait for a drain signal from runtime.
679
- * This is a blocking call that returns when runtime decides it's time to drain.
680
- */
681
- waitForDrainSignal: {
682
- name: "WaitForDrainSignal",
683
- requestType: WaitForDrainSignalRequest,
684
- requestStream: false,
685
- responseType: WaitForDrainSignalResponse,
686
- responseStream: false,
687
- options: {},
688
- },
689
- /** Application notifies runtime that it has completed draining all tasks. */
690
- notifyDrainComplete: {
691
- name: "NotifyDrainComplete",
692
- requestType: NotifyDrainCompleteRequest,
693
- requestStream: false,
694
- responseType: NotifyDrainCompleteResponse,
695
- responseStream: false,
696
- options: {},
697
- },
698
- /** Runtime can query how many tasks are currently registered (for monitoring). */
699
- getTaskCount: {
700
- name: "GetTaskCount",
701
- requestType: GetTaskCountRequest,
702
- requestStream: false,
703
- responseType: GetTaskCountResponse,
704
- responseStream: false,
705
- options: {},
706
- },
707
- },
708
- } as const;
709
-
710
- export interface WaitUntilServiceImplementation<CallContextExt = {}> {
711
- /** Application notifies runtime that it has registered a new task. */
712
- notifyTaskRegistered(
713
- request: NotifyTaskRegisteredRequest,
714
- context: CallContext & CallContextExt,
715
- ): Promise<DeepPartial<NotifyTaskRegisteredResponse>>;
716
- /**
717
- * Application calls this to wait for a drain signal from runtime.
718
- * This is a blocking call that returns when runtime decides it's time to drain.
719
- */
720
- waitForDrainSignal(
721
- request: WaitForDrainSignalRequest,
722
- context: CallContext & CallContextExt,
723
- ): Promise<DeepPartial<WaitForDrainSignalResponse>>;
724
- /** Application notifies runtime that it has completed draining all tasks. */
725
- notifyDrainComplete(
726
- request: NotifyDrainCompleteRequest,
727
- context: CallContext & CallContextExt,
728
- ): Promise<DeepPartial<NotifyDrainCompleteResponse>>;
729
- /** Runtime can query how many tasks are currently registered (for monitoring). */
730
- getTaskCount(
731
- request: GetTaskCountRequest,
732
- context: CallContext & CallContextExt,
733
- ): Promise<DeepPartial<GetTaskCountResponse>>;
734
- }
735
-
736
- export interface WaitUntilServiceClient<CallOptionsExt = {}> {
737
- /** Application notifies runtime that it has registered a new task. */
738
- notifyTaskRegistered(
739
- request: DeepPartial<NotifyTaskRegisteredRequest>,
740
- options?: CallOptions & CallOptionsExt,
741
- ): Promise<NotifyTaskRegisteredResponse>;
742
- /**
743
- * Application calls this to wait for a drain signal from runtime.
744
- * This is a blocking call that returns when runtime decides it's time to drain.
745
- */
746
- waitForDrainSignal(
747
- request: DeepPartial<WaitForDrainSignalRequest>,
748
- options?: CallOptions & CallOptionsExt,
749
- ): Promise<WaitForDrainSignalResponse>;
750
- /** Application notifies runtime that it has completed draining all tasks. */
751
- notifyDrainComplete(
752
- request: DeepPartial<NotifyDrainCompleteRequest>,
753
- options?: CallOptions & CallOptionsExt,
754
- ): Promise<NotifyDrainCompleteResponse>;
755
- /** Runtime can query how many tasks are currently registered (for monitoring). */
756
- getTaskCount(
757
- request: DeepPartial<GetTaskCountRequest>,
758
- options?: CallOptions & CallOptionsExt,
759
- ): Promise<GetTaskCountResponse>;
760
- }
761
-
762
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
763
-
764
- export type DeepPartial<T> = T extends Builtin ? T
765
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
766
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
767
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
768
- : Partial<T>;
769
-
770
- function isSet(value: any): boolean {
771
- return value !== null && value !== undefined;
772
- }
773
-
774
- export interface MessageFns<T> {
775
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
776
- decode(input: BinaryReader | Uint8Array, length?: number): T;
777
- fromJSON(object: any): T;
778
- toJSON(message: T): unknown;
779
- create(base?: DeepPartial<T>): T;
780
- fromPartial(object: DeepPartial<T>): T;
781
- }