@dani-builder/strapi-plugin-builder 0.5.0 → 0.6.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 (82) hide show
  1. package/README.md +53 -12
  2. package/dist/server/src/components/blocks/bento-grid.json +1 -0
  3. package/dist/server/src/components/blocks/content.json +1 -0
  4. package/dist/server/src/components/blocks/cta.json +1 -0
  5. package/dist/server/src/components/blocks/faq.json +1 -0
  6. package/dist/server/src/components/blocks/features.json +1 -0
  7. package/dist/server/src/components/blocks/hero.json +1 -0
  8. package/dist/server/src/components/blocks/highlights.json +1 -0
  9. package/dist/server/src/components/blocks/inquiry-form.json +1 -0
  10. package/dist/server/src/components/blocks/logo-cloud.json +1 -0
  11. package/dist/server/src/components/blocks/previews/bento-grid.jpg +0 -0
  12. package/dist/server/src/components/blocks/previews/content.jpg +0 -0
  13. package/dist/server/src/components/blocks/previews/cta.jpg +0 -0
  14. package/dist/server/src/components/blocks/previews/faq.jpg +0 -0
  15. package/dist/server/src/components/blocks/previews/features.jpg +0 -0
  16. package/dist/server/src/components/blocks/previews/hero.jpg +0 -0
  17. package/dist/server/src/components/blocks/previews/highlights.jpg +0 -0
  18. package/dist/server/src/components/blocks/previews/inquiry-form.jpg +0 -0
  19. package/dist/server/src/components/blocks/previews/logo-cloud.jpg +0 -0
  20. package/dist/server/src/components/blocks/previews/pricing.jpg +0 -0
  21. package/dist/server/src/components/blocks/previews/slider.jpg +0 -0
  22. package/dist/server/src/components/blocks/previews/stats.jpg +0 -0
  23. package/dist/server/src/components/blocks/previews/team.jpg +0 -0
  24. package/dist/server/src/components/blocks/previews/testimonials.jpg +0 -0
  25. package/dist/server/src/components/blocks/pricing.json +1 -0
  26. package/dist/server/src/components/blocks/slider.json +1 -0
  27. package/dist/server/src/components/blocks/stats.json +1 -0
  28. package/dist/server/src/components/blocks/team.json +1 -0
  29. package/dist/server/src/components/blocks/testimonials.json +1 -0
  30. package/dist/server/src/config/builder.d.ts +27 -0
  31. package/dist/server/src/config/builder.d.ts.map +1 -0
  32. package/dist/server/src/config/builder.js +80 -0
  33. package/dist/server/src/config/builder.js.map +1 -0
  34. package/dist/server/src/controllers/global.d.ts.map +1 -1
  35. package/dist/server/src/controllers/global.js +5 -2
  36. package/dist/server/src/controllers/global.js.map +1 -1
  37. package/dist/server/src/controllers/index.d.ts.map +1 -1
  38. package/dist/server/src/controllers/index.js +2 -0
  39. package/dist/server/src/controllers/index.js.map +1 -1
  40. package/dist/server/src/controllers/page.d.ts.map +1 -1
  41. package/dist/server/src/controllers/page.js +7 -2
  42. package/dist/server/src/controllers/page.js.map +1 -1
  43. package/dist/server/src/controllers/preview.d.ts +13 -0
  44. package/dist/server/src/controllers/preview.d.ts.map +1 -0
  45. package/dist/server/src/controllers/preview.js +40 -0
  46. package/dist/server/src/controllers/preview.js.map +1 -0
  47. package/dist/server/src/mcp/index.d.ts +4 -0
  48. package/dist/server/src/mcp/index.d.ts.map +1 -0
  49. package/dist/server/src/mcp/index.js +170 -0
  50. package/dist/server/src/mcp/index.js.map +1 -0
  51. package/dist/server/src/mcp/schema.d.ts +32 -0
  52. package/dist/server/src/mcp/schema.d.ts.map +1 -0
  53. package/dist/server/src/mcp/schema.js +102 -0
  54. package/dist/server/src/mcp/schema.js.map +1 -0
  55. package/dist/server/src/register.d.ts.map +1 -1
  56. package/dist/server/src/register.js +12 -1
  57. package/dist/server/src/register.js.map +1 -1
  58. package/dist/server/src/routes/admin.d.ts +14 -0
  59. package/dist/server/src/routes/admin.d.ts.map +1 -0
  60. package/dist/server/src/routes/admin.js +16 -0
  61. package/dist/server/src/routes/admin.js.map +1 -0
  62. package/dist/server/src/routes/content-api.d.ts +1 -1
  63. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  64. package/dist/server/src/routes/content-api.js +1 -1
  65. package/dist/server/src/routes/content-api.js.map +1 -1
  66. package/dist/server/src/routes/index.d.ts +4 -3
  67. package/dist/server/src/routes/index.d.ts.map +1 -1
  68. package/dist/server/src/routes/index.js +2 -0
  69. package/dist/server/src/routes/index.js.map +1 -1
  70. package/dist/server/src/services/populate.d.ts +1 -4
  71. package/dist/server/src/services/populate.d.ts.map +1 -1
  72. package/dist/server/src/services/populate.js +1 -1
  73. package/dist/server/src/services/populate.js.map +1 -1
  74. package/package.json +37 -7
  75. package/dist/server/src/bootstrap.test.d.ts +0 -2
  76. package/dist/server/src/bootstrap.test.d.ts.map +0 -1
  77. package/dist/server/src/bootstrap.test.js +0 -60
  78. package/dist/server/src/bootstrap.test.js.map +0 -1
  79. package/dist/server/src/config/index.test.d.ts +0 -2
  80. package/dist/server/src/config/index.test.d.ts.map +0 -1
  81. package/dist/server/src/config/index.test.js +0 -87
  82. package/dist/server/src/config/index.test.js.map +0 -1
