@plitzi/sdk-shared 0.38.23 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/CHANGELOG.md +162 -1
  2. package/dist/actions/functions.d.ts +22 -1
  3. package/dist/actions/functions.mjs +3 -3
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.mjs +7 -7
  6. package/dist/auth/failureChannel.mjs +1 -0
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.mjs +2 -2
  9. package/dist/auth/visitorRoles.d.ts +8 -0
  10. package/dist/auth/visitorRoles.mjs +5 -2
  11. package/dist/authoring/declare.d.ts +34 -1
  12. package/dist/authoring/elementCallbacks.d.ts +13 -0
  13. package/dist/authoring/elementCallbacks.mjs +11 -5
  14. package/dist/authoring/index.mjs +3 -3
  15. package/dist/authoring/paramSpec.d.ts +1 -0
  16. package/dist/dataSource/getBindingsDetails.d.ts +1 -1
  17. package/dist/dataSource/getBindingsDetails.mjs +1 -1
  18. package/dist/dataSource/globalSources.d.ts +1 -1
  19. package/dist/dataSource/index.d.ts +1 -2
  20. package/dist/dataSource/index.mjs +1 -1
  21. package/dist/dataSource/utility/arrayMap.mjs +1 -1
  22. package/dist/dataSource/utility/capitalize.mjs +1 -1
  23. package/dist/dataSource/utility/styleSelector.mjs +5 -3
  24. package/dist/dataSource/utility/styleVariant.mjs +17 -13
  25. package/dist/dataSource/variables/index.d.ts +2 -0
  26. package/dist/dataSource/variables/index.mjs +1 -0
  27. package/dist/dataSource/{resolveVariables.d.ts → variables/resolveVariables.d.ts} +1 -1
  28. package/dist/dataSource/{resolveVariables.mjs → variables/resolveVariables.mjs} +1 -1
  29. package/dist/devTools/chrome.d.ts +6 -0
  30. package/dist/devTools/chrome.mjs +2 -2
  31. package/dist/devTools/index.mjs +5 -5
  32. package/dist/devTools/sight/index.d.ts +1 -0
  33. package/dist/devTools/sight/index.mjs +1 -0
  34. package/dist/devTools/sight/sight.d.ts +28 -0
  35. package/dist/devTools/sight/sight.mjs +127 -0
  36. package/dist/devTools/utils/PlitziConsole.d.ts +14 -0
  37. package/dist/devTools/utils/PlitziConsole.mjs +20 -3
  38. package/dist/flags/flagsCookie.mjs +4 -4
  39. package/dist/flags/resolveFlags.d.ts +1 -1
  40. package/dist/helpers/index.mjs +19 -19
  41. package/dist/helpers/ruleEvaluator.d.ts +2 -0
  42. package/dist/helpers/ruleEvaluator.mjs +2 -2
  43. package/dist/helpers/scroll.d.ts +10 -0
  44. package/dist/helpers/scroll.mjs +2 -2
  45. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +90 -88
  46. package/dist/helpers/twigWrapper/Evaluator/helpers.d.ts +6 -0
  47. package/dist/helpers/twigWrapper/Evaluator/helpers.mjs +11 -2
  48. package/dist/helpers/twigWrapper/filters/arrays.d.ts +2 -0
  49. package/dist/helpers/twigWrapper/filters/arrays.mjs +66 -0
  50. package/dist/helpers/twigWrapper/filters/catalog/index.d.ts +17 -0
  51. package/dist/helpers/twigWrapper/filters/catalog/index.mjs +351 -0
  52. package/dist/helpers/twigWrapper/filters/dateParts.d.ts +25 -0
  53. package/dist/helpers/twigWrapper/filters/dateParts.mjs +56 -0
  54. package/dist/helpers/twigWrapper/filters/dates.d.ts +2 -0
  55. package/dist/helpers/twigWrapper/filters/dates.mjs +97 -0
  56. package/dist/helpers/twigWrapper/filters/filters.d.ts +3 -13
  57. package/dist/helpers/twigWrapper/filters/filters.mjs +25 -483
  58. package/dist/helpers/twigWrapper/filters/hashing.d.ts +3 -0
  59. package/dist/helpers/twigWrapper/filters/hashing.mjs +101 -0
  60. package/dist/helpers/twigWrapper/filters/index.mjs +4 -1
  61. package/dist/helpers/twigWrapper/filters/misc.d.ts +5 -0
  62. package/dist/helpers/twigWrapper/filters/misc.mjs +52 -0
  63. package/dist/helpers/twigWrapper/filters/numbers.d.ts +2 -0
  64. package/dist/helpers/twigWrapper/filters/numbers.mjs +36 -0
  65. package/dist/helpers/twigWrapper/filters/objects.d.ts +3 -0
  66. package/dist/helpers/twigWrapper/filters/objects.mjs +61 -0
  67. package/dist/helpers/twigWrapper/filters/raw.d.ts +8 -0
  68. package/dist/helpers/twigWrapper/filters/raw.mjs +7 -0
  69. package/dist/helpers/twigWrapper/filters/strings.d.ts +7 -0
  70. package/dist/helpers/twigWrapper/filters/strings.mjs +79 -0
  71. package/dist/helpers/twigWrapper/filters/types.d.ts +5 -0
  72. package/dist/helpers/twigWrapper/filters/types.mjs +4 -0
  73. package/dist/helpers/twigWrapper/filters/values.d.ts +12 -0
  74. package/dist/helpers/twigWrapper/filters/values.mjs +17 -0
  75. package/dist/helpers/twigWrapper/inspectTemplate.d.ts +5 -0
  76. package/dist/helpers/twigWrapper/inspectTemplate.mjs +39 -20
  77. package/dist/helpers/utils.d.ts +4 -0
  78. package/dist/helpers/utils.mjs +3 -5
  79. package/dist/navigation/index.d.ts +2 -0
  80. package/dist/navigation/index.mjs +2 -1
  81. package/dist/navigation/sitemap.d.ts +16 -0
  82. package/dist/navigation/sitemap.mjs +25 -0
  83. package/dist/network/entitlements.d.ts +101 -0
  84. package/dist/network/entitlements.mjs +4 -0
  85. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.d.ts +31 -0
  86. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.mjs +13 -0
  87. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.d.ts +5 -0
  88. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.mjs +11 -0
  89. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.d.ts +1 -1
  90. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.mjs +1 -1
  91. package/dist/network/graphql/builder/Mutations/index.d.ts +5 -0
  92. package/dist/network/graphql/builder/Mutations/index.mjs +150 -146
  93. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.d.ts +40 -0
  94. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.mjs +24 -0
  95. package/dist/network/graphql/builder/Queries/index.d.ts +3 -0
  96. package/dist/network/graphql/builder/Queries/index.mjs +44 -42
  97. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +3 -1
  98. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
  99. package/dist/network/index.d.ts +1 -0
  100. package/dist/network/index.mjs +9 -8
  101. package/dist/network/spaceEvents.d.ts +20 -1
  102. package/dist/network/spaceEvents.mjs +12 -0
  103. package/dist/project/index.mjs +8 -5
  104. package/dist/project/layout/check.d.ts +22 -0
  105. package/dist/project/layout/check.mjs +60 -0
  106. package/dist/project/{layout.d.ts → layout/codes.d.ts} +3 -66
  107. package/dist/project/layout/codes.mjs +108 -0
  108. package/dist/project/layout/contents.d.ts +10 -0
  109. package/dist/project/layout/contents.mjs +31 -0
  110. package/dist/project/layout/files.d.ts +31 -0
  111. package/dist/project/layout/files.mjs +49 -0
  112. package/dist/project/layout/folders.d.ts +4 -0
  113. package/dist/project/layout/folders.mjs +69 -0
  114. package/dist/project/layout/index.d.ts +16 -0
  115. package/dist/project/layout/index.mjs +5 -0
  116. package/dist/project/layout/plugins.d.ts +46 -0
  117. package/dist/project/layout/plugins.mjs +99 -0
  118. package/dist/project/layout/vendor.d.ts +15 -0
  119. package/dist/project/layout/vendor.mjs +34 -0
  120. package/dist/project/pages/index.d.ts +8 -0
  121. package/dist/project/pages/index.mjs +14 -0
  122. package/dist/project/paths/index.d.ts +52 -4
  123. package/dist/project/paths/index.mjs +2 -2
  124. package/dist/project/root.d.ts +6 -0
  125. package/dist/project/root.mjs +11 -10
  126. package/dist/realtime/client.mjs +104 -91
  127. package/dist/realtime/presence.d.ts +2 -2
  128. package/dist/realtime/presence.mjs +27 -21
  129. package/dist/runs/index.d.ts +73 -0
  130. package/dist/runs/index.mjs +6 -0
  131. package/dist/runs/report.d.ts +56 -0
  132. package/dist/runs/report.mjs +17 -0
  133. package/dist/schema/index.d.ts +6 -0
  134. package/dist/schema/index.mjs +18 -12
  135. package/dist/schema/motion.d.ts +25 -0
  136. package/dist/schema/motion.mjs +47 -19
  137. package/dist/schema/pageAccess.d.ts +6 -0
  138. package/dist/schema/pageAccess.mjs +8 -3
  139. package/dist/schema/pageHead.d.ts +64 -0
  140. package/dist/schema/pageHead.mjs +68 -0
  141. package/dist/schema/providerAnswer.d.ts +17 -0
  142. package/dist/schema/providerAnswer.mjs +4 -0
  143. package/dist/schema/providerWhen.d.ts +36 -0
  144. package/dist/schema/providerWhen.mjs +58 -0
  145. package/dist/schema/schemaSettings.d.ts +14 -0
  146. package/dist/schema/schemaSettings.mjs +4 -0
  147. package/dist/schema/serverElements.d.ts +20 -1
  148. package/dist/schema/serverElements.mjs +41 -28
  149. package/dist/schema/serverInput.d.ts +34 -0
  150. package/dist/schema/serverInput.mjs +60 -0
  151. package/dist/schema/serverQuery.d.ts +47 -0
  152. package/dist/schema/serverQuery.mjs +70 -0
  153. package/dist/server/index.mjs +5 -5
  154. package/dist/server/rsc/refreshRsc.d.ts +6 -2
  155. package/dist/server/rsc/refreshRsc.mjs +75 -59
  156. package/dist/server/rsc/useRscSync.mjs +22 -18
  157. package/dist/source/export.d.ts +1 -1
  158. package/dist/state/runtimeStatePersist.mjs +25 -17
  159. package/dist/store/renderSettings.d.ts +2 -0
  160. package/dist/store/renderSettings.mjs +13 -5
  161. package/dist/store/storeHooks.d.ts +45 -45
  162. package/dist/style/index.mjs +16 -16
  163. package/dist/style/styleConstants.d.ts +12 -2
  164. package/dist/style/styleConstants.mjs +20 -0
  165. package/dist/style/styleStates.d.ts +5 -0
  166. package/dist/style/styleStates.mjs +21 -5
  167. package/dist/types/ActionTypes.d.ts +26 -3
  168. package/dist/types/AuthTypes.d.ts +19 -1
  169. package/dist/types/CommonTypes.d.ts +3 -2
  170. package/dist/types/ElementTypes.d.ts +1 -1
  171. package/dist/types/InteractionTypes.d.ts +10 -1
  172. package/dist/types/JobTypes.d.ts +2 -1
  173. package/dist/types/OAuthTypes.d.ts +246 -0
  174. package/dist/types/OAuthTypes.mjs +0 -0
  175. package/dist/types/PluginTypes.d.ts +2 -0
  176. package/dist/types/PreviewTypes.d.ts +71 -0
  177. package/dist/types/PreviewTypes.mjs +0 -0
  178. package/dist/types/RealtimeTypes.d.ts +11 -0
  179. package/dist/types/SchemaTypes.d.ts +56 -0
  180. package/dist/types/ServerAdapterTypes.d.ts +345 -0
  181. package/dist/types/ServerAdapterTypes.mjs +0 -0
  182. package/dist/types/ServerConfigTypes.d.ts +527 -0
  183. package/dist/types/ServerConfigTypes.mjs +0 -0
  184. package/dist/types/ServerLogTypes.d.ts +119 -0
  185. package/dist/types/ServerLogTypes.mjs +0 -0
  186. package/dist/types/ServerTypes.d.ts +30 -1215
  187. package/dist/types/StoreTypes.d.ts +39 -1
  188. package/dist/types/TestTypes.d.ts +249 -0
  189. package/dist/types/TestTypes.mjs +0 -0
  190. package/dist/types/index.d.ts +6 -0
  191. package/eslint.config.mjs +3 -1
  192. package/package.json +2 -2
  193. package/setupTests.ts +4 -3
  194. package/dist/project/layout.mjs +0 -394
