@esri/solution-workflow 5.2.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 (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +53 -0
  3. package/dist/cjs/common/src/generalHelpers.d.ts +400 -0
  4. package/dist/cjs/common/src/generalHelpers.js +877 -0
  5. package/dist/cjs/common/src/generalHelpers.js.map +1 -0
  6. package/dist/cjs/common/src/getItemTypeAbbrev.d.ts +19 -0
  7. package/dist/cjs/common/src/getItemTypeAbbrev.js +186 -0
  8. package/dist/cjs/common/src/getItemTypeAbbrev.js.map +1 -0
  9. package/dist/cjs/common/src/interfaces.d.ts +1344 -0
  10. package/dist/cjs/common/src/interfaces.js +77 -0
  11. package/dist/cjs/common/src/interfaces.js.map +1 -0
  12. package/dist/cjs/common/src/libConnectors.d.ts +73 -0
  13. package/dist/cjs/common/src/libConnectors.js +115 -0
  14. package/dist/cjs/common/src/libConnectors.js.map +1 -0
  15. package/dist/cjs/common/test/mocks/templates.d.ts +71 -0
  16. package/dist/cjs/common/test/mocks/templates.js +1220 -0
  17. package/dist/cjs/common/test/mocks/templates.js.map +1 -0
  18. package/dist/cjs/common/test/mocks/utils.d.ts +605 -0
  19. package/dist/cjs/common/test/mocks/utils.js +1222 -0
  20. package/dist/cjs/common/test/mocks/utils.js.map +1 -0
  21. package/dist/cjs/workflow/src/index.d.ts +21 -0
  22. package/dist/cjs/workflow/src/index.js +25 -0
  23. package/dist/cjs/workflow/src/index.js.map +1 -0
  24. package/dist/cjs/workflow/src/workflow.d.ts +32 -0
  25. package/dist/cjs/workflow/src/workflow.js +51 -0
  26. package/dist/cjs/workflow/src/workflow.js.map +1 -0
  27. package/dist/esm/common/src/generalHelpers.d.ts +400 -0
  28. package/dist/esm/common/src/generalHelpers.js +829 -0
  29. package/dist/esm/common/src/generalHelpers.js.map +1 -0
  30. package/dist/esm/common/src/getItemTypeAbbrev.d.ts +19 -0
  31. package/dist/esm/common/src/getItemTypeAbbrev.js +182 -0
  32. package/dist/esm/common/src/getItemTypeAbbrev.js.map +1 -0
  33. package/dist/esm/common/src/interfaces.d.ts +1344 -0
  34. package/dist/esm/common/src/interfaces.js +72 -0
  35. package/dist/esm/common/src/interfaces.js.map +1 -0
  36. package/dist/esm/common/src/libConnectors.d.ts +73 -0
  37. package/dist/esm/common/src/libConnectors.js +105 -0
  38. package/dist/esm/common/src/libConnectors.js.map +1 -0
  39. package/dist/esm/common/test/mocks/templates.d.ts +71 -0
  40. package/dist/esm/common/test/mocks/templates.js +1195 -0
  41. package/dist/esm/common/test/mocks/templates.js.map +1 -0
  42. package/dist/esm/common/test/mocks/utils.d.ts +605 -0
  43. package/dist/esm/common/test/mocks/utils.js +1177 -0
  44. package/dist/esm/common/test/mocks/utils.js.map +1 -0
  45. package/dist/esm/workflow/src/index.d.ts +21 -0
  46. package/dist/esm/workflow/src/index.js +22 -0
  47. package/dist/esm/workflow/src/index.js.map +1 -0
  48. package/dist/esm/workflow/src/workflow.d.ts +32 -0
  49. package/dist/esm/workflow/src/workflow.js +45 -0
  50. package/dist/esm/workflow/src/workflow.js.map +1 -0
  51. package/package.json +70 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2017 Esri Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ [![npm status][npm-img]][npm-url]
2
+ [![Build status][travis-img]][travis-url]
3
+ [![gzip bundle size][gzip-img]][npm-url]
4
+ [![Coverage status][coverage-img]][coverage-url]
5
+ [![Apache 2.0 licensed][license-img]][license-url]
6
+
7
+ [npm-img]: https://img.shields.io/npm/v/@esri/solution-workflow.svg?style=round-square&color=blue
8
+ [npm-url]: https://www.npmjs.com/package/@esri/solution-workflow
9
+ [travis-img]: https://img.shields.io/travis/Esri/solution.js/develop.svg
10
+ [travis-url]: https://travis-ci.org/Esri/solution.js
11
+ [gzip-img]: https://img.badgesize.io/https://unpkg.com/@esri/solution-storymap/dist/umd/workflow.umd.min.js?compression=gzip
12
+ [coverage-img]: https://coveralls.io/repos/github/Esri/solution.js/badge.svg
13
+ [coverage-url]: https://coveralls.io/github/Esri/solution.js
14
+ [license-img]: https://img.shields.io/badge/license-Apache%202.0-blue.svg
15
+ [license-url]: #license
16
+
17
+ # @esri/solution-workflow
18
+
19
+ > Manages the creation and deployment of Workflow Manager item types for [`@esri/solution-*`](https://github.com/Esri/solution.js).
20
+
21
+ ### [API Reference](https://esri.github.io/solution.js/api/workflow/)
22
+
23
+ ### Issues
24
+
25
+ Found a bug or want to request a new feature? Please take a look at [previously logged issues](https://github.com/Esri/solution.js/issues); if you don't see your concern, please let us know by [submitting an issue](https://github.com/Esri/solution.js/issues/new).
26
+
27
+ ### [Changelog](https://github.com/Esri/solution.js/blob/develop/CHANGELOG.md)
28
+
29
+ ##### Versioning
30
+
31
+ For transparency into the release cycle and in striving to maintain backward compatibility, @esri/solution.js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible. For more information on SemVer, please visit <http://semver.org/>.
32
+
33
+ ### Contributing
34
+
35
+ Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](CONTRIBUTING.md).
36
+
37
+ ### License
38
+
39
+ Copyright &copy; 2024 Esri
40
+
41
+ Licensed under the Apache License, Version 2.0 (the "License");
42
+ you may not use this file except in compliance with the License.
43
+ You may obtain a copy of the License at
44
+
45
+ > http://www.apache.org/licenses/LICENSE-2.0
46
+
47
+ Unless required by applicable law or agreed to in writing, software
48
+ distributed under the License is distributed on an "AS IS" BASIS,
49
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
+ See the License for the specific language governing permissions and
51
+ limitations under the License.
52
+
53
+ A copy of the license is available in the repository's [LICENSE](./LICENSE) file.
@@ -0,0 +1,400 @@
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 general helper functions.
18
+ *
19
+ * @module generalHelpers
20
+ */
21
+ import { IModel } from "@esri/hub-common";
22
+ import { ICreateItemFromTemplateResponse, IDatasourceInfo, IItemTemplate, IStringValuePair } from "./interfaces";
23
+ import { Sanitizer } from "./libConnectors";
24
+ /**
25
+ * Returns a URL with a query parameter appended
26
+ *
27
+ * @param url URL to append to
28
+ * @param parameter Query parameter to append, prefixed with "?" or "&" as appropriate to what url already has
29
+ * @returns New URL combining url and parameter
30
+ */
31
+ export declare function appendQueryParam(url: string, parameter: string): string;
32
+ /**
33
+ * Extracts JSON from a Blob.
34
+ *
35
+ * @param blob Blob to use as source
36
+ * @returns A promise that will resolve with JSON or null
37
+ */
38
+ export declare function blobToJson(blob: Blob): Promise<any>;
39
+ /**
40
+ * Converts a Blob to a File.
41
+ *
42
+ * @param blob Blob to use as source
43
+ * @param filename Name to use for file
44
+ * @param mimeType MIME type to override blob's MIME type
45
+ * @returns File created out of Blob and filename
46
+ */
47
+ export declare function blobToFile(blob: Blob, filename: string, mimeType?: string): File;
48
+ /**
49
+ * Extracts text from a Blob.
50
+ *
51
+ * @param blob Blob to use as source
52
+ * @returns A promise that will resolve with text read from blob
53
+ */
54
+ export declare function blobToText(blob: Blob): Promise<string>;
55
+ /**
56
+ * Checks that a URL path ends with a slash.
57
+ *
58
+ * @param url URL to check
59
+ * @returns URL, appended with slash if missing
60
+ */
61
+ export declare function checkUrlPathTermination(url: string): string;
62
+ /**
63
+ * Converts a hub-style item into a solutions-style item, the difference being handling of resources.
64
+ *
65
+ * @param hubModel Hub-style item
66
+ * @return solutions-style item
67
+ */
68
+ export declare function convertIModel(hubModel: IModel | undefined): IItemTemplate;
69
+ /**
70
+ * Creates a random 32-character alphanumeric string.
71
+ *
72
+ * @returns A lowercase 32-char alphanumeric string
73
+ * @internal
74
+ */
75
+ export declare function createLongId(): string;
76
+ /**
77
+ * Creates a random 8-character alphanumeric string that begins with an alphabetic character.
78
+ *
79
+ * @returns An alphanumeric string in the range [a0000000..zzzzzzzz]
80
+ */
81
+ export declare function createShortId(): string;
82
+ /**
83
+ * Copies an input list removing duplicates.
84
+ *
85
+ * @param input List to be deduped
86
+ * @returns Deduped list; order of items in input is not maintained
87
+ */
88
+ export declare function dedupe(input?: string[]): string[];
89
+ /**
90
+ * Flags a failure to create an item from a template.
91
+ *
92
+ * @param itemType The AGO item type
93
+ * @param id Item id to include in response
94
+ * @returns Empty creation response
95
+ */
96
+ export declare function generateEmptyCreationResponse(itemType: string, id?: string): ICreateItemFromTemplateResponse;
97
+ /**
98
+ * Converts JSON to a Blob.
99
+ *
100
+ * @param json JSON to use as source
101
+ * @returns A blob from the source JSON
102
+ */
103
+ export declare function jsonToBlob(json: any): Blob;
104
+ /**
105
+ * Converts JSON to a File.
106
+ *
107
+ * @param json JSON to use as source
108
+ * @param filename Name to use for file
109
+ * @param mimeType MIME type to override blob's MIME type
110
+ * @returns File created out of JSON and filename
111
+ */
112
+ export declare function jsonToFile(json: any, filename: string, mimeType?: string): File;
113
+ /**
114
+ * Makes a unique copy of JSON by stringifying and parsing.
115
+ *
116
+ * @param json JSON to use as source
117
+ * @returns A JSON object from the source JSON
118
+ */
119
+ export declare function jsonToJson(json: any): any;
120
+ /**
121
+ * Saves a blob to a file.
122
+ *
123
+ * @param filename Name to give file
124
+ * @param blob Blob to save
125
+ * @returns Promise resolving when operation is complete
126
+ */
127
+ export declare function saveBlobAsFile(filename: string, blob: Blob): Promise<void>;
128
+ /**
129
+ * Makes a deep clone, including arrays but not functions.
130
+ *
131
+ * @param obj Object to be cloned
132
+ * @returns Clone of obj
133
+ * @example
134
+ * ```js
135
+ * import { cloneObject } from "utils/object-helpers";
136
+ * const original = { foo: "bar" }
137
+ * const copy = cloneObject(original)
138
+ * copy.foo // "bar"
139
+ * copy === original // false
140
+ * ```
141
+ */
142
+ export declare function cloneObject(obj: {
143
+ [index: string]: any;
144
+ }): any;
145
+ /**
146
+ * Compares two JSON objects using JSON.stringify.
147
+ *
148
+ * @param json1 First object
149
+ * @param json2 Second object
150
+ * @returns True if objects are the same
151
+ */
152
+ export declare function compareJSON(json1: any, json2: any): boolean;
153
+ /**
154
+ * Compares two JSON objects using JSON.stringify, converting empty strings to nulls.
155
+ *
156
+ * @param json1 First object
157
+ * @param json2 Second object
158
+ * @returns True if objects are the same
159
+ */
160
+ export declare function compareJSONNoEmptyStrings(json1: any, json2: any): boolean;
161
+ /**
162
+ * Compares two JSON objects property by property and reports each mismatch.
163
+ *
164
+ * @param json1 First object
165
+ * @param json2 Second object
166
+ * @returns A list of mismatch report strings
167
+ */
168
+ export declare function compareJSONProperties(json1: any, json2: any): string[];
169
+ /**
170
+ * Sanitizes JSON and echoes changes to console.
171
+ *
172
+ * @param json JSON to sanitize
173
+ * @param sanitizer Instance of Sanitizer class
174
+ * @returns Sanitized version of `json`
175
+ * @see https://github.com/esri/arcgis-html-sanitizer#sanitize-json
176
+ */
177
+ export declare function sanitizeJSONAndReportChanges(json: any, sanitizer?: Sanitizer): any;
178
+ export declare function deleteItemProps(itemTemplate: any): any;
179
+ /**
180
+ * Deletes a property from an object.
181
+ *
182
+ * @param obj Object with property to delete
183
+ * @param path Path into an object to property, e.g., "data.values.webmap", where "data" is a top-level property
184
+ * in obj
185
+ */
186
+ export declare function deleteProp(obj: any, path: string): void;
187
+ /**
188
+ * Deletes properties from an object.
189
+ *
190
+ * @param obj Object with properties to delete
191
+ * @param props Array of properties on object that should be deleted
192
+ */
193
+ export declare function deleteProps(obj: any, props: string[]): void;
194
+ /**
195
+ * Creates an AGO-style JSON failure response with success property.
196
+ *
197
+ * @param e Optional error information
198
+ * @returns JSON structure with property success set to false and optionally including `e`
199
+ */
200
+ export declare function fail(e?: any): any;
201
+ /**
202
+ * Creates an AGO-style JSON failure response with success property and extended with ids list.
203
+ *
204
+ * @param ids List of ids
205
+ * @param e Optional error information
206
+ * @returns JSON structure with property success set to false and optionally including `e`
207
+ */
208
+ export declare function failWithIds(itemIds: string[], e?: any): any;
209
+ /**
210
+ * Extracts subgroup ids from item tags
211
+ *
212
+ * @param tags Tags in an item
213
+ * @returns List of subgroup ids; subgroups are identified using tags that begin with "group." and end with a group id,
214
+ * e.g., "group.8d515625ee9f49d7b4f6c6cb2a389151"; non-matching tags are ignored
215
+ */
216
+ export declare function getSubgroupIds(tags: string[]): string[];
217
+ /**
218
+ * Extracts the ids from a string
219
+ *
220
+ * @param v String to examine
221
+ * @returns List of id strings found
222
+ * @example
223
+ * get id from
224
+ * bad3483e025c47338d43df308c117308
225
+ * {bad3483e025c47338d43df308c117308
226
+ * =bad3483e025c47338d43df308c117308
227
+ * do not get id from
228
+ * http: *something/name_bad3483e025c47338d43df308c117308
229
+ * {{bad3483e025c47338d43df308c117308.itemId}}
230
+ * bad3483e025c47338d43df308c117308bad3483e025c47338d43df308c117308
231
+ */
232
+ export declare function getIDs(v: string): string[];
233
+ /**
234
+ * Gets a property out of a deeply nested object.
235
+ * Does not handle anything but nested object graph
236
+ *
237
+ * @param obj Object to retrieve value from
238
+ * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property
239
+ * in obj
240
+ * @returns Value at end of path
241
+ */
242
+ export declare function getProp(obj: {
243
+ [index: string]: any;
244
+ }, path: string): any;
245
+ /**
246
+ * Returns an array of values from an object based on an array of property paths.
247
+ *
248
+ * @param obj Object to retrieve values from
249
+ * @param props Array of paths into the object e.g., "data.values.webmap", where "data" is a top-level property
250
+ * @returns Array of the values plucked from the object; only defined values are returned
251
+ */
252
+ export declare function getProps(obj: any, props: string[]): any;
253
+ /**
254
+ * Get a property out of a deeply nested object
255
+ * Does not handle anything but nested object graph
256
+ *
257
+ * @param obj Object to retrieve value from
258
+ * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property
259
+ * in obj
260
+ * @param defaultV Optional value to use if any part of path--including final value--is undefined
261
+ * @returns Value at end of path
262
+ */
263
+ export declare function getPropWithDefault(obj: IStringValuePair, path: string, defaultV?: any): any;
264
+ /**
265
+ * Updates a list of the items dependencies if more are found in the
266
+ * provided value.
267
+ *
268
+ * @param v a string value to check for ids
269
+ * @param deps a list of the items dependencies
270
+ */
271
+ export declare function idTest(v: any, deps: string[]): void;
272
+ /**
273
+ * Sets a deeply nested property of an object.
274
+ * Creates the full path if it does not exist.
275
+ *
276
+ * @param obj Object to set value of
277
+ * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property in obj
278
+ * @param value The value to set at the end of the path
279
+ */
280
+ export declare function setCreateProp(obj: any, path: string, value: any): void;
281
+ /**
282
+ * Sets a deeply nested property of an object.
283
+ * Does nothing if the full path does not exist.
284
+ *
285
+ * @param obj Object to set value of
286
+ * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property in obj
287
+ * @param value The value to set at the end of the path
288
+ */
289
+ export declare function setProp(obj: any, path: string, value: any): void;
290
+ /**
291
+ * Creates a timestamp string using the current UTC date and time.
292
+ *
293
+ * @returns Timestamp formatted as YYYYMMDD_hhmm_ssmmm, with month one-based and all values padded with zeroes on the
294
+ * left as needed (`ssmmm` stands for seconds from 0..59 and milliseconds from 0..999)
295
+ * @private
296
+ */
297
+ export declare function getUTCTimestamp(): string;
298
+ /**
299
+ * Tests if an object's `item.typeKeywords` or `typeKeywords` properties has any of a set of keywords.
300
+ *
301
+ * @param jsonObj Object to test
302
+ * @param keywords List of keywords to look for in jsonObj
303
+ * @returns Boolean indicating result
304
+ */
305
+ export declare function hasAnyKeyword(jsonObj: any, keywords: string[]): boolean;
306
+ /**
307
+ * Tests if an object's `item.typeKeywords` or `typeKeywords` properties has a specific keyword.
308
+ *
309
+ * @param jsonObj Object to test
310
+ * @param keyword Keyword to look for in jsonObj
311
+ * @returns Boolean indicating result
312
+ */
313
+ export declare function hasTypeKeyword(jsonObj: any, keyword: string): boolean;
314
+ /**
315
+ * Will return the provided title if it does not exist as a property
316
+ * in one of the objects at the defined path. Otherwise the title will
317
+ * have a numerical value attached.
318
+ *
319
+ * @param title The root title to test
320
+ * @param templateDictionary Hash of the facts
321
+ * @param path to the objects to evaluate for potantial name clashes
322
+ * @returns string The unique title to use
323
+ */
324
+ export declare function getUniqueTitle(title: string, templateDictionary: any, path: string): string;
325
+ /**
326
+ * Performs string replacement on every string in an object.
327
+ *
328
+ * @param obj Object to scan and to modify
329
+ * @param pattern Search pattern in each string
330
+ * @param replacement Replacement for matches to search pattern
331
+ * @returns Modified obj is returned
332
+ */
333
+ export declare function globalStringReplace(obj: any, pattern: RegExp, replacement: string): any;
334
+ /**
335
+ * Tests if an array of DatasourceInfos has a given item and layer id already.
336
+ *
337
+ * @param datasourceInfos Array of DatasourceInfos to evaluate
338
+ * @param itemId The items id to check for
339
+ * @param layerId The layers id to check for
340
+ * @returns Boolean indicating result
341
+ */
342
+ export declare function hasDatasource(datasourceInfos: IDatasourceInfo[], itemId: string, layerId: number): boolean;
343
+ /**
344
+ * remove templatization from item id to compare
345
+ *
346
+ * @example
347
+ * \{\{934a9ef8efa7448fa8ddf7b13cef0240.itemId\}\}
348
+ * returns 934a9ef8efa7448fa8ddf7b13cef0240
349
+ */
350
+ export declare function cleanItemId(id: any): any;
351
+ /**
352
+ * remove templatization from layer based item id to compare
353
+ *
354
+ * @example
355
+ * \{\{934a9ef8efa7448fa8ddf7b13cef0240.layer0.itemId\}\}
356
+ * returns 934a9ef8efa7448fa8ddf7b13cef0240
357
+ */
358
+ export declare function cleanLayerBasedItemId(id: any): any;
359
+ /**
360
+ * remove templatization from layer id to compare
361
+ *
362
+ * @example
363
+ * \{\{934a9ef8efa7448fa8ddf7b13cef0240.layer0.layerId\}\}
364
+ * returns 0
365
+ */
366
+ export declare function cleanLayerId(id: any): any;
367
+ /**
368
+ * Get template from list of templates by ID
369
+ *
370
+ * @param templates Array of item templates to search
371
+ * @param id of template we are searching for
372
+ *
373
+ * @returns Template associated with the user provided id argument
374
+ */
375
+ export declare function getTemplateById(templates: IItemTemplate[], id: string): any;
376
+ /**
377
+ * Evaluates a value with a regular expression
378
+ *
379
+ * @param v a string value to test with the expression
380
+ * @param ex the regular expresion to test with
381
+ * @returns an array of matches
382
+ */
383
+ export declare function regExTest(v: any, ex: RegExp): any[];
384
+ /**
385
+ * Creates a random number between two values.
386
+ *
387
+ * @param min Inclusive minimum desired value
388
+ * @param max Non-inclusive maximum desired value
389
+ * @returns Random number in the range [min, max)
390
+ */
391
+ export declare function _getRandomNumberInRange(min: number, max: number): number;
392
+ /**
393
+ * Pads the string representation of a number to a minimum width. Requires modern browser.
394
+ *
395
+ * @param n Number to pad
396
+ * @param totalSize Desired *minimum* width of number after padding with zeroes
397
+ * @returns Number converted to string and padded on the left as needed
398
+ * @private
399
+ */
400
+ export declare function _padPositiveNum(n: number, totalSize: number): string;