remult 0.13.23 → 0.13.26
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
package/readme.md
CHANGED
|
@@ -33,13 +33,15 @@
|
|
|
33
33
|
|
|
34
34
|
#### Remult :heart: Code Sharing
|
|
35
35
|
|
|
36
|
-
With model types shared between frontend and backend code, Remult can **enforce data validation and constraints, defined once, both in the front-end and
|
|
36
|
+
With model types shared between frontend and backend code, Remult can **enforce data validation and constraints, defined once, both in the front-end and within back-end API routes**.
|
|
37
37
|
|
|
38
38
|
## Getting started
|
|
39
39
|
The best way to learn Remult is by following a tutorial of a simple Todo web app with a Node.js Express backend.
|
|
40
40
|
|
|
41
41
|
* [Tutorial with React](https://remult.dev/tutorials/react/)
|
|
42
42
|
* [Tutorial with Angular](https://remult.dev/tutorials/angular/)
|
|
43
|
+
* [Tutorial with Vue](https://remult.dev/tutorials/vue/)
|
|
44
|
+
* [Tutorial with Next.js](https://remult.dev/tutorials/react-next/)
|
|
43
45
|
|
|
44
46
|
## Installation
|
|
45
47
|
```sh
|
package/server/expressBridge.js
CHANGED
|
@@ -69,7 +69,7 @@ function remultExpress(options) {
|
|
|
69
69
|
if (options.controllers)
|
|
70
70
|
actions.push.apply(actions, tslib_1.__spread(options.controllers));
|
|
71
71
|
register_actions_on_server_1.registerActionsOnServer(apiArea, actions);
|
|
72
|
-
register_entities_on_server_1.registerEntitiesOnServer(apiArea);
|
|
72
|
+
register_entities_on_server_1.registerEntitiesOnServer(apiArea, options.entities);
|
|
73
73
|
}
|
|
74
74
|
return Object.assign(app, {
|
|
75
75
|
getRemult: function (req) { return bridge.getRemult(req); },
|
|
@@ -582,7 +582,10 @@ var ExpressResponseBridgeToDataApiResponse = /** @class */ (function () {
|
|
|
582
582
|
this.req = req;
|
|
583
583
|
}
|
|
584
584
|
ExpressResponseBridgeToDataApiResponse.prototype.forbidden = function () {
|
|
585
|
-
this.
|
|
585
|
+
this.sendStatus(403);
|
|
586
|
+
};
|
|
587
|
+
ExpressResponseBridgeToDataApiResponse.prototype.sendStatus = function (status) {
|
|
588
|
+
this.r.writeHead(status).end();
|
|
586
589
|
};
|
|
587
590
|
ExpressResponseBridgeToDataApiResponse.prototype.progress = function (progress) {
|
|
588
591
|
};
|
|
@@ -594,10 +597,10 @@ var ExpressResponseBridgeToDataApiResponse = /** @class */ (function () {
|
|
|
594
597
|
this.r.json(data);
|
|
595
598
|
};
|
|
596
599
|
ExpressResponseBridgeToDataApiResponse.prototype.deleted = function () {
|
|
597
|
-
this.
|
|
600
|
+
this.sendStatus(204);
|
|
598
601
|
};
|
|
599
602
|
ExpressResponseBridgeToDataApiResponse.prototype.notFound = function () {
|
|
600
|
-
this.
|
|
603
|
+
this.sendStatus(404);
|
|
601
604
|
};
|
|
602
605
|
ExpressResponseBridgeToDataApiResponse.prototype.error = function (data) {
|
|
603
606
|
var _a, _b;
|
|
@@ -309,6 +309,7 @@ export declare class EntityBase {
|
|
|
309
309
|
export declare class ControllerBase {
|
|
310
310
|
protected remult: Remult;
|
|
311
311
|
constructor(remult: Remult);
|
|
312
|
+
assign(values: Partial<Omit<this, keyof EntityBase>>): this;
|
|
312
313
|
get $(): FieldsRef<this>;
|
|
313
314
|
get _(): ControllerRef<this>;
|
|
314
315
|
}
|
|
@@ -2729,6 +2729,10 @@ var ControllerBase = /** @class */ (function () {
|
|
|
2729
2729
|
function ControllerBase(remult) {
|
|
2730
2730
|
this.remult = remult;
|
|
2731
2731
|
}
|
|
2732
|
+
ControllerBase.prototype.assign = function (values) {
|
|
2733
|
+
assign_1.assign(this, values);
|
|
2734
|
+
return this;
|
|
2735
|
+
};
|
|
2732
2736
|
Object.defineProperty(ControllerBase.prototype, "$", {
|
|
2733
2737
|
get: function () { return getFields(this); },
|
|
2734
2738
|
enumerable: false,
|