@sitecore-content-sdk/content 1.5.0-canary.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/LICENSE.txt +202 -0
  2. package/README.md +7 -0
  3. package/client.d.ts +1 -0
  4. package/codegen.d.ts +1 -0
  5. package/config-cli.d.ts +1 -0
  6. package/config.d.ts +1 -0
  7. package/dist/cjs/client/edge-proxy.js +29 -0
  8. package/dist/cjs/client/index.js +14 -0
  9. package/dist/cjs/client/models.js +2 -0
  10. package/dist/cjs/client/sitecore-client.js +443 -0
  11. package/dist/cjs/client/utils.js +53 -0
  12. package/dist/cjs/config/define-config.js +200 -0
  13. package/dist/cjs/config/index.js +7 -0
  14. package/dist/cjs/config/models.js +12 -0
  15. package/dist/cjs/config-cli/define-cli-config.js +23 -0
  16. package/dist/cjs/config-cli/index.js +7 -0
  17. package/dist/cjs/config-cli/models.js +8 -0
  18. package/dist/cjs/constants.js +12 -0
  19. package/dist/cjs/debug.js +21 -0
  20. package/dist/cjs/editing/codegen/index.js +15 -0
  21. package/dist/cjs/editing/codegen/preview.js +305 -0
  22. package/dist/cjs/editing/component-layout-service.js +63 -0
  23. package/dist/cjs/editing/design-library.js +191 -0
  24. package/dist/cjs/editing/editing-service.js +82 -0
  25. package/dist/cjs/editing/index.js +34 -0
  26. package/dist/cjs/editing/models.js +44 -0
  27. package/dist/cjs/editing/utils.js +105 -0
  28. package/dist/cjs/form/form.js +81 -0
  29. package/dist/cjs/form/index.js +7 -0
  30. package/dist/cjs/i18n/dictionary-service.js +144 -0
  31. package/dist/cjs/i18n/index.js +7 -0
  32. package/dist/cjs/i18n/utils.js +16 -0
  33. package/dist/cjs/index.js +47 -0
  34. package/dist/cjs/layout/content-styles.js +72 -0
  35. package/dist/cjs/layout/index.js +29 -0
  36. package/dist/cjs/layout/layout-service.js +69 -0
  37. package/dist/cjs/layout/models.js +39 -0
  38. package/dist/cjs/layout/rewrite-edge-host.js +161 -0
  39. package/dist/cjs/layout/themes.js +74 -0
  40. package/dist/cjs/layout/utils.js +117 -0
  41. package/dist/cjs/media/index.js +38 -0
  42. package/dist/cjs/media/media-api.js +100 -0
  43. package/dist/cjs/models.js +2 -0
  44. package/dist/cjs/personalize/index.js +15 -0
  45. package/dist/cjs/personalize/layout-personalizer.js +98 -0
  46. package/dist/cjs/personalize/personalize-service.js +109 -0
  47. package/dist/cjs/personalize/utils.js +143 -0
  48. package/dist/cjs/site/error-pages-service.js +95 -0
  49. package/dist/cjs/site/index.js +26 -0
  50. package/dist/cjs/site/models.js +2 -0
  51. package/dist/cjs/site/redirects-service.js +109 -0
  52. package/dist/cjs/site/robots-service.js +74 -0
  53. package/dist/cjs/site/site-resolver.js +73 -0
  54. package/dist/cjs/site/siteinfo-service.js +94 -0
  55. package/dist/cjs/site/sitemap-xml-service.js +92 -0
  56. package/dist/cjs/site/sitepath-service.js +201 -0
  57. package/dist/cjs/site/utils.js +55 -0
  58. package/dist/cjs/sitecore-service-base.js +33 -0
  59. package/dist/cjs/tools/codegen/component-generation.js +49 -0
  60. package/dist/cjs/tools/codegen/extract-files.js +103 -0
  61. package/dist/cjs/tools/codegen/import-map.js +398 -0
  62. package/dist/cjs/tools/codegen/utils.js +418 -0
  63. package/dist/cjs/tools/generate-map.js +2 -0
  64. package/dist/cjs/tools/generateSites.js +58 -0
  65. package/dist/cjs/tools/index.js +30 -0
  66. package/dist/cjs/tools/scaffold.js +62 -0
  67. package/dist/cjs/tools/templating/components.js +96 -0
  68. package/dist/cjs/tools/templating/index.js +6 -0
  69. package/dist/esm/client/edge-proxy.js +24 -0
  70. package/dist/esm/client/index.js +4 -0
  71. package/dist/esm/client/models.js +1 -0
  72. package/dist/esm/client/sitecore-client.js +439 -0
  73. package/dist/esm/client/utils.js +49 -0
  74. package/dist/esm/config/define-config.js +194 -0
  75. package/dist/esm/config/index.js +2 -0
  76. package/dist/esm/config/models.js +9 -0
  77. package/dist/esm/config-cli/define-cli-config.js +19 -0
  78. package/dist/esm/config-cli/index.js +2 -0
  79. package/dist/esm/config-cli/models.js +5 -0
  80. package/dist/esm/constants.js +9 -0
  81. package/dist/esm/debug.js +19 -0
  82. package/dist/esm/editing/codegen/index.js +1 -0
  83. package/dist/esm/editing/codegen/preview.js +287 -0
  84. package/dist/esm/editing/component-layout-service.js +56 -0
  85. package/dist/esm/editing/design-library.js +179 -0
  86. package/dist/esm/editing/editing-service.js +75 -0
  87. package/dist/esm/editing/index.js +6 -0
  88. package/dist/esm/editing/models.js +41 -0
  89. package/dist/esm/editing/utils.js +98 -0
  90. package/dist/esm/form/form.js +72 -0
  91. package/dist/esm/form/index.js +1 -0
  92. package/dist/esm/i18n/dictionary-service.js +137 -0
  93. package/dist/esm/i18n/index.js +2 -0
  94. package/dist/esm/i18n/utils.js +13 -0
  95. package/dist/esm/index.js +5 -0
  96. package/dist/esm/layout/content-styles.js +64 -0
  97. package/dist/esm/layout/index.js +7 -0
  98. package/dist/esm/layout/layout-service.js +62 -0
  99. package/dist/esm/layout/models.js +36 -0
  100. package/dist/esm/layout/rewrite-edge-host.js +155 -0
  101. package/dist/esm/layout/themes.js +69 -0
  102. package/dist/esm/layout/utils.js +109 -0
  103. package/dist/esm/media/index.js +2 -0
  104. package/dist/esm/media/media-api.js +90 -0
  105. package/dist/esm/models.js +1 -0
  106. package/dist/esm/personalize/index.js +3 -0
  107. package/dist/esm/personalize/layout-personalizer.js +93 -0
  108. package/dist/esm/personalize/personalize-service.js +102 -0
  109. package/dist/esm/personalize/utils.js +135 -0
  110. package/dist/esm/site/error-pages-service.js +88 -0
  111. package/dist/esm/site/index.js +8 -0
  112. package/dist/esm/site/models.js +1 -0
  113. package/dist/esm/site/redirects-service.js +102 -0
  114. package/dist/esm/site/robots-service.js +67 -0
  115. package/dist/esm/site/site-resolver.js +69 -0
  116. package/dist/esm/site/siteinfo-service.js +87 -0
  117. package/dist/esm/site/sitemap-xml-service.js +85 -0
  118. package/dist/esm/site/sitepath-service.js +193 -0
  119. package/dist/esm/site/utils.js +49 -0
  120. package/dist/esm/sitecore-service-base.js +29 -0
  121. package/dist/esm/tools/codegen/component-generation.js +44 -0
  122. package/dist/esm/tools/codegen/extract-files.js +97 -0
  123. package/dist/esm/tools/codegen/import-map.js +355 -0
  124. package/dist/esm/tools/codegen/utils.js +373 -0
  125. package/dist/esm/tools/generate-map.js +1 -0
  126. package/dist/esm/tools/generateSites.js +51 -0
  127. package/dist/esm/tools/index.js +6 -0
  128. package/dist/esm/tools/scaffold.js +54 -0
  129. package/dist/esm/tools/templating/components.js +59 -0
  130. package/dist/esm/tools/templating/index.js +1 -0
  131. package/editing.d.ts +1 -0
  132. package/i18n.d.ts +1 -0
  133. package/layout.d.ts +1 -0
  134. package/media.d.ts +1 -0
  135. package/package.json +157 -0
  136. package/personalize.d.ts +1 -0
  137. package/site.d.ts +1 -0
  138. package/tools.d.ts +1 -0
  139. package/types/client/edge-proxy.d.ts +17 -0
  140. package/types/client/edge-proxy.d.ts.map +1 -0
  141. package/types/client/index.d.ts +7 -0
  142. package/types/client/index.d.ts.map +1 -0
  143. package/types/client/models.d.ts +21 -0
  144. package/types/client/models.d.ts.map +1 -0
  145. package/types/client/sitecore-client.d.ts +346 -0
  146. package/types/client/sitecore-client.d.ts.map +1 -0
  147. package/types/client/utils.d.ts +15 -0
  148. package/types/client/utils.d.ts.map +1 -0
  149. package/types/config/define-config.d.ts +20 -0
  150. package/types/config/define-config.d.ts.map +1 -0
  151. package/types/config/index.d.ts +3 -0
  152. package/types/config/index.d.ts.map +1 -0
  153. package/types/config/models.d.ts +294 -0
  154. package/types/config/models.d.ts.map +1 -0
  155. package/types/config-cli/define-cli-config.d.ts +9 -0
  156. package/types/config-cli/define-cli-config.d.ts.map +1 -0
  157. package/types/config-cli/index.d.ts +3 -0
  158. package/types/config-cli/index.d.ts.map +1 -0
  159. package/types/config-cli/models.d.ts +6 -0
  160. package/types/config-cli/models.d.ts.map +1 -0
  161. package/types/constants.d.ts +10 -0
  162. package/types/constants.d.ts.map +1 -0
  163. package/types/debug.d.ts +19 -0
  164. package/types/debug.d.ts.map +1 -0
  165. package/types/editing/codegen/index.d.ts +2 -0
  166. package/types/editing/codegen/index.d.ts.map +1 -0
  167. package/types/editing/codegen/preview.d.ts +289 -0
  168. package/types/editing/codegen/preview.d.ts.map +1 -0
  169. package/types/editing/component-layout-service.d.ts +84 -0
  170. package/types/editing/component-layout-service.d.ts.map +1 -0
  171. package/types/editing/design-library.d.ts +119 -0
  172. package/types/editing/design-library.d.ts.map +1 -0
  173. package/types/editing/editing-service.d.ts +71 -0
  174. package/types/editing/editing-service.d.ts.map +1 -0
  175. package/types/editing/index.d.ts +7 -0
  176. package/types/editing/index.d.ts.map +1 -0
  177. package/types/editing/models.d.ts +103 -0
  178. package/types/editing/models.d.ts.map +1 -0
  179. package/types/editing/utils.d.ts +82 -0
  180. package/types/editing/utils.d.ts.map +1 -0
  181. package/types/form/form.d.ts +25 -0
  182. package/types/form/form.d.ts.map +1 -0
  183. package/types/form/index.d.ts +2 -0
  184. package/types/form/index.d.ts.map +1 -0
  185. package/types/i18n/dictionary-service.d.ts +133 -0
  186. package/types/i18n/dictionary-service.d.ts.map +1 -0
  187. package/types/i18n/index.d.ts +3 -0
  188. package/types/i18n/index.d.ts.map +1 -0
  189. package/types/i18n/utils.d.ts +9 -0
  190. package/types/i18n/utils.d.ts.map +1 -0
  191. package/types/index.d.ts +7 -0
  192. package/types/index.d.ts.map +1 -0
  193. package/types/layout/content-styles.d.ts +20 -0
  194. package/types/layout/content-styles.d.ts.map +1 -0
  195. package/types/layout/index.d.ts +7 -0
  196. package/types/layout/index.d.ts.map +1 -0
  197. package/types/layout/layout-service.d.ts +45 -0
  198. package/types/layout/layout-service.d.ts.map +1 -0
  199. package/types/layout/models.d.ts +174 -0
  200. package/types/layout/models.d.ts.map +1 -0
  201. package/types/layout/rewrite-edge-host.d.ts +43 -0
  202. package/types/layout/rewrite-edge-host.d.ts.map +1 -0
  203. package/types/layout/themes.d.ts +13 -0
  204. package/types/layout/themes.d.ts.map +1 -0
  205. package/types/layout/utils.d.ts +56 -0
  206. package/types/layout/utils.d.ts.map +1 -0
  207. package/types/media/index.d.ts +3 -0
  208. package/types/media/index.d.ts.map +1 -0
  209. package/types/media/media-api.d.ts +60 -0
  210. package/types/media/media-api.d.ts.map +1 -0
  211. package/types/models.d.ts +32 -0
  212. package/types/models.d.ts.map +1 -0
  213. package/types/personalize/index.d.ts +4 -0
  214. package/types/personalize/index.d.ts.map +1 -0
  215. package/types/personalize/layout-personalizer.d.ts +29 -0
  216. package/types/personalize/layout-personalizer.d.ts.map +1 -0
  217. package/types/personalize/personalize-service.d.ts +88 -0
  218. package/types/personalize/personalize-service.d.ts.map +1 -0
  219. package/types/personalize/utils.d.ts +78 -0
  220. package/types/personalize/utils.d.ts.map +1 -0
  221. package/types/site/error-pages-service.d.ts +72 -0
  222. package/types/site/error-pages-service.d.ts.map +1 -0
  223. package/types/site/index.d.ts +10 -0
  224. package/types/site/index.d.ts.map +1 -0
  225. package/types/site/models.d.ts +23 -0
  226. package/types/site/models.d.ts.map +1 -0
  227. package/types/site/redirects-service.d.ts +91 -0
  228. package/types/site/redirects-service.d.ts.map +1 -0
  229. package/types/site/robots-service.d.ts +57 -0
  230. package/types/site/robots-service.d.ts.map +1 -0
  231. package/types/site/site-resolver.d.ts +28 -0
  232. package/types/site/site-resolver.d.ts.map +1 -0
  233. package/types/site/siteinfo-service.d.ts +64 -0
  234. package/types/site/siteinfo-service.d.ts.map +1 -0
  235. package/types/site/sitemap-xml-service.d.ts +63 -0
  236. package/types/site/sitemap-xml-service.d.ts.map +1 -0
  237. package/types/site/sitepath-service.d.ts +137 -0
  238. package/types/site/sitepath-service.d.ts.map +1 -0
  239. package/types/site/utils.d.ts +41 -0
  240. package/types/site/utils.d.ts.map +1 -0
  241. package/types/sitecore-service-base.d.ts +31 -0
  242. package/types/sitecore-service-base.d.ts.map +1 -0
  243. package/types/tools/codegen/component-generation.d.ts +50 -0
  244. package/types/tools/codegen/component-generation.d.ts.map +1 -0
  245. package/types/tools/codegen/extract-files.d.ts +20 -0
  246. package/types/tools/codegen/extract-files.d.ts.map +1 -0
  247. package/types/tools/codegen/import-map.d.ts +98 -0
  248. package/types/tools/codegen/import-map.d.ts.map +1 -0
  249. package/types/tools/codegen/utils.d.ts +76 -0
  250. package/types/tools/codegen/utils.d.ts.map +1 -0
  251. package/types/tools/generate-map.d.ts +36 -0
  252. package/types/tools/generate-map.d.ts.map +1 -0
  253. package/types/tools/generateSites.d.ts +22 -0
  254. package/types/tools/generateSites.d.ts.map +1 -0
  255. package/types/tools/index.d.ts +8 -0
  256. package/types/tools/index.d.ts.map +1 -0
  257. package/types/tools/scaffold.d.ts +27 -0
  258. package/types/tools/scaffold.d.ts.map +1 -0
  259. package/types/tools/templating/components.d.ts +104 -0
  260. package/types/tools/templating/components.d.ts.map +1 -0
  261. package/types/tools/templating/index.d.ts +2 -0
  262. package/types/tools/templating/index.d.ts.map +1 -0
