@esri/solution-deployer 1.5.2 → 1.6.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/dist/esm/deploySolutionItems.d.ts +9 -5
- package/dist/esm/deploySolutionItems.js +35 -15
- package/dist/esm/deploySolutionItems.js.map +1 -1
- package/dist/node/deploySolutionItems.d.ts +9 -5
- package/dist/node/deploySolutionItems.js +35 -15
- package/dist/node/deploySolutionItems.js.map +1 -1
- package/dist/umd/deployer/src/deploySolutionItems.d.ts +9 -5
- package/dist/umd/deployer.umd.js +37 -17
- package/dist/umd/deployer.umd.js.map +1 -1
- package/dist/umd/deployer.umd.min.js +3 -3
- package/dist/umd/deployer.umd.min.js.map +1 -1
- package/package.json +12 -12
package/dist/umd/deployer.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-deployer - v1.
|
|
2
|
+
* @esri/solution-deployer - v1.6.0 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Thu Nov 10 2022 06:36:47 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.
|
|
@@ -515,11 +515,15 @@
|
|
|
515
515
|
function _reuseDeployedItems(templates, reuseItems, templateDictionary, authentication) {
|
|
516
516
|
return new Promise((resolve, reject) => {
|
|
517
517
|
if (reuseItems) {
|
|
518
|
-
const
|
|
518
|
+
const findItemsByKeywordResponse = _findExistingItemByKeyword(templates, templateDictionary, authentication);
|
|
519
|
+
const existingItemsByKeyword = findItemsByKeywordResponse.existingItemsDefs;
|
|
520
|
+
const existingItemInfos = findItemsByKeywordResponse.existingItemInfos;
|
|
519
521
|
Promise.all(existingItemsByKeyword).then((existingItemsByKeywordResponse) => {
|
|
520
|
-
const
|
|
522
|
+
const findExistingItemsByTag = _handleExistingItems(existingItemsByKeywordResponse, existingItemInfos, templateDictionary, authentication, true);
|
|
523
|
+
const existingItemsByTag = findExistingItemsByTag.existingItemsDefs;
|
|
524
|
+
const existingItemInfosByTag = findExistingItemsByTag.existingItemInfos;
|
|
521
525
|
Promise.all(existingItemsByTag).then(existingItemsByTagResponse => {
|
|
522
|
-
_handleExistingItems(existingItemsByTagResponse, templateDictionary, authentication, false);
|
|
526
|
+
_handleExistingItems(existingItemsByTagResponse, existingItemInfosByTag, templateDictionary, authentication, false);
|
|
523
527
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
524
528
|
_updateTemplateDictionary(templates, templateDictionary, authentication).then(resolve);
|
|
525
529
|
}, e => reject(common__namespace.fail(e)));
|
|
@@ -802,18 +806,21 @@
|
|
|
802
806
|
* Optionally search by tags and then update the templateDictionary based on the search results
|
|
803
807
|
*
|
|
804
808
|
* @param existingItemsResponse response object from search by typeKeyword and type
|
|
809
|
+
* @param existingItemIds list of the template ids we have queried
|
|
805
810
|
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
806
811
|
* @param authentication Credentials for the request
|
|
807
812
|
* @param addTagQuery Boolean to indicate if a search by tag should happen
|
|
808
|
-
* @returns
|
|
813
|
+
* @returns IFindExistingItemsResponse object with promise that will resolve with an array of results
|
|
814
|
+
* and an array of item ids
|
|
809
815
|
* @private
|
|
810
816
|
*/
|
|
811
|
-
function _handleExistingItems(existingItemsResponse, templateDictionary, authentication, addTagQuery) {
|
|
817
|
+
function _handleExistingItems(existingItemsResponse, existingItemInfos, templateDictionary, authentication, addTagQuery) {
|
|
812
818
|
// if items are not found by type keyword search by tag
|
|
813
819
|
const existingItemsByTag = [Promise.resolve(null)];
|
|
820
|
+
const existingItemInfosByTag = [undefined];
|
|
814
821
|
/* istanbul ignore else */
|
|
815
822
|
if (existingItemsResponse && Array.isArray(existingItemsResponse)) {
|
|
816
|
-
existingItemsResponse.forEach(existingItem => {
|
|
823
|
+
existingItemsResponse.forEach((existingItem, i) => {
|
|
817
824
|
/* istanbul ignore else */
|
|
818
825
|
if (Array.isArray(existingItem?.results)) {
|
|
819
826
|
let result;
|
|
@@ -825,15 +832,15 @@
|
|
|
825
832
|
result = results.reduce((a, b) => a.created > b.created ? a : b);
|
|
826
833
|
}
|
|
827
834
|
else {
|
|
828
|
-
if (addTagQuery &&
|
|
829
|
-
const
|
|
835
|
+
if (addTagQuery && existingItemInfos[i]) {
|
|
836
|
+
const itemInfo = existingItemInfos[i];
|
|
837
|
+
const tagQuery = `tags:source-${itemInfo.itemId} type:${itemInfo.type} owner:${templateDictionary.user.username}`;
|
|
830
838
|
existingItemsByTag.push(_findExistingItem(tagQuery, authentication));
|
|
839
|
+
existingItemInfosByTag.push(existingItemInfos[i]);
|
|
831
840
|
}
|
|
832
841
|
}
|
|
833
842
|
if (result) {
|
|
834
|
-
const sourceId =
|
|
835
|
-
? existingItem.query.match(/[0-9A-F]{32}/i)[0]
|
|
836
|
-
: existingItem.sourceId;
|
|
843
|
+
const sourceId = existingItemInfos[i].itemId;
|
|
837
844
|
/* istanbul ignore else */
|
|
838
845
|
if (sourceId) {
|
|
839
846
|
_updateTemplateDictionaryById(templateDictionary, sourceId, result.id, result);
|
|
@@ -842,7 +849,10 @@
|
|
|
842
849
|
}
|
|
843
850
|
});
|
|
844
851
|
}
|
|
845
|
-
return
|
|
852
|
+
return {
|
|
853
|
+
existingItemsDefs: existingItemsByTag,
|
|
854
|
+
existingItemInfos: existingItemInfosByTag
|
|
855
|
+
};
|
|
846
856
|
}
|
|
847
857
|
//???
|
|
848
858
|
function _updateTemplateDictionaryById(templateDictionary, sourceId, itemId, v) {
|
|
@@ -857,13 +867,16 @@
|
|
|
857
867
|
/**
|
|
858
868
|
* Search items based on user query
|
|
859
869
|
*
|
|
860
|
-
* @param
|
|
870
|
+
* @param templates Templates to examine
|
|
871
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
861
872
|
* @param authentication Credentials for the request
|
|
862
|
-
* @returns
|
|
873
|
+
* @returns IFindExistingItemsResponse object with promise that will resolve with an array of results
|
|
874
|
+
* and an array of item ids
|
|
863
875
|
* @private
|
|
864
876
|
*/
|
|
865
877
|
function _findExistingItemByKeyword(templates, templateDictionary, authentication) {
|
|
866
878
|
const existingItemsDefs = [];
|
|
879
|
+
const existingItemInfos = [];
|
|
867
880
|
templates.forEach(template => {
|
|
868
881
|
if (template.item.type === "Group") {
|
|
869
882
|
const userGroups = templateDictionary.user?.groups;
|
|
@@ -883,8 +896,15 @@
|
|
|
883
896
|
else {
|
|
884
897
|
existingItemsDefs.push(_findExistingItem(`typekeywords:source-${template.itemId} type:${template.item.type} owner:${templateDictionary.user.username}`, authentication));
|
|
885
898
|
}
|
|
899
|
+
existingItemInfos.push({
|
|
900
|
+
itemId: template.itemId,
|
|
901
|
+
type: template.item.type
|
|
902
|
+
});
|
|
886
903
|
});
|
|
887
|
-
return
|
|
904
|
+
return {
|
|
905
|
+
existingItemsDefs,
|
|
906
|
+
existingItemInfos
|
|
907
|
+
};
|
|
888
908
|
}
|
|
889
909
|
/**
|
|
890
910
|
* Search items based on user query
|