@conloca/content-api 0.1.1 → 0.1.2

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.
Files changed (67) hide show
  1. package/package.json +1 -1
  2. package/dist/asset-manifest.d.ts +0 -20
  3. package/dist/asset-manifest.d.ts.map +0 -1
  4. package/dist/asset-operations.d.ts +0 -156
  5. package/dist/asset-operations.d.ts.map +0 -1
  6. package/dist/asset-types.d.ts +0 -56
  7. package/dist/asset-types.d.ts.map +0 -1
  8. package/dist/base-content-index.d.ts +0 -57
  9. package/dist/base-content-index.d.ts.map +0 -1
  10. package/dist/block-index.d.ts +0 -9
  11. package/dist/block-index.d.ts.map +0 -1
  12. package/dist/blocks.d.ts +0 -16
  13. package/dist/blocks.d.ts.map +0 -1
  14. package/dist/cf-access.d.ts +0 -31
  15. package/dist/cf-access.d.ts.map +0 -1
  16. package/dist/component-registry.d.ts +0 -50
  17. package/dist/component-registry.d.ts.map +0 -1
  18. package/dist/component-registry.types.d.ts +0 -11
  19. package/dist/component-registry.types.d.ts.map +0 -1
  20. package/dist/content-api.interface.d.ts +0 -64
  21. package/dist/content-api.interface.d.ts.map +0 -1
  22. package/dist/content-filters.d.ts +0 -31
  23. package/dist/content-filters.d.ts.map +0 -1
  24. package/dist/content-index.d.ts +0 -126
  25. package/dist/content-index.d.ts.map +0 -1
  26. package/dist/content-operations.d.ts +0 -94
  27. package/dist/content-operations.d.ts.map +0 -1
  28. package/dist/content-utils.d.ts +0 -109
  29. package/dist/content-utils.d.ts.map +0 -1
  30. package/dist/content-watcher.d.ts +0 -25
  31. package/dist/content-watcher.d.ts.map +0 -1
  32. package/dist/data-index.d.ts +0 -8
  33. package/dist/data-index.d.ts.map +0 -1
  34. package/dist/data.d.ts +0 -43
  35. package/dist/data.d.ts.map +0 -1
  36. package/dist/etag-utils.d.ts +0 -77
  37. package/dist/etag-utils.d.ts.map +0 -1
  38. package/dist/filesystem-content-api.d.ts +0 -120
  39. package/dist/filesystem-content-api.d.ts.map +0 -1
  40. package/dist/git-operations.d.ts +0 -44
  41. package/dist/git-operations.d.ts.map +0 -1
  42. package/dist/in-memory-content-api.d.ts +0 -35
  43. package/dist/in-memory-content-api.d.ts.map +0 -1
  44. package/dist/index.d.ts +0 -17
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/json-whitespace-view.d.ts +0 -32
  47. package/dist/json-whitespace-view.d.ts.map +0 -1
  48. package/dist/middleware.d.ts +0 -20
  49. package/dist/middleware.d.ts.map +0 -1
  50. package/dist/node.d.ts +0 -25
  51. package/dist/node.d.ts.map +0 -1
  52. package/dist/schemas/index.d.ts +0 -179
  53. package/dist/schemas/index.d.ts.map +0 -1
  54. package/dist/site-index.d.ts +0 -60
  55. package/dist/site-index.d.ts.map +0 -1
  56. package/dist/site.d.ts +0 -21
  57. package/dist/site.d.ts.map +0 -1
  58. package/dist/types.d.ts +0 -329
  59. package/dist/types.d.ts.map +0 -1
  60. package/dist/url-safe-base64.d.ts +0 -12
  61. package/dist/url-safe-base64.d.ts.map +0 -1
  62. package/dist/utils.d.ts +0 -46
  63. package/dist/utils.d.ts.map +0 -1
  64. package/dist/vite-plugin.d.ts +0 -12
  65. package/dist/vite-plugin.d.ts.map +0 -1
  66. package/dist/vxjson.d.ts +0 -111
  67. package/dist/vxjson.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conloca/content-api",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,20 +0,0 @@
