remult 3.3.19-next.2 → 3.3.19-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/src/data-providers/in-memory-database.js +12 -1
- package/esm/src/data-providers/indexed-db-data-provider.js +34 -1
- package/esm/src/remult3/RepositoryImplementation.js +8 -0
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/data-interfaces.d.ts +7 -0
- package/src/data-providers/in-memory-database.d.ts +5 -2
- package/src/data-providers/in-memory-database.js +22 -1
- package/src/data-providers/indexed-db-data-provider.d.ts +24 -2
- package/src/data-providers/indexed-db-data-provider.js +72 -0
- package/src/remult3/RepositoryImplementation.d.ts +2 -2
- package/src/remult3/RepositoryImplementation.js +245 -211
- package/src/remult3/remult3.d.ts +15 -2
package/src/remult3/remult3.d.ts
CHANGED
|
@@ -554,11 +554,14 @@ export interface Repository<entityType> {
|
|
|
554
554
|
*/
|
|
555
555
|
save(item: Partial<MembersOnly<entityType>>[], options?: InsertOrUpdateOptions): Promise<entityType[]>;
|
|
556
556
|
save(item: Partial<MembersOnly<entityType>>, options?: InsertOrUpdateOptions): Promise<entityType>;
|
|
557
|
-
/**Insert an item or item[] to the data source
|
|
557
|
+
/**Insert an item or item[] to the data source.
|
|
558
|
+
* Arrays insert one-by-one by default. Pass `{ bulk: true }` for one provider statement/txn.
|
|
558
559
|
* @example
|
|
559
560
|
* await taskRepo.insert({title:"task a"})
|
|
560
561
|
* @example
|
|
561
562
|
* await taskRepo.insert([{title:"task a"}, {title:"task b", completed:true }])
|
|
563
|
+
* @example
|
|
564
|
+
* await taskRepo.insert([{title:"a"}, {title:"b"}], { bulk: true })
|
|
562
565
|
*/
|
|
563
566
|
insert(item: Partial<MembersOnly<entityType>>[], options?: InsertOrUpdateOptions): Promise<entityType[]>;
|
|
564
567
|
insert(item: Partial<MembersOnly<entityType>>, options?: InsertOrUpdateOptions): Promise<entityType>;
|
|
@@ -1198,7 +1201,17 @@ export declare type EntitySelectFields<entityType> = {
|
|
|
1198
1201
|
[Properties in keyof Partial<MembersOnly<entityType>>]?: boolean;
|
|
1199
1202
|
};
|
|
1200
1203
|
export declare type InsertOrUpdateOptions = {
|
|
1201
|
-
select
|
|
1204
|
+
select?: 'none';
|
|
1205
|
+
/**
|
|
1206
|
+
* One provider statement/txn (SQL multi-row `INSERT`, IDB one txn).
|
|
1207
|
+
*
|
|
1208
|
+
* Default / omitted (`false`): `insert([a,b,c])` inserts one-by-one so
|
|
1209
|
+
* `saving` and `Validators.unique` see prior rows in the same call.
|
|
1210
|
+
*
|
|
1211
|
+
* When `true`: all `saving` hooks run before any write; `Validators.unique`
|
|
1212
|
+
* / `count()` only see the DB, not siblings in the same array.
|
|
1213
|
+
*/
|
|
1214
|
+
bulk?: boolean;
|
|
1202
1215
|
};
|
|
1203
1216
|
export interface ClassFieldDecoratorContextStub<entityType, valueType> {
|
|
1204
1217
|
readonly access: {
|