canopycms 0.0.16 → 0.0.18
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 +120 -34
- package/dist/ai/generate.js +3 -3
- package/dist/ai/handler.js +5 -5
- package/dist/ai/index.js +3 -3
- package/dist/ai/json-to-markdown.js +1 -1
- package/dist/ai/json-to-markdown.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/api/content.js +17 -16
- package/dist/api/content.js.map +1 -1
- package/dist/api/entries.js +8 -8
- 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 +40 -29
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +68 -25
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/sync.js +1 -1
- package/dist/cli/template-files/canopy.ts.template +10 -6
- package/dist/cli/template-files/edit-page-dev.tsx.template +16 -0
- package/dist/cli/template-files/edit-page.tsx.template +14 -21
- package/dist/cli/template-files/middleware-clerk.ts.template +13 -0
- package/dist/cli/template-files/middleware.ts.template +30 -0
- package/dist/cli/template-files/next.config-static.ts.template +13 -0
- package/dist/cli/template-files/next.config.ts.template +5 -0
- package/dist/cli/template-files/schemas.ts.template +4 -2
- package/dist/cli/templates.d.ts +8 -0
- package/dist/cli/templates.d.ts.map +1 -1
- package/dist/cli/templates.js +22 -2
- package/dist/cli/templates.js.map +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 +7 -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 +3 -2
- package/dist/content-listing.d.ts.map +1 -1
- package/dist/content-listing.js +15 -12
- package/dist/content-listing.js.map +1 -1
- package/dist/content-reader.d.ts.map +1 -1
- package/dist/content-reader.js +18 -14
- package/dist/content-reader.js.map +1 -1
- package/dist/content-store.d.ts +5 -0
- package/dist/content-store.d.ts.map +1 -1
- package/dist/content-store.js +34 -24
- package/dist/content-store.js.map +1 -1
- package/dist/content-tree.d.ts.map +1 -1
- package/dist/content-tree.js +8 -3
- package/dist/content-tree.js.map +1 -1
- package/dist/context.d.ts +38 -7
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +38 -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-config.js +2 -2
- package/dist/editor/editor-config.js.map +1 -1
- 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 +12 -3
- 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.d.ts.map +1 -1
- package/dist/github-service.js +12 -8
- package/dist/github-service.js.map +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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- 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.d.ts +1 -1
- package/dist/paths/index.d.ts.map +1 -1
- package/dist/paths/index.js +6 -6
- package/dist/paths/index.js.map +1 -1
- package/dist/paths/normalize.d.ts +8 -0
- package/dist/paths/normalize.d.ts.map +1 -1
- package/dist/paths/normalize.js +17 -0
- package/dist/paths/normalize.js.map +1 -1
- package/dist/paths/test-utils.js +1 -1
- package/dist/paths/validation.js +1 -1
- package/dist/reference-resolver.js +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schema/meta-loader.js +1 -1
- package/dist/schema/resolver.js +1 -1
- package/dist/schema/schema-store.js +4 -4
- package/dist/server.js +13 -13
- 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/url-path-resolver.d.ts +16 -0
- package/dist/url-path-resolver.d.ts.map +1 -0
- package/dist/url-path-resolver.js +31 -0
- package/dist/url-path-resolver.js.map +1 -0
- package/dist/user.js +1 -1
- package/dist/utils/body-field.d.ts +18 -0
- package/dist/utils/body-field.d.ts.map +1 -0
- package/dist/utils/body-field.js +39 -0
- package/dist/utils/body-field.js.map +1 -0
- package/dist/utils/fs.js +1 -1
- package/dist/utils/sanitize-href.d.ts +19 -0
- package/dist/utils/sanitize-href.d.ts.map +1 -0
- package/dist/utils/sanitize-href.js +30 -0
- package/dist/utils/sanitize-href.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
package/dist/api/groups.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { loadInternalGroups, saveInternalGroups, loadGroupsFile, RESERVED_GROUPS, isReservedGroup, } from '../authorization';
|
|
3
|
-
import { defineEndpoint } from './route-builder';
|
|
4
|
-
import { getSettingsBranchContext, commitSettings } from './settings-helpers';
|
|
5
|
-
import { generateId } from '../id';
|
|
2
|
+
import { loadInternalGroups, saveInternalGroups, loadGroupsFile, RESERVED_GROUPS, isReservedGroup, } from '../authorization/index.js';
|
|
3
|
+
import { defineEndpoint } from './route-builder.js';
|
|
4
|
+
import { getSettingsBranchContext, commitSettings } from './settings-helpers.js';
|
|
5
|
+
import { generateId } from '../id.js';
|
|
6
6
|
// ============================================================================
|
|
7
7
|
// Zod Schemas for Validation
|
|
8
8
|
// ============================================================================
|
package/dist/api/guards.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* })
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
import { isAdmin, isReviewer, isPrivileged } from '../authorization/helpers';
|
|
18
|
+
import { isAdmin, isReviewer, isPrivileged } from '../authorization/helpers.js';
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Guard runner implementations
|
|
21
21
|
// ============================================================================
|
package/dist/api/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Content API uses path-based routing now - no separate params/body types exported
|
|
2
2
|
// Export route definitions
|
|
3
|
-
export { USER_ROUTES } from './user';
|
|
3
|
+
export { USER_ROUTES } from './user.js';
|
|
4
4
|
// Note: SCHEMA_ROUTES is not exported here because it imports server-only code (fs module).
|
|
5
|
-
// Import it directly from './schema' in server-side code when needed.
|
|
5
|
+
// Import it directly from './schema.js' in server-side code when needed.
|
|
6
6
|
// Export client
|
|
7
|
-
export { CanopyApiClient, createApiClient } from './client';
|
|
7
|
+
export { CanopyApiClient, createApiClient } from './client.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/api/permissions.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { loadPathPermissions, savePathPermissions, loadPermissionsFile } from '../authorization';
|
|
3
|
-
import { permissionPathSchema } from './validators';
|
|
4
|
-
import { defineEndpoint } from './route-builder';
|
|
5
|
-
import { getSettingsBranchContext, commitSettings } from './settings-helpers';
|
|
2
|
+
import { loadPathPermissions, savePathPermissions, loadPermissionsFile } from '../authorization/index.js';
|
|
3
|
+
import { permissionPathSchema } from './validators.js';
|
|
4
|
+
import { defineEndpoint } from './route-builder.js';
|
|
5
|
+
import { getSettingsBranchContext, commitSettings } from './settings-helpers.js';
|
|
6
6
|
// ============================================================================
|
|
7
7
|
// Zod Schemas for Validation
|
|
8
8
|
// ============================================================================
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ContentStore } from '../content-store';
|
|
3
|
-
import { defineEndpoint } from './route-builder';
|
|
4
|
-
import { ReferenceResolver } from '../reference-resolver';
|
|
5
|
-
import { parseLogicalPath } from '../paths';
|
|
6
|
-
import { branchNameSchema } from './validators';
|
|
2
|
+
import { ContentStore } from '../content-store.js';
|
|
3
|
+
import { defineEndpoint } from './route-builder.js';
|
|
4
|
+
import { ReferenceResolver } from '../reference-resolver.js';
|
|
5
|
+
import { parseLogicalPath } from '../paths/index.js';
|
|
6
|
+
import { branchNameSchema } from './validators.js';
|
|
7
7
|
// ============================================================================
|
|
8
8
|
// Zod Schemas for Validation
|
|
9
9
|
// ============================================================================
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ContentStore } from '../content-store';
|
|
3
|
-
import { defineEndpoint } from './route-builder';
|
|
4
|
-
import { ReferenceResolver } from '../reference-resolver';
|
|
5
|
-
import { branchNameSchema, contentIdSchema } from './validators';
|
|
2
|
+
import { ContentStore } from '../content-store.js';
|
|
3
|
+
import { defineEndpoint } from './route-builder.js';
|
|
4
|
+
import { ReferenceResolver } from '../reference-resolver.js';
|
|
5
|
+
import { branchNameSchema, contentIdSchema } from './validators.js';
|
|
6
6
|
// ============================================================================
|
|
7
7
|
// Zod Schemas for Validation
|
|
8
8
|
// ============================================================================
|
package/dist/api/schema.js
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
import path from 'node:path';
|
|
14
|
-
import { defineEndpoint } from './route-builder';
|
|
15
|
-
import { getErrorMessage } from '../utils/error';
|
|
16
|
-
import { branchNameSchema, logicalPathSchema } from './validators';
|
|
17
|
-
import { SchemaOps, createCollectionInputSchema, updateCollectionInputSchema, entryTypeInputSchema, updateEntryTypeInputSchema, } from '../schema/schema-store';
|
|
18
|
-
import { parseLogicalPath } from '../paths';
|
|
14
|
+
import { defineEndpoint } from './route-builder.js';
|
|
15
|
+
import { getErrorMessage } from '../utils/error.js';
|
|
16
|
+
import { branchNameSchema, logicalPathSchema } from './validators.js';
|
|
17
|
+
import { SchemaOps, createCollectionInputSchema, updateCollectionInputSchema, entryTypeInputSchema, updateEntryTypeInputSchema, } from '../schema/schema-store.js';
|
|
18
|
+
import { parseLogicalPath } from '../paths/index.js';
|
|
19
19
|
/**
|
|
20
20
|
* Resolve the schemaRef for an entry type. Uses the explicit schemaRef if set,
|
|
21
21
|
* otherwise does a reverse lookup in the registry by matching the schema array.
|
package/dist/api/user.js
CHANGED
package/dist/api/validators.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
* ```ts
|
|
9
|
-
* import { branchNameSchema, logicalPathSchema } from './validators'
|
|
9
|
+
* import { branchNameSchema, logicalPathSchema } from './validators.js'
|
|
10
10
|
*
|
|
11
11
|
* const paramsSchema = z.object({
|
|
12
12
|
* branch: branchNameSchema,
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
import { z } from 'zod';
|
|
23
|
-
import { parseBranchName, parseLogicalPath, parseContentId, parseSlug, } from '../paths';
|
|
24
|
-
import { parsePermissionPath } from '../authorization';
|
|
23
|
+
import { parseBranchName, parseLogicalPath, parseContentId, parseSlug, } from '../paths/index.js';
|
|
24
|
+
import { parsePermissionPath } from '../authorization/index.js';
|
|
25
25
|
/**
|
|
26
26
|
* Zod schema for BranchName - validates git branch naming rules and brands.
|
|
27
27
|
*
|
package/dist/asset-store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { isNotFoundError } from './utils/error';
|
|
3
|
+
import { isNotFoundError } from './utils/error.js';
|
|
4
4
|
const normalizeKey = (key) => key.replace(/^\/+/, '');
|
|
5
5
|
/**
|
|
6
6
|
* Local filesystem asset store for dev and tests. In production, swap with S3 adapter.
|
package/dist/auth/cache.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* These use node:fs/promises and must NOT be imported in client bundles.
|
|
4
4
|
* Use 'canopycms/auth/cache' as the import path.
|
|
5
5
|
*/
|
|
6
|
-
export { FileBasedAuthCache, writeAuthCacheSnapshot } from './file-based-auth-cache';
|
|
7
|
-
export { CachingAuthPlugin } from './caching-auth-plugin';
|
|
6
|
+
export { FileBasedAuthCache, writeAuthCacheSnapshot } from './file-based-auth-cache.js';
|
|
7
|
+
export { CachingAuthPlugin } from './caching-auth-plugin.js';
|
|
8
8
|
//# sourceMappingURL=cache.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { createDebugLogger } from '../utils/debug';
|
|
3
|
+
import { createDebugLogger } from '../utils/debug.js';
|
|
4
4
|
const log = createDebugLogger({ prefix: 'FileBasedAuthCache' });
|
|
5
5
|
/**
|
|
6
6
|
* Resolve the active cache directory.
|
package/dist/auth/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isCanopyRequest, isHeadersLike, extractHeaders, validateAuthContext, } from './context-helpers';
|
|
1
|
+
export { isCanopyRequest, isHeadersLike, extractHeaders, validateAuthContext, } from './context-helpers.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
* ```ts
|
|
9
|
-
* import { checkContentAccess } from './authorization'
|
|
9
|
+
* import { checkContentAccess } from './authorization.js'
|
|
10
10
|
*
|
|
11
11
|
* const result = await checkContentAccess(deps, context, branchRoot, 'content/posts/my-post.mdx', user, 'edit')
|
|
12
12
|
* if (result.allowed) {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* }
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
import { operatingStrategy } from '../operating-mode';
|
|
18
|
-
import { createCheckPathAccess } from './path';
|
|
17
|
+
import { operatingStrategy } from '../operating-mode/index.js';
|
|
18
|
+
import { createCheckPathAccess } from './path.js';
|
|
19
19
|
/**
|
|
20
20
|
* Check content access by evaluating both branch and path permissions.
|
|
21
21
|
* Path permissions are loaded dynamically from the branch root.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Groups module exports
|
|
3
3
|
*/
|
|
4
|
-
export { GroupsFileSchema, createDefaultGroupsFile, } from './schema';
|
|
5
|
-
export { loadGroupsFile, loadInternalGroups, saveInternalGroups } from './loader';
|
|
4
|
+
export { GroupsFileSchema, createDefaultGroupsFile, } from './schema.js';
|
|
5
|
+
export { loadGroupsFile, loadInternalGroups, saveInternalGroups } from './loader.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Handles loading and saving internal groups from the filesystem.
|
|
5
5
|
*/
|
|
6
6
|
import { promises as fs } from 'node:fs';
|
|
7
|
-
import { GroupsFileSchema } from './schema';
|
|
8
|
-
import { operatingStrategy } from '../../operating-mode';
|
|
9
|
-
import { RESERVED_GROUPS } from '../helpers';
|
|
10
|
-
import { atomicWriteFile } from '../../utils/atomic-write';
|
|
7
|
+
import { GroupsFileSchema } from './schema.js';
|
|
8
|
+
import { operatingStrategy } from '../../operating-mode/index.js';
|
|
9
|
+
import { RESERVED_GROUPS } from '../helpers.js';
|
|
10
|
+
import { atomicWriteFile } from '../../utils/atomic-write.js';
|
|
11
11
|
/**
|
|
12
12
|
* Get the appropriate groups file path based on mode
|
|
13
13
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* For most use cases, use `checkContentAccess` which handles both branch and path permissions:
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
|
-
* import { checkContentAccess } from './authorization'
|
|
11
|
+
* import { checkContentAccess } from './authorization.js'
|
|
12
12
|
*
|
|
13
13
|
* const result = await checkContentAccess(deps, context, branchRoot, 'content/posts/post.mdx', user, 'edit')
|
|
14
14
|
* if (result.allowed) {
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
* - `groups/` - Groups file schema and loader
|
|
27
27
|
*/
|
|
28
28
|
// Validation
|
|
29
|
-
export { parsePermissionPath } from './validation';
|
|
29
|
+
export { parsePermissionPath } from './validation.js';
|
|
30
30
|
// Main content access (recommended for most cases)
|
|
31
|
-
export { checkContentAccess, createCheckContentAccess } from './content';
|
|
31
|
+
export { checkContentAccess, createCheckContentAccess } from './content.js';
|
|
32
32
|
// Branch-level access
|
|
33
|
-
export { checkBranchAccessWithDefault, createCheckBranchAccess, canPerformWorkflowAction, } from './branch';
|
|
33
|
+
export { checkBranchAccessWithDefault, createCheckBranchAccess, canPerformWorkflowAction, } from './branch.js';
|
|
34
34
|
// Path-level access
|
|
35
|
-
export { checkPathAccess, createCheckPathAccess } from './path';
|
|
35
|
+
export { checkPathAccess, createCheckPathAccess } from './path.js';
|
|
36
36
|
// Helper functions
|
|
37
|
-
export { RESERVED_GROUPS, isReservedGroup, isAdmin, isReviewer, isPrivileged, } from './helpers';
|
|
37
|
+
export { RESERVED_GROUPS, isReservedGroup, isAdmin, isReviewer, isPrivileged, } from './helpers.js';
|
|
38
38
|
// Permissions file handling
|
|
39
|
-
export { PermissionsFileSchema, createDefaultPermissionsFile, loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './permissions';
|
|
39
|
+
export { PermissionsFileSchema, createDefaultPermissionsFile, loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './permissions/index.js';
|
|
40
40
|
// Groups file handling
|
|
41
|
-
export { GroupsFileSchema, createDefaultGroupsFile, loadGroupsFile, loadInternalGroups, saveInternalGroups, } from './groups';
|
|
41
|
+
export { GroupsFileSchema, createDefaultGroupsFile, loadGroupsFile, loadInternalGroups, saveInternalGroups, } from './groups/index.js';
|
|
42
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Permissions module exports
|
|
3
3
|
*/
|
|
4
|
-
export { PermissionsFileSchema, createDefaultPermissionsFile } from './schema';
|
|
5
|
-
export { loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './loader';
|
|
4
|
+
export { PermissionsFileSchema, createDefaultPermissionsFile } from './schema.js';
|
|
5
|
+
export { loadPermissionsFile, loadPathPermissions, savePathPermissions, ensurePermissionsFile, } from './loader.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Handles loading and saving path permissions from the filesystem.
|
|
5
5
|
*/
|
|
6
6
|
import fs from 'node:fs/promises';
|
|
7
|
-
import { PermissionsFileSchema } from './schema';
|
|
8
|
-
import { operatingStrategy } from '../../operating-mode';
|
|
9
|
-
import { atomicWriteFile } from '../../utils/atomic-write';
|
|
7
|
+
import { PermissionsFileSchema } from './schema.js';
|
|
8
|
+
import { operatingStrategy } from '../../operating-mode/index.js';
|
|
9
|
+
import { atomicWriteFile } from '../../utils/atomic-write.js';
|
|
10
10
|
/**
|
|
11
11
|
* Get the appropriate permissions file path based on mode
|
|
12
12
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Schema for permissions.json file
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { parsePermissionPath } from '../validation';
|
|
5
|
+
import { parsePermissionPath } from '../validation.js';
|
|
6
6
|
const permissionTargetSchema = z.object({
|
|
7
7
|
allowedUsers: z.array(z.string()).optional(),
|
|
8
8
|
allowedGroups: z.array(z.string()).optional(),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* // In test files only:
|
|
9
|
-
* import { unsafeAsPermissionPath } from '../authorization/test-utils'
|
|
9
|
+
* import { unsafeAsPermissionPath } from '../authorization/test-utils.js'
|
|
10
10
|
*/
|
|
11
11
|
/** Test-only: cast a string to PermissionPath without validation. */
|
|
12
12
|
export const unsafeAsPermissionPath = (path) => path;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SECURITY CRITICAL: These functions validate permission paths
|
|
5
5
|
* to prevent path traversal attacks.
|
|
6
6
|
*/
|
|
7
|
-
import { hasTraversalSequence } from '../paths/normalize';
|
|
7
|
+
import { hasTraversalSequence } from '../paths/normalize.js';
|
|
8
8
|
/**
|
|
9
9
|
* Parse and validate a PermissionPath.
|
|
10
10
|
*
|
package/dist/branch-metadata.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { BranchRegistry } from './branch-registry';
|
|
5
|
-
import { resolveBranchPath } from './paths';
|
|
6
|
-
import { isFileExistsError, isNotFoundError } from './utils/error';
|
|
4
|
+
import { BranchRegistry } from './branch-registry.js';
|
|
5
|
+
import { resolveBranchPath } from './paths/index.js';
|
|
6
|
+
import { isFileExistsError, isNotFoundError } from './utils/error.js';
|
|
7
7
|
const BRANCH_META_DIR = '.canopy-meta';
|
|
8
8
|
const BRANCH_META_FILE = 'branch.json';
|
|
9
9
|
const CURRENT_SCHEMA_VERSION = 1;
|
package/dist/branch-registry.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { BranchMetadataFileManager } from './branch-metadata';
|
|
4
|
-
import { isNotFoundError } from './utils/error';
|
|
3
|
+
import { BranchMetadataFileManager } from './branch-metadata.js';
|
|
4
|
+
import { isNotFoundError } from './utils/error.js';
|
|
5
5
|
// Registry files are stored directly in the branches root (not in a subdirectory)
|
|
6
6
|
const REGISTRY_FILE = 'branches.json';
|
|
7
7
|
const REGISTRY_STALE_FILE = 'branches.stale.json';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { resolveSchema, isValidSchema } from './schema/resolver';
|
|
4
|
-
import { flattenSchema } from './config/flatten';
|
|
3
|
+
import { resolveSchema, isValidSchema } from './schema/resolver.js';
|
|
4
|
+
import { flattenSchema } from './config/flatten.js';
|
|
5
5
|
/** Bump when BranchSchemaCacheEntry shape changes to auto-invalidate stale caches */
|
|
6
6
|
const SCHEMA_CACHE_VERSION = 2;
|
|
7
7
|
/** Minimum interval between mtime staleness checks (ms) */
|
package/dist/branch-workspace.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ensureBranchRoot } from './paths';
|
|
2
|
-
import { getBranchMetadataFileManager, loadBranchContext } from './branch-metadata';
|
|
3
|
-
import { isDeployedStatic } from './build-mode';
|
|
4
|
-
import { GitManager } from './git-manager';
|
|
5
|
-
import { createDebugLogger } from './utils/debug';
|
|
1
|
+
import { ensureBranchRoot } from './paths/index.js';
|
|
2
|
+
import { getBranchMetadataFileManager, loadBranchContext } from './branch-metadata.js';
|
|
3
|
+
import { isDeployedStatic } from './build-mode.js';
|
|
4
|
+
import { GitManager } from './git-manager.js';
|
|
5
|
+
import { createDebugLogger } from './utils/debug.js';
|
|
6
6
|
const log = createDebugLogger({ prefix: 'BranchWorkspace' });
|
|
7
7
|
// In-memory lock to prevent concurrent workspace initialization
|
|
8
8
|
const workspaceInitLocks = new Map();
|
|
@@ -84,7 +84,7 @@ export class BranchWorkspaceManager {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
export { loadBranchContext } from './branch-metadata';
|
|
87
|
+
export { loadBranchContext } from './branch-metadata.js';
|
|
88
88
|
/**
|
|
89
89
|
* Load an existing branch context, or create the workspace if it doesn't exist yet.
|
|
90
90
|
*
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import fs from 'node:fs/promises';
|
|
8
8
|
import path from 'node:path';
|
|
9
|
-
import { ContentStore } from '../content-store';
|
|
10
|
-
import { BranchSchemaCache } from '../branch-schema-cache';
|
|
11
|
-
import { generateAIContent } from '../ai/generate';
|
|
12
|
-
import { resolveBranchRoot } from '../ai/resolve-branch';
|
|
9
|
+
import { ContentStore } from '../content-store.js';
|
|
10
|
+
import { BranchSchemaCache } from '../branch-schema-cache.js';
|
|
11
|
+
import { generateAIContent } from '../ai/generate.js';
|
|
12
|
+
import { resolveBranchRoot } from '../ai/resolve-branch.js';
|
|
13
13
|
/**
|
|
14
14
|
* Generate AI content files and write them to disk.
|
|
15
15
|
*
|
package/dist/build/index.js
CHANGED
package/dist/cli/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ export function resolveSyncDirection(push, pull, abort) {
|
|
|
33
33
|
async function main() {
|
|
34
34
|
const { argv, flags, command } = parseArgs(process.argv.slice(2));
|
|
35
35
|
if (command === 'init') {
|
|
36
|
-
const { init } = await import('./init');
|
|
36
|
+
const { init } = await import('./init.js');
|
|
37
37
|
const nonInteractive = flags['non-interactive'] === true;
|
|
38
38
|
const force = flags['force'] === true;
|
|
39
39
|
const mode = 'dev';
|
|
@@ -84,7 +84,7 @@ async function main() {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
else if (command === 'init-deploy') {
|
|
87
|
-
const { initDeployAws } = await import('./init');
|
|
87
|
+
const { initDeployAws } = await import('./init.js');
|
|
88
88
|
const cloud = argv._[1];
|
|
89
89
|
if (cloud !== 'aws') {
|
|
90
90
|
console.error('Usage: canopycms init-deploy aws');
|
|
@@ -99,7 +99,7 @@ async function main() {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
else if (command === 'worker') {
|
|
102
|
-
const { workerRunOnce } = await import('./init');
|
|
102
|
+
const { workerRunOnce } = await import('./init.js');
|
|
103
103
|
const subcommand = argv._[1];
|
|
104
104
|
if (subcommand !== 'run-once') {
|
|
105
105
|
console.error('Usage: canopycms worker run-once');
|
|
@@ -127,7 +127,7 @@ async function main() {
|
|
|
127
127
|
await workerRunOnce({ projectDir: process.cwd(), authPlugin });
|
|
128
128
|
}
|
|
129
129
|
else if (command === 'generate-ai-content') {
|
|
130
|
-
const { generateAIContentCLI } = await import('./generate-ai-content');
|
|
130
|
+
const { generateAIContentCLI } = await import('./generate-ai-content.js');
|
|
131
131
|
await generateAIContentCLI({
|
|
132
132
|
projectDir: process.cwd(),
|
|
133
133
|
outputDir: typeof flags['output'] === 'string' ? flags['output'] : undefined,
|
|
@@ -136,7 +136,7 @@ async function main() {
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
else if (command === 'sync') {
|
|
139
|
-
const { sync } = await import('./sync');
|
|
139
|
+
const { sync } = await import('./sync.js');
|
|
140
140
|
const direction = resolveSyncDirection(flags['push'] === true, flags['pull'] === true, flags['abort'] === true);
|
|
141
141
|
await sync({
|
|
142
142
|
projectDir: process.cwd(),
|