@esri/hub-common 9.7.3 → 9.10.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.
- package/dist/es2017/content/_internal.js +64 -0
- package/dist/es2017/content/_internal.js.map +1 -0
- package/dist/es2017/{content.js → content/index.js} +32 -29
- package/dist/es2017/content/index.js.map +1 -0
- package/dist/es2017/extent.js +49 -16
- package/dist/es2017/extent.js.map +1 -1
- package/dist/es2017/objects/deep-set.js +1 -1
- package/dist/es2017/objects/deep-set.js.map +1 -1
- package/dist/es2017/sites/upgrade-site-schema.js +3 -0
- package/dist/es2017/sites/upgrade-site-schema.js.map +1 -1
- package/dist/esm/content/_internal.js +65 -0
- package/dist/esm/content/_internal.js.map +1 -0
- package/dist/esm/{content.js → content/index.js} +32 -29
- package/dist/esm/content/index.js.map +1 -0
- package/dist/esm/extent.js +44 -11
- package/dist/esm/extent.js.map +1 -1
- package/dist/esm/objects/deep-set.js +1 -1
- package/dist/esm/objects/deep-set.js.map +1 -1
- package/dist/esm/sites/upgrade-site-schema.js +3 -0
- package/dist/esm/sites/upgrade-site-schema.js.map +1 -1
- package/dist/node/content/_internal.js +67 -0
- package/dist/node/content/_internal.js.map +1 -0
- package/dist/node/{content.js → content/index.js} +33 -30
- package/dist/node/content/index.js.map +1 -0
- package/dist/node/extent.js +50 -17
- package/dist/node/extent.js.map +1 -1
- package/dist/node/objects/deep-set.js +1 -1
- package/dist/node/objects/deep-set.js.map +1 -1
- package/dist/node/sites/upgrade-site-schema.js +3 -0
- package/dist/node/sites/upgrade-site-schema.js.map +1 -1
- package/dist/types/content/_internal.d.ts +91 -0
- package/dist/types/{content.d.ts → content/index.d.ts} +15 -4
- package/dist/types/extent.d.ts +11 -4
- package/dist/types/types.d.ts +4 -1
- package/dist/umd/common.umd.js +125 -34
- package/dist/umd/common.umd.js.map +1 -1
- package/dist/umd/common.umd.min.js +1 -1
- package/dist/umd/common.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/dist/es2017/content.js.map +0 -1
- package/dist/esm/content.js.map +0 -1
- package/dist/node/content.js.map +0 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use this module for functions that do not need to be used by consumers (yet),
|
|
3
|
+
* but may be shared between hub.js modules, and/or need to be tested
|
|
4
|
+
* to get 100% coverage w/o writing cumbersome tests of higher level functions.
|
|
5
|
+
*
|
|
6
|
+
* Consuming will not be able to import these functions.
|
|
7
|
+
*
|
|
8
|
+
* It's probably a good pattern to add functions here first and then
|
|
9
|
+
* move them to index.ts only when they are needed by a consumer.
|
|
10
|
+
*/
|
|
11
|
+
import { BBox, IHubContent, IHubGeography, GeographyProvenance } from "../types";
|
|
12
|
+
/**
|
|
13
|
+
* Create a new content with updated boundary properties
|
|
14
|
+
* @param content original content
|
|
15
|
+
* @param boundary boundary provenance
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare const setContentBoundary: (content: IHubContent, boundary: GeographyProvenance) => {
|
|
19
|
+
boundary: IHubGeography;
|
|
20
|
+
item: any;
|
|
21
|
+
hubId?: string;
|
|
22
|
+
permissions: {
|
|
23
|
+
visibility: "private" | "public" | "org";
|
|
24
|
+
control?: import("../types").AccessControl;
|
|
25
|
+
groups?: import("@esri/arcgis-rest-types").IGroup[];
|
|
26
|
+
};
|
|
27
|
+
family?: import("../types").HubFamily;
|
|
28
|
+
itemCategories?: string[];
|
|
29
|
+
normalizedType?: string;
|
|
30
|
+
publishedDate: Date;
|
|
31
|
+
publishedDateSource?: string;
|
|
32
|
+
updateFrequency?: string;
|
|
33
|
+
actionLinks?: import("../types").IActionLink[];
|
|
34
|
+
hubActions?: object;
|
|
35
|
+
metrics?: {
|
|
36
|
+
visibility: "private" | "public" | "org" | "updateGroups";
|
|
37
|
+
};
|
|
38
|
+
slug?: string;
|
|
39
|
+
portalDataUrl?: string;
|
|
40
|
+
groupIds?: string[];
|
|
41
|
+
errors?: import("../types").IEnrichmentErrorInfo[];
|
|
42
|
+
data?: {
|
|
43
|
+
[propName: string]: any;
|
|
44
|
+
};
|
|
45
|
+
server?: Partial<import("@esri/arcgis-rest-types").IFeatureServiceDefinition>;
|
|
46
|
+
layers?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>[];
|
|
47
|
+
layer?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>;
|
|
48
|
+
recordCount?: number;
|
|
49
|
+
orgId?: string;
|
|
50
|
+
org?: Partial<import("@esri/arcgis-rest-portal").IPortal>;
|
|
51
|
+
isDownloadable: boolean;
|
|
52
|
+
structuredLicense?: import("..").IStructuredLicense;
|
|
53
|
+
name: string;
|
|
54
|
+
summary?: string;
|
|
55
|
+
hubType: import("../types").HubType;
|
|
56
|
+
createdDate: Date;
|
|
57
|
+
createdDateSource?: string;
|
|
58
|
+
updatedDate: Date;
|
|
59
|
+
updatedDateSource?: string;
|
|
60
|
+
portalHomeUrl?: string;
|
|
61
|
+
portalApiUrl?: string;
|
|
62
|
+
thumbnailUrl?: string;
|
|
63
|
+
metadata?: any;
|
|
64
|
+
id: string;
|
|
65
|
+
owner: string;
|
|
66
|
+
tags: string[];
|
|
67
|
+
created: number;
|
|
68
|
+
modified: number;
|
|
69
|
+
numViews: number;
|
|
70
|
+
size: number;
|
|
71
|
+
protected?: boolean;
|
|
72
|
+
title: string;
|
|
73
|
+
type: string;
|
|
74
|
+
typeKeywords?: string[];
|
|
75
|
+
description?: string;
|
|
76
|
+
snippet?: string;
|
|
77
|
+
documentation?: string;
|
|
78
|
+
extent?: number[][];
|
|
79
|
+
categories?: string[];
|
|
80
|
+
spatialReference?: import("@esri/arcgis-rest-types").ISpatialReference;
|
|
81
|
+
culture?: string;
|
|
82
|
+
properties?: any;
|
|
83
|
+
url?: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Create a new content with updated extent and derived properties like boundary
|
|
87
|
+
* @param content original content
|
|
88
|
+
* @param extent new extent
|
|
89
|
+
* @returns a new content with the updated extent and boundary
|
|
90
|
+
*/
|
|
91
|
+
export declare const setContentExtent: (content: IHubContent, extent: BBox) => IHubContent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResourceObject } from "jsonapi-typescript";
|
|
2
2
|
import { IItem } from "@esri/arcgis-rest-portal";
|
|
3
|
-
import { HubType, HubFamily } from "
|
|
4
|
-
import { IHubContent, IModel } from "
|
|
3
|
+
import { HubType, HubFamily } from "../types";
|
|
4
|
+
import { IHubContent, IModel } from "../types";
|
|
5
5
|
/**
|
|
6
6
|
* JSONAPI dataset resource returned by the Hub API
|
|
7
7
|
*/
|
|
@@ -203,7 +203,7 @@ export declare function datasetToContent(dataset: DatasetResource): IHubContent;
|
|
|
203
203
|
*/
|
|
204
204
|
export declare function datasetToItem(dataset: DatasetResource): IItem;
|
|
205
205
|
/**
|
|
206
|
-
*
|
|
206
|
+
* returns a new content that has the specified type and
|
|
207
207
|
* and updated related properties like normalizedType, family, etc
|
|
208
208
|
* @param content orignal content
|
|
209
209
|
* @param type new type
|
|
@@ -211,12 +211,23 @@ export declare function datasetToItem(dataset: DatasetResource): IItem;
|
|
|
211
211
|
*/
|
|
212
212
|
export declare const setContentType: (content: IHubContent, type: string) => IHubContent;
|
|
213
213
|
/**
|
|
214
|
-
*
|
|
214
|
+
* returns a new content that has the specified hubId and updated identifier
|
|
215
215
|
* @param content orignal content
|
|
216
216
|
* @param hubId new hubId
|
|
217
217
|
* @returns new content
|
|
218
218
|
*/
|
|
219
219
|
export declare const setContentHubId: (content: IHubContent, hubId: string) => IHubContent;
|
|
220
|
+
/**
|
|
221
|
+
* Calculates the relative and absolute urls for a given content on a specific site
|
|
222
|
+
*
|
|
223
|
+
* @param content
|
|
224
|
+
* @param siteModel
|
|
225
|
+
* @returns relative and absolute urls
|
|
226
|
+
*/
|
|
227
|
+
export declare const getContentSiteUrls: (content: IHubContent, siteModel: IModel) => {
|
|
228
|
+
relative: string;
|
|
229
|
+
absolute: string;
|
|
230
|
+
};
|
|
220
231
|
/**
|
|
221
232
|
* append the absolute URL to the content on the site
|
|
222
233
|
* also updates the relative URL in case the
|
package/dist/types/extent.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IExtent } from "@esri/arcgis-rest-types";
|
|
2
|
-
import { IHubRequestOptions,
|
|
1
|
+
import { IExtent, IPolygon } from "@esri/arcgis-rest-types";
|
|
2
|
+
import { IHubRequestOptions, BBox } from "./types";
|
|
3
3
|
export declare function createExtent(xmin: number, ymin: number, xmax: number, ymax: number, wkid?: number): IExtent;
|
|
4
4
|
/**
|
|
5
5
|
* Turns an extent into a bbox
|
|
6
6
|
* @param envelope extent
|
|
7
7
|
*/
|
|
8
|
-
export declare function extentToBBox(envelope: IExtent):
|
|
8
|
+
export declare function extentToBBox(envelope: IExtent): BBox;
|
|
9
9
|
export declare const GLOBAL_EXTENT: IExtent;
|
|
10
10
|
/**
|
|
11
11
|
* Gets the geographic extent for an org
|
|
@@ -16,7 +16,13 @@ export declare function getGeographicOrgExtent(hubRequestOptions: IHubRequestOpt
|
|
|
16
16
|
* Get the default org extent as a bbox for use on item.extent
|
|
17
17
|
* @param {IHubRequestOptions} hubRequestOptions
|
|
18
18
|
*/
|
|
19
|
-
export declare function getOrgExtentAsBBox(hubRequestOptions: IHubRequestOptions): Promise<
|
|
19
|
+
export declare function getOrgExtentAsBBox(hubRequestOptions: IHubRequestOptions): Promise<BBox>;
|
|
20
|
+
/**
|
|
21
|
+
* checks if the extent is a valid BBox (2 element array of coordinate pair arrays)
|
|
22
|
+
* @param extent
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare const isBBox: (extent: unknown) => boolean;
|
|
20
26
|
export declare function isExtentCoordinateArray(extent: object): boolean;
|
|
21
27
|
/**
|
|
22
28
|
* Check if the given extent is in a known format
|
|
@@ -24,3 +30,4 @@ export declare function isExtentCoordinateArray(extent: object): boolean;
|
|
|
24
30
|
* @return {Boolean} indicator
|
|
25
31
|
*/
|
|
26
32
|
export declare function isValidExtent(extent: object): boolean;
|
|
33
|
+
export declare const bBoxToPolygon: (bBox: BBox) => IPolygon;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export interface IItemResource {
|
|
|
102
102
|
url: string;
|
|
103
103
|
name: string;
|
|
104
104
|
}
|
|
105
|
+
export declare type BBox = number[][];
|
|
105
106
|
export declare type IBBox = number[][];
|
|
106
107
|
export declare type IBatch = any[];
|
|
107
108
|
export declare type IBatchTransform = (value: any) => any;
|
|
@@ -139,6 +140,7 @@ export declare type Visibility = "private" | "org" | "public";
|
|
|
139
140
|
* User's access level to a Hub resource
|
|
140
141
|
*/
|
|
141
142
|
export declare type AccessControl = "view" | "edit" | "admin";
|
|
143
|
+
export declare type GeographyProvenance = "item" | "none" | "automatic";
|
|
142
144
|
/**
|
|
143
145
|
* Location of a Hub resource
|
|
144
146
|
*
|
|
@@ -148,6 +150,7 @@ export declare type AccessControl = "view" | "edit" | "admin";
|
|
|
148
150
|
export interface IHubGeography {
|
|
149
151
|
center?: [number, number];
|
|
150
152
|
geometry?: IGeometry;
|
|
153
|
+
provenance?: GeographyProvenance;
|
|
151
154
|
}
|
|
152
155
|
export declare type SearchableType = IItem | IGroup | IUser;
|
|
153
156
|
export declare type SearchFunction = (...args: any[]) => Promise<ISearchResult<SearchableType>>;
|
|
@@ -295,7 +298,7 @@ export interface IHubContent extends IHubResource, IItem {
|
|
|
295
298
|
/** The content's structured license info */
|
|
296
299
|
structuredLicense?: IStructuredLicense;
|
|
297
300
|
}
|
|
298
|
-
interface IActionLink {
|
|
301
|
+
export interface IActionLink {
|
|
299
302
|
/** Link title */
|
|
300
303
|
title: string;
|
|
301
304
|
/** Link URL */
|
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/hub-common - v9.
|
|
2
|
+
* @esri/hub-common - v9.9.0 - Wed Dec 22 2021 11:46:07 GMT-0800 (Pacific Standard Time)
|
|
3
3
|
* Copyright (c) 2021 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -528,7 +528,7 @@
|
|
|
528
528
|
var worker = target;
|
|
529
529
|
var lastIdx = parts.length - 1;
|
|
530
530
|
parts.forEach(function (p, idx) {
|
|
531
|
-
if (!worker.hasOwnProperty(p) || worker[p]
|
|
531
|
+
if (!worker.hasOwnProperty(p) || worker[p] == null) {
|
|
532
532
|
if (idx === lastIdx) {
|
|
533
533
|
worker[p] = value;
|
|
534
534
|
}
|
|
@@ -5169,8 +5169,8 @@
|
|
|
5169
5169
|
ymax: ymax,
|
|
5170
5170
|
// type: 'extent',
|
|
5171
5171
|
spatialReference: {
|
|
5172
|
-
wkid: wkid
|
|
5173
|
-
}
|
|
5172
|
+
wkid: wkid,
|
|
5173
|
+
},
|
|
5174
5174
|
};
|
|
5175
5175
|
}
|
|
5176
5176
|
/**
|
|
@@ -5178,7 +5178,10 @@
|
|
|
5178
5178
|
* @param envelope extent
|
|
5179
5179
|
*/
|
|
5180
5180
|
function extentToBBox(envelope) {
|
|
5181
|
-
return [
|
|
5181
|
+
return [
|
|
5182
|
+
[envelope.xmin, envelope.ymin],
|
|
5183
|
+
[envelope.xmax, envelope.ymax],
|
|
5184
|
+
];
|
|
5182
5185
|
}
|
|
5183
5186
|
var GLOBAL_EXTENT = {
|
|
5184
5187
|
xmin: -180,
|
|
@@ -5186,8 +5189,8 @@
|
|
|
5186
5189
|
xmax: 180,
|
|
5187
5190
|
ymax: 90,
|
|
5188
5191
|
spatialReference: {
|
|
5189
|
-
wkid: 4326
|
|
5190
|
-
}
|
|
5192
|
+
wkid: 4326,
|
|
5193
|
+
},
|
|
5191
5194
|
};
|
|
5192
5195
|
/**
|
|
5193
5196
|
* Gets the geographic extent for an org
|
|
@@ -5208,7 +5211,7 @@
|
|
|
5208
5211
|
// geometry params...
|
|
5209
5212
|
var geometryParam = {
|
|
5210
5213
|
geometryType: "esriGeometryEnvelope",
|
|
5211
|
-
geometries: [orgExtent]
|
|
5214
|
+
geometries: [orgExtent],
|
|
5212
5215
|
};
|
|
5213
5216
|
var options = {
|
|
5214
5217
|
httpMethod: "POST",
|
|
@@ -5218,8 +5221,8 @@
|
|
|
5218
5221
|
transformation: "",
|
|
5219
5222
|
inSR: orgExtent.spatialReference.wkid,
|
|
5220
5223
|
outSR: 4326,
|
|
5221
|
-
f: "json"
|
|
5222
|
-
}
|
|
5224
|
+
f: "json",
|
|
5225
|
+
},
|
|
5223
5226
|
};
|
|
5224
5227
|
// add in auth if it's passed
|
|
5225
5228
|
if (hubRequestOptions.authentication) {
|
|
@@ -5234,8 +5237,8 @@
|
|
|
5234
5237
|
xmax: geom.xmax,
|
|
5235
5238
|
ymax: geom.ymax,
|
|
5236
5239
|
spatialReference: {
|
|
5237
|
-
wkid: 4326
|
|
5238
|
-
}
|
|
5240
|
+
wkid: 4326,
|
|
5241
|
+
},
|
|
5239
5242
|
};
|
|
5240
5243
|
})
|
|
5241
5244
|
.catch(function (ex) {
|
|
@@ -5251,10 +5254,21 @@
|
|
|
5251
5254
|
return extentToBBox(extent);
|
|
5252
5255
|
});
|
|
5253
5256
|
}
|
|
5254
|
-
|
|
5257
|
+
/**
|
|
5258
|
+
* checks if the extent is a valid BBox (2 element array of coordinate pair arrays)
|
|
5259
|
+
* @param extent
|
|
5260
|
+
* @returns
|
|
5261
|
+
*/
|
|
5262
|
+
var isBBox = function (extent) {
|
|
5255
5263
|
return (Array.isArray(extent) &&
|
|
5256
5264
|
Array.isArray(extent[0]) &&
|
|
5257
5265
|
Array.isArray(extent[1]));
|
|
5266
|
+
};
|
|
5267
|
+
function isExtentCoordinateArray(extent) {
|
|
5268
|
+
/* tslint:disable no-console */
|
|
5269
|
+
console.warn("DEPRECATED: use isBBox() instead");
|
|
5270
|
+
/* tslint:enable no-console */
|
|
5271
|
+
return isBBox(extent);
|
|
5258
5272
|
}
|
|
5259
5273
|
function isExtentJSON(extent) {
|
|
5260
5274
|
return ["xmin", "ymin", "xmax", "ymax"].every(function (key) { return typeof extent[key] === "number"; });
|
|
@@ -5268,6 +5282,25 @@
|
|
|
5268
5282
|
return (!!extent &&
|
|
5269
5283
|
[isExtentCoordinateArray, isExtentJSON].some(function (test) { return test(extent); }));
|
|
5270
5284
|
}
|
|
5285
|
+
var bBoxToPolygon = function (bBox) {
|
|
5286
|
+
var _a = bBox[0], xmin = _a[0], ymin = _a[1], _b = bBox[1], xmax = _b[0], ymax = _b[1];
|
|
5287
|
+
var rings = [
|
|
5288
|
+
[
|
|
5289
|
+
[xmin, ymin],
|
|
5290
|
+
[xmax, ymin],
|
|
5291
|
+
[xmax, ymax],
|
|
5292
|
+
[xmin, ymax],
|
|
5293
|
+
[xmin, ymin],
|
|
5294
|
+
],
|
|
5295
|
+
];
|
|
5296
|
+
var wkid = 4326;
|
|
5297
|
+
return {
|
|
5298
|
+
rings: rings,
|
|
5299
|
+
spatialReference: {
|
|
5300
|
+
wkid: wkid,
|
|
5301
|
+
},
|
|
5302
|
+
};
|
|
5303
|
+
};
|
|
5271
5304
|
|
|
5272
5305
|
var STANDARD_LICENSES = [
|
|
5273
5306
|
{
|
|
@@ -5564,6 +5597,56 @@
|
|
|
5564
5597
|
return isSingleAnchorTagRegex.test(rawLicense);
|
|
5565
5598
|
}
|
|
5566
5599
|
|
|
5600
|
+
/**
|
|
5601
|
+
* Use this module for functions that do not need to be used by consumers (yet),
|
|
5602
|
+
* but may be shared between hub.js modules, and/or need to be tested
|
|
5603
|
+
* to get 100% coverage w/o writing cumbersome tests of higher level functions.
|
|
5604
|
+
*
|
|
5605
|
+
* Consuming will not be able to import these functions.
|
|
5606
|
+
*
|
|
5607
|
+
* It's probably a good pattern to add functions here first and then
|
|
5608
|
+
* move them to index.ts only when they are needed by a consumer.
|
|
5609
|
+
*/
|
|
5610
|
+
/**
|
|
5611
|
+
* Create a new content with updated extent and derived properties like boundary
|
|
5612
|
+
* @param content original content
|
|
5613
|
+
* @param extent new extent
|
|
5614
|
+
* @returns a new content with the updated extent and boundary
|
|
5615
|
+
*/
|
|
5616
|
+
var setContentExtent = function (content, extent) {
|
|
5617
|
+
// update content's item and extent
|
|
5618
|
+
var item = __assign(__assign({}, content.item), { extent: extent });
|
|
5619
|
+
var updated = __assign(__assign({}, content), { item: item, extent: extent });
|
|
5620
|
+
// derive boundary from content properties
|
|
5621
|
+
var boundary = getContentBoundary(updated);
|
|
5622
|
+
return __assign(__assign({}, updated), { boundary: boundary });
|
|
5623
|
+
};
|
|
5624
|
+
var getContentBoundary = function (content) {
|
|
5625
|
+
var _a;
|
|
5626
|
+
var item = content.item;
|
|
5627
|
+
var extent = item.extent;
|
|
5628
|
+
var isValidItemExtent = isBBox(extent);
|
|
5629
|
+
// user specified provenance is stored in item.properties
|
|
5630
|
+
var provenance = ((_a = item.properties) === null || _a === void 0 ? void 0 : _a.boundary) ||
|
|
5631
|
+
// but we default to item if the item has an extent
|
|
5632
|
+
(isValidItemExtent ? "item" : undefined);
|
|
5633
|
+
var geometry;
|
|
5634
|
+
switch (provenance) {
|
|
5635
|
+
case "item":
|
|
5636
|
+
geometry = isValidItemExtent ? bBoxToPolygon(extent) : null;
|
|
5637
|
+
break;
|
|
5638
|
+
case "none":
|
|
5639
|
+
geometry = null;
|
|
5640
|
+
break;
|
|
5641
|
+
// TODO: handle other provenances
|
|
5642
|
+
}
|
|
5643
|
+
// TODO: derive and return center
|
|
5644
|
+
return {
|
|
5645
|
+
provenance: provenance,
|
|
5646
|
+
geometry: geometry,
|
|
5647
|
+
};
|
|
5648
|
+
};
|
|
5649
|
+
|
|
5567
5650
|
function collectionToFamily(collection) {
|
|
5568
5651
|
var overrides = {
|
|
5569
5652
|
other: "content",
|
|
@@ -5571,13 +5654,6 @@
|
|
|
5571
5654
|
};
|
|
5572
5655
|
return overrides[collection] || collection;
|
|
5573
5656
|
}
|
|
5574
|
-
function itemExtentToBoundary(extent) {
|
|
5575
|
-
return (extent &&
|
|
5576
|
-
extent.length && {
|
|
5577
|
-
// TODO: center?
|
|
5578
|
-
geometry: createExtent(extent[0][0], extent[0][1], extent[1][0], extent[1][1]),
|
|
5579
|
-
});
|
|
5580
|
-
}
|
|
5581
5657
|
var cache = {};
|
|
5582
5658
|
// TODO: remove this at next breaking version
|
|
5583
5659
|
/**
|
|
@@ -5977,7 +6053,6 @@
|
|
|
5977
6053
|
metrics: properties && properties.metrics,
|
|
5978
6054
|
isDownloadable: isDownloadable(item),
|
|
5979
6055
|
// default boundary from item.extent
|
|
5980
|
-
boundary: itemExtentToBoundary(item.extent),
|
|
5981
6056
|
license: { name: "Custom License", description: item.accessInformation },
|
|
5982
6057
|
// dates and sources we will enrich these later...
|
|
5983
6058
|
createdDate: createdDate,
|
|
@@ -5988,7 +6063,7 @@
|
|
|
5988
6063
|
updatedDateSource: "item.modified",
|
|
5989
6064
|
structuredLicense: getStructuredLicense(item.licenseInfo),
|
|
5990
6065
|
});
|
|
5991
|
-
return setContentType(content, item.type);
|
|
6066
|
+
return setContentExtent(setContentType(content, item.type), item.extent);
|
|
5992
6067
|
}
|
|
5993
6068
|
/**
|
|
5994
6069
|
* Convert a Hub API dataset resource to Hub Content
|
|
@@ -6031,9 +6106,7 @@
|
|
|
6031
6106
|
content.errors = errors;
|
|
6032
6107
|
// common enrichments
|
|
6033
6108
|
content.boundary = boundary;
|
|
6034
|
-
if (!
|
|
6035
|
-
extent &&
|
|
6036
|
-
isExtentCoordinateArray(extent.coordinates)) {
|
|
6109
|
+
if (!isBBox(item.extent) && extent && isBBox(extent.coordinates)) {
|
|
6037
6110
|
// we fall back to the extent derived by the API
|
|
6038
6111
|
// which prefers layer or service extents and ultimately
|
|
6039
6112
|
// falls back to the org's extent
|
|
@@ -6179,7 +6252,7 @@
|
|
|
6179
6252
|
};
|
|
6180
6253
|
}
|
|
6181
6254
|
/**
|
|
6182
|
-
*
|
|
6255
|
+
* returns a new content that has the specified type and
|
|
6183
6256
|
* and updated related properties like normalizedType, family, etc
|
|
6184
6257
|
* @param content orignal content
|
|
6185
6258
|
* @param type new type
|
|
@@ -6187,8 +6260,9 @@
|
|
|
6187
6260
|
*/
|
|
6188
6261
|
var setContentType = function (content, type) {
|
|
6189
6262
|
// get family and normalized type based on new type
|
|
6190
|
-
var family = getFamily(type);
|
|
6191
6263
|
var normalizedType = normalizeItemType(__assign(__assign({}, content.item), { type: type }));
|
|
6264
|
+
var family = getFamily(normalizedType);
|
|
6265
|
+
// TODO: don't we need to update content.item.type too?
|
|
6192
6266
|
var updated = __assign(__assign({}, content), { type: type, family: family, normalizedType: normalizedType });
|
|
6193
6267
|
// update the relative URL to the content
|
|
6194
6268
|
// which is based on type and family
|
|
@@ -6197,7 +6271,7 @@
|
|
|
6197
6271
|
});
|
|
6198
6272
|
};
|
|
6199
6273
|
/**
|
|
6200
|
-
*
|
|
6274
|
+
* returns a new content that has the specified hubId and updated identifier
|
|
6201
6275
|
* @param content orignal content
|
|
6202
6276
|
* @param hubId new hubId
|
|
6203
6277
|
* @returns new content
|
|
@@ -6214,19 +6288,30 @@
|
|
|
6214
6288
|
});
|
|
6215
6289
|
};
|
|
6216
6290
|
/**
|
|
6217
|
-
*
|
|
6218
|
-
*
|
|
6291
|
+
* Calculates the relative and absolute urls for a given content on a specific site
|
|
6292
|
+
*
|
|
6219
6293
|
* @param content
|
|
6220
6294
|
* @param siteModel
|
|
6221
|
-
* @returns
|
|
6295
|
+
* @returns relative and absolute urls
|
|
6222
6296
|
*/
|
|
6223
|
-
var
|
|
6224
|
-
//
|
|
6297
|
+
var getContentSiteUrls = function (content, siteModel) {
|
|
6298
|
+
// compute relative URL using a site specific identifier
|
|
6225
6299
|
var siteIdentifier = getContentIdentifier(content, siteModel);
|
|
6226
6300
|
var relative = getContentRelativeUrl(content, siteIdentifier);
|
|
6227
6301
|
// get the absolute URL to this content on the site
|
|
6228
6302
|
var siteUrl = getProp(siteModel, "item.url").replace(/\/$/, "");
|
|
6229
|
-
var
|
|
6303
|
+
var absolute = "" + siteUrl + relative;
|
|
6304
|
+
return { relative: relative, absolute: absolute };
|
|
6305
|
+
};
|
|
6306
|
+
/**
|
|
6307
|
+
* append the absolute URL to the content on the site
|
|
6308
|
+
* also updates the relative URL in case the
|
|
6309
|
+
* @param content
|
|
6310
|
+
* @param siteModel
|
|
6311
|
+
* @returns
|
|
6312
|
+
*/
|
|
6313
|
+
var setContentSiteUrls = function (content, siteModel) {
|
|
6314
|
+
var _a = getContentSiteUrls(content, siteModel), relative = _a.relative, site = _a.absolute;
|
|
6230
6315
|
// append the updated URLs to a new content
|
|
6231
6316
|
return appendContentUrls(content, {
|
|
6232
6317
|
relative: relative,
|
|
@@ -10073,6 +10158,9 @@
|
|
|
10073
10158
|
model = _purgeNonGuidsFromCatalog(model);
|
|
10074
10159
|
model = _ensureTelemetry(model);
|
|
10075
10160
|
model = _migrateFeedConfig(model);
|
|
10161
|
+
// WARNING - If you are writing a site schema migration,
|
|
10162
|
+
// you probably need to apply it to site drafts as well!
|
|
10163
|
+
// See https://github.com/Esri/hub.js/issues/498 for more details.
|
|
10076
10164
|
return model;
|
|
10077
10165
|
}
|
|
10078
10166
|
}
|
|
@@ -10721,6 +10809,7 @@
|
|
|
10721
10809
|
exports.arrayToObject = arrayToObject;
|
|
10722
10810
|
exports.atob = abab.atob;
|
|
10723
10811
|
exports.autoAddUsers = autoAddUsers;
|
|
10812
|
+
exports.bBoxToPolygon = bBoxToPolygon;
|
|
10724
10813
|
exports.batch = batch;
|
|
10725
10814
|
exports.btoa = abab.btoa;
|
|
10726
10815
|
exports.buildDraft = buildDraft;
|
|
@@ -10782,6 +10871,7 @@
|
|
|
10782
10871
|
exports.getCategory = getCategory;
|
|
10783
10872
|
exports.getCollection = getCollection;
|
|
10784
10873
|
exports.getContentIdentifier = getContentIdentifier;
|
|
10874
|
+
exports.getContentSiteUrls = getContentSiteUrls;
|
|
10785
10875
|
exports.getCulture = getCulture;
|
|
10786
10876
|
exports.getDomainsForSite = getDomainsForSite;
|
|
10787
10877
|
exports.getExportItemTypeKeyword = getExportItemTypeKeyword;
|
|
@@ -10835,6 +10925,7 @@
|
|
|
10835
10925
|
exports.interpolate = interpolate;
|
|
10836
10926
|
exports.interpolateItemId = interpolateItemId;
|
|
10837
10927
|
exports.inviteUsers = inviteUsers;
|
|
10928
|
+
exports.isBBox = isBBox;
|
|
10838
10929
|
exports.isDomainForLegacySite = isDomainForLegacySite;
|
|
10839
10930
|
exports.isDomainUsedElsewhere = isDomainUsedElsewhere;
|
|
10840
10931
|
exports.isDownloadable = isDownloadable;
|