@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
package/README.md CHANGED
@@ -31,7 +31,8 @@ clients), and, for a context with routes of its own, `routes.ts`
31
31
  - `aggregate.ts`: the aggregate's descriptor, its state fields and its event
32
32
  union;
33
33
  - `commandClient.ts`: `<Aggregate>CommandClient`, a method per command and a
34
- `…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;
35
36
  - `queryClient.ts`: `<Aggregate>SnapshotQueryClient`,
36
37
  `<Aggregate>EventQueryClient` and `<Aggregate>StateClient`.
37
38
 
package/README.zh-CN.md CHANGED
@@ -25,7 +25,7 @@ pnpm exec wow-generator generate \
25
25
  上下文还有 `routes.ts`(`<Context>Routes`);每个聚合写出:
26
26
 
27
27
  - `aggregate.ts`:聚合的描述、状态字段与事件联合类型;
28
- - `commandClient.ts`:`<Aggregate>CommandClient`,每条命令一个方法,另有按等待的每个节点逐个返回结果的 `…Stream` 方法;
28
+ - `commandClient.ts`:`<Aggregate>CommandClient`,每条命令一个方法,另有按等待的每个节点逐个返回结果的 `…Stream` 方法;公开端口不提供的内部命令(`"internal": true`)没有方法;
29
29
  - `queryClient.ts`:`<Aggregate>SnapshotQueryClient`、`<Aggregate>EventQueryClient` 与 `<Aggregate>StateClient`。
30
30
 
31
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-CADTvm2G.cjs");let t=require("path"),n=require("commander");var r=`10.0.0-beta.1`;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=`
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.2`;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-Cxlr_VOh.js";
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-beta.1";
6
+ var u = "10.0.0-beta.2";
7
7
  // src/cli/runGenerate.ts
8
8
  function d(e) {
9
9
  if (!e) return !1;