@living-architecture/riviere-extract-conventions-published-language 0.7.2 → 0.8.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.
package/dist/index.js CHANGED
@@ -1,4 +1,18 @@
1
1
  // src/published-language/decorators.ts
2
+ var InvalidCustomComponentTypeError = class extends Error {
3
+ constructor(type) {
4
+ super(`Custom component type must be a non-empty string, got: ${formatCustomType(type)}`);
5
+ this.name = "InvalidCustomComponentTypeError";
6
+ }
7
+ };
8
+ function formatCustomType(type) {
9
+ if (typeof type === "string") return `'${type}'`;
10
+ try {
11
+ return JSON.stringify(type) ?? String(type);
12
+ } catch {
13
+ return "<unprintable value>";
14
+ }
15
+ }
2
16
  function DomainOpContainer(target, _) {
3
17
  return target;
4
18
  }
@@ -40,9 +54,8 @@ function HttpCall(_route, _method) {
40
54
  };
41
55
  }
42
56
  function Custom(type) {
43
- const trimmed = type.trim();
44
- if (trimmed.length === 0) {
45
- throw new TypeError(`Custom component type must be a non-empty string, got: '${type}'`);
57
+ if (typeof type !== "string" || type.trim().length === 0) {
58
+ throw new InvalidCustomComponentTypeError(type);
46
59
  }
47
60
  return function(target, _) {
48
61
  return target;
@@ -69,10 +69,10 @@ export declare function HttpCall(_route: string, _method: string): <T extends Me
69
69
  * Marks a class or method with a custom component type.
70
70
  * Use when standard component types don't fit.
71
71
  *
72
- * @throws TypeError if type is empty or whitespace-only
72
+ * @throws InvalidCustomComponentTypeError if type is not a non-empty string
73
73
  */
74
74
  /** @riviere-role published-language-annotation */
75
- export declare function Custom(type: string): <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T;
75
+ export declare function Custom(type: unknown): <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T;
76
76
  /**
77
77
  * Excludes a class or method from architectural analysis.
78
78
  * Use for infrastructure code, utilities, or code that shouldn't appear in the architecture.
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../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AAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,KAAK,CAAC,CAIrD;AAED;;GAEG;AACH,kDAAkD;AAClD,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,2BAA2B,KAAK,CAAC,CAI1E;AAMD;;;;;GAKG;AACH,kDAAkD;AAClD,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,GACZ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,GAAG,2BAA2B,KAAK,CAAC,CAOnF;AAED;;;GAGG;AACH,kDAAkD;AAClD,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,qBAAqB,GAAG,2BAA2B,GAAG,CAAC,CAE9F"}
@@ -4,6 +4,22 @@
4
4
  * These decorators are pure markers with no runtime behavior.
5
5
  * They exist to be detected by the riviere-extract-ts extractor.
6
6
  */
7
+ class InvalidCustomComponentTypeError extends Error {
8
+ constructor(type) {
9
+ super(`Custom component type must be a non-empty string, got: ${formatCustomType(type)}`);
10
+ this.name = 'InvalidCustomComponentTypeError';
11
+ }
12
+ }
13
+ function formatCustomType(type) {
14
+ if (typeof type === 'string')
15
+ return `'${type}'`;
16
+ try {
17
+ return JSON.stringify(type) ?? String(type);
18
+ }
19
+ catch {
20
+ return '<unprintable value>';
21
+ }
22
+ }
7
23
  // ============================================================================
8
24
  // Container Decorators (class-level, all public methods inherit type)
9
25
  // ============================================================================
@@ -108,13 +124,12 @@ export function HttpCall(_route, _method) {
108
124
  * Marks a class or method with a custom component type.
109
125
  * Use when standard component types don't fit.
110
126
  *
111
- * @throws TypeError if type is empty or whitespace-only
127
+ * @throws InvalidCustomComponentTypeError if type is not a non-empty string
112
128
  */
113
129
  /** @riviere-role published-language-annotation */
114
130
  export function Custom(type) {
115
- const trimmed = type.trim();
116
- if (trimmed.length === 0) {
117
- throw new TypeError(`Custom component type must be a non-empty string, got: '${type}'`);
131
+ if (typeof type !== 'string' || type.trim().length === 0) {
132
+ throw new InvalidCustomComponentTypeError(type);
118
133
  }
119
134
  return function (target, _) {
120
135
  return target;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@living-architecture/riviere-extract-conventions-published-language",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,6 +39,6 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "@typescript-eslint/utils": "8.53.0",
42
- "@living-architecture/riviere-extract-config-published-language": "0.7.2"
42
+ "@living-architecture/riviere-extract-config-published-language": "0.8.0"
43
43
  }
44
44
  }