poe-code 12.0.5 → 12.0.6
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 +4 -2
- package/dist/index.js +98 -17
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-RRSINVWT.js → chunk-KJSS53IH.js} +2 -2
- package/packages/safejs/dist/chunks/{chunk-XBRQ72W6.js → chunk-NDHGDM46.js} +89 -17
- package/packages/safejs/dist/chunks/{chunk-XBRQ72W6.js.map → chunk-NDHGDM46.js.map} +3 -3
- package/packages/safejs/dist/cli.js +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.js +2 -2
- package/packages/safejs/dist/interp/methods/collection-callback.d.ts +7 -0
- package/packages/safejs/dist/interp/methods/collection-callback.js +68 -0
- package/packages/safejs/dist/interp/methods/map.js +18 -9
- package/packages/safejs/dist/interp/methods/set.js +17 -9
- /package/packages/safejs/dist/chunks/{chunk-RRSINVWT.js.map → chunk-KJSS53IH.js.map} +0 -0
package/README.md
CHANGED
|
@@ -263,8 +263,10 @@ Uses `POE_API_KEY` or the stored credential and honors `POE_BASE_URL`. Throws an
|
|
|
263
263
|
|
|
264
264
|
### Shared filesystem foundation
|
|
265
265
|
|
|
266
|
-
`poe-code@12.0.
|
|
267
|
-
|
|
266
|
+
`poe-code@12.0.5` publishes the Node.js foundation at `poe-code/safe-fs`
|
|
267
|
+
and shared filesystem integration for the SafeJS SDK and both CLIs.
|
|
268
|
+
The installed release was verified on Node 18.18.2, 18.20.8, 20.20.0,
|
|
269
|
+
22.22.2 and 24.14.0, including public runtime and TypeScript consumers.
|
|
268
270
|
`@poe-code/safe-fs` is the private workspace name, not a public npm import.
|
|
269
271
|
|
|
270
272
|
The implemented foundation contains memory, host-directory, S3 and WebDAV
|
package/dist/index.js
CHANGED
|
@@ -144228,6 +144228,74 @@ var init_function = __esm({
|
|
|
144228
144228
|
}
|
|
144229
144229
|
});
|
|
144230
144230
|
|
|
144231
|
+
// packages/safejs/src/interp/methods/collection-callback.ts
|
|
144232
|
+
function enterKeyedCollectionCallback(target, keys, budget) {
|
|
144233
|
+
let state = activeCallbacks.get(target);
|
|
144234
|
+
if (state === void 0) {
|
|
144235
|
+
state = { cursors: /* @__PURE__ */ new Set(), leaveRunning: enterRunningState(target) };
|
|
144236
|
+
activeCallbacks.set(target, state);
|
|
144237
|
+
}
|
|
144238
|
+
const cursor2 = { budget, pending: /* @__PURE__ */ new Set() };
|
|
144239
|
+
state.cursors.add(cursor2);
|
|
144240
|
+
const leave = () => {
|
|
144241
|
+
if (!state.cursors.delete(cursor2)) return;
|
|
144242
|
+
cursor2.pending.clear();
|
|
144243
|
+
budget.setRetainedDataUsage(cursor2, 0);
|
|
144244
|
+
budget.setRetainedValues(cursor2, void 0);
|
|
144245
|
+
if (state.cursors.size === 0) {
|
|
144246
|
+
activeCallbacks.delete(target);
|
|
144247
|
+
state.leaveRunning();
|
|
144248
|
+
}
|
|
144249
|
+
};
|
|
144250
|
+
try {
|
|
144251
|
+
budget.setRetainedDataUsage(cursor2, 1);
|
|
144252
|
+
budget.setRetainedValues(cursor2, () => cursor2.pending);
|
|
144253
|
+
for (const key3 of keys) updatePendingKeys(cursor2, "add", key3);
|
|
144254
|
+
} catch (error3) {
|
|
144255
|
+
leave();
|
|
144256
|
+
throw error3;
|
|
144257
|
+
}
|
|
144258
|
+
return {
|
|
144259
|
+
next: () => {
|
|
144260
|
+
budget.visitNode();
|
|
144261
|
+
for (const key3 of cursor2.pending) {
|
|
144262
|
+
cursor2.pending.delete(key3);
|
|
144263
|
+
budget.setRetainedDataUsage(cursor2, 1 + cursor2.pending.size);
|
|
144264
|
+
return { done: false, value: key3 };
|
|
144265
|
+
}
|
|
144266
|
+
return { done: true, value: void 0 };
|
|
144267
|
+
},
|
|
144268
|
+
leave
|
|
144269
|
+
};
|
|
144270
|
+
}
|
|
144271
|
+
function updateKeyedCollectionCallbacks(target, mutation, key3) {
|
|
144272
|
+
const state = activeCallbacks.get(target);
|
|
144273
|
+
if (state === void 0) return;
|
|
144274
|
+
for (const cursor2 of state.cursors) updatePendingKeys(cursor2, mutation, key3);
|
|
144275
|
+
}
|
|
144276
|
+
function updatePendingKeys(cursor2, mutation, key3) {
|
|
144277
|
+
const { budget, pending } = cursor2;
|
|
144278
|
+
budget.visitNode();
|
|
144279
|
+
if (mutation === "add") {
|
|
144280
|
+
const nextSize = pending.has(key3) ? pending.size : pending.size + 1;
|
|
144281
|
+
budget.allocateCollectionEntries(nextSize);
|
|
144282
|
+
budget.setRetainedDataUsage(cursor2, 1 + nextSize);
|
|
144283
|
+
pending.add(key3);
|
|
144284
|
+
} else {
|
|
144285
|
+
if (mutation === "delete") pending.delete(key3);
|
|
144286
|
+
else pending.clear();
|
|
144287
|
+
budget.setRetainedDataUsage(cursor2, 1 + pending.size);
|
|
144288
|
+
}
|
|
144289
|
+
}
|
|
144290
|
+
var activeCallbacks;
|
|
144291
|
+
var init_collection_callback = __esm({
|
|
144292
|
+
"packages/safejs/src/interp/methods/collection-callback.ts"() {
|
|
144293
|
+
"use strict";
|
|
144294
|
+
init_running_state();
|
|
144295
|
+
activeCallbacks = /* @__PURE__ */ new WeakMap();
|
|
144296
|
+
}
|
|
144297
|
+
});
|
|
144298
|
+
|
|
144231
144299
|
// packages/safejs/src/interp/methods/map.ts
|
|
144232
144300
|
function isMapMethodName(value) {
|
|
144233
144301
|
return typeof value === "string" && mapMethodNames.has(value);
|
|
@@ -144251,34 +144319,40 @@ async function callMapMethod(target, methodName, args, options, stack = []) {
|
|
|
144251
144319
|
return target.entries.get(args[0]);
|
|
144252
144320
|
case "set": {
|
|
144253
144321
|
assertCollectionMutable(target);
|
|
144254
|
-
const
|
|
144322
|
+
const exists4 = target.entries.has(args[0]);
|
|
144323
|
+
const nextSize = exists4 ? target.entries.size : target.entries.size + 1;
|
|
144255
144324
|
options.budget.allocateCollectionEntries(nextSize);
|
|
144325
|
+
if (!exists4) updateKeyedCollectionCallbacks(target, "add", args[0]);
|
|
144256
144326
|
target.entries.set(args[0], args[1]);
|
|
144257
144327
|
return target;
|
|
144258
144328
|
}
|
|
144259
144329
|
case "has":
|
|
144260
144330
|
return target.entries.has(args[0]);
|
|
144261
|
-
case "delete":
|
|
144331
|
+
case "delete": {
|
|
144262
144332
|
assertCollectionMutable(target);
|
|
144263
|
-
|
|
144333
|
+
const deleted = target.entries.delete(args[0]);
|
|
144334
|
+
if (deleted) updateKeyedCollectionCallbacks(target, "delete", args[0]);
|
|
144335
|
+
return deleted;
|
|
144336
|
+
}
|
|
144264
144337
|
case "clear":
|
|
144265
144338
|
assertCollectionMutable(target);
|
|
144266
144339
|
target.entries.clear();
|
|
144340
|
+
updateKeyedCollectionCallbacks(target, "clear");
|
|
144267
144341
|
return void 0;
|
|
144268
144342
|
case "forEach": {
|
|
144269
144343
|
const callback = args[0];
|
|
144270
144344
|
if (!isSandboxClosure(callback)) {
|
|
144271
144345
|
throw new TypeError("Map.prototype.forEach requires a callback function.");
|
|
144272
144346
|
}
|
|
144273
|
-
const
|
|
144347
|
+
const cursor2 = enterKeyedCollectionCallback(target, target.entries.keys(), options.budget);
|
|
144274
144348
|
try {
|
|
144275
|
-
|
|
144276
|
-
|
|
144277
|
-
const
|
|
144349
|
+
for (let entry = cursor2.next(); !entry.done; entry = cursor2.next()) {
|
|
144350
|
+
const key3 = entry.value;
|
|
144351
|
+
const value = target.entries.get(key3);
|
|
144278
144352
|
await options.callClosure(callback, [value, key3, target], stack, args[1]);
|
|
144279
144353
|
}
|
|
144280
144354
|
} finally {
|
|
144281
|
-
|
|
144355
|
+
cursor2.leave();
|
|
144282
144356
|
}
|
|
144283
144357
|
return void 0;
|
|
144284
144358
|
}
|
|
@@ -144299,6 +144373,7 @@ var init_map = __esm({
|
|
|
144299
144373
|
"use strict";
|
|
144300
144374
|
init_values();
|
|
144301
144375
|
init_running_state();
|
|
144376
|
+
init_collection_callback();
|
|
144302
144377
|
mapMethodNames = /* @__PURE__ */ new Set([
|
|
144303
144378
|
"get",
|
|
144304
144379
|
"set",
|
|
@@ -145104,34 +145179,39 @@ async function callSetMethod(target, methodName, args, options, stack = []) {
|
|
|
145104
145179
|
switch (methodName) {
|
|
145105
145180
|
case "add": {
|
|
145106
145181
|
assertCollectionMutable(target);
|
|
145107
|
-
const
|
|
145182
|
+
const exists4 = target.values.has(args[0]);
|
|
145183
|
+
const nextSize = exists4 ? target.values.size : target.values.size + 1;
|
|
145108
145184
|
options.budget.allocateCollectionEntries(nextSize);
|
|
145185
|
+
if (!exists4) updateKeyedCollectionCallbacks(target, "add", args[0]);
|
|
145109
145186
|
target.values.add(args[0]);
|
|
145110
145187
|
return target;
|
|
145111
145188
|
}
|
|
145112
145189
|
case "has":
|
|
145113
145190
|
return target.values.has(args[0]);
|
|
145114
|
-
case "delete":
|
|
145191
|
+
case "delete": {
|
|
145115
145192
|
assertCollectionMutable(target);
|
|
145116
|
-
|
|
145193
|
+
const deleted = target.values.delete(args[0]);
|
|
145194
|
+
if (deleted) updateKeyedCollectionCallbacks(target, "delete", args[0]);
|
|
145195
|
+
return deleted;
|
|
145196
|
+
}
|
|
145117
145197
|
case "clear":
|
|
145118
145198
|
assertCollectionMutable(target);
|
|
145119
145199
|
target.values.clear();
|
|
145200
|
+
updateKeyedCollectionCallbacks(target, "clear");
|
|
145120
145201
|
return void 0;
|
|
145121
145202
|
case "forEach": {
|
|
145122
145203
|
const callback = args[0];
|
|
145123
145204
|
if (!isSandboxClosure(callback)) {
|
|
145124
145205
|
throw new TypeError("Set.prototype.forEach requires a callback function.");
|
|
145125
145206
|
}
|
|
145126
|
-
const
|
|
145207
|
+
const cursor2 = enterKeyedCollectionCallback(target, target.values, options.budget);
|
|
145127
145208
|
try {
|
|
145128
|
-
|
|
145129
|
-
|
|
145130
|
-
const value = values[index];
|
|
145209
|
+
for (let entry = cursor2.next(); !entry.done; entry = cursor2.next()) {
|
|
145210
|
+
const value = entry.value;
|
|
145131
145211
|
await options.callClosure(callback, [value, value, target], stack, args[1]);
|
|
145132
145212
|
}
|
|
145133
145213
|
} finally {
|
|
145134
|
-
|
|
145214
|
+
cursor2.leave();
|
|
145135
145215
|
}
|
|
145136
145216
|
return void 0;
|
|
145137
145217
|
}
|
|
@@ -145151,6 +145231,7 @@ var init_set = __esm({
|
|
|
145151
145231
|
"use strict";
|
|
145152
145232
|
init_values();
|
|
145153
145233
|
init_running_state();
|
|
145234
|
+
init_collection_callback();
|
|
145154
145235
|
setMethodNames = /* @__PURE__ */ new Set([
|
|
145155
145236
|
"add",
|
|
145156
145237
|
"has",
|
|
@@ -156371,7 +156452,7 @@ var init_package2 = __esm({
|
|
|
156371
156452
|
"package.json"() {
|
|
156372
156453
|
package_default2 = {
|
|
156373
156454
|
name: "poe-code",
|
|
156374
|
-
version: "12.0.
|
|
156455
|
+
version: "12.0.6",
|
|
156375
156456
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
156376
156457
|
license: "MIT",
|
|
156377
156458
|
type: "module",
|