@altertable/data-app 0.72.0 → 0.74.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 (112) hide show
  1. package/AGENTS.md +5 -61
  2. package/CONTRIBUTING.md +130 -181
  3. package/README.md +3 -4
  4. package/REFERENCE.md +35 -345
  5. package/dist/chunks/contract-BeLPJwlO.js +558 -0
  6. package/dist/chunks/contract-BeLPJwlO.js.map +1 -0
  7. package/dist/chunks/contract-Di8SP74I.js +462 -0
  8. package/dist/chunks/contract-Di8SP74I.js.map +1 -0
  9. package/dist/chunks/diagnostics-BTZSlNtW.js +967 -0
  10. package/dist/chunks/diagnostics-BTZSlNtW.js.map +1 -0
  11. package/dist/chunks/format-BdFlv_xa.js +148 -0
  12. package/dist/chunks/format-BdFlv_xa.js.map +1 -0
  13. package/dist/chunks/operation-CSM9UmO3.js +134 -0
  14. package/dist/chunks/operation-CSM9UmO3.js.map +1 -0
  15. package/dist/chunks/request-body-H1qPmmTN.js +50 -0
  16. package/dist/chunks/request-body-H1qPmmTN.js.map +1 -0
  17. package/dist/client/index.js +273 -285
  18. package/dist/client/index.js.map +1 -13
  19. package/dist/core/appearance.js +171 -162
  20. package/dist/core/appearance.js.map +1 -10
  21. package/dist/core/config.js +49 -11
  22. package/dist/core/config.js.map +1 -9
  23. package/dist/core/contract.js +3 -73
  24. package/dist/core/format.js +1 -26
  25. package/dist/index.js +1 -12
  26. package/dist/internal.js +352 -397
  27. package/dist/internal.js.map +1 -15
  28. package/dist/server/index.js +85 -97
  29. package/dist/server/index.js.map +1 -10
  30. package/dist/types/chunks/appearance.d.ts +45 -0
  31. package/dist/types/chunks/contract.d.ts +720 -0
  32. package/dist/types/chunks/index.d.ts +240 -0
  33. package/dist/types/client/index.d.ts +3 -13
  34. package/dist/types/core/appearance.d.ts +2 -42
  35. package/dist/types/core/config.d.ts +36 -39
  36. package/dist/types/core/contract.d.ts +2 -114
  37. package/dist/types/core/format.d.ts +44 -17
  38. package/dist/types/index.d.ts +3 -3
  39. package/dist/types/internal.d.ts +312 -22
  40. package/dist/types/server/index.d.ts +15 -4
  41. package/docs/app-authoring.md +77 -128
  42. package/docs/client.md +29 -63
  43. package/docs/composition.md +44 -75
  44. package/docs/contract.md +60 -100
  45. package/docs/data-context.md +35 -61
  46. package/docs/diagnostics.md +45 -0
  47. package/docs/embed.md +86 -55
  48. package/docs/formatting-and-appearance.md +17 -38
  49. package/docs/hosted-apps.md +7 -14
  50. package/docs/layout.md +30 -47
  51. package/docs/local-data-apps.md +7 -7
  52. package/docs/react-embed.md +20 -26
  53. package/docs/react.md +10 -27
  54. package/docs/server-bun.md +2 -27
  55. package/docs/server.md +6 -12
  56. package/docs/stories-and-export.md +38 -40
  57. package/docs/styling.md +14 -22
  58. package/docs/ui-quality.md +5 -5
  59. package/docs/ui.md +93 -70
  60. package/docs/variables.md +142 -254
  61. package/docs/views.md +85 -116
  62. package/docs/widgets.md +100 -153
  63. package/docs/worker.md +15 -27
  64. package/package.json +3 -2
  65. package/dist/chunks/index-5a27erdg.js +0 -54
  66. package/dist/chunks/index-5a27erdg.js.map +0 -10
  67. package/dist/chunks/index-9yxr7nmm.js +0 -742
  68. package/dist/chunks/index-9yxr7nmm.js.map +0 -17
  69. package/dist/chunks/index-j5q5n3ra.js +0 -151
  70. package/dist/chunks/index-j5q5n3ra.js.map +0 -10
  71. package/dist/chunks/index-q75zm3a7.js +0 -153
  72. package/dist/chunks/index-q75zm3a7.js.map +0 -11
  73. package/dist/chunks/index-vhaec7m5.js +0 -30
  74. package/dist/chunks/index-vhaec7m5.js.map +0 -10
  75. package/dist/chunks/index-zp78caex.js +0 -1047
  76. package/dist/chunks/index-zp78caex.js.map +0 -19
  77. package/dist/core/contract.js.map +0 -9
  78. package/dist/core/format.js.map +0 -9
  79. package/dist/index.js.map +0 -9
  80. package/dist/types/client/annotations.d.ts +0 -27
  81. package/dist/types/client/data-client.d.ts +0 -43
  82. package/dist/types/client/download.d.ts +0 -5
  83. package/dist/types/client/iframe.d.ts +0 -59
  84. package/dist/types/client/location.d.ts +0 -13
  85. package/dist/types/client/logger.d.ts +0 -14
  86. package/dist/types/client/messages.d.ts +0 -7
  87. package/dist/types/client/navigation.d.ts +0 -15
  88. package/dist/types/client/transport.d.ts +0 -15
  89. package/dist/types/core/annotations.d.ts +0 -99
  90. package/dist/types/core/bridge-endpoint.d.ts +0 -21
  91. package/dist/types/core/bridge.d.ts +0 -172
  92. package/dist/types/core/data-view.d.ts +0 -46
  93. package/dist/types/core/date-format.d.ts +0 -24
  94. package/dist/types/core/date-range.d.ts +0 -20
  95. package/dist/types/core/dimension-source.d.ts +0 -64
  96. package/dist/types/core/dimension.d.ts +0 -71
  97. package/dist/types/core/facets.d.ts +0 -13
  98. package/dist/types/core/filters.d.ts +0 -45
  99. package/dist/types/core/invariant.d.ts +0 -2
  100. package/dist/types/core/keys.d.ts +0 -2
  101. package/dist/types/core/logger.d.ts +0 -12
  102. package/dist/types/core/messages.d.ts +0 -62
  103. package/dist/types/core/navigation.d.ts +0 -11
  104. package/dist/types/core/operation-types.d.ts +0 -80
  105. package/dist/types/core/operation.d.ts +0 -20
  106. package/dist/types/core/presentation.d.ts +0 -9
  107. package/dist/types/core/queries.d.ts +0 -84
  108. package/dist/types/core/reading.d.ts +0 -17
  109. package/dist/types/core/uuid.d.ts +0 -2
  110. package/dist/types/core/variables.d.ts +0 -133
  111. package/dist/types/server/handler.d.ts +0 -13
  112. package/dist/types/server/request-body.d.ts +0 -4
