@esri/hub-common 24.3.0 → 24.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 (50) hide show
  1. package/dist/esm/core/matchIdentifier.js +54 -0
  2. package/dist/esm/core/matchIdentifier.js.map +1 -0
  3. package/dist/esm/core/matchTypes.js +2 -0
  4. package/dist/esm/core/matchTypes.js.map +1 -0
  5. package/dist/esm/core/matchUtils/getItemTypeFromMatchableType.js +25 -0
  6. package/dist/esm/core/matchUtils/getItemTypeFromMatchableType.js.map +1 -0
  7. package/dist/esm/core/matchUtils/matchById.js +52 -0
  8. package/dist/esm/core/matchUtils/matchById.js.map +1 -0
  9. package/dist/esm/core/matchUtils/matchByKeywordSearch.js +49 -0
  10. package/dist/esm/core/matchUtils/matchByKeywordSearch.js.map +1 -0
  11. package/dist/esm/core/matchUtils/matchBySlug.js +23 -0
  12. package/dist/esm/core/matchUtils/matchBySlug.js.map +1 -0
  13. package/dist/esm/core/matchUtils/matchByTitleSearch.js +51 -0
  14. package/dist/esm/core/matchUtils/matchByTitleSearch.js.map +1 -0
  15. package/dist/esm/core/matchesInCatalog.js +30 -0
  16. package/dist/esm/core/matchesInCatalog.js.map +1 -0
  17. package/dist/esm/index.js +3 -0
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/permissions/checkPermission.js +1 -1
  20. package/dist/esm/permissions/checkPermission.js.map +1 -1
  21. package/dist/node/core/matchIdentifier.js +57 -0
  22. package/dist/node/core/matchIdentifier.js.map +1 -0
  23. package/dist/node/core/matchTypes.js +3 -0
  24. package/dist/node/core/matchTypes.js.map +1 -0
  25. package/dist/node/core/matchUtils/getItemTypeFromMatchableType.js +28 -0
  26. package/dist/node/core/matchUtils/getItemTypeFromMatchableType.js.map +1 -0
  27. package/dist/node/core/matchUtils/matchById.js +55 -0
  28. package/dist/node/core/matchUtils/matchById.js.map +1 -0
  29. package/dist/node/core/matchUtils/matchByKeywordSearch.js +52 -0
  30. package/dist/node/core/matchUtils/matchByKeywordSearch.js.map +1 -0
  31. package/dist/node/core/matchUtils/matchBySlug.js +26 -0
  32. package/dist/node/core/matchUtils/matchBySlug.js.map +1 -0
  33. package/dist/node/core/matchUtils/matchByTitleSearch.js +54 -0
  34. package/dist/node/core/matchUtils/matchByTitleSearch.js.map +1 -0
  35. package/dist/node/core/matchesInCatalog.js +33 -0
  36. package/dist/node/core/matchesInCatalog.js.map +1 -0
  37. package/dist/node/index.js +20 -13
  38. package/dist/node/index.js.map +1 -1
  39. package/dist/node/permissions/checkPermission.js +1 -1
  40. package/dist/node/permissions/checkPermission.js.map +1 -1
  41. package/dist/types/core/matchIdentifier.d.ts +15 -0
  42. package/dist/types/core/matchTypes.d.ts +24 -0
  43. package/dist/types/core/matchUtils/getItemTypeFromMatchableType.d.ts +9 -0
  44. package/dist/types/core/matchUtils/matchById.d.ts +11 -0
  45. package/dist/types/core/matchUtils/matchByKeywordSearch.d.ts +3 -0
  46. package/dist/types/core/matchUtils/matchBySlug.d.ts +13 -0
  47. package/dist/types/core/matchUtils/matchByTitleSearch.d.ts +11 -0
  48. package/dist/types/core/matchesInCatalog.d.ts +14 -0
  49. package/dist/types/index.d.ts +4 -0
  50. package/package.json +2 -1
