@zveltio/sdk 3.0.0-beta.108 → 3.0.0-beta.113

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 (47) hide show
  1. package/dist/client.d.ts +12 -2
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +9 -2
  4. package/dist/core.d.ts +2 -5
  5. package/dist/core.d.ts.map +1 -1
  6. package/dist/core.js +1 -4
  7. package/dist/ddl/index.d.ts +0 -4
  8. package/dist/ddl/index.d.ts.map +1 -1
  9. package/dist/extension/capabilities.d.ts +0 -2
  10. package/dist/extension/capabilities.d.ts.map +1 -1
  11. package/dist/extension/capabilities.js +0 -2
  12. package/dist/extension/index.d.ts +211 -30
  13. package/dist/extension/index.d.ts.map +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/realtime.d.ts +17 -1
  17. package/dist/realtime.d.ts.map +1 -1
  18. package/dist/realtime.js +5 -4
  19. package/dist/sync-manager.js +4 -4
  20. package/dist/tests/client.test.js +10 -0
  21. package/dist/tests/sync-manager.test.js +11 -3
  22. package/dist/tests/validate-manifest-actions.test.js +10 -0
  23. package/dist/tests/validate-manifest-routes.test.d.ts +2 -0
  24. package/dist/tests/validate-manifest-routes.test.d.ts.map +1 -0
  25. package/dist/tests/validate-manifest-routes.test.js +76 -0
  26. package/dist/tests/view-runtime.test.d.ts +2 -0
  27. package/dist/tests/view-runtime.test.d.ts.map +1 -0
  28. package/dist/tests/view-runtime.test.js +158 -0
  29. package/dist/tests/view.test.d.ts +2 -0
  30. package/dist/tests/view.test.d.ts.map +1 -0
  31. package/dist/tests/view.test.js +200 -0
  32. package/dist/validate/index.d.ts.map +1 -1
  33. package/dist/validate/index.js +94 -8
  34. package/dist/view/index.d.ts +172 -0
  35. package/dist/view/index.d.ts.map +1 -0
  36. package/dist/view/index.js +367 -0
  37. package/dist/view/runtime.d.ts +71 -0
  38. package/dist/view/runtime.d.ts.map +1 -0
  39. package/dist/view/runtime.js +185 -0
  40. package/dist/view/schema.d.ts +20 -0
  41. package/dist/view/schema.d.ts.map +1 -0
  42. package/dist/view/schema.js +357 -0
  43. package/dist/view/types.generated.d.ts +318 -0
  44. package/dist/view/types.generated.d.ts.map +1 -0
  45. package/dist/view/types.generated.js +2 -0
  46. package/package.json +7 -1
  47. package/schemas/view-2.schema.json +2047 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -11,6 +11,22 @@ export declare const WS_UNAUTHORIZED = 4001;
11
11
  * without them and authenticates by the session cookie.
12
12
  */
13
13
  export declare function openWebSocket(url: string, headers?: Record<string, string>): WebSocket;
14
+ /**
15
+ * A record event, as the engine sends it on `/api/ws`.
16
+ *
17
+ * `id` is always there. `data` is the record as this subscriber may read it,
18
+ * and the engine alone decides whether to send it: a client cannot ask for it
19
+ * and must not rely on it. Without `data`, read the record through the data
20
+ * API — a 404 means it is gone, or not this subscriber's to see.
21
+ */
22
+ export interface RealtimeRecordEvent<T = Record<string, unknown>> {
23
+ type: 'event';
24
+ collection: string;
25
+ event: 'insert' | 'update' | 'delete';
26
+ id: string;
27
+ data?: T;
28
+ timestamp: number;
29
+ }
14
30
  export declare class ZveltioRealtime {
15
31
  private ws;
16
32
  private listeners;
@@ -30,7 +46,7 @@ export declare class ZveltioRealtime {
30
46
  });
31
47
  connect(): void;
32
48
  private attemptReconnect;
33
- subscribe(collection: string, callback: (data: any) => void): () => void;
49
+ subscribe<T = Record<string, unknown>>(collection: string, callback: (event: RealtimeRecordEvent<T>) => void): () => void;
34
50
  /** Called when the engine ends the socket because its credentials were revoked. */
35
51
  onUnauthorized(callback: () => void): () => void;
