@plitzi/sdk-shared 0.39.1 → 0.39.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 (505) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +1 -2
  3. package/dist/actions/access.mjs +1 -2
  4. package/dist/actions/cron.mjs +1 -2
  5. package/dist/actions/failureHandler.mjs +1 -2
  6. package/dist/actions/flowDelay.d.ts +6 -0
  7. package/dist/actions/flowDelay.mjs +3 -0
  8. package/dist/actions/functions.d.ts +6 -3
  9. package/dist/actions/functions.mjs +12 -8
  10. package/dist/actions/index.d.ts +2 -1
  11. package/dist/actions/index.mjs +10 -9
  12. package/dist/actions/jobs.mjs +1 -2
  13. package/dist/actions/smtp.mjs +1 -2
  14. package/dist/actions/triggerParams.mjs +1 -2
  15. package/dist/actions/triggers.mjs +1 -2
  16. package/dist/actions/validateDocument.mjs +133 -123
  17. package/dist/activity/describe.mjs +1 -2
  18. package/dist/activity/guard.mjs +1 -2
  19. package/dist/activity/types.mjs +1 -2
  20. package/dist/auth/failureChannel.mjs +1 -2
  21. package/dist/auth/visitorRoles.mjs +1 -2
  22. package/dist/authoring/builder.mjs +1 -2
  23. package/dist/authoring/declare.mjs +1 -2
  24. package/dist/authoring/elementCallbacks.mjs +1 -2
  25. package/dist/authoring/index.mjs +3 -3
  26. package/dist/authoring/paramSpec.mjs +1 -2
  27. package/dist/authoring/spaceCallbacks.mjs +1 -2
  28. package/dist/builder/contexts/BuilderContext.mjs +1 -2
  29. package/dist/builder/contexts/index.mjs +1 -2
  30. package/dist/conditions/dates.d.ts +2 -0
  31. package/dist/conditions/dates.mjs +12 -0
  32. package/dist/conditions/evaluateRuleGroup.d.ts +13 -0
  33. package/dist/conditions/evaluateRuleGroup.mjs +4 -0
  34. package/dist/conditions/evaluator.d.ts +39 -0
  35. package/dist/conditions/evaluator.mjs +75 -0
  36. package/dist/conditions/index.d.ts +10 -0
  37. package/dist/conditions/index.mjs +5 -0
  38. package/dist/conditions/rules.d.ts +3 -0
  39. package/dist/conditions/rules.mjs +3 -0
  40. package/dist/conditions/types.d.ts +44 -0
  41. package/dist/connectors/constants.mjs +1 -2
  42. package/dist/connectors/manifestTokens.mjs +1 -2
  43. package/dist/connectors/presets.mjs +1 -2
  44. package/dist/connectors/validateManifest.mjs +56 -57
  45. package/dist/dataSource/computed.mjs +16 -17
  46. package/dist/dataSource/getBindingsDetails.d.ts +5 -6
  47. package/dist/dataSource/getBindingsDetails.mjs +65 -40
  48. package/dist/dataSource/globalSources.d.ts +1 -1
  49. package/dist/dataSource/globalSources.mjs +1 -2
  50. package/dist/dataSource/helpers/getSourceName.mjs +1 -2
  51. package/dist/dataSource/index.mjs +5 -5
  52. package/dist/dataSource/utility/arrayMap.mjs +2 -2
  53. package/dist/dataSource/utility/capitalize.mjs +1 -2
  54. package/dist/dataSource/utility/checkboxParams.mjs +1 -2
  55. package/dist/dataSource/utility/dateConverter.mjs +0 -1
  56. package/dist/dataSource/utility/index.mjs +15 -16
  57. package/dist/dataSource/utility/not.mjs +1 -2
  58. package/dist/dataSource/utility/staticValue.mjs +0 -1
  59. package/dist/dataSource/utility/stringToArray.mjs +0 -1
  60. package/dist/dataSource/utility/styleSelector.mjs +1 -2
  61. package/dist/dataSource/utility/styleVariant.mjs +2 -3
  62. package/dist/dataSource/utility/truthiness.mjs +1 -2
  63. package/dist/dataSource/utility/twigTemplate.mjs +0 -1
  64. package/dist/dataSource/variables/resolveVariables.mjs +2 -3
  65. package/dist/dates/formatDate.mjs +29 -30
  66. package/dist/dates/isDate.mjs +1 -2
  67. package/dist/devTools/chrome.mjs +1 -2
  68. package/dist/devTools/debugCookie.mjs +1 -2
  69. package/dist/devTools/index.mjs +5 -5
  70. package/dist/devTools/interactionLog.mjs +1 -2
  71. package/dist/devTools/react/DevToolsContext.mjs +1 -2
  72. package/dist/devTools/sight/sight.mjs +1 -2
  73. package/dist/devTools/utils/PlitziConsole.mjs +1 -2
  74. package/dist/elements/ComponentContext.mjs +1 -2
  75. package/dist/flags/flagsCookie.mjs +5 -6
  76. package/dist/flags/index.d.ts +1 -0
  77. package/dist/flags/index.mjs +4 -3
  78. package/dist/flags/overrides.d.ts +36 -0
  79. package/dist/flags/overrides.mjs +13 -0
  80. package/dist/flags/react/useFlagResolution.mjs +5 -6
  81. package/dist/flags/resolveFlags.d.ts +1 -1
  82. package/dist/flags/resolveFlags.mjs +2 -3
  83. package/dist/flags/schemaFlag.mjs +1 -2
  84. package/dist/functions/contract.d.ts +326 -0
  85. package/dist/functions/contract.mjs +3 -0
  86. package/dist/functions/index.d.ts +15 -0
  87. package/dist/functions/index.mjs +9 -0
  88. package/dist/functions/kv.d.ts +80 -0
  89. package/dist/functions/kvChange.d.ts +67 -0
  90. package/dist/functions/kvChange.mjs +24 -0
  91. package/dist/functions/later.d.ts +18 -0
  92. package/dist/functions/messages.d.ts +4 -0
  93. package/dist/functions/messages.mjs +205 -0
  94. package/dist/functions/protocol.d.ts +416 -0
  95. package/dist/functions/protocol.mjs +37 -0
  96. package/dist/functions/rateLimit.d.ts +17 -0
  97. package/dist/functions/rateLimit.mjs +0 -0
  98. package/dist/functions/refusal.d.ts +26 -0
  99. package/dist/functions/refusal.mjs +11 -0
  100. package/dist/functions/runtime.d.ts +44 -0
  101. package/dist/functions/runtime.mjs +13 -0
  102. package/dist/functions/sizes.d.ts +27 -0
  103. package/dist/functions/sizes.mjs +7 -0
  104. package/dist/functions/wire.d.ts +11 -0
  105. package/dist/functions/wire.mjs +39 -0
  106. package/dist/helpers/canonicalJson.mjs +1 -2
  107. package/dist/helpers/clipboard.mjs +1 -2
  108. package/dist/helpers/cookies.mjs +1 -2
  109. package/dist/helpers/deepEqual/deepEqual.d.ts +5 -0
  110. package/dist/helpers/deepEqual/deepEqual.mjs +44 -0
  111. package/dist/helpers/deepEqual/index.d.ts +1 -0
  112. package/dist/helpers/deepEqual/index.mjs +1 -0
  113. package/dist/helpers/eventTarget.mjs +1 -2
  114. package/dist/helpers/fetchManifest.mjs +1 -2
  115. package/dist/helpers/images.mjs +1 -2
  116. package/dist/helpers/index.d.ts +4 -6
  117. package/dist/helpers/index.mjs +24 -20
  118. package/dist/helpers/interval.mjs +1 -2
  119. package/dist/helpers/isRecord.mjs +1 -2
  120. package/dist/helpers/keys.mjs +1 -2
  121. package/dist/helpers/lodash/camelCase.d.ts +1 -0
  122. package/dist/helpers/lodash/camelCase.mjs +7 -0
  123. package/dist/helpers/lodash/capitalize.d.ts +1 -0
  124. package/dist/helpers/lodash/capitalize.mjs +5 -0
  125. package/dist/helpers/lodash/cloneDeep.d.ts +8 -0
  126. package/dist/helpers/lodash/cloneDeep.mjs +53 -0
  127. package/dist/helpers/lodash/get.d.ts +11 -0
  128. package/dist/helpers/lodash/get.mjs +14 -0
  129. package/dist/helpers/lodash/has.d.ts +2 -0
  130. package/dist/helpers/lodash/has.mjs +12 -0
  131. package/dist/helpers/lodash/index.d.ts +11 -0
  132. package/dist/helpers/lodash/index.mjs +7 -0
  133. package/dist/helpers/lodash/omit.d.ts +4 -0
  134. package/dist/helpers/lodash/omit.mjs +35 -0
  135. package/dist/helpers/lodash/set.d.ts +2 -0
  136. package/dist/helpers/lodash/set.mjs +20 -0
  137. package/dist/helpers/lodash/shared.d.ts +2 -0
  138. package/dist/helpers/lodash/shared.mjs +37 -0
  139. package/dist/helpers/reducerOrigin.mjs +1 -2
  140. package/dist/helpers/replaceEqualDeep/index.d.ts +1 -0
  141. package/dist/helpers/replaceEqualDeep/index.mjs +1 -0
  142. package/dist/helpers/replaceEqualDeep/replaceEqualDeep.d.ts +12 -0
  143. package/dist/helpers/replaceEqualDeep/replaceEqualDeep.mjs +30 -0
  144. package/dist/helpers/resources.d.ts +21 -0
  145. package/dist/helpers/resources.mjs +40 -0
  146. package/dist/helpers/scroll.mjs +1 -2
  147. package/dist/helpers/security.d.ts +15 -0
  148. package/dist/helpers/security.mjs +8 -4
  149. package/dist/helpers/spaceRoot.mjs +1 -2
  150. package/dist/helpers/syntaxHighlight.mjs +1 -2
  151. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +75 -76
  152. package/dist/helpers/twigWrapper/Evaluator/helpers.mjs +1 -2
  153. package/dist/helpers/twigWrapper/Lexer/Lexer.mjs +1 -2
  154. package/dist/helpers/twigWrapper/Lexer/types.mjs +1 -2
  155. package/dist/helpers/twigWrapper/Parser/Cursor.mjs +1 -2
  156. package/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs +1 -2
  157. package/dist/helpers/twigWrapper/Parser/Parser.mjs +1 -2
  158. package/dist/helpers/twigWrapper/Parser/helpers.mjs +1 -2
  159. package/dist/helpers/twigWrapper/TemplateCache/TemplateCache.mjs +1 -2
  160. package/dist/helpers/twigWrapper/charClass.mjs +1 -2
  161. package/dist/helpers/twigWrapper/filters/arrays.mjs +1 -2
  162. package/dist/helpers/twigWrapper/filters/catalog/index.mjs +1 -2
  163. package/dist/helpers/twigWrapper/filters/dateParts.mjs +1 -2
  164. package/dist/helpers/twigWrapper/filters/dates.mjs +13 -14
  165. package/dist/helpers/twigWrapper/filters/filters.mjs +21 -22
  166. package/dist/helpers/twigWrapper/filters/hashing.mjs +1 -2
  167. package/dist/helpers/twigWrapper/filters/misc.mjs +27 -28
  168. package/dist/helpers/twigWrapper/filters/numbers.mjs +1 -2
  169. package/dist/helpers/twigWrapper/filters/objects.mjs +1 -2
  170. package/dist/helpers/twigWrapper/filters/raw.mjs +1 -2
  171. package/dist/helpers/twigWrapper/filters/strings.mjs +23 -24
  172. package/dist/helpers/twigWrapper/filters/types.mjs +1 -2
  173. package/dist/helpers/twigWrapper/filters/values.mjs +1 -2
  174. package/dist/helpers/twigWrapper/index.mjs +8 -8
  175. package/dist/helpers/twigWrapper/inspectTemplate.mjs +12 -13
  176. package/dist/helpers/twigWrapper/processTwig/helpers.mjs +1 -2
  177. package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +1 -2
  178. package/dist/helpers/twigWrapper/processTwig/resolveStepParam.mjs +1 -2
  179. package/dist/helpers/twigWrapper/templateRoots.d.ts +3 -9
  180. package/dist/helpers/twigWrapper/templateRoots.mjs +14 -9
  181. package/dist/helpers/twigWrapper/tokens/hasTemplateSyntax.mjs +1 -2
  182. package/dist/helpers/twigWrapper/tokens/hasValidToken.mjs +1 -2
  183. package/dist/helpers/twigWrapper/tokens/tokenPatterns.mjs +1 -2
  184. package/dist/helpers/utils.mjs +2 -3
  185. package/dist/history/describe.mjs +1 -2
  186. package/dist/history/diff.mjs +1 -2
  187. package/dist/hooks/index.mjs +5 -5
  188. package/dist/hooks/useFontHead.mjs +1 -2
  189. package/dist/hooks/useNetwork.mjs +1 -2
  190. package/dist/hooks/usePlitzi.d.ts +7 -6
  191. package/dist/hooks/usePlitzi.mjs +1 -2
  192. package/dist/hooks/useStableValue.mjs +5 -6
  193. package/dist/navigation/index.mjs +3 -3
  194. package/dist/navigation/matchPath.mjs +19 -11
  195. package/dist/navigation/routes.mjs +57 -38
  196. package/dist/navigation/sitemap.mjs +9 -10
  197. package/dist/network/entitlements.d.ts +21 -0
  198. package/dist/network/entitlements.mjs +1 -2
  199. package/dist/network/graphql/builder/Mutations/Space/SpaceAddElementMutation.mjs +1 -2
  200. package/dist/network/graphql/builder/Mutations/Space/SpaceAddPluginMutation.mjs +1 -2
  201. package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.mjs +1 -2
  202. package/dist/network/graphql/builder/Mutations/Space/SpaceCloneElementMutation.mjs +1 -2
  203. package/dist/network/graphql/builder/Mutations/Space/SpaceDeployMutation.mjs +1 -2
  204. package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.mjs +1 -2
  205. package/dist/network/graphql/builder/Mutations/Space/SpaceMoveElementMutation.mjs +1 -2
  206. package/dist/network/graphql/builder/Mutations/Space/SpacePublishMutation.mjs +1 -2
  207. package/dist/network/graphql/builder/Mutations/Space/SpaceRemoveElementMutation.mjs +1 -2
  208. package/dist/network/graphql/builder/Mutations/Space/SpaceRemovePluginMutation.mjs +1 -2
  209. package/dist/network/graphql/builder/Mutations/Space/SpaceRenameElementMutation.mjs +1 -2
  210. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.mjs +1 -2
  211. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.mjs +1 -2
  212. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateElementMutation.mjs +1 -2
  213. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateElementsMutation.mjs +1 -2
  214. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateMutation.mjs +1 -2
  215. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.mjs +1 -2
  216. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSchemaMutation.mjs +1 -2
  217. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.mjs +1 -2
  218. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceAddActionMutation.mjs +1 -2
  219. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRemoveActionMutation.mjs +1 -2
  220. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRunActionMutation.mjs +1 -2
  221. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceUpdateActionMutation.mjs +1 -2
  222. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceAddCdnBucketMutation.mjs +1 -2
  223. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceAddCdnMutation.mjs +1 -2
  224. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceRemoveCdnBucketMutation.mjs +1 -2
  225. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceRemoveCdnMutation.mjs +1 -2
  226. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceSetCdnCredentialMutation.mjs +1 -2
  227. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceUpdateCdnBucketMutation.mjs +1 -2
  228. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceUpdateCdnMutation.mjs +1 -2
  229. package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.mjs +1 -2
  230. package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.mjs +1 -2
  231. package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.mjs +1 -2
  232. package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.mjs +1 -2
  233. package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceAddConnectorMutation.mjs +1 -2
  234. package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceRemoveConnectorMutation.mjs +1 -2
  235. package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceUpdateConnectorMutation.mjs +1 -2
  236. package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceAddCredentialMutation.mjs +1 -2
  237. package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceRemoveCredentialMutation.mjs +1 -2
  238. package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceUpdateCredentialMutation.mjs +1 -2
  239. package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.mjs +1 -2
  240. package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.mjs +1 -2
  241. package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.mjs +1 -2
  242. package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.mjs +1 -2
  243. package/dist/network/graphql/builder/Mutations/Space/folders/SpaceAddPageFolderMutation.mjs +1 -2
  244. package/dist/network/graphql/builder/Mutations/Space/folders/SpaceRemovePageFolderMutation.mjs +1 -2
  245. package/dist/network/graphql/builder/Mutations/Space/folders/SpaceUpdatePageFolderMutation.mjs +1 -2
  246. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceInstallTemplateFunctionsMutation.mjs +1 -2
  247. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.mjs +1 -2
  248. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.mjs +1 -2
  249. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.mjs +1 -2
  250. package/dist/network/graphql/builder/Mutations/Space/jobs/SpaceControlJobMutation.mjs +1 -2
  251. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceAddPageMutation.mjs +1 -2
  252. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceHomePageMutation.mjs +1 -2
  253. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceRemovePageMutation.mjs +1 -2
  254. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceUpdatePageMutation.mjs +1 -2
  255. package/dist/network/graphql/builder/Mutations/Space/resources/SpaceAddResourceMutation.mjs +1 -2
  256. package/dist/network/graphql/builder/Mutations/Space/resources/SpaceMoveResourceMutation.mjs +1 -2
  257. package/dist/network/graphql/builder/Mutations/Space/resources/SpaceRemoveResourceMutation.mjs +1 -2
  258. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.mjs +1 -2
  259. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.mjs +1 -2
  260. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.mjs +1 -2
  261. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.mjs +1 -2
  262. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.mjs +1 -2
  263. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.mjs +1 -2
  264. package/dist/network/graphql/builder/Mutations/Space/variables/SpaceAddVariableMutation.mjs +1 -2
  265. package/dist/network/graphql/builder/Mutations/Space/variables/SpaceRemoveVariableMutation.mjs +1 -2
  266. package/dist/network/graphql/builder/Mutations/Space/variables/SpaceUpdateVariableMutation.mjs +1 -2
  267. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.mjs +1 -2
  268. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.mjs +1 -2
  269. package/dist/network/graphql/builder/Mutations/Style/StyleUpdateMutation.mjs +1 -2
  270. package/dist/network/graphql/builder/Mutations/Style/StyleUpdateSettingsMutation.mjs +1 -2
  271. package/dist/network/graphql/builder/Mutations/Style/fonts/StyleAddFontMutation.mjs +1 -2
  272. package/dist/network/graphql/builder/Mutations/Style/fonts/StyleRemoveFontMutation.mjs +1 -2
  273. package/dist/network/graphql/builder/Mutations/Style/fonts/StyleUpdateFontMutation.mjs +1 -2
  274. package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleAddSelectorVariableMutation.mjs +1 -2
  275. package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleRemoveSelectorVariableMutation.mjs +1 -2
  276. package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleUpdateSelectorVariableMutation.mjs +1 -2
  277. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleAddSelectorMutation.mjs +1 -2
  278. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleRemoveSelectorMutation.mjs +1 -2
  279. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleRemoveSelectorsMutation.mjs +1 -2
  280. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleUpdateSelectorMutation.mjs +1 -2
  281. package/dist/network/graphql/builder/Mutations/Style/variables/StyleAddVariableMutation.mjs +1 -2
  282. package/dist/network/graphql/builder/Mutations/Style/variables/StyleRemoveVariableMutation.mjs +1 -2
  283. package/dist/network/graphql/builder/Mutations/Style/variables/StyleUpdateVariableMutation.mjs +1 -2
  284. package/dist/network/graphql/builder/Mutations/index.mjs +155 -156
  285. package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -2
  286. package/dist/network/graphql/builder/Queries/Space/SpaceActionEventsQuery.mjs +1 -2
  287. package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.mjs +1 -2
  288. package/dist/network/graphql/builder/Queries/Space/SpaceActionsQuery.mjs +1 -2
  289. package/dist/network/graphql/builder/Queries/Space/SpaceCdnsQuery.mjs +1 -2
  290. package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.mjs +1 -2
  291. package/dist/network/graphql/builder/Queries/Space/SpaceCheckActionQuery.mjs +1 -2
  292. package/dist/network/graphql/builder/Queries/Space/SpaceConnectorsQuery.mjs +1 -2
  293. package/dist/network/graphql/builder/Queries/Space/SpaceCredentialsQuery.mjs +1 -2
  294. package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.mjs +1 -2
  295. package/dist/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.mjs +1 -2
  296. package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.d.ts +1 -1
  297. package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.mjs +2 -3
  298. package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +1 -2
  299. package/dist/network/graphql/builder/Queries/Space/SpaceJobsQuery.mjs +1 -2
  300. package/dist/network/graphql/builder/Queries/Space/SpaceLatestRevisionQuery.mjs +1 -2
  301. package/dist/network/graphql/builder/Queries/Space/SpaceQuotaQuery.mjs +1 -2
  302. package/dist/network/graphql/builder/Queries/Space/SpaceResourcesQuery.mjs +1 -2
  303. package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.d.ts +1 -1
  304. package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.mjs +2 -3
  305. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.mjs +1 -2
  306. package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.mjs +1 -2
  307. package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.mjs +1 -2
  308. package/dist/network/graphql/builder/Queries/index.mjs +37 -38
  309. package/dist/network/graphql/builder/Subscriptions/SpaceEventSubscription.mjs +1 -2
  310. package/dist/network/graphql/builder/Subscriptions/index.mjs +1 -2
  311. package/dist/network/graphql/builder/fragments/cdnFields.mjs +1 -2
  312. package/dist/network/graphql/index.d.ts +0 -1
  313. package/dist/network/graphql/index.mjs +1 -3
  314. package/dist/network/index.d.ts +1 -5
  315. package/dist/network/index.mjs +7 -11
  316. package/dist/network/{NetworkContext.d.ts → react/NetworkContext.d.ts} +12 -11
  317. package/dist/network/{NetworkContext.mjs → react/NetworkContext.mjs} +1 -2
  318. package/dist/network/{NetworkInternalContext.d.ts → react/NetworkInternalContext.d.ts} +1 -1
  319. package/dist/network/react/NetworkInternalContext.mjs +4 -0
  320. package/dist/network/react/index.d.ts +5 -0
  321. package/dist/network/react/index.mjs +3 -0
  322. package/dist/network/spaceEvents.mjs +16 -17
  323. package/dist/plugins/bundle/bundle.mjs +1 -2
  324. package/dist/plugins/declaration.mjs +1 -2
  325. package/dist/plugins/react/ElementRegistryContext.d.ts +26 -0
  326. package/dist/plugins/react/ElementRegistryContext.mjs +17 -0
  327. package/dist/plugins/react/PluginAssetsContext.d.ts +11 -0
  328. package/dist/plugins/react/PluginAssetsContext.mjs +4 -0
  329. package/dist/plugins/react/PluginsContext.mjs +6 -3
  330. package/dist/plugins/react/index.d.ts +3 -0
  331. package/dist/plugins/react/index.mjs +4 -1
  332. package/dist/project/index.mjs +7 -7
  333. package/dist/project/layout/check.mjs +26 -27
  334. package/dist/project/layout/codes.mjs +1 -2
  335. package/dist/project/layout/contents.mjs +12 -13
  336. package/dist/project/layout/files.mjs +1 -2
  337. package/dist/project/layout/folders.mjs +43 -44
  338. package/dist/project/layout/index.mjs +3 -3
  339. package/dist/project/layout/plugins.mjs +56 -57
  340. package/dist/project/layout/vendor.mjs +14 -15
  341. package/dist/project/network.mjs +1 -2
  342. package/dist/project/pages/index.mjs +1 -2
  343. package/dist/project/paths/index.d.ts +8 -2
  344. package/dist/project/paths/index.mjs +3 -4
  345. package/dist/project/root.mjs +1 -2
  346. package/dist/queries/index.mjs +1 -2
  347. package/dist/queries/queryCache.mjs +1 -2
  348. package/dist/queries/serverQueries.mjs +1 -2
  349. package/dist/queries/useQuery.mjs +1 -2
  350. package/dist/queries/useServerQuery.mjs +1 -2
  351. package/dist/{helpers → react}/enclosingSpace.mjs +1 -2
  352. package/dist/react/generateFacade.d.ts +1 -0
  353. package/dist/{helpers → react}/generateFacade.mjs +4 -5
  354. package/dist/react/index.d.ts +8 -0
  355. package/dist/react/index.mjs +4 -0
  356. package/dist/{helpers → react}/sharedContext.mjs +0 -1
  357. package/dist/realtime/client.mjs +3 -4
  358. package/dist/realtime/index.mjs +4 -4
  359. package/dist/realtime/presence.mjs +1 -2
  360. package/dist/realtime/topics.mjs +1 -2
  361. package/dist/runs/index.mjs +1 -2
  362. package/dist/runs/report.mjs +1 -2
  363. package/dist/schema/anchor.mjs +1 -2
  364. package/dist/schema/index.mjs +18 -18
  365. package/dist/schema/layoutChain.mjs +1 -2
  366. package/dist/schema/markdownHeadings.mjs +1 -2
  367. package/dist/schema/motion.mjs +1 -2
  368. package/dist/schema/motionReveal.mjs +1 -2
  369. package/dist/schema/pageAccess.d.ts +9 -0
  370. package/dist/schema/pageAccess.mjs +42 -36
  371. package/dist/schema/pageElements.d.ts +3 -1
  372. package/dist/schema/pageElements.mjs +9 -3
  373. package/dist/schema/pageHead.d.ts +5 -2
  374. package/dist/schema/pageHead.mjs +3 -4
  375. package/dist/schema/providerAnswer.mjs +1 -2
  376. package/dist/schema/providerWhen.d.ts +1 -1
  377. package/dist/schema/providerWhen.mjs +6 -7
  378. package/dist/schema/react/SchemaContext.mjs +1 -2
  379. package/dist/schema/schemaConstants.mjs +1 -2
  380. package/dist/schema/schemaSettings.mjs +1 -2
  381. package/dist/schema/serverElements.d.ts +0 -24
  382. package/dist/schema/serverElements.mjs +60 -39
  383. package/dist/schema/serverInput.mjs +23 -24
  384. package/dist/schema/serverQuery.d.ts +15 -5
  385. package/dist/schema/serverQuery.mjs +47 -35
  386. package/dist/schema/snippet.mjs +1 -2
  387. package/dist/schema/wire.mjs +1 -2
  388. package/dist/security/index.d.ts +49 -0
  389. package/dist/security/index.mjs +44 -0
  390. package/dist/server/actions/useActionsSync.mjs +1 -2
  391. package/dist/server/actions/useImagesSync.mjs +1 -2
  392. package/dist/server/actions/useRealtimeSync.mjs +1 -2
  393. package/dist/server/index.mjs +7 -7
  394. package/dist/server/rsc/refreshRsc.mjs +23 -24
  395. package/dist/server/rsc/useRscRefresh.mjs +1 -2
  396. package/dist/server/rsc/useRscSync.mjs +1 -2
  397. package/dist/server/usePluginRoute.mjs +1 -2
  398. package/dist/source/export.d.ts +1 -1
  399. package/dist/source/export.mjs +1 -2
  400. package/dist/source/import.mjs +1 -2
  401. package/dist/source/index.mjs +4 -4
  402. package/dist/source/snapshot.mjs +1 -2
  403. package/dist/state/index.d.ts +0 -1
  404. package/dist/state/index.mjs +1 -3
  405. package/dist/state/paintedState.mjs +10 -11
  406. package/dist/store/actionRuns/actionRunsRecorder.mjs +1 -2
  407. package/dist/store/actionRuns/actionRunsStore.mjs +1 -2
  408. package/dist/store/actionRuns/index.mjs +3 -3
  409. package/dist/store/actionRuns/useActionRuns.mjs +5 -6
  410. package/dist/store/index.d.ts +1 -0
  411. package/dist/store/index.mjs +2 -1
  412. package/dist/store/renderSettings.d.ts +1 -1
  413. package/dist/store/renderSettings.mjs +1 -2
  414. package/dist/{state → store}/runtimeStatePersist.mjs +29 -30
  415. package/dist/store/storeHooks.d.ts +45 -45
  416. package/dist/store/storeHooks.mjs +1 -2
  417. package/dist/store/tracing/index.mjs +5 -5
  418. package/dist/store/tracing/preview.mjs +1 -2
  419. package/dist/store/tracing/tracingCollector.d.ts +2 -2
  420. package/dist/store/tracing/tracingCollector.mjs +79 -78
  421. package/dist/store/tracing/tracingMiddleware.mjs +1 -2
  422. package/dist/store/tracing/tracingStore.mjs +1 -2
  423. package/dist/store/tracing/useTracing.mjs +6 -7
  424. package/dist/style/breakpoints.mjs +1 -2
  425. package/dist/style/cssLayers.mjs +1 -2
  426. package/dist/style/displayModes.mjs +1 -2
  427. package/dist/style/fontAssets.mjs +1 -2
  428. package/dist/style/fontValidation.mjs +14 -15
  429. package/dist/style/fonts.d.ts +5 -3
  430. package/dist/style/fonts.mjs +23 -24
  431. package/dist/style/fontsFromCss.mjs +1 -2
  432. package/dist/style/index.mjs +18 -18
  433. package/dist/style/keyframes.mjs +1 -2
  434. package/dist/style/layoutGrid.mjs +1 -2
  435. package/dist/style/notifications.mjs +1 -2
  436. package/dist/style/react/useDisplayMode.mjs +1 -2
  437. package/dist/style/react/useElementSize.mjs +1 -2
  438. package/dist/style/runtimeStyle.d.ts +19 -21
  439. package/dist/style/runtimeStyle.mjs +4 -7
  440. package/dist/style/snippetStyle.mjs +5 -6
  441. package/dist/style/styleConditions.mjs +1 -2
  442. package/dist/style/styleConstants.mjs +1 -2
  443. package/dist/style/stylePseudos.mjs +1 -2
  444. package/dist/style/styleStates.mjs +1 -2
  445. package/dist/style/styleTarget.mjs +24 -25
  446. package/dist/theme/cookie/index.mjs +1 -1
  447. package/dist/theme/cookie/themeCookie.d.ts +21 -1
  448. package/dist/theme/cookie/themeCookie.mjs +19 -4
  449. package/dist/theme/index.d.ts +1 -9
  450. package/dist/theme/index.mjs +1 -6
  451. package/dist/theme/{ThemeProvider.d.ts → react/ThemeProvider.d.ts} +8 -2
  452. package/dist/theme/react/ThemeProvider.mjs +78 -0
  453. package/dist/theme/{ThemeScope.d.ts → react/ThemeScope.d.ts} +6 -2
  454. package/dist/theme/react/ThemeScope.mjs +9 -0
  455. package/dist/theme/react/index.d.ts +9 -0
  456. package/dist/theme/react/index.mjs +5 -0
  457. package/dist/theme/{themeStore.d.ts → react/themeStore.d.ts} +5 -5
  458. package/dist/theme/{themeStore.mjs → react/themeStore.mjs} +4 -4
  459. package/dist/theme/{useTheme.d.ts → react/useTheme.d.ts} +1 -1
  460. package/dist/theme/react/useTheme.mjs +19 -0
  461. package/dist/types/ActionTypes.d.ts +33 -0
  462. package/dist/types/AuthTypes.d.ts +6 -0
  463. package/dist/types/CommonTypes.d.ts +14 -3
  464. package/dist/types/DataSourceTypes.d.ts +1 -1
  465. package/dist/types/FunctionTypes.d.ts +16 -6
  466. package/dist/types/InteractionTypes.d.ts +1 -1
  467. package/dist/types/JobTypes.d.ts +56 -182
  468. package/dist/types/PluginTypes.d.ts +8 -1
  469. package/dist/types/SchemaTypes.d.ts +1 -1
  470. package/dist/types/SchemaTypes.mjs +1 -2
  471. package/dist/types/ServerAdapterTypes.d.ts +0 -326
  472. package/dist/types/ServerTypes.d.ts +0 -311
  473. package/dist/types/SpaceTypes.d.ts +5 -2
  474. package/dist/types/StoreTypes.d.ts +9 -3
  475. package/dist/types/StyleTypes.d.ts +6 -0
  476. package/dist/types/StyleTypes.mjs +1 -2
  477. package/dist/types/index.d.ts +0 -3
  478. package/dist/websockets/RTCodec.mjs +1 -2
  479. package/eslint.config.mjs +25 -0
  480. package/package.json +29 -18
  481. package/vite.config.ts +58 -0
  482. package/dist/helpers/generateFacade.d.ts +0 -2
  483. package/dist/helpers/ruleEvaluator.d.ts +0 -16
  484. package/dist/helpers/ruleEvaluator.mjs +0 -5
  485. package/dist/network/NetworkInternalContext.mjs +0 -5
  486. package/dist/network/graphql/sdk/Mutations/index.d.ts +0 -3
  487. package/dist/network/graphql/sdk/Mutations/index.mjs +0 -4
  488. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +0 -16
  489. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +0 -4
  490. package/dist/network/graphql/sdk/Queries/index.d.ts +0 -6
  491. package/dist/network/graphql/sdk/Queries/index.mjs +0 -5
  492. package/dist/network/graphql/sdk/index.d.ts +0 -5
  493. package/dist/network/graphql/sdk/index.mjs +0 -3
  494. package/dist/theme/ThemeProvider.mjs +0 -69
  495. package/dist/theme/ThemeScope.mjs +0 -10
  496. package/dist/theme/useTheme.mjs +0 -20
  497. package/dist/types/OAuthTypes.d.ts +0 -246
  498. package/dist/types/ServerConfigTypes.d.ts +0 -527
  499. package/dist/types/ServerLogTypes.d.ts +0 -119
  500. /package/dist/{types/OAuthTypes.mjs → conditions/types.mjs} +0 -0
  501. /package/dist/{types/ServerConfigTypes.mjs → functions/kv.mjs} +0 -0
  502. /package/dist/{types/ServerLogTypes.mjs → functions/later.mjs} +0 -0
  503. /package/dist/{helpers → react}/enclosingSpace.d.ts +0 -0
  504. /package/dist/{helpers → react}/sharedContext.d.ts +0 -0
  505. /package/dist/{state → store}/runtimeStatePersist.d.ts +0 -0
