@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.
Files changed (125) hide show
  1. package/dist/es2017/Hub.js +6 -10
  2. package/dist/es2017/Hub.js.map +1 -1
  3. package/dist/es2017/HubError.js +2 -1
  4. package/dist/es2017/HubError.js.map +1 -1
  5. package/dist/es2017/content/_internal.js +151 -30
  6. package/dist/es2017/content/_internal.js.map +1 -1
  7. package/dist/es2017/content/compose.js +607 -0
  8. package/dist/es2017/content/compose.js.map +1 -0
  9. package/dist/es2017/content/get-family.js +42 -0
  10. package/dist/es2017/content/get-family.js.map +1 -0
  11. package/dist/es2017/content/index.js +42 -468
  12. package/dist/es2017/content/index.js.map +1 -1
  13. package/dist/es2017/core/types/IHubContentEnrichments.js +1 -0
  14. package/dist/es2017/core/types/IHubContentEnrichments.js.map +1 -0
  15. package/dist/es2017/core/types/IHubItemEntityManager.js +1 -0
  16. package/dist/es2017/core/types/IHubItemEntityManager.js.map +1 -0
  17. package/dist/es2017/core/types/IServerEnrichments.js +1 -0
  18. package/dist/es2017/core/types/IServerEnrichments.js.map +1 -0
  19. package/dist/es2017/core/types/index.js +2 -1
  20. package/dist/es2017/core/types/index.js.map +1 -1
  21. package/dist/es2017/items/index.js +1 -0
  22. package/dist/es2017/items/index.js.map +1 -1
  23. package/dist/es2017/items/setItemThumbnail.js +31 -0
  24. package/dist/es2017/items/setItemThumbnail.js.map +1 -0
  25. package/dist/es2017/items/slugs.js +39 -15
  26. package/dist/es2017/items/slugs.js.map +1 -1
  27. package/dist/es2017/models/index.js +13 -0
  28. package/dist/es2017/models/index.js.map +1 -1
  29. package/dist/es2017/projects/HubProjectManager.js +40 -4
  30. package/dist/es2017/projects/HubProjectManager.js.map +1 -1
  31. package/dist/es2017/projects/HubProjects.js +91 -18
  32. package/dist/es2017/projects/HubProjects.js.map +1 -1
  33. package/dist/esm/Hub.js +6 -10
  34. package/dist/esm/Hub.js.map +1 -1
  35. package/dist/esm/HubError.js +2 -1
  36. package/dist/esm/HubError.js.map +1 -1
  37. package/dist/esm/content/_internal.js +153 -30
  38. package/dist/esm/content/_internal.js.map +1 -1
  39. package/dist/esm/content/compose.js +600 -0
  40. package/dist/esm/content/compose.js.map +1 -0
  41. package/dist/esm/content/get-family.js +42 -0
  42. package/dist/esm/content/get-family.js.map +1 -0
  43. package/dist/esm/content/index.js +44 -476
  44. package/dist/esm/content/index.js.map +1 -1
  45. package/dist/esm/core/types/IHubContentEnrichments.js +1 -0
  46. package/dist/esm/core/types/IHubContentEnrichments.js.map +1 -0
  47. package/dist/esm/core/types/IHubItemEntityManager.js +1 -0
  48. package/dist/esm/core/types/IHubItemEntityManager.js.map +1 -0
  49. package/dist/esm/core/types/IServerEnrichments.js +1 -0
  50. package/dist/esm/core/types/IServerEnrichments.js.map +1 -0
  51. package/dist/esm/core/types/index.js +2 -1
  52. package/dist/esm/core/types/index.js.map +1 -1
  53. package/dist/esm/items/index.js +1 -0
  54. package/dist/esm/items/index.js.map +1 -1
  55. package/dist/esm/items/setItemThumbnail.js +46 -0
  56. package/dist/esm/items/setItemThumbnail.js.map +1 -0
  57. package/dist/esm/items/slugs.js +39 -15
  58. package/dist/esm/items/slugs.js.map +1 -1
  59. package/dist/esm/models/index.js +23 -1
  60. package/dist/esm/models/index.js.map +1 -1
  61. package/dist/esm/projects/HubProjectManager.js +58 -4
  62. package/dist/esm/projects/HubProjectManager.js.map +1 -1
  63. package/dist/esm/projects/HubProjects.js +100 -21
  64. package/dist/esm/projects/HubProjects.js.map +1 -1
  65. package/dist/node/Hub.js +6 -10
  66. package/dist/node/Hub.js.map +1 -1
  67. package/dist/node/HubError.js +5 -4
  68. package/dist/node/HubError.js.map +1 -1
  69. package/dist/node/content/_internal.js +155 -31
  70. package/dist/node/content/_internal.js.map +1 -1
  71. package/dist/node/content/compose.js +612 -0
  72. package/dist/node/content/compose.js.map +1 -0
  73. package/dist/node/content/get-family.js +46 -0
  74. package/dist/node/content/get-family.js.map +1 -0
  75. package/dist/node/content/index.js +48 -477
  76. package/dist/node/content/index.js.map +1 -1
  77. package/dist/node/core/types/IHubContentEnrichments.js +3 -0
  78. package/dist/node/core/types/IHubContentEnrichments.js.map +1 -0
  79. package/dist/node/core/types/IHubItemEntityManager.js +3 -0
  80. package/dist/node/core/types/IHubItemEntityManager.js.map +1 -0
  81. package/dist/node/core/types/{IContentEnrichments.js → IServerEnrichments.js} +1 -1
  82. package/dist/node/core/types/IServerEnrichments.js.map +1 -0
  83. package/dist/node/core/types/index.js +2 -1
  84. package/dist/node/core/types/index.js.map +1 -1
  85. package/dist/node/items/index.js +1 -0
  86. package/dist/node/items/index.js.map +1 -1
  87. package/dist/node/items/setItemThumbnail.js +35 -0
  88. package/dist/node/items/setItemThumbnail.js.map +1 -0
  89. package/dist/node/items/slugs.js +42 -17
  90. package/dist/node/items/slugs.js.map +1 -1
  91. package/dist/node/models/index.js +15 -1
  92. package/dist/node/models/index.js.map +1 -1
  93. package/dist/node/projects/HubProjectManager.js +38 -2
  94. package/dist/node/projects/HubProjectManager.js.map +1 -1
  95. package/dist/node/projects/HubProjects.js +91 -17
  96. package/dist/node/projects/HubProjects.js.map +1 -1
  97. package/dist/types/Hub.d.ts +7 -11
  98. package/dist/types/HubError.d.ts +1 -1
  99. package/dist/types/content/_internal.d.ts +57 -22
  100. package/dist/types/content/compose.d.ts +115 -0
  101. package/dist/types/content/get-family.d.ts +7 -0
  102. package/dist/types/content/index.d.ts +4 -86
  103. package/dist/types/core/types/IHubContent.d.ts +4 -2
  104. package/dist/types/core/types/IHubContentEnrichments.d.ts +15 -0
  105. package/dist/types/core/types/IHubEntityManager.d.ts +16 -0
  106. package/dist/types/core/types/IHubItemEntity.d.ts +1 -1
  107. package/dist/types/core/types/IHubItemEntityManager.d.ts +15 -0
  108. package/dist/types/core/types/{IContentEnrichments.d.ts → IServerEnrichments.d.ts} +3 -2
  109. package/dist/types/core/types/index.d.ts +2 -1
  110. package/dist/types/items/index.d.ts +1 -0
  111. package/dist/types/items/setItemThumbnail.d.ts +9 -0
  112. package/dist/types/items/slugs.d.ts +20 -1
  113. package/dist/types/models/index.d.ts +8 -0
  114. package/dist/types/projects/HubProjectManager.d.ts +21 -3
  115. package/dist/types/projects/HubProjects.d.ts +3 -1
  116. package/dist/umd/common.umd.js +1238 -663
  117. package/dist/umd/common.umd.js.map +1 -1
  118. package/dist/umd/common.umd.min.js +1 -1
  119. package/dist/umd/common.umd.min.js.map +1 -1
  120. package/package.json +1 -1
  121. package/dist/es2017/core/types/IContentEnrichments.js +0 -1
  122. package/dist/es2017/core/types/IContentEnrichments.js.map +0 -1
  123. package/dist/esm/core/types/IContentEnrichments.js +0 -1
  124. package/dist/esm/core/types/IContentEnrichments.js.map +0 -1
  125. package/dist/node/core/types/IContentEnrichments.js.map +0 -1