package/README.md CHANGED
@@ -8,22 +8,63 @@ block-based site builder.
8
8
  ## Install
9
9
 
10
10
  ```bash
11
- pnpm add @dani-builder/strapi-plugin-builder @strapi/plugin-color-picker @d3levvv/strapi-react-icons-plugin
11
+ pnpm add @dani-builder/strapi-plugin-builder @strapi/plugin-color-picker @d3levvv/strapi-react-icons-plugin @strapi/provider-upload-aws-s3
12
12
  ```
13
13
 
14
- The two peer plugins are required: builder components use their custom
14
+ The two custom-field peer plugins are required: builder components use their
15
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`.
16
+ only loads plugins listed in your own `package.json`. Without them the app fails
17
+ to boot with `Could not find Custom Field: plugin::color-picker.color`.
18
18
 
19
- Enable it in `config/plugins.ts`:
19
+ The S3 upload provider is an optional peer for local-only projects, but it must
20
+ be a direct dependency of the CMS when `AWS_BUCKET` enables S3, R2, or MinIO.
21
+ Strapi resolves upload providers from the consuming application.
22
+
23
+ Use the package-owned config factories so package upgrades carry storage and
24
+ media CSP fixes into the application. Compose the package-owned entries with
25
+ the rest of your application config. In `config/plugins.ts`:
20
26
 
21
27
  ```ts
