@hexaijs/plugin-contracts-generator 0.1.0 → 0.2.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.
Files changed (99) hide show
  1. package/README.md +5 -2
  2. package/dist/cli-CPg-O4OY.d.ts +214 -0
  3. package/dist/cli.d.ts +1 -35
  4. package/dist/cli.js +2479 -232
  5. package/dist/cli.js.map +1 -1
  6. package/dist/decorators/index.d.ts +12 -11
  7. package/dist/decorators/index.js +21 -116
  8. package/dist/decorators/index.js.map +1 -1
  9. package/dist/index.d.ts +533 -40
  10. package/dist/index.js +2738 -91
  11. package/dist/index.js.map +1 -1
  12. package/dist/runtime/index.d.ts +23 -2
  13. package/dist/runtime/index.js +38 -5
  14. package/dist/runtime/index.js.map +1 -1
  15. package/package.json +63 -75
  16. package/dist/ast-utils.d.ts +0 -6
  17. package/dist/ast-utils.d.ts.map +0 -1
  18. package/dist/ast-utils.js +0 -111
  19. package/dist/ast-utils.js.map +0 -1
  20. package/dist/class-analyzer.d.ts +0 -16
  21. package/dist/class-analyzer.d.ts.map +0 -1
  22. package/dist/class-analyzer.js +0 -155
  23. package/dist/class-analyzer.js.map +0 -1
  24. package/dist/cli.d.ts.map +0 -1
  25. package/dist/config-loader.d.ts +0 -34
  26. package/dist/config-loader.d.ts.map +0 -1
  27. package/dist/config-loader.js +0 -188
  28. package/dist/config-loader.js.map +0 -1
  29. package/dist/decorators/index.d.ts.map +0 -1
  30. package/dist/domain/index.d.ts +0 -2
  31. package/dist/domain/index.d.ts.map +0 -1
  32. package/dist/domain/index.js +0 -18
  33. package/dist/domain/index.js.map +0 -1
  34. package/dist/domain/types.d.ts +0 -182
  35. package/dist/domain/types.d.ts.map +0 -1
  36. package/dist/domain/types.js +0 -65
  37. package/dist/domain/types.js.map +0 -1
  38. package/dist/errors.d.ts +0 -79
  39. package/dist/errors.d.ts.map +0 -1
  40. package/dist/errors.js +0 -138
  41. package/dist/errors.js.map +0 -1
  42. package/dist/file-copier.d.ts +0 -85
  43. package/dist/file-copier.d.ts.map +0 -1
  44. package/dist/file-copier.js +0 -773
  45. package/dist/file-copier.js.map +0 -1
  46. package/dist/file-graph-resolver.d.ts +0 -47
  47. package/dist/file-graph-resolver.d.ts.map +0 -1
  48. package/dist/file-graph-resolver.js +0 -230
  49. package/dist/file-graph-resolver.js.map +0 -1
  50. package/dist/file-system.d.ts +0 -26
  51. package/dist/file-system.d.ts.map +0 -1
  52. package/dist/file-system.js +0 -34
  53. package/dist/file-system.js.map +0 -1
  54. package/dist/hexai-plugin.d.ts +0 -16
  55. package/dist/hexai-plugin.d.ts.map +0 -1
  56. package/dist/hexai-plugin.js +0 -59
  57. package/dist/hexai-plugin.js.map +0 -1
  58. package/dist/import-analyzer.d.ts +0 -6
  59. package/dist/import-analyzer.d.ts.map +0 -1
  60. package/dist/import-analyzer.js +0 -77
  61. package/dist/import-analyzer.js.map +0 -1
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/logger.d.ts +0 -21
  64. package/dist/logger.d.ts.map +0 -1
  65. package/dist/logger.js +0 -47
  66. package/dist/logger.js.map +0 -1
  67. package/dist/parser.d.ts +0 -32
  68. package/dist/parser.d.ts.map +0 -1
  69. package/dist/parser.js +0 -209
  70. package/dist/parser.js.map +0 -1
  71. package/dist/pipeline.d.ts +0 -56
  72. package/dist/pipeline.d.ts.map +0 -1
  73. package/dist/pipeline.js +0 -152
  74. package/dist/pipeline.js.map +0 -1
  75. package/dist/reexport-generator.d.ts +0 -81
  76. package/dist/reexport-generator.d.ts.map +0 -1
  77. package/dist/reexport-generator.js +0 -208
  78. package/dist/reexport-generator.js.map +0 -1
  79. package/dist/registry-generator.d.ts +0 -27
  80. package/dist/registry-generator.d.ts.map +0 -1
  81. package/dist/registry-generator.js +0 -108
  82. package/dist/registry-generator.js.map +0 -1
  83. package/dist/runtime/index.d.ts.map +0 -1
  84. package/dist/runtime/message-registry.d.ts +0 -23
  85. package/dist/runtime/message-registry.d.ts.map +0 -1
  86. package/dist/runtime/message-registry.js +0 -39
  87. package/dist/runtime/message-registry.js.map +0 -1
  88. package/dist/scanner.d.ts +0 -21
  89. package/dist/scanner.d.ts.map +0 -1
  90. package/dist/scanner.js +0 -53
  91. package/dist/scanner.js.map +0 -1
  92. package/dist/test-utils.d.ts +0 -23
  93. package/dist/test-utils.d.ts.map +0 -1
  94. package/dist/test-utils.js +0 -198
  95. package/dist/test-utils.js.map +0 -1
  96. package/dist/tsconfig-loader.d.ts +0 -8
  97. package/dist/tsconfig-loader.d.ts.map +0 -1
  98. package/dist/tsconfig-loader.js +0 -64
  99. package/dist/tsconfig-loader.js.map +0 -1
