remult 0.26.23 → 0.27.0
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/SseSubscriptionServer.d.ts +3 -4
- package/assign.js +1 -2
- package/esm/graphql.js +1 -1
- package/esm/remult-hono.js +3 -1
- package/esm/remult-knex/index.js +3 -1
- package/esm/remult-sqlite3.js +4 -1
- package/esm/remult-sveltekit.js +1 -0
- package/esm/server/index.js +3 -2
- package/esm/server/initAsyncHooks.js +3 -3
- package/esm/server/remult-admin.js +1 -4
- package/esm/server/remult-api-server.js +47 -48
- package/esm/src/CompoundIdField.js +9 -9
- package/esm/src/data-api.js +1 -1
- package/esm/src/data-providers/json-entity-opfs-storage.js +9 -5
- package/esm/src/data-providers/sql-database.js +9 -9
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +3 -1
- package/esm/src/filter/filter-interfaces.js +1 -1
- package/esm/src/live-query/LiveQueryClient.js +0 -1
- package/esm/src/remult-proxy.js +1 -3
- package/esm/src/remult-static.js +1 -0
- package/esm/src/remult3/Fields.js +15 -7
- package/esm/src/remult3/RepositoryImplementation.js +165 -125
- package/esm/src/remult3/entity.js +1 -1
- package/esm/src/remult3/relation-loader.js +2 -2
- package/esm/src/remult3/remult3.js +15 -0
- package/esm/src/server-action.js +16 -12
- package/esm/src/sort.js +0 -2
- package/esm/src/validators.js +3 -3
- package/esm/src/valueConverters.js +2 -2
- package/graphql.js +3 -4
- package/index.js +2 -2
- package/live-query/data-provider-live-query-storage.js +6 -6
- package/migrations/compare-migration-snapshots.js +48 -49
- package/migrations/generate-migrations.js +1 -2
- package/migrations/migrate.js +2 -3
- package/migrations/migration-types.d.ts +1 -1
- package/migrations/migration-types.js +4 -4
- package/migrations/update-migrations-ts-file.js +1 -2
- package/myLog.js +1 -2
- package/package.json +1 -1
- package/postgres/postgres-data-provider.d.ts +2 -2
- package/postgres/postgres-data-provider.js +5 -5
- package/postgres/schema-builder.d.ts +1 -1
- package/postgres/schema-builder.js +3 -3
- package/remult-express.js +4 -3
- package/remult-fastify.js +4 -3
- package/remult-fresh.js +1 -2
- package/remult-hapi.js +4 -3
- package/remult-hono.js +6 -3
- package/remult-knex/index.d.ts +2 -2
- package/remult-knex/index.js +7 -5
- package/remult-mongo.d.ts +1 -1
- package/remult-next.d.ts +5 -6
- package/remult-next.js +11 -6
- package/remult-nuxt.js +1 -2
- package/remult-solid-start.js +1 -2
- package/remult-sqlite3.js +4 -1
- package/remult-sveltekit.d.ts +1 -1
- package/remult-sveltekit.js +33 -35
- package/server/JsonEntityFileStorage.d.ts +1 -1
- package/server/get-remult-admin-html.js +1 -2
- package/server/index.js +4 -3
- package/server/initAsyncHooks.d.ts +10 -10
- package/server/initAsyncHooks.js +5 -2
- package/server/initDataProvider.js +1 -2
- package/server/initDataProviderOrJson.js +1 -2
- package/server/remult-admin.js +3 -7
- package/server/remult-api-server.d.ts +21 -21
- package/server/remult-api-server.js +54 -48
- package/src/CompoundIdField.d.ts +2 -2
- package/src/CompoundIdField.js +9 -0
- package/src/buildRestDataProvider.d.ts +1 -1
- package/src/buildRestDataProvider.js +8 -8
- package/src/column-interfaces.d.ts +4 -4
- package/src/column-interfaces.js +1 -2
- package/src/column.d.ts +4 -4
- package/src/column.js +2 -2
- package/src/context.d.ts +4 -4
- package/src/context.js +5 -5
- package/src/data-api.d.ts +4 -4
- package/src/data-api.js +4 -4
- package/src/data-interfaces.d.ts +1 -1
- package/src/data-interfaces.js +1 -2
- package/src/data-providers/json-entity-opfs-storage.js +30 -16
- package/src/data-providers/rest-data-provider.d.ts +3 -3
- package/src/data-providers/rest-data-provider.js +4 -4
- package/src/data-providers/sql-database.d.ts +1 -1
- package/src/data-providers/sql-database.js +11 -11
- package/src/data-providers/web-sql-data-provider.d.ts +2 -2
- package/src/entity.d.ts +1 -1
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +3 -3
- package/src/filter/filter-consumer-bridge-to-sql-request.js +21 -19
- package/src/filter/filter-interfaces.d.ts +2 -1
- package/src/filter/filter-interfaces.js +10 -7
- package/src/isOfType.js +2 -3
- package/src/live-query/SubscriptionServer.js +95 -97
- package/src/remult-proxy.js +1 -3
- package/src/remult-static.d.ts +2 -2
- package/src/remult-static.js +7 -4
- package/src/remult3/Fields.d.ts +17 -17
- package/src/remult3/Fields.js +22 -13
- package/src/remult3/RepositoryImplementation.d.ts +51 -46
- package/src/remult3/RepositoryImplementation.js +421 -368
- package/src/remult3/__updateEntityBasedOnWhere.js +1 -2
- package/src/remult3/addValidator.d.ts +1 -1
- package/src/remult3/addValidator.js +1 -2
- package/src/remult3/classDescribers.d.ts +4 -4
- package/src/remult3/classDescribers.js +3 -4
- package/src/remult3/columnInfo.d.ts +1 -1
- package/src/remult3/entity.js +2 -4
- package/src/remult3/getEntityRef.js +4 -4
- package/src/remult3/relation-loader.d.ts +1 -1
- package/src/remult3/relationInfoMember.d.ts +3 -3
- package/src/remult3/relationInfoMember.js +4 -5
- package/src/remult3/remult3.d.ts +23 -20
- package/src/remult3/remult3.js +15 -0
- package/src/remult3/repository-internals.d.ts +3 -3
- package/src/remult3/repository-internals.js +2 -2
- package/src/server-action.d.ts +2 -2
- package/src/server-action.js +65 -58
- package/src/sort.d.ts +1 -1
- package/src/sort.js +0 -2
- package/src/sql-command.d.ts +1 -1
- package/src/validators.d.ts +1 -1
- package/src/validators.js +13 -11
- package/src/valueConverters.js +3 -2
package/server/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.JsonFileDataProvider = exports.JsonEntityFileStorage = exports.DataProviderLiveQueryStorage = exports.SseSubscriptionServer = void 0;
|
|
4
|
+
exports.createRemultServer = createRemultServer;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var remult_api_server_js_1 = require("./remult-api-server.js");
|
|
6
7
|
var initAsyncHooks_js_1 = require("./initAsyncHooks.js");
|
|
8
|
+
var isOfType_js_1 = require("../src/isOfType.js");
|
|
7
9
|
var SseSubscriptionServer_js_1 = require("../SseSubscriptionServer.js");
|
|
8
10
|
Object.defineProperty(exports, "SseSubscriptionServer", { enumerable: true, get: function () { return SseSubscriptionServer_js_1.SseSubscriptionServer; } });
|
|
9
11
|
var data_provider_live_query_storage_js_1 = require("../live-query/data-provider-live-query-storage.js");
|
|
@@ -15,10 +17,9 @@ function createRemultServer(options, serverCoreOptions) {
|
|
|
15
17
|
var _this = this;
|
|
16
18
|
(0, initAsyncHooks_js_1.initAsyncHooks)();
|
|
17
19
|
return (0, remult_api_server_js_1.createRemultServerCore)(options, serverCoreOptions || {
|
|
18
|
-
buildGenericRequestInfo: function (req) { return req; },
|
|
20
|
+
buildGenericRequestInfo: function (req) { return (0, isOfType_js_1.cast)(req, 'method'); },
|
|
19
21
|
getRequestBody: function (req) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
|
|
20
22
|
return [2 /*return*/, req.body];
|
|
21
23
|
}); }); },
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
exports.createRemultServer = createRemultServer;
|
|
@@ -2,23 +2,23 @@ import { type RemultAsyncLocalStorageCore } from '../src/context.js';
|
|
|
2
2
|
export declare function initAsyncHooks(): void;
|
|
3
3
|
export declare class AsyncLocalStorageBridgeToRemultAsyncLocalStorageCoreImpl<T> implements RemultAsyncLocalStorageCore<T> {
|
|
4
4
|
private asyncLocalStorage;
|
|
5
|
-
wasImplemented:
|
|
5
|
+
wasImplemented: "yes";
|
|
6
6
|
run<R>(store: T, callback: () => Promise<R>): Promise<R>;
|
|
7
|
-
getStore(): T;
|
|
7
|
+
getStore(): T | undefined;
|
|
8
8
|
}
|
|
9
9
|
export declare class SequentialRemultAsyncLocalStorageCore<T> implements RemultAsyncLocalStorageCore<T> {
|
|
10
|
-
wasImplemented:
|
|
10
|
+
wasImplemented: "yes";
|
|
11
11
|
run<R>(store: T, callback: () => Promise<R>): Promise<R>;
|
|
12
|
-
getStore(): T;
|
|
13
|
-
lastPromise: Promise<T>;
|
|
14
|
-
currentValue
|
|
12
|
+
getStore(): T | undefined;
|
|
13
|
+
lastPromise: Promise<T | undefined>;
|
|
14
|
+
currentValue?: T;
|
|
15
15
|
}
|
|
16
16
|
export declare class StubRemultAsyncLocalStorageCore<T> implements RemultAsyncLocalStorageCore<T> {
|
|
17
|
-
wasImplemented:
|
|
17
|
+
wasImplemented: "yes";
|
|
18
18
|
run<R>(store: T, callback: () => Promise<R>): Promise<R>;
|
|
19
|
-
getStore(): T;
|
|
20
|
-
lastPromise: Promise<T>;
|
|
21
|
-
currentValue
|
|
19
|
+
getStore(): T | undefined;
|
|
20
|
+
lastPromise: Promise<T | undefined>;
|
|
21
|
+
currentValue?: T;
|
|
22
22
|
}
|
|
23
23
|
export declare class AsyncLocalStorageBridgeToRemultAsyncLocalStorageCore<T> extends AsyncLocalStorageBridgeToRemultAsyncLocalStorageCoreImpl<T> {
|
|
24
24
|
}
|
package/server/initAsyncHooks.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AsyncLocalStorageBridgeToRemultAsyncLocalStorageCore = exports.StubRemultAsyncLocalStorageCore = exports.SequentialRemultAsyncLocalStorageCore = exports.AsyncLocalStorageBridgeToRemultAsyncLocalStorageCoreImpl =
|
|
3
|
+
exports.AsyncLocalStorageBridgeToRemultAsyncLocalStorageCore = exports.StubRemultAsyncLocalStorageCore = exports.SequentialRemultAsyncLocalStorageCore = exports.AsyncLocalStorageBridgeToRemultAsyncLocalStorageCoreImpl = void 0;
|
|
4
|
+
exports.initAsyncHooks = initAsyncHooks;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var async_hooks_1 = require("async_hooks");
|
|
6
7
|
var context_js_1 = require("../src/context.js");
|
|
@@ -28,10 +29,10 @@ function initAsyncHooks() {
|
|
|
28
29
|
});
|
|
29
30
|
}); });
|
|
30
31
|
}
|
|
31
|
-
exports.initAsyncHooks = initAsyncHooks;
|
|
32
32
|
var AsyncLocalStorageBridgeToRemultAsyncLocalStorageCoreImpl = /** @class */ (function () {
|
|
33
33
|
function AsyncLocalStorageBridgeToRemultAsyncLocalStorageCoreImpl() {
|
|
34
34
|
this.asyncLocalStorage = new async_hooks_1.AsyncLocalStorage();
|
|
35
|
+
this.wasImplemented = 'yes';
|
|
35
36
|
}
|
|
36
37
|
AsyncLocalStorageBridgeToRemultAsyncLocalStorageCoreImpl.prototype.run = function (store, callback) {
|
|
37
38
|
var _this = this;
|
|
@@ -73,6 +74,7 @@ var ignoreInStack = [
|
|
|
73
74
|
];
|
|
74
75
|
var SequentialRemultAsyncLocalStorageCore = /** @class */ (function () {
|
|
75
76
|
function SequentialRemultAsyncLocalStorageCore() {
|
|
77
|
+
this.wasImplemented = 'yes';
|
|
76
78
|
this.lastPromise = Promise.resolve(undefined);
|
|
77
79
|
}
|
|
78
80
|
SequentialRemultAsyncLocalStorageCore.prototype.run = function (store, callback) {
|
|
@@ -138,6 +140,7 @@ var SequentialRemultAsyncLocalStorageCore = /** @class */ (function () {
|
|
|
138
140
|
exports.SequentialRemultAsyncLocalStorageCore = SequentialRemultAsyncLocalStorageCore;
|
|
139
141
|
var StubRemultAsyncLocalStorageCore = /** @class */ (function () {
|
|
140
142
|
function StubRemultAsyncLocalStorageCore() {
|
|
143
|
+
this.wasImplemented = 'yes';
|
|
141
144
|
this.lastPromise = Promise.resolve(undefined);
|
|
142
145
|
}
|
|
143
146
|
StubRemultAsyncLocalStorageCore.prototype.run = function (store, callback) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initDataProvider =
|
|
3
|
+
exports.initDataProvider = initDataProvider;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var remult_static_js_1 = require("../src/remult-static.js");
|
|
6
6
|
function initDataProvider(optionsDataProvider, useStaticDefault, defaultDataProvider) {
|
|
@@ -31,4 +31,3 @@ function initDataProvider(optionsDataProvider, useStaticDefault, defaultDataProv
|
|
|
31
31
|
}); });
|
|
32
32
|
return dataProvider;
|
|
33
33
|
}
|
|
34
|
-
exports.initDataProvider = initDataProvider;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initDataProviderOrJson =
|
|
3
|
+
exports.initDataProviderOrJson = initDataProviderOrJson;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var initDataProvider_js_1 = require("./initDataProvider.js");
|
|
6
6
|
function initDataProviderOrJson(dataProvider) {
|
|
@@ -14,4 +14,3 @@ function initDataProviderOrJson(dataProvider) {
|
|
|
14
14
|
});
|
|
15
15
|
}); });
|
|
16
16
|
}
|
|
17
|
-
exports.initDataProviderOrJson = initDataProviderOrJson;
|
package/server/remult-admin.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.default = remultAdminHtml;
|
|
4
|
+
exports.buildEntityInfo = buildEntityInfo;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var relationInfoMember_js_1 = require("../src/remult3/relationInfoMember.js");
|
|
6
7
|
var filter_interfaces_js_1 = require("../src/filter/filter-interfaces.js");
|
|
7
8
|
var get_remult_admin_html_js_1 = require("./get-remult-admin-html.js");
|
|
8
9
|
var RepositoryImplementation_js_1 = require("../src/remult3/RepositoryImplementation.js");
|
|
9
10
|
function remultAdminHtml(options) {
|
|
10
|
-
var
|
|
11
|
-
//@ts-ignore
|
|
12
|
-
delete optionsFromServer.entities;
|
|
13
|
-
delete optionsFromServer.remult;
|
|
11
|
+
var _a = tslib_1.__assign({}, options), remult = _a.remult, entities = _a.entities, optionsFromServer = tslib_1.__rest(_a, ["remult", "entities"]);
|
|
14
12
|
return (0, get_remult_admin_html_js_1.getHtml)().replace('<!--PLACE_HERE-->', "<script >const entities = ".concat(JSON.stringify(buildEntityInfo(options)), "\n const optionsFromServer = ").concat(JSON.stringify(optionsFromServer), "\n </script>"));
|
|
15
13
|
}
|
|
16
|
-
exports.default = remultAdminHtml;
|
|
17
14
|
function buildEntityInfo(options) {
|
|
18
15
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
19
16
|
var _d;
|
|
@@ -118,4 +115,3 @@ function buildEntityInfo(options) {
|
|
|
118
115
|
}
|
|
119
116
|
return entities;
|
|
120
117
|
}
|
|
121
|
-
exports.buildEntityInfo = buildEntityInfo;
|
|
@@ -80,28 +80,28 @@ export interface RemultServerOptions<RequestType> {
|
|
|
80
80
|
* })
|
|
81
81
|
*/
|
|
82
82
|
error?: (info: {
|
|
83
|
-
req
|
|
83
|
+
req?: RequestType;
|
|
84
84
|
entity?: EntityMetadata;
|
|
85
85
|
exception?: any;
|
|
86
86
|
httpStatusCode: number;
|
|
87
87
|
responseBody: any;
|
|
88
88
|
sendError: (httpStatusCode: number, body: any) => void;
|
|
89
|
-
}) => Promise<void
|
|
89
|
+
}) => Promise<void> | undefined;
|
|
90
90
|
}
|
|
91
91
|
export interface InitRequestOptions {
|
|
92
92
|
liveQueryStorage: LiveQueryStorage;
|
|
93
93
|
readonly remult: Remult;
|
|
94
94
|
}
|
|
95
95
|
export declare function createRemultServerCore<RequestType>(options: RemultServerOptions<RequestType>, serverCoreOptions: ServerCoreOptions<RequestType>): RemultServer<RequestType>;
|
|
96
|
-
export type GenericRequestHandler = (req:
|
|
96
|
+
export type GenericRequestHandler<RequestType> = (req: RequestType, res: GenericResponse, next: VoidFunction) => void;
|
|
97
97
|
export interface ServerHandleResponse {
|
|
98
98
|
data?: any;
|
|
99
99
|
html?: string;
|
|
100
100
|
statusCode: number;
|
|
101
101
|
}
|
|
102
102
|
export interface RemultServer<RequestType> extends RemultServerCore<RequestType> {
|
|
103
|
-
withRemult(req: RequestType, res: GenericResponse, next: VoidFunction):
|
|
104
|
-
registerRouter(r: GenericRouter): void;
|
|
103
|
+
withRemult(req: RequestType, res: GenericResponse, next: VoidFunction): void;
|
|
104
|
+
registerRouter(r: GenericRouter<RequestType>): void;
|
|
105
105
|
handle(req: RequestType, gRes?: GenericResponse): Promise<ServerHandleResponse | undefined>;
|
|
106
106
|
withRemultAsync<T>(request: RequestType | undefined, what: () => Promise<T>): Promise<T>;
|
|
107
107
|
}
|
|
@@ -112,14 +112,14 @@ export interface RemultServerCore<RequestType> {
|
|
|
112
112
|
version?: string;
|
|
113
113
|
}): any;
|
|
114
114
|
}
|
|
115
|
-
export type GenericRouter = {
|
|
116
|
-
route(path: string): SpecificRoute
|
|
115
|
+
export type GenericRouter<RequestType> = {
|
|
116
|
+
route(path: string): SpecificRoute<RequestType>;
|
|
117
117
|
};
|
|
118
|
-
export type SpecificRoute = {
|
|
119
|
-
get(handler: GenericRequestHandler): SpecificRoute
|
|
120
|
-
put(handler: GenericRequestHandler): SpecificRoute
|
|
121
|
-
post(handler: GenericRequestHandler): SpecificRoute
|
|
122
|
-
delete(handler: GenericRequestHandler): SpecificRoute
|
|
118
|
+
export type SpecificRoute<RequestType> = {
|
|
119
|
+
get(handler: GenericRequestHandler<RequestType>): SpecificRoute<RequestType>;
|
|
120
|
+
put(handler: GenericRequestHandler<RequestType>): SpecificRoute<RequestType>;
|
|
121
|
+
post(handler: GenericRequestHandler<RequestType>): SpecificRoute<RequestType>;
|
|
122
|
+
delete(handler: GenericRequestHandler<RequestType>): SpecificRoute<RequestType>;
|
|
123
123
|
};
|
|
124
124
|
export interface GenericRequestInfo {
|
|
125
125
|
url?: string;
|
|
@@ -128,10 +128,10 @@ export interface GenericRequestInfo {
|
|
|
128
128
|
params?: any;
|
|
129
129
|
}
|
|
130
130
|
export interface GenericResponse {
|
|
131
|
-
json(data: any):
|
|
132
|
-
send(html: string):
|
|
131
|
+
json(data: any): void;
|
|
132
|
+
send(html: string): void;
|
|
133
133
|
status(statusCode: number): GenericResponse;
|
|
134
|
-
end():
|
|
134
|
+
end(): void;
|
|
135
135
|
}
|
|
136
136
|
export interface queuedJobInfo {
|
|
137
137
|
info: queuedJobInfoResponse;
|
|
@@ -141,7 +141,7 @@ export interface queuedJobInfo {
|
|
|
141
141
|
setProgress(progress: number): void;
|
|
142
142
|
}
|
|
143
143
|
export interface QueueStorage {
|
|
144
|
-
createJob(url: string, userId
|
|
144
|
+
createJob(url: string, userId?: string): Promise<string>;
|
|
145
145
|
getJobInfo(queuedJobId: string): Promise<queuedJobInfo>;
|
|
146
146
|
}
|
|
147
147
|
export declare class EntityQueueStorage implements QueueStorage {
|
|
@@ -155,20 +155,20 @@ export declare class EntityQueueStorage implements QueueStorage {
|
|
|
155
155
|
export declare class RouteImplementation<RequestType> {
|
|
156
156
|
private coreOptions;
|
|
157
157
|
constructor(coreOptions: ServerCoreOptions<RequestType>);
|
|
158
|
-
map: Map<string, Map<string, GenericRequestHandler
|
|
158
|
+
map: Map<string, Map<string, GenericRequestHandler<RequestType>>>;
|
|
159
159
|
starRoutes: {
|
|
160
160
|
route: string;
|
|
161
|
-
handler: Map<string, GenericRequestHandler
|
|
161
|
+
handler: Map<string, GenericRequestHandler<RequestType>>;
|
|
162
162
|
}[];
|
|
163
|
-
route(path: string): SpecificRoute
|
|
163
|
+
route(path: string): SpecificRoute<RequestType>;
|
|
164
164
|
handle(req: RequestType, gRes?: GenericResponse): Promise<ServerHandleResponse | undefined>;
|
|
165
165
|
middleware(origReq: RequestType, res: GenericResponse, next: VoidFunction): void;
|
|
166
166
|
}
|
|
167
167
|
export declare class JobsInQueueEntity extends IdEntity {
|
|
168
168
|
userId: string;
|
|
169
169
|
url: string;
|
|
170
|
-
submitTime
|
|
171
|
-
doneTime
|
|
170
|
+
submitTime?: Date;
|
|
171
|
+
doneTime?: Date;
|
|
172
172
|
result: string;
|
|
173
173
|
done: boolean;
|
|
174
174
|
error: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JobsInQueueEntity = exports.RouteImplementation = exports.EntityQueueStorage = exports.RemultServerImplementation =
|
|
3
|
+
exports.JobsInQueueEntity = exports.RouteImplementation = exports.EntityQueueStorage = exports.RemultServerImplementation = void 0;
|
|
4
|
+
exports.createRemultServerCore = createRemultServerCore;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var SseSubscriptionServer_js_1 = require("../SseSubscriptionServer.js");
|
|
6
7
|
var context_js_1 = require("../src/context.js");
|
|
@@ -18,43 +19,40 @@ var remult_admin_js_1 = tslib_1.__importDefault(require("./remult-admin.js"));
|
|
|
18
19
|
var isOfType_js_1 = require("../src/isOfType.js");
|
|
19
20
|
var initDataProviderOrJson_js_1 = require("./initDataProviderOrJson.js");
|
|
20
21
|
function createRemultServerCore(options, serverCoreOptions) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!options.subscriptionServer) {
|
|
25
|
-
options.subscriptionServer = new SseSubscriptionServer_js_1.SseSubscriptionServer();
|
|
22
|
+
var safeOptions = options !== null && options !== void 0 ? options : {};
|
|
23
|
+
if (!safeOptions.subscriptionServer) {
|
|
24
|
+
safeOptions.subscriptionServer = new SseSubscriptionServer_js_1.SseSubscriptionServer();
|
|
26
25
|
}
|
|
27
|
-
if (
|
|
28
|
-
|
|
26
|
+
if (safeOptions.logApiEndPoints === undefined)
|
|
27
|
+
safeOptions.logApiEndPoints = true;
|
|
29
28
|
remult_static_js_1.remultStatic.actionInfo.runningOnServer = true;
|
|
30
|
-
if (
|
|
31
|
-
data_api_js_1.DataApi.defaultGetLimit =
|
|
29
|
+
if (safeOptions.defaultGetLimit) {
|
|
30
|
+
data_api_js_1.DataApi.defaultGetLimit = safeOptions.defaultGetLimit;
|
|
32
31
|
}
|
|
33
|
-
if (!
|
|
34
|
-
|
|
32
|
+
if (!safeOptions.queueStorage) {
|
|
33
|
+
safeOptions.queueStorage = new InMemoryQueueStorage();
|
|
35
34
|
}
|
|
36
|
-
var dataProvider = (0, initDataProviderOrJson_js_1.initDataProviderOrJson)(
|
|
35
|
+
var dataProvider = (0, initDataProviderOrJson_js_1.initDataProviderOrJson)(safeOptions.dataProvider);
|
|
37
36
|
remult_static_js_1.remultStatic.defaultDataProvider = function () { return dataProvider; };
|
|
38
|
-
if (
|
|
39
|
-
|
|
37
|
+
if (safeOptions.ensureSchema === undefined)
|
|
38
|
+
safeOptions.ensureSchema = true;
|
|
40
39
|
context_js_1.RemultAsyncLocalStorage.enable();
|
|
41
40
|
{
|
|
42
41
|
var allControllers = [];
|
|
43
|
-
if (!
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
allControllers.push.apply(allControllers, tslib_1.__spreadArray([], tslib_1.__read(
|
|
47
|
-
if (
|
|
48
|
-
allControllers.push.apply(allControllers, tslib_1.__spreadArray([], tslib_1.__read(
|
|
49
|
-
|
|
42
|
+
if (!safeOptions.entities)
|
|
43
|
+
safeOptions.entities = tslib_1.__spreadArray([], tslib_1.__read(remult_static_js_1.remultStatic.allEntities), false);
|
|
44
|
+
if (safeOptions.entities)
|
|
45
|
+
allControllers.push.apply(allControllers, tslib_1.__spreadArray([], tslib_1.__read(safeOptions.entities), false));
|
|
46
|
+
if (safeOptions.controllers)
|
|
47
|
+
allControllers.push.apply(allControllers, tslib_1.__spreadArray([], tslib_1.__read(safeOptions.controllers), false));
|
|
48
|
+
safeOptions.controllers = allControllers;
|
|
50
49
|
}
|
|
51
|
-
if (
|
|
52
|
-
|
|
50
|
+
if (safeOptions.rootPath === undefined)
|
|
51
|
+
safeOptions.rootPath = '/api';
|
|
53
52
|
remult_static_js_1.remultStatic.actionInfo.runningOnServer = true;
|
|
54
|
-
var bridge = new RemultServerImplementation(new inProcessQueueHandler(
|
|
53
|
+
var bridge = new RemultServerImplementation(new inProcessQueueHandler(safeOptions.queueStorage), safeOptions, dataProvider, serverCoreOptions);
|
|
55
54
|
return bridge;
|
|
56
55
|
}
|
|
57
|
-
exports.createRemultServerCore = createRemultServerCore;
|
|
58
56
|
/* @internal*/
|
|
59
57
|
var RemultServerImplementation = /** @class */ (function () {
|
|
60
58
|
function RemultServerImplementation(queue, options, dataProvider, coreOptions) {
|
|
@@ -387,7 +385,7 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
387
385
|
return [2 /*return*/];
|
|
388
386
|
});
|
|
389
387
|
}); }));
|
|
390
|
-
r.route(streamPath + '/subscribe').post(this.process(function (remult,
|
|
388
|
+
r.route(streamPath + '/subscribe').post(this.process(function (remult, _2, res, _, _1, origReq) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
391
389
|
var body, _a, _b;
|
|
392
390
|
return tslib_1.__generator(this, function (_c) {
|
|
393
391
|
switch (_c.label) {
|
|
@@ -570,9 +568,7 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
570
568
|
return tslib_1.__generator(this, function (_a) {
|
|
571
569
|
switch (_a.label) {
|
|
572
570
|
case 0:
|
|
573
|
-
genReq = req
|
|
574
|
-
? this.coreOptions.buildGenericRequestInfo(req)
|
|
575
|
-
: undefined;
|
|
571
|
+
genReq = req ? this.coreOptions.buildGenericRequestInfo(req) : {};
|
|
576
572
|
if (req) {
|
|
577
573
|
if (!genReq.query) {
|
|
578
574
|
genReq.query = req['_tempQuery'];
|
|
@@ -581,7 +577,7 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
581
577
|
genReq.params = req['_tempParams'];
|
|
582
578
|
}
|
|
583
579
|
myReq = new RequestBridgeToDataApiRequest(genReq);
|
|
584
|
-
myRes = new ResponseBridgeToDataApiResponse(origRes, req, this.options.error);
|
|
580
|
+
myRes = new ResponseBridgeToDataApiResponse(origRes, req, genReq, this.options.error);
|
|
585
581
|
_a.label = 1;
|
|
586
582
|
case 1:
|
|
587
583
|
_a.trys.push([1, 6, , 7]);
|
|
@@ -1116,9 +1112,10 @@ var RequestBridgeToDataApiRequest = /** @class */ (function () {
|
|
|
1116
1112
|
return RequestBridgeToDataApiRequest;
|
|
1117
1113
|
}());
|
|
1118
1114
|
var ResponseBridgeToDataApiResponse = /** @class */ (function () {
|
|
1119
|
-
function ResponseBridgeToDataApiResponse(r, req, handleError) {
|
|
1115
|
+
function ResponseBridgeToDataApiResponse(r, req, genReq, handleError) {
|
|
1120
1116
|
this.r = r;
|
|
1121
1117
|
this.req = req;
|
|
1118
|
+
this.genReq = genReq;
|
|
1122
1119
|
this.handleError = handleError;
|
|
1123
1120
|
}
|
|
1124
1121
|
ResponseBridgeToDataApiResponse.prototype.forbidden = function () {
|
|
@@ -1141,10 +1138,10 @@ var ResponseBridgeToDataApiResponse = /** @class */ (function () {
|
|
|
1141
1138
|
this.error({ message: 'NotFound' }, undefined, 404);
|
|
1142
1139
|
};
|
|
1143
1140
|
ResponseBridgeToDataApiResponse.prototype.error = function (exception, entity, httpStatusCode) {
|
|
1144
|
-
var _a;
|
|
1145
1141
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1146
1142
|
var data, responseSent, sendError;
|
|
1147
1143
|
var _this = this;
|
|
1144
|
+
var _a;
|
|
1148
1145
|
return tslib_1.__generator(this, function (_b) {
|
|
1149
1146
|
switch (_b.label) {
|
|
1150
1147
|
case 0:
|
|
@@ -1175,8 +1172,8 @@ var ResponseBridgeToDataApiResponse = /** @class */ (function () {
|
|
|
1175
1172
|
message: body.message,
|
|
1176
1173
|
httpStatusCode: httpStatusCode,
|
|
1177
1174
|
stack: (_a = data.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
|
|
1178
|
-
url: (_b = _this.
|
|
1179
|
-
method: (_c = _this.
|
|
1175
|
+
url: (_b = _this.genReq) === null || _b === void 0 ? void 0 : _b.url,
|
|
1176
|
+
method: (_c = _this.genReq) === null || _c === void 0 ? void 0 : _c.method,
|
|
1180
1177
|
});
|
|
1181
1178
|
_this.setStatus(httpStatusCode).json(body);
|
|
1182
1179
|
};
|
|
@@ -1311,7 +1308,7 @@ var EntityQueueStorage = /** @class */ (function () {
|
|
|
1311
1308
|
switch (_a.label) {
|
|
1312
1309
|
case 0: return [4 /*yield*/, this.repo.findId(queuedJobId)];
|
|
1313
1310
|
case 1:
|
|
1314
|
-
q = _a.sent();
|
|
1311
|
+
q = (_a.sent());
|
|
1315
1312
|
lastProgress = undefined;
|
|
1316
1313
|
return [2 /*return*/, {
|
|
1317
1314
|
userId: q.userId,
|
|
@@ -1458,8 +1455,9 @@ var RouteImplementation = /** @class */ (function () {
|
|
|
1458
1455
|
res({ statusCode: statusCode });
|
|
1459
1456
|
};
|
|
1460
1457
|
class_1.prototype.flush = function () {
|
|
1461
|
-
if (gRes
|
|
1458
|
+
if ((0, isOfType_js_1.isOfType)(gRes, 'flush')) {
|
|
1462
1459
|
gRes.flush();
|
|
1460
|
+
}
|
|
1463
1461
|
};
|
|
1464
1462
|
class_1.prototype.json = function (data) {
|
|
1465
1463
|
if (gRes !== undefined)
|
|
@@ -1498,8 +1496,9 @@ var RouteImplementation = /** @class */ (function () {
|
|
|
1498
1496
|
};
|
|
1499
1497
|
RouteImplementation.prototype.middleware = function (origReq, res, next) {
|
|
1500
1498
|
var e_8, _a;
|
|
1499
|
+
var _b;
|
|
1501
1500
|
var req = this.coreOptions.buildGenericRequestInfo(origReq);
|
|
1502
|
-
var theUrl = req.url;
|
|
1501
|
+
var theUrl = ((_b = req.url) === null || _b === void 0 ? void 0 : _b.toString()) || '';
|
|
1503
1502
|
if (theUrl.startsWith('/'))
|
|
1504
1503
|
//next sends a partial url '/api/tasks' and not the full url
|
|
1505
1504
|
theUrl = 'http://stam' + theUrl;
|
|
@@ -1526,8 +1525,8 @@ var RouteImplementation = /** @class */ (function () {
|
|
|
1526
1525
|
var m = this.map.get(lowerPath);
|
|
1527
1526
|
if (!m)
|
|
1528
1527
|
try {
|
|
1529
|
-
for (var
|
|
1530
|
-
var route =
|
|
1528
|
+
for (var _c = tslib_1.__values(this.starRoutes), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1529
|
+
var route = _d.value;
|
|
1531
1530
|
if (lowerPath.startsWith(route.route)) {
|
|
1532
1531
|
m = route.handler;
|
|
1533
1532
|
break;
|
|
@@ -1537,7 +1536,7 @@ var RouteImplementation = /** @class */ (function () {
|
|
|
1537
1536
|
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1538
1537
|
finally {
|
|
1539
1538
|
try {
|
|
1540
|
-
if (
|
|
1539
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1541
1540
|
}
|
|
1542
1541
|
finally { if (e_8) throw e_8.error; }
|
|
1543
1542
|
}
|
|
@@ -1573,15 +1572,22 @@ exports.RouteImplementation = RouteImplementation;
|
|
|
1573
1572
|
var JobsInQueueEntity = /** @class */ (function (_super) {
|
|
1574
1573
|
tslib_1.__extends(JobsInQueueEntity, _super);
|
|
1575
1574
|
function JobsInQueueEntity() {
|
|
1576
|
-
|
|
1575
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
1576
|
+
_this.userId = '';
|
|
1577
|
+
_this.url = '';
|
|
1578
|
+
_this.result = '';
|
|
1579
|
+
_this.done = false;
|
|
1580
|
+
_this.error = false;
|
|
1581
|
+
_this.progress = 0;
|
|
1582
|
+
return _this;
|
|
1577
1583
|
}
|
|
1578
1584
|
tslib_1.__decorate([
|
|
1579
1585
|
Fields_js_1.Fields.string(),
|
|
1580
|
-
tslib_1.__metadata("design:type",
|
|
1586
|
+
tslib_1.__metadata("design:type", Object)
|
|
1581
1587
|
], JobsInQueueEntity.prototype, "userId", void 0);
|
|
1582
1588
|
tslib_1.__decorate([
|
|
1583
1589
|
Fields_js_1.Fields.string(),
|
|
1584
|
-
tslib_1.__metadata("design:type",
|
|
1590
|
+
tslib_1.__metadata("design:type", Object)
|
|
1585
1591
|
], JobsInQueueEntity.prototype, "url", void 0);
|
|
1586
1592
|
tslib_1.__decorate([
|
|
1587
1593
|
Fields_js_1.Fields.date(),
|
|
@@ -1593,19 +1599,19 @@ var JobsInQueueEntity = /** @class */ (function (_super) {
|
|
|
1593
1599
|
], JobsInQueueEntity.prototype, "doneTime", void 0);
|
|
1594
1600
|
tslib_1.__decorate([
|
|
1595
1601
|
Fields_js_1.Fields.string(),
|
|
1596
|
-
tslib_1.__metadata("design:type",
|
|
1602
|
+
tslib_1.__metadata("design:type", Object)
|
|
1597
1603
|
], JobsInQueueEntity.prototype, "result", void 0);
|
|
1598
1604
|
tslib_1.__decorate([
|
|
1599
1605
|
Fields_js_1.Fields.boolean(),
|
|
1600
|
-
tslib_1.__metadata("design:type",
|
|
1606
|
+
tslib_1.__metadata("design:type", Object)
|
|
1601
1607
|
], JobsInQueueEntity.prototype, "done", void 0);
|
|
1602
1608
|
tslib_1.__decorate([
|
|
1603
1609
|
Fields_js_1.Fields.boolean(),
|
|
1604
|
-
tslib_1.__metadata("design:type",
|
|
1610
|
+
tslib_1.__metadata("design:type", Object)
|
|
1605
1611
|
], JobsInQueueEntity.prototype, "error", void 0);
|
|
1606
1612
|
tslib_1.__decorate([
|
|
1607
1613
|
Fields_js_1.Fields.number(),
|
|
1608
|
-
tslib_1.__metadata("design:type",
|
|
1614
|
+
tslib_1.__metadata("design:type", Object)
|
|
1609
1615
|
], JobsInQueueEntity.prototype, "progress", void 0);
|
|
1610
1616
|
JobsInQueueEntity = tslib_1.__decorate([
|
|
1611
1617
|
(0, entity_js_1.Entity)(undefined, {
|
package/src/CompoundIdField.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ export declare class CompoundIdField implements FieldMetadata<string> {
|
|
|
11
11
|
fromInput(inputValue: string, inputType?: string): string;
|
|
12
12
|
getDbName(): Promise<string>;
|
|
13
13
|
getId(instance: any): string;
|
|
14
|
-
options: FieldOptions
|
|
14
|
+
options: FieldOptions;
|
|
15
15
|
get valueConverter(): Required<ValueConverter<string>>;
|
|
16
16
|
target: ClassType<any>;
|
|
17
|
-
readonly:
|
|
17
|
+
readonly: boolean;
|
|
18
18
|
allowNull: boolean;
|
|
19
19
|
dbReadOnly: boolean;
|
|
20
20
|
isServerExpression: boolean;
|
package/src/CompoundIdField.js
CHANGED
|
@@ -7,6 +7,15 @@ var CompoundIdField = /** @class */ (function () {
|
|
|
7
7
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
8
|
columns[_i] = arguments[_i];
|
|
9
9
|
}
|
|
10
|
+
this.options = {};
|
|
11
|
+
this.readonly = true;
|
|
12
|
+
this.allowNull = false;
|
|
13
|
+
this.dbReadOnly = false;
|
|
14
|
+
this.isServerExpression = false;
|
|
15
|
+
this.key = '';
|
|
16
|
+
this.caption = '';
|
|
17
|
+
this.inputType = '';
|
|
18
|
+
this.dbName = '';
|
|
10
19
|
this.fields = columns;
|
|
11
20
|
}
|
|
12
21
|
CompoundIdField.prototype.apiUpdateAllowed = function (item) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RestDataProviderHttpProvider } from './data-interfaces.js';
|
|
2
|
-
export declare function buildRestDataProvider(provider: ExternalHttpProvider | typeof fetch): RestDataProviderHttpProvider;
|
|
2
|
+
export declare function buildRestDataProvider(provider: ExternalHttpProvider | typeof fetch | undefined): RestDataProviderHttpProvider;
|
|
3
3
|
export declare function isExternalHttpProvider(item: any): boolean;
|
|
4
4
|
export declare class HttpProviderBridgeToRestDataProviderHttpProvider implements RestDataProviderHttpProvider {
|
|
5
5
|
private http;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HttpProviderBridgeToRestDataProviderHttpProvider = void 0;
|
|
4
|
+
exports.buildRestDataProvider = buildRestDataProvider;
|
|
5
|
+
exports.isExternalHttpProvider = isExternalHttpProvider;
|
|
6
|
+
exports.retry = retry;
|
|
7
|
+
exports.toPromise = toPromise;
|
|
8
|
+
exports.processHttpException = processHttpException;
|
|
4
9
|
var tslib_1 = require("tslib");
|
|
5
10
|
var rest_data_provider_js_1 = require("./data-providers/rest-data-provider.js");
|
|
6
11
|
var remult3_js_1 = require("./remult3/remult3.js");
|
|
@@ -20,14 +25,12 @@ function buildRestDataProvider(provider) {
|
|
|
20
25
|
}
|
|
21
26
|
return httpDataProvider;
|
|
22
27
|
}
|
|
23
|
-
exports.buildRestDataProvider = buildRestDataProvider;
|
|
24
28
|
function isExternalHttpProvider(item) {
|
|
25
29
|
var http = item;
|
|
26
30
|
if (http && http.get && http.put && http.post && http.delete)
|
|
27
31
|
return true;
|
|
28
32
|
return false;
|
|
29
33
|
}
|
|
30
|
-
exports.isExternalHttpProvider = isExternalHttpProvider;
|
|
31
34
|
var HttpProviderBridgeToRestDataProviderHttpProvider = /** @class */ (function () {
|
|
32
35
|
function HttpProviderBridgeToRestDataProviderHttpProvider(http) {
|
|
33
36
|
this.http = http;
|
|
@@ -64,9 +67,9 @@ var HttpProviderBridgeToRestDataProviderHttpProvider = /** @class */ (function (
|
|
|
64
67
|
}());
|
|
65
68
|
exports.HttpProviderBridgeToRestDataProviderHttpProvider = HttpProviderBridgeToRestDataProviderHttpProvider;
|
|
66
69
|
function retry(what) {
|
|
67
|
-
var _a, _b, _c, _d;
|
|
68
70
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
69
71
|
var i, err_1;
|
|
72
|
+
var _a, _b, _c, _d;
|
|
70
73
|
return tslib_1.__generator(this, function (_e) {
|
|
71
74
|
switch (_e.label) {
|
|
72
75
|
case 0:
|
|
@@ -102,7 +105,6 @@ function retry(what) {
|
|
|
102
105
|
});
|
|
103
106
|
});
|
|
104
107
|
}
|
|
105
|
-
exports.retry = retry;
|
|
106
108
|
function toPromise(p) {
|
|
107
109
|
var _this = this;
|
|
108
110
|
var r;
|
|
@@ -132,11 +134,10 @@ function toPromise(p) {
|
|
|
132
134
|
});
|
|
133
135
|
}); });
|
|
134
136
|
}
|
|
135
|
-
exports.toPromise = toPromise;
|
|
136
137
|
function processHttpException(ex) {
|
|
137
|
-
var _a, _b, _c;
|
|
138
138
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
139
139
|
var z, error, httpStatusCode, result;
|
|
140
|
+
var _a, _b, _c;
|
|
140
141
|
return tslib_1.__generator(this, function (_d) {
|
|
141
142
|
switch (_d.label) {
|
|
142
143
|
case 0: return [4 /*yield*/, ex];
|
|
@@ -175,4 +176,3 @@ function processHttpException(ex) {
|
|
|
175
176
|
});
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
|
-
exports.processHttpException = processHttpException;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClassType } from '../classType.js';
|
|
2
2
|
import type { AllowedForInstance } from './context.js';
|
|
3
3
|
import type { EntityMetadata, FieldRef, LifecycleEvent, ValidateFieldEvent } from './remult3/remult3.js';
|
|
4
|
-
export interface FieldOptions<entityType =
|
|
4
|
+
export interface FieldOptions<entityType = unknown, valueType = unknown> {
|
|
5
5
|
/** A human readable name for the field. Can be used to achieve a consistent caption for a field throughout the app
|
|
6
6
|
* @example
|
|
7
7
|
* <input placeholder={taskRepo.metadata.fields.title.caption}/>
|
|
@@ -119,14 +119,14 @@ export interface FieldOptions<entityType = any, valueType = any> {
|
|
|
119
119
|
key?: string;
|
|
120
120
|
}
|
|
121
121
|
/**Metadata for a `Field`, this metadata can be used in the user interface to provide a richer UI experience */
|
|
122
|
-
export interface FieldMetadata<valueType =
|
|
122
|
+
export interface FieldMetadata<valueType = unknown, entityType = unknown> {
|
|
123
123
|
/** The field's member name in an object.
|
|
124
124
|
* @example
|
|
125
125
|
* const taskRepo = remult.repo(Task);
|
|
126
126
|
* console.log(taskRepo.metadata.fields.title.key);
|
|
127
127
|
* // result: title
|
|
128
128
|
*/
|
|
129
|
-
readonly key: string;
|
|
129
|
+
readonly key: entityType extends object ? keyof entityType & string : string;
|
|
130
130
|
/** A human readable caption for the field. Can be used to achieve a consistent caption for a field throughout the app
|
|
131
131
|
* @example
|
|
132
132
|
* <input placeholder={taskRepo.metadata.fields.title.caption}/>
|
|
@@ -324,7 +324,7 @@ export interface ValueConverter<valueType> {
|
|
|
324
324
|
*/
|
|
325
325
|
readonly inputType?: string;
|
|
326
326
|
}
|
|
327
|
-
export declare type FieldValidator<entityType =
|
|
327
|
+
export declare type FieldValidator<entityType = unknown, valueType = unknown> = (entity: entityType, event: ValidateFieldEvent<entityType, valueType>) => boolean | string | void | undefined | Promise<boolean | string | void | undefined>;
|
|
328
328
|
export declare type ValueOrExpression<valueType> = valueType | (() => valueType);
|
|
329
329
|
export declare function valueOrExpressionToValue<valueType>(f: ValueOrExpression<valueType>): valueType;
|
|
330
330
|
export interface ValueListItem {
|
package/src/column-interfaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.valueOrExpressionToValue =
|
|
3
|
+
exports.valueOrExpressionToValue = valueOrExpressionToValue;
|
|
4
4
|
function valueOrExpressionToValue(f) {
|
|
5
5
|
if (typeof f === 'function') {
|
|
6
6
|
var x = f;
|
|
@@ -8,4 +8,3 @@ function valueOrExpressionToValue(f) {
|
|
|
8
8
|
}
|
|
9
9
|
return f;
|
|
10
10
|
}
|
|
11
|
-
exports.valueOrExpressionToValue = valueOrExpressionToValue;
|