@stonecrop/schema 0.10.2 → 0.10.4

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/dist/schema.d.ts CHANGED
@@ -8,33 +8,13 @@ import { z } from 'zod';
8
8
  * @public
9
9
  */
10
10
  export declare const ActionDefinition: z.ZodObject<{
11
- /** Display label for the action */
12
11
  label: z.ZodString;
13
- /** Handler function name or path */
14
12
  handler: z.ZodString;
15
- /** Fields that must have values before action can execute */
16
- requiredFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
17
- /** Workflow states where this action is available */
18
- allowedStates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
19
- /** Whether to show a confirmation dialog */
13
+ requiredFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ allowedStates: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
15
  confirm: z.ZodOptional<z.ZodBoolean>;
21
- /** Additional arguments for the action */
22
16
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23
- }, "strip", z.ZodTypeAny, {
24
- label: string;
25
- handler: string;
26
- requiredFields?: string[] | undefined;
27
- allowedStates?: string[] | undefined;
28
- confirm?: boolean | undefined;
29
- args?: Record<string, unknown> | undefined;
30
- }, {
31
- label: string;
32
- handler: string;
33
- requiredFields?: string[] | undefined;
34
- allowedStates?: string[] | undefined;
35
- confirm?: boolean | undefined;
36
- args?: Record<string, unknown> | undefined;
37
- }>;
17
+ }, z.core.$strip>;
38
18
 
39
19
  /**
40
20
  * Action definition type inferred from Zod schema
@@ -143,6 +123,57 @@ export declare interface ConvertedGraphQLDoctype extends Omit<DoctypeMeta, 'fiel
143
123
  */
144
124
  export declare function convertGraphQLSchema(source: IntrospectionSource, options?: GraphQLConversionOptions): ConvertedGraphQLDoctype[];
145
125
 
126
+ /**
127
+ * Interface for data clients that fetch doctype metadata and records.
128
+ * Implemented by \@stonecrop/graphql-client's StonecropClient.
129
+ * Custom implementations can use any backend (REST, local storage, etc.).
130
+ *
131
+ * @typeParam T - Doctype reference type for record operations (defaults to DoctypeRef)
132
+ * @typeParam M - Doctype metadata return type for getMeta (defaults to DoctypeMeta)
133
+ * @public
134
+ */
135
+ export declare interface DataClient<T extends DoctypeRef = DoctypeRef, M = DoctypeMeta> {
136
+ /**
137
+ * Fetch doctype metadata
138
+ * @param context - Doctype context identifying the doctype
139
+ * @returns Doctype metadata or null if not found
140
+ */
141
+ getMeta(context: DoctypeContext): Promise<M | null>;
142
+ /**
143
+ * Fetch a single record by ID
144
+ * @param doctype - Doctype reference (name and optional slug)
145
+ * @param recordId - Record ID to fetch
146
+ * @returns Record data or null if not found
147
+ */
148
+ getRecord(doctype: T, recordId: string): Promise<Record<string, unknown> | null>;
149
+ /**
150
+ * Fetch multiple records
151
+ * @param doctype - Doctype reference (name and optional slug)
152
+ * @param options - Optional filters, pagination, sorting
153
+ * @returns Array of record data
154
+ */
155
+ getRecords(doctype: T, options?: {
156
+ filters?: Record<string, unknown>;
157
+ orderBy?: string;
158
+ limit?: number;
159
+ offset?: number;
160
+ }): Promise<Record<string, unknown>[]>;
161
+ /**
162
+ * Execute a doctype action (e.g., SUBMIT, APPROVE, save).
163
+ * All state changes flow through this single mutation endpoint.
164
+ *
165
+ * @param doctype - Doctype reference (name and optional slug)
166
+ * @param action - Action name to execute (e.g., 'SUBMIT', 'APPROVE', 'save')
167
+ * @param args - Action arguments (typically record ID and/or form data)
168
+ * @returns Action result with success status, response data, and any error
169
+ */
170
+ runAction(doctype: T, action: string, args?: unknown[]): Promise<{
171
+ success: boolean;
172
+ data: unknown;
173
+ error: string | null;
174
+ }>;
175
+ }
176
+
146
177
  /**
147
178
  * Default heuristic to filter fields on entity types.
148
179
  * Skips internal fields that don't represent meaningful data.
@@ -172,212 +203,88 @@ export declare function defaultIsEntityField(fieldName: string, _field: GraphQLF
172
203
  */