@@ -24,14 +24,12 @@ export interface IHubOptions {
24
24
  *
25
25
  * myHub.context.currentUser //=> {username: "casey", ...} as IUser
26
26
  *
27
- * const projectStore = await myHub.getProjectStore();
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 projectStore.update(pavingProject);
29
+ * await myHub.projects.update(pavingProject);
32
30
  * ```
33
31
  *
34
- * This is a convenience class. Hub Stores can be created
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 should we need
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 HubProjectStore instance.
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
- * Create a Project Store connected to the current Hub
64
+ * HubProjectManager for the current Hub
69
65
  * @returns
70
66
  */
71
67
  get projects(): HubProjectManager;
@@ -1,4 +1,4 @@
1
- import { OperationError } from ".";
1
+ import OperationError from "./OperationError";
2
2
  /**
3
3
  * Generic Hub Error with an Error stack as well
4
4
  * as an optional serialized OperationStack.
@@ -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 { IItem } from "@esri/arcgis-rest-types/dist/types/item";
12
- import { BBox, IHubContent, IHubGeography, GeographyProvenance, IHubRequestOptions } from "..";
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?: import("@esri/arcgis-rest-types").ISpatialReference;
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("..").AccessControl;
49
- groups?: import("@esri/arcgis-rest-types").IGroup[];
51
+ control?: import("../types").AccessControl;
52
+ groups?: import("@esri/arcgis-rest-portal").IGroup[];
50
53
  };
51
- family?: import("..").HubFamily;
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("..").IActionLink[];
64
+ actionLinks?: import("../types").IActionLink[];
62
65
  hubActions?: object;
63
- layer?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>;
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
- server?: Partial<import("@esri/arcgis-rest-types").IFeatureServiceDefinition>;
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-types").IUser;
92
+ ownerUser?: import("@esri/arcgis-rest-portal").IUser;
91
93
  org?: Partial<import("@esri/arcgis-rest-portal").IPortal>;
92
- errors?: import("..").IEnrichmentErrorInfo[];
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?: import("@esri/arcgis-rest-types").ISpatialReference;
107
+ spatialReference?: ISpatialReference;
103
108
  properties?: any;
104
109
  };
105
- /**
106
- * Create a new content with updated extent and derived properties like boundary
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: IHubRequestOptions) => boolean;
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;
@@ -0,0 +1,7 @@
1
+ import { HubFamily } from "../types";
2
+ /**
3
+ * return the Hub family given an item's type
4
+ * @param type item type
5
+ * @returns Hub family
6
+ */
7
+ export declare function getFamily(type: string): HubFamily;
@@ -1,7 +1,9 @@
1
1
  import { ResourceObject } from "jsonapi-typescript";
2
2
  import { IItem } from "@esri/arcgis-rest-portal";
3
- import { HubType, HubFamily, IModel, IHubRequestOptions } from "../types";
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 { IContentEnrichments } from "./IContentEnrichments";
5
+ import { IHubContentEnrichments } from "./IHubContentEnrichments";
6
6
  /**
7
7
  * Data model for content
8
8
  */
9
- export interface IHubContent extends IHubItemEntity, IContentEnrichments, IItem {
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
  }
@@ -1,5 +1,5 @@
1
1
  import { IHubEntityBase } from "./IHubEntityBase";
2
- import { IHubGeography } from "../..";
2
+ import { IHubGeography } from "../../types";
3
3
  /**
4
4
  * Properties exposed by Entities that are backed by Items
5
5
  */
@@ -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
- import { IItemEnrichments } from "./IItemEnrichments";
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";
@@ -15,3 +15,4 @@ export * from "./fetch-all-pages";
15
15
  export * from "./get-structured-license";
16
16
  export * from "./slugs";
17
17
  export * from "./normalize-solution-template-item";
18
+ export * from "./setItemThumbnail";
@@ -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(slug: string, requestOptions: IRequestOptions, step?: number): Promise<string>;
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>;