@stonecrop/schema 0.31.0 → 0.32.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 (82) hide show
  1. package/README.md +10 -10
  2. package/dist/cli.js +194 -121
  3. package/dist/cli.js.map +1 -1
  4. package/dist/converter-CLwduvT_.js +2102 -0
  5. package/dist/converter-CLwduvT_.js.map +1 -0
  6. package/dist/flatten-Bx2cfvw3.js +37 -0
  7. package/dist/flatten-Bx2cfvw3.js.map +1 -0
  8. package/dist/index.js +123 -117
  9. package/dist/index.js.map +1 -1
  10. package/dist/record-BQOOi83C.js +134 -0
  11. package/dist/record-BQOOi83C.js.map +1 -0
  12. package/dist/record.js +2 -6
  13. package/dist/tsdoc-metadata.json +1 -1
  14. package/package.json +34 -18
  15. package/dist/flatten-C1MjkzFh.js +0 -10
  16. package/dist/flatten-C1MjkzFh.js.map +0 -1
  17. package/dist/record-Bc0lI9Rq.js +0 -61
  18. package/dist/record-Bc0lI9Rq.js.map +0 -1
  19. package/dist/record.js.map +0 -1
  20. package/dist/schema.tsbuildinfo +0 -1
  21. package/dist/src/badge.d.ts +0 -74
  22. package/dist/src/badge.d.ts.map +0 -1
  23. package/dist/src/badge.js +0 -158
  24. package/dist/src/cli.d.ts +0 -3
  25. package/dist/src/cli.d.ts.map +0 -1
  26. package/dist/src/cli.js +0 -292
  27. package/dist/src/column-schema.d.ts +0 -163
  28. package/dist/src/column-schema.d.ts.map +0 -1
  29. package/dist/src/column-schema.js +0 -0
  30. package/dist/src/component-meta.d.ts +0 -96
  31. package/dist/src/component-meta.d.ts.map +0 -1
  32. package/dist/src/component-meta.js +0 -88
  33. package/dist/src/converter/aggregate.d.ts +0 -127
  34. package/dist/src/converter/aggregate.d.ts.map +0 -1
  35. package/dist/src/converter/aggregate.js +0 -235
  36. package/dist/src/converter/authored.d.ts +0 -43
  37. package/dist/src/converter/authored.d.ts.map +0 -1
  38. package/dist/src/converter/authored.js +0 -52
  39. package/dist/src/converter/heuristics.d.ts +0 -60
  40. package/dist/src/converter/heuristics.d.ts.map +0 -1
  41. package/dist/src/converter/heuristics.js +0 -304
  42. package/dist/src/converter/index.d.ts +0 -51
  43. package/dist/src/converter/index.d.ts.map +0 -1
  44. package/dist/src/converter/index.js +0 -195
  45. package/dist/src/converter/merge.d.ts +0 -102
  46. package/dist/src/converter/merge.d.ts.map +0 -1
  47. package/dist/src/converter/merge.js +0 -136
  48. package/dist/src/converter/scalars.d.ts +0 -46
  49. package/dist/src/converter/scalars.d.ts.map +0 -1
  50. package/dist/src/converter/scalars.js +0 -83
  51. package/dist/src/converter/types.d.ts +0 -157
  52. package/dist/src/converter/types.d.ts.map +0 -1
  53. package/dist/src/converter/types.js +0 -5
  54. package/dist/src/doctype.d.ts +0 -516
  55. package/dist/src/doctype.d.ts.map +0 -1
  56. package/dist/src/doctype.js +0 -343
  57. package/dist/src/field.d.ts +0 -423
  58. package/dist/src/field.d.ts.map +0 -1
  59. package/dist/src/field.js +0 -378
  60. package/dist/src/flatten.d.ts +0 -29
  61. package/dist/src/flatten.d.ts.map +0 -1
  62. package/dist/src/flatten.js +0 -38
  63. package/dist/src/index.d.ts +0 -16
  64. package/dist/src/index.d.ts.map +0 -1
  65. package/dist/src/index.js +0 -20
  66. package/dist/src/mode.d.ts +0 -15
  67. package/dist/src/mode.d.ts.map +0 -1
  68. package/dist/src/mode.js +0 -0
  69. package/dist/src/naming.d.ts +0 -80
  70. package/dist/src/naming.d.ts.map +0 -1
  71. package/dist/src/naming.js +0 -106
  72. package/dist/src/record.d.ts +0 -29
  73. package/dist/src/record.d.ts.map +0 -1
  74. package/dist/src/record.js +0 -55
  75. package/dist/src/table.d.ts +0 -33
  76. package/dist/src/table.d.ts.map +0 -1
  77. package/dist/src/table.js +0 -25
  78. package/dist/src/validation.d.ts +0 -54
  79. package/dist/src/validation.d.ts.map +0 -1
  80. package/dist/src/validation.js +0 -60
  81. package/dist/validation-C9P__pRF.js +0 -994
  82. package/dist/validation-C9P__pRF.js.map +0 -1
