foldkit-crud 0.10.0 → 0.12.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/README.md +15 -4
- package/dist/display.d.ts +105 -0
- package/dist/display.d.ts.map +1 -0
- package/dist/display.js +111 -0
- package/dist/display.js.map +1 -0
- package/dist/{index.d.mts → index.d.ts} +114 -217
- package/dist/index.d.ts.map +1 -0
- package/dist/{index.mjs → index.js} +69 -244
- package/dist/index.js.map +1 -0
- package/dist/screen.d.ts +72 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +52 -0
- package/dist/screen.js.map +1 -0
- package/dist/sort.d.ts +36 -0
- package/dist/sort.d.ts.map +1 -0
- package/dist/sort.js +50 -0
- package/dist/sort.js.map +1 -0
- package/package.json +13 -13
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -1,218 +1,15 @@
|
|
|
1
|
+
import { Display, DisplayColumn, DisplayKind, DisplayWords } from "./display.js";
|
|
2
|
+
import { screen } from "./screen.js";
|
|
3
|
+
import { Sort, SortState, SortedColumn } from "./sort.js";
|
|
1
4
|
import { Option, Schema } from "effect";
|
|
5
|
+
import { AnyEntity, EntityInput, IdOf, Selection, SelectionPage } from "foldkit-entity";
|
|
2
6
|
import { Bundle } from "foldkit-bundle";
|
|
3
|
-
import { AnyEntity, EntityInput, EntityMember, IdOf, Selection, SelectionPage } from "foldkit-entity";
|
|
4
7
|
import { FormControl, Submitted } from "foldkit-form";
|
|
5
|
-
import { Metadata } from "foldkit-metadata";
|
|
6
8
|
import { MutationDescriptor, MutationStatus, Page, QueryDescriptor, RemoteClient, RemoteData, RemoteError, RemoteMessage } from "foldkit-remote";
|
|
7
9
|
import { ActiveSurface, ModelRef, Projection } from "foldkit-surface";
|
|
8
10
|
import { Command } from "foldkit/command";
|
|
9
11
|
import * as Submodel from "foldkit/submodel";
|
|
10
12
|
import * as Update from "foldkit/update";
|
|
11
|
-
/**
|
|
12
|
-
* How one selected member shows: the primitive every kind of Display is a value
|
|
13
|
-
* of. `Display.text()` and `Display.flag()` are values of it, made by
|
|
14
|
-
* `Display.kind`, which is what an application calls for a badge or a relative
|
|
15
|
-
* date. The kinds here are a collection, not a special case.
|
|
16
|
-
*/
|
|
17
|
-
export interface Display<Data = unknown> {
|
|
18
|
-
/** The name a renderer is found by. */
|
|
19
|
-
readonly kind: string;
|
|
20
|
-
/** Whether a view draws it. A member read and not shown, usually the id, is `false`. */
|
|
21
|
-
readonly shown: boolean;
|
|
22
|
-
/** What this kind needs: a format, a relation's target. */
|
|
23
|
-
readonly data: Data;
|
|
24
|
-
/**
|
|
25
|
-
* The value as text: what a cell says when nothing draws it specially. It is
|
|
26
|
-
* never given `null` or `undefined`; `Display.show` says `nothing` for those.
|
|
27
|
-
*/
|
|
28
|
-
readonly text: (value: unknown, words: DisplayWords) => string;
|
|
29
|
-
}
|
|
30
|
-
/** A kind of Display: how its values are made, and how one is told from another. */
|
|
31
|
-
interface DisplayKind<Data> {
|
|
32
|
-
readonly kind: string;
|
|
33
|
-
readonly of: (data: Data) => Display<Data>;
|
|
34
|
-
readonly is: (display: Display) => display is Display<Data>;
|
|
35
|
-
}
|
|
36
|
-
/** A selected member with its words and its Display. A list's column, a detail's line. */
|
|
37
|
-
interface DisplayColumn<Key extends string = string> {
|
|
38
|
-
readonly key: Key;
|
|
39
|
-
readonly label: string;
|
|
40
|
-
readonly member: EntityMember;
|
|
41
|
-
readonly display: Display;
|
|
42
|
-
}
|
|
43
|
-
/** The words a Display needs that are not the value's own. */
|
|
44
|
-
interface DisplayWords {
|
|
45
|
-
/** Default `yes`. */
|
|
46
|
-
readonly yes?: string;
|
|
47
|
-
/** Default `no`. */
|
|
48
|
-
readonly no?: string;
|
|
49
|
-
/** What stands for nothing: `null`, `undefined`, an empty list. Default the empty string. */
|
|
50
|
-
readonly nothing?: string;
|
|
51
|
-
/** Between the items of a list, and between the members of a nested value. Default `, `. */
|
|
52
|
-
readonly separator?: string;
|
|
53
|
-
}
|
|
54
|
-
/** A kind of Display. The kinds below are made with it, and so is an application's. */
|
|
55
|
-
declare const kind: <Data = Record<string, never>>(name: string, spec: {
|
|
56
|
-
readonly shown?: boolean;
|
|
57
|
-
readonly text: (data: Data, value: unknown, words: DisplayWords) => string;
|
|
58
|
-
}) => DisplayKind<Data>;
|
|
59
|
-
declare const show: (display: Display, value: unknown, words?: DisplayWords) => string;
|
|
60
|
-
export declare const Display: {
|
|
61
|
-
/**
|
|
62
|
-
* A kind of Display. `Display.kind<{ tone: string }>('Badge', { text: (_, value) => String(value) })`
|
|
63
|
-
* gives `.of(data)` to make one and `.is(display)` to tell one, exactly as the
|
|
64
|
-
* kinds below were made. `text` is the floor; a view draws it specially once
|
|
65
|
-
* it is given a renderer for `Badge`.
|
|
66
|
-
*/
|
|
67
|
-
kind: typeof kind;
|
|
68
|
-
Text: DisplayKind<{
|
|
69
|
-
readonly format?: ((value: unknown) => string) | undefined;
|
|
70
|
-
}>;
|
|
71
|
-
Number: DisplayKind<{
|
|
72
|
-
readonly format?: ((value: number) => string) | undefined;
|
|
73
|
-
}>;
|
|
74
|
-
Flag: DisplayKind<Record<string, never>>;
|
|
75
|
-
Hidden: DisplayKind<Record<string, never>>;
|
|
76
|
-
Ref: DisplayKind<{
|
|
77
|
-
readonly target: AnyEntity;
|
|
78
|
-
readonly many: boolean;
|
|
79
|
-
}>;
|
|
80
|
-
Nested: DisplayKind<{
|
|
81
|
-
readonly target: AnyEntity;
|
|
82
|
-
readonly shape: 'one' | 'many' | 'page';
|
|
83
|
-
readonly columns: ReadonlyArray<DisplayColumn>;
|
|
84
|
-
}>;
|
|
85
|
-
text: (format?: (value: unknown) => string) => Display;
|
|
86
|
-
number: (format?: (value: number) => string) => Display;
|
|
87
|
-
flag: () => Display;
|
|
88
|
-
/** Read, so a row can be opened or keyed by it, and not shown: usually the id. */
|
|
89
|
-
hidden: () => Display;
|
|
90
|
-
/**
|
|
91
|
-
* Entity metadata: how a member shows wherever it is listed, e.g.
|
|
92
|
-
* `Entity.annotateMembers({ price: Display.of(Display.number(cents => ...)) })`.
|
|
93
|
-
*/
|
|
94
|
-
of: (display: Display) => Metadata;
|
|
95
|
-
/**
|
|
96
|
-
* The Display of one selected member, from the most to the least explicit
|
|
97
|
-
* source: the member's `Display.of` metadata, how the relation was selected,
|
|
98
|
-
* then the shape of its schema. `nested` is the columns of a nested Selection,
|
|
99
|
-
* with `shape` saying how many the relation yields.
|
|
100
|
-
*/
|
|
101
|
-
resolve: (member: EntityMember, nested?: {
|
|
102
|
-
readonly shape: 'one' | 'many' | 'page';
|
|
103
|
-
readonly columns: ReadonlyArray<DisplayColumn>;
|
|
104
|
-
}) => Display;
|
|
105
|
-
/**
|
|
106
|
-
* A value as the text its Display calls for: what a cell says when nothing
|
|
107
|
-
* draws it specially. A view that wants a link or a badge reads the Display
|
|
108
|
-
* and the value itself; this is the floor every view can stand on.
|
|
109
|
-
*/
|
|
110
|
-
show: typeof show;
|
|
111
|
-
};
|
|
112
|
-
/** The four Messages a screen answers, named after it: `OpenedPost`, `CreatedPost`, … */
|
|
113
|
-
type ScreenCases<Name extends string, Id extends Schema.Top> = { readonly [K in `Opened${Name}`]: {
|
|
114
|
-
readonly id: Id;
|
|
115
|
-
}; } & { readonly [K in `Created${Name}`]: {}; } & { readonly [K in `Closed${Name}`]: {}; } & { readonly [K in `AskedToRemove${Name}`]: {
|
|
116
|
-
readonly id: Id;
|
|
117
|
-
}; };
|
|
118
|
-
/**
|
|
119
|
-
* What the screen asks of the page's placed pieces. `Out` and `Asked` are what
|
|
120
|
-
* the editor's and the remover's helpers return, the page's own Model and
|
|
121
|
-
* Commands, which the screen hands back.
|
|
122
|
-
*/
|
|
123
|
-
interface ScreenPieces<Root, Id, Out extends {
|
|
124
|
-
readonly model: Root;
|
|
125
|
-
}, Asked extends {
|
|
126
|
-
readonly model: Root;
|
|
127
|
-
}> {
|
|
128
|
-
/** The placed editor (`Editor.at(...)`), whose sync runs after every Message. */
|
|
129
|
-
readonly editor: {
|
|
130
|
-
readonly after: <M, R extends {
|
|
131
|
-
readonly model: Root;
|
|
132
|
-
}>(update: (model: Root, message: M) => R) => (model: Root, message: M) => R;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* The editor's placement (`Page.children.editor`): its `open`, `blank` and
|
|
136
|
-
* `close`, and its link, which reads the form's Messages out of the page's.
|
|
137
|
-
*/
|
|
138
|
-
readonly editing: {
|
|
139
|
-
readonly helpers: {
|
|
140
|
-
readonly open: (id: Id) => (model: Root) => Out;
|
|
141
|
-
readonly blank: () => (model: Root) => Out;
|
|
142
|
-
readonly close: () => (model: Root) => Out;
|
|
143
|
-
};
|
|
144
|
-
readonly link: {
|
|
145
|
-
readonly fromParentMessage: (message: never) => Option.Option<unknown>;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
/** The remover's placement, when the screen can delete: its `ask`. */
|
|
149
|
-
readonly removing?: {
|
|
150
|
-
readonly helpers: {
|
|
151
|
-
readonly ask: (id: Id) => (model: Root) => Asked;
|
|
152
|
-
};
|
|
153
|
-
} | undefined;
|
|
154
|
-
/**
|
|
155
|
-
* The form's pickers (`Crud.options`), when they page: a picker's
|
|
156
|
-
* `AskedForMore` shows one more page of its list, and still reaches the form.
|
|
157
|
-
*/
|
|
158
|
-
readonly pickers?: {
|
|
159
|
-
readonly ask: (root: NoInfer<Root>, key: never) => NoInfer<Root>;
|
|
160
|
-
} | undefined;
|
|
161
|
-
}
|
|
162
|
-
declare const screen: <const Name extends string, Id extends Schema.Top>(name: Name, config: {
|
|
163
|
-
readonly id: Id;
|
|
164
|
-
}) => {
|
|
165
|
-
/** For `Bundle.withMessages`, beside the page's own. */
|
|
166
|
-
messages: ScreenCases<Name, Id>;
|
|
167
|
-
/**
|
|
168
|
-
* Wraps the page's `update`: the screen's Messages are answered here, and
|
|
169
|
-
* every other goes to `update`; the editor's sync runs after each, so the
|
|
170
|
-
* loaded value is shown whichever Message brings it.
|
|
171
|
-
*/
|
|
172
|
-
update: <Root, Message extends {
|
|
173
|
-
readonly _tag: string;
|
|
174
|
-
}, Result extends {
|
|
175
|
-
readonly model: Root;
|
|
176
|
-
}, Out extends {
|
|
177
|
-
readonly model: Root;
|
|
178
|
-
}, Asked extends {
|
|
179
|
-
readonly model: Root;
|
|
180
|
-
} = never>(pieces: ScreenPieces<Root, Id['Type'], Out, Asked>, update: (model: Root, message: Message) => Result) => (model: Root, message: Message) => Asked | Out | Result;
|
|
181
|
-
};
|
|
182
|
-
/** How a list is sorted: by which of its orders, which way; `null` for the server's own order. */
|
|
183
|
-
type SortState<Column extends string> = {
|
|
184
|
-
readonly by: Column;
|
|
185
|
-
readonly direction: 'asc' | 'desc';
|
|
186
|
-
} | null;
|
|
187
|
-
/** How one column is sorted now, and the Message a click on its header sends. */
|
|
188
|
-
interface SortedColumn<Message> {
|
|
189
|
-
readonly direction?: 'asc' | 'desc' | undefined;
|
|
190
|
-
readonly message: Message;
|
|
191
|
-
}
|
|
192
|
-
export declare const Sort: {
|
|
193
|
-
/**
|
|
194
|
-
* The orders a list offers, by name. A name is an order the server knows, not
|
|
195
|
-
* a column: which columns may sort, and what `title` means in SQL, stay the
|
|
196
|
-
* server's to decide.
|
|
197
|
-
*/
|
|
198
|
-
make: <const Columns extends readonly [string, ...string[]]>(columns: Columns) => {
|
|
199
|
-
columns: Columns;
|
|
200
|
-
/** For the Model field, and for the query's input. */
|
|
201
|
-
Schema: Schema.Codec<SortState<Columns[number]>, SortState<Columns[number]>>;
|
|
202
|
-
/** The server's own order. */
|
|
203
|
-
none: SortState<Columns[number]>;
|
|
204
|
-
toggle: (current: SortState<Columns[number]>, column: Columns[number]) => SortState<Columns[number]>;
|
|
205
|
-
/**
|
|
206
|
-
* What a drawn table takes as `sort`: every order with how it is sorted now
|
|
207
|
-
* and the Message a click sends, made from the state the click leads to and
|
|
208
|
-
* the column clicked. A click meets the state last drawn, so two clicks
|
|
209
|
-
* inside one frame both send the same `next`; send the column instead
|
|
210
|
-
* (`(_, column) => Sorted({ column })`) and `toggle` it in `update`, from
|
|
211
|
-
* the Model as it is then.
|
|
212
|
-
*/
|
|
213
|
-
inputs: <Message>(current: SortState<Columns[number]>, message: (next: SortState<Columns[number]>, column: Columns[number]) => Message) => { readonly [K in Columns[number]]: SortedColumn<Message>; };
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
13
|
/** The parts of a `Form.make` result an editor wraps. */
|
|
217
14
|
export interface EditableForm<Name extends string, FormModel, FormMessage, Value, E extends AnyEntity, Fields extends Schema.Struct.Fields, Members, R = never> {
|
|
218
15
|
readonly bundle: {
|
|
@@ -232,6 +29,7 @@ export interface EditableForm<Name extends string, FormModel, FormMessage, Value
|
|
|
232
29
|
Refused(fields: {
|
|
233
30
|
readonly key: string;
|
|
234
31
|
readonly error: string;
|
|
32
|
+
readonly value: unknown;
|
|
235
33
|
}): FormMessage;
|
|
236
34
|
};
|
|
237
35
|
}
|
|
@@ -308,13 +106,17 @@ export interface DomainLike<Root> {
|
|
|
308
106
|
readonly command: Command<RemoteMessage, never, RemoteClient>;
|
|
309
107
|
};
|
|
310
108
|
get(selection: any, id: string): Projection<Root, RemoteData<any>>;
|
|
311
|
-
query(query: any, input: any, options: any): Projection<Root, RemoteData<Page<any
|
|
109
|
+
query(query: any, input: any, options: any): Projection<Root, RemoteData<Page<any>>> & {
|
|
110
|
+
readonly ref: {
|
|
111
|
+
readonly identity: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
312
114
|
more(model: Root, projection: any): Option.Option<Root>;
|
|
313
115
|
refresh(model: Root, target: any): Root;
|
|
314
116
|
mutation(model: Root, requestId: string): MutationStatus;
|
|
315
117
|
refusal(model: Root, requestId: string, mutation: any): Option.Option<unknown>;
|
|
316
118
|
/** `Data.active`: a read of the domain as an active Surface of its application. */
|
|
317
|
-
active(name: string, projectionOf: (model: Root) => Option.Option<Projection<Root,
|
|
119
|
+
active<Value>(name: string, projectionOf: (model: Root) => Option.Option<Projection<Root, Value>>): ActiveSurface<Root, Value>;
|
|
318
120
|
}
|
|
319
121
|
type Step<Root> = Update.Step<Root, RemoteMessage, RemoteClient>;
|
|
320
122
|
/** One thing a relation picker offers. */
|
|
@@ -348,7 +150,7 @@ export declare const Crud: {
|
|
|
348
150
|
readonly id: (root: Root) => Option.Option<string>;
|
|
349
151
|
}) => {
|
|
350
152
|
/** For `Data.subscriptions`: the value is fetched and retained while an id is shown. */
|
|
351
|
-
active: ActiveSurface<Root,
|
|
153
|
+
active: ActiveSurface<Root, RemoteData<any>>;
|
|
352
154
|
value: (root: Root) => RemoteData<Row>;
|
|
353
155
|
/**
|
|
354
156
|
* Asks for the value again: `Data.refresh` over this detail, for a retry
|
|
@@ -435,6 +237,8 @@ export declare const Crud: {
|
|
|
435
237
|
readonly selection: Selection<EntityName, Members, S>;
|
|
436
238
|
/** How many rows a page holds. Default 25. */
|
|
437
239
|
readonly pageSize?: number;
|
|
240
|
+
/** Watch the list live while it is shown (`Data.query`'s `live`). */
|
|
241
|
+
readonly live?: boolean;
|
|
438
242
|
/**
|
|
439
243
|
* How a row reads as a choice in a relation picker: its id, and the words
|
|
440
244
|
* that identify it to a person. Give it to a list that feeds pickers.
|
|
@@ -459,8 +263,17 @@ export declare const Crud: {
|
|
|
459
263
|
readonly input: (root: Root) => Option.Option<Input>;
|
|
460
264
|
}) => {
|
|
461
265
|
/** For `Data.subscriptions`: the page and its rows are fetched and retained while shown. */
|
|
462
|
-
active: ActiveSurface<Root,
|
|
266
|
+
active: ActiveSurface<Root, RemoteData<Page<any>>>;
|
|
463
267
|
page: (root: Root) => RemoteData<Page<S['Type']>>;
|
|
268
|
+
/**
|
|
269
|
+
* The connection the list reads while it is shown, for a write's
|
|
270
|
+
* optimistic insert or remove (`ConnectionChange.prepend(list, ref)`):
|
|
271
|
+
* the list's own key, so a change cannot name one rebuilt from its
|
|
272
|
+
* input that nothing reads. None while the list is not shown.
|
|
273
|
+
*/
|
|
274
|
+
connection: (root: Root) => Option.Option<{
|
|
275
|
+
readonly identity: string;
|
|
276
|
+
}>;
|
|
464
277
|
/**
|
|
465
278
|
* "Load more": the Model with the list showing one page more, for the
|
|
466
279
|
* read entry to fetch; none when it shows every row there is.
|
|
@@ -487,12 +300,13 @@ export declare const Crud: {
|
|
|
487
300
|
/** Whether the list was given a `choice`, so its rows can be a picker's choices. */
|
|
488
301
|
offersChoices: boolean;
|
|
489
302
|
/**
|
|
490
|
-
* The loaded rows as a picker's choices, read through `choice
|
|
303
|
+
* The loaded rows as a picker's choices, read through `choice`; after a
|
|
304
|
+
* failed refresh, the rows last read, as the list still shows them. Listing a
|
|
491
305
|
* relation's target is this query, which the application chose and the
|
|
492
306
|
* server authorizes; nothing is read because a relation exists.
|
|
493
307
|
*/
|
|
494
308
|
choices: (root: Root) => ReadonlyArray<Choice>;
|
|
495
|
-
/** That row as a choice, once it is read. */
|
|
309
|
+
/** That row as a choice, once it is read, or as last read when a refresh failed. */
|
|
496
310
|
choiceOf: (root: Root, id: string) => Choice | undefined;
|
|
497
311
|
};
|
|
498
312
|
};
|
|
@@ -615,7 +429,18 @@ export declare const Crud: {
|
|
|
615
429
|
};
|
|
616
430
|
}>;
|
|
617
431
|
/** What the editor loads before it shows the form: every member the form writes. */
|
|
618
|
-
selection: Selection<E["name"], import("foldkit-entity").WrittenSpec<Members>, Schema.Struct<{ readonly [K in keyof import("foldkit-entity").WrittenSpec<Members> & keyof E["members"]]: E["members"][K] extends (infer T) ? T extends E["members"][K] ? T extends import("foldkit-entity").EntityDerived<any, any, infer S extends Schema.Constraint
|
|
432
|
+
selection: Selection<E["name"], import("foldkit-entity").WrittenSpec<Members>, Schema.Struct<{ readonly [K in keyof import("foldkit-entity").WrittenSpec<Members> & keyof E["members"]]: E["members"][K] extends (infer T) ? T extends E["members"][K] ? T extends import("foldkit-entity").EntityDerived<any, any, infer S extends Schema.Constraint, {
|
|
433
|
+
readonly _tag: "Count";
|
|
434
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
435
|
+
} | {
|
|
436
|
+
readonly _tag: "Exists";
|
|
437
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
438
|
+
readonly viewer: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
439
|
+
} | {
|
|
440
|
+
readonly _tag: "Supplied";
|
|
441
|
+
readonly predict: Option.Option<import("foldkit-entity").Predict>;
|
|
442
|
+
readonly forbids: Option.Option<import("foldkit-entity").Forbids>;
|
|
443
|
+
}> | import("foldkit-entity").EntityField<any, any, infer S extends Schema.Constraint> ? S : T extends import("foldkit-entity").EntityRelation<any, any, infer Target extends AnyEntity, infer C extends import("foldkit-entity").Cardinality, infer Optional extends boolean> ? import("foldkit-entity").WrittenSpec<Members>[K] extends (infer T_1) ? T_1 extends import("foldkit-entity").WrittenSpec<Members>[K] ? T_1 extends SelectionPage<any, infer S_1 extends Schema.Constraint> ? Schema.Struct<{
|
|
619
444
|
readonly items: Schema.$Array<S_1>;
|
|
620
445
|
readonly hasNext: Schema.Boolean;
|
|
621
446
|
readonly hasPrevious: Schema.Boolean;
|
|
@@ -644,7 +469,79 @@ export declare const Crud: {
|
|
|
644
469
|
* For `Data.subscriptions`: while an id is being edited, what it loads is
|
|
645
470
|
* a requirement like any Surface's, so Remote fetches and retains it.
|
|
646
471
|
*/
|
|
647
|
-
active: ActiveSurface<Root,
|
|
472
|
+
active: ActiveSurface<Root, RemoteData<Schema.Struct.View<{ readonly [K in keyof import("foldkit-entity").WrittenSpec<Members> & keyof E["members"]]: E["members"][K] extends (infer T) ? T extends E["members"][K] ? T extends import("foldkit-entity").EntityDerived<any, any, infer S extends Schema.Constraint, {
|
|
473
|
+
readonly _tag: "Count";
|
|
474
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
475
|
+
} | {
|
|
476
|
+
readonly _tag: "Exists";
|
|
477
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
478
|
+
readonly viewer: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
479
|
+
} | {
|
|
480
|
+
readonly _tag: "Supplied";
|
|
481
|
+
readonly predict: Option.Option<import("foldkit-entity").Predict>;
|
|
482
|
+
readonly forbids: Option.Option<import("foldkit-entity").Forbids>;
|
|
483
|
+
}> | import("foldkit-entity").EntityField<any, any, infer S extends Schema.Constraint> ? S : T extends import("foldkit-entity").EntityRelation<any, any, infer Target extends AnyEntity, infer C extends import("foldkit-entity").Cardinality, infer Optional extends boolean> ? import("foldkit-entity").WrittenSpec<Members>[K] extends (infer T_1) ? T_1 extends import("foldkit-entity").WrittenSpec<Members>[K] ? T_1 extends SelectionPage<any, infer S_1 extends Schema.Constraint> ? Schema.Struct<{
|
|
484
|
+
readonly items: Schema.$Array<S_1>;
|
|
485
|
+
readonly hasNext: Schema.Boolean;
|
|
486
|
+
readonly hasPrevious: Schema.Boolean;
|
|
487
|
+
}> : C extends "many" ? Schema.$Array<T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
488
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
489
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
490
|
+
}>> : Optional extends true ? Schema.NullOr<T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
491
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
492
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
493
|
+
}>> : T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
494
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
495
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
496
|
+
}> : never : never : never : never : never; }, "Type", Schema.Struct.TypeOptionalKeys<{ readonly [K in keyof import("foldkit-entity").WrittenSpec<Members> & keyof E["members"]]: E["members"][K] extends (infer T) ? T extends E["members"][K] ? T extends import("foldkit-entity").EntityDerived<any, any, infer S extends Schema.Constraint, {
|
|
497
|
+
readonly _tag: "Count";
|
|
498
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
499
|
+
} | {
|
|
500
|
+
readonly _tag: "Exists";
|
|
501
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
502
|
+
readonly viewer: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
503
|
+
} | {
|
|
504
|
+
readonly _tag: "Supplied";
|
|
505
|
+
readonly predict: Option.Option<import("foldkit-entity").Predict>;
|
|
506
|
+
readonly forbids: Option.Option<import("foldkit-entity").Forbids>;
|
|
507
|
+
}> | import("foldkit-entity").EntityField<any, any, infer S extends Schema.Constraint> ? S : T extends import("foldkit-entity").EntityRelation<any, any, infer Target extends AnyEntity, infer C extends import("foldkit-entity").Cardinality, infer Optional extends boolean> ? import("foldkit-entity").WrittenSpec<Members>[K] extends (infer T_1) ? T_1 extends import("foldkit-entity").WrittenSpec<Members>[K] ? T_1 extends SelectionPage<any, infer S_1 extends Schema.Constraint> ? Schema.Struct<{
|
|
508
|
+
readonly items: Schema.$Array<S_1>;
|
|
509
|
+
readonly hasNext: Schema.Boolean;
|
|
510
|
+
readonly hasPrevious: Schema.Boolean;
|
|
511
|
+
}> : C extends "many" ? Schema.$Array<T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
512
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
513
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
514
|
+
}>> : Optional extends true ? Schema.NullOr<T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
515
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
516
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
517
|
+
}>> : T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
518
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
519
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
520
|
+
}> : never : never : never : never : never; }>, Schema.Struct.TypeMutableKeys<{ readonly [K in keyof import("foldkit-entity").WrittenSpec<Members> & keyof E["members"]]: E["members"][K] extends (infer T) ? T extends E["members"][K] ? T extends import("foldkit-entity").EntityDerived<any, any, infer S extends Schema.Constraint, {
|
|
521
|
+
readonly _tag: "Count";
|
|
522
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
523
|
+
} | {
|
|
524
|
+
readonly _tag: "Exists";
|
|
525
|
+
readonly relation: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
526
|
+
readonly viewer: import("foldkit-entity").EntityRelation<string, string, AnyEntity, "one", boolean>;
|
|
527
|
+
} | {
|
|
528
|
+
readonly _tag: "Supplied";
|
|
529
|
+
readonly predict: Option.Option<import("foldkit-entity").Predict>;
|
|
530
|
+
readonly forbids: Option.Option<import("foldkit-entity").Forbids>;
|
|
531
|
+
}> | import("foldkit-entity").EntityField<any, any, infer S extends Schema.Constraint> ? S : T extends import("foldkit-entity").EntityRelation<any, any, infer Target extends AnyEntity, infer C extends import("foldkit-entity").Cardinality, infer Optional extends boolean> ? import("foldkit-entity").WrittenSpec<Members>[K] extends (infer T_1) ? T_1 extends import("foldkit-entity").WrittenSpec<Members>[K] ? T_1 extends SelectionPage<any, infer S_1 extends Schema.Constraint> ? Schema.Struct<{
|
|
532
|
+
readonly items: Schema.$Array<S_1>;
|
|
533
|
+
readonly hasNext: Schema.Boolean;
|
|
534
|
+
readonly hasPrevious: Schema.Boolean;
|
|
535
|
+
}> : C extends "many" ? Schema.$Array<T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
536
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
537
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
538
|
+
}>> : Optional extends true ? Schema.NullOr<T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
539
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
540
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
541
|
+
}>> : T_1 extends Selection<any, any, infer S_2 extends Schema.Constraint, string> ? S_2 : Schema.Struct<{
|
|
542
|
+
readonly entity: Schema.Literal<Target["name"]>;
|
|
543
|
+
readonly id: import("foldkit-entity").IdSchemaOf<Target>;
|
|
544
|
+
}> : never : never : never : never : never; }>>>>;
|
|
648
545
|
sync: Update.Step<Root, never, never>;
|
|
649
546
|
/**
|
|
650
547
|
* Wraps the application's `update` so `sync` runs after every Message:
|
|
@@ -673,5 +570,5 @@ export declare const Crud: {
|
|
|
673
570
|
};
|
|
674
571
|
};
|
|
675
572
|
};
|
|
676
|
-
export type
|
|
677
|
-
//# sourceMappingURL=index.d.
|
|
573
|
+
export { Display, type DisplayColumn, type DisplayKind, type DisplayWords, Sort, type SortState, type SortedColumn };
|
|
574
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;iBA+CiB,aACf,qBACA,WACA,aACA,OACA,UAAU,WACV,eAAe,OAAO,OAAO,QAC7B,SACA;WAES;aACE,MAAM;aACN,OAAO,OAAO,MAAM;aACpB,SAAS,OAAO,MAAM;aACtB,SACP,OAAO,WACP,SAAS,aACT,eACG,OAAO,qBAAqB,WAAW,aAAa,UAAU,QAAQ;;WAEpE,OAAO,YAAY,GAAG,QAAQ;WAC9B,SAAS;WACT,OAAO,OAAO,WAAW,QAAQ,QAAQ;aAAsB,OAAO;;WACt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