{"version":3,"file":"list.mjs","sources":["../../../../../src/cli/commands/policies/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n  const appContext = await compileStrapi();\n  const app = await createStrapi(appContext).register();\n\n  const list = app.get('policies').keys();\n\n  const infoTable = new CLITable({\n    head: [chalk.blue('Name')],\n  });\n\n  list.forEach((name: string) => infoTable.push([name]));\n\n  console.log(infoTable.toString());\n\n  await app.destroy();\n};\n\n/**\n * `$ strapi policies:list`\n */\nconst command: StrapiCommand = () => {\n  return createCommand('policies:list')\n    .description('List all the application policies')\n    .action(runAction('policies:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","get","keys","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAAA,GAAS,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAAA,GAAM,MAAMC,YAAAA,CAAaH,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAAA,GAAOH,GAAAA,CAAII,GAAG,CAAC,YAAYC,IAAI,EAAA;IAErC,MAAMC,SAAAA,GAAY,IAAIC,QAAAA,CAAS;QAC7BC,IAAAA,EAAM;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAP,IAAAA,IAAAA,CAAKQ,OAAO,CAAC,CAACC,IAAAA,GAAiBN,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAEpDE,OAAAA,CAAQC,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMhB,IAAIiB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,iBAClBC,WAAW,CAAC,qCACZvB,MAAM,CAACwB,UAAU,eAAA,EAAiBxB,MAAAA,CAAAA,CAAAA;AACvC;;;;"}