@sitecore-content-sdk/core 1.3.0-canary.9 → 1.4.0-canary.2

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 (342) hide show
  1. package/README.md +7 -7
  2. package/dist/cjs/cache-client.js +55 -54
  3. package/dist/cjs/client/constants.js +7 -7
  4. package/dist/cjs/client/edge-proxy.js +24 -22
  5. package/dist/cjs/client/index.js +15 -15
  6. package/dist/cjs/client/models.js +2 -2
  7. package/dist/cjs/client/sitecore-client.js +421 -419
  8. package/dist/cjs/client/utils.js +47 -46
  9. package/dist/cjs/config/define-config.js +194 -193
  10. package/dist/cjs/config/index.js +7 -7
  11. package/dist/cjs/config/models.js +12 -11
  12. package/dist/cjs/config-cli/define-cli-config.js +23 -22
  13. package/dist/cjs/config-cli/index.js +7 -7
  14. package/dist/cjs/config-cli/models.js +8 -7
  15. package/dist/cjs/constants.js +49 -17
  16. package/dist/cjs/debug.js +48 -46
  17. package/dist/cjs/editing/codegen/index.js +14 -9
  18. package/dist/cjs/editing/codegen/preview.js +277 -193
  19. package/dist/cjs/editing/component-layout-service.js +62 -61
  20. package/dist/cjs/editing/design-library.js +183 -126
  21. package/dist/cjs/editing/editing-service.js +75 -74
  22. package/dist/cjs/editing/index.js +33 -27
  23. package/dist/cjs/editing/metadata.js +42 -42
  24. package/dist/cjs/editing/models.js +44 -38
  25. package/dist/cjs/editing/utils.js +108 -90
  26. package/dist/cjs/form/form.js +81 -78
  27. package/dist/cjs/form/index.js +7 -7
  28. package/dist/cjs/graphql-request-client.js +108 -107
  29. package/dist/cjs/i18n/dictionary-service.js +122 -121
  30. package/dist/cjs/i18n/index.js +7 -7
  31. package/dist/cjs/i18n/utils.js +16 -15
  32. package/dist/cjs/index.js +60 -60
  33. package/dist/cjs/layout/content-styles.js +72 -71
  34. package/dist/cjs/layout/index.js +24 -24
  35. package/dist/cjs/layout/layout-service.js +62 -57
  36. package/dist/cjs/layout/models.js +39 -34
  37. package/dist/cjs/layout/themes.js +76 -75
  38. package/dist/cjs/layout/utils.js +117 -110
  39. package/dist/cjs/media/index.js +38 -38
  40. package/dist/cjs/media/media-api.js +100 -96
  41. package/dist/cjs/models.js +2 -2
  42. package/dist/cjs/native-fetcher.js +194 -179
  43. package/dist/cjs/personalize/index.js +15 -15
  44. package/dist/cjs/personalize/layout-personalizer.js +98 -97
  45. package/dist/cjs/personalize/personalize-service.js +98 -94
  46. package/dist/cjs/personalize/utils.js +143 -136
  47. package/dist/cjs/retries.js +43 -42
  48. package/dist/cjs/site/error-pages-service.js +65 -64
  49. package/dist/cjs/site/index.js +26 -26
  50. package/dist/cjs/site/models.js +2 -2
  51. package/dist/cjs/site/redirects-service.js +94 -81
  52. package/dist/cjs/site/robots-service.js +66 -65
  53. package/dist/cjs/site/site-resolver.js +73 -72
  54. package/dist/cjs/site/siteinfo-service.js +84 -80
  55. package/dist/cjs/site/sitemap-xml-service.js +84 -83
  56. package/dist/cjs/site/sitepath-service.js +165 -164
  57. package/dist/cjs/site/utils.js +55 -47
  58. package/dist/cjs/sitecore-service-base.js +36 -36
  59. package/dist/cjs/tools/auth/flow.js +65 -64
  60. package/dist/cjs/tools/auth/index.js +5 -5
  61. package/dist/cjs/tools/auth/models.js +2 -2
  62. package/dist/cjs/tools/auth/tenant-store.js +38 -38
  63. package/dist/cjs/tools/codegen/component-generation.js +52 -50
  64. package/dist/cjs/tools/codegen/extract-files.js +105 -107
  65. package/dist/cjs/tools/codegen/import-map.js +401 -349
  66. package/dist/cjs/tools/codegen/utils.js +418 -418
  67. package/dist/cjs/tools/generate-map.js +2 -2
  68. package/dist/cjs/tools/generateMetadata.js +36 -35
  69. package/dist/cjs/tools/generateSites.js +59 -58
  70. package/dist/cjs/tools/index.js +75 -73
  71. package/dist/cjs/tools/scaffold.js +60 -59
  72. package/dist/cjs/tools/templating/components.js +96 -266
  73. package/dist/cjs/tools/templating/index.js +11 -14
  74. package/dist/cjs/tools/templating/plugins.js +80 -78
  75. package/dist/cjs/tools/templating/utils.js +67 -66
  76. package/dist/cjs/utils/ensurePath.js +20 -20
  77. package/dist/cjs/utils/env.js +28 -27
  78. package/dist/cjs/utils/globalCache.js +55 -0
  79. package/dist/cjs/utils/index.js +26 -21
  80. package/dist/cjs/utils/is-server.js +11 -10
  81. package/dist/cjs/utils/normalize-url.js +5 -5
  82. package/dist/cjs/utils/timeout-promise.js +31 -31
  83. package/dist/cjs/utils/utils.js +254 -229
  84. package/dist/esm/cache-client.js +51 -50
  85. package/dist/esm/client/constants.js +4 -4
  86. package/dist/esm/client/edge-proxy.js +19 -17
  87. package/dist/esm/client/index.js +5 -5
  88. package/dist/esm/client/models.js +1 -1
  89. package/dist/esm/client/sitecore-client.js +414 -412
  90. package/dist/esm/client/utils.js +43 -42
  91. package/dist/esm/config/define-config.js +188 -187
  92. package/dist/esm/config/index.js +2 -2
  93. package/dist/esm/config/models.js +9 -8
  94. package/dist/esm/config-cli/define-cli-config.js +19 -18
  95. package/dist/esm/config-cli/index.js +2 -2
  96. package/dist/esm/config-cli/models.js +5 -4
  97. package/dist/esm/constants.js +46 -14
  98. package/dist/esm/debug.js +41 -39
  99. package/dist/esm/editing/codegen/index.js +1 -1
  100. package/dist/esm/editing/codegen/preview.js +263 -185
  101. package/dist/esm/editing/component-layout-service.js +55 -54
  102. package/dist/esm/editing/design-library.js +171 -117
  103. package/dist/esm/editing/editing-service.js +68 -67
  104. package/dist/esm/editing/index.js +6 -5
  105. package/dist/esm/editing/metadata.js +39 -39
  106. package/dist/esm/editing/models.js +41 -35
  107. package/dist/esm/editing/utils.js +98 -80
  108. package/dist/esm/form/form.js +72 -69
  109. package/dist/esm/form/index.js +1 -1
  110. package/dist/esm/graphql-request-client.js +101 -100
  111. package/dist/esm/i18n/dictionary-service.js +115 -114
  112. package/dist/esm/i18n/index.js +2 -2
  113. package/dist/esm/i18n/utils.js +13 -12
  114. package/dist/esm/index.js +13 -13
  115. package/dist/esm/layout/content-styles.js +64 -63
  116. package/dist/esm/layout/index.js +6 -6
  117. package/dist/esm/layout/layout-service.js +55 -50
  118. package/dist/esm/layout/models.js +36 -31
  119. package/dist/esm/layout/themes.js +71 -70
  120. package/dist/esm/layout/utils.js +109 -102
  121. package/dist/esm/media/index.js +2 -2
  122. package/dist/esm/media/media-api.js +90 -86
  123. package/dist/esm/models.js +1 -1
  124. package/dist/esm/native-fetcher.js +187 -172
  125. package/dist/esm/personalize/index.js +3 -3
  126. package/dist/esm/personalize/layout-personalizer.js +93 -92
  127. package/dist/esm/personalize/personalize-service.js +91 -87
  128. package/dist/esm/personalize/utils.js +135 -128
  129. package/dist/esm/retries.js +39 -38
  130. package/dist/esm/site/error-pages-service.js +58 -57
  131. package/dist/esm/site/index.js +8 -8
  132. package/dist/esm/site/models.js +1 -1
  133. package/dist/esm/site/redirects-service.js +87 -74
  134. package/dist/esm/site/robots-service.js +59 -58
  135. package/dist/esm/site/site-resolver.js +69 -68
  136. package/dist/esm/site/siteinfo-service.js +77 -73
  137. package/dist/esm/site/sitemap-xml-service.js +77 -76
  138. package/dist/esm/site/sitepath-service.js +157 -156
  139. package/dist/esm/site/utils.js +49 -41
  140. package/dist/esm/sitecore-service-base.js +29 -29
  141. package/dist/esm/tools/auth/flow.js +62 -61
  142. package/dist/esm/tools/auth/index.js +1 -1
  143. package/dist/esm/tools/auth/models.js +1 -1
  144. package/dist/esm/tools/auth/tenant-store.js +35 -35
  145. package/dist/esm/tools/codegen/component-generation.js +44 -42
  146. package/dist/esm/tools/codegen/extract-files.js +99 -101
  147. package/dist/esm/tools/codegen/import-map.js +358 -306
  148. package/dist/esm/tools/codegen/utils.js +373 -373
  149. package/dist/esm/tools/generate-map.js +1 -1
  150. package/dist/esm/tools/generateMetadata.js +29 -28
  151. package/dist/esm/tools/generateSites.js +52 -51
  152. package/dist/esm/tools/index.js +28 -27
  153. package/dist/esm/tools/scaffold.js +52 -51
  154. package/dist/esm/tools/templating/components.js +59 -223
  155. package/dist/esm/tools/templating/index.js +3 -3
  156. package/dist/esm/tools/templating/plugins.js +72 -70
  157. package/dist/esm/tools/templating/utils.js +59 -58
  158. package/dist/esm/utils/ensurePath.js +13 -13
  159. package/dist/esm/utils/env.js +24 -23
  160. package/dist/esm/utils/globalCache.js +49 -0
  161. package/dist/esm/utils/index.js +4 -3
  162. package/dist/esm/utils/is-server.js +9 -8
  163. package/dist/esm/utils/normalize-url.js +1 -1
  164. package/dist/esm/utils/timeout-promise.js +28 -28
  165. package/dist/esm/utils/utils.js +238 -213
  166. package/package.json +73 -5
  167. package/types/cache-client.d.ts +68 -64
  168. package/types/cache-client.d.ts.map +1 -0
  169. package/types/client/constants.d.ts +5 -4
  170. package/types/client/constants.d.ts.map +1 -0
  171. package/types/client/edge-proxy.d.ts +18 -15
  172. package/types/client/edge-proxy.d.ts.map +1 -0
  173. package/types/client/index.d.ts +8 -7
  174. package/types/client/index.d.ts.map +1 -0
  175. package/types/client/models.d.ts +21 -19
  176. package/types/client/models.d.ts.map +1 -0
  177. package/types/client/sitecore-client.d.ts +338 -327
  178. package/types/client/sitecore-client.d.ts.map +1 -0
  179. package/types/client/utils.d.ts +15 -9
  180. package/types/client/utils.d.ts.map +1 -0
  181. package/types/config/define-config.d.ts +20 -18
  182. package/types/config/define-config.d.ts.map +1 -0
  183. package/types/config/index.d.ts +3 -2
  184. package/types/config/index.d.ts.map +1 -0
  185. package/types/config/models.d.ts +287 -268
  186. package/types/config/models.d.ts.map +1 -0
  187. package/types/config-cli/define-cli-config.d.ts +9 -7
  188. package/types/config-cli/define-cli-config.d.ts.map +1 -0
  189. package/types/config-cli/index.d.ts +3 -2
  190. package/types/config-cli/index.d.ts.map +1 -0
  191. package/types/config-cli/models.d.ts +6 -4
  192. package/types/config-cli/models.d.ts.map +1 -0
  193. package/types/constants.d.ts +44 -11
  194. package/types/constants.d.ts.map +1 -0
  195. package/types/debug.d.ts +35 -28
  196. package/types/debug.d.ts.map +1 -0
  197. package/types/editing/codegen/index.d.ts +2 -1
  198. package/types/editing/codegen/index.d.ts.map +1 -0
  199. package/types/editing/codegen/preview.d.ts +256 -195
  200. package/types/editing/codegen/preview.d.ts.map +1 -0
  201. package/types/editing/component-layout-service.d.ts +84 -80
  202. package/types/editing/component-layout-service.d.ts.map +1 -0
  203. package/types/editing/design-library.d.ts +111 -63
  204. package/types/editing/design-library.d.ts.map +1 -0
  205. package/types/editing/editing-service.d.ts +72 -62
  206. package/types/editing/editing-service.d.ts.map +1 -0
  207. package/types/editing/index.d.ts +7 -6
  208. package/types/editing/index.d.ts.map +1 -0
  209. package/types/editing/metadata.d.ts +8 -7
  210. package/types/editing/metadata.d.ts.map +1 -0
  211. package/types/editing/models.d.ts +103 -92
  212. package/types/editing/models.d.ts.map +1 -0
  213. package/types/editing/utils.d.ts +91 -74
  214. package/types/editing/utils.d.ts.map +1 -0
  215. package/types/form/form.d.ts +25 -21
  216. package/types/form/form.d.ts.map +1 -0
  217. package/types/form/index.d.ts +2 -1
  218. package/types/form/index.d.ts.map +1 -0
  219. package/types/graphql-request-client.d.ts +112 -105
  220. package/types/graphql-request-client.d.ts.map +1 -0
  221. package/types/i18n/dictionary-service.d.ts +135 -131
  222. package/types/i18n/dictionary-service.d.ts.map +1 -0
  223. package/types/i18n/index.d.ts +3 -2
  224. package/types/i18n/index.d.ts.map +1 -0
  225. package/types/i18n/utils.d.ts +9 -7
  226. package/types/i18n/utils.d.ts.map +1 -0
  227. package/types/index.d.ts +13 -12
  228. package/types/index.d.ts.map +1 -0
  229. package/types/layout/content-styles.d.ts +20 -18
  230. package/types/layout/content-styles.d.ts.map +1 -0
  231. package/types/layout/index.d.ts +6 -5
  232. package/types/layout/index.d.ts.map +1 -0
  233. package/types/layout/layout-service.d.ts +45 -35
  234. package/types/layout/layout-service.d.ts.map +1 -0
  235. package/types/layout/models.d.ts +174 -151
  236. package/types/layout/models.d.ts.map +1 -0
  237. package/types/layout/themes.d.ts +13 -11
  238. package/types/layout/themes.d.ts.map +1 -0
  239. package/types/layout/utils.d.ts +56 -41
  240. package/types/layout/utils.d.ts.map +1 -0
  241. package/types/media/index.d.ts +3 -2
  242. package/types/media/index.d.ts.map +1 -0
  243. package/types/media/media-api.d.ts +60 -55
  244. package/types/media/media-api.d.ts.map +1 -0
  245. package/types/models.d.ts +94 -84
  246. package/types/models.d.ts.map +1 -0
  247. package/types/native-fetcher.d.ts +124 -114
  248. package/types/native-fetcher.d.ts.map +1 -0
  249. package/types/personalize/index.d.ts +4 -3
  250. package/types/personalize/index.d.ts.map +1 -0
  251. package/types/personalize/layout-personalizer.d.ts +29 -27
  252. package/types/personalize/layout-personalizer.d.ts.map +1 -0
  253. package/types/personalize/personalize-service.d.ts +90 -80
  254. package/types/personalize/personalize-service.d.ts.map +1 -0
  255. package/types/personalize/utils.d.ts +78 -69
  256. package/types/personalize/utils.d.ts.map +1 -0
  257. package/types/retries.d.ts +26 -24
  258. package/types/retries.d.ts.map +1 -0
  259. package/types/site/error-pages-service.d.ts +64 -57
  260. package/types/site/error-pages-service.d.ts.map +1 -0
  261. package/types/site/index.d.ts +10 -9
  262. package/types/site/index.d.ts.map +1 -0
  263. package/types/site/models.d.ts +23 -18
  264. package/types/site/models.d.ts.map +1 -0
  265. package/types/site/redirects-service.d.ts +92 -69
  266. package/types/site/redirects-service.d.ts.map +1 -0
  267. package/types/site/robots-service.d.ts +57 -50
  268. package/types/site/robots-service.d.ts.map +1 -0
  269. package/types/site/site-resolver.d.ts +28 -26
  270. package/types/site/site-resolver.d.ts.map +1 -0
  271. package/types/site/siteinfo-service.d.ts +65 -52
  272. package/types/site/siteinfo-service.d.ts.map +1 -0
  273. package/types/site/sitemap-xml-service.d.ts +63 -56
  274. package/types/site/sitemap-xml-service.d.ts.map +1 -0
  275. package/types/site/sitepath-service.d.ts +137 -134
  276. package/types/site/sitepath-service.d.ts.map +1 -0
  277. package/types/site/utils.d.ts +41 -28
  278. package/types/site/utils.d.ts.map +1 -0
  279. package/types/sitecore-service-base.d.ts +31 -30
  280. package/types/sitecore-service-base.d.ts.map +1 -0
  281. package/types/tools/auth/flow.d.ts +29 -27
  282. package/types/tools/auth/flow.d.ts.map +1 -0
  283. package/types/tools/auth/index.d.ts +2 -1
  284. package/types/tools/auth/index.d.ts.map +1 -0
  285. package/types/tools/auth/models.d.ts +35 -33
  286. package/types/tools/auth/models.d.ts.map +1 -0
  287. package/types/tools/auth/tenant-store.d.ts +12 -11
  288. package/types/tools/auth/tenant-store.d.ts.map +1 -0
  289. package/types/tools/codegen/component-generation.d.ts +50 -47
  290. package/types/tools/codegen/component-generation.d.ts.map +1 -0
  291. package/types/tools/codegen/extract-files.d.ts +24 -22
  292. package/types/tools/codegen/extract-files.d.ts.map +1 -0
  293. package/types/tools/codegen/import-map.d.ts +103 -70
  294. package/types/tools/codegen/import-map.d.ts.map +1 -0
  295. package/types/tools/codegen/utils.d.ts +76 -75
  296. package/types/tools/codegen/utils.d.ts.map +1 -0
  297. package/types/tools/generate-map.d.ts +36 -26
  298. package/types/tools/generate-map.d.ts.map +1 -0
  299. package/types/tools/generateMetadata.d.ts +24 -22
  300. package/types/tools/generateMetadata.d.ts.map +1 -0
  301. package/types/tools/generateSites.d.ts +25 -22
  302. package/types/tools/generateSites.d.ts.map +1 -0
  303. package/types/tools/index.d.ts +22 -20
  304. package/types/tools/index.d.ts.map +1 -0
  305. package/types/tools/scaffold.d.ts +27 -25
  306. package/types/tools/scaffold.d.ts.map +1 -0
  307. package/types/tools/templating/components.d.ts +104 -103
  308. package/types/tools/templating/components.d.ts.map +1 -0
  309. package/types/tools/templating/index.d.ts +4 -3
  310. package/types/tools/templating/index.d.ts.map +1 -0
  311. package/types/tools/templating/plugins.d.ts +71 -67
  312. package/types/tools/templating/plugins.d.ts.map +1 -0
  313. package/types/tools/templating/utils.d.ts +42 -40
  314. package/types/tools/templating/utils.d.ts.map +1 -0
  315. package/types/utils/ensurePath.d.ts +7 -6
  316. package/types/utils/ensurePath.d.ts.map +1 -0
  317. package/types/utils/env.d.ts +9 -7
  318. package/types/utils/env.d.ts.map +1 -0
  319. package/types/utils/globalCache.d.ts +37 -0
  320. package/types/utils/globalCache.d.ts.map +1 -0
  321. package/types/utils/index.d.ts +5 -3
  322. package/types/utils/index.d.ts.map +1 -0
  323. package/types/utils/is-server.d.ts +8 -6
  324. package/types/utils/is-server.d.ts.map +1 -0
  325. package/types/utils/normalize-url.d.ts +2 -1
  326. package/types/utils/normalize-url.d.ts.map +1 -0
  327. package/types/utils/timeout-promise.d.ts +18 -17
  328. package/types/utils/timeout-promise.d.ts.map +1 -0
  329. package/types/utils/utils.d.ts +104 -79
  330. package/types/utils/utils.d.ts.map +1 -0
  331. package/client.js +0 -1
  332. package/codegen.js +0 -1
  333. package/config-cli.js +0 -1
  334. package/config.js +0 -1
  335. package/editing.js +0 -1
  336. package/i18n.js +0 -1
  337. package/layout.js +0 -1
  338. package/media.js +0 -1
  339. package/personalize.js +0 -1
  340. package/site.js +0 -1
  341. package/tools.js +0 -1
  342. package/utils.js +0 -1
