@esri/hub-common 9.35.0 → 9.36.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/es2017/items/create-item-from-url-or-file.js +16 -4
- package/dist/es2017/items/create-item-from-url-or-file.js.map +1 -1
- package/dist/esm/items/create-item-from-url-or-file.js +15 -5
- package/dist/esm/items/create-item-from-url-or-file.js.map +1 -1
- package/dist/node/items/create-item-from-url-or-file.js +16 -4
- package/dist/node/items/create-item-from-url-or-file.js.map +1 -1
- package/dist/types/items/create-item-from-url-or-file.d.ts +13 -3
- package/dist/umd/common.umd.js +16 -6
- package/dist/umd/common.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,13 +11,20 @@ import { _waitForItemReady } from "./_internal/_wait-for-item-ready";
|
|
|
11
11
|
*
|
|
12
12
|
* @export
|
|
13
13
|
* @param {ICreateItemFromUrlOrFileOptions} createItemFromUrlOrFileOptions Input params (item, groups?, requestoptions)
|
|
14
|
-
* @return {*} {
|
|
14
|
+
* @return {*} {
|
|
15
|
+
* title: string,
|
|
16
|
+
* createdItem: ICreateItemResponse,
|
|
17
|
+
* itemAccessResponse: ISharingResponse,
|
|
18
|
+
* itemSharingResponse: ISharingResponse[]
|
|
19
|
+
* } Responses from createdItem, changing item access, and item Sharing to group
|
|
15
20
|
*/
|
|
16
21
|
export async function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
17
22
|
const { item, groups } = createItemFromUrlOrFileOptions, userRequestOptions = __rest(createItemFromUrlOrFileOptions, ["item", "groups"]);
|
|
18
23
|
// Is there a file or data url?
|
|
19
24
|
const shouldWaitForItemReady = item.dataUrl || item.file;
|
|
20
25
|
let createdItem;
|
|
26
|
+
let itemAccessResponse;
|
|
27
|
+
let itemSharingResponse;
|
|
21
28
|
// If there is a file then we create the item and chunk the file
|
|
22
29
|
// while multithread uploading it
|
|
23
30
|
if (item.file) {
|
|
@@ -34,13 +41,18 @@ export async function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
|
34
41
|
// If the item access is NOT private (which is the sharing access level by default)
|
|
35
42
|
// We subsequently update the items access level.
|
|
36
43
|
if (item.access !== "private") {
|
|
37
|
-
await setItemAccess(Object.assign({ id: createdItem.id, owner: item.owner, access: item.access }, userRequestOptions));
|
|
44
|
+
itemAccessResponse = await setItemAccess(Object.assign({ id: createdItem.id, owner: item.owner, access: item.access }, userRequestOptions));
|
|
38
45
|
}
|
|
39
46
|
// If group ids were passedd in then make share calls to each.
|
|
40
47
|
if (groups === null || groups === void 0 ? void 0 : groups.length) {
|
|
41
48
|
const failSafeShare = failSafe(shareItemWithGroup);
|
|
42
|
-
await Promise.all(groups.map((group) => failSafeShare(Object.assign({ id: createdItem.id, owner: item.owner, groupId: group.id, confirmItemControl: isUpdateGroup(group) }, userRequestOptions))));
|
|
49
|
+
itemSharingResponse = await Promise.all(groups.map((group) => failSafeShare(Object.assign({ id: createdItem.id, owner: item.owner, groupId: group.id, confirmItemControl: isUpdateGroup(group) }, userRequestOptions))));
|
|
43
50
|
}
|
|
44
|
-
return
|
|
51
|
+
return {
|
|
52
|
+
title: item.title,
|
|
53
|
+
createdItem,
|
|
54
|
+
itemAccessResponse,
|
|
55
|
+
itemSharingResponse,
|
|
56
|
+
};
|
|
45
57
|
}
|
|
46
58
|
//# sourceMappingURL=create-item-from-url-or-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-item-from-url-or-file.js","sourceRoot":"","sources":["../../../src/items/create-item-from-url-or-file.ts"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-item-from-url-or-file.js","sourceRoot":"","sources":["../../../src/items/create-item-from-url-or-file.ts"],"names":[],"mappings":";AACA,OAAO,EAGL,aAAa,EACb,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,kBAAkB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C;QACnD,mBAAmB,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CAC3B,aAAa,iBACX,EAAE,EAAE,WAAW,CAAC,EAAE,EAClB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,KAAK,CAAC,EAAE,EACjB,kBAAkB,EAAE,aAAa,CAAC,KAAK,CAAC,IACrC,kBAAkB,EACrB,CACH,CACF,CAAC;KACH;IAED,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW;QACX,kBAAkB;QAClB,mBAAmB;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -11,11 +11,16 @@ import { _waitForItemReady } from "./_internal/_wait-for-item-ready";
|
|
|
11
11
|
*
|
|
12
12
|
* @export
|
|
13
13
|
* @param {ICreateItemFromUrlOrFileOptions} createItemFromUrlOrFileOptions Input params (item, groups?, requestoptions)
|
|
14
|
-
* @return {*} {
|
|
14
|
+
* @return {*} {
|
|
15
|
+
* title: string,
|
|
16
|
+
* createdItem: ICreateItemResponse,
|
|
17
|
+
* itemAccessResponse: ISharingResponse,
|
|
18
|
+
* itemSharingResponse: ISharingResponse[]
|
|
19
|
+
* } Responses from createdItem, changing item access, and item Sharing to group
|
|
15
20
|
*/
|
|
16
21
|
export function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
17
22
|
return __awaiter(this, void 0, void 0, function () {
|
|
18
|
-
var item, groups, userRequestOptions, shouldWaitForItemReady, createdItem, failSafeShare_1;
|
|
23
|
+
var item, groups, userRequestOptions, shouldWaitForItemReady, createdItem, itemAccessResponse, itemSharingResponse, failSafeShare_1;
|
|
19
24
|
return __generator(this, function (_a) {
|
|
20
25
|
switch (_a.label) {
|
|
21
26
|
case 0:
|
|
@@ -40,7 +45,7 @@ export function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
|
40
45
|
if (!(item.access !== "private")) return [3 /*break*/, 8];
|
|
41
46
|
return [4 /*yield*/, setItemAccess(__assign({ id: createdItem.id, owner: item.owner, access: item.access }, userRequestOptions))];
|
|
42
47
|
case 7:
|
|
43
|
-
_a.sent();
|
|
48
|
+
itemAccessResponse = _a.sent();
|
|
44
49
|
_a.label = 8;
|
|
45
50
|
case 8:
|
|
46
51
|
if (!(groups === null || groups === void 0 ? void 0 : groups.length)) return [3 /*break*/, 10];
|
|
@@ -49,9 +54,14 @@ export function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
|
49
54
|
return failSafeShare_1(__assign({ id: createdItem.id, owner: item.owner, groupId: group.id, confirmItemControl: isUpdateGroup(group) }, userRequestOptions));
|
|
50
55
|
}))];
|
|
51
56
|
case 9:
|
|
52
|
-
_a.sent();
|
|
57
|
+
itemSharingResponse = _a.sent();
|
|
53
58
|
_a.label = 10;
|
|
54
|
-
case 10: return [2 /*return*/,
|
|
59
|
+
case 10: return [2 /*return*/, {
|
|
60
|
+
title: item.title,
|
|
61
|
+
createdItem: createdItem,
|
|
62
|
+
itemAccessResponse: itemAccessResponse,
|
|
63
|
+
itemSharingResponse: itemSharingResponse,
|
|
64
|
+
}];
|
|
55
65
|
}
|
|
56
66
|
});
|
|
57
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-item-from-url-or-file.js","sourceRoot":"","sources":["../../../src/items/create-item-from-url-or-file.ts"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-item-from-url-or-file.js","sourceRoot":"","sources":["../../../src/items/create-item-from-url-or-file.ts"],"names":[],"mappings":";AACA,OAAO,EAGL,aAAa,EACb,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAA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AE,EACjB,kBAAkB,EAAE,aAAa,CAAC,KAAK,CAAC,IACrC,kBAAkB,EACrB;wBANF,CAME,CACH,CACF,EAAA;;oBAVD,mBAAmB,GAAG,SAUrB,CAAC;;yBAGJ,sBAAO;wBACL,KAAK,EAAE,IAAI,CAAC,KAAK;wBACjB,WAAW,aAAA;wBACX,kBAAkB,oBAAA;wBAClB,mBAAmB,qBAAA;qBACpB,EAAC;;;;CACH"}
|
|
@@ -14,13 +14,20 @@ const _wait_for_item_ready_1 = require("./_internal/_wait-for-item-ready");
|
|
|
14
14
|
*
|
|
15
15
|
* @export
|
|
16
16
|
* @param {ICreateItemFromUrlOrFileOptions} createItemFromUrlOrFileOptions Input params (item, groups?, requestoptions)
|
|
17
|
-
* @return {*} {
|
|
17
|
+
* @return {*} {
|
|
18
|
+
* title: string,
|
|
19
|
+
* createdItem: ICreateItemResponse,
|
|
20
|
+
* itemAccessResponse: ISharingResponse,
|
|
21
|
+
* itemSharingResponse: ISharingResponse[]
|
|
22
|
+
* } Responses from createdItem, changing item access, and item Sharing to group
|
|
18
23
|
*/
|
|
19
24
|
async function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
20
25
|
const { item, groups } = createItemFromUrlOrFileOptions, userRequestOptions = tslib_1.__rest(createItemFromUrlOrFileOptions, ["item", "groups"]);
|
|
21
26
|
// Is there a file or data url?
|
|
22
27
|
const shouldWaitForItemReady = item.dataUrl || item.file;
|
|
23
28
|
let createdItem;
|
|
29
|
+
let itemAccessResponse;
|
|
30
|
+
let itemSharingResponse;
|
|
24
31
|
// If there is a file then we create the item and chunk the file
|
|
25
32
|
// while multithread uploading it
|
|
26
33
|
if (item.file) {
|
|
@@ -37,14 +44,19 @@ async function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
|
37
44
|
// If the item access is NOT private (which is the sharing access level by default)
|
|
38
45
|
// We subsequently update the items access level.
|
|
39
46
|
if (item.access !== "private") {
|
|
40
|
-
await arcgis_rest_portal_1.setItemAccess(Object.assign({ id: createdItem.id, owner: item.owner, access: item.access }, userRequestOptions));
|
|
47
|
+
itemAccessResponse = await arcgis_rest_portal_1.setItemAccess(Object.assign({ id: createdItem.id, owner: item.owner, access: item.access }, userRequestOptions));
|
|
41
48
|
}
|
|
42
49
|
// If group ids were passedd in then make share calls to each.
|
|
43
50
|
if (groups === null || groups === void 0 ? void 0 : groups.length) {
|
|
44
51
|
const failSafeShare = utils_1.failSafe(arcgis_rest_portal_1.shareItemWithGroup);
|
|
45
|
-
await Promise.all(groups.map((group) => failSafeShare(Object.assign({ id: createdItem.id, owner: item.owner, groupId: group.id, confirmItemControl: utils_1.isUpdateGroup(group) }, userRequestOptions))));
|
|
52
|
+
itemSharingResponse = await Promise.all(groups.map((group) => failSafeShare(Object.assign({ id: createdItem.id, owner: item.owner, groupId: group.id, confirmItemControl: utils_1.isUpdateGroup(group) }, userRequestOptions))));
|
|
46
53
|
}
|
|
47
|
-
return
|
|
54
|
+
return {
|
|
55
|
+
title: item.title,
|
|
56
|
+
createdItem,
|
|
57
|
+
itemAccessResponse,
|
|
58
|
+
itemSharingResponse,
|
|
59
|
+
};
|
|
48
60
|
}
|
|
49
61
|
exports.createItemFromUrlOrFile = createItemFromUrlOrFile;
|
|
50
62
|
//# sourceMappingURL=create-item-from-url-or-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-item-from-url-or-file.js","sourceRoot":"","sources":["../../../src/items/create-item-from-url-or-file.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"create-item-from-url-or-file.js","sourceRoot":"","sources":["../../../src/items/create-item-from-url-or-file.ts"],"names":[],"mappings":";;;;AACA,iEAKkC;AAElC,oCAAmD;AACnD,mEAA6D;AAC7D,iEAA2D;AAC3D,2EAAqE;AAOrE;;;;;;;;;;;;;GAaG;AACI,KAAK,UAAU,uBAAuB,CAC3C,8BAA+D;IAO/D,MAAM,EAAE,IAAI,EAAE,MAAM,KAClB,8BAA8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CAAC,IACrC,kBAAkB,EACrB,CACH,CACF,CAAC;KACH;IAED,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW;QACX,kBAAkB;QAClB,mBAAmB;KACpB,CAAC;AACJ,CAAC;AA/DD,0DA+DC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
|
|
2
|
-
import { ICreateItemResponse } from "@esri/arcgis-rest-portal";
|
|
2
|
+
import { ICreateItemResponse, ISharingResponse } from "@esri/arcgis-rest-portal";
|
|
3
3
|
import { IGroup, IItemAdd } from "@esri/arcgis-rest-types";
|
|
4
4
|
interface ICreateItemFromUrlOrFileOptions extends IUserRequestOptions {
|
|
5
5
|
item: IItemAdd;
|
|
@@ -12,7 +12,17 @@ interface ICreateItemFromUrlOrFileOptions extends IUserRequestOptions {
|
|
|
12
12
|
*
|
|
13
13
|
* @export
|
|
14
14
|
* @param {ICreateItemFromUrlOrFileOptions} createItemFromUrlOrFileOptions Input params (item, groups?, requestoptions)
|
|
15
|
-
* @return {*} {
|
|
15
|
+
* @return {*} {
|
|
16
|
+
* title: string,
|
|
17
|
+
* createdItem: ICreateItemResponse,
|
|
18
|
+
* itemAccessResponse: ISharingResponse,
|
|
19
|
+
* itemSharingResponse: ISharingResponse[]
|
|
20
|
+
* } Responses from createdItem, changing item access, and item Sharing to group
|
|
16
21
|
*/
|
|
17
|
-
export declare function createItemFromUrlOrFile(createItemFromUrlOrFileOptions: ICreateItemFromUrlOrFileOptions): Promise<
|
|
22
|
+
export declare function createItemFromUrlOrFile(createItemFromUrlOrFileOptions: ICreateItemFromUrlOrFileOptions): Promise<{
|
|
23
|
+
title: string;
|
|
24
|
+
createdItem: ICreateItemResponse;
|
|
25
|
+
itemAccessResponse: ISharingResponse;
|
|
26
|
+
itemSharingResponse: ISharingResponse[];
|
|
27
|
+
}>;
|
|
18
28
|
export {};
|
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/hub-common - v9.
|
|
2
|
+
* @esri/hub-common - v9.35.0 - Tue May 24 2022 13:04:14 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -12873,11 +12873,16 @@
|
|
|
12873
12873
|
*
|
|
12874
12874
|
* @export
|
|
12875
12875
|
* @param {ICreateItemFromUrlOrFileOptions} createItemFromUrlOrFileOptions Input params (item, groups?, requestoptions)
|
|
12876
|
-
* @return {*} {
|
|
12876
|
+
* @return {*} {
|
|
12877
|
+
* title: string,
|
|
12878
|
+
* createdItem: ICreateItemResponse,
|
|
12879
|
+
* itemAccessResponse: ISharingResponse,
|
|
12880
|
+
* itemSharingResponse: ISharingResponse[]
|
|
12881
|
+
* } Responses from createdItem, changing item access, and item Sharing to group
|
|
12877
12882
|
*/
|
|
12878
12883
|
function createItemFromUrlOrFile(createItemFromUrlOrFileOptions) {
|
|
12879
12884
|
return __awaiter(this, void 0, void 0, function () {
|
|
12880
|
-
var item, groups, userRequestOptions, shouldWaitForItemReady, createdItem, failSafeShare_1;
|
|
12885
|
+
var item, groups, userRequestOptions, shouldWaitForItemReady, createdItem, itemAccessResponse, itemSharingResponse, failSafeShare_1;
|
|
12881
12886
|
return __generator(this, function (_a) {
|
|
12882
12887
|
switch (_a.label) {
|
|
12883
12888
|
case 0:
|
|
@@ -12902,7 +12907,7 @@
|
|
|
12902
12907
|
if (!(item.access !== "private")) return [3 /*break*/, 8];
|
|
12903
12908
|
return [4 /*yield*/, setItemAccess(__assign({ id: createdItem.id, owner: item.owner, access: item.access }, userRequestOptions))];
|
|
12904
12909
|
case 7:
|
|
12905
|
-
_a.sent();
|
|
12910
|
+
itemAccessResponse = _a.sent();
|
|
12906
12911
|
_a.label = 8;
|
|
12907
12912
|
case 8:
|
|
12908
12913
|
if (!(groups === null || groups === void 0 ? void 0 : groups.length)) return [3 /*break*/, 10];
|
|
@@ -12911,9 +12916,14 @@
|
|
|
12911
12916
|
return failSafeShare_1(__assign({ id: createdItem.id, owner: item.owner, groupId: group.id, confirmItemControl: isUpdateGroup(group) }, userRequestOptions));
|
|
12912
12917
|
}))];
|
|
12913
12918
|
case 9:
|
|
12914
|
-
_a.sent();
|
|
12919
|
+
itemSharingResponse = _a.sent();
|
|
12915
12920
|
_a.label = 10;
|
|
12916
|
-
case 10: return [2 /*return*/,
|
|
12921
|
+
case 10: return [2 /*return*/, {
|
|
12922
|
+
title: item.title,
|
|
12923
|
+
createdItem: createdItem,
|
|
12924
|
+
itemAccessResponse: itemAccessResponse,
|
|
12925
|
+
itemSharingResponse: itemSharingResponse,
|
|
12926
|
+
}];
|
|
12917
12927
|
}
|
|
12918
12928
|
});
|
|
12919
12929
|
});
|