@esri/solution-feature-layer 1.1.4 → 1.3.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.
- package/dist/esm/feature-layer.d.ts +3 -2
- package/dist/esm/feature-layer.js +7 -6
- package/dist/esm/feature-layer.js.map +1 -1
- package/dist/node/feature-layer.d.ts +3 -2
- package/dist/node/feature-layer.js +9 -7
- package/dist/node/feature-layer.js.map +1 -1
- package/dist/umd/feature-layer.d.ts +3 -2
- package/dist/umd/feature-layer.umd.js +91 -58
- package/dist/umd/feature-layer.umd.js.map +1 -1
- package/dist/umd/feature-layer.umd.min.js +4 -4
- package/dist/umd/feature-layer.umd.min.js.map +1 -1
- package/package.json +23 -24
|
@@ -24,11 +24,12 @@ import * as common from "@esri/solution-common";
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId
|
|
26
26
|
* @param itemInfo Feature service item
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
* @param templateDictionary Hash mapping property names to replacement values
|
|
29
30
|
* @return A promise that will resolve when fullItem has been updated
|
|
30
31
|
*/
|
|
31
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
32
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary?: any): Promise<common.IItemTemplate>;
|
|
32
33
|
/**
|
|
33
34
|
* Creates an item in a specified folder (except for Group item type).
|
|
34
35
|
*
|
|
@@ -27,29 +27,30 @@ import * as common from "@esri/solution-common";
|
|
|
27
27
|
*
|
|
28
28
|
* @param solutionItemId
|
|
29
29
|
* @param itemInfo Feature service item
|
|
30
|
-
* @param
|
|
30
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
31
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
31
32
|
* @param templateDictionary Hash mapping property names to replacement values
|
|
32
33
|
* @return A promise that will resolve when fullItem has been updated
|
|
33
34
|
*/
|
|
34
|
-
export function convertItemToTemplate(solutionItemId, itemInfo,
|
|
35
|
+
export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
35
36
|
return new Promise((resolve, reject) => {
|
|
36
37
|
// Init template
|
|
37
38
|
const template = common.createInitializedItemTemplate(itemInfo);
|
|
38
39
|
const hasInvalidDesignations = common.hasInvalidGroupDesignations(itemInfo.groupDesignations);
|
|
39
40
|
if (hasInvalidDesignations) {
|
|
40
41
|
common
|
|
41
|
-
.updateTemplateForInvalidDesignations(template,
|
|
42
|
+
.updateTemplateForInvalidDesignations(template, srcAuthentication)
|
|
42
43
|
.then(_template => resolve(_template), e => reject(common.fail(e)));
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
// Update the estimated cost factor to deploy this item
|
|
46
47
|
template.estimatedDeploymentCostFactor = 10;
|
|
47
48
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
48
|
-
common.getItemDataAsJson(template.item.id,
|
|
49
|
+
common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
|
|
49
50
|
template.data = data;
|
|
50
|
-
common.getServiceLayersAndTables(template,
|
|
51
|
+
common.getServiceLayersAndTables(template, srcAuthentication).then(itemTemplate => {
|
|
51
52
|
// Extract dependencies
|
|
52
|
-
common.extractDependencies(itemTemplate,
|
|
53
|
+
common.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
|
|
53
54
|
// set the dependencies as an array of IDs from the array of IDependency
|
|
54
55
|
itemTemplate.dependencies = dependencies.map((dep) => dep.id);
|
|
55
56
|
// resolve the template with templatized values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-layer.js","sourceRoot":"","sources":["../../src/feature-layer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,kHAAkH;AAElH,OAAO,KAAK,M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C,EAAE;YACd,IAAI,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;gBACvC,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;gBAClE,MAAM;qBACH,4BAA4B,CAC3B,QAAQ,EACR,cAAc,EACd,QAAQ,CAAC,IAAI,CAAC,GAAG,EACjB,kBAAkB,CACnB;qBACA,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aAC1B;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,CAAC;aAClB;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAED,YAAY"}
|
|
@@ -24,11 +24,12 @@ import * as common from "@esri/solution-common";
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId
|
|
26
26
|
* @param itemInfo Feature service item
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
* @param templateDictionary Hash mapping property names to replacement values
|
|
29
30
|
* @return A promise that will resolve when fullItem has been updated
|
|
30
31
|
*/
|
|
31
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
32
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary?: any): Promise<common.IItemTemplate>;
|
|
32
33
|
/**
|
|
33
34
|
* Creates an item in a specified folder (except for Group item type).
|
|
34
35
|
*
|
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
19
20
|
/**
|
|
20
21
|
* Manages the creation and deployment of feature layers and services.
|
|
21
22
|
*
|
|
22
23
|
* @module feature-layer
|
|
23
24
|
*/
|
|
24
25
|
//#region Imports ----------------------------------------------------------------------------------------------//
|
|
25
|
-
const common = require("@esri/solution-common");
|
|
26
|
+
const common = (0, tslib_1.__importStar)(require("@esri/solution-common"));
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region Publish Process --------------------------------------------------------------------------------------//
|
|
28
29
|
/**
|
|
@@ -30,29 +31,30 @@ const common = require("@esri/solution-common");
|
|
|
30
31
|
*
|
|
31
32
|
* @param solutionItemId
|
|
32
33
|
* @param itemInfo Feature service item
|
|
33
|
-
* @param
|
|
34
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
35
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
34
36
|
* @param templateDictionary Hash mapping property names to replacement values
|
|
35
37
|
* @return A promise that will resolve when fullItem has been updated
|
|
36
38
|
*/
|
|
37
|
-
function convertItemToTemplate(solutionItemId, itemInfo,
|
|
39
|
+
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
38
40
|
return new Promise((resolve, reject) => {
|
|
39
41
|
// Init template
|
|
40
42
|
const template = common.createInitializedItemTemplate(itemInfo);
|
|
41
43
|
const hasInvalidDesignations = common.hasInvalidGroupDesignations(itemInfo.groupDesignations);
|
|
42
44
|
if (hasInvalidDesignations) {
|
|
43
45
|
common
|
|
44
|
-
.updateTemplateForInvalidDesignations(template,
|
|
46
|
+
.updateTemplateForInvalidDesignations(template, srcAuthentication)
|
|
45
47
|
.then(_template => resolve(_template), e => reject(common.fail(e)));
|
|
46
48
|
}
|
|
47
49
|
else {
|
|
48
50
|
// Update the estimated cost factor to deploy this item
|
|
49
51
|
template.estimatedDeploymentCostFactor = 10;
|
|
50
52
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
51
|
-
common.getItemDataAsJson(template.item.id,
|
|
53
|
+
common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
|
|
52
54
|
template.data = data;
|
|
53
|
-
common.getServiceLayersAndTables(template,
|
|
55
|
+
common.getServiceLayersAndTables(template, srcAuthentication).then(itemTemplate => {
|
|
54
56
|
// Extract dependencies
|
|
55
|
-
common.extractDependencies(itemTemplate,
|
|
57
|
+
common.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
|
|
56
58
|
// set the dependencies as an array of IDs from the array of IDependency
|
|
57
59
|
itemTemplate.dependencies = dependencies.map((dep) => dep.id);
|
|
58
60
|
// resolve the template with templatized values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-layer.js","sourceRoot":"","sources":["../../src/feature-layer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"feature-layer.js","sourceRoot":"","sources":["../../src/feature-layer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,kHAAkH;AAElH,2EAAgD;AAEhD,YAAY;AAEZ,kHAAkH;AAElH;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAwB;IAExB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3D,gBAAgB;QAChB,MAAM,QAAQ,GAAyB,MAAM,CAAC,6BAA6B,CACzE,QAAQ,CACT,CAAC;QAEF,MAAM,sBAAsB,GAAY,MAAM,CAAC,2BAA2B,CACxE,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;QACF,IAAI,sBAAsB,EAAE;YAC1B,MAAM;iBACH,oCAAoC,CAAC,QAAQ,EAAE,iBAAiB,CAAC;iBACjE,IAAI,CACH,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,EAC/B,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAC5B,CAAC;SACL;aAAM;YACL,uDAAuD;YACvD,QAAQ,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ACN,CAAC,CAAC,CAAC;AACL,CAAC;AAvRD,wDAuRC;AAED;;;;;;;;;GASG;AACH,SAAgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAkC;IAElC,OAAO,IAAI,OAAO,CAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjE,MAAM;aACH,gCAAgC,CAC/B,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf;aACA,IAAI,CAAC,OAAO,CAAC,EAAE;YACd,IAAI,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;gBACvC,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;gBAClE,MAAM;qBACH,4BAA4B,CAC3B,QAAQ,EACR,cAAc,EACd,QAAQ,CAAC,IAAI,CAAC,GAAG,EACjB,kBAAkB,CACnB;qBACA,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aAC1B;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,CAAC;aAClB;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAhCD,kCAgCC;AAED,YAAY"}
|
|
@@ -24,11 +24,12 @@ import * as common from "@esri/solution-common";
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId
|
|
26
26
|
* @param itemInfo Feature service item
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
* @param templateDictionary Hash mapping property names to replacement values
|
|
29
30
|
* @return A promise that will resolve when fullItem has been updated
|
|
30
31
|
*/
|
|
31
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
32
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary?: any): Promise<common.IItemTemplate>;
|
|
32
33
|
/**
|
|
33
34
|
* Creates an item in a specified folder (except for Group item type).
|
|
34
35
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-feature-layer - v1.1
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-feature-layer - v1.3.1 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 10:42:29 GMT-0800 (Pacific Standard Time)
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -18,8 +18,28 @@
|
|
|
18
18
|
(function (global, factory) {
|
|
19
19
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common')) :
|
|
20
20
|
typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common'], factory) :
|
|
21
|
-
(global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution));
|
|
22
|
-
}(this, (function (exports, common) { 'use strict';
|
|
21
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution));
|
|
22
|
+
})(this, (function (exports, common) { 'use strict';
|
|
23
|
+
|
|
24
|
+
function _interopNamespace(e) {
|
|
25
|
+
if (e && e.__esModule) return e;
|
|
26
|
+
var n = Object.create(null);
|
|
27
|
+
if (e) {
|
|
28
|
+
Object.keys(e).forEach(function (k) {
|
|
29
|
+
if (k !== 'default') {
|
|
30
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
31
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return e[k]; }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
n["default"] = e;
|
|
39
|
+
return Object.freeze(n);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var common__namespace = /*#__PURE__*/_interopNamespace(common);
|
|
23
43
|
|
|
24
44
|
/** @license
|
|
25
45
|
* Copyright 2018 Esri
|
|
@@ -43,34 +63,36 @@
|
|
|
43
63
|
*
|
|
44
64
|
* @param solutionItemId
|
|
45
65
|
* @param itemInfo Feature service item
|
|
46
|
-
* @param
|
|
66
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
67
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
47
68
|
* @param templateDictionary Hash mapping property names to replacement values
|
|
48
69
|
* @return A promise that will resolve when fullItem has been updated
|
|
49
70
|
*/
|
|
50
|
-
function convertItemToTemplate(solutionItemId, itemInfo,
|
|
71
|
+
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
51
72
|
return new Promise((resolve, reject) => {
|
|
52
73
|
// Init template
|
|
53
|
-
const template =
|
|
54
|
-
const hasInvalidDesignations =
|
|
74
|
+
const template = common__namespace.createInitializedItemTemplate(itemInfo);
|
|
75
|
+
const hasInvalidDesignations = common__namespace.hasInvalidGroupDesignations(itemInfo.groupDesignations);
|
|
55
76
|
if (hasInvalidDesignations) {
|
|
56
|
-
|
|
57
|
-
.
|
|
77
|
+
common__namespace
|
|
78
|
+
.updateTemplateForInvalidDesignations(template, srcAuthentication)
|
|
79
|
+
.then(_template => resolve(_template), e => reject(common__namespace.fail(e)));
|
|
58
80
|
}
|
|
59
81
|
else {
|
|
60
82
|
// Update the estimated cost factor to deploy this item
|
|
61
83
|
template.estimatedDeploymentCostFactor = 10;
|
|
62
84
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
63
|
-
|
|
85
|
+
common__namespace.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
|
|
64
86
|
template.data = data;
|
|
65
|
-
|
|
87
|
+
common__namespace.getServiceLayersAndTables(template, srcAuthentication).then(itemTemplate => {
|
|
66
88
|
// Extract dependencies
|
|
67
|
-
|
|
89
|
+
common__namespace.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
|
|
68
90
|
// set the dependencies as an array of IDs from the array of IDependency
|
|
69
91
|
itemTemplate.dependencies = dependencies.map((dep) => dep.id);
|
|
70
92
|
// resolve the template with templatized values
|
|
71
|
-
resolve(
|
|
72
|
-
}, (e) => reject(
|
|
73
|
-
}, e => reject(
|
|
93
|
+
resolve(common__namespace.templatize(itemTemplate, dependencies, false, templateDictionary));
|
|
94
|
+
}, (e) => reject(common__namespace.fail(e)));
|
|
95
|
+
}, e => reject(common__namespace.fail(e)));
|
|
74
96
|
});
|
|
75
97
|
}
|
|
76
98
|
});
|
|
@@ -91,54 +113,60 @@
|
|
|
91
113
|
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
92
114
|
return new Promise(resolve => {
|
|
93
115
|
// Interrupt process if progress callback returns `false`
|
|
94
|
-
if (!itemProgressCallback(template.itemId,
|
|
95
|
-
itemProgressCallback(template.itemId,
|
|
96
|
-
resolve(
|
|
116
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Started, 0)) {
|
|
117
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Ignored, 0);
|
|
118
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type));
|
|
97
119
|
return;
|
|
98
120
|
}
|
|
99
121
|
// Replace the templatized symbols in a copy of the template
|
|
100
|
-
let newItemTemplate =
|
|
101
|
-
newItemTemplate =
|
|
122
|
+
let newItemTemplate = common__namespace.cloneObject(template);
|
|
123
|
+
newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
|
|
102
124
|
// Thumbnail has to be updated separately; doesn't work in create service call
|
|
103
125
|
delete newItemTemplate.item.thumbnail;
|
|
104
126
|
// cache the popup info to be added later
|
|
105
|
-
const popupInfos =
|
|
127
|
+
const popupInfos = common__namespace.cachePopupInfos(newItemTemplate.data);
|
|
106
128
|
// Create the item, then update its URL with its new id
|
|
107
|
-
|
|
129
|
+
common__namespace
|
|
130
|
+
.createFeatureService(newItemTemplate, destinationAuthentication, templateDictionary)
|
|
108
131
|
.then(createResponse => {
|
|
109
132
|
if (createResponse.success) {
|
|
110
133
|
// Interrupt process if progress callback returns `false`
|
|
111
|
-
if (!itemProgressCallback(template.itemId,
|
|
112
|
-
itemProgressCallback(template.itemId,
|
|
113
|
-
|
|
114
|
-
.
|
|
134
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
|
|
135
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
136
|
+
common__namespace
|
|
137
|
+
.removeItem(createResponse.serviceItemId, destinationAuthentication)
|
|
138
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
115
139
|
}
|
|
116
140
|
else {
|
|
117
141
|
// Detemplatize what we can now that the service has been created
|
|
118
|
-
newItemTemplate =
|
|
142
|
+
newItemTemplate = common__namespace.updateTemplate(newItemTemplate, templateDictionary, createResponse);
|
|
119
143
|
// Add the layers and tables to the feature service
|
|
120
|
-
|
|
144
|
+
common__namespace
|
|
145
|
+
.addFeatureServiceLayersAndTables(newItemTemplate, templateDictionary, popupInfos, destinationAuthentication)
|
|
121
146
|
.then(() => {
|
|
122
|
-
newItemTemplate =
|
|
147
|
+
newItemTemplate = common__namespace.updateTemplate(newItemTemplate, templateDictionary, createResponse);
|
|
123
148
|
// Update the item with snippet, description, popupInfo, etc.
|
|
124
|
-
|
|
149
|
+
common__namespace
|
|
150
|
+
.updateItemExtended({
|
|
125
151
|
...newItemTemplate.item,
|
|
126
152
|
url: undefined // can't update the URL of a feature service
|
|
127
153
|
}, newItemTemplate.data, destinationAuthentication, template.item.thumbnail, undefined, templateDictionary)
|
|
128
154
|
.then(() => {
|
|
129
155
|
// Interrupt process if progress callback returns `false`
|
|
130
|
-
if (!itemProgressCallback(template.itemId,
|
|
131
|
-
itemProgressCallback(template.itemId,
|
|
132
|
-
|
|
133
|
-
.
|
|
156
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
|
|
157
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
158
|
+
common__namespace
|
|
159
|
+
.removeItem(createResponse.serviceItemId, destinationAuthentication)
|
|
160
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
134
161
|
}
|
|
135
162
|
else {
|
|
136
163
|
// Update the template to match what we've stored in AGO
|
|
137
|
-
|
|
164
|
+
common__namespace
|
|
165
|
+
.getItemBase(newItemTemplate.itemId, destinationAuthentication)
|
|
138
166
|
.then(updatedItem => {
|
|
139
167
|
newItemTemplate.item = updatedItem;
|
|
140
168
|
/* istanbul ignore else */
|
|
141
|
-
if (
|
|
169
|
+
if (common__namespace.getProp(newItemTemplate, "item.url") &&
|
|
142
170
|
!newItemTemplate.item.url.endsWith("/")) {
|
|
143
171
|
newItemTemplate.item.url += "/";
|
|
144
172
|
}
|
|
@@ -146,40 +174,43 @@
|
|
|
146
174
|
item: newItemTemplate,
|
|
147
175
|
id: createResponse.serviceItemId,
|
|
148
176
|
type: newItemTemplate.type,
|
|
149
|
-
postProcess:
|
|
177
|
+
postProcess: common__namespace.hasUnresolvedVariables({
|
|
150
178
|
item: newItemTemplate.item,
|
|
151
179
|
data: newItemTemplate.data
|
|
152
180
|
}) ||
|
|
153
|
-
|
|
181
|
+
common__namespace.isWorkforceProject(newItemTemplate)
|
|
154
182
|
});
|
|
155
183
|
}, () => {
|
|
156
|
-
itemProgressCallback(template.itemId,
|
|
157
|
-
|
|
158
|
-
.
|
|
184
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
185
|
+
common__namespace
|
|
186
|
+
.removeItem(createResponse.serviceItemId, destinationAuthentication)
|
|
187
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
159
188
|
} // fails to update item
|
|
160
189
|
);
|
|
161
190
|
}
|
|
162
191
|
}, () => {
|
|
163
|
-
itemProgressCallback(template.itemId,
|
|
164
|
-
|
|
165
|
-
.
|
|
192
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
193
|
+
common__namespace
|
|
194
|
+
.removeItem(createResponse.serviceItemId, destinationAuthentication)
|
|
195
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
166
196
|
} // fails to update item
|
|
167
197
|
);
|
|
168
198
|
}, () => {
|
|
169
|
-
itemProgressCallback(template.itemId,
|
|
170
|
-
|
|
171
|
-
.
|
|
199
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
200
|
+
common__namespace
|
|
201
|
+
.removeItem(createResponse.serviceItemId, destinationAuthentication)
|
|
202
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
172
203
|
} // fails to add service layers and/or tables
|
|
173
204
|
);
|
|
174
205
|
}
|
|
175
206
|
}
|
|
176
207
|
else {
|
|
177
|
-
itemProgressCallback(template.itemId,
|
|
178
|
-
resolve(
|
|
208
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
209
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
|
|
179
210
|
}
|
|
180
211
|
}, () => {
|
|
181
|
-
itemProgressCallback(template.itemId,
|
|
182
|
-
resolve(
|
|
212
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
213
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
|
|
183
214
|
});
|
|
184
215
|
});
|
|
185
216
|
}
|
|
@@ -195,11 +226,13 @@
|
|
|
195
226
|
*/
|
|
196
227
|
function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
197
228
|
return new Promise((resolve, reject) => {
|
|
198
|
-
|
|
229
|
+
common__namespace
|
|
230
|
+
.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
|
|
199
231
|
.then(results => {
|
|
200
|
-
if (
|
|
201
|
-
template =
|
|
202
|
-
|
|
232
|
+
if (common__namespace.isWorkforceProject(template)) {
|
|
233
|
+
template = common__namespace.replaceInTemplate(template, templateDictionary);
|
|
234
|
+
common__namespace
|
|
235
|
+
.fineTuneCreatedWorkforceItem(template, authentication, template.item.url, templateDictionary)
|
|
203
236
|
.then(resolve, reject);
|
|
204
237
|
}
|
|
205
238
|
else {
|
|
@@ -216,5 +249,5 @@
|
|
|
216
249
|
|
|
217
250
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
218
251
|
|
|
219
|
-
}))
|
|
252
|
+
}));
|
|
220
253
|
//# sourceMappingURL=feature-layer.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-layer.umd.js","sources":["../../src/feature-layer.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of feature layers and services.\r\n *\r\n * @module feature-layer\r\n */\r\n\r\n//#region Imports ----------------------------------------------------------------------------------------------//\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n//#endregion\r\n\r\n//#region Publish Process --------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Fills in missing data, including full layer and table definitions, in a feature services' definition.\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo Feature service item\r\n * @param userSession The session used to interact with the service the template is based on\r\n * @param templateDictionary Hash mapping property names to replacement values\r\n * @return A promise that will resolve when fullItem has been updated\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: common.UserSession,\r\n templateDictionary?: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n // Init template\r\n const template: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n const hasInvalidDesignations: boolean = common.hasInvalidGroupDesignations(\r\n itemInfo.groupDesignations\r\n );\r\n if (hasInvalidDesignations) {\r\n common\r\n .updateTemplateForInvalidDesignations(template, authentication)\r\n .then(\r\n _template => resolve(_template),\r\n e => reject(common.fail(e))\r\n );\r\n } else {\r\n // Update the estimated cost factor to deploy this item\r\n template.estimatedDeploymentCostFactor = 10;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.getItemDataAsJson(template.item.id, authentication).then(data => {\r\n template.data = data;\r\n common.getServiceLayersAndTables(template, authentication).then(\r\n itemTemplate => {\r\n // Extract dependencies\r\n common.extractDependencies(itemTemplate, authentication).then(\r\n (dependencies: common.IDependency[]) => {\r\n // set the dependencies as an array of IDs from the array of IDependency\r\n itemTemplate.dependencies = dependencies.map(\r\n (dep: any) => dep.id\r\n );\r\n\r\n // resolve the template with templatized values\r\n resolve(\r\n common.templatize(\r\n itemTemplate,\r\n dependencies,\r\n false,\r\n templateDictionary\r\n )\r\n );\r\n },\r\n (e: any) => reject(common.fail(e))\r\n );\r\n },\r\n e => reject(common.fail(e))\r\n );\r\n });\r\n }\r\n });\r\n}\r\n\r\n//#endregion\r\n\r\n//#region Deploy Process ---------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Creates an item in a specified folder (except for Group item type).\r\n *\r\n * @param itemTemplate Item to be created; n.b.: this item is modified\r\n * @param folderId Id of folder to receive item; null indicates that the item goes into the root\r\n * folder; ignored for Group item type\r\n * @param settings Hash mapping property names to replacement values\r\n * @param authentication Credentials for the request\r\n * @return A promise that will resolve with the id of the created item\r\n * @protected\r\n */\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Thumbnail has to be updated separately; doesn't work in create service call\r\n delete newItemTemplate.item.thumbnail;\r\n\r\n // cache the popup info to be added later\r\n const popupInfos: common.IPopupInfos = common.cachePopupInfos(\r\n newItemTemplate.data\r\n );\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createFeatureService(\r\n newItemTemplate,\r\n destinationAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n createResponse => {\r\n if (createResponse.success) {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Detemplatize what we can now that the service has been created\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Add the layers and tables to the feature service\r\n common\r\n .addFeatureServiceLayersAndTables(\r\n newItemTemplate,\r\n templateDictionary,\r\n popupInfos,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () => {\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Update the item with snippet, description, popupInfo, etc.\r\n common\r\n .updateItemExtended(\r\n {\r\n ...newItemTemplate.item,\r\n url: undefined // can't update the URL of a feature service\r\n },\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n template.item.thumbnail,\r\n undefined,\r\n templateDictionary\r\n )\r\n .then(\r\n () => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } else {\r\n // Update the template to match what we've stored in AGO\r\n common\r\n .getItemBase(\r\n newItemTemplate.itemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n updatedItem => {\r\n newItemTemplate.item = updatedItem;\r\n /* istanbul ignore else */\r\n if (\r\n common.getProp(\r\n newItemTemplate,\r\n \"item.url\"\r\n ) &&\r\n !newItemTemplate.item.url.endsWith(\"/\")\r\n ) {\r\n newItemTemplate.item.url += \"/\";\r\n }\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.serviceItemId,\r\n type: newItemTemplate.type,\r\n postProcess:\r\n common.hasUnresolvedVariables({\r\n item: newItemTemplate.item,\r\n data: newItemTemplate.data\r\n }) ||\r\n common.isWorkforceProject(newItemTemplate)\r\n });\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n )\r\n );\r\n } // fails to add service layers and/or tables\r\n );\r\n }\r\n } else {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Feature Layer post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: common.IItemTemplate,\r\n templates: common.IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: common.UserSession\r\n): Promise<common.IUpdateItemResponse> {\r\n return new Promise<common.IUpdateItemResponse>((resolve, reject) => {\r\n common\r\n .updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n )\r\n .then(results => {\r\n if (common.isWorkforceProject(template)) {\r\n template = common.replaceInTemplate(template, templateDictionary);\r\n common\r\n .fineTuneCreatedWorkforceItem(\r\n template,\r\n authentication,\r\n template.item.url,\r\n templateDictionary\r\n )\r\n .then(resolve, reject);\r\n } else {\r\n resolve(results);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\n//#endregion\r\n"],"names":["common.createInitializedItemTemplate","common.hasInvalidGroupDesignations","common\r\n .updateTemplateForInvalidDesignations","common.fail","common.getItemDataAsJson","common.getServiceLayersAndTables","common.extractDependencies","common.templatize","common.EItemProgressStatus","common.generateEmptyCreationResponse","common.cloneObject","common.replaceInTemplate","common.cachePopupInfos","common\r\n .createFeatureService","common\r\n .removeItem","common.updateTemplate","common\r\n .addFeatureServiceLayersAndTables","common\r\n .updateItemExtended","common\r\n .removeItem","common\r\n .getItemBase","common.getProp","common.hasUnresolvedVariables","common.isWorkforceProject","common\r\n .removeItem","common\r\n .removeItem","common\r\n .removeItem","common\r\n .updateItemTemplateFromDictionary","common\r\n .fineTuneCreatedWorkforceItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EA0BA;EAEA;EAEA;;;;;;;;;WASgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,cAAkC,EAClC,kBAAwB;MAExB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM;;UAEvD,MAAM,QAAQ,GAAyBA,oCAAoC,CACzE,QAAQ,CACT,CAAC;UAEF,MAAM,sBAAsB,GAAYC,kCAAkC,CACxE,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;UACF,IAAI,sBAAsB,EAAE;cAC1BC,2CACuC,CAAC,QAAQ,EAAE,cAAc,CAAC;mBAC9D,IAAI,CACH,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,EAC/B,CAAC,IAAI,MAAM,CAACC,WAAW,CAAC,CAAC,CAAC,CAAC,CAC5B,CAAC;WACL;eAAM;;cAEL,QAAQ,CAAC,6BAA6B,GAAG,EAAE,CAAC;;cAG5CC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI;kBAClE,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;kBACrBC,gCAAgC,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,IAAI,CAC7D,YAAY;;sBAEVC,0BAA0B,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,IAAI,CAC3D,CAAC,YAAkC;;0BAEjC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC,GAAG,CAC1C,CAAC,GAAQ,KAAK,GAAG,CA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CAC3B,QAAQ,EACR,cAAc,EACd,QAAQ,CAAC,IAAI,CAAC,GAAG,EACjB,kBAAkB,CACnB;uBACA,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;eAC1B;mBAAM;kBACL,OAAO,CAAC,OAAO,CAAC,CAAC;eAClB;WACF,EAAE,MAAM,CAAC,CAAC;OACd,CAAC,CAAC;EACL,CAAC;EAED;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"feature-layer.umd.js","sources":["../../src/feature-layer.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of feature layers and services.\r\n *\r\n * @module feature-layer\r\n */\r\n\r\n//#region Imports ----------------------------------------------------------------------------------------------//\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n//#endregion\r\n\r\n//#region Publish Process --------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Fills in missing data, including full layer and table definitions, in a feature services' definition.\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo Feature service item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param templateDictionary Hash mapping property names to replacement values\r\n * @return A promise that will resolve when fullItem has been updated\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: common.UserSession,\r\n srcAuthentication: common.UserSession,\r\n templateDictionary?: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n // Init template\r\n const template: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n const hasInvalidDesignations: boolean = common.hasInvalidGroupDesignations(\r\n itemInfo.groupDesignations\r\n );\r\n if (hasInvalidDesignations) {\r\n common\r\n .updateTemplateForInvalidDesignations(template, srcAuthentication)\r\n .then(\r\n _template => resolve(_template),\r\n e => reject(common.fail(e))\r\n );\r\n } else {\r\n // Update the estimated cost factor to deploy this item\r\n template.estimatedDeploymentCostFactor = 10;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {\r\n template.data = data;\r\n common.getServiceLayersAndTables(template, srcAuthentication).then(\r\n itemTemplate => {\r\n // Extract dependencies\r\n common.extractDependencies(itemTemplate, srcAuthentication).then(\r\n (dependencies: common.IDependency[]) => {\r\n // set the dependencies as an array of IDs from the array of IDependency\r\n itemTemplate.dependencies = dependencies.map(\r\n (dep: any) => dep.id\r\n );\r\n\r\n // resolve the template with templatized values\r\n resolve(\r\n common.templatize(\r\n itemTemplate,\r\n dependencies,\r\n false,\r\n templateDictionary\r\n )\r\n );\r\n },\r\n (e: any) => reject(common.fail(e))\r\n );\r\n },\r\n e => reject(common.fail(e))\r\n );\r\n });\r\n }\r\n });\r\n}\r\n\r\n//#endregion\r\n\r\n//#region Deploy Process ---------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Creates an item in a specified folder (except for Group item type).\r\n *\r\n * @param itemTemplate Item to be created; n.b.: this item is modified\r\n * @param folderId Id of folder to receive item; null indicates that the item goes into the root\r\n * folder; ignored for Group item type\r\n * @param settings Hash mapping property names to replacement values\r\n * @param authentication Credentials for the request\r\n * @return A promise that will resolve with the id of the created item\r\n * @protected\r\n */\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Thumbnail has to be updated separately; doesn't work in create service call\r\n delete newItemTemplate.item.thumbnail;\r\n\r\n // cache the popup info to be added later\r\n const popupInfos: common.IPopupInfos = common.cachePopupInfos(\r\n newItemTemplate.data\r\n );\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createFeatureService(\r\n newItemTemplate,\r\n destinationAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n createResponse => {\r\n if (createResponse.success) {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Detemplatize what we can now that the service has been created\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Add the layers and tables to the feature service\r\n common\r\n .addFeatureServiceLayersAndTables(\r\n newItemTemplate,\r\n templateDictionary,\r\n popupInfos,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () => {\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Update the item with snippet, description, popupInfo, etc.\r\n common\r\n .updateItemExtended(\r\n {\r\n ...newItemTemplate.item,\r\n url: undefined // can't update the URL of a feature service\r\n },\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n template.item.thumbnail,\r\n undefined,\r\n templateDictionary\r\n )\r\n .then(\r\n () => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } else {\r\n // Update the template to match what we've stored in AGO\r\n common\r\n .getItemBase(\r\n newItemTemplate.itemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n updatedItem => {\r\n newItemTemplate.item = updatedItem;\r\n /* istanbul ignore else */\r\n if (\r\n common.getProp(\r\n newItemTemplate,\r\n \"item.url\"\r\n ) &&\r\n !newItemTemplate.item.url.endsWith(\"/\")\r\n ) {\r\n newItemTemplate.item.url += \"/\";\r\n }\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.serviceItemId,\r\n type: newItemTemplate.type,\r\n postProcess:\r\n common.hasUnresolvedVariables({\r\n item: newItemTemplate.item,\r\n data: newItemTemplate.data\r\n }) ||\r\n common.isWorkforceProject(newItemTemplate)\r\n });\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n )\r\n );\r\n } // fails to add service layers and/or tables\r\n );\r\n }\r\n } else {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Feature Layer post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: common.IItemTemplate,\r\n templates: common.IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: common.UserSession\r\n): Promise<common.IUpdateItemResponse> {\r\n return new Promise<common.IUpdateItemResponse>((resolve, reject) => {\r\n common\r\n .updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n )\r\n .then(results => {\r\n if (common.isWorkforceProject(template)) {\r\n template = common.replaceInTemplate(template, templateDictionary);\r\n common\r\n .fineTuneCreatedWorkforceItem(\r\n template,\r\n authentication,\r\n template.item.url,\r\n templateDictionary\r\n )\r\n .then(resolve, reject);\r\n } else {\r\n resolve(results);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\n//#endregion\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EA0BA;EAEA;EAEA;;;;;;;;;;WAUgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAwB;MAExB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM;;UAEvD,MAAM,QAAQ,GAAyBA,iBAAM,CAAC,6BAA6B,CACzE,QAAQ,CACT,CAAC;UAEF,MAAM,sBAAsB,GAAYA,iBAAM,CAAC,2BAA2B,CACxE,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;UACF,IAAI,sBAAsB,EAAE;cAC1BA,iBAAM;mBACH,oCAAoC,CAAC,QAAQ,EAAE,iBAAiB,CAAC;mBACjE,IAAI,CACH,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,EAC/B,CAAC,IAAI,MAAM,CAACA,iBAAM,CAAC,IAAI,CAAC,CAAC,CAAC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AE,MAAM,CAAC,CAAC;eAC1B;mBAAM;kBACL,OAAO,CAAC,OAAO,CAAC,CAAC;eAClB;WACF,EAAE,MAAM,CAAC,CAAC;OACd,CAAC,CAAC;EACL,CAAC;EAED;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-feature-layer - v1.1
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-feature-layer - v1.3.1 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 10:42:35 GMT-0800 (Pacific Standard Time)
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common"],t):t((e=e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";e.convertItemToTemplate=function(e,r,s,
|
|
18
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);e.convertItemToTemplate=function(e,t,r,s,o){return new Promise(((e,r)=>{const i=n.createInitializedItemTemplate(t);n.hasInvalidGroupDesignations(t.groupDesignations)?n.updateTemplateForInvalidDesignations(i,s).then((t=>e(t)),(e=>r(n.fail(e)))):(i.estimatedDeploymentCostFactor=10,n.getItemDataAsJson(i.item.id,s).then((t=>{i.data=t,n.getServiceLayersAndTables(i,s).then((t=>{n.extractDependencies(t,s).then((r=>{t.dependencies=r.map((e=>e.id)),e(n.templatize(t,r,!1,o))}),(e=>r(n.fail(e))))}),(e=>r(n.fail(e))))})))}))},e.createItemFromTemplate=function(e,t,r,s){return new Promise((o=>{if(!s(e.itemId,n.EItemProgressStatus.Started,0))return s(e.itemId,n.EItemProgressStatus.Ignored,0),void o(n.generateEmptyCreationResponse(e.type));let i=n.cloneObject(e);i=n.replaceInTemplate(i,t),delete i.item.thumbnail;const a=n.cachePopupInfos(i.data);n.createFeatureService(i,r,t).then((m=>{m.success?s(e.itemId,n.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?(i=n.updateTemplate(i,t,m),n.addFeatureServiceLayersAndTables(i,t,a,r).then((()=>{i=n.updateTemplate(i,t,m),n.updateItemExtended({...i.item,url:void 0},i.data,r,e.item.thumbnail,void 0,t).then((()=>{s(e.itemId,n.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?n.getItemBase(i.itemId,r).then((e=>{i.item=e,n.getProp(i,"item.url")&&!i.item.url.endsWith("/")&&(i.item.url+="/"),o({item:i,id:m.serviceItemId,type:i.type,postProcess:n.hasUnresolvedVariables({item:i.item,data:i.data})||n.isWorkforceProject(i)})}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))})):(s(e.itemId,n.EItemProgressStatus.Cancelled,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type)))))}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))}))}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))}))):(s(e.itemId,n.EItemProgressStatus.Cancelled,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))):(s(e.itemId,n.EItemProgressStatus.Failed,0),o(n.generateEmptyCreationResponse(e.type)))}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),o(n.generateEmptyCreationResponse(e.type))}))}))},e.postProcess=function(e,t,r,s,o,i,a){return new Promise(((t,r)=>{n.updateItemTemplateFromDictionary(e,i,a).then((e=>{n.isWorkforceProject(s)?(s=n.replaceInTemplate(s,i),n.fineTuneCreatedWorkforceItem(s,a,s.item.url,i).then(t,r)):t(e)}),r)}))},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
19
19
|
//# sourceMappingURL=feature-layer.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-layer.umd.min.js","sources":["../../src/feature-layer.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of feature layers and services.\r\n *\r\n * @module feature-layer\r\n */\r\n\r\n//#region Imports ----------------------------------------------------------------------------------------------//\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n//#endregion\r\n\r\n//#region Publish Process --------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Fills in missing data, including full layer and table definitions, in a feature services' definition.\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo Feature service item\r\n * @param userSession The session used to interact with the service the template is based on\r\n * @param templateDictionary Hash mapping property names to replacement values\r\n * @return A promise that will resolve when fullItem has been updated\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: common.UserSession,\r\n templateDictionary?: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n // Init template\r\n const template: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n const hasInvalidDesignations: boolean = common.hasInvalidGroupDesignations(\r\n itemInfo.groupDesignations\r\n );\r\n if (hasInvalidDesignations) {\r\n common\r\n .updateTemplateForInvalidDesignations(template, authentication)\r\n .then(\r\n _template => resolve(_template),\r\n e => reject(common.fail(e))\r\n );\r\n } else {\r\n // Update the estimated cost factor to deploy this item\r\n template.estimatedDeploymentCostFactor = 10;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.getItemDataAsJson(template.item.id, authentication).then(data => {\r\n template.data = data;\r\n common.getServiceLayersAndTables(template, authentication).then(\r\n itemTemplate => {\r\n // Extract dependencies\r\n common.extractDependencies(itemTemplate, authentication).then(\r\n (dependencies: common.IDependency[]) => {\r\n // set the dependencies as an array of IDs from the array of IDependency\r\n itemTemplate.dependencies = dependencies.map(\r\n (dep: any) => dep.id\r\n );\r\n\r\n // resolve the template with templatized values\r\n resolve(\r\n common.templatize(\r\n itemTemplate,\r\n dependencies,\r\n false,\r\n templateDictionary\r\n )\r\n );\r\n },\r\n (e: any) => reject(common.fail(e))\r\n );\r\n },\r\n e => reject(common.fail(e))\r\n );\r\n });\r\n }\r\n });\r\n}\r\n\r\n//#endregion\r\n\r\n//#region Deploy Process ---------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Creates an item in a specified folder (except for Group item type).\r\n *\r\n * @param itemTemplate Item to be created; n.b.: this item is modified\r\n * @param folderId Id of folder to receive item; null indicates that the item goes into the root\r\n * folder; ignored for Group item type\r\n * @param settings Hash mapping property names to replacement values\r\n * @param authentication Credentials for the request\r\n * @return A promise that will resolve with the id of the created item\r\n * @protected\r\n */\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Thumbnail has to be updated separately; doesn't work in create service call\r\n delete newItemTemplate.item.thumbnail;\r\n\r\n // cache the popup info to be added later\r\n const popupInfos: common.IPopupInfos = common.cachePopupInfos(\r\n newItemTemplate.data\r\n );\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createFeatureService(\r\n newItemTemplate,\r\n destinationAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n createResponse => {\r\n if (createResponse.success) {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Detemplatize what we can now that the service has been created\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Add the layers and tables to the feature service\r\n common\r\n .addFeatureServiceLayersAndTables(\r\n newItemTemplate,\r\n templateDictionary,\r\n popupInfos,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () => {\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Update the item with snippet, description, popupInfo, etc.\r\n common\r\n .updateItemExtended(\r\n {\r\n ...newItemTemplate.item,\r\n url: undefined // can't update the URL of a feature service\r\n },\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n template.item.thumbnail,\r\n undefined,\r\n templateDictionary\r\n )\r\n .then(\r\n () => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } else {\r\n // Update the template to match what we've stored in AGO\r\n common\r\n .getItemBase(\r\n newItemTemplate.itemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n updatedItem => {\r\n newItemTemplate.item = updatedItem;\r\n /* istanbul ignore else */\r\n if (\r\n common.getProp(\r\n newItemTemplate,\r\n \"item.url\"\r\n ) &&\r\n !newItemTemplate.item.url.endsWith(\"/\")\r\n ) {\r\n newItemTemplate.item.url += \"/\";\r\n }\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.serviceItemId,\r\n type: newItemTemplate.type,\r\n postProcess:\r\n common.hasUnresolvedVariables({\r\n item: newItemTemplate.item,\r\n data: newItemTemplate.data\r\n }) ||\r\n common.isWorkforceProject(newItemTemplate)\r\n });\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n )\r\n );\r\n } // fails to add service layers and/or tables\r\n );\r\n }\r\n } else {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Feature Layer post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: common.IItemTemplate,\r\n templates: common.IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: common.UserSession\r\n): Promise<common.IUpdateItemResponse> {\r\n return new Promise<common.IUpdateItemResponse>((resolve, reject) => {\r\n common\r\n .updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n )\r\n .then(results => {\r\n if (common.isWorkforceProject(template)) {\r\n template = common.replaceInTemplate(template, templateDictionary);\r\n common\r\n .fineTuneCreatedWorkforceItem(\r\n template,\r\n authentication,\r\n template.item.url,\r\n templateDictionary\r\n )\r\n .then(resolve, reject);\r\n } else {\r\n resolve(results);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\n//#endregion\r\n"],"names":["solutionItemId","itemInfo","authentication","templateDictionary","Promise","resolve","reject","template","common.createInitializedItemTemplate","common.hasInvalidGroupDesignations","groupDesignations","common\r\n .updateTemplateForInvalidDesignations","then","_template","e","common.fail","estimatedDeploymentCostFactor","common.getItemDataAsJson","item","id","data","common.getServiceLayersAndTables","itemTemplate","common.extractDependencies","dependencies","map","dep","common.templatize","destinationAuthentication","itemProgressCallback","itemId","common.EItemProgressStatus","Started","Ignored","common.generateEmptyCreationResponse","type","newItemTemplate","common.cloneObject","common.replaceInTemplate","thumbnail","popupInfos","common.cachePopupInfos","common\r\n .createFeatureService","createResponse","success","Created","serviceItemId","common.updateTemplate","common\r\n .addFeatureServiceLayersAndTables","common\r\n .updateItemExtended","url","undefined","Finished","common\r\n .getItemBase","updatedItem","common.getProp","endsWith","postProcess","common.hasUnresolvedVariables","common.isWorkforceProject","Failed","common\r\n .removeItem","Cancelled","common\r\n .removeItem","common\r\n .removeItem","common\r\n .removeItem","common\r\n .removeItem","itemInfos","templates","common\r\n .updateItemTemplateFromDictionary","results","common\r\n .fineTuneCreatedWorkforceItem"],"mappings":";;;;;;;;;;;;;;;;;2UAwCEA,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8B,CAACC,EAASC,KAEjD,MAAMC,EAAiCC,gCACrCP,GAGsCQ,8BACtCR,EAASS,mBAGTC,uCACwCJ,EAAUL,GAC/CU,MACCC,GAAaR,EAAQQ,KACrBC,GAAKR,EAAOS,OAAYD,OAI5BP,EAASS,8BAAgC,GAGzCC,oBAAyBV,EAASW,KAAKC,GAAIjB,GAAgBU,MAAKQ,IAC9Db,EAASa,KAAOA,EAChBC,4BAAiCd,EAAUL,GAAgBU,MACzDU,IAEEC,sBAA2BD,EAAcpB,GAAgBU,MACtDY,IAECF,EAAaE,aAAeA,EAAaC,KACtCC,GAAaA,EAAIP,KAIpBd,EACEsB,aACEL,EACAE,GACA,EACArB,OAILW,GAAWR,EAAOS,OAAYD,SAGnCA,GAAKR,EAAOS,OAAYD,gDAuBhCP,EACAJ,EACAyB,EACAC,GAEA,OAAO,IAAIzB,SAAgDC,IAEzD,IACGwB,EACCtB,EAASuB,OACTC,sBAA2BC,QAC3B,GASF,OANAH,EACEtB,EAASuB,OACTC,sBAA2BE,QAC3B,QAEF5B,EAAQ6B,gCAAqC3B,EA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ACE9B,EACE6B,gCACE3B,EAAS4B,aAkEvB,KACEN,EACEtB,EAASuB,OACTC,sBAA2B6B,OAC3B,GAEFI,aAEIrB,EAAeG,cACflB,GAEDhB,MACC,IACEP,EACE6B,gCACE3B,EAAS4B,SAGf,IACE9B,EACE6B,gCACE3B,EAAS4B,eAO3B,KACEN,EACEtB,EAASuB,OACTC,sBAA2B6B,OAC3B,GAEFK,aAEItB,EAAeG,cACflB,GAEDhB,MACC,IACEP,EACE6B,gCAAqC3B,EAAS4B,SAElD,IACE9B,EACE6B,gCAAqC3B,EAAS4B,cApM5DN,EACEtB,EAASuB,OACTC,sBAA2B+B,UAC3B,GAEFI,aAEIvB,EAAeG,cACflB,GAEDhB,MACC,IACEP,EACE6B,gCAAqC3B,EAAS4B,SAElD,IACE9B,EAAQ6B,gCAAqC3B,EAAS4B,WA2L9DN,EACEtB,EAASuB,OACTC,sBAA2B6B,OAC3B,GAEFvD,EAAQ6B,gCAAqC3B,EAAS4B,WAG1D,KACEN,EACEtB,EAASuB,OACTC,sBAA2B6B,OAC3B,GAEFvD,EAAQ6B,gCAAqC3B,EAAS4B,qCAiB9DL,EACAK,EACAgC,EACA5D,EACA6D,EACAjE,EACAD,GAEA,OAAO,IAAIE,SAAoC,CAACC,EAASC,KACvD+D,mCAEIvC,EACA3B,EACAD,GAEDU,MAAK0D,IACAX,qBAA0BpD,IAC5BA,EAAW+B,oBAAyB/B,EAAUJ,GAC9CoE,+BAEIhE,EACAL,EACAK,EAASW,KAAKgC,IACd/C,GAEDS,KAAKP,EAASC,IAEjBD,EAAQiE,KAEThE"}
|
|
1
|
+
{"version":3,"file":"feature-layer.umd.min.js","sources":["../../src/feature-layer.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of feature layers and services.\r\n *\r\n * @module feature-layer\r\n */\r\n\r\n//#region Imports ----------------------------------------------------------------------------------------------//\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n//#endregion\r\n\r\n//#region Publish Process --------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Fills in missing data, including full layer and table definitions, in a feature services' definition.\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo Feature service item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param templateDictionary Hash mapping property names to replacement values\r\n * @return A promise that will resolve when fullItem has been updated\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: common.UserSession,\r\n srcAuthentication: common.UserSession,\r\n templateDictionary?: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n // Init template\r\n const template: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n const hasInvalidDesignations: boolean = common.hasInvalidGroupDesignations(\r\n itemInfo.groupDesignations\r\n );\r\n if (hasInvalidDesignations) {\r\n common\r\n .updateTemplateForInvalidDesignations(template, srcAuthentication)\r\n .then(\r\n _template => resolve(_template),\r\n e => reject(common.fail(e))\r\n );\r\n } else {\r\n // Update the estimated cost factor to deploy this item\r\n template.estimatedDeploymentCostFactor = 10;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {\r\n template.data = data;\r\n common.getServiceLayersAndTables(template, srcAuthentication).then(\r\n itemTemplate => {\r\n // Extract dependencies\r\n common.extractDependencies(itemTemplate, srcAuthentication).then(\r\n (dependencies: common.IDependency[]) => {\r\n // set the dependencies as an array of IDs from the array of IDependency\r\n itemTemplate.dependencies = dependencies.map(\r\n (dep: any) => dep.id\r\n );\r\n\r\n // resolve the template with templatized values\r\n resolve(\r\n common.templatize(\r\n itemTemplate,\r\n dependencies,\r\n false,\r\n templateDictionary\r\n )\r\n );\r\n },\r\n (e: any) => reject(common.fail(e))\r\n );\r\n },\r\n e => reject(common.fail(e))\r\n );\r\n });\r\n }\r\n });\r\n}\r\n\r\n//#endregion\r\n\r\n//#region Deploy Process ---------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Creates an item in a specified folder (except for Group item type).\r\n *\r\n * @param itemTemplate Item to be created; n.b.: this item is modified\r\n * @param folderId Id of folder to receive item; null indicates that the item goes into the root\r\n * folder; ignored for Group item type\r\n * @param settings Hash mapping property names to replacement values\r\n * @param authentication Credentials for the request\r\n * @return A promise that will resolve with the id of the created item\r\n * @protected\r\n */\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Thumbnail has to be updated separately; doesn't work in create service call\r\n delete newItemTemplate.item.thumbnail;\r\n\r\n // cache the popup info to be added later\r\n const popupInfos: common.IPopupInfos = common.cachePopupInfos(\r\n newItemTemplate.data\r\n );\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createFeatureService(\r\n newItemTemplate,\r\n destinationAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n createResponse => {\r\n if (createResponse.success) {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Detemplatize what we can now that the service has been created\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Add the layers and tables to the feature service\r\n common\r\n .addFeatureServiceLayersAndTables(\r\n newItemTemplate,\r\n templateDictionary,\r\n popupInfos,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () => {\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Update the item with snippet, description, popupInfo, etc.\r\n common\r\n .updateItemExtended(\r\n {\r\n ...newItemTemplate.item,\r\n url: undefined // can't update the URL of a feature service\r\n },\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n template.item.thumbnail,\r\n undefined,\r\n templateDictionary\r\n )\r\n .then(\r\n () => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } else {\r\n // Update the template to match what we've stored in AGO\r\n common\r\n .getItemBase(\r\n newItemTemplate.itemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n updatedItem => {\r\n newItemTemplate.item = updatedItem;\r\n /* istanbul ignore else */\r\n if (\r\n common.getProp(\r\n newItemTemplate,\r\n \"item.url\"\r\n ) &&\r\n !newItemTemplate.item.url.endsWith(\"/\")\r\n ) {\r\n newItemTemplate.item.url += \"/\";\r\n }\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.serviceItemId,\r\n type: newItemTemplate.type,\r\n postProcess:\r\n common.hasUnresolvedVariables({\r\n item: newItemTemplate.item,\r\n data: newItemTemplate.data\r\n }) ||\r\n common.isWorkforceProject(newItemTemplate)\r\n });\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n )\r\n );\r\n } // fails to add service layers and/or tables\r\n );\r\n }\r\n } else {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Feature Layer post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: common.IItemTemplate,\r\n templates: common.IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: common.UserSession\r\n): Promise<common.IUpdateItemResponse> {\r\n return new Promise<common.IUpdateItemResponse>((resolve, reject) => {\r\n common\r\n .updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n )\r\n .then(results => {\r\n if (common.isWorkforceProject(template)) {\r\n template = common.replaceInTemplate(template, templateDictionary);\r\n common\r\n .fineTuneCreatedWorkforceItem(\r\n template,\r\n authentication,\r\n template.item.url,\r\n templateDictionary\r\n )\r\n .then(resolve, reject);\r\n } else {\r\n resolve(results);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\n//#endregion\r\n"],"names":["solutionItemId","itemInfo","destAuthentication","srcAuthentication","templateDictionary","Promise","resolve","reject","template","common","createInitializedItemTemplate","hasInvalidGroupDesignations","groupDesignations","updateTemplateForInvalidDesignations","then","_template","e","fail","estimatedDeploymentCostFactor","getItemDataAsJson","item","id","data","getServiceLayersAndTables","itemTemplate","extractDependencies","dependencies","map","dep","templatize","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","Ignored","generateEmptyCreationResponse","type","newItemTemplate","cloneObject","replaceInTemplate","thumbnail","popupInfos","cachePopupInfos","createFeatureService","createResponse","success","Created","serviceItemId","updateTemplate","addFeatureServiceLayersAndTables","updateItemExtended","url","undefined","Finished","getItemBase","updatedItem","getProp","endsWith","postProcess","hasUnresolvedVariables","isWorkforceProject","Failed","removeItem","Cancelled","itemInfos","templates","authentication","updateItemTemplateFromDictionary","results","fineTuneCreatedWorkforceItem"],"mappings":";;;;;;;;;;;;;;;;;+pBAyCEA,EACAC,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8B,CAACC,EAASC,KAEjD,MAAMC,EAAiCC,EAAOC,8BAC5CT,GAGsCQ,EAAOE,4BAC7CV,EAASW,mBAGTH,EACGI,qCAAqCL,EAAUL,GAC/CW,MACCC,GAAaT,EAAQS,KACrBC,GAAKT,EAAOE,EAAOQ,KAAKD,OAI5BR,EAASU,8BAAgC,GAGzCT,EAAOU,kBAAkBX,EAASY,KAAKC,GAAIlB,GAAmBW,MAAKQ,IACjEd,EAASc,KAAOA,EAChBb,EAAOc,0BAA0Bf,EAAUL,GAAmBW,MAC5DU,IAEEf,EAAOgB,oBAAoBD,EAAcrB,GAAmBW,MACzDY,IAECF,EAAaE,aAAeA,EAAaC,KACtCC,GAAaA,EAAIP,KAIpBf,EACEG,EAAOoB,WACLL,EACAE,GACA,EACAtB,OAILY,GAAWT,EAAOE,EA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O2B,8BAA8B5B,EAAS6B,qCAiB9DL,EACAK,EACA4B,EACAzD,EACA0D,EACA9D,EACA+D,GAEA,OAAO,IAAI9D,SAAoC,CAACC,EAASC,KACvDE,EACG2D,iCACCpC,EACA5B,EACA+D,GAEDrD,MAAKuD,IACA5D,EAAOoD,mBAAmBrD,IAC5BA,EAAWC,EAAO+B,kBAAkBhC,EAAUJ,GAC9CK,EACG6D,6BACC9D,EACA2D,EACA3D,EAASY,KAAKgC,IACdhD,GAEDU,KAAKR,EAASC,IAEjBD,EAAQ+D,KAET9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-feature-layer",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Manages the creation and deployment of feature layers and services for @esri/solution.js.",
|
|
5
5
|
"main": "dist/node/index.js",
|
|
6
6
|
"unpkg": "dist/umd/feature-layer.umd.min.js",
|
|
@@ -13,32 +13,31 @@
|
|
|
13
13
|
"dist/**"
|
|
14
14
|
],
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@esri/arcgis-rest-auth": "3.4.
|
|
17
|
-
"@esri/arcgis-rest-feature-layer": "3.4.
|
|
18
|
-
"@esri/arcgis-rest-portal": "3.4.
|
|
19
|
-
"@esri/arcgis-rest-request": "3.4.
|
|
20
|
-
"@esri/arcgis-rest-service-admin": "3.4.
|
|
21
|
-
"@esri/hub-common": "9.
|
|
22
|
-
"@esri/hub-initiatives": "9.
|
|
23
|
-
"@esri/hub-sites": "9.
|
|
24
|
-
"@esri/hub-teams": "9.
|
|
25
|
-
"rollup": "^
|
|
26
|
-
"typescript": "^4.3.4"
|
|
16
|
+
"@esri/arcgis-rest-auth": "3.4.3",
|
|
17
|
+
"@esri/arcgis-rest-feature-layer": "3.4.3",
|
|
18
|
+
"@esri/arcgis-rest-portal": "3.4.3",
|
|
19
|
+
"@esri/arcgis-rest-request": "3.4.3",
|
|
20
|
+
"@esri/arcgis-rest-service-admin": "3.4.3",
|
|
21
|
+
"@esri/hub-common": "9.15.0",
|
|
22
|
+
"@esri/hub-initiatives": "9.15.0",
|
|
23
|
+
"@esri/hub-sites": "9.15.0",
|
|
24
|
+
"@esri/hub-teams": "9.15.0",
|
|
25
|
+
"rollup": "^2.60.0"
|
|
27
26
|
},
|
|
28
27
|
"peerDependencies": {
|
|
29
|
-
"@esri/arcgis-rest-auth": "3.4.
|
|
30
|
-
"@esri/arcgis-rest-feature-layer": "3.4.
|
|
31
|
-
"@esri/arcgis-rest-portal": "3.4.
|
|
32
|
-
"@esri/arcgis-rest-request": "3.4.
|
|
33
|
-
"@esri/arcgis-rest-service-admin": "3.4.
|
|
34
|
-
"@esri/hub-common": "9.
|
|
35
|
-
"@esri/hub-initiatives": "9.
|
|
36
|
-
"@esri/hub-sites": "9.
|
|
37
|
-
"@esri/hub-teams": "9.
|
|
28
|
+
"@esri/arcgis-rest-auth": "3.4.3",
|
|
29
|
+
"@esri/arcgis-rest-feature-layer": "3.4.3",
|
|
30
|
+
"@esri/arcgis-rest-portal": "3.4.3",
|
|
31
|
+
"@esri/arcgis-rest-request": "3.4.3",
|
|
32
|
+
"@esri/arcgis-rest-service-admin": "3.4.3",
|
|
33
|
+
"@esri/hub-common": "9.15.0",
|
|
34
|
+
"@esri/hub-initiatives": "9.15.0",
|
|
35
|
+
"@esri/hub-sites": "9.15.0",
|
|
36
|
+
"@esri/hub-teams": "9.15.0"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@esri/solution-common": "^1.1
|
|
41
|
-
"tslib": "
|
|
39
|
+
"@esri/solution-common": "^1.3.1",
|
|
40
|
+
"tslib": "1.13.0"
|
|
42
41
|
},
|
|
43
42
|
"scripts": {
|
|
44
43
|
"prepare": "npm run build",
|
|
@@ -90,5 +89,5 @@
|
|
|
90
89
|
"esri",
|
|
91
90
|
"ES6"
|
|
92
91
|
],
|
|
93
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "70c45e0eb9c745f7dbc0f8b6ce3654921cca11a0"
|
|
94
93
|
}
|