@esri/solution-simple-types 6.4.0-next.20250924 → 6.4.0-next.20250926
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/cjs/simple-types.js +37 -2
- package/dist/esm/simple-types.js +37 -2
- package/package.json +3 -3
package/dist/cjs/simple-types.js
CHANGED
|
@@ -26,6 +26,7 @@ const dashboard = tslib_1.__importStar(require("./dashboard"));
|
|
|
26
26
|
const webmap = tslib_1.__importStar(require("./webmap"));
|
|
27
27
|
const webmappingapplication = tslib_1.__importStar(require("./webmappingapplication"));
|
|
28
28
|
const solution_common_1 = require("@esri/solution-common");
|
|
29
|
+
const solution_common_2 = require("@esri/solution-common");
|
|
29
30
|
// Need to import collectively to enable spying
|
|
30
31
|
const simpleTypeHelpers = tslib_1.__importStar(require("./helpers/simple-type-helpers"));
|
|
31
32
|
/**
|
|
@@ -90,7 +91,41 @@ exports.postProcessFieldReferences = postProcessFieldReferences;
|
|
|
90
91
|
* @param {UserSession} authentication The destination session info
|
|
91
92
|
* @returns Promise resolving to successfulness of update
|
|
92
93
|
*/
|
|
93
|
-
function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
94
|
-
|
|
94
|
+
async function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
95
|
+
if (type === "Web Map") {
|
|
96
|
+
if (template.resources.some((r) => r.indexOf(solution_common_2.TASK_CONFIG) > -1)) {
|
|
97
|
+
const url = (0, solution_common_1.generateSourceResourceUrl)(`${templateDictionary.portalBaseUrl}/sharing/rest`, template.itemId, solution_common_2.TASK_CONFIG);
|
|
98
|
+
const requestOptions = {
|
|
99
|
+
httpMethod: "GET",
|
|
100
|
+
authentication: authentication,
|
|
101
|
+
params: {
|
|
102
|
+
f: "json",
|
|
103
|
+
},
|
|
104
|
+
headers: {
|
|
105
|
+
"Accept": "application/json",
|
|
106
|
+
"Authorization": `Bearer ${authentication.token}`,
|
|
107
|
+
"Content-Type": "application/json",
|
|
108
|
+
"X-Esri-Authorization": `Bearer ${authentication.token}`,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
await (0, solution_common_1.request)(url, requestOptions).then(async (r) => {
|
|
112
|
+
const resourceString = JSON.stringify(r);
|
|
113
|
+
const resourceStringUpdated = (0, solution_common_1.replaceInTemplate)(resourceString, templateDictionary);
|
|
114
|
+
// only update if something has changed
|
|
115
|
+
if (resourceString !== resourceStringUpdated) {
|
|
116
|
+
const updatedFileJson = JSON.parse(resourceStringUpdated);
|
|
117
|
+
const requestOptions = {
|
|
118
|
+
id: itemId,
|
|
119
|
+
resource: (0, solution_common_1.jsonToFile)(updatedFileJson, solution_common_2.TASK_CONFIG),
|
|
120
|
+
name: solution_common_2.TASK_CONFIG,
|
|
121
|
+
authentication: authentication,
|
|
122
|
+
params: {},
|
|
123
|
+
};
|
|
124
|
+
await (0, solution_common_1.updateItemResource)(requestOptions);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return (0, solution_common_2.updateItemTemplateFromDictionary)(itemId, templateDictionary, authentication);
|
|
95
130
|
}
|
|
96
131
|
exports.postProcess = postProcess;
|
package/dist/esm/simple-types.js
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
import * as dashboard from "./dashboard";
|
|
22
22
|
import * as webmap from "./webmap";
|
|
23
23
|
import * as webmappingapplication from "./webmappingapplication";
|
|
24
|
-
import {
|
|
24
|
+
import { generateSourceResourceUrl, jsonToFile, request, replaceInTemplate, updateItemResource, } from "@esri/solution-common";
|
|
25
|
+
import { TASK_CONFIG, updateItemTemplateFromDictionary, } from "@esri/solution-common";
|
|
25
26
|
// Need to import collectively to enable spying
|
|
26
27
|
import * as simpleTypeHelpers from "./helpers/simple-type-helpers";
|
|
27
28
|
/**
|
|
@@ -83,6 +84,40 @@ export function postProcessFieldReferences(solutionTemplate, datasourceInfos, ty
|
|
|
83
84
|
* @param {UserSession} authentication The destination session info
|
|
84
85
|
* @returns Promise resolving to successfulness of update
|
|
85
86
|
*/
|
|
86
|
-
export function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
87
|
+
export async function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
88
|
+
if (type === "Web Map") {
|
|
89
|
+
if (template.resources.some((r) => r.indexOf(TASK_CONFIG) > -1)) {
|
|
90
|
+
const url = generateSourceResourceUrl(`${templateDictionary.portalBaseUrl}/sharing/rest`, template.itemId, TASK_CONFIG);
|
|
91
|
+
const requestOptions = {
|
|
92
|
+
httpMethod: "GET",
|
|
93
|
+
authentication: authentication,
|
|
94
|
+
params: {
|
|
95
|
+
f: "json",
|
|
96
|
+
},
|
|
97
|
+
headers: {
|
|
98
|
+
"Accept": "application/json",
|
|
99
|
+
"Authorization": `Bearer ${authentication.token}`,
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
"X-Esri-Authorization": `Bearer ${authentication.token}`,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
await request(url, requestOptions).then(async (r) => {
|
|
105
|
+
const resourceString = JSON.stringify(r);
|
|
106
|
+
const resourceStringUpdated = replaceInTemplate(resourceString, templateDictionary);
|
|
107
|
+
// only update if something has changed
|
|
108
|
+
if (resourceString !== resourceStringUpdated) {
|
|
109
|
+
const updatedFileJson = JSON.parse(resourceStringUpdated);
|
|
110
|
+
const requestOptions = {
|
|
111
|
+
id: itemId,
|
|
112
|
+
resource: jsonToFile(updatedFileJson, TASK_CONFIG),
|
|
113
|
+
name: TASK_CONFIG,
|
|
114
|
+
authentication: authentication,
|
|
115
|
+
params: {},
|
|
116
|
+
};
|
|
117
|
+
await updateItemResource(requestOptions);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
87
122
|
return updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
|
|
88
123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-simple-types",
|
|
3
|
-
"version": "6.4.0-next.
|
|
3
|
+
"version": "6.4.0-next.20250926",
|
|
4
4
|
"description": "Manages the creation and deployment of simple item types for @esri/solution.js.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"npm-check-updates": "^17.1.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@esri/solution-common": "^6.4.0-next.
|
|
25
|
+
"@esri/solution-common": "^6.4.0-next.20250926",
|
|
26
26
|
"tslib": "1.14.1"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"esri",
|
|
78
78
|
"ES6"
|
|
79
79
|
],
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "f8b6ad1803cd5c2f67b317b6ea7390dad77ada61"
|
|
81
81
|
}
|