@plitzi/sdk-shared 0.37.8 → 0.37.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.
Files changed (249) hide show
  1. package/CHANGELOG.md +817 -0
  2. package/dist/actions/functions.d.ts +12 -3
  3. package/dist/actions/functions.mjs +8 -5
  4. package/dist/actions/index.d.ts +2 -2
  5. package/dist/actions/index.mjs +6 -6
  6. package/dist/actions/triggerParams.mjs +7 -6
  7. package/dist/actions/validateDocument.d.ts +3 -0
  8. package/dist/actions/validateDocument.mjs +89 -88
  9. package/dist/auth/failureChannel.d.ts +8 -2
  10. package/dist/auth/failureChannel.mjs +1 -3
  11. package/dist/authoring/elementCallbacks.d.ts +65 -0
  12. package/dist/authoring/elementCallbacks.mjs +72 -8
  13. package/dist/authoring/index.mjs +3 -3
  14. package/dist/builder/contexts/BuilderContext.d.ts +18 -7
  15. package/dist/builder/contexts/BuilderContext.mjs +2 -3
  16. package/dist/connectors/index.d.ts +1 -1
  17. package/dist/connectors/index.mjs +2 -2
  18. package/dist/connectors/validateManifest.d.ts +3 -0
  19. package/dist/connectors/validateManifest.mjs +77 -76
  20. package/dist/dataSource/computed.mjs +25 -29
  21. package/dist/dataSource/globalSources.d.ts +15 -0
  22. package/dist/dataSource/globalSources.mjs +13 -0
  23. package/dist/dataSource/index.d.ts +2 -0
  24. package/dist/dataSource/index.mjs +8 -7
  25. package/dist/devTools/DevToolsContext.mjs +2 -3
  26. package/dist/devTools/utils/PlitziConsole.d.ts +9 -0
  27. package/dist/devTools/utils/PlitziConsole.mjs +27 -7
  28. package/dist/elements/ComponentContext.mjs +2 -3
  29. package/dist/flags/flagsCookie.d.ts +26 -0
  30. package/dist/flags/flagsCookie.mjs +20 -0
  31. package/dist/flags/index.d.ts +3 -0
  32. package/dist/flags/index.mjs +4 -0
  33. package/dist/flags/resolveFlags.d.ts +60 -0
  34. package/dist/flags/resolveFlags.mjs +38 -0
  35. package/dist/flags/schemaFlag.d.ts +11 -0
  36. package/dist/flags/schemaFlag.mjs +9 -0
  37. package/dist/flags/useFlagResolution.d.ts +13 -0
  38. package/dist/flags/useFlagResolution.mjs +43 -0
  39. package/dist/helpers/eventTarget.d.ts +10 -0
  40. package/dist/helpers/eventTarget.mjs +4 -0
  41. package/dist/helpers/images.d.ts +18 -0
  42. package/dist/helpers/images.mjs +13 -0
  43. package/dist/helpers/index.d.ts +3 -0
  44. package/dist/helpers/index.mjs +21 -18
  45. package/dist/helpers/interval.d.ts +18 -0
  46. package/dist/helpers/interval.mjs +7 -0
  47. package/dist/helpers/isRecord.d.ts +2 -0
  48. package/dist/helpers/isRecord.mjs +4 -0
  49. package/dist/helpers/scroll.d.ts +42 -0
  50. package/dist/helpers/scroll.mjs +30 -0
  51. package/dist/helpers/sharedContext.d.ts +14 -0
  52. package/dist/helpers/sharedContext.mjs +9 -0
  53. package/dist/helpers/twigWrapper/Evaluator/Evaluator.d.ts +9 -1
  54. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +13 -8
  55. package/dist/helpers/twigWrapper/Evaluator/index.d.ts +1 -1
  56. package/dist/helpers/twigWrapper/TemplateCache/TemplateCache.mjs +1 -1
  57. package/dist/helpers/twigWrapper/filters/filters.mjs +38 -2
  58. package/dist/helpers/twigWrapper/index.d.ts +1 -0
  59. package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +2 -1
  60. package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +3 -3
  61. package/dist/helpers/utils.mjs +4 -2
  62. package/dist/history/describe.mjs +4 -1
  63. package/dist/history/diff.d.ts +1 -1
  64. package/dist/history/diff.mjs +11 -9
  65. package/dist/history/types.d.ts +1 -1
  66. package/dist/hooks/index.mjs +5 -5
  67. package/dist/hooks/usePlitziServiceContext.d.ts +1 -2
  68. package/dist/hooks/usePlitziServiceContext.mjs +3 -4
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.mjs +90 -77
  71. package/dist/navigation/routes.mjs +6 -4
  72. package/dist/network/NetworkContext.mjs +2 -3
  73. package/dist/network/NetworkInternalContext.d.ts +2 -4
  74. package/dist/network/NetworkInternalContext.mjs +2 -3
  75. package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.d.ts +2 -0
  76. package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.mjs +4 -0
  77. package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.d.ts +4 -0
  78. package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.mjs +4 -0
  79. package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.d.ts +4 -0
  80. package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.mjs +4 -0
  81. package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.d.ts +4 -0
  82. package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.mjs +4 -0
  83. package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.d.ts +4 -0
  84. package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.mjs +4 -0
  85. package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.d.ts +12 -0
  86. package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.mjs +4 -0
  87. package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.d.ts +2 -0
  88. package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.mjs +4 -0
  89. package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.d.ts +3 -0
  90. package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.mjs +4 -0
  91. package/dist/network/graphql/builder/Mutations/index.d.ts +13 -30
  92. package/dist/network/graphql/builder/Mutations/index.mjs +164 -200
  93. package/dist/network/graphql/builder/Queries/InitQuery.d.ts +4 -3
  94. package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
  95. package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.d.ts +1 -1
  96. package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.mjs +1 -1
  97. package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.d.ts +16 -2
  98. package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +1 -1
  99. package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.d.ts +7 -0
  100. package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.mjs +4 -0
  101. package/dist/network/graphql/builder/Queries/index.d.ts +3 -5
  102. package/dist/network/graphql/builder/Queries/index.mjs +36 -38
  103. package/dist/network/graphql/builder/Subscriptions/SpaceEventSubscription.d.ts +1 -1
  104. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +2 -3
  105. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
  106. package/dist/network/graphql/sdk/Queries/index.d.ts +0 -4
  107. package/dist/network/graphql/sdk/Queries/index.mjs +2 -8
  108. package/dist/network/index.mjs +8 -7
  109. package/dist/network/spaceEvents.d.ts +25 -195
  110. package/dist/network/spaceEvents.mjs +156 -241
  111. package/dist/realtime/client.mjs +123 -95
  112. package/dist/realtime/topics.mjs +18 -17
  113. package/dist/schema/SchemaContext.mjs +2 -3
  114. package/dist/schema/anchor.d.ts +8 -0
  115. package/dist/schema/anchor.mjs +4 -0
  116. package/dist/schema/index.d.ts +2 -0
  117. package/dist/schema/index.mjs +6 -4
  118. package/dist/schema/schemaConstants.d.ts +2 -0
  119. package/dist/schema/schemaConstants.mjs +4 -3
  120. package/dist/schema/serverElements.d.ts +6 -2
  121. package/dist/schema/serverElements.mjs +17 -16
  122. package/dist/schema/snippet.d.ts +7 -0
  123. package/dist/schema/snippet.mjs +9 -0
  124. package/dist/schema/wire.d.ts +11 -0
  125. package/dist/schema/wire.mjs +27 -0
  126. package/dist/server/actions/useImagesSync.d.ts +9 -0
  127. package/dist/server/actions/useImagesSync.mjs +7 -0
  128. package/dist/server/rsc/refreshRsc.d.ts +3 -1
  129. package/dist/server/rsc/refreshRsc.mjs +17 -16
  130. package/dist/source/export.d.ts +107 -0
  131. package/dist/source/export.mjs +4 -0
  132. package/dist/source/index.d.ts +4 -0
  133. package/dist/source/index.mjs +3 -0
  134. package/dist/source/snapshot.d.ts +51 -0
  135. package/dist/source/snapshot.mjs +81 -0
  136. package/dist/state/paintedState.mjs +13 -12
  137. package/dist/state/runtimeStatePersist.mjs +50 -49
  138. package/dist/store/index.d.ts +45 -45
  139. package/dist/store/renderSettings.d.ts +1 -0
  140. package/dist/store/renderSettings.mjs +9 -5
  141. package/dist/style/breakpoints.d.ts +11 -0
  142. package/dist/style/breakpoints.mjs +8 -0
  143. package/dist/style/displayModes.d.ts +5 -0
  144. package/dist/style/displayModes.mjs +8 -0
  145. package/dist/style/fontValidation.mjs +52 -51
  146. package/dist/style/fonts.d.ts +0 -12
  147. package/dist/style/fonts.mjs +11 -11
  148. package/dist/style/index.d.ts +4 -0
  149. package/dist/style/index.mjs +11 -7
  150. package/dist/style/layoutGrid.d.ts +30 -0
  151. package/dist/style/layoutGrid.mjs +33 -0
  152. package/dist/style/notifications.d.ts +52 -0
  153. package/dist/style/notifications.mjs +55 -0
  154. package/dist/style/snippetStyle.d.ts +23 -0
  155. package/dist/style/snippetStyle.mjs +32 -0
  156. package/dist/style/styleConstants.d.ts +7 -2
  157. package/dist/style/styleConstants.mjs +10 -0
  158. package/dist/style/styleStates.d.ts +11 -2
  159. package/dist/style/styleStates.mjs +12 -9
  160. package/dist/theme/ThemeProvider.mjs +20 -20
  161. package/dist/theme/ThemeScope.mjs +4 -3
  162. package/dist/types/ActionTypes.d.ts +5 -0
  163. package/dist/types/CommonTypes.d.ts +3 -0
  164. package/dist/types/DevToolsTypes.d.ts +29 -4
  165. package/dist/types/ElementTypes.d.ts +6 -5
  166. package/dist/types/EventBridgeTypes.d.ts +2 -2
  167. package/dist/types/FunctionTypes.d.ts +13 -0
  168. package/dist/types/InteractionTypes.d.ts +5 -0
  169. package/dist/types/PluginTypes.d.ts +1 -1
  170. package/dist/types/ResourceTypes.d.ts +2 -2
  171. package/dist/types/SchemaTypes.d.ts +100 -3
  172. package/dist/types/SdkTypes.d.ts +0 -2
  173. package/dist/types/ServerTypes.d.ts +47 -0
  174. package/dist/types/SnippetTypes.d.ts +28 -0
  175. package/dist/types/SpaceTypes.d.ts +36 -0
  176. package/dist/types/StoreTypes.d.ts +39 -3
  177. package/dist/types/StyleTypes.d.ts +1 -1
  178. package/dist/types/index.d.ts +1 -2
  179. package/package.json +143 -138
  180. package/tailwind.config.js +1 -6
  181. package/vite.config.ts +16 -4
  182. package/dist/network/graphql/builder/Mutations/Segment/SegmentAddMutation.d.ts +0 -4
  183. package/dist/network/graphql/builder/Mutations/Segment/SegmentAddMutation.mjs +0 -4
  184. package/dist/network/graphql/builder/Mutations/Segment/SegmentAddTemplateMutation.d.ts +0 -2
  185. package/dist/network/graphql/builder/Mutations/Segment/SegmentAddTemplateMutation.mjs +0 -4
  186. package/dist/network/graphql/builder/Mutations/Segment/SegmentPublishMutation.d.ts +0 -8
  187. package/dist/network/graphql/builder/Mutations/Segment/SegmentPublishMutation.mjs +0 -4
  188. package/dist/network/graphql/builder/Mutations/Segment/SegmentRemoveMutation.d.ts +0 -2
  189. package/dist/network/graphql/builder/Mutations/Segment/SegmentRemoveMutation.mjs +0 -4
  190. package/dist/network/graphql/builder/Mutations/Segment/SegmentUpdateMutation.d.ts +0 -4
  191. package/dist/network/graphql/builder/Mutations/Segment/SegmentUpdateMutation.mjs +0 -4
  192. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentAddElementMutation.d.ts +0 -2
  193. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentAddElementMutation.mjs +0 -4
  194. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentCloneElementMutation.d.ts +0 -2
  195. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentCloneElementMutation.mjs +0 -4
  196. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentMoveElementMutation.d.ts +0 -2
  197. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentMoveElementMutation.mjs +0 -4
  198. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRemoveElementMutation.d.ts +0 -2
  199. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRemoveElementMutation.mjs +0 -4
  200. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRenameElementMutation.d.ts +0 -3
  201. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRenameElementMutation.mjs +0 -4
  202. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementMutation.d.ts +0 -2
  203. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementMutation.mjs +0 -4
  204. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementsMutation.d.ts +0 -2
  205. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementsMutation.mjs +0 -4
  206. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceAddVariableMutation.d.ts +0 -2
  207. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceAddVariableMutation.mjs +0 -4
  208. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceRemoveVariableMutation.d.ts +0 -2
  209. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceRemoveVariableMutation.mjs +0 -4
  210. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceUpdateVariableMutation.d.ts +0 -2
  211. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceUpdateVariableMutation.mjs +0 -4
  212. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleAddSelectorVariableMutation.d.ts +0 -2
  213. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleAddSelectorVariableMutation.mjs +0 -4
  214. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleRemoveSelectorVariableMutation.d.ts +0 -2
  215. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleRemoveSelectorVariableMutation.mjs +0 -4
  216. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleUpdateSelectorVariableMutation.d.ts +0 -2
  217. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleUpdateSelectorVariableMutation.mjs +0 -4
  218. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleAddSelectorMutation.d.ts +0 -2
  219. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleAddSelectorMutation.mjs +0 -4
  220. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorMutation.d.ts +0 -2
  221. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorMutation.mjs +0 -4
  222. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorsMutation.d.ts +0 -2
  223. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorsMutation.mjs +0 -4
  224. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleUpdateSelectorMutation.d.ts +0 -2
  225. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleUpdateSelectorMutation.mjs +0 -4
  226. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleAddVariableMutation.d.ts +0 -2
  227. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleAddVariableMutation.mjs +0 -4
  228. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleRemoveVariableMutation.d.ts +0 -2
  229. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleRemoveVariableMutation.mjs +0 -4
  230. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleUpdateVariableMutation.d.ts +0 -2
  231. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleUpdateVariableMutation.mjs +0 -4
  232. package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.d.ts +0 -2
  233. package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.mjs +0 -4
  234. package/dist/network/graphql/builder/Queries/Segment/SegmentQuery.d.ts +0 -6
  235. package/dist/network/graphql/builder/Queries/Segment/SegmentQuery.mjs +0 -4
  236. package/dist/network/graphql/builder/Queries/Segment/SegmentsQuery.d.ts +0 -9
  237. package/dist/network/graphql/builder/Queries/Segment/SegmentsQuery.mjs +0 -4
  238. package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.d.ts +0 -6
  239. package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.mjs +0 -4
  240. package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.d.ts +0 -9
  241. package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.mjs +0 -4
  242. package/dist/segments/SegmentsContext.d.ts +0 -2
  243. package/dist/segments/SegmentsContext.mjs +0 -6
  244. package/dist/segments/index.d.ts +0 -3
  245. package/dist/segments/index.mjs +0 -2
  246. package/dist/types/SegmentTypes.d.ts +0 -41
  247. package/dist/types/TemplateTypes.d.ts +0 -20
  248. package/dist/types/TemplateTypes.mjs +0 -0
  249. /package/dist/types/{SegmentTypes.mjs → SnippetTypes.mjs} +0 -0
