@prisma/cli 2.20.1 → 3.0.0-alpha.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 (217) hide show
  1. package/LICENSE +158 -0
  2. package/README.md +29 -28
  3. package/dist/adapters/config.js +74 -0
  4. package/dist/adapters/local-state.js +98 -0
  5. package/dist/adapters/mock-api.js +57 -0
  6. package/dist/adapters/token-storage.js +43 -0
  7. package/dist/cli.js +9 -0
  8. package/dist/cli2.js +59 -0
  9. package/dist/commands/app/index.js +223 -0
  10. package/dist/commands/auth/index.js +42 -0
  11. package/dist/commands/branch/index.js +51 -0
  12. package/dist/commands/project/index.js +45 -0
  13. package/dist/controllers/app.js +813 -0
  14. package/dist/controllers/auth.js +107 -0
  15. package/dist/controllers/branch.js +73 -0
  16. package/dist/controllers/project.js +214 -0
  17. package/dist/controllers/select-prompt-port.js +12 -0
  18. package/dist/lib/app/bun-project.js +39 -0
  19. package/dist/lib/app/env-vars.js +24 -0
  20. package/dist/lib/app/local-dev.js +149 -0
  21. package/dist/lib/app/preview-build.js +283 -0
  22. package/dist/lib/app/preview-interaction.js +38 -0
  23. package/dist/lib/app/preview-progress.js +139 -0
  24. package/dist/lib/app/preview-provider.js +232 -0
  25. package/dist/lib/auth/auth-ops.js +57 -0
  26. package/dist/lib/auth/client.js +22 -0
  27. package/dist/lib/auth/guard.js +34 -0
  28. package/dist/lib/auth/login.js +117 -0
  29. package/dist/output/patterns.js +93 -0
  30. package/dist/presenters/app.js +405 -0
  31. package/dist/presenters/auth.js +73 -0
  32. package/dist/presenters/branch.js +111 -0
  33. package/dist/presenters/project.js +84 -0
  34. package/dist/shell/command-meta.js +320 -0
  35. package/dist/shell/command-runner.js +33 -0
  36. package/dist/shell/errors.js +66 -0
  37. package/dist/shell/global-flags.js +25 -0
  38. package/dist/shell/help.js +78 -0
  39. package/dist/shell/output.js +54 -0
  40. package/dist/shell/prompt.js +31 -0
  41. package/dist/shell/runtime.js +51 -0
  42. package/dist/shell/ui.js +59 -0
  43. package/dist/use-cases/auth.js +70 -0
  44. package/dist/use-cases/branch.js +95 -0
  45. package/dist/use-cases/create-cli-gateways.js +93 -0
  46. package/dist/use-cases/project.js +75 -0
  47. package/package.json +49 -137
  48. package/build/child.js +0 -4110
  49. package/build/index.js +0 -104447
  50. package/build/public/.DS_Store +0 -0
  51. package/build/public/assets/alert.60ea9f84.svg +0 -5
  52. package/build/public/assets/array.1a36c222.svg +0 -4
  53. package/build/public/assets/boolean.9188b434.svg +0 -4
  54. package/build/public/assets/browser.21a575be.js +0 -1
  55. package/build/public/assets/browser.38b7fdb1.js +0 -1
  56. package/build/public/assets/browser.cdd2249a.js +0 -1
  57. package/build/public/assets/chevron-down.24f76e3c.svg +0 -3
  58. package/build/public/assets/cross.c2610cf5.svg +0 -11
  59. package/build/public/assets/datetime.a3bf710a.svg +0 -4
  60. package/build/public/assets/download.8d34b65a.svg +0 -4
  61. package/build/public/assets/ellipsis.a8c5a34a.svg +0 -10
  62. package/build/public/assets/enum.7ec0b64c.svg +0 -6
  63. package/build/public/assets/folder.d77b8eaf.svg +0 -6
  64. package/build/public/assets/hamburger.5fdadeac.svg +0 -4
  65. package/build/public/assets/logotype.a960b169.svg +0 -4
  66. package/build/public/assets/number.85ddf96b.svg +0 -7
  67. package/build/public/assets/object.0ba944a6.svg +0 -5
  68. package/build/public/assets/play.8811691e.svg +0 -6
  69. package/build/public/assets/plus.8fbf7ad3.svg +0 -4
  70. package/build/public/assets/read.79154521.svg +0 -1
  71. package/build/public/assets/refresh.d5448ccc.svg +0 -4
  72. package/build/public/assets/search.2ed766ce.svg +0 -7
  73. package/build/public/assets/settings.5ad25af2.svg +0 -8
  74. package/build/public/assets/string.ea615a24.svg +0 -4
  75. package/build/public/assets/tick-indeterminate.aec8a44d.svg +0 -3
  76. package/build/public/assets/tick.8cbb6a93.svg +0 -4
  77. package/build/public/assets/vendor.c4d0f081.js +0 -354
  78. package/build/public/demo.html +0 -17
  79. package/build/public/demoChunk.js +0 -2
  80. package/build/public/electron-darwin.html +0 -19
  81. package/build/public/electron-linux.html +0 -18
  82. package/build/public/electron-mac.html +0 -18
  83. package/build/public/electron-win.html +0 -17
  84. package/build/public/electron-win32.html +0 -18
  85. package/build/public/electron.html +0 -17
  86. package/build/public/electronBus.js +0 -2
  87. package/build/public/electronChunk.js +0 -2
  88. package/build/public/favicon/apple-touch-icon.png +0 -0
  89. package/build/public/favicon/favicon-16x16.png +0 -0
  90. package/build/public/favicon/favicon-32x32.png +0 -0
  91. package/build/public/favicon/prisma.png +0 -0
  92. package/build/public/favicon.svg +0 -5
  93. package/build/public/fonts/.DS_Store +0 -0
  94. package/build/public/fonts/Inter.ttf +0 -0
  95. package/build/public/fonts/RobotoMono.ttf +0 -0
  96. package/build/public/icons/.DS_Store +0 -0
  97. package/build/public/icons/alert.svg +0 -5
  98. package/build/public/icons/array.svg +0 -4
  99. package/build/public/icons/bin.svg +0 -37
  100. package/build/public/icons/boolean.svg +0 -4
  101. package/build/public/icons/check.svg +0 -3
  102. package/build/public/icons/chevron-down.svg +0 -3
  103. package/build/public/icons/code.svg +0 -4
  104. package/build/public/icons/cross.svg +0 -11
  105. package/build/public/icons/data-tool.svg +0 -5
  106. package/build/public/icons/database.svg +0 -4
  107. package/build/public/icons/datetime.svg +0 -4
  108. package/build/public/icons/double-arrow-right.svg +0 -4
  109. package/build/public/icons/download.svg +0 -4
  110. package/build/public/icons/ellipsis.svg +0 -10
  111. package/build/public/icons/enum.svg +0 -6
  112. package/build/public/icons/expand.svg +0 -4
  113. package/build/public/icons/eye.svg +0 -20
  114. package/build/public/icons/filters.svg +0 -5
  115. package/build/public/icons/folder.svg +0 -6
  116. package/build/public/icons/hamburger.svg +0 -4
  117. package/build/public/icons/icon.svg +0 -199
  118. package/build/public/icons/logo.svg +0 -199
  119. package/build/public/icons/logotype.svg +0 -4
  120. package/build/public/icons/number.svg +0 -7
  121. package/build/public/icons/object.svg +0 -5
  122. package/build/public/icons/play.svg +0 -6
  123. package/build/public/icons/plus.svg +0 -4
  124. package/build/public/icons/refresh.svg +0 -4
  125. package/build/public/icons/search.svg +0 -7
  126. package/build/public/icons/settings.svg +0 -8
  127. package/build/public/icons/string.svg +0 -4
  128. package/build/public/icons/tick-indeterminate.svg +0 -3
  129. package/build/public/icons/tick.svg +0 -4
  130. package/build/public/illustrations/.DS_Store +0 -0
  131. package/build/public/illustrations/empty.svg +0 -1
  132. package/build/public/illustrations/read.svg +0 -1
  133. package/build/public/illustrations/searching.svg +0 -1
  134. package/build/public/images/.DS_Store +0 -0
  135. package/build/public/images/icon-1024.png +0 -0
  136. package/build/public/index.css +0 -1
  137. package/build/public/index.html +0 -49
  138. package/build/public/index.js +0 -1
  139. package/build/public/main.31f688a6254e294d9128.css +0 -118
  140. package/build/public/main.31f688a6254e294d9128.css.map +0 -1
  141. package/build/public/main.364c712f32662ff0e43d.css +0 -116
  142. package/build/public/main.364c712f32662ff0e43d.css.map +0 -1
  143. package/build/public/main.42ef3fe7e97347765c91.css +0 -118
  144. package/build/public/main.42ef3fe7e97347765c91.css.map +0 -1
  145. package/build/public/main.503446defafe7aeca2f3.css +0 -116
  146. package/build/public/main.503446defafe7aeca2f3.css.map +0 -1
  147. package/build/public/main.c50a3b5980fe26f78b65.css +0 -118
  148. package/build/public/main.c50a3b5980fe26f78b65.css.map +0 -1
  149. package/build/public/main.cda25e5813776c2af295.css +0 -116
  150. package/build/public/main.cda25e5813776c2af295.css.map +0 -1
  151. package/build/public/main.dbac3b290f78404ff579.css +0 -116
  152. package/build/public/main.dbac3b290f78404ff579.css.map +0 -1
  153. package/build/public/main.f8ce44e122e5e2b8f778.css +0 -118
  154. package/build/public/main.f8ce44e122e5e2b8f778.css.map +0 -1
  155. package/build/public/main.fc9ea7521a4aecce1a77.css +0 -118
  156. package/build/public/main.fc9ea7521a4aecce1a77.css.map +0 -1
  157. package/build/public/main.js +0 -403
  158. package/build/public/main.js.map +0 -1
  159. package/build/public/mainChunk.0a84f3ba4d2ab481e877.css +0 -116
  160. package/build/public/mainChunk.1b327d58afbddc917bce.css +0 -118
  161. package/build/public/mainChunk.2cdf583b2bd51aa67587.css +0 -118
  162. package/build/public/mainChunk.544af00f7e9ffcbe782c.css +0 -118
  163. package/build/public/mainChunk.56f96a13868b2b4a53be.css +0 -118
  164. package/build/public/mainChunk.5cee429bfbf06e7ecb39.css +0 -118
  165. package/build/public/mainChunk.a862474ed4cdb421ffa2.css +0 -118
  166. package/build/public/mainChunk.ada34153c4911b5ac22b.css +0 -118
  167. package/build/public/mainChunk.c16a8d01b2c49b2f2751.css +0 -118
  168. package/build/public/mainChunk.ca4a878d5478b9320be8.css +0 -116
  169. package/build/public/mainChunk.e3adc8758b4395546cef.css +0 -116
  170. package/build/public/mainChunk.f2c59fcbfc455d8b9de5.css +0 -118
  171. package/build/public/mainChunk.js +0 -396
  172. package/build/public/manifest.json +0 -34
  173. package/build/public/preview.html +0 -16
  174. package/build/public/previewBus.js +0 -2
  175. package/build/public/previewChunk.js +0 -2
  176. package/build/public/projects.html +0 -86
  177. package/build/public/server.html +0 -16
  178. package/build/public/serverBus.js +0 -2
  179. package/build/public/serverChunk.js +0 -2
  180. package/build/public/splash.html +0 -17
  181. package/build/public/studioBundle.828f34b1781061528841.css +0 -118
  182. package/build/public/studioBundle.bfe9138b2e0293fcb7da.css +0 -118
  183. package/build/public/studioBundle.c5b256eede880e502aac.css +0 -118
  184. package/build/public/studioBundle.e43df511c8e2e368900a.css +0 -118
  185. package/build/public/studioBundle.e69382554c2a2942ae32.css +0 -118
  186. package/build/public/studioBundle.ee21aa56a3999a2b380b.css +0 -118
  187. package/build/public/studioBundle.js +0 -396
  188. package/build/public/vercel.html +0 -16
  189. package/build/public/vercelChunk.js +0 -2
  190. package/build/public/views/index.pug +0 -89
  191. package/build/xdg-open +0 -1066
  192. package/install/index.js +0 -5
  193. package/preinstall/index.js +0 -46
  194. package/prisma-client/README.md +0 -27
  195. package/prisma-client/generator-build/.DS_Store +0 -0
  196. package/prisma-client/generator-build/index.js +0 -79697
  197. package/prisma-client/index-browser.js +0 -3
  198. package/prisma-client/index.d.ts +0 -1
  199. package/prisma-client/index.js +0 -11
  200. package/prisma-client/package.json +0 -138
  201. package/prisma-client/runtime/index-browser.d.ts +0 -267
  202. package/prisma-client/runtime/index-browser.js +0 -2273
  203. package/prisma-client/runtime/index.d.ts +0 -1018
  204. package/prisma-client/runtime/index.js +0 -35028
  205. package/prisma-client/scripts/backup-index-browser.js +0 -3
  206. package/prisma-client/scripts/backup-index.d.ts +0 -1
  207. package/prisma-client/scripts/backup-index.js +0 -11
  208. package/prisma-client/scripts/colors.js +0 -180
  209. package/prisma-client/scripts/default-index-browser.js +0 -12
  210. package/prisma-client/scripts/default-index.d.ts +0 -47
  211. package/prisma-client/scripts/default-index.js +0 -12
  212. package/prisma-client/scripts/get-packed-client.js +0 -12
  213. package/prisma-client/scripts/mock-fs.js +0 -14
  214. package/prisma-client/scripts/postinstall.d.ts +0 -5
  215. package/prisma-client/scripts/postinstall.js +0 -398
  216. package/scripts/install-entry.js +0 -8
  217. package/scripts/preinstall-entry.js +0 -9
