{"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<T extends Struct.SingleTypeSchema | Struct.CollectionTypeSchema>(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,YAAAA,GAAe,CACnBC,WAAAA,GAC2CC,YAAAA,CAAiBF,YAAY,CAACC,WAAAA,CAAAA;AAU3E,SAASE,aAAAA,CAAc,EACrBF,WAAW,EAGZ,EAAA;AACC,IAAA,IAAID,aAAaC,WAAAA,CAAAA,EAAc;AAC7B,QAAA,OAAOG,uBAAAA,CAAwBH,WAAAA,CAAAA;AACjC,IAAA;AAEA,IAAA,OAAOI,2BAAAA,CAA4BJ,WAAAA,CAAAA;AACrC;;;;"}