@@ -1,8 +1,17 @@
1
1
  /**
2
- * Where a space's functions answer HTTP: `GET /feed/:id` declared, `GET /api/feed/42` served. The path is
3
- * the functions' and never a page's — the page server and the page linter both read it from here.
2
+ * Where a space's functions answer HTTP: `GET /feed/:id` declared, `GET /fn/feed/42` served. The path is the functions'
3
+ * and never a page's — the page server and the page linter both read it from here. `/fn`, not `/api`: a space's pages
4
+ * are its own to name, and `api` is a slug a site wants for a page about its API.
4
5
  */
5
- export declare const FUNCTION_ROUTES_PREFIX = "/api";
6
+ export declare const FUNCTION_ROUTES_PREFIX = "/fn";
7
+ /**
8
+ * The CPU and time an invocation gets when its task asks for none: what the server runs it with, and what the builder
9
+ * shows as "default". A task asks for more in its `limits`, up to what its deployment allows.
10
+ */
11
+ export declare const DEFAULT_FUNCTION_TIME_LIMITS: {
12
+ readonly cpuMs: 100;
13
+ readonly wallMs: 10000;
14
+ };
6
15
  /** Whether a page at `path` would sit where the space's functions answer. */
7
16
  export declare const isFunctionRoutePath: (path: string) => boolean;
