@revealui/contracts 1.0.0
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/LICENSE +22 -0
- package/README.md +160 -0
- package/dist/a2a/index.d.ts +383 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +276 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/actions/action-validator.d.ts +48 -0
- package/dist/actions/action-validator.d.ts.map +1 -0
- package/dist/actions/action-validator.js +288 -0
- package/dist/actions/action-validator.js.map +1 -0
- package/dist/actions/index.d.ts +7 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +7 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/agents/index.d.ts +628 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +511 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/types.d.ts +22 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/api/auth.d.ts +60 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +84 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/chat.d.ts +45 -0
- package/dist/api/chat.d.ts.map +1 -0
- package/dist/api/chat.js +55 -0
- package/dist/api/chat.js.map +1 -0
- package/dist/api/gdpr.d.ts +39 -0
- package/dist/api/gdpr.d.ts.map +1 -0
- package/dist/api/gdpr.js +53 -0
- package/dist/api/gdpr.js.map +1 -0
- package/dist/cms/collection.d.ts +108 -0
- package/dist/cms/collection.d.ts.map +1 -0
- package/dist/cms/collection.js +144 -0
- package/dist/cms/collection.js.map +1 -0
- package/dist/cms/compat.d.ts +128 -0
- package/dist/cms/compat.d.ts.map +1 -0
- package/dist/cms/compat.js +141 -0
- package/dist/cms/compat.js.map +1 -0
- package/dist/cms/config-contract.d.ts +278 -0
- package/dist/cms/config-contract.d.ts.map +1 -0
- package/dist/cms/config-contract.js +220 -0
- package/dist/cms/config-contract.js.map +1 -0
- package/dist/cms/config.d.ts +351 -0
- package/dist/cms/config.d.ts.map +1 -0
- package/dist/cms/config.js +50 -0
- package/dist/cms/config.js.map +1 -0
- package/dist/cms/errors.d.ts +122 -0
- package/dist/cms/errors.d.ts.map +1 -0
- package/dist/cms/errors.js +163 -0
- package/dist/cms/errors.js.map +1 -0
- package/dist/cms/extensibility.d.ts +211 -0
- package/dist/cms/extensibility.d.ts.map +1 -0
- package/dist/cms/extensibility.js +313 -0
- package/dist/cms/extensibility.js.map +1 -0
- package/dist/cms/field.d.ts +69 -0
- package/dist/cms/field.d.ts.map +1 -0
- package/dist/cms/field.js +94 -0
- package/dist/cms/field.js.map +1 -0
- package/dist/cms/functions.d.ts +466 -0
- package/dist/cms/functions.d.ts.map +1 -0
- package/dist/cms/functions.js +19 -0
- package/dist/cms/functions.js.map +1 -0
- package/dist/cms/global.d.ts +45 -0
- package/dist/cms/global.d.ts.map +1 -0
- package/dist/cms/global.js +62 -0
- package/dist/cms/global.js.map +1 -0
- package/dist/cms/index.d.ts +23 -0
- package/dist/cms/index.d.ts.map +1 -0
- package/dist/cms/index.js +42 -0
- package/dist/cms/index.js.map +1 -0
- package/dist/cms/structure.d.ts +1601 -0
- package/dist/cms/structure.d.ts.map +1 -0
- package/dist/cms/structure.js +757 -0
- package/dist/cms/structure.js.map +1 -0
- package/dist/content/index.d.ts +1542 -0
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +522 -0
- package/dist/content/index.js.map +1 -0
- package/dist/database/bridge.d.ts +177 -0
- package/dist/database/bridge.d.ts.map +1 -0
- package/dist/database/bridge.js +139 -0
- package/dist/database/bridge.js.map +1 -0
- package/dist/database/index.d.ts +8 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +9 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/type-bridge.d.ts +178 -0
- package/dist/database/type-bridge.d.ts.map +1 -0
- package/dist/database/type-bridge.js +154 -0
- package/dist/database/type-bridge.js.map +1 -0
- package/dist/entities/agent-context.d.ts +280 -0
- package/dist/entities/agent-context.d.ts.map +1 -0
- package/dist/entities/agent-context.js +390 -0
- package/dist/entities/agent-context.js.map +1 -0
- package/dist/entities/agent-memory.d.ts +661 -0
- package/dist/entities/agent-memory.d.ts.map +1 -0
- package/dist/entities/agent-memory.js +544 -0
- package/dist/entities/agent-memory.js.map +1 -0
- package/dist/entities/board.d.ts +95 -0
- package/dist/entities/board.d.ts.map +1 -0
- package/dist/entities/board.js +99 -0
- package/dist/entities/board.js.map +1 -0
- package/dist/entities/code-provenance.d.ts +270 -0
- package/dist/entities/code-provenance.d.ts.map +1 -0
- package/dist/entities/code-provenance.js +339 -0
- package/dist/entities/code-provenance.js.map +1 -0
- package/dist/entities/index.d.ts +22 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +22 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/media.d.ts +485 -0
- package/dist/entities/media.d.ts.map +1 -0
- package/dist/entities/media.js +606 -0
- package/dist/entities/media.js.map +1 -0
- package/dist/entities/page-revision.d.ts +390 -0
- package/dist/entities/page-revision.d.ts.map +1 -0
- package/dist/entities/page-revision.js +406 -0
- package/dist/entities/page-revision.js.map +1 -0
- package/dist/entities/page.d.ts +2349 -0
- package/dist/entities/page.d.ts.map +1 -0
- package/dist/entities/page.js +377 -0
- package/dist/entities/page.js.map +1 -0
- package/dist/entities/post.d.ts +619 -0
- package/dist/entities/post.d.ts.map +1 -0
- package/dist/entities/post.js +555 -0
- package/dist/entities/post.js.map +1 -0
- package/dist/entities/price.d.ts +772 -0
- package/dist/entities/price.d.ts.map +1 -0
- package/dist/entities/price.js +308 -0
- package/dist/entities/price.js.map +1 -0
- package/dist/entities/product.d.ts +753 -0
- package/dist/entities/product.d.ts.map +1 -0
- package/dist/entities/product.js +307 -0
- package/dist/entities/product.js.map +1 -0
- package/dist/entities/session.d.ts +222 -0
- package/dist/entities/session.d.ts.map +1 -0
- package/dist/entities/session.js +253 -0
- package/dist/entities/session.js.map +1 -0
- package/dist/entities/site.d.ts +387 -0
- package/dist/entities/site.d.ts.map +1 -0
- package/dist/entities/site.js +348 -0
- package/dist/entities/site.js.map +1 -0
- package/dist/entities/ticket-comment.d.ts +49 -0
- package/dist/entities/ticket-comment.d.ts.map +1 -0
- package/dist/entities/ticket-comment.js +58 -0
- package/dist/entities/ticket-comment.js.map +1 -0
- package/dist/entities/ticket-label.d.ts +64 -0
- package/dist/entities/ticket-label.d.ts.map +1 -0
- package/dist/entities/ticket-label.js +77 -0
- package/dist/entities/ticket-label.js.map +1 -0
- package/dist/entities/ticket.d.ts +204 -0
- package/dist/entities/ticket.d.ts.map +1 -0
- package/dist/entities/ticket.js +205 -0
- package/dist/entities/ticket.js.map +1 -0
- package/dist/entities/user.d.ts +336 -0
- package/dist/entities/user.d.ts.map +1 -0
- package/dist/entities/user.js +255 -0
- package/dist/entities/user.js.map +1 -0
- package/dist/foundation/contract.d.ts +221 -0
- package/dist/foundation/contract.d.ts.map +1 -0
- package/dist/foundation/contract.js +133 -0
- package/dist/foundation/contract.js.map +1 -0
- package/dist/foundation/index.d.ts +7 -0
- package/dist/foundation/index.d.ts.map +1 -0
- package/dist/foundation/index.js +7 -0
- package/dist/foundation/index.js.map +1 -0
- package/dist/generated/contracts.d.ts +1514 -0
- package/dist/generated/contracts.d.ts.map +1 -0
- package/dist/generated/contracts.js +959 -0
- package/dist/generated/contracts.js.map +1 -0
- package/dist/generated/database.d.ts +48 -0
- package/dist/generated/database.d.ts.map +1 -0
- package/dist/generated/database.js +17 -0
- package/dist/generated/database.js.map +1 -0
- package/dist/generated/zod-schemas.d.ts +14793 -0
- package/dist/generated/zod-schemas.d.ts.map +1 -0
- package/dist/generated/zod-schemas.js +547 -0
- package/dist/generated/zod-schemas.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/representation/index.d.ts +304 -0
- package/dist/representation/index.d.ts.map +1 -0
- package/dist/representation/index.js +280 -0
- package/dist/representation/index.js.map +1 -0
- package/package.json +117 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RevealUI CMS Compatibility Layer
|
|
3
|
+
*
|
|
4
|
+
* This module provides adapter functions for CMS configuration compatibility.
|
|
5
|
+
*
|
|
6
|
+
* Compatibility is enforced through:
|
|
7
|
+
* 1. Type assertions that fail at compile time if incompatible
|
|
8
|
+
* 2. Adapter functions for explicit conversions
|
|
9
|
+
* 3. Documentation of any differences
|
|
10
|
+
*
|
|
11
|
+
* @module @revealui/contracts/core/contracts/compat
|
|
12
|
+
*/
|
|
13
|
+
import type { CollectionConfig, Config, GlobalConfig, UnknownRecord } from './config.js';
|
|
14
|
+
/**
|
|
15
|
+
* Normalize a RevealUI CollectionConfig for CMS compatibility
|
|
16
|
+
*
|
|
17
|
+
* This is useful when:
|
|
18
|
+
* - Passing config to external CMS build functions
|
|
19
|
+
* - Integrating with plugins that expect standard CMS types
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { buildConfig } from '@revealui/core';
|
|
24
|
+
* import { Posts } from './collections/Posts.js';
|
|
25
|
+
|
|
26
|
+
* export default buildConfig({
|
|
27
|
+
* collections: [toCMSCollectionConfig(Posts)],
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function toCMSCollectionConfig<T = UnknownRecord>(config: CollectionConfig<T>): CollectionConfig<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Normalize a RevealUI GlobalConfig for CMS compatibility
|
|
34
|
+
*/
|
|
35
|
+
export declare function toCMSGlobalConfig(config: GlobalConfig): GlobalConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Normalize a full RevealUI Config for CMS compatibility
|
|
38
|
+
*/
|
|
39
|
+
export declare function toCMSConfig(config: Config): Config;
|
|
40
|
+
/**
|
|
41
|
+
* Import a CMS config and convert to RevealUI config format
|
|
42
|
+
*
|
|
43
|
+
* Use this when:
|
|
44
|
+
* - Consuming configs from external sources
|
|
45
|
+
* - Migrating existing CMS configs to RevealUI
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Existing CMS config
|
|
50
|
+
* const legacyConfig = { slug: 'posts', fields: [...] };
|
|
51
|
+
*
|
|
52
|
+
* // Validate and convert to RevealUI config
|
|
53
|
+
* const revealConfig = fromCMSCollectionConfig(legacyConfig);
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function fromCMSCollectionConfig(config: CollectionConfig): CollectionConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Convert CMS GlobalConfig to RevealUI GlobalConfig
|
|
59
|
+
*/
|
|
60
|
+
export declare function fromCMSGlobalConfig(config: GlobalConfig): GlobalConfig;
|
|
61
|
+
/**
|
|
62
|
+
* RevealUI-specific extensions that can be added to configs
|
|
63
|
+
*
|
|
64
|
+
* These are RevealUI-exclusive features beyond standard CMS types.
|
|
65
|
+
*/
|
|
66
|
+
export interface RevealUIExtensions {
|
|
67
|
+
/** Enable AI-assisted content features */
|
|
68
|
+
aiEnabled?: boolean;
|
|
69
|
+
/** Dual representation for human and agent interfaces */
|
|
70
|
+
dualRepresentation?: {
|
|
71
|
+
human: {
|
|
72
|
+
label: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
helpText?: string;
|
|
75
|
+
};
|
|
76
|
+
agent: {
|
|
77
|
+
semanticType: string;
|
|
78
|
+
capabilities: string[];
|
|
79
|
+
constraints?: Record<string, unknown>;
|
|
80
|
+
actions?: Array<{
|
|
81
|
+
name: string;
|
|
82
|
+
description: string;
|
|
83
|
+
parameters?: Record<string, unknown>;
|
|
84
|
+
}>;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/** Custom metadata for the collection/global */
|
|
88
|
+
metadata?: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Collection config with RevealUI extensions
|
|
92
|
+
*
|
|
93
|
+
* Use this type when you want to access RevealUI-specific features.
|
|
94
|
+
*/
|
|
95
|
+
export interface RevealUICollectionConfig extends CollectionConfig {
|
|
96
|
+
revealui?: RevealUIExtensions;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Global config with RevealUI extensions
|
|
100
|
+
*/
|
|
101
|
+
export interface RevealUIGlobalConfig extends GlobalConfig {
|
|
102
|
+
revealui?: RevealUIExtensions;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Check if a config has RevealUI extensions
|
|
106
|
+
*/
|
|
107
|
+
export declare function hasRevealUIExtensions(config: CollectionConfig | GlobalConfig): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Extract RevealUI extensions from a config
|
|
110
|
+
*/
|
|
111
|
+
export declare function getRevealUIExtensions(config: CollectionConfig | GlobalConfig): RevealUIExtensions | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Validate a collection/global slug
|
|
114
|
+
*
|
|
115
|
+
* Slugs must:
|
|
116
|
+
* - Start with a lowercase letter
|
|
117
|
+
* - Contain only lowercase letters, numbers, and hyphens
|
|
118
|
+
*/
|
|
119
|
+
export declare function isValidSlug(slug: string): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Convert a string to a valid slug
|
|
122
|
+
*/
|
|
123
|
+
export declare function toSlug(input: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* Validate slug and throw if invalid
|
|
126
|
+
*/
|
|
127
|
+
export declare function assertValidSlug(slug: string, context: string): void;
|
|
128
|
+
//# sourceMappingURL=compat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../src/cms/compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAMxF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,aAAa,EACrD,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC1B,gBAAgB,CAAC,CAAC,CAAC,CAOrB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAEpE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAclD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAIlF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAEtE;AAMD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,yDAAyD;IACzD,kBAAkB,CAAC,EAAE;QACnB,KAAK,EAAE;YACL,KAAK,EAAE,MAAM,CAAA;YACb,WAAW,CAAC,EAAE,MAAM,CAAA;YACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;SAClB,CAAA;QACD,KAAK,EAAE;YACL,YAAY,EAAE,MAAM,CAAA;YACpB,YAAY,EAAE,MAAM,EAAE,CAAA;YACtB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACrC,OAAO,CAAC,EAAE,KAAK,CAAC;gBACd,IAAI,EAAE,MAAM,CAAA;gBACZ,WAAW,EAAE,MAAM,CAAA;gBACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;aACrC,CAAC,CAAA;SACH,CAAA;KACF,CAAA;IAED,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY,GAAG,OAAO,CAKtF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,gBAAgB,GAAG,YAAY,GACtC,kBAAkB,GAAG,SAAS,CAKhC;AAMD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM5C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CASnE"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RevealUI CMS Compatibility Layer
|
|
3
|
+
*
|
|
4
|
+
* This module provides adapter functions for CMS configuration compatibility.
|
|
5
|
+
*
|
|
6
|
+
* Compatibility is enforced through:
|
|
7
|
+
* 1. Type assertions that fail at compile time if incompatible
|
|
8
|
+
* 2. Adapter functions for explicit conversions
|
|
9
|
+
* 3. Documentation of any differences
|
|
10
|
+
*
|
|
11
|
+
* @module @revealui/contracts/core/contracts/compat
|
|
12
|
+
*/
|
|
13
|
+
// ============================================
|
|
14
|
+
// ADAPTER FUNCTIONS
|
|
15
|
+
// ============================================
|
|
16
|
+
/**
|
|
17
|
+
* Normalize a RevealUI CollectionConfig for CMS compatibility
|
|
18
|
+
*
|
|
19
|
+
* This is useful when:
|
|
20
|
+
* - Passing config to external CMS build functions
|
|
21
|
+
* - Integrating with plugins that expect standard CMS types
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { buildConfig } from '@revealui/core';
|
|
26
|
+
* import { Posts } from './collections/Posts.js';
|
|
27
|
+
|
|
28
|
+
* export default buildConfig({
|
|
29
|
+
* collections: [toCMSCollectionConfig(Posts)],
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function toCMSCollectionConfig(config) {
|
|
34
|
+
// Currently a pass-through since RevealUI configs are CMS-compatible
|
|
35
|
+
// This function exists for:
|
|
36
|
+
// 1. Explicit conversion intent
|
|
37
|
+
// 2. Future compatibility shims
|
|
38
|
+
// 3. Stripping RevealUI-specific properties if needed
|
|
39
|
+
return config;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Normalize a RevealUI GlobalConfig for CMS compatibility
|
|
43
|
+
*/
|
|
44
|
+
export function toCMSGlobalConfig(config) {
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Normalize a full RevealUI Config for CMS compatibility
|
|
49
|
+
*/
|
|
50
|
+
export function toCMSConfig(config) {
|
|
51
|
+
const result = {
|
|
52
|
+
secret: config.secret,
|
|
53
|
+
...(config.collections
|
|
54
|
+
? { collections: config.collections.map((c) => toCMSCollectionConfig(c)) }
|
|
55
|
+
: {}),
|
|
56
|
+
...(config.globals ? { globals: config.globals.map((g) => toCMSGlobalConfig(g)) } : {}),
|
|
57
|
+
...(config.db ? { db: config.db } : {}),
|
|
58
|
+
...(config.serverURL ? { serverURL: config.serverURL } : {}),
|
|
59
|
+
...(config.admin ? { admin: config.admin } : {}),
|
|
60
|
+
...(config.custom ? { custom: config.custom } : {}),
|
|
61
|
+
};
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Import a CMS config and convert to RevealUI config format
|
|
66
|
+
*
|
|
67
|
+
* Use this when:
|
|
68
|
+
* - Consuming configs from external sources
|
|
69
|
+
* - Migrating existing CMS configs to RevealUI
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* // Existing CMS config
|
|
74
|
+
* const legacyConfig = { slug: 'posts', fields: [...] };
|
|
75
|
+
*
|
|
76
|
+
* // Validate and convert to RevealUI config
|
|
77
|
+
* const revealConfig = fromCMSCollectionConfig(legacyConfig);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export function fromCMSCollectionConfig(config) {
|
|
81
|
+
// CMS configs should be compatible by design
|
|
82
|
+
// Add any RevealUI defaults or transformations here
|
|
83
|
+
return config;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Convert CMS GlobalConfig to RevealUI GlobalConfig
|
|
87
|
+
*/
|
|
88
|
+
export function fromCMSGlobalConfig(config) {
|
|
89
|
+
return config;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if a config has RevealUI extensions
|
|
93
|
+
*/
|
|
94
|
+
export function hasRevealUIExtensions(config) {
|
|
95
|
+
return ('revealui' in config &&
|
|
96
|
+
config.revealui !== undefined);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Extract RevealUI extensions from a config
|
|
100
|
+
*/
|
|
101
|
+
export function getRevealUIExtensions(config) {
|
|
102
|
+
if (hasRevealUIExtensions(config)) {
|
|
103
|
+
return config.revealui;
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
// ============================================
|
|
108
|
+
// SLUG UTILITIES
|
|
109
|
+
// ============================================
|
|
110
|
+
/**
|
|
111
|
+
* Validate a collection/global slug
|
|
112
|
+
*
|
|
113
|
+
* Slugs must:
|
|
114
|
+
* - Start with a lowercase letter
|
|
115
|
+
* - Contain only lowercase letters, numbers, and hyphens
|
|
116
|
+
*/
|
|
117
|
+
export function isValidSlug(slug) {
|
|
118
|
+
return /^[a-z][a-z0-9-]*$/.test(slug);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Convert a string to a valid slug
|
|
122
|
+
*/
|
|
123
|
+
export function toSlug(input) {
|
|
124
|
+
return input
|
|
125
|
+
.toLowerCase()
|
|
126
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
127
|
+
.replace(/^-+|-+$/g, '')
|
|
128
|
+
.replace(/^([^a-z])/, 'x-$1'); // Ensure starts with letter
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Validate slug and throw if invalid
|
|
132
|
+
*/
|
|
133
|
+
export function assertValidSlug(slug, context) {
|
|
134
|
+
if (!isValidSlug(slug)) {
|
|
135
|
+
throw new Error(`Invalid slug "${slug}" in ${context}. ` +
|
|
136
|
+
`Slugs must start with a lowercase letter and contain only ` +
|
|
137
|
+
`lowercase letters, numbers, and hyphens. ` +
|
|
138
|
+
`Suggested: "${toSlug(slug)}"`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.js","sourceRoot":"","sources":["../../src/cms/compat.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Contract
|
|
3
|
+
*
|
|
4
|
+
* Unified contract for complete Config (root configuration) that combines:
|
|
5
|
+
* - TypeScript types (compile-time)
|
|
6
|
+
* - Zod schemas (runtime validation)
|
|
7
|
+
* - Validation functions
|
|
8
|
+
* - Type guards
|
|
9
|
+
*
|
|
10
|
+
* This is the single source of truth for Config definitions.
|
|
11
|
+
*
|
|
12
|
+
* @module @revealui/contracts/core/contracts/config-contract
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod/v4';
|
|
15
|
+
import { type Contract, type ContractType } from '../foundation/contract.js';
|
|
16
|
+
/**
|
|
17
|
+
* Config structure schema (Zod)
|
|
18
|
+
* Validates the structure of the root Config object
|
|
19
|
+
*
|
|
20
|
+
* Note: This schema validates the STRUCTURE of the config, not function contracts.
|
|
21
|
+
* Functions (access, hooks, onInit, etc.) are validated by TypeScript at compile time.
|
|
22
|
+
*/
|
|
23
|
+
declare const ConfigStructureSchema: z.ZodObject<{
|
|
24
|
+
secret: z.ZodString;
|
|
25
|
+
collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
26
|
+
slug: z.ZodString;
|
|
27
|
+
labels: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
singular: z.ZodString;
|
|
29
|
+
plural: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
fields: z.ZodArray<z.ZodType<import("./structure.js").FieldStructure, unknown, z.core.$ZodTypeInternals<import("./structure.js").FieldStructure, unknown>>>;
|
|
32
|
+
timestamps: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
admin: z.ZodOptional<z.ZodObject<{
|
|
34
|
+
useAsTitle: z.ZodOptional<z.ZodString>;
|
|
35
|
+
defaultColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
group: z.ZodOptional<z.ZodString>;
|
|
37
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
description: z.ZodOptional<z.ZodString>;
|
|
39
|
+
preview: z.ZodOptional<z.ZodUnknown>;
|
|
40
|
+
livePreview: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
url: z.ZodOptional<z.ZodUnknown>;
|
|
42
|
+
breakpoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
width: z.ZodNumber;
|
|
45
|
+
height: z.ZodNumber;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
pagination: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
defaultLimit: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
limits: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
listSearchableFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
enableRichTextLink: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
enableRichTextRelationship: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$loose>>;
|
|
56
|
+
versions: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
57
|
+
maxPerDoc: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
drafts: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
59
|
+
autosave: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
60
|
+
interval: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
}, z.core.$strip>]>>;
|
|
62
|
+
validate: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, z.core.$strip>]>>;
|
|
64
|
+
}, z.core.$strip>]>>;
|
|
65
|
+
upload: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
66
|
+
staticURL: z.ZodOptional<z.ZodString>;
|
|
67
|
+
staticDir: z.ZodOptional<z.ZodString>;
|
|
68
|
+
mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
filesRequiredOnCreate: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
imageSizes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
position: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
left: "left";
|
|
76
|
+
center: "center";
|
|
77
|
+
right: "right";
|
|
78
|
+
centre: "centre";
|
|
79
|
+
top: "top";
|
|
80
|
+
bottom: "bottom";
|
|
81
|
+
entropy: "entropy";
|
|
82
|
+
attention: "attention";
|
|
83
|
+
}>>;
|
|
84
|
+
fit: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
fill: "fill";
|
|
86
|
+
cover: "cover";
|
|
87
|
+
contain: "contain";
|
|
88
|
+
inside: "inside";
|
|
89
|
+
outside: "outside";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$strip>>>;
|
|
92
|
+
adminThumbnail: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>;
|
|
93
|
+
focalPoint: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
crop: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
}, z.core.$strip>]>>;
|
|
96
|
+
auth: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
97
|
+
tokenExpiration: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
verify: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
99
|
+
generateEmailHTML: z.ZodOptional<z.ZodUnknown>;
|
|
100
|
+
generateEmailSubject: z.ZodOptional<z.ZodUnknown>;
|
|
101
|
+
}, z.core.$strip>]>>;
|
|
102
|
+
maxLoginAttempts: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
lockTime: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
useAPIKey: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
cookies: z.ZodOptional<z.ZodObject<{
|
|
107
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
sameSite: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
|
|
109
|
+
none: "none";
|
|
110
|
+
strict: "strict";
|
|
111
|
+
lax: "lax";
|
|
112
|
+
}>, z.ZodBoolean]>>;
|
|
113
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
forgotPassword: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
generateEmailHTML: z.ZodOptional<z.ZodUnknown>;
|
|
117
|
+
generateEmailSubject: z.ZodOptional<z.ZodUnknown>;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
disableLocalStrategy: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
strategies: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
121
|
+
}, z.core.$strip>]>>;
|
|
122
|
+
typescript: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
interface: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
126
|
+
dbName: z.ZodOptional<z.ZodString>;
|
|
127
|
+
defaultSort: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$loose>>>;
|
|
129
|
+
globals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
|
+
slug: z.ZodString;
|
|
131
|
+
label: z.ZodOptional<z.ZodString>;
|
|
132
|
+
labels: z.ZodOptional<z.ZodObject<{
|
|
133
|
+
singular: z.ZodString;
|
|
134
|
+
plural: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
fields: z.ZodArray<z.ZodType<import("./structure.js").FieldStructure, unknown, z.core.$ZodTypeInternals<import("./structure.js").FieldStructure, unknown>>>;
|
|
137
|
+
admin: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
group: z.ZodOptional<z.ZodString>;
|
|
139
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
description: z.ZodOptional<z.ZodString>;
|
|
141
|
+
preview: z.ZodOptional<z.ZodUnknown>;
|
|
142
|
+
livePreview: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
url: z.ZodOptional<z.ZodUnknown>;
|
|
144
|
+
breakpoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
145
|
+
name: z.ZodString;
|
|
146
|
+
width: z.ZodNumber;
|
|
147
|
+
height: z.ZodNumber;
|
|
148
|
+
}, z.core.$strip>>>;
|
|
149
|
+
}, z.core.$strip>>;
|
|
150
|
+
}, z.core.$loose>>;
|
|
151
|
+
versions: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
152
|
+
maxPerDoc: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
drafts: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
154
|
+
autosave: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
155
|
+
interval: z.ZodOptional<z.ZodNumber>;
|
|
156
|
+
}, z.core.$strip>]>>;
|
|
157
|
+
validate: z.ZodOptional<z.ZodBoolean>;
|
|
158
|
+
}, z.core.$strip>]>>;
|
|
159
|
+
}, z.core.$strip>]>>;
|
|
160
|
+
typescript: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
interface: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$strip>>;
|
|
163
|
+
dbName: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, z.core.$loose>>>;
|
|
165
|
+
serverURL: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
166
|
+
admin: z.ZodOptional<z.ZodObject<{
|
|
167
|
+
user: z.ZodOptional<z.ZodString>;
|
|
168
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
169
|
+
titleSuffix: z.ZodOptional<z.ZodString>;
|
|
170
|
+
ogImage: z.ZodOptional<z.ZodString>;
|
|
171
|
+
favicon: z.ZodOptional<z.ZodString>;
|
|
172
|
+
icons: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
173
|
+
url: z.ZodOptional<z.ZodString>;
|
|
174
|
+
sizes: z.ZodOptional<z.ZodString>;
|
|
175
|
+
type: z.ZodOptional<z.ZodString>;
|
|
176
|
+
rel: z.ZodOptional<z.ZodString>;
|
|
177
|
+
fetchPriority: z.ZodOptional<z.ZodEnum<{
|
|
178
|
+
auto: "auto";
|
|
179
|
+
high: "high";
|
|
180
|
+
low: "low";
|
|
181
|
+
}>>;
|
|
182
|
+
}, z.core.$strip>>>;
|
|
183
|
+
}, z.core.$strip>>;
|
|
184
|
+
importMap: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
autoGenerate: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
baseDir: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}, z.core.$loose>>;
|
|
188
|
+
css: z.ZodOptional<z.ZodString>;
|
|
189
|
+
scss: z.ZodOptional<z.ZodString>;
|
|
190
|
+
dateFormat: z.ZodOptional<z.ZodString>;
|
|
191
|
+
avatar: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"default">, z.ZodLiteral<"gravatar">, z.ZodUnknown]>>;
|
|
192
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
+
livePreview: z.ZodOptional<z.ZodObject<{
|
|
194
|
+
url: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>;
|
|
195
|
+
collections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
196
|
+
globals: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
197
|
+
breakpoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
198
|
+
label: z.ZodString;
|
|
199
|
+
name: z.ZodString;
|
|
200
|
+
width: z.ZodNumber;
|
|
201
|
+
height: z.ZodNumber;
|
|
202
|
+
}, z.core.$strip>>>;
|
|
203
|
+
}, z.core.$loose>>;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
email: z.ZodOptional<z.ZodObject<{
|
|
206
|
+
fromName: z.ZodOptional<z.ZodString>;
|
|
207
|
+
fromAddress: z.ZodOptional<z.ZodString>;
|
|
208
|
+
}, z.core.$strip>>;
|
|
209
|
+
localization: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
210
|
+
locales: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodObject<{
|
|
211
|
+
label: z.ZodString;
|
|
212
|
+
code: z.ZodString;
|
|
213
|
+
}, z.core.$strip>>]>;
|
|
214
|
+
defaultLocale: z.ZodString;
|
|
215
|
+
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
216
|
+
}, z.core.$strip>, z.ZodLiteral<false>]>>;
|
|
217
|
+
i18n: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
locales: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
219
|
+
defaultLocale: z.ZodOptional<z.ZodString>;
|
|
220
|
+
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
+
supportedLanguages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
cors: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
224
|
+
origins: z.ZodArray<z.ZodString>;
|
|
225
|
+
headers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
+
}, z.core.$strip>]>>;
|
|
227
|
+
csrf: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
228
|
+
rateLimit: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
window: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
trustProxy: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
}, z.core.$strip>>;
|
|
233
|
+
upload: z.ZodOptional<z.ZodObject<{
|
|
234
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
235
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
236
|
+
}, z.core.$strip>>;
|
|
237
|
+
}, z.core.$strip>>;
|
|
238
|
+
debug: z.ZodOptional<z.ZodBoolean>;
|
|
239
|
+
typescript: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
outputFile: z.ZodOptional<z.ZodString>;
|
|
241
|
+
declare: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
+
autoGenerate: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
+
}, z.core.$strip>>;
|
|
244
|
+
telemetry: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
+
hooks: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
246
|
+
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
type ConfigStructure = z.infer<typeof ConfigStructureSchema>;
|
|
249
|
+
/**
|
|
250
|
+
* Config Contract
|
|
251
|
+
*
|
|
252
|
+
* This contract validates Config (root configuration) at runtime
|
|
253
|
+
* and provides TypeScript types at compile time.
|
|
254
|
+
*
|
|
255
|
+
* Note: This is a simplified contract. The full Config type includes
|
|
256
|
+
* function contracts (access, hooks) which are validated by TypeScript
|
|
257
|
+
* at compile time, not by Zod at runtime.
|
|
258
|
+
*/
|
|
259
|
+
export declare const ConfigContract: Contract<ConfigStructure>;
|
|
260
|
+
/**
|
|
261
|
+
* Type for Config structure
|
|
262
|
+
* Extracted from the ConfigContract
|
|
263
|
+
*/
|
|
264
|
+
export type ConfigContractType = ContractType<typeof ConfigContract>;
|
|
265
|
+
/**
|
|
266
|
+
* Validate a config structure
|
|
267
|
+
*/
|
|
268
|
+
export declare function validateConfigStructure(data: unknown): ReturnType<typeof ConfigContract.validate>;
|
|
269
|
+
/**
|
|
270
|
+
* Type guard for config structures
|
|
271
|
+
*/
|
|
272
|
+
export declare function isConfigStructure(data: unknown): data is ConfigContractType;
|
|
273
|
+
/**
|
|
274
|
+
* Parse config structure (throws on validation failure)
|
|
275
|
+
*/
|
|
276
|
+
export declare function parseConfigStructure(data: unknown): ConfigContractType;
|
|
277
|
+
export {};
|
|
278
|
+
//# sourceMappingURL=config-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-contract.d.ts","sourceRoot":"","sources":["../../src/cms/config-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAkB,MAAM,2BAA2B,CAAA;AAG5F;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0LxB,CAAA;AAIH,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,eAAe,CAOnD,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpE;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,QAAQ,CAAC,CAEjG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,kBAAkB,CAE3E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,CAEtE"}
|