@altertable/data-app 0.75.0 → 0.77.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 (50) hide show
  1. package/README.md +56 -9
  2. package/REFERENCE.md +387 -333
  3. package/dist/chunks/{contract-B3s0ybE2.js → contract-BQsFReRp.js} +314 -237
  4. package/dist/chunks/contract-BQsFReRp.js.map +1 -0
  5. package/dist/chunks/{contract-DcPjfm0R.js → contract-VhY9V9wd.js} +184 -91
  6. package/dist/chunks/contract-VhY9V9wd.js.map +1 -0
  7. package/dist/chunks/{format-5hMYUWk3.js → date-time-range-value-CnlTr1U1.js} +8 -153
  8. package/dist/chunks/date-time-range-value-CnlTr1U1.js.map +1 -0
  9. package/dist/chunks/{diagnostics-DVwQ5PDK.js → diagnostics-Dyj-rUsY.js} +2 -2
  10. package/dist/chunks/{diagnostics-DVwQ5PDK.js.map → diagnostics-Dyj-rUsY.js.map} +1 -1
  11. package/dist/chunks/{operation-CGuN7Zcb.js → operation-BVRM-A5Y.js} +3 -3
  12. package/dist/chunks/{operation-CGuN7Zcb.js.map → operation-BVRM-A5Y.js.map} +1 -1
  13. package/dist/client/index.js +65 -50
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/core/config.js +1 -1
  16. package/dist/core/config.js.map +1 -1
  17. package/dist/core/contract.js +4 -4
  18. package/dist/core/format.js +149 -1
  19. package/dist/core/format.js.map +1 -0
  20. package/dist/internal.js +6 -308
  21. package/dist/internal.js.map +1 -1
  22. package/dist/server/index.js +3 -3
  23. package/dist/types/chunks/contract.d.ts +359 -599
  24. package/dist/types/chunks/contract2.d.ts +221 -0
  25. package/dist/types/chunks/date-time-range-value.d.ts +2 -28
  26. package/dist/types/chunks/date-time-range.d.ts +29 -0
  27. package/dist/types/chunks/index.d.ts +33 -5
  28. package/dist/types/client/index.d.ts +3 -3
  29. package/dist/types/core/config.d.ts +8 -4
  30. package/dist/types/core/contract.d.ts +5 -3
  31. package/dist/types/core/format.d.ts +2 -1
  32. package/dist/types/index.d.ts +2 -2
  33. package/dist/types/internal.d.ts +7 -5
  34. package/dist/types/server/index.d.ts +1 -1
  35. package/docs/app-authoring.md +15 -10
  36. package/docs/client.md +12 -7
  37. package/docs/contract.md +33 -50
  38. package/docs/data-context.md +9 -5
  39. package/docs/filters.md +295 -0
  40. package/docs/hosted-apps.md +4 -3
  41. package/docs/layout.md +24 -18
  42. package/docs/stories-and-export.md +19 -10
  43. package/docs/ui.md +7 -6
  44. package/docs/views.md +62 -26
  45. package/docs/widgets.md +38 -14
  46. package/package.json +16 -5
  47. package/dist/chunks/contract-B3s0ybE2.js.map +0 -1
  48. package/dist/chunks/contract-DcPjfm0R.js.map +0 -1
  49. package/dist/chunks/format-5hMYUWk3.js.map +0 -1
  50. package/docs/variables.md +0 -269
package/README.md CHANGED
@@ -1,17 +1,34 @@
1
1
  # @altertable/data-app
2
2
 
3
- Portable definitions, contracts, formatting, browser clients, and request handlers
4
- for Altertable data apps.
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 query registry:
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
- Use `/contract` for operations and validation, `/client` for browser requests,
28
- and `/server` for request handling. Add `@altertable/data-app-react` to build app
29
- UI or `@altertable/data-app-embed` to host an app. This package requires no React.
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
- Start with [app authoring](docs/app-authoring.md). Guides, [agent instructions](AGENTS.md),
34
- and the [API reference](REFERENCE.md) ship with this package.
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