173
204
  export declare function defaultIsEntityType(typeName: string, type: GraphQLObjectType): boolean;
174
205
 
206
+ /**
207
+ * Context for identifying what doctype/record we're working with.
208
+ * Used by graphql-middleware and graphql-client to resolve schema metadata.
209
+ * @public
210
+ */
211
+ export declare interface DoctypeContext {
212
+ /** Doctype name (e.g., 'Task', 'Customer') */
213
+ doctype: string;
214
+ /** Optional record ID for viewing/editing a specific record */
215
+ recordId?: string;
216
+ /** Additional context properties */
217
+ [key: string]: unknown;
218
+ }
219
+
175
220
  /**
176
221
  * Doctype metadata - complete definition of a doctype
177
222
  * @public
178
223
  */
179
224
  declare const DoctypeMeta: z.ZodObject<{
180
- /** Display name of the doctype */
181
225
  name: z.ZodString;
182
- /** URL-friendly slug (kebab-case) */
183
226
  slug: z.ZodOptional<z.ZodString>;
184
- /** Database table name */
185
227
  tableName: z.ZodOptional<z.ZodString>;
186
- /** Field definitions */
187
228
  fields: z.ZodArray<z.ZodObject<{
188
229
  fieldname: z.ZodString;
189
- fieldtype: z.ZodEnum<["Data", "Text", "Int", "Float", "Decimal", "Check", "Date", "Time", "Datetime", "Duration", "DateRange", "JSON", "Code", "Link", "Doctype", "Attach", "Currency", "Quantity", "Select"]>;
230
+ fieldtype: z.ZodEnum<{
231
+ Data: "Data";
232
+ Text: "Text";
233
+ Int: "Int";
234
+ Float: "Float";
235
+ Decimal: "Decimal";
236
+ Check: "Check";
237
+ Date: "Date";
238
+ Time: "Time";
239
+ Datetime: "Datetime";
240
+ Duration: "Duration";
241
+ DateRange: "DateRange";
242
+ JSON: "JSON";
243
+ Code: "Code";
244
+ Link: "Link";
245
+ Doctype: "Doctype";
246
+ Attach: "Attach";
247
+ Currency: "Currency";
248
+ Quantity: "Quantity";
249
+ Select: "Select";
250
+ }>;
190
251
  component: z.ZodOptional<z.ZodString>;
191
252
  label: z.ZodOptional<z.ZodString>;
192
253
  width: z.ZodOptional<z.ZodString>;
193
- align: z.ZodOptional<z.ZodEnum<["left", "center", "right", "start", "end"]>>;
254
+ align: z.ZodOptional<z.ZodEnum<{
255
+ left: "left";
256
+ center: "center";
257
+ right: "right";
258
+ start: "start";
259
+ end: "end";
260
+ }>>;
194
261
  required: z.ZodOptional<z.ZodBoolean>;
195
262
  readOnly: z.ZodOptional<z.ZodBoolean>;
196
263
  edit: z.ZodOptional<z.ZodBoolean>;
197
264
  hidden: z.ZodOptional<z.ZodBoolean>;
198
265
  value: z.ZodOptional<z.ZodUnknown>;
199
266
  default: z.ZodOptional<z.ZodUnknown>;
200
- options: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
267
+ options: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
201
268
  mask: z.ZodOptional<z.ZodString>;
202
269
  validation: z.ZodOptional<z.ZodObject<{
203
270
  errorMessage: z.ZodString;
204
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
205
- errorMessage: z.ZodString;
206
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
207
- errorMessage: z.ZodString;
208
- }, z.ZodTypeAny, "passthrough">>>;
209
- }, "strip", z.ZodTypeAny, {
210
- fieldname: string;
211
- fieldtype: "Data" | "Text" | "Int" | "Float" | "Decimal" | "Check" | "Date" | "Time" | "Datetime" | "Duration" | "DateRange" | "JSON" | "Code" | "Link" | "Doctype" | "Attach" | "Currency" | "Quantity" | "Select";
212
- value?: unknown;
213
- options?: string | string[] | Record<string, unknown> | undefined;
214
- validation?: z.objectOutputType<{
215
- errorMessage: z.ZodString;
216
- }, z.ZodTypeAny, "passthrough"> | undefined;
217
- component?: string | undefined;
218
- label?: string | undefined;
219
- width?: string | undefined;
220
- align?: "left" | "center" | "right" | "start" | "end" | undefined;
221
- required?: boolean | undefined;
222
- readOnly?: boolean | undefined;
223
- edit?: boolean | undefined;
224
- hidden?: boolean | undefined;
225
- default?: unknown;
226
- mask?: string | undefined;
227
- }, {
228
- fieldname: string;
229
- fieldtype: "Data" | "Text" | "Int" | "Float" | "Decimal" | "Check" | "Date" | "Time" | "Datetime" | "Duration" | "DateRange" | "JSON" | "Code" | "Link" | "Doctype" | "Attach" | "Currency" | "Quantity" | "Select";
230
- value?: unknown;
231
- options?: string | string[] | Record<string, unknown> | undefined;
232
- validation?: z.objectInputType<{
233
- errorMessage: z.ZodString;
234
- }, z.ZodTypeAny, "passthrough"> | undefined;
235
- component?: string | undefined;
236
- label?: string | undefined;
237
- width?: string | undefined;
238
- align?: "left" | "center" | "right" | "start" | "end" | undefined;
239
- required?: boolean | undefined;
240
- readOnly?: boolean | undefined;
241
- edit?: boolean | undefined;
242
- hidden?: boolean | undefined;
243
- default?: unknown;
244
- mask?: string | undefined;
245
- }>, "many">;
246
- /** Workflow configuration */
271
+ }, z.core.$loose>>;
272
+ }, z.core.$strip>>;
247
273
  workflow: z.ZodOptional<z.ZodObject<{
248
- /** List of workflow states */
249
- states: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
250
- /** Actions available in this workflow */
274
+ states: z.ZodOptional<z.ZodArray<z.ZodString>>;
251
275
  actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
252
- /** Display label for the action */
253
276
  label: z.ZodString;
254
- /** Handler function name or path */
255
277
  handler: z.ZodString;
256
- /** Fields that must have values before action can execute */
257
- requiredFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
258
- /** Workflow states where this action is available */
259
- allowedStates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
260
- /** Whether to show a confirmation dialog */
278
+ requiredFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
279
+ allowedStates: z.ZodOptional<z.ZodArray<z.ZodString>>;
261
280
  confirm: z.ZodOptional<z.ZodBoolean>;
262
- /** Additional arguments for the action */
263
281
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
264
- }, "strip", z.ZodTypeAny, {
265
- label: string;
266
- handler: string;
267
- requiredFields?: string[] | undefined;
268
- allowedStates?: string[] | undefined;
269
- confirm?: boolean | undefined;
270
- args?: Record<string, unknown> | undefined;
271
- }, {
272
- label: string;
273
- handler: string;
274
- requiredFields?: string[] | undefined;
275
- allowedStates?: string[] | undefined;
276
- confirm?: boolean | undefined;
277
- args?: Record<string, unknown> | undefined;
278
- }>>>;
279
- }, "strip", z.ZodTypeAny, {
280
- states?: string[] | undefined;
281
- actions?: Record<string, {
282
- label: string;
283
- handler: string;
284
- requiredFields?: string[] | undefined;
285
- allowedStates?: string[] | undefined;
286
- confirm?: boolean | undefined;
287
- args?: Record<string, unknown> | undefined;
288
- }> | undefined;
289
- }, {
290
- states?: string[] | undefined;
291
- actions?: Record<string, {
292
- label: string;
293
- handler: string;
294
- requiredFields?: string[] | undefined;
295
- allowedStates?: string[] | undefined;
296
- confirm?: boolean | undefined;
297
- args?: Record<string, unknown> | undefined;
298
- }> | undefined;
299
- }>>;
300
- /** Parent doctype for inheritance */
282
+ }, z.core.$strip>>>;
283
+ }, z.core.$strip>>;
301
284
  inherits: z.ZodOptional<z.ZodString>;
