@esri/hub-common 9.14.0 → 9.17.0

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 (295) hide show
  1. package/dist/es2017/ArcGISContext.js +72 -26
  2. package/dist/es2017/ArcGISContext.js.map +1 -1
  3. package/dist/es2017/ArcGISContextManager.js +20 -9
  4. package/dist/es2017/ArcGISContextManager.js.map +1 -1
  5. package/dist/es2017/Hub.js +70 -0
  6. package/dist/es2017/Hub.js.map +1 -0
  7. package/dist/es2017/HubError.js +34 -0
  8. package/dist/es2017/HubError.js.map +1 -0
  9. package/dist/es2017/collections.js +23 -0
  10. package/dist/es2017/collections.js.map +1 -1
  11. package/dist/es2017/content/_internal.js +12 -0
  12. package/dist/es2017/content/_internal.js.map +1 -1
  13. package/dist/es2017/content/index.js +42 -18
  14. package/dist/es2017/content/index.js.map +1 -1
  15. package/dist/es2017/core/helpers/PropertyMapper.js +95 -0
  16. package/dist/es2017/core/helpers/PropertyMapper.js.map +1 -0
  17. package/dist/es2017/core/index.js +3 -0
  18. package/dist/es2017/core/index.js.map +1 -0
  19. package/dist/es2017/core/traits/WithBannerImage.js +1 -0
  20. package/dist/es2017/core/traits/WithBannerImage.js.map +1 -0
  21. package/dist/es2017/core/traits/WithLayout.js +1 -0
  22. package/dist/es2017/core/traits/WithLayout.js.map +1 -0
  23. package/dist/es2017/core/traits/WithSlug.js +1 -0
  24. package/dist/es2017/core/traits/WithSlug.js.map +1 -0
  25. package/dist/es2017/core/traits/index.js +4 -0
  26. package/dist/es2017/core/traits/index.js.map +1 -0
  27. package/dist/es2017/core/types/IContentEnrichments.js +1 -0
  28. package/dist/es2017/core/types/IContentEnrichments.js.map +1 -0
  29. package/dist/es2017/core/types/IHubContent.js +1 -0
  30. package/dist/es2017/core/types/IHubContent.js.map +1 -0
  31. package/dist/es2017/core/types/IHubEntityBase.js +1 -0
  32. package/dist/es2017/core/types/IHubEntityBase.js.map +1 -0
  33. package/dist/es2017/core/types/IHubEntityManager.js +1 -0
  34. package/dist/es2017/core/types/IHubEntityManager.js.map +1 -0
  35. package/dist/es2017/core/types/IHubEvent.js +1 -0
  36. package/dist/es2017/core/types/IHubEvent.js.map +1 -0
  37. package/dist/es2017/core/types/IHubImage.js +1 -0
  38. package/dist/es2017/core/types/IHubImage.js.map +1 -0
  39. package/dist/es2017/core/types/IHubInitiative.js +1 -0
  40. package/dist/es2017/core/types/IHubInitiative.js.map +1 -0
  41. package/dist/es2017/core/types/IHubItemEntity.js +1 -0
  42. package/dist/es2017/core/types/IHubItemEntity.js.map +1 -0
  43. package/dist/es2017/core/types/IHubLayout.js +1 -0
  44. package/dist/es2017/core/types/IHubLayout.js.map +1 -0
  45. package/dist/es2017/core/types/IHubPage.js +1 -0
  46. package/dist/es2017/core/types/IHubPage.js.map +1 -0
  47. package/dist/es2017/core/types/IHubProject.js +1 -0
  48. package/dist/es2017/core/types/IHubProject.js.map +1 -0
  49. package/dist/es2017/core/types/IHubSite.js +1 -0
  50. package/dist/es2017/core/types/IHubSite.js.map +1 -0
  51. package/dist/es2017/core/types/IHubTimeline.js +1 -0
  52. package/dist/es2017/core/types/IHubTimeline.js.map +1 -0
  53. package/dist/es2017/core/types/IItemEnrichments.js +1 -0
  54. package/dist/es2017/core/types/IItemEnrichments.js.map +1 -0
  55. package/dist/es2017/core/types/index.js +15 -0
  56. package/dist/es2017/core/types/index.js.map +1 -0
  57. package/dist/es2017/index.js +11 -6
  58. package/dist/es2017/index.js.map +1 -1
  59. package/dist/es2017/items/fail-safe-update.js +2 -2
  60. package/dist/es2017/items/fail-safe-update.js.map +1 -1
  61. package/dist/es2017/items/get-model-from-options.js +2 -2
  62. package/dist/es2017/items/get-model-from-options.js.map +1 -1
  63. package/dist/es2017/items/index.js +2 -3
  64. package/dist/es2017/items/index.js.map +1 -1
  65. package/dist/es2017/items/slugs.js +92 -0
  66. package/dist/es2017/items/slugs.js.map +1 -0
  67. package/dist/es2017/models/index.js +98 -0
  68. package/dist/es2017/models/index.js.map +1 -0
  69. package/dist/es2017/{items/serialize-model.js → models/serializeModel.js} +1 -1
  70. package/dist/es2017/models/serializeModel.js.map +1 -0
  71. package/dist/es2017/projects/HubProjectManager.js +115 -0
  72. package/dist/es2017/projects/HubProjectManager.js.map +1 -0
  73. package/dist/es2017/projects/HubProjects.js +194 -0
  74. package/dist/es2017/projects/HubProjects.js.map +1 -0
  75. package/dist/es2017/projects/index.js +3 -0
  76. package/dist/es2017/projects/index.js.map +1 -0
  77. package/dist/es2017/utils/dasherize.js +25 -0
  78. package/dist/es2017/utils/dasherize.js.map +1 -0
  79. package/dist/es2017/utils/index.js +1 -0
  80. package/dist/es2017/utils/index.js.map +1 -1
  81. package/dist/esm/ArcGISContext.js +76 -26
  82. package/dist/esm/ArcGISContext.js.map +1 -1
  83. package/dist/esm/ArcGISContextManager.js +20 -9
  84. package/dist/esm/ArcGISContextManager.js.map +1 -1
  85. package/dist/esm/Hub.js +89 -0
  86. package/dist/esm/Hub.js.map +1 -0
  87. package/dist/esm/HubError.js +40 -0
  88. package/dist/esm/HubError.js.map +1 -0
  89. package/dist/esm/collections.js +23 -0
  90. package/dist/esm/collections.js.map +1 -1
  91. package/dist/esm/content/_internal.js +14 -0
  92. package/dist/esm/content/_internal.js.map +1 -1
  93. package/dist/esm/content/index.js +42 -18
  94. package/dist/esm/content/index.js.map +1 -1
  95. package/dist/esm/core/helpers/PropertyMapper.js +97 -0
  96. package/dist/esm/core/helpers/PropertyMapper.js.map +1 -0
  97. package/dist/esm/core/index.js +3 -0
  98. package/dist/esm/core/index.js.map +1 -0
  99. package/dist/esm/core/traits/WithBannerImage.js +1 -0
  100. package/dist/esm/core/traits/WithBannerImage.js.map +1 -0
  101. package/dist/esm/core/traits/WithLayout.js +1 -0
  102. package/dist/esm/core/traits/WithLayout.js.map +1 -0
  103. package/dist/esm/core/traits/WithSlug.js +1 -0
  104. package/dist/esm/core/traits/WithSlug.js.map +1 -0
  105. package/dist/esm/core/traits/index.js +4 -0
  106. package/dist/esm/core/traits/index.js.map +1 -0
  107. package/dist/esm/core/types/IContentEnrichments.js +1 -0
  108. package/dist/esm/core/types/IContentEnrichments.js.map +1 -0
  109. package/dist/esm/core/types/IHubContent.js +1 -0
  110. package/dist/esm/core/types/IHubContent.js.map +1 -0
  111. package/dist/esm/core/types/IHubEntityBase.js +1 -0
  112. package/dist/esm/core/types/IHubEntityBase.js.map +1 -0
  113. package/dist/esm/core/types/IHubEntityManager.js +1 -0
  114. package/dist/esm/core/types/IHubEntityManager.js.map +1 -0
  115. package/dist/esm/core/types/IHubEvent.js +1 -0
  116. package/dist/esm/core/types/IHubEvent.js.map +1 -0
  117. package/dist/esm/core/types/IHubImage.js +1 -0
  118. package/dist/esm/core/types/IHubImage.js.map +1 -0
  119. package/dist/esm/core/types/IHubInitiative.js +1 -0
  120. package/dist/esm/core/types/IHubInitiative.js.map +1 -0
  121. package/dist/esm/core/types/IHubItemEntity.js +1 -0
  122. package/dist/esm/core/types/IHubItemEntity.js.map +1 -0
  123. package/dist/esm/core/types/IHubLayout.js +1 -0
  124. package/dist/esm/core/types/IHubLayout.js.map +1 -0
  125. package/dist/esm/core/types/IHubPage.js +1 -0
  126. package/dist/esm/core/types/IHubPage.js.map +1 -0
  127. package/dist/esm/core/types/IHubProject.js +1 -0
  128. package/dist/esm/core/types/IHubProject.js.map +1 -0
  129. package/dist/esm/core/types/IHubSite.js +1 -0
  130. package/dist/esm/core/types/IHubSite.js.map +1 -0
  131. package/dist/esm/core/types/IHubTimeline.js +1 -0
  132. package/dist/esm/core/types/IHubTimeline.js.map +1 -0
  133. package/dist/esm/core/types/IItemEnrichments.js +1 -0
  134. package/dist/esm/core/types/IItemEnrichments.js.map +1 -0
  135. package/dist/esm/core/types/index.js +15 -0
  136. package/dist/esm/core/types/index.js.map +1 -0
  137. package/dist/esm/index.js +11 -6
  138. package/dist/esm/index.js.map +1 -1
  139. package/dist/esm/items/fail-safe-update.js +2 -2
  140. package/dist/esm/items/fail-safe-update.js.map +1 -1
  141. package/dist/esm/items/get-model-from-options.js +2 -2
  142. package/dist/esm/items/get-model-from-options.js.map +1 -1
  143. package/dist/esm/items/index.js +2 -3
  144. package/dist/esm/items/index.js.map +1 -1
  145. package/dist/esm/items/slugs.js +93 -0
  146. package/dist/esm/items/slugs.js.map +1 -0
  147. package/dist/esm/models/index.js +99 -0
  148. package/dist/esm/models/index.js.map +1 -0
  149. package/dist/esm/{items/serialize-model.js → models/serializeModel.js} +1 -1
  150. package/dist/esm/models/serializeModel.js.map +1 -0
  151. package/dist/esm/projects/HubProjectManager.js +142 -0
  152. package/dist/esm/projects/HubProjectManager.js.map +1 -0
  153. package/dist/esm/projects/HubProjects.js +225 -0
  154. package/dist/esm/projects/HubProjects.js.map +1 -0
  155. package/dist/esm/projects/index.js +3 -0
  156. package/dist/esm/projects/index.js.map +1 -0
  157. package/dist/esm/utils/dasherize.js +25 -0
  158. package/dist/esm/utils/dasherize.js.map +1 -0
  159. package/dist/esm/utils/index.js +1 -0
  160. package/dist/esm/utils/index.js.map +1 -1
  161. package/dist/node/ArcGISContext.js +72 -26
  162. package/dist/node/ArcGISContext.js.map +1 -1
  163. package/dist/node/ArcGISContextManager.js +20 -9
  164. package/dist/node/ArcGISContextManager.js.map +1 -1
  165. package/dist/node/Hub.js +74 -0
  166. package/dist/node/Hub.js.map +1 -0
  167. package/dist/node/HubError.js +37 -0
  168. package/dist/node/HubError.js.map +1 -0
  169. package/dist/node/collections.js +24 -1
  170. package/dist/node/collections.js.map +1 -1
  171. package/dist/node/content/_internal.js +13 -1
  172. package/dist/node/content/_internal.js.map +1 -1
  173. package/dist/node/content/index.js +42 -18
  174. package/dist/node/content/index.js.map +1 -1
  175. package/dist/node/core/helpers/PropertyMapper.js +101 -0
  176. package/dist/node/core/helpers/PropertyMapper.js.map +1 -0
  177. package/dist/node/core/index.js +6 -0
  178. package/dist/node/core/index.js.map +1 -0
  179. package/dist/node/core/traits/WithBannerImage.js +3 -0
  180. package/dist/node/core/traits/WithBannerImage.js.map +1 -0
  181. package/dist/node/core/traits/WithLayout.js +3 -0
  182. package/dist/node/core/traits/WithLayout.js.map +1 -0
  183. package/dist/node/core/traits/WithSlug.js +3 -0
  184. package/dist/node/core/traits/WithSlug.js.map +1 -0
  185. package/dist/node/core/traits/index.js +7 -0
  186. package/dist/node/core/traits/index.js.map +1 -0
  187. package/dist/node/core/types/IContentEnrichments.js +3 -0
  188. package/dist/node/core/types/IContentEnrichments.js.map +1 -0
  189. package/dist/node/core/types/IHubContent.js +3 -0
  190. package/dist/node/core/types/IHubContent.js.map +1 -0
  191. package/dist/node/core/types/IHubEntityBase.js +3 -0
  192. package/dist/node/core/types/IHubEntityBase.js.map +1 -0
  193. package/dist/node/core/types/IHubEntityManager.js +3 -0
  194. package/dist/node/core/types/IHubEntityManager.js.map +1 -0
  195. package/dist/node/core/types/IHubEvent.js +3 -0
  196. package/dist/node/core/types/IHubEvent.js.map +1 -0
  197. package/dist/node/core/types/IHubImage.js +3 -0
  198. package/dist/node/core/types/IHubImage.js.map +1 -0
  199. package/dist/node/core/types/IHubInitiative.js +3 -0
  200. package/dist/node/core/types/IHubInitiative.js.map +1 -0
  201. package/dist/node/core/types/IHubItemEntity.js +3 -0
  202. package/dist/node/core/types/IHubItemEntity.js.map +1 -0
  203. package/dist/node/core/types/IHubLayout.js +3 -0
  204. package/dist/node/core/types/IHubLayout.js.map +1 -0
  205. package/dist/node/core/types/IHubPage.js +3 -0
  206. package/dist/node/core/types/IHubPage.js.map +1 -0
  207. package/dist/node/core/types/IHubProject.js +3 -0
  208. package/dist/node/core/types/IHubProject.js.map +1 -0
  209. package/dist/node/core/types/IHubSite.js +3 -0
  210. package/dist/node/core/types/IHubSite.js.map +1 -0
  211. package/dist/node/core/types/IHubTimeline.js +3 -0
  212. package/dist/node/core/types/IHubTimeline.js.map +1 -0
  213. package/dist/node/core/types/IItemEnrichments.js +3 -0
  214. package/dist/node/core/types/IItemEnrichments.js.map +1 -0
  215. package/dist/node/core/types/index.js +18 -0
  216. package/dist/node/core/types/index.js.map +1 -0
  217. package/dist/node/index.js +12 -6
  218. package/dist/node/index.js.map +1 -1
  219. package/dist/node/items/fail-safe-update.js +3 -3
  220. package/dist/node/items/fail-safe-update.js.map +1 -1
  221. package/dist/node/items/get-model-from-options.js +3 -3
  222. package/dist/node/items/get-model-from-options.js.map +1 -1
  223. package/dist/node/items/index.js +2 -3
  224. package/dist/node/items/index.js.map +1 -1
  225. package/dist/node/items/slugs.js +99 -0
  226. package/dist/node/items/slugs.js.map +1 -0
  227. package/dist/node/models/index.js +106 -0
  228. package/dist/node/models/index.js.map +1 -0
  229. package/dist/node/{items/serialize-model.js → models/serializeModel.js} +1 -1
  230. package/dist/node/models/serializeModel.js.map +1 -0
  231. package/dist/node/projects/HubProjectManager.js +119 -0
  232. package/dist/node/projects/HubProjectManager.js.map +1 -0
  233. package/dist/node/projects/HubProjects.js +201 -0
  234. package/dist/node/projects/HubProjects.js.map +1 -0
  235. package/dist/node/projects/index.js +6 -0
  236. package/dist/node/projects/index.js.map +1 -0
  237. package/dist/node/utils/dasherize.js +29 -0
  238. package/dist/node/utils/dasherize.js.map +1 -0
  239. package/dist/node/utils/index.js +1 -0
  240. package/dist/node/utils/index.js.map +1 -1
  241. package/dist/types/ArcGISContext.d.ts +197 -13
  242. package/dist/types/ArcGISContextManager.d.ts +21 -4
  243. package/dist/types/Hub.d.ts +72 -0
  244. package/dist/types/HubError.d.ts +17 -0
  245. package/dist/types/collections.d.ts +12 -0
  246. package/dist/types/content/_internal.d.ts +66 -38
  247. package/dist/types/content/index.d.ts +17 -8
  248. package/dist/types/core/helpers/PropertyMapper.d.ts +69 -0
  249. package/dist/types/core/index.d.ts +2 -0
  250. package/dist/types/core/traits/WithBannerImage.d.ts +30 -0
  251. package/dist/types/core/traits/WithLayout.d.ts +54 -0
  252. package/dist/types/core/traits/WithSlug.d.ts +15 -0
  253. package/dist/types/core/traits/index.d.ts +3 -0
  254. package/dist/types/core/types/IContentEnrichments.d.ts +10 -0
  255. package/dist/types/core/types/IHubContent.d.ts +77 -0
  256. package/dist/types/core/types/IHubEntityBase.d.ts +41 -0
  257. package/dist/types/core/types/IHubEntityManager.d.ts +33 -0
  258. package/dist/types/core/types/IHubEvent.d.ts +10 -0
  259. package/dist/types/core/types/IHubImage.d.ts +25 -0
  260. package/dist/types/core/types/IHubInitiative.d.ts +8 -0
  261. package/dist/types/core/types/IHubItemEntity.d.ts +42 -0
  262. package/dist/types/core/types/IHubLayout.d.ts +20 -0
  263. package/dist/types/core/types/IHubPage.d.ts +8 -0
  264. package/dist/types/core/types/IHubProject.d.ts +15 -0
  265. package/dist/types/core/types/IHubSite.d.ts +11 -0
  266. package/dist/types/core/types/IHubTimeline.d.ts +41 -0
  267. package/dist/types/core/types/IItemEnrichments.d.ts +23 -0
  268. package/dist/types/core/types/index.d.ts +14 -0
  269. package/dist/types/index.d.ts +11 -6
  270. package/dist/types/items/index.d.ts +2 -3
  271. package/dist/types/items/slugs.d.ts +43 -0
  272. package/dist/types/models/index.d.ts +42 -0
  273. package/dist/types/{items/serialize-model.d.ts → models/serializeModel.d.ts} +0 -0
  274. package/dist/types/projects/HubProjectManager.d.ts +81 -0
  275. package/dist/types/projects/HubProjects.d.ts +31 -0
  276. package/dist/types/projects/index.d.ts +2 -0
  277. package/dist/types/search/types.d.ts +2 -0
  278. package/dist/types/types.d.ts +2 -92
  279. package/dist/types/utils/dasherize.d.ts +17 -0
  280. package/dist/types/utils/index.d.ts +1 -0
  281. package/dist/umd/common.umd.js +2062 -1114
  282. package/dist/umd/common.umd.js.map +1 -1
  283. package/dist/umd/common.umd.min.js +1 -1
  284. package/dist/umd/common.umd.min.js.map +1 -1
  285. package/package.json +1 -1
  286. package/dist/es2017/items/get-model.js +0 -19
  287. package/dist/es2017/items/get-model.js.map +0 -1
  288. package/dist/es2017/items/serialize-model.js.map +0 -1
  289. package/dist/esm/items/get-model.js +0 -19
  290. package/dist/esm/items/get-model.js.map +0 -1
  291. package/dist/esm/items/serialize-model.js.map +0 -1
  292. package/dist/node/items/get-model.js +0 -23
  293. package/dist/node/items/get-model.js.map +0 -1
  294. package/dist/node/items/serialize-model.js.map +0 -1
  295. package/dist/types/items/get-model.d.ts +0 -8
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dasherize = void 0;
4
+ /**
5
+ * Dasherize a string
6
+ *
7
+ * ```javascript
8
+ * import { dasherize } from '@esri/hub-common';
9
+ * dasherize('innerHTML'); // 'inner-html'
10
+ * dasherize('action_name'); // 'action-name'
11
+ * dasherize('css-class-name'); // 'css-class-name'
12
+ * dasherize('my favorite items'); // 'my-favorite-items'
13
+ * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
14
+ * ```
15
+ *
16
+ * Extracted and modified from Ember.js source code - MIT license
17
+ * @param value
18
+ * @returns
19
+ */
20
+ function dasherize(value) {
21
+ const DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
22
+ const DASHERIZE_REGEXP = /[ _]/g;
23
+ return value
24
+ .replace(DECAMELIZE_REGEXP, "$1_$2")
25
+ .toLowerCase()
26
+ .replace(DASHERIZE_REGEXP, "-");
27
+ }
28
+ exports.dasherize = dasherize;
29
+ //# sourceMappingURL=dasherize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dasherize.js","sourceRoot":"","sources":["../../../src/utils/dasherize.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,SAAS,CAAC,KAAa;IACrC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;IAC9C,MAAM,gBAAgB,GAAG,OAAO,CAAC;IACjC,OAAO,KAAK;SACT,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAPD,8BAOC"}
@@ -19,4 +19,5 @@ tslib_1.__exportStar(require("./logger"), exports);
19
19
  tslib_1.__exportStar(require("./is-update-group"), exports);