@@ -0,0 +1,223 @@
1
+ import { attachCommandDescriptor } from "../../shell/command-meta.js";
2
+ import { addGlobalFlags } from "../../shell/global-flags.js";
3
+ import { configureRuntimeCommand } from "../../shell/runtime.js";
4
+ import { runAppBuild, runAppDeploy, runAppListDeploys, runAppListEnv, runAppLogs, runAppOpen, runAppPromote, runAppRemove, runAppRollback, runAppRun, runAppShow, runAppShowDeploy, runAppUpdateEnv } from "../../controllers/app.js";
5
+ import { renderAppBuild, renderAppDeploy, renderAppListDeploys, renderAppListEnv, renderAppOpen, renderAppPromote, renderAppRemove, renderAppRollback, renderAppRun, renderAppShow, renderAppShowDeploy, renderAppUpdateEnv, serializeAppBuild, serializeAppDeploy, serializeAppListDeploys, serializeAppListEnv, serializeAppOpen, serializeAppPromote, serializeAppRemove, serializeAppRollback, serializeAppRun, serializeAppShow, serializeAppShowDeploy, serializeAppUpdateEnv } from "../../presenters/app.js";
6
+ import { runCommand } from "../../shell/command-runner.js";
7
+ import { Command, Option } from "commander";
8
+ //#region src/commands/app/index.ts
9
+ function createAppCommand(runtime) {
10
+ const app = attachCommandDescriptor(configureRuntimeCommand(new Command("app"), runtime), "app");
11
+ app.addCommand(createBuildCommand(runtime));
12
+ app.addCommand(createRunCommand(runtime));
13
+ app.addCommand(createDeployCommand(runtime));
14
+ app.addCommand(createUpdateEnvCommand(runtime));
15
+ app.addCommand(createListEnvCommand(runtime));
16
+ app.addCommand(createShowCommand(runtime));
17
+ app.addCommand(createOpenCommand(runtime));
18
+ app.addCommand(createLogsCommand(runtime));
19
+ app.addCommand(createListDeploysCommand(runtime));
20
+ app.addCommand(createShowDeployCommand(runtime));
21
+ app.addCommand(createPromoteCommand(runtime));
22
+ app.addCommand(createRollbackCommand(runtime));
23
+ app.addCommand(createRemoveCommand(runtime));
24
+ return app;
25
+ }
26
+ function createBuildCommand(runtime) {
27
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("build"), runtime), "app.build");
28
+ command.addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto builds")).addOption(new Option("--build-type <type>", "Local build type").choices([
29
+ "auto",
30
+ "bun",
31
+ "nextjs"
32
+ ]).default("auto"));
33
+ addGlobalFlags(command);
34
+ command.action(async (options) => {
35
+ const entry = options.entry;
36
+ const buildType = options.buildType;
37
+ await runCommand(runtime, "app.build", options, (context) => runAppBuild(context, entry, buildType), {
38
+ renderHuman: (context, descriptor, result) => renderAppBuild(context, descriptor, result),
39
+ renderJson: (result) => serializeAppBuild(result)
40
+ });
41
+ });
42
+ return command;
43
+ }
44
+ function createRunCommand(runtime) {
45
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("run"), runtime), "app.run");
46
+ command.addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto runs")).addOption(new Option("--build-type <type>", "Local framework type").choices([
47
+ "auto",
48
+ "bun",
49
+ "nextjs"
50
+ ]).default("auto")).addOption(new Option("--port <port>", "Local port"));
51
+ addGlobalFlags(command);
52
+ command.action(async (options) => {
53
+ const entry = options.entry;
54
+ const buildType = options.buildType;
55
+ const port = options.port;
56
+ await runCommand(runtime, "app.run", options, (context) => runAppRun(context, entry, buildType, port), {
57
+ renderHuman: (context, descriptor, result) => renderAppRun(context, descriptor, result),
58
+ renderJson: (result) => serializeAppRun(result)
59
+ });
60
+ });
61
+ return command;
62
+ }
63
+ function createDeployCommand(runtime) {
64
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("deploy"), runtime), "app.deploy");
65
+ command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto deploys")).addOption(new Option("--build-type <type>", "Deploy build type").choices([
66
+ "auto",
67
+ "bun",
68
+ "nextjs"
69
+ ]).default("auto")).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
70
+ addGlobalFlags(command);
71
+ command.action(async (options) => {
72
+ const appName = options.app;
73
+ const entry = options.entry;
74
+ const buildType = options.buildType;
75
+ const httpPort = options.httpPort;
76
+ const envAssignments = options.env;
77
+ await runCommand(runtime, "app.deploy", options, (context) => runAppDeploy(context, appName, {
78
+ entrypoint: entry,
79
+ buildType,
80
+ httpPort,
81
+ envAssignments
82
+ }), {
83
+ renderHuman: (context, descriptor, result) => renderAppDeploy(context, descriptor, result),
84
+ renderJson: (result) => serializeAppDeploy(result)
85
+ });
86
+ });
87
+ return command;
88
+ }
89
+ function createUpdateEnvCommand(runtime) {
90
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("update-env"), runtime), "app.update-env");
91
+ command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
92
+ addGlobalFlags(command);
93
+ command.action(async (options) => {
94
+ const appName = options.app;
95
+ const envAssignments = options.env;
96
+ await runCommand(runtime, "app.update-env", options, (context) => runAppUpdateEnv(context, appName, envAssignments), {
97
+ renderHuman: (context, descriptor, result) => renderAppUpdateEnv(context, descriptor, result),
98
+ renderJson: (result) => serializeAppUpdateEnv(result)
99
+ });
100
+ });
101
+ return command;
102
+ }
103
+ function createListEnvCommand(runtime) {
104
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list-env"), runtime), "app.list-env");
105
+ command.addOption(new Option("--app <name>", "App name"));
106
+ addGlobalFlags(command);
107
+ command.action(async (options) => {
108
+ const appName = options.app;
109
+ await runCommand(runtime, "app.list-env", options, (context) => runAppListEnv(context, appName), {
110
+ renderHuman: (context, descriptor, result) => renderAppListEnv(context, descriptor, result),
111
+ renderJson: (result) => serializeAppListEnv(result)
112
+ });
113
+ });
114
+ return command;
115
+ }
116
+ function createShowCommand(runtime) {
117
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "app.show");
118
+ command.addOption(new Option("--app <name>", "App name"));
119
+ addGlobalFlags(command);
120
+ command.action(async (options) => {
121
+ const appName = options.app;
122
+ await runCommand(runtime, "app.show", options, (context) => runAppShow(context, appName), {
123
+ renderHuman: (context, descriptor, result) => renderAppShow(context, descriptor, result),
124
+ renderJson: (result) => serializeAppShow(result)
125
+ });
126
+ });
127
+ return command;
128
+ }
129
+ function createOpenCommand(runtime) {
130
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("open"), runtime), "app.open");
131
+ command.addOption(new Option("--app <name>", "App name"));
132
+ addGlobalFlags(command);
133
+ command.action(async (options) => {
134
+ const appName = options.app;
135
+ await runCommand(runtime, "app.open", options, (context) => runAppOpen(context, appName), {
136
+ renderHuman: (context, descriptor, result) => renderAppOpen(context, descriptor, result),
137
+ renderJson: (result) => serializeAppOpen(result)
138
+ });
139
+ });
140
+ return command;
141
+ }
142
+ function createLogsCommand(runtime) {
143
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logs"), runtime), "app.logs");
144
+ command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--deployment <id>", "Deployment id"));
145
+ addGlobalFlags(command);
146
+ command.action(async (options) => {
147
+ const appName = options.app;
148
+ const deploymentId = options.deployment;
149
+ await runCommand(runtime, "app.logs", options, (context) => runAppLogs(context, appName, deploymentId), { renderHuman: () => [] });
150
+ });
151
+ return command;
152
+ }
153
+ function collectRepeatableValues(value, previous) {
154
+ return [...previous ?? [], value];
155
+ }
156
+ function createListDeploysCommand(runtime) {
157
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list-deploys"), runtime), "app.list-deploys");
158
+ command.addOption(new Option("--app <name>", "App name"));
159
+ addGlobalFlags(command);
160
+ command.action(async (options) => {
161
+ const appName = options.app;
162
+ await runCommand(runtime, "app.list-deploys", options, (context) => runAppListDeploys(context, appName), {
163
+ renderHuman: (context, descriptor, result) => renderAppListDeploys(context, descriptor, result),
164
+ renderJson: (result) => serializeAppListDeploys(result)
165
+ });
166
+ });
167
+ return command;
168
+ }
169
+ function createShowDeployCommand(runtime) {
170
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show-deploy"), runtime), "app.show-deploy");
171
+ command.argument("<deployment>", "Deployment id");
172
+ addGlobalFlags(command);
173
+ command.action(async (deploymentId, options) => {
174
+ await runCommand(runtime, "app.show-deploy", options, (context) => runAppShowDeploy(context, deploymentId), {
175
+ renderHuman: (context, descriptor, result) => renderAppShowDeploy(context, descriptor, result),
176
+ renderJson: (result) => serializeAppShowDeploy(result)
177
+ });
178
+ });
179
+ return command;
180
+ }
181
+ function createPromoteCommand(runtime) {
182
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("promote"), runtime), "app.promote");
183
+ command.argument("<deployment>", "Deployment id");
184
+ command.addOption(new Option("--app <name>", "App name"));
185
+ addGlobalFlags(command);
186
+ command.action(async (deploymentId, options) => {
187
+ const appName = options.app;
188
+ await runCommand(runtime, "app.promote", options, (context) => runAppPromote(context, deploymentId, appName), {
189
+ renderHuman: (context, descriptor, result) => renderAppPromote(context, descriptor, result),
190
+ renderJson: (result) => serializeAppPromote(result)
191
+ });
192
+ });
193
+ return command;
194
+ }
195
+ function createRollbackCommand(runtime) {
196
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("rollback"), runtime), "app.rollback");
197
+ command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--to <deployment>", "Deployment id"));
198
+ addGlobalFlags(command);
199
+ command.action(async (options) => {
200
+ const appName = options.app;
201
+ const deploymentId = options.to;
202
+ await runCommand(runtime, "app.rollback", options, (context) => runAppRollback(context, appName, deploymentId), {
203
+ renderHuman: (context, descriptor, result) => renderAppRollback(context, descriptor, result),
204
+ renderJson: (result) => serializeAppRollback(result)
205
+ });
206
+ });
207
+ return command;
208
+ }
209
+ function createRemoveCommand(runtime) {
210
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "app.remove");
211
+ command.addOption(new Option("--app <name>", "App name"));
212
+ addGlobalFlags(command);
213
+ command.action(async (options) => {
214
+ const appName = options.app;
215
+ await runCommand(runtime, "app.remove", options, (context) => runAppRemove(context, appName), {
216
+ renderHuman: (context, descriptor, result) => renderAppRemove(context, descriptor, result),
217
+ renderJson: (result) => serializeAppRemove(result)
218
+ });
219
+ });
220
+ return command;
221
+ }
222
+ //#endregion
223
+ export { createAppCommand };
@@ -0,0 +1,42 @@
1
+ import { attachCommandDescriptor } from "../../shell/command-meta.js";
2
+ import { addGlobalFlags } from "../../shell/global-flags.js";
3
+ import { configureRuntimeCommand } from "../../shell/runtime.js";
4
+ import { runCommand } from "../../shell/command-runner.js";
5
+ import { runAuthLogin, runAuthLogout, runAuthWhoAmI } from "../../controllers/auth.js";
6
+ import { renderAuthSuccess } from "../../presenters/auth.js";
7
+ import { Command, Option } from "commander";
8
+ //#region src/commands/auth/index.ts
9
+ function createAuthCommand(runtime) {
10
+ const auth = attachCommandDescriptor(configureRuntimeCommand(new Command("auth"), runtime), "auth");
11
+ auth.addCommand(createAuthLoginCommand(runtime));
12
+ auth.addCommand(createAuthLogoutCommand(runtime));
13
+ auth.addCommand(createAuthWhoAmICommand(runtime));
14
+ return auth;
15
+ }
16
+ function createAuthLoginCommand(runtime) {
17
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("login"), runtime), "auth.login");
18
+ command.addOption(new Option("--provider <provider>").hideHelp()).addOption(new Option("--user <id>").hideHelp()).addOption(new Option("--workspace <id>").hideHelp());
19
+ addGlobalFlags(command);
20
+ command.action(async (options) => {
21
+ await runCommand(runtime, "auth.login", options, (context) => runAuthLogin(context, options), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.login", result) });
22
+ });
23
+ return command;
24
+ }
25
+ function createAuthLogoutCommand(runtime) {
26
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logout"), runtime), "auth.logout");
27
+ addGlobalFlags(command);
28
+ command.action(async (options) => {
29
+ await runCommand(runtime, "auth.logout", options, (context) => runAuthLogout(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.logout", result) });
30
+ });
31
+ return command;
32
+ }
33
+ function createAuthWhoAmICommand(runtime) {
34
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("whoami"), runtime), "auth.whoami");
35
+ addGlobalFlags(command);
36
+ command.action(async (options) => {
37
+ await runCommand(runtime, "auth.whoami", options, (context) => runAuthWhoAmI(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.whoami", result) });
38
+ });
39
+ return command;
40
+ }
41
+ //#endregion
42
+ export { createAuthCommand };
@@ -0,0 +1,51 @@
1
+ import { attachCommandDescriptor } from "../../shell/command-meta.js";
2
+ import { addGlobalFlags } from "../../shell/global-flags.js";
3
+ import { configureRuntimeCommand } from "../../shell/runtime.js";
4
+ import { runCommand } from "../../shell/command-runner.js";
5
+ import { runBranchList, runBranchShow, runBranchUse } from "../../controllers/branch.js";
6
+ import { renderBranchList, renderBranchShow, renderBranchUse, serializeBranchList, serializeBranchShow } from "../../presenters/branch.js";
7
+ import { Command } from "commander";
8
+ //#region src/commands/branch/index.ts
9
+ function createBranchCommand(runtime) {
10
+ const branch = attachCommandDescriptor(configureRuntimeCommand(new Command("branch"), runtime), "branch");
11
+ branch.addCommand(createBranchListCommand(runtime));
12
+ branch.addCommand(createBranchShowCommand(runtime));
13
+ branch.addCommand(createBranchUseCommand(runtime));
14
+ return branch;
15
+ }
16
+ function createBranchListCommand(runtime) {
17
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "branch.list");
18
+ addGlobalFlags(command);
19
+ command.action(async (options) => {
20
+ await runCommand(runtime, "branch.list", options, (context) => runBranchList(context), {
21
+ renderHuman: (context, descriptor, result) => renderBranchList(context, descriptor, result),
22
+ renderJson: (result) => serializeBranchList(result)
23
+ });
24
+ });
25
+ return command;
26
+ }
27
+ function createBranchShowCommand(runtime) {
28
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "branch.show");
29
+ addGlobalFlags(command);
30
+ command.action(async (options) => {
31
+ await runCommand(runtime, "branch.show", options, (context) => runBranchShow(context), {
32
+ renderHuman: (context, descriptor, result) => renderBranchShow(context, descriptor, result),
33
+ renderJson: (result) => serializeBranchShow(result)
34
+ });
35
+ });
36
+ return command;
37
+ }
38
+ function createBranchUseCommand(runtime) {
39
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("use"), runtime), "branch.use");
40
+ command.argument("[name]", "Branch name");
41
+ addGlobalFlags(command);
42
+ command.action(async (branchName, options) => {
43
+ await runCommand(runtime, "branch.use", options, (context) => runBranchUse(context, branchName), {
44
+ renderHuman: (context, descriptor, result) => renderBranchUse(context, descriptor, result),
45
+ renderJson: (result) => serializeBranchShow(result)
46
+ });
47
+ });
48
+ return command;
49
+ }
50
+ //#endregion
51
+ export { createBranchCommand };
@@ -0,0 +1,45 @@
1
+ import { attachCommandDescriptor } from "../../shell/command-meta.js";
2
+ import { addGlobalFlags } from "../../shell/global-flags.js";
3
+ import { configureRuntimeCommand } from "../../shell/runtime.js";
4
+ import { runCommand } from "../../shell/command-runner.js";
5
+ import { runProjectLink, runProjectList, runProjectShow } from "../../controllers/project.js";
6
+ import { renderProjectLink, renderProjectList, renderProjectShow, serializeProjectList } from "../../presenters/project.js";
7
+ import { Command } from "commander";
8
+ //#region src/commands/project/index.ts
9
+ function createProjectCommand(runtime) {
10
+ const project = attachCommandDescriptor(configureRuntimeCommand(new Command("project"), runtime), "project");
11
+ project.addCommand(createProjectListCommand(runtime));
12
+ project.addCommand(createProjectShowCommand(runtime));
13
+ project.addCommand(createProjectLinkCommand(runtime));
14
+ return project;
15
+ }
16
+ function createProjectListCommand(runtime) {
17
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "project.list");
18
+ addGlobalFlags(command);
19
+ command.action(async (options) => {
20
+ await runCommand(runtime, "project.list", options, (context) => runProjectList(context), {
21
+ renderHuman: (context, descriptor, result) => renderProjectList(context, descriptor, result),
22
+ renderJson: (result) => serializeProjectList(result)
23
+ });
24
+ });
25
+ return command;
26
+ }
27
+ function createProjectShowCommand(runtime) {
28
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "project.show");
29
+ addGlobalFlags(command);
30
+ command.action(async (options) => {
31
+ await runCommand(runtime, "project.show", options, (context) => runProjectShow(context), { renderHuman: (context, descriptor, result) => renderProjectShow(context, descriptor, result) });
32
+ });
33
+ return command;
34
+ }
35
+ function createProjectLinkCommand(runtime) {
36
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("link"), runtime), "project.link");
37
+ command.argument("[project]", "Project id");
38
+ addGlobalFlags(command);
39
+ command.action(async (projectId, options) => {
40
+ await runCommand(runtime, "project.link", options, (context) => runProjectLink(context, projectId), { renderHuman: (context, descriptor, result) => renderProjectLink(context, descriptor, result) });
41
+ });
42
+ return command;
43
+ }
44
+ //#endregion
45
+ export { createProjectCommand };