remult 3.5.0-next.1 → 3.5.0-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/remult-knex/index.js +29 -6
- package/esm/server/remult-admin-html.js +6 -4
- package/esm/server/remult-admin.js +101 -7
- package/esm/server/remult-api-server.js +19 -8
- package/esm/src/buildRestDataProvider.js +4 -4
- package/esm/src/context.js +1 -1
- package/esm/src/data-providers/array-entity-data-provider.js +7 -7
- package/esm/src/data-providers/rest-data-provider-using-fetch.js +11 -4
- package/esm/src/data-providers/sql-database.js +2 -1
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +35 -4
- package/esm/src/filter/filter-interfaces.js +18 -4
- package/esm/src/remult-proxy.js +12 -0
- package/esm/src/remult-static.js +1 -0
- package/esm/src/remult3/RepositoryImplementation.js +25 -1
- package/esm/src/remult3/remult3.js +2 -0
- package/esm/src/server-action.js +43 -14
- package/index.d.ts +3 -2
- package/package.json +1 -1
- package/remult-knex/index.js +29 -6
- package/server/get-remult-admin-html.js +1 -1
- package/server/index.d.ts +2 -1
- package/server/remult-admin-html.js +6 -4
- package/server/remult-admin.d.ts +31 -2
- package/server/remult-admin.js +168 -19
- package/server/remult-api-server.d.ts +30 -0
- package/server/remult-api-server.js +46 -33
- package/src/buildRestDataProvider.d.ts +1 -1
- package/src/buildRestDataProvider.js +5 -5
- package/src/context.js +1 -1
- package/src/data-providers/array-entity-data-provider.js +7 -7
- package/src/data-providers/rest-data-provider-using-fetch.d.ts +1 -1
- package/src/data-providers/rest-data-provider-using-fetch.js +10 -3
- package/src/data-providers/sql-database.js +2 -1
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +8 -0
- package/src/filter/filter-consumer-bridge-to-sql-request.js +58 -19
- package/src/filter/filter-interfaces.js +19 -2
- package/src/remult-proxy.js +28 -0
- package/src/remult-static.d.ts +2 -0
- package/src/remult-static.js +1 -0
- package/src/remult3/RepositoryImplementation.d.ts +7 -0
- package/src/remult3/RepositoryImplementation.js +52 -1
- package/src/remult3/remult3.d.ts +65 -7
- package/src/remult3/remult3.js +2 -0
- package/src/server-action.d.ts +34 -2
- package/src/server-action.js +195 -115
|
@@ -53,6 +53,12 @@ export class RepositoryImplementation {
|
|
|
53
53
|
httpStatusCode: 404,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
_noMatchError() {
|
|
57
|
+
return {
|
|
58
|
+
message: `no row matches the filter in entity ${this.metadata.key}`,
|
|
59
|
+
httpStatusCode: 404,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
56
62
|
[getInternalKey]() {
|
|
57
63
|
return this;
|
|
58
64
|
}
|
|
@@ -1036,6 +1042,24 @@ export class RepositoryImplementation {
|
|
|
1036
1042
|
where: this.metadata.idMetadata.getIdFilter(id),
|
|
1037
1043
|
}, true);
|
|
1038
1044
|
}
|
|
1045
|
+
async findIdOrThrow(id, options) {
|
|
1046
|
+
const row = await this.findId(id, options);
|
|
1047
|
+
if (!row)
|
|
1048
|
+
throw new EntityError(this._notFoundError(id));
|
|
1049
|
+
return row;
|
|
1050
|
+
}
|
|
1051
|
+
async findFirstOrThrow(where, options) {
|
|
1052
|
+
const row = await this.findFirst(where, options);
|
|
1053
|
+
if (!row)
|
|
1054
|
+
throw new EntityError(this._noMatchError());
|
|
1055
|
+
return row;
|
|
1056
|
+
}
|
|
1057
|
+
async findOneOrThrow(options) {
|
|
1058
|
+
const row = await this.findOne(options);
|
|
1059
|
+
if (!row)
|
|
1060
|
+
throw new EntityError(this._noMatchError());
|
|
1061
|
+
return row;
|
|
1062
|
+
}
|
|
1039
1063
|
async _translateWhereToFilter(where) {
|
|
1040
1064
|
let safeWhere = where ?? {};
|
|
1041
1065
|
if (this._defaultFindOptions?.where) {
|
|
@@ -2310,7 +2334,7 @@ class EntityFullInfo {
|
|
|
2310
2334
|
: this.getEntityMetadataWithoutBreakingTheEntity(item).apiDeleteAllowed;
|
|
2311
2335
|
}
|
|
2312
2336
|
apiInsertAllowed(item) {
|
|
2313
|
-
if (this.options.
|
|
2337
|
+
if (this.options.allowApiInsert === undefined)
|
|
2314
2338
|
return false;
|
|
2315
2339
|
return !item
|
|
2316
2340
|
? this.remult.isAllowedForInstance(undefined, this.options.allowApiInsert)
|
|
@@ -22,6 +22,8 @@ export const flags = {
|
|
|
22
22
|
liveQueryKeepAliveMs: 30_000,
|
|
23
23
|
/** Version poll while SSE is stale */
|
|
24
24
|
liveQueryPollWhenStaleMs: 1_000,
|
|
25
|
+
/** Client calls reject with an `EntityError` instead of a plain object. On by default in the next major. */
|
|
26
|
+
clientErrorsAsEntityError: false,
|
|
25
27
|
};
|
|
26
28
|
/*p1 - issues in https://stackblitz.com/edit/demo-allow-delete-based-on-other-entity:
|
|
27
29
|
- don't like the ensure schema
|
package/esm/src/server-action.js
CHANGED
|
@@ -91,9 +91,9 @@ export class myServerAction extends Action {
|
|
|
91
91
|
await decideTransaction(remult, this.options, async () => {
|
|
92
92
|
if (!remult.isAllowedForInstance(undefined, this.options.allowed))
|
|
93
93
|
throw new ForbiddenError();
|
|
94
|
-
info.args = await prepareReceivedArgs(this.types(), info.args, remult, ds, res);
|
|
94
|
+
info.args = await prepareReceivedArgs(this.types(), await fromWire(info.args, remult, this.options, 'args'), remult, ds, res);
|
|
95
95
|
try {
|
|
96
|
-
result.data = await this.originalMethod(info.args);
|
|
96
|
+
result.data = await toWire(await this.originalMethod(info.args), remult, this.options, 'result');
|
|
97
97
|
}
|
|
98
98
|
catch (err) {
|
|
99
99
|
throw err;
|
|
@@ -151,13 +151,16 @@ export function BackendMethod(options) {
|
|
|
151
151
|
if (target.prototype !== undefined) {
|
|
152
152
|
// if types are undefined - you've forgot to set: "emitDecoratorMetadata":true
|
|
153
153
|
let serverAction = new myServerAction((options?.apiPrefix ? options.apiPrefix + '/' : '') + key, () => getTypes(), options, (args) => originalMethod.apply(undefined, args));
|
|
154
|
-
serverAction.doWork = async (args, self,
|
|
155
|
-
|
|
154
|
+
serverAction.doWork = async (args, self, caller) => {
|
|
155
|
+
const calling = caller ?? remult;
|
|
156
|
+
const url = calling.apiClient.url;
|
|
157
|
+
const http = buildRestDataProvider(calling.apiClient.httpClient);
|
|
158
|
+
const sent = await toWire(prepareArgsToSend(getTypes(), args), calling, options, 'args');
|
|
156
159
|
if (options.blockUser === false) {
|
|
157
|
-
return await remultStatic.actionInfo.runActionWithoutBlockingUI(async () => (await serverAction.run({ args }, url, http)).data);
|
|
160
|
+
return await remultStatic.actionInfo.runActionWithoutBlockingUI(async () => fromWire((await serverAction.run({ args: sent }, url, http)).data, calling, options, 'result'));
|
|
158
161
|
}
|
|
159
162
|
else
|
|
160
|
-
return (await serverAction.run({ args }, url, http)).data;
|
|
163
|
+
return fromWire((await serverAction.run({ args: sent }, url, http)).data, calling, options, 'result');
|
|
161
164
|
};
|
|
162
165
|
result = async function (...args) {
|
|
163
166
|
if (!isBackend()) {
|
|
@@ -194,10 +197,10 @@ export function BackendMethod(options) {
|
|
|
194
197
|
'/' +
|
|
195
198
|
(options?.apiPrefix ? options.apiPrefix + '/' : '') +
|
|
196
199
|
key, options ? (options.queue ?? false) : false, options.allowed, async (d, req, res) => {
|
|
197
|
-
d.args = d.args.map((x) => (isCustomUndefined(x) ? undefined : x));
|
|
198
200
|
let allowed = options.allowed;
|
|
199
201
|
try {
|
|
200
202
|
let remult = req;
|
|
203
|
+
d.args = (await fromWire(d.args, remult, options, 'args')).map((x) => (isCustomUndefined(x) ? undefined : x));
|
|
201
204
|
let r;
|
|
202
205
|
await decideTransaction(remult, options, async () => {
|
|
203
206
|
d.args = await prepareReceivedArgs(getTypes(), d.args, remult, remult.dataProvider, res);
|
|
@@ -217,8 +220,13 @@ export function BackendMethod(options) {
|
|
|
217
220
|
$and: [repo.metadata.options.apiPrefilter ?? {}],
|
|
218
221
|
},
|
|
219
222
|
});
|
|
223
|
+
// The client sent a stale row id, so this is a 400 even when
|
|
224
|
+
// defaultErrorStatus is 500.
|
|
220
225
|
if (rows.length != 1)
|
|
221
|
-
throw
|
|
226
|
+
throw {
|
|
227
|
+
message: 'not found or too many matches',
|
|
228
|
+
httpStatusCode: 400,
|
|
229
|
+
};
|
|
222
230
|
y = rows[0];
|
|
223
231
|
await repo.getEntityRef(y)._updateEntityBasedOnApi(rowInfo.data);
|
|
224
232
|
}
|
|
@@ -228,7 +236,7 @@ export function BackendMethod(options) {
|
|
|
228
236
|
await defs.__validateEntity();
|
|
229
237
|
try {
|
|
230
238
|
r = {
|
|
231
|
-
result: await originalMethod.apply(y, d.args),
|
|
239
|
+
result: await toWire(await originalMethod.apply(y, d.args), remult, options, 'result'),
|
|
232
240
|
rowInfo: {
|
|
233
241
|
data: await defs.toApiJson(),
|
|
234
242
|
isNewRow: defs.isNew(),
|
|
@@ -250,7 +258,7 @@ export function BackendMethod(options) {
|
|
|
250
258
|
await controllerRef.__validateEntity();
|
|
251
259
|
try {
|
|
252
260
|
r = {
|
|
253
|
-
result: await originalMethod.apply(y, d.args),
|
|
261
|
+
result: await toWire(await originalMethod.apply(y, d.args), remult, options, 'result'),
|
|
254
262
|
fields: await controllerRef.toApiJson(),
|
|
255
263
|
};
|
|
256
264
|
}
|
|
@@ -271,8 +279,11 @@ export function BackendMethod(options) {
|
|
|
271
279
|
});
|
|
272
280
|
}
|
|
273
281
|
},
|
|
274
|
-
doWork: async function (args, self,
|
|
275
|
-
|
|
282
|
+
doWork: async function (args, self, caller) {
|
|
283
|
+
const calling = caller ?? remult;
|
|
284
|
+
const baseUrl = calling.apiClient.url;
|
|
285
|
+
const http = buildRestDataProvider(calling.apiClient.httpClient);
|
|
286
|
+
args = await toWire(prepareArgsToSend(getTypes(), args), calling, options, 'args');
|
|
276
287
|
if (remultStatic.allEntities.includes(target.constructor)) {
|
|
277
288
|
let defs = getEntityRef(self);
|
|
278
289
|
await defs.__validateEntity();
|
|
@@ -296,7 +307,7 @@ export function BackendMethod(options) {
|
|
|
296
307
|
},
|
|
297
308
|
}, baseUrl, http);
|
|
298
309
|
await defs._updateResultsFromServerAction(r.rowInfo);
|
|
299
|
-
return r.result;
|
|
310
|
+
return fromWire(r.result, calling, options, 'result');
|
|
300
311
|
}
|
|
301
312
|
catch (err) {
|
|
302
313
|
throw defs.catchSaveErrors(err);
|
|
@@ -316,7 +327,7 @@ export function BackendMethod(options) {
|
|
|
316
327
|
fields: await defs.toApiJson(),
|
|
317
328
|
}, baseUrl, http);
|
|
318
329
|
await defs._updateEntityBasedOnApi(r.fields);
|
|
319
|
-
return r.result;
|
|
330
|
+
return fromWire(r.result, calling, options, 'result');
|
|
320
331
|
}
|
|
321
332
|
catch (e) {
|
|
322
333
|
throw defs.catchSaveErrors(e);
|
|
@@ -343,6 +354,12 @@ export function BackendMethod(options) {
|
|
|
343
354
|
return result;
|
|
344
355
|
};
|
|
345
356
|
}
|
|
357
|
+
Object.defineProperty(BackendMethod, 'serializer', {
|
|
358
|
+
get: () => remultStatic.backendMethodSerializer,
|
|
359
|
+
set: (value) => {
|
|
360
|
+
remultStatic.backendMethodSerializer = value;
|
|
361
|
+
},
|
|
362
|
+
});
|
|
346
363
|
const customUndefined = {
|
|
347
364
|
_isUndefined: true,
|
|
348
365
|
};
|
|
@@ -354,6 +371,18 @@ function registerAction(target, resultMethod) {
|
|
|
354
371
|
function isCustomUndefined(x) {
|
|
355
372
|
return x && x._isUndefined;
|
|
356
373
|
}
|
|
374
|
+
async function toWire(value, remult, options, part) {
|
|
375
|
+
const serializer = remultStatic.backendMethodSerializer;
|
|
376
|
+
return serializer
|
|
377
|
+
? serializer[part].serialize(value, { remult, options })
|
|
378
|
+
: value;
|
|
379
|
+
}
|
|
380
|
+
async function fromWire(value, remult, options, part) {
|
|
381
|
+
const serializer = remultStatic.backendMethodSerializer;
|
|
382
|
+
return serializer
|
|
383
|
+
? serializer[part].deserialize(value, { remult, options })
|
|
384
|
+
: value;
|
|
385
|
+
}
|
|
357
386
|
export class ProgressListener {
|
|
358
387
|
res;
|
|
359
388
|
constructor(res) {
|
package/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { ClassType } from './classType.js';
|
|
|
2
2
|
import type { DataProvider } from './src/data-interfaces.js';
|
|
3
3
|
export { ArrayEntityDataProvider } from './src/data-providers/array-entity-data-provider.js';
|
|
4
4
|
export type { ClassType } from './classType.js';
|
|
5
|
-
export type { ValidateFieldEvent, MembersOnly, NumericKeys, FieldsMetadata, FieldRef, IdFieldRef, FieldsRef, EntityMetadata, EntityOrderBy, EntityFilter, FindOptions, FindOptionsBase, QueryResult, QueryOptions, UpsertOptions, Repository, GroupByOptions, GroupByResult, FindFirstOptions, ComparisonValueFilter, ValueFilter, IdFilter, ContainsStringValueFilter, EntityRef, SortSegments, Paginator, LiveQuery, LiveQueryChangeInfo, Subscribable, RefSubscriber, RefSubscriberBase, RelationOptions, ObjectMembersOnly, MembersToInclude, RepositoryRelations, EntityIdFields, EntitySelectFields, InsertOrUpdateOptions, ClassFieldDecorator, ClassFieldDecoratorContextStub, //n1 consider removing in ts5
|
|
5
|
+
export type { ValidateFieldEvent, MembersOnly, NumericKeys, FieldsMetadata, FieldRef, IdFieldRef, FieldsRef, EntityMetadata, EntityOrderBy, EntityFilter, FindOptions, FindOptionsBase, QueryResult, QueryOptions, UpsertOptions, Repository, GroupByOptions, GroupByResult, FindFirstOptions, ComparisonValueFilter, ComparableTypes, ValueFilter, IdFilter, ContainsStringValueFilter, EntityRef, SortSegments, Paginator, LiveQuery, LiveQueryChangeInfo, Subscribable, RefSubscriber, RefSubscriberBase, RelationOptions, ObjectMembersOnly, MembersToInclude, RepositoryRelations, EntityIdFields, EntitySelectFields, InsertOrUpdateOptions, ClassFieldDecorator, ClassFieldDecoratorContextStub, //n1 consider removing in ts5
|
|
6
6
|
LifecycleEvent, FieldsRefBase, FieldsRefForEntityBase, RepositoryRelationsForEntityBase, ControllerRefForControllerBase, ControllerRefBase, ControllerRef, EntityRefForEntityBase, IdMetadata, FindFirstOptionsBase, } from './src/remult3/remult3.js';
|
|
7
|
+
export type { NotAField } from './src/remult3/remult3.js';
|
|
7
8
|
export { standardSchema } from './src/standard-schema/index.js';
|
|
8
9
|
export { EntityBase, ControllerBase, FieldType, getFields, ValueListFieldType, getValueList, ValueListInfo, } from './src/remult3/RepositoryImplementation.js';
|
|
9
10
|
export type { ValueListFieldOptions } from './src/remult3/RepositoryImplementation.js';
|
|
@@ -40,7 +41,7 @@ export { JsonEntityIndexedDbStorage } from './src/data-providers/json-entity-ind
|
|
|
40
41
|
export { IndexedDbDataProvider, IndexedDbIndexBuilder, } from './src/data-providers/indexed-db-data-provider.js';
|
|
41
42
|
export type { IndexedDbDataProviderOptions, IndexedDbIndexDef, } from './src/data-providers/indexed-db-data-provider.js';
|
|
42
43
|
export { Controller, BackendMethod, ProgressListener, ForbiddenError, } from './src/server-action.js';
|
|
43
|
-
export type { BackendMethodOptions } from './src/server-action.js';
|
|
44
|
+
export type { BackendMethodOptions, BackendMethodSerializer, BackendMethodSerializerContext, BackendMethodValueSerializer, } from './src/server-action.js';
|
|
44
45
|
export { Allow, Remult, withRemult, isBackend, EventSource, } from './src/context.js';
|
|
45
46
|
export type { Allowed, RemultContext, ApiClient, AllowedForInstance, EventDispatcher, UserInfo, } from './src/context.js';
|
|
46
47
|
export type { ExternalHttpProvider } from './src/buildRestDataProvider.js';
|
package/package.json
CHANGED
package/remult-knex/index.js
CHANGED
|
@@ -775,6 +775,7 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
775
775
|
this._addWhere = true;
|
|
776
776
|
this.promises = [];
|
|
777
777
|
this.result = [];
|
|
778
|
+
this.handleNull = new filter_consumer_bridge_to_sql_request_js_1.HandleNull();
|
|
778
779
|
}
|
|
779
780
|
FilterConsumerBridgeToKnexRequest.prototype.resolveWhere = function () {
|
|
780
781
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -824,12 +825,13 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
824
825
|
FilterConsumerBridgeToKnexRequest.prototype.or = function (orElements) {
|
|
825
826
|
var _this = this;
|
|
826
827
|
this.promises.push((function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
827
|
-
var result, _loop_2, this_1, orElements_1, orElements_1_1, element, state_1, e_11_1;
|
|
828
|
+
var result, branches, _loop_2, this_1, orElements_1, orElements_1_1, element, state_1, e_11_1;
|
|
828
829
|
var e_11, _a;
|
|
829
830
|
return tslib_1.__generator(this, function (_b) {
|
|
830
831
|
switch (_b.label) {
|
|
831
832
|
case 0:
|
|
832
833
|
result = [];
|
|
834
|
+
branches = new filter_consumer_bridge_to_sql_request_js_1.HandleNull();
|
|
833
835
|
_loop_2 = function (element) {
|
|
834
836
|
var f, where;
|
|
835
837
|
return tslib_1.__generator(this, function (_c) {
|
|
@@ -842,6 +844,7 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
842
844
|
case 1:
|
|
843
845
|
where = _c.sent();
|
|
844
846
|
if (where.length > 0) {
|
|
847
|
+
branches.add(f.handleNull);
|
|
845
848
|
result.push(function (b) {
|
|
846
849
|
b.orWhere(function (b) {
|
|
847
850
|
where.forEach(function (x) { return x(b); });
|
|
@@ -885,6 +888,7 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
885
888
|
return [7 /*endfinally*/];
|
|
886
889
|
case 8:
|
|
887
890
|
if (result.length > 0) {
|
|
891
|
+
this.handleNull.add(branches);
|
|
888
892
|
this.result.push(function (b) { return b.where(function (x) { return result.find(function (y) { return y(x); }); }); });
|
|
889
893
|
}
|
|
890
894
|
return [2 /*return*/];
|
|
@@ -906,14 +910,25 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
906
910
|
case 1:
|
|
907
911
|
where = _a.sent();
|
|
908
912
|
if (where.length > 0) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
913
|
+
if (f.handleNull.nullable) {
|
|
914
|
+
this.result.push(function (b) {
|
|
915
|
+
var nested = b.client.queryBuilder();
|
|
916
|
+
where.forEach(function (x) { return x(nested); });
|
|
917
|
+
var compiled = nested.toSQL();
|
|
918
|
+
var pred = compiled.sql.replace(/^select \* where /i, '');
|
|
919
|
+
b.whereRaw("case when (".concat(pred, ") then 0 else 1 end = 1"), compiled.bindings);
|
|
912
920
|
});
|
|
913
|
-
}
|
|
921
|
+
}
|
|
922
|
+
else {
|
|
923
|
+
this.result.push(function (b) {
|
|
924
|
+
b.whereNot(function (x) {
|
|
925
|
+
where.forEach(function (w) { return w(x); });
|
|
926
|
+
});
|
|
927
|
+
});
|
|
928
|
+
}
|
|
914
929
|
}
|
|
915
930
|
else
|
|
916
|
-
|
|
931
|
+
this.result.push(function (b) { return b.whereRaw('1 = 0'); });
|
|
917
932
|
return [2 /*return*/];
|
|
918
933
|
}
|
|
919
934
|
});
|
|
@@ -921,16 +936,20 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
921
936
|
};
|
|
922
937
|
FilterConsumerBridgeToKnexRequest.prototype.isNull = function (col) {
|
|
923
938
|
var _this = this;
|
|
939
|
+
this.handleNull.column(col);
|
|
924
940
|
this.result.push(function (b) { return b.whereNull(_this.innerNameProvider.$dbNameOf(col)); });
|
|
925
941
|
};
|
|
926
942
|
FilterConsumerBridgeToKnexRequest.prototype.isNotNull = function (col) {
|
|
927
943
|
var _this = this;
|
|
944
|
+
this.handleNull.column(col);
|
|
928
945
|
this.result.push(function (b) {
|
|
929
946
|
return b.whereNotNull(_this.innerNameProvider.$dbNameOf(col));
|
|
930
947
|
});
|
|
931
948
|
};
|
|
932
949
|
FilterConsumerBridgeToKnexRequest.prototype.isIn = function (col, val) {
|
|
933
950
|
var _this = this;
|
|
951
|
+
if (val === null || val === void 0 ? void 0 : val.length)
|
|
952
|
+
this.handleNull.column(col);
|
|
934
953
|
this.result.push(function (knex) {
|
|
935
954
|
return knex.whereIn(_this.innerNameProvider.$dbNameOf(col), val.map(function (x) {
|
|
936
955
|
return translateValueAndHandleArrayAndHandleArray(col, x, _this.jsonColumnStorage);
|
|
@@ -970,6 +989,7 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
970
989
|
FilterConsumerBridgeToKnexRequest.prototype.like = function (col, pattern, not) {
|
|
971
990
|
var _this = this;
|
|
972
991
|
if (not === void 0) { not = ''; }
|
|
992
|
+
this.handleNull.column(col);
|
|
973
993
|
this.result.push(function (b) {
|
|
974
994
|
return b.whereRaw(not +
|
|
975
995
|
'lower (' +
|
|
@@ -983,6 +1003,7 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
983
1003
|
};
|
|
984
1004
|
FilterConsumerBridgeToKnexRequest.prototype.add = function (col, val, operator) {
|
|
985
1005
|
var _this = this;
|
|
1006
|
+
this.handleNull.column(col);
|
|
986
1007
|
this.result.push(function (b) {
|
|
987
1008
|
return b.where(_this.innerNameProvider.$dbNameOf(col), operator, translateValueAndHandleArrayAndHandleArray(col, val, _this.jsonColumnStorage));
|
|
988
1009
|
});
|
|
@@ -999,6 +1020,7 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
999
1020
|
return [4 /*yield*/, databaseCustom.buildKnex()];
|
|
1000
1021
|
case 1:
|
|
1001
1022
|
_b.apply(_a, [_c.sent()]);
|
|
1023
|
+
this.handleNull.custom();
|
|
1002
1024
|
_c.label = 2;
|
|
1003
1025
|
case 2:
|
|
1004
1026
|
if (!(databaseCustom === null || databaseCustom === void 0 ? void 0 : databaseCustom.buildSql)) return [3 /*break*/, 4];
|
|
@@ -1010,6 +1032,7 @@ var FilterConsumerBridgeToKnexRequest = /** @class */ (function () {
|
|
|
1010
1032
|
if (typeof sql_1 !== 'string')
|
|
1011
1033
|
sql_1 = item.sql;
|
|
1012
1034
|
if (sql_1) {
|
|
1035
|
+
this.handleNull.custom();
|
|
1013
1036
|
this.result.push(function (b) { return b.whereRaw(sql_1, r_2.values); });
|
|
1014
1037
|
}
|
|
1015
1038
|
_c.label = 4;
|