302
- /** Doctype to use for list views */
303
285
  listDoctype: z.ZodOptional<z.ZodString>;
304
- /** Parent doctype for child tables */
305
286
  parentDoctype: z.ZodOptional<z.ZodString>;
306
- }, "strip", z.ZodTypeAny, {
307
- name: string;
308
- fields: {
309
- fieldname: string;
310
- fieldtype: "Data" | "Text" | "Int" | "Float" | "Decimal" | "Check" | "Date" | "Time" | "Datetime" | "Duration" | "DateRange" | "JSON" | "Code" | "Link" | "Doctype" | "Attach" | "Currency" | "Quantity" | "Select";
311
- value?: unknown;
312
- options?: string | string[] | Record<string, unknown> | undefined;
313
- validation?: z.objectOutputType<{
314
- errorMessage: z.ZodString;
315
- }, z.ZodTypeAny, "passthrough"> | undefined;
316
- component?: string | undefined;
317
- label?: string | undefined;
318
- width?: string | undefined;
319
- align?: "left" | "center" | "right" | "start" | "end" | undefined;
320
- required?: boolean | undefined;
321
- readOnly?: boolean | undefined;
322
- edit?: boolean | undefined;
323
- hidden?: boolean | undefined;
324
- default?: unknown;
325
- mask?: string | undefined;
326
- }[];
327
- slug?: string | undefined;
328
- tableName?: string | undefined;
329
- workflow?: {
330
- states?: string[] | undefined;
331
- actions?: Record<string, {
332
- label: string;
333
- handler: string;
334
- requiredFields?: string[] | undefined;
335
- allowedStates?: string[] | undefined;
336
- confirm?: boolean | undefined;
337
- args?: Record<string, unknown> | undefined;
338
- }> | undefined;
339
- } | undefined;
340
- inherits?: string | undefined;
341
- listDoctype?: string | undefined;
342
- parentDoctype?: string | undefined;
343
- }, {
344
- name: string;
345
- fields: {
346
- fieldname: string;
347
- fieldtype: "Data" | "Text" | "Int" | "Float" | "Decimal" | "Check" | "Date" | "Time" | "Datetime" | "Duration" | "DateRange" | "JSON" | "Code" | "Link" | "Doctype" | "Attach" | "Currency" | "Quantity" | "Select";
348
- value?: unknown;
349
- options?: string | string[] | Record<string, unknown> | undefined;
350
- validation?: z.objectInputType<{
351
- errorMessage: z.ZodString;
352
- }, z.ZodTypeAny, "passthrough"> | undefined;
353
- component?: string | undefined;
354
- label?: string | undefined;
355
- width?: string | undefined;
356
- align?: "left" | "center" | "right" | "start" | "end" | undefined;
357
- required?: boolean | undefined;
358
- readOnly?: boolean | undefined;
359
- edit?: boolean | undefined;
360
- hidden?: boolean | undefined;
361
- default?: unknown;
362
- mask?: string | undefined;
363
- }[];
364
- slug?: string | undefined;
365
- tableName?: string | undefined;
366
- workflow?: {
367
- states?: string[] | undefined;
368
- actions?: Record<string, {
369
- label: string;
370
- handler: string;
371
- requiredFields?: string[] | undefined;
372
- allowedStates?: string[] | undefined;
373
- confirm?: boolean | undefined;
374
- args?: Record<string, unknown> | undefined;
375
- }> | undefined;
376
- } | undefined;
377
- inherits?: string | undefined;
378
- listDoctype?: string | undefined;
379
- parentDoctype?: string | undefined;
380
- }>;
287
+ }, z.core.$strip>;
381
288
 
