@slingr/cli 0.0.3 → 0.0.4

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 (251) hide show
  1. package/LICENSE.txt +202 -0
  2. package/README.md +490 -319
  3. package/bin/dev.cmd +2 -2
  4. package/bin/dev.js +5 -5
  5. package/bin/run.cmd +2 -2
  6. package/bin/run.js +4 -4
  7. package/bin/slingr +1 -0
  8. package/dist/commands/build.d.ts +20 -0
  9. package/dist/commands/build.d.ts.map +1 -0
  10. package/dist/commands/build.js +206 -0
  11. package/dist/commands/build.js.map +1 -0
  12. package/dist/commands/create-app.d.ts +0 -1
  13. package/dist/commands/create-app.d.ts.map +1 -1
  14. package/dist/commands/create-app.js +38 -57
  15. package/dist/commands/create-app.js.map +1 -1
  16. package/dist/commands/debug.d.ts +28 -0
  17. package/dist/commands/debug.d.ts.map +1 -0
  18. package/dist/commands/debug.js +474 -0
  19. package/dist/commands/debug.js.map +1 -0
  20. package/dist/commands/ds.d.ts +14 -1
  21. package/dist/commands/ds.d.ts.map +1 -1
  22. package/dist/commands/ds.js +450 -121
  23. package/dist/commands/ds.js.map +1 -1
  24. package/dist/commands/gql.d.ts +1 -1
  25. package/dist/commands/gql.d.ts.map +1 -1
  26. package/dist/commands/gql.js +190 -184
  27. package/dist/commands/gql.js.map +1 -1
  28. package/dist/commands/infra/down.d.ts.map +1 -1
  29. package/dist/commands/infra/down.js +8 -7
  30. package/dist/commands/infra/down.js.map +1 -1
  31. package/dist/commands/infra/up.d.ts.map +1 -1
  32. package/dist/commands/infra/up.js +8 -7
  33. package/dist/commands/infra/up.js.map +1 -1
  34. package/dist/commands/infra/update.d.ts +1 -0
  35. package/dist/commands/infra/update.d.ts.map +1 -1
  36. package/dist/commands/infra/update.js +33 -69
  37. package/dist/commands/infra/update.js.map +1 -1
  38. package/dist/commands/run.d.ts +29 -2
  39. package/dist/commands/run.d.ts.map +1 -1
  40. package/dist/commands/run.js +628 -130
  41. package/dist/commands/run.js.map +1 -1
  42. package/dist/commands/setup.d.ts +1 -1
  43. package/dist/commands/setup.d.ts.map +1 -1
  44. package/dist/commands/setup.js +34 -71
  45. package/dist/commands/setup.js.map +1 -1
  46. package/dist/commands/sync-metadata.d.ts +15 -0
  47. package/dist/commands/sync-metadata.d.ts.map +1 -0
  48. package/dist/commands/sync-metadata.js +225 -0
  49. package/dist/commands/sync-metadata.js.map +1 -0
  50. package/dist/commands/users.d.ts +30 -0
  51. package/dist/commands/users.d.ts.map +1 -0
  52. package/dist/commands/users.js +472 -0
  53. package/dist/commands/users.js.map +1 -0
  54. package/dist/commands/views.d.ts +11 -0
  55. package/dist/commands/views.d.ts.map +1 -0
  56. package/dist/commands/views.js +73 -0
  57. package/dist/commands/views.js.map +1 -0
  58. package/dist/projectStructure.d.ts +2 -2
  59. package/dist/projectStructure.d.ts.map +1 -1
  60. package/dist/projectStructure.js +281 -69
  61. package/dist/projectStructure.js.map +1 -1
  62. package/dist/scripts/generate-metadata.d.ts +13 -0
  63. package/dist/scripts/generate-metadata.d.ts.map +1 -0
  64. package/dist/scripts/generate-metadata.js +412 -0
  65. package/dist/scripts/generate-metadata.js.map +1 -0
  66. package/dist/scripts/generate-metadata.ts +498 -0
  67. package/dist/scripts/generate-schema.d.ts +1 -1
  68. package/dist/scripts/generate-schema.js +168 -74
  69. package/dist/scripts/generate-schema.js.map +1 -1
  70. package/dist/scripts/generate-schema.ts +258 -143
  71. package/dist/templates/.env.template +23 -0
  72. package/dist/templates/.firebaserc.template +5 -0
  73. package/dist/templates/.github/copilot-instructions.md.template +652 -17
  74. package/dist/templates/backend/Dockerfile.template +30 -0
  75. package/dist/templates/config/datasource.ts.template +12 -9
  76. package/dist/templates/config/jest.config.ts +30 -30
  77. package/dist/templates/config/jest.setup.ts +1 -1
  78. package/dist/templates/config/tsconfig.json.template +50 -29
  79. package/dist/templates/dataSources/mysql.ts.template +16 -13
  80. package/dist/templates/dataSources/postgres.ts.template +15 -13
  81. package/dist/templates/dataset-generator-script.ts.template +139 -139
  82. package/dist/templates/datasets/mysql-default/.slingr-schema.json.template +5 -0
  83. package/dist/templates/datasets/mysql-default/Address.jsonl.template +3 -3
  84. package/dist/templates/datasets/mysql-default/App.jsonl.template +4 -4
  85. package/dist/templates/datasets/mysql-default/Company.jsonl.template +3 -3
  86. package/dist/templates/datasets/mysql-default/Person.jsonl.template +2 -2
  87. package/dist/templates/datasets/mysql-default/User.jsonl.template +1 -0
  88. package/dist/templates/datasets/mysql-default/instructions.md.template +1 -0
  89. package/dist/templates/datasets/postgres-default/.slingr-schema.json.template +5 -0
  90. package/dist/templates/datasets/postgres-default/Address.jsonl.template +3 -3
  91. package/dist/templates/datasets/postgres-default/App.jsonl.template +4 -4
  92. package/dist/templates/datasets/postgres-default/Company.jsonl.template +3 -3
  93. package/dist/templates/datasets/postgres-default/Person.jsonl.template +2 -2
  94. package/dist/templates/datasets/postgres-default/User.jsonl.template +1 -0
  95. package/dist/templates/datasets/postgres-default/instructions.md.template +1 -0
  96. package/dist/templates/docker-compose.prod-test.yml.template +32 -0
  97. package/dist/templates/docker-compose.yml.template +24 -0
  98. package/dist/templates/docs/app-description.md.template +33 -33
  99. package/dist/templates/firebase.json.template +68 -0
  100. package/dist/templates/frontend/.umirc.ts.template +23 -0
  101. package/dist/templates/frontend/package.json.template +45 -0
  102. package/dist/templates/frontend/public/config.json +6 -0
  103. package/dist/templates/frontend/public/logo.svg +6 -0
  104. package/dist/templates/frontend/src/app.tsx.template +44 -0
  105. package/dist/templates/frontend/src/global.less.template +117 -0
  106. package/dist/templates/frontend/src/layouts/MainLayout.tsx.template +75 -0
  107. package/dist/templates/frontend/src/types/graphql-augmentation.d.ts.template +44 -0
  108. package/dist/templates/frontend/src/views/customViews/user/UserCreateView.tsx.template +18 -0
  109. package/dist/templates/frontend/src/views/customViews/user/UserEditView.tsx.template +29 -0
  110. package/dist/templates/frontend/src/views/customViews/user/UserReadView.tsx.template +24 -0
  111. package/dist/templates/frontend/src/views/customViews/user/UserTableView.tsx.template +38 -0
  112. package/dist/templates/frontend/src/views/customViews/welcome.tsx.template +34 -0
  113. package/dist/templates/frontend/tsconfig.json.template +50 -0
  114. package/dist/templates/gql/codegen.yml.template +25 -25
  115. package/dist/templates/gql/index.ts.template +17 -24
  116. package/dist/templates/gql/operations.graphql.template +30 -30
  117. package/dist/templates/ops/README.md.template +1045 -0
  118. package/dist/templates/ops/cloudbuild.yaml.template +161 -0
  119. package/dist/templates/ops/scripts/_utils.js.template +217 -0
  120. package/dist/templates/ops/scripts/deploy.js.template +145 -0
  121. package/dist/templates/ops/scripts/setup-gcp.js.template +330 -0
  122. package/dist/templates/ops/scripts/setup-secrets.js.template +76 -0
  123. package/dist/templates/ops/scripts/test-prod-local.js.template +49 -0
  124. package/dist/templates/package.json.template +50 -38
  125. package/dist/templates/pnpm-workspace.yaml.template +3 -0
  126. package/dist/templates/prompt-analysis.md.template +110 -110
  127. package/dist/templates/prompt-script-generation.md.template +258 -258
  128. package/dist/templates/src/Address.ts.template +28 -31
  129. package/dist/templates/src/App.ts.template +17 -61
  130. package/dist/templates/src/Company.ts.template +41 -47
  131. package/dist/templates/src/Models.test.ts.template +654 -654
  132. package/dist/templates/src/Person.test.ts.template +289 -289
  133. package/dist/templates/src/Person.ts.template +90 -105
  134. package/dist/templates/src/actions/index.ts.template +11 -11
  135. package/dist/templates/src/auth/permissions.ts.template +34 -0
  136. package/dist/templates/src/data/App.ts.template +48 -0
  137. package/dist/templates/src/data/User.ts.template +35 -0
  138. package/dist/templates/src/types/gql.d.ts.template +17 -17
  139. package/dist/templates/vscode/extensions.json +4 -3
  140. package/dist/templates/vscode/settings.json +17 -11
  141. package/dist/templates/workspace-package.json.template +21 -0
  142. package/dist/utils/buildCache.d.ts +12 -0
  143. package/dist/utils/buildCache.d.ts.map +1 -0
  144. package/dist/utils/buildCache.js +102 -0
  145. package/dist/utils/buildCache.js.map +1 -0
  146. package/dist/utils/checkFramework.d.ts +27 -0
  147. package/dist/utils/checkFramework.d.ts.map +1 -0
  148. package/dist/utils/checkFramework.js +104 -0
  149. package/dist/utils/checkFramework.js.map +1 -0
  150. package/dist/utils/datasourceParser.d.ts +11 -0
  151. package/dist/utils/datasourceParser.d.ts.map +1 -1
  152. package/dist/utils/datasourceParser.js +154 -56
  153. package/dist/utils/datasourceParser.js.map +1 -1
  154. package/dist/utils/dockerManager.d.ts +25 -0
  155. package/dist/utils/dockerManager.d.ts.map +1 -0
  156. package/dist/utils/dockerManager.js +281 -0
  157. package/dist/utils/dockerManager.js.map +1 -0
  158. package/dist/utils/infraFileParser.d.ts +26 -0
  159. package/dist/utils/infraFileParser.d.ts.map +1 -0
  160. package/dist/utils/infraFileParser.js +75 -0
  161. package/dist/utils/infraFileParser.js.map +1 -0
  162. package/dist/utils/jsonlLoader.d.ts +91 -12
  163. package/dist/utils/jsonlLoader.d.ts.map +1 -1
  164. package/dist/utils/jsonlLoader.js +674 -63
  165. package/dist/utils/jsonlLoader.js.map +1 -1
  166. package/dist/utils/model-analyzer.d.ts.map +1 -1
  167. package/dist/utils/model-analyzer.js +67 -13
  168. package/dist/utils/model-analyzer.js.map +1 -1
  169. package/dist/utils/userManagement.d.ts +57 -0
  170. package/dist/utils/userManagement.d.ts.map +1 -0
  171. package/dist/utils/userManagement.js +288 -0
  172. package/dist/utils/userManagement.js.map +1 -0
  173. package/dist/utils/viewsGenerator.d.ts +15 -0
  174. package/dist/utils/viewsGenerator.d.ts.map +1 -0
  175. package/dist/utils/viewsGenerator.js +311 -0
  176. package/dist/utils/viewsGenerator.js.map +1 -0
  177. package/oclif.manifest.json +445 -20
  178. package/package.json +29 -26
  179. package/src/templates/.env.template +23 -0
  180. package/src/templates/.firebaserc.template +5 -0
  181. package/src/templates/.github/copilot-instructions.md.template +652 -17
  182. package/src/templates/backend/Dockerfile.template +30 -0
  183. package/src/templates/config/datasource.ts.template +12 -9
  184. package/src/templates/config/jest.config.ts +30 -30
  185. package/src/templates/config/jest.setup.ts +1 -1
  186. package/src/templates/config/tsconfig.json.template +50 -29
  187. package/src/templates/dataSources/mysql.ts.template +16 -13
  188. package/src/templates/dataSources/postgres.ts.template +15 -13
  189. package/src/templates/dataset-generator-script.ts.template +139 -139
  190. package/src/templates/datasets/mysql-default/.slingr-schema.json.template +5 -0
  191. package/src/templates/datasets/mysql-default/Address.jsonl.template +3 -3
  192. package/src/templates/datasets/mysql-default/App.jsonl.template +4 -4
  193. package/src/templates/datasets/mysql-default/Company.jsonl.template +3 -3
  194. package/src/templates/datasets/mysql-default/Person.jsonl.template +2 -2
  195. package/src/templates/datasets/mysql-default/User.jsonl.template +1 -0
  196. package/src/templates/datasets/mysql-default/instructions.md.template +1 -0
  197. package/src/templates/datasets/postgres-default/.slingr-schema.json.template +5 -0
  198. package/src/templates/datasets/postgres-default/Address.jsonl.template +3 -3
  199. package/src/templates/datasets/postgres-default/App.jsonl.template +4 -4
  200. package/src/templates/datasets/postgres-default/Company.jsonl.template +3 -3
  201. package/src/templates/datasets/postgres-default/Person.jsonl.template +2 -2
  202. package/src/templates/datasets/postgres-default/User.jsonl.template +1 -0
  203. package/src/templates/datasets/postgres-default/instructions.md.template +1 -0
  204. package/src/templates/docker-compose.prod-test.yml.template +32 -0
  205. package/src/templates/docker-compose.yml.template +24 -0
  206. package/src/templates/docs/app-description.md.template +33 -33
  207. package/src/templates/firebase.json.template +68 -0
  208. package/src/templates/frontend/.umirc.ts.template +23 -0
  209. package/src/templates/frontend/package.json.template +45 -0
  210. package/src/templates/frontend/public/config.json +6 -0
  211. package/src/templates/frontend/public/logo.svg +6 -0
  212. package/src/templates/frontend/src/app.tsx.template +44 -0
  213. package/src/templates/frontend/src/global.less.template +117 -0
  214. package/src/templates/frontend/src/layouts/MainLayout.tsx.template +75 -0
  215. package/src/templates/frontend/src/types/graphql-augmentation.d.ts.template +44 -0
  216. package/src/templates/frontend/src/views/customViews/user/UserCreateView.tsx.template +18 -0
  217. package/src/templates/frontend/src/views/customViews/user/UserEditView.tsx.template +29 -0
  218. package/src/templates/frontend/src/views/customViews/user/UserReadView.tsx.template +24 -0
  219. package/src/templates/frontend/src/views/customViews/user/UserTableView.tsx.template +38 -0
  220. package/src/templates/frontend/src/views/customViews/welcome.tsx.template +34 -0
  221. package/src/templates/frontend/tsconfig.json.template +50 -0
  222. package/src/templates/gql/codegen.yml.template +25 -25
  223. package/src/templates/gql/index.ts.template +17 -24
  224. package/src/templates/gql/operations.graphql.template +30 -30
  225. package/src/templates/ops/README.md.template +1045 -0
  226. package/src/templates/ops/cloudbuild.yaml.template +161 -0
  227. package/src/templates/ops/scripts/_utils.js.template +217 -0
  228. package/src/templates/ops/scripts/deploy.js.template +145 -0
  229. package/src/templates/ops/scripts/setup-gcp.js.template +330 -0
  230. package/src/templates/ops/scripts/setup-secrets.js.template +76 -0
  231. package/src/templates/ops/scripts/test-prod-local.js.template +49 -0
  232. package/src/templates/package.json.template +50 -38
  233. package/src/templates/pnpm-workspace.yaml.template +3 -0
  234. package/src/templates/prompt-analysis.md.template +110 -110
  235. package/src/templates/prompt-script-generation.md.template +258 -258
  236. package/src/templates/src/Address.ts.template +28 -31
  237. package/src/templates/src/App.ts.template +17 -61
  238. package/src/templates/src/Company.ts.template +41 -47
  239. package/src/templates/src/Models.test.ts.template +654 -654
  240. package/src/templates/src/Person.test.ts.template +289 -289
  241. package/src/templates/src/Person.ts.template +90 -105
  242. package/src/templates/src/actions/index.ts.template +11 -11
  243. package/src/templates/src/auth/permissions.ts.template +34 -0
  244. package/src/templates/src/data/App.ts.template +48 -0
  245. package/src/templates/src/data/User.ts.template +35 -0
  246. package/src/templates/src/types/gql.d.ts.template +17 -17
  247. package/src/templates/vscode/extensions.json +4 -3
  248. package/src/templates/vscode/settings.json +17 -11
  249. package/src/templates/workspace-package.json.template +21 -0
  250. package/dist/templates/src/index.ts +0 -66
  251. package/src/templates/src/index.ts +0 -66
