@ahoo-wang/wow-generator 10.0.0-alpha.7 → 10.0.0-beta.10
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 +7 -4
- package/README.zh-CN.md +5 -3
- 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.js +2 -2
- package/dist/{codeGenerator-Bouc_Ad8.js → codeGenerator-CXowDsB9.js} +1216 -842
- 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 -176
- package/dist/manifest/analyze.d.ts +1 -176
- 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 +22 -14
- package/dist/codeGenerator-Bouc_Ad8.js.map +0 -1
- package/dist/codeGenerator-C0dKAKl6.cjs +0 -37
- package/dist/codeGenerator-C0dKAKl6.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -22,14 +22,17 @@ pnpm exec wow-generator generate \
|
|
|
22
22
|
|
|
23
23
|
For each bounded context it writes `types.ts` (the command, event and state
|
|
24
24
|
types of the Manifest's schemas), `contract.ts` (`<Context>Contract`: its name,
|
|
25
|
-
error codes and aggregates, and its wait hops)
|
|
26
|
-
(`<Context>
|
|
27
|
-
aggregate
|
|
25
|
+
error codes and aggregates, and its wait hops), `manifest.ts`
|
|
26
|
+
(`<Context>Manifest`: the routes its clients send by, so they fetch no Manifest),
|
|
27
|
+
`client.ts` (`<Context>Client`: its `CommandClient` and every aggregate's
|
|
28
|
+
clients), and, for a context with routes of its own, `routes.ts`
|
|
29
|
+
(`<Context>Routes`); and for each aggregate:
|
|
28
30
|
|
|
29
31
|
- `aggregate.ts`: the aggregate's descriptor, its state fields and its event
|
|
30
32
|
union;
|
|
31
33
|
- `commandClient.ts`: `<Aggregate>CommandClient`, a method per command and a
|
|
32
|
-
`…Stream` twin that answers one result per hop of the wait;
|
|
34
|
+
`…Stream` twin that answers one result per hop of the wait; an internal
|
|
35
|
+
command (`"internal": true`), which the public port does not serve, has none;
|
|
33
36
|
- `queryClient.ts`: `<Aggregate>SnapshotQueryClient`,
|
|
34
37
|
`<Aggregate>EventQueryClient` and `<Aggregate>StateClient`.
|
|
35
38
|
|
package/README.zh-CN.md
CHANGED
|
@@ -19,11 +19,13 @@ pnpm exec wow-generator generate \
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
每个限界上下文写出 `types.ts`(Manifest 中 schema 对应的命令、事件与状态类型)、
|
|
22
|
-
`contract.ts`(`<Context>Contract
|
|
23
|
-
`
|
|
22
|
+
`contract.ts`(`<Context>Contract`:上下文名、错误码与各聚合,以及等待节点)、
|
|
23
|
+
`manifest.ts`(`<Context>Manifest`:客户端发送所按的路由,所以它们不拉取 Manifest)、
|
|
24
|
+
`client.ts`(`<Context>Client`:它的 `CommandClient` 与每个聚合的客户端),对有自己路由的
|
|
25
|
+
上下文还有 `routes.ts`(`<Context>Routes`);每个聚合写出:
|
|
24
26
|
|
|
25
27
|
- `aggregate.ts`:聚合的描述、状态字段与事件联合类型;
|
|
26
|
-
- `commandClient.ts`:`<Aggregate>CommandClient`,每条命令一个方法,另有按等待的每个节点逐个返回结果的 `…Stream`
|
|
28
|
+
- `commandClient.ts`:`<Aggregate>CommandClient`,每条命令一个方法,另有按等待的每个节点逐个返回结果的 `…Stream` 方法;公开端口不提供的内部命令(`"internal": true`)没有方法;
|
|
27
29
|
- `queryClient.ts`:`<Aggregate>SnapshotQueryClient`、`<Aggregate>EventQueryClient` 与 `<Aggregate>StateClient`。
|
|
28
30
|
|
|
29
31
|
<!-- typecheck-generated: examples/eshop/web/src/generated/basket -->
|
|
@@ -24,12 +24,3 @@ export declare const OPERATION_METHOD_NAME_KEY = "x-fetcher-method";
|
|
|
24
24
|
* @throws GeneratorError when a configured or extension name is not a valid method name
|
|
25
25
|
*/
|
|
26
26
|
export declare function resolveMethodName(operation: Operation, configured?: string): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Turns a parameter name from the document into a unique parameter
|
|
29
|
-
* identifier: `item-id` → `itemId`, and `id` twice → `id`, `id2`.
|
|
30
|
-
*
|
|
31
|
-
* @param name - The name the document uses
|
|
32
|
-
* @param used - The identifiers the method already uses; updated
|
|
33
|
-
* @returns The identifier
|
|
34
|
-
*/
|
|
35
|
-
export declare function uniqueParameterName(name: string, used: Set<string>): string;
|
|
@@ -24,12 +24,3 @@ export declare const OPERATION_METHOD_NAME_KEY = "x-fetcher-method";
|
|
|
24
24
|
* @throws GeneratorError when a configured or extension name is not a valid method name
|
|
25
25
|
*/
|
|
26
26
|
export declare function resolveMethodName(operation: Operation, configured?: string): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Turns a parameter name from the document into a unique parameter
|
|
29
|
-
* identifier: `item-id` → `itemId`, and `id` twice → `id`, `id2`.
|
|
30
|
-
*
|
|
31
|
-
* @param name - The name the document uses
|
|
32
|
-
* @param used - The identifiers the method already uses; updated
|
|
33
|
-
* @returns The identifier
|
|
34
|
-
*/
|
|
35
|
-
export declare function uniqueParameterName(name: string, used: Set<string>): string;
|
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./codeGenerator-
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./codeGenerator-q59QJpfT.cjs");let t=require("path"),n=require("commander");var r=`10.0.0-beta.10`;function i(e){if(!e)return!1;let t;try{t=new URL(e)}catch{return!0}return/^[a-z]:$/i.test(t.protocol)?!0:t.protocol===`http:`||t.protocol===`https:`}function a(t=[]){let n={};for(let r of t){let t=r.indexOf(`:`),i=t>0?r.slice(0,t).trim():``;if(!i)throw new e.s(`input`,`Invalid --header "${r}": expected "Name: value".`);n[i]=r.slice(t+1).trim()}return n}function o(t){if(t===void 0)return;let n=Number(t);if(!Number.isInteger(n)||n<=0)throw new e.s(`input`,`Invalid --timeout "${t}": expected a positive number of milliseconds.`);return n}function s(t){if(t===void 0||t===`summary`)return`summary`;if(t===`full`)return`full`;throw new e.s(`input`,`Invalid --schema-docs "${t}": expected "summary" or "full".`)}function c(e){return e.verbose?`verbose`:e.quiet?`quiet`:`normal`}function l(t,n,r){if(n instanceof e.s)return t.error(n.message),r&&n.cause!==void 0&&t.error(`Caused by:`,n.cause),n.exitCode;let i=n instanceof Error?n.message:String(n);return t.error(`Code generation failed: ${i}`),r?t.error(``,n):t.error(`Rerun with --verbose for the stack trace, and report it at https://github.com/Ahoo-Wang/Wow/issues if the input is valid.`),e.o.internal}async function u(n,u=new e.i({level:c(n)}),d={}){if(!i(n.input))return u.error(`Invalid input "${n.input}": expected a file path or an http(s) URL.`),e.o.input;try{u.debug(`wow-generator v${r}`);let i={...d,inputPath:n.input,outputDir:n.output,configPath:n.config,tsConfigFilePath:n.tsConfigFilePath,headers:a(n.header),timeoutMs:o(n.timeout),schemaDocs:s(n.schemaDocs),logger:u},c=await new e.t(i).generate(),l=c.warnings?`, ${c.warnings} warning${c.warnings===1?``:`s`}`:``,f=c.configPath?` with ${(0,t.relative)(process.cwd(),c.configPath)||c.configPath}`:``;return u.info(`Generated ${c.files.length} files into ${n.output}${f}${l}`),n.strict&&c.warnings>0?(u.error(`--strict: the run logged ${c.warnings} warning${c.warnings===1?``:`s`}.`),e.o.specification):e.o.success}catch(t){return d[e.n]?.aborted?e.o.interrupted:l(u,t,!!n.verbose)}}async function d(t){let n=new AbortController;process.once(`SIGINT`,()=>{console.error(`Generation interrupted by user`),n.abort()}),process.exitCode=await u(t,void 0,{[e.n]:n.signal})}var f=`
|
|
3
3
|
Exit codes:
|
|
4
4
|
${e.o.success} generated; or --help, help or --version printed
|
|
5
5
|
${e.o.internal} internal error; rerun with --verbose for the stack trace
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as e, i as t, n, o as r, r as i, s as a, t as o } from "./codeGenerator-
|
|
2
|
+
import { c as e, i as t, n, o as r, r as i, s as a, t as o } from "./codeGenerator-CXowDsB9.js";
|
|
3
3
|
import { relative as s } from "path";
|
|
4
4
|
import { CommanderError as c, program as l } from "commander";
|
|
5
5
|
// src/version.ts
|
|
6
|
-
var u = "10.0.0-
|
|
6
|
+
var u = "10.0.0-beta.10";
|
|
7
7
|
// src/cli/runGenerate.ts
|
|
8
8
|
function d(e) {
|
|
9
9
|
if (!e) return !1;
|