pinia-orm-edge 1.7.3-28257628.bbb8bab

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/dist/casts.cjs +124 -0
  4. package/dist/casts.d.cts +66 -0
  5. package/dist/casts.d.mts +66 -0
  6. package/dist/casts.d.ts +66 -0
  7. package/dist/casts.mjs +118 -0
  8. package/dist/decorators.cjs +219 -0
  9. package/dist/decorators.d.cts +107 -0
  10. package/dist/decorators.d.mts +107 -0
  11. package/dist/decorators.d.ts +107 -0
  12. package/dist/decorators.mjs +198 -0
  13. package/dist/helpers.cjs +69 -0
  14. package/dist/helpers.d.cts +54 -0
  15. package/dist/helpers.d.mts +54 -0
  16. package/dist/helpers.d.ts +54 -0
  17. package/dist/helpers.mjs +61 -0
  18. package/dist/index.cjs +3592 -0
  19. package/dist/index.d.cts +49 -0
  20. package/dist/index.d.mts +49 -0
  21. package/dist/index.d.ts +49 -0
  22. package/dist/index.mjs +3561 -0
  23. package/dist/nanoid/async.cjs +42 -0
  24. package/dist/nanoid/async.d.cts +29 -0
  25. package/dist/nanoid/async.d.mts +29 -0
  26. package/dist/nanoid/async.d.ts +29 -0
  27. package/dist/nanoid/async.mjs +39 -0
  28. package/dist/nanoid/index.cjs +42 -0
  29. package/dist/nanoid/index.d.cts +24 -0
  30. package/dist/nanoid/index.d.mts +24 -0
  31. package/dist/nanoid/index.d.ts +24 -0
  32. package/dist/nanoid/index.mjs +39 -0
  33. package/dist/nanoid/non-secure.cjs +42 -0
  34. package/dist/nanoid/non-secure.d.cts +24 -0
  35. package/dist/nanoid/non-secure.d.mts +24 -0
  36. package/dist/nanoid/non-secure.d.ts +24 -0
  37. package/dist/nanoid/non-secure.mjs +39 -0
  38. package/dist/shared/pinia-orm.1bd7d299.mjs +153 -0
  39. package/dist/shared/pinia-orm.4ff2e12f.mjs +66 -0
  40. package/dist/shared/pinia-orm.876a7cdc.d.cts +1981 -0
  41. package/dist/shared/pinia-orm.876a7cdc.d.mts +1981 -0
  42. package/dist/shared/pinia-orm.876a7cdc.d.ts +1981 -0
  43. package/dist/shared/pinia-orm.a62c4fc4.cjs +167 -0
  44. package/dist/shared/pinia-orm.a7e3e0f3.cjs +68 -0
  45. package/dist/uuid/v1.cjs +41 -0
  46. package/dist/uuid/v1.d.cts +25 -0
  47. package/dist/uuid/v1.d.mts +25 -0
  48. package/dist/uuid/v1.d.ts +25 -0
  49. package/dist/uuid/v1.mjs +38 -0
  50. package/dist/uuid/v4.cjs +41 -0
  51. package/dist/uuid/v4.d.cts +25 -0
  52. package/dist/uuid/v4.d.mts +25 -0
  53. package/dist/uuid/v4.d.ts +25 -0
  54. package/dist/uuid/v4.mjs +38 -0
  55. package/package.json +126 -0
