@praxisjs/decorators 0.6.0 → 0.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @praxisjs/decorators
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 72cd9a8: Fix method decorators rejecting typed parameters
8
+
9
+ `createMethodDecorator` used `unknown[]` for the method value type, which caused TypeScript to reject decorated methods with typed parameters (e.g. `async loadUser(id: number)`). Changed to `any[]` so the decorator accepts any async method signature. Updated the `Task`, `Queue`, and `Pool` decorator casts in `@praxisjs/concurrent` accordingly.
10
+
3
11
  ## 0.6.0
4
12
 
5
13
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  import type { StatefulComponent } from "@praxisjs/core";
2
2
  export interface MethodBehavior {
3
- wrap(original: (...args: unknown[]) => unknown, instance: object, name: string): (...args: unknown[]) => unknown;
3
+ wrap(original: (...args: any[]) => any, instance: object, name: string): (...args: any[]) => any;
4
4
  }
5
- export declare function createMethodDecorator(behavior: MethodBehavior): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<StatefulComponent>) => void;
5
+ export declare function createMethodDecorator(behavior: MethodBehavior): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<StatefulComponent>) => void;
6
6
  //# sourceMappingURL=create-method-decorator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-method-decorator.d.ts","sourceRoot":"","sources":["../src/create-method-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,IAAI,CACF,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACzC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;CACpC;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,IAE1D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACpD,SAAS,2BAA2B,CAAC,iBAAiB,CAAC,KACtD,IAAI,CAWR"}