8
17
  /**
@@ -1,6 +1,9 @@
1
1
  //#region src/actions/functions.ts
2
- var e = "/api", t = (e) => e === "/api" || e.startsWith("/api/"), n = (e) => /^[A-Za-z0-9_][A-Za-z0-9_./-]*\.(ts|js|mjs|json)$/.test(e) && !e.split("/").some((e) => e === ".." || e === "." || e === ""), r = async (e, t) => {
3
- let r = {}, i = async (a) => {
2
+ var e = "/fn", t = {
3
+ cpuMs: 100,
4
+ wallMs: 1e4
5
+ }, n = (e) => e === "/fn" || e.startsWith("/fn/"), r = (e) => /^[A-Za-z0-9_][A-Za-z0-9_./-]*\.(ts|js|mjs|json)$/.test(e) && !e.split("/").some((e) => e === ".." || e === "." || e === ""), i = async (e, t) => {
6
+ let n = {}, i = async (a) => {
4
7
  let o;
5
8
  try {
6
9
  o = await t.list(a ? `${e}/${a}` : e);
@@ -9,10 +12,10 @@ var e = "/api", t = (e) => e === "/api" || e.startsWith("/api/"), n = (e) => /^[
9
12
  }
10
13
  for (let s of o) {
11
14
  let o = a ? `${a}/${s.name}` : s.name;
12
- s.directory ? s.name !== "node_modules" && !s.name.startsWith(".") && await i(o) : n(o) && (r[o] = await t.read(`${e}/${o}`));
15
+ s.directory ? s.name !== "node_modules" && !s.name.startsWith(".") && await i(o) : r(o) && (n[o] = await t.read(`${e}/${o}`));
13
16
  }
14
17
  };
15
- return await i(""), r;
18
+ return await i(""), n;
16
19
  };
17
20
  //#endregion
18
- export { e as FUNCTION_ROUTES_PREFIX, t as isFunctionRoutePath, n as isFunctionsSourcePath, r as readFunctionsSource };
21
+ export { t as DEFAULT_FUNCTION_TIME_LIMITS, e as FUNCTION_ROUTES_PREFIX, n as isFunctionRoutePath, r as isFunctionsSourcePath, i as readFunctionsSource };
@@ -1,10 +1,10 @@
1
1
  export { accessRefusal } from './access';
2
2
  export { cronFiresBetween, cronMatches, cronNextFire, isKnownTimeZone, parseCron, zonedClock } from './cron';
3
3
  export { FAILURE_HANDLER_TASK } from './failureHandler';
4
- export { FUNCTION_ROUTES_PREFIX, isFunctionRoutePath, isFunctionsSourcePath, readFunctionsSource } from './functions';
4
+ export { DEFAULT_FUNCTION_TIME_LIMITS, FUNCTION_ROUTES_PREFIX, isFunctionRoutePath, isFunctionsSourcePath, readFunctionsSource } from './functions';
5
5
  export { triggerAccess, triggerCacheMs, triggerHasStaleVerify, triggerInput, triggerVerify } from './triggerParams';
6
6
  export { actionName, actionTriggers, isActionEnabled } from './triggers';
7
- export { validateActionDocument } from './validateDocument';
7
+ export { isActionDocument, validateActionDocument } from './validateDocument';
8
8
  export { isSingleEmailAddress, readSmtpCredential, SMTP_CREDENTIAL_KEYS } from './smtp';
9
9
  export type { AccessCaller } from './access';
10
10
  export type { FunctionsSourceReader } from './functions';
@@ -1,9 +1,9 @@
1
1
  import { accessRefusal as e } from "./access.mjs";
2
2
  import { cronFiresBetween as t, cronMatches as n, cronNextFire as r, isKnownTimeZone as i, parseCron as a, zonedClock as o } from "./cron.mjs";
3
3
  import { FAILURE_HANDLER_TASK as s } from "./failureHandler.mjs";
4
- import { FUNCTION_ROUTES_PREFIX as c, isFunctionRoutePath as l, isFunctionsSourcePath as u, readFunctionsSource as d } from "./functions.mjs";
5
- import { triggerAccess as f, triggerCacheMs as p, triggerHasStaleVerify as m, triggerInput as h, triggerVerify as g } from "./triggerParams.mjs";
6
- import { actionName as _, actionTriggers as v, isActionEnabled as y } from "./triggers.mjs";
7
- import { validateActionDocument as b } from "./validateDocument.mjs";
8
- import { SMTP_CREDENTIAL_KEYS as x, isSingleEmailAddress as S, readSmtpCredential as C } from "./smtp.mjs";
9
- export { s as FAILURE_HANDLER_TASK, c as FUNCTION_ROUTES_PREFIX, x as SMTP_CREDENTIAL_KEYS, e as accessRefusal, _ as actionName, v as actionTriggers, t as cronFiresBetween, n as cronMatches, r as cronNextFire, y as isActionEnabled, l as isFunctionRoutePath, u as isFunctionsSourcePath, i as isKnownTimeZone, S as isSingleEmailAddress, a as parseCron, d as readFunctionsSource, C as readSmtpCredential, f as triggerAccess, p as triggerCacheMs, m as triggerHasStaleVerify, h as triggerInput, g as triggerVerify, b as validateActionDocument, o as zonedClock };
4
+ import { DEFAULT_FUNCTION_TIME_LIMITS as c, FUNCTION_ROUTES_PREFIX as l, isFunctionRoutePath as u, isFunctionsSourcePath as d, readFunctionsSource as f } from "./functions.mjs";
5
+ import { triggerAccess as p, triggerCacheMs as m, triggerHasStaleVerify as h, triggerInput as g, triggerVerify as _ } from "./triggerParams.mjs";
6
+ import { actionName as v, actionTriggers as y, isActionEnabled as b } from "./triggers.mjs";
7
+ import { isActionDocument as x, validateActionDocument as S } from "./validateDocument.mjs";
8
+ import { SMTP_CREDENTIAL_KEYS as C, isSingleEmailAddress as w, readSmtpCredential as T } from "./smtp.mjs";
9
+ export { c as DEFAULT_FUNCTION_TIME_LIMITS, s as FAILURE_HANDLER_TASK, l as FUNCTION_ROUTES_PREFIX, C as SMTP_CREDENTIAL_KEYS, e as accessRefusal, v as actionName, y as actionTriggers, t as cronFiresBetween, n as cronMatches, r as cronNextFire, x as isActionDocument, b as isActionEnabled, u as isFunctionRoutePath, d as isFunctionsSourcePath, i as isKnownTimeZone, w as isSingleEmailAddress, a as parseCron, f as readFunctionsSource, T as readSmtpCredential, p as triggerAccess, m as triggerCacheMs, h as triggerHasStaleVerify, g as triggerInput, _ as triggerVerify, S as validateActionDocument, o as zonedClock };
@@ -1,11 +1,12 @@
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
1
2
  //#region src/actions/triggerParams.ts
2
- var e = (e) => {
3
+ var t = (e) => {
3
4
  if (typeof e == "string" && e.trim() !== "") try {
4
5
  return JSON.parse(e);
5
6
  } catch {
6
7
  return;
7
8
  }
8
- }, t = (e) => typeof e == "object" && !!e && !Array.isArray(e), n = (e) => {
9
+ }, n = (e) => {
9
10
  let { access: t } = e;
10
11
  if (t === "public" || t === "session") return { mode: t };
11
12
  if (t === "role") return {
@@ -13,8 +14,8 @@ var e = (e) => {
13
14
  permissions: (e.permissions ?? "").split(",").map((e) => e.trim()).filter(Boolean)
14
15
  };
15
16
  }, r = (n) => {
16
- let r = e(n.input);
17
- return t(r) ? r : {};
17
+ let r = t(n.input);
18
+ return e(r) ? r : {};
18
19
  }, i = (e) => {
19
20
  let t = e.signatureCredential?.trim();
20
21
  if (!t) return;
@@ -30,8 +31,8 @@ var e = (e) => {
30
31
  };
31
32
  }, a = (n) => {
32
33
  if (n.signatureCredential?.trim()) return !1;
33
- let r = e(n.verify);
34
- return t(r) && typeof r.credential == "string" && r.credential.trim() !== "";
34
+ let r = t(n.verify);
35
+ return e(r) && typeof r.credential == "string" && r.credential.trim() !== "";
35
36
  }, o = (e) => {
36
37
  let t = Number.parseFloat(e.cacheSeconds ?? "");
37
38
  return Number.isFinite(t) && t > 0 ? Math.round(t * 1e3) : 0;
@@ -1,3 +1,4 @@
1
+ import { ActionDocument } from '../types';
1
2
  /**
2
3
  * The one server-action validator.
3
4
  *
@@ -21,3 +22,5 @@ export type ActionDocumentReport = {
21
22
  warnings: ActionDocumentIssue[];
22
23
  };
23
24
  export declare const validateActionDocument: (document: unknown) => ActionDocumentReport;
25
+ /** Whether a value read from outside — a deployment's store, a request — is an action document a server can run. */
26
+ export declare const isActionDocument: (document: unknown) => document is ActionDocument;
@@ -1,25 +1,26 @@
1
1
  import { isKnownTimeZone as e, parseCron as t } from "./cron.mjs";
