@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.
Files changed (258) 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 +24 -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 +420 -0
  11. package/dist/cjs/client/utils.js +53 -0
  12. package/dist/cjs/config/define-config.js +195 -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 +14 -0
  21. package/dist/cjs/editing/codegen/preview.js +277 -0
  22. package/dist/cjs/editing/component-layout-service.js +62 -0
  23. package/dist/cjs/editing/design-library.js +184 -0
  24. package/dist/cjs/editing/editing-service.js +81 -0
  25. package/dist/cjs/editing/index.js +33 -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 +73 -0
  35. package/dist/cjs/layout/index.js +24 -0
  36. package/dist/cjs/layout/layout-service.js +68 -0
  37. package/dist/cjs/layout/models.js +39 -0
  38. package/dist/cjs/layout/themes.js +77 -0
  39. package/dist/cjs/layout/utils.js +117 -0
  40. package/dist/cjs/media/index.js +38 -0
  41. package/dist/cjs/media/media-api.js +100 -0
  42. package/dist/cjs/models.js +2 -0
  43. package/dist/cjs/personalize/index.js +15 -0
  44. package/dist/cjs/personalize/layout-personalizer.js +98 -0
  45. package/dist/cjs/personalize/personalize-service.js +109 -0
  46. package/dist/cjs/personalize/utils.js +143 -0
  47. package/dist/cjs/site/error-pages-service.js +82 -0
  48. package/dist/cjs/site/index.js +26 -0
  49. package/dist/cjs/site/models.js +2 -0
  50. package/dist/cjs/site/redirects-service.js +109 -0
  51. package/dist/cjs/site/robots-service.js +74 -0
  52. package/dist/cjs/site/site-resolver.js +73 -0
  53. package/dist/cjs/site/siteinfo-service.js +94 -0
  54. package/dist/cjs/site/sitemap-xml-service.js +92 -0
  55. package/dist/cjs/site/sitepath-service.js +201 -0
  56. package/dist/cjs/site/utils.js +55 -0
  57. package/dist/cjs/sitecore-service-base.js +33 -0
  58. package/dist/cjs/tools/codegen/component-generation.js +49 -0
  59. package/dist/cjs/tools/codegen/extract-files.js +105 -0
  60. package/dist/cjs/tools/codegen/import-map.js +411 -0
  61. package/dist/cjs/tools/codegen/utils.js +418 -0
  62. package/dist/cjs/tools/generate-map.js +2 -0
  63. package/dist/cjs/tools/generateSites.js +59 -0
  64. package/dist/cjs/tools/index.js +30 -0
  65. package/dist/cjs/tools/scaffold.js +62 -0
  66. package/dist/cjs/tools/templating/components.js +96 -0
  67. package/dist/cjs/tools/templating/index.js +6 -0
  68. package/dist/esm/client/edge-proxy.js +19 -0
  69. package/dist/esm/client/index.js +4 -0
  70. package/dist/esm/client/models.js +1 -0
  71. package/dist/esm/client/sitecore-client.js +416 -0
  72. package/dist/esm/client/utils.js +49 -0
  73. package/dist/esm/config/define-config.js +189 -0
  74. package/dist/esm/config/index.js +2 -0
  75. package/dist/esm/config/models.js +9 -0
  76. package/dist/esm/config-cli/define-cli-config.js +19 -0
  77. package/dist/esm/config-cli/index.js +2 -0
  78. package/dist/esm/config-cli/models.js +5 -0
  79. package/dist/esm/constants.js +9 -0
  80. package/dist/esm/debug.js +19 -0
  81. package/dist/esm/editing/codegen/index.js +1 -0
  82. package/dist/esm/editing/codegen/preview.js +263 -0
  83. package/dist/esm/editing/component-layout-service.js +55 -0
  84. package/dist/esm/editing/design-library.js +172 -0
  85. package/dist/esm/editing/editing-service.js +74 -0
  86. package/dist/esm/editing/index.js +6 -0
  87. package/dist/esm/editing/models.js +41 -0
  88. package/dist/esm/editing/utils.js +98 -0
  89. package/dist/esm/form/form.js +72 -0
  90. package/dist/esm/form/index.js +1 -0
  91. package/dist/esm/i18n/dictionary-service.js +137 -0
  92. package/dist/esm/i18n/index.js +2 -0
  93. package/dist/esm/i18n/utils.js +13 -0
  94. package/dist/esm/index.js +5 -0
  95. package/dist/esm/layout/content-styles.js +65 -0
  96. package/dist/esm/layout/index.js +6 -0
  97. package/dist/esm/layout/layout-service.js +61 -0
  98. package/dist/esm/layout/models.js +36 -0
  99. package/dist/esm/layout/themes.js +72 -0
  100. package/dist/esm/layout/utils.js +109 -0
  101. package/dist/esm/media/index.js +2 -0
  102. package/dist/esm/media/media-api.js +90 -0
  103. package/dist/esm/models.js +1 -0
  104. package/dist/esm/personalize/index.js +3 -0
  105. package/dist/esm/personalize/layout-personalizer.js +93 -0
  106. package/dist/esm/personalize/personalize-service.js +102 -0
  107. package/dist/esm/personalize/utils.js +135 -0
  108. package/dist/esm/site/error-pages-service.js +75 -0
  109. package/dist/esm/site/index.js +8 -0
  110. package/dist/esm/site/models.js +1 -0
  111. package/dist/esm/site/redirects-service.js +102 -0
  112. package/dist/esm/site/robots-service.js +67 -0
  113. package/dist/esm/site/site-resolver.js +69 -0
  114. package/dist/esm/site/siteinfo-service.js +87 -0
  115. package/dist/esm/site/sitemap-xml-service.js +85 -0
  116. package/dist/esm/site/sitepath-service.js +193 -0
  117. package/dist/esm/site/utils.js +49 -0
  118. package/dist/esm/sitecore-service-base.js +29 -0
  119. package/dist/esm/tools/codegen/component-generation.js +44 -0
  120. package/dist/esm/tools/codegen/extract-files.js +99 -0
  121. package/dist/esm/tools/codegen/import-map.js +368 -0
  122. package/dist/esm/tools/codegen/utils.js +373 -0
  123. package/dist/esm/tools/generate-map.js +1 -0
  124. package/dist/esm/tools/generateSites.js +52 -0
  125. package/dist/esm/tools/index.js +6 -0
  126. package/dist/esm/tools/scaffold.js +54 -0
  127. package/dist/esm/tools/templating/components.js +59 -0
  128. package/dist/esm/tools/templating/index.js +1 -0
  129. package/editing.d.ts +1 -0
  130. package/i18n.d.ts +1 -0
  131. package/layout.d.ts +1 -0
  132. package/media.d.ts +1 -0
  133. package/package.json +157 -0
  134. package/personalize.d.ts +1 -0
  135. package/site.d.ts +1 -0
  136. package/tools.d.ts +1 -0
  137. package/types/client/edge-proxy.d.ts +17 -0
  138. package/types/client/edge-proxy.d.ts.map +1 -0
  139. package/types/client/index.d.ts +7 -0
  140. package/types/client/index.d.ts.map +1 -0
  141. package/types/client/models.d.ts +21 -0
  142. package/types/client/models.d.ts.map +1 -0
  143. package/types/client/sitecore-client.d.ts +338 -0
  144. package/types/client/sitecore-client.d.ts.map +1 -0
  145. package/types/client/utils.d.ts +15 -0
  146. package/types/client/utils.d.ts.map +1 -0
  147. package/types/config/define-config.d.ts +20 -0
  148. package/types/config/define-config.d.ts.map +1 -0
  149. package/types/config/index.d.ts +3 -0
  150. package/types/config/index.d.ts.map +1 -0
  151. package/types/config/models.d.ts +287 -0
  152. package/types/config/models.d.ts.map +1 -0
  153. package/types/config-cli/define-cli-config.d.ts +9 -0
  154. package/types/config-cli/define-cli-config.d.ts.map +1 -0
  155. package/types/config-cli/index.d.ts +3 -0
  156. package/types/config-cli/index.d.ts.map +1 -0
  157. package/types/config-cli/models.d.ts +6 -0
  158. package/types/config-cli/models.d.ts.map +1 -0
  159. package/types/constants.d.ts +10 -0
  160. package/types/constants.d.ts.map +1 -0
  161. package/types/debug.d.ts +19 -0
  162. package/types/debug.d.ts.map +1 -0
  163. package/types/editing/codegen/index.d.ts +2 -0
  164. package/types/editing/codegen/index.d.ts.map +1 -0
  165. package/types/editing/codegen/preview.d.ts +256 -0
  166. package/types/editing/codegen/preview.d.ts.map +1 -0
  167. package/types/editing/component-layout-service.d.ts +84 -0
  168. package/types/editing/component-layout-service.d.ts.map +1 -0
  169. package/types/editing/design-library.d.ts +111 -0
  170. package/types/editing/design-library.d.ts.map +1 -0
  171. package/types/editing/editing-service.d.ts +71 -0
  172. package/types/editing/editing-service.d.ts.map +1 -0
  173. package/types/editing/index.d.ts +7 -0
  174. package/types/editing/index.d.ts.map +1 -0
  175. package/types/editing/models.d.ts +103 -0
  176. package/types/editing/models.d.ts.map +1 -0
  177. package/types/editing/utils.d.ts +82 -0
  178. package/types/editing/utils.d.ts.map +1 -0
  179. package/types/form/form.d.ts +25 -0
  180. package/types/form/form.d.ts.map +1 -0
  181. package/types/form/index.d.ts +2 -0
  182. package/types/form/index.d.ts.map +1 -0
  183. package/types/i18n/dictionary-service.d.ts +133 -0
  184. package/types/i18n/dictionary-service.d.ts.map +1 -0
  185. package/types/i18n/index.d.ts +3 -0
  186. package/types/i18n/index.d.ts.map +1 -0
  187. package/types/i18n/utils.d.ts +9 -0
  188. package/types/i18n/utils.d.ts.map +1 -0
  189. package/types/index.d.ts +7 -0
  190. package/types/index.d.ts.map +1 -0
  191. package/types/layout/content-styles.d.ts +20 -0
  192. package/types/layout/content-styles.d.ts.map +1 -0
  193. package/types/layout/index.d.ts +6 -0
  194. package/types/layout/index.d.ts.map +1 -0
  195. package/types/layout/layout-service.d.ts +45 -0
  196. package/types/layout/layout-service.d.ts.map +1 -0
  197. package/types/layout/models.d.ts +174 -0
  198. package/types/layout/models.d.ts.map +1 -0
  199. package/types/layout/themes.d.ts +13 -0
  200. package/types/layout/themes.d.ts.map +1 -0
  201. package/types/layout/utils.d.ts +56 -0
  202. package/types/layout/utils.d.ts.map +1 -0
  203. package/types/media/index.d.ts +3 -0
  204. package/types/media/index.d.ts.map +1 -0
  205. package/types/media/media-api.d.ts +60 -0
  206. package/types/media/media-api.d.ts.map +1 -0
  207. package/types/models.d.ts +32 -0
  208. package/types/models.d.ts.map +1 -0
  209. package/types/personalize/index.d.ts +4 -0
  210. package/types/personalize/index.d.ts.map +1 -0
  211. package/types/personalize/layout-personalizer.d.ts +29 -0
  212. package/types/personalize/layout-personalizer.d.ts.map +1 -0
  213. package/types/personalize/personalize-service.d.ts +89 -0
  214. package/types/personalize/personalize-service.d.ts.map +1 -0
  215. package/types/personalize/utils.d.ts +78 -0
  216. package/types/personalize/utils.d.ts.map +1 -0
  217. package/types/site/error-pages-service.d.ts +64 -0
  218. package/types/site/error-pages-service.d.ts.map +1 -0
  219. package/types/site/index.d.ts +10 -0
  220. package/types/site/index.d.ts.map +1 -0
  221. package/types/site/models.d.ts +23 -0
  222. package/types/site/models.d.ts.map +1 -0
  223. package/types/site/redirects-service.d.ts +91 -0
  224. package/types/site/redirects-service.d.ts.map +1 -0
  225. package/types/site/robots-service.d.ts +57 -0
  226. package/types/site/robots-service.d.ts.map +1 -0
  227. package/types/site/site-resolver.d.ts +28 -0
  228. package/types/site/site-resolver.d.ts.map +1 -0
  229. package/types/site/siteinfo-service.d.ts +64 -0
  230. package/types/site/siteinfo-service.d.ts.map +1 -0
  231. package/types/site/sitemap-xml-service.d.ts +63 -0
  232. package/types/site/sitemap-xml-service.d.ts.map +1 -0
  233. package/types/site/sitepath-service.d.ts +137 -0
  234. package/types/site/sitepath-service.d.ts.map +1 -0
  235. package/types/site/utils.d.ts +41 -0
  236. package/types/site/utils.d.ts.map +1 -0
  237. package/types/sitecore-service-base.d.ts +31 -0
  238. package/types/sitecore-service-base.d.ts.map +1 -0
  239. package/types/tools/codegen/component-generation.d.ts +50 -0
  240. package/types/tools/codegen/component-generation.d.ts.map +1 -0
  241. package/types/tools/codegen/extract-files.d.ts +24 -0
  242. package/types/tools/codegen/extract-files.d.ts.map +1 -0
  243. package/types/tools/codegen/import-map.d.ts +103 -0
  244. package/types/tools/codegen/import-map.d.ts.map +1 -0
  245. package/types/tools/codegen/utils.d.ts +76 -0
  246. package/types/tools/codegen/utils.d.ts.map +1 -0
  247. package/types/tools/generate-map.d.ts +36 -0
  248. package/types/tools/generate-map.d.ts.map +1 -0
  249. package/types/tools/generateSites.d.ts +25 -0
  250. package/types/tools/generateSites.d.ts.map +1 -0
  251. package/types/tools/index.d.ts +8 -0
  252. package/types/tools/index.d.ts.map +1 -0
  253. package/types/tools/scaffold.d.ts +27 -0
  254. package/types/tools/scaffold.d.ts.map +1 -0
  255. package/types/tools/templating/components.d.ts +104 -0
  256. package/types/tools/templating/components.d.ts.map +1 -0
  257. package/types/tools/templating/index.d.ts +2 -0
  258. package/types/tools/templating/index.d.ts.map +1 -0
