@ahoo-wang/wow-generator 10.0.0-beta.1 → 10.0.0-beta.2

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.
Files changed (70) hide show
  1. package/README.md +2 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/analysis/clientNames.d.cts +0 -9
  4. package/dist/analysis/clientNames.d.ts +0 -9
  5. package/dist/cli.cjs +1 -1
  6. package/dist/cli.js +2 -2
  7. package/dist/{codeGenerator-Cxlr_VOh.js → codeGenerator-CXowDsB9.js} +1233 -867
  8. package/dist/codeGenerator-CXowDsB9.js.map +1 -0
  9. package/dist/codeGenerator-q59QJpfT.cjs +38 -0
  10. package/dist/codeGenerator-q59QJpfT.cjs.map +1 -0
  11. package/dist/emitters/manifest/aggregate.d.cts +4 -0
  12. package/dist/emitters/manifest/aggregate.d.ts +4 -0
  13. package/dist/emitters/manifest/commandClient.d.cts +4 -0
  14. package/dist/emitters/manifest/commandClient.d.ts +4 -0
  15. package/dist/emitters/manifest/contextClient.d.cts +8 -0
  16. package/dist/emitters/manifest/contextClient.d.ts +8 -0
  17. package/dist/emitters/manifest/contract.d.cts +17 -0
  18. package/dist/emitters/manifest/contract.d.ts +17 -0
  19. package/dist/emitters/manifest/generatedModule.d.cts +19 -0
  20. package/dist/emitters/manifest/generatedModule.d.ts +19 -0
  21. package/dist/emitters/manifest/queryClient.d.cts +4 -0
  22. package/dist/emitters/manifest/queryClient.d.ts +4 -0
  23. package/dist/emitters/manifest/routing.d.cts +9 -0
  24. package/dist/emitters/manifest/routing.d.ts +9 -0
  25. package/dist/emitters/manifest/serviceRoutes.d.cts +11 -0
  26. package/dist/emitters/manifest/serviceRoutes.d.ts +11 -0
  27. package/dist/emitters/manifest/textNumbers.d.cts +24 -0
  28. package/dist/emitters/manifest/textNumbers.d.ts +24 -0
  29. package/dist/emitters/manifest/typeDeclarations.d.cts +4 -0
  30. package/dist/emitters/manifest/typeDeclarations.d.ts +4 -0
  31. package/dist/emitters/manifestClients.d.cts +1 -5
  32. package/dist/emitters/manifestClients.d.ts +1 -5
  33. package/dist/emitters/models.d.cts +1 -1
  34. package/dist/emitters/models.d.ts +1 -1
  35. package/dist/emitters/target.d.cts +1 -1
  36. package/dist/emitters/target.d.ts +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/manifest/aggregates.d.cts +6 -0
  40. package/dist/manifest/aggregates.d.ts +6 -0
  41. package/dist/manifest/analyze.d.cts +1 -186
  42. package/dist/manifest/analyze.d.ts +1 -186
  43. package/dist/manifest/document.d.cts +4 -0
  44. package/dist/manifest/document.d.ts +4 -0
  45. package/dist/manifest/model.d.cts +180 -0
  46. package/dist/manifest/model.d.ts +180 -0
  47. package/dist/manifest/names.d.cts +30 -0
  48. package/dist/manifest/names.d.ts +30 -0
  49. package/dist/manifest/schemaTypes.d.cts +46 -0
  50. package/dist/manifest/schemaTypes.d.ts +46 -0
  51. package/dist/manifest/serviceRoutes.d.cts +45 -0
  52. package/dist/manifest/serviceRoutes.d.ts +45 -0
  53. package/dist/manifest/textNumbers.d.cts +108 -0
  54. package/dist/manifest/textNumbers.d.ts +108 -0
  55. package/dist/manifest/typeText.d.cts +11 -0
  56. package/dist/manifest/typeText.d.ts +11 -0
  57. package/dist/naming/naming.d.cts +9 -0
  58. package/dist/naming/naming.d.ts +9 -0
  59. package/dist/types/indexSignature.d.cts +18 -0
  60. package/dist/types/indexSignature.d.ts +18 -0
  61. package/dist/types/literalTypes.d.cts +11 -0
  62. package/dist/types/literalTypes.d.ts +11 -0
  63. package/dist/types/typeContext.d.cts +66 -0
  64. package/dist/types/typeContext.d.ts +66 -0
  65. package/dist/types/typeResolver.d.cts +2 -101
  66. package/dist/types/typeResolver.d.ts +2 -101
  67. package/package.json +6 -6
  68. package/dist/codeGenerator-CADTvm2G.cjs +0 -37
  69. package/dist/codeGenerator-CADTvm2G.cjs.map +0 -1
  70. package/dist/codeGenerator-Cxlr_VOh.js.map +0 -1