@@ -1,18 +1,23 @@
1
- export type SiteInfo = {
2
- /**
3
- * Additional user-defined properties
4
- */
5
- [key: string]: unknown;
6
- /**
7
- * Site name
8
- */
9
- name: string;
10
- /**
11
- * Site host name. May include multiple values (separated by '|') and wildcards ('*')
12
- */
13
- hostName: string;
14
- /**
15
- * Site default language
16
- */
17
- language: string;
18
- };
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"}
@@ -1,69 +1,92 @@
1
- import { FetchOptions, GraphQLClient } from '../client';
2
- import { CacheOptions, CacheClient } from '../cache-client';
3
- import { GraphQLRequestClientFactory } from '../graphql-request-client';
4
- export declare const REDIRECT_TYPE_301 = "REDIRECT_301";
5
- export declare const REDIRECT_TYPE_302 = "REDIRECT_302";
6
- export declare const REDIRECT_TYPE_SERVER_TRANSFER = "SERVER_TRANSFER";
7
- export type RedirectInfo = {
8
- pattern: string;
9
- target: string;
10
- redirectType: string;
11
- isQueryStringPreserved: boolean;
12
- locale: string;
13
- };
14
- export type RedirectsServiceConfig = CacheOptions & {
15
- /**
16
- * Override fetch method. Uses 'GraphQLRequestClient' default otherwise.
17
- */
18
- fetch?: typeof fetch;
19
- /**
20
- * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
21
- * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
22
- */
23
- clientFactory: GraphQLRequestClientFactory;
24
- };
25
- /**
26
- * The schema of data returned in response to redirects array request
27
- */
28
- export type RedirectsQueryResult = {
29
- site: {
30
- siteInfo: {
31
- redirects: RedirectInfo[];
32
- } | null;
33
- };
34
- };
35
- /**
36
- * The RedirectsService class is used to query the Content SDK redirects using Graphql endpoint
37
- */
38
- export declare class RedirectsService {
39
- private options;
40
- private graphQLClient;
41
- private cache;
42
- /**
43
- * Creates an instance of graphQL redirects service with the provided options
44
- * @param {RedirectsServiceConfig} options instance
45
- */
46
- constructor(options: RedirectsServiceConfig);
47
- protected get query(): string;
48
- /**
49
- * Fetch an array of redirects from API
50
- * @param {string} siteName site name
51
- * @returns Promise<RedirectInfo[]>
52
- * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
53
- * @throws {Error} if the siteName is empty.
54
- */
55
- fetchRedirects(siteName: string, fetchOptions?: FetchOptions): Promise<RedirectInfo[]>;
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
- * Gets cache client implementation
65
- * Override this method if custom cache needs to be used
66
- * @returns CacheClient instance
67
- */
68
- protected getCacheClient(): CacheClient<RedirectsQueryResult>;
69
- }
1
+ import { FetchOptions, GraphQLClient } from '../client';
2
+ import { CacheOptions, CacheClient } from '../cache-client';
3
+ import { GraphQLRequestClientFactory } from '../graphql-request-client';
4
+ /**
5
+ * Redirect type for 301 redirects
6
+ * @public
7
+ */
8
+ export declare const REDIRECT_TYPE_301 = "REDIRECT_301";
9
+ /**
10
+ * Redirect type for 302 redirects
11
+ * @public
12
+ */
13
+ export declare const REDIRECT_TYPE_302 = "REDIRECT_302";
14
+ /**
15
+ * Redirect type for server transfer
16
+ * @public
17
+ */
18
+ export declare const REDIRECT_TYPE_SERVER_TRANSFER = "SERVER_TRANSFER";
19
+ /**
20
+ * Object model of Redirect Info result
21
+ * @public
22
+ */
23
+ export type RedirectInfo = {
24
+ pattern: string;
25
+ target: string;
26
+ redirectType: string;
27
+ isQueryStringPreserved: boolean;
28
+ locale: string;
29
+ };
30
+ /**
31
+ * Configuration for @see RedirectsService instances
32
+ * @public
33
+ */
34
+ export type RedirectsServiceConfig = CacheOptions & {
35
+ /**
36
+ * Override fetch method. Uses 'GraphQLRequestClient' default otherwise.
37
+ */
38
+ fetch?: typeof fetch;
39
+ /**
40
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
41
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
42
+ */
43
+ clientFactory: GraphQLRequestClientFactory;
44
+ };
45
+ /**
46
+ * The schema of data returned in response to redirects array request
47
+ * @public
48
+ */
49
+ export type RedirectsQueryResult = {
50
+ site: {
51
+ siteInfo: {
52
+ redirects: RedirectInfo[];
53
+ } | null;
54
+ };
55
+ };
56
+ /**
57
+ * The RedirectsService class is used to query the Content SDK redirects using Graphql endpoint
58
+ * @public
59
+ */
60
+ export declare class RedirectsService {
61
+ private options;
62
+ private graphQLClient;
63
+ private cache;
64
+ /**
65
+ * Creates an instance of graphQL redirects service with the provided options
66
+ * @param {RedirectsServiceConfig} options instance
67
+ */
68
+ constructor(options: RedirectsServiceConfig);
69
+ protected get query(): string;
70
+ /**
71
+ * Fetch an array of redirects from API
72
+ * @param {string} siteName site name
73
+ * @returns Promise<RedirectInfo[]>
74
+ * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
75
+ * @throws {Error} if the siteName is empty.
76
+ */
77
+ fetchRedirects(siteName: string, fetchOptions?: FetchOptions): Promise<RedirectInfo[]>;
78
+ /**
79
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
80
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
81
+ * want to use something else.
82
+ * @returns {GraphQLClient} implementation
83
+ */
84
+ protected getGraphQLClient(): GraphQLClient;
85
+ /**
86
+ * Gets cache client implementation
87
+ * Override this method if custom cache needs to be used
88
+ * @returns CacheClient instance
89
+ */
90
+ protected getCacheClient(): CacheClient<RedirectsQueryResult>;
91
+ }
92
+ //# 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,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAqB,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE;;;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,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAmBF;;;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"}
@@ -1,50 +1,57 @@
1
- import { FetchOptions, GraphQLClient } from '../client';
2
- import { GraphQLRequestClientFactory } from '../graphql-request-client';
3
- export type RobotsServiceConfig = {
4
- /**
5
- * The Content SDK application name
6
- */
7
- siteName: string;
8
- /**
9
- * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
10
- * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
11
- */
12
- clientFactory: GraphQLRequestClientFactory;
13
- };
14
- /**
15
- * The schema of data returned in response to robots.txt request
16
- */
17
- export type RobotsQueryResult = {
18
- site: {
19
- siteInfo: {
20
- robots: string;
21
- };
22
- };
23
- };
24
- /**
25
- * Service that fetch the robots.txt data using Sitecore's GraphQL API.
26
- */
27
- export declare class RobotsService {
28
- options: RobotsServiceConfig;
29
- private graphQLClient;
30
- /**
31
- * Creates an instance of graphQL robots.txt service with the provided options
32
- * @param {RobotsServiceConfig} options instance
33
- */
34
- constructor(options: RobotsServiceConfig);
35
- protected get query(): string;
36
- /**
37
- * Fetch a data of robots.txt from API
38
- * @param {FetchOptions} fetchOptions - The fetch options to be used for the request.
39
- * @returns text of robots.txt
40
- * @throws {Error} if the siteName is empty.
41
- */
42
- fetchRobots(fetchOptions?: FetchOptions): Promise<string>;
43
- /**
44
- * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
45
- * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
46
- * want to use something else.
47
- * @returns {GraphQLClient} implementation
48
- */
49
- protected getGraphQLClient(): GraphQLClient;
50
- }
1
+ import { FetchOptions, GraphQLClient } from '../client';
2
+ import { GraphQLRequestClientFactory } from '../graphql-request-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,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAaxE;;;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"}
@@ -1,26 +1,28 @@
1
- import { SiteInfo } from './models';
2
- /**
3
- * Resolves site based on the provided host or site name
4
- */
5
- export declare class SiteResolver {
6
- readonly sites: SiteInfo[];
7
- /**
8
- * @param {SiteInfo[]} sites Array of sites to be used in resolution
9
- */
10
- constructor(sites: SiteInfo[]);
11
- /**
12
- * Resolve site by host name
13
- * @param {string} hostName the host name
14
- * @returns {SiteInfo} the resolved site
15
- * @throws {Error} if a matching site is not found
16
- */
17
- getByHost: (hostName: string) => SiteInfo;
18
- /**
19
- * Resolve site by site name
20
- * @param {string} siteName the site name
21
- * @returns {SiteInfo} the resolved site or undefined if not found
22
- */
23
- getByName: (siteName: string) => SiteInfo | undefined;
24
- protected getHostMap: () => Map<string, SiteInfo>;
25
- protected matchesPattern(hostname: string, pattern: string): boolean;
26
- }
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"}
@@ -1,52 +1,65 @@
1
- import { FetchOptions, GraphQLClient } from '../client';
2
- import { CacheClient, CacheOptions } from '../cache-client';
3
- import { GraphQLRequestClientFactory } from '../graphql-request-client';
4
- import { SiteInfo } from './models';
5
- export type SiteInfoServiceConfig = CacheOptions & {
6
- /**
7
- * common variable for all GraphQL queries
8
- * it will be used for every type of query to regulate result batch size
9
- * Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
10
- * @default 10
11
- */
12
- pageSize?: number;
13
- /**
14
- * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
15
- * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
16
- */
17
- clientFactory: GraphQLRequestClientFactory;
18
- };
19
- export type GraphQLSiteInfoResult = {
20
- name: string;
21
- hostName: string;
22
- language: string;
23
- };
24
- export declare class SiteInfoService {
25
- private config;
26
- private graphQLClient;
27
- private cache;
28
- /**
29
- * Creates an instance of graphQL service to retrieve site configuration list from Sitecore
30
- * @param {SiteInfoServiceConfig} config instance
31
- */
32
- constructor(config: SiteInfoServiceConfig);
33
- /**
34
- * site query is available on XM Cloud and XP 10.4+
35
- */
36
- protected get siteQuery(): string;
37
- fetchSiteInfo(fetchOptions?: FetchOptions): Promise<SiteInfo[]>;
38
- /**
39
- * Gets cache client implementation
40
- * Override this method if custom cache needs to be used
41
- * @returns CacheClient instance
42
- */
43
- protected getCacheClient(): CacheClient<SiteInfo[]>;
44
- /**
45
- * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
46
- * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
47
- * want to use something else.
48
- * @returns {GraphQLClient} implementation
49
- */
50
- protected getGraphQLClient(): GraphQLClient;
51
- private getCacheKey;
52
- }
1
+ import { FetchOptions, GraphQLClient } from '../client';
2
+ import { CacheClient, CacheOptions } from '../cache-client';
3
+ import { GraphQLRequestClientFactory } from '../graphql-request-client';
4
+ import { SiteInfo } from './models';
5
+ /**
6
+ * Configuration for @see SiteInfoService instances
7
+ * @public
8
+ */
9
+ export type SiteInfoServiceConfig = CacheOptions & {
10
+ /**
11
+ * common variable for all GraphQL queries
12
+ * it will be used for every type of query to regulate result batch size
13
+ * Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
14
+ * @default 10
15
+ */
16
+ pageSize?: number;
17
+ /**
18
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
19
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
20
+ */
21
+ clientFactory: GraphQLRequestClientFactory;
22
+ };
23
+ /**
24
+ * Object model of Site Info result
25
+ * @public
26
+ */
27
+ export type GraphQLSiteInfoResult = {
28
+ name: string;
29
+ hostName: string;
30
+ language: string;
31
+ };
32
+ /**
33
+ * Service to fetch site information
34
+ * @public
35
+ */
36
+ export declare class SiteInfoService {
37
+ private config;
38
+ private graphQLClient;
39
+ private cache;
40
+ /**
41
+ * Creates an instance of graphQL service to retrieve site configuration list from Sitecore
42
+ * @param {SiteInfoServiceConfig} config instance
43
+ */
44
+ constructor(config: SiteInfoServiceConfig);
45
+ /**
46
+ * site query is available on XM Cloud and XP 10.4+
47
+ */
48
+ protected get siteQuery(): string;
49
+ fetchSiteInfo(fetchOptions?: FetchOptions): Promise<SiteInfo[]>;
50
+ /**
51
+ * Gets cache client implementation
52
+ * Override this method if custom cache needs to be used
53
+ * @returns CacheClient instance
54
+ */
55
+ protected getCacheClient(): CacheClient<SiteInfo[]>;
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
+ private getCacheKey;
64
+ }
65
+ //# 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,WAAW,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAqB,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,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"}
@@ -1,56 +1,63 @@
1
- import { FetchOptions, GraphQLClient } from '../client';
2
- import { GraphQLRequestClientFactory } from '../graphql-request-client';
3
- export type SitemapXmlServiceConfig = {
4
- /**
5
- * The Content SDK application name
6
- */
7
- siteName: string;
8
- /**
9
- * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
10
- * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
11
- */
12
- clientFactory: GraphQLRequestClientFactory;
13
- };
14
- /**
15
- * The schema of data returned in response to sitemaps request
16
- */
17
- export type SitemapQueryResult = {
18
- site: {
19
- siteInfo: {
20
- sitemap: string[];
21
- };
22
- };
23
- };
24
- /**
25
- * Service that fetch the sitemaps data using Sitecore's GraphQL API.
26
- */
27
- export declare class SitemapXmlService {
28
- options: SitemapXmlServiceConfig;
29
- private graphQLClient;
30
- /**
31
- * Creates an instance of graphQL sitemaps service with the provided options
32
- * @param {SitemapXmlServiceConfig} options instance
33
- */
34
- constructor(options: SitemapXmlServiceConfig);
35
- protected get query(): string;
36
- /**
37
- * Fetch list of sitemaps for the site
38
- * @returns {string[]} list of sitemap paths
39
- * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
40
- * @throws {Error} if the siteName is empty.
41
- */
42
- fetchSitemaps(fetchOptions?: FetchOptions): Promise<string[]>;
43
- /**
44
- * Get sitemap file path for sitemap id
45
- * @param {string} id the sitemap id (can be empty for default 'sitemap.xml' file)
46
- * @returns {string | undefined} the sitemap file path or undefined if one doesn't exist
47
- */
48
- getSitemap(id: string): Promise<string | undefined>;
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
- }
1
+ import { FetchOptions, GraphQLClient } from '../client';
2
+ import { GraphQLRequestClientFactory } from '../graphql-request-client';
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;AAGxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAexE;;;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"}