@esri/hub-common 12.38.0 → 12.38.1

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.
@@ -7,12 +7,21 @@ import { unshareItemWithGroup, } from "@esri/arcgis-rest-portal";
7
7
  * @param {IRequestOptions} requestOptions
8
8
  */
9
9
  export function unshareItemFromGroups(itemId, groups, requestOptions, owner) {
10
- return Promise.all(groups.map((groupId) => {
10
+ return Promise.all(groups.map(async (groupId) => {
11
11
  const opt = Object.assign({}, { id: itemId, groupId }, requestOptions);
12
12
  if (owner) {
13
13
  opt.owner = owner;
14
14
  }
15
- return unshareItemWithGroup(opt);
15
+ // Because we are using Promise.all, we need to
16
+ // mark the callback fn as async and wrap each
17
+ // individual call in another try/catch block to
18
+ // make sure it catches before all promises finish
19
+ try {
20
+ return await unshareItemWithGroup(opt);
21
+ }
22
+ catch (err) {
23
+ throw Error(`Error unsharing item: ${itemId} with group: ${groupId}`);
24
+ }
16
25
  }));
17
26
  }
18
27
  //# sourceMappingURL=unshare-item-from-groups.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unshare-item-from-groups.js","sourceRoot":"","sources":["../../../src/items/unshare-item-from-groups.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AAGlC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAc,EACd,MAAgB,EAChB,cAA+B,EAC/B,KAAc;IAEd,OAAO,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACrB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CACvB,EAAE,EACF,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EACvB,cAAc,CACS,CAAC;QAC1B,IAAI,KAAK,EAAE;YACT,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;SACnB;QACD,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"unshare-item-from-groups.js","sourceRoot":"","sources":["../../../src/items/unshare-item-from-groups.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AAGlC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAc,EACd,MAAgB,EAChB,cAA+B,EAC/B,KAAc;IAEd,OAAO,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CACvB,EAAE,EACF,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EACvB,cAAc,CACS,CAAC;QAC1B,IAAI,KAAK,EAAE;YACT,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;SACnB;QACD,+CAA+C;QAC/C,8CAA8C;QAC9C,gDAAgD;QAChD,kDAAkD;QAClD,IAAI;YACF,OAAO,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;SACxC;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,KAAK,CAAC,yBAAyB,MAAM,gBAAgB,OAAO,EAAE,CAAC,CAAC;SACvE;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -10,12 +10,21 @@ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
10
10
  * @param {IRequestOptions} requestOptions
11
11
  */
12
12
  function unshareItemFromGroups(itemId, groups, requestOptions, owner) {
13
- return Promise.all(groups.map((groupId) => {
13
+ return Promise.all(groups.map(async (groupId) => {
14
14
  const opt = Object.assign({}, { id: itemId, groupId }, requestOptions);
15
15
  if (owner) {
16
16
  opt.owner = owner;
17
17
  }
18
- return arcgis_rest_portal_1.unshareItemWithGroup(opt);
18
+ // Because we are using Promise.all, we need to
19
+ // mark the callback fn as async and wrap each
20
+ // individual call in another try/catch block to
21
+ // make sure it catches before all promises finish
22
+ try {
23
+ return await arcgis_rest_portal_1.unshareItemWithGroup(opt);
24
+ }
25
+ catch (err) {
26
+ throw Error(`Error unsharing item: ${itemId} with group: ${groupId}`);
27
+ }
19
28
  }));
20
29
  }
21
30
  exports.unshareItemFromGroups = unshareItemFromGroups;
@@ -1 +1 @@
1
- {"version":3,"file":"unshare-item-from-groups.js","sourceRoot":"","sources":["../../../src/items/unshare-item-from-groups.ts"],"names":[],"mappings":";;;AAAA,iEAIkC;AAGlC;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,MAAc,EACd,MAAgB,EAChB,cAA+B,EAC/B,KAAc;IAEd,OAAO,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACrB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CACvB,EAAE,EACF,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EACvB,cAAc,CACS,CAAC;QAC1B,IAAI,KAAK,EAAE;YACT,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;SACnB;QACD,OAAO,yCAAoB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAnBD,sDAmBC"}
1
+ {"version":3,"file":"unshare-item-from-groups.js","sourceRoot":"","sources":["../../../src/items/unshare-item-from-groups.ts"],"names":[],"mappings":";;;AAAA,iEAIkC;AAGlC;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,MAAc,EACd,MAAgB,EAChB,cAA+B,EAC/B,KAAc;IAEd,OAAO,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CACvB,EAAE,EACF,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EACvB,cAAc,CACS,CAAC;QAC1B,IAAI,KAAK,EAAE;YACT,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;SACnB;QACD,+CAA+C;QAC/C,8CAA8C;QAC9C,gDAAgD;QAChD,kDAAkD;QAClD,IAAI;YACF,OAAO,MAAM,yCAAoB,CAAC,GAAG,CAAC,CAAC;SACxC;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,KAAK,CAAC,yBAAyB,MAAM,gBAAgB,OAAO,EAAE,CAAC,CAAC;SACvE;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AA3BD,sDA2BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "12.38.0",
3
+ "version": "12.38.1",
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",