@plitzi/sdk-shared 0.37.8 → 0.37.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +817 -0
- package/dist/actions/functions.d.ts +12 -3
- package/dist/actions/functions.mjs +8 -5
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/index.mjs +6 -6
- package/dist/actions/triggerParams.mjs +7 -6
- package/dist/actions/validateDocument.d.ts +3 -0
- package/dist/actions/validateDocument.mjs +89 -88
- package/dist/auth/failureChannel.d.ts +8 -2
- package/dist/auth/failureChannel.mjs +1 -3
- package/dist/authoring/elementCallbacks.d.ts +65 -0
- package/dist/authoring/elementCallbacks.mjs +72 -8
- package/dist/authoring/index.mjs +3 -3
- package/dist/builder/contexts/BuilderContext.d.ts +18 -7
- package/dist/builder/contexts/BuilderContext.mjs +2 -3
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.mjs +2 -2
- package/dist/connectors/validateManifest.d.ts +3 -0
- package/dist/connectors/validateManifest.mjs +77 -76
- package/dist/dataSource/computed.mjs +25 -29
- package/dist/dataSource/globalSources.d.ts +15 -0
- package/dist/dataSource/globalSources.mjs +13 -0
- package/dist/dataSource/index.d.ts +2 -0
- package/dist/dataSource/index.mjs +8 -7
- package/dist/devTools/DevToolsContext.mjs +2 -3
- package/dist/devTools/utils/PlitziConsole.d.ts +9 -0
- package/dist/devTools/utils/PlitziConsole.mjs +27 -7
- package/dist/elements/ComponentContext.mjs +2 -3
- package/dist/flags/flagsCookie.d.ts +26 -0
- package/dist/flags/flagsCookie.mjs +20 -0
- package/dist/flags/index.d.ts +3 -0
- package/dist/flags/index.mjs +4 -0
- package/dist/flags/resolveFlags.d.ts +60 -0
- package/dist/flags/resolveFlags.mjs +38 -0
- package/dist/flags/schemaFlag.d.ts +11 -0
- package/dist/flags/schemaFlag.mjs +9 -0
- package/dist/flags/useFlagResolution.d.ts +13 -0
- package/dist/flags/useFlagResolution.mjs +43 -0
- package/dist/helpers/eventTarget.d.ts +10 -0
- package/dist/helpers/eventTarget.mjs +4 -0
- package/dist/helpers/images.d.ts +18 -0
- package/dist/helpers/images.mjs +13 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.mjs +21 -18
- package/dist/helpers/interval.d.ts +18 -0
- package/dist/helpers/interval.mjs +7 -0
- package/dist/helpers/isRecord.d.ts +2 -0
- package/dist/helpers/isRecord.mjs +4 -0
- package/dist/helpers/scroll.d.ts +42 -0
- package/dist/helpers/scroll.mjs +30 -0
- package/dist/helpers/sharedContext.d.ts +14 -0
- package/dist/helpers/sharedContext.mjs +9 -0
- package/dist/helpers/twigWrapper/Evaluator/Evaluator.d.ts +9 -1
- package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +13 -8
- package/dist/helpers/twigWrapper/Evaluator/index.d.ts +1 -1
- package/dist/helpers/twigWrapper/TemplateCache/TemplateCache.mjs +1 -1
- package/dist/helpers/twigWrapper/filters/filters.mjs +38 -2
- package/dist/helpers/twigWrapper/index.d.ts +1 -0
- package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +2 -1
- package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +3 -3
- package/dist/helpers/utils.mjs +4 -2
- package/dist/history/describe.mjs +4 -1
- package/dist/history/diff.d.ts +1 -1
- package/dist/history/diff.mjs +11 -9
- package/dist/history/types.d.ts +1 -1
- package/dist/hooks/index.mjs +5 -5
- package/dist/hooks/usePlitziServiceContext.d.ts +1 -2
- package/dist/hooks/usePlitziServiceContext.mjs +3 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +90 -77
- package/dist/navigation/routes.mjs +6 -4
- package/dist/network/NetworkContext.mjs +2 -3
- package/dist/network/NetworkInternalContext.d.ts +2 -4
- package/dist/network/NetworkInternalContext.mjs +2 -3
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.d.ts +12 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.d.ts +3 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/index.d.ts +13 -30
- package/dist/network/graphql/builder/Mutations/index.mjs +164 -200
- package/dist/network/graphql/builder/Queries/InitQuery.d.ts +4 -3
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.d.ts +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.d.ts +16 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.d.ts +7 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.mjs +4 -0
- package/dist/network/graphql/builder/Queries/index.d.ts +3 -5
- package/dist/network/graphql/builder/Queries/index.mjs +36 -38
- package/dist/network/graphql/builder/Subscriptions/SpaceEventSubscription.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +2 -3
- package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/sdk/Queries/index.d.ts +0 -4
- package/dist/network/graphql/sdk/Queries/index.mjs +2 -8
- package/dist/network/index.mjs +8 -7
- package/dist/network/spaceEvents.d.ts +25 -195
- package/dist/network/spaceEvents.mjs +156 -241
- package/dist/realtime/client.mjs +123 -95
- package/dist/realtime/topics.mjs +18 -17
- package/dist/schema/SchemaContext.mjs +2 -3
- package/dist/schema/anchor.d.ts +8 -0
- package/dist/schema/anchor.mjs +4 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.mjs +6 -4
- package/dist/schema/schemaConstants.d.ts +2 -0
- package/dist/schema/schemaConstants.mjs +4 -3
- package/dist/schema/serverElements.d.ts +6 -2
- package/dist/schema/serverElements.mjs +17 -16
- package/dist/schema/snippet.d.ts +7 -0
- package/dist/schema/snippet.mjs +9 -0
- package/dist/schema/wire.d.ts +11 -0
- package/dist/schema/wire.mjs +27 -0
- package/dist/server/actions/useImagesSync.d.ts +9 -0
- package/dist/server/actions/useImagesSync.mjs +7 -0
- package/dist/server/rsc/refreshRsc.d.ts +3 -1
- package/dist/server/rsc/refreshRsc.mjs +17 -16
- package/dist/source/export.d.ts +107 -0
- package/dist/source/export.mjs +4 -0
- package/dist/source/index.d.ts +4 -0
- package/dist/source/index.mjs +3 -0
- package/dist/source/snapshot.d.ts +51 -0
- package/dist/source/snapshot.mjs +81 -0
- package/dist/state/paintedState.mjs +13 -12
- package/dist/state/runtimeStatePersist.mjs +50 -49
- package/dist/store/index.d.ts +45 -45
- package/dist/store/renderSettings.d.ts +1 -0
- package/dist/store/renderSettings.mjs +9 -5
- package/dist/style/breakpoints.d.ts +11 -0
- package/dist/style/breakpoints.mjs +8 -0
- package/dist/style/displayModes.d.ts +5 -0
- package/dist/style/displayModes.mjs +8 -0
- package/dist/style/fontValidation.mjs +52 -51
- package/dist/style/fonts.d.ts +0 -12
- package/dist/style/fonts.mjs +11 -11
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.mjs +11 -7
- package/dist/style/layoutGrid.d.ts +30 -0
- package/dist/style/layoutGrid.mjs +33 -0
- package/dist/style/notifications.d.ts +52 -0
- package/dist/style/notifications.mjs +55 -0
- package/dist/style/snippetStyle.d.ts +23 -0
- package/dist/style/snippetStyle.mjs +32 -0
- package/dist/style/styleConstants.d.ts +7 -2
- package/dist/style/styleConstants.mjs +10 -0
- package/dist/style/styleStates.d.ts +11 -2
- package/dist/style/styleStates.mjs +12 -9
- package/dist/theme/ThemeProvider.mjs +20 -20
- package/dist/theme/ThemeScope.mjs +4 -3
- package/dist/types/ActionTypes.d.ts +5 -0
- package/dist/types/CommonTypes.d.ts +3 -0
- package/dist/types/DevToolsTypes.d.ts +29 -4
- package/dist/types/ElementTypes.d.ts +6 -5
- package/dist/types/EventBridgeTypes.d.ts +2 -2
- package/dist/types/FunctionTypes.d.ts +13 -0
- package/dist/types/InteractionTypes.d.ts +5 -0
- package/dist/types/PluginTypes.d.ts +1 -1
- package/dist/types/ResourceTypes.d.ts +2 -2
- package/dist/types/SchemaTypes.d.ts +100 -3
- package/dist/types/SdkTypes.d.ts +0 -2
- package/dist/types/ServerTypes.d.ts +47 -0
- package/dist/types/SnippetTypes.d.ts +28 -0
- package/dist/types/SpaceTypes.d.ts +36 -0
- package/dist/types/StoreTypes.d.ts +39 -3
- package/dist/types/StyleTypes.d.ts +1 -1
- package/dist/types/index.d.ts +1 -2
- package/package.json +143 -138
- package/tailwind.config.js +1 -6
- package/vite.config.ts +16 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddMutation.d.ts +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddTemplateMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddTemplateMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentPublishMutation.d.ts +0 -8
- package/dist/network/graphql/builder/Mutations/Segment/SegmentPublishMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentRemoveMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/SegmentRemoveMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentUpdateMutation.d.ts +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentUpdateMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentAddElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentAddElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentCloneElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentCloneElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentMoveElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentMoveElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRemoveElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRemoveElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRenameElementMutation.d.ts +0 -3
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRenameElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementsMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementsMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceAddVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceAddVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceRemoveVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceRemoveVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceUpdateVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceUpdateVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleAddSelectorVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleAddSelectorVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleRemoveSelectorVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleRemoveSelectorVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleUpdateSelectorVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleUpdateSelectorVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleAddSelectorMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleAddSelectorMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorsMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorsMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleUpdateSelectorMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleUpdateSelectorMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleAddVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleAddVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleRemoveVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleRemoveVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleUpdateVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleUpdateVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.mjs +0 -4
- package/dist/network/graphql/builder/Queries/Segment/SegmentQuery.d.ts +0 -6
- package/dist/network/graphql/builder/Queries/Segment/SegmentQuery.mjs +0 -4
- package/dist/network/graphql/builder/Queries/Segment/SegmentsQuery.d.ts +0 -9
- package/dist/network/graphql/builder/Queries/Segment/SegmentsQuery.mjs +0 -4
- package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.d.ts +0 -6
- package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.mjs +0 -4
- package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.d.ts +0 -9
- package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.mjs +0 -4
- package/dist/segments/SegmentsContext.d.ts +0 -2
- package/dist/segments/SegmentsContext.mjs +0 -6
- package/dist/segments/index.d.ts +0 -3
- package/dist/segments/index.mjs +0 -2
- package/dist/types/SegmentTypes.d.ts +0 -41
- package/dist/types/TemplateTypes.d.ts +0 -20
- package/dist/types/TemplateTypes.mjs +0 -0
- /package/dist/types/{SegmentTypes.mjs → SnippetTypes.mjs} +0 -0
package/dist/realtime/client.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { pConsole as e } from "../devTools/utils/PlitziConsole.mjs";
|
|
1
2
|
import "./topics.mjs";
|
|
2
3
|
//#region src/realtime/client.ts
|
|
3
|
-
var
|
|
4
|
+
var t = 30, n = [
|
|
4
5
|
500,
|
|
5
6
|
1e3,
|
|
6
7
|
2e3,
|
|
7
8
|
5e3,
|
|
8
9
|
1e4
|
|
9
|
-
],
|
|
10
|
+
], r = 5e3, i = (e) => typeof e == "object" && !!e && "connection" in e && typeof e.connection == "string" && "refused" in e && Array.isArray(e.refused), a = (e) => typeof e == "object" && !!e && "topic" in e && typeof e.topic == "string" && "type" in e && typeof e.type == "string", o = (e) => typeof e == "object" && !!e && "id" in e && typeof e.id == "number" && "ok" in e && typeof e.ok == "boolean", s = (e) => {
|
|
10
11
|
let t = "message", n = [];
|
|
11
12
|
for (let r of e.split("\n")) r.startsWith("event: ") ? t = r.slice(7) : r.startsWith("data: ") && n.push(r.slice(6));
|
|
12
13
|
if (n.length) try {
|
|
@@ -17,7 +18,7 @@ var e = 30, t = [
|
|
|
17
18
|
} catch {
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
|
-
},
|
|
21
|
+
}, c = (e) => {
|
|
21
22
|
try {
|
|
22
23
|
let t = JSON.parse(String(e));
|
|
23
24
|
return typeof t == "object" && t && "event" in t && typeof t.event == "string" ? {
|
|
@@ -27,166 +28,193 @@ var e = 30, t = [
|
|
|
27
28
|
} catch {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
},
|
|
31
|
+
}, l = (e, t) => {
|
|
31
32
|
let n = new URL(`${e}?${t}`, globalThis.location.href);
|
|
32
33
|
return n.protocol = n.protocol === "https:" ? "wss:" : "ws:", n.href;
|
|
33
|
-
},
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
}, u = (e, { transport: u = "sse", fetchImpl: f = fetch, WebSocketImpl: p = globalThis.WebSocket } = {}) => {
|
|
35
|
+
let m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), _ = "idle", v, y = /* @__PURE__ */ new Map(), b, x, S = 0, C = u === "websocket" && typeof p == "function", w = () => [...m.keys()].sort().join(","), T = (e) => {
|
|
36
|
+
_ = e;
|
|
37
|
+
let t = w().split(",").filter(Boolean), n = v?.transport ?? (C ? "websocket" : "sse");
|
|
38
|
+
d(e === "open" ? "success" : e === "closed" ? "warning" : "info", `${e} · ${t.join(", ") || "no topics"}`, {
|
|
39
|
+
event: "status",
|
|
40
|
+
status: e,
|
|
41
|
+
topics: t,
|
|
42
|
+
transport: n
|
|
43
|
+
}), g.forEach((t) => t(e));
|
|
39
44
|
}, E = (e) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
for (let [t, n] of e) y.set(t, n), d("danger", `${t} refused: ${n}`, {
|
|
46
|
+
event: "refused",
|
|
47
|
+
topic: t,
|
|
48
|
+
reason: n
|
|
49
|
+
});
|
|
50
|
+
}, D = (e) => {
|
|
51
|
+
let t = e.split(",").flatMap((e) => h.get(e) ?? []);
|
|
52
|
+
return `topics=${encodeURIComponent(e)}${t.length ? `&grants=${encodeURIComponent(t.join(","))}` : ""}`;
|
|
43
53
|
}, O = (e) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
e.type === "$revoked" && e.from === "server" && E([[e.topic, "revoked"]]), d("info", `${e.topic} ← ${e.type}`, {
|
|
55
|
+
event: "received",
|
|
56
|
+
message: e
|
|
57
|
+
}), m.get(e.topic)?.forEach((t) => t(e));
|
|
48
58
|
}, k = (e, t) => {
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
e.me = t.connection, y = /* @__PURE__ */ new Map(), E(t.refused.map((e) => [e.topic, e.reason])), S = 0, T("open");
|
|
60
|
+
}, A = (e) => {
|
|
61
|
+
if (v !== e) return;
|
|
62
|
+
T("connecting");
|
|
63
|
+
let t = n[Math.min(S, n.length - 1)];
|
|
64
|
+
S += 1, x = setTimeout(N, t);
|
|
65
|
+
}, j = (t, n) => {
|
|
66
|
+
let r = new AbortController(), o, c = {
|
|
67
|
+
topics: t,
|
|
51
68
|
transport: "sse",
|
|
52
|
-
close: () =>
|
|
53
|
-
publish: async (
|
|
54
|
-
if (!
|
|
55
|
-
let
|
|
69
|
+
close: () => r.abort(),
|
|
70
|
+
publish: async (t, n, r) => {
|
|
71
|
+
if (!o) return !1;
|
|
72
|
+
let i = await f(e, {
|
|
56
73
|
method: "POST",
|
|
57
74
|
headers: { "content-type": "application/json" },
|
|
58
75
|
credentials: "same-origin",
|
|
59
76
|
body: JSON.stringify({
|
|
60
|
-
token:
|
|
61
|
-
topic:
|
|
62
|
-
type:
|
|
63
|
-
data:
|
|
77
|
+
token: o,
|
|
78
|
+
topic: t,
|
|
79
|
+
type: n,
|
|
80
|
+
data: r
|
|
64
81
|
})
|
|
65
82
|
}).catch(() => void 0);
|
|
66
|
-
return
|
|
83
|
+
return i?.status === 401 && v === c && N(), i?.ok ?? !1;
|
|
67
84
|
}
|
|
68
|
-
},
|
|
85
|
+
}, l = async (e) => {
|
|
69
86
|
let t = e.body?.getReader();
|
|
70
87
|
if (!t) return;
|
|
71
|
-
let n = new TextDecoder(),
|
|
88
|
+
let n = new TextDecoder(), r = "";
|
|
72
89
|
for (;;) {
|
|
73
90
|
let { done: e, value: l } = await t.read();
|
|
74
91
|
if (e) return;
|
|
75
|
-
|
|
76
|
-
let u =
|
|
92
|
+
r += n.decode(l, { stream: !0 });
|
|
93
|
+
let u = r.indexOf("\n\n");
|
|
77
94
|
for (; u !== -1;) {
|
|
78
|
-
let e =
|
|
79
|
-
|
|
95
|
+
let e = s(r.slice(0, u));
|
|
96
|
+
r = r.slice(u + 2), u = r.indexOf("\n\n"), e?.event === "ready" && i(e.data) ? (o = e.data.token, k(c, e.data)) : e?.event === "message" && a(e.data) && O(e.data);
|
|
80
97
|
}
|
|
81
98
|
}
|
|
82
99
|
};
|
|
83
|
-
return
|
|
100
|
+
return f(`${e}?${n}`, {
|
|
84
101
|
headers: { accept: "text/event-stream" },
|
|
85
102
|
credentials: "same-origin",
|
|
86
|
-
signal:
|
|
87
|
-
}).then(async (
|
|
88
|
-
if (!
|
|
89
|
-
|
|
103
|
+
signal: r.signal
|
|
104
|
+
}).then(async (e) => {
|
|
105
|
+
if (!e.ok) {
|
|
106
|
+
y = /* @__PURE__ */ new Map(), E(t.split(",").map((t) => [t, `http_${String(e.status)}`])), T("closed");
|
|
90
107
|
return;
|
|
91
108
|
}
|
|
92
|
-
throw await
|
|
109
|
+
throw await l(e), Error("The realtime stream ended");
|
|
93
110
|
}).catch(() => {
|
|
94
|
-
|
|
95
|
-
}),
|
|
96
|
-
},
|
|
97
|
-
let
|
|
111
|
+
r.signal.aborted || A(c);
|
|
112
|
+
}), c;
|
|
113
|
+
}, M = (t, n) => {
|
|
114
|
+
let s = new p(l(e, n)), u = /* @__PURE__ */ new Map(), d = 0, f = !1, m = !1, h = () => {
|
|
98
115
|
u.forEach((e) => e(!1)), u.clear();
|
|
99
116
|
}, g = {
|
|
100
|
-
topics:
|
|
117
|
+
topics: t,
|
|
101
118
|
transport: "websocket",
|
|
102
119
|
close: () => {
|
|
103
|
-
m = !0, h(),
|
|
120
|
+
m = !0, h(), s.close();
|
|
104
121
|
},
|
|
105
|
-
publish: (e, t,
|
|
106
|
-
if (
|
|
122
|
+
publish: (e, t, n) => new Promise((i) => {
|
|
123
|
+
if (s.readyState !== s.OPEN) {
|
|
107
124
|
i(!1);
|
|
108
125
|
return;
|
|
109
126
|
}
|
|
110
127
|
d += 1;
|
|
111
|
-
let a = d,
|
|
128
|
+
let a = d, o = setTimeout(() => {
|
|
112
129
|
u.delete(a), i(!1);
|
|
113
|
-
},
|
|
130
|
+
}, r);
|
|
114
131
|
u.set(a, (e) => {
|
|
115
|
-
clearTimeout(
|
|
116
|
-
}),
|
|
132
|
+
clearTimeout(o), i(e);
|
|
133
|
+
}), s.send(JSON.stringify({
|
|
117
134
|
id: a,
|
|
118
135
|
topic: e,
|
|
119
136
|
type: t,
|
|
120
|
-
data:
|
|
137
|
+
data: n
|
|
121
138
|
}));
|
|
122
139
|
})
|
|
123
140
|
};
|
|
124
|
-
return
|
|
125
|
-
let t =
|
|
126
|
-
t?.event === "ready" &&
|
|
127
|
-
},
|
|
128
|
-
if (h(), !(m ||
|
|
129
|
-
if (!
|
|
130
|
-
|
|
141
|
+
return s.onmessage = (e) => {
|
|
142
|
+
let t = c(e.data);
|
|
143
|
+
t?.event === "ready" && i(t.data) ? (f = !0, k(g, t.data)) : t?.event === "message" && a(t.data) ? O(t.data) : t?.event === "ack" && o(t.data) && (u.get(t.data.id)?.(t.data.ok), u.delete(t.data.id));
|
|
144
|
+
}, s.onclose = () => {
|
|
145
|
+
if (h(), !(m || v !== g)) {
|
|
146
|
+
if (!f) {
|
|
147
|
+
C = !1, N();
|
|
131
148
|
return;
|
|
132
149
|
}
|
|
133
|
-
|
|
150
|
+
A(g);
|
|
134
151
|
}
|
|
135
152
|
}, g;
|
|
136
153
|
};
|
|
137
|
-
function
|
|
138
|
-
|
|
154
|
+
function N() {
|
|
155
|
+
v?.close(), v = void 0;
|
|
139
156
|
let e = w();
|
|
140
157
|
if (!e) {
|
|
141
|
-
|
|
158
|
+
T("idle");
|
|
142
159
|
return;
|
|
143
160
|
}
|
|
144
|
-
|
|
145
|
-
let t =
|
|
146
|
-
|
|
161
|
+
T("connecting");
|
|
162
|
+
let t = D(e);
|
|
163
|
+
v = C ? M(e, t) : j(e, t);
|
|
147
164
|
}
|
|
148
|
-
let
|
|
149
|
-
clearTimeout(
|
|
150
|
-
(
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
let
|
|
165
|
+
let P = (e = !1) => {
|
|
166
|
+
clearTimeout(b), clearTimeout(x), b = setTimeout(() => {
|
|
167
|
+
(e || v?.topics !== w()) && N();
|
|
168
|
+
}, t);
|
|
169
|
+
}, F = (e) => _ === "open" && v?.topics.split(",").includes(e) === !0, I = (e) => F(e) ? Promise.resolve(!0) : new Promise((t) => {
|
|
170
|
+
let n = setTimeout(() => {
|
|
154
171
|
i(), t(!1);
|
|
155
|
-
},
|
|
156
|
-
(
|
|
172
|
+
}, r), i = L.onStatus((r) => {
|
|
173
|
+
(r === "closed" || F(e)) && (clearTimeout(n), i(), t(r !== "closed"));
|
|
157
174
|
});
|
|
158
|
-
}),
|
|
175
|
+
}), L = {
|
|
159
176
|
subscribe: (e, t) => {
|
|
160
|
-
let n =
|
|
161
|
-
return n.add(t),
|
|
162
|
-
n.delete(t), n.size || (
|
|
177
|
+
let n = m.get(e) ?? /* @__PURE__ */ new Set();
|
|
178
|
+
return n.add(t), m.set(e, n), P(), () => {
|
|
179
|
+
n.delete(t), n.size || (m.delete(e), h.delete(e), P());
|
|
163
180
|
};
|
|
164
181
|
},
|
|
165
182
|
grant: (e, t) => {
|
|
166
|
-
if (
|
|
167
|
-
t ?
|
|
168
|
-
let n =
|
|
169
|
-
t &&
|
|
183
|
+
if (h.get(e) === t) return;
|
|
184
|
+
t ? h.set(e, t) : h.delete(e);
|
|
185
|
+
let n = F(e) && !y.has(e);
|
|
186
|
+
t && m.has(e) && !n && P(!0);
|
|
187
|
+
},
|
|
188
|
+
publish: async (e, t, n) => {
|
|
189
|
+
let r = await I(e) && v ? await v.publish(e, t, n) : !1;
|
|
190
|
+
return d(r ? "info" : "danger", `${e} → ${t}${r ? "" : " (not delivered)"}`, {
|
|
191
|
+
event: "published",
|
|
192
|
+
topic: e,
|
|
193
|
+
type: t,
|
|
194
|
+
data: n,
|
|
195
|
+
delivered: r
|
|
196
|
+
}), r;
|
|
170
197
|
},
|
|
171
|
-
|
|
172
|
-
onStatus: (e) => (h.add(e), () => h.delete(e)),
|
|
198
|
+
onStatus: (e) => (g.add(e), () => g.delete(e)),
|
|
173
199
|
get status() {
|
|
174
|
-
return
|
|
200
|
+
return _;
|
|
175
201
|
},
|
|
176
202
|
get me() {
|
|
177
|
-
return
|
|
203
|
+
return v?.me;
|
|
178
204
|
},
|
|
179
205
|
get transport() {
|
|
180
|
-
return
|
|
206
|
+
return v?.transport ?? (C ? "websocket" : "sse");
|
|
181
207
|
},
|
|
182
|
-
refusal: (e) =>
|
|
208
|
+
refusal: (e) => y.get(e)
|
|
183
209
|
};
|
|
184
|
-
return
|
|
185
|
-
},
|
|
186
|
-
|
|
210
|
+
return L;
|
|
211
|
+
}, d = (t, n, r) => {
|
|
212
|
+
t === "success" ? e.success("realtime", n, r) : t === "warning" ? e.warning("realtime", n, r) : t === "danger" ? e.danger("realtime", n, r) : e.info("realtime", n, r);
|
|
213
|
+
}, f = /* @__PURE__ */ new Map(), p = (e, t = "sse") => {
|
|
214
|
+
let n = `${t} ${e}`, r = f.get(n);
|
|
187
215
|
if (r) return r;
|
|
188
|
-
let i =
|
|
189
|
-
return
|
|
216
|
+
let i = u(e, { transport: t });
|
|
217
|
+
return f.set(n, i), i;
|
|
190
218
|
};
|
|
191
219
|
//#endregion
|
|
192
|
-
export {
|
|
220
|
+
export { u as createRealtimeClient, p as realtimeClientFor };
|
package/dist/realtime/topics.mjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
1
2
|
//#region src/realtime/topics.ts
|
|
2
|
-
var
|
|
3
|
-
if (!
|
|
4
|
-
let
|
|
5
|
-
return
|
|
6
|
-
pattern:
|
|
7
|
-
declaration:
|
|
3
|
+
var t = /^[A-Za-z0-9:_.-]{1,128}$/, n = "[A-Za-z0-9_.-]{1,64}", r = (e) => t.test(e), i = (e) => RegExp(`^${e.split(/(\{[A-Za-z0-9_]+\})/).map((e) => /^\{[A-Za-z0-9_]+\}$/.test(e) ? n : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("")}$`), a = (e, t) => {
|
|
4
|
+
if (!t || !r(e)) return;
|
|
5
|
+
let n = Object.keys(t).find((t) => i(t).test(e));
|
|
6
|
+
return n === void 0 ? void 0 : {
|
|
7
|
+
pattern: n,
|
|
8
|
+
declaration: t[n]
|
|
8
9
|
};
|
|
9
|
-
},
|
|
10
|
+
}, o = /^(?=.)[A-Za-z0-9:_.-]*(\{[A-Za-z0-9_]+\}[A-Za-z0-9:_.-]*)*$/, s = /* @__PURE__ */ new Set([
|
|
10
11
|
"public",
|
|
11
12
|
"session",
|
|
12
13
|
"role"
|
|
13
|
-
]),
|
|
14
|
-
let
|
|
15
|
-
if (
|
|
16
|
-
let { access:
|
|
17
|
-
typeof f != "string" || !
|
|
18
|
-
for (let [e, t] of [["maxMessageBytes", u], ["messagesPerSecond", d]]) t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t <= 0) &&
|
|
19
|
-
return
|
|
20
|
-
},
|
|
14
|
+
]), c = (t, n) => {
|
|
15
|
+
let r = [];
|
|
16
|
+
if (o.test(t) || r.push("a pattern is letters, digits and `:_.-`, with `{name}` for the part a page fills in — `board:{id}`"), !e(n)) return [...r, "a channel is an object: `{ access: { mode: \"public\" } }`"];
|
|
17
|
+
let { access: i, publish: a, presence: c, grant: l, maxMessageBytes: u, messagesPerSecond: d } = n, f = e(i) ? i.mode : void 0;
|
|
18
|
+
typeof f != "string" || !s.has(f) ? r.push("`access` is { mode: \"public\" }, { mode: \"session\" } or { mode: \"role\", permissions: […] }") : f === "role" && !(e(i) && Array.isArray(i.permissions) && i.permissions.every((e) => typeof e == "string")) && r.push("`access: { mode: \"role\" }` names the permissions it needs: `permissions: [\"boardEdit\"]`"), a !== void 0 && a !== "clients" && a !== "server" && r.push("`publish` is \"clients\" (pages send) or \"server\" (only a flow's realtime.publish)"), c !== void 0 && typeof c != "boolean" && r.push("`presence` is true or false"), l !== void 0 && typeof l != "boolean" && r.push("`grant` is true (a page needs a grant from `realtime.grant` to open a topic) or false");
|
|
19
|
+
for (let [e, t] of [["maxMessageBytes", u], ["messagesPerSecond", d]]) t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t <= 0) && r.push(`\`${e}\` is a whole number above zero`);
|
|
20
|
+
return r;
|
|
21
|
+
}, l = (e) => ({
|
|
21
22
|
maxMessageBytes: e.maxMessageBytes ?? 4096,
|
|
22
23
|
messagesPerSecond: e.messagesPerSecond ?? 30
|
|
23
|
-
}),
|
|
24
|
+
}), u = "$presence", d = "$leave", f = "$join", p = "$revoked";
|
|
24
25
|
//#endregion
|
|
25
|
-
export {
|
|
26
|
+
export { f as JOIN_TYPE, d as LEAVE_TYPE, u as PRESENCE_TYPE, p as REVOKED_TYPE, l as channelLimits, c as channelProblems, r as isValidTopic, a as matchChannel };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var t = e({ definition: { rootId: "" } });
|
|
3
|
-
t.displayName = "SchemaContext";
|
|
1
|
+
import { sharedContext as e } from "../helpers/sharedContext.mjs";
|
|
2
|
+
var t = e("SchemaContext", { definition: { rootId: "" } });
|
|
4
3
|
//#endregion
|
|
5
4
|
export { t as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an element's `anchor` may be: the `id` it carries in the DOM, so `/page#anchor` lands on it.
|
|
3
|
+
*
|
|
4
|
+
* Lowercase, starting with a letter, then letters, digits and hyphens — a fragment a person types in a URL, with no
|
|
5
|
+
* escaping and no case to get wrong. The one rule the authoring package, the builder and the MCP all hold it to.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ANCHOR_PATTERN: RegExp;
|
|
8
|
+
export declare const isAnchor: (value: unknown) => value is string;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { default as SchemaContext } from './SchemaContext';
|
|
2
|
+
export * from './anchor';
|
|
2
3
|
export * from './schemaConstants';
|
|
3
4
|
export * from './SchemaContext';
|
|
4
5
|
export * from './layoutChain';
|
|
5
6
|
export * from './serverElements';
|
|
7
|
+
export * from './snippet';
|
|
6
8
|
export { SchemaContext };
|
package/dist/schema/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import e from "./SchemaContext.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { ANCHOR_PATTERN as t, isAnchor as n } from "./anchor.mjs";
|
|
3
|
+
import { COMPONENT_PROPS_SOURCE as r, EMPTY_SCHEMA as i, VARIABLE_REGEX as a } from "./schemaConstants.mjs";
|
|
4
|
+
import { findLayoutCycle as o, resolveLayoutChain as s } from "./layoutChain.mjs";
|
|
5
|
+
import { collectServerElements as c, hasServerElements as l } from "./serverElements.mjs";
|
|
6
|
+
import { isSnippet as u } from "./snippet.mjs";
|
|
7
|
+
export { t as ANCHOR_PATTERN, r as COMPONENT_PROPS_SOURCE, i as EMPTY_SCHEMA, e as SchemaContext, a as VARIABLE_REGEX, c as collectServerElements, o as findLayoutCycle, l as hasServerElements, n as isAnchor, u as isSnippet, s as resolveLayoutChain };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Schema, Style } from '../types';
|
|
2
2
|
export declare const VARIABLE_REGEX: RegExp;
|
|
3
|
+
/** The source a component's tree reads its props from — `{{ props.title }}` — and the only one it is given. */
|
|
4
|
+
export declare const COMPONENT_PROPS_SOURCE = "props";
|
|
3
5
|
export declare const EMPTY_SCHEMA: {
|
|
4
6
|
schema: Schema;
|
|
5
7
|
style: Style;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EMPTY_STYLE_SCHEMA as e } from "../style/styleConstants.mjs";
|
|
2
2
|
//#region src/schema/schemaConstants.ts
|
|
3
|
-
var t = /var\(\s*--([a-zA-Z0-9_-]+)\s*\)|\{\{\s*([a-zA-Z0-9_-]+)\s*\}\}/, n = {
|
|
3
|
+
var t = /var\(\s*--([a-zA-Z0-9_-]+)\s*\)|\{\{\s*([a-zA-Z0-9_-]+)\s*\}\}/, n = "props", r = {
|
|
4
4
|
schema: {
|
|
5
5
|
definition: {
|
|
6
6
|
name: "",
|
|
@@ -10,10 +10,11 @@ var t = /var\(\s*--([a-zA-Z0-9_-]+)\s*\)|\{\{\s*([a-zA-Z0-9_-]+)\s*\}\}/, n = {
|
|
|
10
10
|
variables: [],
|
|
11
11
|
settings: { customCss: "" },
|
|
12
12
|
pages: [],
|
|
13
|
-
pageFolders: []
|
|
13
|
+
pageFolders: [],
|
|
14
|
+
components: {}
|
|
14
15
|
},
|
|
15
16
|
style: e,
|
|
16
17
|
definition: { rootId: "" }
|
|
17
18
|
};
|
|
18
19
|
//#endregion
|
|
19
|
-
export { n as EMPTY_SCHEMA, t as VARIABLE_REGEX };
|
|
20
|
+
export { n as COMPONENT_PROPS_SOURCE, r as EMPTY_SCHEMA, t as VARIABLE_REGEX };
|
|
@@ -16,6 +16,10 @@ import { Element, Schema } from '../types';
|
|
|
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
18
|
*/
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Given the flags as they resolved, an element gated off by one is skipped with its whole subtree — it will not be
|
|
21
|
+
* rendered, so nothing in it wants data, and resolving it would put a feature that is off into the payload anyway.
|
|
22
|
+
*/
|
|
23
|
+
export declare const collectServerElements: (schema: Schema, pageId: string | undefined, ids?: string[], flags?: Record<string, boolean>) => Element[];
|
|
20
24
|
/** Whether anything on this page consumes server data at all — the question both RSC gates actually ask. */
|
|
21
|
-
export declare const hasServerElements: (schema: Schema, pageId: string | undefined) => boolean;
|
|
25
|
+
export declare const hasServerElements: (schema: Schema, pageId: string | undefined, flags?: Record<string, boolean>) => boolean;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { passesFlagGate as e } from "../flags/resolveFlags.mjs";
|
|
2
|
+
import { resolveLayoutChain as t } from "./layoutChain.mjs";
|
|
2
3
|
//#region src/schema/serverElements.ts
|
|
3
|
-
var
|
|
4
|
-
if (
|
|
5
|
-
let
|
|
6
|
-
for (;
|
|
7
|
-
let
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
if (!
|
|
12
|
-
|
|
13
|
-
let { items:
|
|
14
|
-
|
|
4
|
+
var n = (n, r, i, a) => {
|
|
5
|
+
if (r === void 0) return [];
|
|
6
|
+
let o = i ? new Set(i) : void 0, s = [], c = /* @__PURE__ */ new Set(), l = n.flat[r], u = (e) => typeof e == "string" ? e : "", d = [r, ...l ? t((e) => n.flat[e], u(l.attributes.layout), u(l.attributes.layoutContainer)).map((e) => e.layout) : []];
|
|
7
|
+
for (; d.length > 0;) {
|
|
8
|
+
let t = d.pop();
|
|
9
|
+
if (t === void 0 || c.has(t)) continue;
|
|
10
|
+
c.add(t);
|
|
11
|
+
let r = n.flat[t];
|
|
12
|
+
if (!r || a && !e(r.definition.flag, a)) continue;
|
|
13
|
+
r.definition.runtime === "server" && (!o || o.has(r.id)) && s.push(r);
|
|
14
|
+
let { items: i } = r.definition;
|
|
15
|
+
i && d.push(...i);
|
|
15
16
|
}
|
|
16
|
-
return
|
|
17
|
-
},
|
|
17
|
+
return s;
|
|
18
|
+
}, r = (e, t, r) => n(e, t, void 0, r).length > 0;
|
|
18
19
|
//#endregion
|
|
19
|
-
export {
|
|
20
|
+
export { n as collectServerElements, r as hasServerElements };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Snippet } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a document read from somewhere — an upload, a file on a CDN — is a snippet a builder can show and drop: a
|
|
4
|
+
* name, a base element that is in its elements, and a style to dress them. Its shape only; whether what it holds is
|
|
5
|
+
* sound is `validateSnippet`'s to say (`@plitzi/sdk-authoring`).
|
|
6
|
+
*/
|
|
7
|
+
export declare const isSnippet: (value: unknown) => value is Snippet;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
2
|
+
//#region src/schema/snippet.ts
|
|
3
|
+
var t = (t) => {
|
|
4
|
+
if (!e(t) || !e(t.definition) || !e(t.schema) || !e(t.style)) return !1;
|
|
5
|
+
let { definition: n, schema: r, style: i } = t;
|
|
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
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as isSnippet };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Element, Schema, SchemaRaw, WireElement } from '../types';
|
|
2
|
+
/** A schema as the channel carries it: `flat` as a list. What every publisher of a whole schema sends. */
|
|
3
|
+
export declare const schemaToWire: (schema: Schema) => SchemaRaw;
|
|
4
|
+
/** An element as the store holds it: what the wire sent `null` for is absent, as it is in the document. */
|
|
5
|
+
export declare const elementFromWire: ({ definition, ...element }: WireElement) => Element;
|
|
6
|
+
/**
|
|
7
|
+
* A schema off the wire — the live channel or a GraphQL answer — keyed again by element id: what a receiver stores.
|
|
8
|
+
* The one way in for both, so an element whose missing gate arrived as `null` never reaches code that reads absent as
|
|
9
|
+
* `undefined`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const schemaFromWire: (raw: SchemaRaw) => Schema;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/schema/wire.ts
|
|
2
|
+
var e = (e) => ({
|
|
3
|
+
...e,
|
|
4
|
+
flat: Object.values(e.flat)
|
|
5
|
+
}), t = ({ definition: e, ...t }) => {
|
|
6
|
+
let { parentId: n, items: r, bindings: i, interactions: a, initialState: o, runtime: s, loadStrategy: c, flag: l, anchor: u, ...d } = e;
|
|
7
|
+
return {
|
|
8
|
+
...t,
|
|
9
|
+
definition: {
|
|
10
|
+
...d,
|
|
11
|
+
...n == null ? {} : { parentId: n },
|
|
12
|
+
...r == null ? {} : { items: r },
|
|
13
|
+
...i == null ? {} : { bindings: i },
|
|
14
|
+
...a == null ? {} : { interactions: a },
|
|
15
|
+
...o == null ? {} : { initialState: o },
|
|
16
|
+
...s == null ? {} : { runtime: s },
|
|
17
|
+
...c == null ? {} : { loadStrategy: c },
|
|
18
|
+
...l == null ? {} : { flag: l },
|
|
19
|
+
...u == null ? {} : { anchor: u }
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}, n = (e) => ({
|
|
23
|
+
...e,
|
|
24
|
+
flat: Object.fromEntries(e.flat.map((e) => [e.id, t(e)]))
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { t as elementFromWire, n as schemaFromWire, e as schemaToWire };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ServerSSR } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Seeds where this origin resizes remote pictures, once, at the SDK root — as `useRealtimeSync` does for channels.
|
|
4
|
+
*
|
|
5
|
+
* Only a server that mounts the endpoint publishes the path, so a render without one (the builder, an embed, a client
|
|
6
|
+
* project) keeps every image on its own `src` rather than pointing it at a 404.
|
|
7
|
+
*/
|
|
8
|
+
declare const useImagesSync: (ssr?: ServerSSR) => void;
|
|
9
|
+
export default useImagesSync;
|
|
@@ -22,5 +22,7 @@ export declare const refreshRsc: (store: StoreApi<CommonState>, ids?: string[],
|
|
|
22
22
|
* navigation asks for the destination BEFORE it commits. Absent means where the visitor already is, which is
|
|
23
23
|
* every other caller: the initial load, a pager, an element refreshing itself.
|
|
24
24
|
*/
|
|
25
|
-
location?: string
|
|
25
|
+
location?: string,
|
|
26
|
+
/** Whether this is the one second asking, after a refusal that renewed the session. */
|
|
27
|
+
retried?: boolean) => Promise<void>;
|
|
26
28
|
export default refreshRsc;
|