@strapi/strapi 5.12.1 → 5.12.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 (263) hide show
  1. package/dist/cli.js +89 -45
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +90 -42
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/package.json.js +6 -0
  6. package/dist/package.json.js.map +1 -0
  7. package/dist/package.json.mjs +4 -0
  8. package/dist/package.json.mjs.map +1 -0
  9. package/dist/src/cli/commands/admin/create-user.js +124 -0
  10. package/dist/src/cli/commands/admin/create-user.js.map +1 -0
  11. package/dist/src/cli/commands/admin/create-user.mjs +121 -0
  12. package/dist/src/cli/commands/admin/create-user.mjs.map +1 -0
  13. package/dist/src/cli/commands/admin/reset-user-password.js +61 -0
  14. package/dist/src/cli/commands/admin/reset-user-password.js.map +1 -0
  15. package/dist/src/cli/commands/admin/reset-user-password.mjs +58 -0
  16. package/dist/src/cli/commands/admin/reset-user-password.mjs.map +1 -0
  17. package/dist/src/cli/commands/build.js +29 -0
  18. package/dist/src/cli/commands/build.js.map +1 -0
  19. package/dist/src/cli/commands/build.mjs +27 -0
  20. package/dist/src/cli/commands/build.mjs.map +1 -0
  21. package/dist/src/cli/commands/components/list.js +32 -0
  22. package/dist/src/cli/commands/components/list.js.map +1 -0
  23. package/dist/src/cli/commands/components/list.mjs +29 -0
  24. package/dist/src/cli/commands/components/list.mjs.map +1 -0
  25. package/dist/src/cli/commands/configuration/dump.js +53 -0
  26. package/dist/src/cli/commands/configuration/dump.js.map +1 -0
  27. package/dist/src/cli/commands/configuration/dump.mjs +50 -0
  28. package/dist/src/cli/commands/configuration/dump.mjs.map +1 -0
  29. package/dist/src/cli/commands/configuration/restore.js +173 -0
  30. package/dist/src/cli/commands/configuration/restore.js.map +1 -0
  31. package/dist/src/cli/commands/configuration/restore.mjs +170 -0
  32. package/dist/src/cli/commands/configuration/restore.mjs.map +1 -0
  33. package/dist/src/cli/commands/console.js +31 -0
  34. package/dist/src/cli/commands/console.js.map +1 -0
  35. package/dist/src/cli/commands/console.mjs +28 -0
  36. package/dist/src/cli/commands/console.mjs.map +1 -0
  37. package/dist/src/cli/commands/content-types/list.js +32 -0
  38. package/dist/src/cli/commands/content-types/list.js.map +1 -0
  39. package/dist/src/cli/commands/content-types/list.mjs +29 -0
  40. package/dist/src/cli/commands/content-types/list.mjs.map +1 -0
  41. package/dist/src/cli/commands/controllers/list.js +32 -0
  42. package/dist/src/cli/commands/controllers/list.js.map +1 -0
  43. package/dist/src/cli/commands/controllers/list.mjs +29 -0
  44. package/dist/src/cli/commands/controllers/list.mjs.map +1 -0
  45. package/dist/src/cli/commands/develop.js +32 -0
  46. package/dist/src/cli/commands/develop.js.map +1 -0
  47. package/dist/src/cli/commands/develop.mjs +30 -0
  48. package/dist/src/cli/commands/develop.mjs.map +1 -0
  49. package/dist/src/cli/commands/export/action.js +126 -0
  50. package/dist/src/cli/commands/export/action.js.map +1 -0
  51. package/dist/src/cli/commands/export/action.mjs +124 -0
  52. package/dist/src/cli/commands/export/action.mjs.map +1 -0
  53. package/dist/src/cli/commands/export/command.js +15 -0
  54. package/dist/src/cli/commands/export/command.js.map +1 -0
  55. package/dist/src/cli/commands/export/command.mjs +13 -0
  56. package/dist/src/cli/commands/export/command.mjs.map +1 -0
  57. package/dist/src/cli/commands/generate.js +18 -0
  58. package/dist/src/cli/commands/generate.js.map +1 -0
  59. package/dist/src/cli/commands/generate.mjs +16 -0
  60. package/dist/src/cli/commands/generate.mjs.map +1 -0
  61. package/dist/src/cli/commands/hooks/list.js +32 -0
  62. package/dist/src/cli/commands/hooks/list.js.map +1 -0
  63. package/dist/src/cli/commands/hooks/list.mjs +29 -0
  64. package/dist/src/cli/commands/hooks/list.mjs.map +1 -0
  65. package/dist/src/cli/commands/import/action.js +124 -0
  66. package/dist/src/cli/commands/import/action.js.map +1 -0
  67. package/dist/src/cli/commands/import/action.mjs +122 -0
  68. package/dist/src/cli/commands/import/action.mjs.map +1 -0
  69. package/dist/src/cli/commands/import/command.js +59 -0
  70. package/dist/src/cli/commands/import/command.js.map +1 -0
  71. package/dist/src/cli/commands/import/command.mjs +57 -0
  72. package/dist/src/cli/commands/import/command.mjs.map +1 -0
  73. package/dist/src/cli/commands/index.js +64 -0
  74. package/dist/src/cli/commands/index.js.map +1 -0
  75. package/dist/src/cli/commands/index.mjs +62 -0
  76. package/dist/src/cli/commands/index.mjs.map +1 -0
  77. package/dist/src/cli/commands/middlewares/list.js +32 -0
  78. package/dist/src/cli/commands/middlewares/list.js.map +1 -0
  79. package/dist/src/cli/commands/middlewares/list.mjs +29 -0
  80. package/dist/src/cli/commands/middlewares/list.mjs.map +1 -0
  81. package/dist/src/cli/commands/policies/list.js +32 -0
  82. package/dist/src/cli/commands/policies/list.js.map +1 -0
  83. package/dist/src/cli/commands/policies/list.mjs +29 -0
  84. package/dist/src/cli/commands/policies/list.mjs.map +1 -0
  85. package/dist/src/cli/commands/report.js +39 -0
  86. package/dist/src/cli/commands/report.js.map +1 -0
  87. package/dist/src/cli/commands/report.mjs +37 -0
  88. package/dist/src/cli/commands/report.mjs.map +1 -0
  89. package/dist/src/cli/commands/routes/list.js +40 -0
  90. package/dist/src/cli/commands/routes/list.js.map +1 -0
  91. package/dist/src/cli/commands/routes/list.mjs +37 -0
  92. package/dist/src/cli/commands/routes/list.mjs.map +1 -0
  93. package/dist/src/cli/commands/services/list.js +32 -0
  94. package/dist/src/cli/commands/services/list.js.map +1 -0
  95. package/dist/src/cli/commands/services/list.mjs +29 -0
  96. package/dist/src/cli/commands/services/list.mjs.map +1 -0
  97. package/dist/src/cli/commands/start.js +28 -0
  98. package/dist/src/cli/commands/start.js.map +1 -0
  99. package/dist/src/cli/commands/start.mjs +26 -0
  100. package/dist/src/cli/commands/start.mjs.map +1 -0
  101. package/dist/src/cli/commands/telemetry/disable.js +72 -0
  102. package/dist/src/cli/commands/telemetry/disable.js.map +1 -0
  103. package/dist/src/cli/commands/telemetry/disable.mjs +69 -0
  104. package/dist/src/cli/commands/telemetry/disable.mjs.map +1 -0
  105. package/dist/src/cli/commands/telemetry/enable.js +88 -0
  106. package/dist/src/cli/commands/telemetry/enable.js.map +1 -0
  107. package/dist/src/cli/commands/telemetry/enable.mjs +85 -0
  108. package/dist/src/cli/commands/telemetry/enable.mjs.map +1 -0
  109. package/dist/src/cli/commands/templates/generate.js +15 -0
  110. package/dist/src/cli/commands/templates/generate.js.map +1 -0
  111. package/dist/src/cli/commands/templates/generate.mjs +13 -0
  112. package/dist/src/cli/commands/templates/generate.mjs.map +1 -0
  113. package/dist/src/cli/commands/transfer/action.js +141 -0
  114. package/dist/src/cli/commands/transfer/action.js.map +1 -0
  115. package/dist/src/cli/commands/transfer/action.mjs +139 -0
  116. package/dist/src/cli/commands/transfer/action.mjs.map +1 -0
  117. package/dist/src/cli/commands/transfer/command.js +61 -0
  118. package/dist/src/cli/commands/transfer/command.js.map +1 -0
  119. package/dist/src/cli/commands/transfer/command.mjs +59 -0
  120. package/dist/src/cli/commands/transfer/command.mjs.map +1 -0
  121. package/dist/src/cli/commands/ts/generate-types.js +40 -0
  122. package/dist/src/cli/commands/ts/generate-types.js.map +1 -0
  123. package/dist/src/cli/commands/ts/generate-types.mjs +37 -0
  124. package/dist/src/cli/commands/ts/generate-types.mjs.map +1 -0
  125. package/dist/src/cli/commands/version.js +17 -0
  126. package/dist/src/cli/commands/version.js.map +1 -0
  127. package/dist/src/cli/commands/version.mjs +15 -0
  128. package/dist/src/cli/commands/version.mjs.map +1 -0
  129. package/dist/src/cli/utils/commander.js +125 -0
  130. package/dist/src/cli/utils/commander.js.map +1 -0
  131. package/dist/src/cli/utils/commander.mjs +116 -0
  132. package/dist/src/cli/utils/commander.mjs.map +1 -0
  133. package/dist/src/cli/utils/data-transfer.js +378 -0
  134. package/dist/src/cli/utils/data-transfer.js.map +1 -0
  135. package/dist/src/cli/utils/data-transfer.mjs +359 -0
  136. package/dist/src/cli/utils/data-transfer.mjs.map +1 -0
  137. package/dist/src/cli/utils/helpers.js +114 -0
  138. package/dist/src/cli/utils/helpers.js.map +1 -0
  139. package/dist/src/cli/utils/helpers.mjs +107 -0
  140. package/dist/src/cli/utils/helpers.mjs.map +1 -0
  141. package/dist/src/cli/utils/logger.js +125 -0
  142. package/dist/src/cli/utils/logger.js.map +1 -0
  143. package/dist/src/cli/utils/logger.mjs +104 -0
  144. package/dist/src/cli/utils/logger.mjs.map +1 -0
  145. package/dist/src/cli/utils/telemetry.js +27 -0
  146. package/dist/src/cli/utils/telemetry.js.map +1 -0
  147. package/dist/src/cli/utils/telemetry.mjs +25 -0
  148. package/dist/src/cli/utils/telemetry.mjs.map +1 -0
  149. package/dist/src/cli/utils/tsconfig.js +25 -0
  150. package/dist/src/cli/utils/tsconfig.js.map +1 -0
  151. package/dist/src/cli/utils/tsconfig.mjs +23 -0
  152. package/dist/src/cli/utils/tsconfig.mjs.map +1 -0
  153. package/dist/src/node/build.js +90 -0
  154. package/dist/src/node/build.js.map +1 -0
  155. package/dist/src/node/build.mjs +69 -0
  156. package/dist/src/node/build.mjs.map +1 -0
  157. package/dist/src/node/core/admin-customisations.js +27 -0
  158. package/dist/src/node/core/admin-customisations.js.map +1 -0
  159. package/dist/src/node/core/admin-customisations.mjs +25 -0
  160. package/dist/src/node/core/admin-customisations.mjs.map +1 -0
  161. package/dist/{chunks/aliases-BkD9BImE.js → src/node/core/aliases.js} +3 -42
  162. package/dist/src/node/core/aliases.js.map +1 -0
  163. package/dist/{chunks/aliases-CZgVGGH9.mjs → src/node/core/aliases.mjs} +4 -41
  164. package/dist/src/node/core/aliases.mjs.map +1 -0
  165. package/dist/src/node/core/config.js +18 -0
  166. package/dist/src/node/core/config.js.map +1 -0
  167. package/dist/src/node/core/config.mjs +16 -0
  168. package/dist/src/node/core/config.mjs.map +1 -0
  169. package/dist/src/node/core/dependencies.js +186 -0
  170. package/dist/src/node/core/dependencies.js.map +1 -0
  171. package/dist/src/node/core/dependencies.mjs +183 -0
  172. package/dist/src/node/core/dependencies.mjs.map +1 -0
  173. package/dist/src/node/core/env.js +32 -0
  174. package/dist/src/node/core/env.js.map +1 -0
  175. package/dist/src/node/core/env.mjs +29 -0
  176. package/dist/src/node/core/env.mjs.map +1 -0
  177. package/dist/src/node/core/errors.js +51 -0
  178. package/dist/src/node/core/errors.js.map +1 -0
  179. package/dist/src/node/core/errors.mjs +48 -0
  180. package/dist/src/node/core/errors.mjs.map +1 -0
  181. package/dist/src/node/core/files.js +68 -0
  182. package/dist/src/node/core/files.js.map +1 -0
  183. package/dist/src/node/core/files.mjs +63 -0
  184. package/dist/src/node/core/files.mjs.map +1 -0
  185. package/dist/src/node/core/managers.js +27 -0
  186. package/dist/src/node/core/managers.js.map +1 -0
  187. package/dist/src/node/core/managers.mjs +25 -0
  188. package/dist/src/node/core/managers.mjs.map +1 -0
  189. package/dist/src/node/core/monorepo.js +30 -0
  190. package/dist/src/node/core/monorepo.js.map +1 -0
  191. package/dist/src/node/core/monorepo.mjs +28 -0
  192. package/dist/src/node/core/monorepo.mjs.map +1 -0
  193. package/dist/src/node/core/plugins.js +140 -0
  194. package/dist/src/node/core/plugins.js.map +1 -0
  195. package/dist/src/node/core/plugins.mjs +137 -0
  196. package/dist/src/node/core/plugins.mjs.map +1 -0
  197. package/dist/src/node/core/timer.js +33 -0
  198. package/dist/src/node/core/timer.js.map +1 -0
  199. package/dist/src/node/core/timer.mjs +30 -0
  200. package/dist/src/node/core/timer.mjs.map +1 -0
  201. package/dist/src/node/create-build-context.js +111 -0
  202. package/dist/src/node/create-build-context.js.map +1 -0
  203. package/dist/src/node/create-build-context.mjs +109 -0
  204. package/dist/src/node/create-build-context.mjs.map +1 -0
  205. package/dist/src/node/develop.js +312 -0
  206. package/dist/src/node/develop.js.map +1 -0
  207. package/dist/src/node/develop.mjs +291 -0
  208. package/dist/src/node/develop.mjs.map +1 -0
  209. package/dist/src/node/staticFiles.js +81 -0
  210. package/dist/src/node/staticFiles.js.map +1 -0
  211. package/dist/src/node/staticFiles.mjs +78 -0
  212. package/dist/src/node/staticFiles.mjs.map +1 -0
  213. package/dist/src/node/vite/build.js +14 -0
  214. package/dist/src/node/vite/build.js.map +1 -0
  215. package/dist/src/node/vite/build.mjs +12 -0
  216. package/dist/src/node/vite/build.mjs.map +1 -0
  217. package/dist/{chunks/config-D3Y5s3ui.js → src/node/vite/config.js} +12 -50
  218. package/dist/src/node/vite/config.js.map +1 -0
  219. package/dist/{chunks/config-BFUn1raM.mjs → src/node/vite/config.mjs} +6 -44
  220. package/dist/src/node/vite/config.mjs.map +1 -0
  221. package/dist/src/node/vite/plugins.js +46 -0
  222. package/dist/src/node/vite/plugins.js.map +1 -0
  223. package/dist/src/node/vite/plugins.mjs +44 -0
  224. package/dist/src/node/vite/plugins.mjs.map +1 -0
  225. package/dist/{chunks/watch-gkyBsmAJ.js → src/node/vite/watch.js} +2 -45
  226. package/dist/src/node/vite/watch.js.map +1 -0
  227. package/dist/{chunks/watch-DUnlAAiK.mjs → src/node/vite/watch.mjs} +2 -45
  228. package/dist/src/node/vite/watch.mjs.map +1 -0
  229. package/dist/src/node/webpack/build.js +37 -0
  230. package/dist/src/node/webpack/build.js.map +1 -0
  231. package/dist/src/node/webpack/build.mjs +35 -0
  232. package/dist/src/node/webpack/build.mjs.map +1 -0
  233. package/dist/{chunks/config-Bcu3_xSp.js → src/node/webpack/config.js} +10 -8
  234. package/dist/src/node/webpack/config.js.map +1 -0
  235. package/dist/{chunks/config-DKpJU9io.mjs → src/node/webpack/config.mjs} +5 -3
  236. package/dist/src/node/webpack/config.mjs.map +1 -0
  237. package/dist/{chunks/watch-CNfkm7Fm.js → src/node/webpack/watch.js} +2 -51
  238. package/dist/src/node/webpack/watch.js.map +1 -0
  239. package/dist/{chunks/watch-BEC39t49.mjs → src/node/webpack/watch.mjs} +2 -51
  240. package/dist/src/node/webpack/watch.mjs.map +1 -0
  241. package/package.json +22 -22
  242. package/dist/chunks/aliases-BkD9BImE.js.map +0 -1
  243. package/dist/chunks/aliases-CZgVGGH9.mjs.map +0 -1
  244. package/dist/chunks/build-B6f5SABm.js +0 -87
  245. package/dist/chunks/build-B6f5SABm.js.map +0 -1
  246. package/dist/chunks/build-BQc6C2UF.mjs +0 -85
  247. package/dist/chunks/build-BQc6C2UF.mjs.map +0 -1
  248. package/dist/chunks/build-C4qN5x5L.js +0 -59
  249. package/dist/chunks/build-C4qN5x5L.js.map +0 -1
  250. package/dist/chunks/build-D6MP0Rwu.mjs +0 -57
  251. package/dist/chunks/build-D6MP0Rwu.mjs.map +0 -1
  252. package/dist/chunks/config-BFUn1raM.mjs.map +0 -1
  253. package/dist/chunks/config-Bcu3_xSp.js.map +0 -1
  254. package/dist/chunks/config-D3Y5s3ui.js.map +0 -1
  255. package/dist/chunks/config-DKpJU9io.mjs.map +0 -1
  256. package/dist/chunks/index-DGhshfMs.mjs +0 -3160
  257. package/dist/chunks/index-DGhshfMs.mjs.map +0 -1
  258. package/dist/chunks/index-DW2NjgW9.js +0 -3185
  259. package/dist/chunks/index-DW2NjgW9.js.map +0 -1
  260. package/dist/chunks/watch-BEC39t49.mjs.map +0 -1
  261. package/dist/chunks/watch-CNfkm7Fm.js.map +0 -1
  262. package/dist/chunks/watch-DUnlAAiK.mjs.map +0 -1
  263. package/dist/chunks/watch-gkyBsmAJ.js.map +0 -1
