db4ai 0.3.0 → 0.3.1

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 (89) hide show
  1. package/dist/chunk-3DWAMVV5.js +305 -0
  2. package/dist/chunk-3DWAMVV5.js.map +1 -0
  3. package/dist/chunk-COTPYBYM.js +618 -0
  4. package/dist/chunk-COTPYBYM.js.map +1 -0
  5. package/dist/chunk-EERD6CDF.js +735 -0
  6. package/dist/chunk-EERD6CDF.js.map +1 -0
  7. package/dist/chunk-FUF4HJTC.js +758 -0
  8. package/dist/chunk-FUF4HJTC.js.map +1 -0
  9. package/dist/chunk-JLL6FH5L.js +16 -0
  10. package/dist/chunk-JLL6FH5L.js.map +1 -0
  11. package/dist/chunk-JXFW6AIT.js +192 -0
  12. package/dist/chunk-JXFW6AIT.js.map +1 -0
  13. package/dist/chunk-XLSYCQPG.js +854 -0
  14. package/dist/chunk-XLSYCQPG.js.map +1 -0
  15. package/dist/chunk-Y5IXAS7F.js +569 -0
  16. package/dist/chunk-Y5IXAS7F.js.map +1 -0
  17. package/dist/cli/bin.d.ts +13 -12
  18. package/dist/cli/bin.js +277 -307
  19. package/dist/cli/bin.js.map +1 -1
  20. package/dist/cli/dashboard/index.d.ts +295 -14
  21. package/dist/cli/dashboard/index.js +60 -15
  22. package/dist/cli/dashboard/index.js.map +1 -1
  23. package/dist/cli/index.d.ts +10 -16
  24. package/dist/cli/index.js +94 -47
  25. package/dist/cli/index.js.map +1 -1
  26. package/dist/cli/runtime/index.d.ts +52 -23
  27. package/dist/cli/runtime/index.js +10 -704
  28. package/dist/cli/runtime/index.js.map +1 -1
  29. package/dist/cli/scanner/index.d.ts +17 -15
  30. package/dist/cli/scanner/index.js +8 -639
  31. package/dist/cli/scanner/index.js.map +1 -1
  32. package/dist/cli/seed/index.d.ts +16 -12
  33. package/dist/cli/seed/index.js +12 -773
  34. package/dist/cli/seed/index.js.map +1 -1
  35. package/dist/cli/sync/index.d.ts +54 -53
  36. package/dist/cli/sync/index.js +23 -704
  37. package/dist/cli/sync/index.js.map +1 -1
  38. package/dist/cli/terminal.d.ts +9 -8
  39. package/dist/cli/terminal.js +6 -209
  40. package/dist/cli/terminal.js.map +1 -1
  41. package/dist/cli/workflow/index.d.ts +18 -10
  42. package/dist/cli/workflow/index.js +6 -307
  43. package/dist/cli/workflow/index.js.map +1 -1
  44. package/dist/handlers.d.ts +10 -9
  45. package/dist/handlers.js +6 -38
  46. package/dist/handlers.js.map +1 -1
  47. package/dist/index.d.ts +120 -118
  48. package/dist/index.js +1963 -3125
  49. package/dist/index.js.map +1 -1
  50. package/package.json +3 -4
  51. package/dist/cli/bin.d.ts.map +0 -1
  52. package/dist/cli/dashboard/App.d.ts +0 -16
  53. package/dist/cli/dashboard/App.d.ts.map +0 -1
  54. package/dist/cli/dashboard/App.js +0 -116
  55. package/dist/cli/dashboard/App.js.map +0 -1
  56. package/dist/cli/dashboard/components/index.d.ts +0 -70
  57. package/dist/cli/dashboard/components/index.d.ts.map +0 -1
  58. package/dist/cli/dashboard/components/index.js +0 -192
  59. package/dist/cli/dashboard/components/index.js.map +0 -1
  60. package/dist/cli/dashboard/hooks/index.d.ts +0 -76
  61. package/dist/cli/dashboard/hooks/index.d.ts.map +0 -1
  62. package/dist/cli/dashboard/hooks/index.js +0 -201
  63. package/dist/cli/dashboard/hooks/index.js.map +0 -1
  64. package/dist/cli/dashboard/index.d.ts.map +0 -1
  65. package/dist/cli/dashboard/types.d.ts +0 -84
  66. package/dist/cli/dashboard/types.d.ts.map +0 -1
  67. package/dist/cli/dashboard/types.js +0 -5
  68. package/dist/cli/dashboard/types.js.map +0 -1
  69. package/dist/cli/dashboard/views/index.d.ts +0 -51
  70. package/dist/cli/dashboard/views/index.d.ts.map +0 -1
  71. package/dist/cli/dashboard/views/index.js +0 -72
  72. package/dist/cli/dashboard/views/index.js.map +0 -1
  73. package/dist/cli/index.d.ts.map +0 -1
  74. package/dist/cli/runtime/index.d.ts.map +0 -1
  75. package/dist/cli/scanner/index.d.ts.map +0 -1
  76. package/dist/cli/seed/index.d.ts.map +0 -1
  77. package/dist/cli/sync/index.d.ts.map +0 -1
  78. package/dist/cli/terminal.d.ts.map +0 -1
  79. package/dist/cli/workflow/index.d.ts.map +0 -1
  80. package/dist/errors.d.ts +0 -43
  81. package/dist/errors.d.ts.map +0 -1
  82. package/dist/errors.js +0 -47
  83. package/dist/errors.js.map +0 -1
  84. package/dist/handlers.d.ts.map +0 -1
  85. package/dist/index.d.ts.map +0 -1
  86. package/dist/types.d.ts +0 -276
  87. package/dist/types.d.ts.map +0 -1
  88. package/dist/types.js +0 -12
  89. package/dist/types.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import type { ComponentType } from 'react';