382
289
  /**
383
290
  * Doctype metadata type inferred from Zod schema
@@ -387,6 +294,18 @@ declare type DoctypeMeta = z.infer<typeof DoctypeMeta>;
387
294
  export { DoctypeMeta }
388
295
  export { DoctypeMeta as DoctypeMetaType }
389
296
 
297
+ /**
298
+ * Base interface for doctype metadata passed to DataClient methods.
299
+ * Only requires properties needed for record fetching.
300
+ * @public
301
+ */
302
+ export declare interface DoctypeRef {
303
+ /** Doctype name (e.g., 'Task', 'Customer') */
304
+ name: string;
305
+ /** URL-friendly slug (e.g., 'task', 'customer') */
306
+ slug?: string;
307
+ }
308
+
390
309
  /**
391
310
  * Unified field metadata - the single source of truth for field definitions.
392
311
  * Works for both forms (AForm) and tables (ATable).
@@ -396,98 +315,51 @@ export { DoctypeMeta as DoctypeMetaType }
396
315
  * @public
397
316
  */
398
317
  declare const FieldMeta: z.ZodObject<{
399
- /** Unique identifier for the field within its doctype */
400
318
  fieldname: z.ZodString;
401
- /** Semantic field type - determines behavior and default component */
402
- fieldtype: z.ZodEnum<["Data", "Text", "Int", "Float", "Decimal", "Check", "Date", "Time", "Datetime", "Duration", "DateRange", "JSON", "Code", "Link", "Doctype", "Attach", "Currency", "Quantity", "Select"]>;
403
- /** Vue component to render this field. If not specified, derived from TYPE_MAP */
319
+ fieldtype: z.ZodEnum<{
320
+ Data: "Data";
321
+ Text: "Text";
322
+ Int: "Int";
323
+ Float: "Float";
324
+ Decimal: "Decimal";
325
+ Check: "Check";
326
+ Date: "Date";
327
+ Time: "Time";
328
+ Datetime: "Datetime";
329
+ Duration: "Duration";
330
+ DateRange: "DateRange";
331
+ JSON: "JSON";
332
+ Code: "Code";
333
+ Link: "Link";
334
+ Doctype: "Doctype";
335
+ Attach: "Attach";
336
+ Currency: "Currency";
337
+ Quantity: "Quantity";
338
+ Select: "Select";
339
+ }>;
404
340
  component: z.ZodOptional<z.ZodString>;
405
- /** Human-readable label for the field */
406
341
  label: z.ZodOptional<z.ZodString>;
407
- /** Width of the field (CSS value, e.g., "40ch", "200px") */
408
342
  width: z.ZodOptional<z.ZodString>;
409
- /** Text alignment within the field */
410
- align: z.ZodOptional<z.ZodEnum<["left", "center", "right", "start", "end"]>>;
411
- /** Whether the field is required */
343
+ align: z.ZodOptional<z.ZodEnum<{
344
+ left: "left";
345
+ center: "center";
346
+ right: "right";
347
+ start: "start";
348
+ end: "end";
349
+ }>>;
412
350
  required: z.ZodOptional<z.ZodBoolean>;
413
- /** Whether the field is read-only */
414
351
  readOnly: z.ZodOptional<z.ZodBoolean>;
415
- /** Whether the field is editable (for table cells) */
416
352
  edit: z.ZodOptional<z.ZodBoolean>;
417
- /** Whether the field is hidden from the UI */
418
353
  hidden: z.ZodOptional<z.ZodBoolean>;
419
- /** Current value of the field */
420
354
  value: z.ZodOptional<z.ZodUnknown>;
421
- /** Default value for new records */
422
355
  default: z.ZodOptional<z.ZodUnknown>;
423
- /**
424
- * Type-specific options:
425
- * - Link: target doctype slug ("customer")
426
- * - Doctype: child doctype slug ("sales-order-item")
427
- * - Select: choices array (["Draft", "Submitted"])
428
- * - Decimal: \{ precision, scale \}
429
- * - Code: \{ language \}
430
- */
431
- options: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
432
- /**
433
- * Input mask pattern. Accepts either a plain mask string or a stringified
434
- * arrow function that receives `locale` and returns a mask string.
435
- *
436
- * Plain pattern: `"##/##/####"`
437
- *
438
- * Function pattern: `"(locale) => locale === 'en-US' ? '(###) ###-####' : '####-######'"`
439
- */
356
+ options: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
440
357
  mask: z.ZodOptional<z.ZodString>;
441
- /** Validation configuration */
442
358
  validation: z.ZodOptional<z.ZodObject<{
443
359
  /** Error message to display when validation fails */
444
360
  errorMessage: z.ZodString;
445
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
446
- /** Error message to display when validation fails */
447
- errorMessage: z.ZodString;
448
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
449
- /** Error message to display when validation fails */
450
- errorMessage: z.ZodString;
451
- }, z.ZodTypeAny, "passthrough">>>;
452
- }, "strip", z.ZodTypeAny, {
453
- fieldname: string;
454
- fieldtype: "Data" | "Text" | "Int" | "Float" | "Decimal" | "Check" | "Date" | "Time" | "Datetime" | "Duration" | "DateRange" | "JSON" | "Code" | "Link" | "Doctype" | "Attach" | "Currency" | "Quantity" | "Select";
455
- value?: unknown;
456
- options?: string | string[] | Record<string, unknown> | undefined;
457
- validation?: z.objectOutputType<{
458
- /** Error message to display when validation fails */
459
- errorMessage: z.ZodString;
460
- }, z.ZodTypeAny, "passthrough"> | undefined;
461
- component?: string | undefined;
462
- label?: string | undefined;
463
- width?: string | undefined;
464
- align?: "left" | "center" | "right" | "start" | "end" | undefined;
465
- required?: boolean | undefined;
466
- readOnly?: boolean | undefined;
467
- edit?: boolean | undefined;
468
- hidden?: boolean | undefined;
469
- default?: unknown;
470
- mask?: string | undefined;
471
- }, {
472
- fieldname: string;
473
- fieldtype: "Data" | "Text" | "Int" | "Float" | "Decimal" | "Check" | "Date" | "Time" | "Datetime" | "Duration" | "DateRange" | "JSON" | "Code" | "Link" | "Doctype" | "Attach" | "Currency" | "Quantity" | "Select";
474
- value?: unknown;
475
- options?: string | string[] | Record<string, unknown> | undefined;
476
- validation?: z.objectInputType<{
477
- /** Error message to display when validation fails */
478
- errorMessage: z.ZodString;
479
- }, z.ZodTypeAny, "passthrough"> | undefined;
480
- component?: string | undefined;
481
- label?: string | undefined;
482
- width?: string | undefined;
483
- align?: "left" | "center" | "right" | "start" | "end" | undefined;
484
- required?: boolean | undefined;
485
- readOnly?: boolean | undefined;
486
- edit?: boolean | undefined;
487
- hidden?: boolean | undefined;
488
- default?: unknown;
489
- mask?: string | undefined;
490
- }>;
361
+ }, z.core.$loose>>;
362
+ }, z.core.$strip>;
491
363
 
