@strapi/generators 0.0.0-next.f7babb775ed9a7e18d8351cb7f74c63e016323c4 → 0.0.0-next.f86041c89a8c1545c6437a881dc613e98bc52bd7

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.
Files changed (195) hide show
  1. package/LICENSE +18 -3
  2. package/dist/index.d.ts +10 -5
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +92 -27
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +94 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/plopfile.d.ts +2 -1
  9. package/dist/plopfile.d.ts.map +1 -0
  10. package/dist/plopfile.js +24 -26
  11. package/dist/plopfile.js.map +1 -1
  12. package/dist/plopfile.mjs +25 -0
  13. package/dist/plopfile.mjs.map +1 -0
  14. package/dist/plops/api.d.ts +2 -1
  15. package/dist/plops/api.d.ts.map +1 -0
  16. package/dist/plops/api.js +107 -37
  17. package/dist/plops/api.js.map +1 -1
  18. package/dist/plops/api.mjs +147 -0
  19. package/dist/plops/api.mjs.map +1 -0
  20. package/dist/plops/content-type.d.ts +2 -1
  21. package/dist/plops/content-type.d.ts.map +1 -0
  22. package/dist/plops/content-type.js +170 -83
  23. package/dist/plops/content-type.js.map +1 -1
  24. package/dist/plops/content-type.mjs +243 -0
  25. package/dist/plops/content-type.mjs.map +1 -0
  26. package/dist/plops/controller.d.ts +2 -1
  27. package/dist/plops/controller.d.ts.map +1 -0
  28. package/dist/plops/controller.js +54 -21
  29. package/dist/plops/controller.js.map +1 -1
  30. package/dist/plops/controller.mjs +71 -0
  31. package/dist/plops/controller.mjs.map +1 -0
  32. package/dist/plops/middleware.d.ts +2 -1
  33. package/dist/plops/middleware.d.ts.map +1 -0
  34. package/dist/plops/middleware.js +56 -21
  35. package/dist/plops/middleware.js.map +1 -1
  36. package/dist/plops/middleware.mjs +73 -0
  37. package/dist/plops/middleware.mjs.map +1 -0
  38. package/dist/plops/migration.d.ts +2 -1
  39. package/dist/plops/migration.d.ts.map +1 -0
  40. package/dist/plops/migration.js +19 -19
  41. package/dist/plops/migration.js.map +1 -1
  42. package/dist/plops/migration.mjs +33 -0
  43. package/dist/plops/migration.mjs.map +1 -0
  44. package/dist/plops/policy.d.ts +2 -1
  45. package/dist/plops/policy.d.ts.map +1 -0
  46. package/dist/plops/policy.js +56 -21
  47. package/dist/plops/policy.js.map +1 -1
  48. package/dist/plops/policy.mjs +73 -0
  49. package/dist/plops/policy.mjs.map +1 -0
  50. package/dist/plops/prompts/bootstrap-api-prompts.d.ts +7 -2
  51. package/dist/plops/prompts/bootstrap-api-prompts.d.ts.map +1 -0
  52. package/dist/plops/prompts/bootstrap-api-prompts.js +7 -6
  53. package/dist/plops/prompts/bootstrap-api-prompts.js.map +1 -1
  54. package/dist/plops/prompts/bootstrap-api-prompts.mjs +11 -0
  55. package/dist/plops/prompts/bootstrap-api-prompts.mjs.map +1 -0
  56. package/dist/plops/prompts/ct-names-prompts.d.ts +19 -2
  57. package/dist/plops/prompts/ct-names-prompts.d.ts.map +1 -0
  58. package/dist/plops/prompts/ct-names-prompts.js +19 -43
  59. package/dist/plops/prompts/ct-names-prompts.js.map +1 -1
  60. package/dist/plops/prompts/ct-names-prompts.mjs +42 -0
  61. package/dist/plops/prompts/ct-names-prompts.mjs.map +1 -0
  62. package/dist/plops/prompts/get-attributes-prompts.d.ts +9 -2
  63. package/dist/plops/prompts/get-attributes-prompts.d.ts.map +1 -0
  64. package/dist/plops/prompts/get-attributes-prompts.js +36 -30
  65. package/dist/plops/prompts/get-attributes-prompts.js.map +1 -1
  66. package/dist/plops/prompts/get-attributes-prompts.mjs +99 -0
  67. package/dist/plops/prompts/get-attributes-prompts.mjs.map +1 -0
  68. package/dist/plops/prompts/get-destination-prompts.d.ts +25 -2
  69. package/dist/plops/prompts/get-destination-prompts.d.ts.map +1 -0
  70. package/dist/plops/prompts/get-destination-prompts.js +47 -41
  71. package/dist/plops/prompts/get-destination-prompts.js.map +1 -1
  72. package/dist/plops/prompts/get-destination-prompts.mjs +76 -0
  73. package/dist/plops/prompts/get-destination-prompts.mjs.map +1 -0
  74. package/dist/plops/prompts/kind-prompts.d.ts +12 -2
  75. package/dist/plops/prompts/kind-prompts.d.ts.map +1 -0
  76. package/dist/plops/prompts/kind-prompts.js +17 -12
  77. package/dist/plops/prompts/kind-prompts.js.map +1 -1
  78. package/dist/plops/prompts/kind-prompts.mjs +24 -0
  79. package/dist/plops/prompts/kind-prompts.mjs.map +1 -0
  80. package/dist/plops/service.d.ts +2 -1
  81. package/dist/plops/service.d.ts.map +1 -0
  82. package/dist/plops/service.js +53 -20
  83. package/dist/plops/service.js.map +1 -1
  84. package/dist/plops/service.mjs +69 -0
  85. package/dist/plops/service.mjs.map +1 -0
  86. package/dist/plops/utils/extend-plugin-index-files.d.ts +8 -0
  87. package/dist/plops/utils/extend-plugin-index-files.d.ts.map +1 -0
  88. package/dist/plops/utils/extend-plugin-index-files.js +356 -0
  89. package/dist/plops/utils/extend-plugin-index-files.js.map +1 -0
  90. package/dist/plops/utils/extend-plugin-index-files.mjs +335 -0
  91. package/dist/plops/utils/extend-plugin-index-files.mjs.map +1 -0
  92. package/dist/plops/utils/get-file-path.d.ts +2 -1
  93. package/dist/plops/utils/get-file-path.d.ts.map +1 -0
  94. package/dist/plops/utils/get-file-path.js +9 -7
  95. package/dist/plops/utils/get-file-path.js.map +1 -1
  96. package/dist/plops/utils/get-file-path.mjs +15 -0
  97. package/dist/plops/utils/get-file-path.mjs.map +1 -0
  98. package/dist/plops/utils/get-formatted-date.d.ts +1 -0
  99. package/dist/plops/utils/get-formatted-date.d.ts.map +1 -0
  100. package/dist/plops/utils/get-formatted-date.js +8 -9
  101. package/dist/plops/utils/get-formatted-date.js.map +1 -1
  102. package/dist/plops/utils/get-formatted-date.mjs +6 -0
  103. package/dist/plops/utils/get-formatted-date.mjs.map +1 -0
  104. package/dist/plops/utils/validate-attribute-input.d.ts +1 -0
  105. package/dist/plops/utils/validate-attribute-input.d.ts.map +1 -0
  106. package/dist/plops/utils/validate-attribute-input.js +7 -5
  107. package/dist/plops/utils/validate-attribute-input.js.map +1 -1
  108. package/dist/plops/utils/validate-attribute-input.mjs +10 -0
  109. package/dist/plops/utils/validate-attribute-input.mjs.map +1 -0
  110. package/dist/plops/utils/validate-file-name-input.d.ts +1 -0
  111. package/dist/plops/utils/validate-file-name-input.d.ts.map +1 -0
  112. package/dist/plops/utils/validate-file-name-input.js +7 -5
  113. package/dist/plops/utils/validate-file-name-input.js.map +1 -1
  114. package/dist/plops/utils/validate-file-name-input.mjs +10 -0
  115. package/dist/plops/utils/validate-file-name-input.mjs.map +1 -0
  116. package/dist/plops/utils/validate-input.d.ts +1 -0
  117. package/dist/plops/utils/validate-input.d.ts.map +1 -0
  118. package/dist/plops/utils/validate-input.js +7 -5
  119. package/dist/plops/utils/validate-input.js.map +1 -1
  120. package/dist/plops/utils/validate-input.mjs +10 -0
  121. package/dist/plops/utils/validate-input.mjs.map +1 -0
  122. package/dist/templates/js/content-type.schema.json.hbs +0 -1
  123. package/dist/templates/js/plugin/plugin.routes.index.js.hbs +12 -0
  124. package/dist/templates/js/plugin/plugin.routes.type.index.js.hbs +6 -0
  125. package/dist/templates/ts/content-type.schema.json.hbs +0 -1
  126. package/dist/templates/ts/core-controller.ts.hbs +1 -1
  127. package/dist/templates/ts/middleware.ts.hbs +2 -2
  128. package/dist/templates/ts/plugin/plugin.routes.index.ts.hbs +9 -0
  129. package/dist/templates/ts/plugin/plugin.routes.type.index.ts.hbs +4 -0
  130. package/package.json +25 -17
  131. package/dist/files/js/plugin/.editorconfig +0 -7
  132. package/dist/files/js/plugin/.gitattributes +0 -103
  133. package/dist/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
  134. package/dist/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
  135. package/dist/files/js/plugin/admin/src/index.js +0 -63
  136. package/dist/files/js/plugin/admin/src/pages/App/index.js +0 -25
  137. package/dist/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
  138. package/dist/files/js/plugin/admin/src/pluginId.js +0 -5
  139. package/dist/files/js/plugin/admin/src/translations/en.json +0 -1
  140. package/dist/files/js/plugin/admin/src/translations/fr.json +0 -1
  141. package/dist/files/js/plugin/admin/src/utils/getTrad.js +0 -5
  142. package/dist/files/js/plugin/server/bootstrap.js +0 -5
  143. package/dist/files/js/plugin/server/config/index.js +0 -6
  144. package/dist/files/js/plugin/server/controllers/index.js +0 -7
  145. package/dist/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
  146. package/dist/files/js/plugin/server/destroy.js +0 -5
  147. package/dist/files/js/plugin/server/index.js +0 -25
  148. package/dist/files/js/plugin/server/middlewares/index.js +0 -3
  149. package/dist/files/js/plugin/server/policies/index.js +0 -3
  150. package/dist/files/js/plugin/server/register.js +0 -5
  151. package/dist/files/js/plugin/server/routes/index.js +0 -10
  152. package/dist/files/js/plugin/server/services/index.js +0 -7
  153. package/dist/files/js/plugin/server/services/my-service.js +0 -7
  154. package/dist/files/js/plugin/strapi-admin.js +0 -3
  155. package/dist/files/js/plugin/strapi-server.js +0 -3
  156. package/dist/files/ts/plugin/.editorconfig +0 -7
  157. package/dist/files/ts/plugin/.gitattributes +0 -103
  158. package/dist/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
  159. package/dist/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
  160. package/dist/files/ts/plugin/admin/src/index.tsx +0 -67
  161. package/dist/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
  162. package/dist/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
  163. package/dist/files/ts/plugin/admin/src/pluginId.ts +0 -5
  164. package/dist/files/ts/plugin/admin/src/translations/en.json +0 -1
  165. package/dist/files/ts/plugin/admin/src/translations/fr.json +0 -1
  166. package/dist/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
  167. package/dist/files/ts/plugin/custom.d.ts +0 -5
  168. package/dist/files/ts/plugin/server/bootstrap.ts +0 -5
  169. package/dist/files/ts/plugin/server/config/index.ts +0 -4
  170. package/dist/files/ts/plugin/server/controllers/index.ts +0 -5
  171. package/dist/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
  172. package/dist/files/ts/plugin/server/destroy.ts +0 -5
  173. package/dist/files/ts/plugin/server/index.ts +0 -23
  174. package/dist/files/ts/plugin/server/middlewares/index.ts +0 -1
  175. package/dist/files/ts/plugin/server/policies/index.ts +0 -1
  176. package/dist/files/ts/plugin/server/register.ts +0 -5
  177. package/dist/files/ts/plugin/server/routes/index.ts +0 -10
  178. package/dist/files/ts/plugin/server/services/index.ts +0 -5
  179. package/dist/files/ts/plugin/server/services/my-service.ts +0 -7
  180. package/dist/files/ts/plugin/strapi-admin.js +0 -3
  181. package/dist/files/ts/plugin/strapi-server.js +0 -3
  182. package/dist/files/ts/plugin/tsconfig.json +0 -20
  183. package/dist/files/ts/plugin/tsconfig.server.json +0 -25
  184. package/dist/plops/plugin.d.ts +0 -3
  185. package/dist/plops/plugin.js +0 -107
  186. package/dist/plops/plugin.js.map +0 -1
  187. package/dist/plops/prompts/draft-and-publish-prompts.d.ts +0 -3
  188. package/dist/plops/prompts/draft-and-publish-prompts.js +0 -12
  189. package/dist/plops/prompts/draft-and-publish-prompts.js.map +0 -1
  190. package/dist/templates/js/README.md.hbs +0 -3
  191. package/dist/templates/js/plugin-package.json.hbs +0 -42
  192. package/dist/templates/ts/README.md.hbs +0 -3
  193. package/dist/templates/ts/plugin-package.json.hbs +0 -51
  194. /package/dist/{files/js/plugin/server/content-types/index.js → templates/js/plugin/plugin.index.js.hbs} +0 -0
  195. /package/dist/{files/ts/plugin/server/content-types/index.ts → templates/ts/plugin/plugin.index.ts.hbs} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/plops/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,MAAM,CAAC;+BAU9B,WAAW;AAAjC,wBAoEE"}
