@soapjs/cli 1.0.0

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 (149) hide show
  1. package/.nvmrc +1 -0
  2. package/LICENSE +21 -0
  3. package/README.md +360 -0
  4. package/build/cli.d.ts +3 -0
  5. package/build/cli.js +50 -0
  6. package/build/commands/add/add.command.d.ts +2 -0
  7. package/build/commands/add/add.command.js +709 -0
  8. package/build/commands/add/command-plan.d.ts +15 -0
  9. package/build/commands/add/command-plan.js +182 -0
  10. package/build/commands/add/entity-plan.d.ts +7 -0
  11. package/build/commands/add/entity-plan.js +106 -0
  12. package/build/commands/add/event-plan.d.ts +8 -0
  13. package/build/commands/add/event-plan.js +59 -0
  14. package/build/commands/add/query-plan.d.ts +10 -0
  15. package/build/commands/add/query-plan.js +156 -0
  16. package/build/commands/add/repository-plan.d.ts +11 -0
  17. package/build/commands/add/repository-plan.js +252 -0
  18. package/build/commands/add/resource-plan.d.ts +52 -0
  19. package/build/commands/add/resource-plan.js +2031 -0
  20. package/build/commands/add/route-plan.d.ts +24 -0
  21. package/build/commands/add/route-plan.js +256 -0
  22. package/build/commands/add/socket-plan.d.ts +9 -0
  23. package/build/commands/add/socket-plan.js +81 -0
  24. package/build/commands/add/use-case-plan.d.ts +7 -0
  25. package/build/commands/add/use-case-plan.js +86 -0
  26. package/build/commands/check/check.command.d.ts +2 -0
  27. package/build/commands/check/check.command.js +113 -0
  28. package/build/commands/create/create.command.d.ts +2 -0
  29. package/build/commands/create/create.command.js +234 -0
  30. package/build/commands/create/project-plan.d.ts +44 -0
  31. package/build/commands/create/project-plan.js +1430 -0
  32. package/build/commands/doctor/doctor.command.d.ts +2 -0
  33. package/build/commands/doctor/doctor.command.js +38 -0
  34. package/build/commands/generate/bruno-analysis.d.ts +19 -0
  35. package/build/commands/generate/bruno-analysis.js +51 -0
  36. package/build/commands/generate/bruno-plan.d.ts +6 -0
  37. package/build/commands/generate/bruno-plan.js +326 -0
  38. package/build/commands/generate/generate.command.d.ts +2 -0
  39. package/build/commands/generate/generate.command.js +130 -0
  40. package/build/commands/info/info.command.d.ts +2 -0
  41. package/build/commands/info/info.command.js +26 -0
  42. package/build/commands/remove/remove.command.d.ts +2 -0
  43. package/build/commands/remove/remove.command.js +328 -0
  44. package/build/commands/shared/common-options.d.ts +10 -0
  45. package/build/commands/shared/common-options.js +23 -0
  46. package/build/commands/update/update.command.d.ts +2 -0
  47. package/build/commands/update/update.command.js +155 -0
  48. package/build/config/auth-policy.d.ts +4 -0
  49. package/build/config/auth-policy.js +54 -0
  50. package/build/config/find-soap-root.d.ts +1 -0
  51. package/build/config/find-soap-root.js +22 -0
  52. package/build/config/load-soap-config.d.ts +2 -0
  53. package/build/config/load-soap-config.js +30 -0
  54. package/build/config/schemas/types.d.ts +127 -0
  55. package/build/config/schemas/types.js +2 -0
  56. package/build/config/schemas/validation.d.ts +5 -0
  57. package/build/config/schemas/validation.js +130 -0
  58. package/build/config/soap-config.service.d.ts +4 -0
  59. package/build/config/soap-config.service.js +24 -0
  60. package/build/config/write-soap-config.d.ts +8 -0
  61. package/build/config/write-soap-config.js +25 -0
  62. package/build/core/command-context.d.ts +20 -0
  63. package/build/core/command-context.js +30 -0
  64. package/build/core/errors.d.ts +6 -0
  65. package/build/core/errors.js +23 -0
  66. package/build/core/output.d.ts +12 -0
  67. package/build/core/output.js +30 -0
  68. package/build/core/result.d.ts +9 -0
  69. package/build/core/result.js +11 -0
  70. package/build/dependencies/dependency-resolver.d.ts +6 -0
  71. package/build/dependencies/dependency-resolver.js +68 -0
  72. package/build/dependencies/package-manager.d.ts +7 -0
  73. package/build/dependencies/package-manager.js +54 -0
  74. package/build/index.d.ts +2 -0
  75. package/build/index.js +9 -0
  76. package/build/io/conflict-policy.d.ts +10 -0
  77. package/build/io/conflict-policy.js +32 -0
  78. package/build/io/file-writer.d.ts +19 -0
  79. package/build/io/file-writer.js +65 -0
  80. package/build/io/format-file.d.ts +1 -0
  81. package/build/io/format-file.js +13 -0
  82. package/build/presets/create-presets.d.ts +4 -0
  83. package/build/presets/create-presets.js +97 -0
  84. package/build/presets/index.d.ts +2 -0
  85. package/build/presets/index.js +18 -0
  86. package/build/presets/preset.types.d.ts +6 -0
  87. package/build/presets/preset.types.js +2 -0
  88. package/build/prompts/add-resource.prompt.d.ts +13 -0
  89. package/build/prompts/add-resource.prompt.js +80 -0
  90. package/build/prompts/add-route.prompt.d.ts +16 -0
  91. package/build/prompts/add-route.prompt.js +140 -0
  92. package/build/prompts/create-project.prompt.d.ts +11 -0
  93. package/build/prompts/create-project.prompt.js +156 -0
  94. package/build/prompts/generate-bruno.prompt.d.ts +7 -0
  95. package/build/prompts/generate-bruno.prompt.js +21 -0
  96. package/build/prompts/index.d.ts +8 -0
  97. package/build/prompts/index.js +24 -0
  98. package/build/prompts/inquirer-prompt-adapter.d.ts +8 -0
  99. package/build/prompts/inquirer-prompt-adapter.js +52 -0
  100. package/build/prompts/mock-prompt-adapter.d.ts +13 -0
  101. package/build/prompts/mock-prompt-adapter.js +60 -0
  102. package/build/prompts/prompt-adapter.d.ts +7 -0
  103. package/build/prompts/prompt-adapter.js +2 -0
  104. package/build/prompts/prompt.types.d.ts +26 -0
  105. package/build/prompts/prompt.types.js +2 -0
  106. package/build/registry/registry.service.d.ts +19 -0
  107. package/build/registry/registry.service.js +68 -0
  108. package/build/resolvers/add-resource.resolver.d.ts +23 -0
  109. package/build/resolvers/add-resource.resolver.js +73 -0
  110. package/build/resolvers/add-route.resolver.d.ts +34 -0
  111. package/build/resolvers/add-route.resolver.js +83 -0
  112. package/build/resolvers/create-config.resolver.d.ts +32 -0
  113. package/build/resolvers/create-config.resolver.js +57 -0
  114. package/build/resolvers/generate-bruno.resolver.d.ts +17 -0
  115. package/build/resolvers/generate-bruno.resolver.js +23 -0
  116. package/build/resolvers/index.d.ts +5 -0
  117. package/build/resolvers/index.js +21 -0
  118. package/build/resolvers/resolver.types.d.ts +8 -0
  119. package/build/resolvers/resolver.types.js +2 -0
  120. package/build/summary/create-summary.d.ts +2 -0
  121. package/build/summary/create-summary.js +24 -0
  122. package/build/summary/index.d.ts +1 -0
  123. package/build/summary/index.js +17 -0
  124. package/build/templates/naming.d.ts +11 -0
  125. package/build/templates/naming.js +30 -0
  126. package/build/templates/template-context.d.ts +6 -0
  127. package/build/templates/template-context.js +2 -0
  128. package/build/templates/template-engine.d.ts +1 -0
  129. package/build/templates/template-engine.js +10 -0
  130. package/build/templates/template-resolver.d.ts +2 -0
  131. package/build/templates/template-resolver.js +17 -0
  132. package/build/terminal/terminal-capabilities.d.ts +6 -0
  133. package/build/terminal/terminal-capabilities.js +14 -0
  134. package/docs/adr/0001-soap-cli-project-aware-generator.md +108 -0
  135. package/docs/cli/add-resource.md +127 -0
  136. package/docs/cli/add-route.md +79 -0
  137. package/docs/cli/bruno.md +58 -0
  138. package/docs/cli/create.md +73 -0
  139. package/docs/cli/index.md +92 -0
  140. package/docs/cli/interactive-mode.md +61 -0
  141. package/docs/cli/remove.md +45 -0
  142. package/docs/guides/auth.md +90 -0
  143. package/docs/guides/cqrs-events-realtime.md +100 -0
  144. package/docs/guides/index.md +24 -0
  145. package/docs/guides/quality-and-safety.md +88 -0
  146. package/docs/guides/regular-api.md +119 -0
  147. package/docs/guides/storage.md +101 -0
  148. package/docs/plans/interactive-mode-plan.md +601 -0
  149. package/package.json +44 -0