@@ -0,0 +1,1981 @@
1
+ import * as pinia from 'pinia';
2
+ import { Pinia, DefineStoreOptionsBase } from 'pinia';
3
+ import { schema, Schema as Schema$1 } from '@pinia-orm/normalizr';
4
+ import * as __composables from '@/composables';
5
+
6
+ interface Constructor<T> {
7
+ new (...args: any[]): T;
8
+ }
9
+ type Mutator<T> = (value: T) => T;
10
+ interface MutatorFunctions<T> {
11
+ get?: Mutator<T>;
12
+ set?: Mutator<T>;
13
+ }
14
+ interface Mutators {
15
+ [name: string]: MutatorFunctions<any> | Mutator<any>;
16
+ }
17
+ interface CacheConfig {
18
+ key?: string;
19
+ params?: Record<string, any>;
20
+ }
21
+
22
+ declare class WeakCache<K, V extends object> implements Map<K, V> {
23
+ #private;
24
+ readonly [Symbol.toStringTag]: string;
25
+ has(key: K): boolean;
26
+ get(key: K): V;
27
+ set(key: K, value: V): this;
28
+ get size(): number;
29
+ clear(): void;
30
+ delete(key: K): boolean;
31
+ forEach(cb: (value: V, key: K, map: Map<K, V>) => void): void;
32
+ [Symbol.iterator](): IterableIterator<[K, V]>;
33
+ entries(): IterableIterator<[K, V]>;
34
+ keys(): IterableIterator<K>;
35
+ values(): IterableIterator<V>;
36
+ }
37
+
38
+ interface PiniaOrmPluginContext {
39
+ model: Model;
40
+ repository: Repository;
41
+ config: FilledInstallOptions & {
42
+ [key: string]: any;
43
+ };
44
+ }
45
+ interface PiniaOrmPlugin {
46
+ (context: PiniaOrmPluginContext): PiniaOrmPluginContext;
47
+ }
48
+ declare const definePiniaOrmPlugin: (plugin: PiniaOrmPlugin) => PiniaOrmPlugin;
49
+ declare const plugins: PiniaOrmPlugin[];
50
+ declare function registerPlugins(repository: Repository): Repository<Model>;
51
+
52
+ interface ModelConfigOptions {
53
+ withMeta?: boolean;
54
+ hidden?: string[];
55
+ namespace?: string;
56
+ visible?: string[];
57
+ }
58
+ interface CacheConfigOptions {
59
+ shared?: boolean;
60
+ provider?: typeof WeakCache<string, Model[]>;
61
+ }
62
+ interface InstallOptions {
63
+ model?: ModelConfigOptions;
64
+ cache?: CacheConfigOptions | boolean;
65
+ }
66
+ interface FilledInstallOptions {
67
+ model: Required<ModelConfigOptions>;
68
+ cache: Required<CacheConfigOptions | boolean>;
69
+ }
70
+ interface CreatePiniaOrm {
71
+ use(plugin: PiniaOrmPlugin): this;
72
+ }
73
+ /**
74
+ * Install Pinia ORM to the store.
75
+ */
76
+ declare function createORM(options?: InstallOptions): () => {
77
+ use(plugin: PiniaOrmPlugin): any;
78
+ };
79
+
80
+ declare abstract class Attribute {
81
+ /**
82
+ * The model instance.
83
+ */
84
+ protected model: Model;
85
+ /**
86
+ * The field name
87
+ */
88
+ protected key: string;
89
+ /**
90
+ * Create a new Attribute instance.
91
+ */
92
+ constructor(model: Model);
93
+ /**
94
+ * Set the key name of the field
95
+ */
96
+ setKey(key: string): this;
97
+ /**
98
+ * Make the value for the attribute.
99
+ */
100
+ abstract make(value?: any): any;
101
+ }
102
+
103
+ type TypeDefault<T> = T | null | (() => T | null);
104
+ declare abstract class Type extends Attribute {
105
+ /**
106
+ * The default value for the attribute.
107
+ */
108
+ value: any;
109
+ /**
110
+ * Whether the attribute accepts `null` value or not.
111
+ */
112
+ protected isNullable: boolean;
113
+ /**
114
+ * Create a new Type attribute instance.
115
+ */
116
+ constructor(model: Model, value?: TypeDefault<any>);
117
+ /**
118
+ * Set the nullable option to false.
119
+ */
120
+ notNullable(): this;
121
+ protected makeReturn<T>(type: 'boolean' | 'number' | 'string', value: any): T;
122
+ /**
123
+ * Throw warning for wrong type
124
+ */
125
+ protected throwWarning(message: string[]): void;
126
+ }
127
+
128
+ declare class Attr extends Type {
129
+ /**
130
+ * Make the value for the attribute.
131
+ */
132
+ make(value: any): any;
133
+ }
134
+
135
+ declare class String$1 extends Type {
136
+ /**
137
+ * Create a new String attribute instance.
138
+ */
139
+ constructor(model: Model, value: TypeDefault<string>);
140
+ /**
141
+ * Make the value for the attribute.
142
+ */
143
+ make(value: any): string | null;
144
+ }
145
+
146
+ declare class Number extends Type {
147
+ /**
148
+ * Create a new Number attribute instance.
149
+ */
150
+ constructor(model: Model, value: TypeDefault<number>);
151
+ /**
152
+ * Make the value for the attribute.
153
+ */
154
+ make(value: any): number | null;
155
+ }
156
+
157
+ declare class Boolean$1 extends Type {
158
+ /**
159
+ * Create a new Boolean attribute instance.
160
+ */
161
+ constructor(model: Model, value: TypeDefault<boolean>);
162
+ /**
163
+ * Make the value for the attribute.
164
+ */
165
+ make(value: any): boolean | null;
166
+ }
167
+
168
+ type PropertyDecorator = (target: Model, propertyKey: string) => void;
169
+ type UidOptions = NanoidOptions | number;
170
+ interface NanoidOptions {
171
+ alphabet?: string;
172
+ size?: number;
173
+ }
174
+ interface TypeOptions {
175
+ notNullable?: boolean;
176
+ }
177
+
178
+ declare class Uid extends Type {
179
+ protected options: Record<string, any>;
180
+ protected alphabet: string;
181
+ protected size: number;
182
+ constructor(model: Model, options?: UidOptions);
183
+ /**
184
+ * Make the value for the attribute.
185
+ */
186
+ make(value: any): string;
187
+ }
188
+
189
+ type Schemas = Record<string, schema.Entity>;
190
+ declare class Schema {
191
+ /**
192
+ * The list of generated schemas.
193
+ */
194
+ private schemas;
195
+ /**
196
+ * The model instance.
197
+ */
198
+ private model;
199
+ /**
200
+ * Create a new Schema instance.
201
+ */
202
+ constructor(model: Model);
203
+ /**
204
+ * Create a single schema.
205
+ */
206
+ one(model?: Model, parent?: Model): schema.Entity;
207
+ /**
208
+ * Create an array schema for the given model.
209
+ */
210
+ many(model: Model, parent?: Model): schema.Array;
211
+ /**
212
+ * Create an union schema for the given models.
213
+ */
214
+ union(models: Model[], callback: schema.SchemaFunction): schema.Union;
215
+ /**
216
+ * Create a new normalizr entity.
217
+ */
218
+ private newEntity;
219
+ /**
220
+ * The `id` attribute option for the normalizr entity.
221
+ *
222
+ * Generates any missing primary keys declared by a Uid attribute. Missing
223
+ * primary keys where the designated attributes do not exist will
224
+ * throw an error.
225
+ *
226
+ * Note that this will only generate uids for primary key attributes since it
227
+ * is required to generate the "index id" while the other attributes are not.
228
+ *
229
+ * It's especially important when attempting to "update" records since we'll
230
+ * want to retain the missing attributes in-place to prevent them being
231
+ * overridden by newly generated uid values.
232
+ *
233
+ * If uid primary keys are omitted, when invoking the "update" method, it will
234
+ * fail because the uid values will never exist in the store.
235
+ *
236
+ * While it would be nice to throw an error in such a case, instead of
237
+ * silently failing an update, we don't have a way to detect whether users
238
+ * are trying to "update" records or "inserting" new records at this stage.
239
+ * Something to consider for future revisions.
240
+ */
241
+ private idAttribute;
242
+ /**
243
+ * Get all primary keys defined by the Uid attribute for the given model.
244
+ */
245
+ private getUidPrimaryKeyPairs;
246
+ /**
247
+ * Create a definition for the given model.
248
+ */
249
+ private definition;
250
+ }
251
+
252
+ declare class Database {
253
+ /**
254
+ * The list of registered models.
255
+ */
256
+ models: Record<string, Model>;
257
+ /**
258
+ * Register the given model.
259
+ */
260
+ register<M extends Model>(model: M): void;
261
+ /**
262
+ * Register all related models.
263
+ */
264
+ private registerRelatedModels;
265
+ /**
266
+ * Get a model by the specified entity name.
267
+ */
268
+ getModel<M extends Model>(name: string): M;
269
+ }
270
+
271
+ declare class Interpreter {
272
+ /**
273
+ * The model object.
274
+ */
275
+ model: Model;
276
+ /**
277
+ * Create a new Interpreter instance.
278
+ */
279
+ constructor(model: Model);
280
+ /**
281
+ * Perform interpretation for the given data.
282
+ */
283
+ process(data: Element): [Element, NormalizedData];
284
+ process(data: Element[]): [Element[], NormalizedData];
285
+ /**
286
+ * Normalize the given data.
287
+ */
288
+ private normalize;
289
+ /**
290
+ * Get the schema from the database.
291
+ */
292
+ private getSchema;
293
+ }
294
+
295
+ interface Where {
296
+ field: WherePrimaryClosure | string;
297
+ value: WhereSecondaryClosure | any;
298
+ boolean: 'and' | 'or';
299
+ }
300
+ type WherePrimaryClosure = (model: any) => boolean;
301
+ type WhereSecondaryClosure = (value: any) => boolean;
302
+ interface WhereGroup {
303
+ and?: Where[];
304
+ or?: Where[];
305
+ }
306
+ interface Order {
307
+ field: OrderBy;
308
+ direction: OrderDirection;
309
+ }
310
+ interface Group {
311
+ field: GroupBy;
312
+ }
313
+ type OrderBy = string | ((model: any) => any);
314
+ type GroupBy = string;
315
+ type GroupByFields = string[];
316
+ type OrderDirection = 'asc' | 'desc';
317
+ interface EagerLoad {
318
+ [name: string]: EagerLoadConstraint;
319
+ }
320
+ type EagerLoadConstraint = (query: Query) => void;
321
+
322
+ declare class Query<M extends Model = Model> {
323
+ /**
324
+ * The database instance.
325
+ */
326
+ database: Database;
327
+ /**
328
+ * The model object.
329
+ */
330
+ protected model: M;
331
+ /**
332
+ * The where constraints for the query.
333
+ */
334
+ protected wheres: Where[];
335
+ /**
336
+ * The orderings for the query.
337
+ */
338
+ protected orders: Order[];
339
+ /**
340
+ * The orderings for the query.
341
+ */
342
+ protected groups: Group[];
343
+ /**
344
+ * The maximum number of records to return.
345
+ */
346
+ protected take: number | null;
347
+ /**
348
+ * The number of records to skip.
349
+ */
350
+ protected skip: number;
351
+ /**
352
+ * Fields that should be visible.
353
+ */
354
+ protected visible: string[];
355
+ /**
356
+ * Fields that should be hidden.
357
+ */
358
+ protected hidden: string[];
359
+ /**
360
+ * The cache object.
361
+ */
362
+ protected cache?: WeakCache<string, Collection<M> | GroupedCollection<M>> | undefined;
363
+ /**
364
+ * The relationships that should be eager loaded.
365
+ */
366
+ protected eagerLoad: EagerLoad;
367
+ /**
368
+ * The pinia store.
369
+ */
370
+ protected pinia?: Pinia;
371
+ protected fromCache: boolean;
372
+ protected cacheConfig: CacheConfig;
373
+ protected getNewHydrated: boolean;
374
+ /**
375
+ * Hydrated models. They are stored to prevent rerendering of child components.
376
+ */
377
+ hydratedDataCache: Map<string, M>;
378
+ /**
379
+ * Create a new query instance.
380
+ */
381
+ constructor(database: Database, model: M, cache: WeakCache<string, Collection<M> | GroupedCollection<M>> | undefined, hydratedData: Map<string, M>, pinia?: Pinia);
382
+ /**
383
+ * Create a new query instance for the given model.
384
+ */
385
+ newQuery(model: string): Query;
386
+ /**
387
+ * Create a new query instance with constraints for the given model.
388
+ */
389
+ newQueryWithConstraints(model: string): Query;
390
+ /**
391
+ * Create a new query instance from the given relation.
392
+ */
393
+ newQueryForRelation(relation: Relation): Query;
394
+ /**
395
+ * Create a new interpreter instance.
396
+ */
397
+ protected newInterpreter(): Interpreter;
398
+ /**
399
+ * Commit a store action and get the data
400
+ */
401
+ protected commit(name: string, payload?: any): Record<string, any>;
402
+ /**
403
+ * Make meta field visible
404
+ */
405
+ withMeta(): this;
406
+ /**
407
+ * Make hidden fields visible
408
+ */
409
+ makeVisible(fields: string[]): this;
410
+ /**
411
+ * Make visible fields hidden
412
+ */
413
+ makeHidden(fields: string[]): this;
414
+ /**
415
+ * Add a basic where clause to the query.
416
+ */
417
+ where(field: WherePrimaryClosure | string, value?: WhereSecondaryClosure | any): this;
418
+ /**
419
+ * Add a "where in" clause to the query.
420
+ */
421
+ whereIn(field: string, values: any[] | Set<any>): this;
422
+ /**
423
+ * Add a where clause on the primary key to the query.
424
+ */
425
+ whereId(ids: string | number | (string | number)[]): this;
426
+ /**
427
+ * Add an "or where" clause to the query.
428
+ */
429
+ orWhere(field: WherePrimaryClosure | string, value?: WhereSecondaryClosure | any): this;
430
+ /**
431
+ * Add a "where has" clause to the query.
432
+ */
433
+ whereHas(relation: string, callback?: EagerLoadConstraint, operator?: string | number, count?: number): this;
434
+ /**
435
+ * Add an "or where has" clause to the query.
436
+ */
437
+ orWhereHas(relation: string, callback?: EagerLoadConstraint, operator?: string | number, count?: number): this;
438
+ /**
439
+ * Add a "has" clause to the query.
440
+ */
441
+ has(relation: string, operator?: string | number, count?: number): this;
442
+ /**
443
+ * Add an "or has" clause to the query.
444
+ */
445
+ orHas(relation: string, operator?: string | number, count?: number): this;
446
+ /**
447
+ * Add a "doesn't have" clause to the query.
448
+ */
449
+ doesntHave(relation: string): this;
450
+ /**
451
+ * Add a "doesn't have" clause to the query.
452
+ */
453
+ orDoesntHave(relation: string): this;
454
+ /**
455
+ * Add a "where doesn't have" clause to the query.
456
+ */
457
+ whereDoesntHave(relation: string, callback?: EagerLoadConstraint): this;
458
+ /**
459
+ * Add an "or where doesn't have" clause to the query.
460
+ */
461
+ orWhereDoesntHave(relation: string, callback?: EagerLoadConstraint): this;
462
+ /**
463
+ * Add a "group by" clause to the query.
464
+ */
465
+ groupBy(...fields: GroupByFields): this;
466
+ /**
467
+ * Add an "order by" clause to the query.
468
+ */
469
+ orderBy(field: OrderBy, direction?: OrderDirection): this;
470
+ /**
471
+ * Set the "limit" value of the query.
472
+ */
473
+ limit(value: number): this;
474
+ /**
475
+ * Set the "offset" value of the query.
476
+ */
477
+ offset(value: number): this;
478
+ /**
479
+ * Set the relationships that should be eager loaded.
480
+ */
481
+ with(name: string, callback?: EagerLoadConstraint): this;
482
+ /**
483
+ * Set to eager load all top-level relationships. Constraint is set for all relationships.
484
+ */
485
+ withAll(callback?: EagerLoadConstraint): this;
486
+ /**
487
+ * Set to eager load all relationships recursively.
488
+ */
489
+ withAllRecursive(depth?: number): this;
490
+ /**
491
+ * Define to use the cache for a query
492
+ */
493
+ useCache(key?: string, params?: Record<string, any>): this;
494
+ /**
495
+ * Get where closure for relations
496
+ */
497
+ protected getFieldWhereForRelations(relation: string, callback?: EagerLoadConstraint, operator?: string | number, count?: number): WherePrimaryClosure;
498
+ /**
499
+ * Get all models by id from the store. The difference with the `get` is that this
500
+ * method will not process any query chain.
501
+ */
502
+ protected storeFind(ids?: string[]): Collection<M>;
503
+ /**
504
+ * Get all models from the store. The difference with the `get` is that this
505
+ * method will not process any query chain. It'll always retrieve all models.
506
+ */
507
+ all(): Collection<M>;
508
+ /**
509
+ * Retrieve models by processing whole query chain.
510
+ */
511
+ get<T extends 'group' | 'collection' = 'collection'>(triggerHook?: boolean): T extends 'group' ? GroupedCollection<M> : Collection<M>;
512
+ private internalGet;
513
+ /**
514
+ * Execute the query and get the first result.
515
+ */
516
+ first(): Item<M>;
517
+ /**
518
+ * Find a model by its primary key.
519
+ */
520
+ find(id: string | number): Item<M>;
521
+ find(ids: (string | number)[]): Collection<M>;
522
+ /**
523
+ * Retrieve models by processing all filters set to the query chain.
524
+ */
525
+ select(): Collection<M>;
526
+ /**
527
+ * Filter the given collection by the registered where clause.
528
+ */
529
+ protected filterWhere(models: Collection<M>): Collection<M>;
530
+ /**
531
+ * Get comparator for the where clause.
532
+ */
533
+ protected getWhereComparator(): (model: any) => boolean;
534
+ /**
535
+ * The function to compare where clause to the given model.
536
+ */
537
+ protected whereComparator(model: M, where: Where): boolean;
538
+ /**
539
+ * Filter the given collection by the registered order conditions.
540
+ */
541
+ protected filterOrder(models: Collection<M>): Collection<M>;
542
+ /**
543
+ * Filter the given collection by the registered group conditions.
544
+ */
545
+ protected filterGroup(models: Collection<M>): Record<string, Collection<M>>;
546
+ /**
547
+ * Filter the given collection by the registered limit and offset values.
548
+ */
549
+ protected filterLimit(models: Collection<M>): Collection<M>;
550
+ /**
551
+ * Eager load relations on the model.
552
+ */
553
+ load(models: Collection<M>): void;
554
+ /**
555
+ * Eager load the relationships for the models.
556
+ */
557
+ protected eagerLoadRelations(models: Collection<M>): void;
558
+ /**
559
+ * Eagerly load the relationship on a set of models.
560
+ */
561
+ protected eagerLoadRelation(models: Collection<M>, name: string, constraints: EagerLoadConstraint): void;
562
+ /**
563
+ * Get the relation instance for the given relation name.
564
+ */
565
+ protected getRelation(name: string): Relation;
566
+ revive(schema: Element[]): Collection<M>;
567
+ revive(schema: Element): Item<M>;
568
+ /**
569
+ * Revive single model from the given schema.
570
+ */
571
+ reviveOne(schema: Element): Item<M>;
572
+ /**
573
+ * Revive multiple models from the given schema.
574
+ */
575
+ reviveMany(schema: Element[]): Collection<M>;
576
+ /**
577
+ * Revive relations for the given schema and entity.
578
+ */
579
+ protected reviveRelations(model: M, schema: Element): void;
580
+ /**
581
+ * Create and persist model with default values.
582
+ */
583
+ new(persist?: boolean): M | null;
584
+ /**
585
+ * Save the given records to the store with data normalization.
586
+ */
587
+ save(records: Element[]): M[];
588
+ save(record: Element): M;
589
+ /**
590
+ * Save the given elements to the store.
591
+ */
592
+ saveElements(elements: Elements): void;
593
+ /**
594
+ * Insert the given record to the store.
595
+ */
596
+ insert(records: Element[]): Collection<M>;
597
+ insert(record: Element): M;
598
+ /**
599
+ * Insert the given records to the store by replacing any existing records.
600
+ */
601
+ fresh(records: Element[]): Collection<M>;
602
+ fresh(record: Element): M;
603
+ /**
604
+ * Update the reocrd matching the query chain.
605
+ */
606
+ update(record: Element): Collection<M>;
607
+ /**
608
+ * Destroy the models for the given id.
609
+ */
610
+ destroy(ids: (string | number)[]): Collection<M>;
611
+ destroy(id: string | number): Item<M>;
612
+ protected destroyOne(id: string | number): Item<M>;
613
+ protected destroyMany(ids: (string | number)[]): Collection<M>;
614
+ /**
615
+ * Delete records resolved by the query chain.
616
+ */
617
+ delete(): M[];
618
+ /**
619
+ * Delete all records in the store.
620
+ */
621
+ flush(): Collection<M>;
622
+ protected checkAndDeleteRelations(model: M): void;
623
+ protected dispatchDeleteHooks(models: M | Collection<M>): [{
624
+ (): void;
625
+ }[], string[]];
626
+ /**
627
+ * Get an array of index ids from the given collection.
628
+ */
629
+ protected getIndexIdsFromCollection(models: Collection<M>): string[];
630
+ /**
631
+ * Instantiate new models with the given record.
632
+ */
633
+ protected hydrate(record: Element, options?: ModelOptions): M;
634
+ protected hydrate(records: Element[], options?: ModelOptions): Collection<M>;
635
+ /**
636
+ * Convert given models into an indexed object that is ready to be saved to
637
+ * the store.
638
+ */
639
+ protected compile(models: M | Collection<M>): Elements;
640
+ /**
641
+ * Save already existing models and return them if they exist to prevent
642
+ * an update event trigger in vue if the object is used.
643
+ */
644
+ protected getHydratedModel(record: Element, options?: ModelOptions): M;
645
+ }
646
+
647
+ interface Dictionary {
648
+ [id: string]: Model[];
649
+ }
650
+ type deleteModes = 'cascade' | 'set null';
651
+ declare abstract class Relation extends Attribute {
652
+ /**
653
+ * The parent model.
654
+ */
655
+ parent: Model;
656
+ /**
657
+ * The related model.
658
+ */
659
+ related: Model;
660
+ /**
661
+ * The delete mode
662
+ */
663
+ onDeleteMode?: deleteModes;
664
+ /**
665
+ * Create a new relation instance.
666
+ */
667
+ protected constructor(parent: Model, related: Model);
668
+ /**
669
+ * Get all related models for the relationship.
670
+ */
671
+ abstract getRelateds(): Model[];
672
+ /**
673
+ * Get the related model of the relation.
674
+ */
675
+ getRelated(): Model;
676
+ /**
677
+ * Define the normalizr schema for the relation.
678
+ */
679
+ abstract define(schema: Schema): Schema$1;
680
+ /**
681
+ * Attach the relational key to the given relation.
682
+ */
683
+ abstract attach(record: Element, child: Element): void;
684
+ /**
685
+ * Set the constraints for an eager loading relation.
686
+ */
687
+ abstract addEagerConstraints(query: Query, models: Collection): void;
688
+ /**
689
+ * Match the eagerly loaded results to their parents.
690
+ */
691
+ abstract match(relation: string, models: Collection, query: Query): void;
692
+ /**
693
+ * Get all of the primary keys for an array of models.
694
+ */
695
+ protected getKeys(models: Collection, key: string): (string | number)[];
696
+ /**
697
+ * Specify how this model should behave on delete
698
+ */
699
+ onDelete(mode?: deleteModes): this;
700
+ /**
701
+ * Run a dictionary map over the items.
702
+ */
703
+ protected mapToDictionary(models: Collection, callback: (model: Model) => [string, Model]): Dictionary;
704
+ /**
705
+ * Call a function for a current key match
706
+ */
707
+ protected compositeKeyMapper(foreignKey: PrimaryKey, localKey: PrimaryKey, call: (foreignKey: string, localKey: string) => void): void;
708
+ /**
709
+ * Get the index key defined by the primary key or keys (composite)
710
+ */
711
+ protected getKey(key: PrimaryKey): string;
712
+ }
713
+
714
+ declare class HasOne extends Relation {
715
+ /**
716
+ * The foreign key of the parent model.
717
+ */
718
+ foreignKey: PrimaryKey;
719
+ /**
720
+ * The local key of the parent model.
721
+ */
722
+ localKey: PrimaryKey;
723
+ /**
724
+ * Create a new has-one relation instance.
725
+ */
726
+ constructor(parent: Model, related: Model, foreignKey: PrimaryKey, localKey: PrimaryKey);
727
+ /**
728
+ * Get all related models for the relationship.
729
+ */
730
+ getRelateds(): Model[];
731
+ /**
732
+ * Define the normalizr schema for the relation.
733
+ */
734
+ define(schema: Schema): Schema$1;
735
+ /**
736
+ * Attach the relational key to the given relation.
737
+ */
738
+ attach(record: Element, child: Element): void;
739
+ /**
740
+ * Set the constraints for an eager load of the relation.
741
+ */
742
+ addEagerConstraints(query: Query, models: Collection): void;
743
+ /**
744
+ * Match the eagerly loaded results to their parents.
745
+ */
746
+ match(relation: string, models: Collection, query: Query): void;
747
+ /**
748
+ * Build model dictionary keyed by the relation's foreign key.
749
+ */
750
+ protected buildDictionary(results: Collection): Dictionary;
751
+ /**
752
+ * Make a related model.
753
+ */
754
+ make(element?: Element): Model | null;
755
+ }
756
+
757
+ declare class BelongsTo extends Relation {
758
+ /**
759
+ * The child model instance of the relation.
760
+ */
761
+ child: Model;
762
+ /**
763
+ * The foreign key of the parent model.
764
+ */
765
+ foreignKey: PrimaryKey;
766
+ /**
767
+ * The associated key on the parent model.
768
+ */
769
+ ownerKey: PrimaryKey;
770
+ /**
771
+ * Create a new belongs-to relation instance.
772
+ */
773
+ constructor(parent: Model, child: Model, foreignKey: PrimaryKey, ownerKey: PrimaryKey);
774
+ /**
775
+ * Get all related models for the relationship.
776
+ */
777
+ getRelateds(): Model[];
778
+ /**
779
+ * Define the normalizr schema for the relation.
780
+ */
781
+ define(schema: Schema): Schema$1;
782
+ /**
783
+ * Attach the relational key to the given relation.
784
+ */
785
+ attach(record: Element, child: Element): void;
786
+ /**
787
+ * Set the constraints for an eager load of the relation.
788
+ */
789
+ addEagerConstraints(query: Query, models: Collection): void;
790
+ /**
791
+ * Gather the keys from a collection of related models.
792
+ */
793
+ protected getEagerModelKeys(models: Collection, foreignKey: string): (string | number)[];
794
+ /**
795
+ * Match the eagerly loaded results to their respective parents.
796
+ */
797
+ match(relation: string, models: Collection, query: Query): void;
798
+ /**
799
+ * Build model dictionary keyed by relation's parent key.
800
+ */
801
+ protected buildDictionary(models: Collection): Record<string, Model>;
802
+ /**
803
+ * Make a related model.
804
+ */
805
+ make(element?: Element): Model | null;
806
+ }
807
+
808
+ declare class BelongsToMany extends Relation {
809
+ /**
810
+ * The pivot model.
811
+ */
812
+ pivot: Model;
813
+ /**
814
+ * The foreign key of the parent model.
815
+ */
816
+ foreignPivotKey: string;
817
+ /**
818
+ * The associated key of the relation.
819
+ */
820
+ relatedPivotKey: string;
821
+ /**
822
+ * The key name of the parent model.
823
+ */
824
+ parentKey: string;
825
+ /**
826
+ * The key name of the related model.
827
+ */
828
+ relatedKey: string;
829
+ /**
830
+ * The key name of the pivot data.
831
+ */
832
+ pivotKey: string;
833
+ /**
834
+ * Create a new belongs to instance.
835
+ */
836
+ constructor(parent: Model, related: Model, pivot: Model, foreignPivotKey: string, relatedPivotKey: string, parentKey: string, relatedKey: string);
837
+ /**
838
+ * Get all related models for the relationship.
839
+ */
840
+ getRelateds(): Model[];
841
+ /**
842
+ * Define the normalizr schema for the relationship.
843
+ */
844
+ define(schema: Schema): Schema$1;
845
+ /**
846
+ * Attach the parent type and id to the given relation.
847
+ */
848
+ attach(record: Element, child: Element): void;
849
+ /**
850
+ * Convert given value to the appropriate value for the attribute.
851
+ */
852
+ make(elements?: Element[]): Model[];
853
+ /**
854
+ * Match the eagerly loaded results to their parents.
855
+ */
856
+ match(relation: string, models: Collection, query: Query): void;
857
+ /**
858
+ * Set the constraints for the related relation.
859
+ */
860
+ addEagerConstraints(_query: Query, _collection: Collection): void;
861
+ }
862
+
863
+ declare class HasMany extends Relation {
864
+ /**
865
+ * The foreign key of the parent model.
866
+ */
867
+ foreignKey: PrimaryKey;
868
+ /**
869
+ * The local key of the parent model.
870
+ */
871
+ localKey: PrimaryKey;
872
+ /**
873
+ * Create a new has-many relation instance.
874
+ */
875
+ constructor(parent: Model, related: Model, foreignKey: PrimaryKey, localKey: PrimaryKey);
876
+ /**
877
+ * Get all related models for the relationship.
878
+ */
879
+ getRelateds(): Model[];
880
+ /**
881
+ * Define the normalizr schema for the relation.
882
+ */
883
+ define(schema: Schema): Schema$1;
884
+ /**
885
+ * Attach the relational key to the given relation.
886
+ */
887
+ attach(record: Element, child: Element): void;
888
+ /**
889
+ * Set the constraints for an eager load of the relation.
890
+ */
891
+ addEagerConstraints(query: Query, models: Collection): void;
892
+ /**
893
+ * Match the eagerly loaded results to their parents.
894
+ */
895
+ match(relation: string, models: Collection, query: Query): void;
896
+ /**
897
+ * Build model dictionary keyed by the relation's foreign key.
898
+ */
899
+ protected buildDictionary(results: Collection): Dictionary;
900
+ /**
901
+ * Make related models.
902
+ */
903
+ make(elements?: Element[]): Model[];
904
+ }
905
+
906
+ declare class HasManyBy extends Relation {
907
+ /**
908
+ * The child model instance of the relation.
909
+ */
910
+ child: Model;
911
+ /**
912
+ * The foreign key of the parent model.
913
+ */
914
+ foreignKey: string;
915
+ /**
916
+ * The owner key of the parent model.
917
+ */
918
+ ownerKey: string;
919
+ /**
920
+ * Create a new has-many-by relation instance.
921
+ */
922
+ constructor(parent: Model, child: Model, foreignKey: string, ownerKey: string);
923
+ /**
924
+ * Get all related models for the relationship.
925
+ */
926
+ getRelateds(): Model[];
927
+ /**
928
+ * Define the normalizr schema for the relation.
929
+ */
930
+ define(schema: Schema): Schema$1;
931
+ /**
932
+ * Attach the relational key to the given relation.
933
+ */
934
+ attach(record: Element, child: Element): void;
935
+ /**
936
+ * Push owner key to foregin key array if owner key doesn't exist in foreign
937
+ * key array.
938
+ */
939
+ protected attachIfMissing(foreignKey: (string | number)[], ownerKey: string | number): void;
940
+ /**
941
+ * Set the constraints for an eager load of the relation.
942
+ */
943
+ addEagerConstraints(query: Query, models: Collection): void;
944
+ /**
945
+ * Gather the keys from a collection of related models.
946
+ */
947
+ protected getEagerModelKeys(models: Collection): (string | number)[];
948
+ /**
949
+ * Match the eagerly loaded results to their parents.
950
+ */
951
+ match(relation: string, models: Collection, query: Query): void;
952
+ /**
953
+ * Build model dictionary keyed by the relation's foreign key.
954
+ */
955
+ protected buildDictionary(models: Collection): Record<string, Model>;
956
+ /**
957
+ * Get all related models from the given dictionary.
958
+ */
959
+ protected getRelatedModels(dictionary: Record<string, Model>, keys: (string | number)[]): Model[];
960
+ /**
961
+ * Make related models.
962
+ */
963
+ make(elements?: Element[]): Model[];
964
+ }
965
+
966
+ declare class MorphOne extends Relation {
967
+ /**
968
+ * The field name that contains id of the parent model.
969
+ */
970
+ morphId: string;
971
+ /**
972
+ * The field name that contains type of the parent model.
973
+ */
974
+ morphType: string;
975
+ /**
976
+ * The local key of the model.
977
+ */
978
+ localKey: string;
979
+ /**
980
+ * Create a new morph-one relation instance.
981
+ */
982
+ constructor(parent: Model, related: Model, morphId: string, morphType: string, localKey: string);
983
+ /**
984
+ * Get all related models for the relationship.
985
+ */
986
+ getRelateds(): Model[];
987
+ /**
988
+ * Define the normalizr schema for the relation.
989
+ */
990
+ define(schema: Schema): Schema$1;
991
+ /**
992
+ * Attach the parent type and id to the given relation.
993
+ */
994
+ attach(record: Element, child: Element): void;
995
+ /**
996
+ * Set the constraints for an eager load of the relation.
997
+ */
998
+ addEagerConstraints(query: Query, models: Collection): void;
999
+ /**
1000
+ * Match the eagerly loaded results to their parents.
1001
+ */
1002
+ match(relation: string, models: Collection, query: Query): void;
1003
+ /**
1004
+ * Build model dictionary keyed by the relation's foreign key.
1005
+ */
1006
+ protected buildDictionary(models: Collection): Record<string, Model>;
1007
+ /**
1008
+ * Make a related model.
1009
+ */
1010
+ make(element?: Element): Model | null;
1011
+ }
1012
+
1013
+ interface DictionaryByEntities {
1014
+ [entity: string]: {
1015
+ [id: string]: Model;
1016
+ };
1017
+ }
1018
+ declare class MorphTo extends Relation {
1019
+ /**
1020
+ * The related models.
1021
+ */
1022
+ relatedModels: Model[];
1023
+ /**
1024
+ * The related model dictionary.
1025
+ */
1026
+ relatedTypes: Record<string, Model>;
1027
+ /**
1028
+ * The field name that contains id of the parent model.
1029
+ */
1030
+ morphId: string;
1031
+ /**
1032
+ * The field name that contains type of the parent model.
1033
+ */
1034
+ morphType: string;
1035
+ /**
1036
+ * The associated key of the child model.
1037
+ */
1038
+ ownerKey: string;
1039
+ /**
1040
+ * Create a new morph-to relation instance.
1041
+ */
1042
+ constructor(parent: Model, relatedModels: Model[], morphId: string, morphType: string, ownerKey: string);
1043
+ /**
1044
+ * Create a dictionary of relations keyed by their entity.
1045
+ */
1046
+ protected createRelatedTypes(models: Model[]): Record<string, Model>;
1047
+ /**
1048
+ * Get the type field name.
1049
+ */
1050
+ getType(): string;
1051
+ /**
1052
+ * Get all related models for the relationship.
1053
+ */
1054
+ getRelateds(): Model[];
1055
+ /**
1056
+ * Define the normalizr schema for the relation.
1057
+ */
1058
+ define(schema: Schema): Schema$1;
1059
+ /**
1060
+ * Attach the relational key to the given record. Since morph-to relationship
1061
+ * doesn't have any foreign key, it would do nothing.
1062
+ */
1063
+ attach(_record: Element, _child: Element): void;
1064
+ /**
1065
+ * Add eager constraints. Since we do not know the related model ahead of time,
1066
+ * we cannot add any eager constraints.
1067
+ */
1068
+ addEagerConstraints(_query: Query, _models: Collection): void;
1069
+ /**
1070
+ * Find and attach related children to their respective parents.
1071
+ */
1072
+ match(relation: string, models: Collection, query: Query): void;
1073
+ /**
1074
+ * Make a related model.
1075
+ */
1076
+ make(element?: Element, type?: string): Model | null;
1077
+ /**
1078
+ * Build model dictionary keyed by the owner key for each entity.
1079
+ */
1080
+ protected buildDictionary(query: Query, models: Collection): DictionaryByEntities;
1081
+ /**
1082
+ * Get the relation's primary keys grouped by its entity.
1083
+ */
1084
+ protected getKeysByEntity(models: Collection): Record<string, (string | number)[]>;
1085
+ }
1086
+
1087
+ declare class MorphMany extends Relation {
1088
+ /**
1089
+ * The field name that contains id of the parent model.
1090
+ */
1091
+ morphId: string;
1092
+ /**
1093
+ * The field name that contains type of the parent model.
1094
+ */
1095
+ morphType: string;
1096
+ /**
1097
+ * The local key of the model.
1098
+ */
1099
+ localKey: string;
1100
+ /**
1101
+ * Create a new morph-many relation instance.
1102
+ */
1103
+ constructor(parent: Model, related: Model, morphId: string, morphType: string, localKey: string);
1104
+ /**
1105
+ * Get all related models for the relationship.
1106
+ */
1107
+ getRelateds(): Model[];
1108
+ /**
1109
+ * Define the normalizr schema for the relation.
1110
+ */
1111
+ define(schema: Schema): Schema$1;
1112
+ /**
1113
+ * Attach the parent type and id to the given relation.
1114
+ */
1115
+ attach(record: Element, child: Element): void;
1116
+ /**
1117
+ * Set the constraints for an eager load of the relation.
1118
+ */
1119
+ addEagerConstraints(query: Query, models: Collection): void;
1120
+ /**
1121
+ * Match the eagerly loaded results to their parents.
1122
+ */
1123
+ match(relation: string, models: Collection, query: Query): void;
1124
+ /**
1125
+ * Build model dictionary keyed by the relation's foreign key.
1126
+ */
1127
+ protected buildDictionary(results: Collection): Dictionary;
1128
+ /**
1129
+ * Make related models.
1130
+ */
1131
+ make(elements?: Element[]): Model[];
1132
+ }
1133
+
1134
+ interface Casts {
1135
+ [name: string]: typeof CastAttribute;
1136
+ }
1137
+ declare class CastAttribute {
1138
+ /**
1139
+ * The model instance.
1140
+ */
1141
+ protected static attributes: ModelFields | undefined;
1142
+ /**
1143
+ * Cast parameters
1144
+ */
1145
+ static parameters?: Record<string, any>;
1146
+ /**
1147
+ * Default parameters
1148
+ */
1149
+ $parameters?: Record<string, any>;
1150
+ /**
1151
+ * Create a new Attribute instance.
1152
+ */
1153
+ constructor(attributes: ModelFields | undefined);
1154
+ /**
1155
+ * Get the value for return.
1156
+ */
1157
+ get(value?: any): any;
1158
+ /**
1159
+ * Set the value for the store.
1160
+ */
1161
+ set(value?: any): any;
1162
+ static withParameters(parameters?: Record<string, any>): typeof CastAttribute;
1163
+ /**
1164
+ * Get the cast parameters
1165
+ */
1166
+ getParameters(): Record<string, any> | undefined;
1167
+ /**
1168
+ * Get the constructor for this cast.
1169
+ */
1170
+ $self(): typeof CastAttribute;
1171
+ /**
1172
+ * Generate new instance of cast
1173
+ */
1174
+ static newRawInstance<M extends typeof CastAttribute>(this: M, attributes: any): InstanceType<M>;
1175
+ }
1176
+
1177
+ declare class HasManyThrough extends Relation {
1178
+ /**
1179
+ * The "through" parent model.
1180
+ */
1181
+ through: Model;
1182
+ /**
1183
+ * The near key on the relationship.
1184
+ */
1185
+ firstKey: string;
1186
+ /**
1187
+ * The far key on the relationship.
1188
+ */
1189
+ secondKey: string;
1190
+ /**
1191
+ * The local key on the relationship.
1192
+ */
1193
+ localKey: string;
1194
+ /**
1195
+ * The local key on the intermediary model.
1196
+ */
1197
+ secondLocalKey: string;
1198
+ /**
1199
+ * Create a new has-many-through relation instance.
1200
+ */
1201
+ constructor(parent: Model, related: Model, through: Model, firstKey: string, secondKey: string, localKey: string, secondLocalKey: string);
1202
+ /**
1203
+ * Get all related models for the relationship.
1204
+ */
1205
+ getRelateds(): Model[];
1206
+ /**
1207
+ * Define the normalizr schema for the relation.
1208
+ */
1209
+ define(schema: Schema): Schema$1;
1210
+ /**
1211
+ * Attach the relational key to the given data. Since has many through
1212
+ * relationship doesn't have any foreign key, it would do nothing.
1213
+ */
1214
+ attach(_record: Element, _child: Element): void;
1215
+ /**
1216
+ * Only register missing through relation
1217
+ */
1218
+ addEagerConstraints(_query: Query, _models: Collection): void;
1219
+ /**
1220
+ * Match the eagerly loaded results to their parents.
1221
+ */
1222
+ match(relation: string, models: Collection, query: Query): void;
1223
+ /**
1224
+ * Build model dictionary keyed by the relation's foreign key.
1225
+ */
1226
+ protected buildDictionary(throughResults: Collection, results: Collection): Dictionary;
1227
+ /**
1228
+ * Make related models.
1229
+ */
1230
+ make(elements?: Element[]): Model[];
1231
+ }
1232
+
1233
+ declare class MorphToMany extends Relation {
1234
+ /**
1235
+ * The pivot model.
1236
+ */
1237
+ pivot: Model;
1238
+ /**
1239
+ * The field name that contains id of the parent model.
1240
+ */
1241
+ morphId: string;
1242
+ /**
1243
+ * The field name that contains type of the parent model.
1244
+ */
1245
+ morphType: string;
1246
+ /**
1247
+ * The associated key of the relation.
1248
+ */
1249
+ relatedId: string;
1250
+ /**
1251
+ * The key name of the parent model.
1252
+ */
1253
+ parentKey: string;
1254
+ /**
1255
+ * The key name of the related model.
1256
+ */
1257
+ relatedKey: string;
1258
+ /**
1259
+ * The key name of the pivot data.
1260
+ */
1261
+ pivotKey: string;
1262
+ /**
1263
+ * Create a new morph to many to instance.
1264
+ */
1265
+ constructor(parent: Model, related: Model, pivot: Model, relatedId: string, morphId: string, morphType: string, parentKey: string, relatedKey: string);
1266
+ /**
1267
+ * Get all related models for the relationship.
1268
+ */
1269
+ getRelateds(): Model[];
1270
+ /**
1271
+ * Define the normalizr schema for the relationship.
1272
+ */
1273
+ define(schema: Schema): Schema$1;
1274
+ /**
1275
+ * Attach the parent type and id to the given relation.
1276
+ */
1277
+ attach(record: Element, child: Element): void;
1278
+ /**
1279
+ * Convert given value to the appropriate value for the attribute.
1280
+ */
1281
+ make(elements?: Element[]): Model[];
1282
+ /**
1283
+ * Match the eagerly loaded results to their parents.
1284
+ */
1285
+ match(relation: string, models: Collection, query: Query): void;
1286
+ /**
1287
+ * Set the constraints for the related relation.
1288
+ */
1289
+ addEagerConstraints(_query: Query, _collection: Collection): void;
1290
+ }
1291
+
1292
+ type ModelFields = Record<string, Attribute>;
1293
+ type ModelSchemas = Record<string, ModelFields>;
1294
+ type ModelRegistries = Record<string, ModelRegistry>;
1295
+ type ModelRegistry = Record<string, () => Attribute>;
1296
+ type PrimaryKey = string | string[];
1297
+ interface ModelOptions {
1298
+ config?: ModelConfigOptions;
1299
+ fill?: boolean;
1300
+ relations?: boolean;
1301
+ operation?: 'set' | 'get';
1302
+ visible?: string[];
1303
+ hidden?: string[];
1304
+ action?: 'save' | 'update' | 'insert';
1305
+ }
1306
+ interface MetaValues {
1307
+ createdAt: number;
1308
+ updatedAt: number;
1309
+ }
1310
+ interface BeforeHook {
1311
+ (model: typeof Model & any, record?: Element): void | boolean;
1312
+ }
1313
+ interface AfterHook {
1314
+ (model: typeof Model & any, record?: Element): void;
1315
+ }
1316
+ interface InheritanceTypes {
1317
+ [key: string]: typeof Model;
1318
+ }
1319
+ declare class Model {
1320
+ [s: keyof ModelFields]: any;
1321
+ _meta: undefined | MetaValues;
1322
+ /**
1323
+ * The name of the model.
1324
+ */
1325
+ static entity: string;
1326
+ /**
1327
+ * The reference to the base entity name if the class extends a base entity.
1328
+ */
1329
+ static baseEntity: string;
1330
+ /**
1331
+ * Define a namespace if you have multiple equal entity names.
1332
+ * Resulting in "{namespace}/{entity}"
1333
+ */
1334
+ static namespace: string;
1335
+ /**
1336
+ * The primary key for the model.
1337
+ */
1338
+ static primaryKey: string | string[];
1339
+ /**
1340
+ * The meta key for the model.
1341
+ */
1342
+ static metaKey: string;
1343
+ /**
1344
+ * Hidden properties
1345
+ */
1346
+ static hidden: [keyof ModelFields] | string[];
1347
+ /**
1348
+ * Visible properties
1349
+ */
1350
+ static visible: [keyof ModelFields] | string[];
1351
+ /**
1352
+ * The global install options
1353
+ */
1354
+ static config: ModelConfigOptions & {
1355
+ [key: string]: any;
1356
+ };
1357
+ /**
1358
+ * The type key for the model.
1359
+ */
1360
+ static typeKey: string;
1361
+ /**
1362
+ * Behaviour for relational fields on delete.
1363
+ */
1364
+ static fieldsOnDelete: Record<string, any>;
1365
+ /**
1366
+ * Original model data.
1367
+ */
1368
+ protected static original: Record<string, any>;
1369
+ /**
1370
+ * The schema for the model. It contains the result of the `fields`
1371
+ * method or the attributes defined by decorators.
1372
+ */
1373
+ protected static schemas: ModelSchemas;
1374
+ /**
1375
+ * The registry for the model. It contains predefined model schema generated
1376
+ * by the property decorators and gets evaluated, and stored, on the `schema`
1377
+ * property when registering models to the database.
1378
+ */
1379
+ protected static registries: ModelRegistries;
1380
+ /**
1381
+ * The pinia options for the model. It can contain options which will passed
1382
+ * to the 'defineStore' function of pinia.
1383
+ */
1384
+ protected static piniaOptions: {};
1385
+ /**
1386
+ * The mutators for the model.
1387
+ */
1388
+ protected static fieldMutators: Mutators;
1389
+ /**
1390
+ * The casts for the model.
1391
+ */
1392
+ protected static fieldCasts: Record<string, any>;
1393
+ /**
1394
+ * The array of booted models.
1395
+ */
1396
+ protected static booted: Record<string, boolean>;
1397
+ /**
1398
+ * Create a new model instance.
1399
+ */
1400
+ constructor(attributes?: Element, options?: ModelOptions);
1401
+ /**
1402
+ * Create a new model fields definition.
1403
+ */
1404
+ static fields(): ModelFields;
1405
+ /**
1406
+ * Build the schema by evaluating fields and registry.
1407
+ */
1408
+ protected static initializeSchema(): void;
1409
+ /**
1410
+ * Set the attribute to the registry.
1411
+ */
1412
+ static setRegistry<M extends typeof Model>(this: M, key: string, attribute: () => Attribute): M;
1413
+ /**
1414
+ * Set delete behaviour for relation field
1415
+ */
1416
+ static setFieldDeleteMode<M extends typeof Model>(this: M, key: string, mode: deleteModes): M;
1417
+ /**
1418
+ * Set an mutator for a field
1419
+ */
1420
+ static setMutator<M extends typeof Model>(this: M, key: string, mutator: MutatorFunctions<any>): M;
1421
+ /**
1422
+ * Set a cast for a field
1423
+ */
1424
+ static setCast<M extends typeof Model>(this: M, key: string, to: typeof CastAttribute): M;
1425
+ /**
1426
+ * Set a field to hidden
1427
+ */
1428
+ static setHidden<M extends typeof Model>(this: M, key: keyof ModelFields): M;
1429
+ /**
1430
+ * Clear the list of booted models so they can be re-booted.
1431
+ */
1432
+ static clearBootedModels(): void;
1433
+ /**
1434
+ * Clear registries.
1435
+ */
1436
+ static clearRegistries(): void;
1437
+ /**
1438
+ * Create a new model instance without field values being populated.
1439
+ *
1440
+ * This method is mainly for the internal use when registering models to the
1441
+ * database. Since all pre-registered models are for referencing its model
1442
+ * setting during the various process, but the fields are not required.
1443
+ *
1444
+ * Use this method when you want create a new model instance for:
1445
+ * - Registering model to a component (eg. Repository, Query, etc.)
1446
+ * - Registering model to attributes (String, Has Many, etc.)
1447
+ */
1448
+ static newRawInstance<M extends typeof Model>(this: M): InstanceType<M>;
1449
+ /**
1450
+ * Create a new Attr attribute instance.
1451
+ */
1452
+ static attr(value: TypeDefault<any>): Attr;
1453
+ /**
1454
+ * Create a new String attribute instance.
1455
+ */
1456
+ static string(value: TypeDefault<string>): String$1;
1457
+ /**
1458
+ * Create a new Number attribute instance.
1459
+ */
1460
+ static number(value: TypeDefault<number>): Number;
1461
+ /**
1462
+ * Create a new Boolean attribute instance.
1463
+ */
1464
+ static boolean(value: TypeDefault<boolean>): Boolean$1;
1465
+ /**
1466
+ * Create a new Uid attribute instance.
1467
+ */
1468
+ static uid(options?: UidOptions): Uid;
1469
+ /**
1470
+ * Create a new HasOne relation instance.
1471
+ */
1472
+ static hasOne(related: typeof Model, foreignKey: PrimaryKey, localKey?: PrimaryKey): HasOne;
1473
+ /**
1474
+ * Create a new BelongsTo relation instance.
1475
+ */
1476
+ static belongsTo(related: typeof Model, foreignKey: PrimaryKey, ownerKey?: PrimaryKey): BelongsTo;
1477
+ /**
1478
+ * Create a new HasMany relation instance.
1479
+ */
1480
+ static belongsToMany(related: typeof Model, pivot: typeof Model, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): BelongsToMany;
1481
+ /**
1482
+ * Create a new MorphToMany relation instance.
1483
+ */
1484
+ static morphToMany(related: typeof Model, pivot: typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): MorphToMany;
1485
+ /**
1486
+ * Create a new HasMany relation instance.
1487
+ */
1488
+ static hasMany(related: typeof Model, foreignKey: PrimaryKey, localKey?: PrimaryKey): HasMany;
1489
+ /**
1490
+ * Create a new HasManyBy relation instance.
1491
+ */
1492
+ static hasManyBy(related: typeof Model, foreignKey: string, ownerKey?: string): HasManyBy;
1493
+ /**
1494
+ * Create a new HasMany relation instance.
1495
+ */
1496
+ static hasManyThrough(related: typeof Model, through: typeof Model, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): HasManyThrough;
1497
+ /**
1498
+ * Create a new MorphOne relation instance.
1499
+ */
1500
+ static morphOne(related: typeof Model, id: string, type: string, localKey?: string): MorphOne;
1501
+ /**
1502
+ * Create a new MorphTo relation instance.
1503
+ */
1504
+ static morphTo(related: typeof Model[], id: string, type: string, ownerKey?: string): MorphTo;
1505
+ /**
1506
+ * Create a new MorphMany relation instance.
1507
+ */
1508
+ static morphMany(related: typeof Model, id: string, type: string, localKey?: string): MorphMany;
1509
+ /**
1510
+ * Lifecycle hook for before saving
1511
+ */
1512
+ static saving: BeforeHook;
1513
+ /**
1514
+ * Lifecycle hook for before updating
1515
+ */
1516
+ static updating: BeforeHook;
1517
+ /**
1518
+ * Lifecycle hook for before creating
1519
+ */
1520
+ static creating: BeforeHook;
1521
+ /**
1522
+ * Lifecycle hook for before deleting
1523
+ */
1524
+ static deleting: BeforeHook;
1525
+ /**
1526
+ * Lifecycle hook for after getting data
1527
+ */
1528
+ static retrieved: AfterHook;
1529
+ /**
1530
+ * Lifecycle hook for after saved
1531
+ */
1532
+ static saved: AfterHook;
1533
+ /**
1534
+ * Lifecycle hook for after updated
1535
+ */
1536
+ static updated: AfterHook;
1537
+ /**
1538
+ * Lifecycle hook for after created
1539
+ */
1540
+ static created: AfterHook;
1541
+ /**
1542
+ * Lifecycle hook for after deleted
1543
+ */
1544
+ static deleted: AfterHook;
1545
+ /**
1546
+ * Mutators to mutate matching fields when instantiating the model.
1547
+ */
1548
+ static mutators(): Mutators;
1549
+ /**
1550
+ * Casts to cast matching fields when instantiating the model.
1551
+ */
1552
+ static casts(): Casts;
1553
+ /**
1554
+ * Types mapping used to dispatch entities based on their discriminator field
1555
+ */
1556
+ static types(): InheritanceTypes;
1557
+ /**
1558
+ * Get the constructor for this model.
1559
+ */
1560
+ $self(): typeof Model;
1561
+ /**
1562
+ * Get the entity for this model.
1563
+ */
1564
+ $entity(): string;
1565
+ /**
1566
+ * Get the model config.
1567
+ */
1568
+ $config(): ModelConfigOptions & {
1569
+ [key: string]: any;
1570
+ };
1571
+ /**
1572
+ * Get the namespace.
1573
+ */
1574
+ $namespace(): String;
1575
+ /**
1576
+ * Get the store name.
1577
+ */
1578
+ $storeName(): string;
1579
+ /**
1580
+ * Get the base entity for this model.
1581
+ */
1582
+ $baseEntity(): string;
1583
+ /**
1584
+ * Get the type key for this model.
1585
+ */
1586
+ $typeKey(): string;
1587
+ /**
1588
+ * Get the types for this model.
1589
+ */
1590
+ $types(): InheritanceTypes;
1591
+ /**
1592
+ * Get the pinia options for this model.
1593
+ */
1594
+ $piniaOptions(): {};
1595
+ /**
1596
+ * Get the primary key for this model.
1597
+ */
1598
+ $primaryKey(): string | string[];
1599
+ /**
1600
+ * Get the model fields for this model.
1601
+ */
1602
+ $fields(): ModelFields;
1603
+ /**
1604
+ * Get the model hidden fields
1605
+ */
1606
+ $hidden(): string[];
1607
+ /**
1608
+ * Get the model visible fields
1609
+ */
1610
+ $visible(): string[];
1611
+ /**
1612
+ * Create a new instance of this model. This method provides a convenient way
1613
+ * to re-generate a fresh instance of this model. It's particularly useful
1614
+ * during hydration through Query operations.
1615
+ */
1616
+ $newInstance(attributes?: Element, options?: ModelOptions): this;
1617
+ /**
1618
+ * Bootstrap this model.
1619
+ */
1620
+ protected $boot(): void;
1621
+ /**
1622
+ * Build the schema by evaluating fields and registry.
1623
+ */
1624
+ protected $initializeSchema(): void;
1625
+ $casts(): Casts;
1626
+ /**
1627
+ * Fill this model by the given attributes. Missing fields will be populated
1628
+ * by the attributes default value.
1629
+ */
1630
+ $fill(attributes?: Element, options?: ModelOptions): this;
1631
+ protected $fillMeta(action?: string): void;
1632
+ /**
1633
+ * Fill the given attribute with a given value specified by the given key.
1634
+ */
1635
+ protected $fillField(key: string, attr: Attribute, value: any): any;
1636
+ protected isFieldVisible(key: string, modelHidden: string[], modelVisible: string[], options: ModelOptions): boolean;
1637
+ /**
1638
+ * Get the primary key field name.
1639
+ */
1640
+ $getKeyName(): string | string[];
1641
+ /**
1642
+ * Get primary key value for the model. If the model has the composite key,
1643
+ * it will return an array of ids.
1644
+ */
1645
+ $getKey(record?: Element, concatCompositeKey?: boolean): string | number | (string | number)[] | null;
1646
+ /**
1647
+ * Check whether the model has composite key.
1648
+ */
1649
+ $hasCompositeKey(): boolean;
1650
+ /**
1651
+ * Get the composite key values for the given model as an array of ids.
1652
+ */
1653
+ protected $getCompositeKey(record: Element): (string | number)[] | null;
1654
+ /**
1655
+ * Get the index id of this model or for a given record.
1656
+ */
1657
+ $getIndexId(record?: Element): string;
1658
+ /**
1659
+ * Stringify the given id.
1660
+ */
1661
+ protected $stringifyId(id: string | number | (string | number)[]): string;
1662
+ /**
1663
+ * Get the local key name for the model.
1664
+ */
1665
+ $getLocalKey(): string;
1666
+ /**
1667
+ * Get the relation instance for the given relation name.
1668
+ */
1669
+ $getRelation(name: string): Relation;
1670
+ /**
1671
+ * Set the given relationship on the model.
1672
+ */
1673
+ $setRelation(relation: string, model: Model | Model[] | null): this;
1674
+ /**
1675
+ * Get the mutators of the model
1676
+ */
1677
+ $getMutators(): Mutators;
1678
+ /**
1679
+ * Get the casts of the model
1680
+ */
1681
+ $getCasts(): Casts;
1682
+ /**
1683
+ * Get the original values of the model instance
1684
+ */
1685
+ $getOriginal(): Element;
1686
+ /**
1687
+ * Return the model instance with its original state
1688
+ */
1689
+ $refresh(): this;
1690
+ /**
1691
+ * Checks if attributes were changed
1692
+ */
1693
+ $isDirty($attribute?: keyof ModelFields): Boolean;
1694
+ /**
1695
+ * Get the serialized model attributes.
1696
+ */
1697
+ $getAttributes(): Element;
1698
+ /**
1699
+ * Serialize this model, or the given model, as POJO.
1700
+ */
1701
+ $toJson(model?: Model, options?: ModelOptions): Element;
1702
+ /**
1703
+ * Serialize the given value.
1704
+ */
1705
+ protected serializeValue(value: any): any;
1706
+ /**
1707
+ * Serialize the given array to JSON.
1708
+ */
1709
+ protected serializeArray(value: any[]): any[];
1710
+ /**
1711
+ * Serialize the given object to JSON.
1712
+ */
1713
+ protected serializeObject(value: {
1714
+ [index: string]: number | string;
1715
+ }): object;
1716
+ /**
1717
+ * Serialize the given relation to JSON.
1718
+ */
1719
+ protected serializeRelation(relation: Item): Element | null;
1720
+ protected serializeRelation(relation: Collection): Element[];
1721
+ }
1722
+
1723
+ type Element = Record<string, any>;
1724
+ interface Elements {
1725
+ [id: string]: Element;
1726
+ }
1727
+ interface NormalizedData {
1728
+ [entity: string]: Elements;
1729
+ }
1730
+ type Item<M extends Model = Model> = M | null;
1731
+ type Collection<M extends Model = Model> = M[];
1732
+ type GroupedCollection<M extends Model = Model> = Record<string, M[]>;
1733
+
1734
+ interface ModelConstructor<M extends Model> extends Constructor<M> {
1735
+ newRawInstance(): M;
1736
+ }
1737
+
1738
+ declare function useDataStore<S extends DataStoreState, T extends DataStore = DataStore>(id: string, options: DefineStoreOptionsBase<S, T>, query?: Query): pinia.StoreDefinition<string, S, {}, {
1739
+ save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1740
+ insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1741
+ update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1742
+ fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1743
+ destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1744
+ delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1745
+ flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1746
+ }>;
1747
+ interface DataStoreState {
1748
+ data: Record<string, any>;
1749
+ [s: string]: any;
1750
+ }
1751
+ type DataStore = ReturnType<typeof __composables['useDataStore']>;
1752
+
1753
+ declare class Repository<M extends Model = Model> {
1754
+ [index: string]: any;
1755
+ /**
1756
+ * A special flag to indicate if this is the repository class or not. It's
1757
+ * used when retrieving repository instance from `store.$repo()` method to
1758
+ * determine whether the passed in class is either a repository or a model.
1759
+ */
1760
+ static _isRepository: boolean;
1761
+ /**
1762
+ * The database instance.
1763
+ */
1764
+ database: Database;
1765
+ /**
1766
+ * The model instance.
1767
+ */
1768
+ protected model: M;
1769
+ /**
1770
+ * The pinia instance
1771
+ */
1772
+ protected pinia?: Pinia;
1773
+ /**
1774
+ * The cache instance
1775
+ */
1776
+ queryCache?: WeakCache<string, M[]>;
1777
+ /**
1778
+ * Hydrated models. They are stored to prevent rerendering of child components.
1779
+ */
1780
+ hydratedDataCache: Map<string, M>;
1781
+ /**
1782
+ * The model object to be used for the custom repository.
1783
+ */
1784
+ use?: typeof Model;
1785
+ /**
1786
+ * The model object to be used for the custom repository.
1787
+ */
1788
+ static useModel?: Model;
1789
+ /**
1790
+ * Global config
1791
+ */
1792
+ config: FilledInstallOptions & {
1793
+ [key: string]: any;
1794
+ };
1795
+ /**
1796
+ * Create a new Repository instance.
1797
+ */
1798
+ constructor(database: Database, pinia?: Pinia);
1799
+ /**
1800
+ * Set the model
1801
+ */
1802
+ static setModel(model: Model): typeof Repository;
1803
+ /**
1804
+ * Set the global config
1805
+ */
1806
+ setConfig(config: FilledInstallOptions): void;
1807
+ /**
1808
+ * Initialize the repository by setting the model instance.
1809
+ */
1810
+ initialize(model?: ModelConstructor<M>): this;
1811
+ /**
1812
+ * Get the constructor for this model.
1813
+ */
1814
+ $self(): typeof Repository;
1815
+ /**
1816
+ * Get the model instance. If the model is not registered to the repository,
1817
+ * it will throw an error. It happens when users use a custom repository
1818
+ * without setting `use` property.
1819
+ */
1820
+ getModel(): M;
1821
+ /**
1822
+ * Returns the pinia store used with this model
1823
+ */
1824
+ piniaStore<S extends DataStoreState = DataStoreState>(): pinia.Store<string, S, {}, {
1825
+ save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1826
+ insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1827
+ update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1828
+ fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1829
+ destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1830
+ delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void; /**
1831
+ * Hydrated models. They are stored to prevent rerendering of child components.
1832
+ */
1833
+ flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1834
+ }>;
1835
+ /**
1836
+ * Create a new repository with the given model.
1837
+ */
1838
+ repo<M extends Model>(model: Constructor<M>): Repository<M>;
1839
+ repo<R extends Repository<any>>(repository: Constructor<R>): R;
1840
+ /**
1841
+ * Create a new Query instance.
1842
+ */
1843
+ query(): Query<M>;
1844
+ /**
1845
+ * Create a new Query instance.
1846
+ */
1847
+ cache(): WeakCache<string, M[]> | undefined;
1848
+ /**
1849
+ * Add a basic where clause to the query.
1850
+ */
1851
+ where(field: WherePrimaryClosure | string, value?: WhereSecondaryClosure | any): Query<M>;
1852
+ /**
1853
+ * Add an "or where" clause to the query.
1854
+ */
1855
+ orWhere(field: WherePrimaryClosure | string, value?: WhereSecondaryClosure | any): Query<M>;
1856
+ /**
1857
+ * Add a "where has" clause to the query.
1858
+ */
1859
+ whereHas(relation: string, callback?: EagerLoadConstraint, operator?: string | number, count?: number): Query<M>;
1860
+ /**
1861
+ * Add an "or where has" clause to the query.
1862
+ */
1863
+ orWhereHas(relation: string, callback?: EagerLoadConstraint, operator?: string | number, count?: number): Query<M>;
1864
+ /**
1865
+ * Add a "has" clause to the query.
1866
+ */
1867
+ has(relation: string, operator?: string | number, count?: number): Query<M>;
1868
+ /**
1869
+ * Add an "or has" clause to the query.
1870
+ */
1871
+ orHas(relation: string, operator?: string | number, count?: number): Query<M>;
1872
+ /**
1873
+ * Add a "doesn't have" clause to the query.
1874
+ */
1875
+ doesntHave(relation: string): Query<M>;
1876
+ /**
1877
+ * Add a "doesn't have" clause to the query.
1878
+ */
1879
+ orDoesntHave(relation: string): Query<M>;
1880
+ /**
1881
+ * Add a "where doesn't have" clause to the query.
1882
+ */
1883
+ whereDoesntHave(relation: string, callback?: EagerLoadConstraint): Query<M>;
1884
+ /**
1885
+ * Add an "or where doesn't have" clause to the query.
1886
+ */
1887
+ orWhereDoesntHave(relation: string, callback?: EagerLoadConstraint): Query<M>;
1888
+ /**
1889
+ * Make meta field visible
1890
+ */
1891
+ withMeta(): Query<M>;
1892
+ /**
1893
+ * Make hidden fields visible
1894
+ */
1895
+ makeVisible(fields: string[]): Query<M>;
1896
+ /**
1897
+ * Make visible fields hidden
1898
+ */
1899
+ makeHidden(fields: string[]): Query<M>;
1900
+ /**
1901
+ * Add a "group by" clause to the query.
1902
+ */
1903
+ groupBy(...fields: GroupByFields): Query<M>;
1904
+ /**
1905
+ * Add an "order by" clause to the query.
1906
+ */
1907
+ orderBy(field: OrderBy, direction?: OrderDirection): Query<M>;
1908
+ /**
1909
+ * Set the "limit" value of the query.
1910
+ */
1911
+ limit(value: number): Query<M>;
1912
+ /**
1913
+ * Set the "offset" value of the query.
1914
+ */
1915
+ offset(value: number): Query<M>;
1916
+ /**
1917
+ * Set the relationships that should be eager loaded.
1918
+ */
1919
+ with(name: string, callback?: EagerLoadConstraint): Query<M>;
1920
+ /**
1921
+ * Set to eager load all top-level relationships. Constraint is set for all relationships.
1922
+ */
1923
+ withAll(callback?: EagerLoadConstraint): Query<M>;
1924
+ /**
1925
+ * Set to eager load all top-level relationships. Constraint is set for all relationships.
1926
+ */
1927
+ withAllRecursive(depth?: number): Query<M>;
1928
+ /**
1929
+ * Define to use the cache for a query
1930
+ */
1931
+ useCache(key?: string, params?: Record<string, any>): Query<M>;
1932
+ /**
1933
+ * Get all models from the store.
1934
+ */
1935
+ all(): Collection<M>;
1936
+ /**
1937
+ * Find the model with the given id.
1938
+ */
1939
+ find(id: string | number): Item<M>;
1940
+ find(ids: (string | number)[]): Collection<M>;
1941
+ /**
1942
+ * Retrieves the models from the store by following the given
1943
+ * normalized schema.
1944
+ */
1945
+ revive(schema: Element[]): Collection<M>;
1946
+ revive(schema: Element): Item<M>;
1947
+ /**
1948
+ * Create a new model instance. This method will not save the model to the
1949
+ * store. It's pretty much the alternative to `new Model()`, but it injects
1950
+ * the store instance to support model instance methods in SSR environment.
1951
+ */
1952
+ make(records: Element[]): M[];
1953
+ make(record?: Element): M;
1954
+ save(records: Element[]): M[];
1955
+ save(record: Element): M;
1956
+ /**
1957
+ * Create and persist model with default values.
1958
+ */
1959
+ new(persist?: boolean): M | null;
1960
+ /**
1961
+ * Insert the given records to the store.
1962
+ */
1963
+ insert(records: Element[]): Collection<M>;
1964
+ insert(record: Element): M;
1965
+ /**
1966
+ * Insert the given records to the store by replacing any existing records.
1967
+ */
1968
+ fresh(records: Element[]): Collection<M>;
1969
+ fresh(record: Element): M;
1970
+ /**
1971
+ * Destroy the models for the given id.
1972
+ */
1973
+ destroy(ids: (string | number)[]): Collection<M>;
1974
+ destroy(id: string | number): Item<M>;
1975
+ /**
1976
+ * Delete all records in the store.
1977
+ */
1978
+ flush(): M[];
1979
+ }
1980
+
1981
+ export { CastAttribute as $, type AfterHook as A, type BeforeHook as B, type Constructor as C, type DataStore as D, type Elements as E, type FilledInstallOptions as F, type GroupedCollection as G, Relation as H, type Item as I, BelongsTo as J, BelongsToMany as K, HasMany as L, Model as M, type NormalizedData as N, HasOne as O, type PiniaOrmPluginContext as P, Query as Q, Repository as R, type Schemas as S, HasManyBy as T, HasManyThrough as U, MorphMany as V, WeakCache as W, MorphTo as X, MorphToMany as Y, MorphOne as Z, type Casts as _, type Element as a, type TypeDefault as a0, Type as a1, Interpreter as a2, type Where as a3, type WherePrimaryClosure as a4, type WhereSecondaryClosure as a5, type WhereGroup as a6, type Order as a7, type Group as a8, type OrderBy as a9, type GroupBy as aa, type GroupByFields as ab, type OrderDirection as ac, type EagerLoad as ad, type EagerLoadConstraint as ae, type PropertyDecorator as af, type TypeOptions as ag, type UidOptions as ah, type Mutator as ai, type NanoidOptions as aj, type Collection as b, type DataStoreState as c, type PiniaOrmPlugin as d, definePiniaOrmPlugin as e, type ModelConfigOptions as f, type CacheConfigOptions as g, type InstallOptions as h, type CreatePiniaOrm as i, createORM as j, Database as k, Schema as l, type ModelFields as m, type ModelSchemas as n, type ModelRegistries as o, plugins as p, type ModelRegistry as q, registerPlugins as r, type PrimaryKey as s, type ModelOptions as t, useDataStore as u, type MetaValues as v, type InheritanceTypes as w, Attribute as x, type Dictionary as y, type deleteModes as z };