@esri/hub-common 23.3.0 → 23.4.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 (67) hide show
  1. package/dist/esm/content/_internal/ContentBusinessRules.js +5 -0
  2. package/dist/esm/content/_internal/ContentBusinessRules.js.map +1 -1
  3. package/dist/esm/content/_internal/ContentPermissions.js +1 -0
  4. package/dist/esm/content/_internal/ContentPermissions.js.map +1 -1
  5. package/dist/esm/content/compose.js +18 -3
  6. package/dist/esm/content/compose.js.map +1 -1
  7. package/dist/esm/content/convertItemToContent.js +33 -0
  8. package/dist/esm/content/convertItemToContent.js.map +1 -0
  9. package/dist/esm/content/convertItemToContentPortal.js +24 -0
  10. package/dist/esm/content/convertItemToContentPortal.js.map +1 -0
  11. package/dist/esm/content/fetchContent.js +22 -134
  12. package/dist/esm/content/fetchContent.js.map +1 -1
  13. package/dist/esm/content/fetchContentHubIndex/convertItemToContentHubIndex.js +20 -0
  14. package/dist/esm/content/fetchContentHubIndex/convertItemToContentHubIndex.js.map +1 -0
  15. package/dist/esm/content/fetchContentHubIndex/fetchContentHubIndex.js +146 -0
  16. package/dist/esm/content/fetchContentHubIndex/fetchContentHubIndex.js.map +1 -0
  17. package/dist/esm/content/fetchContentPortal.js +56 -0
  18. package/dist/esm/content/fetchContentPortal.js.map +1 -0
  19. package/dist/esm/content/fetchHubContent.js +3 -20
  20. package/dist/esm/content/fetchHubContent.js.map +1 -1
  21. package/dist/esm/content/types.js.map +1 -1
  22. package/dist/esm/index.js +2 -1
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/permissions/HubPermissionPolicies.js +6 -0
  25. package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
  26. package/dist/esm/permissions/_internal/constants.js +1 -0
  27. package/dist/esm/permissions/_internal/constants.js.map +1 -1
  28. package/dist/node/content/_internal/ContentBusinessRules.js +5 -0
  29. package/dist/node/content/_internal/ContentBusinessRules.js.map +1 -1
  30. package/dist/node/content/_internal/ContentPermissions.js +1 -0
  31. package/dist/node/content/_internal/ContentPermissions.js.map +1 -1
  32. package/dist/node/content/compose.js +18 -3
  33. package/dist/node/content/compose.js.map +1 -1
  34. package/dist/node/content/convertItemToContent.js +37 -0
  35. package/dist/node/content/convertItemToContent.js.map +1 -0
  36. package/dist/node/content/convertItemToContentPortal.js +28 -0
  37. package/dist/node/content/convertItemToContentPortal.js.map +1 -0
  38. package/dist/node/content/fetchContent.js +22 -134
  39. package/dist/node/content/fetchContent.js.map +1 -1
  40. package/dist/node/content/fetchContentHubIndex/convertItemToContentHubIndex.js +24 -0
  41. package/dist/node/content/fetchContentHubIndex/convertItemToContentHubIndex.js.map +1 -0
  42. package/dist/node/content/fetchContentHubIndex/fetchContentHubIndex.js +150 -0
  43. package/dist/node/content/fetchContentHubIndex/fetchContentHubIndex.js.map +1 -0
  44. package/dist/node/content/fetchContentPortal.js +60 -0
  45. package/dist/node/content/fetchContentPortal.js.map +1 -0
  46. package/dist/node/content/fetchHubContent.js +5 -23
  47. package/dist/node/content/fetchHubContent.js.map +1 -1
  48. package/dist/node/content/types.js.map +1 -1
  49. package/dist/node/index.js +3 -2
  50. package/dist/node/index.js.map +1 -1
  51. package/dist/node/permissions/HubPermissionPolicies.js +6 -0
  52. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
  53. package/dist/node/permissions/_internal/constants.js +1 -0
  54. package/dist/node/permissions/_internal/constants.js.map +1 -1
  55. package/dist/types/content/_internal/ContentPermissions.d.ts +1 -1
  56. package/dist/types/content/compose.d.ts +2 -1
  57. package/dist/types/content/convertItemToContent.d.ts +15 -0
  58. package/dist/types/content/convertItemToContentPortal.d.ts +9 -0
  59. package/dist/types/content/fetchContent.d.ts +7 -19
  60. package/dist/types/content/fetchContentHubIndex/convertItemToContentHubIndex.d.ts +9 -0
  61. package/dist/types/content/fetchContentHubIndex/fetchContentHubIndex.d.ts +16 -0
  62. package/dist/types/content/fetchContentPortal.d.ts +12 -0
  63. package/dist/types/content/fetchHubContent.d.ts +2 -7
  64. package/dist/types/content/types.d.ts +11 -0
  65. package/dist/types/index.d.ts +4 -2
  66. package/dist/types/permissions/_internal/constants.d.ts +2 -2
  67. package/package.json +1 -1
