@esri/solution-simple-types 3.0.0 → 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.
Files changed (69) hide show
  1. package/dist/esm/helpers/convert-item-to-template.js +1 -0
  2. package/dist/esm/helpers/convert-item-to-template.js.map +1 -1
  3. package/dist/esm/webmap.js +6 -5
  4. package/dist/esm/webmap.js.map +1 -1
  5. package/package.json +7 -7
  6. package/dist/node/dashboard.d.ts +0 -93
  7. package/dist/node/dashboard.js +0 -354
  8. package/dist/node/dashboard.js.map +0 -1
  9. package/dist/node/helpers/convert-item-to-template.d.ts +0 -39
  10. package/dist/node/helpers/convert-item-to-template.js +0 -184
  11. package/dist/node/helpers/convert-item-to-template.js.map +0 -1
  12. package/dist/node/helpers/create-item-from-template.d.ts +0 -17
  13. package/dist/node/helpers/create-item-from-template.js +0 -138
  14. package/dist/node/helpers/create-item-from-template.js.map +0 -1
  15. package/dist/node/helpers/notebook-helpers.d.ts +0 -19
  16. package/dist/node/helpers/notebook-helpers.js +0 -25
  17. package/dist/node/helpers/notebook-helpers.js.map +0 -1
  18. package/dist/node/helpers/quickcapture-helpers.d.ts +0 -18
  19. package/dist/node/helpers/quickcapture-helpers.js +0 -23
  20. package/dist/node/helpers/quickcapture-helpers.js.map +0 -1
  21. package/dist/node/helpers/simple-type-helpers.d.ts +0 -18
  22. package/dist/node/helpers/simple-type-helpers.js +0 -23
  23. package/dist/node/helpers/simple-type-helpers.js.map +0 -1
  24. package/dist/node/helpers/update-notebook-data.d.ts +0 -17
  25. package/dist/node/helpers/update-notebook-data.js +0 -28
  26. package/dist/node/helpers/update-notebook-data.js.map +0 -1
  27. package/dist/node/index.d.ts +0 -27
  28. package/dist/node/index.js +0 -37
  29. package/dist/node/index.js.map +0 -1
  30. package/dist/node/notebook.d.ts +0 -66
  31. package/dist/node/notebook.js +0 -134
  32. package/dist/node/notebook.js.map +0 -1
  33. package/dist/node/oic.d.ts +0 -53
  34. package/dist/node/oic.js +0 -171
  35. package/dist/node/oic.js.map +0 -1
  36. package/dist/node/quickcapture.d.ts +0 -87
  37. package/dist/node/quickcapture.js +0 -193
  38. package/dist/node/quickcapture.js.map +0 -1
  39. package/dist/node/simple-types.d.ts +0 -57
  40. package/dist/node/simple-types.js +0 -95
  41. package/dist/node/simple-types.js.map +0 -1
  42. package/dist/node/webmap.d.ts +0 -101
  43. package/dist/node/webmap.js +0 -273
  44. package/dist/node/webmap.js.map +0 -1
  45. package/dist/node/webmappingapplication.d.ts +0 -176
  46. package/dist/node/webmappingapplication.js +0 -675
  47. package/dist/node/webmappingapplication.js.map +0 -1
  48. package/dist/node/workforce.d.ts +0 -34
  49. package/dist/node/workforce.js +0 -45
  50. package/dist/node/workforce.js.map +0 -1
  51. package/dist/umd/simple-types/src/dashboard.d.ts +0 -93
  52. package/dist/umd/simple-types/src/helpers/convert-item-to-template.d.ts +0 -39
  53. package/dist/umd/simple-types/src/helpers/create-item-from-template.d.ts +0 -17
  54. package/dist/umd/simple-types/src/helpers/notebook-helpers.d.ts +0 -19
  55. package/dist/umd/simple-types/src/helpers/quickcapture-helpers.d.ts +0 -18
  56. package/dist/umd/simple-types/src/helpers/simple-type-helpers.d.ts +0 -18
  57. package/dist/umd/simple-types/src/helpers/update-notebook-data.d.ts +0 -17
  58. package/dist/umd/simple-types/src/index.d.ts +0 -27
  59. package/dist/umd/simple-types/src/notebook.d.ts +0 -66
  60. package/dist/umd/simple-types/src/oic.d.ts +0 -53
  61. package/dist/umd/simple-types/src/quickcapture.d.ts +0 -87
  62. package/dist/umd/simple-types/src/simple-types.d.ts +0 -57
  63. package/dist/umd/simple-types/src/webmap.d.ts +0 -101
  64. package/dist/umd/simple-types/src/webmappingapplication.d.ts +0 -176
  65. package/dist/umd/simple-types/src/workforce.d.ts +0 -34
  66. package/dist/umd/simple-types.umd.js +0 -2296
  67. package/dist/umd/simple-types.umd.js.map +0 -1
  68. package/dist/umd/simple-types.umd.min.js +0 -19
  69. package/dist/umd/simple-types.umd.min.js.map +0 -1
