remult 0.25.5-exp.5 → 0.25.5-exp.6
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/src/remult3/remult3.js +7 -0
- package/esm/src/server-action.js +9 -12
- package/internals.d.ts +1 -1
- package/package.json +1 -1
- package/src/remult3/remult3.js +7 -0
- package/src/server-action.d.ts +1 -1
- package/src/server-action.js +9 -12
|
@@ -79,3 +79,10 @@ remult.apiClient.url='localhost:3007/api
|
|
|
79
79
|
//y2 - should enforce integer - currently we probably round / truncate it
|
|
80
80
|
//p1 - adjust react tutorial to esm
|
|
81
81
|
//p1 - write docs on with remult - and usage in init api
|
|
82
|
+
/*y1 - discuss sql stuff:
|
|
83
|
+
https://discord.com/channels/975754286384418847/975754286384418852/1198997156678357043
|
|
84
|
+
https://codesandbox.io/p/devbox/demo-sql-expression-forked-f94p6m?file=%2Fsrc%2Findex.ts%3A21%2C3-21%2C12&workspaceId=c0f7eccf-c151-423b-ac8e-0f0f3e1ad350
|
|
85
|
+
https://codesandbox.io/p/devbox/demo-sql-expression-forked-c2jhyc?file=%2Fsrc%2Findex.ts%3A37%2C50&workspaceId=7e9d0505-ea79-46f1-8973-50cadde4fa96
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
*/
|
package/esm/src/server-action.js
CHANGED
|
@@ -92,7 +92,7 @@ export class myServerAction extends Action {
|
|
|
92
92
|
await doTransaction(remult, async () => {
|
|
93
93
|
if (!remult.isAllowedForInstance(undefined, this.options.allowed))
|
|
94
94
|
throw new ForbiddenError();
|
|
95
|
-
info.args = await prepareReceivedArgs(this.types, info.args, remult, ds, res);
|
|
95
|
+
info.args = await prepareReceivedArgs(this.types(), info.args, remult, ds, res);
|
|
96
96
|
try {
|
|
97
97
|
result.data = await this.originalMethod(info.args);
|
|
98
98
|
}
|
|
@@ -119,17 +119,20 @@ export function BackendMethod(options) {
|
|
|
119
119
|
const originalMethod = descriptor ? descriptor.value : target;
|
|
120
120
|
let result = originalMethod;
|
|
121
121
|
checkTarget(target);
|
|
122
|
-
|
|
122
|
+
function getTypes() {
|
|
123
123
|
var types = Reflect.getMetadata('design:paramtypes', target, key);
|
|
124
124
|
if (options.paramTypes)
|
|
125
125
|
types =
|
|
126
126
|
typeof options.paramTypes === 'function'
|
|
127
127
|
? options.paramTypes()
|
|
128
128
|
: options.paramTypes;
|
|
129
|
+
return types;
|
|
130
|
+
}
|
|
131
|
+
if (target.prototype !== undefined) {
|
|
129
132
|
// if types are undefined - you've forgot to set: "emitDecoratorMetadata":true
|
|
130
|
-
let serverAction = new myServerAction((options?.apiPrefix ? options.apiPrefix + '/' : '') + key,
|
|
133
|
+
let serverAction = new myServerAction((options?.apiPrefix ? options.apiPrefix + '/' : '') + key, () => getTypes(), options, (args) => originalMethod.apply(undefined, args));
|
|
131
134
|
serverAction.doWork = async (args, self, url, http) => {
|
|
132
|
-
args = prepareArgsToSend(
|
|
135
|
+
args = prepareArgsToSend(getTypes(), args);
|
|
133
136
|
if (options.blockUser === false) {
|
|
134
137
|
return await remultStatic.actionInfo.runActionWithoutBlockingUI(async () => (await serverAction.run({ args }, url, http)).data);
|
|
135
138
|
}
|
|
@@ -152,12 +155,6 @@ export function BackendMethod(options) {
|
|
|
152
155
|
else
|
|
153
156
|
return result;
|
|
154
157
|
}
|
|
155
|
-
var types = Reflect.getMetadata('design:paramtypes', target, key);
|
|
156
|
-
if (options.paramTypes)
|
|
157
|
-
types =
|
|
158
|
-
typeof options.paramTypes === 'function'
|
|
159
|
-
? options.paramTypes()
|
|
160
|
-
: options.paramTypes;
|
|
161
158
|
let x = remultStatic.classHelpers.get(target.constructor);
|
|
162
159
|
if (!x) {
|
|
163
160
|
x = new ClassHelper();
|
|
@@ -181,7 +178,7 @@ export function BackendMethod(options) {
|
|
|
181
178
|
let remult = req;
|
|
182
179
|
let r;
|
|
183
180
|
await doTransaction(remult, async () => {
|
|
184
|
-
d.args = await prepareReceivedArgs(
|
|
181
|
+
d.args = await prepareReceivedArgs(getTypes(), d.args, remult, remult.dataProvider, res);
|
|
185
182
|
if (remultStatic.allEntities.includes(constructor)) {
|
|
186
183
|
let repo = remult.repo(constructor);
|
|
187
184
|
let y;
|
|
@@ -252,7 +249,7 @@ export function BackendMethod(options) {
|
|
|
252
249
|
}
|
|
253
250
|
},
|
|
254
251
|
doWork: async function (args, self, baseUrl, http) {
|
|
255
|
-
args = prepareArgsToSend(
|
|
252
|
+
args = prepareArgsToSend(getTypes(), args);
|
|
256
253
|
if (remultStatic.allEntities.includes(target.constructor)) {
|
|
257
254
|
let defs = getEntityRef(self);
|
|
258
255
|
await defs.__validateEntity();
|
package/internals.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getRelationInfo, getRelationFieldInfo, RelationFieldInfo, RelationInfo, } from './src/remult3/relationInfoMember.js';
|
|
1
|
+
export { getRelationInfo, getRelationFieldInfo, RelationFieldInfo, RelationInfo, RelationFields, } from './src/remult3/relationInfoMember.js';
|
|
2
2
|
export { decorateColumnSettings, controllerRefImpl, getControllerRef, } from './src/remult3/RepositoryImplementation.js';
|
|
3
3
|
export { getEntitySettings } from './src/remult3/getEntityRef.js';
|
|
4
4
|
export { __updateEntityBasedOnWhere } from './src/filter/filter-interfaces.js';
|
package/package.json
CHANGED
package/src/remult3/remult3.js
CHANGED
|
@@ -80,3 +80,10 @@ remult.apiClient.url='localhost:3007/api
|
|
|
80
80
|
//y2 - should enforce integer - currently we probably round / truncate it
|
|
81
81
|
//p1 - adjust react tutorial to esm
|
|
82
82
|
//p1 - write docs on with remult - and usage in init api
|
|
83
|
+
/*y1 - discuss sql stuff:
|
|
84
|
+
https://discord.com/channels/975754286384418847/975754286384418852/1198997156678357043
|
|
85
|
+
https://codesandbox.io/p/devbox/demo-sql-expression-forked-f94p6m?file=%2Fsrc%2Findex.ts%3A21%2C3-21%2C12&workspaceId=c0f7eccf-c151-423b-ac8e-0f0f3e1ad350
|
|
86
|
+
https://codesandbox.io/p/devbox/demo-sql-expression-forked-c2jhyc?file=%2Fsrc%2Findex.ts%3A37%2C50&workspaceId=7e9d0505-ea79-46f1-8973-50cadde4fa96
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
*/
|
package/src/server-action.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class myServerAction extends Action<inArgs, result> {
|
|
|
28
28
|
private types;
|
|
29
29
|
private options;
|
|
30
30
|
originalMethod: (args: any[]) => any;
|
|
31
|
-
constructor(name: string, types: any[], options: BackendMethodOptions<any>, originalMethod: (args: any[]) => any);
|
|
31
|
+
constructor(name: string, types: () => any[], options: BackendMethodOptions<any>, originalMethod: (args: any[]) => any);
|
|
32
32
|
protected execute(info: inArgs, remult: Remult, res: DataApiResponse): Promise<result>;
|
|
33
33
|
}
|
|
34
34
|
export interface BackendMethodOptions<type> {
|
package/src/server-action.js
CHANGED
|
@@ -145,7 +145,7 @@ var myServerAction = /** @class */ (function (_super) {
|
|
|
145
145
|
if (!remult.isAllowedForInstance(undefined, this.options.allowed))
|
|
146
146
|
throw new ForbiddenError();
|
|
147
147
|
_a = info;
|
|
148
|
-
return [4 /*yield*/, prepareReceivedArgs(this.types, info.args, remult, ds, res)];
|
|
148
|
+
return [4 /*yield*/, prepareReceivedArgs(this.types(), info.args, remult, ds, res)];
|
|
149
149
|
case 1:
|
|
150
150
|
_a.args = _c.sent();
|
|
151
151
|
_c.label = 2;
|
|
@@ -191,21 +191,24 @@ function BackendMethod(options) {
|
|
|
191
191
|
var originalMethod = descriptor ? descriptor.value : target;
|
|
192
192
|
var result = originalMethod;
|
|
193
193
|
(0, Fields_js_1.checkTarget)(target);
|
|
194
|
-
|
|
194
|
+
function getTypes() {
|
|
195
195
|
var types = Reflect.getMetadata('design:paramtypes', target, key);
|
|
196
196
|
if (options.paramTypes)
|
|
197
197
|
types =
|
|
198
198
|
typeof options.paramTypes === 'function'
|
|
199
199
|
? options.paramTypes()
|
|
200
200
|
: options.paramTypes;
|
|
201
|
+
return types;
|
|
202
|
+
}
|
|
203
|
+
if (target.prototype !== undefined) {
|
|
201
204
|
// if types are undefined - you've forgot to set: "emitDecoratorMetadata":true
|
|
202
|
-
var serverAction_1 = new myServerAction(((options === null || options === void 0 ? void 0 : options.apiPrefix) ? options.apiPrefix + '/' : '') + key,
|
|
205
|
+
var serverAction_1 = new myServerAction(((options === null || options === void 0 ? void 0 : options.apiPrefix) ? options.apiPrefix + '/' : '') + key, function () { return getTypes(); }, options, function (args) { return originalMethod.apply(undefined, args); });
|
|
203
206
|
serverAction_1.doWork = function (args, self, url, http) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
204
207
|
var _this = this;
|
|
205
208
|
return tslib_1.__generator(this, function (_a) {
|
|
206
209
|
switch (_a.label) {
|
|
207
210
|
case 0:
|
|
208
|
-
args = prepareArgsToSend(
|
|
211
|
+
args = prepareArgsToSend(getTypes(), args);
|
|
209
212
|
if (!(options.blockUser === false)) return [3 /*break*/, 2];
|
|
210
213
|
return [4 /*yield*/, remult_static_js_1.remultStatic.actionInfo.runActionWithoutBlockingUI(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
|
|
211
214
|
switch (_a.label) {
|
|
@@ -246,12 +249,6 @@ function BackendMethod(options) {
|
|
|
246
249
|
else
|
|
247
250
|
return result;
|
|
248
251
|
}
|
|
249
|
-
var types = Reflect.getMetadata('design:paramtypes', target, key);
|
|
250
|
-
if (options.paramTypes)
|
|
251
|
-
types =
|
|
252
|
-
typeof options.paramTypes === 'function'
|
|
253
|
-
? options.paramTypes()
|
|
254
|
-
: options.paramTypes;
|
|
255
252
|
var x = remult_static_js_1.remultStatic.classHelpers.get(target.constructor);
|
|
256
253
|
if (!x) {
|
|
257
254
|
x = new context_js_1.ClassHelper();
|
|
@@ -289,7 +286,7 @@ function BackendMethod(options) {
|
|
|
289
286
|
switch (_e.label) {
|
|
290
287
|
case 0:
|
|
291
288
|
_a = d;
|
|
292
|
-
return [4 /*yield*/, prepareReceivedArgs(
|
|
289
|
+
return [4 /*yield*/, prepareReceivedArgs(getTypes(), d.args, remult_1, remult_1.dataProvider, res)];
|
|
293
290
|
case 1:
|
|
294
291
|
_a.args = _e.sent();
|
|
295
292
|
if (!remult_static_js_1.remultStatic.allEntities.includes(constructor)) return [3 /*break*/, 13];
|
|
@@ -410,7 +407,7 @@ function BackendMethod(options) {
|
|
|
410
407
|
return tslib_1.__generator(this, function (_h) {
|
|
411
408
|
switch (_h.label) {
|
|
412
409
|
case 0:
|
|
413
|
-
args = prepareArgsToSend(
|
|
410
|
+
args = prepareArgsToSend(getTypes(), args);
|
|
414
411
|
if (!remult_static_js_1.remultStatic.allEntities.includes(target.constructor)) return [3 /*break*/, 8];
|
|
415
412
|
defs = (0, getEntityRef_js_1.getEntityRef)(self);
|
|
416
413
|
return [4 /*yield*/, defs.__validateEntity()];
|