@hexaijs/plugin-contracts-generator 0.1.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/LICENSE +21 -0
- package/README.md +337 -0
- package/dist/ast-utils.d.ts +6 -0
- package/dist/ast-utils.d.ts.map +1 -0
- package/dist/ast-utils.js +111 -0
- package/dist/ast-utils.js.map +1 -0
- package/dist/class-analyzer.d.ts +16 -0
- package/dist/class-analyzer.d.ts.map +1 -0
- package/dist/class-analyzer.js +155 -0
- package/dist/class-analyzer.js.map +1 -0
- package/dist/cli.d.ts +36 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +321 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-loader.d.ts +34 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +188 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/decorators/index.d.ts +143 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +123 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/domain/index.d.ts +2 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +18 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/types.d.ts +182 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/domain/types.js +65 -0
- package/dist/domain/types.js.map +1 -0
- package/dist/errors.d.ts +79 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +138 -0
- package/dist/errors.js.map +1 -0
- package/dist/file-copier.d.ts +85 -0
- package/dist/file-copier.d.ts.map +1 -0
- package/dist/file-copier.js +773 -0
- package/dist/file-copier.js.map +1 -0
- package/dist/file-graph-resolver.d.ts +47 -0
- package/dist/file-graph-resolver.d.ts.map +1 -0
- package/dist/file-graph-resolver.js +230 -0
- package/dist/file-graph-resolver.js.map +1 -0
- package/dist/file-system.d.ts +26 -0
- package/dist/file-system.d.ts.map +1 -0
- package/dist/file-system.js +34 -0
- package/dist/file-system.js.map +1 -0
- package/dist/hexai-plugin.d.ts +16 -0
- package/dist/hexai-plugin.d.ts.map +1 -0
- package/dist/hexai-plugin.js +59 -0
- package/dist/hexai-plugin.js.map +1 -0
- package/dist/import-analyzer.d.ts +6 -0
- package/dist/import-analyzer.d.ts.map +1 -0
- package/dist/import-analyzer.js +77 -0
- package/dist/import-analyzer.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +21 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +47 -0
- package/dist/logger.js.map +1 -0
- package/dist/parser.d.ts +32 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +209 -0
- package/dist/parser.js.map +1 -0
- package/dist/pipeline.d.ts +56 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +152 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/reexport-generator.d.ts +81 -0
- package/dist/reexport-generator.d.ts.map +1 -0
- package/dist/reexport-generator.js +208 -0
- package/dist/reexport-generator.js.map +1 -0
- package/dist/registry-generator.d.ts +27 -0
- package/dist/registry-generator.d.ts.map +1 -0
- package/dist/registry-generator.js +108 -0
- package/dist/registry-generator.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/message-registry.d.ts +23 -0
- package/dist/runtime/message-registry.d.ts.map +1 -0
- package/dist/runtime/message-registry.js +39 -0
- package/dist/runtime/message-registry.js.map +1 -0
- package/dist/scanner.d.ts +21 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +53 -0
- package/dist/scanner.js.map +1 -0
- package/dist/test-utils.d.ts +23 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +198 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/tsconfig-loader.d.ts +8 -0
- package/dist/tsconfig-loader.d.ts.map +1 -0
- package/dist/tsconfig-loader.js +64 -0
- package/dist/tsconfig-loader.js.map +1 -0
- package/package.json +79 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contracts Generator
|
|
3
|
+
*
|
|
4
|
+
* Extract Domain Events and Commands from TypeScript source code using decorators.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { extract } from '@hexaijs/plugin-contracts-generator';
|
|
9
|
+
*
|
|
10
|
+
* const result = await extract({
|
|
11
|
+
* sourceDir: 'packages',
|
|
12
|
+
* outputDir: 'packages/contracts',
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* console.log(`Extracted ${result.events.length} events and ${result.commands.length} commands`);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export type { SourceFile, TypeRef, PrimitiveType, ArrayType, ObjectType, UnionType, IntersectionType, ReferenceType, LiteralType, TupleType, FunctionType, FunctionParameter, Field, TypeDefinition, TypeDefinitionKind, EnumMember, EnumDefinition, ClassDefinition, ClassImport, Message, MessageBase, DomainEvent, Command, Dependency, DependencyKind, ImportSource, ExtractionResult, ExtractionError, ExtractionWarning, Config, } from "./domain/types";
|
|
19
|
+
export { isPrimitiveType, isArrayType, isObjectType, isUnionType, isIntersectionType, isReferenceType, isLiteralType, isTupleType, isFunctionType, isDomainEvent, isCommand, } from "./domain/types";
|
|
20
|
+
export { PublicEvent, PublicCommand, PublicQuery, type PublicEventOptions, type PublicCommandOptions, type PublicQueryOptions, } from "./decorators";
|
|
21
|
+
export { Scanner, type ScannerOptions } from "./scanner";
|
|
22
|
+
export { Parser, type ParseResult } from "./parser";
|
|
23
|
+
export { FileGraphResolver } from "./file-graph-resolver";
|
|
24
|
+
export { FileCopier } from "./file-copier";
|
|
25
|
+
export { TsconfigLoader } from "./tsconfig-loader";
|
|
26
|
+
export { ConfigLoader, type ContractsConfig, type ContextConfig, } from "./config-loader";
|
|
27
|
+
export { MessageParserError, ConfigurationError, ConfigLoadError, TsconfigLoadError, FileSystemError, FileNotFoundError, FileReadError, FileWriteError, ParseError, JsonParseError, ResolutionError, ModuleResolutionError, } from "./errors";
|
|
28
|
+
export { RegistryGenerator, type RegistryGeneratorOptions, type ContextMessages, } from "./registry-generator";
|
|
29
|
+
export { ReexportGenerator, type ReexportGeneratorOptions, type AnalyzeOptions, type GenerateOptions, type RewrittenImport, type ReexportFile, } from "./reexport-generator";
|
|
30
|
+
import { type FileSystem } from "./file-system";
|
|
31
|
+
import { type Logger } from "./logger";
|
|
32
|
+
export type { FileSystem, FileStats } from "./file-system";
|
|
33
|
+
export { nodeFileSystem } from "./file-system";
|
|
34
|
+
export type { Logger, LogLevel, ConsoleLoggerOptions } from "./logger";
|
|
35
|
+
export { ConsoleLogger, noopLogger } from "./logger";
|
|
36
|
+
export { ContractsPipeline, type PipelineDependencies, type PipelineOptions, type PipelineResult, type ParsedMessages, } from "./pipeline";
|
|
37
|
+
import type { ResponseNamingConvention, MessageType } from "./domain/types";
|
|
38
|
+
export interface ProcessContextOptions {
|
|
39
|
+
contextName: string;
|
|
40
|
+
sourceDir: string;
|
|
41
|
+
outputDir: string;
|
|
42
|
+
pathAliasRewrites?: Map<string, string>;
|
|
43
|
+
tsconfigPath?: string;
|
|
44
|
+
responseNamingConventions?: readonly ResponseNamingConvention[];
|
|
45
|
+
removeDecorators?: boolean;
|
|
46
|
+
messageTypes?: MessageType[];
|
|
47
|
+
fileSystem?: FileSystem;
|
|
48
|
+
logger?: Logger;
|
|
49
|
+
}
|
|
50
|
+
export interface ProcessContextResult {
|
|
51
|
+
events: readonly import("./domain/types").DomainEvent[];
|
|
52
|
+
commands: readonly import("./domain/types").Command[];
|
|
53
|
+
queries: readonly import("./domain/types").Query[];
|
|
54
|
+
copiedFiles: string[];
|
|
55
|
+
}
|
|
56
|
+
export declare function processContext(options: ProcessContextOptions): Promise<ProcessContextResult>;
|
|
57
|
+
export { cliPlugin } from "./hexai-plugin";
|
|
58
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EACR,UAAU,EACV,OAAO,EACP,aAAa,EACb,SAAS,EACT,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACX,WAAW,EACX,OAAO,EACP,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,MAAM,GACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,eAAe,EACf,WAAW,EACX,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,GACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,WAAW,EACX,aAAa,EACb,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACH,YAAY,EACZ,KAAK,eAAe,EACpB,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CAAC;IACtB,yBAAyB,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,SAAS,OAAO,gBAAgB,EAAE,WAAW,EAAE,CAAC;IACxD,QAAQ,EAAE,SAAS,OAAO,gBAAgB,EAAE,OAAO,EAAE,CAAC;IACtD,OAAO,EAAE,SAAS,OAAO,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACnD,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAsB,cAAc,CAChC,OAAO,EAAE,qBAAqB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CA6B/B;AAGD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Contracts Generator
|
|
4
|
+
*
|
|
5
|
+
* Extract Domain Events and Commands from TypeScript source code using decorators.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { extract } from '@hexaijs/plugin-contracts-generator';
|
|
10
|
+
*
|
|
11
|
+
* const result = await extract({
|
|
12
|
+
* sourceDir: 'packages',
|
|
13
|
+
* outputDir: 'packages/contracts',
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* console.log(`Extracted ${result.events.length} events and ${result.commands.length} commands`);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.cliPlugin = exports.ContractsPipeline = exports.noopLogger = exports.ConsoleLogger = exports.nodeFileSystem = exports.ReexportGenerator = exports.RegistryGenerator = exports.ModuleResolutionError = exports.ResolutionError = exports.JsonParseError = exports.ParseError = exports.FileWriteError = exports.FileReadError = exports.FileNotFoundError = exports.FileSystemError = exports.TsconfigLoadError = exports.ConfigLoadError = exports.ConfigurationError = exports.MessageParserError = exports.ConfigLoader = exports.TsconfigLoader = exports.FileCopier = exports.FileGraphResolver = exports.Parser = exports.Scanner = exports.PublicQuery = exports.PublicCommand = exports.PublicEvent = exports.isCommand = exports.isDomainEvent = exports.isFunctionType = exports.isTupleType = exports.isLiteralType = exports.isReferenceType = exports.isIntersectionType = exports.isUnionType = exports.isObjectType = exports.isArrayType = exports.isPrimitiveType = void 0;
|
|
21
|
+
exports.processContext = processContext;
|
|
22
|
+
var types_1 = require("./domain/types");
|
|
23
|
+
Object.defineProperty(exports, "isPrimitiveType", { enumerable: true, get: function () { return types_1.isPrimitiveType; } });
|
|
24
|
+
Object.defineProperty(exports, "isArrayType", { enumerable: true, get: function () { return types_1.isArrayType; } });
|
|
25
|
+
Object.defineProperty(exports, "isObjectType", { enumerable: true, get: function () { return types_1.isObjectType; } });
|
|
26
|
+
Object.defineProperty(exports, "isUnionType", { enumerable: true, get: function () { return types_1.isUnionType; } });
|
|
27
|
+
Object.defineProperty(exports, "isIntersectionType", { enumerable: true, get: function () { return types_1.isIntersectionType; } });
|
|
28
|
+
Object.defineProperty(exports, "isReferenceType", { enumerable: true, get: function () { return types_1.isReferenceType; } });
|
|
29
|
+
Object.defineProperty(exports, "isLiteralType", { enumerable: true, get: function () { return types_1.isLiteralType; } });
|
|
30
|
+
Object.defineProperty(exports, "isTupleType", { enumerable: true, get: function () { return types_1.isTupleType; } });
|
|
31
|
+
Object.defineProperty(exports, "isFunctionType", { enumerable: true, get: function () { return types_1.isFunctionType; } });
|
|
32
|
+
Object.defineProperty(exports, "isDomainEvent", { enumerable: true, get: function () { return types_1.isDomainEvent; } });
|
|
33
|
+
Object.defineProperty(exports, "isCommand", { enumerable: true, get: function () { return types_1.isCommand; } });
|
|
34
|
+
var decorators_1 = require("./decorators");
|
|
35
|
+
Object.defineProperty(exports, "PublicEvent", { enumerable: true, get: function () { return decorators_1.PublicEvent; } });
|
|
36
|
+
Object.defineProperty(exports, "PublicCommand", { enumerable: true, get: function () { return decorators_1.PublicCommand; } });
|
|
37
|
+
Object.defineProperty(exports, "PublicQuery", { enumerable: true, get: function () { return decorators_1.PublicQuery; } });
|
|
38
|
+
var scanner_1 = require("./scanner");
|
|
39
|
+
Object.defineProperty(exports, "Scanner", { enumerable: true, get: function () { return scanner_1.Scanner; } });
|
|
40
|
+
var parser_1 = require("./parser");
|
|
41
|
+
Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return parser_1.Parser; } });
|
|
42
|
+
var file_graph_resolver_1 = require("./file-graph-resolver");
|
|
43
|
+
Object.defineProperty(exports, "FileGraphResolver", { enumerable: true, get: function () { return file_graph_resolver_1.FileGraphResolver; } });
|
|
44
|
+
var file_copier_1 = require("./file-copier");
|
|
45
|
+
Object.defineProperty(exports, "FileCopier", { enumerable: true, get: function () { return file_copier_1.FileCopier; } });
|
|
46
|
+
var tsconfig_loader_1 = require("./tsconfig-loader");
|
|
47
|
+
Object.defineProperty(exports, "TsconfigLoader", { enumerable: true, get: function () { return tsconfig_loader_1.TsconfigLoader; } });
|
|
48
|
+
var config_loader_1 = require("./config-loader");
|
|
49
|
+
Object.defineProperty(exports, "ConfigLoader", { enumerable: true, get: function () { return config_loader_1.ConfigLoader; } });
|
|
50
|
+
var errors_1 = require("./errors");
|
|
51
|
+
Object.defineProperty(exports, "MessageParserError", { enumerable: true, get: function () { return errors_1.MessageParserError; } });
|
|
52
|
+
Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return errors_1.ConfigurationError; } });
|
|
53
|
+
Object.defineProperty(exports, "ConfigLoadError", { enumerable: true, get: function () { return errors_1.ConfigLoadError; } });
|
|
54
|
+
Object.defineProperty(exports, "TsconfigLoadError", { enumerable: true, get: function () { return errors_1.TsconfigLoadError; } });
|
|
55
|
+
Object.defineProperty(exports, "FileSystemError", { enumerable: true, get: function () { return errors_1.FileSystemError; } });
|
|
56
|
+
Object.defineProperty(exports, "FileNotFoundError", { enumerable: true, get: function () { return errors_1.FileNotFoundError; } });
|
|
57
|
+
Object.defineProperty(exports, "FileReadError", { enumerable: true, get: function () { return errors_1.FileReadError; } });
|
|
58
|
+
Object.defineProperty(exports, "FileWriteError", { enumerable: true, get: function () { return errors_1.FileWriteError; } });
|
|
59
|
+
Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return errors_1.ParseError; } });
|
|
60
|
+
Object.defineProperty(exports, "JsonParseError", { enumerable: true, get: function () { return errors_1.JsonParseError; } });
|
|
61
|
+
Object.defineProperty(exports, "ResolutionError", { enumerable: true, get: function () { return errors_1.ResolutionError; } });
|
|
62
|
+
Object.defineProperty(exports, "ModuleResolutionError", { enumerable: true, get: function () { return errors_1.ModuleResolutionError; } });
|
|
63
|
+
var registry_generator_1 = require("./registry-generator");
|
|
64
|
+
Object.defineProperty(exports, "RegistryGenerator", { enumerable: true, get: function () { return registry_generator_1.RegistryGenerator; } });
|
|
65
|
+
var reexport_generator_1 = require("./reexport-generator");
|
|
66
|
+
Object.defineProperty(exports, "ReexportGenerator", { enumerable: true, get: function () { return reexport_generator_1.ReexportGenerator; } });
|
|
67
|
+
const file_system_1 = require("./file-system");
|
|
68
|
+
const logger_1 = require("./logger");
|
|
69
|
+
const pipeline_1 = require("./pipeline");
|
|
70
|
+
var file_system_2 = require("./file-system");
|
|
71
|
+
Object.defineProperty(exports, "nodeFileSystem", { enumerable: true, get: function () { return file_system_2.nodeFileSystem; } });
|
|
72
|
+
var logger_2 = require("./logger");
|
|
73
|
+
Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return logger_2.ConsoleLogger; } });
|
|
74
|
+
Object.defineProperty(exports, "noopLogger", { enumerable: true, get: function () { return logger_2.noopLogger; } });
|
|
75
|
+
var pipeline_2 = require("./pipeline");
|
|
76
|
+
Object.defineProperty(exports, "ContractsPipeline", { enumerable: true, get: function () { return pipeline_2.ContractsPipeline; } });
|
|
77
|
+
async function processContext(options) {
|
|
78
|
+
const { contextName, sourceDir, outputDir, pathAliasRewrites, tsconfigPath, responseNamingConventions, removeDecorators, messageTypes, fileSystem = file_system_1.nodeFileSystem, logger = logger_1.noopLogger, } = options;
|
|
79
|
+
const pipeline = await pipeline_1.ContractsPipeline.create({
|
|
80
|
+
tsconfigPath,
|
|
81
|
+
responseNamingConventions,
|
|
82
|
+
messageTypes,
|
|
83
|
+
fileSystem,
|
|
84
|
+
logger,
|
|
85
|
+
});
|
|
86
|
+
return pipeline.execute({
|
|
87
|
+
contextName,
|
|
88
|
+
sourceDir,
|
|
89
|
+
outputDir,
|
|
90
|
+
pathAliasRewrites,
|
|
91
|
+
removeDecorators,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// Hexai CLI plugin integration
|
|
95
|
+
var hexai_plugin_1 = require("./hexai-plugin");
|
|
96
|
+
Object.defineProperty(exports, "cliPlugin", { enumerable: true, get: function () { return hexai_plugin_1.cliPlugin; } });
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AA2IH,wCA+BC;AAvID,wCAYwB;AAXpB,wGAAA,eAAe,OAAA;AACf,oGAAA,WAAW,OAAA;AACX,qGAAA,YAAY,OAAA;AACZ,oGAAA,WAAW,OAAA;AACX,2GAAA,kBAAkB,OAAA;AAClB,wGAAA,eAAe,OAAA;AACf,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AACX,uGAAA,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AACb,kGAAA,SAAS,OAAA;AAGb,2CAOsB;AANlB,yGAAA,WAAW,OAAA;AACX,2GAAA,aAAa,OAAA;AACb,yGAAA,WAAW,OAAA;AAMf,qCAAyD;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AAO,CAAC;QACpB,WAAW;QACX,SAAS;QACT,SAAS;QACT,iBAAiB;QACjB,gBAAgB;KACnB,CAAC,CAAC;AACP,CAAC;AAED,+BAA+B;AAC/B,+CAA2C;AAAlC,yGAAA,SAAS,OAAA"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
2
|
+
export interface Logger {
|
|
3
|
+
debug(message: string): void;
|
|
4
|
+
info(message: string): void;
|
|
5
|
+
warn(message: string): void;
|
|
6
|
+
error(message: string): void;
|
|
7
|
+
}
|
|
8
|
+
export interface ConsoleLoggerOptions {
|
|
9
|
+
level?: LogLevel;
|
|
10
|
+
}
|
|
11
|
+
export declare class ConsoleLogger implements Logger {
|
|
12
|
+
private readonly level;
|
|
13
|
+
constructor(options?: ConsoleLoggerOptions);
|
|
14
|
+
debug(message: string): void;
|
|
15
|
+
info(message: string): void;
|
|
16
|
+
warn(message: string): void;
|
|
17
|
+
error(message: string): void;
|
|
18
|
+
private shouldLog;
|
|
19
|
+
}
|
|
20
|
+
export declare const noopLogger: Logger;
|
|
21
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,MAAM;IACnB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AASD,MAAM,WAAW,oBAAoB;IACjC,KAAK,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,qBAAa,aAAc,YAAW,MAAM;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;gBAErB,OAAO,GAAE,oBAAyB;IAI9C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM5B,OAAO,CAAC,SAAS;CAGpB;AASD,eAAO,MAAM,UAAU,EAAE,MAAyB,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noopLogger = exports.ConsoleLogger = void 0;
|
|
4
|
+
const LOG_LEVEL_PRIORITY = {
|
|
5
|
+
debug: 0,
|
|
6
|
+
info: 1,
|
|
7
|
+
warn: 2,
|
|
8
|
+
error: 3,
|
|
9
|
+
};
|
|
10
|
+
class ConsoleLogger {
|
|
11
|
+
level;
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this.level = options.level ?? "info";
|
|
14
|
+
}
|
|
15
|
+
debug(message) {
|
|
16
|
+
if (this.shouldLog("debug")) {
|
|
17
|
+
console.debug(message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
info(message) {
|
|
21
|
+
if (this.shouldLog("info")) {
|
|
22
|
+
console.info(message);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
warn(message) {
|
|
26
|
+
if (this.shouldLog("warn")) {
|
|
27
|
+
console.warn(message);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
error(message) {
|
|
31
|
+
if (this.shouldLog("error")) {
|
|
32
|
+
console.error(message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
shouldLog(level) {
|
|
36
|
+
return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.level];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
40
|
+
class NoopLogger {
|
|
41
|
+
debug() { }
|
|
42
|
+
info() { }
|
|
43
|
+
warn() { }
|
|
44
|
+
error() { }
|
|
45
|
+
}
|
|
46
|
+
exports.noopLogger = new NoopLogger();
|
|
47
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AASA,MAAM,kBAAkB,GAA6B;IACjD,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACX,CAAC;AAMF,MAAa,aAAa;IACL,KAAK,CAAW;IAEjC,YAAY,UAAgC,EAAE;QAC1C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,OAAe;QACjB,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;IAED,IAAI,CAAC,OAAe;QAChB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IAED,IAAI,CAAC,OAAe;QAChB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAe;QACjB,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,KAAe;QAC7B,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;CACJ;AAlCD,sCAkCC;AAED,MAAM,UAAU;IACZ,KAAK,KAAU,CAAC;IAChB,IAAI,KAAU,CAAC;IACf,IAAI,KAAU,CAAC;IACf,KAAK,KAAU,CAAC;CACnB;AAEY,QAAA,UAAU,GAAW,IAAI,UAAU,EAAE,CAAC"}
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Command, DecoratorNames, DomainEvent, MessageType, Query, ResponseNamingConvention, SourceFile, TypeDefinition } from "./domain";
|
|
2
|
+
export type { MessageType };
|
|
3
|
+
export interface ParseResult {
|
|
4
|
+
readonly events: readonly DomainEvent[];
|
|
5
|
+
readonly commands: readonly Command[];
|
|
6
|
+
readonly queries: readonly Query[];
|
|
7
|
+
readonly typeDefinitions: readonly TypeDefinition[];
|
|
8
|
+
}
|
|
9
|
+
export interface ParserOptions {
|
|
10
|
+
decoratorNames?: DecoratorNames;
|
|
11
|
+
responseNamingConventions?: readonly ResponseNamingConvention[];
|
|
12
|
+
messageTypes?: readonly MessageType[];
|
|
13
|
+
}
|
|
14
|
+
export declare class Parser {
|
|
15
|
+
private readonly decoratorMappings;
|
|
16
|
+
private readonly responseNamingConventions;
|
|
17
|
+
private readonly messageTypes;
|
|
18
|
+
constructor(options?: ParserOptions);
|
|
19
|
+
parse(sourceCode: string, sourceFileInfo: SourceFile): ParseResult;
|
|
20
|
+
private collectMessagesFromClass;
|
|
21
|
+
private applyNamingConventionMatching;
|
|
22
|
+
private findMatchingResponseType;
|
|
23
|
+
private buildMessage;
|
|
24
|
+
private extractMessageDetails;
|
|
25
|
+
private extractPayload;
|
|
26
|
+
private parsePayloadTypeArgument;
|
|
27
|
+
private flattenIntersectionToFields;
|
|
28
|
+
private extractTypeDefinition;
|
|
29
|
+
private extractInterfaceDefinition;
|
|
30
|
+
private buildTypeDefinition;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAER,OAAO,EACP,cAAc,EACd,WAAW,EAIX,WAAW,EAEX,KAAK,EACL,wBAAwB,EACxB,UAAU,EACV,cAAc,EAGjB,MAAM,UAAU,CAAC;AAYlB,YAAY,EAAE,WAAW,EAAE,CAAC;AAI5B,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,aAAa;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,yBAAyB,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAChE,YAAY,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CACzC;AAkCD,qBAAa,MAAM;IACf,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAqB;IACvD,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAsC;IAChF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqC;gBAEtD,OAAO,GAAE,aAAkB;IAOvC,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,GAAG,WAAW;IA2ClE,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,6BAA6B;IAkBrC,OAAO,CAAC,wBAAwB;IAiBhC,OAAO,CAAC,YAAY;IAqCpB,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,2BAA2B;IAYnC,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,0BAA0B;IAmBlC,OAAO,CAAC,mBAAmB;CAiB9B"}
|
package/dist/parser.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Parser = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const domain_1 = require("./domain");
|
|
9
|
+
const ast_utils_1 = require("./ast-utils");
|
|
10
|
+
const class_analyzer_1 = require("./class-analyzer");
|
|
11
|
+
const import_analyzer_1 = require("./import-analyzer");
|
|
12
|
+
const PAYLOAD_TYPE_ARGUMENT_INDEX = 0;
|
|
13
|
+
function buildDecoratorMappings(decoratorNames) {
|
|
14
|
+
return [
|
|
15
|
+
{ decorator: decoratorNames.event, messageType: "event" },
|
|
16
|
+
{ decorator: decoratorNames.command, messageType: "command" },
|
|
17
|
+
{ decorator: decoratorNames.query, messageType: "query" },
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
function extractTypeParameterNames(typeParameters) {
|
|
21
|
+
if (!typeParameters)
|
|
22
|
+
return undefined;
|
|
23
|
+
return typeParameters.map(tp => tp.name.text);
|
|
24
|
+
}
|
|
25
|
+
class Parser {
|
|
26
|
+
decoratorMappings;
|
|
27
|
+
responseNamingConventions;
|
|
28
|
+
messageTypes;
|
|
29
|
+
constructor(options = {}) {
|
|
30
|
+
const names = (0, domain_1.mergeDecoratorNames)(options.decoratorNames);
|
|
31
|
+
this.decoratorMappings = buildDecoratorMappings(names);
|
|
32
|
+
this.responseNamingConventions = options.responseNamingConventions ?? [];
|
|
33
|
+
this.messageTypes = options.messageTypes;
|
|
34
|
+
}
|
|
35
|
+
parse(sourceCode, sourceFileInfo) {
|
|
36
|
+
const tsSourceFile = typescript_1.default.createSourceFile(sourceFileInfo.absolutePath, sourceCode, typescript_1.default.ScriptTarget.Latest, true);
|
|
37
|
+
const events = [];
|
|
38
|
+
const commands = [];
|
|
39
|
+
const queries = [];
|
|
40
|
+
const typeDefinitions = [];
|
|
41
|
+
const messageCollectors = {
|
|
42
|
+
event: (m) => events.push(m),
|
|
43
|
+
command: (m) => commands.push(m),
|
|
44
|
+
query: (m) => queries.push(m),
|
|
45
|
+
};
|
|
46
|
+
const visit = (node) => {
|
|
47
|
+
if (typescript_1.default.isClassDeclaration(node) && node.name) {
|
|
48
|
+
this.collectMessagesFromClass(node, sourceCode, tsSourceFile, sourceFileInfo, messageCollectors);
|
|
49
|
+
}
|
|
50
|
+
if (typescript_1.default.isTypeAliasDeclaration(node) && node.name) {
|
|
51
|
+
typeDefinitions.push(this.extractTypeDefinition(node, sourceFileInfo));
|
|
52
|
+
}
|
|
53
|
+
if (typescript_1.default.isInterfaceDeclaration(node) && node.name) {
|
|
54
|
+
typeDefinitions.push(this.extractInterfaceDefinition(node, sourceFileInfo));
|
|
55
|
+
}
|
|
56
|
+
typescript_1.default.forEachChild(node, visit);
|
|
57
|
+
};
|
|
58
|
+
visit(tsSourceFile);
|
|
59
|
+
this.applyNamingConventionMatching(commands, typeDefinitions);
|
|
60
|
+
this.applyNamingConventionMatching(queries, typeDefinitions);
|
|
61
|
+
return { events, commands, queries, typeDefinitions };
|
|
62
|
+
}
|
|
63
|
+
collectMessagesFromClass(node, sourceCode, tsSourceFile, sourceFileInfo, collectors) {
|
|
64
|
+
for (const { decorator, messageType } of this.decoratorMappings) {
|
|
65
|
+
if (!(0, class_analyzer_1.hasDecorator)(node, decorator))
|
|
66
|
+
continue;
|
|
67
|
+
if (this.messageTypes && !this.messageTypes.includes(messageType))
|
|
68
|
+
continue;
|
|
69
|
+
const message = this.buildMessage(node, sourceCode, tsSourceFile, sourceFileInfo, messageType, decorator);
|
|
70
|
+
collectors[messageType](message);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
applyNamingConventionMatching(messages, typeDefinitions) {
|
|
74
|
+
for (const message of messages) {
|
|
75
|
+
const hasExplicitResultType = Boolean(message.resultType);
|
|
76
|
+
if (hasExplicitResultType)
|
|
77
|
+
continue;
|
|
78
|
+
const matchedTypeName = this.findMatchingResponseType(message.name, typeDefinitions);
|
|
79
|
+
if (matchedTypeName) {
|
|
80
|
+
message.resultType = {
|
|
81
|
+
kind: "reference",
|
|
82
|
+
name: matchedTypeName,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
findMatchingResponseType(messageName, typeDefinitions) {
|
|
88
|
+
for (const convention of this.responseNamingConventions) {
|
|
89
|
+
const hasSuffix = messageName.endsWith(convention.messageSuffix);
|
|
90
|
+
if (!hasSuffix)
|
|
91
|
+
continue;
|
|
92
|
+
const messagePrefix = messageName.slice(0, -convention.messageSuffix.length);
|
|
93
|
+
const expectedResponseName = messagePrefix + convention.responseSuffix;
|
|
94
|
+
const matchingType = typeDefinitions.find(t => t.name === expectedResponseName);
|
|
95
|
+
if (matchingType)
|
|
96
|
+
return matchingType.name;
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
buildMessage(node, sourceCode, tsSourceFile, sourceFileInfo, messageType, decoratorName) {
|
|
101
|
+
const extracted = this.extractMessageDetails(node, sourceCode, tsSourceFile);
|
|
102
|
+
const decoratorOptions = (0, class_analyzer_1.getDecoratorOptions)(node, decoratorName);
|
|
103
|
+
const baseMessage = {
|
|
104
|
+
name: node.name.text,
|
|
105
|
+
messageType,
|
|
106
|
+
sourceFile: sourceFileInfo,
|
|
107
|
+
fields: extracted.fields,
|
|
108
|
+
payloadType: extracted.payloadType,
|
|
109
|
+
sourceText: extracted.sourceText,
|
|
110
|
+
imports: extracted.imports,
|
|
111
|
+
baseClass: extracted.baseClass,
|
|
112
|
+
};
|
|
113
|
+
const explicitResponseName = decoratorOptions?.response;
|
|
114
|
+
const supportsResultType = messageType === "command" || messageType === "query";
|
|
115
|
+
if (!supportsResultType || !explicitResponseName) {
|
|
116
|
+
return baseMessage;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
...baseMessage,
|
|
120
|
+
resultType: {
|
|
121
|
+
kind: "reference",
|
|
122
|
+
name: explicitResponseName,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
extractMessageDetails(node, sourceCode, tsSourceFile) {
|
|
127
|
+
const { fields, payloadType } = this.extractPayload(node);
|
|
128
|
+
const sourceText = (0, class_analyzer_1.extractClassSourceText)(node, sourceCode);
|
|
129
|
+
const imports = (0, import_analyzer_1.extractImports)(tsSourceFile);
|
|
130
|
+
const baseClass = (0, class_analyzer_1.getBaseClassName)(node);
|
|
131
|
+
return {
|
|
132
|
+
fields,
|
|
133
|
+
payloadType,
|
|
134
|
+
sourceText,
|
|
135
|
+
imports,
|
|
136
|
+
baseClass,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
extractPayload(node) {
|
|
140
|
+
const emptyPayload = { fields: [] };
|
|
141
|
+
if (!node.heritageClauses)
|
|
142
|
+
return emptyPayload;
|
|
143
|
+
const extendsClause = node.heritageClauses.find(clause => clause.token === typescript_1.default.SyntaxKind.ExtendsKeyword);
|
|
144
|
+
if (!extendsClause)
|
|
145
|
+
return emptyPayload;
|
|
146
|
+
for (const type of extendsClause.types) {
|
|
147
|
+
const typeArgs = type.typeArguments;
|
|
148
|
+
if (!typeArgs || typeArgs.length === 0)
|
|
149
|
+
continue;
|
|
150
|
+
const payloadTypeArg = typeArgs[PAYLOAD_TYPE_ARGUMENT_INDEX];
|
|
151
|
+
const extractedPayload = this.parsePayloadTypeArgument(payloadTypeArg);
|
|
152
|
+
if (extractedPayload)
|
|
153
|
+
return extractedPayload;
|
|
154
|
+
}
|
|
155
|
+
return emptyPayload;
|
|
156
|
+
}
|
|
157
|
+
parsePayloadTypeArgument(typeArg) {
|
|
158
|
+
if (typescript_1.default.isTypeReferenceNode(typeArg) && typescript_1.default.isIdentifier(typeArg.typeName)) {
|
|
159
|
+
return {
|
|
160
|
+
fields: [],
|
|
161
|
+
payloadType: (0, ast_utils_1.parseTypeNode)(typeArg),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (typescript_1.default.isTypeLiteralNode(typeArg)) {
|
|
165
|
+
return {
|
|
166
|
+
fields: (0, ast_utils_1.extractFieldsFromMembers)(typeArg.members),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (typescript_1.default.isIntersectionTypeNode(typeArg)) {
|
|
170
|
+
const parsedType = (0, ast_utils_1.parseTypeNode)(typeArg);
|
|
171
|
+
return {
|
|
172
|
+
fields: this.flattenIntersectionToFields(parsedType),
|
|
173
|
+
payloadType: parsedType,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
flattenIntersectionToFields(intersection) {
|
|
179
|
+
const fields = [];
|
|
180
|
+
for (const type of intersection.types) {
|
|
181
|
+
if (type.kind === "object") {
|
|
182
|
+
fields.push(...type.fields);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return fields;
|
|
186
|
+
}
|
|
187
|
+
extractTypeDefinition(node, sourceFileInfo) {
|
|
188
|
+
return this.buildTypeDefinition(node.name.text, "type", sourceFileInfo, (0, ast_utils_1.parseTypeNode)(node.type), node.typeParameters, node);
|
|
189
|
+
}
|
|
190
|
+
extractInterfaceDefinition(node, sourceFileInfo) {
|
|
191
|
+
const body = {
|
|
192
|
+
kind: "object",
|
|
193
|
+
fields: (0, ast_utils_1.extractFieldsFromMembers)(node.members),
|
|
194
|
+
};
|
|
195
|
+
return this.buildTypeDefinition(node.name.text, "interface", sourceFileInfo, body, node.typeParameters, node);
|
|
196
|
+
}
|
|
197
|
+
buildTypeDefinition(name, kind, sourceFile, body, typeParameters, node) {
|
|
198
|
+
return {
|
|
199
|
+
name,
|
|
200
|
+
kind,
|
|
201
|
+
sourceFile,
|
|
202
|
+
body,
|
|
203
|
+
typeParameters: extractTypeParameterNames(typeParameters),
|
|
204
|
+
exported: (0, class_analyzer_1.hasExportModifier)(node),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.Parser = Parser;
|
|
209
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAmB5B,qCAA+C;AAC/C,2CAAsE;AACtE,qDAM0B;AAC1B,uDAAmD;AAInD,MAAM,2BAA2B,GAAG,CAAC,CAAC;AA+BtC,SAAS,sBAAsB,CAAC,cAAwC;IACpE,OAAO;QACH,EAAE,SAAS,EAAE,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE;QACzD,EAAE,SAAS,EAAE,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE;QAC7D,EAAE,SAAS,EAAE,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE;KAC5D,CAAC;AACN,CAAC;AAGD,SAAS,yBAAyB,CAC9B,cAAqE;IAErE,IAAI,CAAC,cAAc;QAAE,OAAO,SAAS,CAAC;IACtC,OAAO,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,MAAa,MAAM;IACE,iBAAiB,CAAqB;IACtC,yBAAyB,CAAsC;IAC/D,YAAY,CAAqC;IAElE,YAAY,UAAyB,EAAE;QACnC,MAAM,KAAK,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1D,IAAI,CAAC,iBAAiB,GAAG,sBAAsB,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@@
|
|
|
1
|
+
import { Scanner } from "./scanner";
|
|
2
|
+
import { Parser } from "./parser";
|
|
3
|
+
import { FileGraphResolver, type FileGraph } from "./file-graph-resolver";
|
|
4
|
+
import { FileCopier } from "./file-copier";
|
|
5
|
+
import type { DomainEvent, Command, Query, TypeDefinition, ResponseNamingConvention, MessageType } from "./domain/types";
|
|
6
|
+
import { type FileSystem } from "./file-system";
|
|
7
|
+
import { type Logger } from "./logger";
|
|
8
|
+
export interface PipelineDependencies {
|
|
9
|
+
readonly scanner: Scanner;
|
|
10
|
+
readonly parser: Parser;
|
|
11
|
+
readonly fileGraphResolver: FileGraphResolver;
|
|
12
|
+
readonly fileCopier: FileCopier;
|
|
13
|
+
readonly fileSystem: FileSystem;
|
|
14
|
+
readonly logger: Logger;
|
|
15
|
+
}
|
|
16
|
+
export interface PipelineOptions {
|
|
17
|
+
readonly contextName: string;
|
|
18
|
+
readonly sourceDir: string;
|
|
19
|
+
readonly outputDir: string;
|
|
20
|
+
readonly pathAliasRewrites?: Map<string, string>;
|
|
21
|
+
readonly removeDecorators?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface PipelineResult {
|
|
24
|
+
readonly events: readonly DomainEvent[];
|
|
25
|
+
readonly commands: readonly Command[];
|
|
26
|
+
readonly queries: readonly Query[];
|
|
27
|
+
readonly copiedFiles: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface ParsedMessages {
|
|
30
|
+
readonly events: readonly DomainEvent[];
|
|
31
|
+
readonly commands: readonly Command[];
|
|
32
|
+
readonly queries: readonly Query[];
|
|
33
|
+
readonly typeDefinitions: readonly TypeDefinition[];
|
|
34
|
+
}
|
|
35
|
+
export declare class ContractsPipeline {
|
|
36
|
+
private readonly deps;
|
|
37
|
+
private readonly messageTypes?;
|
|
38
|
+
private constructor();
|
|
39
|
+
static create(options?: {
|
|
40
|
+
tsconfigPath?: string;
|
|
41
|
+
responseNamingConventions?: readonly ResponseNamingConvention[];
|
|
42
|
+
fileSystem?: FileSystem;
|
|
43
|
+
logger?: Logger;
|
|
44
|
+
excludeDependencies?: string[];
|
|
45
|
+
messageTypes?: MessageType[];
|
|
46
|
+
}): Promise<ContractsPipeline>;
|
|
47
|
+
static fromDependencies(deps: PipelineDependencies): ContractsPipeline;
|
|
48
|
+
execute(options: PipelineOptions): Promise<PipelineResult>;
|
|
49
|
+
private collectResponseTypesToExport;
|
|
50
|
+
scan(sourceDir: string): Promise<string[]>;
|
|
51
|
+
parse(files: string[], sourceRoot: string): Promise<ParsedMessages>;
|
|
52
|
+
resolve(entryPoints: string[], sourceRoot: string): Promise<FileGraph>;
|
|
53
|
+
copy(fileGraph: FileGraph, sourceRoot: string, outputDir: string, pathAliasRewrites?: Map<string, string>, responseTypesToExport?: Map<string, string[]>, removeDecorators?: boolean, messageTypes?: readonly MessageType[]): Promise<string[]>;
|
|
54
|
+
exportBarrel(copiedFiles: string[], outputDir: string): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzH,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,UAAU,CAAC;AAUnD,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,OAAO,EAAE,OA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