@altertable/data-app 0.74.0 → 0.76.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 +11 -3
- package/CONTRIBUTING.md +14 -3
- package/README.md +56 -9
- package/REFERENCE.md +194 -99
- package/dist/chunks/{contract-BeLPJwlO.js → contract-DsyRYgN_.js} +176 -108
- package/dist/chunks/contract-DsyRYgN_.js.map +1 -0
- package/dist/chunks/{contract-Di8SP74I.js → contract-kNFYPHRK.js} +255 -4
- package/dist/chunks/contract-kNFYPHRK.js.map +1 -0
- package/dist/chunks/date-time-range-value-TE8KCsfV.js +648 -0
- package/dist/chunks/date-time-range-value-TE8KCsfV.js.map +1 -0
- package/dist/chunks/{diagnostics-BTZSlNtW.js → diagnostics-DhCqGklq.js} +2 -2
- package/dist/chunks/{diagnostics-BTZSlNtW.js.map → diagnostics-DhCqGklq.js.map} +1 -1
- package/dist/chunks/{operation-CSM9UmO3.js → operation-7tiT4cpJ.js} +3 -3
- package/dist/chunks/{operation-CSM9UmO3.js.map → operation-7tiT4cpJ.js.map} +1 -1
- package/dist/client/index.js +51 -5
- package/dist/client/index.js.map +1 -1
- package/dist/core/config.js +4 -3
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.js +4 -3
- package/dist/core/format.js +149 -1
- package/dist/core/format.js.map +1 -0
- package/dist/internal.js +6 -189
- package/dist/internal.js.map +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.js.map +1 -1
- package/dist/types/chunks/contract.d.ts +133 -264
- package/dist/types/chunks/contract2.d.ts +207 -0
- package/dist/types/chunks/date-time-range-value.d.ts +20 -0
- package/dist/types/chunks/date-time-range.d.ts +29 -0
- package/dist/types/chunks/index.d.ts +14 -2
- package/dist/types/client/index.d.ts +3 -3
- package/dist/types/core/config.d.ts +6 -4
- package/dist/types/core/contract.d.ts +5 -2
- package/dist/types/core/format.d.ts +21 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/internal.d.ts +11 -4
- package/dist/types/server/index.d.ts +2 -2
- package/docs/app-authoring.md +46 -14
- package/docs/composition.md +4 -23
- package/docs/contract.md +42 -9
- package/docs/diagnostics.md +37 -0
- package/docs/embed.md +38 -0
- package/docs/hosted-apps.md +7 -4
- package/docs/local-data-apps.md +17 -2
- package/docs/react.md +6 -3
- package/docs/stories-and-export.md +14 -5
- package/docs/ui-quality.md +3 -2
- package/docs/ui.md +53 -2
- package/docs/variables.md +80 -8
- package/package.json +17 -5
- package/dist/chunks/contract-BeLPJwlO.js.map +0 -1
- package/dist/chunks/contract-Di8SP74I.js.map +0 -1
- package/dist/chunks/format-BdFlv_xa.js +0 -148
- package/dist/chunks/format-BdFlv_xa.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
# Build Altertable data apps
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Use [app authoring](docs/app-authoring.md) for SDK mechanics and available starters.
|
|
4
|
+
The calling app brief chooses the use case, content structure,
|
|
5
|
+
and starter; examples demonstrate APIs rather than a required app layout.
|
|
6
|
+
For an existing app, start from its current source. Open another guide only when the
|
|
5
7
|
task needs a pattern that source does not cover. Search [REFERENCE.md](REFERENCE.md) for the exact export or prop.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Contribute to this repository
|
|
10
|
+
|
|
11
|
+
Read [Contributing](CONTRIBUTING.md) before changing packages or contributor
|
|
12
|
+
tooling. App authoring guides teach agents how to build apps with the SDK.
|
|
13
|
+
Keep reusable behavior in components, defaults, types, and tests. Add authoring
|
|
14
|
+
documentation only when an app author must make a decision or take an action;
|
|
15
|
+
do not restate patterns already handled by the SDK.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -13,7 +13,8 @@ bash scripts/install-test-browser.sh
|
|
|
13
13
|
for the kind of change being made.
|
|
14
14
|
2. **Change source and consumers.** Keep the public API focused on concrete app
|
|
15
15
|
needs. Preserve package boundaries and explicit exports. Update affected
|
|
16
|
-
callers
|
|
16
|
+
callers when public behavior changes. Update starters and guides only when
|
|
17
|
+
app authoring must change; apply the documentation boundary below.
|
|
17
18
|
3. **Run focused checks.** Build with `bun run build` before consumer tests.
|
|
18
19
|
Select the test file or `-t "workflow name"` matching the change. For example,
|
|
19
20
|
CSV export changes use `bun run test tests/public-api/apps-export.test.ts`.
|
|
@@ -58,14 +59,24 @@ imports, fabricated internal state, and implementation assertions. Prefer
|
|
|
58
59
|
accessible role/name or label queries scoped to the relevant region. Keep browser
|
|
59
60
|
workflows self-contained in `apps-*.test.ts`.
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
When a change requires new app code or an authoring decision, update the relevant
|
|
63
|
+
guide and starter. Keep SDK mechanics and shared component guidance in `docs/`;
|
|
64
|
+
use-case composition belongs to the app brief and selected starter.
|
|
65
|
+
Document current usage with one focused example, `<Component>` and
|
|
66
|
+
`functionName()` notation.
|
|
63
67
|
Show complete enclosing calls and components; use `// ...` for unrelated setup.
|
|
64
68
|
Name the app declaration `dataApp`; keep the API's `app` prop name.
|
|
65
69
|
Leave prop inventories to TypeScript and JSDoc. Generate `REFERENCE.md` with
|
|
66
70
|
`bun run build` and stage it before `bun run check:reference`; improve entries
|
|
67
71
|
through types and JSDoc, never generated output.
|
|
68
72
|
|
|
73
|
+
## Documentation boundary
|
|
74
|
+
|
|
75
|
+
App authoring guides teach agents what to decide, supply, or change in app code.
|
|
76
|
+
Keep automatic behavior and reusable patterns in components, defaults, types,
|
|
77
|
+
and regression tests. Do not document them as authoring steps or end-user
|
|
78
|
+
instructions.
|
|
79
|
+
|
|
69
80
|
## UI platform principles
|
|
70
81
|
|
|
71
82
|
- Express intent through small typed props and simple data structures.
|
package/README.md
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
# @altertable/data-app
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
The SDK behind [Altertable data apps](https://altertable.ai/docs/data-apps):
|
|
4
|
+
interactive apps that agents build over your data. Queries are declared up front,
|
|
5
|
+
so every result stays governed, cacheable, and traceable to its source while the
|
|
6
|
+
interface adapts to each question.
|
|
7
|
+
|
|
8
|
+
## Do you need this package?
|
|
9
|
+
|
|
10
|
+
- **Building an app in Altertable, Slack, or an MCP client:** follow
|
|
11
|
+
[Build a data app](https://altertable.ai/docs/data-apps/build). The agent uses
|
|
12
|
+
this SDK for you; no install is needed.
|
|
13
|
+
- **Developing locally:** scaffold, run, and publish with the Altertable CLI
|
|
14
|
+
(`altertable app create`). See
|
|
15
|
+
[local development](https://altertable.ai/docs/data-apps/local-development).
|
|
16
|
+
- **Writing an app by hand or embedding apps in a product:** install the packages
|
|
17
|
+
below.
|
|
5
18
|
|
|
6
19
|
## Installation
|
|
7
20
|
|
|
8
21
|
```fish
|
|
9
22
|
bun add @altertable/data-app
|
|
23
|
+
# or
|
|
24
|
+
npm install @altertable/data-app
|
|
25
|
+
# or
|
|
26
|
+
pnpm add @altertable/data-app
|
|
10
27
|
```
|
|
11
28
|
|
|
12
29
|
## Usage
|
|
13
30
|
|
|
14
|
-
Declare an app's identity and
|
|
31
|
+
Declare an app's identity and its named queries:
|
|
15
32
|
|
|
16
33
|
```ts
|
|
17
34
|
import { defineDataApp } from '@altertable/data-app';
|
|
@@ -20,18 +37,48 @@ const dataApp = defineDataApp({
|
|
|
20
37
|
title: 'Activity',
|
|
21
38
|
description: 'Explore activity across your organization.',
|
|
22
39
|
scope: { organization: 'demo', environment: 'production' },
|
|
23
|
-
queries: {
|
|
40
|
+
queries: {
|
|
41
|
+
eventsByDay: {
|
|
42
|
+
statement: `
|
|
43
|
+
SELECT CAST(date_trunc('day', occurred_at) AS VARCHAR) AS day, count(*) AS events
|
|
44
|
+
FROM events
|
|
45
|
+
WHERE occurred_at >= $period.from AND occurred_at < $period.to
|
|
46
|
+
GROUP BY day ORDER BY day`,
|
|
47
|
+
params: { period: { type: 'dateTimeRange' } },
|
|
48
|
+
projections: {
|
|
49
|
+
day: { type: 'string' },
|
|
50
|
+
events: { type: 'number' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
24
54
|
});
|
|
25
55
|
```
|
|
26
56
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
57
|
+
See [queries and operations](docs/contract.md) to run them.
|
|
58
|
+
|
|
59
|
+
## Packages
|
|
60
|
+
|
|
61
|
+
Add the packages your app needs:
|
|
62
|
+
|
|
63
|
+
| Package | Use it to |
|
|
64
|
+
| ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
|
|
65
|
+
| `@altertable/data-app` | Define apps and queries (`/contract`, `/client`, `/server`) |
|
|
66
|
+
| [`@altertable/data-app-react`](https://www.npmjs.com/package/@altertable/data-app-react) | Build app UI with views, filters, charts, and tables |
|
|
67
|
+
| [`@altertable/data-app-embed`](https://www.npmjs.com/package/@altertable/data-app-embed) | Host apps in your product through an iframe sandbox |
|
|
68
|
+
| [`@altertable/data-app-bun`](https://www.npmjs.com/package/@altertable/data-app-bun) | Serve and preview apps locally against your lakehouse |
|
|
69
|
+
| [`@altertable/data-app-worker`](https://www.npmjs.com/package/@altertable/data-app-worker) | Serve apps from a self-contained sandbox Worker |
|
|
70
|
+
| [`@altertable/data-app-manifest`](https://www.npmjs.com/package/@altertable/data-app-manifest) | Extract and rewrite manifests in build tooling |
|
|
71
|
+
| [`@altertable/data-app-examples`](https://www.npmjs.com/package/@altertable/data-app-examples) | Start from canonical app templates |
|
|
30
72
|
|
|
31
73
|
## Documentation
|
|
32
74
|
|
|
33
|
-
|
|
34
|
-
and
|
|
75
|
+
- [Data apps documentation](https://altertable.ai/docs/data-apps): build, share,
|
|
76
|
+
and develop apps in Altertable.
|
|
77
|
+
- [Interfaces for the next question](https://altertable.ai/blog/2026-11-04-interfaces-for-the-next-question):
|
|
78
|
+
why data apps exist and how they are designed.
|
|
79
|
+
- [App authoring](docs/app-authoring.md): start here to write an app. Guides,
|
|
80
|
+
[agent instructions](AGENTS.md), and the [API reference](REFERENCE.md) ship with
|
|
81
|
+
this package.
|
|
35
82
|
|
|
36
83
|
## License
|
|
37
84
|
|