@@ -0,0 +1,13 @@
1
+ import { IArcGISContext } from "../../types/IArcGISContext";
2
+ import { MatchableType, IIdentifierMatches } from "../matchTypes";
3
+ /**
4
+ * Match by slug
5
+ * Handles these two cases via delegation:
6
+ * - org-short::custom-slug, via search: typekeyword: "slug|{identifier}" and type: {type}
7
+ * - indexer-slug-via-title, via search: title: "%identifier.replace('-', ' ')%" and type: {type}
8
+ * @param type
9
+ * @param identifier
10
+ * @param context
11
+ * @returns
12
+ */
13
+ export declare function matchBySlug(type: MatchableType, identifier: string, context: IArcGISContext): Promise<IIdentifierMatches>;
@@ -0,0 +1,11 @@
1
+ import { IArcGISContext } from "../../types/IArcGISContext";
2
+ import { MatchableType, IIdentifierMatches } from "../matchTypes";
3
+ /**
4
+ * Match by a title search
5
+ * Handles searching by title: "%identifier.replace('-', ' ')%" and type: {type}
6
+ * @param type
7
+ * @param identifier
8
+ * @param context
9
+ * @returns
10
+ */
11
+ export declare function matchByTitleSearch(type: MatchableType, identifier: string, context: IArcGISContext): Promise<IIdentifierMatches>;
@@ -0,0 +1,14 @@
1
+ import { IHubCatalog } from "../search/types/IHubCatalog";
2
+ import { IArcGISContext } from "../types/IArcGISContext";
3
+ import { MatchableType, IMatch } from "./matchTypes";
4
+ /**
5
+ * Check which of the given matches are contained in the specified catalog.
6
+ * Decorates each match with inCatalog: true|false, which the disambiguation
7
+ * UX can then use to determine how to present the matches.
8
+ * @param type
9
+ * @param matches
10
+ * @param catalog
11
+ * @param context
12
+ * @param path
13
+ */
14
+ export declare function matchesInCatalog(type: MatchableType, matches: IMatch[], catalog: IHubCatalog, context: IArcGISContext, path?: string): Promise<IMatch[]>;
@@ -70,6 +70,9 @@ export { getHubTypeFromItemType } from "./core/getHubTypeFromItemType";
70
70
  export { getRelativeWorkspaceUrl } from "./core/getRelativeWorkspaceUrl";
71
71
  export { getTypeFromEntity } from "./core/getTypeFromEntity";
72
72
  export { getTypesFromEntityType } from "./core/getTypesFromEntityType";
73
+ export { matchIdentifier } from "./core/matchIdentifier";
74
+ export { MatchableType, IIdentifierMatches, IMatch } from "./core/matchTypes";
75
+ export { matchesInCatalog } from "./core/matchesInCatalog";
73
76
  export { addHistoryEntry, IHubHistory, IHubHistoryEntry, removeHistoryEntry, } from "./core/hubHistory";
74
77
  export { isValidEntityType } from "./core/isValidEntityType";
75
78
  export { getHubEntityTypeFromPath, getPathForHubEntityType, IParsedPath, parseContainmentPath, pathMap, } from "./core/parseContainmentPath";
@@ -315,6 +318,7 @@ export { setProp } from "./objects/set-prop";
315
318
  export { fetchOrganization, portalToOrganization, portalToSearchResult, } from "./org/fetch";
316
319
  export { fetchOrg } from "./org/fetch-org";
317
320
  export { fetchMaxNumUserGroupsLimit, fetchOrgLimits, IOrgLimit, OrgLimitType, } from "./org/fetchOrgLimits";
321
+ export { HUB_PAGE_ITEM_TYPE, ENTERPRISE_PAGE_ITEM_TYPE, } from "./pages/defaults";
318
322
  export { HubPage } from "./pages/HubPage";
319
323
  export { convertItemToPage, convertModelToPage, createPage, deletePage, enrichPageSearchResult, fetchPage, updatePage, } from "./pages/HubPages";
320
324
  export { checkPermission, EntityOrOptions, } from "./permissions/checkPermission";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "24.3.0",
3
+ "version": "24.4.0",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -68,6 +68,7 @@
68
68
  "test": "vitest --config=vitest.config.mjs --reporter=dot --run",
69
69
  "test:coverage": "vitest --config=vitest.config.mjs --coverage --run",
70
70
  "test:watch": "vitest --config=vitest.config.mjs --reporter=verbose",
71
+ "test:harness": "vitest --config=vitest.config.mjs --reporter=verbose --dir ./harnesses",
71
72
  "y:publish": "yalc publish",
72
73
  "y:push": "yalc push"
73
74
  },