@@ -0,0 +1,68 @@
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
2
+ //#region src/schema/pageHead.ts
3
+ var t = [
4
+ "website",
5
+ "article",
6
+ "profile",
7
+ "book",
8
+ "music.song",
9
+ "music.album",
10
+ "music.playlist",
11
+ "music.radio_station",
12
+ "video.movie",
13
+ "video.episode",
14
+ "video.tv_show",
15
+ "video.other"
16
+ ], n = (e) => typeof e == "string" && t.includes(e), r = /^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/, i = /^\/(?!\/)[^\s"'<>]*$/, a = /^https?:\/\/[^\s"'<>]+$/, o = /^(#[0-9a-fA-F]{3,4}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{8}|(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([^()]*\))$/, s = (e) => i.test(e) || a.test(e), c = (e, t) => i.test(e) && t !== "" ? `${t.replace(/\/$/, "")}${e}` : e, l = (e) => e.replace(/-/g, "_"), u = (t) => {
17
+ let n = [], { siteName: i, language: a, favicon: c, shareImage: l, themeColor: u } = t;
18
+ i !== void 0 && i.trim() === "" && n.push("siteName is empty: leave it out, or name the site."), a !== void 0 && !r.test(a) && n.push(`language "${a}" is no language tag: \`en\`, \`es\`, \`es-MX\`.`);
19
+ for (let [e, t] of [["favicon", c], ["shareImage", l]]) t !== void 0 && !s(t) && n.push(`${e} "${t}" is neither a file of the site nor an address: \`/${e === "favicon" ? "favicon.svg" : "og.png"}\` (in public/), or \`https://…\`.`);
20
+ let d = u === void 0 ? [] : typeof u == "string" ? [["themeColor", u]] : Object.entries(u).map(([e, t]) => [`themeColor.${e}`, t]);
21
+ e(u) && Object.keys(u).some((e) => e !== "light" && e !== "dark") && n.push("themeColor is one colour, or one a scheme: `{ light: \"#ffffff\", dark: \"#09090b\" }`.");
22
+ for (let [e, t] of d) (typeof t != "string" || !o.test(t.trim())) && n.push(`${e} ${JSON.stringify(t)} is no colour a browser reads here: \`#ff6a3d\`, \`oklch(…)\`.`);
23
+ return n;
24
+ }, d = (e) => {
25
+ let t = e.split(/[?#]/)[0] ?? "";
26
+ return {
27
+ svg: "image/svg+xml",
28
+ png: "image/png",
29
+ ico: "image/x-icon",
30
+ webp: "image/webp"
31
+ }[t.slice(t.lastIndexOf(".") + 1).toLowerCase()];
32
+ }, f = "https://cdn.plitzi.com/resources/img/favicon.svg", p = (e, t, n) => {
33
+ let i = /^https?:\/\/[^/]+/.exec(n)?.[0] ?? "", a = e.image ?? t.shareImage, o = a && s(a) ? c(a, i) : void 0, u = [], p = (e, t, n, r) => {
34
+ n !== void 0 && n.trim() !== "" && u.push({
35
+ attribute: e,
36
+ key: t,
37
+ content: n.trim(),
38
+ ...r ? { media: r } : {}
39
+ });
40
+ };
41
+ p("name", "description", e.description), p("name", "robots", e.robots), p("property", "og:type", e.type ?? "website"), p("property", "og:title", e.title), p("property", "og:description", e.description), p("property", "og:site_name", t.siteName), p("property", "og:url", n), p("property", "og:locale", t.language ? l(t.language) : void 0), p("property", "og:image", o), p("property", "og:image:alt", o ? e.imageAlt : void 0), p("name", "twitter:card", o ? "summary_large_image" : "summary"), p("name", "twitter:title", e.title), p("name", "twitter:description", e.description), p("name", "twitter:image", o), p("name", "twitter:image:alt", o ? e.imageAlt : void 0);
42
+ let { themeColor: m } = t;
43
+ typeof m == "string" ? p("name", "theme-color", m) : m && (p("name", "theme-color", m.light, "(prefers-color-scheme: light)"), p("name", "theme-color", m.dark, "(prefers-color-scheme: dark)"));
44
+ let h = t.favicon && s(t.favicon) ? t.favicon : f, g = d(h);
45
+ return {
46
+ meta: u,
47
+ links: [...n === "" ? [] : [{
48
+ rel: "canonical",
49
+ href: n
50
+ }], {
51
+ rel: "icon",
52
+ href: h,
53
+ ...g ? { type: g } : {}
54
+ }],
55
+ ...t.language && r.test(t.language) ? { lang: t.language } : {}
56
+ };
57
+ }, m = (e) => {
58
+ let { siteName: t, language: n, favicon: r, shareImage: i, themeColor: a } = e ?? {};
59
+ return {
60
+ ...typeof t == "string" ? { siteName: t } : {},
61
+ ...typeof n == "string" ? { language: n } : {},
62
+ ...typeof r == "string" ? { favicon: r } : {},
63
+ ...typeof i == "string" ? { shareImage: i } : {},
64
+ ...a === void 0 ? {} : { themeColor: a }
65
+ };
66
+ };
67
+ //#endregion
68
+ export { f as DEFAULT_FAVICON, t as OG_TYPES, c as absoluteAddress, s as isHeadAddress, n as isOgType, p as pageHeadTags, m as spaceIdentity, u as spaceIdentityProblems };
@@ -0,0 +1,17 @@
1
+ /** A provider's answer as it holds it: a connector list's `records`, a detail's `record`, a plain `query`'s `data`. */
2
+ export type ProviderSlice = {
3
+ records?: unknown[];
4
+ record?: unknown;
5
+ data?: unknown;
6
+ };
7
+ /**
8
+ * Whether a provider has nothing to show, for each shape of answer it can hold.
9
+ *
10
+ * A connector list publishes `records`, a detail provider `record`, and a plain `query` the body it received under
11
+ * `data`. Only the first two used to be asked, so a `query` — whose slice has no `records` at all — reported empty
12
+ * whatever it held, and an empty state bound to `isEmpty` showed over a full page.
13
+ *
14
+ * `records` is the list after pagination has accumulated it, which is why it is passed in rather than read here. The
15
+ * page server reads it too, for a provider's `when` that waits on another's answer.
16
+ */
17
+ export declare const isEmptyAnswer: (slice: ProviderSlice, records: unknown[], singleRecord: boolean) => boolean;
@@ -0,0 +1,4 @@
1
+ //#region src/schema/providerAnswer.ts
2
+ var e = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0, t = (t, n, r) => r ? t.record === void 0 : Array.isArray(t.records) ? n.length === 0 : e(t.data);
3
+ //#endregion
4
+ export { t as isEmptyAnswer };
@@ -0,0 +1,36 @@
1
+ import { RuleGroup, RuleValue } from '../helpers/ruleEvaluator';
2
+ import { Element, SSRUser } from '../types';
3
+ /**
4
+ * A provider's `when`: the rule group it waits on before it asks — read the same way by the browser, which waits on it,
5
+ * and by the page server, which resolves a `runtime: 'server'` provider only once its `when` holds. The page server used
6
+ * to resolve every server provider whatever its `when` said (a guest's page resolved what only a signed-in visitor
7
+ * reads), and the browser compared it with the route and query params alone, where authoring writes its fields as
8
+ * sources (`auth.isAuthenticated`, `apiContainer_room.found`).
9
+ */
10
+ /** A rule group as a `when` holds it: a combinator and its rules, each a rule or a group. */
11
+ export declare const isRuleGroup: (value: unknown) => value is RuleGroup;
12
+ /** The element's `when`, when it waits on one: a rule group with a rule in it, switched on. */
13
+ export declare const whenOf: (element: Pick<Element, "attributes">) => RuleGroup | undefined;
14
+ /** Every path a rule group reads: each rule's field, and a value that names another path (`isBinding`). */
15
+ export declare const whenPaths: (group: RuleGroup) => string[];
16
+ /** The paths of a `when` the page server cannot know: what it reads in the browser alone. */
17
+ export declare const whenUnknownToServer: (group: RuleGroup, flat: Record<string, unknown>, serverIds: ReadonlySet<string>) => string[];
18
+ /** The server providers a `when` waits on the answer of, by id. */
19
+ export declare const whenProviders: (group: RuleGroup, serverIds: ReadonlySet<string>) => string[];
20
+ /**
21
+ * A server provider's source as the browser publishes it from the same answer — its own fields and where it stands —
22
+ * so a `when` reading it decides the same on both sides. No answer is a provider that could not be reached.
23
+ */
24
+ export declare const serverProviderSource: (answer: unknown, singleRecord: boolean) => Record<string, RuleValue>;
25
+ /** What the page server reads a `when` against: the visit, the visitor, and the answers of server providers so far. */
26
+ export declare const serverWhenValues: ({ routeParams, queryParams, pageId, user, answers }: {
27
+ routeParams: Record<string, string | undefined>;
28
+ queryParams: Record<string, string>;
29
+ pageId: string;
30
+ user: SSRUser | undefined;
31
+ /** Each server provider resolved before it, by id: its answer and whether it holds one record. */
32
+ answers: Record<string, {
33
+ answer: unknown;
34
+ singleRecord: boolean;
35
+ }>;
36
+ }) => Record<string, RuleValue>;
@@ -0,0 +1,58 @@
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
2
+ import { GLOBAL_SOURCES as t } from "../dataSource/globalSources.mjs";
3
+ import n from "../dataSource/helpers/getSourceName.mjs";
4
+ import { isEmptyAnswer as r } from "./providerAnswer.mjs";
5
+ //#region src/schema/providerWhen.ts
6
+ var i = (t) => e(t) && (t.combinator === "and" || t.combinator === "or") && Array.isArray(t.rules) && t.rules.every((t) => i(t) || e(t) && typeof t.field == "string" && typeof t.operator == "string"), a = (e) => {
7
+ let { when: t } = e.attributes;
8
+ return i(t) && t.rules.length > 0 && t.enabled !== !1 ? t : void 0;
9
+ }, o = (e) => e.rules.flatMap((e) => "rules" in e ? o(e) : [e.field, ...e.isBinding && typeof e.value == "string" ? [e.value] : []]), s = "apiContainer", c = ["navigation", "auth"], l = (e, r, i) => {
10
+ let [a] = e.split(".");
11
+ if (c.includes(a)) return !0;
12
+ if (t.includes(a)) return !1;
13
+ let o = a.indexOf("_"), l = o === -1 ? void 0 : a.slice(o + 1);
14
+ return l !== void 0 && Object.hasOwn(r, l) ? a === n(s, l) && i.has(l) : !e.includes(".");
15
+ }, u = (e, t, n) => [...new Set(o(e).filter((e) => !l(e, t, n)))], d = (e, t) => [...new Set(o(e).flatMap((e) => {
16
+ let [n] = e.split("."), r = n.startsWith(`${s}_`) ? n.slice(s.length + 1) : void 0;
17
+ return r !== void 0 && t.has(r) ? [r] : [];
18
+ }))], f = (t, n) => {
19
+ if (!e(t)) return {
20
+ isLoading: !1,
21
+ isEmpty: !0,
22
+ hasError: !0,
23
+ isStale: !1
24
+ };
25
+ let i = Array.isArray(t.records) ? t.records : [];
26
+ return {
27
+ ...t,
28
+ isLoading: !1,
29
+ isEmpty: r(t, i, n),
30
+ hasError: !1,
31
+ isStale: !1
32
+ };
33
+ }, p = ({ routeParams: e, queryParams: t, pageId: r, user: i, answers: a }) => ({
34
+ ...e,
35
+ ...t,
36
+ navigation: {
37
+ routeParams: e,
38
+ queryParams: t,
39
+ currentPageId: r
40
+ },
41
+ auth: i ? {
42
+ isAuthenticated: !0,
43
+ status: "authenticated",
44
+ details: {
45
+ username: i.username,
46
+ email: i.email,
47
+ roles: i.roles,
48
+ permissions: i.permissions,
49
+ verified: i.verified
50
+ }
51
+ } : {
52
+ isAuthenticated: !1,
53
+ status: "guest"
54
+ },
55
+ ...Object.fromEntries(Object.entries(a).map(([e, { answer: t, singleRecord: r }]) => [n(s, e), f(t, r)]))
56
+ });
57
+ //#endregion
58
+ export { i as isRuleGroup, f as serverProviderSource, p as serverWhenValues, a as whenOf, o as whenPaths, d as whenProviders, u as whenUnknownToServer };
@@ -0,0 +1,14 @@
1
+ import { Schema } from '../types';
2
+ /**
3
+ * Every setting a space can carry, which `schemaSettings.test.ts` holds to the `Schema['settings']` type — what the
4
+ * builder writes (`SCHEMA_UPDATE_SETTINGS`) and the reader of a space keeps. A key outside it is one nothing reads any
5
+ * more — `head`, from before a space declared its fonts.
6
+ */
7
+ export declare const SCHEMA_SETTINGS: readonly ["keepState", "stateStorage", "transientState", "keptState", "paintedState", "robotsTxt", "blockAiCrawlers", "viewTransitions", "siteName", "language", "favicon", "shareImage", "themeColor", "customCss", "withheldPage", "visitorRoles", "userProvider", "tokenStorage", "loginUrl", "userUrl", "refreshUrl", "logoutUrl", "revokeUrl", "detailsPath", "tokenPath", "refreshTokenPath", "expirationTimePath", "refreshExpirationTimePath", "sessionHintCookie", "sessionExchangeUrl", "mfaUrl", "sessionGate", "sessionRevalidateSeconds", "debugMode", "computed", "channels"];
8
+ /** Whether a key is a setting a space may carry: one the builder may write, though the space has no value for it yet. */
9
+ export declare const isSchemaSetting: (key: string) => key is (typeof SCHEMA_SETTINGS)[number];
10
+ /**
11
+ * What one setting holds — text, a number, a flag, a list of keys, the visitors' roles, a colour a scheme — or nothing,
12
+ * to leave it out: what the builder writes one with.
13
+ */
14
+ export type SchemaSettingValue = Schema['settings'][keyof Schema['settings']] | undefined;
@@ -0,0 +1,4 @@
1
+ //#region src/schema/schemaSettings.ts
2
+ var e = /* @__PURE__ */ "keepState.stateStorage.transientState.keptState.paintedState.robotsTxt.blockAiCrawlers.viewTransitions.siteName.language.favicon.shareImage.themeColor.customCss.withheldPage.visitorRoles.userProvider.tokenStorage.loginUrl.userUrl.refreshUrl.logoutUrl.revokeUrl.detailsPath.tokenPath.refreshTokenPath.expirationTimePath.refreshExpirationTimePath.sessionHintCookie.sessionExchangeUrl.mfaUrl.sessionGate.sessionRevalidateSeconds.debugMode.computed.channels".split("."), t = new Set(e), n = (e) => t.has(e);
3
+ //#endregion
4
+ export { e as SCHEMA_SETTINGS, n as isSchemaSetting };
@@ -15,12 +15,15 @@ import { Element, Schema } from '../types';
15
15
  * — so a server element that lives in one is on this page as far as the visitor can tell. Walked from the page alone,
16
16
  * a provider in the dashboard's sidebar was never resolved: the payload came back empty, the element rendered with
17
17
  * nothing, and no layer reported it.
18
+ *
19
+ * A page withheld from its visitor holds nothing of its own; the page the space draws in its place
20
+ * (`settings.withheldPage`) is walked instead, as its body.
18
21
  */
19
22
  /**
20
23
  * Given the flags as they resolved, an element gated off by one is skipped with its whole subtree — it will not be
21
24
  * rendered, so nothing in it wants data, and resolving it would put a feature that is off into the payload anyway.
22
25
  */
23
- export declare const collectServerElements: (schema: Pick<Schema, "flat">, pageId: string | undefined, ids?: string[], flags?: Record<string, boolean>) => Element[];
26
+ export declare const collectServerElements: (schema: Pick<Schema, "flat"> & Partial<Pick<Schema, "pages" | "settings">>, pageId: string | undefined, ids?: string[], flags?: Record<string, boolean>) => Element[];
24
27
  /** Whether anything on this page consumes server data at all — the question both RSC gates actually ask. */
25
28
  export declare const hasServerElements: (schema: Schema, pageId: string | undefined, flags?: Record<string, boolean>) => boolean;
26
29
  /** Where the visitor is: what a template on the server reads beside the page's data, as `navigation`. */
@@ -55,3 +58,19 @@ export declare const pageSeoText: (value: unknown, context: Record<string, unkno
55
58
  * `true` counts, as for a provider's.
56
59
  */
57
60
  export declare const pageNotFound: (template: unknown, context: Record<string, unknown>) => boolean;
61
+ /**
62
+ * A page's JSON-LD as the head carries it: each object, its text templates evaluated against `pageServerContext` as the
63
+ * title's are — a detail page says the record it shows (`name: '{{ apiContainer_boxer.name }}'`). A field whose
64
+ * template does not evaluate is left out, never written with its braces.
65
+ */
66
+ export declare const pageStructuredData: (value: unknown, context: Record<string, unknown>) => Record<string, unknown>[];
67
+ /** JSON in a script tag, so no value of it closes the tag: `<` is written as its escape, which JSON reads the same. */
68
+ export declare const jsonForScript: (value: unknown) => string;
69
+ /**
70
+ * A server element that failed, as the page server says it while developing (`devMode`): why, where the page reads it.
71
+ * Without it the provider said only "could not be reached" — a run's session action with no `render` trigger, whose
72
+ * `forbidden` was in a log no agent read. A deployment says nothing of it to a visitor: the element is left out.
73
+ */
74
+ export declare const RSC_FAILURE = "$failed";
75
+ /** Why a server element failed, when the page server said it — or nothing. */
76
+ export declare const rscFailureOf: (data: unknown) => string | undefined;
@@ -1,35 +1,48 @@
1
- import { processTwigValue as e } from "../helpers/twigWrapper/processTwig/processTwig.mjs";
2
- import t from "../dataSource/helpers/getSourceName.mjs";
3
- import { passesFlagGate as n } from "../flags/resolveFlags.mjs";
4
- import { resolveLayoutChain as r } from "./layoutChain.mjs";
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
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";
5
7
  //#region src/schema/serverElements.ts
6
- var i = (e, t, i, a) => {
8
+ var s = (e, t, n, s) => {
7
9
  if (t === void 0) return [];
8
- let o = i ? new Set(i) : void 0, s = [], c = /* @__PURE__ */ new Set(), l = e.flat[t], u = (e) => typeof e == "string" ? e : "", d = [t, ...l ? r((t) => e.flat[t], u(l.attributes.layout), u(l.attributes.layoutContainer)).map((e) => e.layout) : []];
9
- for (; d.length > 0;) {
10
- let t = d.pop();
11
- if (t === void 0 || c.has(t)) continue;
12
- c.add(t);
13
- let r = e.flat[t];
14
- if (!r || a && !n(r.definition.flag, a)) continue;
15
- r.definition.runtime === "server" && (!o || o.has(r.id)) && s.push(r);
16
- let { items: i } = r.definition;
17
- i && d.push(...i);
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);
18
24
  }
19
- return s;
20
- }, a = (e, t, n) => i(e, t, void 0, n).length > 0, o = (t, n, r) => t.find((t) => {
21
- let i = t.attributes.notFound;
22
- return typeof i == "string" && i !== "" && Object.hasOwn(n, t.id) && e(i, {
23
- source: n[t.id],
25
+ return l;
26
+ }, c = (e, t, n) => s(e, t, void 0, n).length > 0, l = (e, n, r) => e.find((e) => {
27
+ let i = e.attributes.notFound;
28
+ return typeof i == "string" && i !== "" && Object.hasOwn(n, e.id) && t(i, {
29
+ source: n[e.id],
24
30
  navigation: r
25
31
  }) === !0;
26
- })?.id, s = (e, n, r) => ({
27
- ...Object.fromEntries(e.filter((e) => Object.hasOwn(n, e.id)).map((e) => [t(e.definition.type, e.id), n[e.id]])),
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]])),
28
34
  navigation: r
29
- }), c = /\{[{%]/, l = (t, n) => {
30
- if (typeof t != "string") return;
31
- let r = c.test(t) ? e(t, n) : t, i = typeof r == "string" || typeof r == "number" ? String(r).trim() : "";
32
- return i === "" || c.test(i) ? void 0 : i;
33
- }, u = (t, n) => typeof t == "string" && t !== "" && e(t, n) === !0;
35
+ }), d = /\{[{%]/, f = (e, n) => {
36
+ 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;
44
+ }
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;
34
47
  //#endregion
35
- export { i as collectServerElements, a as hasServerElements, o as notFoundProvider, u as pageNotFound, l as pageSeoText, s as pageServerContext };
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 };
@@ -0,0 +1,34 @@
1
+ import { Element } from '../types';
2
+ /** The address a server provider is rendered at: what both the page server and the browser know of the page. */
3
+ export interface ProviderAddress {
4
+ routeParams: Record<string, string | string[] | undefined>;
5
+ queryParams: Record<string, string | string[] | undefined>;
6
+ }
7
+ /**
8
+ * The server providers a provider's bound `input` reads the answer of, by id — what the page server resolves before
9
+ * it, as it does a `when`'s: a room's crate bound its person to another provider's answer, and was asked with none.
10
+ */
11
+ export declare const inputProviders: (element: Pick<Element, "definition">, serverIds: ReadonlySet<string>) => string[];
12
+ /**
13
+ * The input a server provider is resolved with on the page server: the one it was saved with, and each binding of its
14
+ * `input` the server reads applied — the address (`navigation.routeParams.slug`), and the answers of the server
15
+ * providers before it (`providers`, by source name, as the browser publishes them: `serverProviderSource`). A binding
16
+ * on the visitor's state stays the browser's to ask again with. A conversation's provider bound `{ with:
17
+ * routeParams.username }` was resolved with no `with` on every load, refused, and logged with a stack.
18
+ *
19
+ * The browser compares what it asks with this same input, so the first paint is never asked for twice.
20
+ */
21
+ export declare const serverInputOf: (element: Pick<Element, "attributes" | "definition"> | undefined, address: ProviderAddress, providers?: Readonly<Record<string, unknown>>) => unknown;
22
+ /**
23
+ * Each binding of a provider's `input` as the page server read it — `input.with ← apiContainer_room.data.owner:
24
+ * "dax"` — or why it did not: the visitor's state, a `when`, a provider with no answer. What a refusal of the input
25
+ * is told beside it: a run's provider was refused `invalid_input` on every load, and only the server's stack said the
26
+ * field it was bound to came empty.
27
+ */
28
+ export declare const inputReadings: (element: Pick<Element, "attributes" | "definition">, address: ProviderAddress, providers?: Readonly<Record<string, unknown>>) => string[];
29
+ /**
30
+ * The input the page server resolved a provider with, as the browser works it out from what it was sent: the element
31
+ * as saved, the page's elements (`flat`) and the server's payload (`rsc.data`) — each read as it is, since a render
32
+ * with no schema or no payload in its store (a widget, a test) has none. What `useInputRefresh` compares against.
33
+ */
34
+ export declare const browserServerInput: (element: Pick<Element, "attributes" | "definition"> | undefined, flat: unknown, payload: unknown, address: ProviderAddress) => unknown;
@@ -0,0 +1,60 @@
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
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
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
+ let n = (e) => {
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;
12
+ };
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 = {}) => {
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,
19
+ navigation: t
20
+ }, {
21
+ attributes: e.attributes,
22
+ definition: {
23
+ ...e.definition,
24
+ bindings: { attributes: i }
25
+ }
26
+ }).attributes.input;
27
+ }, m = (e) => {
28
+ if (e == null || e === "") return "empty";
29
+ let t = JSON.stringify(e);
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)));
33
+ return (e.definition.bindings?.attributes ?? []).filter((e) => e.enabled !== !1 && u(e)).map((o) => {
34
+ let u = `${o.to} ← ${o.source}`;
35
+ if (i.has(o)) {
36
+ let i = n({
37
+ ...r,
38
+ navigation: t
39
+ }, {
40
+ attributes: e.attributes,
41
+ definition: {
42
+ ...e.definition,
43
+ bindings: { attributes: [o] }
44
+ }
45
+ });
46
+ return `${u}: ${m(a(i.attributes, o.to))}`;
47
+ }
48
+ let d = l(o).map(c).find((e) => e.startsWith(`${s}_`) && !Object.hasOwn(r, e));
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
+ });
51
+ }, g = (t, n, a, o) => {
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;
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))])));
58
+ };
59
+ //#endregion
60
+ export { g as browserServerInput, f as inputProviders, h as inputReadings, p as serverInputOf };
@@ -0,0 +1,47 @@
1
+ import { Element } from '../types';
2
+ /**
3
+ * What the page server reads a `runtime: 'server'` provider's `query` as — one rule for the server that reads it and
4
+ * for authoring, which refuses what it cannot read.
5
+ *
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.
8
+ * - `unresolved`: what only the browser can ask — said with why, never left to resolve to nothing.
9
+ */
10
+ export type ServerQuery = {
11
+ kind: 'path';
12
+ path: string;
13
+ } | {
14
+ kind: 'url';
15
+ url: URL;
16
+ headers: Record<string, string>;
17
+ } | {
18
+ kind: 'unresolved';
19
+ why: string;
20
+ };
21
+ /**
22
+ * 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`).
24
+ */
25
+ export type ServerTemplateData = {
26
+ variables: Readonly<Record<string, unknown>>;
27
+ routeParams: Readonly<Record<string, string | undefined>>;
28
+ queryParams: Readonly<Record<string, string>>;
29
+ origin: string;
30
+ };
31
+ type Provider = Pick<Element, 'attributes' | 'definition'>;
32
+ /**
33
+ * 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`).
36
+ *
37
+ * A template may read the space's variables and `navigation` — what the page server knows of a visit. A route or
38
+ * query param is read as `navigation.routeParams.x`: written bare (`{{ x }}`) it cannot be told from a state or a
39
+ * provider's name before the visit.
40
+ */
41
+ export declare const serverQueryProblem: (element: Provider, variableNames: ReadonlySet<string>) => string | undefined;
42
+ /**
43
+ * A provider's `query` as the page server reads it on a visit — its template filled in with what the server knows of
44
+ * it, as the browser would have filled it in; `undefined` for a provider with no query at all.
45
+ */
46
+ export declare const serverQueryOf: (element: Provider, data: ServerTemplateData) => ServerQuery | undefined;
47
+ export {};
@@ -0,0 +1,70 @@
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 = [
5
+ "query",
6
+ "headers",
7
+ "accessToken",
8
+ "method",
9
+ "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)) : [];
18
+ });
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) => {
23
+ if (e.startsWith("//")) return {
24
+ kind: "unresolved",
25
+ why: `"${e}" names no protocol — write https:`
26
+ };
27
+ if (e.startsWith("/")) return {
28
+ kind: "path",
29
+ path: e
30
+ };
31
+ let n;
32
+ try {
33
+ n = new URL(e);
34
+ } catch {
35
+ return {
36
+ kind: "unresolved",
37
+ why: `"${e}" is neither an address (https://…) nor a path of the space (/…)`
38
+ };
39
+ }
40
+ return n.protocol !== "https:" && n.protocol !== "http:" ? {
41
+ kind: "unresolved",
42
+ why: `"${e}" is read with ${n.protocol}, and the page server reads http(s) alone`
43
+ } : {
44
+ kind: "url",
45
+ url: n,
46
+ headers: t
47
+ };
48
+ }, s = (t, n) => {
49
+ let { query: r, headers: s, accessToken: c } = t.attributes;
50
+ if (typeof r != "string" || r === "") return;
51
+ let l = a(t, new Set(Object.keys(n.variables)));
52
+ if (l !== void 0) return {
53
+ kind: "unresolved",
54
+ why: l
55
+ };
56
+ let u = {
57
+ ...n.variables,
58
+ navigation: {
59
+ routeParams: n.routeParams,
60
+ queryParams: n.queryParams,
61
+ origin: n.origin
62
+ }
63
+ }, d = (t) => {
64
+ let n = e(t, u);
65
+ 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);
68
+ };
69
+ //#endregion
70
+ export { s as serverQueryOf, a as serverQueryProblem };
@@ -1,8 +1,8 @@
1
1
  import e from "./actions/useActionsSync.mjs";
