@ahoo-wang/wow-generator 10.0.0-beta.1 → 10.0.0-beta.11
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 +2 -1
- package/README.zh-CN.md +1 -1
- package/dist/analysis/clientNames.d.cts +0 -9
- package/dist/analysis/clientNames.d.ts +0 -9
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/{codeGenerator-Cxlr_VOh.js → codeGenerator-CXowDsB9.js} +1233 -867
- package/dist/codeGenerator-CXowDsB9.js.map +1 -0
- package/dist/codeGenerator-q59QJpfT.cjs +38 -0
- package/dist/codeGenerator-q59QJpfT.cjs.map +1 -0
- package/dist/emitters/manifest/aggregate.d.cts +4 -0
- package/dist/emitters/manifest/aggregate.d.ts +4 -0
- package/dist/emitters/manifest/commandClient.d.cts +4 -0
- package/dist/emitters/manifest/commandClient.d.ts +4 -0
- package/dist/emitters/manifest/contextClient.d.cts +8 -0
- package/dist/emitters/manifest/contextClient.d.ts +8 -0
- package/dist/emitters/manifest/contract.d.cts +17 -0
- package/dist/emitters/manifest/contract.d.ts +17 -0
- package/dist/emitters/manifest/generatedModule.d.cts +19 -0
- package/dist/emitters/manifest/generatedModule.d.ts +19 -0
- package/dist/emitters/manifest/queryClient.d.cts +4 -0
- package/dist/emitters/manifest/queryClient.d.ts +4 -0
- package/dist/emitters/manifest/routing.d.cts +9 -0
- package/dist/emitters/manifest/routing.d.ts +9 -0
- package/dist/emitters/manifest/serviceRoutes.d.cts +11 -0
- package/dist/emitters/manifest/serviceRoutes.d.ts +11 -0
- package/dist/emitters/manifest/textNumbers.d.cts +24 -0
- package/dist/emitters/manifest/textNumbers.d.ts +24 -0
- package/dist/emitters/manifest/typeDeclarations.d.cts +4 -0
- package/dist/emitters/manifest/typeDeclarations.d.ts +4 -0
- package/dist/emitters/manifestClients.d.cts +1 -5
- package/dist/emitters/manifestClients.d.ts +1 -5
- package/dist/emitters/models.d.cts +1 -1
- package/dist/emitters/models.d.ts +1 -1
- package/dist/emitters/target.d.cts +1 -1
- package/dist/emitters/target.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/manifest/aggregates.d.cts +6 -0
- package/dist/manifest/aggregates.d.ts +6 -0
- package/dist/manifest/analyze.d.cts +1 -186
- package/dist/manifest/analyze.d.ts +1 -186
- package/dist/manifest/document.d.cts +4 -0
- package/dist/manifest/document.d.ts +4 -0
- package/dist/manifest/model.d.cts +180 -0
- package/dist/manifest/model.d.ts +180 -0
- package/dist/manifest/names.d.cts +30 -0
- package/dist/manifest/names.d.ts +30 -0
- package/dist/manifest/schemaTypes.d.cts +46 -0
- package/dist/manifest/schemaTypes.d.ts +46 -0
- package/dist/manifest/serviceRoutes.d.cts +45 -0
- package/dist/manifest/serviceRoutes.d.ts +45 -0
- package/dist/manifest/textNumbers.d.cts +108 -0
- package/dist/manifest/textNumbers.d.ts +108 -0
- package/dist/manifest/typeText.d.cts +11 -0
- package/dist/manifest/typeText.d.ts +11 -0
- package/dist/naming/naming.d.cts +9 -0
- package/dist/naming/naming.d.ts +9 -0
- package/dist/types/indexSignature.d.cts +18 -0
- package/dist/types/indexSignature.d.ts +18 -0
- package/dist/types/literalTypes.d.cts +11 -0
- package/dist/types/literalTypes.d.ts +11 -0
- package/dist/types/typeContext.d.cts +66 -0
- package/dist/types/typeContext.d.ts +66 -0
- package/dist/types/typeResolver.d.cts +2 -101
- package/dist/types/typeResolver.d.ts +2 -101
- package/package.json +14 -14
- package/dist/codeGenerator-CADTvm2G.cjs +0 -37
- package/dist/codeGenerator-CADTvm2G.cjs.map +0 -1
- package/dist/codeGenerator-Cxlr_VOh.js.map +0 -1
|
@@ -1,190 +1,5 @@
|
|
|
1
1
|
import { ManifestDocument } from './document.js';
|
|
2
|
-
|
|
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
|
-
/** Its routes, as the Manifest lists them: the client sends it by them. */
|
|
38
|
-
readonly routes: readonly Route[];
|
|
39
|
-
/** Its route by id, and its route without one. */
|
|
40
|
-
readonly byIdPath?: {
|
|
41
|
-
readonly path: string;
|
|
42
|
-
};
|
|
43
|
-
readonly unaddressedPath?: {
|
|
44
|
-
readonly path: string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Of an aggregate whose id is its owner's, the method that sends it by no id
|
|
48
|
-
* to the caller's own aggregate (`addItemOwn`); `method` then sends it by id.
|
|
49
|
-
*/
|
|
50
|
-
readonly ownMethod?: string;
|
|
51
|
-
/** The body's type name, or undefined when its schema is unknown. */
|
|
52
|
-
readonly bodyType: string;
|
|
53
|
-
/** The body may be left out: its schema requires nothing the method takes. */
|
|
54
|
-
readonly bodyOptional: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* The property of its body that names its aggregate (the Manifest's
|
|
57
|
-
* `idProperty`): the command then has no route by id, and its method no id.
|
|
58
|
-
*/
|
|
59
|
-
readonly idProperty?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Its `idProperty` is computed (`readOnly` in its schema): the service
|
|
62
|
-
* computes it from the body's fields, so the method takes the body without it.
|
|
63
|
-
*/
|
|
64
|
-
readonly idComputed?: boolean;
|
|
65
|
-
readonly creation: string;
|
|
66
|
-
readonly mounted: boolean;
|
|
67
|
-
readonly produces: readonly string[];
|
|
68
|
-
/** What the command's class says it is, as the Manifest describes it. */
|
|
69
|
-
readonly description?: string;
|
|
70
|
-
/** Its body has exact numbers, under `textNumbers.commands` of its aggregate. */
|
|
71
|
-
readonly bodyNumbers?: boolean;
|
|
72
|
-
}
|
|
73
|
-
/** A route of the Manifest: a method and a path, `{id}` the aggregate id. */
|
|
74
|
-
export interface Route {
|
|
75
|
-
readonly method: string;
|
|
76
|
-
readonly path: string;
|
|
77
|
-
}
|
|
78
|
-
/** A lifecycle command an aggregate lists. */
|
|
79
|
-
export interface LifecycleModel {
|
|
80
|
-
/** `wow.lifecycle.DeleteAggregate`, … */
|
|
81
|
-
readonly name: string;
|
|
82
|
-
/** The `LifecycleCommands` member. */
|
|
83
|
-
readonly member: string;
|
|
84
|
-
readonly method: string;
|
|
85
|
-
/** Its routes, as the Manifest lists them. */
|
|
86
|
-
readonly routes: readonly Route[];
|
|
87
|
-
/**
|
|
88
|
-
* Of an aggregate whose id is its owner's, the method that sends it by no id
|
|
89
|
-
* to the caller's own aggregate (`deleteAggregateOwn`).
|
|
90
|
-
*/
|
|
91
|
-
readonly ownMethod?: string;
|
|
92
|
-
/**
|
|
93
|
-
* The body's type, or undefined for a command without one: the type
|
|
94
|
-
* generated from the Manifest's `$defs` entry of the command's name when it
|
|
95
|
-
* holds one (`bodyGenerated`), else `@ahoo-wang/wow-client`'s.
|
|
96
|
-
*/
|
|
97
|
-
readonly bodyType?: string;
|
|
98
|
-
/** The body's type is generated from the Manifest, not `@ahoo-wang/wow-client`'s. */
|
|
99
|
-
readonly bodyGenerated?: boolean;
|
|
100
|
-
/** What the Manifest's schema of the body says the command does. */
|
|
101
|
-
readonly description?: string;
|
|
102
|
-
}
|
|
103
|
-
/** An aggregate and its clients. */
|
|
104
|
-
export interface AggregateModel {
|
|
105
|
-
readonly context: string;
|
|
106
|
-
readonly name: string;
|
|
107
|
-
readonly description?: string;
|
|
108
|
-
/** The type-name prefix: `Product`. */
|
|
109
|
-
readonly typeName: string;
|
|
110
|
-
/** The directory of its modules, relative to the output directory. */
|
|
111
|
-
readonly directory: string;
|
|
112
|
-
readonly ownership: string;
|
|
113
|
-
/**
|
|
114
|
-
* Where its id comes from: `assigned`, or `owner` for one whose id is its
|
|
115
|
-
* owner's, whose commands and state read also go by no id to the caller's own.
|
|
116
|
-
*/
|
|
117
|
-
readonly idSource: string;
|
|
118
|
-
readonly snapshot: boolean;
|
|
119
|
-
readonly stateType: string;
|
|
120
|
-
readonly stateFields: readonly string[];
|
|
121
|
-
readonly commands: readonly CommandModel[];
|
|
122
|
-
readonly events: readonly {
|
|
123
|
-
/** The name the Manifest declares: `ProductCreated`. */
|
|
124
|
-
readonly name: string;
|
|
125
|
-
/**
|
|
126
|
-
* The event type the server names it by on the wire (08-data-protocols §2):
|
|
127
|
-
* `context.aggregate.EventName`, or the declared name when it is already
|
|
128
|
-
* qualified.
|
|
129
|
-
*/
|
|
130
|
-
readonly wireName: string;
|
|
131
|
-
readonly revision: number;
|
|
132
|
-
readonly type: string;
|
|
133
|
-
}[];
|
|
134
|
-
readonly lifecycle: readonly LifecycleModel[];
|
|
135
|
-
readonly queryModels: readonly string[];
|
|
136
|
-
/** The exact numbers of its state, events (by wire name) and commands; none when it has none. */
|
|
137
|
-
readonly textNumbers?: {
|
|
138
|
-
readonly state?: TextNumbersModel;
|
|
139
|
-
readonly events?: Readonly<Record<string, TextNumbersModel>>;
|
|
140
|
-
readonly commands?: Readonly<Record<string, TextNumbersModel>>;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
/** A bounded context and what its modules declare. */
|
|
144
|
-
export interface ContextModel {
|
|
145
|
-
readonly name: string;
|
|
146
|
-
readonly description?: string;
|
|
147
|
-
/** The type-name prefix: `EshopCatalog`. */
|
|
148
|
-
readonly typeName: string;
|
|
149
|
-
/** The constant prefix: `ESHOP_CATALOG`. */
|
|
150
|
-
readonly constantName: string;
|
|
151
|
-
readonly directory: string;
|
|
152
|
-
readonly errors: readonly {
|
|
153
|
-
readonly code: string;
|
|
154
|
-
readonly status: number;
|
|
155
|
-
readonly description?: string;
|
|
156
|
-
}[];
|
|
157
|
-
readonly subscriptions: readonly string[];
|
|
158
|
-
readonly aggregates: readonly AggregateModel[];
|
|
159
|
-
/** Its service routes, in the Manifest's order. */
|
|
160
|
-
readonly routes: readonly ServiceRouteModel[];
|
|
161
|
-
}
|
|
162
|
-
/** A parameter of a service route: a path variable or a query parameter, and its TypeScript type. */
|
|
163
|
-
export interface RouteParameterModel {
|
|
164
|
-
readonly name: string;
|
|
165
|
-
readonly location: 'path' | 'query';
|
|
166
|
-
readonly type: string;
|
|
167
|
-
readonly required: boolean;
|
|
168
|
-
}
|
|
169
|
-
/** A service route: its name, where it is served, its parameters and the types of its body and its answer. */
|
|
170
|
-
export interface ServiceRouteModel {
|
|
171
|
-
readonly name: string;
|
|
172
|
-
readonly method: string;
|
|
173
|
-
readonly path: string;
|
|
174
|
-
readonly description?: string;
|
|
175
|
-
readonly deprecated: boolean;
|
|
176
|
-
readonly parameters: readonly RouteParameterModel[];
|
|
177
|
-
/** The body's type; absent when the route takes none. */
|
|
178
|
-
readonly requestType?: string;
|
|
179
|
-
/** The answer's type; absent when the route answers `204 No Content`. */
|
|
180
|
-
readonly responseType?: string;
|
|
181
|
-
}
|
|
182
|
-
/** What a Manifest generates, decided before anything is written. */
|
|
183
|
-
export interface ManifestModel {
|
|
184
|
-
readonly service?: string;
|
|
185
|
-
readonly types: readonly TypeModel[];
|
|
186
|
-
readonly contexts: readonly ContextModel[];
|
|
187
|
-
}
|
|
2
|
+
import { ManifestModel } from './model.js';
|
|
188
3
|
/**
|
|
189
4
|
* Decides what a Manifest generates: a `types.ts` per bounded context with
|
|
190
5
|
* the types of the schemas its aggregates reach (a schema two contexts reach
|
|
@@ -27,6 +27,8 @@ export declare function schemaKey(ref: string): string | undefined;
|
|
|
27
27
|
* object with a numeric `format` and a `contexts` array, and no `openapi`.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isManifestDocument(document: unknown): boolean;
|
|
30
|
+
/** Whether a value of the document is a JSON object. */
|
|
31
|
+
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
30
32
|
/**
|
|
31
33
|
* Checks that a document is a Manifest of the format the generator reads,
|
|
32
34
|
* with the members it needs.
|
|
@@ -37,3 +39,5 @@ export declare function isManifestDocument(document: unknown): boolean;
|
|
|
37
39
|
* `specification` for a Manifest that misses what it needs
|
|
38
40
|
*/
|
|
39
41
|
export declare function validateManifest(document: unknown, source: string): ManifestDocument;
|
|
42
|
+
/** The JSON types a schema names: its `type`, a string or an array of them. */
|
|
43
|
+
export declare function typesOf(schema: JsonSchema): string[];
|
|
@@ -27,6 +27,8 @@ export declare function schemaKey(ref: string): string | undefined;
|
|
|
27
27
|
* object with a numeric `format` and a `contexts` array, and no `openapi`.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isManifestDocument(document: unknown): boolean;
|
|
30
|
+
/** Whether a value of the document is a JSON object. */
|
|
31
|
+
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
30
32
|
/**
|
|
31
33
|
* Checks that a document is a Manifest of the format the generator reads,
|
|
32
34
|
* with the members it needs.
|
|
@@ -37,3 +39,5 @@ export declare function isManifestDocument(document: unknown): boolean;
|
|
|
37
39
|
* `specification` for a Manifest that misses what it needs
|
|
38
40
|
*/
|
|
39
41
|
export declare function validateManifest(document: unknown, source: string): ManifestDocument;
|
|
42
|
+
/** The JSON types a schema names: its `type`, a string or an array of them. */
|
|
43
|
+
export declare function typesOf(schema: JsonSchema): string[];
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { ServiceRouteModel } from './serviceRoutes.cjs';
|
|
2
|
+
import { TextNumbersDeclaration, TextNumbersModel } from './textNumbers.cjs';
|
|
3
|
+
/** A property of a generated interface. */
|
|
4
|
+
export interface PropertyModel {
|
|
5
|
+
/** As written in the interface: quoted when it is no identifier. */
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly type: string;
|
|
8
|
+
readonly optional: boolean;
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A type declared for a schema of `$defs`. */
|
|
12
|
+
export interface TypeModel {
|
|
13
|
+
/** The `$defs` key. */
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** The file it is declared in, relative to the output directory. */
|
|
17
|
+
readonly file: string;
|
|
18
|
+
readonly description?: string;
|
|
19
|
+
/** An interface's properties, or undefined for a type alias. */
|
|
20
|
+
readonly properties?: readonly PropertyModel[];
|
|
21
|
+
/** A type alias's type; or, for an interface, its index signature's. */
|
|
22
|
+
readonly type?: string;
|
|
23
|
+
/** The type names it refers to. */
|
|
24
|
+
readonly references: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
/** A command of an aggregate client. */
|
|
27
|
+
export interface CommandModel {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly method: string;
|
|
30
|
+
/** Its routes, as the Manifest lists them: the client sends it by them. */
|
|
31
|
+
readonly routes: readonly Route[];
|
|
32
|
+
/** Its route by id, and its route without one. */
|
|
33
|
+
readonly byIdPath?: {
|
|
34
|
+
readonly path: string;
|
|
35
|
+
};
|
|
36
|
+
readonly unaddressedPath?: {
|
|
37
|
+
readonly path: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Of an aggregate whose id is its owner's, the method that sends it by no id
|
|
41
|
+
* to the caller's own aggregate (`addItemOwn`); `method` then sends it by id.
|
|
42
|
+
*/
|
|
43
|
+
readonly ownMethod?: string;
|
|
44
|
+
/** The body's type name, or undefined when its schema is unknown. */
|
|
45
|
+
readonly bodyType: string;
|
|
46
|
+
/** The body may be left out: its schema requires nothing the method takes. */
|
|
47
|
+
readonly bodyOptional: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The property of its body that names its aggregate (the Manifest's
|
|
50
|
+
* `idProperty`): the command then has no route by id, and its method no id.
|
|
51
|
+
*/
|
|
52
|
+
readonly idProperty?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Its `idProperty` is computed (`readOnly` in its schema): the service
|
|
55
|
+
* computes it from the body's fields, so the method takes the body without it.
|
|
56
|
+
*/
|
|
57
|
+
readonly idComputed?: boolean;
|
|
58
|
+
readonly creation: string;
|
|
59
|
+
readonly mounted: boolean;
|
|
60
|
+
readonly produces: readonly string[];
|
|
61
|
+
/** What the command's class says it is, as the Manifest describes it. */
|
|
62
|
+
readonly description?: string;
|
|
63
|
+
/** Its body has exact numbers, under `textNumbers.commands` of its aggregate. */
|
|
64
|
+
readonly bodyNumbers?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** A route of the Manifest: a method and a path, `{id}` the aggregate id. */
|
|
67
|
+
export interface Route {
|
|
68
|
+
readonly method: string;
|
|
69
|
+
readonly path: string;
|
|
70
|
+
}
|
|
71
|
+
/** A lifecycle command an aggregate lists. */
|
|
72
|
+
export interface LifecycleModel {
|
|
73
|
+
/** `wow.lifecycle.DeleteAggregate`, … */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
/** The `LifecycleCommands` member. */
|
|
76
|
+
readonly member: string;
|
|
77
|
+
readonly method: string;
|
|
78
|
+
/** Its routes, as the Manifest lists them. */
|
|
79
|
+
readonly routes: readonly Route[];
|
|
80
|
+
/**
|
|
81
|
+
* Of an aggregate whose id is its owner's, the method that sends it by no id
|
|
82
|
+
* to the caller's own aggregate (`deleteAggregateOwn`).
|
|
83
|
+
*/
|
|
84
|
+
readonly ownMethod?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The body's type, or undefined for a command without one: the type
|
|
87
|
+
* generated from the Manifest's `$defs` entry of the command's name when it
|
|
88
|
+
* holds one (`bodyGenerated`), else `@ahoo-wang/wow-client`'s.
|
|
89
|
+
*/
|
|
90
|
+
readonly bodyType?: string;
|
|
91
|
+
/** The body's type is generated from the Manifest, not `@ahoo-wang/wow-client`'s. */
|
|
92
|
+
readonly bodyGenerated?: boolean;
|
|
93
|
+
/** What the Manifest's schema of the body says the command does. */
|
|
94
|
+
readonly description?: string;
|
|
95
|
+
}
|
|
96
|
+
/** An aggregate and its clients. */
|
|
97
|
+
export interface AggregateModel {
|
|
98
|
+
readonly context: string;
|
|
99
|
+
readonly name: string;
|
|
100
|
+
readonly description?: string;
|
|
101
|
+
/** The type-name prefix: `Product`. */
|
|
102
|
+
readonly typeName: string;
|
|
103
|
+
/** The directory of its modules, relative to the output directory. */
|
|
104
|
+
readonly directory: string;
|
|
105
|
+
readonly ownership: string;
|
|
106
|
+
/**
|
|
107
|
+
* Where its id comes from: `assigned`, or `owner` for one whose id is its
|
|
108
|
+
* owner's, whose commands and state read also go by no id to the caller's own.
|
|
109
|
+
*/
|
|
110
|
+
readonly idSource: string;
|
|
111
|
+
readonly snapshot: boolean;
|
|
112
|
+
readonly stateType: string;
|
|
113
|
+
readonly stateFields: readonly string[];
|
|
114
|
+
readonly commands: readonly CommandModel[];
|
|
115
|
+
readonly events: readonly {
|
|
116
|
+
/** The name the Manifest declares: `ProductCreated`. */
|
|
117
|
+
readonly name: string;
|
|
118
|
+
/**
|
|
119
|
+
* The event type the server names it by on the wire (08-data-protocols §2):
|
|
120
|
+
* `context.aggregate.EventName`, or the declared name when it is already
|
|
121
|
+
* qualified.
|
|
122
|
+
*/
|
|
123
|
+
readonly wireName: string;
|
|
124
|
+
readonly revision: number;
|
|
125
|
+
readonly type: string;
|
|
126
|
+
}[];
|
|
127
|
+
readonly lifecycle: readonly LifecycleModel[];
|
|
128
|
+
readonly queryModels: readonly string[];
|
|
129
|
+
/** Its access attributes (decision D390), in the Manifest's order. */
|
|
130
|
+
readonly access: readonly AccessModel[];
|
|
131
|
+
/**
|
|
132
|
+
* The exact numbers of its state, events (by wire name), commands and
|
|
133
|
+
* access attributes; none when it has none.
|
|
134
|
+
*/
|
|
135
|
+
readonly textNumbers?: {
|
|
136
|
+
readonly state?: TextNumbersModel;
|
|
137
|
+
readonly events?: Readonly<Record<string, TextNumbersModel>>;
|
|
138
|
+
readonly commands?: Readonly<Record<string, TextNumbersModel>>;
|
|
139
|
+
readonly access?: TextNumbersModel;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** An access attribute of an aggregate: its name, the TypeScript type of a value, and whether it holds several. */
|
|
143
|
+
export interface AccessModel {
|
|
144
|
+
readonly name: string;
|
|
145
|
+
/**
|
|
146
|
+
* A value's type: an integer is a `Long` on the server, typed `string` and
|
|
147
|
+
* read as its exact text.
|
|
148
|
+
*/
|
|
149
|
+
readonly type: string;
|
|
150
|
+
readonly multiple: boolean;
|
|
151
|
+
/** Whether its values are integers, read as their exact text. */
|
|
152
|
+
readonly integer: boolean;
|
|
153
|
+
}
|
|
154
|
+
/** A bounded context and what its modules declare. */
|
|
155
|
+
export interface ContextModel {
|
|
156
|
+
readonly name: string;
|
|
157
|
+
readonly description?: string;
|
|
158
|
+
/** The type-name prefix: `EshopCatalog`. */
|
|
159
|
+
readonly typeName: string;
|
|
160
|
+
/** The constant prefix: `ESHOP_CATALOG`. */
|
|
161
|
+
readonly constantName: string;
|
|
162
|
+
readonly directory: string;
|
|
163
|
+
readonly errors: readonly {
|
|
164
|
+
readonly code: string;
|
|
165
|
+
readonly status: number;
|
|
166
|
+
readonly description?: string;
|
|
167
|
+
}[];
|
|
168
|
+
readonly subscriptions: readonly string[];
|
|
169
|
+
readonly aggregates: readonly AggregateModel[];
|
|
170
|
+
/** Its service routes, in the Manifest's order. */
|
|
171
|
+
readonly routes: readonly ServiceRouteModel[];
|
|
172
|
+
/** The marks of the recursive types declared in it, its `textNumbers.ts`. */
|
|
173
|
+
readonly textNumbers: readonly TextNumbersDeclaration[];
|
|
174
|
+
}
|
|
175
|
+
/** What a Manifest generates, decided before anything is written. */
|
|
176
|
+
export interface ManifestModel {
|
|
177
|
+
readonly service?: string;
|
|
178
|
+
readonly types: readonly TypeModel[];
|
|
179
|
+
readonly contexts: readonly ContextModel[];
|
|
180
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { ServiceRouteModel } from './serviceRoutes.js';
|
|
2
|
+
import { TextNumbersDeclaration, TextNumbersModel } from './textNumbers.js';
|
|
3
|
+
/** A property of a generated interface. */
|
|
4
|
+
export interface PropertyModel {
|
|
5
|
+
/** As written in the interface: quoted when it is no identifier. */
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly type: string;
|
|
8
|
+
readonly optional: boolean;
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A type declared for a schema of `$defs`. */
|
|
12
|
+
export interface TypeModel {
|
|
13
|
+
/** The `$defs` key. */
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** The file it is declared in, relative to the output directory. */
|
|
17
|
+
readonly file: string;
|
|
18
|
+
readonly description?: string;
|
|
19
|
+
/** An interface's properties, or undefined for a type alias. */
|
|
20
|
+
readonly properties?: readonly PropertyModel[];
|
|
21
|
+
/** A type alias's type; or, for an interface, its index signature's. */
|
|
22
|
+
readonly type?: string;
|
|
23
|
+
/** The type names it refers to. */
|
|
24
|
+
readonly references: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
/** A command of an aggregate client. */
|
|
27
|
+
export interface CommandModel {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly method: string;
|
|
30
|
+
/** Its routes, as the Manifest lists them: the client sends it by them. */
|
|
31
|
+
readonly routes: readonly Route[];
|
|
32
|
+
/** Its route by id, and its route without one. */
|
|
33
|
+
readonly byIdPath?: {
|
|
34
|
+
readonly path: string;
|
|
35
|
+
};
|
|
36
|
+
readonly unaddressedPath?: {
|
|
37
|
+
readonly path: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Of an aggregate whose id is its owner's, the method that sends it by no id
|
|
41
|
+
* to the caller's own aggregate (`addItemOwn`); `method` then sends it by id.
|
|
42
|
+
*/
|
|
43
|
+
readonly ownMethod?: string;
|
|
44
|
+
/** The body's type name, or undefined when its schema is unknown. */
|
|
45
|
+
readonly bodyType: string;
|
|
46
|
+
/** The body may be left out: its schema requires nothing the method takes. */
|
|
47
|
+
readonly bodyOptional: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The property of its body that names its aggregate (the Manifest's
|
|
50
|
+
* `idProperty`): the command then has no route by id, and its method no id.
|
|
51
|
+
*/
|
|
52
|
+
readonly idProperty?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Its `idProperty` is computed (`readOnly` in its schema): the service
|
|
55
|
+
* computes it from the body's fields, so the method takes the body without it.
|
|
56
|
+
*/
|
|
57
|
+
readonly idComputed?: boolean;
|
|
58
|
+
readonly creation: string;
|
|
59
|
+
readonly mounted: boolean;
|
|
60
|
+
readonly produces: readonly string[];
|
|
61
|
+
/** What the command's class says it is, as the Manifest describes it. */
|
|
62
|
+
readonly description?: string;
|
|
63
|
+
/** Its body has exact numbers, under `textNumbers.commands` of its aggregate. */
|
|
64
|
+
readonly bodyNumbers?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** A route of the Manifest: a method and a path, `{id}` the aggregate id. */
|
|
67
|
+
export interface Route {
|
|
68
|
+
readonly method: string;
|
|
69
|
+
readonly path: string;
|
|
70
|
+
}
|
|
71
|
+
/** A lifecycle command an aggregate lists. */
|
|
72
|
+
export interface LifecycleModel {
|
|
73
|
+
/** `wow.lifecycle.DeleteAggregate`, … */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
/** The `LifecycleCommands` member. */
|
|
76
|
+
readonly member: string;
|
|
77
|
+
readonly method: string;
|
|
78
|
+
/** Its routes, as the Manifest lists them. */
|
|
79
|
+
readonly routes: readonly Route[];
|
|
80
|
+
/**
|
|
81
|
+
* Of an aggregate whose id is its owner's, the method that sends it by no id
|
|
82
|
+
* to the caller's own aggregate (`deleteAggregateOwn`).
|
|
83
|
+
*/
|
|
84
|
+
readonly ownMethod?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The body's type, or undefined for a command without one: the type
|
|
87
|
+
* generated from the Manifest's `$defs` entry of the command's name when it
|
|
88
|
+
* holds one (`bodyGenerated`), else `@ahoo-wang/wow-client`'s.
|
|
89
|
+
*/
|
|
90
|
+
readonly bodyType?: string;
|
|
91
|
+
/** The body's type is generated from the Manifest, not `@ahoo-wang/wow-client`'s. */
|
|
92
|
+
readonly bodyGenerated?: boolean;
|
|
93
|
+
/** What the Manifest's schema of the body says the command does. */
|
|
94
|
+
readonly description?: string;
|
|
95
|
+
}
|
|
96
|
+
/** An aggregate and its clients. */
|
|
97
|
+
export interface AggregateModel {
|
|
98
|
+
readonly context: string;
|
|
99
|
+
readonly name: string;
|
|
100
|
+
readonly description?: string;
|
|
101
|
+
/** The type-name prefix: `Product`. */
|
|
102
|
+
readonly typeName: string;
|
|
103
|
+
/** The directory of its modules, relative to the output directory. */
|
|
104
|
+
readonly directory: string;
|
|
105
|
+
readonly ownership: string;
|
|
106
|
+
/**
|
|
107
|
+
* Where its id comes from: `assigned`, or `owner` for one whose id is its
|
|
108
|
+
* owner's, whose commands and state read also go by no id to the caller's own.
|
|
109
|
+
*/
|
|
110
|
+
readonly idSource: string;
|
|
111
|
+
readonly snapshot: boolean;
|
|
112
|
+
readonly stateType: string;
|
|
113
|
+
readonly stateFields: readonly string[];
|
|
114
|
+
readonly commands: readonly CommandModel[];
|
|
115
|
+
readonly events: readonly {
|
|
116
|
+
/** The name the Manifest declares: `ProductCreated`. */
|
|
117
|
+
readonly name: string;
|
|
118
|
+
/**
|
|
119
|
+
* The event type the server names it by on the wire (08-data-protocols §2):
|
|
120
|
+
* `context.aggregate.EventName`, or the declared name when it is already
|
|
121
|
+
* qualified.
|
|
122
|
+
*/
|
|
123
|
+
readonly wireName: string;
|
|
124
|
+
readonly revision: number;
|
|
125
|
+
readonly type: string;
|
|
126
|
+
}[];
|
|
127
|
+
readonly lifecycle: readonly LifecycleModel[];
|
|
128
|
+
readonly queryModels: readonly string[];
|
|
129
|
+
/** Its access attributes (decision D390), in the Manifest's order. */
|
|
130
|
+
readonly access: readonly AccessModel[];
|
|
131
|
+
/**
|
|
132
|
+
* The exact numbers of its state, events (by wire name), commands and
|
|
133
|
+
* access attributes; none when it has none.
|
|
134
|
+
*/
|
|
135
|
+
readonly textNumbers?: {
|
|
136
|
+
readonly state?: TextNumbersModel;
|
|
137
|
+
readonly events?: Readonly<Record<string, TextNumbersModel>>;
|
|
138
|
+
readonly commands?: Readonly<Record<string, TextNumbersModel>>;
|
|
139
|
+
readonly access?: TextNumbersModel;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** An access attribute of an aggregate: its name, the TypeScript type of a value, and whether it holds several. */
|
|
143
|
+
export interface AccessModel {
|
|
144
|
+
readonly name: string;
|
|
145
|
+
/**
|
|
146
|
+
* A value's type: an integer is a `Long` on the server, typed `string` and
|
|
147
|
+
* read as its exact text.
|
|
148
|
+
*/
|
|
149
|
+
readonly type: string;
|
|
150
|
+
readonly multiple: boolean;
|
|
151
|
+
/** Whether its values are integers, read as their exact text. */
|
|
152
|
+
readonly integer: boolean;
|
|
153
|
+
}
|
|
154
|
+
/** A bounded context and what its modules declare. */
|
|
155
|
+
export interface ContextModel {
|
|
156
|
+
readonly name: string;
|
|
157
|
+
readonly description?: string;
|
|
158
|
+
/** The type-name prefix: `EshopCatalog`. */
|
|
159
|
+
readonly typeName: string;
|
|
160
|
+
/** The constant prefix: `ESHOP_CATALOG`. */
|
|
161
|
+
readonly constantName: string;
|
|
162
|
+
readonly directory: string;
|
|
163
|
+
readonly errors: readonly {
|
|
164
|
+
readonly code: string;
|
|
165
|
+
readonly status: number;
|
|
166
|
+
readonly description?: string;
|
|
167
|
+
}[];
|
|
168
|
+
readonly subscriptions: readonly string[];
|
|
169
|
+
readonly aggregates: readonly AggregateModel[];
|
|
170
|
+
/** Its service routes, in the Manifest's order. */
|
|
171
|
+
readonly routes: readonly ServiceRouteModel[];
|
|
172
|
+
/** The marks of the recursive types declared in it, its `textNumbers.ts`. */
|
|
173
|
+
readonly textNumbers: readonly TextNumbersDeclaration[];
|
|
174
|
+
}
|
|
175
|
+
/** What a Manifest generates, decided before anything is written. */
|
|
176
|
+
export interface ManifestModel {
|
|
177
|
+
readonly service?: string;
|
|
178
|
+
readonly types: readonly TypeModel[];
|
|
179
|
+
readonly contexts: readonly ContextModel[];
|
|
180
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ManifestAggregate, ManifestContext, ManifestDocument } from './document.cjs';
|
|
2
|
+
/** The type name of a context, which the names of its clients start with. */
|
|
3
|
+
export declare function contextTypeName(context: Pick<ManifestContext, 'name'>): string;
|
|
4
|
+
/** The type name of an aggregate, which the names of its clients start with. */
|
|
5
|
+
export declare function aggregateTypeName(aggregate: Pick<ManifestAggregate, 'name'>): string;
|
|
6
|
+
/**
|
|
7
|
+
* The names the modules generated from `manifest` bind besides its types:
|
|
8
|
+
* the TypeScript globals they use, what they import from
|
|
9
|
+
* `@ahoo-wang/wow-client`, and what the generator declares for each context
|
|
10
|
+
* and aggregate. A type of `$defs` takes none of them, as it takes no name of
|
|
11
|
+
* another type: it is qualified by its package instead (`shop.Record` is
|
|
12
|
+
* `ShopRecord`), so every generated module can import it beside them.
|
|
13
|
+
*
|
|
14
|
+
* @param manifest - The Manifest
|
|
15
|
+
*/
|
|
16
|
+
export declare function generatedNames(manifest: ManifestDocument): Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* The parameters a service route's method declares besides its path
|
|
19
|
+
* variables, which take other names: a fresh set for one method.
|
|
20
|
+
*/
|
|
21
|
+
export declare function routeMethodParameters(): Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* A route parameter's name in its method: a path variable's, an identifier no
|
|
24
|
+
* other parameter of the method takes (`used`, updated); a query
|
|
25
|
+
* parameter's, its name, a member of the method's `query`, which takes none.
|
|
26
|
+
*/
|
|
27
|
+
export declare function routeParameterIdentifier(parameter: {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly in: string;
|
|
30
|
+
}, used: Set<string>): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ManifestAggregate, ManifestContext, ManifestDocument } from './document.js';
|
|
2
|
+
/** The type name of a context, which the names of its clients start with. */
|
|
3
|
+
export declare function contextTypeName(context: Pick<ManifestContext, 'name'>): string;
|
|
4
|
+
/** The type name of an aggregate, which the names of its clients start with. */
|
|
5
|
+
export declare function aggregateTypeName(aggregate: Pick<ManifestAggregate, 'name'>): string;
|
|
6
|
+
/**
|
|
7
|
+
* The names the modules generated from `manifest` bind besides its types:
|
|
8
|
+
* the TypeScript globals they use, what they import from
|
|
9
|
+
* `@ahoo-wang/wow-client`, and what the generator declares for each context
|
|
10
|
+
* and aggregate. A type of `$defs` takes none of them, as it takes no name of
|
|
11
|
+
* another type: it is qualified by its package instead (`shop.Record` is
|
|
12
|
+
* `ShopRecord`), so every generated module can import it beside them.
|
|
13
|
+
*
|
|
14
|
+
* @param manifest - The Manifest
|
|
15
|
+
*/
|
|
16
|
+
export declare function generatedNames(manifest: ManifestDocument): Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* The parameters a service route's method declares besides its path
|
|
19
|
+
* variables, which take other names: a fresh set for one method.
|
|
20
|
+
*/
|
|
21
|
+
export declare function routeMethodParameters(): Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* A route parameter's name in its method: a path variable's, an identifier no
|
|
24
|
+
* other parameter of the method takes (`used`, updated); a query
|
|
25
|
+
* parameter's, its name, a member of the method's `query`, which takes none.
|
|
26
|
+
*/
|
|
27
|
+
export declare function routeParameterIdentifier(parameter: {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly in: string;
|
|
30
|
+
}, used: Set<string>): string;
|