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