modal 0.3.19 → 0.3.21
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/dist/index.cjs +389 -75
- package/dist/index.d.cts +79 -73
- package/dist/index.d.ts +79 -73
- package/dist/index.js +389 -75
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,7 @@ __export(index_exports, {
|
|
|
59
59
|
module.exports = __toCommonJS(index_exports);
|
|
60
60
|
|
|
61
61
|
// src/app.ts
|
|
62
|
-
var
|
|
62
|
+
var import_nice_grpc6 = require("nice-grpc");
|
|
63
63
|
|
|
64
64
|
// node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js
|
|
65
65
|
function varint64read() {
|
|
@@ -6520,6 +6520,104 @@ var AutoscalerSettings = {
|
|
|
6520
6520
|
return message;
|
|
6521
6521
|
}
|
|
6522
6522
|
};
|
|
6523
|
+
function createBaseAutoscalingMetrics() {
|
|
6524
|
+
return { cpuUsagePercent: 0, memoryUsagePercent: 0, concurrentRequests: 0, timestamp: 0 };
|
|
6525
|
+
}
|
|
6526
|
+
var AutoscalingMetrics = {
|
|
6527
|
+
encode(message, writer = new BinaryWriter()) {
|
|
6528
|
+
if (message.cpuUsagePercent !== 0) {
|
|
6529
|
+
writer.uint32(9).double(message.cpuUsagePercent);
|
|
6530
|
+
}
|
|
6531
|
+
if (message.memoryUsagePercent !== 0) {
|
|
6532
|
+
writer.uint32(17).double(message.memoryUsagePercent);
|
|
6533
|
+
}
|
|
6534
|
+
if (message.concurrentRequests !== 0) {
|
|
6535
|
+
writer.uint32(24).uint32(message.concurrentRequests);
|
|
6536
|
+
}
|
|
6537
|
+
if (message.timestamp !== 0) {
|
|
6538
|
+
writer.uint32(33).double(message.timestamp);
|
|
6539
|
+
}
|
|
6540
|
+
return writer;
|
|
6541
|
+
},
|
|
6542
|
+
decode(input, length) {
|
|
6543
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
6544
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
6545
|
+
const message = createBaseAutoscalingMetrics();
|
|
6546
|
+
while (reader.pos < end) {
|
|
6547
|
+
const tag = reader.uint32();
|
|
6548
|
+
switch (tag >>> 3) {
|
|
6549
|
+
case 1: {
|
|
6550
|
+
if (tag !== 9) {
|
|
6551
|
+
break;
|
|
6552
|
+
}
|
|
6553
|
+
message.cpuUsagePercent = reader.double();
|
|
6554
|
+
continue;
|
|
6555
|
+
}
|
|
6556
|
+
case 2: {
|
|
6557
|
+
if (tag !== 17) {
|
|
6558
|
+
break;
|
|
6559
|
+
}
|
|
6560
|
+
message.memoryUsagePercent = reader.double();
|
|
6561
|
+
continue;
|
|
6562
|
+
}
|
|
6563
|
+
case 3: {
|
|
6564
|
+
if (tag !== 24) {
|
|
6565
|
+
break;
|
|
6566
|
+
}
|
|
6567
|
+
message.concurrentRequests = reader.uint32();
|
|
6568
|
+
continue;
|
|
6569
|
+
}
|
|
6570
|
+
case 4: {
|
|
6571
|
+
if (tag !== 33) {
|
|
6572
|
+
break;
|
|
6573
|
+
}
|
|
6574
|
+
message.timestamp = reader.double();
|
|
6575
|
+
continue;
|
|
6576
|
+
}
|
|
6577
|
+
}
|
|
6578
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6579
|
+
break;
|
|
6580
|
+
}
|
|
6581
|
+
reader.skip(tag & 7);
|
|
6582
|
+
}
|
|
6583
|
+
return message;
|
|
6584
|
+
},
|
|
6585
|
+
fromJSON(object) {
|
|
6586
|
+
return {
|
|
6587
|
+
cpuUsagePercent: isSet3(object.cpuUsagePercent) ? globalThis.Number(object.cpuUsagePercent) : 0,
|
|
6588
|
+
memoryUsagePercent: isSet3(object.memoryUsagePercent) ? globalThis.Number(object.memoryUsagePercent) : 0,
|
|
6589
|
+
concurrentRequests: isSet3(object.concurrentRequests) ? globalThis.Number(object.concurrentRequests) : 0,
|
|
6590
|
+
timestamp: isSet3(object.timestamp) ? globalThis.Number(object.timestamp) : 0
|
|
6591
|
+
};
|
|
6592
|
+
},
|
|
6593
|
+
toJSON(message) {
|
|
6594
|
+
const obj = {};
|
|
6595
|
+
if (message.cpuUsagePercent !== 0) {
|
|
6596
|
+
obj.cpuUsagePercent = message.cpuUsagePercent;
|
|
6597
|
+
}
|
|
6598
|
+
if (message.memoryUsagePercent !== 0) {
|
|
6599
|
+
obj.memoryUsagePercent = message.memoryUsagePercent;
|
|
6600
|
+
}
|
|
6601
|
+
if (message.concurrentRequests !== 0) {
|
|
6602
|
+
obj.concurrentRequests = Math.round(message.concurrentRequests);
|
|
6603
|
+
}
|
|
6604
|
+
if (message.timestamp !== 0) {
|
|
6605
|
+
obj.timestamp = message.timestamp;
|
|
6606
|
+
}
|
|
6607
|
+
return obj;
|
|
6608
|
+
},
|
|
6609
|
+
create(base) {
|
|
6610
|
+
return AutoscalingMetrics.fromPartial(base ?? {});
|
|
6611
|
+
},
|
|
6612
|
+
fromPartial(object) {
|
|
6613
|
+
const message = createBaseAutoscalingMetrics();
|
|
6614
|
+
message.cpuUsagePercent = object.cpuUsagePercent ?? 0;
|
|
6615
|
+
message.memoryUsagePercent = object.memoryUsagePercent ?? 0;
|
|
6616
|
+
message.concurrentRequests = object.concurrentRequests ?? 0;
|
|
6617
|
+
message.timestamp = object.timestamp ?? 0;
|
|
6618
|
+
return message;
|
|
6619
|
+
}
|
|
6620
|
+
};
|
|
6523
6621
|
function createBaseBaseImage() {
|
|
6524
6622
|
return { imageId: "", dockerTag: "" };
|
|
6525
6623
|
}
|
|
@@ -19689,7 +19787,8 @@ function createBaseFunctionHandleMetadata() {
|
|
|
19689
19787
|
functionSchema: void 0,
|
|
19690
19788
|
inputPlaneUrl: void 0,
|
|
19691
19789
|
inputPlaneRegion: void 0,
|
|
19692
|
-
maxObjectSizeBytes: void 0
|
|
19790
|
+
maxObjectSizeBytes: void 0,
|
|
19791
|
+
ExperimentalFlashUrls: []
|
|
19693
19792
|
};
|
|
19694
19793
|
}
|
|
19695
19794
|
var FunctionHandleMetadata = {
|
|
@@ -19733,6 +19832,9 @@ var FunctionHandleMetadata = {
|
|
|
19733
19832
|
if (message.maxObjectSizeBytes !== void 0) {
|
|
19734
19833
|
writer.uint32(384).uint64(message.maxObjectSizeBytes);
|
|
19735
19834
|
}
|
|
19835
|
+
for (const v of message.ExperimentalFlashUrls) {
|
|
19836
|
+
writer.uint32(394).string(v);
|
|
19837
|
+
}
|
|
19736
19838
|
return writer;
|
|
19737
19839
|
},
|
|
19738
19840
|
decode(input, length) {
|
|
@@ -19836,6 +19938,13 @@ var FunctionHandleMetadata = {
|
|
|
19836
19938
|
message.maxObjectSizeBytes = longToNumber(reader.uint64());
|
|
19837
19939
|
continue;
|
|
19838
19940
|
}
|
|
19941
|
+
case 49: {
|
|
19942
|
+
if (tag !== 394) {
|
|
19943
|
+
break;
|
|
19944
|
+
}
|
|
19945
|
+
message.ExperimentalFlashUrls.push(reader.string());
|
|
19946
|
+
continue;
|
|
19947
|
+
}
|
|
19839
19948
|
}
|
|
19840
19949
|
if ((tag & 7) === 4 || tag === 0) {
|
|
19841
19950
|
break;
|
|
@@ -19864,7 +19973,8 @@ var FunctionHandleMetadata = {
|
|
|
19864
19973
|
functionSchema: isSet3(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0,
|
|
19865
19974
|
inputPlaneUrl: isSet3(object.inputPlaneUrl) ? globalThis.String(object.inputPlaneUrl) : void 0,
|
|
19866
19975
|
inputPlaneRegion: isSet3(object.inputPlaneRegion) ? globalThis.String(object.inputPlaneRegion) : void 0,
|
|
19867
|
-
maxObjectSizeBytes: isSet3(object.maxObjectSizeBytes) ? globalThis.Number(object.maxObjectSizeBytes) : void 0
|
|
19976
|
+
maxObjectSizeBytes: isSet3(object.maxObjectSizeBytes) ? globalThis.Number(object.maxObjectSizeBytes) : void 0,
|
|
19977
|
+
ExperimentalFlashUrls: globalThis.Array.isArray(object?.ExperimentalFlashUrls) ? object.ExperimentalFlashUrls.map((e) => globalThis.String(e)) : []
|
|
19868
19978
|
};
|
|
19869
19979
|
},
|
|
19870
19980
|
toJSON(message) {
|
|
@@ -19914,6 +20024,9 @@ var FunctionHandleMetadata = {
|
|
|
19914
20024
|
if (message.maxObjectSizeBytes !== void 0) {
|
|
19915
20025
|
obj.maxObjectSizeBytes = Math.round(message.maxObjectSizeBytes);
|
|
19916
20026
|
}
|
|
20027
|
+
if (message.ExperimentalFlashUrls?.length) {
|
|
20028
|
+
obj.ExperimentalFlashUrls = message.ExperimentalFlashUrls;
|
|
20029
|
+
}
|
|
19917
20030
|
return obj;
|
|
19918
20031
|
},
|
|
19919
20032
|
create(base) {
|
|
@@ -19939,6 +20052,7 @@ var FunctionHandleMetadata = {
|
|
|
19939
20052
|
message.inputPlaneUrl = object.inputPlaneUrl ?? void 0;
|
|
19940
20053
|
message.inputPlaneRegion = object.inputPlaneRegion ?? void 0;
|
|
19941
20054
|
message.maxObjectSizeBytes = object.maxObjectSizeBytes ?? void 0;
|
|
20055
|
+
message.ExperimentalFlashUrls = object.ExperimentalFlashUrls?.map((e) => e) || [];
|
|
19942
20056
|
return message;
|
|
19943
20057
|
}
|
|
19944
20058
|
};
|
|
@@ -23001,6 +23115,57 @@ var ImageContextFile = {
|
|
|
23001
23115
|
return message;
|
|
23002
23116
|
}
|
|
23003
23117
|
};
|
|
23118
|
+
function createBaseImageDeleteRequest() {
|
|
23119
|
+
return { imageId: "" };
|
|
23120
|
+
}
|
|
23121
|
+
var ImageDeleteRequest = {
|
|
23122
|
+
encode(message, writer = new BinaryWriter()) {
|
|
23123
|
+
if (message.imageId !== "") {
|
|
23124
|
+
writer.uint32(10).string(message.imageId);
|
|
23125
|
+
}
|
|
23126
|
+
return writer;
|
|
23127
|
+
},
|
|
23128
|
+
decode(input, length) {
|
|
23129
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
23130
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
23131
|
+
const message = createBaseImageDeleteRequest();
|
|
23132
|
+
while (reader.pos < end) {
|
|
23133
|
+
const tag = reader.uint32();
|
|
23134
|
+
switch (tag >>> 3) {
|
|
23135
|
+
case 1: {
|
|
23136
|
+
if (tag !== 10) {
|
|
23137
|
+
break;
|
|
23138
|
+
}
|
|
23139
|
+
message.imageId = reader.string();
|
|
23140
|
+
continue;
|
|
23141
|
+
}
|
|
23142
|
+
}
|
|
23143
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
23144
|
+
break;
|
|
23145
|
+
}
|
|
23146
|
+
reader.skip(tag & 7);
|
|
23147
|
+
}
|
|
23148
|
+
return message;
|
|
23149
|
+
},
|
|
23150
|
+
fromJSON(object) {
|
|
23151
|
+
return { imageId: isSet3(object.imageId) ? globalThis.String(object.imageId) : "" };
|
|
23152
|
+
},
|
|
23153
|
+
toJSON(message) {
|
|
23154
|
+
const obj = {};
|
|
23155
|
+
if (message.imageId !== "") {
|
|
23156
|
+
obj.imageId = message.imageId;
|
|
23157
|
+
}
|
|
23158
|
+
return obj;
|
|
23159
|
+
},
|
|
23160
|
+
create(base) {
|
|
23161
|
+
return ImageDeleteRequest.fromPartial(base ?? {});
|
|
23162
|
+
},
|
|
23163
|
+
fromPartial(object) {
|
|
23164
|
+
const message = createBaseImageDeleteRequest();
|
|
23165
|
+
message.imageId = object.imageId ?? "";
|
|
23166
|
+
return message;
|
|
23167
|
+
}
|
|
23168
|
+
};
|
|
23004
23169
|
function createBaseImageFromIdRequest() {
|
|
23005
23170
|
return { imageId: "" };
|
|
23006
23171
|
}
|
|
@@ -35006,6 +35171,108 @@ var TaskCurrentInputsResponse = {
|
|
|
35006
35171
|
return message;
|
|
35007
35172
|
}
|
|
35008
35173
|
};
|
|
35174
|
+
function createBaseTaskGetAutoscalingMetricsRequest() {
|
|
35175
|
+
return { taskId: "" };
|
|
35176
|
+
}
|
|
35177
|
+
var TaskGetAutoscalingMetricsRequest = {
|
|
35178
|
+
encode(message, writer = new BinaryWriter()) {
|
|
35179
|
+
if (message.taskId !== "") {
|
|
35180
|
+
writer.uint32(10).string(message.taskId);
|
|
35181
|
+
}
|
|
35182
|
+
return writer;
|
|
35183
|
+
},
|
|
35184
|
+
decode(input, length) {
|
|
35185
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
35186
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
35187
|
+
const message = createBaseTaskGetAutoscalingMetricsRequest();
|
|
35188
|
+
while (reader.pos < end) {
|
|
35189
|
+
const tag = reader.uint32();
|
|
35190
|
+
switch (tag >>> 3) {
|
|
35191
|
+
case 1: {
|
|
35192
|
+
if (tag !== 10) {
|
|
35193
|
+
break;
|
|
35194
|
+
}
|
|
35195
|
+
message.taskId = reader.string();
|
|
35196
|
+
continue;
|
|
35197
|
+
}
|
|
35198
|
+
}
|
|
35199
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35200
|
+
break;
|
|
35201
|
+
}
|
|
35202
|
+
reader.skip(tag & 7);
|
|
35203
|
+
}
|
|
35204
|
+
return message;
|
|
35205
|
+
},
|
|
35206
|
+
fromJSON(object) {
|
|
35207
|
+
return { taskId: isSet3(object.taskId) ? globalThis.String(object.taskId) : "" };
|
|
35208
|
+
},
|
|
35209
|
+
toJSON(message) {
|
|
35210
|
+
const obj = {};
|
|
35211
|
+
if (message.taskId !== "") {
|
|
35212
|
+
obj.taskId = message.taskId;
|
|
35213
|
+
}
|
|
35214
|
+
return obj;
|
|
35215
|
+
},
|
|
35216
|
+
create(base) {
|
|
35217
|
+
return TaskGetAutoscalingMetricsRequest.fromPartial(base ?? {});
|
|
35218
|
+
},
|
|
35219
|
+
fromPartial(object) {
|
|
35220
|
+
const message = createBaseTaskGetAutoscalingMetricsRequest();
|
|
35221
|
+
message.taskId = object.taskId ?? "";
|
|
35222
|
+
return message;
|
|
35223
|
+
}
|
|
35224
|
+
};
|
|
35225
|
+
function createBaseTaskGetAutoscalingMetricsResponse() {
|
|
35226
|
+
return { metrics: void 0 };
|
|
35227
|
+
}
|
|
35228
|
+
var TaskGetAutoscalingMetricsResponse = {
|
|
35229
|
+
encode(message, writer = new BinaryWriter()) {
|
|
35230
|
+
if (message.metrics !== void 0) {
|
|
35231
|
+
AutoscalingMetrics.encode(message.metrics, writer.uint32(10).fork()).join();
|
|
35232
|
+
}
|
|
35233
|
+
return writer;
|
|
35234
|
+
},
|
|
35235
|
+
decode(input, length) {
|
|
35236
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
35237
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
35238
|
+
const message = createBaseTaskGetAutoscalingMetricsResponse();
|
|
35239
|
+
while (reader.pos < end) {
|
|
35240
|
+
const tag = reader.uint32();
|
|
35241
|
+
switch (tag >>> 3) {
|
|
35242
|
+
case 1: {
|
|
35243
|
+
if (tag !== 10) {
|
|
35244
|
+
break;
|
|
35245
|
+
}
|
|
35246
|
+
message.metrics = AutoscalingMetrics.decode(reader, reader.uint32());
|
|
35247
|
+
continue;
|
|
35248
|
+
}
|
|
35249
|
+
}
|
|
35250
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35251
|
+
break;
|
|
35252
|
+
}
|
|
35253
|
+
reader.skip(tag & 7);
|
|
35254
|
+
}
|
|
35255
|
+
return message;
|
|
35256
|
+
},
|
|
35257
|
+
fromJSON(object) {
|
|
35258
|
+
return { metrics: isSet3(object.metrics) ? AutoscalingMetrics.fromJSON(object.metrics) : void 0 };
|
|
35259
|
+
},
|
|
35260
|
+
toJSON(message) {
|
|
35261
|
+
const obj = {};
|
|
35262
|
+
if (message.metrics !== void 0) {
|
|
35263
|
+
obj.metrics = AutoscalingMetrics.toJSON(message.metrics);
|
|
35264
|
+
}
|
|
35265
|
+
return obj;
|
|
35266
|
+
},
|
|
35267
|
+
create(base) {
|
|
35268
|
+
return TaskGetAutoscalingMetricsResponse.fromPartial(base ?? {});
|
|
35269
|
+
},
|
|
35270
|
+
fromPartial(object) {
|
|
35271
|
+
const message = createBaseTaskGetAutoscalingMetricsResponse();
|
|
35272
|
+
message.metrics = object.metrics !== void 0 && object.metrics !== null ? AutoscalingMetrics.fromPartial(object.metrics) : void 0;
|
|
35273
|
+
return message;
|
|
35274
|
+
}
|
|
35275
|
+
};
|
|
35009
35276
|
function createBaseTaskInfo() {
|
|
35010
35277
|
return {
|
|
35011
35278
|
id: "",
|
|
@@ -40438,6 +40705,14 @@ var ModalClientDefinition = {
|
|
|
40438
40705
|
options: {}
|
|
40439
40706
|
},
|
|
40440
40707
|
/** Images */
|
|
40708
|
+
imageDelete: {
|
|
40709
|
+
name: "ImageDelete",
|
|
40710
|
+
requestType: ImageDeleteRequest,
|
|
40711
|
+
requestStream: false,
|
|
40712
|
+
responseType: Empty,
|
|
40713
|
+
responseStream: false,
|
|
40714
|
+
options: {}
|
|
40715
|
+
},
|
|
40441
40716
|
imageFromId: {
|
|
40442
40717
|
name: "ImageFromId",
|
|
40443
40718
|
requestType: ImageFromIdRequest,
|
|
@@ -40904,6 +41179,15 @@ var ModalClientDefinition = {
|
|
|
40904
41179
|
responseStream: false,
|
|
40905
41180
|
options: {}
|
|
40906
41181
|
},
|
|
41182
|
+
/** Used for flash autoscaling */
|
|
41183
|
+
taskGetAutoscalingMetrics: {
|
|
41184
|
+
name: "TaskGetAutoscalingMetrics",
|
|
41185
|
+
requestType: TaskGetAutoscalingMetricsRequest,
|
|
41186
|
+
requestStream: false,
|
|
41187
|
+
responseType: TaskGetAutoscalingMetricsResponse,
|
|
41188
|
+
responseStream: false,
|
|
41189
|
+
options: {}
|
|
41190
|
+
},
|
|
40907
41191
|
taskList: {
|
|
40908
41192
|
name: "TaskList",
|
|
40909
41193
|
requestType: TaskListRequest,
|
|
@@ -41482,6 +41766,8 @@ var Secret = class _Secret {
|
|
|
41482
41766
|
};
|
|
41483
41767
|
|
|
41484
41768
|
// src/image.ts
|
|
41769
|
+
var import_nice_grpc3 = require("nice-grpc");
|
|
41770
|
+
var import_nice_grpc4 = require("nice-grpc");
|
|
41485
41771
|
var Image2 = class _Image {
|
|
41486
41772
|
#imageId;
|
|
41487
41773
|
#tag;
|
|
@@ -41496,18 +41782,27 @@ var Image2 = class _Image {
|
|
|
41496
41782
|
return this.#imageId;
|
|
41497
41783
|
}
|
|
41498
41784
|
/**
|
|
41499
|
-
* Creates an
|
|
41785
|
+
* Creates an Image from an Image ID
|
|
41500
41786
|
*
|
|
41501
|
-
* @param imageId - Image
|
|
41787
|
+
* @param imageId - Image ID.
|
|
41502
41788
|
*/
|
|
41503
|
-
static fromId(imageId) {
|
|
41504
|
-
|
|
41789
|
+
static async fromId(imageId) {
|
|
41790
|
+
try {
|
|
41791
|
+
const resp = await client.imageFromId({ imageId });
|
|
41792
|
+
return new _Image(resp.imageId, "");
|
|
41793
|
+
} catch (err) {
|
|
41794
|
+
if (err instanceof import_nice_grpc3.ClientError && err.code === import_nice_grpc4.Status.NOT_FOUND)
|
|
41795
|
+
throw new NotFoundError(err.details);
|
|
41796
|
+
if (err instanceof import_nice_grpc3.ClientError && err.code === import_nice_grpc4.Status.FAILED_PRECONDITION && err.details.includes("Could not find image with ID"))
|
|
41797
|
+
throw new NotFoundError(err.details);
|
|
41798
|
+
throw err;
|
|
41799
|
+
}
|
|
41505
41800
|
}
|
|
41506
41801
|
/**
|
|
41507
|
-
* Creates an
|
|
41802
|
+
* Creates an Image from a raw registry tag, optionally using a Secret for authentication.
|
|
41508
41803
|
*
|
|
41509
|
-
* @param tag - The registry tag for the
|
|
41510
|
-
* @param secret - Optional. A
|
|
41804
|
+
* @param tag - The registry tag for the Image.
|
|
41805
|
+
* @param secret - Optional. A Secret containing credentials for registry authentication.
|
|
41511
41806
|
*/
|
|
41512
41807
|
static fromRegistry(tag, secret) {
|
|
41513
41808
|
let imageRegistryConfig;
|
|
@@ -41525,10 +41820,10 @@ var Image2 = class _Image {
|
|
|
41525
41820
|
return new _Image("", tag, imageRegistryConfig);
|
|
41526
41821
|
}
|
|
41527
41822
|
/**
|
|
41528
|
-
* Creates an
|
|
41823
|
+
* Creates an Image from a raw registry tag, optionally using a Secret for authentication.
|
|
41529
41824
|
*
|
|
41530
|
-
* @param tag - The registry tag for the
|
|
41531
|
-
* @param secret - A
|
|
41825
|
+
* @param tag - The registry tag for the Image.
|
|
41826
|
+
* @param secret - A Secret containing credentials for registry authentication.
|
|
41532
41827
|
*/
|
|
41533
41828
|
static fromAwsEcr(tag, secret) {
|
|
41534
41829
|
let imageRegistryConfig;
|
|
@@ -41546,10 +41841,10 @@ var Image2 = class _Image {
|
|
|
41546
41841
|
return new _Image("", tag, imageRegistryConfig);
|
|
41547
41842
|
}
|
|
41548
41843
|
/**
|
|
41549
|
-
* Creates an
|
|
41844
|
+
* Creates an Image from a raw registry tag, optionally using a Secret for authentication.
|
|
41550
41845
|
*
|
|
41551
|
-
* @param tag - The registry tag for the
|
|
41552
|
-
* @param secret - A
|
|
41846
|
+
* @param tag - The registry tag for the Image.
|
|
41847
|
+
* @param secret - A Secret containing credentials for registry authentication.
|
|
41553
41848
|
*/
|
|
41554
41849
|
static fromGcpArtifactRegistry(tag, secret) {
|
|
41555
41850
|
let imageRegistryConfig;
|
|
@@ -41567,9 +41862,9 @@ var Image2 = class _Image {
|
|
|
41567
41862
|
return new _Image("", tag, imageRegistryConfig);
|
|
41568
41863
|
}
|
|
41569
41864
|
/**
|
|
41570
|
-
* Eagerly builds an
|
|
41865
|
+
* Eagerly builds an Image on Modal.
|
|
41571
41866
|
*
|
|
41572
|
-
* @param app - App to use to build
|
|
41867
|
+
* @param app - App to use to build the Image.
|
|
41573
41868
|
*/
|
|
41574
41869
|
async build(app) {
|
|
41575
41870
|
if (this.imageId !== "") {
|
|
@@ -41629,10 +41924,15 @@ ${result.exception}`
|
|
|
41629
41924
|
this.#imageId = resp.imageId;
|
|
41630
41925
|
return this;
|
|
41631
41926
|
}
|
|
41927
|
+
/** Delete an Image by ID. Warning: This removes an *entire Image*, and cannot be undone. */
|
|
41928
|
+
static async delete(imageId, _ = {}) {
|
|
41929
|
+
const image = await _Image.fromId(imageId);
|
|
41930
|
+
await client.imageDelete({ imageId: image.imageId });
|
|
41931
|
+
}
|
|
41632
41932
|
};
|
|
41633
41933
|
|
|
41634
41934
|
// src/sandbox.ts
|
|
41635
|
-
var
|
|
41935
|
+
var import_nice_grpc5 = require("nice-grpc");
|
|
41636
41936
|
|
|
41637
41937
|
// src/sandbox_filesystem.ts
|
|
41638
41938
|
var SandboxFile = class {
|
|
@@ -41910,7 +42210,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
41910
42210
|
tags: tagsList
|
|
41911
42211
|
});
|
|
41912
42212
|
} catch (err) {
|
|
41913
|
-
if (err instanceof
|
|
42213
|
+
if (err instanceof import_nice_grpc5.ClientError && err.code === import_nice_grpc5.Status.INVALID_ARGUMENT) {
|
|
41914
42214
|
throw new InvalidError(err.details || err.message);
|
|
41915
42215
|
}
|
|
41916
42216
|
throw err;
|
|
@@ -41927,7 +42227,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
41927
42227
|
timeout: 0
|
|
41928
42228
|
});
|
|
41929
42229
|
} catch (err) {
|
|
41930
|
-
if (err instanceof
|
|
42230
|
+
if (err instanceof import_nice_grpc5.ClientError && err.code === import_nice_grpc5.Status.NOT_FOUND)
|
|
41931
42231
|
throw new NotFoundError(`Sandbox with id: '${sandboxId}' not found`);
|
|
41932
42232
|
throw err;
|
|
41933
42233
|
}
|
|
@@ -41938,8 +42238,8 @@ var Sandbox2 = class _Sandbox {
|
|
|
41938
42238
|
* Raises a NotFoundError if no running Sandbox is found with the given name.
|
|
41939
42239
|
* A Sandbox's name is the `name` argument passed to `App.createSandbox`.
|
|
41940
42240
|
*
|
|
41941
|
-
* @param appName - Name of the deployed
|
|
41942
|
-
* @param name - Name of the
|
|
42241
|
+
* @param appName - Name of the deployed App
|
|
42242
|
+
* @param name - Name of the Sandbox
|
|
41943
42243
|
* @param environment - Optional override for the environment
|
|
41944
42244
|
* @returns Promise that resolves to a Sandbox
|
|
41945
42245
|
*/
|
|
@@ -41952,15 +42252,15 @@ var Sandbox2 = class _Sandbox {
|
|
|
41952
42252
|
});
|
|
41953
42253
|
return new _Sandbox(resp.sandboxId);
|
|
41954
42254
|
} catch (err) {
|
|
41955
|
-
if (err instanceof
|
|
42255
|
+
if (err instanceof import_nice_grpc5.ClientError && err.code === import_nice_grpc5.Status.NOT_FOUND)
|
|
41956
42256
|
throw new NotFoundError(
|
|
41957
|
-
`Sandbox with name '${name}' not found in
|
|
42257
|
+
`Sandbox with name '${name}' not found in App '${appName}'`
|
|
41958
42258
|
);
|
|
41959
42259
|
throw err;
|
|
41960
42260
|
}
|
|
41961
42261
|
}
|
|
41962
42262
|
/**
|
|
41963
|
-
* Open a file in the
|
|
42263
|
+
* Open a file in the Sandbox filesystem.
|
|
41964
42264
|
* @param path - Path to the file to open
|
|
41965
42265
|
* @param mode - File open mode (r, w, a, r+, w+, a+)
|
|
41966
42266
|
* @returns Promise that resolves to a SandboxFile
|
|
@@ -42023,7 +42323,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
42023
42323
|
}
|
|
42024
42324
|
}
|
|
42025
42325
|
}
|
|
42026
|
-
/** Get Tunnel metadata for the
|
|
42326
|
+
/** Get Tunnel metadata for the Sandbox.
|
|
42027
42327
|
*
|
|
42028
42328
|
* Raises `SandboxTimeoutError` if the tunnels are not available after the timeout.
|
|
42029
42329
|
*
|
|
@@ -42071,7 +42371,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
42071
42371
|
);
|
|
42072
42372
|
}
|
|
42073
42373
|
if (!resp.imageId) {
|
|
42074
|
-
throw new Error("Sandbox snapshot response missing
|
|
42374
|
+
throw new Error("Sandbox snapshot response missing `imageId`");
|
|
42075
42375
|
}
|
|
42076
42376
|
return new Image2(resp.imageId, "");
|
|
42077
42377
|
}
|
|
@@ -42115,7 +42415,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
42115
42415
|
}
|
|
42116
42416
|
beforeTimestamp = resp.sandboxes[resp.sandboxes.length - 1].createdAt;
|
|
42117
42417
|
} catch (err) {
|
|
42118
|
-
if (err instanceof
|
|
42418
|
+
if (err instanceof import_nice_grpc5.ClientError && err.code === import_nice_grpc5.Status.INVALID_ARGUMENT) {
|
|
42119
42419
|
throw new InvalidError(err.details || err.message);
|
|
42120
42420
|
}
|
|
42121
42421
|
throw err;
|
|
@@ -42381,7 +42681,7 @@ var App = class _App {
|
|
|
42381
42681
|
this.appId = appId;
|
|
42382
42682
|
this.name = name;
|
|
42383
42683
|
}
|
|
42384
|
-
/** Lookup a deployed
|
|
42684
|
+
/** Lookup a deployed App by name, or create if it does not exist. */
|
|
42385
42685
|
static async lookup(name, options = {}) {
|
|
42386
42686
|
try {
|
|
42387
42687
|
const resp = await client.appGetOrCreate({
|
|
@@ -42391,7 +42691,7 @@ var App = class _App {
|
|
|
42391
42691
|
});
|
|
42392
42692
|
return new _App(resp.appId, name);
|
|
42393
42693
|
} catch (err) {
|
|
42394
|
-
if (err instanceof
|
|
42694
|
+
if (err instanceof import_nice_grpc6.ClientError && err.code === import_nice_grpc6.Status.NOT_FOUND)
|
|
42395
42695
|
throw new NotFoundError(`App '${name}' not found`);
|
|
42396
42696
|
throw err;
|
|
42397
42697
|
}
|
|
@@ -42400,7 +42700,12 @@ var App = class _App {
|
|
|
42400
42700
|
const gpuConfig = parseGpuConfig(options.gpu);
|
|
42401
42701
|
if (options.timeout && options.timeout % 1e3 !== 0) {
|
|
42402
42702
|
throw new Error(
|
|
42403
|
-
`
|
|
42703
|
+
`timeout must be a multiple of 1000ms, got ${options.timeout}`
|
|
42704
|
+
);
|
|
42705
|
+
}
|
|
42706
|
+
if (options.idleTimeout && options.idleTimeout % 1e3 !== 0) {
|
|
42707
|
+
throw new Error(
|
|
42708
|
+
`idleTimeout must be a multiple of 1000ms, got ${options.idleTimeout}`
|
|
42404
42709
|
);
|
|
42405
42710
|
}
|
|
42406
42711
|
await image.build(this);
|
|
@@ -42479,6 +42784,7 @@ var App = class _App {
|
|
|
42479
42784
|
entrypointArgs: options.command ?? ["sleep", "48h"],
|
|
42480
42785
|
imageId: image.imageId,
|
|
42481
42786
|
timeoutSecs: options.timeout != void 0 ? options.timeout / 1e3 : 600,
|
|
42787
|
+
idleTimeoutSecs: options.idleTimeout != void 0 ? options.idleTimeout / 1e3 : void 0,
|
|
42482
42788
|
workdir: options.workdir ?? void 0,
|
|
42483
42789
|
networkAccess,
|
|
42484
42790
|
resources: {
|
|
@@ -42499,7 +42805,7 @@ var App = class _App {
|
|
|
42499
42805
|
}
|
|
42500
42806
|
});
|
|
42501
42807
|
} catch (err) {
|
|
42502
|
-
if (err instanceof
|
|
42808
|
+
if (err instanceof import_nice_grpc6.ClientError && err.code === import_nice_grpc6.Status.ALREADY_EXISTS) {
|
|
42503
42809
|
throw new AlreadyExistsError(err.details || err.message);
|
|
42504
42810
|
}
|
|
42505
42811
|
throw err;
|
|
@@ -42527,7 +42833,7 @@ var App = class _App {
|
|
|
42527
42833
|
};
|
|
42528
42834
|
|
|
42529
42835
|
// src/cls.ts
|
|
42530
|
-
var
|
|
42836
|
+
var import_nice_grpc8 = require("nice-grpc");
|
|
42531
42837
|
|
|
42532
42838
|
// src/function.ts
|
|
42533
42839
|
var import_node_crypto = require("crypto");
|
|
@@ -42693,7 +42999,9 @@ function encodeValue(val, w, proto) {
|
|
|
42693
42999
|
}
|
|
42694
43000
|
return;
|
|
42695
43001
|
}
|
|
42696
|
-
throw new PickleError(
|
|
43002
|
+
throw new PickleError(
|
|
43003
|
+
`The JS Modal SDK does not support encoding/pickling data of type ${typeof val}`
|
|
43004
|
+
);
|
|
42697
43005
|
}
|
|
42698
43006
|
function maybeMemoize(w, proto) {
|
|
42699
43007
|
if (proto >= 4) {
|
|
@@ -42702,7 +43010,9 @@ function maybeMemoize(w, proto) {
|
|
|
42702
43010
|
}
|
|
42703
43011
|
function dumps(obj, protocol = 4) {
|
|
42704
43012
|
if (![3, 4, 5].includes(protocol))
|
|
42705
|
-
throw new PickleError(
|
|
43013
|
+
throw new PickleError(
|
|
43014
|
+
`The JS Modal SDK does not support pickle protocol version ${protocol}`
|
|
43015
|
+
);
|
|
42706
43016
|
const w = new Writer();
|
|
42707
43017
|
w.byte(128 /* PROTO */);
|
|
42708
43018
|
w.byte(protocol);
|
|
@@ -42719,8 +43029,10 @@ function loads(buf) {
|
|
|
42719
43029
|
const op0 = r.byte();
|
|
42720
43030
|
if (op0 !== 128 /* PROTO */) throw new PickleError("pickle missing PROTO header");
|
|
42721
43031
|
const proto = r.byte();
|
|
42722
|
-
if (!
|
|
42723
|
-
throw new PickleError(
|
|
43032
|
+
if (![3, 4, 5].includes(proto))
|
|
43033
|
+
throw new PickleError(
|
|
43034
|
+
`The JS Modal SDK does not support pickle protocol version ${proto}`
|
|
43035
|
+
);
|
|
42724
43036
|
const stack = [];
|
|
42725
43037
|
const memo = [];
|
|
42726
43038
|
const tdec = new TextDecoder();
|
|
@@ -42873,7 +43185,9 @@ function loads(buf) {
|
|
|
42873
43185
|
break;
|
|
42874
43186
|
}
|
|
42875
43187
|
default:
|
|
42876
|
-
throw new PickleError(
|
|
43188
|
+
throw new PickleError(
|
|
43189
|
+
`The JS Modal SDK does not support decoding/unpickling this kind of data. Error: unsupported opcode 0x${op.toString(16)}`
|
|
43190
|
+
);
|
|
42877
43191
|
}
|
|
42878
43192
|
}
|
|
42879
43193
|
throw new PickleError("pickle stream ended without STOP");
|
|
@@ -42933,7 +43247,7 @@ var ControlPlaneInvocation = class _ControlPlaneInvocation {
|
|
|
42933
43247
|
}
|
|
42934
43248
|
async retry(retryCount) {
|
|
42935
43249
|
if (!this.input) {
|
|
42936
|
-
throw new Error("Cannot retry
|
|
43250
|
+
throw new Error("Cannot retry Function invocation - input missing");
|
|
42937
43251
|
}
|
|
42938
43252
|
const retryItem = {
|
|
42939
43253
|
inputJwt: this.inputJwt,
|
|
@@ -43076,11 +43390,11 @@ var FunctionCall = class _FunctionCall {
|
|
|
43076
43390
|
constructor(functionCallId) {
|
|
43077
43391
|
this.functionCallId = functionCallId;
|
|
43078
43392
|
}
|
|
43079
|
-
/** Create a new
|
|
43393
|
+
/** Create a new Function call from ID. */
|
|
43080
43394
|
fromId(functionCallId) {
|
|
43081
43395
|
return new _FunctionCall(functionCallId);
|
|
43082
43396
|
}
|
|
43083
|
-
/** Get the result of a
|
|
43397
|
+
/** Get the result of a Function call, optionally waiting with a timeout. */
|
|
43084
43398
|
async get(options = {}) {
|
|
43085
43399
|
const timeout = options.timeout;
|
|
43086
43400
|
const invocation = ControlPlaneInvocation.fromFunctionCallId(
|
|
@@ -43088,7 +43402,7 @@ var FunctionCall = class _FunctionCall {
|
|
|
43088
43402
|
);
|
|
43089
43403
|
return invocation.awaitOutput(timeout);
|
|
43090
43404
|
}
|
|
43091
|
-
/** Cancel a running
|
|
43405
|
+
/** Cancel a running Function call. */
|
|
43092
43406
|
async cancel(options = {}) {
|
|
43093
43407
|
await client.functionCallCancel({
|
|
43094
43408
|
functionCallId: this.functionCallId,
|
|
@@ -43098,7 +43412,7 @@ var FunctionCall = class _FunctionCall {
|
|
|
43098
43412
|
};
|
|
43099
43413
|
|
|
43100
43414
|
// src/function.ts
|
|
43101
|
-
var
|
|
43415
|
+
var import_nice_grpc7 = require("nice-grpc");
|
|
43102
43416
|
var maxObjectSizeBytes = 2 * 1024 * 1024;
|
|
43103
43417
|
var maxSystemRetries = 8;
|
|
43104
43418
|
var Function_ = class _Function_ {
|
|
@@ -43127,7 +43441,7 @@ var Function_ = class _Function_ {
|
|
|
43127
43441
|
resp.handleMetadata?.webUrl
|
|
43128
43442
|
);
|
|
43129
43443
|
} catch (err) {
|
|
43130
|
-
if (err instanceof
|
|
43444
|
+
if (err instanceof import_nice_grpc7.ClientError && err.code === import_nice_grpc7.Status.NOT_FOUND)
|
|
43131
43445
|
throw new NotFoundError(`Function '${appName}/${name}' not found`);
|
|
43132
43446
|
throw err;
|
|
43133
43447
|
}
|
|
@@ -43164,7 +43478,7 @@ var Function_ = class _Function_ {
|
|
|
43164
43478
|
4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */
|
|
43165
43479
|
);
|
|
43166
43480
|
}
|
|
43167
|
-
// Spawn a single input into a remote
|
|
43481
|
+
// Spawn a single input into a remote Function.
|
|
43168
43482
|
async spawn(args = [], kwargs = {}) {
|
|
43169
43483
|
const input = await this.#createInput(args, kwargs);
|
|
43170
43484
|
const invocation = await ControlPlaneInvocation.create(
|
|
@@ -43201,7 +43515,7 @@ var Function_ = class _Function_ {
|
|
|
43201
43515
|
}
|
|
43202
43516
|
/**
|
|
43203
43517
|
* URL of a Function running as a web endpoint.
|
|
43204
|
-
* @returns The web URL if this
|
|
43518
|
+
* @returns The web URL if this Function is a web endpoint, otherwise undefined
|
|
43205
43519
|
*/
|
|
43206
43520
|
async getWebUrl() {
|
|
43207
43521
|
return this.#webUrl || void 0;
|
|
@@ -43359,7 +43673,7 @@ var Cls = class _Cls {
|
|
|
43359
43673
|
void 0
|
|
43360
43674
|
);
|
|
43361
43675
|
} catch (err) {
|
|
43362
|
-
if (err instanceof
|
|
43676
|
+
if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.NOT_FOUND)
|
|
43363
43677
|
throw new NotFoundError(`Class '${appName}/${name}' not found`);
|
|
43364
43678
|
throw err;
|
|
43365
43679
|
}
|
|
@@ -43555,7 +43869,7 @@ var ClsInstance = class {
|
|
|
43555
43869
|
};
|
|
43556
43870
|
|
|
43557
43871
|
// src/queue.ts
|
|
43558
|
-
var
|
|
43872
|
+
var import_nice_grpc9 = require("nice-grpc");
|
|
43559
43873
|
|
|
43560
43874
|
// src/ephemeral.ts
|
|
43561
43875
|
var ephemeralObjectHeartbeatSleep = 3e5;
|
|
@@ -43614,8 +43928,8 @@ var Queue = class _Queue {
|
|
|
43614
43928
|
return new Uint8Array();
|
|
43615
43929
|
}
|
|
43616
43930
|
/**
|
|
43617
|
-
* Create a nameless, temporary
|
|
43618
|
-
* You will need to call `closeEphemeral()` to delete the
|
|
43931
|
+
* Create a nameless, temporary Queue.
|
|
43932
|
+
* You will need to call `closeEphemeral()` to delete the Queue.
|
|
43619
43933
|
*/
|
|
43620
43934
|
static async ephemeral(options = {}) {
|
|
43621
43935
|
const resp = await client.queueGetOrCreate({
|
|
@@ -43627,7 +43941,7 @@ var Queue = class _Queue {
|
|
|
43627
43941
|
);
|
|
43628
43942
|
return new _Queue(resp.queueId, void 0, ephemeralHbManager);
|
|
43629
43943
|
}
|
|
43630
|
-
/** Delete the ephemeral
|
|
43944
|
+
/** Delete the ephemeral Queue. Only usable with `Queue.ephemeral()`. */
|
|
43631
43945
|
closeEphemeral() {
|
|
43632
43946
|
if (this.#ephemeralHbManager) {
|
|
43633
43947
|
this.#ephemeralHbManager.stop();
|
|
@@ -43636,7 +43950,7 @@ var Queue = class _Queue {
|
|
|
43636
43950
|
}
|
|
43637
43951
|
}
|
|
43638
43952
|
/**
|
|
43639
|
-
* Lookup a
|
|
43953
|
+
* Lookup a Queue by name.
|
|
43640
43954
|
*/
|
|
43641
43955
|
static async lookup(name, options = {}) {
|
|
43642
43956
|
const resp = await client.queueGetOrCreate({
|
|
@@ -43646,13 +43960,13 @@ var Queue = class _Queue {
|
|
|
43646
43960
|
});
|
|
43647
43961
|
return new _Queue(resp.queueId, name);
|
|
43648
43962
|
}
|
|
43649
|
-
/** Delete a
|
|
43963
|
+
/** Delete a Queue by name. */
|
|
43650
43964
|
static async delete(name, options = {}) {
|
|
43651
43965
|
const queue = await _Queue.lookup(name, options);
|
|
43652
43966
|
await client.queueDelete({ queueId: queue.queueId });
|
|
43653
43967
|
}
|
|
43654
43968
|
/**
|
|
43655
|
-
* Remove all objects from a
|
|
43969
|
+
* Remove all objects from a Queue partition.
|
|
43656
43970
|
*/
|
|
43657
43971
|
async clear(options = {}) {
|
|
43658
43972
|
if (options.partition && options.all) {
|
|
@@ -43694,9 +44008,9 @@ var Queue = class _Queue {
|
|
|
43694
44008
|
}
|
|
43695
44009
|
}
|
|
43696
44010
|
/**
|
|
43697
|
-
* Remove and return the next object from the
|
|
44011
|
+
* Remove and return the next object from the Queue.
|
|
43698
44012
|
*
|
|
43699
|
-
* By default, this will wait until at least one item is present in the
|
|
44013
|
+
* By default, this will wait until at least one item is present in the Queue.
|
|
43700
44014
|
* If `timeout` is set, raises `QueueEmptyError` if no items are available
|
|
43701
44015
|
* within that timeout in milliseconds.
|
|
43702
44016
|
*/
|
|
@@ -43705,9 +44019,9 @@ var Queue = class _Queue {
|
|
|
43705
44019
|
return values[0];
|
|
43706
44020
|
}
|
|
43707
44021
|
/**
|
|
43708
|
-
* Remove and return up to `n` objects from the
|
|
44022
|
+
* Remove and return up to `n` objects from the Queue.
|
|
43709
44023
|
*
|
|
43710
|
-
* By default, this will wait until at least one item is present in the
|
|
44024
|
+
* By default, this will wait until at least one item is present in the Queue.
|
|
43711
44025
|
* If `timeout` is set, raises `QueueEmptyError` if no items are available
|
|
43712
44026
|
* within that timeout in milliseconds.
|
|
43713
44027
|
*/
|
|
@@ -43729,7 +44043,7 @@ var Queue = class _Queue {
|
|
|
43729
44043
|
});
|
|
43730
44044
|
break;
|
|
43731
44045
|
} catch (e) {
|
|
43732
|
-
if (e instanceof
|
|
44046
|
+
if (e instanceof import_nice_grpc9.ClientError && e.code === import_nice_grpc9.Status.RESOURCE_EXHAUSTED) {
|
|
43733
44047
|
delay = Math.min(delay * 2, 3e4);
|
|
43734
44048
|
if (deadline !== void 0) {
|
|
43735
44049
|
const remaining = deadline - Date.now();
|
|
@@ -43745,11 +44059,11 @@ var Queue = class _Queue {
|
|
|
43745
44059
|
}
|
|
43746
44060
|
}
|
|
43747
44061
|
/**
|
|
43748
|
-
* Add an item to the end of the
|
|
44062
|
+
* Add an item to the end of the Queue.
|
|
43749
44063
|
*
|
|
43750
|
-
* If the
|
|
44064
|
+
* If the Queue is full, this will retry with exponential backoff until the
|
|
43751
44065
|
* provided `timeout` is reached, or indefinitely if `timeout` is not set.
|
|
43752
|
-
* Raises `QueueFullError` if the
|
|
44066
|
+
* Raises `QueueFullError` if the Queue is still full after the timeout.
|
|
43753
44067
|
*/
|
|
43754
44068
|
async put(v, options = {}) {
|
|
43755
44069
|
await this.#put(
|
|
@@ -43760,11 +44074,11 @@ var Queue = class _Queue {
|
|
|
43760
44074
|
);
|
|
43761
44075
|
}
|
|
43762
44076
|
/**
|
|
43763
|
-
* Add several items to the end of the
|
|
44077
|
+
* Add several items to the end of the Queue.
|
|
43764
44078
|
*
|
|
43765
|
-
* If the
|
|
44079
|
+
* If the Queue is full, this will retry with exponential backoff until the
|
|
43766
44080
|
* provided `timeout` is reached, or indefinitely if `timeout` is not set.
|
|
43767
|
-
* Raises `QueueFullError` if the
|
|
44081
|
+
* Raises `QueueFullError` if the Queue is still full after the timeout.
|
|
43768
44082
|
*/
|
|
43769
44083
|
async putMany(values, options = {}) {
|
|
43770
44084
|
await this.#put(
|
|
@@ -43774,7 +44088,7 @@ var Queue = class _Queue {
|
|
|
43774
44088
|
options.partitionTtl
|
|
43775
44089
|
);
|
|
43776
44090
|
}
|
|
43777
|
-
/** Return the number of objects in the
|
|
44091
|
+
/** Return the number of objects in the Queue. */
|
|
43778
44092
|
async len(options = {}) {
|
|
43779
44093
|
if (options.partition && options.total) {
|
|
43780
44094
|
throw new InvalidError(
|
|
@@ -43788,7 +44102,7 @@ var Queue = class _Queue {
|
|
|
43788
44102
|
});
|
|
43789
44103
|
return resp.len;
|
|
43790
44104
|
}
|
|
43791
|
-
/** Iterate through items in a
|
|
44105
|
+
/** Iterate through items in a Queue without mutation. */
|
|
43792
44106
|
async *iterate(options = {}) {
|
|
43793
44107
|
const { partition, itemPollTimeout = 0 } = options;
|
|
43794
44108
|
let lastEntryId = void 0;
|
|
@@ -43821,7 +44135,7 @@ var Queue = class _Queue {
|
|
|
43821
44135
|
};
|
|
43822
44136
|
|
|
43823
44137
|
// src/volume.ts
|
|
43824
|
-
var
|
|
44138
|
+
var import_nice_grpc10 = require("nice-grpc");
|
|
43825
44139
|
var Volume = class _Volume {
|
|
43826
44140
|
volumeId;
|
|
43827
44141
|
name;
|
|
@@ -43843,7 +44157,7 @@ var Volume = class _Volume {
|
|
|
43843
44157
|
});
|
|
43844
44158
|
return new _Volume(resp.volumeId, name);
|
|
43845
44159
|
} catch (err) {
|
|
43846
|
-
if (err instanceof
|
|
44160
|
+
if (err instanceof import_nice_grpc10.ClientError && err.code === import_nice_grpc10.Status.NOT_FOUND)
|
|
43847
44161
|
throw new NotFoundError(err.details);
|
|
43848
44162
|
throw err;
|
|
43849
44163
|
}
|
|
@@ -43856,8 +44170,8 @@ var Volume = class _Volume {
|
|
|
43856
44170
|
return this._readOnly;
|
|
43857
44171
|
}
|
|
43858
44172
|
/**
|
|
43859
|
-
* Create a nameless, temporary
|
|
43860
|
-
* You will need to call `closeEphemeral()` to delete the
|
|
44173
|
+
* Create a nameless, temporary Volume.
|
|
44174
|
+
* You will need to call `closeEphemeral()` to delete the Volume.
|
|
43861
44175
|
*/
|
|
43862
44176
|
static async ephemeral(options = {}) {
|
|
43863
44177
|
const resp = await client.volumeGetOrCreate({
|
|
@@ -43869,7 +44183,7 @@ var Volume = class _Volume {
|
|
|
43869
44183
|
);
|
|
43870
44184
|
return new _Volume(resp.volumeId, void 0, false, ephemeralHbManager);
|
|
43871
44185
|
}
|
|
43872
|
-
/** Delete the ephemeral
|
|
44186
|
+
/** Delete the ephemeral Volume. Only usable with `Volume.ephemeral()`. */
|
|
43873
44187
|
closeEphemeral() {
|
|
43874
44188
|
if (this.#ephemeralHbManager) {
|
|
43875
44189
|
this.#ephemeralHbManager.stop();
|
|
@@ -43880,7 +44194,7 @@ var Volume = class _Volume {
|
|
|
43880
44194
|
};
|
|
43881
44195
|
|
|
43882
44196
|
// src/proxy.ts
|
|
43883
|
-
var
|
|
44197
|
+
var import_nice_grpc11 = require("nice-grpc");
|
|
43884
44198
|
var Proxy3 = class _Proxy {
|
|
43885
44199
|
proxyId;
|
|
43886
44200
|
/** @ignore */
|
|
@@ -43899,7 +44213,7 @@ var Proxy3 = class _Proxy {
|
|
|
43899
44213
|
}
|
|
43900
44214
|
return new _Proxy(resp.proxy.proxyId);
|
|
43901
44215
|
} catch (err) {
|
|
43902
|
-
if (err instanceof
|
|
44216
|
+
if (err instanceof import_nice_grpc11.ClientError && err.code === import_nice_grpc11.Status.NOT_FOUND)
|
|
43903
44217
|
throw new NotFoundError(`Proxy '${name}' not found`);
|
|
43904
44218
|
throw err;
|
|
43905
44219
|
}
|