20
20
  tslib_1.__exportStar(require("./revertable-tasks"), exports);
21
21
  tslib_1.__exportStar(require("./sessionLocalStorage"), exports);
22
+ tslib_1.__exportStar(require("./dasherize"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,iEAAuC;AACvC,sEAA4C;AAC5C,sDAA4B;AAC5B,mEAAyC;AACzC,4DAAkC;AAClC,kEAAwC;AACxC,qDAA2B;AAC3B,oDAA0B;AAC1B,mDAAyB;AACzB,oDAA0B;AAC1B,4DAAkC;AAClC,2DAAiC;AACjC,6DAAmC;AACnC,mDAAyB;AACzB,4DAAkC;AAClC,6DAAmC;AACnC,gEAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,iEAAuC;AACvC,sEAA4C;AAC5C,sDAA4B;AAC5B,mEAAyC;AACzC,4DAAkC;AAClC,kEAAwC;AACxC,qDAA2B;AAC3B,oDAA0B;AAC1B,mDAAyB;AACzB,oDAA0B;AAC1B,4DAAkC;AAClC,2DAAiC;AACjC,6DAAmC;AACnC,mDAAyB;AACzB,4DAAkC;AAClC,6DAAmC;AACnC,gEAAsC;AACtC,sDAA4B"}
@@ -12,58 +12,198 @@ import { IHubRequestOptions } from ".";
12
12
  *
13
13
  */
14
14
  export interface IArcGISContext {
15
+ /**
16
+ * Unique id from the ArcGISContextManager that created
17
+ * this instance. Primarily useful for debugging possible
18
+ * race-conditions that can result in multiple ArcGISContextManager
19
+ * instances being created.
20
+ */
15
21
  id: number;
22
+ /**
23
+ * Return the UserSession if authenticated
24
+ */
16
25
  session: UserSession;
26
+ /**
27
+ * Return boolean indicating if authenticatio is present
28
+ */
17
29
  isAuthenticated: boolean;
30
+ /**
31
+ * Return `IUserRequestOptions`, which is used for REST-JS
32
+ * functions which require authentication information.
33
+ *
34
+ * If context is not authenticated, this function will return `undefined`
35
+ */
18
36
  userRequestOptions: IUserRequestOptions;
37
+ /**
38
+ * Return `IRequestOptions`, which is used by REST-JS functions
39
+ * which *may* use authentication information if provided.
40
+ *
41
+ * If context is not authenticated, this function just returns
42
+ * the `portal` property, which informs REST-JS what Sharing API
43
+ * instance to use (i.e. AGO, Enterprise etc)
44
+ */
19
45
  requestOptions: IRequestOptions;
46
+ /**
47
+ * Return a `IHubRequestOptions` object
48
+ *
49
+ * If context is not authenticated, this function will return `undefined`
50
+ */
20
51
  hubRequestOptions: IHubRequestOptions;
52
+ /**
53
+ * Return the portal url.
54
+ *
55
+ * If authenticated @ ArcGIS Online, it will return
56
+ * the https://org.env.arcgis.com
57
+ *
58
+ * If authenticated @ ArcGIS Enterprise, it will return
59
+ * https://{portalHostname}/{webadaptor}
60
+ */
21
61
  portalUrl: string;
62
+ /**
63
+ * Returns the url to the sharing api composed from portalUrl
64
+ * i.e. https://myorg.maps.arcgis.com/sharing/rest
65
+ */
22
66
  sharingApiUrl: string;
67
+ /**
68
+ * Returns the Hub url, based on the portalUrl
69
+ *
70
+ * For ArcGIS Enterprise this will return `undefined`
71
+ */
23
72
  hubUrl: string;
73
+ /**
74
+ * Returns boolean indicating if the backing system
75
+ * is ArcGIS Enterprise (formerly ArcGIS Portal) or not
76
+ */
24
77
  isPortal: boolean;
78
+ /**
79
+ * Returns the discussions API URL
80
+ */
25
81
  discussionsServiceUrl: string;
82
+ /**
83
+ * Returns the Hub Search API URL
84
+ */
26
85
  hubSearchServiceUrl: string;
86
+ /**
87
+ * Returns Hub Domain Service URL
88
+ */
27
89
  domainServiceUrl: string;
90
+ /**
91
+ * Returns the Events configuration object from portal/self
92
+ *
93
+ * `{serviceId: '3ef..', publicViewId: 'bc3...'}`
94
+ */
28
95
  eventsConfig: any;
96
+ /**
97
+ * Returns boolean indicating if the current user
98
+ * belongs to an organization that has licensed
99
+ * ArcGIS Hub
100
+ */
29
101
  hubEnabled: boolean;
102
+ /**
103
+ * Return Hub Community Org Id, if defined
104
+ */
30
105
  communityOrgId: string;
106
+ /**
107
+ * Returns the Community Org Hostname, if defined
108
+ */
31
109
  communityOrgHostname: string;
110
+ /**
111
+ * Returns the Hub Community Org url
112
+ *
113
+ * i.e. https://c-org.maps.arcgis.com
114
+ */
32
115
  communityOrgUrl: string;
116
+ /**
117
+ * Returns the hash of helper services from portal self
118
+ */
33
119
  helperServices: any;
120
+ /**
121
+ * Returns the current user
122
+ */
34
123
  currentUser: IUser;
124
+ /**
125
+ * Returns the portal object
126
+ */
35
127
  portal: IPortal;
128
+ /**
129
+ * Additional app-specific context
130
+ */
131
+ properties: Record<string, any>;
36
132
  }
37
133
  /**
38
- * @internal
134
+ * Options for the ArcGISContext constructor
39
135
  */
40
136
  export interface IArcGISContextOptions {
137
+ /**
138
+ * Unique id from the ArcGISContextManager that created
139
+ * this instance. Primarily useful for debugging possible
140
+ * race-conditions that can result in multiple ArcGISContextManager
141
+ * instances being created.
142
+ */
41
143
  id: number;
144
+ /**
145
+ * Portal base url
146
+ * For ArcGIS Online - https://org.env.arcgis.com
147
+ * For ArcGIS Enterprise - https://{portalHostname}/{webadaptor}
148
+ */
42
149
  portalUrl: string;
43
- hubUrl: string;
150
+ /**
151
+ * Hub Url that corresponds to the portal url is appropritate
152
+ */
153
+ hubUrl?: string;
154
+ /**
155
+ * The current UserSession
156
+ */
44
157
  authentication?: UserSession;
158
+ /**
159
+ * If the user is authenticated, the portal should be passed in
160
+ * so various getters can work as expected.
161
+ *
162
+ * ArcGISContextManager handles this internally
163
+ */
45
164
  portalSelf?: IPortal;
165
+ /**
166
+ * If the user is authenticated, the user should be passed in
167
+ * so various getters can work as expected.
168
+ *
169
+ * ArcGISContextManager handles this internally
170
+ */
46
171
  currentUser?: IUser;
172
+ /**
173
+ * Optional hash of additional context
174
+ */
175
+ properties?: Record<string, any>;
47
176
  }
48
177
  /**
49
- * ArcGISContext
50
- *
51
- * Abstraction that holds a UserSession, along with
178
+ * Abstraction that holds a `UserSession`, along with
52
179
  * getters to streamline access to various platform
53
- * urls, and common constructs like IRequestOptions
180
+ * urls, and common constructs like `IRequestOptions`,
181
+ * `IUserRequestOptions` etc.
54
182
  *
55
- * Thin class just used to enable getters
183
+ * Instances are intended to be immutable, but this is not directly enforced.
56
184
  *
57
- * This class should not be used by anything other than
58
- * the ArcGISContextManager class
185
+ * In most circumstances, this class should be created by
186
+ * the ArcGISContextManager class.
59
187
  */
60
188
  export declare class ArcGISContext implements IArcGISContext {
189
+ /**
190
+ * Unique id from the ArcGISContextManager that created
191
+ * this instance. Primarily useful for debugging possible
192
+ * race-conditions that can result in multiple ArcGISContextManager
193
+ * instances being created.
194
+ */
61
195
  id: number;
62
196
  private _authentication;
63
197
  private _portalUrl;
64
198
  private _hubUrl;
65
199
  private _portalSelf;
66
200
  private _currentUser;
201
+ private _properties;
202
+ /**
203
+ * Create a new instance of `ArcGISContext`.
204
+ *
205
+ * @param opts
206
+ */
67
207
  constructor(opts: IArcGISContextOptions);
68
208
  /**
69
209
  * Return the UserSession if authenticated
@@ -94,29 +234,48 @@ export declare class ArcGISContext implements IArcGISContext {
94
234
  */
95
235
  get hubRequestOptions(): IHubRequestOptions;
96
236
  /**
97
- * Return the portal url.
237
+ * Return the portal url i.e. https://www.arcgis.com
98
238
  *
99
239
  * If authenticated @ ArcGIS Online, it will return
100
240
  * the https://org.env.arcgis.com
101
241
  *
102
242
  * If authenticated @ ArcGIS Enterprise, it will return
103
- * https://portalHostname, which includes the web adaptor
243
+ * https://{portalHostname}/{webadaptor}
104
244
  */
105
245
  get portalUrl(): string;
106
246
  /**
107
- * Returns the url to the sharing api
247
+ * Returns the url to the sharing api composed from portalUrl
108
248
  * i.e. https://myorg.maps.arcgis.com/sharing/rest
109
249
  */
110
250
  get sharingApiUrl(): string;
251
+ /**
252
+ * Returns the Hub url, based on the portalUrl
253
+ *
254
+ * For ArcGIS Enterprise this will return `undefined`
255
+ */
111
256
  get hubUrl(): string;
112
257
  /**
113
258
  * Returns boolean indicating if the backing system
114
259
  * is ArcGIS Enterprise (formerly ArcGIS Portal) or not
115
260
  */
116
261
  get isPortal(): boolean;
262
+ /**
263
+ * Returns the discussions API URL
264
+ */
117
265
  get discussionsServiceUrl(): string;
266
+ /**
267
+ * Returns the Hub Search API URL
268
+ */
118
269
  get hubSearchServiceUrl(): string;
270
+ /**
271
+ * Returns Hub Domain Service URL
272
+ */
119
273
  get domainServiceUrl(): string;
274
+ /**
275
+ * Returns the Events configuration object from portal/self
276
+ *
277
+ * `{serviceId: '3ef..', publicViewId: 'bc3...'}`
278
+ */
120
279
  get eventsConfig(): any;
121
280
  /**
122
281
  * Returns boolean indicating if the current user
@@ -125,12 +284,37 @@ export declare class ArcGISContext implements IArcGISContext {
125
284
  */
126
285
  get hubEnabled(): boolean;
127
286
  /**
128
- * Return Hub Community Org Id, if defined
287
+ * Return the Hub Community Org Id, if defined
129
288
  */
130
289
  get communityOrgId(): string;
290
+ /**
291
+ * Returns the Hub Community Org Hostname, if defined
292
+ *
293
+ * i.e. c-org.maps.arcgis.com
294
+ */
131
295
  get communityOrgHostname(): string;
296
+ /**
297
+ * Returns the Hub Community Org url
298
+ *
299
+ * i.e. https://c-org.maps.arcgis.com
300
+ */
132
301
  get communityOrgUrl(): string;
302
+ /**
303
+ * Returns the hash of helper services from portal self
304
+ */
133
305
  get helperServices(): any;
306
+ /**
307
+ * Returns the current user as IUser
308
+ */
134
309
  get currentUser(): IUser;
310
+ /**
311
+ * Returns the portal object as IPortal
312
+ */
135
313
  get portal(): IPortal;
314
+ /**
315
+ * Return the properties hash that was passed in.
316
+ * Useful for app-specific context such as the active
317
+ * Site for ArcGIS Hub
318
+ */
319
+ get properties(): Record<string, any>;
136
320
  }
@@ -32,6 +32,14 @@ export interface IArcGISContextManagerOptions {
32
32
  * it will be fetched.
33
33
  */
34
34
  currentUser?: IUser;
35
+ /**
36
+ * Any additional properties to expose on the context. This allows
37
+ * an application to send additional context into the system.
38
+ * For example, in ArcGIS Hub, many times we want to pass in the
39
+ * active "Hub Site" as additional context, so we will send that in
40
+ * as a node on a properties object.
41
+ */
42
+ properties?: Record<string, any>;
35
43
  /**
36
44
  * Logging level
37
45
  * off > error > warn > info > debug > all
@@ -40,8 +48,6 @@ export interface IArcGISContextManagerOptions {
40
48
  logLevel?: Level;
41
49
  }
42
50
  /**
43
- * ArcGIS Context Manager
44
- *
45
51
  * The manager exposes context (`IArcGISContext`), which combines a `UserSession` with
46
52
  * the `portal/self` and `user/self` responses to provide a central lookup for platform
47
53
  * information, api urls, and other useful properties for developers such as IRequestOptions
@@ -52,7 +58,7 @@ export interface IArcGISContextManagerOptions {
52
58
  * changes on that single property, instead of having to leverage observers or events
53
59
  * for change detection.
54
60
  *
55
- * This is a work-in-progress, and will likely expand over time.
61
+ * Please see the [ArcGISContext Guide](/hub.js/guides/context) for additional information.
56
62
  *
57
63
  */
58
64
  export declare class ArcGISContextManager {
@@ -65,6 +71,7 @@ export declare class ArcGISContextManager {
65
71
  private _context;
66
72
  private _authentication;
67
73
  private _portalUrl;
74
+ private _properties;
68
75
  private _hubUrl;
69
76
  private _portalSelf;
70
77
  private _currentUser;
@@ -76,7 +83,12 @@ export declare class ArcGISContextManager {
76
83
  */
77
84
  private constructor();
78
85
  /**
79
- * Static async Factory
86
+ * Used to create a new instance of the ArcGISContext class.
87
+ *
88
+ * ```js
89
+ * const ctxMgr = await ArcGISContextManager.create();
90
+ * ```
91
+ *
80
92
  * @param opts
81
93
  * @returns
82
94
  */
@@ -88,6 +100,11 @@ export declare class ArcGISContextManager {
88
100
  * @param auth
89
101
  */
90
102
  setAuthentication(auth: UserSession): Promise<void>;
103
+ /**
104
+ * Set the properties hash and re-create the context
105
+ * @param properties
106
+ */
107
+ setProperties(properties: Record<string, any>): void;
91
108
  /**
92
109
  * Clear the Authentication (UserSession). This should be
93
110
  * called when a user signs out of an application, but
@@ -0,0 +1,72 @@
1
+ import { ArcGISContextManager, IArcGISContextManagerOptions } from "./ArcGISContextManager";
2
+ import { HubProjectManager } from "./projects/HubProjectManager";
3
+ /**
4
+ * Options for instantiating a Hub instance
5
+ */
6
+ export interface IHubOptions {
7
+ contextManager?: ArcGISContextManager;
8
+ managerOptions?: IArcGISContextManagerOptions;
9
+ authOptions?: {
10
+ usename: string;
11
+ password: string;
12
+ portalUrl?: string;
13
+ };
14
+ }
15
+ /**
16
+ * Hub class can be used as an entry point to managing
17
+ * content, teams, sites, projects etc, in an organization's Hub.
18
+ *
19
+ * ```js
20
+ * import {Hub} from '@esri/hub-common';
21
+ * // create a Hub instance, authenticating as a specific user
22
+ * // working against arcgis online
23
+ * const myHub = await Hub.create({authOptions: {username: "casey", password: "jones"}});
24
+ *
25
+ * myHub.context.currentUser //=> {username: "casey", ...} as IUser
26
+ *
27
+ * const projectStore = await myHub.getProjectStore();
28
+ *
29
+ * const pavingProject = await projectStore.create({name: "12th Street Paving"});
30
+ * pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
31
+ * await projectStore.update(pavingProject);
32
+ * ```
33
+ *
34
+ * This is a convenience class. Hub Stores can be created
35
+ * directly, or the underlying functions can be imported an used
36
+ * as need for scenarios where these class structures introduce
37
+ * unwanted complexity
38
+ */
39
+ export declare class Hub {
40
+ /**
41
+ * Hold a context manager, which should be a single instance for
42
+ * an application. When authentication changes, the .context
43
+ * property on the context manager will be replaced. As long as
44
+ * all the fns in this class leverage properties on .context
45
+ * everything be kept in sync.
46
+ */
47
+ private _contextManager;
48
+ private _projectManager;
49
+ /**
50
+ * Private so we can employ a factory function should we need
51
+ * async work during creation
52
+ * @param contextManager
53
+ */
54
+ private constructor();
55
+ /**
56
+ * Factory function to construct a new HubProjectStore instance.
57
+ *
58
+ * Note: Used so that we could do async actions in the ctor.
59
+ * @param contextManager
60
+ * @returns
61
+ */
62
+ static create(options: IHubOptions): Promise<Hub>;
63
+ /**
64
+ * Getter to abstract the context manager
65
+ */
66
+ get context(): import("./ArcGISContext").IArcGISContext;
67
+ /**
68
+ * Create a Project Store connected to the current Hub
69
+ * @returns
70
+ */
71
+ get projects(): HubProjectManager;
72
+ }
@@ -0,0 +1,17 @@
1
+ import { OperationError } from ".";
2
+ /**
3
+ * Generic Hub Error with an Error stack as well
4
+ * as an optional serialized OperationStack.
5
+ *
6
+ * Also accepts a `rootCause` Error object
7
+ */
8
+ export default class HubError extends OperationError {
9
+ /**
10
+ * Creates an instance of HubError.
11
+ * @param {string} operation
12
+ * @param {string} [message]
13
+ * @param {Error} [rootCause]
14
+ * @memberof HubError
15
+ */
16
+ constructor(operation: string, message?: string, rootCause?: Error);
17
+ }
@@ -1,3 +1,15 @@
1
+ /**
2
+ * ```js
3
+ * import { getCollection } from "@esri/hub-common";
4
+ * //
5
+ * getCollection('Feature Layer')
6
+ * > 'dataset'
7
+ * ```
8
+ * Get the Hub collection for a given item type
9
+ * @param itemType The ArcGIS [item type](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm).
10
+ * @returns the Hub collection of a given item type.
11
+ */
12
+ export declare const getCollection: (type?: string) => string;
1
13
  export declare const collections: {
2
14
  [key: string]: string[];
3
15
  };
@@ -8,7 +8,8 @@
8
8
  * It's probably a good pattern to add functions here first and then
9
9
  * move them to index.ts only when they are needed by a consumer.
10
10
  */
11
- import { BBox, IHubContent, IHubGeography, GeographyProvenance } from "../types";
11
+ import { IItem } from "@esri/arcgis-rest-types/dist/types/item";
12
+ import { BBox, IHubContent, IHubGeography, GeographyProvenance, IHubRequestOptions } from "..";
12
13
  /**
13
14
  * Create a new content with updated boundary properties
14
15
  * @param content original content
@@ -17,70 +18,89 @@ import { BBox, IHubContent, IHubGeography, GeographyProvenance } from "../types"
17
18
  */
18
19
  export declare const setContentBoundary: (content: IHubContent, boundary: GeographyProvenance) => {
19
20
  boundary: IHubGeography;
20
- item: any;
21
+ item: {
22
+ properties: any;
23
+ id: string;
24
+ owner: string;
25
+ tags: string[];
26
+ created: number;
27
+ modified: number;
28
+ numViews: number;
29
+ size: number;
30
+ protected?: boolean;
31
+ title: string;
32
+ type: string;
33
+ typeKeywords?: string[];
34
+ description?: string;
35
+ snippet?: string;
36
+ documentation?: string;
37
+ extent?: number[][];
38
+ categories?: string[];
39
+ spatialReference?: import("@esri/arcgis-rest-types").ISpatialReference;
40
+ culture?: string;
41
+ url?: string;
42
+ };
43
+ slug?: string;
21
44
  hubId?: string;
45
+ identifier: string;
22
46
  permissions: {
23
47
  visibility: "private" | "public" | "org";
24
- control?: import("../types").AccessControl;
48
+ control?: import("..").AccessControl;
25
49
  groups?: import("@esri/arcgis-rest-types").IGroup[];
26
50
  };
27
- family?: import("../types").HubFamily;
28
- itemCategories?: string[];
29
- normalizedType?: string;
51
+ family?: import("..").HubFamily;
52
+ categories?: string[];
53
+ isDownloadable: boolean;
54
+ structuredLicense?: import("..").IStructuredLicense;
30
55
  publishedDate: Date;
31
56
  publishedDateSource?: string;
32
57
  updateFrequency?: string;
33
- actionLinks?: import("../types").IActionLink[];
34
- hubActions?: object;
35
- metrics?: {
36
- visibility: "private" | "public" | "org" | "updateGroups";
37
- };
38
- slug?: string;
58
+ portalHomeUrl?: string;
59
+ portalApiUrl?: string;
39
60
  portalDataUrl?: string;
40
- groupIds?: string[];
41
- errors?: import("../types").IEnrichmentErrorInfo[];
42
- data?: {
43
- [propName: string]: any;
44
- };
45
- server?: Partial<import("@esri/arcgis-rest-types").IFeatureServiceDefinition>;
46
- layers?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>[];
61
+ actionLinks?: import("..").IActionLink[];
62
+ hubActions?: object;
47
63
  layer?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>;
48
- recordCount?: number;
64
+ itemCategories?: string[];
65
+ normalizedType?: string;
49
66
  orgId?: string;
50
- org?: Partial<import("@esri/arcgis-rest-portal").IPortal>;
51
- isDownloadable: boolean;
52
- structuredLicense?: import("..").IStructuredLicense;
67
+ thumbnailUrl?: string;
68
+ owner: string;
69
+ description?: string;
70
+ culture?: string;
71
+ tags: string[];
72
+ typeKeywords?: string[];
73
+ url?: string;
74
+ id: string;
53
75
  name: string;
54
76
  summary?: string;
55
- hubType: import("../types").HubType;
56
77
  createdDate: Date;
57
- createdDateSource?: string;
78
+ createdDateSource: string;
58
79
  updatedDate: Date;
59
- updatedDateSource?: string;
60
- portalHomeUrl?: string;
61
- portalApiUrl?: string;
62
- thumbnailUrl?: string;
80
+ updatedDateSource: string;
81
+ type: string;
82
+ server?: Partial<import("@esri/arcgis-rest-types").IFeatureServiceDefinition>;
83
+ layers?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>[];
84
+ recordCount?: number;
85
+ data?: {
86
+ [propName: string]: any;
87
+ };
63
88
  metadata?: any;
64
- id: string;
65
- owner: string;
66
- tags: string[];
89
+ groupIds?: string[];
90
+ ownerUser?: import("@esri/arcgis-rest-types").IUser;
91
+ org?: Partial<import("@esri/arcgis-rest-portal").IPortal>;
92
+ errors?: import("..").IEnrichmentErrorInfo[];
67
93
  created: number;
68
94
  modified: number;
69
95
  numViews: number;
70
96
  size: number;
71
97
  protected?: boolean;
72
98
  title: string;
73
- type: string;
74
- typeKeywords?: string[];
75
- description?: string;
76
99
  snippet?: string;
77
100
  documentation?: string;
78
101
  extent?: number[][];
79
- categories?: string[];
80
102
  spatialReference?: import("@esri/arcgis-rest-types").ISpatialReference;
81
- culture?: string;
82
103
  properties?: any;
83
- url?: string;
84
104
  };
85
105
  /**
86
106
  * Create a new content with updated extent and derived properties like boundary
@@ -89,3 +109,11 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
89
109
  * @returns a new content with the updated extent and boundary
90
110
  */
91
111
  export declare const setContentExtent: (content: IHubContent, extent: BBox) => IHubContent;
112
+ /**
113
+ * Returns whether or not an item is a proxied csv
114
+ *
115
+ * @param item
116
+ * @param requestOptions Hub Request Options (including whether we're in portal)
117
+ * @returns
118
+ */
119
+ export declare const isProxiedCSV: (item: IItem, requestOptions: IHubRequestOptions) => boolean;