remult 0.23.0-exp.1 → 0.23.0-exp.2
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/remult-knex/index.js +1 -0
- package/esm/remult-mongo.d.ts +1 -1
- package/esm/remult-mongo.js +4 -2
- package/esm/src/remult3/remult3.d.ts +1 -1
- package/esm/src/resultCompoundIdFilter.d.ts +1 -1
- package/package.json +1 -1
- package/remult-knex/index.js +1 -1
- package/remult-mongo.d.ts +1 -1
- package/remult-mongo.js +6 -3
- package/src/remult3/remult3.d.ts +1 -1
- package/src/resultCompoundIdFilter.d.ts +1 -1
package/esm/remult-knex/index.js
CHANGED
package/esm/remult-mongo.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { RepositoryOverloads } from './src/remult3/RepositoryImplementation
|
|
|
4
4
|
export declare class MongoDataProvider implements DataProvider {
|
|
5
5
|
private db;
|
|
6
6
|
private client;
|
|
7
|
-
constructor(db: Db, client: MongoClient, options?: {
|
|
7
|
+
constructor(db: Db, client: MongoClient | undefined, options?: {
|
|
8
8
|
session?: ClientSession;
|
|
9
9
|
disableTransactions?: boolean;
|
|
10
10
|
});
|
package/esm/remult-mongo.js
CHANGED
|
@@ -10,7 +10,7 @@ export class MongoDataProvider {
|
|
|
10
10
|
this.db = db;
|
|
11
11
|
this.client = client;
|
|
12
12
|
this.session = options?.session;
|
|
13
|
-
this.disableTransactions = options?.disableTransactions;
|
|
13
|
+
this.disableTransactions = Boolean(options?.disableTransactions);
|
|
14
14
|
}
|
|
15
15
|
session;
|
|
16
16
|
disableTransactions = false;
|
|
@@ -28,6 +28,8 @@ export class MongoDataProvider {
|
|
|
28
28
|
await action(this);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
+
if (!this.client)
|
|
32
|
+
throw new Error("Can't use transactions within transactions");
|
|
31
33
|
let session = await this.client.startSession();
|
|
32
34
|
session.startTransaction();
|
|
33
35
|
const db = this.client.db(this.db.databaseName);
|
|
@@ -198,7 +200,7 @@ class FilterConsumerBridgeToMongo {
|
|
|
198
200
|
f._addWhere = false;
|
|
199
201
|
element.__applyToConsumer(f);
|
|
200
202
|
let where = await f.resolveWhere();
|
|
201
|
-
if (where?.$and?.length
|
|
203
|
+
if (where?.$and?.length) {
|
|
202
204
|
result.push(where);
|
|
203
205
|
}
|
|
204
206
|
else
|
|
@@ -414,7 +414,7 @@ export type RelationOptionsBase<fromEntity, toEntity, optionsType extends LoadOp
|
|
|
414
414
|
} & FieldOptions<fromEntity, toEntity>;
|
|
415
415
|
export type ObjectMembersOnly<T> = {
|
|
416
416
|
[K in keyof Pick<T, {
|
|
417
|
-
[K in keyof T]: T[K] extends object ? T[K] extends Date ? never : K : never;
|
|
417
|
+
[K in keyof T]: T[K] extends object | undefined | null ? T[K] extends Date | undefined | null ? never : K : never;
|
|
418
418
|
}[keyof T]>]: T[K];
|
|
419
419
|
};
|
|
420
420
|
export type MembersToInclude<T> = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CompoundIdField } from './CompoundIdField';
|
|
2
2
|
import { Filter } from './filter/filter-interfaces';
|
|
3
|
-
export declare function resultCompoundIdFilter(idField: CompoundIdField, id: string, data: any): Filter;
|
|
3
|
+
export declare function resultCompoundIdFilter(idField: CompoundIdField, id: string | undefined, data: any): Filter;
|
package/package.json
CHANGED
package/remult-knex/index.js
CHANGED
package/remult-mongo.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { RepositoryOverloads } from './src/remult3/RepositoryImplementation
|
|
|
4
4
|
export declare class MongoDataProvider implements DataProvider {
|
|
5
5
|
private db;
|
|
6
6
|
private client;
|
|
7
|
-
constructor(db: Db, client: MongoClient, options?: {
|
|
7
|
+
constructor(db: Db, client: MongoClient | undefined, options?: {
|
|
8
8
|
session?: ClientSession;
|
|
9
9
|
disableTransactions?: boolean;
|
|
10
10
|
});
|
package/remult-mongo.js
CHANGED
|
@@ -13,7 +13,7 @@ var MongoDataProvider = /** @class */ (function () {
|
|
|
13
13
|
this.client = client;
|
|
14
14
|
this.disableTransactions = false;
|
|
15
15
|
this.session = options === null || options === void 0 ? void 0 : options.session;
|
|
16
|
-
this.disableTransactions = options === null || options === void 0 ? void 0 : options.disableTransactions;
|
|
16
|
+
this.disableTransactions = Boolean(options === null || options === void 0 ? void 0 : options.disableTransactions);
|
|
17
17
|
}
|
|
18
18
|
MongoDataProvider.getDb = function (remult) {
|
|
19
19
|
var r = (remult || remult_proxy_1.remult).dataProvider;
|
|
@@ -35,7 +35,10 @@ var MongoDataProvider = /** @class */ (function () {
|
|
|
35
35
|
case 1:
|
|
36
36
|
_a.sent();
|
|
37
37
|
return [3 /*break*/, 11];
|
|
38
|
-
case 2:
|
|
38
|
+
case 2:
|
|
39
|
+
if (!this.client)
|
|
40
|
+
throw new Error("Can't use transactions within transactions");
|
|
41
|
+
return [4 /*yield*/, this.client.startSession()];
|
|
39
42
|
case 3:
|
|
40
43
|
session = _a.sent();
|
|
41
44
|
session.startTransaction();
|
|
@@ -417,7 +420,7 @@ var FilterConsumerBridgeToMongo = /** @class */ (function () {
|
|
|
417
420
|
return [4 /*yield*/, f.resolveWhere()];
|
|
418
421
|
case 3:
|
|
419
422
|
where = _c.sent();
|
|
420
|
-
if ((
|
|
423
|
+
if ((_b = where === null || where === void 0 ? void 0 : where.$and) === null || _b === void 0 ? void 0 : _b.length) {
|
|
421
424
|
result.push(where);
|
|
422
425
|
}
|
|
423
426
|
else
|
package/src/remult3/remult3.d.ts
CHANGED
|
@@ -414,7 +414,7 @@ export type RelationOptionsBase<fromEntity, toEntity, optionsType extends LoadOp
|
|
|
414
414
|
} & FieldOptions<fromEntity, toEntity>;
|
|
415
415
|
export type ObjectMembersOnly<T> = {
|
|
416
416
|
[K in keyof Pick<T, {
|
|
417
|
-
[K in keyof T]: T[K] extends object ? T[K] extends Date ? never : K : never;
|
|
417
|
+
[K in keyof T]: T[K] extends object | undefined | null ? T[K] extends Date | undefined | null ? never : K : never;
|
|
418
418
|
}[keyof T]>]: T[K];
|
|
419
419
|
};
|
|
420
420
|
export type MembersToInclude<T> = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CompoundIdField } from './CompoundIdField';
|
|
2
2
|
import { Filter } from './filter/filter-interfaces';
|
|
3
|
-
export declare function resultCompoundIdFilter(idField: CompoundIdField, id: string, data: any): Filter;
|
|
3
|
+
export declare function resultCompoundIdFilter(idField: CompoundIdField, id: string | undefined, data: any): Filter;
|