@@ -1,301 +1,289 @@
1
- import"../chunks/index-q75zm3a7.js";
2
- import {
3
- withDimensionSelectors,
4
- validLocation,
5
- MessageRoutingError2,
6
- defineDataQueryRoute2,
7
- navigationUpdateRoute2,
8
- annotationDraftRoute2,
9
- annotationEditorStateRoute2,
10
- annotationSendRoute2,
11
- annotationUpdateRoute2,
12
- annotationModeRoute2
13
- } from "../chunks/index-zp78caex.js";
14
- import {
15
- randomUuid2,
16
- DataAppError2,
17
- createHttpTransport2,
18
- PARENT_PARAM2,
19
- createMessageClient2,
20
- createIframeTransport2,
21
- localFrameBridge2,
22
- installDataAppTransport2,
23
- getDataAppTransport2
24
- } from "../chunks/index-9yxr7nmm.js";
25
- import {
26
- executeDataOperation,
27
- toDataOperationFailure2
28
- } from "../chunks/index-j5q5n3ra.js";
29
-
30
- // packages/data-app/src/client/data-client.ts
1
+ import { h as withDimensionSelectors } from "../chunks/contract-BeLPJwlO.js";
2
+ import { a as annotationSendRoute, f as defineDataQueryRoute, g as validLocation, i as annotationModeRoute, l as MessageRoutingError, m as navigationUpdateRoute, n as annotationDraftRoute, o as annotationUpdateRoute, r as annotationEditorStateRoute } from "../chunks/contract-Di8SP74I.js";
3
+ import { n as toDataOperationFailure, t as executeDataOperation } from "../chunks/operation-CSM9UmO3.js";
4
+ import { a as localFrameBridge, c as createMessageClient, f as PARENT_PARAM, g as randomUuid, i as installDataAppTransport, n as createIframeTransport, o as DataAppError, r as getDataAppTransport, s as createHttpTransport, t as appDiagnostics } from "../chunks/diagnostics-BTZSlNtW.js";
5
+ //#region src/client/data-client.ts
6
+ /** The factory is the only place that grants a client its invariant contract witness. */
31
7
  function typedClient(implementation) {
32
- return implementation;
8
+ const query = implementation.query;
9
+ implementation.query = async (name, input, options) => {
10
+ const end = appDiagnostics.begin();
11
+ try {
12
+ const result = await query(name, input, options);
13
+ appDiagnostics.clear("operation", name);
14
+ return result;
15
+ } catch (error) {
16
+ if (!options?.signal?.aborted) appDiagnostics.record("operation", name, error instanceof Error && error.cause instanceof Error ? error.cause : error);
17
+ throw error;
18
+ } finally {
19
+ end();
20
+ }
21
+ };
22
+ return implementation;
33
23
  }