1
- import type { AssetManifestData, ManifestEntryData } from './asset-types';
2
- export type { AssetEntry, AssetManifestData, AssetUsage, FolderListing, FolderTreeNode, ManifestEntryData, } from './asset-types';
3
- export declare class AssetManifest {
4
- private manifestPath;
5
- constructor(assetsPath: string);
6
- read(): Promise<AssetManifestData>;
7
- write(data: AssetManifestData): Promise<void>;
8
- add(relativePath: string, data: ManifestEntryData): Promise<void>;
9
- remove(relativePath: string): Promise<boolean>;
10
- get(relativePath: string): Promise<ManifestEntryData | undefined>;
11
- /**
12
- * Backward compat helper: search manifest keys for entry ending with /filename or equal to filename
13
- * Useful during transition when only filename is known (not full relative path)
14
- */
15
- getByFilename(filename: string): Promise<{
16
- relativePath: string;
17
- data: ManifestEntryData;
18
- } | undefined>;
19
- }
20
- //# sourceMappingURL=asset-manifest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asset-manifest.d.ts","sourceRoot":"","sources":["../src/asset-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG1E,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,cAAc,EACd,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAIvB,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAAS;gBAEjB,UAAU,EAAE,MAAM;IAIxB,IAAI,IAAI,OAAO,CAAC,iBAAiB,CAAC;IASlC,KAAK,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjE,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ9C,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAKvE;;;OAGG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,iBAAiB,CAAA;KAAE,GAAG,SAAS,CAAC;CAS9G"}
@@ -1,156 +0,0 @@
1
- import { type AssetEntry, type AssetUsage, type FolderListing, type FolderTreeNode, type ManifestEntryData } from './asset-manifest';
2
- export interface AssetConfig {
3
- assetsPath: string;
4
- maxFileSize?: number;
5
- acceptedFormats?: string[];
6
- /** Content root directory for usage tracking (scanning VXJSON files) */
7
- contentRoot?: string;
8
- }
9
- export declare class AssetOperations {
10
- private config;
11
- private manifest;
12
- private dirEnsured;
13
- private lfsSetup;
14
- constructor(config: AssetConfig);
15
- private ensureDir;
16
- /**
17
- * Validate that a subpath is safe (no path traversal attacks)
18
- * Returns the resolved full path if valid, throws if invalid
19
- */
20
- private validateSubpath;
21
- /**
22
- * Resolve a unique filename by appending -1, -2, etc. if collision exists
23
- * @param originalName Original filename
24
- * @param folder Optional folder path (relative to assets root)
25
- */
26
- private resolveFilename;
27
- private validateFormat;
28
- private validateSize;
29
- /**
30
- * Get image dimensions from manifest cache or by reading file headers
31
- */
32
- private getDimensions;
33
- /**
34
- * Build an AssetEntry from a directory entry, enriching with manifest metadata
35
- */
36
- private buildAssetEntry;
37
- upload(file: File, metadata?: {
38
- alt?: string;
39
- uploadedBy?: string;
40
- width?: number;
41
- height?: number;
42
- folder?: string;
43
- }): Promise<{
44
- success: true;
45
- asset: AssetEntry;
46
- } | {
47
- success: false;
48
- error: string;
49
- }>;
50
- /**
51
- * List all assets recursively from filesystem
52
- */
53
- list(): Promise<AssetEntry[]>;
54
- /**
55
- * Get asset by filename and optional folder
56
- */
57
- getAsset(filename: string, folder?: string): Promise<AssetEntry | undefined>;
58
- /**
59
- * Delete asset file and manifest entry
60
- */
61
- delete(filename: string, folder?: string): Promise<{
62
- success: true;
63
- } | {
64
- success: false;
65
- error: string;
66
- }>;
67
- /**
68
- * Import an image from a URL (server-side fetch, no CORS issues)
69
- */
70
- importFromUrl(url: string, metadata?: {
71
- alt?: string;
72
- uploadedBy?: string;
73
- folder?: string;
74
- }): Promise<{
75
- success: true;
76
- asset: AssetEntry;
77
- } | {
78
- success: false;
79
- error: string;
80
- }>;
81
- /**
82
- * List assets and subfolders within a folder (filesystem-first)
83
- * @param subpath Folder path relative to assets root (default '/')
84
- */
85
- listFolder(subpath?: string): Promise<FolderListing>;
86
- /**
87
- * Create a folder on disk
88
- * @param subpath Folder path relative to assets root
89
- */
90
- createFolder(subpath: string): Promise<{
91
- success: true;
92
- } | {
93
- success: false;
94
- error: string;
95
- }>;
96
- /**
97
- * Update asset metadata (alt text, tags)
98
- * @param filename Asset filename
99
- * @param updates Metadata updates (alt, tags)
100
- * @param folder Optional folder path (default '/')
101
- */
102
- updateMetadata(filename: string, updates: Partial<ManifestEntryData>, folder?: string): Promise<{
103
- success: true;
104
- asset: AssetEntry;
105
- } | {
106
- success: false;
107
- error: string;
108
- }>;
109
- /**
110
- * Get usage information for an asset (which pages reference it)
111
- * @param filename Asset filename
112
- */
113
- getUsage(filename: string): Promise<AssetUsage[]>;
114
- /**
115
- * Get the file path for an asset
116
- * @param filename Asset filename
117
- * @param folder Optional folder path (defaults to asset's stored folder)
118
- */
119
- getAssetPath(filename: string, folder?: string): string;
120
- /**
121
- * Read asset file contents for serving (filesystem-first)
122
- * @param filename Asset filename
123
- * @param folder Optional folder path (default '/')
124
- */
125
- readAssetFile(filename: string, folder?: string): Promise<{
126
- success: true;
127
- buffer: Buffer;
128
- mimeType: string;
129
- } | {
130
- success: false;
131
- error: string;
132
- }>;
133
- /**
134
- * Helper to find which field contains an asset reference
135
- */
136
- private findFieldWithAsset;
137
- /**
138
- * Move assets from one folder to another
139
- * @param filenames List of filenames to move
140
- * @param sourceFolder Source folder path (relative to assets root)
141
- * @param targetFolder Target folder path (relative to assets root)
142
- */
143
- moveAssets(filenames: string[], sourceFolder: string, targetFolder: string): Promise<{
144
- success: true;
145
- moved: number;
146
- } | {
147
- success: false;
148
- error: string;
149
- }>;
150
- /**
151
- * Get the complete folder tree with asset counts
152
- * @returns Array of folder tree nodes representing the folder hierarchy
153
- */
154
- getFolderTree(): Promise<FolderTreeNode[]>;
155
- }
156
- //# sourceMappingURL=asset-operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asset-operations.d.ts","sourceRoot":"","sources":["../src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C,UAAU,EAAE,CAAC;IAmEvD;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAKvD;;;;OAIG;IACG,aAAa,CACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,SAAM,GACX,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAgBnG;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;;;;OAKG;IACG,UAAU,CACd,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAqEhF;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;CAuEjD"}
@@ -1,56 +0,0 @@
1
- /**
2
- * Browser-safe asset type definitions for @conloca/content-api
3
- *
4
- * These types are safe to import in browser environments.
5
- * The Node.js implementation (AssetManifest class) is in asset-manifest.ts
6
- */
7
- export interface AssetEntry {
8
- filename: string;
9
- originalName: string;
10
- mimeType: string;
11
- size: number;
12
- width?: number;
13
- height?: number;
14
- alt?: string;
15
- uploadedAt: string;
16
- uploadedBy?: string;
17
- /** Folder path relative to assets root, default '/' */
18
- folder?: string;
19
- /** Tags for categorization/filtering */
20
- tags?: string[];
21
- }
22
- /** Asset usage reference - tracks where an asset is used */
23
- export interface AssetUsage {
24
- page: string;
25
- field: string;
26
- }
27
- /** Folder listing result */
28
- export interface FolderListing {
29
- assets: AssetEntry[];
30
- folders: {
31
- name: string;
32
- path: string;
33
- }[];
34
- }
35
- /** Folder tree node for hierarchical folder view */
36
- export interface FolderTreeNode {
37
- name: string;
38
- path: string;
39
- assetCount: number;
40
- children: FolderTreeNode[];
41
- }
42
- /** Metadata stored per-file in the manifest (keyed by relative path) */
43
- export interface ManifestEntryData {
44
- alt?: string;
45
- tags?: string[];
46
- width?: number;
47
- height?: number;
48
- uploadedAt?: string;
49
- uploadedBy?: string;
50
- originalName?: string;
51
- }
52
- /** Object-keyed manifest structure for O(1) lookup by relative path */
53
- export interface AssetManifestData {
54
- [relativePath: string]: ManifestEntryData;
55
- }
56
- //# sourceMappingURL=asset-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asset-types.d.ts","sourceRoot":"","sources":["../src/asset-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4BAA4B;AAC5B,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3C;AAED,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,wEAAwE;AACxE,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC3C"}
@@ -1,57 +0,0 @@
1
- import type { ContentData, ContentIdentity, ContentManifest, LocaleVersion } from './types';
2
- /**
3
- * Base class for content indexes (blocks, data)
4
- * Maintains collection->name->locale lookups with V8-optimized structures
5
- */
6
- export declare class BaseContentIndex {
7
- protected index: Map<string, ContentManifest>;
8
- protected contentCache: Map<string, Record<string, ContentData | null>>;
9
- protected nameIndex: Map<string, Map<string, ContentManifest>>;
10
- readonly collections: Set<string>;
11
- /**
12
- * Add or update content in the index
13
- * Merges manifest locales and updates content cache if provided
14
- */
15
- addContent(identity: ContentIdentity, localeVersion: LocaleVersion, content?: ContentData | null): void;
16
- /**
17
- * Remove a specific locale from an entry
18
- */
19
- removeLocale(id: string, locale: string): void;
20
- /**
21
- * Remove an entry from the index
22
- */
23
- removeEntry(id: string): void;
24
- /**
25
- * Get cached content for a specific locale
26
- */
27
- getCachedContent(id: string, locale: string): ContentData | null;
28
- /**
29
- * Get content manifest
30
- */
31
- getManifest(id: string): ContentManifest | null;
32
- /**
33
- * Find entry by name
34
- */
35
- getByName(collection: string, name: string, locale?: string): ContentManifest | null;
36
- /**
37
- * Generator for all manifests
38
- */
39
- getAllManifests(): Generator<ContentManifest>;
40
- /**
41
- * Generator for manifests by locale
42
- */
43
- getManifestsByLocale(locale: string): Generator<ContentManifest>;
44
- /**
45
- * Generator for manifests by collection
46
- */
47
- getManifestsByCollection(collection: string): Generator<ContentManifest>;
48
- /**
49
- * Get the count of indexed content entries (unique IDs)
50
- */
51
- get entryCount(): number;
52
- /**
53
- * Clear all indexes
54
- */
55
- clear(): void;
56
- }
57
- //# sourceMappingURL=base-content-index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-content-index.d.ts","sourceRoot":"","sources":["../src/base-content-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5F;;;GAGG;AACH,qBAAa,gBAAgB;IAE3B,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAa;IAG1D,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC,CAAa;IAGpF,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAa;IAG3E,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IAE9C;;;OAGG;IACH,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI;IAiDvG;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAoB9C;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAsB7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAKhE;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAI/C;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAepF;;OAEG;IACF,eAAe,IAAI,SAAS,CAAC,eAAe,CAAC;IAM9C;;OAEG;IACF,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC;IAQjE;;OAEG;IACF,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC;IAQzE;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;CAMd"}
@@ -1,9 +0,0 @@
1
- import { BaseContentIndex } from './base-content-index';
2
- /**
3
- * V8-optimized index for blocks
4
- * Maintains collection->name->locale lookups
5
- */
6
- export declare class BlockIndex extends BaseContentIndex {
7
- constructor(locales: string[]);
8
- }
9
- //# sourceMappingURL=block-index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"block-index.d.ts","sourceRoot":"","sources":["../src/block-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;GAGG;AACH,qBAAa,UAAW,SAAQ,gBAAgB;gBAClC,OAAO,EAAE,MAAM,EAAE;CAI9B"}
package/dist/blocks.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import type { BlockIndex } from './block-index';
2
- import type { ContentAPI } from './content-api.interface';
3
- import type { BlockFilters, ContentManifest, CreateBlockInput, CreateResult } from './types';
4
- export declare class Blocks {
5
- private api;
6
- private blockIndex;
7
- constructor(api: ContentAPI, blockIndex: BlockIndex);
8
- listContent(filters?: BlockFilters): Generator<ContentManifest>;
9
- get collections(): Set<string>;
10
- getByName(collection: string, name: string, locale?: string): ContentManifest | null;
11
- isNameAvailable(collection: string, name: string, excludeId?: string): boolean;
12
- getNameConflict(collection: string, name: string, excludeId?: string): string | null;
13
- isBlockNameValid(blockName: string): boolean;
14
- create(data: CreateBlockInput): Promise<CreateResult>;
15
- }
16
- //# sourceMappingURL=blocks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7F,qBAAa,MAAM;IAEf,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,UAAU;gBADV,GAAG,EAAE,UAAU,EACf,UAAU,EAAE,UAAU;IAI/B,WAAW,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC,eAAe,CAAC;IA0BhE,IAAI,WAAW,IAAI,GAAG,CAAC,MAAM,CAAC,CAE7B;IAGD,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAKpF,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;IAM9E,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IASpF,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAqBtC,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CA8B5D"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Cloudflare Access JWT validation utility
3
- *
4
- * Validates JWT tokens from CF Access for API authorization and git commit attribution.
5
- * When CF_ACCESS_TEAM_NAME and CF_ACCESS_AUD env vars are set, requests must have valid tokens.
6
- * When env vars are not set (local dev), validation is skipped.
7
- */
8
- export interface CFAccessUser {
9
- email: string;
10
- sub: string;
11
- }
12
- export interface CFAccessResult {
13
- valid: boolean;
14
- required: boolean;
15
- user?: CFAccessUser;
16
- error?: string;
17
- }
18
- /**
19
- * Extract CF Access JWT token from request.
20
- * Checks Cf-Access-Jwt-Assertion header first, falls back to CF_Authorization cookie.
21
- */
22
- export declare function extractCFAccessToken(request: Request): string | null;
23
- /**
24
- * Validate CF Access JWT from request.
25
- *
26
- * Returns { valid: true, required: false } when env vars not set (local dev mode).
27
- * Returns { valid: true, required: true, user } when token is valid.
28
- * Returns { valid: false, required: true, error } when token is invalid or missing.
29
- */
30
- export declare function validateCFAccessRequest(request: Request): Promise<CFAccessResult>;
31
- //# sourceMappingURL=cf-access.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cf-access.d.ts","sourceRoot":"","sources":["../src/cf-access.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CASpE;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAgCvF"}
@@ -1,50 +0,0 @@
1
- import type { ComponentEntry, ComponentEntryWithId } from './component-registry.types';
2
- /**
3
- * Component Registry for managing linked and unlinked components
4
- *
5
- * Registry is stored at {canvasDir}/components/registry.json
6
- * Component IDs must follow the format: vx-{uuid}
7
- */
8
- export declare class ComponentRegistry {
9
- private registryPath;
10
- private registry;
11
- private initialized;
12
- constructor(canvasDir: string);
13
- /**
14
- * Initialize the registry by loading from disk or creating new
15
- */
16
- initialize(): Promise<void>;
17
- /**
18
- * Validate component ID format (vx-{uuid})
19
- */
20
- private validateComponentId;
21
- /**
22
- * Save registry to disk atomically
23
- */
24
- private save;
25
- /**
26
- * Register a new component or update existing
27
- */
28
- register(id: string, entry: ComponentEntry): Promise<void>;
29
- /**
30
- * Get a component entry by ID
31
- */
32
- get(id: string): Promise<ComponentEntry | null>;
33
- /**
34
- * Link a component to a path
35
- */
36
- link(id: string, path: string): Promise<void>;
37
- /**
38
- * Unlink a component (set path to null)
39
- */
40
- unlink(id: string): Promise<void>;
41
- /**
42
- * List all components
43
- */
44
- list(): Promise<ComponentEntryWithId[]>;
45
- /**
46
- * Delete a component from registry
47
- */
48
- delete(id: string): Promise<void>;
49
- }
50
- //# sourceMappingURL=component-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../src/component-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EAErB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,WAAW,CAAS;gBAEhB,SAAS,EAAE,MAAM;IAI7B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;OAEG;YACW,IAAI;IAyBlB;;OAEG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAKrD;;OAEG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYnD;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAS7C;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMxC"}
@@ -1,11 +0,0 @@
1
- export interface ComponentEntry {
2
- displayName: string;
3
- path: string | null;
4
- }
5
- export interface ComponentEntryWithId extends ComponentEntry {
6
- id: string;
7
- }
8
- export interface ComponentRegistry {
9
- [componentId: string]: ComponentEntry;
10
- }
11
- //# sourceMappingURL=component-registry.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-registry.types.d.ts","sourceRoot":"","sources":["../src/component-registry.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAAC;CACvC"}
@@ -1,64 +0,0 @@
1
- import type { Blocks } from './blocks';
2
- import type { Data } from './data';
3
- import type { Site } from './site';
4
- import type { BatchResult, ContentEntry, ContentManifest, CreateContentInput, CreateResult, DeleteLocaleInput, DeleteResult, FindOptions, GlobalFilters, LocalizedEntry, SitesConfig, UpdateLocaleInput, UpdateResult } from './types';
5
- /**
6
- * Content API Interface
7
- *
8
- * Provides a unified interface for content operations across different storage backends.
9
- *
10
- * ## Indexing and Caching
11
- *
12
- * Implementations should index content at startup for performance. However, since content
13
- * files can be modified externally (via git, text editors, etc.), implementations must:
14
- *
15
- * 1. Perform read-repair when files are invalid (e.g., VXJSON with incorrect field order)
16
- * 2. Handle files that were added after the initial indexing
17
- * 3. Update the index when files are repaired or discovered
18
- *
19
- * ## Read-Repair
20
- *
21
- * For file-based implementations, read-repair should:
22
- * - Fix missing required fields (id, created, modified)
23
- * - Ensure VXJSON files have "content" as the last field
24
- * - Update the index with repaired content
25
- * - Write the repaired file back to disk
26
- */
27
- export interface ContentAPI {
28
- /**
29
- * Get content with all locales
30
- * @param id - The content ID
31
- * @returns The content entry with all locales, or null if not found
32
- */
33
- getContent(id: string): Promise<ContentEntry | null>;
34
- /**
35
- * Get content for a specific locale
36
- *
37
- * For file-based implementations:
38
- * - Should handle files added after initial indexing
39
- * - Should perform read-repair if the file is invalid
40
- * - Should update the index with discovered/repaired content
41
- *
42
- * @param id - The content ID
43
- * @param locale - The locale code
44
- * @returns The localized content entry, or null if not found
45
- */
46
- getLocalized(id: string, locale: string): Promise<LocalizedEntry | null>;
47
- createContent(data: CreateContentInput): Promise<CreateResult>;
48
- updateLocalized(input: UpdateLocaleInput): Promise<UpdateResult>;
49
- deleteContent(id: string, etag: string): Promise<DeleteResult>;
50
- deleteLocalized(input: DeleteLocaleInput): Promise<DeleteResult>;
51
- getSite(siteName: string): Site | null;
52
- readonly blocks: Blocks;
53
- readonly data: Data;
54
- listAllContent(filters?: GlobalFilters): Generator<ContentManifest>;
55
- findUntranslatedContent(targetLocale: string, options?: FindOptions): Generator<ContentManifest>;
56
- readonly sitesConfig: SitesConfig;
57
- batchUpdate(operations: UpdateLocaleInput[]): Promise<BatchResult>;
58
- getContentAsBuffer(id: string, locale: string): Promise<{
59
- buffer: Uint8Array;
60
- etag: string;
61
- contentType: 'application/json' | 'text/mdx';
62
- } | null>;
63
- }
64
- //# sourceMappingURL=content-api.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-api.interface.d.ts","sourceRoot":"","sources":["../src/content-api.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,UAAU;IAGzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAErD;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACzE,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/D,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACjE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/D,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAGjE,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAGpB,cAAc,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;IACpE,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;IAGjG,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAGlC,WAAW,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAGnE,kBAAkB,CAChB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;QACT,MAAM,EAAE,UAAU,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,kBAAkB,GAAG,UAAU,CAAC;KAC9C,GAAG,IAAI,CAAC,CAAC;CACX"}
@@ -1,31 +0,0 @@
1
- import type { ContentIndex } from './content-index';
2
- import type { ContentManifest, GlobalFilters, SitesConfig } from './types';
3
- /**
4
- * Apply filters to a single content manifest
5
- * Pure function that checks if a manifest matches all provided filters
6
- */
7
- export declare function applyContentFilters(manifest: ContentManifest, filters: GlobalFilters): boolean;
8
- /**
9
- * Filter a collection of content manifests based on localization status
10
- * Returns manifests that match the specified localization criteria
11
- */
12
- export declare function filterByLocalization(allManifests: ContentManifest[], filters: GlobalFilters, siteLocales: string[]): ContentManifest[];
13
- /**
14
- * Generator that yields manifests after applying all filters
15
- */
16
- export declare function filteredContentGenerator(contentIndex: ContentIndex, filters: GlobalFilters): Generator<ContentManifest>;
17
- /**
18
- * Generator that yields manifests using the most efficient index path
19
- */
20
- export declare function getFilteredManifestsGenerator(contentIndex: ContentIndex, filters: GlobalFilters): Generator<ContentManifest>;
21
- /**
22
- * Get filtered manifests using indexes where possible for performance
23
- * This function leverages ContentIndex's specialized indexes to avoid full scans
24
- */
25
- export declare function getFilteredManifests(contentIndex: ContentIndex, filters: GlobalFilters): ContentManifest[];
26
- /**
27
- * Generator that yields manifests after applying all filters
28
- * This is the main entry point for filtering content using indexes efficiently
29
- */
30
- export declare function filterContentWithIndexes(contentIndex: ContentIndex, filters: GlobalFilters | undefined, sitesConfig: SitesConfig): Generator<ContentManifest>;
31
- //# sourceMappingURL=content-filters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-filters.d.ts","sourceRoot":"","sources":["../src/content-filters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CA2C9F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,eAAe,EAAE,EAC/B,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,MAAM,EAAE,GACpB,eAAe,EAAE,CAgDnB;AAED;;GAEG;AACH,wBAAiB,wBAAwB,CACvC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,aAAa,GACrB,SAAS,CAAC,eAAe,CAAC,CAM5B;AAED;;GAEG;AACH,wBAAiB,6BAA6B,CAC5C,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,aAAa,GACrB,SAAS,CAAC,eAAe,CAAC,CAmD5B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,eAAe,EAAE,CAE1G;AAED;;;GAGG;AACH,wBAAiB,wBAAwB,CACvC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,WAAW,EAAE,WAAW,GACvB,SAAS,CAAC,eAAe,CAAC,CA6E5B"}