@contember/cli 2.0.0-alpha.9 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/contember-docker.sh +0 -0
  2. package/dist/development/run.cjs.map +1 -1
  3. package/dist/development/run.js.map +1 -1
  4. package/dist/development/src/commands/deploy/DeployCommand.cjs +5 -5
  5. package/dist/development/src/commands/deploy/DeployCommand.cjs.map +1 -1
  6. package/dist/development/src/commands/deploy/DeployCommand.js +5 -5
  7. package/dist/development/src/commands/deploy/DeployCommand.js.map +1 -1
  8. package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs +15 -3
  9. package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
  10. package/dist/development/src/commands/migrations/MigrationAmendCommand.js +15 -3
  11. package/dist/development/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
  12. package/dist/development/src/commands/migrations/MigrationBlankCommand.cjs.map +1 -1
  13. package/dist/development/src/commands/migrations/MigrationBlankCommand.js.map +1 -1
  14. package/dist/development/src/commands/migrations/MigrationDescribeCommand.cjs.map +1 -1
  15. package/dist/development/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
  16. package/dist/development/src/commands/migrations/MigrationDiffCommand.cjs +1 -1
  17. package/dist/development/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
  18. package/dist/development/src/commands/migrations/MigrationDiffCommand.js +1 -1
  19. package/dist/development/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
  20. package/dist/development/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
  21. package/dist/development/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
  22. package/dist/development/src/commands/migrations/MigrationRebaseCommand.cjs.map +1 -1
  23. package/dist/development/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
  24. package/dist/development/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
  25. package/dist/development/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
  26. package/dist/development/src/commands/misc/VersionCommand.cjs.map +1 -1
  27. package/dist/development/src/commands/misc/VersionCommand.js.map +1 -1
  28. package/dist/development/src/commands/project/ProjectGenerateDocumentationCommand.cjs.map +1 -1
  29. package/dist/development/src/commands/project/ProjectGenerateDocumentationCommand.js.map +1 -1
  30. package/dist/development/src/commands/project/ProjectPrintSchemaCommand.cjs +13 -2
  31. package/dist/development/src/commands/project/ProjectPrintSchemaCommand.cjs.map +1 -1
  32. package/dist/development/src/commands/project/ProjectPrintSchemaCommand.js +14 -3
  33. package/dist/development/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
  34. package/dist/development/src/commands/project/ProjectValidateCommand.cjs.map +1 -1
  35. package/dist/development/src/commands/project/ProjectValidateCommand.js.map +1 -1
  36. package/dist/development/src/commands/transfer/ExportCommand.cjs +2 -0
  37. package/dist/development/src/commands/transfer/ExportCommand.cjs.map +1 -1
  38. package/dist/development/src/commands/transfer/ExportCommand.js +2 -0
  39. package/dist/development/src/commands/transfer/ExportCommand.js.map +1 -1
  40. package/dist/development/src/commands/transfer/ImportCommand.cjs.map +1 -1
  41. package/dist/development/src/commands/transfer/ImportCommand.js.map +1 -1
  42. package/dist/development/src/commands/transfer/TransferCommand.cjs +2 -0
  43. package/dist/development/src/commands/transfer/TransferCommand.cjs.map +1 -1
  44. package/dist/development/src/commands/transfer/TransferCommand.js +2 -0
  45. package/dist/development/src/commands/transfer/TransferCommand.js.map +1 -1
  46. package/dist/development/src/commands/transfer/utils.cjs.map +1 -1
  47. package/dist/development/src/commands/transfer/utils.js.map +1 -1
  48. package/dist/development/src/commands/workspace/WorkspaceUpdateApiCommand.cjs.map +1 -1
  49. package/dist/development/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
  50. package/dist/development/src/consts.cjs +3 -1
  51. package/dist/development/src/consts.cjs.map +1 -1
  52. package/dist/development/src/consts.js +4 -2
  53. package/dist/development/src/consts.js.map +1 -1
  54. package/dist/development/src/dic.cjs +3 -1
  55. package/dist/development/src/dic.cjs.map +1 -1
  56. package/dist/development/src/dic.js +3 -1
  57. package/dist/development/src/dic.js.map +1 -1
  58. package/dist/development/src/lib/SystemClientProvider.cjs.map +1 -1
  59. package/dist/development/src/lib/SystemClientProvider.js.map +1 -1
  60. package/dist/development/src/lib/TenantClientProvider.cjs.map +1 -1
  61. package/dist/development/src/lib/TenantClientProvider.js.map +1 -1
  62. package/dist/development/src/lib/VersionChecker.cjs.map +1 -1
  63. package/dist/development/src/lib/VersionChecker.js.map +1 -1
  64. package/dist/development/src/lib/admin/AdminClient.cjs +1 -1
  65. package/dist/development/src/lib/admin/AdminClient.cjs.map +1 -1
  66. package/dist/development/src/lib/admin/AdminClient.js +1 -1
  67. package/dist/development/src/lib/admin/AdminClient.js.map +1 -1
  68. package/dist/development/src/lib/admin/AdminDeployer.cjs.map +1 -1
  69. package/dist/development/src/lib/admin/AdminDeployer.js.map +1 -1
  70. package/dist/development/src/lib/dsn.cjs.map +1 -1
  71. package/dist/development/src/lib/dsn.js.map +1 -1
  72. package/dist/development/src/lib/env.cjs +4 -1
  73. package/dist/development/src/lib/env.cjs.map +1 -1
  74. package/dist/development/src/lib/env.js +4 -1
  75. package/dist/development/src/lib/env.js.map +1 -1
  76. package/dist/development/src/lib/fs/DockerComposeManager.cjs.map +1 -1
  77. package/dist/development/src/lib/fs/DockerComposeManager.js.map +1 -1
  78. package/dist/development/src/lib/fs/FileSystem.cjs.map +1 -1
  79. package/dist/development/src/lib/fs/FileSystem.js.map +1 -1
  80. package/dist/development/src/lib/fs/YamlHandler.cjs.map +1 -1
  81. package/dist/development/src/lib/fs/YamlHandler.js.map +1 -1
  82. package/dist/development/src/lib/js/EsBuildBuilder.cjs +24 -19
  83. package/dist/development/src/lib/js/EsBuildBuilder.cjs.map +1 -1
  84. package/dist/development/src/lib/js/EsBuildBuilder.js +1 -1
  85. package/dist/development/src/lib/js/EsBuildBuilder.js.map +1 -1
  86. package/dist/development/src/lib/js/EvalExecutor.cjs +2 -2
  87. package/dist/development/src/lib/js/EvalExecutor.cjs.map +1 -1
  88. package/dist/development/src/lib/js/EvalExecutor.js +2 -2
  89. package/dist/development/src/lib/js/EvalExecutor.js.map +1 -1
  90. package/dist/development/src/lib/js/JsCodeRunner.cjs.map +1 -1
  91. package/dist/development/src/lib/js/JsCodeRunner.js.map +1 -1
  92. package/dist/development/src/lib/migrations/MigrationExecutionFacade.cjs +1 -1
  93. package/dist/development/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
  94. package/dist/development/src/lib/migrations/MigrationExecutionFacade.js +1 -1
  95. package/dist/development/src/lib/migrations/MigrationExecutionFacade.js.map +1 -1
  96. package/dist/development/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
  97. package/dist/development/src/lib/migrations/MigrationPrinter.js.map +1 -1
  98. package/dist/development/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
  99. package/dist/development/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
  100. package/dist/development/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
  101. package/dist/development/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
  102. package/dist/development/src/lib/migrations/MigrationsValidator.cjs.map +1 -1
  103. package/dist/development/src/lib/migrations/MigrationsValidator.js.map +1 -1
  104. package/dist/development/src/lib/migrations/migrations.cjs.map +1 -1
  105. package/dist/development/src/lib/migrations/migrations.js.map +1 -1
  106. package/dist/development/src/lib/project/RemoteProject.cjs.map +1 -1
  107. package/dist/development/src/lib/project/RemoteProject.js.map +1 -1
  108. package/dist/development/src/lib/project/RemoteProjectProvider.cjs.map +1 -1
  109. package/dist/development/src/lib/project/RemoteProjectProvider.js.map +1 -1
  110. package/dist/development/src/lib/project/RemoteProjectResolver.cjs +9 -2
  111. package/dist/development/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
  112. package/dist/development/src/lib/project/RemoteProjectResolver.js +9 -2
  113. package/dist/development/src/lib/project/RemoteProjectResolver.js.map +1 -1
  114. package/dist/development/src/lib/project/docs/components/EntityInfo.cjs.map +1 -1
  115. package/dist/development/src/lib/project/docs/components/EntityInfo.js.map +1 -1
  116. package/dist/development/src/lib/project/docs/components/FieldLink.cjs.map +1 -1
  117. package/dist/development/src/lib/project/docs/components/FieldLink.js.map +1 -1
  118. package/dist/development/src/lib/project/docs/components/FieldPermissions.cjs.map +1 -1
  119. package/dist/development/src/lib/project/docs/components/FieldPermissions.js.map +1 -1
  120. package/dist/development/src/lib/project/docs/components/FieldType.cjs.map +1 -1
  121. package/dist/development/src/lib/project/docs/components/FieldType.js.map +1 -1
  122. package/dist/development/src/lib/project/docs/components/OnDelete.cjs.map +1 -1
  123. package/dist/development/src/lib/project/docs/components/OnDelete.js.map +1 -1
  124. package/dist/development/src/lib/project/docs/components/ProjectInfo.cjs.map +1 -1
  125. package/dist/development/src/lib/project/docs/components/ProjectInfo.js.map +1 -1
  126. package/dist/development/src/lib/project/docs/components/SinglePermission.cjs.map +1 -1
  127. package/dist/development/src/lib/project/docs/components/SinglePermission.js.map +1 -1
  128. package/dist/development/src/lib/project/docs/projectDescribe.cjs +3 -5
  129. package/dist/development/src/lib/project/docs/projectDescribe.cjs.map +1 -1
  130. package/dist/development/src/lib/project/docs/projectDescribe.js +3 -4
  131. package/dist/development/src/lib/project/docs/projectDescribe.js.map +1 -1
  132. package/dist/development/src/lib/schema/SchemaLoader.cjs.map +1 -1
  133. package/dist/development/src/lib/schema/SchemaLoader.js.map +1 -1
  134. package/dist/development/src/lib/schema/SchemaValidationHelper.cjs.map +1 -1
  135. package/dist/development/src/lib/schema/SchemaValidationPrinter.cjs.map +1 -1
  136. package/dist/development/src/lib/schema/SchemaValidationPrinter.js.map +1 -1
  137. package/dist/development/src/lib/schema/collectReferences.cjs.map +1 -1
  138. package/dist/development/src/lib/schema/collectReferences.js.map +1 -1
  139. package/dist/development/src/lib/stream.cjs.map +1 -1
  140. package/dist/development/src/lib/stream.js.map +1 -1
  141. package/dist/development/src/lib/tenant/TenantClient.cjs +4 -8
  142. package/dist/development/src/lib/tenant/TenantClient.cjs.map +1 -1
  143. package/dist/development/src/lib/tenant/TenantClient.js +3 -7
  144. package/dist/development/src/lib/tenant/TenantClient.js.map +1 -1
  145. package/dist/development/src/lib/transfer/DataTransferClient.cjs +2 -2
  146. package/dist/development/src/lib/transfer/DataTransferClient.cjs.map +1 -1
  147. package/dist/development/src/lib/transfer/DataTransferClient.js +2 -2
  148. package/dist/development/src/lib/transfer/DataTransferClient.js.map +1 -1
  149. package/dist/development/src/lib/transfer/stdio.cjs.map +1 -1
  150. package/dist/development/src/lib/transfer/stdio.js.map +1 -1
  151. package/dist/development/src/lib/workspace/WorkspaceResolver.cjs.map +1 -1
  152. package/dist/development/src/lib/workspace/WorkspaceResolver.js.map +1 -1
  153. package/dist/production/run.cjs.map +1 -1
  154. package/dist/production/run.js +0 -0
  155. package/dist/production/run.js.map +1 -1
  156. package/dist/production/src/commands/deploy/DeployCommand.cjs +5 -5
  157. package/dist/production/src/commands/deploy/DeployCommand.cjs.map +1 -1
  158. package/dist/production/src/commands/deploy/DeployCommand.js +5 -5
  159. package/dist/production/src/commands/deploy/DeployCommand.js.map +1 -1
  160. package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs +15 -3
  161. package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
  162. package/dist/production/src/commands/migrations/MigrationAmendCommand.js +15 -3
  163. package/dist/production/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
  164. package/dist/production/src/commands/migrations/MigrationBlankCommand.cjs.map +1 -1
  165. package/dist/production/src/commands/migrations/MigrationBlankCommand.js.map +1 -1
  166. package/dist/production/src/commands/migrations/MigrationDescribeCommand.cjs.map +1 -1
  167. package/dist/production/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
  168. package/dist/production/src/commands/migrations/MigrationDiffCommand.cjs +1 -1
  169. package/dist/production/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
  170. package/dist/production/src/commands/migrations/MigrationDiffCommand.js +1 -1
  171. package/dist/production/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
  172. package/dist/production/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
  173. package/dist/production/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
  174. package/dist/production/src/commands/migrations/MigrationRebaseCommand.cjs.map +1 -1
  175. package/dist/production/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
  176. package/dist/production/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
  177. package/dist/production/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
  178. package/dist/production/src/commands/misc/VersionCommand.cjs.map +1 -1
  179. package/dist/production/src/commands/misc/VersionCommand.js.map +1 -1
  180. package/dist/production/src/commands/project/ProjectGenerateDocumentationCommand.cjs.map +1 -1
  181. package/dist/production/src/commands/project/ProjectGenerateDocumentationCommand.js.map +1 -1
  182. package/dist/production/src/commands/project/ProjectPrintSchemaCommand.cjs +13 -2
  183. package/dist/production/src/commands/project/ProjectPrintSchemaCommand.cjs.map +1 -1
  184. package/dist/production/src/commands/project/ProjectPrintSchemaCommand.js +14 -3
  185. package/dist/production/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
  186. package/dist/production/src/commands/project/ProjectValidateCommand.cjs.map +1 -1
  187. package/dist/production/src/commands/project/ProjectValidateCommand.js.map +1 -1
  188. package/dist/production/src/commands/transfer/ExportCommand.cjs +2 -0
  189. package/dist/production/src/commands/transfer/ExportCommand.cjs.map +1 -1
  190. package/dist/production/src/commands/transfer/ExportCommand.js +2 -0
  191. package/dist/production/src/commands/transfer/ExportCommand.js.map +1 -1
  192. package/dist/production/src/commands/transfer/ImportCommand.cjs.map +1 -1
  193. package/dist/production/src/commands/transfer/ImportCommand.js.map +1 -1
  194. package/dist/production/src/commands/transfer/TransferCommand.cjs +2 -0
  195. package/dist/production/src/commands/transfer/TransferCommand.cjs.map +1 -1
  196. package/dist/production/src/commands/transfer/TransferCommand.js +2 -0
  197. package/dist/production/src/commands/transfer/TransferCommand.js.map +1 -1
  198. package/dist/production/src/commands/transfer/utils.cjs.map +1 -1
  199. package/dist/production/src/commands/transfer/utils.js.map +1 -1
  200. package/dist/production/src/commands/workspace/WorkspaceUpdateApiCommand.cjs.map +1 -1
  201. package/dist/production/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
  202. package/dist/production/src/consts.cjs +3 -1
  203. package/dist/production/src/consts.cjs.map +1 -1
  204. package/dist/production/src/consts.js +4 -2
  205. package/dist/production/src/consts.js.map +1 -1
  206. package/dist/production/src/dic.cjs +3 -1
  207. package/dist/production/src/dic.cjs.map +1 -1
  208. package/dist/production/src/dic.js +3 -1
  209. package/dist/production/src/dic.js.map +1 -1
  210. package/dist/production/src/lib/SystemClientProvider.cjs.map +1 -1
  211. package/dist/production/src/lib/SystemClientProvider.js.map +1 -1
  212. package/dist/production/src/lib/TenantClientProvider.cjs.map +1 -1
  213. package/dist/production/src/lib/TenantClientProvider.js.map +1 -1
  214. package/dist/production/src/lib/VersionChecker.cjs.map +1 -1
  215. package/dist/production/src/lib/VersionChecker.js.map +1 -1
  216. package/dist/production/src/lib/admin/AdminClient.cjs +1 -1
  217. package/dist/production/src/lib/admin/AdminClient.cjs.map +1 -1
  218. package/dist/production/src/lib/admin/AdminClient.js +1 -1
  219. package/dist/production/src/lib/admin/AdminClient.js.map +1 -1
  220. package/dist/production/src/lib/admin/AdminDeployer.cjs.map +1 -1
  221. package/dist/production/src/lib/admin/AdminDeployer.js.map +1 -1
  222. package/dist/production/src/lib/dsn.cjs.map +1 -1
  223. package/dist/production/src/lib/dsn.js.map +1 -1
  224. package/dist/production/src/lib/env.cjs +4 -1
  225. package/dist/production/src/lib/env.cjs.map +1 -1
  226. package/dist/production/src/lib/env.js +4 -1
  227. package/dist/production/src/lib/env.js.map +1 -1
  228. package/dist/production/src/lib/fs/DockerComposeManager.cjs.map +1 -1
  229. package/dist/production/src/lib/fs/DockerComposeManager.js.map +1 -1
  230. package/dist/production/src/lib/fs/FileSystem.cjs.map +1 -1
  231. package/dist/production/src/lib/fs/FileSystem.js.map +1 -1
  232. package/dist/production/src/lib/fs/YamlHandler.cjs.map +1 -1
  233. package/dist/production/src/lib/fs/YamlHandler.js.map +1 -1
  234. package/dist/production/src/lib/js/EsBuildBuilder.cjs +24 -19
  235. package/dist/production/src/lib/js/EsBuildBuilder.cjs.map +1 -1
  236. package/dist/production/src/lib/js/EsBuildBuilder.js +1 -1
  237. package/dist/production/src/lib/js/EsBuildBuilder.js.map +1 -1
  238. package/dist/production/src/lib/js/EvalExecutor.cjs +2 -2
  239. package/dist/production/src/lib/js/EvalExecutor.cjs.map +1 -1
  240. package/dist/production/src/lib/js/EvalExecutor.js +2 -2
  241. package/dist/production/src/lib/js/EvalExecutor.js.map +1 -1
  242. package/dist/production/src/lib/js/JsCodeRunner.cjs.map +1 -1
  243. package/dist/production/src/lib/js/JsCodeRunner.js.map +1 -1
  244. package/dist/production/src/lib/migrations/MigrationExecutionFacade.cjs +1 -1
  245. package/dist/production/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
  246. package/dist/production/src/lib/migrations/MigrationExecutionFacade.js +1 -1
  247. package/dist/production/src/lib/migrations/MigrationExecutionFacade.js.map +1 -1
  248. package/dist/production/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
  249. package/dist/production/src/lib/migrations/MigrationPrinter.js.map +1 -1
  250. package/dist/production/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
  251. package/dist/production/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
  252. package/dist/production/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
  253. package/dist/production/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
  254. package/dist/production/src/lib/migrations/MigrationsValidator.cjs.map +1 -1
  255. package/dist/production/src/lib/migrations/MigrationsValidator.js.map +1 -1
  256. package/dist/production/src/lib/migrations/migrations.cjs.map +1 -1
  257. package/dist/production/src/lib/migrations/migrations.js.map +1 -1
  258. package/dist/production/src/lib/project/RemoteProject.cjs.map +1 -1
  259. package/dist/production/src/lib/project/RemoteProject.js.map +1 -1
  260. package/dist/production/src/lib/project/RemoteProjectProvider.cjs.map +1 -1
  261. package/dist/production/src/lib/project/RemoteProjectProvider.js.map +1 -1
  262. package/dist/production/src/lib/project/RemoteProjectResolver.cjs +9 -2
  263. package/dist/production/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
  264. package/dist/production/src/lib/project/RemoteProjectResolver.js +9 -2
  265. package/dist/production/src/lib/project/RemoteProjectResolver.js.map +1 -1
  266. package/dist/production/src/lib/project/docs/components/EntityInfo.cjs.map +1 -1
  267. package/dist/production/src/lib/project/docs/components/EntityInfo.js.map +1 -1
  268. package/dist/production/src/lib/project/docs/components/FieldPermissions.cjs.map +1 -1
  269. package/dist/production/src/lib/project/docs/components/FieldPermissions.js.map +1 -1
  270. package/dist/production/src/lib/project/docs/components/FieldType.cjs.map +1 -1
  271. package/dist/production/src/lib/project/docs/components/FieldType.js.map +1 -1
  272. package/dist/production/src/lib/project/docs/components/OnDelete.cjs.map +1 -1
  273. package/dist/production/src/lib/project/docs/components/OnDelete.js.map +1 -1
  274. package/dist/production/src/lib/project/docs/components/ProjectInfo.cjs.map +1 -1
  275. package/dist/production/src/lib/project/docs/components/ProjectInfo.js.map +1 -1
  276. package/dist/production/src/lib/project/docs/components/SinglePermission.cjs.map +1 -1
  277. package/dist/production/src/lib/project/docs/components/SinglePermission.js.map +1 -1
  278. package/dist/production/src/lib/project/docs/projectDescribe.cjs +2 -4
  279. package/dist/production/src/lib/project/docs/projectDescribe.cjs.map +1 -1
  280. package/dist/production/src/lib/project/docs/projectDescribe.js +2 -3
  281. package/dist/production/src/lib/project/docs/projectDescribe.js.map +1 -1
  282. package/dist/production/src/lib/schema/SchemaLoader.cjs.map +1 -1
  283. package/dist/production/src/lib/schema/SchemaLoader.js.map +1 -1
  284. package/dist/production/src/lib/schema/SchemaValidationHelper.cjs.map +1 -1
  285. package/dist/production/src/lib/schema/SchemaValidationPrinter.cjs.map +1 -1
  286. package/dist/production/src/lib/schema/SchemaValidationPrinter.js.map +1 -1
  287. package/dist/production/src/lib/schema/collectReferences.cjs.map +1 -1
  288. package/dist/production/src/lib/schema/collectReferences.js.map +1 -1
  289. package/dist/production/src/lib/stream.cjs.map +1 -1
  290. package/dist/production/src/lib/stream.js.map +1 -1
  291. package/dist/production/src/lib/tenant/TenantClient.cjs +4 -8
  292. package/dist/production/src/lib/tenant/TenantClient.cjs.map +1 -1
  293. package/dist/production/src/lib/tenant/TenantClient.js +3 -7
  294. package/dist/production/src/lib/tenant/TenantClient.js.map +1 -1
  295. package/dist/production/src/lib/transfer/DataTransferClient.cjs +2 -2
  296. package/dist/production/src/lib/transfer/DataTransferClient.cjs.map +1 -1
  297. package/dist/production/src/lib/transfer/DataTransferClient.js +2 -2
  298. package/dist/production/src/lib/transfer/DataTransferClient.js.map +1 -1
  299. package/dist/production/src/lib/transfer/stdio.cjs.map +1 -1
  300. package/dist/production/src/lib/transfer/stdio.js.map +1 -1
  301. package/dist/production/src/lib/workspace/WorkspaceResolver.cjs.map +1 -1
  302. package/dist/production/src/lib/workspace/WorkspaceResolver.js.map +1 -1
  303. package/dist/types/commands/deploy/DeployCommand.d.ts.map +1 -1
  304. package/dist/types/commands/migrations/MigrationAmendCommand.d.ts +1 -0
  305. package/dist/types/commands/migrations/MigrationAmendCommand.d.ts.map +1 -1
  306. package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts +4 -0
  307. package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
  308. package/dist/types/commands/transfer/ExportCommand.d.ts +1 -0
  309. package/dist/types/commands/transfer/ExportCommand.d.ts.map +1 -1
  310. package/dist/types/commands/transfer/TransferCommand.d.ts +1 -0
  311. package/dist/types/commands/transfer/TransferCommand.d.ts.map +1 -1
  312. package/dist/types/consts.d.ts.map +1 -1
  313. package/dist/types/dic.d.ts.map +1 -1
  314. package/dist/types/lib/env.d.ts +3 -0
  315. package/dist/types/lib/env.d.ts.map +1 -1
  316. package/dist/types/lib/js/EsBuildBuilder.d.ts.map +1 -1
  317. package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts +2 -2
  318. package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts.map +1 -1
  319. package/dist/types/lib/migrations/MigrationPrinter.d.ts.map +1 -1
  320. package/dist/types/lib/project/RemoteProjectResolver.d.ts +1 -1
  321. package/dist/types/lib/project/RemoteProjectResolver.d.ts.map +1 -1
  322. package/dist/types/lib/project/docs/projectDescribe.d.ts.map +1 -1
  323. package/dist/types/lib/tenant/TenantClient.d.ts +2 -2
  324. package/dist/types/lib/tenant/TenantClient.d.ts.map +1 -1
  325. package/dist/types/lib/transfer/DataTransferClient.d.ts +2 -1
  326. package/dist/types/lib/transfer/DataTransferClient.d.ts.map +1 -1
  327. package/dist/types/tsconfig.tsbuildinfo +1 -1
  328. package/package.json +34 -31
  329. package/src/commands/deploy/DeployCommand.ts +6 -5
  330. package/src/commands/migrations/MigrationAmendCommand.ts +16 -3
  331. package/src/commands/migrations/MigrationDiffCommand.ts +1 -1
  332. package/src/commands/project/ProjectPrintSchemaCommand.ts +19 -3
  333. package/src/commands/transfer/ExportCommand.ts +3 -0
  334. package/src/commands/transfer/TransferCommand.ts +3 -0
  335. package/src/consts.ts +4 -2
  336. package/src/dic.ts +3 -1
  337. package/src/lib/admin/AdminClient.ts +1 -1
  338. package/src/lib/env.ts +6 -0
  339. package/src/lib/js/EsBuildBuilder.ts +1 -1
  340. package/src/lib/js/EvalExecutor.ts +2 -2
  341. package/src/lib/migrations/MigrationExecutionFacade.ts +3 -3
  342. package/src/lib/migrations/MigrationPrinter.ts +3 -0
  343. package/src/lib/project/RemoteProjectResolver.ts +10 -2
  344. package/src/lib/project/docs/projectDescribe.tsx +2 -3
  345. package/src/lib/tenant/TenantClient.ts +5 -9
  346. package/src/lib/transfer/DataTransferClient.ts +3 -2
  347. package/src/tsconfig.json +1 -0
  348. package/tsconfig.settings.json +0 -1
  349. package/Dockerfile +0 -20
  350. package/build.sh +0 -11
  351. package/esbuild.cjs +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.cjs","sources":["../../../../../../packages/cli/src/lib/fs/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport glob from 'fast-glob'\n\nexport class FileSystem {\n\treadDir = fs.readdir\n\treadFile = fs.readFile\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tlistDirectories = async (dir: string, patterns: string[]): Promise<string[]> => {\n\t\treturn await glob(patterns, { onlyDirectories: true, cwd: dir })\n\t}\n}\n"],"names":["fs","access"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,WAAUA,cAAG,OAAA;AACb,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAMC,GAAAA,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MACR;AAAA,IAAA,CACD;AACkB,kBAAA,MAAA,mBAAA,OAAO,KAAa,aAA0C;AACxE,aAAA,MAAM,KAAK,UAAU,EAAE,iBAAiB,MAAM,KAAK,KAAK;AAAA,IAAA,CAChE;AAAA,EAAA;AACD;;"}
