{"version":3,"file":"index.mjs","sources":["../../../src/core-api/service/index.ts"],"sourcesContent":["import { contentTypes as contentTypeUtils } from '@strapi/utils';\nimport type { Core, Struct } from '@strapi/types';\n\nimport { createSingleTypeService } from './single-type';\nimport { createCollectionTypeService } from './collection-type';\n\nconst isSingleType = (\n contentType: Struct.ContentTypeSchema\n): contentType is Struct.SingleTypeSchema => contentTypeUtils.isSingleType(contentType);\n\n/**\n * Returns a core api for the provided model\n */\nfunction createService(opts: {\n contentType: T;\n}): T extends Struct.SingleTypeSchema\n ? Core.CoreAPI.Service.SingleType\n : Core.CoreAPI.Service.CollectionType;\nfunction createService({\n contentType,\n}: {\n contentType: Struct.CollectionTypeSchema | Struct.SingleTypeSchema;\n}): Core.CoreAPI.Service.SingleType | Core.CoreAPI.Service.CollectionType {\n if (isSingleType(contentType)) {\n return createSingleTypeService(contentType);\n }\n\n return createCollectionTypeService(contentType);\n}\n\nexport { createService };\n"],"names":["isSingleType","contentType","contentTypeUtils","createService","createSingleTypeService","createCollectionTypeService"],"mappings":";;;;AAMA,MAAMA,YAAe,GAAA,CACnBC,WAC2CC,GAAAA,YAAAA,CAAiBF,YAAY,CAACC,WAAAA,CAAAA;AAU3E,SAASE,aAAAA,CAAc,EACrBF,WAAW,EAGZ,EAAA;AACC,IAAA,IAAID,aAAaC,WAAc,CAAA,EAAA;AAC7B,QAAA,OAAOG,uBAAwBH,CAAAA,WAAAA,CAAAA;AACjC;AAEA,IAAA,OAAOI,2BAA4BJ,CAAAA,WAAAA,CAAAA;AACrC;;;;"}