@esri/hub-common 9.18.0 → 9.19.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 (61) hide show
  1. package/dist/es2017/content/_internal.js +151 -30
  2. package/dist/es2017/content/_internal.js.map +1 -1
  3. package/dist/es2017/content/compose.js +607 -0
  4. package/dist/es2017/content/compose.js.map +1 -0
  5. package/dist/es2017/content/get-family.js +42 -0
  6. package/dist/es2017/content/get-family.js.map +1 -0
  7. package/dist/es2017/content/index.js +42 -468
  8. package/dist/es2017/content/index.js.map +1 -1
  9. package/dist/es2017/core/types/IHubContentEnrichments.js +1 -0
  10. package/dist/es2017/core/types/IHubContentEnrichments.js.map +1 -0
  11. package/dist/es2017/core/types/IServerEnrichments.js +1 -0
  12. package/dist/es2017/core/types/IServerEnrichments.js.map +1 -0
  13. package/dist/es2017/core/types/index.js +2 -1
  14. package/dist/es2017/core/types/index.js.map +1 -1
  15. package/dist/esm/content/_internal.js +153 -30
  16. package/dist/esm/content/_internal.js.map +1 -1
  17. package/dist/esm/content/compose.js +600 -0
  18. package/dist/esm/content/compose.js.map +1 -0
  19. package/dist/esm/content/get-family.js +42 -0
  20. package/dist/esm/content/get-family.js.map +1 -0
  21. package/dist/esm/content/index.js +44 -476
  22. package/dist/esm/content/index.js.map +1 -1
  23. package/dist/esm/core/types/IHubContentEnrichments.js +1 -0
  24. package/dist/esm/core/types/IHubContentEnrichments.js.map +1 -0
  25. package/dist/esm/core/types/IServerEnrichments.js +1 -0
  26. package/dist/esm/core/types/IServerEnrichments.js.map +1 -0
  27. package/dist/esm/core/types/index.js +2 -1
  28. package/dist/esm/core/types/index.js.map +1 -1
  29. package/dist/node/content/_internal.js +155 -31
  30. package/dist/node/content/_internal.js.map +1 -1
  31. package/dist/node/content/compose.js +612 -0
  32. package/dist/node/content/compose.js.map +1 -0
  33. package/dist/node/content/get-family.js +46 -0
  34. package/dist/node/content/get-family.js.map +1 -0
  35. package/dist/node/content/index.js +48 -477
  36. package/dist/node/content/index.js.map +1 -1
  37. package/dist/node/core/types/IHubContentEnrichments.js +3 -0
  38. package/dist/node/core/types/IHubContentEnrichments.js.map +1 -0
  39. package/dist/node/core/types/{IContentEnrichments.js → IServerEnrichments.js} +1 -1
  40. package/dist/node/core/types/IServerEnrichments.js.map +1 -0
  41. package/dist/node/core/types/index.js +2 -1
  42. package/dist/node/core/types/index.js.map +1 -1
  43. package/dist/types/content/_internal.d.ts +57 -22
  44. package/dist/types/content/compose.d.ts +115 -0
  45. package/dist/types/content/get-family.d.ts +7 -0
  46. package/dist/types/content/index.d.ts +4 -86
  47. package/dist/types/core/types/IHubContent.d.ts +4 -2
  48. package/dist/types/core/types/IHubContentEnrichments.d.ts +15 -0
  49. package/dist/types/core/types/IHubItemEntity.d.ts +1 -1
  50. package/dist/types/core/types/{IContentEnrichments.d.ts → IServerEnrichments.d.ts} +3 -2
  51. package/dist/types/core/types/index.d.ts +2 -1
  52. package/dist/umd/common.umd.js +910 -555
  53. package/dist/umd/common.umd.js.map +1 -1
  54. package/dist/umd/common.umd.min.js +1 -1
  55. package/dist/umd/common.umd.min.js.map +1 -1
  56. package/package.json +1 -1
  57. package/dist/es2017/core/types/IContentEnrichments.js +0 -1
  58. package/dist/es2017/core/types/IContentEnrichments.js.map +0 -1
  59. package/dist/esm/core/types/IContentEnrichments.js +0 -1
  60. package/dist/esm/core/types/IContentEnrichments.js.map +0 -1
  61. package/dist/node/core/types/IContentEnrichments.js.map +0 -1