@@ -3,8 +3,8 @@
3
3
  * These decorators have no runtime effect - the Message Parser
4
4
  * statically analyzes source code to find and extract them.
5
5
  */
6
- import "reflect-metadata";
7
- export interface PublicEventOptions {
6
+
7
+ interface PublicEventOptions {
8
8
  /**
9
9
  * Event version for versioned events
10
10
  * @example @PublicEvent({ version: 2 })
@@ -17,7 +17,7 @@ export interface PublicEventOptions {
17
17
  */
18
18
  context?: string;
19
19
  }
20
- export interface PublicCommandOptions {
20
+ interface PublicCommandOptions {
21
21
  /**
22
22
  * Business context this command belongs to
23
23
  * If not specified, inferred from package name
@@ -31,7 +31,7 @@ export interface PublicCommandOptions {
31
31
  */
32
32
  response?: string;
33
33
  }
34
- export interface PublicQueryOptions {
34
+ interface PublicQueryOptions {
35
35
  /**
36
36
  * Business context this query belongs to
37
37
  * If not specified, inferred from package name
@@ -45,9 +45,9 @@ export interface PublicQueryOptions {
45
45
  */
46
46
  response?: string;
47
47
  }
48
- export declare const PUBLIC_EVENT_METADATA: unique symbol;
49
- export declare const PUBLIC_COMMAND_METADATA: unique symbol;
50
- export declare const PUBLIC_QUERY_METADATA: unique symbol;
48
+ declare const PUBLIC_EVENT_METADATA: unique symbol;
49
+ declare const PUBLIC_COMMAND_METADATA: unique symbol;
50
+ declare const PUBLIC_QUERY_METADATA: unique symbol;
51
51
  /**
52
52
  * Marks a class as a Domain Event for extraction to public contracts
53
53
  *
@@ -72,7 +72,7 @@ export declare const PUBLIC_QUERY_METADATA: unique symbol;
72
72
  * }
73
73
  * ```
74
74
  */
75
- export declare function PublicEvent(options?: PublicEventOptions): ClassDecorator;
75
+ declare function PublicEvent(options?: PublicEventOptions): ClassDecorator;
76
76
  /**
77
77
  * Marks a class as a Command for extraction to public contracts
78
78
  *
@@ -106,7 +106,7 @@ export declare function PublicEvent(options?: PublicEventOptions): ClassDecorato
106
106
  * export type DialogueCreatedResult = { dialogueId: string };
107
107
  * ```
108
108
  */
109
- export declare function PublicCommand(options?: PublicCommandOptions): ClassDecorator;
109
+ declare function PublicCommand(options?: PublicCommandOptions): ClassDecorator;
110
110
  /**
111
111
  * Marks a class as a Query for extraction to public contracts
112
112
  *
@@ -139,5 +139,6 @@ export declare function PublicCommand(options?: PublicCommandOptions): ClassDeco
139
139
  * export type UserProfileResult = { name: string; email: string };
140
140
  * ```
141
141
  */
142
- export declare function PublicQuery(options?: PublicQueryOptions): ClassDecorator;
143
- //# sourceMappingURL=index.d.ts.map
142
+ declare function PublicQuery(options?: PublicQueryOptions): ClassDecorator;
143
+
144
+ export { PUBLIC_COMMAND_METADATA, PUBLIC_EVENT_METADATA, PUBLIC_QUERY_METADATA, PublicCommand, type PublicCommandOptions, PublicEvent, type PublicEventOptions, PublicQuery, type PublicQueryOptions };
@@ -1,123 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PUBLIC_QUERY_METADATA = exports.PUBLIC_COMMAND_METADATA = exports.PUBLIC_EVENT_METADATA = void 0;
4
- exports.PublicEvent = PublicEvent;
5
- exports.PublicCommand = PublicCommand;
6
- exports.PublicQuery = PublicQuery;
7
- /**
8
- * Decorators for marking Domain Events and Commands.
9
- * These decorators have no runtime effect - the Message Parser
10
- * statically analyzes source code to find and extract them.
11
- */
12
- require("reflect-metadata");
13
- exports.PUBLIC_EVENT_METADATA = Symbol('publicEvent');
14
- exports.PUBLIC_COMMAND_METADATA = Symbol('publicCommand');
15
- exports.PUBLIC_QUERY_METADATA = Symbol('publicQuery');
16
- /**
17
- * Marks a class as a Domain Event for extraction to public contracts
18
- *
19
- * @example
20
- * ```typescript
21
- * @PublicEvent()
22
- * export class UserRegistered extends Message {
23
- * constructor(
24
- * public readonly userId: string,
25
- * public readonly email: string,
26
- * ) {
27
- * super();
28
- * }
29
- * }
30
- * ```
31
- *
32
- * @example With options
33
- * ```typescript
34
- * @PublicEvent({ version: 2, context: 'auth' })
35
- * export class UserRegisteredV2 extends Message {
36
- * // ...
37
- * }
38
- * ```
39
- */
1
+ import 'reflect-metadata';
2
+
3
+ // src/decorators/index.ts
4
+ var PUBLIC_EVENT_METADATA = /* @__PURE__ */ Symbol("publicEvent");
5
+ var PUBLIC_COMMAND_METADATA = /* @__PURE__ */ Symbol("publicCommand");
6
+ var PUBLIC_QUERY_METADATA = /* @__PURE__ */ Symbol("publicQuery");
40
7
  function PublicEvent(options = {}) {
41
- return (target) => {
42
- Reflect.defineMetadata(exports.PUBLIC_EVENT_METADATA, options, target);
43
- return target;
44
- };
8
+ return (target) => {
9
+ Reflect.defineMetadata(PUBLIC_EVENT_METADATA, options, target);
10
+ return target;
11
+ };
45
12
  }
46
- /**
47
- * Marks a class as a Command for extraction to public contracts
48
- *
49
- * @example
50
- * ```typescript
51
- * @PublicCommand()
52
- * export class CreateUser extends Request<CreateUserResult> {
53
- * constructor(
54
- * public readonly email: string,
55
- * public readonly name: string,
56
- * ) {
57
- * super();
58
- * }
59
- * }
60
- * ```
61
- *
62
- * @example With context option
63
- * ```typescript
64
- * @PublicCommand({ context: 'auth' })
65
- * export class CreateUser extends Request<CreateUserResult> {
66
- * // ...
67
- * }
68
- * ```
69
- *
70
- * @example With explicit response type
71
- * ```typescript
72
- * @PublicCommand({ response: 'DialogueCreatedResult' })
73
- * export class BeginDialogueRequest extends Request<DialogueCreatedResult> {
74
- * // ...
75
- * }
76
- * export type DialogueCreatedResult = { dialogueId: string };
77
- * ```
78
- */
79
13
  function PublicCommand(options = {}) {
80
- return (target) => {
81
- Reflect.defineMetadata(exports.PUBLIC_COMMAND_METADATA, options, target);
82
- return target;
83
- };
14
+ return (target) => {
15
+ Reflect.defineMetadata(PUBLIC_COMMAND_METADATA, options, target);
16
+ return target;
17
+ };
84
18
  }
85
- /**
86
- * Marks a class as a Query for extraction to public contracts
87
- *
88
- * @example
89
- * ```typescript
90
- * @PublicQuery()
91
- * export class GetUserProfile extends Request<UserProfile> {
92
- * constructor(
93
- * public readonly userId: string,
94
- * ) {
95
- * super();
96
- * }
97
- * }
98
- * ```
99
- *
100
- * @example With context option
101
- * ```typescript
102
- * @PublicQuery({ context: 'catalog' })
103
- * export class GetProductDetails extends Request<ProductDetails> {
104
- * // ...
105
- * }
106
- * ```
107
- *
108
- * @example With explicit response type
109
- * ```typescript
110
- * @PublicQuery({ response: 'UserProfileResult' })
111
- * export class GetUserProfile extends Request<UserProfileResult> {
112
- * // ...
113
- * }
114
- * export type UserProfileResult = { name: string; email: string };
115
- * ```
116
- */
117
19
  function PublicQuery(options = {}) {
118
- return (target) => {
119
- Reflect.defineMetadata(exports.PUBLIC_QUERY_METADATA, options, target);
120
- return target;
121
- };
20
+ return (target) => {
21
+ Reflect.defineMetadata(PUBLIC_QUERY_METADATA, options, target);
22
+ return target;
23
+ };
122
24
  }
25
+
26
+ export { PUBLIC_COMMAND_METADATA, PUBLIC_EVENT_METADATA, PUBLIC_QUERY_METADATA, PublicCommand, PublicEvent, PublicQuery };
27
+ //# sourceMappingURL=index.js.map
123
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;AAmFA,kCAKC;AAmCD,sCAKC;AAmCD,kCAKC;AAxKD;;;;GAIG;AACH,4BAA0B;AAkDb,QAAA,qBAAqB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAC9C,QAAA,uBAAuB,GAAG,MA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AA,GAAgC,EAAC,EAAmB;AAChF,EAAA,OAAO,CAAC,MAAA,KAAW;AACjB,IAAA,OAAA,CAAQ,cAAA,CAAe,uBAAA,EAAyB,OAAA,EAAS,MAAM,CAAA;AAC/D,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AACF;AAmCO,SAAS,WAAA,CAAY,OAAA,GAA8B,EAAC,EAAmB;AAC5E,EAAA,OAAO,CAAC,MAAA,KAAW;AACjB,IAAA,OAAA,CAAQ,cAAA,CAAe,qBAAA,EAAuB,OAAA,EAAS,MAAM,CAAA;AAC7D,IAAA,OAAO,MAAA;AAAA,EACT,CAAA;AACF","file":"index.js","sourcesContent":["/**\n * Decorators for marking Domain Events and Commands.\n * These decorators have no runtime effect - the Message Parser\n * statically analyzes source code to find and extract them.\n */\nimport \"reflect-metadata\";\n\nexport interface PublicEventOptions {\n /**\n * Event version for versioned events\n * @example @PublicEvent({ version: 2 })\n */\n version?: number;\n\n /**\n * Business context this event belongs to\n * If not specified, inferred from package name\n * @example @PublicEvent({ context: 'lecture' })\n */\n context?: string;\n}\n\nexport interface PublicCommandOptions {\n /**\n * Business context this command belongs to\n * If not specified, inferred from package name\n * @example @PublicCommand({ context: 'auth' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this command\n * If specified, the parser will look for this type in the same file\n * @example @PublicCommand({ response: 'CreateUserResult' })\n */\n response?: string;\n}\n\n\nexport interface PublicQueryOptions {\n /**\n * Business context this query belongs to\n * If not specified, inferred from package name\n * @example @PublicQuery({ context: 'catalog' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this query\n * If specified, the parser will look for this type in the same file\n * @example @PublicQuery({ response: 'UserProfile' })\n */\n response?: string;\n}\n\nexport const PUBLIC_EVENT_METADATA = Symbol('publicEvent');\nexport const PUBLIC_COMMAND_METADATA = Symbol('publicCommand');\nexport const PUBLIC_QUERY_METADATA = Symbol('publicQuery');\n\n/**\n * Marks a class as a Domain Event for extraction to public contracts\n *\n * @example\n * ```typescript\n * @PublicEvent()\n * export class UserRegistered extends Message {\n * constructor(\n * public readonly userId: string,\n * public readonly email: string,\n * ) {\n * super();\n * }\n * }\n * ```\n *\n * @example With options\n * ```typescript\n * @PublicEvent({ version: 2, context: 'auth' })\n * export class UserRegisteredV2 extends Message {\n * // ...\n * }\n * ```\n */\nexport function PublicEvent(options: PublicEventOptions = {}): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(PUBLIC_EVENT_METADATA, options, target);\n return target;\n };\n}\n\n/**\n * Marks a class as a Command for extraction to public contracts\n *\n * @example\n * ```typescript\n * @PublicCommand()\n * export class CreateUser extends Request<CreateUserResult> {\n * constructor(\n * public readonly email: string,\n * public readonly name: string,\n * ) {\n * super();\n * }\n * }\n * ```\n *\n * @example With context option\n * ```typescript\n * @PublicCommand({ context: 'auth' })\n * export class CreateUser extends Request<CreateUserResult> {\n * // ...\n * }\n * ```\n *\n * @example With explicit response type\n * ```typescript\n * @PublicCommand({ response: 'DialogueCreatedResult' })\n * export class BeginDialogueRequest extends Request<DialogueCreatedResult> {\n * // ...\n * }\n * export type DialogueCreatedResult = { dialogueId: string };\n * ```\n */\nexport function PublicCommand(options: PublicCommandOptions = {}): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(PUBLIC_COMMAND_METADATA, options, target);\n return target;\n };\n}\n\n\n/**\n * Marks a class as a Query for extraction to public contracts\n *\n * @example\n * ```typescript\n * @PublicQuery()\n * export class GetUserProfile extends Request<UserProfile> {\n * constructor(\n * public readonly userId: string,\n * ) {\n * super();\n * }\n * }\n * ```\n *\n * @example With context option\n * ```typescript\n * @PublicQuery({ context: 'catalog' })\n * export class GetProductDetails extends Request<ProductDetails> {\n * // ...\n * }\n * ```\n *\n * @example With explicit response type\n * ```typescript\n * @PublicQuery({ response: 'UserProfileResult' })\n * export class GetUserProfile extends Request<UserProfileResult> {\n * // ...\n * }\n * export type UserProfileResult = { name: string; email: string };\n * ```\n */\nexport function PublicQuery(options: PublicQueryOptions = {}): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(PUBLIC_QUERY_METADATA, options, target);\n return target;\n };\n}\n"]}