@niscorp/moss 0.8.1 → 0.9.0
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/CHANGELOG.md +31 -0
- package/DOCS.md +87 -26
- package/README.md +9 -8
- package/dist/{chunk-3DCTQKPQ.cjs → chunk-E6YAYR7G.cjs} +22 -5
- package/dist/chunk-E6YAYR7G.cjs.map +1 -0
- package/dist/{chunk-TMDKNZYL.cjs → chunk-L2GHVTJW.cjs} +103 -71
- package/dist/chunk-L2GHVTJW.cjs.map +1 -0
- package/dist/{chunk-I4UOWER3.cjs → chunk-LKTS4PCD.cjs} +5 -5
- package/dist/{chunk-I4UOWER3.cjs.map → chunk-LKTS4PCD.cjs.map} +1 -1
- package/dist/{chunk-3T422CCN.js → chunk-UUOATPZ7.js} +3 -3
- package/dist/{chunk-3T422CCN.js.map → chunk-UUOATPZ7.js.map} +1 -1
- package/dist/{chunk-6XC2MD7S.js → chunk-WTWRLOPK.js} +22 -5
- package/dist/chunk-WTWRLOPK.js.map +1 -0
- package/dist/{chunk-YZILOVCR.js → chunk-Y7PRASR3.js} +49 -18
- package/dist/chunk-Y7PRASR3.js.map +1 -0
- package/dist/{document-BYAY-Qle.d.ts → document-C3aS9uiW.d.ts} +2 -1
- package/dist/{document-DAE71J27.d.cts → document-deAs7Dre.d.cts} +2 -1
- package/dist/index.cjs +17 -13
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +2 -2
- package/dist/integrations.cjs +12 -5
- package/dist/integrations.cjs.map +1 -1
- package/dist/integrations.js +12 -5
- package/dist/integrations.js.map +1 -1
- package/dist/node.cjs +7 -7
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/unverified.cjs +2 -2
- package/dist/unverified.js +1 -1
- package/dist/vite.cjs +8 -8
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -3
- package/package.json +12 -12
- package/dist/chunk-3DCTQKPQ.cjs.map +0 -1
- package/dist/chunk-6XC2MD7S.js.map +0 -1
- package/dist/chunk-TMDKNZYL.cjs.map +0 -1
- package/dist/chunk-YZILOVCR.js.map +0 -1
package/dist/integrations.js
CHANGED
|
@@ -406,6 +406,7 @@ var BundleSchema = z.object({
|
|
|
406
406
|
extension: z.unknown().optional()
|
|
407
407
|
}).strict();
|
|
408
408
|
var AUDIENCE = /^[a-z][a-z0-9-]*$/;
|
|
409
|
+
var VEX_ROUTE = /^\/api\/(?:[A-Za-z0-9_-]+\/)?vex$/;
|
|
409
410
|
var upgradeBundle = (payload, upgrader) => {
|
|
410
411
|
if (upgrader === void 0 || !isRecord(payload) || !isRecord(payload["actions"])) return { ok: true, payload };
|
|
411
412
|
const declared = payload["grammar"];
|
|
@@ -423,6 +424,13 @@ var upgradeBundle = (payload, upgrader) => {
|
|
|
423
424
|
};
|
|
424
425
|
}
|
|
425
426
|
};
|
|
427
|
+
var ownPathReasons = (endpoint, url, path, own) => {
|
|
428
|
+
if (path.includes("{{")) return [`${endpoint} calls "${url}", whose path is filled in when it is called: only the query, after "?", may hold a template`];
|
|
429
|
+
const resolved = new URL(path, "http://nisc.local").pathname;
|
|
430
|
+
if (resolved !== path) return [`${endpoint} calls "${url}", whose path resolves to "${resolved}": write it as it resolves, under ${own}`];
|
|
431
|
+
if (path.startsWith(`${own}hook/`)) return [`${endpoint} is under /hook/, which is the unauthenticated webhook path`];
|
|
432
|
+
return [];
|
|
433
|
+
};
|
|
426
434
|
var endpointReasons = (id, action, ctx) => {
|
|
427
435
|
const reasons = [];
|
|
428
436
|
for (const [name, endpoint] of Object.entries(action.endpoints ?? {})) {
|
|
@@ -432,13 +440,12 @@ var endpointReasons = (id, action, ctx) => {
|
|
|
432
440
|
}
|
|
433
441
|
const url = endpoint.url;
|
|
434
442
|
const own = `/integrations/${ctx.integrationId}/`;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
443
|
+
const path = url.split("?")[0] ?? "";
|
|
444
|
+
if (path.startsWith(own)) {
|
|
445
|
+
reasons.push(...ownPathReasons(`action ${id}: endpoint "${name}"`, url, path, own));
|
|
439
446
|
continue;
|
|
440
447
|
}
|
|
441
|
-
if (!
|
|
448
|
+
if (!VEX_ROUTE.test(url)) {
|
|
442
449
|
reasons.push(`action ${id}: endpoint "${name}" calls "${url}" \u2014 only ${own}* or /api/*/vex`);
|
|
443
450
|
continue;
|
|
444
451
|
}
|