remult 0.22.3 → 0.22.5
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/angular/interfaces/index.d.ts +1 -0
- package/esm/angular/interfaces/index.js +1 -0
- package/esm/angular/interfaces/src/column-collection.d.ts +70 -0
- package/esm/angular/interfaces/src/column-collection.js +341 -0
- package/esm/angular/interfaces/src/data-area-settings.d.ts +15 -0
- package/esm/angular/interfaces/src/data-area-settings.js +35 -0
- package/esm/angular/interfaces/src/data-control-interfaces.d.ts +36 -0
- package/esm/angular/interfaces/src/data-control-interfaces.js +57 -0
- package/esm/angular/interfaces/src/dataList.d.ts +13 -0
- package/esm/angular/interfaces/src/dataList.js +42 -0
- package/esm/angular/interfaces/src/filter-helper.d.ts +13 -0
- package/esm/angular/interfaces/src/filter-helper.js +59 -0
- package/esm/angular/interfaces/src/grid-settings.d.ts +145 -0
- package/esm/angular/interfaces/src/grid-settings.js +387 -0
- package/esm/angular/interfaces/src/public_api.d.ts +4 -0
- package/esm/angular/interfaces/src/public_api.js +4 -0
- package/esm/angular/src/angular/RemultAngularPluginsService.d.ts +4 -0
- package/esm/angular/src/angular/RemultAngularPluginsService.js +3 -0
- package/esm/angular/src/angular/data-control/data-control2.component.d.ts +49 -0
- package/esm/angular/src/angular/data-control/data-control2.component.js +138 -0
- package/esm/core/SseSubscriptionServer.d.ts +33 -0
- package/esm/core/SseSubscriptionServer.js +107 -0
- package/esm/core/assign.d.ts +1 -0
- package/esm/core/assign.js +5 -0
- package/esm/core/classType.d.ts +3 -0
- package/esm/core/classType.js +1 -0
- package/esm/core/index.d.ts +27 -0
- package/esm/core/index.js +25 -0
- package/esm/core/inputTypes.d.ts +9 -0
- package/esm/core/inputTypes.js +9 -0
- package/esm/core/live-query/data-provider-live-query-storage.d.ts +22 -0
- package/esm/core/live-query/data-provider-live-query-storage.js +71 -0
- package/esm/core/postgres/index.d.ts +2 -0
- package/esm/core/postgres/index.js +2 -0
- package/esm/core/postgres/postgres-data-provider.d.ts +36 -0
- package/esm/core/postgres/postgres-data-provider.js +120 -0
- package/esm/core/postgres/schema-builder.d.ts +17 -0
- package/esm/core/postgres/schema-builder.js +153 -0
- package/esm/core/remult-fresh.d.ts +17 -0
- package/esm/core/remult-fresh.js +29 -0
- package/esm/core/remult-knex/index.d.ts +30 -0
- package/esm/core/remult-knex/index.js +446 -0
- package/esm/core/remult-mongo.d.ts +24 -0
- package/esm/core/remult-mongo.js +254 -0
- package/esm/core/server/JsonEntityFileStorage.d.ts +10 -0
- package/esm/core/server/JsonEntityFileStorage.js +25 -0
- package/esm/core/server/core.d.ts +4 -0
- package/esm/core/server/core.js +4 -0
- package/esm/core/server/expressBridge.d.ts +182 -0
- package/esm/core/server/expressBridge.js +938 -0
- package/esm/core/server/index.d.ts +6 -0
- package/esm/core/server/index.js +9 -0
- package/esm/core/server/initAsyncHooks.d.ts +1 -0
- package/esm/core/server/initAsyncHooks.js +9 -0
- package/esm/core/server/initDataProvider.d.ts +2 -0
- package/esm/core/server/initDataProvider.js +14 -0
- package/esm/core/src/__EntityValueProvider.d.ts +11 -0
- package/esm/core/src/__EntityValueProvider.js +1 -0
- package/esm/core/src/__RowsOfDataForTesting.d.ts +3 -0
- package/esm/core/src/__RowsOfDataForTesting.js +1 -0
- package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +6 -0
- package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.js +147 -0
- package/{src → esm/core/src}/backend-tests/my-test.backend-spec.d.ts +1 -1
- package/esm/core/src/backend-tests/my-test.backend-spec.js +197 -0
- package/esm/core/src/backend-tests/test-http-server.backend-spec.d.ts +1 -0
- package/esm/core/src/backend-tests/test-http-server.backend-spec.js +167 -0
- package/esm/core/src/buildRestDataProvider.d.ts +31 -0
- package/esm/core/src/buildRestDataProvider.js +113 -0
- package/esm/core/src/column-interfaces.d.ts +154 -0
- package/esm/core/src/column-interfaces.js +7 -0
- package/esm/core/src/column.d.ts +58 -0
- package/esm/core/src/column.js +174 -0
- package/esm/core/src/context.d.ts +134 -0
- package/esm/core/src/context.js +286 -0
- package/esm/core/src/data-api.d.ts +39 -0
- package/esm/core/src/data-api.js +279 -0
- package/esm/core/src/data-interfaces.d.ts +41 -0
- package/esm/core/src/data-interfaces.js +12 -0
- package/esm/core/src/data-providers/array-entity-data-provider.d.ts +22 -0
- package/esm/core/src/data-providers/array-entity-data-provider.js +252 -0
- package/esm/core/src/data-providers/in-memory-database.d.ts +9 -0
- package/esm/core/src/data-providers/in-memory-database.js +14 -0
- package/esm/core/src/data-providers/json-data-provider.d.ts +12 -0
- package/esm/core/src/data-providers/json-data-provider.js +55 -0
- package/esm/core/src/data-providers/rest-data-provider.d.ts +49 -0
- package/esm/core/src/data-providers/rest-data-provider.js +256 -0
- package/esm/core/src/data-providers/sql-database.d.ts +33 -0
- package/esm/core/src/data-providers/sql-database.js +384 -0
- package/esm/core/src/data-providers/web-sql-data-provider.d.ts +24 -0
- package/esm/core/src/data-providers/web-sql-data-provider.js +143 -0
- package/esm/core/src/entity.d.ts +91 -0
- package/esm/core/src/entity.js +1 -0
- package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.d.ts +50 -0
- package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.js +150 -0
- package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.d.ts +1 -0
- package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.js +1 -0
- package/esm/core/src/filter/filter-interfaces.d.ts +85 -0
- package/esm/core/src/filter/filter-interfaces.js +477 -0
- package/esm/core/src/live-query/LiveQueryClient.d.ts +20 -0
- package/esm/core/src/live-query/LiveQueryClient.js +188 -0
- package/esm/core/src/live-query/SseSubscriptionClient.d.ts +5 -0
- package/esm/core/src/live-query/SseSubscriptionClient.js +86 -0
- package/esm/core/src/live-query/SubscriptionChannel.d.ts +72 -0
- package/esm/core/src/live-query/SubscriptionChannel.js +123 -0
- package/esm/core/src/live-query/SubscriptionServer.d.ts +53 -0
- package/esm/core/src/live-query/SubscriptionServer.js +111 -0
- package/esm/core/src/live-query/live-query-tests.spec.d.ts +6 -0
- package/esm/core/src/live-query/live-query-tests.spec.js +952 -0
- package/esm/core/src/remult-proxy.d.ts +35 -0
- package/esm/core/src/remult-proxy.js +113 -0
- package/esm/core/src/remult3/DecoratorReplacer.d.ts +10 -0
- package/esm/core/src/remult3/DecoratorReplacer.js +20 -0
- package/esm/core/src/remult3/RepositoryImplementation.d.ts +355 -0
- package/esm/core/src/remult3/RepositoryImplementation.js +2109 -0
- package/esm/core/src/remult3/index.d.ts +2 -0
- package/esm/core/src/remult3/index.js +2 -0
- package/esm/core/src/remult3/remult3.d.ts +395 -0
- package/esm/core/src/remult3/remult3.js +2 -0
- package/esm/core/src/server-action.d.ts +81 -0
- package/esm/core/src/server-action.js +394 -0
- package/esm/core/src/shared-tests/db-tests-setup.d.ts +32 -0
- package/esm/core/src/shared-tests/db-tests-setup.js +78 -0
- package/esm/core/src/shared-tests/db-tests.db-tests.d.ts +25 -0
- package/esm/core/src/shared-tests/db-tests.db-tests.js +810 -0
- package/esm/core/src/shared-tests/deleteAll.d.ts +2 -0
- package/esm/core/src/shared-tests/deleteAll.js +4 -0
- package/esm/core/src/shared-tests/entityWithValidations.d.ts +14 -0
- package/esm/core/src/shared-tests/entityWithValidations.js +43 -0
- package/esm/core/src/shared-tests/index.d.ts +4 -0
- package/esm/core/src/shared-tests/index.js +4 -0
- package/esm/core/src/shared-tests/test-custom-id-column.spec.d.ts +1 -0
- package/esm/core/src/shared-tests/test-custom-id-column.spec.js +67 -0
- package/esm/core/src/shared-tests/test-special-value.spec.d.ts +10 -0
- package/esm/core/src/shared-tests/test-special-value.spec.js +73 -0
- package/esm/core/src/shared-tests/test-update-with-null.spec.d.ts +1 -0
- package/esm/core/src/shared-tests/test-update-with-null.spec.js +31 -0
- package/esm/core/src/sort.d.ts +16 -0
- package/esm/core/src/sort.js +103 -0
- package/esm/core/src/sql-command.d.ts +19 -0
- package/esm/core/src/sql-command.js +1 -0
- package/esm/core/src/test.d.ts +3 -0
- package/esm/core/src/test.js +12 -0
- package/esm/core/src/tests/Done.d.ts +5 -0
- package/esm/core/src/tests/Done.js +9 -0
- package/esm/core/src/tests/RowProvider.spec.d.ts +16 -0
- package/esm/core/src/tests/RowProvider.spec.js +631 -0
- package/esm/core/src/tests/TestDataApiResponse.d.ts +10 -0
- package/esm/core/src/tests/TestDataApiResponse.js +22 -0
- package/esm/core/src/tests/basicRowFunctionality.spec.d.ts +8 -0
- package/esm/core/src/tests/basicRowFunctionality.spec.js +2103 -0
- package/esm/core/src/tests/c.d.ts +8 -0
- package/esm/core/src/tests/c.js +13 -0
- package/esm/core/src/tests/createData.d.ts +7 -0
- package/esm/core/src/tests/createData.js +22 -0
- package/esm/core/src/tests/d.d.ts +6 -0
- package/esm/core/src/tests/d.js +11 -0
- package/esm/core/src/tests/dWithPrefilter.d.ts +7 -0
- package/esm/core/src/tests/dWithPrefilter.js +18 -0
- package/esm/core/src/tests/entityForCustomFilter.d.ts +16 -0
- package/esm/core/src/tests/entityForCustomFilter.js +33 -0
- package/esm/core/src/tests/entityWithValidationsOnColumn.d.ts +5 -0
- package/esm/core/src/tests/entityWithValidationsOnColumn.js +13 -0
- package/esm/core/src/tests/frontend-database-tests-setup.spec.d.ts +4 -0
- package/esm/core/src/tests/frontend-database-tests-setup.spec.js +37 -0
- package/esm/core/src/tests/h.d.ts +6 -0
- package/esm/core/src/tests/h.js +24 -0
- package/esm/core/src/tests/remult-3-basic-tests.spec.d.ts +1 -0
- package/esm/core/src/tests/remult-3-basic-tests.spec.js +236 -0
- package/esm/core/src/tests/remult-3-entities.d.ts +23 -0
- package/esm/core/src/tests/remult-3-entities.js +39 -0
- package/esm/core/src/tests/tasks.d.ts +6 -0
- package/esm/core/src/tests/tasks.js +10 -0
- 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 +1 -0
- package/esm/core/src/tests/test-data-api/predefined-filter.spec.d.ts +1 -0
- package/esm/core/src/tests/test-data-api/predefined-filter.spec.js +389 -0
- package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.d.ts +5 -0
- package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.js +152 -0
- package/esm/core/src/tests/test-decorator-precedence.spec.d.ts +1 -0
- package/esm/core/src/tests/test-decorator-precedence.spec.js +38 -0
- package/esm/core/src/tests/test-default-value.spec.d.ts +1 -0
- package/esm/core/src/tests/test-default-value.spec.js +33 -0
- package/esm/core/src/tests/test-entity-inheritance.spec.d.ts +14 -0
- package/esm/core/src/tests/test-entity-inheritance.spec.js +82 -0
- package/esm/core/src/tests/test-exceptions.spec.d.ts +1 -0
- package/esm/core/src/tests/test-exceptions.spec.js +375 -0
- package/esm/core/src/tests/test-json.spec.d.ts +1 -0
- package/esm/core/src/tests/test-json.spec.js +115 -0
- package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.d.ts +9 -0
- package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.js +809 -0
- package/esm/core/src/tests/test-non-active-record.spec.d.ts +1 -0
- package/esm/core/src/tests/test-non-active-record.spec.js +66 -0
- package/esm/core/src/tests/test-object-column.spec.d.ts +1 -0
- package/esm/core/src/tests/test-object-column.spec.js +189 -0
- package/esm/core/src/tests/test-paged-foreach.spec.d.ts +1 -0
- package/esm/core/src/tests/test-paged-foreach.spec.js +328 -0
- package/esm/core/src/tests/test-remult-angular.spec.d.ts +1 -0
- package/esm/core/src/tests/test-remult-angular.spec.js +23 -0
- package/esm/core/src/tests/test-server-controller.spec.d.ts +7 -0
- package/esm/core/src/tests/test-server-controller.spec.js +489 -0
- package/esm/core/src/tests/test-server-expressions.spec.d.ts +1 -0
- package/esm/core/src/tests/test-server-expressions.spec.js +178 -0
- package/esm/core/src/tests/test-server-method-on-entity.spec.d.ts +1 -0
- package/esm/core/src/tests/test-server-method-on-entity.spec.js +306 -0
- package/esm/core/src/tests/test-sql-expression.spec.d.ts +5 -0
- package/esm/core/src/tests/test-sql-expression.spec.js +205 -0
- package/esm/core/src/tests/test-sql.spec.d.ts +1 -0
- package/esm/core/src/tests/test-sql.spec.js +170 -0
- package/esm/core/src/tests/test-subscribe.spec.d.ts +1 -0
- package/esm/core/src/tests/test-subscribe.spec.js +135 -0
- package/esm/core/src/tests/test-type-recovery.spec.d.ts +1 -0
- package/esm/core/src/tests/test-type-recovery.spec.js +49 -0
- package/esm/core/src/tests/test-where-api.spec.d.ts +1 -0
- package/esm/core/src/tests/test-where-api.spec.js +434 -0
- package/esm/core/src/tests/testHelper.spec.d.ts +36 -0
- package/esm/core/src/tests/testHelper.spec.js +226 -0
- package/esm/core/src/tests/testModel/models.d.ts +16 -0
- package/esm/core/src/tests/testModel/models.js +25 -0
- package/esm/core/src/validators.d.ts +14 -0
- package/esm/core/src/validators.js +33 -0
- package/{valueConverters.d.ts → esm/core/src/valueConverters.d.ts} +13 -12
- package/esm/core/src/valueConverters.js +197 -0
- package/esm/core/urlBuilder.d.ts +6 -0
- package/esm/core/urlBuilder.js +20 -0
- package/esm/graphql.js +27 -27
- package/esm/postgres/schema-builder.js +4 -4
- package/esm/src/context.d.ts +6 -1
- package/esm/src/remult3/RepositoryImplementation.d.ts +1 -1
- package/esm/src/remult3/RepositoryImplementation.js +27 -4
- package/esm/src/shared-tests/db-tests.db-tests.js +57 -0
- package/esm/test-servers/shared/Task.d.ts +9 -0
- package/esm/test-servers/shared/Task.js +32 -0
- package/esm/test.d.ts +5 -0
- package/esm/test.js +6 -0
- package/package.json +1 -1
- package/src/context.d.ts +6 -1
- package/src/remult3/RepositoryImplementation.d.ts +1 -1
- package/src/remult3/RepositoryImplementation.js +88 -63
- package/src/shared-tests/db-tests.db-tests.js +97 -0
- package/esm/src/id-entity.d.ts +0 -4
- package/esm/src/id-entity.js +0 -8
- package/postgres/postgresColumnSyntax.d.ts +0 -2
- package/postgres/postgresColumnSyntax.js +0 -34
- package/remult-middleware.d.ts +0 -2
- package/remult-middleware.js +0 -70
- package/server/register-actions-on-server.d.ts +0 -3
- package/server/register-actions-on-server.js +0 -50
- package/server/register-entities-on-server.d.ts +0 -3
- package/server/register-entities-on-server.js +0 -19
- package/src/backend-tests/my-test.backend-spec.js +0 -217
- package/src/backend-tests/test-http-server.backend-spec.d.ts +0 -6
- package/src/backend-tests/test-http-server.backend-spec.js +0 -342
- package/src/id-entity.d.ts +0 -4
- package/src/id-entity.js +0 -17
- package/valueConverters.js +0 -168
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import './frontend-database-tests-setup.spec';
|
|
2
|
+
import { Remult } from "../context";
|
|
3
|
+
import { DataApi, serializeError } from "../data-api";
|
|
4
|
+
import { InMemoryDataProvider } from "../data-providers/in-memory-database";
|
|
5
|
+
import { RestEntityDataProvider } from "../data-providers/rest-data-provider";
|
|
6
|
+
import { SqlDatabase } from "../data-providers/sql-database";
|
|
7
|
+
import { WebSqlDataProvider } from "../data-providers/web-sql-data-provider";
|
|
8
|
+
import { actionInfo, serverActionField } from "../server-action";
|
|
9
|
+
import { testConfiguration } from '../shared-tests/entityWithValidations';
|
|
10
|
+
import { TestDataApiResponse } from './TestDataApiResponse';
|
|
11
|
+
import { remult } from '../remult-proxy';
|
|
12
|
+
import { HttpProviderBridgeToRestDataProviderHttpProvider } from '../buildRestDataProvider';
|
|
13
|
+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 999999;
|
|
14
|
+
//actionInfo.runningOnServer = false;
|
|
15
|
+
export function itForEach(name, arrayOfT, runAsync) {
|
|
16
|
+
arrayOfT.forEach(i => {
|
|
17
|
+
it(name + ' - ' + i, (done) => {
|
|
18
|
+
runAsync(i).catch(e => {
|
|
19
|
+
fail(e);
|
|
20
|
+
done();
|
|
21
|
+
}).then(done, e => {
|
|
22
|
+
fail(e);
|
|
23
|
+
done();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function fitForEach(name, arrayOfT, runAsync) {
|
|
29
|
+
arrayOfT.forEach(i => {
|
|
30
|
+
fit(name + ' - ' + i, (done) => {
|
|
31
|
+
runAsync(i).catch(e => {
|
|
32
|
+
fail(e);
|
|
33
|
+
done();
|
|
34
|
+
}).then(done, e => {
|
|
35
|
+
fail(e);
|
|
36
|
+
done();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export async function testAsIfOnBackend(what) {
|
|
42
|
+
try {
|
|
43
|
+
actionInfo.runningOnServer = true;
|
|
44
|
+
await what();
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
actionInfo.runningOnServer = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export const ActionTestConfig = {
|
|
51
|
+
db: new InMemoryDataProvider()
|
|
52
|
+
};
|
|
53
|
+
remult.apiClient.httpClient = {
|
|
54
|
+
delete: () => undefined,
|
|
55
|
+
get: () => undefined,
|
|
56
|
+
post: async (urlreq, data) => {
|
|
57
|
+
return await new Promise((res, r) => {
|
|
58
|
+
let found = false;
|
|
59
|
+
actionInfo.allActions.forEach(action => {
|
|
60
|
+
action[serverActionField].
|
|
61
|
+
__register((url, queue, allowed, what) => {
|
|
62
|
+
if ('/api/' + url == urlreq) {
|
|
63
|
+
found = true;
|
|
64
|
+
let t = new TestDataApiResponse();
|
|
65
|
+
actionInfo.runningOnServer = true;
|
|
66
|
+
t.success = data => {
|
|
67
|
+
res(data);
|
|
68
|
+
actionInfo.runningOnServer = false;
|
|
69
|
+
};
|
|
70
|
+
t.error = data => {
|
|
71
|
+
r(JSON.parse(JSON.stringify(serializeError(data))));
|
|
72
|
+
actionInfo.runningOnServer = false;
|
|
73
|
+
};
|
|
74
|
+
t.forbidden = () => {
|
|
75
|
+
r({ status: 403, message: "forbidden" });
|
|
76
|
+
actionInfo.runningOnServer = false;
|
|
77
|
+
};
|
|
78
|
+
let remult = new Remult();
|
|
79
|
+
remult.dataProvider = (ActionTestConfig.db);
|
|
80
|
+
what(JSON.parse(JSON.stringify(data)), remult, t);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
if (!found) {
|
|
85
|
+
r("did not find " + urlreq);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
put: () => undefined
|
|
90
|
+
};
|
|
91
|
+
export async function testSql(runAsync) {
|
|
92
|
+
let webSql = new WebSqlDataProvider('test');
|
|
93
|
+
const sql = new SqlDatabase(webSql);
|
|
94
|
+
for (const r of await (await sql.execute("select name from sqlite_master where type='table'")).rows) {
|
|
95
|
+
switch (r.name) {
|
|
96
|
+
case "__WebKitDatabaseInfoTable__":
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
await sql.execute("drop table if exists " + r.name);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
let remult = new Remult();
|
|
103
|
+
remult.dataProvider = (sql);
|
|
104
|
+
await runAsync({ db: sql, remult });
|
|
105
|
+
}
|
|
106
|
+
export async function testInMemoryDb(runAsync) {
|
|
107
|
+
let db = new InMemoryDataProvider();
|
|
108
|
+
remult.dataProvider = (db);
|
|
109
|
+
await runAsync({ db, remult });
|
|
110
|
+
}
|
|
111
|
+
export async function testRestDb(runAsync) {
|
|
112
|
+
let r = new Remult();
|
|
113
|
+
r.dataProvider = (new InMemoryDataProvider());
|
|
114
|
+
let remult = new Remult();
|
|
115
|
+
let db = new MockRestDataProvider(r);
|
|
116
|
+
remult.dataProvider = (db);
|
|
117
|
+
await runAsync({ db, remult });
|
|
118
|
+
}
|
|
119
|
+
export async function testAllDataProviders(runAsync) {
|
|
120
|
+
await testSql(runAsync);
|
|
121
|
+
await testInMemoryDb(runAsync);
|
|
122
|
+
await testRestDb(runAsync);
|
|
123
|
+
}
|
|
124
|
+
function urlToReq(url) {
|
|
125
|
+
let args = new Map();
|
|
126
|
+
let params = url?.split('?')[1]?.split('&');
|
|
127
|
+
if (params)
|
|
128
|
+
for (const p of params) {
|
|
129
|
+
if (!p)
|
|
130
|
+
continue;
|
|
131
|
+
let z = p.split('=');
|
|
132
|
+
let key = decodeURIComponent(z[0]);
|
|
133
|
+
let value = decodeURIComponent(z[1]);
|
|
134
|
+
let x = args.get(key);
|
|
135
|
+
if (x === undefined) {
|
|
136
|
+
args.set(key, value);
|
|
137
|
+
}
|
|
138
|
+
else if (Array.isArray(x))
|
|
139
|
+
x.push(value);
|
|
140
|
+
else
|
|
141
|
+
args.set(key, [args.get(key), value]);
|
|
142
|
+
}
|
|
143
|
+
let req = {
|
|
144
|
+
get: (key) => {
|
|
145
|
+
let r = args.get(key);
|
|
146
|
+
if (r !== undefined) {
|
|
147
|
+
r.toString();
|
|
148
|
+
}
|
|
149
|
+
return r;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return req;
|
|
153
|
+
}
|
|
154
|
+
export class MockRestDataProvider {
|
|
155
|
+
remult;
|
|
156
|
+
constructor(remult) {
|
|
157
|
+
this.remult = remult;
|
|
158
|
+
}
|
|
159
|
+
getEntityDataProvider(metadata) {
|
|
160
|
+
let dataApi = new DataApi(this.remult.repo(metadata.entityType), this.remult);
|
|
161
|
+
return new RestEntityDataProvider(() => "", () => createMockHttpDataProvider(dataApi), metadata);
|
|
162
|
+
}
|
|
163
|
+
transaction(action) {
|
|
164
|
+
throw new Error('Method not implemented.');
|
|
165
|
+
}
|
|
166
|
+
isProxy = true;
|
|
167
|
+
}
|
|
168
|
+
export function createMockHttpDataProvider(dataApi) {
|
|
169
|
+
return new HttpProviderBridgeToRestDataProviderHttpProvider({
|
|
170
|
+
delete: async (url) => {
|
|
171
|
+
let urlSplit = url.split('/');
|
|
172
|
+
let r = new TestDataApiResponse();
|
|
173
|
+
let result;
|
|
174
|
+
r.deleted = () => { };
|
|
175
|
+
try {
|
|
176
|
+
testConfiguration.restDbRunningOnServer = true;
|
|
177
|
+
await dataApi.delete(r, urlSplit[urlSplit.length - 1]);
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
testConfiguration.restDbRunningOnServer = false;
|
|
181
|
+
}
|
|
182
|
+
return result;
|
|
183
|
+
},
|
|
184
|
+
get: async (url) => {
|
|
185
|
+
let r = new TestDataApiResponse();
|
|
186
|
+
let result;
|
|
187
|
+
r.success = data => { result = data; };
|
|
188
|
+
try {
|
|
189
|
+
testConfiguration.restDbRunningOnServer = true;
|
|
190
|
+
await dataApi.httpGet(r, urlToReq(url), async () => "");
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
testConfiguration.restDbRunningOnServer = false;
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
196
|
+
},
|
|
197
|
+
post: async (url, data) => {
|
|
198
|
+
let r = new TestDataApiResponse();
|
|
199
|
+
let result;
|
|
200
|
+
r.created = data => { result = data; };
|
|
201
|
+
r.success = data => { result = data; };
|
|
202
|
+
try {
|
|
203
|
+
testConfiguration.restDbRunningOnServer = true;
|
|
204
|
+
await dataApi.httpPost(r, urlToReq(url), data, async () => ({}));
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
testConfiguration.restDbRunningOnServer = false;
|
|
208
|
+
}
|
|
209
|
+
return result;
|
|
210
|
+
},
|
|
211
|
+
put: async (url, data) => {
|
|
212
|
+
let urlSplit = url.split('/');
|
|
213
|
+
let r = new TestDataApiResponse();
|
|
214
|
+
let result;
|
|
215
|
+
r.success = data => { result = data; };
|
|
216
|
+
try {
|
|
217
|
+
testConfiguration.restDbRunningOnServer = true;
|
|
218
|
+
await dataApi.put(r, urlSplit[urlSplit.length - 1], data);
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
testConfiguration.restDbRunningOnServer = false;
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class Status {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
static open: Status;
|
|
5
|
+
static closed: Status;
|
|
6
|
+
static hold: Status;
|
|
7
|
+
constructor(id: number, name: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class TestStatus {
|
|
10
|
+
id?: string | undefined;
|
|
11
|
+
caption?: string | undefined;
|
|
12
|
+
static open: TestStatus;
|
|
13
|
+
static closed: TestStatus;
|
|
14
|
+
static hold: TestStatus;
|
|
15
|
+
constructor(id?: string | undefined, caption?: string | undefined);
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ValueListFieldType } from "../../remult3";
|
|
2
|
+
@ValueListFieldType()
|
|
3
|
+
export class Status {
|
|
4
|
+
id;
|
|
5
|
+
name;
|
|
6
|
+
static open = new Status(0, "open");
|
|
7
|
+
static closed = new Status(1, "closed");
|
|
8
|
+
static hold = new Status(2, "hold");
|
|
9
|
+
constructor(id, name) {
|
|
10
|
+
this.id = id;
|
|
11
|
+
this.name = name;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
@ValueListFieldType()
|
|
15
|
+
export class TestStatus {
|
|
16
|
+
id;
|
|
17
|
+
caption;
|
|
18
|
+
static open = new TestStatus();
|
|
19
|
+
static closed = new TestStatus('cc');
|
|
20
|
+
static hold = new TestStatus(undefined, 'hh');
|
|
21
|
+
constructor(id, caption) {
|
|
22
|
+
this.id = id;
|
|
23
|
+
this.caption = caption;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldRef } from "./remult3";
|
|
2
|
+
export declare class Validators {
|
|
3
|
+
static required: ((entity: any, col: FieldRef<any, string>, message?: undefined) => void) & {
|
|
4
|
+
withMessage: (message: string) => (entity: any, col: FieldRef<any, string>) => void;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
static unique: ((entity: any, col: FieldRef<any, any>, message?: undefined) => Promise<void>) & {
|
|
8
|
+
withMessage: (message: string) => (entity: any, col: FieldRef<any, any>) => Promise<void>;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
};
|
|
11
|
+
static uniqueOnBackend: ((entity: any, col: FieldRef<any, any>, message?: undefined) => Promise<void>) & {
|
|
12
|
+
withMessage: (message: string) => (entity: any, col: FieldRef<any, any>) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isBackend } from "./context";
|
|
2
|
+
export class Validators {
|
|
3
|
+
static required = Object.assign((entity, col, message = undefined) => {
|
|
4
|
+
if (!col.value || typeof (col.value) === "string" && col.value.trim().length == 0)
|
|
5
|
+
col.error = message || Validators.required.defaultMessage;
|
|
6
|
+
}, {
|
|
7
|
+
withMessage: (message) => {
|
|
8
|
+
return (entity, col) => Validators.required(entity, col, message);
|
|
9
|
+
},
|
|
10
|
+
defaultMessage: 'Should not be empty'
|
|
11
|
+
});
|
|
12
|
+
static unique = Object.assign(async (entity, col, message = undefined) => {
|
|
13
|
+
if (!col.entityRef)
|
|
14
|
+
throw "unique validation may only work on columns that are attached to an entity";
|
|
15
|
+
if (col.entityRef.isNew() || col.valueChanged()) {
|
|
16
|
+
if (await col.entityRef.repository.count({ [col.metadata.key]: col.value }))
|
|
17
|
+
col.error = message || Validators.unique.defaultMessage;
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
withMessage: (message) => {
|
|
21
|
+
return (entity, col) => Validators.unique(entity, col, message);
|
|
22
|
+
},
|
|
23
|
+
defaultMessage: 'already exists'
|
|
24
|
+
});
|
|
25
|
+
static uniqueOnBackend = Object.assign(async (entity, col, message = undefined) => {
|
|
26
|
+
if (isBackend())
|
|
27
|
+
return Validators.unique(entity, col, message);
|
|
28
|
+
}, {
|
|
29
|
+
withMessage: (message) => {
|
|
30
|
+
return (entity, col) => Validators.uniqueOnBackend(entity, col, message);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { ValueConverter } from "./
|
|
2
|
-
export declare class ValueConverters {
|
|
3
|
-
static readonly Date: ValueConverter<Date>;
|
|
4
|
-
static readonly DateOnly: ValueConverter<Date>;
|
|
5
|
-
static readonly DateOnlyString: ValueConverter<Date>;
|
|
6
|
-
static readonly Boolean: ValueConverter<Boolean>;
|
|
7
|
-
static readonly Number: ValueConverter<number>;
|
|
8
|
-
static readonly
|
|
9
|
-
static readonly
|
|
10
|
-
static readonly
|
|
11
|
-
static readonly
|
|
12
|
-
|
|
1
|
+
import { ValueConverter } from "./column-interfaces";
|
|
2
|
+
export declare class ValueConverters {
|
|
3
|
+
static readonly Date: ValueConverter<Date>;
|
|
4
|
+
static readonly DateOnly: ValueConverter<Date>;
|
|
5
|
+
static readonly DateOnlyString: ValueConverter<Date>;
|
|
6
|
+
static readonly Boolean: ValueConverter<Boolean>;
|
|
7
|
+
static readonly Number: ValueConverter<number>;
|
|
8
|
+
static readonly String: ValueConverter<String>;
|
|
9
|
+
static readonly Integer: ValueConverter<number>;
|
|
10
|
+
static readonly Default: Required<ValueConverter<any>>;
|
|
11
|
+
static readonly JsonString: ValueConverter<any>;
|
|
12
|
+
static readonly JsonValue: ValueConverter<any>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { InputTypes } from "../inputTypes";
|
|
2
|
+
export class ValueConverters {
|
|
3
|
+
static Date = {
|
|
4
|
+
toJson: (val) => {
|
|
5
|
+
if (val === null)
|
|
6
|
+
return null;
|
|
7
|
+
if (!val)
|
|
8
|
+
return '';
|
|
9
|
+
if (typeof (val) === "string")
|
|
10
|
+
val = new Date(val);
|
|
11
|
+
if (val instanceof Date) {
|
|
12
|
+
return val.toISOString();
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
throw new Error("Expected date but got " + val);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
fromJson: (val) => {
|
|
19
|
+
if (val === null)
|
|
20
|
+
return null;
|
|
21
|
+
if (val == undefined)
|
|
22
|
+
return undefined;
|
|
23
|
+
if (val == '')
|
|
24
|
+
return undefined;
|
|
25
|
+
if (val.startsWith('0000-00-00'))
|
|
26
|
+
return undefined;
|
|
27
|
+
return new Date(Date.parse(val));
|
|
28
|
+
},
|
|
29
|
+
toDb: x => x,
|
|
30
|
+
fromDb: val => {
|
|
31
|
+
if (typeof val === "number")
|
|
32
|
+
val = new Date(val);
|
|
33
|
+
if (typeof (val) === "string")
|
|
34
|
+
val = new Date(val);
|
|
35
|
+
if (val && !(val instanceof Date))
|
|
36
|
+
throw "expected date but got " + val;
|
|
37
|
+
return val;
|
|
38
|
+
},
|
|
39
|
+
fromInput: x => ValueConverters.Date.fromJson(x),
|
|
40
|
+
toInput: x => ValueConverters.Date.toJson(x),
|
|
41
|
+
displayValue: (val) => {
|
|
42
|
+
if (!val)
|
|
43
|
+
return '';
|
|
44
|
+
return val.toLocaleString();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
static DateOnly = {
|
|
48
|
+
fromInput: x => ValueConverters.DateOnly.fromJson(x),
|
|
49
|
+
toInput: x => ValueConverters.DateOnly.toJson(x),
|
|
50
|
+
toJson: (val) => {
|
|
51
|
+
var d = val;
|
|
52
|
+
if (typeof d === "string" || typeof (d) === "number")
|
|
53
|
+
d = new Date(d);
|
|
54
|
+
if (!d || d == null)
|
|
55
|
+
return null;
|
|
56
|
+
if (d.getHours() == 0)
|
|
57
|
+
return new Date(d.valueOf() - d.getTimezoneOffset() * 60000).toISOString().substring(0, 10);
|
|
58
|
+
else
|
|
59
|
+
return d.toISOString().substring(0, 10);
|
|
60
|
+
},
|
|
61
|
+
fromJson: (value) => {
|
|
62
|
+
if (!value || value == '' || value == '0000-00-00')
|
|
63
|
+
return null;
|
|
64
|
+
let d = new Date(Date.parse(value));
|
|
65
|
+
d.setMinutes(d.getMinutes() + d.getTimezoneOffset());
|
|
66
|
+
return d;
|
|
67
|
+
},
|
|
68
|
+
inputType: InputTypes.date,
|
|
69
|
+
toDb: (val) => {
|
|
70
|
+
if (!val)
|
|
71
|
+
return null;
|
|
72
|
+
return ValueConverters.DateOnly.fromJson(ValueConverters.DateOnly.toJson(val));
|
|
73
|
+
} //when using date storage, the database expects and returns a date local and every where else we reflect on date iso
|
|
74
|
+
,
|
|
75
|
+
fromDb: (val) => {
|
|
76
|
+
return ValueConverters.Date.fromDb(val);
|
|
77
|
+
},
|
|
78
|
+
fieldTypeInDb: 'date',
|
|
79
|
+
displayValue: (value) => {
|
|
80
|
+
if (!value)
|
|
81
|
+
return '';
|
|
82
|
+
return value.toLocaleDateString(undefined);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
static DateOnlyString = {
|
|
86
|
+
...ValueConverters.DateOnly,
|
|
87
|
+
toDb: (d) => {
|
|
88
|
+
let val = ValueConverters.DateOnly.toJson(d);
|
|
89
|
+
if (!val)
|
|
90
|
+
return undefined;
|
|
91
|
+
return val.replace(/-/g, '');
|
|
92
|
+
},
|
|
93
|
+
fromDb: (val) => {
|
|
94
|
+
if (val === null)
|
|
95
|
+
return null;
|
|
96
|
+
if (!val)
|
|
97
|
+
return undefined;
|
|
98
|
+
return new Date(val.substring(0, 4) + '-' + val.substring(4, 6) + '-' + val.substring(6, 8));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
static Boolean = {
|
|
102
|
+
toDb: (val) => val,
|
|
103
|
+
inputType: InputTypes.checkbox,
|
|
104
|
+
fromDb: (value) => {
|
|
105
|
+
return ValueConverters.Boolean.fromJson(value);
|
|
106
|
+
},
|
|
107
|
+
fromJson: value => {
|
|
108
|
+
if (typeof value === "boolean")
|
|
109
|
+
return value;
|
|
110
|
+
if (value === 1)
|
|
111
|
+
return true;
|
|
112
|
+
if (value !== undefined && value !== null) {
|
|
113
|
+
return value.toString().trim().toLowerCase() == 'true';
|
|
114
|
+
}
|
|
115
|
+
return value;
|
|
116
|
+
},
|
|
117
|
+
toJson: x => x,
|
|
118
|
+
fromInput: x => ValueConverters.Boolean.fromJson(x),
|
|
119
|
+
toInput: x => ValueConverters.Boolean.toJson(x)
|
|
120
|
+
};
|
|
121
|
+
static Number = {
|
|
122
|
+
fromDb: value => {
|
|
123
|
+
if (value === null)
|
|
124
|
+
return null;
|
|
125
|
+
if (value !== undefined)
|
|
126
|
+
return +value;
|
|
127
|
+
return undefined;
|
|
128
|
+
},
|
|
129
|
+
toDb: value => value,
|
|
130
|
+
fromJson: value => ValueConverters.Number.fromDb(value),
|
|
131
|
+
toJson: value => ValueConverters.Number.toDb(value),
|
|
132
|
+
fromInput: (x, type) => {
|
|
133
|
+
let r = +x;
|
|
134
|
+
if (!x)
|
|
135
|
+
return undefined;
|
|
136
|
+
return r;
|
|
137
|
+
},
|
|
138
|
+
toInput: (x, type) => {
|
|
139
|
+
return x?.toString();
|
|
140
|
+
},
|
|
141
|
+
inputType: InputTypes.number
|
|
142
|
+
};
|
|
143
|
+
static String = {
|
|
144
|
+
fromDb: enforceString,
|
|
145
|
+
toDb: enforceString,
|
|
146
|
+
fromJson: enforceString,
|
|
147
|
+
toJson: enforceString,
|
|
148
|
+
fromInput: enforceString,
|
|
149
|
+
toInput: enforceString,
|
|
150
|
+
};
|
|
151
|
+
static Integer = {
|
|
152
|
+
...ValueConverters.Number,
|
|
153
|
+
toJson: value => {
|
|
154
|
+
let val = ValueConverters.Number.toDb(value);
|
|
155
|
+
if (!val)
|
|
156
|
+
return val;
|
|
157
|
+
return +(+val).toFixed(0);
|
|
158
|
+
},
|
|
159
|
+
toDb: value => ValueConverters.Integer.toJson(value),
|
|
160
|
+
fieldTypeInDb: 'integer'
|
|
161
|
+
};
|
|
162
|
+
static Default = {
|
|
163
|
+
fromJson: x => x,
|
|
164
|
+
toJson: x => x,
|
|
165
|
+
fromDb: x => ValueConverters.JsonString.fromDb(x),
|
|
166
|
+
toDb: x => ValueConverters.JsonString.toDb(x),
|
|
167
|
+
fromInput: x => ValueConverters.Default.fromJson(x),
|
|
168
|
+
toInput: x => ValueConverters.Default.toJson(x),
|
|
169
|
+
displayValue: x => x + '',
|
|
170
|
+
fieldTypeInDb: '',
|
|
171
|
+
inputType: 'text'
|
|
172
|
+
};
|
|
173
|
+
static JsonString = {
|
|
174
|
+
fromJson: x => x,
|
|
175
|
+
toJson: x => x,
|
|
176
|
+
fromDb: x => x == null ? null : x ? JSON.parse(ValueConverters.JsonString.fromJson(x)) : undefined,
|
|
177
|
+
toDb: x => x !== undefined ? x === null ? null : JSON.stringify(ValueConverters.JsonString.toJson(x)) : undefined,
|
|
178
|
+
fromInput: x => ValueConverters.JsonString.fromJson(x),
|
|
179
|
+
toInput: x => ValueConverters.JsonString.toJson(x)
|
|
180
|
+
};
|
|
181
|
+
static JsonValue = {
|
|
182
|
+
fromJson: x => x,
|
|
183
|
+
toJson: x => x,
|
|
184
|
+
fromDb: x => x,
|
|
185
|
+
toDb: x => x,
|
|
186
|
+
fromInput: x => ValueConverters.JsonString.fromJson(x),
|
|
187
|
+
toInput: x => ValueConverters.JsonString.toJson(x),
|
|
188
|
+
fieldTypeInDb: 'json'
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function enforceString(value) {
|
|
192
|
+
if (value === null || value === undefined)
|
|
193
|
+
return value;
|
|
194
|
+
if (typeof (value) !== "string")
|
|
195
|
+
return value.toString();
|
|
196
|
+
return value;
|
|
197
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class UrlBuilder {
|
|
2
|
+
url;
|
|
3
|
+
constructor(url) {
|
|
4
|
+
this.url = url;
|
|
5
|
+
}
|
|
6
|
+
add(key, value) {
|
|
7
|
+
if (this.url.indexOf('?') >= 0)
|
|
8
|
+
this.url += '&';
|
|
9
|
+
else
|
|
10
|
+
this.url += '?';
|
|
11
|
+
this.url += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
|
12
|
+
}
|
|
13
|
+
addObject(object, suffix = '') {
|
|
14
|
+
if (object != undefined)
|
|
15
|
+
for (var key in object) {
|
|
16
|
+
let val = object[key];
|
|
17
|
+
this.add(key + suffix, val);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
package/esm/graphql.js
CHANGED
|
@@ -208,16 +208,16 @@ export function remultGraphql(options) {
|
|
|
208
208
|
{
|
|
209
209
|
key: 'limit',
|
|
210
210
|
value: 'Int',
|
|
211
|
-
comment: `
|
|
212
|
-
For **page by page** pagination.
|
|
213
|
-
Limit the number of result.
|
|
211
|
+
comment: `
|
|
212
|
+
For **page by page** pagination.
|
|
213
|
+
Limit the number of result.
|
|
214
214
|
_Side note: \`Math.ceil(totalCount / limit)\` to determine how many pages there are._`,
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
key: 'page',
|
|
218
218
|
value: 'Int',
|
|
219
|
-
comment: `
|
|
220
|
-
For **page by page** pagination.
|
|
219
|
+
comment: `
|
|
220
|
+
For **page by page** pagination.
|
|
221
221
|
Select a dedicated page.`,
|
|
222
222
|
},
|
|
223
223
|
{
|
|
@@ -235,26 +235,26 @@ Select a dedicated page.`,
|
|
|
235
235
|
queryArgsConnection.push({
|
|
236
236
|
key: 'first',
|
|
237
237
|
value: 'Int',
|
|
238
|
-
comment: `
|
|
239
|
-
For **forward cursor** pagination
|
|
238
|
+
comment: `
|
|
239
|
+
For **forward cursor** pagination
|
|
240
240
|
Takes the \`first\`: \`n\` elements from the list.`,
|
|
241
241
|
}, {
|
|
242
242
|
key: 'after',
|
|
243
243
|
value: 'String',
|
|
244
|
-
comment: `
|
|
245
|
-
For **forward cursor** pagination
|
|
244
|
+
comment: `
|
|
245
|
+
For **forward cursor** pagination
|
|
246
246
|
\`after\` this \`cursor\`.`,
|
|
247
247
|
}, {
|
|
248
248
|
key: 'last',
|
|
249
249
|
value: 'Int',
|
|
250
|
-
comment: `
|
|
251
|
-
For **backward cursor** pagination
|
|
250
|
+
comment: `
|
|
251
|
+
For **backward cursor** pagination
|
|
252
252
|
Takes the \`last\`: \`n\` elements from the list.`,
|
|
253
253
|
}, {
|
|
254
254
|
key: 'before',
|
|
255
255
|
value: 'String',
|
|
256
|
-
comment: `
|
|
257
|
-
For **backward cursor** pagination
|
|
256
|
+
comment: `
|
|
257
|
+
For **backward cursor** pagination
|
|
258
258
|
\`before\` this \`cursor\`.`,
|
|
259
259
|
});
|
|
260
260
|
}
|
|
@@ -668,7 +668,7 @@ Select a dedicated page.`,
|
|
|
668
668
|
: ``;
|
|
669
669
|
return `${type}${orderByStr}${whereTypeStr}${whereTypeSubFieldsStr}`;
|
|
670
670
|
})
|
|
671
|
-
.join(`\n\n`)}
|
|
671
|
+
.join(`\n\n`)}
|
|
672
672
|
`,
|
|
673
673
|
};
|
|
674
674
|
}
|
|
@@ -690,12 +690,12 @@ function blockFormat(obj) {
|
|
|
690
690
|
if (obj.data.length === 0) {
|
|
691
691
|
return ``;
|
|
692
692
|
}
|
|
693
|
-
const str = `${obj.prefix} {
|
|
694
|
-
${obj.data.join('\n ')}
|
|
693
|
+
const str = `${obj.prefix} {
|
|
694
|
+
${obj.data.join('\n ')}
|
|
695
695
|
}`;
|
|
696
|
-
let commentsStr = `"""
|
|
697
|
-
${obj.comment}
|
|
698
|
-
"""
|
|
696
|
+
let commentsStr = `"""
|
|
697
|
+
${obj.comment}
|
|
698
|
+
"""
|
|
699
699
|
`;
|
|
700
700
|
if (_removeComments) {
|
|
701
701
|
commentsStr = ``;
|
|
@@ -706,16 +706,16 @@ function argsFormat(args) {
|
|
|
706
706
|
if (args) {
|
|
707
707
|
return `(${args
|
|
708
708
|
.map((arg) => {
|
|
709
|
-
let strComment = `
|
|
710
|
-
"""
|
|
711
|
-
${arg.comment}
|
|
712
|
-
"""
|
|
709
|
+
let strComment = `
|
|
710
|
+
"""
|
|
711
|
+
${arg.comment}
|
|
712
|
+
"""
|
|
713
713
|
`;
|
|
714
714
|
if (_removeComments || !arg.comment) {
|
|
715
715
|
strComment = ``;
|
|
716
716
|
}
|
|
717
717
|
if (strComment) {
|
|
718
|
-
return `${strComment} ${arg.key}: ${arg.value}
|
|
718
|
+
return `${strComment} ${arg.key}: ${arg.value}
|
|
719
719
|
`;
|
|
720
720
|
}
|
|
721
721
|
return `${arg.key}: ${arg.value}`;
|
|
@@ -726,9 +726,9 @@ function argsFormat(args) {
|
|
|
726
726
|
}
|
|
727
727
|
function fieldFormat(field) {
|
|
728
728
|
// First, the comment
|
|
729
|
-
let strComment = `"""
|
|
730
|
-
${field.comment}
|
|
731
|
-
"""
|
|
729
|
+
let strComment = `"""
|
|
730
|
+
${field.comment}
|
|
731
|
+
"""
|
|
732
732
|
`;
|
|
733
733
|
if (_removeComments || !field.comment) {
|
|
734
734
|
strComment = ``;
|