remult 2.7.25-next.2 → 2.7.26-next.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.
|
@@ -203,9 +203,9 @@ export class RemultServerImplementation {
|
|
|
203
203
|
doWork: undefined,
|
|
204
204
|
}, r);
|
|
205
205
|
if (this.options.admin !== undefined && this.options.admin !== false) {
|
|
206
|
-
const admin = (
|
|
206
|
+
const admin = () => this.process(async (remult, req, res, orig, origResponse) => {
|
|
207
207
|
if (remult.isAllowed(this.options.admin)) {
|
|
208
|
-
if (
|
|
208
|
+
if (orig.params.id === '__entities-metadata') {
|
|
209
209
|
res.success(buildEntityInfo({
|
|
210
210
|
remult,
|
|
211
211
|
entities: this.options.entities ?? [],
|
|
@@ -222,10 +222,9 @@ export class RemultServerImplementation {
|
|
|
222
222
|
else
|
|
223
223
|
res.notFound();
|
|
224
224
|
});
|
|
225
|
-
r.route(this.options.rootPath + '/admin
|
|
226
|
-
r.route(this.options.rootPath + '/admin
|
|
227
|
-
r.route(this.options.rootPath + '/admin
|
|
228
|
-
r.route(this.options.rootPath + '/admin').get(admin(false));
|
|
225
|
+
r.route(this.options.rootPath + '/admin/:id').get(admin());
|
|
226
|
+
r.route(this.options.rootPath + '/admin/').get(admin());
|
|
227
|
+
r.route(this.options.rootPath + '/admin').get(admin());
|
|
229
228
|
}
|
|
230
229
|
r.route(this.options.rootPath + '/me').get(this.process(async (remult, req, res) => res.success(remult.user ?? null)));
|
|
231
230
|
if (this.options.subscriptionServer instanceof SseSubscriptionServer) {
|
package/package.json
CHANGED
|
@@ -362,12 +362,12 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
362
362
|
doWork: undefined,
|
|
363
363
|
}, r);
|
|
364
364
|
if (this.options.admin !== undefined && this.options.admin !== false) {
|
|
365
|
-
var admin = function (
|
|
365
|
+
var admin = function () {
|
|
366
366
|
return _this.process(function (remult, req, res, orig, origResponse) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
367
367
|
var _a;
|
|
368
368
|
return tslib_1.__generator(this, function (_b) {
|
|
369
369
|
if (remult.isAllowed(this.options.admin)) {
|
|
370
|
-
if (
|
|
370
|
+
if (orig.params.id === '__entities-metadata') {
|
|
371
371
|
res.success((0, remult_admin_js_1.buildEntityInfo)({
|
|
372
372
|
remult: remult,
|
|
373
373
|
entities: (_a = this.options.entities) !== null && _a !== void 0 ? _a : [],
|
|
@@ -387,10 +387,9 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
387
387
|
});
|
|
388
388
|
}); });
|
|
389
389
|
};
|
|
390
|
-
r.route(this.options.rootPath + '/admin
|
|
391
|
-
r.route(this.options.rootPath + '/admin
|
|
392
|
-
r.route(this.options.rootPath + '/admin
|
|
393
|
-
r.route(this.options.rootPath + '/admin').get(admin(false));
|
|
390
|
+
r.route(this.options.rootPath + '/admin/:id').get(admin());
|
|
391
|
+
r.route(this.options.rootPath + '/admin/').get(admin());
|
|
392
|
+
r.route(this.options.rootPath + '/admin').get(admin());
|
|
394
393
|
}
|
|
395
394
|
r.route(this.options.rootPath + '/me').get(this.process(function (remult, req, res) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var _a; return tslib_1.__generator(this, function (_b) {
|
|
396
395
|
return [2 /*return*/, res.success((_a = remult.user) !== null && _a !== void 0 ? _a : null)];
|
package/src/entity.d.ts
CHANGED
|
@@ -158,15 +158,15 @@ export interface EntityOptions<entityType = unknown> {
|
|
|
158
158
|
dbName?: string;
|
|
159
159
|
/** For entities that are based on SQL expressions instead of a physical table or view
|
|
160
160
|
* @example
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
161
|
+
* @Entity('people', {
|
|
162
|
+
* sqlExpression:`select id,name from employees
|
|
163
|
+
* union all select id,name from contractors`,
|
|
164
164
|
* })
|
|
165
|
-
* export class Person{
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
165
|
+
* export class Person {
|
|
166
|
+
* @Fields.string()
|
|
167
|
+
* id=''
|
|
168
|
+
* @Fields.string()
|
|
169
|
+
* name=''
|
|
170
170
|
* }
|
|
171
171
|
*/
|
|
172
172
|
sqlExpression?: string | ((entity: EntityMetadata<entityType>) => string | Promise<string>);
|