@@ -1,13 +1,14 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const typescript_utils_1 = __importDefault(require("@strapi/typescript-utils"));
7
- const get_destination_prompts_1 = __importDefault(require("./prompts/get-destination-prompts"));
8
- const validate_input_1 = __importDefault(require("./utils/validate-input"));
9
- const get_file_path_1 = __importDefault(require("./utils/get-file-path"));
10
- exports.default = (plop) => {
1
+ 'use strict';
2
+
3
+ var tsUtils = require('@strapi/typescript-utils');
4
+ var path = require('path');
5
+ var fs = require('fs');
6
+ var getDestinationPrompts = require('./prompts/get-destination-prompts.js');
7
+ var validateInput = require('./utils/validate-input.js');
8
+ var getFilePath = require('./utils/get-file-path.js');
9
+ var extendPluginIndexFiles = require('./utils/extend-plugin-index-files.js');
10
+
11
+ var generatePolicy = ((plop)=>{
11
12
  // Policy generator
12
13
  plop.setGenerator('policy', {
13
14
  description: 'Generate a policy for an API',
@@ -16,25 +17,59 @@ exports.default = (plop) => {
16
17
  type: 'input',
17
18
  name: 'id',
18
19
  message: 'Policy name',
19
- validate: (input) => (0, validate_input_1.default)(input),
20
+ validate: (input)=>validateInput(input)
20
21
  },
21
- ...(0, get_destination_prompts_1.default)('policy', plop.getDestBasePath(), { rootFolder: true }),
22
+ ...getDestinationPrompts('policy', plop.getDestBasePath(), {
23
+ rootFolder: true
24
+ })
22
25
  ],
23
- actions(answers) {
26
+ actions (answers) {
24
27
  if (!answers) {
25
28
  return [];
26
29
  }
27
- const filePath = (0, get_file_path_1.default)(answers.destination);
28
30
  const currentDir = process.cwd();
29
- const language = typescript_utils_1.default.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
30
- return [
31
+ const filePath = getFilePath(answers.destination);
32
+ let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
33
+ if (answers.plugin) {
34
+ // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.
35
+ const pluginServerDir = path.join(currentDir, 'src', filePath.replace('{{ plugin }}', answers.plugin), '../');
36
+ language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';
37
+ }
38
+ const baseActions = [
31
39
  {
32
40
  type: 'add',
33
41
  path: `${filePath}/policies/{{ id }}.${language}`,
34
- templateFile: `templates/${language}/policy.${language}.hbs`,
35
- },
42
+ templateFile: `templates/${language}/policy.${language}.hbs`
43
+ }
36
44
  ];
37
- },
45
+ if (answers.plugin) {
46
+ const indexPath = path.join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);
47
+ const exists = fs.existsSync(indexPath);
48
+ if (!exists) {
49
+ // Create index file if it doesn't exist
50
+ baseActions.push({
51
+ type: 'add',
52
+ path: `${filePath}/policies/index.${language}`,
53
+ templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,
54
+ skipIfExists: true
55
+ });
56
+ }
57
+ // Append the new policy to the index.ts file
58
+ baseActions.push({
59
+ type: 'modify',
60
+ path: `${filePath}/policies/index.${language}`,
61
+ transform (template) {
62
+ return extendPluginIndexFiles.appendToFile(template, {
63
+ type: 'index',
64
+ singularName: answers.id
65
+ });
66
+ }
67
+ });
68
+ }
69
+ return baseActions;
70
+ }
38
71
  });
39
- };
40
- //# sourceMappingURL=policy.js.map
72
+ });
73
+
74
+ module.exports = generatePolicy;
75
+ //# sourceMappingURL=policy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/plops/policy.ts"],"names":[],"mappings":";;;;;AACA,gFAA+C;AAE/C,gGAAsE;AACtE,4EAAmD;AACnD,0EAAgD;AAEhD,kBAAe,CAAC,IAAiB,EAAE,EAAE;IACnC,mBAAmB;IACnB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,WAAW,EAAE,8BAA8B;QAC3C,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,aAAa;gBACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC;aAC1C;YACD,GAAG,IAAA,iCAAqB,EAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;SACjF;QACD,OAAO,CAAC,OAAO;YACb,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,EAAE,CAAC;aACX;YAED,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,0BAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YAEzE,OAAO;gBACL;oBACE,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,GAAG,QAAQ,sBAAsB,QAAQ,EAAE;oBACjD,YAAY,EAAE,aAAa,QAAQ,WAAW,QAAQ,MAAM;iBAC7D;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
1
+ {"version":3,"file":"policy.js","sources":["../../src/plops/policy.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\n\nexport default (plop: NodePlopAPI) => {\n // Policy generator\n plop.setGenerator('policy', {\n description: 'Generate a policy for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Policy name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const currentDir = process.cwd();\n const filePath = getFilePath(answers.destination);\n let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/policies/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new policy to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/policies/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","currentDir","process","cwd","filePath","getFilePath","destination","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;;;AAUA,qBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAKC,CAAAA,YAAY,CAAC,QAAU,EAAA;QAC1BC,WAAa,EAAA,8BAAA;QACbC,OAAS,EAAA;AACP,YAAA;gBACEC,IAAM,EAAA,OAAA;gBACNC,IAAM,EAAA,IAAA;gBACNC,OAAS,EAAA,aAAA;gBACTC,QAAU,EAAA,CAACC,QAAUC,aAAcD,CAAAA,KAAAA;AACrC,aAAA;eACGE,qBAAsB,CAAA,QAAA,EAAUV,IAAKW,CAAAA,eAAe,EAAI,EAAA;gBAAEC,UAAY,EAAA;AAAK,aAAA;AAC/E,SAAA;AACDC,QAAAA,OAAAA,CAAAA,CAAQC,OAAO,EAAA;AACb,YAAA,IAAI,CAACA,OAAS,EAAA;AACZ,gBAAA,OAAO,EAAE;AACX;YAEA,MAAMC,UAAAA,GAAaC,QAAQC,GAAG,EAAA;YAC9B,MAAMC,QAAAA,GAAWC,WAAYL,CAAAA,OAAAA,CAAQM,WAAW,CAAA;AAChD,YAAA,IAAIC,QAAWC,GAAAA,OAAAA,CAAQC,qBAAqB,CAACR,cAAc,IAAO,GAAA,IAAA;YAElE,IAAID,OAAAA,CAAQU,MAAM,EAAE;;gBAElB,MAAMC,eAAAA,GAAkBC,SACtBX,CAAAA,UAAAA,EACA,KACAG,EAAAA,QAAAA,CAASS,OAAO,CAAC,cAAA,EAAgBb,OAAQU,CAAAA,MAAM,CAC/C,EAAA,KAAA,CAAA;AAEFH,gBAAAA,QAAAA,GAAWC,OAAQC,CAAAA,qBAAqB,CAACE,eAAAA,CAAAA,GAAmB,IAAO,GAAA,IAAA;AACrE;AAEA,YAAA,MAAMG,WAAiC,GAAA;AACrC,gBAAA;oBACExB,IAAM,EAAA,KAAA;AACNyB,oBAAAA,IAAAA,EAAM,CAAGX,EAAAA,QAAAA,CAAS,mBAAmB,EAAEG,QAAU,CAAA,CAAA;oBACjDS,YAAc,EAAA,CAAC,UAAU,EAAET,QAAAA,CAAS,QAAQ,EAAEA,QAAAA,CAAS,IAAI;AAC7D;AACD,aAAA;YAED,IAAIP,OAAAA,CAAQU,MAAM,EAAE;gBAClB,MAAMO,SAAAA,GAAYL,UAAK1B,IAAKW,CAAAA,eAAe,IAAI,CAAGO,EAAAA,QAAAA,CAAS,gBAAgB,EAAEG,QAAU,CAAA,CAAA,CAAA;gBACvF,MAAMW,MAAAA,GAASC,EAAGC,CAAAA,UAAU,CAACH,SAAAA,CAAAA;AAE7B,gBAAA,IAAI,CAACC,MAAQ,EAAA;;AAEXJ,oBAAAA,WAAAA,CAAYO,IAAI,CAAC;wBACf/B,IAAM,EAAA,KAAA;AACNyB,wBAAAA,IAAAA,EAAM,CAAGX,EAAAA,QAAAA,CAAS,gBAAgB,EAAEG,QAAU,CAAA,CAAA;wBAC9CS,YAAc,EAAA,CAAC,UAAU,EAAET,QAAAA,CAAS,qBAAqB,EAAEA,QAAAA,CAAS,IAAI,CAAC;wBACzEe,YAAc,EAAA;AAChB,qBAAA,CAAA;AACF;;AAGAR,gBAAAA,WAAAA,CAAYO,IAAI,CAAC;oBACf/B,IAAM,EAAA,QAAA;AACNyB,oBAAAA,IAAAA,EAAM,CAAGX,EAAAA,QAAAA,CAAS,gBAAgB,EAAEG,QAAU,CAAA,CAAA;AAC9CgB,oBAAAA,SAAAA,CAAAA,CAAUC,QAAgB,EAAA;AACxB,wBAAA,OAAOC,oCAAaD,QAAU,EAAA;4BAAElC,IAAM,EAAA,OAAA;AAASoC,4BAAAA,YAAAA,EAAc1B,QAAQ2B;AAAG,yBAAA,CAAA;AAC1E;AACF,iBAAA,CAAA;AACF;YAEA,OAAOb,WAAAA;AACT;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
@@ -0,0 +1,73 @@
1
+ import tsUtils from '@strapi/typescript-utils';
2
+ import { join } from 'path';
3
+ import fs from 'fs';
4
+ import getDestinationPrompts from './prompts/get-destination-prompts.mjs';
5
+ import validateInput from './utils/validate-input.mjs';
6
+ import getFilePath from './utils/get-file-path.mjs';
7
+ import { appendToFile } from './utils/extend-plugin-index-files.mjs';
8
+
9
+ var generatePolicy = ((plop)=>{
10
+ // Policy generator
11
+ plop.setGenerator('policy', {
12
+ description: 'Generate a policy for an API',
13
+ prompts: [
14
+ {
15
+ type: 'input',
16
+ name: 'id',
17
+ message: 'Policy name',
18
+ validate: (input)=>validateInput(input)
19
+ },
20
+ ...getDestinationPrompts('policy', plop.getDestBasePath(), {
21
+ rootFolder: true
22
+ })
23
+ ],
24
+ actions (answers) {
25
+ if (!answers) {
26
+ return [];
27
+ }
28
+ const currentDir = process.cwd();
29
+ const filePath = getFilePath(answers.destination);
30
+ let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
31
+ if (answers.plugin) {
32
+ // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.
33
+ const pluginServerDir = join(currentDir, 'src', filePath.replace('{{ plugin }}', answers.plugin), '../');
34
+ language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';
35
+ }
36
+ const baseActions = [
37
+ {
38
+ type: 'add',
39
+ path: `${filePath}/policies/{{ id }}.${language}`,
40
+ templateFile: `templates/${language}/policy.${language}.hbs`
41
+ }
42
+ ];
43
+ if (answers.plugin) {
44
+ const indexPath = join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);
45
+ const exists = fs.existsSync(indexPath);
46
+ if (!exists) {
47
+ // Create index file if it doesn't exist
48
+ baseActions.push({
49
+ type: 'add',
50
+ path: `${filePath}/policies/index.${language}`,
51
+ templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,
52
+ skipIfExists: true
53
+ });
54
+ }
55
+ // Append the new policy to the index.ts file
56
+ baseActions.push({
57
+ type: 'modify',
58
+ path: `${filePath}/policies/index.${language}`,
59
+ transform (template) {
60
+ return appendToFile(template, {
61
+ type: 'index',
62
+ singularName: answers.id
63
+ });
64
+ }
65
+ });
66
+ }
67
+ return baseActions;
68
+ }
69
+ });
70
+ });
71
+
72
+ export { generatePolicy as default };
73
+ //# sourceMappingURL=policy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.mjs","sources":["../../src/plops/policy.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\n\nexport default (plop: NodePlopAPI) => {\n // Policy generator\n plop.setGenerator('policy', {\n description: 'Generate a policy for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Policy name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const currentDir = process.cwd();\n const filePath = getFilePath(answers.destination);\n let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/policies/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new policy to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/policies/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","currentDir","process","cwd","filePath","getFilePath","destination","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;AAUA,qBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAKC,CAAAA,YAAY,CAAC,QAAU,EAAA;QAC1BC,WAAa,EAAA,8BAAA;QACbC,OAAS,EAAA;AACP,YAAA;gBACEC,IAAM,EAAA,OAAA;gBACNC,IAAM,EAAA,IAAA;gBACNC,OAAS,EAAA,aAAA;gBACTC,QAAU,EAAA,CAACC,QAAUC,aAAcD,CAAAA,KAAAA;AACrC,aAAA;eACGE,qBAAsB,CAAA,QAAA,EAAUV,IAAKW,CAAAA,eAAe,EAAI,EAAA;gBAAEC,UAAY,EAAA;AAAK,aAAA;AAC/E,SAAA;AACDC,QAAAA,OAAAA,CAAAA,CAAQC,OAAO,EAAA;AACb,YAAA,IAAI,CAACA,OAAS,EAAA;AACZ,gBAAA,OAAO,EAAE;AACX;YAEA,MAAMC,UAAAA,GAAaC,QAAQC,GAAG,EAAA;YAC9B,MAAMC,QAAAA,GAAWC,WAAYL,CAAAA,OAAAA,CAAQM,WAAW,CAAA;AAChD,YAAA,IAAIC,QAAWC,GAAAA,OAAAA,CAAQC,qBAAqB,CAACR,cAAc,IAAO,GAAA,IAAA;YAElE,IAAID,OAAAA,CAAQU,MAAM,EAAE;;gBAElB,MAAMC,eAAAA,GAAkBC,IACtBX,CAAAA,UAAAA,EACA,KACAG,EAAAA,QAAAA,CAASS,OAAO,CAAC,cAAA,EAAgBb,OAAQU,CAAAA,MAAM,CAC/C,EAAA,KAAA,CAAA;AAEFH,gBAAAA,QAAAA,GAAWC,OAAQC,CAAAA,qBAAqB,CAACE,eAAAA,CAAAA,GAAmB,IAAO,GAAA,IAAA;AACrE;AAEA,YAAA,MAAMG,WAAiC,GAAA;AACrC,gBAAA;oBACExB,IAAM,EAAA,KAAA;AACNyB,oBAAAA,IAAAA,EAAM,CAAGX,EAAAA,QAAAA,CAAS,mBAAmB,EAAEG,QAAU,CAAA,CAAA;oBACjDS,YAAc,EAAA,CAAC,UAAU,EAAET,QAAAA,CAAS,QAAQ,EAAEA,QAAAA,CAAS,IAAI;AAC7D;AACD,aAAA;YAED,IAAIP,OAAAA,CAAQU,MAAM,EAAE;gBAClB,MAAMO,SAAAA,GAAYL,KAAK1B,IAAKW,CAAAA,eAAe,IAAI,CAAGO,EAAAA,QAAAA,CAAS,gBAAgB,EAAEG,QAAU,CAAA,CAAA,CAAA;gBACvF,MAAMW,MAAAA,GAASC,EAAGC,CAAAA,UAAU,CAACH,SAAAA,CAAAA;AAE7B,gBAAA,IAAI,CAACC,MAAQ,EAAA;;AAEXJ,oBAAAA,WAAAA,CAAYO,IAAI,CAAC;wBACf/B,IAAM,EAAA,KAAA;AACNyB,wBAAAA,IAAAA,EAAM,CAAGX,EAAAA,QAAAA,CAAS,gBAAgB,EAAEG,QAAU,CAAA,CAAA;wBAC9CS,YAAc,EAAA,CAAC,UAAU,EAAET,QAAAA,CAAS,qBAAqB,EAAEA,QAAAA,CAAS,IAAI,CAAC;wBACzEe,YAAc,EAAA;AAChB,qBAAA,CAAA;AACF;;AAGAR,gBAAAA,WAAAA,CAAYO,IAAI,CAAC;oBACf/B,IAAM,EAAA,QAAA;AACNyB,oBAAAA,IAAAA,EAAM,CAAGX,EAAAA,QAAAA,CAAS,gBAAgB,EAAEG,QAAU,CAAA,CAAA;AAC9CgB,oBAAAA,SAAAA,CAAAA,CAAUC,QAAgB,EAAA;AACxB,wBAAA,OAAOC,aAAaD,QAAU,EAAA;4BAAElC,IAAM,EAAA,OAAA;AAASoC,4BAAAA,YAAAA,EAAc1B,QAAQ2B;AAAG,yBAAA,CAAA;AAC1E;AACF,iBAAA,CAAA;AACF;YAEA,OAAOb,WAAAA;AACT;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
@@ -1,3 +1,8 @@
1
- import type { PromptQuestion } from 'node-plop';
2
- declare const questions: Array<PromptQuestion>;
1
+ declare const questions: {
2
+ type: string;
3
+ name: string;
4
+ default: boolean;
5
+ message: string;
6
+ }[];
3
7
  export default questions;
8
+ //# sourceMappingURL=bootstrap-api-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-api-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,SAAS;;;;;GAOd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,12 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+
3
3
  const questions = [
4
4
  {
5
5
  type: 'confirm',
6
6
  name: 'bootstrapApi',
7
7
  default: true,
8
- message: 'Bootstrap API related files?',
9
- },
8
+ message: 'Bootstrap API related files?'
9
+ }
10
10
  ];
