@arcote.tech/arc-cli 0.4.8 → 0.4.10
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 +1 -9
- package/package.json +1 -1
- package/src/platform/server.ts +1 -13
package/dist/index.js
CHANGED
|
@@ -27843,35 +27843,27 @@ function parseArcTokensHeader(header) {
|
|
|
27843
27843
|
}
|
|
27844
27844
|
async function filterManifestForTokens(manifest, moduleAccessMap, tokenPayloads) {
|
|
27845
27845
|
const filtered = [];
|
|
27846
|
-
console.log(`[arc:modules] Filtering ${manifest.modules.length} modules with ${tokenPayloads.length} token(s):`, tokenPayloads.map((t) => `${t.tokenType}(${JSON.stringify(t.params)})`).join(", ") || "none");
|
|
27847
|
-
console.log(`[arc:modules] Protected modules:`, [...moduleAccessMap.keys()].join(", ") || "none");
|
|
27848
27846
|
for (const mod of manifest.modules) {
|
|
27849
27847
|
const access = moduleAccessMap.get(mod.name);
|
|
27850
27848
|
if (!access) {
|
|
27851
27849
|
filtered.push(mod);
|
|
27852
27850
|
continue;
|
|
27853
27851
|
}
|
|
27854
|
-
if (tokenPayloads.length === 0)
|
|
27855
|
-
console.log(`[arc:modules] ${mod.name}: SKIP (no tokens)`);
|
|
27852
|
+
if (tokenPayloads.length === 0)
|
|
27856
27853
|
continue;
|
|
27857
|
-
}
|
|
27858
27854
|
let granted = false;
|
|
27859
27855
|
for (const rule of access.rules) {
|
|
27860
27856
|
const matching = tokenPayloads.find((t) => t.tokenType === rule.token.name);
|
|
27861
27857
|
if (matching) {
|
|
27862
27858
|
granted = rule.check ? await rule.check(matching) : true;
|
|
27863
|
-
console.log(`[arc:modules] ${mod.name}: rule ${rule.token.name} matched token, check=${granted}`);
|
|
27864
27859
|
if (granted)
|
|
27865
27860
|
break;
|
|
27866
|
-
} else {
|
|
27867
|
-
console.log(`[arc:modules] ${mod.name}: rule needs "${rule.token.name}", no matching token (have: ${tokenPayloads.map((t) => t.tokenType).join(",")})`);
|
|
27868
27861
|
}
|
|
27869
27862
|
}
|
|
27870
27863
|
if (granted) {
|
|
27871
27864
|
filtered.push({ ...mod, url: signModuleUrl(mod.file) });
|
|
27872
27865
|
}
|
|
27873
27866
|
}
|
|
27874
|
-
console.log(`[arc:modules] Result: ${filtered.map((m2) => m2.name).join(", ")}`);
|
|
27875
27867
|
return { modules: filtered, buildTime: manifest.buildTime };
|
|
27876
27868
|
}
|
|
27877
27869
|
function staticFilesHandler(ws, devMode, moduleAccessMap) {
|
package/package.json
CHANGED
package/src/platform/server.ts
CHANGED
|
@@ -215,10 +215,6 @@ async function filterManifestForTokens(
|
|
|
215
215
|
): Promise<BuildManifest> {
|
|
216
216
|
const filtered: ModuleEntry[] = [];
|
|
217
217
|
|
|
218
|
-
console.log(`[arc:modules] Filtering ${manifest.modules.length} modules with ${tokenPayloads.length} token(s):`,
|
|
219
|
-
tokenPayloads.map(t => `${t.tokenType}(${JSON.stringify(t.params)})`).join(", ") || "none");
|
|
220
|
-
console.log(`[arc:modules] Protected modules:`, [...moduleAccessMap.keys()].join(", ") || "none");
|
|
221
|
-
|
|
222
218
|
for (const mod of manifest.modules) {
|
|
223
219
|
const access = moduleAccessMap.get(mod.name);
|
|
224
220
|
|
|
@@ -227,10 +223,7 @@ async function filterManifestForTokens(
|
|
|
227
223
|
continue;
|
|
228
224
|
}
|
|
229
225
|
|
|
230
|
-
if (tokenPayloads.length === 0)
|
|
231
|
-
console.log(`[arc:modules] ${mod.name}: SKIP (no tokens)`);
|
|
232
|
-
continue;
|
|
233
|
-
}
|
|
226
|
+
if (tokenPayloads.length === 0) continue;
|
|
234
227
|
|
|
235
228
|
let granted = false;
|
|
236
229
|
for (const rule of access.rules) {
|
|
@@ -239,10 +232,7 @@ async function filterManifestForTokens(
|
|
|
239
232
|
);
|
|
240
233
|
if (matching) {
|
|
241
234
|
granted = rule.check ? await rule.check(matching) : true;
|
|
242
|
-
console.log(`[arc:modules] ${mod.name}: rule ${rule.token.name} matched token, check=${granted}`);
|
|
243
235
|
if (granted) break;
|
|
244
|
-
} else {
|
|
245
|
-
console.log(`[arc:modules] ${mod.name}: rule needs "${rule.token.name}", no matching token (have: ${tokenPayloads.map(t => t.tokenType).join(",")})`);
|
|
246
236
|
}
|
|
247
237
|
}
|
|
248
238
|
|
|
@@ -250,8 +240,6 @@ async function filterManifestForTokens(
|
|
|
250
240
|
filtered.push({ ...mod, url: signModuleUrl(mod.file) } as any);
|
|
251
241
|
}
|
|
252
242
|
}
|
|
253
|
-
|
|
254
|
-
console.log(`[arc:modules] Result: ${filtered.map(m => m.name).join(", ")}`);
|
|
255
243
|
return { modules: filtered, buildTime: manifest.buildTime };
|
|
256
244
|
}
|
|
257
245
|
|