34
- var dataQueryRoute = defineDataQueryRoute2();
24
+ const dataQueryRoute = defineDataQueryRoute();
35
25
  function createDataClient(options = {}) {
36
- if (options.operations)
37
- return createOperationClient({
38
- operations: withDimensionSelectors(options.operations),
39
- lakehouse: options.lakehouse
40
- });
41
- const http = createHttpTransport2(options);
42
- const useHttp = options.endpoint !== undefined || options.fetch !== undefined;
43
- return typedClient({
44
- async query(name, input, { signal } = {}) {
45
- const transport = options.transport ?? (useHttp ? http : localFrameBridge2()?.transport ?? http);
46
- const response = await transport(name, input, signal);
47
- const ok = response.status >= 200 && response.status < 300;
48
- let body;
49
- try {
50
- body = dataQueryRoute.output(response, { operation: name, input }).body;
51
- } catch (error) {
52
- if (signal?.aborted)
53
- throw error;
54
- if (error instanceof MessageRoutingError2)
55
- throw new DataAppError2(error.message, error.code, error.requestId);
56
- throw new DataAppError2(ok ? "The data response was invalid." : "Could not load data.", ok ? "invalid_response" : "request_failed");
57
- }
58
- return { ...body, input };
59
- }
60
- });
26
+ if (options.operations) return createOperationClient({
27
+ operations: withDimensionSelectors(options.operations),
28
+ lakehouse: options.lakehouse
29
+ });
30
+ const http = createHttpTransport(options);
31
+ const useHttp = options.endpoint !== void 0 || options.fetch !== void 0;
32
+ return typedClient({ async query(name, input, { signal } = {}) {
33
+ const response = await (options.transport ?? (useHttp ? http : localFrameBridge()?.transport ?? http))(name, input, signal);
34
+ const ok = response.status >= 200 && response.status < 300;
35
+ let body;
36
+ try {
37
+ body = dataQueryRoute.output(response, {
38
+ operation: name,
39
+ input
40
+ }).body;
41
+ } catch (error) {
42
+ if (signal?.aborted) throw error;
43
+ if (error instanceof MessageRoutingError) throw new DataAppError(error.message, error.code, error.requestId);
44
+ throw new DataAppError(ok ? "The data response was invalid." : "Could not load data.", ok ? "invalid_response" : "request_failed");
45
+ }
46
+ return {
47
+ ...body,
48
+ input
49
+ };
50
+ } });
61
51
  }