@@ -1,48 +1,69 @@
1
- import { isRecord as e } from "../helpers/isRecord.mjs";
1
+ import { resolveLayoutChain as e } from "./layoutChain.mjs";
2
2
  import { processTwigValue as t } from "../helpers/twigWrapper/processTwig/processTwig.mjs";
3
- import n from "../dataSource/helpers/getSourceName.mjs";
4
- import { passesFlagGate as r } from "../flags/resolveFlags.mjs";
5
- import { pageWithheldOf as i, withheldPageOf as a } from "./pageAccess.mjs";
6
- import { resolveLayoutChain as o } from "./layoutChain.mjs";
7
- //#region src/schema/serverElements.ts
8
- var s = (e, t, n, s) => {
9
- if (t === void 0) return [];
10
- let c = n ? new Set(n) : void 0, l = [], u = /* @__PURE__ */ new Set(), d = e.flat[t], f = (e) => typeof e == "string" ? e : "", p = d ? o((t) => e.flat[t], f(d.attributes.layout), f(d.attributes.layoutContainer)).map((e) => e.layout) : [], m = i(d?.attributes) ? a(e) : void 0, h = [
11
- t,
12
- ...p,
13
- ...m === void 0 ? [] : [m]
14
- ];
15
- for (; h.length > 0;) {
16
- let t = h.pop();
17
- if (t === void 0 || u.has(t)) continue;
18
- u.add(t);
19
- let n = e.flat[t];
20
- if (!n || s && !r(n.definition.flag, s)) continue;
21
- n.definition.runtime === "server" && (!c || c.has(n.id)) && l.push(n);
22
- let { items: i } = n.definition;
23
- i && h.push(...i);
3
+ import { pageWithheldOf as n, withheldPageOf as r } from "./pageAccess.mjs";
4
+ import i from "../dataSource/helpers/getSourceName.mjs";
5
+ import { passesFlagGate as a } from "../flags/resolveFlags.mjs";
6
+ import { isRecord as o } from "../helpers/isRecord.mjs";
7
+ // src/schema/serverElements.ts
8
+ var s = /* @__PURE__ */ new WeakMap(), c = (t, i) => {
9
+ let a = [], o = /* @__PURE__ */ new Set(), s = t.flat[i], c = (e) => typeof e == "string" ? e : "", l = s ? e((e) => t.flat[e], c(s.attributes.layout), c(s.attributes.layoutContainer)).map((e) => e.layout) : [], u = n(s?.attributes) ? r(t) : void 0, d = [
10
+ i,
11
+ ...l,
12
+ ...u === void 0 ? [] : [u]
13
+ ].map((e) => ({
14
+ id: e,
15
+ gates: []
16
+ }));
17
+ for (; d.length > 0;) {
18
+ let e = d.pop();
19
+ if (e === void 0 || o.has(e.id)) continue;
20
+ o.add(e.id);
21
+ let n = t.flat[e.id];
22
+ if (!n) continue;
23
+ let { flag: r, items: i, runtime: s } = n.definition, c = r ? [...e.gates, r] : e.gates;
24
+ s === "server" && a.push({
25
+ element: n,
26
+ gates: c
27
+ }), i && d.push(...i.map((e) => ({
28
+ id: e,
29
+ gates: c
30
+ })));
24
31
  }
25
- return l;
26
- }, c = (e, t, n) => s(e, t, void 0, n).length > 0, l = (e, n, r) => e.find((e) => {
32
+ return a;
33
+ }, l = (e, t) => {
34
+ let n = s.get(e.flat) ?? /* @__PURE__ */ new Map();
35
+ s.set(e.flat, n);
36
+ let r = n.get(t);
37
+ if (r && r.pages === e.pages && r.settings === e.settings) return r.found;
38
+ let i = c(e, t);
39
+ return n.set(t, {
40
+ pages: e.pages,
41
+ settings: e.settings,
42
+ found: i
43
+ }), i;
44
+ }, u = (e, t, n, r) => {
45
+ if (t === void 0) return [];
46
+ let i = n ? new Set(n) : void 0;
47
+ return l(e, t).filter(({ element: e }) => !i || i.has(e.id)).filter(({ gates: e }) => !r || e.every((e) => a(e, r))).map(({ element: e }) => e);
48
+ }, d = (e, t, n) => u(e, t, void 0, n).length > 0, f = (e, n, r) => e.find((e) => {
27
49
  let i = e.attributes.notFound;
28
50
  return typeof i == "string" && i !== "" && Object.hasOwn(n, e.id) && t(i, {
29
51
  source: n[e.id],
30
52
  navigation: r
31
53
  }) === !0;
32
- })?.id, u = (e, t, r) => ({
33
- ...Object.fromEntries(e.filter((e) => Object.hasOwn(t, e.id)).map((e) => [n(e.definition.type, e.id), t[e.id]])),
34
- navigation: r
35
- }), d = /\{[{%]/, f = (e, n) => {
54
+ })?.id, p = (e, t, n) => ({
55
+ ...Object.fromEntries(e.filter((e) => Object.hasOwn(t, e.id)).map((e) => [i(e.definition.type, e.id), t[e.id]])),
56
+ navigation: n
57
+ }), m = /\{[{%]/, h = (e, n) => {
36
58
  if (typeof e != "string") return;
37
- let r = d.test(e) ? t(e, n) : e, i = typeof r == "string" || typeof r == "number" ? String(r).trim() : "";
38
- return i === "" || d.test(i) ? void 0 : i;
39
- }, p = (e, n) => typeof e == "string" && e !== "" && t(e, n) === !0, m = (n, r) => {
40
- if (typeof n == "string") {
41
- if (!d.test(n)) return n;
42
- let e = t(n, r);
43
- return e === void 0 || typeof e == "string" && (e.trim() === "" || d.test(e)) ? void 0 : e;
59
+ let r = m.test(e) ? t(e, n) : e, i = typeof r == "string" || typeof r == "number" ? String(r).trim() : "";
60
+ return i === "" || m.test(i) ? void 0 : i;
61
+ }, g = (e, n) => typeof e == "string" && e !== "" && t(e, n) === !0, _ = (e, n) => {
62
+ if (typeof e == "string") {
63
+ if (!m.test(e)) return e;
64
+ let r = t(e, n);
65
+ return r === void 0 || typeof r == "string" && (r.trim() === "" || m.test(r)) ? void 0 : r;
44
66
  }
45
- return Array.isArray(n) ? n.map((e) => m(e, r)).filter((e) => e !== void 0) : e(n) ? Object.fromEntries(Object.entries(n).map(([e, t]) => [e, m(t, r)]).filter(([, e]) => e !== void 0)) : n;
46
- }, h = (t, n) => (Array.isArray(t) ? t : []).filter(e).map((e) => m(e, n)).filter(e), g = (e) => JSON.stringify(e).replace(/</g, "\\u003c"), _ = "$failed", v = (t) => e(t) && typeof t.$failed == "string" ? t[_] : void 0;
47
- //#endregion
48
- export { _ as RSC_FAILURE, s as collectServerElements, c as hasServerElements, g as jsonForScript, l as notFoundProvider, p as pageNotFound, f as pageSeoText, u as pageServerContext, h as pageStructuredData, v as rscFailureOf };
67
+ return Array.isArray(e) ? e.map((e) => _(e, n)).filter((e) => e !== void 0) : o(e) ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, _(t, n)]).filter(([, e]) => e !== void 0)) : e;
68
+ }, v = (e, t) => (Array.isArray(e) ? e : []).filter(o).map((e) => _(e, t)).filter(o), y = (e) => JSON.stringify(e).replace(/</g, "\\u003c"), b = "$failed", x = (e) => o(e) && typeof e.$failed == "string" ? e[b] : void 0;
69
+ export { b as RSC_FAILURE, u as collectServerElements, d as hasServerElements, y as jsonForScript, f as notFoundProvider, g as pageNotFound, h as pageSeoText, p as pageServerContext, v as pageStructuredData, x as rscFailureOf };
@@ -1,21 +1,21 @@
1
- import { isRecord as e } from "../helpers/isRecord.mjs";
1
+ import { serverProviderSource as e } from "./providerWhen.mjs";
2
2
  import { templatePaths as t } from "../helpers/twigWrapper/templateRoots.mjs";
3
- import n from "../dataSource/getBindingsDetails.mjs";
4
- import r from "../dataSource/helpers/getSourceName.mjs";
5
- import { serverProviderSource as i } from "./providerWhen.mjs";
6
- import { get as a } from "@plitzi/plitzi-ui/helpers/lodash";
7
- //#region src/schema/serverInput.ts
3
+ import { get as n } from "../helpers/lodash/get.mjs";
4
+ import r from "../dataSource/getBindingsDetails.mjs";
5
+ import i from "../dataSource/helpers/getSourceName.mjs";
6
+ import { isRecord as a } from "../helpers/isRecord.mjs";
7
+ // src/schema/serverInput.ts
8
8
  var o = /^navigation\.(routeParams|queryParams)(\.|$)/, s = "apiContainer", c = (e) => e.split(/[.[]/)[0] ?? e, l = (e) => [e.source, ...(e.transformers ?? []).flatMap(({ action: e, params: n }) => e === "twigTemplate" && typeof n.template == "string" ? t(n.template).filter((e) => e !== "source" && !e.startsWith("source.")) : [])], u = (e) => e.to === "input" || e.to.startsWith("input."), d = (e, t) => (e.definition.bindings?.attributes ?? []).filter((e) => e.enabled !== !1 && u(e) && e.when === void 0 && l(e).every((e) => o.test(e) || t(c(e)))), f = (e, t) => {
9
9
  let n = (e) => {
10
10
  let n = e.startsWith(`${s}_`) ? e.slice(s.length + 1) : void 0;
11
- return n !== void 0 && t.has(n) && r(s, n) === e ? n : void 0;
11
+ return n !== void 0 && t.has(n) && i(s, n) === e ? n : void 0;
12
12
  };
13
13
  return [...new Set(d(e, (e) => n(e) !== void 0).flatMap((e) => l(e).flatMap((e) => n(c(e)) ?? [])))];
14
- }, p = (e, t, r = {}) => {
14
+ }, p = (e, t, n = {}) => {
15
15
  if (e === void 0) return;
16
- let i = d(e, (e) => Object.hasOwn(r, e));
17
- return i.length === 0 ? e.attributes.input : n({
18
- ...r,
16
+ let i = d(e, (e) => Object.hasOwn(n, e));
17
+ return i.length === 0 ? e.attributes.input : r({
18
+ ...n,
19
19
  navigation: t
20
20
  }, {
21
21
  attributes: e.attributes,
@@ -28,13 +28,13 @@ var o = /^navigation\.(routeParams|queryParams)(\.|$)/, s = "apiContainer", c =
28
28
  if (e == null || e === "") return "empty";
29
29
  let t = JSON.stringify(e);
30
30
  return t.length > 60 ? `${t.slice(0, 57)}…` : t;
31
- }, h = (e, t, r = {}) => {
32
- let i = new Set(d(e, (e) => Object.hasOwn(r, e)));
31
+ }, h = (e, t, i = {}) => {
32
+ let a = new Set(d(e, (e) => Object.hasOwn(i, e)));
33
33
  return (e.definition.bindings?.attributes ?? []).filter((e) => e.enabled !== !1 && u(e)).map((o) => {
34
34
  let u = `${o.to} ← ${o.source}`;
35
- if (i.has(o)) {
36
- let i = n({
37
- ...r,
35
+ if (a.has(o)) {
36
+ let a = r({
37
+ ...i,
38
38
  navigation: t
39
39
  }, {
40
40
  attributes: e.attributes,
@@ -43,18 +43,17 @@ var o = /^navigation\.(routeParams|queryParams)(\.|$)/, s = "apiContainer", c =
43
43
  bindings: { attributes: [o] }
44
44
  }
45
45
  });
46
- return `${u}: ${m(a(i.attributes, o.to))}`;
46
+ return `${u}: ${m(n(a.attributes, o.to))}`;
47
47
  }
48
- let d = l(o).map(c).find((e) => e.startsWith(`${s}_`) && !Object.hasOwn(r, e));
48
+ let d = l(o).map(c).find((e) => e.startsWith(`${s}_`) && !Object.hasOwn(i, e));
49
49
  return o.when === void 0 ? d === void 0 ? `${u}: not read on the server (the visitor's state), the input as saved` : `${u}: not read on the server — ${d} gave it no answer (not a server provider, or it failed)` : `${u}: not read on the server (it has a \`when\`), the input as saved`;
50
50
  });
51
- }, g = (t, n, a, o) => {
51
+ }, g = (t, n, r, o) => {
52
52
  if (t === void 0) return;
53
- let c = e(a) ? a : {}, l = (t) => {
54
- let r = e(n) ? n[t] : void 0;
55
- return e(r) && e(r.attributes) && r.attributes.singleRecord === !0;
53
+ let c = a(r) ? r : {}, l = (e) => {
54
+ let t = a(n) ? n[e] : void 0;
55
+ return a(t) && a(t.attributes) && t.attributes.singleRecord === !0;
56
56
  };
57
- return p(t, o, Object.fromEntries(f(t, new Set(Object.keys(c))).map((e) => [r(s, e), i(c[e], l(e))])));
57
+ return p(t, o, Object.fromEntries(f(t, new Set(Object.keys(c))).map((t) => [i(s, t), e(c[t], l(t))])));
58
58
  };
59
- //#endregion
60
59
  export { g as browserServerInput, f as inputProviders, h as inputReadings, p as serverInputOf };
@@ -4,7 +4,8 @@ import { Element } from '../types';
4
4
  * for authoring, which refuses what it cannot read.
5
5
  *
6
6
  * - `path`: a file of the server's own or the project's data (`/data/…`), read from where it is kept.
7
- * - `url`: another site's address, asked with GET by the page server, with the headers the provider declares.
7
+ * - `url`: another site's address, asked with GET by the page server, with the headers the provider declares —
8
+ * `asVisitor` when it says `credentials: 'include'`: with the visitor's cookies, where the deployment allows it.
8
9
  * - `unresolved`: what only the browser can ask — said with why, never left to resolve to nothing.
9
10
  */
10
11
  export type ServerQuery = {
@@ -14,31 +15,40 @@ export type ServerQuery = {
14
15
  kind: 'url';
15
16
  url: URL;
16
17
  headers: Record<string, string>;
18
+ asVisitor: boolean;
17
19
  } | {
18
20
  kind: 'unresolved';
19
21
  why: string;
20
22
  };
21
23
  /**
22
24
  * What the page server knows of a visit, as a template reads it in the browser: the space's variables resolved for
23
- * this host (`{{ apiUrl }}`), and where the visit is (`{{ navigation.routeParams.id }}`, `navigation.origin`).
25
+ * this host (`{{ apiUrl }}`), where the visit is (`{{ navigation.routeParams.id }}`, `navigation.origin`), and the
26
+ * state the page starts from — the keys the space paints (`settings.paintedState`), as the visitor's cookie holds them
27
+ * (`{{ state.workspace.id }}`).
24
28
  */
25
29
  export type ServerTemplateData = {
26
30
  variables: Readonly<Record<string, unknown>>;
27
31
  routeParams: Readonly<Record<string, string | undefined>>;
28
32
  queryParams: Readonly<Record<string, string>>;
29
33
  origin: string;
34
+ /** The keys of `runtime.state` the server knows: the ones the space paints, with `keepState` on. */
35
+ paintedKeys: ReadonlySet<string>;
36
+ /** Their values on this visit — what the page's `runtime.state` starts from. */
37
+ state: Readonly<Record<string, unknown>>;
30
38
  };
31
39
  type Provider = Pick<Element, 'attributes' | 'definition'>;
32
40
  /**
33
41
  * Why the page server cannot ask a provider's `query` — from what is written alone, so authoring says it before a
34
- * visit: bound, templated over what the browser alone holds, the visitor's cookies, another method. `undefined` when it
35
- * can; whether the address it comes to is one it reads is decided once the template is filled in (`serverQueryOf`).
42
+ * visit: bound, templated over what the browser alone holds, another method. `undefined` when it can; whether the
43
+ * address it comes to is one it reads is decided once the template is filled in (`serverQueryOf`) — and whether it may
44
+ * carry the visitor's cookies there (`credentials: 'include'`) by the deployment, which names the APIs and the spaces
45
+ * that may (`rsc.visitorCredentials`).
36
46
  *
37
47
  * A template may read the space's variables and `navigation` — what the page server knows of a visit. A route or
38
48
  * query param is read as `navigation.routeParams.x`: written bare (`{{ x }}`) it cannot be told from a state or a
39
49
  * provider's name before the visit.
40
50
  */
41
- export declare const serverQueryProblem: (element: Provider, variableNames: ReadonlySet<string>) => string | undefined;
51
+ export declare const serverQueryProblem: (element: Provider, variableNames: ReadonlySet<string>, paintedKeys?: ReadonlySet<string>) => string | undefined;
42
52
  /**
43
53
  * A provider's `query` as the page server reads it on a visit — its template filled in with what the server knows of
44
54
  * it, as the browser would have filled it in; `undefined` for a provider with no query at all.
@@ -1,25 +1,33 @@
1
- import { processTwig as e } from "../helpers/twigWrapper/processTwig/processTwig.mjs";
2
- import { templateRootNames as t } from "../helpers/twigWrapper/templateRoots.mjs";
3
- //#region src/schema/serverQuery.ts
4
- var n = [
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
2
+ import { processTwig as t } from "../helpers/twigWrapper/processTwig/processTwig.mjs";
3
+ import { TOKEN_REGEX as n } from "../helpers/twigWrapper/tokens/tokenPatterns.mjs";
4
+ import { templatePaths as r } from "../helpers/twigWrapper/templateRoots.mjs";
5
+ // src/schema/serverQuery.ts
6
+ var i = [
5
7
  "query",
6
8
  "headers",
7
9
  "accessToken",
8
10
  "method",
9
11
  "credentials"
10
- ], r = ["query", "accessToken"], i = (e) => typeof e == "object" && e ? Object.fromEntries(Object.entries(e).filter((e) => typeof e[1] == "string")) : {}, a = (e, i) => {
11
- let { query: a, method: o, credentials: s } = e.attributes;
12
- if (typeof a != "string" || a === "") return;
13
- let c = (e.definition.bindings?.attributes ?? []).filter((e) => e.enabled !== !1 && n.includes(e.to)).map((e) => e.to);
14
- if (c.length > 0) return `its ${[...new Set(c)].join(", ")} is bound, which the browser alone resolves`;
15
- let l = r.flatMap((n) => {
16
- let r = e.attributes[n];
17
- return typeof r == "string" && r.includes("{{") ? t(r).filter((e) => e !== "navigation" && !i.has(e)) : [];
12
+ ], a = ["query", "accessToken"], o = (e) => typeof e == "object" && e ? Object.fromEntries(Object.entries(e).filter((e) => typeof e[1] == "string")) : {}, s = (e, t, n = /* @__PURE__ */ new Set()) => {
13
+ let { query: o, method: s } = e.attributes;
14
+ if (typeof o != "string" || o === "") return;
15
+ let u = (e.definition.bindings?.attributes ?? []).filter((e) => e.enabled !== !1 && i.includes(e.to)).map((e) => e.to);
16
+ if (u.length > 0) return `its ${[...new Set(u)].join(", ")} is bound, which the browser alone resolves`;
17
+ let d = a.flatMap((i) => {
18
+ let a = e.attributes[i];
19
+ return typeof a == "string" && a.includes("{{") ? r(a).filter((e) => !f(e, t, n)).map((e) => e.startsWith("state.") ? e.split(".").slice(0, 2).join(".") : e.split(".")[0]) : [];
18
20
  });
19
- if (l.length > 0) return `its template reads ${[...new Set(l)].map((e) => `\`${e}\``).join(", ")}, which the browser alone holds — the page server knows the space's variables and \`navigation\` (a route param is \`navigation.routeParams.x\`)`;
20
- if (typeof o == "string" && o !== "" && o.toLowerCase() !== "get") return `it asks with ${o.toUpperCase()}, and the page server reads with GET alone`;
21
- if (s === "include") return "it asks with the visitor's cookies (`credentials: 'include'`), which the page server never sends";
22
- }, o = (e, t) => {
21
+ if (d.length > 0) return `its template reads ${[...new Set(d)].map((e) => `\`${e}\``).join(", ")}, which the browser alone holds — the page server knows the space's variables, \`navigation\` (a route param is \`navigation.routeParams.x\`) and the state the space paints (\`settings.paintedState\`, as \`state.<key>\`)`;
22
+ if (a.some((t) => {
23
+ let n = e.attributes[t];
24
+ return typeof n == "string" && l(n).length > 0 && !c(n);
25
+ })) return "its template reads `state` inside an expression, which the browser does not follow — write each value as a token of its own (`{{ apiUrl }}/workspaces/{{ state.workspace.id }}`)";
26
+ if (typeof s == "string" && s !== "" && s.toLowerCase() !== "get") return `it asks with ${s.toUpperCase()}, and the page server reads with GET alone`;
27
+ }, c = (e) => (e.match(/\{\{/g) ?? []).length === (e.match(n) ?? []).length, l = (e) => e.includes("{{") ? r(e).filter((e) => e.startsWith("state.")).map((e) => e.slice(6)) : [], u = (t, n) => n.split(".").reduce((t, n) => e(t) ? t[n] : void 0, t), d = (e) => e == null || e === "", f = (e, t, n) => {
28
+ let [r, ...i] = e.split(".");
29
+ return r === "navigation" || t.has(r) || r === "state" && i.length > 0 && n.has(i[0]);
30
+ }, p = (e, t, n) => {
23
31
  if (e.startsWith("//")) return {
24
32
  kind: "unresolved",
25
33
  why: `"${e}" names no protocol — write https:`
@@ -28,43 +36,47 @@ var n = [
28
36
  kind: "path",
29
37
  path: e
30
38
  };
31
- let n;
39
+ let r;
32
40
  try {
33
- n = new URL(e);
41
+ r = new URL(e);
34
42
  } catch {
35
43
  return {
36
44
  kind: "unresolved",
37
45
  why: `"${e}" is neither an address (https://…) nor a path of the space (/…)`
38
46
  };
39
47
  }
40
- return n.protocol !== "https:" && n.protocol !== "http:" ? {
48
+ return r.protocol !== "https:" && r.protocol !== "http:" ? {
41
49
  kind: "unresolved",
42
- why: `"${e}" is read with ${n.protocol}, and the page server reads http(s) alone`
50
+ why: `"${e}" is read with ${r.protocol}, and the page server reads http(s) alone`
43
51
  } : {
44
52
  kind: "url",
45
- url: n,
46
- headers: t
53
+ url: r,
54
+ headers: t,
55
+ asVisitor: n
47
56
  };
48
- }, s = (t, n) => {
49
- let { query: r, headers: s, accessToken: c } = t.attributes;
57
+ }, m = (e, n) => {
58
+ let { query: r, headers: i, accessToken: a, credentials: c } = e.attributes;
50
59
  if (typeof r != "string" || r === "") return;
51
- let l = a(t, new Set(Object.keys(n.variables)));
52
- if (l !== void 0) return {
60
+ let f = s(e, new Set(Object.keys(n.variables)), n.paintedKeys);
61
+ if (f !== void 0) return {
53
62
  kind: "unresolved",
54
- why: l
63
+ why: f
55
64
  };
56
- let u = {
65
+ if (l(r).some((e) => d(u(n.state, e)))) return;
66
+ let m = {
57
67
  ...n.variables,
58
68
  navigation: {
59
69
  routeParams: n.routeParams,
60
70
  queryParams: n.queryParams,
61
71
  origin: n.origin
62
- }
63
- }, d = (t) => {
64
- let n = e(t, u);
72
+ },
73
+ state: n.state
74
+ }, h = (e) => {
75
+ let n = t(e, m);
65
76
  return typeof n == "string" ? n : String(n);
66
- }, f = i(s);
67
- return typeof c == "string" && c !== "" && (f.Authorization = `Bearer ${d(c)}`), o(d(r), f);
77
+ }, g = o(i);
78
+ typeof a == "string" && a !== "" && (g.Authorization = `Bearer ${h(a)}`);
79
+ let _ = h(r).trim();
80
+ if (_ !== "") return p(_, g, c === "include");
68
81
  };
69
- //#endregion
70
- export { s as serverQueryOf, a as serverQueryProblem };
82
+ export { m as serverQueryOf, s as serverQueryProblem };
@@ -1,9 +1,8 @@
1
1
  import { isRecord as e } from "../helpers/isRecord.mjs";
2
- //#region src/schema/snippet.ts
2
+ // src/schema/snippet.ts
3
3
  var t = (t) => {
4
4
  if (!e(t) || !e(t.definition) || !e(t.schema) || !e(t.style)) return !1;
5
5
  let { definition: n, schema: r, style: i } = t;
6
6
  return typeof n.name != "string" || typeof n.baseElementId != "string" ? !1 : e(r.flat) && e(r.flat[n.baseElementId]) && Array.isArray(r.variables) && e(i.platform);
7
7
  };
8
- //#endregion
9
8
  export { t as isSnippet };
@@ -1,4 +1,4 @@
1
- //#region src/schema/wire.ts
1
+ // src/schema/wire.ts
2
2
  var e = (e) => ({
3
3
  ...e,
4
4
  flat: Object.values(e.flat)
@@ -32,5 +32,4 @@ var e = (e) => ({
32
32
  ...e,
33
33
  flat: Object.fromEntries(e.flat.map((e) => [e.id, n(e)]))
34
34
  });
35
- //#endregion
36
35
  export { n as elementFromWire, r as schemaFromWire, e as schemaToWire };
@@ -0,0 +1,49 @@
1
+ import { TrustedTypesPolicyName } from '../helpers/security';
2
+ /** What of the browser's `trustedTypes` the SDK uses: TypeScript's DOM library does not declare it yet. */
3
+ export type TrustedTypesRules = {
4
+ createHTML?: (input: string) => string | null;
5
+ createScript?: (input: string) => string | null;
6
+ createScriptURL?: (input: string) => string | null;
7
+ };
8
+ export type TrustedTypesPolicy = {
9
+ createHTML: (input: string) => TrustedHTML;
10
+ };
11
+ type TrustedTypesFactory = {
12
+ createPolicy: (name: TrustedTypesPolicyName, rules: TrustedTypesRules) => TrustedTypesPolicy;
13
+ /** The page's `default` policy, once something made it. */
14
+ defaultPolicy?: TrustedTypesPolicy | null;
15
+ };
16
+ /** The browser's factory, where there is one: none on the server, nor in a browser without Trusted Types. */
17
+ export declare const trustedTypesFactory: () => TrustedTypesFactory | undefined;
18
+ export declare const scriptPolicyEnforced: () => boolean;
19
+ /**
20
+ * Markup the page made itself (`plitzi-html`), as a trusted value where the browser asks for one — the same object for
21
+ * the same markup, since React writes `innerHTML` again whenever the value is a different one. The markup as it is on
22
+ * the server and where there is no Trusted Types.
23
+ */
24
+ export declare const ownHtml: (html: string) => string | TrustedHTML;
25
+ /**
26
+ * The page's script policy as its server said it on `<html data-plitzi-script-policy>`: what a copy of this module the
27
+ * SDK does not start — the builder's own, a plugin's that bundles its own — holds itself to. Nothing on the server, nor
28
+ * on a page with no policy.
29
+ */
30
+ export declare const pageScriptPolicy: () => "report-only" | "enforce" | undefined;
31
+ /**
32
+ * The page's policies, made as the SDK starts — before anything writes markup: the head's JSON-LD and React's first
33
+ * script go through `default` from the first commit — with the page's script policy as its server sent it
34
+ * (`Server.scriptPolicy`). What the policies clean depends on it: enforced, what an author wrote is cleaned; reported,
35
+ * it passes as it was, since cleaning it then would take away what still runs (an inline handler the policy does not
36
+ * refuse yet).
37
+ *
38
+ * A page held to a policy, reported or enforced, never asks for `eval`: the store writes without its compiled writers
39
+ * (nexus's `new Function`), and zod parses without compiling. Reported, their probes are reports on every page a visitor
40
+ * opens, which would bury the reports worth reading; enforced, they are refused anyway. It costs about 5 µs a store
41
+ * write, and loading the dashboard writes about a hundred times.
42
+ *
43
+ * Called with nothing, it reads the policy off the document (`pageScriptPolicy`): how a copy of this module the SDK did
44
+ * not start — the builder's — learns it.
45
+ *
46
+ * Nothing on the server: what is decided here is one page's, and a server renders many at once.
47
+ */
48
+ export declare const startMarkupPolicies: (next?: "report-only" | "enforce" | undefined) => void;
49
+ export {};
@@ -0,0 +1,44 @@
1
+ import { setCodegenEnabled as e } from "@plitzi/nexus";
2
+ import { z as t } from "zod";
3
+ // src/security/index.ts
4
+ var n = () => globalThis.trustedTypes, r, i = () => r === "enforce", a = (e) => {
5
+ try {
6
+ return JSON.parse(e), !0;
7
+ } catch {
8
+ return !1;
9
+ }
10
+ }, o = "<script><\/script>", s = (e) => !e.includes("<"), c = (e) => {
11
+ if (typeof location > "u") return !1;
12
+ if (e.startsWith(`blob:${location.origin}/`)) return !0;
13
+ try {
14
+ return new URL(e, location.href).origin === location.origin;
15
+ } catch {
16
+ return !1;
17
+ }
18
+ }, l, u = () => {
19
+ if (l !== void 0) return l;
20
+ let e = n();
21
+ if (!e) return l = null, l;
22
+ if (l = e.createPolicy("plitzi-html", { createHTML: (e) => e }), !e.defaultPolicy) try {
23
+ e.createPolicy("default", {
24
+ createHTML: (e) => e === o || s(e) ? e : null,
25
+ createScript: (e) => a(e) ? e : null,
26
+ createScriptURL: (e) => c(e) ? e : null
27
+ });
28
+ } catch {}
29
+ return l;
30
+ }, d = 500, f = /* @__PURE__ */ new Map(), p = (e) => {
31
+ let t = u();
32
+ if (!t) return e;
33
+ let n = f.get(e);
34
+ if (n) return n;
35
+ let r = t.createHTML(e);
36
+ return f.size < d && f.set(e, r), r;
37
+ }, m = () => {
38
+ if (typeof document > "u") return;
39
+ let e = document.documentElement.dataset.plitziScriptPolicy;
40
+ return e === "report-only" || e === "enforce" ? e : void 0;
41
+ }, h = (n = m()) => {
42
+ typeof window < "u" && (r = n, e(!n && void 0), n && t.config({ jitless: !0 }), u());
43
+ };
44
+ export { p as ownHtml, m as pageScriptPolicy, i as scriptPolicyEnforced, h as startMarkupPolicies, n as trustedTypesFactory };
@@ -1,7 +1,6 @@
1
1
  import { useCommonStoreSync as e } from "../../store/storeHooks.mjs";
2
- //#region src/server/actions/useActionsSync.ts
2
+ // src/server/actions/useActionsSync.ts
3
3
  var t = (t) => {
4
4
  e(["actions.endpoint"], [t?.actionPath]);
5
5
  };
6
- //#endregion
7
6
  export { t as default };
@@ -1,7 +1,6 @@
1
1
  import { useCommonStoreSync as e } from "../../store/storeHooks.mjs";
2
- //#region src/server/actions/useImagesSync.ts
2
+ // src/server/actions/useImagesSync.ts
3
3
  var t = (t) => {
4
4
  e(["images.endpoint"], [t?.imagePath]);
5
5
  };
6
- //#endregion
7
6
  export { t as default };
@@ -1,7 +1,6 @@
1
1
  import { useCommonStoreSync as e } from "../../store/storeHooks.mjs";
2
- //#region src/server/actions/useRealtimeSync.ts
2
+ // src/server/actions/useRealtimeSync.ts
3
3
  var t = (t) => {
4
4
  e(["realtime.endpoint", "realtime.transport"], [t?.realtimePath, t?.realtimeTransport]);
5
5
  };
6
- //#endregion
7
6
  export { t as default };
@@ -1,8 +1,8 @@
1
1
  import e from "./actions/useActionsSync.mjs";
2
- import t from "./actions/useImagesSync.mjs";
3
- import n from "./actions/useRealtimeSync.mjs";
4
- import r, { cancelRsc as i, currentRscLocation as a, holdRscRoot as o, noteRscFailures as s, releaseRscRequests as c, rscDataPath as l } from "./rsc/refreshRsc.mjs";
5
- import u from "./rsc/useRscRefresh.mjs";
6
- import d from "./rsc/useRscSync.mjs";
7
- import f from "./usePluginRoute.mjs";
8
- export { i as cancelRsc, a as currentRscLocation, o as holdRscRoot, s as noteRscFailures, r as refreshRsc, c as releaseRscRequests, l as rscDataPath, e as useActionsSync, t as useImagesSync, f as usePluginRoute, n as useRealtimeSync, u as useRscRefresh, d as useRscSync };
2
+ import t, { cancelRsc as n, currentRscLocation as r, holdRscRoot as i, noteRscFailures as a, releaseRscRequests as o, rscDataPath as s } from "./rsc/refreshRsc.mjs";
3
+ import c from "./rsc/useRscRefresh.mjs";
4
+ import l from "./rsc/useRscSync.mjs";
5
+ import u from "./usePluginRoute.mjs";
6
+ import d from "./actions/useImagesSync.mjs";
7
+ import f from "./actions/useRealtimeSync.mjs";
8
+ export { n as cancelRsc, r as currentRscLocation, i as holdRscRoot, a as noteRscFailures, t as refreshRsc, o as releaseRscRequests, s as rscDataPath, e as useActionsSync, d as useImagesSync, u as usePluginRoute, f as useRealtimeSync, c as useRscRefresh, l as useRscSync };
@@ -1,15 +1,15 @@
1
1
  import { authFailureFromResponse as e, reportAuthFailure as t } from "../../auth/failureChannel.mjs";
2
- import { recordRenderActionRuns as n } from "../../store/actionRuns/actionRunsRecorder.mjs";
3
- import { getPaths as r, matchRoutePath as i } from "../../navigation/routes.mjs";
4
- import { collectServerElements as a, hasServerElements as o, rscFailureOf as s } from "../../schema/serverElements.mjs";
5
- //#region src/server/rsc/refreshRsc.ts
2
+ import { collectServerElements as n, hasServerElements as r, rscFailureOf as i } from "../../schema/serverElements.mjs";
3
+ import { getPaths as a, matchRoutePath as o } from "../../navigation/routes.mjs";
4
+ import { recordRenderActionRuns as s } from "../../store/actionRuns/actionRunsRecorder.mjs";
5
+ // src/server/rsc/refreshRsc.ts
6
6
  var c = (e, t, n) => {
7
7
  if (!e) return;
8
- let a = e.pages.reduce((t, n) => (n in e.flat && (t[n] = e.flat[n]), t), {});
9
- return i(r(a, e.pageFolders, n), t.split("?")[0], n).pageId;
10
- }, l = (e, t, n, r) => {
11
- let i = new Set(a(e, t, [...n], r).map(({ id: e }) => e));
12
- return n.filter((e) => i.has(e));
8
+ let r = e.pages.reduce((t, n) => (n in e.flat && (t[n] = e.flat[n]), t), {});
9
+ return o(a(r, e.pageFolders, n), t.split("?")[0], n).pageId;
10
+ }, l = (e, t, r, i) => {
11
+ let a = new Set(n(e, t, [...r], i).map(({ id: e }) => e));
12
+ return r.filter((e) => a.has(e));
13
13
  }, u = (e) => `rsc.data.${e}`, d = () => typeof window > "u" ? "" : `${window.location.pathname}${window.location.search}`, f = "*", p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), g = (e, t) => {
14
14
  h.set(e, t);
15
15
  }, _ = (e) => {
@@ -46,7 +46,7 @@ var c = (e, t, n) => {
46
46
  p.get(e)?.inFlight.forEach((e) => e.controller.abort()), p.delete(e), h.delete(e);
47
47
  }, w = (e, t) => {
48
48
  let n = Object.entries(t).flatMap(([e, t]) => {
49
- let n = s(t);
49
+ let n = i(t);
50
50
  return n === void 0 ? [] : [[e, n]];
51
51
  });
52
52
  if (n.length === 0) return;
@@ -67,13 +67,13 @@ var c = (e, t, n) => {
67
67
  }
68
68
  e.set("rsc.loaded", !0), e.set("rsc.stale", !1), e.set("rsc.location", i);
69
69
  });
70
- }, E = async (r, i, a, { location: s, fresh: u = !1 } = {}) => {
71
- let p = _(r), { enabled: m, endpoint: h } = p.get("rsc") ?? {};
70
+ }, E = async (n, i, a, { location: o, fresh: u = !1 } = {}) => {
71
+ let p = _(n), { enabled: m, endpoint: h } = p.get("rsc") ?? {};
72
72
  if (!m || !h || typeof window > "u") return;
73
- let g = s ?? d(), v = p.get("schema"), S = p.get("runtime.sources.auth"), C = s ? c(v, s, !!S?.details) : p.get("navigation.currentPageId"), w = s ? void 0 : p.get("runtime.sources.flags");
73
+ let g = o ?? d(), v = p.get("schema"), S = p.get("runtime.sources.auth"), C = o ? c(v, o, !!S?.details) : p.get("navigation.currentPageId"), w = o ? void 0 : p.get("runtime.sources.flags");
74
74
  if (!v) return;
75
75
  let E = i?.length ? l(v, C, i, w) : void 0;
76
- if (E ? !E.length : !o(v, C, w)) return;
76
+ if (E ? !E.length : !r(v, C, w)) return;
77
77
  let D = new URLSearchParams({ location: g });
78
78
  E?.length && D.set("ids", E.join(",")), Object.entries(a ?? {}).forEach(([e, t]) => D.set(e, t));
79
79
  let O = `${h}?${D.toString()}`, k = y(p), A = [...k.inFlight].find((e) => e.url === O && (e.fresh || !u));
@@ -91,8 +91,8 @@ var c = (e, t, n) => {
91
91
  seq: j,
92
92
  controller: M,
93
93
  promise: Promise.resolve()
94
- }, P = async (r) => {
95
- let i = await fetch(O, {
94
+ }, P = async (n) => {
95
+ let r = await fetch(O, {
96
96
  ...u ? {
97
97
  cache: "no-cache",
98
98
  headers: {
@@ -102,17 +102,17 @@ var c = (e, t, n) => {
102
102
  } : { headers: { Accept: "application/json" } },
103
103
  signal: M.signal
104
104
  });
105
- if (!i.ok) {
106
- let n = e(i.status, await i.json().catch(() => void 0));
107
- if (n && await t({
108
- reason: n,
105
+ if (!r.ok) {
106
+ let i = e(r.status, await r.json().catch(() => void 0));
107
+ if (i && await t({
108
+ reason: i,
109
109
  url: h
110
- }) && !r) return P(!0);
110
+ }) && !n) return P(!0);
111
111
  p.set("rsc.stale", !0);
112
112
  return;
113
113
  }
114
- let { serverData: a, actionRuns: o } = await i.json();
115
- o?.length && n(o), T(p, k, N, a ?? {}, g);
114
+ let { serverData: i, actionRuns: a } = await r.json();
115
+ a?.length && s(a), T(p, k, N, i ?? {}, g);
116
116
  };
117
117
  return N.promise = P(!1).catch(() => {
118
118
  M.signal.aborted || p.set("rsc.stale", !0);
@@ -120,5 +120,4 @@ var c = (e, t, n) => {
120
120
  k.inFlight.delete(N), b(p, k);
121
121
  }), k.inFlight.add(N), b(p, k), N.promise;
122
122
  };
123
- //#endregion
124
123
  export { S as cancelRsc, d as currentRscLocation, E as default, E as refreshRsc, g as holdRscRoot, w as noteRscFailures, C as releaseRscRequests, u as rscDataPath };