@dani-builder/strapi-plugin-builder 0.1.0 → 0.3.0

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 (140) hide show
  1. package/AGENTS.md +149 -0
  2. package/LICENSE +21 -0
  3. package/README.md +61 -0
  4. package/dist/server/src/bootstrap.d.ts +1 -1
  5. package/dist/server/src/bootstrap.d.ts.map +1 -1
  6. package/dist/server/src/bootstrap.js +8 -1
  7. package/dist/server/src/bootstrap.js.map +1 -1
  8. package/dist/server/src/bootstrap.test.d.ts +2 -0
  9. package/dist/server/src/bootstrap.test.d.ts.map +1 -0
  10. package/dist/server/src/bootstrap.test.js +45 -0
  11. package/dist/server/src/bootstrap.test.js.map +1 -0
  12. package/dist/server/src/components/blocks/cta.json +13 -5
  13. package/dist/server/src/components/blocks/faq.json +1 -1
  14. package/dist/server/src/components/blocks/features.json +10 -5
  15. package/dist/server/src/components/blocks/hero.json +15 -6
  16. package/dist/server/src/components/blocks/highlights.json +9 -5
  17. package/dist/server/src/components/blocks/inquiry-form.json +3 -0
  18. package/dist/server/src/components/blocks/logo-cloud.json +6 -1
  19. package/dist/server/src/components/blocks/stats.json +9 -5
  20. package/dist/server/src/components/blocks/testimonials.json +10 -5
  21. package/dist/server/src/components/shared/bento-item.json +4 -4
  22. package/dist/server/src/components/shared/highlight-item.json +5 -5
  23. package/dist/server/src/components/shared/image.json +24 -0
  24. package/dist/server/src/components/shared/slider-item.json +5 -5
  25. package/dist/server/src/content-types/article/index.d.ts +146 -0
  26. package/dist/server/src/content-types/article/index.d.ts.map +1 -0
  27. package/dist/server/src/content-types/article/index.js +8 -0
  28. package/dist/server/src/content-types/article/index.js.map +1 -0
  29. package/dist/server/src/content-types/article/schema.json +104 -0
  30. package/dist/server/src/content-types/author/index.d.ts +56 -0
  31. package/dist/server/src/content-types/author/index.d.ts.map +1 -0
  32. package/dist/server/src/content-types/author/index.js +8 -0
  33. package/dist/server/src/content-types/author/index.js.map +1 -0
  34. package/dist/server/src/content-types/author/schema.json +48 -0
  35. package/dist/server/src/content-types/category/index.d.ts +71 -0
  36. package/dist/server/src/content-types/category/index.d.ts.map +1 -0
  37. package/dist/server/src/content-types/category/index.js +8 -0
  38. package/dist/server/src/content-types/category/index.js.map +1 -0
  39. package/dist/server/src/content-types/category/schema.json +45 -0
  40. package/dist/server/src/content-types/faq/index.d.ts +60 -0
  41. package/dist/server/src/content-types/faq/index.d.ts.map +1 -0
  42. package/dist/server/src/content-types/faq/index.js +8 -0
  43. package/dist/server/src/content-types/faq/index.js.map +1 -0
  44. package/dist/server/src/content-types/faq/schema.json +38 -0
  45. package/dist/server/src/content-types/global/index.d.ts +91 -0
  46. package/dist/server/src/content-types/global/index.d.ts.map +1 -0
  47. package/dist/server/src/content-types/global/index.js +8 -0
  48. package/dist/server/src/content-types/global/index.js.map +1 -0
  49. package/dist/server/src/content-types/global/schema.json +66 -0
  50. package/dist/server/src/content-types/index.d.ts +795 -0
  51. package/dist/server/src/content-types/index.d.ts.map +1 -0
  52. package/dist/server/src/content-types/index.js +30 -0
  53. package/dist/server/src/content-types/index.js.map +1 -0
  54. package/dist/server/src/content-types/inquiry/index.d.ts +48 -0
  55. package/dist/server/src/content-types/inquiry/index.d.ts.map +1 -0
  56. package/dist/server/src/content-types/inquiry/index.js +8 -0
  57. package/dist/server/src/content-types/inquiry/index.js.map +1 -0
  58. package/dist/server/src/content-types/inquiry/schema.json +40 -0
  59. package/dist/server/src/content-types/navigation/index.d.ts +80 -0
  60. package/dist/server/src/content-types/navigation/index.d.ts.map +1 -0
  61. package/dist/server/src/content-types/navigation/index.js +8 -0
  62. package/dist/server/src/content-types/navigation/index.js.map +1 -0
  63. package/dist/server/src/content-types/navigation/schema.json +54 -0
  64. package/dist/server/src/content-types/page/index.d.ts +78 -0
  65. package/dist/server/src/content-types/page/index.d.ts.map +1 -0
  66. package/dist/server/src/content-types/page/index.js +8 -0
  67. package/dist/server/src/content-types/page/index.js.map +1 -0
  68. package/dist/server/src/content-types/page/schema.json +64 -0
  69. package/dist/server/src/content-types/series/index.d.ts +68 -0
  70. package/dist/server/src/content-types/series/index.d.ts.map +1 -0
  71. package/dist/server/src/content-types/series/index.js +8 -0
  72. package/dist/server/src/content-types/series/index.js.map +1 -0
  73. package/dist/server/src/content-types/series/schema.json +46 -0
  74. package/dist/server/src/content-types/site-setting/index.d.ts +47 -0
  75. package/dist/server/src/content-types/site-setting/index.d.ts.map +1 -0
  76. package/dist/server/src/content-types/site-setting/index.js +8 -0
  77. package/dist/server/src/content-types/site-setting/index.js.map +1 -0
  78. package/dist/server/src/content-types/site-setting/schema.json +39 -0
  79. package/dist/server/src/content-types/tag/index.d.ts +68 -0
  80. package/dist/server/src/content-types/tag/index.d.ts.map +1 -0
  81. package/dist/server/src/content-types/tag/index.js +8 -0
  82. package/dist/server/src/content-types/tag/index.js.map +1 -0
  83. package/dist/server/src/content-types/tag/schema.json +46 -0
  84. package/dist/server/src/controllers/global.d.ts +1 -10
  85. package/dist/server/src/controllers/global.d.ts.map +1 -1
  86. package/dist/server/src/controllers/global.js +11 -4
  87. package/dist/server/src/controllers/global.js.map +1 -1
  88. package/dist/server/src/controllers/index.d.ts.map +1 -1
  89. package/dist/server/src/controllers/index.js +10 -0
  90. package/dist/server/src/controllers/index.js.map +1 -1
  91. package/dist/server/src/controllers/page.d.ts +11 -14
  92. package/dist/server/src/controllers/page.d.ts.map +1 -1
  93. package/dist/server/src/controllers/page.js +78 -9
  94. package/dist/server/src/controllers/page.js.map +1 -1
  95. package/dist/server/src/index.d.ts.map +1 -1
  96. package/dist/server/src/index.js +4 -0
  97. package/dist/server/src/index.js.map +1 -1
  98. package/dist/server/src/policies/index.d.ts +3 -0
  99. package/dist/server/src/policies/index.d.ts.map +1 -0
  100. package/dist/server/src/policies/index.js +13 -0
  101. package/dist/server/src/policies/index.js.map +1 -0
  102. package/dist/server/src/policies/rate-limit.d.ts +15 -0
  103. package/dist/server/src/policies/rate-limit.d.ts.map +1 -0
  104. package/dist/server/src/policies/rate-limit.js +39 -0
  105. package/dist/server/src/policies/rate-limit.js.map +1 -0
  106. package/dist/server/src/register.d.ts.map +1 -1
  107. package/dist/server/src/register.js +16 -1
  108. package/dist/server/src/register.js.map +1 -1
  109. package/dist/server/src/routes/content-api.d.ts +10 -13
  110. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  111. package/dist/server/src/routes/content-api.js +34 -30
  112. package/dist/server/src/routes/content-api.js.map +1 -1
  113. package/dist/server/src/routes/index.d.ts +10 -15
  114. package/dist/server/src/routes/index.d.ts.map +1 -1
  115. package/dist/server/src/routes/index.js +2 -1
  116. package/dist/server/src/routes/index.js.map +1 -1
  117. package/dist/server/src/services/index.d.ts.map +1 -1
  118. package/dist/server/src/services/index.js +12 -0
  119. package/dist/server/src/services/index.js.map +1 -1
  120. package/dist/server/src/services/populate.d.ts.map +1 -1
  121. package/dist/server/src/services/populate.js +15 -9
  122. package/dist/server/src/services/populate.js.map +1 -1
  123. package/dist/server/src/utils/query.d.ts +11 -0
  124. package/dist/server/src/utils/query.d.ts.map +1 -0
  125. package/dist/server/src/utils/query.js +112 -0
  126. package/dist/server/src/utils/query.js.map +1 -0
  127. package/package.json +30 -18
  128. package/bin/sync.js +0 -320
  129. package/schemas/api/article/content-types/article/schema.json +0 -102
  130. package/schemas/api/author/content-types/author/schema.json +0 -44
  131. package/schemas/api/category/content-types/category/schema.json +0 -43
  132. package/schemas/api/faq/content-types/faq/schema.json +0 -36
  133. package/schemas/api/global/content-types/global/schema.json +0 -64
  134. package/schemas/api/inquiry/content-types/inquiry/schema.json +0 -31
  135. package/schemas/api/navigation/content-types/navigation/schema.json +0 -52
  136. package/schemas/api/page/content-types/page/schema.json +0 -62
  137. package/schemas/api/series/content-types/series/schema.json +0 -44
  138. package/schemas/api/site-setting/content-types/site-setting/schema.json +0 -35
  139. package/schemas/api/tag/content-types/tag/schema.json +0 -44
  140. package/schemas/manifest.json +0 -16