@@ -1,516 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Cardinality for relationship links.
4
- * @public
5
- */
6
- export declare const Cardinality: z.ZodEnum<{
7
- atMostOne: "atMostOne";
8
- one: "one";
9
- noneOrMany: "noneOrMany";
10
- atLeastOne: "atLeastOne";
11
- }>;
12
- /**
13
- * Cardinality type inferred from Zod schema
14
- * @public
15
- */
16
- export type Cardinality = z.infer<typeof Cardinality>;
17
- /**
18
- * Serialized function type - a function serialized to a string.
19
- * Used for custom fetch handlers.
20
- * @public
21
- */
22
- export type SerializedFunction = string;
23
- /**
24
- * Sync fetch strategy - data is fetched in the initial query.
25
- * @public
26
- */
27
- export declare const SyncFetch: z.ZodObject<{
28
- method: z.ZodLiteral<"sync">;
29
- limit: z.ZodOptional<z.ZodNumber>;
30
- }, z.core.$strip>;
31
- /**
32
- * Sync fetch strategy type
33
- * @public
34
- */
35
- export type SyncFetch = z.infer<typeof SyncFetch>;
36
- /**
37
- * Lazy fetch strategy - data is fetched on demand in a separate query.
38
- * @public
39
- */
40
- export declare const LazyFetch: z.ZodObject<{
41
- method: z.ZodLiteral<"lazy">;
42
- }, z.core.$strip>;
43
- /**
44
- * Lazy fetch strategy type
45
- * @public
46
- */
47
- export type LazyFetch = z.infer<typeof LazyFetch>;
48
- /**
49
- * Custom fetch strategy - uses a custom handler function.
50
- * @public
51
- */
52
- export declare const CustomFetch: z.ZodObject<{
53
- method: z.ZodLiteral<"custom">;
54
- handler: z.ZodString;
55
- }, z.core.$strip>;
56
- /**
57
- * Custom fetch strategy type
58
- * @public
59
- */
60
- export type CustomFetch = z.infer<typeof CustomFetch>;
61
- /**
62
- * Fetch strategy for link data loading.
63
- * - sync: fetched in the initial query
64
- * - lazy: fetched on demand in a separate query
65
- * - custom: uses a custom handler function
66
- * @public
67
- */
68
- export declare const FetchStrategy: z.ZodDiscriminatedUnion<[z.ZodObject<{
69
- method: z.ZodLiteral<"sync">;
70
- limit: z.ZodOptional<z.ZodNumber>;
71
- }, z.core.$strip>, z.ZodObject<{
72
- method: z.ZodLiteral<"lazy">;
73
- }, z.core.$strip>, z.ZodObject<{
74
- method: z.ZodLiteral<"custom">;
75
- handler: z.ZodString;
76
- }, z.core.$strip>], "method">;
77
- /**
78
- * Fetch strategy type
79
- * @public
80
- */
81
- export type FetchStrategy = z.infer<typeof FetchStrategy>;
82
- /**
83
- * Link declaration - describes a relationship from one doctype to another.
84
- * @public
85
- */
86
- export declare const LinkDeclaration: z.ZodObject<{
87
- target: z.ZodString;
88
- cardinality: z.ZodEnum<{
89
- atMostOne: "atMostOne";
90
- one: "one";
91
- noneOrMany: "noneOrMany";
92
- atLeastOne: "atLeastOne";
93
- }>;
94
- backlink: z.ZodOptional<z.ZodString>;
95
- component: z.ZodOptional<z.ZodString>;
96
- fieldname: z.ZodOptional<z.ZodString>;
97
- fetch: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
98
- method: z.ZodLiteral<"sync">;
99
- limit: z.ZodOptional<z.ZodNumber>;
100
- }, z.core.$strip>, z.ZodObject<{
101
- method: z.ZodLiteral<"lazy">;
102
- }, z.core.$strip>, z.ZodObject<{
103
- method: z.ZodLiteral<"custom">;
104
- handler: z.ZodString;
105
- }, z.core.$strip>], "method">>;
106
- blockWorkflows: z.ZodOptional<z.ZodBoolean>;
107
- }, z.core.$strip>;
108
- /**
109
- * Link declaration type inferred from Zod schema
110
- * @public
111
- */
112
- export type LinkDeclaration = z.infer<typeof LinkDeclaration>;
113
- /**
114
- * Action definition within a workflow
115
- * @public
116
- */
117
- export declare const ActionDefinition: z.ZodObject<{
118
- label: z.ZodString;
119
- requiredFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
- allowedStates: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
- nextState: z.ZodOptional<z.ZodString>;
122
- stateless: z.ZodOptional<z.ZodBoolean>;
123
- selfTransition: z.ZodOptional<z.ZodBoolean>;
124
- clientHandler: z.ZodOptional<z.ZodString>;
125
- }, z.core.$strip>;
126
- /**
127
- * Action definition type inferred from Zod schema
128
- * @public
129
- */
130
- export type ActionDefinition = z.infer<typeof ActionDefinition>;
131
- /**
132
- * Reactive field-validation trigger — advisory, client-side only.
133
- *
134
- * A Trigger is a docbuilder-authored validator: when any field in `on` is edited, its
135
- * `clientHandler` runs (client-side, no rollback) and may flag a field inline to block save
136
- * in the UI. It is deliberately a **sibling** to {@link (ActionDefinition:type)}, not a member of it —
137
- * a reactive validator is not a user-invoked action, so it lives in the `triggers` map on
138
- * {@link (WorkflowMeta:type)} and never appears to action readers (transition/command dropdowns, the FSM graph).
139
- *
140
- * The two bindings are independent: `on` is the fire-set (which fields' edits run it), while the
141
- * `setError(field, msg)` call inside `clientHandler` chooses which field displays the error.
142
- * @public
143
- */
144
- export declare const TriggerDefinition: z.ZodObject<{
145
- label: z.ZodOptional<z.ZodString>;
146
- on: z.ZodArray<z.ZodString>;
147
- clientHandler: z.ZodString;
148
- }, z.core.$strip>;
149
- /**
150
- * Trigger definition type inferred from Zod schema
151
- * @public
152
- */
153
- export type TriggerDefinition = z.infer<typeof TriggerDefinition>;
154
- /**
155
- * Whether a workflow action may run from `currentState`.
156
- *
157
- * Single source of truth for the "is this action available here" rule, shared by
158
- * the frontend (`getAvailableTransitions`) and the server-side dispatch guard so
159
- * the two can never disagree. Empty or absent `allowedStates` means the action is
160
- * available in ALL states — a plain `allowedStates.includes(currentState)` would
161
- * wrongly block such actions everywhere.
162
- *
163
- * @public
164
- */
165
- export declare function isActionAllowedInState(action: {
166
- allowedStates?: string[] | null;
167
- }, currentState: string): boolean;
168
- /**
169
- * DocBuilder graph layout — node positions for the workflow-state graph, keyed by state name.
170
- * Pure authoring view-state: persisted in the doctype JSON so an author's manual arrangement
171
- * survives reloads, but — exactly like {@link (WorkflowMeta:type)}'s `triggers` — it is client-only
172
- * and never mirrored into the runtime GraphQL SDL (see the WorkflowMeta type in the host SDLs, which
173
- * expose only `states`/`actions`). The shape mirrors VueFlow's node fields; `position` is the node's
174
- * canvas coordinate and `targetPosition`/`sourcePosition` are the handle sides.
175
- * @public
176
- */
177
- export declare const WorkflowLayout: z.ZodRecord<z.ZodString, z.ZodObject<{
178
- position: z.ZodOptional<z.ZodObject<{
179
- x: z.ZodNumber;
180
- y: z.ZodNumber;
181
- }, z.core.$strip>>;
182
- targetPosition: z.ZodOptional<z.ZodEnum<{
183
- left: "left";
184
- right: "right";
185
- top: "top";
186
- bottom: "bottom";
187
- }>>;
188
- sourcePosition: z.ZodOptional<z.ZodEnum<{
189
- left: "left";
190
- right: "right";
191
- top: "top";
192
- bottom: "bottom";
193
- }>>;
194
- }, z.core.$strip>>;
195
- /**
196
- * Workflow layout type inferred from Zod schema
197
- * @public
198
- */
199
- export type WorkflowLayout = z.infer<typeof WorkflowLayout>;
200
- /**
201
- * Workflow metadata - states and actions for a doctype
202
- * @public
203
- */
204
- export declare const WorkflowMeta: z.ZodObject<{
205
- states: z.ZodOptional<z.ZodArray<z.ZodString>>;
206
- actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
207
- label: z.ZodString;
208
- requiredFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
209
- allowedStates: z.ZodOptional<z.ZodArray<z.ZodString>>;
210
- nextState: z.ZodOptional<z.ZodString>;
211
- stateless: z.ZodOptional<z.ZodBoolean>;
212
- selfTransition: z.ZodOptional<z.ZodBoolean>;
213
- clientHandler: z.ZodOptional<z.ZodString>;
214
- }, z.core.$strip>>>;
215
- triggers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
216
- label: z.ZodOptional<z.ZodString>;
217
- on: z.ZodArray<z.ZodString>;
218
- clientHandler: z.ZodString;
219
- }, z.core.$strip>>>;
220
- layout: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
221
- position: z.ZodOptional<z.ZodObject<{
222
- x: z.ZodNumber;
223
- y: z.ZodNumber;
224
- }, z.core.$strip>>;
225
- targetPosition: z.ZodOptional<z.ZodEnum<{
226
- left: "left";
227
- right: "right";
228
- top: "top";
229
- bottom: "bottom";
230
- }>>;
231
- sourcePosition: z.ZodOptional<z.ZodEnum<{
232
- left: "left";
233
- right: "right";
234
- top: "top";
235
- bottom: "bottom";
236
- }>>;
237
- }, z.core.$strip>>>;
238
- }, z.core.$strip>;
239
- /**
240
- * Workflow metadata type inferred from Zod schema
241
- * @public
242
- */
243
- export type WorkflowMeta = z.infer<typeof WorkflowMeta>;
244
- /**
245
- * Doctype metadata - complete definition of a doctype
246
- * @public
247
- */
248
- export declare const DoctypeMeta: z.ZodObject<{
249
- name: z.ZodString;
250
- slug: z.ZodOptional<z.ZodString>;
251
- displayField: z.ZodOptional<z.ZodString>;
252
- route: z.ZodOptional<z.ZodString>;
253
- fields: z.ZodArray<z.ZodType<import("./field").DoctypeField, unknown, z.core.$ZodTypeInternals<import("./field").DoctypeField, unknown>>>;
254
- links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
255
- target: z.ZodString;
256
- cardinality: z.ZodEnum<{
257
- atMostOne: "atMostOne";
258
- one: "one";
259
- noneOrMany: "noneOrMany";
260
- atLeastOne: "atLeastOne";
261
- }>;
262
- backlink: z.ZodOptional<z.ZodString>;
263
- component: z.ZodOptional<z.ZodString>;
264
- fieldname: z.ZodOptional<z.ZodString>;
265
- fetch: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
266
- method: z.ZodLiteral<"sync">;
267
- limit: z.ZodOptional<z.ZodNumber>;
268
- }, z.core.$strip>, z.ZodObject<{
269
- method: z.ZodLiteral<"lazy">;
270
- }, z.core.$strip>, z.ZodObject<{
271
- method: z.ZodLiteral<"custom">;
272
- handler: z.ZodString;
273
- }, z.core.$strip>], "method">>;
274
- blockWorkflows: z.ZodOptional<z.ZodBoolean>;
275
- }, z.core.$strip>>>;
276
- workflow: z.ZodOptional<z.ZodObject<{
277
- states: z.ZodOptional<z.ZodArray<z.ZodString>>;
278
- actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
279
- label: z.ZodString;
280
- requiredFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
281
- allowedStates: z.ZodOptional<z.ZodArray<z.ZodString>>;
282
- nextState: z.ZodOptional<z.ZodString>;
283
- stateless: z.ZodOptional<z.ZodBoolean>;
284
- selfTransition: z.ZodOptional<z.ZodBoolean>;
285
- clientHandler: z.ZodOptional<z.ZodString>;
286
- }, z.core.$strip>>>;
287
- triggers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
288
- label: z.ZodOptional<z.ZodString>;
289
- on: z.ZodArray<z.ZodString>;
290
- clientHandler: z.ZodString;
291
- }, z.core.$strip>>>;
292
- layout: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
293
- position: z.ZodOptional<z.ZodObject<{
294
- x: z.ZodNumber;
295
- y: z.ZodNumber;
296
- }, z.core.$strip>>;
297
- targetPosition: z.ZodOptional<z.ZodEnum<{
298
- left: "left";
299
- right: "right";
300
- top: "top";
301
- bottom: "bottom";
302
- }>>;
303
- sourcePosition: z.ZodOptional<z.ZodEnum<{
304
- left: "left";
305
- right: "right";
306
- top: "top";
307
- bottom: "bottom";
308
- }>>;
309
- }, z.core.$strip>>>;
310
- }, z.core.$strip>>;
311
- inherits: z.ZodOptional<z.ZodString>;
312
- }, z.core.$strip>;
313
- /**
314
- * Doctype metadata type inferred from Zod schema
315
- * @public
316
- */
317
- export type DoctypeMeta = z.infer<typeof DoctypeMeta>;
318
- /**
319
- * The one string a doctype is addressed by.
320
- *
321
- * A doctype carries two names — `name` (`OrderItem`) and `slug` (`order-item`) — and every registry
322
- * must agree on which one keys it. Three implementations had drifted apart: the adapter's registry is
323
- * keyed by `name` and its `getMeta` also scans for a matching `slug`, so it accepts **either**; the
324
- * client's registry is keyed by a slug it derives itself and accepts **only** that; and
325
- * `Doctype.fromObject` dropped an authored `slug` on the floor and re-derived one regardless. The
326
- * adapter's accepted set was therefore a strict superset of the client's, and a link target written
327
- * as the Name booted the server, passed its reference check, served rows over GraphQL, and was
328
- * silently dropped by the client — an expanding child table rendering as one empty text input, with
329
- * nothing logged.
330
- *
331
- * Resolving through this in both runtimes is what makes the two answers the same answer. It is the
332
- * derivation only; a *lookup* still belongs to whichever registry owns the corpus, because the two
333
- * corpora legitimately differ (a client registers lazily, and a client-only host has no adapter at
334
- * all).
335
- *
336
- * An authored `slug` wins over the derived one because the authored doctype is the source of truth:
337
- * generation verifies a file and never overwrites it, so a doctype that states its own slug means it.
338
- * Deriving unconditionally is what `fromObject` did, and it made an authored `slug` a silent no-op on
339
- * one side of the wire while the other honoured it.
340
- *
341
- * @param doctype - anything carrying a doctype's `name` and optional authored `slug`
342
- * @returns the canonical slug
343
- * @public
344
- *
345
- * @example
346
- * ```typescript
347
- * getDoctypeSlug({ name: 'OrderItem' }) // 'order-item'
348
- * getDoctypeSlug({ name: 'Planner', slug: 'planner-board' }) // 'planner-board'
349
- * ```
350
- */
351
- export declare function getDoctypeSlug(doctype: {
352
- name: string;
353
- slug?: string;
354
- }): string;
355
- /**
356
- * Suffix appended to a link fieldname for its pre-resolved display text in record payloads.
357
- *
358
- * @deprecated The `__display` suffix pattern is no longer used. Inline link fields are enriched
359
- * server-side by `@stonecrop/graphql-middleware` as `{ id, displayText }` objects on the link
360
- * field itself.
361
- * @public
362
- */
363
- export declare const LINK_DISPLAY_SUFFIX = "__display";
364
- /**
365
- * Build the payload key for a link field's display text (e.g. `customerId__display`).
366
- *
367
- * @deprecated The `__display` suffix pattern is no longer used. Inline link fields are enriched
368
- * server-side by `@stonecrop/graphql-middleware` as `{ id, displayText }` objects on the link
369
- * field itself.
370
- * @public
371
- */
372
- export declare function linkDisplayFieldname(fieldname: string): string;
373
- /**
374
- * Context for identifying what doctype/record we're working with.
375
- * Used by graphql-middleware and graphql-client to resolve schema metadata.
376
- * @public
377
- */
378
- export interface DoctypeContext {
379
- /** Doctype name (e.g., 'Task', 'Customer') */
380
- doctype: string;
381
- /** Optional record ID for viewing/editing a specific record */
382
- recordId?: string;
383
- /** Additional context properties */
384
- [key: string]: unknown;
385
- }
386
- /**
387
- * Base interface for doctype metadata passed to DataClient methods.
388
- * Only requires properties needed for record fetching.
389
- * @public
390
- */
391
- export interface DoctypeRef {
392
- /** Doctype name (e.g., 'Task', 'Customer') */
393
- name: string;
394
- /** URL-friendly slug (e.g., 'task', 'customer') */
395
- slug?: string;
396
- }
397
- /**
398
- * Options for fetching a single record
399
- * @public
400
- */
401
- export interface GetRecordOptions {
402
- /**
403
- * Include nested link sub-selections.
404
- * - `true`: include all descendant links
405
- * - `string[]`: include only named links
406
- * - `false` / omitted: scalar fields only (default)
407
- */
408
- includeNested?: boolean | string[];
409
- /**
410
- * Maximum depth for recursive sub-selections.
411
- * No default — unlimited when omitted.
412
- */
413
- maxDepth?: number;
414
- }
415
- /**
416
- * Options for fetching multiple records
417
- * @public
418
- */
419
- export interface GetRecordsOptions {
420
- /** Filter expression (field-value pairs) */
421
- filters?: Record<string, unknown>;
422
- /** Order by expression (e.g. 'NAME_ASC') */
423
- orderBy?: string;
424
- /** Maximum number of records to return */
425
- limit?: number;
426
- /** Number of records to skip */
427
- offset?: number;
428
- /**
429
- * Ask the backend for the total matching the filters as well as the page.
430
- *
431
- * Off by default because it costs a second query — a full scan on Postgres — and knowing
432
- * *whether* more exist (`hasMore`) is what a list view actually needs. Turn it on for a
433
- * "showing 20 of 4,312" style display.
434
- */
435
- includeTotal?: boolean;
436
- }
437
- /**
438
- * Result from getRecord - includes the record data
439
- * @public
440
- */
441
- export interface GetRecordResult {
442
- /** The record data, or null if not found */
443
- record: Record<string, unknown> | null;
444
- }
445
- /**
446
- * Result from getRecords — a page of records, and enough to tell that it is one.
447
- *
448
- * A bare array used to be returned here, which claimed to be the whole collection. It is not:
449
- * a limit always applies, so a caller could not distinguish a complete list from a truncated
450
- * one. That is the entire reason this type exists.
451
- *
452
- * @public
453
- */
454
- export interface GetRecordsResult {
455
- /** The records in this page */
456
- data: Record<string, unknown>[];
457
- /** Whether the backend holds further records beyond this page */
458
- hasMore: boolean;
459
- /**
460
- * Total records matching the filters, ignoring limit/offset. Present only when the caller
461
- * asked for it via {@link GetRecordsOptions.includeTotal} — counting is a full scan on most
462
- * backends, so it is never computed speculatively.
463
- */
464
- count?: number;
465
- }
466
- /**
467
- * Interface for data clients that fetch doctype metadata and records.
468
- * Implemented by \@stonecrop/graphql-client's StonecropClient.
469
- * Custom implementations can use any backend (REST, local storage, etc.).
470
- *
471
- * @typeParam T - Doctype reference type for record operations (defaults to DoctypeRef)
472
- * @typeParam M - Doctype metadata return type for getMeta (defaults to DoctypeMeta)
473
- * @public
474
- */
475
- export interface DataClient<T extends DoctypeRef = DoctypeRef, M = DoctypeMeta> {
476
- /**
477
- * Fetch doctype metadata
478
- * @param context - Doctype context identifying the doctype
479
- * @returns Doctype metadata or null if not found
480
- */
481
- getMeta(context: DoctypeContext): Promise<M | null>;
482
- /**
483
- * Fetch a single record by ID
484
- *
485
- * When `includeNested` is set, builds a query with sub-selections for descendant
486
- * links and returns ancestor + merged descendants. When omitted, returns flat scalar data.
487
- *
488
- * @param doctype - Doctype reference (name and optional slug)
489
- * @param recordId - Record ID to fetch
490
- * @param options - Query options
491
- * @returns Record data wrapped in GetRecordResult
492
- */
493
- getRecord(doctype: T, recordId: string, options?: GetRecordOptions): Promise<GetRecordResult>;
494
- /**
495
- * Fetch a page of records
496
- * @param doctype - Doctype reference (name and optional slug)
497
- * @param options - Query options
498
- * @returns The page, plus whether more exist and (on request) the total
499
- */
500
- getRecords(doctype: T, options?: GetRecordsOptions): Promise<GetRecordsResult>;
501
- /**
502
- * Execute a doctype action (e.g., SUBMIT, APPROVE, save).
503
- * All state changes flow through this single mutation endpoint.
504
- *
505
- * @param doctype - Doctype reference (name and optional slug)
506
- * @param action - Action name to execute (e.g., 'SUBMIT', 'APPROVE', 'save')
507
- * @param args - Action arguments (typically record ID and/or form data)
508
- * @returns Action result with success status, response data, and any error
509
- */
510
- runAction(doctype: T, action: string, args?: unknown[]): Promise<{
511
- success: boolean;
512
- data: unknown;
513
- error: string | null;
514
- }>;
515
- }
516
- //# sourceMappingURL=doctype.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;EAGtB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAErD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAEvC;;;GAGG;AACH,eAAO,MAAM,SAAS;;;iBAUnB,CAAA;AAEH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,SAAS;;iBAQnB,CAAA;AAEH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;iBAUrB,CAAA;AAEH;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;6BAGxB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEzD;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;iBA0BzB,CAAA;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,gBAAgB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