2
2
  import { FAILURE_HANDLER_TASK as n } from "./failureHandler.mjs";
3
- import { triggerAccess as r, triggerHasStaleVerify as i, triggerVerify as a } from "./triggerParams.mjs";
3
+ import { isRecord as r } from "../helpers/isRecord.mjs";
4
+ import { triggerAccess as i, triggerHasStaleVerify as a, triggerVerify as o } from "./triggerParams.mjs";
4
5
  //#region src/actions/validateDocument.ts
5
- var o = [
6
+ var s = [
6
7
  "text",
7
8
  "number",
8
9
  "boolean",
9
10
  "date",
10
11
  "json",
11
12
  "file"
12
- ], s = [
13
+ ], c = [
13
14
  "public",
14
15
  "session",
15
16
  "role"
16
- ], c = [
17
+ ], l = [
17
18
  "call",
18
19
  "webhook",
19
20
  "schedule",
20
21
  "render",
21
22
  "custom"
22
- ], l = ["sha256", "sha1"], u = /* @__PURE__ */ new Set([
23
+ ], u = ["sha256", "sha1"], d = /* @__PURE__ */ new Set([
23
24
  "input",
24
25
  "user",
25
26
  "spaceId",
@@ -28,208 +29,208 @@ var o = [
28
29
  "runId",
29
30
  "now",
30
31
  "failure"
31
- ]), d = /^[a-z][a-zA-Z0-9]*\.[a-z][a-zA-Z0-9]*$/, f = (e) => typeof e == "object" && !!e && !Array.isArray(e), p = (e) => typeof e == "string" && e.trim() !== "", m = (e) => {
32
+ ]), f = /^[a-z][a-zA-Z0-9]*\.[a-z][a-zA-Z0-9]*$/, p = (e) => typeof e == "string" && e.trim() !== "", m = (e) => {
32
33
  try {
33
34
  let t = JSON.parse(e);
34
- return f(t) ? t : void 0;
35
+ return r(t) ? t : void 0;
35
36
  } catch {
36
37
  return;
37
38
  }
38
39
  }, h = (e, t, n) => {
39
40
  if (e !== void 0) {
40
- if (!f(e)) {
41
+ if (!r(e)) {
41
42
  n.push({
42
43
  path: t,
43
44
  message: "must be an object of field definitions"
44
45
  });
45
46
  return;
46
47
  }
47
- Object.entries(e).forEach(([e, r]) => {
48
- if (!f(r) || !p(r.type)) {
48
+ Object.entries(e).forEach(([e, i]) => {
49
+ if (!r(i) || !p(i.type)) {
49
50
  n.push({
50
51
  path: `${t}.${e}`,
51
52
  message: "must declare a type"
52
53
  });
53
54
  return;
54
55
  }
55
- o.includes(r.type) || n.push({
56
+ s.includes(i.type) || n.push({
56
57
  path: `${t}.${e}.type`,
57
- message: `unknown field type "${r.type}"`,
58
- hint: `one of ${o.join(", ")}`
58
+ message: `unknown field type "${i.type}"`,
59
+ hint: `one of ${s.join(", ")}`
59
60
  });
60
61
  });
61
62
  }
62
- }, g = (n, o, u, d) => {
63
- let g = `nodes.${n}`, _ = o.action;
64
- if (!p(_) || !c.includes(_)) {
65
- u.push({
63
+ }, g = (n, s, d, f) => {
64
+ let g = `nodes.${n}`, _ = s.action;
65
+ if (!p(_) || !l.includes(_)) {
66
+ d.push({
66
67
  path: `${g}.action`,
67
68
  message: `"${String(_)}" is not a way an action can be started`,
68
- hint: `one of ${c.join(", ")}`
69
+ hint: `one of ${l.join(", ")}`
69
70
  });
70
71
  return;
71
72
  }
72
- let v = f(o.params) ? o.params : {};
73
+ let v = r(s.params) ? s.params : {};
73
74
  if (p(v.input)) {
74
75
  let e = m(v.input);
75
- e === void 0 ? u.push({
76
+ e === void 0 ? d.push({
76
77
  path: `${g}.params.input`,
77
78
  message: "is not valid JSON"
78
- }) : h(e, `${g}.params.input`, u);
79
+ }) : h(e, `${g}.params.input`, d);
79
80
  }
80
81
  if (_ !== "schedule") {
81
- if (!p(v.access) || !s.includes(v.access)) u.push({
82
+ if (!p(v.access) || !c.includes(v.access)) d.push({
82
83
  path: `${g}.params.access`,
83
84
  message: "must say who may start a run this way",
84
- hint: `one of ${s.join(", ")}`
85
+ hint: `one of ${c.join(", ")}`
85
86
  });
86
87
  else if (v.access === "role") {
87
- let e = r(v);
88
- e?.mode === "role" && e.permissions.length === 0 && u.push({
88
+ let e = i(v);
89
+ e?.mode === "role" && e.permissions.length === 0 && d.push({
89
90
  path: `${g}.params.permissions`,
90
91
  message: "role access must name at least one permission"
91
92
  });
92
93
  }
93
94
  }
94
- if (_ === "schedule" && (p(v.cron) ? t(v.cron) || u.push({
95
+ if (_ === "schedule" && (p(v.cron) ? t(v.cron) || d.push({
95
96
  path: `${g}.params.cron`,
96
97
  message: `"${v.cron}" is not an expression this server can read, so it would never fire`,
97
98
  hint: "five fields — minute hour day-of-month month day-of-week — with *, lists, ranges and steps"
98
- }) : u.push({
99
+ }) : d.push({
99
100
  path: `${g}.params.cron`,
100
101
  message: "a scheduled trigger needs a cron expression"
101
- }), p(v.timezone) && !e(v.timezone) && u.push({
102
+ }), p(v.timezone) && !e(v.timezone) && d.push({
102
103
  path: `${g}.params.timezone`,
103
104
  message: `"${v.timezone}" is not a time zone this server knows, so the schedule would never fire`,
104
105
  hint: "an IANA name like America/Santiago or Europe/Madrid — leave it empty for UTC"
105
106
  })), p(v.cacheSeconds)) {
106
107
  let e = Number.parseFloat(v.cacheSeconds);
107
- !Number.isFinite(e) || e < 0 ? u.push({
108
+ !Number.isFinite(e) || e < 0 ? d.push({
108
109
  path: `${g}.params.cacheSeconds`,
109
110
  message: "must be a number of seconds, or left empty"
110
- }) : _ !== "render" && d.push({
111
+ }) : _ !== "render" && f.push({
111
112
  path: `${g}.params.cacheSeconds`,
112
113
  message: `a "${_}" trigger is never answered from a cache`,
113
114
  hint: "reuse only applies to a render, where the same page is built for one visitor after another"
114
115
  });
115
116
  }
116
- _ === "custom" && !p(v.name) && u.push({
117
+ _ === "custom" && !p(v.name) && d.push({
117
118
  path: `${g}.params.name`,
118
119
  message: "a custom trigger needs a name to be mounted under"
119
- }), _ === "webhook" && (i(v) && u.push({
120
+ }), _ === "webhook" && (a(v) && d.push({
120
121
  path: `${g}.params.signatureCredential`,
121
122
  message: "this signature check is in a format nothing reads any more, so the webhook is unverified",
122
123
  hint: "name the credential holding the signing secret in \"Signing secret\", and its header beside it"
123
- }), a(v) || d.push({
124
+ }), o(v) || f.push({
124
125
  path: `${g}.params.signatureCredential`,
125
126
  message: "this webhook accepts unsigned requests",
126
127
  hint: "name the credential holding the signing secret, and only the sender you expect can start a run"
127
- }), p(v.signatureAlgorithm) && !l.includes(v.signatureAlgorithm) && d.push({
128
+ }), p(v.signatureAlgorithm) && !u.includes(v.signatureAlgorithm) && f.push({
128
129
  path: `${g}.params.signatureAlgorithm`,
129
130
  message: `"${v.signatureAlgorithm}" is not an algorithm this server signs with, so sha256 is used`,
130
- hint: `one of ${l.join(", ")}`
131
- }), p(v.signatureToleranceSeconds) && !p(v.signatureTimestampHeader) && d.push({
131
+ hint: `one of ${u.join(", ")}`
132
+ }), p(v.signatureToleranceSeconds) && !p(v.signatureTimestampHeader) && f.push({
132
133
  path: `${g}.params.signatureToleranceSeconds`,
133
134
  message: "a tolerance with no timestamp header expires nothing",
134
135
  hint: "name the header the sender puts the signing time in, or drop the tolerance"
135
- })), _ === "call" && v.access === "public" && d.push({
136
+ })), _ === "call" && v.access === "public" && f.push({
136
137
  path: `${g}.params.access`,
137
138
  message: "anyone can run this action, including signed-out visitors",
138
139
  hint: "use session access unless the page needs it before anyone signs in"
139
140
  });
140
- }, _ = (e, t, r, i) => {
141
- if (!f(e)) {
142
- r.push({
141
+ }, _ = (e, t, i, a) => {
142
+ if (!r(e)) {
143
+ i.push({
143
144
  path: "nodes",
144
145
  message: "must be an object of steps"
145
146
  });
146
147
  return;
147
148
  }
148
- let a = Object.entries(e), o = a.filter(([, e]) => f(e) && e.type === "trigger");
149
- o.length === 0 && r.push({
149
+ let o = Object.entries(e), s = o.filter(([, e]) => r(e) && e.type === "trigger");
150
+ s.length === 0 && i.push({
150
151
  path: "nodes",
151
152
  message: "this action has no way in",
152
153
  hint: "add a trigger step — call, webhook, schedule, render or custom"
153
154
  });
154
- let s = /* @__PURE__ */ new Map();
155
- o.forEach(([e, t]) => {
156
- p(t.action) && s.set(t.action, [...s.get(t.action) ?? [], e]);
157
- }), s.forEach((e, t) => {
158
- e.length > 1 && r.push({
155
+ let c = /* @__PURE__ */ new Map();
156
+ s.forEach(([e, t]) => {
157
+ p(t.action) && c.set(t.action, [...c.get(t.action) ?? [], e]);
158
+ }), c.forEach((e, t) => {
159
+ e.length > 1 && i.push({
159
160
  path: `nodes.${e[1]}`,
160
161
  message: `this action has ${e.length} "${t}" triggers`,
161
162
  hint: "one step per way in — a second flow starts from a different kind of trigger"
162
163
  });
163
- }), a.forEach(([t, n]) => {
164
- let a = `nodes.${t}`;
165
- if (!f(n)) {
166
- r.push({
167
- path: a,
164
+ }), o.forEach(([t, n]) => {
165
+ let o = `nodes.${t}`;
166
+ if (!r(n)) {
167
+ i.push({
168
+ path: o,
168
169
  message: "must be an object"
169
170
  });
170
171
  return;
171
172
  }
172
173
  if (n.type === "trigger") {
173
- g(t, n, r, i);
174
+ g(t, n, i, a);
174
175
  return;
175
176
  }
176
177
  if (n.type !== "task") {
177
- r.push({
178
- path: `${a}.type`,
178
+ i.push({
179
+ path: `${o}.type`,
179
180
  message: `"${String(n.type)}" steps run in the browser and cannot run on the server`,
180
181
  hint: "a server action is made of task steps"
181
182
  });
182
183
  return;
183
184
  }
184
- if (!p(n.action) || !d.test(n.action)) {
185
- r.push({
186
- path: `${a}.action`,
185
+ if (!p(n.action) || !f.test(n.action)) {
186
+ i.push({
187
+ path: `${o}.action`,
187
188
  message: "must name a task as <namespace>.<action>",
188
189
  hint: "for example flow.output or http.request"
189
190
  });
190
191
  return;
191
192
  }
192
- p(n.afterNode) && !Object.hasOwn(e, n.afterNode) && r.push({
193
- path: `${a}.afterNode`,
193
+ p(n.afterNode) && !Object.hasOwn(e, n.afterNode) && i.push({
194
+ path: `${o}.afterNode`,
194
195
  message: `points at "${n.afterNode}", which is not a step here`
195
196
  });
196
- }), a.forEach(([e]) => {
197
- u.has(e) && r.push({
197
+ }), o.forEach(([e]) => {
198
+ d.has(e) && i.push({
198
199
  path: `nodes.${e}`,
199
200
  message: `"${e}" is what the run itself publishes in the flow scope, so a step may not take the name`,
200
201
  hint: `rename the step — every later step reads {{ ${e} }} expecting the run's own value`
201
202
  });
202
203
  });
203
- let c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), m = [];
204
- o.forEach(([t]) => {
204
+ let l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), m = [];
205
+ s.forEach(([t]) => {
205
206
  let n = /* @__PURE__ */ new Set(), r = [], i = t;
206
207
  for (; i;) {
207
208
  if (n.has(i)) {
208
- l.add(i);
209
+ u.add(i);
209
210
  break;
210
211
  }
211
- n.add(i), r.push(i), c.add(i);
212
+ n.add(i), r.push(i), l.add(i);
212
213
  let t = e[i];
213
214
  i = p(t?.afterNode) ? t.afterNode : "";
214
215
  }
215
216
  m.push(r);
216
- }), l.forEach((e) => {
217
- r.push({
217
+ }), u.forEach((e) => {
218
+ i.push({
218
219
  path: `nodes.${e}`,
219
220
  message: "this step is reached again by its own chain, so the flow never ends",
220
221
  hint: "break the `afterNode` chain that comes back to it"
221
222
  });
222
- }), a.forEach(([e]) => {
223
- c.has(e) || i.push({
223
+ }), o.forEach(([e]) => {
224
+ l.has(e) || a.push({
224
225
  path: `nodes.${e}`,
225
226
  message: "no trigger reaches this step, so it never runs",
226
227
  hint: "chain it with `afterNode` from a trigger, or delete it"
227
228
  });
228
229
  });
229
- let h = (t) => e[t]?.action, _ = a.filter(([, e]) => f(e) && e.action === "flow.output");
230
+ let h = (t) => e[t]?.action, _ = o.filter(([, e]) => r(e) && e.action === "flow.output");
230
231
  for (let [t, n] of _) {
231
232
  let r = p(n.afterNode) && h(n.afterNode) === "flow.onFailure";
232
- p(n.afterNode) && Object.hasOwn(e, n.afterNode) && !r && i.push({
233
+ p(n.afterNode) && Object.hasOwn(e, n.afterNode) && !r && a.push({
233
234
  path: `nodes.${t}.afterNode`,
234
235
  message: "the output step is not the last one, so the steps after it run for nothing",
235
236
  hint: "move flow.output to the end of the flow"
@@ -241,37 +242,37 @@ var o = [
241
242
  m.forEach((e) => {
242
243
  let t = e.findIndex((e) => h(e) === n);
243
244
  if (t === -1) return;
244
- let a = e[t];
245
- t === 1 && y(i, {
246
- path: `nodes.${a}`,
245
+ let r = e[t];
246
+ t === 1 && y(a, {
247
+ path: `nodes.${r}`,
247
248
  message: "nothing runs before this step, so nothing can fail and the steps after it never run",
248
249
  hint: "put On Failure after the steps whose work it undoes"
249
- }), t === e.length - 1 && y(i, {
250
- path: `nodes.${a}`,
250
+ }), t === e.length - 1 && y(a, {
251
+ path: `nodes.${r}`,
251
252
  message: "nothing follows this step, so a failed run undoes nothing",
252
253
  hint: "add the steps that give back what the flow already did"
253
254
  }), e.slice(t + 1).forEach((e) => {
254
- h(e) === "flow.onFailure" && y(r, {
255
+ h(e) === "flow.onFailure" && y(i, {
255
256
  path: `nodes.${e}`,
256
257
  message: "a flow has one place its undo begins, and this is a second one",
257
258
  hint: "keep one On Failure step and put every undo step after it"
258
- }), h(e) === "flow.output" && y(r, {
259
+ }), h(e) === "flow.output" && y(i, {
259
260
  path: `nodes.${e}`,
260
261
  message: "an output step after On Failure answers a run that has already failed",
261
262
  hint: "move flow.output before On Failure"
262
263
  });
263
264
  });
264
- }), _.length === 0 && f(t) && Object.keys(t).length > 0 && i.push({
265
+ }), _.length === 0 && r(t) && Object.keys(t).length > 0 && a.push({
265
266
  path: "nodes",
266
267
  message: "this action is expected to answer values but no step names any",
267
268
  hint: "add a flow.output step at the end naming what the caller should get"
268
269
  });
269
270
  }, v = /\{\{\s*credential\./, y = (e, t) => {
270
271
  Object.entries(e).forEach(([e, n]) => {
271
- if (!f(n) || !f(n.params)) return;
272
- let r = p(n.params.credential) ? n.params.credential : "";
273
- Object.entries(n.params).forEach(([n, i]) => {
274
- typeof i == "string" && v.test(i) && r === "" && t.push({
272
+ if (!r(n) || !r(n.params)) return;
273
+ let i = p(n.params.credential) ? n.params.credential : "";
274
+ Object.entries(n.params).forEach(([n, r]) => {
275
+ typeof r == "string" && v.test(r) && i === "" && t.push({
275
276
  path: `nodes.${e}.params.${n}`,
276
277
  message: "this step reads a credential it did not ask for, so the token resolves to nothing",
277
278
  hint: "set the step’s `credential` to the identifier it should use"
@@ -280,10 +281,10 @@ var o = [
280
281
  });
281
282
  }, b = (e) => {
282
283
  let t = [], n = [];
283
- return f(e) ? (p(e.name) || t.push({
284
+ return r(e) ? (p(e.name) || t.push({
284
285
  path: "name",
285
286
  message: "must have a name"
286
- }), h(e.output, "output", t), _(e.nodes, e.output, t, n), y(f(e.nodes) ? e.nodes : {}, n), {
287
+ }), h(e.output, "output", t), _(e.nodes, e.output, t, n), y(r(e.nodes) ? e.nodes : {}, n), {
287
288
  valid: t.length === 0,
288
289
  errors: t,
289
290
  warnings: n
@@ -295,6 +296,6 @@ var o = [
295
296
  }],
296
297
  warnings: n
297
298
  };
298
- };
299
+ }, x = (e) => b(e).valid;
299
300
  //#endregion
300
- export { b as validateActionDocument };
301
+ export { x as isActionDocument, b as validateActionDocument };
@@ -4,13 +4,19 @@ export type AuthFailureSignal = {
4
4
  /** The request that was refused. Auth listens only to refusals from its own backend — see `sameRegistrableDomain`. */
5
5
  url?: string;
6
6
  };
7
- export type AuthFailureListener = (signal: AuthFailureSignal) => void;
7
+ /** Hears a refusal, and answers whether it renewed the session because of it — or nothing, for a listener that did not. */
8
+ export type AuthFailureListener = (signal: AuthFailureSignal) => Promise<boolean> | boolean | undefined;
8
9
  /**
9
10
  * Says that a backend refused a credential. A session can end between two checks — revoked from another device, an
10
11
  * account deactivated — and the first thing that notices is whatever request got refused, not a timer. Reporting it
11
12
  * here is how the network layers tell auth that reality moved on, without either knowing about the other.
13
+ *
14
+ * Answers whether the session was renewed because of it: a refusal that only meant "this credential expired" — a tab
15
+ * coming back after its token's life — is answered by a renewal, and the request that was refused can be asked again,
16
+ * once, instead of leaving its section in an error a reload would have cleared. A refused request never ran, so asking
17
+ * it again repeats nothing.
12
18
  */
13
- export declare const reportAuthFailure: (signal: AuthFailureSignal) => void;
19
+ export declare const reportAuthFailure: (signal: AuthFailureSignal) => Promise<boolean>;
14
20
  export declare const onAuthFailure: (listener: AuthFailureListener) => (() => void);
15
21
  /**
16
22
  * What an HTTP refusal means for the session. Stated once, because the provider and the network layers must not
@@ -1,7 +1,5 @@
1
1
  //#region src/auth/failureChannel.ts
2
- var e = /* @__PURE__ */ new Set(), t = (t) => {
3
- for (let n of e) n(t);
4
- }, n = (t) => (e.add(t), () => e.delete(t)), r = [
2
+ var e = /* @__PURE__ */ new Set(), t = async (t) => (await Promise.all([...e].map(async (e) => e(t)))).some((e) => e === !0), n = (t) => (e.add(t), () => e.delete(t)), r = [
5
3
  "missing",
6
4
  "expired",
7
5
  "revoked",
@@ -1,5 +1,70 @@
1
1
  import { BuiltinActionSpec } from './builder';
2
+ import { BuiltinParam } from './paramSpec';
2
3
  export type BuiltinElementCallback = BuiltinActionSpec;
4
+ /**
5
+ * Moving what an element shows, on the element whose box scrolls (`overflow: auto` on a row of cards, a panel) — or,
6
+ * with `scrollIntoView`, the page to an element. Arrows over a carousel that still swipes on a phone, a "back to the
7
+ * top", a jump to the answer a form just showed. Its node names the element that moves; nothing happens where there is
8
+ * no page to move (a server render).
9
+ */
10
+ export declare const SCROLL_CALLBACKS: {
11
+ scrollBy: {
12
+ title: string;
13
+ type: "callback";
14
+ strictParams: true;
15
+ params: {
16
+ x: {
17
+ type: "text";
18
+ description: string;
19
+ default: string;
20
+ };
21
+ y: {
22
+ type: "text";
23
+ description: string;
24
+ default: string;
25
+ };
26
+ behavior: BuiltinParam;
27
+ };
28
+ };
29
+ scrollTo: {
30
+ title: string;
31
+ type: "callback";
32
+ strictParams: true;
33
+ params: {
34
+ x: {
35
+ type: "text";
36
+ description: string;
37
+ default: string;
38
+ };
39
+ y: {
40
+ type: "text";
41
+ description: string;
42
+ default: string;
43
+ };
44
+ behavior: BuiltinParam;
45
+ };
46
+ };
47
+ scrollIntoView: {
48
+ title: string;
49
+ type: "callback";
50
+ strictParams: true;
51
+ params: {
52
+ block: {
53
+ type: "select";
54
+ description: string;
55
+ default: string;
56
+ options: ("start" | "center" | "end" | "nearest")[];
57
+ };
58
+ inline: {
59
+ type: "select";
60
+ description: string;
61
+ default: string;
62
+ options: ("start" | "center" | "end" | "nearest")[];
63
+ };
64
+ behavior: BuiltinParam;
65
+ };
66
+ };
67
+ };
3
68
  export declare const BUILTIN_ELEMENT_CALLBACKS: Record<string, BuiltinElementCallback>;
4
69
  /** The built-in element callback for an action, or undefined when the action is not a known built-in (an
5
70
  * element-type-specific/plugin callback whose schema is not knowable here). */