@@ -0,0 +1,39 @@
1
+ {
2
+ "kind": "singleType",
3
+ "collectionName": "site_settings",
4
+ "info": {
5
+ "singularName": "site-setting",
6
+ "pluralName": "site-settings",
7
+ "displayName": "Site Settings",
8
+ "description": "Operational settings for analytics, chatbot, and site verification"
9
+ },
10
+ "options": {
11
+ "draftAndPublish": false
12
+ },
13
+ "pluginOptions": {
14
+ "content-manager": { "visible": true },
15
+ "content-type-builder": { "visible": true }
16
+ },
17
+ "attributes": {
18
+ "analyticsSettings": {
19
+ "type": "component",
20
+ "component": "shared.analytics-setting",
21
+ "repeatable": true
22
+ },
23
+ "chatbot": {
24
+ "type": "component",
25
+ "component": "shared.chatbot-setting",
26
+ "repeatable": false
27
+ },
28
+ "siteVerifications": {
29
+ "type": "component",
30
+ "component": "shared.site-verification",
31
+ "repeatable": true
32
+ },
33
+ "brandColors": {
34
+ "type": "component",
35
+ "component": "shared.brand-colors",
36
+ "repeatable": false
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,68 @@
1
+ declare const _default: {
2
+ schema: {
3
+ kind: string;
4
+ collectionName: string;
5
+ info: {
6
+ singularName: string;
7
+ pluralName: string;
8
+ displayName: string;
9
+ description: string;
10
+ };
11
+ options: {
12
+ draftAndPublish: boolean;
13
+ };
14
+ pluginOptions: {
15
+ i18n: {
16
+ localized: boolean;
17
+ };
18
+ "content-manager": {
19
+ visible: boolean;
20
+ };
21
+ "content-type-builder": {
22
+ visible: boolean;
23
+ };
24
+ };
25
+ attributes: {
26
+ name: {
27
+ type: string;
28
+ required: boolean;
29
+ pluginOptions: {
30
+ i18n: {
31
+ localized: boolean;
32
+ };
33
+ };
34
+ };
35
+ slug: {
36
+ type: string;
37
+ targetField: string;
38
+ required: boolean;
39
+ pluginOptions: {
40
+ i18n: {
41
+ localized: boolean;
42
+ };
43
+ };
44
+ };
45
+ color: {
46
+ type: string;
47
+ customField: string;
48
+ regex: string;
49
+ };
50
+ description: {
51
+ type: string;
52
+ pluginOptions: {
53
+ i18n: {
54
+ localized: boolean;
55
+ };
56
+ };
57
+ };
58
+ articles: {
59
+ type: string;
60
+ relation: string;
61
+ target: string;
62
+ mappedBy: string;
63
+ };
64
+ };
65
+ };
66
+ };
67
+ export default _default;
68
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server/src/content-types/tag/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAA0B"}
@@ -0,0 +1,8 @@
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 schema_json_1 = __importDefault(require("./schema.json"));
7
+ exports.default = { schema: schema_json_1.default };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../server/src/content-types/tag/index.ts"],"names":[],"mappings":";;;;;AAAA,gEAAmC;AAEnC,kBAAe,EAAE,MAAM,EAAN,qBAAM,EAAE,CAAC"}
@@ -0,0 +1,46 @@
1
+ {
2
+ "kind": "collectionType",
3
+ "collectionName": "tags",
4
+ "info": {
5
+ "singularName": "tag",
6
+ "pluralName": "tags",
7
+ "displayName": "Tag",
8
+ "description": "Article tag with optional color"
9
+ },
10
+ "options": {
11
+ "draftAndPublish": false
12
+ },
13
+ "pluginOptions": {
14
+ "i18n": { "localized": true },
15
+ "content-manager": { "visible": true },
16
+ "content-type-builder": { "visible": true }
17
+ },
18
+ "attributes": {
19
+ "name": {
20
+ "type": "string",
21
+ "required": true,
22
+ "pluginOptions": { "i18n": { "localized": true } }
23
+ },
24
+ "slug": {
25
+ "type": "uid",
26
+ "targetField": "name",
27
+ "required": true,
28
+ "pluginOptions": { "i18n": { "localized": true } }
29
+ },
30
+ "color": {
31
+ "type": "customField",
32
+ "customField": "plugin::color-picker.color",
33
+ "regex": "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
34
+ },
35
+ "description": {
36
+ "type": "text",
37
+ "pluginOptions": { "i18n": { "localized": true } }
38
+ },
39
+ "articles": {
40
+ "type": "relation",
41
+ "relation": "manyToMany",
42
+ "target": "plugin::builder.article",
43
+ "mappedBy": "tags"
44
+ }
45
+ }
46
+ }
@@ -1,12 +1,3 @@
1
- import type { Core } from '@strapi/strapi';
2
- declare const global: ({ strapi }: {
3
- strapi: Core.Strapi;
4
- }) => {
5
- /**
6
- * GET /api/builder/global
7
- * Global settings with deep populate (siteWideBlocks + footer)
8
- */
9
- find(ctx: any): Promise<any>;
10
- };
1
+ declare const global: unknown;
11
2
  export default global;
12
3
  //# sourceMappingURL=global.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,QAAA,MAAM,MAAM,GAAI,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;IACjD;;;OAGG;cACa,GAAG;CAenB,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/global.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,EAAE,OA4Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const global = ({ strapi }) => ({
3
+ const strapi_1 = require("@strapi/strapi");
4
+ const query_1 = require("../utils/query");
5
+ const global = strapi_1.factories.createCoreController('plugin::builder.global', ({ strapi }) => ({
4
6
  /**
5
7
  * GET /api/builder/global
6
8
  * Global settings with deep populate (siteWideBlocks + footer)
@@ -8,15 +10,20 @@ const global = ({ strapi }) => ({
8
10
  async find(ctx) {
9
11
  const populateService = strapi.plugin('builder').service('populate');
10
12
  const populate = populateService.getGlobalPopulate();
11
- const result = await strapi.documents('api::global.global').findFirst({
13
+ const result = await strapi.documents('plugin::builder.global').findFirst({
14
+ // Global is a single type: only locale/pagination pass through. No
15
+ // filterFields is supplied, so filters/sort (and fields) are dropped.
16
+ ...(0, query_1.pickPublicQuery)(ctx.query),
17
+ // Server-controlled keys after the spread: ctx.query can't override
18
+ // populate (no forced deep/expensive populate) or downgrade status.
12
19
  populate,
13
- ...ctx.query,
20
+ status: 'published',
14
21
  });
15
22
  if (!result) {
16
23
  return ctx.notFound('Global not found');
17
24
  }
18
25
  ctx.body = { data: result };
19
26
  },
20
- });
27
+ }));
21
28
  exports.default = global;
22
29
  //# sourceMappingURL=global.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["../../../../server/src/controllers/global.ts"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAG,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE,CAAC,CAAC;IACvD;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,GAAQ;QACjB,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,eAAe,CAAC,iBAAiB,EAAE,CAAC;QAErD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,SAAS,CAAC;YACpE,QAAQ;YACR,GAAG,GAAG,CAAC,KAAK;SACb,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAC1C,CAAC;QAED,GAAG,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACF,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"global.js","sourceRoot":"","sources":["../../../../server/src/controllers/global.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAC3C,0CAAiD;AAEjD,MAAM,MAAM,GAAY,kBAAS,CAAC,oBAAoB,CACpD,wBAAwB,EACxB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,GAAQ;QACjB,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,eAAe,CAAC,iBAAiB,EAAE,CAAC;QAErD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC;YACxE,mEAAmE;YACnE,sEAAsE;YACtE,GAAG,IAAA,uBAAe,EAAC,GAAG,CAAC,KAAK,CAAC;YAC7B,oEAAoE;YACpE,oEAAoE;YACpE,QAAQ;YACR,MAAM,EAAE,WAAW;SACpB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAC1C,CAAC;QAED,GAAG,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACA,CAAC,CACH,CAAC;AAEF,kBAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAGxC,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAYxC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -3,11 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const strapi_1 = require("@strapi/strapi");
6
7
  const page_1 = __importDefault(require("./page"));
7
8
  const global_1 = __importDefault(require("./global"));
8
9
  const controllers = {
10
+ article: strapi_1.factories.createCoreController('plugin::builder.article'),
11
+ author: strapi_1.factories.createCoreController('plugin::builder.author'),
12
+ category: strapi_1.factories.createCoreController('plugin::builder.category'),
13
+ faq: strapi_1.factories.createCoreController('plugin::builder.faq'),
9
14
  page: page_1.default,
10
15
  global: global_1.default,
16
+ inquiry: strapi_1.factories.createCoreController('plugin::builder.inquiry'),
17
+ navigation: strapi_1.factories.createCoreController('plugin::builder.navigation'),
18
+ series: strapi_1.factories.createCoreController('plugin::builder.series'),
19
+ 'site-setting': strapi_1.factories.createCoreController('plugin::builder.site-setting'),
20
+ tag: strapi_1.factories.createCoreController('plugin::builder.tag'),
11
21
  };
12
22
  exports.default = controllers;
13
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,sDAA8B;AAE9B,MAAM,WAAW,GAA4B;IAC3C,IAAI,EAAJ,cAAI;IACJ,MAAM,EAAN,gBAAM;CACP,CAAC;AAEF,kBAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":";;;;;AAAA,2CAA2C;AAC3C,kDAA0B;AAC1B,sDAA8B;AAE9B,MAAM,WAAW,GAA4B;IAC3C,OAAO,EAAE,kBAAS,CAAC,oBAAoB,CAAC,yBAAyB,CAAC;IAClE,MAAM,EAAE,kBAAS,CAAC,oBAAoB,CAAC,wBAAwB,CAAC;IAChE,QAAQ,EAAE,kBAAS,CAAC,oBAAoB,CAAC,0BAA0B,CAAC;IACpE,GAAG,EAAE,kBAAS,CAAC,oBAAoB,CAAC,qBAAqB,CAAC;IAC1D,IAAI,EAAJ,cAAI;IACJ,MAAM,EAAN,gBAAM;IACN,OAAO,EAAE,kBAAS,CAAC,oBAAoB,CAAC,yBAAyB,CAAC;IAClE,UAAU,EAAE,kBAAS,CAAC,oBAAoB,CAAC,4BAA4B,CAAC;IACxE,MAAM,EAAE,kBAAS,CAAC,oBAAoB,CAAC,wBAAwB,CAAC;IAChE,cAAc,EAAE,kBAAS,CAAC,oBAAoB,CAAC,8BAA8B,CAAC;IAC9E,GAAG,EAAE,kBAAS,CAAC,oBAAoB,CAAC,qBAAqB,CAAC;CAC3D,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -1,17 +1,14 @@
1
- import type { Core } from '@strapi/strapi';
2
- declare const page: ({ strapi }: {
3
- strapi: Core.Strapi;
4
- }) => {
5
- /**
6
- * GET /api/builder/pages
7
- * List pages with minimal populate (no blocks)
8
- */
9
- find(ctx: any): Promise<void>;
10
- /**
11
- * GET /api/builder/pages/:documentId
12
- * Single page with deep block populate
13
- */
14
- findOne(ctx: any): Promise<any>;
1
+ export declare function getPagePagination(pagination: unknown, maxLimit?: unknown): {
2
+ page: number;
3
+ pageSize: undefined;
4
+ start: undefined;
5
+ limit: undefined;
6
+ } | {
7
+ page: number;
8
+ pageSize: number;
9
+ start: number;
10
+ limit: number;
15
11
  };
12
+ declare const page: unknown;
16
13
  export default page;
17
14
  //# sourceMappingURL=page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,QAAA,MAAM,IAAI,GAAI,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;IAC/C;;;OAGG;cACa,GAAG;IAYnB;;;OAGG;iBACgB,GAAG;CAiBtB,CAAC;AAEH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/page.ts"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,QAAQ,CAAC,EAAE,OAAO;;;;;;;;;;EAkBnB;AAUD,QAAA,MAAM,IAAI,EAAE,OAiFX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,6 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const page = ({ strapi }) => ({
3
+ exports.getPagePagination = getPagePagination;
4
+ const strapi_1 = require("@strapi/strapi");
5
+ const query_1 = require("../utils/query");
6
+ const DEFAULT_PAGE_SIZE = 25;
7
+ const DEFAULT_MAX_LIMIT = 100;
8
+ function positiveInteger(value, fallback) {
9
+ const parsed = typeof value === 'string' ? Number(value) : value;
10
+ return typeof parsed === 'number' && Number.isInteger(parsed) && parsed > 0
11
+ ? parsed
12
+ : fallback;
13
+ }
14
+ function getPagePagination(pagination, maxLimit) {
15
+ const input = pagination && typeof pagination === 'object'
16
+ ? pagination
17
+ : undefined;
18
+ const page = positiveInteger(input?.page, 1);
19
+ const cap = maxLimit === undefined
20
+ ? DEFAULT_MAX_LIMIT
21
+ : positiveInteger(maxLimit, Number.POSITIVE_INFINITY);
22
+ const pageSize = input
23
+ ? Math.min(positiveInteger(input.pageSize, DEFAULT_PAGE_SIZE), cap)
24
+ : undefined;
25
+ return pageSize === undefined
26
+ ? { page: 1, pageSize, start: undefined, limit: undefined }
27
+ : { page, pageSize, start: (page - 1) * pageSize, limit: pageSize };
28
+ }
29
+ function getReadStatus(ctx) {
30
+ // Public-role requests populate ctx.state.auth with credentials: null.
31
+ // Draft documents therefore require an actual authenticated principal.
32
+ return ctx.state.auth?.credentials && ctx.query.status === 'draft'
33
+ ? 'draft'
34
+ : 'published';
35
+ }
36
+ const page = strapi_1.factories.createCoreController('plugin::builder.page', ({ strapi }) => ({
4
37
  /**
5
38
  * GET /api/builder/pages
6
39
  * List pages with minimal populate (no blocks)
@@ -8,30 +41,66 @@ const page = ({ strapi }) => ({
8
41
  async find(ctx) {
9
42
  const populateService = strapi.plugin('builder').service('populate');
10
43
  const populate = populateService.getPageListPopulate();
11
- const results = await strapi.documents('api::page.page').findMany({
12
- ...ctx.query,
13
- populate,
44
+ const publicQuery = (0, query_1.pickPublicQuery)(ctx.query, {
45
+ filterFields: query_1.PAGE_PUBLIC_FIELDS,
14
46
  });
15
- ctx.body = { data: results, meta: {} };
47
+ const { pagination, ...documentQuery } = publicQuery;
48
+ const maxLimit = strapi.config.get('api.rest.maxLimit');
49
+ const { page, pageSize, start, limit } = getPagePagination(pagination, maxLimit);
50
+ const documents = strapi.documents('plugin::builder.page');
51
+ const status = getReadStatus(ctx);
52
+ const query = {
53
+ // Whitelist client query params; filters/sort scoped to public fields.
54
+ ...documentQuery,
55
+ // Server-controlled keys after the spread: populate is fixed. Draft
56
+ // reads require Strapi authentication; public requests stay published.
57
+ populate,
58
+ status,
59
+ };
60
+ const countQuery = {
61
+ filters: documentQuery.filters,
62
+ locale: documentQuery.locale,
63
+ status,
64
+ };
65
+ const paginationQuery = start === undefined || limit === undefined ? {} : { start, limit };
66
+ const [results, total] = await Promise.all([
67
+ documents.findMany({ ...query, ...paginationQuery }),
68
+ documents.count(countQuery),
69
+ ]);
70
+ const responsePageSize = pageSize ?? (total || DEFAULT_PAGE_SIZE);
71
+ ctx.body = {
72
+ data: results,
73
+ meta: {
74
+ pagination: {
75
+ page,
76
+ pageSize: responsePageSize,
77
+ pageCount: total === 0 ? 0 : Math.ceil(total / responsePageSize),
78
+ total,
79
+ },
80
+ },
81
+ };
16
82
  },
17
83
  /**
18
84
  * GET /api/builder/pages/:documentId
19
85
  * Single page with deep block populate
20
86
  */
21
87
  async findOne(ctx) {
22
- const { documentId } = ctx.params;
88
+ const documentId = ctx.params.id ?? ctx.params.documentId;
23
89
  const populateService = strapi.plugin('builder').service('populate');
24
90
  const populate = populateService.getPagePopulate();
25
- const result = await strapi.documents('api::page.page').findOne({
91
+ const result = await strapi.documents('plugin::builder.page').findOne({
92
+ ...(0, query_1.pickPublicQuery)(ctx.query, { filterFields: query_1.PAGE_PUBLIC_FIELDS }),
93
+ // documentId/populate/status after the (whitelisted) spread so a caller
94
+ // can't pass query parameters to override the controlled values.
26
95
  documentId,
27
96
  populate,
28
- ...ctx.query,
97
+ status: getReadStatus(ctx),
29
98
  });
30
99
  if (!result) {
31
100
  return ctx.notFound('Page not found');
32
101
  }
33
102
  ctx.body = { data: result };
34
103
  },
35
- });
104
+ }));
36
105
  exports.default = page;
37
106
  //# sourceMappingURL=page.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../server/src/controllers/page.ts"],"names":[],"mappings":";;AAEA,MAAM,IAAI,GAAG,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE,CAAC,CAAC;IACrD;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,GAAQ;QACjB,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,eAAe,CAAC,mBAAmB,EAAE,CAAC;QAEvD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC;YAChE,GAAG,GAAG,CAAC,KAAK;YACZ,QAAQ;SACT,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,GAAQ;QACpB,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAClC,MAAM,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nC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAQnC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -4,16 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const register_1 = __importDefault(require("./register"));
7
+ const content_types_1 = __importDefault(require("./content-types"));
7
8
  const bootstrap_1 = __importDefault(require("./bootstrap"));
8
9
  const controllers_1 = __importDefault(require("./controllers"));
9
10
  const services_1 = __importDefault(require("./services"));
10
11
  const routes_1 = __importDefault(require("./routes"));
12
+ const policies_1 = __importDefault(require("./policies"));
11
13
  const plugin = {
12
14
  register: register_1.default,
15
+ contentTypes: content_types_1.default,
13
16
  bootstrap: bootstrap_1.default,
14
17
  controllers: controllers_1.default,
15
18
  services: services_1.default,
16
19
  routes: routes_1.default,
20
+ policies: policies_1.default,
17
21
  };
18
22
  exports.default = plugin;
19
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,4DAAoC;AACpC,gEAAwC;AACxC,0DAAkC;AAClC,sDAA8B;AAE9B,MAAM,MAAM,GAA4B;IACtC,QAAQ,EAAR,kBAAQ;IACR,SAAS,EAAT,mBAAS;IACT,WAAW,EAAX,qBAAW;IACX,QAAQ,EAAR,kBAAQ;IACR,MAAM,EAAN,gBAAM;CACP,CAAC;AAEF,kBAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,oEAA2C;AAC3C,4DAAoC;AACpC,gEAAwC;AACxC,0DAAkC;AAClC,sDAA8B;AAC9B,0DAAkC;AAElC,MAAM,MAAM,GAA4B;IACtC,QAAQ,EAAR,kBAAQ;IACR,YAAY,EAAZ,uBAAY;IACZ,SAAS,EAAT,mBAAS;IACT,WAAW,EAAX,qBAAW;IACX,QAAQ,EAAR,kBAAQ;IACR,MAAM,EAAN,gBAAM;IACN,QAAQ,EAAR,kBAAQ;CACT,CAAC;AAEF,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const policies: Record<string, unknown>;
2
+ export default policies;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/policies/index.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAErC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,13 @@
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 rate_limit_1 = __importDefault(require("./rate-limit"));
7
+ // Typed as a plain record so the emitted .d.ts doesn't inline the policy's
8
+ // local param interfaces (which would be private-name / non-portable).
9
+ const policies = {
10
+ 'rate-limit': rate_limit_1.default,
11
+ };
12
+ exports.default = policies;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/src/policies/index.ts"],"names":[],"mappings":";;;;;AAAA,8DAAqC;AAErC,2EAA2E;AAC3E,uEAAuE;AACvE,MAAM,QAAQ,GAA4B;IACxC,YAAY,EAAE,oBAAS;CACxB,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,15 @@
1
+ interface PolicyContext {
2
+ request?: {
3
+ ip?: string;
4
+ };
5
+ }
6
+ interface StrapiLike {
7
+ log: {
8
+ warn: (message: string) => void;
9
+ };
10
+ }
11
+ declare const rateLimit: (policyContext: PolicyContext, _config: unknown, { strapi }: {
12
+ strapi: StrapiLike;
13
+ }) => boolean;
14
+ export default rateLimit;
15
+ //# sourceMappingURL=rate-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../../../server/src/policies/rate-limit.ts"],"names":[],"mappings":"AAqBA,UAAU,aAAa;IACrB,OAAO,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3B;AACD,UAAU,UAAU;IAClB,GAAG,EAAE;QAAE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAC1C;AAED,QAAA,MAAM,SAAS,GACb,eAAe,aAAa,EAC5B,SAAS,OAAO,EAChB,YAAY;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,KACjC,OAiBF,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Fixed-window in-memory IP rate limit for write-heavy public routes (inquiry
5
+ * create). Defense-in-depth: the demo-web Next route rate-limits first, but a
6
+ * caller hitting Strapi's public create route directly is throttled here too.
7
+ *
8
+ * Single-instance only — a shared store (Redis) is needed for multi-instance
9
+ * deploys; tracked alongside the P1-4 infra work.
10
+ */
11
+ const WINDOW_MS = 60000;
12
+ const MAX_REQUESTS = 5;
13
+ const hits = new Map();
14
+ // Drop expired entries so one-off IPs don't leak memory.
15
+ function sweep(now) {
16
+ for (const [ip, entry] of hits) {
17
+ if (now > entry.resetAt)
18
+ hits.delete(ip);
19
+ }
20
+ }
21
+ const rateLimit = (policyContext, _config, { strapi }) => {
22
+ const ip = policyContext.request?.ip || 'unknown';
23
+ const now = Date.now();
24
+ if (hits.size > 500)
25
+ sweep(now);
26
+ const entry = hits.get(ip);
27
+ if (!entry || now > entry.resetAt) {
28
+ hits.set(ip, { count: 1, resetAt: now + WINDOW_MS });
29
+ return true;
30
+ }
31
+ entry.count += 1;
32
+ if (entry.count > MAX_REQUESTS) {
33
+ strapi.log.warn(`[builder] inquiry rate limit hit for ip=${ip}`);
34
+ return false; // → 403 Forbidden
35
+ }
36
+ return true;
37
+ };
38
+ exports.default = rateLimit;
39
+ //# sourceMappingURL=rate-limit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../../../server/src/policies/rate-limit.ts"],"names":[],"mappings":";;AAAA;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,KAAM,CAAC;AACzB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,IAAI,GAAG,EAA8C,CAAC;AAEnE,yDAAyD;AACzD,SAAS,KAAK,CAAC,GAAW;IACxB,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;QAC/B,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO;YAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAWD,MAAM,SAAS,GAAG,CAChB,aAA4B,EAC5B,OAAgB,EAChB,EAAE,MAAM,EAA0B,EACzB,EAAE;IACX,MAAM,EAAE,GAAW,aAAa,CAAC,OAAO,EAAE,EAAE,IAAI,SAAS,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,IAAI,IAAI,CAAC,IAAI,GAAG,GAAG;QAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE3B,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,GAAG,SAAS,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;IACjB,IAAI,KAAK,CAAC,KAAK,GAAG,YAAY,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2CAA2C,EAAE,EAAE,CAAC,CAAC;QACjE,OAAO,KAAK,CAAC,CAAC,kBAAkB;IAClC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAc3C;;;;GAIG;AACH,QAAA,MAAM,QAAQ,GAAI,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,SA6BpD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAmB3C;;;;GAIG;AACH,QAAA,MAAM,QAAQ,GAAI,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,SA6CpD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const fs_1 = __importDefault(require("fs"));
8
+ const PROXY_RATE_LIMIT_WARNING = 'Rate limiting uses request.ip, but server.proxy.koa is not enabled. ' +
9
+ 'When running behind a proxy or CDN, set server: { proxy: { koa: true } } ' +
10
+ 'to prevent all clients from sharing one rate-limit bucket.';
8
11
  function upperFirst(str) {
9
12
  return str.charAt(0).toUpperCase() + str.slice(1);
10
13
  }
@@ -19,9 +22,13 @@ function camelCase(str) {
19
22
  * and Content-Type Builder without manual schema creation.
20
23
  */
21
24
  const register = ({ strapi }) => {
25
+ if (!strapi.config.get('server.proxy.koa')) {
26
+ strapi.log.warn(PROXY_RATE_LIMIT_WARNING);
27
+ }
22
28
  const componentsDir = path_1.default.join(__dirname, 'components');
23
29
  const categories = ['blocks', 'elements', 'shared'];
24
30
  const componentsMap = {};
31
+ const componentRegistry = strapi.get('components');
25
32
  for (const category of categories) {
26
33
  const categoryDir = path_1.default.join(componentsDir, category);
27
34
  if (!fs_1.default.existsSync(categoryDir))
@@ -31,6 +38,14 @@ const register = ({ strapi }) => {
31
38
  const schema = JSON.parse(fs_1.default.readFileSync(path_1.default.join(categoryDir, file), 'utf-8'));
32
39
  const componentName = file.replace('.json', '');
33
40
  const uid = `${category}.${componentName}`;
41
+ if (componentRegistry.get(uid)) {
42
+ const appComponentPath = `src/components/${category}/${file}`;
43
+ throw new Error(`Builder component UID conflict: "${uid}" is already registered by "${appComponentPath}". ` +
44
+ '플러그인 컴포넌트는 앱 파일로 덮어쓸 수 없습니다. ' +
45
+ `Remove "${appComponentPath}" and extend Builder through ` +
46
+ '"src/extensions/builder/strapi-server.ts" instead. ' +
47
+ 'Guide: https://github.com/HJ-company/daniworks-builder-v2/blob/main/docs/guides/extending-builder.md');
48
+ }
34
49
  componentsMap[uid] = {
35
50
  ...schema,
36
51
  __schema__: JSON.parse(JSON.stringify(schema)),
@@ -42,7 +57,7 @@ const register = ({ strapi }) => {
42
57
  };
43
58
  }
44
59
  }
45
- strapi.get('components').add(componentsMap);
60
+ componentRegistry.add(componentsMap);
46
61
  };
47
62
  exports.default = register;
48
63
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":";;;;;AACA,gDAAwB;AACxB,4CAAoB;AAEpB,SAAS,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