@dani-builder/strapi-plugin-builder 0.4.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.
- package/AGENTS.md +19 -0
- package/README.md +53 -12
- package/dist/server/src/components/blocks/bento-grid.json +1 -0
- package/dist/server/src/components/blocks/content.json +1 -0
- package/dist/server/src/components/blocks/cta.json +1 -0
- package/dist/server/src/components/blocks/faq.json +1 -0
- package/dist/server/src/components/blocks/features.json +1 -0
- package/dist/server/src/components/blocks/hero.json +1 -0
- package/dist/server/src/components/blocks/highlights.json +1 -0
- package/dist/server/src/components/blocks/inquiry-form.json +1 -0
- package/dist/server/src/components/blocks/logo-cloud.json +1 -0
- package/dist/server/src/components/blocks/previews/bento-grid.jpg +0 -0
- package/dist/server/src/components/blocks/previews/content.jpg +0 -0
- package/dist/server/src/components/blocks/previews/cta.jpg +0 -0
- package/dist/server/src/components/blocks/previews/faq.jpg +0 -0
- package/dist/server/src/components/blocks/previews/features.jpg +0 -0
- package/dist/server/src/components/blocks/previews/hero.jpg +0 -0
- package/dist/server/src/components/blocks/previews/highlights.jpg +0 -0
- package/dist/server/src/components/blocks/previews/inquiry-form.jpg +0 -0
- package/dist/server/src/components/blocks/previews/logo-cloud.jpg +0 -0
- package/dist/server/src/components/blocks/previews/pricing.jpg +0 -0
- package/dist/server/src/components/blocks/previews/slider.jpg +0 -0
- package/dist/server/src/components/blocks/previews/stats.jpg +0 -0
- package/dist/server/src/components/blocks/previews/team.jpg +0 -0
- package/dist/server/src/components/blocks/previews/testimonials.jpg +0 -0
- package/dist/server/src/components/blocks/pricing.json +1 -0
- package/dist/server/src/components/blocks/slider.json +1 -0
- package/dist/server/src/components/blocks/stats.json +1 -0
- package/dist/server/src/components/blocks/team.json +1 -0
- package/dist/server/src/components/blocks/testimonials.json +1 -0
- package/dist/server/src/config/builder.d.ts +27 -0
- package/dist/server/src/config/builder.d.ts.map +1 -0
- package/dist/server/src/config/builder.js +80 -0
- package/dist/server/src/config/builder.js.map +1 -0
- package/dist/server/src/config/index.d.ts +2 -1
- package/dist/server/src/config/index.d.ts.map +1 -1
- package/dist/server/src/config/index.js.map +1 -1
- package/dist/server/src/controllers/global.d.ts.map +1 -1
- package/dist/server/src/controllers/global.js +5 -2
- package/dist/server/src/controllers/global.js.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/index.js +2 -0
- package/dist/server/src/controllers/index.js.map +1 -1
- package/dist/server/src/controllers/page.d.ts.map +1 -1
- package/dist/server/src/controllers/page.js +7 -2
- package/dist/server/src/controllers/page.js.map +1 -1
- package/dist/server/src/controllers/preview.d.ts +13 -0
- package/dist/server/src/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/controllers/preview.js +40 -0
- package/dist/server/src/controllers/preview.js.map +1 -0
- package/dist/server/src/index.d.ts +2 -1
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/index.js.map +1 -1
- package/dist/server/src/mcp/index.d.ts +4 -0
- package/dist/server/src/mcp/index.d.ts.map +1 -0
- package/dist/server/src/mcp/index.js +170 -0
- package/dist/server/src/mcp/index.js.map +1 -0
- package/dist/server/src/mcp/schema.d.ts +32 -0
- package/dist/server/src/mcp/schema.d.ts.map +1 -0
- package/dist/server/src/mcp/schema.js +102 -0
- package/dist/server/src/mcp/schema.js.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/register.js +15 -2
- package/dist/server/src/register.js.map +1 -1
- package/dist/server/src/routes/admin.d.ts +14 -0
- package/dist/server/src/routes/admin.d.ts.map +1 -0
- package/dist/server/src/routes/admin.js +16 -0
- package/dist/server/src/routes/admin.js.map +1 -0
- package/dist/server/src/routes/content-api.d.ts +1 -1
- package/dist/server/src/routes/content-api.d.ts.map +1 -1
- package/dist/server/src/routes/content-api.js +1 -1
- package/dist/server/src/routes/content-api.js.map +1 -1
- package/dist/server/src/routes/index.d.ts +4 -3
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/routes/index.js +2 -0
- package/dist/server/src/routes/index.js.map +1 -1
- package/dist/server/src/services/populate.d.ts +7 -9
- package/dist/server/src/services/populate.d.ts.map +1 -1
- package/dist/server/src/services/populate.js +1 -1
- package/dist/server/src/services/populate.js.map +1 -1
- package/dist/server/src/types/index.d.ts +32 -0
- package/dist/server/src/types/index.d.ts.map +1 -0
- package/dist/server/src/types/index.js +3 -0
- package/dist/server/src/types/index.js.map +1 -0
- package/package.json +42 -6
- package/dist/server/src/bootstrap.test.d.ts +0 -2
- package/dist/server/src/bootstrap.test.d.ts.map +0 -1
- package/dist/server/src/bootstrap.test.js +0 -60
- package/dist/server/src/bootstrap.test.js.map +0 -1
- package/dist/server/src/config/index.test.d.ts +0 -2
- package/dist/server/src/config/index.test.d.ts.map +0 -1
- package/dist/server/src/config/index.test.js +0 -87
- package/dist/server/src/config/index.test.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -147,3 +147,22 @@ server/src/
|
|
|
147
147
|
- `@strapi/strapi` ^5.0.0
|
|
148
148
|
- `@strapi/plugin-color-picker` ^5.0.0
|
|
149
149
|
- `@d3levvv/strapi-react-icons-plugin` ^1.0.0
|
|
150
|
+
|
|
151
|
+
## Publishing Type Subpaths
|
|
152
|
+
|
|
153
|
+
When adding or changing a public type subpath in `package.json#exports`:
|
|
154
|
+
|
|
155
|
+
1. Import its public symbols through the package specifier in a Vitest type
|
|
156
|
+
test (for example, `@dani-builder/strapi-plugin-builder/types`) and assert
|
|
157
|
+
them with `expectTypeOf`.
|
|
158
|
+
2. Keep a no-emit `check-types` script so the root Turbo task compiles the
|
|
159
|
+
package source.
|
|
160
|
+
3. Run `pnpm verify:publish-tarballs` to confirm the declaration files are in
|
|
161
|
+
the published artifact.
|
|
162
|
+
4. Add a changeset when the public contract changes; verification-only changes
|
|
163
|
+
do not need one.
|
|
164
|
+
|
|
165
|
+
The `.claude/skills/builder-extender/references/` files are consumer-project
|
|
166
|
+
templates, not package source, so the package `check-types` task does not include
|
|
167
|
+
them. The public-specifier type test covers their imported Builder contract;
|
|
168
|
+
the copied template is compiled in its consumer project's Strapi context.
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
|
52
|
-
|
|
53
|
-
| GET
|
|
54
|
-
| GET
|
|
55
|
-
| GET
|
|
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
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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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AAQ,EAAE,QAAQ,CAAC;oBACnC,SAAS,EAAE;wBACT,QAAQ;wBACR,OAAO;wBACP,OAAO;wBACP,yBAAyB;wBACzB,GAAG,UAAU;qBACd;oBACD,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;oBACxD,uBAAuB,EAAE,IAAI;iBAC9B;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/config/index.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA2B9C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACrC,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/src/config/index.ts"],"names":[],"mappings":";;;;;AAAA,2FAA6D;AAC7D,qFAAwD;AACxD,6EAAgD;AAChD,6EAAgD;AAChD,uFAA0D;AAC1D,+EAAkD;AAClD,2FAA8D;AAC9D,+FAAiE;AACjE,2FAA6D;AAC7D,qFAAwD;AACxD,mFAAsD;AACtD,iFAAoD;AACpD,+EAAkD;AAClD,+FAAkE;AAClE,qFAAwD;AACxD,uFAA0D;AAC1D,yGAA2E;AAC3E,2FAA6D;AAC7D,+FAAiE;AACjE,qGAAuE;AACvE,+FAAiE;AACjE,mGAAqE;AACrE,iFAAoD;AACpD,+EAAkD;AAClD,yFAA2D;AAC3D,uGAAyE;AACzE,+FAAiE;AACjE,6EAAgD;AAChD,yGAA2E;AAC3E,6FAA+D;AAC/D,yFAA2D;AAC3D,6FAA+D;AAC/D,uGAAyE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/src/config/index.ts"],"names":[],"mappings":";;;;;AAAA,2FAA6D;AAC7D,qFAAwD;AACxD,6EAAgD;AAChD,6EAAgD;AAChD,uFAA0D;AAC1D,+EAAkD;AAClD,2FAA8D;AAC9D,+FAAiE;AACjE,2FAA6D;AAC7D,qFAAwD;AACxD,mFAAsD;AACtD,iFAAoD;AACpD,+EAAkD;AAClD,+FAAkE;AAClE,qFAAwD;AACxD,uFAA0D;AAC1D,yGAA2E;AAC3E,2FAA6D;AAC7D,+FAAiE;AACjE,qGAAuE;AACvE,+FAAiE;AACjE,mGAAqE;AACrE,iFAAoD;AACpD,+EAAkD;AAClD,yFAA2D;AAC3D,uGAAyE;AACzE,+FAAiE;AACjE,6EAAgD;AAChD,yGAA2E;AAC3E,6FAA+D;AAC/D,yFAA2D;AAC3D,6FAA+D;AAC/D,uGAAyE;AAMzE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,YAAY;IACZ,SAAS;IACT,WAAW;IACX,MAAM;IACN,UAAU;IACV,SAAS;IACT,OAAO;IACP,aAAa;IACb,OAAO;IACP,SAAS;IACT,MAAM;IACN,OAAO;IACP,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,MAAM;IACN,MAAM;IACN,WAAW;IACX,KAAK;CACN,CAAC,CAAC;AAUH,MAAM,gBAAgB,GAAiD;IACrE,mBAAmB,EAAE,yBAAS;IAC9B,gBAAgB,EAAE,sBAAO;IACzB,YAAY,EAAE,kBAAG;IACjB,YAAY,EAAE,k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CAAC,SAAS,CAAC,IAAI,CAAC,EACnC,CAAC;oBACD,MAAM,IAAI,KAAK,CACb,gCAAgC,GAAG,kBAAkB,aAAa,4BAA4B,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CACxH,CAAC;gBACJ,CAAC;gBACD,IAAI,SAAS,CAAC,QAAQ,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;oBAC7D,MAAM,IAAI,KAAK,CACb,gCAAgC,GAAG,kBAAkB,aAAa,mCAAmC;wBACnG,4FAA4F,CAC/F,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/global.ts"],"names":[],"mappings":"
|
|
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(
|
|
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
|
|
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,
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../../../server/src/controllers/global.ts"],"names":[],"mappings":";;AAAA,2CAAsD;AACtD,0CAAiD;AAQjD,MAAM,MAAM,GAAY,kBAAS,CAAC,oBAAoB,CACpD,wBAAwB,EACxB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,WAAW;QACpB,MAAM,GAAG,GAAG,WAA4B,CAAC;QACzC,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;aACxB,SAAS,CAAC,wBAAwB,CAAC;aACnC,SAAS,CAAC;YACT,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;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":"
|
|
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;AAC3C,kDAA0B;AAC1B,sDAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":";;;;;AAAA,2CAA2C;AAC3C,kDAA0B;AAC1B,sDAA8B;AAC9B,wDAAgC;AAEhC,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,EAAP,iBAAO;IACP,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/page.ts"],"names":[],"mappings":"
|
|
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(
|
|
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(
|
|
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":";;
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../server/src/controllers/page.ts"],"names":[],"mappings":";;AAqBA,8CAoBC;AAzCD,2CAAsD;AACtD,0CAAqE;AAErE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAU9B,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;IAC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} 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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":"AASA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,QAAA,MAAM,MAAM,EAAE,aASb,CAAC;AAEF,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,eAAe,MAAM,CAAC"}
|