@sitecore/sc-contenthub-webclient-sdk 0.9.7

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 (636) hide show
  1. package/LICENSE +24 -0
  2. package/dist/api/api-info-resource.d.ts +8 -0
  3. package/dist/api/api-info-resource.js +42 -0
  4. package/dist/api/api-info.d.ts +29 -0
  5. package/dist/api/api-info.js +14 -0
  6. package/dist/api/api-resource.d.ts +4 -0
  7. package/dist/api/api-resource.js +16 -0
  8. package/dist/api/api-routes-dictionary.d.ts +8 -0
  9. package/dist/api/api-routes-dictionary.js +10 -0
  10. package/dist/authentication/oauth-grant-base.d.ts +6 -0
  11. package/dist/authentication/oauth-grant-base.js +42 -0
  12. package/dist/authentication/oauth-grant-type.d.ts +4 -0
  13. package/dist/authentication/oauth-grant-type.js +8 -0
  14. package/dist/authentication/oauth-password-grant.d.ts +8 -0
  15. package/dist/authentication/oauth-password-grant.js +45 -0
  16. package/dist/authentication/oauth-refreshtoken-grant.d.ts +7 -0
  17. package/dist/authentication/oauth-refreshtoken-grant.js +39 -0
  18. package/dist/authentication/token-info.d.ts +6 -0
  19. package/dist/authentication/token-info.js +35 -0
  20. package/dist/base-types.d.ts +56 -0
  21. package/dist/base-types.js +32 -0
  22. package/dist/caches/culture-cache.d.ts +8 -0
  23. package/dist/caches/culture-cache.js +21 -0
  24. package/dist/caches/entity-definition-cache.d.ts +44 -0
  25. package/dist/caches/entity-definition-cache.js +96 -0
  26. package/dist/clients/api-client.d.ts +56 -0
  27. package/dist/clients/api-client.js +107 -0
  28. package/dist/clients/commands-client.d.ts +16 -0
  29. package/dist/clients/commands-client.js +40 -0
  30. package/dist/clients/content-hub-client.d.ts +75 -0
  31. package/dist/clients/content-hub-client.js +66 -0
  32. package/dist/clients/culture-client.d.ts +36 -0
  33. package/dist/clients/culture-client.js +43 -0
  34. package/dist/clients/culture-loader.d.ts +41 -0
  35. package/dist/clients/culture-loader.js +103 -0
  36. package/dist/clients/entities-client.d.ts +201 -0
  37. package/dist/clients/entities-client.js +271 -0
  38. package/dist/clients/entity-definitions-client.d.ts +87 -0
  39. package/dist/clients/entity-definitions-client.js +354 -0
  40. package/dist/clients/extended-client.d.ts +11 -0
  41. package/dist/clients/extended-client.js +2 -0
  42. package/dist/clients/internal-client.d.ts +46 -0
  43. package/dist/clients/internal-client.js +240 -0
  44. package/dist/clients/notifications-client.d.ts +35 -0
  45. package/dist/clients/notifications-client.js +128 -0
  46. package/dist/clients/option-list-client.d.ts +49 -0
  47. package/dist/clients/option-list-client.js +85 -0
  48. package/dist/clients/pages-client.d.ts +36 -0
  49. package/dist/clients/pages-client.js +52 -0
  50. package/dist/clients/policies-client.d.ts +47 -0
  51. package/dist/clients/policies-client.js +92 -0
  52. package/dist/clients/querying-client.d.ts +34 -0
  53. package/dist/clients/querying-client.js +95 -0
  54. package/dist/clients/raw-client.d.ts +29 -0
  55. package/dist/clients/raw-client.js +79 -0
  56. package/dist/clients/request-message.d.ts +25 -0
  57. package/dist/clients/request-message.js +12 -0
  58. package/dist/clients/response-handler.d.ts +30 -0
  59. package/dist/clients/response-handler.js +145 -0
  60. package/dist/clients/response-message.d.ts +45 -0
  61. package/dist/clients/response-message.js +34 -0
  62. package/dist/clients/schema-querying.d.ts +16 -0
  63. package/dist/clients/schema-querying.js +70 -0
  64. package/dist/clients/search-client.d.ts +16 -0
  65. package/dist/clients/search-client.js +36 -0
  66. package/dist/clients/settings-client.d.ts +37 -0
  67. package/dist/clients/settings-client.js +126 -0
  68. package/dist/clients/users-client.d.ts +150 -0
  69. package/dist/clients/users-client.js +317 -0
  70. package/dist/clients/web-content-hub-client.d.ts +13 -0
  71. package/dist/clients/web-content-hub-client.js +2 -0
  72. package/dist/constants/api.d.ts +130 -0
  73. package/dist/constants/api.js +133 -0
  74. package/dist/constants/defaults.d.ts +7 -0
  75. package/dist/constants/defaults.js +10 -0
  76. package/dist/constants/definitions.d.ts +62 -0
  77. package/dist/constants/definitions.js +88 -0
  78. package/dist/constants/index.d.ts +5 -0
  79. package/dist/constants/index.js +30 -0
  80. package/dist/constants/notifications.d.ts +7 -0
  81. package/dist/constants/notifications.js +10 -0
  82. package/dist/contracts/base/culture-insensitive-property.d.ts +28 -0
  83. package/dist/contracts/base/culture-insensitive-property.js +47 -0
  84. package/dist/contracts/base/culture-sensitive-property.d.ts +49 -0
  85. package/dist/contracts/base/culture-sensitive-property.js +113 -0
  86. package/dist/contracts/base/data-type.d.ts +18 -0
  87. package/dist/contracts/base/data-type.js +24 -0
  88. package/dist/contracts/base/entity-base.d.ts +65 -0
  89. package/dist/contracts/base/entity-base.js +362 -0
  90. package/dist/contracts/base/entity-construction-args.d.ts +15 -0
  91. package/dist/contracts/base/entity-construction-args.js +16 -0
  92. package/dist/contracts/base/entity-definition.d.ts +108 -0
  93. package/dist/contracts/base/entity-definition.js +126 -0
  94. package/dist/contracts/base/entity.d.ts +237 -0
  95. package/dist/contracts/base/entity.js +76 -0
  96. package/dist/contracts/base/index.d.ts +14 -0
  97. package/dist/contracts/base/index.js +26 -0
  98. package/dist/contracts/base/json-content-type.d.ts +9 -0
  99. package/dist/contracts/base/json-content-type.js +13 -0
  100. package/dist/contracts/base/lazy-loading-manager.d.ts +4 -0
  101. package/dist/contracts/base/lazy-loading-manager.js +17 -0
  102. package/dist/contracts/base/member-condition.d.ts +48 -0
  103. package/dist/contracts/base/member-condition.js +125 -0
  104. package/dist/contracts/base/member-definition-type.d.ts +13 -0
  105. package/dist/contracts/base/member-definition-type.js +17 -0
  106. package/dist/contracts/base/member-definition.d.ts +77 -0
  107. package/dist/contracts/base/member-definition.js +101 -0
  108. package/dist/contracts/base/member-group.d.ts +54 -0
  109. package/dist/contracts/base/member-group.js +61 -0
  110. package/dist/contracts/base/member.d.ts +32 -0
  111. package/dist/contracts/base/member.js +26 -0
  112. package/dist/contracts/base/option-lists/flat-option-list-value.d.ts +4 -0
  113. package/dist/contracts/base/option-lists/flat-option-list-value.js +9 -0
  114. package/dist/contracts/base/option-lists/flat-option-list.d.ts +9 -0
  115. package/dist/contracts/base/option-lists/flat-option-list.js +11 -0
  116. package/dist/contracts/base/option-lists/hierarchical-option-list.d.ts +9 -0
  117. package/dist/contracts/base/option-lists/hierarchical-option-list.js +11 -0
  118. package/dist/contracts/base/option-lists/hierarchical-options-list-value.d.ts +7 -0
  119. package/dist/contracts/base/option-lists/hierarchical-options-list-value.js +14 -0
  120. package/dist/contracts/base/option-lists/option-list-base.d.ts +23 -0
  121. package/dist/contracts/base/option-lists/option-list-base.js +33 -0
  122. package/dist/contracts/base/option-lists/option-list-type.d.ts +13 -0
  123. package/dist/contracts/base/option-lists/option-list-type.js +17 -0
  124. package/dist/contracts/base/option-lists/option-list-value-base.d.ts +7 -0
  125. package/dist/contracts/base/option-lists/option-list-value-base.js +14 -0
  126. package/dist/contracts/base/option-lists/option-list-value.d.ts +30 -0
  127. package/dist/contracts/base/option-lists/option-list-value.js +2 -0
  128. package/dist/contracts/base/option-lists/option-list.d.ts +40 -0
  129. package/dist/contracts/base/option-lists/option-list.js +2 -0
  130. package/dist/contracts/base/property-definition.d.ts +61 -0
  131. package/dist/contracts/base/property-definition.js +76 -0
  132. package/dist/contracts/base/property-definitions/boolean-property-definition.d.ts +7 -0
  133. package/dist/contracts/base/property-definitions/boolean-property-definition.js +33 -0
  134. package/dist/contracts/base/property-definitions/datetime-property-definition.d.ts +7 -0
  135. package/dist/contracts/base/property-definitions/datetime-property-definition.js +33 -0
  136. package/dist/contracts/base/property-definitions/datetimeoffset-property-definition.d.ts +7 -0
  137. package/dist/contracts/base/property-definitions/datetimeoffset-property-definition.js +33 -0
  138. package/dist/contracts/base/property-definitions/decimal-property-definition.d.ts +7 -0
  139. package/dist/contracts/base/property-definitions/decimal-property-definition.js +33 -0
  140. package/dist/contracts/base/property-definitions/index.d.ts +8 -0
  141. package/dist/contracts/base/property-definitions/index.js +20 -0
  142. package/dist/contracts/base/property-definitions/integer-property-definition.d.ts +7 -0
  143. package/dist/contracts/base/property-definitions/integer-property-definition.js +33 -0
  144. package/dist/contracts/base/property-definitions/json-property-definition.d.ts +10 -0
  145. package/dist/contracts/base/property-definitions/json-property-definition.js +38 -0
  146. package/dist/contracts/base/property-definitions/long-property-definition.d.ts +7 -0
  147. package/dist/contracts/base/property-definitions/long-property-definition.js +33 -0
  148. package/dist/contracts/base/property-definitions/string-property-definition.d.ts +33 -0
  149. package/dist/contracts/base/property-definitions/string-property-definition.js +55 -0
  150. package/dist/contracts/base/property-manager.d.ts +19 -0
  151. package/dist/contracts/base/property-manager.js +114 -0
  152. package/dist/contracts/base/property.d.ts +21 -0
  153. package/dist/contracts/base/property.js +30 -0
  154. package/dist/contracts/base/relation-cardinality.d.ts +19 -0
  155. package/dist/contracts/base/relation-cardinality.js +22 -0
  156. package/dist/contracts/base/relation-container.d.ts +40 -0
  157. package/dist/contracts/base/relation-container.js +118 -0
  158. package/dist/contracts/base/relation-definition.d.ts +123 -0
  159. package/dist/contracts/base/relation-definition.js +116 -0
  160. package/dist/contracts/base/relation-manager.d.ts +70 -0
  161. package/dist/contracts/base/relation-manager.js +197 -0
  162. package/dist/contracts/base/relation-role.d.ts +14 -0
  163. package/dist/contracts/base/relation-role.js +17 -0
  164. package/dist/contracts/base/relation.d.ts +74 -0
  165. package/dist/contracts/base/relation.js +40 -0
  166. package/dist/contracts/base/relations/child-to-many-parents-relation.d.ts +27 -0
  167. package/dist/contracts/base/relations/child-to-many-parents-relation.js +67 -0
  168. package/dist/contracts/base/relations/child-to-one-parent-relation.d.ts +26 -0
  169. package/dist/contracts/base/relations/child-to-one-parent-relation.js +74 -0
  170. package/dist/contracts/base/relations/parent-to-many-children-relation.d.ts +27 -0
  171. package/dist/contracts/base/relations/parent-to-many-children-relation.js +67 -0
  172. package/dist/contracts/base/relations/parent-to-one-child-relation.d.ts +29 -0
  173. package/dist/contracts/base/relations/parent-to-one-child-relation.js +74 -0
  174. package/dist/contracts/base/relations/to-many-relation.d.ts +16 -0
  175. package/dist/contracts/base/relations/to-many-relation.js +2 -0
  176. package/dist/contracts/base/relations/to-one-relation.d.ts +18 -0
  177. package/dist/contracts/base/relations/to-one-relation.js +2 -0
  178. package/dist/contracts/base/rendition.d.ts +14 -0
  179. package/dist/contracts/base/rendition.js +13 -0
  180. package/dist/contracts/base/resource.d.ts +21 -0
  181. package/dist/contracts/base/resource.js +2 -0
  182. package/dist/contracts/base/string-content-type.d.ts +21 -0
  183. package/dist/contracts/base/string-content-type.js +25 -0
  184. package/dist/contracts/base/typed-entity.d.ts +11 -0
  185. package/dist/contracts/base/typed-entity.js +2 -0
  186. package/dist/contracts/base/users.d.ts +0 -0
  187. package/dist/contracts/base/users.js +1 -0
  188. package/dist/contracts/base/view-mode.d.ts +4 -0
  189. package/dist/contracts/base/view-mode.js +8 -0
  190. package/dist/contracts/content/asset.d.ts +22 -0
  191. package/dist/contracts/content/asset.js +67 -0
  192. package/dist/contracts/content/final-life-cycle-status.d.ts +7 -0
  193. package/dist/contracts/content/final-life-cycle-status.js +11 -0
  194. package/dist/contracts/dirty-tracking/dirty-tracking.d.ts +10 -0
  195. package/dist/contracts/dirty-tracking/dirty-tracking.js +2 -0
  196. package/dist/contracts/notifications/mail-template.d.ts +44 -0
  197. package/dist/contracts/notifications/mail-template.js +2 -0
  198. package/dist/contracts/policies/condition.d.ts +16 -0
  199. package/dist/contracts/policies/condition.js +10 -0
  200. package/dist/contracts/policies/member-policy.d.ts +31 -0
  201. package/dist/contracts/policies/member-policy.js +12 -0
  202. package/dist/contracts/policies/policy.d.ts +19 -0
  203. package/dist/contracts/policies/policy.js +11 -0
  204. package/dist/contracts/policies/rule-type.d.ts +7 -0
  205. package/dist/contracts/policies/rule-type.js +11 -0
  206. package/dist/contracts/policies/rule.d.ts +58 -0
  207. package/dist/contracts/policies/rule.js +19 -0
  208. package/dist/contracts/policies/user-group-policy.d.ts +10 -0
  209. package/dist/contracts/policies/user-group-policy.js +17 -0
  210. package/dist/contracts/policies/user-policy.d.ts +10 -0
  211. package/dist/contracts/policies/user-policy.js +17 -0
  212. package/dist/contracts/querying/culture-load-option.d.ts +35 -0
  213. package/dist/contracts/querying/culture-load-option.js +69 -0
  214. package/dist/contracts/querying/entity-definition-id-iterator.d.ts +9 -0
  215. package/dist/contracts/querying/entity-definition-id-iterator.js +30 -0
  216. package/dist/contracts/querying/entity-definition-id-query-result.d.ts +10 -0
  217. package/dist/contracts/querying/entity-definition-id-query-result.js +22 -0
  218. package/dist/contracts/querying/entity-definition-iterator.d.ts +16 -0
  219. package/dist/contracts/querying/entity-definition-iterator.js +30 -0
  220. package/dist/contracts/querying/entity-definition-query-result.d.ts +21 -0
  221. package/dist/contracts/querying/entity-definition-query-result.js +22 -0
  222. package/dist/contracts/querying/entity-iterator.d.ts +13 -0
  223. package/dist/contracts/querying/entity-iterator.js +30 -0
  224. package/dist/contracts/querying/entity-load-configuration-builder.d.ts +76 -0
  225. package/dist/contracts/querying/entity-load-configuration-builder.js +101 -0
  226. package/dist/contracts/querying/entity-load-configuration.d.ts +51 -0
  227. package/dist/contracts/querying/entity-load-configuration.js +67 -0
  228. package/dist/contracts/querying/entity-load-option.d.ts +35 -0
  229. package/dist/contracts/querying/entity-load-option.js +94 -0
  230. package/dist/contracts/querying/entity-query-result.d.ts +23 -0
  231. package/dist/contracts/querying/entity-query-result.js +33 -0
  232. package/dist/contracts/querying/filters/comparison-operator.d.ts +11 -0
  233. package/dist/contracts/querying/filters/comparison-operator.js +15 -0
  234. package/dist/contracts/querying/filters/composite-filter-operator.d.ts +4 -0
  235. package/dist/contracts/querying/filters/composite-filter-operator.js +8 -0
  236. package/dist/contracts/querying/filters/composite-query-filter.d.ts +19 -0
  237. package/dist/contracts/querying/filters/composite-query-filter.js +49 -0
  238. package/dist/contracts/querying/filters/createdby-query-filter.d.ts +5 -0
  239. package/dist/contracts/querying/filters/createdby-query-filter.js +30 -0
  240. package/dist/contracts/querying/filters/createdon-query-filter.d.ts +19 -0
  241. package/dist/contracts/querying/filters/createdon-query-filter.js +45 -0
  242. package/dist/contracts/querying/filters/definition-query-filter.d.ts +34 -0
  243. package/dist/contracts/querying/filters/definition-query-filter.js +58 -0
  244. package/dist/contracts/querying/filters/filter-data-type.d.ts +11 -0
  245. package/dist/contracts/querying/filters/filter-data-type.js +15 -0
  246. package/dist/contracts/querying/filters/filter-type.d.ts +18 -0
  247. package/dist/contracts/querying/filters/filter-type.js +22 -0
  248. package/dist/contracts/querying/filters/id-query-filter.d.ts +25 -0
  249. package/dist/contracts/querying/filters/id-query-filter.js +49 -0
  250. package/dist/contracts/querying/filters/identifier-query-filter.d.ts +25 -0
  251. package/dist/contracts/querying/filters/identifier-query-filter.js +49 -0
  252. package/dist/contracts/querying/filters/index.d.ts +20 -0
  253. package/dist/contracts/querying/filters/index.js +32 -0
  254. package/dist/contracts/querying/filters/modifiedby-query-filter.d.ts +5 -0
  255. package/dist/contracts/querying/filters/modifiedby-query-filter.js +30 -0
  256. package/dist/contracts/querying/filters/modifiedon-query-filter.d.ts +19 -0
  257. package/dist/contracts/querying/filters/modifiedon-query-filter.js +45 -0
  258. package/dist/contracts/querying/filters/modules-query-filter.d.ts +14 -0
  259. package/dist/contracts/querying/filters/modules-query-filter.js +43 -0
  260. package/dist/contracts/querying/filters/not-query-filter.d.ts +14 -0
  261. package/dist/contracts/querying/filters/not-query-filter.js +39 -0
  262. package/dist/contracts/querying/filters/property-query-filter.d.ts +38 -0
  263. package/dist/contracts/querying/filters/property-query-filter.js +63 -0
  264. package/dist/contracts/querying/filters/query-filter.d.ts +10 -0
  265. package/dist/contracts/querying/filters/query-filter.js +28 -0
  266. package/dist/contracts/querying/filters/relation-connection-type.d.ts +15 -0
  267. package/dist/contracts/querying/filters/relation-connection-type.js +19 -0
  268. package/dist/contracts/querying/filters/relation-query-filter.d.ts +23 -0
  269. package/dist/contracts/querying/filters/relation-query-filter.js +48 -0
  270. package/dist/contracts/querying/filters/secured-ancestors-query-filter.d.ts +24 -0
  271. package/dist/contracts/querying/filters/secured-ancestors-query-filter.js +53 -0
  272. package/dist/contracts/querying/filters/user-query-filter.d.ts +37 -0
  273. package/dist/contracts/querying/filters/user-query-filter.js +61 -0
  274. package/dist/contracts/querying/id-iterator.d.ts +11 -0
  275. package/dist/contracts/querying/id-iterator.js +19 -0
  276. package/dist/contracts/querying/id-query-result.d.ts +17 -0
  277. package/dist/contracts/querying/id-query-result.js +24 -0
  278. package/dist/contracts/querying/iterator.d.ts +9 -0
  279. package/dist/contracts/querying/iterator.js +2 -0
  280. package/dist/contracts/querying/load-option.d.ts +4 -0
  281. package/dist/contracts/querying/load-option.js +2 -0
  282. package/dist/contracts/querying/load-options.d.ts +6 -0
  283. package/dist/contracts/querying/load-options.js +10 -0
  284. package/dist/contracts/querying/loading-query-iterator.d.ts +17 -0
  285. package/dist/contracts/querying/loading-query-iterator.js +57 -0
  286. package/dist/contracts/querying/member-load-option.d.ts +11 -0
  287. package/dist/contracts/querying/member-load-option.js +15 -0
  288. package/dist/contracts/querying/minimal-schema.d.ts +8 -0
  289. package/dist/contracts/querying/minimal-schema.js +48 -0
  290. package/dist/contracts/querying/property-data.d.ts +8 -0
  291. package/dist/contracts/querying/property-data.js +43 -0
  292. package/dist/contracts/querying/property-load-option.d.ts +30 -0
  293. package/dist/contracts/querying/property-load-option.js +70 -0
  294. package/dist/contracts/querying/query-iterator.d.ts +18 -0
  295. package/dist/contracts/querying/query-iterator.js +54 -0
  296. package/dist/contracts/querying/query-load-configuration.d.ts +39 -0
  297. package/dist/contracts/querying/query-load-configuration.js +86 -0
  298. package/dist/contracts/querying/query-request.d.ts +6 -0
  299. package/dist/contracts/querying/query-request.js +30 -0
  300. package/dist/contracts/querying/query-result-paging-manager.d.ts +9 -0
  301. package/dist/contracts/querying/query-result-paging-manager.js +22 -0
  302. package/dist/contracts/querying/query-result.d.ts +5 -0
  303. package/dist/contracts/querying/query-result.js +2 -0
  304. package/dist/contracts/querying/query-sort-order.d.ts +13 -0
  305. package/dist/contracts/querying/query-sort-order.js +17 -0
  306. package/dist/contracts/querying/query.d.ts +23 -0
  307. package/dist/contracts/querying/query.js +56 -0
  308. package/dist/contracts/querying/relation-data.d.ts +7 -0
  309. package/dist/contracts/querying/relation-data.js +38 -0
  310. package/dist/contracts/querying/relation-load-option.d.ts +31 -0
  311. package/dist/contracts/querying/relation-load-option.js +74 -0
  312. package/dist/contracts/querying/relation-specification.d.ts +33 -0
  313. package/dist/contracts/querying/relation-specification.js +52 -0
  314. package/dist/contracts/querying/schema-querying.d.ts +20 -0
  315. package/dist/contracts/querying/schema-querying.js +2 -0
  316. package/dist/contracts/querying/scroll-request.d.ts +7 -0
  317. package/dist/contracts/querying/scroll-request.js +33 -0
  318. package/dist/contracts/querying/skip-take-iterator-base.d.ts +14 -0
  319. package/dist/contracts/querying/skip-take-iterator-base.js +60 -0
  320. package/dist/contracts/querying/sort-field-type.d.ts +13 -0
  321. package/dist/contracts/querying/sort-field-type.js +17 -0
  322. package/dist/contracts/querying/sorting.d.ts +25 -0
  323. package/dist/contracts/querying/sorting.js +44 -0
  324. package/dist/contracts/users/user-group-combine-method.d.ts +4 -0
  325. package/dist/contracts/users/user-group-combine-method.js +8 -0
  326. package/dist/contracts/users/user-group-configuration.d.ts +11 -0
  327. package/dist/contracts/users/user-group-configuration.js +35 -0
  328. package/dist/contracts/users/user-profile.d.ts +4 -0
  329. package/dist/contracts/users/user-profile.js +2 -0
  330. package/dist/contracts/users/user.d.ts +24 -0
  331. package/dist/contracts/users/user.js +64 -0
  332. package/dist/converters/api-resource-converter.d.ts +16 -0
  333. package/dist/converters/api-resource-converter.js +45 -0
  334. package/dist/converters/file-version-converter.d.ts +22 -0
  335. package/dist/converters/file-version-converter.js +43 -0
  336. package/dist/converters/index.d.ts +6 -0
  337. package/dist/converters/index.js +18 -0
  338. package/dist/converters/member-condition-converter.d.ts +20 -0
  339. package/dist/converters/member-condition-converter.js +50 -0
  340. package/dist/converters/member-condition-resource-converter.d.ts +21 -0
  341. package/dist/converters/member-condition-resource-converter.js +53 -0
  342. package/dist/converters/minimal-schema-relation-cardinality-converter.d.ts +11 -0
  343. package/dist/converters/minimal-schema-relation-cardinality-converter.js +33 -0
  344. package/dist/converters/page-resource-menus-converter.d.ts +19 -0
  345. package/dist/converters/page-resource-menus-converter.js +45 -0
  346. package/dist/converters/page-resource-zones-converter.d.ts +19 -0
  347. package/dist/converters/page-resource-zones-converter.js +45 -0
  348. package/dist/converters/relation-map-resource-converter.d.ts +6 -0
  349. package/dist/converters/relation-map-resource-converter.js +38 -0
  350. package/dist/converters/relation-resource-converter.d.ts +22 -0
  351. package/dist/converters/relation-resource-converter.js +51 -0
  352. package/dist/converters/renditions-converter.d.ts +20 -0
  353. package/dist/converters/renditions-converter.js +44 -0
  354. package/dist/converters/string-to-any-map-converter.d.ts +20 -0
  355. package/dist/converters/string-to-any-map-converter.js +34 -0
  356. package/dist/culture-info.d.ts +5 -0
  357. package/dist/culture-info.js +7 -0
  358. package/dist/dirty-value-calculator.d.ts +7 -0
  359. package/dist/dirty-value-calculator.js +29 -0
  360. package/dist/entity-link.d.ts +8 -0
  361. package/dist/entity-link.js +40 -0
  362. package/dist/error-messages.d.ts +57 -0
  363. package/dist/error-messages.js +64 -0
  364. package/dist/errors/argument-error.d.ts +4 -0
  365. package/dist/errors/argument-error.js +11 -0
  366. package/dist/errors/authentication-error.d.ts +5 -0
  367. package/dist/errors/authentication-error.js +12 -0
  368. package/dist/errors/bad-request-error.d.ts +5 -0
  369. package/dist/errors/bad-request-error.js +11 -0
  370. package/dist/errors/forbidden-error.d.ts +4 -0
  371. package/dist/errors/forbidden-error.js +11 -0
  372. package/dist/errors/internal-error.d.ts +4 -0
  373. package/dist/errors/internal-error.js +11 -0
  374. package/dist/errors/invalid-operation-error.d.ts +4 -0
  375. package/dist/errors/invalid-operation-error.js +11 -0
  376. package/dist/errors/not-found-error.d.ts +5 -0
  377. package/dist/errors/not-found-error.js +11 -0
  378. package/dist/errors/not-implemented-error.d.ts +4 -0
  379. package/dist/errors/not-implemented-error.js +11 -0
  380. package/dist/errors/not-loaded-error.d.ts +4 -0
  381. package/dist/errors/not-loaded-error.js +11 -0
  382. package/dist/errors/not-supported-error.d.ts +4 -0
  383. package/dist/errors/not-supported-error.js +11 -0
  384. package/dist/errors/schema-error.d.ts +4 -0
  385. package/dist/errors/schema-error.js +11 -0
  386. package/dist/errors/validation-error.d.ts +6 -0
  387. package/dist/errors/validation-error.js +12 -0
  388. package/dist/errors/validation-failure.d.ts +7 -0
  389. package/dist/errors/validation-failure.js +14 -0
  390. package/dist/errors/web-api-error.d.ts +13 -0
  391. package/dist/errors/web-api-error.js +13 -0
  392. package/dist/factories/entity-factory.d.ts +38 -0
  393. package/dist/factories/entity-factory.js +76 -0
  394. package/dist/factories/option-list-factory.d.ts +26 -0
  395. package/dist/factories/option-list-factory.js +22 -0
  396. package/dist/factories/property-factory.d.ts +10 -0
  397. package/dist/factories/property-factory.js +54 -0
  398. package/dist/factories/relation-factory.d.ts +55 -0
  399. package/dist/factories/relation-factory.js +70 -0
  400. package/dist/fileversion.d.ts +78 -0
  401. package/dist/fileversion.js +144 -0
  402. package/dist/guard.d.ts +29 -0
  403. package/dist/guard.js +142 -0
  404. package/dist/http-method.d.ts +9 -0
  405. package/dist/http-method.js +13 -0
  406. package/dist/index.d.ts +10 -0
  407. package/dist/index.js +22 -0
  408. package/dist/link-helper.d.ts +209 -0
  409. package/dist/link-helper.js +371 -0
  410. package/dist/link.d.ts +9 -0
  411. package/dist/link.js +78 -0
  412. package/dist/logging/log-level.d.ts +6 -0
  413. package/dist/logging/log-level.js +10 -0
  414. package/dist/logging/logger-base.d.ts +26 -0
  415. package/dist/logging/logger-base.js +98 -0
  416. package/dist/logging/logger.d.ts +16 -0
  417. package/dist/logging/logger.js +2 -0
  418. package/dist/logging/null-logger.d.ts +7 -0
  419. package/dist/logging/null-logger.js +13 -0
  420. package/dist/mappers/api-resource-mapper.d.ts +5 -0
  421. package/dist/mappers/api-resource-mapper.js +16 -0
  422. package/dist/mappers/condition-mapper.d.ts +36 -0
  423. package/dist/mappers/condition-mapper.js +112 -0
  424. package/dist/mappers/entity-definition-mapper.d.ts +13 -0
  425. package/dist/mappers/entity-definition-mapper.js +88 -0
  426. package/dist/mappers/entity-mapper.d.ts +19 -0
  427. package/dist/mappers/entity-mapper.js +134 -0
  428. package/dist/mappers/final-life-cycle-status-mapper.d.ts +6 -0
  429. package/dist/mappers/final-life-cycle-status-mapper.js +51 -0
  430. package/dist/mappers/load-options-mapper.d.ts +16 -0
  431. package/dist/mappers/load-options-mapper.js +100 -0
  432. package/dist/mappers/mapping-utilities.d.ts +7 -0
  433. package/dist/mappers/mapping-utilities.js +19 -0
  434. package/dist/mappers/member-condition-mapper.d.ts +12 -0
  435. package/dist/mappers/member-condition-mapper.js +119 -0
  436. package/dist/mappers/member-definition-mapper.d.ts +19 -0
  437. package/dist/mappers/member-definition-mapper.js +266 -0
  438. package/dist/mappers/member-group-mapper.d.ts +14 -0
  439. package/dist/mappers/member-group-mapper.js +95 -0
  440. package/dist/mappers/member-security-mapper.d.ts +34 -0
  441. package/dist/mappers/member-security-mapper.js +101 -0
  442. package/dist/mappers/notification-mapper.d.ts +5 -0
  443. package/dist/mappers/notification-mapper.js +17 -0
  444. package/dist/mappers/option-list-mapper.d.ts +18 -0
  445. package/dist/mappers/option-list-mapper.js +131 -0
  446. package/dist/mappers/policy-mapper.d.ts +29 -0
  447. package/dist/mappers/policy-mapper.js +124 -0
  448. package/dist/mappers/property-mapper.d.ts +21 -0
  449. package/dist/mappers/property-mapper.js +339 -0
  450. package/dist/mappers/querying-mapper.d.ts +16 -0
  451. package/dist/mappers/querying-mapper.js +96 -0
  452. package/dist/mappers/relation-cardinality-mapper.d.ts +5 -0
  453. package/dist/mappers/relation-cardinality-mapper.js +37 -0
  454. package/dist/mappers/relation-mapper.d.ts +16 -0
  455. package/dist/mappers/relation-mapper.js +202 -0
  456. package/dist/mappers/relation-role-mapper.d.ts +5 -0
  457. package/dist/mappers/relation-role-mapper.js +29 -0
  458. package/dist/mappers/rendition-mapper.d.ts +9 -0
  459. package/dist/mappers/rendition-mapper.js +34 -0
  460. package/dist/mappers/rule-type-mapper.d.ts +6 -0
  461. package/dist/mappers/rule-type-mapper.js +33 -0
  462. package/dist/mappers/rules-mapper.d.ts +35 -0
  463. package/dist/mappers/rules-mapper.js +123 -0
  464. package/dist/mappers/typed-entity-creator.d.ts +27 -0
  465. package/dist/mappers/typed-entity-creator.js +76 -0
  466. package/dist/models/entity-definition-collection-resource.d.ts +5 -0
  467. package/dist/models/entity-definition-collection-resource.js +26 -0
  468. package/dist/models/entity-definition-resource.d.ts +23 -0
  469. package/dist/models/entity-definition-resource.js +98 -0
  470. package/dist/models/entity-list-resource.d.ts +5 -0
  471. package/dist/models/entity-list-resource.js +26 -0
  472. package/dist/models/entity-resource.d.ts +36 -0
  473. package/dist/models/entity-resource.js +142 -0
  474. package/dist/models/list-resource.d.ts +13 -0
  475. package/dist/models/list-resource.js +50 -0
  476. package/dist/models/member-condition-resource.d.ts +32 -0
  477. package/dist/models/member-condition-resource.js +95 -0
  478. package/dist/models/member-definition-resource.d.ts +15 -0
  479. package/dist/models/member-definition-resource.js +71 -0
  480. package/dist/models/member-group-resource.d.ts +14 -0
  481. package/dist/models/member-group-resource.js +61 -0
  482. package/dist/models/notifications/distribute-notification-resource.d.ts +7 -0
  483. package/dist/models/notifications/distribute-notification-resource.js +37 -0
  484. package/dist/models/notifications/mail-request-broadcast.d.ts +7 -0
  485. package/dist/models/notifications/mail-request-broadcast.js +18 -0
  486. package/dist/models/notifications/mail-request-by-id.d.ts +9 -0
  487. package/dist/models/notifications/mail-request-by-id.js +28 -0
  488. package/dist/models/notifications/mail-request-by-username.d.ts +9 -0
  489. package/dist/models/notifications/mail-request-by-username.js +28 -0
  490. package/dist/models/notifications/mail-request.d.ts +26 -0
  491. package/dist/models/notifications/mail-request.js +12 -0
  492. package/dist/models/notifications/notification-level.d.ts +8 -0
  493. package/dist/models/notifications/notification-level.js +12 -0
  494. package/dist/models/notifications/realtime-request-broadcast.d.ts +7 -0
  495. package/dist/models/notifications/realtime-request-broadcast.js +18 -0
  496. package/dist/models/notifications/realtime-request-by-id.d.ts +9 -0
  497. package/dist/models/notifications/realtime-request-by-id.js +28 -0
  498. package/dist/models/notifications/realtime-request-by-username.d.ts +9 -0
  499. package/dist/models/notifications/realtime-request-by-username.js +28 -0
  500. package/dist/models/notifications/realtime-request.d.ts +60 -0
  501. package/dist/models/notifications/realtime-request.js +41 -0
  502. package/dist/models/notifications/request-by-id.d.ts +13 -0
  503. package/dist/models/notifications/request-by-id.js +2 -0
  504. package/dist/models/notifications/request-by-username.d.ts +13 -0
  505. package/dist/models/notifications/request-by-username.js +2 -0
  506. package/dist/models/notifications/validators/mail-validator.d.ts +6 -0
  507. package/dist/models/notifications/validators/mail-validator.js +23 -0
  508. package/dist/models/notifications/validators/realtime-validator.d.ts +5 -0
  509. package/dist/models/notifications/validators/realtime-validator.js +14 -0
  510. package/dist/models/notifications/validators/request-by-id-validator.d.ts +6 -0
  511. package/dist/models/notifications/validators/request-by-id-validator.js +31 -0
  512. package/dist/models/notifications/validators/request-by-username-validator.d.ts +6 -0
  513. package/dist/models/notifications/validators/request-by-username-validator.js +31 -0
  514. package/dist/models/notifications/validators/validator-base.d.ts +6 -0
  515. package/dist/models/notifications/validators/validator-base.js +16 -0
  516. package/dist/models/option-lists/flat-option-list-value.d.ts +4 -0
  517. package/dist/models/option-lists/flat-option-list-value.js +9 -0
  518. package/dist/models/option-lists/hierarchical-options-list-value.d.ts +7 -0
  519. package/dist/models/option-lists/hierarchical-options-list-value.js +14 -0
  520. package/dist/models/option-lists/option-list-collection-resource.d.ts +6 -0
  521. package/dist/models/option-lists/option-list-collection-resource.js +32 -0
  522. package/dist/models/option-lists/option-list-description-resource.d.ts +5 -0
  523. package/dist/models/option-lists/option-list-description-resource.js +31 -0
  524. package/dist/models/option-lists/option-list-resource.d.ts +16 -0
  525. package/dist/models/option-lists/option-list-resource.js +62 -0
  526. package/dist/models/option-lists/option-list-value-resource.d.ts +6 -0
  527. package/dist/models/option-lists/option-list-value-resource.js +32 -0
  528. package/dist/models/pages/component-visualization.d.ts +10 -0
  529. package/dist/models/pages/component-visualization.js +54 -0
  530. package/dist/models/pages/language-resource.d.ts +10 -0
  531. package/dist/models/pages/language-resource.js +47 -0
  532. package/dist/models/pages/menu-item.d.ts +12 -0
  533. package/dist/models/pages/menu-item.js +66 -0
  534. package/dist/models/pages/page-component-resource.d.ts +20 -0
  535. package/dist/models/pages/page-component-resource.js +87 -0
  536. package/dist/models/pages/page-resource.d.ts +23 -0
  537. package/dist/models/pages/page-resource.js +100 -0
  538. package/dist/models/pages/page-row-settings.d.ts +27 -0
  539. package/dist/models/pages/page-row-settings.js +119 -0
  540. package/dist/models/pages/portal-column-resource.d.ts +6 -0
  541. package/dist/models/pages/portal-column-resource.js +37 -0
  542. package/dist/models/pages/portal-row-resource.d.ts +7 -0
  543. package/dist/models/pages/portal-row-resource.js +38 -0
  544. package/dist/models/pages/portal-section-resource.d.ts +6 -0
  545. package/dist/models/pages/portal-section-resource.js +37 -0
  546. package/dist/models/permissions-resource.d.ts +4 -0
  547. package/dist/models/permissions-resource.js +28 -0
  548. package/dist/models/policies/condition-resource.d.ts +21 -0
  549. package/dist/models/policies/condition-resource.js +53 -0
  550. package/dist/models/policies/member-policy-resource.d.ts +8 -0
  551. package/dist/models/policies/member-policy-resource.js +43 -0
  552. package/dist/models/policies/policy-resource.d.ts +50 -0
  553. package/dist/models/policies/policy-resource.js +89 -0
  554. package/dist/models/policies/rule-resource.d.ts +49 -0
  555. package/dist/models/policies/rule-resource.js +78 -0
  556. package/dist/models/property-definition-resource.d.ts +45 -0
  557. package/dist/models/property-definition-resource.js +198 -0
  558. package/dist/models/query-loading-resource.d.ts +4 -0
  559. package/dist/models/query-loading-resource.js +28 -0
  560. package/dist/models/query-result-resource.d.ts +9 -0
  561. package/dist/models/query-result-resource.js +34 -0
  562. package/dist/models/relation-definition-resource.d.ts +29 -0
  563. package/dist/models/relation-definition-resource.js +115 -0
  564. package/dist/models/relation-map-resource.d.ts +6 -0
  565. package/dist/models/relation-map-resource.js +16 -0
  566. package/dist/models/relation-resource.d.ts +21 -0
  567. package/dist/models/relation-resource.js +93 -0
  568. package/dist/models/resource-containers/entity-definition-resource-container.d.ts +8 -0
  569. package/dist/models/resource-containers/entity-definition-resource-container.js +2 -0
  570. package/dist/models/resource-containers/entity-resource-container.d.ts +8 -0
  571. package/dist/models/resource-containers/entity-resource-container.js +2 -0
  572. package/dist/models/resource.d.ts +4 -0
  573. package/dist/models/resource.js +26 -0
  574. package/dist/models/search/aggregation-request-resource.d.ts +16 -0
  575. package/dist/models/search/aggregation-request-resource.js +72 -0
  576. package/dist/models/search/aggregation-response-resource.d.ts +8 -0
  577. package/dist/models/search/aggregation-response-resource.js +41 -0
  578. package/dist/models/search/bucket-response-resource.d.ts +8 -0
  579. package/dist/models/search/bucket-response-resource.js +46 -0
  580. package/dist/models/search/date-interval.d.ts +10 -0
  581. package/dist/models/search/date-interval.js +14 -0
  582. package/dist/models/search/facet-response-resource.d.ts +20 -0
  583. package/dist/models/search/facet-response-resource.js +98 -0
  584. package/dist/models/search/field-filter-request-resource.d.ts +16 -0
  585. package/dist/models/search/field-filter-request-resource.js +76 -0
  586. package/dist/models/search/field-filter-response-resource.d.ts +17 -0
  587. package/dist/models/search/field-filter-response-resource.js +84 -0
  588. package/dist/models/search/field-filter-value-response-resource.d.ts +6 -0
  589. package/dist/models/search/field-filter-value-response-resource.js +31 -0
  590. package/dist/models/search/filter-operator.d.ts +86 -0
  591. package/dist/models/search/filter-operator.js +90 -0
  592. package/dist/models/search/full-text-response-resource.d.ts +4 -0
  593. package/dist/models/search/full-text-response-resource.js +27 -0
  594. package/dist/models/search/group-category.d.ts +6 -0
  595. package/dist/models/search/group-category.js +35 -0
  596. package/dist/models/search/group-config.d.ts +4 -0
  597. package/dist/models/search/group-config.js +27 -0
  598. package/dist/models/search/group-item.d.ts +10 -0
  599. package/dist/models/search/group-item.js +44 -0
  600. package/dist/models/search/grouped-view-response-resource.d.ts +15 -0
  601. package/dist/models/search/grouped-view-response-resource.js +65 -0
  602. package/dist/models/search/metric-option-request-resource.d.ts +7 -0
  603. package/dist/models/search/metric-option-request-resource.js +37 -0
  604. package/dist/models/search/metric-option-response-resource.d.ts +5 -0
  605. package/dist/models/search/metric-option-response-resource.js +31 -0
  606. package/dist/models/search/nested-relation-info.d.ts +11 -0
  607. package/dist/models/search/nested-relation-info.js +96 -0
  608. package/dist/models/search/requested-aggregation-type.d.ts +5 -0
  609. package/dist/models/search/requested-aggregation-type.js +9 -0
  610. package/dist/models/search/requested-filter-type.d.ts +6 -0
  611. package/dist/models/search/requested-filter-type.js +10 -0
  612. package/dist/models/search/search-group-request-resource.d.ts +5 -0
  613. package/dist/models/search/search-group-request-resource.js +31 -0
  614. package/dist/models/search/search-request.d.ts +41 -0
  615. package/dist/models/search/search-request.js +131 -0
  616. package/dist/models/search/search-response.d.ts +36 -0
  617. package/dist/models/search/search-response.js +123 -0
  618. package/dist/models/search/selection-pool-filter-resource.d.ts +7 -0
  619. package/dist/models/search/selection-pool-filter-resource.js +38 -0
  620. package/dist/models/search/sorting-request-resource.d.ts +5 -0
  621. package/dist/models/search/sorting-request-resource.js +32 -0
  622. package/dist/models/search/sorting-response-resource.d.ts +6 -0
  623. package/dist/models/search/sorting-response-resource.js +34 -0
  624. package/dist/models/search-document-resource.d.ts +7 -0
  625. package/dist/models/search-document-resource.js +33 -0
  626. package/dist/models/set-password-request-resource.d.ts +5 -0
  627. package/dist/models/set-password-request-resource.js +31 -0
  628. package/dist/settings/fetch-setting.d.ts +12 -0
  629. package/dist/settings/fetch-setting.js +61 -0
  630. package/dist/settings/super-user-excluded-privileges.d.ts +3 -0
  631. package/dist/settings/super-user-excluded-privileges.js +27 -0
  632. package/dist/settings/usage-rights-configuration.d.ts +24 -0
  633. package/dist/settings/usage-rights-configuration.js +90 -0
  634. package/dist/type-guards.d.ts +20 -0
  635. package/dist/type-guards.js +28 -0
  636. package/package.json +78 -0
