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