@esri/hub-common 20.0.1 → 20.1.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.
@@ -8,4 +8,5 @@ export * from "./utils";
8
8
  export * from "./wellKnownCatalog";
9
9
  export * from "./searchAssociatedContent";
10
10
  export * from "./combineQueries";
11
+ export * from "./serializeCatalogScopeQuery";
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { upgradeCatalogSchema } from "./upgradeCatalogSchema";
2
+ import { expandPortalQuery } from "./utils";
3
+ import { serializeQueryForPortal } from "./serializeQueryForPortal";
4
+ /**
5
+ * Serialize the catalog scope into search options.
6
+ * This is explicitly exported for other ArcGIS platform
7
+ * applications that need to work with Hub Catalogs.
8
+ * @param catalog The catalog to serialize
9
+ * @param scope The scope to serialize
10
+ * @returns The serialized search options
11
+ */
12
+ export function serializeCatalogScope(catalog, scope) {
13
+ // apply any catalog schema migrations
14
+ const upgraded = upgradeCatalogSchema(catalog);
15
+ // get the scope
16
+ const scopeQuery = upgraded.scopes[scope];
17
+ if (!scopeQuery) {
18
+ throw new Error(`No query found for scope: ${scope}`);
19
+ }
20
+ // apply any expansions
21
+ const updatedQuery = expandPortalQuery(scopeQuery);
22
+ // Serialize into a structure compatible with the portal search
23
+ return serializeQueryForPortal(updatedQuery);
24
+ }
25
+ //# sourceMappingURL=serializeCatalogScopeQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializeCatalogScopeQuery.js","sourceRoot":"","sources":["../../../src/search/serializeCatalogScopeQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAoB,EACpB,KAAiB;IAEjB,sCAAsC;IACtC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC/C,gBAAgB;IAChB,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;KACvD;IACD,uBAAuB;IACvB,MAAM,YAAY,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACnD,+DAA+D;IAC/D,OAAO,uBAAuB,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC"}
@@ -11,4 +11,5 @@ tslib_1.__exportStar(require("./utils"), exports);
11
11
  tslib_1.__exportStar(require("./wellKnownCatalog"), exports);
12
12
  tslib_1.__exportStar(require("./searchAssociatedContent"), exports);
13
13
  tslib_1.__exportStar(require("./combineQueries"), exports);
14
+ tslib_1.__exportStar(require("./serializeCatalogScopeQuery"), exports);
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,uDAA6B;AAC7B,sDAA4B;AAC5B,oEAA0C;AAC1C,kDAAwB;AACxB,iEAAuC;AACvC,kDAAwB;AACxB,6DAAmC;AACnC,oEAA0C;AAC1C,2DAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,uDAA6B;AAC7B,sDAA4B;AAC5B,oEAA0C;AAC1C,kDAAwB;AACxB,iEAAuC;AACvC,kDAAwB;AACxB,6DAAmC;AACnC,oEAA0C;AAC1C,2DAAiC;AACjC,uEAA6C"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeCatalogScope = void 0;
4
+ const upgradeCatalogSchema_1 = require("./upgradeCatalogSchema");
5
+ const utils_1 = require("./utils");
6
+ const serializeQueryForPortal_1 = require("./serializeQueryForPortal");
7
+ /**
8
+ * Serialize the catalog scope into search options.
9
+ * This is explicitly exported for other ArcGIS platform
10
+ * applications that need to work with Hub Catalogs.
11
+ * @param catalog The catalog to serialize
12
+ * @param scope The scope to serialize
13
+ * @returns The serialized search options
14
+ */
15
+ function serializeCatalogScope(catalog, scope) {
16
+ // apply any catalog schema migrations
17
+ const upgraded = upgradeCatalogSchema_1.upgradeCatalogSchema(catalog);
18
+ // get the scope
19
+ const scopeQuery = upgraded.scopes[scope];
20
+ if (!scopeQuery) {
21
+ throw new Error(`No query found for scope: ${scope}`);
22
+ }
23
+ // apply any expansions
24
+ const updatedQuery = utils_1.expandPortalQuery(scopeQuery);
25
+ // Serialize into a structure compatible with the portal search
26
+ return serializeQueryForPortal_1.serializeQueryForPortal(updatedQuery);
27
+ }
28
+ exports.serializeCatalogScope = serializeCatalogScope;
29
+ //# sourceMappingURL=serializeCatalogScopeQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializeCatalogScopeQuery.js","sourceRoot":"","sources":["../../../src/search/serializeCatalogScopeQuery.ts"],"names":[],"mappings":";;;AAEA,iEAA8D;AAC9D,mCAA4C;AAC5C,uEAAoE;AAEpE;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,OAAoB,EACpB,KAAiB;IAEjB,sCAAsC;IACtC,MAAM,QAAQ,GAAG,2CAAoB,CAAC,OAAO,CAAC,CAAC;IAC/C,gBAAgB;IAChB,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;KACvD;IACD,uBAAuB;IACvB,MAAM,YAAY,GAAG,yBAAiB,CAAC,UAAU,CAAC,CAAC;IACnD,+DAA+D;IAC/D,OAAO,iDAAuB,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC;AAfD,sDAeC"}
@@ -8,3 +8,4 @@ export * from "./utils";
8
8
  export * from "./wellKnownCatalog";
9
9
  export * from "./searchAssociatedContent";
10
10
  export * from "./combineQueries";
11
+ export * from "./serializeCatalogScopeQuery";
@@ -0,0 +1,11 @@
1
+ import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
+ import { EntityType, IHubCatalog } from "./types/IHubCatalog";
3
+ /**
4
+ * Serialize the catalog scope into search options.
5
+ * This is explicitly exported for other ArcGIS platform
6
+ * applications that need to work with Hub Catalogs.
7
+ * @param catalog The catalog to serialize
8
+ * @param scope The scope to serialize
9
+ * @returns The serialized search options
10
+ */
11
+ export declare function serializeCatalogScope(catalog: IHubCatalog, scope: EntityType): ISearchOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "20.0.1",
3
+ "version": "20.1.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",