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