1
+ {"version":3,"file":"create-method-decorator.d.ts","sourceRoot":"","sources":["../src/create-method-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAEF,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAEX,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,IAG1D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,SAAS,2BAA2B,CAAC,iBAAiB,CAAC,KACtD,IAAI,CAWR"}
@@ -1,5 +1,7 @@
1
1
  export function createMethodDecorator(behavior) {
2
- return function (value, context) {
2
+ return function (
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ value, context) {
3
5
  context.addInitializer(function () {
4
6
  const instance = this;
5
7
  const name = context.name;
@@ -1 +1 @@
1
- {"version":3,"file":"create-method-decorator.js","sourceRoot":"","sources":["../src/create-method-decorator.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,qBAAqB,CAAC,QAAwB;IAC5D,OAAO,UACL,KAAoD,EACpD,OAAuD;QAEvD,OAAO,CAAC,cAAc,CAAC;YACrB,MAAM,QAAQ,GAAG,IAAc,CAAC;YAChC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAc,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE;gBACpC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC;gBAC3C,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"create-method-decorator.js","sourceRoot":"","sources":["../src/create-method-decorator.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,qBAAqB,CAAC,QAAwB;IAC5D,OAAO;IACL,8DAA8D;IAC9D,KAA4C,EAC5C,OAAuD;QAEvD,OAAO,CAAC,cAAc,CAAC;YACrB,MAAM,QAAQ,GAAG,IAAc,CAAC;YAChC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAc,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE;gBACpC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC;gBAC3C,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { StatefulComponent } from "@praxisjs/core";
2
- export declare function Emit(propName: string): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<StatefulComponent>) => void;
2
+ export declare function Emit(propName: string): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<StatefulComponent>) => void;
3
3
  //# sourceMappingURL=emit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/events/emit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKxD,wBAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,0BAIjB,GAAI,8FAqBvB"}
1
+ {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/events/emit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKxD,wBAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,0BAMiB,GAAI,sFAmBzD"}
@@ -1,2 +1,2 @@
1
- export declare function Bind(): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
1
+ export declare function Bind(): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
2
2
  //# sourceMappingURL=bind.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/functions/bind.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,2BAK6H,GAAI,uHADpJ"}
1
+ {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/functions/bind.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,2BAKsT,GAAI,+GAD7U"}
@@ -1,3 +1,3 @@
1
1
  import type { StatefulComponent } from "@praxisjs/core";
2
- export declare function Debounce(ms: number): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<StatefulComponent>) => void;
2
+ export declare function Debounce(ms: number): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<StatefulComponent>) => void;
3
3
  //# sourceMappingURL=debounce.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/functions/debounce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,0BAKM,GAAI,8FAmB5C"}
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/functions/debounce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,0BASN,GAAI,sFAehC"}
@@ -5,5 +5,5 @@ export interface LogOptions {
5
5
  time?: boolean;
6
6
  devOnly?: boolean;
7
7
  }
8
- export declare function Log(options?: LogOptions): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
8
+ export declare function Log(options?: LogOptions): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
9
9
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,GAAG,CAAC,OAAO,GAAE,UAAe,0BAIjC,GAAI,uHAkDd"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,GAAG,CAAC,OAAO,GAAE,UAAe,0BAalC,GAAL,+GAyCJ"}
@@ -1,2 +1,2 @@
1
- export declare function Memo(): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
1
+ export declare function Memo(): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
2
2
  //# sourceMappingURL=memo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../src/functions/memo.ts"],"names":[],"mappings":"AAgCA,wBAAgB,IAAI,2BAtBX,GAAI,uHAqCZ"}
1
+ {"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../src/functions/memo.ts"],"names":[],"mappings":"AAgCA,wBAAgB,IAAI,2BAflB,GAAG,+GA8BJ"}
@@ -1,2 +1,2 @@
1
- export declare function Once(): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
1
+ export declare function Once(): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
2
2
  //# sourceMappingURL=once.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"once.d.ts","sourceRoot":"","sources":["../../src/functions/once.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,2BAQZ,GAAC,uHAKR"}
1
+ {"version":3,"file":"once.d.ts","sourceRoot":"","sources":["../../src/functions/once.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,2BAcoG,GAAI,+GAD3H"}
@@ -3,5 +3,5 @@ export interface RetryOptions {
3
3
  backoff?: number;
4
4
  onRetry?: (error: Error, attempt: number) => void;
5
5
  }
6
- export declare function Retry(maxAttempts: number, options?: RetryOptions): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
6
+ export declare function Retry(maxAttempts: number, options?: RetryOptions): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
7
7
  //# sourceMappingURL=retry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/functions/retry.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,0BAGtD,GAAI,uHAyBlB"}
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/functions/retry.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,0BAOrC,GAE/B,+GAmBA"}
@@ -1,2 +1,2 @@
1
- export declare function Throttle(ms: number): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
1
+ export declare function Throttle(ms: number): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
2
2
  //# sourceMappingURL=throttle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/functions/throttle.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,0BAOC,GAAG,uHAMtC"}
1
+ {"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/functions/throttle.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,0BAckD,GAAI,+GADxF"}
@@ -1,2 +1,2 @@
1
- export declare function Until(propName: string): (value: (this: object, ...args: unknown[]) => unknown, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
1
+ export declare function Until(propName: string): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
2
2
  //# sourceMappingURL=until.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"until.d.ts","sourceRoot":"","sources":["../../src/functions/until.ts"],"names":[],"mappings":"AAMA,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,0BAGhC,GAAH,uHASF"}
1
+ {"version":3,"file":"until.d.ts","sourceRoot":"","sources":["../../src/functions/until.ts"],"names":[],"mappings":"AAMA,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,0BAOrB,GAAG,+GAKnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisjs/decorators",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -2,15 +2,18 @@ import type { StatefulComponent } from "@praxisjs/core";
2
2
 
3
3
  export interface MethodBehavior {
4
4
  wrap(
5
- original: (...args: unknown[]) => unknown,
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ original: (...args: any[]) => any,
6
7
  instance: object,
7
8
  name: string,
8
- ): (...args: unknown[]) => unknown;
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ ): (...args: any[]) => any;
9
11
  }
10
12
 
11
13
  export function createMethodDecorator(behavior: MethodBehavior) {
12
14
  return function (
13
- value: (this: object, ...args: unknown[]) => unknown,
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ value: (this: object, ...args: any[]) => any,
14
17
  context: ClassMethodDecoratorContext<StatefulComponent>,
15
18
  ): void {
16
19
  context.addInitializer(function (this: unknown) {