@dani-builder/strapi-plugin-builder 0.2.0 → 0.4.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 (150) hide show
  1. package/AGENTS.md +18 -21
  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 +12 -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 +60 -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/config/index.d.ts +15 -0
  26. package/dist/server/src/config/index.d.ts.map +1 -0
  27. package/dist/server/src/config/index.js +164 -0
  28. package/dist/server/src/config/index.js.map +1 -0
  29. package/dist/server/src/config/index.test.d.ts +2 -0
  30. package/dist/server/src/config/index.test.d.ts.map +1 -0
  31. package/dist/server/src/config/index.test.js +87 -0
  32. package/dist/server/src/config/index.test.js.map +1 -0
  33. package/dist/server/src/content-types/article/index.d.ts +146 -0
  34. package/dist/server/src/content-types/article/index.d.ts.map +1 -0
  35. package/dist/server/src/content-types/article/index.js +8 -0
  36. package/dist/server/src/content-types/article/index.js.map +1 -0
  37. package/dist/server/src/content-types/article/schema.json +104 -0
  38. package/dist/server/src/content-types/author/index.d.ts +56 -0
  39. package/dist/server/src/content-types/author/index.d.ts.map +1 -0
  40. package/dist/server/src/content-types/author/index.js +8 -0
  41. package/dist/server/src/content-types/author/index.js.map +1 -0
  42. package/dist/server/src/content-types/author/schema.json +48 -0
  43. package/dist/server/src/content-types/category/index.d.ts +71 -0
  44. package/dist/server/src/content-types/category/index.d.ts.map +1 -0
  45. package/dist/server/src/content-types/category/index.js +8 -0
  46. package/dist/server/src/content-types/category/index.js.map +1 -0
  47. package/dist/server/src/content-types/category/schema.json +45 -0
  48. package/dist/server/src/content-types/faq/index.d.ts +60 -0
  49. package/dist/server/src/content-types/faq/index.d.ts.map +1 -0
  50. package/dist/server/src/content-types/faq/index.js +8 -0
  51. package/dist/server/src/content-types/faq/index.js.map +1 -0
  52. package/dist/server/src/content-types/faq/schema.json +38 -0
  53. package/dist/server/src/content-types/global/index.d.ts +91 -0
  54. package/dist/server/src/content-types/global/index.d.ts.map +1 -0
  55. package/dist/server/src/content-types/global/index.js +8 -0
  56. package/dist/server/src/content-types/global/index.js.map +1 -0
  57. package/dist/server/src/content-types/global/schema.json +66 -0
  58. package/dist/server/src/content-types/index.d.ts +795 -0
  59. package/dist/server/src/content-types/index.d.ts.map +1 -0
  60. package/dist/server/src/content-types/index.js +30 -0
  61. package/dist/server/src/content-types/index.js.map +1 -0
  62. package/dist/server/src/content-types/inquiry/index.d.ts +48 -0
  63. package/dist/server/src/content-types/inquiry/index.d.ts.map +1 -0
  64. package/dist/server/src/content-types/inquiry/index.js +8 -0
  65. package/dist/server/src/content-types/inquiry/index.js.map +1 -0
  66. package/dist/server/src/content-types/inquiry/schema.json +40 -0
  67. package/dist/server/src/content-types/navigation/index.d.ts +80 -0
  68. package/dist/server/src/content-types/navigation/index.d.ts.map +1 -0
  69. package/dist/server/src/content-types/navigation/index.js +8 -0
  70. package/dist/server/src/content-types/navigation/index.js.map +1 -0
  71. package/dist/server/src/content-types/navigation/schema.json +54 -0
  72. package/dist/server/src/content-types/page/index.d.ts +78 -0
  73. package/dist/server/src/content-types/page/index.d.ts.map +1 -0
  74. package/dist/server/src/content-types/page/index.js +8 -0
  75. package/dist/server/src/content-types/page/index.js.map +1 -0
  76. package/dist/server/src/content-types/page/schema.json +64 -0
  77. package/dist/server/src/content-types/series/index.d.ts +68 -0
  78. package/dist/server/src/content-types/series/index.d.ts.map +1 -0
  79. package/dist/server/src/content-types/series/index.js +8 -0
  80. package/dist/server/src/content-types/series/index.js.map +1 -0
  81. package/dist/server/src/content-types/series/schema.json +46 -0
  82. package/dist/server/src/content-types/site-setting/index.d.ts +47 -0
  83. package/dist/server/src/content-types/site-setting/index.d.ts.map +1 -0
  84. package/dist/server/src/content-types/site-setting/index.js +8 -0
  85. package/dist/server/src/content-types/site-setting/index.js.map +1 -0
  86. package/dist/server/src/content-types/site-setting/schema.json +39 -0
  87. package/dist/server/src/content-types/tag/index.d.ts +68 -0
  88. package/dist/server/src/content-types/tag/index.d.ts.map +1 -0
  89. package/dist/server/src/content-types/tag/index.js +8 -0
  90. package/dist/server/src/content-types/tag/index.js.map +1 -0
  91. package/dist/server/src/content-types/tag/schema.json +46 -0
  92. package/dist/server/src/controllers/global.d.ts +1 -10
  93. package/dist/server/src/controllers/global.d.ts.map +1 -1
  94. package/dist/server/src/controllers/global.js +11 -4
  95. package/dist/server/src/controllers/global.js.map +1 -1
  96. package/dist/server/src/controllers/index.d.ts.map +1 -1
  97. package/dist/server/src/controllers/index.js +10 -0
  98. package/dist/server/src/controllers/index.js.map +1 -1
  99. package/dist/server/src/controllers/page.d.ts +11 -14
  100. package/dist/server/src/controllers/page.d.ts.map +1 -1
  101. package/dist/server/src/controllers/page.js +78 -9
  102. package/dist/server/src/controllers/page.js.map +1 -1
  103. package/dist/server/src/index.d.ts +1 -0
  104. package/dist/server/src/index.d.ts.map +1 -1
  105. package/dist/server/src/index.js +6 -0
  106. package/dist/server/src/index.js.map +1 -1
  107. package/dist/server/src/policies/index.d.ts +3 -0
  108. package/dist/server/src/policies/index.d.ts.map +1 -0
  109. package/dist/server/src/policies/index.js +13 -0
  110. package/dist/server/src/policies/index.js.map +1 -0
  111. package/dist/server/src/policies/rate-limit.d.ts +15 -0
  112. package/dist/server/src/policies/rate-limit.d.ts.map +1 -0
  113. package/dist/server/src/policies/rate-limit.js +39 -0
  114. package/dist/server/src/policies/rate-limit.js.map +1 -0
  115. package/dist/server/src/register.d.ts.map +1 -1
  116. package/dist/server/src/register.js +55 -2
  117. package/dist/server/src/register.js.map +1 -1
  118. package/dist/server/src/routes/content-api.d.ts +10 -13
  119. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  120. package/dist/server/src/routes/content-api.js +34 -30
  121. package/dist/server/src/routes/content-api.js.map +1 -1
  122. package/dist/server/src/routes/index.d.ts +10 -15
  123. package/dist/server/src/routes/index.d.ts.map +1 -1
  124. package/dist/server/src/routes/index.js +2 -1
  125. package/dist/server/src/routes/index.js.map +1 -1
  126. package/dist/server/src/services/index.d.ts.map +1 -1
  127. package/dist/server/src/services/index.js +12 -0
  128. package/dist/server/src/services/index.js.map +1 -1
  129. package/dist/server/src/services/populate.d.ts +1 -1
  130. package/dist/server/src/services/populate.d.ts.map +1 -1
  131. package/dist/server/src/services/populate.js +24 -11
  132. package/dist/server/src/services/populate.js.map +1 -1
  133. package/dist/server/src/utils/query.d.ts +11 -0
  134. package/dist/server/src/utils/query.d.ts.map +1 -0
  135. package/dist/server/src/utils/query.js +112 -0
  136. package/dist/server/src/utils/query.js.map +1 -0
  137. package/package.json +26 -15
  138. package/bin/sync.js +0 -320
  139. package/schemas/api/article/content-types/article/schema.json +0 -102
  140. package/schemas/api/author/content-types/author/schema.json +0 -44
  141. package/schemas/api/category/content-types/category/schema.json +0 -43
  142. package/schemas/api/faq/content-types/faq/schema.json +0 -36
  143. package/schemas/api/global/content-types/global/schema.json +0 -64
  144. package/schemas/api/inquiry/content-types/inquiry/schema.json +0 -31
  145. package/schemas/api/navigation/content-types/navigation/schema.json +0 -52
  146. package/schemas/api/page/content-types/page/schema.json +0 -62
  147. package/schemas/api/series/content-types/series/schema.json +0 -44
  148. package/schemas/api/site-setting/content-types/site-setting/schema.json +0 -35
  149. package/schemas/api/tag/content-types/tag/schema.json +0 -44
  150. package/schemas/manifest.json +0 -16