22
- export default () => ({
23
- builder: { enabled: true },
28
+ import {
29
+ builderPlugins,
30
+ builderUpload,
31
+ } from "@dani-builder/strapi-plugin-builder/config";
32
+
33
+ export default ({ env }) => ({
34
+ builder: builderPlugins({ env }),
35
+ upload: {
36
+ config: {
37
+ // Keep application-owned security settings such as deniedTypes here.
38
+ ...builderUpload({ env }),
39
+ },
40
+ },
24
41
  });
25
42
  ```
26
43
 
44
+ In `config/middlewares.ts`:
45
+
46
+ ```ts
47
+ import { builderMiddlewares } from "@dani-builder/strapi-plugin-builder/config";
48
+
49
+ export default ({ env }) => [
50
+ "strapi::logger",
51
+ "strapi::errors",
52
+ builderMiddlewares({ env }),
53
+ // The remaining Strapi and application middleware entries stay here.
54
+ ];
55
+ ```
56
+
57
+ With no `AWS_BUCKET`, uploads use Strapi's local provider. Set `AWS_BUCKET` for
58
+ S3; S3-compatible R2 and MinIO deployments can additionally set `AWS_ENDPOINT`.
59
+ Endpoint-based configurations enable path-style requests by default and can
60
+ override that behavior with `AWS_FORCE_PATH_STYLE`.
61
+
62
+ `builderUpload({ env })` only owns provider settings. Spread it inside the
63
+ application's `upload.config` block so Strapi's generated media security
64
+ settings remain in place. SVG and executable upload denial belongs to the
65
+ application's `upload.config.security.deniedTypes`; the factory does not inject
66
+ or replace it.
67
+
27
68
  ## Plugin-owned content types
28
69
 
29
70
  The plugin directly registers all 11 content types as `plugin::builder.*`.
@@ -48,11 +89,11 @@ Claude Code users get the same procedure as the `builder-extender` skill.
48
89
 
49
90
  Deep-populated, published-only reads (drafts never leak):
50
91
 
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 |
92
+ | Method | Endpoint | Purpose |
93
+ | ------ | -------------------------------- | -------------------------------- |
94
+ | GET | `/api/builder/pages` | List pages (minimal populate) |
95
+ | GET | `/api/builder/pages/:documentId` | Single page, deep block populate |
96
+ | GET | `/api/builder/global` | Global settings, deep populate |
56
97
 
57
98
  Consume it with [`@dani-builder/strapi-client`](https://www.npmjs.com/package/@dani-builder/strapi-client).
58
99
 
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Bento Grid",
5
5
  "icon": "grid",
6
+ "preview": "previews/bento-grid.jpg",
6
7
  "description": "Asymmetric grid layout with per-item span control"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Content",
5
5
  "icon": "feather",
6
+ "preview": "previews/content.jpg",
6
7
  "description": "Rich text content block using Strapi Blocks editor"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "CTA",
5
5
  "icon": "cursor",
6
+ "preview": "previews/cta.jpg",
6
7
  "description": "Call-to-Action block with media and action links"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "FAQ",
5
5
  "icon": "question",
6
+ "preview": "previews/faq.jpg",
6
7
  "description": "FAQ list block linked to FAQ content type via relation"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Features",
5
5
  "icon": "apps",
6
+ "preview": "previews/features.jpg",
6
7
  "description": "Feature/service showcase with icon+text items"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Hero",
5
5
  "icon": "picture",
6
+ "preview": "previews/hero.jpg",
6
7
  "description": "Hero banner with media, CTA links, and layout variants"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Highlights",
5
5
  "icon": "star",
6
+ "preview": "previews/highlights.jpg",
6
7
  "description": "Highlight/feature showcase with media+text items"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Inquiry Form",
5
5
  "icon": "envelop",
6
+ "preview": "previews/inquiry-form.jpg",
6
7
  "description": "Contact form block that submits to Inquiry content type"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Logo Cloud",
5
5
  "icon": "picture",
6
+ "preview": "previews/logo-cloud.jpg",
6
7
  "description": "Client/partner logo showcase block"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Pricing",
5
5
  "icon": "priceTag",
6
+ "preview": "previews/pricing.jpg",
6
7
  "description": "Pricing plans/tiers comparison block"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Slider",
5
5
  "icon": "slideshow",
6
+ "preview": "previews/slider.jpg",
6
7
  "description": "Slider/carousel block with media+text items"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Stats",
5
5
  "icon": "chartBubble",
6
+ "preview": "previews/stats.jpg",
6
7
  "description": "Key metrics/numbers showcase block"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Team",
5
5
  "icon": "user",
6
+ "preview": "previews/team.jpg",
6
7
  "description": "Team member showcase block"
7
8
  },
8
9
  "attributes": {
@@ -3,6 +3,7 @@
3
3
  "info": {
4
4
  "displayName": "Testimonials",
5
5
  "icon": "quote",
6
+ "preview": "previews/testimonials.jpg",
6
7
  "description": "Customer testimonials/reviews block"
7
8
  },
8
9
  "attributes": {
@@ -0,0 +1,27 @@
1
+ type ConfigValue = Record<string, unknown>;
2
+ export interface BuilderPluginConfig {
3
+ enabled: boolean;
4
+ config?: ConfigValue;
5
+ }
6
+ export interface BuilderMiddlewareConfig {
7
+ name: 'strapi::security';
8
+ config: {
9
+ contentSecurityPolicy: {
10
+ useDefaults: boolean;
11
+ directives: Record<string, unknown>;
12
+ };
13
+ };
14
+ }
15
+ export interface BuilderEnv {
16
+ (key: string): string | undefined;
17
+ (key: string, defaultValue: string | undefined): string | undefined;
18
+ bool(key: string, defaultValue?: boolean): boolean;
19
+ }
20
+ export interface BuilderConfigParams {
21
+ env: BuilderEnv;
22
+ }
23
+ export declare function builderUpload({ env }: BuilderConfigParams): ConfigValue;
24
+ export declare function builderPlugins(_params: BuilderConfigParams, builderConfig?: ConfigValue): BuilderPluginConfig;
25
+ export declare function builderMiddlewares({ env, }: BuilderConfigParams): BuilderMiddlewareConfig;
26
+ export {};
27
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../server/src/config/builder.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3C,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE;QACN,qBAAqB,EAAE;YACrB,WAAW,EAAE,OAAO,CAAC;YACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACrC,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;IACpE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CACpD;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,UAAU,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,EAAE,mBAAmB,GAAG,WAAW,CA+BvE;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,mBAAmB,EAC5B,aAAa,CAAC,EAAE,WAAW,GAC1B,mBAAmB,CAKrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,GACJ,EAAE,mBAAmB,GAAG,uBAAuB,CAoC/C"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.builderUpload = builderUpload;
4
+ exports.builderPlugins = builderPlugins;
5
+ exports.builderMiddlewares = builderMiddlewares;
6
+ function builderUpload({ env }) {
7
+ const endpoint = env('AWS_ENDPOINT', undefined);
8
+ const bucket = env('AWS_BUCKET');
9
+ if (!bucket)
10
+ return {};
11
+ return {
12
+ provider: 'aws-s3',
13
+ providerOptions: {
14
+ baseUrl: env('AWS_CDN_URL', undefined),
15
+ s3Options: {
16
+ ...(env('AWS_ACCESS_KEY_ID') && env('AWS_ACCESS_SECRET')
17
+ ? {
18
+ credentials: {
19
+ accessKeyId: env('AWS_ACCESS_KEY_ID'),
20
+ secretAccessKey: env('AWS_ACCESS_SECRET'),
21
+ },
22
+ }
23
+ : {}),
24
+ region: env('AWS_REGION', undefined),
25
+ endpoint,
26
+ forcePathStyle: env.bool('AWS_FORCE_PATH_STYLE', Boolean(endpoint)),
27
+ params: { Bucket: bucket },
28
+ },
29
+ },
30
+ actionOptions: {
31
+ upload: {},
32
+ uploadStream: {},
33
+ delete: {},
34
+ },
35
+ };
36
+ }
37
+ function builderPlugins(_params, builderConfig) {
38
+ return {
39
+ enabled: true,
40
+ ...(builderConfig ? { config: builderConfig } : {}),
41
+ };
42
+ }
43
+ function builderMiddlewares({ env, }) {
44
+ const mediaHosts = [
45
+ env('AWS_CDN_URL'),
46
+ env('AWS_ENDPOINT'),
47
+ env('AWS_BUCKET_HOST'),
48
+ ]
49
+ .filter((value) => Boolean(value))
50
+ .map((value) => {
51
+ try {
52
+ return new URL(value.startsWith('http') ? value : `https://${value}`)
53
+ .host;
54
+ }
55
+ catch {
56
+ return value;
57
+ }
58
+ });
59
+ return {
60
+ name: 'strapi::security',
61
+ config: {
62
+ contentSecurityPolicy: {
63
+ useDefaults: true,
64
+ directives: {
65
+ 'connect-src': ["'self'", 'https:'],
66
+ 'img-src': [
67
+ "'self'",
68
+ 'data:',
69
+ 'blob:',
70
+ 'market-assets.strapi.io',
71
+ ...mediaHosts,
72
+ ],
73
+ 'media-src': ["'self'", 'data:', 'blob:', ...mediaHosts],
74
+ upgradeInsecureRequests: null,
75
+ },
76
+ },
77
+ },
78
+ };
79
+ }
80
+ //# sourceMappingURL=builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../server/src/config/builder.ts"],"names":[],"mappings":";;AA2BA,sCA+BC;AAED,wCAQC;AAED,gDAsCC;AAjFD,SAAgB,aAAa,CAAC,EAAE,GAAG,EAAuB;IACxD,MAAM,QAAQ,GAAG,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;IAEjC,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEvB,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,eAAe,EAAE;YACf,OAAO,EAAE,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC;YACtC,SAAS,EAAE;gBACT,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,GAAG,CAAC,mBAAmB,CAAC;oBACtD,CAAC,CAAC;wBACE,WAAW,EAAE;4BACX,WAAW,EAAE,GAAG,CAAC,mBAAmB,CAAC;4BACrC,eAAe,EAAE,GAAG,CAAC,mBAAmB,CAAC;yBAC1C;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP,MAAM,EAAE,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC;gBACpC,QAAQ;gBACR,cAAc,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,QAAQ,CA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AAE,OAAO,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;oBACxD,uBAAuB,EAAE,IAAI;iBAC9B;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
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
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/global.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,MAAM,EAAE,OA+Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -7,10 +7,13 @@ const global = strapi_1.factories.createCoreController('plugin::builder.global',
7
7
  * GET /api/builder/global
8
8
  * Global settings with deep populate (siteWideBlocks + footer)
9
9
  */
10
- async find(ctx) {
10
+ async find(baseContext) {
11
+ const ctx = baseContext;
11
12
  const populateService = strapi.plugin('builder').service('populate');
12
13
  const populate = populateService.getGlobalPopulate();
13
- const result = await strapi.documents('plugin::builder.global').findFirst({
14
+ const result = await strapi
15
+ .documents('plugin::builder.global')
16
+ .findFirst({
14
17
  // Global is a single type: only locale/pagination pass through. No
15
18
  // filterFields is supplied, so filters/sort (and fields) are dropped.
16
19
  ...(0, query_1.pickPublicQuery)(ctx.query),
@@ -1 +1 @@
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,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B,CAAC,CAAC;QAEL,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,CACH,CAAC;AAEF,kBAAe,MAAM,CAAC"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAaxC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const strapi_1 = require("@strapi/strapi");
7
7
  const page_1 = __importDefault(require("./page"));
8
8
  const global_1 = __importDefault(require("./global"));
9
+ const preview_1 = __importDefault(require("./preview"));
9
10
  const controllers = {
10
11
  article: strapi_1.factories.createCoreController('plugin::builder.article'),
11
12
  author: strapi_1.factories.createCoreController('plugin::builder.author'),
@@ -13,6 +14,7 @@ const controllers = {
13
14
  faq: strapi_1.factories.createCoreController('plugin::builder.faq'),
14
15
  page: page_1.default,
15
16
  global: global_1.default,
17
+ preview: preview_1.default,
16
18
  inquiry: strapi_1.factories.createCoreController('plugin::builder.inquiry'),
17
19
  navigation: strapi_1.factories.createCoreController('plugin::builder.navigation'),
18
20
  series: strapi_1.factories.createCoreController('plugin::builder.series'),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":";;;;;AAAA,2CAA2C;A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AC;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 +1 @@
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
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/page.ts"],"names":[],"mappings":"AAqBA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,QAAQ,CAAC,EAAE,OAAO;;;;;;;;;;EAkBnB;AAUD,QAAA,MAAM,IAAI,EAAE,OAsFX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -38,7 +38,8 @@ const page = strapi_1.factories.createCoreController('plugin::builder.page', ({
38
38
  * GET /api/builder/pages
39
39
  * List pages with minimal populate (no blocks)
40
40
  */
41
- async find(ctx) {
41
+ async find(baseContext) {
42
+ const ctx = baseContext;
42
43
  const populateService = strapi.plugin('builder').service('populate');
43
44
  const populate = populateService.getPageListPopulate();
44
45
  const publicQuery = (0, query_1.pickPublicQuery)(ctx.query, {
@@ -84,8 +85,12 @@ const page = strapi_1.factories.createCoreController('plugin::builder.page', ({
84
85
  * GET /api/builder/pages/:documentId
85
86
  * Single page with deep block populate
86
87
  */
87
- async findOne(ctx) {
88
+ async findOne(baseContext) {
89
+ const ctx = baseContext;
88
90
  const documentId = ctx.params.id ?? ctx.params.documentId;
91
+ if (!documentId) {
92
+ return ctx.notFound('Page not found');
93
+ }
89
94
  const populateService = strapi.plugin('builder').service('populate');
90
95
  const populate = populateService.getPagePopulate();
91
96
  const result = await strapi.documents('plugin::builder.page').findOne({
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../server/src/controllers/page.ts"],"names":[],"mappings":";;AAaA,8CAoBC;AAjCD,2CAA2C;AAC3C,0CAAqE;AAErE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,eAAe,CAAC,KAAc,EAAE,QAAgB;IACvD,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACjE,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QACzE,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,QAAQ,CAAC;AACf,CAAC;AAED,SAAgB,iBAAiB,CAC/B,UAAmB,EACnB,QAAkB;IAElB,MAAM,KAAK,GACT,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;QAC1C,CAAC,CAAE,UAAsC;QACzC,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7C,MAAM,GAAG,GACP,QAAQ,KAAK,SAAS;QACpB,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,KAAK;QACpB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,GA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AC;QAEH,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACxC,CAAC;QAED,GAAG,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACF,CAAC,CACH,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ type PreviewContext = Parameters<Core.ControllerHandler>[0] & {
3
+ params: {
4
+ file?: string;
5
+ };
6
+ fresh: boolean;
7
+ notFound(): unknown;
8
+ };
9
+ declare const preview: () => {
10
+ find(ctx: PreviewContext): Promise<unknown>;
11
+ };
12
+ export default preview;
13
+ //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/preview.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAK3C,KAAK,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG;IAC5D,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,IAAI,OAAO,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,OAAO;cACK,cAAc;CAuC9B,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -0,0 +1,40 @@
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 fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const crypto_1 = require("crypto");
9
+ const PREVIEW_FILE_PATTERN = /^[a-z0-9-]+\.jpg$/;
10
+ const PREVIEW_CACHE_CONTROL = 'public, max-age=3600, must-revalidate';
11
+ const preview = () => ({
12
+ async find(ctx) {
13
+ const file = ctx.params.file;
14
+ if (!file || !PREVIEW_FILE_PATTERN.test(file)) {
15
+ return ctx.notFound();
16
+ }
17
+ const previewPath = path_1.default.join(__dirname, '..', 'components', 'blocks', 'previews', file);
18
+ let body;
19
+ try {
20
+ body = await fs_1.default.promises.readFile(previewPath);
21
+ }
22
+ catch (error) {
23
+ if (error.code === 'ENOENT') {
24
+ return ctx.notFound();
25
+ }
26
+ throw error;
27
+ }
28
+ ctx.type = 'image/jpeg';
29
+ ctx.set('Cache-Control', PREVIEW_CACHE_CONTROL);
30
+ ctx.set('ETag', `"${(0, crypto_1.createHash)('sha256').update(body).digest('base64url')}"`);
31
+ ctx.body = body;
32
+ if (ctx.fresh) {
33
+ ctx.status = 304;
34
+ ctx.body = null;
35
+ return;
36
+ }
37
+ },
38
+ });
39
+ exports.default = preview;
40
+ //# sourceMappingURL=preview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../../server/src/controllers/preview.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,mCAAoC;AAIpC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACjD,MAAM,qBAAqB,GAAG,uCAAuC,CAAC;AAQtE,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC;IACrB,KAAK,CAAC,IAAI,CAAC,GAAmB;QAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC7B,IAAI,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC;QAED,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAC3B,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,IAAI,CACL,CAAC;QAEF,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACvD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,GAAG,CAAC,IAAI,GAAG,YAAY,CAAC;QACxB,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;QAChD,GAAG,CAAC,GAAG,CACL,MAAM,EACN,IAAI,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAC7D,CAAC;QACF,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAEhB,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;YACjB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;YAChB,OAAO;QACT,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Core } from '@strapi/strapi';
2
+ export declare function registerBuilderMcp(strapi: Core.Strapi): void;
3
+ export { buildBlockSchemaCatalog, buildBlocksInputSchema } from './schema';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAwE/C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CA8J5D;AAED,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}