@sitecore-content-sdk/content 1.5.0-canary.5
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.txt +202 -0
- package/README.md +7 -0
- package/client.d.ts +1 -0
- package/codegen.d.ts +1 -0
- package/config-cli.d.ts +1 -0
- package/config.d.ts +1 -0
- package/dist/cjs/client/edge-proxy.js +24 -0
- package/dist/cjs/client/index.js +14 -0
- package/dist/cjs/client/models.js +2 -0
- package/dist/cjs/client/sitecore-client.js +420 -0
- package/dist/cjs/client/utils.js +53 -0
- package/dist/cjs/config/define-config.js +195 -0
- package/dist/cjs/config/index.js +7 -0
- package/dist/cjs/config/models.js +12 -0
- package/dist/cjs/config-cli/define-cli-config.js +23 -0
- package/dist/cjs/config-cli/index.js +7 -0
- package/dist/cjs/config-cli/models.js +8 -0
- package/dist/cjs/constants.js +12 -0
- package/dist/cjs/debug.js +21 -0
- package/dist/cjs/editing/codegen/index.js +14 -0
- package/dist/cjs/editing/codegen/preview.js +277 -0
- package/dist/cjs/editing/component-layout-service.js +62 -0
- package/dist/cjs/editing/design-library.js +184 -0
- package/dist/cjs/editing/editing-service.js +81 -0
- package/dist/cjs/editing/index.js +33 -0
- package/dist/cjs/editing/models.js +44 -0
- package/dist/cjs/editing/utils.js +105 -0
- package/dist/cjs/form/form.js +81 -0
- package/dist/cjs/form/index.js +7 -0
- package/dist/cjs/i18n/dictionary-service.js +144 -0
- package/dist/cjs/i18n/index.js +7 -0
- package/dist/cjs/i18n/utils.js +16 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/layout/content-styles.js +73 -0
- package/dist/cjs/layout/index.js +24 -0
- package/dist/cjs/layout/layout-service.js +68 -0
- package/dist/cjs/layout/models.js +39 -0
- package/dist/cjs/layout/themes.js +77 -0
- package/dist/cjs/layout/utils.js +117 -0
- package/dist/cjs/media/index.js +38 -0
- package/dist/cjs/media/media-api.js +100 -0
- package/dist/cjs/models.js +2 -0
- package/dist/cjs/personalize/index.js +15 -0
- package/dist/cjs/personalize/layout-personalizer.js +98 -0
- package/dist/cjs/personalize/personalize-service.js +109 -0
- package/dist/cjs/personalize/utils.js +143 -0
- package/dist/cjs/site/error-pages-service.js +82 -0
- package/dist/cjs/site/index.js +26 -0
- package/dist/cjs/site/models.js +2 -0
- package/dist/cjs/site/redirects-service.js +109 -0
- package/dist/cjs/site/robots-service.js +74 -0
- package/dist/cjs/site/site-resolver.js +73 -0
- package/dist/cjs/site/siteinfo-service.js +94 -0
- package/dist/cjs/site/sitemap-xml-service.js +92 -0
- package/dist/cjs/site/sitepath-service.js +201 -0
- package/dist/cjs/site/utils.js +55 -0
- package/dist/cjs/sitecore-service-base.js +33 -0
- package/dist/cjs/tools/codegen/component-generation.js +49 -0
- package/dist/cjs/tools/codegen/extract-files.js +105 -0
- package/dist/cjs/tools/codegen/import-map.js +411 -0
- package/dist/cjs/tools/codegen/utils.js +418 -0
- package/dist/cjs/tools/generate-map.js +2 -0
- package/dist/cjs/tools/generateSites.js +59 -0
- package/dist/cjs/tools/index.js +30 -0
- package/dist/cjs/tools/scaffold.js +62 -0
- package/dist/cjs/tools/templating/components.js +96 -0
- package/dist/cjs/tools/templating/index.js +6 -0
- package/dist/esm/client/edge-proxy.js +19 -0
- package/dist/esm/client/index.js +4 -0
- package/dist/esm/client/models.js +1 -0
- package/dist/esm/client/sitecore-client.js +416 -0
- package/dist/esm/client/utils.js +49 -0
- package/dist/esm/config/define-config.js +189 -0
- package/dist/esm/config/index.js +2 -0
- package/dist/esm/config/models.js +9 -0
- package/dist/esm/config-cli/define-cli-config.js +19 -0
- package/dist/esm/config-cli/index.js +2 -0
- package/dist/esm/config-cli/models.js +5 -0
- package/dist/esm/constants.js +9 -0
- package/dist/esm/debug.js +19 -0
- package/dist/esm/editing/codegen/index.js +1 -0
- package/dist/esm/editing/codegen/preview.js +263 -0
- package/dist/esm/editing/component-layout-service.js +55 -0
- package/dist/esm/editing/design-library.js +172 -0
- package/dist/esm/editing/editing-service.js +74 -0
- package/dist/esm/editing/index.js +6 -0
- package/dist/esm/editing/models.js +41 -0
- package/dist/esm/editing/utils.js +98 -0
- package/dist/esm/form/form.js +72 -0
- package/dist/esm/form/index.js +1 -0
- package/dist/esm/i18n/dictionary-service.js +137 -0
- package/dist/esm/i18n/index.js +2 -0
- package/dist/esm/i18n/utils.js +13 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/layout/content-styles.js +65 -0
- package/dist/esm/layout/index.js +6 -0
- package/dist/esm/layout/layout-service.js +61 -0
- package/dist/esm/layout/models.js +36 -0
- package/dist/esm/layout/themes.js +72 -0
- package/dist/esm/layout/utils.js +109 -0
- package/dist/esm/media/index.js +2 -0
- package/dist/esm/media/media-api.js +90 -0
- package/dist/esm/models.js +1 -0
- package/dist/esm/personalize/index.js +3 -0
- package/dist/esm/personalize/layout-personalizer.js +93 -0
- package/dist/esm/personalize/personalize-service.js +102 -0
- package/dist/esm/personalize/utils.js +135 -0
- package/dist/esm/site/error-pages-service.js +75 -0
- package/dist/esm/site/index.js +8 -0
- package/dist/esm/site/models.js +1 -0
- package/dist/esm/site/redirects-service.js +102 -0
- package/dist/esm/site/robots-service.js +67 -0
- package/dist/esm/site/site-resolver.js +69 -0
- package/dist/esm/site/siteinfo-service.js +87 -0
- package/dist/esm/site/sitemap-xml-service.js +85 -0
- package/dist/esm/site/sitepath-service.js +193 -0
- package/dist/esm/site/utils.js +49 -0
- package/dist/esm/sitecore-service-base.js +29 -0
- package/dist/esm/tools/codegen/component-generation.js +44 -0
- package/dist/esm/tools/codegen/extract-files.js +99 -0
- package/dist/esm/tools/codegen/import-map.js +368 -0
- package/dist/esm/tools/codegen/utils.js +373 -0
- package/dist/esm/tools/generate-map.js +1 -0
- package/dist/esm/tools/generateSites.js +52 -0
- package/dist/esm/tools/index.js +6 -0
- package/dist/esm/tools/scaffold.js +54 -0
- package/dist/esm/tools/templating/components.js +59 -0
- package/dist/esm/tools/templating/index.js +1 -0
- package/editing.d.ts +1 -0
- package/i18n.d.ts +1 -0
- package/layout.d.ts +1 -0
- package/media.d.ts +1 -0
- package/package.json +157 -0
- package/personalize.d.ts +1 -0
- package/site.d.ts +1 -0
- package/tools.d.ts +1 -0
- package/types/client/edge-proxy.d.ts +17 -0
- package/types/client/edge-proxy.d.ts.map +1 -0
- package/types/client/index.d.ts +7 -0
- package/types/client/index.d.ts.map +1 -0
- package/types/client/models.d.ts +21 -0
- package/types/client/models.d.ts.map +1 -0
- package/types/client/sitecore-client.d.ts +338 -0
- package/types/client/sitecore-client.d.ts.map +1 -0
- package/types/client/utils.d.ts +15 -0
- package/types/client/utils.d.ts.map +1 -0
- package/types/config/define-config.d.ts +20 -0
- package/types/config/define-config.d.ts.map +1 -0
- package/types/config/index.d.ts +3 -0
- package/types/config/index.d.ts.map +1 -0
- package/types/config/models.d.ts +287 -0
- package/types/config/models.d.ts.map +1 -0
- package/types/config-cli/define-cli-config.d.ts +9 -0
- package/types/config-cli/define-cli-config.d.ts.map +1 -0
- package/types/config-cli/index.d.ts +3 -0
- package/types/config-cli/index.d.ts.map +1 -0
- package/types/config-cli/models.d.ts +6 -0
- package/types/config-cli/models.d.ts.map +1 -0
- package/types/constants.d.ts +10 -0
- package/types/constants.d.ts.map +1 -0
- package/types/debug.d.ts +19 -0
- package/types/debug.d.ts.map +1 -0
- package/types/editing/codegen/index.d.ts +2 -0
- package/types/editing/codegen/index.d.ts.map +1 -0
- package/types/editing/codegen/preview.d.ts +256 -0
- package/types/editing/codegen/preview.d.ts.map +1 -0
- package/types/editing/component-layout-service.d.ts +84 -0
- package/types/editing/component-layout-service.d.ts.map +1 -0
- package/types/editing/design-library.d.ts +111 -0
- package/types/editing/design-library.d.ts.map +1 -0
- package/types/editing/editing-service.d.ts +71 -0
- package/types/editing/editing-service.d.ts.map +1 -0
- package/types/editing/index.d.ts +7 -0
- package/types/editing/index.d.ts.map +1 -0
- package/types/editing/models.d.ts +103 -0
- package/types/editing/models.d.ts.map +1 -0
- package/types/editing/utils.d.ts +82 -0
- package/types/editing/utils.d.ts.map +1 -0
- package/types/form/form.d.ts +25 -0
- package/types/form/form.d.ts.map +1 -0
- package/types/form/index.d.ts +2 -0
- package/types/form/index.d.ts.map +1 -0
- package/types/i18n/dictionary-service.d.ts +133 -0
- package/types/i18n/dictionary-service.d.ts.map +1 -0
- package/types/i18n/index.d.ts +3 -0
- package/types/i18n/index.d.ts.map +1 -0
- package/types/i18n/utils.d.ts +9 -0
- package/types/i18n/utils.d.ts.map +1 -0
- package/types/index.d.ts +7 -0
- package/types/index.d.ts.map +1 -0
- package/types/layout/content-styles.d.ts +20 -0
- package/types/layout/content-styles.d.ts.map +1 -0
- package/types/layout/index.d.ts +6 -0
- package/types/layout/index.d.ts.map +1 -0
- package/types/layout/layout-service.d.ts +45 -0
- package/types/layout/layout-service.d.ts.map +1 -0
- package/types/layout/models.d.ts +174 -0
- package/types/layout/models.d.ts.map +1 -0
- package/types/layout/themes.d.ts +13 -0
- package/types/layout/themes.d.ts.map +1 -0
- package/types/layout/utils.d.ts +56 -0
- package/types/layout/utils.d.ts.map +1 -0
- package/types/media/index.d.ts +3 -0
- package/types/media/index.d.ts.map +1 -0
- package/types/media/media-api.d.ts +60 -0
- package/types/media/media-api.d.ts.map +1 -0
- package/types/models.d.ts +32 -0
- package/types/models.d.ts.map +1 -0
- package/types/personalize/index.d.ts +4 -0
- package/types/personalize/index.d.ts.map +1 -0
- package/types/personalize/layout-personalizer.d.ts +29 -0
- package/types/personalize/layout-personalizer.d.ts.map +1 -0
- package/types/personalize/personalize-service.d.ts +89 -0
- package/types/personalize/personalize-service.d.ts.map +1 -0
- package/types/personalize/utils.d.ts +78 -0
- package/types/personalize/utils.d.ts.map +1 -0
- package/types/site/error-pages-service.d.ts +64 -0
- package/types/site/error-pages-service.d.ts.map +1 -0
- package/types/site/index.d.ts +10 -0
- package/types/site/index.d.ts.map +1 -0
- package/types/site/models.d.ts +23 -0
- package/types/site/models.d.ts.map +1 -0
- package/types/site/redirects-service.d.ts +91 -0
- package/types/site/redirects-service.d.ts.map +1 -0
- package/types/site/robots-service.d.ts +57 -0
- package/types/site/robots-service.d.ts.map +1 -0
- package/types/site/site-resolver.d.ts +28 -0
- package/types/site/site-resolver.d.ts.map +1 -0
- package/types/site/siteinfo-service.d.ts +64 -0
- package/types/site/siteinfo-service.d.ts.map +1 -0
- package/types/site/sitemap-xml-service.d.ts +63 -0
- package/types/site/sitemap-xml-service.d.ts.map +1 -0
- package/types/site/sitepath-service.d.ts +137 -0
- package/types/site/sitepath-service.d.ts.map +1 -0
- package/types/site/utils.d.ts +41 -0
- package/types/site/utils.d.ts.map +1 -0
- package/types/sitecore-service-base.d.ts +31 -0
- package/types/sitecore-service-base.d.ts.map +1 -0
- package/types/tools/codegen/component-generation.d.ts +50 -0
- package/types/tools/codegen/component-generation.d.ts.map +1 -0
- package/types/tools/codegen/extract-files.d.ts +24 -0
- package/types/tools/codegen/extract-files.d.ts.map +1 -0
- package/types/tools/codegen/import-map.d.ts +103 -0
- package/types/tools/codegen/import-map.d.ts.map +1 -0
- package/types/tools/codegen/utils.d.ts +76 -0
- package/types/tools/codegen/utils.d.ts.map +1 -0
- package/types/tools/generate-map.d.ts +36 -0
- package/types/tools/generate-map.d.ts.map +1 -0
- package/types/tools/generateSites.d.ts +25 -0
- package/types/tools/generateSites.d.ts.map +1 -0
- package/types/tools/index.d.ts +8 -0
- package/types/tools/index.d.ts.map +1 -0
- package/types/tools/scaffold.d.ts +27 -0
- package/types/tools/scaffold.d.ts.map +1 -0
- package/types/tools/templating/components.d.ts +104 -0
- package/types/tools/templating/components.d.ts.map +1 -0
- package/types/tools/templating/index.d.ts +2 -0
- package/types/tools/templating/index.d.ts.map +1 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { RetryStrategy } from '@sitecore-content-sdk/core';
|
|
2
|
+
import { GenerateMapFunction, GenerateMapArgs } from '../tools';
|
|
3
|
+
/**
|
|
4
|
+
* Utility type to make every property in a type required
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type DeepRequired<T> = Required<{
|
|
8
|
+
[K in keyof T]: T[K] extends Required<T[K]> ? T[K] : DeepRequired<T[K]>;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Utility type to make all properties in a type optional, recursively
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export type DeepPartial<T> = {
|
|
15
|
+
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Type to be used as config input in sitecore.config
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export type SitecoreConfigInput = {
|
|
22
|
+
/**
|
|
23
|
+
* API settings required to connect to Sitecore.
|
|
24
|
+
* Both edge and local sets can be specified; the Content SDK app will choose
|
|
25
|
+
* the correct credentials (Edge or local) at runtime.
|
|
26
|
+
*/
|
|
27
|
+
api?: {
|
|
28
|
+
/**
|
|
29
|
+
* Edge endpoint credentials for connecting to an XM Cloud instance.
|
|
30
|
+
*/
|
|
31
|
+
edge?: {
|
|
32
|
+
/**
|
|
33
|
+
* A unified identifier used to connect and retrieve data from XM Cloud instance
|
|
34
|
+
* Must be provided together with `clientContextId` to support both server-
|
|
35
|
+
* side and browser-side data fetching.
|
|
36
|
+
*/
|
|
37
|
+
contextId: string;
|
|
38
|
+
/**
|
|
39
|
+
* Optional identifier used to connect and retrieve data from XM Cloud instance in client-side functionality
|
|
40
|
+
*/
|
|
41
|
+
clientContextId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* XM Cloud endpoint that the app will communicate and retrieve data from
|
|
44
|
+
* @default https://edge-platform.sitecorecloud.io
|
|
45
|
+
*/
|
|
46
|
+
edgeUrl?: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* API endpoint credentials for connecting to a local Sitecore instance.
|
|
50
|
+
*/
|
|
51
|
+
local?: {
|
|
52
|
+
/**
|
|
53
|
+
* Sitecore API key used to connect to the GraphQL endpoint
|
|
54
|
+
*/
|
|
55
|
+
apiKey: string;
|
|
56
|
+
/**
|
|
57
|
+
* Sitecore API hostname that the app connects to
|
|
58
|
+
*/
|
|
59
|
+
apiHost: string;
|
|
60
|
+
/**
|
|
61
|
+
* GraphQL endpoint path (appended to `apiHost` to form the full URL).
|
|
62
|
+
* @default /sitecore/api/graph/edge
|
|
63
|
+
*/
|
|
64
|
+
path?: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The default and fallback locale for your site.
|
|
69
|
+
* Ensure it aligns with the framework-specific settings used in your application.
|
|
70
|
+
*/
|
|
71
|
+
defaultLanguage?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Your default site name. When using the multisite feature this variable defines the fallback site.
|
|
74
|
+
*/
|
|
75
|
+
defaultSite?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Editing secret required for Sitecore editing and preview functionality.
|
|
78
|
+
* Default comes from the SITECORE_EDITING_SECRET environment variable.
|
|
79
|
+
*/
|
|
80
|
+
editingSecret?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Retry configuration applied to Layout, Dictionary and ErrorPages services
|
|
83
|
+
*/
|
|
84
|
+
retries?: {
|
|
85
|
+
/**
|
|
86
|
+
* Number of retries for the GraphQL client.
|
|
87
|
+
* @default 3
|
|
88
|
+
*/
|
|
89
|
+
count?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Retry strategy for the client. By default, uses exponential
|
|
92
|
+
* back-off factor of 2 for codes 429, 502, 503, 504, 520, 521, 522, 523, 524.
|
|
93
|
+
* @default DefaultRetryStrategy
|
|
94
|
+
*/
|
|
95
|
+
retryStrategy?: RetryStrategy;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Settings for Layout Service
|
|
99
|
+
*/
|
|
100
|
+
layout?: {
|
|
101
|
+
/**
|
|
102
|
+
* Override the first part of graphQL query for Layout Service (excluding the fields part)
|
|
103
|
+
* @param {string} siteName your site name
|
|
104
|
+
* @param {string} itemPath full path to Sitecore item/route
|
|
105
|
+
* @param {string} [locale] item/route language
|
|
106
|
+
* @returns {string} custom layout query
|
|
107
|
+
* @default 'layout(site:"${siteName}", routePath:"${itemPath}", language:"${language}")'
|
|
108
|
+
*/
|
|
109
|
+
formatLayoutQuery?: ((siteName: string, itemPath: string, locale?: string) => string) | null;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Settings for Dictionary Service
|
|
113
|
+
*/
|
|
114
|
+
dictionary?: {
|
|
115
|
+
/**
|
|
116
|
+
* Configure local memory caching for Dictionary Service requests
|
|
117
|
+
*/
|
|
118
|
+
caching?: {
|
|
119
|
+
enabled?: boolean;
|
|
120
|
+
timeout?: number;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Settings for multisite functionality
|
|
125
|
+
*/
|
|
126
|
+
multisite?: {
|
|
127
|
+
/**
|
|
128
|
+
* Enable multisite
|
|
129
|
+
*
|
|
130
|
+
* **WARNING: Do NOT disable multisite in App Router applications.**
|
|
131
|
+
*
|
|
132
|
+
* The App Router route structure requires the `[site]` segment in the path (`/[site]/[locale]/[[...path]]`).
|
|
133
|
+
* Disabling this will break routing and cause 404 errors for regular requests.
|
|
134
|
+
*
|
|
135
|
+
* Preview and Editing modes will still work (they bypass this check), but regular page requests will fail.
|
|
136
|
+
*
|
|
137
|
+
* **For single-site setups**: Keep `enabled: true` and configure only one site in your sites configuration.
|
|
138
|
+
* The middleware will always use that single site, achieving the desired single-site behavior.
|
|
139
|
+
* @default true
|
|
140
|
+
*/
|
|
141
|
+
enabled?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Function used to determine if site should be resolved from sc_site cookie when present
|
|
144
|
+
*/
|
|
145
|
+
useCookieResolution?: (req?: RequestInit, res?: ResponseInit) => boolean;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Settings for Personalize functionality
|
|
149
|
+
*/
|
|
150
|
+
personalize?: {
|
|
151
|
+
/**
|
|
152
|
+
* Enable personalize proxy
|
|
153
|
+
* @default process.env.NODE_ENV !== 'development'
|
|
154
|
+
*/
|
|
155
|
+
enabled?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Configuration for your Sitecore Experience Edge endpoint
|
|
158
|
+
* by default set by the PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT environment variable (for personalize proxy)
|
|
159
|
+
* if not set, will use the default value of 400ms
|
|
160
|
+
*/
|
|
161
|
+
edgeTimeout?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Configuration for your Sitecore CDP endpoint
|
|
164
|
+
* by default set by the PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT environment variable (for personalize proxy)
|
|
165
|
+
* if not set, will use the default value of 400ms
|
|
166
|
+
*/
|
|
167
|
+
cdpTimeout?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Optional Sitecore Personalize scope ID (to isolate data between environments)
|
|
170
|
+
*/
|
|
171
|
+
scope?: string;
|
|
172
|
+
/**
|
|
173
|
+
* The Sitecore CDP channel to use for events. Uses 'WEB' by default.
|
|
174
|
+
*/
|
|
175
|
+
channel?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Currency for CDP requests
|
|
178
|
+
* @default 'USA'
|
|
179
|
+
*/
|
|
180
|
+
currency?: string;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Settings for redirects functionality
|
|
184
|
+
*/
|
|
185
|
+
redirects?: {
|
|
186
|
+
/**
|
|
187
|
+
* Enable redirects middleware
|
|
188
|
+
* @default process.env.NODE_ENV !== 'development'
|
|
189
|
+
*/
|
|
190
|
+
enabled?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* These are all the locales you support in your application.
|
|
193
|
+
* These should match those in framework-specific configuration of your app.
|
|
194
|
+
*/
|
|
195
|
+
locales?: string[];
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Opt-out setting for code generation feature
|
|
199
|
+
* Disables code extraction procedure
|
|
200
|
+
*/
|
|
201
|
+
disableCodeGeneration?: boolean;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Final Sitecore config type used at runtime.
|
|
205
|
+
* Every property is populated, either from sitecore.config or fallback values.
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
export type SitecoreConfig = DeepRequired<SitecoreConfigInput>;
|
|
209
|
+
/**
|
|
210
|
+
* Type used as CLI config input in sitecore.cli.config
|
|
211
|
+
* @public
|
|
212
|
+
*/
|
|
213
|
+
export type SitecoreCliConfigInput = {
|
|
214
|
+
/**
|
|
215
|
+
* Sitecore configuration (`sitecore.config` file)
|
|
216
|
+
*/
|
|
217
|
+
config?: SitecoreConfig;
|
|
218
|
+
/**
|
|
219
|
+
* Configuration for the `sitecore-tools build` CLI command
|
|
220
|
+
*/
|
|
221
|
+
build?: {
|
|
222
|
+
/**
|
|
223
|
+
* Commands to run during the build process
|
|
224
|
+
*/
|
|
225
|
+
commands?: Array<(args?: {
|
|
226
|
+
scConfig?: SitecoreConfig;
|
|
227
|
+
}) => Promise<void>>;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Configuration for the `sitecore-tools scaffold` CLI command
|
|
231
|
+
*/
|
|
232
|
+
scaffold?: {
|
|
233
|
+
/**
|
|
234
|
+
* Scaffold templates available for generating components
|
|
235
|
+
*/
|
|
236
|
+
templates?: ScaffoldTemplate[];
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Configuration for the `sitecore-tools component generate-map` CLI command
|
|
240
|
+
*/
|
|
241
|
+
componentMap?: GenerateMapArgs & {
|
|
242
|
+
/**
|
|
243
|
+
* Function implementation for generating a component map
|
|
244
|
+
*/
|
|
245
|
+
generator?: GenerateMapFunction;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Final Sitecore CLI config type required by the CLI
|
|
250
|
+
* @public
|
|
251
|
+
*/
|
|
252
|
+
export type SitecoreCliConfig = DeepRequired<SitecoreCliConfigInput>;
|
|
253
|
+
/**
|
|
254
|
+
* Represents a scaffold template used for generating components
|
|
255
|
+
* @public
|
|
256
|
+
*/
|
|
257
|
+
export type ScaffoldTemplate = {
|
|
258
|
+
/**
|
|
259
|
+
* Name of the template
|
|
260
|
+
*/
|
|
261
|
+
name: string;
|
|
262
|
+
/**
|
|
263
|
+
* File extension for the generated component
|
|
264
|
+
*/
|
|
265
|
+
fileExtension: string;
|
|
266
|
+
/**
|
|
267
|
+
* Function to generate the component file contents based on the component name.
|
|
268
|
+
* @param componentName - The name of the component.
|
|
269
|
+
* @returns The generated content as a string.
|
|
270
|
+
*/
|
|
271
|
+
generateTemplate: (componentName: string) => string;
|
|
272
|
+
/**
|
|
273
|
+
* Optional function to get the next steps to be shown by the cli after generating the component.
|
|
274
|
+
* @param componentOutputPath - The output path of the generated component.
|
|
275
|
+
* @returns An array of strings representing the next steps.
|
|
276
|
+
*/
|
|
277
|
+
getNextSteps?: (componentOutputPath: string) => string[];
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Enumeration of default component templates
|
|
281
|
+
* @internal
|
|
282
|
+
*/
|
|
283
|
+
export declare enum ComponentTemplateType {
|
|
284
|
+
BYOC = "byoc",
|
|
285
|
+
DEFAULT = "default"
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/config/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC;KACpC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,CAAC,C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;QACN;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,cAAc,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KAC3E,CAAC;IACF;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT;;WAEG;QACH,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;KAChC,CAAC;IACF;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,GAAG;QAC/B;;WAEG;QACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;KACjC,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,mBAAmB,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;CAC1D,CAAC;AAEF;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,OAAO,YAAY;CACpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SitecoreCliConfig, SitecoreCliConfigInput } from '../config/models';
|
|
2
|
+
/**
|
|
3
|
+
* Accepts a `SitecoreCliConfigInput` object and returns Sitecore Content SDK CLI configuration, updated with required default values
|
|
4
|
+
* @param {SitecoreCliConfigInput} cliConfig the cli configuration provided by the application
|
|
5
|
+
* @returns {SitecoreCliConfig} full sitecore cli configuration to use with cli
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const defineCliConfig: (cliConfig: SitecoreCliConfigInput) => SitecoreCliConfig;
|
|
9
|
+
//# sourceMappingURL=define-cli-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-cli-config.d.ts","sourceRoot":"","sources":["../../src/config-cli/define-cli-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAc7E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,sBAAsB,KAAG,iBAGnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config-cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/config-cli/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,yBAAyB,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @private */
|
|
2
|
+
export declare const siteNameError = "The site name must be a non-empty string";
|
|
3
|
+
/** @private */
|
|
4
|
+
export declare const languageError = "The language must be a non-empty string";
|
|
5
|
+
/**
|
|
6
|
+
* Hidden rendering name
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const HIDDEN_RENDERING_NAME = "Hidden Rendering";
|
|
10
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,eAAO,MAAM,aAAa,6CAA6C,CAAC;AACxE,eAAe;AACf,eAAO,MAAM,aAAa,4CAA4C,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC"}
|
package/types/debug.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug module for content package
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
declare const debug: {
|
|
6
|
+
form: import("debug").Debugger;
|
|
7
|
+
layout: import("debug").Debugger;
|
|
8
|
+
dictionary: import("debug").Debugger;
|
|
9
|
+
editing: import("debug").Debugger;
|
|
10
|
+
sitemap: import("debug").Debugger;
|
|
11
|
+
multisite: import("debug").Debugger;
|
|
12
|
+
robots: import("debug").Debugger;
|
|
13
|
+
redirects: import("debug").Debugger;
|
|
14
|
+
personalize: import("debug").Debugger;
|
|
15
|
+
locale: import("debug").Debugger;
|
|
16
|
+
errorpages: import("debug").Debugger;
|
|
17
|
+
};
|
|
18
|
+
export default debug;
|
|
19
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,QAAA,MAAM,KAAK;;;;;;;;;;;;CAYV,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { addComponentPreviewHandler, addServerComponentPreviewHandler, getDesignLibraryComponentPreviewErrorEvent, getDesignLibraryComponentPropsEvent, getDesignLibraryImportMapEvent, getImportMapInfo, addStyleElement, createComponentInstance, sendErrorEvent, DesignLibraryPreviewError, ImportEntry, ImportEntryInfo, ComponentPreviewEventArgs, } from './preview';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editing/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,0CAA0C,EAC1C,mCAAmC,EACnC,8BAA8B,EAC9B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EACzB,WAAW,EACX,eAAe,EACf,yBAAyB,GAC1B,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { ComponentFields, ComponentParams } from '../../layout/models';
|
|
2
|
+
import { DesignLibraryEvent } from '../design-library';
|
|
3
|
+
/**
|
|
4
|
+
* Event to send import map to design library
|
|
5
|
+
*/
|
|
6
|
+
declare const DESIGN_LIBRARY_IMPORT_MAP_EVENT_NAME = "component:generation:import-map";
|
|
7
|
+
/**
|
|
8
|
+
* Event to send component props to design library
|
|
9
|
+
*/
|
|
10
|
+
declare const DESIGN_LIBRARY_COMPONENT_PROPS_EVENT_NAME = "component:generation:component-props";
|
|
11
|
+
/**
|
|
12
|
+
* Event to receive component data from design library
|
|
13
|
+
*/
|
|
14
|
+
declare const DESIGN_LIBRARY_COMPONENT_PREVIEW_EVENT_NAME = "component:generation:component-preview";
|
|
15
|
+
/**
|
|
16
|
+
* Event to send component error to design library
|
|
17
|
+
*/
|
|
18
|
+
declare const DESIGN_LIBRARY_COMPONENT_PREVIEW_ERROR_EVENT_NAME = "component:generation:component-preview-error";
|
|
19
|
+
/**
|
|
20
|
+
* Represents an import map entry.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface ImportEntry {
|
|
24
|
+
module: string;
|
|
25
|
+
exports: {
|
|
26
|
+
name: string | 'default' | '*';
|
|
27
|
+
value: unknown;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents the info for the import entry to be sent to design library.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export interface ImportEntryInfo {
|
|
35
|
+
module: string;
|
|
36
|
+
exports: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Represents a component import.
|
|
40
|
+
*/
|
|
41
|
+
export type ComponentImport = {
|
|
42
|
+
/**
|
|
43
|
+
* The name of the module to be imported.
|
|
44
|
+
* e.g. 'react'
|
|
45
|
+
*/
|
|
46
|
+
module: string;
|
|
47
|
+
/**
|
|
48
|
+
* The name of the export to be imported.
|
|
49
|
+
* e.g. 'useMemo'
|
|
50
|
+
*/
|
|
51
|
+
export: string;
|
|
52
|
+
/**
|
|
53
|
+
* The alias of the import.
|
|
54
|
+
* e.g. 'useMemoFn'
|
|
55
|
+
*/
|
|
56
|
+
alias: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Represents a component preview event data sent from design library
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export interface ComponentPreviewEventArgs extends DesignLibraryEvent {
|
|
63
|
+
name: typeof DESIGN_LIBRARY_COMPONENT_PREVIEW_EVENT_NAME;
|
|
64
|
+
message: {
|
|
65
|
+
/**
|
|
66
|
+
* The unique identifier for the component.
|
|
67
|
+
*/
|
|
68
|
+
uid: string;
|
|
69
|
+
/**
|
|
70
|
+
* The code of the component.
|
|
71
|
+
*/
|
|
72
|
+
code: {
|
|
73
|
+
type: 'function';
|
|
74
|
+
content: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The styles of the component.
|
|
78
|
+
*/
|
|
79
|
+
styles: {
|
|
80
|
+
type: 'style-element';
|
|
81
|
+
/**
|
|
82
|
+
* The styles content to be attached to the DOM.
|
|
83
|
+
*/
|
|
84
|
+
content: string;
|
|
85
|
+
/**
|
|
86
|
+
* The CSS module import
|
|
87
|
+
*/
|
|
88
|
+
styleImport: {
|
|
89
|
+
/**
|
|
90
|
+
* The name of the style import.
|
|
91
|
+
*/
|
|
92
|
+
name: string;
|
|
93
|
+
/**
|
|
94
|
+
* The value of the style import
|
|
95
|
+
*/
|
|
96
|
+
content: unknown;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* The imports of the component.
|
|
101
|
+
*/
|
|
102
|
+
imports: ComponentImport[];
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Represents an event indicating the import map to be sent to design library
|
|
107
|
+
*/
|
|
108
|
+
export interface DesignLibraryImportMapEvent extends DesignLibraryEvent {
|
|
109
|
+
name: typeof DESIGN_LIBRARY_IMPORT_MAP_EVENT_NAME;
|
|
110
|
+
message: {
|
|
111
|
+
uid: string;
|
|
112
|
+
importMap: {
|
|
113
|
+
module: string;
|
|
114
|
+
exports: string[];
|
|
115
|
+
}[];
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Represents an event indicating the component props to be sent to design library
|
|
120
|
+
*/
|
|
121
|
+
export interface DesignLibraryComponentPropsEvent extends DesignLibraryEvent {
|
|
122
|
+
name: typeof DESIGN_LIBRARY_COMPONENT_PROPS_EVENT_NAME;
|
|
123
|
+
message: {
|
|
124
|
+
uid: string;
|
|
125
|
+
fields: ComponentFields;
|
|
126
|
+
parameters: ComponentParams;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Represents an event indicating the preview error to be sent to design library.
|
|
131
|
+
*/
|
|
132
|
+
export interface DesignLibraryComponentPreviewErrorEvent extends DesignLibraryEvent {
|
|
133
|
+
name: typeof DESIGN_LIBRARY_COMPONENT_PREVIEW_ERROR_EVENT_NAME;
|
|
134
|
+
message: {
|
|
135
|
+
uid: string;
|
|
136
|
+
error: unknown;
|
|
137
|
+
type: DesignLibraryPreviewError;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Enumeration of error types for the design library preview.
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
export declare enum DesignLibraryPreviewError {
|
|
145
|
+
/**
|
|
146
|
+
* Error occurred during component rendering.
|
|
147
|
+
*/
|
|
148
|
+
Render = "render",
|
|
149
|
+
/**
|
|
150
|
+
* Error occurred during component and event handlers initialization.
|
|
151
|
+
*/
|
|
152
|
+
RenderInit = "render-init"
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Builds the component dependencies from the component imports and the import map.
|
|
156
|
+
* @param {ComponentImport[]} componentImports - The component imports.
|
|
157
|
+
* @param {ImportEntry[]} importMap - The import map to be used for the component.
|
|
158
|
+
* @returns {Array<{ name: string; value: unknown }>} The component dependencies.
|
|
159
|
+
*/
|
|
160
|
+
export declare function buildComponentDependencies(componentImports: ComponentImport[], importMap: ImportEntry[]): {
|
|
161
|
+
successful: {
|
|
162
|
+
name: string;
|
|
163
|
+
value: unknown;
|
|
164
|
+
}[];
|
|
165
|
+
missing: {
|
|
166
|
+
modules: {
|
|
167
|
+
module: string;
|
|
168
|
+
alias: string;
|
|
169
|
+
}[];
|
|
170
|
+
exports: {
|
|
171
|
+
alias: string;
|
|
172
|
+
export: string;
|
|
173
|
+
module: string;
|
|
174
|
+
}[];
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Adds the browser-side event handler for 'component:generation:component-preview' message used in Design Library
|
|
179
|
+
* The event should contain the component code, styles and imports.
|
|
180
|
+
* @param {ImportEntry[]} importMap - The import map to be used for the component.
|
|
181
|
+
* @param {Function} callback callback to be called after component is received
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
export declare const addComponentPreviewHandler: (importMap: ImportEntry[], callback: (error: unknown | null, Component: unknown) => void) => (() => void) | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* Adds the browser-side event handler for 'component:generation:component-preview' message used in Design Library for server components
|
|
187
|
+
* The event should contain the component code, styles and imports.
|
|
188
|
+
* @param {Function} callback callback to be called after component is received
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
export declare const addServerComponentPreviewHandler: (callback: (eventArgs: ComponentPreviewEventArgs) => void) => () => void;
|
|
192
|
+
/**
|
|
193
|
+
* Adds <style> element in the document head with the provided CSS.
|
|
194
|
+
* If an existing style element with the id "content-sdk-style-preview" is found, it is removed
|
|
195
|
+
* to prevent duplicates
|
|
196
|
+
* @param {string} stylesContent - The raw CSS text to inject into the style element.
|
|
197
|
+
* @internal
|
|
198
|
+
*/
|
|
199
|
+
export declare function addStyleElement(stylesContent: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Dynamically creates a React component instance from provided importMap and from code, styles, and dependencies provided in the preview event.
|
|
202
|
+
* @param {ImportEntry[]} importMap - The import map containing module and export references that might be injected as dependencies in the provided code.
|
|
203
|
+
* @param {ComponentPreviewEventArgs} previewEventArgs - The event arguments containing the component code, styles, and import definitions.
|
|
204
|
+
* @returns The dynamically created React component instance.
|
|
205
|
+
* @throws If any required modules or exports are missing from the import map, an error is thrown describing the missing dependencies.
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
export declare const createComponentInstance: (importMap: ImportEntry[], previewEventArgs: ComponentPreviewEventArgs) => unknown;
|
|
209
|
+
/**
|
|
210
|
+
* Generates a DesignLibraryComponentPreviewErrorEvent with the given uid and error.
|
|
211
|
+
* @param {string} uid - The unique identifier for the event.
|
|
212
|
+
* @param {unknown} error - The error to be sent.
|
|
213
|
+
* @param {DesignLibraryPreviewError} type - The type of error.
|
|
214
|
+
* @returns An object representing the DesignLibraryComponentPreviewErrorEvent.
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
export declare function getDesignLibraryComponentPreviewErrorEvent(uid: string, error: unknown, type: DesignLibraryPreviewError): DesignLibraryComponentPreviewErrorEvent;
|
|
218
|
+
/**
|
|
219
|
+
* Generates a DesignLibraryComponentPropsEvent with the given uid, fields and parameters.
|
|
220
|
+
* @param {string} uid - The unique identifier for the event.
|
|
221
|
+
* @param {ComponentFields} fields - The fields of the component.
|
|
222
|
+
* @param {ComponentParams} parameters - The parameters of the component.
|
|
223
|
+
* @returns An object representing the DesignLibraryComponentPropsEvent.
|
|
224
|
+
* @internal
|
|
225
|
+
*/
|
|
226
|
+
export declare function getDesignLibraryComponentPropsEvent(uid: string, fields?: ComponentFields, parameters?: ComponentParams): DesignLibraryComponentPropsEvent;
|
|
227
|
+
/**
|
|
228
|
+
* Generates a DesignLibraryImportMapEvent with the given uid and importMap.
|
|
229
|
+
* @param {string} uid - The unique identifier for the event.
|
|
230
|
+
* @param {ImportEntry[]} importMap - The imports map to be sent.
|
|
231
|
+
* @returns An object representing the DesignLibraryImportMapEvent.
|
|
232
|
+
* @internal
|
|
233
|
+
*/
|
|
234
|
+
export declare function getDesignLibraryImportMapEvent(uid: string, importMap: ImportEntry[] | ImportEntryInfo[]): DesignLibraryImportMapEvent;
|
|
235
|
+
/**
|
|
236
|
+
* Generates the payload for the import map to be sent to design library.
|
|
237
|
+
* @param {ImportEntry[]} importMap - The imports map to be sent.
|
|
238
|
+
* @internal
|
|
239
|
+
*/
|
|
240
|
+
export declare function getImportMapInfo(importMap: ImportEntry[]): ImportEntryInfo[];
|
|
241
|
+
/**
|
|
242
|
+
* Type guard for ImportEntryInfo[]
|
|
243
|
+
* @param {unknown} data import entry data to check
|
|
244
|
+
* @returns true if the data is ImportEntryInfo array
|
|
245
|
+
*/
|
|
246
|
+
export declare function isImportEntryInfoArray(data: unknown): data is ImportEntryInfo[];
|
|
247
|
+
/**
|
|
248
|
+
* Sends a component preview error event to the design library
|
|
249
|
+
* @param {string} uid - The unique identifier of the component that's being edited.
|
|
250
|
+
* @param {unknown} error - The error object or message to be sent.
|
|
251
|
+
* @param {DesignLibraryPreviewError} type - The type of error, as defined in DesignLibraryPreviewError.
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
export declare const sendErrorEvent: (uid: string, error: unknown, type: DesignLibraryPreviewError) => void;
|
|
255
|
+
export {};
|
|
256
|
+
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/editing/codegen/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAiB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA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