package/AGENTS.md CHANGED
@@ -13,14 +13,12 @@ export default () => ({
13
13
  builder: { enabled: true },
14
14
  });
15
15
 
16
- # 3. Sync content type schemas into your Strapi project
17
- npx daniworks-builder sync # Full sync (schemas + routes/controllers/services)
18
- npx daniworks-builder sync --dry-run # Preview changes
19
- npx daniworks-builder sync --only page # Sync specific content types
20
- npx daniworks-builder sync --force # Overwrite local modifications
16
+ # 3. Start Strapi — the plugin registers all Builder content types itself
21
17
  ```
22
18
 
23
- **Schema sync is required** for REST CRUD endpoints to work. The CLI copies schema.json files and generates routes/controllers/services boilerplate into your project's `src/api/` directory. Changes are tracked via `.daniworks-sync-manifest.json`.
19
+ **Do not copy Builder schemas into `src/api/`.** The plugin owns the content
20
+ types and their core REST routes; copied schemas duplicate collection names and
21
+ prevent Strapi from booting.
24
22
 
25
23
  ## Content Types (11)
26
24
 
@@ -28,22 +26,22 @@ npx daniworks-builder sync --force # Overwrite local modifications
28
26
 
29
27
  | singularName | pluralName | REST endpoint | draftAndPublish | i18n |
30
28
  |---|---|---|---|---|
31
- | page | pages | `api/pages` | true | yes |
32
- | article | articles | `api/articles` | true | yes |
33
- | faq | faqs | `api/faqs` | true | yes |
34
- | category | categories | `api/categories` | false | yes |
35
- | tag | tags | `api/tags` | false | yes |
36
- | author | authors | `api/authors` | false | no |
37
- | inquiry | inquiries | `api/inquiries` | false | no |
38
- | series | all-series | `api/all-series` | false | yes |
29
+ | page | pages | `api/builder/pages` | true | yes |
30
+ | article | articles | `api/builder/articles` | true | yes |
31
+ | faq | faqs | `api/builder/faqs` | true | yes |
32
+ | category | categories | `api/builder/categories` | false | yes |
33
+ | tag | tags | `api/builder/tags` | false | yes |
34
+ | author | authors | `api/builder/authors` | false | no |
35
+ | inquiry | inquiries | `api/builder/inquiries` | false | no |
36
+ | series | all-series | `api/builder/all-series` | false | yes |
39
37
 
40
38
  ### Single Types (3)
41
39
 
42
40
  | singularName | pluralName | REST endpoint | draftAndPublish | i18n |
43
41
  |---|---|---|---|---|
44
- | navigation | navigations | `api/navigations` | true | yes |
45
- | global | globals | `api/globals` | true | yes |
46
- | site-setting | site-settings | `api/site-settings` | false | no |
42
+ | navigation | navigations | `api/builder/navigation` | true | yes |
43
+ | global | globals | `api/builder/global` | true | yes |
44
+ | site-setting | site-settings | `api/builder/site-setting` | false | no |
47
45
 
48
46
  **Series quirk:** `pluralName` is `all-series` (not `series`) because Strapi requires singular and plural names to differ.
49
47
 
@@ -105,7 +103,7 @@ Blocks use a `variant` enum instead of separate components per layout. Only use
105
103
  ## REST API Rules (for MCP / programmatic content creation)
106
104
 
107
105
  ```json
