@esri/hub-common 9.14.0 → 9.14.1

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.
@@ -12,58 +12,189 @@ 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;
36
128
  }
37
129
  /**
38
- * @internal
130
+ * Options for the ArcGISContext constructor
39
131
  */
40
132
  export interface IArcGISContextOptions {
133
+ /**
134
+ * Unique id from the ArcGISContextManager that created
135
+ * this instance. Primarily useful for debugging possible
136
+ * race-conditions that can result in multiple ArcGISContextManager
137
+ * instances being created.
138
+ */
41
139
  id: number;
140
+ /**
141
+ * Portal base url
142
+ * For ArcGIS Online - https://org.env.arcgis.com
143
+ * For ArcGIS Enterprise - https://{portalHostname}/{webadaptor}
144
+ */
42
145
  portalUrl: string;
146
+ /**
147
+ * Hub Url that corresponds to the portal url is appropritate
148
+ */
43
149
  hubUrl: string;
150
+ /**
151
+ * The current UserSession
152
+ */
44
153
  authentication?: UserSession;
154
+ /**
155
+ * If the user is authenticated, the portal should be passed in
156
+ * so various getters can work as expected.
157
+ *
158
+ * ArcGISContextManager handles this internally
159
+ */
45
160
  portalSelf?: IPortal;
161
+ /**
162
+ * If the user is authenticated, the user should be passed in
163
+ * so various getters can work as expected.
164
+ *
165
+ * ArcGISContextManager handles this internally
166
+ */
46
167
  currentUser?: IUser;
47
168
  }
48
169
  /**
49
- * ArcGISContext
50
- *
51
- * Abstraction that holds a UserSession, along with
170
+ * Abstraction that holds a `UserSession`, along with
52
171
  * getters to streamline access to various platform
53
- * urls, and common constructs like IRequestOptions
172
+ * urls, and common constructs like `IRequestOptions`,
173
+ * `IUserRequestOptions` etc.
54
174
  *
55
- * Thin class just used to enable getters
175
+ * Instances are intended to be immutable, but this is not directly enforced.
56
176
  *
57
- * This class should not be used by anything other than
58
- * the ArcGISContextManager class
177
+ * In most circumstances, this class should be created by
178
+ * the ArcGISContextManager class.
59
179
  */