2
2
  import t from "./actions/useImagesSync.mjs";
3
3
  import n from "./actions/useRealtimeSync.mjs";
4
- import r, { cancelRsc as i, currentRscLocation as a, releaseRscRequests as o, rscDataPath as s } from "./rsc/refreshRsc.mjs";
5
- import c from "./rsc/useRscRefresh.mjs";
6
- import l from "./rsc/useRscSync.mjs";
7
- import u from "./usePluginRoute.mjs";
8
- export { i as cancelRsc, a as currentRscLocation, r as refreshRsc, o as releaseRscRequests, s as rscDataPath, e as useActionsSync, t as useImagesSync, u as usePluginRoute, n as useRealtimeSync, c as useRscRefresh, l as useRscSync };
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 };
@@ -3,6 +3,8 @@ import { PathOf, StoreApi } from '@plitzi/nexus';
3
3
  export declare const rscDataPath: (id: string) => PathOf<CommonState>;
4
4
  /** Where the visitor is, spelled the way the server reads it back. */
5
5
  export declare const currentRscLocation: () => string;
6
+ /** Held by `useRscSync` as it renders — before any element below it can refresh — and let go with its requests. */
7
+ export declare const holdRscRoot: (instance: string, store: StoreApi<CommonState>) => void;
6
8
  /**
7
9
  * Stops what a refresh in flight is asking the server for — the request, and the work behind it on the server — and
8
10
  * leaves the payload as it is.
@@ -13,6 +15,8 @@ export declare const currentRscLocation: () => string;
13
15
  export declare const cancelRsc: (store: StoreApi<CommonState>, ids?: readonly string[]) => void;
14
16
  /** Every refresh of this root aborted and forgotten — the SDK root that owned them is going away. */