2
- export { SerializedFunction, serializeFunction, type EntityHandlerType, type SchemaHandlerType, type LifecycleHandlerType, type StateHandlerType, type HandlerExecutionResult, type HandlerLogEntry, } from './handlers';
3
- import { type SerializedFunction } from './handlers';
1
+ import { ComponentType } from 'react';
2
+ import { SerializedFunction } from './handlers.js';
3
+ export { EntityHandlerType, HandlerExecutionResult, HandlerLogEntry, LifecycleHandlerType, SchemaHandlerType, StateHandlerType, serializeFunction } from './handlers.js';
4
+
4
5
  /**
5
6
  * Error codes for schema validation errors.
6
7
  */
7
- export type SchemaValidationErrorCode = 'MISSING_CONTEXT' | 'MISSING_NAMESPACE' | 'INVALID_FIELD_TYPE';
8
+ type SchemaValidationErrorCode = 'MISSING_CONTEXT' | 'MISSING_NAMESPACE' | 'INVALID_FIELD_TYPE';
8
9
  /**
9
10
  * Error thrown when schema validation fails.
10
11
  *
@@ -17,14 +18,14 @@ export type SchemaValidationErrorCode = 'MISSING_CONTEXT' | 'MISSING_NAMESPACE'
17
18
  * }
18
19
  * }
19
20
  */
