@altertable/data-app 0.65.0 → 0.67.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/AGENTS.md +38 -1
- package/CONTRIBUTING.md +54 -14
- package/README.md +1 -1
- package/dist/chunks/index-23dktynd.js +80 -0
- package/dist/chunks/index-23dktynd.js.map +10 -0
- package/dist/chunks/index-8qfxv0h5.js +14160 -0
- package/dist/chunks/index-8qfxv0h5.js.map +108 -0
- package/dist/chunks/index-ag0cgnvq.js +639 -0
- package/dist/chunks/index-ag0cgnvq.js.map +13 -0
- package/dist/chunks/index-dq7b35fn.js +307 -0
- package/dist/chunks/index-dq7b35fn.js.map +13 -0
- package/dist/chunks/{contract-a061yj6r.js → index-ev2b5aaf.js} +41 -72
- package/dist/chunks/index-ev2b5aaf.js.map +12 -0
- package/dist/chunks/{contract-awa2d5b1.js → index-f5cnbrjz.js} +19 -2
- package/dist/chunks/{contract-awa2d5b1.js.map → index-f5cnbrjz.js.map} +4 -3
- package/dist/chunks/{contract-sm7j7k95.js → index-ktmvs916.js} +9 -150
- package/dist/chunks/index-ktmvs916.js.map +13 -0
- package/dist/chunks/{contract-txjy0en2.js → index-m6n8ctfc.js} +64 -72
- package/dist/chunks/index-m6n8ctfc.js.map +10 -0
- package/dist/chunks/index-mt93ff2b.js +28 -0
- package/dist/chunks/index-mt93ff2b.js.map +10 -0
- package/dist/chunks/{contract-tf8c3qpv.js → index-qd5xgx6y.js} +46 -5
- package/dist/chunks/index-qd5xgx6y.js.map +13 -0
- package/dist/chunks/index-x69p7cv7.js +149 -0
- package/dist/chunks/index-x69p7cv7.js.map +10 -0
- package/dist/client/index.js +12 -7
- package/dist/client/index.js.map +1 -1
- package/dist/core/appearance.js +1 -1
- package/dist/core/config.js +7 -3
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.js +24 -6
- package/dist/core/contract.js.map +1 -1
- package/dist/core/format.js +1 -1
- package/dist/embed/index.js +16 -12
- package/dist/embed/index.js.map +4 -4
- package/dist/index.js +12 -0
- package/dist/index.js.map +9 -0
- package/dist/local.js +20 -30
- package/dist/local.js.map +7 -8
- package/dist/react/embed/index.js +1 -1
- package/dist/react/embed/index.js.map +2 -2
- package/dist/react/index.js +2567 -11542
- package/dist/react/index.js.map +16 -91
- package/dist/react/ui/index.js +2272 -0
- package/dist/react/ui/index.js.map +28 -0
- package/dist/server.js +13 -26
- package/dist/server.js.map +6 -7
- package/dist/types/client/annotations.d.ts +27 -0
- package/dist/types/client/data-client.d.ts +1 -2
- package/dist/types/client/iframe.d.ts +4 -2
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/core/annotations.d.ts +94 -0
- package/dist/types/core/appearance.d.ts +2 -2
- package/dist/types/core/config.d.ts +48 -4
- package/dist/types/core/contract.d.ts +21 -11
- package/dist/types/core/dimension.d.ts +6 -4
- package/dist/types/core/filters.d.ts +44 -0
- package/dist/types/core/messages.d.ts +2 -0
- package/dist/types/core/operation-types.d.ts +5 -2
- package/dist/types/core/operation.d.ts +3 -4
- package/dist/types/core/presentation.d.ts +2 -0
- package/dist/types/core/queries.d.ts +16 -0
- package/dist/types/core/uuid.d.ts +2 -0
- package/dist/types/core/variables.d.ts +34 -18
- package/dist/types/embed/runtime-html.d.ts +2 -0
- package/dist/types/embed/source.d.ts +2 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/react/annotations/AnnotationBar.d.ts +30 -0
- package/dist/types/react/annotations/AnnotationControls.d.ts +10 -0
- package/dist/types/react/annotations/AnnotationEditor.d.ts +16 -0
- package/dist/types/react/annotations/AnnotationMarkers.d.ts +19 -0
- package/dist/types/react/annotations/AnnotationSelectionLayer.d.ts +12 -0
- package/dist/types/react/annotations/AnnotationTarget.d.ts +9 -0
- package/dist/types/react/annotations/AnnotationTooltip.d.ts +9 -0
- package/dist/types/react/annotations/AnnotationTrigger.d.ts +10 -0
- package/dist/types/react/annotations/annotation-editor-state.d.ts +56 -0
- package/dist/types/react/annotations/annotation-screenshot.d.ts +4 -0
- package/dist/types/react/annotations/annotation-targets.d.ts +33 -0
- package/dist/types/react/annotations/getAnnotationProps.d.ts +15 -0
- package/dist/types/react/annotations/styles.d.ts +3 -0
- package/dist/types/react/annotations/useAnnotationGeometry.d.ts +22 -0
- package/dist/types/react/annotations/useDataAppAnnotations.d.ts +22 -0
- package/dist/types/react/app-context.d.ts +3 -0
- package/dist/types/react/bindings.d.ts +110 -0
- package/dist/types/react/content.d.ts +24 -11
- package/dist/types/react/hooks.d.ts +29 -787
- package/dist/types/react/index.d.ts +31 -106
- package/dist/types/react/mount.d.ts +6 -4
- package/dist/types/react/source-owner.d.ts +2 -0
- package/dist/types/react/style-contract.d.ts +80 -0
- package/dist/types/react/style-validation.d.ts +2 -0
- package/dist/types/react/ui/AboutData.d.ts +9 -1
- package/dist/types/react/ui/AppHeader.d.ts +1 -2
- package/dist/types/react/ui/AppLayout.d.ts +3 -9
- package/dist/types/react/ui/AppToolbar.d.ts +5 -8
- package/dist/types/react/ui/AreaChart.d.ts +7 -0
- package/dist/types/react/ui/BarChart.d.ts +6 -0
- package/dist/types/react/ui/Button.d.ts +3 -3
- package/dist/types/react/ui/ChartLegend.d.ts +31 -0
- package/dist/types/react/ui/Checkbox.d.ts +15 -4
- package/dist/types/react/ui/CheckboxGroup.d.ts +7 -0
- package/dist/types/react/ui/{Combobox.d.ts → ChoicePicker.d.ts} +10 -15
- package/dist/types/react/ui/{ComparisonVisual.d.ts → Comparison.d.ts} +3 -3
- package/dist/types/react/ui/ComposedChart.d.ts +41 -0
- package/dist/types/react/ui/ComposedChartLegend.d.ts +8 -0
- package/dist/types/react/ui/ContentSkeleton.d.ts +2 -0
- package/dist/types/react/ui/DataApp.d.ts +17 -58
- package/dist/types/react/ui/DataAppFrame.d.ts +41 -0
- package/dist/types/react/ui/DataBoundary.d.ts +4 -5
- package/dist/types/react/ui/DataSection.d.ts +6 -18
- package/dist/types/react/ui/DataSectionBoundary.d.ts +30 -0
- package/dist/types/react/ui/DataValue.d.ts +9 -0
- package/dist/types/react/ui/DataWidget.d.ts +2 -1
- package/dist/types/react/ui/DateTimeTooltip.d.ts +1 -1
- package/dist/types/react/ui/DimensionPicker.d.ts +1 -1
- package/dist/types/react/ui/ExportControl.d.ts +1 -1
- package/dist/types/react/ui/FilterActions.d.ts +10 -0
- package/dist/types/react/ui/FilterBar.d.ts +3 -0
- package/dist/types/react/ui/GettingStarted.d.ts +2 -4
- package/dist/types/react/ui/HelpPopover.d.ts +3 -4
- package/dist/types/react/ui/InspectionContext.d.ts +2 -0
- package/dist/types/react/ui/InspectionProvider.d.ts +29 -0
- package/dist/types/react/ui/LineChart.d.ts +7 -0
- package/dist/types/react/ui/Menu.d.ts +12 -0
- package/dist/types/react/ui/MetricWidget.d.ts +4 -3
- package/dist/types/react/ui/NumberField.d.ts +27 -0
- package/dist/types/react/ui/NumberFilterPicker.d.ts +9 -0
- package/dist/types/react/ui/PieChart.d.ts +11 -0
- package/dist/types/react/ui/PresentStory.d.ts +2 -5
- package/dist/types/react/ui/RadioGroup.d.ts +18 -0
- package/dist/types/react/ui/RefreshControl.d.ts +1 -2
- package/dist/types/react/ui/ScatterChart.d.ts +17 -0
- package/dist/types/react/ui/SearchField.d.ts +1 -2
- package/dist/types/react/ui/SearchInput.d.ts +3 -1
- package/dist/types/react/ui/Select.d.ts +14 -0
- package/dist/types/react/ui/SelectionMark.d.ts +2 -1
- package/dist/types/react/ui/Sheet.d.ts +2 -1
- package/dist/types/react/ui/Skeleton.d.ts +5 -2
- package/dist/types/react/ui/StaticDataApp.d.ts +4 -0
- package/dist/types/react/ui/TableWidget.d.ts +19 -16
- package/dist/types/react/ui/Tabs.d.ts +6 -2
- package/dist/types/react/ui/TextWidget.d.ts +2 -1
- package/dist/types/react/ui/Tooltip.d.ts +4 -3
- package/dist/types/react/ui/TooltipSurface.d.ts +3 -0
- package/dist/types/react/ui/TrendChart.d.ts +5 -0
- package/dist/types/react/ui/UpdatedAt.d.ts +1 -1
- package/dist/types/react/ui/VisualizationWidget.d.ts +12 -13
- package/dist/types/react/ui/WidgetViewTabs.d.ts +1 -1
- package/dist/types/react/ui/chart-data.d.ts +25 -0
- package/dist/types/react/ui/chart-primitives.d.ts +20 -0
- package/dist/types/react/ui/data-context.d.ts +18 -7
- package/dist/types/react/ui/icons.d.ts +2 -0
- package/dist/types/react/ui/index.d.ts +98 -0
- package/dist/types/react/ui/keyboard.d.ts +6 -0
- package/dist/types/react/ui/metric.d.ts +1 -1
- package/dist/types/react/ui/presentation.d.ts +5 -1
- package/dist/types/react/ui/shortcuts.d.ts +14 -1
- package/dist/types/react/ui/useAppAppearance.d.ts +1 -1
- package/dist/types/react/ui/variables.d.ts +4 -2
- package/dist/types/react/view-controls.d.ts +3 -1
- package/dist/types/react/view-runtime.d.ts +29 -0
- package/dist/types/react/view.d.ts +21 -4
- package/dist/types/react/widgets.d.ts +79 -0
- package/dist/types/server/handler.d.ts +4 -4
- package/dist/worker.js +20 -737
- package/docs/app-authoring.md +72 -50
- package/docs/client.md +8 -8
- package/docs/contract.md +42 -20
- package/docs/data-context.md +91 -0
- package/docs/embed.md +10 -2
- package/docs/formatting-and-appearance.md +68 -0
- package/docs/hosted-apps.md +9 -15
- package/docs/layout.md +5 -3
- package/docs/react-embed.md +5 -4
- package/docs/react.md +22 -317
- package/docs/server-bun.md +1 -1
- package/docs/server.md +4 -4
- package/docs/stories-and-export.md +52 -0
- package/docs/styling.md +62 -0
- package/docs/ui-quality.md +20 -0
- package/docs/ui.md +196 -0
- package/docs/variables.md +171 -0
- package/docs/views.md +123 -0
- package/docs/widgets.md +145 -0
- package/examples/starter-data-app/index.tsx +115 -86
- package/package.json +25 -12
- package/dist/chunks/contract-a061yj6r.js.map +0 -12
- package/dist/chunks/contract-g6hky7x6.js +0 -282
- package/dist/chunks/contract-g6hky7x6.js.map +0 -12
- package/dist/chunks/contract-sm7j7k95.js.map +0 -14
- package/dist/chunks/contract-tf8c3qpv.js.map +0 -11
- package/dist/chunks/contract-txjy0en2.js.map +0 -10
- package/dist/chunks/contract-wz59z8pq.js +0 -8
- package/dist/chunks/contract-wz59z8pq.js.map +0 -10
- package/dist/chunks/contract-yxbjea23.js +0 -328
- package/dist/chunks/contract-yxbjea23.js.map +0 -12
- package/dist/types/react/ui/RefreshRegion.d.ts +0 -9
- package/dist/types/react/ui/SelectableBarChart.d.ts +0 -15
- package/docs/releasing.md +0 -79
- /package/dist/chunks/{contract-mev09s5v.js → index-mev09s5v.js} +0 -0
- /package/dist/chunks/{contract-mev09s5v.js.map → index-mev09s5v.js.map} +0 -0
- /package/dist/types/react/ui/{comparison.d.ts → metric-comparison.d.ts} +0 -0
package/dist/core/config.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
defineDataApp2,
|
|
2
3
|
dataAppTitle2
|
|
3
|
-
} from "../chunks/
|
|
4
|
+
} from "../chunks/index-mt93ff2b.js";
|
|
5
|
+
import"../chunks/index-ag0cgnvq.js";
|
|
6
|
+
import"../chunks/index-mev09s5v.js";
|
|
4
7
|
export {
|
|
5
|
-
dataAppTitle2 as dataAppTitle
|
|
8
|
+
dataAppTitle2 as dataAppTitle,
|
|
9
|
+
defineDataApp2 as defineDataApp
|
|
6
10
|
};
|
|
7
11
|
|
|
8
|
-
//# debugId=
|
|
12
|
+
//# debugId=5A57128DDD16D15C64756E2164756E21
|
package/dist/core/config.js.map
CHANGED
package/dist/core/contract.js
CHANGED
|
@@ -3,6 +3,16 @@ import {
|
|
|
3
3
|
parseDimensionSelection2,
|
|
4
4
|
parseFacetOptions2,
|
|
5
5
|
dimensionPredicate2,
|
|
6
|
+
parseDataAppAnnotationDraft2,
|
|
7
|
+
annotationDraftRoute2,
|
|
8
|
+
annotationEditorStateRoute2,
|
|
9
|
+
annotationSendRoute2,
|
|
10
|
+
annotationUpdateRoute2,
|
|
11
|
+
annotationModeRoute2,
|
|
12
|
+
numberFilter2,
|
|
13
|
+
booleanFilter2,
|
|
14
|
+
parseNumberSelection2,
|
|
15
|
+
parseBooleanSelection2,
|
|
6
16
|
parseEmptyInput2,
|
|
7
17
|
parseTrue2,
|
|
8
18
|
previousDateRange2,
|
|
@@ -14,10 +24,8 @@ import {
|
|
|
14
24
|
defineQueryNames2,
|
|
15
25
|
DataSourceError2,
|
|
16
26
|
defineOperation2,
|
|
17
|
-
connectionQueryNames2,
|
|
18
27
|
connectionCheck2
|
|
19
|
-
} from "../chunks/
|
|
20
|
-
import"../chunks/contract-mev09s5v.js";
|
|
28
|
+
} from "../chunks/index-ag0cgnvq.js";
|
|
21
29
|
import {
|
|
22
30
|
MessageRoutingError2,
|
|
23
31
|
defineMessageRoute2,
|
|
@@ -26,12 +34,18 @@ import {
|
|
|
26
34
|
navigationUpdateRoute2,
|
|
27
35
|
sqlQueryRoute2,
|
|
28
36
|
dataAppRoutes2
|
|
29
|
-
} from "../chunks/
|
|
37
|
+
} from "../chunks/index-qd5xgx6y.js";
|
|
38
|
+
import"../chunks/index-mev09s5v.js";
|
|
30
39
|
export {
|
|
31
40
|
DataSourceError2 as DataSourceError,
|
|
32
41
|
MessageRoutingError2 as MessageRoutingError,
|
|
42
|
+
annotationDraftRoute2 as annotationDraftRoute,
|
|
43
|
+
annotationEditorStateRoute2 as annotationEditorStateRoute,
|
|
44
|
+
annotationModeRoute2 as annotationModeRoute,
|
|
45
|
+
annotationSendRoute2 as annotationSendRoute,
|
|
46
|
+
annotationUpdateRoute2 as annotationUpdateRoute,
|
|
47
|
+
booleanFilter2 as booleanFilter,
|
|
33
48
|
connectionCheck2 as connectionCheck,
|
|
34
|
-
connectionQueryNames2 as connectionQueryNames,
|
|
35
49
|
createMessageRouter2 as createMessageRouter,
|
|
36
50
|
dataAppRoutes2 as dataAppRoutes,
|
|
37
51
|
defineDataQueryRoute2 as defineDataQueryRoute,
|
|
@@ -42,16 +56,20 @@ export {
|
|
|
42
56
|
dimensionFilter2 as dimensionFilter,
|
|
43
57
|
dimensionPredicate2 as dimensionPredicate,
|
|
44
58
|
navigationUpdateRoute2 as navigationUpdateRoute,
|
|
59
|
+
numberFilter2 as numberFilter,
|
|
60
|
+
parseBooleanSelection2 as parseBooleanSelection,
|
|
45
61
|
parseCount2 as parseCount,
|
|
62
|
+
parseDataAppAnnotationDraft2 as parseDataAppAnnotationDraft,
|
|
46
63
|
parseDateRangeInput2 as parseDateRangeInput,
|
|
47
64
|
parseDimensionSelection2 as parseDimensionSelection,
|
|
48
65
|
parseEmptyInput2 as parseEmptyInput,
|
|
49
66
|
parseFacetOptions2 as parseFacetOptions,
|
|
50
67
|
parseLabel2 as parseLabel,
|
|
68
|
+
parseNumberSelection2 as parseNumberSelection,
|
|
51
69
|
parseTrue2 as parseTrue,
|
|
52
70
|
previousDateRange2 as previousDateRange,
|
|
53
71
|
rowsAsRecords2 as rowsAsRecords,
|
|
54
72
|
sqlQueryRoute2 as sqlQueryRoute
|
|
55
73
|
};
|
|
56
74
|
|
|
57
|
-
//# debugId=
|
|
75
|
+
//# debugId=C972F356188A80AA64756E2164756E21
|
package/dist/core/format.js
CHANGED
package/dist/embed/index.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import"../chunks/
|
|
2
|
-
import"../chunks/
|
|
1
|
+
import"../chunks/index-mev09s5v.js";
|
|
2
|
+
import"../chunks/index-ag0cgnvq.js";
|
|
3
|
+
import {
|
|
4
|
+
attachDataAppBridge2
|
|
5
|
+
} from "../chunks/index-dq7b35fn.js";
|
|
3
6
|
import {
|
|
4
|
-
createIframeTransport2,
|
|
5
|
-
installDataAppTransport2,
|
|
6
7
|
toDataOperationFailure
|
|
7
|
-
} from "../chunks/
|
|
8
|
+
} from "../chunks/index-x69p7cv7.js";
|
|
8
9
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
createIframeTransport2,
|
|
11
|
+
installDataAppTransport2
|
|
12
|
+
} from "../chunks/index-ktmvs916.js";
|
|
11
13
|
import {
|
|
14
|
+
randomUuid,
|
|
12
15
|
PARENT_PARAM
|
|
13
|
-
} from "../chunks/
|
|
16
|
+
} from "../chunks/index-f5cnbrjz.js";
|
|
14
17
|
import {
|
|
15
18
|
MessageRoutingError2
|
|
16
|
-
} from "../chunks/
|
|
19
|
+
} from "../chunks/index-qd5xgx6y.js";
|
|
17
20
|
// src/embed/bootstrap.ts
|
|
18
21
|
function startDataAppBootstrap({
|
|
19
22
|
parentOrigin,
|
|
@@ -21,7 +24,7 @@ function startDataAppBootstrap({
|
|
|
21
24
|
}) {
|
|
22
25
|
let loaded;
|
|
23
26
|
let failed = false;
|
|
24
|
-
const bundleSource = `altertable-data-app-${
|
|
27
|
+
const bundleSource = `altertable-data-app-${randomUuid()}.js`;
|
|
25
28
|
const bridge = createIframeTransport2({
|
|
26
29
|
parentOrigin,
|
|
27
30
|
window: frame,
|
|
@@ -98,7 +101,7 @@ function createNavigationHandler({
|
|
|
98
101
|
// src/embed/sql.ts
|
|
99
102
|
function createSqlQueryHandler(authorize) {
|
|
100
103
|
async function handleSqlQuery(input, context) {
|
|
101
|
-
const requestId =
|
|
104
|
+
const requestId = randomUuid();
|
|
102
105
|
context.signal.throwIfAborted();
|
|
103
106
|
let lakehouse;
|
|
104
107
|
try {
|
|
@@ -111,6 +114,7 @@ function createSqlQueryHandler(authorize) {
|
|
|
111
114
|
try {
|
|
112
115
|
return await lakehouse.queryAll(input.statement, {
|
|
113
116
|
limit: input.limit,
|
|
117
|
+
...input.params === undefined ? {} : { params: input.params },
|
|
114
118
|
signal: context.signal
|
|
115
119
|
});
|
|
116
120
|
} catch (error) {
|
|
@@ -130,4 +134,4 @@ export {
|
|
|
130
134
|
startDataAppBootstrap
|
|
131
135
|
};
|
|
132
136
|
|
|
133
|
-
//# debugId=
|
|
137
|
+
//# debugId=EC331A28899915F964756E2164756E21
|
package/dist/embed/index.js.map
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/embed/bootstrap.ts", "../src/embed/navigation.ts", "../src/embed/sql.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import {\n createIframeTransport,\n installDataAppTransport,\n} from '@/src/client/iframe';\n\n/** Run from a trusted bootstrap page in an allow-scripts-only iframe. CSP can prohibit network access. */\nexport function startDataAppBootstrap({\n parentOrigin,\n window: frame = window,\n}: {\n parentOrigin: string;\n window?: Window;\n}) {\n let loaded: string | undefined;\n let failed = false;\n const bundleSource = `altertable-data-app-${
|
|
5
|
+
"import { randomUuid } from '@/src/core/uuid';\nimport {\n createIframeTransport,\n installDataAppTransport,\n} from '@/src/client/iframe';\n\n/** Run from a trusted bootstrap page in an allow-scripts-only iframe. CSP can prohibit network access. */\nexport function startDataAppBootstrap({\n parentOrigin,\n window: frame = window,\n}: {\n parentOrigin: string;\n window?: Window;\n}) {\n let loaded: string | undefined;\n let failed = false;\n const bundleSource = `altertable-data-app-${randomUuid()}.js`;\n const bridge = createIframeTransport({\n parentOrigin,\n window: frame,\n mode: 'bundle',\n loadScript(javascript) {\n if (loaded !== undefined) {\n if (javascript === loaded) {\n if (failed) bridge.fail();\n else bridge.ready();\n } else bridge.fail();\n\n return;\n }\n loaded = javascript;\n try {\n const script = frame.document.createElement('script');\n script.textContent = `${javascript}\\n//# sourceURL=${bundleSource}`;\n frame.document.body.append(script);\n if (!failed) bridge.ready();\n } catch {\n reportError();\n }\n },\n });\n\n function reportError() {\n failed = true;\n bridge.fail();\n }\n\n function reportBundleError(event: ErrorEvent) {\n if (event.filename === bundleSource) reportError();\n }\n\n function reportBundleRejection(event: PromiseRejectionEvent) {\n if (\n event.reason instanceof Error &&\n event.reason.stack?.includes(bundleSource)\n )\n reportError();\n }\n\n frame.addEventListener('error', reportBundleError);\n frame.addEventListener('unhandledrejection', reportBundleRejection);\n const uninstall = installDataAppTransport(bridge, frame);\n\n return () => {\n frame.removeEventListener('error', reportBundleError);\n frame.removeEventListener('unhandledrejection', reportBundleRejection);\n uninstall();\n };\n}\n",
|
|
6
6
|
"import { PARENT_PARAM } from '@/src/core/bridge';\nimport type { NavigationUpdate } from '@/src/core/messages';\n\n/** Override this handler for framework routers. Reserved host parameters survive app navigation. */\nexport function createNavigationHandler({\n window: host = window,\n reservedSearchParams = [],\n}: {\n window?: Window;\n reservedSearchParams?: readonly string[];\n} = {}) {\n function navigate(input: NavigationUpdate): null {\n const previous = new URL(host.location.href);\n const url = new URL(previous);\n url.search = input.search;\n url.searchParams.delete(PARENT_PARAM);\n for (const name of reservedSearchParams) {\n url.searchParams.delete(name);\n for (const value of previous.searchParams.getAll(name))\n url.searchParams.append(name, value);\n }\n url.hash = input.hash;\n if (url.href !== host.location.href)\n host.history[input.mode === 'push' ? 'pushState' : 'replaceState'](\n null,\n '',\n url\n );\n if (input.title !== undefined) host.document.title = input.title;\n\n return null;\n }\n\n return navigate;\n}\n",
|
|
7
|
-
"import type { Lakehouse } from '@/src/core/contract';\nimport { toDataOperationFailure } from '@/src/core/operation';\nimport {\n MessageRoutingError,\n type MessageContext,\n type SqlQueryInput,\n} from '@/src/core/messages';\n\n/** Authorize every SQL request and supply a backend that independently enforces access and query limits. */\nexport function createSqlQueryHandler(\n authorize: (\n query: SqlQueryInput,\n context: MessageContext\n ) => Promise<Lakehouse>\n) {\n async function handleSqlQuery(input: SqlQueryInput, context: MessageContext) {\n const requestId =
|
|
7
|
+
"import { randomUuid } from '@/src/core/uuid';\nimport type { Lakehouse } from '@/src/core/contract';\nimport { toDataOperationFailure } from '@/src/core/operation';\nimport {\n MessageRoutingError,\n type MessageContext,\n type SqlQueryInput,\n} from '@/src/core/messages';\n\n/** Authorize every SQL request and supply a backend that independently enforces access and query limits. */\nexport function createSqlQueryHandler(\n authorize: (\n query: SqlQueryInput,\n context: MessageContext\n ) => Promise<Lakehouse>\n) {\n async function handleSqlQuery(input: SqlQueryInput, context: MessageContext) {\n const requestId = randomUuid();\n context.signal.throwIfAborted();\n let lakehouse: Lakehouse;\n try {\n lakehouse = await authorize(input, context);\n } catch {\n context.signal.throwIfAborted();\n throw new MessageRoutingError(\n 'forbidden',\n 'You cannot run this query.',\n requestId\n );\n }\n context.signal.throwIfAborted();\n try {\n return await lakehouse.queryAll(input.statement, {\n limit: input.limit,\n ...(input.params === undefined ? {} : { params: input.params }),\n signal: context.signal,\n });\n } catch (error) {\n context.signal.throwIfAborted();\n if (error instanceof MessageRoutingError) throw error;\n const failure = toDataOperationFailure(error);\n throw new MessageRoutingError(failure.code, failure.message, requestId);\n }\n }\n\n return handleSqlQuery;\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": "
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": "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",
|
|
10
|
+
"debugId": "EC331A28899915F964756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import"./chunks/index-mev09s5v.js";
|
|
2
|
+
import"./chunks/index-ag0cgnvq.js";
|
|
3
|
+
import {
|
|
4
|
+
defineDataApp2,
|
|
5
|
+
dataAppTitle2
|
|
6
|
+
} from "./chunks/index-mt93ff2b.js";
|
|
7
|
+
export {
|
|
8
|
+
dataAppTitle2 as dataAppTitle,
|
|
9
|
+
defineDataApp2 as defineDataApp
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//# debugId=B467CF45B7F40DB364756E2164756E21
|
package/dist/local.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/core/contract.ts
|
|
3
3
|
import { parseDate, today } from "@internationalized/date";
|
|
4
|
-
|
|
5
|
-
// src/core/invariant.ts
|
|
6
|
-
function invariant(condition, message) {
|
|
7
|
-
if (!condition)
|
|
8
|
-
throw new Error(`Invariant failed: ${message}`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// src/core/contract.ts
|
|
12
|
-
function defineQueryNames(names) {
|
|
13
|
-
const values = Object.values(names);
|
|
14
|
-
invariant(values.every((name) => !!name.trim()) && new Set(values).size === values.length, "Query names must be nonempty and unique.");
|
|
15
|
-
return names;
|
|
16
|
-
}
|
|
17
4
|
var sourceErrorBrand = Symbol.for("@altertable/data-app/DataSourceError");
|
|
18
5
|
|
|
19
6
|
class DataSourceError extends Error {
|
|
@@ -31,17 +18,14 @@ class DataSourceError extends Error {
|
|
|
31
18
|
this.name = "DataSourceError";
|
|
32
19
|
}
|
|
33
20
|
}
|
|
34
|
-
var connectionQueryNames = defineQueryNames({
|
|
35
|
-
connection: "connection-check"
|
|
36
|
-
});
|
|
37
21
|
|
|
38
22
|
// src/core/operation.ts
|
|
39
23
|
async function executeDataOperation(operation, value, {
|
|
40
24
|
operationName,
|
|
41
25
|
lakehouse,
|
|
42
26
|
signal: requestSignal,
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
requestId,
|
|
28
|
+
queryParams
|
|
45
29
|
}) {
|
|
46
30
|
requestSignal.throwIfAborted();
|
|
47
31
|
let input;
|
|
@@ -58,14 +42,15 @@ async function executeDataOperation(operation, value, {
|
|
|
58
42
|
try {
|
|
59
43
|
const output = await runOperation(operation, input, {
|
|
60
44
|
lakehouse: execution.lakehouse,
|
|
61
|
-
signal
|
|
45
|
+
signal,
|
|
46
|
+
queryParams
|
|
62
47
|
});
|
|
63
48
|
const body = {
|
|
64
49
|
data: operation.output(output),
|
|
65
50
|
requestId,
|
|
66
51
|
queriedAt: new Date().toISOString(),
|
|
67
52
|
queryIds: execution.queryIds,
|
|
68
|
-
|
|
53
|
+
queries: execution.queries
|
|
69
54
|
};
|
|
70
55
|
const serializedBody = JSON.stringify(body);
|
|
71
56
|
const responseBytes = new TextEncoder().encode(serializedBody).byteLength;
|
|
@@ -89,7 +74,8 @@ function createOperationLakehouse(operation, source, signal, operationName) {
|
|
|
89
74
|
throw new Error(`Query name is not registered for operation ${operationName}.`);
|
|
90
75
|
const query = {
|
|
91
76
|
name: options.name ?? `Query ${queries.length + 1}`,
|
|
92
|
-
statement
|
|
77
|
+
statement,
|
|
78
|
+
...options.params === undefined ? {} : { params: options.params }
|
|
93
79
|
};
|
|
94
80
|
queries.push(query);
|
|
95
81
|
const limit = Math.min(options.limit, operation.policy.maxQueryRows);
|
|
@@ -97,6 +83,7 @@ function createOperationLakehouse(operation, source, signal, operationName) {
|
|
|
97
83
|
try {
|
|
98
84
|
result = await source.queryAll(statement, {
|
|
99
85
|
limit,
|
|
86
|
+
...options.params === undefined ? {} : { params: options.params },
|
|
100
87
|
signal: AbortSignal.any([signal, options.signal])
|
|
101
88
|
});
|
|
102
89
|
} catch (error) {
|
|
@@ -115,7 +102,7 @@ function createOperationLakehouse(operation, source, signal, operationName) {
|
|
|
115
102
|
};
|
|
116
103
|
return { lakehouse, queries, queryIds };
|
|
117
104
|
}
|
|
118
|
-
async function runOperation(operation, input, { lakehouse, signal }) {
|
|
105
|
+
async function runOperation(operation, input, { lakehouse, signal, queryParams }) {
|
|
119
106
|
let abort;
|
|
120
107
|
try {
|
|
121
108
|
signal.throwIfAborted();
|
|
@@ -132,7 +119,7 @@ async function runOperation(operation, input, { lakehouse, signal }) {
|
|
|
132
119
|
cancelled,
|
|
133
120
|
Promise.resolve().then(() => {
|
|
134
121
|
signal.throwIfAborted();
|
|
135
|
-
return operation.run({ lakehouse, signal }, input);
|
|
122
|
+
return operation.run({ lakehouse, signal, queryParams }, input);
|
|
136
123
|
})
|
|
137
124
|
]);
|
|
138
125
|
} finally {
|
|
@@ -223,10 +210,10 @@ function createDataHandler(operations, authorize) {
|
|
|
223
210
|
try {
|
|
224
211
|
const { serializedBody } = await executeDataOperation(operation, input, {
|
|
225
212
|
lakehouse: access.lakehouse,
|
|
226
|
-
includeSql: access.canDiscloseSql,
|
|
227
213
|
signal,
|
|
228
214
|
requestId,
|
|
229
|
-
operationName: name
|
|
215
|
+
operationName: name,
|
|
216
|
+
queryParams: access.queryParams
|
|
230
217
|
});
|
|
231
218
|
return new Response(serializedBody, {
|
|
232
219
|
headers: {
|
|
@@ -311,8 +298,7 @@ function serveLocalApp({
|
|
|
311
298
|
idleTimeout: 60,
|
|
312
299
|
routes: { "/": page },
|
|
313
300
|
fetch: createDataHandler(operations, async () => ({
|
|
314
|
-
lakehouse: localLakehouse()
|
|
315
|
-
canDiscloseSql: true
|
|
301
|
+
lakehouse: localLakehouse()
|
|
316
302
|
}))
|
|
317
303
|
});
|
|
318
304
|
console.log(`${title} running at ${server.url}`);
|
|
@@ -320,7 +306,7 @@ function serveLocalApp({
|
|
|
320
306
|
}
|
|
321
307
|
function localLakehouse(environment = process.env, request = fetch) {
|
|
322
308
|
return {
|
|
323
|
-
async queryAll(statement, { limit, signal }) {
|
|
309
|
+
async queryAll(statement, { limit, signal, params }) {
|
|
324
310
|
const proxyUrl = environment.ALTERTABLE_DATA_PROXY_URL;
|
|
325
311
|
const proxyToken = environment.ALTERTABLE_DATA_PROXY_TOKEN;
|
|
326
312
|
const username = environment.ALTERTABLE_LAKEHOUSE_USERNAME;
|
|
@@ -338,7 +324,11 @@ function localLakehouse(environment = process.env, request = fetch) {
|
|
|
338
324
|
authorization: proxyUrl ? `Bearer ${proxyToken}` : `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`,
|
|
339
325
|
"content-type": "application/json"
|
|
340
326
|
},
|
|
341
|
-
body: JSON.stringify({
|
|
327
|
+
body: JSON.stringify({
|
|
328
|
+
statement,
|
|
329
|
+
limit,
|
|
330
|
+
...params === undefined ? {} : { params }
|
|
331
|
+
}),
|
|
342
332
|
signal
|
|
343
333
|
});
|
|
344
334
|
} catch (error) {
|
|
@@ -417,4 +407,4 @@ export {
|
|
|
417
407
|
serveLocalApp
|
|
418
408
|
};
|
|
419
409
|
|
|
420
|
-
//# debugId=
|
|
410
|
+
//# debugId=E6005345F1D6B04A64756E2164756E21
|