62
52
  function createOperationClient(options) {
63
- const operations = Object.freeze({ ...options.operations });
64
- return typedClient({
65
- async query(name, input, { signal } = {}) {
66
- signal?.throwIfAborted();
67
- const requestId = randomUuid2();
68
- if (!Object.hasOwn(operations, name))
69
- throw new DataAppError2("Unknown data operation.", "not_found", requestId);
70
- const lakehouse = options.lakehouse ?? (typeof window === "undefined" ? undefined : getDataAppTransport2()?.lakehouse);
71
- if (!lakehouse)
72
- throw new DataAppError2("An authorized SQL bridge must be installed first.", "bridge_unavailable", requestId);
73
- try {
74
- const { body } = await executeDataOperation(operations[name], input, {
75
- lakehouse,
76
- signal: signal ?? new AbortController().signal,
77
- requestId,
78
- operationName: name
79
- });
80
- return { ...body, input };
81
- } catch (error) {
82
- if (signal?.aborted)
83
- throw signal.reason;
84
- if (error instanceof DataAppError2)
85
- throw error;
86
- const failure = toDataOperationFailure2(error);
87
- throw new DataAppError2(failure.message, failure.code, requestId);
88
- }
89
- }
90
- });
53
+ const operations = Object.freeze({ ...options.operations });
54
+ return typedClient({ async query(name, input, { signal } = {}) {
55
+ signal?.throwIfAborted();
56
+ const requestId = randomUuid();
57
+ if (!Object.hasOwn(operations, name)) throw new DataAppError("Unknown data operation.", "not_found", requestId);
58
+ const lakehouse = options.lakehouse ?? (typeof window === "undefined" ? void 0 : getDataAppTransport()?.lakehouse);
59
+ if (!lakehouse) throw new DataAppError("An authorized SQL bridge must be installed first.", "bridge_unavailable", requestId);
60
+ try {
61
+ const { body } = await executeDataOperation(operations[name], input, {
62
+ lakehouse,
63
+ signal: signal ?? new AbortController().signal,
64
+ requestId,
65
+ operationName: name,
66
+ onQuery(queryName, error) {
67
+ if (error === void 0) appDiagnostics.clear("query", `${name}: ${queryName}`);
68
+ else appDiagnostics.record("query", `${name}: ${queryName}`, error);
69
+ }
70
+ });
71
+ return {
72
+ ...body,
73
+ input
74
+ };
75
+ } catch (error) {
76
+ if (signal?.aborted) throw signal.reason;
77
+ if (error instanceof DataAppError) throw error;
78
+ const failure = toDataOperationFailure(error);
79
+ const publicError = new DataAppError(failure.message, failure.code, requestId);
80
+ publicError.cause = error;
81
+ throw publicError;
82
+ }
83
+ } });
91
84
  }
