pinia-orm-edge 1.10.0-28586201.60fc813 → 1.10.0-28683029.86bd359

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.
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.cjs';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.cjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  /**
7
7
  * Create a cast nanoid/async.
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.mjs';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.mjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  /**
7
7
  * Create a cast nanoid/async.
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.js';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.js';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  /**
7
7
  * Create a cast nanoid/async.
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.cjs';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.cjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class UidCast extends CastAttribute {
7
7
  static parameters?: NanoidOptions;
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.mjs';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.mjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class UidCast extends CastAttribute {
7
7
  static parameters?: NanoidOptions;
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.js';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.js';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class UidCast extends CastAttribute {
7
7
  static parameters?: NanoidOptions;
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.cjs';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.cjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class UidCast extends CastAttribute {
7
7
  static parameters?: NanoidOptions;
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.mjs';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.mjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class UidCast extends CastAttribute {
7
7
  static parameters?: NanoidOptions;
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.js';
1
+ import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.js';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class UidCast extends CastAttribute {
7
7
  static parameters?: NanoidOptions;
@@ -1,7 +1,7 @@
1
1
  import * as pinia from 'pinia';
2
2
  import { PiniaPlugin, Pinia, DefineStoreOptionsBase } from 'pinia';
3
- import { schema, Schema as Schema$1 } from '@pinia-orm/normalizr';
4
3
  import * as __composables from '@/composables';
4
+ import { schema, Schema as Schema$1 } from '@pinia-orm/normalizr';
5
5
 
6
6
  interface Constructor<T> {
7
7
  new (...args: any[]): T;
@@ -101,9 +101,9 @@ declare abstract class Attribute {
101
101
  type TypeDefault<T> = T | null | (() => T | null);
102
102
  declare abstract class Type extends Attribute {
103
103
  /**
104
- * The default value for the attribute.
104
+ * The raw default value for the attribute (can be a function).
105
105
  */
106
- value: any;
106
+ rawDefaultValue: any;
107
107
  /**
108
108
  * Whether the attribute accepts `null` value or not.
109
109
  */
