arcgis-item-engine
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -19,11 +19,9 @@ var __assign = (this && this.__assign) || function () { | ||
* @param requestOptions - Options for the request | ||
* @param data - Object to store | ||
* @param data - File or text content to store | ||
* @returns A PProgress Promise that will resolve with an object reporting success/failure and | ||
* echoing the item id. | ||
*/ | ||
export default function addItemData(requestOptions, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
data) { | ||
return createOperation(ItemDataOperationTypes.ADD_ITEM_DATA, [addData(__assign(__assign({}, requestOptions), { data: data }))], requestOptions); | ||
export default function addItemData(requestOptions, data) { | ||
return createOperation(ItemDataOperationTypes.ADD_ITEM_DATA, [addData(__assign(__assign({}, requestOptions), data))], requestOptions); | ||
} | ||
//# sourceMappingURL=add.js.map |
@@ -81,2 +81,3 @@ /** | ||
DesktopToolsItemTypes["LOCATOR_PACKAGE"] = "Locator Package"; | ||
DesktopToolsItemTypes["PRO_REPORT_TEMPLATE"] = "Pro Report Template"; | ||
DesktopToolsItemTypes["RASTER_FUNCTION_TEMPLATE"] = "Raster function template"; | ||
@@ -83,0 +84,0 @@ DesktopToolsItemTypes["RULE_PACKAGE"] = "Rule Package"; |
@@ -12,3 +12,7 @@ /** | ||
WebApplicationsItemTypes["DASHBOARD"] = "Dashboard"; | ||
WebApplicationsItemTypes["DEEP_LEARNING_STUDIO_PROJECT"] = "Deep Learning Studio Project"; | ||
WebApplicationsItemTypes["ESRI_CLASSIFICATION_SCHEMA"] = "Esri Classification Schema"; | ||
WebApplicationsItemTypes["EXCALIBUR_IMAGERY_PROJECT"] = "Excalibur Imagery Project"; | ||
WebApplicationsItemTypes["EXPERIENCE_BUILDER_WIDGET"] = "Experience Builder Widget"; | ||
WebApplicationsItemTypes["EXPERIENCE_BUILDER_WIDGET_PACKAGE"] = "Experience Builder Widget Package"; | ||
WebApplicationsItemTypes["FORM"] = "Form"; | ||
@@ -21,3 +25,6 @@ WebApplicationsItemTypes["GEOBIM_APPLICATION"] = "GeoBIM Application"; | ||
WebApplicationsItemTypes["HUB_PAGE"] = "Hub Page"; | ||
WebApplicationsItemTypes["HUB_PROJECT"] = "Hub Project"; | ||
WebApplicationsItemTypes["HUB_SITE_APPLICATION"] = "Hub Site Application"; | ||
WebApplicationsItemTypes["INSIGHTS_DATA_ENGINEERING_MODEL"] = "Insights Data Engineering Model"; | ||
WebApplicationsItemTypes["INSIGHTS_DATA_ENGINEERING_WORKBOOK"] = "Insights Data Engineering Workbook"; | ||
WebApplicationsItemTypes["INSIGHTS_MODEL"] = "Insights Model"; | ||
@@ -28,2 +35,3 @@ WebApplicationsItemTypes["INSIGHTS_PAGE"] = "Insights Page"; | ||
WebApplicationsItemTypes["INSIGHTS_WORKBOOK_PACKAGE"] = "Insights Workbook Package"; | ||
WebApplicationsItemTypes["INVESTIGATION"] = "Investigation"; | ||
WebApplicationsItemTypes["MISSION"] = "Mission"; | ||
@@ -34,2 +42,3 @@ WebApplicationsItemTypes["MOBILE_APPLICATION"] = "Mobile Application"; | ||
WebApplicationsItemTypes["NOTEBOOK"] = "Notebook"; | ||
WebApplicationsItemTypes["NOTEBOOK_CODE_SNIPPET_LIBRARY"] = "Notebook Code Snippet Library"; | ||
WebApplicationsItemTypes["OPERATION_VIEW"] = "Operation View"; | ||
@@ -63,2 +72,3 @@ WebApplicationsItemTypes["OPERATIONS_DASHBOARD_ADD_IN"] = "Operations Dashboard Add In"; | ||
WebDataFilesItemTypes["EARTH_CONFIGURATION"] = "Earth configuration"; | ||
WebDataFilesItemTypes["ESRI_CLASSIFIER_DEFINITION"] = "Esri Classifier Definition"; | ||
WebDataFilesItemTypes["EXPORT_PACKAGE"] = "Export Package"; | ||
@@ -65,0 +75,0 @@ WebDataFilesItemTypes["FILE_GEODATABASE"] = "File Geodatabase"; |
@@ -12,4 +12,3 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { addFeatures as addFeaturesToService, } from '@esri/arcgis-rest-feature-layer'; | ||
import { addToServiceDefinition, createFeatureService as createHostedFeatureService, } from '@esri/arcgis-rest-service-admin'; | ||
import { addFeatures as addFeaturesToService, addToServiceDefinition, createFeatureService as createHostedFeatureService, } from '@esri/arcgis-rest-feature-service'; | ||
import { createOperation } from '../../../utilities/index.js'; | ||
@@ -16,0 +15,0 @@ import { FeatureServiceOperationTypes, } from './types.js'; |
@@ -12,3 +12,3 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { getService, queryFeatures, } from '@esri/arcgis-rest-feature-layer'; | ||
import { getService, queryFeatures, } from '@esri/arcgis-rest-feature-service'; | ||
import { createOperation } from '../../../utilities/index.js'; | ||
@@ -15,0 +15,0 @@ import { FeatureServiceOperationTypes, } from './types.js'; |
@@ -12,3 +12,3 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { getAllLayersAndTables, } from '@esri/arcgis-rest-feature-layer'; | ||
import { getAllLayersAndTables, } from '@esri/arcgis-rest-feature-service'; | ||
import { createOperation } from '../../utilities/index.js'; | ||
@@ -15,0 +15,0 @@ import { getFeatureServiceDefinition } from './feature/index.js'; |
@@ -69,5 +69,7 @@ var __assign = (this && this.__assign) || function () { | ||
import { getPortalUrl } from '@esri/arcgis-rest-portal'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import { File } from '@esri/arcgis-rest-request'; | ||
import { addItem, getItemData, getItemDescription, getItemResource, getItemResources, } from '../../../core/index.js'; | ||
import { createOperation, parallel, series, } from '../../../utilities/index.js'; | ||
import { newFile } from '../../../utilities/ponyfills.js'; | ||
import { BaseItemWorkflowOperationTypes, } from './types.js'; | ||
@@ -107,3 +109,3 @@ /** | ||
return [2 /*return*/, { | ||
file: newFile([blob], filename !== null && filename !== void 0 ? filename : 'file', { type: blob.type }), | ||
file: new File([blob], filename !== null && filename !== void 0 ? filename : 'file', { type: blob.type }), | ||
}]; | ||
@@ -127,3 +129,3 @@ } | ||
var prefix = pathSegments.join('/'); | ||
return __assign(__assign({ name: name }, (prefix && { prefix: prefix })), { private: resource.access === 'private', resource: newFile([blob], resource.resource, { type: blob.type }) }); | ||
return __assign(__assign({ name: name }, (prefix && { prefix: prefix })), { private: resource.access === 'private', resource: new File([blob], resource.resource, { type: blob.type }) }); | ||
}); | ||
@@ -146,25 +148,31 @@ }); | ||
var getDescription = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var description, _a, thumbnailUrl, _b, _c; | ||
var _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var description, _a, thumbnailUrl, _b, _c, _d; | ||
var _e; | ||
return __generator(this, function (_f) { | ||
switch (_f.label) { | ||
case 0: | ||
if (!((_d = item === null || item === void 0 ? void 0 : item.description) !== null && _d !== void 0)) return [3 /*break*/, 1]; | ||
_a = _d; | ||
if (!((_e = item === null || item === void 0 ? void 0 : item.description) !== null && _e !== void 0)) return [3 /*break*/, 1]; | ||
_a = _e; | ||
return [3 /*break*/, 3]; | ||
case 1: return [4 /*yield*/, getItemDescription(requestOptions)]; | ||
case 2: | ||
_a = (_e.sent()); | ||
_e.label = 3; | ||
_a = (_f.sent()); | ||
_f.label = 3; | ||
case 3: | ||
description = _a; | ||
thumbnailUrl = "".concat(getPortalUrl(requestOptions), "/content/items/").concat(description.id, "/info/").concat(description.thumbnail); | ||
if (!(requestOptions.authentication && description.access !== 'public')) return [3 /*break*/, 5]; | ||
if (!(requestOptions.authentication && description.access !== 'public')) return [3 /*break*/, 7]; | ||
_b = thumbnailUrl; | ||
_c = "?token=".concat; | ||
return [4 /*yield*/, requestOptions.authentication.getToken(thumbnailUrl, requestOptions)]; | ||
case 4: | ||
thumbnailUrl = _b + _c.apply("?token=", [_e.sent()]); | ||
_e.label = 5; | ||
case 5: 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 })]; | ||
if (!(typeof requestOptions.authentication === 'string')) return [3 /*break*/, 4]; | ||
_d = requestOptions.authentication; | ||
return [3 /*break*/, 6]; | ||
case 4: return [4 /*yield*/, requestOptions.authentication.getToken(thumbnailUrl, requestOptions)]; | ||
case 5: | ||
_d = _f.sent(); | ||
_f.label = 6; | ||
case 6: | ||
thumbnailUrl = _b + _c.apply("?token=", [_d]); | ||
_f.label = 7; | ||
case 7: 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 })]; | ||
} | ||
@@ -171,0 +179,0 @@ }); |
@@ -109,12 +109,7 @@ var __assign = (this && this.__assign) || function () { | ||
var updateItemContent = function (item) { | ||
var _a, _b, _c; | ||
var destinationItemOptions = __assign(__assign({}, destinationOptions), { id: item.description.id }); | ||
return parallel.apply(void 0, __spreadArray(__spreadArray([ | ||
// update description | ||
updateItemDescription(destinationItemOptions, item.description)], (item.data | ||
updateItemDescription(destinationItemOptions, item.description)], (item.data ? [addItemData(destinationItemOptions, item.data)] : []), false), (item.resources | ||
? [ | ||
addItemData(destinationItemOptions, (_b = (_a = item.data) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : (_c = item.data) === null || _c === void 0 ? void 0 : _c.file), | ||
] | ||
: []), false), (item.resources | ||
? [ | ||
parallel.apply(void 0, item.resources.map(function (resource) { | ||
@@ -121,0 +116,0 @@ return addItemResource(destinationItemOptions, resource); |
{ | ||
"name": "arcgis-item-engine", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Engine for powering ArcGIS item workflows.", | ||
@@ -37,4 +37,5 @@ "keywords": [ | ||
"dev": "tsc --watch", | ||
"prepare": "husky install && npm run clean && npm run build", | ||
"release": "standard-version", | ||
"prepare": "husky install && npm run clean && npm run build" | ||
"update-types": "node ./support/update-item-types.js" | ||
}, | ||
@@ -55,3 +56,2 @@ "dependencies": { | ||
"commitizen": "^4.3.0", | ||
"cross-fetch": "^3.1.5", | ||
"cz-conventional-changelog": "^3.3.0", | ||
@@ -74,8 +74,6 @@ "eslint": "^8.35.0", | ||
"peerDependencies": { | ||
"@esri/arcgis-rest-auth": "^3.0.5", | ||
"@esri/arcgis-rest-feature-layer": "^3.0.5", | ||
"@esri/arcgis-rest-portal": "^3.0.5", | ||
"@esri/arcgis-rest-request": "^3.0.5", | ||
"@esri/arcgis-rest-service-admin": "^3.0.5" | ||
"@esri/arcgis-rest-feature-service": "^4.0.4", | ||
"@esri/arcgis-rest-portal": "^4.2.0", | ||
"@esri/arcgis-rest-request": "^4.2.0" | ||
} | ||
} |
@@ -15,23 +15,24 @@ # arcgis-item-engine | ||
import { updateItemDescription } from 'arcgis-item-engine'; | ||
import { UserSession } from '@esri/arcgis-rest-auth'; | ||
import { ArcGISIdentityManager } from '@esri/arcgis-rest-request'; | ||
updateItemDescription( | ||
{ | ||
id: '0123456789abcdef0123456789abcdef', // item id | ||
authentication: new UserSession({ // user login w/update permissions | ||
username: 'example_user', | ||
password: 'password', | ||
}), | ||
}, | ||
{ | ||
title: 'Updated Title', | ||
// more properties... | ||
}, // description property updates | ||
{ | ||
id: '0123456789abcdef0123456789abcdef', // item id | ||
authentication: ArcGISIdentityManager({ | ||
// user login w/update permissions | ||
username: 'example_user', | ||
password: 'password', | ||
}), | ||
}, | ||
{ | ||
title: 'Updated Title', | ||
// more properties... | ||
}, // description property updates | ||
) | ||
.onProgress((progress) => { | ||
console.log(`Progress: ${progress}%`); | ||
}) | ||
.then((result) => { | ||
console.log(result); // json response | ||
}); | ||
.onProgress((progress) => { | ||
console.log(`Progress: ${progress}%`); | ||
}) | ||
.then((result) => { | ||
console.log(result); // json response | ||
}); | ||
``` |
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 not supported yet
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 not supported yet
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 not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7
22
38
0
147405
128
1943