@esri/solution-viewer 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-viewer",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Simplifies access to @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/viewer.umd.min.js",
@@ -18,7 +18,7 @@
18
18
  "@esri/arcgis-rest-portal": "~3.5.0",
19
19
  "@esri/arcgis-rest-request": "~3.5.0",
20
20
  "@esri/arcgis-rest-service-admin": "~3.5.0",
21
- "@esri/solution-common": "^3.0.1",
21
+ "@esri/solution-common": "^3.1.0",
22
22
  "rollup": "2.79.1"
23
23
  },
24
24
  "peerDependencies": {
@@ -81,5 +81,5 @@
81
81
  "esri",
82
82
  "ES6"
83
83
  ],
84
- "gitHead": "86394b7a82adae26897cb2ec2aade0aa05e70e41"
84
+ "gitHead": "d7bddb4b7c7b98ef00eac060c639a22d0654a03f"
85
85
  }
@@ -1,21 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Provides the access to the solution's contents.
18
- *
19
- * @module viewer
20
- */
21
- export * from "./viewer";
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const tslib_1 = require("tslib");
19
- /**
20
- * Provides the access to the solution's contents.
21
- *
22
- * @module viewer
23
- */
24
- tslib_1.__exportStar(require("./viewer"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,mDAAyB"}
@@ -1,54 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Provides the access to the solution's contents.
18
- *
19
- * @module viewer
20
- */
21
- import * as common from "@esri/solution-common";
22
- /**
23
- * Checks a Solution.
24
- *
25
- * @param item Solution id
26
- * @param authentication Credentials for the request to AGO
27
- * @returns List of results of checks of Solution
28
- */
29
- export declare function checkSolution(itemId: string, authentication?: common.UserSession): Promise<string[]>;
30
- /**
31
- * Compares two AGO items, fetching them if only their id is supplied.
32
- *
33
- * @param item1 First item or its AGO id
34
- * @param item2 Second item or its AGO id
35
- * @param authentication Credentials for the request to AGO
36
- * @returns True if objects are the same
37
- * @see Only comparable properties are compared; see deleteItemProps() in the `common` package
38
- */
39
- export declare function compareItems(item1: string | any, item2: string | any, authentication?: common.UserSession): Promise<boolean>;
40
- /**
41
- * Creates a hierarchy of the items in a Solution template.
42
- *
43
- * @param templates Array of templates from a Solution
44
- * @returns List of top-level items, each containing a recursive list of its dependencies
45
- */
46
- export declare function getItemHierarchy(templates: common.IItemTemplate[]): common.IHierarchyElement[];
47
- /**
48
- * Finds the top-level items in a Solution template--the items that are not dependencies of any other item.
49
- *
50
- * @param templates Array of templates from a Solution
51
- * @returns List of top-level item ids
52
- * @private
53
- */
54
- export declare function _getTopLevelItemIds(templates: common.IItemTemplate[]): string[];
@@ -1,262 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports._getTopLevelItemIds = exports.getItemHierarchy = exports.compareItems = exports.checkSolution = void 0;
19
- const tslib_1 = require("tslib");
20
- /**
21
- * Provides the access to the solution's contents.
22
- *
23
- * @module viewer
24
- */
25
- const common = tslib_1.__importStar(require("@esri/solution-common"));
26
- // ------------------------------------------------------------------------------------------------------------------ //
27
- /**
28
- * Checks a Solution.
29
- *
30
- * @param item Solution id
31
- * @param authentication Credentials for the request to AGO
32
- * @returns List of results of checks of Solution
33
- */
34
- function checkSolution(itemId, authentication = null) {
35
- const resultsHtml = [`Item ${itemId}`];
36
- let item;
37
- let isTemplate = true;
38
- let templateItems;
39
- let templateItemIds;
40
- let currentAction = " while getting complete item";
41
- return (common
42
- .getCompleteItem(itemId, authentication)
43
- // ---------- Is it a Template or Deployed Solution? -----------------------------------------------------------//
44
- .then((results) => {
45
- currentAction = "";
46
- item = results;
47
- if (!item) {
48
- throw new Error(`item is not found`);
49
- }
50
- else if (item.base.type !== "Solution") {
51
- throw new Error(`item is not a Solution`);
52
- }
53
- else if (item.base.typeKeywords.includes("Template")) {
54
- resultsHtml.push(`&#x2714; item is a Template Solution`);
55
- }
56
- else if (item.base.typeKeywords.includes("Deployed")) {
57
- isTemplate = false;
58
- resultsHtml.push(`&#x2714; item is a Deployed Solution`);
59
- }
60
- else {
61
- throw new Error(`item is neither a Template Solution nor a Deployed Solution`);
62
- }
63
- // base: IItem; text/plain JSON
64
- // data: File; */*
65
- // thumbnail: File; image/*
66
- // metadata: File; application/xml
67
- // resources: File[]; list of */*
68
- // fwdRelatedItems: IRelatedItems[]; list of forward relationshipType/relatedItems[] pairs
69
- // revRelatedItems: IRelatedItems[]; list of reverse relationshipType/relatedItems[] pairs
70
- return common.blobToJson(item.data);
71
- })
72
- // ---------- Check the Solution2Item relationship from a Deployed Solution to each deployed item --------------//
73
- .then(itemDataJson => {
74
- templateItems = itemDataJson?.templates;
75
- /* istanbul ignore else */
76
- if (!templateItems || templateItems.length === 0) {
77
- throw new Error(`Solution's data are not valid JSON or the Solution contains no items`);
78
- }
79
- templateItemIds = templateItems
80
- .map((template) => template.itemId)
81
- .sort();
82
- if (!isTemplate) {
83
- // Make sure that there's a Solution2Item relationship to each deployed item
84
- const fwdRelatedItemIds = item.fwdRelatedItems
85
- .filter(relationshipSet => relationshipSet.relationshipType === "Solution2Item")
86
- .reduce((flatSet, relationshipSet) => flatSet.concat(relationshipSet.relatedItemIds), [])
87
- .sort();
88
- if (templateItemIds.length < fwdRelatedItemIds.length) {
89
- resultsHtml.push("&#x2716; there are forward Solution2Item relationship(s) to unknown item(s)");
90
- }
91
- else if (templateItemIds.length > fwdRelatedItemIds.length) {
92
- resultsHtml.push("&#x2716; missing forward Solution2Item relationship(s)");
93
- }
94
- else if (JSON.stringify(templateItemIds) !==
95
- JSON.stringify(fwdRelatedItemIds)) {
96
- resultsHtml.push("&#x2716; mismatching forward Solution2Item relationship(s)");
97
- }
98
- else {
99
- resultsHtml.push("&#x2714; matching forward Solution2Item relationship(s)");
100
- }
101
- }
102
- return resultsHtml;
103
- })
104
- // ---------- Check that all dependency references are items in Solution ---------------------------------------//
105
- .then(() => {
106
- const dependencyIds = templateItems
107
- .reduce((flatSet, template) => flatSet.concat(template.dependencies), [])
108
- .reduce((noDupSet, dependency) => {
109
- /* istanbul ignore else */
110
- if (!noDupSet.includes(dependency))
111
- noDupSet.push(dependency);
112
- return noDupSet;
113
- }, [])
114
- .sort();
115
- const missingItems = dependencyIds.filter((dependencyId) => !templateItemIds.includes(dependencyId));
116
- if (missingItems.length === 0) {
117
- resultsHtml.push("&#x2714; all dependencies are in Solution");
118
- }
119
- else {
120
- resultsHtml.push("&#x2716; dependencies that aren't in Solution: " +
121
- JSON.stringify(missingItems));
122
- }
123
- return resultsHtml;
124
- })
125
- // ---------- Done ---------------------------------------------------------------------------------------------//
126
- .then(() => {
127
- return resultsHtml;
128
- })
129
- // ---------- Fatal error --------------------------------------------------------------------------------------//
130
- .catch(error => {
131
- resultsHtml.push(`&#x2716; error${currentAction}: ${error.message}`);
132
- return resultsHtml;
133
- }));
134
- }
135
- exports.checkSolution = checkSolution;
136
- /**
137
- * Compares two AGO items, fetching them if only their id is supplied.
138
- *
139
- * @param item1 First item or its AGO id
140
- * @param item2 Second item or its AGO id
141
- * @param authentication Credentials for the request to AGO
142
- * @returns True if objects are the same
143
- * @see Only comparable properties are compared; see deleteItemProps() in the `common` package
144
- */
145
- function compareItems(item1, item2, authentication = null) {
146
- return new Promise((resolve, reject) => {
147
- // If an input is a string, fetch the item; otherwise, clone the input because we will modify the
148
- // item base to remove incomparable properties
149
- let itemBaseDef1;
150
- if (typeof item1 === "string") {
151
- itemBaseDef1 = common.getItemBase(item1, authentication);
152
- }
153
- else {
154
- itemBaseDef1 = Promise.resolve(common.cloneObject(item1));
155
- }
156
- let itemBaseDef2;
157
- if (typeof item2 === "string") {
158
- itemBaseDef2 = common.getItemBase(item2, authentication);
159
- }
160
- else {
161
- itemBaseDef2 = Promise.resolve(common.cloneObject(item2));
162
- }
163
- Promise.all([itemBaseDef1, itemBaseDef2]).then(responses => {
164
- const [itemBase1, itemBase2] = responses;
165
- common.deleteItemProps(itemBase1);
166
- common.deleteItemProps(itemBase2);
167
- if (itemBase1.type === "Solution") {
168
- delete itemBase1.typeKeywords;
169
- delete itemBase1.size;
170
- delete itemBase2.typeKeywords;
171
- delete itemBase2.size;
172
- }
173
- /*console.log("----------------------------------------------------------------");
174
- console.log("item 1 " + item1 + ": ", JSON.stringify(itemBase1, null, 2));
175
- console.log("item 2 " + item2 + ": ", JSON.stringify(itemBase2, null, 2));
176
- console.log("----------------------------------------------------------------");*/
177
- resolve(common.compareJSONNoEmptyStrings(itemBase1, itemBase2));
178
- }, e => reject(e));
179
- });
180
- }
181
- exports.compareItems = compareItems;
182
- /**
183
- * Creates a hierarchy of the items in a Solution template.
184
- *
185
- * @param templates Array of templates from a Solution
186
- * @returns List of top-level items, each containing a recursive list of its dependencies
187
- */
188
- function getItemHierarchy(templates) {
189
- const hierarchy = [];
190
- // Get the template specified by id out of a list of templates
191
- function getTemplateInSolution(templates, id) {
192
- const iTemplate = templates.findIndex((template) => id === template.itemId);
193
- return iTemplate >= 0 ? templates[iTemplate] : null;
194
- }
195
- // Hierarchically list the dependencies of specified node
196
- function traceItemId(id, accumulatedHierarchy, alreadyVisitedIds = []) {
197
- // Get the dependencies of the node
198
- const template = getTemplateInSolution(templates, id);
199
- /* istanbul ignore else */
200
- if (template) {
201
- const templateEntry = {
202
- id,
203
- dependencies: []
204
- };
205
- // Visit each dependency, but only if this template is not in the alreadyVisitedIds list to avoid infinite loops
206
- if (alreadyVisitedIds.indexOf(id) < 0) {
207
- // Add dependency to alreadyVisitedIds list
208
- alreadyVisitedIds.push(id);
209
- template.dependencies.forEach(dependencyId => {
210
- // Remove dependency from list of templates to visit in the top-level loop
211
- const iDependencyTemplate = templateItemIds.indexOf(dependencyId);
212
- if (iDependencyTemplate >= 0) {
213
- templateItemIds.splice(iDependencyTemplate, 1);
214
- }
215
- traceItemId(dependencyId, templateEntry.dependencies, alreadyVisitedIds);
216
- });
217
- }
218
- accumulatedHierarchy.push(templateEntry);
219
- }
220
- }
221
- // Start with top-level nodes and add in the rest of the nodes to catch cycles without top-level nodes
222
- let templateItemIds = _getTopLevelItemIds(templates);
223
- const otherItems = templates
224
- .filter(template => templateItemIds.indexOf(template.itemId) < 0) // only keep non-top-level nodes
225
- .sort((a, b) => b.dependencies.length - a.dependencies.length); // sort so that nodes with more dependencies come first--reduces stubs
226
- templateItemIds = templateItemIds.concat(otherItems.map(template => template.itemId));
227
- // Step through the list of nodes; we'll also remove nodes as we visit them
228
- let itemId = templateItemIds.shift();
229
- while (typeof itemId !== "undefined") {
230
- traceItemId(itemId, hierarchy);
231
- itemId = templateItemIds.shift();
232
- }
233
- return hierarchy;
234
- }
235
- exports.getItemHierarchy = getItemHierarchy;
236
- // ------------------------------------------------------------------------------------------------------------------ //
237
- /**
238
- * Finds the top-level items in a Solution template--the items that are not dependencies of any other item.
239
- *
240
- * @param templates Array of templates from a Solution
241
- * @returns List of top-level item ids
242
- * @private
243
- */
244
- function _getTopLevelItemIds(templates) {
245
- // Find the top-level nodes. Start with all nodes, then remove those that other nodes depend on
246
- const topLevelItemCandidateIds = templates.map(function (template) { return template.itemId; });
247
- templates.forEach(function (template) {
248
- (template.dependencies || []).forEach(function (dependencyId) {
249
- const iNode = topLevelItemCandidateIds.indexOf(dependencyId);
250
- /* istanbul ignore else */
251
- if (iNode >= 0) {
252
- // Node is somebody's dependency, so remove the node from the list of top-level nodes
253
- // If iNode == -1, then it's a shared dependency and it has already been removed
254
- topLevelItemCandidateIds.splice(iNode, 1);
255
- }
256
- });
257
- });
258
- return topLevelItemCandidateIds;
259
- }
260
- exports._getTopLevelItemIds = _getTopLevelIt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UAAU,QAAQ;QAClC,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,YAAY;YAC1D,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAE7D,0BAA0B;YAC1B,IAAI,KAAK,IAAI,CAAC,EAAE;gBACd,qFAAqF;gBACrF,gFAAgF;gBAChF,wBAAwB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;aAC3C;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;AAClC,CAAC;AApBD,kDAoBC;AAAA,CAAC"}
@@ -1,21 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Provides the access to the solution's contents.
18
- *
19
- * @module viewer
20
- */
21
- export * from "./viewer";
@@ -1,54 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Provides the access to the solution's contents.
18
- *
19
- * @module viewer
20
- */
21
- import * as common from "@esri/solution-common";
22
- /**
23
- * Checks a Solution.
24
- *
25
- * @param item Solution id
26
- * @param authentication Credentials for the request to AGO
27
- * @returns List of results of checks of Solution
28
- */
29
- export declare function checkSolution(itemId: string, authentication?: common.UserSession): Promise<string[]>;
30
- /**
31
- * Compares two AGO items, fetching them if only their id is supplied.
32
- *
33
- * @param item1 First item or its AGO id
34
- * @param item2 Second item or its AGO id
35
- * @param authentication Credentials for the request to AGO
36
- * @returns True if objects are the same
37
- * @see Only comparable properties are compared; see deleteItemProps() in the `common` package
38
- */
39
- export declare function compareItems(item1: string | any, item2: string | any, authentication?: common.UserSession): Promise<boolean>;
40
- /**
41
- * Creates a hierarchy of the items in a Solution template.
42
- *
43
- * @param templates Array of templates from a Solution
44
- * @returns List of top-level items, each containing a recursive list of its dependencies
45
- */
46
- export declare function getItemHierarchy(templates: common.IItemTemplate[]): common.IHierarchyElement[];
47
- /**
48
- * Finds the top-level items in a Solution template--the items that are not dependencies of any other item.
49
- *
50
- * @param templates Array of templates from a Solution
51
- * @returns List of top-level item ids
52
- * @private
53
- */
54
- export declare function _getTopLevelItemIds(templates: common.IItemTemplate[]): string[];
@@ -1,299 +0,0 @@
1
- /* @preserve
2
- * @esri/solution-viewer - v1.7.0 - Apache-2.0
3
- * Copyright (c) 2018-2023 Esri, Inc.
4
- * Fri Apr 28 2023 11:22:15 GMT-0700 (Pacific Daylight Time)
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- (function (global, factory) {
19
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common')) :
20
- typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common'], factory) :
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);
43
-
44
- /** @license
45
- * Copyright 2018 Esri
46
- *
47
- * Licensed under the Apache License, Version 2.0 (the "License");
48
- * you may not use this file except in compliance with the License.
49
- * You may obtain a copy of the License at
50
- *
51
- * http://www.apache.org/licenses/LICENSE-2.0
52
- *
53
- * Unless required by applicable law or agreed to in writing, software
54
- * distributed under the License is distributed on an "AS IS" BASIS,
55
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56
- * See the License for the specific language governing permissions and
57
- * limitations under the License.
58
- */
59
- // ------------------------------------------------------------------------------------------------------------------ //
60
- /**
61
- * Checks a Solution.
62
- *
63
- * @param item Solution id
64
- * @param authentication Credentials for the request to AGO
65
- * @returns List of results of checks of Solution
66
- */
67
- function checkSolution(itemId, authentication = null) {
68
- const resultsHtml = [`Item ${itemId}`];
69
- let item;
70
- let isTemplate = true;
71
- let templateItems;
72
- let templateItemIds;
73
- let currentAction = " while getting complete item";
74
- return (common__namespace
75
- .getCompleteItem(itemId, authentication)
76
- // ---------- Is it a Template or Deployed Solution? -----------------------------------------------------------//
77
- .then((results) => {
78
- currentAction = "";
79
- item = results;
80
- if (!item) {
81
- throw new Error(`item is not found`);
82
- }
83
- else if (item.base.type !== "Solution") {
84
- throw new Error(`item is not a Solution`);
85
- }
86
- else if (item.base.typeKeywords.includes("Template")) {
87
- resultsHtml.push(`&#x2714; item is a Template Solution`);
88
- }
89
- else if (item.base.typeKeywords.includes("Deployed")) {
90
- isTemplate = false;
91
- resultsHtml.push(`&#x2714; item is a Deployed Solution`);
92
- }
93
- else {
94
- throw new Error(`item is neither a Template Solution nor a Deployed Solution`);
95
- }
96
- // base: IItem; text/plain JSON
97
- // data: File; */*
98
- // thumbnail: File; image/*
99
- // metadata: File; application/xml
100
- // resources: File[]; list of */*
101
- // fwdRelatedItems: IRelatedItems[]; list of forward relationshipType/relatedItems[] pairs
102
- // revRelatedItems: IRelatedItems[]; list of reverse relationshipType/relatedItems[] pairs
103
- return common__namespace.blobToJson(item.data);
104
- })
105
- // ---------- Check the Solution2Item relationship from a Deployed Solution to each deployed item --------------//
106
- .then(itemDataJson => {
107
- templateItems = itemDataJson?.templates;
108
- /* istanbul ignore else */
109
- if (!templateItems || templateItems.length === 0) {
110
- throw new Error(`Solution's data are not valid JSON or the Solution contains no items`);
111
- }
112
- templateItemIds = templateItems
113
- .map((template) => template.itemId)
114
- .sort();
115
- if (!isTemplate) {
116
- // Make sure that there's a Solution2Item relationship to each deployed item
117
- const fwdRelatedItemIds = item.fwdRelatedItems
118
- .filter(relationshipSet => relationshipSet.relationshipType === "Solution2Item")
119
- .reduce((flatSet, relationshipSet) => flatSet.concat(relationshipSet.relatedItemIds), [])
120
- .sort();
121
- if (templateItemIds.length < fwdRelatedItemIds.length) {
122
- resultsHtml.push("&#x2716; there are forward Solution2Item relationship(s) to unknown item(s)");
123
- }
124
- else if (templateItemIds.length > fwdRelatedItemIds.length) {
125
- resultsHtml.push("&#x2716; missing forward Solution2Item relationship(s)");
126
- }
127
- else if (JSON.stringify(templateItemIds) !==
128
- JSON.stringify(fwdRelatedItemIds)) {
129
- resultsHtml.push("&#x2716; mismatching forward Solution2Item relationship(s)");
130
- }
131
- else {
132
- resultsHtml.push("&#x2714; matching forward Solution2Item relationship(s)");
133
- }
134
- }
135
- return resultsHtml;
136
- })
137
- // ---------- Check that all dependency references are items in Solution ---------------------------------------//
138
- .then(() => {
139
- const dependencyIds = templateItems
140
- .reduce((flatSet, template) => flatSet.concat(template.dependencies), [])
141
- .reduce((noDupSet, dependency) => {
142
- /* istanbul ignore else */
143
- if (!noDupSet.includes(dependency))
144
- noDupSet.push(dependency);
145
- return noDupSet;
146
- }, [])
147
- .sort();
148
- const missingItems = dependencyIds.filter((dependencyId) => !templateItemIds.includes(dependencyId));
149
- if (missingItems.length === 0) {
150
- resultsHtml.push("&#x2714; all dependencies are in Solution");
151
- }
152
- else {
153
- resultsHtml.push("&#x2716; dependencies that aren't in Solution: " +
154
- JSON.stringify(missingItems));
155
- }
156
- return resultsHtml;
157
- })
158
- // ---------- Done ---------------------------------------------------------------------------------------------//
159
- .then(() => {
160
- return resultsHtml;
161
- })
162
- // ---------- Fatal error --------------------------------------------------------------------------------------//
163
- .catch(error => {
164
- resultsHtml.push(`&#x2716; error${currentAction}: ${error.message}`);
165
- return resultsHtml;
166
- }));
167
- }
168
- /**
169
- * Compares two AGO items, fetching them if only their id is supplied.
170
- *
171
- * @param item1 First item or its AGO id
172
- * @param item2 Second item or its AGO id
173
- * @param authentication Credentials for the request to AGO
174
- * @returns True if objects are the same
175
- * @see Only comparable properties are compared; see deleteItemProps() in the `common` package
176
- */
177
- function compareItems(item1, item2, authentication = null) {
178
- return new Promise((resolve, reject) => {
179
- // If an input is a string, fetch the item; otherwise, clone the input because we will modify the
180
- // item base to remove incomparable properties
181
- let itemBaseDef1;
182
- if (typeof item1 === "string") {
183
- itemBaseDef1 = common__namespace.getItemBase(item1, authentication);
184
- }
185
- else {
186
- itemBaseDef1 = Promise.resolve(common__namespace.cloneObject(item1));
187
- }
188
- let itemBaseDef2;
189
- if (typeof item2 === "string") {
190
- itemBaseDef2 = common__namespace.getItemBase(item2, authentication);
191
- }
192
- else {
193
- itemBaseDef2 = Promise.resolve(common__namespace.cloneObject(item2));
194
- }
195
- Promise.all([itemBaseDef1, itemBaseDef2]).then(responses => {
196
- const [itemBase1, itemBase2] = responses;
197
- common__namespace.deleteItemProps(itemBase1);
198
- common__namespace.deleteItemProps(itemBase2);
199
- if (itemBase1.type === "Solution") {
200
- delete itemBase1.typeKeywords;
201
- delete itemBase1.size;
202
- delete itemBase2.typeKeywords;
203
- delete itemBase2.size;
204
- }
205
- /*console.log("----------------------------------------------------------------");
206
- console.log("item 1 " + item1 + ": ", JSON.stringify(itemBase1, null, 2));
207
- console.log("item 2 " + item2 + ": ", JSON.stringify(itemBase2, null, 2));
208
- console.log("----------------------------------------------------------------");*/
209
- resolve(common__namespace.compareJSONNoEmptyStrings(itemBase1, itemBase2));
210
- }, e => reject(e));
211
- });
212
- }
213
- /**
214
- * Creates a hierarchy of the items in a Solution template.
215
- *
216
- * @param templates Array of templates from a Solution
217
- * @returns List of top-level items, each containing a recursive list of its dependencies
218
- */
219
- function getItemHierarchy(templates) {
220
- const hierarchy = [];
221
- // Get the template specified by id out of a list of templates
222
- function getTemplateInSolution(templates, id) {
223
- const iTemplate = templates.findIndex((template) => id === template.itemId);
224
- return iTemplate >= 0 ? templates[iTemplate] : null;
225
- }
226
- // Hierarchically list the dependencies of specified node
227
- function traceItemId(id, accumulatedHierarchy, alreadyVisitedIds = []) {
228
- // Get the dependencies of the node
229
- const template = getTemplateInSolution(templates, id);
230
- /* istanbul ignore else */
231
- if (template) {
232
- const templateEntry = {
233
- id,
234
- dependencies: []
235
- };
236
- // Visit each dependency, but only if this template is not in the alreadyVisitedIds list to avoid infinite loops
237
- if (alreadyVisitedIds.indexOf(id) < 0) {
238
- // Add dependency to alreadyVisitedIds list
239
- alreadyVisitedIds.push(id);
240
- template.dependencies.forEach(dependencyId => {
241
- // Remove dependency from list of templates to visit in the top-level loop
242
- const iDependencyTemplate = templateItemIds.indexOf(dependencyId);
243
- if (iDependencyTemplate >= 0) {
244
- templateItemIds.splice(iDependencyTemplate, 1);
245
- }
246
- traceItemId(dependencyId, templateEntry.dependencies, alreadyVisitedIds);
247
- });
248
- }
249
- accumulatedHierarchy.push(templateEntry);
250
- }
251
- }
252
- // Start with top-level nodes and add in the rest of the nodes to catch cycles without top-level nodes
253
- let templateItemIds = _getTopLevelItemIds(templates);
254
- const otherItems = templates
255
- .filter(template => templateItemIds.indexOf(template.itemId) < 0) // only keep non-top-level nodes
256
- .sort((a, b) => b.dependencies.length - a.dependencies.length); // sort so that nodes with more dependencies come first--reduces stubs
257
- templateItemIds = templateItemIds.concat(otherItems.map(template => template.itemId));
258
- // Step through the list of nodes; we'll also remove nodes as we visit them
259
- let itemId = templateItemIds.shift();
260
- while (typeof itemId !== "undefined") {
261
- traceItemId(itemId, hierarchy);
262
- itemId = templateItemIds.shift();
263
- }
264
- return hierarchy;
265
- }
266
- // ------------------------------------------------------------------------------------------------------------------ //
267
- /**
268
- * Finds the top-level items in a Solution template--the items that are not dependencies of any other item.
269
- *
270
- * @param templates Array of templates from a Solution
271
- * @returns List of top-level item ids
272
- * @private
273
- */
274
- function _getTopLevelItemIds(templates) {
275
- // Find the top-level nodes. Start with all nodes, then remove those that other nodes depend on
276
- const topLevelItemCandidateIds = templates.map(function (template) { return template.itemId; });
277
- templates.forEach(function (template) {
278
- (template.dependencies || []).forEach(function (dependencyId) {
279
- const iNode = topLevelItemCandidateIds.indexOf(dependencyId);
280
- /* istanbul ignore else */
281
- if (iNode >= 0) {
282
- // Node is somebody's dependency, so remove the node from the list of top-level nodes
283
- // If iNode == -1, then it's a shared dependency and it has already been removed
284
- topLevelItemCandidateIds.splice(iNode, 1);
285
- }
286
- });
287
- });
288
- return topLevelItemCandidateIds;
289
- }
290
-
291
- exports._getTopLevelItemIds = _getTopLevelItemIds;
292
- exports.checkSolution = checkSolution;
293
- exports.compareItems = compareItems;
294
- exports.getItemHierarchy = getItemHierarchy;
295
-
296
- Object.defineProperty(exports, '__esModule', { value: true });
297
-
298
- }));
299
- //# sourceMappingURL=viewer.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viewer.umd.js","sources":["../../src/viewer.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 * Provides the access to the solution's contents.\r\n *\r\n * @module viewer\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Checks a Solution.\r\n *\r\n * @param item Solution id\r\n * @param authentication Credentials for the request to AGO\r\n * @returns List of results of checks of Solution\r\n */\r\nexport function checkSolution(\r\n itemId: string,\r\n authentication: common.UserSession = null\r\n): Promise<string[]> {\r\n const resultsHtml: string[] = [`Item ${itemId}`];\r\n let item: common.ICompleteItem;\r\n let isTemplate = true;\r\n let templateItems: common.IItemTemplate[];\r\n let templateItemIds: string[];\r\n\r\n let currentAction: string = \" while getting complete item\";\r\n return (\r\n common\r\n .getCompleteItem(itemId, authentication)\r\n\r\n // ---------- Is it a Template or Deployed Solution? -----------------------------------------------------------//\r\n .then((results: common.ICompleteItem) => {\r\n currentAction = \"\";\r\n item = results;\r\n\r\n if (!item) {\r\n throw new Error(`item is not found`);\r\n } else if (item.base.type !== \"Solution\") {\r\n throw new Error(`item is not a Solution`);\r\n } else if (item.base.typeKeywords.includes(\"Template\")) {\r\n resultsHtml.push(`&#x2714; item is a Template Solution`);\r\n } else if (item.base.typeKeywords.includes(\"Deployed\")) {\r\n isTemplate = false;\r\n resultsHtml.push(`&#x2714; item is a Deployed Solution`);\r\n } else {\r\n throw new Error(\r\n `item is neither a Template Solution nor a Deployed Solution`\r\n );\r\n }\r\n\r\n // base: IItem; text/plain JSON\r\n // data: File; */*\r\n // thumbnail: File; image/*\r\n // metadata: File; application/xml\r\n // resources: File[]; list of */*\r\n // fwdRelatedItems: IRelatedItems[]; list of forward relationshipType/relatedItems[] pairs\r\n // revRelatedItems: IRelatedItems[]; list of reverse relationshipType/relatedItems[] pairs\r\n return common.blobToJson(item.data);\r\n })\r\n\r\n // ---------- Check the Solution2Item relationship from a Deployed Solution to each deployed item --------------//\r\n .then(itemDataJson => {\r\n templateItems = itemDataJson?.templates;\r\n /* istanbul ignore else */\r\n if (!templateItems || templateItems.length === 0) {\r\n throw new Error(\r\n `Solution's data are not valid JSON or the Solution contains no items`\r\n );\r\n }\r\n\r\n templateItemIds = templateItems\r\n .map((template: common.IItemTemplate) => template.itemId)\r\n .sort();\r\n\r\n if (!isTemplate) {\r\n // Make sure that there's a Solution2Item relationship to each deployed item\r\n const fwdRelatedItemIds = item.fwdRelatedItems\r\n .filter(\r\n relationshipSet =>\r\n relationshipSet.relationshipType === \"Solution2Item\"\r\n )\r\n .reduce(\r\n (flatSet, relationshipSet) =>\r\n flatSet.concat(relationshipSet.relatedItemIds),\r\n []\r\n )\r\n .sort();\r\n if (templateItemIds.length < fwdRelatedItemIds.length) {\r\n resultsHtml.push(\r\n \"&#x2716; there are forward Solution2Item relationship(s) to unknown item(s)\"\r\n );\r\n } else if (templateItemIds.length > fwdRelatedItemIds.length) {\r\n resultsHtml.push(\r\n \"&#x2716; missing forward Solution2Item relationship(s)\"\r\n );\r\n } else if (\r\n JSON.stringify(templateItemIds) !==\r\n JSON.stringify(fwdRelatedItemIds)\r\n ) {\r\n resultsHtml.push(\r\n \"&#x2716; mismatching forward Solution2Item relationship(s)\"\r\n );\r\n } else {\r\n resultsHtml.push(\r\n \"&#x2714; matching forward Solution2Item relationship(s)\"\r\n );\r\n }\r\n }\r\n return resultsHtml;\r\n })\r\n\r\n // ---------- Check that all dependency references are items in Solution ---------------------------------------//\r\n .then(() => {\r\n const dependencyIds = templateItems\r\n .reduce(\r\n (flatSet, template) => flatSet.concat(template.dependencies),\r\n []\r\n )\r\n .reduce((noDupSet, dependency) => {\r\n /* istanbul ignore else */\r\n if (!noDupSet.includes(dependency)) noDupSet.push(dependency);\r\n return noDupSet;\r\n }, [])\r\n .sort();\r\n\r\n const missingItems = dependencyIds.filter(\r\n (dependencyId: string) => !templateItemIds.includes(dependencyId)\r\n );\r\n\r\n if (missingItems.length === 0) {\r\n resultsHtml.push(\"&#x2714; all dependencies are in Solution\");\r\n } else {\r\n resultsHtml.push(\r\n \"&#x2716; dependencies that aren't in Solution: \" +\r\n JSON.stringify(missingItems)\r\n );\r\n }\r\n\r\n return resultsHtml;\r\n })\r\n\r\n // ---------- Done ---------------------------------------------------------------------------------------------//\r\n .then(() => {\r\n return resultsHtml;\r\n })\r\n\r\n // ---------- Fatal error --------------------------------------------------------------------------------------//\r\n .catch(error => {\r\n resultsHtml.push(`&#x2716; error${currentAction}: ${error.message}`);\r\n return resultsHtml;\r\n })\r\n );\r\n}\r\n\r\n/**\r\n * Compares two AGO items, fetching them if only their id is supplied.\r\n *\r\n * @param item1 First item or its AGO id\r\n * @param item2 Second item or its AGO id\r\n * @param authentication Credentials for the request to AGO\r\n * @returns True if objects are the same\r\n * @see Only comparable properties are compared; see deleteItemProps() in the `common` package\r\n */\r\nexport function compareItems(\r\n item1: string | any,\r\n item2: string | any,\r\n authentication: common.UserSession = null\r\n): Promise<boolean> {\r\n return new Promise<boolean>((resolve, reject) => {\r\n // If an input is a string, fetch the item; otherwise, clone the input because we will modify the\r\n // item base to remove incomparable properties\r\n let itemBaseDef1: Promise<any>;\r\n if (typeof item1 === \"string\") {\r\n itemBaseDef1 = common.getItemBase(item1, authentication);\r\n } else {\r\n itemBaseDef1 = Promise.resolve(common.cloneObject(item1));\r\n }\r\n\r\n let itemBaseDef2: Promise<any>;\r\n if (typeof item2 === \"string\") {\r\n itemBaseDef2 = common.getItemBase(item2, authentication);\r\n } else {\r\n itemBaseDef2 = Promise.resolve(common.cloneObject(item2));\r\n }\r\n\r\n Promise.all([itemBaseDef1, itemBaseDef2]).then(\r\n responses => {\r\n const [itemBase1, itemBase2] = responses;\r\n\r\n common.deleteItemProps(itemBase1);\r\n common.deleteItemProps(itemBase2);\r\n\r\n if (itemBase1.type === \"Solution\") {\r\n delete itemBase1.typeKeywords;\r\n delete itemBase1.size;\r\n delete itemBase2.typeKeywords;\r\n delete itemBase2.size;\r\n }\r\n\r\n /*console.log(\"----------------------------------------------------------------\");\r\n console.log(\"item 1 \" + item1 + \": \", JSON.stringify(itemBase1, null, 2));\r\n console.log(\"item 2 \" + item2 + \": \", JSON.stringify(itemBase2, null, 2));\r\n console.log(\"----------------------------------------------------------------\");*/\r\n\r\n resolve(common.compareJSONNoEmptyStrings(itemBase1, itemBase2));\r\n },\r\n e => reject(e)\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Creates a hierarchy of the items in a Solution template.\r\n *\r\n * @param templates Array of templates from a Solution\r\n * @returns List of top-level items, each containing a recursive list of its dependencies\r\n */\r\nexport function getItemHierarchy(\r\n templates: common.IItemTemplate[]\r\n): common.IHierarchyElement[] {\r\n const hierarchy = [] as common.IHierarchyElement[];\r\n\r\n // Get the template specified by id out of a list of templates\r\n function getTemplateInSolution(templates: common.IItemTemplate[], id: string): common.IItemTemplate {\r\n const iTemplate = templates.findIndex((template) => id === template.itemId);\r\n return iTemplate >= 0 ? templates[iTemplate] : null;\r\n }\r\n\r\n // Hierarchically list the dependencies of specified node\r\n function traceItemId(id: string, accumulatedHierarchy: common.IHierarchyElement[], alreadyVisitedIds: string[] = []) {\r\n // Get the dependencies of the node\r\n const template = getTemplateInSolution(templates, id);\r\n /* istanbul ignore else */\r\n if (template) {\r\n const templateEntry = {\r\n id,\r\n dependencies: [] as common.IHierarchyElement[]\r\n };\r\n\r\n // Visit each dependency, but only if this template is not in the alreadyVisitedIds list to avoid infinite loops\r\n if (alreadyVisitedIds.indexOf(id) < 0) {\r\n // Add dependency to alreadyVisitedIds list\r\n alreadyVisitedIds.push(id);\r\n\r\n template.dependencies.forEach(\r\n dependencyId => {\r\n // Remove dependency from list of templates to visit in the top-level loop\r\n const iDependencyTemplate = templateItemIds.indexOf(dependencyId);\r\n if (iDependencyTemplate >= 0) {\r\n templateItemIds.splice(iDependencyTemplate, 1);\r\n }\r\n\r\n traceItemId(dependencyId, templateEntry.dependencies, alreadyVisitedIds);\r\n }\r\n );\r\n }\r\n accumulatedHierarchy.push(templateEntry);\r\n }\r\n }\r\n\r\n // Start with top-level nodes and add in the rest of the nodes to catch cycles without top-level nodes\r\n let templateItemIds: string[] = _getTopLevelItemIds(templates);\r\n\r\n const otherItems: common.IItemTemplate[] = templates\r\n .filter(template => templateItemIds.indexOf(template.itemId) < 0) // only keep non-top-level nodes\r\n .sort((a, b) => b.dependencies.length - a.dependencies.length); // sort so that nodes with more dependencies come first--reduces stubs\r\n\r\n templateItemIds = templateItemIds.concat(otherItems.map(template => template.itemId));\r\n\r\n // Step through the list of nodes; we'll also remove nodes as we visit them\r\n let itemId = templateItemIds.shift();\r\n while (typeof itemId !== \"undefined\") {\r\n traceItemId(itemId, hierarchy);\r\n itemId = templateItemIds.shift();\r\n }\r\n\r\n return hierarchy;\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Finds the top-level items in a Solution template--the items that are not dependencies of any other item.\r\n *\r\n * @param templates Array of templates from a Solution\r\n * @returns List of top-level item ids\r\n * @private\r\n */\r\nexport function _getTopLevelItemIds(\r\n templates: common.IItemTemplate[]\r\n): string[] {\r\n // Find the top-level nodes. Start with all nodes, then remove those that other nodes depend on\r\n const topLevelItemCandidateIds = templates.map(function (template) { return template.itemId; });\r\n\r\n templates.forEach(function (template) {\r\n (template.dependencies || []).forEach(function (dependencyId) {\r\n const iNode = topLevelItemCandidateIds.indexOf(dependencyId);\r\n\r\n /* istanbul ignore else */\r\n if (iNode >= 0) {\r\n // Node is somebody's dependency, so remove the node from the list of top-level nodes\r\n // If iNode == -1, then it's a shared dependency and it has already been removed\r\n topLevelItemCandidateIds.splice(iNode, 1);\r\n }\r\n });\r\n });\r\n\r\n return topLevelItemCandidateIds;\r\n};\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;EAcG;EAUH;EAEA;;;;;;EAMG;WACa,aAAa,CAC3B,MAAc,EACd,iBAAqC,IAAI,EAAA;EAEzC,IAAA,MAAM,WAAW,GAAa,CAAC,QAAQ,MAAM,CAAA,CAAE,CAAC,CAAC;EACjD,IAAA,IAAI,IAA0B,CAAC;MAC/B,IAAI,UAAU,GAAG,IAAI,CAAC;EACtB,IAAA,IAAI,aAAqC,CAAC;EAC1C,IAAA,IAAI,eAAyB,CAAC;MAE9B,IAAI,aAAa,GAAW,8BAA8B,CAAC;EAC3D,IAAA,QACEA,iBAAM;EACH,SAAA,eAAe,CAAC,MAAM,EAAE,cAAc,CAAC;;EAGvC,SAAA,IAAI,CAAC,CAAC,OAA6B,KAAI;UACtC,aAAa,GAAG,EAAE,CAAC;UACnB,IAAI,GAAG,OAAO,CAAC;UAEf,IAAI,CAAC,IAAI,EAAE;EACT,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,iBAAA,CAAmB,CAAC,CAAC;EACtC,SAAA;EAAM,aAAA,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;EACxC,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,CAAwB,CAAC,CAAC;EAC3C,SAAA;eAAM,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;EACtD,YAAA,WAAW,CAAC,IAAI,CAAC,CAAA,oCAAA,CAAsC,CAAC,CAAC;EAC1D,SAAA;eAAM,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE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QAAQ,EAAI,EAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;EAEhG,IAAA,SAAS,CAAC,OAAO,CAAC,UAAU,QAAQ,EAAA;UAClC,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,EAAE,OAAO,CAAC,UAAU,YAAY,EAAA;cAC1D,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;;cAG7D,IAAI,KAAK,IAAI,CAAC,EAAE;;;EAGd,gBAAA,wBAAwB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;EAC3C,aAAA;EACH,SAAC,CAAC,CAAC;EACL,KAAC,CAAC,CAAC;EAEH,IAAA,OAAO,wBAAwB,CAAC;EAClC;;;;;;;;;;;;;"}
@@ -1,19 +0,0 @@
1
- /* @preserve
2
- * @esri/solution-viewer - v1.7.0 - Apache-2.0
3
- * Copyright (c) 2018-2023 Esri, Inc.
4
- * Fri Apr 28 2023 11:22:19 GMT-0700 (Pacific Daylight Time)
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
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="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=n(t);function i(e){const t=e.map((function(e){return e.itemId}));return e.forEach((function(e){(e.dependencies||[]).forEach((function(e){const n=t.indexOf(e);n>=0&&t.splice(n,1)}))})),t}e._getTopLevelItemIds=i,e.checkSolution=function(e,t=null){const n=[`Item ${e}`];let i,r,s,l=!0,c=" while getting complete item";return o.getCompleteItem(e,t).then((e=>{if(c="",i=e,!i)throw new Error("item is not found");if("Solution"!==i.base.type)throw new Error("item is not a Solution");if(i.base.typeKeywords.includes("Template"))n.push("&#x2714; item is a Template Solution");else{if(!i.base.typeKeywords.includes("Deployed"))throw new Error("item is neither a Template Solution nor a Deployed Solution");l=!1,n.push("&#x2714; item is a Deployed Solution")}return o.blobToJson(i.data)})).then((e=>{if(r=e?.templates,!r||0===r.length)throw new Error("Solution's data are not valid JSON or the Solution contains no items");if(s=r.map((e=>e.itemId)).sort(),!l){const e=i.fwdRelatedItems.filter((e=>"Solution2Item"===e.relationshipType)).reduce(((e,t)=>e.concat(t.relatedItemIds)),[]).sort();s.length<e.length?n.push("&#x2716; there are forward Solution2Item relationship(s) to unknown item(s)"):s.length>e.length?n.push("&#x2716; missing forward Solution2Item relationship(s)"):JSON.stringify(s)!==JSON.stringify(e)?n.push("&#x2716; mismatching forward Solution2Item relationship(s)"):n.push("&#x2714; matching forward Solution2Item relationship(s)")}return n})).then((()=>{const e=r.reduce(((e,t)=>e.concat(t.dependencies)),[]).reduce(((e,t)=>(e.includes(t)||e.push(t),e)),[]).sort().filter((e=>!s.includes(e)));return 0===e.length?n.push("&#x2714; all dependencies are in Solution"):n.push("&#x2716; dependencies that aren't in Solution: "+JSON.stringify(e)),n})).then((()=>n)).catch((e=>(n.push(`&#x2716; error${c}: ${e.message}`),n)))},e.compareItems=function(e,t,n=null){return new Promise(((i,r)=>{let s,l;s="string"==typeof e?o.getItemBase(e,n):Promise.resolve(o.cloneObject(e)),l="string"==typeof t?o.getItemBase(t,n):Promise.resolve(o.cloneObject(t)),Promise.all([s,l]).then((e=>{const[t,n]=e;o.deleteItemProps(t),o.deleteItemProps(n),"Solution"===t.type&&(delete t.typeKeywords,delete t.size,delete n.typeKeywords,delete n.size),i(o.compareJSONNoEmptyStrings(t,n))}),(e=>r(e)))}))},e.getItemHierarchy=function(e){const t=[];function n(t,i,r=[]){const s=function(e,t){const n=e.findIndex((e=>t===e.itemId));return n>=0?e[n]:null}(e,t);if(s){const e={id:t,dependencies:[]};r.indexOf(t)<0&&(r.push(t),s.dependencies.forEach((t=>{const i=o.indexOf(t);i>=0&&o.splice(i,1),n(t,e.dependencies,r)}))),i.push(e)}}let o=i(e);const r=e.filter((e=>o.indexOf(e.itemId)<0)).sort(((e,t)=>t.dependencies.length-e.dependencies.length));o=o.concat(r.map((e=>e.itemId)));let s=o.shift();for(;void 0!==s;)n(s,t),s=o.shift();return t},Object.defineProperty(e,"__esModule",{value:!0})}));
19
- //# sourceMappingURL=viewer.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viewer.umd.min.js","sources":["../../src/viewer.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 * Provides the access to the solution's contents.\r\n *\r\n * @module viewer\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Checks a Solution.\r\n *\r\n * @param item Solution id\r\n * @param authentication Credentials for the request to AGO\r\n * @returns List of results of checks of Solution\r\n */\r\nexport function checkSolution(\r\n itemId: string,\r\n authentication: common.UserSession = null\r\n): Promise<string[]> {\r\n const resultsHtml: string[] = [`Item ${itemId}`];\r\n let item: common.ICompleteItem;\r\n let isTemplate = true;\r\n let templateItems: common.IItemTemplate[];\r\n let templateItemIds: string[];\r\n\r\n let currentAction: string = \" while getting complete item\";\r\n return (\r\n common\r\n .getCompleteItem(itemId, authentication)\r\n\r\n // ---------- Is it a Template or Deployed Solution? -----------------------------------------------------------//\r\n .then((results: common.ICompleteItem) => {\r\n currentAction = \"\";\r\n item = results;\r\n\r\n if (!item) {\r\n throw new Error(`item is not found`);\r\n } else if (item.base.type !== \"Solution\") {\r\n throw new Error(`item is not a Solution`);\r\n } else if (item.base.typeKeywords.includes(\"Template\")) {\r\n resultsHtml.push(`&#x2714; item is a Template Solution`);\r\n } else if (item.base.typeKeywords.includes(\"Deployed\")) {\r\n isTemplate = false;\r\n resultsHtml.push(`&#x2714; item is a Deployed Solution`);\r\n } else {\r\n throw new Error(\r\n `item is neither a Template Solution nor a Deployed Solution`\r\n );\r\n }\r\n\r\n // base: IItem; text/plain JSON\r\n // data: File; */*\r\n // thumbnail: File; image/*\r\n // metadata: File; application/xml\r\n // resources: File[]; list of */*\r\n // fwdRelatedItems: IRelatedItems[]; list of forward relationshipType/relatedItems[] pairs\r\n // revRelatedItems: IRelatedItems[]; list of reverse relationshipType/relatedItems[] pairs\r\n return common.blobToJson(item.data);\r\n })\r\n\r\n // ---------- Check the Solution2Item relationship from a Deployed Solution to each deployed item --------------//\r\n .then(itemDataJson => {\r\n templateItems = itemDataJson?.templates;\r\n /* istanbul ignore else */\r\n if (!templateItems || templateItems.length === 0) {\r\n throw new Error(\r\n `Solution's data are not valid JSON or the Solution contains no items`\r\n );\r\n }\r\n\r\n templateItemIds = templateItems\r\n .map((template: common.IItemTemplate) => template.itemId)\r\n .sort();\r\n\r\n if (!isTemplate) {\r\n // Make sure that there's a Solution2Item relationship to each deployed item\r\n const fwdRelatedItemIds = item.fwdRelatedItems\r\n .filter(\r\n relationshipSet =>\r\n relationshipSet.relationshipType === \"Solution2Item\"\r\n )\r\n .reduce(\r\n (flatSet, relationshipSet) =>\r\n flatSet.concat(relationshipSet.relatedItemIds),\r\n []\r\n )\r\n .sort();\r\n if (templateItemIds.length < fwdRelatedItemIds.length) {\r\n resultsHtml.push(\r\n \"&#x2716; there are forward Solution2Item relationship(s) to unknown item(s)\"\r\n );\r\n } else if (templateItemIds.length > fwdRelatedItemIds.length) {\r\n resultsHtml.push(\r\n \"&#x2716; missing forward Solution2Item relationship(s)\"\r\n );\r\n } else if (\r\n JSON.stringify(templateItemIds) !==\r\n JSON.stringify(fwdRelatedItemIds)\r\n ) {\r\n resultsHtml.push(\r\n \"&#x2716; mismatching forward Solution2Item relationship(s)\"\r\n );\r\n } else {\r\n resultsHtml.push(\r\n \"&#x2714; matching forward Solution2Item relationship(s)\"\r\n );\r\n }\r\n }\r\n return resultsHtml;\r\n })\r\n\r\n // ---------- Check that all dependency references are items in Solution ---------------------------------------//\r\n .then(() => {\r\n const dependencyIds = templateItems\r\n .reduce(\r\n (flatSet, template) => flatSet.concat(template.dependencies),\r\n []\r\n )\r\n .reduce((noDupSet, dependency) => {\r\n /* istanbul ignore else */\r\n if (!noDupSet.includes(dependency)) noDupSet.push(dependency);\r\n return noDupSet;\r\n }, [])\r\n .sort();\r\n\r\n const missingItems = dependencyIds.filter(\r\n (dependencyId: string) => !templateItemIds.includes(dependencyId)\r\n );\r\n\r\n if (missingItems.length === 0) {\r\n resultsHtml.push(\"&#x2714; all dependencies are in Solution\");\r\n } else {\r\n resultsHtml.push(\r\n \"&#x2716; dependencies that aren't in Solution: \" +\r\n JSON.stringify(missingItems)\r\n );\r\n }\r\n\r\n return resultsHtml;\r\n })\r\n\r\n // ---------- Done ---------------------------------------------------------------------------------------------//\r\n .then(() => {\r\n return resultsHtml;\r\n })\r\n\r\n // ---------- Fatal error --------------------------------------------------------------------------------------//\r\n .catch(error => {\r\n resultsHtml.push(`&#x2716; error${currentAction}: ${error.message}`);\r\n return resultsHtml;\r\n })\r\n );\r\n}\r\n\r\n/**\r\n * Compares two AGO items, fetching them if only their id is supplied.\r\n *\r\n * @param item1 First item or its AGO id\r\n * @param item2 Second item or its AGO id\r\n * @param authentication Credentials for the request to AGO\r\n * @returns True if objects are the same\r\n * @see Only comparable properties are compared; see deleteItemProps() in the `common` package\r\n */\r\nexport function compareItems(\r\n item1: string | any,\r\n item2: string | any,\r\n authentication: common.UserSession = null\r\n): Promise<boolean> {\r\n return new Promise<boolean>((resolve, reject) => {\r\n // If an input is a string, fetch the item; otherwise, clone the input because we will modify the\r\n // item base to remove incomparable properties\r\n let itemBaseDef1: Promise<any>;\r\n if (typeof item1 === \"string\") {\r\n itemBaseDef1 = common.getItemBase(item1, authentication);\r\n } else {\r\n itemBaseDef1 = Promise.resolve(common.cloneObject(item1));\r\n }\r\n\r\n let itemBaseDef2: Promise<any>;\r\n if (typeof item2 === \"string\") {\r\n itemBaseDef2 = common.getItemBase(item2, authentication);\r\n } else {\r\n itemBaseDef2 = Promise.resolve(common.cloneObject(item2));\r\n }\r\n\r\n Promise.all([itemBaseDef1, itemBaseDef2]).then(\r\n responses => {\r\n const [itemBase1, itemBase2] = responses;\r\n\r\n common.deleteItemProps(itemBase1);\r\n common.deleteItemProps(itemBase2);\r\n\r\n if (itemBase1.type === \"Solution\") {\r\n delete itemBase1.typeKeywords;\r\n delete itemBase1.size;\r\n delete itemBase2.typeKeywords;\r\n delete itemBase2.size;\r\n }\r\n\r\n /*console.log(\"----------------------------------------------------------------\");\r\n console.log(\"item 1 \" + item1 + \": \", JSON.stringify(itemBase1, null, 2));\r\n console.log(\"item 2 \" + item2 + \": \", JSON.stringify(itemBase2, null, 2));\r\n console.log(\"----------------------------------------------------------------\");*/\r\n\r\n resolve(common.compareJSONNoEmptyStrings(itemBase1, itemBase2));\r\n },\r\n e => reject(e)\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Creates a hierarchy of the items in a Solution template.\r\n *\r\n * @param templates Array of templates from a Solution\r\n * @returns List of top-level items, each containing a recursive list of its dependencies\r\n */\r\nexport function getItemHierarchy(\r\n templates: common.IItemTemplate[]\r\n): common.IHierarchyElement[] {\r\n const hierarchy = [] as common.IHierarchyElement[];\r\n\r\n // Get the template specified by id out of a list of templates\r\n function getTemplateInSolution(templates: common.IItemTemplate[], id: string): common.IItemTemplate {\r\n const iTemplate = templates.findIndex((template) => id === template.itemId);\r\n return iTemplate >= 0 ? templates[iTemplate] : null;\r\n }\r\n\r\n // Hierarchically list the dependencies of specified node\r\n function traceItemId(id: string, accumulatedHierarchy: common.IHierarchyElement[], alreadyVisitedIds: string[] = []) {\r\n // Get the dependencies of the node\r\n const template = getTemplateInSolution(templates, id);\r\n /* istanbul ignore else */\r\n if (template) {\r\n const templateEntry = {\r\n id,\r\n dependencies: [] as common.IHierarchyElement[]\r\n };\r\n\r\n // Visit each dependency, but only if this template is not in the alreadyVisitedIds list to avoid infinite loops\r\n if (alreadyVisitedIds.indexOf(id) < 0) {\r\n // Add dependency to alreadyVisitedIds list\r\n alreadyVisitedIds.push(id);\r\n\r\n template.dependencies.forEach(\r\n dependencyId => {\r\n // Remove dependency from list of templates to visit in the top-level loop\r\n const iDependencyTemplate = templateItemIds.indexOf(dependencyId);\r\n if (iDependencyTemplate >= 0) {\r\n templateItemIds.splice(iDependencyTemplate, 1);\r\n }\r\n\r\n traceItemId(dependencyId, templateEntry.dependencies, alreadyVisitedIds);\r\n }\r\n );\r\n }\r\n accumulatedHierarchy.push(templateEntry);\r\n }\r\n }\r\n\r\n // Start with top-level nodes and add in the rest of the nodes to catch cycles without top-level nodes\r\n let templateItemIds: string[] = _getTopLevelItemIds(templates);\r\n\r\n const otherItems: common.IItemTemplate[] = templates\r\n .filter(template => templateItemIds.indexOf(template.itemId) < 0) // only keep non-top-level nodes\r\n .sort((a, b) => b.dependencies.length - a.dependencies.length); // sort so that nodes with more dependencies come first--reduces stubs\r\n\r\n templateItemIds = templateItemIds.concat(otherItems.map(template => template.itemId));\r\n\r\n // Step through the list of nodes; we'll also remove nodes as we visit them\r\n let itemId = templateItemIds.shift();\r\n while (typeof itemId !== \"undefined\") {\r\n traceItemId(itemId, hierarchy);\r\n itemId = templateItemIds.shift();\r\n }\r\n\r\n return hierarchy;\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Finds the top-level items in a Solution template--the items that are not dependencies of any other item.\r\n *\r\n * @param templates Array of templates from a Solution\r\n * @returns List of top-level item ids\r\n * @private\r\n */\r\nexport function _getTopLevelItemIds(\r\n templates: common.IItemTemplate[]\r\n): string[] {\r\n // Find the top-level nodes. Start with all nodes, then remove those that other nodes depend on\r\n const topLevelItemCandidateIds = templates.map(function (template) { return template.itemId; });\r\n\r\n templates.forEach(function (template) {\r\n (template.dependencies || []).forEach(function (dependencyId) {\r\n const iNode = topLevelItemCandidateIds.indexOf(dependencyId);\r\n\r\n /* istanbul ignore else */\r\n if (iNode >= 0) {\r\n // Node is somebody's dependency, so remove the node from the list of top-level nodes\r\n // If iNode == -1, then it's a shared dependency and it has already been removed\r\n topLevelItemCandidateIds.splice(iNode, 1);\r\n }\r\n });\r\n });\r\n\r\n return topLevelItemCandidateIds;\r\n};\r\n"],"names":["_getTopLevelItemIds","templates","topLevelItemCandidateIds","map","template","itemId","forEach","dependencies","dependencyId","iNode","indexOf","splice","authentication","resultsHtml","item","templateItems","templateItemIds","isTemplate","currentAction","common","getCompleteItem","then","results","Error","base","type","typeKeywords","includes","push","blobToJson","data","itemDataJson","length","sort","fwdRelatedItemIds","fwdRelatedItems","filter","relationshipSet","relationshipType","reduce","flatSet","concat","relatedItemIds","JSON","stringify","missingItems","noDupSet","dependency","catch","error","message","item1","item2","Promise","resolve","reject","itemBaseDef1","itemBaseDef2","getItemBase","cloneObject","all","responses","itemBase1","itemBase2","deleteItemProps","size","compareJSONNoEmptyStrings","e","hierarchy","traceItemId","id","accumulatedHierarchy","alreadyVisited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