@azure/app-configuration-importer 1.0.0-preview

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/NOTICE.txt ADDED
@@ -0,0 +1,370 @@
1
+ NOTICES
2
+
3
+ This repository incorporates material as listed below or described in the code.
4
+
5
+
6
+ -------------------------------------------------------
7
+
8
+ https://github.com/lodash/lodash
9
+
10
+ The MIT License
11
+
12
+ Copyright JS Foundation and other contributors <https://js.foundation/>
13
+
14
+ Based on Underscore.js, copyright Jeremy Ashkenas,
15
+ DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
16
+
17
+ This software consists of voluntary contributions made by many
18
+ individuals. For exact contribution history, see the revision history
19
+ available at https://github.com/lodash/lodash
20
+
21
+ The following license applies to all parts of this software except as
22
+ documented below:
23
+
24
+ ====
25
+
26
+ Permission is hereby granted, free of charge, to any person obtaining
27
+ a copy of this software and associated documentation files (the
28
+ "Software"), to deal in the Software without restriction, including
29
+ without limitation the rights to use, copy, modify, merge, publish,
30
+ distribute, sublicense, and/or sell copies of the Software, and to
31
+ permit persons to whom the Software is furnished to do so, subject to
32
+ the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be
35
+ included in all copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
38
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
39
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
40
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
41
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
42
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
43
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44
+
45
+ ====
46
+
47
+ Copyright and related rights for sample code are waived via CC0. Sample
48
+ code is defined as all source code displayed within the prose of the
49
+ documentation.
50
+
51
+ CC0: http://creativecommons.org/publicdomain/zero/1.0/
52
+
53
+ ====
54
+
55
+ Files located in the node_modules and vendor directories are externally
56
+ maintained libraries used by this software which have their own
57
+ licenses; we recommend you read them, as their terms may differ from the
58
+ terms above.
59
+
60
+ ---------------------------------------------------------
61
+
62
+ ---------------------------------------------------------
63
+
64
+ https://github.com/hughsk/flat
65
+
66
+ Copyright (c) 2014, Hugh Kennedy
67
+ All rights reserved.
68
+
69
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
70
+
71
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
72
+
73
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
74
+
75
+ 3. Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
76
+
77
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
78
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
79
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
80
+ COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
81
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
82
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
83
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
84
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
85
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86
+
87
+ ---------------------------------------------------------
88
+
89
+ ---------------------------------------------------------
90
+
91
+ https://github.com/nodeca/js-yaml
92
+
93
+ (The MIT License)
94
+
95
+ Copyright (C) 2011-2015 by Vitaly Puzrin
96
+
97
+ Permission is hereby granted, free of charge, to any person obtaining a copy
98
+ of this software and associated documentation files (the "Software"), to deal
99
+ in the Software without restriction, including without limitation the rights
100
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
101
+ copies of the Software, and to permit persons to whom the Software is
102
+ furnished to do so, subject to the following conditions:
103
+
104
+ The above copyright notice and this permission notice shall be included in
105
+ all copies or substantial portions of the Software.
106
+
107
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
108
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
109
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
110
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
111
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
112
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
113
+ THE SOFTWARE.
114
+
115
+ ---------------------------------------------------------
116
+
117
+ ---------------------------------------------------------
118
+
119
+ https://github.com/Avansai/properties-file
120
+
121
+ MIT License
122
+
123
+ Copyright (c) 2022 Avansai
124
+
125
+ Permission is hereby granted, free of charge, to any person obtaining a copy
126
+ of this software and associated documentation files (the "Software"), to deal
127
+ in the Software without restriction, including without limitation the rights
128
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
129
+ copies of the Software, and to permit persons to whom the Software is
130
+ furnished to do so, subject to the following conditions:
131
+
132
+ The above copyright notice and this permission notice shall be included in all
133
+ copies or substantial portions of the Software.
134
+
135
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
136
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
137
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
138
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
139
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
140
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
141
+ SOFTWARE.
142
+
143
+ ---------------------------------------------------------
144
+
145
+ ---------------------------------------------------------
146
+
147
+ https://github.com/reactivex/rxjs
148
+
149
+ Apache License
150
+ Version 2.0, January 2004
151
+ http://www.apache.org/licenses/
152
+
153
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
154
+
155
+ 1. Definitions.
156
+
157
+ "License" shall mean the terms and conditions for use, reproduction,
158
+ and distribution as defined by Sections 1 through 9 of this document.
159
+
160
+ "Licensor" shall mean the copyright owner or entity authorized by
161
+ the copyright owner that is granting the License.
162
+
163
+ "Legal Entity" shall mean the union of the acting entity and all
164
+ other entities that control, are controlled by, or are under common
165
+ control with that entity. For the purposes of this definition,
166
+ "control" means (i) the power, direct or indirect, to cause the
167
+ direction or management of such entity, whether by contract or
168
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
169
+ outstanding shares, or (iii) beneficial ownership of such entity.
170
+
171
+ "You" (or "Your") shall mean an individual or Legal Entity
172
+ exercising permissions granted by this License.
173
+
174
+ "Source" form shall mean the preferred form for making modifications,
175
+ including but not limited to software source code, documentation
176
+ source, and configuration files.
177
+
178
+ "Object" form shall mean any form resulting from mechanical
179
+ transformation or translation of a Source form, including but
180
+ not limited to compiled object code, generated documentation,
181
+ and conversions to other media types.
182
+
183
+ "Work" shall mean the work of authorship, whether in Source or
184
+ Object form, made available under the License, as indicated by a
185
+ copyright notice that is included in or attached to the work
186
+ (an example is provided in the Appendix below).
187
+
188
+ "Derivative Works" shall mean any work, whether in Source or Object
189
+ form, that is based on (or derived from) the Work and for which the
190
+ editorial revisions, annotations, elaborations, or other modifications
191
+ represent, as a whole, an original work of authorship. For the purposes
192
+ of this License, Derivative Works shall not include works that remain
193
+ separable from, or merely link (or bind by name) to the interfaces of,
194
+ the Work and Derivative Works thereof.
195
+
196
+ "Contribution" shall mean any work of authorship, including
197
+ the original version of the Work and any modifications or additions
198
+ to that Work or Derivative Works thereof, that is intentionally
199
+ submitted to Licensor for inclusion in the Work by the copyright owner
200
+ or by an individual or Legal Entity authorized to submit on behalf of
201
+ the copyright owner. For the purposes of this definition, "submitted"
202
+ means any form of electronic, verbal, or written communication sent
203
+ to the Licensor or its representatives, including but not limited to
204
+ communication on electronic mailing lists, source code control systems,
205
+ and issue tracking systems that are managed by, or on behalf of, the
206
+ Licensor for the purpose of discussing and improving the Work, but
207
+ excluding communication that is conspicuously marked or otherwise
208
+ designated in writing by the copyright owner as "Not a Contribution."
209
+
210
+ "Contributor" shall mean Licensor and any individual or Legal Entity
211
+ on behalf of whom a Contribution has been received by Licensor and
212
+ subsequently incorporated within the Work.
213
+
214
+ 2. Grant of Copyright License. Subject to the terms and conditions of
215
+ this License, each Contributor hereby grants to You a perpetual,
216
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
217
+ copyright license to reproduce, prepare Derivative Works of,
218
+ publicly display, publicly perform, sublicense, and distribute the
219
+ Work and such Derivative Works in Source or Object form.
220
+
221
+ 3. Grant of Patent License. Subject to the terms and conditions of
222
+ this License, each Contributor hereby grants to You a perpetual,
223
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
224
+ (except as stated in this section) patent license to make, have made,
225
+ use, offer to sell, sell, import, and otherwise transfer the Work,
226
+ where such license applies only to those patent claims licensable
227
+ by such Contributor that are necessarily infringed by their
228
+ Contribution(s) alone or by combination of their Contribution(s)
229
+ with the Work to which such Contribution(s) was submitted. If You
230
+ institute patent litigation against any entity (including a
231
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
232
+ or a Contribution incorporated within the Work constitutes direct
233
+ or contributory patent infringement, then any patent licenses
234
+ granted to You under this License for that Work shall terminate
235
+ as of the date such litigation is filed.
236
+
237
+ 4. Redistribution. You may reproduce and distribute copies of the
238
+ Work or Derivative Works thereof in any medium, with or without
239
+ modifications, and in Source or Object form, provided that You
240
+ meet the following conditions:
241
+
242
+ (a) You must give any other recipients of the Work or
243
+ Derivative Works a copy of this License; and
244
+
245
+ (b) You must cause any modified files to carry prominent notices
246
+ stating that You changed the files; and
247
+
248
+ (c) You must retain, in the Source form of any Derivative Works
249
+ that You distribute, all copyright, patent, trademark, and
250
+ attribution notices from the Source form of the Work,
251
+ excluding those notices that do not pertain to any part of
252
+ the Derivative Works; and
253
+
254
+ (d) If the Work includes a "NOTICE" text file as part of its
255
+ distribution, then any Derivative Works that You distribute must
256
+ include a readable copy of the attribution notices contained
257
+ within such NOTICE file, excluding those notices that do not
258
+ pertain to any part of the Derivative Works, in at least one
259
+ of the following places: within a NOTICE text file distributed
260
+ as part of the Derivative Works; within the Source form or
261
+ documentation, if provided along with the Derivative Works; or,
262
+ within a display generated by the Derivative Works, if and
263
+ wherever such third-party notices normally appear. The contents
264
+ of the NOTICE file are for informational purposes only and
265
+ do not modify the License. You may add Your own attribution
266
+ notices within Derivative Works that You distribute, alongside
267
+ or as an addendum to the NOTICE text from the Work, provided
268
+ that such additional attribution notices cannot be construed
269
+ as modifying the License.
270
+
271
+ You may add Your own copyright statement to Your modifications and
272
+ may provide additional or different license terms and conditions
273
+ for use, reproduction, or distribution of Your modifications, or
274
+ for any such Derivative Works as a whole, provided Your use,
275
+ reproduction, and distribution of the Work otherwise complies with
276
+ the conditions stated in this License.
277
+
278
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
279
+ any Contribution intentionally submitted for inclusion in the Work
280
+ by You to the Licensor shall be under the terms and conditions of
281
+ this License, without any additional terms or conditions.
282
+ Notwithstanding the above, nothing herein shall supersede or modify
283
+ the terms of any separate license agreement you may have executed
284
+ with Licensor regarding such Contributions.
285
+
286
+ 6. Trademarks. This License does not grant permission to use the trade
287
+ names, trademarks, service marks, or product names of the Licensor,
288
+ except as required for reasonable and customary use in describing the
289
+ origin of the Work and reproducing the content of the NOTICE file.
290
+
291
+ 7. Disclaimer of Warranty. Unless required by applicable law or
292
+ agreed to in writing, Licensor provides the Work (and each
293
+ Contributor provides its Contributions) on an "AS IS" BASIS,
294
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
295
+ implied, including, without limitation, any warranties or conditions
296
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
297
+ PARTICULAR PURPOSE. You are solely responsible for determining the
298
+ appropriateness of using or redistributing the Work and assume any
299
+ risks associated with Your exercise of permissions under this License.
300
+
301
+ 8. Limitation of Liability. In no event and under no legal theory,
302
+ whether in tort (including negligence), contract, or otherwise,
303
+ unless required by applicable law (such as deliberate and grossly
304
+ negligent acts) or agreed to in writing, shall any Contributor be
305
+ liable to You for damages, including any direct, indirect, special,
306
+ incidental, or consequential damages of any character arising as a
307
+ result of this License or out of the use or inability to use the
308
+ Work (including but not limited to damages for loss of goodwill,
309
+ work stoppage, computer failure or malfunction, or any and all
310
+ other commercial damages or losses), even if such Contributor
311
+ has been advised of the possibility of such damages.
312
+
313
+ 9. Accepting Warranty or Additional Liability. While redistributing
314
+ the Work or Derivative Works thereof, You may choose to offer,
315
+ and charge a fee for, acceptance of support, warranty, indemnity,
316
+ or other liability obligations and/or rights consistent with this
317
+ License. However, in accepting such obligations, You may act only
318
+ on Your own behalf and on Your sole responsibility, not on behalf
319
+ of any other Contributor, and only if You agree to indemnify,
320
+ defend, and hold each Contributor harmless for any liability
321
+ incurred by, or claims asserted against, such Contributor by reason
322
+ of your accepting any such warranty or additional liability.
323
+
324
+ END OF TERMS AND CONDITIONS
325
+
326
+ APPENDIX: How to apply the Apache License to your work.
327
+
328
+ To apply the Apache License to your work, attach the following
329
+ boilerplate notice, with the fields enclosed by brackets "[]"
330
+ replaced with your own identifying information. (Don't include
331
+ the brackets!) The text should be enclosed in the appropriate
332
+ comment syntax for the file format. We also recommend that a
333
+ file or class name and description of purpose be included on the
334
+ same "printed page" as the copyright notice for easier
335
+ identification within third-party archives.
336
+
337
+ Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors
338
+
339
+ Licensed under the Apache License, Version 2.0 (the "License");
340
+ you may not use this file except in compliance with the License.
341
+ You may obtain a copy of the License at
342
+
343
+ http://www.apache.org/licenses/LICENSE-2.0
344
+
345
+ Unless required by applicable law or agreed to in writing, software
346
+ distributed under the License is distributed on an "AS IS" BASIS,
347
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
348
+ See the License for the specific language governing permissions and
349
+ limitations under the License.
350
+
351
+ ---------------------------------------------------------
352
+
353
+ ---------------------------------------------------------
354
+
355
+ https://github.com/sindresorhus/strip-json-comments
356
+
357
+ MIT License
358
+
359
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
360
+
361
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
362
+
363
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
364
+
365
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
366
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
367
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
368
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
369
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
370
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,164 @@
1
+ Invoking: cross-env TS_NODE_PROJECT="tsconfig.test.json" mocha -r ts-node/register 'tests/**/*.ts'
2
+
3
+
4
+ Call Import API to import configuration file to AppConfiguration
5
+ ✔ Succeed to import simple key value file
6
+ ✔ Fail to import because of server error
7
+ ✔ Fail to import because of timeout (1005ms)
8
+ ✔ Success to import after surviving from client throttle
9
+ ✔ Try import an empty file, no error
10
+ ✔ Try import an empty file, no error
11
+ ✔ Succeed to import simple key value file in strict mode
12
+ Call Import API to import configurations from file and pass dryRun and Import mode options
13
+ The following settings will be removed from App Configuration:
14
+
15
+ The following settings will be written to App Configuration:
16
+ {"key":"app:Settings:FontSize","label":"Dev"}
17
+ {"key":"app:Settings:BackgroundColor","label":"Dev"}
18
+ {"key":"app:Settings:FontColor","label":"Dev"}
19
+ ✔ Succeed to import and log all key-values with importMode as All, profile as default
20
+ The following settings will be removed from App Configuration:
21
+
22
+ The following settings will be written to App Configuration:
23
+ {"key":"app:Settings:FontColor","label":"Dev"}
24
+ ✔ Succeed to import and log no matching key values updates with importMode as IgnoreMatch and profile as default
25
+ The following settings will be removed from App Configuration:
26
+
27
+ The following settings will be written to App Configuration:
28
+ {"key":".appconfig.featureflag/Test","label":"dev","contentType":"application/vnd.microsoft.appconfig.ff+json;charset=utf-8","tags":{}}
29
+ {"key":"Database:ConnectionString","label":"test","contentType":"application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8","tags":{}}
30
+ {"key":"TestEnv","label":"dev","contentType":null,"tags":{"tag1":"value1","tag2":"value2"}}
31
+ ✔ Succeed to import key-values file with importMode as All and profile as kvset
32
+ The following settings will be removed from App Configuration:
33
+
34
+ The following settings will be written to App Configuration:
35
+ {"key":"TestEnv","label":"dev","contentType":null,"tags":{"tag1":"value1","tag2":"value2"}}
36
+ ✔ Succeed to import key-values and log no matching key values with importMode as IgnoreMatch and profile as kvset
37
+ ✔ Fail when an invalid import mode is provided
38
+
39
+ Parse Json format file
40
+ ✔ Parse simple key value json file
41
+ ✔ Parse nested key value json file, does not set depth
42
+ ✔ Parse nested key value json file, set depth to 1
43
+ ✔ Parse nested key value json file, set depth to number larger than 1
44
+ ✔ Parse nested key value json file with array
45
+ ✔ Parse nested key value json file correctly when does not set separator and depth
46
+ ✔ Set Prefix, Label in options
47
+ ✔ Invalid key name, throw Argument Error
48
+ ✔ Parse simple key value yaml file
49
+ ✔ Parse simple key value yaml file, set separator and depth
50
+ ✔ Parse properties file, set separator and depth
51
+ ✔ Parse nested key value json file with json contentType
52
+ ✔ Parse nested key array json file with json contentType
53
+ ✔ Parse nested key array json file
54
+ ✔ Parse nested key array json file with arbitrary content type
55
+ ✔ Preserve arrays if content type is Json
56
+ ✔ Ignore empty objects when content type is not JSON
57
+ ✔ Handle null value present in json configuration file
58
+ ✔ Handle null value present in json configuration file, with json content type
59
+ ✔ Handle null value present in yaml configuration file
60
+
61
+ Parse FeatureFlag Json format file
62
+ ✔ Invalid FeatureFlag json format, no filter name
63
+ ✔ Invalid FeatureFlag json format, invalid format, type error
64
+ ✔ Invalid FeatureFlag json format, invalid format, no EnableFor attribute
65
+ ✔ Parse key value config and feature managment config correctly, skip feature flag keep default
66
+ ✔ Parse key value config and feature managment config correctly, skip feature flag
67
+ ✔ Parse key value config and feature managment config correctly, involve feature flag
68
+ ✔ Parse key value config and feature management config correctly, set tags,label and contentType
69
+ ✔ Importing feature flag properties file is not supported
70
+ ✔ Successfully parse configurations from properties file if includes not startswith feature-management
71
+ ✔ Successfully parse configurations from properties file if skipFeatureFlags is true
72
+ ✔ Parse feature flag yaml file
73
+
74
+ Iterator configuration source test
75
+ ✔ Successfully get configuration settings and override label and content type
76
+ ✔ Successfully import configuration settings and override label and content type
77
+ ✔ Successfully import configuration settings and feature flags when import mode is all
78
+ ✔ Successfully import only changed configuration settings when import mode is Ignore-Match
79
+ ✔ Successfully get configuration settings and feature flags
80
+ ✔ Successfully skip feature flags when skip feature flag is enabled
81
+ ✔ Successfully append prefix to feature flag
82
+ ✔ Successfully trim prefix for configuration settings
83
+ ✔ Successfully trim prefix for configuration settings and append prefix
84
+ ✔ Successfully trim prefix for feature flags and append prefix
85
+ ✔ Throw for invalid key prefix
86
+
87
+ Parse kvset format file
88
+ ✔ Parse kvset format file, get correct configurationSettings
89
+ ✔ Parse kvset format file, get error
90
+ ✔ Parse invalid kvset format file, get error
91
+ ✔ Parse invalid key file, get error
92
+ ✔ Parse invalid kvset format schema file, get error
93
+ ✔ Parse kvset file with invalid field, just ignore it, no error thrown
94
+ ✔ Parse kvset file with invalid tag, should throw correct error
95
+ ✔ Parse kvset file with invalid key name, should throw correct error
96
+ ✔ Parse kvset file with invalid key object, should throw correct error
97
+ ✔ Parse kvset file with invalid key with feature flag prefix, should throw correct error
98
+ ✔ Parse kvset file with invalid label, should throw correct error
99
+ ✔ Parse kvset file with invalid content_type, should throw correct error
100
+ ✔ Parse kvset file with invalid value, should throw correct error
101
+ ✔ Does not support parse kvset yaml file, throw error
102
+ The following settings will be removed from App Configuration:
103
+ {"key":"app:Settings:FontSize","label":"Dev"}
104
+ {"key":"app:Settings:BackgroundColor","label":"Dev","tags":{}}
105
+ {"key":"app:Settings:FontColor","label":"Dev","tags":{"tag1":"value1","tag2":"value2"}}
106
+
107
+ The following settings will be written to App Configuration:
108
+ {"key":".appconfig.featureflag/Test","label":"dev","contentType":"application/vnd.microsoft.appconfig.ff+json;charset=utf-8","tags":{}}
109
+ {"key":"Database:ConnectionString","label":"test","contentType":"application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8","tags":{}}
110
+ {"key":"TestEnv","label":"dev","contentType":null,"tags":{"tag1":"value1","tag2":"value2"}}
111
+ ✔ Delete key-values present in the store but not available in the config file
112
+ The following settings will be removed from App Configuration:
113
+ {"key":"app:Settings:FontSize","label":"Dev"}
114
+ {"key":"app:Settings:BackgroundColor","label":"Dev","tags":{}}
115
+ {"key":"app:Settings:FontColor","label":"Dev","tags":{"tag1":"value1","tag2":"value2"}}
116
+ {"key":".appconfig.featureflag/Test","label":"dev","contentType":"application/vnd.microsoft.appconfig.ff+json;charset=utf-8","tags":{}}
117
+ {"key":"Database:ConnectionString","label":"test","contentType":"application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8"}
118
+
119
+ The following settings will be written to App Configuration:
120
+ {"key":"app:Settings:FontSize","label":"Label1","contentType":"","tags":{}}
121
+ {"key":"app:Settings:BackgroundColor","label":"Label1","contentType":"","tags":{}}
122
+ {"key":"app:Settings:FontColor","label":"Label1","contentType":null,"tags":{"tag1":"value1","tag2":"value2"}}
123
+ {"key":"Database:ConnectionString","label":"Label1","contentType":"application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8","tags":{}}
124
+ {"key":"TestEnv","label":"Label1","contentType":null,"tags":{"tag1":"value1","tag2":"value2"}}
125
+ {"key":"TestEnv","label":"dev","contentType":null,"tags":{"tag1":"value1","tag2":"value2"}}
126
+ ✔ Delete key-values present in the store but not available in the config file, with similar key but different label
127
+
128
+ Readable stream configuration settings source tests
129
+ ✔ Successfully get configuration settings from readable stream source, json file
130
+ ✔ Successfully get configuration settings from readable stream source, yaml file
131
+ ✔ Successfully get configuration settings from large readable stream source with 5000 kvs
132
+ ✔ Successfully import configuration settings from readable stream source
133
+ ✔ Successfully get configuration settings from readable stream source(Node JS), json file
134
+ ✔ Throw error if the readable stream is not utf8
135
+
136
+ Parse sercret reference file
137
+ ✔ Parse secret reference file, get correct configurationSettings
138
+ ✔ Parse secret reference file, no uri specified
139
+
140
+ String configuration source test
141
+ ✔ Throw argument error when set unexpected option when the profile is kvset
142
+ ✔ Throw argument error if format is not json when the profile is kvset
143
+ ✔ Throw argument error if depth is set but separator is not
144
+ ✔ Throw argument error if separator is not valid
145
+ ✔ Throw error if string is not UTF8 encoded
146
+ ✔ Throw error if string is not in valid json format
147
+ ✔ Throw error if string is not in valid yaml format
148
+ ✔ Throw error if string content is not valid object
149
+ ✔ Throw error if format is not json when the contentType is json
150
+ ✔ Ignore comments in json file
151
+
152
+ Test the utility methods
153
+ ✔ Determine the content type is json contentType
154
+ ✔ Determine the content type is not json contentType
155
+ ✔ Determine if Tags with different values are not equal
156
+ ✔ Determine if Tags with similar values are equal
157
+ ✔ Determine if key-values with different values are not equal
158
+ ✔ Determine if key-values with similar values are equal
159
+ ✔ Determine if feature flag values with same values are equal
160
+ ✔ Determine if feature flag values with different values are not equal
161
+
162
+
163
+ 96 passing (1s)
164
+
@@ -0,0 +1,136 @@
1
+ ## API Report File for "@azure/app-configuration-importer"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="node" />
8
+
9
+ import { AppConfigurationClient } from '@azure/app-configuration';
10
+ import { ConfigurationSetting } from '@azure/app-configuration';
11
+ import { FeatureFlagValue } from '@azure/app-configuration';
12
+ import { ListConfigurationSettingPage } from '@azure/app-configuration';
13
+ import { ListConfigurationSettingsOptions } from '@azure/app-configuration';
14
+ import { PagedAsyncIterableIterator } from '@azure/core-paging';
15
+ import { PageSettings } from '@azure/core-paging';
16
+ import { SecretReferenceValue } from '@azure/app-configuration';
17
+ import { SetConfigurationSettingParam } from '@azure/app-configuration';
18
+
19
+ // @public
20
+ export class AppConfigurationImporter {
21
+ constructor(configurationClient: AppConfigurationClient);
22
+ Import(configSettingsSource: ConfigurationSettingsSource, timeout: number, strict?: boolean, progressCallback?: (progress: ImportResult) => unknown, importMode?: ImportMode, dryRun?: boolean): Promise<void>;
23
+ }
24
+
25
+ // @public
26
+ export class ArgumentError extends Error {
27
+ constructor(message: string);
28
+ }
29
+
30
+ // @public
31
+ export class ArgumentNullError extends Error {
32
+ }
33
+
34
+ // @public
35
+ export enum ConfigurationFormat {
36
+ // (undocumented)
37
+ Json = 0,
38
+ // (undocumented)
39
+ Properties = 1,
40
+ // (undocumented)
41
+ Yaml = 2
42
+ }
43
+
44
+ // @public
45
+ export enum ConfigurationProfile {
46
+ // (undocumented)
47
+ Default = 0,
48
+ // (undocumented)
49
+ KvSet = 1
50
+ }
51
+
52
+ // @public
53
+ export interface ConfigurationSettingsSource {
54
+ FilterOptions: ListConfigurationSettingsOptions;
55
+ GetConfigurationSettings(): Promise<Array<SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>>>;
56
+ }
57
+
58
+ // @public
59
+ export enum ImportMode {
60
+ // (undocumented)
61
+ All = 0,
62
+ // (undocumented)
63
+ IgnoreMatch = 1
64
+ }
65
+
66
+ // @public (undocumented)
67
+ export interface ImportResult {
68
+ // (undocumented)
69
+ importCount: number;
70
+ // (undocumented)
71
+ successCount: number;
72
+ }
73
+
74
+ // @public (undocumented)
75
+ export class IterableConfigurationSettingsSource implements ConfigurationSettingsSource {
76
+ constructor(options: IterableSourceOptions);
77
+ // (undocumented)
78
+ FilterOptions: ListConfigurationSettingsOptions;
79
+ // (undocumented)
80
+ GetConfigurationSettings(): Promise<SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>[]>;
81
+ }
82
+
83
+ // Warning: (ae-forgotten-export) The symbol "Options" needs to be exported by the entry point index.d.ts
84
+ //
85
+ // @public (undocumented)
86
+ export type IterableSourceOptions = Options & {
87
+ data: PagedAsyncIterableIterator<ConfigurationSetting<string>, ListConfigurationSettingPage, PageSettings>;
88
+ trimPrefix?: string;
89
+ };
90
+
91
+ // @public
92
+ export class OperationTimeoutError extends Error {
93
+ constructor();
94
+ }
95
+
96
+ // @public
97
+ export class ParseError extends Error {
98
+ constructor(message: string);
99
+ // (undocumented)
100
+ message: string;
101
+ }
102
+
103
+ // @public (undocumented)
104
+ export class ReadableStreamConfigurationSettingsSource implements ConfigurationSettingsSource {
105
+ constructor(options: ReadableStreamSourceOptions);
106
+ // (undocumented)
107
+ FilterOptions: ListConfigurationSettingsOptions;
108
+ // (undocumented)
109
+ GetConfigurationSettings(): Promise<SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>[]>;
110
+ }
111
+
112
+ // Warning: (ae-forgotten-export) The symbol "SourceOptions" needs to be exported by the entry point index.d.ts
113
+ //
114
+ // @public (undocumented)
115
+ export type ReadableStreamSourceOptions = SourceOptions & {
116
+ data: ReadableStream<Uint8Array> | NodeJS.ReadableStream;
117
+ };
118
+
119
+ // @public
120
+ export class StringConfigurationSettingsSource implements ConfigurationSettingsSource {
121
+ constructor(options: StringSourceOptions);
122
+ // (undocumented)
123
+ FilterOptions: ListConfigurationSettingsOptions;
124
+ // (undocumented)
125
+ GetConfigurationSettings(): Promise<SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>[]>;
126
+ protected getConfigurationSettingsInternal(data: string): Array<SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>>;
127
+ }
128
+
129
+ // @public
130
+ export type StringSourceOptions = SourceOptions & {
131
+ data: string;
132
+ };
133
+
134
+ // (No @packageDocumentation comment for this package)
135
+
136
+ ```