@esri/hub-common 9.17.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.
- package/dist/es2017/Hub.js +6 -10
- package/dist/es2017/Hub.js.map +1 -1
- package/dist/es2017/HubError.js +2 -1
- package/dist/es2017/HubError.js.map +1 -1
- package/dist/es2017/content/_internal.js +151 -30
- package/dist/es2017/content/_internal.js.map +1 -1
- package/dist/es2017/content/compose.js +607 -0
- package/dist/es2017/content/compose.js.map +1 -0
- package/dist/es2017/content/get-family.js +42 -0
- package/dist/es2017/content/get-family.js.map +1 -0
- package/dist/es2017/content/index.js +42 -468
- package/dist/es2017/content/index.js.map +1 -1
- package/dist/es2017/core/types/IHubContentEnrichments.js +1 -0
- package/dist/es2017/core/types/IHubContentEnrichments.js.map +1 -0
- package/dist/es2017/core/types/IHubItemEntityManager.js +1 -0
- package/dist/es2017/core/types/IHubItemEntityManager.js.map +1 -0
- package/dist/es2017/core/types/IServerEnrichments.js +1 -0
- package/dist/es2017/core/types/IServerEnrichments.js.map +1 -0
- package/dist/es2017/core/types/index.js +2 -1
- package/dist/es2017/core/types/index.js.map +1 -1
- package/dist/es2017/items/index.js +1 -0
- package/dist/es2017/items/index.js.map +1 -1
- package/dist/es2017/items/setItemThumbnail.js +31 -0
- package/dist/es2017/items/setItemThumbnail.js.map +1 -0
- package/dist/es2017/items/slugs.js +39 -15
- package/dist/es2017/items/slugs.js.map +1 -1
- package/dist/es2017/models/index.js +13 -0
- package/dist/es2017/models/index.js.map +1 -1
- package/dist/es2017/projects/HubProjectManager.js +40 -4
- package/dist/es2017/projects/HubProjectManager.js.map +1 -1
- package/dist/es2017/projects/HubProjects.js +91 -18
- package/dist/es2017/projects/HubProjects.js.map +1 -1
- package/dist/esm/Hub.js +6 -10
- package/dist/esm/Hub.js.map +1 -1
- package/dist/esm/HubError.js +2 -1
- package/dist/esm/HubError.js.map +1 -1
- package/dist/esm/content/_internal.js +153 -30
- package/dist/esm/content/_internal.js.map +1 -1
- package/dist/esm/content/compose.js +600 -0
- package/dist/esm/content/compose.js.map +1 -0
- package/dist/esm/content/get-family.js +42 -0
- package/dist/esm/content/get-family.js.map +1 -0
- package/dist/esm/content/index.js +44 -476
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/core/types/IHubContentEnrichments.js +1 -0
- package/dist/esm/core/types/IHubContentEnrichments.js.map +1 -0
- package/dist/esm/core/types/IHubItemEntityManager.js +1 -0
- package/dist/esm/core/types/IHubItemEntityManager.js.map +1 -0
- package/dist/esm/core/types/IServerEnrichments.js +1 -0
- package/dist/esm/core/types/IServerEnrichments.js.map +1 -0
- package/dist/esm/core/types/index.js +2 -1
- package/dist/esm/core/types/index.js.map +1 -1
- package/dist/esm/items/index.js +1 -0
- package/dist/esm/items/index.js.map +1 -1
- package/dist/esm/items/setItemThumbnail.js +46 -0
- package/dist/esm/items/setItemThumbnail.js.map +1 -0
- package/dist/esm/items/slugs.js +39 -15
- package/dist/esm/items/slugs.js.map +1 -1
- package/dist/esm/models/index.js +23 -1
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/projects/HubProjectManager.js +58 -4
- package/dist/esm/projects/HubProjectManager.js.map +1 -1
- package/dist/esm/projects/HubProjects.js +100 -21
- package/dist/esm/projects/HubProjects.js.map +1 -1
- package/dist/node/Hub.js +6 -10
- package/dist/node/Hub.js.map +1 -1
- package/dist/node/HubError.js +5 -4
- package/dist/node/HubError.js.map +1 -1
- package/dist/node/content/_internal.js +155 -31
- package/dist/node/content/_internal.js.map +1 -1
- package/dist/node/content/compose.js +612 -0
- package/dist/node/content/compose.js.map +1 -0
- package/dist/node/content/get-family.js +46 -0
- package/dist/node/content/get-family.js.map +1 -0
- package/dist/node/content/index.js +48 -477
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/core/types/IHubContentEnrichments.js +3 -0
- package/dist/node/core/types/IHubContentEnrichments.js.map +1 -0
- package/dist/node/core/types/IHubItemEntityManager.js +3 -0
- package/dist/node/core/types/IHubItemEntityManager.js.map +1 -0
- package/dist/node/core/types/{IContentEnrichments.js → IServerEnrichments.js} +1 -1
- package/dist/node/core/types/IServerEnrichments.js.map +1 -0
- package/dist/node/core/types/index.js +2 -1
- package/dist/node/core/types/index.js.map +1 -1
- package/dist/node/items/index.js +1 -0
- package/dist/node/items/index.js.map +1 -1
- package/dist/node/items/setItemThumbnail.js +35 -0
- package/dist/node/items/setItemThumbnail.js.map +1 -0
- package/dist/node/items/slugs.js +42 -17
- package/dist/node/items/slugs.js.map +1 -1
- package/dist/node/models/index.js +15 -1
- package/dist/node/models/index.js.map +1 -1
- package/dist/node/projects/HubProjectManager.js +38 -2
- package/dist/node/projects/HubProjectManager.js.map +1 -1
- package/dist/node/projects/HubProjects.js +91 -17
- package/dist/node/projects/HubProjects.js.map +1 -1
- package/dist/types/Hub.d.ts +7 -11
- package/dist/types/HubError.d.ts +1 -1
- package/dist/types/content/_internal.d.ts +57 -22
- package/dist/types/content/compose.d.ts +115 -0
- package/dist/types/content/get-family.d.ts +7 -0
- package/dist/types/content/index.d.ts +4 -86
- package/dist/types/core/types/IHubContent.d.ts +4 -2
- package/dist/types/core/types/IHubContentEnrichments.d.ts +15 -0
- package/dist/types/core/types/IHubEntityManager.d.ts +16 -0
- package/dist/types/core/types/IHubItemEntity.d.ts +1 -1
- package/dist/types/core/types/IHubItemEntityManager.d.ts +15 -0
- package/dist/types/core/types/{IContentEnrichments.d.ts → IServerEnrichments.d.ts} +3 -2
- package/dist/types/core/types/index.d.ts +2 -1
- package/dist/types/items/index.d.ts +1 -0
- package/dist/types/items/setItemThumbnail.d.ts +9 -0
- package/dist/types/items/slugs.d.ts +20 -1
- package/dist/types/models/index.d.ts +8 -0
- package/dist/types/projects/HubProjectManager.d.ts +21 -3
- package/dist/types/projects/HubProjects.d.ts +3 -1
- package/dist/umd/common.umd.js +1238 -663
- 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 +1 -1
- package/dist/es2017/core/types/IContentEnrichments.js +0 -1
- package/dist/es2017/core/types/IContentEnrichments.js.map +0 -1
- package/dist/esm/core/types/IContentEnrichments.js +0 -1
- package/dist/esm/core/types/IContentEnrichments.js.map +0 -1
- package/dist/node/core/types/IContentEnrichments.js.map +0 -1
package/dist/types/Hub.d.ts
CHANGED
|
@@ -24,14 +24,12 @@ export interface IHubOptions {
|
|
|
24
24
|
*
|
|
25
25
|
* myHub.context.currentUser //=> {username: "casey", ...} as IUser
|
|
26
26
|
*
|
|
27
|
-
* const
|
|
28
|
-
*
|
|
29
|
-
* const pavingProject = await projectStore.create({name: "12th Street Paving"});
|
|
27
|
+
* const pavingProject = await myHub.projects.create({name: "12th Street Paving"});
|
|
30
28
|
* pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
|
|
31
|
-
* await
|
|
29
|
+
* await myHub.projects.update(pavingProject);
|
|
32
30
|
* ```
|
|
33
31
|
*
|
|
34
|
-
* This is a convenience class. Hub
|
|
32
|
+
* This is a convenience class. Hub Managers can be created
|
|
35
33
|
* directly, or the underlying functions can be imported an used
|
|
36
34
|
* as need for scenarios where these class structures introduce
|
|
37
35
|
* unwanted complexity
|
|
@@ -42,20 +40,18 @@ export declare class Hub {
|
|
|
42
40
|
* an application. When authentication changes, the .context
|
|
43
41
|
* property on the context manager will be replaced. As long as
|
|
44
42
|
* all the fns in this class leverage properties on .context
|
|
45
|
-
* everything be kept in sync.
|
|
43
|
+
* everything will be kept in sync.
|
|
46
44
|
*/
|
|
47
45
|
private _contextManager;
|
|
48
46
|
private _projectManager;
|
|
49
47
|
/**
|
|
50
|
-
* Private so we can employ a factory function
|
|
48
|
+
* Private so we can employ a factory function to do
|
|
51
49
|
* async work during creation
|
|
52
50
|
* @param contextManager
|
|
53
51
|
*/
|
|
54
52
|
private constructor();
|
|
55
53
|
/**
|
|
56
|
-
* Factory function to construct a new
|
|
57
|
-
*
|
|
58
|
-
* Note: Used so that we could do async actions in the ctor.
|
|
54
|
+
* Factory function to construct a new Hub instance.
|
|
59
55
|
* @param contextManager
|
|
60
56
|
* @returns
|
|
61
57
|
*/
|
|
@@ -65,7 +61,7 @@ export declare class Hub {
|
|
|
65
61
|
*/
|
|
66
62
|
get context(): import("./ArcGISContext").IArcGISContext;
|
|
67
63
|
/**
|
|
68
|
-
*
|
|
64
|
+
* HubProjectManager for the current Hub
|
|
69
65
|
* @returns
|
|
70
66
|
*/
|
|
71
67
|
get projects(): HubProjectManager;
|
package/dist/types/HubError.d.ts
CHANGED
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
* It's probably a good pattern to add functions here first and then
|
|
9
9
|
* move them to index.ts only when they are needed by a consumer.
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { ILayerDefinition, IFeatureServiceDefinition } from "@esri/arcgis-rest-feature-layer";
|
|
12
|
+
import { IItem } from "@esri/arcgis-rest-portal";
|
|
13
|
+
import { ISpatialReference } from "@esri/arcgis-rest-types";
|
|
14
|
+
import { IHubContent } from "../core";
|
|
15
|
+
import { IHubGeography, GeographyProvenance, IHubRequestOptions } from "../types";
|
|
13
16
|
/**
|
|
14
17
|
* Create a new content with updated boundary properties
|
|
15
18
|
* @param content original content
|
|
@@ -36,7 +39,7 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
|
|
|
36
39
|
documentation?: string;
|
|
37
40
|
extent?: number[][];
|
|
38
41
|
categories?: string[];
|
|
39
|
-
spatialReference?:
|
|
42
|
+
spatialReference?: ISpatialReference;
|
|
40
43
|
culture?: string;
|
|
41
44
|
url?: string;
|
|
42
45
|
};
|
|
@@ -45,10 +48,10 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
|
|
|
45
48
|
identifier: string;
|
|
46
49
|
permissions: {
|
|
47
50
|
visibility: "private" | "public" | "org";
|
|
48
|
-
control?: import("
|
|
49
|
-
groups?: import("@esri/arcgis-rest-
|
|
51
|
+
control?: import("../types").AccessControl;
|
|
52
|
+
groups?: import("@esri/arcgis-rest-portal").IGroup[];
|
|
50
53
|
};
|
|
51
|
-
family?: import("
|
|
54
|
+
family?: import("../types").HubFamily;
|
|
52
55
|
categories?: string[];
|
|
53
56
|
isDownloadable: boolean;
|
|
54
57
|
structuredLicense?: import("..").IStructuredLicense;
|
|
@@ -58,9 +61,10 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
|
|
|
58
61
|
portalHomeUrl?: string;
|
|
59
62
|
portalApiUrl?: string;
|
|
60
63
|
portalDataUrl?: string;
|
|
61
|
-
actionLinks?: import("
|
|
64
|
+
actionLinks?: import("../types").IActionLink[];
|
|
62
65
|
hubActions?: object;
|
|
63
|
-
layer?: Partial<
|
|
66
|
+
layer?: Partial<ILayerDefinition>;
|
|
67
|
+
isProxied?: boolean;
|
|
64
68
|
itemCategories?: string[];
|
|
65
69
|
normalizedType?: string;
|
|
66
70
|
orgId?: string;
|
|
@@ -79,17 +83,18 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
|
|
|
79
83
|
updatedDate: Date;
|
|
80
84
|
updatedDateSource: string;
|
|
81
85
|
type: string;
|
|
82
|
-
|
|
83
|
-
layers?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>[];
|
|
84
|
-
recordCount?: number;
|
|
86
|
+
statistics?: any;
|
|
85
87
|
data?: {
|
|
86
88
|
[propName: string]: any;
|
|
87
89
|
};
|
|
88
90
|
metadata?: any;
|
|
89
91
|
groupIds?: string[];
|
|
90
|
-
ownerUser?: import("@esri/arcgis-rest-
|
|
92
|
+
ownerUser?: import("@esri/arcgis-rest-portal").IUser;
|
|
91
93
|
org?: Partial<import("@esri/arcgis-rest-portal").IPortal>;
|
|
92
|
-
errors?: import("
|
|
94
|
+
errors?: import("../types").IEnrichmentErrorInfo[];
|
|
95
|
+
server?: Partial<IFeatureServiceDefinition>;
|
|
96
|
+
layers?: Partial<ILayerDefinition>[];
|
|
97
|
+
recordCount?: number;
|
|
93
98
|
created: number;
|
|
94
99
|
modified: number;
|
|
95
100
|
numViews: number;
|
|
@@ -99,16 +104,11 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
|
|
|
99
104
|
snippet?: string;
|
|
100
105
|
documentation?: string;
|
|
101
106
|
extent?: number[][];
|
|
102
|
-
spatialReference?:
|
|
107
|
+
spatialReference?: ISpatialReference;
|
|
103
108
|
properties?: any;
|
|
104
109
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* @param content original content
|
|
108
|
-
* @param extent new extent
|
|
109
|
-
* @returns a new content with the updated extent and boundary
|
|
110
|
-
*/
|
|
111
|
-
export declare const setContentExtent: (content: IHubContent, extent: BBox) => IHubContent;
|
|
110
|
+
export declare const getContentBoundary: (item: IItem) => IHubGeography;
|
|
111
|
+
export declare const isPortal: (requestOptions?: IHubRequestOptions) => boolean;
|
|
112
112
|
/**
|
|
113
113
|
* Returns whether or not an item is a proxied csv
|
|
114
114
|
*
|
|
@@ -116,4 +116,39 @@ export declare const setContentExtent: (content: IHubContent, extent: BBox) => I
|
|
|
116
116
|
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
117
117
|
* @returns
|
|
118
118
|
*/
|
|
119
|
-
export declare const isProxiedCSV: (item: IItem, requestOptions
|
|
119
|
+
export declare const isProxiedCSV: (item: IItem, requestOptions?: IHubRequestOptions) => boolean;
|
|
120
|
+
export declare const getHubRelativeUrl: (type: string, identifier: string, typeKeywords?: string[]) => string;
|
|
121
|
+
export declare const isPageType: (type: string) => boolean;
|
|
122
|
+
export interface IMetadataPaths {
|
|
123
|
+
updateFrequency: string;
|
|
124
|
+
metadataUpdateFrequency: string;
|
|
125
|
+
metadataUpdatedDate: string;
|
|
126
|
+
reviseDate: string;
|
|
127
|
+
pubDate: string;
|
|
128
|
+
createDate: string;
|
|
129
|
+
}
|
|
130
|
+
export declare function getMetadataPath(identifier: keyof IMetadataPaths): string;
|
|
131
|
+
export declare function getValueFromMetadata(metadata: any, identifier: keyof IMetadataPaths): any;
|
|
132
|
+
export declare enum DatePrecision {
|
|
133
|
+
Year = "year",
|
|
134
|
+
Month = "month",
|
|
135
|
+
Day = "day",
|
|
136
|
+
Time = "time"
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Parses an ISO8601 date string into a date and a precision.
|
|
140
|
+
* This is because a) if somone entered 2018, we want to respect that and not treat it as the same as 2018-01-01
|
|
141
|
+
* and b) you cannot naively call new Date with an ISO 8601 string that does not include time information
|
|
142
|
+
* For example, when I, here in mountain time, do new Date('2018').getFullYear() I get "2017".
|
|
143
|
+
* This is because when you do not provide time or timezone info, UTC is assumed, so new Date('2018') is 2018-01-01T00:00:00 in UTC
|
|
144
|
+
* which is actually 7 hours earlier here in mountain time.
|
|
145
|
+
*
|
|
146
|
+
* @param {string} isoString
|
|
147
|
+
* @return { date: Date, precision: DatePrecision }
|
|
148
|
+
*/
|
|
149
|
+
export declare function parseISODateString(isoString: string): {
|
|
150
|
+
date: Date;
|
|
151
|
+
precision: DatePrecision;
|
|
152
|
+
};
|
|
153
|
+
export declare const getServerSpatialReference: (server: Partial<IFeatureServiceDefinition>, layer?: ILayerDefinition) => ISpatialReference;
|
|
154
|
+
export declare const getItemSpatialReference: (item: IItem) => ISpatialReference;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { IItem } from "@esri/arcgis-rest-portal";
|
|
2
|
+
import { IHubRequestOptions } from "../types";
|
|
3
|
+
import { IHubContentEnrichments, IHubContent } from "../core";
|
|
4
|
+
/**
|
|
5
|
+
* The possible values for updateFrequency
|
|
6
|
+
*
|
|
7
|
+
* @enum {string}
|
|
8
|
+
*/
|
|
9
|
+
export declare enum UpdateFrequency {
|
|
10
|
+
Continual = "continual",
|
|
11
|
+
Daily = "daily",
|
|
12
|
+
Weekly = "weekly",
|
|
13
|
+
Fortnightly = "fortnightly",
|
|
14
|
+
Monthly = "monthly",
|
|
15
|
+
Quarterly = "quarterly",
|
|
16
|
+
Biannually = "biannually",
|
|
17
|
+
Annually = "annually",
|
|
18
|
+
AsNeeded = "as-needed",
|
|
19
|
+
Irregular = "irregular",
|
|
20
|
+
NotPlanned = "not-planned",
|
|
21
|
+
Unknown = "unknown",
|
|
22
|
+
Semimonthly = "semimonthly"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* DEPRECATED: Compute the content type icon based on the content type
|
|
26
|
+
* @param content type
|
|
27
|
+
* @returns content type icon
|
|
28
|
+
*/
|
|
29
|
+
export declare const getContentTypeIcon: (contentType: string) => any;
|
|
30
|
+
/**
|
|
31
|
+
* get portal URLs (home, API, data, and thumbnail) for an item
|
|
32
|
+
*
|
|
33
|
+
* @param item Item
|
|
34
|
+
* @param requestOptions Request options
|
|
35
|
+
* @returns a hash with the portal URLs
|
|
36
|
+
* @export
|
|
37
|
+
*/
|
|
38
|
+
export declare const getPortalUrls: (item: IItem, requestOptions: IHubRequestOptions) => {
|
|
39
|
+
portalHome: string;
|
|
40
|
+
portalApi: string;
|
|
41
|
+
portalData: string;
|
|
42
|
+
thumbnail: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* If an item is a proxied csv, returns the url for the proxying feature layer.
|
|
46
|
+
* If the item is not a proxied csv, returns undefined.
|
|
47
|
+
*
|
|
48
|
+
* @param item
|
|
49
|
+
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
export declare const getProxyUrl: (item: IItem, requestOptions?: IHubRequestOptions) => string;
|
|
53
|
+
/**
|
|
54
|
+
* parse layer id from a service URL
|
|
55
|
+
* @param {string} url
|
|
56
|
+
* @returns {string} layer id
|
|
57
|
+
*/
|
|
58
|
+
export declare const getLayerIdFromUrl: (url: string) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Case-insensitive check if the type is "Feature Service"
|
|
61
|
+
* @param {string} type - item's type
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
export declare const isFeatureService: (type: string) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* ```js
|
|
67
|
+
* import { normalizeItemType } from "@esri/hub-common";
|
|
68
|
+
* //
|
|
69
|
+
* normalizeItemType(item)
|
|
70
|
+
* > [ 'Hub Site Application' ]
|
|
71
|
+
* ```
|
|
72
|
+
* @param item Item object.
|
|
73
|
+
* @returns type of the input item.
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
export declare function normalizeItemType(item?: any): string;
|
|
77
|
+
/**
|
|
78
|
+
* return the layerId if we can tell that item is a single layer service
|
|
79
|
+
* @param {*} item from AGO
|
|
80
|
+
* @returns {string} layer id
|
|
81
|
+
*/
|
|
82
|
+
export declare const getItemLayerId: (item: IItem) => string;
|
|
83
|
+
/**
|
|
84
|
+
* given an item, get the id to use w/ the Hub API
|
|
85
|
+
* @param item
|
|
86
|
+
* @returns Hub API id (hubId)
|
|
87
|
+
*/
|
|
88
|
+
export declare const getItemHubId: (item: IItem) => string;
|
|
89
|
+
/**
|
|
90
|
+
* Splits item category strings at slashes and discards the "Categories" keyword
|
|
91
|
+
*
|
|
92
|
+
* ```
|
|
93
|
+
* ["/Categories/Boundaries", "/Categories/Planning and cadastre/Property records", "/Categories/Structure"]
|
|
94
|
+
* ```
|
|
95
|
+
* Should end up being
|
|
96
|
+
* ```
|
|
97
|
+
* ["Boundaries", "Planning and cadastre", "Property records", "Structure"]
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @param categories - an array of strings
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
export declare function parseItemCategories(categories: string[]): string[];
|
|
104
|
+
export interface IComposeContentOptions extends IHubContentEnrichments {
|
|
105
|
+
layerId?: number;
|
|
106
|
+
slug?: string;
|
|
107
|
+
requestOptions?: IHubRequestOptions;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Compose a new content object out of an item, enrichments, and context
|
|
111
|
+
* @param item
|
|
112
|
+
* @param options any enrichments, current state (selected layerId), or context (requestOptions)
|
|
113
|
+
* @returns new content object
|
|
114
|
+
*/
|
|
115
|
+
export declare const composeContent: (item: IItem, options?: IComposeContentOptions) => IHubContent;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ResourceObject } from "jsonapi-typescript";
|
|
2
2
|
import { IItem } from "@esri/arcgis-rest-portal";
|
|
3
|
-
import { HubType,
|
|
4
|
-
import { IHubContent } from "
|
|
3
|
+
import { HubType, IModel } from "../types";
|
|
4
|
+
import { IHubContent } from "../core";
|
|
5
|
+
export * from "./compose";
|
|
6
|
+
export * from "./get-family";
|
|
5
7
|
/**
|
|
6
8
|
* JSONAPI dataset resource returned by the Hub API
|
|
7
9
|
*/
|
|
@@ -34,18 +36,6 @@ export declare function getCategory(itemType?: string): string;
|
|
|
34
36
|
*
|
|
35
37
|
*/
|
|
36
38
|
export declare function getTypes(category?: string): string[];
|
|
37
|
-
/**
|
|
38
|
-
* ```js
|
|
39
|
-
* import { normalizeItemType } from "@esri/hub-common";
|
|
40
|
-
* //
|
|
41
|
-
* normalizeItemType(item)
|
|
42
|
-
* > [ 'Hub Site Application' ]
|
|
43
|
-
* ```
|
|
44
|
-
* @param item Item object.
|
|
45
|
-
* @returns type of the input item.
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
export declare function normalizeItemType(item?: any): string;
|
|
49
39
|
/**
|
|
50
40
|
* ```js
|
|
51
41
|
* import { getTypeCategories } from "@esri/hub-common";
|
|
@@ -58,42 +48,6 @@ export declare function normalizeItemType(item?: any): string;
|
|
|
58
48
|
*
|
|
59
49
|
*/
|
|
60
50
|
export declare function getTypeCategories(item?: any): string[];
|
|
61
|
-
/**
|
|
62
|
-
* ```js
|
|
63
|
-
* import { getCollection } from "@esri/hub-common";
|
|
64
|
-
* //
|
|
65
|
-
* getCollection('Feature Layer')
|
|
66
|
-
* > 'dataset'
|
|
67
|
-
* ```
|
|
68
|
-
* Get the Hub collection for a given item type
|
|
69
|
-
* @param itemType The ArcGIS [item type](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm).
|
|
70
|
-
* @returns the Hub collection of a given item type.
|
|
71
|
-
*/
|
|
72
|
-
export declare function getCollection(itemType?: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* Case-insensitive check if the type is "Feature Service"
|
|
75
|
-
* @param {string} type - item's type
|
|
76
|
-
* @returns {boolean}
|
|
77
|
-
*/
|
|
78
|
-
export declare const isFeatureService: (type: string) => boolean;
|
|
79
|
-
/**
|
|
80
|
-
* parse layer id from a service URL
|
|
81
|
-
* @param {string} url
|
|
82
|
-
* @returns {string} layer id
|
|
83
|
-
*/
|
|
84
|
-
export declare const getLayerIdFromUrl: (url: string) => string;
|
|
85
|
-
/**
|
|
86
|
-
* return the layerId if we can tell that item is a single layer service
|
|
87
|
-
* @param {*} item from AGO
|
|
88
|
-
* @returns {string} layer id
|
|
89
|
-
*/
|
|
90
|
-
export declare const getItemLayerId: (item: IItem) => string;
|
|
91
|
-
/**
|
|
92
|
-
* given an item, get the id to use w/ the Hub API
|
|
93
|
-
* @param item
|
|
94
|
-
* @returns Hub API id (hubId)
|
|
95
|
-
*/
|
|
96
|
-
export declare const getItemHubId: (item: IItem) => string;
|
|
97
51
|
/**
|
|
98
52
|
* ```js
|
|
99
53
|
* import { getContentIdentifier } from "@esri/hub-common";
|
|
@@ -149,27 +103,6 @@ export declare function addContextToSlug(slug: string, context: string): string;
|
|
|
149
103
|
* @returns slug without context
|
|
150
104
|
*/
|
|
151
105
|
export declare function removeContextFromSlug(slug: string, context: string): string;
|
|
152
|
-
/**
|
|
153
|
-
* Splits item category strings at slashes and discards the "Categories" keyword
|
|
154
|
-
*
|
|
155
|
-
* ```
|
|
156
|
-
* ["/Categories/Boundaries", "/Categories/Planning and cadastre/Property records", "/Categories/Structure"]
|
|
157
|
-
* ```
|
|
158
|
-
* Should end up being
|
|
159
|
-
* ```
|
|
160
|
-
* ["Boundaries", "Planning and cadastre", "Property records", "Structure"]
|
|
161
|
-
* ```
|
|
162
|
-
*
|
|
163
|
-
* @param categories - an array of strings
|
|
164
|
-
* @private
|
|
165
|
-
*/
|
|
166
|
-
export declare function parseItemCategories(categories: string[]): string[];
|
|
167
|
-
/**
|
|
168
|
-
* return the Hub family given an item's type
|
|
169
|
-
* @param type item type
|
|
170
|
-
* @returns Hub family
|
|
171
|
-
*/
|
|
172
|
-
export declare function getFamily(type: string): HubFamily;
|
|
173
106
|
/**
|
|
174
107
|
* DEPRECATED: Use getFamily() instead.
|
|
175
108
|
*
|
|
@@ -210,12 +143,6 @@ export declare function datasetToItem(dataset: DatasetResource): IItem;
|
|
|
210
143
|
* @returns new content
|
|
211
144
|
*/
|
|
212
145
|
export declare const setContentType: (content: IHubContent, type: string) => IHubContent;
|
|
213
|
-
/**
|
|
214
|
-
* Compute the content type icon based on the content type
|
|
215
|
-
* @param content type
|
|
216
|
-
* @returns content type icon
|
|
217
|
-
*/
|
|
218
|
-
export declare const getContentTypeIcon: (contentType: string) => any;
|
|
219
146
|
/**
|
|
220
147
|
* Compute the content type label
|
|
221
148
|
* @param contentType
|
|
@@ -249,12 +176,3 @@ export declare const getContentSiteUrls: (content: IHubContent, siteModel: IMode
|
|
|
249
176
|
* @returns
|
|
250
177
|
*/
|
|
251
178
|
export declare const setContentSiteUrls: (content: IHubContent, siteModel: IModel) => IHubContent;
|
|
252
|
-
/**
|
|
253
|
-
* If an item is a proxied csv, returns the url for the proxying feature layer.
|
|
254
|
-
* If the item is not a proxied csv, returns undefined.
|
|
255
|
-
*
|
|
256
|
-
* @param item
|
|
257
|
-
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
258
|
-
* @returns
|
|
259
|
-
*/
|
|
260
|
-
export declare const getProxyUrl: (item: IItem, requestOptions: IHubRequestOptions) => string;
|
|
@@ -2,11 +2,11 @@ import { IItem, IGroup } from "@esri/arcgis-rest-portal";
|
|
|
2
2
|
import { ILayerDefinition } from "@esri/arcgis-rest-feature-layer";
|
|
3
3
|
import { Visibility, AccessControl, HubFamily, IActionLink, IStructuredLicense } from "../..";
|
|
4
4
|
import { IHubItemEntity } from ".";
|
|
5
|
-
import {
|
|
5
|
+
import { IHubContentEnrichments } from "./IHubContentEnrichments";
|
|
6
6
|
/**
|
|
7
7
|
* Data model for content
|
|
8
8
|
*/
|
|
9
|
-
export interface IHubContent extends IHubItemEntity,
|
|
9
|
+
export interface IHubContent extends IHubItemEntity, IHubContentEnrichments, IItem {
|
|
10
10
|
/**
|
|
11
11
|
* The underlying portal item referenced by this content
|
|
12
12
|
*/
|
|
@@ -71,6 +71,8 @@ export interface IHubContent extends IHubItemEntity, IContentEnrichments, IItem
|
|
|
71
71
|
hubActions?: object;
|
|
72
72
|
/** Information about the layer referenced by this content (geometryType, fields, etc) */
|
|
73
73
|
layer?: Partial<ILayerDefinition>;
|
|
74
|
+
/** Whether or not the layer or table is actually a proxied CSV */
|
|
75
|
+
isProxied?: boolean;
|
|
74
76
|
itemCategories?: string[];
|
|
75
77
|
normalizedType?: string;
|
|
76
78
|
orgId?: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IHubGeography } from "../../types";
|
|
2
|
+
import { IItemEnrichments } from "./IItemEnrichments";
|
|
3
|
+
import { IServerEnrichments } from "./IServerEnrichments";
|
|
4
|
+
export interface IHubContentEnrichments extends IItemEnrichments, IServerEnrichments {
|
|
5
|
+
/**
|
|
6
|
+
* boundary will default to the item extent
|
|
7
|
+
* but can be overwritten by enrichments from the Hub API (inline)
|
|
8
|
+
* or fetched from a location such as /resources/boundary.json
|
|
9
|
+
*/
|
|
10
|
+
boundary?: IHubGeography;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
statistics?: any;
|
|
15
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
|
|
2
2
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
3
|
+
import { Filter, IHubSearchOptions, ISearchResponse } from "../..";
|
|
3
4
|
/**
|
|
4
5
|
* Baseline CRUD+Search functions required for all Store classes
|
|
5
6
|
*/
|
|
@@ -30,4 +31,19 @@ export interface IHubEntityManager<T> {
|
|
|
30
31
|
* @param requestOptions
|
|
31
32
|
*/
|
|
32
33
|
fetch(identifier: string, requestOptions: IRequestOptions): Promise<T>;
|
|
34
|
+
/**
|
|
35
|
+
* [WIP] We need to work out how best to handle the typing on this. Simply
|
|
36
|
+
* delegating to `searchContent` with a filter constraining to an Entity type
|
|
37
|
+
* will return `ISearchResponse<IHubContent>` and not the expected type.
|
|
38
|
+
*
|
|
39
|
+
* Search for Entitys of type `T`
|
|
40
|
+
*
|
|
41
|
+
* Note: When implementing, this should be a search for things of type `T`
|
|
42
|
+
* not searching "within" the `T`.
|
|
43
|
+
*
|
|
44
|
+
* i.e. Searching for Teams, not searching for content shared to a team.
|
|
45
|
+
* @param filter
|
|
46
|
+
* @param opts
|
|
47
|
+
*/
|
|
48
|
+
search(filter: Filter<"content">, opts: IHubSearchOptions): Promise<ISearchResponse<T>>;
|
|
33
49
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
|
|
2
|
+
/**
|
|
3
|
+
* Item specific functions that must be implemented by Managers which operate against
|
|
4
|
+
* items stored in the Portal API
|
|
5
|
+
*/
|
|
6
|
+
export interface IHubItemEntityManager<T> {
|
|
7
|
+
/**
|
|
8
|
+
* Add a thumbnail to an item
|
|
9
|
+
* @param entity
|
|
10
|
+
* @param file
|
|
11
|
+
* @param name
|
|
12
|
+
* @param requestOptions
|
|
13
|
+
*/
|
|
14
|
+
updateThumbnail(entity: T, file: any, filename: string, requestOptions?: IUserRequestOptions): Promise<T>;
|
|
15
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IFeatureServiceDefinition, ILayerDefinition } from "@esri/arcgis-rest-feature-layer";
|
|
2
|
-
|
|
3
|
-
export interface IContentEnrichments extends IItemEnrichments {
|
|
2
|
+
export interface IServerEnrichments {
|
|
4
3
|
/** Information about the service referenced by this content (currentVersion, capabilities, maxRecordCount etc) */
|
|
5
4
|
server?: Partial<IFeatureServiceDefinition>;
|
|
6
5
|
/** Detailed information about the service's layers (geometryType, fields, etc) for related layers in the service */
|
|
@@ -8,3 +7,5 @@ export interface IContentEnrichments extends IItemEnrichments {
|
|
|
8
7
|
/** The count of records for the layer referenced by this content */
|
|
9
8
|
recordCount?: number;
|
|
10
9
|
}
|
|
10
|
+
export interface IContentEnrichments extends IServerEnrichments {
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./IContentEnrichments";
|
|
2
1
|
export * from "./IItemEnrichments";
|
|
2
|
+
export * from "./IHubContentEnrichments";
|
|
3
3
|
export * from "./IHubContent";
|
|
4
4
|
export * from "./IHubEntityBase";
|
|
5
5
|
export * from "./IHubItemEntity";
|
|
@@ -12,3 +12,4 @@ export * from "./IHubPage";
|
|
|
12
12
|
export * from "./IHubProject";
|
|
13
13
|
export * from "./IHubSite";
|
|
14
14
|
export * from "./IHubTimeline";
|
|
15
|
+
export * from "./IServerEnrichments";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
|
|
2
|
+
/**
|
|
3
|
+
* Upload a file to be used as the thumbnail for an item
|
|
4
|
+
* @param id
|
|
5
|
+
* @param file
|
|
6
|
+
* @param filename
|
|
7
|
+
* @param requestOptions
|
|
8
|
+
*/
|
|
9
|
+
export declare function setItemThumbnail(id: string, file: any, filename: string, requestOptions: IUserRequestOptions): Promise<void>;
|
|
@@ -28,6 +28,22 @@ export declare function setSlugKeyword(typeKeywords: string[], slug: string): st
|
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
30
|
export declare function getItemBySlug(slug: string, requestOptions: IRequestOptions): Promise<IItem>;
|
|
31
|
+
/**
|
|
32
|
+
* Find items by slug typeKeywords.
|
|
33
|
+
*
|
|
34
|
+
* Optional exclude parameter accepts the id of an item we expect to
|
|
35
|
+
* have this particular slug. This is used during update calls
|
|
36
|
+
* where we don't know if the slug specifically has been updated, but we
|
|
37
|
+
* don't want a false-postive from the item we are updating
|
|
38
|
+
*
|
|
39
|
+
* @param slug
|
|
40
|
+
* @param requestOptions
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export declare function findItemsBySlug(slugInfo: {
|
|
44
|
+
slug: string;
|
|
45
|
+
exclude?: string;
|
|
46
|
+
}, requestOptions: IRequestOptions): Promise<IItem[]>;
|
|
31
47
|
/**
|
|
32
48
|
* Given a slug, search for items using that slug, incrementing the slug name until
|
|
33
49
|
* a unique value is found
|
|
@@ -40,4 +56,7 @@ export declare function getItemBySlug(slug: string, requestOptions: IRequestOpti
|
|
|
40
56
|
* @param step
|
|
41
57
|
* @returns
|
|
42
58
|
*/
|
|
43
|
-
export declare function getUniqueSlug(
|
|
59
|
+
export declare function getUniqueSlug(slugInfo: {
|
|
60
|
+
slug: string;
|
|
61
|
+
existingId?: string;
|
|
62
|
+
}, requestOptions: IRequestOptions, step?: number): Promise<string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./serializeModel";
|
|
2
2
|
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
|
|
3
|
+
import { IItem } from "@esri/arcgis-rest-portal";
|
|
3
4
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
4
5
|
import { IModel } from "..";
|
|
5
6
|
/**
|
|
@@ -40,3 +41,10 @@ export declare function createModel(model: IModel, requestOptions: IUserRequestO
|
|
|
40
41
|
* @returns {Promise<IModel>}
|
|
41
42
|
*/
|
|
42
43
|
export declare function updateModel(model: IModel, requestOptions: IUserRequestOptions): Promise<IModel>;
|
|
44
|
+
/**
|
|
45
|
+
* Given an Item, fetch the data json and return an IModel
|
|
46
|
+
* @param item
|
|
47
|
+
* @param requestOptions
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export declare function fetchModelFromItem(item: IItem, requestOptions: IRequestOptions): Promise<IModel>;
|