@@ -1,144 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchContent = void 0;
4
- const tslib_1 = require("tslib");
5
- const arcgis_rest_feature_service_1 = require("@esri/arcgis-rest-feature-service");
6
- const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
7
- const _enrichments_1 = require("../items/_enrichments");
8
- const util_1 = require("../util");
9
- const _array_1 = require("../utils/_array");
10
- const slugs_1 = require("./slugs");
11
- const _fetch_1 = require("./_fetch");
12
- const internalContentUtils_1 = require("./_internal/internalContentUtils");
13
- const compose_1 = require("./compose");
14
- const hasFeatures = (contentType) => ["Feature Layer", "Table"].includes(contentType);
15
- const maybeFetchLayerEnrichments = async (itemAndEnrichments, options) => {
16
- const { item } = itemAndEnrichments;
17
- let { layers } = itemAndEnrichments;
18
- let layer = layers && (0, compose_1.getItemLayer)(item, layers, options && options.layerId);
19
- // TODO: Remove once we stop supporting ArcGIS Servers below version 10.5.
20
- // The /layers endpoint of some earlier servers return layers and tables
21
- // without certain critical properties, such as type. If this is the case,
22
- // fetch the fully hydrated target layer and stab it onto the layers array.
23
- // See https://devtopia.esri.com/dc/hub/issues/3488 for more details
24
- if (layer && !layer.type) {
25
- const layerUrl = `${(0, arcgis_rest_feature_service_1.parseServiceUrl)(item.url)}/${layer.id}`;
26
- const getLayerOptions = Object.assign({ url: layerUrl }, options); // works whether options is defined or not
27
- layer = await (0, arcgis_rest_feature_service_1.getLayer)(getLayerOptions);
28
- layers = layers.map((unhydratedLayer) => {
29
- return unhydratedLayer.id === layer.id ? layer : unhydratedLayer;
30
- });
31
- }
32
- return Object.assign(Object.assign({}, itemAndEnrichments), { layers });
33
- };
34
- const fetchItemAndEnrichments = async (itemId, options) => {
35
- // fetch the item
36
- const item = await (0, arcgis_rest_portal_1.getItem)(itemId, options);
37
- // The Hub Application expects the item url of proxied CSVs to point to the
38
- // proxying feature service. Stabbing it on here maintains that consistency
39
- // and also helps us fetch and calculate the correct reference layer
40
- item.url = (0, compose_1.getProxyUrl)(item, options) || item.url;
41
- // fetch the enrichments
42
- const enrichmentsToFetch = (options === null || options === void 0 ? void 0 : options.enrichments) || (0, _fetch_1.getContentEnrichments)(item);
43
- const enrichments = await (0, _enrichments_1.fetchItemEnrichments)(item, enrichmentsToFetch, options);
44
- return maybeFetchLayerEnrichments(Object.assign(Object.assign({}, enrichments), { item }), options);
45
- };
46
- const fetchContentById = async (hubId, options) => {
47
- // start by fetching the item and item enrichments
48
- const { itemId } = (0, slugs_1.parseDatasetId)(hubId);
49
- const _a = await fetchItemAndEnrichments(itemId, options), { item } = _a, itemEnrichments = tslib_1.__rest(_a, ["item"]);
50
- // did the caller request a specific layer
51
- const specifiedLayerId = options && options.layerId;
52
- // if this is a public item and we're not in enterprise
53
- // fetch the slug and remaining enrichments from the Hub API
54
- // const { slug, layerId, boundary, extent, searchDescription, statistics } =
55
- const hubEnrichments = (0, internalContentUtils_1.canUseHubApiForItem)(item, options)
56
- ? await (0, _fetch_1.fetchHubEnrichmentsById)(hubId, options)
57
- : {};
58
- const layerId = hubEnrichments.layerId;
59
- // return a new content object composed from the item and enrichments we fetched
60
- return (0, compose_1.composeContent)(item, Object.assign(Object.assign(Object.assign({ requestOptions: options }, itemEnrichments), hubEnrichments), {
61
- // prefer specified layer id if any
62
- layerId: (0, util_1.isNil)(specifiedLayerId) ? layerId : specifiedLayerId,
63
- // merge error arrays
64
- errors: (0, _array_1.maybeConcat)([itemEnrichments.errors, hubEnrichments.errors]) }));
65
- };
66
- const fetchContentBySlug = async (fullyQualifiedSlug, options) => {
67
- // we only have a slug, not an item id, so we start by
68
- // fetching the item id (and enrichments) from the Hub API
69
- // NOTE: if we are in enterprise this will throw an error
70
- let hubEnrichments = await (0, _fetch_1.fetchHubEnrichmentsBySlug)(fullyQualifiedSlug, options);
71
- const { itemId } = hubEnrichments;
72
- let { layerId } = hubEnrichments;
73
- // now we can fetch the item and item enrichments
74
- const _a = await fetchItemAndEnrichments(itemId, options), { item } = _a, itemEnrichments = tslib_1.__rest(_a, ["item"]);
75
- // did the caller request a specific layer
76
- const specifiedLayerId = options && options.layerId;
77
- if (!(0, util_1.isNil)(specifiedLayerId) && specifiedLayerId !== layerId) {
78
- // we fetched Hub enrichments by slug for another record,
79
- // most likely the record for the parent service of this layer,
80
- // so we need to fetch them for the specified layer instead
81
- layerId = specifiedLayerId;
82
- hubEnrichments = Object.assign(Object.assign({}, hubEnrichments), (await (0, _fetch_1.fetchHubEnrichmentsById)(`${itemId}_${layerId}`, options)));
83
- }
84
- return (0, compose_1.composeContent)(item, Object.assign(Object.assign(Object.assign({ requestOptions: options }, itemEnrichments), hubEnrichments), { layerId,
85
- // Note that we are not extracting the slug for the specified layer.
86
- // It seems that the old client composer code always populated the slug
87
- // field with the slug that was passed into the function (typically the
88
- // slug of the parent service). To maintain parity, we do the same here.
89
- //
90
- // TODO: should we prefer the slug of the fetched layer instead?
91
- // return a new content object composed from the item and enrichments we fetched
92
- slug: fullyQualifiedSlug,
93
- // merge error arrays
94
- errors: (0, _array_1.maybeConcat)([itemEnrichments.errors, hubEnrichments.errors]) }));
95
- };
96
- const fetchContentRecordCount = async (content, requestOptions) => {
97
- const { url, viewDefinition } = content;
98
- const where = viewDefinition === null || viewDefinition === void 0 ? void 0 : viewDefinition.definitionExpression;
99
- try {
100
- const response = await (0, arcgis_rest_feature_service_1.queryFeatures)(Object.assign(Object.assign({}, requestOptions), { url,
101
- where, returnCountOnly: true }));
102
- return response.count;
103
- }
104
- catch (_a) {
105
- // swallow the error and return Infinity as a flag that the caller can act on
106
- // NOTE: this is what the -ui app currently expects, see:
107
- // https://github.com/ArcGIS/opendata-ui/blob/300601918eb2dee79a89314880541ecd60f21e68/packages/opendata-ui/app/utils/composer.js#L273-L279
108
- // however, we should probably push the error message into content.errors instead
109
- return Infinity;
110
- }
111
- };
4
+ const checkPermission_1 = require("../permissions/checkPermission");
5
+ const fetchContentHubIndex_1 = require("./fetchContentHubIndex/fetchContentHubIndex");
6
+ const fetchContentPortal_1 = require("./fetchContentPortal");
112
7
  /**
113
- * Fetch enriched content from the Portal and Hub APIs.
114
- * @param identifier content slug or id
115
- * @param options Request options with additional options to control how the content or enrichments are fetched
116
- * @returns A content object composed of the backing item and enrichments
8
+ * Fetch Content by identifier, using either the Hub Indexer or Portal APIs
117
9
  *
118
- * ```js
119
- * import { fetchContent } from '@esri/hub-common'
120
- * // fetch content by slug
121
- * const content = await fetchContent('my-org::item-name')
122
- * ```
10
+ * Temporary facade while we transition to using the Portal API for content fetching.
11
+ * Depending on the gating permission, use either the Hub Indexer or Portal code path.
12
+ * @param identifier
13
+ * @param options
14
+ * @returns
123
15
  */