@@ -0,0 +1,78 @@
1
+ /** @internal */
2
+ export declare const DEFAULT_VARIANT = "_default";
3
+ /** @internal */
4
+ export declare const VARIANT_PREFIX = "_variantId_";
5
+ /** @public */
6
+ export type PersonalizedRewriteData = {
7
+ variantId: string;
8
+ componentVariantIds?: string[];
9
+ };
10
+ /**
11
+ * Get a personalized rewrite path for given pathname
12
+ * @param {string} pathname the pathname
13
+ * @param {string[]} variantIds the variantIds to include in the rewrite
14
+ * @returns {string} the rewrite path
15
+ * @public
16
+ */
17
+ export declare function getPersonalizedRewrite(pathname: string, variantIds: string[]): string;
18
+ /**
19
+ * Get personalize data from the rewrite path
20
+ * @param {string} pathname the pathname
21
+ * @returns {PersonalizedRewriteData} the personalize data from the rewrite
22
+ * @public
23
+ */
24
+ export declare function getPersonalizedRewriteData(pathname: string): PersonalizedRewriteData;
25
+ /**
26
+ * Parses a list of variantIds and divides into layout and component variants
27
+ * @param {string[]} variantIds the list of variant IDs for a page
28
+ * @returns {PersonalizedRewriteData} object with variant IDs sorted
29
+ * @public
30
+ */
31
+ export declare function getGroomedVariantIds(variantIds: string[]): PersonalizedRewriteData;
32
+ /**
33
+ * Normalize a personalized rewrite path (remove personalize data)
34
+ * @param {string} pathname the pathname
35
+ * @returns {string} the pathname with personalize data removed
36
+ * @public
37
+ */
38
+ export declare function normalizePersonalizedRewrite(pathname: string): string;
39
+ /**
40
+ * Static utility class for Sitecore CDP
41
+ * @public
42
+ */
43
+ export declare class CdpHelper {
44
+ /**
45
+ * Gets the page variant id for CDP in the required format
46
+ * @param {string} pageId the page id
47
+ * @param {string} language the language
48
+ * @param {string} variantId the variant id
49
+ * @param {string} [scope] the scope value
50
+ * @returns {string} the formatted page variant id
51
+ */
52
+ static getPageVariantId(pageId: string, language: string, variantId: string, scope?: string): string;
53
+ /**
54
+ * Gets the friendly id for (page-level) Embedded Personalization in the required format `embedded_[<scope>_]<id>_<lang>`
55
+ * @param {string} pageId the page id
56
+ * @param {string} language the language
57
+ * @param {string} [scope] the scope value
58
+ * @returns {string} the friendly id
59
+ */
60
+ static getPageFriendlyId(pageId: string, language: string, scope?: string): string;
61
+ /**
62
+ * Gets the friendly id for Component A/B Testing in the required format `component_[<scope>_]<pageId>_<componentId>_<language>*`
63
+ * @param {string} pageId the page id
64
+ * @param {string} componentId the component id
65
+ * @param {string} language the language
66
+ * @param {string} [scope] the scope value
67
+ * @returns {string} the friendly id
68
+ */
69
+ static getComponentFriendlyId(pageId: string, componentId: string, language: string, scope?: string): string;
70
+ /**
71
+ * Normalizes the scope from the given string value
72
+ * Removes all non-alphanumeric characters
73
+ * @param {string} [scope] the scope value
74
+ * @returns {string} normalized scope value
75
+ */
76
+ static normalizeScope(scope?: string): string;
77
+ }
78
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/personalize/utils.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,gBAAgB;AAChB,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,cAAc;AACd,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAGrF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,uBAAuB,CAWpF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,2BAmBxD;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASrE;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB;;;;;;;OAOG;IACH,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM;IAWT;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAOlF;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAC3B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM;IAQT;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;CAG9C"}
@@ -0,0 +1,64 @@
1
+ import { GraphQLRequestClientFactory } from '@sitecore-content-sdk/core';
2
+ import { FetchOptions, GraphQLClient } from '../client';
3
+ import { LayoutServiceData } from '../layout';
4
+ import { GraphQLServiceConfig } from '../sitecore-service-base';
5
+ /**
6
+ * Configuration for @see ErrorPagesService instances
7
+ * @public
8
+ */
9
+ export interface ErrorPagesServiceConfig extends GraphQLServiceConfig {
10
+ /**
11
+ * The language
12
+ */
13
+ language: string;
14
+ /**
15
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
16
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
17
+ */
18
+ clientFactory: GraphQLRequestClientFactory;
19
+ }
20
+ /**
21
+ * Object model of Error Pages result
22
+ * @public
23
+ */
24
+ export type ErrorPages = {
25
+ notFoundPage: {
26
+ rendered: LayoutServiceData;
27
+ };
28
+ notFoundPagePath: string;
29
+ serverErrorPage: {
30
+ rendered: LayoutServiceData;
31
+ };
32
+ serverErrorPagePath: string;
33
+ };
34
+ /**
35
+ * Service that fetch the error pages data using Sitecore's GraphQL API.
36
+ * @public
37
+ */
38
+ export declare class ErrorPagesService {
39
+ options: ErrorPagesServiceConfig;
40
+ private graphQLClient;
41
+ /**
42
+ * Creates an instance of graphQL error pages service with the provided options
43
+ * @param {ErrorPagesServiceConfig} options instance
44
+ */
45
+ constructor(options: ErrorPagesServiceConfig);
46
+ protected get query(): string;
47
+ /**
48
+ * Fetch list of error pages for the site
49
+ * @param {string} siteName The site name
50
+ * @param {string} locale The language
51
+ * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
52
+ * @returns {ErrorPages} list of url's error pages
53
+ * @throws {Error} if the siteName is empty.
54
+ */
55
+ fetchErrorPages(siteName: string, locale?: string, fetchOptions?: FetchOptions): Promise<ErrorPages | null>;
56
+ /**
57
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
58
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
59
+ * want to use something else.
60
+ * @returns {GraphQLClient} implementation
61
+ */
62
+ protected getGraphQLClient(): GraphQLClient;
63
+ }
64
+ //# sourceMappingURL=error-pages-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-pages-service.d.ts","sourceRoot":"","sources":["../../src/site/error-pages-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAuBhE;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE;QAAE,QAAQ,EAAE,iBAAiB,CAAA;KAAE,CAAC;IAC9C,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE;QAAE,QAAQ,EAAE,iBAAiB,CAAA;KAAE,CAAC;IACjD,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AASF;;;GAGG;AACH,qBAAa,iBAAiB;IAOT,OAAO,EAAE,uBAAuB;IANnD,OAAO,CAAC,aAAa,CAAgB;IAErC;;;OAGG;gBACgB,OAAO,EAAE,uBAAuB;IAInD,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IAED;;;;;;;OAOG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAqB7B;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAW5C"}
@@ -0,0 +1,10 @@
1
+ export { RobotsQueryResult, RobotsService, RobotsServiceConfig } from './robots-service';
2
+ export { RedirectInfo, RedirectsQueryResult, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_SERVER_TRANSFER, RedirectsService, RedirectsServiceConfig, } from './redirects-service';
3
+ export { SitemapQueryResult, SitemapXmlService, SitemapXmlServiceConfig, } from './sitemap-xml-service';
4
+ export { ErrorPages, ErrorPagesService, ErrorPagesServiceConfig } from './error-pages-service';
5
+ export { SiteInfoService, SiteInfoServiceConfig } from './siteinfo-service';
6
+ export { SitePathService, SitePathServiceConfig } from './sitepath-service';
7
+ export { SiteInfo } from './models';
8
+ export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SiteRewriteData, SITE_PREFIX, SITE_KEY, } from './utils';
9
+ export { SiteResolver } from './site-resolver';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/site/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Object model of Site Info result
3
+ * @public
4
+ */
5
+ export type SiteInfo = {
6
+ /**
7
+ * Additional user-defined properties
8
+ */
9
+ [key: string]: unknown;
10
+ /**
11
+ * Site name
12
+ */
13
+ name: string;
14
+ /**
15
+ * Site host name. May include multiple values (separated by '|') and wildcards ('*')
16
+ */
17
+ hostName: string;
18
+ /**
19
+ * Site default language
20
+ */
21
+ language: string;
22
+ };
23
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/site/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { GraphQLClient, GraphQLRequestClientFactory, CacheClient, CacheOptions, FetchOptions } from '@sitecore-content-sdk/core';
2
+ /**
3
+ * Redirect type for 301 redirects
4
+ * @public
5
+ */
6
+ export declare const REDIRECT_TYPE_301 = "REDIRECT_301";
7
+ /**
8
+ * Redirect type for 302 redirects
9
+ * @public
10
+ */
11
+ export declare const REDIRECT_TYPE_302 = "REDIRECT_302";
12
+ /**
13
+ * Redirect type for server transfer
14
+ * @public
15
+ */
16
+ export declare const REDIRECT_TYPE_SERVER_TRANSFER = "SERVER_TRANSFER";
17
+ /**
18
+ * Object model of Redirect Info result
19
+ * @public
20
+ */
21
+ export type RedirectInfo = {
22
+ pattern: string;
23
+ target: string;
24
+ redirectType: string;
25
+ isQueryStringPreserved: boolean;
26
+ isLanguagePreserved?: boolean;
27
+ locale: string;
28
+ };
29
+ /**
30
+ * Configuration for @see RedirectsService instances
31
+ * @public
32
+ */
33
+ export type RedirectsServiceConfig = CacheOptions & {
34
+ /**
35
+ * Override fetch method. Uses 'GraphQLRequestClient' default otherwise.
36
+ */
37
+ fetch?: typeof fetch;
38
+ /**
39
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
40
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
41
+ */
42
+ clientFactory: GraphQLRequestClientFactory;
43
+ };
44
+ /**
45
+ * The schema of data returned in response to redirects array request
46
+ * @public
47
+ */
48
+ export type RedirectsQueryResult = {
49
+ site: {
50
+ siteInfo: {
51
+ redirects: RedirectInfo[];
52
+ } | null;
53
+ };
54
+ };
55
+ /**
56
+ * The RedirectsService class is used to query the Content SDK redirects using Graphql endpoint
57
+ * @public
58
+ */
59
+ export declare class RedirectsService {
60
+ private options;
61
+ private graphQLClient;
62
+ private cache;
63
+ /**
64
+ * Creates an instance of graphQL redirects service with the provided options
65
+ * @param {RedirectsServiceConfig} options instance
66
+ */
67
+ constructor(options: RedirectsServiceConfig);
68
+ protected get query(): string;
69
+ /**
70
+ * Fetch an array of redirects from API
71
+ * @param {string} siteName site name
72
+ * @returns Promise<RedirectInfo[]>
73
+ * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
74
+ * @throws {Error} if the siteName is empty.
75
+ */
76
+ fetchRedirects(siteName: string, fetchOptions?: FetchOptions): Promise<RedirectInfo[]>;
77
+ /**
78
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
79
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
80
+ * want to use something else.
81
+ * @returns {GraphQLClient} implementation
82
+ */
83
+ protected getGraphQLClient(): GraphQLClient;
84
+ /**
85
+ * Gets cache client implementation
86
+ * Override this method if custom cache needs to be used
87
+ * @returns CacheClient instance
88
+ */
89
+ protected getCacheClient(): CacheClient<RedirectsQueryResult>;
90
+ }
91
+ //# sourceMappingURL=redirects-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirects-service.d.ts","sourceRoot":"","sources":["../../src/site/redirects-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,WAAW,EACX,YAAY,EAEZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AAIpC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,6BAA6B,oBAAoB,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAoBF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG;IAClD;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE;QAAE,QAAQ,EAAE;YAAE,SAAS,EAAE,YAAY,EAAE,CAAA;SAAE,GAAG,IAAI,CAAA;KAAE,CAAC;CAC1D,CAAC;AAEF;;;GAGG;AACH,qBAAa,gBAAgB;IAQf,OAAO,CAAC,OAAO;IAP3B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAAoC;IAEjD;;;OAGG;gBACiB,OAAO,EAAE,sBAAsB;IAKnD,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IAED;;;;;;OAMG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAsB5F;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;IAW3C;;;;OAIG;IACH,SAAS,CAAC,cAAc,IAAI,WAAW,CAAC,oBAAoB,CAAC;CAM9D"}
@@ -0,0 +1,57 @@
1
+ import { GraphQLRequestClientFactory } from '@sitecore-content-sdk/core';
2
+ import { FetchOptions, GraphQLClient } from '../client';
3
+ /**
4
+ * Configuration for @see RobotsService instances
5
+ * @public
6
+ */
7
+ export type RobotsServiceConfig = {
8
+ /**
9
+ * The Content SDK application name
10
+ */
11
+ siteName: string;
12
+ /**
13
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
14
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
15
+ */
16
+ clientFactory: GraphQLRequestClientFactory;
17
+ };
18
+ /**
19
+ * The schema of data returned in response to robots.txt request
20
+ * @public
21
+ */
22
+ export type RobotsQueryResult = {
23
+ site: {
24
+ siteInfo: {
25
+ robots: string;
26
+ };
27
+ };
28
+ };
29
+ /**
30
+ * Service that fetch the robots.txt data using Sitecore's GraphQL API.
31
+ * @public
32
+ */
33
+ export declare class RobotsService {
34
+ options: RobotsServiceConfig;
35
+ private graphQLClient;
36
+ /**
37
+ * Creates an instance of graphQL robots.txt service with the provided options
38
+ * @param {RobotsServiceConfig} options instance
39
+ */
40
+ constructor(options: RobotsServiceConfig);
41
+ protected get query(): string;
42
+ /**
43
+ * Fetch a data of robots.txt from API
44
+ * @param {FetchOptions} fetchOptions - The fetch options to be used for the request.
45
+ * @returns text of robots.txt
46
+ * @throws {Error} if the siteName is empty.
47
+ */
48
+ fetchRobots(fetchOptions?: FetchOptions): Promise<string>;
49
+ /**
50
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
51
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
52
+ * want to use something else.
53
+ * @returns {GraphQLClient} implementation
54
+ */
55
+ protected getGraphQLClient(): GraphQLClient;
56
+ }
57
+ //# sourceMappingURL=robots-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"robots-service.d.ts","sourceRoot":"","sources":["../../src/site/robots-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAexD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE;QAAE,QAAQ,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,CAAC;AAE3E;;;GAGG;AACH,qBAAa,aAAa;IAOL,OAAO,EAAE,mBAAmB;IAN/C,OAAO,CAAC,aAAa,CAAgB;IAErC;;;OAGG;gBACgB,OAAO,EAAE,mBAAmB;IAI/C,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IAED;;;;;OAKG;IACG,WAAW,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB/D;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAS5C"}
@@ -0,0 +1,28 @@
1
+ import { SiteInfo } from './models';
2
+ /**
3
+ * Resolves site based on the provided host or site name
4
+ * @public
5
+ */
6
+ export declare class SiteResolver {
7
+ readonly sites: SiteInfo[];
8
+ /**
9
+ * @param {SiteInfo[]} sites Array of sites to be used in resolution
10
+ */
11
+ constructor(sites: SiteInfo[]);
12
+ /**
13
+ * Resolve site by host name
14
+ * @param {string} hostName the host name
15
+ * @returns {SiteInfo} the resolved site
16
+ * @throws {Error} if a matching site is not found
17
+ */
18
+ getByHost: (hostName: string) => SiteInfo;
19
+ /**
20
+ * Resolve site by site name
21
+ * @param {string} siteName the site name
22
+ * @returns {SiteInfo} the resolved site or undefined if not found
23
+ */
24
+ getByName: (siteName: string) => SiteInfo | undefined;
25
+ protected getHostMap: () => Map<string, SiteInfo>;
26
+ protected matchesPattern(hostname: string, pattern: string): boolean;
27
+ }
28
+ //# sourceMappingURL=site-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site-resolver.d.ts","sourceRoot":"","sources":["../../src/site/site-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKpC;;;GAGG;AACH,qBAAa,YAAY;IAIX,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE;IAHtC;;OAEG;gBACkB,KAAK,EAAE,QAAQ,EAAE;IAEtC;;;;;OAKG;IACI,SAAS,GAAI,UAAU,MAAM,KAAG,QAAQ,CAO7C;IAEF;;;;OAIG;IACI,SAAS,GAAI,UAAU,MAAM,0BAMlC;IAEF,SAAS,CAAC,UAAU,QAAO,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CA2B9C;IAEF,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;CASrE"}
@@ -0,0 +1,64 @@
1
+ import { FetchOptions, GraphQLClient } from '@sitecore-content-sdk/core';
2
+ import { GraphQLRequestClientFactory, CacheClient, CacheOptions } from '@sitecore-content-sdk/core';
3
+ import { SiteInfo } from './models';
4
+ /**
5
+ * Configuration for @see SiteInfoService instances
6
+ * @public
7
+ */
8
+ export type SiteInfoServiceConfig = CacheOptions & {
9
+ /**
10
+ * common variable for all GraphQL queries
11
+ * it will be used for every type of query to regulate result batch size
12
+ * Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
13
+ * @default 10
14
+ */
15
+ pageSize?: number;
16
+ /**
17
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
18
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
19
+ */
20
+ clientFactory: GraphQLRequestClientFactory;
21
+ };
22
+ /**
23
+ * Object model of Site Info result
24
+ * @public
25
+ */
26
+ export type GraphQLSiteInfoResult = {
27
+ name: string;
28
+ hostName: string;
29
+ language: string;
30
+ };
31
+ /**
32
+ * Service to fetch site information
33
+ * @public
34
+ */
35
+ export declare class SiteInfoService {
36
+ private config;
37
+ private graphQLClient;
38
+ private cache;
39
+ /**
40
+ * Creates an instance of graphQL service to retrieve site configuration list from Sitecore
41
+ * @param {SiteInfoServiceConfig} config instance
42
+ */
43
+ constructor(config: SiteInfoServiceConfig);
44
+ /**
45
+ * site query is available on XM Cloud and XP 10.4+
46
+ */
47
+ protected get siteQuery(): string;
48
+ fetchSiteInfo(fetchOptions?: FetchOptions): Promise<SiteInfo[]>;
49
+ /**
50
+ * Gets cache client implementation
51
+ * Override this method if custom cache needs to be used
52
+ * @returns CacheClient instance
53
+ */
54
+ protected getCacheClient(): CacheClient<SiteInfo[]>;
55
+ /**
56
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
57
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
58
+ * want to use something else.
59
+ * @returns {GraphQLClient} implementation
60
+ */
61
+ protected getGraphQLClient(): GraphQLClient;
62
+ private getCacheKey;
63
+ }
64
+ //# sourceMappingURL=siteinfo-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"siteinfo-service.d.ts","sourceRoot":"","sources":["../../src/site/siteinfo-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,YAAY,EAAqB,MAAM,4BAA4B,CAAC;AAEvH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAcpC;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C,CAAC;AAQF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,qBAAa,eAAe;IAQd,OAAO,CAAC,MAAM;IAP1B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAA0B;IAEvC;;;OAGG;gBACiB,MAAM,EAAE,qBAAqB;IAKjD;;OAEG;IACH,SAAS,KAAK,SAAS,IAAI,MAAM,CAEhC;IAEK,aAAa,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IA8BrE;;;;OAIG;IACH,SAAS,CAAC,cAAc,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;IAOnD;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;IAU3C,OAAO,CAAC,WAAW;CAGpB"}
@@ -0,0 +1,63 @@
1
+ import { FetchOptions, GraphQLClient } from '../client';
2
+ import { GraphQLRequestClientFactory } from '@sitecore-content-sdk/core';
3
+ /**
4
+ * Configuration for @see SitemapXmlService instances
5
+ * @public
6
+ */
7
+ export type SitemapXmlServiceConfig = {
8
+ /**
9
+ * The Content SDK application name
10
+ */
11
+ siteName: string;
12
+ /**
13
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
14
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
15
+ */
16
+ clientFactory: GraphQLRequestClientFactory;
17
+ };
18
+ /**
19
+ * The schema of data returned in response to sitemaps request
20
+ * @public
21
+ */
22
+ export type SitemapQueryResult = {
23
+ site: {
24
+ siteInfo: {
25
+ sitemap: string[];
26
+ };
27
+ };
28
+ };
29
+ /**
30
+ * Service that fetch the sitemaps data using Sitecore's GraphQL API.
31
+ * @public
32
+ */
33
+ export declare class SitemapXmlService {
34
+ options: SitemapXmlServiceConfig;
35
+ private graphQLClient;
36
+ /**
37
+ * Creates an instance of graphQL sitemaps service with the provided options
38
+ * @param {SitemapXmlServiceConfig} options instance
39
+ */
40
+ constructor(options: SitemapXmlServiceConfig);
41
+ protected get query(): string;
42
+ /**
43
+ * Fetch list of sitemaps for the site
44
+ * @returns {string[]} list of sitemap paths
45
+ * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
46
+ * @throws {Error} if the siteName is empty.
47
+ */
48
+ fetchSitemaps(fetchOptions?: FetchOptions): Promise<string[]>;
49
+ /**
50
+ * Get sitemap file path for sitemap id
51
+ * @param {string} id the sitemap id (can be empty for default 'sitemap.xml' file)
52
+ * @returns {string | undefined} the sitemap file path or undefined if one doesn't exist
53
+ */
54
+ getSitemap(id: string): Promise<string | undefined>;
55
+ /**
56
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
57
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
58
+ * want to use something else.
59
+ * @returns {GraphQLClient} implementation
60
+ */
61
+ protected getGraphQLClient(): GraphQLClient;
62
+ }
63
+ //# sourceMappingURL=sitemap-xml-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap-xml-service.d.ts","sourceRoot":"","sources":["../../src/site/sitemap-xml-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAiBzE;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE;QAAE,QAAQ,EAAE;YAAE,OAAO,EAAE,MAAM,EAAE,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,CAAC;AAE/E;;;GAGG;AACH,qBAAa,iBAAiB;IAOT,OAAO,EAAE,uBAAuB;IANnD,OAAO,CAAC,aAAa,CAAgB;IAErC;;;OAGG;gBACgB,OAAO,EAAE,uBAAuB;IAInD,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IAED;;;;;OAKG;IACG,aAAa,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAqBnE;;;;OAIG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAiBzD;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAS5C"}
@@ -0,0 +1,137 @@
1
+ import { FetchOptions, GraphQLClient, GraphQLRequestClientFactory, PageInfo } from '../client';
2
+ import { StaticPath } from '../models';
3
+ /** @private */
4
+ export declare const languageError = "The list of languages cannot be empty";
5
+ export declare const siteError = "The service needs a site name";
6
+ export declare const sitesError = "The list of sites cannot be empty";
7
+ /**
8
+ * @param {string} siteName to inject into error text
9
+ * @private
10
+ */
11
+ export declare function getSiteEmptyError(siteName: string): string;
12
+ /**
13
+ * type for input variables for the site routes query
14
+ */
15
+ interface SiteRouteQueryVariables {
16
+ /**
17
+ * Required. Name of a site to fetch sitemap for
18
+ */
19
+ siteName: string;
20
+ /**
21
+ * Required. The language to return routes/pages for.
22
+ */
23
+ language: string;
24
+ /**
25
+ * Optional. Only paths starting with these provided prefixes will be returned.
26
+ */
27
+ includedPaths?: string[];
28
+ /**
29
+ * Optional. Paths starting with these provided prefixes will be excluded from returned results.
30
+ */
31
+ excludedPaths?: string[];
32
+ /**
33
+ * common variable for all GraphQL queries
34
+ * it will be used for every type of query to regulate result batch size
35
+ * Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
36
+ * @default 100
37
+ */
38
+ pageSize?: number;
39
+ }
40
+ /**
41
+ * Schema of data returned in response to a "site" query request
42
+ * @template T The type of objects being requested.
43
+ */
44
+ export interface SiteRouteQueryResult<T> {
45
+ site: {
46
+ siteInfo: {
47
+ routes: {
48
+ /**
49
+ * Data needed to paginate the site results
50
+ */
51
+ pageInfo: PageInfo;
52
+ results: T[];
53
+ };
54
+ };
55
+ };
56
+ }
57
+ /**
58
+ * The schema of data returned in response to a routes list query request
59
+ */
60
+ export type RouteListQueryResult = {
61
+ path: string;
62
+ route?: {
63
+ personalization?: {
64
+ variantIds: string[];
65
+ };
66
+ };
67
+ };
68
+ /**
69
+ * Configuration options for @see SitePathService instances
70
+ * @public
71
+ */
72
+ export interface SitePathServiceConfig extends Omit<SiteRouteQueryVariables, 'language' | 'siteName'> {
73
+ /**
74
+ * A flag for whether to include personalized routes in service output.
75
+ * Only works on XM Cloud for pages using Embedded Personalization (not Component A/B testing).
76
+ * Turned off by default.
77
+ */
78
+ includePersonalizedRoutes?: boolean;
79
+ /**
80
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
81
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
82
+ */
83
+ clientFactory: GraphQLRequestClientFactory;
84
+ }
85
+ /**
86
+ * Service that fetches the list of site pages using Sitecore's GraphQL API.
87
+ * Used to handle a single site
88
+ * This list is used for SSG and Export functionality.
89
+ * @mixes SearchQueryService<PageListQueryResult>
90
+ * @public
91
+ */
92
+ export declare class SitePathService {
93
+ options: SitePathServiceConfig;
94
+ private _graphQLClient;
95
+ /**
96
+ * Creates an instance of graphQL sitemap service with the provided options
97
+ * @param {SitePathServiceConfig} options instance
98
+ */
99
+ constructor(options: SitePathServiceConfig);
100
+ /**
101
+ * GraphQL client accessible by descendant classes when needed
102
+ */
103
+ protected get graphQLClient(): GraphQLClient;
104
+ /**
105
+ * Gets the default query used for fetching the list of site pages
106
+ */
107
+ protected get query(): string;
108
+ /**
109
+ * Fetch a flat list of all pages that belong to all the requested sites and have a
110
+ * version in the specified language(s).
111
+ * @param {string[]} sites Fetch pages for these sites.
112
+ * @param {string[]} languages Fetch pages that have versions in this language(s).
113
+ * @param {FetchOptions} fetchOptions Options to override graphQL client details like retries and fetch implementation
114
+ * @returns list of pages
115
+ * @throws {RangeError} if the list of languages is empty.
116
+ * @throws {RangeError} if the any of the languages is an empty string.
117
+ */
118
+ fetchSiteRoutes(sites: string[], languages: string[], fetchOptions?: FetchOptions): Promise<StaticPath[]>;
119
+ protected transformLanguageSitePaths(sitePaths: RouteListQueryResult[], formatStaticPath: (path: string[], language: string) => StaticPath, language: string): Promise<StaticPath[]>;
120
+ /**
121
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
122
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
123
+ * want to use something else.
124
+ * @returns {GraphQLClient} implementation
125
+ */
126
+ protected getGraphQLClient(): GraphQLClient;
127
+ /**
128
+ * Fetch and return site paths for multisite implementation, with prefixes included
129
+ * @param {string} language path language
130
+ * @param {string} siteName site name
131
+ * @param {FetchOptions} fetchOptions Options to override graphQL client details like retries and fetch implementation
132
+ * @returns modified paths
133
+ */
134
+ protected fetchLanguageSitePaths(language: string, siteName: string, fetchOptions?: FetchOptions): Promise<RouteListQueryResult[]>;
135
+ }
136
+ export {};
137
+ //# sourceMappingURL=sitepath-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitepath-service.d.ts","sourceRoot":"","sources":["../../src/site/sitepath-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAKvC,eAAe;AACf,eAAO,MAAM,aAAa,0CAA0C,CAAC;AACrE,eAAO,MAAM,SAAS,kCAAkC,CAAC;AACzD,eAAO,MAAM,UAAU,sCAAsC,CAAC;AAE9D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,UAEjD;AAgDD;;GAEG;AACH,UAAU,uBAAuB;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,IAAI,EAAE;QACJ,QAAQ,EAAE;YACR,MAAM,EAAE;gBACN;;mBAEG;gBACH,QAAQ,EAAE,QAAQ,CAAC;gBACnB,OAAO,EAAE,CAAC,EAAE,CAAC;aACd,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE;QACN,eAAe,CAAC,EAAE;YAChB,UAAU,EAAE,MAAM,EAAE,CAAC;SACtB,CAAC;KACH,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,uBAAuB,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9D;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C;AAED;;;;;;GAMG;AACH,qBAAa,eAAe;IAOP,OAAO,EAAE,qBAAqB;IANjD,OAAO,CAAC,cAAc,CAAgB;IAEtC;;;OAGG;gBACgB,OAAO,EAAE,qBAAqB;IAIjD;;OAEG;IACH,SAAS,KAAK,aAAa,kBAE1B;IAED;;OAEG;IACH,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IAED;;;;;;;;;OASG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,UAAU,EAAE,CAAC;cAkCR,0BAA0B,CACxC,SAAS,EAAE,oBAAoB,EAAE,EACjC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,KAAK,UAAU,EAClE,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,EAAE,CAAC;IA6BxB;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;IAU3C;;;;;;OAMG;cACa,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAwCnC"}