{"version":3,"file":"is-initialized.mjs","sources":["../../src/utils/is-initialized.ts"],"sourcesContent":["import { isEmpty, isNil } from 'lodash/fp';\n\nimport type { Core } from '@strapi/types';\n\n/**\n * Test if the strapi application is considered as initialized (1st user has been created)\n */\nexport const isInitialized = async (strapi: Core.Strapi): Promise<boolean> => {\n  try {\n    if (isEmpty(strapi.admin)) {\n      return true;\n    }\n\n    // test if there is at least one admin\n    const anyAdministrator = await strapi.db.query('admin::user').findOne({ select: ['id'] });\n\n    return !isNil(anyAdministrator);\n  } catch (err) {\n    strapi.stopWithError(err);\n  }\n};\n"],"names":["isInitialized","strapi","isEmpty","admin","anyAdministrator","db","query","findOne","select","isNil","err","stopWithError"],"mappings":";;AAIA;;IAGO,MAAMA,aAAAA,GAAgB,OAAOC,MAAAA,GAAAA;IAClC,IAAI;QACF,IAAIC,OAAAA,CAAQD,MAAAA,CAAOE,KAAK,CAAA,EAAG;YACzB,OAAO,IAAA;AACT,QAAA;;QAGA,MAAMC,gBAAAA,GAAmB,MAAMH,MAAAA,CAAOI,EAAE,CAACC,KAAK,CAAC,aAAA,CAAA,CAAeC,OAAO,CAAC;YAAEC,MAAAA,EAAQ;AAAC,gBAAA;AAAK;AAAC,SAAA,CAAA;AAEvF,QAAA,OAAO,CAACC,KAAAA,CAAML,gBAAAA,CAAAA;AAChB,IAAA,CAAA,CAAE,OAAOM,GAAAA,EAAK;AACZT,QAAAA,MAAAA,CAAOU,aAAa,CAACD,GAAAA,CAAAA;AACvB,IAAA;AACF;;;;"}