11
- exports.default = questions;
12
- //# sourceMappingURL=bootstrap-api-prompts.js.map
11
+
12
+ module.exports = questions;
13
+ //# sourceMappingURL=bootstrap-api-prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-api-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAA0B;IACvC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,8BAA8B;KACxC;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"bootstrap-api-prompts.js","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"sourcesContent":["const questions = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","default","message"],"mappings":";;AAAA,MAAMA,SAAY,GAAA;AAChB,IAAA;QACEC,IAAM,EAAA,SAAA;QACNC,IAAM,EAAA,cAAA;QACNC,OAAS,EAAA,IAAA;QACTC,OAAS,EAAA;AACX;AACD;;;;"}
@@ -0,0 +1,11 @@
1
+ const questions = [
2
+ {
3
+ type: 'confirm',
4
+ name: 'bootstrapApi',
5
+ default: true,
6
+ message: 'Bootstrap API related files?'
7
+ }
8
+ ];
9
+
10
+ export { questions as default };
11
+ //# sourceMappingURL=bootstrap-api-prompts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-api-prompts.mjs","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"sourcesContent":["const questions = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","default","message"],"mappings":"AAAA,MAAMA,SAAY,GAAA;AAChB,IAAA;QACEC,IAAM,EAAA,SAAA;QACNC,IAAM,EAAA,cAAA;QACNC,OAAS,EAAA,IAAA;QACTC,OAAS,EAAA;AACX;AACD;;;;"}
@@ -1,3 +1,20 @@
1
- import type { PromptQuestion } from 'node-plop';
2
- declare const questions: Array<PromptQuestion>;
1
+ interface Answers {
2
+ displayName: string;
3
+ singularName: string;
4
+ pluralName: string;
5
+ }
6
+ declare const questions: ({
7
+ type: string;
8
+ name: string;
9
+ message: string;
10
+ validate: (input: string) => boolean;
11
+ default?: undefined;
12
+ } | {
13
+ type: string;
14
+ name: string;
15
+ message: string;
16
+ default: (answers: Answers) => any;
17
+ validate(input: string, answers: Answers): true | "Singular and plural names cannot be the same" | "Value must be in kebab-case";
18
+ })[];
3
19
  export default questions;
