@alienplatform/bindings 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/AGENTS.md +70 -0
  2. package/dist/index.d.ts +1770 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +44772 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +56 -0
  7. package/scripts/generate-proto.sh +46 -0
  8. package/src/bindings/AGENTS.md +105 -0
  9. package/src/bindings/artifact-registry.ts +314 -0
  10. package/src/bindings/build.ts +195 -0
  11. package/src/bindings/function.ts +164 -0
  12. package/src/bindings/index.ts +12 -0
  13. package/src/bindings/kv.ts +240 -0
  14. package/src/bindings/queue.ts +191 -0
  15. package/src/bindings/service-account.ts +113 -0
  16. package/src/bindings/storage.ts +535 -0
  17. package/src/bindings/vault.ts +133 -0
  18. package/src/channel.ts +94 -0
  19. package/src/commands.ts +76 -0
  20. package/src/context.ts +368 -0
  21. package/src/errors.ts +259 -0
  22. package/src/events.ts +463 -0
  23. package/src/generated/artifact_registry.ts +1934 -0
  24. package/src/generated/build.ts +1263 -0
  25. package/src/generated/container.ts +485 -0
  26. package/src/generated/control.ts +1574 -0
  27. package/src/generated/function.ts +741 -0
  28. package/src/generated/google/protobuf/duration.ts +196 -0
  29. package/src/generated/google/protobuf/timestamp.ts +225 -0
  30. package/src/generated/kv.ts +1137 -0
  31. package/src/generated/queue.ts +729 -0
  32. package/src/generated/service_account.ts +766 -0
  33. package/src/generated/storage.ts +3653 -0
  34. package/src/generated/vault.ts +519 -0
  35. package/src/generated/wait_until.ts +781 -0
  36. package/src/global.ts +316 -0
  37. package/src/grpc-utils.ts +159 -0
  38. package/src/index.ts +156 -0
  39. package/src/types.ts +384 -0
  40. package/src/wait-until.ts +257 -0
  41. package/tsconfig.json +8 -0
  42. package/tsdown.config.ts +14 -0
