remult 0.10.13 → 0.10.14
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/package.json
CHANGED
|
@@ -5,11 +5,16 @@ import { queuedJobInfoResponse } from '../src/server-action';
|
|
|
5
5
|
import { DataApi, DataApiRequest, DataApiResponse } from '../src/data-api';
|
|
6
6
|
import { AllowedForInstance } from '../src/context';
|
|
7
7
|
export declare function remultExpress(options?: {
|
|
8
|
+
/** Determines the Data Provider
|
|
9
|
+
|
|
10
|
+
* @see [Optional Databases](https://remult.dev/docs/databases.html)
|
|
11
|
+
*/
|
|
8
12
|
dataProvider?: DataProvider | Promise<DataProvider> | (() => Promise<DataProvider | undefined>);
|
|
9
13
|
bodySizeLimit?: string;
|
|
10
14
|
disableAutoApi?: boolean;
|
|
11
15
|
queueStorage?: QueueStorage;
|
|
12
16
|
initRequest?: (remult: Remult, origReq: express.Request) => Promise<void>;
|
|
17
|
+
initApi?: (remult: Remult) => void | Promise<void>;
|
|
13
18
|
logApiEndPoints?: boolean;
|
|
14
19
|
defaultGetLimit?: number;
|
|
15
20
|
}): RemultExpressBridge;
|
package/server/expressBridge.js
CHANGED
|
@@ -14,6 +14,7 @@ var server_action_1 = require("../src/server-action");
|
|
|
14
14
|
var data_api_1 = require("../src/data-api");
|
|
15
15
|
var context_1 = require("../src/context");
|
|
16
16
|
function remultExpress(options) {
|
|
17
|
+
var _this = this;
|
|
17
18
|
var app = express.Router();
|
|
18
19
|
if (!options) {
|
|
19
20
|
options = {};
|
|
@@ -41,6 +42,21 @@ function remultExpress(options) {
|
|
|
41
42
|
return dp;
|
|
42
43
|
return new json_data_provider_1.JsonDataProvider(new JsonEntityFileStorage_1.JsonEntityFileStorage('./db'));
|
|
43
44
|
});
|
|
45
|
+
if (options.initApi) {
|
|
46
|
+
dataProvider = dataProvider.then(function (dp) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
47
|
+
var remult;
|
|
48
|
+
return tslib_1.__generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
remult = new __1.Remult(dp);
|
|
52
|
+
return [4 /*yield*/, options.initApi(remult)];
|
|
53
|
+
case 1:
|
|
54
|
+
_a.sent();
|
|
55
|
+
return [2 /*return*/, dp];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}); });
|
|
59
|
+
}
|
|
44
60
|
var bridge = new ExpressBridge(app, new inProcessQueueHandler(options.queueStorage), options.initRequest, dataProvider);
|
|
45
61
|
if (options.logApiEndPoints !== undefined)
|
|
46
62
|
bridge.logApiEndPoints = options.logApiEndPoints;
|
package/src/data-interfaces.d.ts
CHANGED
|
@@ -29,8 +29,6 @@ export declare function extractSort(sort: any): Sort;
|
|
|
29
29
|
export interface ErrorInfo<entityType = any> {
|
|
30
30
|
message?: string;
|
|
31
31
|
modelState?: {
|
|
32
|
-
[key: string]: string;
|
|
33
|
-
} & {
|
|
34
32
|
[Properties in keyof Partial<OmitEB<entityType>>]?: string;
|
|
35
33
|
};
|
|
36
34
|
stack?: string;
|