124
16
  const fetchContent = async (identifier, options) => {
125
- const content = (0, slugs_1.isSlug)(identifier)
126
- ? await fetchContentBySlug((0, slugs_1.addContextToSlug)(identifier, options === null || options === void 0 ? void 0 : options.siteOrgKey), options)
127
- : await fetchContentById(identifier, options);
128
- // fetch record count for content that has features (e.g. layers, tables, or proxied CSVs)
129
- const { layer, type } = content;
130
- // it's too expensive to always fetch the live record count up front
131
- // in order to avoid a breaking change, we're including the cached recordCount
132
- // in the list of enrichments we fetch from the Hub API and using that
133
- // and only fetching the live record count in cases where we don't have that
134
- // TODO: fetchContent() should NOT fetch record count in the next breaking change
135
- const canQuery = !!layer && hasFeatures(type);
136
- content.recordCount =
137
- canQuery && ((0, util_1.isNil)(content.recordCount) || content.viewDefinition)
138
- ? // no cached count, or this is client-side layer view, fetch the count
139
- await fetchContentRecordCount(content, options)
140
- : content.recordCount;
141
- return content;
17
+ let codePath = "hubIndexer";
18
+ if (options === null || options === void 0 ? void 0 : options.context) {
19
+ const chk = (0, checkPermission_1.checkPermission)("hub:content:fetch:portal", options.context);
20
+ if (chk.access) {
21
+ codePath = "portal";
22
+ }
23
+ }
24
+ if (codePath === "portal") {
25
+ return (0, fetchContentPortal_1.fetchContentPortal)(identifier, options);
26
+ }
27
+ else {
28
+ return (0, fetchContentHubIndex_1.fetchContentHubIndex)(identifier, options);
29
+ }
142
30
  };
143
31
  exports.fetchContent = fetchContent;
144
32
  //# sourceMappingURL=fetchContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchContent.js","sourceRoot":"","sources":["../../../src/content/fetchContent.ts"],"names":[],"mappings":";;;;AAAA,mFAI2C;AAC3C,iEAAmD;AACnD,wDAI+B;AAC/B,kCAAgC;AAChC,4CAA8C;AAC9C,mCAAmE;AACnE,qCAIkB;AAClB,2EAAuE;AACvE,uCAAsE;AAKtE,MAAM,WAAW,GAAG,CAAC,WAAmB,EAAE,EAAE,CAC1C,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEnD,MAAM,0BAA0B,GAAG,KAAK,EACtC,kBAAuC,EACvC,OAA8B,EAC9B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC;IACpC,IAAI,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAAC;IAEpC,IAAI,KAAK,GAAG,MAAM,IAAI,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7E,0EAA0E;IAC1E,wEAAwE;IACxE,0EAA0E;IAC1E,2EAA2E;IAC3E,oEAAoE;IACpE,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,GAAG,IAAA,6CAAe,EAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;QAC5D,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,0CAA0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AAO,CAAC,CAAC;QACzE,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,QAAQ,GAAG,QAAQ,CAAC;QACtB,CAAC;IACH,CAAC;IACD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,IAAA,uCAAkB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,OAAO,IAAA,2CAAoB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,YAAY,gBAgBvB"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertItemToContentHubIndex = void 0;
