@hexaijs/plugin-contracts-generator 0.1.1 → 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.
- package/README.md +5 -2
- package/dist/cli-CPg-O4OY.d.ts +214 -0
- package/dist/cli.d.ts +1 -35
- package/dist/cli.js +2479 -232
- package/dist/cli.js.map +1 -1
- package/dist/decorators/index.d.ts +12 -11
- package/dist/decorators/index.js +21 -116
- package/dist/decorators/index.js.map +1 -1
- package/dist/index.d.ts +533 -40
- package/dist/index.js +2738 -91
- package/dist/index.js.map +1 -1
- package/dist/runtime/index.d.ts +23 -2
- package/dist/runtime/index.js +38 -5
- package/dist/runtime/index.js.map +1 -1
- package/package.json +10 -14
- package/dist/ast-utils.d.ts +0 -6
- package/dist/ast-utils.d.ts.map +0 -1
- package/dist/ast-utils.js +0 -111
- package/dist/ast-utils.js.map +0 -1
- package/dist/class-analyzer.d.ts +0 -16
- package/dist/class-analyzer.d.ts.map +0 -1
- package/dist/class-analyzer.js +0 -155
- package/dist/class-analyzer.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/config-loader.d.ts +0 -34
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -188
- package/dist/config-loader.js.map +0 -1
- package/dist/decorators/index.d.ts.map +0 -1
- package/dist/domain/index.d.ts +0 -2
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js +0 -18
- package/dist/domain/index.js.map +0 -1
- package/dist/domain/types.d.ts +0 -182
- package/dist/domain/types.d.ts.map +0 -1
- package/dist/domain/types.js +0 -65
- package/dist/domain/types.js.map +0 -1
- package/dist/errors.d.ts +0 -79
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -138
- package/dist/errors.js.map +0 -1
- package/dist/file-copier.d.ts +0 -84
- package/dist/file-copier.d.ts.map +0 -1
- package/dist/file-copier.js +0 -758
- package/dist/file-copier.js.map +0 -1
- package/dist/file-graph-resolver.d.ts +0 -47
- package/dist/file-graph-resolver.d.ts.map +0 -1
- package/dist/file-graph-resolver.js +0 -230
- package/dist/file-graph-resolver.js.map +0 -1
- package/dist/file-system.d.ts +0 -26
- package/dist/file-system.d.ts.map +0 -1
- package/dist/file-system.js +0 -34
- package/dist/file-system.js.map +0 -1
- package/dist/hexai-plugin.d.ts +0 -16
- package/dist/hexai-plugin.d.ts.map +0 -1
- package/dist/hexai-plugin.js +0 -59
- package/dist/hexai-plugin.js.map +0 -1
- package/dist/import-analyzer.d.ts +0 -6
- package/dist/import-analyzer.d.ts.map +0 -1
- package/dist/import-analyzer.js +0 -77
- package/dist/import-analyzer.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/logger.d.ts +0 -21
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -47
- package/dist/logger.js.map +0 -1
- package/dist/parser.d.ts +0 -32
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -209
- package/dist/parser.js.map +0 -1
- package/dist/pipeline.d.ts +0 -56
- package/dist/pipeline.d.ts.map +0 -1
- package/dist/pipeline.js +0 -152
- package/dist/pipeline.js.map +0 -1
- package/dist/reexport-generator.d.ts +0 -81
- package/dist/reexport-generator.d.ts.map +0 -1
- package/dist/reexport-generator.js +0 -208
- package/dist/reexport-generator.js.map +0 -1
- package/dist/registry-generator.d.ts +0 -27
- package/dist/registry-generator.d.ts.map +0 -1
- package/dist/registry-generator.js +0 -108
- package/dist/registry-generator.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/message-registry.d.ts +0 -23
- package/dist/runtime/message-registry.d.ts.map +0 -1
- package/dist/runtime/message-registry.js +0 -39
- package/dist/runtime/message-registry.js.map +0 -1
- package/dist/scanner.d.ts +0 -21
- package/dist/scanner.d.ts.map +0 -1
- package/dist/scanner.js +0 -53
- package/dist/scanner.js.map +0 -1
- package/dist/test-utils.d.ts +0 -23
- package/dist/test-utils.d.ts.map +0 -1
- package/dist/test-utils.js +0 -198
- package/dist/test-utils.js.map +0 -1
- package/dist/tsconfig-loader.d.ts +0 -8
- package/dist/tsconfig-loader.d.ts.map +0 -1
- package/dist/tsconfig-loader.js +0 -64
- 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
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
143
|
-
|
|
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 };
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,123 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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,"
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;AAuDO,IAAM,qBAAA,0BAA+B,aAAa;AAClD,IAAM,uBAAA,0BAAiC,eAAe;AACtD,IAAM,qBAAA,0BAA+B,aAAa;AA0BlD,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;AAmCO,SAAS,aAAA,CAAc,OAAA,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"]}
|