canopycms 0.0.68-int.101 → 0.0.68-int.103
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/README.md +3 -1
- package/dist/api/client.d.ts +2 -1
- package/dist/api/client.js +2 -1
- package/dist/assets/asset-url.d.ts +6 -0
- package/dist/assets/asset-url.js +9 -0
- package/dist/auth/plugin.d.ts +1 -1
- package/dist/cli/cli.js +692 -652
- package/dist/cli/generate-ai-content.js +406 -96
- package/dist/cli/init.js +1 -80
- package/dist/config/schemas/config.d.ts +3 -0
- package/dist/config/schemas/config.js +1 -0
- package/dist/config/types.d.ts +15 -0
- package/dist/content-reader.d.ts +9 -0
- package/dist/content-reader.js +8 -4
- package/dist/content-store.d.ts +4 -0
- package/dist/content-store.js +3 -1
- package/dist/editor/Editor.js +3 -1
- package/dist/editor/FormRenderer.js +78 -9
- package/dist/editor/components/EditorCrashScreen.d.ts +17 -0
- package/dist/editor/components/EditorCrashScreen.js +22 -0
- package/dist/editor/components/EditorErrorBoundary.d.ts +38 -0
- package/dist/editor/components/EditorErrorBoundary.js +40 -0
- package/dist/editor/context/ApiClientContext.d.ts +2 -1
- package/dist/editor/context/ApiClientContext.js +2 -1
- package/dist/editor/context/AssetContext.d.ts +2 -7
- package/dist/editor/context/AssetContext.js +2 -12
- package/dist/editor/fields/FieldCrashFallback.d.ts +17 -0
- package/dist/editor/fields/FieldCrashFallback.js +30 -0
- package/dist/editor/fields/ImageField.js +8 -5
- package/dist/editor/fields/MarkdownField.d.ts +21 -0
- package/dist/editor/fields/MarkdownField.js +51 -19
- package/dist/editor/fields/markdown-export-options.d.ts +2 -0
- package/dist/editor/fields/markdown-export-options.js +8 -0
- package/dist/editor/fields/mdx-jsx-support.d.ts +5 -1
- package/dist/editor/fields/mdx-jsx-support.js +74 -70
- package/dist/editor/fields/rich-text-failures.d.ts +5 -0
- package/dist/editor/fields/rich-text-failures.js +26 -0
- package/dist/editor/hooks/useEntryManager.js +19 -5
- package/dist/editor/media/AssetCard.d.ts +2 -5
- package/dist/editor/media/AssetCard.js +4 -7
- package/dist/editor/media/editor-image-src.d.ts +6 -5
- package/dist/editor/media/editor-image-src.js +7 -9
- package/dist/editor/preview-asset-base.d.ts +5 -4
- package/dist/editor/preview-asset-base.js +9 -5
- package/dist/editor/preview-bridge.d.ts +8 -0
- package/dist/editor/preview-bridge.js +22 -6
- package/dist/editor/raw-asset-base.d.ts +5 -0
- package/dist/editor/raw-asset-base.js +14 -0
- package/dist/editor/utils/editor-errors.d.ts +19 -0
- package/dist/editor/utils/editor-errors.js +32 -0
- package/dist/http/handler.js +7 -2
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +1 -1
- package/dist/server.d.ts +9 -0
- package/dist/server.js +9 -0
- package/dist/url-exclusivity-fixtures.d.ts +7 -0
- package/dist/url-exclusivity-fixtures.js +10 -0
- package/dist/utils/content-serialize.d.ts +7 -5
- package/dist/utils/content-serialize.js +58 -9
- package/dist/utils/error.js +6 -2
- package/dist/utils/markdown-body-splice.d.ts +39 -0
- package/dist/utils/markdown-body-splice.js +421 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -1
package/README.md
CHANGED
|
@@ -637,7 +637,9 @@ media: { adapter: 's3', bucket: 'my-site-assets', region: 'us-east-1' }
|
|
|
637
637
|
|
|
638
638
|
Passing an `image` field value applies its stored crop (`opts.crop` overrides it). Its `width`
|
|
639
639
|
and `height` are the uncropped original's, so scale them by `crop.w` and `crop.h` for a cropped
|
|
640
|
-
value. SVGs and PDFs are served statically, with no transform.
|
|
640
|
+
value. SVGs and PDFs are served statically, with no transform. The package declares
|
|
641
|
+
`sideEffects`, so this import adds under 7 KB minified to a client bundle and none of the
|
|
642
|
+
config schemas.
|
|
641
643
|
|
|
642
644
|
- **Where `/assets` is mounted** — the URLs above are root-relative, because that is what gets
|
|
643
645
|
stored in content and content moves between branches and environments. If your renderer sees
|
package/dist/api/client.d.ts
CHANGED
|
@@ -32,7 +32,8 @@ export interface ApiClientOptions {
|
|
|
32
32
|
*/
|
|
33
33
|
trailingSlash?: boolean;
|
|
34
34
|
/**
|
|
35
|
-
* Called whenever a response
|
|
35
|
+
* Called whenever a response says the credential is no longer accepted: HTTP 401, or a
|
|
36
|
+
* handler's body with `status: 401` under the HTTP status `unauthenticatedStatus` chose. A
|
|
36
37
|
* notification, not a retry; the editor's auth gate uses it to show sign-in.
|
|
37
38
|
*/
|
|
38
39
|
onUnauthorized?: () => void;
|
package/dist/api/client.js
CHANGED
|
@@ -341,7 +341,8 @@ export class CanopyApiClient {
|
|
|
341
341
|
response = await this.fetchFn(url, init);
|
|
342
342
|
parsed = await response.json().catch(() => undefined);
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
// The body's status is the signal: `unauthenticatedStatus` may send it under HTTP 419.
|
|
345
|
+
if (response.status === 401 || (isApiResponseBody(parsed) && parsed.status === 401)) {
|
|
345
346
|
this.onUnauthorized?.();
|
|
346
347
|
return { ok: false, status: 401, error: errorFromBody(parsed) ?? 'Unauthorized' };
|
|
347
348
|
}
|
|
@@ -41,6 +41,12 @@ export interface AssetUrlOptions {
|
|
|
41
41
|
*/
|
|
42
42
|
baseUrl?: string;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether `src` is in canopycms's own `/assets` URL space - a transform or static asset src the
|
|
46
|
+
* asset store serves. Every other src (a site's own static file, an off-site URL, a `data:` URI)
|
|
47
|
+
* is the host's, and the asset store never serves it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isAssetStoreSrc(src: string): boolean;
|
|
44
50
|
/**
|
|
45
51
|
* Build a transform URL, merging `opts` and `ref.crop` over the directives already present
|
|
46
52
|
* in `ref.src` (see `mergeDirectives` for precedence). For static srcs (svg/pdf under
|
package/dist/assets/asset-url.js
CHANGED
|
@@ -9,6 +9,15 @@ import { getPreviewAssetBase } from '../editor/preview-asset-base.js';
|
|
|
9
9
|
import { ASSET_PREFIXES } from './asset-prefixes.js';
|
|
10
10
|
import { formatDirectives, isAllowedTransformWidth, parseTransformPath, } from './transform-directives.js';
|
|
11
11
|
const TRANSFORM_URL_PREFIX = `/${ASSET_PREFIXES.transform}/`;
|
|
12
|
+
const ASSET_SPACE_PREFIX = `/${ASSET_PREFIXES.public}/`;
|
|
13
|
+
/**
|
|
14
|
+
* Whether `src` is in canopycms's own `/assets` URL space - a transform or static asset src the
|
|
15
|
+
* asset store serves. Every other src (a site's own static file, an off-site URL, a `data:` URI)
|
|
16
|
+
* is the host's, and the asset store never serves it.
|
|
17
|
+
*/
|
|
18
|
+
export function isAssetStoreSrc(src) {
|
|
19
|
+
return src.startsWith(ASSET_SPACE_PREFIX);
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* Test-only. A function stored on `globalThis` under this symbol is called with every URL
|
|
14
23
|
* `assetUrl` returns; the dual-build fixture installs one during a static export to prove
|
package/dist/auth/plugin.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface AuthPlugin {
|
|
|
14
14
|
* groups; core applies bootstrap admins.
|
|
15
15
|
*
|
|
16
16
|
* CREDENTIAL failures (missing, invalid or expired token) RESOLVE to
|
|
17
|
-
* `{ success: false }` and map to
|
|
17
|
+
* `{ success: false }` and map to `unauthenticatedStatus` (default 401). CONFIGURATION errors (an absent
|
|
18
18
|
* CLERK_SECRET_KEY, say) may THROW instead: they are operator mistakes, and
|
|
19
19
|
* belong in a loud 500 rather than a quiet auth denial. A custom adapter
|
|
20
20
|
* calling this directly must be ready for that rejection.
|