4
+ const getDefaultEntitySettings_1 = require("../../discussions/api/settings/getDefaultEntitySettings");
5
+ const settings_1 = require("../../discussions/api/settings/settings");
6
+ const fetchModelFromItem_1 = require("../../models/fetchModelFromItem");
7
+ const modelToHubEditableContent_1 = require("../modelToHubEditableContent");
8
+ /**
9
+ * Convert an Item to an editable Hub Content object,
10
+ * fetch any additional information that may be required
11
+ */
12
+ const convertItemToContentHubIndex = async (item, requestOptions, enrichments) => {
13
+ const [model, entitySettings] = await Promise.all([
14
+ (0, fetchModelFromItem_1.fetchModelFromItem)(item, requestOptions),
15
+ !requestOptions.isPortal
16
+ ? (0, settings_1.fetchSettingV2)(Object.assign({ id: item.id }, requestOptions)).catch(() => (Object.assign({ id: null }, (0, getDefaultEntitySettings_1.getDefaultEntitySettings)("content"))))
17
+ : null, // non-hub-indexer path
18
+ ]);
19
+ model.entitySettings = entitySettings;
20
+ const content = (0, modelToHubEditableContent_1.modelToHubEditableContent)(model, requestOptions, enrichments);
21
+ return content;
22
+ };
23
+ exports.convertItemToContentHubIndex = convertItemToContentHubIndex;
24
+ //# sourceMappingURL=convertItemToContentHubIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertItemToContentHubIndex.js","sourceRoot":"","sources":["../../../../src/content/fetchContentHubIndex/convertItemToContentHubIndex.ts"],"names":[],"mappings":";;;AAEA,sGAAmG;AACnG,sEAAyE;AAIzE,wEAAqE;AACrE,4EAAyE;AAEzE;;;GAGG;AACI,MAAM,4BAA4B,GAAG,KAAK,EAC/C,IAAW,EACX,cAAkC,EAClC,WAA4C,EACd,EAAE;IAChC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChD,IAAA,uCAAkB,EAAC,IAAI,EAAE,cAAc,CAAC;QACxC,CAAC,cAAc,CAAC,QAAQ;YACtB,CAAC,CAAC,IAAA,yBAAc,kBACZ,EAAE,EAAE,IAAI,CAAC,EAAE,IACR,cAAc,EACjB,CAAC,KAAK,CACN,GAAG,EAAE,CACH,CAAC,gBACC,EAAE,EAAE,IAAI,IACL,IAAA,mDAAwB,EAAC,SAAS,CAAC,CACpB,CAAA,CACvB;YACH,CAAC,CAAC,IAAI,EAAE,uBAAuB;KAClC,CAAC,CAAC;IACH,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;IACtC,MAAM,OAAO,GAAiC,IAAA,qDAAyB,EACrE,KAAK,EACL,cAAc,EACd,WAAW,CACZ,CAAC;IAEF,OAAO,OAA8B,CAAC;AACxC,CAAC,CAAC;AA5BW,QAAA,4BAA4B,gCA4BvC"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchContentHubIndex = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const arcgis_rest_feature_service_1 = require("@esri/arcgis-rest-feature-service");
6
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
7
+ const _enrichments_1 = require("../../items/_enrichments");
8
+ const util_1 = require("../../util");
9
+ const _array_1 = require("../../utils/_array");
10
+ const slugs_1 = require("../slugs");
11
+ const _fetch_1 = require("../_fetch");
12
+ const internalContentUtils_1 = require("../_internal/internalContentUtils");
13
+ const compose_1 = require("../compose");
14
+ const hasFeatures = (contentType) => ["Feature Layer", "Table"].includes(contentType);
15
+ const maybeFetchLayerEnrichments = async (itemAndEnrichments, options) => {
16
+ const { item } = itemAndEnrichments;
17
+ let { layers } = itemAndEnrichments;
18
+ let layer = layers && (0, compose_1.getItemLayer)(item, layers, options && options.layerId);
19
+ // TODO: Remove once we stop supporting ArcGIS Servers below version 10.5.
20
+ // The /layers endpoint of some earlier servers return layers and tables
21
+ // without certain critical properties, such as type. If this is the case,
22
+ // fetch the fully hydrated target layer and stab it onto the layers array.
23
+ // See https://devtopia.esri.com/dc/hub/issues/3488 for more details
24
+ if (layer && !layer.type) {
25
+ const layerUrl = `${(0, arcgis_rest_feature_service_1.parseServiceUrl)(item.url)}/${layer.id}`;
26
+ const getLayerOptions = Object.assign({ url: layerUrl }, options); // works whether options is defined or not
27
+ layer = await (0, arcgis_rest_feature_service_1.getLayer)(getLayerOptions);
28
+ layers = layers.map((unhydratedLayer) => {
29
+ return unhydratedLayer.id === layer.id ? layer : unhydratedLayer;
30
+ });
31
+ }
32
+ return Object.assign(Object.assign({}, itemAndEnrichments), { layers });
33
+ };
34
+ const fetchItemAndEnrichments = async (itemId, options) => {
35
+ // fetch the item
36
+ const item = await (0, arcgis_rest_portal_1.getItem)(itemId, options);
37
+ // The Hub Application expects the item url of proxied CSVs to point to the
38
+ // proxying feature service. Stabbing it on here maintains that consistency
39
+ // and also helps us fetch and calculate the correct reference layer
40
+ item.url = (0, compose_1.getProxyUrl)(item, options) || item.url;
41
+ // fetch the enrichments
42
+ const enrichmentsToFetch = (options === null || options === void 0 ? void 0 : options.enrichments) || (0, _fetch_1.getContentEnrichments)(item);
43
+ const enrichments = await (0, _enrichments_1.fetchItemEnrichments)(item, enrichmentsToFetch, options);
44
+ return maybeFetchLayerEnrichments(Object.assign(Object.assign({}, enrichments), { item }), options);
45
+ };
46
+ const fetchContentById = async (hubId, options) => {
47
+ // start by fetching the item and item enrichments
48
+ const { itemId } = (0, slugs_1.parseDatasetId)(hubId);
49
+ const _a = await fetchItemAndEnrichments(itemId, options), { item } = _a, itemEnrichments = tslib_1.__rest(_a, ["item"]);
50
+ // did the caller request a specific layer
51
+ const specifiedLayerId = options && options.layerId;
52
+ // if this is a public item and we're not in enterprise
53
+ // fetch the slug and remaining enrichments from the Hub API
54
+ // const { slug, layerId, boundary, extent, searchDescription, statistics } =
55
+ // TODO: remove fetchHubEnrichmentsById as we're removing the Hub API dependency
56
+ const hubEnrichments = (0, internalContentUtils_1.canUseHubApiForItem)(item, options)
57
+ ? await (0, _fetch_1.fetchHubEnrichmentsById)(hubId, options)
58
+ : {};
59
+ const layerId = hubEnrichments.layerId;
60
+ // return a new content object composed from the item and enrichments we fetched
61
+ return (0, compose_1.composeContent)(item, Object.assign(Object.assign(Object.assign({ requestOptions: options }, itemEnrichments), hubEnrichments), {
62
+ // prefer specified layer id if any
63
+ layerId: (0, util_1.isNil)(specifiedLayerId) ? layerId : specifiedLayerId,
64
+ // merge error arrays
65
+ errors: (0, _array_1.maybeConcat)([itemEnrichments.errors, hubEnrichments.errors]) }));
66
+ };
67
+ const fetchContentBySlug = async (fullyQualifiedSlug, options) => {
68
+ // ---
69
+ // Unclear why this does not just resolve the id, then delegate to fetchContentById().
70
+ // My guess is that it saves an xhr, at the expense of some duplicated logic.
71
+ // ---
72
+ // we only have a slug, not an item id, so we start by
73
+ // fetching the item id (and enrichments) from the Hub API
74
+ // NOTE: if we are in enterprise this will throw an error
75
+ let hubEnrichments = await (0, _fetch_1.fetchHubEnrichmentsBySlug)(fullyQualifiedSlug, options);
76
+ const { itemId } = hubEnrichments;
77
+ let { layerId } = hubEnrichments;
78
+ // now we can fetch the item and item enrichments
79
+ const _a = await fetchItemAndEnrichments(itemId, options), { item } = _a, itemEnrichments = tslib_1.__rest(_a, ["item"]);
80
+ // did the caller request a specific layer
81
+ const specifiedLayerId = options && options.layerId;
82
+ if (!(0, util_1.isNil)(specifiedLayerId) && specifiedLayerId !== layerId) {
83
+ // we fetched Hub enrichments by slug for another record,
84
+ // most likely the record for the parent service of this layer,
85
+ // so we need to fetch them for the specified layer instead
86
+ layerId = specifiedLayerId;
87
+ hubEnrichments = Object.assign(Object.assign({}, hubEnrichments), (await (0, _fetch_1.fetchHubEnrichmentsById)(`${itemId}_${layerId}`, options)));
88
+ }
89
+ return (0, compose_1.composeContent)(item, Object.assign(Object.assign(Object.assign({ requestOptions: options }, itemEnrichments), hubEnrichments), { layerId,
90
+ // Note that we are not extracting the slug for the specified layer.
91
+ // It seems that the old client composer code always populated the slug
92
+ // field with the slug that was passed into the function (typically the
93
+ // slug of the parent service). To maintain parity, we do the same here.
94
+ //
95
+ // TODO: should we prefer the slug of the fetched layer instead?
96
+ // return a new content object composed from the item and enrichments we fetched
97
+ slug: fullyQualifiedSlug,
98
+ // merge error arrays
99
+ errors: (0, _array_1.maybeConcat)([itemEnrichments.errors, hubEnrichments.errors]) }));
100
+ };
101
+ const fetchContentRecordCount = async (content, requestOptions) => {
102
+ const { url, viewDefinition } = content;
103
+ const where = viewDefinition === null || viewDefinition === void 0 ? void 0 : viewDefinition.definitionExpression;
104
+ try {
105
+ const response = await (0, arcgis_rest_feature_service_1.queryFeatures)(Object.assign(Object.assign({}, requestOptions), { url,
106
+ where, returnCountOnly: true }));
107
+ return response.count;
108
+ }
109
+ catch (_a) {
110
+ // swallow the error and return Infinity as a flag that the caller can act on
111
+ // NOTE: this is what the -ui app currently expects, see:
112
+ // https://github.com/ArcGIS/opendata-ui/blob/300601918eb2dee79a89314880541ecd60f21e68/packages/opendata-ui/app/utils/composer.js#L273-L279
113
+ // however, we should probably push the error message into content.errors instead
114
+ return Infinity;
115
+ }
116
+ };
117
+ /**
118
+ * Fetch enriched content from the Portal and Hub APIs.
119
+ * Currently used in the Ember content service, arcgis-hub-dataset-field-list and arcgis-hub-metadata-list components.
120
+ * @param identifier content slug or id
121
+ * @param options Request options with additional options to control how the content or enrichments are fetched
122
+ * @returns A content object composed of the backing item and enrichments
123
+ *
124
+ * ```js
125
+ * import { fetchContent } from '@esri/hub-common'
126
+ * // fetch content by slug
127
+ * const content = await fetchContent('my-org::item-name')
128
+ * ```
129
+ */
130
+ const fetchContentHubIndex = async (identifier, options) => {
131
+ const content = (0, slugs_1.isSlug)(identifier)
132
+ ? await fetchContentBySlug((0, slugs_1.addContextToSlug)(identifier, options === null || options === void 0 ? void 0 : options.siteOrgKey), options)
133
+ : await fetchContentById(identifier, options);
134
+ // fetch record count for content that has features (e.g. layers, tables, or proxied CSVs)
135
+ const { layer, type } = content;
136
+ // it's too expensive to always fetch the live record count up front
137
+ // in order to avoid a breaking change, we're including the cached recordCount
138
+ // in the list of enrichments we fetch from the Hub API and using that
139
+ // and only fetching the live record count in cases where we don't have that
140
+ // TODO: fetchContent() should NOT fetch record count in the next breaking change
141
+ const canQuery = !!layer && hasFeatures(type);
142
+ content.recordCount =
143
+ canQuery && ((0, util_1.isNil)(content.recordCount) || content.viewDefinition)
144
+ ? // no cached count, or this is client-side layer view, fetch the count
145
+ await fetchContentRecordCount(content, options)
146
+ : content.recordCount;
147
+ return content;
148
+ };
149
+ exports.fetchContentHubIndex = fetchContentHubIndex;
150
+ //# sourceMappingURL=fetchContentHubIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchContentHubIndex.js","sourceRoot":"","sources":["../../../../src/content/fetchContentHubIndex/fetchContentHubIndex.ts"],"names":[],"mappings":";;;;AAAA,mFAI2C;AAC3C,iEAAmD;AACnD,2DAGkC;AAClC,qCAAmC;AACnC,+CAAiD;AACjD,oCAAoE;AACpE,sCAImB;AACnB,4EAAwE;AACxE,wCAAuE;AAOvE,MAAM,WAAW,GAAG,CAAC,WAAmB,EAAE,EAAE,CAC1C,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEnD,MAAM,0BAA0B,GAAG,KAAK,EACtC,kBAAuC,EACvC,OAA8B,EAC9B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,kBAAkB,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IAAI,OAAO,CAAC,cAAc,CAAC;YAChE,CAAC,CAAC,sEAAsE;gBACtE,MAAM,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC;YACjD,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC1B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAxBW,QAAA,oBAAoB,wBAwB/B"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchContentPortal = void 0;
4
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
5
+ const is_guid_1 = require("../utils/is-guid");
6
+ const slugs_1 = require("../items/slugs");
7
+ const _fetch_1 = require("./_fetch");
8
+ const _enrichments_1 = require("../items/_enrichments");
9
+ const compose_1 = require("./compose");
10
+ const _array_1 = require("../utils/_array");
11
+ /**
12
+ * Fetch Content from ArcGIS Portal by id or slug
13
+ * Temporary function to support migration from Hub Index to portal
14
+ * Once released, this will be renamed fetchContent and the existing fetchContent facade
15
+ * function will be removed.
16
+ * @param identifier
17
+ * @param options
18
+ * @returns
19
+ */
20
+ const fetchContentPortal = async (identifier, options) => {
21
+ // Resolve content using the same logic as any other entity
22
+ let item;
23
+ // if id is a guid, fetch item by id from portal
24
+ if ((0, is_guid_1.isGuid)(identifier)) {
25
+ // get item by id
26
+ item = await (0, arcgis_rest_portal_1.getItem)(identifier, options);
27
+ }
28
+ else {
29
+ // if it is a slug, fetch item by typeKeyword slug, from portal
30
+ item = await (0, slugs_1.getItemBySlug)(identifier, options);
31
+ if (!item) {
32
+ // try searching for an item by title using the slugs as a fallback
33
+ const titleFromSlug = identifier.replace(/-/g, " ");
34
+ const q = `title:"${titleFromSlug}"`;
35
+ const searchResult = await (0, arcgis_rest_portal_1.searchItems)({
36
+ q,
37
+ authentication: options === null || options === void 0 ? void 0 : options.authentication,
38
+ num: 1,
39
+ });
40
+ if (searchResult.results.length > 0) {
41
+ const id = searchResult.results[0].id;
42
+ item = await (0, arcgis_rest_portal_1.getItem)(id, options);
43
+ }
44
+ else {
45
+ // attempted both slug options and got nothing back
46
+ throw new Error(`Item not found for identifier: ${identifier}`);
47
+ }
48
+ }
49
+ }
50
+ // Now fetch the item enrichments and compose the content
51
+ const enrichmentsToFetch = (options === null || options === void 0 ? void 0 : options.enrichments) || (0, _fetch_1.getContentEnrichments)(item);
52
+ const enrichments = await (0, _enrichments_1.fetchItemEnrichments)(item, enrichmentsToFetch, options);
53
+ // compose into IHubContent
54
+ const content = (0, compose_1.composeContent)(item, Object.assign(Object.assign({ requestOptions: options }, enrichments), { layerId: (options && options.layerId) || null,
55
+ // merge error arrays
56
+ errors: (0, _array_1.maybeConcat)([enrichments.errors]), usePortalAPIOnly: true }));
57
+ return content;
58
+ };
59
+ exports.fetchContentPortal = fetchContentPortal;
60
+ //# sourceMappingURL=fetchContentPortal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchContentPortal.js","sourceRoot":"","sources":["../../../src/content/fetchContentPortal.ts"],"names":[],"mappings":";;;AAAA,iEAAuE;AAEvE,8CAA0C;AAE1C,0CAA+C;AAC/C,qCAAiD;AACjD,wDAA6D;AAC7D,uCAA2C;AAC3C,4CAA8C;AAG9C;;;;;;;;GAQG;AACI,MAAM,kBAAkB,GAAG,KAAK,EACrC,UAAkB,EAClB,OAA8B,EACR,EAAE;IACxB,2DAA2D;IAC3D,IAAI,IAAW,CAAC;IAChB,gDAAgD;IAChD,IAAI,IAAA,gBAAM,EAAC,UAAU,CAAC,EAAE,CAAC;QACvB,iBAAiB;QACjB,IAAI,GAAG,MAAM,IAAA,4BAAO,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,+DAA+D;QAC/D,IAAI,GAAG,MAAM,IAAA,qBAAa,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,mEAAmE;YACnE,MAAM,aAAa,GAAG,UAAU,CAAC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+1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertItemToContent = exports.fetchHubContent = void 0;
4
- const fetchContent_1 = require("./fetchContent");
3
+ exports.fetchHubContent = void 0;
5
4
  const fetchEditableContentEnrichments_1 = require("./_internal/fetchEditableContentEnrichments");
