remult 0.25.5-exp.4 → 0.25.5-exp.5

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.
@@ -1,5 +1,4 @@
1
1
  export {};
2
- //y1 - another toOne scenario - for a one to one relation, where the other table has my id in one of its fields.
3
2
  //y1 - number default storage in knex is decimal and it by default has 8,2 - meaning only 999,999 - I think it should be way bigger than that. in firefly we do at least 18 - https://discord.com/channels/975754286384418847/1195162533447876658
4
3
  //y1 - talk about the parameter issue with backend methods
5
4
  //y1 - tried to upgrade vitest, nuxt tests are failing with loading uuid - sounds familiar?
@@ -122,7 +122,10 @@ export function BackendMethod(options) {
122
122
  if (target.prototype !== undefined) {
123
123
  var types = Reflect.getMetadata('design:paramtypes', target, key);
124
124
  if (options.paramTypes)
125
- types = options.paramTypes;
125
+ types =
126
+ typeof options.paramTypes === 'function'
127
+ ? options.paramTypes()
128
+ : options.paramTypes;
126
129
  // if types are undefined - you've forgot to set: "emitDecoratorMetadata":true
127
130
  let serverAction = new myServerAction((options?.apiPrefix ? options.apiPrefix + '/' : '') + key, types, options, (args) => originalMethod.apply(undefined, args));
128
131
  serverAction.doWork = async (args, self, url, http) => {
@@ -151,7 +154,10 @@ export function BackendMethod(options) {
151
154
  }
152
155
  var types = Reflect.getMetadata('design:paramtypes', target, key);
153
156
  if (options.paramTypes)
154
- types = options.paramTypes;
157
+ types =
158
+ typeof options.paramTypes === 'function'
159
+ ? options.paramTypes()
160
+ : options.paramTypes;
155
161
  let x = remultStatic.classHelpers.get(target.constructor);
156
162
  if (!x) {
157
163
  x = new ClassHelper();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.25.5-exp.4",
3
+ "version": "0.25.5-exp.5",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //y1 - another toOne scenario - for a one to one relation, where the other table has my id in one of its fields.
4
3
  //y1 - number default storage in knex is decimal and it by default has 8,2 - meaning only 999,999 - I think it should be way bigger than that. in firefly we do at least 18 - https://discord.com/channels/975754286384418847/1195162533447876658
5
4
  //y1 - talk about the parameter issue with backend methods
6
5
  //y1 - tried to upgrade vitest, nuxt tests are failing with loading uuid - sounds familiar?
@@ -43,7 +43,7 @@ export interface BackendMethodOptions<type> {
43
43
  queue?: boolean;
44
44
  /** EXPERIMENTAL: Determines if the user should be blocked while this `BackendMethod` is running*/
45
45
  blockUser?: boolean;
46
- paramTypes?: any[];
46
+ paramTypes?: any[] | (() => any[]);
47
47
  }
48
48
  export declare function Controller(key: string): (target: any, context?: any) => any;
49
49
  export interface ClassMethodDecoratorContextStub<This = unknown, Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any> {
@@ -194,7 +194,10 @@ function BackendMethod(options) {
194
194
  if (target.prototype !== undefined) {
195
195
  var types = Reflect.getMetadata('design:paramtypes', target, key);
196
196
  if (options.paramTypes)
197
- types = options.paramTypes;
197
+ types =
198
+ typeof options.paramTypes === 'function'
199
+ ? options.paramTypes()
200
+ : options.paramTypes;
198
201
  // if types are undefined - you've forgot to set: "emitDecoratorMetadata":true
199
202
  var serverAction_1 = new myServerAction(((options === null || options === void 0 ? void 0 : options.apiPrefix) ? options.apiPrefix + '/' : '') + key, types, options, function (args) { return originalMethod.apply(undefined, args); });
200
203
  serverAction_1.doWork = function (args, self, url, http) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
@@ -245,7 +248,10 @@ function BackendMethod(options) {
245
248
  }
246
249
  var types = Reflect.getMetadata('design:paramtypes', target, key);
247
250
  if (options.paramTypes)
248
- types = options.paramTypes;
251
+ types =
252
+ typeof options.paramTypes === 'function'
253
+ ? options.paramTypes()
254
+ : options.paramTypes;
249
255
  var x = remult_static_js_1.remultStatic.classHelpers.get(target.constructor);
250
256
  if (!x) {
251
257
  x = new context_js_1.ClassHelper();