@nuasite/cms-core 0.43.0-beta.1
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/types/collection-scanner.d.ts +12 -0
- package/dist/types/collection-scanner.d.ts.map +1 -0
- package/dist/types/component-registry.d.ts +15 -0
- package/dist/types/component-registry.d.ts.map +1 -0
- package/dist/types/content-config-ast.d.ts +45 -0
- package/dist/types/content-config-ast.d.ts.map +1 -0
- package/dist/types/core.d.ts +44 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/fs/glob.d.ts +3 -0
- package/dist/types/fs/glob.d.ts.map +1 -0
- package/dist/types/fs/node-fs.d.ts +7 -0
- package/dist/types/fs/node-fs.d.ts.map +1 -0
- package/dist/types/fs/types.d.ts +33 -0
- package/dist/types/fs/types.d.ts.map +1 -0
- package/dist/types/handlers/entry-ops.d.ts +69 -0
- package/dist/types/handlers/entry-ops.d.ts.map +1 -0
- package/dist/types/handlers/page-ops.d.ts +14 -0
- package/dist/types/handlers/page-ops.d.ts.map +1 -0
- package/dist/types/handlers/redirect-ops.d.ts +10 -0
- package/dist/types/handlers/redirect-ops.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/media/contember.d.ts +18 -0
- package/dist/types/media/contember.d.ts.map +1 -0
- package/dist/types/media/index.d.ts +5 -0
- package/dist/types/media/index.d.ts.map +1 -0
- package/dist/types/media/local.d.ts +12 -0
- package/dist/types/media/local.d.ts.map +1 -0
- package/dist/types/media/project-images.d.ts +15 -0
- package/dist/types/media/project-images.d.ts.map +1 -0
- package/dist/types/media/s3.d.ts +12 -0
- package/dist/types/media/s3.d.ts.map +1 -0
- package/dist/types/shared.d.ts +24 -0
- package/dist/types/shared.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +55 -0
- package/src/collection-scanner.ts +935 -0
- package/src/component-registry.ts +308 -0
- package/src/content-config-ast.ts +536 -0
- package/src/core.ts +167 -0
- package/src/fs/glob.ts +32 -0
- package/src/fs/node-fs.ts +138 -0
- package/src/fs/types.ts +26 -0
- package/src/handlers/entry-ops.ts +528 -0
- package/src/handlers/page-ops.ts +203 -0
- package/src/handlers/redirect-ops.ts +139 -0
- package/src/index.ts +41 -0
- package/src/media/contember.ts +90 -0
- package/src/media/index.ts +4 -0
- package/src/media/local.ts +147 -0
- package/src/media/project-images.ts +82 -0
- package/src/media/s3.ts +151 -0
- package/src/shared.ts +65 -0
- package/src/tsconfig.json +9 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CollectionDefinition } from '@nuasite/cms-types';
|
|
2
|
+
import { type ParseCache } from './content-config-ast';
|
|
3
|
+
import type { CmsFileSystem } from './fs/types';
|
|
4
|
+
/**
|
|
5
|
+
* Scan all collections in the content directory.
|
|
6
|
+
*
|
|
7
|
+
* `contentDir` is a root-relative directory (default `src/content`); all I/O is
|
|
8
|
+
* resolved against the injected `CmsFileSystem`'s root. `parseCache` keeps the
|
|
9
|
+
* mtime-keyed content-config parse result across calls within one core instance.
|
|
10
|
+
*/
|
|
11
|
+
export declare function scanCollections(fs: CmsFileSystem, contentDir?: string, parseCache?: ParseCache): Promise<Record<string, CollectionDefinition>>;
|
|
12
|
+
//# sourceMappingURL=collection-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-scanner.d.ts","sourceRoot":"","sources":["../../src/collection-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAmD,MAAM,oBAAoB,CAAA;AAG/G,OAAO,EAAE,KAAK,UAAU,EAA2D,MAAM,sBAAsB,CAAA;AAC/G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AA82B/C;;;;;;GAMG;AACH,wBAAsB,eAAe,CACpC,EAAE,EAAE,aAAa,EACjB,UAAU,GAAE,MAAsB,EAClC,UAAU,GAAE,UAAsB,GAChC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAyC/C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentDefinition } from '@nuasite/cms-types';
|
|
2
|
+
import type { CmsFileSystem } from './fs/types';
|
|
3
|
+
/**
|
|
4
|
+
* Scan Astro component files under the given directories and extract their
|
|
5
|
+
* definitions (props, slots, description, preview width) over the FileSystem
|
|
6
|
+
* port.
|
|
7
|
+
*
|
|
8
|
+
* Ported verbatim from `@nuasite/cms`'s `ComponentRegistry` so that the
|
|
9
|
+
* `componentDefinitions` resolved internally by `updateEntry` (for MDX import
|
|
10
|
+
* injection) match the manifest-fed definitions used by the legacy handler. The
|
|
11
|
+
* only behavioral difference is the I/O boundary: directory walking and file
|
|
12
|
+
* reads go through `CmsFileSystem` instead of `node:fs` + `getProjectRoot()`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scanComponentDefinitions(fs: CmsFileSystem, componentDirs?: string[]): Promise<Record<string, ComponentDefinition>>;
|
|
15
|
+
//# 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":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,oBAAoB,CAAA;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC7C,EAAE,EAAE,aAAa,EACjB,aAAa,GAAE,MAAM,EAAuB,GAC1C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAQ9C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type FieldHints, type FieldType } from '@nuasite/cms-types';
|
|
2
|
+
import type { CmsFileSystem } from './fs/types';
|
|
3
|
+
export interface ParsedReference {
|
|
4
|
+
target: string;
|
|
5
|
+
isArray: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ParsedField {
|
|
8
|
+
name: string;
|
|
9
|
+
type?: FieldType;
|
|
10
|
+
options?: string[];
|
|
11
|
+
hints?: FieldHints;
|
|
12
|
+
required: boolean;
|
|
13
|
+
orderBy?: {
|
|
14
|
+
direction: 'asc' | 'desc';
|
|
15
|
+
};
|
|
16
|
+
reference?: ParsedReference;
|
|
17
|
+
/** True when the field is `image()` from an Astro callback schema, which routes through `astro:assets`. */
|
|
18
|
+
astroImage?: boolean;
|
|
19
|
+
/** Element type for `array` fields */
|
|
20
|
+
itemType?: FieldType;
|
|
21
|
+
/** Nested fields for `object` fields, or per-item fields for `array` of objects */
|
|
22
|
+
fields?: ParsedField[];
|
|
23
|
+
}
|
|
24
|
+
export interface ParsedCollection {
|
|
25
|
+
name: string;
|
|
26
|
+
fields: ParsedField[];
|
|
27
|
+
loaderPattern?: string;
|
|
28
|
+
loaderBase?: string;
|
|
29
|
+
}
|
|
30
|
+
export type ParsedConfig = Map<string, ParsedCollection>;
|
|
31
|
+
/** Cached parse result keyed by config path; invalidated by mtime. */
|
|
32
|
+
export type ParseCache = Map<string, {
|
|
33
|
+
mtimeMs: number;
|
|
34
|
+
parsed: ParsedConfig;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Parse the project's Astro content config file (TypeScript) into a structured
|
|
38
|
+
* representation of each collection's schema. Returns an empty map if no config
|
|
39
|
+
* file exists or parsing fails. The mtime-keyed cache (via `fs.stat()`) skips
|
|
40
|
+
* re-reading and re-parsing an unchanged config file.
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseContentConfig(fs: CmsFileSystem, cache: ParseCache): Promise<ParsedConfig>;
|
|
43
|
+
/** Exported for unit testing — operates on a source string directly. */
|
|
44
|
+
export declare function parseConfigSource(source: string, _sourcePath?: string): ParsedConfig;
|
|
45
|
+
//# sourceMappingURL=content-config-ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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a,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAqBpG;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CA8GpF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AddRedirectRequest, CollectionDefinition, ComponentDefinition, CreatePageRequest, DeletePageRequest, DeleteRedirectRequest, DuplicatePageRequest, GetRedirectsResponse, LayoutInfo, MediaStorageAdapter, MutationResult, PageOperationResponse, RedirectOperationResponse, UpdateRedirectRequest } from '@nuasite/cms-types';
|
|
2
|
+
import type { CmsFileSystem } from './fs/types';
|
|
3
|
+
import { type AddArrayItemInput, type CreateEntryInput, type GetEntryResult, type RemoveArrayItemInput, type UpdateEntryInput } from './handlers/entry-ops';
|
|
4
|
+
export interface CmsCoreOptions {
|
|
5
|
+
/** Content collections directory, relative to the filesystem root. Defaults to `src/content`. */
|
|
6
|
+
contentDir?: string;
|
|
7
|
+
/** Pluggable media storage adapter (local / s3 / contember). */
|
|
8
|
+
media?: MediaStorageAdapter;
|
|
9
|
+
/** Directories to scan for Astro components (used for MDX import resolution). Defaults to `['src/components']`. */
|
|
10
|
+
componentDirs?: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The framework-agnostic CMS brain over a `CmsFileSystem` port.
|
|
14
|
+
*
|
|
15
|
+
* Exposes the read/scan surface plus the structural mutations (entry / array /
|
|
16
|
+
* page / redirect CRUD) and a pluggable media adapter. All I/O flows through the
|
|
17
|
+
* injected `CmsFileSystem`; nothing here knows about Astro, Vite, HTTP or the
|
|
18
|
+
* render-time page manifest.
|
|
19
|
+
*/
|
|
20
|
+
export interface CmsCore {
|
|
21
|
+
/** Scan all content collections, returning their inferred definitions keyed by name. */
|
|
22
|
+
scanCollections(): Promise<Record<string, CollectionDefinition>>;
|
|
23
|
+
/** Resolve the Astro component definitions used for MDX import injection. */
|
|
24
|
+
scanComponents(): Promise<Record<string, ComponentDefinition>>;
|
|
25
|
+
/** Read a single entry's frontmatter + body, or `null` when it does not exist. */
|
|
26
|
+
getEntry(collection: string, slug: string): Promise<GetEntryResult | null>;
|
|
27
|
+
createEntry(input: CreateEntryInput): Promise<MutationResult>;
|
|
28
|
+
updateEntry(input: UpdateEntryInput): Promise<MutationResult>;
|
|
29
|
+
deleteEntry(collection: string, slug: string): Promise<MutationResult>;
|
|
30
|
+
renameEntry(collection: string, from: string, to: string): Promise<MutationResult>;
|
|
31
|
+
addArrayItem(input: AddArrayItemInput): Promise<MutationResult>;
|
|
32
|
+
removeArrayItem(input: RemoveArrayItemInput): Promise<MutationResult>;
|
|
33
|
+
createPage(input: CreatePageRequest): Promise<PageOperationResponse>;
|
|
34
|
+
duplicatePage(input: DuplicatePageRequest): Promise<PageOperationResponse>;
|
|
35
|
+
deletePage(input: DeletePageRequest): Promise<PageOperationResponse>;
|
|
36
|
+
getLayouts(): Promise<LayoutInfo[]>;
|
|
37
|
+
listRedirects(): Promise<GetRedirectsResponse>;
|
|
38
|
+
addRedirect(input: AddRedirectRequest): Promise<RedirectOperationResponse>;
|
|
39
|
+
updateRedirect(input: UpdateRedirectRequest): Promise<RedirectOperationResponse>;
|
|
40
|
+
deleteRedirect(input: DeleteRedirectRequest): Promise<RedirectOperationResponse>;
|
|
41
|
+
media?: MediaStorageAdapter;
|
|
42
|
+
}
|
|
43
|
+
export declare function createCmsCore(fs: CmsFileSystem, opts?: CmsCoreOptions): CmsCore;
|
|
44
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,mBAA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AAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAC/D,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAGrE,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACpE,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC1E,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACpE,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IACnC,aAAa,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAC9C,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAC1E,cAAc,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAChF,cAAc,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAGhF,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAoEnF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/fs/glob.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8BjD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CmsFileSystem } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a `CmsFileSystem` backed by `node:fs`, rooted at `root`.
|
|
4
|
+
* Every path is resolved relative to `root` and validated to stay within it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createNodeFs(root: string): CmsFileSystem;
|
|
7
|
+
//# sourceMappingURL=node-fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-fs.d.ts","sourceRoot":"","sources":["../../../src/fs/node-fs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AA+D5C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAkExD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The FileSystem port: the only I/O boundary of cms-core.
|
|
3
|
+
*
|
|
4
|
+
* All paths are interpreted relative to the implementation's configured root.
|
|
5
|
+
* Implementations must resolve them under the root and reject any path that
|
|
6
|
+
* escapes it (path traversal). The same brain therefore runs unchanged over
|
|
7
|
+
* `node:fs` (sidecar + local dev) and, in principle, over a remote adapter.
|
|
8
|
+
*/
|
|
9
|
+
export interface CmsFileSystem {
|
|
10
|
+
/** Read a UTF-8 text file. Rejects when the file does not exist. */
|
|
11
|
+
readFile(path: string): Promise<string>;
|
|
12
|
+
/** Write a UTF-8 text file atomically (write temp + rename). Creates parent dirs. */
|
|
13
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
14
|
+
/** Rename/move a file. Creates the destination's parent dir. */
|
|
15
|
+
rename(from: string, to: string): Promise<void>;
|
|
16
|
+
/** Remove a file. No-op when it does not exist. */
|
|
17
|
+
remove(path: string): Promise<void>;
|
|
18
|
+
/** Whether a file or directory exists. */
|
|
19
|
+
exists(path: string): Promise<boolean>;
|
|
20
|
+
/** List the immediate children of a directory. Returns [] when it does not exist. */
|
|
21
|
+
list(dir: string): Promise<{
|
|
22
|
+
name: string;
|
|
23
|
+
isDirectory: boolean;
|
|
24
|
+
}[]>;
|
|
25
|
+
/** Resolve a glob pattern (supports `*`, `**`, `?`, `{a,b}`) to matching file paths, root-relative. */
|
|
26
|
+
glob(pattern: string): Promise<string[]>;
|
|
27
|
+
/** File metadata. Rejects when the path does not exist. */
|
|
28
|
+
stat(path: string): Promise<{
|
|
29
|
+
mtimeMs: number;
|
|
30
|
+
size: number;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fs/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,qFAAqF;IACrF,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,gEAAgE;IAChE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,mDAAmD;IACnD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,0CAA0C;IAC1C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,qFAAqF;IACrF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC,CAAA;IACpE,uGAAuG;IACvG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACxC,2DAA2D;IAC3D,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { CollectionEntryInfo, ComponentDefinition, MutationResult } from '@nuasite/cms-types';
|
|
2
|
+
import { type ParseCache } from '../content-config-ast';
|
|
3
|
+
import type { CmsFileSystem } from '../fs/types';
|
|
4
|
+
export interface GetEntryResult {
|
|
5
|
+
/** Markdown body (empty string for data collections). */
|
|
6
|
+
content: string;
|
|
7
|
+
/** Parsed frontmatter / data object. */
|
|
8
|
+
frontmatter: Record<string, unknown>;
|
|
9
|
+
/** Source file path, root-relative. */
|
|
10
|
+
sourcePath: string;
|
|
11
|
+
}
|
|
12
|
+
export interface EntryOpsDeps {
|
|
13
|
+
fs: CmsFileSystem;
|
|
14
|
+
contentDir: string;
|
|
15
|
+
parseCache: ParseCache;
|
|
16
|
+
/** Directories to scan for Astro components when resolving MDX imports. */
|
|
17
|
+
componentDirs: string[];
|
|
18
|
+
/** Resolve component definitions internally (MDX import injection). */
|
|
19
|
+
resolveComponentDefinitions: () => Promise<Record<string, ComponentDefinition>>;
|
|
20
|
+
}
|
|
21
|
+
export declare function parseFrontmatter(raw: string): {
|
|
22
|
+
frontmatter: Record<string, unknown>;
|
|
23
|
+
content: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function serializeFrontmatter(frontmatter: Record<string, unknown>, content: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Ensure MDX content has import statements for all components used in the body.
|
|
28
|
+
* Scans for `<ComponentName` tags, checks for existing imports, and prepends missing ones.
|
|
29
|
+
*
|
|
30
|
+
* `filePath` and the component `def.file` are both root-relative, forward-slash paths.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ensureMdxImports(content: string, filePath: string, componentDefinitions: Record<string, ComponentDefinition>): string;
|
|
33
|
+
export interface CreateEntryInput {
|
|
34
|
+
collection: string;
|
|
35
|
+
slug: string;
|
|
36
|
+
frontmatter: Record<string, unknown>;
|
|
37
|
+
body?: string;
|
|
38
|
+
/** File extension override for data collections (e.g. 'json', 'yaml'). Defaults to 'md'. */
|
|
39
|
+
fileExtension?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface UpdateEntryInput {
|
|
42
|
+
collection: string;
|
|
43
|
+
slug: string;
|
|
44
|
+
frontmatter?: Record<string, unknown>;
|
|
45
|
+
body?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function getEntry(deps: EntryOpsDeps, collection: string, slug: string): Promise<GetEntryResult | null>;
|
|
48
|
+
export declare function createEntry(deps: EntryOpsDeps, input: CreateEntryInput): Promise<MutationResult>;
|
|
49
|
+
export declare function updateEntry(deps: EntryOpsDeps, input: UpdateEntryInput): Promise<MutationResult>;
|
|
50
|
+
export declare function deleteEntry(deps: EntryOpsDeps, collection: string, slug: string): Promise<MutationResult>;
|
|
51
|
+
export declare function renameEntry(deps: EntryOpsDeps, collection: string, from: string, to: string): Promise<MutationResult>;
|
|
52
|
+
export interface AddArrayItemInput {
|
|
53
|
+
collection: string;
|
|
54
|
+
slug: string;
|
|
55
|
+
field: string;
|
|
56
|
+
value: unknown;
|
|
57
|
+
index?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface RemoveArrayItemInput {
|
|
60
|
+
collection: string;
|
|
61
|
+
slug: string;
|
|
62
|
+
field: string;
|
|
63
|
+
index: number;
|
|
64
|
+
}
|
|
65
|
+
export declare function addArrayItem(deps: EntryOpsDeps, input: AddArrayItemInput): Promise<MutationResult>;
|
|
66
|
+
export declare function removeArrayItem(deps: EntryOpsDeps, input: RemoveArrayItemInput): Promise<MutationResult>;
|
|
67
|
+
/** Re-export for tests / parity consumers needing the collection's entry list. */
|
|
68
|
+
export declare function listCollectionEntries(deps: EntryOpsDeps, collection: string): Promise<CollectionEntryInfo[]>;
|
|
69
|
+
//# sourceMappingURL=entry-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-ops.d.ts","sourceRoot":"","sources":["../../../src/handlers/entry-ops.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAA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wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAuBxG;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAwB9G;AAED,kFAAkF;AAClF,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAGlH"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CreatePageRequest, DeletePageRequest, DuplicatePageRequest, LayoutInfo, PageOperationResponse } from '@nuasite/cms-types';
|
|
2
|
+
import type { CmsFileSystem } from '../fs/types';
|
|
3
|
+
export interface PageOpsDeps {
|
|
4
|
+
fs: CmsFileSystem;
|
|
5
|
+
}
|
|
6
|
+
export declare function createPage(deps: PageOpsDeps, request: CreatePageRequest): Promise<PageOperationResponse>;
|
|
7
|
+
export declare function duplicatePage(deps: PageOpsDeps, request: DuplicatePageRequest): Promise<PageOperationResponse>;
|
|
8
|
+
export declare function deletePage(deps: PageOpsDeps, request: DeletePageRequest): Promise<PageOperationResponse>;
|
|
9
|
+
export declare function getLayouts(deps: PageOpsDeps): Promise<LayoutInfo[]>;
|
|
10
|
+
export declare function checkSlugExists(deps: PageOpsDeps, slug: string): Promise<{
|
|
11
|
+
exists: boolean;
|
|
12
|
+
filePath?: string;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=page-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-ops.d.ts","sourceRoot":"","sources":["../../../src/handlers/page-ops.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACvI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAKhD,MAAM,WAAW,WAAW;IAC3B,EAAE,EAAE,aAAa,CAAA;CACjB;AAMD,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAwB9G;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqCpH;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAc9G;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAczE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAMtH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AddRedirectRequest, DeleteRedirectRequest, GetRedirectsResponse, RedirectOperationResponse, UpdateRedirectRequest } from '@nuasite/cms-types';
|
|
2
|
+
import type { CmsFileSystem } from '../fs/types';
|
|
3
|
+
export interface RedirectOpsDeps {
|
|
4
|
+
fs: CmsFileSystem;
|
|
5
|
+
}
|
|
6
|
+
export declare function listRedirects(deps: RedirectOpsDeps): Promise<GetRedirectsResponse>;
|
|
7
|
+
export declare function addRedirect(deps: RedirectOpsDeps, request: AddRedirectRequest): Promise<RedirectOperationResponse>;
|
|
8
|
+
export declare function updateRedirect(deps: RedirectOpsDeps, request: UpdateRedirectRequest): Promise<RedirectOperationResponse>;
|
|
9
|
+
export declare function deleteRedirect(deps: RedirectOpsDeps, request: DeleteRedirectRequest): Promise<RedirectOperationResponse>;
|
|
10
|
+
//# sourceMappingURL=redirect-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect-ops.d.ts","sourceRoot":"","sources":["../../../src/handlers/redirect-ops.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EAEzB,qBAAqB,EACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAKhD,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,aAAa,CAAA;CACjB;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAGxF;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAuBxH;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAiB9H;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAiB9H"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { scanCollections } from './collection-scanner';
|
|
2
|
+
export { scanComponentDefinitions } from './component-registry';
|
|
3
|
+
export { type ParseCache, parseConfigSource, parseContentConfig, type ParsedCollection, type ParsedConfig, type ParsedField, type ParsedReference, } from './content-config-ast';
|
|
4
|
+
export { createCmsCore } from './core';
|
|
5
|
+
export type { CmsCore, CmsCoreOptions } from './core';
|
|
6
|
+
export { globToRegExp } from './fs/glob';
|
|
7
|
+
export { createNodeFs } from './fs/node-fs';
|
|
8
|
+
export type { CmsFileSystem } from './fs/types';
|
|
9
|
+
export { type AddArrayItemInput, type CreateEntryInput, ensureMdxImports, type EntryOpsDeps, type GetEntryResult, parseFrontmatter, type RemoveArrayItemInput, serializeFrontmatter, type UpdateEntryInput, } from './handlers/entry-ops';
|
|
10
|
+
export { type ContemberStorageOptions, createContemberStorageAdapter, createLocalStorageAdapter, createS3StorageAdapter, getFileExtension, listProjectImages, type ListProjectImagesOptions, type LocalStorageOptions, MIME_BY_EXT, mimeFromExt, type S3StorageOptions, } from './media/index';
|
|
11
|
+
export { escapeHtml, relativeImportPath, slugify, slugifyHref } from './shared';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EACN,KAAK,UAAU,EACf,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,GACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,oBAAoB,EACpB,KAAK,gBAAgB,GACrB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACN,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,WAAW,EACX,WAAW,EACX,KAAK,gBAAgB,GACrB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MediaStorageAdapter } from '@nuasite/cms-types';
|
|
2
|
+
export interface ContemberStorageOptions {
|
|
3
|
+
/** Base URL of the worker API, e.g. 'https://api.example.com' */
|
|
4
|
+
apiBaseUrl: string;
|
|
5
|
+
/** Project slug used in the API path */
|
|
6
|
+
projectSlug: string;
|
|
7
|
+
/** Session token for authentication (NUA_SITE_SESSION_TOKEN cookie value) */
|
|
8
|
+
sessionToken?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Media storage adapter that proxies to the Contember worker's CMS media endpoints.
|
|
12
|
+
* Uses the existing /cms/:projectSlug/media/* API backed by R2 storage + Contember database.
|
|
13
|
+
*
|
|
14
|
+
* All connection details (`apiBaseUrl`, `projectSlug`, `sessionToken`) are injected
|
|
15
|
+
* by the caller — the adapter never reads `process.env`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createContemberStorageAdapter(options: ContemberStorageOptions): MediaStorageAdapter;
|
|
18
|
+
//# sourceMappingURL=contember.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contember.d.ts","sourceRoot":"","sources":["../../../src/media/contember.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,MAAM,WAAW,uBAAuB;IACvC,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAA;IAClB,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,uBAAuB,GAAG,mBAAmB,CAuEnG"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { type ContemberStorageOptions, createContemberStorageAdapter } from './contember';
|
|
2
|
+
export { createLocalStorageAdapter, getFileExtension, type LocalStorageOptions, MIME_BY_EXT, mimeFromExt } from './local';
|
|
3
|
+
export { listProjectImages, type ListProjectImagesOptions } from './project-images';
|
|
4
|
+
export { createS3StorageAdapter, type S3StorageOptions } from './s3';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/media/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AACzF,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACzH,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,MAAM,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MediaStorageAdapter } from '@nuasite/cms-types';
|
|
2
|
+
export interface LocalStorageOptions {
|
|
3
|
+
/** Directory to store media files (relative to project root or absolute). Default: 'public/uploads' */
|
|
4
|
+
dir?: string;
|
|
5
|
+
/** URL prefix for serving files. Default: '/uploads' */
|
|
6
|
+
urlPrefix?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createLocalStorageAdapter(options?: LocalStorageOptions): MediaStorageAdapter;
|
|
9
|
+
export declare function getFileExtension(filename: string): string;
|
|
10
|
+
export declare const MIME_BY_EXT: Record<string, string>;
|
|
11
|
+
export declare function mimeFromExt(ext: string): string;
|
|
12
|
+
//# sourceMappingURL=local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/media/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoC,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAKlH,MAAM,WAAW,mBAAmB;IACnC,uGAAuG;IACvG,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,mBAAwB,GAAG,mBAAmB,CA8GhG;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY9C,CAAA;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MediaItem } from '@nuasite/cms-types';
|
|
2
|
+
import type { CmsFileSystem } from '../fs/types';
|
|
3
|
+
export interface ListProjectImagesOptions {
|
|
4
|
+
/** Root-relative directory to exclude (e.g. the media uploads dir), to avoid duplicates. */
|
|
5
|
+
excludeDir?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Scan the project for image files in `public/` and `src/` directories,
|
|
9
|
+
* excluding the media uploads directory, over the FileSystem port.
|
|
10
|
+
*
|
|
11
|
+
* - `public/` files are served from `/<path-relative-to-public>`.
|
|
12
|
+
* - `src/` files are served from `/<path-relative-to-project-root>`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function listProjectImages(fs: CmsFileSystem, options?: ListProjectImagesOptions): Promise<MediaItem[]>;
|
|
15
|
+
//# sourceMappingURL=project-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-images.d.ts","sourceRoot":"","sources":["../../../src/media/project-images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAKhD,MAAM,WAAW,wBAAwB;IACxC,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAmBnH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MediaStorageAdapter } from '@nuasite/cms-types';
|
|
2
|
+
export interface S3StorageOptions {
|
|
3
|
+
bucket: string;
|
|
4
|
+
region: string;
|
|
5
|
+
accessKeyId?: string;
|
|
6
|
+
secretAccessKey?: string;
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
cdnPrefix?: string;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createS3StorageAdapter(options: S3StorageOptions): MediaStorageAdapter;
|
|
12
|
+
//# sourceMappingURL=s3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../src/media/s3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoC,mBAAmB,EAAqB,MAAM,oBAAoB,CAAA;AAKlH,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAQD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,CAiIrF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slugify with diacritics normalization for href paths.
|
|
3
|
+
* "Lidé" → "lide", "Aktuálně z nezisku" → "aktualne-z-nezisku"
|
|
4
|
+
*/
|
|
5
|
+
export declare function slugifyHref(text: string): string;
|
|
6
|
+
/** Runtime guard: a non-null, non-array object usable as a string-keyed record. */
|
|
7
|
+
export declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* Slugify text for URL paths.
|
|
10
|
+
* Lowercases, strips non-word characters, collapses whitespace/underscores to hyphens.
|
|
11
|
+
*/
|
|
12
|
+
export declare function slugify(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Escape HTML special characters to prevent injection.
|
|
15
|
+
* Covers &, <, >, ", and ' — the full set needed for both text content and attribute values.
|
|
16
|
+
*/
|
|
17
|
+
export declare function escapeHtml(text: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Compute a POSIX-style relative import path from one root-relative file to another.
|
|
20
|
+
* Both paths are forward-slash POSIX paths relative to the project root. Ensures
|
|
21
|
+
* the result starts with `./` or `../`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function relativeImportPath(fromFile: string, toFile: string): string;
|
|
24
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAShD;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9E;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO5C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAa3E"}
|