canopycms 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/generate.js +5 -5
- package/dist/ai/generate.js.map +1 -1
- package/dist/ai/handler.js +5 -5
- package/dist/ai/index.js +3 -3
- package/dist/ai/resolve-branch.js +2 -2
- package/dist/api/__test__/mock-client.js +1 -1
- package/dist/api/assets.js +1 -1
- package/dist/api/branch-merge.js +3 -3
- package/dist/api/branch-review.js +4 -4
- package/dist/api/branch-status.js +8 -8
- package/dist/api/branch-withdraw.js +5 -5
- package/dist/api/branch.js +9 -9
- package/dist/api/comments.js +4 -4
- package/dist/api/content.js +5 -5
- package/dist/api/entries.d.ts.map +1 -1
- package/dist/api/entries.js +57 -145
- package/dist/api/entries.js.map +1 -1
- package/dist/api/github-sync.js +3 -3
- package/dist/api/groups.js +4 -4
- package/dist/api/guards.js +1 -1
- package/dist/api/index.js +3 -3
- package/dist/api/permissions.js +4 -4
- package/dist/api/reference-options.js +5 -5
- package/dist/api/resolve-references.js +4 -4
- package/dist/api/route-builder.js +1 -1
- package/dist/api/schema.js +5 -5
- package/dist/api/settings-helpers.js +1 -1
- package/dist/api/user.js +1 -1
- package/dist/api/validators.js +3 -3
- package/dist/asset-store.js +1 -1
- package/dist/auth/cache.js +2 -2
- package/dist/auth/caching-auth-plugin.js +1 -1
- package/dist/auth/file-based-auth-cache.js +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/authorization/branch.js +1 -1
- package/dist/authorization/content.js +3 -3
- package/dist/authorization/groups/index.js +2 -2
- package/dist/authorization/groups/loader.js +4 -4
- package/dist/authorization/index.js +8 -8
- package/dist/authorization/path.js +1 -1
- package/dist/authorization/permissions/index.js +2 -2
- package/dist/authorization/permissions/loader.js +3 -3
- package/dist/authorization/permissions/schema.js +1 -1
- package/dist/authorization/test-utils.js +1 -1
- package/dist/authorization/validation.js +1 -1
- package/dist/branch-metadata.js +3 -3
- package/dist/branch-registry.js +2 -2
- package/dist/branch-schema-cache.js +2 -2
- package/dist/branch-workspace.js +6 -6
- package/dist/build/generate-ai-content.js +4 -4
- package/dist/build/index.js +1 -1
- package/dist/cli/cli.js +5 -5
- package/dist/cli/generate-ai-content.js +12 -13
- package/dist/cli/init.js +4 -11
- package/dist/cli/sync.js +1 -1
- package/dist/client.js +9 -9
- package/dist/config/flatten.js +2 -2
- package/dist/config/helpers.js +3 -3
- package/dist/config/index.js +9 -9
- package/dist/config/schemas/collection.js +1 -1
- package/dist/config/schemas/config.js +2 -2
- package/dist/config/schemas/field.d.ts +21 -0
- package/dist/config/schemas/field.d.ts.map +1 -1
- package/dist/config/schemas/field.js +2 -1
- package/dist/config/schemas/field.js.map +1 -1
- package/dist/config/types.d.ts +2 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/validation.js +2 -2
- package/dist/config-test.js +2 -2
- package/dist/config.js +2 -2
- package/dist/content-id-index.js +2 -2
- package/dist/content-listing.d.ts +67 -2
- package/dist/content-listing.d.ts.map +1 -1
- package/dist/content-listing.js +95 -13
- package/dist/content-listing.js.map +1 -1
- package/dist/content-reader.js +5 -5
- package/dist/content-store.d.ts +1 -1
- package/dist/content-store.d.ts.map +1 -1
- package/dist/content-store.js +6 -6
- package/dist/content-store.js.map +1 -1
- package/dist/content-tree.d.ts +11 -5
- package/dist/content-tree.d.ts.map +1 -1
- package/dist/content-tree.js +3 -1
- package/dist/content-tree.js.map +1 -1
- package/dist/context.d.ts +3 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +24 -6
- package/dist/context.js.map +1 -1
- package/dist/editor/BranchManager.js +4 -4
- package/dist/editor/CanopyEditor.js +3 -3
- package/dist/editor/CanopyEditorPage.js +1 -1
- package/dist/editor/CommentsPanel.js +1 -1
- package/dist/editor/Editor.js +18 -18
- package/dist/editor/EntryNavigator.js +1 -1
- package/dist/editor/FormRenderer.js +12 -12
- package/dist/editor/GroupManager.js +1 -1
- package/dist/editor/PermissionManager.js +1 -1
- package/dist/editor/client-reference-resolver.js +1 -1
- package/dist/editor/comments/BranchComments.js +1 -1
- package/dist/editor/comments/EntryComments.js +1 -1
- package/dist/editor/comments/FieldWrapper.js +1 -1
- package/dist/editor/comments/InlineCommentThread.js +1 -1
- package/dist/editor/comments/ThreadCarousel.js +1 -1
- package/dist/editor/components/EditorHeader.js +1 -1
- package/dist/editor/components/UserBadge.js +1 -1
- package/dist/editor/components/index.js +3 -3
- package/dist/editor/context/ApiClientContext.js +1 -1
- package/dist/editor/context/index.js +2 -2
- package/dist/editor/editor-utils.js +1 -1
- package/dist/editor/fields/BlockField.js +1 -1
- package/dist/editor/fields/ObjectField.js +1 -1
- package/dist/editor/fields/ReferenceField.js +1 -1
- package/dist/editor/group-manager/GroupCard.js +1 -1
- package/dist/editor/group-manager/InternalGroupsTab.js +1 -1
- package/dist/editor/group-manager/MemberList.js +1 -1
- package/dist/editor/group-manager/index.js +9 -9
- package/dist/editor/hooks/__test__/test-utils.js +3 -3
- package/dist/editor/hooks/index.js +11 -11
- package/dist/editor/hooks/useBranchActions.js +1 -1
- package/dist/editor/hooks/useBranchManager.js +1 -1
- package/dist/editor/hooks/useCommentSystem.js +2 -2
- package/dist/editor/hooks/useDraftManager.js +1 -1
- package/dist/editor/hooks/useEntryManager.js +3 -3
- package/dist/editor/hooks/useGroupManager.js +1 -1
- package/dist/editor/hooks/usePermissionManager.js +1 -1
- package/dist/editor/hooks/useReferenceResolution.js +1 -1
- package/dist/editor/hooks/useSchemaManager.js +1 -1
- package/dist/editor/hooks/useUserContext.js +1 -1
- package/dist/editor/permission-manager/PermissionEditor.js +4 -4
- package/dist/editor/permission-manager/PermissionLevelBadge.js +1 -1
- package/dist/editor/permission-manager/PermissionTree.js +3 -3
- package/dist/editor/permission-manager/UserSelector.js +1 -1
- package/dist/editor/permission-manager/hooks/usePermissionTree.js +2 -2
- package/dist/editor/permission-manager/index.js +6 -6
- package/dist/editor/preview-bridge.js +1 -1
- package/dist/editor/schema-editor/CollectionEditor.js +2 -2
- package/dist/editor/schema-editor/index.js +2 -2
- package/dist/entry-schema-registry.d.ts.map +1 -1
- package/dist/entry-schema-registry.js +34 -2
- package/dist/entry-schema-registry.js.map +1 -1
- package/dist/entry-schema.d.ts +1 -0
- package/dist/entry-schema.d.ts.map +1 -1
- package/dist/entry-schema.js.map +1 -1
- package/dist/git-manager.js +4 -4
- package/dist/github-service.js +1 -1
- package/dist/http/handler.js +7 -7
- package/dist/http/index.js +3 -3
- package/dist/http/router.js +12 -12
- package/dist/id.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/operating-mode/client-unsafe-strategy.js +2 -2
- package/dist/operating-mode/client.js +1 -1
- package/dist/operating-mode/index.js +2 -2
- package/dist/paths/branch.js +1 -1
- package/dist/paths/index.js +6 -6
- package/dist/paths/test-utils.js +1 -1
- package/dist/paths/validation.js +1 -1
- package/dist/reference-resolver.js +2 -2
- package/dist/reference-resolver.js.map +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schema/meta-loader.d.ts.map +1 -1
- package/dist/schema/meta-loader.js +11 -1
- package/dist/schema/meta-loader.js.map +1 -1
- package/dist/schema/resolver.js +1 -1
- package/dist/schema/schema-store.js +4 -4
- package/dist/server.d.ts +3 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +13 -12
- package/dist/server.js.map +1 -1
- package/dist/services.js +12 -12
- package/dist/settings-branch-utils.js +1 -1
- package/dist/settings-workspace.js +3 -3
- package/dist/task-queue/index.js +1 -1
- package/dist/task-queue/task-queue.js +1 -1
- package/dist/user.js +1 -1
- package/dist/utils/fs.js +1 -1
- package/dist/utils/title-field.d.ts +40 -0
- package/dist/utils/title-field.d.ts.map +1 -0
- package/dist/utils/title-field.js +126 -0
- package/dist/utils/title-field.js.map +1 -0
- package/dist/validation/reference-validator.js +2 -2
- package/dist/worker/cms-worker.js +5 -5
- package/dist/worker/task-queue-config.js +1 -1
- package/dist/worker/task-queue.js +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar, Badge, Tooltip, Group, Text, Skeleton, ActionIcon } from '@mantine/core';
|
|
3
3
|
import { IconUserOff, IconX } from '@tabler/icons-react';
|
|
4
|
-
import { useUserMetadata } from '../hooks/useUserMetadata';
|
|
4
|
+
import { useUserMetadata } from '../hooks/useUserMetadata.js';
|
|
5
5
|
export const UserBadge = ({ userId, getUserMetadata, variant = 'avatar-name', showEmailTooltip = true, onRemove, color, size = 'sm', badgeVariant = 'filled', showBadge = false, loading: loadingOverride, cachedUser, }) => {
|
|
6
6
|
const { userMetadata, isLoading, error } = useUserMetadata(userId, getUserMetadata, cachedUser);
|
|
7
7
|
const loading = loadingOverride ?? isLoading;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Barrel export for all Editor UI components
|
|
2
2
|
// Export components as they are created
|
|
3
|
-
export * from './EditorFooter';
|
|
4
|
-
export * from './EditorHeader';
|
|
5
|
-
export * from './EditorSidebar';
|
|
3
|
+
export * from './EditorFooter.js';
|
|
4
|
+
export * from './EditorHeader.js';
|
|
5
|
+
export * from './EditorSidebar.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -10,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
* - No global mutable state
|
|
11
11
|
*/
|
|
12
12
|
import { createContext, useContext, useMemo } from 'react';
|
|
13
|
-
import { createApiClient } from '../../api';
|
|
13
|
+
import { createApiClient } from '../../api/index.js';
|
|
14
14
|
const ApiClientContext = createContext(null);
|
|
15
15
|
/**
|
|
16
16
|
* Provider that creates and provides the API client.
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
* </ApiClientProvider>
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
export { ApiClientProvider, useApiClient, useOptionalApiClient, } from './ApiClientContext';
|
|
19
|
-
export { EditorStateProvider, useEditorState, useEditorLoading, useEditorModals, useEditorPreview, } from './EditorStateContext';
|
|
18
|
+
export { ApiClientProvider, useApiClient, useOptionalApiClient, } from './ApiClientContext.js';
|
|
19
|
+
export { EditorStateProvider, useEditorState, useEditorLoading, useEditorModals, useEditorPreview, } from './EditorStateContext.js';
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Import directly from normalize to avoid pulling in server-only branch.ts
|
|
2
|
-
import { normalizeCollectionPath } from '../paths/normalize';
|
|
2
|
+
import { normalizeCollectionPath } from '../paths/normalize.js';
|
|
3
3
|
export { normalizeCollectionPath };
|
|
4
4
|
export const encodeSlug = (value) => (value ?? '')
|
|
5
5
|
.split('/')
|
|
@@ -5,7 +5,7 @@ import { ActionIcon, Button, Group, Paper, Select, Stack, Text } from '@mantine/
|
|
|
5
5
|
import { DndContext, KeyboardSensor, PointerSensor, useSensor, useSensors, } from '@dnd-kit/core';
|
|
6
6
|
import { SortableContext, arrayMove, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy, } from '@dnd-kit/sortable';
|
|
7
7
|
import { CSS } from '@dnd-kit/utilities';
|
|
8
|
-
import { formatCanopyPath } from '../canopy-path';
|
|
8
|
+
import { formatCanopyPath } from '../canopy-path.js';
|
|
9
9
|
const findTemplate = (templates, name) => templates.find((t) => t.name === name);
|
|
10
10
|
const SortableBlock = ({ id, children }) => {
|
|
11
11
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Paper, Stack, Text } from '@mantine/core';
|
|
3
|
-
import { formatCanopyPath } from '../canopy-path';
|
|
3
|
+
import { formatCanopyPath } from '../canopy-path.js';
|
|
4
4
|
export const ObjectField = ({ label, fields, value, onChange, renderField, path, dataCanopyField, }) => {
|
|
5
5
|
const current = value ?? {};
|
|
6
6
|
return (_jsx(Paper, { withBorder: true, radius: "md", p: "md", bg: "gray.0", "data-canopy-field": dataCanopyField ?? formatCanopyPath(path), shadow: "xs", children: _jsxs(Stack, { gap: "sm", children: [label && (_jsx(Text, { size: "xs", fw: 700, c: "neutral.8", children: label })), _jsx(Stack, { gap: "sm", children: fields.map((field) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useState } from 'react';
|
|
3
3
|
import { MultiSelect, Select, Stack, Text, Loader } from '@mantine/core';
|
|
4
|
-
import { createApiClient } from '../../api/client';
|
|
4
|
+
import { createApiClient } from '../../api/client.js';
|
|
5
5
|
export const ReferenceField = ({ id, label, options: staticOptions, collections, displayField = 'title', branch = 'main', value, onChange, multiple, dataCanopyField, }) => {
|
|
6
6
|
const needsFetch = !staticOptions && !!collections && collections.length > 0;
|
|
7
7
|
const [options, setOptions] = useState(staticOptions || []);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ActionIcon, Badge, Group, Paper, Text, Tooltip } from '@mantine/core';
|
|
4
4
|
import { IconEdit, IconTrash } from '@tabler/icons-react';
|
|
5
|
-
import { MemberList } from './MemberList';
|
|
5
|
+
import { MemberList } from './MemberList.js';
|
|
6
6
|
export const GroupCard = ({ group, onEdit, onDelete, onAddMember, onRemoveMember, onGetUserMetadata, showUserSearch, searchQuery, searchResults, isSearching, searchError, onSearchQueryChange, onShowSearch, onHideSearch, canSearch, }) => {
|
|
7
7
|
return (_jsxs(Paper, { withBorder: true, p: "sm", mb: "xs", children: [_jsxs(Group, { justify: "space-between", mb: "sm", children: [_jsxs("div", { style: { flex: 1 }, children: [_jsxs(Group, { gap: "xs", children: [_jsx(Text, { size: "sm", fw: 500, children: group.name }), _jsxs(Badge, { size: "sm", variant: "light", children: [group.members?.length || 0, " members"] })] }), _jsxs(Text, { size: "xs", c: "dimmed", mt: 4, children: ["ID: ", group.id] }), group.description && (_jsx(Text, { size: "xs", c: "dimmed", mt: 4, children: group.description }))] }), _jsxs(Group, { gap: "xs", children: [_jsx(Tooltip, { label: "Edit group", children: _jsx(ActionIcon, { size: "sm", variant: "subtle", onClick: () => onEdit(group), children: _jsx(IconEdit, { size: 16 }) }) }), _jsx(Tooltip, { label: "Delete group", children: _jsx(ActionIcon, { size: "sm", variant: "subtle", color: "red", onClick: () => onDelete(group.id), children: _jsx(IconTrash, { size: 16 }) }) })] })] }), _jsx(MemberList, { groupId: group.id, members: group.members || [], onRemoveMember: onRemoveMember, onAddMember: onAddMember, onGetUserMetadata: onGetUserMetadata, showUserSearch: showUserSearch, searchQuery: searchQuery, searchResults: searchResults, isSearching: isSearching, searchError: searchError, onSearchQueryChange: onSearchQueryChange, onShowSearch: onShowSearch, onHideSearch: onHideSearch, canSearch: canSearch })] }));
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Button, Group, Paper, ScrollArea, Stack, Text } from '@mantine/core';
|
|
4
4
|
import { IconPlus, IconUsers } from '@tabler/icons-react';
|
|
5
|
-
import { GroupCard } from './GroupCard';
|
|
5
|
+
import { GroupCard } from './GroupCard.js';
|
|
6
6
|
export const InternalGroupsTab = ({ groups, canEdit, onCreateGroup, onEditGroup, onDeleteGroup, onAddMember, onRemoveMember, onGetUserMetadata, activeSearchGroupId, searchQuery, searchResults, isSearching, searchError, onSearchQueryChange, onShowSearch, onHideSearch, canSearch, }) => {
|
|
7
7
|
// Read-only view
|
|
8
8
|
if (!canEdit) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ActionIcon, Badge, Button, Group, Loader, Paper, Stack, Text, TextInput, } from '@mantine/core';
|
|
4
4
|
import { IconSearch, IconX } from '@tabler/icons-react';
|
|
5
|
-
import { UserBadge } from '../components/UserBadge';
|
|
5
|
+
import { UserBadge } from '../components/UserBadge.js';
|
|
6
6
|
export const MemberList = ({ groupId, members, onRemoveMember, onAddMember, onGetUserMetadata, showUserSearch, searchQuery, searchResults, isSearching, searchError, onSearchQueryChange, onShowSearch, onHideSearch, canSearch, }) => {
|
|
7
7
|
const handleAddMember = (userId) => {
|
|
8
8
|
onAddMember(groupId, userId);
|
|
@@ -9,12 +9,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
import { useState, useCallback } from 'react';
|
|
10
10
|
import { Alert, Button, Group, Loader, Stack, Tabs, Text } from '@mantine/core';
|
|
11
11
|
import { IconAlertCircle } from '@tabler/icons-react';
|
|
12
|
-
import { useGroupState } from './hooks/useGroupState';
|
|
13
|
-
import { useUserSearch } from './hooks/useUserSearch';
|
|
14
|
-
import { useExternalGroupSearch } from './hooks/useExternalGroupSearch';
|
|
15
|
-
import { InternalGroupsTab } from './InternalGroupsTab';
|
|
16
|
-
import { ExternalGroupsTab } from './ExternalGroupsTab';
|
|
17
|
-
import { GroupForm } from './GroupForm';
|
|
12
|
+
import { useGroupState } from './hooks/useGroupState.js';
|
|
13
|
+
import { useUserSearch } from './hooks/useUserSearch.js';
|
|
14
|
+
import { useExternalGroupSearch } from './hooks/useExternalGroupSearch.js';
|
|
15
|
+
import { InternalGroupsTab } from './InternalGroupsTab.js';
|
|
16
|
+
import { ExternalGroupsTab } from './ExternalGroupsTab.js';
|
|
17
|
+
import { GroupForm } from './GroupForm.js';
|
|
18
18
|
export const GroupManager = ({ internalGroups: initialInternalGroups, loading = false, canEdit, onSave, onSearchUsers, onGetUserMetadata, onSearchExternalGroups, onClose: _, }) => {
|
|
19
19
|
// Group state management
|
|
20
20
|
const { groups, isDirty, isSaving, error, setError, createGroup, updateGroup, deleteGroup, addMember, removeMember, save, discard, } = useGroupState({
|
|
@@ -65,7 +65,7 @@ export const GroupManager = ({ internalGroups: initialInternalGroups, loading =
|
|
|
65
65
|
}, [addMember, userSearch]);
|
|
66
66
|
return (_jsxs(Stack, { h: "100%", style: { display: 'flex', flexDirection: 'column' }, gap: 0, children: [!canEdit && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "yellow", mb: "sm", title: "Read-only", children: "You need admin access to manage groups." })), error && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "red", mb: "sm", title: "Error", withCloseButton: true, onClose: () => setError(null), children: error })), loading ? (_jsxs(Group, { justify: "center", py: "xl", children: [_jsx(Loader, { size: "md" }), _jsx(Text, { size: "sm", c: "dimmed", children: "Loading groups..." })] })) : (_jsxs(Tabs, { defaultValue: "internal", style: { flex: 1, display: 'flex', flexDirection: 'column' }, children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Tab, { value: "internal", children: "Internal Groups" }), _jsx(Tabs.Tab, { value: "external", children: "External Groups" })] }), _jsx(Tabs.Panel, { value: "internal", style: { flex: 1, overflow: 'auto' }, children: _jsx(InternalGroupsTab, { groups: groups, canEdit: canEdit, onCreateGroup: handleCreateGroup, onEditGroup: handleEditGroup, onDeleteGroup: deleteGroup, onAddMember: handleAddMember, onRemoveMember: removeMember, onGetUserMetadata: onGetUserMetadata, activeSearchGroupId: userSearch.activeGroupId, searchQuery: userSearch.searchQuery, searchResults: userSearch.searchResults, isSearching: userSearch.isSearching, searchError: userSearch.searchError, onSearchQueryChange: userSearch.setSearchQuery, onShowSearch: userSearch.showSearch, onHideSearch: userSearch.hideSearch, canSearch: !!onSearchUsers }) }), _jsx(Tabs.Panel, { value: "external", style: { flex: 1, overflow: 'auto' }, children: _jsx(ExternalGroupsTab, { canEdit: canEdit, searchQuery: externalGroupSearch.searchQuery, searchResults: externalGroupSearch.searchResults, isSearching: externalGroupSearch.isSearching, searchError: externalGroupSearch.searchError, onSearchQueryChange: externalGroupSearch.setSearchQuery, canSearch: !!onSearchExternalGroups }) })] })), canEdit && isDirty && (_jsxs(Group, { justify: "flex-end", py: "sm", gap: "sm", style: { borderTop: '1px solid var(--mantine-color-gray-3)' }, children: [_jsx(Button, { variant: "subtle", color: "neutral", onClick: discard, disabled: isSaving, children: "Discard Changes" }), _jsx(Button, { onClick: save, loading: isSaving, disabled: isSaving, children: "Save Groups" })] })), _jsx(GroupForm, { isOpen: isModalOpen, editingGroup: editingGroup, formData: formData, onFormChange: handleFormChange, onSave: handleSaveModal, onClose: () => setIsModalOpen(false) })] }));
|
|
67
67
|
};
|
|
68
|
-
export { useGroupState } from './hooks/useGroupState';
|
|
69
|
-
export { useUserSearch } from './hooks/useUserSearch';
|
|
70
|
-
export { useExternalGroupSearch } from './hooks/useExternalGroupSearch';
|
|
68
|
+
export { useGroupState } from './hooks/useGroupState.js';
|
|
69
|
+
export { useUserSearch } from './hooks/useUserSearch.js';
|
|
70
|
+
export { useExternalGroupSearch } from './hooks/useExternalGroupSearch.js';
|
|
71
71
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { vi } from 'vitest';
|
|
3
|
-
import { createMockApiClient } from '../../../api/__test__/mock-client';
|
|
4
|
-
import { ApiClientProvider } from '../../context';
|
|
3
|
+
import { createMockApiClient } from '../../../api/__test__/mock-client.js';
|
|
4
|
+
import { ApiClientProvider } from '../../context/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Setup mock API client for hook tests.
|
|
7
7
|
*
|
|
@@ -21,7 +21,7 @@ import { ApiClientProvider } from '../../context';
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export async function setupMockApiClient() {
|
|
24
|
-
const { createApiClient } = await import('../../../api');
|
|
24
|
+
const { createApiClient } = await import('../../../api/index.js');
|
|
25
25
|
const mockClient = createMockApiClient();
|
|
26
26
|
vi.mocked(createApiClient).mockReturnValue(mockClient);
|
|
27
27
|
return mockClient;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Barrel export for all custom hooks
|
|
2
2
|
// Export hooks as they are created
|
|
3
3
|
// Note: resetApiClient functions are not exported - they're test-only utilities
|
|
4
|
-
export * from './useEditorLayout';
|
|
5
|
-
export { useBranchManager } from './useBranchManager';
|
|
6
|
-
export { useEntryManager } from './useEntryManager';
|
|
7
|
-
export * from './useDraftManager';
|
|
8
|
-
export { useCommentSystem } from './useCommentSystem';
|
|
9
|
-
export { useGroupManager } from './useGroupManager';
|
|
10
|
-
export { usePermissionManager } from './usePermissionManager';
|
|
11
|
-
export { useBranchActions } from './useBranchActions';
|
|
12
|
-
export { useUserContext } from './useUserContext';
|
|
13
|
-
export { useReferenceResolution, } from './useReferenceResolution';
|
|
14
|
-
export { useSchemaManager, } from './useSchemaManager';
|
|
4
|
+
export * from './useEditorLayout.js';
|
|
5
|
+
export { useBranchManager } from './useBranchManager.js';
|
|
6
|
+
export { useEntryManager } from './useEntryManager.js';
|
|
7
|
+
export * from './useDraftManager.js';
|
|
8
|
+
export { useCommentSystem } from './useCommentSystem.js';
|
|
9
|
+
export { useGroupManager } from './useGroupManager.js';
|
|
10
|
+
export { usePermissionManager } from './usePermissionManager.js';
|
|
11
|
+
export { useBranchActions } from './useBranchActions.js';
|
|
12
|
+
export { useUserContext } from './useUserContext.js';
|
|
13
|
+
export { useReferenceResolution, } from './useReferenceResolution.js';
|
|
14
|
+
export { useSchemaManager, } from './useSchemaManager.js';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { modals } from '@mantine/modals';
|
|
3
3
|
import { notifications } from '@mantine/notifications';
|
|
4
4
|
import { Text } from '@mantine/core';
|
|
5
|
-
import { useApiClient } from '../context';
|
|
5
|
+
import { useApiClient } from '../context/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* Custom hook for branch navigation actions with dirty check support.
|
|
8
8
|
*
|
|
@@ -3,7 +3,7 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
3
3
|
import { Text } from '@mantine/core';
|
|
4
4
|
import { modals } from '@mantine/modals';
|
|
5
5
|
import { notifications } from '@mantine/notifications';
|
|
6
|
-
import { useApiClient } from '../context';
|
|
6
|
+
import { useApiClient } from '../context/index.js';
|
|
7
7
|
/**
|
|
8
8
|
* Helper function to show confirmation modal for branch submit action.
|
|
9
9
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { notifications } from '@mantine/notifications';
|
|
3
|
-
import { normalizeCanopyPath } from '../canopy-path';
|
|
4
|
-
import { useApiClient } from '../context';
|
|
3
|
+
import { normalizeCanopyPath } from '../canopy-path.js';
|
|
4
|
+
import { useApiClient } from '../context/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook for managing the comment system.
|
|
7
7
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { notifications } from '@mantine/notifications';
|
|
3
|
-
import { getNotificationDuration } from '../utils/env';
|
|
3
|
+
import { getNotificationDuration } from '../utils/env.js';
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook for managing draft state (localStorage persistence, save/discard).
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { notifications } from '@mantine/notifications';
|
|
3
|
-
import { buildEntriesFromListResponse, buildWritePayload, normalizeContentPayload, } from '../editor-utils';
|
|
4
|
-
import { useApiClient } from '../context';
|
|
3
|
+
import { buildEntriesFromListResponse, buildWritePayload, normalizeContentPayload, } from '../editor-utils.js';
|
|
4
|
+
import { useApiClient } from '../context/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook for managing editor entries (CRUD operations).
|
|
7
7
|
*
|
|
@@ -107,7 +107,7 @@ export function useEntryManager(options) {
|
|
|
107
107
|
const hydratedFlatSchema = schemaResult.data.flatSchema.map((item) => item.type === 'entry-type' ? { ...item, schema: entrySchemas[item.schemaRef] ?? [] } : item);
|
|
108
108
|
// Build editor collections from hydrated flatSchema
|
|
109
109
|
// Dynamic import: lazy-load heavier editor config; only needed after API data arrives
|
|
110
|
-
const { buildEditorCollections } = await import('../editor-config');
|
|
110
|
+
const { buildEditorCollections } = await import('../editor-config.js');
|
|
111
111
|
const collections = buildEditorCollections(hydratedFlatSchema);
|
|
112
112
|
setCollectionsState(collections);
|
|
113
113
|
// Fetch entries from entries API
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { notifications } from '@mantine/notifications';
|
|
3
|
-
import { useApiClient } from '../context';
|
|
3
|
+
import { useApiClient } from '../context/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook for managing internal groups (CRUD operations).
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { notifications } from '@mantine/notifications';
|
|
3
|
-
import { useApiClient } from '../context';
|
|
3
|
+
import { useApiClient } from '../context/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook for managing path permissions (CRUD operations).
|
|
6
6
|
*
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* - Persists across edits for instant re-renders
|
|
32
32
|
*/
|
|
33
33
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
34
|
-
import { resolveChangedReferences } from '../client-reference-resolver';
|
|
34
|
+
import { resolveChangedReferences } from '../client-reference-resolver.js';
|
|
35
35
|
export function useReferenceResolution({ value, fields, branch, onResolvedValueChange, onLoadingStateChange, }) {
|
|
36
36
|
const resolvedCache = useRef(new Map());
|
|
37
37
|
const prevValueRef = useRef({}); // Track previous value for change detection
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
2
|
import { notifications } from '@mantine/notifications';
|
|
3
|
-
import { useApiClient } from '../context';
|
|
3
|
+
import { useApiClient } from '../context/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Hook for managing schema operations (collections, entry types, ordering).
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { createApiClient } from '../../api';
|
|
2
|
+
import { createApiClient } from '../../api/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Hook to fetch current user context from the API.
|
|
5
5
|
* This provides the userId and groups needed for permission checks.
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ActionIcon, Badge, Button, Group, Paper, Stack, Tabs, Text, Tooltip } from '@mantine/core';
|
|
4
4
|
import { IconSearch, IconX, IconUserOff } from '@tabler/icons-react';
|
|
5
|
-
import { PERMISSION_LEVELS, LEVEL_CONFIG } from './constants';
|
|
6
|
-
import { GroupSelector } from './GroupSelector';
|
|
7
|
-
import { UserSelector } from './UserSelector';
|
|
8
|
-
import { UserBadge } from '../components/UserBadge';
|
|
5
|
+
import { PERMISSION_LEVELS, LEVEL_CONFIG } from './constants.js';
|
|
6
|
+
import { GroupSelector } from './GroupSelector.js';
|
|
7
|
+
import { UserSelector } from './UserSelector.js';
|
|
8
|
+
import { UserBadge } from '../components/UserBadge.js';
|
|
9
9
|
export const PermissionEditor = ({ node, activeLevel, onSetActiveLevel, canEdit, groups, isSelected, userSearchResults, isSearchingUsers, showUserSearch, userSearchQuery, userSearchError, onSearchUsers, onGetUserMetadata, onToggleUserSearch, onAddUser, onRemoveUser, showGroupSearch, groupSearchQuery, filteredGroups, onSearchGroups, onToggleGroupSearch, onAddGroup, onRemoveGroup, }) => {
|
|
10
10
|
const directPerm = node.directPermission;
|
|
11
11
|
const inheritedPerm = node.inheritedPermission;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Badge, Tooltip } from '@mantine/core';
|
|
4
|
-
import { LEVEL_CONFIG } from './constants';
|
|
4
|
+
import { LEVEL_CONFIG } from './constants.js';
|
|
5
5
|
/**
|
|
6
6
|
* Displays a badge for a permission level.
|
|
7
7
|
* Shows filled badge for direct permissions, outlined for inherited.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ActionIcon, Collapse } from '@mantine/core';
|
|
4
4
|
import { IconChevronRight, IconChevronDown, IconFolder, IconFile } from '@tabler/icons-react';
|
|
5
|
-
import { PERMISSION_LEVELS } from './constants';
|
|
6
|
-
import { PermissionLevelBadge } from './PermissionLevelBadge';
|
|
7
|
-
import { PermissionEditor } from './PermissionEditor';
|
|
5
|
+
import { PERMISSION_LEVELS } from './constants.js';
|
|
6
|
+
import { PermissionLevelBadge } from './PermissionLevelBadge.js';
|
|
7
|
+
import { PermissionEditor } from './PermissionEditor.js';
|
|
8
8
|
export const PermissionTree = ({ node, expandedNodes, selectedNode, canEdit, groups, activeLevel, userSearchResults, isSearchingUsers, showUserSearch, userSearchQuery, userSearchError, showGroupSearch, groupSearchQuery, filteredGroups, onToggle, onSelect, onSetActiveLevel, onUpdatePermission, onSearchUsers, onGetUserMetadata, onToggleUserSearch, onAddUser, onRemoveUser, onSearchGroups, onToggleGroupSearch, onAddGroup, onRemoveGroup, }) => {
|
|
9
9
|
const isExpanded = expandedNodes.has(node.path);
|
|
10
10
|
const isSelected = selectedNode === node.path;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Paper, Stack, Text, Loader } from '@mantine/core';
|
|
4
|
-
import { UserBadge } from '../components/UserBadge';
|
|
4
|
+
import { UserBadge } from '../components/UserBadge.js';
|
|
5
5
|
export const UserSelector = ({ searchQuery, onSearchChange, searchResults, isSearching, searchError, onSelectUser, onGetUserMetadata, }) => {
|
|
6
6
|
return (_jsx(Paper, { withBorder: true, p: "sm", mt: "xs", children: _jsxs(Stack, { gap: "xs", children: [_jsx("input", { type: "text", placeholder: "Search users by name or email...", value: searchQuery, onChange: (e) => onSearchChange(e.target.value), "aria-label": "Search users by name or email", style: {
|
|
7
7
|
width: '100%',
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Hook for managing permission tree state and operations
|
|
3
3
|
*/
|
|
4
4
|
import { useState, useMemo, useEffect, useCallback } from 'react';
|
|
5
|
-
import { buildTree, annotateTreeWithPermissions, findTreeNode } from '../utils';
|
|
6
|
-
import { parsePermissionPath } from '../../../authorization/validation';
|
|
5
|
+
import { buildTree, annotateTreeWithPermissions, findTreeNode } from '../utils.js';
|
|
6
|
+
import { parsePermissionPath } from '../../../authorization/validation.js';
|
|
7
7
|
export function usePermissionTree({ collections, contentRoot = 'content', permissions, contentTree, }) {
|
|
8
8
|
const [expandedNodes, setExpandedNodes] = useState(new Set([contentRoot]));
|
|
9
9
|
const [selectedNode, setSelectedNode] = useState(null);
|
|
@@ -10,10 +10,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
import { useState, useCallback } from 'react';
|
|
11
11
|
import { Alert, Button, Group, Loader, ScrollArea, Stack, Text } from '@mantine/core';
|
|
12
12
|
import { IconAlertCircle } from '@tabler/icons-react';
|
|
13
|
-
import { usePermissionTree } from './hooks/usePermissionTree';
|
|
14
|
-
import { useGroupsAndUsers } from './hooks/useGroupsAndUsers';
|
|
15
|
-
import { PermissionTree } from './PermissionTree';
|
|
16
|
-
import { findTreeNode } from './utils';
|
|
13
|
+
import { usePermissionTree } from './hooks/usePermissionTree.js';
|
|
14
|
+
import { useGroupsAndUsers } from './hooks/useGroupsAndUsers.js';
|
|
15
|
+
import { PermissionTree } from './PermissionTree.js';
|
|
16
|
+
import { findTreeNode } from './utils.js';
|
|
17
17
|
export const PermissionManager = ({ collections, contentRoot = 'content', permissions, canEdit, onSave, onSearchUsers, onGetUserMetadata, onListGroups, onClose: __, loading = false, contentTree, }) => {
|
|
18
18
|
const [isSaving, setIsSaving] = useState(false);
|
|
19
19
|
const [error, setError] = useState(null);
|
|
@@ -120,6 +120,6 @@ export const PermissionManager = ({ collections, contentRoot = 'content', permis
|
|
|
120
120
|
}, [annotatedTree, localPermissions, updateNodePermission]);
|
|
121
121
|
return (_jsxs(Stack, { h: "100%", style: { display: 'flex', flexDirection: 'column' }, gap: 0, children: [!canEdit && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "yellow", mb: "sm", title: "Read-only", children: "You need admin access to edit permissions" })), error && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "red", mb: "sm", title: "Error", withCloseButton: true, onClose: () => setError(null), children: error })), groupLoadError && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "orange", mb: "sm", title: "Warning", withCloseButton: true, onClose: clearGroupLoadError, children: groupLoadError })), _jsxs(Group, { gap: "xs", pb: "sm", children: [_jsx(Button, { size: "xs", variant: "subtle", onClick: expandAll, children: "Expand All" }), _jsx(Button, { size: "xs", variant: "subtle", onClick: collapseAll, children: "Collapse All" })] }), _jsx(ScrollArea, { style: { flex: 1 }, pb: "md", children: loading ? (_jsxs(Group, { justify: "center", py: "xl", children: [_jsx(Loader, { size: "md" }), _jsx(Text, { size: "sm", c: "dimmed", children: "Loading permissions..." })] })) : (_jsx(PermissionTree, { node: annotatedTree, expandedNodes: expandedNodes, selectedNode: selectedNode, canEdit: canEdit, groups: groupSelectData, activeLevel: activeLevel, userSearchResults: userSearchResults, isSearchingUsers: isSearchingUsers, showUserSearch: showUserSearch, userSearchQuery: userSearchQuery, userSearchError: userSearchError, showGroupSearch: showGroupSearch, groupSearchQuery: groupSearchQuery, filteredGroups: filteredGroups, onToggle: toggleNode, onSelect: selectNode, onSetActiveLevel: setActiveLevel, onUpdatePermission: updateNodePermission, onSearchUsers: setUserSearchQuery, onGetUserMetadata: onGetUserMetadata, onToggleUserSearch: toggleUserSearch, onAddUser: handleAddUser, onRemoveUser: handleRemoveUser, onSearchGroups: setGroupSearchQuery, onToggleGroupSearch: setShowGroupSearch, onAddGroup: handleAddGroup, onRemoveGroup: handleRemoveGroup })) }), canEdit && isDirty && (_jsxs(Group, { justify: "flex-end", py: "sm", gap: "sm", style: { borderTop: '1px solid var(--mantine-color-gray-3)' }, children: [_jsx(Button, { variant: "subtle", color: "neutral", onClick: handleDiscard, disabled: isSaving, children: "Discard Changes" }), _jsx(Button, { onClick: handleSave, loading: isSaving, disabled: isSaving, children: "Save Permissions" })] }))] }));
|
|
122
122
|
};
|
|
123
|
-
export { usePermissionTree } from './hooks/usePermissionTree';
|
|
124
|
-
export { useGroupsAndUsers } from './hooks/useGroupsAndUsers';
|
|
123
|
+
export { usePermissionTree } from './hooks/usePermissionTree.js';
|
|
124
|
+
export { useGroupsAndUsers } from './hooks/useGroupsAndUsers.js';
|
|
125
125
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { formatCanopyPath } from './canopy-path';
|
|
4
|
+
import { formatCanopyPath } from './canopy-path.js';
|
|
5
5
|
export const __CANOPY_PREVIEW_CLIENT__ = true;
|
|
6
6
|
export const CANOPY_PREVIEW_MESSAGE = 'canopycms:draft:update';
|
|
7
7
|
export const CANOPY_PREVIEW_FOCUS = 'canopycms:preview:focus';
|
|
@@ -14,8 +14,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
import { useState, useCallback, useEffect } from 'react';
|
|
15
15
|
import { Modal, Stack, TextInput, Group, Button, Alert, Text, Paper, ActionIcon, Menu, Divider, Badge, } from '@mantine/core';
|
|
16
16
|
import { IconAlertCircle, IconPlus, IconDotsVertical, IconTrash, IconEdit, IconStar, } from '@tabler/icons-react';
|
|
17
|
-
import { EntryTypeEditor } from './EntryTypeEditor';
|
|
18
|
-
import { ConfirmDeleteModal } from '../components/ConfirmDeleteModal';
|
|
17
|
+
import { EntryTypeEditor } from './EntryTypeEditor.js';
|
|
18
|
+
import { ConfirmDeleteModal } from '../components/ConfirmDeleteModal.js';
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Component
|
|
21
21
|
// ============================================================================
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* - CollectionEditor: Create/edit collections and their entry types
|
|
6
6
|
* - EntryTypeEditor: Create/edit individual entry types
|
|
7
7
|
*/
|
|
8
|
-
export { CollectionEditor, } from './CollectionEditor';
|
|
9
|
-
export { EntryTypeEditor, } from './EntryTypeEditor';
|
|
8
|
+
export { CollectionEditor, } from './CollectionEditor.js';
|
|
9
|
+
export { EntryTypeEditor, } from './EntryTypeEditor.js';
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-schema-registry.d.ts","sourceRoot":"","sources":["../src/entry-schema-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"entry-schema-registry.d.ts","sourceRoot":"","sources":["../src/entry-schema-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,UAAU,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAwBzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAwC/F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,2BAA2B,CAC/C,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAmDf"}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import { countTitleFields, findInvalidTitleFields, findTitleFieldsInLists, } from './utils/title-field.js';
|
|
2
|
+
/** Look up a field's type by dotted path (e.g., "meta.order"). */
|
|
3
|
+
function findFieldType(fields, dottedPath) {
|
|
4
|
+
const parts = dottedPath.split('.');
|
|
5
|
+
let current = fields;
|
|
6
|
+
for (let i = 0; i < parts.length; i++) {
|
|
7
|
+
const field = current.find((f) => f.name === parts[i]);
|
|
8
|
+
if (!field)
|
|
9
|
+
return 'unknown';
|
|
10
|
+
if (i === parts.length - 1)
|
|
11
|
+
return field.type;
|
|
12
|
+
if (field.type === 'object' && 'fields' in field && field.fields) {
|
|
13
|
+
current = field.fields;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return 'unknown';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return 'unknown';
|
|
20
|
+
}
|
|
1
21
|
/**
|
|
2
22
|
* Creates a type-safe entry schema registry with runtime validation.
|
|
3
23
|
*
|
|
@@ -36,6 +56,18 @@ export function createEntrySchemaRegistry(registry) {
|
|
|
36
56
|
if (schema.length === 0) {
|
|
37
57
|
throw new Error(`Entry schema registry entry "${key}" cannot be empty`);
|
|
38
58
|
}
|
|
59
|
+
const titleCount = countTitleFields(schema);
|
|
60
|
+
if (titleCount > 1) {
|
|
61
|
+
throw new Error(`Entry schema registry entry "${key}" has ${titleCount} fields with isTitle: true, but at most one is allowed`);
|
|
62
|
+
}
|
|
63
|
+
const invalidTitleFields = findInvalidTitleFields(schema);
|
|
64
|
+
if (invalidTitleFields.length > 0) {
|
|
65
|
+
throw new Error(`Entry schema registry entry "${key}": field "${invalidTitleFields[0]}" has isTitle: true but is type "${findFieldType(schema, invalidTitleFields[0])}" — isTitle is only valid on string fields`);
|
|
66
|
+
}
|
|
67
|
+
const listTitleFields = findTitleFieldsInLists(schema);
|
|
68
|
+
if (listTitleFields.length > 0) {
|
|
69
|
+
throw new Error(`Entry schema registry entry "${key}": field "${listTitleFields[0]}" has isTitle: true but is inside a list field — isTitle cannot resolve inside list fields`);
|
|
70
|
+
}
|
|
39
71
|
}
|
|
40
72
|
return registry;
|
|
41
73
|
}
|
|
@@ -52,13 +84,13 @@ export function createEntrySchemaRegistry(registry) {
|
|
|
52
84
|
* @example
|
|
53
85
|
* ```typescript
|
|
54
86
|
* import { validateEntrySchemaRegistry } from 'canopycms/server'
|
|
55
|
-
* import { entrySchemaRegistry } from './schemas'
|
|
87
|
+
* import { entrySchemaRegistry } from './schemas.js'
|
|
56
88
|
*
|
|
57
89
|
* await validateEntrySchemaRegistry(entrySchemaRegistry, './content')
|
|
58
90
|
* ```
|
|
59
91
|
*/
|
|
60
92
|
export async function validateEntrySchemaRegistry(entrySchemaRegistry, contentPath) {
|
|
61
|
-
const { loadCollectionMetaFiles } = await import('./schema');
|
|
93
|
+
const { loadCollectionMetaFiles } = await import('./schema/index.js');
|
|
62
94
|
const { access } = await import('fs/promises');
|
|
63
95
|
// Check if content directory exists
|
|
64
96
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-schema-registry.js","sourceRoot":"","sources":["../src/entry-schema-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entry-schema-registry.js","sourceRoot":"","sources":["../src/entry-schema-registry.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAE5B,kEAAkE;AAClE,SAAS,aAAa,CAAC,MAA8B,EAAE,UAAkB;IACvE,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnC,IAAI,OAAO,GAA2B,MAAM,CAAA;IAC5C,KAAK,IAAI,CAAC,GAAG,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;;;;;;;;GAQG;AACH,KAAK,iBAAiB,CAAC,MAAM,SAAS,SAAS,cAAc,EAAE,IAAI;KAChE,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;CAClD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,CAAC,CAAC,SAAS,SAAS,cAAc,EAAE,EAAE,QAAQ,CAAC,KAAG,CAAW,CAAA;AAEpG;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,SAAS,cAAc,EAAE,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAA"}
|
package/dist/entry-schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-schema.js","sourceRoot":"","sources":["../src/entry-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entry-schema.js","sourceRoot":"","sources":["../src/entry-schema.ts"],"names":[],"mappings":"AA4EA;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAA4C,MAAS,EAAK,EAAE,CAAC,MAAM,CAAA"}
|
package/dist/git-manager.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { simpleGit, } from 'simple-git';
|
|
4
|
-
import { createDebugLogger } from './utils/debug';
|
|
5
|
-
import { isNotFoundError } from './utils/error';
|
|
6
|
-
import { detectHeadBranch } from './utils/git';
|
|
4
|
+
import { createDebugLogger } from './utils/debug.js';
|
|
5
|
+
import { isNotFoundError } from './utils/error.js';
|
|
6
|
+
import { detectHeadBranch } from './utils/git.js';
|
|
7
7
|
const log = createDebugLogger({ prefix: 'GitManager' });
|
|
8
8
|
// In-memory lock to prevent concurrent remote.git initialization
|
|
9
9
|
// Maps remotePath -> Promise<void> to serialize access
|
|
@@ -239,7 +239,7 @@ export class GitManager {
|
|
|
239
239
|
static async resolveRemoteUrl(options) {
|
|
240
240
|
// Dynamic import: operating-mode contains Node-only code; deferring the
|
|
241
241
|
// import keeps git-manager loadable in non-Node evaluation contexts
|
|
242
|
-
const { operatingStrategy } = await import('./operating-mode');
|
|
242
|
+
const { operatingStrategy } = await import('./operating-mode/index.js');
|
|
243
243
|
const strategy = operatingStrategy(options.mode);
|
|
244
244
|
const config = strategy.getRemoteUrlConfig();
|
|
245
245
|
// Centralized priority chain (no duplication across strategies)
|
package/dist/github-service.js
CHANGED
package/dist/http/handler.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsonResponse } from './types';
|
|
2
|
-
import { createCanopyRouter } from './router';
|
|
3
|
-
import { createCanopyServices } from '../services';
|
|
4
|
-
import { loadBranchContext, BranchWorkspaceManager } from '../branch-workspace';
|
|
5
|
-
import { authResultToCanopyUser } from '../user';
|
|
6
|
-
import { loadInternalGroups, RESERVED_GROUPS } from '../authorization';
|
|
7
|
-
import { clientOperatingStrategy } from '../operating-mode';
|
|
1
|
+
import { jsonResponse } from './types.js';
|
|
2
|
+
import { createCanopyRouter } from './router.js';
|
|
3
|
+
import { createCanopyServices } from '../services.js';
|
|
4
|
+
import { loadBranchContext, BranchWorkspaceManager } from '../branch-workspace.js';
|
|
5
|
+
import { authResultToCanopyUser } from '../user.js';
|
|
6
|
+
import { loadInternalGroups, RESERVED_GROUPS } from '../authorization/index.js';
|
|
7
|
+
import { clientOperatingStrategy } from '../operating-mode/index.js';
|
|
8
8
|
let warnedNoAdmins = false;
|
|
9
9
|
/**
|
|
10
10
|
* Build API context from options.
|