@hexaijs/plugin-contracts-generator 0.1.1 → 0.2.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/README.md +38 -27
- package/dist/cli-DajurpEQ.d.ts +277 -0
- package/dist/cli.d.ts +1 -35
- package/dist/cli.js +2474 -233
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +461 -40
- package/dist/index.js +2711 -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 +11 -19
- 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 +0 -143
- package/dist/decorators/index.d.ts.map +0 -1
- package/dist/decorators/index.js +0 -123
- package/dist/decorators/index.js.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
package/dist/config-loader.js
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ConfigLoadError = exports.ConfigLoader = void 0;
|
|
37
|
-
const path_1 = require("path");
|
|
38
|
-
const ts = __importStar(require("typescript"));
|
|
39
|
-
const errors_1 = require("./errors");
|
|
40
|
-
const file_system_1 = require("./file-system");
|
|
41
|
-
const domain_1 = require("./domain");
|
|
42
|
-
const PACKAGE_CONFIG_FILENAME = "application.config.ts";
|
|
43
|
-
const SUPPORTED_GLOB_PARTS_COUNT = 2;
|
|
44
|
-
class ConfigLoader {
|
|
45
|
-
fs;
|
|
46
|
-
constructor(options = {}) {
|
|
47
|
-
this.fs = options.fileSystem ?? file_system_1.nodeFileSystem;
|
|
48
|
-
}
|
|
49
|
-
async load(configPath) {
|
|
50
|
-
const absolutePath = (0, path_1.resolve)(configPath);
|
|
51
|
-
const config = await this.loadTypeScriptConfig(absolutePath);
|
|
52
|
-
return this.extractContractsConfig(config, (0, path_1.dirname)(absolutePath));
|
|
53
|
-
}
|
|
54
|
-
async loadTypeScriptConfig(absolutePath) {
|
|
55
|
-
const source = await this.fs.readFile(absolutePath);
|
|
56
|
-
const result = ts.transpileModule(source, {
|
|
57
|
-
compilerOptions: {
|
|
58
|
-
module: ts.ModuleKind.CommonJS,
|
|
59
|
-
target: ts.ScriptTarget.ES2020,
|
|
60
|
-
esModuleInterop: true,
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
const exports = {};
|
|
64
|
-
const moduleWrapper = new Function("exports", result.outputText);
|
|
65
|
-
moduleWrapper(exports);
|
|
66
|
-
return exports.default ?? exports;
|
|
67
|
-
}
|
|
68
|
-
async extractContractsConfig(config, configDir) {
|
|
69
|
-
const contracts = config.contracts;
|
|
70
|
-
if (!contracts) {
|
|
71
|
-
throw new errors_1.ConfigLoadError("Missing 'contracts' section in config");
|
|
72
|
-
}
|
|
73
|
-
if (!contracts.contexts || !Array.isArray(contracts.contexts)) {
|
|
74
|
-
throw new errors_1.ConfigLoadError("Missing 'contracts.contexts' in config");
|
|
75
|
-
}
|
|
76
|
-
const contexts = await this.resolveContexts(contracts.contexts, configDir);
|
|
77
|
-
if (contexts.length === 0) {
|
|
78
|
-
throw new errors_1.ConfigLoadError("No contexts found from 'contexts'");
|
|
79
|
-
}
|
|
80
|
-
const decoratorNames = (0, domain_1.mergeDecoratorNames)(contracts.decoratorNames);
|
|
81
|
-
return {
|
|
82
|
-
contexts,
|
|
83
|
-
pathAliasRewrites: contracts.pathAliasRewrites,
|
|
84
|
-
externalDependencies: contracts.externalDependencies,
|
|
85
|
-
decoratorNames,
|
|
86
|
-
responseNamingConventions: contracts.responseNamingConventions,
|
|
87
|
-
removeDecorators: contracts.removeDecorators ?? true,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
async resolveContexts(contextsConfig, configDir) {
|
|
91
|
-
const contexts = [];
|
|
92
|
-
for (let i = 0; i < contextsConfig.length; i++) {
|
|
93
|
-
const item = contextsConfig[i];
|
|
94
|
-
if (typeof item === "string") {
|
|
95
|
-
const resolvedContexts = await this.resolveStringContext(item, configDir);
|
|
96
|
-
contexts.push(...resolvedContexts);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
const validated = this.validateObjectContext(item, i);
|
|
100
|
-
contexts.push(validated);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return contexts;
|
|
104
|
-
}
|
|
105
|
-
async resolveStringContext(contextPath, configDir) {
|
|
106
|
-
if (contextPath.includes("*")) {
|
|
107
|
-
return this.expandGlobPattern(contextPath, configDir);
|
|
108
|
-
}
|
|
109
|
-
const packageDir = (0, path_1.resolve)(configDir, contextPath);
|
|
110
|
-
return [await this.loadPackageConfig(packageDir)];
|
|
111
|
-
}
|
|
112
|
-
async expandGlobPattern(pattern, configDir) {
|
|
113
|
-
const packageDirs = await this.matchGlobPattern(pattern, configDir);
|
|
114
|
-
const configs = await Promise.all(packageDirs.map((packageDir) => this.loadPackageConfig(packageDir)));
|
|
115
|
-
return configs;
|
|
116
|
-
}
|
|
117
|
-
async loadPackageConfig(packageDir) {
|
|
118
|
-
const configPath = (0, path_1.join)(packageDir, PACKAGE_CONFIG_FILENAME);
|
|
119
|
-
if (!await this.fs.exists(configPath)) {
|
|
120
|
-
throw new errors_1.ConfigLoadError(`Missing application.config.ts in package: ${packageDir}`);
|
|
121
|
-
}
|
|
122
|
-
const packageConfig = await this.loadTypeScriptConfig(configPath);
|
|
123
|
-
if (!packageConfig.contextName || typeof packageConfig.contextName !== "string") {
|
|
124
|
-
throw new errors_1.ConfigLoadError(`Missing 'contextName' in ${configPath}`);
|
|
125
|
-
}
|
|
126
|
-
if (!packageConfig.sourceDir || typeof packageConfig.sourceDir !== "string") {
|
|
127
|
-
throw new errors_1.ConfigLoadError(`Missing 'sourceDir' in ${configPath}`);
|
|
128
|
-
}
|
|
129
|
-
const contextName = packageConfig.contextName;
|
|
130
|
-
const sourceDir = (0, path_1.resolve)(packageDir, packageConfig.sourceDir);
|
|
131
|
-
const tsconfigPath = packageConfig.tsconfigPath
|
|
132
|
-
? (0, path_1.resolve)(packageDir, packageConfig.tsconfigPath)
|
|
133
|
-
: undefined;
|
|
134
|
-
return {
|
|
135
|
-
name: contextName,
|
|
136
|
-
sourceDir,
|
|
137
|
-
tsconfigPath,
|
|
138
|
-
responseNamingConventions: packageConfig.responseNamingConventions,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
validateObjectContext(ctx, index) {
|
|
142
|
-
if (!ctx.name || typeof ctx.name !== "string") {
|
|
143
|
-
throw new errors_1.ConfigLoadError(`Invalid context at index ${index}: missing 'name'`);
|
|
144
|
-
}
|
|
145
|
-
if (!ctx.sourceDir || typeof ctx.sourceDir !== "string") {
|
|
146
|
-
throw new errors_1.ConfigLoadError(`Invalid context at index ${index}: missing 'sourceDir'`);
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
name: ctx.name,
|
|
150
|
-
sourceDir: ctx.sourceDir,
|
|
151
|
-
tsconfigPath: ctx.tsconfigPath,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
async matchGlobPattern(pattern, configDir) {
|
|
155
|
-
const globParts = pattern.split("*");
|
|
156
|
-
if (globParts.length !== SUPPORTED_GLOB_PARTS_COUNT) {
|
|
157
|
-
throw new errors_1.ConfigLoadError(`Invalid glob pattern: "${pattern}". Only single wildcard patterns like "packages/*" are supported.`);
|
|
158
|
-
}
|
|
159
|
-
const [prefix, suffix] = globParts;
|
|
160
|
-
const baseDir = (0, path_1.resolve)(configDir, prefix);
|
|
161
|
-
if (!await this.fs.exists(baseDir)) {
|
|
162
|
-
return [];
|
|
163
|
-
}
|
|
164
|
-
const entries = await this.fs.readdir(baseDir);
|
|
165
|
-
const matchedDirs = [];
|
|
166
|
-
for (const entry of entries) {
|
|
167
|
-
const fullPath = (0, path_1.resolve)(baseDir, entry);
|
|
168
|
-
const stats = await this.fs.stat(fullPath);
|
|
169
|
-
if (!stats.isDirectory()) {
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
if (suffix) {
|
|
173
|
-
const suffixPath = (0, path_1.resolve)(fullPath, suffix.replace(/^\//, ""));
|
|
174
|
-
if (await this.fs.exists(suffixPath)) {
|
|
175
|
-
matchedDirs.push(fullPath);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
matchedDirs.push(fullPath);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return matchedDirs.sort();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
exports.ConfigLoader = ConfigLoader;
|
|
186
|
-
var errors_2 = require("./errors");
|
|
187
|
-
Object.defineProperty(exports, "ConfigLoadError", { enumerable: true, get: function () { return errors_2.ConfigLoadError; } });
|
|
188
|
-
//# sourceMappingURL=config-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src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AAI,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;oBACnC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC/B,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC;QACL,CAAC;QAED,OAAO,WAAW,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;CACJ;AA9MD,oCA8MC;AAED,mCAA2C;AAAlC,yGAAA,eAAe,OAAA"}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decorators for marking Domain Events and Commands.
|
|
3
|
-
* These decorators have no runtime effect - the Message Parser
|
|
4
|
-
* statically analyzes source code to find and extract them.
|
|
5
|
-
*/
|
|
6
|
-
import "reflect-metadata";
|
|
7
|
-
export interface PublicEventOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Event version for versioned events
|
|
10
|
-
* @example @PublicEvent({ version: 2 })
|
|
11
|
-
*/
|
|
12
|
-
version?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Business context this event belongs to
|
|
15
|
-
* If not specified, inferred from package name
|
|
16
|
-
* @example @PublicEvent({ context: 'lecture' })
|
|
17
|
-
*/
|
|
18
|
-
context?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface PublicCommandOptions {
|
|
21
|
-
/**
|
|
22
|
-
* Business context this command belongs to
|
|
23
|
-
* If not specified, inferred from package name
|
|
24
|
-
* @example @PublicCommand({ context: 'auth' })
|
|
25
|
-
*/
|
|
26
|
-
context?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Explicit response type name for this command
|
|
29
|
-
* If specified, the parser will look for this type in the same file
|
|
30
|
-
* @example @PublicCommand({ response: 'CreateUserResult' })
|
|
31
|
-
*/
|
|
32
|
-
response?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface PublicQueryOptions {
|
|
35
|
-
/**
|
|
36
|
-
* Business context this query belongs to
|
|
37
|
-
* If not specified, inferred from package name
|
|
38
|
-
* @example @PublicQuery({ context: 'catalog' })
|
|
39
|
-
*/
|
|
40
|
-
context?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Explicit response type name for this query
|
|
43
|
-
* If specified, the parser will look for this type in the same file
|
|
44
|
-
* @example @PublicQuery({ response: 'UserProfile' })
|
|
45
|
-
*/
|
|
46
|
-
response?: string;
|
|
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;
|
|
51
|
-
/**
|
|
52
|
-
* Marks a class as a Domain Event for extraction to public contracts
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* @PublicEvent()
|
|
57
|
-
* export class UserRegistered extends Message {
|
|
58
|
-
* constructor(
|
|
59
|
-
* public readonly userId: string,
|
|
60
|
-
* public readonly email: string,
|
|
61
|
-
* ) {
|
|
62
|
-
* super();
|
|
63
|
-
* }
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @example With options
|
|
68
|
-
* ```typescript
|
|
69
|
-
* @PublicEvent({ version: 2, context: 'auth' })
|
|
70
|
-
* export class UserRegisteredV2 extends Message {
|
|
71
|
-
* // ...
|
|
72
|
-
* }
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export declare function PublicEvent(options?: PublicEventOptions): ClassDecorator;
|
|
76
|
-
/**
|
|
77
|
-
* Marks a class as a Command for extraction to public contracts
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* @PublicCommand()
|
|
82
|
-
* export class CreateUser extends Request<CreateUserResult> {
|
|
83
|
-
* constructor(
|
|
84
|
-
* public readonly email: string,
|
|
85
|
-
* public readonly name: string,
|
|
86
|
-
* ) {
|
|
87
|
-
* super();
|
|
88
|
-
* }
|
|
89
|
-
* }
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* @example With context option
|
|
93
|
-
* ```typescript
|
|
94
|
-
* @PublicCommand({ context: 'auth' })
|
|
95
|
-
* export class CreateUser extends Request<CreateUserResult> {
|
|
96
|
-
* // ...
|
|
97
|
-
* }
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @example With explicit response type
|
|
101
|
-
* ```typescript
|
|
102
|
-
* @PublicCommand({ response: 'DialogueCreatedResult' })
|
|
103
|
-
* export class BeginDialogueRequest extends Request<DialogueCreatedResult> {
|
|
104
|
-
* // ...
|
|
105
|
-
* }
|
|
106
|
-
* export type DialogueCreatedResult = { dialogueId: string };
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
export declare function PublicCommand(options?: PublicCommandOptions): ClassDecorator;
|
|
110
|
-
/**
|
|
111
|
-
* Marks a class as a Query for extraction to public contracts
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* @PublicQuery()
|
|
116
|
-
* export class GetUserProfile extends Request<UserProfile> {
|
|
117
|
-
* constructor(
|
|
118
|
-
* public readonly userId: string,
|
|
119
|
-
* ) {
|
|
120
|
-
* super();
|
|
121
|
-
* }
|
|
122
|
-
* }
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* @example With context option
|
|
126
|
-
* ```typescript
|
|
127
|
-
* @PublicQuery({ context: 'catalog' })
|
|
128
|
-
* export class GetProductDetails extends Request<ProductDetails> {
|
|
129
|
-
* // ...
|
|
130
|
-
* }
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @example With explicit response type
|
|
134
|
-
* ```typescript
|
|
135
|
-
* @PublicQuery({ response: 'UserProfileResult' })
|
|
136
|
-
* export class GetUserProfile extends Request<UserProfileResult> {
|
|
137
|
-
* // ...
|
|
138
|
-
* }
|
|
139
|
-
* export type UserProfileResult = { name: string; email: string };
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
export declare function PublicQuery(options?: PublicQueryOptions): ClassDecorator;
|
|
143
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,qBAAqB,eAAwB,CAAC;AAC3D,eAAO,MAAM,uBAAuB,eAA0B,CAAC;AAC/D,eAAO,MAAM,qBAAqB,eAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,cAAc,CAK5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,cAAc,CAKhF;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,cAAc,CAK5E"}
|
package/dist/decorators/index.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
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
|
-
*/
|
|
40
|
-
function PublicEvent(options = {}) {
|
|
41
|
-
return (target) => {
|
|
42
|
-
Reflect.defineMetadata(exports.PUBLIC_EVENT_METADATA, options, target);
|
|
43
|
-
return target;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
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
|
-
function PublicCommand(options = {}) {
|
|
80
|
-
return (target) => {
|
|
81
|
-
Reflect.defineMetadata(exports.PUBLIC_COMMAND_METADATA, options, target);
|
|
82
|
-
return target;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
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
|
-
function PublicQuery(options = {}) {
|
|
118
|
-
return (target) => {
|
|
119
|
-
Reflect.defineMetadata(exports.PUBLIC_QUERY_METADATA, options, target);
|
|
120
|
-
return target;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,MAAM,CAAC,eAAe,CAAC,CAAC;AAClD,QAAA,qBAAqB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,WAAW,CAAC,UAA8B,EAAE;IAC1D,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,OAAO,CAAC,cAAc,CAAC,6BAAqB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAgB,aAAa,CAAC,UAAgC,EAAE;IAC9D,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,OAAO,CAAC,cAAc,CAAC,+BAAuB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACjE,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,WAAW,CAAC,UAA8B,EAAE;IAC1D,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,OAAO,CAAC,cAAc,CAAC,6BAAqB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/domain/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
package/dist/domain/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/domain/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB"}
|
package/dist/domain/types.d.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
export interface SourceFile {
|
|
2
|
-
readonly absolutePath: string;
|
|
3
|
-
readonly relativePath: string;
|
|
4
|
-
readonly packageName?: string;
|
|
5
|
-
}
|
|
6
|
-
export type TypeRef = PrimitiveType | ArrayType | ObjectType | UnionType | IntersectionType | ReferenceType | LiteralType | TupleType | FunctionType;
|
|
7
|
-
export interface PrimitiveType {
|
|
8
|
-
readonly kind: 'primitive';
|
|
9
|
-
readonly name: 'string' | 'number' | 'boolean' | 'null' | 'undefined' | 'void' | 'any' | 'unknown' | 'never' | 'bigint' | 'symbol';
|
|
10
|
-
}
|
|
11
|
-
export interface ArrayType {
|
|
12
|
-
readonly kind: 'array';
|
|
13
|
-
readonly elementType: TypeRef;
|
|
14
|
-
}
|
|
15
|
-
export interface ObjectType {
|
|
16
|
-
readonly kind: 'object';
|
|
17
|
-
readonly fields: readonly Field[];
|
|
18
|
-
}
|
|
19
|
-
export interface UnionType {
|
|
20
|
-
readonly kind: 'union';
|
|
21
|
-
readonly types: readonly TypeRef[];
|
|
22
|
-
}
|
|
23
|
-
export interface IntersectionType {
|
|
24
|
-
readonly kind: 'intersection';
|
|
25
|
-
readonly types: readonly TypeRef[];
|
|
26
|
-
}
|
|
27
|
-
export interface ReferenceType {
|
|
28
|
-
readonly kind: 'reference';
|
|
29
|
-
readonly name: string;
|
|
30
|
-
readonly typeArguments?: readonly TypeRef[];
|
|
31
|
-
}
|
|
32
|
-
export interface LiteralType {
|
|
33
|
-
readonly kind: 'literal';
|
|
34
|
-
readonly value: string | number | boolean;
|
|
35
|
-
}
|
|
36
|
-
export interface TupleType {
|
|
37
|
-
readonly kind: 'tuple';
|
|
38
|
-
readonly elements: readonly TypeRef[];
|
|
39
|
-
}
|
|
40
|
-
export interface FunctionType {
|
|
41
|
-
readonly kind: 'function';
|
|
42
|
-
readonly parameters: readonly FunctionParameter[];
|
|
43
|
-
readonly returnType: TypeRef;
|
|
44
|
-
}
|
|
45
|
-
export interface FunctionParameter {
|
|
46
|
-
readonly name: string;
|
|
47
|
-
readonly type: TypeRef;
|
|
48
|
-
readonly optional: boolean;
|
|
49
|
-
}
|
|
50
|
-
export interface Field {
|
|
51
|
-
readonly name: string;
|
|
52
|
-
readonly type: TypeRef;
|
|
53
|
-
readonly optional: boolean;
|
|
54
|
-
readonly readonly: boolean;
|
|
55
|
-
}
|
|
56
|
-
export type TypeDefinitionKind = 'interface' | 'type' | 'enum' | 'class';
|
|
57
|
-
export interface TypeDefinition {
|
|
58
|
-
readonly name: string;
|
|
59
|
-
readonly kind: TypeDefinitionKind;
|
|
60
|
-
readonly sourceFile: SourceFile;
|
|
61
|
-
readonly body: TypeRef;
|
|
62
|
-
readonly typeParameters?: readonly string[];
|
|
63
|
-
readonly exported: boolean;
|
|
64
|
-
}
|
|
65
|
-
export interface EnumMember {
|
|
66
|
-
readonly name: string;
|
|
67
|
-
readonly value?: string | number;
|
|
68
|
-
}
|
|
69
|
-
export interface EnumDefinition extends Omit<TypeDefinition, 'kind' | 'body'> {
|
|
70
|
-
readonly kind: 'enum';
|
|
71
|
-
readonly members: readonly EnumMember[];
|
|
72
|
-
}
|
|
73
|
-
export interface ClassImport {
|
|
74
|
-
readonly names: readonly string[];
|
|
75
|
-
readonly source: string;
|
|
76
|
-
readonly isTypeOnly: boolean;
|
|
77
|
-
readonly isExternal: boolean;
|
|
78
|
-
}
|
|
79
|
-
export interface ClassDefinition {
|
|
80
|
-
readonly name: string;
|
|
81
|
-
readonly kind: 'class';
|
|
82
|
-
readonly sourceFile: SourceFile;
|
|
83
|
-
readonly sourceText: string;
|
|
84
|
-
readonly imports: readonly ClassImport[];
|
|
85
|
-
readonly dependencies: readonly string[];
|
|
86
|
-
readonly baseClass?: string;
|
|
87
|
-
readonly exported: boolean;
|
|
88
|
-
}
|
|
89
|
-
export interface MessageBase {
|
|
90
|
-
readonly name: string;
|
|
91
|
-
readonly sourceFile: SourceFile;
|
|
92
|
-
readonly fields: readonly Field[];
|
|
93
|
-
readonly baseClass?: string;
|
|
94
|
-
readonly sourceText: string;
|
|
95
|
-
readonly imports: readonly ClassImport[];
|
|
96
|
-
}
|
|
97
|
-
export interface DomainEvent extends MessageBase {
|
|
98
|
-
readonly messageType: 'event';
|
|
99
|
-
readonly version?: number;
|
|
100
|
-
readonly context?: string;
|
|
101
|
-
readonly payloadType?: TypeRef;
|
|
102
|
-
}
|
|
103
|
-
export interface Command extends MessageBase {
|
|
104
|
-
readonly messageType: 'command';
|
|
105
|
-
readonly resultType?: TypeRef;
|
|
106
|
-
readonly context?: string;
|
|
107
|
-
readonly payloadType?: TypeRef;
|
|
108
|
-
}
|
|
109
|
-
export interface Query extends MessageBase {
|
|
110
|
-
readonly messageType: 'query';
|
|
111
|
-
readonly resultType?: TypeRef;
|
|
112
|
-
readonly context?: string;
|
|
113
|
-
readonly payloadType?: TypeRef;
|
|
114
|
-
}
|
|
115
|
-
export type Message = DomainEvent | Command | Query;
|
|
116
|
-
/** Used to filter which decorators the scanner should look for. */
|
|
117
|
-
export type MessageType = Message['messageType'];
|
|
118
|
-
export type ImportSource = {
|
|
119
|
-
readonly type: 'local';
|
|
120
|
-
readonly path: string;
|
|
121
|
-
} | {
|
|
122
|
-
readonly type: 'external';
|
|
123
|
-
readonly package: string;
|
|
124
|
-
};
|
|
125
|
-
export type DependencyKind = 'type' | 'value' | 'class';
|
|
126
|
-
export interface Dependency {
|
|
127
|
-
readonly name: string;
|
|
128
|
-
readonly source: ImportSource;
|
|
129
|
-
readonly kind: DependencyKind;
|
|
130
|
-
readonly definition?: TypeDefinition;
|
|
131
|
-
}
|
|
132
|
-
export interface SourceLocation {
|
|
133
|
-
readonly file: string;
|
|
134
|
-
readonly message: string;
|
|
135
|
-
readonly line?: number;
|
|
136
|
-
readonly column?: number;
|
|
137
|
-
}
|
|
138
|
-
export type ExtractionError = SourceLocation;
|
|
139
|
-
export type ExtractionWarning = SourceLocation;
|
|
140
|
-
export interface ExtractionResult {
|
|
141
|
-
readonly events: readonly DomainEvent[];
|
|
142
|
-
readonly commands: readonly Command[];
|
|
143
|
-
readonly types: readonly TypeDefinition[];
|
|
144
|
-
readonly dependencies: readonly Dependency[];
|
|
145
|
-
readonly errors: readonly ExtractionError[];
|
|
146
|
-
readonly warnings: readonly ExtractionWarning[];
|
|
147
|
-
}
|
|
148
|
-
/** Customizes decorator names used to identify public messages. Unspecified names use defaults. */
|
|
149
|
-
export interface DecoratorNames {
|
|
150
|
-
event?: string;
|
|
151
|
-
command?: string;
|
|
152
|
-
query?: string;
|
|
153
|
-
}
|
|
154
|
-
export declare const DEFAULT_DECORATOR_NAMES: Required<DecoratorNames>;
|
|
155
|
-
/** Merges partial decorator names with defaults for backward compatibility. */
|
|
156
|
-
export declare function mergeDecoratorNames(partial?: DecoratorNames): Required<DecoratorNames>;
|
|
157
|
-
export interface ResponseNamingConvention {
|
|
158
|
-
readonly messageSuffix: string;
|
|
159
|
-
readonly responseSuffix: string;
|
|
160
|
-
}
|
|
161
|
-
export interface Config {
|
|
162
|
-
readonly sourceDir: string;
|
|
163
|
-
readonly outputDir: string;
|
|
164
|
-
readonly include?: readonly string[];
|
|
165
|
-
readonly exclude?: readonly string[];
|
|
166
|
-
readonly externalPackages?: Readonly<Record<string, string>>;
|
|
167
|
-
readonly decoratorNames?: DecoratorNames;
|
|
168
|
-
readonly responseNamingConventions?: readonly ResponseNamingConvention[];
|
|
169
|
-
}
|
|
170
|
-
export declare function isPrimitiveType(type: TypeRef): type is PrimitiveType;
|
|
171
|
-
export declare function isArrayType(type: TypeRef): type is ArrayType;
|
|
172
|
-
export declare function isObjectType(type: TypeRef): type is ObjectType;
|
|
173
|
-
export declare function isUnionType(type: TypeRef): type is UnionType;
|
|
174
|
-
export declare function isIntersectionType(type: TypeRef): type is IntersectionType;
|
|
175
|
-
export declare function isReferenceType(type: TypeRef): type is ReferenceType;
|
|
176
|
-
export declare function isLiteralType(type: TypeRef): type is LiteralType;
|
|
177
|
-
export declare function isTupleType(type: TypeRef): type is TupleType;
|
|
178
|
-
export declare function isFunctionType(type: TypeRef): type is FunctionType;
|
|
179
|
-
export declare function isDomainEvent(message: Message): message is DomainEvent;
|
|
180
|
-
export declare function isCommand(message: Message): message is Command;
|
|
181
|
-
export declare function isQuery(message: Message): message is Query;
|
|
182
|
-
//# sourceMappingURL=types.d.ts.map
|