@azure/app-configuration-importer 1.1.2-preview → 2.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/dist/index.js +740 -97
- package/dist/index.js.map +1 -1
- package/dist-esm/src/appConfigurationImporter.js +119 -65
- package/dist-esm/src/appConfigurationImporter.js.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/internal/parsers/configurationSettingsConverter.js.map +1 -1
- package/dist-esm/src/internal/parsers/defaultConfigurationSettingsConverter.js.map +1 -1
- package/dist-esm/src/internal/utils.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/{importOptions.js → options.js} +1 -1
- package/dist-esm/src/options.js.map +1 -0
- package/dist-esm/src/settingsImport/configurationChangesSource.js +33 -0
- package/dist-esm/src/settingsImport/configurationChangesSource.js.map +1 -0
- package/dist-esm/src/settingsImport/configurationSettingsSource.js.map +1 -1
- package/dist-esm/src/settingsImport/iterableConfigurationSettingsSource.js.map +1 -1
- package/dist-esm/src/settingsImport/readableStreamConfigurationSettingsSource.js.map +1 -1
- package/dist-esm/src/settingsImport/stringConfigurationSettingsSource.js.map +1 -1
- package/package.json +2 -2
- package/types/azure-app-configuration-importer.d.ts +93 -12
- package/types/src/appConfigurationImporter.d.ts +37 -10
- package/types/src/appConfigurationImporter.d.ts.map +1 -1
- package/types/src/index.d.ts +3 -2
- package/types/src/index.d.ts.map +1 -1
- package/types/src/internal/parsers/configurationSettingsConverter.d.ts +1 -1
- package/types/src/internal/parsers/configurationSettingsConverter.d.ts.map +1 -1
- package/types/src/internal/parsers/defaultConfigurationSettingsConverter.d.ts +1 -1
- package/types/src/internal/parsers/defaultConfigurationSettingsConverter.d.ts.map +1 -1
- package/types/src/internal/utils.d.ts +1 -1
- package/types/src/internal/utils.d.ts.map +1 -1
- package/types/src/models.d.ts +7 -0
- package/types/src/models.d.ts.map +1 -1
- package/types/src/{importOptions.d.ts → options.d.ts} +26 -3
- package/types/src/options.d.ts.map +1 -0
- package/types/src/settingsImport/configurationChangesSource.d.ts +27 -0
- package/types/src/settingsImport/configurationChangesSource.d.ts.map +1 -0
- package/types/src/settingsImport/configurationSettingsSource.d.ts +4 -3
- package/types/src/settingsImport/configurationSettingsSource.d.ts.map +1 -1
- package/types/src/settingsImport/iterableConfigurationSettingsSource.d.ts +1 -1
- package/types/src/settingsImport/iterableConfigurationSettingsSource.d.ts.map +1 -1
- package/types/src/settingsImport/readableStreamConfigurationSettingsSource.d.ts +1 -1
- package/types/src/settingsImport/readableStreamConfigurationSettingsSource.d.ts.map +1 -1
- package/types/src/settingsImport/stringConfigurationSettingsSource.d.ts +1 -1
- package/types/src/settingsImport/stringConfigurationSettingsSource.d.ts.map +1 -1
- package/dist-esm/src/importOptions.js.map +0 -1
- package/types/src/importOptions.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('node:crypto'), require('stream')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'node:crypto', 'stream'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["azure-app-configuration-importer"] = {}, global.crypto, global.stream));
|
|
5
|
-
})(this, (function (exports, crypto, stream) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('node:os'), require('node:util'), require('node:process'), require('node:crypto'), require('stream')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'node:os', 'node:util', 'node:process', 'node:crypto', 'stream'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["azure-app-configuration-importer"] = {}, global.require$$1, global.require$$2, global.require$$3$1, global.crypto, global.stream));
|
|
5
|
+
})(this, (function (exports, require$$1, require$$2, require$$3$1, crypto, stream) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
+
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
10
|
+
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
11
|
+
var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3$1);
|
|
9
12
|
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
|
10
13
|
|
|
11
14
|
/******************************************************************************
|
|
@@ -39,6 +42,17 @@
|
|
|
39
42
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
40
43
|
}
|
|
41
44
|
|
|
45
|
+
var __assign = function() {
|
|
46
|
+
__assign = Object.assign || function __assign(t) {
|
|
47
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
48
|
+
s = arguments[i];
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
50
|
+
}
|
|
51
|
+
return t;
|
|
52
|
+
};
|
|
53
|
+
return __assign.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
|
|
42
56
|
function __rest(s, e) {
|
|
43
57
|
var t = {};
|
|
44
58
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -51,6 +65,116 @@
|
|
|
51
65
|
return t;
|
|
52
66
|
}
|
|
53
67
|
|
|
68
|
+
function __decorate(decorators, target, key, desc) {
|
|
69
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
70
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
71
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
72
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function __param(paramIndex, decorator) {
|
|
76
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
80
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
81
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
82
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
83
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
84
|
+
var _, done = false;
|
|
85
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
86
|
+
var context = {};
|
|
87
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
88
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
89
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
90
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
91
|
+
if (kind === "accessor") {
|
|
92
|
+
if (result === void 0) continue;
|
|
93
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
94
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
95
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
96
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
97
|
+
}
|
|
98
|
+
else if (_ = accept(result)) {
|
|
99
|
+
if (kind === "field") initializers.unshift(_);
|
|
100
|
+
else descriptor[key] = _;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
104
|
+
done = true;
|
|
105
|
+
}
|
|
106
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
107
|
+
var useValue = arguments.length > 2;
|
|
108
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
109
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
110
|
+
}
|
|
111
|
+
return useValue ? value : void 0;
|
|
112
|
+
}
|
|
113
|
+
function __propKey(x) {
|
|
114
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
|
115
|
+
}
|
|
116
|
+
function __setFunctionName(f, name, prefix) {
|
|
117
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
118
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
119
|
+
}
|
|
120
|
+
function __metadata(metadataKey, metadataValue) {
|
|
121
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
125
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
126
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
127
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
128
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
129
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
130
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function __generator(thisArg, body) {
|
|
135
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
136
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
137
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
138
|
+
function step(op) {
|
|
139
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
140
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
141
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
142
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
143
|
+
switch (op[0]) {
|
|
144
|
+
case 0: case 1: t = op; break;
|
|
145
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
146
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
147
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
148
|
+
default:
|
|
149
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
150
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
151
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
152
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
153
|
+
if (t[2]) _.ops.pop();
|
|
154
|
+
_.trys.pop(); continue;
|
|
155
|
+
}
|
|
156
|
+
op = body.call(thisArg, _);
|
|
157
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
158
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
163
|
+
if (k2 === undefined) k2 = k;
|
|
164
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
165
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
166
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
167
|
+
}
|
|
168
|
+
Object.defineProperty(o, k2, desc);
|
|
169
|
+
}) : (function(o, m, k, k2) {
|
|
170
|
+
if (k2 === undefined) k2 = k;
|
|
171
|
+
o[k2] = m[k];
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
function __exportStar(m, o) {
|
|
175
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
176
|
+
}
|
|
177
|
+
|
|
54
178
|
function __values$2(o) {
|
|
55
179
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
56
180
|
if (m) return m.call(o);
|
|
@@ -80,6 +204,22 @@
|
|
|
80
204
|
return ar;
|
|
81
205
|
}
|
|
82
206
|
|
|
207
|
+
/** @deprecated */
|
|
208
|
+
function __spread() {
|
|
209
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
210
|
+
ar = ar.concat(__read$1(arguments[i]));
|
|
211
|
+
return ar;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** @deprecated */
|
|
215
|
+
function __spreadArrays() {
|
|
216
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
217
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
218
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
219
|
+
r[k] = a[j];
|
|
220
|
+
return r;
|
|
221
|
+
}
|
|
222
|
+
|
|
83
223
|
function __spreadArray(to, from, pack) {
|
|
84
224
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
85
225
|
if (ar || !(i in from)) {
|
|
@@ -90,6 +230,29 @@
|
|
|
90
230
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
91
231
|
}
|
|
92
232
|
|
|
233
|
+
function __await(v) {
|
|
234
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
238
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
239
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
240
|
+
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
241
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
242
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
243
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
244
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
245
|
+
function fulfill(value) { resume("next", value); }
|
|
246
|
+
function reject(value) { resume("throw", value); }
|
|
247
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function __asyncDelegator(o) {
|
|
251
|
+
var i, p;
|
|
252
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
253
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
254
|
+
}
|
|
255
|
+
|
|
93
256
|
function __asyncValues(o) {
|
|
94
257
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
95
258
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -98,38 +261,161 @@
|
|
|
98
261
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
99
262
|
}
|
|
100
263
|
|
|
101
|
-
|
|
264
|
+
function __makeTemplateObject(cooked, raw) {
|
|
265
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
266
|
+
return cooked;
|
|
267
|
+
}
|
|
268
|
+
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
269
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
270
|
+
}) : function(o, v) {
|
|
271
|
+
o["default"] = v;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
function __importStar(mod) {
|
|
275
|
+
if (mod && mod.__esModule) return mod;
|
|
276
|
+
var result = {};
|
|
277
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
278
|
+
__setModuleDefault(result, mod);
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function __importDefault(mod) {
|
|
283
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
287
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
288
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
289
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
293
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
294
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
295
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
296
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
300
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
|
301
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function __addDisposableResource(env, value, async) {
|
|
305
|
+
if (value !== null && value !== void 0) {
|
|
306
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
307
|
+
var dispose, inner;
|
|
308
|
+
if (async) {
|
|
309
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
310
|
+
dispose = value[Symbol.asyncDispose];
|
|
311
|
+
}
|
|
312
|
+
if (dispose === void 0) {
|
|
313
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
314
|
+
dispose = value[Symbol.dispose];
|
|
315
|
+
if (async) inner = dispose;
|
|
316
|
+
}
|
|
317
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
318
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
319
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
320
|
+
}
|
|
321
|
+
else if (async) {
|
|
322
|
+
env.stack.push({ async: true });
|
|
323
|
+
}
|
|
324
|
+
return value;
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
102
329
|
var e = new Error(message);
|
|
103
330
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
function __disposeResources(env) {
|
|
334
|
+
function fail(e) {
|
|
335
|
+
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
336
|
+
env.hasError = true;
|
|
337
|
+
}
|
|
338
|
+
function next() {
|
|
339
|
+
while (env.stack.length) {
|
|
340
|
+
var rec = env.stack.pop();
|
|
341
|
+
try {
|
|
342
|
+
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
343
|
+
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
344
|
+
}
|
|
345
|
+
catch (e) {
|
|
346
|
+
fail(e);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (env.hasError) throw env.error;
|
|
350
|
+
}
|
|
351
|
+
return next();
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
var _tslib = {
|
|
355
|
+
__extends: __extends,
|
|
356
|
+
__assign: __assign,
|
|
357
|
+
__rest: __rest,
|
|
358
|
+
__decorate: __decorate,
|
|
359
|
+
__param: __param,
|
|
360
|
+
__metadata: __metadata,
|
|
361
|
+
__awaiter: __awaiter,
|
|
362
|
+
__generator: __generator,
|
|
363
|
+
__createBinding: __createBinding,
|
|
364
|
+
__exportStar: __exportStar,
|
|
365
|
+
__values: __values$2,
|
|
366
|
+
__read: __read$1,
|
|
367
|
+
__spread: __spread,
|
|
368
|
+
__spreadArrays: __spreadArrays,
|
|
369
|
+
__spreadArray: __spreadArray,
|
|
370
|
+
__await: __await,
|
|
371
|
+
__asyncGenerator: __asyncGenerator,
|
|
372
|
+
__asyncDelegator: __asyncDelegator,
|
|
373
|
+
__asyncValues: __asyncValues,
|
|
374
|
+
__makeTemplateObject: __makeTemplateObject,
|
|
375
|
+
__importStar: __importStar,
|
|
376
|
+
__importDefault: __importDefault,
|
|
377
|
+
__classPrivateFieldGet: __classPrivateFieldGet,
|
|
378
|
+
__classPrivateFieldSet: __classPrivateFieldSet,
|
|
379
|
+
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
380
|
+
__addDisposableResource: __addDisposableResource,
|
|
381
|
+
__disposeResources: __disposeResources,
|
|
104
382
|
};
|
|
105
383
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
384
|
+
var _tslib$1 = /*#__PURE__*/Object.freeze({
|
|
385
|
+
__proto__: null,
|
|
386
|
+
__extends: __extends,
|
|
387
|
+
get __assign () { return __assign; },
|
|
388
|
+
__rest: __rest,
|
|
389
|
+
__decorate: __decorate,
|
|
390
|
+
__param: __param,
|
|
391
|
+
__esDecorate: __esDecorate,
|
|
392
|
+
__runInitializers: __runInitializers,
|
|
393
|
+
__propKey: __propKey,
|
|
394
|
+
__setFunctionName: __setFunctionName,
|
|
395
|
+
__metadata: __metadata,
|
|
396
|
+
__awaiter: __awaiter,
|
|
397
|
+
__generator: __generator,
|
|
398
|
+
__createBinding: __createBinding,
|
|
399
|
+
__exportStar: __exportStar,
|
|
400
|
+
__values: __values$2,
|
|
401
|
+
__read: __read$1,
|
|
402
|
+
__spread: __spread,
|
|
403
|
+
__spreadArrays: __spreadArrays,
|
|
404
|
+
__spreadArray: __spreadArray,
|
|
405
|
+
__await: __await,
|
|
406
|
+
__asyncGenerator: __asyncGenerator,
|
|
407
|
+
__asyncDelegator: __asyncDelegator,
|
|
408
|
+
__asyncValues: __asyncValues,
|
|
409
|
+
__makeTemplateObject: __makeTemplateObject,
|
|
410
|
+
__importStar: __importStar,
|
|
411
|
+
__importDefault: __importDefault,
|
|
412
|
+
__classPrivateFieldGet: __classPrivateFieldGet,
|
|
413
|
+
__classPrivateFieldSet: __classPrivateFieldSet,
|
|
414
|
+
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
415
|
+
__addDisposableResource: __addDisposableResource,
|
|
416
|
+
__disposeResources: __disposeResources,
|
|
417
|
+
'default': _tslib
|
|
418
|
+
});
|
|
133
419
|
|
|
134
420
|
// Copyright (c) Microsoft Corporation.
|
|
135
421
|
// Licensed under the MIT license.
|
|
@@ -184,6 +470,65 @@
|
|
|
184
470
|
}
|
|
185
471
|
}
|
|
186
472
|
|
|
473
|
+
// Copyright (c) Microsoft Corporation.
|
|
474
|
+
/**
|
|
475
|
+
* A ConfigurationSettingsSource that wraps pre-calculated configuration changes.
|
|
476
|
+
*
|
|
477
|
+
* Use this class to import changes that were previously obtained via GetConfigurationChanges().
|
|
478
|
+
*
|
|
479
|
+
* Example usage:
|
|
480
|
+
* ```ts
|
|
481
|
+
* // First, get the configuration changes
|
|
482
|
+
* const changes = await importer.GetConfigurationChanges(source);
|
|
483
|
+
*
|
|
484
|
+
* // Import the pre-calculated changes
|
|
485
|
+
* const changesSource = new ConfigurationChangesSource(changes);
|
|
486
|
+
* await importer.Import(changesSource, { timeout: 60 });
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
class ConfigurationChangesSource {
|
|
490
|
+
constructor(configurationChanges, filterOptions) {
|
|
491
|
+
if (filterOptions && Object.keys(filterOptions).length > 0) {
|
|
492
|
+
throw new ArgumentError("FilterOptions are not supported for ConfigurationChangesSource.");
|
|
493
|
+
}
|
|
494
|
+
this.configurationChanges = configurationChanges;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* @inheritdoc
|
|
498
|
+
*/
|
|
499
|
+
async GetConfigurationSettings() {
|
|
500
|
+
return this.configurationChanges;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Copyright (c) Microsoft Corporation.
|
|
505
|
+
// Licensed under the MIT license.
|
|
506
|
+
/**
|
|
507
|
+
* Enums of configuration Format.
|
|
508
|
+
*/
|
|
509
|
+
exports.ConfigurationFormat = void 0;
|
|
510
|
+
(function (ConfigurationFormat) {
|
|
511
|
+
ConfigurationFormat[ConfigurationFormat["Json"] = 0] = "Json";
|
|
512
|
+
ConfigurationFormat[ConfigurationFormat["Properties"] = 1] = "Properties";
|
|
513
|
+
ConfigurationFormat[ConfigurationFormat["Yaml"] = 2] = "Yaml";
|
|
514
|
+
})(exports.ConfigurationFormat || (exports.ConfigurationFormat = {}));
|
|
515
|
+
/**
|
|
516
|
+
* Enums of configuration Profile.
|
|
517
|
+
*/
|
|
518
|
+
exports.ConfigurationProfile = void 0;
|
|
519
|
+
(function (ConfigurationProfile) {
|
|
520
|
+
ConfigurationProfile[ConfigurationProfile["Default"] = 0] = "Default";
|
|
521
|
+
ConfigurationProfile[ConfigurationProfile["KvSet"] = 1] = "KvSet";
|
|
522
|
+
})(exports.ConfigurationProfile || (exports.ConfigurationProfile = {}));
|
|
523
|
+
/**
|
|
524
|
+
* Enums of import mode.
|
|
525
|
+
*/
|
|
526
|
+
exports.ImportMode = void 0;
|
|
527
|
+
(function (ImportMode) {
|
|
528
|
+
ImportMode[ImportMode["All"] = 0] = "All";
|
|
529
|
+
ImportMode[ImportMode["IgnoreMatch"] = 1] = "IgnoreMatch";
|
|
530
|
+
})(exports.ImportMode || (exports.ImportMode = {}));
|
|
531
|
+
|
|
187
532
|
function isFunction(value) {
|
|
188
533
|
return typeof value === 'function';
|
|
189
534
|
}
|
|
@@ -953,6 +1298,250 @@
|
|
|
953
1298
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
954
1299
|
}
|
|
955
1300
|
|
|
1301
|
+
function getAugmentedNamespace(n) {
|
|
1302
|
+
if (n.__esModule) return n;
|
|
1303
|
+
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
1304
|
+
Object.keys(n).forEach(function (k) {
|
|
1305
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1306
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
1307
|
+
enumerable: true,
|
|
1308
|
+
get: function () {
|
|
1309
|
+
return n[k];
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
});
|
|
1313
|
+
return a;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(_tslib$1);
|
|
1317
|
+
|
|
1318
|
+
var commonjs = {};
|
|
1319
|
+
|
|
1320
|
+
var debug = {};
|
|
1321
|
+
|
|
1322
|
+
var log$1 = {};
|
|
1323
|
+
|
|
1324
|
+
// Copyright (c) Microsoft Corporation.
|
|
1325
|
+
// Licensed under the MIT license.
|
|
1326
|
+
Object.defineProperty(log$1, "__esModule", { value: true });
|
|
1327
|
+
log$1.log = void 0;
|
|
1328
|
+
const tslib_1 = require$$0;
|
|
1329
|
+
const node_os_1 = require$$1__default["default"];
|
|
1330
|
+
const node_util_1 = tslib_1.__importDefault(require$$2__default["default"]);
|
|
1331
|
+
const process$1 = tslib_1.__importStar(require$$3__default["default"]);
|
|
1332
|
+
function log(message, ...args) {
|
|
1333
|
+
process$1.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`);
|
|
1334
|
+
}
|
|
1335
|
+
log$1.log = log;
|
|
1336
|
+
|
|
1337
|
+
// Copyright (c) Microsoft Corporation.
|
|
1338
|
+
// Licensed under the MIT license.
|
|
1339
|
+
Object.defineProperty(debug, "__esModule", { value: true });
|
|
1340
|
+
const log_js_1 = log$1;
|
|
1341
|
+
const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined;
|
|
1342
|
+
let enabledString;
|
|
1343
|
+
let enabledNamespaces = [];
|
|
1344
|
+
let skippedNamespaces = [];
|
|
1345
|
+
const debuggers = [];
|
|
1346
|
+
if (debugEnvVariable) {
|
|
1347
|
+
enable(debugEnvVariable);
|
|
1348
|
+
}
|
|
1349
|
+
const debugObj = Object.assign((namespace) => {
|
|
1350
|
+
return createDebugger(namespace);
|
|
1351
|
+
}, {
|
|
1352
|
+
enable,
|
|
1353
|
+
enabled,
|
|
1354
|
+
disable,
|
|
1355
|
+
log: log_js_1.log,
|
|
1356
|
+
});
|
|
1357
|
+
function enable(namespaces) {
|
|
1358
|
+
enabledString = namespaces;
|
|
1359
|
+
enabledNamespaces = [];
|
|
1360
|
+
skippedNamespaces = [];
|
|
1361
|
+
const wildcard = /\*/g;
|
|
1362
|
+
const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?"));
|
|
1363
|
+
for (const ns of namespaceList) {
|
|
1364
|
+
if (ns.startsWith("-")) {
|
|
1365
|
+
skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`));
|
|
1366
|
+
}
|
|
1367
|
+
else {
|
|
1368
|
+
enabledNamespaces.push(new RegExp(`^${ns}$`));
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
for (const instance of debuggers) {
|
|
1372
|
+
instance.enabled = enabled(instance.namespace);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function enabled(namespace) {
|
|
1376
|
+
if (namespace.endsWith("*")) {
|
|
1377
|
+
return true;
|
|
1378
|
+
}
|
|
1379
|
+
for (const skipped of skippedNamespaces) {
|
|
1380
|
+
if (skipped.test(namespace)) {
|
|
1381
|
+
return false;
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
for (const enabledNamespace of enabledNamespaces) {
|
|
1385
|
+
if (enabledNamespace.test(namespace)) {
|
|
1386
|
+
return true;
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
return false;
|
|
1390
|
+
}
|
|
1391
|
+
function disable() {
|
|
1392
|
+
const result = enabledString || "";
|
|
1393
|
+
enable("");
|
|
1394
|
+
return result;
|
|
1395
|
+
}
|
|
1396
|
+
function createDebugger(namespace) {
|
|
1397
|
+
const newDebugger = Object.assign(debug, {
|
|
1398
|
+
enabled: enabled(namespace),
|
|
1399
|
+
destroy,
|
|
1400
|
+
log: debugObj.log,
|
|
1401
|
+
namespace,
|
|
1402
|
+
extend: extend$1,
|
|
1403
|
+
});
|
|
1404
|
+
function debug(...args) {
|
|
1405
|
+
if (!newDebugger.enabled) {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
if (args.length > 0) {
|
|
1409
|
+
args[0] = `${namespace} ${args[0]}`;
|
|
1410
|
+
}
|
|
1411
|
+
newDebugger.log(...args);
|
|
1412
|
+
}
|
|
1413
|
+
debuggers.push(newDebugger);
|
|
1414
|
+
return newDebugger;
|
|
1415
|
+
}
|
|
1416
|
+
function destroy() {
|
|
1417
|
+
const index = debuggers.indexOf(this);
|
|
1418
|
+
if (index >= 0) {
|
|
1419
|
+
debuggers.splice(index, 1);
|
|
1420
|
+
return true;
|
|
1421
|
+
}
|
|
1422
|
+
return false;
|
|
1423
|
+
}
|
|
1424
|
+
function extend$1(namespace) {
|
|
1425
|
+
const newDebugger = createDebugger(`${this.namespace}:${namespace}`);
|
|
1426
|
+
newDebugger.log = this.log;
|
|
1427
|
+
return newDebugger;
|
|
1428
|
+
}
|
|
1429
|
+
debug.default = debugObj;
|
|
1430
|
+
|
|
1431
|
+
(function (exports) {
|
|
1432
|
+
// Copyright (c) Microsoft Corporation.
|
|
1433
|
+
// Licensed under the MIT license.
|
|
1434
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1435
|
+
exports.createClientLogger = exports.getLogLevel = exports.setLogLevel = exports.AzureLogger = void 0;
|
|
1436
|
+
const tslib_1 = require$$0;
|
|
1437
|
+
const debug_js_1 = tslib_1.__importDefault(debug);
|
|
1438
|
+
const registeredLoggers = new Set();
|
|
1439
|
+
const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL) || undefined;
|
|
1440
|
+
let azureLogLevel;
|
|
1441
|
+
/**
|
|
1442
|
+
* The AzureLogger provides a mechanism for overriding where logs are output to.
|
|
1443
|
+
* By default, logs are sent to stderr.
|
|
1444
|
+
* Override the `log` method to redirect logs to another location.
|
|
1445
|
+
*/
|
|
1446
|
+
exports.AzureLogger = (0, debug_js_1.default)("azure");
|
|
1447
|
+
exports.AzureLogger.log = (...args) => {
|
|
1448
|
+
debug_js_1.default.log(...args);
|
|
1449
|
+
};
|
|
1450
|
+
const AZURE_LOG_LEVELS = ["verbose", "info", "warning", "error"];
|
|
1451
|
+
if (logLevelFromEnv) {
|
|
1452
|
+
// avoid calling setLogLevel because we don't want a mis-set environment variable to crash
|
|
1453
|
+
if (isAzureLogLevel(logLevelFromEnv)) {
|
|
1454
|
+
setLogLevel(logLevelFromEnv);
|
|
1455
|
+
}
|
|
1456
|
+
else {
|
|
1457
|
+
console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Immediately enables logging at the specified log level. If no level is specified, logging is disabled.
|
|
1462
|
+
* @param level - The log level to enable for logging.
|
|
1463
|
+
* Options from most verbose to least verbose are:
|
|
1464
|
+
* - verbose
|
|
1465
|
+
* - info
|
|
1466
|
+
* - warning
|
|
1467
|
+
* - error
|
|
1468
|
+
*/
|
|
1469
|
+
function setLogLevel(level) {
|
|
1470
|
+
if (level && !isAzureLogLevel(level)) {
|
|
1471
|
+
throw new Error(`Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(",")}`);
|
|
1472
|
+
}
|
|
1473
|
+
azureLogLevel = level;
|
|
1474
|
+
const enabledNamespaces = [];
|
|
1475
|
+
for (const logger of registeredLoggers) {
|
|
1476
|
+
if (shouldEnable(logger)) {
|
|
1477
|
+
enabledNamespaces.push(logger.namespace);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
debug_js_1.default.enable(enabledNamespaces.join(","));
|
|
1481
|
+
}
|
|
1482
|
+
exports.setLogLevel = setLogLevel;
|
|
1483
|
+
/**
|
|
1484
|
+
* Retrieves the currently specified log level.
|
|
1485
|
+
*/
|
|
1486
|
+
function getLogLevel() {
|
|
1487
|
+
return azureLogLevel;
|
|
1488
|
+
}
|
|
1489
|
+
exports.getLogLevel = getLogLevel;
|
|
1490
|
+
const levelMap = {
|
|
1491
|
+
verbose: 400,
|
|
1492
|
+
info: 300,
|
|
1493
|
+
warning: 200,
|
|
1494
|
+
error: 100,
|
|
1495
|
+
};
|
|
1496
|
+
/**
|
|
1497
|
+
* Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`.
|
|
1498
|
+
* @param namespace - The name of the SDK package.
|
|
1499
|
+
* @hidden
|
|
1500
|
+
*/
|
|
1501
|
+
function createClientLogger(namespace) {
|
|
1502
|
+
const clientRootLogger = exports.AzureLogger.extend(namespace);
|
|
1503
|
+
patchLogMethod(exports.AzureLogger, clientRootLogger);
|
|
1504
|
+
return {
|
|
1505
|
+
error: createLogger(clientRootLogger, "error"),
|
|
1506
|
+
warning: createLogger(clientRootLogger, "warning"),
|
|
1507
|
+
info: createLogger(clientRootLogger, "info"),
|
|
1508
|
+
verbose: createLogger(clientRootLogger, "verbose"),
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
exports.createClientLogger = createClientLogger;
|
|
1512
|
+
function patchLogMethod(parent, child) {
|
|
1513
|
+
child.log = (...args) => {
|
|
1514
|
+
parent.log(...args);
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
function createLogger(parent, level) {
|
|
1518
|
+
const logger = Object.assign(parent.extend(level), {
|
|
1519
|
+
level,
|
|
1520
|
+
});
|
|
1521
|
+
patchLogMethod(parent, logger);
|
|
1522
|
+
if (shouldEnable(logger)) {
|
|
1523
|
+
const enabledNamespaces = debug_js_1.default.disable();
|
|
1524
|
+
debug_js_1.default.enable(enabledNamespaces + "," + logger.namespace);
|
|
1525
|
+
}
|
|
1526
|
+
registeredLoggers.add(logger);
|
|
1527
|
+
return logger;
|
|
1528
|
+
}
|
|
1529
|
+
function shouldEnable(logger) {
|
|
1530
|
+
return Boolean(azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]);
|
|
1531
|
+
}
|
|
1532
|
+
function isAzureLogLevel(logLevel) {
|
|
1533
|
+
return AZURE_LOG_LEVELS.includes(logLevel);
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
}(commonjs));
|
|
1537
|
+
|
|
1538
|
+
// Copyright (c) Microsoft Corporation.
|
|
1539
|
+
/**
|
|
1540
|
+
* The `@azure/logger` configuration for this package.
|
|
1541
|
+
* @internal
|
|
1542
|
+
*/
|
|
1543
|
+
commonjs.createClientLogger("app-config");
|
|
1544
|
+
|
|
956
1545
|
// Copyright (c) Microsoft Corporation.
|
|
957
1546
|
/**
|
|
958
1547
|
* The prefix for feature flags.
|
|
@@ -18437,31 +19026,84 @@
|
|
|
18437
19026
|
this.configurationClient = configurationClient;
|
|
18438
19027
|
}
|
|
18439
19028
|
/**
|
|
18440
|
-
* Import
|
|
19029
|
+
* Import settings into the Azure App Configuration service.
|
|
18441
19030
|
*
|
|
18442
19031
|
* Example usage:
|
|
18443
19032
|
* ```ts
|
|
18444
19033
|
* const fileData = fs.readFileSync("mylocalPath").toString();
|
|
18445
|
-
* const
|
|
19034
|
+
* const source = new StringConfigurationSettingsSource({data:fileData, format: ConfigurationFormat.Json});
|
|
19035
|
+
* await importer.Import(source, { timeout: 60 });
|
|
19036
|
+
* ```
|
|
19037
|
+
*
|
|
19038
|
+
* @param configurationSettingsSource - A ConfigurationSettingsSource instance.
|
|
19039
|
+
* @param options - Import options including timeout, progress callback, strict mode, and import mode.
|
|
19040
|
+
* @returns Promise<void>
|
|
19041
|
+
*/
|
|
19042
|
+
async Import(configurationSettingsSource, options) {
|
|
19043
|
+
if (configurationSettingsSource instanceof ConfigurationChangesSource) {
|
|
19044
|
+
// When using ConfigurationChanges, strict and importMode parameters are not applicable
|
|
19045
|
+
if ((options === null || options === void 0 ? void 0 : options.strict) || (options === null || options === void 0 ? void 0 : options.importMode)) {
|
|
19046
|
+
throw new ArgumentError("Parameters 'strict' and 'importMode' are not applicable when importing pre-calculated changes.");
|
|
19047
|
+
}
|
|
19048
|
+
}
|
|
19049
|
+
// Generate correlationRequestId for operations in the same activity
|
|
19050
|
+
const customCorrelationRequestId = v4();
|
|
19051
|
+
const customHeadersOption = {
|
|
19052
|
+
requestOptions: {
|
|
19053
|
+
customHeaders: {
|
|
19054
|
+
[Constants.CorrelationRequestIdHeader]: customCorrelationRequestId
|
|
19055
|
+
}
|
|
19056
|
+
}
|
|
19057
|
+
};
|
|
19058
|
+
const configurationChanges = await this.GetConfigurationChanges(configurationSettingsSource, options === null || options === void 0 ? void 0 : options.strict, options === null || options === void 0 ? void 0 : options.importMode, customHeadersOption);
|
|
19059
|
+
return await this.applyUpdatesToServer([...configurationChanges.ToAdd, ...configurationChanges.ToModify, ...configurationChanges.ToRefresh], configurationChanges.ToDelete, options.timeout, customHeadersOption, options.progressCallback);
|
|
19060
|
+
}
|
|
19061
|
+
/**
|
|
19062
|
+
* Get configuration changes between source settings and existing settings in Azure App Configuration service without applying any changes
|
|
19063
|
+
*
|
|
19064
|
+
* Example usage:
|
|
19065
|
+
* ```ts
|
|
19066
|
+
* const fileData = fs.readFileSync("mylocalPath").toString();
|
|
19067
|
+
* const configurationChanges = await client.GetConfigurationChanges(
|
|
19068
|
+
* new StringConfigurationSettingsSource({data:fileData, format: ConfigurationFormat.Json}),
|
|
19069
|
+
* false,
|
|
19070
|
+
* ImportMode.All,
|
|
19071
|
+
* options
|
|
19072
|
+
* );
|
|
18446
19073
|
* ```
|
|
18447
19074
|
* @param configSettingsSource - A ConfigurationSettingsSource instance.
|
|
18448
|
-
* @param strict - Use strict mode
|
|
18449
|
-
* @param
|
|
18450
|
-
*
|
|
18451
|
-
*
|
|
18452
|
-
* @param
|
|
19075
|
+
* @param strict - Use strict mode to delete settings not in source.
|
|
19076
|
+
* @param importMode - Determines the behavior when analyzing key-values.
|
|
19077
|
+
* 'All' will include all key-values.
|
|
19078
|
+
* 'Ignore-Match' will exclude settings that have matching key-values in App Configuration.
|
|
19079
|
+
* @param customHeadersOption - Custom headers for the operation.
|
|
19080
|
+
* @returns ConfigurationChanges object containing Added, Modified, and Deleted settings
|
|
18453
19081
|
*/
|
|
18454
|
-
async
|
|
19082
|
+
async GetConfigurationChanges(configSettingsSource, strict = false, importMode = exports.ImportMode.IgnoreMatch, customHeadersOption) {
|
|
18455
19083
|
var _a, e_1, _b, _c;
|
|
18456
|
-
|
|
18457
|
-
|
|
19084
|
+
this.validateImportMode(importMode);
|
|
19085
|
+
// Generate correlationRequestId for operations in the same activity
|
|
19086
|
+
if (!customHeadersOption) {
|
|
19087
|
+
const customCorrelationRequestId = v4();
|
|
19088
|
+
customHeadersOption = {
|
|
19089
|
+
requestOptions: {
|
|
19090
|
+
customHeaders: {
|
|
19091
|
+
[Constants.CorrelationRequestIdHeader]: customCorrelationRequestId
|
|
19092
|
+
}
|
|
19093
|
+
}
|
|
19094
|
+
};
|
|
18458
19095
|
}
|
|
18459
|
-
|
|
18460
|
-
|
|
19096
|
+
const configSettingsResult = await configSettingsSource.GetConfigurationSettings();
|
|
19097
|
+
// If the source returns ConfigurationChanges (e.g., ConfigurationChangesSource),
|
|
19098
|
+
// return them directly without further processing since changes are already calculated
|
|
19099
|
+
if (this.isConfigurationChanges(configSettingsResult)) {
|
|
19100
|
+
return configSettingsResult;
|
|
18461
19101
|
}
|
|
18462
|
-
|
|
18463
|
-
const configSettings = await configSettingsSource.GetConfigurationSettings();
|
|
19102
|
+
const configSettings = configSettingsResult;
|
|
18464
19103
|
const configurationSettingToDelete = [];
|
|
19104
|
+
const configurationSettingToModify = [];
|
|
19105
|
+
const configurationSettingToAdd = [];
|
|
19106
|
+
const configurationSettingToRefresh = [];
|
|
18465
19107
|
const srcKeyLabelLookUp = {};
|
|
18466
19108
|
configSettings.forEach((config) => {
|
|
18467
19109
|
if (!srcKeyLabelLookUp[config.key]) {
|
|
@@ -18469,72 +19111,58 @@
|
|
|
18469
19111
|
}
|
|
18470
19112
|
srcKeyLabelLookUp[config.key][config.label || ""] = true;
|
|
18471
19113
|
});
|
|
18472
|
-
|
|
18473
|
-
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18481
|
-
|
|
18482
|
-
|
|
18483
|
-
|
|
18484
|
-
|
|
18485
|
-
|
|
18486
|
-
|
|
18487
|
-
|
|
18488
|
-
|
|
18489
|
-
|
|
18490
|
-
configurationSettingToDelete.push(existing);
|
|
19114
|
+
configurationSettingToAdd.push(...configSettings);
|
|
19115
|
+
try {
|
|
19116
|
+
for (var _d = true, _e = __asyncValues(this.configurationClient.listConfigurationSettings(Object.assign(Object.assign({}, configSettingsSource.FilterOptions), customHeadersOption))), _f; _f = await _e.next(), _a = _f.done, !_a;) {
|
|
19117
|
+
_c = _f.value;
|
|
19118
|
+
_d = false;
|
|
19119
|
+
try {
|
|
19120
|
+
const existing = _c;
|
|
19121
|
+
const isKeyLabelPresent = srcKeyLabelLookUp[existing.key] && srcKeyLabelLookUp[existing.key][existing.label || ""];
|
|
19122
|
+
if (strict && !isKeyLabelPresent) {
|
|
19123
|
+
configurationSettingToDelete.push(existing);
|
|
19124
|
+
}
|
|
19125
|
+
const incoming = configSettings.find(configSetting => configSetting.key == existing.key && configSetting.label === existing.label);
|
|
19126
|
+
if (incoming) {
|
|
19127
|
+
// Remove from add list since it already exists
|
|
19128
|
+
configurationSettingToAdd.splice(configurationSettingToAdd.indexOf(incoming), 1);
|
|
19129
|
+
if (!isConfigSettingEqual(incoming, existing)) {
|
|
19130
|
+
// Key-value has changed, add to ToModify
|
|
19131
|
+
configurationSettingToModify.push(incoming);
|
|
18491
19132
|
}
|
|
18492
|
-
if (importMode
|
|
18493
|
-
|
|
18494
|
-
|
|
18495
|
-
if (incoming && isConfigSettingEqual(incoming, existing)) {
|
|
18496
|
-
configSettings.splice(configSettings.indexOf(incoming), 1);
|
|
18497
|
-
}
|
|
19133
|
+
else if (importMode === exports.ImportMode.All) {
|
|
19134
|
+
// Key-value is unchanged and importMode is All, add to ToRefresh
|
|
19135
|
+
configurationSettingToRefresh.push(incoming);
|
|
18498
19136
|
}
|
|
18499
19137
|
}
|
|
18500
|
-
finally {
|
|
18501
|
-
_d = true;
|
|
18502
|
-
}
|
|
18503
19138
|
}
|
|
18504
|
-
|
|
18505
|
-
|
|
18506
|
-
finally {
|
|
18507
|
-
try {
|
|
18508
|
-
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
19139
|
+
finally {
|
|
19140
|
+
_d = true;
|
|
18509
19141
|
}
|
|
18510
|
-
finally { if (e_1) throw e_1.error; }
|
|
18511
19142
|
}
|
|
18512
19143
|
}
|
|
18513
|
-
|
|
18514
|
-
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
}
|
|
18520
|
-
printUpdatesToConsole(settingsToAdd, settingsToDelete) {
|
|
18521
|
-
console.log("The following settings will be removed from App Configuration:");
|
|
18522
|
-
for (const setting of settingsToDelete) {
|
|
18523
|
-
console.log(JSON.stringify({ key: setting.key, label: setting.label, contentType: setting.contentType, tags: setting.tags }));
|
|
18524
|
-
}
|
|
18525
|
-
console.log("\nThe following settings will be written to App Configuration:");
|
|
18526
|
-
for (const setting of settingsToAdd) {
|
|
18527
|
-
console.log(JSON.stringify({ key: setting.key, label: setting.label, contentType: setting.contentType, tags: setting.tags }));
|
|
19144
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
19145
|
+
finally {
|
|
19146
|
+
try {
|
|
19147
|
+
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
19148
|
+
}
|
|
19149
|
+
finally { if (e_1) throw e_1.error; }
|
|
18528
19150
|
}
|
|
19151
|
+
return {
|
|
19152
|
+
ToAdd: configurationSettingToAdd,
|
|
19153
|
+
ToModify: configurationSettingToModify,
|
|
19154
|
+
ToDelete: configurationSettingToDelete,
|
|
19155
|
+
ToRefresh: configurationSettingToRefresh
|
|
19156
|
+
};
|
|
18529
19157
|
}
|
|
18530
|
-
async applyUpdatesToServer(
|
|
19158
|
+
async applyUpdatesToServer(settingsToPut, settingsToDelete, timeout, options, progressCallback) {
|
|
18531
19159
|
const deleteTaskManager = this.newAdaptiveTaskManager((setting) => this.configurationClient.deleteConfigurationSetting(setting, options), settingsToDelete);
|
|
18532
19160
|
const startTime = Date.now();
|
|
18533
19161
|
await this.executeTasksWithTimeout(deleteTaskManager, timeout);
|
|
18534
19162
|
const endTime = Date.now();
|
|
18535
19163
|
const deleteTimeConsumed = (endTime - startTime) / 1000;
|
|
18536
19164
|
timeout -= deleteTimeConsumed;
|
|
18537
|
-
const importTaskManager = this.newAdaptiveTaskManager((setting) => this.configurationClient.setConfigurationSetting(setting, options),
|
|
19165
|
+
const importTaskManager = this.newAdaptiveTaskManager((setting) => this.configurationClient.setConfigurationSetting(setting, options), settingsToPut);
|
|
18538
19166
|
await this.executeTasksWithTimeout(importTaskManager, timeout, progressCallback);
|
|
18539
19167
|
}
|
|
18540
19168
|
newAdaptiveTaskManager(task, configurationSettings) {
|
|
@@ -18565,6 +19193,20 @@
|
|
|
18565
19193
|
throw new ArgumentError("Only options supported for Import Mode are 'All' and 'Ignore-Match'.");
|
|
18566
19194
|
}
|
|
18567
19195
|
}
|
|
19196
|
+
/**
|
|
19197
|
+
* Type guard to detect a ConfigurationChanges object.
|
|
19198
|
+
* @internal
|
|
19199
|
+
*/
|
|
19200
|
+
isConfigurationChanges(obj) {
|
|
19201
|
+
if (obj === null || typeof obj !== "object") {
|
|
19202
|
+
return false;
|
|
19203
|
+
}
|
|
19204
|
+
const configChanges = obj;
|
|
19205
|
+
return Array.isArray(configChanges.ToAdd) &&
|
|
19206
|
+
Array.isArray(configChanges.ToModify) &&
|
|
19207
|
+
Array.isArray(configChanges.ToDelete) &&
|
|
19208
|
+
Array.isArray(configChanges.ToRefresh);
|
|
19209
|
+
}
|
|
18568
19210
|
}
|
|
18569
19211
|
|
|
18570
19212
|
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
|
@@ -28894,6 +29536,7 @@
|
|
|
28894
29536
|
exports.AppConfigurationImporter = AppConfigurationImporter;
|
|
28895
29537
|
exports.ArgumentError = ArgumentError;
|
|
28896
29538
|
exports.ArgumentNullError = ArgumentNullError;
|
|
29539
|
+
exports.ConfigurationChangesSource = ConfigurationChangesSource;
|
|
28897
29540
|
exports.IterableConfigurationSettingsSource = IterableConfigurationSettingsSource;
|
|
28898
29541
|
exports.OperationTimeoutError = OperationTimeoutError;
|
|
28899
29542
|
exports.ParseError = ParseError;
|