6
5
  const compose_1 = require("./compose");
7
6
  const set_prop_1 = require("../objects/set-prop");
8
- const modelToHubEditableContent_1 = require("./modelToHubEditableContent");
9
- const settings_1 = require("../discussions/api/settings/settings");
10
- const getDefaultEntitySettings_1 = require("../discussions/api/settings/getDefaultEntitySettings");
11
- const fetchModelFromItem_1 = require("../models/fetchModelFromItem");
7
+ const fetchContent_1 = require("./fetchContent");
8
+ const convertItemToContent_1 = require("./convertItemToContent");
12
9
  /**
13
10
  * fetch a content entity by identifier
11
+ * Currently used in arcgis-hub-add-content component, and the Ember content service
14
12
  * @param identifier
15
13
  * @param requestOptions
16
14
  * @returns content entity
@@ -27,23 +25,7 @@ const fetchHubContent = async (identifier, requestOptions, enrichments) => {
27
25
  // Application") before we map the model to a Hub Entity
28
26
  const type = (0, compose_1.normalizeItemType)(item);
29
27
  (0, set_prop_1.setProp)("type", type, item);
30
- return (0, exports.convertItemToContent)(item, requestOptions, editableContentEnrichments);
28
+ return (0, convertItemToContent_1.convertItemToContent)(item, requestOptions, editableContentEnrichments);
31
29
  };
32
30
  exports.fetchHubContent = fetchHubContent;
33
- /**
34
- * Convert an Item to an editable Hub Content object,
35
- * fetch any additional information that may be required
36
- */
37
- const convertItemToContent = async (item, requestOptions, enrichments) => {
38
- const [model, entitySettings] = await Promise.all([
39
- (0, fetchModelFromItem_1.fetchModelFromItem)(item, requestOptions),
40
- !requestOptions.isPortal
41
- ? (0, settings_1.fetchSettingV2)(Object.assign({ id: item.id }, requestOptions)).catch(() => (Object.assign({ id: null }, (0, getDefaultEntitySettings_1.getDefaultEntitySettings)("content"))))
42
- : null,
43
- ]);
44
- model.entitySettings = entitySettings;
45
- const content = (0, modelToHubEditableContent_1.modelToHubEditableContent)(model, requestOptions, enrichments);
46
- return content;
47
- };
48
- exports.convertItemToContent = convertItemToContent;
49
31
  //# sourceMappingURL=fetchHubContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchHubContent.js","sourceRoot":"","sources":["../../../src/content/fetchHubContent.ts"],"names":[],"mappings":";;;AAKA,iDAAoE;AACpE,iGAA8F;AAC9F,uCAA8C;AAC9C,kDAA8C;AAC9C,2EAAwE;AACxE,mEAAsE;AACtE,mGAAgG;AAEhG,qEAAkE;AAIlE;;;;;GAKG;AACI,MAAM,eAAe,GAAG,KAAK,EAClC,UAAkB,EAClB,cAAkC,EAClC,WAAyC,EACX,EAAE;IAChC,4EAA4E;IAC5E,4EAA4E;IAC5E,mCAAmC;IACnC,MAAM,OAAO,GAAG,gCACX,cAAc,KACjB,WAAW,EAAE,EAAE,GACQ,CAAC;IAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,2BAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAEzD,MAAM,0BAA0B,GAAG,MAAM,IAAA,iEAA+B,EACtE,IAAI,EACJ,cAAc,EACd,WAAW,CACZ,CAAC;IAEF,wDAAwD;IACxD,yDAAyD;IACzD,wDAAwD;IACxD,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAAC,IAAI,CAAC,CAAC;IACrC,IAAA,kBAAO,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAE5B,OAAO,IAAA,4BAAoB,EAAC,IAAI,EAAE,cAAc,EAAE,0BAA0B,CAAC,CAAC;AAChF,CAAC,CAAC;AA3BW,QAAA,eAAe,mBA2B1B;AAEF;;;GAGG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,IAAW,EACX,cAAkC,EAClC,WAA4C,EACd,EAAE;IAChC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChD,IAAA,uCAAkB,EAAC,IAAI,EAAE,cAAc,CAAC;QACxC,CAAC,cAAc,CAAC,QAAQ;YACtB,CAAC,CAAC,IAAA,yBAAc,kBACZ,EAAE,EAAE,IAAI,CAAC,EAAE,IACR,cAAc,EACjB,CAAC,KAAK,CACN,GAAG,EAAE,CACH,CAAC,gBACC,EAAE,EAAE,IAAI,IACL,IAAA,mDAAwB,EAAC,SAAS,CAAC,CACpB,CAAA,CACvB;YACH,CAAC,CAAC,IAAI;KACT,CAAC,CAAC;IACH,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;IACtC,MAAM,OAAO,GAAiC,IAAA,qDAAyB,EACrE,KAAK,EACL,cAAc,EACd,WAAW,CACZ,CAAC;IAEF,OAAO,OAA8B,CAAC;AACxC,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B"}
