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