1
+ {"version":3,"file":"FileSystem.cjs","sources":["../../../../../../packages/cli/src/lib/fs/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport glob from 'fast-glob'\n\nexport class FileSystem {\n\treadDir = fs.readdir\n\treadFile = fs.readFile\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tlistDirectories = async (dir: string, patterns: string[]): Promise<string[]> => {\n\t\treturn await glob(patterns, { onlyDirectories: true, cwd: dir })\n\t}\n}\n"],"names":["fs","access"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,WAAUA,cAAG,OAAA;AACb,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAMC,GAAAA,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MAAA;AAAA,IACR,CACD;AACkB,kBAAA,MAAA,mBAAA,OAAO,KAAa,aAA0C;AACxE,aAAA,MAAM,KAAK,UAAU,EAAE,iBAAiB,MAAM,KAAK,KAAK;AAAA,IAAA,CAChE;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.js","sources":["../../../../../../packages/cli/src/lib/fs/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport glob from 'fast-glob'\n\nexport class FileSystem {\n\treadDir = fs.readdir\n\treadFile = fs.readFile\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tlistDirectories = async (dir: string, patterns: string[]): Promise<string[]> => {\n\t\treturn await glob(patterns, { onlyDirectories: true, cwd: dir })\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,WAAU,GAAG,OAAA;AACb,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAM,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MACR;AAAA,IAAA,CACD;AACkB,kBAAA,MAAA,mBAAA,OAAO,KAAa,aAA0C;AACxE,aAAA,MAAM,KAAK,UAAU,EAAE,iBAAiB,MAAM,KAAK,KAAK;AAAA,IAAA,CAChE;AAAA,EAAA;AACD;"}
1
+ {"version":3,"file":"FileSystem.js","sources":["../../../../../../packages/cli/src/lib/fs/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport glob from 'fast-glob'\n\nexport class FileSystem {\n\treadDir = fs.readdir\n\treadFile = fs.readFile\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tlistDirectories = async (dir: string, patterns: string[]): Promise<string[]> => {\n\t\treturn await glob(patterns, { onlyDirectories: true, cwd: dir })\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,WAAU,GAAG,OAAA;AACb,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAM,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MAAA;AAAA,IACR,CACD;AACkB,kBAAA,MAAA,mBAAA,OAAO,KAAa,aAA0C;AACxE,aAAA,MAAM,KAAK,UAAU,EAAE,iBAAiB,MAAM,KAAK,KAAK;AAAA,IAAA,CAChE;AAAA,EAAA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"YamlHandler.cjs","sources":["../../../../../../packages/cli/src/lib/fs/YamlHandler.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises'\nimport jsyaml from 'js-yaml'\nimport { FileSystem } from './FileSystem'\nimport YAWN from 'yawn-yaml'\nimport { JSONObject, JSONPrimitive } from '../json'\nimport { Merger } from '@contember/config-loader'\n\nexport type JsonUpdateCallback<Value = JSONObject> = (\n\tdata: Partial<Value>,\n\tutils: { merge: (a: JSONObject, b: JSONObject) => JSONObject },\n) => Value\n\nexport class YamlHandler {\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\treadYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n\n\ttryReadYaml = async <T = unknown>(path: string): Promise<T | null> => {\n\t\ttry {\n\t\t\treturn await this.readYaml<T>(path)\n\t\t} catch (e: any) {\n\t\t\tif (e.code === 'ENOENT') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}\n\n\tupdateYaml = async <Value = JSONObject>(\n\t\tpath: string,\n\t\tupdater: JsonUpdateCallback<Value>,\n\t\toptions: { createMissing?: boolean } = {},\n\t) => {\n\t\tlet config = ''\n\t\tif (await this.fs.pathExists(path)) {\n\t\t\tconfig = await readFile(path, { encoding: 'utf8' })\n\t\t} else if (options.createMissing !== true) {\n\t\t\tthrow new Error(`File ${path} does not exist.`)\n\t\t}\n\n\t\tlet newConfig = ''\n\t\tconst mergeUtils = { merge: (a: JSONObject, b: JSONObject) => Merger.merge<JSONPrimitive>(a, b) }\n\t\tif (config) {\n\t\t\tconst yawn = new YAWN(config)\n\t\t\tyawn.json = updater(yawn.json, mergeUtils)\n\t\t\tnewConfig = yawn.yaml\n\t\t} else {\n\t\t\tnewConfig = jsyaml.dump(updater({}, mergeUtils))\n\t\t}\n\n\t\tawait writeFile(path, newConfig, { encoding: 'utf8' })\n\t}\n}\n"],"names":["fs","readFile","Merger","writeFile"],"mappings":";;;;;;;;;AAYO,MAAM,YAAY;AAAA,EACxB,YACkBA,MAChB;AADgB,SAAA,KAAAA;AAIlB,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AACrD,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,OAAA,CAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAEA,kBAAA,MAAA,eAAc,OAAoB,SAAoC;AACjE,UAAA;AACI,eAAA,MAAM,KAAK,SAAY,IAAI;AAAA,eAC1B,GAAQ;AACZ,YAAA,EAAE,SAAS,UAAU;AACjB,iBAAA;AAAA,QACR;AACM,cAAA;AAAA,MACP;AAAA,IAAA,CACD;AAEA,kBAAA,MAAA,cAAa,OACZ,MACA,SACA,UAAuC,OACnC;AACJ,UAAI,SAAS;AACb,UAAI,MAAM,KAAK,GAAG,WAAW,IAAI,GAAG;AACnC,iBAAS,MAAMC,GAAAA,SAAS,MAAM,EAAE,UAAU,QAAQ;AAAA,MAAA,WACxC,QAAQ,kBAAkB,MAAM;AAC1C,cAAM,IAAI,MAAM,QAAQ,IAAI,kBAAkB;AAAA,MAC/C;AAEA,UAAI,YAAY;AACV,YAAA,aAAa,EAAE,OAAO,CAAC,GAAe,MAAkBC,aAAO,OAAA,MAAqB,GAAG,CAAC;AAC9F,UAAI,QAAQ;AACL,cAAA,OAAO,IAAI,KAAK,MAAM;AAC5B,aAAK,OAAO,QAAQ,KAAK,MAAM,UAAU;AACzC,oBAAY,KAAK;AAAA,MAAA,OACX;AACN,oBAAY,OAAO,KAAK,QAAQ,CAAC,GAAG,UAAU,CAAC;AAAA,MAChD;AAEA,YAAMC,GAAAA,UAAU,MAAM,WAAW,EAAE,UAAU,QAAQ;AAAA,IAAA,CACtD;AAAA,EAzCA;AA0CD;;"}
1
+ {"version":3,"file":"YamlHandler.cjs","sources":["../../../../../../packages/cli/src/lib/fs/YamlHandler.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises'\nimport jsyaml from 'js-yaml'\nimport { FileSystem } from './FileSystem'\nimport YAWN from 'yawn-yaml'\nimport { JSONObject, JSONPrimitive } from '../json'\nimport { Merger } from '@contember/config-loader'\n\nexport type JsonUpdateCallback<Value = JSONObject> = (\n\tdata: Partial<Value>,\n\tutils: { merge: (a: JSONObject, b: JSONObject) => JSONObject },\n) => Value\n\nexport class YamlHandler {\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\treadYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n\n\ttryReadYaml = async <T = unknown>(path: string): Promise<T | null> => {\n\t\ttry {\n\t\t\treturn await this.readYaml<T>(path)\n\t\t} catch (e: any) {\n\t\t\tif (e.code === 'ENOENT') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}\n\n\tupdateYaml = async <Value = JSONObject>(\n\t\tpath: string,\n\t\tupdater: JsonUpdateCallback<Value>,\n\t\toptions: { createMissing?: boolean } = {},\n\t) => {\n\t\tlet config = ''\n\t\tif (await this.fs.pathExists(path)) {\n\t\t\tconfig = await readFile(path, { encoding: 'utf8' })\n\t\t} else if (options.createMissing !== true) {\n\t\t\tthrow new Error(`File ${path} does not exist.`)\n\t\t}\n\n\t\tlet newConfig = ''\n\t\tconst mergeUtils = { merge: (a: JSONObject, b: JSONObject) => Merger.merge<JSONPrimitive>(a, b) }\n\t\tif (config) {\n\t\t\tconst yawn = new YAWN(config)\n\t\t\tyawn.json = updater(yawn.json, mergeUtils)\n\t\t\tnewConfig = yawn.yaml\n\t\t} else {\n\t\t\tnewConfig = jsyaml.dump(updater({}, mergeUtils))\n\t\t}\n\n\t\tawait writeFile(path, newConfig, { encoding: 'utf8' })\n\t}\n}\n"],"names":["fs","readFile","Merger","writeFile"],"mappings":";;;;;;;;;AAYO,MAAM,YAAY;AAAA,EACxB,YACkBA,MAChB;AADgB,SAAA,KAAAA;AAIlB,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AACrD,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAEA,kBAAA,MAAA,eAAc,OAAoB,SAAoC;AACjE,UAAA;AACI,eAAA,MAAM,KAAK,SAAY,IAAI;AAAA,eAC1B,GAAQ;AACZ,YAAA,EAAE,SAAS,UAAU;AACjB,iBAAA;AAAA,QAAA;AAEF,cAAA;AAAA,MAAA;AAAA,IACP,CACD;AAEA,kBAAA,MAAA,cAAa,OACZ,MACA,SACA,UAAuC,OACnC;AACJ,UAAI,SAAS;AACb,UAAI,MAAM,KAAK,GAAG,WAAW,IAAI,GAAG;AACnC,iBAAS,MAAMC,GAAAA,SAAS,MAAM,EAAE,UAAU,QAAQ;AAAA,MAAA,WACxC,QAAQ,kBAAkB,MAAM;AAC1C,cAAM,IAAI,MAAM,QAAQ,IAAI,kBAAkB;AAAA,MAAA;AAG/C,UAAI,YAAY;AACV,YAAA,aAAa,EAAE,OAAO,CAAC,GAAe,MAAkBC,aAAAA,OAAO,MAAqB,GAAG,CAAC,EAAE;AAChG,UAAI,QAAQ;AACL,cAAA,OAAO,IAAI,KAAK,MAAM;AAC5B,aAAK,OAAO,QAAQ,KAAK,MAAM,UAAU;AACzC,oBAAY,KAAK;AAAA,MAAA,OACX;AACN,oBAAY,OAAO,KAAK,QAAQ,CAAC,GAAG,UAAU,CAAC;AAAA,MAAA;AAGhD,YAAMC,GAAAA,UAAU,MAAM,WAAW,EAAE,UAAU,QAAQ;AAAA,IAAA,CACtD;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"YamlHandler.js","sources":["../../../../../../packages/cli/src/lib/fs/YamlHandler.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises'\nimport jsyaml from 'js-yaml'\nimport { FileSystem } from './FileSystem'\nimport YAWN from 'yawn-yaml'\nimport { JSONObject, JSONPrimitive } from '../json'\nimport { Merger } from '@contember/config-loader'\n\nexport type JsonUpdateCallback<Value = JSONObject> = (\n\tdata: Partial<Value>,\n\tutils: { merge: (a: JSONObject, b: JSONObject) => JSONObject },\n) => Value\n\nexport class YamlHandler {\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\treadYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n\n\ttryReadYaml = async <T = unknown>(path: string): Promise<T | null> => {\n\t\ttry {\n\t\t\treturn await this.readYaml<T>(path)\n\t\t} catch (e: any) {\n\t\t\tif (e.code === 'ENOENT') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}\n\n\tupdateYaml = async <Value = JSONObject>(\n\t\tpath: string,\n\t\tupdater: JsonUpdateCallback<Value>,\n\t\toptions: { createMissing?: boolean } = {},\n\t) => {\n\t\tlet config = ''\n\t\tif (await this.fs.pathExists(path)) {\n\t\t\tconfig = await readFile(path, { encoding: 'utf8' })\n\t\t} else if (options.createMissing !== true) {\n\t\t\tthrow new Error(`File ${path} does not exist.`)\n\t\t}\n\n\t\tlet newConfig = ''\n\t\tconst mergeUtils = { merge: (a: JSONObject, b: JSONObject) => Merger.merge<JSONPrimitive>(a, b) }\n\t\tif (config) {\n\t\t\tconst yawn = new YAWN(config)\n\t\t\tyawn.json = updater(yawn.json, mergeUtils)\n\t\t\tnewConfig = yawn.yaml\n\t\t} else {\n\t\t\tnewConfig = jsyaml.dump(updater({}, mergeUtils))\n\t\t}\n\n\t\tawait writeFile(path, newConfig, { encoding: 'utf8' })\n\t}\n}\n"],"names":["jsyaml"],"mappings":";;;;;;;AAYO,MAAM,YAAY;AAAA,EACxB,YACkB,IAChB;AADgB,SAAA,KAAA;AAIlB,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AACrD,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,OAAA,CAAQ;AAC1D,aAAAA,gBAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAEA,kBAAA,MAAA,eAAc,OAAoB,SAAoC;AACjE,UAAA;AACI,eAAA,MAAM,KAAK,SAAY,IAAI;AAAA,eAC1B,GAAQ;AACZ,YAAA,EAAE,SAAS,UAAU;AACjB,iBAAA;AAAA,QACR;AACM,cAAA;AAAA,MACP;AAAA,IAAA,CACD;AAEA,kBAAA,MAAA,cAAa,OACZ,MACA,SACA,UAAuC,OACnC;AACJ,UAAI,SAAS;AACb,UAAI,MAAM,KAAK,GAAG,WAAW,IAAI,GAAG;AACnC,iBAAS,MAAM,SAAS,MAAM,EAAE,UAAU,QAAQ;AAAA,MAAA,WACxC,QAAQ,kBAAkB,MAAM;AAC1C,cAAM,IAAI,MAAM,QAAQ,IAAI,kBAAkB;AAAA,MAC/C;AAEA,UAAI,YAAY;AACV,YAAA,aAAa,EAAE,OAAO,CAAC,GAAe,MAAkB,OAAO,MAAqB,GAAG,CAAC;AAC9F,UAAI,QAAQ;AACL,cAAA,OAAO,IAAI,KAAK,MAAM;AAC5B,aAAK,OAAO,QAAQ,KAAK,MAAM,UAAU;AACzC,oBAAY,KAAK;AAAA,MAAA,OACX;AACN,oBAAYA,gBAAO,KAAK,QAAQ,CAAC,GAAG,UAAU,CAAC;AAAA,MAChD;AAEA,YAAM,UAAU,MAAM,WAAW,EAAE,UAAU,QAAQ;AAAA,IAAA,CACtD;AAAA,EAzCA;AA0CD;"}
1
+ {"version":3,"file":"YamlHandler.js","sources":["../../../../../../packages/cli/src/lib/fs/YamlHandler.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises'\nimport jsyaml from 'js-yaml'\nimport { FileSystem } from './FileSystem'\nimport YAWN from 'yawn-yaml'\nimport { JSONObject, JSONPrimitive } from '../json'\nimport { Merger } from '@contember/config-loader'\n\nexport type JsonUpdateCallback<Value = JSONObject> = (\n\tdata: Partial<Value>,\n\tutils: { merge: (a: JSONObject, b: JSONObject) => JSONObject },\n) => Value\n\nexport class YamlHandler {\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\treadYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n\n\ttryReadYaml = async <T = unknown>(path: string): Promise<T | null> => {\n\t\ttry {\n\t\t\treturn await this.readYaml<T>(path)\n\t\t} catch (e: any) {\n\t\t\tif (e.code === 'ENOENT') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}\n\n\tupdateYaml = async <Value = JSONObject>(\n\t\tpath: string,\n\t\tupdater: JsonUpdateCallback<Value>,\n\t\toptions: { createMissing?: boolean } = {},\n\t) => {\n\t\tlet config = ''\n\t\tif (await this.fs.pathExists(path)) {\n\t\t\tconfig = await readFile(path, { encoding: 'utf8' })\n\t\t} else if (options.createMissing !== true) {\n\t\t\tthrow new Error(`File ${path} does not exist.`)\n\t\t}\n\n\t\tlet newConfig = ''\n\t\tconst mergeUtils = { merge: (a: JSONObject, b: JSONObject) => Merger.merge<JSONPrimitive>(a, b) }\n\t\tif (config) {\n\t\t\tconst yawn = new YAWN(config)\n\t\t\tyawn.json = updater(yawn.json, mergeUtils)\n\t\t\tnewConfig = yawn.yaml\n\t\t} else {\n\t\t\tnewConfig = jsyaml.dump(updater({}, mergeUtils))\n\t\t}\n\n\t\tawait writeFile(path, newConfig, { encoding: 'utf8' })\n\t}\n}\n"],"names":["jsyaml"],"mappings":";;;;;;;AAYO,MAAM,YAAY;AAAA,EACxB,YACkB,IAChB;AADgB,SAAA,KAAA;AAIlB,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AACrD,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAAA,gBAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAEA,kBAAA,MAAA,eAAc,OAAoB,SAAoC;AACjE,UAAA;AACI,eAAA,MAAM,KAAK,SAAY,IAAI;AAAA,eAC1B,GAAQ;AACZ,YAAA,EAAE,SAAS,UAAU;AACjB,iBAAA;AAAA,QAAA;AAEF,cAAA;AAAA,MAAA;AAAA,IACP,CACD;AAEA,kBAAA,MAAA,cAAa,OACZ,MACA,SACA,UAAuC,OACnC;AACJ,UAAI,SAAS;AACb,UAAI,MAAM,KAAK,GAAG,WAAW,IAAI,GAAG;AACnC,iBAAS,MAAM,SAAS,MAAM,EAAE,UAAU,QAAQ;AAAA,MAAA,WACxC,QAAQ,kBAAkB,MAAM;AAC1C,cAAM,IAAI,MAAM,QAAQ,IAAI,kBAAkB;AAAA,MAAA;AAG/C,UAAI,YAAY;AACV,YAAA,aAAa,EAAE,OAAO,CAAC,GAAe,MAAkB,OAAO,MAAqB,GAAG,CAAC,EAAE;AAChG,UAAI,QAAQ;AACL,cAAA,OAAO,IAAI,KAAK,MAAM;AAC5B,aAAK,OAAO,QAAQ,KAAK,MAAM,UAAU;AACzC,oBAAY,KAAK;AAAA,MAAA,OACX;AACN,oBAAYA,gBAAO,KAAK,QAAQ,CAAC,GAAG,UAAU,CAAC;AAAA,MAAA;AAGhD,YAAM,UAAU,MAAM,WAAW,EAAE,UAAU,QAAQ;AAAA,IAAA,CACtD;AAAA,EAAA;AACD;"}
@@ -1,26 +1,31 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const esbuild = require("esbuild");
4
- function _interopNamespaceDefault(e) {
5
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
- if (e) {
7
- for (const k in e) {
8
- if (k !== "default") {
9
- const d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: () => e[k]
13
- });
14
- }
15
- }
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
13
  }
17
- n.default = e;
18
- return Object.freeze(n);
19
- }
20
- const esbuild__namespace = /* @__PURE__ */ _interopNamespaceDefault(esbuild);
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
21
25
  class EsBuildBuilder {
22
26
  async build(path) {
23
- const response = await esbuild__namespace.build({
27
+ const esbuild = await import("esbuild");
28
+ const response = await esbuild.build({
24
29
  entryPoints: [path],
25
30
  platform: "node",
26
31
  bundle: true,
@@ -1 +1 @@
1
- {"version":3,"file":"EsBuildBuilder.cjs","sources":["../../../../../../packages/cli/src/lib/js/EsBuildBuilder.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\nimport * as esbuild from 'esbuild'\n\nexport class EsBuildBuilder implements JsBuilder {\n\tasync build(path: string): Promise<string> {\n\t\tconst response = await esbuild.build({\n\t\t\tentryPoints: [path],\n\t\t\tplatform: 'node',\n\t\t\tbundle: true,\n\t\t\ttreeShaking: true,\n\t\t\twrite: false,\n\t\t\tloader: { '.sql': 'text' },\n\t\t\texternal: ['@contember/admin', 'react', 'react/jsx-runtime'],\n\t\t})\n\t\treturn response.outputFiles[0].text\n\t}\n}\n"],"names":["esbuild"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGO,MAAM,eAAoC;AAAA,EAChD,MAAM,MAAM,MAA+B;AACpC,UAAA,WAAW,MAAMA,mBAAQ,MAAM;AAAA,MACpC,aAAa,CAAC,IAAI;AAAA,MAClB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,OAAO;AAAA,MACP,QAAQ,EAAE,QAAQ,OAAO;AAAA,MACzB,UAAU,CAAC,oBAAoB,SAAS,mBAAmB;AAAA,IAAA,CAC3D;AACM,WAAA,SAAS,YAAY,CAAC,EAAE;AAAA,EAChC;AACD;;"}
1
+ {"version":3,"file":"EsBuildBuilder.cjs","sources":["../../../../../../packages/cli/src/lib/js/EsBuildBuilder.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\n\nexport class EsBuildBuilder implements JsBuilder {\n\tasync build(path: string): Promise<string> {\n\t\tconst esbuild = await import('esbuild')\n\t\tconst response = await esbuild.build({\n\t\t\tentryPoints: [path],\n\t\t\tplatform: 'node',\n\t\t\tbundle: true,\n\t\t\ttreeShaking: true,\n\t\t\twrite: false,\n\t\t\tloader: { '.sql': 'text' },\n\t\t\texternal: ['@contember/admin', 'react', 'react/jsx-runtime'],\n\t\t})\n\t\treturn response.outputFiles[0].text\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,eAAoC;AAAA,EAChD,MAAM,MAAM,MAA+B;AACpC,UAAA,UAAU,MAAM,OAAO,SAAS;AAChC,UAAA,WAAW,MAAM,QAAQ,MAAM;AAAA,MACpC,aAAa,CAAC,IAAI;AAAA,MAClB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,OAAO;AAAA,MACP,QAAQ,EAAE,QAAQ,OAAO;AAAA,MACzB,UAAU,CAAC,oBAAoB,SAAS,mBAAmB;AAAA,IAAA,CAC3D;AACM,WAAA,SAAS,YAAY,CAAC,EAAE;AAAA,EAAA;AAEjC;;"}
@@ -1,6 +1,6 @@
1
- import * as esbuild from "esbuild";
2
1
  class EsBuildBuilder {
3
2
  async build(path) {
3
+ const esbuild = await import("esbuild");
4
4
  const response = await esbuild.build({
5
5
  entryPoints: [path],
6
6
  platform: "node",
@@ -1 +1 @@
1
- {"version":3,"file":"EsBuildBuilder.js","sources":["../../../../../../packages/cli/src/lib/js/EsBuildBuilder.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\nimport * as esbuild from 'esbuild'\n\nexport class EsBuildBuilder implements JsBuilder {\n\tasync build(path: string): Promise<string> {\n\t\tconst response = await esbuild.build({\n\t\t\tentryPoints: [path],\n\t\t\tplatform: 'node',\n\t\t\tbundle: true,\n\t\t\ttreeShaking: true,\n\t\t\twrite: false,\n\t\t\tloader: { '.sql': 'text' },\n\t\t\texternal: ['@contember/admin', 'react', 'react/jsx-runtime'],\n\t\t})\n\t\treturn response.outputFiles[0].text\n\t}\n}\n"],"names":[],"mappings":";AAGO,MAAM,eAAoC;AAAA,EAChD,MAAM,MAAM,MAA+B;AACpC,UAAA,WAAW,MAAM,QAAQ,MAAM;AAAA,MACpC,aAAa,CAAC,IAAI;AAAA,MAClB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,OAAO;AAAA,MACP,QAAQ,EAAE,QAAQ,OAAO;AAAA,MACzB,UAAU,CAAC,oBAAoB,SAAS,mBAAmB;AAAA,IAAA,CAC3D;AACM,WAAA,SAAS,YAAY,CAAC,EAAE;AAAA,EAChC;AACD;"}
1
+ {"version":3,"file":"EsBuildBuilder.js","sources":["../../../../../../packages/cli/src/lib/js/EsBuildBuilder.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\n\nexport class EsBuildBuilder implements JsBuilder {\n\tasync build(path: string): Promise<string> {\n\t\tconst esbuild = await import('esbuild')\n\t\tconst response = await esbuild.build({\n\t\t\tentryPoints: [path],\n\t\t\tplatform: 'node',\n\t\t\tbundle: true,\n\t\t\ttreeShaking: true,\n\t\t\twrite: false,\n\t\t\tloader: { '.sql': 'text' },\n\t\t\texternal: ['@contember/admin', 'react', 'react/jsx-runtime'],\n\t\t})\n\t\treturn response.outputFiles[0].text\n\t}\n}\n"],"names":[],"mappings":"AAEO,MAAM,eAAoC;AAAA,EAChD,MAAM,MAAM,MAA+B;AACpC,UAAA,UAAU,MAAM,OAAO,SAAS;AAChC,UAAA,WAAW,MAAM,QAAQ,MAAM;AAAA,MACpC,aAAa,CAAC,IAAI;AAAA,MAClB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,OAAO;AAAA,MACP,QAAQ,EAAE,QAAQ,OAAO;AAAA,MACzB,UAAU,CAAC,oBAAoB,SAAS,mBAAmB;AAAA,IAAA,CAC3D;AACM,WAAA,SAAS,YAAY,CAAC,EAAE;AAAA,EAAA;AAEjC;"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  class EvalExecutor {
4
4
  async execute(code) {
5
- const fn = new Function(`var module = {}; ((module) => { ${code} })(module); return module`);
6
- return fn().exports;
5
+ const fn = new Function("require", `var module = {}; ((module) => { ${code} })(module); return module`);
6
+ return fn(require).exports;
7
7
  }
8
8
  }
9
9
  exports.EvalExecutor = EvalExecutor;
@@ -1 +1 @@
1
- {"version":3,"file":"EvalExecutor.cjs","sources":["../../../../../../packages/cli/src/lib/js/EvalExecutor.ts"],"sourcesContent":["import { JsExecutor } from './JsExecutor'\n\nexport class EvalExecutor implements JsExecutor {\n\tpublic async execute(code: string): Promise<unknown> {\n\t\tconst fn = new Function(`var module = {}; ((module) => { ${code} })(module); return module`)\n\t\treturn fn().exports\n\t}\n}\n"],"names":[],"mappings":";;AAEO,MAAM,aAAmC;AAAA,EAC/C,MAAa,QAAQ,MAAgC;AACpD,UAAM,KAAK,IAAI,SAAS,mCAAmC,IAAI,4BAA4B;AAC3F,WAAO,GAAK,EAAA;AAAA,EACb;AACD;;"}
1
+ {"version":3,"file":"EvalExecutor.cjs","sources":["../../../../../../packages/cli/src/lib/js/EvalExecutor.ts"],"sourcesContent":["import { JsExecutor } from './JsExecutor'\n\nexport class EvalExecutor implements JsExecutor {\n\tpublic async execute(code: string): Promise<unknown> {\n\t\tconst fn = new Function('require', `var module = {}; ((module) => { ${code} })(module); return module`)\n\t\treturn fn(require).exports\n\t}\n}\n"],"names":[],"mappings":";;AAEO,MAAM,aAAmC;AAAA,EAC/C,MAAa,QAAQ,MAAgC;AACpD,UAAM,KAAK,IAAI,SAAS,WAAW,mCAAmC,IAAI,4BAA4B;AAC/F,WAAA,GAAG,OAAO,EAAE;AAAA,EAAA;AAErB;;"}
@@ -1,7 +1,7 @@
1
1
  class EvalExecutor {
2
2
  async execute(code) {
3
- const fn = new Function(`var module = {}; ((module) => { ${code} })(module); return module`);
4
- return fn().exports;
3
+ const fn = new Function("require", `var module = {}; ((module) => { ${code} })(module); return module`);
4
+ return fn(require).exports;
5
5
  }
6
6
  }
7
7
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"EvalExecutor.js","sources":["../../../../../../packages/cli/src/lib/js/EvalExecutor.ts"],"sourcesContent":["import { JsExecutor } from './JsExecutor'\n\nexport class EvalExecutor implements JsExecutor {\n\tpublic async execute(code: string): Promise<unknown> {\n\t\tconst fn = new Function(`var module = {}; ((module) => { ${code} })(module); return module`)\n\t\treturn fn().exports\n\t}\n}\n"],"names":[],"mappings":"AAEO,MAAM,aAAmC;AAAA,EAC/C,MAAa,QAAQ,MAAgC;AACpD,UAAM,KAAK,IAAI,SAAS,mCAAmC,IAAI,4BAA4B;AAC3F,WAAO,GAAK,EAAA;AAAA,EACb;AACD;"}
1
+ {"version":3,"file":"EvalExecutor.js","sources":["../../../../../../packages/cli/src/lib/js/EvalExecutor.ts"],"sourcesContent":["import { JsExecutor } from './JsExecutor'\n\nexport class EvalExecutor implements JsExecutor {\n\tpublic async execute(code: string): Promise<unknown> {\n\t\tconst fn = new Function('require', `var module = {}; ((module) => { ${code} })(module); return module`)\n\t\treturn fn(require).exports\n\t}\n}\n"],"names":[],"mappings":"AAEO,MAAM,aAAmC;AAAA,EAC/C,MAAa,QAAQ,MAAgC;AACpD,UAAM,KAAK,IAAI,SAAS,WAAW,mCAAmC,IAAI,4BAA4B;AAC/F,WAAA,GAAG,OAAO,EAAE;AAAA,EAAA;AAErB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"JsCodeRunner.cjs","sources":["../../../../../../packages/cli/src/lib/js/JsCodeRunner.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\nimport { JsExecutor } from './JsExecutor'\n\nexport class JsCodeRunner {\n\tconstructor(\n\t\tprivate readonly jsBuilder: JsBuilder,\n\t\tprivate readonly jsExecutor: JsExecutor,\n\t) {\n\t}\n\n\trun = async (path: string): Promise<unknown> => {\n\t\tconst builtCode = await this.jsBuilder.build(path)\n\t\treturn this.jsExecutor.execute(builtCode)\n\t}\n}\n"],"names":[],"mappings":";;;;;AAGO,MAAM,aAAa;AAAA,EACzB,YACkB,WACA,YAChB;AAFgB,SAAA,YAAA;AACA,SAAA,aAAA;AAIlB,kBAAA,MAAA,OAAM,OAAO,SAAmC;AAC/C,YAAM,YAAY,MAAM,KAAK,UAAU,MAAM,IAAI;AAC1C,aAAA,KAAK,WAAW,QAAQ,SAAS;AAAA,IAAA,CACzC;AAAA,EALA;AAMD;;"}
1
+ {"version":3,"file":"JsCodeRunner.cjs","sources":["../../../../../../packages/cli/src/lib/js/JsCodeRunner.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\nimport { JsExecutor } from './JsExecutor'\n\nexport class JsCodeRunner {\n\tconstructor(\n\t\tprivate readonly jsBuilder: JsBuilder,\n\t\tprivate readonly jsExecutor: JsExecutor,\n\t) {\n\t}\n\n\trun = async (path: string): Promise<unknown> => {\n\t\tconst builtCode = await this.jsBuilder.build(path)\n\t\treturn this.jsExecutor.execute(builtCode)\n\t}\n}\n"],"names":[],"mappings":";;;;;AAGO,MAAM,aAAa;AAAA,EACzB,YACkB,WACA,YAChB;AAFgB,SAAA,YAAA;AACA,SAAA,aAAA;AAIlB,kBAAA,MAAA,OAAM,OAAO,SAAmC;AAC/C,YAAM,YAAY,MAAM,KAAK,UAAU,MAAM,IAAI;AAC1C,aAAA,KAAK,WAAW,QAAQ,SAAS;AAAA,IAAA,CACzC;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"JsCodeRunner.js","sources":["../../../../../../packages/cli/src/lib/js/JsCodeRunner.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\nimport { JsExecutor } from './JsExecutor'\n\nexport class JsCodeRunner {\n\tconstructor(\n\t\tprivate readonly jsBuilder: JsBuilder,\n\t\tprivate readonly jsExecutor: JsExecutor,\n\t) {\n\t}\n\n\trun = async (path: string): Promise<unknown> => {\n\t\tconst builtCode = await this.jsBuilder.build(path)\n\t\treturn this.jsExecutor.execute(builtCode)\n\t}\n}\n"],"names":[],"mappings":";;;AAGO,MAAM,aAAa;AAAA,EACzB,YACkB,WACA,YAChB;AAFgB,SAAA,YAAA;AACA,SAAA,aAAA;AAIlB,kBAAA,MAAA,OAAM,OAAO,SAAmC;AAC/C,YAAM,YAAY,MAAM,KAAK,UAAU,MAAM,IAAI;AAC1C,aAAA,KAAK,WAAW,QAAQ,SAAS;AAAA,IAAA,CACzC;AAAA,EALA;AAMD;"}
1
+ {"version":3,"file":"JsCodeRunner.js","sources":["../../../../../../packages/cli/src/lib/js/JsCodeRunner.ts"],"sourcesContent":["import { JsBuilder } from './JsBuilder'\nimport { JsExecutor } from './JsExecutor'\n\nexport class JsCodeRunner {\n\tconstructor(\n\t\tprivate readonly jsBuilder: JsBuilder,\n\t\tprivate readonly jsExecutor: JsExecutor,\n\t) {\n\t}\n\n\trun = async (path: string): Promise<unknown> => {\n\t\tconst builtCode = await this.jsBuilder.build(path)\n\t\treturn this.jsExecutor.execute(builtCode)\n\t}\n}\n"],"names":[],"mappings":";;;AAGO,MAAM,aAAa;AAAA,EACzB,YACkB,WACA,YAChB;AAFgB,SAAA,YAAA;AACA,SAAA,aAAA;AAIlB,kBAAA,MAAA,OAAM,OAAO,SAAmC;AAC/C,YAAM,YAAY,MAAM,KAAK,UAAU,MAAM,IAAI;AAC1C,aAAA,KAAK,WAAW,QAAQ,SAAS;AAAA,IAAA,CACzC;AAAA,EAAA;AACD;"}
@@ -32,7 +32,7 @@ class MigrationExecutionFacade {
32
32
  console.log("Will execute following migrations:");
33
33
  migrations.forEach((it) => console.log(it.name));
34
34
  additionalMessage && console.log(additionalMessage);
35
- if (requireConfirmation) {
35
+ if (typeof requireConfirmation === "function" ? requireConfirmation(migrations) : requireConfirmation) {
36
36
  if (!process.stdin.isTTY) {
37
37
  throw "TTY not available. Pass --yes option to confirm execution.";
38
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationExecutionFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationExecutionFacade.ts"],"sourcesContent":["import prompts from 'prompts'\nimport { MigrationPrinter } from './MigrationPrinter'\nimport { isSchemaMigration, MigrationExecutor, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from './MigrationsStatusFacade'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { RemoteProject } from '../project/RemoteProject'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { TenantClientProvider } from '../TenantClientProvider'\nimport { RemoteProjectProvider } from '../project/RemoteProjectProvider'\n\nexport class MigrationExecutionFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly tenantClientProvider: TenantClientProvider,\n\t\tprivate readonly projectProvider: RemoteProjectProvider,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutor: MigrationExecutor,\n\t\tprivate readonly migrationStatusFacade: MigrationsStatusFacade,\n\t) {\n\t}\n\n\texecute = async ({\n\t\trequireConfirmation,\n\t\tforce,\n\t\tuntil,\n\t\tadditionalMessage,\n\t}: {\n\t\trequireConfirmation: boolean\n\t\tforce?: boolean\n\t\tuntil?: string\n\t\tadditionalMessage?: string\n\t}): Promise<boolean> => {\n\t\tconst project = this.projectProvider.get()\n\t\tawait this.tenantClientProvider.get().createProject(project.name, true)\n\n\t\tconst status = await this.migrationStatusFacade.resolveMigrationsStatus({ force })\n\t\tconst migrations = until\n\t\t\t? status.migrationsToExecute.filter(it => it.version <= MigrationVersionHelper.extractVersion(until))\n\t\t\t: status.migrationsToExecute\n\t\tif (migrations.length === 0) {\n\t\t\tconsole.log('No migrations to execute')\n\t\t\treturn true\n\t\t}\n\t\tconsole.log('Will execute following migrations:')\n\t\tmigrations.forEach(it => console.log(it.name))\n\t\tadditionalMessage && console.log(additionalMessage)\n\n\t\tif (requireConfirmation) {\n\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Execute migrations' },\n\t\t\t\t\t\t{ value: 'describe', title: 'Describe migrations' },\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (action === 'describe') {\n\t\t\t\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migrations[0].version)\n\t\t\t\t\tfor (const migration of migrations) {\n\t\t\t\t\t\tconst migrationContent = await migration.localMigration.getContent()\n\t\t\t\t\t\tif (!isSchemaMigration(migrationContent)) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.migrationPrinter.printMigrationDescription(schema, migrationContent, {\n\t\t\t\t\t\t\tnoSql: true,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else if (action === 'yes') {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} while (true)\n\t\t}\n\n\t\tawait this.migrationExecutor.executeMigrations({\n\t\t\tclient: this.systemClientProvider.get(),\n\t\t\tmigrations,\n\t\t\tcontentMigrationFactoryArgs: {\n\t\t\t\tapiToken: project.token,\n\t\t\t\tapiBaseUrl: project.endpoint,\n\t\t\t\tprojectName: project.name,\n\t\t\t},\n\t\t\tlog: message => console.log(message),\n\t\t\tforce,\n\t\t})\n\t\treturn true\n\t}\n}\n"],"names":["MigrationVersionHelper","isSchemaMigration"],"mappings":";;;;;;;;AAUO,MAAM,yBAAyB;AAAA,EACrC,YACkB,sBACA,sBACA,iBACA,sBACA,kBACA,mBACA,uBAChB;AAPgB,SAAA,uBAAA;AACA,SAAA,uBAAA;AACA,SAAA,kBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,oBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,WAAU,OAAO;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,MAMuB;AACjB,YAAA,UAAU,KAAK,gBAAgB,IAAI;AACzC,YAAM,KAAK,qBAAqB,MAAM,cAAc,QAAQ,MAAM,IAAI;AAEtE,YAAM,SAAS,MAAM,KAAK,sBAAsB,wBAAwB,EAAE,OAAO;AACjF,YAAM,aAAa,QAChB,OAAO,oBAAoB,OAAO,CAAA,OAAM,GAAG,WAAWA,aAAuB,uBAAA,eAAe,KAAK,CAAC,IAClG,OAAO;AACN,UAAA,WAAW,WAAW,GAAG;AAC5B,gBAAQ,IAAI,0BAA0B;AAC/B,eAAA;AAAA,MACR;AACA,cAAQ,IAAI,oCAAoC;AAChD,iBAAW,QAAQ,CAAM,OAAA,QAAQ,IAAI,GAAG,IAAI,CAAC;AACxB,2BAAA,QAAQ,IAAI,iBAAiB;AAElD,UAAI,qBAAqB;AACpB,YAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,gBAAA;AAAA,QACP;AACG,WAAA;AACF,gBAAM,EAAE,WAAW,MAAM,QAAQ;AAAA,YAChC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,YACT,SAAS;AAAA,cACR,EAAE,OAAO,OAAO,OAAO,qBAAqB;AAAA,cAC5C,EAAE,OAAO,YAAY,OAAO,sBAAsB;AAAA,cAClD,EAAE,OAAO,MAAM,OAAO,QAAQ;AAAA,YAC/B;AAAA,UAAA,CACA;AACD,cAAI,WAAW,YAAY;AACpB,kBAAA,SAAS,MAAM,KAAK,qBAAqB,iBAAiB,WAAW,CAAC,EAAE,OAAO;AACrF,uBAAW,aAAa,YAAY;AACnC,oBAAM,mBAAmB,MAAM,UAAU,eAAe,WAAW;AAC/D,kBAAA,CAACC,iBAAAA,kBAAkB,gBAAgB,GAAG;AACzC;AAAA,cACD;AAEA,oBAAM,KAAK,iBAAiB,0BAA0B,QAAQ,kBAAkB;AAAA,gBAC/E,OAAO;AAAA,cAAA,CACP;AAAA,YACF;AAAA,UAAA,WACU,WAAW,OAAO;AAC5B;AAAA,UAAA,OACM;AACC,mBAAA;AAAA,UACR;AAAA,QACQ,SAAA;AAAA,MACV;AAEM,YAAA,KAAK,kBAAkB,kBAAkB;AAAA,QAC9C,QAAQ,KAAK,qBAAqB,IAAI;AAAA,QACtC;AAAA,QACA,6BAA6B;AAAA,UAC5B,UAAU,QAAQ;AAAA,UAClB,YAAY,QAAQ;AAAA,UACpB,aAAa,QAAQ;AAAA,QACtB;AAAA,QACA,KAAK,CAAA,YAAW,QAAQ,IAAI,OAAO;AAAA,QACnC;AAAA,MAAA,CACA;AACM,aAAA;AAAA,IAAA,CACR;AAAA,EA3EA;AA4ED;;"}
1
+ {"version":3,"file":"MigrationExecutionFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationExecutionFacade.ts"],"sourcesContent":["import prompts from 'prompts'\nimport { MigrationPrinter } from './MigrationPrinter'\nimport { isSchemaMigration, MigrationExecutor, MigrationToExecuteOkStatus, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from './MigrationsStatusFacade'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { RemoteProject } from '../project/RemoteProject'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { TenantClientProvider } from '../TenantClientProvider'\nimport { RemoteProjectProvider } from '../project/RemoteProjectProvider'\n\nexport class MigrationExecutionFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly tenantClientProvider: TenantClientProvider,\n\t\tprivate readonly projectProvider: RemoteProjectProvider,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutor: MigrationExecutor,\n\t\tprivate readonly migrationStatusFacade: MigrationsStatusFacade,\n\t) {\n\t}\n\n\texecute = async ({\n\t\trequireConfirmation,\n\t\tforce,\n\t\tuntil,\n\t\tadditionalMessage,\n\t}: {\n\t\trequireConfirmation: boolean | ((migrations: MigrationToExecuteOkStatus[]) => boolean)\n\t\tforce?: boolean\n\t\tuntil?: string\n\t\tadditionalMessage?: string\n\t}): Promise<boolean> => {\n\t\tconst project = this.projectProvider.get()\n\t\tawait this.tenantClientProvider.get().createProject(project.name, true)\n\n\t\tconst status = await this.migrationStatusFacade.resolveMigrationsStatus({ force })\n\t\tconst migrations = until\n\t\t\t? status.migrationsToExecute.filter(it => it.version <= MigrationVersionHelper.extractVersion(until))\n\t\t\t: status.migrationsToExecute\n\t\tif (migrations.length === 0) {\n\t\t\tconsole.log('No migrations to execute')\n\t\t\treturn true\n\t\t}\n\t\tconsole.log('Will execute following migrations:')\n\t\tmigrations.forEach(it => console.log(it.name))\n\t\tadditionalMessage && console.log(additionalMessage)\n\n\t\tif (typeof requireConfirmation === 'function' ? requireConfirmation(migrations) : requireConfirmation) {\n\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Execute migrations' },\n\t\t\t\t\t\t{ value: 'describe', title: 'Describe migrations' },\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (action === 'describe') {\n\t\t\t\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migrations[0].version)\n\t\t\t\t\tfor (const migration of migrations) {\n\t\t\t\t\t\tconst migrationContent = await migration.localMigration.getContent()\n\t\t\t\t\t\tif (!isSchemaMigration(migrationContent)) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.migrationPrinter.printMigrationDescription(schema, migrationContent, {\n\t\t\t\t\t\t\tnoSql: true,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else if (action === 'yes') {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} while (true)\n\t\t}\n\n\t\tawait this.migrationExecutor.executeMigrations({\n\t\t\tclient: this.systemClientProvider.get(),\n\t\t\tmigrations,\n\t\t\tcontentMigrationFactoryArgs: {\n\t\t\t\tapiToken: project.token,\n\t\t\t\tapiBaseUrl: project.endpoint,\n\t\t\t\tprojectName: project.name,\n\t\t\t},\n\t\t\tlog: message => console.log(message),\n\t\t\tforce,\n\t\t})\n\t\treturn true\n\t}\n}\n"],"names":["MigrationVersionHelper","isSchemaMigration"],"mappings":";;;;;;;;AAUO,MAAM,yBAAyB;AAAA,EACrC,YACkB,sBACA,sBACA,iBACA,sBACA,kBACA,mBACA,uBAChB;AAPgB,SAAA,uBAAA;AACA,SAAA,uBAAA;AACA,SAAA,kBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,oBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,WAAU,OAAO;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,MAMuB;AACjB,YAAA,UAAU,KAAK,gBAAgB,IAAI;AACzC,YAAM,KAAK,qBAAqB,IAAA,EAAM,cAAc,QAAQ,MAAM,IAAI;AAEtE,YAAM,SAAS,MAAM,KAAK,sBAAsB,wBAAwB,EAAE,OAAO;AACjF,YAAM,aAAa,QAChB,OAAO,oBAAoB,OAAO,CAAA,OAAM,GAAG,WAAWA,aAAuB,uBAAA,eAAe,KAAK,CAAC,IAClG,OAAO;AACN,UAAA,WAAW,WAAW,GAAG;AAC5B,gBAAQ,IAAI,0BAA0B;AAC/B,eAAA;AAAA,MAAA;AAER,cAAQ,IAAI,oCAAoC;AAChD,iBAAW,QAAQ,CAAM,OAAA,QAAQ,IAAI,GAAG,IAAI,CAAC;AACxB,2BAAA,QAAQ,IAAI,iBAAiB;AAElD,UAAI,OAAO,wBAAwB,aAAa,oBAAoB,UAAU,IAAI,qBAAqB;AAClG,YAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,gBAAA;AAAA,QAAA;AAEJ,WAAA;AACF,gBAAM,EAAE,WAAW,MAAM,QAAQ;AAAA,YAChC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,YACT,SAAS;AAAA,cACR,EAAE,OAAO,OAAO,OAAO,qBAAqB;AAAA,cAC5C,EAAE,OAAO,YAAY,OAAO,sBAAsB;AAAA,cAClD,EAAE,OAAO,MAAM,OAAO,QAAQ;AAAA,YAAA;AAAA,UAC/B,CACA;AACD,cAAI,WAAW,YAAY;AACpB,kBAAA,SAAS,MAAM,KAAK,qBAAqB,iBAAiB,WAAW,CAAC,EAAE,OAAO;AACrF,uBAAW,aAAa,YAAY;AACnC,oBAAM,mBAAmB,MAAM,UAAU,eAAe,WAAW;AAC/D,kBAAA,CAACC,iBAAAA,kBAAkB,gBAAgB,GAAG;AACzC;AAAA,cAAA;AAGD,oBAAM,KAAK,iBAAiB,0BAA0B,QAAQ,kBAAkB;AAAA,gBAC/E,OAAO;AAAA,cAAA,CACP;AAAA,YAAA;AAAA,UACF,WACU,WAAW,OAAO;AAC5B;AAAA,UAAA,OACM;AACC,mBAAA;AAAA,UAAA;AAAA,QACR,SACQ;AAAA,MAAA;AAGJ,YAAA,KAAK,kBAAkB,kBAAkB;AAAA,QAC9C,QAAQ,KAAK,qBAAqB,IAAI;AAAA,QACtC;AAAA,QACA,6BAA6B;AAAA,UAC5B,UAAU,QAAQ;AAAA,UAClB,YAAY,QAAQ;AAAA,UACpB,aAAa,QAAQ;AAAA,QACtB;AAAA,QACA,KAAK,CAAA,YAAW,QAAQ,IAAI,OAAO;AAAA,QACnC;AAAA,MAAA,CACA;AACM,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;;"}
@@ -30,7 +30,7 @@ class MigrationExecutionFacade {
30
30
  console.log("Will execute following migrations:");
31
31
  migrations.forEach((it) => console.log(it.name));
32
32
  additionalMessage && console.log(additionalMessage);
33
- if (requireConfirmation) {
33
+ if (typeof requireConfirmation === "function" ? requireConfirmation(migrations) : requireConfirmation) {
34
34
  if (!process.stdin.isTTY) {
35
35
  throw "TTY not available. Pass --yes option to confirm execution.";
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationExecutionFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationExecutionFacade.ts"],"sourcesContent":["import prompts from 'prompts'\nimport { MigrationPrinter } from './MigrationPrinter'\nimport { isSchemaMigration, MigrationExecutor, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from './MigrationsStatusFacade'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { RemoteProject } from '../project/RemoteProject'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { TenantClientProvider } from '../TenantClientProvider'\nimport { RemoteProjectProvider } from '../project/RemoteProjectProvider'\n\nexport class MigrationExecutionFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly tenantClientProvider: TenantClientProvider,\n\t\tprivate readonly projectProvider: RemoteProjectProvider,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutor: MigrationExecutor,\n\t\tprivate readonly migrationStatusFacade: MigrationsStatusFacade,\n\t) {\n\t}\n\n\texecute = async ({\n\t\trequireConfirmation,\n\t\tforce,\n\t\tuntil,\n\t\tadditionalMessage,\n\t}: {\n\t\trequireConfirmation: boolean\n\t\tforce?: boolean\n\t\tuntil?: string\n\t\tadditionalMessage?: string\n\t}): Promise<boolean> => {\n\t\tconst project = this.projectProvider.get()\n\t\tawait this.tenantClientProvider.get().createProject(project.name, true)\n\n\t\tconst status = await this.migrationStatusFacade.resolveMigrationsStatus({ force })\n\t\tconst migrations = until\n\t\t\t? status.migrationsToExecute.filter(it => it.version <= MigrationVersionHelper.extractVersion(until))\n\t\t\t: status.migrationsToExecute\n\t\tif (migrations.length === 0) {\n\t\t\tconsole.log('No migrations to execute')\n\t\t\treturn true\n\t\t}\n\t\tconsole.log('Will execute following migrations:')\n\t\tmigrations.forEach(it => console.log(it.name))\n\t\tadditionalMessage && console.log(additionalMessage)\n\n\t\tif (requireConfirmation) {\n\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Execute migrations' },\n\t\t\t\t\t\t{ value: 'describe', title: 'Describe migrations' },\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (action === 'describe') {\n\t\t\t\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migrations[0].version)\n\t\t\t\t\tfor (const migration of migrations) {\n\t\t\t\t\t\tconst migrationContent = await migration.localMigration.getContent()\n\t\t\t\t\t\tif (!isSchemaMigration(migrationContent)) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.migrationPrinter.printMigrationDescription(schema, migrationContent, {\n\t\t\t\t\t\t\tnoSql: true,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else if (action === 'yes') {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} while (true)\n\t\t}\n\n\t\tawait this.migrationExecutor.executeMigrations({\n\t\t\tclient: this.systemClientProvider.get(),\n\t\t\tmigrations,\n\t\t\tcontentMigrationFactoryArgs: {\n\t\t\t\tapiToken: project.token,\n\t\t\t\tapiBaseUrl: project.endpoint,\n\t\t\t\tprojectName: project.name,\n\t\t\t},\n\t\t\tlog: message => console.log(message),\n\t\t\tforce,\n\t\t})\n\t\treturn true\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAUO,MAAM,yBAAyB;AAAA,EACrC,YACkB,sBACA,sBACA,iBACA,sBACA,kBACA,mBACA,uBAChB;AAPgB,SAAA,uBAAA;AACA,SAAA,uBAAA;AACA,SAAA,kBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,oBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,WAAU,OAAO;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,MAMuB;AACjB,YAAA,UAAU,KAAK,gBAAgB,IAAI;AACzC,YAAM,KAAK,qBAAqB,MAAM,cAAc,QAAQ,MAAM,IAAI;AAEtE,YAAM,SAAS,MAAM,KAAK,sBAAsB,wBAAwB,EAAE,OAAO;AACjF,YAAM,aAAa,QAChB,OAAO,oBAAoB,OAAO,CAAA,OAAM,GAAG,WAAW,uBAAuB,eAAe,KAAK,CAAC,IAClG,OAAO;AACN,UAAA,WAAW,WAAW,GAAG;AAC5B,gBAAQ,IAAI,0BAA0B;AAC/B,eAAA;AAAA,MACR;AACA,cAAQ,IAAI,oCAAoC;AAChD,iBAAW,QAAQ,CAAM,OAAA,QAAQ,IAAI,GAAG,IAAI,CAAC;AACxB,2BAAA,QAAQ,IAAI,iBAAiB;AAElD,UAAI,qBAAqB;AACpB,YAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,gBAAA;AAAA,QACP;AACG,WAAA;AACF,gBAAM,EAAE,WAAW,MAAM,QAAQ;AAAA,YAChC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,YACT,SAAS;AAAA,cACR,EAAE,OAAO,OAAO,OAAO,qBAAqB;AAAA,cAC5C,EAAE,OAAO,YAAY,OAAO,sBAAsB;AAAA,cAClD,EAAE,OAAO,MAAM,OAAO,QAAQ;AAAA,YAC/B;AAAA,UAAA,CACA;AACD,cAAI,WAAW,YAAY;AACpB,kBAAA,SAAS,MAAM,KAAK,qBAAqB,iBAAiB,WAAW,CAAC,EAAE,OAAO;AACrF,uBAAW,aAAa,YAAY;AACnC,oBAAM,mBAAmB,MAAM,UAAU,eAAe,WAAW;AAC/D,kBAAA,CAAC,kBAAkB,gBAAgB,GAAG;AACzC;AAAA,cACD;AAEA,oBAAM,KAAK,iBAAiB,0BAA0B,QAAQ,kBAAkB;AAAA,gBAC/E,OAAO;AAAA,cAAA,CACP;AAAA,YACF;AAAA,UAAA,WACU,WAAW,OAAO;AAC5B;AAAA,UAAA,OACM;AACC,mBAAA;AAAA,UACR;AAAA,QACQ,SAAA;AAAA,MACV;AAEM,YAAA,KAAK,kBAAkB,kBAAkB;AAAA,QAC9C,QAAQ,KAAK,qBAAqB,IAAI;AAAA,QACtC;AAAA,QACA,6BAA6B;AAAA,UAC5B,UAAU,QAAQ;AAAA,UAClB,YAAY,QAAQ;AAAA,UACpB,aAAa,QAAQ;AAAA,QACtB;AAAA,QACA,KAAK,CAAA,YAAW,QAAQ,IAAI,OAAO;AAAA,QACnC;AAAA,MAAA,CACA;AACM,aAAA;AAAA,IAAA,CACR;AAAA,EA3EA;AA4ED;"}
1
+ {"version":3,"file":"MigrationExecutionFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationExecutionFacade.ts"],"sourcesContent":["import prompts from 'prompts'\nimport { MigrationPrinter } from './MigrationPrinter'\nimport { isSchemaMigration, MigrationExecutor, MigrationToExecuteOkStatus, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from './MigrationsStatusFacade'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { RemoteProject } from '../project/RemoteProject'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { TenantClientProvider } from '../TenantClientProvider'\nimport { RemoteProjectProvider } from '../project/RemoteProjectProvider'\n\nexport class MigrationExecutionFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly tenantClientProvider: TenantClientProvider,\n\t\tprivate readonly projectProvider: RemoteProjectProvider,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutor: MigrationExecutor,\n\t\tprivate readonly migrationStatusFacade: MigrationsStatusFacade,\n\t) {\n\t}\n\n\texecute = async ({\n\t\trequireConfirmation,\n\t\tforce,\n\t\tuntil,\n\t\tadditionalMessage,\n\t}: {\n\t\trequireConfirmation: boolean | ((migrations: MigrationToExecuteOkStatus[]) => boolean)\n\t\tforce?: boolean\n\t\tuntil?: string\n\t\tadditionalMessage?: string\n\t}): Promise<boolean> => {\n\t\tconst project = this.projectProvider.get()\n\t\tawait this.tenantClientProvider.get().createProject(project.name, true)\n\n\t\tconst status = await this.migrationStatusFacade.resolveMigrationsStatus({ force })\n\t\tconst migrations = until\n\t\t\t? status.migrationsToExecute.filter(it => it.version <= MigrationVersionHelper.extractVersion(until))\n\t\t\t: status.migrationsToExecute\n\t\tif (migrations.length === 0) {\n\t\t\tconsole.log('No migrations to execute')\n\t\t\treturn true\n\t\t}\n\t\tconsole.log('Will execute following migrations:')\n\t\tmigrations.forEach(it => console.log(it.name))\n\t\tadditionalMessage && console.log(additionalMessage)\n\n\t\tif (typeof requireConfirmation === 'function' ? requireConfirmation(migrations) : requireConfirmation) {\n\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Execute migrations' },\n\t\t\t\t\t\t{ value: 'describe', title: 'Describe migrations' },\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (action === 'describe') {\n\t\t\t\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migrations[0].version)\n\t\t\t\t\tfor (const migration of migrations) {\n\t\t\t\t\t\tconst migrationContent = await migration.localMigration.getContent()\n\t\t\t\t\t\tif (!isSchemaMigration(migrationContent)) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.migrationPrinter.printMigrationDescription(schema, migrationContent, {\n\t\t\t\t\t\t\tnoSql: true,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else if (action === 'yes') {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} while (true)\n\t\t}\n\n\t\tawait this.migrationExecutor.executeMigrations({\n\t\t\tclient: this.systemClientProvider.get(),\n\t\t\tmigrations,\n\t\t\tcontentMigrationFactoryArgs: {\n\t\t\t\tapiToken: project.token,\n\t\t\t\tapiBaseUrl: project.endpoint,\n\t\t\t\tprojectName: project.name,\n\t\t\t},\n\t\t\tlog: message => console.log(message),\n\t\t\tforce,\n\t\t})\n\t\treturn true\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAUO,MAAM,yBAAyB;AAAA,EACrC,YACkB,sBACA,sBACA,iBACA,sBACA,kBACA,mBACA,uBAChB;AAPgB,SAAA,uBAAA;AACA,SAAA,uBAAA;AACA,SAAA,kBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,oBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,WAAU,OAAO;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,MAMuB;AACjB,YAAA,UAAU,KAAK,gBAAgB,IAAI;AACzC,YAAM,KAAK,qBAAqB,IAAA,EAAM,cAAc,QAAQ,MAAM,IAAI;AAEtE,YAAM,SAAS,MAAM,KAAK,sBAAsB,wBAAwB,EAAE,OAAO;AACjF,YAAM,aAAa,QAChB,OAAO,oBAAoB,OAAO,CAAA,OAAM,GAAG,WAAW,uBAAuB,eAAe,KAAK,CAAC,IAClG,OAAO;AACN,UAAA,WAAW,WAAW,GAAG;AAC5B,gBAAQ,IAAI,0BAA0B;AAC/B,eAAA;AAAA,MAAA;AAER,cAAQ,IAAI,oCAAoC;AAChD,iBAAW,QAAQ,CAAM,OAAA,QAAQ,IAAI,GAAG,IAAI,CAAC;AACxB,2BAAA,QAAQ,IAAI,iBAAiB;AAElD,UAAI,OAAO,wBAAwB,aAAa,oBAAoB,UAAU,IAAI,qBAAqB;AAClG,YAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,gBAAA;AAAA,QAAA;AAEJ,WAAA;AACF,gBAAM,EAAE,WAAW,MAAM,QAAQ;AAAA,YAChC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,YACT,SAAS;AAAA,cACR,EAAE,OAAO,OAAO,OAAO,qBAAqB;AAAA,cAC5C,EAAE,OAAO,YAAY,OAAO,sBAAsB;AAAA,cAClD,EAAE,OAAO,MAAM,OAAO,QAAQ;AAAA,YAAA;AAAA,UAC/B,CACA;AACD,cAAI,WAAW,YAAY;AACpB,kBAAA,SAAS,MAAM,KAAK,qBAAqB,iBAAiB,WAAW,CAAC,EAAE,OAAO;AACrF,uBAAW,aAAa,YAAY;AACnC,oBAAM,mBAAmB,MAAM,UAAU,eAAe,WAAW;AAC/D,kBAAA,CAAC,kBAAkB,gBAAgB,GAAG;AACzC;AAAA,cAAA;AAGD,oBAAM,KAAK,iBAAiB,0BAA0B,QAAQ,kBAAkB;AAAA,gBAC/E,OAAO;AAAA,cAAA,CACP;AAAA,YAAA;AAAA,UACF,WACU,WAAW,OAAO;AAC5B;AAAA,UAAA,OACM;AACC,mBAAA;AAAA,UAAA;AAAA,QACR,SACQ;AAAA,MAAA;AAGJ,YAAA,KAAK,kBAAkB,kBAAkB;AAAA,QAC9C,QAAQ,KAAK,qBAAqB,IAAI;AAAA,QACtC;AAAA,QACA,6BAA6B;AAAA,UAC5B,UAAU,QAAQ;AAAA,UAClB,YAAY,QAAQ;AAAA,UACpB,aAAa,QAAQ;AAAA,QACtB;AAAA,QACA,KAAK,CAAA,YAAW,QAAQ,IAAI,OAAO;AAAA,QACnC;AAAA,MAAA,CACA;AACM,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationPrinter.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\tconst table = chalkTable(\n\t\t\t{\n\t\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t\t},\n\t\t\tmigrations.map(it => {\n\t\t\t\tswitch (it.state) {\n\t\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(it)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t\tconsole.log(table)\n\t}\n\n}\n"],"names":["description","emptyDatabaseMetadata","MigrationState","assertNever"],"mappings":";;;;;;;;;;AAOO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAIU,kBAAA,MAAA,6BAAA,CAC3B,QACA,WACA,YACI;AACJ,YAAM,cAAc,KAAK,oBAAoB,sBAAsB,QAAQ,SAAS;AACpF,kBAAY,QAAQ,CAAC,EAAE,cAAc,QAAQ,aAAAA,mBAAkB;AAC9D,cAAM,MAAM,OAAO;AAAA,UAClB,cAAc;AAAA,UACd,kBAAkBC,SAAA;AAAA,UAClB,4BAA4B,MAAM;AAAA,QAAA,CAClC;AACD,YAAI,QAAQ,SAAS;AAChB,cAAA,IAAI,QAAQ;AACf,oBAAQ,IAAI,GAAG;AAAA,UAChB;AAAA,QAAA,OACM;AACN,gBAAM,QAAQD,aAAY,gBAAgB,MAAM,MAAM,MAAM;AACpD,kBAAA,MAAM,MAAM,GAAGA,aAAY,OAAO,KAAK,aAAa,YAAY,GAAG,CAAC;AAC5E,cAAIA,aAAY,gBAAgB;AACvB,oBAAA,IAAI,MAAM,QAAQ,MAAM,UAAUA,aAAY,cAAc,CAAC,CAAC;AAAA,UACvE;AAEI,cAAA,CAAC,QAAQ,OAAO;AACf,gBAAA,IAAI,QAAQ;AACf,sBAAQ,IAAI,GAAG;AAAA,YAAA,OACT;AACN,sBAAQ,IAAI,mBAAmB;AAAA,YAChC;AAAA,UACD;AACA,kBAAQ,SAAS;AAAA,QAClB;AAAA,MAAA,CACA;AAAA,IAAA,CACF;AAEA,kBAAA,MAAA,oBAAmB,CAAC,eAAqC;AACxD,YAAM,QAAQ;AAAA,QACb;AAAA,UACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,QACxC;AAAA,QACA,WAAW,IAAI,CAAM,OAAA;AACpB,kBAAQ,GAAG,OAAO;AAAA,YACjB,KAAKE,iBAAe,eAAA;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F,KAAKA,iBAAe,eAAA;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,gBAC5C,WAAW,GAAG;AAAA,gBACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,cAAA;AAAA,YAEpE,KAAKA,iBAAe,eAAA;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,gBACvC,WAAW,GAAG;AAAA,gBACd,MAAM,GAAG;AAAA,cAAA;AAAA,YAEX,KAAKA,iBAAe,eAAA;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,gBAC/C,WAAW,GAAG;AAAA,gBACd,MAAM;AAAA,cAAA;AAAA,YAER,KAAKA,iBAAe,eAAA;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F;AACCC,0BAAAA,YAAc;AAAA,UAChB;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,cAAQ,IAAI,KAAK;AAAA,IAAA,CAClB;AAAA,EAxEA;AA0ED;;"}
1
+ {"version":3,"file":"MigrationPrinter.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../../../types/chalk-table/index.d.ts\" />\n\nimport { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\tconst table = chalkTable(\n\t\t\t{\n\t\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t\t},\n\t\t\tmigrations.map(it => {\n\t\t\t\tswitch (it.state) {\n\t\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(it)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t\tconsole.log(table)\n\t}\n\n}\n"],"names":["description","emptyDatabaseMetadata","MigrationState","assertNever"],"mappings":";;;;;;;;;;AAUO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAIU,kBAAA,MAAA,6BAAA,CAC3B,QACA,WACA,YACI;AACJ,YAAM,cAAc,KAAK,oBAAoB,sBAAsB,QAAQ,SAAS;AACpF,kBAAY,QAAQ,CAAC,EAAE,cAAc,QAAQ,aAAAA,mBAAkB;AAC9D,cAAM,MAAM,OAAO;AAAA,UAClB,cAAc;AAAA,UACd,kBAAkBC,SAAA;AAAA,UAClB,4BAA4B,MAAM;AAAA,QAAA,CAClC;AACD,YAAI,QAAQ,SAAS;AAChB,cAAA,IAAI,QAAQ;AACf,oBAAQ,IAAI,GAAG;AAAA,UAAA;AAAA,QAChB,OACM;AACN,gBAAM,QAAQD,aAAY,gBAAgB,MAAM,MAAM,MAAM;AACpD,kBAAA,MAAM,MAAM,GAAGA,aAAY,OAAO,KAAK,aAAa,YAAY,GAAG,CAAC;AAC5E,cAAIA,aAAY,gBAAgB;AACvB,oBAAA,IAAI,MAAM,QAAQ,MAAM,UAAUA,aAAY,cAAc,CAAC,CAAC;AAAA,UAAA;AAGnE,cAAA,CAAC,QAAQ,OAAO;AACf,gBAAA,IAAI,QAAQ;AACf,sBAAQ,IAAI,GAAG;AAAA,YAAA,OACT;AACN,sBAAQ,IAAI,mBAAmB;AAAA,YAAA;AAAA,UAChC;AAED,kBAAQ,SAAS;AAAA,QAAA;AAAA,MAClB,CACA;AAAA,IAAA,CACF;AAEA,kBAAA,MAAA,oBAAmB,CAAC,eAAqC;AACxD,YAAM,QAAQ;AAAA,QACb;AAAA,UACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,QACxC;AAAA,QACA,WAAW,IAAI,CAAM,OAAA;AACpB,kBAAQ,GAAG,OAAO;AAAA,YACjB,KAAKE,iBAAe,eAAA;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F,KAAKA,iBAAe,eAAA;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,gBAC5C,WAAW,GAAG;AAAA,gBACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,cACnE;AAAA,YACD,KAAKA,iBAAe,eAAA;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,gBACvC,WAAW,GAAG;AAAA,gBACd,MAAM,GAAG;AAAA,cACV;AAAA,YACD,KAAKA,iBAAe,eAAA;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,gBAC/C,WAAW,GAAG;AAAA,gBACd,MAAM;AAAA,cACP;AAAA,YACD,KAAKA,iBAAe,eAAA;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F;AACCC,0BAAAA,YAAc;AAAA,UAAA;AAAA,QAEhB,CAAA;AAAA,MACF;AACA,cAAQ,IAAI,KAAK;AAAA,IAAA,CAClB;AAAA,EAAA;AAED;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationPrinter.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["import { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\tconst table = chalkTable(\n\t\t\t{\n\t\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t\t},\n\t\t\tmigrations.map(it => {\n\t\t\t\tswitch (it.state) {\n\t\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(it)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t\tconsole.log(table)\n\t}\n\n}\n"],"names":["description"],"mappings":";;;;;;;;AAOO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAIU,kBAAA,MAAA,6BAAA,CAC3B,QACA,WACA,YACI;AACJ,YAAM,cAAc,KAAK,oBAAoB,sBAAsB,QAAQ,SAAS;AACpF,kBAAY,QAAQ,CAAC,EAAE,cAAc,QAAQ,aAAAA,mBAAkB;AAC9D,cAAM,MAAM,OAAO;AAAA,UAClB,cAAc;AAAA,UACd,kBAAkB;AAAA,UAClB,4BAA4B,MAAM;AAAA,QAAA,CAClC;AACD,YAAI,QAAQ,SAAS;AAChB,cAAA,IAAI,QAAQ;AACf,oBAAQ,IAAI,GAAG;AAAA,UAChB;AAAA,QAAA,OACM;AACN,gBAAM,QAAQA,aAAY,gBAAgB,MAAM,MAAM,MAAM;AACpD,kBAAA,MAAM,MAAM,GAAGA,aAAY,OAAO,KAAK,aAAa,YAAY,GAAG,CAAC;AAC5E,cAAIA,aAAY,gBAAgB;AACvB,oBAAA,IAAI,MAAM,QAAQ,MAAM,UAAUA,aAAY,cAAc,CAAC,CAAC;AAAA,UACvE;AAEI,cAAA,CAAC,QAAQ,OAAO;AACf,gBAAA,IAAI,QAAQ;AACf,sBAAQ,IAAI,GAAG;AAAA,YAAA,OACT;AACN,sBAAQ,IAAI,mBAAmB;AAAA,YAChC;AAAA,UACD;AACA,kBAAQ,SAAS;AAAA,QAClB;AAAA,MAAA,CACA;AAAA,IAAA,CACF;AAEA,kBAAA,MAAA,oBAAmB,CAAC,eAAqC;AACxD,YAAM,QAAQ;AAAA,QACb;AAAA,UACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,QACxC;AAAA,QACA,WAAW,IAAI,CAAM,OAAA;AACpB,kBAAQ,GAAG,OAAO;AAAA,YACjB,KAAK,eAAe;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F,KAAK,eAAe;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,gBAC5C,WAAW,GAAG;AAAA,gBACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,cAAA;AAAA,YAEpE,KAAK,eAAe;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,gBACvC,WAAW,GAAG;AAAA,gBACd,MAAM,GAAG;AAAA,cAAA;AAAA,YAEX,KAAK,eAAe;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,gBAC/C,WAAW,GAAG;AAAA,gBACd,MAAM;AAAA,cAAA;AAAA,YAER,KAAK,eAAe;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F;AACC,0BAAc;AAAA,UAChB;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,cAAQ,IAAI,KAAK;AAAA,IAAA,CAClB;AAAA,EAxEA;AA0ED;"}
1
+ {"version":3,"file":"MigrationPrinter.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationPrinter.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../../../types/chalk-table/index.d.ts\" />\n\nimport { Schema } from '@contember/schema'\nimport chalk from 'chalk'\nimport { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\n\nexport class MigrationPrinter {\n\tconstructor(\n\t\tprivate readonly migrationsDescriber: MigrationDescriber,\n\t) {\n\t}\n\n\tprintMigrationDescription = (\n\t\tschema: Schema,\n\t\tmigration: Migration,\n\t\toptions: { sqlOnly?: boolean; noSql?: boolean },\n\t) => {\n\t\tconst description = this.migrationsDescriber.describeModifications(schema, migration)\n\t\tdescription.forEach(({ modification, getSql, description }) => {\n\t\t\tconst sql = getSql({\n\t\t\t\tsystemSchema: 'system',\n\t\t\t\tdatabaseMetadata: emptyDatabaseMetadata,\n\t\t\t\tinvalidateDatabaseMetadata: () => null,\n\t\t\t})\n\t\t\tif (options.sqlOnly) {\n\t\t\t\tif (sql.trim()) {\n\t\t\t\t\tconsole.log(sql)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst color = description.isDestructive ? chalk.red : chalk.blue\n\t\t\t\tconsole.group(color(`${description.message} [${modification.modification}]`))\n\t\t\t\tif (description.failureWarning) {\n\t\t\t\t\tconsole.log(chalk.bgWhite(chalk.redBright(description.failureWarning)))\n\t\t\t\t}\n\n\t\t\t\tif (!options.noSql) {\n\t\t\t\t\tif (sql.trim()) {\n\t\t\t\t\t\tconsole.log(sql)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.log('No sql to execute')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.groupEnd()\n\t\t\t}\n\t\t})\n\t}\n\n\tprintStatusTable = (migrations: AnyMigrationStatus[]) => {\n\t\tconst table = chalkTable(\n\t\t\t{\n\t\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t\t},\n\t\t\tmigrations.map(it => {\n\t\t\t\tswitch (it.state) {\n\t\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t\t}\n\t\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(it)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t\tconsole.log(table)\n\t}\n\n}\n"],"names":["description"],"mappings":";;;;;;;;AAUO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAIU,kBAAA,MAAA,6BAAA,CAC3B,QACA,WACA,YACI;AACJ,YAAM,cAAc,KAAK,oBAAoB,sBAAsB,QAAQ,SAAS;AACpF,kBAAY,QAAQ,CAAC,EAAE,cAAc,QAAQ,aAAAA,mBAAkB;AAC9D,cAAM,MAAM,OAAO;AAAA,UAClB,cAAc;AAAA,UACd,kBAAkB;AAAA,UAClB,4BAA4B,MAAM;AAAA,QAAA,CAClC;AACD,YAAI,QAAQ,SAAS;AAChB,cAAA,IAAI,QAAQ;AACf,oBAAQ,IAAI,GAAG;AAAA,UAAA;AAAA,QAChB,OACM;AACN,gBAAM,QAAQA,aAAY,gBAAgB,MAAM,MAAM,MAAM;AACpD,kBAAA,MAAM,MAAM,GAAGA,aAAY,OAAO,KAAK,aAAa,YAAY,GAAG,CAAC;AAC5E,cAAIA,aAAY,gBAAgB;AACvB,oBAAA,IAAI,MAAM,QAAQ,MAAM,UAAUA,aAAY,cAAc,CAAC,CAAC;AAAA,UAAA;AAGnE,cAAA,CAAC,QAAQ,OAAO;AACf,gBAAA,IAAI,QAAQ;AACf,sBAAQ,IAAI,GAAG;AAAA,YAAA,OACT;AACN,sBAAQ,IAAI,mBAAmB;AAAA,YAAA;AAAA,UAChC;AAED,kBAAQ,SAAS;AAAA,QAAA;AAAA,MAClB,CACA;AAAA,IAAA,CACF;AAEA,kBAAA,MAAA,oBAAmB,CAAC,eAAqC;AACxD,YAAM,QAAQ;AAAA,QACb;AAAA,UACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,QACxC;AAAA,QACA,WAAW,IAAI,CAAM,OAAA;AACpB,kBAAQ,GAAG,OAAO;AAAA,YACjB,KAAK,eAAe;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F,KAAK,eAAe;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,gBAC5C,WAAW,GAAG;AAAA,gBACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,cACnE;AAAA,YACD,KAAK,eAAe;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,gBACvC,WAAW,GAAG;AAAA,gBACd,MAAM,GAAG;AAAA,cACV;AAAA,YACD,KAAK,eAAe;AACZ,qBAAA;AAAA,gBACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,gBAC/C,WAAW,GAAG;AAAA,gBACd,MAAM;AAAA,cACP;AAAA,YACD,KAAK,eAAe;AACnB,qBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,YAC9F;AACC,0BAAc;AAAA,UAAA;AAAA,QAEhB,CAAA;AAAA,MACF;AACA,cAAQ,IAAI,KAAK;AAAA,IAAA,CAClB;AAAA,EAAA;AAED;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationRebaseFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationRebaseFacade.ts"],"sourcesContent":["import { Migration, MigrationFilesManager, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsValidator } from './MigrationsValidator'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationRebaseFacade {\n\tconstructor(\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t) {\n\t}\n\n\trebase = async (migrations: Migration[]) => {\n\t\tconst versions = migrations.map(it => it.version)\n\t\tconst schemaWithoutMigrations = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\temptySchema,\n\t\t\tversion => !versions.includes(version),\n\t\t)\n\t\tconst valid = await this.migrationsValidator.validate(schemaWithoutMigrations, migrations)\n\t\tif (!valid) {\n\t\t\tthrow `Cannot rebase migrations`\n\t\t}\n\n\t\tlet i = 0\n\t\tfor (const migration of migrations) {\n\t\t\tconst name = migration.name.substring(MigrationVersionHelper.prefixLength + 1)\n\t\t\tconst [version, fullName] = MigrationVersionHelper.createVersion(name, i++)\n\t\t\tconst newMigration = {\n\t\t\t\tname: fullName,\n\t\t\t\tversion: version,\n\t\t\t\tformatVersion: migration.formatVersion,\n\t\t\t\tmodifications: migration.modifications,\n\t\t\t}\n\t\t\tawait this.systemClientProvider.get().migrationModify(migration.version, newMigration)\n\t\t\tawait this.migrationFilesManager.moveFile(migration.name, newMigration.name)\n\t\t}\n\t}\n}\n"],"names":["emptySchema","MigrationVersionHelper"],"mappings":";;;;;;;AAMO,MAAM,sBAAsB;AAAA,EAClC,YACkB,sBACA,qBACA,sBACA,uBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,uBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,UAAS,OAAO,eAA4B;AAC3C,YAAM,WAAW,WAAW,IAAI,CAAA,OAAM,GAAG,OAAO;AAC1C,YAAA,0BAA0B,MAAM,KAAK,qBAAqB;AAAA,QAC/DA,YAAA;AAAA,QACA,CAAW,YAAA,CAAC,SAAS,SAAS,OAAO;AAAA,MAAA;AAEtC,YAAM,QAAQ,MAAM,KAAK,oBAAoB,SAAS,yBAAyB,UAAU;AACzF,UAAI,CAAC,OAAO;AACL,cAAA;AAAA,MACP;AAEA,UAAI,IAAI;AACR,iBAAW,aAAa,YAAY;AACnC,cAAM,OAAO,UAAU,KAAK,UAAUC,oCAAuB,eAAe,CAAC;AAC7E,cAAM,CAAC,SAAS,QAAQ,IAAIA,aAAAA,uBAAuB,cAAc,MAAM,GAAG;AAC1E,cAAM,eAAe;AAAA,UACpB,MAAM;AAAA,UACN;AAAA,UACA,eAAe,UAAU;AAAA,UACzB,eAAe,UAAU;AAAA,QAAA;AAE1B,cAAM,KAAK,qBAAqB,MAAM,gBAAgB,UAAU,SAAS,YAAY;AACrF,cAAM,KAAK,sBAAsB,SAAS,UAAU,MAAM,aAAa,IAAI;AAAA,MAC5E;AAAA,IAAA,CACD;AAAA,EA1BA;AA2BD;;"}
1
+ {"version":3,"file":"MigrationRebaseFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationRebaseFacade.ts"],"sourcesContent":["import { Migration, MigrationFilesManager, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsValidator } from './MigrationsValidator'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationRebaseFacade {\n\tconstructor(\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t) {\n\t}\n\n\trebase = async (migrations: Migration[]) => {\n\t\tconst versions = migrations.map(it => it.version)\n\t\tconst schemaWithoutMigrations = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\temptySchema,\n\t\t\tversion => !versions.includes(version),\n\t\t)\n\t\tconst valid = await this.migrationsValidator.validate(schemaWithoutMigrations, migrations)\n\t\tif (!valid) {\n\t\t\tthrow `Cannot rebase migrations`\n\t\t}\n\n\t\tlet i = 0\n\t\tfor (const migration of migrations) {\n\t\t\tconst name = migration.name.substring(MigrationVersionHelper.prefixLength + 1)\n\t\t\tconst [version, fullName] = MigrationVersionHelper.createVersion(name, i++)\n\t\t\tconst newMigration = {\n\t\t\t\tname: fullName,\n\t\t\t\tversion: version,\n\t\t\t\tformatVersion: migration.formatVersion,\n\t\t\t\tmodifications: migration.modifications,\n\t\t\t}\n\t\t\tawait this.systemClientProvider.get().migrationModify(migration.version, newMigration)\n\t\t\tawait this.migrationFilesManager.moveFile(migration.name, newMigration.name)\n\t\t}\n\t}\n}\n"],"names":["emptySchema","MigrationVersionHelper"],"mappings":";;;;;;;AAMO,MAAM,sBAAsB;AAAA,EAClC,YACkB,sBACA,qBACA,sBACA,uBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,uBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,UAAS,OAAO,eAA4B;AAC3C,YAAM,WAAW,WAAW,IAAI,CAAA,OAAM,GAAG,OAAO;AAC1C,YAAA,0BAA0B,MAAM,KAAK,qBAAqB;AAAA,QAC/DA,YAAA;AAAA,QACA,CAAW,YAAA,CAAC,SAAS,SAAS,OAAO;AAAA,MACtC;AACA,YAAM,QAAQ,MAAM,KAAK,oBAAoB,SAAS,yBAAyB,UAAU;AACzF,UAAI,CAAC,OAAO;AACL,cAAA;AAAA,MAAA;AAGP,UAAI,IAAI;AACR,iBAAW,aAAa,YAAY;AACnC,cAAM,OAAO,UAAU,KAAK,UAAUC,aAAA,uBAAuB,eAAe,CAAC;AAC7E,cAAM,CAAC,SAAS,QAAQ,IAAIA,aAAuB,uBAAA,cAAc,MAAM,GAAG;AAC1E,cAAM,eAAe;AAAA,UACpB,MAAM;AAAA,UACN;AAAA,UACA,eAAe,UAAU;AAAA,UACzB,eAAe,UAAU;AAAA,QAC1B;AACA,cAAM,KAAK,qBAAqB,IAAA,EAAM,gBAAgB,UAAU,SAAS,YAAY;AACrF,cAAM,KAAK,sBAAsB,SAAS,UAAU,MAAM,aAAa,IAAI;AAAA,MAAA;AAAA,IAC5E,CACD;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationRebaseFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationRebaseFacade.ts"],"sourcesContent":["import { Migration, MigrationFilesManager, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsValidator } from './MigrationsValidator'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationRebaseFacade {\n\tconstructor(\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t) {\n\t}\n\n\trebase = async (migrations: Migration[]) => {\n\t\tconst versions = migrations.map(it => it.version)\n\t\tconst schemaWithoutMigrations = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\temptySchema,\n\t\t\tversion => !versions.includes(version),\n\t\t)\n\t\tconst valid = await this.migrationsValidator.validate(schemaWithoutMigrations, migrations)\n\t\tif (!valid) {\n\t\t\tthrow `Cannot rebase migrations`\n\t\t}\n\n\t\tlet i = 0\n\t\tfor (const migration of migrations) {\n\t\t\tconst name = migration.name.substring(MigrationVersionHelper.prefixLength + 1)\n\t\t\tconst [version, fullName] = MigrationVersionHelper.createVersion(name, i++)\n\t\t\tconst newMigration = {\n\t\t\t\tname: fullName,\n\t\t\t\tversion: version,\n\t\t\t\tformatVersion: migration.formatVersion,\n\t\t\t\tmodifications: migration.modifications,\n\t\t\t}\n\t\t\tawait this.systemClientProvider.get().migrationModify(migration.version, newMigration)\n\t\t\tawait this.migrationFilesManager.moveFile(migration.name, newMigration.name)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,sBAAsB;AAAA,EAClC,YACkB,sBACA,qBACA,sBACA,uBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,uBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,UAAS,OAAO,eAA4B;AAC3C,YAAM,WAAW,WAAW,IAAI,CAAA,OAAM,GAAG,OAAO;AAC1C,YAAA,0BAA0B,MAAM,KAAK,qBAAqB;AAAA,QAC/D;AAAA,QACA,CAAW,YAAA,CAAC,SAAS,SAAS,OAAO;AAAA,MAAA;AAEtC,YAAM,QAAQ,MAAM,KAAK,oBAAoB,SAAS,yBAAyB,UAAU;AACzF,UAAI,CAAC,OAAO;AACL,cAAA;AAAA,MACP;AAEA,UAAI,IAAI;AACR,iBAAW,aAAa,YAAY;AACnC,cAAM,OAAO,UAAU,KAAK,UAAU,uBAAuB,eAAe,CAAC;AAC7E,cAAM,CAAC,SAAS,QAAQ,IAAI,uBAAuB,cAAc,MAAM,GAAG;AAC1E,cAAM,eAAe;AAAA,UACpB,MAAM;AAAA,UACN;AAAA,UACA,eAAe,UAAU;AAAA,UACzB,eAAe,UAAU;AAAA,QAAA;AAE1B,cAAM,KAAK,qBAAqB,MAAM,gBAAgB,UAAU,SAAS,YAAY;AACrF,cAAM,KAAK,sBAAsB,SAAS,UAAU,MAAM,aAAa,IAAI;AAAA,MAC5E;AAAA,IAAA,CACD;AAAA,EA1BA;AA2BD;"}
1
+ {"version":3,"file":"MigrationRebaseFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationRebaseFacade.ts"],"sourcesContent":["import { Migration, MigrationFilesManager, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsValidator } from './MigrationsValidator'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationVersionHelper } from '@contember/engine-common'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationRebaseFacade {\n\tconstructor(\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t) {\n\t}\n\n\trebase = async (migrations: Migration[]) => {\n\t\tconst versions = migrations.map(it => it.version)\n\t\tconst schemaWithoutMigrations = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\temptySchema,\n\t\t\tversion => !versions.includes(version),\n\t\t)\n\t\tconst valid = await this.migrationsValidator.validate(schemaWithoutMigrations, migrations)\n\t\tif (!valid) {\n\t\t\tthrow `Cannot rebase migrations`\n\t\t}\n\n\t\tlet i = 0\n\t\tfor (const migration of migrations) {\n\t\t\tconst name = migration.name.substring(MigrationVersionHelper.prefixLength + 1)\n\t\t\tconst [version, fullName] = MigrationVersionHelper.createVersion(name, i++)\n\t\t\tconst newMigration = {\n\t\t\t\tname: fullName,\n\t\t\t\tversion: version,\n\t\t\t\tformatVersion: migration.formatVersion,\n\t\t\t\tmodifications: migration.modifications,\n\t\t\t}\n\t\t\tawait this.systemClientProvider.get().migrationModify(migration.version, newMigration)\n\t\t\tawait this.migrationFilesManager.moveFile(migration.name, newMigration.name)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,sBAAsB;AAAA,EAClC,YACkB,sBACA,qBACA,sBACA,uBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,uBAAA;AACA,SAAA,wBAAA;AAIlB,kBAAA,MAAA,UAAS,OAAO,eAA4B;AAC3C,YAAM,WAAW,WAAW,IAAI,CAAA,OAAM,GAAG,OAAO;AAC1C,YAAA,0BAA0B,MAAM,KAAK,qBAAqB;AAAA,QAC/D;AAAA,QACA,CAAW,YAAA,CAAC,SAAS,SAAS,OAAO;AAAA,MACtC;AACA,YAAM,QAAQ,MAAM,KAAK,oBAAoB,SAAS,yBAAyB,UAAU;AACzF,UAAI,CAAC,OAAO;AACL,cAAA;AAAA,MAAA;AAGP,UAAI,IAAI;AACR,iBAAW,aAAa,YAAY;AACnC,cAAM,OAAO,UAAU,KAAK,UAAU,uBAAuB,eAAe,CAAC;AAC7E,cAAM,CAAC,SAAS,QAAQ,IAAI,uBAAuB,cAAc,MAAM,GAAG;AAC1E,cAAM,eAAe;AAAA,UACpB,MAAM;AAAA,UACN;AAAA,UACA,eAAe,UAAU;AAAA,UACzB,eAAe,UAAU;AAAA,QAC1B;AACA,cAAM,KAAK,qBAAqB,IAAA,EAAM,gBAAgB,UAAU,SAAS,YAAY;AACrF,cAAM,KAAK,sBAAsB,SAAS,UAAU,MAAM,aAAa,IAAI;AAAA,MAAA;AAAA,IAC5E,CACD;AAAA,EAAA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationsStatusFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver, SystemClient } from '@contember/migrations-client'\nimport { createMigrationStatusTable } from './migrations'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t) {\n\t}\n\n\n\tpublic resolveMigrationsStatus = async ({ force }: { force?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0) {\n\t\t\tconsole.error(createMigrationStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":["createMigrationStatusTable"],"mappings":";;;;;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BAChB;AAHgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AAKlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,MAAA,MAAiC;AAC1E,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM;AACjE,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAkB;AACxE,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AAC7G,UAAA,OAAO,gBAAgB,SAAS,GAAG;AACtC,gBAAQ,MAAMA,WAAAA,2BAA2B,OAAO,eAAe,CAAC;AAChE,YAAI,CAAC,OAAO;AACL,gBAAA;AAAA,QACP;AAAA,MACD;AAEO,aAAA;AAAA,IAAA,CACR;AAAA,EAfA;AAgBD;;"}
1
+ {"version":3,"file":"MigrationsStatusFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver, SystemClient } from '@contember/migrations-client'\nimport { createMigrationStatusTable } from './migrations'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t) {\n\t}\n\n\n\tpublic resolveMigrationsStatus = async ({ force }: { force?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0) {\n\t\t\tconsole.error(createMigrationStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":["createMigrationStatusTable"],"mappings":";;;;;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BAChB;AAHgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AAKlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,MAAA,MAAiC;AAC1E,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAuB;AACxF,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAkB;AACxE,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AAC7G,UAAA,OAAO,gBAAgB,SAAS,GAAG;AACtC,gBAAQ,MAAMA,WAAAA,2BAA2B,OAAO,eAAe,CAAC;AAChE,YAAI,CAAC,OAAO;AACL,gBAAA;AAAA,QAAA;AAAA,MACP;AAGM,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationsStatusFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver, SystemClient } from '@contember/migrations-client'\nimport { createMigrationStatusTable } from './migrations'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t) {\n\t}\n\n\n\tpublic resolveMigrationsStatus = async ({ force }: { force?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0) {\n\t\t\tconsole.error(createMigrationStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BAChB;AAHgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AAKlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,MAAA,MAAiC;AAC1E,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM;AACjE,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAkB;AACxE,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AAC7G,UAAA,OAAO,gBAAgB,SAAS,GAAG;AACtC,gBAAQ,MAAM,2BAA2B,OAAO,eAAe,CAAC;AAChE,YAAI,CAAC,OAAO;AACL,gBAAA;AAAA,QACP;AAAA,MACD;AAEO,aAAA;AAAA,IAAA,CACR;AAAA,EAfA;AAgBD;"}
1
+ {"version":3,"file":"MigrationsStatusFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver, SystemClient } from '@contember/migrations-client'\nimport { createMigrationStatusTable } from './migrations'\nimport { SystemClientProvider } from '../SystemClientProvider'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t) {\n\t}\n\n\n\tpublic resolveMigrationsStatus = async ({ force }: { force?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0) {\n\t\t\tconsole.error(createMigrationStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BAChB;AAHgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AAKlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,MAAA,MAAiC;AAC1E,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAuB;AACxF,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAkB;AACxE,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AAC7G,UAAA,OAAO,gBAAgB,SAAS,GAAG;AACtC,gBAAQ,MAAM,2BAA2B,OAAO,eAAe,CAAC;AAChE,YAAI,CAAC,OAAO;AACL,gBAAA;AAAA,QAAA;AAAA,MACP;AAGM,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationsValidator.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":["SchemaUpdateError","MigrationVersionHelper","validateSchemaAndPrintErrors"],"mappings":";;;;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIP,kBAAA,MAAA,YAAA,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAA;AACpD,iBAAW,aAAa,YAAY;AAC/B,YAAA;AAEE,eAAA,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,iBAC1G,GAAG;AACX,cAAI,aAAaA,iBAAAA,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UACvD;AACM,gBAAA;AAAA,QACP;AACM,cAAA,eAAe,aAAa,UAAU,IAAI;AAChC,wBAAA;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAaC,wCAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAC;AAAA,QAAA;AAEhC,uBAAeC,uBAA6B,6BAAA,gBAAgB,cAAc,aAAa,KACnF;AAAA,MACL;AACO,aAAA;AAAA,IAAA,CACR;AAAA,EA3BA;AA4BD;;"}
1
+ {"version":3,"file":"MigrationsValidator.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":["SchemaUpdateError","MigrationVersionHelper","validateSchemaAndPrintErrors"],"mappings":";;;;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIP,kBAAA,MAAA,YAAA,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAC;AACrD,iBAAW,aAAa,YAAY;AAC/B,YAAA;AAEE,eAAA,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,iBAC1G,GAAG;AACX,cAAI,aAAaA,iBAAAA,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UAAA;AAEjD,gBAAA;AAAA,QAAA;AAED,cAAA,eAAe,aAAa,UAAU,IAAI;AAChC,wBAAA;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAaC,wCAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAA;AAAA,QAC/B;AACA,uBAAeC,uBAAAA,6BAA6B,gBAAgB,cAAc,aAAa,KACnF;AAAA,MAAA;AAEE,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MigrationsValidator.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIP,kBAAA,MAAA,YAAA,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAA;AACpD,iBAAW,aAAa,YAAY;AAC/B,YAAA;AAEE,eAAA,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,iBAC1G,GAAG;AACX,cAAI,aAAa,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UACvD;AACM,gBAAA;AAAA,QACP;AACM,cAAA,eAAe,aAAa,UAAU,IAAI;AAChC,wBAAA;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAa,uBAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAC;AAAA,QAAA;AAEhC,uBAAe,6BAA6B,gBAAgB,cAAc,aAAa,KACnF;AAAA,MACL;AACO,aAAA;AAAA,IAAA,CACR;AAAA,EA3BA;AA4BD;"}
1
+ {"version":3,"file":"MigrationsValidator.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIP,kBAAA,MAAA,YAAA,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAC;AACrD,iBAAW,aAAa,YAAY;AAC/B,YAAA;AAEE,eAAA,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,iBAC1G,GAAG;AACX,cAAI,aAAa,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UAAA;AAEjD,gBAAA;AAAA,QAAA;AAED,cAAA,eAAe,aAAa,UAAU,IAAI;AAChC,wBAAA;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAa,uBAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAA;AAAA,QAC/B;AACA,uBAAe,6BAA6B,gBAAgB,cAAc,aAAa,KACnF;AAAA,MAAA;AAEE,aAAA;AAAA,IAAA,CACR;AAAA,EAAA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/migrations.ts"],"sourcesContent":["import { Migration, MigrationDescriber } from '@contember/schema-migrations'\nimport chalk from 'chalk'\nimport { Schema } from '@contember/schema'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport { MigrationState } from '@contember/migrations-client'\nimport { AnyMigrationStatus } from '@contember/migrations-client'\n\n\nexport const createMigrationStatusTable = (migrations: AnyMigrationStatus[]): string => {\n\treturn chalkTable(\n\t\t{\n\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t},\n\t\tmigrations.map(it => {\n\t\t\tswitch (it.state) {\n\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(it)\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"names":["MigrationState","assertNever"],"mappings":";;;;;;AAUa,MAAA,6BAA6B,CAAC,eAA6C;AAChF,SAAA;AAAA,IACN;AAAA,MACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,IACxC;AAAA,IACA,WAAW,IAAI,CAAM,OAAA;AACpB,cAAQ,GAAG,OAAO;AAAA,QACjB,KAAKA,iBAAe,eAAA;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F,KAAKA,iBAAe,eAAA;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,YAC5C,WAAW,GAAG;AAAA,YACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,UAAA;AAAA,QAEpE,KAAKA,iBAAe,eAAA;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,YACvC,WAAW,GAAG;AAAA,YACd,MAAM,GAAG;AAAA,UAAA;AAAA,QAEX,KAAKA,iBAAe,eAAA;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,YAC/C,WAAW,GAAG;AAAA,YACd,MAAM;AAAA,UAAA;AAAA,QAER,KAAKA,iBAAe,eAAA;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F;AACCC,sBAAAA,YAAc;AAAA,MAChB;AAAA,IAAA,CACA;AAAA,EAAA;AAEH;;"}
1
+ {"version":3,"file":"migrations.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/migrations.ts"],"sourcesContent":["import { Migration, MigrationDescriber } from '@contember/schema-migrations'\nimport chalk from 'chalk'\nimport { Schema } from '@contember/schema'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport { MigrationState } from '@contember/migrations-client'\nimport { AnyMigrationStatus } from '@contember/migrations-client'\n\n\nexport const createMigrationStatusTable = (migrations: AnyMigrationStatus[]): string => {\n\treturn chalkTable(\n\t\t{\n\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t},\n\t\tmigrations.map(it => {\n\t\t\tswitch (it.state) {\n\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(it)\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"names":["MigrationState","assertNever"],"mappings":";;;;;;AAUa,MAAA,6BAA6B,CAAC,eAA6C;AAChF,SAAA;AAAA,IACN;AAAA,MACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,IACxC;AAAA,IACA,WAAW,IAAI,CAAM,OAAA;AACpB,cAAQ,GAAG,OAAO;AAAA,QACjB,KAAKA,iBAAe,eAAA;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F,KAAKA,iBAAe,eAAA;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,YAC5C,WAAW,GAAG;AAAA,YACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,UACnE;AAAA,QACD,KAAKA,iBAAe,eAAA;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,YACvC,WAAW,GAAG;AAAA,YACd,MAAM,GAAG;AAAA,UACV;AAAA,QACD,KAAKA,iBAAe,eAAA;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,YAC/C,WAAW,GAAG;AAAA,YACd,MAAM;AAAA,UACP;AAAA,QACD,KAAKA,iBAAe,eAAA;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F;AACCC,sBAAAA,YAAc;AAAA,MAAA;AAAA,IAEhB,CAAA;AAAA,EACF;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.js","sources":["../../../../../../packages/cli/src/lib/migrations/migrations.ts"],"sourcesContent":["import { Migration, MigrationDescriber } from '@contember/schema-migrations'\nimport chalk from 'chalk'\nimport { Schema } from '@contember/schema'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport { MigrationState } from '@contember/migrations-client'\nimport { AnyMigrationStatus } from '@contember/migrations-client'\n\n\nexport const createMigrationStatusTable = (migrations: AnyMigrationStatus[]): string => {\n\treturn chalkTable(\n\t\t{\n\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t},\n\t\tmigrations.map(it => {\n\t\t\tswitch (it.state) {\n\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(it)\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"names":[],"mappings":";;;;AAUa,MAAA,6BAA6B,CAAC,eAA6C;AAChF,SAAA;AAAA,IACN;AAAA,MACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,IACxC;AAAA,IACA,WAAW,IAAI,CAAM,OAAA;AACpB,cAAQ,GAAG,OAAO;AAAA,QACjB,KAAK,eAAe;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F,KAAK,eAAe;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,YAC5C,WAAW,GAAG;AAAA,YACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,UAAA;AAAA,QAEpE,KAAK,eAAe;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,YACvC,WAAW,GAAG;AAAA,YACd,MAAM,GAAG;AAAA,UAAA;AAAA,QAEX,KAAK,eAAe;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,YAC/C,WAAW,GAAG;AAAA,YACd,MAAM;AAAA,UAAA;AAAA,QAER,KAAK,eAAe;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F;AACC,sBAAc;AAAA,MAChB;AAAA,IAAA,CACA;AAAA,EAAA;AAEH;"}
1
+ {"version":3,"file":"migrations.js","sources":["../../../../../../packages/cli/src/lib/migrations/migrations.ts"],"sourcesContent":["import { Migration, MigrationDescriber } from '@contember/schema-migrations'\nimport chalk from 'chalk'\nimport { Schema } from '@contember/schema'\nimport chalkTable from 'chalk-table'\nimport { assertNever } from '../assertNever'\nimport { emptyDatabaseMetadata } from '@contember/database'\nimport { MigrationState } from '@contember/migrations-client'\nimport { AnyMigrationStatus } from '@contember/migrations-client'\n\n\nexport const createMigrationStatusTable = (migrations: AnyMigrationStatus[]): string => {\n\treturn chalkTable(\n\t\t{\n\t\t\tcolumns: ['status', 'migration', 'info'],\n\t\t},\n\t\tmigrations.map(it => {\n\t\t\tswitch (it.state) {\n\t\t\t\tcase MigrationState.EXECUTED_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tcase MigrationState.EXECUTED_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgGreen.blackBright('Executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: `Executed at ${it.executedMigration.executedAt.toISOString()}`,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.EXECUTED_MISSING:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgRedBright.white('ERROR'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: it.errorMessage,\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_OK:\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: chalk.bgBlueBright.white('Not executed'),\n\t\t\t\t\t\tmigration: it.name,\n\t\t\t\t\t\tinfo: 'Will be executed during next deploy',\n\t\t\t\t\t}\n\t\t\t\tcase MigrationState.TO_EXECUTE_ERROR:\n\t\t\t\t\treturn { status: chalk.bgRedBright.white('ERROR'), migration: it.name, info: it.errorMessage }\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(it)\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"names":[],"mappings":";;;;AAUa,MAAA,6BAA6B,CAAC,eAA6C;AAChF,SAAA;AAAA,IACN;AAAA,MACC,SAAS,CAAC,UAAU,aAAa,MAAM;AAAA,IACxC;AAAA,IACA,WAAW,IAAI,CAAM,OAAA;AACpB,cAAQ,GAAG,OAAO;AAAA,QACjB,KAAK,eAAe;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F,KAAK,eAAe;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,QAAQ,YAAY,UAAU;AAAA,YAC5C,WAAW,GAAG;AAAA,YACd,MAAM,eAAe,GAAG,kBAAkB,WAAW,aAAa;AAAA,UACnE;AAAA,QACD,KAAK,eAAe;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,YAAY,MAAM,OAAO;AAAA,YACvC,WAAW,GAAG;AAAA,YACd,MAAM,GAAG;AAAA,UACV;AAAA,QACD,KAAK,eAAe;AACZ,iBAAA;AAAA,YACN,QAAQ,MAAM,aAAa,MAAM,cAAc;AAAA,YAC/C,WAAW,GAAG;AAAA,YACd,MAAM;AAAA,UACP;AAAA,QACD,KAAK,eAAe;AACnB,iBAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,MAAM,GAAG,aAAa;AAAA,QAC9F;AACC,sBAAc;AAAA,MAAA;AAAA,IAEhB,CAAA;AAAA,EACF;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProject.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProject.ts"],"sourcesContent":["export class RemoteProject {\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly endpoint: string,\n\t\tpublic readonly token: string,\n\t\tpublic readonly adminEndpoint?: string,\n\t) {\n\t}\n}\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc;AAAA,EAC1B,YACiB,MACA,UACA,OACA,eACf;AAJe,SAAA,OAAA;AACA,SAAA,WAAA;AACA,SAAA,QAAA;AACA,SAAA,gBAAA;AAAA,EAEjB;AACD;;"}
1
+ {"version":3,"file":"RemoteProject.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProject.ts"],"sourcesContent":["export class RemoteProject {\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly endpoint: string,\n\t\tpublic readonly token: string,\n\t\tpublic readonly adminEndpoint?: string,\n\t) {\n\t}\n}\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc;AAAA,EAC1B,YACiB,MACA,UACA,OACA,eACf;AAJe,SAAA,OAAA;AACA,SAAA,WAAA;AACA,SAAA,QAAA;AACA,SAAA,gBAAA;AAAA,EAAA;AAGlB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProject.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProject.ts"],"sourcesContent":["export class RemoteProject {\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly endpoint: string,\n\t\tpublic readonly token: string,\n\t\tpublic readonly adminEndpoint?: string,\n\t) {\n\t}\n}\n"],"names":[],"mappings":"AAAO,MAAM,cAAc;AAAA,EAC1B,YACiB,MACA,UACA,OACA,eACf;AAJe,SAAA,OAAA;AACA,SAAA,WAAA;AACA,SAAA,QAAA;AACA,SAAA,gBAAA;AAAA,EAEjB;AACD;"}
1
+ {"version":3,"file":"RemoteProject.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProject.ts"],"sourcesContent":["export class RemoteProject {\n\tconstructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly endpoint: string,\n\t\tpublic readonly token: string,\n\t\tpublic readonly adminEndpoint?: string,\n\t) {\n\t}\n}\n"],"names":[],"mappings":"AAAO,MAAM,cAAc;AAAA,EAC1B,YACiB,MACA,UACA,OACA,eACf;AAJe,SAAA,OAAA;AACA,SAAA,WAAA;AACA,SAAA,QAAA;AACA,SAAA,gBAAA;AAAA,EAAA;AAGlB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProjectProvider.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACE,kBAAA,MAAA,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EACvB;AAAA,EAEO,MAAqB;AACvB,QAAA,CAAC,KAAK,gBAAgB;AACnB,YAAA,IAAI,MAAM,wBAAwB;AAAA,IACzC;AACA,WAAO,KAAK;AAAA,EACb;AACD;;"}
1
+ {"version":3,"file":"RemoteProjectProvider.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACE,kBAAA,MAAA,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EAAA;AAAA,EAGhB,MAAqB;AACvB,QAAA,CAAC,KAAK,gBAAgB;AACnB,YAAA,IAAI,MAAM,wBAAwB;AAAA,IAAA;AAEzC,WAAO,KAAK;AAAA,EAAA;AAEd;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProjectProvider.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACE,kBAAA,MAAA,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EACvB;AAAA,EAEO,MAAqB;AACvB,QAAA,CAAC,KAAK,gBAAgB;AACnB,YAAA,IAAI,MAAM,wBAAwB;AAAA,IACzC;AACA,WAAO,KAAK;AAAA,EACb;AACD;"}
1
+ {"version":3,"file":"RemoteProjectProvider.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACE,kBAAA,MAAA,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EAAA;AAAA,EAGhB,MAAqB;AACvB,QAAA,CAAC,KAAK,gBAAgB;AACnB,YAAA,IAAI,MAAM,wBAAwB;AAAA,IAAA;AAEzC,WAAO,KAAK;AAAA,EAAA;AAEd;"}
@@ -6,7 +6,7 @@ class RemoteProjectResolver {
6
6
  constructor(cliEnv) {
7
7
  this.cliEnv = cliEnv;
8
8
  }
9
- resolve(identifier) {
9
+ resolve(identifier, adminEndpoint) {
10
10
  let endpoint;
11
11
  let token;
12
12
  let project;
@@ -22,7 +22,14 @@ class RemoteProjectResolver {
22
22
  if (!project || !endpoint || !token) {
23
23
  return void 0;
24
24
  }
25
- return new RemoteProject.RemoteProject(project, endpoint, token);
25
+ if (endpoint.endsWith("/")) {
26
+ endpoint = endpoint.slice(0, -1);
27
+ }
28
+ if (!adminEndpoint && endpoint.endsWith(".contember.cloud") && !endpoint.includes("://api-")) {
29
+ adminEndpoint = endpoint;
30
+ endpoint += "/_api";
31
+ }
32
+ return new RemoteProject.RemoteProject(project, endpoint, token, adminEndpoint);
26
33
  }
27
34
  }
28
35
  exports.RemoteProjectResolver = RemoteProjectResolver;
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProjectResolver.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn'\nimport { RemoteProject } from './RemoteProject'\nimport { CliEnv } from '../env'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token)\n\t}\n}\n"],"names":["parseDsn","RemoteProject"],"mappings":";;;;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,QAAQ,YAAgD;AACnD,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA,YAAY,SAAS,KAAK,GAAG;AAChC,OAAC,EAAE,UAAU,SAAS,MAAM,IAAIA,IAAAA,SAAS,UAAU;AAAA,IAAA,WACzC,KAAK,OAAO,KAAK;AAC1B,OAAA,EAAE,UAAU,SAAS,MAAA,IAAUA,IAAAA,SAAS,KAAK,OAAO,GAAG;AAAA,IAAA,OAClD;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IACzE;AACA,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AAC7B,aAAA;AAAA,IACR;AAEA,WAAO,IAAIC,cAAAA,cAAc,SAAS,UAAU,KAAK;AAAA,EAClD;AACD;;"}
1
+ {"version":3,"file":"RemoteProjectResolver.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn'\nimport { RemoteProject } from './RemoteProject'\nimport { CliEnv } from '../env'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string, adminEndpoint?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (endpoint.endsWith('/')) {\n\t\t\tendpoint = endpoint.slice(0, -1)\n\t\t}\n\n\t\tif (!adminEndpoint && endpoint.endsWith('.contember.cloud') && !endpoint.includes('://api-')) {\n\t\t\tadminEndpoint = endpoint\n\t\t\tendpoint += '/_api'\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token, adminEndpoint)\n\t}\n}\n"],"names":["parseDsn","RemoteProject"],"mappings":";;;;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAAA;AAAA,EAIlB,QAAQ,YAAqB,eAAmD;AAC3E,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA,YAAY,SAAS,KAAK,GAAG;AAChC,OAAC,EAAE,UAAU,SAAS,MAAM,IAAIA,IAAAA,SAAS,UAAU;AAAA,IAAA,WACzC,KAAK,OAAO,KAAK;AAC1B,OAAA,EAAE,UAAU,SAAS,MAAA,IAAUA,IAAAA,SAAS,KAAK,OAAO,GAAG;AAAA,IAAA,OAClD;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IAAA;AAEzE,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AAC7B,aAAA;AAAA,IAAA;AAEJ,QAAA,SAAS,SAAS,GAAG,GAAG;AAChB,iBAAA,SAAS,MAAM,GAAG,EAAE;AAAA,IAAA;AAG5B,QAAA,CAAC,iBAAiB,SAAS,SAAS,kBAAkB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG;AAC7E,sBAAA;AACJ,kBAAA;AAAA,IAAA;AAGb,WAAO,IAAIC,cAAAA,cAAc,SAAS,UAAU,OAAO,aAAa;AAAA,EAAA;AAElE;;"}
@@ -4,7 +4,7 @@ class RemoteProjectResolver {
4
4
  constructor(cliEnv) {
5
5
  this.cliEnv = cliEnv;
6
6
  }
7
- resolve(identifier) {
7
+ resolve(identifier, adminEndpoint) {
8
8
  let endpoint;
9
9
  let token;
10
10
  let project;
@@ -20,7 +20,14 @@ class RemoteProjectResolver {
20
20
  if (!project || !endpoint || !token) {
21
21
  return void 0;
22
22
  }
23
- return new RemoteProject(project, endpoint, token);
23
+ if (endpoint.endsWith("/")) {
24
+ endpoint = endpoint.slice(0, -1);
25
+ }
26
+ if (!adminEndpoint && endpoint.endsWith(".contember.cloud") && !endpoint.includes("://api-")) {
27
+ adminEndpoint = endpoint;
28
+ endpoint += "/_api";
29
+ }
30
+ return new RemoteProject(project, endpoint, token, adminEndpoint);
24
31
  }
25
32
  }
26
33
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProjectResolver.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn'\nimport { RemoteProject } from './RemoteProject'\nimport { CliEnv } from '../env'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token)\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,QAAQ,YAAgD;AACnD,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA,YAAY,SAAS,KAAK,GAAG;AAChC,OAAC,EAAE,UAAU,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,IAAA,WACzC,KAAK,OAAO,KAAK;AAC1B,OAAA,EAAE,UAAU,SAAS,MAAA,IAAU,SAAS,KAAK,OAAO,GAAG;AAAA,IAAA,OAClD;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IACzE;AACA,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AAC7B,aAAA;AAAA,IACR;AAEA,WAAO,IAAI,cAAc,SAAS,UAAU,KAAK;AAAA,EAClD;AACD;"}
1
+ {"version":3,"file":"RemoteProjectResolver.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn'\nimport { RemoteProject } from './RemoteProject'\nimport { CliEnv } from '../env'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string, adminEndpoint?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (endpoint.endsWith('/')) {\n\t\t\tendpoint = endpoint.slice(0, -1)\n\t\t}\n\n\t\tif (!adminEndpoint && endpoint.endsWith('.contember.cloud') && !endpoint.includes('://api-')) {\n\t\t\tadminEndpoint = endpoint\n\t\t\tendpoint += '/_api'\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token, adminEndpoint)\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAAA;AAAA,EAIlB,QAAQ,YAAqB,eAAmD;AAC3E,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA,YAAY,SAAS,KAAK,GAAG;AAChC,OAAC,EAAE,UAAU,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,IAAA,WACzC,KAAK,OAAO,KAAK;AAC1B,OAAA,EAAE,UAAU,SAAS,MAAA,IAAU,SAAS,KAAK,OAAO,GAAG;AAAA,IAAA,OAClD;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IAAA;AAEzE,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AAC7B,aAAA;AAAA,IAAA;AAEJ,QAAA,SAAS,SAAS,GAAG,GAAG;AAChB,iBAAA,SAAS,MAAM,GAAG,EAAE;AAAA,IAAA;AAG5B,QAAA,CAAC,iBAAiB,SAAS,SAAS,kBAAkB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG;AAC7E,sBAAA;AACJ,kBAAA;AAAA,IAAA;AAGb,WAAO,IAAI,cAAc,SAAS,UAAU,OAAO,aAAa;AAAA,EAAA;AAElE;"}