@ahoo-wang/wow-generator 9.9.0 → 10.0.0-alpha.4
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 +99 -62
- package/README.zh-CN.md +85 -48
- package/dist/analysis/analyze.d.cts +5 -8
- package/dist/analysis/analyze.d.ts +5 -8
- package/dist/analysis/apiClients.d.cts +3 -4
- package/dist/analysis/apiClients.d.ts +3 -4
- package/dist/analysis/clientNames.d.cts +0 -20
- package/dist/analysis/clientNames.d.ts +0 -20
- package/dist/analysis/model.d.cts +2 -102
- package/dist/analysis/model.d.ts +2 -102
- package/dist/analysis/modelInfo.d.cts +12 -3
- package/dist/analysis/modelInfo.d.ts +12 -3
- package/dist/analysis/models.d.cts +3 -11
- package/dist/analysis/models.d.ts +3 -11
- package/dist/api/configuration.d.cts +1 -5
- package/dist/api/configuration.d.ts +1 -5
- package/dist/cli/program.d.cts +0 -5
- package/dist/cli/program.d.ts +0 -5
- package/dist/cli.cjs +9 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +102 -3
- package/dist/cli.js.map +1 -1
- package/dist/codeGenerator-CU1TGcUI.js +2407 -0
- package/dist/codeGenerator-CU1TGcUI.js.map +1 -0
- package/dist/codeGenerator-DzI0zCgM.cjs +27 -0
- package/dist/codeGenerator-DzI0zCgM.cjs.map +1 -0
- package/dist/emit/imports.d.cts +0 -9
- package/dist/emit/imports.d.ts +0 -9
- package/dist/emitters/decorators.d.cts +3 -18
- package/dist/emitters/decorators.d.ts +3 -18
- package/dist/emitters/emit.d.cts +2 -3
- package/dist/emitters/emit.d.ts +2 -3
- package/dist/emitters/manifestClients.d.cts +15 -0
- package/dist/emitters/manifestClients.d.ts +15 -0
- package/dist/emitters/models.d.cts +1 -1
- package/dist/emitters/models.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/input/configuration.d.cts +2 -4
- package/dist/input/configuration.d.ts +2 -4
- package/dist/input/parsers.d.cts +13 -0
- package/dist/input/parsers.d.ts +13 -0
- package/dist/manifest/analyze.d.cts +148 -0
- package/dist/manifest/analyze.d.ts +148 -0
- package/dist/manifest/document.d.cts +89 -0
- package/dist/manifest/document.d.ts +89 -0
- package/dist/naming/modelInfo.d.cts +1 -2
- package/dist/naming/modelInfo.d.ts +1 -2
- package/dist/naming/paths.d.cts +0 -5
- package/dist/naming/paths.d.ts +0 -5
- package/dist/output/outputStore.d.cts +2 -6
- package/dist/output/outputStore.d.ts +2 -6
- package/dist/pipeline/codeGenerator.d.cts +19 -11
- package/dist/pipeline/codeGenerator.d.ts +19 -11
- package/package.json +8 -8
- package/dist/analysis/aggregates.d.cts +0 -21
- package/dist/analysis/aggregates.d.ts +0 -21
- package/dist/codeGenerator-BMyiC0tW.cjs +0 -23
- package/dist/codeGenerator-BMyiC0tW.cjs.map +0 -1
- package/dist/codeGenerator-CsWf0pZy.js +0 -2572
- package/dist/codeGenerator-CsWf0pZy.js.map +0 -1
- package/dist/emitters/commandClients.d.cts +0 -14
- package/dist/emitters/commandClients.d.ts +0 -14
- package/dist/emitters/queryClients.d.cts +0 -11
- package/dist/emitters/queryClients.d.ts +0 -11
- package/dist/fetcherGeneratorCli.cjs +0 -3
- package/dist/fetcherGeneratorCli.cjs.map +0 -1
- package/dist/fetcherGeneratorCli.d.cts +0 -8
- package/dist/fetcherGeneratorCli.d.ts +0 -8
- package/dist/fetcherGeneratorCli.js +0 -6
- package/dist/fetcherGeneratorCli.js.map +0 -1
- package/dist/program-64WQvLq1.js +0 -103
- package/dist/program-64WQvLq1.js.map +0 -1
- package/dist/program-DWjbTSVJ.cjs +0 -10
- package/dist/program-DWjbTSVJ.cjs.map +0 -1
- package/dist/wow/conventions.d.cts +0 -154
- package/dist/wow/conventions.d.ts +0 -154
- package/dist/wow/model.d.cts +0 -116
- package/dist/wow/model.d.ts +0 -116
- package/dist/wow/resolveWowModel.d.cts +0 -21
- package/dist/wow/resolveWowModel.d.ts +0 -21
package/dist/emit/imports.d.cts
CHANGED
|
@@ -38,12 +38,3 @@ export declare function modelModuleSpecifier(module: ModuleBuilder, outputDir: s
|
|
|
38
38
|
* @returns A specifier starting with `./` or `../` and ending with `.js`
|
|
39
39
|
*/
|
|
40
40
|
export declare function relativeModuleSpecifier(fromDirectory: string, targetFilePath: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Imports a bounded context's alias constant into a generated file.
|
|
43
|
-
*
|
|
44
|
-
* @param module - The importing module
|
|
45
|
-
* @param outputDir - The output directory
|
|
46
|
-
* @param contextAlias - The bounded context alias
|
|
47
|
-
* @param declarationName - The name of the alias constant
|
|
48
|
-
*/
|
|
49
|
-
export declare function addImportBoundedContext(module: ModuleBuilder, outputDir: string, contextAlias: string, declarationName: string): readonly NamedImport[];
|
package/dist/emit/imports.d.ts
CHANGED
|
@@ -38,12 +38,3 @@ export declare function modelModuleSpecifier(module: ModuleBuilder, outputDir: s
|
|
|
38
38
|
* @returns A specifier starting with `./` or `../` and ending with `.js`
|
|
39
39
|
*/
|
|
40
40
|
export declare function relativeModuleSpecifier(fromDirectory: string, targetFilePath: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Imports a bounded context's alias constant into a generated file.
|
|
43
|
-
*
|
|
44
|
-
* @param module - The importing module
|
|
45
|
-
* @param outputDir - The output directory
|
|
46
|
-
* @param contextAlias - The bounded context alias
|
|
47
|
-
* @param declarationName - The name of the alias constant
|
|
48
|
-
*/
|
|
49
|
-
export declare function addImportBoundedContext(module: ModuleBuilder, outputDir: string, contextAlias: string, declarationName: string): readonly NamedImport[];
|
|
@@ -20,13 +20,6 @@ export declare const STRING_RETURN_TYPE: MethodReturnType;
|
|
|
20
20
|
* Metadata configuration for stream result extraction.
|
|
21
21
|
*/
|
|
22
22
|
export declare const STREAM_RESULT_EXTRACTOR_METADATA = "{\n headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },\n resultExtractor: JsonEventStreamResultExtractor,\n}";
|
|
23
|
-
/**
|
|
24
|
-
* The endpoint options of a streaming command client, imported from
|
|
25
|
-
* `@ahoo-wang/wow-client`: `Accept: text/event-stream` and a result
|
|
26
|
-
* extractor that errors the stream with a `WowError` when the server sends an
|
|
27
|
-
* error event instead of passing the event on as a result.
|
|
28
|
-
*/
|
|
29
|
-
export declare const COMMAND_STREAM_ENDPOINT_METADATA = "COMMAND_STREAM_ENDPOINT";
|
|
30
23
|
export declare function addImportFetcher(module: ModuleBuilder): void;
|
|
31
24
|
/**
|
|
32
25
|
* Adds the necessary imports for decorator functionality to a module.
|
|
@@ -51,23 +44,15 @@ export declare function addImportDecorator(module: ModuleBuilder): void;
|
|
|
51
44
|
*/
|
|
52
45
|
export declare function createDecoratorClass(className: string, module: ModuleBuilder, apiArgs?: string[], typeParameters?: string[], extendsClass?: string): ClassDeclarationStructure;
|
|
53
46
|
/**
|
|
54
|
-
* Adds the ApiMetadataCapable interface implementation and constructor to a class declaration
|
|
55
|
-
*
|
|
56
|
-
* With defaults, the constructor merges what the caller passes over them, so
|
|
57
|
-
* `new CartCommandClient({ fetcher })` keeps the bounded context's base path:
|
|
47
|
+
* Adds the ApiMetadataCapable interface implementation and constructor to a class declaration:
|
|
58
48
|
*
|
|
59
49
|
* ```typescript
|
|
60
|
-
* readonly apiMetadata
|
|
61
|
-
* constructor(apiMetadata?: ApiMetadata) {
|
|
62
|
-
* this.apiMetadata = { ...DEFAULT_COMMAND_CLIENT_OPTIONS, ...apiMetadata };
|
|
63
|
-
* }
|
|
50
|
+
* constructor(public readonly apiMetadata?: ApiMetadata) {}
|
|
64
51
|
* ```
|
|
65
52
|
*
|
|
66
53
|
* @param classDeclaration - The class declaration to modify
|
|
67
|
-
* @param defaults - Object literal entries the constructor starts from, such
|
|
68
|
-
* as `...DEFAULT_COMMAND_CLIENT_OPTIONS` or `basePath: X`; none by default
|
|
69
54
|
*/
|
|
70
|
-
export declare function addApiMetadataCtor(classDeclaration: ClassDeclarationStructure
|
|
55
|
+
export declare function addApiMetadataCtor(classDeclaration: ClassDeclarationStructure): void;
|
|
71
56
|
/**
|
|
72
57
|
* The decorator of an HTTP method: its name, but `del` for `delete`, a
|
|
73
58
|
* reserved word.
|
|
@@ -20,13 +20,6 @@ export declare const STRING_RETURN_TYPE: MethodReturnType;
|
|
|
20
20
|
* Metadata configuration for stream result extraction.
|
|
21
21
|
*/
|
|
22
22
|
export declare const STREAM_RESULT_EXTRACTOR_METADATA = "{\n headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },\n resultExtractor: JsonEventStreamResultExtractor,\n}";
|
|
23
|
-
/**
|
|
24
|
-
* The endpoint options of a streaming command client, imported from
|
|
25
|
-
* `@ahoo-wang/wow-client`: `Accept: text/event-stream` and a result
|
|
26
|
-
* extractor that errors the stream with a `WowError` when the server sends an
|
|
27
|
-
* error event instead of passing the event on as a result.
|
|
28
|
-
*/
|
|
29
|
-
export declare const COMMAND_STREAM_ENDPOINT_METADATA = "COMMAND_STREAM_ENDPOINT";
|
|
30
23
|
export declare function addImportFetcher(module: ModuleBuilder): void;
|
|
31
24
|
/**
|
|
32
25
|
* Adds the necessary imports for decorator functionality to a module.
|
|
@@ -51,23 +44,15 @@ export declare function addImportDecorator(module: ModuleBuilder): void;
|
|
|
51
44
|
*/
|
|
52
45
|
export declare function createDecoratorClass(className: string, module: ModuleBuilder, apiArgs?: string[], typeParameters?: string[], extendsClass?: string): ClassDeclarationStructure;
|
|
53
46
|
/**
|
|
54
|
-
* Adds the ApiMetadataCapable interface implementation and constructor to a class declaration
|
|
55
|
-
*
|
|
56
|
-
* With defaults, the constructor merges what the caller passes over them, so
|
|
57
|
-
* `new CartCommandClient({ fetcher })` keeps the bounded context's base path:
|
|
47
|
+
* Adds the ApiMetadataCapable interface implementation and constructor to a class declaration:
|
|
58
48
|
*
|
|
59
49
|
* ```typescript
|
|
60
|
-
* readonly apiMetadata
|
|
61
|
-
* constructor(apiMetadata?: ApiMetadata) {
|
|
62
|
-
* this.apiMetadata = { ...DEFAULT_COMMAND_CLIENT_OPTIONS, ...apiMetadata };
|
|
63
|
-
* }
|
|
50
|
+
* constructor(public readonly apiMetadata?: ApiMetadata) {}
|
|
64
51
|
* ```
|
|
65
52
|
*
|
|
66
53
|
* @param classDeclaration - The class declaration to modify
|
|
67
|
-
* @param defaults - Object literal entries the constructor starts from, such
|
|
68
|
-
* as `...DEFAULT_COMMAND_CLIENT_OPTIONS` or `basePath: X`; none by default
|
|
69
54
|
*/
|
|
70
|
-
export declare function addApiMetadataCtor(classDeclaration: ClassDeclarationStructure
|
|
55
|
+
export declare function addApiMetadataCtor(classDeclaration: ClassDeclarationStructure): void;
|
|
71
56
|
/**
|
|
72
57
|
* The decorator of an HTTP method: its name, but `del` for `delete`, a
|
|
73
58
|
* reserved word.
|
package/dist/emitters/emit.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { GenerationModel } from '../analysis/model.cjs';
|
|
2
2
|
import { EmitTarget } from './target.cjs';
|
|
3
3
|
/**
|
|
4
|
-
* Describes every file of a generation to its module: the
|
|
5
|
-
*
|
|
6
|
-
* clients. Nothing reaches a source file until the modules are built.
|
|
4
|
+
* Describes every file of a generation to its module: the models, then the
|
|
5
|
+
* API clients. Nothing reaches a source file until the modules are built.
|
|
7
6
|
*
|
|
8
7
|
* The order is the one the files have always been written in, so the
|
|
9
8
|
* imports of a module, and the aliases a name clash gives them, come out
|
package/dist/emitters/emit.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { GenerationModel } from '../analysis/model.js';
|
|
2
2
|
import { EmitTarget } from './target.js';
|
|
3
3
|
/**
|
|
4
|
-
* Describes every file of a generation to its module: the
|
|
5
|
-
*
|
|
6
|
-
* clients. Nothing reaches a source file until the modules are built.
|
|
4
|
+
* Describes every file of a generation to its module: the models, then the
|
|
5
|
+
* API clients. Nothing reaches a source file until the modules are built.
|
|
7
6
|
*
|
|
8
7
|
* The order is the one the files have always been written in, so the
|
|
9
8
|
* imports of a module, and the aliases a name clash gives them, come out
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModuleSet } from '../emit/moduleBuilder.cjs';
|
|
2
|
+
import { ManifestModel } from '../manifest/analyze.cjs';
|
|
3
|
+
/** The entry of the client every generated module imports from. */
|
|
4
|
+
export declare const WOW_CLIENT = "@ahoo-wang/wow-client";
|
|
5
|
+
/**
|
|
6
|
+
* Describes every file a Manifest generates to its module (decision D74,
|
|
7
|
+
* roadmap 5a.3): the types of each bounded context, its error codes and wait
|
|
8
|
+
* helpers, and the aggregate, command and query clients of each aggregate,
|
|
9
|
+
* all on `@ahoo-wang/wow-client`.
|
|
10
|
+
*
|
|
11
|
+
* @param model - What the Manifest generates
|
|
12
|
+
* @param modules - The modules of the run
|
|
13
|
+
* @param outputDir - The output directory
|
|
14
|
+
*/
|
|
15
|
+
export declare function emitManifestGeneration(model: ManifestModel, modules: ModuleSet, outputDir: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModuleSet } from '../emit/moduleBuilder.js';
|
|
2
|
+
import { ManifestModel } from '../manifest/analyze.js';
|
|
3
|
+
/** The entry of the client every generated module imports from. */
|
|
4
|
+
export declare const WOW_CLIENT = "@ahoo-wang/wow-client";
|
|
5
|
+
/**
|
|
6
|
+
* Describes every file a Manifest generates to its module (decision D74,
|
|
7
|
+
* roadmap 5a.3): the types of each bounded context, its error codes and wait
|
|
8
|
+
* helpers, and the aggregate, command and query clients of each aggregate,
|
|
9
|
+
* all on `@ahoo-wang/wow-client`.
|
|
10
|
+
*
|
|
11
|
+
* @param model - What the Manifest generates
|
|
12
|
+
* @param modules - The modules of the run
|
|
13
|
+
* @param outputDir - The output directory
|
|
14
|
+
*/
|
|
15
|
+
export declare function emitManifestGeneration(model: ManifestModel, modules: ModuleSet, outputDir: string): void;
|
|
@@ -30,7 +30,7 @@ export declare function emitModel(declaration: ModelDeclaration, target: EmitTar
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function uniqueEnumMemberNames(values: readonly string[]): Map<string, string>;
|
|
32
32
|
/** The model a {@link ModelEmitter} writes. */
|
|
33
|
-
export type ModelSource = Pick<ModelDeclaration, 'key' | 'info' | 'schema'
|
|
33
|
+
export type ModelSource = Pick<ModelDeclaration, 'key' | 'info' | 'schema'>;
|
|
34
34
|
/**
|
|
35
35
|
* Writes one model into a module: the declaration its schema calls for,
|
|
36
36
|
* with the model's doc comment.
|
|
@@ -30,7 +30,7 @@ export declare function emitModel(declaration: ModelDeclaration, target: EmitTar
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function uniqueEnumMemberNames(values: readonly string[]): Map<string, string>;
|
|
32
32
|
/** The model a {@link ModelEmitter} writes. */
|
|
33
|
-
export type ModelSource = Pick<ModelDeclaration, 'key' | 'info' | 'schema'
|
|
33
|
+
export type ModelSource = Pick<ModelDeclaration, 'key' | 'info' | 'schema'>;
|
|
34
34
|
/**
|
|
35
35
|
* Writes one model into a module: the declaration its schema calls for,
|
|
36
36
|
* with the model's doc comment.
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./codeGenerator-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./codeGenerator-DzI0zCgM.cjs");exports.CodeGenerator=e.t,exports.ConsoleLogger=e.i,exports.DEFAULT_CONFIG_PATH=e.c,exports.EXIT_CODES=e.o,exports.GeneratorError=e.s,exports.SilentLogger=e.a;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as CodeGenerator, i as ConsoleLogger, c as DEFAULT_CONFIG_PATH, o as EXIT_CODES, s as GeneratorError, a as SilentLogger } from "./codeGenerator-
|
|
1
|
+
export { t as CodeGenerator, i as ConsoleLogger, c as DEFAULT_CONFIG_PATH, o as EXIT_CODES, s as GeneratorError, a as SilentLogger } from "./codeGenerator-CU1TGcUI.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GeneratorConfiguration } from '../api/configuration.cjs';
|
|
2
2
|
import { Logger } from '../api/logger.cjs';
|
|
3
3
|
import { LoadResourceOptions } from './resources.cjs';
|
|
4
|
-
export declare const LEGACY_CONFIG_PATH = "./fetcher-generator.config.json";
|
|
5
4
|
/**
|
|
6
5
|
* A configuration, and the warnings reading it gave: keys the generator does
|
|
7
6
|
* not read, an empty file.
|
|
@@ -23,9 +22,8 @@ export interface ResolvedConfiguration extends LoadedConfiguration {
|
|
|
23
22
|
* Finds and loads the generator configuration.
|
|
24
23
|
*
|
|
25
24
|
* A path the caller names has to exist. Without one the generator reads
|
|
26
|
-
* {@link DEFAULT_CONFIG_PATH},
|
|
27
|
-
*
|
|
28
|
-
* the defaults when neither exists.
|
|
25
|
+
* {@link DEFAULT_CONFIG_PATH}, and generates with the defaults when it does
|
|
26
|
+
* not exist.
|
|
29
27
|
*
|
|
30
28
|
* @param configPath - The path or URL the caller named, if any
|
|
31
29
|
* @param logger - Receives what was read, at `debug`
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GeneratorConfiguration } from '../api/configuration.js';
|
|
2
2
|
import { Logger } from '../api/logger.js';
|
|
3
3
|
import { LoadResourceOptions } from './resources.js';
|
|
4
|
-
export declare const LEGACY_CONFIG_PATH = "./fetcher-generator.config.json";
|
|
5
4
|
/**
|
|
6
5
|
* A configuration, and the warnings reading it gave: keys the generator does
|
|
7
6
|
* not read, an empty file.
|
|
@@ -23,9 +22,8 @@ export interface ResolvedConfiguration extends LoadedConfiguration {
|
|
|
23
22
|
* Finds and loads the generator configuration.
|
|
24
23
|
*
|
|
25
24
|
* A path the caller names has to exist. Without one the generator reads
|
|
26
|
-
* {@link DEFAULT_CONFIG_PATH},
|
|
27
|
-
*
|
|
28
|
-
* the defaults when neither exists.
|
|
25
|
+
* {@link DEFAULT_CONFIG_PATH}, and generates with the defaults when it does
|
|
26
|
+
* not exist.
|
|
29
27
|
*
|
|
30
28
|
* @param configPath - The path or URL the caller named, if any
|
|
31
29
|
* @param logger - Receives what was read, at `debug`
|
package/dist/input/parsers.d.cts
CHANGED
|
@@ -13,6 +13,19 @@ import { LoadResourceOptions } from './resources.cjs';
|
|
|
13
13
|
* @returns The parsed document; `paths` is an empty object when it has none
|
|
14
14
|
*/
|
|
15
15
|
export declare function parseOpenAPI(inputPath: string, options?: LoadResourceOptions): Promise<OpenAPI>;
|
|
16
|
+
/**
|
|
17
|
+
* Loads and parses the input document, an OpenAPI 3 document or a Wow
|
|
18
|
+
* Manifest, without checking which it is.
|
|
19
|
+
*
|
|
20
|
+
* Every failure is a {@link GeneratorError} of kind `input` whose message
|
|
21
|
+
* names the document: it cannot be read or fetched, or it is neither JSON
|
|
22
|
+
* nor YAML.
|
|
23
|
+
*
|
|
24
|
+
* @param inputPath - The path or http(s) URL of the document
|
|
25
|
+
* @param options - Headers and timeout for an http(s) document
|
|
26
|
+
* @returns The parsed document
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadDocument(inputPath: string, options?: LoadResourceOptions): Promise<unknown>;
|
|
16
29
|
/**
|
|
17
30
|
* Checks that a parsed document is an OpenAPI 3 document the generator reads.
|
|
18
31
|
*
|
package/dist/input/parsers.d.ts
CHANGED
|
@@ -13,6 +13,19 @@ import { LoadResourceOptions } from './resources.js';
|
|
|
13
13
|
* @returns The parsed document; `paths` is an empty object when it has none
|
|
14
14
|
*/
|
|
15
15
|
export declare function parseOpenAPI(inputPath: string, options?: LoadResourceOptions): Promise<OpenAPI>;
|
|
16
|
+
/**
|
|
17
|
+
* Loads and parses the input document, an OpenAPI 3 document or a Wow
|
|
18
|
+
* Manifest, without checking which it is.
|
|
19
|
+
*
|
|
20
|
+
* Every failure is a {@link GeneratorError} of kind `input` whose message
|
|
21
|
+
* names the document: it cannot be read or fetched, or it is neither JSON
|
|
22
|
+
* nor YAML.
|
|
23
|
+
*
|
|
24
|
+
* @param inputPath - The path or http(s) URL of the document
|
|
25
|
+
* @param options - Headers and timeout for an http(s) document
|
|
26
|
+
* @returns The parsed document
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadDocument(inputPath: string, options?: LoadResourceOptions): Promise<unknown>;
|
|
16
29
|
/**
|
|
17
30
|
* Checks that a parsed document is an OpenAPI 3 document the generator reads.
|
|
18
31
|
*
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ManifestDocument } from './document.cjs';
|
|
2
|
+
/** A property of a generated interface. */
|
|
3
|
+
export interface PropertyModel {
|
|
4
|
+
/** As written in the interface: quoted when it is no identifier. */
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly type: string;
|
|
7
|
+
readonly optional: boolean;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
}
|
|
10
|
+
/** A type declared for a schema of `$defs`. */
|
|
11
|
+
export interface TypeModel {
|
|
12
|
+
/** The `$defs` key. */
|
|
13
|
+
readonly key: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** The file it is declared in, relative to the output directory. */
|
|
16
|
+
readonly file: string;
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
/** An interface's properties, or undefined for a type alias. */
|
|
19
|
+
readonly properties?: readonly PropertyModel[];
|
|
20
|
+
/** A type alias's type; or, for an interface, its index signature's. */
|
|
21
|
+
readonly type?: string;
|
|
22
|
+
/** The type names it refers to. */
|
|
23
|
+
readonly references: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The numbers of a value read and written as their exact text, as
|
|
27
|
+
* `@ahoo-wang/wow-client`'s `TextNumbers` holds them: `true` at such a number,
|
|
28
|
+
* else its members' marks by name, `'*'` for every item or map value.
|
|
29
|
+
*/
|
|
30
|
+
export type TextNumbersModel = true | {
|
|
31
|
+
readonly [member: string]: TextNumbersModel;
|
|
32
|
+
};
|
|
33
|
+
/** A command of an aggregate client. */
|
|
34
|
+
export interface CommandModel {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly method: string;
|
|
37
|
+
/** The `PATHS` member of its route by id, and of its route without one. */
|
|
38
|
+
readonly byIdPath?: {
|
|
39
|
+
readonly member: string;
|
|
40
|
+
readonly path: string;
|
|
41
|
+
};
|
|
42
|
+
readonly unaddressedPath?: {
|
|
43
|
+
readonly member: string;
|
|
44
|
+
readonly path: string;
|
|
45
|
+
};
|
|
46
|
+
/** The body's type name, or undefined when its schema is unknown. */
|
|
47
|
+
readonly bodyType: string;
|
|
48
|
+
/** The body may be left out: its schema requires nothing. */
|
|
49
|
+
readonly bodyOptional: boolean;
|
|
50
|
+
readonly creation: string;
|
|
51
|
+
readonly mounted: boolean;
|
|
52
|
+
readonly produces: readonly string[];
|
|
53
|
+
/** What the command's class says it is, as the Manifest describes it. */
|
|
54
|
+
readonly description?: string;
|
|
55
|
+
/** Its body has exact numbers, under `textNumbers.commands` of its aggregate. */
|
|
56
|
+
readonly bodyNumbers?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** A lifecycle command an aggregate lists. */
|
|
59
|
+
export interface LifecycleModel {
|
|
60
|
+
/** `wow.lifecycle.DeleteAggregate`, … */
|
|
61
|
+
readonly name: string;
|
|
62
|
+
/** The `LifecycleCommands` member. */
|
|
63
|
+
readonly member: string;
|
|
64
|
+
readonly method: string;
|
|
65
|
+
/**
|
|
66
|
+
* The body's type, or undefined for a command without one: the type
|
|
67
|
+
* generated from the Manifest's `$defs` entry of the command's name when it
|
|
68
|
+
* holds one (`bodyGenerated`), else `@ahoo-wang/wow-client`'s.
|
|
69
|
+
*/
|
|
70
|
+
readonly bodyType?: string;
|
|
71
|
+
/** The body's type is generated from the Manifest, not `@ahoo-wang/wow-client`'s. */
|
|
72
|
+
readonly bodyGenerated?: boolean;
|
|
73
|
+
/** What the Manifest's schema of the body says the command does. */
|
|
74
|
+
readonly description?: string;
|
|
75
|
+
}
|
|
76
|
+
/** An aggregate and its clients. */
|
|
77
|
+
export interface AggregateModel {
|
|
78
|
+
readonly context: string;
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly description?: string;
|
|
81
|
+
/** The type-name prefix: `Product`. */
|
|
82
|
+
readonly typeName: string;
|
|
83
|
+
/** The directory of its modules, relative to the output directory. */
|
|
84
|
+
readonly directory: string;
|
|
85
|
+
readonly ownership: string;
|
|
86
|
+
readonly snapshot: boolean;
|
|
87
|
+
readonly stateType: string;
|
|
88
|
+
readonly stateFields: readonly string[];
|
|
89
|
+
readonly commands: readonly CommandModel[];
|
|
90
|
+
readonly events: readonly {
|
|
91
|
+
/** The name the Manifest declares: `ProductCreated`. */
|
|
92
|
+
readonly name: string;
|
|
93
|
+
/**
|
|
94
|
+
* The event type the server names it by on the wire (08-data-protocols §2):
|
|
95
|
+
* `context.aggregate.EventName`, or the declared name when it is already
|
|
96
|
+
* qualified.
|
|
97
|
+
*/
|
|
98
|
+
readonly wireName: string;
|
|
99
|
+
readonly revision: number;
|
|
100
|
+
readonly type: string;
|
|
101
|
+
}[];
|
|
102
|
+
readonly lifecycle: readonly LifecycleModel[];
|
|
103
|
+
readonly queryModels: readonly string[];
|
|
104
|
+
/** The exact numbers of its state, events (by wire name) and commands; none when it has none. */
|
|
105
|
+
readonly textNumbers?: {
|
|
106
|
+
readonly state?: TextNumbersModel;
|
|
107
|
+
readonly events?: Readonly<Record<string, TextNumbersModel>>;
|
|
108
|
+
readonly commands?: Readonly<Record<string, TextNumbersModel>>;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** A bounded context and what its modules declare. */
|
|
112
|
+
export interface ContextModel {
|
|
113
|
+
readonly name: string;
|
|
114
|
+
readonly description?: string;
|
|
115
|
+
/** The type-name prefix: `EshopCatalog`. */
|
|
116
|
+
readonly typeName: string;
|
|
117
|
+
/** The constant prefix: `ESHOP_CATALOG`. */
|
|
118
|
+
readonly constantName: string;
|
|
119
|
+
readonly directory: string;
|
|
120
|
+
readonly errors: readonly {
|
|
121
|
+
readonly member: string;
|
|
122
|
+
readonly code: string;
|
|
123
|
+
readonly status: number;
|
|
124
|
+
readonly description?: string;
|
|
125
|
+
}[];
|
|
126
|
+
readonly subscriptions: readonly string[];
|
|
127
|
+
readonly aggregates: readonly AggregateModel[];
|
|
128
|
+
}
|
|
129
|
+
/** What a Manifest generates, decided before anything is written. */
|
|
130
|
+
export interface ManifestModel {
|
|
131
|
+
readonly service?: string;
|
|
132
|
+
readonly types: readonly TypeModel[];
|
|
133
|
+
readonly contexts: readonly ContextModel[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Decides what a Manifest generates: a `types.ts` per bounded context with
|
|
137
|
+
* the types of the schemas its aggregates reach (a schema two contexts reach
|
|
138
|
+
* is declared in the first), a `boundedContext.ts` with its error codes and
|
|
139
|
+
* wait helpers, and for each aggregate its `aggregate.ts`,
|
|
140
|
+
* `commandClient.ts` and `queryClient.ts`.
|
|
141
|
+
*
|
|
142
|
+
* @param manifest - The Manifest
|
|
143
|
+
* @returns The model and the warnings it raised
|
|
144
|
+
*/
|
|
145
|
+
export declare function analyzeManifest(manifest: ManifestDocument): {
|
|
146
|
+
model: ManifestModel;
|
|
147
|
+
warnings: string[];
|
|
148
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ManifestDocument } from './document.js';
|
|
2
|
+
/** A property of a generated interface. */
|
|
3
|
+
export interface PropertyModel {
|
|
4
|
+
/** As written in the interface: quoted when it is no identifier. */
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly type: string;
|
|
7
|
+
readonly optional: boolean;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
}
|
|
10
|
+
/** A type declared for a schema of `$defs`. */
|
|
11
|
+
export interface TypeModel {
|
|
12
|
+
/** The `$defs` key. */
|
|
13
|
+
readonly key: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** The file it is declared in, relative to the output directory. */
|
|
16
|
+
readonly file: string;
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
/** An interface's properties, or undefined for a type alias. */
|
|
19
|
+
readonly properties?: readonly PropertyModel[];
|
|
20
|
+
/** A type alias's type; or, for an interface, its index signature's. */
|
|
21
|
+
readonly type?: string;
|
|
22
|
+
/** The type names it refers to. */
|
|
23
|
+
readonly references: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The numbers of a value read and written as their exact text, as
|
|
27
|
+
* `@ahoo-wang/wow-client`'s `TextNumbers` holds them: `true` at such a number,
|
|
28
|
+
* else its members' marks by name, `'*'` for every item or map value.
|
|
29
|
+
*/
|
|
30
|
+
export type TextNumbersModel = true | {
|
|
31
|
+
readonly [member: string]: TextNumbersModel;
|
|
32
|
+
};
|
|
33
|
+
/** A command of an aggregate client. */
|
|
34
|
+
export interface CommandModel {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly method: string;
|
|
37
|
+
/** The `PATHS` member of its route by id, and of its route without one. */
|
|
38
|
+
readonly byIdPath?: {
|
|
39
|
+
readonly member: string;
|
|
40
|
+
readonly path: string;
|
|
41
|
+
};
|
|
42
|
+
readonly unaddressedPath?: {
|
|
43
|
+
readonly member: string;
|
|
44
|
+
readonly path: string;
|
|
45
|
+
};
|
|
46
|
+
/** The body's type name, or undefined when its schema is unknown. */
|
|
47
|
+
readonly bodyType: string;
|
|
48
|
+
/** The body may be left out: its schema requires nothing. */
|
|
49
|
+
readonly bodyOptional: boolean;
|
|
50
|
+
readonly creation: string;
|
|
51
|
+
readonly mounted: boolean;
|
|
52
|
+
readonly produces: readonly string[];
|
|
53
|
+
/** What the command's class says it is, as the Manifest describes it. */
|
|
54
|
+
readonly description?: string;
|
|
55
|
+
/** Its body has exact numbers, under `textNumbers.commands` of its aggregate. */
|
|
56
|
+
readonly bodyNumbers?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** A lifecycle command an aggregate lists. */
|
|
59
|
+
export interface LifecycleModel {
|
|
60
|
+
/** `wow.lifecycle.DeleteAggregate`, … */
|
|
61
|
+
readonly name: string;
|
|
62
|
+
/** The `LifecycleCommands` member. */
|
|
63
|
+
readonly member: string;
|
|
64
|
+
readonly method: string;
|
|
65
|
+
/**
|
|
66
|
+
* The body's type, or undefined for a command without one: the type
|
|
67
|
+
* generated from the Manifest's `$defs` entry of the command's name when it
|
|
68
|
+
* holds one (`bodyGenerated`), else `@ahoo-wang/wow-client`'s.
|
|
69
|
+
*/
|
|
70
|
+
readonly bodyType?: string;
|
|
71
|
+
/** The body's type is generated from the Manifest, not `@ahoo-wang/wow-client`'s. */
|
|
72
|
+
readonly bodyGenerated?: boolean;
|
|
73
|
+
/** What the Manifest's schema of the body says the command does. */
|
|
74
|
+
readonly description?: string;
|
|
75
|
+
}
|
|
76
|
+
/** An aggregate and its clients. */
|
|
77
|
+
export interface AggregateModel {
|
|
78
|
+
readonly context: string;
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly description?: string;
|
|
81
|
+
/** The type-name prefix: `Product`. */
|
|
82
|
+
readonly typeName: string;
|
|
83
|
+
/** The directory of its modules, relative to the output directory. */
|
|
84
|
+
readonly directory: string;
|
|
85
|
+
readonly ownership: string;
|
|
86
|
+
readonly snapshot: boolean;
|
|
87
|
+
readonly stateType: string;
|
|
88
|
+
readonly stateFields: readonly string[];
|
|
89
|
+
readonly commands: readonly CommandModel[];
|
|
90
|
+
readonly events: readonly {
|
|
91
|
+
/** The name the Manifest declares: `ProductCreated`. */
|
|
92
|
+
readonly name: string;
|
|
93
|
+
/**
|
|
94
|
+
* The event type the server names it by on the wire (08-data-protocols §2):
|
|
95
|
+
* `context.aggregate.EventName`, or the declared name when it is already
|
|
96
|
+
* qualified.
|
|
97
|
+
*/
|
|
98
|
+
readonly wireName: string;
|
|
99
|
+
readonly revision: number;
|
|
100
|
+
readonly type: string;
|
|
101
|
+
}[];
|
|
102
|
+
readonly lifecycle: readonly LifecycleModel[];
|
|
103
|
+
readonly queryModels: readonly string[];
|
|
104
|
+
/** The exact numbers of its state, events (by wire name) and commands; none when it has none. */
|
|
105
|
+
readonly textNumbers?: {
|
|
106
|
+
readonly state?: TextNumbersModel;
|
|
107
|
+
readonly events?: Readonly<Record<string, TextNumbersModel>>;
|
|
108
|
+
readonly commands?: Readonly<Record<string, TextNumbersModel>>;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** A bounded context and what its modules declare. */
|
|
112
|
+
export interface ContextModel {
|
|
113
|
+
readonly name: string;
|
|
114
|
+
readonly description?: string;
|
|
115
|
+
/** The type-name prefix: `EshopCatalog`. */
|
|
116
|
+
readonly typeName: string;
|
|
117
|
+
/** The constant prefix: `ESHOP_CATALOG`. */
|
|
118
|
+
readonly constantName: string;
|
|
119
|
+
readonly directory: string;
|
|
120
|
+
readonly errors: readonly {
|
|
121
|
+
readonly member: string;
|
|
122
|
+
readonly code: string;
|
|
123
|
+
readonly status: number;
|
|
124
|
+
readonly description?: string;
|
|
125
|
+
}[];
|
|
126
|
+
readonly subscriptions: readonly string[];
|
|
127
|
+
readonly aggregates: readonly AggregateModel[];
|
|
128
|
+
}
|
|
129
|
+
/** What a Manifest generates, decided before anything is written. */
|
|
130
|
+
export interface ManifestModel {
|
|
131
|
+
readonly service?: string;
|
|
132
|
+
readonly types: readonly TypeModel[];
|
|
133
|
+
readonly contexts: readonly ContextModel[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Decides what a Manifest generates: a `types.ts` per bounded context with
|
|
137
|
+
* the types of the schemas its aggregates reach (a schema two contexts reach
|
|
138
|
+
* is declared in the first), a `boundedContext.ts` with its error codes and
|
|
139
|
+
* wait helpers, and for each aggregate its `aggregate.ts`,
|
|
140
|
+
* `commandClient.ts` and `queryClient.ts`.
|
|
141
|
+
*
|
|
142
|
+
* @param manifest - The Manifest
|
|
143
|
+
* @returns The model and the warnings it raised
|
|
144
|
+
*/
|
|
145
|
+
export declare function analyzeManifest(manifest: ManifestDocument): {
|
|
146
|
+
model: ManifestModel;
|
|
147
|
+
warnings: string[];
|
|
148
|
+
};
|