1
+ {"version":3,"file":"fetchHubContent.js","sourceRoot":"","sources":["../../../src/content/fetchHubContent.ts"],"names":[],"mappings":";;;AAEA,iGAA8F;AAC9F,uCAA8C;AAC9C,kDAA8C;AAE9C,iDAA8C;AAE9C,iEAA8D;AAE9D;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,KAAK,EAClC,UAAkB,EAClB,cAAkC,EAClC,WAAyC,EACX,EAAE;IAChC,4EAA4E;IAC5E,4EAA4E;IAC5E,mCAAmC;IACnC,MAAM,OAAO,GAAG,gCACX,cAAc,KACjB,WAAW,EAAE,EAAE,GACQ,CAAC;IAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,2BAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAEzD,MAAM,0BAA0B,GAAG,MAAM,IAAA,iEAA+B,EACtE,IAAI,EACJ,cAAc,EACd,WAAW,CACZ,CAAC;IAEF,wDAAwD;IACxD,yDAAyD;IACzD,wDAAwD;IACxD,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAAC,IAAI,CAAC,CAAC;IACrC,IAAA,kBAAO,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAE5B,OAAO,IAAA,2CAAoB,EAAC,IAAI,EAAE,cAAc,EAAE,0BAA0B,CAAC,CAAC;AAChF,CAAC,CAAC;AA3BW,QAAA,eAAe,mBA2B1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/content/types.ts"],"names":[],"mappings":";;AAuFA,qEAAqE"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/content/types.ts"],"names":[],"mappings":";;AAkGA,qEAAqE"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.datasetToItem = exports.datasetToContent = exports.composeHubContent = exports.parseItemCategories = exports.normalizeItemType = exports.isLayerView = exports.isFeatureService = exports.getProxyUrl = exports.getPortalUrls = exports.getLayerIdFromUrl = exports.getItemLayerId = exports.getItemLayer = exports.getItemHubId = exports.getContentTypeIcon = exports.composeContent = exports.HubChannel = exports.fetchHubChannel = exports.updateHubChannel = exports.deleteHubChannel = exports.createHubChannel = exports.isDownloadable = exports.categories = exports.getWellKnownAssociationsCatalog = exports.getAvailableToRequestAssociationCatalogs = exports.ASSOCIATION_REFERENCE_LIMIT = exports.setEntityAssociationGroup = exports.requestAssociation = exports.acceptAssociation = exports.getRequestingEntitiesQuery = exports.getReferencedEntityIds = exports.getPendingEntitiesQuery = exports.getAvailableToRequestEntitiesQuery = exports.getAssociationStats = exports.getAssociatedEntitiesQuery = exports.breakAssociation = exports.HUB_SERVICE_STATUS = exports.ENTERPRISE_SITES_SERVICE_STATUS = exports.ArcGISContextManager = exports.ALPHA_ORGS = exports.ENTERPRISE_SITES_PATH = exports.ENTERPRISE_HOME_SUBDOMAIN = exports.ArcGISContext = exports.getHubApiUrl = exports.hasBasePriv = exports.compareAccess = exports.REQUIRED_PRIVS = exports.canEditSiteContent = exports.canEditSite = exports.canEditItem = exports.canEditEvent = void 0;
4
- exports.getRelativeWorkspaceUrl = exports.getHubTypeFromItemType = exports.getEntityTypeFromHubEntityType = exports.getEntityThumbnailUrl = exports.getEntityGroups = exports.fetchHubEntity = exports.TIMELINE_STAGE_STATUSES = exports.MetricVisibility = exports.FeatureLayerStyle = exports.ExpressionRelationships = exports.EntityEditor = exports.deepCatalogContains = exports.catalogContains = exports.removeContextFromSlug = exports.parseDatasetId = exports.isSlug = exports.addContextToSlug = exports.enrichImageSearchResult = exports.enrichContentSearchResult = exports.modelToHubEditableContent = exports.isSiteType = exports.HubContent = exports.toggleServiceCapability = exports.isSecureProxyServiceUrl = exports.isHostedFeatureServiceMainItem = exports.isHostedFeatureServiceMainEntity = exports.isAGOFeatureServiceUrl = exports.hasServiceCapability = exports.getFamilyTypes = exports.getFamily = exports.fetchItemJobRecords = exports.fetchHubContent = exports.convertItemToContent = exports.fetchContent = exports.UpdateFrequency = exports.ServiceCapabilities = exports.JobRecordStatus = exports.JobRecordType = exports.updateContent = exports.editorToContent = exports.deleteContent = exports.createContent = exports.setContentType = exports.itemToContent = exports.getTypes = exports.getTypeCategories = exports.getServiceStatus = exports.getContentTypeLabel = exports.getContentIdentifier = exports.getCategory = void 0;
4
+ exports.getRelativeWorkspaceUrl = exports.getHubTypeFromItemType = exports.getEntityTypeFromHubEntityType = exports.getEntityThumbnailUrl = exports.getEntityGroups = exports.fetchHubEntity = exports.TIMELINE_STAGE_STATUSES = exports.MetricVisibility = exports.FeatureLayerStyle = exports.ExpressionRelationships = exports.EntityEditor = exports.deepCatalogContains = exports.catalogContains = exports.removeContextFromSlug = exports.parseDatasetId = exports.isSlug = exports.addContextToSlug = exports.enrichImageSearchResult = exports.enrichContentSearchResult = exports.modelToHubEditableContent = exports.isSiteType = exports.HubContent = exports.toggleServiceCapability = exports.isSecureProxyServiceUrl = exports.isHostedFeatureServiceMainItem = exports.isHostedFeatureServiceMainEntity = exports.isAGOFeatureServiceUrl = exports.hasServiceCapability = exports.getFamilyTypes = exports.getFamily = exports.fetchItemJobRecords = exports.convertItemToContent = exports.fetchHubContent = exports.fetchContent = exports.UpdateFrequency = exports.ServiceCapabilities = exports.JobRecordStatus = exports.JobRecordType = exports.updateContent = exports.editorToContent = exports.deleteContent = exports.createContent = exports.setContentType = exports.itemToContent = exports.getTypes = exports.getTypeCategories = exports.getServiceStatus = exports.getContentTypeLabel = exports.getContentIdentifier = exports.getCategory = void 0;
5
5
  exports.UiSchemaElementTypes = exports.UiSchemaSectionTypes = exports.UiSchemaMessageTypes = exports.validStatCardEditorTypes = exports.validFollowCardEditorTypes = exports.validEventGalleryCardEditorTypes = exports.validEntityEditorTypes = exports.validEmbedCardEditorTypes = exports.validEditorTypes = exports.validDiscussionSettingsEditorTypes = exports.validCardEditorTypes = exports.SLUG_SCHEMA = exports.SITE_ENTITY_NAME_SCHEMA = exports.PRIVACY_CONFIG_SCHEMA = exports.ENTITY_TIMELINE_SCHEMA = exports.ENTITY_TAGS_SCHEMA = exports.ENTITY_SUMMARY_SCHEMA = exports.ENTITY_NAME_SCHEMA = exports.ENTITY_MAP_SCHEMA = exports.ENTITY_LOCATION_SCHEMA = exports.ENTITY_LAYOUT_SETUP_SCHEMA = exports.ENTITY_IS_DISCUSSABLE_SCHEMA = exports.ENTITY_IMAGE_SCHEMA = exports.ENTITY_FEATURED_CONTENT_SCHEMA = exports.ENTITY_CATEGORIES_SCHEMA = exports.ENTITY_CATALOG_SETUP_SCHEMA = exports.ENTITY_ACCESS_SCHEMA = exports.ENTERPRISE_SITE_ENTITY_NAME_SCHEMA = exports.DISCUSSION_SETTINGS_SCHEMA = exports.CARD_TITLE_TAGS = exports.QuerySchema = exports.PredicateSchema = exports.GalleryDisplayConfigSchema = exports.FilterSchema = exports.CollectionSchema = exports.CatalogSchema = exports.getTagItems = exports.fetchCategoriesUiSchemaElement = exports.getEditorConfig = exports.processActionLinks = exports.processActionLink = exports.pathMap = exports.parseContainmentPath = exports.getPathForHubEntityType = exports.getHubEntityTypeFromPath = exports.isValidEntityType = exports.removeHistoryEntry = exports.addHistoryEntry = exports.getTypesFromEntityType = exports.getTypeFromEntity = void 0;