@@ -0,0 +1,741 @@
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: function.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { CallContext, CallOptions } from "nice-grpc-common";
10
+
11
+ export const protobufPackage = "alien_bindings.function";
12
+
13
+ /** Messages for Invoke */
14
+ export interface InvokeRequest {
15
+ /** Name of the Function binding to use */
16
+ bindingName: string;
17
+ /** Target function identifier (name, ARN, URL, etc.) */
18
+ targetFunction: string;
19
+ /** HTTP method */
20
+ method: string;
21
+ /** Request path */
22
+ path: string;
23
+ /** HTTP headers */
24
+ headers: { [key: string]: string };
25
+ /** Request body bytes */
26
+ body: Uint8Array;
27
+ /** Optional timeout for the invocation in seconds */
28
+ timeoutSeconds?: number | undefined;
29
+ }
30
+
31
+ export interface InvokeRequest_HeadersEntry {
32
+ key: string;
33
+ value: string;
34
+ }
35
+
36
+ export interface InvokeResponse {
37
+ /** HTTP status code */
38
+ status: number;
39
+ /** HTTP response headers */
40
+ headers: { [key: string]: string };
41
+ /** Response body bytes */
42
+ body: Uint8Array;
43
+ }
44
+
45
+ export interface InvokeResponse_HeadersEntry {
46
+ key: string;
47
+ value: string;
48
+ }
49
+
50
+ /** Messages for GetFunctionUrl */
51
+ export interface GetFunctionUrlRequest {
52
+ /** Name of the Function binding to use */
53
+ bindingName: string;
54
+ }
55
+
56
+ export interface GetFunctionUrlResponse {
57
+ /** The public URL if available */
58
+ url?: string | undefined;
59
+ }
60
+
61
+ function createBaseInvokeRequest(): InvokeRequest {
62
+ return {
63
+ bindingName: "",
64
+ targetFunction: "",
65
+ method: "",
66
+ path: "",
67
+ headers: {},
68
+ body: new Uint8Array(0),
69
+ timeoutSeconds: undefined,
70
+ };
71
+ }
72
+
73
+ export const InvokeRequest: MessageFns<InvokeRequest> = {
74
+ encode(message: InvokeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
75
+ if (message.bindingName !== "") {
76
+ writer.uint32(10).string(message.bindingName);
77
+ }
78
+ if (message.targetFunction !== "") {
79
+ writer.uint32(18).string(message.targetFunction);
80
+ }
81
+ if (message.method !== "") {
82
+ writer.uint32(26).string(message.method);
83
+ }
84
+ if (message.path !== "") {
85
+ writer.uint32(34).string(message.path);
86
+ }
87
+ globalThis.Object.entries(message.headers).forEach(([key, value]: [string, string]) => {
88
+ InvokeRequest_HeadersEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).join();
89
+ });
90
+ if (message.body.length !== 0) {
91
+ writer.uint32(50).bytes(message.body);
92
+ }
93
+ if (message.timeoutSeconds !== undefined) {
94
+ writer.uint32(56).uint64(message.timeoutSeconds);
95
+ }
96
+ return writer;
97
+ },
98
+
99
+ decode(input: BinaryReader | Uint8Array, length?: number): InvokeRequest {
100
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
101
+ const end = length === undefined ? reader.len : reader.pos + length;
102
+ const message = createBaseInvokeRequest();
103
+ while (reader.pos < end) {
104
+ const tag = reader.uint32();
105
+ switch (tag >>> 3) {
106
+ case 1: {
107
+ if (tag !== 10) {
108
+ break;
109
+ }
110
+
111
+ message.bindingName = reader.string();
112
+ continue;
113
+ }
114
+ case 2: {
115
+ if (tag !== 18) {
116
+ break;
117
+ }
118
+
119
+ message.targetFunction = reader.string();
120
+ continue;
121
+ }
122
+ case 3: {
123
+ if (tag !== 26) {
124
+ break;
125
+ }
126
+
127
+ message.method = reader.string();
128
+ continue;
129
+ }
130
+ case 4: {
131
+ if (tag !== 34) {
132
+ break;
133
+ }
134
+
135
+ message.path = reader.string();
136
+ continue;
137
+ }
138
+ case 5: {
139
+ if (tag !== 42) {
140
+ break;
141
+ }
142
+
143
+ const entry5 = InvokeRequest_HeadersEntry.decode(reader, reader.uint32());
144
+ if (entry5.value !== undefined) {
145
+ message.headers[entry5.key] = entry5.value;
146
+ }
147
+ continue;
148
+ }
149
+ case 6: {
150
+ if (tag !== 50) {
151
+ break;
152
+ }
153
+
154
+ message.body = reader.bytes();
155
+ continue;
156
+ }
157
+ case 7: {
158
+ if (tag !== 56) {
159
+ break;
160
+ }
161
+
162
+ message.timeoutSeconds = longToNumber(reader.uint64());
163
+ continue;
164
+ }
165
+ }
166
+ if ((tag & 7) === 4 || tag === 0) {
167
+ break;
168
+ }
169
+ reader.skip(tag & 7);
170
+ }
171
+ return message;
172
+ },
173
+
174
+ fromJSON(object: any): InvokeRequest {
175
+ return {
176
+ bindingName: isSet(object.bindingName) ? globalThis.String(object.bindingName) : "",
177
+ targetFunction: isSet(object.targetFunction) ? globalThis.String(object.targetFunction) : "",
178
+ method: isSet(object.method) ? globalThis.String(object.method) : "",
179
+ path: isSet(object.path) ? globalThis.String(object.path) : "",
180
+ headers: isObject(object.headers)
181
+ ? (globalThis.Object.entries(object.headers) as [string, any][]).reduce(
182
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
183
+ acc[key] = globalThis.String(value);
184
+ return acc;
185
+ },
186
+ {},
187
+ )
188
+ : {},
189
+ body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array(0),
190
+ timeoutSeconds: isSet(object.timeoutSeconds) ? globalThis.Number(object.timeoutSeconds) : undefined,
191
+ };
192
+ },
193
+
194
+ toJSON(message: InvokeRequest): unknown {
195
+ const obj: any = {};
196
+ if (message.bindingName !== "") {
197
+ obj.bindingName = message.bindingName;
198
+ }
199
+ if (message.targetFunction !== "") {
200
+ obj.targetFunction = message.targetFunction;
201
+ }
202
+ if (message.method !== "") {
203
+ obj.method = message.method;
204
+ }
205
+ if (message.path !== "") {
206
+ obj.path = message.path;
207
+ }
208
+ if (message.headers) {
209
+ const entries = globalThis.Object.entries(message.headers) as [string, string][];
210
+ if (entries.length > 0) {
211
+ obj.headers = {};
212
+ entries.forEach(([k, v]) => {
213
+ obj.headers[k] = v;
214
+ });
215
+ }
216
+ }
217
+ if (message.body.length !== 0) {
218
+ obj.body = base64FromBytes(message.body);
219
+ }
220
+ if (message.timeoutSeconds !== undefined) {
221
+ obj.timeoutSeconds = Math.round(message.timeoutSeconds);
222
+ }
223
+ return obj;
224
+ },
225
+
226
+ create(base?: DeepPartial<InvokeRequest>): InvokeRequest {
227
+ return InvokeRequest.fromPartial(base ?? {});
228
+ },
229
+ fromPartial(object: DeepPartial<InvokeRequest>): InvokeRequest {
230
+ const message = createBaseInvokeRequest();
231
+ message.bindingName = object.bindingName ?? "";
232
+ message.targetFunction = object.targetFunction ?? "";
233
+ message.method = object.method ?? "";
234
+ message.path = object.path ?? "";
235
+ message.headers = (globalThis.Object.entries(object.headers ?? {}) as [string, string][]).reduce(
236
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
237
+ if (value !== undefined) {
238
+ acc[key] = globalThis.String(value);
239
+ }
240
+ return acc;
241
+ },
242
+ {},
243
+ );
244
+ message.body = object.body ?? new Uint8Array(0);
245
+ message.timeoutSeconds = object.timeoutSeconds ?? undefined;
246
+ return message;
247
+ },
248
+ };
249
+
250
+ function createBaseInvokeRequest_HeadersEntry(): InvokeRequest_HeadersEntry {
251
+ return { key: "", value: "" };
252
+ }
253
+
254
+ export const InvokeRequest_HeadersEntry: MessageFns<InvokeRequest_HeadersEntry> = {
255
+ encode(message: InvokeRequest_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
256
+ if (message.key !== "") {
257
+ writer.uint32(10).string(message.key);
258
+ }
259
+ if (message.value !== "") {
260
+ writer.uint32(18).string(message.value);
261
+ }
262
+ return writer;
263
+ },
264
+
265
+ decode(input: BinaryReader | Uint8Array, length?: number): InvokeRequest_HeadersEntry {
266
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
267
+ const end = length === undefined ? reader.len : reader.pos + length;
268
+ const message = createBaseInvokeRequest_HeadersEntry();
269
+ while (reader.pos < end) {
270
+ const tag = reader.uint32();
271
+ switch (tag >>> 3) {
272
+ case 1: {
273
+ if (tag !== 10) {
274
+ break;
275
+ }
276
+
277
+ message.key = reader.string();
278
+ continue;
279
+ }
280
+ case 2: {
281
+ if (tag !== 18) {
282
+ break;
283
+ }
284
+
285
+ message.value = reader.string();
286
+ continue;
287
+ }
288
+ }
289
+ if ((tag & 7) === 4 || tag === 0) {
290
+ break;
291
+ }
292
+ reader.skip(tag & 7);
293
+ }
294
+ return message;
295
+ },
296
+
297
+ fromJSON(object: any): InvokeRequest_HeadersEntry {
298
+ return {
299
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
300
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
301
+ };
302
+ },
303
+
304
+ toJSON(message: InvokeRequest_HeadersEntry): unknown {
305
+ const obj: any = {};
306
+ if (message.key !== "") {
307
+ obj.key = message.key;
308
+ }
309
+ if (message.value !== "") {
310
+ obj.value = message.value;
311
+ }
312
+ return obj;
313
+ },
314
+
315
+ create(base?: DeepPartial<InvokeRequest_HeadersEntry>): InvokeRequest_HeadersEntry {
316
+ return InvokeRequest_HeadersEntry.fromPartial(base ?? {});
317
+ },
318
+ fromPartial(object: DeepPartial<InvokeRequest_HeadersEntry>): InvokeRequest_HeadersEntry {
319
+ const message = createBaseInvokeRequest_HeadersEntry();
320
+ message.key = object.key ?? "";
321
+ message.value = object.value ?? "";
322
+ return message;
323
+ },
324
+ };
325
+
326
+ function createBaseInvokeResponse(): InvokeResponse {
327
+ return { status: 0, headers: {}, body: new Uint8Array(0) };
328
+ }
329
+
330
+ export const InvokeResponse: MessageFns<InvokeResponse> = {
331
+ encode(message: InvokeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
332
+ if (message.status !== 0) {
333
+ writer.uint32(8).uint32(message.status);
334
+ }
335
+ globalThis.Object.entries(message.headers).forEach(([key, value]: [string, string]) => {
336
+ InvokeResponse_HeadersEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
337
+ });
338
+ if (message.body.length !== 0) {
339
+ writer.uint32(26).bytes(message.body);
340
+ }
341
+ return writer;
342
+ },
343
+
344
+ decode(input: BinaryReader | Uint8Array, length?: number): InvokeResponse {
345
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
346
+ const end = length === undefined ? reader.len : reader.pos + length;
347
+ const message = createBaseInvokeResponse();
348
+ while (reader.pos < end) {
349
+ const tag = reader.uint32();
350
+ switch (tag >>> 3) {
351
+ case 1: {
352
+ if (tag !== 8) {
353
+ break;
354
+ }
355
+
356
+ message.status = reader.uint32();
357
+ continue;
358
+ }
359
+ case 2: {
360
+ if (tag !== 18) {
361
+ break;
362
+ }
363
+
364
+ const entry2 = InvokeResponse_HeadersEntry.decode(reader, reader.uint32());
365
+ if (entry2.value !== undefined) {
366
+ message.headers[entry2.key] = entry2.value;
367
+ }
368
+ continue;
369
+ }
370
+ case 3: {
371
+ if (tag !== 26) {
372
+ break;
373
+ }
374
+
375
+ message.body = reader.bytes();
376
+ continue;
377
+ }
378
+ }
379
+ if ((tag & 7) === 4 || tag === 0) {
380
+ break;
381
+ }
382
+ reader.skip(tag & 7);
383
+ }
384
+ return message;
385
+ },
386
+
387
+ fromJSON(object: any): InvokeResponse {
388
+ return {
389
+ status: isSet(object.status) ? globalThis.Number(object.status) : 0,
390
+ headers: isObject(object.headers)
391
+ ? (globalThis.Object.entries(object.headers) as [string, any][]).reduce(
392
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
393
+ acc[key] = globalThis.String(value);
394
+ return acc;
395
+ },
396
+ {},
397
+ )
398
+ : {},
399
+ body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array(0),
400
+ };
401
+ },
402
+
403
+ toJSON(message: InvokeResponse): unknown {
404
+ const obj: any = {};
405
+ if (message.status !== 0) {
406
+ obj.status = Math.round(message.status);
407
+ }
408
+ if (message.headers) {
409
+ const entries = globalThis.Object.entries(message.headers) as [string, string][];
410
+ if (entries.length > 0) {
411
+ obj.headers = {};
412
+ entries.forEach(([k, v]) => {
413
+ obj.headers[k] = v;
414
+ });
415
+ }
416
+ }
417
+ if (message.body.length !== 0) {
418
+ obj.body = base64FromBytes(message.body);
419
+ }
420
+ return obj;
421
+ },
422
+
423
+ create(base?: DeepPartial<InvokeResponse>): InvokeResponse {
424
+ return InvokeResponse.fromPartial(base ?? {});
425
+ },
426
+ fromPartial(object: DeepPartial<InvokeResponse>): InvokeResponse {
427
+ const message = createBaseInvokeResponse();
428
+ message.status = object.status ?? 0;
429
+ message.headers = (globalThis.Object.entries(object.headers ?? {}) as [string, string][]).reduce(
430
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
431
+ if (value !== undefined) {
432
+ acc[key] = globalThis.String(value);
433
+ }
434
+ return acc;
435
+ },
436
+ {},
437
+ );
438
+ message.body = object.body ?? new Uint8Array(0);
439
+ return message;
440
+ },
441
+ };
442
+
443
+ function createBaseInvokeResponse_HeadersEntry(): InvokeResponse_HeadersEntry {
444
+ return { key: "", value: "" };
445
+ }
446
+
447
+ export const InvokeResponse_HeadersEntry: MessageFns<InvokeResponse_HeadersEntry> = {
448
+ encode(message: InvokeResponse_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
449
+ if (message.key !== "") {
450
+ writer.uint32(10).string(message.key);
451
+ }
452
+ if (message.value !== "") {
453
+ writer.uint32(18).string(message.value);
454
+ }
455
+ return writer;
456
+ },
457
+
458
+ decode(input: BinaryReader | Uint8Array, length?: number): InvokeResponse_HeadersEntry {
459
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
460
+ const end = length === undefined ? reader.len : reader.pos + length;
461
+ const message = createBaseInvokeResponse_HeadersEntry();
462
+ while (reader.pos < end) {
463
+ const tag = reader.uint32();
464
+ switch (tag >>> 3) {
465
+ case 1: {
466
+ if (tag !== 10) {
467
+ break;
468
+ }
469
+
470
+ message.key = reader.string();
471
+ continue;
472
+ }
473
+ case 2: {
474
+ if (tag !== 18) {
475
+ break;
476
+ }
477
+
478
+ message.value = reader.string();
479
+ continue;
480
+ }
481
+ }
482
+ if ((tag & 7) === 4 || tag === 0) {
483
+ break;
484
+ }
485
+ reader.skip(tag & 7);
486
+ }
487
+ return message;
488
+ },
489
+
490
+ fromJSON(object: any): InvokeResponse_HeadersEntry {
491
+ return {
492
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
493
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
494
+ };
495
+ },
496
+
497
+ toJSON(message: InvokeResponse_HeadersEntry): unknown {
498
+ const obj: any = {};
499
+ if (message.key !== "") {
500
+ obj.key = message.key;
501
+ }
502
+ if (message.value !== "") {
503
+ obj.value = message.value;
504
+ }
505
+ return obj;
506
+ },
507
+
508
+ create(base?: DeepPartial<InvokeResponse_HeadersEntry>): InvokeResponse_HeadersEntry {
509
+ return InvokeResponse_HeadersEntry.fromPartial(base ?? {});
510
+ },
511
+ fromPartial(object: DeepPartial<InvokeResponse_HeadersEntry>): InvokeResponse_HeadersEntry {
512
+ const message = createBaseInvokeResponse_HeadersEntry();
513
+ message.key = object.key ?? "";
514
+ message.value = object.value ?? "";
515
+ return message;
516
+ },
517
+ };
518
+
519
+ function createBaseGetFunctionUrlRequest(): GetFunctionUrlRequest {
520
+ return { bindingName: "" };
521
+ }
522
+
523
+ export const GetFunctionUrlRequest: MessageFns<GetFunctionUrlRequest> = {
524
+ encode(message: GetFunctionUrlRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
525
+ if (message.bindingName !== "") {
526
+ writer.uint32(10).string(message.bindingName);
527
+ }
528
+ return writer;
529
+ },
530
+
531
+ decode(input: BinaryReader | Uint8Array, length?: number): GetFunctionUrlRequest {
532
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
533
+ const end = length === undefined ? reader.len : reader.pos + length;
534
+ const message = createBaseGetFunctionUrlRequest();
535
+ while (reader.pos < end) {
536
+ const tag = reader.uint32();
537
+ switch (tag >>> 3) {
538
+ case 1: {
539
+ if (tag !== 10) {
540
+ break;
541
+ }
542
+
543
+ message.bindingName = reader.string();
544
+ continue;
545
+ }
546
+ }
547
+ if ((tag & 7) === 4 || tag === 0) {
548
+ break;
549
+ }
550
+ reader.skip(tag & 7);
551
+ }
552
+ return message;
553
+ },
554
+
555
+ fromJSON(object: any): GetFunctionUrlRequest {
556
+ return { bindingName: isSet(object.bindingName) ? globalThis.String(object.bindingName) : "" };
557
+ },
558
+
559
+ toJSON(message: GetFunctionUrlRequest): unknown {
560
+ const obj: any = {};
561
+ if (message.bindingName !== "") {
562
+ obj.bindingName = message.bindingName;
563
+ }
564
+ return obj;
565
+ },
566
+
567
+ create(base?: DeepPartial<GetFunctionUrlRequest>): GetFunctionUrlRequest {
568
+ return GetFunctionUrlRequest.fromPartial(base ?? {});
569
+ },
570
+ fromPartial(object: DeepPartial<GetFunctionUrlRequest>): GetFunctionUrlRequest {
571
+ const message = createBaseGetFunctionUrlRequest();
572
+ message.bindingName = object.bindingName ?? "";
573
+ return message;
574
+ },
575
+ };
576
+
577
+ function createBaseGetFunctionUrlResponse(): GetFunctionUrlResponse {
578
+ return { url: undefined };
579
+ }
580
+
581
+ export const GetFunctionUrlResponse: MessageFns<GetFunctionUrlResponse> = {
582
+ encode(message: GetFunctionUrlResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
583
+ if (message.url !== undefined) {
584
+ writer.uint32(10).string(message.url);
585
+ }
586
+ return writer;
587
+ },
588
+
589
+ decode(input: BinaryReader | Uint8Array, length?: number): GetFunctionUrlResponse {
590
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
591
+ const end = length === undefined ? reader.len : reader.pos + length;
592
+ const message = createBaseGetFunctionUrlResponse();
593
+ while (reader.pos < end) {
594
+ const tag = reader.uint32();
595
+ switch (tag >>> 3) {
596
+ case 1: {
597
+ if (tag !== 10) {
598
+ break;
599
+ }
600
+
601
+ message.url = reader.string();
602
+ continue;
603
+ }
604
+ }
605
+ if ((tag & 7) === 4 || tag === 0) {
606
+ break;
607
+ }
608
+ reader.skip(tag & 7);
609
+ }
610
+ return message;
611
+ },
612
+
613
+ fromJSON(object: any): GetFunctionUrlResponse {
614
+ return { url: isSet(object.url) ? globalThis.String(object.url) : undefined };
615
+ },
616
+
617
+ toJSON(message: GetFunctionUrlResponse): unknown {
618
+ const obj: any = {};
619
+ if (message.url !== undefined) {
620
+ obj.url = message.url;
621
+ }
622
+ return obj;
623
+ },
624
+
625
+ create(base?: DeepPartial<GetFunctionUrlResponse>): GetFunctionUrlResponse {
626
+ return GetFunctionUrlResponse.fromPartial(base ?? {});
627
+ },
628
+ fromPartial(object: DeepPartial<GetFunctionUrlResponse>): GetFunctionUrlResponse {
629
+ const message = createBaseGetFunctionUrlResponse();
630
+ message.url = object.url ?? undefined;
631
+ return message;
632
+ },
633
+ };
634
+
635
+ /** Function service for direct function-to-function invocation */
636
+ export type FunctionServiceDefinition = typeof FunctionServiceDefinition;
637
+ export const FunctionServiceDefinition = {
638
+ name: "FunctionService",
639
+ fullName: "alien_bindings.function.FunctionService",
640
+ methods: {
641
+ /** Invoke a function with HTTP request data */
642
+ invoke: {
643
+ name: "Invoke",
644
+ requestType: InvokeRequest,
645
+ requestStream: false,
646
+ responseType: InvokeResponse,
647
+ responseStream: false,
648
+ options: {},
649
+ },
650
+ /** Get the public URL of the function, if available */
651
+ getFunctionUrl: {
652
+ name: "GetFunctionUrl",
653
+ requestType: GetFunctionUrlRequest,
654
+ requestStream: false,
655
+ responseType: GetFunctionUrlResponse,
656
+ responseStream: false,
657
+ options: {},
658
+ },
659
+ },
660
+ } as const;
661
+
662
+ export interface FunctionServiceImplementation<CallContextExt = {}> {
663
+ /** Invoke a function with HTTP request data */
664
+ invoke(request: InvokeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<InvokeResponse>>;
665
+ /** Get the public URL of the function, if available */
666
+ getFunctionUrl(
667
+ request: GetFunctionUrlRequest,
668
+ context: CallContext & CallContextExt,
669
+ ): Promise<DeepPartial<GetFunctionUrlResponse>>;
670
+ }
671
+
672
+ export interface FunctionServiceClient<CallOptionsExt = {}> {
673
+ /** Invoke a function with HTTP request data */
674
+ invoke(request: DeepPartial<InvokeRequest>, options?: CallOptions & CallOptionsExt): Promise<InvokeResponse>;
675
+ /** Get the public URL of the function, if available */
676
+ getFunctionUrl(
677
+ request: DeepPartial<GetFunctionUrlRequest>,
678
+ options?: CallOptions & CallOptionsExt,
679
+ ): Promise<GetFunctionUrlResponse>;
680
+ }
681
+
682
+ function bytesFromBase64(b64: string): Uint8Array {
683
+ if ((globalThis as any).Buffer) {
684
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
685
+ } else {
686
+ const bin = globalThis.atob(b64);
687
+ const arr = new Uint8Array(bin.length);
688
+ for (let i = 0; i < bin.length; ++i) {
689
+ arr[i] = bin.charCodeAt(i);
690
+ }
691
+ return arr;
692
+ }
693
+ }
694
+
695
+ function base64FromBytes(arr: Uint8Array): string {
696
+ if ((globalThis as any).Buffer) {
697
+ return globalThis.Buffer.from(arr).toString("base64");
698
+ } else {
699
+ const bin: string[] = [];
700
+ arr.forEach((byte) => {
701
+ bin.push(globalThis.String.fromCharCode(byte));
702
+ });
703
+ return globalThis.btoa(bin.join(""));
704
+ }
705
+ }
706
+
707
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
708
+
709
+ export type DeepPartial<T> = T extends Builtin ? T
710
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
711
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
712
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
713
+ : Partial<T>;
714
+
715
+ function longToNumber(int64: { toString(): string }): number {
716
+ const num = globalThis.Number(int64.toString());
717
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
718
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
719
+ }
720
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
721
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
722
+ }
723
+ return num;
724
+ }
725
+
726
+ function isObject(value: any): boolean {
727
+ return typeof value === "object" && value !== null;
728
+ }
729
+
730
+ function isSet(value: any): boolean {
731
+ return value !== null && value !== undefined;
732
+ }
733
+
734
+ export interface MessageFns<T> {
735
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
736
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
737
+ fromJSON(object: any): T;
738
+ toJSON(message: T): unknown;
739
+ create(base?: DeepPartial<T>): T;
740
+ fromPartial(object: DeepPartial<T>): T;
741
+ }