@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/wow/model.d.cts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { HTTPMethod, Operation, Parameter, Tag } from '@ahoo-wang/fetcher-openapi';
|
|
2
|
-
import { AliasAggregate, Named } from '@ahoo-wang/wow-client';
|
|
3
|
-
import { KeySchema } from '../openapi/components.cjs';
|
|
4
|
-
export interface CommandDefinition extends Named {
|
|
5
|
-
/**
|
|
6
|
-
* The name of the command
|
|
7
|
-
*/
|
|
8
|
-
name: string;
|
|
9
|
-
/**
|
|
10
|
-
* The HTTP method for the command
|
|
11
|
-
*/
|
|
12
|
-
method: HTTPMethod;
|
|
13
|
-
/**
|
|
14
|
-
* The endpoint path for the command
|
|
15
|
-
*/
|
|
16
|
-
path: string;
|
|
17
|
-
/**
|
|
18
|
-
* The path parameters for the command
|
|
19
|
-
*/
|
|
20
|
-
pathParameters: Parameter[];
|
|
21
|
-
summary?: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The schema for the command body
|
|
25
|
-
*/
|
|
26
|
-
schema: KeySchema;
|
|
27
|
-
operation: Operation;
|
|
28
|
-
}
|
|
29
|
-
export interface EventDefinition extends Named {
|
|
30
|
-
/**
|
|
31
|
-
* The name of the event
|
|
32
|
-
*/
|
|
33
|
-
name: string;
|
|
34
|
-
/**
|
|
35
|
-
* The title of the event
|
|
36
|
-
*/
|
|
37
|
-
title: string;
|
|
38
|
-
/**
|
|
39
|
-
* The schema for the event body
|
|
40
|
-
*/
|
|
41
|
-
schema: KeySchema;
|
|
42
|
-
}
|
|
43
|
-
export interface TagAliasAggregate extends AliasAggregate {
|
|
44
|
-
tag: Tag;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Complete definition of an aggregate including its commands, events, and state schemas.
|
|
48
|
-
*/
|
|
49
|
-
export interface AggregateDefinition {
|
|
50
|
-
/** The aggregate metadata with tag and alias information */
|
|
51
|
-
aggregate: TagAliasAggregate;
|
|
52
|
-
/**
|
|
53
|
-
* The aggregate's route segment, which is its name unless the aggregate
|
|
54
|
-
* sets a resource name: `sales-order` for the aggregate `order`.
|
|
55
|
-
*/
|
|
56
|
-
resourceName: string;
|
|
57
|
-
/**
|
|
58
|
-
* The schema for the aggregate root state
|
|
59
|
-
*/
|
|
60
|
-
state: KeySchema;
|
|
61
|
-
/**
|
|
62
|
-
* The fields schema for aggregate queries
|
|
63
|
-
*/
|
|
64
|
-
fields: KeySchema;
|
|
65
|
-
/**
|
|
66
|
-
* Map of command names to command definitions
|
|
67
|
-
*/
|
|
68
|
-
commands: Map<string, CommandDefinition>;
|
|
69
|
-
/**
|
|
70
|
-
* Map of event names to event definitions
|
|
71
|
-
*/
|
|
72
|
-
events: Map<string, EventDefinition>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Map of context aliases to sets of aggregate definitions
|
|
76
|
-
*/
|
|
77
|
-
export type BoundedContextAggregates = Map<string, Set<AggregateDefinition>>;
|
|
78
|
-
/**
|
|
79
|
-
* The doc comment the Wow metadata lends a schema: a command body takes its
|
|
80
|
-
* operation's summary and description where it has none of its own, an event
|
|
81
|
-
* body the title of its domain event. It holds every field the metadata
|
|
82
|
-
* sets, in the order it sets them, so a model's doc reads the schema with
|
|
83
|
-
* these over it the way it read the document the old resolver changed in
|
|
84
|
-
* place: a field the schema lacks comes last, and an `undefined` one is left
|
|
85
|
-
* out. The document itself is never changed.
|
|
86
|
-
*/
|
|
87
|
-
export type SchemaDocOverride = Readonly<Partial<Record<'title' | 'description', string | undefined>>>;
|
|
88
|
-
/** What the Wow metadata of a document says, read without changing it. */
|
|
89
|
-
export interface WowModel {
|
|
90
|
-
/** The bounded context the document names (`info.x-wow-context-alias`). */
|
|
91
|
-
readonly contextAlias?: string;
|
|
92
|
-
/** The aggregates that have state and query fields, by context alias. */
|
|
93
|
-
readonly contexts: BoundedContextAggregates;
|
|
94
|
-
/**
|
|
95
|
-
* The tags of every aggregate that exposes a Wow route, resolved or not.
|
|
96
|
-
* Their operations belong to command and query clients, not to API clients.
|
|
97
|
-
*/
|
|
98
|
-
readonly aggregateTags: ReadonlySet<string>;
|
|
99
|
-
/** The doc comments the metadata lends schemas, by component key. */
|
|
100
|
-
readonly schemaDocOverrides: ReadonlyMap<string, SchemaDocOverride>;
|
|
101
|
-
/** Aggregates and commands skipped for missing metadata, a warning each. */
|
|
102
|
-
readonly warnings: readonly string[];
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Tells whether the document comes from a Wow service: it names its bounded
|
|
106
|
-
* context, or it has aggregates.
|
|
107
|
-
*/
|
|
108
|
-
export declare function isWowDocument(wow: Pick<WowModel, 'contextAlias' | 'aggregateTags'>): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* A schema as a model's doc reads it: the schema with the doc comment the
|
|
111
|
-
* Wow metadata lends it over it.
|
|
112
|
-
*
|
|
113
|
-
* @param schema - The schema, left unchanged
|
|
114
|
-
* @param override - What the metadata lends it, if anything
|
|
115
|
-
*/
|
|
116
|
-
export declare function withDocOverride<T extends object>(schema: T, override: SchemaDocOverride | undefined): T;
|
package/dist/wow/model.d.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { HTTPMethod, Operation, Parameter, Tag } from '@ahoo-wang/fetcher-openapi';
|
|
2
|
-
import { AliasAggregate, Named } from '@ahoo-wang/wow-client';
|
|
3
|
-
import { KeySchema } from '../openapi/components.js';
|
|
4
|
-
export interface CommandDefinition extends Named {
|
|
5
|
-
/**
|
|
6
|
-
* The name of the command
|
|
7
|
-
*/
|
|
8
|
-
name: string;
|
|
9
|
-
/**
|
|
10
|
-
* The HTTP method for the command
|
|
11
|
-
*/
|
|
12
|
-
method: HTTPMethod;
|
|
13
|
-
/**
|
|
14
|
-
* The endpoint path for the command
|
|
15
|
-
*/
|
|
16
|
-
path: string;
|
|
17
|
-
/**
|
|
18
|
-
* The path parameters for the command
|
|
19
|
-
*/
|
|
20
|
-
pathParameters: Parameter[];
|
|
21
|
-
summary?: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The schema for the command body
|
|
25
|
-
*/
|
|
26
|
-
schema: KeySchema;
|
|
27
|
-
operation: Operation;
|
|
28
|
-
}
|
|
29
|
-
export interface EventDefinition extends Named {
|
|
30
|
-
/**
|
|
31
|
-
* The name of the event
|
|
32
|
-
*/
|
|
33
|
-
name: string;
|
|
34
|
-
/**
|
|
35
|
-
* The title of the event
|
|
36
|
-
*/
|
|
37
|
-
title: string;
|
|
38
|
-
/**
|
|
39
|
-
* The schema for the event body
|
|
40
|
-
*/
|
|
41
|
-
schema: KeySchema;
|
|
42
|
-
}
|
|
43
|
-
export interface TagAliasAggregate extends AliasAggregate {
|
|
44
|
-
tag: Tag;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Complete definition of an aggregate including its commands, events, and state schemas.
|
|
48
|
-
*/
|
|
49
|
-
export interface AggregateDefinition {
|
|
50
|
-
/** The aggregate metadata with tag and alias information */
|
|
51
|
-
aggregate: TagAliasAggregate;
|
|
52
|
-
/**
|
|
53
|
-
* The aggregate's route segment, which is its name unless the aggregate
|
|
54
|
-
* sets a resource name: `sales-order` for the aggregate `order`.
|
|
55
|
-
*/
|
|
56
|
-
resourceName: string;
|
|
57
|
-
/**
|
|
58
|
-
* The schema for the aggregate root state
|
|
59
|
-
*/
|
|
60
|
-
state: KeySchema;
|
|
61
|
-
/**
|
|
62
|
-
* The fields schema for aggregate queries
|
|
63
|
-
*/
|
|
64
|
-
fields: KeySchema;
|
|
65
|
-
/**
|
|
66
|
-
* Map of command names to command definitions
|
|
67
|
-
*/
|
|
68
|
-
commands: Map<string, CommandDefinition>;
|
|
69
|
-
/**
|
|
70
|
-
* Map of event names to event definitions
|
|
71
|
-
*/
|
|
72
|
-
events: Map<string, EventDefinition>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Map of context aliases to sets of aggregate definitions
|
|
76
|
-
*/
|
|
77
|
-
export type BoundedContextAggregates = Map<string, Set<AggregateDefinition>>;
|
|
78
|
-
/**
|
|
79
|
-
* The doc comment the Wow metadata lends a schema: a command body takes its
|
|
80
|
-
* operation's summary and description where it has none of its own, an event
|
|
81
|
-
* body the title of its domain event. It holds every field the metadata
|
|
82
|
-
* sets, in the order it sets them, so a model's doc reads the schema with
|
|
83
|
-
* these over it the way it read the document the old resolver changed in
|
|
84
|
-
* place: a field the schema lacks comes last, and an `undefined` one is left
|
|
85
|
-
* out. The document itself is never changed.
|
|
86
|
-
*/
|
|
87
|
-
export type SchemaDocOverride = Readonly<Partial<Record<'title' | 'description', string | undefined>>>;
|
|
88
|
-
/** What the Wow metadata of a document says, read without changing it. */
|
|
89
|
-
export interface WowModel {
|
|
90
|
-
/** The bounded context the document names (`info.x-wow-context-alias`). */
|
|
91
|
-
readonly contextAlias?: string;
|
|
92
|
-
/** The aggregates that have state and query fields, by context alias. */
|
|
93
|
-
readonly contexts: BoundedContextAggregates;
|
|
94
|
-
/**
|
|
95
|
-
* The tags of every aggregate that exposes a Wow route, resolved or not.
|
|
96
|
-
* Their operations belong to command and query clients, not to API clients.
|
|
97
|
-
*/
|
|
98
|
-
readonly aggregateTags: ReadonlySet<string>;
|
|
99
|
-
/** The doc comments the metadata lends schemas, by component key. */
|
|
100
|
-
readonly schemaDocOverrides: ReadonlyMap<string, SchemaDocOverride>;
|
|
101
|
-
/** Aggregates and commands skipped for missing metadata, a warning each. */
|
|
102
|
-
readonly warnings: readonly string[];
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Tells whether the document comes from a Wow service: it names its bounded
|
|
106
|
-
* context, or it has aggregates.
|
|
107
|
-
*/
|
|
108
|
-
export declare function isWowDocument(wow: Pick<WowModel, 'contextAlias' | 'aggregateTags'>): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* A schema as a model's doc reads it: the schema with the doc comment the
|
|
111
|
-
* Wow metadata lends it over it.
|
|
112
|
-
*
|
|
113
|
-
* @param schema - The schema, left unchanged
|
|
114
|
-
* @param override - What the metadata lends it, if anything
|
|
115
|
-
*/
|
|
116
|
-
export declare function withDocOverride<T extends object>(schema: T, override: SchemaDocOverride | undefined): T;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { OpenApiDocument } from '../openapi/document.cjs';
|
|
2
|
-
import { WowModel } from './model.cjs';
|
|
3
|
-
/**
|
|
4
|
-
* Reads the Wow metadata of a document: its bounded context, and each
|
|
5
|
-
* aggregate its tags name with the aggregate's commands, events, state,
|
|
6
|
-
* query fields and route segment.
|
|
7
|
-
*
|
|
8
|
-
* An aggregate needs its state (`snapshot_state.single`) and its query fields
|
|
9
|
-
* (`snapshot.count`) to generate clients; one that lacks either is left out
|
|
10
|
-
* with a warning, and so is a command whose body is not a component schema.
|
|
11
|
-
*
|
|
12
|
-
* It is a pure function: the document is left as it was. The doc comments the
|
|
13
|
-
* metadata lends command and event bodies are in
|
|
14
|
-
* {@link WowModel.schemaDocOverrides}.
|
|
15
|
-
*
|
|
16
|
-
* @param document - The document
|
|
17
|
-
* @returns The Wow model, and the warnings to log
|
|
18
|
-
* @throws GeneratorError (`specification`) when an aggregate's Wow metadata
|
|
19
|
-
* is malformed, or a command's response references form a cycle
|
|
20
|
-
*/
|
|
21
|
-
export declare function resolveWowModel(document: OpenApiDocument): WowModel;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { OpenApiDocument } from '../openapi/document.js';
|
|
2
|
-
import { WowModel } from './model.js';
|
|
3
|
-
/**
|
|
4
|
-
* Reads the Wow metadata of a document: its bounded context, and each
|
|
5
|
-
* aggregate its tags name with the aggregate's commands, events, state,
|
|
6
|
-
* query fields and route segment.
|
|
7
|
-
*
|
|
8
|
-
* An aggregate needs its state (`snapshot_state.single`) and its query fields
|
|
9
|
-
* (`snapshot.count`) to generate clients; one that lacks either is left out
|
|
10
|
-
* with a warning, and so is a command whose body is not a component schema.
|
|
11
|
-
*
|
|
12
|
-
* It is a pure function: the document is left as it was. The doc comments the
|
|
13
|
-
* metadata lends command and event bodies are in
|
|
14
|
-
* {@link WowModel.schemaDocOverrides}.
|
|
15
|
-
*
|
|
16
|
-
* @param document - The document
|
|
17
|
-
* @returns The Wow model, and the warnings to log
|
|
18
|
-
* @throws GeneratorError (`specification`) when an aggregate's Wow metadata
|
|
19
|
-
* is malformed, or a command's response references form a cycle
|
|
20
|
-
*/
|
|
21
|
-
export declare function resolveWowModel(document: OpenApiDocument): WowModel;
|