@lambdaorm/cli 1.4.9

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 (240) hide show
  1. package/LICENSE/home/runner/work/core/core/LICENSE +9 -0
  2. package/README.md +337 -0
  3. package/application/cli.d.ts +17 -0
  4. package/application/cli.d.ts.map +1 -0
  5. package/application/cli.js +22 -0
  6. package/application/cli.js.map +1 -0
  7. package/application/helper.d.ts +16 -0
  8. package/application/helper.d.ts.map +1 -0
  9. package/application/helper.js +51 -0
  10. package/application/helper.js.map +1 -0
  11. package/application/index.d.ts +28 -0
  12. package/application/index.d.ts.map +1 -0
  13. package/application/index.js +44 -0
  14. package/application/index.js.map +1 -0
  15. package/application/ports/language.d.ts +7 -0
  16. package/application/ports/language.d.ts.map +1 -0
  17. package/application/ports/language.js +3 -0
  18. package/application/ports/language.js.map +1 -0
  19. package/application/ports/orm.d.ts +97 -0
  20. package/application/ports/orm.d.ts.map +1 -0
  21. package/application/ports/orm.js +3 -0
  22. package/application/ports/orm.js.map +1 -0
  23. package/application/ports/workspace.d.ts +8 -0
  24. package/application/ports/workspace.d.ts.map +1 -0
  25. package/application/ports/workspace.js +3 -0
  26. package/application/ports/workspace.js.map +1 -0
  27. package/application/services/languages.d.ts +8 -0
  28. package/application/services/languages.d.ts.map +1 -0
  29. package/application/services/languages.js +21 -0
  30. package/application/services/languages.js.map +1 -0
  31. package/application/services/outputService.d.ts +6 -0
  32. package/application/services/outputService.d.ts.map +1 -0
  33. package/application/services/outputService.js +48 -0
  34. package/application/services/outputService.js.map +1 -0
  35. package/application/useCases/build.d.ts +8 -0
  36. package/application/useCases/build.d.ts.map +1 -0
  37. package/application/useCases/build.js +20 -0
  38. package/application/useCases/build.js.map +1 -0
  39. package/application/useCases/constraints.d.ts +7 -0
  40. package/application/useCases/constraints.d.ts.map +1 -0
  41. package/application/useCases/constraints.js +29 -0
  42. package/application/useCases/constraints.js.map +1 -0
  43. package/application/useCases/drop.d.ts +7 -0
  44. package/application/useCases/drop.d.ts.map +1 -0
  45. package/application/useCases/drop.js +27 -0
  46. package/application/useCases/drop.js.map +1 -0
  47. package/application/useCases/execute.d.ts +7 -0
  48. package/application/useCases/execute.d.ts.map +1 -0
  49. package/application/useCases/execute.js +31 -0
  50. package/application/useCases/execute.js.map +1 -0
  51. package/application/useCases/export.d.ts +7 -0
  52. package/application/useCases/export.d.ts.map +1 -0
  53. package/application/useCases/export.js +31 -0
  54. package/application/useCases/export.js.map +1 -0
  55. package/application/useCases/fetch.d.ts +7 -0
  56. package/application/useCases/fetch.d.ts.map +1 -0
  57. package/application/useCases/fetch.js +26 -0
  58. package/application/useCases/fetch.js.map +1 -0
  59. package/application/useCases/import.d.ts +7 -0
  60. package/application/useCases/import.d.ts.map +1 -0
  61. package/application/useCases/import.js +30 -0
  62. package/application/useCases/import.js.map +1 -0
  63. package/application/useCases/incorporate.d.ts +7 -0
  64. package/application/useCases/incorporate.d.ts.map +1 -0
  65. package/application/useCases/incorporate.js +31 -0
  66. package/application/useCases/incorporate.js.map +1 -0
  67. package/application/useCases/init.d.ts +8 -0
  68. package/application/useCases/init.d.ts.map +1 -0
  69. package/application/useCases/init.js +15 -0
  70. package/application/useCases/init.js.map +1 -0
  71. package/application/useCases/introspect.d.ts +7 -0
  72. package/application/useCases/introspect.d.ts.map +1 -0
  73. package/application/useCases/introspect.js +31 -0
  74. package/application/useCases/introspect.js.map +1 -0
  75. package/application/useCases/metadata.d.ts +7 -0
  76. package/application/useCases/metadata.d.ts.map +1 -0
  77. package/application/useCases/metadata.js +29 -0
  78. package/application/useCases/metadata.js.map +1 -0
  79. package/application/useCases/model.d.ts +7 -0
  80. package/application/useCases/model.d.ts.map +1 -0
  81. package/application/useCases/model.js +29 -0
  82. package/application/useCases/model.js.map +1 -0
  83. package/application/useCases/parameters.d.ts +7 -0
  84. package/application/useCases/parameters.d.ts.map +1 -0
  85. package/application/useCases/parameters.js +29 -0
  86. package/application/useCases/parameters.js.map +1 -0
  87. package/application/useCases/plan.d.ts +7 -0
  88. package/application/useCases/plan.d.ts.map +1 -0
  89. package/application/useCases/plan.js +30 -0
  90. package/application/useCases/plan.js.map +1 -0
  91. package/application/useCases/pull.d.ts +7 -0
  92. package/application/useCases/pull.d.ts.map +1 -0
  93. package/application/useCases/pull.js +26 -0
  94. package/application/useCases/pull.js.map +1 -0
  95. package/application/useCases/push.d.ts +7 -0
  96. package/application/useCases/push.d.ts.map +1 -0
  97. package/application/useCases/push.js +27 -0
  98. package/application/useCases/push.js.map +1 -0
  99. package/application/useCases/schema.d.ts +7 -0
  100. package/application/useCases/schema.d.ts.map +1 -0
  101. package/application/useCases/schema.js +83 -0
  102. package/application/useCases/schema.js.map +1 -0
  103. package/application/useCases/version.d.ts +7 -0
  104. package/application/useCases/version.d.ts.map +1 -0
  105. package/application/useCases/version.js +15 -0
  106. package/application/useCases/version.js.map +1 -0
  107. package/application/useCases/versionGlobal.d.ts +7 -0
  108. package/application/useCases/versionGlobal.d.ts.map +1 -0
  109. package/application/useCases/versionGlobal.js +14 -0
  110. package/application/useCases/versionGlobal.js.map +1 -0
  111. package/doc.index.d.ts +2 -0
  112. package/doc.index.d.ts.map +1 -0
  113. package/doc.index.js +18 -0
  114. package/doc.index.js.map +1 -0
  115. package/index.d.ts +3 -0
  116. package/index.d.ts.map +1 -0
  117. package/index.js +39 -0
  118. package/index.js.map +1 -0
  119. package/infrastructure/builders/facade.d.ts +6 -0
  120. package/infrastructure/builders/facade.d.ts.map +1 -0
  121. package/infrastructure/builders/facade.js +31 -0
  122. package/infrastructure/builders/facade.js.map +1 -0
  123. package/infrastructure/builders/usesCases.d.ts +21 -0
  124. package/infrastructure/builders/usesCases.d.ts.map +1 -0
  125. package/infrastructure/builders/usesCases.js +26 -0
  126. package/infrastructure/builders/usesCases.js.map +1 -0
  127. package/infrastructure/command/build.d.ts +26 -0
  128. package/infrastructure/command/build.d.ts.map +1 -0
  129. package/infrastructure/command/build.js +82 -0
  130. package/infrastructure/command/build.js.map +1 -0
  131. package/infrastructure/command/constraints.d.ts +18 -0
  132. package/infrastructure/command/constraints.d.ts.map +1 -0
  133. package/infrastructure/command/constraints.js +57 -0
  134. package/infrastructure/command/constraints.js.map +1 -0
  135. package/infrastructure/command/drop.d.ts +20 -0
  136. package/infrastructure/command/drop.d.ts.map +1 -0
  137. package/infrastructure/command/drop.js +66 -0
  138. package/infrastructure/command/drop.js.map +1 -0
  139. package/infrastructure/command/execute.d.ts +22 -0
  140. package/infrastructure/command/execute.d.ts.map +1 -0
  141. package/infrastructure/command/execute.js +67 -0
  142. package/infrastructure/command/execute.js.map +1 -0
  143. package/infrastructure/command/export.d.ts +20 -0
  144. package/infrastructure/command/export.d.ts.map +1 -0
  145. package/infrastructure/command/export.js +56 -0
  146. package/infrastructure/command/export.js.map +1 -0
  147. package/infrastructure/command/fetch.d.ts +18 -0
  148. package/infrastructure/command/fetch.d.ts.map +1 -0
  149. package/infrastructure/command/fetch.js +51 -0
  150. package/infrastructure/command/fetch.js.map +1 -0
  151. package/infrastructure/command/import.d.ts +18 -0
  152. package/infrastructure/command/import.d.ts.map +1 -0
  153. package/infrastructure/command/import.js +52 -0
  154. package/infrastructure/command/import.js.map +1 -0
  155. package/infrastructure/command/incorporate.d.ts +20 -0
  156. package/infrastructure/command/incorporate.d.ts.map +1 -0
  157. package/infrastructure/command/incorporate.js +56 -0
  158. package/infrastructure/command/incorporate.js.map +1 -0
  159. package/infrastructure/command/init.d.ts +20 -0
  160. package/infrastructure/command/init.d.ts.map +1 -0
  161. package/infrastructure/command/init.js +58 -0
  162. package/infrastructure/command/init.js.map +1 -0
  163. package/infrastructure/command/introspect.d.ts +20 -0
  164. package/infrastructure/command/introspect.d.ts.map +1 -0
  165. package/infrastructure/command/introspect.js +56 -0
  166. package/infrastructure/command/introspect.js.map +1 -0
  167. package/infrastructure/command/metadata.d.ts +18 -0
  168. package/infrastructure/command/metadata.d.ts.map +1 -0
  169. package/infrastructure/command/metadata.js +57 -0
  170. package/infrastructure/command/metadata.js.map +1 -0
  171. package/infrastructure/command/model.d.ts +18 -0
  172. package/infrastructure/command/model.d.ts.map +1 -0
  173. package/infrastructure/command/model.js +57 -0
  174. package/infrastructure/command/model.js.map +1 -0
  175. package/infrastructure/command/parameters.d.ts +18 -0
  176. package/infrastructure/command/parameters.d.ts.map +1 -0
  177. package/infrastructure/command/parameters.js +57 -0
  178. package/infrastructure/command/parameters.js.map +1 -0
  179. package/infrastructure/command/plan.d.ts +20 -0
  180. package/infrastructure/command/plan.d.ts.map +1 -0
  181. package/infrastructure/command/plan.js +62 -0
  182. package/infrastructure/command/plan.js.map +1 -0
  183. package/infrastructure/command/pull.d.ts +16 -0
  184. package/infrastructure/command/pull.d.ts.map +1 -0
  185. package/infrastructure/command/pull.js +46 -0
  186. package/infrastructure/command/pull.js.map +1 -0
  187. package/infrastructure/command/push.d.ts +18 -0
  188. package/infrastructure/command/push.d.ts.map +1 -0
  189. package/infrastructure/command/push.js +51 -0
  190. package/infrastructure/command/push.js.map +1 -0
  191. package/infrastructure/command/schema.d.ts +18 -0
  192. package/infrastructure/command/schema.d.ts.map +1 -0
  193. package/infrastructure/command/schema.js +51 -0
  194. package/infrastructure/command/schema.js.map +1 -0
  195. package/infrastructure/command/version.d.ts +12 -0
  196. package/infrastructure/command/version.d.ts.map +1 -0
  197. package/infrastructure/command/version.js +42 -0
  198. package/infrastructure/command/version.js.map +1 -0
  199. package/infrastructure/index.d.ts +18 -0
  200. package/infrastructure/index.d.ts.map +1 -0
  201. package/infrastructure/index.js +34 -0
  202. package/infrastructure/index.js.map +1 -0
  203. package/infrastructure/languages/clientNode.d.ts +10 -0
  204. package/infrastructure/languages/clientNode.d.ts.map +1 -0
  205. package/infrastructure/languages/clientNode.js +95 -0
  206. package/infrastructure/languages/clientNode.js.map +1 -0
  207. package/infrastructure/languages/index.d.ts +3 -0
  208. package/infrastructure/languages/index.d.ts.map +1 -0
  209. package/infrastructure/languages/index.js +19 -0
  210. package/infrastructure/languages/index.js.map +1 -0
  211. package/infrastructure/languages/node.d.ts +55 -0
  212. package/infrastructure/languages/node.d.ts.map +1 -0
  213. package/infrastructure/languages/node.js +313 -0
  214. package/infrastructure/languages/node.js.map +1 -0
  215. package/infrastructure/orm/adapters/lib.d.ts +64 -0
  216. package/infrastructure/orm/adapters/lib.d.ts.map +1 -0
  217. package/infrastructure/orm/adapters/lib.js +166 -0
  218. package/infrastructure/orm/adapters/lib.js.map +1 -0
  219. package/infrastructure/orm/adapters/rest.d.ts +64 -0
  220. package/infrastructure/orm/adapters/rest.d.ts.map +1 -0
  221. package/infrastructure/orm/adapters/rest.js +191 -0
  222. package/infrastructure/orm/adapters/rest.js.map +1 -0
  223. package/infrastructure/orm/factory.d.ts +6 -0
  224. package/infrastructure/orm/factory.d.ts.map +1 -0
  225. package/infrastructure/orm/factory.js +18 -0
  226. package/infrastructure/orm/factory.js.map +1 -0
  227. package/infrastructure/workspace/adapters/client.d.ts +11 -0
  228. package/infrastructure/workspace/adapters/client.d.ts.map +1 -0
  229. package/infrastructure/workspace/adapters/client.js +38 -0
  230. package/infrastructure/workspace/adapters/client.js.map +1 -0
  231. package/infrastructure/workspace/adapters/local.d.ts +10 -0
  232. package/infrastructure/workspace/adapters/local.d.ts.map +1 -0
  233. package/infrastructure/workspace/adapters/local.js +26 -0
  234. package/infrastructure/workspace/adapters/local.js.map +1 -0
  235. package/infrastructure/workspace/factory.d.ts +9 -0
  236. package/infrastructure/workspace/factory.d.ts.map +1 -0
  237. package/infrastructure/workspace/factory.js +20 -0
  238. package/infrastructure/workspace/factory.js.map +1 -0
  239. package/jest-config.json +24 -0
  240. package/package.json +48 -0
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Flavio Lionel Rita <flaviolrita@proton.me>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,337 @@
1
+ # λORM CLI
2
+
3
+ λORM CLI is a command line application to use [λORM](https://www.npmjs.com/package/lambdaorm)
4
+
5
+ ## Installation
6
+
7
+ Install the package globally to use the CLI commands to help you create and maintain projects
8
+
9
+ ```sh
10
+ npm install lambdaorm-cli -g
11
+ ```
12
+
13
+ ## CLI
14
+
15
+ | Command | Description |
16
+ |:------------|:--------------------------------------------------------------------|
17
+ | version | Prints lambdaorm version this project uses. |
18
+ | init | Generates lambdaorm project structure. |
19
+ | push | Synchronize sources with schema |
20
+ | pull | Synchronize schema whit sources |
21
+ | fetch | Show differences the schema whit sources |
22
+ | introspect | Update schema with structure of data and push |
23
+ | incorporate | Update schema with structure of data, push and importa data |
24
+ | execute | Execute an expression lambda. |
25
+ | metadata | Return metadata of query expression. |
26
+ | parameters | Return parameters of query expression. |
27
+ | model | Return model of query expression. |
28
+ | plan | Return plan execution of query expression. |
29
+ | schema | Return schema information. |
30
+ | import | Import data from file to database. |
31
+ | export | Export data from a database. |
32
+ | build | add configuration, model and repositories according to the language.|
33
+ | drop | Removes all database objects but not the database. |
34
+
35
+ ## Usage
36
+
37
+ ### version
38
+
39
+ Prints lambdaorm version this project uses.
40
+
41
+ ```sh
42
+ lambdaorm version
43
+ ```
44
+
45
+ Result:
46
+
47
+ ```sh
48
+ Global lambdaorm cli version: 0.9.21
49
+ Local lambdaorm version: 0.8.96
50
+ ```
51
+
52
+ ### init
53
+
54
+ will create the project folder with the basic structure.
55
+
56
+ ```sh
57
+ lambdaorm init -w lab
58
+ ```
59
+
60
+ It will generate:
61
+
62
+ ```sh
63
+ ├── orm_state
64
+ └── lambdaORM.yaml
65
+ ```
66
+
67
+ ### init client node
68
+
69
+ will create the project folder with the basic structure.
70
+
71
+ ```sh
72
+ lambdaorm init -w client-lab -u http://localhost:9291
73
+ ```
74
+
75
+ It will generate:
76
+
77
+ ```sh
78
+ ├── orm_state
79
+ └── lambdaORM.yaml
80
+ ```
81
+
82
+ ### push
83
+
84
+ Synchronize Stage configured in lambdaORM schema with database/s.
85
+
86
+ ```sh
87
+ lambdaorm push
88
+ ```
89
+
90
+ In the case the default stage is associated with several data sources, it generates a file for each data source and a file with the current model.
91
+
92
+ ```sh
93
+ data
94
+ ├── default-ddl-20231201T191054280Z-push-Catalog.sql
95
+ ├── default-ddl-20231201T191054280Z-push-Crm.sql
96
+ ├── default-ddl-20231201T191054281Z-push-Ordering.json
97
+ ├── default-model.json
98
+ ```
99
+
100
+ ### execute
101
+
102
+ Execute an expression lambda.
103
+
104
+ ```sh
105
+ lambdaorm execute -e .env -q "Orders.filter(p => p.customerId == customerId).include(p => [p.customer.map(p => p.name), p.details.include(p => p.product.include(p => p.category.map(p => p.name)).map(p => p.name)).map(p => [p.quantity, p.unitPrice])]).page(1,1)" -d "{\"customerId\": \"HANAR\"}"
106
+ ```
107
+
108
+ Result:
109
+
110
+ ```json
111
+ [
112
+ {
113
+ "id": 3,
114
+ "customerId": "HANAR",
115
+ "employeeId": 4,
116
+ "orderDate": "1996-07-08T00:00:00.000+02:00",
117
+ "requiredDate": "1996-08-05",
118
+ "shippedDate": "1996-07-12",
119
+ "shipViaId": 2,
120
+ "freight": 65.83,
121
+ "name": "Hanari Carnes",
122
+ "address": "Rua do Pao, 67",
123
+ "city": "Rio de Janeiro",
124
+ "region": "RJ",
125
+ "postalCode": "05454-876",
126
+ "country": "Brazil",
127
+ "details": [
128
+ {
129
+ "quantity": 10,
130
+ "unitPrice": 7.7,
131
+ "product": {
132
+ "name": "Jack's New England Clam Chowder",
133
+ "category": {
134
+ "name": "Seafood"
135
+ }
136
+ }
137
+ },
138
+ {
139
+ "quantity": 35,
140
+ "unitPrice": 42.4,
141
+ "product": {
142
+ "name": "Manjimup Dried Apples",
143
+ "category": {
144
+ "name": "Produce"
145
+ }
146
+ }
147
+ },
148
+ {
149
+ "quantity": 15,
150
+ "unitPrice": 16.8,
151
+ "product": {
152
+ "name": "Louisiana Fiery Hot Pepper Sauce",
153
+ "category": {
154
+ "name": "Condiments"
155
+ }
156
+ }
157
+ }
158
+ ],
159
+ "customer": {
160
+ "name": "Hanari Carnes"
161
+ }
162
+ }
163
+ ]
164
+ ```
165
+
166
+ In this example:
167
+
168
+ - The .env file is used to obtain the environment variables.
169
+ - The lambda expression is used to obtain an order from the "HANAR" client.
170
+
171
+ ### Plan
172
+
173
+ Return plan execution of query expression.
174
+
175
+ ```sh
176
+ lambdaorm plan -e .env -s default -q "Orders.filter(p => p.customerId == customerId).include(p => p.customer.map(p => p.name)).order(p=> p.id).page(1,1)" -o beautiful
177
+ ```
178
+
179
+ Result:
180
+
181
+ ```json
182
+ {
183
+ "entity": "Orders",
184
+ "dialect": "MongoDB",
185
+ "source": "Ordering",
186
+ "sentence": "[{ \"$match\" : { \"CustomerID\":{{customerId}} } }, { \"$project\" :{ \"_id\": 0 , \"id\":\"$_id\", \"customerId\":\"$CustomerID\", \"orderDate\":\"$OrderDate\", \"__customerId\":\"$CustomerID\" }} , { \"$sort\" :{ \"_id\":1 } } , { \"$skip\" : 0 }, { \"$limit\" : 1 } , { \"$project\": { \"_id\": 0 } }]",
187
+ "children": [
188
+ {
189
+ "entity": "Customers",
190
+ "dialect": "PostgreSQL",
191
+ "source": "Crm",
192
+ "sentence": "SELECT c.CompanyName AS \"name\", c.CustomerID AS \"LambdaOrmParentId\" FROM Customers c WHERE c.CustomerID IN ($1) "
193
+ }
194
+ ]
195
+ }
196
+ ```
197
+
198
+ In this example:
199
+
200
+ - The .env file is used to obtain the environment variables.
201
+ - The Plan obtained is about the stage default.
202
+ - The lambda expression is used to obtain an order from the "HANAR" client.
203
+ - The plan is obtained in a beautiful format.
204
+
205
+ ### import
206
+
207
+ Import data from file to datasources asociados a un stage.
208
+
209
+ ```sh
210
+
211
+ ```sh
212
+ lambdaorm import -e .env -s default -d ./data.json
213
+ ```
214
+
215
+ In this example:
216
+
217
+ - The datasources associated with the default stage are known.
218
+ - The .env file is used to obtain environment variables.
219
+ - Data is obtained from data.json file
220
+
221
+ ### export
222
+
223
+ Export data from a datasource associated to a stage.
224
+
225
+ ```sh
226
+ lambdaorm export -s stage1 -e .env
227
+ ```
228
+
229
+ In this example:
230
+
231
+ - Data is exported from the datasources associated with stage1.
232
+ - The .env file is used to obtain the environment variables.
233
+ - A file called "stage1-export.json" will be created with all the data associated with the stage1 datasources.
234
+
235
+ ### Build
236
+
237
+ Running the build command will create or update the following:
238
+
239
+ - Folder that will contain the source code and is taken from the "infrastructure.paths.scr" configuration in the lambdaorm.yaml file
240
+ - Folder that will contain the domain files, the path is relative to the src folder and is taken from the "infrastructure.paths.domain" configuration in the lambdaorm.yaml file
241
+ - Model file: file with the definition of the entities
242
+ - Repository files: one file for each entity with data access methods
243
+ - Install the necessary dependencies according to the databases used
244
+
245
+ #### Build Node example
246
+
247
+ Add configuration, model and repositories according to the language.
248
+
249
+ ```sh
250
+ lambdaorm build -l node
251
+ ```
252
+
253
+ Result:
254
+
255
+ ```sh
256
+ ├── orm_state
257
+ ├── lambdaORM.yaml
258
+ ├── package.json
259
+ ├── src
260
+ │ └── countries
261
+ │ └── domain
262
+ │ ├── model.ts
263
+ │ ├── repositoryCountry.ts
264
+ │ └── repositoryState.ts
265
+ └── tsconfig.json
266
+ ```
267
+
268
+ #### Build Client Node example
269
+
270
+ ```sh
271
+ lambdaorm build -l client-node --all -u http://localhost:9291
272
+ ```
273
+
274
+ Result:
275
+
276
+ ```sh
277
+ ├── orm_state
278
+ ├── lambdaORM.yaml
279
+ ├── package.json
280
+ ├── src
281
+ │ ├── index.ts
282
+ │ └── northwind
283
+ │ └── domain
284
+ │ ├── model.ts
285
+ │ ├── repositoryCategory.ts
286
+ │ ├── repositoryCustomer.ts
287
+ │ ├── repositoryOrdersDetail.ts
288
+ │ ├── repositoryOrder.ts
289
+ │ └── repositoryProduct.ts
290
+ └── tsconfig.json
291
+ ```
292
+
293
+ ### Drop
294
+
295
+ Removes all database objects but not the database.
296
+
297
+ ```sh
298
+ lambdaorm drop -e .env -s default
299
+ lambdaorm drop -e .env -s insights
300
+ ```
301
+
302
+ Result:
303
+
304
+ ```sh
305
+ orm_state
306
+ ├── default-ddl-20231129T110712162Z-push-Catalog.sql
307
+ ├── default-ddl-20231129T110712163Z-push-Crm.sql
308
+ ├── default-ddl-20231129T110712163Z-push-Ordering.json
309
+ ├── default-ddl-20231129T111730593Z-clean-Catalog.sql
310
+ ├── default-ddl-20231129T111730594Z-clean-Crm.sql
311
+ ├── default-ddl-20231129T111730594Z-clean-Ordering.json
312
+ ├── insights-ddl-20231129T110303423Z-push-Insights.sql
313
+ └── insights-ddl-20231129T111738316Z-clean-Insights.sql
314
+ ```
315
+
316
+ In this example:
317
+
318
+ - The .env file is used to obtain the environment variables.
319
+ - The first execution drops all the database objects associated with the default datasources.
320
+ - The second execution drops all the database objects associated with the insights data sources.
321
+ - The clean files associated with each datasource of each stage are generated.
322
+ - The model file associated with each stage is removed.
323
+
324
+ ## Documentation
325
+
326
+ Full documentation is available in the [Wiki](https://github.com/lambda-orm/lambdaorm-cli/wiki).
327
+
328
+ ## Related projects
329
+
330
+ - [Lambda ORM](https://www.npmjs.com/package/lambdaorm)
331
+ - [Lambda ORM Service](https://github.com/lambda-orm/lambdaorm-svc)
332
+ - [Client Node](https://www.npmjs.com/package/lambdaorm-client-node)
333
+ - [Client Kotlin](https://github.com/lambda-orm/lambdaorm-client-kotlin)
334
+
335
+ ## Labs
336
+
337
+ You can access various labs at [github.com/lambda-orm/lambdaorm-labs](https://github.com/lambda-orm/lambdaorm-labs)
@@ -0,0 +1,17 @@
1
+ import { SchemaFacade } from '@lambdaorm/lib';
2
+ import { OrmCliH3lp } from './helper';
3
+ import { OrmFactory } from './ports/orm';
4
+ import { Languages } from './services/languages';
5
+ import { WorkspaceFactory } from './ports/workspace';
6
+ import { OutputService } from './services/outputService';
7
+ export declare class CliFacade {
8
+ readonly languages: Languages;
9
+ readonly orm: OrmFactory;
10
+ readonly workspace: WorkspaceFactory;
11
+ readonly output: OutputService;
12
+ readonly helper: OrmCliH3lp;
13
+ readonly schema: SchemaFacade;
14
+ constructor(languages: Languages, orm: OrmFactory, workspace: WorkspaceFactory, output: OutputService, helper: OrmCliH3lp, schema: SchemaFacade);
15
+ getGlobalPackage(name: string): Promise<string>;
16
+ }
17
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/lib/application/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,qBAAa,SAAS;aAGJ,SAAS,EAAC,SAAS;aACnB,GAAG,EAAC,UAAU;aACd,SAAS,EAAC,gBAAgB;aAC1B,MAAM,EAAC,aAAa;aACpB,MAAM,EAAC,UAAU;aACjB,MAAM,EAAC,YAAY;gBALnB,SAAS,EAAC,SAAS,EACnB,GAAG,EAAC,UAAU,EACd,SAAS,EAAC,gBAAgB,EAC1B,MAAM,EAAC,aAAa,EACpB,MAAM,EAAC,UAAU,EACjB,MAAM,EAAC,YAAY;IAEvB,gBAAgB,CAAE,IAAI,EAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM5D"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliFacade = void 0;
4
+ class CliFacade {
5
+ // eslint-disable-next-line no-useless-constructor
6
+ constructor(languages, orm, workspace, output, helper, schema) {
7
+ this.languages = languages;
8
+ this.orm = orm;
9
+ this.workspace = workspace;
10
+ this.output = output;
11
+ this.helper = helper;
12
+ this.schema = schema;
13
+ }
14
+ async getGlobalPackage(name) {
15
+ const exp = new RegExp(`${name}@(.*)\n`);
16
+ const globalNpmList = await this.helper.utils.exec('npm list -g --depth=0', process.cwd());
17
+ const globalMatches = globalNpmList.match(exp);
18
+ return (globalMatches && globalMatches[1] ? globalMatches[1] : '').replace(/"invalid"/gi, '').trim();
19
+ }
20
+ }
21
+ exports.CliFacade = CliFacade;
22
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/lib/application/cli.ts"],"names":[],"mappings":";;;AAMA,MAAa,SAAS;IACrB,kDAAkD;IAClD,YACiB,SAAmB,EACnB,GAAc,EACd,SAA0B,EAC1B,MAAoB,EACpB,MAAiB,EACjB,MAAmB;QALnB,cAAS,GAAT,SAAS,CAAU;QACnB,QAAG,GAAH,GAAG,CAAW;QACd,cAAS,GAAT,SAAS,CAAiB;QAC1B,WAAM,GAAN,MAAM,CAAc;QACpB,WAAM,GAAN,MAAM,CAAW;QACjB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEjC,KAAK,CAAC,gBAAgB,CAAE,IAAW;QACzC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,CAAC,CAAA;QACxC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAC1F,MAAM,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC9C,OAAO,CAAC,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACrG,CAAC;CACD;AAhBD,8BAgBC"}
@@ -0,0 +1,16 @@
1
+ import { H3lp, IUtils, IFsHelper } from 'h3lp';
2
+ import { Logger, OrmH3lp } from '@lambdaorm/lib';
3
+ declare class CliHelper {
4
+ private readonly utils;
5
+ private readonly fs;
6
+ constructor(utils: IUtils, fs: IFsHelper);
7
+ readData(data: any): Promise<any>;
8
+ nameFromFile(filePath: string): string;
9
+ getPackage(name: string, workspace: string): Promise<string>;
10
+ }
11
+ export declare class OrmCliH3lp extends OrmH3lp {
12
+ cli: CliHelper;
13
+ constructor(h3lp: H3lp, logger: Logger);
14
+ }
15
+ export {};
16
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/lib/application/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAGhD,cAAM,SAAS;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAS,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAjC,KAAK,EAAC,MAAM,EAAmB,EAAE,EAAC,SAAS;IAE5D,QAAQ,CAAE,IAAI,EAAC,GAAG,GAAE,OAAO,CAAC,GAAG,CAAC;IAiBtC,YAAY,CAAE,QAAQ,EAAC,MAAM,GAAE,MAAM;IAK/B,UAAU,CAAE,IAAI,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMxE;AAED,qBAAa,UAAW,SAAQ,OAAO;IAC/B,GAAG,EAAC,SAAS,CAAA;gBACP,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM;CAIvC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.OrmCliH3lp = void 0;
7
+ const lib_1 = require("@lambdaorm/lib");
8
+ const path_1 = __importDefault(require("path"));
9
+ class CliHelper {
10
+ // eslint-disable-next-line no-useless-constructor
11
+ constructor(utils, fs) {
12
+ this.utils = utils;
13
+ this.fs = fs;
14
+ }
15
+ async readData(data) {
16
+ // read Data
17
+ if (typeof data === 'string') {
18
+ const _data = this.utils.tryParse(data);
19
+ if (_data !== null) {
20
+ return _data;
21
+ }
22
+ else {
23
+ try {
24
+ const strData = await this.fs.read(path_1.default.join(process.cwd(), data));
25
+ return JSON.parse(strData);
26
+ }
27
+ catch (error) {
28
+ throw new Error(`Error to read context: ${error}`);
29
+ }
30
+ }
31
+ }
32
+ }
33
+ nameFromFile(filePath) {
34
+ const parsedPath = path_1.default.parse(filePath);
35
+ return parsedPath.name;
36
+ }
37
+ async getPackage(name, workspace) {
38
+ const exp = new RegExp(`${name}@(.*)\n`);
39
+ const localNpmList = await this.utils.exec('npm list --depth=0', workspace);
40
+ const localMatches = localNpmList.match(exp);
41
+ return (localMatches && localMatches[1] ? localMatches[1] : '').replace(/"invalid"/gi, '').trim();
42
+ }
43
+ }
44
+ class OrmCliH3lp extends lib_1.OrmH3lp {
45
+ constructor(h3lp, logger) {
46
+ super(h3lp, logger);
47
+ this.cli = new CliHelper(h3lp.utils, h3lp.fs);
48
+ }
49
+ }
50
+ exports.OrmCliH3lp = OrmCliH3lp;
51
+ //# sourceMappingURL=helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/lib/application/helper.ts"],"names":[],"mappings":";;;;;;AACA,wCAAgD;AAChD,gDAAuB;AAEvB,MAAM,SAAS;IACd,kDAAkD;IAClD,YAA8B,KAAY,EAAmB,EAAY;QAA3C,UAAK,GAAL,KAAK,CAAO;QAAmB,OAAE,GAAF,EAAE,CAAU;IAAG,CAAC;IAEtE,KAAK,CAAC,QAAQ,CAAE,IAAQ;QAC9B,YAAY;QACZ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAA;YACjD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACpB,OAAO,KAAK,CAAA;YACb,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC;oBACJ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAc,CAAC,CAAC,CAAA;oBAC5E,OAAO,IAAI,CAAC,KAAK,CAAC,OAAiB,CAAC,CAAA;gBACrC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAA;gBACnD,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAEM,YAAY,CAAE,QAAe;QACnC,MAAM,UAAU,GAAG,cAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACvC,OAAO,UAAU,CAAC,IAAI,CAAA;IACvB,CAAC;IAEM,KAAK,CAAC,UAAU,CAAE,IAAW,EAAE,SAAgB;QACrD,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,CAAC,CAAA;QACxC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAA;QAC3E,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC5C,OAAO,CAAC,YAAY,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IAClG,CAAC;CACD;AAED,MAAa,UAAW,SAAQ,aAAO;IAEtC,YAAa,IAAU,EAAE,MAAc;QACtC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACnB,IAAI,CAAC,GAAG,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9C,CAAC;CACD;AAND,gCAMC"}
@@ -0,0 +1,28 @@
1
+ export * from './cli';
2
+ export * from './services/outputService';
3
+ export * from './helper';
4
+ export * from './useCases/build';
5
+ export * from './useCases/init';
6
+ export * from './useCases/drop';
7
+ export * from './useCases/execute';
8
+ export * from './useCases/metadata';
9
+ export * from './useCases/parameters';
10
+ export * from './useCases/model';
11
+ export * from './useCases/constraints';
12
+ export * from './useCases/plan';
13
+ export * from './useCases/export';
14
+ export * from './useCases/import';
15
+ export * from './useCases/push';
16
+ export * from './useCases/schema';
17
+ export * from './useCases/version';
18
+ export * from './useCases/versionGlobal';
19
+ export * from './useCases/introspect';
20
+ export * from './useCases/incorporate';
21
+ export * from './useCases/pull';
22
+ export * from './useCases/fetch';
23
+ export * from './ports/orm';
24
+ export * from './ports/workspace';
25
+ export * from './ports/language';
26
+ export * from './helper';
27
+ export * from './services/languages';
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/application/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,0BAA0B,CAAA;AACxC,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./cli"), exports);
18
+ __exportStar(require("./services/outputService"), exports);
19
+ __exportStar(require("./helper"), exports);
20
+ __exportStar(require("./useCases/build"), exports);
21
+ __exportStar(require("./useCases/init"), exports);
22
+ __exportStar(require("./useCases/drop"), exports);
23
+ __exportStar(require("./useCases/execute"), exports);
24
+ __exportStar(require("./useCases/metadata"), exports);
25
+ __exportStar(require("./useCases/parameters"), exports);
26
+ __exportStar(require("./useCases/model"), exports);
27
+ __exportStar(require("./useCases/constraints"), exports);
28
+ __exportStar(require("./useCases/plan"), exports);
29
+ __exportStar(require("./useCases/export"), exports);
30
+ __exportStar(require("./useCases/import"), exports);
31
+ __exportStar(require("./useCases/push"), exports);
32
+ __exportStar(require("./useCases/schema"), exports);
33
+ __exportStar(require("./useCases/version"), exports);
34
+ __exportStar(require("./useCases/versionGlobal"), exports);
35
+ __exportStar(require("./useCases/introspect"), exports);
36
+ __exportStar(require("./useCases/incorporate"), exports);
37
+ __exportStar(require("./useCases/pull"), exports);
38
+ __exportStar(require("./useCases/fetch"), exports);
39
+ __exportStar(require("./ports/orm"), exports);
40
+ __exportStar(require("./ports/workspace"), exports);
41
+ __exportStar(require("./ports/language"), exports);
42
+ __exportStar(require("./helper"), exports);
43
+ __exportStar(require("./services/languages"), exports);
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/application/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,2DAAwC;AACxC,2CAAwB;AACxB,mDAAgC;AAChC,kDAA+B;AAC/B,kDAA+B;AAC/B,qDAAkC;AAClC,sDAAmC;AACnC,wDAAqC;AACrC,mDAAgC;AAChC,yDAAsC;AACtC,kDAA+B;AAC/B,oDAAiC;AACjC,oDAAiC;AACjC,kDAA+B;AAC/B,oDAAiC;AACjC,qDAAkC;AAClC,2DAAwC;AACxC,wDAAqC;AACrC,yDAAsC;AACtC,kDAA+B;AAC/B,mDAAgC;AAChC,8CAA2B;AAC3B,oDAAiC;AACjC,mDAAgC;AAChC,2CAAwB;AACxB,uDAAoC"}
@@ -0,0 +1,7 @@
1
+ import { BuildArgs } from './orm';
2
+ export interface LanguageService {
3
+ get name(): string;
4
+ build(args: BuildArgs): Promise<void>;
5
+ localVersion(workspace: string): Promise<string>;
6
+ }
7
+ //# sourceMappingURL=language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../../src/lib/application/ports/language.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,MAAM,WAAW,eAAe;IAC/B,IAAI,IAAI,IAAG,MAAM,CAAA;IACjB,KAAK,CAAE,IAAI,EAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,YAAY,CAAE,SAAS,EAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAChD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=language.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.js","sourceRoot":"","sources":["../../../../src/lib/application/ports/language.ts"],"names":[],"mappings":""}
@@ -0,0 +1,97 @@
1
+ import { QueryPlan, QueryOptions, Metadata, MetadataModel, MetadataConstraint, MetadataParameter, DomainSchema, SchemaData, Entity, Enum, Schema, Mapping, EntityMapping, Stage, ExecuteResult } from '@lambdaorm/lib';
2
+ export interface CliSchemaService {
3
+ introspect(data: any, name: string): Promise<void>;
4
+ version(): Promise<{
5
+ version: string | undefined;
6
+ }>;
7
+ originalSchema(): Promise<Schema>;
8
+ schema(): Promise<Schema>;
9
+ domain(): Promise<DomainSchema>;
10
+ sources(): Promise<{
11
+ name: string;
12
+ dialect: string;
13
+ }[]>;
14
+ source(source: string): Promise<{
15
+ name: string;
16
+ dialect: string;
17
+ }>;
18
+ entities(): Promise<Entity[]>;
19
+ entity(entity: string): Promise<Entity | undefined>;
20
+ enums(): Promise<Enum[]>;
21
+ enum(_enum: string): Promise<Enum | undefined>;
22
+ mappings(): Promise<Mapping[]>;
23
+ mapping(mapping: string): Promise<Mapping | undefined>;
24
+ entityMapping(mapping: string, entity: string): Promise<EntityMapping | undefined>;
25
+ stages(): Promise<Stage[]>;
26
+ stage(stage: string): Promise<Stage | undefined>;
27
+ views(): Promise<string[]>;
28
+ }
29
+ export interface CliStageService {
30
+ exists(stage: string): Promise<boolean>;
31
+ export(stage: string, force: boolean): Promise<SchemaData>;
32
+ import(stage: string, schemaData: any): Promise<void>;
33
+ fetch(stage: string): Promise<Mapping[]>;
34
+ introspect(data: any, name: string, stage?: string): Promise<ExecuteResult[]>;
35
+ incorporate(data: any, name: string, stage?: string): Promise<ExecuteResult[]>;
36
+ pull(stage: string): Promise<ExecuteResult[]>;
37
+ drop(stage: string, sentence: boolean, force: boolean): Promise<ExecuteResult[]>;
38
+ push(stage: string, sentence: boolean, force: boolean): Promise<ExecuteResult[]>;
39
+ }
40
+ export interface BuildArgs {
41
+ workspace: string;
42
+ url?: string;
43
+ language: string;
44
+ options: string[];
45
+ srcPath?: string;
46
+ dataPath?: string;
47
+ domainPath?: string;
48
+ }
49
+ export interface OrmService {
50
+ init(): Promise<any>;
51
+ end(): Promise<void>;
52
+ getStageName(stage?: string): Promise<string>;
53
+ get schema(): CliSchemaService;
54
+ get stage(): CliStageService;
55
+ /**
56
+ * Get model of query
57
+ * @returns Model of query
58
+ */
59
+ model(query: string): Promise<MetadataModel[]>;
60
+ /**
61
+ * Get parameters of query
62
+ * @returns Parameters of query
63
+ */
64
+ parameters(query: string): Promise<MetadataParameter[]>;
65
+ /**
66
+ * Get constraints of query
67
+ * @returns Constraints of query
68
+ */
69
+ constraints(query: string): Promise<MetadataConstraint>;
70
+ /**
71
+ * Get metadata of query
72
+ * @returns metadata of query
73
+ */
74
+ metadata(query: string): Promise<Metadata>;
75
+ /**
76
+ *
77
+ * @param query
78
+ * @param stage
79
+ */
80
+ plan(query: string, options?: QueryOptions): Promise<QueryPlan>;
81
+ /**
82
+ * Execute query
83
+ * @param data Data with variables
84
+ * @param stage Stage name
85
+ * @param view View name
86
+ * @returns Result of execution
87
+ */
88
+ execute(query: string, data?: any, options?: QueryOptions): Promise<any>;
89
+ }
90
+ export interface OrmFactoryArgs {
91
+ workspace?: string;
92
+ url?: string;
93
+ }
94
+ export interface OrmFactory {
95
+ create(args: OrmFactoryArgs): OrmService;
96
+ }
97
+ //# sourceMappingURL=orm.d.ts.map