492
364
  /**
493
365
  * Field metadata type inferred from Zod schema
@@ -508,7 +380,7 @@ export { FieldMeta as FieldMetaType }
508
380
  *
509
381
  * @public
510
382
  */
511
- declare const FieldOptions: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
383
+ declare const FieldOptions: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
512
384
 
513
385
  /**
514
386
  * Field options type inferred from Zod schema
@@ -541,13 +413,7 @@ export declare interface FieldTemplate {
541
413
  export declare const FieldValidation: z.ZodObject<{
542
414
  /** Error message to display when validation fails */
543
415
  errorMessage: z.ZodString;
544
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
545
- /** Error message to display when validation fails */
546
- errorMessage: z.ZodString;
547
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
548
- /** Error message to display when validation fails */
549
- errorMessage: z.ZodString;
550
- }, z.ZodTypeAny, "passthrough">>;
416
+ }, z.core.$loose>;
551
417
 
552
418
  /**
553
419
  * Field validation type inferred from Zod schema
@@ -736,20 +602,6 @@ export declare function parseField(data: unknown): FieldMeta;
736
602
  */
737
603
  export declare function pascalToSnake(pascal: string): string;
738
604
 
739
- /**
740
- * Route context for identifying what doctype/record we're working with.
741
- * Used by graphql-middleware and graphql-client to resolve schema metadata.
742
- * @public
743
- */
744
- export declare interface RouteContext {
745
- /** Doctype name (e.g., 'Task', 'Customer') */
746
- doctype: string;
747
- /** Optional record ID for viewing/editing a specific record */
748
- recordId?: string;
749
- /** Additional context properties */
750
- [key: string]: unknown;
751
- }
752
-
753
605
  /**
754
606
  * Converts snake_case to camelCase
755
607
  * @param snakeCase - Snake case string
@@ -781,7 +633,27 @@ export declare function snakeToLabel(snakeCase: string): string;
781
633
  * These are consistent across forms and tables.
782
634
  * @public
783
635
  */
