@strapi/strapi 4.14.0-alpha.0 → 4.14.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/README.md +25 -29
- package/bin/strapi.js +1 -1
- package/dist/Strapi.d.ts +102 -0
- package/dist/Strapi.js +544 -0
- package/dist/Strapi.js.map +1 -0
- package/dist/commands/actions/admin/create-user/action.d.ts +11 -0
- package/dist/commands/actions/admin/create-user/action.js +97 -0
- package/dist/commands/actions/admin/create-user/action.js.map +1 -0
- package/dist/commands/actions/admin/create-user/command.d.ts +6 -0
- package/dist/commands/actions/admin/create-user/command.js +19 -0
- package/dist/commands/actions/admin/create-user/command.js.map +1 -0
- package/dist/commands/actions/admin/reset-user-password/action.d.ts +9 -0
- package/dist/commands/actions/admin/reset-user-password/action.js +43 -0
- package/dist/commands/actions/admin/reset-user-password/action.js.map +1 -0
- package/dist/commands/actions/admin/reset-user-password/command.d.ts +6 -0
- package/dist/commands/actions/admin/reset-user-password/command.js +17 -0
- package/dist/commands/actions/admin/reset-user-password/command.js.map +1 -0
- package/dist/commands/actions/build-command/action.d.ts +9 -0
- package/dist/commands/actions/build-command/action.js +20 -0
- package/dist/commands/actions/build-command/action.js.map +1 -0
- package/dist/commands/actions/build-command/command.d.ts +6 -0
- package/dist/commands/actions/build-command/command.js +15 -0
- package/dist/commands/actions/build-command/command.js.map +1 -0
- package/dist/commands/actions/components/list/action.d.ts +2 -0
- package/dist/commands/actions/components/list/action.js +20 -0
- package/dist/commands/actions/components/list/action.js.map +1 -0
- package/dist/commands/actions/components/list/command.d.ts +6 -0
- package/dist/commands/actions/components/list/command.js +14 -0
- package/dist/commands/actions/components/list/command.js.map +1 -0
- package/dist/commands/actions/configuration/dump/action.d.ts +10 -0
- package/dist/commands/actions/configuration/dump/action.js +46 -0
- package/dist/commands/actions/configuration/dump/action.js.map +1 -0
- package/dist/commands/actions/configuration/dump/command.d.ts +6 -0
- package/dist/commands/actions/configuration/dump/command.js +17 -0
- package/dist/commands/actions/configuration/dump/command.js.map +1 -0
- package/dist/commands/actions/configuration/restore/action.d.ts +10 -0
- package/dist/commands/actions/configuration/restore/action.js +153 -0
- package/dist/commands/actions/configuration/restore/action.js.map +1 -0
- package/dist/commands/actions/configuration/restore/command.d.ts +6 -0
- package/dist/commands/actions/configuration/restore/command.js +17 -0
- package/dist/commands/actions/configuration/restore/command.js.map +1 -0
- package/dist/commands/actions/console/action.d.ts +5 -0
- package/dist/commands/actions/console/action.js +26 -0
- package/dist/commands/actions/console/action.js.map +1 -0
- package/dist/commands/actions/console/command.d.ts +6 -0
- package/dist/commands/actions/console/command.js +14 -0
- package/dist/commands/actions/console/command.js.map +1 -0
- package/dist/commands/actions/content-types/list/action.d.ts +2 -0
- package/dist/commands/actions/content-types/list/action.js +20 -0
- package/dist/commands/actions/content-types/list/action.js.map +1 -0
- package/dist/commands/actions/content-types/list/command.d.ts +6 -0
- package/dist/commands/actions/content-types/list/command.js +14 -0
- package/dist/commands/actions/content-types/list/command.js.map +1 -0
- package/dist/commands/actions/controllers/list/action.d.ts +2 -0
- package/dist/commands/actions/controllers/list/action.js +20 -0
- package/dist/commands/actions/controllers/list/action.js.map +1 -0
- package/dist/commands/actions/controllers/list/command.d.ts +6 -0
- package/dist/commands/actions/controllers/list/command.js +14 -0
- package/dist/commands/actions/controllers/list/command.js.map +1 -0
- package/dist/commands/actions/develop/action.d.ts +86 -0
- package/dist/commands/actions/develop/action.js +190 -0
- package/dist/commands/actions/develop/action.js.map +1 -0
- package/dist/commands/actions/develop/command.d.ts +6 -0
- package/dist/commands/actions/develop/command.js +19 -0
- package/dist/commands/actions/develop/command.js.map +1 -0
- package/dist/commands/actions/generate/command.d.ts +6 -0
- package/dist/commands/actions/generate/command.js +19 -0
- package/dist/commands/actions/generate/command.js.map +1 -0
- package/dist/commands/actions/hooks/list/action.d.ts +2 -0
- package/dist/commands/actions/hooks/list/action.js +20 -0
- package/dist/commands/actions/hooks/list/action.js.map +1 -0
- package/dist/commands/actions/hooks/list/command.d.ts +6 -0
- package/dist/commands/actions/hooks/list/command.js +14 -0
- package/dist/commands/actions/hooks/list/command.js.map +1 -0
- package/dist/commands/actions/install/action.d.ts +2 -0
- package/dist/commands/actions/install/action.js +49 -0
- package/dist/commands/actions/install/action.js.map +1 -0
- package/dist/commands/actions/install/command.d.ts +6 -0
- package/dist/commands/actions/install/command.js +14 -0
- package/dist/commands/actions/install/command.js.map +1 -0
- package/dist/commands/actions/middlewares/list/action.d.ts +2 -0
- package/dist/commands/actions/middlewares/list/action.js +20 -0
- package/dist/commands/actions/middlewares/list/action.js.map +1 -0
- package/dist/commands/actions/middlewares/list/command.d.ts +6 -0
- package/dist/commands/actions/middlewares/list/command.js +14 -0
- package/dist/commands/actions/middlewares/list/command.js.map +1 -0
- package/dist/commands/actions/new/action.d.ts +7 -0
- package/dist/commands/actions/new/action.js +12 -0
- package/dist/commands/actions/new/action.js.map +1 -0
- package/dist/commands/actions/new/command.d.ts +6 -0
- package/dist/commands/actions/new/command.js +35 -0
- package/dist/commands/actions/new/command.js.map +1 -0
- package/dist/commands/actions/plugin/build-command/action.d.ts +6 -0
- package/dist/commands/actions/plugin/build-command/action.js +105 -0
- package/dist/commands/actions/plugin/build-command/action.js.map +1 -0
- package/dist/commands/actions/plugin/build-command/command.d.ts +6 -0
- package/dist/commands/actions/plugin/build-command/command.js +17 -0
- package/dist/commands/actions/plugin/build-command/command.js.map +1 -0
- package/dist/commands/actions/policies/list/action.d.ts +2 -0
- package/dist/commands/actions/policies/list/action.js +20 -0
- package/dist/commands/actions/policies/list/action.js.map +1 -0
- package/dist/commands/actions/policies/list/command.d.ts +6 -0
- package/dist/commands/actions/policies/list/command.js +14 -0
- package/dist/commands/actions/policies/list/command.js.map +1 -0
- package/dist/commands/actions/report/action.d.ts +7 -0
- package/dist/commands/actions/report/action.js +32 -0
- package/dist/commands/actions/report/action.js.map +1 -0
- package/dist/commands/actions/report/command.d.ts +6 -0
- package/dist/commands/actions/report/command.js +17 -0
- package/dist/commands/actions/report/command.js.map +1 -0
- package/dist/commands/actions/routes/list/action.d.ts +2 -0
- package/dist/commands/actions/routes/list/action.js +26 -0
- package/dist/commands/actions/routes/list/action.js.map +1 -0
- package/dist/commands/actions/routes/list/command.d.ts +6 -0
- package/dist/commands/actions/routes/list/command.js +14 -0
- package/dist/commands/actions/routes/list/command.js.map +1 -0
- package/dist/commands/actions/services/list/action.d.ts +2 -0
- package/dist/commands/actions/services/list/action.js +20 -0
- package/dist/commands/actions/services/list/action.js.map +1 -0
- package/dist/commands/actions/services/list/command.d.ts +6 -0
- package/dist/commands/actions/services/list/command.js +14 -0
- package/dist/commands/actions/services/list/command.js.map +1 -0
- package/dist/commands/actions/start/action.d.ts +78 -0
- package/dist/commands/actions/start/action.js +22 -0
- package/dist/commands/actions/start/action.js.map +1 -0
- package/dist/commands/actions/start/command.d.ts +6 -0
- package/dist/commands/actions/start/command.js +14 -0
- package/dist/commands/actions/start/command.js.map +1 -0
- package/dist/commands/actions/telemetry/disable/action.d.ts +1 -0
- package/dist/commands/actions/telemetry/disable/action.js +83 -0
- package/dist/commands/actions/telemetry/disable/action.js.map +1 -0
- package/dist/commands/actions/telemetry/disable/command.d.ts +6 -0
- package/dist/commands/actions/telemetry/disable/command.js +14 -0
- package/dist/commands/actions/telemetry/disable/command.js.map +1 -0
- package/dist/commands/actions/telemetry/enable/action.d.ts +2 -0
- package/dist/commands/actions/telemetry/enable/action.js +103 -0
- package/dist/commands/actions/telemetry/enable/action.js.map +1 -0
- package/dist/commands/actions/telemetry/enable/command.d.ts +6 -0
- package/dist/commands/actions/telemetry/enable/command.js +14 -0
- package/dist/commands/actions/telemetry/enable/command.js.map +1 -0
- package/dist/commands/actions/templates/generate/action.d.ts +1 -0
- package/dist/commands/actions/templates/generate/action.js +85 -0
- package/dist/commands/actions/templates/generate/action.js.map +1 -0
- package/dist/commands/actions/templates/generate/command.d.ts +6 -0
- package/dist/commands/actions/templates/generate/command.js +14 -0
- package/dist/commands/actions/templates/generate/command.js.map +1 -0
- package/dist/commands/actions/ts/generate-types/action.d.ts +8 -0
- package/dist/commands/actions/ts/generate-types/action.js +28 -0
- package/dist/commands/actions/ts/generate-types/action.js.map +1 -0
- package/dist/commands/actions/ts/generate-types/command.d.ts +6 -0
- package/dist/commands/actions/ts/generate-types/command.js +18 -0
- package/dist/commands/actions/ts/generate-types/command.js.map +1 -0
- package/dist/commands/actions/uninstall/action.d.ts +5 -0
- package/dist/commands/actions/uninstall/action.js +67 -0
- package/dist/commands/actions/uninstall/action.js.map +1 -0
- package/dist/commands/actions/uninstall/command.d.ts +6 -0
- package/dist/commands/actions/uninstall/command.js +15 -0
- package/dist/commands/actions/uninstall/command.js.map +1 -0
- package/dist/commands/actions/version/command.d.ts +6 -0
- package/dist/commands/actions/version/command.js +19 -0
- package/dist/commands/actions/version/command.js.map +1 -0
- package/dist/commands/actions/watch-admin/action.d.ts +4 -0
- package/dist/commands/actions/watch-admin/action.js +36 -0
- package/dist/commands/actions/watch-admin/action.js.map +1 -0
- package/dist/commands/actions/watch-admin/command.d.ts +6 -0
- package/dist/commands/actions/watch-admin/command.js +15 -0
- package/dist/commands/actions/watch-admin/command.js.map +1 -0
- package/dist/commands/builders/admin.d.ts +8 -0
- package/dist/commands/builders/admin.js +52 -0
- package/dist/commands/builders/admin.js.map +1 -0
- package/dist/commands/builders/index.d.ts +3 -0
- package/dist/commands/builders/index.js +11 -0
- package/dist/commands/builders/index.js.map +1 -0
- package/dist/commands/builders/packages.d.ts +37 -0
- package/dist/commands/builders/packages.js +166 -0
- package/dist/commands/builders/packages.js.map +1 -0
- package/dist/commands/builders/tasks/dts.d.ts +13 -0
- package/dist/commands/builders/tasks/dts.js +143 -0
- package/dist/commands/builders/tasks/dts.js.map +1 -0
- package/dist/commands/builders/tasks/index.d.ts +14 -0
- package/dist/commands/builders/tasks/index.js +14 -0
- package/dist/commands/builders/tasks/index.js.map +1 -0
- package/dist/commands/builders/tasks/vite.d.ts +15 -0
- package/dist/commands/builders/tasks/vite.js +114 -0
- package/dist/commands/builders/tasks/vite.js.map +1 -0
- package/dist/commands/builders/typescript.d.ts +6 -0
- package/dist/commands/builders/typescript.js +29 -0
- package/dist/commands/builders/typescript.js.map +1 -0
- package/dist/commands/index.d.ts +34 -0
- package/dist/commands/index.js +100 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/types.d.ts +5 -0
- package/dist/commands/types.js +3 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/utils/commander.d.ts +35 -0
- package/dist/commands/utils/commander.js +138 -0
- package/dist/commands/utils/commander.js.map +1 -0
- package/dist/commands/utils/helpers.d.ts +50 -0
- package/dist/commands/utils/helpers.js +165 -0
- package/dist/commands/utils/helpers.js.map +1 -0
- package/dist/commands/utils/logger.d.ts +16 -0
- package/dist/commands/utils/logger.js +53 -0
- package/dist/commands/utils/logger.js.map +1 -0
- package/dist/commands/utils/pkg.d.ts +237 -0
- package/dist/commands/utils/pkg.js +316 -0
- package/dist/commands/utils/pkg.js.map +1 -0
- package/dist/compile.d.ts +9 -0
- package/dist/compile.js +20 -0
- package/dist/compile.js.map +1 -0
- package/dist/container.d.ts +2 -0
- package/dist/container.js +39 -0
- package/dist/container.js.map +1 -0
- package/dist/core/app-configuration/config-loader.d.ts +2 -0
- package/dist/core/app-configuration/config-loader.js +22 -0
- package/dist/core/app-configuration/config-loader.js.map +1 -0
- package/dist/core/app-configuration/index.d.ts +35 -0
- package/dist/core/app-configuration/index.js +54 -0
- package/dist/core/app-configuration/index.js.map +1 -0
- package/dist/core/app-configuration/load-config-file.d.ts +1 -0
- package/dist/core/app-configuration/load-config-file.js +49 -0
- package/dist/core/app-configuration/load-config-file.js.map +1 -0
- package/dist/core/bootstrap.d.ts +4 -0
- package/dist/core/bootstrap.js +27 -0
- package/dist/core/bootstrap.js.map +1 -0
- package/dist/core/domain/content-type/index.d.ts +8 -0
- package/dist/core/domain/content-type/index.js +117 -0
- package/dist/core/domain/content-type/index.js.map +1 -0
- package/dist/core/domain/content-type/validator.d.ts +21 -0
- package/dist/core/domain/content-type/validator.js +91 -0
- package/dist/core/domain/content-type/validator.js.map +1 -0
- package/dist/core/domain/module/index.d.ts +38 -0
- package/dist/core/domain/module/index.js +110 -0
- package/dist/core/domain/module/index.js.map +1 -0
- package/dist/core/domain/module/validation.d.ts +13 -0
- package/dist/core/domain/module/validation.js +29 -0
- package/dist/core/domain/module/validation.js.map +1 -0
- package/dist/core/loaders/admin.d.ts +2 -0
- package/dist/core/loaders/admin.js +18 -0
- package/dist/core/loaders/admin.js.map +1 -0
- package/dist/core/loaders/apis.d.ts +2 -0
- package/dist/core/loaders/apis.js +156 -0
- package/dist/core/loaders/apis.js.map +1 -0
- package/dist/core/loaders/components.d.ts +6 -0
- package/dist/core/loaders/components.js +37 -0
- package/dist/core/loaders/components.js.map +1 -0
- package/dist/core/loaders/index.d.ts +18 -0
- package/dist/core/loaders/index.js +26 -0
- package/dist/core/loaders/index.js.map +1 -0
- package/dist/core/loaders/middlewares.d.ts +2 -0
- package/dist/core/loaders/middlewares.js +34 -0
- package/dist/core/loaders/middlewares.js.map +1 -0
- package/dist/core/loaders/plugins/get-enabled-plugins.d.ts +4 -0
- package/dist/core/loaders/plugins/get-enabled-plugins.js +113 -0
- package/dist/core/loaders/plugins/get-enabled-plugins.js.map +1 -0
- package/dist/core/loaders/plugins/get-user-plugins-config.d.ts +6 -0
- package/dist/core/loaders/plugins/get-user-plugins-config.js +31 -0
- package/dist/core/loaders/plugins/get-user-plugins-config.js.map +1 -0
- package/dist/core/loaders/plugins/index.d.ts +2 -0
- package/dist/core/loaders/plugins/index.js +109 -0
- package/dist/core/loaders/plugins/index.js.map +1 -0
- package/dist/core/loaders/policies.d.ts +2 -0
- package/dist/core/loaders/policies.js +28 -0
- package/dist/core/loaders/policies.js.map +1 -0
- package/dist/core/loaders/sanitizers.d.ts +3 -0
- package/dist/core/loaders/sanitizers.js +6 -0
- package/dist/core/loaders/sanitizers.js.map +1 -0
- package/dist/core/loaders/src-index.d.ts +3 -0
- package/dist/core/loaders/src-index.js +37 -0
- package/dist/core/loaders/src-index.js.map +1 -0
- package/dist/core/loaders/validators.d.ts +3 -0
- package/dist/core/loaders/validators.js +6 -0
- package/dist/core/loaders/validators.js.map +1 -0
- package/dist/core/registries/apis.d.ts +7 -0
- package/dist/core/registries/apis.js +24 -0
- package/dist/core/registries/apis.js.map +1 -0
- package/dist/core/registries/config.d.ts +3 -0
- package/dist/core/registries/config.js +23 -0
- package/dist/core/registries/config.js.map +1 -0
- package/dist/core/registries/content-types.d.ts +32 -0
- package/dist/core/registries/content-types.js +70 -0
- package/dist/core/registries/content-types.js.map +1 -0
- package/dist/core/registries/controllers.d.ts +34 -0
- package/dist/core/registries/controllers.js +81 -0
- package/dist/core/registries/controllers.js.map +1 -0
- package/dist/core/registries/custom-fields.d.ts +7 -0
- package/dist/core/registries/custom-fields.js +74 -0
- package/dist/core/registries/custom-fields.js.map +1 -0
- package/dist/core/registries/hooks.d.ts +43 -0
- package/dist/core/registries/hooks.js +59 -0
- package/dist/core/registries/hooks.js.map +1 -0
- package/dist/core/registries/middlewares.d.ts +30 -0
- package/dist/core/registries/middlewares.js +62 -0
- package/dist/core/registries/middlewares.js.map +1 -0
- package/dist/core/registries/modules.d.ts +14 -0
- package/dist/core/registries/modules.js +40 -0
- package/dist/core/registries/modules.js.map +1 -0
- package/dist/core/registries/plugins.d.ts +8 -0
- package/dist/core/registries/plugins.js +24 -0
- package/dist/core/registries/plugins.js.map +1 -0
- package/dist/core/registries/policies.d.ts +33 -0
- package/dist/core/registries/policies.js +64 -0
- package/dist/core/registries/policies.js.map +1 -0
- package/dist/core/registries/sanitizers.d.ts +9 -0
- package/dist/core/registries/sanitizers.js +27 -0
- package/dist/core/registries/sanitizers.js.map +1 -0
- package/dist/core/registries/services.d.ts +34 -0
- package/dist/core/registries/services.js +82 -0
- package/dist/core/registries/services.js.map +1 -0
- package/dist/core/registries/validators.d.ts +9 -0
- package/dist/core/registries/validators.js +27 -0
- package/dist/core/registries/validators.js.map +1 -0
- package/dist/core/utils.d.ts +4 -0
- package/dist/core/utils.js +28 -0
- package/dist/core/utils.js.map +1 -0
- package/dist/core-api/controller/collection-type.d.ts +10 -0
- package/dist/core-api/controller/collection-type.js +95 -0
- package/dist/core-api/controller/collection-type.js.map +1 -0
- package/dist/core-api/controller/index.d.ts +5 -0
- package/dist/core-api/controller/index.js +50 -0
- package/dist/core-api/controller/index.js.map +1 -0
- package/dist/core-api/controller/single-type.d.ts +9 -0
- package/dist/core-api/controller/single-type.js +52 -0
- package/dist/core-api/controller/single-type.js.map +1 -0
- package/dist/core-api/controller/transform.d.ts +21 -0
- package/dist/core-api/controller/transform.js +86 -0
- package/dist/core-api/controller/transform.js.map +1 -0
- package/dist/core-api/routes/index.d.ts +23 -0
- package/dist/core-api/routes/index.js +68 -0
- package/dist/core-api/routes/index.js.map +1 -0
- package/dist/core-api/service/collection-type.d.ts +9 -0
- package/dist/core-api/service/collection-type.js +61 -0
- package/dist/core-api/service/collection-type.js.map +1 -0
- package/dist/core-api/service/get-fetch-params.d.ts +6 -0
- package/dist/core-api/service/get-fetch-params.js +16 -0
- package/dist/core-api/service/get-fetch-params.js.map +1 -0
- package/dist/core-api/service/index.d.ts +8 -0
- package/dist/core-api/service/index.js +18 -0
- package/dist/core-api/service/index.js.map +1 -0
- package/dist/core-api/service/pagination.d.ts +40 -0
- package/dist/core-api/service/pagination.js +97 -0
- package/dist/core-api/service/pagination.js.map +1 -0
- package/dist/core-api/service/single-type.d.ts +8 -0
- package/dist/core-api/service/single-type.js +57 -0
- package/dist/core-api/service/single-type.js.map +1 -0
- package/dist/ee/index.d.ts +19 -0
- package/dist/ee/index.js +185 -0
- package/dist/ee/index.js.map +1 -0
- package/dist/ee/license.d.ts +20 -0
- package/dist/ee/license.js +94 -0
- package/dist/ee/license.js.map +1 -0
- package/dist/factories.d.ts +12 -0
- package/dist/factories.js +70 -0
- package/dist/factories.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/load/filepath-to-prop-path.d.ts +5 -0
- package/dist/load/filepath-to-prop-path.js +21 -0
- package/dist/load/filepath-to-prop-path.js.map +1 -0
- package/dist/load/glob.d.ts +6 -0
- package/dist/load/glob.js +20 -0
- package/dist/load/glob.js.map +1 -0
- package/dist/load/index.d.ts +2 -0
- package/dist/load/index.js +11 -0
- package/dist/load/index.js.map +1 -0
- package/dist/load/load-files.d.ts +9 -0
- package/dist/load/load-files.js +44 -0
- package/dist/load/load-files.js.map +1 -0
- package/dist/load/package-path.d.ts +5 -0
- package/dist/load/package-path.js +11 -0
- package/dist/load/package-path.js.map +1 -0
- package/dist/middlewares/body.d.ts +5 -0
- package/dist/middlewares/body.js +78 -0
- package/dist/middlewares/body.js.map +1 -0
- package/dist/middlewares/compression.d.ts +4 -0
- package/dist/middlewares/compression.js +10 -0
- package/dist/middlewares/compression.js.map +1 -0
- package/dist/middlewares/cors.d.ts +12 -0
- package/dist/middlewares/cors.js +54 -0
- package/dist/middlewares/cors.js.map +1 -0
- package/dist/middlewares/errors.d.ts +3 -0
- package/dist/middlewares/errors.js +35 -0
- package/dist/middlewares/errors.js.map +1 -0
- package/dist/middlewares/favicon.d.ts +4 -0
- package/dist/middlewares/favicon.js +30 -0
- package/dist/middlewares/favicon.js.map +1 -0
- package/dist/middlewares/index.d.ts +2 -0
- package/dist/middlewares/index.js +34 -0
- package/dist/middlewares/index.js.map +1 -0
- package/dist/middlewares/ip.d.ts +4 -0
- package/dist/middlewares/ip.js +10 -0
- package/dist/middlewares/ip.js.map +1 -0
- package/dist/middlewares/logger.d.ts +2 -0
- package/dist/middlewares/logger.js +13 -0
- package/dist/middlewares/logger.js.map +1 -0
- package/dist/middlewares/powered-by.d.ts +5 -0
- package/dist/middlewares/powered-by.js +15 -0
- package/dist/middlewares/powered-by.js.map +1 -0
- package/dist/middlewares/public/index.d.ts +2 -0
- package/dist/middlewares/public/index.js +112 -0
- package/dist/middlewares/public/index.js.map +1 -0
- package/dist/middlewares/public/serve-static.d.ts +3 -0
- package/dist/middlewares/public/serve-static.js +27 -0
- package/dist/middlewares/public/serve-static.js.map +1 -0
- package/dist/middlewares/query.d.ts +2 -0
- package/dist/middlewares/query.js +45 -0
- package/dist/middlewares/query.js.map +1 -0
- package/dist/middlewares/response-time.d.ts +2 -0
- package/dist/middlewares/response-time.js +13 -0
- package/dist/middlewares/response-time.js.map +1 -0
- package/dist/middlewares/responses.d.ts +5 -0
- package/dist/middlewares/responses.js +16 -0
- package/dist/middlewares/responses.js.map +1 -0
- package/dist/middlewares/security.d.ts +4 -0
- package/dist/middlewares/security.js +52 -0
- package/dist/middlewares/security.js.map +1 -0
- package/dist/middlewares/session.d.ts +3 -0
- package/dist/middlewares/session.js +30 -0
- package/dist/middlewares/session.js.map +1 -0
- package/dist/migrations/draft-publish.d.ts +8 -0
- package/dist/migrations/draft-publish.js +46 -0
- package/dist/migrations/draft-publish.js.map +1 -0
- package/dist/services/auth/index.d.ts +25 -0
- package/dist/services/auth/index.js +84 -0
- package/dist/services/auth/index.js.map +1 -0
- package/dist/services/content-api/index.d.ts +53 -0
- package/dist/services/content-api/index.js +62 -0
- package/dist/services/content-api/index.js.map +1 -0
- package/dist/services/content-api/permissions/engine.d.ts +4 -0
- package/dist/services/content-api/permissions/engine.js +8 -0
- package/dist/services/content-api/permissions/engine.js.map +1 -0
- package/dist/services/content-api/permissions/index.d.ts +51 -0
- package/dist/services/content-api/permissions/index.js +110 -0
- package/dist/services/content-api/permissions/index.js.map +1 -0
- package/dist/services/content-api/permissions/providers/action.d.ts +19 -0
- package/dist/services/content-api/permissions/providers/action.js +16 -0
- package/dist/services/content-api/permissions/providers/action.js.map +1 -0
- package/dist/services/content-api/permissions/providers/condition.d.ts +23 -0
- package/dist/services/content-api/permissions/providers/condition.js +16 -0
- package/dist/services/content-api/permissions/providers/condition.js.map +1 -0
- package/dist/services/content-api/permissions/providers/index.d.ts +2 -0
- package/dist/services/content-api/permissions/providers/index.js +11 -0
- package/dist/services/content-api/permissions/providers/index.js.map +1 -0
- package/dist/services/core-store.d.ts +52 -0
- package/dist/services/core-store.js +123 -0
- package/dist/services/core-store.js.map +1 -0
- package/dist/services/cron.d.ts +26 -0
- package/dist/services/cron.js +69 -0
- package/dist/services/cron.js.map +1 -0
- package/dist/services/custom-fields.d.ts +3 -0
- package/dist/services/custom-fields.js +11 -0
- package/dist/services/custom-fields.js.map +1 -0
- package/dist/services/entity-service/attributes/index.d.ts +5 -0
- package/dist/services/entity-service/attributes/index.js +26 -0
- package/dist/services/entity-service/attributes/index.js.map +1 -0
- package/dist/services/entity-service/attributes/transforms.d.ts +9 -0
- package/dist/services/entity-service/attributes/transforms.js +22 -0
- package/dist/services/entity-service/attributes/transforms.js.map +1 -0
- package/dist/services/entity-service/components.d.ts +22 -0
- package/dist/services/entity-service/components.js +381 -0
- package/dist/services/entity-service/components.js.map +1 -0
- package/dist/services/entity-service/index.d.ts +14 -0
- package/dist/services/entity-service/index.js +311 -0
- package/dist/services/entity-service/index.js.map +1 -0
- package/dist/services/entity-service/params.d.ts +7 -0
- package/dist/services/entity-service/params.js +9 -0
- package/dist/services/entity-service/params.js.map +1 -0
- package/dist/services/entity-validator/blocks-validator.d.ts +2 -0
- package/dist/services/entity-validator/blocks-validator.js +127 -0
- package/dist/services/entity-validator/blocks-validator.js.map +1 -0
- package/dist/services/entity-validator/index.d.ts +7 -0
- package/dist/services/entity-validator/index.js +332 -0
- package/dist/services/entity-validator/index.js.map +1 -0
- package/dist/services/entity-validator/validators.d.ts +36 -0
- package/dist/services/entity-validator/validators.js +149 -0
- package/dist/services/entity-validator/validators.js.map +1 -0
- package/dist/services/errors.d.ts +39 -0
- package/dist/services/errors.js +78 -0
- package/dist/services/errors.js.map +1 -0
- package/dist/services/event-hub.d.ts +18 -0
- package/dist/services/event-hub.js +77 -0
- package/dist/services/event-hub.js.map +1 -0
- package/dist/services/fs.d.ts +12 -0
- package/dist/services/fs.js +54 -0
- package/dist/services/fs.js.map +1 -0
- package/dist/services/metrics/admin-user-hash.d.ts +6 -0
- package/dist/services/metrics/admin-user-hash.js +19 -0
- package/dist/services/metrics/admin-user-hash.js.map +1 -0
- package/dist/services/metrics/index.d.ts +13 -0
- package/dist/services/metrics/index.js +53 -0
- package/dist/services/metrics/index.js.map +1 -0
- package/dist/services/metrics/is-truthy.d.ts +2 -0
- package/dist/services/metrics/is-truthy.js +11 -0
- package/dist/services/metrics/is-truthy.js.map +1 -0
- package/dist/services/metrics/middleware.d.ts +6 -0
- package/dist/services/metrics/middleware.js +28 -0
- package/dist/services/metrics/middleware.js.map +1 -0
- package/dist/services/metrics/rate-limiter.d.ts +6 -0
- package/dist/services/metrics/rate-limiter.js +21 -0
- package/dist/services/metrics/rate-limiter.js.map +1 -0
- package/dist/services/metrics/sender.d.ts +12 -0
- package/dist/services/metrics/sender.js +80 -0
- package/dist/services/metrics/sender.js.map +1 -0
- package/dist/services/request-context.d.ts +6 -0
- package/dist/services/request-context.js +14 -0
- package/dist/services/request-context.js.map +1 -0
- package/dist/services/server/admin-api.d.ts +10 -0
- package/dist/services/server/admin-api.js +13 -0
- package/dist/services/server/admin-api.js.map +1 -0
- package/dist/services/server/api.d.ts +14 -0
- package/dist/services/server/api.js +32 -0
- package/dist/services/server/api.js.map +1 -0
- package/dist/services/server/compose-endpoint.d.ts +6 -0
- package/dist/services/server/compose-endpoint.js +121 -0
- package/dist/services/server/compose-endpoint.js.map +1 -0
- package/dist/services/server/content-api.d.ts +10 -0
- package/dist/services/server/content-api.js +13 -0
- package/dist/services/server/content-api.js.map +1 -0
- package/dist/services/server/http-server.d.ts +9 -0
- package/dist/services/server/http-server.js +54 -0
- package/dist/services/server/http-server.js.map +1 -0
- package/dist/services/server/index.d.ts +3 -0
- package/dist/services/server/index.js +91 -0
- package/dist/services/server/index.js.map +1 -0
- package/dist/services/server/koa.d.ts +15 -0
- package/dist/services/server/koa.js +56 -0
- package/dist/services/server/koa.js.map +1 -0
- package/dist/services/server/middleware.d.ts +14 -0
- package/dist/services/server/middleware.js +103 -0
- package/dist/services/server/middleware.js.map +1 -0
- package/dist/services/server/policy.d.ts +3 -0
- package/dist/services/server/policy.js +21 -0
- package/dist/services/server/policy.js.map +1 -0
- package/dist/services/server/register-middlewares.d.ts +6 -0
- package/dist/services/server/register-middlewares.js +82 -0
- package/dist/services/server/register-middlewares.js.map +1 -0
- package/dist/services/server/register-routes.d.ts +6 -0
- package/dist/services/server/register-routes.js +94 -0
- package/dist/services/server/register-routes.js.map +1 -0
- package/dist/services/server/routing.d.ts +32 -0
- package/dist/services/server/routing.js +105 -0
- package/dist/services/server/routing.js.map +1 -0
- package/dist/services/utils/dynamic-zones.d.ts +2 -0
- package/dist/services/utils/dynamic-zones.js +13 -0
- package/dist/services/utils/dynamic-zones.js.map +1 -0
- package/dist/services/utils/upload-files.d.ts +7 -0
- package/dist/services/utils/upload-files.js +74 -0
- package/dist/services/utils/upload-files.js.map +1 -0
- package/dist/services/webhook-runner.d.ts +48 -0
- package/dist/services/webhook-runner.js +141 -0
- package/dist/services/webhook-runner.js.map +1 -0
- package/dist/services/webhook-store.d.ts +49 -0
- package/dist/services/webhook-store.js +106 -0
- package/dist/services/webhook-store.js.map +1 -0
- package/dist/services/worker-queue.d.ts +19 -0
- package/dist/services/worker-queue.js +64 -0
- package/dist/services/worker-queue.js.map +1 -0
- package/dist/utils/addSlash.d.ts +2 -0
- package/dist/utils/addSlash.js +15 -0
- package/dist/utils/addSlash.js.map +1 -0
- package/dist/utils/convert-custom-field-type.d.ts +3 -0
- package/dist/utils/convert-custom-field-type.js +20 -0
- package/dist/utils/convert-custom-field-type.js.map +1 -0
- package/dist/utils/cron.d.ts +7 -0
- package/dist/utils/cron.js +56 -0
- package/dist/utils/cron.js.map +1 -0
- package/dist/utils/ee.d.ts +2 -0
- package/dist/utils/ee.js +8 -0
- package/dist/utils/ee.js.map +1 -0
- package/dist/utils/fetch.d.ts +8 -0
- package/dist/utils/fetch.js +23 -0
- package/dist/utils/fetch.js.map +1 -0
- package/dist/utils/get-dirs.d.ts +9 -0
- package/dist/utils/get-dirs.js +30 -0
- package/dist/utils/get-dirs.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/is-initialized.d.ts +5 -0
- package/dist/utils/is-initialized.js +21 -0
- package/dist/utils/is-initialized.js.map +1 -0
- package/dist/utils/lifecycles.d.ts +5 -0
- package/dist/utils/lifecycles.js +9 -0
- package/dist/utils/lifecycles.js.map +1 -0
- package/dist/utils/machine-id.d.ts +2 -0
- package/dist/utils/machine-id.js +15 -0
- package/dist/utils/machine-id.js.map +1 -0
- package/dist/utils/open-browser.d.ts +4 -0
- package/dist/utils/open-browser.js +13 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/postinstall.d.ts +1 -0
- package/dist/utils/postinstall.js +32 -0
- package/dist/utils/postinstall.js.map +1 -0
- package/dist/utils/signals.d.ts +2 -0
- package/dist/utils/signals.js +20 -0
- package/dist/utils/signals.js.map +1 -0
- package/dist/utils/startup-logger.d.ts +10 -0
- package/dist/utils/startup-logger.js +68 -0
- package/dist/utils/startup-logger.js.map +1 -0
- package/dist/utils/update-notifier/index.d.ts +8 -0
- package/dist/utils/update-notifier/index.js +85 -0
- package/dist/utils/update-notifier/index.js.map +1 -0
- package/index.js +5 -0
- package/package.json +59 -27
- package/scripts/postinstall.js +7 -0
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -4
- package/ee/LICENSE.txt +0 -1
- package/ee/index.js +0 -213
- package/ee/license.js +0 -109
- package/lib/Strapi.js +0 -591
- package/lib/commands/actions/admin/create-user/action.js +0 -113
- package/lib/commands/actions/admin/create-user/command.js +0 -19
- package/lib/commands/actions/admin/reset-user-password/action.js +0 -52
- package/lib/commands/actions/admin/reset-user-password/command.js +0 -17
- package/lib/commands/actions/build-command/action.js +0 -18
- package/lib/commands/actions/build-command/command.js +0 -15
- package/lib/commands/actions/components/list/action.js +0 -23
- package/lib/commands/actions/components/list/command.js +0 -14
- package/lib/commands/actions/configuration/dump/action.js +0 -51
- package/lib/commands/actions/configuration/dump/command.js +0 -17
- package/lib/commands/actions/configuration/restore/action.js +0 -172
- package/lib/commands/actions/configuration/restore/command.js +0 -17
- package/lib/commands/actions/console/action.js +0 -27
- package/lib/commands/actions/console/command.js +0 -14
- package/lib/commands/actions/content-types/list/action.js +0 -23
- package/lib/commands/actions/content-types/list/command.js +0 -14
- package/lib/commands/actions/controllers/list/action.js +0 -23
- package/lib/commands/actions/controllers/list/command.js +0 -14
- package/lib/commands/actions/develop/action.js +0 -217
- package/lib/commands/actions/develop/command.js +0 -19
- package/lib/commands/actions/export/action.js +0 -184
- package/lib/commands/actions/export/command.js +0 -45
- package/lib/commands/actions/generate/command.js +0 -18
- package/lib/commands/actions/hooks/list/action.js +0 -23
- package/lib/commands/actions/hooks/list/command.js +0 -14
- package/lib/commands/actions/import/action.js +0 -181
- package/lib/commands/actions/import/command.js +0 -97
- package/lib/commands/actions/install/action.js +0 -48
- package/lib/commands/actions/install/command.js +0 -14
- package/lib/commands/actions/middlewares/list/action.js +0 -23
- package/lib/commands/actions/middlewares/list/command.js +0 -14
- package/lib/commands/actions/new/action.js +0 -13
- package/lib/commands/actions/new/command.js +0 -35
- package/lib/commands/actions/plugin/build-command/action.js +0 -137
- package/lib/commands/actions/plugin/build-command/command.js +0 -17
- package/lib/commands/actions/policies/list/action.js +0 -23
- package/lib/commands/actions/policies/list/command.js +0 -14
- package/lib/commands/actions/report/action.js +0 -35
- package/lib/commands/actions/report/command.js +0 -17
- package/lib/commands/actions/routes/list/action.js +0 -29
- package/lib/commands/actions/routes/list/command.js +0 -14
- package/lib/commands/actions/services/list/action.js +0 -23
- package/lib/commands/actions/services/list/command.js +0 -14
- package/lib/commands/actions/start/action.js +0 -25
- package/lib/commands/actions/start/command.js +0 -14
- package/lib/commands/actions/telemetry/disable/action.js +0 -88
- package/lib/commands/actions/telemetry/disable/command.js +0 -14
- package/lib/commands/actions/telemetry/enable/action.js +0 -104
- package/lib/commands/actions/telemetry/enable/command.js +0 -14
- package/lib/commands/actions/templates/generate/action.js +0 -96
- package/lib/commands/actions/templates/generate/command.js +0 -14
- package/lib/commands/actions/transfer/action.js +0 -200
- package/lib/commands/actions/transfer/command.js +0 -115
- package/lib/commands/actions/ts/generate-types/action.js +0 -29
- package/lib/commands/actions/ts/generate-types/command.js +0 -21
- package/lib/commands/actions/uninstall/action.js +0 -68
- package/lib/commands/actions/uninstall/command.js +0 -15
- package/lib/commands/actions/version/command.js +0 -19
- package/lib/commands/actions/watch-admin/action.js +0 -40
- package/lib/commands/actions/watch-admin/command.js +0 -15
- package/lib/commands/builders/admin.js +0 -57
- package/lib/commands/builders/index.js +0 -9
- package/lib/commands/builders/packages.js +0 -252
- package/lib/commands/builders/tasks/dts.js +0 -199
- package/lib/commands/builders/tasks/index.js +0 -29
- package/lib/commands/builders/tasks/vite.js +0 -144
- package/lib/commands/builders/typescript.js +0 -32
- package/lib/commands/index.js +0 -68
- package/lib/commands/utils/commander.js +0 -157
- package/lib/commands/utils/data-transfer.js +0 -427
- package/lib/commands/utils/helpers.js +0 -218
- package/lib/commands/utils/logger.js +0 -97
- package/lib/commands/utils/pkg.js +0 -421
- package/lib/compile.js +0 -20
- package/lib/container.js +0 -45
- package/lib/core/app-configuration/config-loader.js +0 -22
- package/lib/core/app-configuration/index.js +0 -61
- package/lib/core/app-configuration/load-config-file.js +0 -43
- package/lib/core/bootstrap.js +0 -33
- package/lib/core/domain/component/index.js +0 -24
- package/lib/core/domain/component/validator.js +0 -23
- package/lib/core/domain/content-type/index.js +0 -134
- package/lib/core/domain/content-type/validator.js +0 -105
- package/lib/core/domain/module/index.js +0 -108
- package/lib/core/domain/module/validation.js +0 -32
- package/lib/core/loaders/admin.js +0 -16
- package/lib/core/loaders/apis.js +0 -161
- package/lib/core/loaders/components.js +0 -42
- package/lib/core/loaders/index.js +0 -13
- package/lib/core/loaders/middlewares.js +0 -37
- package/lib/core/loaders/plugins/get-enabled-plugins.js +0 -151
- package/lib/core/loaders/plugins/get-user-plugins-config.js +0 -37
- package/lib/core/loaders/plugins/index.js +0 -121
- package/lib/core/loaders/policies.js +0 -29
- package/lib/core/loaders/sanitizers.js +0 -5
- package/lib/core/loaders/src-index.js +0 -39
- package/lib/core/loaders/validators.js +0 -5
- package/lib/core/registries/apis.js +0 -29
- package/lib/core/registries/config.js +0 -21
- package/lib/core/registries/content-types.js +0 -97
- package/lib/core/registries/controllers.d.ts +0 -7
- package/lib/core/registries/controllers.js +0 -114
- package/lib/core/registries/custom-fields.js +0 -89
- package/lib/core/registries/hooks.d.ts +0 -17
- package/lib/core/registries/hooks.js +0 -87
- package/lib/core/registries/middlewares.d.ts +0 -5
- package/lib/core/registries/middlewares.js +0 -89
- package/lib/core/registries/modules.js +0 -44
- package/lib/core/registries/plugins.js +0 -28
- package/lib/core/registries/policies.d.ts +0 -13
- package/lib/core/registries/policies.js +0 -89
- package/lib/core/registries/sanitizers.js +0 -26
- package/lib/core/registries/services.js +0 -114
- package/lib/core/registries/validators.js +0 -26
- package/lib/core/utils.js +0 -32
- package/lib/core-api/controller/collection-type.js +0 -115
- package/lib/core-api/controller/index.js +0 -63
- package/lib/core-api/controller/single-type.js +0 -65
- package/lib/core-api/controller/transform.js +0 -97
- package/lib/core-api/routes/index.js +0 -71
- package/lib/core-api/service/collection-type.js +0 -80
- package/lib/core-api/service/index.js +0 -45
- package/lib/core-api/service/pagination.js +0 -125
- package/lib/core-api/service/single-type.js +0 -72
- package/lib/factories.d.ts +0 -18
- package/lib/factories.js +0 -93
- package/lib/global.d.ts +0 -22
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -8
- package/lib/load/filepath-to-prop-path.js +0 -22
- package/lib/load/glob.js +0 -15
- package/lib/load/index.js +0 -9
- package/lib/load/load-files.js +0 -58
- package/lib/load/package-path.js +0 -9
- package/lib/middlewares/body.js +0 -82
- package/lib/middlewares/compression.js +0 -8
- package/lib/middlewares/cors.js +0 -59
- package/lib/middlewares/errors.js +0 -40
- package/lib/middlewares/favicon.js +0 -32
- package/lib/middlewares/index.d.ts +0 -5
- package/lib/middlewares/index.js +0 -33
- package/lib/middlewares/ip.js +0 -8
- package/lib/middlewares/logger.js +0 -14
- package/lib/middlewares/powered-by.js +0 -20
- package/lib/middlewares/public/index.js +0 -94
- package/lib/middlewares/public/serve-static.js +0 -23
- package/lib/middlewares/query.js +0 -52
- package/lib/middlewares/response-time.js +0 -15
- package/lib/middlewares/responses.js +0 -19
- package/lib/middlewares/security.js +0 -57
- package/lib/middlewares/session.js +0 -30
- package/lib/migrations/draft-publish.js +0 -53
- package/lib/services/auth/index.js +0 -109
- package/lib/services/content-api/index.js +0 -74
- package/lib/services/content-api/permissions/engine.js +0 -5
- package/lib/services/content-api/permissions/index.js +0 -148
- package/lib/services/content-api/permissions/providers/action.js +0 -19
- package/lib/services/content-api/permissions/providers/condition.js +0 -19
- package/lib/services/content-api/permissions/providers/index.js +0 -9
- package/lib/services/core-store.js +0 -145
- package/lib/services/cron.js +0 -71
- package/lib/services/custom-fields.js +0 -11
- package/lib/services/entity-service/attributes/index.js +0 -31
- package/lib/services/entity-service/attributes/transforms.js +0 -20
- package/lib/services/entity-service/components.js +0 -497
- package/lib/services/entity-service/index.d.ts +0 -1
- package/lib/services/entity-service/index.js +0 -434
- package/lib/services/entity-service/params.js +0 -9
- package/lib/services/entity-service/types/index.d.ts +0 -228
- package/lib/services/entity-service/types/params/attributes.d.ts +0 -146
- package/lib/services/entity-service/types/params/data.d.ts +0 -4
- package/lib/services/entity-service/types/params/fields.d.ts +0 -74
- package/lib/services/entity-service/types/params/filters/index.d.ts +0 -75
- package/lib/services/entity-service/types/params/filters/operators.d.ts +0 -30
- package/lib/services/entity-service/types/params/index.d.ts +0 -79
- package/lib/services/entity-service/types/params/pagination.d.ts +0 -13
- package/lib/services/entity-service/types/params/populate.d.ts +0 -130
- package/lib/services/entity-service/types/params/publication-state.d.ts +0 -38
- package/lib/services/entity-service/types/params/search.d.ts +0 -1
- package/lib/services/entity-service/types/params/sort.d.ts +0 -106
- package/lib/services/entity-service/types/plugin.d.ts +0 -11
- package/lib/services/entity-service/types/result.d.ts +0 -205
- package/lib/services/entity-validator/index.js +0 -382
- package/lib/services/entity-validator/validators.js +0 -216
- package/lib/services/errors.js +0 -87
- package/lib/services/event-hub.js +0 -83
- package/lib/services/fs.js +0 -58
- package/lib/services/metrics/admin-user-hash.js +0 -21
- package/lib/services/metrics/index.js +0 -61
- package/lib/services/metrics/is-truthy.js +0 -9
- package/lib/services/metrics/middleware.js +0 -33
- package/lib/services/metrics/rate-limiter.js +0 -27
- package/lib/services/metrics/sender.js +0 -90
- package/lib/services/metrics/stringify-deep.js +0 -22
- package/lib/services/request-context.js +0 -17
- package/lib/services/server/admin-api.js +0 -14
- package/lib/services/server/api.js +0 -36
- package/lib/services/server/compose-endpoint.js +0 -141
- package/lib/services/server/content-api.js +0 -16
- package/lib/services/server/http-server.js +0 -64
- package/lib/services/server/index.js +0 -129
- package/lib/services/server/koa.js +0 -62
- package/lib/services/server/middleware.js +0 -132
- package/lib/services/server/policy.js +0 -32
- package/lib/services/server/register-middlewares.js +0 -109
- package/lib/services/server/register-routes.js +0 -105
- package/lib/services/server/routing.js +0 -105
- package/lib/services/utils/dynamic-zones.js +0 -13
- package/lib/services/utils/upload-files.js +0 -79
- package/lib/services/webhook-runner.js +0 -156
- package/lib/services/webhook-store.js +0 -120
- package/lib/services/worker-queue.js +0 -59
- package/lib/types/core/attributes/base.d.ts +0 -77
- package/lib/types/core/attributes/biginteger.d.ts +0 -15
- package/lib/types/core/attributes/boolean.d.ts +0 -14
- package/lib/types/core/attributes/common.d.ts +0 -77
- package/lib/types/core/attributes/component.d.ts +0 -36
- package/lib/types/core/attributes/date-time.d.ts +0 -16
- package/lib/types/core/attributes/date.d.ts +0 -13
- package/lib/types/core/attributes/decimal.d.ts +0 -15
- package/lib/types/core/attributes/dynamic-zone.d.ts +0 -29
- package/lib/types/core/attributes/email.d.ts +0 -14
- package/lib/types/core/attributes/enumeration.d.ts +0 -18
- package/lib/types/core/attributes/float.d.ts +0 -13
- package/lib/types/core/attributes/index.d.ts +0 -26
- package/lib/types/core/attributes/integer.d.ts +0 -15
- package/lib/types/core/attributes/json.d.ts +0 -11
- package/lib/types/core/attributes/media.d.ts +0 -42
- package/lib/types/core/attributes/password.d.ts +0 -15
- package/lib/types/core/attributes/relation.d.ts +0 -152
- package/lib/types/core/attributes/richtext.d.ts +0 -15
- package/lib/types/core/attributes/string.d.ts +0 -20
- package/lib/types/core/attributes/text.d.ts +0 -20
- package/lib/types/core/attributes/time.d.ts +0 -13
- package/lib/types/core/attributes/timestamp.d.ts +0 -15
- package/lib/types/core/attributes/uid.d.ts +0 -43
- package/lib/types/core/attributes/utils.d.ts +0 -143
- package/lib/types/core/commands/index.d.ts +0 -6
- package/lib/types/core/common/controller.d.ts +0 -8
- package/lib/types/core/common/index.d.ts +0 -16
- package/lib/types/core/common/schema.d.ts +0 -3
- package/lib/types/core/common/service.d.ts +0 -5
- package/lib/types/core/common/uid.d.ts +0 -58
- package/lib/types/core/index.d.ts +0 -9
- package/lib/types/core/namespace.d.ts +0 -99
- package/lib/types/core/plugins/index.d.ts +0 -16
- package/lib/types/core/registry.d.ts +0 -68
- package/lib/types/core/schemas/index.d.ts +0 -133
- package/lib/types/core/strapi/index.d.ts +0 -453
- package/lib/types/core/uid.d.ts +0 -167
- package/lib/types/core-api/controller.d.ts +0 -54
- package/lib/types/core-api/index.d.ts +0 -3
- package/lib/types/core-api/router.d.ts +0 -68
- package/lib/types/core-api/service.d.ts +0 -50
- package/lib/types/index.d.ts +0 -8
- package/lib/types/shared/entity-service.d.ts +0 -1
- package/lib/types/shared/index.d.ts +0 -3
- package/lib/types/shared/plugins.d.ts +0 -3
- package/lib/types/shared/registries.d.ts +0 -45
- package/lib/types/utils/array.d.ts +0 -25
- package/lib/types/utils/expression.d.ts +0 -91
- package/lib/types/utils/guard.d.ts +0 -27
- package/lib/types/utils/index.d.ts +0 -27
- package/lib/types/utils/object.d.ts +0 -63
- package/lib/types/utils/string.d.ts +0 -59
- package/lib/types/utils/tuple.d.ts +0 -13
- package/lib/utils/addSlash.js +0 -11
- package/lib/utils/convert-custom-field-type.js +0 -22
- package/lib/utils/cron.js +0 -56
- package/lib/utils/ee.js +0 -3
- package/lib/utils/fetch.js +0 -23
- package/lib/utils/get-dirs.js +0 -31
- package/lib/utils/index.js +0 -11
- package/lib/utils/is-initialized.js +0 -23
- package/lib/utils/lifecycles.js +0 -15
- package/lib/utils/machine-id.js +0 -14
- package/lib/utils/open-browser.js +0 -12
- package/lib/utils/run-checks.js +0 -22
- package/lib/utils/signals.js +0 -24
- package/lib/utils/startup-logger.js +0 -88
- package/lib/utils/success.js +0 -35
- package/lib/utils/update-notifier/index.js +0 -97
- package/lib/utils/url-from-segments.js +0 -12
- /package/{lib → dist}/middlewares/public/assets/images/group_people_1.png +0 -0
- /package/{lib → dist}/middlewares/public/assets/images/group_people_2.png +0 -0
- /package/{lib → dist}/middlewares/public/assets/images/group_people_3.png +0 -0
- /package/{lib → dist}/middlewares/public/assets/images/logo_login.png +0 -0
- /package/{lib → dist}/middlewares/public/index.html +0 -0
- /package/{ee/resources → resources}/key.pub +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { Common } from '@strapi/types';
|
|
3
|
+
type PolicyExtendFn = (policy: Common.Policy) => Common.Policy;
|
|
4
|
+
type PolicyMap = Record<string, Common.Policy>;
|
|
5
|
+
declare const policiesRegistry: () => {
|
|
6
|
+
/**
|
|
7
|
+
* Returns this list of registered policies uids
|
|
8
|
+
*/
|
|
9
|
+
keys(): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Returns the instance of a policy. Instantiate the policy if not already done
|
|
12
|
+
*/
|
|
13
|
+
get(uid: Common.UID.Policy): Common.Policy<unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a map with all the policies in a namespace
|
|
16
|
+
*/
|
|
17
|
+
getAll(namespace: string): import("lodash").Dictionary<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Registers a policy
|
|
20
|
+
*/
|
|
21
|
+
set(uid: string, policy: Common.Policy): any;
|
|
22
|
+
/**
|
|
23
|
+
* Registers a map of policies for a specific namespace
|
|
24
|
+
*/
|
|
25
|
+
add(namespace: string, newPolicies: PolicyMap): void;
|
|
26
|
+
/**
|
|
27
|
+
* Wraps a policy to extend it
|
|
28
|
+
* @param {string} uid
|
|
29
|
+
* @param {(policy: Policy) => Policy} extendFn
|
|
30
|
+
*/
|
|
31
|
+
extend(uid: Common.UID.Policy, extendFn: PolicyExtendFn): any;
|
|
32
|
+
};
|
|
33
|
+
export default policiesRegistry;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fp_1 = require("lodash/fp");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
// TODO: move instantiation part here instead of in the policy utils
|
|
6
|
+
const policiesRegistry = () => {
|
|
7
|
+
const policies = {};
|
|
8
|
+
return {
|
|
9
|
+
/**
|
|
10
|
+
* Returns this list of registered policies uids
|
|
11
|
+
*/
|
|
12
|
+
keys() {
|
|
13
|
+
return Object.keys(policies);
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Returns the instance of a policy. Instantiate the policy if not already done
|
|
17
|
+
*/
|
|
18
|
+
get(uid) {
|
|
19
|
+
return policies[uid];
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Returns a map with all the policies in a namespace
|
|
23
|
+
*/
|
|
24
|
+
getAll(namespace) {
|
|
25
|
+
return (0, fp_1.pickBy)((_, uid) => (0, utils_1.hasNamespace)(uid, namespace))(policies);
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Registers a policy
|
|
29
|
+
*/
|
|
30
|
+
set(uid, policy) {
|
|
31
|
+
policies[uid] = policy;
|
|
32
|
+
return this;
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Registers a map of policies for a specific namespace
|
|
36
|
+
*/
|
|
37
|
+
add(namespace, newPolicies) {
|
|
38
|
+
for (const policyName of Object.keys(newPolicies)) {
|
|
39
|
+
const policy = newPolicies[policyName];
|
|
40
|
+
const uid = (0, utils_1.addNamespace)(policyName, namespace);
|
|
41
|
+
if ((0, fp_1.has)(uid, policies)) {
|
|
42
|
+
throw new Error(`Policy ${uid} has already been registered.`);
|
|
43
|
+
}
|
|
44
|
+
policies[uid] = policy;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Wraps a policy to extend it
|
|
49
|
+
* @param {string} uid
|
|
50
|
+
* @param {(policy: Policy) => Policy} extendFn
|
|
51
|
+
*/
|
|
52
|
+
extend(uid, extendFn) {
|
|
53
|
+
const currentPolicy = this.get(uid);
|
|
54
|
+
if (!currentPolicy) {
|
|
55
|
+
throw new Error(`Policy ${uid} doesn't exist`);
|
|
56
|
+
}
|
|
57
|
+
const newPolicy = extendFn(currentPolicy);
|
|
58
|
+
policies[uid] = newPolicy;
|
|
59
|
+
return this;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.default = policiesRegistry;
|
|
64
|
+
//# sourceMappingURL=policies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/core/registries/policies.ts"],"names":[],"mappings":";;AAAA,kCAAwC;AAExC,oCAAsD;AAKtD,oEAAoE;AACpE,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC5B,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,OAAO;QACL;;WAEG;QACH,IAAI;YACF,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QAED;;WAEG;QACH,GAAG,CAAC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C;AAEF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropertyName } from 'lodash';
|
|
2
|
+
type Sanitizer = (value: unknown) => unknown;
|
|
3
|
+
declare const sanitizersRegistry: () => {
|
|
4
|
+
get(path: PropertyName): Sanitizer[];
|
|
5
|
+
add(path: PropertyName, sanitizer: Sanitizer): any;
|
|
6
|
+
set(path: PropertyName, value?: never[]): any;
|
|
7
|
+
has(path: PropertyName): boolean;
|
|
8
|
+
};
|
|
9
|
+
export default sanitizersRegistry;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
+
const sanitizersRegistry = () => {
|
|
8
|
+
const sanitizers = {};
|
|
9
|
+
return {
|
|
10
|
+
get(path) {
|
|
11
|
+
return lodash_1.default.get(sanitizers, path, []);
|
|
12
|
+
},
|
|
13
|
+
add(path, sanitizer) {
|
|
14
|
+
this.get(path).push(sanitizer);
|
|
15
|
+
return this;
|
|
16
|
+
},
|
|
17
|
+
set(path, value = []) {
|
|
18
|
+
lodash_1.default.set(sanitizers, path, value);
|
|
19
|
+
return this;
|
|
20
|
+
},
|
|
21
|
+
has(path) {
|
|
22
|
+
return lodash_1.default.has(sanitizers, path);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.default = sanitizersRegistry;
|
|
27
|
+
//# sourceMappingURL=sanitizers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizers.js","sourceRoot":"","sources":["../../../src/core/registries/sanitizers.ts"],"names":[],"mappings":";;;;;AAAA,oDAAyC;AAIzC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,MAAM,UAAU,GAAgC,EAAE,CAAC;IAEnD,OAAO;QACL,GAAG,CAAC,IAAkB;YACpB,OAAO,gBAAC,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,GAAG,CAAC,IAAkB,EAAE,SAAoB;YAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,GAAG,CAAC,IAAkB,EAAE,KAAK,GAAG,EAAE;YAChC,gBAAC,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,GAAG,CAAC,IAAkB;YACpB,OAAO,gBAAC,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Strapi, Common } from '@strapi/types';
|
|
2
|
+
export type ServiceFactory = (params: {
|
|
3
|
+
strapi: Strapi;
|
|
4
|
+
}) => Common.Service | Common.Service;
|
|
5
|
+
export type ServiceFactoryMap = Record<string, ServiceFactory>;
|
|
6
|
+
export type ServiceMap = Record<string, Common.Service>;
|
|
7
|
+
export type ServiceExtendFn = (service: Common.Service) => Common.Service;
|
|
8
|
+
declare const servicesRegistry: (strapi: Strapi) => {
|
|
9
|
+
/**
|
|
10
|
+
* Returns this list of registered services uids
|
|
11
|
+
*/
|
|
12
|
+
keys(): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Returns the instance of a service. Instantiate the service if not already done
|
|
15
|
+
*/
|
|
16
|
+
get(uid: Common.UID.Service): Common.Service | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a map with all the services in a namespace
|
|
19
|
+
*/
|
|
20
|
+
getAll(namespace: string): ServiceMap;
|
|
21
|
+
/**
|
|
22
|
+
* Registers a service
|
|
23
|
+
*/
|
|
24
|
+
set(uid: string, service: ServiceFactory): any;
|
|
25
|
+
/**
|
|
26
|
+
* Registers a map of services for a specific namespace
|
|
27
|
+
*/
|
|
28
|
+
add(namespace: string, newServices: ServiceFactoryMap): any;
|
|
29
|
+
/**
|
|
30
|
+
* Wraps a service to extend it
|
|
31
|
+
*/
|
|
32
|
+
extend(uid: Common.UID.Service, extendFn: ServiceExtendFn): any;
|
|
33
|
+
};
|
|
34
|
+
export default servicesRegistry;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fp_1 = require("lodash/fp");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const servicesRegistry = (strapi) => {
|
|
6
|
+
const services = {};
|
|
7
|
+
const instantiatedServices = {};
|
|
8
|
+
return {
|
|
9
|
+
/**
|
|
10
|
+
* Returns this list of registered services uids
|
|
11
|
+
*/
|
|
12
|
+
keys() {
|
|
13
|
+
return Object.keys(services);
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Returns the instance of a service. Instantiate the service if not already done
|
|
17
|
+
*/
|
|
18
|
+
get(uid) {
|
|
19
|
+
if (instantiatedServices[uid]) {
|
|
20
|
+
return instantiatedServices[uid];
|
|
21
|
+
}
|
|
22
|
+
const service = services[uid];
|
|
23
|
+
if (service) {
|
|
24
|
+
instantiatedServices[uid] = typeof service === 'function' ? service({ strapi }) : service;
|
|
25
|
+
return instantiatedServices[uid];
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Returns a map with all the services in a namespace
|
|
30
|
+
*/
|
|
31
|
+
getAll(namespace) {
|
|
32
|
+
const filteredServices = (0, fp_1.pickBy)((_, uid) => (0, utils_1.hasNamespace)(uid, namespace))(services);
|
|
33
|
+
// create lazy accessor to avoid instantiating the services;
|
|
34
|
+
const map = {};
|
|
35
|
+
for (const uid of Object.keys(filteredServices)) {
|
|
36
|
+
Object.defineProperty(map, uid, {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: () => {
|
|
39
|
+
return this.get(uid);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return map;
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Registers a service
|
|
47
|
+
*/
|
|
48
|
+
set(uid, service) {
|
|
49
|
+
services[uid] = service;
|
|
50
|
+
delete instantiatedServices[uid];
|
|
51
|
+
return this;
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Registers a map of services for a specific namespace
|
|
55
|
+
*/
|
|
56
|
+
add(namespace, newServices) {
|
|
57
|
+
for (const serviceName of Object.keys(newServices)) {
|
|
58
|
+
const service = newServices[serviceName];
|
|
59
|
+
const uid = (0, utils_1.addNamespace)(serviceName, namespace);
|
|
60
|
+
if ((0, fp_1.has)(uid, services)) {
|
|
61
|
+
throw new Error(`Service ${uid} has already been registered.`);
|
|
62
|
+
}
|
|
63
|
+
services[uid] = service;
|
|
64
|
+
}
|
|
65
|
+
return this;
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* Wraps a service to extend it
|
|
69
|
+
*/
|
|
70
|
+
extend(uid, extendFn) {
|
|
71
|
+
const currentService = this.get(uid);
|
|
72
|
+
if (!currentService) {
|
|
73
|
+
throw new Error(`Service ${uid} doesn't exist`);
|
|
74
|
+
}
|
|
75
|
+
const newService = extendFn(currentService);
|
|
76
|
+
instantiatedServices[uid] = newService;
|
|
77
|
+
return this;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
exports.default = servicesRegistry;
|
|
82
|
+
//# sourceMappingURL=services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/core/registries/services.ts"],"names":[],"mappings":";;AAAA,kC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QACb,CAAC;QAED;;WAEG;QACH,GAAG,CAAC,GAAW,EAAE,OAAuB;YACtC,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;YACxB,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;WAEG;QACH,GAAG,CAAC,SAAiB,EAAE,WAA8B;YACnD,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;gBAClD,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;gBACzC,MAAM,GAAG,GAAG,IAAA,oBAAY,EAAC,WAAW,EAAE,SAAS,CAAC,CAAC;gBAEjD,IAAI,IAAA,QAAG,EAAC,GAAG,EAAE,QAAQ,CAAC,EAAE;oBACtB,MAAM,IAAI,KAAK,CAAC,WAAW,GAAG,+BAA+B,CAAC,CAAC;iBAChE;gBACD,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;aACzB;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;WAEG;QACH,MAAM,CAAC,GAAuB,EAAE,QAAyB;YACvD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAErC,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,KAAK,CAAC,WAAW,GAAG,gBAAgB,CAAC,CAAC;aACjD;YAED,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC5C,oBAAoB,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YAEvC,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropertyName } from 'lodash';
|
|
2
|
+
type Validator = unknown;
|
|
3
|
+
declare const validatorsRegistry: () => {
|
|
4
|
+
get(path: PropertyName): Validator[];
|
|
5
|
+
add(path: PropertyName, validator: Validator): any;
|
|
6
|
+
set(path: PropertyName, value?: never[]): any;
|
|
7
|
+
has(path: PropertyName): boolean;
|
|
8
|
+
};
|
|
9
|
+
export default validatorsRegistry;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
+
const validatorsRegistry = () => {
|
|
8
|
+
const validators = {};
|
|
9
|
+
return {
|
|
10
|
+
get(path) {
|
|
11
|
+
return lodash_1.default.get(validators, path, []);
|
|
12
|
+
},
|
|
13
|
+
add(path, validator) {
|
|
14
|
+
this.get(path).push(validator);
|
|
15
|
+
return this;
|
|
16
|
+
},
|
|
17
|
+
set(path, value = []) {
|
|
18
|
+
lodash_1.default.set(validators, path, value);
|
|
19
|
+
return this;
|
|
20
|
+
},
|
|
21
|
+
has(path) {
|
|
22
|
+
return lodash_1.default.has(validators, path);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.default = validatorsRegistry;
|
|
27
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/core/registries/validators.ts"],"names":[],"mappings":";;;;;AAAA,oDAAyC;AAIzC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,MAAM,UAAU,GAAgC,EAAE,CAAC;IAEnD,OAAO;QACL,GAAG,CAAC,IAAkB;YACpB,OAAO,gBAAC,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,GAAG,CAAC,IAAkB,EAAE,SAAoB;YAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,GAAG,CAAC,IAAkB,EAAE,KAAK,GAAG,EAAE;YAChC,gBAAC,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,GAAG,CAAC,IAAkB;YACpB,OAAO,gBAAC,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const hasNamespace: (name: string, namespace: string) => boolean;
|
|
2
|
+
declare const addNamespace: (name: string, namespace: string) => string;
|
|
3
|
+
declare const removeNamespace: (name: string, namespace: string) => string;
|
|
4
|
+
export { addNamespace, removeNamespace, hasNamespace };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasNamespace = exports.removeNamespace = exports.addNamespace = void 0;
|
|
4
|
+
const hasNamespace = (name, namespace) => {
|
|
5
|
+
if (!namespace) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (namespace.endsWith('::')) {
|
|
9
|
+
return name.startsWith(namespace);
|
|
10
|
+
}
|
|
11
|
+
return name.startsWith(`${namespace}.`);
|
|
12
|
+
};
|
|
13
|
+
exports.hasNamespace = hasNamespace;
|
|
14
|
+
const addNamespace = (name, namespace) => {
|
|
15
|
+
if (namespace.endsWith('::')) {
|
|
16
|
+
return `${namespace}${name}`;
|
|
17
|
+
}
|
|
18
|
+
return `${namespace}.${name}`;
|
|
19
|
+
};
|
|
20
|
+
exports.addNamespace = addNamespace;
|
|
21
|
+
const removeNamespace = (name, namespace) => {
|
|
22
|
+
if (namespace.endsWith('::')) {
|
|
23
|
+
return name.replace(namespace, '');
|
|
24
|
+
}
|
|
25
|
+
return name.replace(`${namespace}.`, '');
|
|
26
|
+
};
|
|
27
|
+
exports.removeNamespace = removeNamespace;
|
|
28
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/core/utils.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,SAAiB,EAAE,EAAE;IACvD,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,IAAI,CAAC;KACb;IAED,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;KACnC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC;AAgBsC,oCAAY;AAdpD,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,SAAiB,EAAE,EAAE;IACvD,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,CAAC;KAC9B;IACD,OAAO,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;AAChC,CAAC,CAAC;AASO,oCAAY;AAPrB,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,SAAiB,EAAE,EAAE;IAC1D,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;KACpC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEqB,0CAAe"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CoreApi, Schema, Utils } from '@strapi/types';
|
|
2
|
+
interface Options {
|
|
3
|
+
contentType: Schema.CollectionType;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* Returns a collection type controller to handle default core-api actions
|
|
8
|
+
*/
|
|
9
|
+
declare const createCollectionTypeController: ({ contentType, }: Options) => Utils.PartialWithThis<CoreApi.Controller.CollectionType>;
|
|
10
|
+
export default createCollectionTypeController;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fp_1 = require("lodash/fp");
|
|
4
|
+
const utils_1 = require("@strapi/utils");
|
|
5
|
+
const transform_1 = require("./transform");
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Returns a collection type controller to handle default core-api actions
|
|
9
|
+
*/
|
|
10
|
+
const createCollectionTypeController = ({ contentType, }) => {
|
|
11
|
+
const uid = contentType.uid;
|
|
12
|
+
return {
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve records.
|
|
15
|
+
*/
|
|
16
|
+
async find(ctx) {
|
|
17
|
+
await this.validateQuery(ctx);
|
|
18
|
+
const sanitizedQuery = await this.sanitizeQuery(ctx);
|
|
19
|
+
const { results, pagination } = await strapi.service(uid).find(sanitizedQuery);
|
|
20
|
+
const sanitizedResults = await this.sanitizeOutput(results, ctx);
|
|
21
|
+
return this.transformResponse(sanitizedResults, { pagination });
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve a record.
|
|
25
|
+
*
|
|
26
|
+
* @return {Object}
|
|
27
|
+
*/
|
|
28
|
+
async findOne(ctx) {
|
|
29
|
+
const { id } = ctx.params;
|
|
30
|
+
await this.validateQuery(ctx);
|
|
31
|
+
const sanitizedQuery = await this.sanitizeQuery(ctx);
|
|
32
|
+
const entity = await strapi.service(uid).findOne(id, sanitizedQuery);
|
|
33
|
+
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
|
|
34
|
+
return this.transformResponse(sanitizedEntity);
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Create a record.
|
|
38
|
+
*
|
|
39
|
+
* @return {Object}
|
|
40
|
+
*/
|
|
41
|
+
async create(ctx) {
|
|
42
|
+
await this.validateQuery(ctx);
|
|
43
|
+
const sanitizedQuery = await this.sanitizeQuery(ctx);
|
|
44
|
+
const body = (0, transform_1.parseBody)(ctx);
|
|
45
|
+
if (!(0, fp_1.isObject)(body.data)) {
|
|
46
|
+
throw new utils_1.errors.ValidationError('Missing "data" payload in the request body');
|
|
47
|
+
}
|
|
48
|
+
const sanitizedInputData = await this.sanitizeInput(body.data, ctx);
|
|
49
|
+
const entity = await strapi.service(uid).create({
|
|
50
|
+
...sanitizedQuery,
|
|
51
|
+
data: sanitizedInputData,
|
|
52
|
+
files: 'files' in body ? body.files : undefined,
|
|
53
|
+
});
|
|
54
|
+
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
|
|
55
|
+
return this.transformResponse(sanitizedEntity);
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Update a record.
|
|
59
|
+
*
|
|
60
|
+
* @return {Object}
|
|
61
|
+
*/
|
|
62
|
+
async update(ctx) {
|
|
63
|
+
const { id } = ctx.params;
|
|
64
|
+
await this.validateQuery(ctx);
|
|
65
|
+
const sanitizedQuery = await this.sanitizeQuery(ctx);
|
|
66
|
+
const body = (0, transform_1.parseBody)(ctx);
|
|
67
|
+
if (!(0, fp_1.isObject)(body.data)) {
|
|
68
|
+
throw new utils_1.errors.ValidationError('Missing "data" payload in the request body');
|
|
69
|
+
}
|
|
70
|
+
const sanitizedInputData = await this.sanitizeInput(body.data, ctx);
|
|
71
|
+
const entity = await strapi.service(uid).update(id, {
|
|
72
|
+
...sanitizedQuery,
|
|
73
|
+
data: sanitizedInputData,
|
|
74
|
+
files: 'files' in body ? body.files : undefined,
|
|
75
|
+
});
|
|
76
|
+
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
|
|
77
|
+
return this.transformResponse(sanitizedEntity);
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Destroy a record.
|
|
81
|
+
*
|
|
82
|
+
* @return {Object}
|
|
83
|
+
*/
|
|
84
|
+
async delete(ctx) {
|
|
85
|
+
const { id } = ctx.params;
|
|
86
|
+
await this.validateQuery(ctx);
|
|
87
|
+
const sanitizedQuery = await this.sanitizeQuery(ctx);
|
|
88
|
+
const entity = await strapi.service(uid).delete(id, sanitizedQuery);
|
|
89
|
+
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
|
|
90
|
+
return this.transformResponse(sanitizedEntity);
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
exports.default = createCollectionTypeController;
|
|
95
|
+
//# sourceMappingURL=collection-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-type.js","sourceRoot":"","sources":["../../../src/core-api/controller/collection-type.ts"],"names":[],"mappings":";;AAAA,kCAAqC;AACrC,yCAAuC;AAIvC,2CAAwC;AAMxC;;;GAGG;AACH,MAAM,8BAA8B,GAAG,CAAC,EACtC,WAAW,GACH,EAA4D,EAAE;IACtE,MAAM,GAAG,GAAG,WAAW,CAAC,GAAyB,CAAC;IAElD,OAAO;QACL;;WAEG;QACH,KAAK,CAAC,IAAI,CAAC,GAAG;YACZ,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAC9B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAErD,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC/E,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACjE,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;QA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IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAC9B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAErD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;YACpE,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAE/D,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CoreApi, Schema } from '@strapi/types';
|
|
2
|
+
declare function createController<T extends Schema.SingleType | Schema.CollectionType>(opts: {
|
|
3
|
+
contentType: T;
|
|
4
|
+
}): T extends Schema.SingleType ? CoreApi.Controller.SingleType : CoreApi.Controller.CollectionType;
|
|
5
|
+
export { createController };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createController = void 0;
|
|
7
|
+
const fp_1 = require("lodash/fp");
|
|
8
|
+
const utils_1 = require("@strapi/utils");
|
|
9
|
+
const transform_1 = require("./transform");
|
|
10
|
+
const single_type_1 = __importDefault(require("./single-type"));
|
|
11
|
+
const collection_type_1 = __importDefault(require("./collection-type"));
|
|
12
|
+
const isSingleType = (contentType) => utils_1.contentTypes.isSingleType(contentType);
|
|
13
|
+
const getAuthFromKoaContext = (ctx) => (0, fp_1.prop)('state.auth', ctx) ?? {};
|
|
14
|
+
function createController({ contentType, }) {
|
|
15
|
+
const proto = {
|
|
16
|
+
transformResponse(data, meta) {
|
|
17
|
+
return (0, transform_1.transformResponse)(data, meta, { contentType });
|
|
18
|
+
},
|
|
19
|
+
async sanitizeOutput(data, ctx) {
|
|
20
|
+
const auth = getAuthFromKoaContext(ctx);
|
|
21
|
+
return utils_1.sanitize.contentAPI.output(data, contentType, { auth });
|
|
22
|
+
},
|
|
23
|
+
async sanitizeInput(data, ctx) {
|
|
24
|
+
const auth = getAuthFromKoaContext(ctx);
|
|
25
|
+
return utils_1.sanitize.contentAPI.input(data, contentType, { auth });
|
|
26
|
+
},
|
|
27
|
+
async sanitizeQuery(ctx) {
|
|
28
|
+
const auth = getAuthFromKoaContext(ctx);
|
|
29
|
+
return utils_1.sanitize.contentAPI.query(ctx.query, contentType, { auth });
|
|
30
|
+
},
|
|
31
|
+
async validateQuery(ctx) {
|
|
32
|
+
const auth = getAuthFromKoaContext(ctx);
|
|
33
|
+
return utils_1.validate.contentAPI.query(ctx.query, contentType, { auth });
|
|
34
|
+
},
|
|
35
|
+
async validateInput(data, ctx) {
|
|
36
|
+
const auth = getAuthFromKoaContext(ctx);
|
|
37
|
+
return utils_1.validate.contentAPI.input(data, contentType, { auth });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
let ctrl;
|
|
41
|
+
if (isSingleType(contentType)) {
|
|
42
|
+
ctrl = (0, single_type_1.default)({ contentType });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
ctrl = (0, collection_type_1.default)({ contentType });
|
|
46
|
+
}
|
|
47
|
+
return Object.assign(Object.create(proto), ctrl);
|
|
48
|
+
}
|
|
49
|
+
exports.createController = createController;
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core-api/controller/index.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAiC;AAEjC,yCAAqF;AAGrF,2CAAgD;AAChD,gEAAuD;AACvD,wEAA+D;AAE/D,M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,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG;YAC3B,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;YAExC,OAAO,gBAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;IAEF,IAAI,IAAI,CAAC;IAET,IAAI,YAAY,CAAC,WAAW,CAAC,EAAE;QAC7B,IAAI,GAAG,IAAA,qBAA0B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;KACpD;SAAM;QACL,IAAI,GAAG,IAAA,yBAA8B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;KACxD;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC;AAEQ,4CAAgB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Schema, CoreApi, Utils } from '@strapi/types';
|
|
2
|
+
interface Options {
|
|
3
|
+
contentType: Schema.SingleType;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Returns a single type controller to handle default core-api actions
|
|
7
|
+
*/
|
|
8
|
+
declare const createSingleTypeController: ({ contentType, }: Options) => Utils.PartialWithThis<CoreApi.Controller.SingleType>;
|
|
9
|
+
export default createSingleTypeController;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fp_1 = require("lodash/fp");
|
|
4
|
+
const utils_1 = require("@strapi/utils");
|
|
5
|
+
const transform_1 = require("./transform");
|
|
6
|
+
/**
|
|
7
|
+
* Returns a single type controller to handle default core-api actions
|
|
8
|
+
*/
|
|
9
|
+
const createSingleTypeController = ({ contentType, }) => {
|
|
10
|
+
const uid = contentType.uid;
|
|
11
|
+
return {
|
|
12
|
+
/**
|
|
13
|
+
* Retrieve single type content
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
async find(ctx) {
|
|
17
|
+
await this.validateQuery(ctx);
|
|
18
|
+
const sanitizedQuery = await this.sanitizeQuery(ctx);
|
|
19
|
+
const entity = await strapi.service(uid).find(sanitizedQuery);
|
|
20
|
+
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
|
|
21
|
+
return this.transformResponse(sanitizedEntity);
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* create or update single type content.
|
|
25
|
+
*
|
|
26
|
+
* @return {Object}
|
|
27
|
+
*/
|
|
28
|
+
async update(ctx) {
|
|
29
|
+
const { query } = ctx.request;
|
|
30
|
+
const body = (0, transform_1.parseBody)(ctx);
|
|
31
|
+
if (!(0, fp_1.isObject)(body.data)) {
|
|
32
|
+
throw new utils_1.errors.ValidationError('Missing "data" payload in the request body');
|
|
33
|
+
}
|
|
34
|
+
const sanitizedInputData = await this.sanitizeInput(body.data, ctx);
|
|
35
|
+
const entity = await strapi.service(uid).createOrUpdate({
|
|
36
|
+
...query,
|
|
37
|
+
data: sanitizedInputData,
|
|
38
|
+
files: 'files' in body ? body.files : undefined,
|
|
39
|
+
});
|
|
40
|
+
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
|
|
41
|
+
return this.transformResponse(sanitizedEntity);
|
|
42
|
+
},
|
|
43
|
+
async delete(ctx) {
|
|
44
|
+
const { query } = ctx;
|
|
45
|
+
const entity = await strapi.service(uid).delete(query);
|
|
46
|
+
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
|
|
47
|
+
return this.transformResponse(sanitizedEntity);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.default = createSingleTypeController;
|
|
52
|
+
//# sourceMappingURL=single-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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AK,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aAChD,CAAC,CAAC;YAEH,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAE/D,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QACjD,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,GAAG;YACd,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;YAEtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAE/D,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="formidable" />
|
|
2
|
+
import type Koa from 'koa';
|
|
3
|
+
import type { Schema } from '@strapi/types';
|
|
4
|
+
type TransformedEntry = {
|
|
5
|
+
id: string;
|
|
6
|
+
attributes: Record<string, unknown>;
|
|
7
|
+
meta?: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
declare const parseBody: (ctx: Koa.Context) => Koa.Context | {
|
|
10
|
+
data: any;
|
|
11
|
+
files: import("formidable").Files;
|
|
12
|
+
} | {
|
|
13
|
+
data: any;
|
|
14
|
+
};
|
|
15
|
+
declare const transformResponse: (resource: any, meta?: unknown, opts?: {
|
|
16
|
+
contentType?: Schema.ContentType | Schema.Component;
|
|
17
|
+
}) => {
|
|
18
|
+
data: TransformedEntry | TransformedEntry[] | null;
|
|
19
|
+
meta: unknown;
|
|
20
|
+
} | null | undefined;
|
|
21
|
+
export { parseBody, transformResponse };
|