@strapi/strapi 4.26.1 → 4.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs.map +1 -1
- package/dist/admin.js.map +1 -1
- package/dist/admin.mjs.map +1 -1
- package/dist/commands/actions/admin/create-user/action.js.map +1 -1
- package/dist/commands/actions/admin/reset-user-password/action.js.map +1 -1
- package/dist/commands/actions/admin/reset-user-password/command.js.map +1 -1
- package/dist/commands/actions/components/list/action.js.map +1 -1
- package/dist/commands/actions/components/list/command.js.map +1 -1
- package/dist/commands/actions/configuration/dump/action.js.map +1 -1
- package/dist/commands/actions/configuration/dump/command.js.map +1 -1
- package/dist/commands/actions/configuration/restore/action.js +1 -2
- package/dist/commands/actions/configuration/restore/action.js.map +1 -1
- package/dist/commands/actions/configuration/restore/command.js.map +1 -1
- package/dist/commands/actions/console/action.js.map +1 -1
- package/dist/commands/actions/console/command.js.map +1 -1
- package/dist/commands/actions/content-types/list/action.js.map +1 -1
- package/dist/commands/actions/content-types/list/command.js.map +1 -1
- package/dist/commands/actions/controllers/list/action.js.map +1 -1
- package/dist/commands/actions/controllers/list/command.js.map +1 -1
- package/dist/commands/actions/generate/command.js.map +1 -1
- package/dist/commands/actions/hooks/list/action.js.map +1 -1
- package/dist/commands/actions/hooks/list/command.js.map +1 -1
- package/dist/commands/actions/install/action.js.map +1 -1
- package/dist/commands/actions/install/command.js.map +1 -1
- package/dist/commands/actions/middlewares/list/action.js.map +1 -1
- package/dist/commands/actions/middlewares/list/command.js.map +1 -1
- package/dist/commands/actions/new/action.js.map +1 -1
- package/dist/commands/actions/new/command.js.map +1 -1
- package/dist/commands/actions/plugin/build-command/action.js.map +1 -1
- package/dist/commands/actions/plugin/build-command/command.js.map +1 -1
- package/dist/commands/actions/plugin/init/action.js.map +1 -1
- package/dist/commands/actions/plugin/init/command.js.map +1 -1
- package/dist/commands/actions/plugin/init/files/admin.js.map +1 -1
- package/dist/commands/actions/plugin/init/files/server.js.map +1 -1
- package/dist/commands/actions/plugin/init/files/typescript.js.map +1 -1
- package/dist/commands/actions/plugin/link-watch/action.js.map +1 -1
- package/dist/commands/actions/plugin/verify/action.js.map +1 -1
- package/dist/commands/actions/plugin/watch/action.js.map +1 -1
- package/dist/commands/actions/policies/list/action.js.map +1 -1
- package/dist/commands/actions/policies/list/command.js.map +1 -1
- package/dist/commands/actions/report/action.js.map +1 -1
- package/dist/commands/actions/report/command.js.map +1 -1
- package/dist/commands/actions/routes/list/action.js.map +1 -1
- package/dist/commands/actions/routes/list/command.js.map +1 -1
- package/dist/commands/actions/services/list/action.js.map +1 -1
- package/dist/commands/actions/services/list/command.js.map +1 -1
- package/dist/commands/actions/start/action.js.map +1 -1
- package/dist/commands/actions/start/command.js.map +1 -1
- package/dist/commands/actions/telemetry/disable/action.js.map +1 -1
- package/dist/commands/actions/telemetry/disable/command.js.map +1 -1
- package/dist/commands/actions/telemetry/enable/action.js.map +1 -1
- package/dist/commands/actions/telemetry/enable/command.js.map +1 -1
- package/dist/commands/actions/templates/generate/action.js.map +1 -1
- package/dist/commands/actions/templates/generate/command.js.map +1 -1
- package/dist/commands/actions/ts/generate-types/action.js.map +1 -1
- package/dist/commands/actions/ts/generate-types/command.js.map +1 -1
- package/dist/commands/actions/uninstall/action.js.map +1 -1
- package/dist/commands/actions/uninstall/command.js.map +1 -1
- package/dist/commands/actions/version/command.js.map +1 -1
- package/dist/commands/actions/watch-admin/action.js.map +1 -1
- package/dist/commands/actions/watch-admin/command.js.map +1 -1
- package/dist/commands/index.js +60 -60
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/utils/commander.js.map +1 -1
- package/dist/commands/utils/helpers.js.map +1 -1
- package/dist/commands/utils/logger.js +1 -2
- package/dist/commands/utils/logger.js.map +1 -1
- package/dist/commands/utils/pkg.js +1 -2
- package/dist/commands/utils/pkg.js.map +1 -1
- package/dist/commands/utils/tsconfig.js.map +1 -1
- package/dist/compile.js.map +1 -1
- package/dist/compile.mjs.map +1 -1
- package/dist/container.js.map +1 -1
- package/dist/container.mjs.map +1 -1
- package/dist/core/app-configuration/config-loader.js +1 -2
- package/dist/core/app-configuration/config-loader.js.map +1 -1
- package/dist/core/app-configuration/config-loader.mjs +1 -2
- package/dist/core/app-configuration/config-loader.mjs.map +1 -1
- package/dist/core/app-configuration/index.js.map +1 -1
- package/dist/core/app-configuration/index.mjs.map +1 -1
- package/dist/core/app-configuration/load-config-file.js.map +1 -1
- package/dist/core/app-configuration/load-config-file.mjs +1 -1
- package/dist/core/app-configuration/load-config-file.mjs.map +1 -1
- package/dist/core/bootstrap.js.map +1 -1
- package/dist/core/bootstrap.mjs.map +1 -1
- package/dist/core/domain/content-type/index.js.map +1 -1
- package/dist/core/domain/content-type/index.mjs.map +1 -1
- package/dist/core/domain/content-type/validator.js.map +1 -1
- package/dist/core/domain/content-type/validator.mjs.map +1 -1
- package/dist/core/domain/module/index.js.map +1 -1
- package/dist/core/domain/module/index.mjs.map +1 -1
- package/dist/core/domain/module/validation.js.map +1 -1
- package/dist/core/domain/module/validation.mjs.map +1 -1
- package/dist/core/loaders/admin.js.map +1 -1
- package/dist/core/loaders/admin.mjs.map +1 -1
- package/dist/core/loaders/apis.js.map +1 -1
- package/dist/core/loaders/apis.mjs.map +1 -1
- package/dist/core/loaders/components.js.map +1 -1
- package/dist/core/loaders/components.mjs.map +1 -1
- package/dist/core/loaders/index.js.map +1 -1
- package/dist/core/loaders/index.mjs.map +1 -1
- package/dist/core/loaders/middlewares.js.map +1 -1
- package/dist/core/loaders/middlewares.mjs.map +1 -1
- package/dist/core/loaders/plugins/get-enabled-plugins.js.map +1 -1
- package/dist/core/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
- package/dist/core/loaders/plugins/get-user-plugins-config.js.map +1 -1
- package/dist/core/loaders/plugins/get-user-plugins-config.mjs.map +1 -1
- package/dist/core/loaders/plugins/index.js.map +1 -1
- package/dist/core/loaders/plugins/index.mjs +1 -1
- package/dist/core/loaders/plugins/index.mjs.map +1 -1
- package/dist/core/loaders/policies.js.map +1 -1
- package/dist/core/loaders/policies.mjs.map +1 -1
- package/dist/core/loaders/sanitizers.js.map +1 -1
- package/dist/core/loaders/sanitizers.mjs.map +1 -1
- package/dist/core/loaders/src-index.js.map +1 -1
- package/dist/core/loaders/src-index.mjs.map +1 -1
- package/dist/core/loaders/validators.js.map +1 -1
- package/dist/core/loaders/validators.mjs.map +1 -1
- package/dist/core/registries/apis.js.map +1 -1
- package/dist/core/registries/apis.mjs.map +1 -1
- package/dist/core/registries/config.js.map +1 -1
- package/dist/core/registries/config.mjs.map +1 -1
- package/dist/core/registries/content-types.js.map +1 -1
- package/dist/core/registries/content-types.mjs +2 -2
- package/dist/core/registries/content-types.mjs.map +1 -1
- package/dist/core/registries/controllers.js.map +1 -1
- package/dist/core/registries/controllers.mjs +2 -2
- package/dist/core/registries/controllers.mjs.map +1 -1
- package/dist/core/registries/custom-fields.js.map +1 -1
- package/dist/core/registries/custom-fields.mjs.map +1 -1
- package/dist/core/registries/hooks.js.map +1 -1
- package/dist/core/registries/hooks.mjs +1 -1
- package/dist/core/registries/hooks.mjs.map +1 -1
- package/dist/core/registries/middlewares.js.map +1 -1
- package/dist/core/registries/middlewares.mjs +2 -2
- package/dist/core/registries/middlewares.mjs.map +1 -1
- package/dist/core/registries/modules.js.map +1 -1
- package/dist/core/registries/modules.mjs +1 -1
- package/dist/core/registries/modules.mjs.map +1 -1
- package/dist/core/registries/plugins.js.map +1 -1
- package/dist/core/registries/plugins.mjs.map +1 -1
- package/dist/core/registries/policies.js.map +1 -1
- package/dist/core/registries/policies.mjs +2 -2
- package/dist/core/registries/policies.mjs.map +1 -1
- package/dist/core/registries/sanitizers.js.map +1 -1
- package/dist/core/registries/sanitizers.mjs.map +1 -1
- package/dist/core/registries/services.js.map +1 -1
- package/dist/core/registries/services.mjs +2 -2
- package/dist/core/registries/services.mjs.map +1 -1
- package/dist/core/registries/validators.js.map +1 -1
- package/dist/core/registries/validators.mjs.map +1 -1
- package/dist/core/utils.js.map +1 -1
- package/dist/core/utils.mjs.map +1 -1
- package/dist/core-api/controller/collection-type.js.map +1 -1
- package/dist/core-api/controller/collection-type.mjs.map +1 -1
- package/dist/core-api/controller/index.js.map +1 -1
- package/dist/core-api/controller/index.mjs +1 -1
- package/dist/core-api/controller/index.mjs.map +1 -1
- package/dist/core-api/controller/single-type.js.map +1 -1
- package/dist/core-api/controller/single-type.mjs.map +1 -1
- package/dist/core-api/controller/transform.js.map +1 -1
- package/dist/core-api/controller/transform.mjs.map +1 -1
- package/dist/core-api/routes/index.js.map +1 -1
- package/dist/core-api/routes/index.mjs.map +1 -1
- package/dist/core-api/service/collection-type.js.map +1 -1
- package/dist/core-api/service/collection-type.mjs.map +1 -1
- package/dist/core-api/service/get-fetch-params.js.map +1 -1
- package/dist/core-api/service/get-fetch-params.mjs.map +1 -1
- package/dist/core-api/service/index.js.map +1 -1
- package/dist/core-api/service/index.mjs.map +1 -1
- package/dist/core-api/service/pagination.js.map +1 -1
- package/dist/core-api/service/pagination.mjs +1 -1
- package/dist/core-api/service/pagination.mjs.map +1 -1
- package/dist/core-api/service/single-type.js +1 -2
- package/dist/core-api/service/single-type.js.map +1 -1
- package/dist/core-api/service/single-type.mjs +2 -3
- package/dist/core-api/service/single-type.mjs.map +1 -1
- package/dist/ee/index.js.map +1 -1
- package/dist/ee/index.mjs +1 -1
- package/dist/ee/index.mjs.map +1 -1
- package/dist/ee/license.js.map +1 -1
- package/dist/ee/license.mjs.map +1 -1
- package/dist/factories.js +4 -4
- package/dist/factories.js.map +1 -1
- package/dist/factories.mjs.map +1 -1
- package/dist/load/filepath-to-prop-path.js.map +1 -1
- package/dist/load/load-files.js +1 -2
- package/dist/load/load-files.js.map +1 -1
- package/dist/load/load-files.mjs +1 -2
- package/dist/load/load-files.mjs.map +1 -1
- package/dist/middlewares/body.js.map +1 -1
- package/dist/middlewares/body.mjs.map +1 -1
- package/dist/middlewares/cors.js.map +1 -1
- package/dist/middlewares/cors.mjs.map +1 -1
- package/dist/middlewares/errors.js.map +1 -1
- package/dist/middlewares/errors.mjs.map +1 -1
- package/dist/middlewares/favicon.js.map +1 -1
- package/dist/middlewares/favicon.mjs.map +1 -1
- package/dist/middlewares/index.js.map +1 -1
- package/dist/middlewares/logger.js.map +1 -1
- package/dist/middlewares/logger.mjs.map +1 -1
- package/dist/middlewares/powered-by.js.map +1 -1
- package/dist/middlewares/powered-by.mjs.map +1 -1
- package/dist/middlewares/public/index.js +1 -2
- package/dist/middlewares/public/index.js.map +1 -1
- package/dist/middlewares/public/index.mjs +1 -2
- package/dist/middlewares/public/index.mjs.map +1 -1
- package/dist/middlewares/public/serve-static.js.map +1 -1
- package/dist/middlewares/public/serve-static.mjs.map +1 -1
- package/dist/middlewares/query.js.map +1 -1
- package/dist/middlewares/query.mjs.map +1 -1
- package/dist/middlewares/response-time.js.map +1 -1
- package/dist/middlewares/response-time.mjs.map +1 -1
- package/dist/middlewares/responses.js.map +1 -1
- package/dist/middlewares/responses.mjs.map +1 -1
- package/dist/middlewares/security.js.map +1 -1
- package/dist/middlewares/security.mjs.map +1 -1
- package/dist/middlewares/session.js.map +1 -1
- package/dist/middlewares/session.mjs.map +1 -1
- package/dist/migrations/draft-publish.js.map +1 -1
- package/dist/migrations/draft-publish.mjs.map +1 -1
- package/dist/services/auth/index.js.map +1 -1
- package/dist/services/auth/index.mjs.map +1 -1
- package/dist/services/content-api/index.js.map +1 -1
- package/dist/services/content-api/index.mjs.map +1 -1
- package/dist/services/content-api/permissions/engine.js.map +1 -1
- package/dist/services/content-api/permissions/engine.mjs.map +1 -1
- package/dist/services/content-api/permissions/index.js.map +1 -1
- package/dist/services/content-api/permissions/index.mjs.map +1 -1
- package/dist/services/content-api/permissions/providers/action.js.map +1 -1
- package/dist/services/content-api/permissions/providers/action.mjs.map +1 -1
- package/dist/services/content-api/permissions/providers/condition.js.map +1 -1
- package/dist/services/content-api/permissions/providers/condition.mjs.map +1 -1
- package/dist/services/core-store.js.map +1 -1
- package/dist/services/core-store.mjs.map +1 -1
- package/dist/services/cron.js +1 -2
- package/dist/services/cron.js.map +1 -1
- package/dist/services/cron.mjs +1 -2
- package/dist/services/cron.mjs.map +1 -1
- package/dist/services/custom-fields.js.map +1 -1
- package/dist/services/custom-fields.mjs.map +1 -1
- package/dist/services/entity-service/attributes/index.js.map +1 -1
- package/dist/services/entity-service/attributes/index.mjs.map +1 -1
- package/dist/services/entity-service/attributes/transforms.js.map +1 -1
- package/dist/services/entity-service/attributes/transforms.mjs.map +1 -1
- package/dist/services/entity-service/components.js.map +1 -1
- package/dist/services/entity-service/components.mjs +1 -1
- package/dist/services/entity-service/components.mjs.map +1 -1
- package/dist/services/entity-service/index.js.map +1 -1
- package/dist/services/entity-service/index.mjs +2 -2
- package/dist/services/entity-service/index.mjs.map +1 -1
- package/dist/services/entity-service/params.js.map +1 -1
- package/dist/services/entity-service/params.mjs.map +1 -1
- package/dist/services/entity-validator/blocks-validator.js.map +1 -1
- package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
- package/dist/services/entity-validator/index.js.map +1 -1
- package/dist/services/entity-validator/index.mjs +1 -1
- package/dist/services/entity-validator/index.mjs.map +1 -1
- package/dist/services/entity-validator/validators.js.map +1 -1
- package/dist/services/entity-validator/validators.mjs.map +1 -1
- package/dist/services/errors.js.map +1 -1
- package/dist/services/errors.mjs.map +1 -1
- package/dist/services/event-hub.js.map +1 -1
- package/dist/services/event-hub.mjs.map +1 -1
- package/dist/services/features.js.map +1 -1
- package/dist/services/features.mjs.map +1 -1
- package/dist/services/fs.js.map +1 -1
- package/dist/services/fs.mjs.map +1 -1
- package/dist/services/metrics/admin-user-hash.js.map +1 -1
- package/dist/services/metrics/admin-user-hash.mjs.map +1 -1
- package/dist/services/metrics/index.js +1 -2
- package/dist/services/metrics/index.js.map +1 -1
- package/dist/services/metrics/index.mjs +1 -2
- package/dist/services/metrics/index.mjs.map +1 -1
- package/dist/services/metrics/is-truthy.js.map +1 -1
- package/dist/services/metrics/is-truthy.mjs.map +1 -1
- package/dist/services/metrics/middleware.js.map +1 -1
- package/dist/services/metrics/middleware.mjs.map +1 -1
- package/dist/services/metrics/rate-limiter.js.map +1 -1
- package/dist/services/metrics/rate-limiter.mjs.map +1 -1
- package/dist/services/metrics/sender.js.map +1 -1
- package/dist/services/metrics/sender.mjs.map +1 -1
- package/dist/services/request-context.js.map +1 -1
- package/dist/services/request-context.mjs.map +1 -1
- package/dist/services/server/admin-api.js.map +1 -1
- package/dist/services/server/admin-api.mjs.map +1 -1
- package/dist/services/server/api.js.map +1 -1
- package/dist/services/server/api.mjs.map +1 -1
- package/dist/services/server/compose-endpoint.js +1 -1
- package/dist/services/server/compose-endpoint.js.map +1 -1
- package/dist/services/server/compose-endpoint.mjs +1 -1
- package/dist/services/server/compose-endpoint.mjs.map +1 -1
- package/dist/services/server/content-api.js.map +1 -1
- package/dist/services/server/content-api.mjs.map +1 -1
- package/dist/services/server/http-server.js.map +1 -1
- package/dist/services/server/http-server.mjs.map +1 -1
- package/dist/services/server/index.js.map +1 -1
- package/dist/services/server/index.mjs.map +1 -1
- package/dist/services/server/koa.js.map +1 -1
- package/dist/services/server/koa.mjs.map +1 -1
- package/dist/services/server/middleware.js.map +1 -1
- package/dist/services/server/middleware.mjs.map +1 -1
- package/dist/services/server/policy.js.map +1 -1
- package/dist/services/server/policy.mjs.map +1 -1
- package/dist/services/server/register-middlewares.js.map +1 -1
- package/dist/services/server/register-middlewares.mjs.map +1 -1
- package/dist/services/server/register-routes.js.map +1 -1
- package/dist/services/server/register-routes.mjs.map +1 -1
- package/dist/services/server/routing.js.map +1 -1
- package/dist/services/server/routing.mjs.map +1 -1
- package/dist/services/utils/dynamic-zones.js.map +1 -1
- package/dist/services/utils/dynamic-zones.mjs.map +1 -1
- package/dist/services/utils/upload-files.js +2 -4
- package/dist/services/utils/upload-files.js.map +1 -1
- package/dist/services/utils/upload-files.mjs +2 -4
- package/dist/services/utils/upload-files.mjs.map +1 -1
- package/dist/services/webhook-runner.js.map +1 -1
- package/dist/services/webhook-runner.mjs.map +1 -1
- package/dist/services/webhook-store.js.map +1 -1
- package/dist/services/webhook-store.mjs.map +1 -1
- package/dist/services/worker-queue.js.map +1 -1
- package/dist/services/worker-queue.mjs.map +1 -1
- package/dist/utils/convert-custom-field-type.js.map +1 -1
- package/dist/utils/convert-custom-field-type.mjs.map +1 -1
- package/dist/utils/cron.js.map +1 -1
- package/dist/utils/cron.mjs.map +1 -1
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/fetch.mjs.map +1 -1
- package/dist/utils/get-dirs.js.map +1 -1
- package/dist/utils/get-dirs.mjs +1 -1
- package/dist/utils/get-dirs.mjs.map +1 -1
- package/dist/utils/is-initialized.js.map +1 -1
- package/dist/utils/is-initialized.mjs.map +1 -1
- package/dist/utils/machine-id.js.map +1 -1
- package/dist/utils/machine-id.mjs.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/open-browser.mjs.map +1 -1
- package/dist/utils/signals.js.map +1 -1
- package/dist/utils/signals.mjs.map +1 -1
- package/dist/utils/startup-logger.js.map +1 -1
- package/dist/utils/startup-logger.mjs.map +1 -1
- package/dist/utils/update-notifier/index.js.map +1 -1
- package/dist/utils/update-notifier/index.mjs.map +1 -1
- package/package.json +26 -26
package/dist/Strapi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Strapi.js","sources":["../src/Strapi.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\nimport path from 'path';\nimport _ from 'lodash';\nimport { isFunction } from 'lodash/fp';\nimport { Logger, createLogger } from '@strapi/logger';\nimport { Database } from '@strapi/database';\nimport { hooks } from '@strapi/utils';\nimport type {\n Strapi as StrapiI,\n Server,\n Container,\n EntityService,\n EventHub,\n StartupLogger,\n CronService,\n WebhookStore,\n CoreStore,\n TelemetryService,\n RequestContext,\n CustomFields,\n Fetch,\n StrapiFS,\n StrapiDirectories,\n Reloader,\n EntityValidator,\n Common,\n Shared,\n Schema,\n} from '@strapi/types';\n\nimport loadConfiguration from './core/app-configuration';\n\nimport * as factories from './factories';\nimport compile from './compile';\n\nimport * as utils from './utils';\nimport { createContainer } from './container';\nimport createStrapiFs from './services/fs';\nimport createEventHub from './services/event-hub';\nimport { createServer } from './services/server';\nimport createWebhookRunner, { WebhookRunner } from './services/webhook-runner';\nimport { webhookModel, createWebhookStore } from './services/webhook-store';\nimport { createCoreStore, coreStoreModel } from './services/core-store';\nimport createEntityService from './services/entity-service';\nimport createCronService from './services/cron';\nimport entityValidator from './services/entity-validator';\nimport createTelemetry from './services/metrics';\nimport requestContext from './services/request-context';\nimport createAuth from './services/auth';\nimport createCustomFields from './services/custom-fields';\nimport createContentAPI from './services/content-api';\nimport createUpdateNotifier from './utils/update-notifier';\nimport createStartupLogger from './utils/startup-logger';\nimport { createStrapiFetch } from './utils/fetch';\nimport { LIFECYCLES } from './utils/lifecycles';\nimport ee from './utils/ee';\nimport contentTypesRegistry from './core/registries/content-types';\nimport servicesRegistry from './core/registries/services';\nimport policiesRegistry from './core/registries/policies';\nimport middlewaresRegistry from './core/registries/middlewares';\nimport hooksRegistry from './core/registries/hooks';\nimport controllersRegistry from './core/registries/controllers';\nimport modulesRegistry from './core/registries/modules';\nimport pluginsRegistry from './core/registries/plugins';\nimport customFieldsRegistry from './core/registries/custom-fields';\nimport createConfigProvider from './core/registries/config';\nimport apisRegistry from './core/registries/apis';\nimport bootstrap from './core/bootstrap';\nimport loaders from './core/loaders';\nimport { destroyOnSignal } from './utils/signals';\nimport getNumberOfDynamicZones from './services/utils/dynamic-zones';\nimport sanitizersRegistry from './core/registries/sanitizers';\nimport validatorsRegistry from './core/registries/validators';\nimport convertCustomFieldType from './utils/convert-custom-field-type';\n\n// TODO: move somewhere else\nimport * as draftAndPublishSync from './migrations/draft-publish';\nimport { FeaturesService, createFeaturesService } from './services/features';\n\n/**\n * Resolve the working directories based on the instance options.\n *\n * Behavior:\n * - `appDir` is the directory where Strapi will write every file (schemas, generated APIs, controllers or services)\n * - `distDir` is the directory where Strapi will read configurations, schemas and any compiled code\n *\n * Default values:\n * - If `appDir` is `undefined`, it'll be set to `process.cwd()`\n * - If `distDir` is `undefined`, it'll be set to `appDir`\n */\nconst resolveWorkingDirectories = (opts: { appDir?: string; distDir?: string }) => {\n const cwd = process.cwd();\n\n const appDir = opts.appDir ? path.resolve(cwd, opts.appDir) : cwd;\n const distDir = opts.distDir ? path.resolve(cwd, opts.distDir) : appDir;\n\n return { app: appDir, dist: distDir };\n};\n\nconst reloader = (strapi: Strapi) => {\n const state = {\n shouldReload: 0,\n isWatching: true,\n };\n\n function reload() {\n if (state.shouldReload > 0) {\n // Reset the reloading state\n state.shouldReload -= 1;\n reload.isReloading = false;\n return;\n }\n\n if (strapi.config.get('autoReload')) {\n process.send?.('reload');\n }\n }\n\n Object.defineProperty(reload, 'isWatching', {\n configurable: true,\n enumerable: true,\n set(value) {\n // Special state when the reloader is disabled temporarly (see GraphQL plugin example).\n if (state.isWatching === false && value === true) {\n state.shouldReload += 1;\n }\n state.isWatching = value;\n },\n get() {\n return state.isWatching;\n },\n });\n\n reload.isReloading = false;\n reload.isWatching = true;\n\n return reload;\n};\n\nexport type LoadedStrapi = Required<Strapi>;\n\nclass Strapi implements StrapiI {\n server: Server;\n\n container: Container;\n\n log: Logger;\n\n fs: StrapiFS;\n\n eventHub: EventHub;\n\n startupLogger: StartupLogger;\n\n cron: CronService;\n\n webhookRunner?: WebhookRunner;\n\n webhookStore?: WebhookStore;\n\n store?: CoreStore;\n\n entityValidator?: EntityValidator;\n\n entityService?: EntityService.EntityService;\n\n telemetry: TelemetryService;\n\n requestContext: RequestContext;\n\n customFields: CustomFields.CustomFields;\n\n fetch: Fetch;\n\n dirs: StrapiDirectories;\n\n admin?: Common.Module;\n\n isLoaded: boolean;\n\n db?: Database;\n\n app: any;\n\n EE?: boolean;\n\n components: Shared.Components;\n\n reload: Reloader;\n\n features: FeaturesService;\n\n constructor(opts: StrapiOptions = {}) {\n destroyOnSignal(this);\n\n const rootDirs = resolveWorkingDirectories(opts);\n\n // Load the app configuration from the dist directory\n const appConfig = loadConfiguration(rootDirs, opts);\n\n // Instantiate the Strapi container\n this.container = createContainer(this)\n .register('config', createConfigProvider(appConfig))\n .register('content-types', contentTypesRegistry())\n .register('services', servicesRegistry(this))\n .register('policies', policiesRegistry())\n .register('middlewares', middlewaresRegistry())\n .register('hooks', hooksRegistry())\n .register('controllers', controllersRegistry(this))\n .register('modules', modulesRegistry(this))\n .register('plugins', pluginsRegistry(this))\n .register('custom-fields', customFieldsRegistry(this))\n .register('apis', apisRegistry(this))\n .register('auth', createAuth())\n .register('content-api', createContentAPI(this))\n .register('sanitizers', sanitizersRegistry())\n .register('validators', validatorsRegistry());\n\n this.components = {};\n\n // Create a mapping of every useful directory (for the app, dist and static directories)\n this.dirs = utils.getDirs(rootDirs, { strapi: this });\n\n // Strapi state management variables\n this.isLoaded = false;\n this.reload = reloader(this);\n\n // Instantiate the Koa app & the HTTP server\n this.server = createServer(this);\n\n // Strapi utils instantiation\n this.fs = createStrapiFs(this);\n this.eventHub = createEventHub();\n this.startupLogger = createStartupLogger(this);\n this.log = createLogger(this.config.get('logger', {}));\n this.cron = createCronService();\n this.telemetry = createTelemetry(this);\n this.requestContext = requestContext;\n this.customFields = createCustomFields(this);\n this.fetch = createStrapiFetch(this);\n this.features = createFeaturesService(this);\n\n createUpdateNotifier(this).notify();\n\n Object.defineProperty<Strapi>(this, 'EE', {\n get: () => {\n ee.init(this.dirs.app.root, this.log);\n return ee.isEE;\n },\n configurable: false,\n });\n }\n\n get config() {\n return this.container.get('config');\n }\n\n get services() {\n return this.container.get('services').getAll();\n }\n\n service(uid: Common.UID.Service) {\n return this.container.get('services').get(uid);\n }\n\n get controllers() {\n return this.container.get('controllers').getAll();\n }\n\n controller(uid: Common.UID.Controller) {\n return this.container.get('controllers').get(uid);\n }\n\n get contentTypes(): Shared.ContentTypes {\n return this.container.get('content-types').getAll();\n }\n\n contentType(name: Common.UID.ContentType) {\n return this.container.get('content-types').get(name);\n }\n\n get policies() {\n return this.container.get('policies').getAll();\n }\n\n policy(name: string) {\n return this.container.get('policies').get(name);\n }\n\n get middlewares() {\n return this.container.get('middlewares').getAll();\n }\n\n middleware(name: string) {\n return this.container.get('middlewares').get(name);\n }\n\n get plugins(): Record<string, Common.Plugin> {\n return this.container.get('plugins').getAll();\n }\n\n plugin(name: string): Common.Plugin {\n return this.container.get('plugins').get(name);\n }\n\n get hooks() {\n return this.container.get('hooks').getAll();\n }\n\n hook(name: string) {\n return this.container.get('hooks').get(name);\n }\n\n // api(name) {\n // return this.container.get('apis').get(name);\n // }\n\n get api(): Record<string, Common.Module> {\n return this.container.get('apis').getAll();\n }\n\n get auth() {\n return this.container.get('auth');\n }\n\n get contentAPI() {\n return this.container.get('content-api');\n }\n\n get sanitizers() {\n return this.container.get('sanitizers');\n }\n\n get validators() {\n return this.container.get('validators');\n }\n\n async start() {\n try {\n if (!this.isLoaded) {\n await this.load();\n }\n\n await this.listen();\n\n return this;\n } catch (error) {\n return this.stopWithError(error);\n }\n }\n\n async destroy() {\n await this.server.destroy();\n await this.runLifecyclesFunctions(LIFECYCLES.DESTROY);\n\n this.eventHub.destroy();\n\n await this.db?.destroy();\n\n this.telemetry.destroy();\n this.cron.destroy();\n\n process.removeAllListeners();\n\n // @ts-expect-error: Allow clean delete of global.strapi to allow re-instanciation\n delete global.strapi;\n }\n\n sendStartupTelemetry() {\n // Emit started event.\n // do not await to avoid slower startup\n // This event is anonymous\n this.telemetry\n .send('didStartServer', {\n groupProperties: {\n database: this.config.get('database.connection.client'),\n plugins: Object.keys(this.plugins),\n numberOfAllContentTypes: _.size(this.contentTypes), // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.\n numberOfComponents: _.size(this.components),\n numberOfDynamicZones: getNumberOfDynamicZones(),\n numberOfCustomControllers: Object.values<Common.Controller>(this.controllers).filter(\n // TODO: Fix this at the content API loader level to prevent future types issues\n (controller) => controller !== undefined && factories.isCustomController(controller)\n ).length,\n environment: this.config.environment,\n // TODO: to add back\n // providers: this.config.installedProviders,\n },\n })\n .catch(this.log.error);\n }\n\n async openAdmin({ isInitialized }: { isInitialized: boolean }) {\n const shouldOpenAdmin =\n this.config.get('environment') === 'development' &&\n this.config.get('admin.autoOpen', true) !== false;\n\n if (shouldOpenAdmin && !isInitialized) {\n try {\n await utils.openBrowser(this.config);\n this.telemetry.send('didOpenTab');\n } catch (e) {\n this.telemetry.send('didNotOpenTab');\n }\n }\n }\n\n async postListen() {\n const isInitialized = await utils.isInitialized(this);\n\n this.startupLogger.logStartupMessage({ isInitialized });\n\n this.sendStartupTelemetry();\n this.openAdmin({ isInitialized });\n }\n\n /**\n * Add behaviors to the server\n */\n async listen() {\n return new Promise<void>((resolve, reject) => {\n const onListen = async () => {\n try {\n await this.postListen();\n\n resolve();\n } catch (error) {\n reject(error);\n }\n };\n\n const listenSocket = this.config.get('server.socket');\n\n if (listenSocket) {\n this.server.listen(listenSocket, onListen);\n } else {\n const { host, port } = this.config.get('server');\n\n this.server.listen(port, host, onListen);\n }\n });\n }\n\n stopWithError(err: unknown, customMessage?: string): never {\n this.log.debug(`⛔️ Server wasn't able to start properly.`);\n if (customMessage) {\n this.log.error(customMessage);\n }\n\n this.log.error(err);\n return this.stop();\n }\n\n stop(exitCode = 1): never {\n this.destroy();\n\n if (this.config.get('autoReload')) {\n process.send?.('stop');\n }\n\n // Kill process\n process.exit(exitCode);\n }\n\n async loadAdmin() {\n await loaders.loadAdmin(this);\n }\n\n async loadPlugins() {\n await loaders.loadPlugins(this);\n }\n\n async loadPolicies() {\n await loaders.loadPolicies(this);\n }\n\n async loadAPIs() {\n await loaders.loadAPIs(this);\n }\n\n async loadComponents() {\n this.components = await loaders.loadComponents(this);\n }\n\n async loadMiddlewares() {\n await loaders.loadMiddlewares(this);\n }\n\n async loadApp() {\n this.app = await loaders.loadSrcIndex(this);\n }\n\n async loadSanitizers() {\n await loaders.loadSanitizers(this);\n }\n\n async loadValidators() {\n await loaders.loadValidators(this);\n }\n\n registerInternalHooks() {\n this.container\n .get('hooks')\n .set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n\n this.container\n .get('hooks')\n .set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n this.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n this.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n }\n\n async register() {\n await Promise.all([\n this.loadApp(),\n this.loadSanitizers(),\n this.loadValidators(),\n this.loadPlugins(),\n this.loadAdmin(),\n this.loadAPIs(),\n this.loadComponents(),\n this.loadMiddlewares(),\n this.loadPolicies(),\n ]);\n\n await bootstrap({ strapi: this });\n\n // init webhook runner\n this.webhookRunner = createWebhookRunner({\n eventHub: this.eventHub,\n logger: this.log,\n configuration: this.config.get('server.webhooks', {}),\n fetch: this.fetch,\n });\n\n this.registerInternalHooks();\n\n this.telemetry.register();\n\n await this.runLifecyclesFunctions(LIFECYCLES.REGISTER);\n // NOTE: Swap type customField for underlying data type\n convertCustomFieldType(this);\n\n return this;\n }\n\n async bootstrap() {\n const contentTypes = [\n coreStoreModel,\n webhookModel,\n ...Object.values(this.contentTypes),\n ...Object.values(this.components),\n ];\n\n this.db = await Database.init({\n ...this.config.get('database'),\n models: Database.transformContentTypes(contentTypes),\n });\n\n this.store = createCoreStore({ db: this.db });\n this.webhookStore = createWebhookStore({ db: this.db });\n\n this.entityValidator = entityValidator;\n this.entityService = createEntityService({\n strapi: this,\n db: this.db,\n eventHub: this.eventHub,\n entityValidator: this.entityValidator,\n });\n\n if (this.config.get('server.cron.enabled', true)) {\n const cronTasks = this.config.get('server.cron.tasks', {});\n this.cron.add(cronTasks);\n }\n\n this.telemetry.bootstrap();\n\n let oldContentTypes;\n if (await this.db.getSchemaConnection().hasTable(coreStoreModel.collectionName)) {\n oldContentTypes = await this.store.get({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n });\n }\n\n await this.hook('strapi::content-types.beforeSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n const status = await this.db.schema.sync();\n\n // if schemas have changed, run repairs\n if (status === 'CHANGED') {\n await this.db.repair.removeOrphanMorphType({ pivot: 'component_type' });\n }\n\n if (this.EE) {\n await ee.checkLicense({ strapi: this });\n }\n\n await this.hook('strapi::content-types.afterSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n await this.store.set({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n value: this.contentTypes,\n });\n\n await this.startWebhooks();\n\n await this.server.initMiddlewares();\n this.server.initRouting();\n\n await this.contentAPI.permissions.registerActions();\n\n await this.runLifecyclesFunctions(LIFECYCLES.BOOTSTRAP);\n\n this.cron.start();\n\n return this;\n }\n\n async load() {\n await this.register();\n await this.bootstrap();\n\n this.isLoaded = true;\n\n return this as this & Required<StrapiI>;\n }\n\n async startWebhooks() {\n const webhooks = await this.webhookStore?.findWebhooks();\n if (!webhooks) {\n return;\n }\n\n for (const webhook of webhooks) {\n this.webhookRunner?.add(webhook);\n }\n }\n\n async runLifecyclesFunctions(lifecycleName: 'register' | 'bootstrap' | 'destroy') {\n // plugins\n await this.container.get('modules')[lifecycleName]();\n\n // admin\n const adminLifecycleFunction = this.admin && this.admin[lifecycleName];\n if (isFunction(adminLifecycleFunction)) {\n await adminLifecycleFunction({ strapi: this });\n }\n\n // user\n const userLifecycleFunction = this.app && this.app[lifecycleName];\n if (isFunction(userLifecycleFunction)) {\n await userLifecycleFunction({ strapi: this });\n }\n }\n\n getModel(uid: Common.UID.ContentType): Schema.ContentType;\n getModel(uid: Common.UID.Component): Schema.Component;\n getModel<TUID extends Common.UID.Schema>(\n uid: TUID\n ): Schema.ContentType | Schema.Component | undefined {\n if (uid in this.contentTypes) {\n return this.contentTypes[uid as Common.UID.ContentType];\n }\n\n if (uid in this.components) {\n return this.components[uid as Common.UID.Component];\n }\n }\n\n /**\n * Binds queries with a specific model\n * @param {string} uid\n */\n query(uid: Common.UID.Schema) {\n return this.db!.query(uid);\n }\n}\n\ninterface StrapiOptions {\n appDir?: string;\n distDir?: string;\n autoReload?: boolean;\n serveAdminPanel?: boolean;\n}\n\ninterface Init {\n (options?: StrapiOptions): Strapi;\n factories: typeof factories;\n compile: typeof compile;\n}\n\nconst initFn = (options: StrapiOptions = {}) => {\n const strapi = new Strapi(options);\n global.strapi = strapi as LoadedStrapi;\n return strapi;\n};\n\nconst init: Init = Object.assign(initFn, { factories, compile });\n\nexport default init;\n"],"names":["path","destroyOnSignal","loadConfiguration","createContainer","createConfigProvider","contentTypesRegistry","servicesRegistry","policiesRegistry","middlewaresRegistry","hooksRegistry","controllersRegistry","modulesRegistry","pluginsRegistry","customFieldsRegistry","apisRegistry","createAuth","createContentAPI","sanitizersRegistry","validatorsRegistry","utils.getDirs","createServer","createStrapiFs","createEventHub","createStartupLogger","createLogger","createCronService","createTelemetry","createCustomFields","createStrapiFetch","createFeaturesService","createUpdateNotifier","ee","LIFECYCLES","_","getNumberOfDynamicZones","factories.isCustomController","isInitialized","utils.openBrowser","utils.isInitialized","loaders","hooks","draftAndPublishSync.disable","draftAndPublishSync.enable","createWebhookRunner","contentTypes","coreStoreModel","webhookModel","Database","createCoreStore","createWebhookStore","entityValidator","createEntityService","isFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,MAAM,4BAA4B,CAAC,SAAgD;AAC3E,QAAA,MAAM,QAAQ;AAEd,QAAA,SAAS,KAAK,SAASA,cAAA,QAAK,QAAQ,KAAK,KAAK,MAAM,IAAI;AACxD,QAAA,UAAU,KAAK,UAAUA,cAAA,QAAK,QAAQ,KAAK,KAAK,OAAO,IAAI;AAEjE,SAAO,EAAE,KAAK,QAAQ,MAAM,QAAQ;AACtC;AAEA,MAAM,WAAW,CAAC,WAAmB;AAC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S,EAAE,aAAa;AAGjD,UAAM,yBAAyB,KAAK,SAAS,KAAK,MAAM,aAAa;AACjE,QAAAoB,GAAAA,WAAW,sBAAsB,GAAG;AACtC,YAAM,uBAAuB,EAAE,QAAQ,KAAM,CAAA;AAAA,IAC/C;AAGA,UAAM,wBAAwB,KAAK,OAAO,KAAK,IAAI,aAAa;AAC5D,QAAAA,GAAAA,WAAW,qBAAqB,GAAG;AACrC,YAAM,sBAAsB,EAAE,QAAQ,KAAM,CAAA;AAAA,IAC9C;AAAA,EACF;AAAA,EAIA,SACE,KACmD;AAC/C,QAAA,OAAO,KAAK,cAAc;AACrB,aAAA,KAAK,aAAa,GAA6B;AAAA,IACxD;AAEI,QAAA,OAAO,KAAK,YAAY;AACnB,aAAA,KAAK,WAAW,GAA2B;AAAA,IACpD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,KAAwB;AACrB,WAAA,KAAK,GAAI,MAAM,GAAG;AAAA,EAC3B;AACF;AAeA,MAAM,SAAS,CAAC,UAAyB,OAAO;AACxC,QAAA,SAAS,IAAI,OAAO,OAAO;AACjC,SAAO,SAAS;AACT,SAAA;AACT;AAEA,MAAM,OAAa,OAAO,OAAO,QAAQ,EAAE,WAAW,QAAS,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"Strapi.js","sources":["../src/Strapi.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\nimport path from 'path';\nimport _ from 'lodash';\nimport { isFunction } from 'lodash/fp';\nimport { Logger, createLogger } from '@strapi/logger';\nimport { Database } from '@strapi/database';\nimport { hooks } from '@strapi/utils';\nimport type {\n Strapi as StrapiI,\n Server,\n Container,\n EntityService,\n EventHub,\n StartupLogger,\n CronService,\n WebhookStore,\n CoreStore,\n TelemetryService,\n RequestContext,\n CustomFields,\n Fetch,\n StrapiFS,\n StrapiDirectories,\n Reloader,\n EntityValidator,\n Common,\n Shared,\n Schema,\n} from '@strapi/types';\n\nimport loadConfiguration from './core/app-configuration';\n\nimport * as factories from './factories';\nimport compile from './compile';\n\nimport * as utils from './utils';\nimport { createContainer } from './container';\nimport createStrapiFs from './services/fs';\nimport createEventHub from './services/event-hub';\nimport { createServer } from './services/server';\nimport createWebhookRunner, { WebhookRunner } from './services/webhook-runner';\nimport { webhookModel, createWebhookStore } from './services/webhook-store';\nimport { createCoreStore, coreStoreModel } from './services/core-store';\nimport createEntityService from './services/entity-service';\nimport createCronService from './services/cron';\nimport entityValidator from './services/entity-validator';\nimport createTelemetry from './services/metrics';\nimport requestContext from './services/request-context';\nimport createAuth from './services/auth';\nimport createCustomFields from './services/custom-fields';\nimport createContentAPI from './services/content-api';\nimport createUpdateNotifier from './utils/update-notifier';\nimport createStartupLogger from './utils/startup-logger';\nimport { createStrapiFetch } from './utils/fetch';\nimport { LIFECYCLES } from './utils/lifecycles';\nimport ee from './utils/ee';\nimport contentTypesRegistry from './core/registries/content-types';\nimport servicesRegistry from './core/registries/services';\nimport policiesRegistry from './core/registries/policies';\nimport middlewaresRegistry from './core/registries/middlewares';\nimport hooksRegistry from './core/registries/hooks';\nimport controllersRegistry from './core/registries/controllers';\nimport modulesRegistry from './core/registries/modules';\nimport pluginsRegistry from './core/registries/plugins';\nimport customFieldsRegistry from './core/registries/custom-fields';\nimport createConfigProvider from './core/registries/config';\nimport apisRegistry from './core/registries/apis';\nimport bootstrap from './core/bootstrap';\nimport loaders from './core/loaders';\nimport { destroyOnSignal } from './utils/signals';\nimport getNumberOfDynamicZones from './services/utils/dynamic-zones';\nimport sanitizersRegistry from './core/registries/sanitizers';\nimport validatorsRegistry from './core/registries/validators';\nimport convertCustomFieldType from './utils/convert-custom-field-type';\n\n// TODO: move somewhere else\nimport * as draftAndPublishSync from './migrations/draft-publish';\nimport { FeaturesService, createFeaturesService } from './services/features';\n\n/**\n * Resolve the working directories based on the instance options.\n *\n * Behavior:\n * - `appDir` is the directory where Strapi will write every file (schemas, generated APIs, controllers or services)\n * - `distDir` is the directory where Strapi will read configurations, schemas and any compiled code\n *\n * Default values:\n * - If `appDir` is `undefined`, it'll be set to `process.cwd()`\n * - If `distDir` is `undefined`, it'll be set to `appDir`\n */\nconst resolveWorkingDirectories = (opts: { appDir?: string; distDir?: string }) => {\n const cwd = process.cwd();\n\n const appDir = opts.appDir ? path.resolve(cwd, opts.appDir) : cwd;\n const distDir = opts.distDir ? path.resolve(cwd, opts.distDir) : appDir;\n\n return { app: appDir, dist: distDir };\n};\n\nconst reloader = (strapi: Strapi) => {\n const state = {\n shouldReload: 0,\n isWatching: true,\n };\n\n function reload() {\n if (state.shouldReload > 0) {\n // Reset the reloading state\n state.shouldReload -= 1;\n reload.isReloading = false;\n return;\n }\n\n if (strapi.config.get('autoReload')) {\n process.send?.('reload');\n }\n }\n\n Object.defineProperty(reload, 'isWatching', {\n configurable: true,\n enumerable: true,\n set(value) {\n // Special state when the reloader is disabled temporarly (see GraphQL plugin example).\n if (state.isWatching === false && value === true) {\n state.shouldReload += 1;\n }\n state.isWatching = value;\n },\n get() {\n return state.isWatching;\n },\n });\n\n reload.isReloading = false;\n reload.isWatching = true;\n\n return reload;\n};\n\nexport type LoadedStrapi = Required<Strapi>;\n\nclass Strapi implements StrapiI {\n server: Server;\n\n container: Container;\n\n log: Logger;\n\n fs: StrapiFS;\n\n eventHub: EventHub;\n\n startupLogger: StartupLogger;\n\n cron: CronService;\n\n webhookRunner?: WebhookRunner;\n\n webhookStore?: WebhookStore;\n\n store?: CoreStore;\n\n entityValidator?: EntityValidator;\n\n entityService?: EntityService.EntityService;\n\n telemetry: TelemetryService;\n\n requestContext: RequestContext;\n\n customFields: CustomFields.CustomFields;\n\n fetch: Fetch;\n\n dirs: StrapiDirectories;\n\n admin?: Common.Module;\n\n isLoaded: boolean;\n\n db?: Database;\n\n app: any;\n\n EE?: boolean;\n\n components: Shared.Components;\n\n reload: Reloader;\n\n features: FeaturesService;\n\n constructor(opts: StrapiOptions = {}) {\n destroyOnSignal(this);\n\n const rootDirs = resolveWorkingDirectories(opts);\n\n // Load the app configuration from the dist directory\n const appConfig = loadConfiguration(rootDirs, opts);\n\n // Instantiate the Strapi container\n this.container = createContainer(this)\n .register('config', createConfigProvider(appConfig))\n .register('content-types', contentTypesRegistry())\n .register('services', servicesRegistry(this))\n .register('policies', policiesRegistry())\n .register('middlewares', middlewaresRegistry())\n .register('hooks', hooksRegistry())\n .register('controllers', controllersRegistry(this))\n .register('modules', modulesRegistry(this))\n .register('plugins', pluginsRegistry(this))\n .register('custom-fields', customFieldsRegistry(this))\n .register('apis', apisRegistry(this))\n .register('auth', createAuth())\n .register('content-api', createContentAPI(this))\n .register('sanitizers', sanitizersRegistry())\n .register('validators', validatorsRegistry());\n\n this.components = {};\n\n // Create a mapping of every useful directory (for the app, dist and static directories)\n this.dirs = utils.getDirs(rootDirs, { strapi: this });\n\n // Strapi state management variables\n this.isLoaded = false;\n this.reload = reloader(this);\n\n // Instantiate the Koa app & the HTTP server\n this.server = createServer(this);\n\n // Strapi utils instantiation\n this.fs = createStrapiFs(this);\n this.eventHub = createEventHub();\n this.startupLogger = createStartupLogger(this);\n this.log = createLogger(this.config.get('logger', {}));\n this.cron = createCronService();\n this.telemetry = createTelemetry(this);\n this.requestContext = requestContext;\n this.customFields = createCustomFields(this);\n this.fetch = createStrapiFetch(this);\n this.features = createFeaturesService(this);\n\n createUpdateNotifier(this).notify();\n\n Object.defineProperty<Strapi>(this, 'EE', {\n get: () => {\n ee.init(this.dirs.app.root, this.log);\n return ee.isEE;\n },\n configurable: false,\n });\n }\n\n get config() {\n return this.container.get('config');\n }\n\n get services() {\n return this.container.get('services').getAll();\n }\n\n service(uid: Common.UID.Service) {\n return this.container.get('services').get(uid);\n }\n\n get controllers() {\n return this.container.get('controllers').getAll();\n }\n\n controller(uid: Common.UID.Controller) {\n return this.container.get('controllers').get(uid);\n }\n\n get contentTypes(): Shared.ContentTypes {\n return this.container.get('content-types').getAll();\n }\n\n contentType(name: Common.UID.ContentType) {\n return this.container.get('content-types').get(name);\n }\n\n get policies() {\n return this.container.get('policies').getAll();\n }\n\n policy(name: string) {\n return this.container.get('policies').get(name);\n }\n\n get middlewares() {\n return this.container.get('middlewares').getAll();\n }\n\n middleware(name: string) {\n return this.container.get('middlewares').get(name);\n }\n\n get plugins(): Record<string, Common.Plugin> {\n return this.container.get('plugins').getAll();\n }\n\n plugin(name: string): Common.Plugin {\n return this.container.get('plugins').get(name);\n }\n\n get hooks() {\n return this.container.get('hooks').getAll();\n }\n\n hook(name: string) {\n return this.container.get('hooks').get(name);\n }\n\n // api(name) {\n // return this.container.get('apis').get(name);\n // }\n\n get api(): Record<string, Common.Module> {\n return this.container.get('apis').getAll();\n }\n\n get auth() {\n return this.container.get('auth');\n }\n\n get contentAPI() {\n return this.container.get('content-api');\n }\n\n get sanitizers() {\n return this.container.get('sanitizers');\n }\n\n get validators() {\n return this.container.get('validators');\n }\n\n async start() {\n try {\n if (!this.isLoaded) {\n await this.load();\n }\n\n await this.listen();\n\n return this;\n } catch (error) {\n return this.stopWithError(error);\n }\n }\n\n async destroy() {\n await this.server.destroy();\n await this.runLifecyclesFunctions(LIFECYCLES.DESTROY);\n\n this.eventHub.destroy();\n\n await this.db?.destroy();\n\n this.telemetry.destroy();\n this.cron.destroy();\n\n process.removeAllListeners();\n\n // @ts-expect-error: Allow clean delete of global.strapi to allow re-instanciation\n delete global.strapi;\n }\n\n sendStartupTelemetry() {\n // Emit started event.\n // do not await to avoid slower startup\n // This event is anonymous\n this.telemetry\n .send('didStartServer', {\n groupProperties: {\n database: this.config.get('database.connection.client'),\n plugins: Object.keys(this.plugins),\n numberOfAllContentTypes: _.size(this.contentTypes), // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.\n numberOfComponents: _.size(this.components),\n numberOfDynamicZones: getNumberOfDynamicZones(),\n numberOfCustomControllers: Object.values<Common.Controller>(this.controllers).filter(\n // TODO: Fix this at the content API loader level to prevent future types issues\n (controller) => controller !== undefined && factories.isCustomController(controller)\n ).length,\n environment: this.config.environment,\n // TODO: to add back\n // providers: this.config.installedProviders,\n },\n })\n .catch(this.log.error);\n }\n\n async openAdmin({ isInitialized }: { isInitialized: boolean }) {\n const shouldOpenAdmin =\n this.config.get('environment') === 'development' &&\n this.config.get('admin.autoOpen', true) !== false;\n\n if (shouldOpenAdmin && !isInitialized) {\n try {\n await utils.openBrowser(this.config);\n this.telemetry.send('didOpenTab');\n } catch (e) {\n this.telemetry.send('didNotOpenTab');\n }\n }\n }\n\n async postListen() {\n const isInitialized = await utils.isInitialized(this);\n\n this.startupLogger.logStartupMessage({ isInitialized });\n\n this.sendStartupTelemetry();\n this.openAdmin({ isInitialized });\n }\n\n /**\n * Add behaviors to the server\n */\n async listen() {\n return new Promise<void>((resolve, reject) => {\n const onListen = async () => {\n try {\n await this.postListen();\n\n resolve();\n } catch (error) {\n reject(error);\n }\n };\n\n const listenSocket = this.config.get('server.socket');\n\n if (listenSocket) {\n this.server.listen(listenSocket, onListen);\n } else {\n const { host, port } = this.config.get('server');\n\n this.server.listen(port, host, onListen);\n }\n });\n }\n\n stopWithError(err: unknown, customMessage?: string): never {\n this.log.debug(`⛔️ Server wasn't able to start properly.`);\n if (customMessage) {\n this.log.error(customMessage);\n }\n\n this.log.error(err);\n return this.stop();\n }\n\n stop(exitCode = 1): never {\n this.destroy();\n\n if (this.config.get('autoReload')) {\n process.send?.('stop');\n }\n\n // Kill process\n process.exit(exitCode);\n }\n\n async loadAdmin() {\n await loaders.loadAdmin(this);\n }\n\n async loadPlugins() {\n await loaders.loadPlugins(this);\n }\n\n async loadPolicies() {\n await loaders.loadPolicies(this);\n }\n\n async loadAPIs() {\n await loaders.loadAPIs(this);\n }\n\n async loadComponents() {\n this.components = await loaders.loadComponents(this);\n }\n\n async loadMiddlewares() {\n await loaders.loadMiddlewares(this);\n }\n\n async loadApp() {\n this.app = await loaders.loadSrcIndex(this);\n }\n\n async loadSanitizers() {\n await loaders.loadSanitizers(this);\n }\n\n async loadValidators() {\n await loaders.loadValidators(this);\n }\n\n registerInternalHooks() {\n this.container\n .get('hooks')\n .set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n\n this.container\n .get('hooks')\n .set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n this.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n this.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n }\n\n async register() {\n await Promise.all([\n this.loadApp(),\n this.loadSanitizers(),\n this.loadValidators(),\n this.loadPlugins(),\n this.loadAdmin(),\n this.loadAPIs(),\n this.loadComponents(),\n this.loadMiddlewares(),\n this.loadPolicies(),\n ]);\n\n await bootstrap({ strapi: this });\n\n // init webhook runner\n this.webhookRunner = createWebhookRunner({\n eventHub: this.eventHub,\n logger: this.log,\n configuration: this.config.get('server.webhooks', {}),\n fetch: this.fetch,\n });\n\n this.registerInternalHooks();\n\n this.telemetry.register();\n\n await this.runLifecyclesFunctions(LIFECYCLES.REGISTER);\n // NOTE: Swap type customField for underlying data type\n convertCustomFieldType(this);\n\n return this;\n }\n\n async bootstrap() {\n const contentTypes = [\n coreStoreModel,\n webhookModel,\n ...Object.values(this.contentTypes),\n ...Object.values(this.components),\n ];\n\n this.db = await Database.init({\n ...this.config.get('database'),\n models: Database.transformContentTypes(contentTypes),\n });\n\n this.store = createCoreStore({ db: this.db });\n this.webhookStore = createWebhookStore({ db: this.db });\n\n this.entityValidator = entityValidator;\n this.entityService = createEntityService({\n strapi: this,\n db: this.db,\n eventHub: this.eventHub,\n entityValidator: this.entityValidator,\n });\n\n if (this.config.get('server.cron.enabled', true)) {\n const cronTasks = this.config.get('server.cron.tasks', {});\n this.cron.add(cronTasks);\n }\n\n this.telemetry.bootstrap();\n\n let oldContentTypes;\n if (await this.db.getSchemaConnection().hasTable(coreStoreModel.collectionName)) {\n oldContentTypes = await this.store.get({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n });\n }\n\n await this.hook('strapi::content-types.beforeSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n const status = await this.db.schema.sync();\n\n // if schemas have changed, run repairs\n if (status === 'CHANGED') {\n await this.db.repair.removeOrphanMorphType({ pivot: 'component_type' });\n }\n\n if (this.EE) {\n await ee.checkLicense({ strapi: this });\n }\n\n await this.hook('strapi::content-types.afterSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n await this.store.set({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n value: this.contentTypes,\n });\n\n await this.startWebhooks();\n\n await this.server.initMiddlewares();\n this.server.initRouting();\n\n await this.contentAPI.permissions.registerActions();\n\n await this.runLifecyclesFunctions(LIFECYCLES.BOOTSTRAP);\n\n this.cron.start();\n\n return this;\n }\n\n async load() {\n await this.register();\n await this.bootstrap();\n\n this.isLoaded = true;\n\n return this as this & Required<StrapiI>;\n }\n\n async startWebhooks() {\n const webhooks = await this.webhookStore?.findWebhooks();\n if (!webhooks) {\n return;\n }\n\n for (const webhook of webhooks) {\n this.webhookRunner?.add(webhook);\n }\n }\n\n async runLifecyclesFunctions(lifecycleName: 'register' | 'bootstrap' | 'destroy') {\n // plugins\n await this.container.get('modules')[lifecycleName]();\n\n // admin\n const adminLifecycleFunction = this.admin && this.admin[lifecycleName];\n if (isFunction(adminLifecycleFunction)) {\n await adminLifecycleFunction({ strapi: this });\n }\n\n // user\n const userLifecycleFunction = this.app && this.app[lifecycleName];\n if (isFunction(userLifecycleFunction)) {\n await userLifecycleFunction({ strapi: this });\n }\n }\n\n getModel(uid: Common.UID.ContentType): Schema.ContentType;\n getModel(uid: Common.UID.Component): Schema.Component;\n getModel<TUID extends Common.UID.Schema>(\n uid: TUID\n ): Schema.ContentType | Schema.Component | undefined {\n if (uid in this.contentTypes) {\n return this.contentTypes[uid as Common.UID.ContentType];\n }\n\n if (uid in this.components) {\n return this.components[uid as Common.UID.Component];\n }\n }\n\n /**\n * Binds queries with a specific model\n * @param {string} uid\n */\n query(uid: Common.UID.Schema) {\n return this.db!.query(uid);\n }\n}\n\ninterface StrapiOptions {\n appDir?: string;\n distDir?: string;\n autoReload?: boolean;\n serveAdminPanel?: boolean;\n}\n\ninterface Init {\n (options?: StrapiOptions): Strapi;\n factories: typeof factories;\n compile: typeof compile;\n}\n\nconst initFn = (options: StrapiOptions = {}) => {\n const strapi = new Strapi(options);\n global.strapi = strapi as LoadedStrapi;\n return strapi;\n};\n\nconst init: Init = Object.assign(initFn, { factories, compile });\n\nexport default init;\n"],"names":["path","destroyOnSignal","loadConfiguration","createContainer","createConfigProvider","contentTypesRegistry","servicesRegistry","policiesRegistry","middlewaresRegistry","hooksRegistry","controllersRegistry","modulesRegistry","pluginsRegistry","customFieldsRegistry","apisRegistry","createAuth","createContentAPI","sanitizersRegistry","validatorsRegistry","utils.getDirs","createServer","createStrapiFs","createEventHub","createStartupLogger","createLogger","createCronService","createTelemetry","createCustomFields","createStrapiFetch","createFeaturesService","createUpdateNotifier","ee","LIFECYCLES","_","getNumberOfDynamicZones","factories.isCustomController","isInitialized","utils.openBrowser","utils.isInitialized","loaders","hooks","draftAndPublishSync.disable","draftAndPublishSync.enable","createWebhookRunner","contentTypes","coreStoreModel","webhookModel","Database","createCoreStore","createWebhookStore","entityValidator","createEntityService","isFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,MAAM,4BAA4B,CAAC,SAAgD;AACjF,QAAM,MAAM,QAAQ,IAAA;AAEpB,QAAM,SAAS,KAAK,SAASA,cAAAA,QAAK,QAAQ,KAAK,KAAK,MAAM,IAAI;AAC9D,QAAM,UAAU,KAAK,UAAUA,cAAAA,QAAK,QAAQ,KAAK,KAAK,OAAO,IAAI;AAEjE,SAAO,EAAE,KAAK,QAAQ,MAAM,QAAA;AAC9B;AAEA,MAAM,WAAW,CAAC,WAAmB;AACnC,QAAM,QAAQ;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,EAAA;AAGd,WAA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AAW,UAAU;AAC9B,WAAK,eAAe,IAAI,OAAO;AAAA,IACjC;AAAA,EACF;AAAA,EAEA,MAAM,uBAAuB,eAAqD;AAEhF,UAAM,KAAK,UAAU,IAAI,SAAS,EAAE,aAAa,EAAA;AAGjD,UAAM,yBAAyB,KAAK,SAAS,KAAK,MAAM,aAAa;AACrE,QAAIoB,GAAAA,WAAW,sBAAsB,GAAG;AACtC,YAAM,uBAAuB,EAAE,QAAQ,MAAM;AAAA,IAC/C;AAGA,UAAM,wBAAwB,KAAK,OAAO,KAAK,IAAI,aAAa;AAChE,QAAIA,GAAAA,WAAW,qBAAqB,GAAG;AACrC,YAAM,sBAAsB,EAAE,QAAQ,MAAM;AAAA,IAC9C;AAAA,EACF;AAAA,EAIA,SACE,KACmD;AACnD,QAAI,OAAO,KAAK,cAAc;AAC5B,aAAO,KAAK,aAAa,GAA6B;AAAA,IACxD;AAEA,QAAI,OAAO,KAAK,YAAY;AAC1B,aAAO,KAAK,WAAW,GAA2B;AAAA,IACpD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,KAAwB;AAC5B,WAAO,KAAK,GAAI,MAAM,GAAG;AAAA,EAC3B;AACF;AAeA,MAAM,SAAS,CAAC,UAAyB,OAAO;AAC9C,QAAM,SAAS,IAAI,OAAO,OAAO;AACjC,SAAO,SAAS;AAChB,SAAO;AACT;AAEA,MAAM,OAAa,OAAO,OAAO,QAAQ,EAAE,WAAW,SAAS;;"}
|
package/dist/Strapi.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Strapi.mjs","sources":["../src/Strapi.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\nimport path from 'path';\nimport _ from 'lodash';\nimport { isFunction } from 'lodash/fp';\nimport { Logger, createLogger } from '@strapi/logger';\nimport { Database } from '@strapi/database';\nimport { hooks } from '@strapi/utils';\nimport type {\n Strapi as StrapiI,\n Server,\n Container,\n EntityService,\n EventHub,\n StartupLogger,\n CronService,\n WebhookStore,\n CoreStore,\n TelemetryService,\n RequestContext,\n CustomFields,\n Fetch,\n StrapiFS,\n StrapiDirectories,\n Reloader,\n EntityValidator,\n Common,\n Shared,\n Schema,\n} from '@strapi/types';\n\nimport loadConfiguration from './core/app-configuration';\n\nimport * as factories from './factories';\nimport compile from './compile';\n\nimport * as utils from './utils';\nimport { createContainer } from './container';\nimport createStrapiFs from './services/fs';\nimport createEventHub from './services/event-hub';\nimport { createServer } from './services/server';\nimport createWebhookRunner, { WebhookRunner } from './services/webhook-runner';\nimport { webhookModel, createWebhookStore } from './services/webhook-store';\nimport { createCoreStore, coreStoreModel } from './services/core-store';\nimport createEntityService from './services/entity-service';\nimport createCronService from './services/cron';\nimport entityValidator from './services/entity-validator';\nimport createTelemetry from './services/metrics';\nimport requestContext from './services/request-context';\nimport createAuth from './services/auth';\nimport createCustomFields from './services/custom-fields';\nimport createContentAPI from './services/content-api';\nimport createUpdateNotifier from './utils/update-notifier';\nimport createStartupLogger from './utils/startup-logger';\nimport { createStrapiFetch } from './utils/fetch';\nimport { LIFECYCLES } from './utils/lifecycles';\nimport ee from './utils/ee';\nimport contentTypesRegistry from './core/registries/content-types';\nimport servicesRegistry from './core/registries/services';\nimport policiesRegistry from './core/registries/policies';\nimport middlewaresRegistry from './core/registries/middlewares';\nimport hooksRegistry from './core/registries/hooks';\nimport controllersRegistry from './core/registries/controllers';\nimport modulesRegistry from './core/registries/modules';\nimport pluginsRegistry from './core/registries/plugins';\nimport customFieldsRegistry from './core/registries/custom-fields';\nimport createConfigProvider from './core/registries/config';\nimport apisRegistry from './core/registries/apis';\nimport bootstrap from './core/bootstrap';\nimport loaders from './core/loaders';\nimport { destroyOnSignal } from './utils/signals';\nimport getNumberOfDynamicZones from './services/utils/dynamic-zones';\nimport sanitizersRegistry from './core/registries/sanitizers';\nimport validatorsRegistry from './core/registries/validators';\nimport convertCustomFieldType from './utils/convert-custom-field-type';\n\n// TODO: move somewhere else\nimport * as draftAndPublishSync from './migrations/draft-publish';\nimport { FeaturesService, createFeaturesService } from './services/features';\n\n/**\n * Resolve the working directories based on the instance options.\n *\n * Behavior:\n * - `appDir` is the directory where Strapi will write every file (schemas, generated APIs, controllers or services)\n * - `distDir` is the directory where Strapi will read configurations, schemas and any compiled code\n *\n * Default values:\n * - If `appDir` is `undefined`, it'll be set to `process.cwd()`\n * - If `distDir` is `undefined`, it'll be set to `appDir`\n */\nconst resolveWorkingDirectories = (opts: { appDir?: string; distDir?: string }) => {\n const cwd = process.cwd();\n\n const appDir = opts.appDir ? path.resolve(cwd, opts.appDir) : cwd;\n const distDir = opts.distDir ? path.resolve(cwd, opts.distDir) : appDir;\n\n return { app: appDir, dist: distDir };\n};\n\nconst reloader = (strapi: Strapi) => {\n const state = {\n shouldReload: 0,\n isWatching: true,\n };\n\n function reload() {\n if (state.shouldReload > 0) {\n // Reset the reloading state\n state.shouldReload -= 1;\n reload.isReloading = false;\n return;\n }\n\n if (strapi.config.get('autoReload')) {\n process.send?.('reload');\n }\n }\n\n Object.defineProperty(reload, 'isWatching', {\n configurable: true,\n enumerable: true,\n set(value) {\n // Special state when the reloader is disabled temporarly (see GraphQL plugin example).\n if (state.isWatching === false && value === true) {\n state.shouldReload += 1;\n }\n state.isWatching = value;\n },\n get() {\n return state.isWatching;\n },\n });\n\n reload.isReloading = false;\n reload.isWatching = true;\n\n return reload;\n};\n\nexport type LoadedStrapi = Required<Strapi>;\n\nclass Strapi implements StrapiI {\n server: Server;\n\n container: Container;\n\n log: Logger;\n\n fs: StrapiFS;\n\n eventHub: EventHub;\n\n startupLogger: StartupLogger;\n\n cron: CronService;\n\n webhookRunner?: WebhookRunner;\n\n webhookStore?: WebhookStore;\n\n store?: CoreStore;\n\n entityValidator?: EntityValidator;\n\n entityService?: EntityService.EntityService;\n\n telemetry: TelemetryService;\n\n requestContext: RequestContext;\n\n customFields: CustomFields.CustomFields;\n\n fetch: Fetch;\n\n dirs: StrapiDirectories;\n\n admin?: Common.Module;\n\n isLoaded: boolean;\n\n db?: Database;\n\n app: any;\n\n EE?: boolean;\n\n components: Shared.Components;\n\n reload: Reloader;\n\n features: FeaturesService;\n\n constructor(opts: StrapiOptions = {}) {\n destroyOnSignal(this);\n\n const rootDirs = resolveWorkingDirectories(opts);\n\n // Load the app configuration from the dist directory\n const appConfig = loadConfiguration(rootDirs, opts);\n\n // Instantiate the Strapi container\n this.container = createContainer(this)\n .register('config', createConfigProvider(appConfig))\n .register('content-types', contentTypesRegistry())\n .register('services', servicesRegistry(this))\n .register('policies', policiesRegistry())\n .register('middlewares', middlewaresRegistry())\n .register('hooks', hooksRegistry())\n .register('controllers', controllersRegistry(this))\n .register('modules', modulesRegistry(this))\n .register('plugins', pluginsRegistry(this))\n .register('custom-fields', customFieldsRegistry(this))\n .register('apis', apisRegistry(this))\n .register('auth', createAuth())\n .register('content-api', createContentAPI(this))\n .register('sanitizers', sanitizersRegistry())\n .register('validators', validatorsRegistry());\n\n this.components = {};\n\n // Create a mapping of every useful directory (for the app, dist and static directories)\n this.dirs = utils.getDirs(rootDirs, { strapi: this });\n\n // Strapi state management variables\n this.isLoaded = false;\n this.reload = reloader(this);\n\n // Instantiate the Koa app & the HTTP server\n this.server = createServer(this);\n\n // Strapi utils instantiation\n this.fs = createStrapiFs(this);\n this.eventHub = createEventHub();\n this.startupLogger = createStartupLogger(this);\n this.log = createLogger(this.config.get('logger', {}));\n this.cron = createCronService();\n this.telemetry = createTelemetry(this);\n this.requestContext = requestContext;\n this.customFields = createCustomFields(this);\n this.fetch = createStrapiFetch(this);\n this.features = createFeaturesService(this);\n\n createUpdateNotifier(this).notify();\n\n Object.defineProperty<Strapi>(this, 'EE', {\n get: () => {\n ee.init(this.dirs.app.root, this.log);\n return ee.isEE;\n },\n configurable: false,\n });\n }\n\n get config() {\n return this.container.get('config');\n }\n\n get services() {\n return this.container.get('services').getAll();\n }\n\n service(uid: Common.UID.Service) {\n return this.container.get('services').get(uid);\n }\n\n get controllers() {\n return this.container.get('controllers').getAll();\n }\n\n controller(uid: Common.UID.Controller) {\n return this.container.get('controllers').get(uid);\n }\n\n get contentTypes(): Shared.ContentTypes {\n return this.container.get('content-types').getAll();\n }\n\n contentType(name: Common.UID.ContentType) {\n return this.container.get('content-types').get(name);\n }\n\n get policies() {\n return this.container.get('policies').getAll();\n }\n\n policy(name: string) {\n return this.container.get('policies').get(name);\n }\n\n get middlewares() {\n return this.container.get('middlewares').getAll();\n }\n\n middleware(name: string) {\n return this.container.get('middlewares').get(name);\n }\n\n get plugins(): Record<string, Common.Plugin> {\n return this.container.get('plugins').getAll();\n }\n\n plugin(name: string): Common.Plugin {\n return this.container.get('plugins').get(name);\n }\n\n get hooks() {\n return this.container.get('hooks').getAll();\n }\n\n hook(name: string) {\n return this.container.get('hooks').get(name);\n }\n\n // api(name) {\n // return this.container.get('apis').get(name);\n // }\n\n get api(): Record<string, Common.Module> {\n return this.container.get('apis').getAll();\n }\n\n get auth() {\n return this.container.get('auth');\n }\n\n get contentAPI() {\n return this.container.get('content-api');\n }\n\n get sanitizers() {\n return this.container.get('sanitizers');\n }\n\n get validators() {\n return this.container.get('validators');\n }\n\n async start() {\n try {\n if (!this.isLoaded) {\n await this.load();\n }\n\n await this.listen();\n\n return this;\n } catch (error) {\n return this.stopWithError(error);\n }\n }\n\n async destroy() {\n await this.server.destroy();\n await this.runLifecyclesFunctions(LIFECYCLES.DESTROY);\n\n this.eventHub.destroy();\n\n await this.db?.destroy();\n\n this.telemetry.destroy();\n this.cron.destroy();\n\n process.removeAllListeners();\n\n // @ts-expect-error: Allow clean delete of global.strapi to allow re-instanciation\n delete global.strapi;\n }\n\n sendStartupTelemetry() {\n // Emit started event.\n // do not await to avoid slower startup\n // This event is anonymous\n this.telemetry\n .send('didStartServer', {\n groupProperties: {\n database: this.config.get('database.connection.client'),\n plugins: Object.keys(this.plugins),\n numberOfAllContentTypes: _.size(this.contentTypes), // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.\n numberOfComponents: _.size(this.components),\n numberOfDynamicZones: getNumberOfDynamicZones(),\n numberOfCustomControllers: Object.values<Common.Controller>(this.controllers).filter(\n // TODO: Fix this at the content API loader level to prevent future types issues\n (controller) => controller !== undefined && factories.isCustomController(controller)\n ).length,\n environment: this.config.environment,\n // TODO: to add back\n // providers: this.config.installedProviders,\n },\n })\n .catch(this.log.error);\n }\n\n async openAdmin({ isInitialized }: { isInitialized: boolean }) {\n const shouldOpenAdmin =\n this.config.get('environment') === 'development' &&\n this.config.get('admin.autoOpen', true) !== false;\n\n if (shouldOpenAdmin && !isInitialized) {\n try {\n await utils.openBrowser(this.config);\n this.telemetry.send('didOpenTab');\n } catch (e) {\n this.telemetry.send('didNotOpenTab');\n }\n }\n }\n\n async postListen() {\n const isInitialized = await utils.isInitialized(this);\n\n this.startupLogger.logStartupMessage({ isInitialized });\n\n this.sendStartupTelemetry();\n this.openAdmin({ isInitialized });\n }\n\n /**\n * Add behaviors to the server\n */\n async listen() {\n return new Promise<void>((resolve, reject) => {\n const onListen = async () => {\n try {\n await this.postListen();\n\n resolve();\n } catch (error) {\n reject(error);\n }\n };\n\n const listenSocket = this.config.get('server.socket');\n\n if (listenSocket) {\n this.server.listen(listenSocket, onListen);\n } else {\n const { host, port } = this.config.get('server');\n\n this.server.listen(port, host, onListen);\n }\n });\n }\n\n stopWithError(err: unknown, customMessage?: string): never {\n this.log.debug(`⛔️ Server wasn't able to start properly.`);\n if (customMessage) {\n this.log.error(customMessage);\n }\n\n this.log.error(err);\n return this.stop();\n }\n\n stop(exitCode = 1): never {\n this.destroy();\n\n if (this.config.get('autoReload')) {\n process.send?.('stop');\n }\n\n // Kill process\n process.exit(exitCode);\n }\n\n async loadAdmin() {\n await loaders.loadAdmin(this);\n }\n\n async loadPlugins() {\n await loaders.loadPlugins(this);\n }\n\n async loadPolicies() {\n await loaders.loadPolicies(this);\n }\n\n async loadAPIs() {\n await loaders.loadAPIs(this);\n }\n\n async loadComponents() {\n this.components = await loaders.loadComponents(this);\n }\n\n async loadMiddlewares() {\n await loaders.loadMiddlewares(this);\n }\n\n async loadApp() {\n this.app = await loaders.loadSrcIndex(this);\n }\n\n async loadSanitizers() {\n await loaders.loadSanitizers(this);\n }\n\n async loadValidators() {\n await loaders.loadValidators(this);\n }\n\n registerInternalHooks() {\n this.container\n .get('hooks')\n .set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n\n this.container\n .get('hooks')\n .set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n this.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n this.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n }\n\n async register() {\n await Promise.all([\n this.loadApp(),\n this.loadSanitizers(),\n this.loadValidators(),\n this.loadPlugins(),\n this.loadAdmin(),\n this.loadAPIs(),\n this.loadComponents(),\n this.loadMiddlewares(),\n this.loadPolicies(),\n ]);\n\n await bootstrap({ strapi: this });\n\n // init webhook runner\n this.webhookRunner = createWebhookRunner({\n eventHub: this.eventHub,\n logger: this.log,\n configuration: this.config.get('server.webhooks', {}),\n fetch: this.fetch,\n });\n\n this.registerInternalHooks();\n\n this.telemetry.register();\n\n await this.runLifecyclesFunctions(LIFECYCLES.REGISTER);\n // NOTE: Swap type customField for underlying data type\n convertCustomFieldType(this);\n\n return this;\n }\n\n async bootstrap() {\n const contentTypes = [\n coreStoreModel,\n webhookModel,\n ...Object.values(this.contentTypes),\n ...Object.values(this.components),\n ];\n\n this.db = await Database.init({\n ...this.config.get('database'),\n models: Database.transformContentTypes(contentTypes),\n });\n\n this.store = createCoreStore({ db: this.db });\n this.webhookStore = createWebhookStore({ db: this.db });\n\n this.entityValidator = entityValidator;\n this.entityService = createEntityService({\n strapi: this,\n db: this.db,\n eventHub: this.eventHub,\n entityValidator: this.entityValidator,\n });\n\n if (this.config.get('server.cron.enabled', true)) {\n const cronTasks = this.config.get('server.cron.tasks', {});\n this.cron.add(cronTasks);\n }\n\n this.telemetry.bootstrap();\n\n let oldContentTypes;\n if (await this.db.getSchemaConnection().hasTable(coreStoreModel.collectionName)) {\n oldContentTypes = await this.store.get({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n });\n }\n\n await this.hook('strapi::content-types.beforeSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n const status = await this.db.schema.sync();\n\n // if schemas have changed, run repairs\n if (status === 'CHANGED') {\n await this.db.repair.removeOrphanMorphType({ pivot: 'component_type' });\n }\n\n if (this.EE) {\n await ee.checkLicense({ strapi: this });\n }\n\n await this.hook('strapi::content-types.afterSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n await this.store.set({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n value: this.contentTypes,\n });\n\n await this.startWebhooks();\n\n await this.server.initMiddlewares();\n this.server.initRouting();\n\n await this.contentAPI.permissions.registerActions();\n\n await this.runLifecyclesFunctions(LIFECYCLES.BOOTSTRAP);\n\n this.cron.start();\n\n return this;\n }\n\n async load() {\n await this.register();\n await this.bootstrap();\n\n this.isLoaded = true;\n\n return this as this & Required<StrapiI>;\n }\n\n async startWebhooks() {\n const webhooks = await this.webhookStore?.findWebhooks();\n if (!webhooks) {\n return;\n }\n\n for (const webhook of webhooks) {\n this.webhookRunner?.add(webhook);\n }\n }\n\n async runLifecyclesFunctions(lifecycleName: 'register' | 'bootstrap' | 'destroy') {\n // plugins\n await this.container.get('modules')[lifecycleName]();\n\n // admin\n const adminLifecycleFunction = this.admin && this.admin[lifecycleName];\n if (isFunction(adminLifecycleFunction)) {\n await adminLifecycleFunction({ strapi: this });\n }\n\n // user\n const userLifecycleFunction = this.app && this.app[lifecycleName];\n if (isFunction(userLifecycleFunction)) {\n await userLifecycleFunction({ strapi: this });\n }\n }\n\n getModel(uid: Common.UID.ContentType): Schema.ContentType;\n getModel(uid: Common.UID.Component): Schema.Component;\n getModel<TUID extends Common.UID.Schema>(\n uid: TUID\n ): Schema.ContentType | Schema.Component | undefined {\n if (uid in this.contentTypes) {\n return this.contentTypes[uid as Common.UID.ContentType];\n }\n\n if (uid in this.components) {\n return this.components[uid as Common.UID.Component];\n }\n }\n\n /**\n * Binds queries with a specific model\n * @param {string} uid\n */\n query(uid: Common.UID.Schema) {\n return this.db!.query(uid);\n }\n}\n\ninterface StrapiOptions {\n appDir?: string;\n distDir?: string;\n autoReload?: boolean;\n serveAdminPanel?: boolean;\n}\n\ninterface Init {\n (options?: StrapiOptions): Strapi;\n factories: typeof factories;\n compile: typeof compile;\n}\n\nconst initFn = (options: StrapiOptions = {}) => {\n const strapi = new Strapi(options);\n global.strapi = strapi as LoadedStrapi;\n return strapi;\n};\n\nconst init: Init = Object.assign(initFn, { factories, compile });\n\nexport default init;\n"],"names":["createAuth","utils.getDirs","createTelemetry","requestContext","ee","factories.isCustomController","isInitialized","utils.openBrowser","utils.isInitialized","draftAndPublishSync.disable","draftAndPublishSync.enable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,MAAM,4BAA4B,CAAC,SAAgD;AAC3E,QAAA,MAAM,QAAQ;AAEd,QAAA,SAAS,KAAK,SAAS,KAAK,QAAQ,KAAK,KAAK,MAAM,IAAI;AACxD,QAAA,UAAU,KAAK,UAAU,KAAK,QAAQ,KAAK,KAAK,OAAO,IAAI;AAEjE,SAAO,EAAE,KAAK,QAAQ,MAAM,QAAQ;AACtC;AAEA,MAAM,WAAW,CAAC,WAAmB;AACnC,QAAM,QAAQ;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,EAAA;AAGd,WAAS,SAAS;AACZ,QAAA,MAAM,eAAe,GAAG;AAE1B,YAAM,gBAAgB;AACtB,aAAO,cAAc;AACrB;AAAA,IACF;AAEA,QAAI,OAAO,OAAO,IAAI,YAAY,GAAG;AACnC,cAAQ,OAAO,QAAQ;AAAA,IACzB;AAAA,EACF;AAEO,SAAA,eAAe,QAAQ,cAAc;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AAY;AACnB,aAAA,KAAK,WAAW,GAA2B;AAAA,IACpD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,KAAwB;AACrB,WAAA,KAAK,GAAI,MAAM,GAAG;AAAA,EAC3B;AACF;AAeA,MAAM,SAAS,CAAC,UAAyB,OAAO;AACxC,QAAA,SAAS,IAAI,OAAO,OAAO;AACjC,SAAO,SAAS;AACT,SAAA;AACT;AAEA,MAAM,OAAa,OAAO,OAAO,QAAQ,EAAE,WAAW,QAAS,CAAA;"}
|
|
1
|
+
{"version":3,"file":"Strapi.mjs","sources":["../src/Strapi.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\nimport path from 'path';\nimport _ from 'lodash';\nimport { isFunction } from 'lodash/fp';\nimport { Logger, createLogger } from '@strapi/logger';\nimport { Database } from '@strapi/database';\nimport { hooks } from '@strapi/utils';\nimport type {\n Strapi as StrapiI,\n Server,\n Container,\n EntityService,\n EventHub,\n StartupLogger,\n CronService,\n WebhookStore,\n CoreStore,\n TelemetryService,\n RequestContext,\n CustomFields,\n Fetch,\n StrapiFS,\n StrapiDirectories,\n Reloader,\n EntityValidator,\n Common,\n Shared,\n Schema,\n} from '@strapi/types';\n\nimport loadConfiguration from './core/app-configuration';\n\nimport * as factories from './factories';\nimport compile from './compile';\n\nimport * as utils from './utils';\nimport { createContainer } from './container';\nimport createStrapiFs from './services/fs';\nimport createEventHub from './services/event-hub';\nimport { createServer } from './services/server';\nimport createWebhookRunner, { WebhookRunner } from './services/webhook-runner';\nimport { webhookModel, createWebhookStore } from './services/webhook-store';\nimport { createCoreStore, coreStoreModel } from './services/core-store';\nimport createEntityService from './services/entity-service';\nimport createCronService from './services/cron';\nimport entityValidator from './services/entity-validator';\nimport createTelemetry from './services/metrics';\nimport requestContext from './services/request-context';\nimport createAuth from './services/auth';\nimport createCustomFields from './services/custom-fields';\nimport createContentAPI from './services/content-api';\nimport createUpdateNotifier from './utils/update-notifier';\nimport createStartupLogger from './utils/startup-logger';\nimport { createStrapiFetch } from './utils/fetch';\nimport { LIFECYCLES } from './utils/lifecycles';\nimport ee from './utils/ee';\nimport contentTypesRegistry from './core/registries/content-types';\nimport servicesRegistry from './core/registries/services';\nimport policiesRegistry from './core/registries/policies';\nimport middlewaresRegistry from './core/registries/middlewares';\nimport hooksRegistry from './core/registries/hooks';\nimport controllersRegistry from './core/registries/controllers';\nimport modulesRegistry from './core/registries/modules';\nimport pluginsRegistry from './core/registries/plugins';\nimport customFieldsRegistry from './core/registries/custom-fields';\nimport createConfigProvider from './core/registries/config';\nimport apisRegistry from './core/registries/apis';\nimport bootstrap from './core/bootstrap';\nimport loaders from './core/loaders';\nimport { destroyOnSignal } from './utils/signals';\nimport getNumberOfDynamicZones from './services/utils/dynamic-zones';\nimport sanitizersRegistry from './core/registries/sanitizers';\nimport validatorsRegistry from './core/registries/validators';\nimport convertCustomFieldType from './utils/convert-custom-field-type';\n\n// TODO: move somewhere else\nimport * as draftAndPublishSync from './migrations/draft-publish';\nimport { FeaturesService, createFeaturesService } from './services/features';\n\n/**\n * Resolve the working directories based on the instance options.\n *\n * Behavior:\n * - `appDir` is the directory where Strapi will write every file (schemas, generated APIs, controllers or services)\n * - `distDir` is the directory where Strapi will read configurations, schemas and any compiled code\n *\n * Default values:\n * - If `appDir` is `undefined`, it'll be set to `process.cwd()`\n * - If `distDir` is `undefined`, it'll be set to `appDir`\n */\nconst resolveWorkingDirectories = (opts: { appDir?: string; distDir?: string }) => {\n const cwd = process.cwd();\n\n const appDir = opts.appDir ? path.resolve(cwd, opts.appDir) : cwd;\n const distDir = opts.distDir ? path.resolve(cwd, opts.distDir) : appDir;\n\n return { app: appDir, dist: distDir };\n};\n\nconst reloader = (strapi: Strapi) => {\n const state = {\n shouldReload: 0,\n isWatching: true,\n };\n\n function reload() {\n if (state.shouldReload > 0) {\n // Reset the reloading state\n state.shouldReload -= 1;\n reload.isReloading = false;\n return;\n }\n\n if (strapi.config.get('autoReload')) {\n process.send?.('reload');\n }\n }\n\n Object.defineProperty(reload, 'isWatching', {\n configurable: true,\n enumerable: true,\n set(value) {\n // Special state when the reloader is disabled temporarly (see GraphQL plugin example).\n if (state.isWatching === false && value === true) {\n state.shouldReload += 1;\n }\n state.isWatching = value;\n },\n get() {\n return state.isWatching;\n },\n });\n\n reload.isReloading = false;\n reload.isWatching = true;\n\n return reload;\n};\n\nexport type LoadedStrapi = Required<Strapi>;\n\nclass Strapi implements StrapiI {\n server: Server;\n\n container: Container;\n\n log: Logger;\n\n fs: StrapiFS;\n\n eventHub: EventHub;\n\n startupLogger: StartupLogger;\n\n cron: CronService;\n\n webhookRunner?: WebhookRunner;\n\n webhookStore?: WebhookStore;\n\n store?: CoreStore;\n\n entityValidator?: EntityValidator;\n\n entityService?: EntityService.EntityService;\n\n telemetry: TelemetryService;\n\n requestContext: RequestContext;\n\n customFields: CustomFields.CustomFields;\n\n fetch: Fetch;\n\n dirs: StrapiDirectories;\n\n admin?: Common.Module;\n\n isLoaded: boolean;\n\n db?: Database;\n\n app: any;\n\n EE?: boolean;\n\n components: Shared.Components;\n\n reload: Reloader;\n\n features: FeaturesService;\n\n constructor(opts: StrapiOptions = {}) {\n destroyOnSignal(this);\n\n const rootDirs = resolveWorkingDirectories(opts);\n\n // Load the app configuration from the dist directory\n const appConfig = loadConfiguration(rootDirs, opts);\n\n // Instantiate the Strapi container\n this.container = createContainer(this)\n .register('config', createConfigProvider(appConfig))\n .register('content-types', contentTypesRegistry())\n .register('services', servicesRegistry(this))\n .register('policies', policiesRegistry())\n .register('middlewares', middlewaresRegistry())\n .register('hooks', hooksRegistry())\n .register('controllers', controllersRegistry(this))\n .register('modules', modulesRegistry(this))\n .register('plugins', pluginsRegistry(this))\n .register('custom-fields', customFieldsRegistry(this))\n .register('apis', apisRegistry(this))\n .register('auth', createAuth())\n .register('content-api', createContentAPI(this))\n .register('sanitizers', sanitizersRegistry())\n .register('validators', validatorsRegistry());\n\n this.components = {};\n\n // Create a mapping of every useful directory (for the app, dist and static directories)\n this.dirs = utils.getDirs(rootDirs, { strapi: this });\n\n // Strapi state management variables\n this.isLoaded = false;\n this.reload = reloader(this);\n\n // Instantiate the Koa app & the HTTP server\n this.server = createServer(this);\n\n // Strapi utils instantiation\n this.fs = createStrapiFs(this);\n this.eventHub = createEventHub();\n this.startupLogger = createStartupLogger(this);\n this.log = createLogger(this.config.get('logger', {}));\n this.cron = createCronService();\n this.telemetry = createTelemetry(this);\n this.requestContext = requestContext;\n this.customFields = createCustomFields(this);\n this.fetch = createStrapiFetch(this);\n this.features = createFeaturesService(this);\n\n createUpdateNotifier(this).notify();\n\n Object.defineProperty<Strapi>(this, 'EE', {\n get: () => {\n ee.init(this.dirs.app.root, this.log);\n return ee.isEE;\n },\n configurable: false,\n });\n }\n\n get config() {\n return this.container.get('config');\n }\n\n get services() {\n return this.container.get('services').getAll();\n }\n\n service(uid: Common.UID.Service) {\n return this.container.get('services').get(uid);\n }\n\n get controllers() {\n return this.container.get('controllers').getAll();\n }\n\n controller(uid: Common.UID.Controller) {\n return this.container.get('controllers').get(uid);\n }\n\n get contentTypes(): Shared.ContentTypes {\n return this.container.get('content-types').getAll();\n }\n\n contentType(name: Common.UID.ContentType) {\n return this.container.get('content-types').get(name);\n }\n\n get policies() {\n return this.container.get('policies').getAll();\n }\n\n policy(name: string) {\n return this.container.get('policies').get(name);\n }\n\n get middlewares() {\n return this.container.get('middlewares').getAll();\n }\n\n middleware(name: string) {\n return this.container.get('middlewares').get(name);\n }\n\n get plugins(): Record<string, Common.Plugin> {\n return this.container.get('plugins').getAll();\n }\n\n plugin(name: string): Common.Plugin {\n return this.container.get('plugins').get(name);\n }\n\n get hooks() {\n return this.container.get('hooks').getAll();\n }\n\n hook(name: string) {\n return this.container.get('hooks').get(name);\n }\n\n // api(name) {\n // return this.container.get('apis').get(name);\n // }\n\n get api(): Record<string, Common.Module> {\n return this.container.get('apis').getAll();\n }\n\n get auth() {\n return this.container.get('auth');\n }\n\n get contentAPI() {\n return this.container.get('content-api');\n }\n\n get sanitizers() {\n return this.container.get('sanitizers');\n }\n\n get validators() {\n return this.container.get('validators');\n }\n\n async start() {\n try {\n if (!this.isLoaded) {\n await this.load();\n }\n\n await this.listen();\n\n return this;\n } catch (error) {\n return this.stopWithError(error);\n }\n }\n\n async destroy() {\n await this.server.destroy();\n await this.runLifecyclesFunctions(LIFECYCLES.DESTROY);\n\n this.eventHub.destroy();\n\n await this.db?.destroy();\n\n this.telemetry.destroy();\n this.cron.destroy();\n\n process.removeAllListeners();\n\n // @ts-expect-error: Allow clean delete of global.strapi to allow re-instanciation\n delete global.strapi;\n }\n\n sendStartupTelemetry() {\n // Emit started event.\n // do not await to avoid slower startup\n // This event is anonymous\n this.telemetry\n .send('didStartServer', {\n groupProperties: {\n database: this.config.get('database.connection.client'),\n plugins: Object.keys(this.plugins),\n numberOfAllContentTypes: _.size(this.contentTypes), // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.\n numberOfComponents: _.size(this.components),\n numberOfDynamicZones: getNumberOfDynamicZones(),\n numberOfCustomControllers: Object.values<Common.Controller>(this.controllers).filter(\n // TODO: Fix this at the content API loader level to prevent future types issues\n (controller) => controller !== undefined && factories.isCustomController(controller)\n ).length,\n environment: this.config.environment,\n // TODO: to add back\n // providers: this.config.installedProviders,\n },\n })\n .catch(this.log.error);\n }\n\n async openAdmin({ isInitialized }: { isInitialized: boolean }) {\n const shouldOpenAdmin =\n this.config.get('environment') === 'development' &&\n this.config.get('admin.autoOpen', true) !== false;\n\n if (shouldOpenAdmin && !isInitialized) {\n try {\n await utils.openBrowser(this.config);\n this.telemetry.send('didOpenTab');\n } catch (e) {\n this.telemetry.send('didNotOpenTab');\n }\n }\n }\n\n async postListen() {\n const isInitialized = await utils.isInitialized(this);\n\n this.startupLogger.logStartupMessage({ isInitialized });\n\n this.sendStartupTelemetry();\n this.openAdmin({ isInitialized });\n }\n\n /**\n * Add behaviors to the server\n */\n async listen() {\n return new Promise<void>((resolve, reject) => {\n const onListen = async () => {\n try {\n await this.postListen();\n\n resolve();\n } catch (error) {\n reject(error);\n }\n };\n\n const listenSocket = this.config.get('server.socket');\n\n if (listenSocket) {\n this.server.listen(listenSocket, onListen);\n } else {\n const { host, port } = this.config.get('server');\n\n this.server.listen(port, host, onListen);\n }\n });\n }\n\n stopWithError(err: unknown, customMessage?: string): never {\n this.log.debug(`⛔️ Server wasn't able to start properly.`);\n if (customMessage) {\n this.log.error(customMessage);\n }\n\n this.log.error(err);\n return this.stop();\n }\n\n stop(exitCode = 1): never {\n this.destroy();\n\n if (this.config.get('autoReload')) {\n process.send?.('stop');\n }\n\n // Kill process\n process.exit(exitCode);\n }\n\n async loadAdmin() {\n await loaders.loadAdmin(this);\n }\n\n async loadPlugins() {\n await loaders.loadPlugins(this);\n }\n\n async loadPolicies() {\n await loaders.loadPolicies(this);\n }\n\n async loadAPIs() {\n await loaders.loadAPIs(this);\n }\n\n async loadComponents() {\n this.components = await loaders.loadComponents(this);\n }\n\n async loadMiddlewares() {\n await loaders.loadMiddlewares(this);\n }\n\n async loadApp() {\n this.app = await loaders.loadSrcIndex(this);\n }\n\n async loadSanitizers() {\n await loaders.loadSanitizers(this);\n }\n\n async loadValidators() {\n await loaders.loadValidators(this);\n }\n\n registerInternalHooks() {\n this.container\n .get('hooks')\n .set('strapi::content-types.beforeSync', hooks.createAsyncParallelHook());\n\n this.container\n .get('hooks')\n .set('strapi::content-types.afterSync', hooks.createAsyncParallelHook());\n\n this.hook('strapi::content-types.beforeSync').register(draftAndPublishSync.disable);\n this.hook('strapi::content-types.afterSync').register(draftAndPublishSync.enable);\n }\n\n async register() {\n await Promise.all([\n this.loadApp(),\n this.loadSanitizers(),\n this.loadValidators(),\n this.loadPlugins(),\n this.loadAdmin(),\n this.loadAPIs(),\n this.loadComponents(),\n this.loadMiddlewares(),\n this.loadPolicies(),\n ]);\n\n await bootstrap({ strapi: this });\n\n // init webhook runner\n this.webhookRunner = createWebhookRunner({\n eventHub: this.eventHub,\n logger: this.log,\n configuration: this.config.get('server.webhooks', {}),\n fetch: this.fetch,\n });\n\n this.registerInternalHooks();\n\n this.telemetry.register();\n\n await this.runLifecyclesFunctions(LIFECYCLES.REGISTER);\n // NOTE: Swap type customField for underlying data type\n convertCustomFieldType(this);\n\n return this;\n }\n\n async bootstrap() {\n const contentTypes = [\n coreStoreModel,\n webhookModel,\n ...Object.values(this.contentTypes),\n ...Object.values(this.components),\n ];\n\n this.db = await Database.init({\n ...this.config.get('database'),\n models: Database.transformContentTypes(contentTypes),\n });\n\n this.store = createCoreStore({ db: this.db });\n this.webhookStore = createWebhookStore({ db: this.db });\n\n this.entityValidator = entityValidator;\n this.entityService = createEntityService({\n strapi: this,\n db: this.db,\n eventHub: this.eventHub,\n entityValidator: this.entityValidator,\n });\n\n if (this.config.get('server.cron.enabled', true)) {\n const cronTasks = this.config.get('server.cron.tasks', {});\n this.cron.add(cronTasks);\n }\n\n this.telemetry.bootstrap();\n\n let oldContentTypes;\n if (await this.db.getSchemaConnection().hasTable(coreStoreModel.collectionName)) {\n oldContentTypes = await this.store.get({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n });\n }\n\n await this.hook('strapi::content-types.beforeSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n const status = await this.db.schema.sync();\n\n // if schemas have changed, run repairs\n if (status === 'CHANGED') {\n await this.db.repair.removeOrphanMorphType({ pivot: 'component_type' });\n }\n\n if (this.EE) {\n await ee.checkLicense({ strapi: this });\n }\n\n await this.hook('strapi::content-types.afterSync').call({\n oldContentTypes,\n contentTypes: this.contentTypes,\n });\n\n await this.store.set({\n type: 'strapi',\n name: 'content_types',\n key: 'schema',\n value: this.contentTypes,\n });\n\n await this.startWebhooks();\n\n await this.server.initMiddlewares();\n this.server.initRouting();\n\n await this.contentAPI.permissions.registerActions();\n\n await this.runLifecyclesFunctions(LIFECYCLES.BOOTSTRAP);\n\n this.cron.start();\n\n return this;\n }\n\n async load() {\n await this.register();\n await this.bootstrap();\n\n this.isLoaded = true;\n\n return this as this & Required<StrapiI>;\n }\n\n async startWebhooks() {\n const webhooks = await this.webhookStore?.findWebhooks();\n if (!webhooks) {\n return;\n }\n\n for (const webhook of webhooks) {\n this.webhookRunner?.add(webhook);\n }\n }\n\n async runLifecyclesFunctions(lifecycleName: 'register' | 'bootstrap' | 'destroy') {\n // plugins\n await this.container.get('modules')[lifecycleName]();\n\n // admin\n const adminLifecycleFunction = this.admin && this.admin[lifecycleName];\n if (isFunction(adminLifecycleFunction)) {\n await adminLifecycleFunction({ strapi: this });\n }\n\n // user\n const userLifecycleFunction = this.app && this.app[lifecycleName];\n if (isFunction(userLifecycleFunction)) {\n await userLifecycleFunction({ strapi: this });\n }\n }\n\n getModel(uid: Common.UID.ContentType): Schema.ContentType;\n getModel(uid: Common.UID.Component): Schema.Component;\n getModel<TUID extends Common.UID.Schema>(\n uid: TUID\n ): Schema.ContentType | Schema.Component | undefined {\n if (uid in this.contentTypes) {\n return this.contentTypes[uid as Common.UID.ContentType];\n }\n\n if (uid in this.components) {\n return this.components[uid as Common.UID.Component];\n }\n }\n\n /**\n * Binds queries with a specific model\n * @param {string} uid\n */\n query(uid: Common.UID.Schema) {\n return this.db!.query(uid);\n }\n}\n\ninterface StrapiOptions {\n appDir?: string;\n distDir?: string;\n autoReload?: boolean;\n serveAdminPanel?: boolean;\n}\n\ninterface Init {\n (options?: StrapiOptions): Strapi;\n factories: typeof factories;\n compile: typeof compile;\n}\n\nconst initFn = (options: StrapiOptions = {}) => {\n const strapi = new Strapi(options);\n global.strapi = strapi as LoadedStrapi;\n return strapi;\n};\n\nconst init: Init = Object.assign(initFn, { factories, compile });\n\nexport default init;\n"],"names":["createAuth","utils.getDirs","createTelemetry","requestContext","ee","factories.isCustomController","isInitialized","utils.openBrowser","utils.isInitialized","draftAndPublishSync.disable","draftAndPublishSync.enable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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Store } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport contentReleases from '@strapi/content-releases/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n contentReleases,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs, Store };\n"],"names":["renderAdmin","contentTypeBuilder","email","upload","contentReleases"],"mappings":";;;;;;;;;;;;AAQA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAOA,YAAAA,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA,MACP,wBAAwBC,
|
|
1
|
+
{"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin, Store } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport contentReleases from '@strapi/content-releases/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n contentReleases,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs, Store };\n"],"names":["renderAdmin","contentTypeBuilder","email","upload","contentReleases"],"mappings":";;;;;;;;;;;;AAQA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAOA,YAAAA,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA,MACP,wBAAwBC,4BAAAA;AAAAA;AAAAA,MAAA,OAExBC,eAAAA;AAAAA,MAAA,QACAC,gBAAAA;AAAAA,MAAA,iBACAC,yBAAAA;AAAAA,MACA,GAAG;AAAA,IAAA;AAAA,EACL,CACD;AACH;;"}
|
package/dist/admin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.mjs","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin, Store } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport contentReleases from '@strapi/content-releases/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n contentReleases,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs, Store };\n"],"names":[],"mappings":";;;;;AAQA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAO,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA,MACP,wBAAwB;AAAA;AAAA,MAExB;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,
|
|
1
|
+
{"version":3,"file":"admin.mjs","sources":["../src/admin.ts"],"sourcesContent":["import { RenderAdminArgs, renderAdmin, Store } from '@strapi/admin/strapi-admin';\nimport contentTypeBuilder from '@strapi/plugin-content-type-builder/strapi-admin';\nimport email from '@strapi/plugin-email/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport upload from '@strapi/plugin-upload/strapi-admin';\n// @ts-expect-error – No types, yet.\nimport contentReleases from '@strapi/content-releases/strapi-admin';\n\nconst render = (mountNode: HTMLElement | null, { plugins, ...restArgs }: RenderAdminArgs) => {\n return renderAdmin(mountNode, {\n ...restArgs,\n plugins: {\n 'content-type-builder': contentTypeBuilder,\n // @ts-expect-error – TODO: fix this\n email,\n upload,\n contentReleases,\n ...plugins,\n },\n });\n};\n\nexport { render as renderAdmin };\nexport type { RenderAdminArgs, Store };\n"],"names":[],"mappings":";;;;;AAQA,MAAM,SAAS,CAAC,WAA+B,EAAE,SAAS,GAAG,eAAgC;AAC3F,SAAO,YAAY,WAAW;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS;AAAA,MACP,wBAAwB;AAAA;AAAA,MAExB;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA;AAAA,EACL,CACD;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/admin/create-user/action.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport strapi from '../../../../Strapi';\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 .matches(/[a-z]/, 'Password must contain at least one lowercase character')\n .matches(/[A-Z]/, 'Password must contain at least one uppercase character')\n .matches(/\\d/, 'Password must contain at least one number');\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\n/**\n * Create new admin user\n */\nexport default 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\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["yup","_","inquirer","strapi"],"mappings":";;;;;;;;AAYA,MAAM,iBAAiBA,
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/admin/create-user/action.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\nimport _ from 'lodash';\nimport inquirer from 'inquirer';\nimport strapi from '../../../../Strapi';\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 .matches(/[a-z]/, 'Password must contain at least one lowercase character')\n .matches(/[A-Z]/, 'Password must contain at least one uppercase character')\n .matches(/\\d/, 'Password must contain at least one number');\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\n/**\n * Create new admin user\n */\nexport default 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\nasync function createAdmin({ email, password, firstname, lastname }: CmdOptions) {\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["yup","_","inquirer","strapi"],"mappings":";;;;;;;;AAYA,MAAM,iBAAiBA,YAAAA,IAAI,OAAA,EAAS,MAAM,uBAAuB,EAAE,UAAA;AAEnE,MAAM,oBAAoBA,YAAAA,IACvB,OAAA,EACA,IAAI,GAAG,6CAA6C,EACpD,QAAQ,SAAS,wDAAwD,EACzE,QAAQ,SAAS,wDAAwD,EACzE,QAAQ,MAAM,2CAA2C;AAE5D,MAAM,oBAAoBA,YAAAA,IAAI,OAAA,EAAS,MAAM;AAAA,EAC3C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAWA,YAAAA,IAAI,OAAA,EAAS,KAAA,EAAO,SAAS,wBAAwB;AAAA,EAChE,UAAUA,YAAAA,IAAI,OAAA;AAChB,CAAC;AAgBD,MAAM,kBAAwD;AAAA,EAC5D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,SAAS,OAAe;AAC5B,YAAM,aAAa,MAAM,eAAe,SAAS,KAAK;AAC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AM,MAAMA,OAAO,UAAU,EAAE,KAAA;AAErC,QAAM,OAAO,MAAM,IAAI,MAAM,SAAS,KAAK,OAAO,EAAE,OAAO;AAE3D,MAAI,MAAM;AACR,YAAQ,MAAM,oBAAoB,KAAK,kBAAkB;AACzD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,iBAAiB,MAAM,IAAI,MAAM,SAAS,KAAK,cAAA;AAErD,QAAM,IAAI,MAAM,SAAS,KAAK,OAAO;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,OAAO,CAAC,eAAe,EAAE;AAAA,IACzB,GAAI,YAAY,EAAE,UAAU,mBAAmB,KAAA;AAAA,EAAK,CACrD;AAED,UAAQ,IAAI,gCAAgC;AAC5C,UAAQ,KAAK,CAAC;AAChB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/admin/reset-user-password/action.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport strapi from '../../../../Strapi';\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\n/**\n * Reset user's password\n */\nexport default 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\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["_","inquirer","strapi"],"mappings":";;;;;;;AAeA,MAAM,kBAAqE;AAAA,EACzE,EAAE,MAAM,SAAS,MAAM,SAAS,SAAS,
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/admin/reset-user-password/action.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport strapi from '../../../../Strapi';\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\n/**\n * Reset user's password\n */\nexport default 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\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["_","inquirer","strapi"],"mappings":";;;;;;;AAeA,MAAM,kBAAqE;AAAA,EACzE,EAAE,MAAM,SAAS,MAAM,SAAS,SAAS,cAAA;AAAA,EACzC,EAAE,MAAM,YAAY,MAAM,YAAY,SAAS,gBAAA;AAAA,EAC/C;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAEb;AAKA,MAAA,SAAe,OAAO,aAAyB,CAAA,MAAO;AACpD,QAAM,EAAE,OAAO,SAAA,IAAa;AAE5B,MAAIA,mBAAE,QAAQ,KAAK,KAAKA,WAAAA,QAAE,QAAQ,QAAQ,KAAK,QAAQ,MAAM,OAAO;AAClE,UAAM,UAAU,MAAMC,0BAAS,OAAO,eAAe;AAErD,QAAI,CAAC,QAAQ,SAAS;AACpB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,WAAO,eAAe,OAAO;AAAA,EAC/B;AAEA,MAAID,WAAAA,QAAE,QAAQ,KAAK,KAAKA,WAAAA,QAAE,QAAQ,QAAQ,GAAG;AAC3C,YAAQ,MAAM,gDAAgD;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO,eAAe,EAAE,OAAO,UAAU;AAC3C;AAEA,eAAe,eAAe,EAAE,OAAO,YAAwB;AAC7D,QAAM,aAAa,MAAME,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,KAAA;AAErC,QAAM,IAAI,MAAM,SAAS,KAAK,qBAAqB,OAAO,QAAQ;AAElE,UAAQ,IAAI,oCAAoC;AAChD,UAAQ,KAAK,CAAC;AAChB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/admin/reset-user-password/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('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 default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,2BAA2B,EACnC,MAAM,sBAAsB,EAC5B,YAAY,gCAAgC,EAC5C,OAAO,uBAAuB,gBAAgB,EAC9C,OAAO,6BAA6B,2BAA2B,EAC/D,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/admin/reset-user-password/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('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 default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,2BAA2B,EACnC,MAAM,sBAAsB,EAC5B,YAAY,gCAAgC,EAC5C,OAAO,uBAAuB,gBAAgB,EAC9C,OAAO,6BAA6B,2BAA2B,EAC/D,OAAOC,QAAAA,UAAU,6BAA6B,MAAM,CAAC;AAC1D;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/components/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/components/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;AACzB,QAAM,aAAa,MAAMA,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,SAAA;AAErC,QAAM,OAAO,OAAO,KAAK,IAAI,UAAU;AAEvC,QAAM,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAED,OAAK,QAAQ,CAAC,SAAS,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7C,UAAQ,IAAI,UAAU,UAAU;AAEhC,QAAM,IAAI,QAAA;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/components/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,iBAAiB,EACzB,YAAY,qCAAqC,EACjD,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/components/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,iBAAiB,EACzB,YAAY,qCAAqC,EACjD,OAAOC,QAAAA,UAAU,mBAAmB,MAAM,CAAC;AAChD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/configuration/dump/action.ts"],"sourcesContent":["import fs from 'fs';\nimport strapi from '../../../../Strapi';\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 */\nexport default async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["fs","strapi"],"mappings":";;;;;AAqBA,MAAM,aAAa;AAMnB,
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/configuration/dump/action.ts"],"sourcesContent":["import fs from 'fs';\nimport strapi from '../../../../Strapi';\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 */\nexport default async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["fs","strapi"],"mappings":";;;;;AAqBA,MAAM,aAAa;AAMnB,MAAA,SAAe,OAAO,EAAE,MAAM,UAAU,aAAyB;AAC/D,QAAM,SAAiB,WAAWA,YAAAA,QAAG,kBAAkB,QAAQ,IAAI,QAAQ;AAE3E,QAAM,aAAa,MAAMC,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,KAAA;AAErC,QAAM,QAAQ,MAAM,IAAI,MAAM,oBAAoB,EAAE,MAAA;AAEpD,QAAM,aAA2B,CAAA;AAEjC,QAAM,YAAY,KAAK,KAAK,QAAQ,UAAU;AAE9C,WAAS,OAAO,GAAG,OAAO,WAAW,QAAQ,GAAG;AAC9C,UAAM,UAAU,MAAM,IACnB,MAAM,oBAAoB,EAC1B,SAAS,EAAE,OAAO,YAAY,QAAQ,OAAO,YAAY,SAAS,OAAO;AAE5E,YACG,OAAO,CAAC,WAAW,OAAO,IAAI,WAAW,SAAS,CAAC,EACnD,QAAQ,CAAC,WAAW;AACnB,iBAAW,KAAK;AAAA,QACd,KAAK,OAAO;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,MAAM,OAAO;AAAA,QACb,aAAa,OAAO;AAAA,QACpB,KAAK,OAAO;AAAA,MAAA,CACb;AAAA,IACH,CAAC;AAAA,EACL;AAEA,QAAM,MAAM,KAAK,UAAU,YAAY,MAAM,SAAS,IAAI,MAAS;AAEnE,SAAO,MAAM,GAAG;AAChB,SAAO,MAAM,IAAI;AACjB,SAAO,IAAA;AAGP,MAAI,UAAU;AACZ,YAAQ,IAAI,yBAAyB,WAAW,MAAM,wBAAwB;AAAA,EAChF;AACA,UAAQ,KAAK,CAAC;AAChB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/configuration/dump/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('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 default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,oBAAoB,EAC5B,MAAM,aAAa,EACnB,YAAY,yCAAyC,EACrD,OAAO,qBAAqB,uCAAuC,EACnE,OAAO,gBAAgB,2DAA2D,KAAK,EACvF,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/configuration/dump/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('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 default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,oBAAoB,EAC5B,MAAM,aAAa,EACnB,YAAY,yCAAyC,EACrD,OAAO,qBAAqB,uCAAuC,EACnE,OAAO,gBAAgB,2DAA2D,KAAK,EACvF,OAAOC,QAAAA,UAAU,sBAAsB,MAAM,CAAC;AACnD;;"}
|
|
@@ -36,8 +36,7 @@ const action = async ({ file: filePath, strategy = "replace" }) => {
|
|
|
36
36
|
const readStdin = () => {
|
|
37
37
|
const { stdin } = process;
|
|
38
38
|
let result = "";
|
|
39
|
-
if (stdin.isTTY)
|
|
40
|
-
return Promise.resolve(result);
|
|
39
|
+
if (stdin.isTTY) return Promise.resolve(result);
|
|
41
40
|
return new Promise((resolve, reject) => {
|
|
42
41
|
stdin.setEncoding("utf8");
|
|
43
42
|
stdin.on("readable", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/configuration/restore/action.ts"],"sourcesContent":["import fs from 'fs';\nimport _ from 'lodash';\nimport type { Database } from '@strapi/database';\n\nimport strapi from '../../../../Strapi';\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 */\nexport default async ({ file: filePath, strategy = 'replace' }: CmdOptions) => {\n const input = filePath ? fs.readFileSync(filePath) : await readStdin();\n\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["fs","strapi","_"],"mappings":";;;;;;;AAgBA,
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/configuration/restore/action.ts"],"sourcesContent":["import fs from 'fs';\nimport _ from 'lodash';\nimport type { Database } from '@strapi/database';\n\nimport strapi from '../../../../Strapi';\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 */\nexport default async ({ file: filePath, strategy = 'replace' }: CmdOptions) => {\n const input = filePath ? fs.readFileSync(filePath) : await readStdin();\n\n const appContext = await strapi.compile();\n const app = await strapi(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"],"names":["fs","strapi","_"],"mappings":";;;;;;;AAgBA,MAAA,SAAe,OAAO,EAAE,MAAM,UAAU,WAAW,gBAA4B;AAC7E,QAAM,QAAQ,WAAWA,YAAAA,QAAG,aAAa,QAAQ,IAAI,MAAM,UAAA;AAE3D,QAAM,aAAa,MAAMC,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,KAAA;AAErC,MAAI;AACJ,MAAI;AACF,mBAAe,KAAK,MAAMC,WAAAA,QAAE,SAAS,KAAK,CAAC;AAAA,EAC7C,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,uBAAuB,MAAM,OAAO,gCAAgC;AAAA,IACtF;AAEA,UAAM;AAAA,EACR;AAEA,MAAI,CAAC,MAAM,QAAQ,YAAY,GAAG;AAChC,UAAM,IAAI,MAAM,kDAAkD;A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;AAAA,IACrD;AAAA,IAEA,MAAM,OAAO,MAA+B;AAC1C,YAAM,WAAW,MAAM,GAAG,MAAM,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,KAAK,IAAA,GAAO;AACxF,UAAI,WAAW,GAAG;AAChB,cAAM,aAAa;AAEnB;AAAA,MACF;AAEA,YAAM,WAAW;AACjB,YAAM,GAAG,MAAM,oBAAoB,EAAE,OAAO,EAAE,MAAM,MAAM;AAAA,IAC5D;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/configuration/restore/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi configuration:restore`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('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 default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,uBAAuB,EAC/B,MAAM,gBAAgB,EACtB,YAAY,4CAA4C,EACxD,OAAO,qBAAqB,oCAAoC,EAChE,OAAO,6BAA6B,mDAAmD,EACvF,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/configuration/restore/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi configuration:restore`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('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 default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,uBAAuB,EAC/B,MAAM,gBAAgB,EACtB,YAAY,4CAA4C,EACxD,OAAO,qBAAqB,oCAAoC,EAChE,OAAO,6BAA6B,mDAAmD,EACvF,OAAOC,QAAAA,UAAU,yBAAyB,MAAM,CAAC;AACtD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/console/action.ts"],"sourcesContent":["import REPL from 'repl';\nimport strapi from '../../../Strapi';\n\n/**\n * `$ strapi console`\n */\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).load();\n\n app.start().then(() => {\n const repl = REPL.start(app.config.info.name + ' > ' || 'strapi > '); // eslint-disable-line prefer-template\n\n repl.on('exit', (err: Error) => {\n if (err) {\n app.log.error(err);\n process.exit(1);\n }\n\n app.server.destroy();\n process.exit(0);\n });\n });\n};\n"],"names":["strapi","REPL"],"mappings":";;;;;AAMA,MAAA,SAAe,YAAY;
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/console/action.ts"],"sourcesContent":["import REPL from 'repl';\nimport strapi from '../../../Strapi';\n\n/**\n * `$ strapi console`\n */\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).load();\n\n app.start().then(() => {\n const repl = REPL.start(app.config.info.name + ' > ' || 'strapi > '); // eslint-disable-line prefer-template\n\n repl.on('exit', (err: Error) => {\n if (err) {\n app.log.error(err);\n process.exit(1);\n }\n\n app.server.destroy();\n process.exit(0);\n });\n });\n};\n"],"names":["strapi","REPL"],"mappings":";;;;;AAMA,MAAA,SAAe,YAAY;AACzB,QAAM,aAAa,MAAMA,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,KAAA;AAErC,MAAI,QAAQ,KAAK,MAAM;AACrB,UAAM,OAAOC,sBAAK,MAAM,IAAI,OAAO,KAAK,OAAO,SAAS,WAAW;AAEnE,SAAK,GAAG,QAAQ,CAAC,QAAe;AAC9B,UAAI,KAAK;AACP,YAAI,IAAI,MAAM,GAAG;AACjB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,UAAI,OAAO,QAAA;AACX,cAAQ,KAAK,CAAC;AAAA,IAChB,CAAC;AAAA,EACH,CAAC;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/console/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi console`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('console')\n .description('Open the Strapi framework console')\n .action(runAction('console', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,SAAS,EACjB,YAAY,mCAAmC,EAC/C,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/console/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi console`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('console')\n .description('Open the Strapi framework console')\n .action(runAction('console', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,SAAS,EACjB,YAAY,mCAAmC,EAC/C,OAAOC,QAAAA,UAAU,WAAW,MAAM,CAAC;AACxC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/content-types/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).register();\n\n const list = app.container.get('content-types').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/content-types/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).register();\n\n const list = app.container.get('content-types').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;AACzB,QAAM,aAAa,MAAMA,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,SAAA;AAErC,QAAM,OAAO,IAAI,UAAU,IAAI,eAAe,EAAE,KAAA;AAEhD,QAAM,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAED,OAAK,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAErD,UAAQ,IAAI,UAAU,UAAU;AAEhC,QAAM,IAAI,QAAA;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/content-types/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi content-types:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('content-types:list')\n .description('List all the application content-types')\n .action(runAction('content-types:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,oBAAoB,EAC5B,YAAY,wCAAwC,EACpD,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/content-types/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi content-types:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('content-types:list')\n .description('List all the application content-types')\n .action(runAction('content-types:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,oBAAoB,EAC5B,YAAY,wCAAwC,EACpD,OAAOC,QAAAA,UAAU,sBAAsB,MAAM,CAAC;AACnD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/controllers/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).register();\n\n const list = app.container.get('controllers').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/controllers/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).register();\n\n const list = app.container.get('controllers').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;AACzB,QAAM,aAAa,MAAMA,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,SAAA;AAErC,QAAM,OAAO,IAAI,UAAU,IAAI,aAAa,EAAE,KAAA;AAE9C,QAAM,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAED,OAAK,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAErD,UAAQ,IAAI,UAAU,UAAU;AAEhC,QAAM,IAAI,QAAA;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/controllers/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi controllers:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('controllers:list')\n .description('List all the application controllers')\n .action(runAction('controllers:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,kBAAkB,EAC1B,YAAY,sCAAsC,EAClD,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/controllers/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi controllers:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('controllers:list')\n .description('List all the application controllers')\n .action(runAction('controllers:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,kBAAkB,EAC1B,YAAY,sCAAsC,EAClD,OAAOC,QAAAA,UAAU,oBAAoB,MAAM,CAAC;AACjD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/generate/command.ts"],"sourcesContent":["import { assertCwdContainsStrapiProject } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\n/**\n * `$ strapi generate`\n */\nconst commands: StrapiCommand = ({ command, argv }) => {\n command\n .command('generate')\n .description('Launch the interactive API generator')\n .action(() => {\n assertCwdContainsStrapiProject('generate');\n argv.splice(2, 1);\n\n // NOTE: this needs to be lazy loaded in order for plop to work correctly\n import('@strapi/generators').then((gen) => gen.runCLI());\n });\n};\n\nexport default commands;\n"],"names":["assertCwdContainsStrapiProject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,WAA0B,CAAC,EAAE,SAAS,WAAW;AACrD,UACG,QAAQ,UAAU,EAClB,YAAY,sCAAsC,EAClD,OAAO,MAAM;AACZA,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/generate/command.ts"],"sourcesContent":["import { assertCwdContainsStrapiProject } from '../../utils/helpers';\nimport type { StrapiCommand } from '../../types';\n\n/**\n * `$ strapi generate`\n */\nconst commands: StrapiCommand = ({ command, argv }) => {\n command\n .command('generate')\n .description('Launch the interactive API generator')\n .action(() => {\n assertCwdContainsStrapiProject('generate');\n argv.splice(2, 1);\n\n // NOTE: this needs to be lazy loaded in order for plop to work correctly\n import('@strapi/generators').then((gen) => gen.runCLI());\n });\n};\n\nexport default commands;\n"],"names":["assertCwdContainsStrapiProject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,WAA0B,CAAC,EAAE,SAAS,WAAW;AACrD,UACG,QAAQ,UAAU,EAClB,YAAY,sCAAsC,EAClD,OAAO,MAAM;AACZA,YAAAA,+BAA+B,UAAU;AACzC,SAAK,OAAO,GAAG,CAAC;AAGhB,WAAO,oBAAoB,EAAE,KAAK,CAAC,QAAQ,IAAI,QAAQ;AAAA,EACzD,CAAC;AACL;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/hooks/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).register();\n\n const list = app.container.get('hooks').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/hooks/list/action.ts"],"sourcesContent":["import CLITable from 'cli-table3';\nimport chalk from 'chalk';\n\nimport strapi from '../../../../Strapi';\n\nexport default async () => {\n const appContext = await strapi.compile();\n const app = await strapi(appContext).register();\n\n const list = app.container.get('hooks').keys();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name: string) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n"],"names":["strapi","CLITable","chalk"],"mappings":";;;;;;;AAKA,MAAA,SAAe,YAAY;AACzB,QAAM,aAAa,MAAMA,OAAO,QAAA;AAChC,QAAM,MAAM,MAAMA,OAAO,UAAU,EAAE,SAAA;AAErC,QAAM,OAAO,IAAI,UAAU,IAAI,OAAO,EAAE,KAAA;AAExC,QAAM,YAAY,IAAIC,0BAAS;AAAA,IAC7B,MAAM,CAACC,eAAAA,QAAM,KAAK,MAAM,CAAC;AAAA,EAAA,CAC1B;AAED,OAAK,QAAQ,CAAC,SAAiB,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC;AAErD,UAAQ,IAAI,UAAU,UAAU;AAEhC,QAAM,IAAI,QAAA;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/hooks/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi hooks:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('hooks:list')\n .description('List all the application hooks')\n .action(runAction('hooks:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,YAAY,EACpB,YAAY,gCAAgC,EAC5C,OAAOC,
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/hooks/list/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi hooks:list`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('hooks:list')\n .description('List all the application hooks')\n .action(runAction('hooks:list', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,YAAY,EACpB,YAAY,gCAAgC,EAC5C,OAAOC,QAAAA,UAAU,cAAc,MAAM,CAAC;AAC3C;;"}
|