@@ -0,0 +1,119 @@
1
+ # Guide: Regular CRUD API
2
+
3
+ Use this path for a conventional Express service with generated CRUD routes, storage, route contracts, tests, Bruno, and OpenAPI.
4
+
5
+ ## Create The Project
6
+
7
+ ```bash
8
+ soap create billing-api \
9
+ --db postgres \
10
+ --auth jwt \
11
+ --docs openapi \
12
+ --contracts zod \
13
+ --api-client bruno \
14
+ --install \
15
+ --git-init
16
+ ```
17
+
18
+ Interactive equivalent:
19
+
20
+ ```bash
21
+ soap create billing-api -i
22
+ ```
23
+
24
+ In interactive mode, select:
25
+
26
+ - architecture: `regular`
27
+ - database: `postgres`
28
+ - auth: `jwt`
29
+ - docs: `openapi`
30
+ - contracts: `zod`
31
+ - API client: `bruno`
32
+ - install dependencies: yes when wanted
33
+ - git init: yes only when you want a new local repository
34
+
35
+ ## Run The Service
36
+
37
+ ```bash
38
+ cd billing-api
39
+ npm run build
40
+ npm test
41
+ npm start
42
+ ```
43
+
44
+ Health check:
45
+
46
+ ```bash
47
+ curl http://localhost:3000/health
48
+ ```
49
+
50
+ ## Add A CRUD Resource
51
+
52
+ ```bash
53
+ soap add resource invoice \
54
+ --crud \
55
+ --db postgres \
56
+ --auth jwt \
57
+ --zone private \
58
+ --field number:string \
59
+ --field total:number \
60
+ --field paid:boolean:optional \
61
+ --bruno
62
+ ```
63
+
64
+ Generated output includes:
65
+
66
+ - domain entity and entity spec
67
+ - repository port
68
+ - in-memory repository and repository spec
69
+ - Postgres SQL repository
70
+ - CRUD use-cases and use-case specs
71
+ - route contracts
72
+ - route controllers
73
+ - resource setup registration
74
+ - Bruno requests when Bruno is enabled
75
+
76
+ ## Add A Custom Route
77
+
78
+ ```bash
79
+ soap add route invoice approve \
80
+ --method post \
81
+ --path :id/approve \
82
+ --auth jwt \
83
+ --zone private \
84
+ --policy custom:invoice-approver \
85
+ --bruno
86
+ ```
87
+
88
+ Route paths are scoped under the resource path. The example generates `/invoices/:id/approve`.
89
+
90
+ ## Validate Generated Metadata
91
+
92
+ ```bash
93
+ soap info
94
+ soap doctor
95
+ soap check routes
96
+ ```
97
+
98
+ Run these after adding or removing resources/routes.
99
+
100
+ ## Refresh API Artifacts
101
+
102
+ ```bash
103
+ soap generate bruno
104
+ soap generate bruno --e2e
105
+ soap generate openapi --output openapi.json
106
+ ```
107
+
108
+ `generate openapi` expects the service to be running.
109
+
110
+ ## Safe Removal
111
+
112
+ ```bash
113
+ soap remove route invoice approve
114
+ soap remove resource invoice --dry-run
115
+ soap remove resource invoice
116
+ ```
117
+
118
+ Modified generated files are skipped unless you use `--force` or `--on-conflict overwrite`.
119
+
@@ -0,0 +1,101 @@
1
+ # Guide: Storage Capabilities
2
+
3
+ Storage capabilities affect generated dependencies, config, Docker services, and resource repository templates.
4
+
5
+ ## Supported Storage
6
+
7
+ | Capability | Project infra | Resource repository |
8
+ | --- | --- | --- |
9
+ | `none` | no external service | in-memory |
10
+ | `mongo` | Mongo client, config, Docker service | Mongo repository |
11
+ | `postgres` | SQL client, config, Docker service | SQL repository |
12
+ | `mysql` | SQL client, config, Docker service | SQL repository |
13
+ | `sqlite` | SQL client, local filename config | SQL repository |
14
+ | `redis` | Redis client/config/Docker service | infrastructure only |
15
+
16
+ Redis is currently infrastructure-only for resources. Do not pass `--db redis` to resource generation expecting a Redis repository template.
17
+
18
+ ## Create With Storage
19
+
20
+ ```bash
21
+ soap create data-api --db postgres --install
22
+ soap create data-api --db mysql --db sqlite --skip-install
23
+ soap create data-api --db mongo --db redis --skip-install
24
+ ```
25
+
26
+ ## Add Storage Later
27
+
28
+ ```bash
29
+ soap update config --add-db postgres
30
+ soap update config --add-db mysql
31
+ soap update config --add-db sqlite
32
+ soap update config --add-db redis
33
+ ```
34
+
35
+ `update config` is add-only.
36
+
37
+ ## Add Resources With Storage
38
+
39
+ ```bash
40
+ soap add resource invoice --crud --db postgres
41
+ soap add resource invoice --crud --db mysql
42
+ soap add resource note --crud --db sqlite
43
+ soap add resource customer --crud --db mongo
44
+ soap add resource task --crud --db none
45
+ ```
46
+
47
+ Generated SQL repositories use the same repository template with adapter-specific config:
48
+
49
+ - PostgreSQL uses `$1`, `$2` placeholders.
50
+ - MySQL and SQLite use `?` placeholders.
51
+
52
+ ## Environment Variables
53
+
54
+ PostgreSQL:
55
+
56
+ ```txt
57
+ POSTGRES_HOST=localhost
58
+ POSTGRES_PORT=5432
59
+ POSTGRES_DB=app
60
+ POSTGRES_USER=app
61
+ POSTGRES_PASSWORD=app
62
+ ```
63
+
64
+ MySQL:
65
+
66
+ ```txt
67
+ MYSQL_HOST=localhost
68
+ MYSQL_PORT=3306
69
+ MYSQL_DATABASE=app
70
+ MYSQL_USER=app
71
+ MYSQL_PASSWORD=app
72
+ ```
73
+
74
+ SQLite:
75
+
76
+ ```txt
77
+ SQLITE_FILENAME=./data/app.sqlite
78
+ ```
79
+
80
+ Mongo:
81
+
82
+ ```txt
83
+ MONGO_URI=mongodb://localhost:27017/app
84
+ ```
85
+
86
+ Redis:
87
+
88
+ ```txt
89
+ REDIS_URL=redis://localhost:6379
90
+ ```
91
+
92
+ ## Docker
93
+
94
+ ```bash
95
+ make up
96
+ make logs
97
+ make down
98
+ ```
99
+
100
+ Generated Docker Compose includes services for Mongo, Postgres, MySQL, Redis, and Kafka/Redpanda when those capabilities are enabled.
101
+