784
- declare const StonecropFieldType: z.ZodEnum<["Data", "Text", "Int", "Float", "Decimal", "Check", "Date", "Time", "Datetime", "Duration", "DateRange", "JSON", "Code", "Link", "Doctype", "Attach", "Currency", "Quantity", "Select"]>;
636
+ declare const StonecropFieldType: z.ZodEnum<{
637
+ Data: "Data";
638
+ Text: "Text";
639
+ Int: "Int";
640
+ Float: "Float";
641
+ Decimal: "Decimal";
642
+ Check: "Check";
643
+ Date: "Date";
644
+ Time: "Time";
645
+ Datetime: "Datetime";
646
+ Duration: "Duration";
647
+ DateRange: "DateRange";
648
+ JSON: "JSON";
649
+ Code: "Code";
650
+ Link: "Link";
651
+ Doctype: "Doctype";
652
+ Attach: "Attach";
653
+ Currency: "Currency";
654
+ Quantity: "Quantity";
655
+ Select: "Select";
656
+ }>;
785
657
 
786
658
  /**
787
659
  * Stonecrop field type enum inferred from Zod schema
@@ -836,7 +708,7 @@ export declare function validateField(data: unknown): ValidationResult;
836
708
  */
837
709
  export declare interface ValidationError {
838
710
  /** Path to the invalid property */
839
- path: (string | number)[];
711
+ path: PropertyKey[];
840
712
  /** Error message */
841
713
  message: string;
842
714
  }