6
6
  exports.updatePostV2 = exports.updatePostStatusV2 = exports.searchPostsV2 = exports.removePostV2 = exports.fetchPostV2 = exports.exportPostsV2 = exports.createReplyV2 = exports.createPostV2 = exports.SortOrder = exports.SharingAccess = exports.SearchPostsFormat = exports.Role = exports.ReactionRelation = exports.PostType = exports.PostStatus = exports.PostSort = exports.PostRelation = exports.PostReaction = exports.EntitySettingType = exports.DiscussionType = exports.DiscussionSource = exports.CommonSort = exports.ChannelSort = exports.ChannelRelation = exports.ChannelFilter = exports.AclSubCategory = exports.AclCategory = exports.discussionsApiRequestV2 = exports.updateChannelV2 = exports.searchChannelsV2 = exports.removeChannelV2 = exports.removeChannelNotificationOptOutV2 = exports.removeChannelActivityV2 = exports.fetchChannelV2 = exports.fetchChannelNotifcationOptOutV2 = exports.createChannelV2 = exports.createChannelNotificationOptOutV2 = exports.updateHubEntity = exports.unshareEntityWithGroups = exports.EntityResourceMap = exports.MAX_FEATURED_METRICS_ALLOWED = exports.MAX_ENTITY_METRICS_ALLOWED = exports.isHubService = exports.PublisherSource = exports.HUB_ITEM_ENTITY_TYPES = exports.HUB_ENTITY_TYPES = exports.EmbedKind = exports.shareEntityWithGroups = exports.setEntityAccess = exports.UiSchemaRuleEffects = void 0;
