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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/app.ts
|
|
2
|
-
import { ClientError as
|
|
2
|
+
import { ClientError as ClientError5, Status as Status5 } from "nice-grpc";
|
|
3
3
|
|
|
4
4
|
// node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js
|
|
5
5
|
function varint64read() {
|
|
@@ -6460,6 +6460,104 @@ var AutoscalerSettings = {
|
|
|
6460
6460
|
return message;
|
|
6461
6461
|
}
|
|
6462
6462
|
};
|
|
6463
|
+
function createBaseAutoscalingMetrics() {
|
|
6464
|
+
return { cpuUsagePercent: 0, memoryUsagePercent: 0, concurrentRequests: 0, timestamp: 0 };
|
|
6465
|
+
}
|
|
6466
|
+
var AutoscalingMetrics = {
|
|
6467
|
+
encode(message, writer = new BinaryWriter()) {
|
|
6468
|
+
if (message.cpuUsagePercent !== 0) {
|
|
6469
|
+
writer.uint32(9).double(message.cpuUsagePercent);
|
|
6470
|
+
}
|
|
6471
|
+
if (message.memoryUsagePercent !== 0) {
|
|
6472
|
+
writer.uint32(17).double(message.memoryUsagePercent);
|
|
6473
|
+
}
|
|
6474
|
+
if (message.concurrentRequests !== 0) {
|
|
6475
|
+
writer.uint32(24).uint32(message.concurrentRequests);
|
|
6476
|
+
}
|
|
6477
|
+
if (message.timestamp !== 0) {
|
|
6478
|
+
writer.uint32(33).double(message.timestamp);
|
|
6479
|
+
}
|
|
6480
|
+
return writer;
|
|
6481
|
+
},
|
|
6482
|
+
decode(input, length) {
|
|
6483
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
6484
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
6485
|
+
const message = createBaseAutoscalingMetrics();
|
|
6486
|
+
while (reader.pos < end) {
|
|
6487
|
+
const tag = reader.uint32();
|
|
6488
|
+
switch (tag >>> 3) {
|
|
6489
|
+
case 1: {
|
|
6490
|
+
if (tag !== 9) {
|
|
6491
|
+
break;
|
|
6492
|
+
}
|
|
6493
|
+
message.cpuUsagePercent = reader.double();
|
|
6494
|
+
continue;
|
|
6495
|
+
}
|
|
6496
|
+
case 2: {
|
|
6497
|
+
if (tag !== 17) {
|
|
6498
|
+
break;
|
|
6499
|
+
}
|
|
6500
|
+
message.memoryUsagePercent = reader.double();
|
|
6501
|
+
continue;
|
|
6502
|
+
}
|
|
6503
|
+
case 3: {
|
|
6504
|
+
if (tag !== 24) {
|
|
6505
|
+
break;
|
|
6506
|
+
}
|
|
6507
|
+
message.concurrentRequests = reader.uint32();
|
|
6508
|
+
continue;
|
|
6509
|
+
}
|
|
6510
|
+
case 4: {
|
|
6511
|
+
if (tag !== 33) {
|
|
6512
|
+
break;
|
|
6513
|
+
}
|
|
6514
|
+
message.timestamp = reader.double();
|
|
6515
|
+
continue;
|
|
6516
|
+
}
|
|
6517
|
+
}
|
|
6518
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6519
|
+
break;
|
|
6520
|
+
}
|
|
6521
|
+
reader.skip(tag & 7);
|
|
6522
|
+
}
|
|
6523
|
+
return message;
|
|
6524
|
+
},
|
|
6525
|
+
fromJSON(object) {
|
|
6526
|
+
return {
|
|
6527
|
+
cpuUsagePercent: isSet3(object.cpuUsagePercent) ? globalThis.Number(object.cpuUsagePercent) : 0,
|
|
6528
|
+
memoryUsagePercent: isSet3(object.memoryUsagePercent) ? globalThis.Number(object.memoryUsagePercent) : 0,
|
|
6529
|
+
concurrentRequests: isSet3(object.concurrentRequests) ? globalThis.Number(object.concurrentRequests) : 0,
|
|
6530
|
+
timestamp: isSet3(object.timestamp) ? globalThis.Number(object.timestamp) : 0
|
|
6531
|
+
};
|
|
6532
|
+
},
|
|
6533
|
+
toJSON(message) {
|
|
6534
|
+
const obj = {};
|
|
6535
|
+
if (message.cpuUsagePercent !== 0) {
|
|
6536
|
+
obj.cpuUsagePercent = message.cpuUsagePercent;
|
|
6537
|
+
}
|
|
6538
|
+
if (message.memoryUsagePercent !== 0) {
|
|
6539
|
+
obj.memoryUsagePercent = message.memoryUsagePercent;
|
|
6540
|
+
}
|
|
6541
|
+
if (message.concurrentRequests !== 0) {
|
|
6542
|
+
obj.concurrentRequests = Math.round(message.concurrentRequests);
|
|
6543
|
+
}
|
|
6544
|
+
if (message.timestamp !== 0) {
|
|
6545
|
+
obj.timestamp = message.timestamp;
|
|
6546
|
+
}
|
|
6547
|
+
return obj;
|
|
6548
|
+
},
|
|
6549
|
+
create(base) {
|
|
6550
|
+
return AutoscalingMetrics.fromPartial(base ?? {});
|
|
6551
|
+
},
|
|
6552
|
+
fromPartial(object) {
|
|
6553
|
+
const message = createBaseAutoscalingMetrics();
|
|
6554
|
+
message.cpuUsagePercent = object.cpuUsagePercent ?? 0;
|
|
6555
|
+
message.memoryUsagePercent = object.memoryUsagePercent ?? 0;
|
|
6556
|
+
message.concurrentRequests = object.concurrentRequests ?? 0;
|
|
6557
|
+
message.timestamp = object.timestamp ?? 0;
|
|
6558
|
+
return message;
|
|
6559
|
+
}
|
|
6560
|
+
};
|
|
6463
6561
|
function createBaseBaseImage() {
|
|
6464
6562
|
return { imageId: "", dockerTag: "" };
|
|
6465
6563
|
}
|
|
@@ -19629,7 +19727,8 @@ function createBaseFunctionHandleMetadata() {
|
|
|
19629
19727
|
functionSchema: void 0,
|
|
19630
19728
|
inputPlaneUrl: void 0,
|
|
19631
19729
|
inputPlaneRegion: void 0,
|
|
19632
|
-
maxObjectSizeBytes: void 0
|
|
19730
|
+
maxObjectSizeBytes: void 0,
|
|
19731
|
+
ExperimentalFlashUrls: []
|
|
19633
19732
|
};
|
|
19634
19733
|
}
|
|
19635
19734
|
var FunctionHandleMetadata = {
|
|
@@ -19673,6 +19772,9 @@ var FunctionHandleMetadata = {
|
|
|
19673
19772
|
if (message.maxObjectSizeBytes !== void 0) {
|
|
19674
19773
|
writer.uint32(384).uint64(message.maxObjectSizeBytes);
|
|
19675
19774
|
}
|
|
19775
|
+
for (const v of message.ExperimentalFlashUrls) {
|
|
19776
|
+
writer.uint32(394).string(v);
|
|
19777
|
+
}
|
|
19676
19778
|
return writer;
|
|
19677
19779
|
},
|
|
19678
19780
|
decode(input, length) {
|
|
@@ -19776,6 +19878,13 @@ var FunctionHandleMetadata = {
|
|
|
19776
19878
|
message.maxObjectSizeBytes = longToNumber(reader.uint64());
|
|
19777
19879
|
continue;
|
|
19778
19880
|
}
|
|
19881
|
+
case 49: {
|
|
19882
|
+
if (tag !== 394) {
|
|
19883
|
+
break;
|
|
19884
|
+
}
|
|
19885
|
+
message.ExperimentalFlashUrls.push(reader.string());
|
|
19886
|
+
continue;
|
|
19887
|
+
}
|
|
19779
19888
|
}
|
|
19780
19889
|
if ((tag & 7) === 4 || tag === 0) {
|
|
19781
19890
|
break;
|
|
@@ -19804,7 +19913,8 @@ var FunctionHandleMetadata = {
|
|
|
19804
19913
|
functionSchema: isSet3(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0,
|
|
19805
19914
|
inputPlaneUrl: isSet3(object.inputPlaneUrl) ? globalThis.String(object.inputPlaneUrl) : void 0,
|
|
19806
19915
|
inputPlaneRegion: isSet3(object.inputPlaneRegion) ? globalThis.String(object.inputPlaneRegion) : void 0,
|
|
19807
|
-
maxObjectSizeBytes: isSet3(object.maxObjectSizeBytes) ? globalThis.Number(object.maxObjectSizeBytes) : void 0
|
|
19916
|
+
maxObjectSizeBytes: isSet3(object.maxObjectSizeBytes) ? globalThis.Number(object.maxObjectSizeBytes) : void 0,
|
|
19917
|
+
ExperimentalFlashUrls: globalThis.Array.isArray(object?.ExperimentalFlashUrls) ? object.ExperimentalFlashUrls.map((e) => globalThis.String(e)) : []
|
|
19808
19918
|
};
|
|
19809
19919
|
},
|
|
19810
19920
|
toJSON(message) {
|
|
@@ -19854,6 +19964,9 @@ var FunctionHandleMetadata = {
|
|
|
19854
19964
|
if (message.maxObjectSizeBytes !== void 0) {
|
|
19855
19965
|
obj.maxObjectSizeBytes = Math.round(message.maxObjectSizeBytes);
|
|
19856
19966
|
}
|
|
19967
|
+
if (message.ExperimentalFlashUrls?.length) {
|
|
19968
|
+
obj.ExperimentalFlashUrls = message.ExperimentalFlashUrls;
|
|
19969
|
+
}
|
|
19857
19970
|
return obj;
|
|
19858
19971
|
},
|
|
19859
19972
|
create(base) {
|
|
@@ -19879,6 +19992,7 @@ var FunctionHandleMetadata = {
|
|
|
19879
19992
|
message.inputPlaneUrl = object.inputPlaneUrl ?? void 0;
|
|
19880
19993
|
message.inputPlaneRegion = object.inputPlaneRegion ?? void 0;
|
|
19881
19994
|
message.maxObjectSizeBytes = object.maxObjectSizeBytes ?? void 0;
|
|
19995
|
+
message.ExperimentalFlashUrls = object.ExperimentalFlashUrls?.map((e) => e) || [];
|
|
19882
19996
|
return message;
|
|
19883
19997
|
}
|
|
19884
19998
|
};
|
|
@@ -22941,6 +23055,57 @@ var ImageContextFile = {
|
|
|
22941
23055
|
return message;
|
|
22942
23056
|
}
|
|
22943
23057
|
};
|
|
23058
|
+
function createBaseImageDeleteRequest() {
|
|
23059
|
+
return { imageId: "" };
|
|
23060
|
+
}
|
|
23061
|
+
var ImageDeleteRequest = {
|
|
23062
|
+
encode(message, writer = new BinaryWriter()) {
|
|
23063
|
+
if (message.imageId !== "") {
|
|
23064
|
+
writer.uint32(10).string(message.imageId);
|
|
23065
|
+
}
|
|
23066
|
+
return writer;
|
|
23067
|
+
},
|
|
23068
|
+
decode(input, length) {
|
|
23069
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
23070
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
23071
|
+
const message = createBaseImageDeleteRequest();
|
|
23072
|
+
while (reader.pos < end) {
|
|
23073
|
+
const tag = reader.uint32();
|
|
23074
|
+
switch (tag >>> 3) {
|
|
23075
|
+
case 1: {
|
|
23076
|
+
if (tag !== 10) {
|
|
23077
|
+
break;
|
|
23078
|
+
}
|
|
23079
|
+
message.imageId = reader.string();
|
|
23080
|
+
continue;
|
|
23081
|
+
}
|
|
23082
|
+
}
|
|
23083
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
23084
|
+
break;
|
|
23085
|
+
}
|
|
23086
|
+
reader.skip(tag & 7);
|
|
23087
|
+
}
|
|
23088
|
+
return message;
|
|
23089
|
+
},
|
|
23090
|
+
fromJSON(object) {
|
|
23091
|
+
return { imageId: isSet3(object.imageId) ? globalThis.String(object.imageId) : "" };
|
|
23092
|
+
},
|
|
23093
|
+
toJSON(message) {
|
|
23094
|
+
const obj = {};
|
|
23095
|
+
if (message.imageId !== "") {
|
|
23096
|
+
obj.imageId = message.imageId;
|
|
23097
|
+
}
|
|
23098
|
+
return obj;
|
|
23099
|
+
},
|
|
23100
|
+
create(base) {
|
|
23101
|
+
return ImageDeleteRequest.fromPartial(base ?? {});
|
|
23102
|
+
},
|
|
23103
|
+
fromPartial(object) {
|
|
23104
|
+
const message = createBaseImageDeleteRequest();
|
|
23105
|
+
message.imageId = object.imageId ?? "";
|
|
23106
|
+
return message;
|
|
23107
|
+
}
|
|
23108
|
+
};
|
|
22944
23109
|
function createBaseImageFromIdRequest() {
|
|
22945
23110
|
return { imageId: "" };
|
|
22946
23111
|
}
|
|
@@ -34946,6 +35111,108 @@ var TaskCurrentInputsResponse = {
|
|
|
34946
35111
|
return message;
|
|
34947
35112
|
}
|
|
34948
35113
|
};
|
|
35114
|
+
function createBaseTaskGetAutoscalingMetricsRequest() {
|
|
35115
|
+
return { taskId: "" };
|
|
35116
|
+
}
|
|
35117
|
+
var TaskGetAutoscalingMetricsRequest = {
|
|
35118
|
+
encode(message, writer = new BinaryWriter()) {
|
|
35119
|
+
if (message.taskId !== "") {
|
|
35120
|
+
writer.uint32(10).string(message.taskId);
|
|
35121
|
+
}
|
|
35122
|
+
return writer;
|
|
35123
|
+
},
|
|
35124
|
+
decode(input, length) {
|
|
35125
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
35126
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
35127
|
+
const message = createBaseTaskGetAutoscalingMetricsRequest();
|
|
35128
|
+
while (reader.pos < end) {
|
|
35129
|
+
const tag = reader.uint32();
|
|
35130
|
+
switch (tag >>> 3) {
|
|
35131
|
+
case 1: {
|
|
35132
|
+
if (tag !== 10) {
|
|
35133
|
+
break;
|
|
35134
|
+
}
|
|
35135
|
+
message.taskId = reader.string();
|
|
35136
|
+
continue;
|
|
35137
|
+
}
|
|
35138
|
+
}
|
|
35139
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35140
|
+
break;
|
|
35141
|
+
}
|
|
35142
|
+
reader.skip(tag & 7);
|
|
35143
|
+
}
|
|
35144
|
+
return message;
|
|
35145
|
+
},
|
|
35146
|
+
fromJSON(object) {
|
|
35147
|
+
return { taskId: isSet3(object.taskId) ? globalThis.String(object.taskId) : "" };
|
|
35148
|
+
},
|
|
35149
|
+
toJSON(message) {
|
|
35150
|
+
const obj = {};
|
|
35151
|
+
if (message.taskId !== "") {
|
|
35152
|
+
obj.taskId = message.taskId;
|
|
35153
|
+
}
|
|
35154
|
+
return obj;
|
|
35155
|
+
},
|
|
35156
|
+
create(base) {
|
|
35157
|
+
return TaskGetAutoscalingMetricsRequest.fromPartial(base ?? {});
|
|
35158
|
+
},
|
|
35159
|
+
fromPartial(object) {
|
|
35160
|
+
const message = createBaseTaskGetAutoscalingMetricsRequest();
|
|
35161
|
+
message.taskId = object.taskId ?? "";
|
|
35162
|
+
return message;
|
|
35163
|
+
}
|
|
35164
|
+
};
|
|
35165
|
+
function createBaseTaskGetAutoscalingMetricsResponse() {
|
|
35166
|
+
return { metrics: void 0 };
|
|
35167
|
+
}
|
|
35168
|
+
var TaskGetAutoscalingMetricsResponse = {
|
|
35169
|
+
encode(message, writer = new BinaryWriter()) {
|
|
35170
|
+
if (message.metrics !== void 0) {
|
|
35171
|
+
AutoscalingMetrics.encode(message.metrics, writer.uint32(10).fork()).join();
|
|
35172
|
+
}
|
|
35173
|
+
return writer;
|
|
35174
|
+
},
|
|
35175
|
+
decode(input, length) {
|
|
35176
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
35177
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
35178
|
+
const message = createBaseTaskGetAutoscalingMetricsResponse();
|
|
35179
|
+
while (reader.pos < end) {
|
|
35180
|
+
const tag = reader.uint32();
|
|
35181
|
+
switch (tag >>> 3) {
|
|
35182
|
+
case 1: {
|
|
35183
|
+
if (tag !== 10) {
|
|
35184
|
+
break;
|
|
35185
|
+
}
|
|
35186
|
+
message.metrics = AutoscalingMetrics.decode(reader, reader.uint32());
|
|
35187
|
+
continue;
|
|
35188
|
+
}
|
|
35189
|
+
}
|
|
35190
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35191
|
+
break;
|
|
35192
|
+
}
|
|
35193
|
+
reader.skip(tag & 7);
|
|
35194
|
+
}
|
|
35195
|
+
return message;
|
|
35196
|
+
},
|
|
35197
|
+
fromJSON(object) {
|
|
35198
|
+
return { metrics: isSet3(object.metrics) ? AutoscalingMetrics.fromJSON(object.metrics) : void 0 };
|
|
35199
|
+
},
|
|
35200
|
+
toJSON(message) {
|
|
35201
|
+
const obj = {};
|
|
35202
|
+
if (message.metrics !== void 0) {
|
|
35203
|
+
obj.metrics = AutoscalingMetrics.toJSON(message.metrics);
|
|
35204
|
+
}
|
|
35205
|
+
return obj;
|
|
35206
|
+
},
|
|
35207
|
+
create(base) {
|
|
35208
|
+
return TaskGetAutoscalingMetricsResponse.fromPartial(base ?? {});
|
|
35209
|
+
},
|
|
35210
|
+
fromPartial(object) {
|
|
35211
|
+
const message = createBaseTaskGetAutoscalingMetricsResponse();
|
|
35212
|
+
message.metrics = object.metrics !== void 0 && object.metrics !== null ? AutoscalingMetrics.fromPartial(object.metrics) : void 0;
|
|
35213
|
+
return message;
|
|
35214
|
+
}
|
|
35215
|
+
};
|
|
34949
35216
|
function createBaseTaskInfo() {
|
|
34950
35217
|
return {
|
|
34951
35218
|
id: "",
|
|
@@ -40378,6 +40645,14 @@ var ModalClientDefinition = {
|
|
|
40378
40645
|
options: {}
|
|
40379
40646
|
},
|
|
40380
40647
|
/** Images */
|
|
40648
|
+
imageDelete: {
|
|
40649
|
+
name: "ImageDelete",
|
|
40650
|
+
requestType: ImageDeleteRequest,
|
|
40651
|
+
requestStream: false,
|
|
40652
|
+
responseType: Empty,
|
|
40653
|
+
responseStream: false,
|
|
40654
|
+
options: {}
|
|
40655
|
+
},
|
|
40381
40656
|
imageFromId: {
|
|
40382
40657
|
name: "ImageFromId",
|
|
40383
40658
|
requestType: ImageFromIdRequest,
|
|
@@ -40844,6 +41119,15 @@ var ModalClientDefinition = {
|
|
|
40844
41119
|
responseStream: false,
|
|
40845
41120
|
options: {}
|
|
40846
41121
|
},
|
|
41122
|
+
/** Used for flash autoscaling */
|
|
41123
|
+
taskGetAutoscalingMetrics: {
|
|
41124
|
+
name: "TaskGetAutoscalingMetrics",
|
|
41125
|
+
requestType: TaskGetAutoscalingMetricsRequest,
|
|
41126
|
+
requestStream: false,
|
|
41127
|
+
responseType: TaskGetAutoscalingMetricsResponse,
|
|
41128
|
+
responseStream: false,
|
|
41129
|
+
options: {}
|
|
41130
|
+
},
|
|
40847
41131
|
taskList: {
|
|
40848
41132
|
name: "TaskList",
|
|
40849
41133
|
requestType: TaskListRequest,
|
|
@@ -41428,6 +41712,8 @@ var Secret = class _Secret {
|
|
|
41428
41712
|
};
|
|
41429
41713
|
|
|
41430
41714
|
// src/image.ts
|
|
41715
|
+
import { ClientError as ClientError3 } from "nice-grpc";
|
|
41716
|
+
import { Status as Status3 } from "nice-grpc";
|
|
41431
41717
|
var Image2 = class _Image {
|
|
41432
41718
|
#imageId;
|
|
41433
41719
|
#tag;
|
|
@@ -41442,18 +41728,27 @@ var Image2 = class _Image {
|
|
|
41442
41728
|
return this.#imageId;
|
|
41443
41729
|
}
|
|
41444
41730
|
/**
|
|
41445
|
-
* Creates an
|
|
41731
|
+
* Creates an Image from an Image ID
|
|
41446
41732
|
*
|
|
41447
|
-
* @param imageId - Image
|
|
41733
|
+
* @param imageId - Image ID.
|
|
41448
41734
|
*/
|
|
41449
|
-
static fromId(imageId) {
|
|
41450
|
-
|
|
41735
|
+
static async fromId(imageId) {
|
|
41736
|
+
try {
|
|
41737
|
+
const resp = await client.imageFromId({ imageId });
|
|
41738
|
+
return new _Image(resp.imageId, "");
|
|
41739
|
+
} catch (err) {
|
|
41740
|
+
if (err instanceof ClientError3 && err.code === Status3.NOT_FOUND)
|
|
41741
|
+
throw new NotFoundError(err.details);
|
|
41742
|
+
if (err instanceof ClientError3 && err.code === Status3.FAILED_PRECONDITION && err.details.includes("Could not find image with ID"))
|
|
41743
|
+
throw new NotFoundError(err.details);
|
|
41744
|
+
throw err;
|
|
41745
|
+
}
|
|
41451
41746
|
}
|
|
41452
41747
|
/**
|
|
41453
|
-
* Creates an
|
|
41748
|
+
* Creates an Image from a raw registry tag, optionally using a Secret for authentication.
|
|
41454
41749
|
*
|
|
41455
|
-
* @param tag - The registry tag for the
|
|
41456
|
-
* @param secret - Optional. A
|
|
41750
|
+
* @param tag - The registry tag for the Image.
|
|
41751
|
+
* @param secret - Optional. A Secret containing credentials for registry authentication.
|
|
41457
41752
|
*/
|
|
41458
41753
|
static fromRegistry(tag, secret) {
|
|
41459
41754
|
let imageRegistryConfig;
|
|
@@ -41471,10 +41766,10 @@ var Image2 = class _Image {
|
|
|
41471
41766
|
return new _Image("", tag, imageRegistryConfig);
|
|
41472
41767
|
}
|
|
41473
41768
|
/**
|
|
41474
|
-
* Creates an
|
|
41769
|
+
* Creates an Image from a raw registry tag, optionally using a Secret for authentication.
|
|
41475
41770
|
*
|
|
41476
|
-
* @param tag - The registry tag for the
|
|
41477
|
-
* @param secret - A
|
|
41771
|
+
* @param tag - The registry tag for the Image.
|
|
41772
|
+
* @param secret - A Secret containing credentials for registry authentication.
|
|
41478
41773
|
*/
|
|
41479
41774
|
static fromAwsEcr(tag, secret) {
|
|
41480
41775
|
let imageRegistryConfig;
|
|
@@ -41492,10 +41787,10 @@ var Image2 = class _Image {
|
|
|
41492
41787
|
return new _Image("", tag, imageRegistryConfig);
|
|
41493
41788
|
}
|
|
41494
41789
|
/**
|
|
41495
|
-
* Creates an
|
|
41790
|
+
* Creates an Image from a raw registry tag, optionally using a Secret for authentication.
|
|
41496
41791
|
*
|
|
41497
|
-
* @param tag - The registry tag for the
|
|
41498
|
-
* @param secret - A
|
|
41792
|
+
* @param tag - The registry tag for the Image.
|
|
41793
|
+
* @param secret - A Secret containing credentials for registry authentication.
|
|
41499
41794
|
*/
|
|
41500
41795
|
static fromGcpArtifactRegistry(tag, secret) {
|
|
41501
41796
|
let imageRegistryConfig;
|
|
@@ -41513,9 +41808,9 @@ var Image2 = class _Image {
|
|
|
41513
41808
|
return new _Image("", tag, imageRegistryConfig);
|
|
41514
41809
|
}
|
|
41515
41810
|
/**
|
|
41516
|
-
* Eagerly builds an
|
|
41811
|
+
* Eagerly builds an Image on Modal.
|
|
41517
41812
|
*
|
|
41518
|
-
* @param app - App to use to build
|
|
41813
|
+
* @param app - App to use to build the Image.
|
|
41519
41814
|
*/
|
|
41520
41815
|
async build(app) {
|
|
41521
41816
|
if (this.imageId !== "") {
|
|
@@ -41575,10 +41870,15 @@ ${result.exception}`
|
|
|
41575
41870
|
this.#imageId = resp.imageId;
|
|
41576
41871
|
return this;
|
|
41577
41872
|
}
|
|
41873
|
+
/** Delete an Image by ID. Warning: This removes an *entire Image*, and cannot be undone. */
|
|
41874
|
+
static async delete(imageId, _ = {}) {
|
|
41875
|
+
const image = await _Image.fromId(imageId);
|
|
41876
|
+
await client.imageDelete({ imageId: image.imageId });
|
|
41877
|
+
}
|
|
41578
41878
|
};
|
|
41579
41879
|
|
|
41580
41880
|
// src/sandbox.ts
|
|
41581
|
-
import { ClientError as
|
|
41881
|
+
import { ClientError as ClientError4, Status as Status4 } from "nice-grpc";
|
|
41582
41882
|
|
|
41583
41883
|
// src/sandbox_filesystem.ts
|
|
41584
41884
|
var SandboxFile = class {
|
|
@@ -41856,7 +42156,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
41856
42156
|
tags: tagsList
|
|
41857
42157
|
});
|
|
41858
42158
|
} catch (err) {
|
|
41859
|
-
if (err instanceof
|
|
42159
|
+
if (err instanceof ClientError4 && err.code === Status4.INVALID_ARGUMENT) {
|
|
41860
42160
|
throw new InvalidError(err.details || err.message);
|
|
41861
42161
|
}
|
|
41862
42162
|
throw err;
|
|
@@ -41873,7 +42173,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
41873
42173
|
timeout: 0
|
|
41874
42174
|
});
|
|
41875
42175
|
} catch (err) {
|
|
41876
|
-
if (err instanceof
|
|
42176
|
+
if (err instanceof ClientError4 && err.code === Status4.NOT_FOUND)
|
|
41877
42177
|
throw new NotFoundError(`Sandbox with id: '${sandboxId}' not found`);
|
|
41878
42178
|
throw err;
|
|
41879
42179
|
}
|
|
@@ -41884,8 +42184,8 @@ var Sandbox2 = class _Sandbox {
|
|
|
41884
42184
|
* Raises a NotFoundError if no running Sandbox is found with the given name.
|
|
41885
42185
|
* A Sandbox's name is the `name` argument passed to `App.createSandbox`.
|
|
41886
42186
|
*
|
|
41887
|
-
* @param appName - Name of the deployed
|
|
41888
|
-
* @param name - Name of the
|
|
42187
|
+
* @param appName - Name of the deployed App
|
|
42188
|
+
* @param name - Name of the Sandbox
|
|
41889
42189
|
* @param environment - Optional override for the environment
|
|
41890
42190
|
* @returns Promise that resolves to a Sandbox
|
|
41891
42191
|
*/
|
|
@@ -41898,15 +42198,15 @@ var Sandbox2 = class _Sandbox {
|
|
|
41898
42198
|
});
|
|
41899
42199
|
return new _Sandbox(resp.sandboxId);
|
|
41900
42200
|
} catch (err) {
|
|
41901
|
-
if (err instanceof
|
|
42201
|
+
if (err instanceof ClientError4 && err.code === Status4.NOT_FOUND)
|
|
41902
42202
|
throw new NotFoundError(
|
|
41903
|
-
`Sandbox with name '${name}' not found in
|
|
42203
|
+
`Sandbox with name '${name}' not found in App '${appName}'`
|
|
41904
42204
|
);
|
|
41905
42205
|
throw err;
|
|
41906
42206
|
}
|
|
41907
42207
|
}
|
|
41908
42208
|
/**
|
|
41909
|
-
* Open a file in the
|
|
42209
|
+
* Open a file in the Sandbox filesystem.
|
|
41910
42210
|
* @param path - Path to the file to open
|
|
41911
42211
|
* @param mode - File open mode (r, w, a, r+, w+, a+)
|
|
41912
42212
|
* @returns Promise that resolves to a SandboxFile
|
|
@@ -41969,7 +42269,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
41969
42269
|
}
|
|
41970
42270
|
}
|
|
41971
42271
|
}
|
|
41972
|
-
/** Get Tunnel metadata for the
|
|
42272
|
+
/** Get Tunnel metadata for the Sandbox.
|
|
41973
42273
|
*
|
|
41974
42274
|
* Raises `SandboxTimeoutError` if the tunnels are not available after the timeout.
|
|
41975
42275
|
*
|
|
@@ -42017,7 +42317,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
42017
42317
|
);
|
|
42018
42318
|
}
|
|
42019
42319
|
if (!resp.imageId) {
|
|
42020
|
-
throw new Error("Sandbox snapshot response missing
|
|
42320
|
+
throw new Error("Sandbox snapshot response missing `imageId`");
|
|
42021
42321
|
}
|
|
42022
42322
|
return new Image2(resp.imageId, "");
|
|
42023
42323
|
}
|
|
@@ -42061,7 +42361,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
42061
42361
|
}
|
|
42062
42362
|
beforeTimestamp = resp.sandboxes[resp.sandboxes.length - 1].createdAt;
|
|
42063
42363
|
} catch (err) {
|
|
42064
|
-
if (err instanceof
|
|
42364
|
+
if (err instanceof ClientError4 && err.code === Status4.INVALID_ARGUMENT) {
|
|
42065
42365
|
throw new InvalidError(err.details || err.message);
|
|
42066
42366
|
}
|
|
42067
42367
|
throw err;
|
|
@@ -42327,7 +42627,7 @@ var App = class _App {
|
|
|
42327
42627
|
this.appId = appId;
|
|
42328
42628
|
this.name = name;
|
|
42329
42629
|
}
|
|
42330
|
-
/** Lookup a deployed
|
|
42630
|
+
/** Lookup a deployed App by name, or create if it does not exist. */
|
|
42331
42631
|
static async lookup(name, options = {}) {
|
|
42332
42632
|
try {
|
|
42333
42633
|
const resp = await client.appGetOrCreate({
|
|
@@ -42337,7 +42637,7 @@ var App = class _App {
|
|
|
42337
42637
|
});
|
|
42338
42638
|
return new _App(resp.appId, name);
|
|
42339
42639
|
} catch (err) {
|
|
42340
|
-
if (err instanceof
|
|
42640
|
+
if (err instanceof ClientError5 && err.code === Status5.NOT_FOUND)
|
|
42341
42641
|
throw new NotFoundError(`App '${name}' not found`);
|
|
42342
42642
|
throw err;
|
|
42343
42643
|
}
|
|
@@ -42346,7 +42646,12 @@ var App = class _App {
|
|
|
42346
42646
|
const gpuConfig = parseGpuConfig(options.gpu);
|
|
42347
42647
|
if (options.timeout && options.timeout % 1e3 !== 0) {
|
|
42348
42648
|
throw new Error(
|
|
42349
|
-
`
|
|
42649
|
+
`timeout must be a multiple of 1000ms, got ${options.timeout}`
|
|
42650
|
+
);
|
|
42651
|
+
}
|
|
42652
|
+
if (options.idleTimeout && options.idleTimeout % 1e3 !== 0) {
|
|
42653
|
+
throw new Error(
|
|
42654
|
+
`idleTimeout must be a multiple of 1000ms, got ${options.idleTimeout}`
|
|
42350
42655
|
);
|
|
42351
42656
|
}
|
|
42352
42657
|
await image.build(this);
|
|
@@ -42425,6 +42730,7 @@ var App = class _App {
|
|
|
42425
42730
|
entrypointArgs: options.command ?? ["sleep", "48h"],
|
|
42426
42731
|
imageId: image.imageId,
|
|
42427
42732
|
timeoutSecs: options.timeout != void 0 ? options.timeout / 1e3 : 600,
|
|
42733
|
+
idleTimeoutSecs: options.idleTimeout != void 0 ? options.idleTimeout / 1e3 : void 0,
|
|
42428
42734
|
workdir: options.workdir ?? void 0,
|
|
42429
42735
|
networkAccess,
|
|
42430
42736
|
resources: {
|
|
@@ -42445,7 +42751,7 @@ var App = class _App {
|
|
|
42445
42751
|
}
|
|
42446
42752
|
});
|
|
42447
42753
|
} catch (err) {
|
|
42448
|
-
if (err instanceof
|
|
42754
|
+
if (err instanceof ClientError5 && err.code === Status5.ALREADY_EXISTS) {
|
|
42449
42755
|
throw new AlreadyExistsError(err.details || err.message);
|
|
42450
42756
|
}
|
|
42451
42757
|
throw err;
|
|
@@ -42473,7 +42779,7 @@ var App = class _App {
|
|
|
42473
42779
|
};
|
|
42474
42780
|
|
|
42475
42781
|
// src/cls.ts
|
|
42476
|
-
import { ClientError as
|
|
42782
|
+
import { ClientError as ClientError7, Status as Status7 } from "nice-grpc";
|
|
42477
42783
|
|
|
42478
42784
|
// src/function.ts
|
|
42479
42785
|
import { createHash } from "node:crypto";
|
|
@@ -42639,7 +42945,9 @@ function encodeValue(val, w, proto) {
|
|
|
42639
42945
|
}
|
|
42640
42946
|
return;
|
|
42641
42947
|
}
|
|
42642
|
-
throw new PickleError(
|
|
42948
|
+
throw new PickleError(
|
|
42949
|
+
`The JS Modal SDK does not support encoding/pickling data of type ${typeof val}`
|
|
42950
|
+
);
|
|
42643
42951
|
}
|
|
42644
42952
|
function maybeMemoize(w, proto) {
|
|
42645
42953
|
if (proto >= 4) {
|
|
@@ -42648,7 +42956,9 @@ function maybeMemoize(w, proto) {
|
|
|
42648
42956
|
}
|
|
42649
42957
|
function dumps(obj, protocol = 4) {
|
|
42650
42958
|
if (![3, 4, 5].includes(protocol))
|
|
42651
|
-
throw new PickleError(
|
|
42959
|
+
throw new PickleError(
|
|
42960
|
+
`The JS Modal SDK does not support pickle protocol version ${protocol}`
|
|
42961
|
+
);
|
|
42652
42962
|
const w = new Writer();
|
|
42653
42963
|
w.byte(128 /* PROTO */);
|
|
42654
42964
|
w.byte(protocol);
|
|
@@ -42665,8 +42975,10 @@ function loads(buf) {
|
|
|
42665
42975
|
const op0 = r.byte();
|
|
42666
42976
|
if (op0 !== 128 /* PROTO */) throw new PickleError("pickle missing PROTO header");
|
|
42667
42977
|
const proto = r.byte();
|
|
42668
|
-
if (!
|
|
42669
|
-
throw new PickleError(
|
|
42978
|
+
if (![3, 4, 5].includes(proto))
|
|
42979
|
+
throw new PickleError(
|
|
42980
|
+
`The JS Modal SDK does not support pickle protocol version ${proto}`
|
|
42981
|
+
);
|
|
42670
42982
|
const stack = [];
|
|
42671
42983
|
const memo = [];
|
|
42672
42984
|
const tdec = new TextDecoder();
|
|
@@ -42819,7 +43131,9 @@ function loads(buf) {
|
|
|
42819
43131
|
break;
|
|
42820
43132
|
}
|
|
42821
43133
|
default:
|
|
42822
|
-
throw new PickleError(
|
|
43134
|
+
throw new PickleError(
|
|
43135
|
+
`The JS Modal SDK does not support decoding/unpickling this kind of data. Error: unsupported opcode 0x${op.toString(16)}`
|
|
43136
|
+
);
|
|
42823
43137
|
}
|
|
42824
43138
|
}
|
|
42825
43139
|
throw new PickleError("pickle stream ended without STOP");
|
|
@@ -42879,7 +43193,7 @@ var ControlPlaneInvocation = class _ControlPlaneInvocation {
|
|
|
42879
43193
|
}
|
|
42880
43194
|
async retry(retryCount) {
|
|
42881
43195
|
if (!this.input) {
|
|
42882
|
-
throw new Error("Cannot retry
|
|
43196
|
+
throw new Error("Cannot retry Function invocation - input missing");
|
|
42883
43197
|
}
|
|
42884
43198
|
const retryItem = {
|
|
42885
43199
|
inputJwt: this.inputJwt,
|
|
@@ -43022,11 +43336,11 @@ var FunctionCall = class _FunctionCall {
|
|
|
43022
43336
|
constructor(functionCallId) {
|
|
43023
43337
|
this.functionCallId = functionCallId;
|
|
43024
43338
|
}
|
|
43025
|
-
/** Create a new
|
|
43339
|
+
/** Create a new Function call from ID. */
|
|
43026
43340
|
fromId(functionCallId) {
|
|
43027
43341
|
return new _FunctionCall(functionCallId);
|
|
43028
43342
|
}
|
|
43029
|
-
/** Get the result of a
|
|
43343
|
+
/** Get the result of a Function call, optionally waiting with a timeout. */
|
|
43030
43344
|
async get(options = {}) {
|
|
43031
43345
|
const timeout = options.timeout;
|
|
43032
43346
|
const invocation = ControlPlaneInvocation.fromFunctionCallId(
|
|
@@ -43034,7 +43348,7 @@ var FunctionCall = class _FunctionCall {
|
|
|
43034
43348
|
);
|
|
43035
43349
|
return invocation.awaitOutput(timeout);
|
|
43036
43350
|
}
|
|
43037
|
-
/** Cancel a running
|
|
43351
|
+
/** Cancel a running Function call. */
|
|
43038
43352
|
async cancel(options = {}) {
|
|
43039
43353
|
await client.functionCallCancel({
|
|
43040
43354
|
functionCallId: this.functionCallId,
|
|
@@ -43044,7 +43358,7 @@ var FunctionCall = class _FunctionCall {
|
|
|
43044
43358
|
};
|
|
43045
43359
|
|
|
43046
43360
|
// src/function.ts
|
|
43047
|
-
import { ClientError as
|
|
43361
|
+
import { ClientError as ClientError6, Status as Status6 } from "nice-grpc";
|
|
43048
43362
|
var maxObjectSizeBytes = 2 * 1024 * 1024;
|
|
43049
43363
|
var maxSystemRetries = 8;
|
|
43050
43364
|
var Function_ = class _Function_ {
|
|
@@ -43073,7 +43387,7 @@ var Function_ = class _Function_ {
|
|
|
43073
43387
|
resp.handleMetadata?.webUrl
|
|
43074
43388
|
);
|
|
43075
43389
|
} catch (err) {
|
|
43076
|
-
if (err instanceof
|
|
43390
|
+
if (err instanceof ClientError6 && err.code === Status6.NOT_FOUND)
|
|
43077
43391
|
throw new NotFoundError(`Function '${appName}/${name}' not found`);
|
|
43078
43392
|
throw err;
|
|
43079
43393
|
}
|
|
@@ -43110,7 +43424,7 @@ var Function_ = class _Function_ {
|
|
|
43110
43424
|
4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */
|
|
43111
43425
|
);
|
|
43112
43426
|
}
|
|
43113
|
-
// Spawn a single input into a remote
|
|
43427
|
+
// Spawn a single input into a remote Function.
|
|
43114
43428
|
async spawn(args = [], kwargs = {}) {
|
|
43115
43429
|
const input = await this.#createInput(args, kwargs);
|
|
43116
43430
|
const invocation = await ControlPlaneInvocation.create(
|
|
@@ -43147,7 +43461,7 @@ var Function_ = class _Function_ {
|
|
|
43147
43461
|
}
|
|
43148
43462
|
/**
|
|
43149
43463
|
* URL of a Function running as a web endpoint.
|
|
43150
|
-
* @returns The web URL if this
|
|
43464
|
+
* @returns The web URL if this Function is a web endpoint, otherwise undefined
|
|
43151
43465
|
*/
|
|
43152
43466
|
async getWebUrl() {
|
|
43153
43467
|
return this.#webUrl || void 0;
|
|
@@ -43305,7 +43619,7 @@ var Cls = class _Cls {
|
|
|
43305
43619
|
void 0
|
|
43306
43620
|
);
|
|
43307
43621
|
} catch (err) {
|
|
43308
|
-
if (err instanceof
|
|
43622
|
+
if (err instanceof ClientError7 && err.code === Status7.NOT_FOUND)
|
|
43309
43623
|
throw new NotFoundError(`Class '${appName}/${name}' not found`);
|
|
43310
43624
|
throw err;
|
|
43311
43625
|
}
|
|
@@ -43501,7 +43815,7 @@ var ClsInstance = class {
|
|
|
43501
43815
|
};
|
|
43502
43816
|
|
|
43503
43817
|
// src/queue.ts
|
|
43504
|
-
import { ClientError as
|
|
43818
|
+
import { ClientError as ClientError8, Status as Status8 } from "nice-grpc";
|
|
43505
43819
|
|
|
43506
43820
|
// src/ephemeral.ts
|
|
43507
43821
|
var ephemeralObjectHeartbeatSleep = 3e5;
|
|
@@ -43560,8 +43874,8 @@ var Queue = class _Queue {
|
|
|
43560
43874
|
return new Uint8Array();
|
|
43561
43875
|
}
|
|
43562
43876
|
/**
|
|
43563
|
-
* Create a nameless, temporary
|
|
43564
|
-
* You will need to call `closeEphemeral()` to delete the
|
|
43877
|
+
* Create a nameless, temporary Queue.
|
|
43878
|
+
* You will need to call `closeEphemeral()` to delete the Queue.
|
|
43565
43879
|
*/
|
|
43566
43880
|
static async ephemeral(options = {}) {
|
|
43567
43881
|
const resp = await client.queueGetOrCreate({
|
|
@@ -43573,7 +43887,7 @@ var Queue = class _Queue {
|
|
|
43573
43887
|
);
|
|
43574
43888
|
return new _Queue(resp.queueId, void 0, ephemeralHbManager);
|
|
43575
43889
|
}
|
|
43576
|
-
/** Delete the ephemeral
|
|
43890
|
+
/** Delete the ephemeral Queue. Only usable with `Queue.ephemeral()`. */
|
|
43577
43891
|
closeEphemeral() {
|
|
43578
43892
|
if (this.#ephemeralHbManager) {
|
|
43579
43893
|
this.#ephemeralHbManager.stop();
|
|
@@ -43582,7 +43896,7 @@ var Queue = class _Queue {
|
|
|
43582
43896
|
}
|
|
43583
43897
|
}
|
|
43584
43898
|
/**
|
|
43585
|
-
* Lookup a
|
|
43899
|
+
* Lookup a Queue by name.
|
|
43586
43900
|
*/
|
|
43587
43901
|
static async lookup(name, options = {}) {
|
|
43588
43902
|
const resp = await client.queueGetOrCreate({
|
|
@@ -43592,13 +43906,13 @@ var Queue = class _Queue {
|
|
|
43592
43906
|
});
|
|
43593
43907
|
return new _Queue(resp.queueId, name);
|
|
43594
43908
|
}
|
|
43595
|
-
/** Delete a
|
|
43909
|
+
/** Delete a Queue by name. */
|
|
43596
43910
|
static async delete(name, options = {}) {
|
|
43597
43911
|
const queue = await _Queue.lookup(name, options);
|
|
43598
43912
|
await client.queueDelete({ queueId: queue.queueId });
|
|
43599
43913
|
}
|
|
43600
43914
|
/**
|
|
43601
|
-
* Remove all objects from a
|
|
43915
|
+
* Remove all objects from a Queue partition.
|
|
43602
43916
|
*/
|
|
43603
43917
|
async clear(options = {}) {
|
|
43604
43918
|
if (options.partition && options.all) {
|
|
@@ -43640,9 +43954,9 @@ var Queue = class _Queue {
|
|
|
43640
43954
|
}
|
|
43641
43955
|
}
|
|
43642
43956
|
/**
|
|
43643
|
-
* Remove and return the next object from the
|
|
43957
|
+
* Remove and return the next object from the Queue.
|
|
43644
43958
|
*
|
|
43645
|
-
* By default, this will wait until at least one item is present in the
|
|
43959
|
+
* By default, this will wait until at least one item is present in the Queue.
|
|
43646
43960
|
* If `timeout` is set, raises `QueueEmptyError` if no items are available
|
|
43647
43961
|
* within that timeout in milliseconds.
|
|
43648
43962
|
*/
|
|
@@ -43651,9 +43965,9 @@ var Queue = class _Queue {
|
|
|
43651
43965
|
return values[0];
|
|
43652
43966
|
}
|
|
43653
43967
|
/**
|
|
43654
|
-
* Remove and return up to `n` objects from the
|
|
43968
|
+
* Remove and return up to `n` objects from the Queue.
|
|
43655
43969
|
*
|
|
43656
|
-
* By default, this will wait until at least one item is present in the
|
|
43970
|
+
* By default, this will wait until at least one item is present in the Queue.
|
|
43657
43971
|
* If `timeout` is set, raises `QueueEmptyError` if no items are available
|
|
43658
43972
|
* within that timeout in milliseconds.
|
|
43659
43973
|
*/
|
|
@@ -43675,7 +43989,7 @@ var Queue = class _Queue {
|
|
|
43675
43989
|
});
|
|
43676
43990
|
break;
|
|
43677
43991
|
} catch (e) {
|
|
43678
|
-
if (e instanceof
|
|
43992
|
+
if (e instanceof ClientError8 && e.code === Status8.RESOURCE_EXHAUSTED) {
|
|
43679
43993
|
delay = Math.min(delay * 2, 3e4);
|
|
43680
43994
|
if (deadline !== void 0) {
|
|
43681
43995
|
const remaining = deadline - Date.now();
|
|
@@ -43691,11 +44005,11 @@ var Queue = class _Queue {
|
|
|
43691
44005
|
}
|
|
43692
44006
|
}
|
|
43693
44007
|
/**
|
|
43694
|
-
* Add an item to the end of the
|
|
44008
|
+
* Add an item to the end of the Queue.
|
|
43695
44009
|
*
|
|
43696
|
-
* If the
|
|
44010
|
+
* If the Queue is full, this will retry with exponential backoff until the
|
|
43697
44011
|
* provided `timeout` is reached, or indefinitely if `timeout` is not set.
|
|
43698
|
-
* Raises `QueueFullError` if the
|
|
44012
|
+
* Raises `QueueFullError` if the Queue is still full after the timeout.
|
|
43699
44013
|
*/
|
|
43700
44014
|
async put(v, options = {}) {
|
|
43701
44015
|
await this.#put(
|
|
@@ -43706,11 +44020,11 @@ var Queue = class _Queue {
|
|
|
43706
44020
|
);
|
|
43707
44021
|
}
|
|
43708
44022
|
/**
|
|
43709
|
-
* Add several items to the end of the
|
|
44023
|
+
* Add several items to the end of the Queue.
|
|
43710
44024
|
*
|
|
43711
|
-
* If the
|
|
44025
|
+
* If the Queue is full, this will retry with exponential backoff until the
|
|
43712
44026
|
* provided `timeout` is reached, or indefinitely if `timeout` is not set.
|
|
43713
|
-
* Raises `QueueFullError` if the
|
|
44027
|
+
* Raises `QueueFullError` if the Queue is still full after the timeout.
|
|
43714
44028
|
*/
|
|
43715
44029
|
async putMany(values, options = {}) {
|
|
43716
44030
|
await this.#put(
|
|
@@ -43720,7 +44034,7 @@ var Queue = class _Queue {
|
|
|
43720
44034
|
options.partitionTtl
|
|
43721
44035
|
);
|
|
43722
44036
|
}
|
|
43723
|
-
/** Return the number of objects in the
|
|
44037
|
+
/** Return the number of objects in the Queue. */
|
|
43724
44038
|
async len(options = {}) {
|
|
43725
44039
|
if (options.partition && options.total) {
|
|
43726
44040
|
throw new InvalidError(
|
|
@@ -43734,7 +44048,7 @@ var Queue = class _Queue {
|
|
|
43734
44048
|
});
|
|
43735
44049
|
return resp.len;
|
|
43736
44050
|
}
|
|
43737
|
-
/** Iterate through items in a
|
|
44051
|
+
/** Iterate through items in a Queue without mutation. */
|
|
43738
44052
|
async *iterate(options = {}) {
|
|
43739
44053
|
const { partition, itemPollTimeout = 0 } = options;
|
|
43740
44054
|
let lastEntryId = void 0;
|
|
@@ -43767,7 +44081,7 @@ var Queue = class _Queue {
|
|
|
43767
44081
|
};
|
|
43768
44082
|
|
|
43769
44083
|
// src/volume.ts
|
|
43770
|
-
import { ClientError as
|
|
44084
|
+
import { ClientError as ClientError9, Status as Status9 } from "nice-grpc";
|
|
43771
44085
|
var Volume = class _Volume {
|
|
43772
44086
|
volumeId;
|
|
43773
44087
|
name;
|
|
@@ -43789,7 +44103,7 @@ var Volume = class _Volume {
|
|
|
43789
44103
|
});
|
|
43790
44104
|
return new _Volume(resp.volumeId, name);
|
|
43791
44105
|
} catch (err) {
|
|
43792
|
-
if (err instanceof
|
|
44106
|
+
if (err instanceof ClientError9 && err.code === Status9.NOT_FOUND)
|
|
43793
44107
|
throw new NotFoundError(err.details);
|
|
43794
44108
|
throw err;
|
|
43795
44109
|
}
|
|
@@ -43802,8 +44116,8 @@ var Volume = class _Volume {
|
|
|
43802
44116
|
return this._readOnly;
|
|
43803
44117
|
}
|
|
43804
44118
|
/**
|
|
43805
|
-
* Create a nameless, temporary
|
|
43806
|
-
* You will need to call `closeEphemeral()` to delete the
|
|
44119
|
+
* Create a nameless, temporary Volume.
|
|
44120
|
+
* You will need to call `closeEphemeral()` to delete the Volume.
|
|
43807
44121
|
*/
|
|
43808
44122
|
static async ephemeral(options = {}) {
|
|
43809
44123
|
const resp = await client.volumeGetOrCreate({
|
|
@@ -43815,7 +44129,7 @@ var Volume = class _Volume {
|
|
|
43815
44129
|
);
|
|
43816
44130
|
return new _Volume(resp.volumeId, void 0, false, ephemeralHbManager);
|
|
43817
44131
|
}
|
|
43818
|
-
/** Delete the ephemeral
|
|
44132
|
+
/** Delete the ephemeral Volume. Only usable with `Volume.ephemeral()`. */
|
|
43819
44133
|
closeEphemeral() {
|
|
43820
44134
|
if (this.#ephemeralHbManager) {
|
|
43821
44135
|
this.#ephemeralHbManager.stop();
|
|
@@ -43826,7 +44140,7 @@ var Volume = class _Volume {
|
|
|
43826
44140
|
};
|
|
43827
44141
|
|
|
43828
44142
|
// src/proxy.ts
|
|
43829
|
-
import { ClientError as
|
|
44143
|
+
import { ClientError as ClientError10, Status as Status10 } from "nice-grpc";
|
|
43830
44144
|
var Proxy2 = class _Proxy {
|
|
43831
44145
|
proxyId;
|
|
43832
44146
|
/** @ignore */
|
|
@@ -43845,7 +44159,7 @@ var Proxy2 = class _Proxy {
|
|
|
43845
44159
|
}
|
|
43846
44160
|
return new _Proxy(resp.proxy.proxyId);
|
|
43847
44161
|
} catch (err) {
|
|
43848
|
-
if (err instanceof
|
|
44162
|
+
if (err instanceof ClientError10 && err.code === Status10.NOT_FOUND)
|
|
43849
44163
|
throw new NotFoundError(`Proxy '${name}' not found`);
|
|
43850
44164
|
throw err;
|
|
43851
44165
|
}
|