@@ -869,58 +741,16 @@ export declare const WELL_KNOWN_SCALARS: Record<string, FieldTemplate>;
869
741
  * @public
870
742
  */
871
743
  declare const WorkflowMeta: z.ZodObject<{
872
- /** List of workflow states */
873
- states: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
874
- /** Actions available in this workflow */
744
+ states: z.ZodOptional<z.ZodArray<z.ZodString>>;
875
745
  actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
876
- /** Display label for the action */
877
746
  label: z.ZodString;
878
- /** Handler function name or path */
879
747
  handler: z.ZodString;
880
- /** Fields that must have values before action can execute */
881
- requiredFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
882
- /** Workflow states where this action is available */
883
- allowedStates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
884
- /** Whether to show a confirmation dialog */
748
+ requiredFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
749
+ allowedStates: z.ZodOptional<z.ZodArray<z.ZodString>>;
885
750
  confirm: z.ZodOptional<z.ZodBoolean>;
886
- /** Additional arguments for the action */
887
751
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
888
- }, "strip", z.ZodTypeAny, {
889
- label: string;
890
- handler: string;
891
- requiredFields?: string[] | undefined;
892
- allowedStates?: string[] | undefined;
893
- confirm?: boolean | undefined;
894
- args?: Record<string, unknown> | undefined;
895
- }, {
896
- label: string;
897
- handler: string;
898
- requiredFields?: string[] | undefined;
899
- allowedStates?: string[] | undefined;
900
- confirm?: boolean | undefined;
901
- args?: Record<string, unknown> | undefined;
902
- }>>>;
903
- }, "strip", z.ZodTypeAny, {
904
- states?: string[] | undefined;
905
- actions?: Record<string, {
906
- label: string;
907
- handler: string;
908
- requiredFields?: string[] | undefined;
909
- allowedStates?: string[] | undefined;
910
- confirm?: boolean | undefined;
911
- args?: Record<string, unknown> | undefined;
912
- }> | undefined;
913
- }, {
914
- states?: string[] | undefined;
915
- actions?: Record<string, {
916
- label: string;
917
- handler: string;
918
- requiredFields?: string[] | undefined;
919
- allowedStates?: string[] | undefined;
920
- confirm?: boolean | undefined;
921
- args?: Record<string, unknown> | undefined;
922
- }> | undefined;
923
- }>;
752
+ }, z.core.$strip>>>;
753
+ }, z.core.$strip>;
924
754
 
925
755
  /**
926
756
  * Workflow metadata type inferred from Zod schema