@strapi/strapi 5.37.1 → 5.38.1

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 (154) hide show
  1. package/dist/admin.js.map +1 -1
  2. package/dist/admin.mjs.map +1 -1
  3. package/dist/cli/commands/admin/create-user.d.ts.map +1 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/node/core/linked-packages.d.ts +15 -0
  7. package/dist/node/core/linked-packages.d.ts.map +1 -0
  8. package/dist/node/core/resolve-module.d.ts +8 -0
  9. package/dist/node/core/resolve-module.d.ts.map +1 -0
  10. package/dist/node/vite/config.d.ts.map +1 -1
  11. package/dist/node/webpack/config.d.ts.map +1 -1
  12. package/dist/package.json.js +1 -1
  13. package/dist/package.json.mjs +1 -1
  14. package/dist/src/cli/commands/admin/create-user.js +1 -2
  15. package/dist/src/cli/commands/admin/create-user.js.map +1 -1
  16. package/dist/src/cli/commands/admin/create-user.mjs +1 -2
  17. package/dist/src/cli/commands/admin/create-user.mjs.map +1 -1
  18. package/dist/src/cli/commands/admin/reset-user-password.js.map +1 -1
  19. package/dist/src/cli/commands/admin/reset-user-password.mjs.map +1 -1
  20. package/dist/src/cli/commands/build.js.map +1 -1
  21. package/dist/src/cli/commands/build.mjs.map +1 -1
  22. package/dist/src/cli/commands/components/list.js.map +1 -1
  23. package/dist/src/cli/commands/components/list.mjs.map +1 -1
  24. package/dist/src/cli/commands/configuration/dump.js.map +1 -1
  25. package/dist/src/cli/commands/configuration/dump.mjs.map +1 -1
  26. package/dist/src/cli/commands/configuration/restore.js.map +1 -1
  27. package/dist/src/cli/commands/configuration/restore.mjs.map +1 -1
  28. package/dist/src/cli/commands/console.js.map +1 -1
  29. package/dist/src/cli/commands/console.mjs.map +1 -1
  30. package/dist/src/cli/commands/content-types/list.js.map +1 -1
  31. package/dist/src/cli/commands/content-types/list.mjs.map +1 -1
  32. package/dist/src/cli/commands/controllers/list.js.map +1 -1
  33. package/dist/src/cli/commands/controllers/list.mjs.map +1 -1
  34. package/dist/src/cli/commands/develop.js.map +1 -1
  35. package/dist/src/cli/commands/develop.mjs.map +1 -1
  36. package/dist/src/cli/commands/export/action.js +19 -19
  37. package/dist/src/cli/commands/export/action.js.map +1 -1
  38. package/dist/src/cli/commands/export/action.mjs +1 -1
  39. package/dist/src/cli/commands/export/action.mjs.map +1 -1
  40. package/dist/src/cli/commands/export/command.js.map +1 -1
  41. package/dist/src/cli/commands/export/command.mjs.map +1 -1
  42. package/dist/src/cli/commands/generate.js.map +1 -1
  43. package/dist/src/cli/commands/generate.mjs.map +1 -1
  44. package/dist/src/cli/commands/hooks/list.js.map +1 -1
  45. package/dist/src/cli/commands/hooks/list.mjs.map +1 -1
  46. package/dist/src/cli/commands/import/action.js +19 -19
  47. package/dist/src/cli/commands/import/action.js.map +1 -1
  48. package/dist/src/cli/commands/import/action.mjs +1 -1
  49. package/dist/src/cli/commands/import/action.mjs.map +1 -1
  50. package/dist/src/cli/commands/import/command.js.map +1 -1
  51. package/dist/src/cli/commands/import/command.mjs.map +1 -1
  52. package/dist/src/cli/commands/index.js.map +1 -1
  53. package/dist/src/cli/commands/index.mjs.map +1 -1
  54. package/dist/src/cli/commands/middlewares/list.js.map +1 -1
  55. package/dist/src/cli/commands/middlewares/list.mjs.map +1 -1
  56. package/dist/src/cli/commands/openapi/generate.js.map +1 -1
  57. package/dist/src/cli/commands/openapi/generate.mjs.map +1 -1
  58. package/dist/src/cli/commands/openapi/index.js.map +1 -1
  59. package/dist/src/cli/commands/openapi/index.mjs.map +1 -1
  60. package/dist/src/cli/commands/policies/list.js.map +1 -1
  61. package/dist/src/cli/commands/policies/list.mjs.map +1 -1
  62. package/dist/src/cli/commands/report.js.map +1 -1
  63. package/dist/src/cli/commands/report.mjs.map +1 -1
  64. package/dist/src/cli/commands/routes/list.js.map +1 -1
  65. package/dist/src/cli/commands/routes/list.mjs.map +1 -1
  66. package/dist/src/cli/commands/services/list.js.map +1 -1
  67. package/dist/src/cli/commands/services/list.mjs.map +1 -1
  68. package/dist/src/cli/commands/start.js.map +1 -1
  69. package/dist/src/cli/commands/start.mjs.map +1 -1
  70. package/dist/src/cli/commands/telemetry/disable.js.map +1 -1
  71. package/dist/src/cli/commands/telemetry/disable.mjs.map +1 -1
  72. package/dist/src/cli/commands/telemetry/enable.js.map +1 -1
  73. package/dist/src/cli/commands/telemetry/enable.mjs.map +1 -1
  74. package/dist/src/cli/commands/templates/generate.js.map +1 -1
  75. package/dist/src/cli/commands/templates/generate.mjs.map +1 -1
  76. package/dist/src/cli/commands/transfer/action.js +20 -20
  77. package/dist/src/cli/commands/transfer/action.js.map +1 -1
  78. package/dist/src/cli/commands/transfer/action.mjs.map +1 -1
  79. package/dist/src/cli/commands/transfer/command.js.map +1 -1
  80. package/dist/src/cli/commands/transfer/command.mjs.map +1 -1
  81. package/dist/src/cli/commands/ts/generate-types.js.map +1 -1
  82. package/dist/src/cli/commands/ts/generate-types.mjs.map +1 -1
  83. package/dist/src/cli/commands/version.js.map +1 -1
  84. package/dist/src/cli/commands/version.mjs.map +1 -1
  85. package/dist/src/cli/utils/commander.js.map +1 -1
  86. package/dist/src/cli/utils/commander.mjs.map +1 -1
  87. package/dist/src/cli/utils/data-transfer.js.map +1 -1
  88. package/dist/src/cli/utils/data-transfer.mjs +1 -1
  89. package/dist/src/cli/utils/data-transfer.mjs.map +1 -1
  90. package/dist/src/cli/utils/helpers.js.map +1 -1
  91. package/dist/src/cli/utils/helpers.mjs.map +1 -1
  92. package/dist/src/cli/utils/logger.js.map +1 -1
  93. package/dist/src/cli/utils/logger.mjs.map +1 -1
  94. package/dist/src/cli/utils/telemetry.js.map +1 -1
  95. package/dist/src/cli/utils/telemetry.mjs.map +1 -1
  96. package/dist/src/cli/utils/tsconfig.js.map +1 -1
  97. package/dist/src/cli/utils/tsconfig.mjs.map +1 -1
  98. package/dist/src/node/build.js.map +1 -1
  99. package/dist/src/node/build.mjs.map +1 -1
  100. package/dist/src/node/core/admin-customisations.js.map +1 -1
  101. package/dist/src/node/core/admin-customisations.mjs.map +1 -1
  102. package/dist/src/node/core/aliases.js.map +1 -1
  103. package/dist/src/node/core/aliases.mjs.map +1 -1
  104. package/dist/src/node/core/config.js.map +1 -1
  105. package/dist/src/node/core/config.mjs.map +1 -1
  106. package/dist/src/node/core/dependencies.js.map +1 -1
  107. package/dist/src/node/core/dependencies.mjs.map +1 -1
  108. package/dist/src/node/core/env.js.map +1 -1
  109. package/dist/src/node/core/env.mjs.map +1 -1
  110. package/dist/src/node/core/errors.js.map +1 -1
  111. package/dist/src/node/core/errors.mjs.map +1 -1
  112. package/dist/src/node/core/files.js.map +1 -1
  113. package/dist/src/node/core/files.mjs.map +1 -1
  114. package/dist/src/node/core/linked-packages.js +34 -0
  115. package/dist/src/node/core/linked-packages.js.map +1 -0
  116. package/dist/src/node/core/linked-packages.mjs +30 -0
  117. package/dist/src/node/core/linked-packages.mjs.map +1 -0
  118. package/dist/src/node/core/managers.js.map +1 -1
  119. package/dist/src/node/core/managers.mjs.map +1 -1
  120. package/dist/src/node/core/monorepo.js.map +1 -1
  121. package/dist/src/node/core/monorepo.mjs.map +1 -1
  122. package/dist/src/node/core/plugins.js.map +1 -1
  123. package/dist/src/node/core/plugins.mjs.map +1 -1
  124. package/dist/src/node/core/resolve-module.js +20 -0
  125. package/dist/src/node/core/resolve-module.js.map +1 -0
  126. package/dist/src/node/core/resolve-module.mjs +18 -0
  127. package/dist/src/node/core/resolve-module.mjs.map +1 -0
  128. package/dist/src/node/core/timer.js.map +1 -1
  129. package/dist/src/node/core/timer.mjs.map +1 -1
  130. package/dist/src/node/create-build-context.js.map +1 -1
  131. package/dist/src/node/create-build-context.mjs.map +1 -1
  132. package/dist/src/node/develop.js.map +1 -1
  133. package/dist/src/node/develop.mjs.map +1 -1
  134. package/dist/src/node/staticFiles.js.map +1 -1
  135. package/dist/src/node/staticFiles.mjs.map +1 -1
  136. package/dist/src/node/vite/build.js.map +1 -1
  137. package/dist/src/node/vite/build.mjs.map +1 -1
  138. package/dist/src/node/vite/config.js +27 -3
  139. package/dist/src/node/vite/config.js.map +1 -1
  140. package/dist/src/node/vite/config.mjs +27 -3
  141. package/dist/src/node/vite/config.mjs.map +1 -1
  142. package/dist/src/node/vite/plugins.js.map +1 -1
  143. package/dist/src/node/vite/plugins.mjs.map +1 -1
  144. package/dist/src/node/vite/watch.js.map +1 -1
  145. package/dist/src/node/vite/watch.mjs.map +1 -1
  146. package/dist/src/node/webpack/build.js.map +1 -1
  147. package/dist/src/node/webpack/build.mjs.map +1 -1
  148. package/dist/src/node/webpack/config.js +16 -18
  149. package/dist/src/node/webpack/config.js.map +1 -1
  150. package/dist/src/node/webpack/config.mjs +10 -12
  151. package/dist/src/node/webpack/config.mjs.map +1 -1
  152. package/dist/src/node/webpack/watch.js.map +1 -1
  153. package/dist/src/node/webpack/watch.mjs.map +1 -1
  154. package/package.json +24 -23