7
7
  exports.getSpatialRefTypeKeyword = exports.getExportLayerTypeKeyword = exports.getExportItemTypeKeyword = exports.buildExistingExportsPortalQuery = exports.setDiscussableKeyword = exports.isPublicChannel = exports.isPrivateChannel = exports.isOrgChannel = exports.isDiscussable = exports.getPostCSVFileName = exports.getChannelUsersQuery = exports.getChannelOrgIds = exports.getChannelGroupIds = exports.getChannelAccess = exports.channelToSearchResult = exports.HubDiscussion = exports.fetchDiscussion = exports.convertItemToDiscussion = exports.updateDiscussion = exports.deleteDiscussion = exports.createDiscussion = exports.MENTION_ATTRIBUTE = exports.CANNOT_DISCUSS = exports.canCreateReactionV2 = exports.parseMentionedUsers = exports.parseDiscussionURI = exports.cannotCreatePostGroupsBlockedV2 = exports.canEditPostV2 = exports.canEditPostStatusV2 = exports.canDeletePostV2 = exports.canCreateReplyV2 = exports.canCreatePostV2 = exports.userHasPrivileges = exports.userHasPrivilege = exports.reduceByGroupMembership = exports.isUserInOrg = exports.isOrgAdminInOrg = exports.isOrgAdmin = exports.deriveUserRoleV2 = exports.canReadChannelV2 = exports.canEditChannelV2 = exports.canDeleteChannelV2 = exports.canCreateChannelV2 = exports.updateSettingV2 = exports.removeSettingV2 = exports.fetchSettingV2 = exports.createSettingV2 = exports.getDefaultEntitySettings = exports.removeReactionV2 = exports.createReactionV2 = void 0;
@@ -132,8 +132,9 @@ Object.defineProperty(exports, "UpdateFrequency", { enumerable: true, get: funct
132
132
  var fetchContent_1 = require("./content/fetchContent");
133
133
  Object.defineProperty(exports, "fetchContent", { enumerable: true, get: function () { return fetchContent_1.fetchContent; } });
134
134
  var fetchHubContent_1 = require("./content/fetchHubContent");
135
- Object.defineProperty(exports, "convertItemToContent", { enumerable: true, get: function () { return fetchHubContent_1.convertItemToContent; } });
136
135
  Object.defineProperty(exports, "fetchHubContent", { enumerable: true, get: function () { return fetchHubContent_1.fetchHubContent; } });
136
+ var convertItemToContent_1 = require("./content/convertItemToContent");
137
+ Object.defineProperty(exports, "convertItemToContent", { enumerable: true, get: function () { return convertItemToContent_1.convertItemToContent; } });
137
138
  var fetchItemJobRecords_1 = require("./content/fetchItemJobRecords");
138
139
  Object.defineProperty(exports, "fetchItemJobRecords", { enumerable: true, get: function () { return fetchItemJobRecords_1.fetchItemJobRecords; } });
139
140
  var get_family_1 = require("./content/get-family");