92
- // packages/data-app/src/client/location.ts
85
+ //#endregion
86
+ //#region src/client/location.ts
87
+ /** Opaque sandboxes keep app state in memory; URL frames retain their real URL for HMR. */
93
88
  function createAppLocation(frame, virtual, publish) {
94
- let state = { search: "", hash: "" };
95
- let disposed = false;
96
- const listeners = new Set;
97
- function notify() {
98
- for (const listener of listeners)
99
- listener();
100
- }
101
- function snapshot() {
102
- if (virtual)
103
- return state;
104
- const url = new URL(frame.location.href);
105
- url.searchParams.delete(PARENT_PARAM2);
106
- if (state.search !== url.search || state.hash !== url.hash)
107
- state = { search: url.search, hash: url.hash };
108
- return state;
109
- }
110
- function apply(next) {
111
- const previous = snapshot();
112
- if (previous.search === next.search && previous.hash === next.hash)
113
- return;
114
- if (virtual)
115
- state = next;
116
- else {
117
- const url = new URL(frame.location.href);
118
- const parent = url.searchParams.get(PARENT_PARAM2);
119
- url.search = next.search;
120
- if (parent)
121
- url.searchParams.set(PARENT_PARAM2, parent);
122
- url.hash = next.hash;
123
- frame.history.replaceState(null, "", url);
124
- frame.dispatchEvent(new Event("popstate"));
125
- }
126
- if (virtual)
127
- notify();
128
- }
129
- const location = {
130
- snapshot,
131
- subscribe(listener) {
132
- listeners.add(listener);
133
- if (!virtual)
134
- frame.addEventListener("popstate", listener);
135
- return () => {
136
- listeners.delete(listener);
137
- frame.removeEventListener("popstate", listener);
138
- };
139
- },
140
- update(next, mode = "replace") {
141
- if (disposed)
142
- return;
143
- if (!validLocation(next))
144
- throw new Error("Invalid app location.");
145
- const before = snapshot();
146
- if (before.search === next.search && before.hash === next.hash)
147
- return;
148
- apply(next);
149
- publish(next, mode);
150
- }
151
- };
152
- function dispose() {
153
- disposed = true;
154
- for (const listener of listeners)
155
- frame.removeEventListener("popstate", listener);
156
- listeners.clear();
157
- }
158
- return { location, apply, dispose };
89
+ let state = {
90
+ search: "",
91
+ hash: ""
92
+ };
93
+ let disposed = false;
94
+ const listeners = /* @__PURE__ */ new Set();
95
+ function notify() {
96
+ for (const listener of listeners) listener();
97
+ }
98
+ function snapshot() {
99
+ if (virtual) return state;
100
+ const url = new URL(frame.location.href);
101
+ url.searchParams.delete(PARENT_PARAM);
102
+ if (state.search !== url.search || state.hash !== url.hash) state = {
103
+ search: url.search,
104
+ hash: url.hash
105
+ };
106
+ return state;
107
+ }
108
+ function apply(next) {
109
+ const previous = snapshot();
110
+ if (previous.search === next.search && previous.hash === next.hash) return;
111
+ if (virtual) state = next;
112
+ else {
113
+ const url = new URL(frame.location.href);
114
+ const parent = url.searchParams.get(PARENT_PARAM);
115
+ url.search = next.search;
116
+ if (parent) url.searchParams.set(PARENT_PARAM, parent);
117
+ url.hash = next.hash;
118
+ frame.history.replaceState(null, "", url);
119
+ frame.dispatchEvent(new Event("popstate"));
120
+ }
121
+ if (virtual) notify();
122
+ }
123
+ const location = {
124
+ snapshot,
125
+ subscribe(listener) {
126
+ listeners.add(listener);
127
+ if (!virtual) frame.addEventListener("popstate", listener);
128
+ return () => {
129
+ listeners.delete(listener);
130
+ frame.removeEventListener("popstate", listener);
131
+ };
132
+ },
133
+ update(next, mode = "replace") {
134
+ if (disposed) return;
135
+ if (!validLocation(next)) throw new Error("Invalid app location.");
136
+ const before = snapshot();
137
+ if (before.search === next.search && before.hash === next.hash) return;
138
+ apply(next);
139
+ publish(next, mode);
140
+ }
141
+ };
142
+ function dispose() {
143
+ disposed = true;
144
+ for (const listener of listeners) frame.removeEventListener("popstate", listener);
145
+ listeners.clear();
146
+ }
147
+ return {
148
+ location,
149
+ apply,
150
+ dispose
151
+ };
159
152
  }
