@strapi/core 5.4.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Strapi.js +1 -2
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs.map +1 -1
- package/dist/compile.js.map +1 -1
- package/dist/compile.mjs.map +1 -1
- package/dist/configuration/config-loader.js +1 -2
- package/dist/configuration/config-loader.js.map +1 -1
- package/dist/configuration/config-loader.mjs +1 -2
- package/dist/configuration/config-loader.mjs.map +1 -1
- package/dist/configuration/get-dirs.js.map +1 -1
- package/dist/configuration/get-dirs.mjs.map +1 -1
- package/dist/configuration/index.js.map +1 -1
- package/dist/configuration/index.mjs.map +1 -1
- package/dist/configuration/urls.js.map +1 -1
- package/dist/configuration/urls.mjs.map +1 -1
- package/dist/container.js.map +1 -1
- package/dist/container.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.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/core-service.js.map +1 -1
- package/dist/core-api/service/core-service.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.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 +1 -2
- package/dist/core-api/service/single-type.mjs.map +1 -1
- package/dist/domain/content-type/index.js.map +1 -1
- package/dist/domain/content-type/index.mjs.map +1 -1
- package/dist/domain/content-type/validator.js.map +1 -1
- package/dist/domain/content-type/validator.mjs.map +1 -1
- package/dist/domain/module/index.js.map +1 -1
- package/dist/domain/module/index.mjs.map +1 -1
- package/dist/domain/module/validation.js.map +1 -1
- package/dist/domain/module/validation.mjs.map +1 -1
- package/dist/ee/index.js.map +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.map +1 -1
- package/dist/factories.mjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loaders/admin.js.map +1 -1
- package/dist/loaders/admin.mjs.map +1 -1
- package/dist/loaders/apis.js.map +1 -1
- package/dist/loaders/apis.mjs.map +1 -1
- package/dist/loaders/components.js.map +1 -1
- package/dist/loaders/components.mjs.map +1 -1
- package/dist/loaders/middlewares.js.map +1 -1
- package/dist/loaders/middlewares.mjs.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
- package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
- package/dist/loaders/plugins/get-user-plugins-config.mjs.map +1 -1
- package/dist/loaders/plugins/index.js +1 -2
- package/dist/loaders/plugins/index.js.map +1 -1
- package/dist/loaders/plugins/index.mjs.map +1 -1
- package/dist/loaders/policies.js.map +1 -1
- package/dist/loaders/policies.mjs.map +1 -1
- package/dist/loaders/sanitizers.js.map +1 -1
- package/dist/loaders/sanitizers.mjs.map +1 -1
- package/dist/loaders/src-index.js.map +1 -1
- package/dist/loaders/src-index.mjs.map +1 -1
- package/dist/loaders/validators.js.map +1 -1
- package/dist/loaders/validators.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.js.map +1 -1
- package/dist/middlewares/public.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/database/5.0.0-discard-drafts.js.map +1 -1
- package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -1
- package/dist/migrations/draft-publish.js.map +1 -1
- package/dist/migrations/draft-publish.mjs.map +1 -1
- package/dist/migrations/i18n.js.map +1 -1
- package/dist/migrations/i18n.mjs.map +1 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/index.mjs.map +1 -1
- package/dist/providers/admin.js.map +1 -1
- package/dist/providers/admin.mjs.map +1 -1
- package/dist/providers/coreStore.js.map +1 -1
- package/dist/providers/coreStore.mjs.map +1 -1
- package/dist/providers/cron.js.map +1 -1
- package/dist/providers/cron.mjs.map +1 -1
- package/dist/providers/registries.js.map +1 -1
- package/dist/providers/registries.mjs.map +1 -1
- package/dist/providers/telemetry.js.map +1 -1
- package/dist/providers/telemetry.mjs.map +1 -1
- package/dist/providers/webhooks.js.map +1 -1
- package/dist/providers/webhooks.mjs.map +1 -1
- package/dist/registries/apis.js.map +1 -1
- package/dist/registries/apis.mjs.map +1 -1
- package/dist/registries/components.js.map +1 -1
- package/dist/registries/components.mjs.map +1 -1
- package/dist/registries/content-types.js.map +1 -1
- package/dist/registries/content-types.mjs.map +1 -1
- package/dist/registries/controllers.js.map +1 -1
- package/dist/registries/controllers.mjs.map +1 -1
- package/dist/registries/custom-fields.js.map +1 -1
- package/dist/registries/custom-fields.mjs.map +1 -1
- package/dist/registries/hooks.js.map +1 -1
- package/dist/registries/hooks.mjs.map +1 -1
- package/dist/registries/middlewares.js.map +1 -1
- package/dist/registries/middlewares.mjs.map +1 -1
- package/dist/registries/models.js.map +1 -1
- package/dist/registries/models.mjs.map +1 -1
- package/dist/registries/modules.js.map +1 -1
- package/dist/registries/modules.mjs.map +1 -1
- package/dist/registries/namespace.js.map +1 -1
- package/dist/registries/namespace.mjs.map +1 -1
- package/dist/registries/plugins.js.map +1 -1
- package/dist/registries/plugins.mjs.map +1 -1
- package/dist/registries/policies.js.map +1 -1
- package/dist/registries/policies.mjs.map +1 -1
- package/dist/registries/sanitizers.js.map +1 -1
- package/dist/registries/sanitizers.mjs.map +1 -1
- package/dist/registries/services.js.map +1 -1
- package/dist/registries/services.mjs.map +1 -1
- package/dist/registries/validators.js.map +1 -1
- package/dist/registries/validators.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/config.js.map +1 -1
- package/dist/services/config.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/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/document-service/attributes/index.js.map +1 -1
- package/dist/services/document-service/attributes/index.mjs.map +1 -1
- package/dist/services/document-service/attributes/transforms.js.map +1 -1
- package/dist/services/document-service/attributes/transforms.mjs.map +1 -1
- package/dist/services/document-service/components.js.map +1 -1
- package/dist/services/document-service/components.mjs.map +1 -1
- package/dist/services/document-service/draft-and-publish.js.map +1 -1
- package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
- package/dist/services/document-service/entries.js.map +1 -1
- package/dist/services/document-service/entries.mjs.map +1 -1
- package/dist/services/document-service/events.js.map +1 -1
- package/dist/services/document-service/events.mjs.map +1 -1
- package/dist/services/document-service/index.js.map +1 -1
- package/dist/services/document-service/index.mjs.map +1 -1
- package/dist/services/document-service/internationalization.js.map +1 -1
- package/dist/services/document-service/internationalization.mjs.map +1 -1
- package/dist/services/document-service/middlewares/errors.js.map +1 -1
- package/dist/services/document-service/middlewares/errors.mjs.map +1 -1
- package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -1
- package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -1
- package/dist/services/document-service/repository.js.map +1 -1
- package/dist/services/document-service/repository.mjs.map +1 -1
- package/dist/services/document-service/transform/data.js.map +1 -1
- package/dist/services/document-service/transform/data.mjs.map +1 -1
- package/dist/services/document-service/transform/fields.js.map +1 -1
- package/dist/services/document-service/transform/fields.mjs.map +1 -1
- package/dist/services/document-service/transform/id-map.js +2 -4
- package/dist/services/document-service/transform/id-map.js.map +1 -1
- package/dist/services/document-service/transform/id-map.mjs +2 -4
- package/dist/services/document-service/transform/id-map.mjs.map +1 -1
- package/dist/services/document-service/transform/id-transform.js.map +1 -1
- package/dist/services/document-service/transform/id-transform.mjs.map +1 -1
- package/dist/services/document-service/transform/populate.js.map +1 -1
- package/dist/services/document-service/transform/populate.mjs.map +1 -1
- package/dist/services/document-service/transform/query.js.map +1 -1
- package/dist/services/document-service/transform/query.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
- package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/transform/data-ids.js +1 -2
- package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
- package/dist/services/document-service/transform/relations/transform/data-ids.mjs +1 -2
- package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -1
- package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
- package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
- package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/utils/map-relation.js +3 -6
- package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -1
- package/dist/services/document-service/transform/relations/utils/map-relation.mjs +3 -6
- package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -1
- package/dist/services/document-service/utils/populate.js.map +1 -1
- package/dist/services/document-service/utils/populate.mjs.map +1 -1
- package/dist/services/document-service/utils/unidirectional-relations.js +1 -2
- package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -1
- package/dist/services/document-service/utils/unidirectional-relations.mjs +1 -2
- package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -1
- package/dist/services/entity-service/index.js.map +1 -1
- package/dist/services/entity-service/index.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.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/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/query-params.js.map +1 -1
- package/dist/services/query-params.mjs.map +1 -1
- package/dist/services/reloader.js.map +1 -1
- package/dist/services/reloader.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.map +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/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/filepath-to-prop-path.js.map +1 -1
- package/dist/utils/filepath-to-prop-path.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/load-config-file.js.map +1 -1
- package/dist/utils/load-config-file.mjs.map +1 -1
- package/dist/utils/load-files.js +1 -2
- package/dist/utils/load-files.js.map +1 -1
- package/dist/utils/load-files.mjs +1 -2
- package/dist/utils/load-files.mjs.map +1 -1
- package/dist/utils/resolve-working-dirs.js.map +1 -1
- package/dist/utils/resolve-working-dirs.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.d.ts.map +1 -1
- package/dist/utils/startup-logger.js +6 -1
- package/dist/utils/startup-logger.js.map +1 -1
- package/dist/utils/startup-logger.mjs +6 -1
- package/dist/utils/startup-logger.mjs.map +1 -1
- package/dist/utils/transform-content-types-to-models.js.map +1 -1
- package/dist/utils/transform-content-types-to-models.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 +14 -14
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"webhook-runner.js","sources":["../../src/services/webhook-runner.ts"],"sourcesContent":["/**\n * The event hub is Strapi's event control center.\n */\n\nimport createdDebugger from 'debug';\nimport _ from 'lodash';\nimport type { Logger } from '@strapi/logger';\n\nimport type { Modules } from '@strapi/types';\nimport WorkerQueue from './worker-queue';\nimport type { EventHub } from './event-hub';\nimport type { Fetch } from '../utils/fetch';\n\ntype Webhook = Modules.WebhookStore.Webhook;\n\ninterface Config {\n defaultHeaders: Record<string, string>;\n}\n\ninterface ConstructorParameters {\n eventHub: EventHub;\n logger: Logger;\n configuration?: Record<string, unknown>;\n fetch: Fetch;\n}\n\ninterface Event {\n event: string;\n info: Record<string, unknown>;\n}\n\ntype Listener = (info: Record<string, unknown>) => Promise<void>;\n\nconst debug = createdDebugger('strapi:webhook');\n\nconst defaultConfiguration: Config = {\n defaultHeaders: {},\n};\n\nclass WebhookRunner {\n private eventHub: EventHub;\n\n private logger: Logger;\n\n private config: Config;\n\n private webhooksMap: Map<string, Webhook[]> = new Map();\n\n private listeners: Map<string, Listener> = new Map();\n\n private queue: WorkerQueue<Event, void>;\n\n private fetch: Fetch;\n\n constructor({ eventHub, logger, configuration = {}, fetch }: ConstructorParameters) {\n debug('Initialized webhook runner');\n this.eventHub = eventHub;\n this.logger = logger;\n this.fetch = fetch;\n\n if (typeof configuration !== 'object') {\n throw new Error(\n 'Invalid configuration provided to the webhookRunner.\\nCheck your server.json -> webhooks configuration'\n );\n }\n\n this.config = _.merge(defaultConfiguration, configuration);\n\n this.queue = new WorkerQueue({ logger, concurrency: 5 });\n\n this.queue.subscribe(this.executeListener.bind(this));\n }\n\n deleteListener(event: string) {\n debug(`Deleting listener for event '${event}'`);\n\n const fn = this.listeners.get(event);\n\n if (fn !== undefined) {\n this.eventHub.off(event, fn);\n this.listeners.delete(event);\n }\n }\n\n createListener(event: string) {\n debug(`Creating listener for event '${event}'`);\n if (this.listeners.has(event)) {\n this.logger.error(\n `The webhook runner is already listening for the event '${event}'. Did you mean to call .register() ?`\n );\n }\n\n const listen = async (info: Event['info']) => {\n this.queue.enqueue({ event, info });\n };\n\n this.listeners.set(event, listen);\n this.eventHub.on(event, listen);\n }\n\n async executeListener({ event, info }: Event) {\n debug(`Executing webhook for event '${event}'`);\n const webhooks = this.webhooksMap.get(event) || [];\n const activeWebhooks = webhooks.filter((webhook) => webhook.isEnabled === true);\n\n for (const webhook of activeWebhooks) {\n await this.run(webhook, event, info).catch((error: unknown) => {\n this.logger.error('Error running webhook');\n this.logger.error(error);\n });\n }\n }\n\n run(webhook: Webhook, event: string, info = {}) {\n const { url, headers } = webhook;\n\n return this.fetch(url, {\n method: 'post',\n body: JSON.stringify({\n event,\n createdAt: new Date(),\n ...info,\n }),\n headers: {\n ...this.config.defaultHeaders,\n ...headers,\n 'X-Strapi-Event': event,\n 'Content-Type': 'application/json',\n },\n signal: AbortSignal.timeout(10000),\n })\n .then(async (res) => {\n if (res.ok) {\n return {\n statusCode: res.status,\n };\n }\n\n return {\n statusCode: res.status,\n message: await res.text(),\n };\n })\n .catch((err) => {\n return {\n statusCode: 500,\n message: err.message,\n };\n });\n }\n\n add(webhook: Webhook) {\n debug(`Registering webhook '${webhook.id}'`);\n const { events } = webhook;\n\n events.forEach((event) => {\n if (this.webhooksMap.has(event)) {\n this.webhooksMap.get(event)?.push(webhook);\n } else {\n this.webhooksMap.set(event, [webhook]);\n this.createListener(event);\n }\n });\n }\n\n update(webhook: Webhook) {\n debug(`Refreshing webhook '${webhook.id}'`);\n this.remove(webhook);\n this.add(webhook);\n }\n\n remove(webhook: Webhook) {\n debug(`Unregistering webhook '${webhook.id}'`);\n\n this.webhooksMap.forEach((webhooks, event) => {\n const filteredWebhooks = webhooks.filter((value) => value.id !== webhook.id);\n\n // Cleanup hanging listeners\n if (filteredWebhooks.length === 0) {\n this.webhooksMap.delete(event);\n this.deleteListener(event);\n } else {\n this.webhooksMap.set(event, filteredWebhooks);\n }\n });\n }\n}\n\n/**\n * Expose a factory function instead of the class\n */\nexport default function createWebhookRunner(opts: ConstructorParameters): WebhookRunner {\n return new WebhookRunner(opts);\n}\n\nexport type { WebhookRunner };\n"],"names":["createdDebugger","_","WorkerQueue"],"mappings":";;;;;;;AAiCA,MAAM,QAAQA,
|
1
|
+
{"version":3,"file":"webhook-runner.js","sources":["../../src/services/webhook-runner.ts"],"sourcesContent":["/**\n * The event hub is Strapi's event control center.\n */\n\nimport createdDebugger from 'debug';\nimport _ from 'lodash';\nimport type { Logger } from '@strapi/logger';\n\nimport type { Modules } from '@strapi/types';\nimport WorkerQueue from './worker-queue';\nimport type { EventHub } from './event-hub';\nimport type { Fetch } from '../utils/fetch';\n\ntype Webhook = Modules.WebhookStore.Webhook;\n\ninterface Config {\n defaultHeaders: Record<string, string>;\n}\n\ninterface ConstructorParameters {\n eventHub: EventHub;\n logger: Logger;\n configuration?: Record<string, unknown>;\n fetch: Fetch;\n}\n\ninterface Event {\n event: string;\n info: Record<string, unknown>;\n}\n\ntype Listener = (info: Record<string, unknown>) => Promise<void>;\n\nconst debug = createdDebugger('strapi:webhook');\n\nconst defaultConfiguration: Config = {\n defaultHeaders: {},\n};\n\nclass WebhookRunner {\n private eventHub: EventHub;\n\n private logger: Logger;\n\n private config: Config;\n\n private webhooksMap: Map<string, Webhook[]> = new Map();\n\n private listeners: Map<string, Listener> = new Map();\n\n private queue: WorkerQueue<Event, void>;\n\n private fetch: Fetch;\n\n constructor({ eventHub, logger, configuration = {}, fetch }: ConstructorParameters) {\n debug('Initialized webhook runner');\n this.eventHub = eventHub;\n this.logger = logger;\n this.fetch = fetch;\n\n if (typeof configuration !== 'object') {\n throw new Error(\n 'Invalid configuration provided to the webhookRunner.\\nCheck your server.json -> webhooks configuration'\n );\n }\n\n this.config = _.merge(defaultConfiguration, configuration);\n\n this.queue = new WorkerQueue({ logger, concurrency: 5 });\n\n this.queue.subscribe(this.executeListener.bind(this));\n }\n\n deleteListener(event: string) {\n debug(`Deleting listener for event '${event}'`);\n\n const fn = this.listeners.get(event);\n\n if (fn !== undefined) {\n this.eventHub.off(event, fn);\n this.listeners.delete(event);\n }\n }\n\n createListener(event: string) {\n debug(`Creating listener for event '${event}'`);\n if (this.listeners.has(event)) {\n this.logger.error(\n `The webhook runner is already listening for the event '${event}'. Did you mean to call .register() ?`\n );\n }\n\n const listen = async (info: Event['info']) => {\n this.queue.enqueue({ event, info });\n };\n\n this.listeners.set(event, listen);\n this.eventHub.on(event, listen);\n }\n\n async executeListener({ event, info }: Event) {\n debug(`Executing webhook for event '${event}'`);\n const webhooks = this.webhooksMap.get(event) || [];\n const activeWebhooks = webhooks.filter((webhook) => webhook.isEnabled === true);\n\n for (const webhook of activeWebhooks) {\n await this.run(webhook, event, info).catch((error: unknown) => {\n this.logger.error('Error running webhook');\n this.logger.error(error);\n });\n }\n }\n\n run(webhook: Webhook, event: string, info = {}) {\n const { url, headers } = webhook;\n\n return this.fetch(url, {\n method: 'post',\n body: JSON.stringify({\n event,\n createdAt: new Date(),\n ...info,\n }),\n headers: {\n ...this.config.defaultHeaders,\n ...headers,\n 'X-Strapi-Event': event,\n 'Content-Type': 'application/json',\n },\n signal: AbortSignal.timeout(10000),\n })\n .then(async (res) => {\n if (res.ok) {\n return {\n statusCode: res.status,\n };\n }\n\n return {\n statusCode: res.status,\n message: await res.text(),\n };\n })\n .catch((err) => {\n return {\n statusCode: 500,\n message: err.message,\n };\n });\n }\n\n add(webhook: Webhook) {\n debug(`Registering webhook '${webhook.id}'`);\n const { events } = webhook;\n\n events.forEach((event) => {\n if (this.webhooksMap.has(event)) {\n this.webhooksMap.get(event)?.push(webhook);\n } else {\n this.webhooksMap.set(event, [webhook]);\n this.createListener(event);\n }\n });\n }\n\n update(webhook: Webhook) {\n debug(`Refreshing webhook '${webhook.id}'`);\n this.remove(webhook);\n this.add(webhook);\n }\n\n remove(webhook: Webhook) {\n debug(`Unregistering webhook '${webhook.id}'`);\n\n this.webhooksMap.forEach((webhooks, event) => {\n const filteredWebhooks = webhooks.filter((value) => value.id !== webhook.id);\n\n // Cleanup hanging listeners\n if (filteredWebhooks.length === 0) {\n this.webhooksMap.delete(event);\n this.deleteListener(event);\n } else {\n this.webhooksMap.set(event, filteredWebhooks);\n }\n });\n }\n}\n\n/**\n * Expose a factory function instead of the class\n */\nexport default function createWebhookRunner(opts: ConstructorParameters): WebhookRunner {\n return new WebhookRunner(opts);\n}\n\nexport type { WebhookRunner };\n"],"names":["createdDebugger","_","WorkerQueue"],"mappings":";;;;;;;AAiCA,MAAM,QAAQA,gCAAgB,gBAAgB;AAE9C,MAAM,uBAA+B;AAAA,EACnC,gBAAgB,CAAA;AAClB;AAEA,MAAM,cAAc;AAAA,EACV;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA,kCAA0C,IAAI;AAAA,EAE9C,gCAAuC,IAAI;AAAA,EAE3C;AAAA,EAEA;AAAA,EAER,YAAY,EAAE,UAAU,QAAQ,gBAAgB,CAAA,GAAI,SAAgC;AAClF,UAAM,4BAA4B;AAClC,SAAK,WAAW;AAChB,SAAK,SAAS;AACd,SAAK,QAAQ;AAET,QAAA,OAAO,kBAAkB,UAAU;AACrC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IAAA;AAGF,SAAK,SAASC,WAAAA,QAAE,MAAM,sBAAsB,aAAa;AAEzD,SAAK,QAAQ,IAAIC,YAAY,EAAE,QAAQ,aAAa,GAAG;AAEvD,SAAK,MAAM,UAAU,KAAK,gBAAgB,KAAK,IAAI,CAAC;AAAA,EAAA;AAAA,EAGtD,eAAe,OAAe;AACtB,UAAA,gCAAgC,KAAK,GAAG;AAE9C,UAAM,KAAK,KAAK,UAAU,IAAI,KAAK;AAEnC,QAAI,O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,IAAI;AAC/B;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"webhook-runner.mjs","sources":["../../src/services/webhook-runner.ts"],"sourcesContent":["/**\n * The event hub is Strapi's event control center.\n */\n\nimport createdDebugger from 'debug';\nimport _ from 'lodash';\nimport type { Logger } from '@strapi/logger';\n\nimport type { Modules } from '@strapi/types';\nimport WorkerQueue from './worker-queue';\nimport type { EventHub } from './event-hub';\nimport type { Fetch } from '../utils/fetch';\n\ntype Webhook = Modules.WebhookStore.Webhook;\n\ninterface Config {\n defaultHeaders: Record<string, string>;\n}\n\ninterface ConstructorParameters {\n eventHub: EventHub;\n logger: Logger;\n configuration?: Record<string, unknown>;\n fetch: Fetch;\n}\n\ninterface Event {\n event: string;\n info: Record<string, unknown>;\n}\n\ntype Listener = (info: Record<string, unknown>) => Promise<void>;\n\nconst debug = createdDebugger('strapi:webhook');\n\nconst defaultConfiguration: Config = {\n defaultHeaders: {},\n};\n\nclass WebhookRunner {\n private eventHub: EventHub;\n\n private logger: Logger;\n\n private config: Config;\n\n private webhooksMap: Map<string, Webhook[]> = new Map();\n\n private listeners: Map<string, Listener> = new Map();\n\n private queue: WorkerQueue<Event, void>;\n\n private fetch: Fetch;\n\n constructor({ eventHub, logger, configuration = {}, fetch }: ConstructorParameters) {\n debug('Initialized webhook runner');\n this.eventHub = eventHub;\n this.logger = logger;\n this.fetch = fetch;\n\n if (typeof configuration !== 'object') {\n throw new Error(\n 'Invalid configuration provided to the webhookRunner.\\nCheck your server.json -> webhooks configuration'\n );\n }\n\n this.config = _.merge(defaultConfiguration, configuration);\n\n this.queue = new WorkerQueue({ logger, concurrency: 5 });\n\n this.queue.subscribe(this.executeListener.bind(this));\n }\n\n deleteListener(event: string) {\n debug(`Deleting listener for event '${event}'`);\n\n const fn = this.listeners.get(event);\n\n if (fn !== undefined) {\n this.eventHub.off(event, fn);\n this.listeners.delete(event);\n }\n }\n\n createListener(event: string) {\n debug(`Creating listener for event '${event}'`);\n if (this.listeners.has(event)) {\n this.logger.error(\n `The webhook runner is already listening for the event '${event}'. Did you mean to call .register() ?`\n );\n }\n\n const listen = async (info: Event['info']) => {\n this.queue.enqueue({ event, info });\n };\n\n this.listeners.set(event, listen);\n this.eventHub.on(event, listen);\n }\n\n async executeListener({ event, info }: Event) {\n debug(`Executing webhook for event '${event}'`);\n const webhooks = this.webhooksMap.get(event) || [];\n const activeWebhooks = webhooks.filter((webhook) => webhook.isEnabled === true);\n\n for (const webhook of activeWebhooks) {\n await this.run(webhook, event, info).catch((error: unknown) => {\n this.logger.error('Error running webhook');\n this.logger.error(error);\n });\n }\n }\n\n run(webhook: Webhook, event: string, info = {}) {\n const { url, headers } = webhook;\n\n return this.fetch(url, {\n method: 'post',\n body: JSON.stringify({\n event,\n createdAt: new Date(),\n ...info,\n }),\n headers: {\n ...this.config.defaultHeaders,\n ...headers,\n 'X-Strapi-Event': event,\n 'Content-Type': 'application/json',\n },\n signal: AbortSignal.timeout(10000),\n })\n .then(async (res) => {\n if (res.ok) {\n return {\n statusCode: res.status,\n };\n }\n\n return {\n statusCode: res.status,\n message: await res.text(),\n };\n })\n .catch((err) => {\n return {\n statusCode: 500,\n message: err.message,\n };\n });\n }\n\n add(webhook: Webhook) {\n debug(`Registering webhook '${webhook.id}'`);\n const { events } = webhook;\n\n events.forEach((event) => {\n if (this.webhooksMap.has(event)) {\n this.webhooksMap.get(event)?.push(webhook);\n } else {\n this.webhooksMap.set(event, [webhook]);\n this.createListener(event);\n }\n });\n }\n\n update(webhook: Webhook) {\n debug(`Refreshing webhook '${webhook.id}'`);\n this.remove(webhook);\n this.add(webhook);\n }\n\n remove(webhook: Webhook) {\n debug(`Unregistering webhook '${webhook.id}'`);\n\n this.webhooksMap.forEach((webhooks, event) => {\n const filteredWebhooks = webhooks.filter((value) => value.id !== webhook.id);\n\n // Cleanup hanging listeners\n if (filteredWebhooks.length === 0) {\n this.webhooksMap.delete(event);\n this.deleteListener(event);\n } else {\n this.webhooksMap.set(event, filteredWebhooks);\n }\n });\n }\n}\n\n/**\n * Expose a factory function instead of the class\n */\nexport default function createWebhookRunner(opts: ConstructorParameters): WebhookRunner {\n return new WebhookRunner(opts);\n}\n\nexport type { WebhookRunner };\n"],"names":["createdDebugger"],"mappings":";;;AAiCA,MAAM,QAAQA,eAAgB,gBAAgB;AAE9C,MAAM,uBAA+B;AAAA,EACnC,gBAAgB,
|
1
|
+
{"version":3,"file":"webhook-runner.mjs","sources":["../../src/services/webhook-runner.ts"],"sourcesContent":["/**\n * The event hub is Strapi's event control center.\n */\n\nimport createdDebugger from 'debug';\nimport _ from 'lodash';\nimport type { Logger } from '@strapi/logger';\n\nimport type { Modules } from '@strapi/types';\nimport WorkerQueue from './worker-queue';\nimport type { EventHub } from './event-hub';\nimport type { Fetch } from '../utils/fetch';\n\ntype Webhook = Modules.WebhookStore.Webhook;\n\ninterface Config {\n defaultHeaders: Record<string, string>;\n}\n\ninterface ConstructorParameters {\n eventHub: EventHub;\n logger: Logger;\n configuration?: Record<string, unknown>;\n fetch: Fetch;\n}\n\ninterface Event {\n event: string;\n info: Record<string, unknown>;\n}\n\ntype Listener = (info: Record<string, unknown>) => Promise<void>;\n\nconst debug = createdDebugger('strapi:webhook');\n\nconst defaultConfiguration: Config = {\n defaultHeaders: {},\n};\n\nclass WebhookRunner {\n private eventHub: EventHub;\n\n private logger: Logger;\n\n private config: Config;\n\n private webhooksMap: Map<string, Webhook[]> = new Map();\n\n private listeners: Map<string, Listener> = new Map();\n\n private queue: WorkerQueue<Event, void>;\n\n private fetch: Fetch;\n\n constructor({ eventHub, logger, configuration = {}, fetch }: ConstructorParameters) {\n debug('Initialized webhook runner');\n this.eventHub = eventHub;\n this.logger = logger;\n this.fetch = fetch;\n\n if (typeof configuration !== 'object') {\n throw new Error(\n 'Invalid configuration provided to the webhookRunner.\\nCheck your server.json -> webhooks configuration'\n );\n }\n\n this.config = _.merge(defaultConfiguration, configuration);\n\n this.queue = new WorkerQueue({ logger, concurrency: 5 });\n\n this.queue.subscribe(this.executeListener.bind(this));\n }\n\n deleteListener(event: string) {\n debug(`Deleting listener for event '${event}'`);\n\n const fn = this.listeners.get(event);\n\n if (fn !== undefined) {\n this.eventHub.off(event, fn);\n this.listeners.delete(event);\n }\n }\n\n createListener(event: string) {\n debug(`Creating listener for event '${event}'`);\n if (this.listeners.has(event)) {\n this.logger.error(\n `The webhook runner is already listening for the event '${event}'. Did you mean to call .register() ?`\n );\n }\n\n const listen = async (info: Event['info']) => {\n this.queue.enqueue({ event, info });\n };\n\n this.listeners.set(event, listen);\n this.eventHub.on(event, listen);\n }\n\n async executeListener({ event, info }: Event) {\n debug(`Executing webhook for event '${event}'`);\n const webhooks = this.webhooksMap.get(event) || [];\n const activeWebhooks = webhooks.filter((webhook) => webhook.isEnabled === true);\n\n for (const webhook of activeWebhooks) {\n await this.run(webhook, event, info).catch((error: unknown) => {\n this.logger.error('Error running webhook');\n this.logger.error(error);\n });\n }\n }\n\n run(webhook: Webhook, event: string, info = {}) {\n const { url, headers } = webhook;\n\n return this.fetch(url, {\n method: 'post',\n body: JSON.stringify({\n event,\n createdAt: new Date(),\n ...info,\n }),\n headers: {\n ...this.config.defaultHeaders,\n ...headers,\n 'X-Strapi-Event': event,\n 'Content-Type': 'application/json',\n },\n signal: AbortSignal.timeout(10000),\n })\n .then(async (res) => {\n if (res.ok) {\n return {\n statusCode: res.status,\n };\n }\n\n return {\n statusCode: res.status,\n message: await res.text(),\n };\n })\n .catch((err) => {\n return {\n statusCode: 500,\n message: err.message,\n };\n });\n }\n\n add(webhook: Webhook) {\n debug(`Registering webhook '${webhook.id}'`);\n const { events } = webhook;\n\n events.forEach((event) => {\n if (this.webhooksMap.has(event)) {\n this.webhooksMap.get(event)?.push(webhook);\n } else {\n this.webhooksMap.set(event, [webhook]);\n this.createListener(event);\n }\n });\n }\n\n update(webhook: Webhook) {\n debug(`Refreshing webhook '${webhook.id}'`);\n this.remove(webhook);\n this.add(webhook);\n }\n\n remove(webhook: Webhook) {\n debug(`Unregistering webhook '${webhook.id}'`);\n\n this.webhooksMap.forEach((webhooks, event) => {\n const filteredWebhooks = webhooks.filter((value) => value.id !== webhook.id);\n\n // Cleanup hanging listeners\n if (filteredWebhooks.length === 0) {\n this.webhooksMap.delete(event);\n this.deleteListener(event);\n } else {\n this.webhooksMap.set(event, filteredWebhooks);\n }\n });\n }\n}\n\n/**\n * Expose a factory function instead of the class\n */\nexport default function createWebhookRunner(opts: ConstructorParameters): WebhookRunner {\n return new WebhookRunner(opts);\n}\n\nexport type { WebhookRunner };\n"],"names":["createdDebugger"],"mappings":";;;AAiCA,MAAM,QAAQA,eAAgB,gBAAgB;AAE9C,MAAM,uBAA+B;AAAA,EACnC,gBAAgB,CAAA;AAClB;AAEA,MAAM,cAAc;AAAA,EACV;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA,kCAA0C,IAAI;AAAA,EAE9C,gCAAuC,IAAI;AAAA,EAE3C;AAAA,EAEA;AAAA,EAER,YAAY,EAAE,UAAU,QAAQ,gBAAgB,CAAA,GAAI,SAAgC;AAClF,UAAM,4BAA4B;AAClC,SAAK,WAAW;AAChB,SAAK,SAAS;AACd,SAAK,QAAQ;AAET,QAAA,OAAO,kBAAkB,UAAU;AACrC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IAAA;AAGF,SAAK,SAAS,EAAE,MAAM,sBAAsB,aAAa;AAEzD,SAAK,QAAQ,IAAI,YAAY,EAAE,QAAQ,aAAa,GAAG;AAEvD,SAAK,MAAM,UAAU,KAAK,gBAAgB,KAAK,IAAI,CAAC;AAAA,EAAA;AAAA,EAGtD,eAAe,OAAe;AACtB,UAAA,gCAAgC,KAAK,GAAG;AAE9C,UAAM,KAAK,KAAK,UAAU,IAAI,KAAK;AAEnC,QAAI,OAAO,QAAW;AACf,WAAA,SAAS,IAAI,OAAO,EAAE;AACtB,WAAA,UAAU,OAAO,KAAK;AAAA,IAAA;AAAA,EAC7B;AAAA,EAGF,eAAe,OAAe;AACtB,UAAA,gC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L,YAAY,IAAI;AAAA,QAChB,SAAS,MAAM,IAAI,KAAK;AAAA,MAC1B;AAAA,IAAA,CACD,EACA,MAAM,CAAC,QAAQ;AACP,aAAA;AAAA,QACL,YAAY;AAAA,QACZ,SAAS,IAAI;AAAA,MACf;AAAA,IAAA,CACD;AAAA,EAAA;AAAA,EAGL,IAAI,SAAkB;AACd,UAAA,wBAAwB,QAAQ,EAAE,GAAG;AACrC,UAAA,EAAE,WAAW;AAEZ,WAAA,QAAQ,CAAC,UAAU;AACxB,UAAI,KAAK,YAAY,IAAI,KAAK,GAAG;AAC/B,aAAK,YAAY,IAAI,KAAK,GAAG,KAAK,OAAO;AAAA,MAAA,OACpC;AACL,aAAK,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;AACrC,aAAK,eAAe,KAAK;AAAA,MAAA;AAAA,IAC3B,CACD;AAAA,EAAA;AAAA,EAGH,OAAO,SAAkB;AACjB,UAAA,uBAAuB,QAAQ,EAAE,GAAG;AAC1C,SAAK,OAAO,OAAO;AACnB,SAAK,IAAI,OAAO;AAAA,EAAA;AAAA,EAGlB,OAAO,SAAkB;AACjB,UAAA,0BAA0B,QAAQ,EAAE,GAAG;AAE7C,SAAK,YAAY,QAAQ,CAAC,UAAU,UAAU;AACtC,YAAA,mBAAmB,SAAS,OAAO,CAAC,UAAU,MAAM,OAAO,QAAQ,EAAE;AAGvE,UAAA,iBAAiB,WAAW,GAAG;AAC5B,aAAA,YAAY,OAAO,KAAK;AAC7B,aAAK,eAAe,KAAK;AAAA,MAAA,OACpB;AACA,aAAA,YAAY,IAAI,OAAO,gBAAgB;AAAA,MAAA;AAAA,IAC9C,CACD;AAAA,EAAA;AAEL;AAKA,SAAwB,oBAAoB,MAA4C;AAC/E,SAAA,IAAI,cAAc,IAAI;AAC/B;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"webhook-store.js","sources":["../../src/services/webhook-store.ts"],"sourcesContent":["/**\n * Webhook store is the implementation of webhook storage over the core_store\n */\n\nimport { errors } from '@strapi/utils';\nimport type { Model, Database } from '@strapi/database';\nimport type { Modules } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst webhookModel: Model = {\n uid: 'strapi::webhook',\n singularName: 'strapi_webhooks',\n tableName: 'strapi_webhooks',\n attributes: {\n id: {\n type: 'increments',\n },\n name: {\n type: 'string',\n },\n url: {\n type: 'text',\n },\n headers: {\n type: 'json',\n },\n events: {\n type: 'json',\n },\n enabled: {\n type: 'boolean',\n },\n },\n};\n\ntype Webhook = Modules.WebhookStore.Webhook;\ntype DBOutput = Omit<Webhook, 'id' | 'isEnabled'> & { id: string | number; enabled: boolean };\ntype DBInput = Omit<DBOutput, 'id'>;\n\nconst toDBObject = (data: Webhook): DBInput => {\n return {\n name: data.name,\n url: data.url,\n headers: data.headers,\n events: data.events,\n enabled: data.isEnabled,\n };\n};\n\nconst fromDBObject = (row: DBOutput): Webhook => {\n return {\n id: typeof row.id === 'number' ? row.id.toString() : row.id,\n name: row.name,\n url: row.url,\n headers: row.headers,\n events: row.events,\n isEnabled: row.enabled,\n };\n};\n\nconst webhookEventValidator = async (allowedEvents: Map<string, string>, events: string[]) => {\n const allowedValues = Array.from(allowedEvents.values());\n\n events.forEach((event) => {\n if (allowedValues.includes(event)) {\n return;\n }\n\n throw new ValidationError(`Webhook event ${event} is not supported`);\n });\n};\n\nexport interface WebhookStore {\n allowedEvents: Map<string, string>;\n addAllowedEvent(key: string, value: string): void;\n removeAllowedEvent(key: string): void;\n listAllowedEvents(): string[];\n getAllowedEvent(key: string): string | undefined;\n findWebhooks(): Promise<Webhook[]>;\n findWebhook(id: string): Promise<Webhook | null>;\n createWebhook(data: Webhook): Promise<Webhook>;\n updateWebhook(id: string, data: Webhook): Promise<Webhook | null>;\n deleteWebhook(id: string): Promise<Webhook | null>;\n}\n\nconst createWebhookStore = ({ db }: { db: Database }): WebhookStore => {\n return {\n allowedEvents: new Map([\n ['ENTRY_CREATE', 'entry.create'],\n ['ENTRY_UPDATE', 'entry.update'],\n ['ENTRY_DELETE', 'entry.delete'],\n ['ENTRY_PUBLISH', 'entry.publish'],\n ['ENTRY_UNPUBLISH', 'entry.unpublish'],\n ['ENTRY_DRAFT_DISCARD', 'entry.draft-discard'],\n ]),\n addAllowedEvent(key, value) {\n this.allowedEvents.set(key, value);\n },\n removeAllowedEvent(key) {\n this.allowedEvents.delete(key);\n },\n listAllowedEvents() {\n return Array.from(this.allowedEvents.keys());\n },\n getAllowedEvent(key) {\n return this.allowedEvents.get(key);\n },\n async findWebhooks() {\n const results = await db.query('strapi::webhook').findMany();\n\n return results.map(fromDBObject);\n },\n async findWebhook(id) {\n const result = await db.query('strapi::webhook').findOne({ where: { id } });\n return result ? fromDBObject(result) : null;\n },\n async createWebhook(data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n return db\n .query('strapi::webhook')\n .create({\n data: toDBObject({ ...data, isEnabled: true }),\n })\n .then(fromDBObject);\n },\n async updateWebhook(id, data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n const webhook = await db.query('strapi::webhook').update({\n where: { id },\n data: toDBObject(data),\n });\n\n return webhook ? fromDBObject(webhook) : null;\n },\n async deleteWebhook(id) {\n const webhook = await db.query('strapi::webhook').delete({ where: { id } });\n return webhook ? fromDBObject(webhook) : null;\n },\n };\n};\n\nexport { webhookModel, createWebhookStore };\n"],"names":["errors"],"mappings":";;;AAQA,MAAM,EAAE,gBAAoB,IAAAA;AAE5B,MAAM,eAAsB;AAAA,EAC1B,KAAK;AAAA,EACL,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,IACA,KAAK;AAAA,MACH,MAAM;AAAA,IACR;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,
|
1
|
+
{"version":3,"file":"webhook-store.js","sources":["../../src/services/webhook-store.ts"],"sourcesContent":["/**\n * Webhook store is the implementation of webhook storage over the core_store\n */\n\nimport { errors } from '@strapi/utils';\nimport type { Model, Database } from '@strapi/database';\nimport type { Modules } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst webhookModel: Model = {\n uid: 'strapi::webhook',\n singularName: 'strapi_webhooks',\n tableName: 'strapi_webhooks',\n attributes: {\n id: {\n type: 'increments',\n },\n name: {\n type: 'string',\n },\n url: {\n type: 'text',\n },\n headers: {\n type: 'json',\n },\n events: {\n type: 'json',\n },\n enabled: {\n type: 'boolean',\n },\n },\n};\n\ntype Webhook = Modules.WebhookStore.Webhook;\ntype DBOutput = Omit<Webhook, 'id' | 'isEnabled'> & { id: string | number; enabled: boolean };\ntype DBInput = Omit<DBOutput, 'id'>;\n\nconst toDBObject = (data: Webhook): DBInput => {\n return {\n name: data.name,\n url: data.url,\n headers: data.headers,\n events: data.events,\n enabled: data.isEnabled,\n };\n};\n\nconst fromDBObject = (row: DBOutput): Webhook => {\n return {\n id: typeof row.id === 'number' ? row.id.toString() : row.id,\n name: row.name,\n url: row.url,\n headers: row.headers,\n events: row.events,\n isEnabled: row.enabled,\n };\n};\n\nconst webhookEventValidator = async (allowedEvents: Map<string, string>, events: string[]) => {\n const allowedValues = Array.from(allowedEvents.values());\n\n events.forEach((event) => {\n if (allowedValues.includes(event)) {\n return;\n }\n\n throw new ValidationError(`Webhook event ${event} is not supported`);\n });\n};\n\nexport interface WebhookStore {\n allowedEvents: Map<string, string>;\n addAllowedEvent(key: string, value: string): void;\n removeAllowedEvent(key: string): void;\n listAllowedEvents(): string[];\n getAllowedEvent(key: string): string | undefined;\n findWebhooks(): Promise<Webhook[]>;\n findWebhook(id: string): Promise<Webhook | null>;\n createWebhook(data: Webhook): Promise<Webhook>;\n updateWebhook(id: string, data: Webhook): Promise<Webhook | null>;\n deleteWebhook(id: string): Promise<Webhook | null>;\n}\n\nconst createWebhookStore = ({ db }: { db: Database }): WebhookStore => {\n return {\n allowedEvents: new Map([\n ['ENTRY_CREATE', 'entry.create'],\n ['ENTRY_UPDATE', 'entry.update'],\n ['ENTRY_DELETE', 'entry.delete'],\n ['ENTRY_PUBLISH', 'entry.publish'],\n ['ENTRY_UNPUBLISH', 'entry.unpublish'],\n ['ENTRY_DRAFT_DISCARD', 'entry.draft-discard'],\n ]),\n addAllowedEvent(key, value) {\n this.allowedEvents.set(key, value);\n },\n removeAllowedEvent(key) {\n this.allowedEvents.delete(key);\n },\n listAllowedEvents() {\n return Array.from(this.allowedEvents.keys());\n },\n getAllowedEvent(key) {\n return this.allowedEvents.get(key);\n },\n async findWebhooks() {\n const results = await db.query('strapi::webhook').findMany();\n\n return results.map(fromDBObject);\n },\n async findWebhook(id) {\n const result = await db.query('strapi::webhook').findOne({ where: { id } });\n return result ? fromDBObject(result) : null;\n },\n async createWebhook(data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n return db\n .query('strapi::webhook')\n .create({\n data: toDBObject({ ...data, isEnabled: true }),\n })\n .then(fromDBObject);\n },\n async updateWebhook(id, data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n const webhook = await db.query('strapi::webhook').update({\n where: { id },\n data: toDBObject(data),\n });\n\n return webhook ? fromDBObject(webhook) : null;\n },\n async deleteWebhook(id) {\n const webhook = await db.query('strapi::webhook').delete({ where: { id } });\n return webhook ? fromDBObject(webhook) : null;\n },\n };\n};\n\nexport { webhookModel, createWebhookStore };\n"],"names":["errors"],"mappings":";;;AAQA,MAAM,EAAE,gBAAoB,IAAAA,YAAA;AAE5B,MAAM,eAAsB;AAAA,EAC1B,KAAK;AAAA,EACL,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,IACA,KAAK;AAAA,MACH,MAAM;AAAA,IACR;A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cesContent":["/**\n * Webhook store is the implementation of webhook storage over the core_store\n */\n\nimport { errors } from '@strapi/utils';\nimport type { Model, Database } from '@strapi/database';\nimport type { Modules } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst webhookModel: Model = {\n uid: 'strapi::webhook',\n singularName: 'strapi_webhooks',\n tableName: 'strapi_webhooks',\n attributes: {\n id: {\n type: 'increments',\n },\n name: {\n type: 'string',\n },\n url: {\n type: 'text',\n },\n headers: {\n type: 'json',\n },\n events: {\n type: 'json',\n },\n enabled: {\n type: 'boolean',\n },\n },\n};\n\ntype Webhook = Modules.WebhookStore.Webhook;\ntype DBOutput = Omit<Webhook, 'id' | 'isEnabled'> & { id: string | number; enabled: boolean };\ntype DBInput = Omit<DBOutput, 'id'>;\n\nconst toDBObject = (data: Webhook): DBInput => {\n return {\n name: data.name,\n url: data.url,\n headers: data.headers,\n events: data.events,\n enabled: data.isEnabled,\n };\n};\n\nconst fromDBObject = (row: DBOutput): Webhook => {\n return {\n id: typeof row.id === 'number' ? row.id.toString() : row.id,\n name: row.name,\n url: row.url,\n headers: row.headers,\n events: row.events,\n isEnabled: row.enabled,\n };\n};\n\nconst webhookEventValidator = async (allowedEvents: Map<string, string>, events: string[]) => {\n const allowedValues = Array.from(allowedEvents.values());\n\n events.forEach((event) => {\n if (allowedValues.includes(event)) {\n return;\n }\n\n throw new ValidationError(`Webhook event ${event} is not supported`);\n });\n};\n\nexport interface WebhookStore {\n allowedEvents: Map<string, string>;\n addAllowedEvent(key: string, value: string): void;\n removeAllowedEvent(key: string): void;\n listAllowedEvents(): string[];\n getAllowedEvent(key: string): string | undefined;\n findWebhooks(): Promise<Webhook[]>;\n findWebhook(id: string): Promise<Webhook | null>;\n createWebhook(data: Webhook): Promise<Webhook>;\n updateWebhook(id: string, data: Webhook): Promise<Webhook | null>;\n deleteWebhook(id: string): Promise<Webhook | null>;\n}\n\nconst createWebhookStore = ({ db }: { db: Database }): WebhookStore => {\n return {\n allowedEvents: new Map([\n ['ENTRY_CREATE', 'entry.create'],\n ['ENTRY_UPDATE', 'entry.update'],\n ['ENTRY_DELETE', 'entry.delete'],\n ['ENTRY_PUBLISH', 'entry.publish'],\n ['ENTRY_UNPUBLISH', 'entry.unpublish'],\n ['ENTRY_DRAFT_DISCARD', 'entry.draft-discard'],\n ]),\n addAllowedEvent(key, value) {\n this.allowedEvents.set(key, value);\n },\n removeAllowedEvent(key) {\n this.allowedEvents.delete(key);\n },\n listAllowedEvents() {\n return Array.from(this.allowedEvents.keys());\n },\n getAllowedEvent(key) {\n return this.allowedEvents.get(key);\n },\n async findWebhooks() {\n const results = await db.query('strapi::webhook').findMany();\n\n return results.map(fromDBObject);\n },\n async findWebhook(id) {\n const result = await db.query('strapi::webhook').findOne({ where: { id } });\n return result ? fromDBObject(result) : null;\n },\n async createWebhook(data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n return db\n .query('strapi::webhook')\n .create({\n data: toDBObject({ ...data, isEnabled: true }),\n })\n .then(fromDBObject);\n },\n async updateWebhook(id, data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n const webhook = await db.query('strapi::webhook').update({\n where: { id },\n data: toDBObject(data),\n });\n\n return webhook ? fromDBObject(webhook) : null;\n },\n async deleteWebhook(id) {\n const webhook = await db.query('strapi::webhook').delete({ where: { id } });\n return webhook ? fromDBObject(webhook) : null;\n },\n };\n};\n\nexport { webhookModel, createWebhookStore };\n"],"names":[],"mappings":";AAQA,MAAM,EAAE,gBAAoB,IAAA;AAE5B,MAAM,eAAsB;AAAA,EAC1B,KAAK;AAAA,EACL,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,IACA,KAAK;AAAA,MACH,MAAM;AAAA,IACR;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,
|
1
|
+
{"version":3,"file":"webhook-store.mjs","sources":["../../src/services/webhook-store.ts"],"sourcesContent":["/**\n * Webhook store is the implementation of webhook storage over the core_store\n */\n\nimport { errors } from '@strapi/utils';\nimport type { Model, Database } from '@strapi/database';\nimport type { Modules } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst webhookModel: Model = {\n uid: 'strapi::webhook',\n singularName: 'strapi_webhooks',\n tableName: 'strapi_webhooks',\n attributes: {\n id: {\n type: 'increments',\n },\n name: {\n type: 'string',\n },\n url: {\n type: 'text',\n },\n headers: {\n type: 'json',\n },\n events: {\n type: 'json',\n },\n enabled: {\n type: 'boolean',\n },\n },\n};\n\ntype Webhook = Modules.WebhookStore.Webhook;\ntype DBOutput = Omit<Webhook, 'id' | 'isEnabled'> & { id: string | number; enabled: boolean };\ntype DBInput = Omit<DBOutput, 'id'>;\n\nconst toDBObject = (data: Webhook): DBInput => {\n return {\n name: data.name,\n url: data.url,\n headers: data.headers,\n events: data.events,\n enabled: data.isEnabled,\n };\n};\n\nconst fromDBObject = (row: DBOutput): Webhook => {\n return {\n id: typeof row.id === 'number' ? row.id.toString() : row.id,\n name: row.name,\n url: row.url,\n headers: row.headers,\n events: row.events,\n isEnabled: row.enabled,\n };\n};\n\nconst webhookEventValidator = async (allowedEvents: Map<string, string>, events: string[]) => {\n const allowedValues = Array.from(allowedEvents.values());\n\n events.forEach((event) => {\n if (allowedValues.includes(event)) {\n return;\n }\n\n throw new ValidationError(`Webhook event ${event} is not supported`);\n });\n};\n\nexport interface WebhookStore {\n allowedEvents: Map<string, string>;\n addAllowedEvent(key: string, value: string): void;\n removeAllowedEvent(key: string): void;\n listAllowedEvents(): string[];\n getAllowedEvent(key: string): string | undefined;\n findWebhooks(): Promise<Webhook[]>;\n findWebhook(id: string): Promise<Webhook | null>;\n createWebhook(data: Webhook): Promise<Webhook>;\n updateWebhook(id: string, data: Webhook): Promise<Webhook | null>;\n deleteWebhook(id: string): Promise<Webhook | null>;\n}\n\nconst createWebhookStore = ({ db }: { db: Database }): WebhookStore => {\n return {\n allowedEvents: new Map([\n ['ENTRY_CREATE', 'entry.create'],\n ['ENTRY_UPDATE', 'entry.update'],\n ['ENTRY_DELETE', 'entry.delete'],\n ['ENTRY_PUBLISH', 'entry.publish'],\n ['ENTRY_UNPUBLISH', 'entry.unpublish'],\n ['ENTRY_DRAFT_DISCARD', 'entry.draft-discard'],\n ]),\n addAllowedEvent(key, value) {\n this.allowedEvents.set(key, value);\n },\n removeAllowedEvent(key) {\n this.allowedEvents.delete(key);\n },\n listAllowedEvents() {\n return Array.from(this.allowedEvents.keys());\n },\n getAllowedEvent(key) {\n return this.allowedEvents.get(key);\n },\n async findWebhooks() {\n const results = await db.query('strapi::webhook').findMany();\n\n return results.map(fromDBObject);\n },\n async findWebhook(id) {\n const result = await db.query('strapi::webhook').findOne({ where: { id } });\n return result ? fromDBObject(result) : null;\n },\n async createWebhook(data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n return db\n .query('strapi::webhook')\n .create({\n data: toDBObject({ ...data, isEnabled: true }),\n })\n .then(fromDBObject);\n },\n async updateWebhook(id, data) {\n await webhookEventValidator(this.allowedEvents, data.events);\n\n const webhook = await db.query('strapi::webhook').update({\n where: { id },\n data: toDBObject(data),\n });\n\n return webhook ? fromDBObject(webhook) : null;\n },\n async deleteWebhook(id) {\n const webhook = await db.query('strapi::webhook').delete({ where: { id } });\n return webhook ? fromDBObject(webhook) : null;\n },\n };\n};\n\nexport { webhookModel, createWebhookStore };\n"],"names":[],"mappings":";AAQA,MAAM,EAAE,gBAAoB,IAAA;AAE5B,MAAM,eAAsB;AAAA,EAC1B,KAAK;AAAA,EACL,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,IACA,KAAK;AAA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src/services/worker-queue.ts"],"sourcesContent":["/**\n * Simple worker queue in memory\n */\nimport createDebugger from 'debug';\nimport type { Logger } from '@strapi/logger';\nimport type { Utils } from '@strapi/types';\n\nconst debug = createDebugger('strapi:worker-queue');\n\ninterface ConstructorParameters {\n logger: Logger;\n concurrency?: number;\n}\n\ntype Worker<TPayload, TReturn> = (payload: TPayload) => Promise<TReturn> | TReturn;\n\nconst noop: Utils.Function.Any = () => {};\n\nexport default class WorkerQueue<TPayload, TReturn> {\n logger: Logger;\n\n worker: Worker<TPayload, TReturn>;\n\n concurrency: number;\n\n running: number;\n\n queue: TPayload[];\n\n constructor({ logger, concurrency = 5 }: ConstructorParameters) {\n debug('Initialize worker queue');\n\n this.logger = logger;\n this.worker = noop;\n\n this.concurrency = concurrency;\n this.running = 0;\n this.queue = [];\n }\n\n subscribe(worker: Worker<TPayload, TReturn>) {\n debug('Subscribe to worker queue');\n this.worker = worker;\n }\n\n enqueue(payload: TPayload) {\n debug('Enqueue event in worker queue');\n if (this.running < this.concurrency) {\n this.running += 1;\n this.execute(payload);\n } else {\n this.queue.unshift(payload);\n }\n }\n\n pop() {\n debug('Pop worker queue and execute');\n const payload = this.queue.pop();\n\n if (payload) {\n this.execute(payload);\n } else {\n this.running -= 1;\n }\n }\n\n async execute(payload: TPayload) {\n debug('Execute worker');\n try {\n await this.worker(payload);\n } catch (error) {\n this.logger.error(error);\n } finally {\n this.pop();\n }\n }\n}\n"],"names":["createDebugger"],"mappings":";;;;AAOA,MAAM,QAAQA,
|
1
|
+
{"version":3,"file":"worker-queue.js","sources":["../../src/services/worker-queue.ts"],"sourcesContent":["/**\n * Simple worker queue in memory\n */\nimport createDebugger from 'debug';\nimport type { Logger } from '@strapi/logger';\nimport type { Utils } from '@strapi/types';\n\nconst debug = createDebugger('strapi:worker-queue');\n\ninterface ConstructorParameters {\n logger: Logger;\n concurrency?: number;\n}\n\ntype Worker<TPayload, TReturn> = (payload: TPayload) => Promise<TReturn> | TReturn;\n\nconst noop: Utils.Function.Any = () => {};\n\nexport default class WorkerQueue<TPayload, TReturn> {\n logger: Logger;\n\n worker: Worker<TPayload, TReturn>;\n\n concurrency: number;\n\n running: number;\n\n queue: TPayload[];\n\n constructor({ logger, concurrency = 5 }: ConstructorParameters) {\n debug('Initialize worker queue');\n\n this.logger = logger;\n this.worker = noop;\n\n this.concurrency = concurrency;\n this.running = 0;\n this.queue = [];\n }\n\n subscribe(worker: Worker<TPayload, TReturn>) {\n debug('Subscribe to worker queue');\n this.worker = worker;\n }\n\n enqueue(payload: TPayload) {\n debug('Enqueue event in worker queue');\n if (this.running < this.concurrency) {\n this.running += 1;\n this.execute(payload);\n } else {\n this.queue.unshift(payload);\n }\n }\n\n pop() {\n debug('Pop worker queue and execute');\n const payload = this.queue.pop();\n\n if (payload) {\n this.execute(payload);\n } else {\n this.running -= 1;\n }\n }\n\n async execute(payload: TPayload) {\n debug('Execute worker');\n try {\n await this.worker(payload);\n } catch (error) {\n this.logger.error(error);\n } finally {\n this.pop();\n }\n }\n}\n"],"names":["createDebugger"],"mappings":";;;;AAOA,MAAM,QAAQA,gCAAe,qBAAqB;AASlD,MAAM,OAA2B,MAAM;AAAC;AAExC,MAAqB,YAA+B;AAAA,EAClD;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA,YAAY,EAAE,QAAQ,cAAc,KAA4B;AAC9D,UAAM,yBAAyB;AAE/B,SAAK,SAAS;AACd,SAAK,SAAS;AAEd,SAAK,cAAc;AACnB,SAAK,UAAU;AACf,SAAK,QAAQ,CAAC;AAAA,EAAA;AAAA,EAGhB,UAAU,QAAmC;AAC3C,UAAM,2BAA2B;AACjC,SAAK,SAAS;AAAA,EAAA;AAAA,EAGhB,QAAQ,SAAmB;AACzB,UAAM,+BAA+B;AACjC,QAAA,KAAK,UAAU,KAAK,aAAa;AACnC,WAAK,WAAW;AAChB,WAAK,QAAQ,OAAO;AAAA,IAAA,OACf;AACA,WAAA,MAAM,QAAQ,OAAO;AAAA,IAAA;AAAA,EAC5B;AAAA,EAGF,MAAM;AACJ,UAAM,8BAA8B;AAC9B,UAAA,UAAU,KAAK,MAAM,IAAI;AAE/B,QAAI,SAAS;AACX,WAAK,QAAQ,OAAO;AAAA,IAAA,OACf;AACL,WAAK,WAAW;AAAA,IAAA;AAAA,EAClB;AAAA,EAGF,MAAM,QAAQ,SAAmB;AAC/B,UAAM,gBAAgB;AAClB,QAAA;AACI,YAAA,KAAK,OAAO,OAAO;AAAA,aAClB,OAAO;AACT,WAAA,OAAO,MAAM,KAAK;AAAA,IAAA,UACvB;AACA,WAAK,IAAI;AAAA,IAAA;AAAA,EACX;AAEJ;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"worker-queue.mjs","sources":["../../src/services/worker-queue.ts"],"sourcesContent":["/**\n * Simple worker queue in memory\n */\nimport createDebugger from 'debug';\nimport type { Logger } from '@strapi/logger';\nimport type { Utils } from '@strapi/types';\n\nconst debug = createDebugger('strapi:worker-queue');\n\ninterface ConstructorParameters {\n logger: Logger;\n concurrency?: number;\n}\n\ntype Worker<TPayload, TReturn> = (payload: TPayload) => Promise<TReturn> | TReturn;\n\nconst noop: Utils.Function.Any = () => {};\n\nexport default class WorkerQueue<TPayload, TReturn> {\n logger: Logger;\n\n worker: Worker<TPayload, TReturn>;\n\n concurrency: number;\n\n running: number;\n\n queue: TPayload[];\n\n constructor({ logger, concurrency = 5 }: ConstructorParameters) {\n debug('Initialize worker queue');\n\n this.logger = logger;\n this.worker = noop;\n\n this.concurrency = concurrency;\n this.running = 0;\n this.queue = [];\n }\n\n subscribe(worker: Worker<TPayload, TReturn>) {\n debug('Subscribe to worker queue');\n this.worker = worker;\n }\n\n enqueue(payload: TPayload) {\n debug('Enqueue event in worker queue');\n if (this.running < this.concurrency) {\n this.running += 1;\n this.execute(payload);\n } else {\n this.queue.unshift(payload);\n }\n }\n\n pop() {\n debug('Pop worker queue and execute');\n const payload = this.queue.pop();\n\n if (payload) {\n this.execute(payload);\n } else {\n this.running -= 1;\n }\n }\n\n async execute(payload: TPayload) {\n debug('Execute worker');\n try {\n await this.worker(payload);\n } catch (error) {\n this.logger.error(error);\n } finally {\n this.pop();\n }\n }\n}\n"],"names":[],"mappings":";AAOA,MAAM,QAAQ,eAAe,qBAAqB;AASlD,MAAM,OAA2B,MAAM;AAAC;AAExC,MAAqB,YAA+B;AAAA,EAClD;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA,YAAY,EAAE,QAAQ,cAAc,KAA4B;AAC9D,UAAM,yBAAyB;AAE/B,SAAK,SAAS;AACd,SAAK,SAAS;AAEd,SAAK,cAAc;AACnB,SAAK,UAAU;AACf,SAAK,QAAQ;
|
1
|
+
{"version":3,"file":"worker-queue.mjs","sources":["../../src/services/worker-queue.ts"],"sourcesContent":["/**\n * Simple worker queue in memory\n */\nimport createDebugger from 'debug';\nimport type { Logger } from '@strapi/logger';\nimport type { Utils } from '@strapi/types';\n\nconst debug = createDebugger('strapi:worker-queue');\n\ninterface ConstructorParameters {\n logger: Logger;\n concurrency?: number;\n}\n\ntype Worker<TPayload, TReturn> = (payload: TPayload) => Promise<TReturn> | TReturn;\n\nconst noop: Utils.Function.Any = () => {};\n\nexport default class WorkerQueue<TPayload, TReturn> {\n logger: Logger;\n\n worker: Worker<TPayload, TReturn>;\n\n concurrency: number;\n\n running: number;\n\n queue: TPayload[];\n\n constructor({ logger, concurrency = 5 }: ConstructorParameters) {\n debug('Initialize worker queue');\n\n this.logger = logger;\n this.worker = noop;\n\n this.concurrency = concurrency;\n this.running = 0;\n this.queue = [];\n }\n\n subscribe(worker: Worker<TPayload, TReturn>) {\n debug('Subscribe to worker queue');\n this.worker = worker;\n }\n\n enqueue(payload: TPayload) {\n debug('Enqueue event in worker queue');\n if (this.running < this.concurrency) {\n this.running += 1;\n this.execute(payload);\n } else {\n this.queue.unshift(payload);\n }\n }\n\n pop() {\n debug('Pop worker queue and execute');\n const payload = this.queue.pop();\n\n if (payload) {\n this.execute(payload);\n } else {\n this.running -= 1;\n }\n }\n\n async execute(payload: TPayload) {\n debug('Execute worker');\n try {\n await this.worker(payload);\n } catch (error) {\n this.logger.error(error);\n } finally {\n this.pop();\n }\n }\n}\n"],"names":[],"mappings":";AAOA,MAAM,QAAQ,eAAe,qBAAqB;AASlD,MAAM,OAA2B,MAAM;AAAC;AAExC,MAAqB,YAA+B;AAAA,EAClD;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA,YAAY,EAAE,QAAQ,cAAc,KAA4B;AAC9D,UAAM,yBAAyB;AAE/B,SAAK,SAAS;AACd,SAAK,SAAS;AAEd,SAAK,cAAc;AACnB,SAAK,UAAU;AACf,SAAK,QAAQ,CAAC;AAAA,EAAA;AAAA,EAGhB,UAAU,QAAmC;AAC3C,UAAM,2BAA2B;AACjC,SAAK,SAAS;AAAA,EAAA;AAAA,EAGhB,QAAQ,SAAmB;AACzB,UAAM,+BAA+B;AACjC,QAAA,KAAK,UAAU,KAAK,aAAa;AACnC,WAAK,WAAW;AAChB,WAAK,QAAQ,OAAO;AAAA,IAAA,OACf;AACA,WAAA,MAAM,QAAQ,OAAO;AAAA,IAAA;AAAA,EAC5B;AAAA,EAGF,MAAM;AACJ,UAAM,8BAA8B;AAC9B,UAAA,UAAU,KAAK,MAAM,IAAI;AAE/B,QAAI,SAAS;AACX,WAAK,QAAQ,OAAO;AAAA,IAAA,OACf;AACL,WAAK,WAAW;AAAA,IAAA;AAAA,EAClB;AAAA,EAGF,MAAM,QAAQ,SAAmB;AAC/B,UAAM,gBAAgB;AAClB,QAAA;AACI,YAAA,KAAK,OAAO,OAAO;AAAA,aAClB,OAAO;AACT,WAAA,OAAO,MAAM,KAAK;AAAA,IAAA,UACvB;AACA,WAAK,IAAI;AAAA,IAAA;AAAA,EACX;AAEJ;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"convert-custom-field-type.js","sources":["../../src/utils/convert-custom-field-type.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\ntype InputAttributes = {\n [key: string]: {\n type: string;\n customField?: string;\n };\n};\n\nexport const convertCustomFieldType = (strapi: Core.Strapi) => {\n const allContentTypeSchemaAttributes = Object.values(strapi.contentTypes).map(\n (schema) => schema.attributes\n );\n\n const allComponentSchemaAttributes = Object.values(strapi.components).map(\n (schema) => schema.attributes\n );\n const allSchemasAttributes: InputAttributes[] = [\n ...allContentTypeSchemaAttributes,\n ...allComponentSchemaAttributes,\n ];\n\n for (const schemaAttrbutes of allSchemasAttributes) {\n for (const attribute of Object.values(schemaAttrbutes)) {\n if (attribute.type === 'customField') {\n const customField = strapi.get('custom-fields').get(attribute.customField);\n attribute.type = customField.type;\n }\n }\n }\n};\n"],"names":[],"mappings":";;AASa,MAAA,yBAAyB,CAAC,WAAwB;AAC7D,QAAM,iCAAiC,OAAO,OAAO,OAAO,YAAY,EAAE;AAAA,IACxE,CAAC,WAAW,OAAO;AAAA,
|
1
|
+
{"version":3,"file":"convert-custom-field-type.js","sources":["../../src/utils/convert-custom-field-type.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\ntype InputAttributes = {\n [key: string]: {\n type: string;\n customField?: string;\n };\n};\n\nexport const convertCustomFieldType = (strapi: Core.Strapi) => {\n const allContentTypeSchemaAttributes = Object.values(strapi.contentTypes).map(\n (schema) => schema.attributes\n );\n\n const allComponentSchemaAttributes = Object.values(strapi.components).map(\n (schema) => schema.attributes\n );\n const allSchemasAttributes: InputAttributes[] = [\n ...allContentTypeSchemaAttributes,\n ...allComponentSchemaAttributes,\n ];\n\n for (const schemaAttrbutes of allSchemasAttributes) {\n for (const attribute of Object.values(schemaAttrbutes)) {\n if (attribute.type === 'customField') {\n const customField = strapi.get('custom-fields').get(attribute.customField);\n attribute.type = customField.type;\n }\n }\n }\n};\n"],"names":[],"mappings":";;AASa,MAAA,yBAAyB,CAAC,WAAwB;AAC7D,QAAM,iCAAiC,OAAO,OAAO,OAAO,YAAY,EAAE;AAAA,IACxE,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,QAAM,+BAA+B,OAAO,OAAO,OAAO,UAAU,EAAE;AAAA,IACpE,CAAC,WAAW,OAAO;AAAA,EACrB;AACA,QAAM,uBAA0C;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,aAAW,mBAAmB,sBAAsB;AAClD,eAAW,aAAa,OAAO,OAAO,eAAe,GAAG;AAClD,UAAA,UAAU,SAAS,eAAe;AACpC,cAAM,cAAc,OAAO,IAAI,eAAe,EAAE,IAAI,UAAU,WAAW;AACzE,kBAAU,OAAO,YAAY;AAAA,MAAA;AAAA,IAC/B;AAAA,EACF;AAEJ;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"convert-custom-field-type.mjs","sources":["../../src/utils/convert-custom-field-type.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\ntype InputAttributes = {\n [key: string]: {\n type: string;\n customField?: string;\n };\n};\n\nexport const convertCustomFieldType = (strapi: Core.Strapi) => {\n const allContentTypeSchemaAttributes = Object.values(strapi.contentTypes).map(\n (schema) => schema.attributes\n );\n\n const allComponentSchemaAttributes = Object.values(strapi.components).map(\n (schema) => schema.attributes\n );\n const allSchemasAttributes: InputAttributes[] = [\n ...allContentTypeSchemaAttributes,\n ...allComponentSchemaAttributes,\n ];\n\n for (const schemaAttrbutes of allSchemasAttributes) {\n for (const attribute of Object.values(schemaAttrbutes)) {\n if (attribute.type === 'customField') {\n const customField = strapi.get('custom-fields').get(attribute.customField);\n attribute.type = customField.type;\n }\n }\n }\n};\n"],"names":[],"mappings":"AASa,MAAA,yBAAyB,CAAC,WAAwB;AAC7D,QAAM,iCAAiC,OAAO,OAAO,OAAO,YAAY,EAAE;AAAA,IACxE,CAAC,WAAW,OAAO;AAAA,
|
1
|
+
{"version":3,"file":"convert-custom-field-type.mjs","sources":["../../src/utils/convert-custom-field-type.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\ntype InputAttributes = {\n [key: string]: {\n type: string;\n customField?: string;\n };\n};\n\nexport const convertCustomFieldType = (strapi: Core.Strapi) => {\n const allContentTypeSchemaAttributes = Object.values(strapi.contentTypes).map(\n (schema) => schema.attributes\n );\n\n const allComponentSchemaAttributes = Object.values(strapi.components).map(\n (schema) => schema.attributes\n );\n const allSchemasAttributes: InputAttributes[] = [\n ...allContentTypeSchemaAttributes,\n ...allComponentSchemaAttributes,\n ];\n\n for (const schemaAttrbutes of allSchemasAttributes) {\n for (const attribute of Object.values(schemaAttrbutes)) {\n if (attribute.type === 'customField') {\n const customField = strapi.get('custom-fields').get(attribute.customField);\n attribute.type = customField.type;\n }\n }\n }\n};\n"],"names":[],"mappings":"AASa,MAAA,yBAAyB,CAAC,WAAwB;AAC7D,QAAM,iCAAiC,OAAO,OAAO,OAAO,YAAY,EAAE;AAAA,IACxE,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,QAAM,+BAA+B,OAAO,OAAO,OAAO,UAAU,EAAE;AAAA,IACpE,CAAC,WAAW,OAAO;AAAA,EACrB;AACA,QAAM,uBAA0C;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,aAAW,mBAAmB,sBAAsB;AAClD,eAAW,aAAa,OAAO,OAAO,eAAe,GAAG;AAClD,UAAA,UAAU,SAAS,eAAe;AACpC,cAAM,cAAc,OAAO,IAAI,eAAe,EAAE,IAAI,UAAU,WAAW;AACzE,kBAAU,OAAO,YAAY;AAAA,MAAA;AAAA,IAC/B;AAAA,EACF;AAEJ;"}
|
package/dist/utils/cron.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cron.js","sources":["../../src/utils/cron.ts"],"sourcesContent":["import { isEmpty, negate } from 'lodash/fp';\n\nconst DATE_FUNCTIONS = [\n 'getSeconds',\n 'getMinutes',\n 'getHours',\n 'getDate',\n 'getMonth',\n 'getDay',\n] as const;\n\nconst INTEGER_REGEX = /^\\d+$/;\nconst STEP_REGEX = /^\\*\\/\\d+$/;\nconst COMPONENTS: {\n limit: number;\n zeroBasedIndices: boolean;\n functionName: (typeof DATE_FUNCTIONS)[number];\n}[] = [\n { limit: 60, zeroBasedIndices: true, functionName: 'getSeconds' },\n { limit: 60, zeroBasedIndices: true, functionName: 'getMinutes' },\n { limit: 24, zeroBasedIndices: true, functionName: 'getHours' },\n { limit: 31, zeroBasedIndices: false, functionName: 'getDate' },\n { limit: 12, zeroBasedIndices: false, functionName: 'getMonth' },\n { limit: 7, zeroBasedIndices: true, functionName: 'getDay' },\n];\n\nconst shift = (component: string, index: number, date: Date) => {\n if (component === '*') {\n return '*';\n }\n\n const { limit, zeroBasedIndices, functionName } = COMPONENTS[index];\n const offset = +!zeroBasedIndices;\n const currentValue = date[functionName]();\n\n if (INTEGER_REGEX.test(component)) {\n return ((Number.parseInt(component, 10) + currentValue) % limit) + offset;\n }\n\n if (STEP_REGEX.test(component)) {\n const [, step] = component.split('/');\n const frequency = Math.floor(limit / Number(step));\n const list = Array.from({ length: frequency }, (_, index) => index * Number(step));\n return list.map((value) => ((value + currentValue) % limit) + offset).sort((a, b) => a - b);\n }\n\n // Unsupported syntax\n return component;\n};\n\n/**\n * Simulate an interval by shifting a cron expression using the specified date.\n * @param {string} rule A cron expression you want to shift.\n * @param {Date} date The date that's gonna be used as the start of the \"interval\", it defaults to now.\n * @returns The shifted cron expression.\n */\nexport const shiftCronExpression = (rule: string, date = new Date()) => {\n const components = rule.trim().split(' ').filter(negate(isEmpty));\n const secondsIncluded = components.length === 6;\n return components\n .map((component, index) => shift(component, secondsIncluded ? index : index + 1, date))\n .join(' ');\n};\n"],"names":["index","negate","isEmpty"],"mappings":";;;AAWA,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,aAIA;AAAA,EACJ,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,aAAa;AAAA,EAChE,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,aAAa;AAAA,EAChE,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,WAAW;AAAA,EAC9D,EAAE,OAAO,IAAI,kBAAkB,OAAO,cAAc,UAAU;AAAA,EAC9D,EAAE,OAAO,IAAI,kBAAkB,OAAO,cAAc,WAAW;AAAA,EAC/D,EAAE,OAAO,GAAG,kBAAkB,MAAM,cAAc,SAAS;AAC7D;AAEA,MAAM,QAAQ,CAAC,WAAmB,OAAe,SAAe;AAC9D,MAAI,cAAc,KAAK;AACd,WAAA;AAAA,
|
1
|
+
{"version":3,"file":"cron.js","sources":["../../src/utils/cron.ts"],"sourcesContent":["import { isEmpty, negate } from 'lodash/fp';\n\nconst DATE_FUNCTIONS = [\n 'getSeconds',\n 'getMinutes',\n 'getHours',\n 'getDate',\n 'getMonth',\n 'getDay',\n] as const;\n\nconst INTEGER_REGEX = /^\\d+$/;\nconst STEP_REGEX = /^\\*\\/\\d+$/;\nconst COMPONENTS: {\n limit: number;\n zeroBasedIndices: boolean;\n functionName: (typeof DATE_FUNCTIONS)[number];\n}[] = [\n { limit: 60, zeroBasedIndices: true, functionName: 'getSeconds' },\n { limit: 60, zeroBasedIndices: true, functionName: 'getMinutes' },\n { limit: 24, zeroBasedIndices: true, functionName: 'getHours' },\n { limit: 31, zeroBasedIndices: false, functionName: 'getDate' },\n { limit: 12, zeroBasedIndices: false, functionName: 'getMonth' },\n { limit: 7, zeroBasedIndices: true, functionName: 'getDay' },\n];\n\nconst shift = (component: string, index: number, date: Date) => {\n if (component === '*') {\n return '*';\n }\n\n const { limit, zeroBasedIndices, functionName } = COMPONENTS[index];\n const offset = +!zeroBasedIndices;\n const currentValue = date[functionName]();\n\n if (INTEGER_REGEX.test(component)) {\n return ((Number.parseInt(component, 10) + currentValue) % limit) + offset;\n }\n\n if (STEP_REGEX.test(component)) {\n const [, step] = component.split('/');\n const frequency = Math.floor(limit / Number(step));\n const list = Array.from({ length: frequency }, (_, index) => index * Number(step));\n return list.map((value) => ((value + currentValue) % limit) + offset).sort((a, b) => a - b);\n }\n\n // Unsupported syntax\n return component;\n};\n\n/**\n * Simulate an interval by shifting a cron expression using the specified date.\n * @param {string} rule A cron expression you want to shift.\n * @param {Date} date The date that's gonna be used as the start of the \"interval\", it defaults to now.\n * @returns The shifted cron expression.\n */\nexport const shiftCronExpression = (rule: string, date = new Date()) => {\n const components = rule.trim().split(' ').filter(negate(isEmpty));\n const secondsIncluded = components.length === 6;\n return components\n .map((component, index) => shift(component, secondsIncluded ? index : index + 1, date))\n .join(' ');\n};\n"],"names":["index","negate","isEmpty"],"mappings":";;;AAWA,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,aAIA;AAAA,EACJ,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,aAAa;AAAA,EAChE,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,aAAa;AAAA,EAChE,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,WAAW;AAAA,EAC9D,EAAE,OAAO,IAAI,kBAAkB,OAAO,cAAc,UAAU;AAAA,EAC9D,EAAE,OAAO,IAAI,kBAAkB,OAAO,cAAc,WAAW;AAAA,EAC/D,EAAE,OAAO,GAAG,kBAAkB,MAAM,cAAc,SAAS;AAC7D;AAEA,MAAM,QAAQ,CAAC,WAAmB,OAAe,SAAe;AAC9D,MAAI,cAAc,KAAK;AACd,WAAA;AAAA,EAAA;AAGT,QAAM,EAAE,OAAO,kBAAkB,aAAa,IAAI,WAAW,KAAK;AAC5D,QAAA,SAAS,CAAC,CAAC;AACX,QAAA,eAAe,KAAK,YAAY,EAAE;AAEpC,MAAA,cAAc,KAAK,SAAS,GAAG;AACjC,YAAS,OAAO,SAAS,WAAW,EAAE,IAAI,gBAAgB,QAAS;AAAA,EAAA;AAGjE,MAAA,WAAW,KAAK,SAAS,GAAG;AAC9B,UAAM,CAAG,EAAA,IAAI,IAAI,UAAU,MAAM,GAAG;AACpC,UAAM,YAAY,KAAK,MAAM,QAAQ,OAAO,IAAI,CAAC;AACjD,UAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,UAAA,GAAa,CAAC,GAAGA,WAAUA,SAAQ,OAAO,IAAI,CAAC;AACjF,WAAO,KAAK,IAAI,CAAC,WAAY,QAAQ,gBAAgB,QAAS,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,EAAA;AAIrF,SAAA;AACT;AAQO,MAAM,sBAAsB,CAAC,MAAc,OAAO,oBAAI,WAAW;AAChE,QAAA,aAAa,KAAK,OAAO,MAAM,GAAG,EAAE,OAAOC,UAAOC,GAAAA,OAAO,CAAC;AAC1D,QAAA,kBAAkB,WAAW,WAAW;AAC9C,SAAO,WACJ,IAAI,CAAC,WAAW,UAAU,MAAM,WAAW,kBAAkB,QAAQ,QAAQ,GAAG,IAAI,CAAC,EACrF,KAAK,GAAG;AACb;;"}
|
package/dist/utils/cron.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cron.mjs","sources":["../../src/utils/cron.ts"],"sourcesContent":["import { isEmpty, negate } from 'lodash/fp';\n\nconst DATE_FUNCTIONS = [\n 'getSeconds',\n 'getMinutes',\n 'getHours',\n 'getDate',\n 'getMonth',\n 'getDay',\n] as const;\n\nconst INTEGER_REGEX = /^\\d+$/;\nconst STEP_REGEX = /^\\*\\/\\d+$/;\nconst COMPONENTS: {\n limit: number;\n zeroBasedIndices: boolean;\n functionName: (typeof DATE_FUNCTIONS)[number];\n}[] = [\n { limit: 60, zeroBasedIndices: true, functionName: 'getSeconds' },\n { limit: 60, zeroBasedIndices: true, functionName: 'getMinutes' },\n { limit: 24, zeroBasedIndices: true, functionName: 'getHours' },\n { limit: 31, zeroBasedIndices: false, functionName: 'getDate' },\n { limit: 12, zeroBasedIndices: false, functionName: 'getMonth' },\n { limit: 7, zeroBasedIndices: true, functionName: 'getDay' },\n];\n\nconst shift = (component: string, index: number, date: Date) => {\n if (component === '*') {\n return '*';\n }\n\n const { limit, zeroBasedIndices, functionName } = COMPONENTS[index];\n const offset = +!zeroBasedIndices;\n const currentValue = date[functionName]();\n\n if (INTEGER_REGEX.test(component)) {\n return ((Number.parseInt(component, 10) + currentValue) % limit) + offset;\n }\n\n if (STEP_REGEX.test(component)) {\n const [, step] = component.split('/');\n const frequency = Math.floor(limit / Number(step));\n const list = Array.from({ length: frequency }, (_, index) => index * Number(step));\n return list.map((value) => ((value + currentValue) % limit) + offset).sort((a, b) => a - b);\n }\n\n // Unsupported syntax\n return component;\n};\n\n/**\n * Simulate an interval by shifting a cron expression using the specified date.\n * @param {string} rule A cron expression you want to shift.\n * @param {Date} date The date that's gonna be used as the start of the \"interval\", it defaults to now.\n * @returns The shifted cron expression.\n */\nexport const shiftCronExpression = (rule: string, date = new Date()) => {\n const components = rule.trim().split(' ').filter(negate(isEmpty));\n const secondsIncluded = components.length === 6;\n return components\n .map((component, index) => shift(component, secondsIncluded ? index : index + 1, date))\n .join(' ');\n};\n"],"names":["index"],"mappings":";AAWA,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,aAIA;AAAA,EACJ,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,aAAa;AAAA,EAChE,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,aAAa;AAAA,EAChE,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,WAAW;AAAA,EAC9D,EAAE,OAAO,IAAI,kBAAkB,OAAO,cAAc,UAAU;AAAA,EAC9D,EAAE,OAAO,IAAI,kBAAkB,OAAO,cAAc,WAAW;AAAA,EAC/D,EAAE,OAAO,GAAG,kBAAkB,MAAM,cAAc,SAAS;AAC7D;AAEA,MAAM,QAAQ,CAAC,WAAmB,OAAe,SAAe;AAC9D,MAAI,cAAc,KAAK;AACd,WAAA;AAAA,
|
1
|
+
{"version":3,"file":"cron.mjs","sources":["../../src/utils/cron.ts"],"sourcesContent":["import { isEmpty, negate } from 'lodash/fp';\n\nconst DATE_FUNCTIONS = [\n 'getSeconds',\n 'getMinutes',\n 'getHours',\n 'getDate',\n 'getMonth',\n 'getDay',\n] as const;\n\nconst INTEGER_REGEX = /^\\d+$/;\nconst STEP_REGEX = /^\\*\\/\\d+$/;\nconst COMPONENTS: {\n limit: number;\n zeroBasedIndices: boolean;\n functionName: (typeof DATE_FUNCTIONS)[number];\n}[] = [\n { limit: 60, zeroBasedIndices: true, functionName: 'getSeconds' },\n { limit: 60, zeroBasedIndices: true, functionName: 'getMinutes' },\n { limit: 24, zeroBasedIndices: true, functionName: 'getHours' },\n { limit: 31, zeroBasedIndices: false, functionName: 'getDate' },\n { limit: 12, zeroBasedIndices: false, functionName: 'getMonth' },\n { limit: 7, zeroBasedIndices: true, functionName: 'getDay' },\n];\n\nconst shift = (component: string, index: number, date: Date) => {\n if (component === '*') {\n return '*';\n }\n\n const { limit, zeroBasedIndices, functionName } = COMPONENTS[index];\n const offset = +!zeroBasedIndices;\n const currentValue = date[functionName]();\n\n if (INTEGER_REGEX.test(component)) {\n return ((Number.parseInt(component, 10) + currentValue) % limit) + offset;\n }\n\n if (STEP_REGEX.test(component)) {\n const [, step] = component.split('/');\n const frequency = Math.floor(limit / Number(step));\n const list = Array.from({ length: frequency }, (_, index) => index * Number(step));\n return list.map((value) => ((value + currentValue) % limit) + offset).sort((a, b) => a - b);\n }\n\n // Unsupported syntax\n return component;\n};\n\n/**\n * Simulate an interval by shifting a cron expression using the specified date.\n * @param {string} rule A cron expression you want to shift.\n * @param {Date} date The date that's gonna be used as the start of the \"interval\", it defaults to now.\n * @returns The shifted cron expression.\n */\nexport const shiftCronExpression = (rule: string, date = new Date()) => {\n const components = rule.trim().split(' ').filter(negate(isEmpty));\n const secondsIncluded = components.length === 6;\n return components\n .map((component, index) => shift(component, secondsIncluded ? index : index + 1, date))\n .join(' ');\n};\n"],"names":["index"],"mappings":";AAWA,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,aAIA;AAAA,EACJ,EAAE,OAAO,IAAI,kBAAkB,MAAM,cAAc,aAAa;AAAA,EAChE,EAAE,OAAO,IAAI,kBAA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AAG;AACb;"}
|
package/dist/utils/fetch.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetch.js","sources":["../../src/utils/fetch.ts"],"sourcesContent":["import type { Core, Modules } from '@strapi/types';\nimport { ProxyAgent } from 'undici';\n\n// TODO: once core Node exposes a stable way to create a ProxyAgent we will use that instead of undici\n\n// Create a wrapper for Node's Fetch API that applies a global proxy\nexport const createStrapiFetch = (strapi: Core.Strapi): Modules.Fetch.Fetch => {\n function strapiFetch(url: RequestInfo | URL, options?: RequestInit) {\n const fetchOptions = {\n ...(strapiFetch.dispatcher ? { dispatcher: strapiFetch.dispatcher } : {}),\n ...options,\n };\n strapi.log.debug(`Making request for ${url}`);\n return fetch(url, fetchOptions);\n }\n\n const proxy =\n strapi.config.get<ConstructorParameters<typeof ProxyAgent>[0]>('server.proxy.fetch') ||\n strapi.config.get<string>('server.proxy.global');\n\n if (proxy) {\n strapi.log.info(`Using proxy for Fetch requests: ${proxy}`);\n strapiFetch.dispatcher = new ProxyAgent(proxy);\n }\n\n return strapiFetch;\n};\n\nexport type Fetch = Modules.Fetch.Fetch;\n"],"names":["ProxyAgent"],"mappings":";;;AAMa,MAAA,oBAAoB,CAAC,WAA6C;AACpE,WAAA,YAAY,KAAwB,SAAuB;AAClE,UAAM,eAAe;AAAA,MACnB,GAAI,YAAY,aAAa,EAAE,YAAY,YAAY,WAAA,IAAe,CAAC;AAAA,MACvE,GAAG;AAAA,
|
1
|
+
{"version":3,"file":"fetch.js","sources":["../../src/utils/fetch.ts"],"sourcesContent":["import type { Core, Modules } from '@strapi/types';\nimport { ProxyAgent } from 'undici';\n\n// TODO: once core Node exposes a stable way to create a ProxyAgent we will use that instead of undici\n\n// Create a wrapper for Node's Fetch API that applies a global proxy\nexport const createStrapiFetch = (strapi: Core.Strapi): Modules.Fetch.Fetch => {\n function strapiFetch(url: RequestInfo | URL, options?: RequestInit) {\n const fetchOptions = {\n ...(strapiFetch.dispatcher ? { dispatcher: strapiFetch.dispatcher } : {}),\n ...options,\n };\n strapi.log.debug(`Making request for ${url}`);\n return fetch(url, fetchOptions);\n }\n\n const proxy =\n strapi.config.get<ConstructorParameters<typeof ProxyAgent>[0]>('server.proxy.fetch') ||\n strapi.config.get<string>('server.proxy.global');\n\n if (proxy) {\n strapi.log.info(`Using proxy for Fetch requests: ${proxy}`);\n strapiFetch.dispatcher = new ProxyAgent(proxy);\n }\n\n return strapiFetch;\n};\n\nexport type Fetch = Modules.Fetch.Fetch;\n"],"names":["ProxyAgent"],"mappings":";;;AAMa,MAAA,oBAAoB,CAAC,WAA6C;AACpE,WAAA,YAAY,KAAwB,SAAuB;AAClE,UAAM,eAAe;AAAA,MACnB,GAAI,YAAY,aAAa,EAAE,YAAY,YAAY,WAAA,IAAe,CAAC;AAAA,MACvE,GAAG;AAAA,IACL;AACA,WAAO,IAAI,MAAM,sBAAsB,GAAG,EAAE;AACrC,WAAA,MAAM,KAAK,YAAY;AAAA,EAAA;AAG1B,QAAA,QACJ,OAAO,OAAO,IAAiD,oBAAoB,KACnF,OAAO,OAAO,IAAY,qBAAqB;AAEjD,MAAI,OAAO;AACT,WAAO,IAAI,KAAK,mCAAmC,KAAK,EAAE;AAC9C,gBAAA,aAAa,IAAIA,OAAA,WAAW,KAAK;AAAA,EAAA;AAGxC,SAAA;AACT;;"}
|
package/dist/utils/fetch.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetch.mjs","sources":["../../src/utils/fetch.ts"],"sourcesContent":["import type { Core, Modules } from '@strapi/types';\nimport { ProxyAgent } from 'undici';\n\n// TODO: once core Node exposes a stable way to create a ProxyAgent we will use that instead of undici\n\n// Create a wrapper for Node's Fetch API that applies a global proxy\nexport const createStrapiFetch = (strapi: Core.Strapi): Modules.Fetch.Fetch => {\n function strapiFetch(url: RequestInfo | URL, options?: RequestInit) {\n const fetchOptions = {\n ...(strapiFetch.dispatcher ? { dispatcher: strapiFetch.dispatcher } : {}),\n ...options,\n };\n strapi.log.debug(`Making request for ${url}`);\n return fetch(url, fetchOptions);\n }\n\n const proxy =\n strapi.config.get<ConstructorParameters<typeof ProxyAgent>[0]>('server.proxy.fetch') ||\n strapi.config.get<string>('server.proxy.global');\n\n if (proxy) {\n strapi.log.info(`Using proxy for Fetch requests: ${proxy}`);\n strapiFetch.dispatcher = new ProxyAgent(proxy);\n }\n\n return strapiFetch;\n};\n\nexport type Fetch = Modules.Fetch.Fetch;\n"],"names":[],"mappings":";AAMa,MAAA,oBAAoB,CAAC,WAA6C;AACpE,WAAA,YAAY,KAAwB,SAAuB;AAClE,UAAM,eAAe;AAAA,MACnB,GAAI,YAAY,aAAa,EAAE,YAAY,YAAY,WAAA,IAAe,CAAC;AAAA,MACvE,GAAG;AAAA,
|
1
|
+
{"version":3,"file":"fetch.mjs","sources":["../../src/utils/fetch.ts"],"sourcesContent":["import type { Core, Modules } from '@strapi/types';\nimport { ProxyAgent } from 'undici';\n\n// TODO: once core Node exposes a stable way to create a ProxyAgent we will use that instead of undici\n\n// Create a wrapper for Node's Fetch API that applies a global proxy\nexport const createStrapiFetch = (strapi: Core.Strapi): Modules.Fetch.Fetch => {\n function strapiFetch(url: RequestInfo | URL, options?: RequestInit) {\n const fetchOptions = {\n ...(strapiFetch.dispatcher ? { dispatcher: strapiFetch.dispatcher } : {}),\n ...options,\n };\n strapi.log.debug(`Making request for ${url}`);\n return fetch(url, fetchOptions);\n }\n\n const proxy =\n strapi.config.get<ConstructorParameters<typeof ProxyAgent>[0]>('server.proxy.fetch') ||\n strapi.config.get<string>('server.proxy.global');\n\n if (proxy) {\n strapi.log.info(`Using proxy for Fetch requests: ${proxy}`);\n strapiFetch.dispatcher = new ProxyAgent(proxy);\n }\n\n return strapiFetch;\n};\n\nexport type Fetch = Modules.Fetch.Fetch;\n"],"names":[],"mappings":";AAMa,MAAA,oBAAoB,CAAC,WAA6C;AACpE,WAAA,YAAY,KAAwB,SAAuB;AAClE,UAAM,eAAe;AAAA,MACnB,GAAI,YAAY,aAAa,EAAE,YAAY,YAAY,WAAA,IAAe,CAAC;AAAA,MACvE,GAAG;AAAA,IACL;AACA,WAAO,IAAI,MAAM,sBAAsB,GAAG,EAAE;AACrC,WAAA,MAAM,KAAK,YAAY;AAAA,EAAA;AAG1B,QAAA,QACJ,OAAO,OAAO,IAAiD,oBAAoB,KACnF,OAAO,OAAO,IAAY,qBAAqB;AAEjD,MAAI,OAAO;AACT,WAAO,IAAI,KAAK,mCAAmC,KAAK,EAAE;AAC9C,gBAAA,aAAa,IAAI,WAAW,KAAK;AAAA,EAAA;AAGxC,SAAA;AACT;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filepath-to-prop-path.js","sources":["../../src/utils/filepath-to-prop-path.ts"],"sourcesContent":["import path from 'node:path';\nimport fp from 'lodash/fp';\n\n/**\n * Returns a path (as an array) from a file path\n */\nexport const filePathToPropPath = (\n entryPath: string,\n useFileNameAsKey: boolean = true\n): string[] => {\n const transform = fp.pipe(\n // Remove the relative path prefixes: './' for posix (and some win32) and \".\\\" for win32\n removeRelativePrefix,\n // Remove the path metadata and extensions\n fp.replace(/(\\.settings|\\.json|\\.js)/g, ''),\n // Transform to lowercase\n // Note: We're using fp.toLower instead of fp.lowercase as the latest removes special characters such as \"/\"\n fp.toLower,\n // Split the cleaned path by matching every possible separator (either \"/\" or \"\\\" depending on the OS)\n fp.split(new RegExp(`[\\\\${path.win32.sep}|${path.posix.sep}]`, 'g')),\n // Make sure to remove leading '.' from the different path parts\n fp.map(fp.trimCharsStart('.')),\n // join + split in case some '.' characters are still present in different parts of the path\n fp.join('.'),\n fp.split('.'),\n // Remove the last portion of the path array if the file name shouldn't be used as a key\n useFileNameAsKey ? fp.identity : fp.slice(0, -1)\n );\n\n return transform(entryPath) as string[];\n};\n\nconst removeRelativePrefix = (filePath: string) => {\n return filePath.startsWith(`.${path.win32.sep}`) || filePath.startsWith(`.${path.posix.sep}`)\n ? filePath.slice(2)\n : filePath;\n};\n"],"names":["fp","path"],"mappings":";;;;;;;AAMO,MAAM,qBAAqB,CAChC,WACA,mBAA4B,SACf;AACb,QAAM,YAAYA,YAAAA,QAAG;AAAA;AAAA,IAEnB;AAAA;AAAA,IAEAA,oBAAG,QAAQ,6BAA6B,EAAE;AAAA;AAAA;AAAA,IAG1CA,YAAAA,QAAG;AAAA;AAAA,IAEHA,YAAG,QAAA,MAAM,IAAI,OAAO,MAAMC,cAAK,QAAA,MAAM,GAAG,IAAIA,cAAK,QAAA,MAAM,GAAG,KAAK,GAAG,CAAC;AAAA;AAAA,IAEnED,YAAAA,QAAG,IAAIA,YAAAA,QAAG,eAAe,GAAG,CAAC;AAAA;AAAA,IAE7BA,YAAA,QAAG,KAAK,GAAG;AAAA,IACXA,YAAA,QAAG,MAAM,GAAG;AAAA;AAAA,IAEZ,mBAAmBA,YAAG,QAAA,WAAWA,
|
1
|
+
{"version":3,"file":"filepath-to-prop-path.js","sources":["../../src/utils/filepath-to-prop-path.ts"],"sourcesContent":["import path from 'node:path';\nimport fp from 'lodash/fp';\n\n/**\n * Returns a path (as an array) from a file path\n */\nexport const filePathToPropPath = (\n entryPath: string,\n useFileNameAsKey: boolean = true\n): string[] => {\n const transform = fp.pipe(\n // Remove the relative path prefixes: './' for posix (and some win32) and \".\\\" for win32\n removeRelativePrefix,\n // Remove the path metadata and extensions\n fp.replace(/(\\.settings|\\.json|\\.js)/g, ''),\n // Transform to lowercase\n // Note: We're using fp.toLower instead of fp.lowercase as the latest removes special characters such as \"/\"\n fp.toLower,\n // Split the cleaned path by matching every possible separator (either \"/\" or \"\\\" depending on the OS)\n fp.split(new RegExp(`[\\\\${path.win32.sep}|${path.posix.sep}]`, 'g')),\n // Make sure to remove leading '.' from the different path parts\n fp.map(fp.trimCharsStart('.')),\n // join + split in case some '.' characters are still present in different parts of the path\n fp.join('.'),\n fp.split('.'),\n // Remove the last portion of the path array if the file name shouldn't be used as a key\n useFileNameAsKey ? fp.identity : fp.slice(0, -1)\n );\n\n return transform(entryPath) as string[];\n};\n\nconst removeRelativePrefix = (filePath: string) => {\n return filePath.startsWith(`.${path.win32.sep}`) || filePath.startsWith(`.${path.posix.sep}`)\n ? filePath.slice(2)\n : filePath;\n};\n"],"names":["fp","path"],"mappings":";;;;;;;AAMO,MAAM,qBAAqB,CAChC,WACA,mBAA4B,SACf;AACb,QAAM,YAAYA,YAAAA,QAAG;AAAA;AAAA,IAEnB;AAAA;AAAA,IAEAA,oBAAG,QAAQ,6BAA6B,EAAE;AAAA;AAAA;AAAA,IAG1CA,YAAAA,QAAG;AAAA;AAAA,IAEHA,YAAG,QAAA,MAAM,IAAI,OAAO,MAAMC,cAAK,QAAA,MAAM,GAAG,IAAIA,cAAK,QAAA,MAAM,GAAG,KAAK,GAAG,CAAC;AAAA;AAAA,IAEnED,YAAAA,QAAG,IAAIA,YAAAA,QAAG,eAAe,GAAG,CAAC;AAAA;AAAA,IAE7BA,YAAA,QAAG,KAAK,GAAG;AAAA,IACXA,YAAA,QAAG,MAAM,GAAG;AAAA;AAAA,IAEZ,mBAAmBA,YAAG,QAAA,WAAWA,YAAG,QAAA,MAAM,GAAG,EAAE;AAAA,EACjD;AAEA,SAAO,UAAU,SAAS;AAC5B;AAEA,MAAM,uBAAuB,CAAC,aAAqB;AACjD,SAAO,SAAS,WAAW,IAAIC,cAAAA,QAAK,MAAM,GAAG,EAAE,KAAK,SAAS,WAAW,IAAIA,cAAAA,QAAK,MAAM,GAAG,EAAE,IACxF,SAAS,MAAM,CAAC,IAChB;AACN;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filepath-to-prop-path.mjs","sources":["../../src/utils/filepath-to-prop-path.ts"],"sourcesContent":["import path from 'node:path';\nimport fp from 'lodash/fp';\n\n/**\n * Returns a path (as an array) from a file path\n */\nexport const filePathToPropPath = (\n entryPath: string,\n useFileNameAsKey: boolean = true\n): string[] => {\n const transform = fp.pipe(\n // Remove the relative path prefixes: './' for posix (and some win32) and \".\\\" for win32\n removeRelativePrefix,\n // Remove the path metadata and extensions\n fp.replace(/(\\.settings|\\.json|\\.js)/g, ''),\n // Transform to lowercase\n // Note: We're using fp.toLower instead of fp.lowercase as the latest removes special characters such as \"/\"\n fp.toLower,\n // Split the cleaned path by matching every possible separator (either \"/\" or \"\\\" depending on the OS)\n fp.split(new RegExp(`[\\\\${path.win32.sep}|${path.posix.sep}]`, 'g')),\n // Make sure to remove leading '.' from the different path parts\n fp.map(fp.trimCharsStart('.')),\n // join + split in case some '.' characters are still present in different parts of the path\n fp.join('.'),\n fp.split('.'),\n // Remove the last portion of the path array if the file name shouldn't be used as a key\n useFileNameAsKey ? fp.identity : fp.slice(0, -1)\n );\n\n return transform(entryPath) as string[];\n};\n\nconst removeRelativePrefix = (filePath: string) => {\n return filePath.startsWith(`.${path.win32.sep}`) || filePath.startsWith(`.${path.posix.sep}`)\n ? filePath.slice(2)\n : filePath;\n};\n"],"names":[],"mappings":";;AAMO,MAAM,qBAAqB,CAChC,WACA,mBAA4B,SACf;AACb,QAAM,YAAY,GAAG;AAAA;AAAA,IAEnB;AAAA;AAAA,IAEA,GAAG,QAAQ,6BAA6B,EAAE;AAAA;AAAA;AAAA,IAG1C,GAAG;AAAA;AAAA,IAEH,GAAG,MAAM,IAAI,OAAO,MAAM,KAAK,MAAM,GAAG,IAAI,KAAK,MAAM,GAAG,KAAK,GAAG,CAAC;AAAA;AAAA,IAEnE,GAAG,IAAI,GAAG,eAAe,GAAG,CAAC;AAAA;AAAA,IAE7B,GAAG,KAAK,GAAG;AAAA,IACX,GAAG,MAAM,GAAG;AAAA;AAAA,IAEZ,mBAAmB,GAAG,WAAW,GAAG,MAAM,GAAG,EAAE;AAAA,
|
1
|
+
{"version":3,"file":"filepath-to-prop-path.mjs","sources":["../../src/utils/filepath-to-prop-path.ts"],"sourcesContent":["import path from 'node:path';\nimport fp from 'lodash/fp';\n\n/**\n * Returns a path (as an array) from a file path\n */\nexport const filePathToPropPath = (\n entryPath: string,\n useFileNameAsKey: boolean = true\n): string[] => {\n const transform = fp.pipe(\n // Remove the relative path prefixes: './' for posix (and some win32) and \".\\\" for win32\n removeRelativePrefix,\n // Remove the path metadata and extensions\n fp.replace(/(\\.settings|\\.json|\\.js)/g, ''),\n // Transform to lowercase\n // Note: We're using fp.toLower instead of fp.lowercase as the latest removes special characters such as \"/\"\n fp.toLower,\n // Split the cleaned path by matching every possible separator (either \"/\" or \"\\\" depending on the OS)\n fp.split(new RegExp(`[\\\\${path.win32.sep}|${path.posix.sep}]`, 'g')),\n // Make sure to remove leading '.' from the different path parts\n fp.map(fp.trimCharsStart('.')),\n // join + split in case some '.' characters are still present in different parts of the path\n fp.join('.'),\n fp.split('.'),\n // Remove the last portion of the path array if the file name shouldn't be used as a key\n useFileNameAsKey ? fp.identity : fp.slice(0, -1)\n );\n\n return transform(entryPath) as string[];\n};\n\nconst removeRelativePrefix = (filePath: string) => {\n return filePath.startsWith(`.${path.win32.sep}`) || filePath.startsWith(`.${path.posix.sep}`)\n ? filePath.slice(2)\n : filePath;\n};\n"],"names":[],"mappings":";;AAMO,MAAM,qBAAqB,CAChC,WACA,mBAA4B,SACf;AACb,QAAM,YAAY,GAAG;AAAA;AAAA,IAEnB;AAAA;AAAA,IAEA,GAAG,QAAQ,6BAA6B,EAAE;AAAA;AAAA;AAAA,IAG1C,GAAG;AAAA;AAAA,IAEH,GAAG,MAAM,IAAI,OAAO,MAAM,KAAK,MAAM,GAAG,IAAI,KAAK,MAAM,GAAG,KAAK,GAAG,CAAC;AAAA;AAAA,IAEnE,GAAG,IAAI,GAAG,eAAe,GAAG,CAAC;AAAA;AAAA,IAE7B,GAAG,KAAK,GAAG;AAAA,IACX,GAAG,MAAM,GAAG;AAAA;AAAA,IAEZ,mBAAmB,GAAG,WAAW,GAAG,MAAM,GAAG,EAAE;AAAA,EACjD;AAEA,SAAO,UAAU,SAAS;AAC5B;AAEA,MAAM,uBAAuB,CAAC,aAAqB;AACjD,SAAO,SAAS,WAAW,IAAI,KAAK,MAAM,GAAG,EAAE,KAAK,SAAS,WAAW,IAAI,KAAK,MAAM,GAAG,EAAE,IACxF,SAAS,MAAM,CAAC,IAChB;AACN;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is-initialized.js","sources":["../../src/utils/is-initialized.ts"],"sourcesContent":["import { isEmpty, isNil } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\n/**\n * Test if the strapi application is considered as initialized (1st user has been created)\n */\nexport const isInitialized = async (strapi: Core.Strapi): Promise<boolean> => {\n try {\n if (isEmpty(strapi.admin)) {\n return true;\n }\n\n // test if there is at least one admin\n const anyAdministrator = await strapi.db.query('admin::user').findOne({ select: ['id'] });\n\n return !isNil(anyAdministrator);\n } catch (err) {\n strapi.stopWithError(err);\n }\n};\n"],"names":["isEmpty","isNil"],"mappings":";;;AAOa,MAAA,gBAAgB,OAAO,WAA0C;AACxE,MAAA;AACE,QAAAA,GAAA,QAAQ,OAAO,KAAK,GAAG;AAClB,aAAA;AAAA,
|
1
|
+
{"version":3,"file":"is-initialized.js","sources":["../../src/utils/is-initialized.ts"],"sourcesContent":["import { isEmpty, isNil } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\n/**\n * Test if the strapi application is considered as initialized (1st user has been created)\n */\nexport const isInitialized = async (strapi: Core.Strapi): Promise<boolean> => {\n try {\n if (isEmpty(strapi.admin)) {\n return true;\n }\n\n // test if there is at least one admin\n const anyAdministrator = await strapi.db.query('admin::user').findOne({ select: ['id'] });\n\n return !isNil(anyAdministrator);\n } catch (err) {\n strapi.stopWithError(err);\n }\n};\n"],"names":["isEmpty","isNil"],"mappings":";;;AAOa,MAAA,gBAAgB,OAAO,WAA0C;AACxE,MAAA;AACE,QAAAA,GAAA,QAAQ,OAAO,KAAK,GAAG;AAClB,aAAA;AAAA,IAAA;AAIT,UAAM,mBAAmB,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,GAAG;AAEjF,WAAA,CAACC,SAAM,gBAAgB;AAAA,WACvB,KAAK;AACZ,WAAO,cAAc,GAAG;AAAA,EAAA;AAE5B;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is-initialized.mjs","sources":["../../src/utils/is-initialized.ts"],"sourcesContent":["import { isEmpty, isNil } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\n/**\n * Test if the strapi application is considered as initialized (1st user has been created)\n */\nexport const isInitialized = async (strapi: Core.Strapi): Promise<boolean> => {\n try {\n if (isEmpty(strapi.admin)) {\n return true;\n }\n\n // test if there is at least one admin\n const anyAdministrator = await strapi.db.query('admin::user').findOne({ select: ['id'] });\n\n return !isNil(anyAdministrator);\n } catch (err) {\n strapi.stopWithError(err);\n }\n};\n"],"names":[],"mappings":";AAOa,MAAA,gBAAgB,OAAO,WAA0C;AACxE,MAAA;AACE,QAAA,QAAQ,OAAO,KAAK,GAAG;AAClB,aAAA;AAAA,
|
1
|
+
{"version":3,"file":"is-initialized.mjs","sources":["../../src/utils/is-initialized.ts"],"sourcesContent":["import { isEmpty, isNil } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\n/**\n * Test if the strapi application is considered as initialized (1st user has been created)\n */\nexport const isInitialized = async (strapi: Core.Strapi): Promise<boolean> => {\n try {\n if (isEmpty(strapi.admin)) {\n return true;\n }\n\n // test if there is at least one admin\n const anyAdministrator = await strapi.db.query('admin::user').findOne({ select: ['id'] });\n\n return !isNil(anyAdministrator);\n } catch (err) {\n strapi.stopWithError(err);\n }\n};\n"],"names":[],"mappings":";AAOa,MAAA,gBAAgB,OAAO,WAA0C;AACxE,MAAA;AACE,QAAA,QAAQ,OAAO,KAAK,GAAG;AAClB,aAAA;AAAA,IAAA;AAIT,UAAM,mBAAmB,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,GAAG;AAEjF,WAAA,CAAC,MAAM,gBAAgB;AAAA,WACvB,KAAK;AACZ,WAAO,cAAc,GAAG;AAAA,EAAA;AAE5B;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load-config-file.js","sources":["../../src/utils/load-config-file.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport { env, importDefault } from '@strapi/utils';\n\nconst loadJsFile = (file: string) => {\n try {\n const jsModule = importDefault(file);\n\n // call if function\n if (typeof jsModule === 'function') {\n return jsModule({ env });\n }\n\n return jsModule;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load js config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nconst loadJSONFile = (file: string) => {\n try {\n return JSON.parse(fs.readFileSync(file).toString());\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load json config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nexport const loadConfigFile = (file: string) => {\n const ext = path.extname(file);\n\n switch (ext) {\n case '.js':\n return loadJsFile(file);\n case '.json':\n return loadJSONFile(file);\n default:\n return {};\n }\n};\n"],"names":["importDefault","env","fs","path"],"mappings":";;;;;;;;AAIA,MAAM,aAAa,CAAC,SAAiB;AAC/B,MAAA;AACI,UAAA,WAAWA,0BAAc,IAAI;AAG/B,QAAA,OAAO,aAAa,YAAY;AAC3B,aAAA,SAAS,
|
1
|
+
{"version":3,"file":"load-config-file.js","sources":["../../src/utils/load-config-file.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport { env, importDefault } from '@strapi/utils';\n\nconst loadJsFile = (file: string) => {\n try {\n const jsModule = importDefault(file);\n\n // call if function\n if (typeof jsModule === 'function') {\n return jsModule({ env });\n }\n\n return jsModule;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load js config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nconst loadJSONFile = (file: string) => {\n try {\n return JSON.parse(fs.readFileSync(file).toString());\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load json config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nexport const loadConfigFile = (file: string) => {\n const ext = path.extname(file);\n\n switch (ext) {\n case '.js':\n return loadJsFile(file);\n case '.json':\n return loadJSONFile(file);\n default:\n return {};\n }\n};\n"],"names":["importDefault","env","fs","path"],"mappings":";;;;;;;;AAIA,MAAM,aAAa,CAAC,SAAiB;AAC/B,MAAA;AACI,UAAA,WAAWA,0BAAc,IAAI;AAG/B,QAAA,OAAO,aAAa,YAAY;AAC3B,aAAA,SAAS,EAAEC,KAAAA,YAAAA,KAAK;AAAA,IAAA;AAGlB,WAAA;AAAA,WACA,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,iCAAiC,IAAI,KAAK,MAAM,OAAO,EAAE;AAAA,IAAA;AAGrE,UAAA,IAAI,MAAM,eAAe;AAAA,EAAA;AAEnC;AAEA,MAAM,eAAe,CAAC,SAAiB;AACjC,MAAA;AACF,WAAO,KAAK,MAAMC,YAAA,QAAG,aAAa,IAAI,EAAE,UAAU;AAAA,WAC3C,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,mCAAmC,IAAI,KAAK,MAAM,OAAO,EAAE;AAAA,IAAA;AAGvE,UAAA,IAAI,MAAM,eAAe;AAAA,EAAA;AAEnC;AAEa,MAAA,iBAAiB,CAAC,SAAiB;AACxC,QAAA,MAAMC,cAAAA,QAAK,QAAQ,IAAI;AAE7B,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAO,WAAW,IAAI;AAAA,IACxB,KAAK;AACH,aAAO,aAAa,IAAI;AAAA,IAC1B;AACE,aAAO,CAAC;AAAA,EAAA;AAEd;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load-config-file.mjs","sources":["../../src/utils/load-config-file.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport { env, importDefault } from '@strapi/utils';\n\nconst loadJsFile = (file: string) => {\n try {\n const jsModule = importDefault(file);\n\n // call if function\n if (typeof jsModule === 'function') {\n return jsModule({ env });\n }\n\n return jsModule;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load js config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nconst loadJSONFile = (file: string) => {\n try {\n return JSON.parse(fs.readFileSync(file).toString());\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load json config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nexport const loadConfigFile = (file: string) => {\n const ext = path.extname(file);\n\n switch (ext) {\n case '.js':\n return loadJsFile(file);\n case '.json':\n return loadJSONFile(file);\n default:\n return {};\n }\n};\n"],"names":[],"mappings":";;;AAIA,MAAM,aAAa,CAAC,SAAiB;AAC/B,MAAA;AACI,UAAA,WAAW,cAAc,IAAI;AAG/B,QAAA,OAAO,aAAa,YAAY;AAC3B,aAAA,SAAS,EAAE,
|
1
|
+
{"version":3,"file":"load-config-file.mjs","sources":["../../src/utils/load-config-file.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport { env, importDefault } from '@strapi/utils';\n\nconst loadJsFile = (file: string) => {\n try {\n const jsModule = importDefault(file);\n\n // call if function\n if (typeof jsModule === 'function') {\n return jsModule({ env });\n }\n\n return jsModule;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load js config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nconst loadJSONFile = (file: string) => {\n try {\n return JSON.parse(fs.readFileSync(file).toString());\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Could not load json config file ${file}: ${error.message}`);\n }\n\n throw new Error('Unknown error');\n }\n};\n\nexport const loadConfigFile = (file: string) => {\n const ext = path.extname(file);\n\n switch (ext) {\n case '.js':\n return loadJsFile(file);\n case '.json':\n return loadJSONFile(file);\n default:\n return {};\n }\n};\n"],"names":[],"mappings":";;;AAIA,MAAM,aAAa,CAAC,SAAiB;AAC/B,MAAA;AACI,UAAA,WAAW,cAAc,IAAI;AAG/B,QAAA,OAAO,aAAa,YAAY;AAC3B,aAAA,SAAS,EAAE,KAAK;AAAA,IAAA;AAGlB,WAAA;AAAA,WACA,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,iCAAiC,IAAI,KAAK,MAAM,OAAO,EAAE;AAAA,IAAA;AAGrE,UAAA,IAAI,MAAM,eAAe;AAAA,EAAA;AAEnC;AAEA,MAAM,eAAe,CAAC,SAAiB;AACjC,MAAA;AACF,WAAO,KAAK,MAAM,GAAG,aAAa,IAAI,EAAE,UAAU;AAAA,WAC3C,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,mCAAmC,IAAI,KAAK,MAAM,OAAO,EAAE;AAAA,IAAA;AAGvE,UAAA,IAAI,MAAM,eAAe;AAAA,EAAA;AAEnC;AAEa,MAAA,iBAAiB,CAAC,SAAiB;AACxC,QAAA,MAAM,KAAK,QAAQ,IAAI;AAE7B,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAO,WAAW,IAAI;AAAA,IACxB,KAAK;AACH,aAAO,aAAa,IAAI;AAAA,IAC1B;AACE,aAAO,CAAC;AAAA,EAAA;AAEd;"}
|
package/dist/utils/load-files.js
CHANGED
@@ -29,8 +29,7 @@ const loadFiles = async (dir, pattern, { requireFn = strapiUtils.importDefault,
|
|
29
29
|
value: path__default.default.basename(file)
|
30
30
|
});
|
31
31
|
const propPath = filepathToPropPath.filePathToPropPath(file, shouldUseFileNameAsKey(file));
|
32
|
-
if (propPath.length === 0)
|
33
|
-
___default.default.merge(root, mod);
|
32
|
+
if (propPath.length === 0) ___default.default.merge(root, mod);
|
34
33
|
___default.default.merge(root, ___default.default.setWith({}, propPath, mod, Object));
|
35
34
|
}
|
36
35
|
return root;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load-files.js","sources":["../../src/utils/load-files.ts"],"sourcesContent":["import path from 'path';\nimport _ from 'lodash';\nimport fse from 'fs-extra';\n\nimport { importDefault } from '@strapi/utils';\nimport { glob } from 'glob';\nimport { filePathToPropPath } from './filepath-to-prop-path';\n\n/**\n * Returns an Object build from a list of files matching a glob pattern in a directory\n * It builds a tree structure resembling the folder structure in dir\n */\nexport const loadFiles = async <T extends object>(\n dir: string,\n pattern: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n { requireFn = importDefault, shouldUseFileNameAsKey = (_: any) => true, globArgs = {} } = {}\n): Promise<T> => {\n const root = {};\n const files = await glob(pattern, { cwd: dir, ...globArgs });\n\n for (const file of files) {\n const absolutePath = path.resolve(dir, file);\n\n // load module\n delete require.cache[absolutePath];\n let mod;\n\n if (path.extname(absolutePath) === '.json') {\n mod = await fse.readJson(absolutePath);\n } else {\n mod = requireFn(absolutePath);\n }\n\n Object.defineProperty(mod, '__filename__', {\n enumerable: true,\n configurable: false,\n writable: false,\n value: path.basename(file),\n });\n\n const propPath = filePathToPropPath(file, shouldUseFileNameAsKey(file));\n\n if (propPath.length === 0) _.merge(root, mod);\n _.merge(root, _.setWith({}, propPath, mod, Object));\n }\n\n return root as T;\n};\n"],"names":["importDefault","_","glob","path","fse","filePathToPropPath"],"mappings":";;;;;;;;;;;;AAYO,MAAM,YAAY,OACvB,KACA,SAEA,EAAE,YAAYA,YAAe,eAAA,yBAAyB,CAACC,OAAW,MAAM,WAAW,CAAG,EAAA,IAAI,CAAA,MAC3E;AACf,QAAM,OAAO,
|
1
|
+
{"version":3,"file":"load-files.js","sources":["../../src/utils/load-files.ts"],"sourcesContent":["import path from 'path';\nimport _ from 'lodash';\nimport fse from 'fs-extra';\n\nimport { importDefault } from '@strapi/utils';\nimport { glob } from 'glob';\nimport { filePathToPropPath } from './filepath-to-prop-path';\n\n/**\n * Returns an Object build from a list of files matching a glob pattern in a directory\n * It builds a tree structure resembling the folder structure in dir\n */\nexport const loadFiles = async <T extends object>(\n dir: string,\n pattern: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n { requireFn = importDefault, shouldUseFileNameAsKey = (_: any) => true, globArgs = {} } = {}\n): Promise<T> => {\n const root = {};\n const files = await glob(pattern, { cwd: dir, ...globArgs });\n\n for (const file of files) {\n const absolutePath = path.resolve(dir, file);\n\n // load module\n delete require.cache[absolutePath];\n let mod;\n\n if (path.extname(absolutePath) === '.json') {\n mod = await fse.readJson(absolutePath);\n } else {\n mod = requireFn(absolutePath);\n }\n\n Object.defineProperty(mod, '__filename__', {\n enumerable: true,\n configurable: false,\n writable: false,\n value: path.basename(file),\n });\n\n const propPath = filePathToPropPath(file, shouldUseFileNameAsKey(file));\n\n if (propPath.length === 0) _.merge(root, mod);\n _.merge(root, _.setWith({}, propPath, mod, Object));\n }\n\n return root as T;\n};\n"],"names":["importDefault","_","glob","path","fse","filePathToPropPath"],"mappings":";;;;;;;;;;;;AAYO,MAAM,YAAY,OACvB,KACA,SAEA,EAAE,YAAYA,YAAe,eAAA,yBAAyB,CAACC,OAAW,MAAM,WAAW,CAAG,EAAA,IAAI,CAAA,MAC3E;AACf,QAAM,OAAO,CAAC;AACR,QAAA,QAAQ,MAAMC,KAAAA,KAAK,SAAS,EAAE,KAAK,KAAK,GAAG,UAAU;AAE3D,aAAW,QAAQ,OAAO;AACxB,UAAM,eAAeC,cAAA,QAAK,QAAQ,KAAK,IAAI;AAGpC,WAAA,QAAQ,MAAM,YAAY;AAC7B,QAAA;AAEJ,QAAIA,sBAAK,QAAQ,YAAY,MAAM,SAAS;AACpC,YAAA,MAAMC,aAAAA,QAAI,SAAS,YAAY;AAAA,IAAA,OAChC;AACL,YAAM,UAAU,YAAY;AAAA,IAAA;AAGvB,WAAA,eAAe,KAAK,gBAAgB;AAAA,MACzC,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAOD,cAAAA,QAAK,SAAS,IAAI;AAAA,IAAA,CAC1B;AAED,UAAM,WAAWE,mBAAA,mBAAmB,MAAM,uBAAuB,IAAI,CAAC;AAEtE,QAAI,SAAS,WAAW,EAAKJ,YAAA,QAAA,MAAM,MAAM,GAAG;AAC1CA,uBAAA,MAAM,MAAMA,mBAAE,QAAQ,CAAA,GAAI,UAAU,KAAK,MAAM,CAAC;AAAA,EAAA;AAG7C,SAAA;AACT;;"}
|
@@ -23,8 +23,7 @@ const loadFiles = async (dir, pattern, { requireFn = importDefault, shouldUseFil
|
|
23
23
|
value: path.basename(file)
|
24
24
|
});
|
25
25
|
const propPath = filePathToPropPath(file, shouldUseFileNameAsKey(file));
|
26
|
-
if (propPath.length === 0)
|
27
|
-
_.merge(root, mod);
|
26
|
+
if (propPath.length === 0) _.merge(root, mod);
|
28
27
|
_.merge(root, _.setWith({}, propPath, mod, Object));
|
29
28
|
}
|
30
29
|
return root;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load-files.mjs","sources":["../../src/utils/load-files.ts"],"sourcesContent":["import path from 'path';\nimport _ from 'lodash';\nimport fse from 'fs-extra';\n\nimport { importDefault } from '@strapi/utils';\nimport { glob } from 'glob';\nimport { filePathToPropPath } from './filepath-to-prop-path';\n\n/**\n * Returns an Object build from a list of files matching a glob pattern in a directory\n * It builds a tree structure resembling the folder structure in dir\n */\nexport const loadFiles = async <T extends object>(\n dir: string,\n pattern: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n { requireFn = importDefault, shouldUseFileNameAsKey = (_: any) => true, globArgs = {} } = {}\n): Promise<T> => {\n const root = {};\n const files = await glob(pattern, { cwd: dir, ...globArgs });\n\n for (const file of files) {\n const absolutePath = path.resolve(dir, file);\n\n // load module\n delete require.cache[absolutePath];\n let mod;\n\n if (path.extname(absolutePath) === '.json') {\n mod = await fse.readJson(absolutePath);\n } else {\n mod = requireFn(absolutePath);\n }\n\n Object.defineProperty(mod, '__filename__', {\n enumerable: true,\n configurable: false,\n writable: false,\n value: path.basename(file),\n });\n\n const propPath = filePathToPropPath(file, shouldUseFileNameAsKey(file));\n\n if (propPath.length === 0) _.merge(root, mod);\n _.merge(root, _.setWith({}, propPath, mod, Object));\n }\n\n return root as T;\n};\n"],"names":["_"],"mappings":";;;;;;AAYO,MAAM,YAAY,OACvB,KACA,SAEA,EAAE,YAAY,eAAe,yBAAyB,CAACA,OAAW,MAAM,WAAW,CAAG,EAAA,IAAI,CAAA,MAC3E;AACf,QAAM,OAAO,
|
1
|
+
{"version":3,"file":"load-files.mjs","sources":["../../src/utils/load-files.ts"],"sourcesContent":["import path from 'path';\nimport _ from 'lodash';\nimport fse from 'fs-extra';\n\nimport { importDefault } from '@strapi/utils';\nimport { glob } from 'glob';\nimport { filePathToPropPath } from './filepath-to-prop-path';\n\n/**\n * Returns an Object build from a list of files matching a glob pattern in a directory\n * It builds a tree structure resembling the folder structure in dir\n */\nexport const loadFiles = async <T extends object>(\n dir: string,\n pattern: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n { requireFn = importDefault, shouldUseFileNameAsKey = (_: any) => true, globArgs = {} } = {}\n): Promise<T> => {\n const root = {};\n const files = await glob(pattern, { cwd: dir, ...globArgs });\n\n for (const file of files) {\n const absolutePath = path.resolve(dir, file);\n\n // load module\n delete require.cache[absolutePath];\n let mod;\n\n if (path.extname(absolutePath) === '.json') {\n mod = await fse.readJson(absolutePath);\n } else {\n mod = requireFn(absolutePath);\n }\n\n Object.defineProperty(mod, '__filename__', {\n enumerable: true,\n configurable: false,\n writable: false,\n value: path.basename(file),\n });\n\n const propPath = filePathToPropPath(file, shouldUseFileNameAsKey(file));\n\n if (propPath.length === 0) _.merge(root, mod);\n _.merge(root, _.setWith({}, propPath, mod, Object));\n }\n\n return root as T;\n};\n"],"names":["_"],"mappings":";;;;;;AAYO,MAAM,YAAY,OACvB,KACA,SAEA,EAAE,YAAY,eAAe,yBAAyB,CAACA,OAAW,MAAM,WAAW,CAAG,EAAA,IAAI,CAAA,MAC3E;AACf,QAAM,OAAO,CAAC;AACR,QAAA,QAAQ,MAAM,KAAK,SAAS,EAAE,KAAK,KAAK,GAAG,UAAU;AAE3D,aAAW,QAAQ,OAAO;AACxB,UAAM,eAAe,KAAK,QAAQ,KAAK,IAAI;AAGpC,WAAA,QAAQ,MAAM,YAAY;AAC7B,QAAA;AAEJ,QAAI,KAAK,QAAQ,YAAY,MAAM,SAAS;AACpC,YAAA,MAAM,IAAI,SAAS,YAAY;AAAA,IAAA,OAChC;AACL,YAAM,UAAU,YAAY;AAAA,IAAA;AAGvB,WAAA,eAAe,KAAK,gBAAgB;AAAA,MACzC,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,UAAU;AAAA,MACV,OAAO,KAAK,SAAS,IAAI;AAAA,IAAA,CAC1B;AAED,UAAM,WAAW,mBAAmB,MAAM,uBAAuB,IAAI,CAAC;AAEtE,QAAI,SAAS,WAAW,EAAK,GAAA,MAAM,MAAM,GAAG;AAC1C,MAAA,MAAM,MAAM,EAAE,QAAQ,CAAA,GAAI,UAAU,KAAK,MAAM,CAAC;AAAA,EAAA;AAG7C,SAAA;AACT;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resolve-working-dirs.js","sources":["../../src/utils/resolve-working-dirs.ts"],"sourcesContent":["import path from 'node:path';\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 */\nexport const 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 { appDir, distDir };\n};\n"],"names":["path"],"mappings":";;;;;AAaa,MAAA,4BAA4B,CAAC,SAAgD;AAClF,QAAA,MAAM,QAAQ;
|
1
|
+
{"version":3,"file":"resolve-working-dirs.js","sources":["../../src/utils/resolve-working-dirs.ts"],"sourcesContent":["import path from 'node:path';\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 */\nexport const 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 { appDir, distDir };\n};\n"],"names":["path"],"mappings":";;;;;AAaa,MAAA,4BAA4B,CAAC,SAAgD;AAClF,QAAA,MAAM,QAAQ,IAAI;AAElB,QAAA,SAAS,KAAK,SAASA,cAAA,QAAK,QAAQ,KAAK,KAAK,MAAM,IAAI;AACxD,QAAA,UAAU,KAAK,UAAUA,cAAA,QAAK,QAAQ,KAAK,KAAK,OAAO,IAAI;AAE1D,SAAA,EAAE,QAAQ,QAAQ;AAC3B;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resolve-working-dirs.mjs","sources":["../../src/utils/resolve-working-dirs.ts"],"sourcesContent":["import path from 'node:path';\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 */\nexport const 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 { appDir, distDir };\n};\n"],"names":[],"mappings":";AAaa,MAAA,4BAA4B,CAAC,SAAgD;AAClF,QAAA,MAAM,QAAQ;
|
1
|
+
{"version":3,"file":"resolve-working-dirs.mjs","sources":["../../src/utils/resolve-working-dirs.ts"],"sourcesContent":["import path from 'node:path';\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 */\nexport const 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 { appDir, distDir };\n};\n"],"names":[],"mappings":";AAaa,MAAA,4BAA4B,CAAC,SAAgD;AAClF,QAAA,MAAM,QAAQ,IAAI;AAElB,QAAA,SAAS,KAAK,SAAS,KAAK,QAAQ,KAAK,KAAK,MAAM,IAAI;AACxD,QAAA,UAAU,KAAK,UAAU,KAAK,QAAQ,KAAK,KAAK,OAAO,IAAI;AAE1D,SAAA,EAAE,QAAQ,QAAQ;AAC3B;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"signals.js","sources":["../../src/utils/signals.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport const destroyOnSignal = (strapi: Core.Strapi) => {\n let signalReceived = false;\n\n // For unknown reasons, we receive signals 2 times.\n // As a temporary fix, we ignore the signals received after the first one.\n\n const terminateStrapi = async () => {\n if (!signalReceived) {\n signalReceived = true;\n await strapi.destroy();\n process.exit();\n }\n };\n\n ['SIGTERM', 'SIGINT'].forEach((signal) => {\n process.on(signal, terminateStrapi);\n });\n};\n"],"names":[],"mappings":";;AAEa,MAAA,kBAAkB,CAAC,WAAwB;AACtD,MAAI,iBAAiB;AAKrB,QAAM,kBAAkB,YAAY;AAClC,QAAI,CAAC,gBAAgB;AACF,uBAAA;AACjB,YAAM,OAAO;
|
1
|
+
{"version":3,"file":"signals.js","sources":["../../src/utils/signals.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport const destroyOnSignal = (strapi: Core.Strapi) => {\n let signalReceived = false;\n\n // For unknown reasons, we receive signals 2 times.\n // As a temporary fix, we ignore the signals received after the first one.\n\n const terminateStrapi = async () => {\n if (!signalReceived) {\n signalReceived = true;\n await strapi.destroy();\n process.exit();\n }\n };\n\n ['SIGTERM', 'SIGINT'].forEach((signal) => {\n process.on(signal, terminateStrapi);\n });\n};\n"],"names":[],"mappings":";;AAEa,MAAA,kBAAkB,CAAC,WAAwB;AACtD,MAAI,iBAAiB;AAKrB,QAAM,kBAAkB,YAAY;AAClC,QAAI,CAAC,gBAAgB;AACF,uBAAA;AACjB,YAAM,OAAO,QAAQ;AACrB,cAAQ,KAAK;AAAA,IAAA;AAAA,EAEjB;AAEA,GAAC,WAAW,QAAQ,EAAE,QAAQ,CAAC,WAAW;AAChC,YAAA,GAAG,QAAQ,eAAe;AAAA,EAAA,CACnC;AACH;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"signals.mjs","sources":["../../src/utils/signals.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport const destroyOnSignal = (strapi: Core.Strapi) => {\n let signalReceived = false;\n\n // For unknown reasons, we receive signals 2 times.\n // As a temporary fix, we ignore the signals received after the first one.\n\n const terminateStrapi = async () => {\n if (!signalReceived) {\n signalReceived = true;\n await strapi.destroy();\n process.exit();\n }\n };\n\n ['SIGTERM', 'SIGINT'].forEach((signal) => {\n process.on(signal, terminateStrapi);\n });\n};\n"],"names":[],"mappings":"AAEa,MAAA,kBAAkB,CAAC,WAAwB;AACtD,MAAI,iBAAiB;AAKrB,QAAM,kBAAkB,YAAY;AAClC,QAAI,CAAC,gBAAgB;AACF,uBAAA;AACjB,YAAM,OAAO;
|
1
|
+
{"version":3,"file":"signals.mjs","sources":["../../src/utils/signals.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport const destroyOnSignal = (strapi: Core.Strapi) => {\n let signalReceived = false;\n\n // For unknown reasons, we receive signals 2 times.\n // As a temporary fix, we ignore the signals received after the first one.\n\n const terminateStrapi = async () => {\n if (!signalReceived) {\n signalReceived = true;\n await strapi.destroy();\n process.exit();\n }\n };\n\n ['SIGTERM', 'SIGINT'].forEach((signal) => {\n process.on(signal, terminateStrapi);\n });\n};\n"],"names":[],"mappings":"AAEa,MAAA,kBAAkB,CAAC,WAAwB;AACtD,MAAI,iBAAiB;AAKrB,QAAM,kBAAkB,YAAY;AAClC,QAAI,CAAC,gBAAgB;AACF,uBAAA;AACjB,YAAM,OAAO,QAAQ;AACrB,cAAQ,KAAK;AAAA,IAAA;AAAA,EAEjB;AAEA,GAAC,WAAW,QAAQ,EAAE,QAAQ,CAAC,WAAW;AAChC,YAAA,GAAG,QAAQ,eAAe;AAAA,EAAA,CACnC;AACH;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"startup-logger.d.ts","sourceRoot":"","sources":["../../src/utils/startup-logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,eAAO,MAAM,mBAAmB,QAAS,KAAK,MAAM;;;;
|
1
|
+
{"version":3,"file":"startup-logger.d.ts","sourceRoot":"","sources":["../../src/utils/startup-logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,eAAO,MAAM,mBAAmB,QAAS,KAAK,MAAM;;;;yCA+EX;QAAE,aAAa,EAAE,OAAO,CAAA;KAAE;CAWlE,CAAC"}
|
@@ -18,6 +18,7 @@ const createStartupLogger = (app) => {
|
|
18
18
|
colWidths: [20, 50],
|
19
19
|
chars: { mid: "", "left-mid": "", "mid-mid": "", "right-mid": "" }
|
20
20
|
});
|
21
|
+
const dbInfo = app.db?.getInfo();
|
21
22
|
infoTable.push(
|
22
23
|
[chalk__default.default.blue("Time"), `${/* @__PURE__ */ new Date()}`],
|
23
24
|
[chalk__default.default.blue("Launched in"), `${Date.now() - app.config.launchedAt} ms`],
|
@@ -25,8 +26,12 @@ const createStartupLogger = (app) => {
|
|
25
26
|
[chalk__default.default.blue("Process PID"), process.pid],
|
26
27
|
[chalk__default.default.blue("Version"), `${app.config.info.strapi} (node ${process.version})`],
|
27
28
|
[chalk__default.default.blue("Edition"), app.EE ? "Enterprise" : "Community"],
|
28
|
-
[chalk__default.default.blue("Database"),
|
29
|
+
[chalk__default.default.blue("Database"), dbInfo?.client],
|
30
|
+
[chalk__default.default.blue("Database name"), dbInfo?.displayName]
|
29
31
|
);
|
32
|
+
if (dbInfo?.schema) {
|
33
|
+
infoTable.push([chalk__default.default.blue("Database schema"), dbInfo.schema]);
|
34
|
+
}
|
30
35
|
console.log(infoTable.toString());
|
31
36
|
console.log();
|
32
37
|
console.log(chalk__default.default.black.bgWhite(fp__default.default.padEnd(columns, " Actions available")));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"startup-logger.js","sources":["../../src/utils/startup-logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport CLITable from 'cli-table3';\nimport _ from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\nexport const createStartupLogger = (app: Core.Strapi) => {\n return {\n logStats() {\n const columns = Math.min(process.stderr.columns, 80) - 2;\n console.log();\n console.log(chalk.black.bgWhite(_.padEnd(columns, ' Project information')));\n console.log();\n\n const infoTable = new CLITable({\n colWidths: [20, 50],\n chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },\n });\n\n infoTable.push(\n [chalk.blue('Time'), `${new Date()}`],\n [chalk.blue('Launched in'), `${Date.now() - app.config.launchedAt} ms`],\n [chalk.blue('Environment'), app.config.environment],\n [chalk.blue('Process PID'), process.pid],\n [chalk.blue('Version'), `${app.config.info.strapi} (node ${process.version})`],\n [chalk.blue('Edition'), app.EE ? 'Enterprise' : 'Community'],\n [chalk.blue('Database'),
|
1
|
+
{"version":3,"file":"startup-logger.js","sources":["../../src/utils/startup-logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport CLITable from 'cli-table3';\nimport _ from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\nexport const createStartupLogger = (app: Core.Strapi) => {\n return {\n logStats() {\n const columns = Math.min(process.stderr.columns, 80) - 2;\n console.log();\n console.log(chalk.black.bgWhite(_.padEnd(columns, ' Project information')));\n console.log();\n\n const infoTable = new CLITable({\n colWidths: [20, 50],\n chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },\n });\n\n const dbInfo = app.db?.getInfo();\n\n infoTable.push(\n [chalk.blue('Time'), `${new Date()}`],\n [chalk.blue('Launched in'), `${Date.now() - app.config.launchedAt} ms`],\n [chalk.blue('Environment'), app.config.environment],\n [chalk.blue('Process PID'), process.pid],\n [chalk.blue('Version'), `${app.config.info.strapi} (node ${process.version})`],\n [chalk.blue('Edition'), app.EE ? 'Enterprise' : 'Community'],\n [chalk.blue('Database'), dbInfo?.client],\n [chalk.blue('Database name'), dbInfo?.displayName]\n );\n\n if (dbInfo?.schema) {\n infoTable.push([chalk.blue('Database schema'), dbInfo.schema]);\n }\n\n console.log(infoTable.toString());\n console.log();\n console.log(chalk.black.bgWhite(_.padEnd(columns, ' Actions available')));\n console.log();\n },\n\n logFirstStartupMessage() {\n if (!strapi.config.get('server.logger.startup.enabled')) {\n return;\n }\n\n this.logStats();\n\n console.log(chalk.bold('One more thing...'));\n console.log(\n chalk.grey('Create your first administrator 💻 by going to the administration panel at:')\n );\n console.log();\n\n const addressTable = new CLITable();\n\n const adminUrl = strapi.config.get('admin.absoluteUrl');\n addressTable.push([chalk.bold(adminUrl)]);\n\n console.log(`${addressTable.toString()}`);\n console.log();\n },\n\n logDefaultStartupMessage() {\n if (!strapi.config.get('server.logger.startup.enabled')) {\n return;\n }\n this.logStats();\n\n console.log(chalk.bold('Welcome back!'));\n\n if (app.config.get('admin.serveAdminPanel') === true) {\n console.log(chalk.grey('To manage your project 🚀, go to the administration panel at:'));\n const adminUrl = strapi.config.get('admin.absoluteUrl');\n console.log(chalk.bold(adminUrl));\n console.log();\n }\n\n console.log(chalk.grey('To access the server ⚡️, go to:'));\n const serverUrl = strapi.config.get('server.absoluteUrl');\n console.log(chalk.bold(serverUrl));\n console.log();\n },\n\n logStartupMessage({ isInitialized }: { isInitialized: boolean }) {\n if (!strapi.config.get('server.logger.startup.enabled')) {\n return;\n }\n if (!isInitialized) {\n this.logFirstStartupMessage();\n } else {\n this.logDefaultStartupMessage();\n }\n },\n };\n};\n"],"names":["chalk","_","CLITable"],"mappings":";;;;;;;;;AAMa,MAAA,sBAAsB,CAAC,QAAqB;AAChD,SAAA;AAAA,IACL,WAAW;AACT,YAAM,UAAU,KAAK,IAAI,QAAQ,OAAO,SAAS,EAAE,IAAI;AACvD,cAAQ,IAAI;AACJ,cAAA,IAAIA,uBAAM,MAAM,QAAQC,oBAAE,OAAO,SAAS,sBAAsB,CAAC,CAAC;AAC1E,cAAQ,IAAI;AAEN,YAAA,YAAY,IAAIC,0BAAS;AAAA,QAC7B,WAAW,CAAC,IAAI,EAAE;AAAA,QAClB,OAAO,EAAE,KAAK,IAAI,YAAY,IAAI,WAAW,IAAI,aAAa,GAAG;AAAA,MAAA,CAClE;AAEK,YAAA,SAAS,IAAI,IAAI,QAAQ;AAErB,gBAAA;AAAA,QACR,CAACF,eAAAA,QAAM,KAAK,MAAM,GAAG,GAAG,oBAAI,KAAM,CAAA,EAAE;AAAA,QACpC,CAACA,uBAAM,KAAK,aAAa,GAAG,GAAG,KAAK,IAAA,IAAQ,IAAI,OAAO,UAAU,KAAK;AAAA,QACtE,CAACA,eAAAA,QAAM,KAAK,aAAa,GAAG,IAAI,OAAO,WAAW;AAAA,QAClD,CAACA,eAAM,QAAA,KAAK,aAAa,GAAG,QAAQ,GAAG;AAAA,QACvC,CAACA,eAAA,QAAM,KAAK,SAAS,G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,eAAAA,QAAM,KAAK,+DAA+D,CAAC;AACvF,cAAM,WAAW,OAAO,OAAO,IAAI,mBAAmB;AACtD,gBAAQ,IAAIA,eAAAA,QAAM,KAAK,QAAQ,CAAC;AAChC,gBAAQ,IAAI;AAAA,MAAA;AAGd,cAAQ,IAAIA,eAAAA,QAAM,KAAK,iCAAiC,CAAC;AACzD,YAAM,YAAY,OAAO,OAAO,IAAI,oBAAoB;AACxD,cAAQ,IAAIA,eAAAA,QAAM,KAAK,SAAS,CAAC;AACjC,cAAQ,IAAI;AAAA,IACd;AAAA,IAEA,kBAAkB,EAAE,iBAA6C;AAC/D,UAAI,CAAC,OAAO,OAAO,IAAI,+BAA+B,GAAG;AACvD;AAAA,MAAA;AAEF,UAAI,CAAC,eAAe;AAClB,aAAK,uBAAuB;AAAA,MAAA,OACvB;AACL,aAAK,yBAAyB;AAAA,MAAA;AAAA,IAChC;AAAA,EAEJ;AACF;;"}
|
@@ -12,6 +12,7 @@ const createStartupLogger = (app) => {
|
|
12
12
|
colWidths: [20, 50],
|
13
13
|
chars: { mid: "", "left-mid": "", "mid-mid": "", "right-mid": "" }
|
14
14
|
});
|
15
|
+
const dbInfo = app.db?.getInfo();
|
15
16
|
infoTable.push(
|
16
17
|
[chalk.blue("Time"), `${/* @__PURE__ */ new Date()}`],
|
17
18
|
[chalk.blue("Launched in"), `${Date.now() - app.config.launchedAt} ms`],
|
@@ -19,8 +20,12 @@ const createStartupLogger = (app) => {
|
|
19
20
|
[chalk.blue("Process PID"), process.pid],
|
20
21
|
[chalk.blue("Version"), `${app.config.info.strapi} (node ${process.version})`],
|
21
22
|
[chalk.blue("Edition"), app.EE ? "Enterprise" : "Community"],
|
22
|
-
[chalk.blue("Database"),
|
23
|
+
[chalk.blue("Database"), dbInfo?.client],
|
24
|
+
[chalk.blue("Database name"), dbInfo?.displayName]
|
23
25
|
);
|
26
|
+
if (dbInfo?.schema) {
|
27
|
+
infoTable.push([chalk.blue("Database schema"), dbInfo.schema]);
|
28
|
+
}
|
24
29
|
console.log(infoTable.toString());
|
25
30
|
console.log();
|
26
31
|
console.log(chalk.black.bgWhite(fp.padEnd(columns, " Actions available")));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"startup-logger.mjs","sources":["../../src/utils/startup-logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport CLITable from 'cli-table3';\nimport _ from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\nexport const createStartupLogger = (app: Core.Strapi) => {\n return {\n logStats() {\n const columns = Math.min(process.stderr.columns, 80) - 2;\n console.log();\n console.log(chalk.black.bgWhite(_.padEnd(columns, ' Project information')));\n console.log();\n\n const infoTable = new CLITable({\n colWidths: [20, 50],\n chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },\n });\n\n infoTable.push(\n [chalk.blue('Time'), `${new Date()}`],\n [chalk.blue('Launched in'), `${Date.now() - app.config.launchedAt} ms`],\n [chalk.blue('Environment'), app.config.environment],\n [chalk.blue('Process PID'), process.pid],\n [chalk.blue('Version'), `${app.config.info.strapi} (node ${process.version})`],\n [chalk.blue('Edition'), app.EE ? 'Enterprise' : 'Community'],\n [chalk.blue('Database'),
|
1
|
+
{"version":3,"file":"startup-logger.mjs","sources":["../../src/utils/startup-logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport CLITable from 'cli-table3';\nimport _ from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\nexport const createStartupLogger = (app: Core.Strapi) => {\n return {\n logStats() {\n const columns = Math.min(process.stderr.columns, 80) - 2;\n console.log();\n console.log(chalk.black.bgWhite(_.padEnd(columns, ' Project information')));\n console.log();\n\n const infoTable = new CLITable({\n colWidths: [20, 50],\n chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },\n });\n\n const dbInfo = app.db?.getInfo();\n\n infoTable.push(\n [chalk.blue('Time'), `${new Date()}`],\n [chalk.blue('Launched in'), `${Date.now() - app.config.launchedAt} ms`],\n [chalk.blue('Environment'), app.config.environment],\n [chalk.blue('Process PID'), process.pid],\n [chalk.blue('Version'), `${app.config.info.strapi} (node ${process.version})`],\n [chalk.blue('Edition'), app.EE ? 'Enterprise' : 'Community'],\n [chalk.blue('Database'), dbInfo?.client],\n [chalk.blue('Database name'), dbInfo?.displayName]\n );\n\n if (dbInfo?.schema) {\n infoTable.push([chalk.blue('Database schema'), dbInfo.schema]);\n }\n\n console.log(infoTable.toString());\n console.log();\n console.log(chalk.black.bgWhite(_.padEnd(columns, ' Actions available')));\n console.log();\n },\n\n logFirstStartupMessage() {\n if (!strapi.config.get('server.logger.startup.enabled')) {\n return;\n }\n\n this.logStats();\n\n console.log(chalk.bold('One more thing...'));\n console.log(\n chalk.grey('Create your first administrator 💻 by going to the administration panel at:')\n );\n console.log();\n\n const addressTable = new CLITable();\n\n const adminUrl = strapi.config.get('admin.absoluteUrl');\n addressTable.push([chalk.bold(adminUrl)]);\n\n console.log(`${addressTable.toString()}`);\n console.log();\n },\n\n logDefaultStartupMessage() {\n if (!strapi.config.get('server.logger.startup.enabled')) {\n return;\n }\n this.logStats();\n\n console.log(chalk.bold('Welcome back!'));\n\n if (app.config.get('admin.serveAdminPanel') === true) {\n console.log(chalk.grey('To manage your project 🚀, go to the administration panel at:'));\n const adminUrl = strapi.config.get('admin.absoluteUrl');\n console.log(chalk.bold(adminUrl));\n console.log();\n }\n\n console.log(chalk.grey('To access the server ⚡️, go to:'));\n const serverUrl = strapi.config.get('server.absoluteUrl');\n console.log(chalk.bold(serverUrl));\n console.log();\n },\n\n logStartupMessage({ isInitialized }: { isInitialized: boolean }) {\n if (!strapi.config.get('server.logger.startup.enabled')) {\n return;\n }\n if (!isInitialized) {\n this.logFirstStartupMessage();\n } else {\n this.logDefaultStartupMessage();\n }\n },\n };\n};\n"],"names":["_"],"mappings":";;;AAMa,MAAA,sBAAsB,CAAC,QAAqB;AAChD,SAAA;AAAA,IACL,WAAW;AACT,YAAM,UAAU,KAAK,IAAI,QAAQ,OAAO,SAAS,EA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