20
+ //# sourceMappingURL=ct-names-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ct-names-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"names":[],"mappings":"AAIA,UAAU,OAAO;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,SAAS;;;;sBAKO,MAAM;;;;;;uBAmBL,OAAO;oBACV,MAAM,WAAW,OAAO;IAY3C,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,68 +1,44 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const pluralize_1 = __importDefault(require("pluralize"));
30
- const slugify_1 = __importDefault(require("@sindresorhus/slugify"));
31
- const utils = __importStar(require("@strapi/utils"));
1
+ 'use strict';
2
+
3
+ var pluralize = require('pluralize');
4
+ var slugify = require('@sindresorhus/slugify');
5
+ var utils = require('@strapi/utils');
6
+
32
7
  const questions = [
33
8
  {
34
9
  type: 'input',
35
10
  name: 'displayName',
36
11
  message: 'Content type display name',
37
- validate: (input) => !!input,
12
+ validate: (input)=>!!input
38
13
  },
39
14
  {
40
15
  type: 'input',
41
16
  name: 'singularName',
42
17
  message: 'Content type singular name',
43
- default: (answers) => (0, slugify_1.default)(answers.displayName),
44
- validate(input) {
45
- if (!utils.isKebabCase(input)) {
18
+ default: (answers)=>slugify(answers.displayName),
19
+ validate (input) {
20
+ if (!utils.strings.isKebabCase(input)) {
46
21
  return 'Value must be in kebab-case';
47
22
  }
48
23
  return true;
49
- },
24
+ }
50
25
  },
51
26
  {
52
27
  type: 'input',
53
28
  name: 'pluralName',
54
29
  message: 'Content type plural name',
55
- default: (answers) => (0, pluralize_1.default)(answers.singularName),
56
- validate(input, answers) {
30
+ default: (answers)=>pluralize(answers.singularName),
31
+ validate (input, answers) {
57
32
  if (answers.singularName === input) {
58
33
  return 'Singular and plural names cannot be the same';
59
34
  }
60
- if (!utils.isKebabCase(input)) {
35
+ if (!utils.strings.isKebabCase(input)) {
61
36
  return 'Value must be in kebab-case';
62
37
  }
63
38
  return true;
64
- },
65
- },
39
+ }
40
+ }
66
41
  ];
67
- exports.default = questions;
68
- //# sourceMappingURL=ct-names-prompts.js.map
42
+
43
+ module.exports = questions;
44
+ //# sourceMappingURL=ct-names-prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ct-names-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAkC;AAClC,oEAA4C;AAC5C,qDAAuC;AAUvC,MAAM,SAAS,GAA0B;IACvC;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,2BAA2B;QACpC,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK;KACrC;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,4BAA4B;QACrC,OAAO,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,WAAW,CAAC;QAC3D,QAAQ,CAAC,KAAK;YACZ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;gBAC7B,OAAO,6BAA6B,CAAC;aACtC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,0BAA0B;QACnC,OAAO,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,OAAO,CAAC,YAAY,CAAC;QAC9D,QAAQ,CAAC,KAAa,EAAE,OAAgB;YACtC,IAAI,OAAO,CAAC,YAAY,KAAK,KAAK,EAAE;gBAClC,OAAO,8CAA8C,CAAC;aACvD;YAED,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;gBAC7B,OAAO,6BAA6B,CAAC;aACtC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"ct-names-prompts.js","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"sourcesContent":["import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions = [\n {\n type: 'input',\n name: 'displayName',\n message: 'Content type display name',\n validate: (input: string) => !!input,\n },\n {\n type: 'input',\n name: 'singularName',\n message: 'Content type singular name',\n default: (answers: Answers) => slugify(answers.displayName),\n validate(input: string) {\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n {\n type: 'input',\n name: 'pluralName',\n message: 'Content type plural name',\n default: (answers: Answers) => pluralize(answers.singularName),\n validate(input: string, answers: Answers) {\n if (answers.singularName === input) {\n return 'Singular and plural names cannot be the same';\n }\n\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","message","validate","input","default","answers","slugify","displayName","strings","isKebabCase","pluralize","singularName"],"mappings":";;;;;;AAUA,MAAMA,SAAY,GAAA;AAChB,IAAA;QACEC,IAAM,EAAA,OAAA;QACNC,IAAM,EAAA,aAAA;QACNC,OAAS,EAAA,2BAAA;QACTC,QAAU,EAAA,CAACC,KAAkB,GAAA,CAAC,CAACA;AACjC,KAAA;AACA,IAAA;QACEJ,IAAM,EAAA,OAAA;QACNC,IAAM,EAAA,cAAA;QACNC,OAAS,EAAA,4BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBC,OAAQD,CAAAA,OAAAA,CAAQE,WAAW,CAAA;AAC1DL,QAAAA,QAAAA,CAAAA,CAASC,KAAa,EAAA;AACpB,YAAA,IAAI,CAACK,aAAAA,CAAQC,WAAW,CAACN,KAAQ,CAAA,EAAA;gBAC/B,OAAO,6BAAA;AACT;YAEA,OAAO,IAAA;AACT;AACF,KAAA;AACA,IAAA;QACEJ,IAAM,EAAA,OAAA;QACNC,IAAM,EAAA,YAAA;QACNC,OAAS,EAAA,0BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBK,SAAUL,CAAAA,OAAAA,CAAQM,YAAY,CAAA;QAC7DT,QAASC,CAAAA,CAAAA,KAAa,EAAEE,OAAgB,EAAA;YACtC,IAAIA,OAAAA,CAAQM,YAAY,KAAKR,KAAO,EAAA;gBAClC,OAAO,8CAAA;AACT;AAEA,YAAA,IAAI,CAACK,aAAAA,CAAQC,WAAW,CAACN,KAAQ,CAAA,EAAA;gBAC/B,OAAO,6BAAA;AACT;YAEA,OAAO,IAAA;AACT;AACF;AACD;;;;"}
@@ -0,0 +1,42 @@
1
+ import pluralize from 'pluralize';
2
+ import slugify from '@sindresorhus/slugify';
3
+ import { strings } from '@strapi/utils';
4
+
5
+ const questions = [
6
+ {
7
+ type: 'input',
8
+ name: 'displayName',
9
+ message: 'Content type display name',
10
+ validate: (input)=>!!input
11
+ },
12
+ {
13
+ type: 'input',
14
+ name: 'singularName',
15
+ message: 'Content type singular name',
16
+ default: (answers)=>slugify(answers.displayName),
17
+ validate (input) {
18
+ if (!strings.isKebabCase(input)) {
19
+ return 'Value must be in kebab-case';
20
+ }
21
+ return true;
22
+ }
23
+ },
24
+ {
25
+ type: 'input',
26
+ name: 'pluralName',
27
+ message: 'Content type plural name',
28
+ default: (answers)=>pluralize(answers.singularName),
29
+ validate (input, answers) {
30
+ if (answers.singularName === input) {
31
+ return 'Singular and plural names cannot be the same';
32
+ }
33
+ if (!strings.isKebabCase(input)) {
34
+ return 'Value must be in kebab-case';
35
+ }
36
+ return true;
37
+ }
38
+ }
39
+ ];
40
+
41
+ export { questions as default };
42
+ //# sourceMappingURL=ct-names-prompts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ct-names-prompts.mjs","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"sourcesContent":["import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions = [\n {\n type: 'input',\n name: 'displayName',\n message: 'Content type display name',\n validate: (input: string) => !!input,\n },\n {\n type: 'input',\n name: 'singularName',\n message: 'Content type singular name',\n default: (answers: Answers) => slugify(answers.displayName),\n validate(input: string) {\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n {\n type: 'input',\n name: 'pluralName',\n message: 'Content type plural name',\n default: (answers: Answers) => pluralize(answers.singularName),\n validate(input: string, answers: Answers) {\n if (answers.singularName === input) {\n return 'Singular and plural names cannot be the same';\n }\n\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","message","validate","input","default","answers","slugify","displayName","strings","isKebabCase","pluralize","singularName"],"mappings":";;;;AAUA,MAAMA,SAAY,GAAA;AAChB,IAAA;QACEC,IAAM,EAAA,OAAA;QACNC,IAAM,EAAA,aAAA;QACNC,OAAS,EAAA,2BAAA;QACTC,QAAU,EAAA,CAACC,KAAkB,GAAA,CAAC,CAACA;AACjC,KAAA;AACA,IAAA;QACEJ,IAAM,EAAA,OAAA;QACNC,IAAM,EAAA,cAAA;QACNC,OAAS,EAAA,4BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBC,OAAQD,CAAAA,OAAAA,CAAQE,WAAW,CAAA;AAC1DL,QAAAA,QAAAA,CAAAA,CAASC,KAAa,EAAA;AACpB,YAAA,IAAI,CAACK,OAAAA,CAAQC,WAAW,CAACN,KAAQ,CAAA,EAAA;gBAC/B,OAAO,6BAAA;AACT;YAEA,OAAO,IAAA;AACT;AACF,KAAA;AACA,IAAA;QACEJ,IAAM,EAAA,OAAA;QACNC,IAAM,EAAA,YAAA;QACNC,OAAS,EAAA,0BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBK,SAAUL,CAAAA,OAAAA,CAAQM,YAAY,CAAA;QAC7DT,QAASC,CAAAA,CAAAA,KAAa,EAAEE,OAAgB,EAAA;YACtC,IAAIA,OAAAA,CAAQM,YAAY,KAAKR,KAAO,EAAA;gBAClC,OAAO,8CAAA;AACT;AAEA,YAAA,IAAI,CAACK,OAAAA,CAAQC,WAAW,CAACN,KAAQ,CAAA,EAAA;gBAC/B,OAAO,6BAAA;AACT;YAEA,OAAO,IAAA;AACT;AACF;AACD;;;;"}
@@ -1,3 +1,10 @@
1
- import type { DynamicPromptsFunction } from 'node-plop';
2
- declare const getAttributesPrompts: DynamicPromptsFunction;
1
+ interface AttributeAnswer {
2
+ attributeName: string;
3
+ attributeType: (typeof DEFAULT_TYPES)[number];
4
+ enum?: string;
5
+ multiple?: boolean;
6
+ }
7
+ declare const DEFAULT_TYPES: readonly ["media", "string", "text", "richtext", "json", "enumeration", "password", "email", "integer", "biginteger", "float", "decimal", "date", "time", "datetime", "timestamp", "boolean"];
8
+ declare const getAttributesPrompts: (inquirer: any) => Promise<AttributeAnswer[]>;
3
9
  export default getAttributesPrompts;
10
+ //# sourceMappingURL=get-attributes-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-attributes-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,aAAa,+LAqBT,CAAC;AAEX,QAAA,MAAM,oBAAoB,aAAoB,GAAG,+BAyEhD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1,9 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const validate_attribute_input_1 = __importDefault(require("../utils/validate-attribute-input"));
1
+ 'use strict';
2
+
3
+ var validateAttributeInput = require('../utils/validate-attribute-input.js');
4
+
7
5
  const DEFAULT_TYPES = [
8
6
  // advanced types
9
7
  'media',
@@ -23,59 +21,67 @@ const DEFAULT_TYPES = [
23
21
  'time',
24
22
  'datetime',
25
23
  'timestamp',
26
- 'boolean',
24
+ 'boolean'
27
25
  ];
28
- const getAttributesPrompts = async (inquirer) => {
26
+ const getAttributesPrompts = async (inquirer)=>{
29
27
  const { addAttributes } = await inquirer.prompt([
30
28
  {
31
29
  type: 'confirm',
32
30
  name: 'addAttributes',
33
- message: 'Do you want to add attributes?',
34
- },
31
+ message: 'Do you want to add attributes?'
32
+ }
35
33
  ]);
36
34
  const attributes = [];
37
35
  /**
38
- * @param {import('inquirer').Inquirer} inquirer
39
- * @returns {Promise<void>}
40
- */
41
- const createNewAttributes = async (inquirer) => {
36
+ * @param {import('inquirer').Inquirer} inquirer
37
+ * @returns {Promise<void>}
38
+ */ const createNewAttributes = async (inquirer)=>{
42
39
  const answers = await inquirer.prompt([
43
40
  {
44
41
  type: 'input',
45
42
  name: 'attributeName',
46
43
  message: 'Name of attribute',
47
- validate: (input) => (0, validate_attribute_input_1.default)(input),
44
+ validate: (input)=>validateAttributeInput(input)
48
45
  },
49
46
  {
50
47
  type: 'list',
51
48
  name: 'attributeType',
52
49
  message: 'What type of attribute',
53
50
  pageSize: DEFAULT_TYPES.length,
54
- choices: DEFAULT_TYPES.map((type) => {
55
- return { name: type, value: type };
56
- }),
51
+ choices: DEFAULT_TYPES.map((type)=>{
52
+ return {
53
+ name: type,
54
+ value: type
55
+ };
56
+ })
57
57
  },
58
58
  {
59
- when: (answers) => answers.attributeType === 'enumeration',
59
+ when: (answers)=>answers.attributeType === 'enumeration',
60
60
  type: 'input',
61
61
  name: 'enum',
62
- message: 'Add values separated by a comma',
62
+ message: 'Add values separated by a comma'
63
63
  },
64
64
  {
65
- when: (answers) => answers.attributeType === 'media',
65
+ when: (answers)=>answers.attributeType === 'media',
66
66
  type: 'list',
67
67
  name: 'multiple',
68
68
  message: 'Choose media type',
69
69
  choices: [
70
- { name: 'Multiple', value: true },
71
- { name: 'Single', value: false },
72
- ],
70
+ {
71
+ name: 'Multiple',
72
+ value: true
73
+ },
74
+ {
75
+ name: 'Single',
76
+ value: false
77
+ }
78
+ ]
73
79
  },
74
80
  {
75
81
  type: 'confirm',
76
82
  name: 'addAttributes',
77
- message: 'Do you want to add another attribute?',
78
- },
83
+ message: 'Do you want to add another attribute?'
84
+ }
79
85
  ]);
80
86
  attributes.push(answers);
81
87
  if (!answers.addAttributes) {
@@ -85,11 +91,11 @@ const getAttributesPrompts = async (inquirer) => {
85
91
  };
86
92
  if (addAttributes) {
87
93
  await createNewAttributes(inquirer);
88
- }
89
- else {
94
+ } else {
90
95
  console.warn(`You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`);
91
96
  }
92
97
  return attributes;
93
98
  };
94
- exports.default = getAttributesPrompts;
95
- //# sourceMappingURL=get-attributes-prompts.js.map
99
+
100
+ module.exports = getAttributesPrompts;
101
+ //# sourceMappingURL=get-attributes-prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-attributes-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"names":[],"mappings":";;;;;AAEA,iGAAuE;AASvE,MAAM,aAAa,GAAG;IACpB,iBAAiB;IACjB,OAAO;IAEP,eAAe;IACf,QAAQ;IACR,MAAM;IACN,UAAU;IACV,MAAM;IACN,aAAa;IACb,UAAU;IACV,OAAO;IACP,SAAS;IACT,YAAY;IACZ,OAAO;IACP,SAAS;IACT,MAAM;IACN,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;CACD,CAAC;AAEX,MAAM,oBAAoB,GAA2B,KAAK,EAAE,QAAQ,EAAE,EAAE;IACtE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC9C;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,gCAAgC;SAC1C;KACF,CAAC,CAAC;IAEH,MAAM,UAAU,GAA2B,EAAE,CAAC;IAE9C;;;OAGG;IACH,MAAM,mBAAmB,GAAG,KAAK,EAAE,QAA+C,EAAE,EAAE;QACpF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACpC;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,mBAAmB;gBAC5B,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,kCAAsB,EAAC,KAAK,CAAC;aAC3D;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,wBAAwB;gBACjC,QAAQ,EAAE,aAAa,CAAC,MAAM;gBAC9B,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;oBAClC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;gBACrC,CAAC,CAAC;aACH;YACD;gBACE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,KAAK,aAAa;gBAC1D,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,iCAAiC;aAC3C;YACD;gBACE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,KAAK,OAAO;gBACpD,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,mBAAmB;gBAC5B,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;oBACjC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;iBACjC;aACF;YACD;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,uCAAuC;aACjD;SACF,CAAC,CAAC;QAEH,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;YAC1B,OAAO;SACR;QAED,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,IAAI,aAAa,EAAE;QACjB,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC;KACrC;SAAM;QACL,OAAO,CAAC,IAAI,CACV,uHAAuH,CACxH,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"get-attributes-prompts.js","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"sourcesContent":["import validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: (typeof DEFAULT_TYPES)[number];\n enum?: string;\n multiple?: boolean;\n}\n\nconst DEFAULT_TYPES = [\n // advanced types\n 'media',\n\n // scalar types\n 'string',\n 'text',\n 'richtext',\n 'json',\n 'enumeration',\n 'password',\n 'email',\n 'integer',\n 'biginteger',\n 'float',\n 'decimal',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n] as const;\n\nconst getAttributesPrompts = async (inquirer: any) => {\n const { addAttributes } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add attributes?',\n },\n ]);\n\n const attributes: Array<AttributeAnswer> = [];\n\n /**\n * @param {import('inquirer').Inquirer} inquirer\n * @returns {Promise<void>}\n */\n const createNewAttributes = async (inquirer: any) => {\n const answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'attributeName',\n message: 'Name of attribute',\n validate: (input: string) => validateAttributeInput(input),\n },\n {\n type: 'list',\n name: 'attributeType',\n message: 'What type of attribute',\n pageSize: DEFAULT_TYPES.length,\n choices: DEFAULT_TYPES.map((type) => {\n return { name: type, value: type };\n }),\n },\n {\n when: (answers: AttributeAnswer) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers: AttributeAnswer) => answers.attributeType === 'media',\n type: 'list',\n name: 'multiple',\n message: 'Choose media type',\n choices: [\n { name: 'Multiple', value: true },\n { name: 'Single', value: false },\n ],\n },\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add another attribute?',\n },\n ]);\n\n attributes.push(answers);\n\n if (!answers.addAttributes) {\n return;\n }\n\n await createNewAttributes(inquirer);\n };\n\n if (addAttributes) {\n await createNewAttributes(inquirer);\n } else {\n console.warn(\n `You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`\n );\n }\n\n return attributes;\n};\n\nexport default getAttributesPrompts;\n"],"names":["DEFAULT_TYPES","getAttributesPrompts","inquirer","addAttributes","prompt","type","name","message","attributes","createNewAttributes","answers","validate","input","validateAttributeInput","pageSize","length","choices","map","value","when","attributeType","push","console","warn"],"mappings":";;;;AASA,MAAMA,aAAgB,GAAA;;AAEpB,IAAA,OAAA;;AAGA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,MAAA;AACA,IAAA,aAAA;AACA,IAAA,UAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,YAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,uBAAuB,OAAOC,QAAAA,GAAAA;AAClC,IAAA,MAAM,EAAEC,aAAa,EAAE,GAAG,MAAMD,QAAAA,CAASE,MAAM,CAAC;AAC9C,QAAA;YACEC,IAAM,EAAA,SAAA;YACNC,IAAM,EAAA,eAAA;YACNC,OAAS,EAAA;AACX;AACD,KAAA,CAAA;AAED,IAAA,MAAMC,aAAqC,EAAE;AAE7C;;;MAIA,MAAMC,sBAAsB,OAAOP,QAAAA,GAAAA;AACjC,QAAA,MAAMQ,OAAU,GAAA,MAAMR,QAASE,CAAAA,MAAM,CAAC;AACpC,YAAA;gBACEC,IAAM,EAAA,OAAA;gBACNC,IAAM,EAAA,eAAA;gBACNC,OAAS,EAAA,mBAAA;gBACTI,QAAU,EAAA,CAACC,QAAkBC,sBAAuBD,CAAAA,KAAAA;AACtD,aAAA;AACA,YAAA;gBACEP,IAAM,EAAA,MAAA;gBACNC,IAAM,EAAA,eAAA;gBACNC,OAAS,EAAA,wBAAA;AACTO,gBAAAA,QAAAA,EAAUd,cAAce,MAAM;gBAC9BC,OAAShB,EAAAA,aAAAA,CAAciB,GAAG,CAAC,CAACZ,IAAAA,GAAAA;oBAC1B,OAAO;wBAAEC,IAAMD,EAAAA,IAAAA;wBAAMa,KAAOb,EAAAA;AAAK,qBAAA;AACnC,iBAAA;AACF,aAAA;AACA,YAAA;AACEc,gBAAAA,IAAAA,EAAM,CAACT,OAAAA,GAA6BA,OAAQU,CAAAA,aAAa,KAAK,aAAA;gBAC9Df,IAAM,EAAA,OAAA;gBACNC,IAAM,EAAA,MAAA;gBACNC,OAAS,EAAA;AACX,aAAA;AACA,YAAA;AACEY,gBAAAA,IAAAA,EAAM,CAACT,OAAAA,GAA6BA,OAAQU,CAAAA,aAAa,KAAK,OAAA;gBAC9Df,IAAM,EAAA,MAAA;gBACNC,IAAM,EAAA,UAAA;gBACNC,OAAS,EAAA,mBAAA;gBACTS,OAAS,EAAA;AACP,oBAAA;wBAAEV,IAAM,EAAA,UAAA;wBAAYY,KAAO,EAAA;AAAK,qBAAA;AAChC,oBAAA;wBAAEZ,IAAM,EAAA,QAAA;wBAAUY,KAAO,EAAA;AAAM;AAChC;AACH,aAAA;AACA,YAAA;gBACEb,IAAM,EAAA,SAAA;gBACNC,IAAM,EAAA,eAAA;gBACNC,OAAS,EAAA;AACX;AACD,SAAA,CAAA;AAEDC,QAAAA,UAAAA,CAAWa,IAAI,CAACX,OAAAA,CAAAA;QAEhB,IAAI,CAACA,OAAQP,CAAAA,aAAa,EAAE;AAC1B,YAAA;AACF;AAEA,QAAA,MAAMM,mBAAoBP,CAAAA,QAAAA,CAAAA;AAC5B,KAAA;AAEA,IAAA,IAAIC,aAAe,EAAA;AACjB,QAAA,MAAMM,mBAAoBP,CAAAA,QAAAA,CAAAA;KACrB,MAAA;AACLoB,QAAAA,OAAAA,CAAQC,IAAI,CACV,CAAC,qHAAqH,CAAC,CAAA;AAE3H;IAEA,OAAOf,UAAAA;AACT;;;;"}