@blitznocode/blitz-orm 0.10.7 → 0.10.14

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/index.d.mts CHANGED
@@ -154,6 +154,15 @@ type AdapterContext = {
154
154
  };
155
155
  };
156
156
 
157
+ declare const Schema: unique symbol;
158
+ declare const QueryPath: unique symbol;
159
+ declare const EdgeType: unique symbol;
160
+ declare const EdgeSchema: unique symbol;
161
+ declare const DBNode: unique symbol;
162
+ declare const FieldSchema: unique symbol;
163
+ declare const SharedMetadata: unique symbol;
164
+ declare const SuqlMetadata: unique symbol;
165
+
157
166
  type BormField = {
158
167
  path: string;
159
168
  cardinality?: DiscreteCardinality;
@@ -169,6 +178,7 @@ type LinkField = BormField & {
169
178
  relation: string;
170
179
  cardinality: DiscreteCardinality;
171
180
  plays: string;
181
+ isVirtual?: boolean;
172
182
  } & ({
173
183
  target: 'role';
174
184
  filter?: Filter | Filter[];
@@ -179,6 +189,21 @@ type LinkedFieldWithThing = LinkField & {
179
189
  thing: string;
180
190
  thingType: ThingType;
181
191
  };
192
+ type MultiField = BormField & {
193
+ contentType: 'FLEX';
194
+ default?: {
195
+ type: 'fn';
196
+ fn: (currentNode: BQLMutationBlock) => unknown;
197
+ } | {
198
+ type: 'value';
199
+ value: unknown;
200
+ };
201
+ validations?: {
202
+ enum?: unknown[];
203
+ unique?: boolean;
204
+ fn?: (value: unknown) => boolean;
205
+ };
206
+ };
182
207
  type StringField = BormField & {
183
208
  contentType: 'ID' | 'COLOR' | 'DATE' | 'FILE' | 'EMAIL' | 'PHONE' | 'URL' | 'PASSWORD' | 'LANGUAGE_TEXT' | 'RICH_TEXT' | 'TEXT' | 'JSON';
184
209
  default?: {
@@ -237,7 +262,7 @@ type BooleanField = BormField & {
237
262
  fn?: (value: boolean) => boolean;
238
263
  };
239
264
  };
240
- type AllDataField = StringField | NumberField | DateField | BooleanField;
265
+ type AllDataField = StringField | NumberField | DateField | BooleanField | MultiField;
241
266
  type DataField = BormField & {
242
267
  cardinality?: Cardinality;
243
268
  shared?: boolean;
@@ -305,11 +330,12 @@ type SharedEnrichedProps = {
305
330
  dataFields?: EnrichedDataField[];
306
331
  db: DBHandleKey;
307
332
  dbContext: AdapterContext;
333
+ allExtends?: string[];
334
+ subTypes?: string[];
308
335
  };
309
336
  type EnrichedBormEntity = Omit<BormEntity, 'linkFields' | 'idFields' | 'dataFields'> & {
310
337
  extends?: string;
311
338
  thingType: 'entity';
312
- allExtends?: string[];
313
339
  idFields: string[];
314
340
  } & SharedEnrichedProps;
315
341
  type EnrichedBormRelation = Omit<BormRelation, 'linkFields' | 'dataFields'> & {
@@ -317,35 +343,47 @@ type EnrichedBormRelation = Omit<BormRelation, 'linkFields' | 'dataFields'> & {
317
343
  roles: {
318
344
  [key: string]: EnrichedRoleField;
319
345
  };
346
+ idFields: string[];
320
347
  } & SharedEnrichedProps;
321
348
  type EnrichedRoleField = RoleField & {
322
- playedBy?: LinkedFieldWithThing[];
323
349
  name: string;
350
+ playedBy?: LinkedFieldWithThing[];
351
+ $things: string[];
324
352
  fieldType: 'roleField';
353
+ [SharedMetadata]: {
354
+ inheritanceOrigin: string;
355
+ };
356
+ [SuqlMetadata]: {
357
+ queryPath: string;
358
+ };
325
359
  };
326
360
  type EnrichedDataField = DataField & {
327
361
  dbPath: string;
362
+ [SharedMetadata]: {
363
+ inheritanceOrigin: string;
364
+ };
328
365
  };
329
366
  type EnrichedLinkField = LinkField & {
330
367
  name: string;
331
368
  relation: string;
332
369
  plays: string;
370
+ $things: string[];
333
371
  fieldType: 'linkField';
372
+ [SharedMetadata]: {
373
+ inheritanceOrigin: string;
374
+ };
375
+ [SuqlMetadata]: {
376
+ queryPath: string;
377
+ };
334
378
  } & ({
335
379
  target: 'role';
336
- filter?: Filter | Filter[];
380
+ targetRoles?: string[];
337
381
  oppositeLinkFieldsPlayedBy: LinkedFieldWithThing[];
338
382
  } | {
339
383
  target: 'relation';
340
384
  oppositeLinkFieldsPlayedBy: Pick<LinkedFieldWithThing, 'thing' | 'thingType' | 'plays'>[];
341
385
  });
342
386
 
343
- declare const Schema: unique symbol;
344
- declare const QueryPath: unique symbol;
345
- declare const EdgeType: unique symbol;
346
- declare const EdgeSchema: unique symbol;
347
- declare const DBNode: unique symbol;
348
-
349
387
  type Sorter = {
350
388
  field: string;
351
389
  desc?: boolean;
@@ -384,6 +422,7 @@ type EnrichedAttributeQuery = {
384
422
  $justId: boolean;
385
423
  $id: string;
386
424
  $isVirtual?: boolean;
425
+ [FieldSchema]: EnrichedDataField;
387
426
  };
388
427
  type PlayedBy = {
389
428
  path: string;
@@ -412,11 +451,11 @@ type EnrichedLinkQuery = {
412
451
  $idNotIncluded?: boolean;
413
452
  $filter?: Filter;
414
453
  $filterByUnique: boolean;
415
- $filterProcessed: boolean;
416
454
  $sort?: Sorter[];
417
455
  $offset?: number;
418
456
  $limit?: number;
419
457
  [QueryPath]: string;
458
+ [FieldSchema]: EnrichedLinkField;
420
459
  };
421
460
  type EnrichedRoleQuery = {
422
461
  $fieldType: 'role';
@@ -434,14 +473,15 @@ type EnrichedRoleQuery = {
434
473
  $filter?: Filter;
435
474
  $filterByUnique: boolean;
436
475
  $playedBy: PlayedBy;
437
- $filterProcessed: boolean;
438
476
  $sort?: Sorter[];
439
477
  $offset?: number;
440
478
  $limit?: number;
441
479
  [QueryPath]: string;
480
+ [FieldSchema]: EnrichedRoleField;
442
481
  };
443
482
  type EnrichedFieldQuery = EnrichedAttributeQuery | EnrichedLinkQuery | EnrichedRoleQuery;
444
483
  type EnrichedEntityQuery = {
484
+ $id?: string | string[];
445
485
  $thingType: 'entity';
446
486
  $thing: string;
447
487
  $path: string;
@@ -455,6 +495,7 @@ type EnrichedEntityQuery = {
455
495
  [QueryPath]: string;
456
496
  };
457
497
  type EnrichedRelationQuery = {
498
+ $id?: string | string[];
458
499
  $thingType: 'relation';
459
500
  $thing: string;
460
501
  $path: string;
package/dist/index.d.ts CHANGED
@@ -154,6 +154,15 @@ type AdapterContext = {
154
154
  };
155
155
  };
156
156
 
157
+ declare const Schema: unique symbol;
158
+ declare const QueryPath: unique symbol;
159
+ declare const EdgeType: unique symbol;
160
+ declare const EdgeSchema: unique symbol;
161
+ declare const DBNode: unique symbol;
162
+ declare const FieldSchema: unique symbol;
163
+ declare const SharedMetadata: unique symbol;
164
+ declare const SuqlMetadata: unique symbol;
165
+
157
166
  type BormField = {
158
167
  path: string;
159
168
  cardinality?: DiscreteCardinality;
@@ -169,6 +178,7 @@ type LinkField = BormField & {
169
178
  relation: string;
170
179
  cardinality: DiscreteCardinality;
171
180
  plays: string;
181
+ isVirtual?: boolean;
172
182
  } & ({
173
183
  target: 'role';
174
184
  filter?: Filter | Filter[];
@@ -179,6 +189,21 @@ type LinkedFieldWithThing = LinkField & {
179
189
  thing: string;
180
190
  thingType: ThingType;
181
191
  };
192
+ type MultiField = BormField & {
193
+ contentType: 'FLEX';
194
+ default?: {
195
+ type: 'fn';
196
+ fn: (currentNode: BQLMutationBlock) => unknown;
197
+ } | {
198
+ type: 'value';
199
+ value: unknown;
200
+ };
201
+ validations?: {
202
+ enum?: unknown[];
203
+ unique?: boolean;
204
+ fn?: (value: unknown) => boolean;
205
+ };
206
+ };
182
207
  type StringField = BormField & {
183
208
  contentType: 'ID' | 'COLOR' | 'DATE' | 'FILE' | 'EMAIL' | 'PHONE' | 'URL' | 'PASSWORD' | 'LANGUAGE_TEXT' | 'RICH_TEXT' | 'TEXT' | 'JSON';
184
209
  default?: {
@@ -237,7 +262,7 @@ type BooleanField = BormField & {
237
262
  fn?: (value: boolean) => boolean;
238
263
  };
239
264
  };
240
- type AllDataField = StringField | NumberField | DateField | BooleanField;
265
+ type AllDataField = StringField | NumberField | DateField | BooleanField | MultiField;
241
266
  type DataField = BormField & {
242
267
  cardinality?: Cardinality;
243
268
  shared?: boolean;
@@ -305,11 +330,12 @@ type SharedEnrichedProps = {
305
330
  dataFields?: EnrichedDataField[];
306
331
  db: DBHandleKey;
307
332
  dbContext: AdapterContext;
333
+ allExtends?: string[];
334
+ subTypes?: string[];
308
335
  };
309
336
  type EnrichedBormEntity = Omit<BormEntity, 'linkFields' | 'idFields' | 'dataFields'> & {
310
337
  extends?: string;
311
338
  thingType: 'entity';
312
- allExtends?: string[];
313
339
  idFields: string[];
314
340
  } & SharedEnrichedProps;
315
341
  type EnrichedBormRelation = Omit<BormRelation, 'linkFields' | 'dataFields'> & {
@@ -317,35 +343,47 @@ type EnrichedBormRelation = Omit<BormRelation, 'linkFields' | 'dataFields'> & {
317
343
  roles: {
318
344
  [key: string]: EnrichedRoleField;
319
345
  };
346
+ idFields: string[];
320
347
  } & SharedEnrichedProps;
321
348
  type EnrichedRoleField = RoleField & {
322
- playedBy?: LinkedFieldWithThing[];
323
349
  name: string;
350
+ playedBy?: LinkedFieldWithThing[];
351
+ $things: string[];
324
352
  fieldType: 'roleField';
353
+ [SharedMetadata]: {
354
+ inheritanceOrigin: string;
355
+ };
356
+ [SuqlMetadata]: {
357
+ queryPath: string;
358
+ };
325
359
  };
326
360
  type EnrichedDataField = DataField & {
327
361
  dbPath: string;
362
+ [SharedMetadata]: {
363
+ inheritanceOrigin: string;
364
+ };
328
365
  };
329
366
  type EnrichedLinkField = LinkField & {
330
367
  name: string;
331
368
  relation: string;
332
369
  plays: string;
370
+ $things: string[];
333
371
  fieldType: 'linkField';
372
+ [SharedMetadata]: {
373
+ inheritanceOrigin: string;
374
+ };
375
+ [SuqlMetadata]: {
376
+ queryPath: string;
377
+ };
334
378
  } & ({
335
379
  target: 'role';
336
- filter?: Filter | Filter[];
380
+ targetRoles?: string[];
337
381
  oppositeLinkFieldsPlayedBy: LinkedFieldWithThing[];
338
382
  } | {
339
383
  target: 'relation';
340
384
  oppositeLinkFieldsPlayedBy: Pick<LinkedFieldWithThing, 'thing' | 'thingType' | 'plays'>[];
341
385
  });
342
386
 
343
- declare const Schema: unique symbol;
344
- declare const QueryPath: unique symbol;
345
- declare const EdgeType: unique symbol;
346
- declare const EdgeSchema: unique symbol;
347
- declare const DBNode: unique symbol;
348
-
349
387
  type Sorter = {
350
388
  field: string;
351
389
  desc?: boolean;
@@ -384,6 +422,7 @@ type EnrichedAttributeQuery = {
384
422
  $justId: boolean;
385
423
  $id: string;
386
424
  $isVirtual?: boolean;
425
+ [FieldSchema]: EnrichedDataField;
387
426
  };
388
427
  type PlayedBy = {
389
428
  path: string;
@@ -412,11 +451,11 @@ type EnrichedLinkQuery = {
412
451
  $idNotIncluded?: boolean;
413
452
  $filter?: Filter;
414
453
  $filterByUnique: boolean;
415
- $filterProcessed: boolean;
416
454
  $sort?: Sorter[];
417
455
  $offset?: number;
418
456
  $limit?: number;
419
457
  [QueryPath]: string;
458
+ [FieldSchema]: EnrichedLinkField;
420
459
  };
421
460
  type EnrichedRoleQuery = {
422
461
  $fieldType: 'role';
@@ -434,14 +473,15 @@ type EnrichedRoleQuery = {
434
473
  $filter?: Filter;
435
474
  $filterByUnique: boolean;
436
475
  $playedBy: PlayedBy;
437
- $filterProcessed: boolean;
438
476
  $sort?: Sorter[];
439
477
  $offset?: number;
440
478
  $limit?: number;
441
479
  [QueryPath]: string;
480
+ [FieldSchema]: EnrichedRoleField;
442
481
  };
443
482
  type EnrichedFieldQuery = EnrichedAttributeQuery | EnrichedLinkQuery | EnrichedRoleQuery;
444
483
  type EnrichedEntityQuery = {
484
+ $id?: string | string[];
445
485
  $thingType: 'entity';
446
486
  $thing: string;
447
487
  $path: string;
@@ -455,6 +495,7 @@ type EnrichedEntityQuery = {
455
495
  [QueryPath]: string;
456
496
  };
457
497
  type EnrichedRelationQuery = {
498
+ $id?: string | string[];
458
499
  $thingType: 'relation';
459
500
  $thing: string;
460
501
  $path: string;