@esri/hub-common 14.83.0 → 14.84.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/esm/associations/getAssociationStats.js +25 -6
- package/dist/esm/associations/getAssociationStats.js.map +1 -1
- package/dist/esm/associations/getReferencedEntityIds.js +25 -0
- package/dist/esm/associations/getReferencedEntityIds.js.map +1 -0
- package/dist/esm/associations/index.js +2 -1
- package/dist/esm/associations/index.js.map +1 -1
- package/dist/esm/associations/internal/getIdsFromKeywords.js +2 -1
- package/dist/esm/associations/internal/getIdsFromKeywords.js.map +1 -1
- package/dist/esm/associations/types.js +12 -0
- package/dist/esm/associations/types.js.map +1 -1
- package/dist/esm/associations/{getWellKnownAssociationsCatalog.js → wellKnownAssociationCatalogs.js} +41 -2
- package/dist/esm/associations/wellKnownAssociationCatalogs.js.map +1 -0
- package/dist/esm/search/wellKnownCatalog.js +27 -7
- package/dist/esm/search/wellKnownCatalog.js.map +1 -1
- package/dist/node/associations/getAssociationStats.js +25 -6
- package/dist/node/associations/getAssociationStats.js.map +1 -1
- package/dist/node/associations/getReferencedEntityIds.js +28 -0
- package/dist/node/associations/getReferencedEntityIds.js.map +1 -0
- package/dist/node/associations/index.js +2 -1
- package/dist/node/associations/index.js.map +1 -1
- package/dist/node/associations/internal/getIdsFromKeywords.js +2 -1
- package/dist/node/associations/internal/getIdsFromKeywords.js.map +1 -1
- package/dist/node/associations/types.js +13 -0
- package/dist/node/associations/types.js.map +1 -1
- package/dist/node/associations/{getWellKnownAssociationsCatalog.js → wellKnownAssociationCatalogs.js} +41 -2
- package/dist/node/associations/wellKnownAssociationCatalogs.js.map +1 -0
- package/dist/node/search/wellKnownCatalog.js +27 -7
- package/dist/node/search/wellKnownCatalog.js.map +1 -1
- package/dist/types/associations/getAssociationStats.d.ts +16 -2
- package/dist/types/associations/getReferencedEntityIds.d.ts +22 -0
- package/dist/types/associations/index.d.ts +2 -1
- package/dist/types/associations/internal/getIdsFromKeywords.d.ts +1 -1
- package/dist/types/associations/types.d.ts +12 -0
- package/dist/types/associations/{getWellKnownAssociationsCatalog.d.ts → wellKnownAssociationCatalogs.d.ts} +16 -0
- package/dist/types/core/types/IHubCardViewModel.d.ts +2 -0
- package/dist/types/search/wellKnownCatalog.d.ts +3 -1
- package/package.json +1 -1
- package/dist/esm/associations/getWellKnownAssociationsCatalog.js.map +0 -1
- package/dist/node/associations/getWellKnownAssociationsCatalog.js.map +0 -1
|
@@ -6,8 +6,22 @@ import { getRequestingEntitiesQuery } from "./getRequestingEntitiesQuery";
|
|
|
6
6
|
import { getAssociationHierarchy } from "./internal/getAssociationHierarchy";
|
|
7
7
|
import { isAssociationSupported } from "./internal/isAssociationSupported";
|
|
8
8
|
/**
|
|
9
|
-
* get
|
|
10
|
-
*
|
|
9
|
+
* get Entity A's association stats with Entity B:
|
|
10
|
+
*
|
|
11
|
+
* 1. associated: the number of Entity B's that Entity A
|
|
12
|
+
* is associated with
|
|
13
|
+
*
|
|
14
|
+
* 2. pending: the number of outgoing requests Entity A
|
|
15
|
+
* has sent to Entity B
|
|
16
|
+
*
|
|
17
|
+
* 3. requesting: the number of incoming requests Entity A
|
|
18
|
+
* has received from Entity B
|
|
19
|
+
*
|
|
20
|
+
* 4a. included: if Entity A is the parent, the number of
|
|
21
|
+
* Entity B's it has included in its association group
|
|
22
|
+
*
|
|
23
|
+
* 4b. referenced: if Entity A is the child, the number of
|
|
24
|
+
* Entity B's it has referenced (via typeKeyword)
|
|
11
25
|
*
|
|
12
26
|
* @param entity - Hub entity
|
|
13
27
|
* @param associationType - entity type to query for
|
|
@@ -30,10 +44,15 @@ export const getAssociationStats = async (entity, associationType, context) => {
|
|
|
30
44
|
getPendingEntitiesQuery(entity, associationType, context),
|
|
31
45
|
getRequestingEntitiesQuery(entity, associationType, context),
|
|
32
46
|
]);
|
|
33
|
-
const [{ total: associated }, { total: pending }, { total: requesting }] = await Promise.all(queries.map((query) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
const [{ total: associated }, { total: pending }, { total: requesting }] = await Promise.all(queries.map(async (query) => {
|
|
48
|
+
try {
|
|
49
|
+
return await hubSearch(query, {
|
|
50
|
+
requestOptions: context.hubRequestOptions,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return { total: 0 };
|
|
55
|
+
}
|
|
37
56
|
}));
|
|
38
57
|
stats = Object.assign({ associated,
|
|
39
58
|
pending,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAssociationStats.js","sourceRoot":"","sources":["../../../src/associations/getAssociationStats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG3E
|
|
1
|
+
{"version":3,"file":"getAssociationStats.js","sourceRoot":"","sources":["../../../src/associations/getAssociationStats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAA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E,KAAa,EAAE,EAAE;YAClC,IAAI;gBACF,OAAO,MAAM,SAAS,CAAC,KAAK,EAAE;oBAC5B,cAAc,EAAE,OAAO,CAAC,iBAAiB;iBAC1C,CAAC,CAAC;aACJ;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;aACrB;QACH,CAAC,CAAC,CACH,CAAC;QAEJ,KAAK,mBACH,UAAU;YACV,OAAO;YACP,UAAU,IACP,CAAC,QAAQ;YACV,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,EAAE;YACpC,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,EAAE,CAAC,CAC1C,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getIdsFromKeywords } from "./internal/getIdsFromKeywords";
|
|
2
|
+
/**
|
|
3
|
+
* The following util returns an array of ids that the provided
|
|
4
|
+
* entity "references" via a typeKeyword of the form ref|<associationType>|<id>
|
|
5
|
+
*
|
|
6
|
+
* Note: if a specific associationType is not provided, this util
|
|
7
|
+
* will return ALL the ids that the provided entity "references"
|
|
8
|
+
*
|
|
9
|
+
* Additional context: the model for associations is built around
|
|
10
|
+
* platform capabilities. Platform imposes a limit of 128 on the
|
|
11
|
+
* number of typeKeywords that can be set on an item. Since "child"
|
|
12
|
+
* entities form their half of an association connection via
|
|
13
|
+
* typeKeywords, we must limit the number of associations a child
|
|
14
|
+
* can request or accept to far fewer than 128. For now, we are
|
|
15
|
+
* imposing a limit of 50. From the application, we can then use
|
|
16
|
+
* this util to determine if a child has already reached the limit
|
|
17
|
+
*
|
|
18
|
+
* @param entity - hub entity to extract ids from
|
|
19
|
+
* @param associationType - entity type to extract reference ids for
|
|
20
|
+
* @returns {string[]}
|
|
21
|
+
*/
|
|
22
|
+
export const getReferencedEntityIds = (entity, associationType) => {
|
|
23
|
+
return getIdsFromKeywords(entity, associationType);
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=getReferencedEntityIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getReferencedEntityIds.js","sourceRoot":"","sources":["../../../src/associations/getReferencedEntityIds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAAiB,EACjB,eAA+B,EACrB,EAAE;IACZ,OAAO,kBAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AACrD,CAAC,CAAC"}
|
|
@@ -8,7 +8,8 @@ export * from "./getAssociationStats";
|
|
|
8
8
|
export * from "./getAvailableToRequestEntitiesQuery";
|
|
9
9
|
export * from "./getPendingEntitiesQuery";
|
|
10
10
|
export * from "./getRequestingEntitiesQuery";
|
|
11
|
-
export * from "./
|
|
11
|
+
export * from "./getReferencedEntityIds";
|
|
12
|
+
export * from "./wellKnownAssociationCatalogs";
|
|
12
13
|
// Note: we expose "requestAssociation" under 2 names.
|
|
13
14
|
// These actions are functionally equivalent, but we want
|
|
14
15
|
// to make the intent more clear to the consumer.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/associations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/associations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,sDAAsD;AACtD,yDAAyD;AACzD,iDAAiD;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -12,7 +12,8 @@ import { getProp } from "../../objects";
|
|
|
12
12
|
*/
|
|
13
13
|
export const getIdsFromKeywords = (entity, associationType) => {
|
|
14
14
|
return getProp(entity, "typeKeywords").reduce((ids, keyword) => {
|
|
15
|
-
|
|
15
|
+
const refKey = associationType ? `ref|${associationType}|` : "ref|";
|
|
16
|
+
if (keyword.startsWith(refKey)) {
|
|
16
17
|
const id = keyword.split("|")[2];
|
|
17
18
|
ids.push(id);
|
|
18
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIdsFromKeywords.js","sourceRoot":"","sources":["../../../../src/associations/internal/getIdsFromKeywords.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"getIdsFromKeywords.js","sourceRoot":"","sources":["../../../../src/associations/internal/getIdsFromKeywords.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAiB,EACjB,eAA+B,EACrB,EAAE;IACZ,OAAO,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,MAAM,CAC3C,CAAC,GAAa,EAAE,OAAe,EAAE,EAAE;QACjC,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,OAAO,eAAe,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;QACpE,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC9B,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACd;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model for associations is built around platform
|
|
3
|
+
* capabilities. Platform imposes a limit of 128 on the
|
|
4
|
+
* number of typeKeywords that can be set on an item.
|
|
5
|
+
* Since "child" entities form their half of an association
|
|
6
|
+
* connection via typeKeywords, we must limit the number
|
|
7
|
+
* of associations a child can request or accept to far
|
|
8
|
+
* fewer than 128.
|
|
9
|
+
*
|
|
10
|
+
* For now, we are setting this limit to 50
|
|
11
|
+
*/
|
|
12
|
+
export const ASSOCIATION_REFERENCE_LIMIT = 50;
|
|
1
13
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/associations/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/associations/types.ts"],"names":[],"mappings":"AA8EA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC"}
|
package/dist/esm/associations/{getWellKnownAssociationsCatalog.js → wellKnownAssociationCatalogs.js}
RENAMED
|
@@ -6,7 +6,7 @@ import { getPendingEntitiesQuery } from "./getPendingEntitiesQuery";
|
|
|
6
6
|
import { getAvailableToRequestEntitiesQuery } from "./getAvailableToRequestEntitiesQuery";
|
|
7
7
|
import { getRequestingEntitiesQuery } from "./getRequestingEntitiesQuery";
|
|
8
8
|
import { isAssociationSupported } from "./internal/isAssociationSupported";
|
|
9
|
-
import { dotifyString, getWellknownCollection, } from "../search/wellKnownCatalog";
|
|
9
|
+
import { dotifyString, getWellKnownCatalog, getWellknownCollection, } from "../search/wellKnownCatalog";
|
|
10
10
|
/**
|
|
11
11
|
* There are two primary UI workflows when we consider associations:
|
|
12
12
|
* 1. Viewing associations
|
|
@@ -69,4 +69,43 @@ export async function getWellKnownAssociationsCatalog(i18nScope, catalogName, en
|
|
|
69
69
|
catalog = buildCatalog(i18nScope, catalogName, filters, collections, targetEntity);
|
|
70
70
|
return catalog;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Specific util for building well-known (My content, Favorites,
|
|
74
|
+
* Organization, and World) association catalogs to populate
|
|
75
|
+
* a gallery picker experience for requesting association.
|
|
76
|
+
*
|
|
77
|
+
* In addition to the normal filters that define these well-known
|
|
78
|
+
* catalogs, we also need to further filter the results to only
|
|
79
|
+
* include entities that can still be requested for association.
|
|
80
|
+
*
|
|
81
|
+
* @param i18nScope - translation scope to be interpolated into the catalog
|
|
82
|
+
* @param entity - primary entity the catalog is being built for
|
|
83
|
+
* @param associationType - type of entity the primary entity wants to view associations for
|
|
84
|
+
* @param context - contextual auth and portal information
|
|
85
|
+
* @returns {IHubCatalog[]}
|
|
86
|
+
*/
|
|
87
|
+
export const getAvailableToRequestAssociationCatalogs = (i18nScope, entity, associationType, context) => {
|
|
88
|
+
var _a;
|
|
89
|
+
const entityType = getTypeFromEntity(entity);
|
|
90
|
+
const isSupported = isAssociationSupported(entityType, associationType);
|
|
91
|
+
if (!isSupported) {
|
|
92
|
+
throw new Error(`getAvailableToRequestAssociationCatalogs: Association between ${entityType} and ${associationType} is not supported.`);
|
|
93
|
+
}
|
|
94
|
+
i18nScope = dotifyString(i18nScope);
|
|
95
|
+
const filters = (_a = getAvailableToRequestEntitiesQuery(entity, associationType)) === null || _a === void 0 ? void 0 : _a.filters;
|
|
96
|
+
const catalogNames = [
|
|
97
|
+
"myContent",
|
|
98
|
+
"favorites",
|
|
99
|
+
"organization",
|
|
100
|
+
"world",
|
|
101
|
+
];
|
|
102
|
+
return catalogNames.map((name) => {
|
|
103
|
+
const options = {
|
|
104
|
+
user: context.currentUser,
|
|
105
|
+
filters,
|
|
106
|
+
collectionNames: [associationType],
|
|
107
|
+
};
|
|
108
|
+
return getWellKnownCatalog(i18nScope, name, "item", options);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=wellKnownAssociationCatalogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wellKnownAssociationCatalogs.js","sourceRoot":"","sources":["../../../src/associations/wellKnownAssociationCatalogs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EAIL,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAapC;;;;;;;;;;;;;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ildCatalog } from "./_internal/buildCatalog";
|
|
3
|
+
import { getProp } from "../objects";
|
|
3
4
|
/**
|
|
4
5
|
* Check if i18nScope is defined and not ending with a ".", if so add a "." at the end.
|
|
5
6
|
* e.g. if the i18nScope is 'project.edit', the path is `${i18nScope}catalog.organization`,
|
|
@@ -48,22 +49,32 @@ function validateUserExistence(catalogName, options) {
|
|
|
48
49
|
function getWellknownItemCatalog(i18nScope, catalogName, options) {
|
|
49
50
|
i18nScope = dotifyString(i18nScope);
|
|
50
51
|
let catalog;
|
|
52
|
+
const additionalFilters = getProp(options, "filters") || [];
|
|
51
53
|
const collections = getWellknownCollections(i18nScope, "item", options === null || options === void 0 ? void 0 : options.collectionNames);
|
|
52
54
|
switch (catalogName) {
|
|
53
55
|
case "myContent":
|
|
54
56
|
validateUserExistence(catalogName, options);
|
|
55
|
-
catalog = buildCatalog(i18nScope, catalogName, [
|
|
57
|
+
catalog = buildCatalog(i18nScope, catalogName, [
|
|
58
|
+
{ predicates: [{ owner: options.user.username }] },
|
|
59
|
+
...additionalFilters,
|
|
60
|
+
], collections, "item");
|
|
56
61
|
break;
|
|
57
62
|
case "favorites":
|
|
58
63
|
validateUserExistence(catalogName, options);
|
|
59
|
-
catalog = buildCatalog(i18nScope, catalogName, [
|
|
64
|
+
catalog = buildCatalog(i18nScope, catalogName, [
|
|
65
|
+
{ predicates: [{ group: options.user.favGroupId }] },
|
|
66
|
+
...additionalFilters,
|
|
67
|
+
], collections, "item");
|
|
60
68
|
break;
|
|
61
69
|
case "organization":
|
|
62
70
|
validateUserExistence(catalogName, options);
|
|
63
|
-
catalog = buildCatalog(i18nScope, catalogName, [{ predicates: [{ orgid: options.user.orgId }] }], collections, "item");
|
|
71
|
+
catalog = buildCatalog(i18nScope, catalogName, [{ predicates: [{ orgid: options.user.orgId }] }, ...additionalFilters], collections, "item");
|
|
64
72
|
break;
|
|
65
73
|
case "world":
|
|
66
|
-
catalog = buildCatalog(i18nScope, catalogName, [
|
|
74
|
+
catalog = buildCatalog(i18nScope, catalogName, [
|
|
75
|
+
{ predicates: [{ type: { not: ["code attachment"] } }] },
|
|
76
|
+
...additionalFilters,
|
|
77
|
+
], collections, "item");
|
|
67
78
|
break;
|
|
68
79
|
}
|
|
69
80
|
return catalog;
|
|
@@ -78,6 +89,7 @@ function getWellknownItemCatalog(i18nScope, catalogName, options) {
|
|
|
78
89
|
function getWellknownGroupCatalog(i18nScope, catalogName, options) {
|
|
79
90
|
i18nScope = dotifyString(i18nScope);
|
|
80
91
|
let catalog;
|
|
92
|
+
const additionalFilters = getProp(options, "filters") || [];
|
|
81
93
|
// because collections are needed in arcgis-hub-catalog and
|
|
82
94
|
// "searchGroups" allows 'q: "*"', we use this as the collection
|
|
83
95
|
const collections = [
|
|
@@ -98,15 +110,21 @@ function getWellknownGroupCatalog(i18nScope, catalogName, options) {
|
|
|
98
110
|
switch (catalogName) {
|
|
99
111
|
case "editGroups":
|
|
100
112
|
validateUserExistence(catalogName, options);
|
|
101
|
-
catalog = buildCatalog(i18nScope, catalogName, [
|
|
113
|
+
catalog = buildCatalog(i18nScope, catalogName, [
|
|
114
|
+
{ predicates: [{ capabilities: ["updateitemcontrol"] }] },
|
|
115
|
+
...additionalFilters,
|
|
116
|
+
], collections, "group");
|
|
102
117
|
break;
|
|
103
118
|
case "viewGroups":
|
|
104
119
|
validateUserExistence(catalogName, options);
|
|
105
|
-
catalog = buildCatalog(i18nScope, catalogName, [
|
|
120
|
+
catalog = buildCatalog(i18nScope, catalogName, [
|
|
121
|
+
{ predicates: [{ capabilities: { not: ["updateitemcontrol"] } }] },
|
|
122
|
+
...additionalFilters,
|
|
123
|
+
], collections, "group");
|
|
106
124
|
break;
|
|
107
125
|
case "allGroups":
|
|
108
126
|
validateUserExistence(catalogName, options);
|
|
109
|
-
catalog = buildCatalog(i18nScope, catalogName, [{ predicates: [{ capabilities: [""] }] }], collections, "group");
|
|
127
|
+
catalog = buildCatalog(i18nScope, catalogName, [{ predicates: [{ capabilities: [""] }] }, ...additionalFilters], collections, "group");
|
|
110
128
|
break;
|
|
111
129
|
}
|
|
112
130
|
return catalog;
|
|
@@ -236,6 +254,8 @@ function getAllCollectionsMap(i18nScope, entityType) {
|
|
|
236
254
|
predicates: [
|
|
237
255
|
{
|
|
238
256
|
type: getFamilyTypes("initiative"),
|
|
257
|
+
// only include v2 initiatives
|
|
258
|
+
typekeywords: ["hubInitiativeV2"],
|
|
239
259
|
},
|
|
240
260
|
],
|
|
241
261
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wellKnownCatalog.js","sourceRoot":"","sources":["../../../src/search/wellKnownCatalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"wellKnownCatalog.js","sourceRoot":"","sources":["../../../src/search/wellKnownCatalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAsCrC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,OAAO,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,WAA6B,EAC7B,UAAsB,EACtB,OAAqC;IAErC,QAAQ,UAAU,EAAE;QAClB,KAAK,MAAM;YACT,OAAO,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAClE,KAAK,OAAO;YACV,OAAO,wBAAwB,CAAC,SAAS,EAAE,WAA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G,YAAY,CAAC,SAAS,CAAC,CAAC;IAEpC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAEtE,MAAM,sBAAsB,GAAG,yBAAyB,EAAE,CAAC;IAE3D,mEAAmE;IACnE,wCAAwC;IACxC,MAAM,KAAK,GAAG,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,EACnC,CAAC,CAAC,eAAe;QACjB,CAAC,CAAC,sBAAsB,CAAC;IAC3B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAClC,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE;YAC3B,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,UAAsB,EACtB,cAAmC;IAEnC,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,oBAAoB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,cAAc,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -9,8 +9,22 @@ const getRequestingEntitiesQuery_1 = require("./getRequestingEntitiesQuery");
|
|
|
9
9
|
const getAssociationHierarchy_1 = require("./internal/getAssociationHierarchy");
|
|
10
10
|
const isAssociationSupported_1 = require("./internal/isAssociationSupported");
|
|
11
11
|
/**
|
|
12
|
-
* get
|
|
13
|
-
*
|
|
12
|
+
* get Entity A's association stats with Entity B:
|
|
13
|
+
*
|
|
14
|
+
* 1. associated: the number of Entity B's that Entity A
|
|
15
|
+
* is associated with
|
|
16
|
+
*
|
|
17
|
+
* 2. pending: the number of outgoing requests Entity A
|
|
18
|
+
* has sent to Entity B
|
|
19
|
+
*
|
|
20
|
+
* 3. requesting: the number of incoming requests Entity A
|
|
21
|
+
* has received from Entity B
|
|
22
|
+
*
|
|
23
|
+
* 4a. included: if Entity A is the parent, the number of
|
|
24
|
+
* Entity B's it has included in its association group
|
|
25
|
+
*
|
|
26
|
+
* 4b. referenced: if Entity A is the child, the number of
|
|
27
|
+
* Entity B's it has referenced (via typeKeyword)
|
|
14
28
|
*
|
|
15
29
|
* @param entity - Hub entity
|
|
16
30
|
* @param associationType - entity type to query for
|
|
@@ -33,10 +47,15 @@ exports.getAssociationStats = async (entity, associationType, context) => {
|
|
|
33
47
|
getPendingEntitiesQuery_1.getPendingEntitiesQuery(entity, associationType, context),
|
|
34
48
|
getRequestingEntitiesQuery_1.getRequestingEntitiesQuery(entity, associationType, context),
|
|
35
49
|
]);
|
|
36
|
-
const [{ total: associated }, { total: pending }, { total: requesting }] = await Promise.all(queries.map((query) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
const [{ total: associated }, { total: pending }, { total: requesting }] = await Promise.all(queries.map(async (query) => {
|
|
51
|
+
try {
|
|
52
|
+
return await hubSearch_1.hubSearch(query, {
|
|
53
|
+
requestOptions: context.hubRequestOptions,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return { total: 0 };
|
|
58
|
+
}
|
|
40
59
|
}));
|
|
41
60
|
stats = Object.assign({ associated,
|
|
42
61
|
pending,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAssociationStats.js","sourceRoot":"","sources":["../../../src/associations/getAssociationStats.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAG9D,mDAAgD;AAChD,6EAA0E;AAC1E,uEAAoE;AACpE,6EAA0E;AAC1E,gFAA6E;AAC7E,8EAA2E;AAG3E
|
|
1
|
+
{"version":3,"file":"getAssociationStats.js","sourceRoot":"","sources":["../../../src/associations/getAssociationStats.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAG9D,mDAAgD;AAChD,6EAA0E;AAC1E,uEA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CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;YAClC,IAAI;gBACF,OAAO,MAAM,qBAAS,CAAC,KAAK,EAAE;oBAC5B,cAAc,EAAE,OAAO,CAAC,iBAAiB;iBAC1C,CAAC,CAAC;aACJ;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;aACrB;QACH,CAAC,CAAC,CACH,CAAC;QAEJ,KAAK,mBACH,UAAU;YACV,OAAO;YACP,UAAU,IACP,CAAC,QAAQ;YACV,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,EAAE;YACpC,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,EAAE,CAAC,CAC1C,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReferencedEntityIds = void 0;
|
|
4
|
+
const getIdsFromKeywords_1 = require("./internal/getIdsFromKeywords");
|
|
5
|
+
/**
|
|
6
|
+
* The following util returns an array of ids that the provided
|
|
7
|
+
* entity "references" via a typeKeyword of the form ref|<associationType>|<id>
|
|
8
|
+
*
|
|
9
|
+
* Note: if a specific associationType is not provided, this util
|
|
10
|
+
* will return ALL the ids that the provided entity "references"
|
|
11
|
+
*
|
|
12
|
+
* Additional context: the model for associations is built around
|
|
13
|
+
* platform capabilities. Platform imposes a limit of 128 on the
|
|
14
|
+
* number of typeKeywords that can be set on an item. Since "child"
|
|
15
|
+
* entities form their half of an association connection via
|
|
16
|
+
* typeKeywords, we must limit the number of associations a child
|
|
17
|
+
* can request or accept to far fewer than 128. For now, we are
|
|
18
|
+
* imposing a limit of 50. From the application, we can then use
|
|
19
|
+
* this util to determine if a child has already reached the limit
|
|
20
|
+
*
|
|
21
|
+
* @param entity - hub entity to extract ids from
|
|
22
|
+
* @param associationType - entity type to extract reference ids for
|
|
23
|
+
* @returns {string[]}
|
|
24
|
+
*/
|
|
25
|
+
exports.getReferencedEntityIds = (entity, associationType) => {
|
|
26
|
+
return getIdsFromKeywords_1.getIdsFromKeywords(entity, associationType);
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=getReferencedEntityIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getReferencedEntityIds.js","sourceRoot":"","sources":["../../../src/associations/getReferencedEntityIds.ts"],"names":[],"mappings":";;;AACA,sEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,sBAAsB,GAAG,CACpC,MAAiB,EACjB,eAA+B,EACrB,EAAE;IACZ,OAAO,uCAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AACrD,CAAC,CAAC"}
|
|
@@ -11,7 +11,8 @@ tslib_1.__exportStar(require("./getAssociationStats"), exports);
|
|
|
11
11
|
tslib_1.__exportStar(require("./getAvailableToRequestEntitiesQuery"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./getPendingEntitiesQuery"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./getRequestingEntitiesQuery"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./
|
|
14
|
+
tslib_1.__exportStar(require("./getReferencedEntityIds"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./wellKnownAssociationCatalogs"), exports);
|
|
15
16
|
// Note: we expose "requestAssociation" under 2 names.
|
|
16
17
|
// These actions are functionally equivalent, but we want
|
|
17
18
|
// to make the intent more clear to the consumer.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/associations/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,6DAAmC;AACnC,6DAAmC;AACnC,8DAAoC;AACpC,kDAAwB;AACxB,uEAA6C;AAC7C,gEAAsC;AACtC,+EAAqD;AACrD,oEAA0C;AAC1C,uEAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/associations/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,6DAAmC;AACnC,6DAAmC;AACnC,8DAAoC;AACpC,kDAAwB;AACxB,uEAA6C;AAC7C,gEAAsC;AACtC,+EAAqD;AACrD,oEAA0C;AAC1C,uEAA6C;AAC7C,mEAAyC;AACzC,yEAA+C;AAC/C,sDAAsD;AACtD,yDAAyD;AACzD,iDAAiD;AACjD,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,2DAA+E;AAAtE,uHAAA,kBAAkB,OAAqB"}
|
|
@@ -15,7 +15,8 @@ const objects_1 = require("../../objects");
|
|
|
15
15
|
*/
|
|
16
16
|
exports.getIdsFromKeywords = (entity, associationType) => {
|
|
17
17
|
return objects_1.getProp(entity, "typeKeywords").reduce((ids, keyword) => {
|
|
18
|
-
|
|
18
|
+
const refKey = associationType ? `ref|${associationType}|` : "ref|";
|
|
19
|
+
if (keyword.startsWith(refKey)) {
|
|
19
20
|
const id = keyword.split("|")[2];
|
|
20
21
|
ids.push(id);
|
|
21
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIdsFromKeywords.js","sourceRoot":"","sources":["../../../../src/associations/internal/getIdsFromKeywords.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AAExC;;;;;;;;;;GAUG;AACU,QAAA,kBAAkB,GAAG,CAChC,MAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"getIdsFromKeywords.js","sourceRoot":"","sources":["../../../../src/associations/internal/getIdsFromKeywords.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AAExC;;;;;;;;;;GAUG;AACU,QAAA,kBAAkB,GAAG,CAChC,MAAiB,EACjB,eAA+B,EACrB,EAAE;IACZ,OAAO,iBAAO,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,MAAM,CAC3C,CAAC,GAAa,EAAE,OAAe,EAAE,EAAE;QACjC,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,OAAO,eAAe,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;QACpE,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC9B,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACd;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ASSOCIATION_REFERENCE_LIMIT = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The model for associations is built around platform
|
|
6
|
+
* capabilities. Platform imposes a limit of 128 on the
|
|
7
|
+
* number of typeKeywords that can be set on an item.
|
|
8
|
+
* Since "child" entities form their half of an association
|
|
9
|
+
* connection via typeKeywords, we must limit the number
|
|
10
|
+
* of associations a child can request or accept to far
|
|
11
|
+
* fewer than 128.
|
|
12
|
+
*
|
|
13
|
+
* For now, we are setting this limit to 50
|
|
14
|
+
*/
|
|
15
|
+
exports.ASSOCIATION_REFERENCE_LIMIT = 50;
|
|
3
16
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/associations/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/associations/types.ts"],"names":[],"mappings":";;;AA8EA;;;;;;;;;;GAUG;AACU,QAAA,2BAA2B,GAAG,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWellKnownAssociationsCatalog = void 0;
|
|
3
|
+
exports.getAvailableToRequestAssociationCatalogs = exports.getWellKnownAssociationsCatalog = void 0;
|
|
4
4
|
const core_1 = require("../core");
|
|
5
5
|
const buildCatalog_1 = require("../search/_internal/buildCatalog");
|
|
6
6
|
const getEntityTypeFromType_1 = require("../search/_internal/getEntityTypeFromType");
|
|
@@ -73,4 +73,43 @@ async function getWellKnownAssociationsCatalog(i18nScope, catalogName, entity, a
|
|
|
73
73
|
return catalog;
|
|
74
74
|
}
|
|
75
75
|
exports.getWellKnownAssociationsCatalog = getWellKnownAssociationsCatalog;
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Specific util for building well-known (My content, Favorites,
|
|
78
|
+
* Organization, and World) association catalogs to populate
|
|
79
|
+
* a gallery picker experience for requesting association.
|
|
80
|
+
*
|
|
81
|
+
* In addition to the normal filters that define these well-known
|
|
82
|
+
* catalogs, we also need to further filter the results to only
|
|
83
|
+
* include entities that can still be requested for association.
|
|
84
|
+
*
|
|
85
|
+
* @param i18nScope - translation scope to be interpolated into the catalog
|
|
86
|
+
* @param entity - primary entity the catalog is being built for
|
|
87
|
+
* @param associationType - type of entity the primary entity wants to view associations for
|
|
88
|
+
* @param context - contextual auth and portal information
|
|
89
|
+
* @returns {IHubCatalog[]}
|
|
90
|
+
*/
|
|
91
|
+
exports.getAvailableToRequestAssociationCatalogs = (i18nScope, entity, associationType, context) => {
|
|
92
|
+
var _a;
|
|
93
|
+
const entityType = core_1.getTypeFromEntity(entity);
|
|
94
|
+
const isSupported = isAssociationSupported_1.isAssociationSupported(entityType, associationType);
|
|
95
|
+
if (!isSupported) {
|
|
96
|
+
throw new Error(`getAvailableToRequestAssociationCatalogs: Association between ${entityType} and ${associationType} is not supported.`);
|
|
97
|
+
}
|
|
98
|
+
i18nScope = wellKnownCatalog_1.dotifyString(i18nScope);
|
|
99
|
+
const filters = (_a = getAvailableToRequestEntitiesQuery_1.getAvailableToRequestEntitiesQuery(entity, associationType)) === null || _a === void 0 ? void 0 : _a.filters;
|
|
100
|
+
const catalogNames = [
|
|
101
|
+
"myContent",
|
|
102
|
+
"favorites",
|
|
103
|
+
"organization",
|
|
104
|
+
"world",
|
|
105
|
+
];
|
|
106
|
+
return catalogNames.map((name) => {
|
|
107
|
+
const options = {
|
|
108
|
+
user: context.currentUser,
|
|
109
|
+
filters,
|
|
110
|
+
collectionNames: [associationType],
|
|
111
|
+
};
|
|
112
|
+
return wellKnownCatalog_1.getWellKnownCatalog(i18nScope, name, "item", options);
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=wellKnownAssociationCatalogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wellKnownAssociationCatalogs.js","sourceRoot":"","sources":["../../../src/associations/wellKnownAssociationCatalogs.ts"],"names":[],"mappings":";;;AACA,kCAA4C;AAE5C,mEAAgE;AAChE,qFAAkF;AAClF,6EAA0E;AAC1E,uEAAoE;AACpE,6FAA0F;AAC1F,6EAA0E;AAC1E,8EAA2E;AAE3E,iEAOoC;AAapC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,KAAK,UAAU,+BAA+B,CACnD,SAAiB,EACjB,WAAwC,EACxC,MAAiB,EACjB,eAA8B,EAC9B,OAAuB;IAEvB,IAAI,OAAoB,CAAC;IACzB,MAAM,UAAU,GAAG,wBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,+CAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,wDAAwD,UAAU,QAAQ,eAAe,oBAAoB,CAC9G,CAAC;KACH;IAED,SAAS,GAAG,+BAAY,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,6CAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAExD,kEAAkE;IAClE,MAAM,WAA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IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,iEAAiE,UAAU,QAAQ,eAAe,oBAAoB,CACvH,CAAC;KACH;IAED,SAAS,GAAG,+BAAY,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,OAAO,SAAG,uEAAkC,CAChD,MAAM,EACN,eAAe,CAChB,0CAAE,OAAO,CAAC;IACX,MAAM,YAAY,GAAuB;QACvC,WAAW;QACX,WAAW;QACX,cAAc;QACd,OAAO;KACR,CAAC;IACF,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,IAAsB,EAAE,EAAE;QACjD,MAAM,OAAO,GAAgC;YAC3C,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,OAAO;YACP,eAAe,EAAE,CAAC,eAAsC,CAAC;SAC1D,CAAC;QACF,OAAO,sCAAmB,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWellknownCollection = exports.getWellknownCollections = exports.getWellKnownCatalog = exports.dotifyString = void 0;
|
|
4
4
|
const get_family_1 = require("../content/get-family");
|
|
5
5
|
const buildCatalog_1 = require("./_internal/buildCatalog");
|
|
6
|
+
const objects_1 = require("../objects");
|
|
6
7
|
/**
|
|
7
8
|
* Check if i18nScope is defined and not ending with a ".", if so add a "." at the end.
|
|
8
9
|
* e.g. if the i18nScope is 'project.edit', the path is `${i18nScope}catalog.organization`,
|
|
@@ -53,22 +54,32 @@ function validateUserExistence(catalogName, options) {
|
|
|
53
54
|
function getWellknownItemCatalog(i18nScope, catalogName, options) {
|
|
54
55
|
i18nScope = dotifyString(i18nScope);
|
|
55
56
|
let catalog;
|
|
57
|
+
const additionalFilters = objects_1.getProp(options, "filters") || [];
|
|
56
58
|
const collections = getWellknownCollections(i18nScope, "item", options === null || options === void 0 ? void 0 : options.collectionNames);
|
|
57
59
|
switch (catalogName) {
|
|
58
60
|
case "myContent":
|
|
59
61
|
validateUserExistence(catalogName, options);
|
|
60
|
-
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
62
|
+
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
63
|
+
{ predicates: [{ owner: options.user.username }] },
|
|
64
|
+
...additionalFilters,
|
|
65
|
+
], collections, "item");
|
|
61
66
|
break;
|
|
62
67
|
case "favorites":
|
|
63
68
|
validateUserExistence(catalogName, options);
|
|
64
|
-
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
69
|
+
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
70
|
+
{ predicates: [{ group: options.user.favGroupId }] },
|
|
71
|
+
...additionalFilters,
|
|
72
|
+
], collections, "item");
|
|
65
73
|
break;
|
|
66
74
|
case "organization":
|
|
67
75
|
validateUserExistence(catalogName, options);
|
|
68
|
-
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [{ predicates: [{ orgid: options.user.orgId }] }], collections, "item");
|
|
76
|
+
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [{ predicates: [{ orgid: options.user.orgId }] }, ...additionalFilters], collections, "item");
|
|
69
77
|
break;
|
|
70
78
|
case "world":
|
|
71
|
-
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
79
|
+
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
80
|
+
{ predicates: [{ type: { not: ["code attachment"] } }] },
|
|
81
|
+
...additionalFilters,
|
|
82
|
+
], collections, "item");
|
|
72
83
|
break;
|
|
73
84
|
}
|
|
74
85
|
return catalog;
|
|
@@ -83,6 +94,7 @@ function getWellknownItemCatalog(i18nScope, catalogName, options) {
|
|
|
83
94
|
function getWellknownGroupCatalog(i18nScope, catalogName, options) {
|
|
84
95
|
i18nScope = dotifyString(i18nScope);
|
|
85
96
|
let catalog;
|
|
97
|
+
const additionalFilters = objects_1.getProp(options, "filters") || [];
|
|
86
98
|
// because collections are needed in arcgis-hub-catalog and
|
|
87
99
|
// "searchGroups" allows 'q: "*"', we use this as the collection
|
|
88
100
|
const collections = [
|
|
@@ -103,15 +115,21 @@ function getWellknownGroupCatalog(i18nScope, catalogName, options) {
|
|
|
103
115
|
switch (catalogName) {
|
|
104
116
|
case "editGroups":
|
|
105
117
|
validateUserExistence(catalogName, options);
|
|
106
|
-
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
118
|
+
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
119
|
+
{ predicates: [{ capabilities: ["updateitemcontrol"] }] },
|
|
120
|
+
...additionalFilters,
|
|
121
|
+
], collections, "group");
|
|
107
122
|
break;
|
|
108
123
|
case "viewGroups":
|
|
109
124
|
validateUserExistence(catalogName, options);
|
|
110
|
-
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
125
|
+
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [
|
|
126
|
+
{ predicates: [{ capabilities: { not: ["updateitemcontrol"] } }] },
|
|
127
|
+
...additionalFilters,
|
|
128
|
+
], collections, "group");
|
|
111
129
|
break;
|
|
112
130
|
case "allGroups":
|
|
113
131
|
validateUserExistence(catalogName, options);
|
|
114
|
-
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [{ predicates: [{ capabilities: [""] }] }], collections, "group");
|
|
132
|
+
catalog = buildCatalog_1.buildCatalog(i18nScope, catalogName, [{ predicates: [{ capabilities: [""] }] }, ...additionalFilters], collections, "group");
|
|
115
133
|
break;
|
|
116
134
|
}
|
|
117
135
|
return catalog;
|
|
@@ -241,6 +259,8 @@ function getAllCollectionsMap(i18nScope, entityType) {
|
|
|
241
259
|
predicates: [
|
|
242
260
|
{
|
|
243
261
|
type: get_family_1.getFamilyTypes("initiative"),
|
|
262
|
+
// only include v2 initiatives
|
|
263
|
+
typekeywords: ["hubInitiativeV2"],
|
|
244
264
|
},
|
|
245
265
|
],
|
|
246
266
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wellKnownCatalog.js","sourceRoot":"","sources":["../../../src/search/wellKnownCatalog.ts"],"names":[],"mappings":";;;AACA,sDAAuD;AAGvD,2DAAwD;
|
|
1
|
+
{"version":3,"file":"wellKnownCatalog.js","sourceRoot":"","sources":["../../../src/search/wellKnownCatalog.ts"],"names":[],"mappings":";;;AACA,sDAAuD;AAGvD,2DAAwD;AACxD,wCAAqC;AAsCrC;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,SAAiB;IAC5C,OAAO,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC;AAFD,oCAEC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,SAAiB,EACjB,WAA6B,EAC7B,UAAsB,EACtB,OAAqC;IAErC,QAAQ,UAAU,EAAE;QAClB,KAAK,MAAM;YACT,OAAO,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAClE,KAAK,OAAO;YACV,OAAO,wBAAwB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACnE,mEAAmE;QACnE;YACE,MAAM,IAAI,KAAK,CAAC,0CAA0C,UAAU,GAAG,CAAC,CAAC;KAC5E;AACH,CAAC;AAfD,kDAeC;AAED;;;;GAIG;AACH,SAAS,qBAAqB,CAC5B,WAA6B,EAC7B,OAAoC;IAEpC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,uBAAuB,WAAW,WAAW,CAAC,CAAC;KAChE;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,uBAAuB,CAC9B,SAAiB,EACjB,WAA6B,EAC7B,OAAqC;IAEr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I,iBAAiB,CAAC,IAAI,CAAC,EAAE;YAC3B,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAtBD,0DAsBC;AAED;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,SAAiB,EACjB,UAAsB,EACtB,cAAmC;IAEnC,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,oBAAoB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,cAAc,CAAC,CAAC;AACrE,CAAC;AAPD,wDAOC"}
|
|
@@ -2,8 +2,22 @@ import { IArcGISContext } from "../ArcGISContext";
|
|
|
2
2
|
import { HubEntity, HubEntityType } from "../core/types";
|
|
3
3
|
import { IAssociationStats } from "./types";
|
|
4
4
|
/**
|
|
5
|
-
* get
|
|
6
|
-
*
|
|
5
|
+
* get Entity A's association stats with Entity B:
|
|
6
|
+
*
|
|
7
|
+
* 1. associated: the number of Entity B's that Entity A
|
|
8
|
+
* is associated with
|
|
9
|
+
*
|
|
10
|
+
* 2. pending: the number of outgoing requests Entity A
|
|
11
|
+
* has sent to Entity B
|
|
12
|
+
*
|
|
13
|
+
* 3. requesting: the number of incoming requests Entity A
|
|
14
|
+
* has received from Entity B
|
|
15
|
+
*
|
|
16
|
+
* 4a. included: if Entity A is the parent, the number of
|
|
17
|
+
* Entity B's it has included in its association group
|
|
18
|
+
*
|
|
19
|
+
* 4b. referenced: if Entity A is the child, the number of
|
|
20
|
+
* Entity B's it has referenced (via typeKeyword)
|
|
7
21
|
*
|
|
8
22
|
* @param entity - Hub entity
|
|
9
23
|
* @param associationType - entity type to query for
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HubEntity, HubEntityType } from "../core/types";
|
|
2
|
+
/**
|
|
3
|
+
* The following util returns an array of ids that the provided
|
|
4
|
+
* entity "references" via a typeKeyword of the form ref|<associationType>|<id>
|
|
5
|
+
*
|
|
6
|
+
* Note: if a specific associationType is not provided, this util
|
|
7
|
+
* will return ALL the ids that the provided entity "references"
|
|
8
|
+
*
|
|
9
|
+
* Additional context: the model for associations is built around
|
|
10
|
+
* platform capabilities. Platform imposes a limit of 128 on the
|
|
11
|
+
* number of typeKeywords that can be set on an item. Since "child"
|
|
12
|
+
* entities form their half of an association connection via
|
|
13
|
+
* typeKeywords, we must limit the number of associations a child
|
|
14
|
+
* can request or accept to far fewer than 128. For now, we are
|
|
15
|
+
* imposing a limit of 50. From the application, we can then use
|
|
16
|
+
* this util to determine if a child has already reached the limit
|
|
17
|
+
*
|
|
18
|
+
* @param entity - hub entity to extract ids from
|
|
19
|
+
* @param associationType - entity type to extract reference ids for
|
|
20
|
+
* @returns {string[]}
|
|
21
|
+
*/
|
|
22
|
+
export declare const getReferencedEntityIds: (entity: HubEntity, associationType?: HubEntityType) => string[];
|
|
@@ -8,6 +8,7 @@ export * from "./getAssociationStats";
|
|
|
8
8
|
export * from "./getAvailableToRequestEntitiesQuery";
|
|
9
9
|
export * from "./getPendingEntitiesQuery";
|
|
10
10
|
export * from "./getRequestingEntitiesQuery";
|
|
11
|
-
export * from "./
|
|
11
|
+
export * from "./getReferencedEntityIds";
|
|
12
|
+
export * from "./wellKnownAssociationCatalogs";
|
|
12
13
|
export { requestAssociation } from "./requestAssociation";
|
|
13
14
|
export { requestAssociation as acceptAssociation } from "./requestAssociation";
|
|
@@ -10,4 +10,4 @@ import { HubEntity, HubEntityType } from "../../core";
|
|
|
10
10
|
* @param associationType - entity type to extract ids for
|
|
11
11
|
* @returns {string[]}
|
|
12
12
|
*/
|
|
13
|
-
export declare const getIdsFromKeywords: (entity: HubEntity, associationType
|
|
13
|
+
export declare const getIdsFromKeywords: (entity: HubEntity, associationType?: HubEntityType) => string[];
|
|
@@ -70,3 +70,15 @@ export interface IAssociationInfo {
|
|
|
70
70
|
* Association type
|
|
71
71
|
*/
|
|
72
72
|
export declare type AssociationType = "initiative";
|
|
73
|
+
/**
|
|
74
|
+
* The model for associations is built around platform
|
|
75
|
+
* capabilities. Platform imposes a limit of 128 on the
|
|
76
|
+
* number of typeKeywords that can be set on an item.
|
|
77
|
+
* Since "child" entities form their half of an association
|
|
78
|
+
* connection via typeKeywords, we must limit the number
|
|
79
|
+
* of associations a child can request or accept to far
|
|
80
|
+
* fewer than 128.
|
|
81
|
+
*
|
|
82
|
+
* For now, we are setting this limit to 50
|
|
83
|
+
*/
|
|
84
|
+
export declare const ASSOCIATION_REFERENCE_LIMIT = 50;
|
|
@@ -32,3 +32,19 @@ export declare type WellKnownAssociationCatalog = "associated" | "pending" | "re
|
|
|
32
32
|
* @returns {IHubCatalog}
|
|
33
33
|
*/
|
|
34
34
|
export declare function getWellKnownAssociationsCatalog(i18nScope: string, catalogName: WellKnownAssociationCatalog, entity: HubEntity, associationType: HubEntityType, context: IArcGISContext): Promise<IHubCatalog>;
|
|
35
|
+
/**
|
|
36
|
+
* Specific util for building well-known (My content, Favorites,
|
|
37
|
+
* Organization, and World) association catalogs to populate
|
|
38
|
+
* a gallery picker experience for requesting association.
|
|
39
|
+
*
|
|
40
|
+
* In addition to the normal filters that define these well-known
|
|
41
|
+
* catalogs, we also need to further filter the results to only
|
|
42
|
+
* include entities that can still be requested for association.
|
|
43
|
+
*
|
|
44
|
+
* @param i18nScope - translation scope to be interpolated into the catalog
|
|
45
|
+
* @param entity - primary entity the catalog is being built for
|
|
46
|
+
* @param associationType - type of entity the primary entity wants to view associations for
|
|
47
|
+
* @param context - contextual auth and portal information
|
|
48
|
+
* @returns {IHubCatalog[]}
|
|
49
|
+
*/
|
|
50
|
+
export declare const getAvailableToRequestAssociationCatalogs: (i18nScope: string, entity: HubEntity, associationType: HubEntityType, context: IArcGISContext) => IHubCatalog[];
|
|
@@ -51,6 +51,8 @@ export interface ICardActionLink {
|
|
|
51
51
|
showLabel?: boolean;
|
|
52
52
|
icon?: string;
|
|
53
53
|
buttonStyle?: "outline" | "outline-fill" | "solid" | "transparent";
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
tooltip?: string;
|
|
54
56
|
}
|
|
55
57
|
export declare type CardModelTarget = "self" | "siteRelative" | "workspaceRelative" | "none" | "event";
|
|
56
58
|
export declare type EntityToCardModelFn<T> = (entity: T, context: IArcGISContext, opts?: IConvertToCardModelOpts) => IHubCardViewModel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IUser } from "@esri/arcgis-rest-types";
|
|
2
2
|
import { HubFamily } from "../types";
|
|
3
|
-
import { EntityType, IHubCatalog, IHubCollection } from "./types";
|
|
3
|
+
import { EntityType, IFilter, IHubCatalog, IHubCollection } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* This is used to determine what IHubCatalog definition JSON object
|
|
6
6
|
* can be created
|
|
@@ -21,6 +21,8 @@ export declare type WellKnownCollection = Exclude<HubFamily, "app" | "map"> | "a
|
|
|
21
21
|
export interface IGetWellKnownCatalogOptions {
|
|
22
22
|
user?: IUser;
|
|
23
23
|
collectionNames?: WellKnownCollection[];
|
|
24
|
+
/** additional filters to apply to the catalog scope */
|
|
25
|
+
filters?: IFilter[];
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Check if i18nScope is defined and not ending with a ".", if so add a "." at the end.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getWellKnownAssociationsCatalog.js","sourceRoot":"","sources":["../../../src/associations/getWellKnownAssociationsCatalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kCAAk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oB;YACvB,KAAK,GAAG,kCAAkC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACpE,MAAM;KACT;IAED,sCAAsC;IACtC,gEAAgE;IAChE,2DAA2D;IAC3D,qCAAqC;IACrC,MAAM,OAAO,GAAG,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EAC5B,CAAC,CAAC,KAAK,CAAC,OAAO;QACf,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtD,OAAO,GAAG,YAAY,CACpB,SAAS,EACT,WAAW,EACX,OAAO,EACP,WAAW,EACX,YAAY,CACb,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getWellKnownAssociationsCatalog.js","sourceRoot":"","sources":["../../../src/associations/getWellKnownAssociationsCatalog.ts"],"names":[],"mappings":";;;AACA,kCAA4C;AAE5C,mEAAgE;AAChE,qFAAkF;AAClF,6EAA0E;AAC1E,uEAAoE;AACpE,6FAA0F;AAC1F,6EAA0E;AAC1E,8EAA2E;AAE3E,iEAIoC;AAapC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,KAAK,UAAU,+BAA+B,CACnD,SAAiB,EACjB,WAAwC,EACxC,MAAiB,EACjB,eAA8B,EAC9B,OAAuB;IAEvB,IAAI,OAAoB,CAAC;IACzB,MAAM,UAAU,GAAG,wBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,+CAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,wDAAwD,UAAU,QAAQ,eAAe,oBAAoB,CAC9G,CAAC;KACH;IAED,SAAS,GAAG,+BAAY,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,YAAY,GA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