canopycms 0.0.63 → 0.0.65
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 +153 -19
- package/dist/ai/generate.d.ts +4 -5
- package/dist/ai/generate.js +0 -1
- package/dist/ai/handler.d.ts +3 -4
- package/dist/ai/handler.js +0 -1
- package/dist/ai/index.d.ts +7 -8
- package/dist/ai/index.js +0 -1
- package/dist/ai/json-to-markdown.d.ts +1 -2
- package/dist/ai/json-to-markdown.js +11 -2
- package/dist/ai/resolve-branch.d.ts +1 -2
- package/dist/ai/resolve-branch.js +0 -1
- package/dist/ai/strip-mdx.d.ts +0 -1
- package/dist/ai/strip-mdx.js +0 -1
- package/dist/ai/to-plain-text.d.ts +4 -1
- package/dist/ai/to-plain-text.js +47 -1
- package/dist/ai/transform-components.d.ts +1 -2
- package/dist/ai/transform-components.js +0 -1
- package/dist/ai/types.d.ts +1 -2
- package/dist/ai/types.js +0 -1
- package/dist/api/admin-branch-health.d.ts +7 -8
- package/dist/api/admin-branch-health.js +0 -1
- package/dist/api/admin.d.ts +16 -17
- package/dist/api/admin.js +0 -1
- package/dist/api/assets.d.ts +8 -9
- package/dist/api/assets.js +9 -1
- package/dist/api/branch-merge.d.ts +3 -4
- package/dist/api/branch-merge.js +0 -1
- package/dist/api/branch-review.d.ts +5 -6
- package/dist/api/branch-review.js +0 -1
- package/dist/api/branch-status.d.ts +15 -16
- package/dist/api/branch-status.js +0 -1
- package/dist/api/branch-withdraw.d.ts +3 -4
- package/dist/api/branch-withdraw.js +0 -1
- package/dist/api/branch.d.ts +13 -14
- package/dist/api/branch.js +0 -1
- package/dist/api/client.d.ts +14 -15
- package/dist/api/client.js +0 -1
- package/dist/api/comments.d.ts +11 -12
- package/dist/api/comments.js +0 -1
- package/dist/api/content.d.ts +22 -24
- package/dist/api/content.js +132 -18
- package/dist/api/entries-constants.d.ts +0 -1
- package/dist/api/entries-constants.js +0 -1
- package/dist/api/entries.d.ts +12 -13
- package/dist/api/entries.js +12 -2
- package/dist/api/github-sync.d.ts +2 -3
- package/dist/api/github-sync.js +0 -1
- package/dist/api/groups.d.ts +6 -7
- package/dist/api/groups.js +0 -1
- package/dist/api/guards.d.ts +2 -3
- package/dist/api/guards.js +0 -1
- package/dist/api/index.d.ts +18 -19
- package/dist/api/index.js +0 -1
- package/dist/api/permissions.d.ts +10 -11
- package/dist/api/permissions.js +0 -1
- package/dist/api/reference-options.d.ts +3 -4
- package/dist/api/reference-options.js +0 -1
- package/dist/api/request-body-hash.d.ts +0 -1
- package/dist/api/request-body-hash.js +0 -1
- package/dist/api/resolve-references.d.ts +6 -7
- package/dist/api/resolve-references.js +24 -6
- package/dist/api/route-builder.d.ts +2 -3
- package/dist/api/route-builder.js +0 -1
- package/dist/api/schema.d.ts +43 -44
- package/dist/api/schema.js +0 -1
- package/dist/api/settings-helpers.d.ts +2 -3
- package/dist/api/settings-helpers.js +0 -1
- package/dist/api/types.d.ts +6 -7
- package/dist/api/types.js +0 -1
- package/dist/api/user.d.ts +2 -3
- package/dist/api/user.js +0 -1
- package/dist/api/validators.d.ts +3 -4
- package/dist/api/validators.js +0 -1
- package/dist/assets/asset-prefixes.d.ts +1 -2
- package/dist/assets/asset-prefixes.js +0 -1
- package/dist/assets/asset-src.d.ts +17 -5
- package/dist/assets/asset-src.js +15 -3
- package/dist/assets/asset-url.d.ts +28 -7
- package/dist/assets/asset-url.js +20 -15
- package/dist/assets/factory.d.ts +2 -3
- package/dist/assets/factory.js +0 -2
- package/dist/assets/finalize.d.ts +2 -3
- package/dist/assets/finalize.js +0 -1
- package/dist/assets/index.d.ts +12 -13
- package/dist/assets/index.js +0 -1
- package/dist/assets/keys.d.ts +1 -2
- package/dist/assets/keys.js +0 -1
- package/dist/assets/pipeline.d.ts +1 -2
- package/dist/assets/pipeline.js +0 -1
- package/dist/assets/store-local.d.ts +1 -2
- package/dist/assets/store-local.js +0 -1
- package/dist/assets/store-s3.d.ts +2 -4
- package/dist/assets/store-s3.js +0 -1
- package/dist/assets/svg-sanitizer.d.ts +0 -1
- package/dist/assets/svg-sanitizer.js +0 -1
- package/dist/assets/transform-directives.d.ts +0 -1
- package/dist/assets/transform-directives.js +0 -1
- package/dist/assets/transform.d.ts +1 -2
- package/dist/assets/transform.js +0 -1
- package/dist/assets/types.d.ts +0 -1
- package/dist/assets/types.js +0 -1
- package/dist/auth/cache.d.ts +2 -3
- package/dist/auth/cache.js +0 -1
- package/dist/auth/caching-auth-plugin.d.ts +3 -4
- package/dist/auth/caching-auth-plugin.js +0 -1
- package/dist/auth/context-helpers.d.ts +1 -2
- package/dist/auth/context-helpers.js +0 -1
- package/dist/auth/file-based-auth-cache.d.ts +3 -4
- package/dist/auth/file-based-auth-cache.js +14 -3
- package/dist/auth/index.d.ts +6 -7
- package/dist/auth/index.js +0 -1
- package/dist/auth/plugin.d.ts +3 -4
- package/dist/auth/plugin.js +0 -1
- package/dist/auth/types.d.ts +1 -2
- package/dist/auth/types.js +0 -1
- package/dist/authorization/branch.d.ts +4 -5
- package/dist/authorization/branch.js +0 -1
- package/dist/authorization/content.d.ts +6 -7
- package/dist/authorization/content.js +0 -1
- package/dist/authorization/groups/index.d.ts +2 -3
- package/dist/authorization/groups/index.js +0 -1
- package/dist/authorization/groups/loader.d.ts +3 -4
- package/dist/authorization/groups/loader.js +0 -1
- package/dist/authorization/groups/schema.d.ts +1 -2
- package/dist/authorization/groups/schema.js +0 -1
- package/dist/authorization/helpers.d.ts +0 -1
- package/dist/authorization/helpers.js +0 -1
- package/dist/authorization/index.d.ts +11 -12
- package/dist/authorization/index.js +0 -1
- package/dist/authorization/path.d.ts +4 -5
- package/dist/authorization/path.js +0 -1
- package/dist/authorization/permissions/index.d.ts +2 -3
- package/dist/authorization/permissions/index.js +0 -1
- package/dist/authorization/permissions/loader.d.ts +4 -5
- package/dist/authorization/permissions/loader.js +0 -1
- package/dist/authorization/permissions/schema.d.ts +2 -3
- package/dist/authorization/permissions/schema.js +0 -1
- package/dist/authorization/protected-branch.d.ts +2 -3
- package/dist/authorization/protected-branch.js +0 -1
- package/dist/authorization/settings-file-store.d.ts +1 -2
- package/dist/authorization/settings-file-store.js +0 -1
- package/dist/authorization/types.d.ts +6 -7
- package/dist/authorization/types.js +0 -1
- package/dist/authorization/validation.d.ts +1 -2
- package/dist/authorization/validation.js +0 -1
- package/dist/branch-health.d.ts +22 -3
- package/dist/branch-health.js +6 -2
- package/dist/branch-metadata.d.ts +2 -3
- package/dist/branch-metadata.js +0 -1
- package/dist/branch-registry.d.ts +1 -2
- package/dist/branch-registry.js +0 -1
- package/dist/branch-schema-cache.d.ts +4 -5
- package/dist/branch-schema-cache.js +0 -1
- package/dist/branch-workspace.d.ts +4 -5
- package/dist/branch-workspace.js +0 -1
- package/dist/build/generate-ai-content.d.ts +21 -5
- package/dist/build/generate-ai-content.js +98 -6
- package/dist/build/index.d.ts +2 -3
- package/dist/build/index.js +0 -1
- package/dist/build-canopy.d.ts +5 -6
- package/dist/build-canopy.js +0 -1
- package/dist/build-mode.d.ts +1 -2
- package/dist/build-mode.js +0 -1
- package/dist/cli/cli.d.ts +18 -2
- package/dist/cli/cli.js +1172 -490
- package/dist/cli/generate-ai-content.d.ts +0 -1
- package/dist/cli/generate-ai-content.js +1000 -360
- package/dist/cli/init.d.ts +1 -2
- package/dist/cli/init.js +43 -6
- package/dist/cli/migrate.d.ts +5 -3
- package/dist/cli/migrate.js +5 -3
- package/dist/cli/project-detect.d.ts +5 -2
- package/dist/cli/project-detect.js +5 -1
- package/dist/cli/project-root.d.ts +0 -1
- package/dist/cli/project-root.js +0 -1
- package/dist/cli/sync.d.ts +0 -1
- package/dist/cli/sync.js +0 -1
- package/dist/cli/template-files/Dockerfile.cms.template +8 -2
- package/dist/cli/template-files/cms-stack.ts.template +33 -6
- package/dist/cli/template-files/deploy-cms.yml.template +29 -14
- package/dist/cli/templates.d.ts +0 -1
- package/dist/cli/templates.js +0 -1
- package/dist/client.d.ts +13 -14
- package/dist/client.js +0 -1
- package/dist/comment-store.d.ts +0 -1
- package/dist/comment-store.js +0 -1
- package/dist/config/flatten.d.ts +1 -2
- package/dist/config/flatten.js +0 -1
- package/dist/config/helpers.d.ts +3 -4
- package/dist/config/helpers.js +2 -2
- package/dist/config/index.d.ts +10 -11
- package/dist/config/index.js +0 -1
- package/dist/config/schemas/collection.d.ts +0 -1
- package/dist/config/schemas/collection.js +0 -1
- package/dist/config/schemas/config.d.ts +7 -4
- package/dist/config/schemas/config.js +12 -1
- package/dist/config/schemas/field.d.ts +3 -1
- package/dist/config/schemas/field.js +5 -1
- package/dist/config/schemas/media.d.ts +0 -1
- package/dist/config/schemas/media.js +0 -1
- package/dist/config/schemas/permissions.d.ts +0 -1
- package/dist/config/schemas/permissions.js +0 -1
- package/dist/config/types.d.ts +55 -9
- package/dist/config/types.js +0 -1
- package/dist/config/validation.d.ts +1 -2
- package/dist/config/validation.js +0 -1
- package/dist/config.d.ts +2 -3
- package/dist/config.js +0 -1
- package/dist/content-id-index.d.ts +1 -2
- package/dist/content-id-index.js +0 -1
- package/dist/content-index-generation.d.ts +0 -1
- package/dist/content-index-generation.js +0 -1
- package/dist/content-index-registry.d.ts +0 -1
- package/dist/content-index-registry.js +0 -1
- package/dist/content-listing.d.ts +75 -59
- package/dist/content-listing.js +76 -83
- package/dist/content-reader.d.ts +4 -5
- package/dist/content-reader.js +22 -3
- package/dist/content-store.d.ts +137 -6
- package/dist/content-store.js +294 -22
- package/dist/content-tree.d.ts +15 -5
- package/dist/content-tree.js +27 -8
- package/dist/context.d.ts +9 -6
- package/dist/context.js +0 -1
- package/dist/dev-content-watcher.d.ts +12 -3
- package/dist/dev-content-watcher.js +120 -30
- package/dist/editor/BranchManager.d.ts +4 -5
- package/dist/editor/BranchManager.js +0 -1
- package/dist/editor/CanopyEditor.d.ts +2 -3
- package/dist/editor/CanopyEditor.js +1 -2
- package/dist/editor/CanopyEditorPage.d.ts +2 -3
- package/dist/editor/CanopyEditorPage.js +0 -1
- package/dist/editor/CommentsPanel.d.ts +2 -3
- package/dist/editor/CommentsPanel.js +0 -1
- package/dist/editor/Editor.d.ts +13 -8
- package/dist/editor/Editor.js +4 -5
- package/dist/editor/EditorPanes.d.ts +0 -1
- package/dist/editor/EditorPanes.js +0 -1
- package/dist/editor/EntryNavigator.d.ts +1 -2
- package/dist/editor/EntryNavigator.js +0 -1
- package/dist/editor/FormRenderer.d.ts +2 -3
- package/dist/editor/FormRenderer.js +22 -3
- package/dist/editor/GroupManager.d.ts +2 -3
- package/dist/editor/GroupManager.js +0 -1
- package/dist/editor/PermissionManager.d.ts +2 -3
- package/dist/editor/PermissionManager.js +0 -1
- package/dist/editor/admin/SystemHealthPanel.d.ts +0 -1
- package/dist/editor/admin/SystemHealthPanel.js +0 -1
- package/dist/editor/admin/useSystemHealth.d.ts +2 -3
- package/dist/editor/admin/useSystemHealth.js +0 -1
- package/dist/editor/canopy-path.d.ts +0 -1
- package/dist/editor/canopy-path.js +0 -1
- package/dist/editor/client-reference-resolver.d.ts +13 -4
- package/dist/editor/client-reference-resolver.js +18 -8
- package/dist/editor/comments/BranchComments.d.ts +2 -3
- package/dist/editor/comments/BranchComments.js +0 -1
- package/dist/editor/comments/EntryComments.d.ts +1 -2
- package/dist/editor/comments/EntryComments.js +0 -1
- package/dist/editor/comments/FieldWrapper.d.ts +1 -2
- package/dist/editor/comments/FieldWrapper.js +0 -1
- package/dist/editor/comments/InlineCommentThread.d.ts +2 -3
- package/dist/editor/comments/InlineCommentThread.js +0 -1
- package/dist/editor/comments/ThreadCarousel.d.ts +2 -3
- package/dist/editor/comments/ThreadCarousel.js +0 -1
- package/dist/editor/components/ConfirmDeleteModal.d.ts +0 -1
- package/dist/editor/components/ConfirmDeleteModal.js +0 -1
- package/dist/editor/components/EditorFooter.d.ts +0 -1
- package/dist/editor/components/EditorFooter.js +0 -1
- package/dist/editor/components/EditorHeader.d.ts +4 -5
- package/dist/editor/components/EditorHeader.js +0 -1
- package/dist/editor/components/EditorSidebar.d.ts +1 -2
- package/dist/editor/components/EditorSidebar.js +0 -1
- package/dist/editor/components/EntryCreateModal.d.ts +0 -1
- package/dist/editor/components/EntryCreateModal.js +21 -10
- package/dist/editor/components/RenameEntryModal.d.ts +0 -1
- package/dist/editor/components/RenameEntryModal.js +0 -1
- package/dist/editor/components/UserBadge.d.ts +2 -3
- package/dist/editor/components/UserBadge.js +0 -1
- package/dist/editor/components/index.d.ts +3 -4
- package/dist/editor/components/index.js +0 -1
- package/dist/editor/context/ApiClientContext.d.ts +9 -3
- package/dist/editor/context/ApiClientContext.js +8 -4
- package/dist/editor/context/AssetContext.d.ts +26 -2
- package/dist/editor/context/AssetContext.js +23 -3
- package/dist/editor/context/EditorStateContext.d.ts +1 -2
- package/dist/editor/context/EditorStateContext.js +0 -1
- package/dist/editor/context/SWRProvider.d.ts +0 -1
- package/dist/editor/context/SWRProvider.js +0 -1
- package/dist/editor/context/index.d.ts +4 -5
- package/dist/editor/context/index.js +0 -1
- package/dist/editor/editor-config.d.ts +2 -3
- package/dist/editor/editor-config.js +0 -1
- package/dist/editor/editor-utils.d.ts +22 -10
- package/dist/editor/editor-utils.js +41 -10
- package/dist/editor/fields/BlockField.d.ts +1 -2
- package/dist/editor/fields/BlockField.js +0 -1
- package/dist/editor/fields/CodeField.d.ts +0 -1
- package/dist/editor/fields/CodeField.js +0 -1
- package/dist/editor/fields/DateTimeField.d.ts +0 -1
- package/dist/editor/fields/DateTimeField.js +0 -1
- package/dist/editor/fields/ImageField.d.ts +1 -2
- package/dist/editor/fields/ImageField.js +0 -1
- package/dist/editor/fields/InlineGroupField.d.ts +2 -3
- package/dist/editor/fields/InlineGroupField.js +0 -1
- package/dist/editor/fields/MarkdownField.d.ts +0 -1
- package/dist/editor/fields/MarkdownField.js +0 -1
- package/dist/editor/fields/MdxImageDialog.d.ts +0 -1
- package/dist/editor/fields/MdxImageDialog.js +0 -1
- package/dist/editor/fields/NumberField.d.ts +0 -1
- package/dist/editor/fields/NumberField.js +0 -1
- package/dist/editor/fields/NumberListField.d.ts +0 -1
- package/dist/editor/fields/NumberListField.js +0 -1
- package/dist/editor/fields/ObjectField.d.ts +11 -2
- package/dist/editor/fields/ObjectField.js +3 -4
- package/dist/editor/fields/ReferenceField.d.ts +0 -1
- package/dist/editor/fields/ReferenceField.js +8 -3
- package/dist/editor/fields/SelectField.d.ts +0 -1
- package/dist/editor/fields/SelectField.js +0 -1
- package/dist/editor/fields/StringListField.d.ts +0 -1
- package/dist/editor/fields/StringListField.js +0 -1
- package/dist/editor/fields/TextField.d.ts +0 -1
- package/dist/editor/fields/TextField.js +0 -1
- package/dist/editor/fields/ToggleField.d.ts +0 -1
- package/dist/editor/fields/ToggleField.js +0 -1
- package/dist/editor/fields/entry-link/EntryLinkContext.d.ts +1 -2
- package/dist/editor/fields/entry-link/EntryLinkContext.js +0 -1
- package/dist/editor/fields/entry-link/InsertEntryLink.d.ts +0 -1
- package/dist/editor/fields/entry-link/InsertEntryLink.js +0 -1
- package/dist/editor/fields/entry-link/index.d.ts +2 -3
- package/dist/editor/fields/entry-link/index.js +0 -1
- package/dist/editor/group-manager/ExternalGroupsTab.d.ts +1 -2
- package/dist/editor/group-manager/ExternalGroupsTab.js +0 -1
- package/dist/editor/group-manager/GroupCard.d.ts +1 -2
- package/dist/editor/group-manager/GroupCard.js +0 -1
- package/dist/editor/group-manager/GroupForm.d.ts +1 -2
- package/dist/editor/group-manager/GroupForm.js +0 -1
- package/dist/editor/group-manager/InternalGroupsTab.d.ts +1 -2
- package/dist/editor/group-manager/InternalGroupsTab.js +0 -1
- package/dist/editor/group-manager/MemberList.d.ts +1 -2
- package/dist/editor/group-manager/MemberList.js +0 -1
- package/dist/editor/group-manager/hooks/useExternalGroupSearch.d.ts +1 -2
- package/dist/editor/group-manager/hooks/useExternalGroupSearch.js +0 -1
- package/dist/editor/group-manager/hooks/useGroupState.d.ts +1 -2
- package/dist/editor/group-manager/hooks/useGroupState.js +0 -1
- package/dist/editor/group-manager/hooks/useUserSearch.d.ts +1 -2
- package/dist/editor/group-manager/hooks/useUserSearch.js +0 -1
- package/dist/editor/group-manager/index.d.ts +5 -6
- package/dist/editor/group-manager/index.js +0 -1
- package/dist/editor/group-manager/types.d.ts +4 -5
- package/dist/editor/group-manager/types.js +0 -1
- package/dist/editor/hooks/index.d.ts +14 -15
- package/dist/editor/hooks/index.js +0 -1
- package/dist/editor/hooks/useBranchActions.d.ts +0 -1
- package/dist/editor/hooks/useBranchActions.js +0 -1
- package/dist/editor/hooks/useBranchManager.d.ts +4 -5
- package/dist/editor/hooks/useBranchManager.js +0 -1
- package/dist/editor/hooks/useBranchesData.d.ts +2 -3
- package/dist/editor/hooks/useBranchesData.js +0 -1
- package/dist/editor/hooks/useCommentSystem.d.ts +2 -3
- package/dist/editor/hooks/useCommentSystem.js +0 -1
- package/dist/editor/hooks/useCommentsData.d.ts +2 -3
- package/dist/editor/hooks/useCommentsData.js +0 -1
- package/dist/editor/hooks/useDraftManager.d.ts +3 -4
- package/dist/editor/hooks/useDraftManager.js +0 -1
- package/dist/editor/hooks/useEditorLayout.d.ts +1 -2
- package/dist/editor/hooks/useEditorLayout.js +0 -1
- package/dist/editor/hooks/useEntriesData.d.ts +3 -5
- package/dist/editor/hooks/useEntriesData.js +0 -3
- package/dist/editor/hooks/useEntryLinkResolution.d.ts +2 -3
- package/dist/editor/hooks/useEntryLinkResolution.js +0 -1
- package/dist/editor/hooks/useEntryManager.d.ts +5 -7
- package/dist/editor/hooks/useEntryManager.js +8 -3
- package/dist/editor/hooks/useGroupManager.d.ts +2 -3
- package/dist/editor/hooks/useGroupManager.js +0 -1
- package/dist/editor/hooks/usePermissionManager.d.ts +2 -3
- package/dist/editor/hooks/usePermissionManager.js +0 -1
- package/dist/editor/hooks/useReferenceResolution.d.ts +1 -2
- package/dist/editor/hooks/useReferenceResolution.js +8 -3
- package/dist/editor/hooks/useSchemaManager.d.ts +2 -3
- package/dist/editor/hooks/useSchemaManager.js +0 -1
- package/dist/editor/hooks/useUserContext.d.ts +1 -2
- package/dist/editor/hooks/useUserContext.js +8 -3
- package/dist/editor/hooks/useUserMetadata.d.ts +2 -3
- package/dist/editor/hooks/useUserMetadata.js +0 -1
- package/dist/editor/media/AssetCard.d.ts +1 -2
- package/dist/editor/media/AssetCard.js +0 -1
- package/dist/editor/media/CropStep.d.ts +1 -2
- package/dist/editor/media/CropStep.js +0 -1
- package/dist/editor/media/MediaLibrary.d.ts +1 -2
- package/dist/editor/media/MediaLibrary.js +0 -1
- package/dist/editor/media/MediaLibraryBody.d.ts +1 -2
- package/dist/editor/media/MediaLibraryBody.js +0 -1
- package/dist/editor/media/crop-math.d.ts +1 -2
- package/dist/editor/media/crop-math.js +0 -1
- package/dist/editor/media/upload-asset.d.ts +2 -3
- package/dist/editor/media/upload-asset.js +0 -1
- package/dist/editor/media/upload-constants.d.ts +0 -1
- package/dist/editor/media/upload-constants.js +0 -1
- package/dist/editor/media/useAssetUpload.d.ts +1 -2
- package/dist/editor/media/useAssetUpload.js +0 -1
- package/dist/editor/media/xhr-upload.d.ts +0 -1
- package/dist/editor/media/xhr-upload.js +0 -1
- package/dist/editor/permission-manager/GroupSelector.d.ts +1 -2
- package/dist/editor/permission-manager/GroupSelector.js +0 -1
- package/dist/editor/permission-manager/PermissionEditor.d.ts +1 -2
- package/dist/editor/permission-manager/PermissionEditor.js +0 -1
- package/dist/editor/permission-manager/PermissionLevelBadge.d.ts +1 -2
- package/dist/editor/permission-manager/PermissionLevelBadge.js +0 -1
- package/dist/editor/permission-manager/PermissionTree.d.ts +1 -2
- package/dist/editor/permission-manager/PermissionTree.js +0 -1
- package/dist/editor/permission-manager/UserSelector.d.ts +1 -2
- package/dist/editor/permission-manager/UserSelector.js +0 -1
- package/dist/editor/permission-manager/constants.d.ts +1 -2
- package/dist/editor/permission-manager/constants.js +0 -1
- package/dist/editor/permission-manager/hooks/useGroupsAndUsers.d.ts +1 -2
- package/dist/editor/permission-manager/hooks/useGroupsAndUsers.js +0 -1
- package/dist/editor/permission-manager/hooks/usePermissionTree.d.ts +2 -3
- package/dist/editor/permission-manager/hooks/usePermissionTree.js +0 -1
- package/dist/editor/permission-manager/index.d.ts +4 -5
- package/dist/editor/permission-manager/index.js +0 -1
- package/dist/editor/permission-manager/types.d.ts +3 -4
- package/dist/editor/permission-manager/types.js +0 -1
- package/dist/editor/permission-manager/utils.d.ts +2 -3
- package/dist/editor/permission-manager/utils.js +0 -1
- package/dist/editor/preview-bridge.d.ts +1 -2
- package/dist/editor/preview-bridge.js +0 -1
- package/dist/editor/relative-time.d.ts +0 -1
- package/dist/editor/relative-time.js +0 -1
- package/dist/editor/schema-editor/CollectionEditor.d.ts +4 -5
- package/dist/editor/schema-editor/CollectionEditor.js +0 -1
- package/dist/editor/schema-editor/EntryTypeEditor.d.ts +2 -3
- package/dist/editor/schema-editor/EntryTypeEditor.js +0 -1
- package/dist/editor/schema-editor/index.d.ts +2 -3
- package/dist/editor/schema-editor/index.js +0 -1
- package/dist/editor/theme.d.ts +0 -1
- package/dist/editor/theme.js +0 -1
- package/dist/editor/utils/env.d.ts +0 -1
- package/dist/editor/utils/env.js +0 -1
- package/dist/entry-link-resolver.d.ts +1 -2
- package/dist/entry-link-resolver.js +0 -1
- package/dist/entry-schema-registry.d.ts +3 -4
- package/dist/entry-schema-registry.js +6 -2
- package/dist/entry-schema.d.ts +114 -3
- package/dist/entry-schema.js +46 -1
- package/dist/git-manager.d.ts +1 -2
- package/dist/git-manager.js +0 -1
- package/dist/github-service.d.ts +1 -2
- package/dist/github-service.js +0 -1
- package/dist/http/handler.d.ts +6 -7
- package/dist/http/handler.js +0 -1
- package/dist/http/index.d.ts +6 -7
- package/dist/http/index.js +0 -1
- package/dist/http/router.d.ts +2 -3
- package/dist/http/router.js +0 -1
- package/dist/http/types.d.ts +0 -1
- package/dist/http/types.js +0 -1
- package/dist/id.d.ts +2 -3
- package/dist/id.js +0 -1
- package/dist/index.d.ts +17 -18
- package/dist/index.js +0 -1
- package/dist/operating-mode/client-safe-strategy.d.ts +1 -2
- package/dist/operating-mode/client-safe-strategy.js +0 -1
- package/dist/operating-mode/client-unsafe-strategy.d.ts +1 -2
- package/dist/operating-mode/client-unsafe-strategy.js +0 -1
- package/dist/operating-mode/client.d.ts +3 -4
- package/dist/operating-mode/client.js +0 -1
- package/dist/operating-mode/deployment-name-fixtures.d.ts +0 -1
- package/dist/operating-mode/deployment-name-fixtures.js +0 -1
- package/dist/operating-mode/deployment-name.d.ts +0 -1
- package/dist/operating-mode/deployment-name.js +0 -1
- package/dist/operating-mode/index.d.ts +5 -6
- package/dist/operating-mode/index.js +0 -1
- package/dist/operating-mode/mode-env.d.ts +1 -2
- package/dist/operating-mode/mode-env.js +0 -1
- package/dist/operating-mode/types.d.ts +2 -3
- package/dist/operating-mode/types.js +0 -1
- package/dist/paths/branch-name.d.ts +1 -2
- package/dist/paths/branch-name.js +0 -1
- package/dist/paths/branch.d.ts +3 -4
- package/dist/paths/branch.js +0 -1
- package/dist/paths/index.d.ts +8 -9
- package/dist/paths/index.js +0 -1
- package/dist/paths/normalize-server.d.ts +1 -2
- package/dist/paths/normalize-server.js +0 -1
- package/dist/paths/normalize.d.ts +1 -2
- package/dist/paths/normalize.js +0 -1
- package/dist/paths/resolve.d.ts +2 -3
- package/dist/paths/resolve.js +0 -1
- package/dist/paths/types.d.ts +0 -1
- package/dist/paths/types.js +0 -1
- package/dist/paths/validation.d.ts +1 -2
- package/dist/paths/validation.js +0 -1
- package/dist/reference-resolver.d.ts +3 -4
- package/dist/reference-resolver.js +0 -1
- package/dist/resolve-canopy-user.d.ts +3 -4
- package/dist/resolve-canopy-user.js +0 -1
- package/dist/resource-generation.d.ts +0 -1
- package/dist/resource-generation.js +0 -1
- package/dist/schema/index.d.ts +3 -4
- package/dist/schema/index.js +0 -1
- package/dist/schema/meta-loader.d.ts +3 -4
- package/dist/schema/meta-loader.js +3 -3
- package/dist/schema/resolver.d.ts +2 -3
- package/dist/schema/resolver.js +0 -1
- package/dist/schema/schema-store-types.d.ts +2 -3
- package/dist/schema/schema-store-types.js +0 -1
- package/dist/schema/schema-store.d.ts +6 -7
- package/dist/schema/schema-store.js +33 -1
- package/dist/schema/types.d.ts +1 -2
- package/dist/schema/types.js +0 -1
- package/dist/server.d.ts +54 -45
- package/dist/server.js +11 -3
- package/dist/services.d.ts +10 -11
- package/dist/services.js +0 -1
- package/dist/settings-workspace.d.ts +12 -15
- package/dist/settings-workspace.js +10 -13
- package/dist/static/index.d.ts +164 -6
- package/dist/static/index.js +242 -7
- package/dist/static/seo.d.ts +8 -30
- package/dist/static/seo.js +19 -46
- package/dist/sync-core.d.ts +0 -1
- package/dist/sync-core.js +0 -1
- package/dist/task-queue/index.d.ts +2 -3
- package/dist/task-queue/index.js +0 -1
- package/dist/task-queue/task-queue.d.ts +1 -2
- package/dist/task-queue/task-queue.js +10 -2
- package/dist/task-queue/types.d.ts +0 -1
- package/dist/task-queue/types.js +0 -1
- package/dist/types.d.ts +3 -4
- package/dist/types.js +0 -1
- package/dist/url-collision.d.ts +86 -0
- package/dist/url-collision.js +186 -0
- package/dist/url-path-resolver.d.ts +11 -2
- package/dist/url-path-resolver.js +37 -5
- package/dist/user.d.ts +3 -4
- package/dist/user.js +0 -1
- package/dist/utils/async-mutex.d.ts +0 -1
- package/dist/utils/async-mutex.js +0 -1
- package/dist/utils/atomic-write.d.ts +0 -1
- package/dist/utils/atomic-write.js +0 -1
- package/dist/utils/body-field.d.ts +12 -2
- package/dist/utils/body-field.js +17 -1
- package/dist/utils/content-serialize.d.ts +37 -0
- package/dist/utils/content-serialize.js +429 -0
- package/dist/utils/content-write-lock.d.ts +12 -16
- package/dist/utils/content-write-lock.js +38 -22
- package/dist/utils/debug.d.ts +0 -1
- package/dist/utils/debug.js +0 -1
- package/dist/utils/entry-url.d.ts +17 -1
- package/dist/utils/entry-url.js +21 -3
- package/dist/utils/error.d.ts +0 -1
- package/dist/utils/error.js +0 -1
- package/dist/utils/flatten-group-fields.d.ts +1 -2
- package/dist/utils/flatten-group-fields.js +0 -1
- package/dist/utils/format.d.ts +1 -2
- package/dist/utils/format.js +0 -1
- package/dist/utils/fs.d.ts +7 -1
- package/dist/utils/fs.js +16 -1
- package/dist/utils/git.d.ts +18 -2
- package/dist/utils/git.js +61 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +0 -1
- package/dist/utils/occ-json-write.d.ts +0 -1
- package/dist/utils/occ-json-write.js +0 -1
- package/dist/utils/provisioning-lock.d.ts +17 -4
- package/dist/utils/provisioning-lock.js +94 -14
- package/dist/utils/sanitize-href.d.ts +2 -3
- package/dist/utils/sanitize-href.js +2 -3
- package/dist/utils/title-field.d.ts +1 -2
- package/dist/utils/title-field.js +0 -1
- package/dist/utils/typed-filename.d.ts +61 -0
- package/dist/utils/typed-filename.js +92 -0
- package/dist/utils/url-prefix.d.ts +121 -0
- package/dist/utils/url-prefix.js +158 -0
- package/dist/validation/block-structural-keys.d.ts +42 -0
- package/dist/validation/block-structural-keys.js +44 -0
- package/dist/validation/deletion-checker.d.ts +4 -5
- package/dist/validation/deletion-checker.js +0 -1
- package/dist/validation/entry-link-validator.d.ts +2 -3
- package/dist/validation/entry-link-validator.js +0 -1
- package/dist/validation/entry-type-reference-validator.d.ts +1 -2
- package/dist/validation/entry-type-reference-validator.js +0 -1
- package/dist/validation/entry-validator.d.ts +23 -2
- package/dist/validation/entry-validator.js +34 -2
- package/dist/validation/field-traversal.d.ts +28 -4
- package/dist/validation/field-traversal.js +24 -7
- package/dist/validation/reference-validator.d.ts +2 -3
- package/dist/validation/reference-validator.js +0 -1
- package/dist/worker/cms-worker.d.ts +31 -2
- package/dist/worker/cms-worker.js +321 -13
- package/dist/worker/log.d.ts +0 -1
- package/dist/worker/log.js +0 -1
- package/dist/worker/task-queue-config.d.ts +1 -2
- package/dist/worker/task-queue-config.js +0 -1
- package/dist/worker/task-queue.d.ts +3 -4
- package/dist/worker/task-queue.js +0 -1
- package/dist/worker/worker-status.d.ts +1 -2
- package/dist/worker/worker-status.js +0 -1
- package/package.json +3 -6
- package/dist/ai/generate.d.ts.map +0 -1
- package/dist/ai/generate.js.map +0 -1
- package/dist/ai/handler.d.ts.map +0 -1
- package/dist/ai/handler.js.map +0 -1
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/index.js.map +0 -1
- package/dist/ai/json-to-markdown.d.ts.map +0 -1
- package/dist/ai/json-to-markdown.js.map +0 -1
- package/dist/ai/resolve-branch.d.ts.map +0 -1
- package/dist/ai/resolve-branch.js.map +0 -1
- package/dist/ai/strip-mdx.d.ts.map +0 -1
- package/dist/ai/strip-mdx.js.map +0 -1
- package/dist/ai/to-plain-text.d.ts.map +0 -1
- package/dist/ai/to-plain-text.js.map +0 -1
- package/dist/ai/transform-components.d.ts.map +0 -1
- package/dist/ai/transform-components.js.map +0 -1
- package/dist/ai/types.d.ts.map +0 -1
- package/dist/ai/types.js.map +0 -1
- package/dist/api/__test__/mock-client.d.ts +0 -231
- package/dist/api/__test__/mock-client.d.ts.map +0 -1
- package/dist/api/__test__/mock-client.js +0 -388
- package/dist/api/__test__/mock-client.js.map +0 -1
- package/dist/api/admin-branch-health.d.ts.map +0 -1
- package/dist/api/admin-branch-health.js.map +0 -1
- package/dist/api/admin.d.ts.map +0 -1
- package/dist/api/admin.js.map +0 -1
- package/dist/api/assets.d.ts.map +0 -1
- package/dist/api/assets.js.map +0 -1
- package/dist/api/branch-merge.d.ts.map +0 -1
- package/dist/api/branch-merge.js.map +0 -1
- package/dist/api/branch-review.d.ts.map +0 -1
- package/dist/api/branch-review.js.map +0 -1
- package/dist/api/branch-status.d.ts.map +0 -1
- package/dist/api/branch-status.js.map +0 -1
- package/dist/api/branch-withdraw.d.ts.map +0 -1
- package/dist/api/branch-withdraw.js.map +0 -1
- package/dist/api/branch.d.ts.map +0 -1
- package/dist/api/branch.js.map +0 -1
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js.map +0 -1
- package/dist/api/comments.d.ts.map +0 -1
- package/dist/api/comments.js.map +0 -1
- package/dist/api/content.d.ts.map +0 -1
- package/dist/api/content.js.map +0 -1
- package/dist/api/entries-constants.d.ts.map +0 -1
- package/dist/api/entries-constants.js.map +0 -1
- package/dist/api/entries.d.ts.map +0 -1
- package/dist/api/entries.js.map +0 -1
- package/dist/api/github-sync.d.ts.map +0 -1
- package/dist/api/github-sync.js.map +0 -1
- package/dist/api/groups.d.ts.map +0 -1
- package/dist/api/groups.js.map +0 -1
- package/dist/api/guards.d.ts.map +0 -1
- package/dist/api/guards.js.map +0 -1
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js.map +0 -1
- package/dist/api/permissions.d.ts.map +0 -1
- package/dist/api/permissions.js.map +0 -1
- package/dist/api/reference-options.d.ts.map +0 -1
- package/dist/api/reference-options.js.map +0 -1
- package/dist/api/request-body-hash.d.ts.map +0 -1
- package/dist/api/request-body-hash.js.map +0 -1
- package/dist/api/resolve-references.d.ts.map +0 -1
- package/dist/api/resolve-references.js.map +0 -1
- package/dist/api/route-builder.d.ts.map +0 -1
- package/dist/api/route-builder.js.map +0 -1
- package/dist/api/schema.d.ts.map +0 -1
- package/dist/api/schema.js.map +0 -1
- package/dist/api/settings-helpers.d.ts.map +0 -1
- package/dist/api/settings-helpers.js.map +0 -1
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js.map +0 -1
- package/dist/api/user.d.ts.map +0 -1
- package/dist/api/user.js.map +0 -1
- package/dist/api/validators.d.ts.map +0 -1
- package/dist/api/validators.js.map +0 -1
- package/dist/assets/asset-prefixes.d.ts.map +0 -1
- package/dist/assets/asset-prefixes.js.map +0 -1
- package/dist/assets/asset-src.d.ts.map +0 -1
- package/dist/assets/asset-src.js.map +0 -1
- package/dist/assets/asset-url.d.ts.map +0 -1
- package/dist/assets/asset-url.js.map +0 -1
- package/dist/assets/factory.d.ts.map +0 -1
- package/dist/assets/factory.js.map +0 -1
- package/dist/assets/finalize.d.ts.map +0 -1
- package/dist/assets/finalize.js.map +0 -1
- package/dist/assets/index.d.ts.map +0 -1
- package/dist/assets/index.js.map +0 -1
- package/dist/assets/keys.d.ts.map +0 -1
- package/dist/assets/keys.js.map +0 -1
- package/dist/assets/pipeline.d.ts.map +0 -1
- package/dist/assets/pipeline.js.map +0 -1
- package/dist/assets/store-local.d.ts.map +0 -1
- package/dist/assets/store-local.js.map +0 -1
- package/dist/assets/store-s3.d.ts.map +0 -1
- package/dist/assets/store-s3.js.map +0 -1
- package/dist/assets/svg-sanitizer.d.ts.map +0 -1
- package/dist/assets/svg-sanitizer.js.map +0 -1
- package/dist/assets/transform-directives.d.ts.map +0 -1
- package/dist/assets/transform-directives.js.map +0 -1
- package/dist/assets/transform.d.ts.map +0 -1
- package/dist/assets/transform.js.map +0 -1
- package/dist/assets/types.d.ts.map +0 -1
- package/dist/assets/types.js.map +0 -1
- package/dist/auth/cache.d.ts.map +0 -1
- package/dist/auth/cache.js.map +0 -1
- package/dist/auth/caching-auth-plugin.d.ts.map +0 -1
- package/dist/auth/caching-auth-plugin.js.map +0 -1
- package/dist/auth/context-helpers.d.ts.map +0 -1
- package/dist/auth/context-helpers.js.map +0 -1
- package/dist/auth/file-based-auth-cache.d.ts.map +0 -1
- package/dist/auth/file-based-auth-cache.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/plugin.d.ts.map +0 -1
- package/dist/auth/plugin.js.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/authorization/branch.d.ts.map +0 -1
- package/dist/authorization/branch.js.map +0 -1
- package/dist/authorization/content.d.ts.map +0 -1
- package/dist/authorization/content.js.map +0 -1
- package/dist/authorization/groups/index.d.ts.map +0 -1
- package/dist/authorization/groups/index.js.map +0 -1
- package/dist/authorization/groups/loader.d.ts.map +0 -1
- package/dist/authorization/groups/loader.js.map +0 -1
- package/dist/authorization/groups/schema.d.ts.map +0 -1
- package/dist/authorization/groups/schema.js.map +0 -1
- package/dist/authorization/helpers.d.ts.map +0 -1
- package/dist/authorization/helpers.js.map +0 -1
- package/dist/authorization/index.d.ts.map +0 -1
- package/dist/authorization/index.js.map +0 -1
- package/dist/authorization/path.d.ts.map +0 -1
- package/dist/authorization/path.js.map +0 -1
- package/dist/authorization/permissions/index.d.ts.map +0 -1
- package/dist/authorization/permissions/index.js.map +0 -1
- package/dist/authorization/permissions/loader.d.ts.map +0 -1
- package/dist/authorization/permissions/loader.js.map +0 -1
- package/dist/authorization/permissions/schema.d.ts.map +0 -1
- package/dist/authorization/permissions/schema.js.map +0 -1
- package/dist/authorization/protected-branch.d.ts.map +0 -1
- package/dist/authorization/protected-branch.js.map +0 -1
- package/dist/authorization/settings-file-store.d.ts.map +0 -1
- package/dist/authorization/settings-file-store.js.map +0 -1
- package/dist/authorization/test-utils.d.ts +0 -26
- package/dist/authorization/test-utils.d.ts.map +0 -1
- package/dist/authorization/test-utils.js +0 -23
- package/dist/authorization/test-utils.js.map +0 -1
- package/dist/authorization/types.d.ts.map +0 -1
- package/dist/authorization/types.js.map +0 -1
- package/dist/authorization/validation.d.ts.map +0 -1
- package/dist/authorization/validation.js.map +0 -1
- package/dist/branch-health.d.ts.map +0 -1
- package/dist/branch-health.js.map +0 -1
- package/dist/branch-metadata.d.ts.map +0 -1
- package/dist/branch-metadata.js.map +0 -1
- package/dist/branch-registry.d.ts.map +0 -1
- package/dist/branch-registry.js.map +0 -1
- package/dist/branch-schema-cache.d.ts.map +0 -1
- package/dist/branch-schema-cache.js.map +0 -1
- package/dist/branch-workspace.d.ts.map +0 -1
- package/dist/branch-workspace.js.map +0 -1
- package/dist/build/generate-ai-content.d.ts.map +0 -1
- package/dist/build/generate-ai-content.js.map +0 -1
- package/dist/build/index.d.ts.map +0 -1
- package/dist/build/index.js.map +0 -1
- package/dist/build-canopy.d.ts.map +0 -1
- package/dist/build-canopy.js.map +0 -1
- package/dist/build-mode.d.ts.map +0 -1
- package/dist/build-mode.js.map +0 -1
- package/dist/cli/cli.d.ts.map +0 -1
- package/dist/cli/cli.js.map +0 -1
- package/dist/cli/generate-ai-content.d.ts.map +0 -1
- package/dist/cli/generate-ai-content.js.map +0 -1
- package/dist/cli/init.d.ts.map +0 -1
- package/dist/cli/init.js.map +0 -1
- package/dist/cli/migrate.d.ts.map +0 -1
- package/dist/cli/migrate.js.map +0 -1
- package/dist/cli/project-detect.d.ts.map +0 -1
- package/dist/cli/project-detect.js.map +0 -1
- package/dist/cli/project-root.d.ts.map +0 -1
- package/dist/cli/project-root.js.map +0 -1
- package/dist/cli/sync.d.ts.map +0 -1
- package/dist/cli/sync.js.map +0 -1
- package/dist/cli/templates.d.ts.map +0 -1
- package/dist/cli/templates.js.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/comment-store.d.ts.map +0 -1
- package/dist/comment-store.js.map +0 -1
- package/dist/config/flatten.d.ts.map +0 -1
- package/dist/config/flatten.js.map +0 -1
- package/dist/config/helpers.d.ts.map +0 -1
- package/dist/config/helpers.js.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js.map +0 -1
- package/dist/config/schemas/collection.d.ts.map +0 -1
- package/dist/config/schemas/collection.js.map +0 -1
- package/dist/config/schemas/config.d.ts.map +0 -1
- package/dist/config/schemas/config.js.map +0 -1
- package/dist/config/schemas/field.d.ts.map +0 -1
- package/dist/config/schemas/field.js.map +0 -1
- package/dist/config/schemas/media.d.ts.map +0 -1
- package/dist/config/schemas/media.js.map +0 -1
- package/dist/config/schemas/permissions.d.ts.map +0 -1
- package/dist/config/schemas/permissions.js.map +0 -1
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js.map +0 -1
- package/dist/config/validation.d.ts.map +0 -1
- package/dist/config/validation.js.map +0 -1
- package/dist/config-test.d.ts +0 -20
- package/dist/config-test.d.ts.map +0 -1
- package/dist/config-test.js +0 -49
- package/dist/config-test.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/content-id-index.d.ts.map +0 -1
- package/dist/content-id-index.js.map +0 -1
- package/dist/content-index-generation.d.ts.map +0 -1
- package/dist/content-index-generation.js.map +0 -1
- package/dist/content-index-registry.d.ts.map +0 -1
- package/dist/content-index-registry.js.map +0 -1
- package/dist/content-listing.d.ts.map +0 -1
- package/dist/content-listing.js.map +0 -1
- package/dist/content-reader.d.ts.map +0 -1
- package/dist/content-reader.js.map +0 -1
- package/dist/content-store.d.ts.map +0 -1
- package/dist/content-store.js.map +0 -1
- package/dist/content-tree.d.ts.map +0 -1
- package/dist/content-tree.js.map +0 -1
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/dev-content-watcher.d.ts.map +0 -1
- package/dist/dev-content-watcher.js.map +0 -1
- package/dist/editor/BranchManager.d.ts.map +0 -1
- package/dist/editor/BranchManager.js.map +0 -1
- package/dist/editor/CanopyEditor.d.ts.map +0 -1
- package/dist/editor/CanopyEditor.js.map +0 -1
- package/dist/editor/CanopyEditorPage.d.ts.map +0 -1
- package/dist/editor/CanopyEditorPage.js.map +0 -1
- package/dist/editor/CommentsPanel.d.ts.map +0 -1
- package/dist/editor/CommentsPanel.js.map +0 -1
- package/dist/editor/Editor.d.ts.map +0 -1
- package/dist/editor/Editor.js.map +0 -1
- package/dist/editor/EditorPanes.d.ts.map +0 -1
- package/dist/editor/EditorPanes.js.map +0 -1
- package/dist/editor/EntryNavigator.d.ts.map +0 -1
- package/dist/editor/EntryNavigator.js.map +0 -1
- package/dist/editor/FormRenderer.d.ts.map +0 -1
- package/dist/editor/FormRenderer.js.map +0 -1
- package/dist/editor/GroupManager.d.ts.map +0 -1
- package/dist/editor/GroupManager.js.map +0 -1
- package/dist/editor/PermissionManager.d.ts.map +0 -1
- package/dist/editor/PermissionManager.js.map +0 -1
- package/dist/editor/admin/SystemHealthPanel.d.ts.map +0 -1
- package/dist/editor/admin/SystemHealthPanel.js.map +0 -1
- package/dist/editor/admin/useSystemHealth.d.ts.map +0 -1
- package/dist/editor/admin/useSystemHealth.js.map +0 -1
- package/dist/editor/canopy-path.d.ts.map +0 -1
- package/dist/editor/canopy-path.js.map +0 -1
- package/dist/editor/client-reference-resolver.d.ts.map +0 -1
- package/dist/editor/client-reference-resolver.js.map +0 -1
- package/dist/editor/comments/BranchComments.d.ts.map +0 -1
- package/dist/editor/comments/BranchComments.js.map +0 -1
- package/dist/editor/comments/EntryComments.d.ts.map +0 -1
- package/dist/editor/comments/EntryComments.js.map +0 -1
- package/dist/editor/comments/FieldWrapper.d.ts.map +0 -1
- package/dist/editor/comments/FieldWrapper.js.map +0 -1
- package/dist/editor/comments/InlineCommentThread.d.ts.map +0 -1
- package/dist/editor/comments/InlineCommentThread.js.map +0 -1
- package/dist/editor/comments/ThreadCarousel.d.ts.map +0 -1
- package/dist/editor/comments/ThreadCarousel.js.map +0 -1
- package/dist/editor/components/ConfirmDeleteModal.d.ts.map +0 -1
- package/dist/editor/components/ConfirmDeleteModal.js.map +0 -1
- package/dist/editor/components/EditorFooter.d.ts.map +0 -1
- package/dist/editor/components/EditorFooter.js.map +0 -1
- package/dist/editor/components/EditorHeader.d.ts.map +0 -1
- package/dist/editor/components/EditorHeader.js.map +0 -1
- package/dist/editor/components/EditorSidebar.d.ts.map +0 -1
- package/dist/editor/components/EditorSidebar.js.map +0 -1
- package/dist/editor/components/EntryCreateModal.d.ts.map +0 -1
- package/dist/editor/components/EntryCreateModal.js.map +0 -1
- package/dist/editor/components/RenameEntryModal.d.ts.map +0 -1
- package/dist/editor/components/RenameEntryModal.js.map +0 -1
- package/dist/editor/components/UserBadge.d.ts.map +0 -1
- package/dist/editor/components/UserBadge.js.map +0 -1
- package/dist/editor/components/index.d.ts.map +0 -1
- package/dist/editor/components/index.js.map +0 -1
- package/dist/editor/context/ApiClientContext.d.ts.map +0 -1
- package/dist/editor/context/ApiClientContext.js.map +0 -1
- package/dist/editor/context/AssetContext.d.ts.map +0 -1
- package/dist/editor/context/AssetContext.js.map +0 -1
- package/dist/editor/context/EditorStateContext.d.ts.map +0 -1
- package/dist/editor/context/EditorStateContext.js.map +0 -1
- package/dist/editor/context/SWRProvider.d.ts.map +0 -1
- package/dist/editor/context/SWRProvider.js.map +0 -1
- package/dist/editor/context/index.d.ts.map +0 -1
- package/dist/editor/context/index.js.map +0 -1
- package/dist/editor/editor-config.d.ts.map +0 -1
- package/dist/editor/editor-config.js.map +0 -1
- package/dist/editor/editor-utils.d.ts.map +0 -1
- package/dist/editor/editor-utils.js.map +0 -1
- package/dist/editor/fields/BlockField.d.ts.map +0 -1
- package/dist/editor/fields/BlockField.js.map +0 -1
- package/dist/editor/fields/CodeField.d.ts.map +0 -1
- package/dist/editor/fields/CodeField.js.map +0 -1
- package/dist/editor/fields/DateTimeField.d.ts.map +0 -1
- package/dist/editor/fields/DateTimeField.js.map +0 -1
- package/dist/editor/fields/ImageField.d.ts.map +0 -1
- package/dist/editor/fields/ImageField.js.map +0 -1
- package/dist/editor/fields/InlineGroupField.d.ts.map +0 -1
- package/dist/editor/fields/InlineGroupField.js.map +0 -1
- package/dist/editor/fields/MarkdownField.d.ts.map +0 -1
- package/dist/editor/fields/MarkdownField.js.map +0 -1
- package/dist/editor/fields/MdxImageDialog.d.ts.map +0 -1
- package/dist/editor/fields/MdxImageDialog.js.map +0 -1
- package/dist/editor/fields/NumberField.d.ts.map +0 -1
- package/dist/editor/fields/NumberField.js.map +0 -1
- package/dist/editor/fields/NumberListField.d.ts.map +0 -1
- package/dist/editor/fields/NumberListField.js.map +0 -1
- package/dist/editor/fields/ObjectField.d.ts.map +0 -1
- package/dist/editor/fields/ObjectField.js.map +0 -1
- package/dist/editor/fields/ReferenceField.d.ts.map +0 -1
- package/dist/editor/fields/ReferenceField.js.map +0 -1
- package/dist/editor/fields/SelectField.d.ts.map +0 -1
- package/dist/editor/fields/SelectField.js.map +0 -1
- package/dist/editor/fields/StringListField.d.ts.map +0 -1
- package/dist/editor/fields/StringListField.js.map +0 -1
- package/dist/editor/fields/TextField.d.ts.map +0 -1
- package/dist/editor/fields/TextField.js.map +0 -1
- package/dist/editor/fields/ToggleField.d.ts.map +0 -1
- package/dist/editor/fields/ToggleField.js.map +0 -1
- package/dist/editor/fields/entry-link/EntryLinkContext.d.ts.map +0 -1
- package/dist/editor/fields/entry-link/EntryLinkContext.js.map +0 -1
- package/dist/editor/fields/entry-link/InsertEntryLink.d.ts.map +0 -1
- package/dist/editor/fields/entry-link/InsertEntryLink.js.map +0 -1
- package/dist/editor/fields/entry-link/index.d.ts.map +0 -1
- package/dist/editor/fields/entry-link/index.js.map +0 -1
- package/dist/editor/group-manager/ExternalGroupsTab.d.ts.map +0 -1
- package/dist/editor/group-manager/ExternalGroupsTab.js.map +0 -1
- package/dist/editor/group-manager/GroupCard.d.ts.map +0 -1
- package/dist/editor/group-manager/GroupCard.js.map +0 -1
- package/dist/editor/group-manager/GroupForm.d.ts.map +0 -1
- package/dist/editor/group-manager/GroupForm.js.map +0 -1
- package/dist/editor/group-manager/InternalGroupsTab.d.ts.map +0 -1
- package/dist/editor/group-manager/InternalGroupsTab.js.map +0 -1
- package/dist/editor/group-manager/MemberList.d.ts.map +0 -1
- package/dist/editor/group-manager/MemberList.js.map +0 -1
- package/dist/editor/group-manager/hooks/useExternalGroupSearch.d.ts.map +0 -1
- package/dist/editor/group-manager/hooks/useExternalGroupSearch.js.map +0 -1
- package/dist/editor/group-manager/hooks/useGroupState.d.ts.map +0 -1
- package/dist/editor/group-manager/hooks/useGroupState.js.map +0 -1
- package/dist/editor/group-manager/hooks/useUserSearch.d.ts.map +0 -1
- package/dist/editor/group-manager/hooks/useUserSearch.js.map +0 -1
- package/dist/editor/group-manager/index.d.ts.map +0 -1
- package/dist/editor/group-manager/index.js.map +0 -1
- package/dist/editor/group-manager/types.d.ts.map +0 -1
- package/dist/editor/group-manager/types.js.map +0 -1
- package/dist/editor/hooks/__test__/test-utils.d.ts +0 -164
- package/dist/editor/hooks/__test__/test-utils.d.ts.map +0 -1
- package/dist/editor/hooks/__test__/test-utils.js +0 -203
- package/dist/editor/hooks/__test__/test-utils.js.map +0 -1
- package/dist/editor/hooks/index.d.ts.map +0 -1
- package/dist/editor/hooks/index.js.map +0 -1
- package/dist/editor/hooks/useBranchActions.d.ts.map +0 -1
- package/dist/editor/hooks/useBranchActions.js.map +0 -1
- package/dist/editor/hooks/useBranchManager.d.ts.map +0 -1
- package/dist/editor/hooks/useBranchManager.js.map +0 -1
- package/dist/editor/hooks/useBranchesData.d.ts.map +0 -1
- package/dist/editor/hooks/useBranchesData.js.map +0 -1
- package/dist/editor/hooks/useCommentSystem.d.ts.map +0 -1
- package/dist/editor/hooks/useCommentSystem.js.map +0 -1
- package/dist/editor/hooks/useCommentsData.d.ts.map +0 -1
- package/dist/editor/hooks/useCommentsData.js.map +0 -1
- package/dist/editor/hooks/useDraftManager.d.ts.map +0 -1
- package/dist/editor/hooks/useDraftManager.js.map +0 -1
- package/dist/editor/hooks/useEditorLayout.d.ts.map +0 -1
- package/dist/editor/hooks/useEditorLayout.js.map +0 -1
- package/dist/editor/hooks/useEntriesData.d.ts.map +0 -1
- package/dist/editor/hooks/useEntriesData.js.map +0 -1
- package/dist/editor/hooks/useEntryLinkResolution.d.ts.map +0 -1
- package/dist/editor/hooks/useEntryLinkResolution.js.map +0 -1
- package/dist/editor/hooks/useEntryManager.d.ts.map +0 -1
- package/dist/editor/hooks/useEntryManager.js.map +0 -1
- package/dist/editor/hooks/useGroupManager.d.ts.map +0 -1
- package/dist/editor/hooks/useGroupManager.js.map +0 -1
- package/dist/editor/hooks/usePermissionManager.d.ts.map +0 -1
- package/dist/editor/hooks/usePermissionManager.js.map +0 -1
- package/dist/editor/hooks/useReferenceResolution.d.ts.map +0 -1
- package/dist/editor/hooks/useReferenceResolution.js.map +0 -1
- package/dist/editor/hooks/useSchemaManager.d.ts.map +0 -1
- package/dist/editor/hooks/useSchemaManager.js.map +0 -1
- package/dist/editor/hooks/useUserContext.d.ts.map +0 -1
- package/dist/editor/hooks/useUserContext.js.map +0 -1
- package/dist/editor/hooks/useUserMetadata.d.ts.map +0 -1
- package/dist/editor/hooks/useUserMetadata.js.map +0 -1
- package/dist/editor/media/AssetCard.d.ts.map +0 -1
- package/dist/editor/media/AssetCard.js.map +0 -1
- package/dist/editor/media/CropStep.d.ts.map +0 -1
- package/dist/editor/media/CropStep.js.map +0 -1
- package/dist/editor/media/MediaLibrary.d.ts.map +0 -1
- package/dist/editor/media/MediaLibrary.js.map +0 -1
- package/dist/editor/media/MediaLibraryBody.d.ts.map +0 -1
- package/dist/editor/media/MediaLibraryBody.js.map +0 -1
- package/dist/editor/media/crop-math.d.ts.map +0 -1
- package/dist/editor/media/crop-math.js.map +0 -1
- package/dist/editor/media/upload-asset.d.ts.map +0 -1
- package/dist/editor/media/upload-asset.js.map +0 -1
- package/dist/editor/media/upload-constants.d.ts.map +0 -1
- package/dist/editor/media/upload-constants.js.map +0 -1
- package/dist/editor/media/useAssetUpload.d.ts.map +0 -1
- package/dist/editor/media/useAssetUpload.js.map +0 -1
- package/dist/editor/media/xhr-upload.d.ts.map +0 -1
- package/dist/editor/media/xhr-upload.js.map +0 -1
- package/dist/editor/permission-manager/GroupSelector.d.ts.map +0 -1
- package/dist/editor/permission-manager/GroupSelector.js.map +0 -1
- package/dist/editor/permission-manager/PermissionEditor.d.ts.map +0 -1
- package/dist/editor/permission-manager/PermissionEditor.js.map +0 -1
- package/dist/editor/permission-manager/PermissionLevelBadge.d.ts.map +0 -1
- package/dist/editor/permission-manager/PermissionLevelBadge.js.map +0 -1
- package/dist/editor/permission-manager/PermissionTree.d.ts.map +0 -1
- package/dist/editor/permission-manager/PermissionTree.js.map +0 -1
- package/dist/editor/permission-manager/UserSelector.d.ts.map +0 -1
- package/dist/editor/permission-manager/UserSelector.js.map +0 -1
- package/dist/editor/permission-manager/constants.d.ts.map +0 -1
- package/dist/editor/permission-manager/constants.js.map +0 -1
- package/dist/editor/permission-manager/hooks/useGroupsAndUsers.d.ts.map +0 -1
- package/dist/editor/permission-manager/hooks/useGroupsAndUsers.js.map +0 -1
- package/dist/editor/permission-manager/hooks/usePermissionTree.d.ts.map +0 -1
- package/dist/editor/permission-manager/hooks/usePermissionTree.js.map +0 -1
- package/dist/editor/permission-manager/index.d.ts.map +0 -1
- package/dist/editor/permission-manager/index.js.map +0 -1
- package/dist/editor/permission-manager/types.d.ts.map +0 -1
- package/dist/editor/permission-manager/types.js.map +0 -1
- package/dist/editor/permission-manager/utils.d.ts.map +0 -1
- package/dist/editor/permission-manager/utils.js.map +0 -1
- package/dist/editor/preview-bridge.d.ts.map +0 -1
- package/dist/editor/preview-bridge.js.map +0 -1
- package/dist/editor/relative-time.d.ts.map +0 -1
- package/dist/editor/relative-time.js.map +0 -1
- package/dist/editor/schema-editor/CollectionEditor.d.ts.map +0 -1
- package/dist/editor/schema-editor/CollectionEditor.js.map +0 -1
- package/dist/editor/schema-editor/EntryTypeEditor.d.ts.map +0 -1
- package/dist/editor/schema-editor/EntryTypeEditor.js.map +0 -1
- package/dist/editor/schema-editor/index.d.ts.map +0 -1
- package/dist/editor/schema-editor/index.js.map +0 -1
- package/dist/editor/setup-test-dom.d.ts +0 -1
- package/dist/editor/setup-test-dom.d.ts.map +0 -1
- package/dist/editor/setup-test-dom.js +0 -12
- package/dist/editor/setup-test-dom.js.map +0 -1
- package/dist/editor/test-setup.d.ts +0 -6
- package/dist/editor/test-setup.d.ts.map +0 -1
- package/dist/editor/test-setup.js +0 -42
- package/dist/editor/test-setup.js.map +0 -1
- package/dist/editor/theme.d.ts.map +0 -1
- package/dist/editor/theme.js.map +0 -1
- package/dist/editor/utils/env.d.ts.map +0 -1
- package/dist/editor/utils/env.js.map +0 -1
- package/dist/entry-link-resolver.d.ts.map +0 -1
- package/dist/entry-link-resolver.js.map +0 -1
- package/dist/entry-schema-registry.d.ts.map +0 -1
- package/dist/entry-schema-registry.js.map +0 -1
- package/dist/entry-schema.d.ts.map +0 -1
- package/dist/entry-schema.js.map +0 -1
- package/dist/git-manager.d.ts.map +0 -1
- package/dist/git-manager.js.map +0 -1
- package/dist/github-service.d.ts.map +0 -1
- package/dist/github-service.js.map +0 -1
- package/dist/http/handler.d.ts.map +0 -1
- package/dist/http/handler.js.map +0 -1
- package/dist/http/index.d.ts.map +0 -1
- package/dist/http/index.js.map +0 -1
- package/dist/http/router.d.ts.map +0 -1
- package/dist/http/router.js.map +0 -1
- package/dist/http/types.d.ts.map +0 -1
- package/dist/http/types.js.map +0 -1
- package/dist/id.d.ts.map +0 -1
- package/dist/id.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/operating-mode/client-safe-strategy.d.ts.map +0 -1
- package/dist/operating-mode/client-safe-strategy.js.map +0 -1
- package/dist/operating-mode/client-unsafe-strategy.d.ts.map +0 -1
- package/dist/operating-mode/client-unsafe-strategy.js.map +0 -1
- package/dist/operating-mode/client.d.ts.map +0 -1
- package/dist/operating-mode/client.js.map +0 -1
- package/dist/operating-mode/deployment-name-fixtures.d.ts.map +0 -1
- package/dist/operating-mode/deployment-name-fixtures.js.map +0 -1
- package/dist/operating-mode/deployment-name.d.ts.map +0 -1
- package/dist/operating-mode/deployment-name.js.map +0 -1
- package/dist/operating-mode/index.d.ts.map +0 -1
- package/dist/operating-mode/index.js.map +0 -1
- package/dist/operating-mode/mode-env.d.ts.map +0 -1
- package/dist/operating-mode/mode-env.js.map +0 -1
- package/dist/operating-mode/types.d.ts.map +0 -1
- package/dist/operating-mode/types.js.map +0 -1
- package/dist/paths/branch-name.d.ts.map +0 -1
- package/dist/paths/branch-name.js.map +0 -1
- package/dist/paths/branch.d.ts.map +0 -1
- package/dist/paths/branch.js.map +0 -1
- package/dist/paths/index.d.ts.map +0 -1
- package/dist/paths/index.js.map +0 -1
- package/dist/paths/normalize-server.d.ts.map +0 -1
- package/dist/paths/normalize-server.js.map +0 -1
- package/dist/paths/normalize.d.ts.map +0 -1
- package/dist/paths/normalize.js.map +0 -1
- package/dist/paths/resolve.d.ts.map +0 -1
- package/dist/paths/resolve.js.map +0 -1
- package/dist/paths/test-utils.d.ts +0 -22
- package/dist/paths/test-utils.d.ts.map +0 -1
- package/dist/paths/test-utils.js +0 -21
- package/dist/paths/test-utils.js.map +0 -1
- package/dist/paths/types.d.ts.map +0 -1
- package/dist/paths/types.js.map +0 -1
- package/dist/paths/validation.d.ts.map +0 -1
- package/dist/paths/validation.js.map +0 -1
- package/dist/reference-resolver.d.ts.map +0 -1
- package/dist/reference-resolver.js.map +0 -1
- package/dist/resolve-canopy-user.d.ts.map +0 -1
- package/dist/resolve-canopy-user.js.map +0 -1
- package/dist/resource-generation.d.ts.map +0 -1
- package/dist/resource-generation.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/meta-loader.d.ts.map +0 -1
- package/dist/schema/meta-loader.js.map +0 -1
- package/dist/schema/resolver.d.ts.map +0 -1
- package/dist/schema/resolver.js.map +0 -1
- package/dist/schema/schema-store-types.d.ts.map +0 -1
- package/dist/schema/schema-store-types.js.map +0 -1
- package/dist/schema/schema-store.d.ts.map +0 -1
- package/dist/schema/schema-store.js.map +0 -1
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/schema/types.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/services.d.ts.map +0 -1
- package/dist/services.js.map +0 -1
- package/dist/settings-workspace.d.ts.map +0 -1
- package/dist/settings-workspace.js.map +0 -1
- package/dist/static/index.d.ts.map +0 -1
- package/dist/static/index.js.map +0 -1
- package/dist/static/seo.d.ts.map +0 -1
- package/dist/static/seo.js.map +0 -1
- package/dist/sync-core.d.ts.map +0 -1
- package/dist/sync-core.js.map +0 -1
- package/dist/task-queue/index.d.ts.map +0 -1
- package/dist/task-queue/index.js.map +0 -1
- package/dist/task-queue/task-queue.d.ts.map +0 -1
- package/dist/task-queue/task-queue.js.map +0 -1
- package/dist/task-queue/types.d.ts.map +0 -1
- package/dist/task-queue/types.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/url-path-resolver.d.ts.map +0 -1
- package/dist/url-path-resolver.js.map +0 -1
- package/dist/user.d.ts.map +0 -1
- package/dist/user.js.map +0 -1
- package/dist/utils/async-mutex.d.ts.map +0 -1
- package/dist/utils/async-mutex.js.map +0 -1
- package/dist/utils/atomic-write.d.ts.map +0 -1
- package/dist/utils/atomic-write.js.map +0 -1
- package/dist/utils/body-field.d.ts.map +0 -1
- package/dist/utils/body-field.js.map +0 -1
- package/dist/utils/content-write-lock.d.ts.map +0 -1
- package/dist/utils/content-write-lock.js.map +0 -1
- package/dist/utils/debug.d.ts.map +0 -1
- package/dist/utils/debug.js.map +0 -1
- package/dist/utils/entry-url.d.ts.map +0 -1
- package/dist/utils/entry-url.js.map +0 -1
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/flatten-group-fields.d.ts.map +0 -1
- package/dist/utils/flatten-group-fields.js.map +0 -1
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/fs.d.ts.map +0 -1
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/occ-json-write.d.ts.map +0 -1
- package/dist/utils/occ-json-write.js.map +0 -1
- package/dist/utils/provisioning-lock.d.ts.map +0 -1
- package/dist/utils/provisioning-lock.js.map +0 -1
- package/dist/utils/sanitize-href.d.ts.map +0 -1
- package/dist/utils/sanitize-href.js.map +0 -1
- package/dist/utils/title-field.d.ts.map +0 -1
- package/dist/utils/title-field.js.map +0 -1
- package/dist/validation/deletion-checker.d.ts.map +0 -1
- package/dist/validation/deletion-checker.js.map +0 -1
- package/dist/validation/entry-link-validator.d.ts.map +0 -1
- package/dist/validation/entry-link-validator.js.map +0 -1
- package/dist/validation/entry-type-reference-validator.d.ts.map +0 -1
- package/dist/validation/entry-type-reference-validator.js.map +0 -1
- package/dist/validation/entry-validator.d.ts.map +0 -1
- package/dist/validation/entry-validator.js.map +0 -1
- package/dist/validation/field-traversal.d.ts.map +0 -1
- package/dist/validation/field-traversal.js.map +0 -1
- package/dist/validation/reference-validator.d.ts.map +0 -1
- package/dist/validation/reference-validator.js.map +0 -1
- package/dist/worker/cms-worker.d.ts.map +0 -1
- package/dist/worker/cms-worker.js.map +0 -1
- package/dist/worker/log.d.ts.map +0 -1
- package/dist/worker/log.js.map +0 -1
- package/dist/worker/task-queue-config.d.ts.map +0 -1
- package/dist/worker/task-queue-config.js.map +0 -1
- package/dist/worker/task-queue.d.ts.map +0 -1
- package/dist/worker/task-queue.js.map +0 -1
- package/dist/worker/worker-status.d.ts.map +0 -1
- package/dist/worker/worker-status.js.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { EntryTypeConfig } from '../config/index.js';
|
|
2
|
+
import type { ContentId, Slug } from '../paths/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse a Canopy content filename into its `{type}.{slug}.{id}.{ext}` parts.
|
|
5
|
+
*
|
|
6
|
+
* ## Filename grammar
|
|
7
|
+
*
|
|
8
|
+
* Every entry file on disk is named `{type}.{slug}.{id}.{ext}`:
|
|
9
|
+
* - `type` — the entry type name (a key in the collection's `entries` config).
|
|
10
|
+
* - `slug` — the entry's URL slug. May itself contain dots (e.g. a slug of
|
|
11
|
+
* `getting.started.guide`), so the type and ID anchor the split: the ID is
|
|
12
|
+
* always the second-to-last dot-separated segment, and the slug is
|
|
13
|
+
* everything between the type and the ID. The returned `slug` is
|
|
14
|
+
* lowercased.
|
|
15
|
+
* - `id` — a 12-character Base58 content ID (`generateId()`/`isValidId()`).
|
|
16
|
+
* Base58 excludes the ambiguous characters `0`, `O`, `I`, `l` so IDs are
|
|
17
|
+
* unambiguous when read aloud or hand-transcribed. A filename whose
|
|
18
|
+
* would-be ID segment doesn't pass `isValidId` is rejected — the whole
|
|
19
|
+
* parse returns `null`, even if the rest of the shape looks right.
|
|
20
|
+
* - `ext` — the format extension (`.md`, `.mdx`, `.json`, `.yaml`), stripped
|
|
21
|
+
* before parsing and not part of the returned result.
|
|
22
|
+
*
|
|
23
|
+
* @param filename - The bare filename (no directory component). **This precondition is
|
|
24
|
+
* not enforced.** The parser splits purely on `.`, so a `/` or `\` you pass in is not
|
|
25
|
+
* rejected and is not treated as special — it becomes part of whichever segment it
|
|
26
|
+
* falls in, most often the `type` segment (e.g. `'foo/bar.slug.<validId>.md'` parses
|
|
27
|
+
* to `type: 'foo/bar'`). Strip any directory component yourself (e.g.
|
|
28
|
+
* `path.basename(filePath)`) before calling this — every internal caller already does.
|
|
29
|
+
* @param entryTypes - When provided, the parsed `type` segment must match one
|
|
30
|
+
* of these entry types by name, or the parse is rejected (this is how
|
|
31
|
+
* `listCollectionEntries` filters out files that don't belong to the
|
|
32
|
+
* collection's configured entry types). Omit this argument to parse
|
|
33
|
+
* structurally without validating the type against a known list — useful
|
|
34
|
+
* for adopter code that needs to recover `{type, slug, id}` from a
|
|
35
|
+
* filename without having a schema/entry-types list on hand (e.g. a
|
|
36
|
+
* filesystem walk over content for tooling or diagnostics). Even without
|
|
37
|
+
* `entryTypes`, a leading-dot filename (dotfile, editor swap/backup file)
|
|
38
|
+
* is always rejected — an empty string is never a legal type, matching the
|
|
39
|
+
* `filename.startsWith('.')` guard `extractEntryTypeFromFilename` in
|
|
40
|
+
* `content-id-index.ts` already applies.
|
|
41
|
+
* @returns `{ type, slug, id }`, or `null` if `filename` doesn't match the
|
|
42
|
+
* `{type}.{slug}.{id}.{ext}` shape (too few segments, no extension, a
|
|
43
|
+
* leading dot, an invalid ID, or — when `entryTypes` is given — an
|
|
44
|
+
* unrecognized type). `id` is validated (`isValidId`) and safe to trust. **`slug` is
|
|
45
|
+
* not** — it is the raw dot-joined middle segment(s), lowercased, cast to the branded
|
|
46
|
+
* `Slug` type without running `parseSlug`'s validation. A filename with an
|
|
47
|
+
* unconventional slug segment (e.g. containing a space, or a dot) still parses and still
|
|
48
|
+
* receives the `Slug` brand. Callers that need a validated slug must run the result
|
|
49
|
+
* through `parseSlug` themselves; this function's contract is "split the filename
|
|
50
|
+
* grammar apart," not "validate every part." `listCollectionEntries` (content-listing.ts)
|
|
51
|
+
* is exactly such a caller that does NOT re-validate — it lists the file and computes a
|
|
52
|
+
* `urlPath` for it regardless — so a dotted slug listed this way builds and gets
|
|
53
|
+
* advertised (sitemap, `generateStaticParams`) but can never be read back through
|
|
54
|
+
* `readByUrlPath`, which does run every URL-resolution candidate through `parseSlug`.
|
|
55
|
+
* `static/index.ts`'s `assertRoutableSlugs` is the build-time guard that catches this.
|
|
56
|
+
*/
|
|
57
|
+
export declare const parseTypedFilename: (filename: string, entryTypes?: readonly EntryTypeConfig[]) => {
|
|
58
|
+
type: string;
|
|
59
|
+
slug: Slug;
|
|
60
|
+
id: ContentId;
|
|
61
|
+
} | null;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { isValidId } from '../id.js';
|
|
2
|
+
// Lives here rather than in content-listing.ts, where it was born, purely so dependency-light
|
|
3
|
+
// modules can use it: content-listing imports ContentStore, so anything content-store itself
|
|
4
|
+
// imports (url-collision.ts) cannot reach back into it without a cycle. content-listing
|
|
5
|
+
// re-exports this and `canopycms/server` re-exports it from there, so the public surface is
|
|
6
|
+
// unchanged.
|
|
7
|
+
/**
|
|
8
|
+
* Parse a Canopy content filename into its `{type}.{slug}.{id}.{ext}` parts.
|
|
9
|
+
*
|
|
10
|
+
* ## Filename grammar
|
|
11
|
+
*
|
|
12
|
+
* Every entry file on disk is named `{type}.{slug}.{id}.{ext}`:
|
|
13
|
+
* - `type` — the entry type name (a key in the collection's `entries` config).
|
|
14
|
+
* - `slug` — the entry's URL slug. May itself contain dots (e.g. a slug of
|
|
15
|
+
* `getting.started.guide`), so the type and ID anchor the split: the ID is
|
|
16
|
+
* always the second-to-last dot-separated segment, and the slug is
|
|
17
|
+
* everything between the type and the ID. The returned `slug` is
|
|
18
|
+
* lowercased.
|
|
19
|
+
* - `id` — a 12-character Base58 content ID (`generateId()`/`isValidId()`).
|
|
20
|
+
* Base58 excludes the ambiguous characters `0`, `O`, `I`, `l` so IDs are
|
|
21
|
+
* unambiguous when read aloud or hand-transcribed. A filename whose
|
|
22
|
+
* would-be ID segment doesn't pass `isValidId` is rejected — the whole
|
|
23
|
+
* parse returns `null`, even if the rest of the shape looks right.
|
|
24
|
+
* - `ext` — the format extension (`.md`, `.mdx`, `.json`, `.yaml`), stripped
|
|
25
|
+
* before parsing and not part of the returned result.
|
|
26
|
+
*
|
|
27
|
+
* @param filename - The bare filename (no directory component). **This precondition is
|
|
28
|
+
* not enforced.** The parser splits purely on `.`, so a `/` or `\` you pass in is not
|
|
29
|
+
* rejected and is not treated as special — it becomes part of whichever segment it
|
|
30
|
+
* falls in, most often the `type` segment (e.g. `'foo/bar.slug.<validId>.md'` parses
|
|
31
|
+
* to `type: 'foo/bar'`). Strip any directory component yourself (e.g.
|
|
32
|
+
* `path.basename(filePath)`) before calling this — every internal caller already does.
|
|
33
|
+
* @param entryTypes - When provided, the parsed `type` segment must match one
|
|
34
|
+
* of these entry types by name, or the parse is rejected (this is how
|
|
35
|
+
* `listCollectionEntries` filters out files that don't belong to the
|
|
36
|
+
* collection's configured entry types). Omit this argument to parse
|
|
37
|
+
* structurally without validating the type against a known list — useful
|
|
38
|
+
* for adopter code that needs to recover `{type, slug, id}` from a
|
|
39
|
+
* filename without having a schema/entry-types list on hand (e.g. a
|
|
40
|
+
* filesystem walk over content for tooling or diagnostics). Even without
|
|
41
|
+
* `entryTypes`, a leading-dot filename (dotfile, editor swap/backup file)
|
|
42
|
+
* is always rejected — an empty string is never a legal type, matching the
|
|
43
|
+
* `filename.startsWith('.')` guard `extractEntryTypeFromFilename` in
|
|
44
|
+
* `content-id-index.ts` already applies.
|
|
45
|
+
* @returns `{ type, slug, id }`, or `null` if `filename` doesn't match the
|
|
46
|
+
* `{type}.{slug}.{id}.{ext}` shape (too few segments, no extension, a
|
|
47
|
+
* leading dot, an invalid ID, or — when `entryTypes` is given — an
|
|
48
|
+
* unrecognized type). `id` is validated (`isValidId`) and safe to trust. **`slug` is
|
|
49
|
+
* not** — it is the raw dot-joined middle segment(s), lowercased, cast to the branded
|
|
50
|
+
* `Slug` type without running `parseSlug`'s validation. A filename with an
|
|
51
|
+
* unconventional slug segment (e.g. containing a space, or a dot) still parses and still
|
|
52
|
+
* receives the `Slug` brand. Callers that need a validated slug must run the result
|
|
53
|
+
* through `parseSlug` themselves; this function's contract is "split the filename
|
|
54
|
+
* grammar apart," not "validate every part." `listCollectionEntries` (content-listing.ts)
|
|
55
|
+
* is exactly such a caller that does NOT re-validate — it lists the file and computes a
|
|
56
|
+
* `urlPath` for it regardless — so a dotted slug listed this way builds and gets
|
|
57
|
+
* advertised (sitemap, `generateStaticParams`) but can never be read back through
|
|
58
|
+
* `readByUrlPath`, which does run every URL-resolution candidate through `parseSlug`.
|
|
59
|
+
* `static/index.ts`'s `assertRoutableSlugs` is the build-time guard that catches this.
|
|
60
|
+
*/
|
|
61
|
+
export const parseTypedFilename = (filename, entryTypes) => {
|
|
62
|
+
// Reject dotfiles outright (matching extractEntryTypeFromFilename's guard in
|
|
63
|
+
// content-id-index.ts): a leading dot can never be a legal entry type, and this
|
|
64
|
+
// is exactly the shape of the files a structural (no-entryTypes) parse would
|
|
65
|
+
// otherwise misparse -- e.g. '.hidden.file.aB3cD4eF5gH6.md' -> potentialType ''.
|
|
66
|
+
if (filename.startsWith('.'))
|
|
67
|
+
return null;
|
|
68
|
+
// Remove extension
|
|
69
|
+
const lastDot = filename.lastIndexOf('.');
|
|
70
|
+
if (lastDot === -1)
|
|
71
|
+
return null;
|
|
72
|
+
const nameWithoutExt = filename.slice(0, lastDot);
|
|
73
|
+
// Parse: {type}.{slug}.{id}
|
|
74
|
+
const parts = nameWithoutExt.split('.');
|
|
75
|
+
if (parts.length < 3)
|
|
76
|
+
return null;
|
|
77
|
+
const potentialType = parts[0];
|
|
78
|
+
// When a known-types list is supplied, the first segment must match one of
|
|
79
|
+
// them. Without it, any non-empty first segment is accepted as the type.
|
|
80
|
+
if (entryTypes && !entryTypes.some((e) => e.name === potentialType)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const id = parts[parts.length - 1];
|
|
84
|
+
if (!isValidId(id))
|
|
85
|
+
return null;
|
|
86
|
+
const slug = parts.slice(1, -1).join('.').toLowerCase();
|
|
87
|
+
return {
|
|
88
|
+
type: potentialType,
|
|
89
|
+
slug: slug,
|
|
90
|
+
id: id,
|
|
91
|
+
};
|
|
92
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Joining a URL prefix onto a root-relative path, in ONE place.
|
|
3
|
+
*
|
|
4
|
+
* Two surfaces need the identical operation and had drifted into two implementations:
|
|
5
|
+
*
|
|
6
|
+
* - `static/seo.ts`'s `resolveSeoUrl` puts a site origin in front of an entry's URL path.
|
|
7
|
+
* - `assets/asset-url.ts`'s `assetUrl` puts an asset-space mount point in front of a stored
|
|
8
|
+
* `/assets/…` src.
|
|
9
|
+
*
|
|
10
|
+
* The asset copy was the weaker one - it checked neither absoluteness of the path nor the shape
|
|
11
|
+
* of the prefix - so it silently produced `/prefix/https://cdn.example.com/x.png` for an
|
|
12
|
+
* off-site src, and a *document-relative* URL for a prefix that had no leading slash. Both bugs
|
|
13
|
+
* were already solved on the SEO side. Sharing one function is what stops a third caller from
|
|
14
|
+
* inheriting the weaker half again.
|
|
15
|
+
*
|
|
16
|
+
* Dependency-free apart from `./sanitize-href` (itself pure - its only dependency is the global
|
|
17
|
+
* `URL`), because this is reachable from client bundles via `assets/asset-url.ts`. Do not add a
|
|
18
|
+
* node built-in here; `pnpm lint:bundle` fails the build if you do.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Whether `url` is a DECLARED off-site pointer - a scheme-qualified absolute URL
|
|
22
|
+
* (`https://example.com/x`) or a literal protocol-relative one (`//cdn.example.com/x`).
|
|
23
|
+
*
|
|
24
|
+
* Deliberately narrower than "resolves off-origin": a WHATWG-backslash-equivalent spelling
|
|
25
|
+
* (`/\evil.com`, `\\evil.com`, `\/evil.com` — see `utils/sanitize-href.ts`'s
|
|
26
|
+
* `isImplicitlyOffOrigin`) also resolves off-origin in a browser, but is NOT recognized here as
|
|
27
|
+
* an intentional off-site pointer the way a literal `//cdn…` is. Callers handle that case
|
|
28
|
+
* separately, by neutralizing (`neutralizeImplicitOffOrigin`) rather than passing through: a
|
|
29
|
+
* `false` result here isn't a guarantee the value is a safe site-relative path on its own, only
|
|
30
|
+
* that it isn't a *declared* off-site one.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isAbsoluteUrl(url: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Strip trailing slashes without a regex.
|
|
35
|
+
*
|
|
36
|
+
* The obvious `replace(/\/+$/, '')` is a polynomial-ReDoS shape (CodeQL
|
|
37
|
+
* `js/polynomial-redos`, flagged high): on a value that is mostly slashes but does not end in
|
|
38
|
+
* one, the engine retries `\/+` from every position and the match cost is quadratic in the
|
|
39
|
+
* input length. Both prefixes that reach here - a `siteUrl` and an asset `baseUrl` - are
|
|
40
|
+
* adopter-supplied and can come from config or an env var, so they count as uncontrolled. A
|
|
41
|
+
* character scan is linear and needs no reasoning about backtracking.
|
|
42
|
+
*
|
|
43
|
+
* Exported (from `canopycms/server`) so adopter code normalizing its own site-origin env var —
|
|
44
|
+
* e.g. a `SITE_URL` constant built from `NEXT_PUBLIC_SITE_URL` — has a package-provided linear
|
|
45
|
+
* way to do it instead of reaching for the same regex this function replaced.
|
|
46
|
+
*/
|
|
47
|
+
export declare function stripTrailingSlashes(value: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Reduce a URL reference to a value that is safe to emit as a SAME-ORIGIN path.
|
|
50
|
+
*
|
|
51
|
+
* `neutralizeImplicitOffOrigin` alone is not sufficient, and this is the subtle part: it returns
|
|
52
|
+
* `pathname + search + hash`, and a WHATWG `pathname` can ITSELF begin with `//`. `/\evil.com//a`
|
|
53
|
+
* parses to host `evil.com` with pathname `//a`, so neutralizing yields the string `//a` — which,
|
|
54
|
+
* re-emitted as a URL reference, reads as protocol-relative all over again and points at a host
|
|
55
|
+
* literally named `a`. Neutralizing a second time does not help: the value is now indistinguishable
|
|
56
|
+
* from a caller's legitimate `//cdn.example.com` pointer, so every absolute-URL check downstream
|
|
57
|
+
* (correctly) passes it straight through, prefix and all.
|
|
58
|
+
*
|
|
59
|
+
* The value is same-origin by construction at this point, so collapse the leading slash run to a
|
|
60
|
+
* single slash. Linear scan rather than a regex, for the reason `stripTrailingSlashes` documents.
|
|
61
|
+
*
|
|
62
|
+
* Use this instead of calling `neutralizeImplicitOffOrigin` directly anywhere the result is going
|
|
63
|
+
* to be prefixed or emitted as a path.
|
|
64
|
+
*/
|
|
65
|
+
export declare function toSameOriginPath(url: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Whether `url` is something a prefix cannot meaningfully be put in front of.
|
|
68
|
+
*
|
|
69
|
+
* Two kinds: **scheme-bearing** (`data:`, `blob:`, `mailto:`, `https://…`) and **literal
|
|
70
|
+
* protocol-relative** (`//cdn.example.com/x`). Neither is a site-relative path, so rooting or
|
|
71
|
+
* prefixing them only corrupts them (`data:image/png;…` → `/data:image/png;…`, a broken
|
|
72
|
+
* `<img src>`).
|
|
73
|
+
*
|
|
74
|
+
* NOTE this is deliberately NOT consulted by `joinUrlPrefix` for the scheme half. A URL-space
|
|
75
|
+
* mount point (`assetUrl`) wants scheme-bearing values handed back untouched; a site ORIGIN
|
|
76
|
+
* (`resolveSeoUrl`) does not - it must still produce an absolute URL, because a non-absolute
|
|
77
|
+
* sitemap `<loc>` invalidates the whole sitemap. Letting the two share one rule silently made
|
|
78
|
+
* `resolveSeoUrl('mailto:a@b.c', { siteUrl })` return `mailto:a@b.c` and drop the origin. Callers
|
|
79
|
+
* that want the pass-through opt in by checking this themselves.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isUnprefixablePath(url: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Make `url` safe to emit AS-IS, changing nothing else.
|
|
84
|
+
*
|
|
85
|
+
* For a caller with no mount point to apply, which must hand a value back byte-identical wherever
|
|
86
|
+
* it legitimately can: an `isUnprefixablePath` value passes straight through, and everything else
|
|
87
|
+
* goes through `toSameOriginPath`, so a value that merely *reads* as off-origin to a browser (the
|
|
88
|
+
* backslash spellings) is still neutralized rather than passed along.
|
|
89
|
+
*/
|
|
90
|
+
export declare function sanitizeUnprefixedPath(url: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Put `prefix` in front of the root-relative `path`, and return `path` untouched when it is
|
|
93
|
+
* already a declared off-site URL.
|
|
94
|
+
*
|
|
95
|
+
* ORDER MATTERS — the absolute check on `path` runs FIRST. An absolute or protocol-relative
|
|
96
|
+
* value is a deliberate off-site pointer (syndication, a partner-hosted copy, a CDN image) and
|
|
97
|
+
* must pass through verbatim; prefixing first turns `https://other.org/page` into
|
|
98
|
+
* `<prefix>/https://other.org/page`.
|
|
99
|
+
*
|
|
100
|
+
* `prefix` normalization, in order:
|
|
101
|
+
* - Empty/undefined, or nothing but slashes (`'/'`, `'///'`) → no prefix at all, so the result
|
|
102
|
+
* stays root-relative. This is what makes an unset option a clean no-op. It also kills a
|
|
103
|
+
* `'//'` prefix, which would otherwise concatenate to `//assets/…` — read by browsers as
|
|
104
|
+
* protocol-relative, i.e. a request to a host literally named `assets`.
|
|
105
|
+
* - A declared off-site prefix (`https://cdn.example.com`, `//cdn.example.com`) is used as-is.
|
|
106
|
+
* A literal protocol-relative prefix is an intentionally-supported off-site pointer here (see
|
|
107
|
+
* `utils/sanitize-href.ts`), so it is NOT collapsed to a path.
|
|
108
|
+
* - Anything else is a same-origin path prefix and is given a leading slash if it lacks one.
|
|
109
|
+
* Without this, a prefix like `preview-123` (the shape an env var often carries) produces a
|
|
110
|
+
* *document-relative* URL that resolves to a different place on every page — an intermittent
|
|
111
|
+
* failure that is harder to diagnose than the plain 404 it replaced.
|
|
112
|
+
*
|
|
113
|
+
* `path` is run through `toSameOriginPath` when it is not a pass-through, so a
|
|
114
|
+
* backslash-equivalent spelling that `isAbsoluteUrl` correctly declines to call "absolute"
|
|
115
|
+
* (see its doc) can't still be read by a browser as protocol-relative once emitted. Note this
|
|
116
|
+
* needs the `//`-pathname collapse, not just neutralization — see `toSameOriginPath`.
|
|
117
|
+
*
|
|
118
|
+
* `prefix` is NOT neutralized: it is adopter-supplied configuration rather than content, and
|
|
119
|
+
* neutralizing it would silently rewrite a legitimate protocol-relative CDN base into a path.
|
|
120
|
+
*/
|
|
121
|
+
export declare function joinUrlPrefix(prefix: string | undefined, path: string): string;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Joining a URL prefix onto a root-relative path, in ONE place.
|
|
3
|
+
*
|
|
4
|
+
* Two surfaces need the identical operation and had drifted into two implementations:
|
|
5
|
+
*
|
|
6
|
+
* - `static/seo.ts`'s `resolveSeoUrl` puts a site origin in front of an entry's URL path.
|
|
7
|
+
* - `assets/asset-url.ts`'s `assetUrl` puts an asset-space mount point in front of a stored
|
|
8
|
+
* `/assets/…` src.
|
|
9
|
+
*
|
|
10
|
+
* The asset copy was the weaker one - it checked neither absoluteness of the path nor the shape
|
|
11
|
+
* of the prefix - so it silently produced `/prefix/https://cdn.example.com/x.png` for an
|
|
12
|
+
* off-site src, and a *document-relative* URL for a prefix that had no leading slash. Both bugs
|
|
13
|
+
* were already solved on the SEO side. Sharing one function is what stops a third caller from
|
|
14
|
+
* inheriting the weaker half again.
|
|
15
|
+
*
|
|
16
|
+
* Dependency-free apart from `./sanitize-href` (itself pure - its only dependency is the global
|
|
17
|
+
* `URL`), because this is reachable from client bundles via `assets/asset-url.ts`. Do not add a
|
|
18
|
+
* node built-in here; `pnpm lint:bundle` fails the build if you do.
|
|
19
|
+
*/
|
|
20
|
+
import { declaresScheme, neutralizeImplicitOffOrigin } from './sanitize-href.js';
|
|
21
|
+
/**
|
|
22
|
+
* Whether `url` is a DECLARED off-site pointer - a scheme-qualified absolute URL
|
|
23
|
+
* (`https://example.com/x`) or a literal protocol-relative one (`//cdn.example.com/x`).
|
|
24
|
+
*
|
|
25
|
+
* Deliberately narrower than "resolves off-origin": a WHATWG-backslash-equivalent spelling
|
|
26
|
+
* (`/\evil.com`, `\\evil.com`, `\/evil.com` — see `utils/sanitize-href.ts`'s
|
|
27
|
+
* `isImplicitlyOffOrigin`) also resolves off-origin in a browser, but is NOT recognized here as
|
|
28
|
+
* an intentional off-site pointer the way a literal `//cdn…` is. Callers handle that case
|
|
29
|
+
* separately, by neutralizing (`neutralizeImplicitOffOrigin`) rather than passing through: a
|
|
30
|
+
* `false` result here isn't a guarantee the value is a safe site-relative path on its own, only
|
|
31
|
+
* that it isn't a *declared* off-site one.
|
|
32
|
+
*/
|
|
33
|
+
export function isAbsoluteUrl(url) {
|
|
34
|
+
return /^[a-z][a-z0-9+.-]*:\/\//i.test(url) || url.startsWith('//');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Strip trailing slashes without a regex.
|
|
38
|
+
*
|
|
39
|
+
* The obvious `replace(/\/+$/, '')` is a polynomial-ReDoS shape (CodeQL
|
|
40
|
+
* `js/polynomial-redos`, flagged high): on a value that is mostly slashes but does not end in
|
|
41
|
+
* one, the engine retries `\/+` from every position and the match cost is quadratic in the
|
|
42
|
+
* input length. Both prefixes that reach here - a `siteUrl` and an asset `baseUrl` - are
|
|
43
|
+
* adopter-supplied and can come from config or an env var, so they count as uncontrolled. A
|
|
44
|
+
* character scan is linear and needs no reasoning about backtracking.
|
|
45
|
+
*
|
|
46
|
+
* Exported (from `canopycms/server`) so adopter code normalizing its own site-origin env var —
|
|
47
|
+
* e.g. a `SITE_URL` constant built from `NEXT_PUBLIC_SITE_URL` — has a package-provided linear
|
|
48
|
+
* way to do it instead of reaching for the same regex this function replaced.
|
|
49
|
+
*/
|
|
50
|
+
export function stripTrailingSlashes(value) {
|
|
51
|
+
let end = value.length;
|
|
52
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47 /* '/' */)
|
|
53
|
+
end--;
|
|
54
|
+
return value.slice(0, end);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Reduce a URL reference to a value that is safe to emit as a SAME-ORIGIN path.
|
|
58
|
+
*
|
|
59
|
+
* `neutralizeImplicitOffOrigin` alone is not sufficient, and this is the subtle part: it returns
|
|
60
|
+
* `pathname + search + hash`, and a WHATWG `pathname` can ITSELF begin with `//`. `/\evil.com//a`
|
|
61
|
+
* parses to host `evil.com` with pathname `//a`, so neutralizing yields the string `//a` — which,
|
|
62
|
+
* re-emitted as a URL reference, reads as protocol-relative all over again and points at a host
|
|
63
|
+
* literally named `a`. Neutralizing a second time does not help: the value is now indistinguishable
|
|
64
|
+
* from a caller's legitimate `//cdn.example.com` pointer, so every absolute-URL check downstream
|
|
65
|
+
* (correctly) passes it straight through, prefix and all.
|
|
66
|
+
*
|
|
67
|
+
* The value is same-origin by construction at this point, so collapse the leading slash run to a
|
|
68
|
+
* single slash. Linear scan rather than a regex, for the reason `stripTrailingSlashes` documents.
|
|
69
|
+
*
|
|
70
|
+
* Use this instead of calling `neutralizeImplicitOffOrigin` directly anywhere the result is going
|
|
71
|
+
* to be prefixed or emitted as a path.
|
|
72
|
+
*/
|
|
73
|
+
export function toSameOriginPath(url) {
|
|
74
|
+
const neutralized = neutralizeImplicitOffOrigin(url);
|
|
75
|
+
let slashes = 0;
|
|
76
|
+
while (slashes < neutralized.length && neutralized.charCodeAt(slashes) === 47 /* '/' */)
|
|
77
|
+
slashes++;
|
|
78
|
+
return slashes > 1 ? `/${neutralized.slice(slashes)}` : neutralized;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Whether `url` is something a prefix cannot meaningfully be put in front of.
|
|
82
|
+
*
|
|
83
|
+
* Two kinds: **scheme-bearing** (`data:`, `blob:`, `mailto:`, `https://…`) and **literal
|
|
84
|
+
* protocol-relative** (`//cdn.example.com/x`). Neither is a site-relative path, so rooting or
|
|
85
|
+
* prefixing them only corrupts them (`data:image/png;…` → `/data:image/png;…`, a broken
|
|
86
|
+
* `<img src>`).
|
|
87
|
+
*
|
|
88
|
+
* NOTE this is deliberately NOT consulted by `joinUrlPrefix` for the scheme half. A URL-space
|
|
89
|
+
* mount point (`assetUrl`) wants scheme-bearing values handed back untouched; a site ORIGIN
|
|
90
|
+
* (`resolveSeoUrl`) does not - it must still produce an absolute URL, because a non-absolute
|
|
91
|
+
* sitemap `<loc>` invalidates the whole sitemap. Letting the two share one rule silently made
|
|
92
|
+
* `resolveSeoUrl('mailto:a@b.c', { siteUrl })` return `mailto:a@b.c` and drop the origin. Callers
|
|
93
|
+
* that want the pass-through opt in by checking this themselves.
|
|
94
|
+
*/
|
|
95
|
+
export function isUnprefixablePath(url) {
|
|
96
|
+
return declaresScheme(url) || isAbsoluteUrl(url);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Make `url` safe to emit AS-IS, changing nothing else.
|
|
100
|
+
*
|
|
101
|
+
* For a caller with no mount point to apply, which must hand a value back byte-identical wherever
|
|
102
|
+
* it legitimately can: an `isUnprefixablePath` value passes straight through, and everything else
|
|
103
|
+
* goes through `toSameOriginPath`, so a value that merely *reads* as off-origin to a browser (the
|
|
104
|
+
* backslash spellings) is still neutralized rather than passed along.
|
|
105
|
+
*/
|
|
106
|
+
export function sanitizeUnprefixedPath(url) {
|
|
107
|
+
if (isUnprefixablePath(url))
|
|
108
|
+
return url;
|
|
109
|
+
return toSameOriginPath(url);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Put `prefix` in front of the root-relative `path`, and return `path` untouched when it is
|
|
113
|
+
* already a declared off-site URL.
|
|
114
|
+
*
|
|
115
|
+
* ORDER MATTERS — the absolute check on `path` runs FIRST. An absolute or protocol-relative
|
|
116
|
+
* value is a deliberate off-site pointer (syndication, a partner-hosted copy, a CDN image) and
|
|
117
|
+
* must pass through verbatim; prefixing first turns `https://other.org/page` into
|
|
118
|
+
* `<prefix>/https://other.org/page`.
|
|
119
|
+
*
|
|
120
|
+
* `prefix` normalization, in order:
|
|
121
|
+
* - Empty/undefined, or nothing but slashes (`'/'`, `'///'`) → no prefix at all, so the result
|
|
122
|
+
* stays root-relative. This is what makes an unset option a clean no-op. It also kills a
|
|
123
|
+
* `'//'` prefix, which would otherwise concatenate to `//assets/…` — read by browsers as
|
|
124
|
+
* protocol-relative, i.e. a request to a host literally named `assets`.
|
|
125
|
+
* - A declared off-site prefix (`https://cdn.example.com`, `//cdn.example.com`) is used as-is.
|
|
126
|
+
* A literal protocol-relative prefix is an intentionally-supported off-site pointer here (see
|
|
127
|
+
* `utils/sanitize-href.ts`), so it is NOT collapsed to a path.
|
|
128
|
+
* - Anything else is a same-origin path prefix and is given a leading slash if it lacks one.
|
|
129
|
+
* Without this, a prefix like `preview-123` (the shape an env var often carries) produces a
|
|
130
|
+
* *document-relative* URL that resolves to a different place on every page — an intermittent
|
|
131
|
+
* failure that is harder to diagnose than the plain 404 it replaced.
|
|
132
|
+
*
|
|
133
|
+
* `path` is run through `toSameOriginPath` when it is not a pass-through, so a
|
|
134
|
+
* backslash-equivalent spelling that `isAbsoluteUrl` correctly declines to call "absolute"
|
|
135
|
+
* (see its doc) can't still be read by a browser as protocol-relative once emitted. Note this
|
|
136
|
+
* needs the `//`-pathname collapse, not just neutralization — see `toSameOriginPath`.
|
|
137
|
+
*
|
|
138
|
+
* `prefix` is NOT neutralized: it is adopter-supplied configuration rather than content, and
|
|
139
|
+
* neutralizing it would silently rewrite a legitimate protocol-relative CDN base into a path.
|
|
140
|
+
*/
|
|
141
|
+
export function joinUrlPrefix(prefix, path) {
|
|
142
|
+
// Only a DECLARED off-site pointer passes through. A scheme-bearing but non-absolute value
|
|
143
|
+
// (`mailto:x`, `data:…`) is rooted, which is what a site origin needs - see
|
|
144
|
+
// `isUnprefixablePath` for why this deliberately differs from the asset-mount case.
|
|
145
|
+
if (isAbsoluteUrl(path))
|
|
146
|
+
return path;
|
|
147
|
+
const safePath = toSameOriginPath(path);
|
|
148
|
+
const normalizedPath = safePath.startsWith('/') ? safePath : `/${safePath}`;
|
|
149
|
+
if (!prefix)
|
|
150
|
+
return normalizedPath;
|
|
151
|
+
const trimmedPrefix = stripTrailingSlashes(prefix);
|
|
152
|
+
if (!trimmedPrefix)
|
|
153
|
+
return normalizedPath;
|
|
154
|
+
const normalizedPrefix = isAbsoluteUrl(trimmedPrefix) || trimmedPrefix.startsWith('/')
|
|
155
|
+
? trimmedPrefix
|
|
156
|
+
: `/${trimmedPrefix}`;
|
|
157
|
+
return `${normalizedPrefix}${normalizedPath}`;
|
|
158
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys a block item carries that are STRUCTURE rather than content.
|
|
3
|
+
*
|
|
4
|
+
* A block on disk is `{ template: 'hero', value: { ...fields } }` — the canonical shape the
|
|
5
|
+
* editor writes and `ContentStore` persists — or, defensively, the inline `{ _type: 'hero',
|
|
6
|
+
* ...fields }` shape (see `resolveBlockItem` in `./field-traversal`). Either way the
|
|
7
|
+
* discriminator names the block's TEMPLATE, which is a category label shared by every block of
|
|
8
|
+
* that kind, not an identifier for this particular block.
|
|
9
|
+
*
|
|
10
|
+
* That distinction matters to two callers for opposite-looking reasons, which is why the list
|
|
11
|
+
* lives here rather than in either of them:
|
|
12
|
+
*
|
|
13
|
+
* - `findUnknownKeys` (./entry-validator) must not report the discriminator as a stale key: it
|
|
14
|
+
* is not a schema field, but it is supposed to be there.
|
|
15
|
+
* - `looksLikeSameItem` (../utils/content-serialize) must not accept the discriminator as
|
|
16
|
+
* evidence that two list items are the same item: two `hero` blocks share `template: hero`,
|
|
17
|
+
* so counting it migrated an editorial comment off a deleted block onto an unrelated
|
|
18
|
+
* survivor.
|
|
19
|
+
*
|
|
20
|
+
* A single list keeps those two from drifting apart — a third discriminator added for one of
|
|
21
|
+
* them but not the other would resurrect exactly one of those bugs.
|
|
22
|
+
*
|
|
23
|
+
* Note that two other readers deliberately still spell the keys out themselves, because they
|
|
24
|
+
* READ the discriminator's value positionally rather than testing membership, and they do not
|
|
25
|
+
* agree on precedence: `resolveBlockItem` prefers `template`, while `ai/json-to-markdown.ts`
|
|
26
|
+
* prefers `_type`. Reconciling that is a behaviour question, not a refactor — see
|
|
27
|
+
* `.claude/future-tasks/block-discriminator-precedence-disagreement.md`.
|
|
28
|
+
*
|
|
29
|
+
* Dependency-free on purpose: both importers are reachable from contexts that must not pull in
|
|
30
|
+
* schema types or node built-ins.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* The discriminator keys, in the precedence `resolveBlockItem` reads them.
|
|
34
|
+
*
|
|
35
|
+
* Ordered (rather than a bare Set) so a caller that needs the VALUE can iterate it, and so the
|
|
36
|
+
* canonical shape's key stays visibly first.
|
|
37
|
+
*/
|
|
38
|
+
export declare const BLOCK_DISCRIMINATOR_KEYS: readonly ["template", "_type"];
|
|
39
|
+
/** Membership form of {@link BLOCK_DISCRIMINATOR_KEYS}, for the two set-test callers. */
|
|
40
|
+
export declare const BLOCK_STRUCTURAL_KEYS: ReadonlySet<string>;
|
|
41
|
+
/** True for a key that names a block's template rather than holding any of its content. */
|
|
42
|
+
export declare function isBlockStructuralKey(key: string): boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys a block item carries that are STRUCTURE rather than content.
|
|
3
|
+
*
|
|
4
|
+
* A block on disk is `{ template: 'hero', value: { ...fields } }` — the canonical shape the
|
|
5
|
+
* editor writes and `ContentStore` persists — or, defensively, the inline `{ _type: 'hero',
|
|
6
|
+
* ...fields }` shape (see `resolveBlockItem` in `./field-traversal`). Either way the
|
|
7
|
+
* discriminator names the block's TEMPLATE, which is a category label shared by every block of
|
|
8
|
+
* that kind, not an identifier for this particular block.
|
|
9
|
+
*
|
|
10
|
+
* That distinction matters to two callers for opposite-looking reasons, which is why the list
|
|
11
|
+
* lives here rather than in either of them:
|
|
12
|
+
*
|
|
13
|
+
* - `findUnknownKeys` (./entry-validator) must not report the discriminator as a stale key: it
|
|
14
|
+
* is not a schema field, but it is supposed to be there.
|
|
15
|
+
* - `looksLikeSameItem` (../utils/content-serialize) must not accept the discriminator as
|
|
16
|
+
* evidence that two list items are the same item: two `hero` blocks share `template: hero`,
|
|
17
|
+
* so counting it migrated an editorial comment off a deleted block onto an unrelated
|
|
18
|
+
* survivor.
|
|
19
|
+
*
|
|
20
|
+
* A single list keeps those two from drifting apart — a third discriminator added for one of
|
|
21
|
+
* them but not the other would resurrect exactly one of those bugs.
|
|
22
|
+
*
|
|
23
|
+
* Note that two other readers deliberately still spell the keys out themselves, because they
|
|
24
|
+
* READ the discriminator's value positionally rather than testing membership, and they do not
|
|
25
|
+
* agree on precedence: `resolveBlockItem` prefers `template`, while `ai/json-to-markdown.ts`
|
|
26
|
+
* prefers `_type`. Reconciling that is a behaviour question, not a refactor — see
|
|
27
|
+
* `.claude/future-tasks/block-discriminator-precedence-disagreement.md`.
|
|
28
|
+
*
|
|
29
|
+
* Dependency-free on purpose: both importers are reachable from contexts that must not pull in
|
|
30
|
+
* schema types or node built-ins.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* The discriminator keys, in the precedence `resolveBlockItem` reads them.
|
|
34
|
+
*
|
|
35
|
+
* Ordered (rather than a bare Set) so a caller that needs the VALUE can iterate it, and so the
|
|
36
|
+
* canonical shape's key stays visibly first.
|
|
37
|
+
*/
|
|
38
|
+
export const BLOCK_DISCRIMINATOR_KEYS = ['template', '_type'];
|
|
39
|
+
/** Membership form of {@link BLOCK_DISCRIMINATOR_KEYS}, for the two set-test callers. */
|
|
40
|
+
export const BLOCK_STRUCTURAL_KEYS = new Set(BLOCK_DISCRIMINATOR_KEYS);
|
|
41
|
+
/** True for a key that names a block's template rather than holding any of its content. */
|
|
42
|
+
export function isBlockStructuralKey(key) {
|
|
43
|
+
return BLOCK_STRUCTURAL_KEYS.has(key);
|
|
44
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ContentStore } from '../content-store';
|
|
2
|
-
import type { ContentIdIndex } from '../content-id-index';
|
|
3
|
-
import type { FieldConfig } from '../config';
|
|
4
|
-
import { type LogicalPath, type Slug } from '../paths';
|
|
1
|
+
import type { ContentStore } from '../content-store.js';
|
|
2
|
+
import type { ContentIdIndex } from '../content-id-index.js';
|
|
3
|
+
import type { FieldConfig } from '../config/index.js';
|
|
4
|
+
import { type LogicalPath, type Slug } from '../paths/index.js';
|
|
5
5
|
export interface ReferenceInfo {
|
|
6
6
|
entryPath: string;
|
|
7
7
|
entryTitle?: string;
|
|
@@ -63,4 +63,3 @@ export declare class DeletionChecker {
|
|
|
63
63
|
*/
|
|
64
64
|
private listEntriesInCollection;
|
|
65
65
|
}
|
|
66
|
-
//# sourceMappingURL=deletion-checker.d.ts.map
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* This parallels ReferenceValidator but operates on inline links in text content
|
|
7
7
|
* rather than structured reference fields.
|
|
8
8
|
*/
|
|
9
|
-
import type { ContentIdIndex } from '../content-id-index';
|
|
10
|
-
import type { FieldConfig } from '../config';
|
|
9
|
+
import type { ContentIdIndex } from '../content-id-index.js';
|
|
10
|
+
import type { FieldConfig } from '../config/index.js';
|
|
11
11
|
export interface EntryLinkWarning {
|
|
12
12
|
field: string;
|
|
13
13
|
fieldPath: string;
|
|
@@ -24,4 +24,3 @@ export interface EntryLinkValidationResult {
|
|
|
24
24
|
* and checks that each referenced ID exists in the content index.
|
|
25
25
|
*/
|
|
26
26
|
export declare function validateEntryLinks(data: Record<string, unknown>, schema: readonly FieldConfig[], idIndex: ContentIdIndex, bodyContent?: string): EntryLinkValidationResult;
|
|
27
|
-
//# sourceMappingURL=entry-link-validator.d.ts.map
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* at entry-schema *registration* (entry-schema-registry.ts), before any branch
|
|
14
14
|
* schema exists, and so cannot perform this check.
|
|
15
15
|
*/
|
|
16
|
-
import type { RootCollectionConfig } from '../config';
|
|
16
|
+
import type { RootCollectionConfig } from '../config/index.js';
|
|
17
17
|
/**
|
|
18
18
|
* Collect every entry type name defined anywhere in the schema.
|
|
19
19
|
*
|
|
@@ -30,4 +30,3 @@ export declare const collectEntryTypeNames: (schema: RootCollectionConfig) => Se
|
|
|
30
30
|
* @returns One human-readable message per offending value; empty when valid.
|
|
31
31
|
*/
|
|
32
32
|
export declare const validateReferenceEntryTypes: (schema: RootCollectionConfig) => string[];
|
|
33
|
-
//# sourceMappingURL=entry-type-reference-validator.d.ts.map
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* content ID index (filesystem) and is enforced server-side only, by running
|
|
22
22
|
* `ReferenceValidator` at the write boundary.
|
|
23
23
|
*/
|
|
24
|
-
import type { ContentFormat, EntrySchema } from '../config';
|
|
24
|
+
import type { ContentFormat, EntrySchema } from '../config/index.js';
|
|
25
25
|
/**
|
|
26
26
|
* One per-field validation error. `fieldPath` uses the canonical CanopyCMS
|
|
27
27
|
* path format shared with field-traversal and the editor's canopy-path
|
|
@@ -56,6 +56,28 @@ export declare function validateEntryData(fields: EntrySchema, data: Record<stri
|
|
|
56
56
|
* schema's body field before validating so required/type checks see it.
|
|
57
57
|
*/
|
|
58
58
|
export declare function validateEntryFormValue(fields: EntrySchema, format: ContentFormat | undefined, value: Record<string, unknown>): EntryFieldError[];
|
|
59
|
+
/**
|
|
60
|
+
* Find data keys that have no counterpart in the schema, as canonical field paths
|
|
61
|
+
* (`author.nickname`, `blocks[2].headline`).
|
|
62
|
+
*
|
|
63
|
+
* `validateEntryData` iterates the SCHEMA, so it can only ever report fields the schema knows
|
|
64
|
+
* about. Nothing reported the inverse: rename or reshape a field and the old key persists on
|
|
65
|
+
* disk forever, because the editor's form state is the whole record verbatim and every save
|
|
66
|
+
* posts it back. The only symptom is a component quietly receiving `undefined`.
|
|
67
|
+
*
|
|
68
|
+
* Pure — safe in the browser. Reports rather than rejects: a save carrying a stale key still
|
|
69
|
+
* succeeds (and now the write path even preserves the key and its comments), so this feeds the
|
|
70
|
+
* non-blocking `validationWarnings` channel, not the 422 path.
|
|
71
|
+
*
|
|
72
|
+
* Two things it deliberately does not report:
|
|
73
|
+
*
|
|
74
|
+
* - **A container with no fields at all.** `api/content.ts` falls back to `[]` for a collection
|
|
75
|
+
* with no configured entry type; "no schema" is not "every key is unknown".
|
|
76
|
+
* - **Anything inside a `reference` value.** Reads resolve references by default, so a reference
|
|
77
|
+
* field's value is `{ ...target data, id, slug, collection, urlPath }`. The traversal only
|
|
78
|
+
* descends into `object` and `block`, so it never looks inside one.
|
|
79
|
+
*/
|
|
80
|
+
export declare function findUnknownKeys(fields: EntrySchema, data: Record<string, unknown>): string[];
|
|
59
81
|
/**
|
|
60
82
|
* Return a copy of `data` with resolved reference objects (`{ id, ... }`)
|
|
61
83
|
* collapsed back to their id strings, recursing through objects, lists, and
|
|
@@ -64,4 +86,3 @@ export declare function validateEntryFormValue(fields: EntrySchema, format: Cont
|
|
|
64
86
|
* that may still carry resolved objects from a prior read.
|
|
65
87
|
*/
|
|
66
88
|
export declare function normalizeReferenceValues(fields: EntrySchema, data: Record<string, unknown>): Record<string, unknown>;
|
|
67
|
-
//# sourceMappingURL=entry-validator.d.ts.map
|