60
180
  export declare class ArcGISContext implements IArcGISContext {
181
+ /**
182
+ * Unique id from the ArcGISContextManager that created
183
+ * this instance. Primarily useful for debugging possible
184
+ * race-conditions that can result in multiple ArcGISContextManager
185
+ * instances being created.
186
+ */
61
187
  id: number;
62
188
  private _authentication;
63
189
  private _portalUrl;
64
190
  private _hubUrl;
65
191
  private _portalSelf;
66
192
  private _currentUser;
193
+ /**
194
+ * Create a new instance of `ArcGISContext`.
195
+ *
196
+ * @param opts
197
+ */
67
198
  constructor(opts: IArcGISContextOptions);
68
199
  /**
69
200
  * Return the UserSession if authenticated
@@ -94,29 +225,48 @@ export declare class ArcGISContext implements IArcGISContext {
94
225
  */
95
226
  get hubRequestOptions(): IHubRequestOptions;
96
227
  /**
97
- * Return the portal url.
228
+ * Return the portal url i.e. https://www.arcgis.com
98
229
  *
99
230
  * If authenticated @ ArcGIS Online, it will return
100
231
  * the https://org.env.arcgis.com
101
232
  *
102
233
  * If authenticated @ ArcGIS Enterprise, it will return
103
- * https://portalHostname, which includes the web adaptor
234
+ * https://{portalHostname}/{webadaptor}
104
235
  */
105
236
  get portalUrl(): string;
106
237
  /**
107
- * Returns the url to the sharing api
238
+ * Returns the url to the sharing api composed from portalUrl
108
239
  * i.e. https://myorg.maps.arcgis.com/sharing/rest
109
240
  */
110
241
  get sharingApiUrl(): string;
242
+ /**
243
+ * Returns the Hub url, based on the portalUrl
244
+ *
245
+ * For ArcGIS Enterprise this will return `undefined`
246
+ */
111
247
  get hubUrl(): string;
112
248
  /**
113
249
  * Returns boolean indicating if the backing system
114
250
  * is ArcGIS Enterprise (formerly ArcGIS Portal) or not
115
251
  */
116
252
  get isPortal(): boolean;
253
+ /**
254
+ * Returns the discussions API URL
255
+ */
117
256
  get discussionsServiceUrl(): string;
257
+ /**
258
+ * Returns the Hub Search API URL
259
+ */
118
260
  get hubSearchServiceUrl(): string;
261
+ /**
262
+ * Returns Hub Domain Service URL
263
+ */
119
264
  get domainServiceUrl(): string;
265
+ /**
266
+ * Returns the Events configuration object from portal/self
267
+ *
268
+ * `{serviceId: '3ef..', publicViewId: 'bc3...'}`
269
+ */
120
270
  get eventsConfig(): any;
121
271
  /**
122
272
  * Returns boolean indicating if the current user
@@ -125,12 +275,31 @@ export declare class ArcGISContext implements IArcGISContext {
125
275
  */
126
276
  get hubEnabled(): boolean;
127
277
  /**
128
- * Return Hub Community Org Id, if defined
278
+ * Return the Hub Community Org Id, if defined
129
279
  */
130
280
  get communityOrgId(): string;
281
+ /**
282
+ * Returns the Hub Community Org Hostname, if defined
283
+ *
284
+ * i.e. c-org.maps.arcgis.com
285
+ */
131
286
  get communityOrgHostname(): string;
287
+ /**
288
+ * Returns the Hub Community Org url
289
+ *
290
+ * i.e. https://c-org.maps.arcgis.com
291
+ */
132
292
  get communityOrgUrl(): string;
293
+ /**
294
+ * Returns the hash of helper services from portal self
295
+ */
133
296
  get helperServices(): any;
297
+ /**
298
+ * Returns the current user as IUser
299
+ */
134
300
  get currentUser(): IUser;
301
+ /**
302
+ * Returns the portal object as IPortal
303
+ */
135
304
  get portal(): IPortal;
136
305
  }
@@ -40,8 +40,6 @@ export interface IArcGISContextManagerOptions {
40
40
  logLevel?: Level;
41
41
  }
42
42
  /**
43
- * ArcGIS Context Manager
44
- *
45
43
  * The manager exposes context (`IArcGISContext`), which combines a `UserSession` with
46
44
  * the `portal/self` and `user/self` responses to provide a central lookup for platform
47
45
  * information, api urls, and other useful properties for developers such as IRequestOptions
@@ -52,7 +50,7 @@ export interface IArcGISContextManagerOptions {
52
50
  * changes on that single property, instead of having to leverage observers or events
53
51
  * for change detection.
54
52
  *
55
- * This is a work-in-progress, and will likely expand over time.
53
+ * Please see the [ArcGISContext Guide](/hub.js/guides/context) for additional information.
56
54
  *
57
55
  */