@@ -0,0 +1,4 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.cjs';
3
+ import { TypeFiles } from './generatedModule.cjs';
4
+ export declare function emitAggregate(aggregate: AggregateModel, context: ContextModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,4 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.js';
3
+ import { TypeFiles } from './generatedModule.js';
4
+ export declare function emitAggregate(aggregate: AggregateModel, context: ContextModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,4 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.cjs';
3
+ import { TypeFiles } from './generatedModule.cjs';
4
+ export declare function emitCommandClient(aggregate: AggregateModel, context: ContextModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,4 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.js';
3
+ import { TypeFiles } from './generatedModule.js';
4
+ export declare function emitCommandClient(aggregate: AggregateModel, context: ContextModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,8 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { ContextModel } from '../../manifest/model.cjs';
3
+ /**
4
+ * The clients of a context in one place: per aggregate its command client and
5
+ * its query and state clients, on the same options. Each client stays its own
6
+ * module too, so an application that imports a single client loads no other.
7
+ */
8
+ export declare function emitContextClient(context: ContextModel, modules: ModuleSet, outputDir: string): void;
@@ -0,0 +1,8 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { ContextModel } from '../../manifest/model.js';
3
+ /**
4
+ * The clients of a context in one place: per aggregate its command client and
5
+ * its query and state clients, on the same options. Each client stays its own
6
+ * module too, so an application that imports a single client loads no other.
7
+ */
8
+ export declare function emitContextClient(context: ContextModel, modules: ModuleSet, outputDir: string): void;
@@ -0,0 +1,17 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.cjs';
3
+ /** An error of a context's Manifest, by the constant it is named by. */
4
+ type ErrorEntry = ContextModel['errors'][number];
5
+ /**
6
+ * The errors of `aggregate`, those whose code is `context.aggregate.*`, or,
7
+ * without one, the context's own: each by the constant naming what follows
8
+ * its owner's name, as the Kotlin contract names them.
9
+ */
10
+ export declare function errorsOf(context: ContextModel, aggregate?: AggregateModel): {
11
+ readonly member: string;
12
+ readonly error: ErrorEntry;
13
+ }[];
14
+ /** The `Errors` member of a contract constant, or nothing when it has none. */
15
+ export declare function errorsMember(errors: ReturnType<typeof errorsOf>, indent: string): string;
16
+ export declare function emitContract(context: ContextModel, modules: ModuleSet, outputDir: string): void;
17
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.js';
3
+ /** An error of a context's Manifest, by the constant it is named by. */
4
+ type ErrorEntry = ContextModel['errors'][number];
5
+ /**
6
+ * The errors of `aggregate`, those whose code is `context.aggregate.*`, or,
7
+ * without one, the context's own: each by the constant naming what follows
8
+ * its owner's name, as the Kotlin contract names them.
9
+ */
10
+ export declare function errorsOf(context: ContextModel, aggregate?: AggregateModel): {
11
+ readonly member: string;
12
+ readonly error: ErrorEntry;
13
+ }[];
14
+ /** The `Errors` member of a contract constant, or nothing when it has none. */
15
+ export declare function errorsMember(errors: ReturnType<typeof errorsOf>, indent: string): string;
16
+ export declare function emitContract(context: ContextModel, modules: ModuleSet, outputDir: string): void;
17
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ModuleBuilder } from '../../emit/moduleBuilder.cjs';
2
+ /** The entry of the client every generated module imports from. */
3
+ export declare const WOW_CLIENT = "@ahoo-wang/wow-client";
4
+ /** The entry of the service routes' client. */
5
+ export declare const WOW_CLIENT_ROUTES = "@ahoo-wang/wow-client/routes";
6
+ /** A doc comment of the lines given, those without text left out. */
7
+ export declare function doc(lines: readonly (string | undefined)[], indent?: string): string;
8
+ /**
9
+ * Adds a statement set off from the one before by a blank line, as the
10
+ * structures the other emitters add are.
11
+ */
12
+ export declare function addStatement(module: ModuleBuilder, statement: string): void;
13
+ export declare function union(members: readonly string[]): string;
14
+ /** Where each generated type is declared, by its name. */
15
+ export type TypeFiles = ReadonlyMap<string, string>;
16
+ /**
17
+ * Imports the generated types a module names from the files declaring them.
18
+ */
19
+ export declare function importTypes(module: ModuleBuilder, outputDir: string, files: TypeFiles, names: readonly string[], ownFile?: string): void;
@@ -0,0 +1,19 @@
1
+ import { ModuleBuilder } from '../../emit/moduleBuilder.js';
2
+ /** The entry of the client every generated module imports from. */
3
+ export declare const WOW_CLIENT = "@ahoo-wang/wow-client";
4
+ /** The entry of the service routes' client. */
5
+ export declare const WOW_CLIENT_ROUTES = "@ahoo-wang/wow-client/routes";
6
+ /** A doc comment of the lines given, those without text left out. */
7
+ export declare function doc(lines: readonly (string | undefined)[], indent?: string): string;
8
+ /**
9
+ * Adds a statement set off from the one before by a blank line, as the
10
+ * structures the other emitters add are.
11
+ */
12
+ export declare function addStatement(module: ModuleBuilder, statement: string): void;
13
+ export declare function union(members: readonly string[]): string;
14
+ /** Where each generated type is declared, by its name. */
15
+ export type TypeFiles = ReadonlyMap<string, string>;
16
+ /**
17
+ * Imports the generated types a module names from the files declaring them.
18
+ */
19
+ export declare function importTypes(module: ModuleBuilder, outputDir: string, files: TypeFiles, names: readonly string[], ownFile?: string): void;
@@ -0,0 +1,4 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { AggregateModel } from '../../manifest/model.cjs';
3
+ import { TypeFiles } from './generatedModule.cjs';
4
+ export declare function emitQueryClient(aggregate: AggregateModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,4 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { AggregateModel } from '../../manifest/model.js';
3
+ import { TypeFiles } from './generatedModule.js';
4
+ export declare function emitQueryClient(aggregate: AggregateModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,9 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { ContextModel } from '../../manifest/model.cjs';
3
+ /**
4
+ * The routing part of the service's Manifest, as data: each aggregate's
5
+ * commands, its lifecycle commands among them, with their routes, and the
6
+ * property of the body that names the aggregate of a command whose body does.
7
+ * Its clients send by it, so they fetch no Manifest; it holds no schema.
8
+ */
9
+ export declare function emitRouting(context: ContextModel, modules: ModuleSet): void;
@@ -0,0 +1,9 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { ContextModel } from '../../manifest/model.js';
3
+ /**
4
+ * The routing part of the service's Manifest, as data: each aggregate's
5
+ * commands, its lifecycle commands among them, with their routes, and the
6
+ * property of the body that names the aggregate of a command whose body does.
7
+ * Its clients send by it, so they fetch no Manifest; it holds no schema.
8
+ */
9
+ export declare function emitRouting(context: ContextModel, modules: ModuleSet): void;
@@ -0,0 +1,11 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { ContextModel } from '../../manifest/model.cjs';
3
+ import { TypeFiles } from './generatedModule.cjs';
4
+ /**
5
+ * A context's service routes as one class, a method per route named as the
6
+ * Manifest names it: its path variables in order, then its body, then an
7
+ * object of its query parameters (required when one of them is), then the
8
+ * request's options; it answers the route's answer (`| undefined` when it
9
+ * may answer 204 for it), or nothing for a route that answers 204 alone.
10
+ */
11
+ export declare function emitServiceRoutes(context: ContextModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,11 @@
1
+ import { ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { ContextModel } from '../../manifest/model.js';
3
+ import { TypeFiles } from './generatedModule.js';
4
+ /**
5
+ * A context's service routes as one class, a method per route named as the
6
+ * Manifest names it: its path variables in order, then its body, then an
7
+ * object of its query parameters (required when one of them is), then the
8
+ * request's options; it answers the route's answer (`| undefined` when it
9
+ * may answer 204 for it), or nothing for a route that answers 204 alone.
10
+ */
11
+ export declare function emitServiceRoutes(context: ContextModel, modules: ModuleSet, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,24 @@
1
+ import { ModuleBuilder, ModuleSet } from '../../emit/moduleBuilder.cjs';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.cjs';
3
+ /** Where the marks of a module go: the module, the output directory, and the client's entry. */
4
+ interface Target {
5
+ readonly module: ModuleBuilder;
6
+ readonly outputDir: string;
7
+ readonly client: string;
8
+ }
9
+ /**
10
+ * The `textNumbers` member of an aggregate constant, or nothing when it has
11
+ * none.
12
+ */
13
+ export declare function textNumbersMember(aggregate: AggregateModel, target: Target): string;
14
+ /**
15
+ * The `textNumbers` option of a context's `ServiceRoutes`, by
16
+ * `context.route`, or nothing when no route has exact numbers.
17
+ */
18
+ export declare function routeNumbersOption(context: ContextModel, target: Target): string;
19
+ /**
20
+ * Writes a context's `textNumbers.ts`, the marks of its recursive types,
21
+ * which other marks read lazily; nothing for a context that has none.
22
+ */
23
+ export declare function emitTextNumbers(context: ContextModel, modules: ModuleSet, outputDir: string, client: string): void;
24
+ export {};
@@ -0,0 +1,24 @@
1
+ import { ModuleBuilder, ModuleSet } from '../../emit/moduleBuilder.js';
2
+ import { AggregateModel, ContextModel } from '../../manifest/model.js';
3
+ /** Where the marks of a module go: the module, the output directory, and the client's entry. */
4
+ interface Target {
5
+ readonly module: ModuleBuilder;
6
+ readonly outputDir: string;
7
+ readonly client: string;
8
+ }
9
+ /**
10
+ * The `textNumbers` member of an aggregate constant, or nothing when it has
11
+ * none.
12
+ */
13
+ export declare function textNumbersMember(aggregate: AggregateModel, target: Target): string;
14
+ /**
15
+ * The `textNumbers` option of a context's `ServiceRoutes`, by
16
+ * `context.route`, or nothing when no route has exact numbers.
17
+ */
18
+ export declare function routeNumbersOption(context: ContextModel, target: Target): string;
19
+ /**
20
+ * Writes a context's `textNumbers.ts`, the marks of its recursive types,
21
+ * which other marks read lazily; nothing for a context that has none.
22
+ */
23
+ export declare function emitTextNumbers(context: ContextModel, modules: ModuleSet, outputDir: string, client: string): void;
24
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ModuleBuilder } from '../../emit/moduleBuilder.cjs';
2
+ import { TypeModel } from '../../manifest/model.cjs';
3
+ import { TypeFiles } from './generatedModule.cjs';
4
+ export declare function emitType(module: ModuleBuilder, type: TypeModel, files: TypeFiles, outputDir: string): void;
@@ -0,0 +1,4 @@
1
+ import { ModuleBuilder } from '../../emit/moduleBuilder.js';
2
+ import { TypeModel } from '../../manifest/model.js';
3
+ import { TypeFiles } from './generatedModule.js';
4
+ export declare function emitType(module: ModuleBuilder, type: TypeModel, files: TypeFiles, outputDir: string): void;
@@ -1,9 +1,5 @@
1
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
- /** The entry of the service routes' client. */
6
- export declare const WOW_CLIENT_ROUTES = "@ahoo-wang/wow-client/routes";
2
+ import { ManifestModel } from '../manifest/model.cjs';
7
3
  /**
8
4
  * Describes every file a Manifest generates to its module: the types of each
9
5
  * bounded context, its error codes and wait
@@ -1,9 +1,5 @@
1
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
- /** The entry of the service routes' client. */
6
- export declare const WOW_CLIENT_ROUTES = "@ahoo-wang/wow-client/routes";
2
+ import { ManifestModel } from '../manifest/model.js';
7
3
  /**
8
4
  * Describes every file a Manifest generates to its module: the types of each
9
5
  * bounded context, its error codes and wait
@@ -1,7 +1,7 @@
1
1
  import { Components, Reference, Schema } from '@ahoo-wang/fetcher-openapi';
2
2
  import { ModelDeclaration } from '../analysis/model.cjs';
3
3
  import { ModuleBuilder } from '../emit/moduleBuilder.cjs';
4
- import { TypeContext } from '../types/typeResolver.cjs';
4
+ import { TypeContext } from '../types/typeContext.cjs';
5
5
  import { EmitTarget } from './target.cjs';
6
6
  /**
7
7
  * The type context of a document: its components, named the way the
@@ -1,7 +1,7 @@
1
1
  import { Components, Reference, Schema } from '@ahoo-wang/fetcher-openapi';
2
2
  import { ModelDeclaration } from '../analysis/model.js';
3
3
  import { ModuleBuilder } from '../emit/moduleBuilder.js';
4
- import { TypeContext } from '../types/typeResolver.js';
4
+ import { TypeContext } from '../types/typeContext.js';
5
5
  import { EmitTarget } from './target.js';
6
6
  /**
7
7
  * The type context of a document: its components, named the way the
@@ -1,6 +1,6 @@
1
1
  import { SchemaDocs } from '../api/options.cjs';
2
2
  import { ModuleSet } from '../emit/moduleBuilder.cjs';
3
- import { TypeContext } from '../types/typeResolver.cjs';
3
+ import { TypeContext } from '../types/typeContext.cjs';
4
4
  /** Where the emitters write, and what every module of a run shares. */
5
5
  export interface EmitTarget {
6
6
  /** The module of each file, claimed from the output the first time asked. */
@@ -1,6 +1,6 @@
1
1
  import { SchemaDocs } from '../api/options.js';
2
2
  import { ModuleSet } from '../emit/moduleBuilder.js';
3
- import { TypeContext } from '../types/typeResolver.js';
3
+ import { TypeContext } from '../types/typeContext.js';
4
4
  /** Where the emitters write, and what every module of a run shares. */
5
5
  export interface EmitTarget {
6
6
  /** The module of each file, claimed from the output the first time asked. */
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./codeGenerator-CADTvm2G.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;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./codeGenerator-q59QJpfT.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-Cxlr_VOh.js";
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-CXowDsB9.js";
@@ -0,0 +1,6 @@
1
+ import { ManifestAggregate, ManifestContext } from './document.cjs';
2
+ import { AggregateModel } from './model.cjs';
3
+ import { SchemaTypes } from './schemaTypes.cjs';
4
+ import { TextNumbers } from './textNumbers.cjs';
5
+ export declare function aggregateRoots(types: SchemaTypes, aggregate: ManifestAggregate): string[];
6
+ export declare function aggregateModel(types: SchemaTypes, numbers: TextNumbers, context: ManifestContext, aggregate: ManifestAggregate): AggregateModel;
@@ -0,0 +1,6 @@
1
+ import { ManifestAggregate, ManifestContext } from './document.js';
2
+ import { AggregateModel } from './model.js';
3
+ import { SchemaTypes } from './schemaTypes.js';
4
+ import { TextNumbers } from './textNumbers.js';
5
+ export declare function aggregateRoots(types: SchemaTypes, aggregate: ManifestAggregate): string[];
6
+ export declare function aggregateModel(types: SchemaTypes, numbers: TextNumbers, context: ManifestContext, aggregate: ManifestAggregate): AggregateModel;
@@ -1,190 +1,5 @@
1
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
- /** 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.cjs';
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