15
17
  export declare const releaseRscRequests: (instance: string) => void;
18
+ /** Each element of a payload the page server could not resolve, kept with why — its first failure, not overwritten. */
19
+ export declare const noteRscFailures: (store: StoreApi<CommonState>, serverData: Record<string, unknown>) => void;
16
20
  export type RscRefreshOptions = {
17
21
  /**
18
22
  * Resolve for somewhere the visitor is not yet.
@@ -37,7 +41,7 @@ export type RscRefreshOptions = {
37
41
  *
38
42
  * Plain function over a store rather than a context method: the payload lives in `rsc.data`, so every caller already
39
43
  * has what it needs through the store it can reach, and an element buried under any number of scopes writes to the
40
- * root by delegation (nothing but the root owns `rsc`).
44
+ * root its token names (nothing but the root owns `rsc`).
41
45
  *
42
46
  * Pass `requestedIds` to refresh only those elements — the response is merged over the existing payload; of them,
43
47
  * only the ones the server resolves at that location are asked for, and none is no request. Omit them for a full
@@ -49,5 +53,5 @@ export type RscRefreshOptions = {
49
53
  * again, an element asked for again — is aborted, here and on the server. Before this a click on a link asked twice
50
54
  * (its prefetch, then the route change), and a slow answer could land over a newer one.
51
55
  */
52
- export declare const refreshRsc: (store: StoreApi<CommonState>, requestedIds?: string[], params?: Record<string, string>, { location, fresh }?: RscRefreshOptions) => Promise<void>;
56
+ export declare const refreshRsc: (from: StoreApi<CommonState>, requestedIds?: string[], params?: Record<string, string>, { location, fresh }?: RscRefreshOptions) => Promise<void>;
53
57
  export default refreshRsc;