@strapi/core 0.0.0-next.3116274aabb83ba9f858814329ead55ccaea244d → 0.0.0-next.32e19446d7ac2d8eaffa53da59f933ca5716d727
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.
Potentially problematic release.
This version of @strapi/core might be problematic. Click here for more details.
- package/dist/Strapi.d.ts +1 -0
- package/dist/Strapi.d.ts.map +1 -1
- package/dist/Strapi.js +22 -5
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs +22 -5
- package/dist/Strapi.mjs.map +1 -1
- package/dist/configuration/config-loader.js.map +1 -1
- package/dist/configuration/config-loader.mjs.map +1 -1
- package/dist/configuration/urls.js.map +1 -1
- package/dist/configuration/urls.mjs.map +1 -1
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +4 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/container.js.map +1 -1
- package/dist/container.mjs.map +1 -1
- package/dist/core-api/controller/index.d.ts.map +1 -1
- package/dist/core-api/controller/index.js +2 -1
- package/dist/core-api/controller/index.js.map +1 -1
- package/dist/core-api/controller/index.mjs +2 -1
- package/dist/core-api/controller/index.mjs.map +1 -1
- package/dist/core-api/controller/transform.d.ts +3 -2
- package/dist/core-api/controller/transform.d.ts.map +1 -1
- package/dist/core-api/controller/transform.js +13 -3
- package/dist/core-api/controller/transform.js.map +1 -1
- package/dist/core-api/controller/transform.mjs +13 -3
- 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/routes/validation/attributes.d.ts +1 -1
- package/dist/core-api/routes/validation/mappers.d.ts.map +1 -1
- package/dist/core-api/routes/validation/mappers.js +35 -0
- package/dist/core-api/routes/validation/mappers.js.map +1 -1
- package/dist/core-api/routes/validation/mappers.mjs +35 -0
- package/dist/core-api/routes/validation/mappers.mjs.map +1 -1
- package/dist/core-api/routes/validation/utils.d.ts.map +1 -1
- package/dist/core-api/routes/validation/utils.js +22 -6
- package/dist/core-api/routes/validation/utils.js.map +1 -1
- package/dist/core-api/routes/validation/utils.mjs +22 -6
- package/dist/core-api/routes/validation/utils.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/single-type.js.map +1 -1
- 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/module/index.js.map +1 -1
- package/dist/domain/module/index.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 +1 -2
- package/dist/ee/license.js.map +1 -1
- package/dist/ee/license.mjs +1 -2
- package/dist/ee/license.mjs.map +1 -1
- package/dist/factories.js.map +1 -1
- package/dist/factories.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/plugins/get-enabled-plugins.js.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
- package/dist/loaders/plugins/index.js +1 -1
- package/dist/loaders/plugins/index.js.map +1 -1
- package/dist/loaders/plugins/index.mjs +1 -1
- package/dist/loaders/plugins/index.mjs.map +1 -1
- package/dist/loaders/src-index.js.map +1 -1
- package/dist/loaders/src-index.mjs.map +1 -1
- package/dist/middlewares/logger.js.map +1 -1
- package/dist/middlewares/logger.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/security.d.ts.map +1 -1
- package/dist/middlewares/security.js +2 -15
- package/dist/middlewares/security.js.map +1 -1
- package/dist/middlewares/security.mjs +2 -15
- package/dist/middlewares/security.mjs.map +1 -1
- package/dist/migrations/first-published-at.js.map +1 -1
- package/dist/migrations/first-published-at.mjs.map +1 -1
- package/dist/package.json.js +16 -14
- package/dist/package.json.js.map +1 -1
- package/dist/package.json.mjs +16 -14
- package/dist/package.json.mjs.map +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +2 -0
- package/dist/providers/index.mjs.map +1 -1
- package/dist/providers/session-manager.d.ts +3 -0
- package/dist/providers/session-manager.d.ts.map +1 -0
- package/dist/providers/session-manager.js +23 -0
- package/dist/providers/session-manager.js.map +1 -0
- package/dist/providers/session-manager.mjs +21 -0
- package/dist/providers/session-manager.mjs.map +1 -0
- package/dist/registries/apis.js.map +1 -1
- package/dist/registries/apis.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/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/services/config.js.map +1 -1
- package/dist/services/config.mjs.map +1 -1
- package/dist/services/content-api/index.d.ts +1 -1
- package/dist/services/content-api/index.d.ts.map +1 -1
- package/dist/services/content-api/index.js +1 -1
- package/dist/services/content-api/index.js.map +1 -1
- package/dist/services/content-api/index.mjs +2 -2
- 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-source-maps.d.ts +13 -0
- package/dist/services/content-source-maps.d.ts.map +1 -0
- package/dist/services/content-source-maps.js +108 -0
- package/dist/services/content-source-maps.js.map +1 -0
- package/dist/services/content-source-maps.mjs +106 -0
- package/dist/services/content-source-maps.mjs.map +1 -0
- package/dist/services/core-store.js.map +1 -1
- package/dist/services/core-store.mjs.map +1 -1
- package/dist/services/document-service/components.d.ts +31 -1
- package/dist/services/document-service/components.d.ts.map +1 -1
- package/dist/services/document-service/components.js +109 -0
- package/dist/services/document-service/components.js.map +1 -1
- package/dist/services/document-service/components.mjs +107 -1
- package/dist/services/document-service/components.mjs.map +1 -1
- package/dist/services/document-service/repository.d.ts.map +1 -1
- package/dist/services/document-service/repository.js +5 -1
- package/dist/services/document-service/repository.js.map +1 -1
- package/dist/services/document-service/repository.mjs +6 -2
- package/dist/services/document-service/repository.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.map +1 -1
- package/dist/services/document-service/transform/id-map.mjs.map +1 -1
- package/dist/services/document-service/utils/clean-component-join-table.d.ts +7 -0
- package/dist/services/document-service/utils/clean-component-join-table.d.ts.map +1 -0
- package/dist/services/document-service/utils/clean-component-join-table.js +145 -0
- package/dist/services/document-service/utils/clean-component-join-table.js.map +1 -0
- package/dist/services/document-service/utils/clean-component-join-table.mjs +143 -0
- package/dist/services/document-service/utils/clean-component-join-table.mjs.map +1 -0
- package/dist/services/document-service/utils/unidirectional-relations.d.ts +19 -2
- package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -1
- package/dist/services/document-service/utils/unidirectional-relations.js +21 -6
- package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -1
- package/dist/services/document-service/utils/unidirectional-relations.mjs +21 -6
- 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/metrics/index.js +2 -1
- package/dist/services/metrics/index.js.map +1 -1
- package/dist/services/metrics/index.mjs +2 -1
- package/dist/services/metrics/index.mjs.map +1 -1
- package/dist/services/metrics/middleware.d.ts +2 -1
- package/dist/services/metrics/middleware.d.ts.map +1 -1
- package/dist/services/metrics/middleware.js +2 -2
- package/dist/services/metrics/middleware.js.map +1 -1
- package/dist/services/metrics/middleware.mjs +2 -2
- package/dist/services/metrics/middleware.mjs.map +1 -1
- package/dist/services/metrics/sender.d.ts.map +1 -1
- package/dist/services/metrics/sender.js +2 -1
- package/dist/services/metrics/sender.js.map +1 -1
- package/dist/services/metrics/sender.mjs +2 -1
- package/dist/services/metrics/sender.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/index.js.map +1 -1
- package/dist/services/server/index.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/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/session-manager.d.ts +167 -0
- package/dist/services/session-manager.d.ts.map +1 -0
- package/dist/services/session-manager.js +529 -0
- package/dist/services/session-manager.js.map +1 -0
- package/dist/services/session-manager.mjs +526 -0
- package/dist/services/session-manager.mjs.map +1 -0
- package/dist/services/webhook-runner.js.map +1 -1
- package/dist/services/webhook-runner.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/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/load-config-file.js.map +1 -1
- package/dist/utils/load-config-file.mjs.map +1 -1
- package/dist/utils/startup-logger.js.map +1 -1
- package/dist/utils/startup-logger.mjs.map +1 -1
- package/package.json +16 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.mjs","sources":["../../src/registries/policies.ts"],"sourcesContent":["import { pickBy, has, castArray } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\nimport { addNamespace, hasNamespace } from './namespace';\n\nconst PLUGIN_PREFIX = 'plugin::';\nconst API_PREFIX = 'api::';\n\ninterface PolicyInfo {\n name: string;\n config: unknown;\n}\n\ntype PolicyConfig = string | PolicyInfo;\n\ninterface NamespaceInfo {\n pluginName?: string;\n apiName?: string;\n}\n\nconst parsePolicy = (policy: string | PolicyInfo) => {\n if (typeof policy === 'string') {\n return { policyName: policy, config: {} };\n }\n\n const { name, config } = policy;\n return { policyName: name, config };\n};\n\nconst policiesRegistry = () => {\n const policies = new Map<string, Core.Policy>();\n\n const find = (name: string, namespaceInfo?: NamespaceInfo) => {\n const { pluginName, apiName } = namespaceInfo ?? {};\n\n // try to resolve a full name to avoid extra prefixing\n const policy = policies.get(name);\n\n if (policy) {\n return policy;\n }\n\n if (pluginName) {\n return policies.get(`${PLUGIN_PREFIX}${pluginName}.${name}`);\n }\n\n if (apiName) {\n return policies.get(`${API_PREFIX}${apiName}.${name}`);\n }\n };\n\n function resolveHandler(policyConfig: PolicyConfig, namespaceInfo?: NamespaceInfo): Core.Policy;\n function resolveHandler(\n policyConfig: PolicyConfig[],\n namespaceInfo?: NamespaceInfo\n ): Core.Policy[];\n function resolveHandler(\n policyConfig: PolicyConfig | PolicyConfig[],\n namespaceInfo?: NamespaceInfo\n ): Core.Policy | Core.Policy[] {\n if (Array.isArray(policyConfig)) {\n return policyConfig.map((config) => {\n return resolveHandler(config, namespaceInfo);\n });\n }\n\n const { policyName, config } = parsePolicy(policyConfig);\n\n const policy = find(policyName, namespaceInfo);\n\n if (!policy) {\n throw new Error(`Policy ${policyName} not found.`);\n }\n\n if (typeof policy === 'function') {\n return policy;\n }\n\n if (policy.validator) {\n policy.validator(config);\n }\n\n return policy.handler;\n }\n\n return {\n /**\n * Returns this list of registered policies uids\n */\n keys() {\n // Return an array so format stays the same as controllers, services, etc\n return Array.from(policies.keys());\n },\n\n /**\n * Returns the instance of a policy. Instantiate the policy if not already done\n */\n get(name: string, namespaceInfo?: NamespaceInfo) {\n return find(name, namespaceInfo);\n },\n /**\n * Checks if a policy is registered\n */\n has(name: string, namespaceInfo?: NamespaceInfo) {\n const res = find(name, namespaceInfo);\n return !!res;\n },\n\n /**\n * Returns a map with all the policies in a namespace\n */\n getAll(namespace: string) {\n return pickBy((_, uid) => hasNamespace(uid, namespace))(Object.fromEntries(policies));\n },\n\n /**\n * Registers a policy\n */\n set(uid: string, policy: Core.Policy) {\n policies.set(uid, policy);\n return this;\n },\n\n /**\n * Registers a map of policies for a specific namespace\n */\n add(namespace: string, newPolicies: Record<string, Core.Policy>) {\n for (const policyName of Object.keys(newPolicies)) {\n const policy = newPolicies[policyName];\n const uid = addNamespace(policyName, namespace);\n\n if (has(uid, policies)) {\n throw new Error(`Policy ${uid} has already been registered.`);\n }\n\n policies.set(uid, policy);\n }\n },\n\n /**\n * Resolves a list of policies\n */\n resolve(config: PolicyConfig | PolicyConfig[], namespaceInfo?: NamespaceInfo) {\n const { pluginName, apiName } = namespaceInfo ?? {};\n\n return castArray(config).map((policyConfig) => {\n return {\n handler: resolveHandler(policyConfig, { pluginName, apiName }),\n config: (typeof policyConfig === 'object' && policyConfig.config) || {},\n };\n });\n },\n };\n};\n\nexport default policiesRegistry;\n"],"names":["PLUGIN_PREFIX","API_PREFIX","parsePolicy","policy","policyName","config","name","policiesRegistry","policies","Map","find","namespaceInfo","pluginName","apiName","get","resolveHandler","policyConfig","Array","isArray","map","Error","validator","handler","keys","from","has","res","getAll","namespace","pickBy","_","uid","hasNamespace","Object","fromEntries","set","add","newPolicies","addNamespace","resolve","castArray"],"mappings":";;;AAIA,MAAMA,aAAgB,GAAA,UAAA;AACtB,MAAMC,UAAa,GAAA,OAAA;AAcnB,MAAMC,cAAc,CAACC,MAAAA,GAAAA;IACnB,IAAI,OAAOA,WAAW,QAAU,EAAA;QAC9B,OAAO;YAAEC,UAAYD,EAAAA,MAAAA;AAAQE,YAAAA,MAAAA,EAAQ;AAAG,SAAA;AAC1C;AAEA,IAAA,MAAM,EAAEC,IAAI,EAAED,MAAM,EAAE,GAAGF,MAAAA;IACzB,OAAO;QAAEC,UAAYE,EAAAA,IAAAA;AAAMD,QAAAA;AAAO,KAAA;AACpC,CAAA;AAEA,MAAME,gBAAmB,GAAA,IAAA;AACvB,IAAA,MAAMC,WAAW,IAAIC,GAAAA,EAAAA;IAErB,MAAMC,IAAAA,GAAO,CAACJ,IAAcK,EAAAA,aAAAA,GAAAA;AAC1B,QAAA,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE,GAAGF,iBAAiB,EAAC;;QAGlD,MAAMR,MAAAA,GAASK,QAASM,CAAAA,GAAG,CAACR,IAAAA,CAAAA;AAE5B,QAAA,IAAIH,MAAQ,EAAA;YACV,OAAOA,MAAAA;AACT;AAEA,QAAA,IAAIS,UAAY,EAAA;YACd,OAAOJ,QAAAA,CAASM,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"policies.mjs","sources":["../../src/registries/policies.ts"],"sourcesContent":["import { pickBy, has, castArray } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\nimport { addNamespace, hasNamespace } from './namespace';\n\nconst PLUGIN_PREFIX = 'plugin::';\nconst API_PREFIX = 'api::';\n\ninterface PolicyInfo {\n name: string;\n config: unknown;\n}\n\ntype PolicyConfig = string | PolicyInfo;\n\ninterface NamespaceInfo {\n pluginName?: string;\n apiName?: string;\n}\n\nconst parsePolicy = (policy: string | PolicyInfo) => {\n if (typeof policy === 'string') {\n return { policyName: policy, config: {} };\n }\n\n const { name, config } = policy;\n return { policyName: name, config };\n};\n\nconst policiesRegistry = () => {\n const policies = new Map<string, Core.Policy>();\n\n const find = (name: string, namespaceInfo?: NamespaceInfo) => {\n const { pluginName, apiName } = namespaceInfo ?? {};\n\n // try to resolve a full name to avoid extra prefixing\n const policy = policies.get(name);\n\n if (policy) {\n return policy;\n }\n\n if (pluginName) {\n return policies.get(`${PLUGIN_PREFIX}${pluginName}.${name}`);\n }\n\n if (apiName) {\n return policies.get(`${API_PREFIX}${apiName}.${name}`);\n }\n };\n\n function resolveHandler(policyConfig: PolicyConfig, namespaceInfo?: NamespaceInfo): Core.Policy;\n function resolveHandler(\n policyConfig: PolicyConfig[],\n namespaceInfo?: NamespaceInfo\n ): Core.Policy[];\n function resolveHandler(\n policyConfig: PolicyConfig | PolicyConfig[],\n namespaceInfo?: NamespaceInfo\n ): Core.Policy | Core.Policy[] {\n if (Array.isArray(policyConfig)) {\n return policyConfig.map((config) => {\n return resolveHandler(config, namespaceInfo);\n });\n }\n\n const { policyName, config } = parsePolicy(policyConfig);\n\n const policy = find(policyName, namespaceInfo);\n\n if (!policy) {\n throw new Error(`Policy ${policyName} not found.`);\n }\n\n if (typeof policy === 'function') {\n return policy;\n }\n\n if (policy.validator) {\n policy.validator(config);\n }\n\n return policy.handler;\n }\n\n return {\n /**\n * Returns this list of registered policies uids\n */\n keys() {\n // Return an array so format stays the same as controllers, services, etc\n return Array.from(policies.keys());\n },\n\n /**\n * Returns the instance of a policy. Instantiate the policy if not already done\n */\n get(name: string, namespaceInfo?: NamespaceInfo) {\n return find(name, namespaceInfo);\n },\n /**\n * Checks if a policy is registered\n */\n has(name: string, namespaceInfo?: NamespaceInfo) {\n const res = find(name, namespaceInfo);\n return !!res;\n },\n\n /**\n * Returns a map with all the policies in a namespace\n */\n getAll(namespace: string) {\n return pickBy((_, uid) => hasNamespace(uid, namespace))(Object.fromEntries(policies));\n },\n\n /**\n * Registers a policy\n */\n set(uid: string, policy: Core.Policy) {\n policies.set(uid, policy);\n return this;\n },\n\n /**\n * Registers a map of policies for a specific namespace\n */\n add(namespace: string, newPolicies: Record<string, Core.Policy>) {\n for (const policyName of Object.keys(newPolicies)) {\n const policy = newPolicies[policyName];\n const uid = addNamespace(policyName, namespace);\n\n if (has(uid, policies)) {\n throw new Error(`Policy ${uid} has already been registered.`);\n }\n\n policies.set(uid, policy);\n }\n },\n\n /**\n * Resolves a list of policies\n */\n resolve(config: PolicyConfig | PolicyConfig[], namespaceInfo?: NamespaceInfo) {\n const { pluginName, apiName } = namespaceInfo ?? {};\n\n return castArray(config).map((policyConfig) => {\n return {\n handler: resolveHandler(policyConfig, { pluginName, apiName }),\n config: (typeof policyConfig === 'object' && policyConfig.config) || {},\n };\n });\n },\n };\n};\n\nexport default policiesRegistry;\n"],"names":["PLUGIN_PREFIX","API_PREFIX","parsePolicy","policy","policyName","config","name","policiesRegistry","policies","Map","find","namespaceInfo","pluginName","apiName","get","resolveHandler","policyConfig","Array","isArray","map","Error","validator","handler","keys","from","has","res","getAll","namespace","pickBy","_","uid","hasNamespace","Object","fromEntries","set","add","newPolicies","addNamespace","resolve","castArray"],"mappings":";;;AAIA,MAAMA,aAAgB,GAAA,UAAA;AACtB,MAAMC,UAAa,GAAA,OAAA;AAcnB,MAAMC,cAAc,CAACC,MAAAA,GAAAA;IACnB,IAAI,OAAOA,WAAW,QAAU,EAAA;QAC9B,OAAO;YAAEC,UAAYD,EAAAA,MAAAA;AAAQE,YAAAA,MAAAA,EAAQ;AAAG,SAAA;AAC1C;AAEA,IAAA,MAAM,EAAEC,IAAI,EAAED,MAAM,EAAE,GAAGF,MAAAA;IACzB,OAAO;QAAEC,UAAYE,EAAAA,IAAAA;AAAMD,QAAAA;AAAO,KAAA;AACpC,CAAA;AAEA,MAAME,gBAAmB,GAAA,IAAA;AACvB,IAAA,MAAMC,WAAW,IAAIC,GAAAA,EAAAA;IAErB,MAAMC,IAAAA,GAAO,CAACJ,IAAcK,EAAAA,aAAAA,GAAAA;AAC1B,QAAA,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE,GAAGF,iBAAiB,EAAC;;QAGlD,MAAMR,MAAAA,GAASK,QAASM,CAAAA,GAAG,CAACR,IAAAA,CAAAA;AAE5B,QAAA,IAAIH,MAAQ,EAAA;YACV,OAAOA,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B,EAAA;AAC1E,YAAA,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE,GAAGF,iBAAiB,EAAC;AAElD,YAAA,OAAO6B,SAAUnC,CAAAA,MAAAA,CAAAA,CAAQc,GAAG,CAAC,CAACH,YAAAA,GAAAA;gBAC5B,OAAO;AACLM,oBAAAA,OAAAA,EAASP,eAAeC,YAAc,EAAA;AAAEJ,wBAAAA,UAAAA;AAAYC,wBAAAA;AAAQ,qBAAA,CAAA;AAC5DR,oBAAAA,MAAAA,EAAQ,OAAQW,YAAAA,KAAiB,YAAYA,YAAaX,CAAAA,MAAM,IAAK;AACvE,iBAAA;AACF,aAAA,CAAA;AACF;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../src/services/config.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { get, set, has, isString, isNumber, isArray, type PropertyPath } from 'lodash';\n\ntype State = {\n config: Config;\n};\n\ntype Config = Record<string, unknown>;\n\nexport const createConfigProvider = (\n initialConfig: Record<string, unknown> = {},\n strapi?: Core.Strapi\n): Core.ConfigProvider => {\n const state: State = {\n config: { ...initialConfig }, // not deep clone because it would break some config\n };\n\n // Accessing model configs with dot (.) was deprecated between v4->v5, but to avoid a major breaking change\n // we will still support certain namespaces, currently only 'plugin.'\n const transformPathString = (path: string) => {\n if (path.startsWith('plugin.')) {\n const newPath = path.replace('plugin.', 'plugin::');\n\n // strapi logger may not be loaded yet, so fall back to console\n (strapi?.log?.warn ?? console.warn)(\n `Using dot notation for model config namespaces is deprecated, for example \"plugin::myplugin\" should be used instead of \"plugin.myplugin\". Modifying requested path ${path} to ${newPath}`\n );\n return newPath;\n }\n\n return path;\n };\n\n const transformDeprecatedPaths = (path: PropertyPath): PropertyPath => {\n if (isString(path)) {\n return transformPathString(path);\n }\n if (isArray(path)) {\n // if the path is not joinable, we won't apply our deprecation support\n if (path.some((part) => !(isString(part) || isNumber(part)))) {\n return path;\n }\n\n return transformPathString(path.join('.'));\n }\n\n return path;\n };\n\n return {\n ...state.config, // TODO: to remove\n get(path: PropertyPath, defaultValue?: unknown) {\n return get(state.config, transformDeprecatedPaths(path), defaultValue);\n },\n set(path: PropertyPath, val: unknown) {\n set(state.config, transformDeprecatedPaths(path), val);\n return this;\n },\n has(path: PropertyPath) {\n return has(state.config, transformDeprecatedPaths(path));\n },\n };\n};\n"],"names":["createConfigProvider","initialConfig","strapi","state","config","transformPathString","path","startsWith","newPath","replace","log","warn","console","transformDeprecatedPaths","isString","isArray","some","part","isNumber","join","get","defaultValue","set","val","has"],"mappings":";;;;MASaA,oBAAuB,GAAA,CAClCC,aAAyC,GAAA,EAAE,EAC3CC,MAAAA,GAAAA;AAEA,IAAA,MAAMC,KAAe,GAAA;QACnBC,MAAQ,EAAA;AAAE,YAAA,GAAGH;AAAc;AAC7B,KAAA;;;AAIA,IAAA,MAAMI,sBAAsB,CAACC,IAAAA,GAAAA;QAC3B,IAAIA,IAAAA,CAAKC,UAAU,CAAC,SAAY,CAAA,EAAA;AAC9B,YAAA,MAAMC,OAAUF,GAAAA,IAAAA,CAAKG,OAAO,CAAC,SAAW,EAAA,UAAA,CAAA;;AAGvCP,YAAAA,CAAAA,MAAQQ,EAAAA,GAAAA,EAAKC,IAAQC,IAAAA,OAAAA,CAAQD,
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../src/services/config.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { get, set, has, isString, isNumber, isArray, type PropertyPath } from 'lodash';\n\ntype State = {\n config: Config;\n};\n\ntype Config = Record<string, unknown>;\n\nexport const createConfigProvider = (\n initialConfig: Record<string, unknown> = {},\n strapi?: Core.Strapi\n): Core.ConfigProvider => {\n const state: State = {\n config: { ...initialConfig }, // not deep clone because it would break some config\n };\n\n // Accessing model configs with dot (.) was deprecated between v4->v5, but to avoid a major breaking change\n // we will still support certain namespaces, currently only 'plugin.'\n const transformPathString = (path: string) => {\n if (path.startsWith('plugin.')) {\n const newPath = path.replace('plugin.', 'plugin::');\n\n // strapi logger may not be loaded yet, so fall back to console\n (strapi?.log?.warn ?? console.warn)(\n `Using dot notation for model config namespaces is deprecated, for example \"plugin::myplugin\" should be used instead of \"plugin.myplugin\". Modifying requested path ${path} to ${newPath}`\n );\n return newPath;\n }\n\n return path;\n };\n\n const transformDeprecatedPaths = (path: PropertyPath): PropertyPath => {\n if (isString(path)) {\n return transformPathString(path);\n }\n if (isArray(path)) {\n // if the path is not joinable, we won't apply our deprecation support\n if (path.some((part) => !(isString(part) || isNumber(part)))) {\n return path;\n }\n\n return transformPathString(path.join('.'));\n }\n\n return path;\n };\n\n return {\n ...state.config, // TODO: to remove\n get(path: PropertyPath, defaultValue?: unknown) {\n return get(state.config, transformDeprecatedPaths(path), defaultValue);\n },\n set(path: PropertyPath, val: unknown) {\n set(state.config, transformDeprecatedPaths(path), val);\n return this;\n },\n has(path: PropertyPath) {\n return has(state.config, transformDeprecatedPaths(path));\n },\n };\n};\n"],"names":["createConfigProvider","initialConfig","strapi","state","config","transformPathString","path","startsWith","newPath","replace","log","warn","console","transformDeprecatedPaths","isString","isArray","some","part","isNumber","join","get","defaultValue","set","val","has"],"mappings":";;;;MASaA,oBAAuB,GAAA,CAClCC,aAAyC,GAAA,EAAE,EAC3CC,MAAAA,GAAAA;AAEA,IAAA,MAAMC,KAAe,GAAA;QACnBC,MAAQ,EAAA;AAAE,YAAA,GAAGH;AAAc;AAC7B,KAAA;;;AAIA,IAAA,MAAMI,sBAAsB,CAACC,IAAAA,GAAAA;QAC3B,IAAIA,IAAAA,CAAKC,UAAU,CAAC,SAAY,CAAA,EAAA;AAC9B,YAAA,MAAMC,OAAUF,GAAAA,IAAAA,CAAKG,OAAO,CAAC,SAAW,EAAA,UAAA,CAAA;;AAGvCP,YAAAA,CAAAA,MAAQQ,EAAAA,GAAAA,EAAKC,IAAQC,IAAAA,OAAAA,CAAQD,IAAG,EAC/B,CAAC,mKAAmK,EAAEL,IAAK,CAAA,IAAI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/services/config.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { get, set, has, isString, isNumber, isArray, type PropertyPath } from 'lodash';\n\ntype State = {\n config: Config;\n};\n\ntype Config = Record<string, unknown>;\n\nexport const createConfigProvider = (\n initialConfig: Record<string, unknown> = {},\n strapi?: Core.Strapi\n): Core.ConfigProvider => {\n const state: State = {\n config: { ...initialConfig }, // not deep clone because it would break some config\n };\n\n // Accessing model configs with dot (.) was deprecated between v4->v5, but to avoid a major breaking change\n // we will still support certain namespaces, currently only 'plugin.'\n const transformPathString = (path: string) => {\n if (path.startsWith('plugin.')) {\n const newPath = path.replace('plugin.', 'plugin::');\n\n // strapi logger may not be loaded yet, so fall back to console\n (strapi?.log?.warn ?? console.warn)(\n `Using dot notation for model config namespaces is deprecated, for example \"plugin::myplugin\" should be used instead of \"plugin.myplugin\". Modifying requested path ${path} to ${newPath}`\n );\n return newPath;\n }\n\n return path;\n };\n\n const transformDeprecatedPaths = (path: PropertyPath): PropertyPath => {\n if (isString(path)) {\n return transformPathString(path);\n }\n if (isArray(path)) {\n // if the path is not joinable, we won't apply our deprecation support\n if (path.some((part) => !(isString(part) || isNumber(part)))) {\n return path;\n }\n\n return transformPathString(path.join('.'));\n }\n\n return path;\n };\n\n return {\n ...state.config, // TODO: to remove\n get(path: PropertyPath, defaultValue?: unknown) {\n return get(state.config, transformDeprecatedPaths(path), defaultValue);\n },\n set(path: PropertyPath, val: unknown) {\n set(state.config, transformDeprecatedPaths(path), val);\n return this;\n },\n has(path: PropertyPath) {\n return has(state.config, transformDeprecatedPaths(path));\n },\n };\n};\n"],"names":["createConfigProvider","initialConfig","strapi","state","config","transformPathString","path","startsWith","newPath","replace","log","warn","console","transformDeprecatedPaths","isString","isArray","some","part","isNumber","join","get","defaultValue","set","val","has"],"mappings":";;MASaA,oBAAuB,GAAA,CAClCC,aAAyC,GAAA,EAAE,EAC3CC,MAAAA,GAAAA;AAEA,IAAA,MAAMC,KAAe,GAAA;QACnBC,MAAQ,EAAA;AAAE,YAAA,GAAGH;AAAc;AAC7B,KAAA;;;AAIA,IAAA,MAAMI,sBAAsB,CAACC,IAAAA,GAAAA;QAC3B,IAAIA,IAAAA,CAAKC,UAAU,CAAC,SAAY,CAAA,EAAA;AAC9B,YAAA,MAAMC,OAAUF,GAAAA,IAAAA,CAAKG,OAAO,CAAC,SAAW,EAAA,UAAA,CAAA;;AAGvCP,YAAAA,CAAAA,MAAQQ,EAAAA,GAAAA,EAAKC,IAAQC,IAAAA,OAAAA,CAAQD,
|
|
1
|
+
{"version":3,"file":"config.mjs","sources":["../../src/services/config.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { get, set, has, isString, isNumber, isArray, type PropertyPath } from 'lodash';\n\ntype State = {\n config: Config;\n};\n\ntype Config = Record<string, unknown>;\n\nexport const createConfigProvider = (\n initialConfig: Record<string, unknown> = {},\n strapi?: Core.Strapi\n): Core.ConfigProvider => {\n const state: State = {\n config: { ...initialConfig }, // not deep clone because it would break some config\n };\n\n // Accessing model configs with dot (.) was deprecated between v4->v5, but to avoid a major breaking change\n // we will still support certain namespaces, currently only 'plugin.'\n const transformPathString = (path: string) => {\n if (path.startsWith('plugin.')) {\n const newPath = path.replace('plugin.', 'plugin::');\n\n // strapi logger may not be loaded yet, so fall back to console\n (strapi?.log?.warn ?? console.warn)(\n `Using dot notation for model config namespaces is deprecated, for example \"plugin::myplugin\" should be used instead of \"plugin.myplugin\". Modifying requested path ${path} to ${newPath}`\n );\n return newPath;\n }\n\n return path;\n };\n\n const transformDeprecatedPaths = (path: PropertyPath): PropertyPath => {\n if (isString(path)) {\n return transformPathString(path);\n }\n if (isArray(path)) {\n // if the path is not joinable, we won't apply our deprecation support\n if (path.some((part) => !(isString(part) || isNumber(part)))) {\n return path;\n }\n\n return transformPathString(path.join('.'));\n }\n\n return path;\n };\n\n return {\n ...state.config, // TODO: to remove\n get(path: PropertyPath, defaultValue?: unknown) {\n return get(state.config, transformDeprecatedPaths(path), defaultValue);\n },\n set(path: PropertyPath, val: unknown) {\n set(state.config, transformDeprecatedPaths(path), val);\n return this;\n },\n has(path: PropertyPath) {\n return has(state.config, transformDeprecatedPaths(path));\n },\n };\n};\n"],"names":["createConfigProvider","initialConfig","strapi","state","config","transformPathString","path","startsWith","newPath","replace","log","warn","console","transformDeprecatedPaths","isString","isArray","some","part","isNumber","join","get","defaultValue","set","val","has"],"mappings":";;MASaA,oBAAuB,GAAA,CAClCC,aAAyC,GAAA,EAAE,EAC3CC,MAAAA,GAAAA;AAEA,IAAA,MAAMC,KAAe,GAAA;QACnBC,MAAQ,EAAA;AAAE,YAAA,GAAGH;AAAc;AAC7B,KAAA;;;AAIA,IAAA,MAAMI,sBAAsB,CAACC,IAAAA,GAAAA;QAC3B,IAAIA,IAAAA,CAAKC,UAAU,CAAC,SAAY,CAAA,EAAA;AAC9B,YAAA,MAAMC,OAAUF,GAAAA,IAAAA,CAAKG,OAAO,CAAC,SAAW,EAAA,UAAA,CAAA;;AAGvCP,YAAAA,CAAAA,MAAQQ,EAAAA,GAAAA,EAAKC,IAAQC,IAAAA,OAAAA,CAAQD,IAAG,EAC/B,CAAC,mKAAmK,EAAEL,IAAK,CAAA,IAAI,EAAEE,OAAS,CAAA,CAAA,CAAA;YAE5L,OAAOA,OAAAA;AACT;QAEA,OAAOF,IAAAA;AACT,KAAA;AAEA,IAAA,MAAMO,2BAA2B,CAACP,IAAAA,GAAAA;AAChC,QAAA,IAAIQ,SAASR,IAAO,CAAA,EAAA;AAClB,YAAA,OAAOD,mBAAoBC,CAAAA,IAAAA,CAAAA;AAC7B;AACA,QAAA,IAAIS,QAAQT,IAAO,CAAA,EAAA;;YAEjB,IAAIA,IAAAA,CAAKU,IAAI,CAAC,CAACC,IAAAA,GAAS,EAAEH,QAASG,CAAAA,IAAAA,CAAAA,IAASC,QAASD,CAAAA,IAAAA,CAAI,CAAK,CAAA,EAAA;gBAC5D,OAAOX,IAAAA;AACT;YAEA,OAAOD,mBAAAA,CAAoBC,IAAKa,CAAAA,IAAI,CAAC,GAAA,CAAA,CAAA;AACvC;QAEA,OAAOb,IAAAA;AACT,KAAA;IAEA,OAAO;AACL,QAAA,GAAGH,MAAMC,MAAM;QACfgB,GAAId,CAAAA,CAAAA,IAAkB,EAAEe,YAAsB,EAAA;AAC5C,YAAA,OAAOD,GAAIjB,CAAAA,KAAAA,CAAMC,MAAM,EAAES,yBAAyBP,IAAOe,CAAAA,EAAAA,YAAAA,CAAAA;AAC3D,SAAA;QACAC,GAAIhB,CAAAA,CAAAA,IAAkB,EAAEiB,GAAY,EAAA;AAClCD,YAAAA,GAAAA,CAAInB,KAAMC,CAAAA,MAAM,EAAES,wBAAAA,CAAyBP,IAAOiB,CAAAA,EAAAA,GAAAA,CAAAA;AAClD,YAAA,OAAO,IAAI;AACb,SAAA;AACAC,QAAAA,GAAAA,CAAAA,CAAIlB,IAAkB,EAAA;AACpB,YAAA,OAAOkB,GAAIrB,CAAAA,KAAAA,CAAMC,MAAM,EAAES,wBAAyBP,CAAAA,IAAAA,CAAAA,CAAAA;AACpD;AACF,KAAA;AACF;;;;"}
|
|
@@ -47,7 +47,7 @@ declare const createContentAPI: (strapi: Core.Strapi) => {
|
|
|
47
47
|
controllers: Record<string, string[]>;
|
|
48
48
|
}>;
|
|
49
49
|
};
|
|
50
|
-
getRoutesMap: () => Promise<Record<string,
|
|
50
|
+
getRoutesMap: () => Promise<Record<string, unknown>>;
|
|
51
51
|
sanitize: {
|
|
52
52
|
input: sanitize.SanitizeFunc;
|
|
53
53
|
output: sanitize.SanitizeFunc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/content-api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/content-api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAqC,MAAM,eAAe,CAAC;AAEtF,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,eAAe,CAAC;AAgB/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,WAAY,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgF5C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -49,7 +49,7 @@ const filterContentAPI = (route)=>route.info.type === 'content-api';
|
|
|
49
49
|
path: `${apiPrefix}${route.path}`
|
|
50
50
|
}));
|
|
51
51
|
});
|
|
52
|
-
return routesMap;
|
|
52
|
+
return strapiUtils.sanitizeRoutesMapForSerialization(routesMap);
|
|
53
53
|
};
|
|
54
54
|
const sanitizer = strapiUtils.sanitize.createAPISanitizers({
|
|
55
55
|
getModel (uid) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return routesMap;\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAAM;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate, sanitizeRoutesMapForSerialization } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return sanitizeRoutesMapForSerialization(routesMap);\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizeRoutesMapForSerialization","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAAM;AAClD,QAAA,MAAME,IAAOF,GAAAA,MAAAA,KAAWG,SAAY,GAAA,CAAA,EAAGH,SAASD,KAAMG,CAAAA,IAAI,CAAE,CAAA,GAAG,CAAC,CAAC,EAAEJ,UAAaC,CAAAA,EAAAA,KAAAA,CAAMG,IAAI,CAAE,CAAA;QAE5F,OAAO;AACL,YAAA,GAAGH,KAAK;AACRG,YAAAA;AACF,SAAA;AACF,KAAA;AAEA,MAAME,mBAAmB,CAACL,KAAAA,GAAsBA,MAAMM,IAAI,CAACC,IAAI,KAAK,aAAA;AAEpE;;IAGA,MAAMC,mBAAmB,CAACC,MAAAA,GAAAA;AACxB,IAAA,MAAMC,YAAe,GAAA,UAAA;AACnB,QAAA,MA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AA;AACzB,SAAA;;AAEA,QAAA,IAAIO,UAAa,CAAA,GAAA;YACf,OAAO;AACLL,gBAAAA,KAAAA,EAAO3B,MAAOgC,CAAAA,UAAU,CAACnB,GAAG,CAAC,mBAAA;AAC/B,aAAA;AACF;AACF,KAAA,CAAA;IAEA,OAAO;AACLoB,QAAAA,WAAAA,EAAaC,KAAgClC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAqB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { sanitize, validate } from '@strapi/utils';
|
|
2
|
+
import { sanitize, validate, sanitizeRoutesMapForSerialization } from '@strapi/utils';
|
|
3
3
|
import instantiatePermissionsUtilities from './permissions/index.mjs';
|
|
4
4
|
|
|
5
5
|
const transformRoutePrefixFor = (pluginName)=>(route)=>{
|
|
@@ -47,7 +47,7 @@ const filterContentAPI = (route)=>route.info.type === 'content-api';
|
|
|
47
47
|
path: `${apiPrefix}${route.path}`
|
|
48
48
|
}));
|
|
49
49
|
});
|
|
50
|
-
return routesMap;
|
|
50
|
+
return sanitizeRoutesMapForSerialization(routesMap);
|
|
51
51
|
};
|
|
52
52
|
const sanitizer = sanitize.createAPISanitizers({
|
|
53
53
|
getModel (uid) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return routesMap;\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAAM;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/services/content-api/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport { sanitize, validate, sanitizeRoutesMapForSerialization } from '@strapi/utils';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport instantiatePermissionsUtilities from './permissions';\n\nconst transformRoutePrefixFor = (pluginName: string) => (route: Core.Route) => {\n const prefix = route.config && route.config.prefix;\n const path = prefix !== undefined ? `${prefix}${route.path}` : `/${pluginName}${route.path}`;\n\n return {\n ...route,\n path,\n };\n};\n\nconst filterContentAPI = (route: Core.Route) => route.info.type === 'content-api';\n\n/**\n * Create a content API container that holds logic, tools and utils. (eg: permissions, ...)\n */\nconst createContentAPI = (strapi: Core.Strapi) => {\n const getRoutesMap = async () => {\n const routesMap: Record<string, Core.Route[]> = {};\n\n _.forEach(strapi.apis, (api, apiName) => {\n const routes = _.flatMap(api.routes, (route) => {\n if ('routes' in route) {\n return route.routes;\n }\n\n return route;\n }).filter(filterContentAPI);\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`api::${apiName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n _.forEach(strapi.plugins, (plugin, pluginName) => {\n const transformPrefix = transformRoutePrefixFor(pluginName);\n\n if (Array.isArray(plugin.routes)) {\n return plugin.routes.map(transformPrefix).filter(filterContentAPI);\n }\n\n const routes = _.flatMap(plugin.routes, (route) => route.routes.map(transformPrefix)).filter(\n filterContentAPI\n );\n\n if (routes.length === 0) {\n return;\n }\n\n const apiPrefix = strapi.config.get('api.rest.prefix');\n routesMap[`plugin::${pluginName}`] = routes.map((route) => ({\n ...route,\n path: `${apiPrefix}${route.path}`,\n }));\n });\n\n return sanitizeRoutesMapForSerialization(routesMap);\n };\n\n const sanitizer = sanitize.createAPISanitizers({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of sanitizers after the creation of the container\n get sanitizers() {\n return {\n input: strapi.sanitizers.get('content-api.input'),\n output: strapi.sanitizers.get('content-api.output'),\n };\n },\n });\n\n const validator = validate.createAPIValidators({\n getModel(uid: string) {\n return strapi.getModel(uid as UID.Schema);\n },\n // NOTE: use lazy access to allow registration of validators after the creation of the container\n get validators() {\n return {\n input: strapi.validators.get('content-api.input'),\n };\n },\n });\n\n return {\n permissions: instantiatePermissionsUtilities(strapi),\n getRoutesMap,\n sanitize: sanitizer,\n validate: validator,\n };\n};\n\nexport default createContentAPI;\n"],"names":["transformRoutePrefixFor","pluginName","route","prefix","config","path","undefined","filterContentAPI","info","type","createContentAPI","strapi","getRoutesMap","routesMap","_","forEach","apis","api","apiName","routes","flatMap","filter","length","apiPrefix","get","map","plugins","plugin","transformPrefix","Array","isArray","sanitizeRoutesMapForSerialization","sanitizer","sanitize","createAPISanitizers","getModel","uid","sanitizers","input","output","validator","validate","createAPIValidators","validators","permissions","instantiatePermissionsUtilities"],"mappings":";;;;AAOA,MAAMA,uBAAAA,GAA0B,CAACC,UAAAA,GAAuB,CAACC,KAAAA,GAAAA;AACvD,QAAA,MAAMC,SAASD,KAAME,CAAAA,MAAM,IAAIF,KAAME,CAAAA,MAAM,CAACD,MAAM;AAClD,QAAA,MAAME,IAAOF,GAAAA,MAAAA,KAAWG,SAAY,GAAA,CAAA,EAAGH,SAASD,KAAMG,CAAAA,IAAI,CAAE,CAA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EAAO3B,MAAO0B,CAAAA,UAAU,CAACb,GAAG,CAAC,mBAAA,CAAA;AAC7Be,gBAAAA,MAAAA,EAAQ5B,MAAO0B,CAAAA,UAAU,CAACb,GAAG,CAAC,oBAAA;AAChC,aAAA;AACF;AACF,KAAA,CAAA;IAEA,MAAMgB,SAAAA,GAAYC,QAASC,CAAAA,mBAAmB,CAAC;AAC7CP,QAAAA,QAAAA,CAAAA,CAASC,GAAW,EAAA;YAClB,OAAOzB,MAAAA,CAAOwB,QAAQ,CAACC,GAAAA,CAAAA;AACzB,SAAA;;AAEA,QAAA,IAAIO,UAAa,CAAA,GAAA;YACf,OAAO;AACLL,gBAAAA,KAAAA,EAAO3B,MAAOgC,CAAAA,UAAU,CAACnB,GAAG,CAAC,mBAAA;AAC/B,aAAA;AACF;AACF,KAAA,CAAA;IAEA,OAAO;AACLoB,QAAAA,WAAAA,EAAaC,+BAAgClC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAqB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/services/content-api/permissions/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\nimport { createActionProvider, createConditionProvider } from './providers';\nimport createPermissionEngine from './engine';\n\nconst typeSymbol = Symbol.for('__type__');\n\ninterface ValidatePermissionHandler {\n (params: { permission: { action: string } }): boolean;\n}\n\n/**\n * Creates a handler that checks if the permission's action exists in the action registry\n */\nconst createValidatePermissionHandler =\n (actionProvider: ReturnType<typeof createActionProvider>): ValidatePermissionHandler =>\n ({ permission }) => {\n const action = actionProvider.get(permission.action);\n\n // If the action isn't registered into the action provider, then ignore the permission and warn the user\n if (!action) {\n strapi.log.debug(\n `Unknown action \"${permission.action}\" supplied when registering a new permission`\n );\n\n return false;\n }\n\n return true;\n };\n\n/**\n * Create instances of providers and permission engine for the core content-API service.\n * Also, expose utilities to get information about available actions and such.\n */\nexport default (strapi: Core.Strapi) => {\n // NOTE: Here we define both an action and condition provider,\n // but at the moment, we're only using the action one.\n const providers = {\n action: createActionProvider(),\n condition: createConditionProvider(),\n };\n\n /**\n * Get a tree representation of the available Content API actions\n * based on the methods of the Content API controllers.\n *\n * @note Only actions bound to a content-API route are returned.\n */\n const getActionsMap = () => {\n const actionMap: Record<\n string,\n {\n controllers: Record<string, string[]>;\n }\n > = {};\n\n /**\n * Check if a controller's action is bound to the\n * content-api by looking at a potential __type__ symbol\n */\n const isContentApi = (action: Core.ControllerHandler & { [s: symbol]: any }) => {\n if (!_.has(action, typeSymbol)) {\n return false;\n }\n\n return action[typeSymbol].includes('content-api');\n };\n\n /**\n * Register actions from a specific API source into the result tree\n */\n const registerAPIsActions = (\n apis: Record<string, Core.Plugin | Core.Module>,\n source: 'api' | 'plugin'\n ) => {\n _.forEach(apis, (api, apiName) => {\n const controllers = _.reduce(\n api.controllers,\n (acc, controller, controllerName) => {\n const contentApiActions = _.pickBy(controller, isContentApi);\n\n if (_.isEmpty(contentApiActions)) {\n return acc;\n }\n\n acc[controllerName] = Object.keys(contentApiActions);\n\n return acc;\n },\n {} as Record<string, string[]>\n );\n\n if (!_.isEmpty(controllers)) {\n actionMap[`${source}::${apiName}`] = { controllers };\n }\n });\n };\n\n registerAPIsActions(strapi.apis, 'api');\n registerAPIsActions(strapi.plugins, 'plugin');\n\n return actionMap;\n };\n\n /**\n * Register all the content-API controllers actions into the action provider.\n * This method make use of the {@link getActionsMap} to generate the list of actions to register.\n */\n const registerActions = async () => {\n const actionsMap = getActionsMap();\n\n // For each API\n for (const [api, value] of Object.entries(actionsMap)) {\n const { controllers } = value;\n\n // Register controllers methods as actions\n for (const [controller, actions] of Object.entries(controllers)) {\n // Register each action individually\n await Promise.all(\n actions.map((action) => {\n const actionUID = `${api}.${controller}.${action}`;\n\n return providers.action.register(actionUID, {\n api,\n controller,\n action,\n uid: actionUID,\n });\n })\n );\n }\n }\n };\n\n // Create an instance of a content-API permission engine\n // and binds a custom validation handler to it\n const engine = createPermissionEngine({ providers });\n\n engine.on(\n 'before-format::validate.permission',\n createValidatePermissionHandler(providers.action)\n );\n\n return {\n engine,\n providers,\n registerActions,\n getActionsMap,\n };\n};\n"],"names":["typeSymbol","Symbol","for","createValidatePermissionHandler","actionProvider","permission","action","get","strapi","log","debug","providers","createActionProvider","condition","createConditionProvider","getActionsMap","actionMap","isContentApi","_","has","includes","registerAPIsActions","apis","source","forEach","api","apiName","controllers","reduce","acc","controller","controllerName","contentApiActions","pickBy","isEmpty","Object","keys","plugins","registerActions","actionsMap","value","entries","actions","Promise","all","map","actionUID","register","uid","engine","createPermissionEngine","on"],"mappings":";;;;;;;AAKA,MAAMA,UAAAA,GAAaC,MAAOC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAM9B;;AAEC,IACD,MAAMC,+BACJ,GAAA,CAACC,iBACD,CAAC,EAAEC,UAAU,EAAE,GAAA;AACb,QAAA,MAAMC,MAASF,GAAAA,cAAAA,CAAeG,GAAG,CAACF,WAAWC,MAAM,CAAA;;AAGnD,QAAA,IAAI,CAACA,MAAQ,EAAA;YACXE,MAAOC,CAAAA,GAAG,CAACC,KAAK,CACd,CAAC,gBAAgB,EAAEL,UAAWC,CAAAA,MAAM,CAAC,4CAA4C,CAAC,CAAA;YAGpF,OAAO,KAAA;AACT;QAEA,OAAO,IAAA;AACT,KAAA;AAEF;;;IAIA,sCAAe,CAAA,CAACE,OAAAA,GAAAA;;;AAGd,IAAA,MAAMG,SAAY,GAAA;QAChBL,MAAQM,EAAAA,MAAAA,EAAAA;QACRC,SAAWC,EAAAA,SAAAA;AACb,KAAA;AAEA;;;;;AAKC,MACD,MAAMC,aAAgB,GAAA,IAAA;AACpB,QAAA,MAAMC,YAKF,EAAC;AAEL;;;QAIA,MAAMC,eAAe,CAACX,MAAAA,GAAAA;AACpB,YAAA,IAAI,CAACY,CAAAA,CAAEC,GAAG,CAACb,QAAQN,UAAa,CAAA,EAAA;gBAC9B,OAAO,KAAA;AACT;AAEA,YAAA,OAAOM,MAAM,CAACN,UAAW,CAAA,CAACoB,QAAQ,CAAC,aAAA,CAAA;AACrC,SAAA;AAEA;;QAGA,MAAMC,mBAAsB,GAAA,CAC1BC,IACAC,EAAAA,MAAAA,GAAAA;AAEAL,YAAAA,CAAAA,CAAEM,OAAO,CAACF,IAAM,EAAA,CAACG,GAAKC,EAAAA,OAAAA,GAAAA;gBACpB,MAAMC,WAAAA,GAAcT,EAAEU,MAAM,CAC1BH,IAAIE,WAAW,EACf,CAACE,GAAAA,EAAKC,UAAYC,EAAAA,cAAAA,GAAAA;AAChB,oBAAA,MAAMC,iBAAoBd,GAAAA,CAAAA,CAAEe,MAAM,CAACH,UAAYb,EAAAA,YAAAA,CAAAA;oBAE/C,IAAIC,CAAAA,CAAEgB,OAAO,CAACF,iBAAoB,CAAA,EAAA;wBAChC,OAAOH,GAAAA;AACT;AAEAA,oBAAAA,GAAG,CAACE,cAAAA,CAAe,GAAGI,MAAAA,CAAOC,IAAI,CAACJ,iBAAAA,CAAAA;oBAElC,OAAOH,GAAAA;AACT,iBAAA,EACA,EAAC,CAAA;AAGH,gBAAA,IAAI,CAACX,CAAAA,CAAEgB,OAAO,CAACP,WAAc,CAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/services/content-api/permissions/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\nimport { createActionProvider, createConditionProvider } from './providers';\nimport createPermissionEngine from './engine';\n\nconst typeSymbol = Symbol.for('__type__');\n\ninterface ValidatePermissionHandler {\n (params: { permission: { action: string } }): boolean;\n}\n\n/**\n * Creates a handler that checks if the permission's action exists in the action registry\n */\nconst createValidatePermissionHandler =\n (actionProvider: ReturnType<typeof createActionProvider>): ValidatePermissionHandler =>\n ({ permission }) => {\n const action = actionProvider.get(permission.action);\n\n // If the action isn't registered into the action provider, then ignore the permission and warn the user\n if (!action) {\n strapi.log.debug(\n `Unknown action \"${permission.action}\" supplied when registering a new permission`\n );\n\n return false;\n }\n\n return true;\n };\n\n/**\n * Create instances of providers and permission engine for the core content-API service.\n * Also, expose utilities to get information about available actions and such.\n */\nexport default (strapi: Core.Strapi) => {\n // NOTE: Here we define both an action and condition provider,\n // but at the moment, we're only using the action one.\n const providers = {\n action: createActionProvider(),\n condition: createConditionProvider(),\n };\n\n /**\n * Get a tree representation of the available Content API actions\n * based on the methods of the Content API controllers.\n *\n * @note Only actions bound to a content-API route are returned.\n */\n const getActionsMap = () => {\n const actionMap: Record<\n string,\n {\n controllers: Record<string, string[]>;\n }\n > = {};\n\n /**\n * Check if a controller's action is bound to the\n * content-api by looking at a potential __type__ symbol\n */\n const isContentApi = (action: Core.ControllerHandler & { [s: symbol]: any }) => {\n if (!_.has(action, typeSymbol)) {\n return false;\n }\n\n return action[typeSymbol].includes('content-api');\n };\n\n /**\n * Register actions from a specific API source into the result tree\n */\n const registerAPIsActions = (\n apis: Record<string, Core.Plugin | Core.Module>,\n source: 'api' | 'plugin'\n ) => {\n _.forEach(apis, (api, apiName) => {\n const controllers = _.reduce(\n api.controllers,\n (acc, controller, controllerName) => {\n const contentApiActions = _.pickBy(controller, isContentApi);\n\n if (_.isEmpty(contentApiActions)) {\n return acc;\n }\n\n acc[controllerName] = Object.keys(contentApiActions);\n\n return acc;\n },\n {} as Record<string, string[]>\n );\n\n if (!_.isEmpty(controllers)) {\n actionMap[`${source}::${apiName}`] = { controllers };\n }\n });\n };\n\n registerAPIsActions(strapi.apis, 'api');\n registerAPIsActions(strapi.plugins, 'plugin');\n\n return actionMap;\n };\n\n /**\n * Register all the content-API controllers actions into the action provider.\n * This method make use of the {@link getActionsMap} to generate the list of actions to register.\n */\n const registerActions = async () => {\n const actionsMap = getActionsMap();\n\n // For each API\n for (const [api, value] of Object.entries(actionsMap)) {\n const { controllers } = value;\n\n // Register controllers methods as actions\n for (const [controller, actions] of Object.entries(controllers)) {\n // Register each action individually\n await Promise.all(\n actions.map((action) => {\n const actionUID = `${api}.${controller}.${action}`;\n\n return providers.action.register(actionUID, {\n api,\n controller,\n action,\n uid: actionUID,\n });\n })\n );\n }\n }\n };\n\n // Create an instance of a content-API permission engine\n // and binds a custom validation handler to it\n const engine = createPermissionEngine({ providers });\n\n engine.on(\n 'before-format::validate.permission',\n createValidatePermissionHandler(providers.action)\n );\n\n return {\n engine,\n providers,\n registerActions,\n getActionsMap,\n };\n};\n"],"names":["typeSymbol","Symbol","for","createValidatePermissionHandler","actionProvider","permission","action","get","strapi","log","debug","providers","createActionProvider","condition","createConditionProvider","getActionsMap","actionMap","isContentApi","_","has","includes","registerAPIsActions","apis","source","forEach","api","apiName","controllers","reduce","acc","controller","controllerName","contentApiActions","pickBy","isEmpty","Object","keys","plugins","registerActions","actionsMap","value","entries","actions","Promise","all","map","actionUID","register","uid","engine","createPermissionEngine","on"],"mappings":";;;;;;;AAKA,MAAMA,UAAAA,GAAaC,MAAOC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAM9B;;AAEC,IACD,MAAMC,+BACJ,GAAA,CAACC,iBACD,CAAC,EAAEC,UAAU,EAAE,GAAA;AACb,QAAA,MAAMC,MAASF,GAAAA,cAAAA,CAAeG,GAAG,CAACF,WAAWC,MAAM,CAAA;;AAGnD,QAAA,IAAI,CAACA,MAAQ,EAAA;YACXE,MAAOC,CAAAA,GAAG,CAACC,KAAK,CACd,CAAC,gBAAgB,EAAEL,UAAWC,CAAAA,MAAM,CAAC,4CAA4C,CAAC,CAAA;YAGpF,OAAO,KAAA;AACT;QAEA,OAAO,IAAA;AACT,KAAA;AAEF;;;IAIA,sCAAe,CAAA,CAACE,OAAAA,GAAAA;;;AAGd,IAAA,MAAMG,SAAY,GAAA;QAChBL,MAAQM,EAAAA,MAAAA,EAAAA;QACRC,SAAWC,EAAAA,SAAAA;AACb,KAAA;AAEA;;;;;AAKC,MACD,MAAMC,aAAgB,GAAA,IAAA;AACpB,QAAA,MAAMC,YAKF,EAAC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AA;AAEA;;;AAGC,MACD,MAAMsB,eAAkB,GAAA,UAAA;AACtB,QAAA,MAAMC,UAAaxB,GAAAA,aAAAA,EAAAA;;QAGnB,KAAK,MAAM,CAACU,GAAKe,EAAAA,KAAAA,CAAM,IAAIL,MAAOM,CAAAA,OAAO,CAACF,UAAa,CAAA,CAAA;YACrD,MAAM,EAAEZ,WAAW,EAAE,GAAGa,KAAAA;;YAGxB,KAAK,MAAM,CAACV,UAAYY,EAAAA,OAAAA,CAAQ,IAAIP,MAAOM,CAAAA,OAAO,CAACd,WAAc,CAAA,CAAA;;AAE/D,gBAAA,MAAMgB,QAAQC,GAAG,CACfF,OAAQG,CAAAA,GAAG,CAAC,CAACvC,MAAAA,GAAAA;oBACX,MAAMwC,SAAAA,GAAY,GAAGrB,GAAI,CAAA,CAAC,EAAEK,UAAW,CAAA,CAAC,EAAExB,MAAQ,CAAA,CAAA;AAElD,oBAAA,OAAOK,SAAUL,CAAAA,MAAM,CAACyC,QAAQ,CAACD,SAAW,EAAA;AAC1CrB,wBAAAA,GAAAA;AACAK,wBAAAA,UAAAA;AACAxB,wBAAAA,MAAAA;wBACA0C,GAAKF,EAAAA;AACP,qBAAA,CAAA;AACF,iBAAA,CAAA,CAAA;AAEJ;AACF;AACF,KAAA;;;AAIA,IAAA,MAAMG,WAASC,MAAuB,CAAA;AAAEvC,QAAAA;AAAU,KAAA,CAAA;AAElDsC,IAAAA,QAAAA,CAAOE,EAAE,CACP,oCACAhD,EAAAA,+BAAAA,CAAgCQ,UAAUL,MAAM,CAAA,CAAA;IAGlD,OAAO;AACL2C,gBAAAA,QAAAA;AACAtC,QAAAA,SAAAA;AACA2B,QAAAA,eAAAA;AACAvB,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/services/content-api/permissions/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\nimport { createActionProvider, createConditionProvider } from './providers';\nimport createPermissionEngine from './engine';\n\nconst typeSymbol = Symbol.for('__type__');\n\ninterface ValidatePermissionHandler {\n (params: { permission: { action: string } }): boolean;\n}\n\n/**\n * Creates a handler that checks if the permission's action exists in the action registry\n */\nconst createValidatePermissionHandler =\n (actionProvider: ReturnType<typeof createActionProvider>): ValidatePermissionHandler =>\n ({ permission }) => {\n const action = actionProvider.get(permission.action);\n\n // If the action isn't registered into the action provider, then ignore the permission and warn the user\n if (!action) {\n strapi.log.debug(\n `Unknown action \"${permission.action}\" supplied when registering a new permission`\n );\n\n return false;\n }\n\n return true;\n };\n\n/**\n * Create instances of providers and permission engine for the core content-API service.\n * Also, expose utilities to get information about available actions and such.\n */\nexport default (strapi: Core.Strapi) => {\n // NOTE: Here we define both an action and condition provider,\n // but at the moment, we're only using the action one.\n const providers = {\n action: createActionProvider(),\n condition: createConditionProvider(),\n };\n\n /**\n * Get a tree representation of the available Content API actions\n * based on the methods of the Content API controllers.\n *\n * @note Only actions bound to a content-API route are returned.\n */\n const getActionsMap = () => {\n const actionMap: Record<\n string,\n {\n controllers: Record<string, string[]>;\n }\n > = {};\n\n /**\n * Check if a controller's action is bound to the\n * content-api by looking at a potential __type__ symbol\n */\n const isContentApi = (action: Core.ControllerHandler & { [s: symbol]: any }) => {\n if (!_.has(action, typeSymbol)) {\n return false;\n }\n\n return action[typeSymbol].includes('content-api');\n };\n\n /**\n * Register actions from a specific API source into the result tree\n */\n const registerAPIsActions = (\n apis: Record<string, Core.Plugin | Core.Module>,\n source: 'api' | 'plugin'\n ) => {\n _.forEach(apis, (api, apiName) => {\n const controllers = _.reduce(\n api.controllers,\n (acc, controller, controllerName) => {\n const contentApiActions = _.pickBy(controller, isContentApi);\n\n if (_.isEmpty(contentApiActions)) {\n return acc;\n }\n\n acc[controllerName] = Object.keys(contentApiActions);\n\n return acc;\n },\n {} as Record<string, string[]>\n );\n\n if (!_.isEmpty(controllers)) {\n actionMap[`${source}::${apiName}`] = { controllers };\n }\n });\n };\n\n registerAPIsActions(strapi.apis, 'api');\n registerAPIsActions(strapi.plugins, 'plugin');\n\n return actionMap;\n };\n\n /**\n * Register all the content-API controllers actions into the action provider.\n * This method make use of the {@link getActionsMap} to generate the list of actions to register.\n */\n const registerActions = async () => {\n const actionsMap = getActionsMap();\n\n // For each API\n for (const [api, value] of Object.entries(actionsMap)) {\n const { controllers } = value;\n\n // Register controllers methods as actions\n for (const [controller, actions] of Object.entries(controllers)) {\n // Register each action individually\n await Promise.all(\n actions.map((action) => {\n const actionUID = `${api}.${controller}.${action}`;\n\n return providers.action.register(actionUID, {\n api,\n controller,\n action,\n uid: actionUID,\n });\n })\n );\n }\n }\n };\n\n // Create an instance of a content-API permission engine\n // and binds a custom validation handler to it\n const engine = createPermissionEngine({ providers });\n\n engine.on(\n 'before-format::validate.permission',\n createValidatePermissionHandler(providers.action)\n );\n\n return {\n engine,\n providers,\n registerActions,\n getActionsMap,\n };\n};\n"],"names":["typeSymbol","Symbol","for","createValidatePermissionHandler","actionProvider","permission","action","get","strapi","log","debug","providers","createActionProvider","condition","createConditionProvider","getActionsMap","actionMap","isContentApi","_","has","includes","registerAPIsActions","apis","source","forEach","api","apiName","controllers","reduce","acc","controller","controllerName","contentApiActions","pickBy","isEmpty","Object","keys","plugins","registerActions","actionsMap","value","entries","actions","Promise","all","map","actionUID","register","uid","engine","createPermissionEngine","on"],"mappings":";;;;;AAKA,MAAMA,UAAAA,GAAaC,MAAOC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAM9B;;AAEC,IACD,MAAMC,+BACJ,GAAA,CAACC,iBACD,CAAC,EAAEC,UAAU,EAAE,GAAA;AACb,QAAA,MAAMC,MAASF,GAAAA,cAAAA,CAAeG,GAAG,CAACF,WAAWC,MAAM,CAAA;;AAGnD,QAAA,IAAI,CAACA,MAAQ,EAAA;YACXE,MAAOC,CAAAA,GAAG,CAACC,KAAK,CACd,CAAC,gBAAgB,EAAEL,UAAWC,CAAAA,MAAM,CAAC,4CAA4C,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,"file":"index.mjs","sources":["../../../../src/services/content-api/permissions/index.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\nimport { createActionProvider, createConditionProvider } from './providers';\nimport createPermissionEngine from './engine';\n\nconst typeSymbol = Symbol.for('__type__');\n\ninterface ValidatePermissionHandler {\n (params: { permission: { action: string } }): boolean;\n}\n\n/**\n * Creates a handler that checks if the permission's action exists in the action registry\n */\nconst createValidatePermissionHandler =\n (actionProvider: ReturnType<typeof createActionProvider>): ValidatePermissionHandler =>\n ({ permission }) => {\n const action = actionProvider.get(permission.action);\n\n // If the action isn't registered into the action provider, then ignore the permission and warn the user\n if (!action) {\n strapi.log.debug(\n `Unknown action \"${permission.action}\" supplied when registering a new permission`\n );\n\n return false;\n }\n\n return true;\n };\n\n/**\n * Create instances of providers and permission engine for the core content-API service.\n * Also, expose utilities to get information about available actions and such.\n */\nexport default (strapi: Core.Strapi) => {\n // NOTE: Here we define both an action and condition provider,\n // but at the moment, we're only using the action one.\n const providers = {\n action: createActionProvider(),\n condition: createConditionProvider(),\n };\n\n /**\n * Get a tree representation of the available Content API actions\n * based on the methods of the Content API controllers.\n *\n * @note Only actions bound to a content-API route are returned.\n */\n const getActionsMap = () => {\n const actionMap: Record<\n string,\n {\n controllers: Record<string, string[]>;\n }\n > = {};\n\n /**\n * Check if a controller's action is bound to the\n * content-api by looking at a potential __type__ symbol\n */\n const isContentApi = (action: Core.ControllerHandler & { [s: symbol]: any }) => {\n if (!_.has(action, typeSymbol)) {\n return false;\n }\n\n return action[typeSymbol].includes('content-api');\n };\n\n /**\n * Register actions from a specific API source into the result tree\n */\n const registerAPIsActions = (\n apis: Record<string, Core.Plugin | Core.Module>,\n source: 'api' | 'plugin'\n ) => {\n _.forEach(apis, (api, apiName) => {\n const controllers = _.reduce(\n api.controllers,\n (acc, controller, controllerName) => {\n const contentApiActions = _.pickBy(controller, isContentApi);\n\n if (_.isEmpty(contentApiActions)) {\n return acc;\n }\n\n acc[controllerName] = Object.keys(contentApiActions);\n\n return acc;\n },\n {} as Record<string, string[]>\n );\n\n if (!_.isEmpty(controllers)) {\n actionMap[`${source}::${apiName}`] = { controllers };\n }\n });\n };\n\n registerAPIsActions(strapi.apis, 'api');\n registerAPIsActions(strapi.plugins, 'plugin');\n\n return actionMap;\n };\n\n /**\n * Register all the content-API controllers actions into the action provider.\n * This method make use of the {@link getActionsMap} to generate the list of actions to register.\n */\n const registerActions = async () => {\n const actionsMap = getActionsMap();\n\n // For each API\n for (const [api, value] of Object.entries(actionsMap)) {\n const { controllers } = value;\n\n // Register controllers methods as actions\n for (const [controller, actions] of Object.entries(controllers)) {\n // Register each action individually\n await Promise.all(\n actions.map((action) => {\n const actionUID = `${api}.${controller}.${action}`;\n\n return providers.action.register(actionUID, {\n api,\n controller,\n action,\n uid: actionUID,\n });\n })\n );\n }\n }\n };\n\n // Create an instance of a content-API permission engine\n // and binds a custom validation handler to it\n const engine = createPermissionEngine({ providers });\n\n engine.on(\n 'before-format::validate.permission',\n createValidatePermissionHandler(providers.action)\n );\n\n return {\n engine,\n providers,\n registerActions,\n getActionsMap,\n };\n};\n"],"names":["typeSymbol","Symbol","for","createValidatePermissionHandler","actionProvider","permission","action","get","strapi","log","debug","providers","createActionProvider","condition","createConditionProvider","getActionsMap","actionMap","isContentApi","_","has","includes","registerAPIsActions","apis","source","forEach","api","apiName","controllers","reduce","acc","controller","controllerName","contentApiActions","pickBy","isEmpty","Object","keys","plugins","registerActions","actionsMap","value","entries","actions","Promise","all","map","actionUID","register","uid","engine","createPermissionEngine","on"],"mappings":";;;;;AAKA,MAAMA,UAAAA,GAAaC,MAAOC,CAAAA,GAAG,CAAC,UAAA,CAAA;AAM9B;;AAEC,IACD,MAAMC,+BACJ,GAAA,CAACC,iBACD,CAAC,EAAEC,UAAU,EAAE,GAAA;AACb,QAAA,MAAMC,MAASF,GAAAA,cAAAA,CAAeG,GAAG,CAACF,WAAWC,MAAM,CAAA;;AAGnD,QAAA,IAAI,CAACA,MAAQ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,CAAA;AAAEvC,QAAAA;AAAU,KAAA,CAAA;AAElDsC,IAAAA,MAAAA,CAAOE,EAAE,CACP,oCACAhD,EAAAA,+BAAAA,CAAgCQ,UAAUL,MAAM,CAAA,CAAA;IAGlD,OAAO;AACL2C,QAAAA,MAAAA;AACAtC,QAAAA,SAAAA;AACA2B,QAAAA,eAAAA;AACAvB,QAAAA;AACF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Core, Struct } from '@strapi/types';
|
|
2
|
+
import type { FieldContentSourceMap } from '@strapi/admin/strapi-admin';
|
|
3
|
+
interface EncodingInfo {
|
|
4
|
+
data: any;
|
|
5
|
+
schema: Struct.Schema;
|
|
6
|
+
}
|
|
7
|
+
declare const createContentSourceMapsService: (strapi: Core.Strapi) => {
|
|
8
|
+
encodeField(text: string, { kind, model, documentId, type, path, locale }: FieldContentSourceMap): string;
|
|
9
|
+
encodeEntry({ data, schema }: EncodingInfo): Promise<any>;
|
|
10
|
+
encodeSourceMaps({ data, schema }: EncodingInfo): Promise<any>;
|
|
11
|
+
};
|
|
12
|
+
export { createContentSourceMapsService };
|
|
13
|
+
//# sourceMappingURL=content-source-maps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-source-maps.d.ts","sourceRoot":"","sources":["../../src/services/content-source-maps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAO,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAwCxE,UAAU,YAAY;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;CACvB;AAMD,QAAA,MAAM,8BAA8B,WAAY,KAAK,MAAM;sBAG/C,MAAM,mDACqC,qBAAqB;kCAyBpC,YAAY,GAAG,QAAQ,GAAG,CAAC;uCAiCtB,YAAY,GAAG,QAAQ,GAAG,CAAC;CAmBvE,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var stega = require('@vercel/stega');
|
|
4
|
+
var strapiUtils = require('@strapi/utils');
|
|
5
|
+
|
|
6
|
+
const ENCODABLE_TYPES = [
|
|
7
|
+
'string',
|
|
8
|
+
'text',
|
|
9
|
+
'richtext',
|
|
10
|
+
'biginteger',
|
|
11
|
+
'date',
|
|
12
|
+
'time',
|
|
13
|
+
'datetime',
|
|
14
|
+
'timestamp',
|
|
15
|
+
'boolean',
|
|
16
|
+
'enumeration',
|
|
17
|
+
'json',
|
|
18
|
+
'media',
|
|
19
|
+
'email',
|
|
20
|
+
'password'
|
|
21
|
+
];
|
|
22
|
+
// TODO: use a centralized store for these fields that would be shared with the CM and CTB
|
|
23
|
+
const EXCLUDED_FIELDS = [
|
|
24
|
+
'id',
|
|
25
|
+
'documentId',
|
|
26
|
+
'locale',
|
|
27
|
+
'localizations',
|
|
28
|
+
'created_by',
|
|
29
|
+
'updated_by',
|
|
30
|
+
'created_at',
|
|
31
|
+
'updated_at',
|
|
32
|
+
'publishedAt'
|
|
33
|
+
];
|
|
34
|
+
const isObject = (value)=>{
|
|
35
|
+
return typeof value === 'object' && value !== null;
|
|
36
|
+
};
|
|
37
|
+
const createContentSourceMapsService = (strapi)=>{
|
|
38
|
+
return {
|
|
39
|
+
encodeField (text, { kind, model, documentId, type, path, locale }) {
|
|
40
|
+
/**
|
|
41
|
+
* Combine all metadata into into a one string so we only have to deal with one data-atribute
|
|
42
|
+
* on the frontend. Make it human readable because that data-attribute may be set manually by
|
|
43
|
+
* users for fields that don't support sourcemap encoding.
|
|
44
|
+
*/ const strapiSource = new URLSearchParams();
|
|
45
|
+
strapiSource.set('documentId', documentId);
|
|
46
|
+
strapiSource.set('type', type);
|
|
47
|
+
strapiSource.set('path', path);
|
|
48
|
+
if (model) {
|
|
49
|
+
strapiSource.set('model', model);
|
|
50
|
+
}
|
|
51
|
+
if (kind) {
|
|
52
|
+
strapiSource.set('kind', kind);
|
|
53
|
+
}
|
|
54
|
+
if (locale) {
|
|
55
|
+
strapiSource.set('locale', locale);
|
|
56
|
+
}
|
|
57
|
+
return stega.vercelStegaCombine(text, {
|
|
58
|
+
strapiSource: strapiSource.toString()
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
async encodeEntry ({ data, schema }) {
|
|
62
|
+
if (!isObject(data) || data === undefined) {
|
|
63
|
+
return data;
|
|
64
|
+
}
|
|
65
|
+
return strapiUtils.traverseEntity(({ key, value, attribute, schema, path }, { set })=>{
|
|
66
|
+
if (!attribute || EXCLUDED_FIELDS.includes(key)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {
|
|
70
|
+
set(key, this.encodeField(value, {
|
|
71
|
+
path: path.rawWithIndices,
|
|
72
|
+
type: attribute.type,
|
|
73
|
+
kind: schema.kind,
|
|
74
|
+
model: schema.uid,
|
|
75
|
+
locale: data.locale,
|
|
76
|
+
documentId: data.documentId
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
schema,
|
|
81
|
+
getModel: (uid)=>strapi.getModel(uid)
|
|
82
|
+
}, data);
|
|
83
|
+
},
|
|
84
|
+
async encodeSourceMaps ({ data, schema }) {
|
|
85
|
+
try {
|
|
86
|
+
if (Array.isArray(data)) {
|
|
87
|
+
return await Promise.all(data.map((item)=>this.encodeSourceMaps({
|
|
88
|
+
data: item,
|
|
89
|
+
schema
|
|
90
|
+
})));
|
|
91
|
+
}
|
|
92
|
+
if (!isObject(data)) {
|
|
93
|
+
return data;
|
|
94
|
+
}
|
|
95
|
+
return await this.encodeEntry({
|
|
96
|
+
data,
|
|
97
|
+
schema
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
strapi.log.error('Error encoding source maps:', error);
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.createContentSourceMapsService = createContentSourceMapsService;
|
|
108
|
+
//# sourceMappingURL=content-source-maps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-source-maps.js","sources":["../../src/services/content-source-maps.ts"],"sourcesContent":["import { vercelStegaCombine } from '@vercel/stega';\nimport type { Core, Struct, UID } from '@strapi/types';\nimport { traverseEntity } from '@strapi/utils';\nimport type { FieldContentSourceMap } from '@strapi/admin/strapi-admin';\n\nconst ENCODABLE_TYPES = [\n 'string',\n 'text',\n 'richtext',\n 'biginteger',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n 'enumeration',\n 'json',\n 'media',\n 'email',\n 'password',\n /**\n * We cannot modify the response shape, so types that aren't based on string cannot be encoded:\n * - json: object\n * - blocks: object, will require a custom implementation in a dedicated PR\n * - integer, float and decimal: number\n * - boolean: boolean (believe it or not)\n * - uid: can be stringified but would mess up URLs\n */\n];\n\n// TODO: use a centralized store for these fields that would be shared with the CM and CTB\nconst EXCLUDED_FIELDS = [\n 'id',\n 'documentId',\n 'locale',\n 'localizations',\n 'created_by',\n 'updated_by',\n 'created_at',\n 'updated_at',\n 'publishedAt',\n];\n\ninterface EncodingInfo {\n data: any;\n schema: Struct.Schema;\n}\n\nconst isObject = (value: unknown): value is Record<string, any> => {\n return typeof value === 'object' && value !== null;\n};\n\nconst createContentSourceMapsService = (strapi: Core.Strapi) => {\n return {\n encodeField(\n text: string,\n { kind, model, documentId, type, path, locale }: FieldContentSourceMap\n ) {\n /**\n * Combine all metadata into into a one string so we only have to deal with one data-atribute\n * on the frontend. Make it human readable because that data-attribute may be set manually by\n * users for fields that don't support sourcemap encoding.\n */\n const strapiSource = new URLSearchParams();\n strapiSource.set('documentId', documentId);\n strapiSource.set('type', type);\n strapiSource.set('path', path);\n\n if (model) {\n strapiSource.set('model', model);\n }\n if (kind) {\n strapiSource.set('kind', kind);\n }\n if (locale) {\n strapiSource.set('locale', locale);\n }\n\n return vercelStegaCombine(text, { strapiSource: strapiSource.toString() });\n },\n\n async encodeEntry({ data, schema }: EncodingInfo): Promise<any> {\n if (!isObject(data) || data === undefined) {\n return data;\n }\n\n return traverseEntity(\n ({ key, value, attribute, schema, path }, { set }) => {\n if (!attribute || EXCLUDED_FIELDS.includes(key)) {\n return;\n }\n\n if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {\n set(\n key,\n this.encodeField(value, {\n path: path.rawWithIndices!,\n type: attribute.type,\n kind: schema.kind,\n model: schema.uid as UID.Schema,\n locale: data.locale,\n documentId: data.documentId,\n }) as any\n );\n }\n },\n {\n schema,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n data\n );\n },\n\n async encodeSourceMaps({ data, schema }: EncodingInfo): Promise<any> {\n try {\n if (Array.isArray(data)) {\n return await Promise.all(\n data.map((item) => this.encodeSourceMaps({ data: item, schema }))\n );\n }\n\n if (!isObject(data)) {\n return data;\n }\n\n return await this.encodeEntry({ data, schema });\n } catch (error) {\n strapi.log.error('Error encoding source maps:', error);\n return data;\n }\n },\n };\n};\n\nexport { createContentSourceMapsService };\n"],"names":["ENCODABLE_TYPES","EXCLUDED_FIELDS","isObject","value","createContentSourceMapsService","strapi","encodeField","text","kind","model","documentId","type","path","locale","strapiSource","URLSearchParams","set","vercelStegaCombine","toString","encodeEntry","data","schema","undefined","traverseEntity","key","attribute","includes","rawWithIndices","uid","getModel","encodeSourceMaps","Array","isArray","Promise","all","map","item","error","log"],"mappings":";;;;;AAKA,MAAMA,eAAkB,GAAA;AACtB,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,YAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA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A,CAAQC,GAAG,CACtBd,IAAKe,CAAAA,GAAG,CAAC,CAACC,IAAS,GAAA,IAAI,CAACN,gBAAgB,CAAC;4BAAEV,IAAMgB,EAAAA,IAAAA;AAAMf,4BAAAA;AAAO,yBAAA,CAAA,CAAA,CAAA;AAElE;gBAEA,IAAI,CAACnB,SAASkB,IAAO,CAAA,EAAA;oBACnB,OAAOA,IAAAA;AACT;AAEA,gBAAA,OAAO,MAAM,IAAI,CAACD,WAAW,CAAC;AAAEC,oBAAAA,IAAAA;AAAMC,oBAAAA;AAAO,iBAAA,CAAA;AAC/C,aAAA,CAAE,OAAOgB,KAAO,EAAA;AACdhC,gBAAAA,MAAAA,CAAOiC,GAAG,CAACD,KAAK,CAAC,6BAA+BA,EAAAA,KAAAA,CAAAA;gBAChD,OAAOjB,IAAAA;AACT;AACF;AACF,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { vercelStegaCombine } from '@vercel/stega';
|
|
2
|
+
import { traverseEntity } from '@strapi/utils';
|
|
3
|
+
|
|
4
|
+
const ENCODABLE_TYPES = [
|
|
5
|
+
'string',
|
|
6
|
+
'text',
|
|
7
|
+
'richtext',
|
|
8
|
+
'biginteger',
|
|
9
|
+
'date',
|
|
10
|
+
'time',
|
|
11
|
+
'datetime',
|
|
12
|
+
'timestamp',
|
|
13
|
+
'boolean',
|
|
14
|
+
'enumeration',
|
|
15
|
+
'json',
|
|
16
|
+
'media',
|
|
17
|
+
'email',
|
|
18
|
+
'password'
|
|
19
|
+
];
|
|
20
|
+
// TODO: use a centralized store for these fields that would be shared with the CM and CTB
|
|
21
|
+
const EXCLUDED_FIELDS = [
|
|
22
|
+
'id',
|
|
23
|
+
'documentId',
|
|
24
|
+
'locale',
|
|
25
|
+
'localizations',
|
|
26
|
+
'created_by',
|
|
27
|
+
'updated_by',
|
|
28
|
+
'created_at',
|
|
29
|
+
'updated_at',
|
|
30
|
+
'publishedAt'
|
|
31
|
+
];
|
|
32
|
+
const isObject = (value)=>{
|
|
33
|
+
return typeof value === 'object' && value !== null;
|
|
34
|
+
};
|
|
35
|
+
const createContentSourceMapsService = (strapi)=>{
|
|
36
|
+
return {
|
|
37
|
+
encodeField (text, { kind, model, documentId, type, path, locale }) {
|
|
38
|
+
/**
|
|
39
|
+
* Combine all metadata into into a one string so we only have to deal with one data-atribute
|
|
40
|
+
* on the frontend. Make it human readable because that data-attribute may be set manually by
|
|
41
|
+
* users for fields that don't support sourcemap encoding.
|
|
42
|
+
*/ const strapiSource = new URLSearchParams();
|
|
43
|
+
strapiSource.set('documentId', documentId);
|
|
44
|
+
strapiSource.set('type', type);
|
|
45
|
+
strapiSource.set('path', path);
|
|
46
|
+
if (model) {
|
|
47
|
+
strapiSource.set('model', model);
|
|
48
|
+
}
|
|
49
|
+
if (kind) {
|
|
50
|
+
strapiSource.set('kind', kind);
|
|
51
|
+
}
|
|
52
|
+
if (locale) {
|
|
53
|
+
strapiSource.set('locale', locale);
|
|
54
|
+
}
|
|
55
|
+
return vercelStegaCombine(text, {
|
|
56
|
+
strapiSource: strapiSource.toString()
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
async encodeEntry ({ data, schema }) {
|
|
60
|
+
if (!isObject(data) || data === undefined) {
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
return traverseEntity(({ key, value, attribute, schema, path }, { set })=>{
|
|
64
|
+
if (!attribute || EXCLUDED_FIELDS.includes(key)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {
|
|
68
|
+
set(key, this.encodeField(value, {
|
|
69
|
+
path: path.rawWithIndices,
|
|
70
|
+
type: attribute.type,
|
|
71
|
+
kind: schema.kind,
|
|
72
|
+
model: schema.uid,
|
|
73
|
+
locale: data.locale,
|
|
74
|
+
documentId: data.documentId
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
schema,
|
|
79
|
+
getModel: (uid)=>strapi.getModel(uid)
|
|
80
|
+
}, data);
|
|
81
|
+
},
|
|
82
|
+
async encodeSourceMaps ({ data, schema }) {
|
|
83
|
+
try {
|
|
84
|
+
if (Array.isArray(data)) {
|
|
85
|
+
return await Promise.all(data.map((item)=>this.encodeSourceMaps({
|
|
86
|
+
data: item,
|
|
87
|
+
schema
|
|
88
|
+
})));
|
|
89
|
+
}
|
|
90
|
+
if (!isObject(data)) {
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
return await this.encodeEntry({
|
|
94
|
+
data,
|
|
95
|
+
schema
|
|
96
|
+
});
|
|
97
|
+
} catch (error) {
|
|
98
|
+
strapi.log.error('Error encoding source maps:', error);
|
|
99
|
+
return data;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export { createContentSourceMapsService };
|
|
106
|
+
//# sourceMappingURL=content-source-maps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-source-maps.mjs","sources":["../../src/services/content-source-maps.ts"],"sourcesContent":["import { vercelStegaCombine } from '@vercel/stega';\nimport type { Core, Struct, UID } from '@strapi/types';\nimport { traverseEntity } from '@strapi/utils';\nimport type { FieldContentSourceMap } from '@strapi/admin/strapi-admin';\n\nconst ENCODABLE_TYPES = [\n 'string',\n 'text',\n 'richtext',\n 'biginteger',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n 'enumeration',\n 'json',\n 'media',\n 'email',\n 'password',\n /**\n * We cannot modify the response shape, so types that aren't based on string cannot be encoded:\n * - json: object\n * - blocks: object, will require a custom implementation in a dedicated PR\n * - integer, float and decimal: number\n * - boolean: boolean (believe it or not)\n * - uid: can be stringified but would mess up URLs\n */\n];\n\n// TODO: use a centralized store for these fields that would be shared with the CM and CTB\nconst EXCLUDED_FIELDS = [\n 'id',\n 'documentId',\n 'locale',\n 'localizations',\n 'created_by',\n 'updated_by',\n 'created_at',\n 'updated_at',\n 'publishedAt',\n];\n\ninterface EncodingInfo {\n data: any;\n schema: Struct.Schema;\n}\n\nconst isObject = (value: unknown): value is Record<string, any> => {\n return typeof value === 'object' && value !== null;\n};\n\nconst createContentSourceMapsService = (strapi: Core.Strapi) => {\n return {\n encodeField(\n text: string,\n { kind, model, documentId, type, path, locale }: FieldContentSourceMap\n ) {\n /**\n * Combine all metadata into into a one string so we only have to deal with one data-atribute\n * on the frontend. Make it human readable because that data-attribute may be set manually by\n * users for fields that don't support sourcemap encoding.\n */\n const strapiSource = new URLSearchParams();\n strapiSource.set('documentId', documentId);\n strapiSource.set('type', type);\n strapiSource.set('path', path);\n\n if (model) {\n strapiSource.set('model', model);\n }\n if (kind) {\n strapiSource.set('kind', kind);\n }\n if (locale) {\n strapiSource.set('locale', locale);\n }\n\n return vercelStegaCombine(text, { strapiSource: strapiSource.toString() });\n },\n\n async encodeEntry({ data, schema }: EncodingInfo): Promise<any> {\n if (!isObject(data) || data === undefined) {\n return data;\n }\n\n return traverseEntity(\n ({ key, value, attribute, schema, path }, { set }) => {\n if (!attribute || EXCLUDED_FIELDS.includes(key)) {\n return;\n }\n\n if (ENCODABLE_TYPES.includes(attribute.type) && typeof value === 'string') {\n set(\n key,\n this.encodeField(value, {\n path: path.rawWithIndices!,\n type: attribute.type,\n kind: schema.kind,\n model: schema.uid as UID.Schema,\n locale: data.locale,\n documentId: data.documentId,\n }) as any\n );\n }\n },\n {\n schema,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n data\n );\n },\n\n async encodeSourceMaps({ data, schema }: EncodingInfo): Promise<any> {\n try {\n if (Array.isArray(data)) {\n return await Promise.all(\n data.map((item) => this.encodeSourceMaps({ data: item, schema }))\n );\n }\n\n if (!isObject(data)) {\n return data;\n }\n\n return await this.encodeEntry({ data, schema });\n } catch (error) {\n strapi.log.error('Error encoding source maps:', error);\n return data;\n }\n },\n };\n};\n\nexport { createContentSourceMapsService };\n"],"names":["ENCODABLE_TYPES","EXCLUDED_FIELDS","isObject","value","createContentSourceMapsService","strapi","encodeField","text","kind","model","documentId","type","path","locale","strapiSource","URLSearchParams","set","vercelStegaCombine","toString","encodeEntry","data","schema","undefined","traverseEntity","key","attribute","includes","rawWithIndices","uid","getModel","encodeSourceMaps","Array","isArray","Promise","all","map","item","error","log"],"mappings":";;;AAKA,MAAMA,eAAkB,GAAA;AACtB,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,YAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,OAAA;AACA,IAAA;AASD,CAAA;AAED;AACA,MAAMC,eAAkB,GAAA;AACtB,IAAA,IAAA;AACA,IAAA,YAAA;AACA,IAAA,QAAA;AACA,IAAA,eAAA;AACA,IAAA,YAAA;AACA,IAAA,YAAA;AACA,IAAA,YAAA;AACA,IAAA,YAAA;AACA,IAAA;AACD,CAAA;AAOD,MAAMC,WAAW,CAACC,KAAAA,GAAAA;IAChB,OAAO,OAAOA,KAAU,KAAA,QAAA,IAAYA,KAAU,KAAA,IAAA;AAChD,CAAA;AAEA,MAAMC,iCAAiC,CAACC,MAAAA,GAAAA;IACtC,OAAO;AACLC,QAAAA,WAAAA,CAAAA,CACEC,IAAY,EACZ,EAAEC,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAyB,EAAA;AAEtE;;;;UAKA,MAAMC,eAAe,IAAIC,eAAAA,EAAAA;YACzBD,YAAaE,CAAAA,GAAG,CAAC,YAAcN,EAAAA,UAAAA,CAAAA;YAC/BI,YAAaE,CAAAA,GAAG,CAAC,MAAQL,EAAAA,IAAAA,CAAAA;YACzBG,YAAaE,CAAAA,GAAG,CAAC,MAAQJ,EAAAA,IAAAA,CAAAA;AAEzB,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