arcgis-item-engine
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.0.9](https://github.com/EsriPS/arcgis-item-engine/compare/v0.0.8...v0.0.9) (2021-06-07) | ||
### Bug Fixes | ||
* **item workflow:** copy thumbnail during item copy ([#34](https://github.com/EsriPS/arcgis-item-engine/issues/34)) ([f28b313](https://github.com/EsriPS/arcgis-item-engine/commit/f28b31364ad8c10183766627f68f0e168b27c4ec)) | ||
### [0.0.8](https://github.com/EsriPS/arcgis-item-engine/compare/v0.0.7...v0.0.8) (2021-05-11) | ||
@@ -7,0 +14,0 @@ |
@@ -53,2 +53,3 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { getPortalUrl } from '@esri/arcgis-rest-portal'; | ||
import { addItem, getItemData, getItemDescription, getItemResource, getItemResources, } from '../../../core'; | ||
@@ -122,7 +123,25 @@ import { createOperation, parallel, series, } from '../../../utilities'; | ||
export function copyBaseItem(requestOptions, destinationOptions, options) { | ||
var _this = this; | ||
// function to retrieve item content converted for add | ||
var getItemContent = function () { | ||
// function to retrieve modified item description | ||
var getDescription = function () { return getItemDescription(requestOptions) | ||
.then(function (description) { return (__assign(__assign(__assign(__assign({}, description), (description.id === description.item && { item: undefined })), options === null || options === void 0 ? void 0 : options.description), { owner: undefined })); }); }; | ||
var getDescription = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var description, thumbnailUrl, _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, getItemDescription(requestOptions)]; | ||
case 1: | ||
description = _c.sent(); | ||
thumbnailUrl = getPortalUrl(requestOptions) + "/content/items/" + description.id + "/info/" + description.thumbnail; | ||
if (!(requestOptions.authentication && description.access !== 'public')) return [3 /*break*/, 3]; | ||
_a = thumbnailUrl; | ||
_b = "?token="; | ||
return [4 /*yield*/, requestOptions.authentication.getToken(thumbnailUrl, requestOptions)]; | ||
case 2: | ||
thumbnailUrl = _a + (_b + (_c.sent())); | ||
_c.label = 3; | ||
case 3: return [2 /*return*/, __assign(__assign(__assign(__assign(__assign({}, description), (description.id === description.item && { item: undefined })), { thumbnailUrl: thumbnailUrl }), options === null || options === void 0 ? void 0 : options.description), { owner: undefined })]; | ||
} | ||
}); | ||
}); }; | ||
// function to retrieve item data converted for add | ||
@@ -129,0 +148,0 @@ var getData = function (description) { return getItemData(__assign(__assign({}, requestOptions), { rawResponse: true })) |
@@ -56,2 +56,3 @@ "use strict"; | ||
exports.copyBaseItem = exports.convertResourceDetailsToResources = exports.convertRawDataResponseToData = void 0; | ||
var arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal"); | ||
var core_1 = require("../../../core"); | ||
@@ -127,7 +128,25 @@ var utilities_1 = require("../../../utilities"); | ||
function copyBaseItem(requestOptions, destinationOptions, options) { | ||
var _this = this; | ||
// function to retrieve item content converted for add | ||
var getItemContent = function () { | ||
// function to retrieve modified item description | ||
var getDescription = function () { return core_1.getItemDescription(requestOptions) | ||
.then(function (description) { return (__assign(__assign(__assign(__assign({}, description), (description.id === description.item && { item: undefined })), options === null || options === void 0 ? void 0 : options.description), { owner: undefined })); }); }; | ||
var getDescription = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var description, thumbnailUrl, _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, core_1.getItemDescription(requestOptions)]; | ||
case 1: | ||
description = _c.sent(); | ||
thumbnailUrl = arcgis_rest_portal_1.getPortalUrl(requestOptions) + "/content/items/" + description.id + "/info/" + description.thumbnail; | ||
if (!(requestOptions.authentication && description.access !== 'public')) return [3 /*break*/, 3]; | ||
_a = thumbnailUrl; | ||
_b = "?token="; | ||
return [4 /*yield*/, requestOptions.authentication.getToken(thumbnailUrl, requestOptions)]; | ||
case 2: | ||
thumbnailUrl = _a + (_b + (_c.sent())); | ||
_c.label = 3; | ||
case 3: return [2 /*return*/, __assign(__assign(__assign(__assign(__assign({}, description), (description.id === description.item && { item: undefined })), { thumbnailUrl: thumbnailUrl }), options === null || options === void 0 ? void 0 : options.description), { owner: undefined })]; | ||
} | ||
}); | ||
}); }; | ||
// function to retrieve item data converted for add | ||
@@ -134,0 +153,0 @@ var getData = function (description) { return core_1.getItemData(__assign(__assign({}, requestOptions), { rawResponse: true })) |
{ | ||
"name": "arcgis-item-engine", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Engine for powering ArcGIS item workflows.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/EsriPS/arcgis-item-engine#readme", |
@@ -1,2 +0,2 @@ | ||
import { IItem } from '@esri/arcgis-rest-portal'; | ||
import { getPortalUrl, IItem } from '@esri/arcgis-rest-portal'; | ||
import PProgress from 'p-progress'; | ||
@@ -109,9 +109,19 @@ import { | ||
// function to retrieve modified item description | ||
const getDescription = () => getItemDescription(requestOptions) | ||
.then((description) => ({ | ||
const getDescription = async () => { | ||
const description = await getItemDescription(requestOptions); | ||
// build url to item thumbnail | ||
let thumbnailUrl = `${getPortalUrl(requestOptions)}/content/items/${description.id}/info/${description.thumbnail}`; | ||
if (requestOptions.authentication && description.access !== 'public') { | ||
thumbnailUrl += `?token=${await requestOptions.authentication.getToken(thumbnailUrl, requestOptions)}`; | ||
} | ||
return { | ||
...description, | ||
...(description.id === description.item && { item: undefined }), | ||
thumbnailUrl, | ||
...options?.description, | ||
owner: undefined, | ||
})); | ||
}; | ||
}; | ||
@@ -118,0 +128,0 @@ // function to retrieve item data converted for add |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
525468
7635