remult 0.22.2 → 0.22.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/graphql.js +27 -27
- package/esm/postgres/schema-builder.js +4 -4
- package/esm/remult-knex/index.js +2 -2
- package/esm/src/backend-tests/backend-database-test-setup.backend-spec.js +10 -0
- package/esm/src/id-entity.d.ts +4 -0
- package/esm/src/id-entity.js +8 -0
- package/esm/src/remult3/RepositoryImplementation.js +7 -5
- package/esm/src/shared-tests/db-tests.db-tests.js +35 -0
- package/package.json +1 -1
- package/postgres/postgresColumnSyntax.d.ts +2 -0
- package/postgres/postgresColumnSyntax.js +34 -0
- package/remult-knex/index.js +2 -2
- package/remult-middleware.d.ts +2 -0
- package/remult-middleware.js +70 -0
- package/server/register-actions-on-server.d.ts +3 -0
- package/server/register-actions-on-server.js +50 -0
- package/server/register-entities-on-server.d.ts +3 -0
- package/server/register-entities-on-server.js +19 -0
- package/src/backend-tests/backend-database-test-setup.backend-spec.js +10 -0
- package/{esm/core/src → src}/backend-tests/my-test.backend-spec.d.ts +1 -1
- package/src/backend-tests/my-test.backend-spec.js +217 -0
- package/src/backend-tests/test-http-server.backend-spec.d.ts +6 -0
- package/src/backend-tests/test-http-server.backend-spec.js +342 -0
- package/src/id-entity.d.ts +4 -0
- package/src/id-entity.js +17 -0
- package/src/remult3/RepositoryImplementation.js +15 -13
- package/src/shared-tests/db-tests.db-tests.js +64 -0
- package/{esm/core/src/valueConverters.d.ts → valueConverters.d.ts} +12 -13
- package/valueConverters.js +168 -0
- package/esm/angular/interfaces/index.d.ts +0 -1
- package/esm/angular/interfaces/index.js +0 -1
- package/esm/angular/interfaces/src/column-collection.d.ts +0 -70
- package/esm/angular/interfaces/src/column-collection.js +0 -341
- package/esm/angular/interfaces/src/data-area-settings.d.ts +0 -15
- package/esm/angular/interfaces/src/data-area-settings.js +0 -35
- package/esm/angular/interfaces/src/data-control-interfaces.d.ts +0 -36
- package/esm/angular/interfaces/src/data-control-interfaces.js +0 -57
- package/esm/angular/interfaces/src/dataList.d.ts +0 -13
- package/esm/angular/interfaces/src/dataList.js +0 -42
- package/esm/angular/interfaces/src/filter-helper.d.ts +0 -13
- package/esm/angular/interfaces/src/filter-helper.js +0 -59
- package/esm/angular/interfaces/src/grid-settings.d.ts +0 -145
- package/esm/angular/interfaces/src/grid-settings.js +0 -387
- package/esm/angular/interfaces/src/public_api.d.ts +0 -4
- package/esm/angular/interfaces/src/public_api.js +0 -4
- package/esm/angular/src/angular/RemultAngularPluginsService.d.ts +0 -4
- package/esm/angular/src/angular/RemultAngularPluginsService.js +0 -3
- package/esm/angular/src/angular/data-control/data-control2.component.d.ts +0 -49
- package/esm/angular/src/angular/data-control/data-control2.component.js +0 -138
- package/esm/core/SseSubscriptionServer.d.ts +0 -33
- package/esm/core/SseSubscriptionServer.js +0 -107
- package/esm/core/assign.d.ts +0 -1
- package/esm/core/assign.js +0 -5
- package/esm/core/classType.d.ts +0 -3
- package/esm/core/classType.js +0 -1
- package/esm/core/index.d.ts +0 -27
- package/esm/core/index.js +0 -25
- package/esm/core/inputTypes.d.ts +0 -9
- package/esm/core/inputTypes.js +0 -9
- package/esm/core/live-query/data-provider-live-query-storage.d.ts +0 -22
- package/esm/core/live-query/data-provider-live-query-storage.js +0 -71
- package/esm/core/postgres/index.d.ts +0 -2
- package/esm/core/postgres/index.js +0 -2
- package/esm/core/postgres/postgres-data-provider.d.ts +0 -36
- package/esm/core/postgres/postgres-data-provider.js +0 -120
- package/esm/core/postgres/schema-builder.d.ts +0 -17
- package/esm/core/postgres/schema-builder.js +0 -153
- package/esm/core/remult-fresh.d.ts +0 -17
- package/esm/core/remult-fresh.js +0 -29
- package/esm/core/remult-knex/index.d.ts +0 -30
- package/esm/core/remult-knex/index.js +0 -446
- package/esm/core/remult-mongo.d.ts +0 -24
- package/esm/core/remult-mongo.js +0 -254
- package/esm/core/server/JsonEntityFileStorage.d.ts +0 -10
- package/esm/core/server/JsonEntityFileStorage.js +0 -25
- package/esm/core/server/core.d.ts +0 -4
- package/esm/core/server/core.js +0 -4
- package/esm/core/server/expressBridge.d.ts +0 -182
- package/esm/core/server/expressBridge.js +0 -938
- package/esm/core/server/index.d.ts +0 -6
- package/esm/core/server/index.js +0 -9
- package/esm/core/server/initAsyncHooks.d.ts +0 -1
- package/esm/core/server/initAsyncHooks.js +0 -9
- package/esm/core/server/initDataProvider.d.ts +0 -2
- package/esm/core/server/initDataProvider.js +0 -14
- package/esm/core/src/__EntityValueProvider.d.ts +0 -11
- package/esm/core/src/__EntityValueProvider.js +0 -1
- package/esm/core/src/__RowsOfDataForTesting.d.ts +0 -3
- package/esm/core/src/__RowsOfDataForTesting.js +0 -1
- package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +0 -6
- package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.js +0 -147
- package/esm/core/src/backend-tests/my-test.backend-spec.js +0 -197
- package/esm/core/src/backend-tests/test-http-server.backend-spec.d.ts +0 -1
- package/esm/core/src/backend-tests/test-http-server.backend-spec.js +0 -167
- package/esm/core/src/buildRestDataProvider.d.ts +0 -31
- package/esm/core/src/buildRestDataProvider.js +0 -113
- package/esm/core/src/column-interfaces.d.ts +0 -154
- package/esm/core/src/column-interfaces.js +0 -7
- package/esm/core/src/column.d.ts +0 -58
- package/esm/core/src/column.js +0 -174
- package/esm/core/src/context.d.ts +0 -134
- package/esm/core/src/context.js +0 -286
- package/esm/core/src/data-api.d.ts +0 -39
- package/esm/core/src/data-api.js +0 -279
- package/esm/core/src/data-interfaces.d.ts +0 -41
- package/esm/core/src/data-interfaces.js +0 -12
- package/esm/core/src/data-providers/array-entity-data-provider.d.ts +0 -22
- package/esm/core/src/data-providers/array-entity-data-provider.js +0 -252
- package/esm/core/src/data-providers/in-memory-database.d.ts +0 -9
- package/esm/core/src/data-providers/in-memory-database.js +0 -14
- package/esm/core/src/data-providers/json-data-provider.d.ts +0 -12
- package/esm/core/src/data-providers/json-data-provider.js +0 -55
- package/esm/core/src/data-providers/rest-data-provider.d.ts +0 -49
- package/esm/core/src/data-providers/rest-data-provider.js +0 -256
- package/esm/core/src/data-providers/sql-database.d.ts +0 -33
- package/esm/core/src/data-providers/sql-database.js +0 -384
- package/esm/core/src/data-providers/web-sql-data-provider.d.ts +0 -24
- package/esm/core/src/data-providers/web-sql-data-provider.js +0 -143
- package/esm/core/src/entity.d.ts +0 -91
- package/esm/core/src/entity.js +0 -1
- package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.d.ts +0 -50
- package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.js +0 -150
- package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -1
- package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.js +0 -1
- package/esm/core/src/filter/filter-interfaces.d.ts +0 -85
- package/esm/core/src/filter/filter-interfaces.js +0 -477
- package/esm/core/src/live-query/LiveQueryClient.d.ts +0 -20
- package/esm/core/src/live-query/LiveQueryClient.js +0 -188
- package/esm/core/src/live-query/SseSubscriptionClient.d.ts +0 -5
- package/esm/core/src/live-query/SseSubscriptionClient.js +0 -86
- package/esm/core/src/live-query/SubscriptionChannel.d.ts +0 -72
- package/esm/core/src/live-query/SubscriptionChannel.js +0 -123
- package/esm/core/src/live-query/SubscriptionServer.d.ts +0 -53
- package/esm/core/src/live-query/SubscriptionServer.js +0 -111
- package/esm/core/src/live-query/live-query-tests.spec.d.ts +0 -6
- package/esm/core/src/live-query/live-query-tests.spec.js +0 -952
- package/esm/core/src/remult-proxy.d.ts +0 -35
- package/esm/core/src/remult-proxy.js +0 -113
- package/esm/core/src/remult3/DecoratorReplacer.d.ts +0 -10
- package/esm/core/src/remult3/DecoratorReplacer.js +0 -20
- package/esm/core/src/remult3/RepositoryImplementation.d.ts +0 -355
- package/esm/core/src/remult3/RepositoryImplementation.js +0 -2109
- package/esm/core/src/remult3/index.d.ts +0 -2
- package/esm/core/src/remult3/index.js +0 -2
- package/esm/core/src/remult3/remult3.d.ts +0 -395
- package/esm/core/src/remult3/remult3.js +0 -2
- package/esm/core/src/server-action.d.ts +0 -81
- package/esm/core/src/server-action.js +0 -394
- package/esm/core/src/shared-tests/db-tests-setup.d.ts +0 -32
- package/esm/core/src/shared-tests/db-tests-setup.js +0 -78
- package/esm/core/src/shared-tests/db-tests.db-tests.d.ts +0 -25
- package/esm/core/src/shared-tests/db-tests.db-tests.js +0 -810
- package/esm/core/src/shared-tests/deleteAll.d.ts +0 -2
- package/esm/core/src/shared-tests/deleteAll.js +0 -4
- package/esm/core/src/shared-tests/entityWithValidations.d.ts +0 -14
- package/esm/core/src/shared-tests/entityWithValidations.js +0 -43
- package/esm/core/src/shared-tests/index.d.ts +0 -4
- package/esm/core/src/shared-tests/index.js +0 -4
- package/esm/core/src/shared-tests/test-custom-id-column.spec.d.ts +0 -1
- package/esm/core/src/shared-tests/test-custom-id-column.spec.js +0 -67
- package/esm/core/src/shared-tests/test-special-value.spec.d.ts +0 -10
- package/esm/core/src/shared-tests/test-special-value.spec.js +0 -73
- package/esm/core/src/shared-tests/test-update-with-null.spec.d.ts +0 -1
- package/esm/core/src/shared-tests/test-update-with-null.spec.js +0 -31
- package/esm/core/src/sort.d.ts +0 -16
- package/esm/core/src/sort.js +0 -103
- package/esm/core/src/sql-command.d.ts +0 -19
- package/esm/core/src/sql-command.js +0 -1
- package/esm/core/src/test.d.ts +0 -3
- package/esm/core/src/test.js +0 -12
- package/esm/core/src/tests/Done.d.ts +0 -5
- package/esm/core/src/tests/Done.js +0 -9
- package/esm/core/src/tests/RowProvider.spec.d.ts +0 -16
- package/esm/core/src/tests/RowProvider.spec.js +0 -631
- package/esm/core/src/tests/TestDataApiResponse.d.ts +0 -10
- package/esm/core/src/tests/TestDataApiResponse.js +0 -22
- package/esm/core/src/tests/basicRowFunctionality.spec.d.ts +0 -8
- package/esm/core/src/tests/basicRowFunctionality.spec.js +0 -2103
- package/esm/core/src/tests/c.d.ts +0 -8
- package/esm/core/src/tests/c.js +0 -13
- package/esm/core/src/tests/createData.d.ts +0 -7
- package/esm/core/src/tests/createData.js +0 -22
- package/esm/core/src/tests/d.d.ts +0 -6
- package/esm/core/src/tests/d.js +0 -11
- package/esm/core/src/tests/dWithPrefilter.d.ts +0 -7
- package/esm/core/src/tests/dWithPrefilter.js +0 -18
- package/esm/core/src/tests/entityForCustomFilter.d.ts +0 -16
- package/esm/core/src/tests/entityForCustomFilter.js +0 -33
- package/esm/core/src/tests/entityWithValidationsOnColumn.d.ts +0 -5
- package/esm/core/src/tests/entityWithValidationsOnColumn.js +0 -13
- package/esm/core/src/tests/frontend-database-tests-setup.spec.d.ts +0 -4
- package/esm/core/src/tests/frontend-database-tests-setup.spec.js +0 -37
- package/esm/core/src/tests/h.d.ts +0 -6
- package/esm/core/src/tests/h.js +0 -24
- package/esm/core/src/tests/remult-3-basic-tests.spec.d.ts +0 -1
- package/esm/core/src/tests/remult-3-basic-tests.spec.js +0 -236
- package/esm/core/src/tests/remult-3-entities.d.ts +0 -23
- package/esm/core/src/tests/remult-3-entities.js +0 -39
- package/esm/core/src/tests/tasks.d.ts +0 -6
- package/esm/core/src/tests/tasks.js +0 -10
- package/esm/core/src/tests/test-context-as-storage.spec.d.ts +0 -0
- package/esm/core/src/tests/test-context-as-storage.spec.js +0 -1
- package/esm/core/src/tests/test-data-api/predefined-filter.spec.d.ts +0 -1
- package/esm/core/src/tests/test-data-api/predefined-filter.spec.js +0 -389
- package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.d.ts +0 -5
- package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.js +0 -152
- package/esm/core/src/tests/test-decorator-precedence.spec.d.ts +0 -1
- package/esm/core/src/tests/test-decorator-precedence.spec.js +0 -38
- package/esm/core/src/tests/test-default-value.spec.d.ts +0 -1
- package/esm/core/src/tests/test-default-value.spec.js +0 -33
- package/esm/core/src/tests/test-entity-inheritance.spec.d.ts +0 -14
- package/esm/core/src/tests/test-entity-inheritance.spec.js +0 -82
- package/esm/core/src/tests/test-exceptions.spec.d.ts +0 -1
- package/esm/core/src/tests/test-exceptions.spec.js +0 -375
- package/esm/core/src/tests/test-json.spec.d.ts +0 -1
- package/esm/core/src/tests/test-json.spec.js +0 -115
- package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.d.ts +0 -9
- package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.js +0 -809
- package/esm/core/src/tests/test-non-active-record.spec.d.ts +0 -1
- package/esm/core/src/tests/test-non-active-record.spec.js +0 -66
- package/esm/core/src/tests/test-object-column.spec.d.ts +0 -1
- package/esm/core/src/tests/test-object-column.spec.js +0 -189
- package/esm/core/src/tests/test-paged-foreach.spec.d.ts +0 -1
- package/esm/core/src/tests/test-paged-foreach.spec.js +0 -328
- package/esm/core/src/tests/test-remult-angular.spec.d.ts +0 -1
- package/esm/core/src/tests/test-remult-angular.spec.js +0 -23
- package/esm/core/src/tests/test-server-controller.spec.d.ts +0 -7
- package/esm/core/src/tests/test-server-controller.spec.js +0 -489
- package/esm/core/src/tests/test-server-expressions.spec.d.ts +0 -1
- package/esm/core/src/tests/test-server-expressions.spec.js +0 -178
- package/esm/core/src/tests/test-server-method-on-entity.spec.d.ts +0 -1
- package/esm/core/src/tests/test-server-method-on-entity.spec.js +0 -306
- package/esm/core/src/tests/test-sql-expression.spec.d.ts +0 -5
- package/esm/core/src/tests/test-sql-expression.spec.js +0 -205
- package/esm/core/src/tests/test-sql.spec.d.ts +0 -1
- package/esm/core/src/tests/test-sql.spec.js +0 -170
- package/esm/core/src/tests/test-subscribe.spec.d.ts +0 -1
- package/esm/core/src/tests/test-subscribe.spec.js +0 -135
- package/esm/core/src/tests/test-type-recovery.spec.d.ts +0 -1
- package/esm/core/src/tests/test-type-recovery.spec.js +0 -49
- package/esm/core/src/tests/test-where-api.spec.d.ts +0 -1
- package/esm/core/src/tests/test-where-api.spec.js +0 -434
- package/esm/core/src/tests/testHelper.spec.d.ts +0 -36
- package/esm/core/src/tests/testHelper.spec.js +0 -226
- package/esm/core/src/tests/testModel/models.d.ts +0 -16
- package/esm/core/src/tests/testModel/models.js +0 -25
- package/esm/core/src/validators.d.ts +0 -14
- package/esm/core/src/validators.js +0 -33
- package/esm/core/src/valueConverters.js +0 -197
- package/esm/core/urlBuilder.d.ts +0 -6
- package/esm/core/urlBuilder.js +0 -20
- package/esm/test-servers/shared/Task.d.ts +0 -9
- package/esm/test-servers/shared/Task.js +0 -32
- package/esm/test.d.ts +0 -5
- package/esm/test.js +0 -6
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { SqlCommandWithParameters } from "../sql-command";
|
|
2
|
-
import { Filter, FilterConsumer } from './filter-interfaces';
|
|
3
|
-
import { FieldMetadata } from "../column-interfaces";
|
|
4
|
-
import { EntityFilter, OmitEB } from "../remult3/remult3";
|
|
5
|
-
import { EntityMetadataOverloads, RepositoryOverloads } from "../remult3";
|
|
6
|
-
export declare class FilterConsumerBridgeToSqlRequest implements FilterConsumer {
|
|
7
|
-
private r;
|
|
8
|
-
private nameProvider;
|
|
9
|
-
private where;
|
|
10
|
-
_addWhere: boolean;
|
|
11
|
-
promises: Promise<void>[];
|
|
12
|
-
resolveWhere(): Promise<string>;
|
|
13
|
-
constructor(r: SqlCommandWithParameters, nameProvider: EntityDbNamesBase);
|
|
14
|
-
custom(key: string, customItem: any): void;
|
|
15
|
-
or(orElements: Filter[]): void;
|
|
16
|
-
isNull(col: FieldMetadata): void;
|
|
17
|
-
isNotNull(col: FieldMetadata): void;
|
|
18
|
-
isIn(col: FieldMetadata, val: any[]): void;
|
|
19
|
-
isEqualTo(col: FieldMetadata, val: any): void;
|
|
20
|
-
isDifferentFrom(col: FieldMetadata, val: any): void;
|
|
21
|
-
isGreaterOrEqualTo(col: FieldMetadata, val: any): void;
|
|
22
|
-
isGreaterThan(col: FieldMetadata, val: any): void;
|
|
23
|
-
isLessOrEqualTo(col: FieldMetadata, val: any): void;
|
|
24
|
-
isLessThan(col: FieldMetadata, val: any): void;
|
|
25
|
-
containsCaseInsensitive(col: FieldMetadata, val: any): void;
|
|
26
|
-
private add;
|
|
27
|
-
private addToWhere;
|
|
28
|
-
databaseCustom(databaseCustom: CustomSqlFilterObject): void;
|
|
29
|
-
}
|
|
30
|
-
export type CustomSqlFilterBuilderFunction = (builder: CustomSqlFilterBuilder) => void | Promise<any>;
|
|
31
|
-
export interface CustomSqlFilterObject {
|
|
32
|
-
buildSql: CustomSqlFilterBuilderFunction;
|
|
33
|
-
}
|
|
34
|
-
export declare class CustomSqlFilterBuilder {
|
|
35
|
-
private r;
|
|
36
|
-
constructor(r: SqlCommandWithParameters);
|
|
37
|
-
sql: string;
|
|
38
|
-
addParameterAndReturnSqlToken<valueType>(val: valueType, field?: FieldMetadata<valueType>): string;
|
|
39
|
-
filterToRaw<entityType>(repo: RepositoryOverloads<entityType>, condition: EntityFilter<entityType>): Promise<string>;
|
|
40
|
-
}
|
|
41
|
-
export declare function isDbReadonly<entityType>(field: FieldMetadata, dbNames: EntityDbNames<entityType>): boolean;
|
|
42
|
-
export declare type EntityDbNamesBase = {
|
|
43
|
-
$entityName: string;
|
|
44
|
-
$dbNameOf(field: FieldMetadata<any> | string): string;
|
|
45
|
-
toString(): string;
|
|
46
|
-
};
|
|
47
|
-
export declare type EntityDbNames<entityType> = {
|
|
48
|
-
[Properties in keyof Required<OmitEB<entityType>>]: string;
|
|
49
|
-
} & EntityDbNamesBase;
|
|
50
|
-
export declare function dbNamesOf<entityType>(repo: EntityMetadataOverloads<entityType>): Promise<EntityDbNames<entityType>>;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { getEntityMetadata } from "../remult3";
|
|
2
|
-
import { SqlDatabase } from "../data-providers/sql-database";
|
|
3
|
-
export class FilterConsumerBridgeToSqlRequest {
|
|
4
|
-
r;
|
|
5
|
-
nameProvider;
|
|
6
|
-
where = "";
|
|
7
|
-
_addWhere = true;
|
|
8
|
-
promises = [];
|
|
9
|
-
async resolveWhere() {
|
|
10
|
-
while (this.promises.length > 0) {
|
|
11
|
-
let p = this.promises;
|
|
12
|
-
this.promises = [];
|
|
13
|
-
for (const pr of p) {
|
|
14
|
-
await pr;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return this.where;
|
|
18
|
-
}
|
|
19
|
-
constructor(r, nameProvider) {
|
|
20
|
-
this.r = r;
|
|
21
|
-
this.nameProvider = nameProvider;
|
|
22
|
-
}
|
|
23
|
-
custom(key, customItem) {
|
|
24
|
-
throw new Error("Custom filter should be translated before it gets here");
|
|
25
|
-
}
|
|
26
|
-
or(orElements) {
|
|
27
|
-
let statement = '';
|
|
28
|
-
this.promises.push((async () => {
|
|
29
|
-
for (const element of orElements) {
|
|
30
|
-
let f = new FilterConsumerBridgeToSqlRequest(this.r, this.nameProvider);
|
|
31
|
-
f._addWhere = false;
|
|
32
|
-
element.__applyToConsumer(f);
|
|
33
|
-
let where = await f.resolveWhere();
|
|
34
|
-
if (!where)
|
|
35
|
-
return; //since if any member of or is empty, then the entire or is irrelevant
|
|
36
|
-
if (where.length > 0) {
|
|
37
|
-
if (statement.length > 0) {
|
|
38
|
-
statement += " or ";
|
|
39
|
-
}
|
|
40
|
-
if (orElements.length > 1) {
|
|
41
|
-
statement += "(" + where + ")";
|
|
42
|
-
}
|
|
43
|
-
else
|
|
44
|
-
statement += where;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
this.addToWhere("(" + statement + ")");
|
|
48
|
-
})());
|
|
49
|
-
}
|
|
50
|
-
isNull(col) {
|
|
51
|
-
this.promises.push((async () => this.addToWhere(this.nameProvider.$dbNameOf(col) + ' is null'))());
|
|
52
|
-
}
|
|
53
|
-
isNotNull(col) {
|
|
54
|
-
this.promises.push((async () => this.addToWhere(this.nameProvider.$dbNameOf(col) + ' is not null'))());
|
|
55
|
-
}
|
|
56
|
-
isIn(col, val) {
|
|
57
|
-
this.promises.push((async () => {
|
|
58
|
-
if (val && val.length > 0)
|
|
59
|
-
this.addToWhere(this.nameProvider.$dbNameOf(col) + " in (" + val.map(x => this.r.addParameterAndReturnSqlToken(col.valueConverter.toDb(x))).join(",") + ")");
|
|
60
|
-
else
|
|
61
|
-
this.addToWhere('1 = 0 /*isIn with no values*/');
|
|
62
|
-
})());
|
|
63
|
-
}
|
|
64
|
-
isEqualTo(col, val) {
|
|
65
|
-
this.add(col, val, "=");
|
|
66
|
-
}
|
|
67
|
-
isDifferentFrom(col, val) {
|
|
68
|
-
this.add(col, val, "<>");
|
|
69
|
-
}
|
|
70
|
-
isGreaterOrEqualTo(col, val) {
|
|
71
|
-
this.add(col, val, ">=");
|
|
72
|
-
}
|
|
73
|
-
isGreaterThan(col, val) {
|
|
74
|
-
this.add(col, val, ">");
|
|
75
|
-
}
|
|
76
|
-
isLessOrEqualTo(col, val) {
|
|
77
|
-
this.add(col, val, "<=");
|
|
78
|
-
}
|
|
79
|
-
isLessThan(col, val) {
|
|
80
|
-
this.add(col, val, "<");
|
|
81
|
-
}
|
|
82
|
-
containsCaseInsensitive(col, val) {
|
|
83
|
-
this.promises.push((async () => {
|
|
84
|
-
this.addToWhere('lower (' + this.nameProvider.$dbNameOf(col) + ") like lower ('%" + val.replace(/'/g, '\'\'') + "%')");
|
|
85
|
-
})());
|
|
86
|
-
}
|
|
87
|
-
add(col, val, operator) {
|
|
88
|
-
this.promises.push((async () => {
|
|
89
|
-
let x = this.nameProvider.$dbNameOf(col) + ' ' + operator + ' ' + this.r.addParameterAndReturnSqlToken(col.valueConverter.toDb(val));
|
|
90
|
-
this.addToWhere(x);
|
|
91
|
-
})());
|
|
92
|
-
}
|
|
93
|
-
addToWhere(x) {
|
|
94
|
-
if (this.where.length == 0) {
|
|
95
|
-
if (this._addWhere)
|
|
96
|
-
this.where += ' where ';
|
|
97
|
-
}
|
|
98
|
-
else
|
|
99
|
-
this.where += ' and ';
|
|
100
|
-
this.where += x;
|
|
101
|
-
}
|
|
102
|
-
databaseCustom(databaseCustom) {
|
|
103
|
-
this.promises.push((async () => {
|
|
104
|
-
if (databaseCustom?.buildSql) {
|
|
105
|
-
let item = new CustomSqlFilterBuilder(this.r);
|
|
106
|
-
await databaseCustom.buildSql(item);
|
|
107
|
-
if (item.sql) {
|
|
108
|
-
this.addToWhere("(" + item.sql + ")");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
})());
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
export class CustomSqlFilterBuilder {
|
|
115
|
-
r;
|
|
116
|
-
constructor(r) {
|
|
117
|
-
this.r = r;
|
|
118
|
-
}
|
|
119
|
-
sql = '';
|
|
120
|
-
addParameterAndReturnSqlToken(val, field) {
|
|
121
|
-
if (field)
|
|
122
|
-
val = field.valueConverter.toDb(val);
|
|
123
|
-
return this.r.addParameterAndReturnSqlToken(val);
|
|
124
|
-
}
|
|
125
|
-
async filterToRaw(repo, condition) {
|
|
126
|
-
return SqlDatabase.filterToRaw(repo, condition, this);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
export function isDbReadonly(field, dbNames) {
|
|
130
|
-
return (field.dbReadOnly || field.isServerExpression || dbNames.$dbNameOf(field) != field.options.dbName);
|
|
131
|
-
}
|
|
132
|
-
export async function dbNamesOf(repo) {
|
|
133
|
-
var meta = getEntityMetadata(repo);
|
|
134
|
-
const result = {
|
|
135
|
-
$entityName: await meta.getDbName(),
|
|
136
|
-
toString: () => result.$entityName,
|
|
137
|
-
$dbNameOf: (field) => {
|
|
138
|
-
var key;
|
|
139
|
-
if (typeof field === "string")
|
|
140
|
-
key = field;
|
|
141
|
-
else
|
|
142
|
-
key = field.key;
|
|
143
|
-
return result[key];
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
for (const field of meta.fields) {
|
|
147
|
-
result[field.key] = await field.getDbName();
|
|
148
|
-
}
|
|
149
|
-
return result;
|
|
150
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { FieldMetadata } from "../column-interfaces";
|
|
2
|
-
import { Remult } from "../context";
|
|
3
|
-
import { EntityMetadata, EntityFilter } from "../remult3";
|
|
4
|
-
export declare class Filter {
|
|
5
|
-
private apply?;
|
|
6
|
-
constructor(apply?: ((add: FilterConsumer) => void) | undefined);
|
|
7
|
-
__applyToConsumer(add: FilterConsumer): void;
|
|
8
|
-
static resolve<entityType>(filter: EntityFilter<entityType> | (() => EntityFilter<entityType> | Promise<EntityFilter<entityType>>)): Promise<EntityFilter<entityType>>;
|
|
9
|
-
static createCustom<entityType>(rawFilterTranslator: (unused: never, r: Remult) => EntityFilter<entityType> | Promise<EntityFilter<entityType>>, key?: string): (() => EntityFilter<entityType>) & rawFilterInfo<entityType>;
|
|
10
|
-
static createCustom<entityType, argsType>(rawFilterTranslator: (args: argsType, r: Remult) => EntityFilter<entityType> | Promise<EntityFilter<entityType>>, key?: string): ((y: argsType) => EntityFilter<entityType>) & rawFilterInfo<entityType>;
|
|
11
|
-
static fromEntityFilter<T>(entity: EntityMetadata<T>, whereItem: EntityFilter<T>): Filter;
|
|
12
|
-
toJson(): any;
|
|
13
|
-
static entityFilterToJson<T>(entityDefs: EntityMetadata<T>, where: EntityFilter<T>): any;
|
|
14
|
-
static entityFilterFromJson<T>(entityDefs: EntityMetadata<T>, packed: any): EntityFilter<T>;
|
|
15
|
-
static translateCustomWhere<T>(r: Filter, entity: EntityMetadata<T>, remult: Remult): Promise<Filter>;
|
|
16
|
-
}
|
|
17
|
-
export declare class filterHelper {
|
|
18
|
-
metadata: FieldMetadata;
|
|
19
|
-
constructor(metadata: FieldMetadata);
|
|
20
|
-
processVal(val: any): any;
|
|
21
|
-
contains(val: string): Filter;
|
|
22
|
-
isLessThan(val: any): Filter;
|
|
23
|
-
isGreaterOrEqualTo(val: any): Filter;
|
|
24
|
-
isNotIn(values: any[]): Filter;
|
|
25
|
-
isDifferentFrom(val: any): Filter;
|
|
26
|
-
isLessOrEqualTo(val: any): Filter;
|
|
27
|
-
isGreaterThan(val: any): Filter;
|
|
28
|
-
isEqualTo(val: any): Filter;
|
|
29
|
-
isIn(val: any[]): Filter;
|
|
30
|
-
}
|
|
31
|
-
export interface FilterConsumer {
|
|
32
|
-
or(orElements: Filter[]): any;
|
|
33
|
-
isEqualTo(col: FieldMetadata, val: any): void;
|
|
34
|
-
isDifferentFrom(col: FieldMetadata, val: any): void;
|
|
35
|
-
isNull(col: FieldMetadata): void;
|
|
36
|
-
isNotNull(col: FieldMetadata): void;
|
|
37
|
-
isGreaterOrEqualTo(col: FieldMetadata, val: any): void;
|
|
38
|
-
isGreaterThan(col: FieldMetadata, val: any): void;
|
|
39
|
-
isLessOrEqualTo(col: FieldMetadata, val: any): void;
|
|
40
|
-
isLessThan(col: FieldMetadata, val: any): void;
|
|
41
|
-
containsCaseInsensitive(col: FieldMetadata, val: any): void;
|
|
42
|
-
isIn(col: FieldMetadata, val: any[]): void;
|
|
43
|
-
custom(key: string, customItem: any): void;
|
|
44
|
-
databaseCustom(databaseCustom: any): void;
|
|
45
|
-
}
|
|
46
|
-
export declare class AndFilter extends Filter {
|
|
47
|
-
readonly filters: Filter[];
|
|
48
|
-
constructor(...filters: Filter[]);
|
|
49
|
-
add(filter: Filter): void;
|
|
50
|
-
}
|
|
51
|
-
export declare class OrFilter extends Filter {
|
|
52
|
-
readonly filters: Filter[];
|
|
53
|
-
constructor(...filters: Filter[]);
|
|
54
|
-
}
|
|
55
|
-
export declare const customUrlToken = "$custom$";
|
|
56
|
-
export declare const customDatabaseFilterToken = "$db$";
|
|
57
|
-
export declare class FilterSerializer implements FilterConsumer {
|
|
58
|
-
result: any;
|
|
59
|
-
constructor();
|
|
60
|
-
databaseCustom(databaseCustom: any): void;
|
|
61
|
-
custom(key: any, customItem: any): void;
|
|
62
|
-
hasUndefined: boolean;
|
|
63
|
-
add(key: string, val: any): void;
|
|
64
|
-
or(orElements: Filter[]): void;
|
|
65
|
-
isNull(col: FieldMetadata): void;
|
|
66
|
-
isNotNull(col: FieldMetadata): void;
|
|
67
|
-
isIn(col: FieldMetadata, val: any[]): void;
|
|
68
|
-
isEqualTo(col: FieldMetadata, val: any): void;
|
|
69
|
-
isDifferentFrom(col: FieldMetadata, val: any): void;
|
|
70
|
-
isGreaterOrEqualTo(col: FieldMetadata, val: any): void;
|
|
71
|
-
isGreaterThan(col: FieldMetadata, val: any): void;
|
|
72
|
-
isLessOrEqualTo(col: FieldMetadata, val: any): void;
|
|
73
|
-
isLessThan(col: FieldMetadata, val: any): void;
|
|
74
|
-
containsCaseInsensitive(col: FieldMetadata, val: any): void;
|
|
75
|
-
}
|
|
76
|
-
export declare function entityFilterToJson<T>(entityDefs: EntityMetadata<T>, where: EntityFilter<T>): any;
|
|
77
|
-
export declare function buildFilterFromRequestParameters(entity: EntityMetadata, filterInfo: {
|
|
78
|
-
get: (key: string) => any;
|
|
79
|
-
}): EntityFilter<any>;
|
|
80
|
-
export interface rawFilterInfo<entityType> {
|
|
81
|
-
rawFilterInfo: {
|
|
82
|
-
key: string;
|
|
83
|
-
rawFilterTranslator: (args: any, r: Remult) => (EntityFilter<entityType> | Promise<EntityFilter<entityType>>);
|
|
84
|
-
};
|
|
85
|
-
}
|