@poe-platform/safe-js 0.1.729 → 0.1.731
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/README.md +5 -5
- package/dist/safe-js/chunks/{chunk-SJZWSPWD.js → chunk-2GVBG23M.js} +1 -1
- package/dist/safe-js/chunks/{chunk-SJZWSPWD.js.map → chunk-2GVBG23M.js.map} +1 -1
- package/dist/safe-js/chunks/{chunk-VIMROAQA.js → chunk-E4XLBT7R.js} +2 -2
- package/dist/safe-js/chunks/chunk-F6CV74HU.js +114 -0
- package/dist/safe-js/chunks/chunk-F6CV74HU.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-OZLTLIHX.js → chunk-G6WTEIJJ.js} +2 -2
- package/dist/safe-js/chunks/{chunk-XX57YCGZ.js → chunk-GNEORAQI.js} +55 -50
- package/dist/safe-js/chunks/chunk-GNEORAQI.js.map +7 -0
- package/dist/safe-js/chunks/chunk-GVKXZW53.js +76 -0
- package/dist/safe-js/chunks/chunk-GVKXZW53.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-2S4YRXI6.js → chunk-IRDQDZ5R.js} +4 -4
- package/dist/safe-js/chunks/{chunk-MRULOD5J.js → chunk-K4T4EBED.js} +59 -38
- package/dist/safe-js/chunks/chunk-K4T4EBED.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-MFCEBCGV.js → chunk-KETIFEA7.js} +17 -8
- package/dist/safe-js/chunks/chunk-KETIFEA7.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-S5YDMMM3.js → chunk-MDIWQFYU.js} +95 -169
- package/dist/safe-js/chunks/{chunk-S5YDMMM3.js.map → chunk-MDIWQFYU.js.map} +4 -4
- package/dist/safe-js/chunks/{chunk-BRBOVGNC.js → chunk-MGHE7ZFI.js} +78 -67
- package/dist/safe-js/chunks/chunk-MGHE7ZFI.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-EN724VH3.js → chunk-O4IDRXW7.js} +4 -4
- package/dist/safe-js/chunks/{chunk-EA7AHM2X.js → chunk-PSVV3IG2.js} +3 -3
- package/dist/safe-js/chunks/{chunk-Y5EZYHU6.js → chunk-QKO4FATZ.js} +33 -5
- package/dist/safe-js/chunks/chunk-QKO4FATZ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-EG3QWREA.js → chunk-RULU2F5J.js} +2 -2
- package/dist/safe-js/chunks/chunk-UQPYTZOZ.js +72 -0
- package/dist/safe-js/chunks/chunk-UQPYTZOZ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-LRSWTDIV.js → chunk-W4SWUHCQ.js} +58 -23
- package/dist/safe-js/chunks/chunk-W4SWUHCQ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-W3IY6FKO.js → chunk-WS2FJBH6.js} +2 -2
- package/dist/safe-js/chunks/{chunk-MVLDRXWS.js → chunk-X3CKAZQ4.js} +3 -3
- package/dist/safe-js/chunks/chunk-YUQFFRUF.js +26 -0
- package/dist/safe-js/chunks/chunk-YUQFFRUF.js.map +7 -0
- package/dist/safe-js/chunks/{cli-runtime-6VVBO2SS.js → cli-runtime-NUEFUM64.js} +51 -30
- package/dist/safe-js/chunks/cli-runtime-NUEFUM64.js.map +7 -0
- package/dist/safe-js/chunks/{dump-UNYK24YS.js → dump-RGRC3CG3.js} +5 -4
- package/dist/safe-js/chunks/harness-UMOMFXDT.js +11 -0
- package/dist/safe-js/chunks/mcp-S672263Q.js +12 -0
- package/dist/safe-js/chunks/migration-file-KRXQYI3Q.js +15 -0
- package/dist/safe-js/chunks/restore-GEO7VN2R.js +14 -0
- package/dist/safe-js/chunks/run-ZSFX66RN.js +20 -0
- package/dist/safe-js/chunks/runtime-modules-A3U2DKFL.js +11 -0
- package/dist/safe-js/chunks/source-files-L3SGK63Z.js +10 -0
- package/dist/safe-js/cli-runtime.d.ts +2 -0
- package/dist/safe-js/cli.js +4 -4
- package/dist/safe-js/core.d.ts +1 -0
- package/dist/safe-js/core.js +15 -8
- package/dist/safe-js/error/shape.js +170 -0
- package/dist/safe-js/index.js +42 -33
- package/dist/safe-js/index.js.map +2 -2
- package/dist/safe-js/interp/budget.js +600 -0
- package/dist/safe-js/interp/internal-symbols.js +1 -0
- package/dist/safe-js/interp/promise-replay.d.ts +1 -1
- package/dist/safe-js/interp/template-cache.js +7 -0
- package/dist/safe-js/migration-file.d.ts +2 -0
- package/dist/safe-js/modules/fs-config.d.ts +3 -1
- package/dist/safe-js/modules/fs.d.ts +8 -4
- package/dist/safe-js/modules/fs.js +16 -0
- package/dist/safe-js/modules/source-files.d.ts +3 -2
- package/dist/safe-js/platform/context.js +58 -0
- package/dist/safe-js/platform/node.js +64 -0
- package/dist/safe-js/platform/types.js +63 -0
- package/dist/safe-js/platform/workerd.js +39 -0
- package/dist/safe-js/runner/run-harness.d.ts +2 -0
- package/dist/safe-js/snapshot/backend.d.ts +2 -0
- package/package.json +9 -2
- package/dist/safe-js/chunks/chunk-BRBOVGNC.js.map +0 -7
- package/dist/safe-js/chunks/chunk-FCCA27RC.js +0 -69
- package/dist/safe-js/chunks/chunk-FCCA27RC.js.map +0 -7
- package/dist/safe-js/chunks/chunk-LRSWTDIV.js.map +0 -7
- package/dist/safe-js/chunks/chunk-MFCEBCGV.js.map +0 -7
- package/dist/safe-js/chunks/chunk-MRULOD5J.js.map +0 -7
- package/dist/safe-js/chunks/chunk-XX57YCGZ.js.map +0 -7
- package/dist/safe-js/chunks/chunk-Y5EZYHU6.js.map +0 -7
- package/dist/safe-js/chunks/cli-runtime-6VVBO2SS.js.map +0 -7
- package/dist/safe-js/chunks/fs-AOV77RQC.js +0 -13
- package/dist/safe-js/chunks/harness-ZIEO7NAV.js +0 -10
- package/dist/safe-js/chunks/mcp-WBM7ZOAN.js +0 -11
- package/dist/safe-js/chunks/migration-file-3SWGNDS2.js +0 -12
- package/dist/safe-js/chunks/restore-FCTWPLU3.js +0 -13
- package/dist/safe-js/chunks/run-ESJHEXCE.js +0 -17
- package/dist/safe-js/chunks/runtime-modules-7V6BWCRK.js +0 -10
- package/dist/safe-js/chunks/source-files-73OHLNGH.js +0 -8
- /package/dist/safe-js/chunks/{chunk-VIMROAQA.js.map → chunk-E4XLBT7R.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-OZLTLIHX.js.map → chunk-G6WTEIJJ.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-2S4YRXI6.js.map → chunk-IRDQDZ5R.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-EN724VH3.js.map → chunk-O4IDRXW7.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-EA7AHM2X.js.map → chunk-PSVV3IG2.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-EG3QWREA.js.map → chunk-RULU2F5J.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-W3IY6FKO.js.map → chunk-WS2FJBH6.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-MVLDRXWS.js.map → chunk-X3CKAZQ4.js.map} +0 -0
- /package/dist/safe-js/chunks/{dump-UNYK24YS.js.map → dump-RGRC3CG3.js.map} +0 -0
- /package/dist/safe-js/chunks/{fs-AOV77RQC.js.map → harness-UMOMFXDT.js.map} +0 -0
- /package/dist/safe-js/chunks/{harness-ZIEO7NAV.js.map → mcp-S672263Q.js.map} +0 -0
- /package/dist/safe-js/chunks/{mcp-WBM7ZOAN.js.map → migration-file-KRXQYI3Q.js.map} +0 -0
- /package/dist/safe-js/chunks/{migration-file-3SWGNDS2.js.map → restore-GEO7VN2R.js.map} +0 -0
- /package/dist/safe-js/chunks/{restore-FCTWPLU3.js.map → run-ZSFX66RN.js.map} +0 -0
- /package/dist/safe-js/chunks/{run-ESJHEXCE.js.map → runtime-modules-A3U2DKFL.js.map} +0 -0
- /package/dist/safe-js/chunks/{runtime-modules-7V6BWCRK.js.map → source-files-L3SGK63Z.js.map} +0 -0
- /package/dist/safe-js/{chunks/source-files-73OHLNGH.js.map → modules/fs.js.map} +0 -0
|
@@ -147,49 +147,59 @@ var HttpResponseMessages = class {
|
|
|
147
147
|
function isJsonValue(value, options = {}) {
|
|
148
148
|
const maxNodes = options.maxNodes ?? 1e4;
|
|
149
149
|
const maxDepth = options.maxDepth ?? 64;
|
|
150
|
-
if (!Number.isSafeInteger(maxNodes) || maxNodes < 1) throw new Error("maxNodes must be a positive safe integer");
|
|
151
|
-
if (!Number.isSafeInteger(maxDepth) || maxDepth < 0
|
|
150
|
+
if (maxNodes !== Infinity && (!Number.isSafeInteger(maxNodes) || maxNodes < 1)) throw new Error("maxNodes must be a positive safe integer");
|
|
151
|
+
if (maxDepth !== Infinity && (!Number.isSafeInteger(maxDepth) || maxDepth < 0)) throw new Error("maxDepth must be a nonnegative safe integer");
|
|
152
152
|
const ancestors = /* @__PURE__ */ new Set();
|
|
153
|
+
const stack = [];
|
|
154
|
+
function* properties(item2) {
|
|
155
|
+
if (Array.isArray(item2)) {
|
|
156
|
+
for (let index = 0; index < item2.length; index++) yield Object.getOwnPropertyDescriptor(item2, String(index));
|
|
157
|
+
} else for (const key2 in item2) {
|
|
158
|
+
const property = Object.getOwnPropertyDescriptor(item2, key2);
|
|
159
|
+
if (property !== void 0) yield property;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
153
162
|
let nodes = 0;
|
|
154
|
-
|
|
163
|
+
let item = value, depth = 0;
|
|
164
|
+
while (true) {
|
|
155
165
|
if (++nodes > maxNodes || depth > maxDepth) return false;
|
|
156
|
-
if (item
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
let valid = true;
|
|
173
|
-
if (Array.isArray(item)) {
|
|
174
|
-
if (item.length > maxNodes) valid = false;
|
|
175
|
-
else for (let index = 0; index < item.length; index++) {
|
|
176
|
-
const property = Object.getOwnPropertyDescriptor(item, String(index));
|
|
177
|
-
if (property === void 0 || !("value" in property) || !visit(property.value, depth + 1)) {
|
|
178
|
-
valid = false;
|
|
179
|
-
break;
|
|
166
|
+
if (item !== null && typeof item !== "string" && typeof item !== "boolean") {
|
|
167
|
+
if (typeof item === "number") {
|
|
168
|
+
if (!Number.isFinite(item)) return false;
|
|
169
|
+
} else {
|
|
170
|
+
if (typeof item !== "object" || ancestors.has(item)) return false;
|
|
171
|
+
if (!Array.isArray(item) && Object.getPrototypeOf(item) !== Object.prototype && Object.getPrototypeOf(item) !== null) return false;
|
|
172
|
+
let hookOwner = item;
|
|
173
|
+
let prototypeDepth = 0;
|
|
174
|
+
while (hookOwner !== null) {
|
|
175
|
+
if (++prototypeDepth > 64) return false;
|
|
176
|
+
const serializationHook = Object.getOwnPropertyDescriptor(hookOwner, "toJSON");
|
|
177
|
+
if (serializationHook !== void 0) {
|
|
178
|
+
if (!("value" in serializationHook) || typeof serializationHook.value === "function") return false;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
hookOwner = Object.getPrototypeOf(hookOwner);
|
|
180
182
|
}
|
|
183
|
+
if (Array.isArray(item) && item.length > maxNodes) return false;
|
|
184
|
+
ancestors.add(item);
|
|
185
|
+
stack.push({ owner: item, children: properties(item), depth });
|
|
181
186
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
}
|
|
188
|
+
let next;
|
|
189
|
+
while (stack.length) {
|
|
190
|
+
const frame = stack[stack.length - 1];
|
|
191
|
+
next = frame.children.next();
|
|
192
|
+
if (!next.done) {
|
|
193
|
+
if (next.value === void 0 || !("value" in next.value)) return false;
|
|
194
|
+
item = next.value.value;
|
|
195
|
+
depth = frame.depth + 1;
|
|
186
196
|
break;
|
|
187
197
|
}
|
|
198
|
+
ancestors.delete(frame.owner);
|
|
199
|
+
stack.pop();
|
|
188
200
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
};
|
|
192
|
-
return visit(value, 0);
|
|
201
|
+
if (!stack.length) return true;
|
|
202
|
+
}
|
|
193
203
|
}
|
|
194
204
|
|
|
195
205
|
// packages/toolcraft-schema/src/json-schema/utils.ts
|
|
@@ -3637,38 +3647,39 @@ async function waitForOAuthOperation(operation, signal) {
|
|
|
3637
3647
|
// packages/mcp-oauth/src/client/bounded-json.ts
|
|
3638
3648
|
function copyBoundedOAuthJson(value, message) {
|
|
3639
3649
|
const invalid = () => new Error(message);
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
if (input === null || typeof input === "boolean" || typeof input === "string") return input;
|
|
3644
|
-
if (typeof input === "number" && Number.isFinite(input)) return input;
|
|
3645
|
-
if (typeof input !== "object" || input === null) throw invalid();
|
|
3646
|
-
const descriptors = Object.getOwnPropertyDescriptors(input);
|
|
3647
|
-
if (Array.isArray(input)) {
|
|
3648
|
-
const length = descriptors.length?.value;
|
|
3649
|
-
if (length > 2e4) throw invalid();
|
|
3650
|
-
const result2 = [];
|
|
3651
|
-
for (let index = 0; index < length; index++) {
|
|
3652
|
-
const descriptor = descriptors[String(index)];
|
|
3653
|
-
if (descriptor === void 0 || !Object.hasOwn(descriptor, "value")) throw invalid();
|
|
3654
|
-
result2.push(copy(descriptor.value, depth + 1));
|
|
3655
|
-
}
|
|
3656
|
-
return result2;
|
|
3657
|
-
}
|
|
3658
|
-
if (Object.getPrototypeOf(input) !== Object.prototype && Object.getPrototypeOf(input) !== null) throw invalid();
|
|
3659
|
-
return Object.fromEntries(Object.entries(descriptors).filter(([, descriptor]) => descriptor.enumerable).map(([key2, descriptor]) => {
|
|
3660
|
-
if (!Object.hasOwn(descriptor, "value")) throw invalid();
|
|
3661
|
-
return [key2, copy(descriptor.value, depth + 1)];
|
|
3662
|
-
}));
|
|
3663
|
-
}
|
|
3664
|
-
let result;
|
|
3650
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
3651
|
+
const root = {};
|
|
3652
|
+
const tasks = [{ input: value, target: root, key: "value" }];
|
|
3665
3653
|
try {
|
|
3666
|
-
|
|
3654
|
+
while (tasks.length) {
|
|
3655
|
+
const task = tasks.pop();
|
|
3656
|
+
if ("leave" in task) {
|
|
3657
|
+
ancestors.delete(task.leave);
|
|
3658
|
+
continue;
|
|
3659
|
+
}
|
|
3660
|
+
const { input, target, key: key2 } = task;
|
|
3661
|
+
let output = input;
|
|
3662
|
+
if (input !== null && typeof input !== "boolean" && typeof input !== "string" && !(typeof input === "number" && Number.isFinite(input))) {
|
|
3663
|
+
if (typeof input !== "object" || input === null || ancestors.has(input)) throw invalid();
|
|
3664
|
+
const descriptors = Object.getOwnPropertyDescriptors(input);
|
|
3665
|
+
const array = Array.isArray(input);
|
|
3666
|
+
if (!array && Object.getPrototypeOf(input) !== Object.prototype && Object.getPrototypeOf(input) !== null) throw invalid();
|
|
3667
|
+
output = array ? [] : {};
|
|
3668
|
+
ancestors.add(input);
|
|
3669
|
+
tasks.push({ leave: input });
|
|
3670
|
+
const keys = array ? Array.from({ length: input.length }, (_, index) => String(index)) : Object.keys(descriptors).filter((name) => descriptors[name].enumerable);
|
|
3671
|
+
for (let index = keys.length - 1; index >= 0; index--) {
|
|
3672
|
+
const name = keys[index], descriptor = descriptors[name];
|
|
3673
|
+
if (descriptor === void 0 || !Object.hasOwn(descriptor, "value")) throw invalid();
|
|
3674
|
+
tasks.push({ input: descriptor.value, target: output, key: name });
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
Object.defineProperty(target, key2, { value: output, enumerable: true, configurable: true, writable: true });
|
|
3678
|
+
}
|
|
3679
|
+
return root.value;
|
|
3667
3680
|
} catch {
|
|
3668
3681
|
throw invalid();
|
|
3669
3682
|
}
|
|
3670
|
-
if (Buffer.byteLength(JSON.stringify(result), "utf8") > 64 * 1024) throw invalid();
|
|
3671
|
-
return result;
|
|
3672
3683
|
}
|
|
3673
3684
|
|
|
3674
3685
|
// packages/mcp-oauth/src/client/loopback-authorization.ts
|
|
@@ -5183,7 +5194,7 @@ function generateCodeChallenge(verifier) {
|
|
|
5183
5194
|
|
|
5184
5195
|
// packages/mcp-oauth/src/http-response.ts
|
|
5185
5196
|
async function readBoundedResponseText(response, maxBytes, readers, signal) {
|
|
5186
|
-
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
|
|
5197
|
+
if (maxBytes !== Infinity && (!Number.isSafeInteger(maxBytes) || maxBytes < 1))
|
|
5187
5198
|
throw new Error("HTTP response byte limit must be a positive safe integer");
|
|
5188
5199
|
if (signal?.aborted) {
|
|
5189
5200
|
void response.body?.cancel().catch(() => void 0);
|
|
@@ -7777,7 +7788,7 @@ var HttpTransport = class {
|
|
|
7777
7788
|
onWarning,
|
|
7778
7789
|
maxResponseBytes = 16 * 1024 * 1024
|
|
7779
7790
|
}) {
|
|
7780
|
-
if (!Number.isSafeInteger(maxResponseBytes) || maxResponseBytes < 1)
|
|
7791
|
+
if (maxResponseBytes !== Infinity && (!Number.isSafeInteger(maxResponseBytes) || maxResponseBytes < 1))
|
|
7781
7792
|
throw new Error("HTTP response byte limit must be a positive safe integer");
|
|
7782
7793
|
try {
|
|
7783
7794
|
const target = new URL(url);
|
|
@@ -8520,7 +8531,7 @@ var SseParser = class {
|
|
|
8520
8531
|
constructor(maxEventBytes = 16 * 1024 * 1024, acceptEndpoint = false) {
|
|
8521
8532
|
this.maxEventBytes = maxEventBytes;
|
|
8522
8533
|
this.acceptEndpoint = acceptEndpoint;
|
|
8523
|
-
if (!Number.isSafeInteger(maxEventBytes) || maxEventBytes < 1)
|
|
8534
|
+
if (maxEventBytes !== Infinity && (!Number.isSafeInteger(maxEventBytes) || maxEventBytes < 1))
|
|
8524
8535
|
throw new Error("SSE event byte limit must be a positive safe integer");
|
|
8525
8536
|
}
|
|
8526
8537
|
maxEventBytes;
|
|
@@ -9818,4 +9829,4 @@ CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
|
|
|
9818
9829
|
the full license text.
|
|
9819
9830
|
|
|
9820
9831
|
*/
|
|
9821
|
-
//# sourceMappingURL=chunk-
|
|
9832
|
+
//# sourceMappingURL=chunk-MGHE7ZFI.js.map
|