36
52
  disconnect(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../src/realtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAStF;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,EAAE,CAA0B;IAEpC,OAAO,CAAC,SAAS,CAAoD;IACrE,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,oBAAoB,CAAM;IAClC,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,qBAAqB,CAAyB;IAEtD;;;;OAIG;gBACS,OAAO,EAAE,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;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAO;IAM/E,OAAO,IAAI,IAAI;IAiDf,OAAO,CAAC,gBAAgB;IAQxB,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,GAChD,MAAM,IAAI;IAqBb,mFAAmF;IACnF,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAKhD,UAAU,IAAI,IAAI;CAQnB"}
package/dist/realtime.js CHANGED
@@ -23,7 +23,6 @@ export function openWebSocket(url, headers) {
23
23
  }
24
24
  export class ZveltioRealtime {
25
25
  ws = null;
26
- // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
27
26
  listeners = new Map();
28
27
  baseUrl;
29
28
  reconnectAttempts = 0;
@@ -55,8 +54,11 @@ export class ZveltioRealtime {
55
54
  this.ws.onmessage = (event) => {
56
55
  try {
57
56
  const msg = JSON.parse(event.data);
58
- const collection = msg.collection;
59
- const subs = this.listeners.get(collection);
57
+ // Record events only: other frames that name a collection (a schema
58
+ // change) are not `RealtimeRecordEvent`s.
59
+ if (msg.type !== 'event')
60
+ return;
61
+ const subs = this.listeners.get(msg.collection);
60
62
  if (subs) {
61
63
  subs.forEach((fn) => {
62
64
  try {
@@ -93,7 +95,6 @@ export class ZveltioRealtime {
93
95
  this.reconnectAttempts++;
94
96
  this.reconnectTimer = setTimeout(() => this.connect(), delay);
95
97
  }
96
- // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
97
98
  subscribe(collection, callback) {
98
99
  if (!this.listeners.has(collection))
99
100
  this.listeners.set(collection, new Set());
@@ -133,10 +133,10 @@ export class SyncManager {
133
133
  let unsubRealtime;
134
134
  if (this.realtime) {
135
135
  unsubRealtime = this.realtime.subscribe(name, async (event) => {
136
- // Apply update from server to local store. The engine's socket
137
- // sends `{ type: 'event', event: 'insert'|'update'|'delete', data }`
138
- // (routes/ws.ts `broadcastEvent`); the id lives on `data`.
139
- const id = event.data?.id;
136
+ // Apply update from server to local store. The event names its
137
+ // record (`id`) and may carry no `data`; the record is read through
138
+ // the data API either way.
139
+ const id = event.id;
140
140
  if (event.type !== 'event' || !id)
141
141
  return;
142
142
  if (event.event === 'insert' || event.event === 'update') {
@@ -55,6 +55,16 @@ describe('ZveltioClient URL building', () => {
55
55
  await client.storage.list('invoices&limit=9999');
56
56
  expect(urls).toEqual(['https://engine.test/api/storage?folder_id=invoices%26limit%3D9999']);
57
57
  });
58
+ it('reaches a file visibility and the own quota under /api/storage', async () => {
59
+ const urls = captureUrls();
60
+ const client = createZveltioClient({ baseUrl: 'https://engine.test' });
61
+ await client.storage.setVisibility('a/b', 'tenant');
62
+ await client.storage.quota();
63
+ expect(urls).toEqual([
64
+ 'https://engine.test/api/storage/a%2Fb',
65
+ 'https://engine.test/api/storage/quota',
66
+ ]);
67
+ });
58
68
  it('sends the upload folder under the field name the engine reads', async () => {
59
69
  let body;
60
70
  globalThis.fetch = (async (_input, init) => {
@@ -29,7 +29,8 @@ afterEach(async () => {
29
29
  sync = undefined;
30
30
  });
31
31
  describe('SyncManager — realtime frames as the engine sends them', () => {
32
- // The frame shape is `broadcastEvent` in packages/engine/src/routes/ws.ts.
32
+ // The frame shape is `broadcastEvent` in packages/engine/src/routes/ws.ts:
33
+ // `id` always, `data` only when the engine sends it (ADR 0036 decision 3).
33
34
  // The handler used to wait for `record.created` / `record_id`, names the
34
35
  // socket never sends, so no server push ever reached the local store.
35
36
  it('applies an insert and drops a delete without queueing one back', async () => {
@@ -43,10 +44,17 @@ describe('SyncManager — realtime frames as the engine sends them', () => {
43
44
  sync.collection('posts').subscribe((records) => {
44
45
  latest = records;
45
46
  });
46
- await rt.push({ type: 'event', collection: 'posts', event: 'insert', data: { id: 'p1' } });
47
+ // No `data`: the manager reads the record by `id`.
48
+ await rt.push({ type: 'event', collection: 'posts', event: 'insert', id: 'p1' });
47
49
  expect((await store.get('posts', 'p1'))?.data).toMatchObject({ title: 'from server' });
48
50
  expect(latest.map((r) => r.id)).toEqual(['p1']);
49
- await rt.push({ type: 'event', collection: 'posts', event: 'delete', data: { id: 'p1' } });
51
+ await rt.push({
52
+ type: 'event',
53
+ collection: 'posts',
54
+ event: 'delete',
55
+ id: 'p1',
56
+ data: { id: 'p1' },
57
+ });
50
58
  expect(await store.get('posts', 'p1')).toBeUndefined();
51
59
  // A queued delete here would send the server's own deletion back to it.
52
60
  expect(await store.getPendingOps()).toEqual([]);
@@ -79,4 +79,14 @@ describe('manifest collections', () => {
79
79
  expect(bad(['Tasks'])).toHaveLength(1);
80
80
  expect(bad(['tasks', 'tasks'])).toHaveLength(1);
81
81
  });
82
+ it('takes tcp slots as { name, kind }, one kind per name (ADR 0026 amendment)', () => {
83
+ const slots = (egressSlots) => ({ ...job, egressSlots });
84
+ expect(errors({ jobs: [slots([{ name: 'mail', kind: 'tcp' }, 'provider'])] })).toEqual([]);
85
+ expect(errors({ jobs: [slots([{ name: 'mail', kind: 'udp' }])] })).toHaveLength(1);
86
+ expect(errors({ jobs: [slots([{ name: 'mail', port: 993 }])] })).toHaveLength(1);
87
+ expect(errors({ jobs: [slots(['mail', { name: 'mail', kind: 'tcp' }])] })).toHaveLength(1);
88
+ expect(errors({
89
+ jobs: [slots(['mail']), { ...slots([{ name: 'mail', kind: 'tcp' }]), name: 'other' }],
90
+ })).toEqual(['job "other": slot "mail" is declared both "http" and "tcp"']);
91
+ });
82
92
  });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validate-manifest-routes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-manifest-routes.test.d.ts","sourceRoot":"","sources":["../../src/tests/validate-manifest-routes.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ // `zveltio extension validate` takes the declared routes the engine takes (ADR 0039).
2
+ import { describe, expect, it } from 'bun:test';
3
+ import { validateManifest } from '../validate/index.js';
4
+ const base = {
5
+ name: 'a',
6
+ displayName: 'A',
7
+ category: 'custom',
8
+ description: 'd',
9
+ version: '1.0.0',
10
+ };
11
+ const hook = { method: 'POST', path: '/hook/:id', access: 'public', handler: 'hook' };
12
+ const codes = (manifest) => validateManifest({ manifest: { ...base, ...manifest } })
13
+ .filter((e) => e.severity !== 'warning')
14
+ .map((e) => e.code);
15
+ describe('manifest routes', () => {
16
+ it('takes a declared route; a public one is what a job may name', () => {
17
+ const job = {
18
+ name: 'ingest',
19
+ input: { type: 'object' },
20
+ fromPublicRoutes: ['/hook/:id'],
21
+ };
22
+ expect(codes({ routes: [hook], jobs: [job] })).toEqual([]);
23
+ expect(codes({ routes: [{ ...hook, access: 'caller' }], jobs: [job] })).toEqual([
24
+ 'MANIFEST_BAD_JOB',
25
+ ]);
26
+ expect(codes({ routes: [hook], forwardCredentials: { '/hook/:id': ['authorization'] } })).toEqual([]);
27
+ });
28
+ it('refuses what the engine refuses', () => {
29
+ for (const bad of [
30
+ { path: '/hook/*' },
31
+ { path: '/actions/run' },
32
+ { method: 'HEAD' },
33
+ { access: 'admin' },
34
+ { handler: 'Hook' },
35
+ { extra: 1 },
36
+ ]) {
37
+ expect(codes({ routes: [{ ...hook, ...bad }] }), JSON.stringify(bad)).toEqual([
38
+ 'MANIFEST_BAD_ROUTE',
39
+ ]);
40
+ }
41
+ expect(codes({ routes: [hook, { ...hook, handler: 'other' }] })).toEqual([
42
+ 'MANIFEST_BAD_ROUTE',
43
+ ]);
44
+ expect(codes({ routes: {} })).toEqual(['MANIFEST_BAD_ROUTE']);
45
+ });
46
+ });
47
+ describe('manifest signInProviders (ADR 0039 decision 8)', () => {
48
+ const login = { method: 'POST', path: '/login', access: 'public', handler: 'login' };
49
+ const start = { method: 'GET', path: '/start', access: 'public', handler: 'start' };
50
+ const dir = { id: 'dir', label: 'Directory', kind: 'credentials', route: '/login' };
51
+ it('takes a provider started by a declared public route of its kind', () => {
52
+ expect(codes({
53
+ routes: [login, start],
54
+ signInProviders: [dir, { id: 'sso', label: 'SSO', kind: 'redirect', route: '/start' }],
55
+ })).toEqual([]);
56
+ });
57
+ it('refuses what the engine refuses', () => {
58
+ for (const bad of [
59
+ { kind: 'redirect' },
60
+ { route: '/start' },
61
+ { route: '/nowhere' },
62
+ { id: 'Dir' },
63
+ { label: '' },
64
+ { kind: 'oauth' },
65
+ { extra: 1 },
66
+ ]) {
67
+ expect(codes({ routes: [login, start], signInProviders: [{ ...dir, ...bad }] }), JSON.stringify(bad)).toEqual(['MANIFEST_BAD_SIGN_IN_PROVIDER']);
68
+ }
69
+ expect(codes({ routes: [{ ...login, access: 'caller' }], signInProviders: [dir] })).toEqual([
70
+ 'MANIFEST_BAD_SIGN_IN_PROVIDER',
71
+ ]);
72
+ expect(codes({ routes: [login], signInProviders: [dir, dir] })).toEqual([
73
+ 'MANIFEST_BAD_SIGN_IN_PROVIDER',
74
+ ]);
75
+ });
76
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=view-runtime.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-runtime.test.d.ts","sourceRoot":"","sources":["../../src/tests/view-runtime.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,158 @@
1
+ // What every `view/2` renderer shares (ADR 0042 decision 8): references, the
2
+ // data API filter, `when`, the generated defaults, the fallback, action results.
3
+ import { describe, expect, it } from 'bun:test';
4
+ import { readFileSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import { $, actionPath, defaultView, fallbackFor, isEditable, matches, readActionResult, resolveInput, toFilter, toSort, validateView, } from '../view/index.js';
7
+ const scope = {
8
+ record: { id: 'r1', status: 'open', total: 5 },
9
+ selected: { folders: 'f9' },
10
+ selection: [{ id: 'a' }, { id: 'b' }],
11
+ params: { id: 'p1' },
12
+ user: 'u1',
13
+ today: '2026-11-12',
14
+ };
15
+ describe('references', () => {
16
+ it('fills every reference from the scope', () => {
17
+ expect(resolveInput({
18
+ rec: $.record('id'),
19
+ sel: $.selected('folders'),
20
+ ids: $.selection('id'),
21
+ p: $.param('id'),
22
+ me: $.user(),
23
+ d: $.today(),
24
+ lit: 3,
25
+ }, scope)).toEqual({
26
+ rec: 'r1',
27
+ sel: 'f9',
28
+ ids: ['a', 'b'],
29
+ p: 'p1',
30
+ me: 'u1',
31
+ d: '2026-11-12',
32
+ lit: 3,
33
+ });
34
+ });
35
+ it('is unresolved while a pane has no selection', () => {
36
+ expect(resolveInput({ x: $.selected('other') }, scope)).toBeNull();
37
+ expect(toFilter([$.where('folder_id', 'eq', $.selected('other'))], scope)).toBeNull();
38
+ });
39
+ });
40
+ describe('toFilter', () => {
41
+ it('builds the data API JSON filter, several operators on one field', () => {
42
+ expect(toFilter([
43
+ $.where('total', 'gt', 1),
44
+ $.where('total', 'lt', 9),
45
+ $.where('owner', 'eq', $.user()),
46
+ $.where('deleted_at', 'null'),
47
+ ], scope)).toEqual({ total: { gt: 1, lt: 9 }, owner: { eq: 'u1' }, deleted_at: { null: true } });
48
+ });
49
+ });
50
+ describe('cross-key checks', () => {
51
+ const doc = (v) => ({ spec: 'zveltio.view/2', type: 'list', collection: 'a', ...v });
52
+ it('refuses the same field and operator twice in one condition list', () => {
53
+ const r = validateView(doc({ filter: [$.where('total', 'gt', 1), $.where('total', 'gt', 5)] }));
54
+ expect(r.ok ? [] : r.issues.map((i) => i.path)).toEqual(['/filter/1']);
55
+ // Two operators on one field are one data API filter: allowed.
56
+ expect(validateView(doc({ filter: [$.where('total', 'gt', 1), $.where('total', 'lt', 9)] })).ok).toBe(true);
57
+ expect(() => toFilter([$.where('a', 'eq', 1), $.where('a', 'eq', 2)], scope)).toThrow();
58
+ });
59
+ it('refuses a prompt that names an input the button binds', () => {
60
+ const r = validateView(doc({
61
+ rowActions: [{ action: 'pay', input: { id: $.record('id') }, prompt: ['id', 'note'] }],
62
+ }));
63
+ expect(r.ok ? [] : r.issues.map((i) => i.path)).toEqual(['/rowActions/0/prompt/0']);
64
+ });
65
+ });
66
+ describe('matches', () => {
67
+ it('checks a row against conditions', () => {
68
+ const row = { status: 'open', total: 5, owner: 'u1', note: null };
69
+ expect(matches(undefined, row, scope)).toBe(true);
70
+ expect(matches([$.where('status', 'eq', 'open'), $.where('total', 'gte', 5)], row, scope)).toBe(true);
71
+ expect(matches([$.where('status', 'in', ['done', 'void'])], row, scope)).toBe(false);
72
+ expect(matches([$.where('owner', 'neq', $.user())], row, scope)).toBe(false);
73
+ expect(matches([$.where('note', 'null')], row, scope)).toBe(true);
74
+ expect(matches([$.where('status', 'ilike', 'OP')], row, scope)).toBe(true);
75
+ // An unresolved reference never holds.
76
+ expect(matches([$.where('status', 'eq', $.selected('none'))], row, scope)).toBe(false);
77
+ });
78
+ });
79
+ describe('generated defaults', () => {
80
+ const fields = [
81
+ { name: 'id', type: 'uuid', is_system: true },
82
+ { name: 'title', type: 'text' },
83
+ { name: 'score', type: 'computed' },
84
+ { name: 'locked', type: 'text', readonly: true },
85
+ ...Array.from({ length: 9 }, (_, i) => ({ name: `f${i}`, type: 'text' })),
86
+ ];
87
+ it('drops system and computed fields; a list stops at eight; a form drops read-only ones', () => {
88
+ const list = defaultView('list', 'notes', fields);
89
+ expect(list.fields).toEqual(['title', 'locked', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5']);
90
+ const form = defaultView('form', 'notes', fields);
91
+ expect(form.fields).not.toContain('locked');
92
+ expect(form.fields).toHaveLength(10);
93
+ expect(defaultView('detail', 'notes', fields)).toMatchObject({ record: { $param: 'id' } });
94
+ });
95
+ it('never makes a system, computed or read-only field writable', () => {
96
+ expect(isEditable({ name: 'title', type: 'text' })).toBe(true);
97
+ expect(isEditable({ name: 'id', type: 'uuid', is_system: true })).toBe(false);
98
+ expect(isEditable({ name: 'score', type: 'computed' })).toBe(false);
99
+ expect(isEditable({ name: 'locked', type: 'text', readonly: true })).toBe(false);
100
+ });
101
+ it('falls back to the view’s own fallback, then to the list of its collection', () => {
102
+ const drawn = new Set(['list', 'form']);
103
+ const board = { type: 'board', collection: 'tasks', groupBy: 'status' };
104
+ expect(fallbackFor(board, drawn)).toEqual({ type: 'list', collection: 'tasks' });
105
+ const withOwn = { ...board, fallback: { type: 'form', collection: 'tasks' } };
106
+ expect(fallbackFor(withOwn, drawn)).toEqual({ type: 'form', collection: 'tasks' });
107
+ expect(fallbackFor({ type: 'tabs', items: [] }, drawn)).toBeNull();
108
+ });
109
+ });
110
+ describe('actions', () => {
111
+ it('names its own extension’s action or a dependency’s', () => {
112
+ expect(actionPath('billing', 'pay')).toBe('/ext/billing/actions/pay');
113
+ expect(actionPath('billing', 'mail.send')).toBe('/ext/mail/actions/send');
114
+ // A dependency with a scoped name keeps its `/`, as its routes are mounted.
115
+ expect(actionPath('x', 'finance/quotes.approve')).toBe('/ext/finance/quotes/actions/approve');
116
+ });
117
+ it('refuses a name that would leave the action route', () => {
118
+ for (const [ext, action] of [
119
+ ['billing', '..'],
120
+ ['billing', '../admin.x'],
121
+ ['billing', 'a/../b.pay'],
122
+ ['..', 'pay'],
123
+ ['billing', 'pay/../../x'],
124
+ ['billing', 'mail.'],
125
+ ]) {
126
+ expect(() => actionPath(ext, action)).toThrow();
127
+ }
128
+ });
129
+ it('reads a result as navigation, view, file, reveal or values', () => {
130
+ expect(readActionResult({ view: 'mail.compose', params: { draft_id: 'd' } })).toEqual({
131
+ kind: 'navigate',
132
+ view: 'mail.compose',
133
+ params: { draft_id: 'd' },
134
+ });
135
+ expect(readActionResult({ view: { type: 'list', collection: 'x' } }).kind).toBe('view');
136
+ expect(readActionResult({ file: 'f1' })).toEqual({ kind: 'file', file: 'f1' });
137
+ expect(readActionResult({ reveal: 'k' })).toEqual({ kind: 'reveal', value: 'k' });
138
+ expect(readActionResult({ total: 3 })).toEqual({ kind: 'values', values: { total: 3 } });
139
+ expect(readActionResult(null)).toEqual({ kind: 'values', values: null });
140
+ // A tagged object that is none of the closed forms is not values: no guessing.
141
+ const bad = readActionResult({ view: 'mail.compose', extra: 1 });
142
+ expect(bad.kind).toBe('invalid');
143
+ });
144
+ // The shared corpus: the engine's test runs the same results through the
145
+ // published JSON Schema.
146
+ const corpus = JSON.parse(readFileSync(join(import.meta.dir, '../../src/tests/fixtures/view-2.json'), 'utf8')).actionResults;
147
+ for (const [name, r] of Object.entries(corpus.valid)) {
148
+ it(`reads: ${name}`, () => expect(readActionResult(r).kind).not.toBe('invalid'));
149
+ }
150
+ for (const [name, r] of Object.entries(corpus.invalid)) {
151
+ it(`refuses: ${name}`, () => expect(readActionResult(r).kind).toBe('invalid'));
152
+ }
153
+ it('sorts by the first field, `-` descending', () => {
154
+ expect(toSort('-issued_on')).toEqual({ sort: 'issued_on', order: 'desc' });
155
+ expect(toSort(['name', '-x'])).toEqual({ sort: 'name', order: 'asc' });
156
+ expect(toSort(undefined)).toBeNull();
157
+ });
158
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=view.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.test.d.ts","sourceRoot":"","sources":["../../src/tests/view.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,200 @@
1
+ // `zveltio.view/2` (ADR 0042): the validator the CLI runs at validate and pack,
2
+ // the builder, and what the schema cannot see (names, panes, keys).
3
+ // `fixtures/view-2.json` is shared with the engine's test, which runs the same
4
+ // documents through its own check of the published JSON Schema.
5
+ import { describe, expect, it } from 'bun:test';
6
+ import { readFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { $, isViewDocument, VIEW_SPEC, validateView, view, viewNameIssues } from '../view/index.js';
9
+ // Parsed, not imported: an import would turn the `__proto__` key into a prototype.
10
+ // Resolved through src/ so the copy tsc compiles into dist/tests finds it too.
11
+ // Parsed, not imported: an import would turn the `__proto__` key into a prototype.
12
+ const fixtures = JSON.parse(readFileSync(join(import.meta.dir, '../../src/tests/fixtures/view-2.json'), 'utf8'));
13
+ const issues = (input) => {
14
+ const r = validateView(input);
15
+ return r.ok ? [] : r.issues;
16
+ };
17
+ const paths = (input) => issues(input).map((i) => i.path);
18
+ describe('validateView', () => {
19
+ for (const [name, doc] of Object.entries(fixtures.valid)) {
20
+ it(`accepts: ${name}`, () => expect(issues(doc)).toEqual([]));
21
+ }
22
+ for (const [name, doc] of Object.entries(fixtures.invalid)) {
23
+ it(`refuses: ${name}`, () => expect(issues(doc)).not.toEqual([]));
24
+ }
25
+ // The broken fixture: a view/1 page written as if it were view/2. Without the
26
+ // validation every key below would reach a renderer.
27
+ it('names each key that is not part of the vocabulary', () => {
28
+ expect(paths(fixtures.invalid['view/1 habits'])).toEqual([
29
+ '/dataSource',
30
+ '/fields/0/class',
31
+ '/rowActions/0/icon',
32
+ ]);
33
+ expect(paths(fixtures.invalid['unknown key deep in a panel'])).toEqual([
34
+ '/panes/1/panels/0/endpoint',
35
+ ]);
36
+ });
37
+ it('refuses keys an object inherits', () => {
38
+ for (const key of ['constructor', 'toString', '__proto__']) {
39
+ expect(paths(fixtures.invalid[key])).toEqual([`/${key}`]);
40
+ }
41
+ });
42
+ it('shapes a condition by its operator', () => {
43
+ expect(paths(fixtures.invalid['in without a list'])).toEqual(['/filter/0/value']);
44
+ expect(paths(fixtures.invalid['null with a value'])).toEqual(['/filter/0/value']);
45
+ expect(paths(fixtures.invalid['eq without a value'])).toEqual(['/filter/0']);
46
+ });
47
+ it('names the kind the type names, and the missing key', () => {
48
+ expect(issues(fixtures.invalid['detail without a record'])).toEqual([
49
+ { path: '', message: 'needs "record"' },
50
+ ]);
51
+ expect(paths(fixtures.invalid['an unknown kind'])[0]).toBe('/type');
52
+ });
53
+ it('a view/1 schema is not a view/2 document', () => {
54
+ const v1 = { sduiSchema: 1, title: 't', resources: [{ id: 'r', dataSource: '/ext/x/r' }] };
55
+ expect(isViewDocument(v1)).toBe(false);
56
+ expect(issues(v1)).toEqual([{ path: '/spec', message: `must be "${VIEW_SPEC}"` }]);
57
+ });
58
+ });
59
+ describe('viewNameIssues', () => {
60
+ const names = {
61
+ collections: ['mail_accounts', 'mail_messages', 'mail_drafts'],
62
+ actions: ['sync', 'setFlags', 'deleteMessages', 'send', 'pay'],
63
+ dependencies: ['crm'],
64
+ };
65
+ it('passes a view that names only its own collections and actions', () => {
66
+ expect(viewNameIssues(fixtures.valid.inbox, names)).toEqual([]);
67
+ });
68
+ it("refuses another extension's collection and an undeclared action; allows a dependency's action", () => {
69
+ const v = view.document(view.list({
70
+ collection: 'invoices',
71
+ rowActions: [{ action: 'archive' }, { action: 'crm.link' }, { action: 'billing.pay' }],
72
+ }));
73
+ expect(viewNameIssues(v, names).map((i) => i.path)).toEqual([
74
+ '/collection',
75
+ '/rowActions/0/action',
76
+ '/rowActions/2/action',
77
+ ]);
78
+ });
79
+ it("reads an action's input as values: a key named action or collection is not a reference", () => {
80
+ const v = view.document(view.list({
81
+ collection: 'mail_messages',
82
+ rowActions: [{ action: 'pay', input: { action: 'refund', collection: 'x' } }],
83
+ }));
84
+ expect(viewNameIssues(v, names)).toEqual([]);
85
+ });
86
+ it('a $selected names an earlier pane of an enclosing split; pane ids are unique', () => {
87
+ const v = view.document(view.split({
88
+ actions: [{ action: 'sync', input: { a: $.selected('second') } }],
89
+ panes: [
90
+ view.list({
91
+ id: 'first',
92
+ collection: 'mail_messages',
93
+ filter: [$.where('a', 'eq', $.selected('second'))],
94
+ }),
95
+ view.list({
96
+ id: 'second',
97
+ collection: 'mail_messages',
98
+ filter: [$.where('a', 'eq', $.selected('first'))],
99
+ }),
100
+ view.detail({ id: 'first', collection: 'mail_messages', record: $.selected('nowhere') }),
101
+ ],
102
+ }));
103
+ expect(viewNameIssues(v, names).map((i) => i.path)).toEqual([
104
+ '/panes/0/filter/0/value/$selected',
105
+ '/panes/2/id',
106
+ '/panes/2/record/$selected',
107
+ ]);
108
+ });
109
+ it('navigate and open name a view of the extension; a message key must be shipped', () => {
110
+ const v = view.document(view.list({
111
+ collection: 'mail_messages',
112
+ title: 'mail.inbox',
113
+ open: 'mail.thread',
114
+ rowActions: [
115
+ { navigate: 'mail.nowhere', label: 'mail.typo' },
116
+ { action: 'send', label: 'Send' },
117
+ ],
118
+ }));
119
+ const found = viewNameIssues(v, {
120
+ ...names,
121
+ views: ['mail.thread'],
122
+ messageKeys: ['mail.inbox'],
123
+ });
124
+ expect(found.map((i) => i.path)).toEqual(['/rowActions/0/navigate', '/rowActions/0/label']);
125
+ });
126
+ it('reports a field the bound collection does not declare, and only with fields given', () => {
127
+ const v = {
128
+ type: 'split',
129
+ panes: [
130
+ {
131
+ type: 'list',
132
+ collection: 'mail_messages',
133
+ fields: ['subject', { field: 'sujbect', label: 'Subject' }],
134
+ filter: [{ field: 'read', op: 'eq', value: false }],
135
+ sort: ['-created_at', 'sent'],
136
+ rowActions: [{ action: 'send', label: 'Send', input: { subject: 'x' } }],
137
+ },
138
+ { type: 'board', collection: 'mail_messages', groupBy: 'folder', card: ['subject'] },
139
+ { type: 'stat', source: { collection: 'mail_messages', aggregate: 'sum', field: 'size' } },
140
+ ],
141
+ };
142
+ const fields = new Map([['mail_messages', ['id', 'created_at', 'subject', 'folder']]]);
143
+ expect(viewNameIssues(v, { ...names, fields }).map((i) => i.path)).toEqual([
144
+ '/panes/0/fields/1/field',
145
+ '/panes/0/filter/0/field',
146
+ '/panes/0/sort/1',
147
+ '/panes/2/source/field',
148
+ ]);
149
+ expect(viewNameIssues(v, names)).toEqual([]);
150
+ });
151
+ });
152
+ describe('builder', () => {
153
+ it('emits the JSON a hand-written file would hold, and it validates', () => {
154
+ const built = view.document(view.split({
155
+ panes: [
156
+ view.list({ id: 'account', collection: 'mail_accounts', fields: ['email'] }),
157
+ view.detail({
158
+ collection: 'mail_messages',
159
+ record: $.selected('account'),
160
+ panels: [
161
+ view.list({
162
+ collection: 'mail_drafts',
163
+ filter: [$.where('owner', 'eq', $.user()), $.where('sent_at', 'null')],
164
+ }),
165
+ ],
166
+ }),
167
+ ],
168
+ }), 'mail.drafts');
169
+ expect(built).toEqual({
170
+ type: 'split',
171
+ spec: VIEW_SPEC,
172
+ id: 'mail.drafts',
173
+ panes: [
174
+ { type: 'list', id: 'account', collection: 'mail_accounts', fields: ['email'] },
175
+ {
176
+ type: 'detail',
177
+ collection: 'mail_messages',
178
+ record: { $selected: 'account' },
179
+ panels: [
180
+ {
181
+ type: 'list',
182
+ collection: 'mail_drafts',
183
+ filter: [
184
+ { field: 'owner', op: 'eq', value: { $user: 'id' } },
185
+ { field: 'sent_at', op: 'null' },
186
+ ],
187
+ },
188
+ ],
189
+ },
190
+ ],
191
+ });
192
+ expect(issues(built)).toEqual([]);
193
+ });
194
+ it('drops undefined keys, as a file would not hold them', () => {
195
+ const sorted = false;
196
+ const built = view.document(view.list({ collection: 'a', sort: sorted ? 'name' : undefined, rowActions: undefined }));
197
+ expect(Object.keys(built)).toEqual(['type', 'collection', 'spec']);
198
+ expect(issues(built)).toEqual([]);
199
+ });
200
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAK/D,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,oDAAoD;IACpD,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE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