remult 0.22.4 → 0.22.6
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/graphql.js +2 -1
- package/esm/remult-mongo.js +1 -1
- package/esm/src/backend-tests/backend-database-test-setup.backend-spec.js +11 -10
- package/esm/src/context.d.ts +6 -1
- package/esm/src/shared-tests/db-tests.db-tests.js +1 -1
- package/graphql.js +2 -1
- package/package.json +1 -1
- package/remult-mongo.js +1 -1
- package/src/backend-tests/backend-database-test-setup.backend-spec.js +11 -10
- package/src/context.d.ts +6 -1
- package/src/shared-tests/db-tests.db-tests.js +1 -1
package/esm/graphql.js
CHANGED
|
@@ -87,7 +87,7 @@ export function remultGraphql(options) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
if (whereType === 'String') {
|
|
90
|
-
for (const operator of ['
|
|
90
|
+
for (const operator of ['contains']) {
|
|
91
91
|
const field = {
|
|
92
92
|
key: operator,
|
|
93
93
|
value: whereType,
|
|
@@ -801,6 +801,7 @@ export function translateWhereToRestBody(fields, { where }) {
|
|
|
801
801
|
}
|
|
802
802
|
tr('nin', (x) => (result[field.key + '.ne'] = x));
|
|
803
803
|
tr('eq', (x) => (result[field.key] = x));
|
|
804
|
+
tr('contains', (x) => (result[field.key + '.contains'] = x));
|
|
804
805
|
}
|
|
805
806
|
}
|
|
806
807
|
if (where.OR) {
|
package/esm/remult-mongo.js
CHANGED
|
@@ -233,7 +233,7 @@ class FilterConsumerBridgeToMongo {
|
|
|
233
233
|
this.add(col, val, '$lt');
|
|
234
234
|
}
|
|
235
235
|
containsCaseInsensitive(col, val) {
|
|
236
|
-
|
|
236
|
+
this.add(col, val, '$regex');
|
|
237
237
|
// this.promises.push(col.getDbName().then(colName => {
|
|
238
238
|
// this.result.push(b => b.whereRaw(
|
|
239
239
|
// 'lower (' + colName + ") like lower ('%" + val.replace(/'/g, '\'\'') + "%')"));
|
|
@@ -64,16 +64,17 @@ export const mySqlTest = addDatabaseToTest(testKnexSqlImpl(Knex.default({
|
|
|
64
64
|
database: 'test',
|
|
65
65
|
},
|
|
66
66
|
}), 'mysql2'));
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
67
|
+
if (false)
|
|
68
|
+
addDatabaseToTest(testKnexSqlImpl(Knex.default({
|
|
69
|
+
client: 'mysql',
|
|
70
|
+
connection: {
|
|
71
|
+
user: 'root',
|
|
72
|
+
password: 'MASTERKEY',
|
|
73
|
+
host: '127.0.0.1',
|
|
74
|
+
database: 'test',
|
|
75
|
+
port: 3307,
|
|
76
|
+
},
|
|
77
|
+
}), 'mysql'));
|
|
77
78
|
let pg = createPostgresConnection();
|
|
78
79
|
export function testPostgresImplementation(key, what, focus = false) {
|
|
79
80
|
itWithFocus(key + ' - postgres', async () => {
|
package/esm/src/context.d.ts
CHANGED
|
@@ -8,11 +8,15 @@ export declare class RemultAsyncLocalStorage {
|
|
|
8
8
|
private readonly remultObjectStorage;
|
|
9
9
|
static enable(): void;
|
|
10
10
|
static disable(): void;
|
|
11
|
-
constructor(remultObjectStorage:
|
|
11
|
+
constructor(remultObjectStorage: myAsyncLocalStorage<Remult>);
|
|
12
12
|
run(remult: Remult, callback: VoidFunction): void;
|
|
13
13
|
getRemult(): Remult;
|
|
14
14
|
static instance: RemultAsyncLocalStorage;
|
|
15
15
|
}
|
|
16
|
+
declare type myAsyncLocalStorage<T> = {
|
|
17
|
+
run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
|
|
18
|
+
getStore(): T;
|
|
19
|
+
};
|
|
16
20
|
export declare function isBackend(): boolean;
|
|
17
21
|
export declare class Remult {
|
|
18
22
|
/**Return's a `Repository` of the specific entity type
|
|
@@ -127,3 +131,4 @@ export interface itemChange {
|
|
|
127
131
|
deleted: boolean;
|
|
128
132
|
}
|
|
129
133
|
export declare function doTransaction(remult: Remult, what: () => Promise<void>): Promise<void>;
|
|
134
|
+
export {};
|
|
@@ -919,7 +919,7 @@ testAll('test contains with names with casing', async ({ createEntity }) => {
|
|
|
919
919
|
let item = await r.findFirst({ firstName: { $contains: 'oa' } });
|
|
920
920
|
expect(item.firstName).toBe('noam');
|
|
921
921
|
}, false, {
|
|
922
|
-
exclude: [TestDbs.mongo
|
|
922
|
+
exclude: [TestDbs.mongo],
|
|
923
923
|
});
|
|
924
924
|
testAll('test live query storage', async (x) => {
|
|
925
925
|
await x.createEntity(LiveQueryStorageEntity);
|
package/graphql.js
CHANGED
|
@@ -117,7 +117,7 @@ function remultGraphql(options) {
|
|
|
117
117
|
}
|
|
118
118
|
if (whereType === 'String') {
|
|
119
119
|
try {
|
|
120
|
-
for (var _p = (e_4 = void 0, tslib_1.__values(['
|
|
120
|
+
for (var _p = (e_4 = void 0, tslib_1.__values(['contains'])), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
121
121
|
var operator = _q.value;
|
|
122
122
|
var field = {
|
|
123
123
|
key: operator,
|
|
@@ -926,6 +926,7 @@ function translateWhereToRestBody(fields, _a) {
|
|
|
926
926
|
}
|
|
927
927
|
tr('nin', function (x) { return (result[field.key + '.ne'] = x); });
|
|
928
928
|
tr('eq', function (x) { return (result[field.key] = x); });
|
|
929
|
+
tr('contains', function (x) { return (result[field.key + '.contains'] = x); });
|
|
929
930
|
}
|
|
930
931
|
};
|
|
931
932
|
try {
|
package/package.json
CHANGED
package/remult-mongo.js
CHANGED
|
@@ -481,7 +481,7 @@ var FilterConsumerBridgeToMongo = /** @class */ (function () {
|
|
|
481
481
|
this.add(col, val, '$lt');
|
|
482
482
|
};
|
|
483
483
|
FilterConsumerBridgeToMongo.prototype.containsCaseInsensitive = function (col, val) {
|
|
484
|
-
|
|
484
|
+
this.add(col, val, '$regex');
|
|
485
485
|
// this.promises.push(col.getDbName().then(colName => {
|
|
486
486
|
// this.result.push(b => b.whereRaw(
|
|
487
487
|
// 'lower (' + colName + ") like lower ('%" + val.replace(/'/g, '\'\'') + "%')"));
|
|
@@ -92,16 +92,17 @@ exports.mySqlTest = db_tests_setup_1.addDatabaseToTest(testKnexSqlImpl(Knex.defa
|
|
|
92
92
|
database: 'test',
|
|
93
93
|
},
|
|
94
94
|
}), 'mysql2'));
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
95
|
+
if (false)
|
|
96
|
+
db_tests_setup_1.addDatabaseToTest(testKnexSqlImpl(Knex.default({
|
|
97
|
+
client: 'mysql',
|
|
98
|
+
connection: {
|
|
99
|
+
user: 'root',
|
|
100
|
+
password: 'MASTERKEY',
|
|
101
|
+
host: '127.0.0.1',
|
|
102
|
+
database: 'test',
|
|
103
|
+
port: 3307,
|
|
104
|
+
},
|
|
105
|
+
}), 'mysql'));
|
|
105
106
|
var pg = postgres_1.createPostgresConnection();
|
|
106
107
|
function testPostgresImplementation(key, what, focus) {
|
|
107
108
|
var _this = this;
|
package/src/context.d.ts
CHANGED
|
@@ -8,11 +8,15 @@ export declare class RemultAsyncLocalStorage {
|
|
|
8
8
|
private readonly remultObjectStorage;
|
|
9
9
|
static enable(): void;
|
|
10
10
|
static disable(): void;
|
|
11
|
-
constructor(remultObjectStorage:
|
|
11
|
+
constructor(remultObjectStorage: myAsyncLocalStorage<Remult>);
|
|
12
12
|
run(remult: Remult, callback: VoidFunction): void;
|
|
13
13
|
getRemult(): Remult;
|
|
14
14
|
static instance: RemultAsyncLocalStorage;
|
|
15
15
|
}
|
|
16
|
+
declare type myAsyncLocalStorage<T> = {
|
|
17
|
+
run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
|
|
18
|
+
getStore(): T;
|
|
19
|
+
};
|
|
16
20
|
export declare function isBackend(): boolean;
|
|
17
21
|
export declare class Remult {
|
|
18
22
|
/**Return's a `Repository` of the specific entity type
|
|
@@ -127,3 +131,4 @@ export interface itemChange {
|
|
|
127
131
|
deleted: boolean;
|
|
128
132
|
}
|
|
129
133
|
export declare function doTransaction(remult: Remult, what: () => Promise<void>): Promise<void>;
|
|
134
|
+
export {};
|
|
@@ -2061,7 +2061,7 @@ db_tests_setup_1.testAll('test contains with names with casing', function (_a) {
|
|
|
2061
2061
|
});
|
|
2062
2062
|
});
|
|
2063
2063
|
}, false, {
|
|
2064
|
-
exclude: [db_tests_setup_1.TestDbs.mongo
|
|
2064
|
+
exclude: [db_tests_setup_1.TestDbs.mongo],
|
|
2065
2065
|
});
|
|
2066
2066
|
db_tests_setup_1.testAll('test live query storage', function (x) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
2067
2067
|
var s, entityKey, id;
|