108
- // POST api/pages — create a page with blocks
106
+ // POST api/builder/pages — create a page with blocks
109
107
  {
110
108
  "data": {
111
109
  "title": "About",
@@ -135,14 +133,13 @@ Blocks use a `variant` enum instead of separate components per layout. Only use
135
133
  ## File Structure
136
134
 
137
135
  ```
138
- schemas/api/ — Content type schemas (copied to consumer project by sync CLI)
139
136
  server/src/
137
+ content-types/ — Plugin-owned content type schemas
140
138
  register.ts — Programmatic component registration
141
139
  controllers/ — Smart API controllers (page, global)
142
140
  services/ — Populate service (deep populate definitions for all 14 blocks)
143
- routes/ — Smart API route definitions
141
+ routes/ — Core and smart API route definitions
144
142
  components/ — Component JSON schemas (blocks, elements, shared)
145
- bin/sync.js — CLI for schema sync
146
143
  ```
147
144
 
148
145
  ## Peer Dependencies
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HJ-company
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @dani-builder/strapi-plugin-builder
2
+
3
+ Reusable CMS building blocks for **Strapi v5** — 11 content types, 31 block/element
4
+ components, and a "smart API" that returns fully deep-populated pages and globals
5
+ in a single request. Powers the [Daniworks Builder](https://github.com/HJ-company/daniworks-builder-v2)
6
+ block-based site builder.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pnpm add @dani-builder/strapi-plugin-builder @strapi/plugin-color-picker @d3levvv/strapi-react-icons-plugin
12
+ ```
13
+
14
+ The two peer plugins are required: builder components use their custom
15
+ fields (`plugin::color-picker.color`, `plugin::icon-picker.icon`), and Strapi
16
+ only loads plugins listed in your own `package.json`. Without them the app
17
+ fails to boot with `Could not find Custom Field: plugin::color-picker.color`.
18
+
19
+ Enable it in `config/plugins.ts`:
20
+
21
+ ```ts
22
+ export default () => ({
23
+ builder: { enabled: true },
24
+ });
25
+ ```
26
+
27
+ ## Plugin-owned content types
28
+
29
+ The plugin directly registers all 11 content types as `plugin::builder.*`.
30
+ Do not copy schemas into a consumer's `src/api` directory: that would create
31
+ conflicting `collectionName` registrations. Core REST endpoints are available
32
+ under `/api/builder/*`.
33
+
34
+ The `inquiry` endpoint is write-only (`POST /api/builder/inquiries`) and IP
35
+ rate-limited so submitter PII cannot be listed over the public API.
36
+
37
+ ## Extending from your project
38
+
39
+ Add your own blocks to `Page.blocks` and extra fields to plugin components
40
+ from `src/extensions/builder/strapi-server.ts` in your Strapi project — no
41
+ plugin fork needed. Register populate for custom blocks with
42
+ `strapi.plugin('builder').service('populate').registerBlock(uid, populate)`.
43
+ Step-by-step guide with the failure cases to avoid:
44
+ [docs/guides/extending-builder.md](https://github.com/HJ-company/daniworks-builder-v2/blob/main/docs/guides/extending-builder.md).
45
+ Claude Code users get the same procedure as the `builder-extender` skill.
46
+
47
+ ## Smart API
48
+
49
+ Deep-populated, published-only reads (drafts never leak):
50
+
51
+ | Method | Endpoint | Purpose |
52
+ |--------|----------|---------|
53
+ | GET | `/api/builder/pages` | List pages (minimal populate) |
54
+ | GET | `/api/builder/pages/:documentId` | Single page, deep block populate |
55
+ | GET | `/api/builder/global` | Global settings, deep populate |
56
+
57
+ Consume it with [`@dani-builder/strapi-client`](https://www.npmjs.com/package/@dani-builder/strapi-client).
58
+
59
+ ## License
60
+
61
+ MIT © HJ-company
@@ -1,4 +1,4 @@
1
- import type { Core } from '@strapi/strapi';
1
+ import type { Core } from "@strapi/strapi";
2
2
  declare const bootstrap: ({ strapi }: {
3
3
  strapi: Core.Strapi;
4
4
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,QAAA,MAAM,SAAS,GAAI,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,SAGrD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAM3C,QAAA,MAAM,SAAS,GAAI,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,SAcrD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,8 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AGENT_PLUGIN_ID = "agent";
4
+ const CTB_COMPONENT_WARNING = "[builder] Plugin components cannot be edited in Content-Type Builder. Extend them through builder.config; see docs/guides/extending-builder.md.";
3
5
  const bootstrap = ({ strapi }) => {
6
+ if (strapi.config.get("autoReload", false)) {
7
+ strapi.log.warn(CTB_COMPONENT_WARNING);
8
+ }
4
9
  // Initialize populate service with core block definitions
5
- strapi.plugin('builder').service('populate').buildBlocksPopulate();
10
+ strapi.plugin("builder").service("populate").buildBlocksPopulate();
11
+ // The agent plugin is optional. Its first registration set is deliberately
12
+ // empty; future agent work adds observed serializer overrides here.
13
+ const serializer = strapi.plugins[AGENT_PLUGIN_ID]?.services?.serializer;
14
+ if (serializer && typeof serializer.registerOverrides === "function") {
15
+ serializer.registerOverrides({});
16
+ }
6
17
  };
7
18
  exports.default = bootstrap;
8
19
  //# sourceMappingURL=bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE;IACxD,0DAA0D;IAC1D,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACrE,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":";;AAEA,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,qBAAqB,GACzB,iJAAiJ,CAAC;AAEpJ,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE;IACxD,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,0DAA0D;IAC1D,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,mBAAmB,EAAE,CAAC;IAEnE,2EAA2E;IAC3E,oEAAoE;IACpE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC;IACzE,IAAI,UAAU,IAAI,OAAO,UAAU,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QACrE,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bootstrap.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.test.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
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 vitest_1 = require("vitest");
7
+ const bootstrap_1 = __importDefault(require("./bootstrap"));
8
+ function createStrapi(serializerInstalled, autoReload = false) {
9
+ const registerOverrides = vitest_1.vi.fn();
10
+ const buildBlocksPopulate = vitest_1.vi.fn();
11
+ const warn = vitest_1.vi.fn();
12
+ const plugins = serializerInstalled
13
+ ? { agent: { services: { serializer: { registerOverrides } } } }
14
+ : {};
15
+ return {
16
+ config: { get: vitest_1.vi.fn(() => autoReload) },
17
+ log: { warn },
18
+ plugins,
19
+ plugin: vitest_1.vi.fn((name) => {
20
+ if (name === "builder")
21
+ return { service: () => ({ buildBlocksPopulate }) };
22
+ return { service: () => ({ registerOverrides }) };
23
+ }),
24
+ registerOverrides,
25
+ buildBlocksPopulate,
26
+ warn,
27
+ };
28
+ }
29
+ (0, vitest_1.describe)("builder bootstrap", () => {
30
+ (0, vitest_1.it)("does not access agent services when the optional plugin is absent", () => {
31
+ const strapi = createStrapi(false);
32
+ (0, bootstrap_1.default)({ strapi: strapi });
33
+ (0, vitest_1.expect)(strapi.buildBlocksPopulate).toHaveBeenCalledOnce();
34
+ (0, vitest_1.expect)(strapi.plugin).toHaveBeenCalledTimes(1);
35
+ });
36
+ (0, vitest_1.it)("registers the empty serializer override set when agent is installed", () => {
37
+ const strapi = createStrapi(true);
38
+ (0, bootstrap_1.default)({ strapi: strapi });
39
+ (0, vitest_1.expect)(strapi.registerOverrides).toHaveBeenCalledWith({});
40
+ });
41
+ (0, vitest_1.it)("does not access an unrelated plugin registered as agent", () => {
42
+ const strapi = createStrapi(false);
43
+ strapi.plugins.agent = {};
44
+ (0, bootstrap_1.default)({ strapi: strapi });
45
+ (0, vitest_1.expect)(strapi.registerOverrides).not.toHaveBeenCalled();
46
+ (0, vitest_1.expect)(strapi.plugin).toHaveBeenCalledTimes(1);
47
+ });
48
+ (0, vitest_1.it)("warns once about CTB component editing in development", () => {
49
+ const strapi = createStrapi(false, true);
50
+ (0, bootstrap_1.default)({ strapi: strapi });
51
+ (0, vitest_1.expect)(strapi.warn).toHaveBeenCalledOnce();
52
+ (0, vitest_1.expect)(strapi.warn).toHaveBeenCalledWith(vitest_1.expect.stringContaining("builder.config"));
53
+ });
54
+ (0, vitest_1.it)("does not warn about CTB component editing in production", () => {
55
+ const strapi = createStrapi(false, false);
56
+ (0, bootstrap_1.default)({ strapi: strapi });
57
+ (0, vitest_1.expect)(strapi.warn).not.toHaveBeenCalled();
58
+ });
59
+ });
60
+ //# sourceMappingURL=bootstrap.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.test.js","sourceRoot":"","sources":["../../../server/src/bootstrap.test.ts"],"names":[],"mappings":"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"}
@@ -13,12 +13,20 @@
13
13
  },
14
14
  "variant": {
15
15
  "type": "enumeration",
16
- "enum": ["inline-spread", "inline-centered", "inline-stacked", "card-stacked", "card-centered", "card-horizontal"]
16
+ "enum": [
17
+ "inline-spread",
18
+ "inline-centered",
19
+ "inline-stacked",
20
+ "card-stacked",
21
+ "card-centered",
22
+ "card-horizontal"
23
+ ],
24
+ "default": "inline-spread"
17
25
  },
18
- "ctaMedia": {
19
- "type": "media",
20
- "multiple": false,
21
- "allowedTypes": ["images", "videos"]
26
+ "image": {
27
+ "type": "component",
28
+ "component": "shared.image",
29
+ "repeatable": false
22
30
  },
23
31
  "ctaText": {
24
32
  "type": "text"
@@ -14,7 +14,7 @@
14
14
  "items": {
15
15
  "type": "relation",
16
16
  "relation": "oneToMany",
17
- "target": "api::faq.faq"
17
+ "target": "plugin::builder.faq"
18
18
  }
19
19
  }
20
20
  }
@@ -11,17 +11,22 @@
11
11
  },
12
12
  "variant": {
13
13
  "type": "enumeration",
14
- "enum": ["simple-grid", "dual-column", "media-aside", "media-aside-compact"]
14
+ "enum": [
15
+ "simple-grid",
16
+ "dual-column",
17
+ "media-aside",
18
+ "media-aside-compact"
19
+ ]
15
20
  },
16
21
  "section": {
17
22
  "type": "component",
18
23
  "component": "elements.section",
19
24
  "repeatable": false
20
25
  },
21
- "media": {
22
- "type": "media",
23
- "multiple": false,
24
- "allowedTypes": ["images"]
26
+ "image": {
27
+ "type": "component",
28
+ "component": "shared.image",
29
+ "repeatable": false
25
30
  },
26
31
  "items": {
27
32
  "type": "component",
@@ -8,17 +8,22 @@
8
8
  "attributes": {
9
9
  "variant": {
10
10
  "type": "enumeration",
11
- "enum": ["side-by-side", "media-extending", "fullscreen-media", "stacked-media"]
11
+ "enum": [
12
+ "side-by-side",
13
+ "media-extending",
14
+ "fullscreen-media",
15
+ "stacked-media"
16
+ ]
12
17
  },
13
18
  "section": {
14
19
  "type": "component",
15
20
  "component": "elements.section",
16
21
  "repeatable": false
17
22
  },
18
- "heroMedia": {
19
- "type": "media",
20
- "multiple": false,
21
- "allowedTypes": ["images", "videos"]
23
+ "image": {
24
+ "type": "component",
25
+ "component": "shared.image",
26
+ "repeatable": false
22
27
  },
23
28
  "ctaText": {
24
29
  "type": "text"
@@ -35,7 +40,11 @@
35
40
  },
36
41
  "headerMode": {
37
42
  "type": "enumeration",
38
- "enum": ["none", "transparent-black", "transparent-white"],
43
+ "enum": [
44
+ "none",
45
+ "transparent-black",
46
+ "transparent-white"
47
+ ],
39
48
  "default": "none"
40
49
  }
41
50
  }
@@ -11,12 +11,16 @@
11
11
  },
12
12
  "variant": {
13
13
  "type": "enumeration",
14
- "enum": ["dual-column", "triple-column", "alternating"]
14
+ "enum": [
15
+ "dual-column",
16
+ "triple-column",
17
+ "alternating"
18
+ ]
15
19
  },
16
- "media": {
17
- "type": "media",
18
- "multiple": false,
19
- "allowedTypes": ["images", "videos"]
20
+ "image": {
21
+ "type": "component",
22
+ "component": "shared.image",
23
+ "repeatable": false
20
24
  },
21
25
  "section": {
22
26
  "type": "component",
@@ -13,6 +13,9 @@
13
13
  },
14
14
  "successMessage": {
15
15
  "type": "text"
16
+ },
17
+ "errorMessage": {
18
+ "type": "text"
16
19
  }
17
20
  }
18
21
  }
@@ -11,7 +11,12 @@
11
11
  },
12
12
  "variant": {
13
13
  "type": "enumeration",
14
- "enum": ["inline", "grid", "split"]
14
+ "enum": [
15
+ "inline",
16
+ "grid",
17
+ "split",
18
+ "marquee"
19
+ ]
15
20
  },
16
21
  "section": {
17
22
  "type": "component",
@@ -11,17 +11,21 @@
11
11
  },
12
12
  "variant": {
13
13
  "type": "enumeration",
14
- "enum": ["simple", "card-grid", "split"]
14
+ "enum": [
15
+ "simple",
16
+ "card-grid",
17
+ "split"
18
+ ]
15
19
  },
16
20
  "section": {
17
21
  "type": "component",
18
22
  "component": "elements.section",
19
23
  "repeatable": false
20
24
  },
21
- "media": {
22
- "type": "media",
23
- "multiple": false,
24
- "allowedTypes": ["images", "videos"]
25
+ "image": {
26
+ "type": "component",
27
+ "component": "shared.image",
28
+ "repeatable": false
25
29
  },
26
30
  "items": {
27
31
  "type": "component",
@@ -11,17 +11,22 @@
11
11
  },
12
12
  "variant": {
13
13
  "type": "enumeration",
14
- "enum": ["centered", "side-by-side", "card-grid", "subtle-grid"]
14
+ "enum": [
15
+ "centered",
16
+ "side-by-side",
17
+ "card-grid",
18
+ "subtle-grid"
19
+ ]
15
20
  },
16
21
  "section": {
17
22
  "type": "component",
18
23
  "component": "elements.section",
19
24
  "repeatable": false
20
25
  },
21
- "media": {
22
- "type": "media",
23
- "multiple": false,
24
- "allowedTypes": ["images", "videos"]
26
+ "image": {
27
+ "type": "component",
28
+ "component": "shared.image",
29
+ "repeatable": false
25
30
  },
26
31
  "items": {
27
32
  "type": "component",
@@ -12,10 +12,10 @@
12
12
  "description": {
13
13
  "type": "text"
14
14
  },
15
- "media": {
16
- "type": "media",
17
- "multiple": false,
18
- "allowedTypes": ["images"]
15
+ "image": {
16
+ "type": "component",
17
+ "component": "shared.image",
18
+ "repeatable": false
19
19
  },
20
20
  "icon": {
21
21
  "type": "customField",
@@ -12,11 +12,11 @@
12
12
  "description": {
13
13
  "type": "richtext"
14
14
  },
15
- "media": {
16
- "type": "media",
17
- "multiple": false,
18
- "required": true,
19
- "allowedTypes": ["images", "videos"]
15
+ "image": {
16
+ "type": "component",
17
+ "component": "shared.image",
18
+ "repeatable": false,
19
+ "required": true
20
20
  },
21
21
  "link": {
22
22
  "type": "component",
@@ -0,0 +1,24 @@
1
+ {
2
+ "collectionName": "components_shared_images",
3
+ "info": {
4
+ "displayName": "Image",
5
+ "icon": "picture",
6
+ "description": "Informational image with per-usage fit control and localized alt override"
7
+ },
8
+ "attributes": {
9
+ "media": {
10
+ "type": "media",
11
+ "multiple": false,
12
+ "required": true,
13
+ "allowedTypes": ["images", "videos"]
14
+ },
15
+ "alt": {
16
+ "type": "string"
17
+ },
18
+ "fit": {
19
+ "type": "enumeration",
20
+ "enum": ["auto", "cover", "contain"],
21
+ "default": "auto"
22
+ }
23
+ }
24
+ }
@@ -17,11 +17,11 @@
17
17
  "component": "shared.link",
18
18
  "repeatable": false
19
19
  },
20
- "media": {
21
- "type": "media",
22
- "multiple": false,
23
- "required": true,
24
- "allowedTypes": ["images", "videos"]
20
+ "image": {
21
+ "type": "component",
22
+ "component": "shared.image",
23
+ "repeatable": false,
24
+ "required": true
25
25
  }
26
26
  }
27
27
  }
@@ -0,0 +1,15 @@
1
+ export interface BuilderConfig {
2
+ blocks: {
3
+ extra: Record<string, object>;
4
+ includeInGlobal: boolean;
5
+ };
6
+ components: Record<string, {
7
+ attributes: Record<string, object>;
8
+ }>;
9
+ }
10
+ declare const config: {
11
+ default(): BuilderConfig;
12
+ validator(value: unknown): void;
13
+ };
14
+ export default config;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/config/index.ts"],"names":[],"mappings":"AA2DA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;CACpE;AAgED,QAAA,MAAM,MAAM;eACC,aAAa;qBAUP,OAAO,GAAG,IAAI;CAmFhC,CAAC;AAEF,eAAe,MAAM,CAAC"}