@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
@@ -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
- if (url.startsWith(own)) {
436
- if (url.startsWith(`${own}hook/`)) {
437
- reasons.push(`action ${id}: endpoint "${name}" is under /hook/, which is the unauthenticated webhook path`);
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 (!url.startsWith("/api/")) {
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
  }