@@ -0,0 +1,104 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getBackendPath = getBackendPath;
37
+ exports.hasSlingrFramework = hasSlingrFramework;
38
+ exports.getFrameworkPath = getFrameworkPath;
39
+ const path = __importStar(require("node:path"));
40
+ const fs = __importStar(require("fs-extra"));
41
+ /**
42
+ * Gets the backend directory path for a Slingr application.
43
+ * All Slingr applications use a workspace structure with backend/ directory.
44
+ *
45
+ * @param cwd - The current working directory (defaults to process.cwd())
46
+ * @returns The path to the backend directory
47
+ */
48
+ function getBackendPath(cwd = process.cwd()) {
49
+ return path.join(cwd, 'backend');
50
+ }
51
+ /**
52
+ * Checks if the current directory contains a Slingr application by looking for
53
+ * @slingr/framework-backend in backend/package.json dependencies or devDependencies.
54
+ * Also handles symlinked packages (npm link).
55
+ *
56
+ * @param cwd - The current working directory (defaults to process.cwd())
57
+ * @returns true if framework is found, false otherwise
58
+ */
59
+ async function hasSlingrFramework(cwd = process.cwd()) {
60
+ const backendPath = getBackendPath(cwd);
61
+ const packageJsonPath = path.join(backendPath, 'package.json');
62
+ if (!(await fs.pathExists(packageJsonPath))) {
63
+ return false;
64
+ }
65
+ const packageJson = await fs.readJSON(packageJsonPath);
66
+ const deps = packageJson.dependencies || {};
67
+ const devDeps = packageJson.devDependencies || {};
68
+ return !!deps['@slingr/framework-backend'] || !!devDeps['@slingr/framework-backend'];
69
+ }
70
+ /**
71
+ * Gets the path to the @slingr/framework-backend package.
72
+ * Checks both backend/node_modules (regular install) and root node_modules (npm workspaces).
73
+ * Handles symlinked packages (npm link).
74
+ *
75
+ * @param cwd - The current working directory (defaults to process.cwd())
76
+ * @returns The path to the framework package, or null if not found
77
+ */
78
+ async function getFrameworkPath(cwd = process.cwd()) {
79
+ const backendPath = getBackendPath(cwd);
80
+ // Try backend/node_modules first (regular installation)
81
+ const backendNodeModulesPath = path.join(backendPath, 'node_modules');
82
+ const backendFrameworkPath = path.join(backendNodeModulesPath, '@slingr-framework', 'backend');
83
+ if (await fs.pathExists(backendFrameworkPath)) {
84
+ // Follow symlink if it is one (handles npm link)
85
+ const stats = await fs.lstat(backendFrameworkPath);
86
+ if (stats.isSymbolicLink()) {
87
+ return await fs.realpath(backendFrameworkPath);
88
+ }
89
+ return backendFrameworkPath;
90
+ }
91
+ // Try root node_modules (npm workspaces)
92
+ const rootNodeModulesPath = path.join(cwd, 'node_modules');
93
+ const rootFrameworkPath = path.join(rootNodeModulesPath, '@slingr-framework', 'backend');
94
+ if (await fs.pathExists(rootFrameworkPath)) {
95
+ // Follow symlink if it is one (handles npm link)
96
+ const stats = await fs.lstat(rootFrameworkPath);
97
+ if (stats.isSymbolicLink()) {
98
+ return await fs.realpath(rootFrameworkPath);
99
+ }
100
+ return rootFrameworkPath;
101
+ }
102
+ return null;
103
+ }
104
+ //# sourceMappingURL=checkFramework.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkFramework.js","sourceRoot":"","sources":["../../src/utils/checkFramework.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,wCAEC;AAUD,gDAaC;AAUD,4CA8BC;AA3ED,gDAAkC;AAClC,6CAA+B;AAE/B;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACxD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,kBAAkB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAClE,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAE/D,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,IAAI,EAAE,CAAC;IAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,eAAe,IAAI,EAAE,CAAC;IAElD,OAAO,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACvF,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,gBAAgB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAChE,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IAExC,wDAAwD;IACxD,MAAM,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACtE,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAE/F,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC9C,iDAAiD;QACjD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACnD,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC;YAC3B,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,yCAAyC;IACzC,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAEzF,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC3C,iDAAiD;QACjD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAChD,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC;YAC3B,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { TypeOrmSqlDataSource } from '@slingr/framework-backend';
1
2
  export interface DataSourcePortInfo {
2
3
  database?: string;
3
4
  fileName: string;
@@ -5,6 +6,16 @@ export interface DataSourcePortInfo {
5
6
  port: number;
6
7
  type: string;
7
8
  }
9
+ /**
10
+ * Discover datasource files in the project
11
+ * Returns the filename without extension
12
+ */
13
+ export declare function discoverDatasourceFile(requestedName: string): Promise<string>;
14
+ /**
15
+ * Load datasource configuration from a file
16
+ * Discovers and returns whatever datasource is exported from the file
17
+ */
18
+ export declare function loadDataSourceFromFile(fileName: string): Promise<TypeOrmSqlDataSource>;
8
19
  /**
9
20
  * Extract port information from datasource files
10
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"datasourceParser.d.ts","sourceRoot":"","sources":["../../src/utils/datasourceParser.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAmGjG"}
1
+ {"version":3,"file":"datasourceParser.d.ts","sourceRoot":"","sources":["../../src/utils/datasourceParser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAuB,MAAM,2BAA2B,CAAC;AAItF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BnF;AA4CD;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAgF5F;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA6CjG"}
@@ -3,9 +3,151 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.discoverDatasourceFile = discoverDatasourceFile;
7
+ exports.loadDataSourceFromFile = loadDataSourceFromFile;
6
8
  exports.extractDataSourcePorts = extractDataSourcePorts;
7
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
10
  const node_path_1 = __importDefault(require("node:path"));
11
+ const framework_backend_1 = require("@slingr/framework-backend");
12
+ const checkFramework_1 = require("./checkFramework");
13
+ const infraFileParser_1 = require("./infraFileParser");
14
+ /**
15
+ * Discover datasource files in the project
16
+ * Returns the filename without extension
17
+ */
18
+ async function discoverDatasourceFile(requestedName) {
19
+ const backendPath = (0, checkFramework_1.getBackendPath)();
20
+ const datasourcesDir = node_path_1.default.join(backendPath, 'src', 'dataSources');
21
+ // Check if datasources directory exists
22
+ if (!(await fs_extra_1.default.pathExists(datasourcesDir))) {
23
+ throw new Error(`Datasources directory not found at: ${datasourcesDir}`);
24
+ }
25
+ // Check if the requested file exists
26
+ const requestedPath = node_path_1.default.join(datasourcesDir, `${requestedName}.ts`);
27
+ if (!(await fs_extra_1.default.pathExists(requestedPath))) {
28
+ // List available datasource files for helpful error message
29
+ const files = await fs_extra_1.default.readdir(datasourcesDir);
30
+ const tsFiles = files.filter(f => f.endsWith('.ts') && !f.endsWith('.d.ts'));
31
+ if (tsFiles.length === 0) {
32
+ throw new Error(`No datasource files found in ${datasourcesDir}`);
33
+ }
34
+ throw new Error(`Datasource file '${requestedName}.ts' not found at: ${requestedPath}\n\n` +
35
+ `Available datasource files:\n` +
36
+ tsFiles.map(f => ` • ${f.replace('.ts', '')}`).join('\n'));
37
+ }
38
+ return requestedName;
39
+ }
40
+ /**
41
+ * Check if an object is a TypeOrmSqlDataSource instance using duck typing.
42
+ * This is more reliable than instanceof when dealing with potentially different
43
+ * module instances of @slingr/framework-backend (e.g., CLI vs user app).
44
+ */
45
+ function isTypeOrmSqlDataSourceInstance(candidate) {
46
+ if (!candidate || typeof candidate !== 'object') {
47
+ return false;
48
+ }
49
+ const constructorName = candidate.constructor?.name;
50
+ if (constructorName === 'TypeOrmSqlDataSource') {
51
+ return true;
52
+ }
53
+ return (typeof candidate.initialize === 'function' &&
54
+ typeof candidate.getTypeOrmDataSource === 'function' &&
55
+ typeof candidate.save === 'function' &&
56
+ typeof candidate.findOne === 'function' &&
57
+ typeof candidate.getOptions === 'function');
58
+ }
59
+ /**
60
+ * Check if a value is a class constructor that extends TypeOrmSqlDataSource
61
+ * (the decorated class pattern: @DataSource() export class X extends TypeOrmSqlDataSource).
62
+ */
63
+ function isTypeOrmSqlDataSourceClass(candidate) {
64
+ if (typeof candidate !== 'function') {
65
+ return false;
66
+ }
67
+ let proto = Object.getPrototypeOf(candidate);
68
+ while (proto && proto !== Function.prototype) {
69
+ if (proto.name === 'TypeOrmSqlDataSource') {
70
+ return true;
71
+ }
72
+ proto = Object.getPrototypeOf(proto);
73
+ }
74
+ return false;
75
+ }
76
+ /**
77
+ * Load datasource configuration from a file
78
+ * Discovers and returns whatever datasource is exported from the file
79
+ */
80
+ async function loadDataSourceFromFile(fileName) {
81
+ const backendPath = (0, checkFramework_1.getBackendPath)();
82
+ // Load from the current TypeScript output structure.
83
+ const distDir = node_path_1.default.join(backendPath, 'dist', 'src', 'dataSources');
84
+ const filePath = node_path_1.default.join(distDir, `${fileName}.js`);
85
+ if (!(await fs_extra_1.default.pathExists(filePath))) {
86
+ throw new Error(`Compiled datasource file '${fileName}.js' not found at:\n` +
87
+ ` - ${filePath}\n\n` +
88
+ `Make sure the app is built (npm run build).`);
89
+ }
90
+ // Load the module using require() to ensure consistent module caching with discoverModels()
91
+ // Using import() would create a separate ESM cache, potentially resulting in different
92
+ // datasource instances which would break TypeORM entity metadata association
93
+ let dsModule;
94
+ try {
95
+ const resolvedPath = node_path_1.default.resolve(filePath);
96
+ dsModule = require(resolvedPath);
97
+ }
98
+ catch (error) {
99
+ throw new Error(`Failed to load datasource from '${fileName}.js':\n${error instanceof Error ? error.message : String(error)}`);
100
+ }
101
+ // Load DependencyContainer from the app's own @slingr/framework-backend, not the CLI's.
102
+ // With pnpm, the CLI and the app resolve @slingr/framework-backend to different module
103
+ // instances, each with their own singletons. @DataModel decorators in the app's compiled
104
+ // code register with the APP's DependencyContainer. We must use the same instance here,
105
+ // or we'd get a fresh datasource with an empty registeredModels set.
106
+ let appDependencyContainer;
107
+ try {
108
+ const backendPath = (0, checkFramework_1.getBackendPath)();
109
+ // Resolve the framework entry point the same way the app's compiled code would
110
+ const appFrameworkEntry = require.resolve('@slingr/framework-backend', {
111
+ paths: [backendPath],
112
+ });
113
+ const appFramework = require(appFrameworkEntry);
114
+ appDependencyContainer = appFramework.DependencyContainer;
115
+ if (!appDependencyContainer) {
116
+ throw new Error('DependencyContainer not exported from app framework');
117
+ }
118
+ }
119
+ catch (err) {
120
+ console.warn('[ds] Could not load app framework DependencyContainer, falling back to CLI copy:', err.message);
121
+ appDependencyContainer = framework_backend_1.DependencyContainer;
122
+ }
123
+ // Try to find any TypeOrmSqlDataSource export
124
+ // Check common export names and find the first valid datasource
125
+ const possibleExports = [
126
+ fileName, // Export name matches filename (e.g., postgres.ts exports postgres)
127
+ 'mainDs', // Common convention
128
+ 'default', // Default export
129
+ ...Object.keys(dsModule), // Any other exports
130
+ ];
131
+ for (const exportName of possibleExports) {
132
+ const candidate = dsModule[exportName];
133
+ if (isTypeOrmSqlDataSourceInstance(candidate)) {
134
+ return candidate;
135
+ }
136
+ if (isTypeOrmSqlDataSourceClass(candidate)) {
137
+ // Resolve the DI singleton instead of creating a new instance.
138
+ // When @DataModel decorators run (triggered by discoverModels), they register
139
+ // entities with the DI singleton. Creating a new instance here would produce
140
+ // a datasource with an empty registeredModels set, causing
141
+ // "No metadata for ..." TypeORM errors at save time.
142
+ return appDependencyContainer.resolve(candidate);
143
+ }
144
+ }
145
+ // If no datasource found, provide helpful error
146
+ const availableExports = Object.keys(dsModule).filter(key => !key.startsWith('__'));
147
+ throw new Error(`No TypeOrmSqlDataSource found in '${fileName}.ts'\n\n` +
148
+ `Available exports: ${availableExports.length > 0 ? availableExports.join(', ') : 'none'}\n\n` +
149
+ `Make sure the file exports a class decorated with @DataSource() that extends TypeOrmSqlDataSource.`);
150
+ }
9
151
  /**
10
152
  * Extract port information from datasource files
11
153
  */
@@ -26,65 +168,21 @@ async function extractDataSourcePorts(specificFile) {
26
168
  continue;
27
169
  }
28
170
  const fileContent = await fs_extra_1.default.readFile(filePath, 'utf8');
29
- // Extract values using regex
30
- const extractRaw = (key) => {
31
- const re = new RegExp(key + '\\s*:\\s*([^,\n]+)', 'i');
32
- const m = fileContent.match(re);
33
- return m ? m[1].trim() : null;
34
- };
35
- const interpret = (raw) => {
36
- if (!raw) {
37
- return undefined;
38
- }
39
- raw = raw.replace(/,$/, '').trim();
40
- // Handle boolean values
41
- if (/^(true|false)$/i.test(raw)) {
42
- return raw.toLowerCase() === 'true';
43
- }
44
- // Handle parseInt with fallback
45
- let m = raw.match(/parseInt\([^|]+\|\|\s*['"]([^'"]+)['"]\)/i);
46
- if (m) {
47
- return Number.parseInt(m[1], 10);
48
- }
49
- // Handle environment variables with fallback
50
- m = raw.match(/process\.env\.[A-Z0-9_]+\s*\|\|\s*['"]([^'"]+)['"]/i);
51
- if (m) {
52
- return m[1];
53
- }
54
- // Handle quoted strings
55
- m = raw.match(/^['"]([^'"]+)['"]$/);
56
- if (m) {
57
- return m[1];
58
- }
59
- // Handle plain numbers
60
- m = raw.match(/^(\d+)$/);
61
- if (m) {
62
- return Number.parseInt(m[1], 10);
63
- }
64
- return raw;
65
- };
66
- const typeRaw = extractRaw('type');
67
- if (!typeRaw) {
171
+ const name = file.replace('.ts', '');
172
+ const ds = (0, infraFileParser_1.parseDataSourceFile)(fileContent, name);
173
+ if (!ds) {
68
174
  continue;
69
175
  }
70
- let typeVal = (typeRaw.match(/['"]([^'"]+)['"]/i) || [null, typeRaw])[1].toLowerCase();
71
- if (typeVal === 'postgresql') {
72
- typeVal = 'postgres';
73
- }
74
- if (!['mysql', 'postgres', 'sqlite'].includes(typeVal)) {
75
- continue;
76
- }
77
- const portRaw = extractRaw('port');
78
- const port = interpret(portRaw) ?? (typeVal === 'mysql' ? 3306 : 5432);
79
- if (typeof port === 'number') {
80
- dataSources.push({
81
- database: interpret(extractRaw('database')) ?? undefined,
82
- fileName: file,
83
- host: interpret(extractRaw('host')) ?? 'localhost',
84
- port,
85
- type: typeVal,
86
- });
176
+ const portInfo = {
177
+ fileName: file,
178
+ host: ds.host ?? 'localhost',
179
+ port: ds.port ?? (ds.type === 'mysql' ? 3306 : 5432),
180
+ type: ds.type,
181
+ };
182
+ if (ds.database !== undefined) {
183
+ portInfo.database = ds.database;
87
184
  }
185
+ dataSources.push(portInfo);
88
186
  }
89
187
  return dataSources;
90
188
  }
@@ -1 +1 @@
1
- {"version":3,"file":"datasourceParser.js","sourceRoot":"","sources":["../../src/utils/datasourceParser.ts"],"names":[],"mappings":";;;;;AAcA,wDAmGC;AAjHD,wDAA0B;AAC1B,0DAA6B;AAU7B;;GAEG;AACI,KAAK,UAAU,sBAAsB,CAAC,YAAqB;IAChE,MAAM,cAAc,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;IAEtE,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,6CAA6C;IAC7C,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;IAEzF,MAAM,KAAK,GAAG,YAAY;QACxB,CAAC,CAAC,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OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Utility functions for Docker management.
3
+ * Provides automatic Docker daemon startup and health checking.
4
+ */
5
+ /**
6
+ * Check if Docker is running by attempting to execute `docker ps`.
7
+ *
8
+ * @returns true if Docker daemon is running, false otherwise
9
+ */
10
+ export declare function isDockerRunning(): boolean;
11
+ /**
12
+ * Attempt to start Docker daemon based on the operating system.
13
+ * Tries different commands based on the platform.
14
+ *
15
+ * @returns Promise resolving to true if Docker was started successfully, false otherwise
16
+ */
17
+ export declare function tryStartDocker(): Promise<boolean>;
18
+ /**
19
+ * Ensure Docker is running by checking status and attempting to start if needed.
20
+ * Throws an error with helpful message if Docker cannot be started.
21
+ *
22
+ * @param commandName - Name of the command requiring Docker (for error messages)
23
+ */
24
+ export declare function ensureDockerIsRunning(commandName?: string): Promise<void>;
25
+ //# sourceMappingURL=dockerManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dockerManager.d.ts","sourceRoot":"","sources":["../../src/utils/dockerManager.ts"],"names":[],"mappings":"AAyKA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAiFvD;AAiED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,GAAE,MAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B/F"}