@revenexx/app-sdk 0.4.2 → 0.5.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.
@@ -1,66 +0,0 @@
1
- /**
2
- * Shared runtime types. The generated per-App client (emitted by
3
- * @revenexx/app-sdk-cli) layers strongly-typed entity interfaces on top of
4
- * these loose runtime shapes.
5
- */
6
- type FilterOp = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'in' | 'is';
7
- type Scalar = string | number | boolean | null;
8
- /** A PostgREST filter: equality, an `in` list, or an explicit operator. */
9
- type Filter = Scalar | Scalar[] | {
10
- op: FilterOp;
11
- value: unknown;
12
- };
13
- /**
14
- * The query object is the one interface shared by every adapter: remote/runtime
15
- * serialise it to a PostgREST querystring, mock applies it in memory — so App
16
- * code is identical regardless of where the data lives.
17
- */
18
- interface Query<T = Record<string, unknown>> {
19
- where?: Partial<Record<keyof T & string, Filter>> & Record<string, Filter>;
20
- select?: (keyof T & string)[] | string[];
21
- order?: string;
22
- limit?: number;
23
- offset?: number;
24
- }
25
- type Op = 'list' | 'get' | 'create' | 'update' | 'delete';
26
- interface ColumnDef {
27
- type: string;
28
- pk?: boolean;
29
- notNull?: boolean;
30
- default?: string | null;
31
- check?: string;
32
- }
33
- /** A generated entity descriptor: maps an App entity to its real table + ops. */
34
- interface Entity {
35
- name: string;
36
- table: string;
37
- pk: string;
38
- columns?: Record<string, ColumnDef>;
39
- ops?: Op[] | Set<Op>;
40
- }
41
- type Row = Record<string, unknown>;
42
- /** A page of rows plus the total count of matching rows (ignoring limit/offset). */
43
- interface Page<T = Row> {
44
- items: T[];
45
- total: number;
46
- limit?: number;
47
- offset?: number;
48
- }
49
- /**
50
- * The data-plane contract. Implement this to add a new backend (e.g. GraphQL,
51
- * a local SQLite file) and register it with `registerAdapter`.
52
- *
53
- * `page` is optional: adapters that can report a total (PostgREST `count=exact`,
54
- * an in-memory store) implement it; others fall back to `list` only.
55
- */
56
- interface Adapter {
57
- readonly kind: string;
58
- list(entity: Entity, query?: Query): Promise<Row[]>;
59
- get(entity: Entity, id: string | number): Promise<Row | null>;
60
- create(entity: Entity, data: Row): Promise<Row>;
61
- update(entity: Entity, id: string | number, patch: Row): Promise<Row>;
62
- remove(entity: Entity, id: string | number): Promise<void>;
63
- page?(entity: Entity, query?: Query): Promise<Page>;
64
- }
65
-
66
- export type { Adapter as A, ColumnDef as C, Entity as E, Filter as F, Op as O, Page as P, Query as Q, Row as R, Scalar as S, FilterOp as a };