@@ -0,0 +1,35 @@
1
+ import { MailRequestBroadcast } from "../models/notifications/mail-request-broadcast";
2
+ import { MailRequestById } from "../models/notifications/mail-request-by-id";
3
+ import { MailRequestByUsername } from "../models/notifications/mail-request-by-username";
4
+ import { RealtimeRequestBroadcast } from "../models/notifications/realtime-request-broadcast";
5
+ import { RealtimeRequestById } from "../models/notifications/realtime-request-by-id";
6
+ import { RealtimeRequestByUsername } from "../models/notifications/realtime-request-by-username";
7
+ import { IExtendedContentHubClient } from "./extended-client";
8
+ export interface INotificationsClient {
9
+ /**
10
+ * Sends a registration confirmation e-mail to the specified users by id.
11
+ * This action requires the 'SendConfirmationEmail' privilege.
12
+ * @param usernames - Usernames or ids that will receive the registration confirmation e-mail
13
+ */
14
+ sendConfirmationEmailAsync(usernames: Array<string> | Array<number>): Promise<void>;
15
+ /**
16
+ * Sends an e-mail to users by user id, username or to all users.
17
+ * @param mailRequest - must have type MailRequestById | MailRequestByUsername | MailRequestBroadcast
18
+ */
19
+ sendEmailNotificationAsync(mailRequest: MailRequestById | MailRequestByUsername | MailRequestBroadcast): Promise<void>;
20
+ /**
21
+ * Sends a real-time notification (browser notification) to users by user id, username or to all users.
22
+ * @param realtimeRequest - must have type RealtimeRequestById | RealtimeRequestByUsername | RealtimeRequestBroadcast
23
+ */
24
+ sendRealTimeNotificationAsync(realtimeRequest: RealtimeRequestById | RealtimeRequestByUsername | RealtimeRequestBroadcast): Promise<void>;
25
+ }
26
+ export declare class NotificationsClient implements INotificationsClient {
27
+ private readonly _client;
28
+ constructor(client: IExtendedContentHubClient);
29
+ sendConfirmationEmailAsync(users: Array<string> | Array<number>): Promise<void>;
30
+ sendEmailNotificationAsync(mailRequest: MailRequestById | MailRequestByUsername | MailRequestBroadcast): Promise<void>;
31
+ sendRealTimeNotificationAsync(realtimeRequest: RealtimeRequestById | RealtimeRequestByUsername | RealtimeRequestBroadcast): Promise<void>;
32
+ private sendPrivateEmailNotificationAsync;
33
+ private sendPrivateRealTimeNotificationAsync;
34
+ private sendNotificationAsync;
35
+ }
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.NotificationsClient = void 0;
16
+ const ta_json_1 = require("ta-json");
17
+ const constants_1 = require("../constants");
18
+ const guard_1 = __importDefault(require("../guard"));
19
+ const notification_mapper_1 = require("../mappers/notification-mapper");
20
+ const distribute_notification_resource_1 = require("../models/notifications/distribute-notification-resource");
21
+ const type_guards_1 = require("../type-guards");
22
+ const response_handler_1 = require("./response-handler");
23
+ class NotificationsClient {
24
+ constructor(client) {
25
+ guard_1.default.notNullOrUndefined(client);
26
+ this._client = client;
27
+ }
28
+ //! Not necessary for now, can be added later (lots of boilerplate)
29
+ // public async getMailTemplateAsync(name: string, loadConfiguration: Nullable<IEntityLoadConfiguration> = null)
30
+ sendConfirmationEmailAsync(users) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ let userIds = [];
33
+ if (type_guards_1.TypeGuards.isStringArray(users)) {
34
+ userIds = (yield this._client.users.getUserIdsAsync(users));
35
+ }
36
+ else {
37
+ userIds = users;
38
+ }
39
+ guard_1.default.validIds(userIds);
40
+ for (const userId of userIds) {
41
+ const link = yield this._client.linkHelper.sendConfirmationMailToLinkAsync(userId);
42
+ const response = yield this._client.raw.postAsync(link.href, ta_json_1.TaJson.serialize(userId));
43
+ response_handler_1.ResponseHandler.handleErrors(response);
44
+ }
45
+ });
46
+ }
47
+ sendEmailNotificationAsync(mailRequest) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ guard_1.default.notNullOrUndefined(mailRequest);
50
+ mailRequest.validate();
51
+ if ("recipients" in mailRequest) {
52
+ if (type_guards_1.TypeGuards.isStringArray(mailRequest.recipients)) {
53
+ // Usernames
54
+ const mailUsernames = mailRequest;
55
+ const ids = yield this._client.users.getUserIdsAsync(mailUsernames.recipients);
56
+ if (ids !== null) {
57
+ yield this.sendPrivateEmailNotificationAsync(mailUsernames, ids);
58
+ }
59
+ }
60
+ else {
61
+ // Ids
62
+ const mailIds = mailRequest;
63
+ yield this.sendPrivateEmailNotificationAsync(mailIds, mailIds.recipients);
64
+ }
65
+ }
66
+ else {
67
+ // Broadcast
68
+ yield this.sendPrivateEmailNotificationAsync(mailRequest, null);
69
+ }
70
+ });
71
+ }
72
+ sendRealTimeNotificationAsync(realtimeRequest) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ guard_1.default.notNull(realtimeRequest);
75
+ realtimeRequest.validate();
76
+ if ("recipients" in realtimeRequest) {
77
+ if (type_guards_1.TypeGuards.isStringArray(realtimeRequest.recipients)) {
78
+ // Usernames
79
+ const realtimeUsers = realtimeRequest;
80
+ const ids = yield this._client.users.getUserIdsAsync(realtimeUsers.recipients);
81
+ if (ids !== null) {
82
+ yield this.sendPrivateRealTimeNotificationAsync(realtimeRequest, ids);
83
+ }
84
+ }
85
+ else {
86
+ // Ids
87
+ const realtimeIds = realtimeRequest;
88
+ yield this.sendPrivateRealTimeNotificationAsync(realtimeIds, realtimeIds.recipients);
89
+ }
90
+ }
91
+ else {
92
+ // Broadcast
93
+ yield this.sendPrivateRealTimeNotificationAsync(realtimeRequest, null);
94
+ }
95
+ });
96
+ }
97
+ //#region Private functions
98
+ sendPrivateEmailNotificationAsync(mailRequest, recipients) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ return this.sendNotificationAsync(mailRequest.mailTemplateName, recipients, "EmailNotification", mailRequest.variables);
101
+ });
102
+ }
103
+ sendPrivateRealTimeNotificationAsync(realtimeRequest, recipients) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ const parameters = notification_mapper_1.NotificationMapper.mapParameters(realtimeRequest);
106
+ return this.sendNotificationAsync(constants_1.NOTIFICATIONS.REALTIME.raw, recipients, "RealTimeNotification", parameters);
107
+ });
108
+ }
109
+ sendNotificationAsync(notificationName, recipients, channel, parameters) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ const link = yield this._client.linkHelper.sendNotificationToLinkAsync(notificationName);
112
+ // Get user links.
113
+ let userLinks = null;
114
+ const linkPromises = recipients === null || recipients === void 0 ? void 0 : recipients.map(id => this._client.linkHelper.entityToLinkAsync(id));
115
+ if (linkPromises != null) {
116
+ userLinks = yield Promise.all(linkPromises);
117
+ }
118
+ // Create the resource.
119
+ const resource = new distribute_notification_resource_1.DistributeNotificationResource();
120
+ resource.recipients = userLinks;
121
+ resource.channels = [channel];
122
+ resource.parameters = parameters;
123
+ const response = yield this._client.raw.postAsync(link.href, ta_json_1.TaJson.serialize(resource));
124
+ response_handler_1.ResponseHandler.handleErrors(response);
125
+ });
126
+ }
127
+ }
128
+ exports.NotificationsClient = NotificationsClient;
@@ -0,0 +1,49 @@
1
+ import { NullableResultPromise } from "../base-types";
2
+ import { IOptionList } from "../contracts/base/option-lists/option-list";
3
+ import OptionListDescriptionResource from "../models/option-lists/option-list-description-resource";
4
+ import { IExtendedContentHubClient } from "./extended-client";
5
+ export interface IOptionListClient {
6
+ /**
7
+ * Gets the names of all option lists that exist.
8
+ */
9
+ getAllNamesAsync(): Promise<Array<string>>;
10
+ /**
11
+ * Gets an array of all options list descriptions.
12
+ */
13
+ getAllDescriptionsAsync(): Promise<Array<OptionListDescriptionResource>>;
14
+ /**
15
+ * Gets the option list with the specified name.
16
+ *
17
+ * @param name - the option list name
18
+ */
19
+ getAsync(name: string): NullableResultPromise<IOptionList>;
20
+ /**
21
+ * Creates a new option list
22
+ *
23
+ * @param optionList - {@link IOptionList} - the option list instance
24
+ */
25
+ createAsync(optionList: IOptionList): Promise<void>;
26
+ /**
27
+ * Update an existing option list
28
+ *
29
+ * @param optionList - {@link IOptionList} - the option list instance
30
+ */
31
+ updateAsync(optionList: IOptionList): Promise<void>;
32
+ /**
33
+ * Delete an existing option list
34
+ *
35
+ * @param name - the name of the option list
36
+ */
37
+ deleteAsync(name: string): Promise<void>;
38
+ }
39
+ export declare class OptionListClient implements IOptionListClient {
40
+ private readonly _client;
41
+ private readonly _mapper;
42
+ constructor(client: IExtendedContentHubClient);
43
+ getAllNamesAsync(): Promise<Array<string>>;
44
+ getAllDescriptionsAsync(): Promise<Array<OptionListDescriptionResource>>;
45
+ getAsync(name: string): NullableResultPromise<IOptionList>;
46
+ createAsync(optionList: IOptionList): Promise<void>;
47
+ updateAsync(optionList: IOptionList): Promise<void>;
48
+ deleteAsync(name: string): Promise<void>;
49
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.OptionListClient = void 0;
16
+ const ta_json_1 = require("ta-json");
17
+ const guard_1 = __importDefault(require("../guard"));
18
+ const option_list_mapper_1 = require("../mappers/option-list-mapper");
19
+ const option_list_collection_resource_1 = __importDefault(require("../models/option-lists/option-list-collection-resource"));
20
+ const option_list_resource_1 = __importDefault(require("../models/option-lists/option-list-resource"));
21
+ const response_handler_1 = require("./response-handler");
22
+ class OptionListClient {
23
+ constructor(client) {
24
+ this._client = client;
25
+ this._mapper = new option_list_mapper_1.OptionListMapper(client);
26
+ }
27
+ getAllNamesAsync() {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const link = yield this._client.linkHelper.dataSourcesLinkAsync();
30
+ const response = yield this._client.raw.getAsync(link.href);
31
+ const resource = ta_json_1.TaJson.deserialize(response.content, option_list_collection_resource_1.default);
32
+ const names = resource.items.map(item => item.name);
33
+ return names;
34
+ });
35
+ }
36
+ getAllDescriptionsAsync() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const link = yield this._client.linkHelper.dataSourcesLinkAsync();
39
+ const response = yield this._client.raw.getAsync(link.href);
40
+ const resource = ta_json_1.TaJson.deserialize(response.content, option_list_collection_resource_1.default);
41
+ return resource.items;
42
+ });
43
+ }
44
+ getAsync(name) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ guard_1.default.stringNotNullOrEmpty(name);
47
+ const link = yield this._client.linkHelper.dataSourceToLinkAsync(name);
48
+ const response = yield this._client.raw.getAsync(link.href);
49
+ if (response.statusCode === 404) {
50
+ return null;
51
+ }
52
+ response_handler_1.ResponseHandler.handleErrors(response);
53
+ const resource = ta_json_1.TaJson.deserialize(response.content, option_list_resource_1.default);
54
+ const optionList = this._mapper.mapOptionListAsync(resource);
55
+ return optionList;
56
+ });
57
+ }
58
+ createAsync(optionList) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ guard_1.default.notNull(optionList, "optionList");
61
+ const resource = this._mapper.map(optionList);
62
+ const link = yield this._client.linkHelper.dataSourcesLinkAsync();
63
+ const response = yield this._client.raw.postAsync(link.href, ta_json_1.TaJson.serialize(resource));
64
+ response_handler_1.ResponseHandler.handleErrors(response);
65
+ });
66
+ }
67
+ updateAsync(optionList) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ guard_1.default.notNull(optionList, "optionList");
70
+ const resource = this._mapper.map(optionList);
71
+ const link = yield this._client.linkHelper.dataSourceToLinkAsync(optionList.name);
72
+ const response = yield this._client.raw.putAsync(link.href, ta_json_1.TaJson.serialize(resource));
73
+ response_handler_1.ResponseHandler.handleErrors(response);
74
+ });
75
+ }
76
+ deleteAsync(name) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ guard_1.default.stringNotNullOrEmpty(name);
79
+ const link = yield this._client.linkHelper.dataSourceToLinkAsync(name);
80
+ const response = yield this._client.raw.deleteAsync(link.href);
81
+ response_handler_1.ResponseHandler.handleErrors(response);
82
+ });
83
+ }
84
+ }
85
+ exports.OptionListClient = OptionListClient;
@@ -0,0 +1,36 @@
1
+ import CultureInfo from "../culture-info";
2
+ import { PageResource } from "../models/pages/page-resource";
3
+ import { IExtendedContentHubClient } from "./extended-client";
4
+ export interface IPagesClient {
5
+ /**
6
+ * Get a page resource by identifier.
7
+ * @param identifier - The identifier of the page
8
+ * @param culture - A culture to load the page in
9
+ * @returns A promise resolving to a {@link PageResource}.
10
+ * @throws An error when the resource can't be found.
11
+ */
12
+ getPageByIdentifierAsync(identifier: string, culture: CultureInfo): Promise<PageResource>;
13
+ /**
14
+ * Get a page resource by name.
15
+ * @param name - The name of the page
16
+ * @param culture - A culture to load the page in
17
+ * @returns A promise resolving to a {@link PageResource}.
18
+ * @throws An error when the resource can't be found.
19
+ */
20
+ getPageByNameAsync(name: string, culture: CultureInfo): Promise<PageResource>;
21
+ /**
22
+ * Get a page resource by id.
23
+ * @param id - The id of the page
24
+ * @param culture - A culture to load the page in
25
+ * @returns A promise resolving to a {@link PageResource}.
26
+ * @throws An error when the resource can't be found.
27
+ */
28
+ getPageByIdAsync(id: number, culture: CultureInfo): Promise<PageResource>;
29
+ }
30
+ export declare class PagesClient implements IPagesClient {
31
+ private readonly _client;
32
+ constructor(client: IExtendedContentHubClient);
33
+ getPageByNameAsync(name: string, culture: CultureInfo): Promise<PageResource>;
34
+ getPageByIdentifierAsync(identifier: string, culture: CultureInfo): Promise<PageResource>;
35
+ getPageByIdAsync(id: number, culture: CultureInfo): Promise<PageResource>;
36
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.PagesClient = void 0;
16
+ const ta_json_1 = require("ta-json");
17
+ const guard_1 = __importDefault(require("../guard"));
18
+ const page_resource_1 = require("../models/pages/page-resource");
19
+ const response_handler_1 = require("./response-handler");
20
+ class PagesClient {
21
+ constructor(client) {
22
+ this._client = client;
23
+ }
24
+ getPageByNameAsync(name, culture) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ guard_1.default.stringNotNullOrEmpty(name);
27
+ guard_1.default.notNullOrUndefined(culture);
28
+ return this.getPageByIdentifierAsync(name, culture);
29
+ });
30
+ }
31
+ getPageByIdentifierAsync(identifier, culture) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ guard_1.default.stringNotNullOrEmpty(identifier);
34
+ guard_1.default.notNullOrUndefined(culture);
35
+ const link = yield this._client.linkHelper.pageResourceToLinkAsync(identifier, culture);
36
+ const response = yield this._client.raw.getAsync(link.href);
37
+ response_handler_1.ResponseHandler.handleErrors(response);
38
+ return ta_json_1.TaJson.deserialize(response.content, page_resource_1.PageResource);
39
+ });
40
+ }
41
+ getPageByIdAsync(id, culture) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ guard_1.default.validId(id);
44
+ guard_1.default.notNullOrUndefined(culture);
45
+ const link = yield this._client.linkHelper.pageResourceToLinkAsync(id, culture);
46
+ const response = yield this._client.raw.getAsync(link.href);
47
+ response_handler_1.ResponseHandler.handleErrors(response);
48
+ return ta_json_1.TaJson.deserialize(response.content, page_resource_1.PageResource);
49
+ });
50
+ }
51
+ }
52
+ exports.PagesClient = PagesClient;
@@ -0,0 +1,47 @@
1
+ import { NullableResultPromise } from "../base-types";
2
+ import { IPolicy } from "../contracts/policies/policy";
3
+ import { IUserGroupPolicy } from "../contracts/policies/user-group-policy";
4
+ import { IUserPolicy } from "../contracts/policies/user-policy";
5
+ import { IExtendedContentHubClient } from "./extended-client";
6
+ /**
7
+ * Contains functionality to get and update policies.
8
+ */
9
+ export interface IPoliciesClient {
10
+ /**
11
+ * Gets the policy from specified user.
12
+ *
13
+ * @remarks
14
+ * The specified user group id must be a strictly positive number.
15
+ *
16
+ * @param userGroupId - Id of the user group to get the policy from
17
+ * @returns The policy or null when it was not found.
18
+ */
19
+ getUserGroupPolicyAsync(userGroupId: number): NullableResultPromise<IUserGroupPolicy>;
20
+ /**
21
+ * Gets the policy from specified user.
22
+ *
23
+ * @remarks
24
+ * The specified user id must be a strictly positive number.
25
+ *
26
+ * @param userId - Id of the user to get the policy from
27
+ * @returns The policy or null when it was not found.
28
+ */
29
+ getUserPolicyAsync(userId: number): NullableResultPromise<IUserPolicy>;
30
+ /**
31
+ * Updates the specified policy.
32
+ *
33
+ * @remarks
34
+ * Throws an error when the policy could not be saved because a validation error occurred.
35
+ *
36
+ * @param policy - The policy to update
37
+ */
38
+ updateAsync(policy: IPolicy): Promise<void>;
39
+ }
40
+ export declare class PoliciesClient implements IPoliciesClient {
41
+ private readonly _client;
42
+ constructor(client: IExtendedContentHubClient);
43
+ getUserGroupPolicyAsync(userGroupId: number): NullableResultPromise<IUserGroupPolicy>;
44
+ getUserPolicyAsync(userId: number): NullableResultPromise<IUserPolicy>;
45
+ updateAsync(policy: IPolicy): Promise<void>;
46
+ private getPolicyResourceAsync;
47
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.PoliciesClient = void 0;
35
+ const HttpStatus = __importStar(require("http-status-codes"));
36
+ const ta_json_1 = require("ta-json");
37
+ const error_messages_1 = __importDefault(require("../error-messages"));
38
+ const invalid_operation_error_1 = require("../errors/invalid-operation-error");
39
+ const guard_1 = __importDefault(require("../guard"));
40
+ const policy_mapper_1 = require("../mappers/policy-mapper");
41
+ const policy_resource_1 = require("../models/policies/policy-resource");
42
+ const response_handler_1 = require("./response-handler");
43
+ class PoliciesClient {
44
+ constructor(client) {
45
+ guard_1.default.notNull(client);
46
+ this._client = client;
47
+ }
48
+ getUserGroupPolicyAsync(userGroupId) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ guard_1.default.validId(userGroupId);
51
+ const resource = yield this.getPolicyResourceAsync(userGroupId);
52
+ const result = yield policy_mapper_1.PolicyMapper.mapToUserGroupPolicyAsync(this._client, resource);
53
+ return result;
54
+ });
55
+ }
56
+ getUserPolicyAsync(userId) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ guard_1.default.validId(userId);
59
+ const resource = yield this.getPolicyResourceAsync(userId);
60
+ const result = yield policy_mapper_1.PolicyMapper.mapToUserPolicyAsync(this._client, resource);
61
+ return result;
62
+ });
63
+ }
64
+ updateAsync(policy) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ guard_1.default.notNull(policy);
67
+ const resource = yield policy_mapper_1.PolicyMapper.mapToResourceAsync(this._client, policy);
68
+ const id = policy.getRelatedId();
69
+ if (id == null) {
70
+ throw new invalid_operation_error_1.InvalidOperationError(error_messages_1.default.PoliciesClient.RelatedIdCannotBeNull);
71
+ }
72
+ const link = yield this._client.linkHelper.policyToLinkAsync(id);
73
+ const content = ta_json_1.TaJson.serialize(resource);
74
+ const response = yield this._client.raw.postAsync(link.href, content);
75
+ response_handler_1.ResponseHandler.handleErrors(response);
76
+ });
77
+ }
78
+ //#region Private methods
79
+ getPolicyResourceAsync(id) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const link = yield this._client.linkHelper.policyToLinkAsync(id);
82
+ const response = yield this._client.raw.getAsync(link.href);
83
+ if (response.statusCode === HttpStatus.NOT_FOUND) {
84
+ return null;
85
+ }
86
+ response_handler_1.ResponseHandler.handleErrors(response);
87
+ const resource = ta_json_1.TaJson.deserialize(response.content, policy_resource_1.PolicyResource);
88
+ return resource;
89
+ });
90
+ }
91
+ }
92
+ exports.PoliciesClient = PoliciesClient;
@@ -0,0 +1,34 @@
1
+ import { Nullable, NullableResultPromise } from "../base-types";
2
+ import { IEntity } from "../contracts/base/entity";
3
+ import { IEntityLoadConfiguration } from "../contracts/querying/entity-load-configuration";
4
+ import { IEntityQueryResult } from "../contracts/querying/entity-query-result";
5
+ import { IIdQueryResult } from "../contracts/querying/id-query-result";
6
+ import { Query } from "../contracts/querying/query";
7
+ import { IQueryLoadConfiguration } from "../contracts/querying/query-load-configuration";
8
+ import { IContentHubClient } from "./content-hub-client";
9
+ import { IExtendedContentHubClient } from "./extended-client";
10
+ export interface IQueryingClient {
11
+ singleAsync(query: Query, loadConfiguration?: IEntityLoadConfiguration): NullableResultPromise<IEntity>;
12
+ singleIdAsync(query: Query): NullableResultPromise<number>;
13
+ queryAsync(query: Query): Promise<IEntityQueryResult>;
14
+ queryAsync(query: Query, loadConfiguration?: Nullable<IEntityLoadConfiguration>): Promise<IEntityQueryResult>;
15
+ queryIdsAsync(query: Query): Promise<IIdQueryResult>;
16
+ }
17
+ declare abstract class QueryingClientBase implements IQueryingClient {
18
+ protected readonly _client: IContentHubClient;
19
+ constructor(client: IContentHubClient);
20
+ singleAsync(query: Query, loadConfiguration?: IEntityLoadConfiguration): NullableResultPromise<IEntity>;
21
+ singleIdAsync(query: Query): NullableResultPromise<number>;
22
+ abstract queryAsync(query: Query, loadConfiguration?: Nullable<IEntityLoadConfiguration>): Promise<IEntityQueryResult>;
23
+ abstract queryIdsAsync(query: Query): Promise<IIdQueryResult>;
24
+ protected resolveLoadConfiguration(query: Query, loadConfiguration?: IEntityLoadConfiguration): Nullable<IQueryLoadConfiguration>;
25
+ }
26
+ export declare class QueryingClient extends QueryingClientBase {
27
+ private readonly _extendedClient;
28
+ private readonly _mapper;
29
+ private readonly _schemaQuerying;
30
+ constructor(client: IExtendedContentHubClient);
31
+ queryAsync(query: Query, loadConfiguration?: Nullable<IEntityLoadConfiguration>): Promise<IEntityQueryResult>;
32
+ queryIdsAsync(query: Query): Promise<IIdQueryResult>;
33
+ }
34
+ export {};
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.QueryingClient = void 0;
16
+ const query_load_configuration_1 = require("../contracts/querying/query-load-configuration");
17
+ const error_messages_1 = __importDefault(require("../error-messages"));
18
+ const invalid_operation_error_1 = require("../errors/invalid-operation-error");
19
+ const guard_1 = __importDefault(require("../guard"));
20
+ const load_options_mapper_1 = require("../mappers/load-options-mapper");
21
+ const querying_mapper_1 = require("../mappers/querying-mapper");
22
+ const schema_querying_1 = require("./schema-querying");
23
+ class QueryingClientBase {
24
+ constructor(client) {
25
+ guard_1.default.notNullOrUndefined(client);
26
+ this._client = client;
27
+ }
28
+ singleAsync(query, loadConfiguration) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ guard_1.default.notNullOrUndefined(query);
31
+ const result = yield this.queryAsync(query, loadConfiguration);
32
+ if (result.items.length === 0) {
33
+ return null;
34
+ }
35
+ else if (result.items.length > 1) {
36
+ throw new invalid_operation_error_1.InvalidOperationError(error_messages_1.default.QueryingClient.MultipleResults);
37
+ }
38
+ return result.items[0];
39
+ });
40
+ }
41
+ singleIdAsync(query) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ guard_1.default.notNullOrUndefined(query);
44
+ const result = yield this.queryIdsAsync(query);
45
+ if (result.items.length === 0) {
46
+ return null;
47
+ }
48
+ else if (result.items.length > 1) {
49
+ throw new invalid_operation_error_1.InvalidOperationError(error_messages_1.default.QueryingClient.MultipleResults);
50
+ }
51
+ return result.items[0];
52
+ });
53
+ }
54
+ //? deprecated
55
+ resolveLoadConfiguration(query, loadConfiguration) {
56
+ let queryLoadConfiguration;
57
+ if (loadConfiguration != null) {
58
+ queryLoadConfiguration = load_options_mapper_1.LoadOptionsMapper.toQueryLoadConfiguration(loadConfiguration);
59
+ }
60
+ else {
61
+ queryLoadConfiguration = query_load_configuration_1.QueryLoadConfiguration.Default;
62
+ }
63
+ return queryLoadConfiguration;
64
+ }
65
+ }
66
+ class QueryingClient extends QueryingClientBase {
67
+ constructor(client) {
68
+ super(client);
69
+ guard_1.default.notNullOrUndefined(client);
70
+ this._extendedClient = client;
71
+ this._schemaQuerying = new schema_querying_1.SchemaQuerying(client);
72
+ this._mapper = new querying_mapper_1.QueryingMapper(client);
73
+ }
74
+ queryAsync(query, loadConfiguration) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ guard_1.default.notNullOrUndefined(query, "query");
77
+ //TODO query.validate();
78
+ const queryLoadConfiguration = this.resolveLoadConfiguration(query, loadConfiguration || undefined);
79
+ const resource = yield this._schemaQuerying.queryWithSchemaAsync(query, queryLoadConfiguration);
80
+ loadConfiguration = load_options_mapper_1.LoadOptionsMapper.toEntityLoadConfiguration(queryLoadConfiguration || undefined);
81
+ const result = yield this._mapper.mapEntityQueryResultAsync(resource, query, loadConfiguration);
82
+ return result;
83
+ });
84
+ }
85
+ queryIdsAsync(query) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ guard_1.default.notNullOrUndefined(query, "query");
88
+ //TODO query.validate();
89
+ const resource = yield this._schemaQuerying.queryWithSchemaAsync(query, query_load_configuration_1.QueryLoadConfiguration.Ids);
90
+ const result = yield this._mapper.mapEntityIdQueryResultAsync(resource, query);
91
+ return result;
92
+ });
93
+ }
94
+ }
95
+ exports.QueryingClient = QueryingClient;