@pantheon-systems/p1-media 0.4.4 → 0.4.5
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/dist/index.d.mts +11 -14
- package/dist/index.d.ts +11 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +8 -11
- package/dist/server.d.ts +8 -11
- package/dist/server.js.map +1 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -58,7 +58,7 @@ interface MediaConfig {
|
|
|
58
58
|
type GetAuthToken = () => Promise<string | null> | string | null;
|
|
59
59
|
|
|
60
60
|
interface MediaPluginOptions {
|
|
61
|
-
/** The base URL of the
|
|
61
|
+
/** The base URL of the media API. Defaults to the production host. */
|
|
62
62
|
workerUrl?: string;
|
|
63
63
|
/**
|
|
64
64
|
* Site identifier used to scope media to a specific site. Defaults to the
|
|
@@ -68,7 +68,7 @@ interface MediaPluginOptions {
|
|
|
68
68
|
siteId?: string;
|
|
69
69
|
/**
|
|
70
70
|
* Workstream (branch) identifier. Currently accepted for forward-compat but not
|
|
71
|
-
* read by the
|
|
71
|
+
* read by the backend for any scoping decision — omit unless a future release
|
|
72
72
|
* documents otherwise.
|
|
73
73
|
*/
|
|
74
74
|
workstreamId?: string;
|
|
@@ -89,7 +89,7 @@ interface MediaPluginOptions {
|
|
|
89
89
|
metadataFields?: MetadataFieldDef[];
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Creates a Puck plugin that adds a media library backed by Cloudflare R2
|
|
92
|
+
* Creates a Puck plugin that adds a media library backed by Cloudflare R2.
|
|
93
93
|
* It supports two field modes:
|
|
94
94
|
* - Basic: text fields matching image/media name patterns are replaced with the
|
|
95
95
|
* picker and store a clean CDN URL string. Render with `buildImageUrl()`.
|
|
@@ -145,7 +145,7 @@ interface ImageTransformParams {
|
|
|
145
145
|
quality?: number;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* Merges
|
|
148
|
+
* Merges image transform params onto a CDN image URL.
|
|
149
149
|
* Preserves any existing params in the URL — e.g. the editor's crop intent
|
|
150
150
|
* (`fit=cover&gravity=auto` for smart crop, `trim.*` for a manual crop).
|
|
151
151
|
*
|
|
@@ -158,20 +158,17 @@ interface GetMediaPropsOptions {
|
|
|
158
158
|
/**
|
|
159
159
|
* The CDN image origin that serves media, e.g.
|
|
160
160
|
* "https://staging.media.p1.pantheon.io". This is the public image host —
|
|
161
|
-
* NOT the
|
|
162
|
-
* real image URL.
|
|
161
|
+
* NOT the content API URL, whose origin would reject every real image URL.
|
|
163
162
|
*
|
|
164
|
-
* Security (required): a value's `url` is untrusted document content —
|
|
165
|
-
* who can edit a document
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* server-fetching `next/image`). getMediaProps therefore rejects any url that
|
|
169
|
-
* is not `https` on this exact origin. If `mediaBaseUrl` is omitted it
|
|
163
|
+
* Security (required): a value's `url` is untrusted document content —
|
|
164
|
+
* anyone who can edit a document controls it. getMediaProps rejects any url
|
|
165
|
+
* that is not `https` on this exact origin, so an edited document can't
|
|
166
|
+
* point a render at an arbitrary origin. If `mediaBaseUrl` is omitted it
|
|
170
167
|
* **fails closed** (empty src) rather than degrading to an insecure pass-through.
|
|
171
168
|
*
|
|
172
169
|
* Local dev exception: when the configured base is itself `http` on a
|
|
173
|
-
* loopback host (`localhost`, `127.0.0.1`, `[::1]`
|
|
174
|
-
*
|
|
170
|
+
* loopback host (`localhost`, `127.0.0.1`, `[::1]`), same-origin `http`
|
|
171
|
+
* urls are allowed so rich values render locally.
|
|
175
172
|
*/
|
|
176
173
|
mediaBaseUrl?: string;
|
|
177
174
|
/** Transform params merged onto the validated URL (width, height, format, quality). */
|
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ interface MediaConfig {
|
|
|
58
58
|
type GetAuthToken = () => Promise<string | null> | string | null;
|
|
59
59
|
|
|
60
60
|
interface MediaPluginOptions {
|
|
61
|
-
/** The base URL of the
|
|
61
|
+
/** The base URL of the media API. Defaults to the production host. */
|
|
62
62
|
workerUrl?: string;
|
|
63
63
|
/**
|
|
64
64
|
* Site identifier used to scope media to a specific site. Defaults to the
|
|
@@ -68,7 +68,7 @@ interface MediaPluginOptions {
|
|
|
68
68
|
siteId?: string;
|
|
69
69
|
/**
|
|
70
70
|
* Workstream (branch) identifier. Currently accepted for forward-compat but not
|
|
71
|
-
* read by the
|
|
71
|
+
* read by the backend for any scoping decision — omit unless a future release
|
|
72
72
|
* documents otherwise.
|
|
73
73
|
*/
|
|
74
74
|
workstreamId?: string;
|
|
@@ -89,7 +89,7 @@ interface MediaPluginOptions {
|
|
|
89
89
|
metadataFields?: MetadataFieldDef[];
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Creates a Puck plugin that adds a media library backed by Cloudflare R2
|
|
92
|
+
* Creates a Puck plugin that adds a media library backed by Cloudflare R2.
|
|
93
93
|
* It supports two field modes:
|
|
94
94
|
* - Basic: text fields matching image/media name patterns are replaced with the
|
|
95
95
|
* picker and store a clean CDN URL string. Render with `buildImageUrl()`.
|
|
@@ -145,7 +145,7 @@ interface ImageTransformParams {
|
|
|
145
145
|
quality?: number;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* Merges
|
|
148
|
+
* Merges image transform params onto a CDN image URL.
|
|
149
149
|
* Preserves any existing params in the URL — e.g. the editor's crop intent
|
|
150
150
|
* (`fit=cover&gravity=auto` for smart crop, `trim.*` for a manual crop).
|
|
151
151
|
*
|
|
@@ -158,20 +158,17 @@ interface GetMediaPropsOptions {
|
|
|
158
158
|
/**
|
|
159
159
|
* The CDN image origin that serves media, e.g.
|
|
160
160
|
* "https://staging.media.p1.pantheon.io". This is the public image host —
|
|
161
|
-
* NOT the
|
|
162
|
-
* real image URL.
|
|
161
|
+
* NOT the content API URL, whose origin would reject every real image URL.
|
|
163
162
|
*
|
|
164
|
-
* Security (required): a value's `url` is untrusted document content —
|
|
165
|
-
* who can edit a document
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* server-fetching `next/image`). getMediaProps therefore rejects any url that
|
|
169
|
-
* is not `https` on this exact origin. If `mediaBaseUrl` is omitted it
|
|
163
|
+
* Security (required): a value's `url` is untrusted document content —
|
|
164
|
+
* anyone who can edit a document controls it. getMediaProps rejects any url
|
|
165
|
+
* that is not `https` on this exact origin, so an edited document can't
|
|
166
|
+
* point a render at an arbitrary origin. If `mediaBaseUrl` is omitted it
|
|
170
167
|
* **fails closed** (empty src) rather than degrading to an insecure pass-through.
|
|
171
168
|
*
|
|
172
169
|
* Local dev exception: when the configured base is itself `http` on a
|
|
173
|
-
* loopback host (`localhost`, `127.0.0.1`, `[::1]`
|
|
174
|
-
*
|
|
170
|
+
* loopback host (`localhost`, `127.0.0.1`, `[::1]`), same-origin `http`
|
|
171
|
+
* urls are allowed so rich values render locally.
|
|
175
172
|
*/
|
|
176
173
|
mediaBaseUrl?: string;
|
|
177
174
|
/** Transform params merged onto the validated URL (width, height, format, quality). */
|