@adep/runtime 0.3.7 → 0.3.8
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.js +39 -5
- package/dist/storage/driver.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ var ExecutorError = class extends Error {
|
|
|
6
6
|
this.code = code;
|
|
7
7
|
this.name = "ExecutorError";
|
|
8
8
|
}
|
|
9
|
+
status;
|
|
10
|
+
code;
|
|
9
11
|
};
|
|
10
12
|
var TIMEOUT_CODE = "FN_EXEC_TIMEOUT";
|
|
11
13
|
var OOM_CODE = "FN_EXEC_OOM";
|
|
@@ -364,6 +366,8 @@ var DbError = class extends Error {
|
|
|
364
366
|
this.code = code;
|
|
365
367
|
this.name = "DbError";
|
|
366
368
|
}
|
|
369
|
+
status;
|
|
370
|
+
code;
|
|
367
371
|
};
|
|
368
372
|
var IDENTIFIER_PATTERN = /^[A-Za-z_][A-Za-z0-9_]{0,62}$/;
|
|
369
373
|
function assertIdentifier(name) {
|
|
@@ -1248,9 +1252,12 @@ var StorageError = class extends Error {
|
|
|
1248
1252
|
this.code = code;
|
|
1249
1253
|
this.name = "StorageError";
|
|
1250
1254
|
}
|
|
1255
|
+
status;
|
|
1256
|
+
code;
|
|
1251
1257
|
};
|
|
1252
1258
|
var STORAGE_CODES = {
|
|
1253
1259
|
invalidPath: "STORAGE_INVALID_PATH",
|
|
1260
|
+
invalidData: "STORAGE_INVALID_DATA",
|
|
1254
1261
|
notFound: "STORAGE_NOT_FOUND",
|
|
1255
1262
|
quotaExceeded: "STORAGE_QUOTA_EXCEEDED"
|
|
1256
1263
|
};
|
|
@@ -1502,11 +1509,33 @@ function verifyDownloadSignature(config, projectId, path, query, nowSeconds2 = M
|
|
|
1502
1509
|
var DEFAULT_VISIBILITY = "private";
|
|
1503
1510
|
function asBytes(data) {
|
|
1504
1511
|
if (typeof data === "string") return new TextEncoder().encode(data);
|
|
1505
|
-
if (data
|
|
1506
|
-
if (data
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1512
|
+
if (isArrayBufferLike(data)) return new Uint8Array(data);
|
|
1513
|
+
if (isBytes(data)) return toByteView(data);
|
|
1514
|
+
if (isFunctionFile(data)) {
|
|
1515
|
+
if (isBytes(data.data)) return toByteView(data.data);
|
|
1516
|
+
if (isArrayBufferLike(data.data)) return new Uint8Array(data.data);
|
|
1517
|
+
if (typeof data.data === "string") return new TextEncoder().encode(data.data);
|
|
1518
|
+
}
|
|
1519
|
+
throw new StorageError(400, STORAGE_CODES.invalidData, describeUnsupportedUploadData(data));
|
|
1520
|
+
}
|
|
1521
|
+
function isArrayBufferLike(value) {
|
|
1522
|
+
return Object.prototype.toString.call(value) === "[object ArrayBuffer]";
|
|
1523
|
+
}
|
|
1524
|
+
function isBytes(value) {
|
|
1525
|
+
return ArrayBuffer.isView(value) && !(Object.prototype.toString.call(value) === "[object DataView]");
|
|
1526
|
+
}
|
|
1527
|
+
function toByteView(view) {
|
|
1528
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
1529
|
+
}
|
|
1530
|
+
function isFunctionFile(value) {
|
|
1531
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1532
|
+
const candidate = value;
|
|
1533
|
+
return typeof candidate.name === "string" && "data" in candidate;
|
|
1534
|
+
}
|
|
1535
|
+
function describeUnsupportedUploadData(data) {
|
|
1536
|
+
const tag = Object.prototype.toString.call(data);
|
|
1537
|
+
const constructorName = typeof data === "object" && data !== null ? data.constructor?.name ?? "unknown" : "none";
|
|
1538
|
+
return `\u4E0D\u652F\u6301\u7684\u5B58\u50A8\u6570\u636E\u7C7B\u578B\uFF08\u80FD\u529B cloud.storage\uFF0C\u65B9\u6CD5 upload\uFF09\uFF1Atypeof=${typeof data}\uFF0CtoString=${tag}\uFF0Cconstructor=${constructorName}\u3002\u652F\u6301\uFF1Astring / Uint8Array / ArrayBuffer / ctx.files\uFF08FunctionFile\uFF09\u3002\u82E5\u6570\u636E\u6765\u81EA\u5BB9\u5668\u6267\u884C\u5668\uFF0C\u8BF7\u786E\u8BA4\u5DF2\u5347\u7EA7\u5230\u5305\u542B RPC typed-array \u7F16\u89E3\u7801\u7684\u8FD0\u884C\u65F6\u955C\u50CF\u3002`;
|
|
1510
1539
|
}
|
|
1511
1540
|
function toStoredFile(meta) {
|
|
1512
1541
|
return {
|
|
@@ -2069,11 +2098,13 @@ var SimDbError = class extends Error {
|
|
|
2069
2098
|
this.code = code;
|
|
2070
2099
|
this.name = "SimDbError";
|
|
2071
2100
|
}
|
|
2101
|
+
code;
|
|
2072
2102
|
};
|
|
2073
2103
|
var ParamCursor = class {
|
|
2074
2104
|
constructor(params) {
|
|
2075
2105
|
this.params = params;
|
|
2076
2106
|
}
|
|
2107
|
+
params;
|
|
2077
2108
|
index = 0;
|
|
2078
2109
|
take() {
|
|
2079
2110
|
const v = this.params[this.index];
|
|
@@ -2255,16 +2286,19 @@ var ExcludedRef = class {
|
|
|
2255
2286
|
constructor(column) {
|
|
2256
2287
|
this.column = column;
|
|
2257
2288
|
}
|
|
2289
|
+
column;
|
|
2258
2290
|
};
|
|
2259
2291
|
var ColumnRef = class {
|
|
2260
2292
|
constructor(column) {
|
|
2261
2293
|
this.column = column;
|
|
2262
2294
|
}
|
|
2295
|
+
column;
|
|
2263
2296
|
};
|
|
2264
2297
|
var ExprRef = class {
|
|
2265
2298
|
constructor(source) {
|
|
2266
2299
|
this.source = source;
|
|
2267
2300
|
}
|
|
2301
|
+
source;
|
|
2268
2302
|
};
|
|
2269
2303
|
function resolveSetValue(value, existing, row) {
|
|
2270
2304
|
if (value instanceof ExcludedRef) return row[value.column];
|
package/dist/storage/driver.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export declare class StorageError extends Error {
|
|
|
56
56
|
}
|
|
57
57
|
export declare const STORAGE_CODES: {
|
|
58
58
|
readonly invalidPath: "STORAGE_INVALID_PATH";
|
|
59
|
+
readonly invalidData: "STORAGE_INVALID_DATA";
|
|
59
60
|
readonly notFound: "STORAGE_NOT_FOUND";
|
|
60
61
|
readonly quotaExceeded: "STORAGE_QUOTA_EXCEEDED";
|
|
61
62
|
};
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"homepage": "https://adep.top",
|
|
9
9
|
"bugs": "https://gitcode.com/yunqiang_wu/ai-yunke/issues",
|
|
10
|
-
"version": "0.3.
|
|
10
|
+
"version": "0.3.8",
|
|
11
11
|
"private": false,
|
|
12
12
|
"type": "module",
|
|
13
13
|
"sideEffects": false,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@adep/types": "0.
|
|
35
|
+
"@adep/types": "0.4.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"test": "vitest run",
|