moost 0.6.28 → 0.6.30

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/dist/index.cjs CHANGED
@@ -65,14 +65,24 @@ function runPipes(pipes, initialValue, metas, level) {
65
65
 
66
66
  //#endregion
67
67
  //#region packages/moost/src/metadata/moost-metadata.ts
68
- const moostMate = new _prostojs_mate.Mate("moost", {
68
+ const METADATA_WORKSPACE = "moost";
69
+ /**
70
+ * A param entry is "bare" when it carries nothing but the design-time type
71
+ * (auto-captured from `design:paramtypes` the moment any decorator touches the
72
+ * method). Bare entries mean the override declared no param decorators of its
73
+ * own, so the parent's param metadata (resolvers, pipes, …) should survive.
74
+ */ function isBareParam(param) {
75
+ return !param || Object.entries(param).every(([key, value]) => key === "type" || value === void 0);
76
+ }
77
+ const moostMate = new _prostojs_mate.Mate(METADATA_WORKSPACE, {
69
78
  readType: true,
70
79
  readReturnType: true,
71
80
  collectPropKeys: true,
72
81
  inherit(classMeta, targetMeta, level) {
82
+ if (targetMeta?.inherit === false) return false;
73
83
  if (level === "CLASS") return !!classMeta?.inherit;
74
- if (level === "PROP") return !!targetMeta?.inherit || !!(classMeta?.inherit && !targetMeta);
75
- return !!targetMeta?.inherit;
84
+ if (level === "PROP") return !!targetMeta?.inherit || !!classMeta?.inherit;
85
+ return !!targetMeta?.inherit || isBareParam(targetMeta);
76
86
  }
77
87
  });
78
88
  /** Returns the shared `Mate` instance operating in the `'moost'` metadata workspace. */ function getMoostMate() {
@@ -695,9 +705,22 @@ function fillLabel(target, key, index, name) {
695
705
  /**
696
706
  * ## Inherit
697
707
  * ### @Decorator
698
- * Inherit metadata from super class
699
- * @returns
700
- */ const Inherit = () => getMoostMate().decorate("inherit", true);
708
+ * Enables metadata inheritance from the super class. Goes on the **inheriting
709
+ * subclass** (the class whose metadata is being read), not on the base class.
710
+ *
711
+ * - On a class: class-level metadata is merged from the parent (own keys win),
712
+ * and every method/prop inherits the parent's metadata — including decorated
713
+ * overrides, which merge the parent's metadata under their own (so adding
714
+ * e.g. a rate-limit decorator to an override does not unbind the parent's
715
+ * `@Get`/`@Post` route).
716
+ * - On a method/prop: enables inheritance for just that member.
717
+ * - `@Inherit(false)` on an overridden member opts out of the merge for a
718
+ * deliberate full replacement (the member keeps only its own metadata).
719
+ *
720
+ * Note: constructor param metadata is inherited automatically when the
721
+ * subclass declares no constructor of its own; a subclass that declares a
722
+ * constructor uses its own params only.
723
+ */ const Inherit = (inherit = true) => getMoostMate().decorate("inherit", inherit);
701
724
 
702
725
  //#endregion
703
726
  //#region packages/moost/src/decorators/init.decorator.ts
package/dist/index.d.ts CHANGED
@@ -575,10 +575,23 @@ declare function HandlerPaths(method?: string, opts?: TGetHandlerPathsOptions):
575
575
  /**
576
576
  * ## Inherit
577
577
  * ### @Decorator
578
- * Inherit metadata from super class
579
- * @returns
578
+ * Enables metadata inheritance from the super class. Goes on the **inheriting
579
+ * subclass** (the class whose metadata is being read), not on the base class.
580
+ *
581
+ * - On a class: class-level metadata is merged from the parent (own keys win),
582
+ * and every method/prop inherits the parent's metadata — including decorated
583
+ * overrides, which merge the parent's metadata under their own (so adding
584
+ * e.g. a rate-limit decorator to an override does not unbind the parent's
585
+ * `@Get`/`@Post` route).
586
+ * - On a method/prop: enables inheritance for just that member.
587
+ * - `@Inherit(false)` on an overridden member opts out of the merge for a
588
+ * deliberate full replacement (the member keeps only its own metadata).
589
+ *
590
+ * Note: constructor param metadata is inherited automatically when the
591
+ * subclass declares no constructor of its own; a subclass that declares a
592
+ * constructor uses its own params only.
580
593
  */
581
- declare const Inherit: () => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
594
+ declare const Inherit: (inherit?: boolean) => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
582
595
 
583
596
  /**
584
597
  * ## MoostInit
package/dist/index.mjs CHANGED
@@ -64,14 +64,24 @@ function runPipes(pipes, initialValue, metas, level) {
64
64
 
65
65
  //#endregion
66
66
  //#region packages/moost/src/metadata/moost-metadata.ts
67
- const moostMate = new Mate("moost", {
67
+ const METADATA_WORKSPACE = "moost";
68
+ /**
69
+ * A param entry is "bare" when it carries nothing but the design-time type
70
+ * (auto-captured from `design:paramtypes` the moment any decorator touches the
71
+ * method). Bare entries mean the override declared no param decorators of its
72
+ * own, so the parent's param metadata (resolvers, pipes, …) should survive.
73
+ */ function isBareParam(param) {
74
+ return !param || Object.entries(param).every(([key, value]) => key === "type" || value === void 0);
75
+ }
76
+ const moostMate = new Mate(METADATA_WORKSPACE, {
68
77
  readType: true,
69
78
  readReturnType: true,
70
79
  collectPropKeys: true,
71
80
  inherit(classMeta, targetMeta, level) {
81
+ if (targetMeta?.inherit === false) return false;
72
82
  if (level === "CLASS") return !!classMeta?.inherit;
73
- if (level === "PROP") return !!targetMeta?.inherit || !!(classMeta?.inherit && !targetMeta);
74
- return !!targetMeta?.inherit;
83
+ if (level === "PROP") return !!targetMeta?.inherit || !!classMeta?.inherit;
84
+ return !!targetMeta?.inherit || isBareParam(targetMeta);
75
85
  }
76
86
  });
77
87
  /** Returns the shared `Mate` instance operating in the `'moost'` metadata workspace. */ function getMoostMate() {
@@ -694,9 +704,22 @@ function fillLabel(target, key, index, name) {
694
704
  /**
695
705
  * ## Inherit
696
706
  * ### @Decorator
697
- * Inherit metadata from super class
698
- * @returns
699
- */ const Inherit = () => getMoostMate().decorate("inherit", true);
707
+ * Enables metadata inheritance from the super class. Goes on the **inheriting
708
+ * subclass** (the class whose metadata is being read), not on the base class.
709
+ *
710
+ * - On a class: class-level metadata is merged from the parent (own keys win),
711
+ * and every method/prop inherits the parent's metadata — including decorated
712
+ * overrides, which merge the parent's metadata under their own (so adding
713
+ * e.g. a rate-limit decorator to an override does not unbind the parent's
714
+ * `@Get`/`@Post` route).
715
+ * - On a method/prop: enables inheritance for just that member.
716
+ * - `@Inherit(false)` on an overridden member opts out of the merge for a
717
+ * deliberate full replacement (the member keeps only its own metadata).
718
+ *
719
+ * Note: constructor param metadata is inherited automatically when the
720
+ * subclass declares no constructor of its own; a subclass that declares a
721
+ * constructor uses its own params only.
722
+ */ const Inherit = (inherit = true) => getMoostMate().decorate("inherit", inherit);
700
723
 
701
724
  //#endregion
702
725
  //#region packages/moost/src/decorators/init.decorator.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moost",
3
- "version": "0.6.28",
3
+ "version": "0.6.30",
4
4
  "description": "moost",
5
5
  "keywords": [
6
6
  "composables",
@@ -49,7 +49,7 @@
49
49
  "@wooksjs/event-http": "^0.7.19",
50
50
  "@wooksjs/http-body": "^0.7.19",
51
51
  "vitest": "3.2.4",
52
- "@moostjs/event-http": "^0.6.28"
52
+ "@moostjs/event-http": "^0.6.30"
53
53
  },
54
54
  "scripts": {
55
55
  "pub": "pnpm publish --access public",