@@ -111,7 +111,11 @@ declare abstract class Type extends Attribute {
111
111
  /**
112
112
  * Create a new Type attribute instance.
113
113
  */
114
- constructor(model: Model, value?: TypeDefault<any>);
114
+ constructor(model: Model, defaultValue?: TypeDefault<any>);
115
+ /**
116
+ * The computed default value of the attribute.
117
+ */
118
+ get defaultValue(): any;
115
119
  /**
116
120
  * Set the nullable option to false.
117
121
  */
@@ -1516,6 +1520,10 @@ declare class Model {
1516
1520
  * Create a new MorphToMany relation instance.
1517
1521
  */
1518
1522
  static morphToMany(related: typeof Model, pivot: typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): MorphToMany;
1523
+ /**
1524
+ * Create a new MorphedByMany relation instance.
1525
+ */
1526
+ static morphedByMany(related: typeof Model, pivot: typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): MorphToMany;
1519
1527
  /**
1520
1528
  * Create a new HasMany relation instance.
1521
1529
  */
@@ -1752,9 +1760,7 @@ declare class Model {
1752
1760
  /**
1753
1761
  * Serialize the given object to JSON.
1754
1762
  */
1755
- protected serializeObject(value: {
1756
- [index: string]: number | string;
1757
- }): object;
1763
+ protected serializeObject(value: any): object;
1758
1764
  /**
1759
1765
  * Serialize the given relation to JSON.
1760
1766
  */
@@ -1773,18 +1779,14 @@ type Item<M extends Model = Model> = M | null;
1773
1779
  type Collection<M extends Model = Model> = M[];
1774
1780
  type GroupedCollection<M extends Model = Model> = Record<string, M[]>;
1775
1781
 
1776
- interface ModelConstructor<M extends Model> extends Constructor<M> {
1777
- newRawInstance(): M;
1778
- }
1779
-
1780
1782
  declare function useDataStore<S extends DataStoreState, T extends DataStore = DataStore>(id: string, options: DefineStoreOptionsBase<S, T>, query?: Query<any>): pinia.StoreDefinition<string, S, {}, {
1781
- save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1782
- insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1783
- update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1784
- fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1785
- destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1786
- delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1787
- flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1783
+ save(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1784
+ insert(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1785
+ update(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1786
+ fresh(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1787
+ destroy(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1788
+ delete(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1789
+ flush(this: DataStore, _records?: Elements, triggerQueryAction?: boolean): void;
1788
1790
  }>;
1789
1791
  interface DataStoreState {
1790
1792
  data: Record<string, any>;
@@ -1792,6 +1794,41 @@ interface DataStoreState {
1792
1794
  }
1793
1795
  type DataStore = ReturnType<typeof __composables['useDataStore']>;
1794
1796
 
1797
+ interface ModelConstructor<M extends Model> extends Constructor<M> {
1798
+ newRawInstance(): M;
1799
+ }
1800
+
1801
+ interface Repository<M extends Model = Model> {
1802
+ /**
1803
+ * Add a where clause where `field` value is in values.
1804
+ */
1805
+ whereIn(field: string, values: any[] | Set<any>): Query<M>;
1806
+ /**
1807
+ * Add a where clause where `field` value is in values or ...
1808
+ */
1809
+ orWhereIn(field: string, values: any[] | Set<any>): Query<M>;
1810
+ /**
1811
+ * Add a where clause where `field` value is not in values or ...
1812
+ */
1813
+ orWhereNotIn(field: string, values: any[] | Set<any>): Query<M>;
1814
+ /**
1815
+ * Add a where clause where `field` has not defined values
1816
+ */
1817
+ whereNotIn(field: string, values: any[] | Set<any>): Query<M>;
1818
+ /**
1819
+ * Add a where clause to get all results where `field` is null
1820
+ */
1821
+ whereNull(field: string): Query<M>;
1822
+ /**
1823
+ * Add a where clause to get all results where `field` is not null
1824
+ */
1825
+ whereNotNull(field: string): Query<M>;
1826
+ /**
1827
+ * Find the model with the given id.
1828
+ */
1829
+ find(id: string | number): Item<M>;
1830
+ find(ids: (string | number)[]): Collection<M>;
1831
+ }
1795
1832
  declare class Repository<M extends Model = Model> {
1796
1833
  [index: string]: any;
1797
1834
  /**
@@ -1864,13 +1901,13 @@ declare class Repository<M extends Model = Model> {
1864
1901
  * Returns the pinia store used with this model
1865
1902
  */
1866
1903
  piniaStore<S extends DataStoreState = DataStoreState>(): pinia.Store<string, S, {}, {
1867
- save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1868
- insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1869
- update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1870
- fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1871
- destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1872
- delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1873
- flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1904
+ save(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1905
+ insert(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1906
+ update(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1907
+ fresh(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1908
+ destroy(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1909
+ delete(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1910
+ flush(this: DataStore, _records?: Elements, triggerQueryAction?: boolean): void;
1874
1911
  }>;
1875
1912
  /**
1876
1913
  * Create a new repository with the given model.
@@ -1,7 +1,7 @@
1
1
  import * as pinia from 'pinia';
2
2
  import { PiniaPlugin, Pinia, DefineStoreOptionsBase } from 'pinia';
3
- import { schema, Schema as Schema$1 } from '@pinia-orm/normalizr';
4
3
  import * as __composables from '@/composables';
4
+ import { schema, Schema as Schema$1 } from '@pinia-orm/normalizr';
5
5
 
6
6
  interface Constructor<T> {
7
7
  new (...args: any[]): T;
@@ -101,9 +101,9 @@ declare abstract class Attribute {
101
101
  type TypeDefault<T> = T | null | (() => T | null);
102
102
  declare abstract class Type extends Attribute {
103
103
  /**
104
- * The default value for the attribute.
104
+ * The raw default value for the attribute (can be a function).
105
105
  */
106
- value: any;
106
+ rawDefaultValue: any;
107
107
  /**
108
108
  * Whether the attribute accepts `null` value or not.
109
109
  */
@@ -111,7 +111,11 @@ declare abstract class Type extends Attribute {
111
111
  /**
112
112
  * Create a new Type attribute instance.
113
113
  */
114
- constructor(model: Model, value?: TypeDefault<any>);
114
+ constructor(model: Model, defaultValue?: TypeDefault<any>);
115
+ /**
116
+ * The computed default value of the attribute.
117
+ */
118
+ get defaultValue(): any;
115
119
  /**
116
120
  * Set the nullable option to false.
117
121
  */
@@ -1516,6 +1520,10 @@ declare class Model {
1516
1520
  * Create a new MorphToMany relation instance.
1517
1521
  */
1518
1522
  static morphToMany(related: typeof Model, pivot: typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): MorphToMany;
1523
+ /**
1524
+ * Create a new MorphedByMany relation instance.
1525
+ */
1526
+ static morphedByMany(related: typeof Model, pivot: typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): MorphToMany;
1519
1527
  /**
1520
1528
  * Create a new HasMany relation instance.
1521
1529
  */
@@ -1752,9 +1760,7 @@ declare class Model {
1752
1760
  /**
1753
1761
  * Serialize the given object to JSON.
1754
1762
  */
1755
- protected serializeObject(value: {
1756
- [index: string]: number | string;
1757
- }): object;
1763
+ protected serializeObject(value: any): object;
1758
1764
  /**
1759
1765
  * Serialize the given relation to JSON.
1760
1766
  */
@@ -1773,18 +1779,14 @@ type Item<M extends Model = Model> = M | null;
1773
1779
  type Collection<M extends Model = Model> = M[];
1774
1780
  type GroupedCollection<M extends Model = Model> = Record<string, M[]>;
1775
1781
 
1776
- interface ModelConstructor<M extends Model> extends Constructor<M> {
1777
- newRawInstance(): M;
1778
- }
1779
-
1780
1782
  declare function useDataStore<S extends DataStoreState, T extends DataStore = DataStore>(id: string, options: DefineStoreOptionsBase<S, T>, query?: Query<any>): pinia.StoreDefinition<string, S, {}, {
1781
- save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1782
- insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1783
- update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1784
- fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1785
- destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1786
- delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1787
- flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1783
+ save(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1784
+ insert(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1785
+ update(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1786
+ fresh(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1787
+ destroy(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1788
+ delete(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1789
+ flush(this: DataStore, _records?: Elements, triggerQueryAction?: boolean): void;
1788
1790
  }>;
1789
1791
  interface DataStoreState {
1790
1792
  data: Record<string, any>;
@@ -1792,6 +1794,41 @@ interface DataStoreState {
1792
1794
  }
1793
1795
  type DataStore = ReturnType<typeof __composables['useDataStore']>;
1794
1796
 
1797
+ interface ModelConstructor<M extends Model> extends Constructor<M> {
1798
+ newRawInstance(): M;
1799
+ }
1800
+
1801
+ interface Repository<M extends Model = Model> {
1802
+ /**
1803
+ * Add a where clause where `field` value is in values.
1804
+ */
1805
+ whereIn(field: string, values: any[] | Set<any>): Query<M>;
1806
+ /**
1807
+ * Add a where clause where `field` value is in values or ...
1808
+ */
1809
+ orWhereIn(field: string, values: any[] | Set<any>): Query<M>;
1810
+ /**
1811
+ * Add a where clause where `field` value is not in values or ...
1812
+ */
1813
+ orWhereNotIn(field: string, values: any[] | Set<any>): Query<M>;
1814
+ /**
1815
+ * Add a where clause where `field` has not defined values
1816
+ */
1817
+ whereNotIn(field: string, values: any[] | Set<any>): Query<M>;
1818
+ /**
1819
+ * Add a where clause to get all results where `field` is null
1820
+ */
1821
+ whereNull(field: string): Query<M>;
1822
+ /**
1823
+ * Add a where clause to get all results where `field` is not null
1824
+ */
1825
+ whereNotNull(field: string): Query<M>;
1826
+ /**
1827
+ * Find the model with the given id.
1828
+ */
1829
+ find(id: string | number): Item<M>;
1830
+ find(ids: (string | number)[]): Collection<M>;
1831
+ }
1795
1832
  declare class Repository<M extends Model = Model> {
1796
1833
  [index: string]: any;
1797
1834
  /**
@@ -1864,13 +1901,13 @@ declare class Repository<M extends Model = Model> {
1864
1901
  * Returns the pinia store used with this model
1865
1902
  */
1866
1903
  piniaStore<S extends DataStoreState = DataStoreState>(): pinia.Store<string, S, {}, {
1867
- save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1868
- insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1869
- update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1870
- fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1871
- destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1872
- delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1873
- flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1904
+ save(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1905
+ insert(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1906
+ update(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1907
+ fresh(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1908
+ destroy(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1909
+ delete(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1910
+ flush(this: DataStore, _records?: Elements, triggerQueryAction?: boolean): void;
1874
1911
  }>;
1875
1912
  /**
1876
1913
  * Create a new repository with the given model.
@@ -1,7 +1,7 @@
1
1
  import * as pinia from 'pinia';
2
2
  import { PiniaPlugin, Pinia, DefineStoreOptionsBase } from 'pinia';
3
- import { schema, Schema as Schema$1 } from '@pinia-orm/normalizr';
4
3
  import * as __composables from '@/composables';
4
+ import { schema, Schema as Schema$1 } from '@pinia-orm/normalizr';
5
5
 
6
6
  interface Constructor<T> {
7
7
  new (...args: any[]): T;
@@ -101,9 +101,9 @@ declare abstract class Attribute {
101
101
  type TypeDefault<T> = T | null | (() => T | null);
102
102
  declare abstract class Type extends Attribute {
103
103
  /**
104
- * The default value for the attribute.
104
+ * The raw default value for the attribute (can be a function).
105
105
  */
106
- value: any;
106
+ rawDefaultValue: any;
107
107
  /**
108
108
  * Whether the attribute accepts `null` value or not.
109
109
  */
@@ -111,7 +111,11 @@ declare abstract class Type extends Attribute {
111
111
  /**
112
112
  * Create a new Type attribute instance.
113
113
  */
114
- constructor(model: Model, value?: TypeDefault<any>);
114
+ constructor(model: Model, defaultValue?: TypeDefault<any>);
115
+ /**
116
+ * The computed default value of the attribute.
117
+ */
118
+ get defaultValue(): any;
115
119
  /**
116
120
  * Set the nullable option to false.
117
121
  */
@@ -1516,6 +1520,10 @@ declare class Model {
1516
1520
  * Create a new MorphToMany relation instance.
1517
1521
  */
1518
1522
  static morphToMany(related: typeof Model, pivot: typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): MorphToMany;
1523
+ /**
1524
+ * Create a new MorphedByMany relation instance.
1525
+ */
1526
+ static morphedByMany(related: typeof Model, pivot: typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): MorphToMany;
1519
1527
  /**
1520
1528
  * Create a new HasMany relation instance.
1521
1529
  */
@@ -1752,9 +1760,7 @@ declare class Model {
1752
1760
  /**
1753
1761
  * Serialize the given object to JSON.
1754
1762
  */
1755
- protected serializeObject(value: {
1756
- [index: string]: number | string;
1757
- }): object;
1763
+ protected serializeObject(value: any): object;
1758
1764
  /**
1759
1765
  * Serialize the given relation to JSON.
1760
1766
  */
@@ -1773,18 +1779,14 @@ type Item<M extends Model = Model> = M | null;
1773
1779
  type Collection<M extends Model = Model> = M[];
1774
1780
  type GroupedCollection<M extends Model = Model> = Record<string, M[]>;
1775
1781
 
1776
- interface ModelConstructor<M extends Model> extends Constructor<M> {
1777
- newRawInstance(): M;
1778
- }
1779
-
1780
1782
  declare function useDataStore<S extends DataStoreState, T extends DataStore = DataStore>(id: string, options: DefineStoreOptionsBase<S, T>, query?: Query<any>): pinia.StoreDefinition<string, S, {}, {
1781
- save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1782
- insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1783
- update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1784
- fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1785
- destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1786
- delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1787
- flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1783
+ save(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1784
+ insert(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1785
+ update(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1786
+ fresh(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1787
+ destroy(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1788
+ delete(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1789
+ flush(this: DataStore, _records?: Elements, triggerQueryAction?: boolean): void;
1788
1790
  }>;
1789
1791
  interface DataStoreState {
1790
1792
  data: Record<string, any>;
@@ -1792,6 +1794,41 @@ interface DataStoreState {
1792
1794
  }
1793
1795
  type DataStore = ReturnType<typeof __composables['useDataStore']>;
1794
1796
 
1797
+ interface ModelConstructor<M extends Model> extends Constructor<M> {
1798
+ newRawInstance(): M;
1799
+ }
1800
+
1801
+ interface Repository<M extends Model = Model> {
1802
+ /**
1803
+ * Add a where clause where `field` value is in values.
1804
+ */
1805
+ whereIn(field: string, values: any[] | Set<any>): Query<M>;
1806
+ /**
1807
+ * Add a where clause where `field` value is in values or ...
1808
+ */
1809
+ orWhereIn(field: string, values: any[] | Set<any>): Query<M>;
1810
+ /**
1811
+ * Add a where clause where `field` value is not in values or ...
1812
+ */
1813
+ orWhereNotIn(field: string, values: any[] | Set<any>): Query<M>;
1814
+ /**
1815
+ * Add a where clause where `field` has not defined values
1816
+ */
1817
+ whereNotIn(field: string, values: any[] | Set<any>): Query<M>;
1818
+ /**
1819
+ * Add a where clause to get all results where `field` is null
1820
+ */
1821
+ whereNull(field: string): Query<M>;
1822
+ /**
1823
+ * Add a where clause to get all results where `field` is not null
1824
+ */
1825
+ whereNotNull(field: string): Query<M>;
1826
+ /**
1827
+ * Find the model with the given id.
1828
+ */
1829
+ find(id: string | number): Item<M>;
1830
+ find(ids: (string | number)[]): Collection<M>;
1831
+ }
1795
1832
  declare class Repository<M extends Model = Model> {
1796
1833
  [index: string]: any;
1797
1834
  /**
@@ -1864,13 +1901,13 @@ declare class Repository<M extends Model = Model> {
1864
1901
  * Returns the pinia store used with this model
1865
1902
  */
1866
1903
  piniaStore<S extends DataStoreState = DataStoreState>(): pinia.Store<string, S, {}, {
1867
- save(this: any, records: Elements, triggerQueryAction?: boolean): void;
1868
- insert(this: any, records: Elements, triggerQueryAction?: boolean): void;
1869
- update(this: any, records: Elements, triggerQueryAction?: boolean): void;
1870
- fresh(this: any, records: Elements, triggerQueryAction?: boolean): void;
1871
- destroy(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1872
- delete(this: any, ids: (string | number)[], triggerQueryAction?: boolean): void;
1873
- flush(this: any, _records?: Elements | undefined, triggerQueryAction?: boolean): void;
1904
+ save(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1905
+ insert(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1906
+ update(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1907
+ fresh(this: DataStore, records: Elements, triggerQueryAction?: boolean): void;
1908
+ destroy(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1909
+ delete(this: DataStore, ids: (string | number)[], triggerQueryAction?: boolean): void;
1910
+ flush(this: DataStore, _records?: Elements, triggerQueryAction?: boolean): void;
1874
1911
  }>;
1875
1912
  /**
1876
1913
  * Create a new repository with the given model.
@@ -1,8 +1,8 @@
1
1
  import { V1Options } from 'uuid';
2
- import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.cjs';
2
+ import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.cjs';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  declare class UidCast extends CastAttribute {
8
8
  static parameters?: V1Options;
@@ -1,8 +1,8 @@
1
1
  import { V1Options } from 'uuid';
2
- import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.mjs';
2
+ import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.mjs';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  declare class UidCast extends CastAttribute {
8
8
  static parameters?: V1Options;
package/dist/uuid/v1.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { V1Options } from 'uuid';
2
- import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.js';
2
+ import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.js';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  declare class UidCast extends CastAttribute {
8
8
  static parameters?: V1Options;
@@ -1,8 +1,8 @@
1
1
  import { V4Options } from 'uuid';
2
- import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.cjs';
2
+ import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.cjs';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  declare class UidCast extends CastAttribute {
8
8
  static parameters?: V4Options;
@@ -1,8 +1,8 @@
1
1
  import { V4Options } from 'uuid';
2
- import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.mjs';
2
+ import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.mjs';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  declare class UidCast extends CastAttribute {
8
8
  static parameters?: V4Options;
package/dist/uuid/v4.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { V4Options } from 'uuid';
2
- import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.f37062c8.js';
2
+ import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.52557866.js';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  declare class UidCast extends CastAttribute {
8
8
  static parameters?: V4Options;