@strapi/core 5.29.0 → 5.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Strapi.js +14 -16
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs +14 -16
- 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/container.js.map +1 -1
- package/dist/container.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/mappers.js.map +1 -1
- package/dist/core-api/routes/validation/mappers.mjs.map +1 -1
- package/dist/core-api/routes/validation/utils.js.map +1 -1
- 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.map +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 +12 -12
- package/dist/package.json.mjs +12 -12
- 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.js.map +1 -1
- package/dist/services/content-api/index.mjs.map +1 -1
- package/dist/services/content-api/permissions/index.js.map +1 -1
- package/dist/services/content-api/permissions/index.mjs.map +1 -1
- package/dist/services/core-store.js.map +1 -1
- package/dist/services/core-store.mjs.map +1 -1
- package/dist/services/document-service/components.js.map +1 -1
- package/dist/services/document-service/components.mjs.map +1 -1
- package/dist/services/document-service/repository.js +1 -1
- package/dist/services/document-service/repository.js.map +1 -1
- package/dist/services/document-service/repository.mjs +1 -1
- 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.map +1 -1
- 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/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/sender.js.map +1 -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.js.map +1 -1
- package/dist/services/session-manager.mjs.map +1 -1
- package/dist/services/webhook-runner.js.map +1 -1
- package/dist/services/webhook-runner.mjs.map +1 -1
- package/dist/services/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 +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.mjs","sources":["../../src/middlewares/security.ts"],"sourcesContent":["import { defaultsDeep, mergeWith } from 'lodash/fp';\nimport helmet, { KoaHelmet } from 'koa-helmet';\n\nimport type { Core } from '@strapi/types';\n\nexport type Config = NonNullable<Parameters<KoaHelmet>[0]>;\n\nconst defaults: Config = {\n crossOriginEmbedderPolicy: false,\n crossOriginOpenerPolicy: false,\n crossOriginResourcePolicy: false,\n originAgentCluster: false,\n contentSecurityPolicy: {\n useDefaults: true,\n directives: {\n
|
|
1
|
+
{"version":3,"file":"security.mjs","sources":["../../src/middlewares/security.ts"],"sourcesContent":["import { defaultsDeep, mergeWith } from 'lodash/fp';\nimport helmet, { KoaHelmet } from 'koa-helmet';\nimport { CSP_DEFAULTS } from '@strapi/utils';\n\nimport type { Core } from '@strapi/types';\n\nexport type Config = NonNullable<Parameters<KoaHelmet>[0]>;\n\nconst defaults: Config = {\n crossOriginEmbedderPolicy: false,\n crossOriginOpenerPolicy: false,\n crossOriginResourcePolicy: false,\n originAgentCluster: false,\n contentSecurityPolicy: {\n useDefaults: true,\n directives: {\n ...CSP_DEFAULTS,\n upgradeInsecureRequests: null,\n },\n },\n xssFilter: false,\n hsts: {\n maxAge: 31536000,\n includeSubDomains: true,\n },\n frameguard: {\n action: 'sameorigin',\n },\n};\n\nconst mergeConfig = (existingConfig: Config, newConfig: Config) => {\n return mergeWith(\n (obj, src) => (Array.isArray(obj) && Array.isArray(src) ? obj.concat(src) : undefined),\n existingConfig,\n newConfig\n );\n};\n\nexport const security: Core.MiddlewareFactory<Config> =\n (config, { strapi }) =>\n (ctx, next) => {\n let helmetConfig: Config = defaultsDeep(defaults, config);\n const specialPaths = ['/documentation'];\n\n const directives: {\n 'script-src': string[];\n 'img-src': string[];\n 'manifest-src': string[];\n 'frame-src': string[];\n } = {\n 'script-src': [\"'self'\", \"'unsafe-inline'\", 'cdn.jsdelivr.net'],\n 'img-src': [\"'self'\", 'data:', 'cdn.jsdelivr.net', 'strapi.io'],\n 'manifest-src': [],\n 'frame-src': [],\n };\n\n // if apollo graphql playground is enabled, add exceptions for it\n if (strapi.plugin('graphql')?.service('utils').playground.isEnabled()) {\n const { config: gqlConfig } = strapi.plugin('graphql');\n specialPaths.push(gqlConfig('endpoint'));\n\n directives['script-src'].push(`https: 'unsafe-inline'`);\n directives['img-src'].push(`'apollo-server-landing-page.cdn.apollographql.com'`);\n directives['manifest-src'].push(`'self'`);\n directives['manifest-src'].push('apollo-server-landing-page.cdn.apollographql.com');\n directives['frame-src'].push(`'self'`);\n directives['frame-src'].push('sandbox.embed.apollographql.com');\n }\n\n // TODO: we shouldn't combine playground exceptions with documentation for all routes, we should first check the path and then return exceptions specific to that\n if (ctx.method === 'GET' && specialPaths.some((str) => ctx.path.startsWith(str))) {\n helmetConfig = mergeConfig(helmetConfig, {\n crossOriginEmbedderPolicy: false, // TODO: only use this for graphql playground\n contentSecurityPolicy: {\n directives,\n },\n });\n }\n\n /**\n * These are for vite's watch mode so it can accurately\n * connect to the HMR websocket & reconnect on failure\n * or when the server restarts.\n *\n * It only applies in development, and only on GET requests\n * that are part of the admin route.\n */\n\n if (\n ['development', 'test'].includes(process.env.NODE_ENV ?? '') &&\n ctx.method === 'GET' &&\n ctx.path.startsWith(strapi.config.get('admin.path'))\n ) {\n helmetConfig = mergeConfig(helmetConfig, {\n contentSecurityPolicy: {\n directives: {\n 'script-src': [\"'self'\", \"'unsafe-inline'\"],\n 'connect-src': [\"'self'\", 'http:', 'https:', 'ws:'],\n },\n },\n });\n }\n\n return helmet(helmetConfig)(ctx, next);\n };\n"],"names":["defaults","crossOriginEmbedderPolicy","crossOriginOpenerPolicy","crossOriginResourcePolicy","originAgentCluster","contentSecurityPolicy","useDefaults","directives","CSP_DEFAULTS","upgradeInsecureRequests","xssFilter","hsts","maxAge","includeSubDomains","frameguard","action","mergeConfig","existingConfig","newConfig","mergeWith","obj","src","Array","isArray","concat","undefined","security","config","strapi","ctx","next","helmetConfig","defaultsDeep","specialPaths","plugin","service","playground","isEnabled","gqlConfig","push","method","some","str","path","startsWith","includes","process","env","NODE_ENV","get","helmet"],"mappings":";;;;AAQA,MAAMA,QAAmB,GAAA;IACvBC,yBAA2B,EAAA,KAAA;IAC3BC,uBAAyB,EAAA,KAAA;IACzBC,yBAA2B,EAAA,KAAA;IAC3BC,kBAAoB,EAAA,KAAA;IACpBC,qBAAuB,EAAA;QACrBC,WAAa,EAAA,IAAA;QACbC,UAAY,EAAA;AACV,YAAA,GAAGC,YAAY;YACfC,uBAAyB,EAAA;AAC3B;AACF,KAAA;IACAC,SAAW,EAAA,KAAA;IACXC,IAAM,EAAA;QACJC,MAAQ,EAAA,QAAA;QACRC,iBAAmB,EAAA;AACrB,KAAA;IACAC,UAAY,EAAA;QACVC,MAAQ,EAAA;AACV;AACF,CAAA;AAEA,MAAMC,WAAAA,GAAc,CAACC,cAAwBC,EAAAA,SAAAA,GAAAA;AAC3C,IAAA,OAAOC,UACL,CAACC,GAAAA,EAAKC,GAASC,GAAAA,KAAAA,CAAMC,OAAO,CAACH,GAAAA,CAAAA,IAAQE,KAAMC,CAAAA,OAAO,CAACF,GAAOD,CAAAA,GAAAA,GAAAA,CAAII,MAAM,CAACH,GAAAA,CAAAA,GAAOI,WAC5ER,cACAC,EAAAA,SAAAA,CAAAA;AAEJ,CAAA;AAEO,MAAMQ,WACX,CAACC,MAAAA,EAAQ,EAAEC,MAAM,EAAE,GACnB,CAACC,GAAKC,EAAAA,IAAAA,GAAAA;QACJ,IAAIC,YAAAA,GAAuBC,aAAahC,QAAU2B,EAAAA,MAAAA,CAAAA;AAClD,QAAA,MAAMM,YAAe,GAAA;AAAC,YAAA;AAAiB,SAAA;AAEvC,QAAA,MAAM1B,UAKF,GAAA;YACF,YAAc,EAAA;AAAC,gBAAA,QAAA;AAAU,gBAAA,iBAAA;AAAmB,gBAAA;AAAmB,aAAA;YAC/D,SAAW,EAAA;AAAC,gBAAA,QAAA;AAAU,gBAAA,OAAA;AAAS,gBAAA,kB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AAQ,CAACC,OAAQC,CAAAA,GAAG,CAACC,QAAQ,IAAI,EACzDnB,CAAAA,IAAAA,GAAAA,CAAIW,MAAM,KAAK,SACfX,GAAIc,CAAAA,IAAI,CAACC,UAAU,CAAChB,OAAOD,MAAM,CAACsB,GAAG,CAAC,YACtC,CAAA,CAAA,EAAA;AACAlB,YAAAA,YAAAA,GAAef,YAAYe,YAAc,EAAA;gBACvC1B,qBAAuB,EAAA;oBACrBE,UAAY,EAAA;wBACV,YAAc,EAAA;AAAC,4BAAA,QAAA;AAAU,4BAAA;AAAkB,yBAAA;wBAC3C,aAAe,EAAA;AAAC,4BAAA,QAAA;AAAU,4BAAA,OAAA;AAAS,4BAAA,QAAA;AAAU,4BAAA;AAAM;AACrD;AACF;AACF,aAAA,CAAA;AACF;QAEA,OAAO2C,MAAAA,CAAOnB,cAAcF,GAAKC,EAAAA,IAAAA,CAAAA;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-published-at.js","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":";;;;;AAYA,MAAMA,yBAAyB,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;AAC5E,IAAA,IAAI,CAACD,eAAiB,EAAA;AACpB,QAAA;AACF;AAEA,IAAA,OAAOE,MAAOC,CAAAA,EAAE,CAACC,WAAW,CAAC,OAAOC,GAAAA,GAAAA;QAClC,IAAK,MAAMC,OAAOL,YAAc,CAAA;AAC9B,YAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,gBAAA;AACF;YAEA,MAAMC,WAAAA,GAAcN,YAAY,CAACK,GAAI,CAAA;AAErC,YAAA,IAAI,CAACE,wBAAAA,CAAkBC,wBAAwB,CAACF,WAAc,CAAA,EAAA;AAC5D,gBAAA;AACF;AAEA,YAAA,IAAI,CAACA,WAAAA,CAAYG,UAAU,EAAEC,gBAAkB,EAAA;AAC7C,gBAAA;AACF;AAEA,YAAA,MAAMC,OAA6B,GAAA,MAAMV,MAAOC,CAAAA,EAAE,CAC/CU,YAAY,CAACP,GACbQ,CAAAA,CAAAA,MAAM,CAAC,GAAA,CAAA,CACPC,WAAW,CAACV,KACZW,OAAO,EAAA;;;AAIV,YAAA,MAAMC,
|
|
1
|
+
{"version":3,"file":"first-published-at.js","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":";;;;;AAYA,MAAMA,yBAAyB,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;AAC5E,IAAA,IAAI,CAACD,eAAiB,EAAA;AACpB,QAAA;AACF;AAEA,IAAA,OAAOE,MAAOC,CAAAA,EAAE,CAACC,WAAW,CAAC,OAAOC,GAAAA,GAAAA;QAClC,IAAK,MAAMC,OAAOL,YAAc,CAAA;AAC9B,YAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,gBAAA;AACF;YAEA,MAAMC,WAAAA,GAAcN,YAAY,CAACK,GAAI,CAAA;AAErC,YAAA,IAAI,CAACE,wBAAAA,CAAkBC,wBAAwB,CAACF,WAAc,CAAA,EAAA;AAC5D,gBAAA;AACF;AAEA,YAAA,IAAI,CAACA,WAAAA,CAAYG,UAAU,EAAEC,gBAAkB,EAAA;AAC7C,gBAAA;AACF;AAEA,YAAA,MAAMC,OAA6B,GAAA,MAAMV,MAAOC,CAAAA,EAAE,CAC/CU,YAAY,CAACP,GACbQ,CAAAA,CAAAA,MAAM,CAAC,GAAA,CAAA,CACPC,WAAW,CAACV,KACZW,OAAO,EAAA;;;AAIV,YAAA,MAAMC,cAAiBC,GAAAA,CAAAA,CAAEC,OAAO,CAACP,SAAS,CAACQ,IAAAA,GAAS,CAAGA,EAAAA,IAAAA,CAAKC,UAAU,CAAC,CAAC,EAAED,IAAAA,CAAKE,MAAM,CAAE,CAAA,CAAA;AAEvF,YAAA,KAAK,MAAMC,KAAAA,IAASC,MAAOC,CAAAA,MAAM,CAACR,cAAiB,CAAA,CAAA;;gBAEjD,IAAIM,KAAAA,CAAMG,MAAM,IAAI,CAAG,EAAA;AACrB,oBAAA;AACF;;AAGA,gBAAA,IAAIH,KAAK,CAAC,CAAE,CAAA,CAACZ,gBAAgB,IAAI,IAAQY,IAAAA,KAAK,CAAC,CAAA,CAAE,CAACZ,gBAAgB,IAAI,IAAM,EAAA;AAC1E,oBAAA;AACF;gBAEA,MAAMgB,gBAAAA,GAAmBJ,KAAMK,CAAAA,MAAM,CAAC,CAACR,IAASA,GAAAA,IAAAA,CAAKS,WAAW,IAAI,IAAMC,CAAAA,CAAAA,EAAE,CAAC,CAAA,CAAA;AAC7E,gBAAA,IAAI,CAACH,gBAAkB,EAAA;AACrB,oBAAA;AACF;AAEA,gBAAA,MAAMzB,OAAOC,EAAE,CACZU,YAAY,CAACP,GAAAA,CAAAA,CACbyB,MAAM,CAAC;oBACNpB,gBAAkB,EAAA,IAAIqB,IAAKL,CAAAA,gBAAAA,CAAiBE,WAAW;AACzD,iBAAA,CAAA,CACCI,KAAK,CAAC;AACLZ,oBAAAA,UAAAA,EAAYM,iBAAiBN,UAAU;AACvCC,oBAAAA,MAAAA,EAAQK,iBAAiBL;iBAE1BP,CAAAA,CAAAA,WAAW,CAACV,GAAAA,CAAAA,CACZW,OAAO,EAAA;AACZ;AACF;AACF,KAAA,CAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-published-at.mjs","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":";;;AAYA,MAAMA,yBAAyB,OAAO,EAAEC,eAAe,gBAAEC,cAAY,EAAS,GAAA;AAC5E,IAAA,IAAI,CAACD,eAAiB,EAAA;AACpB,QAAA;AACF;AAEA,IAAA,OAAOE,MAAOC,CAAAA,EAAE,CAACC,WAAW,CAAC,OAAOC,GAAAA,GAAAA;QAClC,IAAK,MAAMC,OAAOL,cAAc,CAAA;AAC9B,YAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,gBAAA;AACF;YAEA,MAAMC,WAAAA,GAAcN,cAAY,CAACK,GAAI,CAAA;AAErC,YAAA,IAAI,CAACE,YAAAA,CAAkBC,wBAAwB,CAACF,WAAc,CAAA,EAAA;AAC5D,gBAAA;AACF;AAEA,YAAA,IAAI,CAACA,WAAAA,CAAYG,UAAU,EAAEC,gBAAkB,EAAA;AAC7C,gBAAA;AACF;AAEA,YAAA,MAAMC,OAA6B,GAAA,MAAMV,MAAOC,CAAAA,EAAE,CAC/CU,YAAY,CAACP,GACbQ,CAAAA,CAAAA,MAAM,CAAC,GAAA,CAAA,CACPC,WAAW,CAACV,KACZW,OAAO,EAAA;;;AAIV,YAAA,MAAMC,
|
|
1
|
+
{"version":3,"file":"first-published-at.mjs","sources":["../../src/migrations/first-published-at.ts"],"sourcesContent":["import { contentTypes as contentTypesUtils } from '@strapi/utils';\nimport _ from 'lodash';\nimport { Input } from './draft-publish';\n\ninterface ContentTypeData {\n id: number;\n documentId: string;\n publishedAt: Date;\n firstPublishedAt: Date;\n locale: string;\n}\n\nconst enableFirstPublishedAt = async ({ oldContentTypes, contentTypes }: Input) => {\n if (!oldContentTypes) {\n return;\n }\n\n return strapi.db.transaction(async (trx) => {\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const contentType = contentTypes[uid];\n\n if (!contentTypesUtils.hasFirstPublishedAtField(contentType)) {\n continue;\n }\n\n if (!contentType.attributes?.firstPublishedAt) {\n continue;\n }\n\n const content: ContentTypeData[] = await strapi.db\n .queryBuilder(uid)\n .select('*')\n .transacting(trx)\n .execute();\n\n // Process content types in pairs: draft and published.\n // If only one exist, which means the value is not published yet and we can ignore it\n const groupedContent = _.groupBy(content, (item) => `${item.documentId}-${item.locale}`);\n\n for (const items of Object.values(groupedContent)) {\n // If there is only one item, which means nothing is published yet for this locale\n if (items.length <= 1) {\n continue;\n }\n\n // If firstPublishedAt is already present, do not do anything\n if (items[0].firstPublishedAt != null && items[1].firstPublishedAt != null) {\n continue;\n }\n\n const publishedContent = items.filter((item) => item.publishedAt != null).at(0);\n if (!publishedContent) {\n continue;\n }\n\n await strapi.db\n .queryBuilder(uid)\n .update({\n firstPublishedAt: new Date(publishedContent.publishedAt),\n })\n .where({\n documentId: publishedContent.documentId,\n locale: publishedContent.locale,\n })\n .transacting(trx)\n .execute();\n }\n }\n });\n};\n\nexport { enableFirstPublishedAt as enable };\n"],"names":["enableFirstPublishedAt","oldContentTypes","contentTypes","strapi","db","transaction","trx","uid","contentType","contentTypesUtils","hasFirstPublishedAtField","attributes","firstPublishedAt","content","queryBuilder","select","transacting","execute","groupedContent","_","groupBy","item","documentId","locale","items","Object","values","length","publishedContent","filter","publishedAt","at","update","Date","where"],"mappings":";;;AAYA,MAAMA,yBAAyB,OAAO,EAAEC,eAAe,gBAAEC,cAAY,EAAS,GAAA;AAC5E,IAAA,IAAI,CAACD,eAAiB,EAAA;AACpB,QAAA;AACF;AAEA,IAAA,OAAOE,MAAOC,CAAAA,EAAE,CAACC,WAAW,CAAC,OAAOC,GAAAA,GAAAA;QAClC,IAAK,MAAMC,OAAOL,cAAc,CAAA;AAC9B,YAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,gBAAA;AACF;YAEA,MAAMC,WAAAA,GAAcN,cAAY,CAACK,GAAI,CAAA;AAErC,YAAA,IAAI,CAACE,YAAAA,CAAkBC,wBAAwB,CAACF,WAAc,CAAA,EAAA;AAC5D,gBAAA;AACF;AAEA,YAAA,IAAI,CAACA,WAAAA,CAAYG,UAAU,EAAEC,gBAAkB,EAAA;AAC7C,gBAAA;AACF;AAEA,YAAA,MAAMC,OAA6B,GAAA,MAAMV,MAAOC,CAAAA,EAAE,CAC/CU,YAAY,CAACP,GACbQ,CAAAA,CAAAA,MAAM,CAAC,GAAA,CAAA,CACPC,WAAW,CAACV,KACZW,OAAO,EAAA;;;AAIV,YAAA,MAAMC,cAAiBC,GAAAA,CAAAA,CAAEC,OAAO,CAACP,SAAS,CAACQ,IAAAA,GAAS,CAAGA,EAAAA,IAAAA,CAAKC,UAAU,CAAC,CAAC,EAAED,IAAAA,CAAKE,MAAM,CAAE,CAAA,CAAA;AAEvF,YAAA,KAAK,MAAMC,KAAAA,IAASC,MAAOC,CAAAA,MAAM,CAACR,cAAiB,CAAA,CAAA;;gBAEjD,IAAIM,KAAAA,CAAMG,MAAM,IAAI,CAAG,EAAA;AACrB,oBAAA;AACF;;AAGA,gBAAA,IAAIH,KAAK,CAAC,CAAE,CAAA,CAACZ,gBAAgB,IAAI,IAAQY,IAAAA,KAAK,CAAC,CAAA,CAAE,CAACZ,gBAAgB,IAAI,IAAM,EAAA;AAC1E,oBAAA;AACF;gBAEA,MAAMgB,gBAAAA,GAAmBJ,KAAMK,CAAAA,MAAM,CAAC,CAACR,IAASA,GAAAA,IAAAA,CAAKS,WAAW,IAAI,IAAMC,CAAAA,CAAAA,EAAE,CAAC,CAAA,CAAA;AAC7E,gBAAA,IAAI,CAACH,gBAAkB,EAAA;AACrB,oBAAA;AACF;AAEA,gBAAA,MAAMzB,OAAOC,EAAE,CACZU,YAAY,CAACP,GAAAA,CAAAA,CACbyB,MAAM,CAAC;oBACNpB,gBAAkB,EAAA,IAAIqB,IAAKL,CAAAA,gBAAAA,CAAiBE,WAAW;AACzD,iBAAA,CAAA,CACCI,KAAK,CAAC;AACLZ,oBAAAA,UAAAA,EAAYM,iBAAiBN,UAAU;AACvCC,oBAAAA,MAAAA,EAAQK,iBAAiBL;iBAE1BP,CAAAA,CAAAA,WAAW,CAACV,GAAAA,CAAAA,CACZW,OAAO,EAAA;AACZ;AACF;AACF,KAAA,CAAA;AACF;;;;"}
|
package/dist/package.json.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "@strapi/core";
|
|
6
|
-
var version = "5.
|
|
6
|
+
var version = "5.30.1";
|
|
7
7
|
var description = "Core of Strapi";
|
|
8
8
|
var homepage = "https://strapi.io";
|
|
9
9
|
var bugs = {
|
|
@@ -59,14 +59,14 @@ var dependencies = {
|
|
|
59
59
|
"@koa/cors": "5.0.0",
|
|
60
60
|
"@koa/router": "12.0.2",
|
|
61
61
|
"@paralleldrive/cuid2": "2.2.2",
|
|
62
|
-
"@strapi/admin": "5.
|
|
63
|
-
"@strapi/database": "5.
|
|
64
|
-
"@strapi/generators": "5.
|
|
65
|
-
"@strapi/logger": "5.
|
|
66
|
-
"@strapi/permissions": "5.
|
|
67
|
-
"@strapi/types": "5.
|
|
68
|
-
"@strapi/typescript-utils": "5.
|
|
69
|
-
"@strapi/utils": "5.
|
|
62
|
+
"@strapi/admin": "5.30.1",
|
|
63
|
+
"@strapi/database": "5.30.1",
|
|
64
|
+
"@strapi/generators": "5.30.1",
|
|
65
|
+
"@strapi/logger": "5.30.1",
|
|
66
|
+
"@strapi/permissions": "5.30.1",
|
|
67
|
+
"@strapi/types": "5.30.1",
|
|
68
|
+
"@strapi/typescript-utils": "5.30.1",
|
|
69
|
+
"@strapi/utils": "5.30.1",
|
|
70
70
|
"@vercel/stega": "0.1.2",
|
|
71
71
|
bcryptjs: "2.4.3",
|
|
72
72
|
boxen: "5.1.2",
|
|
@@ -115,7 +115,7 @@ var dependencies = {
|
|
|
115
115
|
};
|
|
116
116
|
var devDependencies = {
|
|
117
117
|
"@strapi/ts-zen": "^0.2.0",
|
|
118
|
-
"@swc/core": "1.
|
|
118
|
+
"@swc/core": "1.13.5",
|
|
119
119
|
"@types/bcryptjs": "2.4.3",
|
|
120
120
|
"@types/configstore": "5.0.1",
|
|
121
121
|
"@types/delegates": "1.0.0",
|
|
@@ -134,9 +134,9 @@ var devDependencies = {
|
|
|
134
134
|
"@types/node": "18.19.24",
|
|
135
135
|
"@types/node-schedule": "2.1.7",
|
|
136
136
|
"@types/statuses": "2.0.1",
|
|
137
|
-
"eslint-config-custom": "5.
|
|
137
|
+
"eslint-config-custom": "5.30.1",
|
|
138
138
|
supertest: "6.3.3",
|
|
139
|
-
tsconfig: "5.
|
|
139
|
+
tsconfig: "5.30.1"
|
|
140
140
|
};
|
|
141
141
|
var engines = {
|
|
142
142
|
node: ">=18.0.0 <=22.x.x",
|
package/dist/package.json.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var name = "@strapi/core";
|
|
2
|
-
var version = "5.
|
|
2
|
+
var version = "5.30.1";
|
|
3
3
|
var description = "Core of Strapi";
|
|
4
4
|
var homepage = "https://strapi.io";
|
|
5
5
|
var bugs = {
|
|
@@ -55,14 +55,14 @@ var dependencies = {
|
|
|
55
55
|
"@koa/cors": "5.0.0",
|
|
56
56
|
"@koa/router": "12.0.2",
|
|
57
57
|
"@paralleldrive/cuid2": "2.2.2",
|
|
58
|
-
"@strapi/admin": "5.
|
|
59
|
-
"@strapi/database": "5.
|
|
60
|
-
"@strapi/generators": "5.
|
|
61
|
-
"@strapi/logger": "5.
|
|
62
|
-
"@strapi/permissions": "5.
|
|
63
|
-
"@strapi/types": "5.
|
|
64
|
-
"@strapi/typescript-utils": "5.
|
|
65
|
-
"@strapi/utils": "5.
|
|
58
|
+
"@strapi/admin": "5.30.1",
|
|
59
|
+
"@strapi/database": "5.30.1",
|
|
60
|
+
"@strapi/generators": "5.30.1",
|
|
61
|
+
"@strapi/logger": "5.30.1",
|
|
62
|
+
"@strapi/permissions": "5.30.1",
|
|
63
|
+
"@strapi/types": "5.30.1",
|
|
64
|
+
"@strapi/typescript-utils": "5.30.1",
|
|
65
|
+
"@strapi/utils": "5.30.1",
|
|
66
66
|
"@vercel/stega": "0.1.2",
|
|
67
67
|
bcryptjs: "2.4.3",
|
|
68
68
|
boxen: "5.1.2",
|
|
@@ -111,7 +111,7 @@ var dependencies = {
|
|
|
111
111
|
};
|
|
112
112
|
var devDependencies = {
|
|
113
113
|
"@strapi/ts-zen": "^0.2.0",
|
|
114
|
-
"@swc/core": "1.
|
|
114
|
+
"@swc/core": "1.13.5",
|
|
115
115
|
"@types/bcryptjs": "2.4.3",
|
|
116
116
|
"@types/configstore": "5.0.1",
|
|
117
117
|
"@types/delegates": "1.0.0",
|
|
@@ -130,9 +130,9 @@ var devDependencies = {
|
|
|
130
130
|
"@types/node": "18.19.24",
|
|
131
131
|
"@types/node-schedule": "2.1.7",
|
|
132
132
|
"@types/statuses": "2.0.1",
|
|
133
|
-
"eslint-config-custom": "5.
|
|
133
|
+
"eslint-config-custom": "5.30.1",
|
|
134
134
|
supertest: "6.3.3",
|
|
135
|
-
tsconfig: "5.
|
|
135
|
+
tsconfig: "5.30.1"
|
|
136
136
|
};
|
|
137
137
|
var engines = {
|
|
138
138
|
node: ">=18.0.0 <=22.x.x",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.js","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apiName, apis)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;;;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAK,CAAA;AACnB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,SAAA;QACAI,GAAIC,CAAAA,CAAAA,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,MAAAA,CAAIF,SAASL,IAAO,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIQ,KAAM,CAAA,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D;
|
|
1
|
+
{"version":3,"file":"apis.js","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apiName, apis)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;;;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAK,CAAA;AACnB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,SAAA;QACAI,GAAIC,CAAAA,CAAAA,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,MAAAA,CAAIF,SAASL,IAAO,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIQ,KAAM,CAAA,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D;YAEA,MAAMI,GAAAA,GAAMV,MAAOE,CAAAA,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,KAAK,EAAEC,OAAAA,CAAAA,CAAS,EAAEC,SAAAA,CAAAA;YAEzDN,IAAI,CAACK,QAAQ,GAAGI,GAAAA;YAEhB,OAAOT,IAAI,CAACK,OAAQ,CAAA;AACtB;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.mjs","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apiName, apis)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAK,CAAA;AACnB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,SAAA;QACAI,GAAIC,CAAAA,CAAAA,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,GAAAA,CAAIF,SAASL,IAAO,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIQ,KAAM,CAAA,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D;
|
|
1
|
+
{"version":3,"file":"apis.mjs","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apiName, apis)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAK,CAAA;AACnB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,SAAA;QACAI,GAAIC,CAAAA,CAAAA,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,GAAAA,CAAIF,SAASL,IAAO,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIQ,KAAM,CAAA,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D;YAEA,MAAMI,GAAAA,GAAMV,MAAOE,CAAAA,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,KAAK,EAAEC,OAAAA,CAAAA,CAAS,EAAEC,SAAAA,CAAAA;YAEzDN,IAAI,CAACK,QAAQ,GAAGI,GAAAA;YAEhB,OAAOT,IAAI,CAACK,OAAQ,CAAA;AACtB;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-fields.js","sources":["../../src/registries/custom-fields.ts"],"sourcesContent":["import { has, isPlainObject } from 'lodash/fp';\n\nimport type { Core, Modules } from '@strapi/types';\n\nconst ALLOWED_TYPES = [\n 'biginteger',\n 'boolean',\n 'date',\n 'datetime',\n 'decimal',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'password',\n 'richtext',\n 'string',\n 'text',\n 'time',\n 'uid',\n] as const;\n\nconst customFieldsRegistry = (strapi: Core.Strapi) => {\n const customFields: Record<string, unknown> = {};\n\n return {\n getAll() {\n return customFields;\n },\n get(customField: string) {\n const registeredCustomField = customFields[customField];\n if (!registeredCustomField) {\n throw new Error(`Could not find Custom Field: ${customField}`);\n }\n\n return registeredCustomField;\n },\n add(\n customField:\n | Modules.CustomFields.CustomFieldServerOptions\n | Modules.CustomFields.CustomFieldServerOptions[]\n ) {\n const customFieldList = Array.isArray(customField) ? customField : [customField];\n\n for (const cf of customFieldList) {\n if (!has('name', cf) || !has('type', cf)) {\n throw new Error(`Custom fields require a 'name' and 'type' key`);\n }\n\n const { name, plugin, type, inputSize } = cf;\n if (!ALLOWED_TYPES.includes(type)) {\n throw new Error(\n `Custom field type: '${type}' is not a valid Strapi type or it can't be used with a Custom Field`\n );\n }\n\n const isValidObjectKey = /^(?![0-9])[a-zA-Z0-9$_-]+$/g;\n if (!isValidObjectKey.test(name)) {\n throw new Error(`Custom field name: '${name}' is not a valid object key`);\n }\n\n // Validate inputSize when provided\n if (inputSize) {\n if (\n !isPlainObject(inputSize) ||\n !has('default', inputSize) ||\n !has('isResizable', inputSize)\n ) {\n throw new Error(`inputSize should be an object with 'default' and 'isResizable' keys`);\n }\n if (![4, 6, 8, 12].includes(inputSize.default)) {\n throw new Error('Custom fields require a valid default input size');\n }\n if (typeof inputSize.isResizable !== 'boolean') {\n throw new Error('Custom fields should specify if their input is resizable');\n }\n }\n\n // When no plugin is specified, or it isn't found in Strapi, default to global\n const uid =\n plugin && strapi.plugin(plugin) ? `plugin::${plugin}.${name}` : `global::${name}`;\n\n if (has(uid, customFields)) {\n throw new Error(`Custom field: '${uid}' has already been registered`);\n }\n\n customFields[uid] = cf;\n }\n },\n };\n};\n\nexport default customFieldsRegistry;\n"],"names":["ALLOWED_TYPES","customFieldsRegistry","strapi","customFields","getAll","get","customField","registeredCustomField","Error","add","customFieldList","Array","isArray","cf","has","name","plugin","type","inputSize","includes","isValidObjectKey","test","isPlainObject","default","isResizable","uid"],"mappings":";;;;AAIA,MAAMA,aAAgB,GAAA;AACpB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,uBAAuB,CAACC,MAAAA,GAAAA;AAC5B,IAAA,MAAMC,eAAwC,EAAC;IAE/C,OAAO;AACLC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOD,YAAAA;AACT,SAAA;AACAE,QAAAA,GAAAA,CAAAA,CAAIC,WAAmB,EAAA;YACrB,MAAMC,qBAAAA,GAAwBJ,YAAY,CAACG,WAAY,CAAA;AACvD,YAAA,IAAI,CAACC,qBAAuB,EAAA;AAC1B,gBAAA,MAAM,IAAIC,
|
|
1
|
+
{"version":3,"file":"custom-fields.js","sources":["../../src/registries/custom-fields.ts"],"sourcesContent":["import { has, isPlainObject } from 'lodash/fp';\n\nimport type { Core, Modules } from '@strapi/types';\n\nconst ALLOWED_TYPES = [\n 'biginteger',\n 'boolean',\n 'date',\n 'datetime',\n 'decimal',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'password',\n 'richtext',\n 'string',\n 'text',\n 'time',\n 'uid',\n] as const;\n\nconst customFieldsRegistry = (strapi: Core.Strapi) => {\n const customFields: Record<string, unknown> = {};\n\n return {\n getAll() {\n return customFields;\n },\n get(customField: string) {\n const registeredCustomField = customFields[customField];\n if (!registeredCustomField) {\n throw new Error(`Could not find Custom Field: ${customField}`);\n }\n\n return registeredCustomField;\n },\n add(\n customField:\n | Modules.CustomFields.CustomFieldServerOptions\n | Modules.CustomFields.CustomFieldServerOptions[]\n ) {\n const customFieldList = Array.isArray(customField) ? customField : [customField];\n\n for (const cf of customFieldList) {\n if (!has('name', cf) || !has('type', cf)) {\n throw new Error(`Custom fields require a 'name' and 'type' key`);\n }\n\n const { name, plugin, type, inputSize } = cf;\n if (!ALLOWED_TYPES.includes(type)) {\n throw new Error(\n `Custom field type: '${type}' is not a valid Strapi type or it can't be used with a Custom Field`\n );\n }\n\n const isValidObjectKey = /^(?![0-9])[a-zA-Z0-9$_-]+$/g;\n if (!isValidObjectKey.test(name)) {\n throw new Error(`Custom field name: '${name}' is not a valid object key`);\n }\n\n // Validate inputSize when provided\n if (inputSize) {\n if (\n !isPlainObject(inputSize) ||\n !has('default', inputSize) ||\n !has('isResizable', inputSize)\n ) {\n throw new Error(`inputSize should be an object with 'default' and 'isResizable' keys`);\n }\n if (![4, 6, 8, 12].includes(inputSize.default)) {\n throw new Error('Custom fields require a valid default input size');\n }\n if (typeof inputSize.isResizable !== 'boolean') {\n throw new Error('Custom fields should specify if their input is resizable');\n }\n }\n\n // When no plugin is specified, or it isn't found in Strapi, default to global\n const uid =\n plugin && strapi.plugin(plugin) ? `plugin::${plugin}.${name}` : `global::${name}`;\n\n if (has(uid, customFields)) {\n throw new Error(`Custom field: '${uid}' has already been registered`);\n }\n\n customFields[uid] = cf;\n }\n },\n };\n};\n\nexport default customFieldsRegistry;\n"],"names":["ALLOWED_TYPES","customFieldsRegistry","strapi","customFields","getAll","get","customField","registeredCustomField","Error","add","customFieldList","Array","isArray","cf","has","name","plugin","type","inputSize","includes","isValidObjectKey","test","isPlainObject","default","isResizable","uid"],"mappings":";;;;AAIA,MAAMA,aAAgB,GAAA;AACpB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,uBAAuB,CAACC,MAAAA,GAAAA;AAC5B,IAAA,MAAMC,eAAwC,EAAC;IAE/C,OAAO;AACLC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOD,YAAAA;AACT,SAAA;AACAE,QA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A,CAACJ,MAAI,CAAA,aAAA,EAAeI,SACpB,CAAA,EAAA;AACA,wBAAA,MAAM,IAAIV,KAAAA,CAAM,CAAC,mEAAmE,CAAC,CAAA;AACvF;AACA,oBAAA,IAAI,CAAC;AAAC,wBAAA,CAAA;AAAG,wBAAA,CAAA;AAAG,wBAAA,CAAA;AAAG,wBAAA;AAAG,qBAAA,CAACW,QAAQ,CAACD,SAAUK,CAAAA,OAAO,CAAG,EAAA;AAC9C,wBAAA,MAAM,IAAIf,KAAM,CAAA,kDAAA,CAAA;AAClB;AACA,oBAAA,IAAI,OAAOU,SAAAA,CAAUM,WAAW,KAAK,SAAW,EAAA;AAC9C,wBAAA,MAAM,IAAIhB,KAAM,CAAA,0DAAA,CAAA;AAClB;AACF;;AAGA,gBAAA,MAAMiB,MACJT,MAAUd,IAAAA,MAAAA,CAAOc,MAAM,CAACA,UAAU,CAAC,QAAQ,EAAEA,MAAAA,CAAO,CAAC,EAAED,IAAAA,CAAAA,CAAM,GAAG,CAAC,QAAQ,EAAEA,IAAM,CAAA,CAAA;gBAEnF,IAAID,MAAAA,CAAIW,KAAKtB,YAAe,CAAA,EAAA;AAC1B,oBAAA,MAAM,IAAIK,KAAM,CAAA,CAAC,eAAe,EAAEiB,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACtE;gBAEAtB,YAAY,CAACsB,IAAI,GAAGZ,EAAAA;AACtB;AACF;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-fields.mjs","sources":["../../src/registries/custom-fields.ts"],"sourcesContent":["import { has, isPlainObject } from 'lodash/fp';\n\nimport type { Core, Modules } from '@strapi/types';\n\nconst ALLOWED_TYPES = [\n 'biginteger',\n 'boolean',\n 'date',\n 'datetime',\n 'decimal',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'password',\n 'richtext',\n 'string',\n 'text',\n 'time',\n 'uid',\n] as const;\n\nconst customFieldsRegistry = (strapi: Core.Strapi) => {\n const customFields: Record<string, unknown> = {};\n\n return {\n getAll() {\n return customFields;\n },\n get(customField: string) {\n const registeredCustomField = customFields[customField];\n if (!registeredCustomField) {\n throw new Error(`Could not find Custom Field: ${customField}`);\n }\n\n return registeredCustomField;\n },\n add(\n customField:\n | Modules.CustomFields.CustomFieldServerOptions\n | Modules.CustomFields.CustomFieldServerOptions[]\n ) {\n const customFieldList = Array.isArray(customField) ? customField : [customField];\n\n for (const cf of customFieldList) {\n if (!has('name', cf) || !has('type', cf)) {\n throw new Error(`Custom fields require a 'name' and 'type' key`);\n }\n\n const { name, plugin, type, inputSize } = cf;\n if (!ALLOWED_TYPES.includes(type)) {\n throw new Error(\n `Custom field type: '${type}' is not a valid Strapi type or it can't be used with a Custom Field`\n );\n }\n\n const isValidObjectKey = /^(?![0-9])[a-zA-Z0-9$_-]+$/g;\n if (!isValidObjectKey.test(name)) {\n throw new Error(`Custom field name: '${name}' is not a valid object key`);\n }\n\n // Validate inputSize when provided\n if (inputSize) {\n if (\n !isPlainObject(inputSize) ||\n !has('default', inputSize) ||\n !has('isResizable', inputSize)\n ) {\n throw new Error(`inputSize should be an object with 'default' and 'isResizable' keys`);\n }\n if (![4, 6, 8, 12].includes(inputSize.default)) {\n throw new Error('Custom fields require a valid default input size');\n }\n if (typeof inputSize.isResizable !== 'boolean') {\n throw new Error('Custom fields should specify if their input is resizable');\n }\n }\n\n // When no plugin is specified, or it isn't found in Strapi, default to global\n const uid =\n plugin && strapi.plugin(plugin) ? `plugin::${plugin}.${name}` : `global::${name}`;\n\n if (has(uid, customFields)) {\n throw new Error(`Custom field: '${uid}' has already been registered`);\n }\n\n customFields[uid] = cf;\n }\n },\n };\n};\n\nexport default customFieldsRegistry;\n"],"names":["ALLOWED_TYPES","customFieldsRegistry","strapi","customFields","getAll","get","customField","registeredCustomField","Error","add","customFieldList","Array","isArray","cf","has","name","plugin","type","inputSize","includes","isValidObjectKey","test","isPlainObject","default","isResizable","uid"],"mappings":";;AAIA,MAAMA,aAAgB,GAAA;AACpB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,uBAAuB,CAACC,MAAAA,GAAAA;AAC5B,IAAA,MAAMC,eAAwC,EAAC;IAE/C,OAAO;AACLC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOD,YAAAA;AACT,SAAA;AACAE,QAAAA,GAAAA,CAAAA,CAAIC,WAAmB,EAAA;YACrB,MAAMC,qBAAAA,GAAwBJ,YAAY,CAACG,WAAY,CAAA;AACvD,YAAA,IAAI,CAACC,qBAAuB,EAAA;AAC1B,gBAAA,MAAM,IAAIC,
|
|
1
|
+
{"version":3,"file":"custom-fields.mjs","sources":["../../src/registries/custom-fields.ts"],"sourcesContent":["import { has, isPlainObject } from 'lodash/fp';\n\nimport type { Core, Modules } from '@strapi/types';\n\nconst ALLOWED_TYPES = [\n 'biginteger',\n 'boolean',\n 'date',\n 'datetime',\n 'decimal',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'password',\n 'richtext',\n 'string',\n 'text',\n 'time',\n 'uid',\n] as const;\n\nconst customFieldsRegistry = (strapi: Core.Strapi) => {\n const customFields: Record<string, unknown> = {};\n\n return {\n getAll() {\n return customFields;\n },\n get(customField: string) {\n const registeredCustomField = customFields[customField];\n if (!registeredCustomField) {\n throw new Error(`Could not find Custom Field: ${customField}`);\n }\n\n return registeredCustomField;\n },\n add(\n customField:\n | Modules.CustomFields.CustomFieldServerOptions\n | Modules.CustomFields.CustomFieldServerOptions[]\n ) {\n const customFieldList = Array.isArray(customField) ? customField : [customField];\n\n for (const cf of customFieldList) {\n if (!has('name', cf) || !has('type', cf)) {\n throw new Error(`Custom fields require a 'name' and 'type' key`);\n }\n\n const { name, plugin, type, inputSize } = cf;\n if (!ALLOWED_TYPES.includes(type)) {\n throw new Error(\n `Custom field type: '${type}' is not a valid Strapi type or it can't be used with a Custom Field`\n );\n }\n\n const isValidObjectKey = /^(?![0-9])[a-zA-Z0-9$_-]+$/g;\n if (!isValidObjectKey.test(name)) {\n throw new Error(`Custom field name: '${name}' is not a valid object key`);\n }\n\n // Validate inputSize when provided\n if (inputSize) {\n if (\n !isPlainObject(inputSize) ||\n !has('default', inputSize) ||\n !has('isResizable', inputSize)\n ) {\n throw new Error(`inputSize should be an object with 'default' and 'isResizable' keys`);\n }\n if (![4, 6, 8, 12].includes(inputSize.default)) {\n throw new Error('Custom fields require a valid default input size');\n }\n if (typeof inputSize.isResizable !== 'boolean') {\n throw new Error('Custom fields should specify if their input is resizable');\n }\n }\n\n // When no plugin is specified, or it isn't found in Strapi, default to global\n const uid =\n plugin && strapi.plugin(plugin) ? `plugin::${plugin}.${name}` : `global::${name}`;\n\n if (has(uid, customFields)) {\n throw new Error(`Custom field: '${uid}' has already been registered`);\n }\n\n customFields[uid] = cf;\n }\n },\n };\n};\n\nexport default customFieldsRegistry;\n"],"names":["ALLOWED_TYPES","customFieldsRegistry","strapi","customFields","getAll","get","customField","registeredCustomField","Error","add","customFieldList","Array","isArray","cf","has","name","plugin","type","inputSize","includes","isValidObjectKey","test","isPlainObject","default","isResizable","uid"],"mappings":";;AAIA,MAAMA,aAAgB,GAAA;AACpB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD,CAAA;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AK,2BAA2B,CAAC,CAAA;AAC1E;;AAGA,gBAAA,IAAIG,SAAW,EAAA;oBACb,IACE,CAACI,aAAcJ,CAAAA,SAAAA,CAAAA,IACf,CAACJ,GAAAA,CAAI,WAAWI,SAChB,CAAA,IAAA,CAACJ,GAAI,CAAA,aAAA,EAAeI,SACpB,CAAA,EAAA;AACA,wBAAA,MAAM,IAAIV,KAAAA,CAAM,CAAC,mEAAmE,CAAC,CAAA;AACvF;AACA,oBAAA,IAAI,CAAC;AAAC,wBAAA,CAAA;AAAG,wBAAA,CAAA;AAAG,wBAAA,CAAA;AAAG,wBAAA;AAAG,qBAAA,CAACW,QAAQ,CAACD,SAAUK,CAAAA,OAAO,CAAG,EAAA;AAC9C,wBAAA,MAAM,IAAIf,KAAM,CAAA,kDAAA,CAAA;AAClB;AACA,oBAAA,IAAI,OAAOU,SAAAA,CAAUM,WAAW,KAAK,SAAW,EAAA;AAC9C,wBAAA,MAAM,IAAIhB,KAAM,CAAA,0DAAA,CAAA;AAClB;AACF;;AAGA,gBAAA,MAAMiB,MACJT,MAAUd,IAAAA,MAAAA,CAAOc,MAAM,CAACA,UAAU,CAAC,QAAQ,EAAEA,MAAAA,CAAO,CAAC,EAAED,IAAAA,CAAAA,CAAM,GAAG,CAAC,QAAQ,EAAEA,IAAM,CAAA,CAAA;gBAEnF,IAAID,GAAAA,CAAIW,KAAKtB,YAAe,CAAA,EAAA;AAC1B,oBAAA,MAAM,IAAIK,KAAM,CAAA,CAAC,eAAe,EAAEiB,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACtE;gBAEAtB,YAAY,CAACsB,IAAI,GAAGZ,EAAAA;AACtB;AACF;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.js","sources":["../../src/registries/namespace.ts"],"sourcesContent":["const hasNamespace = (name: string, namespace: string) => {\n if (!namespace) {\n return true;\n }\n\n if (namespace.endsWith('::')) {\n return name.startsWith(namespace);\n }\n return name.startsWith(`${namespace}.`);\n};\n\nconst addNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return `${namespace}${name}`;\n }\n return `${namespace}.${name}`;\n};\n\nconst removeNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return name.replace(namespace, '');\n }\n return name.replace(`${namespace}.`, '');\n};\n\nexport { addNamespace, removeNamespace, hasNamespace };\n"],"names":["hasNamespace","name","namespace","endsWith","startsWith","addNamespace","removeNamespace","replace"],"mappings":";;AAAMA,MAAAA,YAAAA,GAAe,CAACC,IAAcC,EAAAA,SAAAA,GAAAA;AAClC,IAAA,IAAI,CAACA,SAAW,EAAA;QACd,OAAO,IAAA;AACT;IAEA,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAOF,IAAAA,CAAKG,UAAU,CAACF,SAAAA,CAAAA;AACzB;AACA,IAAA,OAAOD,KAAKG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"namespace.js","sources":["../../src/registries/namespace.ts"],"sourcesContent":["const hasNamespace = (name: string, namespace: string) => {\n if (!namespace) {\n return true;\n }\n\n if (namespace.endsWith('::')) {\n return name.startsWith(namespace);\n }\n return name.startsWith(`${namespace}.`);\n};\n\nconst addNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return `${namespace}${name}`;\n }\n return `${namespace}.${name}`;\n};\n\nconst removeNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return name.replace(namespace, '');\n }\n return name.replace(`${namespace}.`, '');\n};\n\nexport { addNamespace, removeNamespace, hasNamespace };\n"],"names":["hasNamespace","name","namespace","endsWith","startsWith","addNamespace","removeNamespace","replace"],"mappings":";;AAAMA,MAAAA,YAAAA,GAAe,CAACC,IAAcC,EAAAA,SAAAA,GAAAA;AAClC,IAAA,IAAI,CAACA,SAAW,EAAA;QACd,OAAO,IAAA;AACT;IAEA,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAOF,IAAAA,CAAKG,UAAU,CAACF,SAAAA,CAAAA;AACzB;AACA,IAAA,OAAOD,KAAKG,UAAU,CAAC,CAAGF,EAAAA,SAAAA,CAAU,CAAC,CAAC,CAAA;AACxC;AAEMG,MAAAA,YAAAA,GAAe,CAACJ,IAAcC,EAAAA,SAAAA,GAAAA;IAClC,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAO,CAAA,EAAGD,YAAYD,IAAM,CAAA,CAAA;AAC9B;AACA,IAAA,OAAO,CAAGC,EAAAA,SAAAA,CAAU,CAAC,EAAED,IAAM,CAAA,CAAA;AAC/B;AAEMK,MAAAA,eAAAA,GAAkB,CAACL,IAAcC,EAAAA,SAAAA,GAAAA;IACrC,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAOF,IAAAA,CAAKM,OAAO,CAACL,SAAW,EAAA,EAAA,CAAA;AACjC;AACA,IAAA,OAAOD,KAAKM,OAAO,CAAC,GAAGL,SAAU,CAAA,CAAC,CAAC,EAAE,EAAA,CAAA;AACvC;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.mjs","sources":["../../src/registries/namespace.ts"],"sourcesContent":["const hasNamespace = (name: string, namespace: string) => {\n if (!namespace) {\n return true;\n }\n\n if (namespace.endsWith('::')) {\n return name.startsWith(namespace);\n }\n return name.startsWith(`${namespace}.`);\n};\n\nconst addNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return `${namespace}${name}`;\n }\n return `${namespace}.${name}`;\n};\n\nconst removeNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return name.replace(namespace, '');\n }\n return name.replace(`${namespace}.`, '');\n};\n\nexport { addNamespace, removeNamespace, hasNamespace };\n"],"names":["hasNamespace","name","namespace","endsWith","startsWith","addNamespace","removeNamespace","replace"],"mappings":"AAAMA,MAAAA,YAAAA,GAAe,CAACC,IAAcC,EAAAA,SAAAA,GAAAA;AAClC,IAAA,IAAI,CAACA,SAAW,EAAA;QACd,OAAO,IAAA;AACT;IAEA,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAOF,IAAAA,CAAKG,UAAU,CAACF,SAAAA,CAAAA;AACzB;AACA,IAAA,OAAOD,KAAKG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"namespace.mjs","sources":["../../src/registries/namespace.ts"],"sourcesContent":["const hasNamespace = (name: string, namespace: string) => {\n if (!namespace) {\n return true;\n }\n\n if (namespace.endsWith('::')) {\n return name.startsWith(namespace);\n }\n return name.startsWith(`${namespace}.`);\n};\n\nconst addNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return `${namespace}${name}`;\n }\n return `${namespace}.${name}`;\n};\n\nconst removeNamespace = (name: string, namespace: string) => {\n if (namespace.endsWith('::')) {\n return name.replace(namespace, '');\n }\n return name.replace(`${namespace}.`, '');\n};\n\nexport { addNamespace, removeNamespace, hasNamespace };\n"],"names":["hasNamespace","name","namespace","endsWith","startsWith","addNamespace","removeNamespace","replace"],"mappings":"AAAMA,MAAAA,YAAAA,GAAe,CAACC,IAAcC,EAAAA,SAAAA,GAAAA;AAClC,IAAA,IAAI,CAACA,SAAW,EAAA;QACd,OAAO,IAAA;AACT;IAEA,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAOF,IAAAA,CAAKG,UAAU,CAACF,SAAAA,CAAAA;AACzB;AACA,IAAA,OAAOD,KAAKG,UAAU,CAAC,CAAGF,EAAAA,SAAAA,CAAU,CAAC,CAAC,CAAA;AACxC;AAEMG,MAAAA,YAAAA,GAAe,CAACJ,IAAcC,EAAAA,SAAAA,GAAAA;IAClC,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAO,CAAA,EAAGD,YAAYD,IAAM,CAAA,CAAA;AAC9B;AACA,IAAA,OAAO,CAAGC,EAAAA,SAAAA,CAAU,CAAC,EAAED,IAAM,CAAA,CAAA;AAC/B;AAEMK,MAAAA,eAAAA,GAAkB,CAACL,IAAcC,EAAAA,SAAAA,GAAAA;IACrC,IAAIA,SAAAA,CAAUC,QAAQ,CAAC,IAAO,CAAA,EAAA;QAC5B,OAAOF,IAAAA,CAAKM,OAAO,CAACL,SAAW,EAAA,EAAA,CAAA;AACjC;AACA,IAAA,OAAOD,KAAKM,OAAO,CAAC,GAAGL,SAAU,CAAA,CAAC,CAAC,EAAE,EAAA,CAAA;AACvC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sources":["../../src/registries/plugins.ts"],"sourcesContent":["import { has } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\ntype PluginMap = Record<string, Core.Plugin>;\n\nconst pluginsRegistry = (strapi: Core.Strapi) => {\n const plugins: PluginMap = {};\n\n return {\n get(name: string) {\n return plugins[name];\n },\n getAll() {\n return plugins;\n },\n add(name: string, pluginConfig: Core.Plugin) {\n if (has(name, plugins)) {\n throw new Error(`Plugin ${name} has already been registered.`);\n }\n\n const pluginModule = strapi.get('modules').add(`plugin::${name}`, pluginConfig);\n plugins[name] = pluginModule;\n\n return plugins[name];\n },\n };\n};\n\nexport default pluginsRegistry;\n"],"names":["pluginsRegistry","strapi","plugins","get","name","getAll","add","pluginConfig","has","Error","pluginModule"],"mappings":";;;;AAMA,MAAMA,kBAAkB,CAACC,MAAAA,GAAAA;AACvB,IAAA,MAAMC,UAAqB,EAAC;IAE5B,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,OAAO,CAACE,IAAK,CAAA;AACtB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT,SAAA;QACAI,GAAIF,CAAAA,CAAAA,IAAY,EAAEG,YAAyB,EAAA;YACzC,IAAIC,MAAAA,CAAIJ,MAAMF,OAAU,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIO,KAAM,CAAA,CAAC,OAAO,EAAEL,IAAAA,CAAK,6BAA6B,CAAC,CAAA;AAC/D;
|
|
1
|
+
{"version":3,"file":"plugins.js","sources":["../../src/registries/plugins.ts"],"sourcesContent":["import { has } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\ntype PluginMap = Record<string, Core.Plugin>;\n\nconst pluginsRegistry = (strapi: Core.Strapi) => {\n const plugins: PluginMap = {};\n\n return {\n get(name: string) {\n return plugins[name];\n },\n getAll() {\n return plugins;\n },\n add(name: string, pluginConfig: Core.Plugin) {\n if (has(name, plugins)) {\n throw new Error(`Plugin ${name} has already been registered.`);\n }\n\n const pluginModule = strapi.get('modules').add(`plugin::${name}`, pluginConfig);\n plugins[name] = pluginModule;\n\n return plugins[name];\n },\n };\n};\n\nexport default pluginsRegistry;\n"],"names":["pluginsRegistry","strapi","plugins","get","name","getAll","add","pluginConfig","has","Error","pluginModule"],"mappings":";;;;AAMA,MAAMA,kBAAkB,CAACC,MAAAA,GAAAA;AACvB,IAAA,MAAMC,UAAqB,EAAC;IAE5B,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,OAAO,CAACE,IAAK,CAAA;AACtB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT,SAAA;QACAI,GAAIF,CAAAA,CAAAA,IAAY,EAAEG,YAAyB,EAAA;YACzC,IAAIC,MAAAA,CAAIJ,MAAMF,OAAU,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIO,KAAM,CAAA,CAAC,OAAO,EAAEL,IAAAA,CAAK,6BAA6B,CAAC,CAAA;AAC/D;YAEA,MAAMM,YAAAA,GAAeT,MAAOE,CAAAA,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,QAAQ,EAAEF,IAAAA,CAAAA,CAAM,EAAEG,YAAAA,CAAAA;YAClEL,OAAO,CAACE,KAAK,GAAGM,YAAAA;YAEhB,OAAOR,OAAO,CAACE,IAAK,CAAA;AACtB;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","sources":["../../src/registries/plugins.ts"],"sourcesContent":["import { has } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\ntype PluginMap = Record<string, Core.Plugin>;\n\nconst pluginsRegistry = (strapi: Core.Strapi) => {\n const plugins: PluginMap = {};\n\n return {\n get(name: string) {\n return plugins[name];\n },\n getAll() {\n return plugins;\n },\n add(name: string, pluginConfig: Core.Plugin) {\n if (has(name, plugins)) {\n throw new Error(`Plugin ${name} has already been registered.`);\n }\n\n const pluginModule = strapi.get('modules').add(`plugin::${name}`, pluginConfig);\n plugins[name] = pluginModule;\n\n return plugins[name];\n },\n };\n};\n\nexport default pluginsRegistry;\n"],"names":["pluginsRegistry","strapi","plugins","get","name","getAll","add","pluginConfig","has","Error","pluginModule"],"mappings":";;AAMA,MAAMA,kBAAkB,CAACC,MAAAA,GAAAA;AACvB,IAAA,MAAMC,UAAqB,EAAC;IAE5B,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,OAAO,CAACE,IAAK,CAAA;AACtB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT,SAAA;QACAI,GAAIF,CAAAA,CAAAA,IAAY,EAAEG,YAAyB,EAAA;YACzC,IAAIC,GAAAA,CAAIJ,MAAMF,OAAU,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIO,KAAM,CAAA,CAAC,OAAO,EAAEL,IAAAA,CAAK,6BAA6B,CAAC,CAAA;AAC/D;
|
|
1
|
+
{"version":3,"file":"plugins.mjs","sources":["../../src/registries/plugins.ts"],"sourcesContent":["import { has } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\ntype PluginMap = Record<string, Core.Plugin>;\n\nconst pluginsRegistry = (strapi: Core.Strapi) => {\n const plugins: PluginMap = {};\n\n return {\n get(name: string) {\n return plugins[name];\n },\n getAll() {\n return plugins;\n },\n add(name: string, pluginConfig: Core.Plugin) {\n if (has(name, plugins)) {\n throw new Error(`Plugin ${name} has already been registered.`);\n }\n\n const pluginModule = strapi.get('modules').add(`plugin::${name}`, pluginConfig);\n plugins[name] = pluginModule;\n\n return plugins[name];\n },\n };\n};\n\nexport default pluginsRegistry;\n"],"names":["pluginsRegistry","strapi","plugins","get","name","getAll","add","pluginConfig","has","Error","pluginModule"],"mappings":";;AAMA,MAAMA,kBAAkB,CAACC,MAAAA,GAAAA;AACvB,IAAA,MAAMC,UAAqB,EAAC;IAE5B,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,OAAO,CAACE,IAAK,CAAA;AACtB,SAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,OAAAA;AACT,SAAA;QACAI,GAAIF,CAAAA,CAAAA,IAAY,EAAEG,YAAyB,EAAA;YACzC,IAAIC,GAAAA,CAAIJ,MAAMF,OAAU,CAAA,EAAA;AACtB,gBAAA,MAAM,IAAIO,KAAM,CAAA,CAAC,OAAO,EAAEL,IAAAA,CAAK,6BAA6B,CAAC,CAAA;AAC/D;YAEA,MAAMM,YAAAA,GAAeT,MAAOE,CAAAA,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,QAAQ,EAAEF,IAAAA,CAAAA,CAAM,EAAEG,YAAAA,CAAAA;YAClEL,OAAO,CAACE,KAAK,GAAGM,YAAAA;YAEhB,OAAOR,OAAO,CAACE,IAAK,CAAA;AACtB;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","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.js","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,CAAA,EAAGd,gBAAgBY,UAAW,CAAA,CAAC,EAA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,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":"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,MAA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,EAAAA,SAAAA,CAAAA;gBAErC,IAAIH,GAAAA,CAAIM,KAAKvB,QAAW,CAAA,EAAA;AACtB,oBAAA,MAAM,IAAIY,KAAM,CAAA,CAAC,OAAO,EAAEW,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AAC9D;gBAEAvB,QAAS2B,CAAAA,GAAG,CAACJ,GAAK5B,EAAAA,MAAAA,CAAAA;AACpB;AACF,SAAA;AAEA;;QAGAoC,OAAAA,CAAAA,CAAQlC,MAAqC,EAAEM,aAA6B,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,I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AAyBP,IAAOiB,CAAAA,EAAAA,GAAAA,CAAAA;AAClD,YAAA,OAAO,IAAI;AACb,SAAA;AACAC,QAAAA,GAAAA,CAAAA,CAAIlB,IAAkB,EAAA;AACpB,YAAA,OAAOkB,KAAIrB,CAAAA,KAAAA,CAAMC,MAAM,EAAES,wBAAyBP,CAAAA,IAAAA,CAAAA,CAAAA;AACpD;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,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AmB,CAAC;AAC7CC,QAAAA,QAAAA,CAAAA,CAASC,GAAW,EAAA;YAClB,OAAOzB,MAAAA,CAAOwB,QAAQ,CAACC,GAAAA,CAAAA;AACzB,SAAA;;AAEA,QAAA,IAAIC,UAAa,CAAA,GAAA;YACf,OAAO;AACLC,gBAAAA,KAAAA,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,oBAASC,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,KAAgClC,CAAAA,MAAAA,CAAAA;AAC7CC,QAAAA,YAAAA;QACAqB,QAAUD,EAAAA,SAAAA;QACVS,QAAUD,EAAAA;AACZ,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,IA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