@storystick/preview 0.0.0-stage → 0.2.0-rc.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.
- package/LICENSE +112 -0
- package/PUBLIC-API.md +55 -0
- package/README.md +42 -2
- package/dist/.source-hash +1 -0
- package/dist/authoring/runtime-contract.d.ts +89 -0
- package/dist/authoring/runtime-contract.js +28 -0
- package/dist/channel-taxonomy.d.ts +17 -0
- package/dist/channel-taxonomy.js +46 -0
- package/dist/context-command.d.ts +18 -0
- package/dist/context-command.js +38 -0
- package/dist/dev/suspicious-codeword-detector.d.ts +15 -0
- package/dist/dev/suspicious-codeword-detector.js +220 -0
- package/dist/dev/suspicious-codeword-detector.noop.d.ts +3 -0
- package/dist/dev/suspicious-codeword-detector.noop.js +4 -0
- package/dist/framework/browser-context.d.ts +2 -0
- package/dist/framework/browser-context.js +2 -0
- package/dist/framework/generation-refresh.d.ts +23 -0
- package/dist/framework/generation-refresh.js +82 -0
- package/dist/framework/generation-signal.d.ts +8 -0
- package/dist/framework/generation-signal.js +17 -0
- package/dist/framework/projection-generation-watch.d.ts +5 -0
- package/dist/framework/projection-generation-watch.js +53 -0
- package/dist/framework/render-receipt.d.ts +8 -0
- package/dist/framework/render-receipt.js +10 -0
- package/dist/framework/runtime-adapter-store.d.ts +30 -0
- package/dist/framework/runtime-adapter-store.js +81 -0
- package/dist/grant-coordinator.d.ts +53 -0
- package/dist/grant-coordinator.js +329 -0
- package/dist/grant-lifecycle.d.ts +52 -0
- package/dist/grant-lifecycle.js +74 -0
- package/dist/identity/__test-adapter.d.ts +34 -0
- package/dist/identity/__test-adapter.js +59 -0
- package/dist/identity/browser-context-gate.d.ts +4 -0
- package/dist/identity/browser-context-gate.js +22 -0
- package/dist/identity/browser-context.d.ts +13 -0
- package/dist/identity/browser-context.js +22 -0
- package/dist/identity/carriers/postmessage.d.ts +84 -0
- package/dist/identity/carriers/postmessage.js +177 -0
- package/dist/identity/carriers/storage-state.d.ts +41 -0
- package/dist/identity/carriers/storage-state.js +99 -0
- package/dist/identity/carriers/storage.d.ts +39 -0
- package/dist/identity/carriers/storage.js +182 -0
- package/dist/identity/carriers/url.d.ts +19 -0
- package/dist/identity/carriers/url.js +38 -0
- package/dist/identity/identity-state-machine.d.ts +70 -0
- package/dist/identity/identity-state-machine.js +244 -0
- package/dist/identity/identity-types.d.ts +192 -0
- package/dist/identity/identity-types.js +22 -0
- package/dist/identity/index.d.ts +18 -0
- package/dist/identity/index.js +16 -0
- package/dist/identity/preview-cookie.d.ts +9 -0
- package/dist/identity/preview-cookie.js +12 -0
- package/dist/identity/preview-draft.d.ts +6 -0
- package/dist/identity/preview-draft.js +25 -0
- package/dist/identity/preview-identity.d.ts +28 -0
- package/dist/identity/preview-identity.js +84 -0
- package/dist/identity/preview-scope.d.ts +28 -0
- package/dist/identity/preview-scope.js +47 -0
- package/dist/identity/resolver.d.ts +110 -0
- package/dist/identity/resolver.js +334 -0
- package/dist/identity/session-query.d.ts +4 -0
- package/dist/identity/session-query.js +19 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +788 -0
- package/dist/interaction-mode.d.ts +58 -0
- package/dist/interaction-mode.js +93 -0
- package/dist/nav-handler.d.ts +95 -0
- package/dist/nav-handler.js +84 -0
- package/dist/overlay-label.d.ts +79 -0
- package/dist/overlay-label.js +73 -0
- package/dist/provenance/anchor-map.d.ts +95 -0
- package/dist/provenance/anchor-map.js +177 -0
- package/dist/provenance/carrier-plan.d.ts +51 -0
- package/dist/provenance/carrier-plan.js +90 -0
- package/dist/provenance/coded-text.d.ts +20 -0
- package/dist/provenance/coded-text.js +302 -0
- package/dist/provenance/direct-edit-locator.d.ts +29 -0
- package/dist/provenance/direct-edit-locator.js +218 -0
- package/dist/provenance/editable-leaf.d.ts +134 -0
- package/dist/provenance/editable-leaf.js +483 -0
- package/dist/provenance/editor-target.d.ts +29 -0
- package/dist/provenance/editor-target.js +46 -0
- package/dist/provenance/field-leaf-walker.d.ts +21 -0
- package/dist/provenance/field-leaf-walker.js +98 -0
- package/dist/provenance/frame-dependencies.d.ts +212 -0
- package/dist/provenance/frame-dependencies.js +550 -0
- package/dist/provenance/index.d.ts +26 -0
- package/dist/provenance/index.js +26 -0
- package/dist/provenance/local-events.d.ts +1 -0
- package/dist/provenance/local-events.js +1 -0
- package/dist/provenance/markers.d.ts +21 -0
- package/dist/provenance/markers.js +70 -0
- package/dist/provenance/multi-frame-anchor-map.d.ts +54 -0
- package/dist/provenance/multi-frame-anchor-map.js +109 -0
- package/dist/provenance/normalize.d.ts +2 -0
- package/dist/provenance/normalize.js +19 -0
- package/dist/provenance/overlay-focus-echo.d.ts +17 -0
- package/dist/provenance/overlay-focus-echo.js +16 -0
- package/dist/provenance/overlay-projection.d.ts +65 -0
- package/dist/provenance/overlay-projection.js +201 -0
- package/dist/provenance/owner-map.d.ts +55 -0
- package/dist/provenance/owner-map.js +239 -0
- package/dist/provenance/read-carrier.d.ts +22 -0
- package/dist/provenance/read-carrier.js +92 -0
- package/dist/provenance/recorder.d.ts +38 -0
- package/dist/provenance/recorder.js +82 -0
- package/dist/provenance/render-context.d.ts +106 -0
- package/dist/provenance/render-context.js +338 -0
- package/dist/provenance/reveal-contract.d.ts +44 -0
- package/dist/provenance/reveal-contract.js +1 -0
- package/dist/provenance/richtext-slice-embed-address.d.ts +20 -0
- package/dist/provenance/richtext-slice-embed-address.js +35 -0
- package/dist/provenance/runtime-script.d.ts +1 -0
- package/dist/provenance/runtime-script.js +2217 -0
- package/dist/provenance/sidecar-store.d.ts +63 -0
- package/dist/provenance/sidecar-store.js +151 -0
- package/dist/provenance/sidecar.d.ts +34 -0
- package/dist/provenance/sidecar.js +227 -0
- package/dist/provenance/slice-model.d.ts +28 -0
- package/dist/provenance/slice-model.js +86 -0
- package/dist/provenance/source-identity.d.ts +3 -0
- package/dist/provenance/source-identity.js +7 -0
- package/dist/provenance/source-map-materializer.d.ts +76 -0
- package/dist/provenance/source-map-materializer.js +286 -0
- package/dist/provenance/source-registry.d.ts +103 -0
- package/dist/provenance/source-registry.js +562 -0
- package/dist/provenance/transformed-output-gate.d.ts +161 -0
- package/dist/provenance/transformed-output-gate.js +171 -0
- package/dist/provenance/types.d.ts +102 -0
- package/dist/provenance/types.js +1 -0
- package/dist/refresh-policy.d.ts +11 -0
- package/dist/refresh-policy.js +14 -0
- package/dist/reveal-target.d.ts +8 -0
- package/dist/reveal-target.js +47 -0
- package/dist/route-paths.d.ts +11 -0
- package/dist/route-paths.js +14 -0
- package/dist/router-subscriber.d.ts +92 -0
- package/dist/router-subscriber.js +44 -0
- package/dist/runtime/anchor-types.d.ts +5 -0
- package/dist/runtime/anchor-types.js +1 -0
- package/dist/runtime/authority-store.d.ts +31 -0
- package/dist/runtime/authority-store.js +56 -0
- package/dist/runtime/boot.d.ts +52 -0
- package/dist/runtime/boot.js +379 -0
- package/dist/runtime/content-refresh.d.ts +30 -0
- package/dist/runtime/content-refresh.js +68 -0
- package/dist/runtime/emit-runtime-error.d.ts +51 -0
- package/dist/runtime/emit-runtime-error.js +64 -0
- package/dist/runtime/field-proxy.d.ts +112 -0
- package/dist/runtime/field-proxy.js +471 -0
- package/dist/runtime/form-contract-reporter.d.ts +99 -0
- package/dist/runtime/form-contract-reporter.js +391 -0
- package/dist/runtime/invalidation-adapter.d.ts +17 -0
- package/dist/runtime/invalidation-adapter.js +42 -0
- package/dist/runtime/live-query-overlay.d.ts +39 -0
- package/dist/runtime/live-query-overlay.js +345 -0
- package/dist/runtime/momentary-navigate.d.ts +16 -0
- package/dist/runtime/momentary-navigate.js +106 -0
- package/dist/runtime/observation-scheduler.d.ts +15 -0
- package/dist/runtime/observation-scheduler.js +42 -0
- package/dist/runtime/perf-metrics.d.ts +28 -0
- package/dist/runtime/perf-metrics.js +90 -0
- package/dist/runtime/preview-interaction-policy.d.ts +1 -0
- package/dist/runtime/preview-interaction-policy.js +103 -0
- package/dist/runtime/preview-overlay-painter.d.ts +27 -0
- package/dist/runtime/preview-overlay-painter.js +1732 -0
- package/dist/runtime/preview-overlay-sidecar.d.ts +26 -0
- package/dist/runtime/preview-overlay-sidecar.js +45 -0
- package/dist/runtime/preview-perspective-alignment.d.ts +15 -0
- package/dist/runtime/preview-perspective-alignment.js +40 -0
- package/dist/runtime/preview-perspective-intent-state.d.ts +23 -0
- package/dist/runtime/preview-perspective-intent-state.js +5 -0
- package/dist/runtime/preview-transition-state.d.ts +142 -0
- package/dist/runtime/preview-transition-state.js +257 -0
- package/dist/runtime/render-mode-state.d.ts +51 -0
- package/dist/runtime/render-mode-state.js +76 -0
- package/dist/runtime/request-id.d.ts +4 -0
- package/dist/runtime/request-id.js +8 -0
- package/dist/runtime/resolve-schema-field.d.ts +99 -0
- package/dist/runtime/resolve-schema-field.js +356 -0
- package/dist/runtime/runtime-error-dispatch.d.ts +23 -0
- package/dist/runtime/runtime-error-dispatch.js +75 -0
- package/dist/runtime/schema-store.d.ts +121 -0
- package/dist/runtime/schema-store.js +667 -0
- package/dist/runtime/snapshot-assembly.d.ts +104 -0
- package/dist/runtime/snapshot-assembly.js +553 -0
- package/dist/runtime/snapshot-reporter.d.ts +55 -0
- package/dist/runtime/snapshot-reporter.js +375 -0
- package/dist/runtime/standalone-overlay-controller.d.ts +33 -0
- package/dist/runtime/standalone-overlay-controller.js +281 -0
- package/dist/runtime/store.d.ts +307 -0
- package/dist/runtime/store.js +1026 -0
- package/dist/runtime/windowed-minimap-projection.d.ts +28 -0
- package/dist/runtime/windowed-minimap-projection.js +189 -0
- package/dist/runtime/workspace-shortcuts.d.ts +30 -0
- package/dist/runtime/workspace-shortcuts.js +188 -0
- package/dist/sdk-error-copy.d.ts +48 -0
- package/dist/sdk-error-copy.js +182 -0
- package/dist/select-cursor.d.ts +2 -0
- package/dist/select-cursor.js +23 -0
- package/dist/server/admission-cookie.d.ts +38 -0
- package/dist/server/admission-cookie.js +122 -0
- package/dist/server/control-client.d.ts +29 -0
- package/dist/server/control-client.js +22 -0
- package/dist/server/control-errors.d.ts +22 -0
- package/dist/server/control-errors.js +165 -0
- package/dist/server/draft-route.d.ts +12 -0
- package/dist/server/draft-route.js +45 -0
- package/dist/server/extract-token.d.ts +30 -0
- package/dist/server/extract-token.js +98 -0
- package/dist/server/grant.d.ts +128 -0
- package/dist/server/grant.js +395 -0
- package/dist/server/ordinary-read-provenance.d.ts +11 -0
- package/dist/server/ordinary-read-provenance.js +124 -0
- package/dist/server/preview-read-metadata.d.ts +10 -0
- package/dist/server/preview-read-metadata.js +27 -0
- package/dist/server/provenance-frame-builder.d.ts +53 -0
- package/dist/server/provenance-frame-builder.js +102 -0
- package/dist/server/provenance-runtime.d.ts +70 -0
- package/dist/server/provenance-runtime.js +46 -0
- package/dist/server/read-context-command.d.ts +11 -0
- package/dist/server/read-context-command.js +53 -0
- package/dist/server/read-identity.d.ts +3 -0
- package/dist/server/read-identity.js +63 -0
- package/dist/server/read-lifecycle.d.ts +17 -0
- package/dist/server/read-lifecycle.js +52 -0
- package/dist/server/render-frame-provenance.d.ts +133 -0
- package/dist/server/render-frame-provenance.js +676 -0
- package/dist/server/render-id.d.ts +15 -0
- package/dist/server/render-id.js +22 -0
- package/dist/server/route-document-provenance.d.ts +77 -0
- package/dist/server/route-document-provenance.js +1327 -0
- package/dist/server/route-session-cookie.d.ts +33 -0
- package/dist/server/route-session-cookie.js +54 -0
- package/dist/session-projections.d.ts +33 -0
- package/dist/session-projections.js +43 -0
- package/dist/session-subscriber.d.ts +124 -0
- package/dist/session-subscriber.js +79 -0
- package/dist/sha256-fallback.d.ts +30 -0
- package/dist/sha256-fallback.js +126 -0
- package/dist/types.d.ts +446 -0
- package/dist/types.js +85 -0
- package/dist/validators.d.ts +61 -0
- package/dist/validators.js +110 -0
- package/package.json +206 -3
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { parsePreviewRichTextSliceEmbedAddress } from './richtext-slice-embed-address.js';
|
|
2
|
+
import { normalizePreviewVariantId } from '../identity/preview-identity.js';
|
|
3
|
+
import { hasCoherentPreviewProvenanceSourceIdentity } from './source-identity.js';
|
|
4
|
+
export function hasCompleteDirectLocatorCoverage(anchorMap) {
|
|
5
|
+
let locatorCount = 0;
|
|
6
|
+
for (const map of anchorMap.maps) {
|
|
7
|
+
const markerIds = new Set((map.editLocators ?? []).map((entry) => entry.markerId));
|
|
8
|
+
locatorCount += markerIds.size;
|
|
9
|
+
if (map.sidecarMarkerIds.some((markerId) => !markerIds.has(markerId))) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return locatorCount > 0;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve owners entirely from the public render payload delivered with the
|
|
17
|
+
* anchor map. The sidecar and observed anchors are the complete click
|
|
18
|
+
* authority; no second transport or document hydration participates.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveDirectProvenanceOwnerMap(input) {
|
|
21
|
+
const rejections = [];
|
|
22
|
+
const owners = [];
|
|
23
|
+
const ownerByMarkerId = new Map();
|
|
24
|
+
const ambiguousMarkerIds = new Set();
|
|
25
|
+
const reject = (rejection) => {
|
|
26
|
+
rejections.push(rejection);
|
|
27
|
+
};
|
|
28
|
+
if (input.anchorMap.pending || !input.anchorMap.valid) {
|
|
29
|
+
reject({ reason: 'anchor-map-not-paintable' });
|
|
30
|
+
return finish(owners, ownerByMarkerId, rejections);
|
|
31
|
+
}
|
|
32
|
+
for (const map of input.anchorMap.maps) {
|
|
33
|
+
if (!map.valid) {
|
|
34
|
+
reject({ reason: 'anchor-map-not-paintable', frameId: map.frameId });
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const directByMarkerId = new Map((map.editLocators ?? []).map((entry) => [entry.markerId, entry]));
|
|
38
|
+
const candidateMarkerIds = new Set(map.anchors.map((anchor) => anchor.markerId));
|
|
39
|
+
for (const markerId of map.unpaintedMarkerIds) {
|
|
40
|
+
if (directByMarkerId.get(markerId)?.presence === 'expected') {
|
|
41
|
+
candidateMarkerIds.add(markerId);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const markerId of map.ambiguousMarkerIds) {
|
|
45
|
+
candidateMarkerIds.add(markerId);
|
|
46
|
+
}
|
|
47
|
+
for (const markerId of candidateMarkerIds) {
|
|
48
|
+
if (ambiguousMarkerIds.has(markerId))
|
|
49
|
+
continue;
|
|
50
|
+
const direct = directByMarkerId.get(markerId);
|
|
51
|
+
if (!direct) {
|
|
52
|
+
reject({ reason: 'edit-locator-missing', frameId: map.frameId, markerId });
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (!hasCoherentPreviewProvenanceSourceIdentity(direct.locator)) {
|
|
56
|
+
reject({
|
|
57
|
+
reason: 'edit-locator-variant-mismatch',
|
|
58
|
+
frameId: map.frameId,
|
|
59
|
+
markerId,
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const owner = resolvedOwnerFromDirectLocator({
|
|
64
|
+
markerId,
|
|
65
|
+
frameId: map.frameId,
|
|
66
|
+
locator: direct.locator,
|
|
67
|
+
modality: direct.modality,
|
|
68
|
+
presence: direct.presence,
|
|
69
|
+
});
|
|
70
|
+
const existingOwner = ownerByMarkerId.get(markerId);
|
|
71
|
+
if (existingOwner !== undefined) {
|
|
72
|
+
if (sameOwner(existingOwner, owner))
|
|
73
|
+
continue;
|
|
74
|
+
reject({ reason: 'duplicate-marker-owner', frameId: map.frameId, markerId });
|
|
75
|
+
ambiguousMarkerIds.add(markerId);
|
|
76
|
+
ownerByMarkerId.delete(markerId);
|
|
77
|
+
removeOwner(owners, markerId);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
owners.push(owner);
|
|
81
|
+
ownerByMarkerId.set(markerId, owner);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return finish(owners, ownerByMarkerId, rejections);
|
|
85
|
+
}
|
|
86
|
+
export function buildProvenanceSnapshotItems(input) {
|
|
87
|
+
if (input.anchorMap.pending || !input.anchorMap.valid || !input.ownerMap.valid) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
const items = [];
|
|
91
|
+
for (const map of input.anchorMap.maps) {
|
|
92
|
+
if (!map.valid)
|
|
93
|
+
return [];
|
|
94
|
+
for (const anchor of map.anchors) {
|
|
95
|
+
const owner = input.ownerMap.ownerByMarkerId.get(anchor.markerId);
|
|
96
|
+
if (owner === undefined)
|
|
97
|
+
continue;
|
|
98
|
+
if (anchor.paintId === undefined || anchor.paintId.length === 0)
|
|
99
|
+
continue;
|
|
100
|
+
if (!isFiniteDocumentRect(anchor.documentRect))
|
|
101
|
+
continue;
|
|
102
|
+
items.push({
|
|
103
|
+
kind: 'field',
|
|
104
|
+
snapshotItemKey: anchor.paintId,
|
|
105
|
+
method: 'observed',
|
|
106
|
+
documentId: owner.documentId,
|
|
107
|
+
sliceKey: owner.fromAnchors.find((candidate) => candidate.pathPrefix === 'sections')?.key,
|
|
108
|
+
path: owner.canonicalPath,
|
|
109
|
+
fromAnchors: owner.fromAnchors,
|
|
110
|
+
...(owner.navigationPath !== undefined
|
|
111
|
+
? { navigationPath: owner.navigationPath }
|
|
112
|
+
: {}),
|
|
113
|
+
...(owner.navigationAnchors !== undefined
|
|
114
|
+
? { navigationAnchors: owner.navigationAnchors }
|
|
115
|
+
: {}),
|
|
116
|
+
field: owner.field,
|
|
117
|
+
documentRect: anchor.documentRect,
|
|
118
|
+
tier: { kind: 'observed' },
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return items;
|
|
123
|
+
}
|
|
124
|
+
function removeOwner(owners, markerId) {
|
|
125
|
+
const index = owners.findIndex((owner) => owner.markerId === markerId);
|
|
126
|
+
if (index >= 0)
|
|
127
|
+
owners.splice(index, 1);
|
|
128
|
+
}
|
|
129
|
+
function sameOwner(a, b) {
|
|
130
|
+
return a.frameId === b.frameId &&
|
|
131
|
+
a.sourceSetId === b.sourceSetId &&
|
|
132
|
+
a.documentId === b.documentId &&
|
|
133
|
+
normalizePreviewVariantId(a.variantId) === normalizePreviewVariantId(b.variantId) &&
|
|
134
|
+
a.canonicalPath === b.canonicalPath &&
|
|
135
|
+
a.navigationPath === b.navigationPath &&
|
|
136
|
+
a.richTextTextNodeIndex === b.richTextTextNodeIndex &&
|
|
137
|
+
a.richTextSliceEmbedIndex === b.richTextSliceEmbedIndex &&
|
|
138
|
+
a.richTextSliceEmbedKey === b.richTextSliceEmbedKey &&
|
|
139
|
+
a.presence === b.presence;
|
|
140
|
+
}
|
|
141
|
+
function resolvedOwnerFromDirectLocator(input) {
|
|
142
|
+
const source = {
|
|
143
|
+
documentId: input.locator.documentId,
|
|
144
|
+
...(input.locator.variantId !== undefined
|
|
145
|
+
? { variantId: input.locator.variantId }
|
|
146
|
+
: {}),
|
|
147
|
+
canonicalPath: input.locator.canonicalPath,
|
|
148
|
+
pathAnchors: input.locator.pathAnchors,
|
|
149
|
+
...(input.locator.navigationPath !== undefined
|
|
150
|
+
? { navigationPath: input.locator.navigationPath }
|
|
151
|
+
: {}),
|
|
152
|
+
...(input.locator.navigationAnchors !== undefined
|
|
153
|
+
? { navigationAnchors: input.locator.navigationAnchors }
|
|
154
|
+
: {}),
|
|
155
|
+
...(input.locator.textNodeIndex !== undefined
|
|
156
|
+
? { textNodeIndex: input.locator.textNodeIndex }
|
|
157
|
+
: {}),
|
|
158
|
+
sourceKind: input.locator.sourceKind,
|
|
159
|
+
...(input.locator.readScope !== undefined
|
|
160
|
+
? { readScope: input.locator.readScope }
|
|
161
|
+
: {}),
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
markerId: input.markerId,
|
|
165
|
+
frameId: input.frameId,
|
|
166
|
+
sourceSetId: input.locator.sourceSetId,
|
|
167
|
+
documentId: input.locator.documentId,
|
|
168
|
+
...(input.locator.variantId !== undefined
|
|
169
|
+
? { variantId: input.locator.variantId }
|
|
170
|
+
: {}),
|
|
171
|
+
...(input.locator.readScope !== undefined
|
|
172
|
+
? { readScope: input.locator.readScope }
|
|
173
|
+
: {}),
|
|
174
|
+
canonicalPath: input.locator.canonicalPath,
|
|
175
|
+
...(input.locator.navigationPath !== undefined
|
|
176
|
+
? { navigationPath: input.locator.navigationPath }
|
|
177
|
+
: {}),
|
|
178
|
+
...(input.locator.textNodeIndex !== undefined
|
|
179
|
+
? { richTextTextNodeIndex: input.locator.textNodeIndex }
|
|
180
|
+
: {}),
|
|
181
|
+
...richTextSliceEmbedAddressForSource(source),
|
|
182
|
+
pathAnchors: input.locator.pathAnchors,
|
|
183
|
+
fromAnchors: input.locator.pathAnchors.map((anchor) => ({
|
|
184
|
+
pathPrefix: anchor.path,
|
|
185
|
+
key: anchor.key,
|
|
186
|
+
})),
|
|
187
|
+
...(input.locator.navigationAnchors !== undefined
|
|
188
|
+
? {
|
|
189
|
+
navigationAnchors: input.locator.navigationAnchors.map((anchor) => ({
|
|
190
|
+
pathPrefix: anchor.path,
|
|
191
|
+
key: anchor.key,
|
|
192
|
+
})),
|
|
193
|
+
}
|
|
194
|
+
: {}),
|
|
195
|
+
sourceKind: input.locator.sourceKind,
|
|
196
|
+
modality: input.modality,
|
|
197
|
+
...(input.presence !== undefined ? { presence: input.presence } : {}),
|
|
198
|
+
field: extractLeafField(input.locator.canonicalPath),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function richTextSliceEmbedAddressForSource(source) {
|
|
202
|
+
const addressPath = source.navigationPath ?? source.canonicalPath;
|
|
203
|
+
const address = parsePreviewRichTextSliceEmbedAddress(addressPath);
|
|
204
|
+
if (address === null)
|
|
205
|
+
return {};
|
|
206
|
+
const anchors = source.navigationAnchors ?? source.pathAnchors;
|
|
207
|
+
const key = anchors.find((anchor) => anchor.path === address.rootPath)?.key;
|
|
208
|
+
return {
|
|
209
|
+
richTextSliceEmbedIndex: address.index,
|
|
210
|
+
...(key !== undefined ? { richTextSliceEmbedKey: key } : {}),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function extractLeafField(path) {
|
|
214
|
+
const dotIndex = path.lastIndexOf('.');
|
|
215
|
+
if (dotIndex >= 0)
|
|
216
|
+
return path.slice(dotIndex + 1);
|
|
217
|
+
return path.includes('[') ? '' : path;
|
|
218
|
+
}
|
|
219
|
+
function finish(owners, ownerByMarkerId, rejections) {
|
|
220
|
+
const valid = rejections.length === 0;
|
|
221
|
+
return {
|
|
222
|
+
// One unresolved or contradictory marker invalidates the whole render
|
|
223
|
+
// candidate. Painting a partial map would make click authority depend on
|
|
224
|
+
// traversal order while a streamed frame is settling.
|
|
225
|
+
valid,
|
|
226
|
+
owners: valid ? owners : [],
|
|
227
|
+
ownerByMarkerId: valid
|
|
228
|
+
? ownerByMarkerId
|
|
229
|
+
: new Map(),
|
|
230
|
+
rejections,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function isFiniteDocumentRect(rect) {
|
|
234
|
+
return (rect !== undefined &&
|
|
235
|
+
Number.isFinite(rect.x) &&
|
|
236
|
+
Number.isFinite(rect.y) &&
|
|
237
|
+
Number.isFinite(rect.width) &&
|
|
238
|
+
Number.isFinite(rect.height));
|
|
239
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PublicProvenanceSidecar, PublicSidecarMarker } from './sidecar.js';
|
|
2
|
+
/** Identity of the route resolved by the site, not an edit/access capability. */
|
|
3
|
+
export interface PreviewPrimaryPage {
|
|
4
|
+
readonly documentId: string;
|
|
5
|
+
readonly locale: string;
|
|
6
|
+
readonly publicPathname: string;
|
|
7
|
+
}
|
|
8
|
+
/** Select only unambiguous metadata for the route actually rendered. Closed over
|
|
9
|
+
* no module state so the same rule runs in the injected reporter and Studio return link. */
|
|
10
|
+
export declare function selectPreviewPrimaryPage(pages: readonly unknown[], browserPathname: string, basePath?: string): PreviewPrimaryPage | null;
|
|
11
|
+
/** Self-contained, public read provenance. No token, content value or private graph. */
|
|
12
|
+
export declare function encodePreviewReadCarrier(frameId: string, sidecar: PublicProvenanceSidecar, marker: PublicSidecarMarker, primaryPage?: PreviewPrimaryPage): string;
|
|
13
|
+
/**
|
|
14
|
+
* Shape decoding only. Consumers must normalize the sidecar and validate the
|
|
15
|
+
* read context against the authorized view. Kept closed over no module state so
|
|
16
|
+
* the same implementation can be embedded in the zero-dependency browser runtime.
|
|
17
|
+
*/
|
|
18
|
+
export declare function decodePreviewReadCarrier(value: unknown): {
|
|
19
|
+
frameId: string;
|
|
20
|
+
sidecar: PublicProvenanceSidecar;
|
|
21
|
+
primaryPage?: PreviewPrimaryPage;
|
|
22
|
+
} | null;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Select only unambiguous metadata for the route actually rendered. Closed over
|
|
2
|
+
* no module state so the same rule runs in the injected reporter and Studio return link. */
|
|
3
|
+
export function selectPreviewPrimaryPage(pages, browserPathname, basePath = '') {
|
|
4
|
+
const base = basePath.replace(/\/$/, '');
|
|
5
|
+
const pathname = base && (browserPathname === base || browserPathname.startsWith(base + '/'))
|
|
6
|
+
? browserPathname.slice(base.length) || '/' : browserPathname;
|
|
7
|
+
const canonical = (path) => new URL(path, 'https://preview.invalid').pathname.replace(/\/$/, '') || '/';
|
|
8
|
+
let selected = null;
|
|
9
|
+
for (const value of pages) {
|
|
10
|
+
const page = value;
|
|
11
|
+
if (!page || typeof page.documentId !== 'string' || !page.documentId || page.documentId.length > 180 ||
|
|
12
|
+
typeof page.locale !== 'string' || !page.locale || page.locale.length > 100 || typeof page.publicPathname !== 'string' ||
|
|
13
|
+
!page.publicPathname.startsWith('/') || page.publicPathname.startsWith('//') || /[\\?#\u0000-\u0020]/.test(page.publicPathname))
|
|
14
|
+
return null;
|
|
15
|
+
if (canonical(page.publicPathname) !== canonical(pathname))
|
|
16
|
+
continue;
|
|
17
|
+
if (selected && (selected.documentId !== page.documentId || selected.locale !== page.locale))
|
|
18
|
+
return null;
|
|
19
|
+
selected = page;
|
|
20
|
+
}
|
|
21
|
+
return selected;
|
|
22
|
+
}
|
|
23
|
+
/** Self-contained, public read provenance. No token, content value or private graph. */
|
|
24
|
+
export function encodePreviewReadCarrier(frameId, sidecar, marker, primaryPage) {
|
|
25
|
+
const dependency = sidecar.dependencySet;
|
|
26
|
+
const value = [frameId, sidecar.codeVersion, sidecar.variantId ?? null,
|
|
27
|
+
sidecar.renderId, sidecar.renderNonce, sidecar.emissionRevision,
|
|
28
|
+
dependency?.readContext ?? null, dependency?.receiptIds ?? [],
|
|
29
|
+
dependency?.renderWatermark ?? null, dependency?.sessionId ?? null,
|
|
30
|
+
sidecar.previewScope ?? null,
|
|
31
|
+
[marker.markerId, marker.editLocator ?? null, marker.modality, marker.anchorKind,
|
|
32
|
+
marker.renderedTextFingerprint ?? null], primaryPage ?? null];
|
|
33
|
+
const bytes = new TextEncoder().encode(JSON.stringify(value));
|
|
34
|
+
let binary = '';
|
|
35
|
+
for (const byte of bytes)
|
|
36
|
+
binary += String.fromCharCode(byte);
|
|
37
|
+
const result = 'ssr1.' + btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
|
|
38
|
+
if (result.length > 32_768)
|
|
39
|
+
throw new Error('Preview read carrier exceeds its size limit.');
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Shape decoding only. Consumers must normalize the sidecar and validate the
|
|
44
|
+
* read context against the authorized view. Kept closed over no module state so
|
|
45
|
+
* the same implementation can be embedded in the zero-dependency browser runtime.
|
|
46
|
+
*/
|
|
47
|
+
export function decodePreviewReadCarrier(value) {
|
|
48
|
+
if (typeof value !== 'string' || !value.startsWith('ssr1.') || value.length > 32_768)
|
|
49
|
+
return null;
|
|
50
|
+
try {
|
|
51
|
+
const binary = atob(value.slice(5).replace(/-/g, '+').replace(/_/g, '/'));
|
|
52
|
+
const text = decodeURIComponent(Array.from(binary, char => '%' + char.charCodeAt(0).toString(16).padStart(2, '0')).join(''));
|
|
53
|
+
const row = JSON.parse(text);
|
|
54
|
+
if (!Array.isArray(row) || row.length !== 13 ||
|
|
55
|
+
![row[0], row[1], row[3], row[4]].every(part => typeof part === 'string' && part.length > 0 && part.length <= 512) ||
|
|
56
|
+
!Number.isSafeInteger(row[5]) || row[5] <= 0 ||
|
|
57
|
+
!Array.isArray(row[7]) || row[7].length > 64 ||
|
|
58
|
+
!row[7].every((id) => typeof id === 'string' && id.length <= 512) ||
|
|
59
|
+
!Array.isArray(row[11]) || row[11].length !== 5)
|
|
60
|
+
return null;
|
|
61
|
+
const [frameId, codeVersion, variantId, renderId, renderNonce, emissionRevision, readContext, receiptIds, renderWatermark, sessionId, previewScope, marker, primaryPage] = row;
|
|
62
|
+
if (primaryPage !== null && (!primaryPage || typeof primaryPage !== 'object' ||
|
|
63
|
+
typeof primaryPage.documentId !== 'string' || !primaryPage.documentId || primaryPage.documentId.length > 180 ||
|
|
64
|
+
typeof primaryPage.locale !== 'string' || !primaryPage.locale || primaryPage.locale.length > 100 ||
|
|
65
|
+
typeof primaryPage.publicPathname !== 'string' || primaryPage.publicPathname.length > 8192 ||
|
|
66
|
+
!primaryPage.publicPathname.startsWith('/') || primaryPage.publicPathname.startsWith('//') ||
|
|
67
|
+
/[\\?#\u0000-\u0020]/.test(primaryPage.publicPathname)))
|
|
68
|
+
return null;
|
|
69
|
+
const routeHash = 'occurrence:' + frameId;
|
|
70
|
+
return { frameId, ...(primaryPage ? { primaryPage } : {}), sidecar: {
|
|
71
|
+
type: 'storystick.preview.public-sidecar', version: 1,
|
|
72
|
+
routeHash, codeVersion, renderId, renderNonce, emissionRevision, generation: 1,
|
|
73
|
+
...(variantId ? { variantId } : {}),
|
|
74
|
+
...(previewScope ? { previewScope } : {}),
|
|
75
|
+
dependencySet: {
|
|
76
|
+
type: 'storystick.preview.frame-dependency-set', version: 1,
|
|
77
|
+
frameId, routeHash, codeVersion, renderId, generation: 1,
|
|
78
|
+
...(sessionId ? { sessionId } : {}),
|
|
79
|
+
...(readContext === null ? {} : { readContext }),
|
|
80
|
+
...(variantId ? { variantId } : {}),
|
|
81
|
+
receiptIds, ...(renderWatermark === null ? {} : { renderWatermark }), dependencies: [],
|
|
82
|
+
},
|
|
83
|
+
markers: [{ markerId: marker[0], ...(marker[1] ? { editLocator: marker[1] } : {}),
|
|
84
|
+
modality: marker[2], anchorKind: marker[3], anchorMultiplicity: 'multi', presence: 'optional',
|
|
85
|
+
...(marker[4] ? { renderedTextFingerprint: marker[4] } : {}),
|
|
86
|
+
}],
|
|
87
|
+
} };
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type PreviewReadScopeEcho } from '@storystick/client/internal';
|
|
2
|
+
import type { PreviewReadContext } from '@storystick/types/preview-query-targeting';
|
|
3
|
+
import type { MarkerRecord, PreviewProvenanceCarrierPlan, ProvenanceFrame, SourceSet } from './types.js';
|
|
4
|
+
export interface ProvenanceRecorderOptions {
|
|
5
|
+
readonly sessionId?: string;
|
|
6
|
+
readonly readContext?: PreviewReadContext;
|
|
7
|
+
readonly routeHash: string;
|
|
8
|
+
readonly codeVersion: string;
|
|
9
|
+
readonly variantId?: string | null;
|
|
10
|
+
readonly previewScope?: PreviewReadScopeEcho;
|
|
11
|
+
readonly renderId: string;
|
|
12
|
+
readonly generation: number;
|
|
13
|
+
readonly renderNonce?: string;
|
|
14
|
+
readonly emissionRevision?: number;
|
|
15
|
+
readonly enabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface MarkOptions {
|
|
18
|
+
readonly modality: MarkerRecord['modality'];
|
|
19
|
+
readonly anchorKind: MarkerRecord['anchorKind'];
|
|
20
|
+
readonly carrierPlans?: readonly PreviewProvenanceCarrierPlan[];
|
|
21
|
+
readonly anchorMultiplicity?: MarkerRecord['anchorMultiplicity'];
|
|
22
|
+
readonly presence?: MarkerRecord['presence'];
|
|
23
|
+
readonly renderedText?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface RegisteredMark {
|
|
26
|
+
readonly markerId: string | null;
|
|
27
|
+
readonly sourceSetId: string;
|
|
28
|
+
readonly attrs: Readonly<Record<string, string>>;
|
|
29
|
+
readonly carrierPlans: readonly PreviewProvenanceCarrierPlan[];
|
|
30
|
+
}
|
|
31
|
+
export declare class ProvenanceRecorder {
|
|
32
|
+
private readonly options;
|
|
33
|
+
private readonly sourceSets;
|
|
34
|
+
private readonly markers;
|
|
35
|
+
constructor(options: ProvenanceRecorderOptions);
|
|
36
|
+
mark(sourceSet: SourceSet, options: MarkOptions): Promise<RegisteredMark>;
|
|
37
|
+
flush(): ProvenanceFrame;
|
|
38
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createDirectEditMarkerId } from './markers.js';
|
|
2
|
+
import { fingerprintRenderedText } from './normalize.js';
|
|
3
|
+
import { normalizePreviewVariantId } from '../identity/preview-identity.js';
|
|
4
|
+
import { attrsForPreviewProvenanceCarrierPlans, createPreviewProvenanceAttributeCarrierPlan, } from './carrier-plan.js';
|
|
5
|
+
export class ProvenanceRecorder {
|
|
6
|
+
options;
|
|
7
|
+
sourceSets = new Map();
|
|
8
|
+
markers = [];
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
}
|
|
12
|
+
async mark(sourceSet, options) {
|
|
13
|
+
const carrierPlans = options.carrierPlans ?? [
|
|
14
|
+
createPreviewProvenanceAttributeCarrierPlan({
|
|
15
|
+
modality: options.modality,
|
|
16
|
+
anchorKind: options.anchorKind,
|
|
17
|
+
}),
|
|
18
|
+
];
|
|
19
|
+
if (this.options.enabled === false) {
|
|
20
|
+
return {
|
|
21
|
+
markerId: null,
|
|
22
|
+
sourceSetId: sourceSet.id,
|
|
23
|
+
attrs: {},
|
|
24
|
+
carrierPlans,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
this.sourceSets.set(sourceSet.id, sourceSet);
|
|
28
|
+
const markerId = await createDirectEditMarkerId({
|
|
29
|
+
...(this.options.sessionId ? { sessionId: this.options.sessionId } : {}),
|
|
30
|
+
...(this.options.readContext ? { readContext: this.options.readContext } : {}),
|
|
31
|
+
routeHash: this.options.routeHash,
|
|
32
|
+
codeVersion: this.options.codeVersion,
|
|
33
|
+
variantId: this.options.variantId,
|
|
34
|
+
renderId: this.options.renderId,
|
|
35
|
+
sourceSetId: sourceSet.id,
|
|
36
|
+
});
|
|
37
|
+
this.markers.push({
|
|
38
|
+
markerId,
|
|
39
|
+
sourceSetId: sourceSet.id,
|
|
40
|
+
modality: options.modality,
|
|
41
|
+
anchorKind: options.anchorKind,
|
|
42
|
+
carrierPlans,
|
|
43
|
+
anchorMultiplicity: options.anchorMultiplicity,
|
|
44
|
+
presence: options.presence,
|
|
45
|
+
renderedTextFingerprint: options.renderedText === undefined
|
|
46
|
+
? undefined
|
|
47
|
+
: fingerprintRenderedText(options.renderedText),
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
markerId,
|
|
51
|
+
sourceSetId: sourceSet.id,
|
|
52
|
+
attrs: attrsForPreviewProvenanceCarrierPlans(markerId, carrierPlans),
|
|
53
|
+
carrierPlans,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
flush() {
|
|
57
|
+
return {
|
|
58
|
+
type: 'storystick.preview.provenance-frame',
|
|
59
|
+
version: 1,
|
|
60
|
+
...(this.options.sessionId ? { sessionId: this.options.sessionId } : {}),
|
|
61
|
+
...(this.options.readContext ? { readContext: this.options.readContext } : {}),
|
|
62
|
+
routeHash: this.options.routeHash,
|
|
63
|
+
codeVersion: this.options.codeVersion,
|
|
64
|
+
...(normalizePreviewVariantId(this.options.variantId) !== null
|
|
65
|
+
? { variantId: normalizePreviewVariantId(this.options.variantId) }
|
|
66
|
+
: {}),
|
|
67
|
+
...(this.options.previewScope !== undefined
|
|
68
|
+
? { previewScope: this.options.previewScope }
|
|
69
|
+
: {}),
|
|
70
|
+
renderId: this.options.renderId,
|
|
71
|
+
generation: this.options.generation,
|
|
72
|
+
...(this.options.renderNonce !== undefined
|
|
73
|
+
? { renderNonce: this.options.renderNonce }
|
|
74
|
+
: {}),
|
|
75
|
+
...(this.options.emissionRevision !== undefined
|
|
76
|
+
? { emissionRevision: this.options.emissionRevision }
|
|
77
|
+
: {}),
|
|
78
|
+
sourceSets: [...this.sourceSets.values()],
|
|
79
|
+
markers: [...this.markers],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type PreviewReadContext } from '@storystick/types/preview-query-targeting';
|
|
2
|
+
export type PreviewProvenanceAttrs = Readonly<Record<string, string | boolean>>;
|
|
3
|
+
export type PreviewProvenanceAttrsByKey = Readonly<Record<string, PreviewProvenanceAttrs>>;
|
|
4
|
+
export type PreviewProvenanceFields = Readonly<Record<string, PreviewProvenanceAttrs>>;
|
|
5
|
+
export type PreviewProvenanceArrays = Readonly<Record<string, Readonly<Record<string, PreviewProvenanceFields>>>>;
|
|
6
|
+
export type PreviewProvenancePaths = Readonly<Record<string, PreviewProvenanceAttrs>>;
|
|
7
|
+
export interface PreviewProvenanceFieldSegment {
|
|
8
|
+
readonly type: 'field';
|
|
9
|
+
readonly name: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PreviewProvenanceArrayItemSegment {
|
|
12
|
+
readonly type: 'arrayItem';
|
|
13
|
+
readonly field: string;
|
|
14
|
+
readonly key: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PreviewProvenanceRichTextTextNodeSegment {
|
|
17
|
+
readonly type: 'richTextTextNode';
|
|
18
|
+
readonly index: number;
|
|
19
|
+
}
|
|
20
|
+
export type PreviewProvenancePathSegment = PreviewProvenanceFieldSegment | PreviewProvenanceArrayItemSegment | PreviewProvenanceRichTextTextNodeSegment;
|
|
21
|
+
export type PreviewProvenancePath = readonly PreviewProvenancePathSegment[];
|
|
22
|
+
export interface PreviewProvenanceSliceKey {
|
|
23
|
+
readonly _key: string;
|
|
24
|
+
}
|
|
25
|
+
export interface PreviewProvenanceDocumentKey {
|
|
26
|
+
readonly documentId: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SliceProvenance {
|
|
29
|
+
readonly fields: PreviewProvenanceFields;
|
|
30
|
+
readonly arrays: PreviewProvenanceArrays;
|
|
31
|
+
readonly paths: PreviewProvenancePaths;
|
|
32
|
+
}
|
|
33
|
+
export interface DocumentProvenance {
|
|
34
|
+
readonly fields: PreviewProvenanceFields;
|
|
35
|
+
readonly paths: PreviewProvenancePaths;
|
|
36
|
+
}
|
|
37
|
+
export interface PreviewProvenancePathCarrier {
|
|
38
|
+
readonly paths: PreviewProvenancePaths;
|
|
39
|
+
}
|
|
40
|
+
export interface PreviewProvenanceContext {
|
|
41
|
+
readonly __ssPreviewProvenance?: {
|
|
42
|
+
readonly attrsByKey: PreviewProvenanceAttrsByKey;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface PreviewProvenanceRouteFrameContext {
|
|
46
|
+
readonly type: 'storystick.preview.route-frame';
|
|
47
|
+
readonly version: 1;
|
|
48
|
+
readonly frameId: string;
|
|
49
|
+
readonly sessionId?: string;
|
|
50
|
+
readonly routeHash: string;
|
|
51
|
+
readonly publicSidecar: PreviewProvenancePublicSidecar | null;
|
|
52
|
+
}
|
|
53
|
+
export interface PreviewProvenanceRouteFrameCarrier {
|
|
54
|
+
readonly __ssPreviewRouteFrame?: PreviewProvenanceRouteFrameContext;
|
|
55
|
+
}
|
|
56
|
+
export interface PreviewProvenanceRouteRenderContext {
|
|
57
|
+
readonly type: 'storystick.preview.route-render';
|
|
58
|
+
readonly version: 1;
|
|
59
|
+
readonly frame: PreviewProvenanceRouteFrameContext;
|
|
60
|
+
readonly document: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
export interface PreviewProvenanceRouteRenderCarrier {
|
|
63
|
+
readonly __ssPreviewRouteRender?: PreviewProvenanceRouteRenderContext;
|
|
64
|
+
}
|
|
65
|
+
export interface PreviewProvenancePublicSidecarMarker {
|
|
66
|
+
readonly markerId: string;
|
|
67
|
+
readonly modality?: string;
|
|
68
|
+
readonly anchorKind?: string;
|
|
69
|
+
readonly anchorMultiplicity?: string;
|
|
70
|
+
readonly presence?: string;
|
|
71
|
+
readonly renderedTextFingerprint?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface PreviewProvenancePublicSidecar {
|
|
74
|
+
readonly dependencySet?: {
|
|
75
|
+
readonly readContext?: PreviewReadContext;
|
|
76
|
+
readonly receiptIds?: readonly string[];
|
|
77
|
+
};
|
|
78
|
+
readonly type: 'storystick.preview.public-sidecar';
|
|
79
|
+
readonly version: number;
|
|
80
|
+
readonly routeHash: string;
|
|
81
|
+
readonly codeVersion: string;
|
|
82
|
+
readonly renderId: string;
|
|
83
|
+
readonly generation: number;
|
|
84
|
+
readonly renderNonce?: string;
|
|
85
|
+
readonly routeRenderNonce?: string;
|
|
86
|
+
readonly emissionRevision?: number;
|
|
87
|
+
readonly markers: readonly PreviewProvenancePublicSidecarMarker[];
|
|
88
|
+
}
|
|
89
|
+
export declare function serializePreviewProvenanceSidecar(sidecar: PreviewProvenancePublicSidecar): string;
|
|
90
|
+
export declare function withPreviewProvenanceContext(context: unknown, attrsByKey: PreviewProvenanceAttrsByKey | null | undefined): unknown;
|
|
91
|
+
export declare function withPreviewProvenanceRouteFrame<T>(value: T, frame: PreviewProvenanceRouteFrameContext | null | undefined): T;
|
|
92
|
+
export declare function readPreviewProvenanceRouteFrame(value: unknown): PreviewProvenanceRouteFrameContext | null;
|
|
93
|
+
export declare function withPreviewProvenanceRouteRender<T>(value: T, render: PreviewProvenanceRouteRenderContext | null | undefined): T;
|
|
94
|
+
export declare function readPreviewProvenanceRouteRender(value: unknown): PreviewProvenanceRouteRenderContext | null;
|
|
95
|
+
export declare function previewProvenanceAttrs(context: unknown, key: string): PreviewProvenanceAttrs;
|
|
96
|
+
export declare function buildSliceProvenance(context: unknown, slice: PreviewProvenanceSliceKey): SliceProvenance | undefined;
|
|
97
|
+
export declare function buildDocumentProvenance(context: unknown, document: PreviewProvenanceDocumentKey): DocumentProvenance | undefined;
|
|
98
|
+
export declare function fieldSegment(name: string): PreviewProvenanceFieldSegment;
|
|
99
|
+
export declare function arrayItemSegment(field: string, key: string): PreviewProvenanceArrayItemSegment;
|
|
100
|
+
export declare function richTextTextNodeSegment(index: number): PreviewProvenanceRichTextTextNodeSegment;
|
|
101
|
+
export declare function previewPathKey(path: PreviewProvenancePath): string;
|
|
102
|
+
export declare function slicePathKey(slice: PreviewProvenanceSliceKey, path: PreviewProvenancePath): string;
|
|
103
|
+
export declare function sliceFieldKey(slice: PreviewProvenanceSliceKey, field: string): string;
|
|
104
|
+
export declare function sliceArrayFieldKey(slice: PreviewProvenanceSliceKey, arrayName: string, itemKey: string, field: string): string;
|
|
105
|
+
export declare function documentPathKey(document: PreviewProvenanceDocumentKey, path: PreviewProvenancePath): string;
|
|
106
|
+
export declare function documentFieldKey(document: PreviewProvenanceDocumentKey, field: string): string;
|