160
-
161
- // packages/data-app/src/client/navigation.ts
162
- function createDataAppNavigation({
163
- bridge,
164
- window: frame = window
165
- }) {
166
- return attachNavigation(frame, bridge.mode === "bundle", bridge).navigation;
153
+ //#endregion
154
+ //#region src/client/navigation.ts
155
+ /** Attach app URL behavior to an already authenticated bridge. */
156
+ function createDataAppNavigation({ bridge, window: frame = window }) {
157
+ return attachNavigation(frame, bridge.mode === "bundle", bridge).navigation;
167
158
  }
168
159
  function attachNavigation(frame, virtual, connection) {
169
- let disposed = false;
170
- let unsubscribe;
171
- let send;
172
- let pendingUpdate;
173
- const { location, apply, dispose } = createAppLocation(frame, virtual, publish);
174
- function publish(location, mode) {
175
- const update = { ...location, mode, title: frame.document.title };
176
- if (send)
177
- send(update);
178
- else
179
- pendingUpdate = update;
180
- }
181
- function attach(bridge) {
182
- if (disposed)
183
- return;
184
- unsubscribe?.();
185
- const messages = createMessageClient2({ "navigation:update": navigationUpdateRoute2 }, bridge.request);
186
- function sendUpdate(update) {
187
- messages.request("navigation:update", update).catch(() => {});
188
- }
189
- function receiveState(state) {
190
- if (!validLocation(state))
191
- return;
192
- pendingUpdate = undefined;
193
- apply(state);
194
- }
195
- send = sendUpdate;
196
- unsubscribe = bridge.subscribe(receiveState);
197
- receiveState(bridge.snapshot());
198
- if (pendingUpdate) {
199
- sendUpdate(pendingUpdate);
200
- pendingUpdate = undefined;
201
- }
202
- }
203
- if ("then" in connection)
204
- connection.then(attach).catch(() => {});
205
- else
206
- attach(connection);
207
- const navigation = {
208
- ...location,
209
- publish(mode = "replace") {
210
- if (!disposed)
211
- publish(location.snapshot(), mode);
212
- },
213
- dispose() {
214
- disposed = true;
215
- unsubscribe?.();
216
- dispose();
217
- send = undefined;
218
- pendingUpdate = undefined;
219
- }
220
- };
221
- return {
222
- navigation,
223
- attach,
224
- isDisposed() {
225
- return disposed;
226
- }
227
- };
160
+ let disposed = false;
161
+ let unsubscribe;
162
+ let send;
163
+ let pendingUpdate;
164
+ const { location, apply, dispose } = createAppLocation(frame, virtual, publish);
165
+ function publish(location, mode) {
166
+ const update = {
167
+ ...location,
168
+ mode,
169
+ title: frame.document.title
170
+ };
171
+ if (send) send(update);
172
+ else pendingUpdate = update;
173
+ }
174
+ function attach(bridge) {
175
+ if (disposed) return;
176
+ unsubscribe?.();
177
+ const messages = createMessageClient({ "navigation:update": navigationUpdateRoute }, bridge.request);
178
+ function sendUpdate(update) {
179
+ messages.request("navigation:update", update).catch(() => {});
180
+ }
181
+ function receiveState(state) {
182
+ if (!validLocation(state)) return;
183
+ pendingUpdate = void 0;
184
+ apply(state);
185
+ }
186
+ send = sendUpdate;
187
+ unsubscribe = bridge.subscribe(receiveState);
188
+ receiveState(bridge.snapshot());
189
+ if (pendingUpdate) {
190
+ sendUpdate(pendingUpdate);
191
+ pendingUpdate = void 0;
192
+ }
193
+ }
194
+ if ("then" in connection) connection.then(attach).catch(() => {});
195
+ else attach(connection);
196
+ return {
197
+ navigation: {
198
+ ...location,
199
+ publish(mode = "replace") {
200
+ if (!disposed) publish(location.snapshot(), mode);
201
+ },
202
+ dispose() {
203
+ disposed = true;
204
+ unsubscribe?.();
205
+ dispose();
206
+ send = void 0;
207
+ pendingUpdate = void 0;
208
+ }
209
+ },
210
+ attach,
211
+ isDisposed() {
212
+ return disposed;
213
+ }
214
+ };
228
215
  }
229
- var navigationKey = Symbol.for("altertable.appNavigation");
216
+ const navigationKey = Symbol.for("altertable.appNavigation");
217
+ /** URL controls attach navigation on demand; bootstrap and data-only clients do not. */
230
218
  function getDataAppNavigation(frame = window) {
231
- const target = frame;
232
- const bridge = getDataAppTransport2(frame);
233
- const cached = target[navigationKey]?.isDisposed() ? undefined : target[navigationKey];
234
- if (cached) {
235
- if (bridge && cached.bridge !== bridge) {
236
- cached.attach(bridge);
237
- cached.bridge = bridge;
238
- }
239
- return cached.navigation;
240
- }
241
- if (bridge) {
242
- const adapter = attachNavigation(frame, bridge.mode === "bundle", bridge);
243
- target[navigationKey] = { bridge, ...adapter };
244
- return adapter.navigation;
245
- }
246
- const preview = localFrameBridge2(frame);
247
- if (!preview?.connect)
248
- return;
249
- const connection = preview.connect();
250
- const adapter = attachNavigation(frame, false, connection);
251
- const entry = {
252
- ...adapter,
253
- bridge: undefined
254
- };
255
- target[navigationKey] = entry;
256
- connection.then((bridge) => {
257
- entry.bridge = bridge;
258
- }).catch(() => {});
259
- return adapter.navigation;
219
+ const target = frame;
220
+ const bridge = getDataAppTransport(frame);
221
+ const cached = target[navigationKey]?.isDisposed() ? void 0 : target[navigationKey];
222
+ if (cached) {
223
+ if (bridge && cached.bridge !== bridge) {
224
+ cached.attach(bridge);
225
+ cached.bridge = bridge;
226
+ }
227
+ return cached.navigation;
228
+ }
229
+ if (bridge) {
230
+ const adapter = attachNavigation(frame, bridge.mode === "bundle", bridge);
231
+ target[navigationKey] = {
232
+ bridge,
233
+ ...adapter
234
+ };
235
+ return adapter.navigation;
236
+ }
237
+ const preview = localFrameBridge(frame);
238
+ if (!preview?.connect) return void 0;
239
+ const connection = preview.connect();
240
+ const adapter = attachNavigation(frame, false, connection);
241
+ const entry = {
242
+ ...adapter,
243
+ bridge: void 0
244
+ };
245
+ target[navigationKey] = entry;
246
+ connection.then((bridge) => {
247
+ entry.bridge = bridge;
248
+ }).catch(() => {});
249
+ return adapter.navigation;
260
250
  }
261
- // packages/data-app/src/client/annotations.ts
251
+ //#endregion
252
+ //#region src/client/annotations.ts
253
+ /** Deliver annotations to the authenticated host. Acknowledgement means retained, not sent to an agent. */
262
254
  function createAnnotationClient(transport) {
263
- const client = createMessageClient2({
264
- "annotation:draft": annotationDraftRoute2,
265
- "annotation:update": annotationUpdateRoute2,
266
- "annotation:mode": annotationModeRoute2,
267
- "annotation:editor": annotationEditorStateRoute2,
268
- "annotation:send": annotationSendRoute2
269
- }, transport);
270
- return {
271
- requestSendAnnotations(options) {
272
- return client.request("annotation:send", null, options);
273
- },
274
- reportAnnotationEditorState(state, options) {
275
- return client.request("annotation:editor", state, options);
276
- },
277
- addAnnotation(draft, options) {
278
- return client.request("annotation:draft", draft, options);
279
- },
280
- updateAnnotation(id, comment, options) {
281
- return client.request("annotation:update", { id, comment }, options);
282
- },
283
- requestAnnotationModeChange(request, options) {
284
- return client.request("annotation:mode", request, options);
285
- }
286
- };
255
+ const client = createMessageClient({
256
+ "annotation:draft": annotationDraftRoute,
257
+ "annotation:update": annotationUpdateRoute,
258
+ "annotation:mode": annotationModeRoute,
259
+ "annotation:editor": annotationEditorStateRoute,
260
+ "annotation:send": annotationSendRoute
261
+ }, transport);
262
+ return {
263
+ /** Ask the host to submit its saved annotations using its existing send guards. */
264
+ requestSendAnnotations(options) {
265
+ return client.request("annotation:send", null, options);
266
+ },
267
+ /** Report the iframe editor's status so the host can guard batch submission. */
268
+ reportAnnotationEditorState(state, options) {
269
+ return client.request("annotation:editor", state, options);
270
+ },
271
+ addAnnotation(draft, options) {
272
+ return client.request("annotation:draft", draft, options);
273
+ },
274
+ updateAnnotation(id, comment, options) {
275
+ return client.request("annotation:update", {
276
+ id,
277
+ comment
278
+ }, options);
279
+ },
280
+ /** Ask the host to change its controlled annotation mode. */
281
+ requestAnnotationModeChange(request, options) {
282
+ return client.request("annotation:mode", request, options);
283
+ }
284
+ };
287
285
  }
288
- export {
289
- DataAppError2 as DataAppError,
290
- createAnnotationClient,
291
- createDataAppNavigation,
292
- createDataClient,
293
- createHttpTransport2 as createHttpTransport,
294
- createIframeTransport2 as createIframeTransport,
295
- createMessageClient2 as createMessageClient,
296
- getDataAppNavigation,
297
- getDataAppTransport2 as getDataAppTransport,
298
- installDataAppTransport2 as installDataAppTransport
299
- };
286
+ //#endregion
287
+ export { DataAppError, appDiagnostics, createAnnotationClient, createDataAppNavigation, createDataClient, createHttpTransport, createIframeTransport, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport };
300
288
 
301
- //# debugId=5A1F9FC553D4FC1964756E2164756E21
289
+ //# sourceMappingURL=index.js.map