20
- export declare class SchemaValidationError extends Error {
21
+ declare class SchemaValidationError extends Error {
21
22
  code: SchemaValidationErrorCode;
22
23
  constructor(code: SchemaValidationErrorCode, message: string);
23
24
  }
24
25
  /**
25
26
  * Error codes for API errors.
26
27
  */
27
- export type APIErrorCode = 'REGISTRATION_FAILED' | 'GENERATION_FAILED' | 'REFERENCE_RESOLUTION_FAILED';
28
+ type APIErrorCode = 'REGISTRATION_FAILED' | 'GENERATION_FAILED' | 'REFERENCE_RESOLUTION_FAILED';
28
29
  /**
29
30
  * Error thrown when API operations fail.
30
31
  *
@@ -38,12 +39,12 @@ export type APIErrorCode = 'REGISTRATION_FAILED' | 'GENERATION_FAILED' | 'REFERE
38
39
  * }
39
40
  * }
40
41
  */
41
- export declare class APIError extends Error {
42
+ declare class APIError extends Error {
42
43
  code: APIErrorCode;
43
44
  statusCode?: number;
44
45
  constructor(code: APIErrorCode, message: string, statusCode?: number);
45
46
  }
46
- export type Components = {
47
+ type Components = {
47
48
  App: ComponentType;
48
49
  List: ComponentType;
49
50
  ListItem: ComponentType;
@@ -51,7 +52,7 @@ export type Components = {
51
52
  Edit: ComponentType;
52
53
  Chat: ComponentType;
53
54
  };
54
- export declare function UI(components: Components): Components;
55
+ declare function UI(components: Components): Components;
55
56
  /**
56
57
  * Parse namespace from a $id URL.
57
58
  *
@@ -64,15 +65,15 @@ export declare function UI(components: Components): Components;
64
65
  * parseNamespaceFromId('https://db.sb/') // null
65
66
  * parseNamespaceFromId('invalid') // null
66
67
  */
67
- export declare function parseNamespaceFromId(id: string): string | null;
68
+ declare function parseNamespaceFromId(id: string): string | null;
68
69
  /**
69
70
  * Computed field - a function that derives a value from the entity.
70
71
  */
71
- export type ComputedFieldFn<E = any, R = any> = (entity: E, $?: any) => R;
72
+ type ComputedFieldFn<E = any, R = any> = (entity: E, $?: any) => R;
72
73
  /**
73
74
  * Nested object field value - used for complex structures like StoryBrand.hero.wants
74
75
  */
75
- export interface NestedFieldValue {
76
+ interface NestedFieldValue {
76
77
  [key: string]: string | string[] | boolean | NestedFieldValue | ComputedFieldFn;
77
78
  }
78
79
  /**
@@ -83,43 +84,43 @@ export interface NestedFieldValue {
83
84
  * - `boolean` - Relationship marker (e.g., '->Entity[]': true)
84
85
  * - `Function` - Computed field
85
86
  */
86
- export type FieldValue = string | string[] | boolean | NestedFieldValue | ComputedFieldFn;
87
+ type FieldValue = string | string[] | boolean | NestedFieldValue | ComputedFieldFn;
87
88
  /**
88
89
  * Entity lifecycle handler.
89
90
  */
90
- export type EntityHandler<E = any> = (entity: E, $: any) => void | Promise<void>;
91
+ type EntityHandler<E = any> = (entity: E, $: any) => void | Promise<void>;
91
92
  /**
92
93
  * Entity update handler with previous state.
93
94
  */
94
- export type EntityUpdateHandler<E = any> = (entity: E, previous: E, $: any) => void | Promise<void>;
95
+ type EntityUpdateHandler<E = any> = (entity: E, previous: E, $: any) => void | Promise<void>;
95
96
  /**
96
97
  * Schema lifecycle handler.
97
98
  */
98
- export type SchemaHandler = ($: any) => void | Promise<void>;
99
+ type SchemaHandler = ($: any) => void | Promise<void>;
99
100
  /**
100
101
  * Schema error handler.
101
102
  */
102
- export type SchemaErrorHandler = (error: Error, $: any) => void | Promise<void>;
103
+ type SchemaErrorHandler = (error: Error, $: any) => void | Promise<void>;
103
104
  /**
104
105
  * Input state machine configuration for entity definitions.
105
106
  * This is the raw format before parsing - use RawStateConfig from state machine types.
106
107
  */
107
- export type InputStateConfig = {
108
+ type InputStateConfig = {
108
109
  $initial: string;
109
110
  } & Record<string, unknown>;
110
111
  /**
111
112
  * Evaluation definition stub.
112
113
  */
113
- export type EvalDefinition = Record<string, unknown>;
114
+ type EvalDefinition = Record<string, unknown>;
114
115
  /**
115
116
  * Schema experiment definition stub.
116
117
  */
117
- export type SchemaExperiment = Record<string, unknown>;
118
+ type SchemaExperiment = Record<string, unknown>;
118
119
  /**
119
120
  * Schema analytics configuration stub.
120
121
  */
121
- export type SchemaAnalytics = Record<string, unknown>;
122
- export interface SchemaMetadata {
122
+ type SchemaAnalytics = Record<string, unknown>;
123
+ interface SchemaMetadata {
123
124
  /** Unique identifier/URL for this schema */
124
125
  $id?: string;
125
126
  /** Shared namespace for composing multiple DB() schemas */
@@ -146,7 +147,7 @@ export interface SchemaMetadata {
146
147
  /**
147
148
  * Entity-level directives that can appear in type definitions.
148
149
  */
149
- export interface EntityDirectives {
150
+ interface EntityDirectives {
150
151
  /** Seed data source URL */
151
152
  $seed?: string;
152
153
  /** JSONPath or transform for entity ID from seed data (e.g., '$.slug', 'PascalCase($.name)') */
@@ -178,13 +179,13 @@ export interface EntityDirectives {
178
179
  * Type definition: entity directives + field definitions.
179
180
  * Allows any string key for fields and relationship markers.
180
181
  */
181
- export type TypeDefinition = EntityDirectives & Record<string, FieldValue | undefined>;
182
+ type TypeDefinition = EntityDirectives & Record<string, FieldValue | undefined>;
182
183
  /**
183
184
  * Schema: metadata + type definitions.
184
185
  * Allows entity type definitions with all directives and field types.
185
186
  */
186
- export type SchemaDefinition = SchemaMetadata & Record<string, TypeDefinition | string | undefined>;
187
- export interface StringField {
187
+ type SchemaDefinition = SchemaMetadata & Record<string, TypeDefinition | string | undefined>;
188
+ interface StringField {
188
189
  type: 'string';
189
190
  description: string;
190
191
  optional?: boolean;
@@ -206,7 +207,7 @@ export interface StringField {
206
207
  * { posts: '<-Post' } // Find Posts that reference this entity
207
208
  * { related: '<~Article' } // Find semantically related Articles
208
209
  */
209
- export declare const OPERATORS: {
210
+ declare const OPERATORS: {
210
211
  /** Forward exact reference: `->Type` - resolves to exact ID match */
211
212
  readonly FORWARD_EXACT: "->";
212
213
  /** Forward fuzzy reference: `~>Type` - resolves by semantic similarity */
@@ -217,9 +218,9 @@ export declare const OPERATORS: {
217
218
  readonly BACKWARD_FUZZY: "<~";
218
219
  };
219
220
  /** Type for all valid reference operators */
220
- export type ReferenceOperator = (typeof OPERATORS)[keyof typeof OPERATORS];
221
+ type ReferenceOperator = (typeof OPERATORS)[keyof typeof OPERATORS];
221
222
  /** Parsed operator information returned by parseOperator */
222
- export type ParsedOperator = {
223
+ type ParsedOperator = {
223
224
  direction: 'forward';
224
225
  fuzzy: boolean;
225
226
  } | {
@@ -241,7 +242,7 @@ export type ParsedOperator = {
241
242
  * parseOperator('<-') // { direction: 'backward', mode: 'exact' }
242
243
  * parseOperator('<~') // { direction: 'backward', mode: 'fuzzy' }
243
244
  */
244
- export declare function parseOperator(prefix: string): ParsedOperator;
245
+ declare function parseOperator(prefix: string): ParsedOperator;
245
246
  /**
246
247
  * Parsed reference field from the schema DSL.
247
248
  *
@@ -266,7 +267,7 @@ export declare function parseOperator(prefix: string): ParsedOperator;
266
267
  * parseFieldType('<~Post[]')
267
268
  * // { type: 'reference', ref: 'Post', isArray: true, optional: false, direction: 'backward', mode: 'fuzzy' }
268
269
  */
269
- export interface ReferenceField {
270
+ interface ReferenceField {
270
271
  type: 'reference';
271
272
  /** Single reference target type (mutually exclusive with `refs`) */
272
273
  ref?: string;
@@ -283,7 +284,7 @@ export interface ReferenceField {
283
284
  /** For backward references: 'exact' (`<-`) or 'fuzzy' (`<~`) */
284
285
  mode?: 'exact' | 'fuzzy';
285
286
  }
286
- export interface ArrayField {
287
+ interface ArrayField {
287
288
  type: 'array';
288
289
  items: {
289
290
  type: 'string';
@@ -297,39 +298,39 @@ export interface ArrayField {
297
298
  max: number;
298
299
  };
299
300
  }
300
- export interface ObjectField {
301
+ interface ObjectField {
301
302
  type: 'object';
302
303
  properties: Record<string, StringField>;
303
304
  optional?: boolean;
304
305
  }
305
- export interface EmbeddedField {
306
+ interface EmbeddedField {
306
307
  type: 'embedded';
307
308
  embeddedType: string;
308
309
  isArray?: boolean;
309
310
  optional?: boolean;
310
311
  }
311
- export interface JSONPathField {
312
+ interface JSONPathField {
312
313
  type: 'jsonpath';
313
314
  path: string;
314
315
  transform?: string;
315
316
  }
316
- export interface JSONPathEmbeddedField {
317
+ interface JSONPathEmbeddedField {
317
318
  type: 'jsonpath-embedded';
318
319
  path: string;
319
320
  embeddedType: string;
320
321
  isArray: boolean;
321
322
  optional?: boolean;
322
323
  }
323
- export interface ComputedField {
324
+ interface ComputedField {
324
325
  type: 'computed';
325
326
  source: string;
326
327
  }
327
- export interface PromptField {
328
+ interface PromptField {
328
329
  type: 'prompt';
329
330
  prompt: string;
330
331
  }
331
- export type ParsedField = StringField | ReferenceField | ArrayField | ObjectField | EmbeddedField | JSONPathField | JSONPathEmbeddedField | ComputedField | PromptField;
332
- export interface TypeReference {
332
+ type ParsedField = StringField | ReferenceField | ArrayField | ObjectField | EmbeddedField | JSONPathField | JSONPathEmbeddedField | ComputedField | PromptField;
333
+ interface TypeReference {
333
334
  field: string;
334
335
  ref: string;
335
336
  refs?: string[];
@@ -338,7 +339,7 @@ export interface TypeReference {
338
339
  fuzzy?: boolean;
339
340
  backRef?: boolean;
340
341
  }
341
- export interface SeedConfig {
342
+ interface SeedConfig {
342
343
  url: string;
343
344
  format?: 'tsv' | 'csv' | 'json';
344
345
  idField?: string;
@@ -359,7 +360,7 @@ export interface SeedConfig {
359
360
  * parseIdConfig('kebab-case($.title)') // { path: '$.title', transform: 'kebab-case' }
360
361
  * parseIdConfig('slug') // { path: 'slug' }
361
362
  */
362
- export declare function parseIdConfig(idField: string): {
363
+ declare function parseIdConfig(idField: string): {
363
364
  path: string;
364
365
  transform?: string;
365
366
  };
@@ -384,7 +385,7 @@ export declare function parseIdConfig(idField: string): {
384
385
  * isValidJSONPath('title') // false (missing $.)
385
386
  * isValidJSONPath('$50 price') // false (not a valid path)
386
387
  */
387
- export declare function isValidJSONPath(path: string): boolean;
388
+ declare function isValidJSONPath(path: string): boolean;
388
389
  /**
389
390
  * Type guard to check if a ParsedField is a JSONPathField.
390
391
  *
@@ -394,7 +395,7 @@ export declare function isValidJSONPath(path: string): boolean;
394
395
  * console.log(field.path) // TypeScript knows field.path exists
395
396
  * }
396
397
  */
397
- export declare function isJSONPathField(field: ParsedField): field is JSONPathField;
398
+ declare function isJSONPathField(field: ParsedField): field is JSONPathField;
398
399
  /**
399
400
  * Type guard to check if a ParsedField is a JSONPathEmbeddedField.
400
401
  *
@@ -404,7 +405,7 @@ export declare function isJSONPathField(field: ParsedField): field is JSONPathFi
404
405
  * console.log(field.embeddedType) // TypeScript knows field.embeddedType exists
405
406
  * }
406
407
  */
407
- export declare function isJSONPathEmbeddedField(field: ParsedField): field is JSONPathEmbeddedField;
408
+ declare function isJSONPathEmbeddedField(field: ParsedField): field is JSONPathEmbeddedField;
408
409
  /**
409
410
  * Type guard to check if a ParsedField is a PromptField.
410
411
  *
@@ -414,21 +415,21 @@ export declare function isJSONPathEmbeddedField(field: ParsedField): field is JS
414
415
  * console.log(field.prompt) // TypeScript knows field.prompt exists
415
416
  * }
416
417
  */
417
- export declare function isPromptField(field: ParsedField): field is PromptField;
418
+ declare function isPromptField(field: ParsedField): field is PromptField;
418
419
  /**
419
420
  * Type guard to check if a ParsedField is a StringField.
420
421
  */
421
- export declare function isStringField(field: ParsedField): field is StringField;
422
- export interface OAuthConfig {
422
+ declare function isStringField(field: ParsedField): field is StringField;
423
+ interface OAuthConfig {
423
424
  tokenUrl: string;
424
425
  clientId: string;
425
426
  clientSecret: string;
426
427
  }
427
- export interface AsyncConfig {
428
+ interface AsyncConfig {
428
429
  start: string;
429
430
  result: string;
430
431
  }
431
- export interface SourceConfig {
432
+ interface SourceConfig {
432
433
  $api: string;
433
434
  $apiKey?: string;
434
435
  $bearer?: string;
@@ -436,54 +437,54 @@ export interface SourceConfig {
436
437
  $data?: string;
437
438
  $async?: AsyncConfig;
438
439
  }
439
- export type SourceInput = Record<string, 'string' | 'string?'>;
440
- export interface ImageConfig {
440
+ type SourceInput = Record<string, 'string' | 'string?'>;
441
+ interface ImageConfig {
441
442
  aspectRatio?: string;
442
443
  style?: string;
443
444
  }
444
- export interface SpeechConfig {
445
+ interface SpeechConfig {
445
446
  voice?: string;
446
447
  speed?: number;
447
448
  format?: string;
448
449
  }
449
- export interface DiagramConfig {
450
+ interface DiagramConfig {
450
451
  type?: string;
451
452
  direction?: string;
452
453
  format?: string;
453
454
  }
454
- export interface ConventionsConfig {
455
+ interface ConventionsConfig {
455
456
  nodes?: string;
456
457
  edges?: string;
457
458
  events?: string;
458
459
  }
459
- export interface CodeConfig {
460
+ interface CodeConfig {
460
461
  language?: string;
461
462
  runtime?: string;
462
463
  framework?: string;
463
464
  }
464
465
  /** Transition configuration - simple string or complex object */
465
- export interface TransitionConfig {
466
+ interface TransitionConfig {
466
467
  to: string | null;
467
468
  if?: SerializedFunction;
468
469
  do?: SerializedFunction;
469
470
  }
470
471
  /** State configuration with transitions */
471
- export interface StateConfig {
472
+ interface StateConfig {
472
473
  transitions: Record<string, TransitionConfig>;
473
474
  $entry?: SerializedFunction;
474
475
  $exit?: SerializedFunction;
475
476
  }
476
477
  /** Parsed state machine configuration */
477
- export interface ParsedStateConfig {
478
+ interface ParsedStateConfig {
478
479
  $initial: string;
479
480
  states: Record<string, StateConfig>;
480
481
  }
481
482
  /** Raw state config - input format before parsing */
482
- export type RawStateConfig = {
483
+ type RawStateConfig = {
483
484
  $initial: string;
484
485
  } & Record<string, unknown>;
485
486
  /** State validation error */
486
- export interface StateValidationError {
487
+ interface StateValidationError {
487
488
  code: string;
488
489
  message: string;
489
490
  state?: string;
@@ -491,7 +492,7 @@ export interface StateValidationError {
491
492
  transition?: string;
492
493
  }
493
494
  /** State validation result */
494
- export interface StateValidationResult {
495
+ interface StateValidationResult {
495
496
  valid: boolean;
496
497
  errors: StateValidationError[];
497
498
  }
@@ -499,7 +500,7 @@ export interface StateValidationResult {
499
500
  * Validate a raw state machine configuration.
500
501
  * Checks for: valid $initial, reachable states, no orphan states, valid transitions.
501
502
  */
502
- export declare function validateStateConfig(config: RawStateConfig): StateValidationResult;
503
+ declare function validateStateConfig(config: RawStateConfig): StateValidationResult;
503
504
  /**
504
505
  * Parse a raw state machine configuration into the normalized format.
505
506
  * Converts string functions to SerializedFunction objects.
@@ -520,8 +521,8 @@ export declare function validateStateConfig(config: RawStateConfig): StateValida
520
521
  * approved: null // terminal state
521
522
  * })
522
523
  */
523
- export declare function parseStateConfig(config: RawStateConfig): ParsedStateConfig;
524
- export interface ParsedType {
524
+ declare function parseStateConfig(config: RawStateConfig): ParsedStateConfig;
525
+ interface ParsedType {
525
526
  name: string;
526
527
  fields: Record<string, ParsedField>;
527
528
  references: TypeReference[];
@@ -547,10 +548,10 @@ export interface ParsedType {
547
548
  eval?: Record<string, EvalDefinition>;
548
549
  experiment?: SchemaExperiment;
549
550
  }
550
- export interface SchemaSettings {
551
+ interface SchemaSettings {
551
552
  iconLibrary?: string;
552
553
  }
553
- export interface ParsedSchema {
554
+ interface ParsedSchema {
554
555
  types: Record<string, ParsedType>;
555
556
  hash: string;
556
557
  settings?: SchemaSettings;
@@ -561,7 +562,7 @@ export interface ParsedSchema {
561
562
  analytics?: SchemaAnalytics;
562
563
  handlers?: Record<string, SerializedFunction>;
563
564
  }
564
- export interface JSONSchemaProperty {
565
+ interface JSONSchemaProperty {
565
566
  type: string;
566
567
  description?: string;
567
568
  items?: {
@@ -576,13 +577,13 @@ export interface JSONSchemaProperty {
576
577
  minItems?: number;
577
578
  maxItems?: number;
578
579
  }
579
- export interface JSONSchema {
580
+ interface JSONSchema {
580
581
  type: 'object';
581
582
  properties: Record<string, JSONSchemaProperty>;
582
583
  required: string[];
583
584
  additionalProperties: boolean;
584
585
  }
585
- export declare function extractCountFromDescription(description: string): number | {
586
+ declare function extractCountFromDescription(description: string): number | {
586
587
  min: number;
587
588
  max: number;
588
589
  } | undefined;
@@ -663,12 +664,12 @@ export declare function extractCountFromDescription(description: string): number
663
664
  * parseFieldType({ street: 'Street address', city: 'City name' })
664
665
  * // { type: 'object', properties: { street: {...}, city: {...} } }
665
666
  */
666
- export declare function parseFieldType(value: FieldValue | Function): ParsedField;
667
+ declare function parseFieldType(value: FieldValue | Function): ParsedField;
667
668
  /**
668
669
  * Parsed reference field info for generation.
669
670
  * Used by the two-phase generation pipeline to understand reference fields.
670
671
  */
671
- export interface ParsedGenerationReference {
672
+ interface ParsedGenerationReference {
672
673
  /** Reference mode: exact (->) or fuzzy (~>) */
673
674
  mode: 'exact' | 'fuzzy';
674
675
  /** Target type name (or first type for union types) */
@@ -705,7 +706,7 @@ export interface ParsedGenerationReference {
705
706
  * parseGenerationReference('->User|Organization')
706
707
  * // { mode: 'exact', targetType: 'User', targetTypes: ['User', 'Organization'], isOptional: false, isArray: false }
707
708
  */
708
- export declare function parseGenerationReference(fieldDef: string): ParsedGenerationReference | null;
709
+ declare function parseGenerationReference(fieldDef: string): ParsedGenerationReference | null;
709
710
  /**
710
711
  * Parse array field definition for generation.
711
712
  *
@@ -718,7 +719,7 @@ export declare function parseGenerationReference(fieldDef: string): ParsedGenera
718
719
  * parseGenerationArrayReference(['~>Investor'])
719
720
  * // { mode: 'fuzzy', targetType: 'Investor', isOptional: false, isArray: true }
720
721
  */
721
- export declare function parseGenerationArrayReference(fieldDef: string[]): ParsedGenerationReference | null;
722
+ declare function parseGenerationArrayReference(fieldDef: string[]): ParsedGenerationReference | null;
722
723
  /**
723
724
  * Check if a field definition is a reference field.
724
725
  *
@@ -732,21 +733,21 @@ export declare function parseGenerationArrayReference(fieldDef: string[]): Parse
732
733
  * isReferenceField('User name') // false
733
734
  * isReferenceField(['tags']) // false
734
735
  */
735
- export declare function isReferenceField(fieldDef: string | string[]): boolean;
736
+ declare function isReferenceField(fieldDef: string | string[]): boolean;
736
737
  /**
737
738
  * Extract reference mode from a field definition.
738
739
  *
739
740
  * @param fieldDef - The field definition
740
741
  * @returns 'exact' | 'fuzzy' | null
741
742
  */
742
- export declare function getReferenceMode(fieldDef: string | string[]): 'exact' | 'fuzzy' | null;
743
+ declare function getReferenceMode(fieldDef: string | string[]): 'exact' | 'fuzzy' | null;
743
744
  /**
744
745
  * Extract target type(s) from a reference field.
745
746
  *
746
747
  * @param fieldDef - The field definition
747
748
  * @returns Target type string, array of types for unions, or null if not a reference
748
749
  */
749
- export declare function getReferenceTargetType(fieldDef: string | string[]): string | string[] | null;
750
+ declare function getReferenceTargetType(fieldDef: string | string[]): string | string[] | null;
750
751
  /**
751
752
  * Parse seed configuration from a schema type's `$seed` field.
752
753
  *
@@ -784,7 +785,7 @@ export declare function getReferenceTargetType(fieldDef: string | string[]): str
784
785
  * })
785
786
  * // { url: '...', format: 'json', data: '$.items', next: '$.pagination.next' }
786
787
  */
787
- export declare function parseSeedConfig(value: string | Record<string, string>): SeedConfig;
788
+ declare function parseSeedConfig(value: string | Record<string, string>): SeedConfig;
788
789
  /**
789
790
  * Converts string fields to prompt fields in a seeded type's field map.
790
791
  *
@@ -814,7 +815,7 @@ export declare function parseSeedConfig(value: string | Record<string, string>):
814
815
  * This function is called during parseSchema when a type has `$seed` defined.
815
816
  * Only StringField types are converted; all other field types pass through unchanged.
816
817
  */
817
- export declare function convertStringsToPromptsInSeededType(fields: Record<string, ParsedField>): Record<string, ParsedField>;
818
+ declare function convertStringsToPromptsInSeededType(fields: Record<string, ParsedField>): Record<string, ParsedField>;
818
819
  /**
819
820
  * Parse an entire schema definition into a structured ParsedSchema.
820
821
  *
@@ -869,7 +870,7 @@ export declare function convertStringsToPromptsInSeededType(fields: Record<strin
869
870
  * // schema.types.Company.icon === 'building'
870
871
  * // schema.types.Company.seed.url === 'https://api.example.com/companies.json'
871
872
  */
872
- export declare function parseSchema(schema: SchemaDefinition): ParsedSchema;
873
+ declare function parseSchema(schema: SchemaDefinition): ParsedSchema;
873
874
  /**
874
875
  * Convert a parsed type definition to a JSON Schema representation.
875
876
  *
@@ -928,7 +929,7 @@ export declare function parseSchema(schema: SchemaDefinition): ParsedSchema;
928
929
  * const jsonSchema = toJSONSchema(schema.types.User, schema)
929
930
  * // properties.address will contain the full Address schema inline
930
931
  */
931
- export declare function toJSONSchema(parsedType: ParsedType, parsedSchemaOrIncludeRefs?: ParsedSchema | boolean, seen?: Set<string>): JSONSchema;
932
+ declare function toJSONSchema(parsedType: ParsedType, parsedSchemaOrIncludeRefs?: ParsedSchema | boolean, seen?: Set<string>): JSONSchema;
932
933
  /**
933
934
  * Generate a deterministic hash for a schema definition.
934
935
  *
@@ -961,9 +962,9 @@ export declare function toJSONSchema(parsedType: ParsedType, parsedSchemaOrInclu
961
962
  * console.log(schema.hash)
962
963
  * // The hash can be used to detect schema changes and trigger migrations
963
964
  */
964
- export declare function schemaHash(schema: SchemaDefinition): string;
965
- export type JobStatus = 'queued' | 'running' | 'completed' | 'failed';
966
- export interface Job<T = void> {
965
+ declare function schemaHash(schema: SchemaDefinition): string;
966
+ type JobStatus = 'queued' | 'running' | 'completed' | 'failed';
967
+ interface Job<T = void> {
967
968
  id: string;
968
969
  status: JobStatus;
969
970
  result?: T;
@@ -975,7 +976,7 @@ export interface Job<T = void> {
975
976
  * - As collection: `for (const idea of db.Idea) { ... }`
976
977
  */
977
978
  /** Options for listing entities */
978
- export interface ListOptions {
979
+ interface ListOptions {
979
980
  /** Maximum number of entities to return */
980
981
  limit?: number;
981
982
  /** Number of entities to skip */
@@ -983,7 +984,7 @@ export interface ListOptions {
983
984
  /** Filter criteria */
984
985
  filter?: Record<string, unknown>;
985
986
  }
986
- export interface EntityCollection<T extends Record<string, unknown> = Record<string, unknown>> extends Iterable<T> {
987
+ interface EntityCollection<T extends Record<string, unknown> = Record<string, unknown>> extends Iterable<T> {
987
988
  /** The type name of entities in this collection */
988
989
  readonly $type: string;
989
990
  /** Current count of entities in the local collection */
@@ -1005,14 +1006,14 @@ export interface EntityCollection<T extends Record<string, unknown> = Record<str
1005
1006
  /** Factory function signature - call the collection to generate/fetch an entity */
1006
1007
  (id: string, context?: Record<string, unknown>): Promise<T>;
1007
1008
  }
1008
- export interface DBInstance<T = Record<string, unknown>> {
1009
+ interface DBInstance<T = Record<string, unknown>> {
1009
1010
  id: string;
1010
1011
  type: string;
1011
1012
  data: T;
1012
1013
  }
1013
- export type GeneratedObject = Record<string, unknown>;
1014
- export type TypeFactory = (id: string, context?: Record<string, unknown>) => Promise<GeneratedObject>;
1015
- export interface DBResultBase {
1014
+ type GeneratedObject = Record<string, unknown>;
1015
+ type TypeFactory = (id: string, context?: Record<string, unknown>) => Promise<GeneratedObject>;
1016
+ interface DBResultBase {
1016
1017
  schema: SchemaDefinition;
1017
1018
  types: Record<string, ParsedType>;
1018
1019
  hash: string;
@@ -1024,7 +1025,7 @@ export interface DBResultBase {
1024
1025
  toJSONSchema: (typeName: string) => JSONSchema;
1025
1026
  registerSchema: () => Promise<void>;
1026
1027
  }
1027
- export type DBResult = DBResultBase & Record<string, EntityCollection>;
1028
+ type DBResult = DBResultBase & Record<string, EntityCollection>;
1028
1029
  /**
1029
1030
  * Create a database instance from a schema definition.
1030
1031
  *
@@ -1095,7 +1096,7 @@ export type DBResult = DBResultBase & Record<string, EntityCollection>;
1095
1096
  * }
1096
1097
  * })
1097
1098
  */
1098
- export declare function DB(schema: SchemaDefinition): DBResult;
1099
+ declare function DB(schema: SchemaDefinition): DBResult;
1099
1100
  /**
1100
1101
  * A lazy pipeline builder for cartesian products and collection transformations.
1101
1102
  *
@@ -1148,7 +1149,7 @@ export declare function DB(schema: SchemaDefinition): DBResult;
1148
1149
  * .map(user => user.email)
1149
1150
  * .all()
1150
1151
  */
1151
- export declare class Combinable<T> implements Iterable<T> {
1152
+ declare class Combinable<T> implements Iterable<T> {
1152
1153
  private readonly source;
1153
1154
  constructor(source: () => Generator<T>);
1154
1155
  /**
@@ -1184,14 +1185,14 @@ export declare class Combinable<T> implements Iterable<T> {
1184
1185
  */
1185
1186
  [Symbol.iterator](): Iterator<T>;
1186
1187
  }
1187
- export declare function combine<A, B>(a: Iterable<A>, b: Iterable<B>): Combinable<[A, B]>;
1188
- export declare function combine<A, B, C>(a: Iterable<A>, b: Iterable<B>, c: Iterable<C>): Combinable<[A, B, C]>;
1189
- export declare function combine<A, B, C, D>(a: Iterable<A>, b: Iterable<B>, c: Iterable<C>, d: Iterable<D>): Combinable<[A, B, C, D]>;
1190
- export declare function combine<A, B, C, D, E>(a: Iterable<A>, b: Iterable<B>, c: Iterable<C>, d: Iterable<D>, e: Iterable<E>): Combinable<[A, B, C, D, E]>;
1188
+ declare function combine<A, B>(a: Iterable<A>, b: Iterable<B>): Combinable<[A, B]>;
1189
+ declare function combine<A, B, C>(a: Iterable<A>, b: Iterable<B>, c: Iterable<C>): Combinable<[A, B, C]>;
1190
+ declare function combine<A, B, C, D>(a: Iterable<A>, b: Iterable<B>, c: Iterable<C>, d: Iterable<D>): Combinable<[A, B, C, D]>;
1191
+ declare function combine<A, B, C, D, E>(a: Iterable<A>, b: Iterable<B>, c: Iterable<C>, d: Iterable<D>, e: Iterable<E>): Combinable<[A, B, C, D, E]>;
1191
1192
  /**
1192
1193
  * Result of parsing MDX frontmatter
1193
1194
  */
1194
- export interface ParseMDXResult {
1195
+ interface ParseMDXResult {
1195
1196
  /** Parsed schema definition from YAML frontmatter */
1196
1197
  schema: SchemaDefinition;
1197
1198
  /** Remaining MDX body after frontmatter */
@@ -1217,18 +1218,18 @@ export interface ParseMDXResult {
1217
1218
  * // schema = { $context: 'https://db.sb', Idea: { concept: 'What is the concept?' } }
1218
1219
  * // body = '\n<App>content</App>'
1219
1220
  */
1220
- export declare function parseMDX(mdx: string): ParseMDXResult;
1221
+ declare function parseMDX(mdx: string): ParseMDXResult;
1221
1222
  /**
1222
1223
  * Hook context passed to entity hooks
1223
1224
  */
1224
- export interface HookContext {
1225
+ interface HookContext {
1225
1226
  generate: (types: string | string[]) => Promise<void>;
1226
1227
  changed?: Record<string, boolean>;
1227
1228
  }
1228
1229
  /**
1229
1230
  * Entity lifecycle hooks
1230
1231
  */
1231
- export interface EntityHooks {
1232
+ interface EntityHooks {
1232
1233
  onCreate?: (entity: unknown, ctx: HookContext) => Promise<void>;
1233
1234
  onUpdate?: (entity: unknown, ctx: HookContext) => Promise<void>;
1234
1235
  onDelete?: (entity: unknown) => Promise<void>;
@@ -1236,7 +1237,7 @@ export interface EntityHooks {
1236
1237
  /**
1237
1238
  * Navigation group in the sidebar
1238
1239
  */
1239
- export interface NavigationGroup {
1240
+ interface NavigationGroup {
1240
1241
  name: string;
1241
1242
  icon?: string;
1242
1243
  children: (NavigationGroup | string)[];
@@ -1244,7 +1245,7 @@ export interface NavigationGroup {
1244
1245
  /**
1245
1246
  * Field configuration from <Field> elements
1246
1247
  */
1247
- export interface FieldConfig {
1248
+ interface FieldConfig {
1248
1249
  name: string;
1249
1250
  lines?: number;
1250
1251
  placeholder?: string;
@@ -1263,7 +1264,7 @@ export interface FieldConfig {
1263
1264
  /**
1264
1265
  * Section configuration from <Section> elements
1265
1266
  */
1266
- export interface SectionConfig {
1267
+ interface SectionConfig {
1267
1268
  label: string;
1268
1269
  collapsed?: boolean;
1269
1270
  children?: (FieldConfig | SectionConfig)[];
@@ -1271,20 +1272,20 @@ export interface SectionConfig {
1271
1272
  /**
1272
1273
  * Search configuration from <Search> elements
1273
1274
  */
1274
- export interface SearchConfig {
1275
+ interface SearchConfig {
1275
1276
  fields?: string[];
1276
1277
  }
1277
1278
  /**
1278
1279
  * Filter configuration from <Filter> elements
1279
1280
  */
1280
- export interface FilterConfig {
1281
+ interface FilterConfig {
1281
1282
  field: string;
1282
1283
  exists?: boolean;
1283
1284
  }
1284
1285
  /**
1285
1286
  * Action configuration for generate/built-in actions
1286
1287
  */
1287
- export interface ActionConfig {
1288
+ interface ActionConfig {
1288
1289
  type: 'generate' | 'delete' | 'duplicate' | 'export' | 'import';
1289
1290
  entity?: string;
1290
1291
  context?: string[];
@@ -1294,20 +1295,20 @@ export interface ActionConfig {
1294
1295
  /**
1295
1296
  * Role-based permission configuration
1296
1297
  */
1297
- export interface RoleConfig {
1298
+ interface RoleConfig {
1298
1299
  name: string;
1299
1300
  actions: string[];
1300
1301
  }
1301
1302
  /**
1302
1303
  * Template configuration for Cards/Detail views
1303
1304
  */
1304
- export interface TemplateConfig {
1305
+ interface TemplateConfig {
1305
1306
  jsx: string;
1306
1307
  }
1307
1308
  /**
1308
1309
  * Form configuration from <Form> elements
1309
1310
  */
1310
- export interface FormConfig {
1311
+ interface FormConfig {
1311
1312
  layout?: 'stack' | 'grid';
1312
1313
  fields?: string[];
1313
1314
  children?: (FieldConfig | SectionConfig)[];
@@ -1315,7 +1316,7 @@ export interface FormConfig {
1315
1316
  /**
1316
1317
  * Display component configuration
1317
1318
  */
1318
- export interface DisplayConfig {
1319
+ interface DisplayConfig {
1319
1320
  type: 'table' | 'grid' | 'cards';
1320
1321
  columns?: string[];
1321
1322
  sortable?: boolean;
@@ -1324,7 +1325,7 @@ export interface DisplayConfig {
1324
1325
  /**
1325
1326
  * View configuration (List, Detail, Edit, Create)
1326
1327
  */
1327
- export interface ViewConfig {
1328
+ interface ViewConfig {
1328
1329
  search?: SearchConfig;
1329
1330
  filters?: FilterConfig[];
1330
1331
  display?: DisplayConfig;
@@ -1337,7 +1338,7 @@ export interface ViewConfig {
1337
1338
  /**
1338
1339
  * Collection configuration for a schema type
1339
1340
  */
1340
- export interface CollectionConfig {
1341
+ interface CollectionConfig {
1341
1342
  view?: 'table' | 'cards' | 'grid';
1342
1343
  columns?: string[];
1343
1344
  searchable?: boolean;
@@ -1354,7 +1355,7 @@ export interface CollectionConfig {
1354
1355
  /**
1355
1356
  * Complete UI configuration parsed from JSX
1356
1357
  */
1357
- export interface UIConfig {
1358
+ interface UIConfig {
1358
1359
  hooks: Record<string, EntityHooks>;
1359
1360
  navigation: NavigationGroup[];
1360
1361
  collections: Record<string, CollectionConfig>;
@@ -1380,11 +1381,11 @@ export interface UIConfig {
1380
1381
  * // config.navigation = [{ name: 'Planning', icon: 'lightbulb', children: ['Idea'] }]
1381
1382
  * // config.collections = { Idea: { view: 'cards' } }
1382
1383
  */
1383
- export declare function parseJSXUI(jsx: string, schema: ParsedSchema): UIConfig;
1384
+ declare function parseJSXUI(jsx: string, schema: ParsedSchema): UIConfig;
1384
1385
  /**
1385
1386
  * Result of processing an MDX file
1386
1387
  */
1387
- export interface ProcessMDXResult {
1388
+ interface ProcessMDXResult {
1388
1389
  /** Raw YAML schema definition */
1389
1390
  schema: SchemaDefinition;
1390
1391
  /** Parsed schema with types, fields, and references */
@@ -1397,5 +1398,6 @@ export interface ProcessMDXResult {
1397
1398
  /**
1398
1399
  * Process an MDX file and return all parsed components.
1399
1400
  */
1400
- export declare function processMDX(mdx: string): ProcessMDXResult;
1401
- //# sourceMappingURL=index.d.ts.map
1401
+ declare function processMDX(mdx: string): ProcessMDXResult;
1402
+
1403
+ export { APIError, type APIErrorCode, type ActionConfig, type ArrayField, type AsyncConfig, type CodeConfig, type CollectionConfig, Combinable, type Components, type ComputedField, type ComputedFieldFn, type ConventionsConfig, DB, type DBInstance, type DBResult, type DBResultBase, type DiagramConfig, type DisplayConfig, type EmbeddedField, type EntityCollection, type EntityDirectives, type EntityHandler, type EntityHooks, type EntityUpdateHandler, type EvalDefinition, type FieldConfig, type FieldValue, type FilterConfig, type FormConfig, type GeneratedObject, type HookContext, type ImageConfig, type InputStateConfig, type JSONPathEmbeddedField, type JSONPathField, type JSONSchema, type JSONSchemaProperty, type Job, type JobStatus, type ListOptions, type NavigationGroup, type NestedFieldValue, type OAuthConfig, OPERATORS, type ObjectField, type ParseMDXResult, type ParsedField, type ParsedGenerationReference, type ParsedOperator, type ParsedSchema, type ParsedStateConfig, type ParsedType, type ProcessMDXResult, type PromptField, type RawStateConfig, type ReferenceField, type ReferenceOperator, type RoleConfig, type SchemaAnalytics, type SchemaDefinition, type SchemaErrorHandler, type SchemaExperiment, type SchemaHandler, type SchemaMetadata, type SchemaSettings, SchemaValidationError, type SchemaValidationErrorCode, type SearchConfig, type SectionConfig, type SeedConfig, SerializedFunction, type SourceConfig, type SourceInput, type SpeechConfig, type StateConfig, type StateValidationError, type StateValidationResult, type StringField, type TemplateConfig, type TransitionConfig, type TypeDefinition, type TypeFactory, type TypeReference, UI, type UIConfig, type ViewConfig, combine, convertStringsToPromptsInSeededType, extractCountFromDescription, getReferenceMode, getReferenceTargetType, isJSONPathEmbeddedField, isJSONPathField, isPromptField, isReferenceField, isStringField, isValidJSONPath, parseFieldType, parseGenerationArrayReference, parseGenerationReference, parseIdConfig, parseJSXUI, parseMDX, parseNamespaceFromId, parseOperator, parseSchema, parseSeedConfig, parseStateConfig, processMDX, schemaHash, toJSONSchema, validateStateConfig };