@@ -0,0 +1,607 @@
1
+ import { parseServiceUrl, } from "@esri/arcgis-rest-feature-layer";
2
+ import { isDownloadable } from "../categories";
3
+ import { getStructuredLicense } from "../items/get-structured-license";
4
+ import { getProp } from "../objects";
5
+ import { getItemThumbnailUrl } from "../resources/get-item-thumbnail-url";
6
+ import { getItemHomeUrl } from "../urls/get-item-home-url";
7
+ import { getItemApiUrl } from "../urls/get-item-api-url";
8
+ import { getItemDataUrl } from "../urls/get-item-data-url";
9
+ import { camelize, isNil } from "../util";
10
+ import { includes } from "../utils";
11
+ import { DatePrecision, getContentBoundary, getHubRelativeUrl, getItemSpatialReference, getServerSpatialReference, getValueFromMetadata, getMetadataPath, isProxiedCSV, isPortal, parseISODateString, } from "./_internal";
12
+ import { getFamily } from "./get-family";
13
+ import { getHubApiUrl } from "../api";
14
+ // helper fns - move this to _internal if needed elsewhere
15
+ const getOnlyQueryLayer = (layers) => {
16
+ const layer = layers && layers.length === 1 && layers[0];
17
+ return layer && layer.capabilities.includes("Query") && layer;
18
+ };
19
+ const shouldUseLayerInfo = (layer, layers, url) => {
20
+ return (layer &&
21
+ layers &&
22
+ layers.length > 1 &&
23
+ // we use item info instead of layer info for single layer items
24
+ !getLayerIdFromUrl(url));
25
+ };
26
+ /**
27
+ * The possible values for updateFrequency
28
+ *
29
+ * @enum {string}
30
+ */
31
+ export var UpdateFrequency;
32
+ (function (UpdateFrequency) {
33
+ UpdateFrequency["Continual"] = "continual";
34
+ UpdateFrequency["Daily"] = "daily";
35
+ UpdateFrequency["Weekly"] = "weekly";
36
+ UpdateFrequency["Fortnightly"] = "fortnightly";
37
+ UpdateFrequency["Monthly"] = "monthly";
38
+ UpdateFrequency["Quarterly"] = "quarterly";
39
+ UpdateFrequency["Biannually"] = "biannually";
40
+ UpdateFrequency["Annually"] = "annually";
41
+ UpdateFrequency["AsNeeded"] = "as-needed";
42
+ UpdateFrequency["Irregular"] = "irregular";
43
+ UpdateFrequency["NotPlanned"] = "not-planned";
44
+ UpdateFrequency["Unknown"] = "unknown";
45
+ UpdateFrequency["Semimonthly"] = "semimonthly";
46
+ })(UpdateFrequency || (UpdateFrequency = {}));
47
+ const getUpdateFrequencyFromMetadata = (metadata, identifier) => {
48
+ const updateFrequencyMap = {
49
+ "001": UpdateFrequency.Continual,
50
+ "002": UpdateFrequency.Daily,
51
+ "003": UpdateFrequency.Weekly,
52
+ "004": UpdateFrequency.Fortnightly,
53
+ "005": UpdateFrequency.Monthly,
54
+ "006": UpdateFrequency.Quarterly,
55
+ "007": UpdateFrequency.Biannually,
56
+ "008": UpdateFrequency.Annually,
57
+ "009": UpdateFrequency.AsNeeded,
58
+ "010": UpdateFrequency.Irregular,
59
+ "011": UpdateFrequency.NotPlanned,
60
+ "012": UpdateFrequency.Unknown,
61
+ "013": UpdateFrequency.Semimonthly,
62
+ };
63
+ return updateFrequencyMap[getValueFromMetadata(metadata, identifier || "updateFrequency")];
64
+ };
65
+ const getDateInfoFromMetadata = (metadata, identifier) => {
66
+ const metadataDateInfo = parseISODateString(getValueFromMetadata(metadata, identifier));
67
+ return (metadataDateInfo && Object.assign(Object.assign({}, metadataDateInfo), { source: `metadata.${getMetadataPath(identifier)}` }));
68
+ };
69
+ const getLastEditDateInfo = (content, layerOrServer) => {
70
+ const source = `${layerOrServer}.editingInfo.lastEditDate`;
71
+ const lastEditDate = getProp(content, source);
72
+ return (lastEditDate && {
73
+ date: new Date(lastEditDate),
74
+ source,
75
+ // NOTE: this default was taken from _enrichDates
76
+ precision: DatePrecision.Day,
77
+ });
78
+ };
79
+ const getItemDateInfo = (item, createdOrModified) => {
80
+ return {
81
+ date: new Date(item[createdOrModified]),
82
+ // NOTE: this was set to Day in _enrichDates()
83
+ // but I wonder if it should be Time instead?
84
+ precision: DatePrecision.Day,
85
+ source: `item.${createdOrModified}`,
86
+ };
87
+ };
88
+ const getUpdatedDateInfo = (item, options) => {
89
+ return (
90
+ // prefer metadata revise date
91
+ getDateInfoFromMetadata(options.metadata, "reviseDate") ||
92
+ // then layer last edit date
93
+ getLastEditDateInfo(options, "layer") ||
94
+ // then server last edit date
95
+ getLastEditDateInfo(options, "server") ||
96
+ // fall back to item modified date
97
+ getItemDateInfo(item, "modified"));
98
+ };
99
+ const getPublishedDateInfo = (item, metadata) => {
100
+ return (
101
+ // prefer metadata publish date
102
+ getDateInfoFromMetadata(metadata, "pubDate") ||
103
+ // then metadata create date
104
+ getDateInfoFromMetadata(metadata, "createDate") ||
105
+ // fall back to item created date
106
+ getItemDateInfo(item, "created"));
107
+ };
108
+ const getMetadataUpdatedDateInfo = (item, metadata) => {
109
+ // prefer date from metadata
110
+ return (getDateInfoFromMetadata(metadata, "metadataUpdatedDate") ||
111
+ // default to when the item was last modified
112
+ getItemDateInfo(item, "modified"));
113
+ };
114
+ // public API
115
+ /**
116
+ * DEPRECATED: Compute the content type icon based on the content type
117
+ * @param content type
118
+ * @returns content type icon
119
+ */
120
+ export const getContentTypeIcon = (contentType) => {
121
+ var _a;
122
+ const type = camelize(contentType || "");
123
+ const iconMap = {
124
+ appbuilderExtension: "file",
125
+ appbuilderWidgetPackage: "widgets-source",
126
+ application: "web",
127
+ applicationConfiguration: "app-gear",
128
+ arcgisProMap: "desktop",
129
+ cadDrawing: "file-cad",
130
+ cityEngineWebScene: "urban-model",
131
+ codeAttachment: "file-code",
132
+ codeSample: "file-code",
133
+ colorSet: "palette",
134
+ contentCategorySet: "label",
135
+ csv: "file-csv",
136
+ cSV: "file-csv",
137
+ cSVCollection: "file-csv",
138
+ dashboard: "dashboard",
139
+ desktopApplication: "desktop",
140
+ documentLink: "link",
141
+ excaliburImageryProject: "file",
142
+ explorerMap: "file",
143
+ exportPackage: "file",
144
+ featureCollection: "data",
145
+ featureCollectionTemplate: "file",
146
+ featureLayer: "data",
147
+ featureService: "collection",
148
+ fileGeodatabase: "data",
149
+ form: "survey",
150
+ geocodingService: "file",
151
+ geodataService: "file",
152
+ geometryService: "file",
153
+ geopackage: "file",
154
+ geoprocessingService: "file",
155
+ globeLayer: "layers",
156
+ globeService: "file",
157
+ hubInitiative: "initiative",
158
+ hubInitiativeTemplate: "initiative-template",
159
+ hubPage: "browser",
160
+ hubSiteApplication: "web",
161
+ image: "file-image",
162
+ imageService: "data",
163
+ insightsModel: "file",
164
+ insightsPage: "graph-moving-average",
165
+ insightsTheme: "palette",
166
+ insightsWorkbook: "graph-moving-average",
167
+ iWorkPages: "file-text",
168
+ iWorkKeynote: "presentation",
169
+ iWorkNumbers: "file-report",
170
+ kML: "data",
171
+ kMLCollection: "data",
172
+ layer: "layers",
173
+ layerPackage: "layers",
174
+ layerTemplate: "file",
175
+ locatorPackage: "file",
176
+ mapArea: "file",
177
+ mapDocument: "map-contents",
178
+ mapImageLayer: "collection",
179
+ mapPackage: "file",
180
+ mapService: "collection",
181
+ microsoftExcel: "file-report",
182
+ microsoftPowerpoint: "presentation",
183
+ microsoftWord: "file-text",
184
+ mission: "file",
185
+ mobileMapPackage: "map-contents",
186
+ nativeApplication: "mobile",
187
+ nativeApplicationInstaller: "file",
188
+ nativeApplicationTemplate: "file",
189
+ mobileApplication: "mobile",
190
+ networkAnalysisService: "file",
191
+ notebook: "code",
192
+ orientedImageryCatalog: "file",
193
+ orthoMappingProject: "file",
194
+ orthoMappingTemplate: "file",
195
+ pDF: "file-pdf",
196
+ quickCaptureProject: "mobile",
197
+ rasterFunctionTemplate: "file",
198
+ rasterLayer: "map",
199
+ realTimeAnalytic: "file",
200
+ relationalDatabaseConnection: "file",
201
+ reportTemplate: "file",
202
+ sceneLayer: "data",
203
+ sceneService: "urban-model",
204
+ serviceDefinition: "file",
205
+ shapefile: "data",
206
+ solution: "puzzle-piece",
207
+ sqliteGeodatabase: "file",
208
+ statisticalDataCollection: "file",
209
+ storymap: "tour",
210
+ storyMap: "tour",
211
+ storymapTheme: "palette",
212
+ symbolSet: "file",
213
+ table: "table",
214
+ urbanModel: "urban-model",
215
+ vectorTilePackage: "file-shape",
216
+ vectorTileService: "map",
217
+ visioDocument: "conditional-rules",
218
+ webExperience: "apps",
219
+ webMap: "map",
220
+ webMappingApplication: "apps",
221
+ webScene: "urban-model",
222
+ wfs: "map",
223
+ wFS: "map",
224
+ wMS: "map",
225
+ wMTS: "map",
226
+ workflowManagerService: "file",
227
+ workforceProject: "list-check",
228
+ };
229
+ return (_a = iconMap[type]) !== null && _a !== void 0 ? _a : "file";
230
+ };
231
+ /**
232
+ * get portal URLs (home, API, data, and thumbnail) for an item
233
+ *
234
+ * @param item Item
235
+ * @param requestOptions Request options
236
+ * @returns a hash with the portal URLs
237
+ * @export
238
+ */
239
+ export const getPortalUrls = (item, requestOptions) => {
240
+ const authentication = requestOptions.authentication;
241
+ const token = authentication && authentication.token;
242
+ // add properties that depend on portal
243
+ const portalHome = getItemHomeUrl(item.id, requestOptions);
244
+ // the URL of the item's Portal API end point
245
+ const portalApi = getItemApiUrl(item, requestOptions, token);
246
+ // the URL of the item's data API end point
247
+ const portalData = getItemDataUrl(item, requestOptions, token);
248
+ // the full URL of the thumbnail
249
+ const thumbnail = getItemThumbnailUrl(item, requestOptions, {
250
+ token,
251
+ });
252
+ return {
253
+ portalHome,
254
+ portalApi,
255
+ portalData,
256
+ thumbnail,
257
+ };
258
+ };
259
+ /**
260
+ * If an item is a proxied csv, returns the url for the proxying feature layer.
261
+ * If the item is not a proxied csv, returns undefined.
262
+ *
263
+ * @param item
264
+ * @param requestOptions Hub Request Options (including whether we're in portal)
265
+ * @returns
266
+ */
267
+ export const getProxyUrl = (item, requestOptions) => {
268
+ let result;
269
+ if (isProxiedCSV(item, requestOptions)) {
270
+ result = `${getHubApiUrl(requestOptions)}/datasets/${item.id}_0/FeatureServer/0`;
271
+ }
272
+ return result;
273
+ };
274
+ /**
275
+ * parse layer id from a service URL
276
+ * @param {string} url
277
+ * @returns {string} layer id
278
+ */
279
+ export const getLayerIdFromUrl = (url) => {
280
+ const endsWithNumberSegmentRegEx = /\/\d+$/;
281
+ const matched = url && url.match(endsWithNumberSegmentRegEx);
282
+ return matched && matched[0].slice(1);
283
+ };
284
+ /**
285
+ * Case-insensitive check if the type is "Feature Service"
286
+ * @param {string} type - item's type
287
+ * @returns {boolean}
288
+ */
289
+ export const isFeatureService = (type) => {
290
+ return type && type.toLowerCase() === "feature service";
291
+ };
292
+ /**
293
+ * ```js
294
+ * import { normalizeItemType } from "@esri/hub-common";
295
+ * //
296
+ * normalizeItemType(item)
297
+ * > [ 'Hub Site Application' ]
298
+ * ```
299
+ * @param item Item object.
300
+ * @returns type of the input item.
301
+ *
302
+ */
303
+ export function normalizeItemType(item = {}) {
304
+ let ret = item.type;
305
+ const typeKeywords = item.typeKeywords || [];
306
+ if (item.type === "Site Application" ||
307
+ (item.type === "Web Mapping Application" &&
308
+ includes(typeKeywords, "hubSite"))) {
309
+ ret = "Hub Site Application";
310
+ }
311
+ if (item.type === "Site Page" ||
312
+ (item.type === "Web Mapping Application" &&
313
+ includes(typeKeywords, "hubPage"))) {
314
+ ret = "Hub Page";
315
+ }
316
+ if (item.type === "Hub Initiative" &&
317
+ includes(typeKeywords, "hubInitiativeTemplate")) {
318
+ ret = "Hub Initiative Template";
319
+ }
320
+ if (item.type === "Web Mapping Application" &&
321
+ includes(typeKeywords, "hubSolutionTemplate")) {
322
+ ret = "Solution";
323
+ }
324
+ return ret;
325
+ }
326
+ /**
327
+ * return the layerId if we can tell that item is a single layer service
328
+ * @param {*} item from AGO
329
+ * @returns {string} layer id
330
+ */
331
+ export const getItemLayerId = (item) => {
332
+ // try to parse it from the URL, but failing that we check for
333
+ // the Singlelayer typeKeyword, which I think is set when you create the item in AGO
334
+ // but have not verified that, nor that we should alway return '0' in that case
335
+ return (getLayerIdFromUrl(item.url) ||
336
+ (isFeatureService(item.type) &&
337
+ item.typeKeywords &&
338
+ includes(item.typeKeywords, "Singlelayer") &&
339
+ "0"));
340
+ };
341
+ /**
342
+ * given an item, get the id to use w/ the Hub API
343
+ * @param item
344
+ * @returns Hub API id (hubId)
345
+ */
346
+ export const getItemHubId = (item) => {
347
+ if (item.access !== "public") {
348
+ // the hub only indexes public items
349
+ return;
350
+ }
351
+ const id = item.id;
352
+ const layerId = getItemLayerId(item);
353
+ return layerId ? `${id}_${layerId}` : id;
354
+ };
355
+ /**
356
+ * Splits item category strings at slashes and discards the "Categories" keyword
357
+ *
358
+ * ```
359
+ * ["/Categories/Boundaries", "/Categories/Planning and cadastre/Property records", "/Categories/Structure"]
360
+ * ```
361
+ * Should end up being
362
+ * ```
363
+ * ["Boundaries", "Planning and cadastre", "Property records", "Structure"]
364
+ * ```
365
+ *
366
+ * @param categories - an array of strings
367
+ * @private
368
+ */
369
+ export function parseItemCategories(categories) {
370
+ if (!categories)
371
+ return categories;
372
+ const exclude = ["categories", ""];
373
+ const parsed = categories.map((cat) => cat.split("/"));
374
+ const flattened = parsed.reduce((acc, arr, _) => [...acc, ...arr], []);
375
+ return flattened.filter((cat) => !includes(exclude, cat.toLowerCase()));
376
+ }
377
+ /**
378
+ * Compose a new content object out of an item, enrichments, and context
379
+ * @param item
380
+ * @param options any enrichments, current state (selected layerId), or context (requestOptions)
381
+ * @returns new content object
382
+ */
383
+ export const composeContent = (item, options) => {
384
+ // extract enrichments and context out of the options
385
+ const { slug, requestOptions, data, metadata, groupIds, ownerUser, org, errors, server, layers, recordCount, boundary, statistics, } = options || {};
386
+ // set common variables that we will use in the derived properties below
387
+ // if item refers to a layer we always want to use that layer id
388
+ // otherwise use the layer id that was passed in (if any)
389
+ const _layerIdFromUrl = getLayerIdFromUrl(item.url);
390
+ const layerId = _layerIdFromUrl
391
+ ? parseInt(_layerIdFromUrl, 10)
392
+ : options === null || options === void 0 ? void 0 : options.layerId;
393
+ const layer = layers &&
394
+ (!isNil(layerId)
395
+ ? // find the explicitly set layer id
396
+ layers.find((_layer) => _layer.id === layerId)
397
+ : // for feature servers with a single layer always show the layer
398
+ isFeatureService(item.type) && getOnlyQueryLayer(layers));
399
+ // NOTE: we only set hubId for public items in online
400
+ const _canUseHubApi = !isPortal(requestOptions) && item.access === "public";
401
+ const hubId = _canUseHubApi
402
+ ? layer
403
+ ? `${item.id}_${layer.id}`
404
+ : getItemHubId(item)
405
+ : undefined;
406
+ const identifier = slug || hubId || item.id;
407
+ // whether or not we should show layer info for name, description, etc
408
+ const _shouldUseLayerInfo = shouldUseLayerInfo(layer, layers, item.url);
409
+ const name = _shouldUseLayerInfo ? layer.name : item.title;
410
+ const _layerDescription = _shouldUseLayerInfo && layer.description;
411
+ // so much depends on type
412
+ const type = layer
413
+ ? // use layer type (Feature Layer, Table, etc) for layer content
414
+ layer.type
415
+ : // otherwise use the normalized item type
416
+ normalizeItemType(item);
417
+ // all the urls
418
+ const urls = Object.assign({ relative: getHubRelativeUrl(type, identifier, item.typeKeywords) }, (requestOptions && getPortalUrls(item, requestOptions)));
419
+ const _proxyUrl = getProxyUrl(item, requestOptions);
420
+ // NOTE: I'd rather not compute these date values up front,
421
+ // but they are used by several getters below, so we do it here only once
422
+ const _updatedDateInfo = getUpdatedDateInfo(item, {
423
+ metadata,
424
+ layer,
425
+ server,
426
+ });
427
+ const _publishedDateInfo = getPublishedDateInfo(item, metadata);
428
+ const _metadataUpdatedDateInfo = getMetadataUpdatedDateInfo(item, metadata);
429
+ // return all of the above composed into a content object
430
+ return Object.assign(Object.assign({
431
+ // a reference to underlying item
432
+ item }, item), {
433
+ // item enrichments
434
+ slug,
435
+ data,
436
+ metadata,
437
+ groupIds,
438
+ ownerUser,
439
+ org, errors: errors || [],
440
+ // server enrichments
441
+ server,
442
+ layers,
443
+ recordCount,
444
+ // enrichments from the Hub API (boundary is below)
445
+ statistics,
446
+ // derived properties
447
+ // NOTE: in the getters below you can **not** use `this`
448
+ // these are not meant to provide live updating computed props
449
+ // their purpose is to avoid computing all these values above
450
+ // especially where we want to defer computation of less used props
451
+ hubId,
452
+ identifier,
453
+ get isProxied() {
454
+ return !!_proxyUrl;
455
+ },
456
+ layer,
457
+ name,
458
+ get title() {
459
+ return name;
460
+ },
461
+ get description() {
462
+ return _layerDescription || item.description;
463
+ },
464
+ type,
465
+ get family() {
466
+ return getFamily(type);
467
+ },
468
+ get url() {
469
+ return _proxyUrl
470
+ ? _proxyUrl
471
+ : _shouldUseLayerInfo
472
+ ? `${parseServiceUrl(item.url)}/${layer.id}`
473
+ : item.url;
474
+ },
475
+ get categories() {
476
+ return parseItemCategories(item.categories);
477
+ },
478
+ get actionLinks() {
479
+ return item.properties && item.properties.links;
480
+ },
481
+ get hubActions() {
482
+ return item.properties && item.properties.actions;
483
+ },
484
+ get isDownloadable() {
485
+ return isDownloadable(item);
486
+ },
487
+ get structuredLicense() {
488
+ return getStructuredLicense(item.licenseInfo);
489
+ },
490
+ get permissions() {
491
+ return {
492
+ visibility: item.access,
493
+ control: item.itemControl || "view",
494
+ };
495
+ },
496
+ get boundary() {
497
+ // TODO: need to be able to handle automatic w/ additional enrichment
498
+ // that could for example fetch the concave hull from the Hub API or resources
499
+ return boundary || getContentBoundary(item);
500
+ },
501
+ get summary() {
502
+ return _layerDescription
503
+ ? _layerDescription
504
+ : // TODO: this should use the logic for the Hub API's searchDescription
505
+ // see: https://github.com/ArcGIS/hub-indexer/blob/b352cfded8221a967ac80447879d493db6476d7a/packages/duke/compose/dataset.js#L238-L250
506
+ // TODO: can we strip HTML from description, and do we need to trim it to a X chars?
507
+ item.snippet || item.description;
508
+ },
509
+ urls,
510
+ get portalHomeUrl() {
511
+ return urls.portalHome;
512
+ },
513
+ get portalDataUrl() {
514
+ return urls.portalData;
515
+ },
516
+ get portalApiUrl() {
517
+ return urls.portalApi;
518
+ },
519
+ get thumbnailUrl() {
520
+ return urls.thumbnail;
521
+ },
522
+ /** The date the item was created */
523
+ get createdDate() {
524
+ return new Date(item.created);
525
+ }, createdDateSource: "item.created", get updatedDate() {
526
+ return _updatedDateInfo.date;
527
+ },
528
+ get updatedDateSource() {
529
+ return _updatedDateInfo.source;
530
+ },
531
+ get updatedDatePrecision() {
532
+ return _updatedDateInfo.precision;
533
+ },
534
+ get modified() {
535
+ return _updatedDateInfo.date.getTime();
536
+ },
537
+ get publishedDate() {
538
+ return _publishedDateInfo.date;
539
+ },
540
+ get publishedDateSource() {
541
+ return _publishedDateInfo.source;
542
+ },
543
+ get publishedDatePrecision() {
544
+ return _publishedDateInfo.precision;
545
+ },
546
+ get metadataUpdatedDate() {
547
+ return _metadataUpdatedDateInfo.date;
548
+ },
549
+ get metadataUpdatedDateSource() {
550
+ return _metadataUpdatedDateInfo.source;
551
+ },
552
+ get metadataUpdatedDatePrecision() {
553
+ return _metadataUpdatedDateInfo.precision;
554
+ },
555
+ get updateFrequency() {
556
+ return getUpdateFrequencyFromMetadata(metadata);
557
+ },
558
+ get metadataUpdateFrequency() {
559
+ return getUpdateFrequencyFromMetadata(metadata, "metadataUpdateFrequency");
560
+ },
561
+ // TODO: add the publisher logic outlined here:
562
+ // https://devtopia.esri.com/dc/hub/issues/2932#issuecomment-3276309
563
+ get publisher() {
564
+ return {
565
+ name: item.owner,
566
+ username: item.owner,
567
+ };
568
+ },
569
+ // TODO: is metrics in use?
570
+ get metrics() {
571
+ return item.properties && item.properties.metrics;
572
+ },
573
+ get spatialReference() {
574
+ // NOTE: I had to add || null just so packages/content/test/portal.test.ts would pass
575
+ // we can remove that when that package is deprecated
576
+ return (getItemSpatialReference(item) ||
577
+ getServerSpatialReference(server, layer) ||
578
+ null);
579
+ },
580
+ get orgId() {
581
+ // NOTE: it's undocumented, but the portal API will return orgId for items... sometimes
582
+ return org ? org.id : item.orgId;
583
+ },
584
+ // deprecated properties
585
+ // TODO: should we add these in legacy wrappers
586
+ // like itemToContent or datasetToContent instead?
587
+ get contentTypeIcon() {
588
+ /* tslint:disable no-console */
589
+ console.warn(
590
+ /* tslint:enable no-console */
591
+ "DEPRECATED: it is now the responsibility of the consuming package to determine the icon");
592
+ return getContentTypeIcon(type);
593
+ },
594
+ get license() {
595
+ /* tslint:disable no-console */
596
+ console.warn("DEPRECATED: use structuredLicense instead");
597
+ /* tslint:enable no-console */
598
+ return { name: "Custom License", description: item.accessInformation };
599
+ },
600
+ get hubType() {
601
+ /* tslint:disable no-console */
602
+ console.warn("DEPRECATED: use family instead");
603
+ /* tslint:enable no-console */
604
+ return getFamily(type);
605
+ } });
606
+ };
607
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/content/compose.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAA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A2B;QAC3B,IAAI,OAAO;YACT,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACpD,CAAC;QACD,IAAI,gBAAgB;YAClB,qFAAqF;YACrF,qDAAqD;YACrD,OAAO,CACL,uBAAuB,CAAC,IAAI,CAAC;gBAC7B,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC;gBACxC,IAAI,CACL,CAAC;QACJ,CAAC;QACD,IAAI,KAAK;YACP,uFAAuF;YACvF,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACnC,CAAC;QACD,wBAAwB;QACxB,+CAA+C;QAC/C,kDAAkD;QAClD,IAAI,eAAe;YACjB,+BAA+B;YAC/B,OAAO,CAAC,IAAI;YACV,8BAA8B;YAC9B,yFAAyF,CAC1F,CAAC;YACF,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,OAAO;YACT,+BAA+B;YAC/B,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;YAC1D,8BAA8B;YAC9B,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzE,CAAC;QACD,IAAI,OAAO;YACT,+BAA+B;YAC/B,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAC/C,8BAA8B;YAC9B,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,GACa,CAAC;AACnB,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { getCollection } from "../collections";
2
+ // private helper functions
3
+ function collectionToFamily(collection) {
4
+ const overrides = {
5
+ other: "content",
6
+ solution: "template",
7
+ };
8
+ return overrides[collection] || collection;
9
+ }
10
+ /**
11
+ * return the Hub family given an item's type
12
+ * @param type item type
13
+ * @returns Hub family
14
+ */
15
+ export function getFamily(type) {
16
+ let family;
17
+ // override default behavior for the rows that are highlighted in yellow here:
18
+ // https://esriis.sharepoint.com/:x:/r/sites/ArcGISHub/_layouts/15/Doc.aspx?sourcedoc=%7BADA1C9DC-4F6C-4DE4-92C6-693EF9571CFA%7D&file=Hub%20Routes.xlsx&nav=MTBfe0VENEREQzI4LUZFMDctNEI0Ri04NjcyLThCQUE2MTA0MEZGRn1fezIwMTIwMEJFLTA4MEQtNEExRC05QzA4LTE5MTAzOUQwMEE1RH0&action=default&mobileredirect=true&cid=df1c874b-c367-4cea-bc13-7bebfad3f2ac
19
+ switch ((type || "").toLowerCase()) {
20
+ case "image service":
21
+ family = "dataset";
22
+ break;
23
+ case "feature service":
24
+ case "raster layer":
25
+ // TODO: check if feature service has > 1 layer first?
26
+ family = "map";
27
+ break;
28
+ case "microsoft excel":
29
+ family = "document";
30
+ break;
31
+ case "cad drawing":
32
+ case "feature collection template":
33
+ case "report template":
34
+ family = "content";
35
+ break;
36
+ default:
37
+ // by default derive from collection
38
+ family = collectionToFamily(getCollection(type));
39
+ }
40
+ return family;
41
+ }
42
+ //# sourceMappingURL=get-family.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-family.js","sourceRoot":"","sources":["../../../src/content/get-family.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,2BAA2B;AAC3B,SAAS,kBAAkB,CAAC,UAAkB;IAC5C,MAAM,SAAS,GAAQ;QACrB,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,UAAU;KACrB,CAAC;IACF,OAAO,SAAS,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,MAAM,CAAC;IACX,8EAA8E;IAC9E,mVAAmV;IACnV,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE;QAClC,KAAK,eAAe;YAClB,MAAM,GAAG,SAAS,CAAC;YACnB,MAAM;QACR,KAAK,iBAAiB,CAAC;QACvB,KAAK,cAAc;YACjB,sDAAsD;YACtD,MAAM,GAAG,KAAK,CAAC;YACf,MAAM;QACR,KAAK,iBAAiB;YACpB,MAAM,GAAG,UAAU,CAAC;YACpB,MAAM;QACR,KAAK,aAAa,CAAC;QACnB,KAAK,6BAA6B,CAAC;QACnC,KAAK,iBAAiB;YACpB,MAAM,GAAG,SAAS,CAAC;YACnB,MAAM;QACR;YACE,oCAAoC;YACpC,MAAM,GAAG,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;KACpD;IACD,OAAO,MAAmB,CAAC;AAC7B,CAAC"}