@@ -1,66 +0,0 @@
1
- /** @license
2
- * Copyright 2020 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
- import * as common from "@esri/solution-common";
17
- /**
18
- * Converts a notebook item into a template.
19
- *
20
- * @param solutionItemId The solution to contain the template
21
- * @param itemInfo Info about the item
22
- * @param destAuthentication Credentials for requests to the destination organization
23
- * @param srcAuthentication Credentials for requests to source items
24
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
25
- * @returns A promise that will resolve when the template has been created
26
- */
27
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary: any): Promise<common.IItemTemplate>;
28
- export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
29
- /**
30
- * Converts a Python Notebook item to a template.
31
- *
32
- * @param itemTemplate template for the Python Notebook
33
- * @returns templatized itemTemplate
34
- */
35
- export declare function convertNotebookToTemplate(itemTemplate: common.IItemTemplate): common.IItemTemplate;
36
- /**
37
- * Remove interpreter and papermill props
38
- *
39
- * This function will update the data passed in by removing key props
40
- *
41
- * @param data The notebooks data object
42
- *
43
- */
44
- export declare function deleteProps(data: any): void;
45
- /**
46
- * Update the notebooks data
47
- *
48
- * @param originalTemplate The original template item
49
- * @param newlyCreatedItem The current item that may have unswapped variables
50
- * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
51
- * @param authentication Credentials for the requests to the destination
52
- *
53
- * @returns A promise that will resolve once any updates have been made
54
- */
55
- export declare function fineTuneCreatedItem(originalTemplate: common.IItemTemplate, newlyCreatedItem: common.IItemTemplate, templateDictionary: any, authentication: common.UserSession): Promise<void>;
56
- /**
57
- * Notebook specific post-processing actions
58
- *
59
- * @param {string} itemId The item ID
60
- * @param {string} type The template type
61
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
62
- * @param {any} templateDictionary The template dictionary
63
- * @param {UserSession} authentication The destination session info
64
- * @returns {Promise<any>}
65
- */
66
- export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: common.IItemTemplate, templates: common.IItemTemplate[], templateDictionary: any, authentication: common.UserSession): Promise<any>;
@@ -1,134 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2020 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.postProcess = exports.fineTuneCreatedItem = exports.deleteProps = exports.convertNotebookToTemplate = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
- const tslib_1 = require("tslib");
20
- const common = tslib_1.__importStar(require("@esri/solution-common"));
21
- // Need to import collectively to enable spying
22
- const notebookHelpers = tslib_1.__importStar(require("./helpers/notebook-helpers"));
23
- /**
24
- * Converts a notebook item into a template.
25
- *
26
- * @param solutionItemId The solution to contain the template
27
- * @param itemInfo Info about the item
28
- * @param destAuthentication Credentials for requests to the destination organization
29
- * @param srcAuthentication Credentials for requests to source items
30
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
31
- * @returns A promise that will resolve when the template has been created
32
- */
33
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
34
- // Delegate back to simple-types, which will in-turn delegate
35
- // to convertNotebookToTemplate at the correct point in the process
36
- // This is a temporary refactor step
37
- return notebookHelpers.convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
38
- }
39
- exports.convertItemToTemplate = convertItemToTemplate;
40
- // Delegate back to simple-types
41
- // This is a temporary refactor step
42
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
43
- return notebookHelpers.createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
44
- }
45
- exports.createItemFromTemplate = createItemFromTemplate;
46
- /**
47
- * Converts a Python Notebook item to a template.
48
- *
49
- * @param itemTemplate template for the Python Notebook
50
- * @returns templatized itemTemplate
51
- */
52
- function convertNotebookToTemplate(itemTemplate) {
53
- // The templates data to process
54
- const data = itemTemplate.data;
55
- deleteProps(data);
56
- let dataString = JSON.stringify(data);
57
- const idTest = /[0-9A-F]{32}/gim;
58
- if (data && idTest.test(dataString)) {
59
- const ids = dataString.match(idTest);
60
- const verifiedIds = [];
61
- ids.forEach(id => {
62
- if (verifiedIds.indexOf(id) === -1) {
63
- verifiedIds.push(id);
64
- // templatize the itemId--but only once per unique id
65
- const regEx = new RegExp(id, "gm");
66
- dataString = dataString.replace(regEx, "{{" + id + ".itemId}}");
67
- // update the dependencies
68
- if (itemTemplate.dependencies.indexOf(id) === -1) {
69
- itemTemplate.dependencies.push(id);
70
- }
71
- }
72
- });
73
- itemTemplate.data = JSON.parse(dataString);
74
- }
75
- return itemTemplate;
76
- }
77
- exports.convertNotebookToTemplate = convertNotebookToTemplate;
78
- /**
79
- * Remove interpreter and papermill props
80
- *
81
- * This function will update the data passed in by removing key props
82
- *
83
- * @param data The notebooks data object
84
- *
85
- */
86
- function deleteProps(data) {
87
- /* istanbul ignore else */
88
- if (data) {
89
- const props = ["metadata.interpreter", "metadata.papermill"];
90
- common.deleteProps(data, props);
91
- (data.cells || []).forEach((cell) => {
92
- common.deleteProps(cell, props);
93
- });
94
- }
95
- }
96
- exports.deleteProps = deleteProps;
97
- /**
98
- * Update the notebooks data
99
- *
100
- * @param originalTemplate The original template item
101
- * @param newlyCreatedItem The current item that may have unswapped variables
102
- * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
103
- * @param authentication Credentials for the requests to the destination
104
- *
105
- * @returns A promise that will resolve once any updates have been made
106
- */
107
- function fineTuneCreatedItem(originalTemplate, newlyCreatedItem, templateDictionary, authentication) {
108
- return new Promise((resolve, reject) => {
109
- const updateOptions = {
110
- id: newlyCreatedItem.itemId,
111
- url: newlyCreatedItem.item.url,
112
- data: common.jsonToFile(newlyCreatedItem.data, newlyCreatedItem.itemId + ".ipynb")
113
- };
114
- common
115
- .updateItem(updateOptions, authentication)
116
- .then(() => resolve(null), reject);
117
- });
118
- }
119
- exports.fineTuneCreatedItem = fineTuneCreatedItem;
120
- /**
121
- * Notebook specific post-processing actions
122
- *
123
- * @param {string} itemId The item ID
124
- * @param {string} type The template type
125
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
126
- * @param {any} templateDictionary The template dictionary
127
- * @param {UserSession} authentication The destination session info
128
- * @returns {Promise<any>}
129
- */
130
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
131
- return common.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
132
- }
133
- exports.postProcess = postProcess;
134
- //# sourceMappingURL=notebook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notebook.js","sourceRoot":"","sources":["../../src/notebook.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAChD,+CAA+C;AAC/C,oFAA8D;AAE9D;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iB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,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,kDAmBC;AAED;;;;;;;;;GASG;AACH,SAAgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAkC;IAElC,OAAO,MAAM,CAAC,gCAAgC,CAC5C,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC;AAdD,kCAcC"}
@@ -1,53 +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
- import * as common from "@esri/solution-common";
17
- /**
18
- * Converts an AGOL OIC (Oriented Imagery Catalog) item to a template.
19
- *
20
- * @param itemTemplate Template for the OIC (Oriented Imagery Catalog) item
21
- * @param destAuthentication Credentials for requests to the destination organization
22
- * @param srcAuthentication Credentials for requests to source items
23
- * @returns Template for the solution item that contains key details for item reconstruction
24
- */
25
- export declare function convertItemToTemplate(itemTemplate: common.IItemTemplate, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
26
- /**
27
- * Gets the ids of the dependencies of an AGOL OIC (Oriented Imagery Catalog) item.
28
- *
29
- * @param itemTemplate A OIC (Oriented Imagery Catalog) item whose dependencies are sought
30
- * @param authentication Credentials for any requests
31
- * @returns List of dependencies ids and url/itemId hash
32
- * @private
33
- */
34
- export declare function _extractDependencies(itemTemplate: common.IItemTemplate, authentication: common.UserSession): Promise<any>;
35
- /**
36
- * Extracts the AGOL itemId for each layer in a list using the url.
37
- *
38
- * @param layerURLs List of OIC layer URLs
39
- * @param dependencies Current list of dependencies
40
- * @param authentication Credentials for any requests
41
- * @returns List of dependencies ids and url/itemId hash
42
- * @private
43
- */
44
- export declare function _getLayerIds(layerURLs: string[], dependencies: string[], authentication: common.UserSession): Promise<any>;
45
- /**
46
- * Templatizes the url and item id for a layer.
47
- *
48
- * @param layerURL OIC layer URL
49
- * @param urlHash Lookup object for analysis layers
50
- * @returns Templatized URL if layerURL is in the urlHash
51
- * @private
52
- */
53
- export declare function _templatizeOicLayerUrl(layerURL: string, urlHash: any): string;
package/dist/node/oic.js DELETED
@@ -1,171 +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._templatizeOicLayerUrl = exports._getLayerIds = exports._extractDependencies = exports.convertItemToTemplate = void 0;
19
- const tslib_1 = require("tslib");
20
- const common = tslib_1.__importStar(require("@esri/solution-common"));
21
- // ------------------------------------------------------------------------------------------------------------------ //
22
- /**
23
- * Converts an AGOL OIC (Oriented Imagery Catalog) item to a template.
24
- *
25
- * @param itemTemplate Template for the OIC (Oriented Imagery Catalog) item
26
- * @param destAuthentication Credentials for requests to the destination organization
27
- * @param srcAuthentication Credentials for requests to source items
28
- * @returns Template for the solution item that contains key details for item reconstruction
29
- */
30
- function convertItemToTemplate(itemTemplate, destAuthentication, srcAuthentication) {
31
- return new Promise((resolve, reject) => {
32
- // Extract dependencies
33
- _extractDependencies(itemTemplate, srcAuthentication).then((results) => {
34
- itemTemplate.dependencies = results.dependencies;
35
- // Templatize the map layer ids after we've extracted them as dependencies
36
- /* istanbul ignore else */
37
- if (itemTemplate.data?.properties) {
38
- itemTemplate.data.properties.ServiceURL = _templatizeOicLayerUrl(itemTemplate.data.properties.ServiceURL, results.urlHash);
39
- itemTemplate.data.properties.OverviewURL = _templatizeOicLayerUrl(itemTemplate.data.properties.OverviewURL, results.urlHash);
40
- }
41
- resolve(itemTemplate);
42
- }, e => reject(common.fail(e)));
43
- });
44
- }
45
- exports.convertItemToTemplate = convertItemToTemplate;
46
- /**
47
- * Gets the ids of the dependencies of an AGOL OIC (Oriented Imagery Catalog) item.
48
- *
49
- * @param itemTemplate A OIC (Oriented Imagery Catalog) item whose dependencies are sought
50
- * @param authentication Credentials for any requests
51
- * @returns List of dependencies ids and url/itemId hash
52
- * @private
53
- */
54
- function _extractDependencies(itemTemplate, authentication) {
55
- return new Promise((resolve, reject) => {
56
- const dependencies = [];
57
- if (itemTemplate.data?.properties) {
58
- const layerURLs = [];
59
- /* istanbul ignore else */
60
- if (itemTemplate.data.properties.ServiceURL) {
61
- layerURLs.push(itemTemplate.data.properties.ServiceURL);
62
- }
63
- /* istanbul ignore else */
64
- if (itemTemplate.data.properties.OverviewURL &&
65
- itemTemplate.data.properties.OverviewURL !==
66
- itemTemplate.data.properties.ServiceURL) {
67
- layerURLs.push(itemTemplate.data.properties.OverviewURL);
68
- }
69
- _getLayerIds(layerURLs, dependencies, authentication).then(results => {
70
- resolve(results);
71
- }, e => reject(common.fail(e)));
72
- }
73
- else {
74
- resolve({
75
- dependencies: dependencies,
76
- urlHash: {}
77
- });
78
- }
79
- });
80
- }
81
- exports._extractDependencies = _extractDependencies;
82
- /**
83
- * Extracts the AGOL itemId for each layer in a list using the url.
84
- *
85
- * @param layerURLs List of OIC layer URLs
86
- * @param dependencies Current list of dependencies
87
- * @param authentication Credentials for any requests
88
- * @returns List of dependencies ids and url/itemId hash
89
- * @private
90
- */
91
- function _getLayerIds(layerURLs, dependencies, authentication) {
92
- return new Promise((resolve, reject) => {
93
- const urlHash = {};
94
- const options = {
95
- f: "json",
96
- authentication: authentication
97
- };
98
- const layerPromises = [];
99
- const layerChecks = {};
100
- const filteredLayerURLs = layerURLs.filter(layerURL => {
101
- if (layerURL) {
102
- const results = /.+FeatureServer/g.exec(layerURL);
103
- const baseUrl = Array.isArray(results) && results.length > 0 ? results[0] : undefined;
104
- if (baseUrl) {
105
- // avoid redundant checks when we have a layer with subLayers
106
- /* istanbul ignore else */
107
- if (Object.keys(layerChecks).indexOf(baseUrl) < 0) {
108
- layerChecks[baseUrl] = common.rest_request(layerURL, options);
109
- }
110
- layerPromises.push(layerChecks[baseUrl]);
111
- return true;
112
- }
113
- else {
114
- return false;
115
- }
116
- }
117
- else {
118
- return false;
119
- }
120
- });
121
- if (layerPromises.length > 0) {
122
- Promise.all(layerPromises).then(serviceResponses => {
123
- serviceResponses.forEach((serviceResponse, i) => {
124
- /* istanbul ignore else */
125
- if (common.getProp(serviceResponse, "serviceItemId")) {
126
- const id = serviceResponse.serviceItemId;
127
- /* istanbul ignore else */
128
- if (dependencies.indexOf(id) < 0) {
129
- dependencies.push(id);
130
- }
131
- urlHash[filteredLayerURLs[i]] = id;
132
- }
133
- });
134
- resolve({
135
- dependencies: dependencies,
136
- urlHash: urlHash
137
- });
138
- }, e => reject(common.fail(e)));
139
- }
140
- else {
141
- resolve({
142
- dependencies: dependencies,
143
- urlHash: urlHash
144
- });
145
- }
146
- });
147
- }
148
- exports._getLayerIds = _getLayerIds;
149
- /**
150
- * Templatizes the url and item id for a layer.
151
- *
152
- * @param layerURL OIC layer URL
153
- * @param urlHash Lookup object for analysis layers
154
- * @returns Templatized URL if layerURL is in the urlHash
155
- * @private
156
- */
157
- function _templatizeOicLayerUrl(layerURL, urlHash) {
158
- let templatizedURL = layerURL;
159
- if (layerURL) {
160
- const id = urlHash[layerURL];
161
- if (id) {
162
- const layerId = layerURL.substr(layerURL.lastIndexOf("/") + 1);
163
- templatizedURL = common.templatizeTerm(id, id, ".layer" + layerId + ".url");
164
- }
165
- // replace everything up until /home with portalBaseUrl var and templatize the itemId
166
- templatizedURL = common.templatizeIds(templatizedURL.replace(/.+?(?=\/home)/, "{{portalBaseUrl}}"));
167
- }
168
- return templatizedURL;
169
- }
170
- exports._templatizeOicLayerUrl = _templatizeOicLayerUrl;
171
- //# sourceMappingURL=oic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oic.js","sourceRoot":"","sources":["../../src/oic.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAEhD,wHAAwH;AAExH;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,YAAkC,EAClC,kBAAsC,EACtC,iBAAqC;IAErC,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3D,uBAAuB;QACvB,oBAAoB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC,IAAI,CACxD,CAAC,OAAY,EAAE,EAAE;YACf,YAAY,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;YAEjD,0EAA0E;YAC1E,0BAA0B;YAC1B,IAAI,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE;gBACjC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,sBAAsB,CAC9D,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EACvC,OAAO,CAAC,OAAO,CAChB,CAAC;gBACF,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,sBAAsB,CAC/D,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EACxC,OAAO,CAAC,OAAO,CAChB,CAAC;aACH;YAED,OAAO,CAAC,YAAY,CAAC,CAAC;QACxB,CAAC,EACD,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAC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AC,eAAe,EAAE,mBAAmB,CAAC,CAC7D,CAAC;KACH;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAnBD,wDAmBC"}
@@ -1,87 +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
- import * as common from "@esri/solution-common";
17
- /**
18
- * Converts a Quick Capture item into a template.
19
- *
20
- * @param solutionItemId The solution to contain the template
21
- * @param itemInfo Info about the item
22
- * @param destAuthentication Credentials for requests to the destination organization
23
- * @param srcAuthentication Credentials for requests to source items
24
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
25
- * @returns A promise that will resolve when the template has been created
26
- */
27
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary: any): Promise<common.IItemTemplate>;
28
- /**
29
- * Converts an quick capture item to a template.
30
- *
31
- * @param itemTemplate template for the quick capture project item
32
- * @returns templatized itemTemplate
33
- */
34
- export declare function convertQuickCaptureToTemplate(itemTemplate: common.IItemTemplate): Promise<common.IItemTemplate>;
35
- /**
36
- * Templatizes key properties for a quick capture project and gathers item dependencies
37
- *
38
- * @param data the projects json
39
- * @param itemTemplate template for the quick capture project item
40
- * @returns templatized itemTemplate
41
- * @private
42
- */
43
- export declare function _templatizeApplication(data: any, itemTemplate: common.IItemTemplate): any;
44
- /**
45
- * Templatize the email property
46
- *
47
- * @param data the quick capture application
48
- * @private
49
- */
50
- export declare function _templatizeAdminEmail(data: any): void;
51
- /**
52
- * Updates the templates dependencies list with unique item ids
53
- *
54
- * @param id the item id of the dependency
55
- * @param itemTemplate template for the quick capture project item
56
- * @returns templatized itemTemplate
57
- */
58
- export declare function _updateDependencies(id: string, itemTemplate: common.IItemTemplate): void;
59
- /**
60
- * Templatize a url property
61
- *
62
- * @param obj the datasource object
63
- * @param idPath the path to the id property
64
- * @param urlPath the path to the url property
65
- * @private
66
- */
67
- export declare function _templatizeUrl(obj: any, idPath: string, urlPath: string): void;
68
- /**
69
- * Templatize the item id property
70
- *
71
- * @param obj the datasource or object that contains the item id property
72
- * @param path the path to the id property
73
- * @private
74
- */
75
- export declare function _templatizeId(obj: any, path: string): void;
76
- export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
77
- /**
78
- * QuickCapture post-processing actions
79
- *
80
- * @param {string} itemId The item ID
81
- * @param {string} type The template type
82
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
83
- * @param {any} templateDictionary The template dictionary
84
- * @param {UserSession} authentication The destination session info
85
- * @returns Promise resolving to successfulness of update
86
- */
87
- export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: common.IItemTemplate, templates: common.IItemTemplate[], templateDictionary: any, authentication: common.UserSession): Promise<any>;