@@ -0,0 +1,141 @@
1
+ 'use strict';
2
+
3
+ var fp = require('lodash/fp');
4
+ var dataTransfer$1 = require('@strapi/data-transfer');
5
+ var dataTransfer = require('../../utils/data-transfer.js');
6
+ var helpers = require('../../utils/helpers.js');
7
+
8
+ const { createTransferEngine } = dataTransfer$1.engine;
9
+ const { providers: { createRemoteStrapiDestinationProvider, createLocalStrapiSourceProvider, createLocalStrapiDestinationProvider, createRemoteStrapiSourceProvider } } = dataTransfer$1.strapi;
10
+ /**
11
+ * Transfer command.
12
+ *
13
+ * Transfers data between local Strapi and remote Strapi instances
14
+ */ var action = (async (opts)=>{
15
+ // Validate inputs from Commander
16
+ if (!fp.isObject(opts)) {
17
+ helpers.exitWith(1, 'Could not parse command arguments');
18
+ }
19
+ if (!(opts.from || opts.to) || opts.from && opts.to) {
20
+ helpers.exitWith(1, 'Exactly one source (from) or destination (to) option must be provided');
21
+ }
22
+ const strapi = await dataTransfer.createStrapiInstance();
23
+ let source;
24
+ let destination;
25
+ // if no URL provided, use local Strapi
26
+ if (!opts.from) {
27
+ source = createLocalStrapiSourceProvider({
28
+ getStrapi: ()=>strapi
29
+ });
30
+ } else {
31
+ if (!opts.fromToken) {
32
+ helpers.exitWith(1, 'Missing token for remote destination');
33
+ }
34
+ source = createRemoteStrapiSourceProvider({
35
+ getStrapi: ()=>strapi,
36
+ url: opts.from,
37
+ auth: {
38
+ type: 'token',
39
+ token: opts.fromToken
40
+ }
41
+ });
42
+ }
43
+ // if no URL provided, use local Strapi
44
+ if (!opts.to) {
45
+ destination = createLocalStrapiDestinationProvider({
46
+ getStrapi: ()=>strapi,
47
+ strategy: 'restore',
48
+ restore: dataTransfer.parseRestoreFromOptions(opts)
49
+ });
50
+ } else {
51
+ if (!opts.toToken) {
52
+ helpers.exitWith(1, 'Missing token for remote destination');
53
+ }
54
+ destination = createRemoteStrapiDestinationProvider({
55
+ url: opts.to,
56
+ auth: {
57
+ type: 'token',
58
+ token: opts.toToken
59
+ },
60
+ strategy: 'restore',
61
+ restore: dataTransfer.parseRestoreFromOptions(opts)
62
+ });
63
+ }
64
+ if (!source || !destination) {
65
+ helpers.exitWith(1, 'Could not create providers');
66
+ }
67
+ const engine = createTransferEngine(source, destination, {
68
+ versionStrategy: 'exact',
69
+ schemaStrategy: 'strict',
70
+ exclude: opts.exclude,
71
+ only: opts.only,
72
+ throttle: opts.throttle,
73
+ transforms: {
74
+ links: [
75
+ {
76
+ filter (link) {
77
+ return !dataTransfer.DEFAULT_IGNORED_CONTENT_TYPES.includes(link.left.type) && !dataTransfer.DEFAULT_IGNORED_CONTENT_TYPES.includes(link.right.type);
78
+ }
79
+ }
80
+ ],
81
+ entities: [
82
+ {
83
+ filter (entity) {
84
+ return !dataTransfer.DEFAULT_IGNORED_CONTENT_TYPES.includes(entity.type);
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ });
90
+ engine.diagnostics.onDiagnostic(dataTransfer.formatDiagnostic('transfer', opts.verbose));
91
+ const progress = engine.progress.stream;
92
+ const { updateLoader } = dataTransfer.loadersFactory();
93
+ engine.onSchemaDiff(dataTransfer.getDiffHandler(engine, {
94
+ force: opts.force,
95
+ action: 'transfer'
96
+ }));
97
+ engine.addErrorHandler('ASSETS_DIRECTORY_ERR', dataTransfer.getAssetsBackupHandler(engine, {
98
+ force: opts.force,
99
+ action: 'transfer'
100
+ }));
101
+ progress.on(`stage::start`, ({ stage, data })=>{
102
+ updateLoader(stage, data).start();
103
+ });
104
+ progress.on('stage::finish', ({ stage, data })=>{
105
+ updateLoader(stage, data).succeed();
106
+ });
107
+ progress.on('stage::progress', ({ stage, data })=>{
108
+ updateLoader(stage, data);
109
+ });
110
+ progress.on('stage::error', ({ stage, data })=>{
111
+ updateLoader(stage, data).fail();
112
+ });
113
+ progress.on('transfer::start', async ()=>{
114
+ console.log(`Starting transfer...`);
115
+ await strapi.telemetry.send('didDEITSProcessStart', dataTransfer.getTransferTelemetryPayload(engine));
116
+ });
117
+ let results;
118
+ try {
119
+ // Abort transfer if user interrupts process
120
+ dataTransfer.setSignalHandler(()=>dataTransfer.abortTransfer({
121
+ engine,
122
+ strapi
123
+ }));
124
+ results = await engine.transfer();
125
+ // Note: we need to await telemetry or else the process ends before it is sent
126
+ await strapi.telemetry.send('didDEITSProcessFinish', dataTransfer.getTransferTelemetryPayload(engine));
127
+ try {
128
+ const table = dataTransfer.buildTransferTable(results.engine);
129
+ console.log(table?.toString());
130
+ } catch (e) {
131
+ console.error('There was an error displaying the results of the transfer.');
132
+ }
133
+ helpers.exitWith(0, dataTransfer.exitMessageText('transfer'));
134
+ } catch (e) {
135
+ await strapi.telemetry.send('didDEITSProcessFail', dataTransfer.getTransferTelemetryPayload(engine));
136
+ helpers.exitWith(1, dataTransfer.exitMessageText('transfer', true));
137
+ }
138
+ });
139
+
140
+ module.exports = action;
141
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sources":["../../../../../src/cli/commands/transfer/action.ts"],"sourcesContent":["import { isObject } from 'lodash/fp';\nimport { engine as engineDataTransfer, strapi as strapiDataTransfer } from '@strapi/data-transfer';\n\nimport {\n buildTransferTable,\n createStrapiInstance,\n DEFAULT_IGNORED_CONTENT_TYPES,\n formatDiagnostic,\n loadersFactory,\n exitMessageText,\n abortTransfer,\n getTransferTelemetryPayload,\n setSignalHandler,\n getDiffHandler,\n getAssetsBackupHandler,\n parseRestoreFromOptions,\n} from '../../utils/data-transfer';\nimport { exitWith } from '../../utils/helpers';\n\nconst { createTransferEngine } = engineDataTransfer;\nconst {\n providers: {\n createRemoteStrapiDestinationProvider,\n createLocalStrapiSourceProvider,\n createLocalStrapiDestinationProvider,\n createRemoteStrapiSourceProvider,\n },\n} = strapiDataTransfer;\n\ninterface CmdOptions {\n from?: URL;\n fromToken: string;\n to: URL;\n toToken: string;\n verbose?: boolean;\n only?: (keyof engineDataTransfer.TransferGroupFilter)[];\n exclude?: (keyof engineDataTransfer.TransferGroupFilter)[];\n throttle?: number;\n force?: boolean;\n}\n/**\n * Transfer command.\n *\n * Transfers data between local Strapi and remote Strapi instances\n */\nexport default async (opts: CmdOptions) => {\n // Validate inputs from Commander\n if (!isObject(opts)) {\n exitWith(1, 'Could not parse command arguments');\n }\n\n if (!(opts.from || opts.to) || (opts.from && opts.to)) {\n exitWith(1, 'Exactly one source (from) or destination (to) option must be provided');\n }\n\n const strapi = await createStrapiInstance();\n let source;\n let destination;\n\n // if no URL provided, use local Strapi\n if (!opts.from) {\n source = createLocalStrapiSourceProvider({\n getStrapi: () => strapi,\n });\n }\n // if URL provided, set up a remote source provider\n else {\n if (!opts.fromToken) {\n exitWith(1, 'Missing token for remote destination');\n }\n\n source = createRemoteStrapiSourceProvider({\n getStrapi: () => strapi,\n url: opts.from,\n auth: {\n type: 'token',\n token: opts.fromToken,\n },\n });\n }\n\n // if no URL provided, use local Strapi\n if (!opts.to) {\n destination = createLocalStrapiDestinationProvider({\n getStrapi: () => strapi,\n strategy: 'restore',\n restore: parseRestoreFromOptions(opts),\n });\n }\n // if URL provided, set up a remote destination provider\n else {\n if (!opts.toToken) {\n exitWith(1, 'Missing token for remote destination');\n }\n\n destination = createRemoteStrapiDestinationProvider({\n url: opts.to,\n auth: {\n type: 'token',\n token: opts.toToken,\n },\n strategy: 'restore',\n restore: parseRestoreFromOptions(opts),\n });\n }\n\n if (!source || !destination) {\n exitWith(1, 'Could not create providers');\n }\n\n const engine = createTransferEngine(source, destination, {\n versionStrategy: 'exact',\n schemaStrategy: 'strict',\n exclude: opts.exclude,\n only: opts.only,\n throttle: opts.throttle,\n transforms: {\n links: [\n {\n filter(link) {\n return (\n !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.left.type) &&\n !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.right.type)\n );\n },\n },\n ],\n entities: [\n {\n filter(entity) {\n return !DEFAULT_IGNORED_CONTENT_TYPES.includes(entity.type);\n },\n },\n ],\n },\n });\n\n engine.diagnostics.onDiagnostic(formatDiagnostic('transfer', opts.verbose));\n\n const progress = engine.progress.stream;\n\n const { updateLoader } = loadersFactory();\n\n engine.onSchemaDiff(getDiffHandler(engine, { force: opts.force, action: 'transfer' }));\n\n engine.addErrorHandler(\n 'ASSETS_DIRECTORY_ERR',\n getAssetsBackupHandler(engine, { force: opts.force, action: 'transfer' })\n );\n\n progress.on(`stage::start`, ({ stage, data }) => {\n updateLoader(stage, data).start();\n });\n\n progress.on('stage::finish', ({ stage, data }) => {\n updateLoader(stage, data).succeed();\n });\n\n progress.on('stage::progress', ({ stage, data }) => {\n updateLoader(stage, data);\n });\n\n progress.on('stage::error', ({ stage, data }) => {\n updateLoader(stage, data).fail();\n });\n\n progress.on('transfer::start', async () => {\n console.log(`Starting transfer...`);\n\n await strapi.telemetry.send('didDEITSProcessStart', getTransferTelemetryPayload(engine));\n });\n\n let results: Awaited<ReturnType<typeof engine.transfer>>;\n try {\n // Abort transfer if user interrupts process\n setSignalHandler(() => abortTransfer({ engine, strapi }));\n\n results = await engine.transfer();\n\n // Note: we need to await telemetry or else the process ends before it is sent\n await strapi.telemetry.send('didDEITSProcessFinish', getTransferTelemetryPayload(engine));\n\n try {\n const table = buildTransferTable(results.engine);\n console.log(table?.toString());\n } catch (e) {\n console.error('There was an error displaying the results of the transfer.');\n }\n\n exitWith(0, exitMessageText('transfer'));\n } catch (e) {\n await strapi.telemetry.send('didDEITSProcessFail', getTransferTelemetryPayload(engine));\n exitWith(1, exitMessageText('transfer', true));\n }\n};\n"],"names":["createTransferEngine","engineDataTransfer","providers","createRemoteStrapiDestinationProvider","createLocalStrapiSourceProvider","createLocalStrapiDestinationProvider","createRemoteStrapiSourceProvider","strapiDataTransfer","opts","isObject","exitWith","from","to","strapi","createStrapiInstance","source","destination","getStrapi","fromToken","url","auth","type","token","strategy","restore","parseRestoreFromOptions","toToken","engine","versionStrategy","schemaStrategy","exclude","only","throttle","transforms","links","filter","link","DEFAULT_IGNORED_CONTENT_TYPES","includes","left","right","entities","entity","diagnostics","onDiagnostic","formatDiagnostic","verbose","progress","stream","updateLoader","loadersFactory","onSchemaDiff","getDiffHandler","force","action","addErrorHandler","getAssetsBackupHandler","on","stage","data","start","succeed","fail","console","log","telemetry","send","getTransferTelemetryPayload","results","setSignalHandler","abortTransfer","transfer","table","buildTransferTable","toString","e","error","exitMessageText"],"mappings":";;;;;;;AAmBA,MAAM,EAAEA,oBAAoB,EAAE,GAAGC,qBAAAA;AACjC,MAAM,EACJC,SAAAA,EAAW,EACTC,qCAAqC,EACrCC,+BAA+B,EAC/BC,oCAAoC,EACpCC,gCAAgC,EACjC,EACF,GAAGC,qBAAAA;AAaJ;;;;IAKA,aAAe,CAAA,OAAOC,IAAAA,GAAAA;;I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C,oBAAoB,CAAC,CAAA;AAElC,QAAA,MAAMnD,OAAOoD,SAAS,CAACC,IAAI,CAAC,wBAAwBC,wCAA4BxC,CAAAA,MAAAA,CAAAA,CAAAA;AAClF,KAAA,CAAA;IAEA,IAAIyC,OAAAA;IACJ,IAAI;;AAEFC,QAAAA,6BAAAA,CAAiB,IAAMC,0BAAc,CAAA;AAAE3C,gBAAAA,MAAAA;AAAQd,gBAAAA;AAAO,aAAA,CAAA,CAAA;QAEtDuD,OAAU,GAAA,MAAMzC,OAAO4C,QAAQ,EAAA;;AAG/B,QAAA,MAAM1D,OAAOoD,SAAS,CAACC,IAAI,CAAC,yBAAyBC,wCAA4BxC,CAAAA,MAAAA,CAAAA,CAAAA;QAEjF,IAAI;YACF,MAAM6C,KAAAA,GAAQC,+BAAmBL,CAAAA,OAAAA,CAAQzC,MAAM,CAAA;YAC/CoC,OAAQC,CAAAA,GAAG,CAACQ,KAAOE,EAAAA,QAAAA,EAAAA,CAAAA;AACrB,SAAA,CAAE,OAAOC,CAAG,EAAA;AACVZ,YAAAA,OAAAA,CAAQa,KAAK,CAAC,4DAAA,CAAA;AAChB;AAEAlE,QAAAA,gBAAAA,CAAS,GAAGmE,4BAAgB,CAAA,UAAA,CAAA,CAAA;AAC9B,KAAA,CAAE,OAAOF,CAAG,EAAA;AACV,QAAA,MAAM9D,OAAOoD,SAAS,CAACC,IAAI,CAAC,uBAAuBC,wCAA4BxC,CAAAA,MAAAA,CAAAA,CAAAA;QAC/EjB,gBAAS,CAAA,CAAA,EAAGmE,6BAAgB,UAAY,EAAA,IAAA,CAAA,CAAA;AAC1C;AACF,CAAA;;;;"}
@@ -0,0 +1,139 @@
1
+ import { isObject } from 'lodash/fp';
2
+ import { engine, strapi } from '@strapi/data-transfer';
3
+ import { createStrapiInstance, parseRestoreFromOptions, DEFAULT_IGNORED_CONTENT_TYPES, formatDiagnostic, getDiffHandler, getAssetsBackupHandler, getTransferTelemetryPayload, setSignalHandler, abortTransfer, buildTransferTable, exitMessageText, loadersFactory } from '../../utils/data-transfer.mjs';
4
+ import { exitWith } from '../../utils/helpers.mjs';
5
+
6
+ const { createTransferEngine } = engine;
7
+ const { providers: { createRemoteStrapiDestinationProvider, createLocalStrapiSourceProvider, createLocalStrapiDestinationProvider, createRemoteStrapiSourceProvider } } = strapi;
8
+ /**
9
+ * Transfer command.
10
+ *
11
+ * Transfers data between local Strapi and remote Strapi instances
12
+ */ var action = (async (opts)=>{
13
+ // Validate inputs from Commander
14
+ if (!isObject(opts)) {
15
+ exitWith(1, 'Could not parse command arguments');
16
+ }
17
+ if (!(opts.from || opts.to) || opts.from && opts.to) {
18
+ exitWith(1, 'Exactly one source (from) or destination (to) option must be provided');
19
+ }
20
+ const strapi = await createStrapiInstance();
21
+ let source;
22
+ let destination;
23
+ // if no URL provided, use local Strapi
24
+ if (!opts.from) {
25
+ source = createLocalStrapiSourceProvider({
26
+ getStrapi: ()=>strapi
27
+ });
28
+ } else {
29
+ if (!opts.fromToken) {
30
+ exitWith(1, 'Missing token for remote destination');
31
+ }
32
+ source = createRemoteStrapiSourceProvider({
33
+ getStrapi: ()=>strapi,
34
+ url: opts.from,
35
+ auth: {
36
+ type: 'token',
37
+ token: opts.fromToken
38
+ }
39
+ });
40
+ }
41
+ // if no URL provided, use local Strapi
42
+ if (!opts.to) {
43
+ destination = createLocalStrapiDestinationProvider({
44
+ getStrapi: ()=>strapi,
45
+ strategy: 'restore',
46
+ restore: parseRestoreFromOptions(opts)
47
+ });
48
+ } else {
49
+ if (!opts.toToken) {
50
+ exitWith(1, 'Missing token for remote destination');
51
+ }
52
+ destination = createRemoteStrapiDestinationProvider({
53
+ url: opts.to,
54
+ auth: {
55
+ type: 'token',
56
+ token: opts.toToken
57
+ },
58
+ strategy: 'restore',
59
+ restore: parseRestoreFromOptions(opts)
60
+ });
61
+ }
62
+ if (!source || !destination) {
63
+ exitWith(1, 'Could not create providers');
64
+ }
65
+ const engine = createTransferEngine(source, destination, {
66
+ versionStrategy: 'exact',
67
+ schemaStrategy: 'strict',
68
+ exclude: opts.exclude,
69
+ only: opts.only,
70
+ throttle: opts.throttle,
71
+ transforms: {
72
+ links: [
73
+ {
74
+ filter (link) {
75
+ return !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.left.type) && !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.right.type);
76
+ }
77
+ }
78
+ ],
79
+ entities: [
80
+ {
81
+ filter (entity) {
82
+ return !DEFAULT_IGNORED_CONTENT_TYPES.includes(entity.type);
83
+ }
84
+ }
85
+ ]
86
+ }
87
+ });
88
+ engine.diagnostics.onDiagnostic(formatDiagnostic('transfer', opts.verbose));
89
+ const progress = engine.progress.stream;
90
+ const { updateLoader } = loadersFactory();
91
+ engine.onSchemaDiff(getDiffHandler(engine, {
92
+ force: opts.force,
93
+ action: 'transfer'
94
+ }));
95
+ engine.addErrorHandler('ASSETS_DIRECTORY_ERR', getAssetsBackupHandler(engine, {
96
+ force: opts.force,
97
+ action: 'transfer'
98
+ }));
99
+ progress.on(`stage::start`, ({ stage, data })=>{
100
+ updateLoader(stage, data).start();
101
+ });
102
+ progress.on('stage::finish', ({ stage, data })=>{
103
+ updateLoader(stage, data).succeed();
104
+ });
105
+ progress.on('stage::progress', ({ stage, data })=>{
106
+ updateLoader(stage, data);
107
+ });
108
+ progress.on('stage::error', ({ stage, data })=>{
109
+ updateLoader(stage, data).fail();
110
+ });
111
+ progress.on('transfer::start', async ()=>{
112
+ console.log(`Starting transfer...`);
113
+ await strapi.telemetry.send('didDEITSProcessStart', getTransferTelemetryPayload(engine));
114
+ });
115
+ let results;
116
+ try {
117
+ // Abort transfer if user interrupts process
118
+ setSignalHandler(()=>abortTransfer({
119
+ engine,
120
+ strapi
121
+ }));
122
+ results = await engine.transfer();
123
+ // Note: we need to await telemetry or else the process ends before it is sent
124
+ await strapi.telemetry.send('didDEITSProcessFinish', getTransferTelemetryPayload(engine));
125
+ try {
126
+ const table = buildTransferTable(results.engine);
127
+ console.log(table?.toString());
128
+ } catch (e) {
129
+ console.error('There was an error displaying the results of the transfer.');
130
+ }
131
+ exitWith(0, exitMessageText('transfer'));
132
+ } catch (e) {
133
+ await strapi.telemetry.send('didDEITSProcessFail', getTransferTelemetryPayload(engine));
134
+ exitWith(1, exitMessageText('transfer', true));
135
+ }
136
+ });
137
+
138
+ export { action as default };
139
+ //# sourceMappingURL=action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.mjs","sources":["../../../../../src/cli/commands/transfer/action.ts"],"sourcesContent":["import { isObject } from 'lodash/fp';\nimport { engine as engineDataTransfer, strapi as strapiDataTransfer } from '@strapi/data-transfer';\n\nimport {\n buildTransferTable,\n createStrapiInstance,\n DEFAULT_IGNORED_CONTENT_TYPES,\n formatDiagnostic,\n loadersFactory,\n exitMessageText,\n abortTransfer,\n getTransferTelemetryPayload,\n setSignalHandler,\n getDiffHandler,\n getAssetsBackupHandler,\n parseRestoreFromOptions,\n} from '../../utils/data-transfer';\nimport { exitWith } from '../../utils/helpers';\n\nconst { createTransferEngine } = engineDataTransfer;\nconst {\n providers: {\n createRemoteStrapiDestinationProvider,\n createLocalStrapiSourceProvider,\n createLocalStrapiDestinationProvider,\n createRemoteStrapiSourceProvider,\n },\n} = strapiDataTransfer;\n\ninterface CmdOptions {\n from?: URL;\n fromToken: string;\n to: URL;\n toToken: string;\n verbose?: boolean;\n only?: (keyof engineDataTransfer.TransferGroupFilter)[];\n exclude?: (keyof engineDataTransfer.TransferGroupFilter)[];\n throttle?: number;\n force?: boolean;\n}\n/**\n * Transfer command.\n *\n * Transfers data between local Strapi and remote Strapi instances\n */\nexport default async (opts: CmdOptions) => {\n // Validate inputs from Commander\n if (!isObject(opts)) {\n exitWith(1, 'Could not parse command arguments');\n }\n\n if (!(opts.from || opts.to) || (opts.from && opts.to)) {\n exitWith(1, 'Exactly one source (from) or destination (to) option must be provided');\n }\n\n const strapi = await createStrapiInstance();\n let source;\n let destination;\n\n // if no URL provided, use local Strapi\n if (!opts.from) {\n source = createLocalStrapiSourceProvider({\n getStrapi: () => strapi,\n });\n }\n // if URL provided, set up a remote source provider\n else {\n if (!opts.fromToken) {\n exitWith(1, 'Missing token for remote destination');\n }\n\n source = createRemoteStrapiSourceProvider({\n getStrapi: () => strapi,\n url: opts.from,\n auth: {\n type: 'token',\n token: opts.fromToken,\n },\n });\n }\n\n // if no URL provided, use local Strapi\n if (!opts.to) {\n destination = createLocalStrapiDestinationProvider({\n getStrapi: () => strapi,\n strategy: 'restore',\n restore: parseRestoreFromOptions(opts),\n });\n }\n // if URL provided, set up a remote destination provider\n else {\n if (!opts.toToken) {\n exitWith(1, 'Missing token for remote destination');\n }\n\n destination = createRemoteStrapiDestinationProvider({\n url: opts.to,\n auth: {\n type: 'token',\n token: opts.toToken,\n },\n strategy: 'restore',\n restore: parseRestoreFromOptions(opts),\n });\n }\n\n if (!source || !destination) {\n exitWith(1, 'Could not create providers');\n }\n\n const engine = createTransferEngine(source, destination, {\n versionStrategy: 'exact',\n schemaStrategy: 'strict',\n exclude: opts.exclude,\n only: opts.only,\n throttle: opts.throttle,\n transforms: {\n links: [\n {\n filter(link) {\n return (\n !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.left.type) &&\n !DEFAULT_IGNORED_CONTENT_TYPES.includes(link.right.type)\n );\n },\n },\n ],\n entities: [\n {\n filter(entity) {\n return !DEFAULT_IGNORED_CONTENT_TYPES.includes(entity.type);\n },\n },\n ],\n },\n });\n\n engine.diagnostics.onDiagnostic(formatDiagnostic('transfer', opts.verbose));\n\n const progress = engine.progress.stream;\n\n const { updateLoader } = loadersFactory();\n\n engine.onSchemaDiff(getDiffHandler(engine, { force: opts.force, action: 'transfer' }));\n\n engine.addErrorHandler(\n 'ASSETS_DIRECTORY_ERR',\n getAssetsBackupHandler(engine, { force: opts.force, action: 'transfer' })\n );\n\n progress.on(`stage::start`, ({ stage, data }) => {\n updateLoader(stage, data).start();\n });\n\n progress.on('stage::finish', ({ stage, data }) => {\n updateLoader(stage, data).succeed();\n });\n\n progress.on('stage::progress', ({ stage, data }) => {\n updateLoader(stage, data);\n });\n\n progress.on('stage::error', ({ stage, data }) => {\n updateLoader(stage, data).fail();\n });\n\n progress.on('transfer::start', async () => {\n console.log(`Starting transfer...`);\n\n await strapi.telemetry.send('didDEITSProcessStart', getTransferTelemetryPayload(engine));\n });\n\n let results: Awaited<ReturnType<typeof engine.transfer>>;\n try {\n // Abort transfer if user interrupts process\n setSignalHandler(() => abortTransfer({ engine, strapi }));\n\n results = await engine.transfer();\n\n // Note: we need to await telemetry or else the process ends before it is sent\n await strapi.telemetry.send('didDEITSProcessFinish', getTransferTelemetryPayload(engine));\n\n try {\n const table = buildTransferTable(results.engine);\n console.log(table?.toString());\n } catch (e) {\n console.error('There was an error displaying the results of the transfer.');\n }\n\n exitWith(0, exitMessageText('transfer'));\n } catch (e) {\n await strapi.telemetry.send('didDEITSProcessFail', getTransferTelemetryPayload(engine));\n exitWith(1, exitMessageText('transfer', true));\n }\n};\n"],"names":["createTransferEngine","engineDataTransfer","providers","createRemoteStrapiDestinationProvider","createLocalStrapiSourceProvider","createLocalStrapiDestinationProvider","createRemoteStrapiSourceProvider","strapiDataTransfer","opts","isObject","exitWith","from","to","strapi","createStrapiInstance","source","destination","getStrapi","fromToken","url","auth","type","token","strategy","restore","parseRestoreFromOptions","toToken","engine","versionStrategy","schemaStrategy","exclude","only","throttle","transforms","links","filter","link","DEFAULT_IGNORED_CONTENT_TYPES","includes","left","right","entities","entity","diagnostics","onDiagnostic","formatDiagnostic","verbose","progress","stream","updateLoader","loadersFactory","onSchemaDiff","getDiffHandler","force","action","addErrorHandler","getAssetsBackupHandler","on","stage","data","start","succeed","fail","console","log","telemetry","send","getTransferTelemetryPayload","results","setSignalHandler","abortTransfer","transfer","table","buildTransferTable","toString","e","error","exitMessageText"],"mappings":";;;;;AAmBA,MAAM,EAAEA,oBAAoB,EAAE,GAAGC,MAAAA;AACjC,MAAM,EACJC,SAAAA,EAAW,EACTC,qCAAqC,EACrCC,+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AAA,CAAA;IAEAf,QAASU,CAAAA,EAAE,CAAC,iBAAmB,EAAA,UAAA;AAC7BM,QAAAA,OAAAA,CAAQC,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAAA;AAElC,QAAA,MAAMnD,OAAOoD,SAAS,CAACC,IAAI,CAAC,wBAAwBC,2BAA4BxC,CAAAA,MAAAA,CAAAA,CAAAA;AAClF,KAAA,CAAA;IAEA,IAAIyC,OAAAA;IACJ,IAAI;;AAEFC,QAAAA,gBAAAA,CAAiB,IAAMC,aAAc,CAAA;AAAE3C,gBAAAA,MAAAA;AAAQd,gBAAAA;AAAO,aAAA,CAAA,CAAA;QAEtDuD,OAAU,GAAA,MAAMzC,OAAO4C,QAAQ,EAAA;;AAG/B,QAAA,MAAM1D,OAAOoD,SAAS,CAACC,IAAI,CAAC,yBAAyBC,2BAA4BxC,CAAAA,MAAAA,CAAAA,CAAAA;QAEjF,IAAI;YACF,MAAM6C,KAAAA,GAAQC,kBAAmBL,CAAAA,OAAAA,CAAQzC,MAAM,CAAA;YAC/CoC,OAAQC,CAAAA,GAAG,CAACQ,KAAOE,EAAAA,QAAAA,EAAAA,CAAAA;AACrB,SAAA,CAAE,OAAOC,CAAG,EAAA;AACVZ,YAAAA,OAAAA,CAAQa,KAAK,CAAC,4DAAA,CAAA;AAChB;AAEAlE,QAAAA,QAAAA,CAAS,GAAGmE,eAAgB,CAAA,UAAA,CAAA,CAAA;AAC9B,KAAA,CAAE,OAAOF,CAAG,EAAA;AACV,QAAA,MAAM9D,OAAOoD,SAAS,CAACC,IAAI,CAAC,uBAAuBC,2BAA4BxC,CAAAA,MAAAA,CAAAA,CAAAA;QAC/EjB,QAAS,CAAA,CAAA,EAAGmE,gBAAgB,UAAY,EAAA,IAAA,CAAA,CAAA;AAC1C;AACF,CAAA;;;;"}
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ var inquirer = require('inquirer');
4
+ var commander = require('commander');
5
+ var commander$1 = require('../../utils/commander.js');
6
+ var helpers = require('../../utils/helpers.js');
7
+ var dataTransfer = require('../../utils/data-transfer.js');
8
+ var action = require('./action.js');
9
+
10
+ /**
11
+ * `$ strapi transfer`
12
+ */ const command = ()=>{
13
+ return commander.createCommand('transfer').description('Transfer data from one source to another').allowExcessArguments(false).addOption(new commander.Option('--from <sourceURL>', `URL of the remote Strapi instance to get data from`).argParser(commander$1.parseURL)).addOption(new commander.Option('--from-token <token>', `Transfer token for the remote Strapi source`)).addOption(new commander.Option('--to <destinationURL>', `URL of the remote Strapi instance to send data to`).argParser(commander$1.parseURL)).addOption(new commander.Option('--to-token <token>', `Transfer token for the remote Strapi destination`)).addOption(new commander.Option('--verbose', 'Enable verbose logs')).addOption(commander$1.forceOption).addOption(dataTransfer.excludeOption).addOption(dataTransfer.onlyOption).addOption(dataTransfer.throttleOption).hook('preAction', dataTransfer.validateExcludeOnly).hook('preAction', helpers.ifOptions((opts)=>!(opts.from || opts.to) || opts.from && opts.to, async ()=>helpers.exitWith(1, 'Exactly one remote source (from) or destination (to) option must be provided')))// If --from is used, validate the URL and token
14
+ .hook('preAction', helpers.ifOptions((opts)=>opts.from, async (thisCommand)=>{
15
+ helpers.assertUrlHasProtocol(thisCommand.opts().from, [
16
+ 'https:',
17
+ 'http:'
18
+ ]);
19
+ if (!thisCommand.opts().fromToken) {
20
+ const answers = await inquirer.prompt([
21
+ {
22
+ type: 'password',
23
+ message: 'Please enter your transfer token for the remote Strapi source',
24
+ name: 'fromToken'
25
+ }
26
+ ]);
27
+ if (!answers.fromToken?.length) {
28
+ helpers.exitWith(1, 'No token provided for remote source, aborting transfer.');
29
+ }
30
+ thisCommand.opts().fromToken = answers.fromToken;
31
+ }
32
+ await commander$1.getCommanderConfirmMessage('The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?', {
33
+ failMessage: 'Transfer process aborted'
34
+ })(thisCommand);
35
+ }))// If --to is used, validate the URL, token, and confirm restore
36
+ .hook('preAction', helpers.ifOptions((opts)=>opts.to, async (thisCommand)=>{
37
+ helpers.assertUrlHasProtocol(thisCommand.opts().to, [
38
+ 'https:',
39
+ 'http:'
40
+ ]);
41
+ if (!thisCommand.opts().toToken) {
42
+ const answers = await inquirer.prompt([
43
+ {
44
+ type: 'password',
45
+ message: 'Please enter your transfer token for the remote Strapi destination',
46
+ name: 'toToken'
47
+ }
48
+ ]);
49
+ if (!answers.toToken?.length) {
50
+ helpers.exitWith(1, 'No token provided for remote destination, aborting transfer.');
51
+ }
52
+ thisCommand.opts().toToken = answers.toToken;
53
+ }
54
+ await commander$1.getCommanderConfirmMessage('The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?', {
55
+ failMessage: 'Transfer process aborted'
56
+ })(thisCommand);
57
+ })).action(action);
58
+ };
59
+
60
+ module.exports = command;
61
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sources":["../../../../../src/cli/commands/transfer/command.ts"],"sourcesContent":["import inquirer from 'inquirer';\nimport { createCommand, Option } from 'commander';\nimport { getCommanderConfirmMessage, forceOption, parseURL } from '../../utils/commander';\nimport { exitWith, assertUrlHasProtocol, ifOptions } from '../../utils/helpers';\nimport {\n excludeOption,\n onlyOption,\n throttleOption,\n validateExcludeOnly,\n} from '../../utils/data-transfer';\n\nimport action from './action';\n\n/**\n * `$ strapi transfer`\n */\nconst command = () => {\n return (\n createCommand('transfer')\n .description('Transfer data from one source to another')\n .allowExcessArguments(false)\n .addOption(\n new Option(\n '--from <sourceURL>',\n `URL of the remote Strapi instance to get data from`\n ).argParser(parseURL)\n )\n .addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`))\n .addOption(\n new Option(\n '--to <destinationURL>',\n `URL of the remote Strapi instance to send data to`\n ).argParser(parseURL)\n )\n\n .addOption(\n new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)\n )\n .addOption(new Option('--verbose', 'Enable verbose logs'))\n .addOption(forceOption)\n .addOption(excludeOption)\n .addOption(onlyOption)\n .addOption(throttleOption)\n .hook('preAction', validateExcludeOnly)\n .hook(\n 'preAction',\n ifOptions(\n (opts) => !(opts.from || opts.to) || (opts.from && opts.to),\n async () =>\n exitWith(\n 1,\n 'Exactly one remote source (from) or destination (to) option must be provided'\n )\n )\n )\n // If --from is used, validate the URL and token\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.from,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().from, ['https:', 'http:']);\n if (!thisCommand.opts().fromToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi source',\n name: 'fromToken',\n },\n ]);\n if (!answers.fromToken?.length) {\n exitWith(1, 'No token provided for remote source, aborting transfer.');\n }\n thisCommand.opts().fromToken = answers.fromToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n // If --to is used, validate the URL, token, and confirm restore\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.to,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().to, ['https:', 'http:']);\n if (!thisCommand.opts().toToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi destination',\n name: 'toToken',\n },\n ]);\n if (!answers.toToken?.length) {\n exitWith(1, 'No token provided for remote destination, aborting transfer.');\n }\n thisCommand.opts().toToken = answers.toToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n .action(action)\n );\n};\n\nexport default command;\n"],"names":["command","createCommand","description","allowExcessArguments","addOption","Option","argParser","parseURL","forceOption","excludeOption","onlyOption","throttleOption","hook","validateExcludeOnly","ifOptions","opts","from","to","exitWith","thisCommand","assertUrlHasProtocol","fromToken","answers","inquirer","prompt","type","message","name","length","getCommanderConfirmMessage","failMessage","toToken","action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C;AAEA,QAAA,MAAMF,uCACJ,kGACA,EAAA;YAAEC,WAAa,EAAA;SACfX,CAAAA,CAAAA,WAAAA,CAAAA;AACJ,KAAA,CAAA,CAAA,CAGHa,MAAM,CAACA,MAAAA,CAAAA;AAEd;;;;"}
@@ -0,0 +1,59 @@
1
+ import inquirer from 'inquirer';
2
+ import { createCommand, Option } from 'commander';
3
+ import { parseURL, forceOption, getCommanderConfirmMessage } from '../../utils/commander.mjs';
4
+ import { ifOptions, exitWith, assertUrlHasProtocol } from '../../utils/helpers.mjs';
5
+ import { excludeOption, onlyOption, throttleOption, validateExcludeOnly } from '../../utils/data-transfer.mjs';
6
+ import action from './action.mjs';
7
+
8
+ /**
9
+ * `$ strapi transfer`
10
+ */ const command = ()=>{
11
+ return createCommand('transfer').description('Transfer data from one source to another').allowExcessArguments(false).addOption(new Option('--from <sourceURL>', `URL of the remote Strapi instance to get data from`).argParser(parseURL)).addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`)).addOption(new Option('--to <destinationURL>', `URL of the remote Strapi instance to send data to`).argParser(parseURL)).addOption(new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)).addOption(new Option('--verbose', 'Enable verbose logs')).addOption(forceOption).addOption(excludeOption).addOption(onlyOption).addOption(throttleOption).hook('preAction', validateExcludeOnly).hook('preAction', ifOptions((opts)=>!(opts.from || opts.to) || opts.from && opts.to, async ()=>exitWith(1, 'Exactly one remote source (from) or destination (to) option must be provided')))// If --from is used, validate the URL and token
12
+ .hook('preAction', ifOptions((opts)=>opts.from, async (thisCommand)=>{
13
+ assertUrlHasProtocol(thisCommand.opts().from, [
14
+ 'https:',
15
+ 'http:'
16
+ ]);
17
+ if (!thisCommand.opts().fromToken) {
18
+ const answers = await inquirer.prompt([
19
+ {
20
+ type: 'password',
21
+ message: 'Please enter your transfer token for the remote Strapi source',
22
+ name: 'fromToken'
23
+ }
24
+ ]);
25
+ if (!answers.fromToken?.length) {
26
+ exitWith(1, 'No token provided for remote source, aborting transfer.');
27
+ }
28
+ thisCommand.opts().fromToken = answers.fromToken;
29
+ }
30
+ await getCommanderConfirmMessage('The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?', {
31
+ failMessage: 'Transfer process aborted'
32
+ })(thisCommand);
33
+ }))// If --to is used, validate the URL, token, and confirm restore
34
+ .hook('preAction', ifOptions((opts)=>opts.to, async (thisCommand)=>{
35
+ assertUrlHasProtocol(thisCommand.opts().to, [
36
+ 'https:',
37
+ 'http:'
38
+ ]);
39
+ if (!thisCommand.opts().toToken) {
40
+ const answers = await inquirer.prompt([
41
+ {
42
+ type: 'password',
43
+ message: 'Please enter your transfer token for the remote Strapi destination',
44
+ name: 'toToken'
45
+ }
46
+ ]);
47
+ if (!answers.toToken?.length) {
48
+ exitWith(1, 'No token provided for remote destination, aborting transfer.');
49
+ }
50
+ thisCommand.opts().toToken = answers.toToken;
51
+ }
52
+ await getCommanderConfirmMessage('The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?', {
53
+ failMessage: 'Transfer process aborted'
54
+ })(thisCommand);
55
+ })).action(action);
56
+ };
57
+
58
+ export { command as default };
59
+ //# sourceMappingURL=command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.mjs","sources":["../../../../../src/cli/commands/transfer/command.ts"],"sourcesContent":["import inquirer from 'inquirer';\nimport { createCommand, Option } from 'commander';\nimport { getCommanderConfirmMessage, forceOption, parseURL } from '../../utils/commander';\nimport { exitWith, assertUrlHasProtocol, ifOptions } from '../../utils/helpers';\nimport {\n excludeOption,\n onlyOption,\n throttleOption,\n validateExcludeOnly,\n} from '../../utils/data-transfer';\n\nimport action from './action';\n\n/**\n * `$ strapi transfer`\n */\nconst command = () => {\n return (\n createCommand('transfer')\n .description('Transfer data from one source to another')\n .allowExcessArguments(false)\n .addOption(\n new Option(\n '--from <sourceURL>',\n `URL of the remote Strapi instance to get data from`\n ).argParser(parseURL)\n )\n .addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`))\n .addOption(\n new Option(\n '--to <destinationURL>',\n `URL of the remote Strapi instance to send data to`\n ).argParser(parseURL)\n )\n\n .addOption(\n new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)\n )\n .addOption(new Option('--verbose', 'Enable verbose logs'))\n .addOption(forceOption)\n .addOption(excludeOption)\n .addOption(onlyOption)\n .addOption(throttleOption)\n .hook('preAction', validateExcludeOnly)\n .hook(\n 'preAction',\n ifOptions(\n (opts) => !(opts.from || opts.to) || (opts.from && opts.to),\n async () =>\n exitWith(\n 1,\n 'Exactly one remote source (from) or destination (to) option must be provided'\n )\n )\n )\n // If --from is used, validate the URL and token\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.from,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().from, ['https:', 'http:']);\n if (!thisCommand.opts().fromToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi source',\n name: 'fromToken',\n },\n ]);\n if (!answers.fromToken?.length) {\n exitWith(1, 'No token provided for remote source, aborting transfer.');\n }\n thisCommand.opts().fromToken = answers.fromToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n // If --to is used, validate the URL, token, and confirm restore\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.to,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().to, ['https:', 'http:']);\n if (!thisCommand.opts().toToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi destination',\n name: 'toToken',\n },\n ]);\n if (!answers.toToken?.length) {\n exitWith(1, 'No token provided for remote destination, aborting transfer.');\n }\n thisCommand.opts().toToken = answers.toToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n .action(action)\n );\n};\n\nexport default command;\n"],"names":["command","createCommand","description","allowExcessArguments","addOption","Option","argParser","parseURL","forceOption","excludeOption","onlyOption","throttleOption","hook","validateExcludeOnly","ifOptions","opts","from","to","exitWith","thisCommand","assertUrlHasProtocol","fromToken","answers","inquirer","prompt","type","message","name","length","getCommanderConfirmMessage","failMessage","toToken","action"],"mappings":";;;;;;;AAaA;;AAEC,UACKA,OAAU,GAAA,IAAA;IACd,OACEC,aAAAA,CAAc,YACXC,WAAW,CAAC,4CACZC,oBAAoB,CAAC,OACrBC,SAAS,CACR,IAAIC,MACF,CAAA,oBAAA,EACA,CAAC,kDAAkD,CAAC,EACpDC,SAAS,CAACC,QAEbH,CAAAA,CAAAA,CAAAA,SAAS,CAAC,IAAIC,OAAO,sBAAwB,EAAA,CAAC,2CAA2C,CAAC,CAAA,CAAA,CAC1FD,SAAS,CACR,IAAIC,OACF,uBACA,EAAA,CAAC,iDAAiD,CAAC,CAAA,CACnDC,SAAS,CAACC,QAAAA,CAAAA,CAAAA,CAGbH,SAAS,CACR,IAAIC,MAAO,CAAA,oBAAA,EAAsB,CAAC,gDAAgD,CAAC,CAEpFD,CAAAA,CAAAA,SAAS,CAAC,IAAIC,MAAAA,CAAO,aAAa,qBAClCD,CAAAA,CAAAA,CAAAA,SAAS,CAACI,WACVJ,CAAAA,CAAAA,SAAS,CAACK,aACVL,CAAAA,CAAAA,SAAS,CAACM,UACVN,CAAAA,CAAAA,SAAS,CAACO,cACVC,CAAAA,CAAAA,IAAI,CAAC,WAAA,EAAaC,mBAClBD,CAAAA,CAAAA,IAAI,CACH,WACAE,EAAAA,SAAAA,CACE,CAACC,IAAS,GAAA,EAAEA,IAAKC,CAAAA,IAAI,IAAID,IAAAA,CAAKE,EAAC,KAAOF,IAAKC,CAAAA,IAAI,IAAID,IAAKE,CAAAA,EAAE,EAC1D,UACEC,QAAAA,CACE,CACA,EAAA,8EAAA,CAAA,CAAA,CAIR;KACCN,IAAI,CACH,aACAE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D,YAAA,IAAI,CAACL,OAAAA,CAAQS,OAAO,EAAEH,MAAQ,EAAA;AAC5BV,gBAAAA,QAAAA,CAAS,CAAG,EAAA,8DAAA,CAAA;AACd;AACAC,YAAAA,WAAAA,CAAYJ,IAAI,EAAA,CAAGgB,OAAO,GAAGT,QAAQS,OAAO;AAC9C;AAEA,QAAA,MAAMF,2BACJ,kGACA,EAAA;YAAEC,WAAa,EAAA;SACfX,CAAAA,CAAAA,WAAAA,CAAAA;AACJ,KAAA,CAAA,CAAA,CAGHa,MAAM,CAACA,MAAAA,CAAAA;AAEd;;;;"}
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ var commander = require('commander');
4
+ var tsUtils = require('@strapi/typescript-utils');
5
+ var core = require('@strapi/core');
6
+ var helpers = require('../../utils/helpers.js');
7
+
8
+ const action = async ({ debug, silent, verbose, outDir })=>{
9
+ if ((debug || verbose) && silent) {
10
+ console.error('Flags conflict: both silent and debug mode are enabled, exiting...');
11
+ process.exit(1);
12
+ }
13
+ const appContext = await core.compileStrapi({
14
+ ignoreDiagnostics: true
15
+ });
16
+ const app = await core.createStrapi(appContext).register();
17
+ await tsUtils.generators.generate({
18
+ strapi: app,
19
+ pwd: appContext.appDir,
20
+ rootDir: outDir ?? undefined,
21
+ logger: {
22
+ silent,
23
+ debug
24
+ },
25
+ artifacts: {
26
+ contentTypes: true,
27
+ components: true
28
+ }
29
+ });
30
+ await app.destroy();
31
+ };
32
+ /**
33
+ * `$ strapi ts:generate-types`
34
+ */ const command = ()=>{
35
+ return commander.createCommand('ts:generate-types').description(`Generate TypeScript typings for your schemas`).option('-d, --debug', `Run the generation with debug messages`, false).option('-s, --silent', `Run the generation silently, without any output`, false).option('-o, --out-dir <outDir>', 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.').action(helpers.runAction('ts:generate-types', action));
36
+ };
37
+
38
+ exports.action = action;
39
+ exports.command = command;
40
+ //# sourceMappingURL=generate-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-types.js","sources":["../../../../../src/cli/commands/ts/generate-types.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n debug?: boolean;\n silent?: boolean;\n verbose?: boolean;\n outDir?: string;\n}\n\nconst action = async ({ debug, silent, verbose, outDir }: CmdOptions) => {\n if ((debug || verbose) && silent) {\n console.error('Flags conflict: both silent and debug mode are enabled, exiting...');\n process.exit(1);\n }\n\n const appContext = await compileStrapi({ ignoreDiagnostics: true });\n const app = await createStrapi(appContext).register();\n\n await tsUtils.generators.generate({\n strapi: app,\n pwd: appContext.appDir,\n rootDir: outDir ?? undefined,\n logger: {\n silent,\n debug,\n },\n artifacts: { contentTypes: true, components: true },\n });\n\n await app.destroy();\n};\n\n/**\n * `$ strapi ts:generate-types`\n */\nconst command: StrapiCommand = () => {\n return createCommand('ts:generate-types')\n .description(`Generate TypeScript typings for your schemas`)\n .option('-d, --debug', `Run the generation with debug messages`, false)\n .option('-s, --silent', `Run the generation silently, without any output`, false)\n .option(\n '-o, --out-dir <outDir>',\n 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.'\n )\n .action(runAction('ts:generate-types', action));\n};\n\nexport { action, command };\n"],"names":["action","debug","silent","verbose","outDir","console","error","process","exit","appContext","compileStrapi","ignoreDiagnostics","app","createStrapi","register","tsUtils","generators","generate","strapi","pwd","appDir","rootDir","undefined","logger","artifacts","contentTypes","components","destroy","command","createCommand","description","option","runAction"],"mappings":";;;;;;;AAcMA,MAAAA,MAAAA,GAAS,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAc,GAAA;AAClE,IAAA,IAAI,CAACH,KAASE,IAAAA,OAAM,KAAMD,MAAQ,EAAA;AAChCG,QAAAA,OAAAA,CAAQC,KAAK,CAAC,oEAAA,CAAA;AACdC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;IAEA,MAAMC,UAAAA,GAAa,MAAMC,kBAAc,CAAA;QAAEC,iBAAmB,EAAA;AAAK,KAAA,CAAA;AACjE,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaJ,CAAAA,UAAAA,CAAAA,CAAYK,QAAQ,EAAA;AAEnD,IAAA,MAAMC,OAAQC,CAAAA,UAAU,CAACC,QAAQ,CAAC;QAChCC,MAAQN,EAAAA,GAAAA;AACRO,QAAAA,GAAAA,EAAKV,WAAWW,MAAM;AACtBC,QAAAA,OAAAA,EAASjB,MAAUkB,IAAAA,SAAAA;QACnBC,MAAQ,EAAA;AACNrB,YAAAA,MAAAA;AACAD,YAAAA;AACF,SAAA;QACAuB,SAAW,EAAA;YAAEC,YAAc,EAAA,IAAA;YAAMC,UAAY,EAAA;AAAK;AACpD,KAAA,CAAA;AAEA,IAAA,MAAMd,IAAIe,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;AAC7B,IAAA,OAAOC,uBAAc,CAAA,mBAAA,CAAA,CAClBC,WAAW,CAAC,CAAC,4CAA4C,CAAC,CAAA,CAC1DC,MAAM,CAAC,aAAe,EAAA,CAAC,sCAAsC,CAAC,EAAE,KAChEA,CAAAA,CAAAA,MAAM,CAAC,cAAA,EAAgB,CAAC,+CAA+C,CAAC,EAAE,KAAA,CAAA,CAC1EA,MAAM,CACL,wBACA,EAAA,uKAAA,CAAA,CAED/B,MAAM,CAACgC,kBAAU,mBAAqBhC,EAAAA,MAAAA,CAAAA,CAAAA;AAC3C;;;;;"}
@@ -0,0 +1,37 @@
1
+ import { createCommand } from 'commander';
2
+ import tsUtils__default from '@strapi/typescript-utils';
3
+ import { compileStrapi, createStrapi } from '@strapi/core';
4
+ import { runAction } from '../../utils/helpers.mjs';
5
+
6
+ const action = async ({ debug, silent, verbose, outDir })=>{
7
+ if ((debug || verbose) && silent) {
8
+ console.error('Flags conflict: both silent and debug mode are enabled, exiting...');
9
+ process.exit(1);
10
+ }
11
+ const appContext = await compileStrapi({
12
+ ignoreDiagnostics: true
13
+ });
14
+ const app = await createStrapi(appContext).register();
15
+ await tsUtils__default.generators.generate({
16
+ strapi: app,
17
+ pwd: appContext.appDir,
18
+ rootDir: outDir ?? undefined,
19
+ logger: {
20
+ silent,
21
+ debug
22
+ },
23
+ artifacts: {
24
+ contentTypes: true,
25
+ components: true
26
+ }
27
+ });
28
+ await app.destroy();
29
+ };
30
+ /**
31
+ * `$ strapi ts:generate-types`
32
+ */ const command = ()=>{
33
+ return createCommand('ts:generate-types').description(`Generate TypeScript typings for your schemas`).option('-d, --debug', `Run the generation with debug messages`, false).option('-s, --silent', `Run the generation silently, without any output`, false).option('-o, --out-dir <outDir>', 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.').action(runAction('ts:generate-types', action));
34
+ };
35
+
36
+ export { action, command };
37
+ //# sourceMappingURL=generate-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-types.mjs","sources":["../../../../../src/cli/commands/ts/generate-types.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n debug?: boolean;\n silent?: boolean;\n verbose?: boolean;\n outDir?: string;\n}\n\nconst action = async ({ debug, silent, verbose, outDir }: CmdOptions) => {\n if ((debug || verbose) && silent) {\n console.error('Flags conflict: both silent and debug mode are enabled, exiting...');\n process.exit(1);\n }\n\n const appContext = await compileStrapi({ ignoreDiagnostics: true });\n const app = await createStrapi(appContext).register();\n\n await tsUtils.generators.generate({\n strapi: app,\n pwd: appContext.appDir,\n rootDir: outDir ?? undefined,\n logger: {\n silent,\n debug,\n },\n artifacts: { contentTypes: true, components: true },\n });\n\n await app.destroy();\n};\n\n/**\n * `$ strapi ts:generate-types`\n */\nconst command: StrapiCommand = () => {\n return createCommand('ts:generate-types')\n .description(`Generate TypeScript typings for your schemas`)\n .option('-d, --debug', `Run the generation with debug messages`, false)\n .option('-s, --silent', `Run the generation silently, without any output`, false)\n .option(\n '-o, --out-dir <outDir>',\n 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.'\n )\n .action(runAction('ts:generate-types', action));\n};\n\nexport { action, command };\n"],"names":["action","debug","silent","verbose","outDir","console","error","process","exit","appContext","compileStrapi","ignoreDiagnostics","app","createStrapi","register","tsUtils","generators","generate","strapi","pwd","appDir","rootDir","undefined","logger","artifacts","contentTypes","components","destroy","command","createCommand","description","option","runAction"],"mappings":";;;;;AAcMA,MAAAA,MAAAA,GAAS,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAc,GAAA;AAClE,IAAA,IAAI,CAACH,KAASE,IAAAA,OAAM,KAAMD,MAAQ,EAAA;AAChCG,QAAAA,OAAAA,CAAQC,KAAK,CAAC,oEAAA,CAAA;AACdC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;IAEA,MAAMC,UAAAA,GAAa,MAAMC,aAAc,CAAA;QAAEC,iBAAmB,EAAA;AAAK,KAAA,CAAA;AACjE,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaJ,CAAAA,UAAAA,CAAAA,CAAYK,QAAQ,EAAA;AAEnD,IAAA,MAAMC,gBAAQC,CAAAA,UAAU,CAACC,QAAQ,CAAC;QAChCC,MAAQN,EAAAA,GAAAA;AACRO,QAAAA,GAAAA,EAAKV,WAAWW,MAAM;AACtBC,QAAAA,OAAAA,EAASjB,MAAUkB,IAAAA,SAAAA;QACnBC,MAAQ,EAAA;AACNrB,YAAAA,MAAAA;AACAD,YAAAA;AACF,SAAA;QACAuB,SAAW,EAAA;YAAEC,YAAc,EAAA,IAAA;YAAMC,UAAY,EAAA;AAAK;AACpD,KAAA,CAAA;AAEA,IAAA,MAAMd,IAAIe,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;AAC7B,IAAA,OAAOC,aAAc,CAAA,mBAAA,CAAA,CAClBC,WAAW,CAAC,CAAC,4CAA4C,CAAC,CAAA,CAC1DC,MAAM,CAAC,aAAe,EAAA,CAAC,sCAAsC,CAAC,EAAE,KAChEA,CAAAA,CAAAA,MAAM,CAAC,cAAA,EAAgB,CAAC,+CAA+C,CAAC,EAAE,KAAA,CAAA,CAC1EA,MAAM,CACL,wBACA,EAAA,uKAAA,CAAA,CAED/B,MAAM,CAACgC,UAAU,mBAAqBhC,EAAAA,MAAAA,CAAAA,CAAAA;AAC3C;;;;"}
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var commander = require('commander');
4
+ var _package = require('../../../package.json.js');
5
+
6
+ /**
7
+ * `$ strapi version`
8
+ */ const command = ()=>{
9
+ // load the Strapi package.json to get version and other information
10
+ return commander.createCommand('version').description('Output the version of Strapi').action(()=>{
11
+ process.stdout.write(`${_package.version}\n`);
12
+ process.exit(0);
13
+ });
14
+ };
15
+
16
+ exports.command = command;
17
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sources":["../../../../src/cli/commands/version.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\nimport { version } from '../../../package.json';\n\n/**\n * `$ strapi version`\n */\n\nconst command: StrapiCommand = () => {\n // load the Strapi package.json to get version and other information\n return createCommand('version')\n .description('Output the version of Strapi')\n .action(() => {\n process.stdout.write(`${version}\\n`);\n process.exit(0);\n });\n};\n\nexport { command };\n"],"names":["command","createCommand","description","action","process","stdout","write","version","exit"],"mappings":";;;;;AAIA;;AAEC,UAEKA,OAAyB,GAAA,IAAA;;AAE7B,IAAA,OAAOC,wBAAc,SAClBC,CAAAA,CAAAA,WAAW,CAAC,8BAAA,CAAA,CACZC,MAAM,CAAC,IAAA;QACNC,OAAQC,CAAAA,MAAM,CAACC,KAAK,CAAC,CAAC,EAAEC,gBAAAA,CAAQ,EAAE,CAAC,CAAA;AACnCH,QAAAA,OAAAA,CAAQI,IAAI,CAAC,CAAA,CAAA;AACf,KAAA,CAAA;AACJ;;;;"}
@@ -0,0 +1,15 @@
1
+ import { createCommand } from 'commander';
2
+ import { version } from '../../../package.json.mjs';
3
+
4
+ /**
5
+ * `$ strapi version`
6
+ */ const command = ()=>{
7
+ // load the Strapi package.json to get version and other information
8
+ return createCommand('version').description('Output the version of Strapi').action(()=>{
9
+ process.stdout.write(`${version}\n`);
10
+ process.exit(0);
11
+ });
12
+ };
13
+
14
+ export { command };
15
+ //# sourceMappingURL=version.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.mjs","sources":["../../../../src/cli/commands/version.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\nimport { version } from '../../../package.json';\n\n/**\n * `$ strapi version`\n */\n\nconst command: StrapiCommand = () => {\n // load the Strapi package.json to get version and other information\n return createCommand('version')\n .description('Output the version of Strapi')\n .action(() => {\n process.stdout.write(`${version}\\n`);\n process.exit(0);\n });\n};\n\nexport { command };\n"],"names":["command","createCommand","description","action","process","stdout","write","version","exit"],"mappings":";;;AAIA;;AAEC,UAEKA,OAAyB,GAAA,IAAA;;AAE7B,IAAA,OAAOC,cAAc,SAClBC,CAAAA,CAAAA,WAAW,CAAC,8BAAA,CAAA,CACZC,MAAM,CAAC,IAAA;QACNC,OAAQC,CAAAA,MAAM,CAACC,KAAK,CAAC,CAAC,EAAEC,OAAAA,CAAQ,EAAE,CAAC,CAAA;AACnCH,QAAAA,OAAAA,CAAQI,IAAI,CAAC,CAAA,CAAA;AACf,KAAA,CAAA;AACJ;;;;"}