@conloca/content-api 0.1.15 → 0.1.16
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/asset-manifest.d.ts +23 -0
- package/dist/asset-manifest.d.ts.map +1 -0
- package/dist/asset-manifest.js +73 -0
- package/dist/asset-operations.d.ts +159 -0
- package/dist/asset-operations.d.ts.map +1 -0
- package/dist/asset-operations.js +736 -0
- package/dist/asset-types.d.ts +56 -0
- package/dist/asset-types.d.ts.map +1 -0
- package/dist/asset-types.js +7 -0
- package/dist/base-content-index.d.ts +57 -0
- package/dist/base-content-index.d.ts.map +1 -0
- package/dist/base-content-index.js +179 -0
- package/dist/block-index.d.ts +9 -0
- package/dist/block-index.d.ts.map +1 -0
- package/dist/block-index.js +11 -0
- package/dist/blocks.d.ts +16 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +103 -0
- package/dist/cf-access.d.ts +31 -0
- package/dist/cf-access.d.ts.map +1 -0
- package/dist/cf-access.js +66 -0
- package/dist/component-registry.d.ts +50 -0
- package/dist/component-registry.d.ts.map +1 -0
- package/dist/component-registry.js +120 -0
- package/dist/{component-registry.types-CBGONnYn.d.mts → component-registry.types-C0ctF9nh.d.mts} +1 -1
- package/dist/component-registry.types-C0ctF9nh.d.mts.map +1 -0
- package/dist/component-registry.types.d.ts +11 -0
- package/dist/component-registry.types.d.ts.map +1 -0
- package/dist/component-registry.types.js +1 -0
- package/dist/content-api.interface.d.ts +64 -0
- package/dist/content-api.interface.d.ts.map +1 -0
- package/dist/content-api.interface.js +1 -0
- package/dist/content-filters.d.ts +31 -0
- package/dist/content-filters.d.ts.map +1 -0
- package/dist/content-filters.js +246 -0
- package/dist/content-index-D092_vk1.mjs +629 -0
- package/dist/content-index-D092_vk1.mjs.map +1 -0
- package/dist/content-index-D6IVMmAB.d.mts +127 -0
- package/dist/content-index-D6IVMmAB.d.mts.map +1 -0
- package/dist/content-index.d.ts +126 -0
- package/dist/content-index.d.ts.map +1 -0
- package/dist/content-index.js +418 -0
- package/dist/content-operations-DIbsxG5A.d.mts +354 -0
- package/dist/content-operations-DIbsxG5A.d.mts.map +1 -0
- package/dist/content-operations.d.ts +93 -0
- package/dist/content-operations.d.ts.map +1 -0
- package/dist/content-operations.js +275 -0
- package/dist/content-reader.d.ts +10 -0
- package/dist/content-reader.d.ts.map +1 -0
- package/dist/content-reader.js +13 -0
- package/dist/content-utils-fWNHTrPy.mjs +280 -0
- package/dist/content-utils-fWNHTrPy.mjs.map +1 -0
- package/dist/content-utils.d.ts +132 -0
- package/dist/content-utils.d.ts.map +1 -0
- package/dist/content-utils.js +352 -0
- package/dist/content-watcher.d.ts +43 -0
- package/dist/content-watcher.d.ts.map +1 -0
- package/dist/content-watcher.js +83 -0
- package/dist/{data-Db1Iv9T0.mjs → data-DquNIEnQ.mjs} +4 -2
- package/dist/{data-Db1Iv9T0.mjs.map → data-DquNIEnQ.mjs.map} +1 -1
- package/dist/data-index.d.ts +8 -0
- package/dist/data-index.d.ts.map +1 -0
- package/dist/data-index.js +7 -0
- package/dist/data.d.ts +43 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +103 -0
- package/dist/etag-utils.d.ts +77 -0
- package/dist/etag-utils.d.ts.map +1 -0
- package/dist/etag-utils.js +160 -0
- package/dist/filesystem-content-api-B1KIQJfk.mjs +2 -0
- package/dist/{filesystem-content-api-kxKY5IUw.mjs → filesystem-content-api-C0HIhqZi.mjs} +172 -1230
- package/dist/filesystem-content-api-C0HIhqZi.mjs.map +1 -0
- package/dist/{filesystem-content-api-C1TM0GLo.d.mts → filesystem-content-api-DCdNi-co.d.mts} +19 -4
- package/dist/filesystem-content-api-DCdNi-co.d.mts.map +1 -0
- package/dist/filesystem-content-api.d.ts +135 -0
- package/dist/filesystem-content-api.d.ts.map +1 -0
- package/dist/filesystem-content-api.js +2181 -0
- package/dist/git-operations.d.ts +49 -0
- package/dist/git-operations.d.ts.map +1 -0
- package/dist/git-operations.js +252 -0
- package/dist/header-parser.d.ts +37 -0
- package/dist/header-parser.d.ts.map +1 -0
- package/dist/header-parser.js +286 -0
- package/dist/in-memory-content-api.d.ts +35 -0
- package/dist/in-memory-content-api.d.ts.map +1 -0
- package/dist/in-memory-content-api.js +591 -0
- package/dist/index-DxVTFK66.d.mts +105 -0
- package/dist/index-DxVTFK66.d.mts.map +1 -0
- package/dist/index.d.mts +6 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.mjs +37 -6
- package/dist/index.mjs.map +1 -1
- package/dist/indexing.d.mts +152 -0
- package/dist/indexing.d.mts.map +1 -0
- package/dist/indexing.d.ts +5 -0
- package/dist/indexing.d.ts.map +1 -0
- package/dist/indexing.js +7 -0
- package/dist/indexing.mjs +255 -0
- package/dist/indexing.mjs.map +1 -0
- package/dist/json-whitespace-view.d.ts +32 -0
- package/dist/json-whitespace-view.d.ts.map +1 -0
- package/dist/json-whitespace-view.js +152 -0
- package/dist/middleware.d.ts +20 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +1031 -0
- package/dist/node.d.mts +10 -15
- package/dist/node.d.mts.map +1 -1
- package/dist/node.d.ts +25 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +24 -0
- package/dist/node.mjs +89 -135
- package/dist/node.mjs.map +1 -1
- package/dist/reader.d.mts +5 -8
- package/dist/reader.d.mts.map +1 -1
- package/dist/reader.d.ts +15 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +13 -0
- package/dist/reader.mjs +8 -8
- package/dist/reader.mjs.map +1 -1
- package/dist/schemas/index.d.mts +2 -90
- package/dist/schemas/index.d.ts +102 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +87 -0
- package/dist/schemas/index.mjs +2 -70
- package/dist/schemas-CFRD0FIQ.mjs +84 -0
- package/dist/schemas-CFRD0FIQ.mjs.map +1 -0
- package/dist/{site-vNtJ5jCh.mjs → site-8oaj1Q60.mjs} +21 -193
- package/dist/site-8oaj1Q60.mjs.map +1 -0
- package/dist/site-index-B_254bCc.d.mts +136 -0
- package/dist/site-index-B_254bCc.d.mts.map +1 -0
- package/dist/site-index.d.ts +60 -0
- package/dist/site-index.d.ts.map +1 -0
- package/dist/site-index.js +287 -0
- package/dist/site.d.ts +21 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +168 -0
- package/dist/{types-DWt912tu.mjs → types-DOdldbfD.mjs} +3 -2
- package/dist/types-DOdldbfD.mjs.map +1 -0
- package/dist/types-DjfhS272.d.mts +456 -0
- package/dist/types-DjfhS272.d.mts.map +1 -0
- package/dist/types.d.ts +453 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +36 -0
- package/dist/url-safe-base64.d.ts +12 -0
- package/dist/url-safe-base64.d.ts.map +1 -0
- package/dist/url-safe-base64.js +40 -0
- package/dist/url-validation.d.ts +14 -0
- package/dist/url-validation.d.ts.map +1 -0
- package/dist/url-validation.js +81 -0
- package/dist/utils/atomic-write.d.ts +6 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/atomic-write.js +20 -0
- package/dist/utils.d.ts +46 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +70 -0
- package/dist/vite-plugin.d.ts +12 -0
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.js +29 -0
- package/dist/vxjson-qHrgLGip.mjs +555 -0
- package/dist/vxjson-qHrgLGip.mjs.map +1 -0
- package/dist/vxjson-serialize-geF6qvpn.mjs +34 -0
- package/dist/vxjson-serialize-geF6qvpn.mjs.map +1 -0
- package/dist/vxjson-serialize.d.mts +17 -0
- package/dist/vxjson-serialize.d.mts.map +1 -0
- package/dist/vxjson-serialize.d.ts +14 -0
- package/dist/vxjson-serialize.d.ts.map +1 -0
- package/dist/vxjson-serialize.js +50 -0
- package/dist/vxjson-serialize.mjs +2 -0
- package/dist/vxjson.d.ts +112 -0
- package/dist/vxjson.d.ts.map +1 -0
- package/dist/vxjson.js +391 -0
- package/dist/xxhash.d.ts +10 -0
- package/dist/xxhash.d.ts.map +1 -0
- package/dist/xxhash.js +31 -0
- package/package.json +79 -17
- package/dist/component-registry.types-CBGONnYn.d.mts.map +0 -1
- package/dist/content-operations-Dv67amz3.d.mts +0 -852
- package/dist/content-operations-Dv67amz3.d.mts.map +0 -1
- package/dist/filesystem-content-api-C1TM0GLo.d.mts.map +0 -1
- package/dist/filesystem-content-api-kxKY5IUw.mjs.map +0 -1
- package/dist/schemas/index.d.mts.map +0 -1
- package/dist/schemas/index.mjs.map +0 -1
- package/dist/site-vNtJ5jCh.mjs.map +0 -1
- package/dist/types-DWt912tu.mjs.map +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,CA+CtG;IAED;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAkB7C;IAED;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAoB5B;IAED;;OAEG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAG/D;IAED;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAE9C;IAED;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAanF;IAED;;OAEG;IACF,eAAe,IAAI,SAAS,CAAC,eAAe,CAAC,CAI7C;IAED;;OAEG;IACF,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,CAMhE;IAED;;OAEG;IACF,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,CAMxE;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI,CAKZ;CACF"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { localesOf } from './content-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for content indexes (blocks, data)
|
|
4
|
+
* Maintains collection->name->locale lookups with V8-optimized structures
|
|
5
|
+
*/
|
|
6
|
+
export class BaseContentIndex {
|
|
7
|
+
// Primary index: id -> ContentManifest
|
|
8
|
+
index = new Map();
|
|
9
|
+
// Content cache: id -> locale -> content (for small files)
|
|
10
|
+
contentCache = new Map();
|
|
11
|
+
// Name index: collection -> name -> ContentManifest
|
|
12
|
+
nameIndex = new Map();
|
|
13
|
+
// Collections used
|
|
14
|
+
collections = new Set();
|
|
15
|
+
/**
|
|
16
|
+
* Add or update content in the index
|
|
17
|
+
* Merges manifest locales and updates content cache if provided
|
|
18
|
+
*/
|
|
19
|
+
addContent(identity, localeVersion, content) {
|
|
20
|
+
// Get existing manifest
|
|
21
|
+
const existing = this.index.get(identity.id);
|
|
22
|
+
const locale = localeVersion.locale;
|
|
23
|
+
if (existing) {
|
|
24
|
+
// Update single locale
|
|
25
|
+
const existingLocale = existing.locales[locale];
|
|
26
|
+
if (!existingLocale || existingLocale.etag !== localeVersion.etag) {
|
|
27
|
+
existing.locales[locale] = localeVersion;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// New content - create ContentManifest with single locale
|
|
32
|
+
const newManifest = {
|
|
33
|
+
id: identity.id,
|
|
34
|
+
type: identity.type,
|
|
35
|
+
kind: identity.kind,
|
|
36
|
+
site: identity.site,
|
|
37
|
+
collection: identity.collection,
|
|
38
|
+
locales: {
|
|
39
|
+
[locale]: localeVersion,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
this.index.set(identity.id, newManifest);
|
|
43
|
+
this.collections.add(identity.collection);
|
|
44
|
+
}
|
|
45
|
+
// Update content cache if provided
|
|
46
|
+
if (content !== undefined) {
|
|
47
|
+
const existingCache = this.contentCache.get(identity.id);
|
|
48
|
+
if (existingCache) {
|
|
49
|
+
// Update single locale content
|
|
50
|
+
existingCache[locale] = content;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.contentCache.set(identity.id, { [locale]: content });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Update name index
|
|
57
|
+
const manifestToIndex = existing || this.index.get(identity.id);
|
|
58
|
+
if (localeVersion.name) {
|
|
59
|
+
if (!this.nameIndex.has(identity.collection)) {
|
|
60
|
+
this.nameIndex.set(identity.collection, new Map());
|
|
61
|
+
}
|
|
62
|
+
this.nameIndex.get(identity.collection).set(localeVersion.name, manifestToIndex);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Remove a specific locale from an entry
|
|
67
|
+
*/
|
|
68
|
+
removeLocale(id, locale) {
|
|
69
|
+
const manifest = this.index.get(id);
|
|
70
|
+
if (!manifest || !manifest.locales[locale])
|
|
71
|
+
return;
|
|
72
|
+
// Remove locale from manifest
|
|
73
|
+
manifest.locales[locale] = undefined;
|
|
74
|
+
// Remove from content cache
|
|
75
|
+
const contentCache = this.contentCache.get(id);
|
|
76
|
+
if (contentCache) {
|
|
77
|
+
delete contentCache[locale];
|
|
78
|
+
}
|
|
79
|
+
// If no defined locales left, remove the entire entry
|
|
80
|
+
const remainingLocales = Object.values(manifest.locales).filter((v) => v !== undefined);
|
|
81
|
+
if (remainingLocales.length === 0) {
|
|
82
|
+
this.removeEntry(id);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Remove an entry from the index
|
|
87
|
+
*/
|
|
88
|
+
removeEntry(id) {
|
|
89
|
+
const manifest = this.index.get(id);
|
|
90
|
+
if (!manifest)
|
|
91
|
+
return;
|
|
92
|
+
// Remove from name index
|
|
93
|
+
for (const localeVersion of localesOf(manifest)) {
|
|
94
|
+
if (localeVersion.name) {
|
|
95
|
+
const collectionMap = this.nameIndex.get(manifest.collection);
|
|
96
|
+
if (collectionMap) {
|
|
97
|
+
collectionMap.delete(localeVersion.name);
|
|
98
|
+
}
|
|
99
|
+
break; // All locales have same name
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Remove from primary index
|
|
103
|
+
this.index.delete(id);
|
|
104
|
+
// Remove from content cache
|
|
105
|
+
this.contentCache.delete(id);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get cached content for a specific locale
|
|
109
|
+
*/
|
|
110
|
+
getCachedContent(id, locale) {
|
|
111
|
+
const localeContent = this.contentCache.get(id);
|
|
112
|
+
return localeContent?.[locale] || null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get content manifest
|
|
116
|
+
*/
|
|
117
|
+
getManifest(id) {
|
|
118
|
+
return this.index.get(id) || null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Find entry by name
|
|
122
|
+
*/
|
|
123
|
+
getByName(collection, name, locale) {
|
|
124
|
+
const collectionMap = this.nameIndex.get(collection);
|
|
125
|
+
if (!collectionMap)
|
|
126
|
+
return null;
|
|
127
|
+
const manifest = collectionMap.get(name);
|
|
128
|
+
if (!manifest)
|
|
129
|
+
return null;
|
|
130
|
+
// If specific locale requested, check it exists
|
|
131
|
+
if (locale && !manifest.locales[locale]) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
return manifest;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Generator for all manifests
|
|
138
|
+
*/
|
|
139
|
+
*getAllManifests() {
|
|
140
|
+
for (const manifest of this.index.values()) {
|
|
141
|
+
yield manifest;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Generator for manifests by locale
|
|
146
|
+
*/
|
|
147
|
+
*getManifestsByLocale(locale) {
|
|
148
|
+
for (const manifest of this.index.values()) {
|
|
149
|
+
if (manifest.locales[locale]) {
|
|
150
|
+
yield manifest;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Generator for manifests by collection
|
|
156
|
+
*/
|
|
157
|
+
*getManifestsByCollection(collection) {
|
|
158
|
+
for (const manifest of this.index.values()) {
|
|
159
|
+
if (manifest.collection === collection) {
|
|
160
|
+
yield manifest;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get the count of indexed content entries (unique IDs)
|
|
166
|
+
*/
|
|
167
|
+
get entryCount() {
|
|
168
|
+
return this.index.size;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Clear all indexes
|
|
172
|
+
*/
|
|
173
|
+
clear() {
|
|
174
|
+
this.index.clear();
|
|
175
|
+
this.contentCache.clear();
|
|
176
|
+
this.nameIndex.clear();
|
|
177
|
+
this.collections.clear();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;IAC9C,YAAY,OAAO,EAAE,MAAM,EAAE,EAG5B;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseContentIndex } from './base-content-index';
|
|
2
|
+
/**
|
|
3
|
+
* V8-optimized index for blocks
|
|
4
|
+
* Maintains collection->name->locale lookups
|
|
5
|
+
*/
|
|
6
|
+
export class BlockIndex extends BaseContentIndex {
|
|
7
|
+
constructor(locales) {
|
|
8
|
+
super();
|
|
9
|
+
// locales parameter kept for future use
|
|
10
|
+
}
|
|
11
|
+
}
|
package/dist/blocks.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;IAFpB,YACU,GAAG,EAAE,UAAU,EACf,UAAU,EAAE,UAAU,EAC5B;IAGH,WAAW,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC,eAAe,CAAC,CAuB/D;IAGD,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,CAEnF;IAGD,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAG7E;IAGD,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnF;IAGD,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAkB3C;IAGK,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6B1D;CACF"}
|
package/dist/blocks.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export class Blocks {
|
|
2
|
+
api;
|
|
3
|
+
blockIndex;
|
|
4
|
+
constructor(api, blockIndex) {
|
|
5
|
+
this.api = api;
|
|
6
|
+
this.blockIndex = blockIndex;
|
|
7
|
+
}
|
|
8
|
+
// Content discovery
|
|
9
|
+
*listContent(filters) {
|
|
10
|
+
// Choose the most efficient method based on filters
|
|
11
|
+
if (filters?.collection) {
|
|
12
|
+
if (filters.locales && filters.locales.length > 0) {
|
|
13
|
+
// Filter by locales after getting collection entries
|
|
14
|
+
for (const manifest of this.blockIndex.getManifestsByCollection(filters.collection)) {
|
|
15
|
+
if (filters.locales.some((locale) => manifest.locales[locale])) {
|
|
16
|
+
yield manifest;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
yield* this.blockIndex.getManifestsByCollection(filters.collection);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (filters?.locales && filters.locales.length > 0) {
|
|
25
|
+
// For multiple locales, we need to check each
|
|
26
|
+
for (const manifest of this.blockIndex.getAllManifests()) {
|
|
27
|
+
if (filters.locales.some((locale) => manifest.locales[locale])) {
|
|
28
|
+
yield manifest;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
yield* this.blockIndex.getAllManifests();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Get all block collections
|
|
37
|
+
get collections() {
|
|
38
|
+
return this.blockIndex.collections;
|
|
39
|
+
}
|
|
40
|
+
// Block operations (returns null if not found)
|
|
41
|
+
getByName(collection, name, locale) {
|
|
42
|
+
return this.blockIndex.getByName(collection, name, locale);
|
|
43
|
+
}
|
|
44
|
+
// Check if block name is available
|
|
45
|
+
isNameAvailable(collection, name, excludeId) {
|
|
46
|
+
const existing = this.getByName(collection, name);
|
|
47
|
+
return !existing || existing.id === excludeId;
|
|
48
|
+
}
|
|
49
|
+
// Get the ID of content that conflicts with a block name
|
|
50
|
+
getNameConflict(collection, name, excludeId) {
|
|
51
|
+
const existing = this.getByName(collection, name);
|
|
52
|
+
if (existing && existing.id !== excludeId) {
|
|
53
|
+
return existing.id;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
// Check if block name is valid
|
|
58
|
+
isBlockNameValid(blockName) {
|
|
59
|
+
// Block names must not be empty
|
|
60
|
+
if (!blockName || blockName.trim() === '') {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
// Block names must not contain dots (would interfere with locale suffixes)
|
|
64
|
+
if (blockName.includes('.')) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
// Block names must not contain path separators
|
|
68
|
+
if (blockName.includes('/') || blockName.includes('\\')) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
// Block names should only contain alphanumeric, hyphens, underscores
|
|
72
|
+
return /^[a-zA-Z0-9_-]+$/.test(blockName);
|
|
73
|
+
}
|
|
74
|
+
// Create block with name validation
|
|
75
|
+
async create(data) {
|
|
76
|
+
// Validate block name
|
|
77
|
+
if (!this.isBlockNameValid(data.name)) {
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
reason: 'invalid_name',
|
|
81
|
+
error: new Error(`Invalid block name: ${data.name}`),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Check if name is already taken in any locale
|
|
85
|
+
const existing = this.getByName(data.collection, data.name);
|
|
86
|
+
if (existing) {
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
reason: 'name_taken',
|
|
90
|
+
error: new Error(`Block name ${data.name} already exists in collection ${data.collection}`),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Create the content
|
|
94
|
+
return this.api.createContent({
|
|
95
|
+
kind: 'block',
|
|
96
|
+
collection: data.collection,
|
|
97
|
+
type: 'mdx',
|
|
98
|
+
name: data.name,
|
|
99
|
+
meta: data.meta,
|
|
100
|
+
locales: data.locales,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cf-access.d.ts","sourceRoot":"","sources":["../src/cf-access.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
import { createRemoteJWKSet, jwtVerify } from 'jose';
|
|
9
|
+
const CF_ACCESS_TEAM_NAME = process.env.CF_ACCESS_TEAM_NAME;
|
|
10
|
+
const CF_ACCESS_AUD = process.env.CF_ACCESS_AUD;
|
|
11
|
+
// JWKS with built-in caching (handles key rotation automatically)
|
|
12
|
+
const JWKS = CF_ACCESS_TEAM_NAME
|
|
13
|
+
? createRemoteJWKSet(new URL(`https://${CF_ACCESS_TEAM_NAME}.cloudflareaccess.com/cdn-cgi/access/certs`))
|
|
14
|
+
: null;
|
|
15
|
+
/**
|
|
16
|
+
* Extract CF Access JWT token from request.
|
|
17
|
+
* Checks Cf-Access-Jwt-Assertion header first, falls back to CF_Authorization cookie.
|
|
18
|
+
*/
|
|
19
|
+
export function extractCFAccessToken(request) {
|
|
20
|
+
// Header is primary (always present when behind CF Access)
|
|
21
|
+
const headerToken = request.headers.get('Cf-Access-Jwt-Assertion');
|
|
22
|
+
if (headerToken)
|
|
23
|
+
return headerToken;
|
|
24
|
+
// Cookie is fallback (browser requests)
|
|
25
|
+
const cookies = request.headers.get('Cookie') || '';
|
|
26
|
+
const match = cookies.match(/CF_Authorization=([^;]+)/);
|
|
27
|
+
return match ? match[1] : null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validate CF Access JWT from request.
|
|
31
|
+
*
|
|
32
|
+
* Returns { valid: true, required: false } when env vars not set (local dev mode).
|
|
33
|
+
* Returns { valid: true, required: true, user } when token is valid.
|
|
34
|
+
* Returns { valid: false, required: true, error } when token is invalid or missing.
|
|
35
|
+
*/
|
|
36
|
+
export async function validateCFAccessRequest(request) {
|
|
37
|
+
// If CF Access not configured, skip validation (local dev)
|
|
38
|
+
if (!CF_ACCESS_TEAM_NAME || !CF_ACCESS_AUD || !JWKS) {
|
|
39
|
+
return { valid: true, required: false };
|
|
40
|
+
}
|
|
41
|
+
const token = extractCFAccessToken(request);
|
|
42
|
+
if (!token) {
|
|
43
|
+
return { valid: false, required: true, error: 'No token provided' };
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const { payload } = await jwtVerify(token, JWKS, {
|
|
47
|
+
issuer: `https://${CF_ACCESS_TEAM_NAME}.cloudflareaccess.com`,
|
|
48
|
+
audience: CF_ACCESS_AUD,
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
valid: true,
|
|
52
|
+
required: true,
|
|
53
|
+
user: {
|
|
54
|
+
email: typeof payload.email === 'string' && payload.email ? payload.email : undefined,
|
|
55
|
+
sub: typeof payload.sub === 'string' && payload.sub ? payload.sub : undefined,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return {
|
|
61
|
+
valid: false,
|
|
62
|
+
required: true,
|
|
63
|
+
error: error instanceof Error ? error.message : 'Validation failed',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;AAGpC;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,WAAW,CAAS;IAE5B,YAAY,SAAS,EAAE,MAAM,EAE5B;IAED;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBhC;IAED;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;OAEG;YACW,IAAI;IAWlB;;OAEG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/D;IAED;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAGpD;IAED;;OAEG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUlD;IAED;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtC;IAED;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAO5C;IAED;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKtC;CACF"}
|