58
56
  export declare class ArcGISContextManager {
@@ -76,7 +74,12 @@ export declare class ArcGISContextManager {
76
74
  */
77
75
  private constructor();
78
76
  /**
79
- * Static async Factory
77
+ * Used to create a new instance of the ArcGISContext class.
78
+ *
79
+ * ```js
80
+ * const ctxMgr = await ArcGISContextManager.create();
81
+ * ```
82
+ *
80
83
  * @param opts
81
84
  * @returns
82
85
  */
@@ -1,5 +1,5 @@
1
1
  /* @preserve
2
- * @esri/hub-common - v9.13.2 - Tue Jan 25 2022 00:14:10 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/hub-common - v9.14.0 - Mon Feb 07 2022 19:02:27 GMT+0000 (Coordinated Universal Time)
3
3
  * Copyright (c) 2022 Environmental Systems Research Institute, Inc.
4
4
  * Apache-2.0
5
5
  */
@@ -6430,12 +6430,15 @@
6430
6430
  appbuilderExtension: "file",
6431
6431
  appbuilderWidgetPackage: "widgets-source",
6432
6432
  application: "web",
6433
+ applicationConfiguration: "app-gear",
6433
6434
  arcgisProMap: "desktop",
6434
6435
  cadDrawing: "file-cad",
6435
6436
  cityEngineWebScene: "urban-model",
6436
6437
  codeAttachment: "file-code",
6438
+ codeSample: "file-code",
6437
6439
  colorSet: "palette",
6438
6440
  contentCategorySet: "label",
6441
+ csv: "file-csv",
6439
6442
  cSV: "file-csv",
6440
6443
  cSVCollection: "file-csv",
6441
6444
  dashboard: "dashboard",
@@ -6457,8 +6460,8 @@
6457
6460
  geoprocessingService: "file",
6458
6461
  globeLayer: "layers",
6459
6462
  globeService: "file",
6460
- hubInitiative: "mountain-summit-nocap",
6461
- hubInitiativeTemplate: "initiative-template-outlines-thick",
6463
+ hubInitiative: "initiative",
6464
+ hubInitiativeTemplate: "initiative-template",
6462
6465
  hubPage: "browser",
6463
6466
  hubSiteApplication: "web",
6464
6467
  image: "file-image",
@@ -6474,6 +6477,7 @@
6474
6477
  kMLCollection: "data",
6475
6478
  layer: "layers",
6476
6479
  layerPackage: "layers",
6480
+ layerTemplate: "file",
6477
6481
  locatorPackage: "file",
6478
6482
  mapArea: "file",
6479
6483
  mapDocument: "map-contents",
@@ -6496,6 +6500,7 @@
6496
6500
  orthoMappingTemplate: "file",
6497
6501
  pDF: "file-pdf",
6498
6502
  quickCaptureProject: "mobile",
6503
+ rasterFunctionTemplate: "file",
6499
6504
  rasterLayer: "map",
6500
6505
  realTimeAnalytic: "file",
6501
6506
  relationalDatabaseConnection: "file",
@@ -6504,19 +6509,23 @@
6504
6509
  sceneService: "urban-model",
6505
6510
  serviceDefinition: "file",
6506
6511
  shapefile: "data",
6507
- solution: "solutions",
6512
+ solution: "puzzle-piece",
6508
6513
  sqliteGeodatabase: "file",
6509
6514
  statisticalDataCollection: "file",
6515
+ storymap: "tour",
6510
6516
  storyMap: "tour",
6517
+ storymapTheme: "palette",
6511
6518
  symbolSet: "file",
6512
6519
  table: "table",
6513
6520
  urbanModel: "urban-model",
6521
+ vectorTilePackage: "file-shape",
6514
6522
  vectorTileService: "map",
6515
6523
  visioDocument: "conditional-rules",
6516
6524
  webExperience: "apps",
6517
6525
  webMap: "map",
6518
6526
  webMappingApplication: "apps",
6519
6527
  webScene: "urban-model",
6528
+ wfs: "map",
6520
6529
  wFS: "map",
6521
6530
  wMS: "map",
6522
6531
  wMTS: "map",
@@ -10783,18 +10792,22 @@
10783
10792
  discussions: "/api/discussions/v1",
10784
10793
  };
10785
10794
  /**
10786
- * ArcGISContext
10787
- *
10788
- * Abstraction that holds a UserSession, along with
10795
+ * Abstraction that holds a `UserSession`, along with
10789
10796
  * getters to streamline access to various platform
10790
- * urls, and common constructs like IRequestOptions
10797
+ * urls, and common constructs like `IRequestOptions`,
10798
+ * `IUserRequestOptions` etc.
10791
10799
  *
10792
- * Thin class just used to enable getters
10800
+ * Instances are intended to be immutable, but this is not directly enforced.
10793
10801
  *
10794
- * This class should not be used by anything other than
10795
- * the ArcGISContextManager class
10802
+ * In most circumstances, this class should be created by
10803
+ * the ArcGISContextManager class.
10796
10804
  */
10797
10805
  var ArcGISContext = /** @class */ (function () {
10806
+ /**
10807
+ * Create a new instance of `ArcGISContext`.
10808
+ *
10809
+ * @param opts
10810
+ */
10798
10811
  function ArcGISContext(opts) {
10799
10812
  this._portalUrl = "https://www.arcgis.com";
10800
10813
  this.id = opts.id;
@@ -10878,25 +10891,27 @@
10878
10891
  */
10879
10892
  get: function () {
10880
10893
  // We may add more logic around what is returned in some corner cases
10881
- return {
10882
- authentication: this.session,
10883
- isPortal: this.isPortal,
10884
- portalSelf: this.portal,
10885
- hubApiUrl: this.hubUrl,
10886
- };
10894
+ if (this.isAuthenticated) {
10895
+ return {
10896
+ authentication: this.session,
10897
+ isPortal: this.isPortal,
10898
+ portalSelf: this.portal,
10899
+ hubApiUrl: this.hubUrl,
10900
+ };
10901
+ }
10887
10902
  },
10888
10903
  enumerable: false,
10889
10904
  configurable: true
10890
10905
  });
10891
10906
  Object.defineProperty(ArcGISContext.prototype, "portalUrl", {
10892
10907
  /**
10893
- * Return the portal url.
10908
+ * Return the portal url i.e. https://www.arcgis.com
10894
10909
  *
10895
10910
  * If authenticated @ ArcGIS Online, it will return
10896
10911
  * the https://org.env.arcgis.com
10897
10912
  *
10898
10913
  * If authenticated @ ArcGIS Enterprise, it will return
10899
- * https://portalHostname, which includes the web adaptor
10914
+ * https://{portalHostname}/{webadaptor}
10900
10915
  */
10901
10916
  get: function () {
10902
10917
  if (this.isAuthenticated) {
@@ -10916,7 +10931,7 @@
10916
10931
  });
10917
10932
  Object.defineProperty(ArcGISContext.prototype, "sharingApiUrl", {
10918
10933
  /**
10919
- * Returns the url to the sharing api
10934
+ * Returns the url to the sharing api composed from portalUrl
10920
10935
  * i.e. https://myorg.maps.arcgis.com/sharing/rest
10921
10936
  */
10922
10937
  get: function () {
@@ -10926,6 +10941,11 @@
10926
10941
  configurable: true
10927
10942
  });
10928
10943
  Object.defineProperty(ArcGISContext.prototype, "hubUrl", {
10944
+ /**
10945
+ * Returns the Hub url, based on the portalUrl
10946
+ *
10947
+ * For ArcGIS Enterprise this will return `undefined`
10948
+ */
10929
10949
  get: function () {
10930
10950
  return this._hubUrl;
10931
10951
  },
@@ -10946,9 +10966,9 @@
10946
10966
  configurable: true
10947
10967
  });
10948
10968
  Object.defineProperty(ArcGISContext.prototype, "discussionsServiceUrl", {
10949
- // Hub APIs
10950
- // ----------
10951
- // Discussions
10969
+ /**
10970
+ * Returns the discussions API URL
10971
+ */
10952
10972
  get: function () {
10953
10973
  if (this._hubUrl) {
10954
10974
  return "" + this._hubUrl + hubApiEndpoints.discussions;
@@ -10958,7 +10978,9 @@
10958
10978
  configurable: true
10959
10979
  });
10960
10980
  Object.defineProperty(ArcGISContext.prototype, "hubSearchServiceUrl", {
10961
- // Hub Search
10981
+ /**
10982
+ * Returns the Hub Search API URL
10983
+ */
10962
10984
  get: function () {
10963
10985
  if (this._hubUrl) {
10964
10986
  return "" + this._hubUrl + hubApiEndpoints.search;
@@ -10968,7 +10990,9 @@
10968
10990
  configurable: true
10969
10991
  });
10970
10992
  Object.defineProperty(ArcGISContext.prototype, "domainServiceUrl", {
10971
- // Domain
10993
+ /**
10994
+ * Returns Hub Domain Service URL
10995
+ */
10972
10996
  get: function () {
10973
10997
  if (this._hubUrl) {
10974
10998
  return "" + this._hubUrl + hubApiEndpoints.domains;
@@ -10978,8 +11002,11 @@
10978
11002
  configurable: true
10979
11003
  });
10980
11004
  Object.defineProperty(ArcGISContext.prototype, "eventsConfig", {
10981
- // Events
10982
- // returns `{serviceId: '3ef..', publicViewId: 'bc3...'}
11005
+ /**
11006
+ * Returns the Events configuration object from portal/self
11007
+ *
11008
+ * `{serviceId: '3ef..', publicViewId: 'bc3...'}`
11009
+ */
10983
11010
  get: function () {
10984
11011
  if (this._portalSelf) {
10985
11012
  return getProp(this._portalSelf, "portalProperties.hub.settings.events");
@@ -11002,7 +11029,7 @@
11002
11029
  });
11003
11030
  Object.defineProperty(ArcGISContext.prototype, "communityOrgId", {
11004
11031
  /**
11005
- * Return Hub Community Org Id, if defined
11032
+ * Return the Hub Community Org Id, if defined
11006
11033
  */
11007
11034
  get: function () {
11008
11035
  if (this._portalSelf) {
@@ -11013,6 +11040,11 @@
11013
11040
  configurable: true
11014
11041
  });
11015
11042
  Object.defineProperty(ArcGISContext.prototype, "communityOrgHostname", {
11043
+ /**
11044
+ * Returns the Hub Community Org Hostname, if defined
11045
+ *
11046
+ * i.e. c-org.maps.arcgis.com
11047
+ */
11016
11048
  get: function () {
11017
11049
  if (this._portalSelf) {
11018
11050
  return getProp(this._portalSelf, "portalProperties.hub.settings.communityOrg.portalHostname");
@@ -11022,6 +11054,11 @@
11022
11054
  configurable: true
11023
11055
  });
11024
11056
  Object.defineProperty(ArcGISContext.prototype, "communityOrgUrl", {
11057
+ /**
11058
+ * Returns the Hub Community Org url
11059
+ *
11060
+ * i.e. https://c-org.maps.arcgis.com
11061
+ */
11025
11062
  get: function () {
11026
11063
  if (this.communityOrgHostname) {
11027
11064
  return "https://" + this.communityOrgHostname;
@@ -11031,8 +11068,9 @@
11031
11068
  configurable: true
11032
11069
  });
11033
11070
  Object.defineProperty(ArcGISContext.prototype, "helperServices", {
11034
- // Platform API service urls are all in helperServices
11035
- // and not consistent to expose as urls
11071
+ /**
11072
+ * Returns the hash of helper services from portal self
11073
+ */
11036
11074
  get: function () {
11037
11075
  if (this._portalSelf) {
11038
11076
  return this._portalSelf.helperServices;
@@ -11042,6 +11080,9 @@
11042
11080
  configurable: true
11043
11081
  });
11044
11082
  Object.defineProperty(ArcGISContext.prototype, "currentUser", {
11083
+ /**
11084
+ * Returns the current user as IUser
11085
+ */
11045
11086
  get: function () {
11046
11087
  return this._currentUser;
11047
11088
  },
@@ -11049,6 +11090,9 @@
11049
11090
  configurable: true
11050
11091
  });
11051
11092
  Object.defineProperty(ArcGISContext.prototype, "portal", {
11093
+ /**
11094
+ * Returns the portal object as IPortal
11095
+ */
11052
11096
  get: function () {
11053
11097
  return this._portalSelf;
11054
11098
  },
@@ -11059,8 +11103,6 @@
11059
11103
  }());
11060
11104
 
11061
11105
  /**
11062
- * ArcGIS Context Manager
11063
- *
11064
11106
  * The manager exposes context (`IArcGISContext`), which combines a `UserSession` with
11065
11107
  * the `portal/self` and `user/self` responses to provide a central lookup for platform
11066
11108
  * information, api urls, and other useful properties for developers such as IRequestOptions
@@ -11071,7 +11113,7 @@
11071
11113
  * changes on that single property, instead of having to leverage observers or events
11072
11114
  * for change detection.
11073
11115
  *
11074
- * This is a work-in-progress, and will likely expand over time.
11116
+ * Please see the [ArcGISContext Guide](/hub.js/guides/context) for additional information.
11075
11117
  *
11076
11118
  */
11077
11119
  var ArcGISContextManager = /** @class */ (function () {
@@ -11110,7 +11152,12 @@
11110
11152
  }
11111
11153
  }
11112
11154
  /**
11113
- * Static async Factory
11155
+ * Used to create a new instance of the ArcGISContext class.
11156
+ *
11157
+ * ```js
11158
+ * const ctxMgr = await ArcGISContextManager.create();
11159
+ * ```
11160
+ *
11114
11161
  * @param opts
11115
11162
  * @returns
11116
11163
  */