@niscorp/moss 0.8.1 → 0.8.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/DOCS.md +49 -12
  3. package/dist/{chunk-YZILOVCR.js → chunk-4M2MALV7.js} +18 -8
  4. package/dist/chunk-4M2MALV7.js.map +1 -0
  5. package/dist/{chunk-3DCTQKPQ.cjs → chunk-E6YAYR7G.cjs} +22 -5
  6. package/dist/chunk-E6YAYR7G.cjs.map +1 -0
  7. package/dist/{chunk-I4UOWER3.cjs → chunk-KLZYTSR2.cjs} +5 -5
  8. package/dist/{chunk-I4UOWER3.cjs.map → chunk-KLZYTSR2.cjs.map} +1 -1
  9. package/dist/{chunk-TMDKNZYL.cjs → chunk-QB7U2JDQ.cjs} +73 -63
  10. package/dist/chunk-QB7U2JDQ.cjs.map +1 -0
  11. package/dist/{chunk-3T422CCN.js → chunk-S4JSTWAE.js} +3 -3
  12. package/dist/{chunk-3T422CCN.js.map → chunk-S4JSTWAE.js.map} +1 -1
  13. package/dist/{chunk-6XC2MD7S.js → chunk-WTWRLOPK.js} +22 -5
  14. package/dist/chunk-WTWRLOPK.js.map +1 -0
  15. package/dist/{document-BYAY-Qle.d.ts → document-C3aS9uiW.d.ts} +2 -1
  16. package/dist/{document-DAE71J27.d.cts → document-deAs7Dre.d.cts} +2 -1
  17. package/dist/index.cjs +13 -13
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +2 -2
  21. package/dist/integrations.cjs +12 -5
  22. package/dist/integrations.cjs.map +1 -1
  23. package/dist/integrations.js +12 -5
  24. package/dist/integrations.js.map +1 -1
  25. package/dist/node.cjs +7 -7
  26. package/dist/node.d.cts +1 -1
  27. package/dist/node.d.ts +1 -1
  28. package/dist/node.js +3 -3
  29. package/dist/unverified.cjs +2 -2
  30. package/dist/unverified.js +1 -1
  31. package/dist/vite.cjs +8 -8
  32. package/dist/vite.d.cts +1 -1
  33. package/dist/vite.d.ts +1 -1
  34. package/dist/vite.js +3 -3
  35. package/package.json +9 -9
  36. package/dist/chunk-3DCTQKPQ.cjs.map +0 -1
  37. package/dist/chunk-6XC2MD7S.js.map +0 -1
  38. package/dist/chunk-TMDKNZYL.cjs.map +0 -1
  39. package/dist/chunk-YZILOVCR.js.map +0 -1
@@ -408,6 +408,7 @@ var BundleSchema = zod.z.object({
408
408
  extension: zod.z.unknown().optional()
409
409
  }).strict();
410
410
  var AUDIENCE = /^[a-z][a-z0-9-]*$/;
411
+ var VEX_ROUTE = /^\/api\/(?:[A-Za-z0-9_-]+\/)?vex$/;
411
412
  var upgradeBundle = (payload, upgrader) => {
412
413
  if (upgrader === void 0 || !reflect.isRecord(payload) || !reflect.isRecord(payload["actions"])) return { ok: true, payload };
413
414
  const declared = payload["grammar"];
@@ -425,6 +426,13 @@ var upgradeBundle = (payload, upgrader) => {
425
426
  };
426
427
  }
427
428
  };
429
+ var ownPathReasons = (endpoint, url, path, own) => {
430
+ if (path.includes("{{")) return [`${endpoint} calls "${url}", whose path is filled in when it is called: only the query, after "?", may hold a template`];
431
+ const resolved = new URL(path, "http://nisc.local").pathname;
432
+ if (resolved !== path) return [`${endpoint} calls "${url}", whose path resolves to "${resolved}": write it as it resolves, under ${own}`];
433
+ if (path.startsWith(`${own}hook/`)) return [`${endpoint} is under /hook/, which is the unauthenticated webhook path`];
434
+ return [];
435
+ };
428
436
  var endpointReasons = (id, action, ctx) => {
429
437
  const reasons = [];
430
438
  for (const [name, endpoint] of Object.entries(action.endpoints ?? {})) {
@@ -434,13 +442,12 @@ var endpointReasons = (id, action, ctx) => {
434
442
  }
435
443
  const url = endpoint.url;
436
444
  const own = `/integrations/${ctx.integrationId}/`;
437
- if (url.startsWith(own)) {
438
- if (url.startsWith(`${own}hook/`)) {
439
- reasons.push(`action ${id}: endpoint "${name}" is under /hook/, which is the unauthenticated webhook path`);
440
- }
445
+ const path = url.split("?")[0] ?? "";
446
+ if (path.startsWith(own)) {
447
+ reasons.push(...ownPathReasons(`action ${id}: endpoint "${name}"`, url, path, own));
441
448
  continue;
442
449
  }
443
- if (!url.startsWith("/api/")) {
450
+ if (!VEX_ROUTE.test(url)) {
444
451
  reasons.push(`action ${id}: endpoint "${name}" calls "${url}" \u2014 only ${own}* or /api/*/vex`);
445
452
  continue;
446
453
  }