@@ -0,0 +1,294 @@
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
+ * Rewrite media/content URLs in layout (media fields, rich text img/src, href, etc.).
199
+ * - When `true`: use default rewriter (Edge hostnames -> custom hostname from env).
200
+ * - When a function: transform each string value; the SDK traverses the layout for you.
201
+ * @default false
202
+ */
203
+ rewriteMediaUrls?: boolean | ((value: string) => string);
204
+ /**
205
+ * Opt-out setting for code generation feature
206
+ * Disables code extraction procedure
207
+ */
208
+ disableCodeGeneration?: boolean;
209
+ };
210
+ /**
211
+ * Final Sitecore config type used at runtime.
212
+ * Every property is populated, either from sitecore.config or fallback values.
213
+ * @public
214
+ */
215
+ export type SitecoreConfig = DeepRequired<SitecoreConfigInput>;
216
+ /**
217
+ * Type used as CLI config input in sitecore.cli.config
218
+ * @public
219
+ */
220
+ export type SitecoreCliConfigInput = {
221
+ /**
222
+ * Sitecore configuration (`sitecore.config` file)
223
+ */
224
+ config: SitecoreConfig;
225
+ /**
226
+ * Configuration for the `sitecore-tools build` CLI command
227
+ */
228
+ build?: {
229
+ /**
230
+ * Commands to run during the build process
231
+ */
232
+ commands?: Array<(args?: {
233
+ scConfig: SitecoreConfig;
234
+ }) => Promise<void>>;
235
+ };
236
+ /**
237
+ * Configuration for the `sitecore-tools scaffold` CLI command
238
+ */
239
+ scaffold?: {
240
+ /**
241
+ * Scaffold templates available for generating components
242
+ */
243
+ templates?: ScaffoldTemplate[];
244
+ };
245
+ /**
246
+ * Configuration for the `sitecore-tools component generate-map` CLI command
247
+ */
248
+ componentMap?: GenerateMapArgs & {
249
+ /**
250
+ * Function implementation for generating a component map
251
+ */
252
+ generator?: GenerateMapFunction;
253
+ };
254
+ };
255
+ /**
256
+ * Final Sitecore CLI config type required by the CLI
257
+ * @public
258
+ */
259
+ export type SitecoreCliConfig = DeepRequired<SitecoreCliConfigInput>;
260
+ /**
261
+ * Represents a scaffold template used for generating components
262
+ * @public
263
+ */
264
+ export type ScaffoldTemplate = {
265
+ /**
266
+ * Name of the template
267
+ */
268
+ name: string;
269
+ /**
270
+ * File extension for the generated component
271
+ */
272
+ fileExtension: string;
273
+ /**
274
+ * Function to generate the component file contents based on the component name.
275
+ * @param componentName - The name of the component.
276
+ * @returns The generated content as a string.
277
+ */
278
+ generateTemplate: (componentName: string) => string;
279
+ /**
280
+ * Optional function to get the next steps to be shown by the cli after generating the component.
281
+ * @param componentOutputPath - The output path of the generated component.
282
+ * @returns An array of strings representing the next steps.
283
+ */
284
+ getNextSteps?: (componentOutputPath: string) => string[];
285
+ };
286
+ /**
287
+ * Enumeration of default component templates
288
+ * @internal
289
+ */
290
+ export declare enum ComponentTemplateType {
291
+ BYOC = "byoc",
292
+ DEFAULT = "default"
293
+ }
294
+ //# 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,CA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CAAC,mBAAmB,CAAC,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE;QACN;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ,EAAE,cAAc,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KAC1E,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,3 @@
1
+ export { defineCliConfig } from './define-cli-config';
2
+ export { SITECORE_CLI_MODE_ENV_VAR } from './models';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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,6 @@
1
+ /**
2
+ * Environment variable to indicate that the application is running in CLI mode
3
+ * @internal
4
+ */
5
+ export declare const SITECORE_CLI_MODE_ENV_VAR = "SITECORE_CLI_MODE";
6
+ //# sourceMappingURL=models.d.ts.map
@@ -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"}
@@ -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, GeneratedComponentData, ComponentPreviewEventArgs, ServerComponentPreviewEventArgs, fetchGeneratedComponentFromCache, } 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,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,gCAAgC,GACjC,MAAM,WAAW,CAAC"}
@@ -0,0 +1,289 @@
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 the data needed to render AI generated component.
60
+ * @internal
61
+ */
62
+ export type GeneratedComponentData = {
63
+ /**
64
+ * The unique identifier for the component.
65
+ */
66
+ uid: string;
67
+ /**
68
+ * The code of the component.
69
+ */
70
+ code: {
71
+ type: 'function';
72
+ content: string;
73
+ };
74
+ /**
75
+ * The styles of the component.
76
+ */
77
+ styles: {
78
+ type: 'style-element';
79
+ /**
80
+ * The styles content to be attached to the DOM.
81
+ */
82
+ content: string;
83
+ /**
84
+ * The CSS module import
85
+ */
86
+ styleImport: {
87
+ /**
88
+ * The name of the style import.
89
+ */
90
+ name: string;
91
+ /**
92
+ * The value of the style import
93
+ */
94
+ content: unknown;
95
+ };
96
+ };
97
+ /**
98
+ * The imports of the component.
99
+ */
100
+ imports: ComponentImport[];
101
+ };
102
+ /**
103
+ * Represents a component preview event data sent from design library
104
+ * @internal
105
+ */
106
+ export interface ComponentPreviewEventArgs extends DesignLibraryEvent {
107
+ name: typeof DESIGN_LIBRARY_COMPONENT_PREVIEW_EVENT_NAME;
108
+ message: GeneratedComponentData;
109
+ }
110
+ /**
111
+ * Represents a server component preview event data sent from design library in variant generation mode.
112
+ * @internal
113
+ */
114
+ export interface ServerComponentPreviewEventArgs extends DesignLibraryEvent {
115
+ name: typeof DESIGN_LIBRARY_COMPONENT_PREVIEW_EVENT_NAME;
116
+ message: {
117
+ /**
118
+ * The cache information for the component preview, used for server components in Design Library variant generation mode.
119
+ */
120
+ cache: {
121
+ /** The unique identifier for the cache entry. */
122
+ id: string;
123
+ /** The jwt token for authentication when fetching the preview component from the cache. */
124
+ token: string;
125
+ };
126
+ };
127
+ }
128
+ /**
129
+ * Represents an event indicating the import map to be sent to design library
130
+ */
131
+ export interface DesignLibraryImportMapEvent extends DesignLibraryEvent {
132
+ name: typeof DESIGN_LIBRARY_IMPORT_MAP_EVENT_NAME;
133
+ message: {
134
+ uid: string;
135
+ importMap: {
136
+ module: string;
137
+ exports: string[];
138
+ }[];
139
+ };
140
+ }
141
+ /**
142
+ * Represents an event indicating the component props to be sent to design library
143
+ */
144
+ export interface DesignLibraryComponentPropsEvent extends DesignLibraryEvent {
145
+ name: typeof DESIGN_LIBRARY_COMPONENT_PROPS_EVENT_NAME;
146
+ message: {
147
+ uid: string;
148
+ fields: ComponentFields;
149
+ parameters: ComponentParams;
150
+ };
151
+ }
152
+ /**
153
+ * Represents an event indicating the preview error to be sent to design library.
154
+ */
155
+ export interface DesignLibraryComponentPreviewErrorEvent extends DesignLibraryEvent {
156
+ name: typeof DESIGN_LIBRARY_COMPONENT_PREVIEW_ERROR_EVENT_NAME;
157
+ message: {
158
+ uid: string;
159
+ error: unknown;
160
+ type: DesignLibraryPreviewError;
161
+ };
162
+ }
163
+ /**
164
+ * Enumeration of error types for the design library preview.
165
+ * @internal
166
+ */
167
+ export declare enum DesignLibraryPreviewError {
168
+ /**
169
+ * Error occurred during component rendering.
170
+ */
171
+ Render = "render",
172
+ /**
173
+ * Error occurred during component and event handlers initialization.
174
+ */
175
+ RenderInit = "render-init"
176
+ }
177
+ /**
178
+ * Builds the component dependencies from the component imports and the import map.
179
+ * @param {ComponentImport[]} componentImports - The component imports.
180
+ * @param {ImportEntry[]} importMap - The import map to be used for the component.
181
+ * @returns {Array<{ name: string; value: unknown }>} The component dependencies.
182
+ */
183
+ export declare function buildComponentDependencies(componentImports: ComponentImport[], importMap: ImportEntry[]): {
184
+ successful: {
185
+ name: string;
186
+ value: unknown;
187
+ }[];
188
+ missing: {
189
+ modules: {
190
+ module: string;
191
+ alias: string;
192
+ }[];
193
+ exports: {
194
+ alias: string;
195
+ export: string;
196
+ module: string;
197
+ }[];
198
+ };
199
+ };
200
+ /**
201
+ * Adds the browser-side event handler for 'component:generation:component-preview' message used in Design Library
202
+ * The event should contain the component code, styles and imports.
203
+ * @param {ImportEntry[]} importMap - The import map to be used for the component.
204
+ * @param {Function} callback callback to be called after component is received
205
+ * @internal
206
+ */
207
+ export declare const addComponentPreviewHandler: (importMap: ImportEntry[], callback: (error: unknown | null, Component: unknown) => void) => (() => void) | undefined;
208
+ /**
209
+ * Adds the browser-side event handler for 'component:generation:component-preview' message used in Design Library for server components
210
+ * The event should contain the cache id and token which will be used to fetch the component code, styles and imports from secured endpoint
211
+ * @param {Function} callback callback to be called after component is received
212
+ * @internal
213
+ */
214
+ export declare const addServerComponentPreviewHandler: (callback: (eventArgs: ServerComponentPreviewEventArgs) => void) => () => void;
215
+ /**
216
+ * Adds <style> element in the document head with the provided CSS.
217
+ * If an existing style element with the id "content-sdk-style-preview" is found, it is removed
218
+ * to prevent duplicates
219
+ * @param {string} stylesContent - The raw CSS text to inject into the style element.
220
+ * @internal
221
+ */
222
+ export declare function addStyleElement(stylesContent: string): void;
223
+ /**
224
+ * Dynamically creates a React component instance from provided importMap and from code, styles, and dependencies provided in the preview event.
225
+ * @param {ImportEntry[]} importMap - The import map containing module and export references that might be injected as dependencies in the provided code.
226
+ * @param {GeneratedComponentData} generatedComponentData - The generated component data received from design library.
227
+ * @returns The dynamically created React component instance.
228
+ * @throws If any required modules or exports are missing from the import map, an error is thrown describing the missing dependencies.
229
+ * @internal
230
+ */
231
+ export declare const createComponentInstance: (importMap: ImportEntry[], generatedComponentData: GeneratedComponentData) => unknown;
232
+ /**
233
+ * Generates a DesignLibraryComponentPreviewErrorEvent with the given uid and error.
234
+ * @param {string} uid - The unique identifier for the event.
235
+ * @param {unknown} error - The error to be sent.
236
+ * @param {DesignLibraryPreviewError} type - The type of error.
237
+ * @returns An object representing the DesignLibraryComponentPreviewErrorEvent.
238
+ * @internal
239
+ */
240
+ export declare function getDesignLibraryComponentPreviewErrorEvent(uid: string, error: unknown, type: DesignLibraryPreviewError): DesignLibraryComponentPreviewErrorEvent;
241
+ /**
242
+ * Generates a DesignLibraryComponentPropsEvent with the given uid, fields and parameters.
243
+ * @param {string} uid - The unique identifier for the event.
244
+ * @param {ComponentFields} fields - The fields of the component.
245
+ * @param {ComponentParams} parameters - The parameters of the component.
246
+ * @returns An object representing the DesignLibraryComponentPropsEvent.
247
+ * @internal
248
+ */
249
+ export declare function getDesignLibraryComponentPropsEvent(uid: string, fields?: ComponentFields, parameters?: ComponentParams): DesignLibraryComponentPropsEvent;
250
+ /**
251
+ * Generates a DesignLibraryImportMapEvent with the given uid and importMap.
252
+ * @param {string} uid - The unique identifier for the event.
253
+ * @param {ImportEntry[]} importMap - The imports map to be sent.
254
+ * @returns An object representing the DesignLibraryImportMapEvent.
255
+ * @internal
256
+ */
257
+ export declare function getDesignLibraryImportMapEvent(uid: string, importMap: ImportEntry[] | ImportEntryInfo[]): DesignLibraryImportMapEvent;
258
+ /**
259
+ * Generates the payload for the import map to be sent to design library.
260
+ * @param {ImportEntry[]} importMap - The imports map to be sent.
261
+ * @internal
262
+ */
263
+ export declare function getImportMapInfo(importMap: ImportEntry[]): ImportEntryInfo[];
264
+ /**
265
+ * Type guard for ImportEntryInfo[]
266
+ * @param {unknown} data import entry data to check
267
+ * @returns true if the data is ImportEntryInfo array
268
+ */
269
+ export declare function isImportEntryInfoArray(data: unknown): data is ImportEntryInfo[];
270
+ /**
271
+ * Sends a component preview error event to the design library
272
+ * @param {string} uid - The unique identifier of the component that's being edited.
273
+ * @param {unknown} error - The error object or message to be sent.
274
+ * @param {DesignLibraryPreviewError} type - The type of error, as defined in DesignLibraryPreviewError.
275
+ * @internal
276
+ */
277
+ export declare const sendErrorEvent: (uid: string, error: unknown, type: DesignLibraryPreviewError) => void;
278
+ /**
279
+ * Fetches generated component data from the authoring cache endpoint.
280
+ * This is used by the Design Studio Server to fetch the updated component data from the secured cache endpoint and render it in the Design Library Studio preview iframe.
281
+ * @param {string} id - The unique identifier of the component to fetch from cache.
282
+ * @param {string} token - The authorization token for authentication.
283
+ * @param {string} [edgeUrl] - The URL of the Sitecore Edge endpoint.
284
+ * @returns A Promise that resolves to the component rendering data, component generation data, or undefined if the fetch fails.
285
+ * @internal
286
+ */
287
+ export declare function fetchGeneratedComponentFromCache(id: string, token: string, edgeUrl?: string): Promise<GeneratedComponentData>;
288
+ export {};
289
+ //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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