@alienplatform/sdk 1.3.5 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/AGENTS.md +1 -1
- package/dist/bindings/artifact-registry.d.ts.map +1 -1
- package/dist/bindings/index.d.ts +1 -1
- package/dist/bindings/index.d.ts.map +1 -1
- package/dist/bindings/storage.d.ts.map +1 -1
- package/dist/bindings/{function.d.ts → worker.d.ts} +20 -20
- package/dist/bindings/worker.d.ts.map +1 -0
- package/dist/context.d.ts +4 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/dist.js +3871 -778
- package/dist/generated/artifact_registry.d.ts +13 -3
- package/dist/generated/artifact_registry.d.ts.map +1 -1
- package/dist/generated/storage.d.ts +10 -9
- package/dist/generated/storage.d.ts.map +1 -1
- package/dist/generated/{function.d.ts → worker.d.ts} +30 -30
- package/dist/generated/worker.d.ts.map +1 -0
- package/dist/global.d.ts +6 -6
- package/dist/global.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1609 -1339
- package/dist/types.d.ts +20 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/wait-until.d.ts +1 -1
- package/package.json +2 -2
- package/src/bindings/artifact-registry.ts +5 -4
- package/src/bindings/index.ts +1 -1
- package/src/bindings/storage.ts +1 -0
- package/src/bindings/{function.ts → worker.ts} +32 -32
- package/src/context.ts +7 -7
- package/src/generated/artifact_registry.ts +63 -9
- package/src/generated/storage.ts +108 -69
- package/src/generated/{function.ts → worker.ts} +62 -62
- package/src/global.ts +7 -7
- package/src/index.ts +8 -7
- package/src/types.ts +22 -11
- package/src/wait-until.ts +1 -1
- package/dist/bindings/function.d.ts.map +0 -1
- package/dist/generated/function.d.ts.map +0 -1
package/src/generated/storage.ts
CHANGED
|
@@ -274,6 +274,14 @@ export interface StorageAttributeKeyValuePair {
|
|
|
274
274
|
value: string;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
/** Represents a single HTTP header required by a signed URL request. */
|
|
278
|
+
export interface StorageHttpHeader {
|
|
279
|
+
/** Header name. */
|
|
280
|
+
key: string;
|
|
281
|
+
/** Header value. */
|
|
282
|
+
value: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
277
285
|
/**
|
|
278
286
|
* A collection of storage attributes.
|
|
279
287
|
* Maps to object_store::Attributes.
|
|
@@ -354,15 +362,6 @@ export interface StorageGetRequest {
|
|
|
354
362
|
options?: StorageGetOptions | undefined;
|
|
355
363
|
}
|
|
356
364
|
|
|
357
|
-
/** A chunk of data from a storage object stream. */
|
|
358
|
-
export interface StorageChunkResponse {
|
|
359
|
-
/**
|
|
360
|
-
* Bytes of the object chunk.
|
|
361
|
-
* Corresponds to Bytes from the object_store::GetResult stream.
|
|
362
|
-
*/
|
|
363
|
-
chunkData: Uint8Array;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
365
|
/** New message for Get RPC stream */
|
|
367
366
|
export interface GetResponsePart {
|
|
368
367
|
/** First message in the stream */
|
|
@@ -659,6 +658,8 @@ export interface StorageSignedUrlRequest {
|
|
|
659
658
|
export interface StorageSignedUrlResponse {
|
|
660
659
|
/** The generated signed URL. */
|
|
661
660
|
url: string;
|
|
661
|
+
/** Headers that must be included when executing the signed request. */
|
|
662
|
+
headers: StorageHttpHeader[];
|
|
662
663
|
}
|
|
663
664
|
|
|
664
665
|
function createBaseStorageRange(): StorageRange {
|
|
@@ -1283,6 +1284,82 @@ export const StorageAttributeKeyValuePair: MessageFns<StorageAttributeKeyValuePa
|
|
|
1283
1284
|
},
|
|
1284
1285
|
};
|
|
1285
1286
|
|
|
1287
|
+
function createBaseStorageHttpHeader(): StorageHttpHeader {
|
|
1288
|
+
return { key: "", value: "" };
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
export const StorageHttpHeader: MessageFns<StorageHttpHeader> = {
|
|
1292
|
+
encode(message: StorageHttpHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1293
|
+
if (message.key !== "") {
|
|
1294
|
+
writer.uint32(10).string(message.key);
|
|
1295
|
+
}
|
|
1296
|
+
if (message.value !== "") {
|
|
1297
|
+
writer.uint32(18).string(message.value);
|
|
1298
|
+
}
|
|
1299
|
+
return writer;
|
|
1300
|
+
},
|
|
1301
|
+
|
|
1302
|
+
decode(input: BinaryReader | Uint8Array, length?: number): StorageHttpHeader {
|
|
1303
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1304
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1305
|
+
const message = createBaseStorageHttpHeader();
|
|
1306
|
+
while (reader.pos < end) {
|
|
1307
|
+
const tag = reader.uint32();
|
|
1308
|
+
switch (tag >>> 3) {
|
|
1309
|
+
case 1: {
|
|
1310
|
+
if (tag !== 10) {
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
message.key = reader.string();
|
|
1315
|
+
continue;
|
|
1316
|
+
}
|
|
1317
|
+
case 2: {
|
|
1318
|
+
if (tag !== 18) {
|
|
1319
|
+
break;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
message.value = reader.string();
|
|
1323
|
+
continue;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1327
|
+
break;
|
|
1328
|
+
}
|
|
1329
|
+
reader.skip(tag & 7);
|
|
1330
|
+
}
|
|
1331
|
+
return message;
|
|
1332
|
+
},
|
|
1333
|
+
|
|
1334
|
+
fromJSON(object: any): StorageHttpHeader {
|
|
1335
|
+
return {
|
|
1336
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
1337
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
1338
|
+
};
|
|
1339
|
+
},
|
|
1340
|
+
|
|
1341
|
+
toJSON(message: StorageHttpHeader): unknown {
|
|
1342
|
+
const obj: any = {};
|
|
1343
|
+
if (message.key !== "") {
|
|
1344
|
+
obj.key = message.key;
|
|
1345
|
+
}
|
|
1346
|
+
if (message.value !== "") {
|
|
1347
|
+
obj.value = message.value;
|
|
1348
|
+
}
|
|
1349
|
+
return obj;
|
|
1350
|
+
},
|
|
1351
|
+
|
|
1352
|
+
create(base?: DeepPartial<StorageHttpHeader>): StorageHttpHeader {
|
|
1353
|
+
return StorageHttpHeader.fromPartial(base ?? {});
|
|
1354
|
+
},
|
|
1355
|
+
fromPartial(object: DeepPartial<StorageHttpHeader>): StorageHttpHeader {
|
|
1356
|
+
const message = createBaseStorageHttpHeader();
|
|
1357
|
+
message.key = object.key ?? "";
|
|
1358
|
+
message.value = object.value ?? "";
|
|
1359
|
+
return message;
|
|
1360
|
+
},
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1286
1363
|
function createBaseStorageAttributesMap(): StorageAttributesMap {
|
|
1287
1364
|
return { pairs: [] };
|
|
1288
1365
|
}
|
|
@@ -1635,64 +1712,6 @@ export const StorageGetRequest: MessageFns<StorageGetRequest> = {
|
|
|
1635
1712
|
},
|
|
1636
1713
|
};
|
|
1637
1714
|
|
|
1638
|
-
function createBaseStorageChunkResponse(): StorageChunkResponse {
|
|
1639
|
-
return { chunkData: new Uint8Array(0) };
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
export const StorageChunkResponse: MessageFns<StorageChunkResponse> = {
|
|
1643
|
-
encode(message: StorageChunkResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1644
|
-
if (message.chunkData.length !== 0) {
|
|
1645
|
-
writer.uint32(10).bytes(message.chunkData);
|
|
1646
|
-
}
|
|
1647
|
-
return writer;
|
|
1648
|
-
},
|
|
1649
|
-
|
|
1650
|
-
decode(input: BinaryReader | Uint8Array, length?: number): StorageChunkResponse {
|
|
1651
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1652
|
-
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1653
|
-
const message = createBaseStorageChunkResponse();
|
|
1654
|
-
while (reader.pos < end) {
|
|
1655
|
-
const tag = reader.uint32();
|
|
1656
|
-
switch (tag >>> 3) {
|
|
1657
|
-
case 1: {
|
|
1658
|
-
if (tag !== 10) {
|
|
1659
|
-
break;
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
message.chunkData = reader.bytes();
|
|
1663
|
-
continue;
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
1667
|
-
break;
|
|
1668
|
-
}
|
|
1669
|
-
reader.skip(tag & 7);
|
|
1670
|
-
}
|
|
1671
|
-
return message;
|
|
1672
|
-
},
|
|
1673
|
-
|
|
1674
|
-
fromJSON(object: any): StorageChunkResponse {
|
|
1675
|
-
return { chunkData: isSet(object.chunkData) ? bytesFromBase64(object.chunkData) : new Uint8Array(0) };
|
|
1676
|
-
},
|
|
1677
|
-
|
|
1678
|
-
toJSON(message: StorageChunkResponse): unknown {
|
|
1679
|
-
const obj: any = {};
|
|
1680
|
-
if (message.chunkData.length !== 0) {
|
|
1681
|
-
obj.chunkData = base64FromBytes(message.chunkData);
|
|
1682
|
-
}
|
|
1683
|
-
return obj;
|
|
1684
|
-
},
|
|
1685
|
-
|
|
1686
|
-
create(base?: DeepPartial<StorageChunkResponse>): StorageChunkResponse {
|
|
1687
|
-
return StorageChunkResponse.fromPartial(base ?? {});
|
|
1688
|
-
},
|
|
1689
|
-
fromPartial(object: DeepPartial<StorageChunkResponse>): StorageChunkResponse {
|
|
1690
|
-
const message = createBaseStorageChunkResponse();
|
|
1691
|
-
message.chunkData = object.chunkData ?? new Uint8Array(0);
|
|
1692
|
-
return message;
|
|
1693
|
-
},
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
1715
|
function createBaseGetResponsePart(): GetResponsePart {
|
|
1697
1716
|
return { metadata: undefined, chunkData: undefined };
|
|
1698
1717
|
}
|
|
@@ -3221,7 +3240,7 @@ export const StorageSignedUrlRequest: MessageFns<StorageSignedUrlRequest> = {
|
|
|
3221
3240
|
};
|
|
3222
3241
|
|
|
3223
3242
|
function createBaseStorageSignedUrlResponse(): StorageSignedUrlResponse {
|
|
3224
|
-
return { url: "" };
|
|
3243
|
+
return { url: "", headers: [] };
|
|
3225
3244
|
}
|
|
3226
3245
|
|
|
3227
3246
|
export const StorageSignedUrlResponse: MessageFns<StorageSignedUrlResponse> = {
|
|
@@ -3229,6 +3248,9 @@ export const StorageSignedUrlResponse: MessageFns<StorageSignedUrlResponse> = {
|
|
|
3229
3248
|
if (message.url !== "") {
|
|
3230
3249
|
writer.uint32(10).string(message.url);
|
|
3231
3250
|
}
|
|
3251
|
+
for (const v of message.headers) {
|
|
3252
|
+
StorageHttpHeader.encode(v!, writer.uint32(18).fork()).join();
|
|
3253
|
+
}
|
|
3232
3254
|
return writer;
|
|
3233
3255
|
},
|
|
3234
3256
|
|
|
@@ -3247,6 +3269,14 @@ export const StorageSignedUrlResponse: MessageFns<StorageSignedUrlResponse> = {
|
|
|
3247
3269
|
message.url = reader.string();
|
|
3248
3270
|
continue;
|
|
3249
3271
|
}
|
|
3272
|
+
case 2: {
|
|
3273
|
+
if (tag !== 18) {
|
|
3274
|
+
break;
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
message.headers.push(StorageHttpHeader.decode(reader, reader.uint32()));
|
|
3278
|
+
continue;
|
|
3279
|
+
}
|
|
3250
3280
|
}
|
|
3251
3281
|
if ((tag & 7) === 4 || tag === 0) {
|
|
3252
3282
|
break;
|
|
@@ -3257,7 +3287,12 @@ export const StorageSignedUrlResponse: MessageFns<StorageSignedUrlResponse> = {
|
|
|
3257
3287
|
},
|
|
3258
3288
|
|
|
3259
3289
|
fromJSON(object: any): StorageSignedUrlResponse {
|
|
3260
|
-
return {
|
|
3290
|
+
return {
|
|
3291
|
+
url: isSet(object.url) ? globalThis.String(object.url) : "",
|
|
3292
|
+
headers: globalThis.Array.isArray(object?.headers)
|
|
3293
|
+
? object.headers.map((e: any) => StorageHttpHeader.fromJSON(e))
|
|
3294
|
+
: [],
|
|
3295
|
+
};
|
|
3261
3296
|
},
|
|
3262
3297
|
|
|
3263
3298
|
toJSON(message: StorageSignedUrlResponse): unknown {
|
|
@@ -3265,6 +3300,9 @@ export const StorageSignedUrlResponse: MessageFns<StorageSignedUrlResponse> = {
|
|
|
3265
3300
|
if (message.url !== "") {
|
|
3266
3301
|
obj.url = message.url;
|
|
3267
3302
|
}
|
|
3303
|
+
if (message.headers?.length) {
|
|
3304
|
+
obj.headers = message.headers.map((e) => StorageHttpHeader.toJSON(e));
|
|
3305
|
+
}
|
|
3268
3306
|
return obj;
|
|
3269
3307
|
},
|
|
3270
3308
|
|
|
@@ -3274,6 +3312,7 @@ export const StorageSignedUrlResponse: MessageFns<StorageSignedUrlResponse> = {
|
|
|
3274
3312
|
fromPartial(object: DeepPartial<StorageSignedUrlResponse>): StorageSignedUrlResponse {
|
|
3275
3313
|
const message = createBaseStorageSignedUrlResponse();
|
|
3276
3314
|
message.url = object.url ?? "";
|
|
3315
|
+
message.headers = object.headers?.map((e) => StorageHttpHeader.fromPartial(e)) || [];
|
|
3277
3316
|
return message;
|
|
3278
3317
|
},
|
|
3279
3318
|
};
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.10.1
|
|
4
4
|
// protoc v7.34.1
|
|
5
|
-
// source:
|
|
5
|
+
// source: worker.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
9
|
import type { CallContext, CallOptions } from "nice-grpc-common";
|
|
10
10
|
|
|
11
|
-
export const protobufPackage = "alien_bindings.
|
|
11
|
+
export const protobufPackage = "alien_bindings.worker";
|
|
12
12
|
|
|
13
13
|
/** Messages for Invoke */
|
|
14
14
|
export interface InvokeRequest {
|
|
15
|
-
/** Name of the
|
|
15
|
+
/** Name of the Worker binding to use */
|
|
16
16
|
bindingName: string;
|
|
17
|
-
/** Target
|
|
18
|
-
|
|
17
|
+
/** Target worker identifier (name, ARN, URL, etc.) */
|
|
18
|
+
targetWorker: string;
|
|
19
19
|
/** HTTP method */
|
|
20
20
|
method: string;
|
|
21
21
|
/** Request path */
|
|
@@ -47,13 +47,13 @@ export interface InvokeResponse_HeadersEntry {
|
|
|
47
47
|
value: string;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/** Messages for
|
|
51
|
-
export interface
|
|
52
|
-
/** Name of the
|
|
50
|
+
/** Messages for GetWorkerUrl */
|
|
51
|
+
export interface GetWorkerUrlRequest {
|
|
52
|
+
/** Name of the Worker binding to use */
|
|
53
53
|
bindingName: string;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export interface
|
|
56
|
+
export interface GetWorkerUrlResponse {
|
|
57
57
|
/** The public URL if available */
|
|
58
58
|
url?: string | undefined;
|
|
59
59
|
}
|
|
@@ -61,7 +61,7 @@ export interface GetFunctionUrlResponse {
|
|
|
61
61
|
function createBaseInvokeRequest(): InvokeRequest {
|
|
62
62
|
return {
|
|
63
63
|
bindingName: "",
|
|
64
|
-
|
|
64
|
+
targetWorker: "",
|
|
65
65
|
method: "",
|
|
66
66
|
path: "",
|
|
67
67
|
headers: {},
|
|
@@ -75,8 +75,8 @@ export const InvokeRequest: MessageFns<InvokeRequest> = {
|
|
|
75
75
|
if (message.bindingName !== "") {
|
|
76
76
|
writer.uint32(10).string(message.bindingName);
|
|
77
77
|
}
|
|
78
|
-
if (message.
|
|
79
|
-
writer.uint32(18).string(message.
|
|
78
|
+
if (message.targetWorker !== "") {
|
|
79
|
+
writer.uint32(18).string(message.targetWorker);
|
|
80
80
|
}
|
|
81
81
|
if (message.method !== "") {
|
|
82
82
|
writer.uint32(26).string(message.method);
|
|
@@ -116,7 +116,7 @@ export const InvokeRequest: MessageFns<InvokeRequest> = {
|
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
message.
|
|
119
|
+
message.targetWorker = reader.string();
|
|
120
120
|
continue;
|
|
121
121
|
}
|
|
122
122
|
case 3: {
|
|
@@ -174,7 +174,7 @@ export const InvokeRequest: MessageFns<InvokeRequest> = {
|
|
|
174
174
|
fromJSON(object: any): InvokeRequest {
|
|
175
175
|
return {
|
|
176
176
|
bindingName: isSet(object.bindingName) ? globalThis.String(object.bindingName) : "",
|
|
177
|
-
|
|
177
|
+
targetWorker: isSet(object.targetWorker) ? globalThis.String(object.targetWorker) : "",
|
|
178
178
|
method: isSet(object.method) ? globalThis.String(object.method) : "",
|
|
179
179
|
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
|
180
180
|
headers: isObject(object.headers)
|
|
@@ -196,8 +196,8 @@ export const InvokeRequest: MessageFns<InvokeRequest> = {
|
|
|
196
196
|
if (message.bindingName !== "") {
|
|
197
197
|
obj.bindingName = message.bindingName;
|
|
198
198
|
}
|
|
199
|
-
if (message.
|
|
200
|
-
obj.
|
|
199
|
+
if (message.targetWorker !== "") {
|
|
200
|
+
obj.targetWorker = message.targetWorker;
|
|
201
201
|
}
|
|
202
202
|
if (message.method !== "") {
|
|
203
203
|
obj.method = message.method;
|
|
@@ -229,7 +229,7 @@ export const InvokeRequest: MessageFns<InvokeRequest> = {
|
|
|
229
229
|
fromPartial(object: DeepPartial<InvokeRequest>): InvokeRequest {
|
|
230
230
|
const message = createBaseInvokeRequest();
|
|
231
231
|
message.bindingName = object.bindingName ?? "";
|
|
232
|
-
message.
|
|
232
|
+
message.targetWorker = object.targetWorker ?? "";
|
|
233
233
|
message.method = object.method ?? "";
|
|
234
234
|
message.path = object.path ?? "";
|
|
235
235
|
message.headers = (globalThis.Object.entries(object.headers ?? {}) as [string, string][]).reduce(
|
|
@@ -516,22 +516,22 @@ export const InvokeResponse_HeadersEntry: MessageFns<InvokeResponse_HeadersEntry
|
|
|
516
516
|
},
|
|
517
517
|
};
|
|
518
518
|
|
|
519
|
-
function
|
|
519
|
+
function createBaseGetWorkerUrlRequest(): GetWorkerUrlRequest {
|
|
520
520
|
return { bindingName: "" };
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
export const
|
|
524
|
-
encode(message:
|
|
523
|
+
export const GetWorkerUrlRequest: MessageFns<GetWorkerUrlRequest> = {
|
|
524
|
+
encode(message: GetWorkerUrlRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
525
525
|
if (message.bindingName !== "") {
|
|
526
526
|
writer.uint32(10).string(message.bindingName);
|
|
527
527
|
}
|
|
528
528
|
return writer;
|
|
529
529
|
},
|
|
530
530
|
|
|
531
|
-
decode(input: BinaryReader | Uint8Array, length?: number):
|
|
531
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetWorkerUrlRequest {
|
|
532
532
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
533
533
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
534
|
-
const message =
|
|
534
|
+
const message = createBaseGetWorkerUrlRequest();
|
|
535
535
|
while (reader.pos < end) {
|
|
536
536
|
const tag = reader.uint32();
|
|
537
537
|
switch (tag >>> 3) {
|
|
@@ -552,11 +552,11 @@ export const GetFunctionUrlRequest: MessageFns<GetFunctionUrlRequest> = {
|
|
|
552
552
|
return message;
|
|
553
553
|
},
|
|
554
554
|
|
|
555
|
-
fromJSON(object: any):
|
|
555
|
+
fromJSON(object: any): GetWorkerUrlRequest {
|
|
556
556
|
return { bindingName: isSet(object.bindingName) ? globalThis.String(object.bindingName) : "" };
|
|
557
557
|
},
|
|
558
558
|
|
|
559
|
-
toJSON(message:
|
|
559
|
+
toJSON(message: GetWorkerUrlRequest): unknown {
|
|
560
560
|
const obj: any = {};
|
|
561
561
|
if (message.bindingName !== "") {
|
|
562
562
|
obj.bindingName = message.bindingName;
|
|
@@ -564,32 +564,32 @@ export const GetFunctionUrlRequest: MessageFns<GetFunctionUrlRequest> = {
|
|
|
564
564
|
return obj;
|
|
565
565
|
},
|
|
566
566
|
|
|
567
|
-
create(base?: DeepPartial<
|
|
568
|
-
return
|
|
567
|
+
create(base?: DeepPartial<GetWorkerUrlRequest>): GetWorkerUrlRequest {
|
|
568
|
+
return GetWorkerUrlRequest.fromPartial(base ?? {});
|
|
569
569
|
},
|
|
570
|
-
fromPartial(object: DeepPartial<
|
|
571
|
-
const message =
|
|
570
|
+
fromPartial(object: DeepPartial<GetWorkerUrlRequest>): GetWorkerUrlRequest {
|
|
571
|
+
const message = createBaseGetWorkerUrlRequest();
|
|
572
572
|
message.bindingName = object.bindingName ?? "";
|
|
573
573
|
return message;
|
|
574
574
|
},
|
|
575
575
|
};
|
|
576
576
|
|
|
577
|
-
function
|
|
577
|
+
function createBaseGetWorkerUrlResponse(): GetWorkerUrlResponse {
|
|
578
578
|
return { url: undefined };
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
export const
|
|
582
|
-
encode(message:
|
|
581
|
+
export const GetWorkerUrlResponse: MessageFns<GetWorkerUrlResponse> = {
|
|
582
|
+
encode(message: GetWorkerUrlResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
583
583
|
if (message.url !== undefined) {
|
|
584
584
|
writer.uint32(10).string(message.url);
|
|
585
585
|
}
|
|
586
586
|
return writer;
|
|
587
587
|
},
|
|
588
588
|
|
|
589
|
-
decode(input: BinaryReader | Uint8Array, length?: number):
|
|
589
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetWorkerUrlResponse {
|
|
590
590
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
591
591
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
592
|
-
const message =
|
|
592
|
+
const message = createBaseGetWorkerUrlResponse();
|
|
593
593
|
while (reader.pos < end) {
|
|
594
594
|
const tag = reader.uint32();
|
|
595
595
|
switch (tag >>> 3) {
|
|
@@ -610,11 +610,11 @@ export const GetFunctionUrlResponse: MessageFns<GetFunctionUrlResponse> = {
|
|
|
610
610
|
return message;
|
|
611
611
|
},
|
|
612
612
|
|
|
613
|
-
fromJSON(object: any):
|
|
613
|
+
fromJSON(object: any): GetWorkerUrlResponse {
|
|
614
614
|
return { url: isSet(object.url) ? globalThis.String(object.url) : undefined };
|
|
615
615
|
},
|
|
616
616
|
|
|
617
|
-
toJSON(message:
|
|
617
|
+
toJSON(message: GetWorkerUrlResponse): unknown {
|
|
618
618
|
const obj: any = {};
|
|
619
619
|
if (message.url !== undefined) {
|
|
620
620
|
obj.url = message.url;
|
|
@@ -622,23 +622,23 @@ export const GetFunctionUrlResponse: MessageFns<GetFunctionUrlResponse> = {
|
|
|
622
622
|
return obj;
|
|
623
623
|
},
|
|
624
624
|
|
|
625
|
-
create(base?: DeepPartial<
|
|
626
|
-
return
|
|
625
|
+
create(base?: DeepPartial<GetWorkerUrlResponse>): GetWorkerUrlResponse {
|
|
626
|
+
return GetWorkerUrlResponse.fromPartial(base ?? {});
|
|
627
627
|
},
|
|
628
|
-
fromPartial(object: DeepPartial<
|
|
629
|
-
const message =
|
|
628
|
+
fromPartial(object: DeepPartial<GetWorkerUrlResponse>): GetWorkerUrlResponse {
|
|
629
|
+
const message = createBaseGetWorkerUrlResponse();
|
|
630
630
|
message.url = object.url ?? undefined;
|
|
631
631
|
return message;
|
|
632
632
|
},
|
|
633
633
|
};
|
|
634
634
|
|
|
635
|
-
/**
|
|
636
|
-
export type
|
|
637
|
-
export const
|
|
638
|
-
name: "
|
|
639
|
-
fullName: "alien_bindings.
|
|
635
|
+
/** Worker service for direct worker-to-worker invocation */
|
|
636
|
+
export type WorkerServiceDefinition = typeof WorkerServiceDefinition;
|
|
637
|
+
export const WorkerServiceDefinition = {
|
|
638
|
+
name: "WorkerService",
|
|
639
|
+
fullName: "alien_bindings.worker.WorkerService",
|
|
640
640
|
methods: {
|
|
641
|
-
/** Invoke a
|
|
641
|
+
/** Invoke a worker with HTTP request data */
|
|
642
642
|
invoke: {
|
|
643
643
|
name: "Invoke",
|
|
644
644
|
requestType: InvokeRequest,
|
|
@@ -647,36 +647,36 @@ export const FunctionServiceDefinition = {
|
|
|
647
647
|
responseStream: false,
|
|
648
648
|
options: {},
|
|
649
649
|
},
|
|
650
|
-
/** Get the public URL of the
|
|
651
|
-
|
|
652
|
-
name: "
|
|
653
|
-
requestType:
|
|
650
|
+
/** Get the public URL of the worker, if available */
|
|
651
|
+
getWorkerUrl: {
|
|
652
|
+
name: "GetWorkerUrl",
|
|
653
|
+
requestType: GetWorkerUrlRequest,
|
|
654
654
|
requestStream: false,
|
|
655
|
-
responseType:
|
|
655
|
+
responseType: GetWorkerUrlResponse,
|
|
656
656
|
responseStream: false,
|
|
657
657
|
options: {},
|
|
658
658
|
},
|
|
659
659
|
},
|
|
660
660
|
} as const;
|
|
661
661
|
|
|
662
|
-
export interface
|
|
663
|
-
/** Invoke a
|
|
662
|
+
export interface WorkerServiceImplementation<CallContextExt = {}> {
|
|
663
|
+
/** Invoke a worker with HTTP request data */
|
|
664
664
|
invoke(request: InvokeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<InvokeResponse>>;
|
|
665
|
-
/** Get the public URL of the
|
|
666
|
-
|
|
667
|
-
request:
|
|
665
|
+
/** Get the public URL of the worker, if available */
|
|
666
|
+
getWorkerUrl(
|
|
667
|
+
request: GetWorkerUrlRequest,
|
|
668
668
|
context: CallContext & CallContextExt,
|
|
669
|
-
): Promise<DeepPartial<
|
|
669
|
+
): Promise<DeepPartial<GetWorkerUrlResponse>>;
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
-
export interface
|
|
673
|
-
/** Invoke a
|
|
672
|
+
export interface WorkerServiceClient<CallOptionsExt = {}> {
|
|
673
|
+
/** Invoke a worker with HTTP request data */
|
|
674
674
|
invoke(request: DeepPartial<InvokeRequest>, options?: CallOptions & CallOptionsExt): Promise<InvokeResponse>;
|
|
675
|
-
/** Get the public URL of the
|
|
676
|
-
|
|
677
|
-
request: DeepPartial<
|
|
675
|
+
/** Get the public URL of the worker, if available */
|
|
676
|
+
getWorkerUrl(
|
|
677
|
+
request: DeepPartial<GetWorkerUrlRequest>,
|
|
678
678
|
options?: CallOptions & CallOptionsExt,
|
|
679
|
-
): Promise<
|
|
679
|
+
): Promise<GetWorkerUrlResponse>;
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
function bytesFromBase64(b64: string): Uint8Array {
|
package/src/global.ts
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import type { ArtifactRegistry } from "./bindings/artifact-registry.js"
|
|
8
8
|
import type { Build } from "./bindings/build.js"
|
|
9
|
-
import type { FunctionBinding } from "./bindings/function.js"
|
|
10
9
|
import type { Kv } from "./bindings/kv.js"
|
|
11
10
|
import type { Queue } from "./bindings/queue.js"
|
|
12
11
|
import type { ServiceAccount } from "./bindings/service-account.js"
|
|
13
12
|
import type { Storage } from "./bindings/storage.js"
|
|
14
13
|
import type { Vault } from "./bindings/vault.js"
|
|
14
|
+
import type { WorkerBinding } from "./bindings/worker.js"
|
|
15
15
|
|
|
16
16
|
import { AlienContext } from "./context.js"
|
|
17
17
|
import {
|
|
@@ -151,21 +151,21 @@ export async function artifactRegistry(name: string): Promise<ArtifactRegistry>
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
* Get a
|
|
154
|
+
* Get a worker binding.
|
|
155
155
|
*
|
|
156
156
|
* @param name - Binding name
|
|
157
|
-
* @returns
|
|
157
|
+
* @returns Worker binding instance
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
160
|
* ```typescript
|
|
161
|
-
* import {
|
|
161
|
+
* import { worker } from "@alienplatform/sdk"
|
|
162
162
|
*
|
|
163
|
-
* const processor = await
|
|
163
|
+
* const processor = await worker("image-processor")
|
|
164
164
|
* const result = await processor.invokeJson("resize", { width: 800 })
|
|
165
165
|
* ```
|
|
166
166
|
*/
|
|
167
|
-
export async function
|
|
168
|
-
return (await getGlobalContext()).
|
|
167
|
+
export async function worker(name: string): Promise<WorkerBinding> {
|
|
168
|
+
return (await getGlobalContext()).worker(name)
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
/**
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @alienplatform/sdk - TypeScript SDK for Alien bindings.
|
|
3
3
|
*
|
|
4
4
|
* This package provides type-safe access to Alien resources including
|
|
5
|
-
* Storage, KV, Queue, Vault, Build, ArtifactRegistry,
|
|
5
|
+
* Storage, KV, Queue, Vault, Build, ArtifactRegistry, Worker, and ServiceAccount.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
export { AlienContext } from "./context.js"
|
|
30
30
|
|
|
31
31
|
// ============================================================================
|
|
32
|
-
// Global Convenience
|
|
32
|
+
// Global Convenience Bindings
|
|
33
33
|
// ============================================================================
|
|
34
34
|
|
|
35
35
|
export {
|
|
@@ -40,7 +40,7 @@ export {
|
|
|
40
40
|
vault,
|
|
41
41
|
build,
|
|
42
42
|
artifactRegistry,
|
|
43
|
-
|
|
43
|
+
worker,
|
|
44
44
|
serviceAccount,
|
|
45
45
|
// Event handlers
|
|
46
46
|
onStorageEvent,
|
|
@@ -71,7 +71,7 @@ export { Queue } from "./bindings/queue.js"
|
|
|
71
71
|
export { Vault } from "./bindings/vault.js"
|
|
72
72
|
export { Build } from "./bindings/build.js"
|
|
73
73
|
export { ArtifactRegistry } from "./bindings/artifact-registry.js"
|
|
74
|
-
export {
|
|
74
|
+
export { WorkerBinding } from "./bindings/worker.js"
|
|
75
75
|
export { ServiceAccount } from "./bindings/service-account.js"
|
|
76
76
|
|
|
77
77
|
// ============================================================================
|
|
@@ -99,14 +99,15 @@ export type {
|
|
|
99
99
|
ArtifactRegistryPermissions,
|
|
100
100
|
RepositoryInfo,
|
|
101
101
|
ArtifactRegistryCredentials,
|
|
102
|
+
RegistryAuthMethod,
|
|
102
103
|
ComputeServiceType,
|
|
103
104
|
AwsCrossAccountAccess,
|
|
104
105
|
GcpCrossAccountAccess,
|
|
105
106
|
CrossAccountAccess,
|
|
106
107
|
CrossAccountPermissions,
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
// Worker
|
|
109
|
+
WorkerInvokeRequest,
|
|
110
|
+
WorkerInvokeResponse,
|
|
110
111
|
// Service Account
|
|
111
112
|
ServiceAccountInfo,
|
|
112
113
|
AwsServiceAccountInfo,
|