package/dist/admin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/content-type-builder/strapi-admin';\nimport contentManager from '@strapi/content-manager/strapi-admin';\nimport email from '@strapi/email/strapi-admin';\nimport upload from '@strapi/upload/strapi-admin';\nimport i18n from '@strapi/i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\nimport reviewWorkflows from '@strapi/review-workflows/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-manager': contentManager,\n 'content-type-builder': contentTypeBuilder,\n email,\n upload,\n contentReleases,\n i18n,\n reviewWorkflows,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n\nexport {\n unstable_useDocumentLayout,\n unstable_useDocumentActions,\n unstable_useDocument,\n unstable_useContentManagerContext,\n useDocumentRBAC,\n} from '@strapi/content-manager/strapi-admin';\n\nexport {\n private_useAutoReloadOverlayBlocker,\n private_AutoReloadOverlayBlockerProvider,\n} from '@strapi/content-type-builder/strapi-admin';\n"],"names":["render","mountNode","plugins","restArgs","renderAdmin","contentManager","contentTypeBuilder","email","upload","contentReleases","i18n","reviewWorkflows"],"mappings":";;;;;;;;;;;AASA,MAAMA,SAAS,CAACC,SAAAA,EAA+B,EAAEC,OAAO,EAAE,GAAGC,QAA2B,EAAA,GAAA;AACtF,IAAA,OAAOC,wBAAYH,SAAW,EAAA;AAC5B,QAAA,GAAGE,QAAQ;QACXD,OAAS,EAAA;YACP,iBAAmBG,EAAAA,cAAAA;YACnB,sBAAwBC,EAAAA,kBAAAA;AACxBC,YAAAA,KAAAA;AACAC,YAAAA,MAAAA;AACAC,YAAAA,eAAAA;AACAC,YAAAA,IAAAA;AACAC,YAAAA,eAAAA;AACA,YAAA,GAAGT;AACL;AACF,KAAA,CAAA;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/content-type-builder/strapi-admin';\nimport contentManager from '@strapi/content-manager/strapi-admin';\nimport email from '@strapi/email/strapi-admin';\nimport upload from '@strapi/upload/strapi-admin';\nimport i18n from '@strapi/i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\nimport reviewWorkflows from '@strapi/review-workflows/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-manager': contentManager,\n 'content-type-builder': contentTypeBuilder,\n email,\n upload,\n contentReleases,\n i18n,\n reviewWorkflows,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n\nexport {\n unstable_useDocumentLayout,\n unstable_useDocumentActions,\n unstable_useDocument,\n unstable_useContentManagerContext,\n useDocumentRBAC,\n} from '@strapi/content-manager/strapi-admin';\n\nexport {\n private_useAutoReloadOverlayBlocker,\n private_AutoReloadOverlayBlockerProvider,\n} from '@strapi/content-type-builder/strapi-admin';\n"],"names":["render","mountNode","plugins","restArgs","renderAdmin","contentManager","contentTypeBuilder","email","upload","contentReleases","i18n","reviewWorkflows"],"mappings":";;;;;;;;;;;AASA,MAAMA,SAAS,CAACC,SAAAA,EAA+B,EAAEC,OAAO,EAAE,GAAGC,QAAAA,EAA2B,GAAA;AACtF,IAAA,OAAOC,wBAAYH,SAAAA,EAAW;AAC5B,QAAA,GAAGE,QAAQ;QACXD,OAAAA,EAAS;YACP,iBAAA,EAAmBG,cAAAA;YACnB,sBAAA,EAAwBC,kBAAAA;AACxBC,YAAAA,KAAAA;AACAC,YAAAA,MAAAA;AACAC,YAAAA,eAAAA;AACAC,YAAAA,IAAAA;AACAC,YAAAA,eAAAA;AACA,YAAA,GAAGT;AACL;AACF,KAAA,CAAA;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"admin.mjs","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/content-type-builder/strapi-admin';\nimport contentManager from '@strapi/content-manager/strapi-admin';\nimport email from '@strapi/email/strapi-admin';\nimport upload from '@strapi/upload/strapi-admin';\nimport i18n from '@strapi/i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\nimport reviewWorkflows from '@strapi/review-workflows/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-manager': contentManager,\n 'content-type-builder': contentTypeBuilder,\n email,\n upload,\n contentReleases,\n i18n,\n reviewWorkflows,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n\nexport {\n unstable_useDocumentLayout,\n unstable_useDocumentActions,\n unstable_useDocument,\n unstable_useContentManagerContext,\n useDocumentRBAC,\n} from '@strapi/content-manager/strapi-admin';\n\nexport {\n private_useAutoReloadOverlayBlocker,\n private_AutoReloadOverlayBlockerProvider,\n} from '@strapi/content-type-builder/strapi-admin';\n"],"names":["render","mountNode","plugins","restArgs","renderAdmin","contentManager","contentTypeBuilder","email","upload","contentReleases","i18n","reviewWorkflows"],"mappings":";;;;;;;;;;;;AASA,MAAMA,SAAS,CAACC,SAAAA,EAA+B,EAAEC,OAAO,EAAE,GAAGC,QAA2B,EAAA,GAAA;AACtF,IAAA,OAAOC,YAAYH,SAAW,EAAA;AAC5B,QAAA,GAAGE,QAAQ;QACXD,OAAS,EAAA;YACP,iBAAmBG,EAAAA,cAAAA;YACnB,sBAAwBC,EAAAA,kBAAAA;AACxBC,YAAAA,KAAAA;AACAC,YAAAA,MAAAA;AACAC,YAAAA,eAAAA;AACAC,YAAAA,IAAAA;AACAC,YAAAA,eAAAA;AACA,YAAA,GAAGT;AACL;AACF,KAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"admin.mjs","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/content-type-builder/strapi-admin';\nimport contentManager from '@strapi/content-manager/strapi-admin';\nimport email from '@strapi/email/strapi-admin';\nimport upload from '@strapi/upload/strapi-admin';\nimport i18n from '@strapi/i18n/strapi-admin';\nimport contentReleases from '@strapi/content-releases/strapi-admin';\nimport reviewWorkflows from '@strapi/review-workflows/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-manager': contentManager,\n 'content-type-builder': contentTypeBuilder,\n email,\n upload,\n contentReleases,\n i18n,\n reviewWorkflows,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs };\n\nexport * from '@strapi/admin/strapi-admin';\n\nexport {\n unstable_useDocumentLayout,\n unstable_useDocumentActions,\n unstable_useDocument,\n unstable_useContentManagerContext,\n useDocumentRBAC,\n} from '@strapi/content-manager/strapi-admin';\n\nexport {\n private_useAutoReloadOverlayBlocker,\n private_AutoReloadOverlayBlockerProvider,\n} from '@strapi/content-type-builder/strapi-admin';\n"],"names":["render","mountNode","plugins","restArgs","renderAdmin","contentManager","contentTypeBuilder","email","upload","contentReleases","i18n","reviewWorkflows"],"mappings":";;;;;;;;;;;;AASA,MAAMA,SAAS,CAACC,SAAAA,EAA+B,EAAEC,OAAO,EAAE,GAAGC,QAAAA,EAA2B,GAAA;AACtF,IAAA,OAAOC,YAAYH,SAAAA,EAAW;AAC5B,QAAA,GAAGE,QAAQ;QACXD,OAAAA,EAAS;YACP,iBAAA,EAAmBG,cAAAA;YACnB,sBAAA,EAAwBC,kBAAAA;AACxBC,YAAAA,KAAAA;AACAC,YAAAA,MAAAA;AACAC,YAAAA,eAAAA;AACAC,YAAAA,IAAAA;AACAC,YAAAA,eAAAA;AACA,YAAA,GAAGT;AACL;AACF,KAAA,CAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-user.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/admin/create-user.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA+FD;;GAEG;AACH,QAAA,MAAM,MAAM,gBAAsB,UAAU,kBA8B3C,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aASd,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"create-user.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/admin/create-user.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA8FD;;GAEG;AACH,QAAA,MAAM,MAAM,gBAAsB,UAAU,kBA8B3C,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aASd,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\nimport { version } from '../../package.json';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(version, '-v, --version', 'Output the version number');\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["createCLI","argv","command","Command","storeOptionsAsProperties","allowUnknownOption","helpOption","addHelpCommand","version","cwd","process","hasDebug","includes","hasSilent","logger","createLogger","debug","silent","timestamp","tsconfig","loadTsConfig","path","ctx","commandFactory","strapiCommands","subCommand","addCommand","e","console","error","deprecatedCommands","name","message","forEach","deprecated","description","action","warn","hidden","runCLI","commands","parseAsync"],"mappings":";;;;;;;;AASA,MAAMA,SAAY,GAAA,OAAOC,IAAgBC,EAAAA,OAAAA,GAAU,IAAIC,iBAAS,EAAA,GAAA;;AAE9DD,IAAAA,OAAA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/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\nimport { version } from '../../package.json';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(version, '-v, --version', 'Output the version number');\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["createCLI","argv","command","Command","storeOptionsAsProperties","allowUnknownOption","helpOption","addHelpCommand","version","cwd","process","hasDebug","includes","hasSilent","logger","createLogger","debug","silent","timestamp","tsconfig","loadTsConfig","path","ctx","commandFactory","strapiCommands","subCommand","addCommand","e","console","error","deprecatedCommands","name","message","forEach","deprecated","description","action","warn","hidden","runCLI","commands","parseAsync"],"mappings":";;;;;;;;AASA,MAAMA,SAAAA,GAAY,OAAOC,IAAAA,EAAgBC,OAAAA,GAAU,IAAIC,iBAAAA,EAAS,GAAA;;AAE9DD,IAAAA,OAAAA,CAAQE,wBAAwB,CAAC,KAAA,CAAA,CAAOC,kBAAkB,CAAC,IAAA,CAAA;;IAG3DH,OAAAA,CAAQI,UAAU,CAAC,YAAA,EAAc,0BAAA,CAAA;IACjCJ,OAAAA,CAAQK,cAAc,CAAC,gBAAA,EAAkB,0BAAA,CAAA;IAEzCL,OAAAA,CAAQM,OAAO,CAACA,gBAAAA,EAAS,eAAA,EAAiB,2BAAA,CAAA;IAE1C,MAAMC,GAAAA,GAAMC,QAAQD,GAAG,EAAA;IAEvB,MAAME,QAAAA,GAAWV,IAAAA,CAAKW,QAAQ,CAAC,SAAA,CAAA;IAC/B,MAAMC,SAAAA,GAAYZ,IAAAA,CAAKW,QAAQ,CAAC,UAAA,CAAA;AAEhC,IAAA,MAAME,WAASC,mBAAAA,CAAa;QAAEC,KAAAA,EAAOL,QAAAA;QAAUM,MAAAA,EAAQJ,SAAAA;QAAWK,SAAAA,EAAW;AAAM,KAAA,CAAA;AAEnF,IAAA,MAAMC,aAAWC,qBAAAA,CAAa;AAC5BX,QAAAA,GAAAA;QACAY,IAAAA,EAAM,eAAA;AACNP,gBAAAA;AACF,KAAA,CAAA;AAEA,IA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,CAAC,CAAA;AAEnG,YAAA,IAAIC,OAAAA,EAAS;AACXJ,gBAAAA,OAAAA,CAAQS,IAAI,CAACL,OAAAA,CAAAA;AACf,YAAA;AACF,QAAA,CAAA,CAAA;QACF9B,OAAAA,CAAQwB,UAAU,CAACQ,UAAAA,EAAY;YAAEI,MAAAA,EAAQ;AAAK,SAAA,CAAA;AAChD,IAAA,CAAA,CAAA;IACA,OAAOpC,OAAAA;AACT;AAEA,MAAMqC,MAAAA,GAAS,OAAOtC,IAAAA,GAAOS,OAAAA,CAAQT,IAAI,EAAEC,OAAAA,GAAU,IAAIC,iBAAAA,EAAS,GAAA;IAChE,MAAMqC,QAAAA,GAAW,MAAMxC,SAAAA,CAAUC,IAAAA,EAAMC,OAAAA,CAAAA;IACvC,MAAMsC,QAAAA,CAASC,UAAU,CAACxC,IAAAA,CAAAA;AAC5B;;;;;"}
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","sources":["../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\nimport { version } from '../../package.json';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(version, '-v, --version', 'Output the version number');\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["createCLI","argv","command","Command","storeOptionsAsProperties","allowUnknownOption","helpOption","addHelpCommand","version","cwd","process","hasDebug","includes","hasSilent","logger","createLogger","debug","silent","timestamp","tsconfig","loadTsConfig","path","ctx","commandFactory","strapiCommands","subCommand","addCommand","e","console","error","deprecatedCommands","name","message","forEach","deprecated","description","action","warn","hidden","runCLI","commands","parseAsync"],"mappings":";;;;;;AASA,MAAMA,SAAY,GAAA,OAAOC,IAAgBC,EAAAA,OAAAA,GAAU,IAAIC,OAAS,EAAA,GAAA;;AAE9DD,IAAAA,OAAAA,CAAQE,wBAAwB,CAAC,KAAOC,CAAAA,CAAAA,kBAAkB,CAAC,IAAA,CAAA;;IAG3DH,OAAQI,CAAAA,UAAU,CAAC,YAAc,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AAA;YACNC,OAAS,EAAA;AACX,SAAA;AACA,QAAA;YACED,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA;AACX,SAAA;AACA,QAAA;YACED,IAAM,EAAA,mBAAA;YACNC,OAAS,EAAA;AACX,SAAA;AACA,QAAA;YACED,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA;AACX;AACD,KAAA;;AAGDF,IAAAA,kBAAAA,CAAmBG,OAAO,CAAC,CAAC,EAAEF,IAAI,EAAEC,OAAO,EAAE,GAAA;QAC3C,MAAME,UAAAA,GAAa,IAAI/B,OAAAA,CAAQ4B,IAC5B7B,CAAAA,CAAAA,OAAO,CAAC6B,IAAAA,CAAAA,CACRI,WAAW,CAAC,cACZC,CAAAA,CAAAA,MAAM,CAAC,IAAA;AACNR,YAAAA,OAAAA,CAAQS,IAAI,CACV,CAAC,YAAY,EAAEN,IAAAA,CAAK,4EAA4E,CAAC,CAAA;AAEnG,YAAA,IAAIC,OAAS,EAAA;AACXJ,gBAAAA,OAAAA,CAAQS,IAAI,CAACL,OAAAA,CAAAA;AACf;AACF,SAAA,CAAA;QACF9B,OAAQwB,CAAAA,UAAU,CAACQ,UAAY,EAAA;YAAEI,MAAQ,EAAA;AAAK,SAAA,CAAA;AAChD,KAAA,CAAA;IACA,OAAOpC,OAAAA;AACT;AAEMqC,MAAAA,MAAAA,GAAS,OAAOtC,IAAOS,GAAAA,OAAAA,CAAQT,IAAI,EAAEC,OAAAA,GAAU,IAAIC,OAAS,EAAA,GAAA;IAChE,MAAMqC,QAAAA,GAAW,MAAMxC,SAAAA,CAAUC,IAAMC,EAAAA,OAAAA,CAAAA;IACvC,MAAMsC,QAAAA,CAASC,UAAU,CAACxC,IAAAA,CAAAA;AAC5B;;;;"}
1
+ {"version":3,"file":"cli.mjs","sources":["../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\nimport { version } from '../../package.json';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(version, '-v, --version', 'Output the version number');\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["createCLI","argv","command","Command","storeOptionsAsProperties","allowUnknownOption","helpOption","addHelpCommand","version","cwd","process","hasDebug","includes","hasSilent","logger","createLogger","debug","silent","timestamp","tsconfig","loadTsConfig","path","ctx","commandFactory","strapiCommands","subCommand","addCommand","e","console","error","deprecatedCommands","name","message","forEach","deprecated","description","action","warn","hidden","runCLI","commands","parseAsync"],"mappings":";;;;;;AASA,MAAMA,SAAAA,GAAY,OAAOC,IAAAA,EAAgBC,OAAAA,GAAU,IAAIC,OAAAA,EAAS,GAAA;;AAE9DD,IAAAA,OAAAA,CAAQE,wBAAwB,CAAC,KAAA,CAAA,CAAOC,kBAAkB,CAAC,IAAA,CAAA;;IAG3DH,OAAAA,CAAQI,UAAU,CAAC,YAAA,EAAc,0BAAA,CAAA;IACjCJ,OAAAA,CAAQK,cAAc,CAAC,gBAAA,EAAkB,0BAAA,CAAA;IAEzCL,OAAAA,CAAQM,OAAO,CAACA,OAAAA,EAAS,eAAA,EAAiB,2BAAA,CAAA;IAE1C,MAAMC,GAAAA,GAAMC,QAAQD,GAAG,EAAA;IAEvB,MAAME,QAAAA,GAAWV,IAAAA,CAAKW,QAAQ,CAAC,SAAA,CAAA;IAC/B,MAAMC,SAAAA,GAAYZ,IAAAA,CAAKW,QAAQ,CAAC,UAAA,CAAA;AAEhC,IAAA,MAAME,SAASC,YAAAA,CAAa;QAAEC,KAAAA,EAAOL,QAAAA;QAAUM,MAAAA,EAAQJ,SAAAA;QAAWK,SAAAA,EAAW;AAAM,KAAA,CAAA;AAEnF,IAAA,MAAMC,WAAWC,YAAAA,CAAa;AAC5BX,QAAAA,GAAAA;QACAY,IAAAA,EAAM,eAAA;AACNP,QAAAA;AACF,KAAA,CAAA;AAEA,IAAA,MAAMQ,GAAAA,GAAM;AACVb,QAAAA,GAAAA;AACAK,QAAAA,MAAAA;AACAK,QAAAA;AACF,KAAA;;IAGA,KAAK,MAAMI,kBAAkBC,QAAAA,CAA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A;QACF9B,OAAAA,CAAQwB,UAAU,CAACQ,UAAAA,EAAY;YAAEI,MAAAA,EAAQ;AAAK,SAAA,CAAA;AAChD,IAAA,CAAA,CAAA;IACA,OAAOpC,OAAAA;AACT;AAEA,MAAMqC,MAAAA,GAAS,OAAOtC,IAAAA,GAAOS,OAAAA,CAAQT,IAAI,EAAEC,OAAAA,GAAU,IAAIC,OAAAA,EAAS,GAAA;IAChE,MAAMqC,QAAAA,GAAW,MAAMxC,SAAAA,CAAUC,IAAAA,EAAMC,OAAAA,CAAAA;IACvC,MAAMsC,QAAAA,CAASC,UAAU,CAACxC,IAAAA,CAAAA;AAC5B;;;;"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Detect if a package is locally linked (portal:, file:, yarn link) rather than installed in node_modules.
3
+ * When linked, the resolved path is outside node_modules.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare const isPackageLinked: (mod: string) => boolean;
8
+ /**
9
+ * Detects if @strapi/design-system is linked (portal:, file:, or yarn link).
10
+ * Returns the package root path when linked, null otherwise.
11
+ * Uses the heuristic: linked packages resolve outside node_modules.
12
+ */
13
+ export declare const getLinkedDesignSystemPath: () => string | null;
14
+ export declare const isDesignSystemLinked: () => boolean;
15
+ //# sourceMappingURL=linked-packages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linked-packages.d.ts","sourceRoot":"","sources":["../../../src/node/core/linked-packages.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,OAI7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,QAAO,MAAM,GAAG,IAOrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAO,OAA+C,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Resolve module to package root for use in aliases.
3
+ * Ensures pnpm's strict node_modules structure can resolve packages when bundling plugin chunks.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare const getModulePath: (mod: string) => string;
8
+ //# sourceMappingURL=resolve-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-module.d.ts","sourceRoot":"","sources":["../../../src/node/core/resolve-module.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,KAAG,MAI3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAOrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAoH5D,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,YAAY,CAuB9E,CAAC;AAEF,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,YAAY,CA0B/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,YAAY,OAAO,YAAY,wBAQ/E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AASrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAoI5D,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,YAAY,CAuB9E,CAAC;AAEF,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,YAAY,CA0B/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,YAAY,OAAO,YAAY,wBAQ/E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/config.ts"],"names":[],"mappings":"AASA,OAAO,EACL,aAAa,EAId,MAAM,SAAS,CAAC;AAIjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA4G5D,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAgDhF,CAAC;AAEF,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAwC/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,aAAa,OAAO,YAAY,2BAoBhF,CAAC;AAYF,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/config.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,aAAa,EAId,MAAM,SAAS,CAAC;AAIjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA8G5D,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAqDhF,CAAC;AAEF,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAwC/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,aAAa,OAAO,YAAY,2BAoBhF,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "5.37.1";
3
+ var version = "5.38.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.js.map
@@ -1,4 +1,4 @@
1
- var version = "5.37.1";
1
+ var version = "5.38.1";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.mjs.map
@@ -28,8 +28,7 @@ const adminCreateSchema = utils.yup.object().shape({
28
28
  * It's not an observable, in reality this is
29
29
  * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`
30
30
  * but then the logic of the validate function needs to change.
31
- */ // eslint-disable-next-line rxjs/finnish
32
- const promptQuestions = [
31
+ */ const promptQuestions = [
33
32
  {
34
33
  type: 'input',
35
34
  name: 'email',
@@ -1 +1 @@
1
- {"version":3,"file":"create-user.js","sources":["../../../../../src/cli/commands/admin/create-user.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport { runAction } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n firstname?: string;\n lastname?: string;\n}\n\nconst emailValidator = yup.string().email('Invalid email address').lowercase();\n\nconst passwordValidator = yup\n .string()\n .min(8, 'Password must be at least 8 characters long')\n .test('lowercase', 'Password must contain at least one lowercase character', (value) => {\n if (!value) return true;\n return /[a-z]/.test(value);\n })\n .test('uppercase', 'Password must contain at least one uppercase character', (value) => {\n if (!value) return true;\n return /[A-Z]/.test(value);\n })\n .test('number', 'Password must contain at least one number', (value) => {\n if (!value) return true;\n return /\\d/.test(value);\n });\n\nconst adminCreateSchema = yup.object().shape({\n email: emailValidator,\n password: passwordValidator,\n firstname: yup.string().trim().required('First name is required'),\n lastname: yup.string(),\n});\n\ninterface Answers {\n email: string;\n password: string;\n firstname: string;\n lastname: string;\n confirm: boolean;\n}\n\n/**\n * It's not an observable, in reality this is\n * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`\n * but then the logic of the validate function needs to change.\n */\n// eslint-disable-next-line rxjs/finnish\nconst promptQuestions: inquirer.QuestionCollection<Answers> = [\n {\n type: 'input',\n name: 'email',\n message: 'Admin email?',\n async validate(value: string) {\n const validEmail = await emailValidator.validate(value);\n return validEmail === value || validEmail;\n },\n },\n {\n type: 'password',\n name: 'password',\n message: 'Admin password?',\n async validate(value: string) {\n const validPassword = await passwordValidator.validate(value);\n return validPassword === value || validPassword;\n },\n },\n { type: 'input', name: 'firstname', message: 'First name?' },\n { type: 'input', name: 'lastname', message: 'Last name?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do you really want to create a new admin?',\n },\n];\n\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const user = await app.admin!.services.user.exists({ email });\n\n if (user) {\n console.error(`User with email \"${email}\" already exists`);\n process.exit(1);\n }\n\n const superAdminRole = await app.admin!.services.role.getSuperAdmin();\n\n await app.admin!.services.user.create({\n email,\n firstname,\n lastname,\n isActive: true,\n roles: [superAdminRole.id],\n ...(password && { password, registrationToken: null }),\n });\n\n console.log(`Successfully created new admin`);\n process.exit(0);\n}\n\n/**\n * Create new admin user\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n let { email, password, firstname, lastname } = cmdOptions;\n\n if (\n _.isEmpty(email) &&\n _.isEmpty(password) &&\n _.isEmpty(firstname) &&\n _.isEmpty(lastname) &&\n process.stdin.isTTY\n ) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n ({ email, password, firstname, lastname } = inquiry);\n }\n\n try {\n await adminCreateSchema.validate({ email, password, firstname, lastname });\n } catch (err) {\n if (err instanceof yup.ValidationError) {\n console.error(err.errors[0]);\n }\n\n process.exit(1);\n }\n\n return createAdmin({ email, password, firstname, lastname });\n};\n\n/**\n * `$ strapi admin:create-user`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:create-user')\n .alias('admin:create')\n .description('Create a new admin')\n .option('-e, --email <email>', 'Email of the new admin')\n .option('-p, --password <password>', 'Password of the new admin')\n .option('-f, --firstname <first name>', 'First name of the new admin')\n .option('-l, --lastname <last name>', 'Last name of the new admin')\n .action(runAction('admin:create-user', action));\n};\n\nexport { action, command };\n"],"names":["emailValidator","yup","string","email","lowercase","passwordValidator","min","test","value","adminCreateSchema","object","shape","password","firstname","trim","required","lastname","promptQuestions","type","name","message","validate","validEmail","validPassword","createAdmin","appContext","compileStrapi","app","createStrapi","load","user","admin","services","exists","console","error","process","exit","superAdminRole","role","getSuperAdmin","create","isActive","roles","id","registrationToken","log","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","err","ValidationError","errors","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;;AAgBA,MAAMA,iBAAiBC,SAAIC,CAAAA,MAAM,GAAGC,KAAK,CAAC,yBAAyBC,SAAS,EAAA;AAE5E,MAAMC,iBAAoBJ,GAAAA,SAAAA,CACvBC,MAAM,EAAA,CACNI,GAAG,CAAC,CAAG,EAAA,6CAAA,CAAA,CACPC,IAAI,CAAC,WAAa,EAAA,wDAAA,EAA0D,CAACC,KAAAA,GAAAA;IAC5E,IAAI,CAACA,OAAO,OAAO,IAAA;IACnB,OAAO,OAAA,CAAQD,IAAI,CAACC,KAAAA,CAAAA;AACtB,CAAA,CAAA,CACCD,IAAI,CAAC,WAAa,EAAA,wDAAA,EAA0D,CAACC,KAAAA,GAAAA;IAC5E,IAAI,CAACA,OAAO,OAAO,IAAA;IACnB,OAAO,OAAA,CAAQD,IAAI,CAACC,KAAAA,CAAAA;AACtB,CAAA,CAAA,CACCD,IAAI,CAAC,QAAU,EAAA,2CAAA,EAA6C,CAACC,KAAAA,GAAAA;IAC5D,IAAI,CAACA,OAAO,OAAO,IAAA;IACnB,OAAO,IAAA,CAAKD,IAAI,CAACC,KAAAA,CAAAA;AACnB,CAAA,CAAA;AAEF,MAAMC,iBAAoBR,GAAAA,SAAAA,CAAIS,MAAM,EAAA,CAAGC,KAAK,CAAC;IAC3CR,KAAOH,EAAAA,cAAAA;IACPY,QAAUP,EAAAA,iBAAAA;AACVQ,IAAAA,SAAAA,EAAWZ,UAAIC,MAAM,EAAA,CAAGY,IAAI,EAAA,CAAGC,QAAQ,CAAC,wBAAA,CAAA;AACxCC,IAAAA,QAAAA,EAAUf,UAAIC,MAAM;AACtB,CAAA,CAAA;AAUA;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;AACpBpB,YAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;QAEC,CAAA,EAAElC,KAAK,EAAES,QAAQ,EAAEC,SAAS,EAAEG,QAAQ,EAAE,GAAGqC,OAAM;AACpD;IAEA,IAAI;QACF,MAAM5C,iBAAAA,CAAkBY,QAAQ,CAAC;AAAElB,YAAAA,KAAAA;AAAOS,YAAAA,QAAAA;AAAUC,YAAAA,SAAAA;AAAWG,YAAAA;AAAS,SAAA,CAAA;AAC1E,KAAA,CAAE,OAAOyC,GAAK,EAAA;QACZ,IAAIA,GAAAA,YAAexD,SAAIyD,CAAAA,eAAe,EAAE;AACtCxB,YAAAA,OAAAA,CAAQC,KAAK,CAACsB,GAAIE,CAAAA,MAAM,CAAC,CAAE,CAAA,CAAA;AAC7B;AAEAvB,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA,IAAA,OAAOb,WAAY,CAAA;AAAErB,QAAAA,KAAAA;AAAOS,QAAAA,QAAAA;AAAUC,QAAAA,SAAAA;AAAWG,QAAAA;AAAS,KAAA,CAAA;AAC5D;AAEA;;AAEC,UACK4C,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,mBAClBC,CAAAA,CAAAA,KAAK,CAAC,cAAA,CAAA,CACNC,WAAW,CAAC,oBACZC,CAAAA,CAAAA,MAAM,CAAC,qBAAA,EAAuB,wBAC9BA,CAAAA,CAAAA,MAAM,CAAC,2BAAA,EAA6B,2BACpCA,CAAAA,CAAAA,MAAM,CAAC,8BAAA,EAAgC,6BACvCA,CAAAA,CAAAA,MAAM,CAAC,4BAAA,EAA8B,4BACrCjB,CAAAA,CAAAA,MAAM,CAACkB,iBAAAA,CAAU,mBAAqBlB,EAAAA,MAAAA,CAAAA,CAAAA;AAC3C;;;;;"}
1
+ {"version":3,"file":"create-user.js","sources":["../../../../../src/cli/commands/admin/create-user.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport { runAction } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n firstname?: string;\n lastname?: string;\n}\n\nconst emailValidator = yup.string().email('Invalid email address').lowercase();\n\nconst passwordValidator = yup\n .string()\n .min(8, 'Password must be at least 8 characters long')\n .test('lowercase', 'Password must contain at least one lowercase character', (value) => {\n if (!value) return true;\n return /[a-z]/.test(value);\n })\n .test('uppercase', 'Password must contain at least one uppercase character', (value) => {\n if (!value) return true;\n return /[A-Z]/.test(value);\n })\n .test('number', 'Password must contain at least one number', (value) => {\n if (!value) return true;\n return /\\d/.test(value);\n });\n\nconst adminCreateSchema = yup.object().shape({\n email: emailValidator,\n password: passwordValidator,\n firstname: yup.string().trim().required('First name is required'),\n lastname: yup.string(),\n});\n\ninterface Answers {\n email: string;\n password: string;\n firstname: string;\n lastname: string;\n confirm: boolean;\n}\n\n/**\n * It's not an observable, in reality this is\n * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`\n * but then the logic of the validate function needs to change.\n */\nconst promptQuestions: inquirer.QuestionCollection<Answers> = [\n {\n type: 'input',\n name: 'email',\n message: 'Admin email?',\n async validate(value: string) {\n const validEmail = await emailValidator.validate(value);\n return validEmail === value || validEmail;\n },\n },\n {\n type: 'password',\n name: 'password',\n message: 'Admin password?',\n async validate(value: string) {\n const validPassword = await passwordValidator.validate(value);\n return validPassword === value || validPassword;\n },\n },\n { type: 'input', name: 'firstname', message: 'First name?' },\n { type: 'input', name: 'lastname', message: 'Last name?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do you really want to create a new admin?',\n },\n];\n\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const user = await app.admin!.services.user.exists({ email });\n\n if (user) {\n console.error(`User with email \"${email}\" already exists`);\n process.exit(1);\n }\n\n const superAdminRole = await app.admin!.services.role.getSuperAdmin();\n\n await app.admin!.services.user.create({\n email,\n firstname,\n lastname,\n isActive: true,\n roles: [superAdminRole.id],\n ...(password && { password, registrationToken: null }),\n });\n\n console.log(`Successfully created new admin`);\n process.exit(0);\n}\n\n/**\n * Create new admin user\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n let { email, password, firstname, lastname } = cmdOptions;\n\n if (\n _.isEmpty(email) &&\n _.isEmpty(password) &&\n _.isEmpty(firstname) &&\n _.isEmpty(lastname) &&\n process.stdin.isTTY\n ) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n ({ email, password, firstname, lastname } = inquiry);\n }\n\n try {\n await adminCreateSchema.validate({ email, password, firstname, lastname });\n } catch (err) {\n if (err instanceof yup.ValidationError) {\n console.error(err.errors[0]);\n }\n\n process.exit(1);\n }\n\n return createAdmin({ email, password, firstname, lastname });\n};\n\n/**\n * `$ strapi admin:create-user`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:create-user')\n .alias('admin:create')\n .description('Create a new admin')\n .option('-e, --email <email>', 'Email of the new admin')\n .option('-p, --password <password>', 'Password of the new admin')\n .option('-f, --firstname <first name>', 'First name of the new admin')\n .option('-l, --lastname <last name>', 'Last name of the new admin')\n .action(runAction('admin:create-user', action));\n};\n\nexport { action, command };\n"],"names":["emailValidator","yup","string","email","lowercase","passwordValidator","min","test","value","adminCreateSchema","object","shape","password","firstname","trim","required","lastname","promptQuestions","type","name","message","validate","validEmail","validPassword","createAdmin","appContext","compileStrapi","app","createStrapi","load","user","admin","services","exists","console","error","process","exit","superAdminRole","role","getSuperAdmin","create","isActive","roles","id","registrationToken","log","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","err","ValidationError","errors","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;;AAgBA,MAAMA,iBAAiBC,SAAAA,CAAIC,MAAM,GAA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,YAAAA,KAAAA;AAAOS,YAAAA,QAAAA;AAAUC,YAAAA,SAAAA;AAAWG,YAAAA;AAAS,SAAA,CAAA;AAC1E,IAAA,CAAA,CAAE,OAAOyC,GAAAA,EAAK;QACZ,IAAIA,GAAAA,YAAexD,SAAAA,CAAIyD,eAAe,EAAE;AACtCxB,YAAAA,OAAAA,CAAQC,KAAK,CAACsB,GAAAA,CAAIE,MAAM,CAAC,CAAA,CAAE,CAAA;AAC7B,QAAA;AAEAvB,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;AAEA,IAAA,OAAOb,WAAAA,CAAY;AAAErB,QAAAA,KAAAA;AAAOS,QAAAA,QAAAA;AAAUC,QAAAA,SAAAA;AAAWG,QAAAA;AAAS,KAAA,CAAA;AAC5D;AAEA;;AAEC,UACK4C,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,mBAAA,CAAA,CAClBC,KAAK,CAAC,cAAA,CAAA,CACNC,WAAW,CAAC,oBAAA,CAAA,CACZC,MAAM,CAAC,qBAAA,EAAuB,wBAAA,CAAA,CAC9BA,MAAM,CAAC,2BAAA,EAA6B,2BAAA,CAAA,CACpCA,MAAM,CAAC,8BAAA,EAAgC,6BAAA,CAAA,CACvCA,MAAM,CAAC,4BAAA,EAA8B,4BAAA,CAAA,CACrCjB,MAAM,CAACkB,iBAAAA,CAAU,mBAAA,EAAqBlB,MAAAA,CAAAA,CAAAA;AAC3C;;;;;"}
@@ -26,8 +26,7 @@ const adminCreateSchema = yup.object().shape({
26
26
  * It's not an observable, in reality this is
27
27
  * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`
28
28
  * but then the logic of the validate function needs to change.
29
- */ // eslint-disable-next-line rxjs/finnish
30
- const promptQuestions = [
29
+ */ const promptQuestions = [
31
30
  {
32
31
  type: 'input',
33
32
  name: 'email',
@@ -1 +1 @@
1
- {"version":3,"file":"create-user.mjs","sources":["../../../../../src/cli/commands/admin/create-user.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport { runAction } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n firstname?: string;\n lastname?: string;\n}\n\nconst emailValidator = yup.string().email('Invalid email address').lowercase();\n\nconst passwordValidator = yup\n .string()\n .min(8, 'Password must be at least 8 characters long')\n .test('lowercase', 'Password must contain at least one lowercase character', (value) => {\n if (!value) return true;\n return /[a-z]/.test(value);\n })\n .test('uppercase', 'Password must contain at least one uppercase character', (value) => {\n if (!value) return true;\n return /[A-Z]/.test(value);\n })\n .test('number', 'Password must contain at least one number', (value) => {\n if (!value) return true;\n return /\\d/.test(value);\n });\n\nconst adminCreateSchema = yup.object().shape({\n email: emailValidator,\n password: passwordValidator,\n firstname: yup.string().trim().required('First name is required'),\n lastname: yup.string(),\n});\n\ninterface Answers {\n email: string;\n password: string;\n firstname: string;\n lastname: string;\n confirm: boolean;\n}\n\n/**\n * It's not an observable, in reality this is\n * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`\n * but then the logic of the validate function needs to change.\n */\n// eslint-disable-next-line rxjs/finnish\nconst promptQuestions: inquirer.QuestionCollection<Answers> = [\n {\n type: 'input',\n name: 'email',\n message: 'Admin email?',\n async validate(value: string) {\n const validEmail = await emailValidator.validate(value);\n return validEmail === value || validEmail;\n },\n },\n {\n type: 'password',\n name: 'password',\n message: 'Admin password?',\n async validate(value: string) {\n const validPassword = await passwordValidator.validate(value);\n return validPassword === value || validPassword;\n },\n },\n { type: 'input', name: 'firstname', message: 'First name?' },\n { type: 'input', name: 'lastname', message: 'Last name?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do you really want to create a new admin?',\n },\n];\n\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const user = await app.admin!.services.user.exists({ email });\n\n if (user) {\n console.error(`User with email \"${email}\" already exists`);\n process.exit(1);\n }\n\n const superAdminRole = await app.admin!.services.role.getSuperAdmin();\n\n await app.admin!.services.user.create({\n email,\n firstname,\n lastname,\n isActive: true,\n roles: [superAdminRole.id],\n ...(password && { password, registrationToken: null }),\n });\n\n console.log(`Successfully created new admin`);\n process.exit(0);\n}\n\n/**\n * Create new admin user\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n let { email, password, firstname, lastname } = cmdOptions;\n\n if (\n _.isEmpty(email) &&\n _.isEmpty(password) &&\n _.isEmpty(firstname) &&\n _.isEmpty(lastname) &&\n process.stdin.isTTY\n ) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n ({ email, password, firstname, lastname } = inquiry);\n }\n\n try {\n await adminCreateSchema.validate({ email, password, firstname, lastname });\n } catch (err) {\n if (err instanceof yup.ValidationError) {\n console.error(err.errors[0]);\n }\n\n process.exit(1);\n }\n\n return createAdmin({ email, password, firstname, lastname });\n};\n\n/**\n * `$ strapi admin:create-user`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:create-user')\n .alias('admin:create')\n .description('Create a new admin')\n .option('-e, --email <email>', 'Email of the new admin')\n .option('-p, --password <password>', 'Password of the new admin')\n .option('-f, --firstname <first name>', 'First name of the new admin')\n .option('-l, --lastname <last name>', 'Last name of the new admin')\n .action(runAction('admin:create-user', action));\n};\n\nexport { action, command };\n"],"names":["emailValidator","yup","string","email","lowercase","passwordValidator","min","test","value","adminCreateSchema","object","shape","password","firstname","trim","required","lastname","promptQuestions","type","name","message","validate","validEmail","validPassword","createAdmin","appContext","compileStrapi","app","createStrapi","load","user","admin","services","exists","console","error","process","exit","superAdminRole","role","getSuperAdmin","create","isActive","roles","id","registrationToken","log","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","err","ValidationError","errors","command","createCommand","alias","description","option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C;AAAElB,YAAAA,KAAAA;AAAOS,YAAAA,QAAAA;AAAUC,YAAAA,SAAAA;AAAWG,YAAAA;AAAS,SAAA,CAAA;AAC1E,KAAA,CAAE,OAAOyC,GAAK,EAAA;QACZ,IAAIA,GAAAA,YAAexD,GAAIyD,CAAAA,eAAe,EAAE;AACtCxB,YAAAA,OAAAA,CAAQC,KAAK,CAACsB,GAAIE,CAAAA,MAAM,CAAC,CAAE,CAAA,CAAA;AAC7B;AAEAvB,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA,IAAA,OAAOb,WAAY,CAAA;AAAErB,QAAAA,KAAAA;AAAOS,QAAAA,QAAAA;AAAUC,QAAAA,SAAAA;AAAWG,QAAAA;AAAS,KAAA,CAAA;AAC5D;AAEA;;AAEC,UACK4C,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,mBAClBC,CAAAA,CAAAA,KAAK,CAAC,cAAA,CAAA,CACNC,WAAW,CAAC,oBACZC,CAAAA,CAAAA,MAAM,CAAC,qBAAA,EAAuB,wBAC9BA,CAAAA,CAAAA,MAAM,CAAC,2BAAA,EAA6B,2BACpCA,CAAAA,CAAAA,MAAM,CAAC,8BAAA,EAAgC,6BACvCA,CAAAA,CAAAA,MAAM,CAAC,4BAAA,EAA8B,4BACrCjB,CAAAA,CAAAA,MAAM,CAACkB,SAAAA,CAAU,mBAAqBlB,EAAAA,MAAAA,CAAAA,CAAAA;AAC3C;;;;"}
1
+ {"version":3,"file":"create-user.mjs","sources":["../../../../../src/cli/commands/admin/create-user.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport { runAction } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n firstname?: string;\n lastname?: string;\n}\n\nconst emailValidator = yup.string().email('Invalid email address').lowercase();\n\nconst passwordValidator = yup\n .string()\n .min(8, 'Password must be at least 8 characters long')\n .test('lowercase', 'Password must contain at least one lowercase character', (value) => {\n if (!value) return true;\n return /[a-z]/.test(value);\n })\n .test('uppercase', 'Password must contain at least one uppercase character', (value) => {\n if (!value) return true;\n return /[A-Z]/.test(value);\n })\n .test('number', 'Password must contain at least one number', (value) => {\n if (!value) return true;\n return /\\d/.test(value);\n });\n\nconst adminCreateSchema = yup.object().shape({\n email: emailValidator,\n password: passwordValidator,\n firstname: yup.string().trim().required('First name is required'),\n lastname: yup.string(),\n});\n\ninterface Answers {\n email: string;\n password: string;\n firstname: string;\n lastname: string;\n confirm: boolean;\n}\n\n/**\n * It's not an observable, in reality this is\n * `ReadOnlyArray<inquirer.DistinctQuestion<Answers>>`\n * but then the logic of the validate function needs to change.\n */\nconst promptQuestions: inquirer.QuestionCollection<Answers> = [\n {\n type: 'input',\n name: 'email',\n message: 'Admin email?',\n async validate(value: string) {\n const validEmail = await emailValidator.validate(value);\n return validEmail === value || validEmail;\n },\n },\n {\n type: 'password',\n name: 'password',\n message: 'Admin password?',\n async validate(value: string) {\n const validPassword = await passwordValidator.validate(value);\n return validPassword === value || validPassword;\n },\n },\n { type: 'input', name: 'firstname', message: 'First name?' },\n { type: 'input', name: 'lastname', message: 'Last name?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do you really want to create a new admin?',\n },\n];\n\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const user = await app.admin!.services.user.exists({ email });\n\n if (user) {\n console.error(`User with email \"${email}\" already exists`);\n process.exit(1);\n }\n\n const superAdminRole = await app.admin!.services.role.getSuperAdmin();\n\n await app.admin!.services.user.create({\n email,\n firstname,\n lastname,\n isActive: true,\n roles: [superAdminRole.id],\n ...(password && { password, registrationToken: null }),\n });\n\n console.log(`Successfully created new admin`);\n process.exit(0);\n}\n\n/**\n * Create new admin user\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n let { email, password, firstname, lastname } = cmdOptions;\n\n if (\n _.isEmpty(email) &&\n _.isEmpty(password) &&\n _.isEmpty(firstname) &&\n _.isEmpty(lastname) &&\n process.stdin.isTTY\n ) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n ({ email, password, firstname, lastname } = inquiry);\n }\n\n try {\n await adminCreateSchema.validate({ email, password, firstname, lastname });\n } catch (err) {\n if (err instanceof yup.ValidationError) {\n console.error(err.errors[0]);\n }\n\n process.exit(1);\n }\n\n return createAdmin({ email, password, firstname, lastname });\n};\n\n/**\n * `$ strapi admin:create-user`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:create-user')\n .alias('admin:create')\n .description('Create a new admin')\n .option('-e, --email <email>', 'Email of the new admin')\n .option('-p, --password <password>', 'Password of the new admin')\n .option('-f, --firstname <first name>', 'First name of the new admin')\n .option('-l, --lastname <last name>', 'Last name of the new admin')\n .action(runAction('admin:create-user', action));\n};\n\nexport { action, command };\n"],"names":["emailValidator","yup","string","email","lowercase","passwordValidator","min","test","value","adminCreateSchema","object","shape","password","firstname","trim","required","lastname","promptQuestions","type","name","message","validate","validEmail","validPassword","createAdmin","appContext","compileStrapi","app","createStrapi","load","user","admin","services","exists","console","error","process","exit","superAdminRole","role","getSuperAdmin","create","isActive","roles","id","registrationToken","log","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","err","ValidationError","errors","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;AAgBA,MAAMA,iBAAiBC,GAAAA,CAAIC,MAAM,GAAGC,KAAK,CAAC,yBAAyBC,SAAS,EAAA;AAE5E,MAAMC,iBAAAA,GAAoBJ,GAAAA,CACvBC,MAAM,EAAA,CACNI,GAAG,CAAC,CAAA,EAAG,6CAAA,CAAA,CACPC,IAAI,CAAC,WAAA,EAAa,wDAAA,EAA0D,CAACC,KAAAA,GAAAA;IAC5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AAA,CAAQC,KAAK,CAACsB,GAAAA,CAAIE,MAAM,CAAC,CAAA,CAAE,CAAA;AAC7B,QAAA;AAEAvB,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;AAEA,IAAA,OAAOb,WAAAA,CAAY;AAAErB,QAAAA,KAAAA;AAAOS,QAAAA,QAAAA;AAAUC,QAAAA,SAAAA;AAAWG,QAAAA;AAAS,KAAA,CAAA;AAC5D;AAEA;;AAEC,UACK4C,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,mBAAA,CAAA,CAClBC,KAAK,CAAC,cAAA,CAAA,CACNC,WAAW,CAAC,oBAAA,CAAA,CACZC,MAAM,CAAC,qBAAA,EAAuB,wBAAA,CAAA,CAC9BA,MAAM,CAAC,2BAAA,EAA6B,2BAAA,CAAA,CACpCA,MAAM,CAAC,8BAAA,EAAgC,6BAAA,CAAA,CACvCA,MAAM,CAAC,4BAAA,EAA8B,4BAAA,CAAA,CACrCjB,MAAM,CAACkB,SAAAA,CAAU,mBAAA,EAAqBlB,MAAAA,CAAAA,CAAAA;AAC3C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"reset-user-password.js","sources":["../../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["promptQuestions","type","name","message","changePassword","email","password","appContext","compileStrapi","app","createStrapi","load","admin","services","user","resetPasswordByEmail","console","log","process","exit","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","error","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;AAmBA,MAAMA,eAAqE,GAAA;AACzE,IAAA;QAAEC,IAAM,EAAA,OAAA;QAASC,IAAM,EAAA,OAAA;QAASC,OAAS,EAAA;AAAc,KAAA;AACvD,IAAA;QAAEF,IAAM,EAAA,UAAA;QAAYC,IAAM,EAAA,UAAA;QAAYC,OAAS,EAAA;AAAgB,KAAA;AAC/D,IAAA;QACEF,IAAM,EAAA,SAAA;QACNC,IAAM,EAAA,SAAA;QACNC,OAAS,EAAA;AACX;AACD,CAAA;AAED,eAAeC,cAAe,CAAA,EAAEC,KAAK,EAAEC,QAAQ,EAAc,EAAA;AAC3D,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GA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AA,KAAK,CAAC,sBACNC,CAAAA,CAAAA,WAAW,CAAC,gCACZC,CAAAA,CAAAA,MAAM,CAAC,qBAAuB,EAAA,gBAAA,CAAA,CAC9BA,MAAM,CAAC,2BAAA,EAA6B,6BACpCf,MAAM,CAACgB,kBAAU,2BAA6BhB,EAAAA,MAAAA,CAAAA,CAAAA;AACnD;;;;;"}
1
+ {"version":3,"file":"reset-user-password.js","sources":["../../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["promptQuestions","type","name","message","changePassword","email","password","appContext","compileStrapi","app","createStrapi","load","admin","services","user","resetPasswordByEmail","console","log","process","exit","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","error","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;AAmBA,MAAMA,eAAAA,GAAqE;AACzE,IAAA;QAAEC,IAAAA,EAAM,OAAA;QAASC,IAAAA,EAAM,OAAA;QAASC,OAAAA,EAAS;AAAc,KAAA;AACvD,IAAA;QAAEF,IAAAA,EAAM,UAAA;QAAYC,IAAAA,EAAM,UAAA;QAAYC,OAAAA,EAAS;AAAgB,KAAA;AAC/D,IAAA;QACEF,IAAAA,EAAM,SAAA;QACNC,IAAAA,EAAM,SAAA;QACNC,OAAAA,EAAS;AACX;AACD,CAAA;AAED,eAAeC,cAAAA,CAAe,EAAEC,KAAK,EAAEC,QAAQ,EAAc,EAAA;AAC3D,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAAA,GAAM,MAAMC,iBAAAA,CAAaH,UAAAA,CAAAA,CAAYI,IAAI,EAAA;IAE/C,MAAMF,GAAAA,CAAIG,KAAK,CAAEC,QAAQ,CAACC,IAAI,CAACC,oBAAoB,CAACV,KAAAA,EAAOC,QAAAA,CAAAA;AAE3DU,IAAAA,OAAAA,CAAQC,GAAG,CAAC,CAAC,kCAAkC,CAAC,CAAA;AAChDC,IAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA;;AAEC,IACD,MAAMC,MAAAA,GAAS,OAAOC,UAAAA,GAAyB,EAAE,GAAA;AAC/C,IAAA,MAAM,EAAEhB,KAAK,EAAEC,QAAQ,EAAE,GAAGe,UAAAA;AAE5B,IAAA,IAAIC,CAAAA,CAAEC,OAAO,CAAClB,KAAAA,CAAAA,IAAUiB,CAAAA,CAAEC,OAAO,CAACjB,QAAAA,CAAAA,IAAaY,OAAAA,CAAQM,KAAK,CAACC,KAAK,EAAE;AAClE,QAAA,MAAMC,OAAAA,GAAU,MAAMC,QAAAA,CAASC,MAAM,CAAC5B,eAAAA,CAAAA;QAEtC,IAAI,CAAC0B,OAAAA,CAAQG,OAAO,EAAE;AACpBX,YAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,QAAA;AAEA,QAAA,OAAOf,cAAAA,CAAesB,OAAAA,CAAAA;AACxB,IAAA;AAEA,IAAA,IAAIJ,EAAEC,OAAO,CAAClB,UAAUiB,CAAAA,CAAEC,OAAO,CAACjB,QAAAA,CAAAA,EAAW;AAC3CU,QAAAA,OAAAA,CAAQc,KAAK,CAAC,gDAAA,CAAA;AACdZ,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;AAEA,IAAA,OAAOf,cAAAA,CAAe;AAAEC,QAAAA,KAAAA;AAAOC,QAAAA;AAAS,KAAA,CAAA;AAC1C;AAEA;;AAEC,UACKyB,OAAAA,GAAyB,IAAA;AAC7B,IAAA,OAAOC,wBAAc,2BAAA,CAAA,CAClBC,KAAK,CAAC,sBAAA,CAAA,CACNC,WAAW,CAAC,gCAAA,CAAA,CACZC,MAAM,CAAC,qBAAA,EAAuB,gBAAA,CAAA,CAC9BA,MAAM,CAAC,2BAAA,EAA6B,6BACpCf,MAAM,CAACgB,kBAAU,2BAAA,EAA6BhB,MAAAA,CAAAA,CAAAA;AACnD;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"reset-user-password.mjs","sources":["../../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["promptQuestions","type","name","message","changePassword","email","password","appContext","compileStrapi","app","createStrapi","load","admin","services","user","resetPasswordByEmail","console","log","process","exit","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","error","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;AAmBA,MAAMA,eAAqE,GAAA;AACzE,IAAA;QAAEC,IAAM,EAAA,OAAA;QAASC,IAAM,EAAA,OAAA;QAASC,OAAS,EAAA;AAAc,KAAA;AACvD,IAAA;QAAEF,IAAM,EAAA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AAC3CU,QAAAA,OAAAA,CAAQc,KAAK,CAAC,gDAAA,CAAA;AACdZ,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA,IAAA,OAAOf,cAAe,CAAA;AAAEC,QAAAA,KAAAA;AAAOC,QAAAA;AAAS,KAAA,CAAA;AAC1C;AAEA;;AAEC,UACKyB,OAAyB,GAAA,IAAA;AAC7B,IAAA,OAAOC,cAAc,2BAClBC,CAAAA,CAAAA,KAAK,CAAC,sBACNC,CAAAA,CAAAA,WAAW,CAAC,gCACZC,CAAAA,CAAAA,MAAM,CAAC,qBAAuB,EAAA,gBAAA,CAAA,CAC9BA,MAAM,CAAC,2BAAA,EAA6B,6BACpCf,MAAM,CAACgB,UAAU,2BAA6BhB,EAAAA,MAAAA,CAAAA,CAAAA;AACnD;;;;"}
1
+ {"version":3,"file":"reset-user-password.mjs","sources":["../../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["promptQuestions","type","name","message","changePassword","email","password","appContext","compileStrapi","app","createStrapi","load","admin","services","user","resetPasswordByEmail","console","log","process","exit","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","error","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;AAmBA,MAAMA,eAAAA,GAAqE;AACzE,IAAA;QAAEC,IAAAA,EAAM,OAAA;QAASC,IAAAA,EAAM,OAAA;QAASC,OAAAA,EAAS;AAAc,KAAA;AACvD,IAAA;QAAEF,IAAAA,EAAM,UAAA;QAAYC,IAAAA,EAAM,UAAA;QAAYC,OAAAA,EAAS;AAAgB,KAAA;AAC/D,IAAA;QACEF,IAAAA,EAAM,SAAA;QACNC,IAAAA,EAAM,SAAA;QACNC,OAAAA,EAAS;AACX;AACD,CAAA;AAED,eAAeC,cAAAA,CAAe,EAAEC,KAAK,EAAEC,QAAQ,EAAc,EAAA;AAC3D,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAAA,GAAM,MAAMC,YAAAA,CAAaH,UAAAA,CAAAA,CAAYI,IAAI,EAAA;IAE/C,MAAMF,GAAAA,CAAIG,KAAK,CAAEC,QAAQ,CAACC,IAAI,CAACC,oBAAoB,CAACV,KAAAA,EAAOC,QAAAA,CAAAA;AAE3DU,IAA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BAAA,EAA6BhB,MAAAA,CAAAA,CAAAA;AACnD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sources":["../../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["action","options","bundler","logger","warn","nodeBuild","err","handleUnexpectedError","command","ctx","createCommand","option","description"],"mappings":";;;;;;AAQA,MAAMA,SAAS,OAAOC,OAAAA,GAAAA;IACpB,IAAI;QACF,IAAIA,OAAAA,CAAQC,OAAO,KAAK,SAAW,EAAA;YACjCD,OAAQE,CAAAA,MAAM,CAACC,IAAI,CACjB,yFAAA,CAAA;AAEJ;AAEA,QAAA,MAAMC,WAAUJ,CAAAA,OAAAA,CAAAA;AAClB,KAAA,CAAE,OAAOK,GAAK,EAAA;QACZC,4BAAsBD,CAAAA,GAAAA,CAAAA;AACxB;AACF,CAAA;AAEA;;AAEC,IACKE,MAAAA,OAAAA,GAAyB,CAAC,EAAEC,GAAG,EAAE,GAAA;AACrC,IAAA,OAAOC,wBAAc,OAClBC,CAAAA,CAAAA,MAAM,CAAC,qBAAA,EAAuB,oCAAoC,MAClEA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,2CAA2C,KACjEA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,qBAAqB,IACxCA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,sBAAsB,KACzCA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,sBAAsB,KAC5CA,CAAAA,CAAAA,MAAM,CAAC,SAAA,EAAW,yCAAyC,KAC3DC,CAAAA,CAAAA,WAAW,CAAC,4BACZZ,CAAAA,CAAAA,MAAM,CAAC,OAAOC,OAAAA,GAAAA;AACb,QAAA,OAAOD,MAAO,CAAA;AAAE,YAAA,GAAGC,OAAO;AAAE,YAAA,GAAGQ;AAAI,SAAA,CAAA;AACrC,KAAA,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"build.js","sources":["../../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["action","options","bundler","logger","warn","nodeBuild","err","handleUnexpectedError","command","ctx","createCommand","option","description"],"mappings":";;;;;;AAQA,MAAMA,SAAS,OAAOC,OAAAA,GAAAA;IACpB,IAAI;QACF,IAAIA,OAAAA,CAAQC,OAAO,KAAK,SAAA,EAAW;YACjCD,OAAAA,CAAQE,MAAM,CAACC,IAAI,CACjB,yFAAA,CAAA;AAEJ,QAAA;AAEA,QAAA,MAAMC,WAAAA,CAAUJ,OAAAA,CAAAA;AAClB,IAAA,CAAA,CAAE,OAAOK,GAAAA,EAAK;QACZC,4BAAAA,CAAsBD,GAAAA,CAAAA;AACxB,IAAA;AACF,CAAA;AAEA;;AAEC,IACD,MAAME,OAAAA,GAAyB,CAAC,EAAEC,GAAG,EAAE,GAAA;AACrC,IAAA,OAAOC,wBAAc,OAAA,CAAA,CAClBC,MAAM,CAAC,qBAAA,EAAuB,oCAAoC,MAAA,CAAA,CAClEA,MAAM,CAAC,aAAA,EAAe,2CAA2C,KAAA,CAAA,CACjEA,MAAM,CAAC,UAAA,EAAY,qBAAqB,IAAA,CAAA,CACxCA,MAAM,CAAC,UAAA,EAAY,sBAAsB,KAAA,CAAA,CACzCA,MAAM,CAAC,aAAA,EAAe,sBAAsB,KAAA,CAAA,CAC5CA,MAAM,CAAC,SAAA,EAAW,yCAAyC,KAAA,CAAA,CAC3DC,WAAW,CAAC,4BAAA,CAAA,CACZZ,MAAM,CAAC,OAAOC,OAAAA,GAAAA;AACb,QAAA,OAAOD,MAAAA,CAAO;AAAE,YAAA,GAAGC,OAAO;AAAE,YAAA,GAAGQ;AAAI,SAAA,CAAA;AACrC,IAAA,CAAA,CAAA;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"build.mjs","sources":["../../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["action","options","bundler","logger","warn","nodeBuild","err","handleUnexpectedError","command","ctx","createCommand","option","description"],"mappings":";;;;AAQA,MAAMA,SAAS,OAAOC,OAAAA,GAAAA;IACpB,IAAI;QACF,IAAIA,OAAAA,CAAQC,OAAO,KAAK,SAAW,EAAA;YACjCD,OAAQE,CAAAA,MAAM,CAACC,IAAI,CACjB,yFAAA,CAAA;AAEJ;AAEA,QAAA,MAAMC,KAAUJ,CAAAA,OAAAA,CAAAA;AAClB,KAAA,CAAE,OAAOK,GAAK,EAAA;QACZC,qBAAsBD,CAAAA,GAAAA,CAAAA;AACxB;AACF,CAAA;AAEA;;AAEC,IACKE,MAAAA,OAAAA,GAAyB,CAAC,EAAEC,GAAG,EAAE,GAAA;AACrC,IAAA,OAAOC,cAAc,OAClBC,CAAAA,CAAAA,MAAM,CAAC,qBAAA,EAAuB,oCAAoC,MAClEA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,2CAA2C,KACjEA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,qBAAqB,IACxCA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,sBAAsB,KACzCA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,sBAAsB,KAC5CA,CAAAA,CAAAA,MAAM,CAAC,SAAA,EAAW,yCAAyC,KAC3DC,CAAAA,CAAAA,WAAW,CAAC,4BACZZ,CAAAA,CAAAA,MAAM,CAAC,OAAOC,OAAAA,GAAAA;AACb,QAAA,OAAOD,MAAO,CAAA;AAAE,YAAA,GAAGC,OAAO;AAAE,YAAA,GAAGQ;AAAI,SAAA,CAAA;AACrC,KAAA,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"build.mjs","sources":["../../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["action","options","bundler","logger","warn","nodeBuild","err","handleUnexpectedError","command","ctx","createCommand","option","description"],"mappings":";;;;AAQA,MAAMA,SAAS,OAAOC,OAAAA,GAAAA;IACpB,IAAI;QACF,IAAIA,OAAAA,CAAQC,OAAO,KAAK,SAAA,EAAW;YACjCD,OAAAA,CAAQE,MAAM,CAACC,IAAI,CACjB,yFAAA,CAAA;AAEJ,QAAA;AAEA,QAAA,MAAMC,KAAAA,CAAUJ,OAAAA,CAAAA;AAClB,IAAA,CAAA,CAAE,OAAOK,GAAAA,EAAK;QACZC,qBAAAA,CAAsBD,GAAAA,CAAAA;AACxB,IAAA;AACF,CAAA;AAEA;;AAEC,IACD,MAAME,OAAAA,GAAyB,CAAC,EAAEC,GAAG,EAAE,GAAA;AACrC,IAAA,OAAOC,cAAc,OAAA,CAAA,CAClBC,MAAM,CAAC,qBAAA,EAAuB,oCAAoC,MAAA,CAAA,CAClEA,MAAM,CAAC,aAAA,EAAe,2CAA2C,KAAA,CAAA,CACjEA,MAAM,CAAC,UAAA,EAAY,qBAAqB,IAAA,CAAA,CACxCA,MAAM,CAAC,UAAA,EAAY,sBAAsB,KAAA,CAAA,CACzCA,MAAM,CAAC,aAAA,EAAe,sBAAsB,KAAA,CAAA,CAC5CA,MAAM,CAAC,SAAA,EAAW,yCAAyC,KAAA,CAAA,CAC3DC,WAAW,CAAC,4BAAA,CAAA,CACZZ,MAAM,CAAC,OAAOC,OAAAA,GAAAA;AACb,QAAA,OAAOD,MAAAA,CAAO;AAAE,YAAA,GAAGC,OAAO;AAAE,YAAA,GAAGQ;AAAI,SAAA,CAAA;AACrC,IAAA,CAAA,CAAA;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sources":["../../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","Object","keys","components","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAOC,GAAAA,MAAAA,CAAOC,IAAI,CAACL,IAAIM,UAAU,CAAA;IAEvC,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAR,IAAAA,IAAAA,CAAKS,OAAO,CAAC,CAACC,IAASN,GAAAA,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAE5CE,OAAQC,CAAAA,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMjB,IAAIkB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,mBAClBC,WAAW,CAAC,uCACZxB,MAAM,CAACyB,kBAAU,iBAAmBzB,EAAAA,MAAAA,CAAAA,CAAAA;AACzC;;;;;"}
1
+ {"version":3,"file":"list.js","sources":["../../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","Object","keys","components","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;;;AAQA,MAAMA,MAAAA,GAAS,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAAA,GAAM,MAAMC,iBAAAA,CAAaH,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAAA,GAAOC,MAAAA,CAAOC,IAAI,CAACL,IAAIM,UAAU,CAAA;IAEvC,MAAMC,SAAAA,GAAY,IAAIC,QAAAA,CAAS;QAC7BC,IAAAA,EAAM;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAR,IAAAA,IAAAA,CAAKS,OAAO,CAAC,CAACC,IAAAA,GAASN,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAE5CE,OAAAA,CAAQC,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMjB,IAAIkB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,mBAClBC,WAAW,CAAC,uCACZxB,MAAM,CAACyB,kBAAU,iBAAA,EAAmBzB,MAAAA,CAAAA,CAAAA;AACzC;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"list.mjs","sources":["../../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","Object","keys","components","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAOC,GAAAA,MAAAA,CAAOC,IAAI,CAACL,IAAIM,UAAU,CAAA;IAEvC,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAR,IAAAA,IAAAA,CAAKS,OAAO,CAAC,CAACC,IAASN,GAAAA,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAE5CE,OAAQC,CAAAA,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMjB,IAAIkB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,mBAClBC,WAAW,CAAC,uCACZxB,MAAM,CAACyB,UAAU,iBAAmBzB,EAAAA,MAAAA,CAAAA,CAAAA;AACzC;;;;"}
1
+ {"version":3,"file":"list.mjs","sources":["../../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","Object","keys","components","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAAA,GAAS,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAAA,GAAM,MAAMC,YAAAA,CAAaH,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAAA,GAAOC,MAAAA,CAAOC,IAAI,CAACL,IAAIM,UAAU,CAAA;IAEvC,MAAMC,SAAAA,GAAY,IAAIC,QAAAA,CAAS;QAC7BC,IAAAA,EAAM;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAR,IAAAA,IAAAA,CAAKS,OAAO,CAAC,CAACC,IAAAA,GAASN,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAE5CE,OAAAA,CAAQC,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMjB,IAAIkB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,mBAClBC,WAAW,CAAC,uCACZxB,MAAM,CAACyB,UAAU,iBAAA,EAAmBzB,MAAAA,CAAAA,CAAAA;AACzC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"dump.js","sources":["../../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["CHUNK_SIZE","action","file","filePath","pretty","output","fs","createWriteStream","process","stdout","appContext","compileStrapi","app","createStrapi","load","count","query","exportData","pageCount","Math","ceil","page","results","findMany","limit","offset","orderBy","filter","result","key","startsWith","forEach","push","value","type","environment","tag","str","JSON","stringify","undefined","write","end","console","log","length","exit","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;AAyBA,MAAMA,UAAa,GAAA,GAAA;AAEnB;;;IAIA,MAAMC,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,MAAM,EAAc,GAAA;AAC1D,IAAA,MAAMC,SAAiBF,QAAWG,GAAAA,EAAAA,CAAGC,iBAAiB,CAACJ,QAAAA,CAAAA,GAAYK,QAAQC,MAAM;AAEjF,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,QAAQ,MAAMH,GAAAA,CAAII,KAAK,CAAC,sBAAsBD,KAAK,EAAA;AAEzD,IAAA,MAAME,aAA2B,EAAE;AAEnC,IAAA,MAAMC,SAAYC,GAAAA,IAAAA,CAAKC,IAAI,CAACL,KAAQf,GAAAA,UAAAA,CAAAA;AAEpC,IAAA,IAAK,IAAIqB,IAAO,GAAA,CAAA,EAAGA,IAAOH,GAA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AAA,CAAc,sBAClBC,KAAK,CAAC,eACNC,WAAW,CAAC,2CACZC,MAAM,CAAC,qBAAqB,uCAC5BA,CAAAA,CAAAA,MAAM,CAAC,cAAgB,EAAA,yDAAA,EAA2D,OAClFlD,MAAM,CAACmD,kBAAU,oBAAsBnD,EAAAA,MAAAA,CAAAA,CAAAA;AAC5C;;;;;"}
1
+ {"version":3,"file":"dump.js","sources":["../../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["CHUNK_SIZE","action","file","filePath","pretty","output","fs","createWriteStream","process","stdout","appContext","compileStrapi","app","createStrapi","load","count","query","exportData","pageCount","Math","ceil","page","results","findMany","limit","offset","orderBy","filter","result","key","startsWith","forEach","push","value","type","environment","tag","str","JSON","stringify","undefined","write","end","console","log","length","exit","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;AAyBA,MAAMA,UAAAA,GAAa,GAAA;AAEnB;;;IAIA,MAAMC,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,MAAM,EAAc,GAAA;AAC1D,IAAA,MAAMC,SAAiBF,QAAAA,GAAWG,EAAAA,CAAGC,iBAAiB,CAACJ,QAAAA,CAAAA,GAAYK,QAAQC,MAAM;AAEjF,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAAA,GAAM,MAAMC,iBAAAA,CAAaH,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,QAAQ,MAAMH,GAAAA,CAAII,KAAK,CAAC,sBAAsBD,KAAK,EAAA;AAEzD,IAAA,MAAME,aAA2B,EAAE;AAEnC,IAAA,MAAMC,SAAAA,GAAYC,IAAAA,CAAKC,IAAI,CAACL,KAAAA,GAAQf,UAAAA,CAAAA;AAEpC,IAAA,IAAK,IAAIqB,IAAAA,GAAO,CAAA,EAAGA,IAAAA,GAAOH,SAAAA,EAAWG,QAAQ,CAAA,CAAG;AAC9C,QAAA,MAAMC,UAAU,MAAMV,GAAAA,CACnBI,KAAK,CAAC,oBAAA,CAAA,CACNO,QAAQ,CAAC;YAAEC,KAAAA,EAAOxB,UAAAA;AAAYyB,YAAAA,MAAAA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kBAAU,oBAAA,EAAsBnD,MAAAA,CAAAA,CAAAA;AAC5C;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"dump.mjs","sources":["../../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["CHUNK_SIZE","action","file","filePath","pretty","output","fs","createWriteStream","process","stdout","appContext","compileStrapi","app","createStrapi","load","count","query","exportData","pageCount","Math","ceil","page","results","findMany","limit","offset","orderBy","filter","result","key","startsWith","forEach","push","value","type","environment","tag","str","JSON","stringify","undefined","write","end","console","log","length","exit","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;AAyBA,MAAMA,UAAa,GAAA,GAAA;AAEnB;;;IAIA,MAAMC,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,MAAM,EAAc,GAAA;AAC1D,IAAA,MAAMC,SAAiBF,QAAWG,GAAAA,EAAAA,CAAGC,iBAAiB,CAACJ,QAAAA,CAAAA,GAAYK,QAAQC,MAAM;AAEjF,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,QAAQ,MAAMH,GAAAA,CAAII,KAAK,CAAC,sBAAsBD,KAAK,EAAA;AAEzD,IAAA,MAAME,aAA2B,EAAE;AAEnC,IAAA,MAAMC,SAAYC,GAAAA,IAAAA,CAAKC,IAAI,CAACL,KAAQf,GAAAA,UAAAA,CAAAA;AAEpC,IAAA,IAAK,IAAIqB,IAAO,GAAA,CAAA,EAAGA,IAAOH,GAAAA,SAAAA,EAAWG,QAAQ,CAAG,CAAA;AAC9C,QAAA,MAAMC,UAAU,MAAMV,GAAAA,CACnBI,KAAK,CAAC,oBAAA,CAAA,CACNO,QAAQ,CAAC;YAAEC,KAAOxB,EAAAA,UAAAA;AAAYyB,YAAAA,MAAAA,EAAQJ,IAAOrB,GAAAA,UAAAA;YAAY0B,OAAS,EAAA;AAAM,SAAA,CAAA;AAE3EJ,QAAAA,OAAAA,CACGK,MAAM,CAAC,CAACC,MAAAA,GAAWA,MAAOC,CAAAA,GAAG,CAACC,UAAU,CAAC,SAAA,CAAA,CAAA,CACzCC,OAAO,CAAC,CAACH,MAAAA,GAAAA;AACRX,YAAAA,UAAAA,CAAWe,IAAI,CAAC;AACdH,gBAAAA,GAAAA,EAAKD,OAAOC,GAAG;AACfI,gBAAAA,KAAAA,EAAOL,OAAOK,KAAK;AACnBC,gBAAAA,IAAAA,EAAMN,OAAOM,IAAI;AACjBC,gBAAAA,WAAAA,EAAaP,OAAOO,WAAW;AAC/BC,gBAAAA,GAAAA,EAAKR,OAAOQ;AACd,aAAA,CAAA;AACF,SAAA,CAAA;AACJ;AAEA,IAAA,MAAMC,MAAMC,IAAKC,CAAAA,SAAS,CAACtB,UAAY,EAAA,IAAA,EAAMb,SAAS,CAAIoC,GAAAA,SAAAA,CAAAA;AAE1DnC,IAAAA,MAAAA,CAAOoC,KAAK,CAACJ,GAAAA,CAAAA;AACbhC,IAAAA,MAAAA,CAAOoC,KAAK,CAAC,IAAA,CAAA;AACbpC,IAAAA,MAAAA,CAAOqC,GAAG,EAAA;;AAGV,IAAA,IAAIvC,QAAU,EAAA;QACZwC,OAAQC,CAAAA,GAAG,CAAC,CAAC,sBAAsB,EAAE3B,UAAW4B,CAAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;AAChF;AACArC,IAAAA,OAAAA,CAAQsC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,sBAClBC,KAAK,CAAC,eACNC,WAAW,CAAC,2CACZC,MAAM,CAAC,qBAAqB,uCAC5BA,CAAAA,CAAAA,MAAM,CAAC,cAAgB,EAAA,yDAAA,EAA2D,OAClFlD,MAAM,CAACmD,UAAU,oBAAsBnD,EAAAA,MAAAA,CAAAA,CAAAA;AAC5C;;;;"}
1
+ {"version":3,"file":"dump.mjs","sources":["../../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["CHUNK_SIZE","action","file","filePath","pretty","output","fs","createWriteStream","process","stdout","appContext","compileStrapi","app","createStrapi","load","count","query","exportData","pageCount","Math","ceil","page","results","findMany","limit","offset","orderBy","filter","result","key","startsWith","forEach","push","value","type","environment","tag","str","JSON","stringify","undefined","write","end","console","log","length","exit","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;AAyBA,MAAMA,UAAAA,GAAa,GAAA;AAEnB;;;IAIA,MAAMC,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,MAAM,EAAc,GAAA;AAC1D,IAAA,MAAMC,SAAiBF,QAAAA,GAAWG,EAAAA,CAAGC,iBAAiB,CAACJ,QAAAA,CAAAA,GAAYK,QAAQC,MAAM;AAEjF,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAAA,GAAM,MAAMC,YAAAA,CAAaH,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,QAAQ,MAAMH,GAAAA,CAAII,KAAK,CAAC,sBAAsBD,KAAK,EAAA;AAEzD,IAAA,MAAME,aAA2B,EAAE;AAEnC,IAAA,MAAMC,SAAAA,GAAYC,IAAAA,CAAKC,IAAI,CAACL,KAAAA,GAAQf,UAAAA,CAAAA;AAEpC,IAAA,IAAK,IAAIqB,IAAAA,GAAO,CAAA,EAAGA,IAAAA,GAAOH,SAAAA,EAAWG,QAAQ,CAAA,CAAG;AAC9C,QAAA,MAAMC,UAAU,MAAMV,GAAAA,CACnBI,KAAK,CAAC,oBAAA,CAAA,CACNO,QAAQ,CAAC;YAAEC,KAAAA,EAAOxB,UAAAA;AAAYyB,YAAAA,MAAAA,EAAQJ,IAAAA,GAAOrB,UAAAA;YAAY0B,OAAAA,EAAS;AAAM,SAAA,CAAA;AAE3EJ,QAAAA,OAAAA,CACGK,MAAM,CAAC,CAACC,MAAAA,GAAWA,MAAAA,CAAOC,GAAG,CAACC,UAAU,CAAC,SAAA,CAAA,CAAA,CACzCC,OAAO,CAAC,CAACH,MAAAA,GAAAA;AACRX,YAAAA,UAAAA,CAAWe,IAAI,CAAC;AACdH,gBAAAA,GAAAA,EAAKD,OAAOC,GAAG;AACfI,gBAAAA,KAAAA,EAAOL,OAAOK,KAAK;AACnBC,gBAAAA,IAAAA,EAAMN,OAAOM,IAAI;AACjBC,gBAAAA,WAAAA,EAAaP,OAAOO,WAAW;AAC/BC,gBAAAA,GAAAA,EAAKR,OAAOQ;AACd,aAAA,CAAA;AACF,QAAA,CAAA,CAAA;AACJ,IAAA;AAEA,IAAA,MAAMC,MAAMC,IAAAA,CAAKC,SAAS,CAACtB,UAAAA,EAAY,IAAA,EAAMb,SAAS,CAAA,GAAIoC,SAAAA,CAAAA;AAE1DnC,IAAAA,MAAAA,CAAOoC,KAAK,CAACJ,GAAAA,CAAAA;AACbhC,IAAAA,MAAAA,CAAOoC,KAAK,CAAC,IAAA,CAAA;AACbpC,IAAAA,MAAAA,CAAOqC,GAAG,EAAA;;AAGV,IAAA,IAAIvC,QAAAA,EAAU;QACZwC,OAAAA,CAAQC,GAAG,CAAC,CAAC,sBAAsB,EAAE3B,UAAAA,CAAW4B,MAAM,CAAC,sBAAsB,CAAC,CAAA;AAChF,IAAA;AACArC,IAAAA,OAAAA,CAAQsC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,sBAClBC,KAAK,CAAC,eACNC,WAAW,CAAC,2CACZC,MAAM,CAAC,qBAAqB,uCAAA,CAAA,CAC5BA,MAAM,CAAC,cAAA,EAAgB,yDAAA,EAA2D,OAClFlD,MAAM,CAACmD,UAAU,oBAAA,EAAsBnD,MAAAA,CAAAA,CAAAA;AAC5C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"restore.js","sources":["../../../../../src/cli/commands/configuration/restore.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport _ from 'lodash';\nimport { createStrapi, compileStrapi } from '@strapi/core';\nimport type { Database } from '@strapi/database';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ntype Strategy = 'replace' | 'merge' | 'keep';\n\ninterface CmdOptions {\n file?: string;\n strategy?: Strategy;\n}\n\n/**\n * Will restore configurations. It reads from a file or stdin\n */\nconst action = async ({ file: filePath, strategy = 'replace' }: CmdOptions) => {\n const input = filePath ? fs.readFileSync(filePath) : await readStdin();\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n let dataToImport;\n try {\n dataToImport = JSON.parse(_.toString(input));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Invalid input data: ${error.message}. Expected a valid JSON array.`);\n }\n\n throw error;\n }\n\n if (!Array.isArray(dataToImport)) {\n throw new Error(`Invalid input data. Expected a valid JSON array.`);\n }\n\n if (!app.db) {\n throw new Error('Cannot import configuration without a database connection.');\n }\n\n const importer = createImporter(app.db, strategy);\n\n for (const config of dataToImport) {\n await importer.import(config);\n }\n\n console.log(\n `Successfully imported configuration with ${strategy} strategy. Statistics: ${importer.printStatistics()}.`\n );\n\n process.exit(0);\n};\n\nconst readStdin = () => {\n const { stdin } = process;\n let result = '';\n\n if (stdin.isTTY) return Promise.resolve(result);\n\n return new Promise((resolve, reject) => {\n stdin.setEncoding('utf8');\n stdin.on('readable', () => {\n let chunk;\n // eslint-disable-next-line no-cond-assign\n while ((chunk = stdin.read())) {\n result += chunk;\n }\n });\n\n stdin.on('end', () => {\n resolve(result);\n });\n\n stdin.on('error', reject);\n });\n};\n\nconst createImporter = (db: Database, strategy?: Strategy) => {\n switch (strategy) {\n case 'replace':\n return createReplaceImporter(db);\n case 'merge':\n return createMergeImporter(db);\n case 'keep':\n return createKeepImporter(db);\n default:\n throw new Error(`No importer available for strategy \"${strategy}\"`);\n }\n};\n\n/**\n * Replace importer. Will replace the keys that already exist and create the new ones\n */\nconst createReplaceImporter = (db: Database) => {\n const stats = {\n created: 0,\n replaced: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.replaced} replaced`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.replaced += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: conf,\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will merge the keys that already exist with their new value and create the new ones\n */\nconst createMergeImporter = (db: Database) => {\n const stats = {\n created: 0,\n merged: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.merged} merged`;\n },\n\n async import(conf: Record<string, unknown>) {\n const existingConf = await db\n .query('strapi::core-store')\n .findOne({ where: { key: conf.key } });\n\n if (existingConf) {\n stats.merged += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: _.merge(existingConf, conf),\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will keep the keys that already exist without changing them and create the new ones\n */\nconst createKeepImporter = (db: Database) => {\n const stats = {\n created: 0,\n untouched: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.untouched} untouched`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.untouched += 1;\n // if configuration already exists do not overwrite it\n return;\n }\n\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n },\n };\n};\n\n/**\n * `$ strapi configuration:restore`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:restore')\n .alias('config:restore')\n .description('Restore configurations of your application')\n .option('-f, --file <file>', 'Input file, default input is stdin')\n .option('-s, --strategy <strategy>', 'Strategy name, one of: \"replace\", \"merge\", \"keep\"')\n .action(runAction('configuration:restore', action));\n};\n\nexport { action, command };\n"],"names":["action","file","filePath","strategy","input","fs","readFileSync","readStdin","appContext","compileStrapi","app","createStrapi","load","dataToImport","JSON","parse","_","toString","error","Error","message","Array","isArray","db","importer","createImporter","config","import","console","log","printStatistics","process","exit","stdin","result","isTTY","Promise","resolve","reject","setEncoding","on","chunk","read","createReplaceImporter","createMergeImporter","createKeepImporter","stats","created","replaced","conf","matching","query","count","where","key","update","data","create","merged","existingConf","findOne","merge","untouched","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;AAgBA;;IAGA,MAAMA,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,QAAW,GAAA,SAAS,EAAc,GAAA;AACxE,IAAA,MAAMC,QAAQF,QAAWG,GAAAA,EAAAA,CAAGC,YAAY,CAACJ,YAAY,MAAMK,SAAAA,EAAAA;AAE3D,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;IAE/C,IAAIC,YAAAA;IACJ,IAAI;AACFA,QAAAA,YAAAA,GAAeC,IAAKC,CAAAA,KAAK,CAACC,CAAAA,CAAEC,QAAQ,CAACb,KAAAA,CAAAA,CAAAA;AACvC,KAAA,CAAE,OAAOc,KAAO,EAAA;AACd,QAAA,IAAIA,iBAAiBC,KAAO,EAAA;YAC1B,MAAM,IAAIA,MAAM,CAAC,oBAAoB,EAAED,KAAME,CAAAA,OAAO,CAAC,8BAA8B,CAAC,CAAA;AACtF;QAEA,MAAMF,KAAAA;AACR;AAEA,IAAA,IAAI,CAACG,KAAAA,CAAMC,OAAO,CAACT,YAAe,CAAA,EAAA;AAChC,QAAA,MAAM,IAAIM,KAAAA,CAAM,CAAC,gDAAgD,CAAC,CAAA;AACpE;IAEA,IAAI,CAACT,GAAIa,CAAAA,EAAE,EAAE;AACX,QAAA,MAAM,IAAIJ,KAAM,CAAA,4DAAA,CAAA;AAClB;AAEA,IAAA,MAAMK,QAAWC,GAAAA,cAAAA,CAAef,GAAIa,CAAAA,EAAE,EAAEpB,QAAAA,CAAAA;IAExC,KAAK,MAAMuB,UAAUb,YAAc,CAAA;QACjC,MAAMW,QAAAA,CAASG,MAAM,CAACD,MAAAA,CAAAA;AACxB;AAEAE,IAAAA,OAAAA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QAAA,MAAMnC,QAAOsB,IAA6B,EAAA;AACxC,YAAA,MAAMC,WAAW,MAAM3B,EAAAA,CAAG4B,KAAK,CAAC,oBAAA,CAAA,CAAsBC,KAAK,CAAC;gBAAEC,KAAO,EAAA;AAAEC,oBAAAA,GAAAA,EAAKL,KAAKK;AAAI;AAAE,aAAA,CAAA;AACvF,YAAA,IAAIJ,WAAW,CAAG,EAAA;AAChBJ,gBAAAA,KAAAA,CAAMgB,SAAS,IAAI,CAAA;;AAEnB,gBAAA;AACF;AAEAhB,YAAAA,KAAAA,CAAMC,OAAO,IAAI,CAAA;AACjB,YAAA,MAAMxB,EAAG4B,CAAAA,KAAK,CAAC,oBAAA,CAAA,CAAsBM,MAAM,CAAC;gBAAED,IAAMP,EAAAA;AAAK,aAAA,CAAA;AAC3D;AACF,KAAA;AACF,CAAA;AAEA;;AAEC,UACKc,OAAyB,GAAA,IAAA;AAC7B,IAAA,OAAOC,wBAAc,uBAClBC,CAAAA,CAAAA,KAAK,CAAC,gBACNC,CAAAA,CAAAA,WAAW,CAAC,4CACZC,CAAAA,CAAAA,MAAM,CAAC,mBAAqB,EAAA,oCAAA,CAAA,CAC5BA,MAAM,CAAC,2BAAA,EAA6B,qDACpCnE,MAAM,CAACoE,kBAAU,uBAAyBpE,EAAAA,MAAAA,CAAAA,CAAAA;AAC/C;;;;;"}
1
+ {"version":3,"file":"restore.js","sources":["../../../../../src/cli/commands/configuration/restore.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport _ from 'lodash';\nimport { createStrapi, compileStrapi } from '@strapi/core';\nimport type { Database } from '@strapi/database';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ntype Strategy = 'replace' | 'merge' | 'keep';\n\ninterface CmdOptions {\n file?: string;\n strategy?: Strategy;\n}\n\n/**\n * Will restore configurations. It reads from a file or stdin\n */\nconst action = async ({ file: filePath, strategy = 'replace' }: CmdOptions) => {\n const input = filePath ? fs.readFileSync(filePath) : await readStdin();\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n let dataToImport;\n try {\n dataToImport = JSON.parse(_.toString(input));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Invalid input data: ${error.message}. Expected a valid JSON array.`);\n }\n\n throw error;\n }\n\n if (!Array.isArray(dataToImport)) {\n throw new Error(`Invalid input data. Expected a valid JSON array.`);\n }\n\n if (!app.db) {\n throw new Error('Cannot import configuration without a database connection.');\n }\n\n const importer = createImporter(app.db, strategy);\n\n for (const config of dataToImport) {\n await importer.import(config);\n }\n\n console.log(\n `Successfully imported configuration with ${strategy} strategy. Statistics: ${importer.printStatistics()}.`\n );\n\n process.exit(0);\n};\n\nconst readStdin = () => {\n const { stdin } = process;\n let result = '';\n\n if (stdin.isTTY) return Promise.resolve(result);\n\n return new Promise((resolve, reject) => {\n stdin.setEncoding('utf8');\n stdin.on('readable', () => {\n let chunk;\n // eslint-disable-next-line no-cond-assign\n while ((chunk = stdin.read())) {\n result += chunk;\n }\n });\n\n stdin.on('end', () => {\n resolve(result);\n });\n\n stdin.on('error', reject);\n });\n};\n\nconst createImporter = (db: Database, strategy?: Strategy) => {\n switch (strategy) {\n case 'replace':\n return createReplaceImporter(db);\n case 'merge':\n return createMergeImporter(db);\n case 'keep':\n return createKeepImporter(db);\n default:\n throw new Error(`No importer available for strategy \"${strategy}\"`);\n }\n};\n\n/**\n * Replace importer. Will replace the keys that already exist and create the new ones\n */\nconst createReplaceImporter = (db: Database) => {\n const stats = {\n created: 0,\n replaced: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.replaced} replaced`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.replaced += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: conf,\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will merge the keys that already exist with their new value and create the new ones\n */\nconst createMergeImporter = (db: Database) => {\n const stats = {\n created: 0,\n merged: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.merged} merged`;\n },\n\n async import(conf: Record<string, unknown>) {\n const existingConf = await db\n .query('strapi::core-store')\n .findOne({ where: { key: conf.key } });\n\n if (existingConf) {\n stats.merged += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: _.merge(existingConf, conf),\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will keep the keys that already exist without changing them and create the new ones\n */\nconst createKeepImporter = (db: Database) => {\n const stats = {\n created: 0,\n untouched: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.untouched} untouched`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.untouched += 1;\n // if configuration already exists do not overwrite it\n return;\n }\n\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n },\n };\n};\n\n/**\n * `$ strapi configuration:restore`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:restore')\n .alias('config:restore')\n .description('Restore configurations of your application')\n .option('-f, --file <file>', 'Input file, default input is stdin')\n .option('-s, --strategy <strategy>', 'Strategy name, one of: \"replace\", \"merge\", \"keep\"')\n .action(runAction('configuration:restore', action));\n};\n\nexport { action, command };\n"],"names":["action","file","filePath","strategy","input","fs","readFileSync","readStdin","appContext","compileStrapi","app","createStrapi","load","dataToImport","JSON","parse","_","toString","error","Error","message","Array","isArray","db","importer","createImporter","config","import","console","log","printStatistics","process","exit","stdin","result","isTTY","Promise","resolve","reject","setEncoding","on","chunk","read","createReplaceImporter","createMergeImporter","createKeepImporter","stats","created","replaced","conf","matching","query","count","where","key","update","data","create","merged","existingConf","findOne","merge","untouched","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;AAg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