@azure/app-configuration-importer 1.0.0-preview → 1.1.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.
Files changed (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/dist/index.js +7110 -217
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/MsFeatureFlagSchema.js +122 -0
  6. package/dist-esm/src/MsFeatureFlagSchema.js.map +1 -0
  7. package/dist-esm/src/appConfigurationImporter.js +157 -0
  8. package/dist-esm/src/appConfigurationImporter.js.map +1 -0
  9. package/dist-esm/src/enums.js +28 -0
  10. package/dist-esm/src/enums.js.map +1 -0
  11. package/dist-esm/src/errors.js +53 -0
  12. package/dist-esm/src/errors.js.map +1 -0
  13. package/dist-esm/src/featureFlag.js +12 -0
  14. package/dist-esm/src/featureFlag.js.map +1 -0
  15. package/dist-esm/src/importOptions.js +4 -0
  16. package/dist-esm/src/importOptions.js.map +1 -0
  17. package/dist-esm/src/index.js +9 -0
  18. package/dist-esm/src/index.js.map +1 -0
  19. package/dist-esm/src/internal/adaptiveTaskManager.js +69 -0
  20. package/dist-esm/src/internal/adaptiveTaskManager.js.map +1 -0
  21. package/dist-esm/src/internal/constants.js +36 -0
  22. package/dist-esm/src/internal/constants.js.map +1 -0
  23. package/dist-esm/src/internal/parsers/configurationSettingsConverter.js +4 -0
  24. package/dist-esm/src/internal/parsers/configurationSettingsConverter.js.map +1 -0
  25. package/dist-esm/src/internal/parsers/defaultConfigurationSettingsConverter.js +328 -0
  26. package/dist-esm/src/internal/parsers/defaultConfigurationSettingsConverter.js.map +1 -0
  27. package/dist-esm/src/internal/parsers/kvSetConfigurationSettingsConverter.js +66 -0
  28. package/dist-esm/src/internal/parsers/kvSetConfigurationSettingsConverter.js.map +1 -0
  29. package/dist-esm/src/internal/stream.browser.js +16 -0
  30. package/dist-esm/src/internal/stream.browser.js.map +1 -0
  31. package/dist-esm/src/internal/stream.js +15 -0
  32. package/dist-esm/src/internal/stream.js.map +1 -0
  33. package/dist-esm/src/internal/utils.js +129 -0
  34. package/dist-esm/src/internal/utils.js.map +1 -0
  35. package/dist-esm/src/models.js +4 -0
  36. package/dist-esm/src/models.js.map +1 -0
  37. package/dist-esm/src/settingsImport/configurationSettingsSource.js +4 -0
  38. package/dist-esm/src/settingsImport/configurationSettingsSource.js.map +1 -0
  39. package/dist-esm/src/settingsImport/iterableConfigurationSettingsSource.js +83 -0
  40. package/dist-esm/src/settingsImport/iterableConfigurationSettingsSource.js.map +1 -0
  41. package/dist-esm/src/settingsImport/readableStreamConfigurationSettingsSource.js +49 -0
  42. package/dist-esm/src/settingsImport/readableStreamConfigurationSettingsSource.js.map +1 -0
  43. package/dist-esm/src/settingsImport/stringConfigurationSettingsSource.js +92 -0
  44. package/dist-esm/src/settingsImport/stringConfigurationSettingsSource.js.map +1 -0
  45. package/package.json +20 -5
  46. package/types/azure-app-configuration-importer.d.ts +13 -0
  47. package/types/src/MsFeatureFlagSchema.d.ts +164 -0
  48. package/types/src/MsFeatureFlagSchema.d.ts.map +1 -0
  49. package/types/src/appConfigurationImporter.d.ts +37 -0
  50. package/types/src/appConfigurationImporter.d.ts.map +1 -0
  51. package/types/src/enums.d.ts +23 -0
  52. package/types/src/enums.d.ts.map +1 -0
  53. package/types/src/errors.d.ts +36 -0
  54. package/types/src/errors.d.ts.map +1 -0
  55. package/types/src/featureFlag.d.ts +50 -0
  56. package/types/src/featureFlag.d.ts.map +1 -0
  57. package/types/src/importOptions.d.ts +39 -0
  58. package/types/src/importOptions.d.ts.map +1 -0
  59. package/types/src/index.d.ts +10 -0
  60. package/types/src/index.d.ts.map +1 -0
  61. package/types/src/internal/adaptiveTaskManager.d.ts +20 -0
  62. package/types/src/internal/adaptiveTaskManager.d.ts.map +1 -0
  63. package/types/src/internal/constants.d.ts +10 -0
  64. package/types/src/internal/constants.d.ts.map +1 -0
  65. package/types/src/internal/parsers/configurationSettingsConverter.d.ts +11 -0
  66. package/types/src/internal/parsers/configurationSettingsConverter.d.ts.map +1 -0
  67. package/types/src/internal/parsers/defaultConfigurationSettingsConverter.d.ts +21 -0
  68. package/types/src/internal/parsers/defaultConfigurationSettingsConverter.d.ts.map +1 -0
  69. package/types/src/internal/parsers/kvSetConfigurationSettingsConverter.d.ts +15 -0
  70. package/types/src/internal/parsers/kvSetConfigurationSettingsConverter.d.ts.map +1 -0
  71. package/types/src/internal/stream.browser.d.ts +4 -0
  72. package/types/src/internal/stream.browser.d.ts.map +1 -0
  73. package/types/src/internal/stream.d.ts +4 -0
  74. package/types/src/internal/stream.d.ts.map +1 -0
  75. package/types/src/internal/utils.d.ts +17 -0
  76. package/types/src/internal/utils.d.ts.map +1 -0
  77. package/types/src/models.d.ts +42 -0
  78. package/types/src/models.d.ts.map +1 -0
  79. package/types/src/settingsImport/configurationSettingsSource.d.ts +19 -0
  80. package/types/src/settingsImport/configurationSettingsSource.d.ts.map +1 -0
  81. package/types/src/settingsImport/iterableConfigurationSettingsSource.d.ts +14 -0
  82. package/types/src/settingsImport/iterableConfigurationSettingsSource.d.ts.map +1 -0
  83. package/types/src/settingsImport/readableStreamConfigurationSettingsSource.d.ts +11 -0
  84. package/types/src/settingsImport/readableStreamConfigurationSettingsSource.d.ts.map +1 -0
  85. package/types/src/settingsImport/stringConfigurationSettingsSource.d.ts +24 -0
  86. package/types/src/settingsImport/stringConfigurationSettingsSource.d.ts.map +1 -0
  87. package/NOTICE.txt +0 -370
  88. package/app-configuration-importer.test.log +0 -164
  89. package/dist/app-configuration-importer.api.md +0 -136
  90. package/examples/README.md +0 -59
  91. package/examples/package.json +0 -32
  92. package/examples/sample.env +0 -6
  93. package/examples/testFiles/default.json +0 -24
  94. package/examples/testFiles/kvset.json +0 -35
  95. package/types/tsdoc-metadata.json +0 -11
@@ -0,0 +1,122 @@
1
+ import { RequirementType, StatusOverride } from "./featureFlag";
2
+ export const MsFeatureFlagValueSchema = {
3
+ type: "object",
4
+ properties: {
5
+ id: { type: "string" },
6
+ description: { type: "string", nullable: true },
7
+ enabled: { type: "boolean", nullable: true },
8
+ conditions: {
9
+ type: "object",
10
+ nullable: true,
11
+ properties: {
12
+ client_filters: {
13
+ type: "array",
14
+ minItems: 0,
15
+ nullable: true,
16
+ items: {
17
+ type: "object",
18
+ properties: {
19
+ name: { type: "string" },
20
+ parameters: { type: "object", nullable: true }
21
+ },
22
+ required: ["name"]
23
+ }
24
+ },
25
+ requirement_type: {
26
+ type: "string",
27
+ nullable: true,
28
+ enum: [RequirementType.All, RequirementType.Any]
29
+ }
30
+ }
31
+ },
32
+ display_name: { type: "string", nullable: true },
33
+ allocation: {
34
+ type: "object",
35
+ nullable: true,
36
+ properties: {
37
+ user: {
38
+ type: "array",
39
+ nullable: true,
40
+ items: {
41
+ type: "object",
42
+ properties: {
43
+ variant: { type: "string" },
44
+ users: {
45
+ type: "array",
46
+ items: { type: "string" }
47
+ }
48
+ },
49
+ required: ["variant", "users"]
50
+ }
51
+ },
52
+ group: {
53
+ type: "array",
54
+ nullable: true,
55
+ items: {
56
+ type: "object",
57
+ properties: {
58
+ variant: { type: "string" },
59
+ groups: {
60
+ type: "array",
61
+ items: { type: "string" }
62
+ }
63
+ },
64
+ required: ["variant", "groups"]
65
+ }
66
+ },
67
+ default_when_enabled: { type: "string", nullable: true },
68
+ default_when_disabled: { type: "string", nullable: true },
69
+ percentile: {
70
+ type: "array",
71
+ nullable: true,
72
+ items: {
73
+ type: "object",
74
+ properties: {
75
+ variant: { type: "string" },
76
+ from: { type: "number", minimum: 0, maximum: 100 },
77
+ to: { type: "number", minimum: 0, maximum: 100 }
78
+ },
79
+ required: ["variant", "from", "to"]
80
+ }
81
+ },
82
+ seed: { type: "string", nullable: true }
83
+ }
84
+ },
85
+ variants: {
86
+ type: "array",
87
+ nullable: true,
88
+ items: {
89
+ type: "object",
90
+ properties: {
91
+ name: { type: "string" },
92
+ configuration_value: {
93
+ oneOf: [
94
+ { type: "string" },
95
+ { type: "number" },
96
+ { type: "object", additionalProperties: true },
97
+ { type: "boolean" },
98
+ { type: "array" },
99
+ { type: "null" }
100
+ ]
101
+ },
102
+ status_override: {
103
+ type: "string",
104
+ nullable: true,
105
+ enum: [StatusOverride.None, StatusOverride.Enabled, StatusOverride.Disabled]
106
+ }
107
+ },
108
+ required: ["name"]
109
+ }
110
+ },
111
+ telemetry: {
112
+ type: "object",
113
+ nullable: true,
114
+ properties: {
115
+ enabled: { type: "boolean", nullable: true },
116
+ metadata: { type: "object", nullable: true }
117
+ }
118
+ }
119
+ },
120
+ required: ["id"]
121
+ };
122
+ //# sourceMappingURL=MsFeatureFlagSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MsFeatureFlagSchema.js","sourceRoot":"","sources":["../../src/MsFeatureFlagSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACtB,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/C,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC5C,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,cAAc,EAAE;oBACd,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,CAAC;oBACX,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAC;4BACvB,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;yBAC/C;wBACD,QAAQ,EAAE,CAAC,MAAM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,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC5C,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;aAC7C;SACF;KACF;IACD,QAAQ,EAAE,CAAC,IAAI,CAAC;CACjB,CAAC","sourcesContent":["import { RequirementType, StatusOverride } from \"./featureFlag\";\n\nexport const MsFeatureFlagValueSchema = {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n description: { type: \"string\", nullable: true },\n enabled: { type: \"boolean\", nullable: true },\n conditions: {\n type: \"object\",\n nullable: true,\n properties: {\n client_filters: {\n type: \"array\",\n minItems: 0,\n nullable: true,\n items: {\n type: \"object\",\n properties: {\n name: { type: \"string\"},\n parameters: { type: \"object\", nullable: true }\n },\n required: [\"name\"]\n }\n },\n requirement_type: {\n type: \"string\",\n nullable: true,\n enum: [RequirementType.All, RequirementType.Any] }\n }\n },\n display_name: { type: \"string\", nullable: true },\n allocation: {\n type: \"object\",\n nullable: true,\n properties: {\n user: {\n type: \"array\",\n nullable: true,\n items: {\n type: \"object\",\n properties: {\n variant: { type: \"string\" },\n users: {\n type: \"array\",\n items: { type: \"string\" }\n }\n },\n required: [\"variant\", \"users\"]\n }\n },\n group: {\n type: \"array\",\n nullable: true,\n items: {\n type: \"object\",\n properties: {\n variant: { type: \"string\" },\n groups: {\n type: \"array\",\n items: { type: \"string\" }\n }\n },\n required: [\"variant\", \"groups\"]\n }\n },\n default_when_enabled: { type: \"string\", nullable: true },\n default_when_disabled: { type: \"string\", nullable: true },\n percentile: {\n type: \"array\",\n nullable: true,\n items: {\n type: \"object\",\n properties: {\n variant: { type: \"string\" },\n from: { type: \"number\", minimum: 0, maximum: 100 },\n to: { type: \"number\", minimum: 0, maximum: 100 }\n },\n required: [\"variant\", \"from\", \"to\"]\n }\n },\n seed: { type: \"string\", nullable: true }\n }\n },\n variants: {\n type: \"array\",\n nullable: true,\n items: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n configuration_value: { \n oneOf: [\n { type: \"string\" },\n { type: \"number\" },\n { type: \"object\", additionalProperties: true },\n { type: \"boolean\"},\n { type: \"array\"},\n { type: \"null\"}\n ]} as any,\n status_override: {\n type: \"string\",\n nullable: true,\n enum: [StatusOverride.None, StatusOverride.Enabled, StatusOverride.Disabled]\n }\n },\n required: [\"name\"]\n }\n },\n telemetry: {\n type: \"object\",\n nullable: true,\n properties: {\n enabled: { type: \"boolean\", nullable: true },\n metadata: { type: \"object\", nullable: true }\n }\n }\n },\n required: [\"id\"]\n};"]}
@@ -0,0 +1,157 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
4
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5
+ var m = o[Symbol.asyncIterator], i;
6
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
7
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
8
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
9
+ };
10
+ import { ImportMode } from "./enums";
11
+ import { OperationTimeoutError, ArgumentError } from "./errors";
12
+ import { AdaptiveTaskManager } from "./internal/adaptiveTaskManager";
13
+ import { isConfigSettingEqual } from "./internal/utils";
14
+ import { v4 as uuidv4 } from "uuid";
15
+ import { Constants } from "./internal/constants";
16
+ /**
17
+ * Entrypoint class for sync configuration
18
+ */
19
+ export class AppConfigurationImporter {
20
+ /**
21
+ * Initializes a new instance of the AppConfigurationSync class.
22
+ * @param configurationClient - App configuration client for manipulate the target App Configuration.
23
+ */
24
+ constructor(configurationClient) {
25
+ this.configurationClient = configurationClient;
26
+ }
27
+ /**
28
+ * Import source settings into the Azure App Configuration service
29
+ *
30
+ * Example usage:
31
+ * ```ts
32
+ * const fileData = fs.readFileSync("mylocalPath").toString();
33
+ * const result = await asyncClient.Import(new StringConfigurationSettingsSource({data:fileData, format: ConfigurationFormat.Json}));
34
+ * ```
35
+ * @param configSettingsSource - A ConfigurationSettingsSource instance.
36
+ * @param strict - Use strict mode or not.
37
+ * @param timeout - Seconds of entire import progress timeout
38
+ * @param progressCallback - Callback for report the progress of import
39
+ * @param importMode - Determines the behavior when importing key-values. The default value, 'All' will import all key-values in the input file to App Configuration. 'Ignore-Match' will only import settings that have no matching key-value in App Configuration.
40
+ * @param dryRun - When dry run is enabled, no updates will be performed to App Configuration. Instead, any updates that would have been performed in a normal run will be printed to the console for review
41
+ */
42
+ async Import(configSettingsSource, timeout, strict = false, progressCallback, importMode, dryRun) {
43
+ var _a, e_1, _b, _c;
44
+ if (importMode == undefined) {
45
+ importMode = ImportMode.IgnoreMatch;
46
+ }
47
+ if (dryRun == undefined) {
48
+ dryRun = false;
49
+ }
50
+ this.validateImportMode(importMode);
51
+ const configSettings = await configSettingsSource.GetConfigurationSettings();
52
+ const configurationSettingToDelete = [];
53
+ const srcKeyLabelLookUp = {};
54
+ configSettings.forEach((config) => {
55
+ if (!srcKeyLabelLookUp[config.key]) {
56
+ srcKeyLabelLookUp[config.key] = {};
57
+ }
58
+ srcKeyLabelLookUp[config.key][config.label || ""] = true;
59
+ });
60
+ // generate correlationRequestId for operations in the same activity
61
+ const customCorrelationRequestId = uuidv4();
62
+ const customHeadersOption = {
63
+ requestOptions: {
64
+ customHeaders: {
65
+ [Constants.CorrelationRequestIdHeader]: customCorrelationRequestId
66
+ }
67
+ }
68
+ };
69
+ if (strict || importMode == ImportMode.IgnoreMatch) {
70
+ try {
71
+ 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;) {
72
+ _c = _f.value;
73
+ _d = false;
74
+ try {
75
+ const existing = _c;
76
+ const isKeyLabelPresent = srcKeyLabelLookUp[existing.key] && srcKeyLabelLookUp[existing.key][existing.label || ""];
77
+ if (strict && !isKeyLabelPresent) {
78
+ configurationSettingToDelete.push(existing);
79
+ }
80
+ if (importMode == ImportMode.IgnoreMatch) {
81
+ const incoming = configSettings.find(configSetting => configSetting.key == existing.key &&
82
+ configSetting.label == existing.label);
83
+ if (incoming && isConfigSettingEqual(incoming, existing)) {
84
+ configSettings.splice(configSettings.indexOf(incoming), 1);
85
+ }
86
+ }
87
+ }
88
+ finally {
89
+ _d = true;
90
+ }
91
+ }
92
+ }
93
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
94
+ finally {
95
+ try {
96
+ if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
97
+ }
98
+ finally { if (e_1) throw e_1.error; }
99
+ }
100
+ }
101
+ if (dryRun) {
102
+ this.printUpdatesToConsole(configSettings, configurationSettingToDelete);
103
+ }
104
+ else {
105
+ await this.applyUpdatesToServer(configSettings, configurationSettingToDelete, timeout, customHeadersOption, progressCallback);
106
+ }
107
+ }
108
+ printUpdatesToConsole(settingsToAdd, settingsToDelete) {
109
+ console.log("The following settings will be removed from App Configuration:");
110
+ for (const setting of settingsToDelete) {
111
+ console.log(JSON.stringify({ key: setting.key, label: setting.label, contentType: setting.contentType, tags: setting.tags }));
112
+ }
113
+ console.log("\nThe following settings will be written to App Configuration:");
114
+ for (const setting of settingsToAdd) {
115
+ console.log(JSON.stringify({ key: setting.key, label: setting.label, contentType: setting.contentType, tags: setting.tags }));
116
+ }
117
+ }
118
+ async applyUpdatesToServer(settingsToAdd, settingsToDelete, timeout, options, progressCallback) {
119
+ const deleteTaskManager = this.newAdaptiveTaskManager((setting) => this.configurationClient.deleteConfigurationSetting(setting, options), settingsToDelete);
120
+ const startTime = Date.now();
121
+ await this.executeTasksWithTimeout(deleteTaskManager, timeout);
122
+ const endTime = Date.now();
123
+ const deleteTimeConsumed = (endTime - startTime) / 1000;
124
+ timeout -= deleteTimeConsumed;
125
+ const importTaskManager = this.newAdaptiveTaskManager((setting) => this.configurationClient.setConfigurationSetting(setting, options), settingsToAdd);
126
+ await this.executeTasksWithTimeout(importTaskManager, timeout, progressCallback);
127
+ }
128
+ newAdaptiveTaskManager(task, configurationSettings) {
129
+ let index = 0;
130
+ return new AdaptiveTaskManager(() => {
131
+ if (index == configurationSettings.length) {
132
+ return undefined;
133
+ }
134
+ const configSet = configurationSettings[index++];
135
+ return async () => {
136
+ return task(configSet);
137
+ };
138
+ }, configurationSettings.length);
139
+ }
140
+ async executeTasksWithTimeout(taskManager, timeInSeconds, callback) {
141
+ let timer;
142
+ const taskPromise = taskManager.Start(callback);
143
+ const timeoutPromise = new Promise((_, reject) => {
144
+ timer = setTimeout(() => reject(new OperationTimeoutError()), timeInSeconds * 1000);
145
+ });
146
+ await Promise.race([taskPromise, timeoutPromise]).finally(() => {
147
+ clearTimeout(timer); // clear timeout when importPromise successfully resolve or faultily reject.
148
+ });
149
+ }
150
+ validateImportMode(importMode) {
151
+ if (importMode && !(importMode == ImportMode.IgnoreMatch ||
152
+ importMode == ImportMode.All)) {
153
+ throw new ArgumentError("Only options supported for Import Mode are 'All' and 'Ignore-Match'.");
154
+ }
155
+ }
156
+ }
157
+ //# sourceMappingURL=appConfigurationImporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appConfigurationImporter.js","sourceRoot":"","sources":["../../src/appConfigurationImporter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;AASlC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,E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AE;YAC7D,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,4EAA4E;QACnG,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,kBAAkB,CAAC,UAAsB;QAC/C,IAAI,UAAU,IAAI,CAAC,CAAC,UAAU,IAAI,UAAU,CAAC,WAAW;YACtD,UAAU,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;YAC/B,MAAM,IAAI,aAAa,CAAC,sEAAsE,CAAC,CAAC;SACjG;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { \n AppConfigurationClient, \n ConfigurationSetting, \n SetConfigurationSettingParam, \n FeatureFlagValue, \n SecretReferenceValue } from \"@azure/app-configuration\";\nimport { ConfigurationSettingsSource } from \"./settingsImport/configurationSettingsSource\";\nimport { ImportMode } from \"./enums\";\nimport { OperationTimeoutError, ArgumentError } from \"./errors\";\nimport { AdaptiveTaskManager } from \"./internal/adaptiveTaskManager\";\nimport { ImportProgress, KeyLabelLookup } from \"./models\";\nimport { isConfigSettingEqual } from \"./internal/utils\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { Constants } from \"./internal/constants\";\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Entrypoint class for sync configuration\n */\nexport class AppConfigurationImporter {\n private configurationClient: AppConfigurationClient;\n /**\n * Initializes a new instance of the AppConfigurationSync class.\n * @param configurationClient - App configuration client for manipulate the target App Configuration.\n */\n constructor(configurationClient: AppConfigurationClient) {\n this.configurationClient = configurationClient;\n }\n\n /**\n * Import source settings into the Azure App Configuration service\n *\n * Example usage:\n * ```ts\n * const fileData = fs.readFileSync(\"mylocalPath\").toString();\n * const result = await asyncClient.Import(new StringConfigurationSettingsSource({data:fileData, format: ConfigurationFormat.Json}));\n * ```\n * @param configSettingsSource - A ConfigurationSettingsSource instance.\n * @param strict - Use strict mode or not.\n * @param timeout - Seconds of entire import progress timeout\n * @param progressCallback - Callback for report the progress of import\n * @param importMode - Determines the behavior when importing key-values. The default value, 'All' will import all key-values in the input file to App Configuration. 'Ignore-Match' will only import settings that have no matching key-value in App Configuration.\n * @param dryRun - When dry run is enabled, no updates will be performed to App Configuration. Instead, any updates that would have been performed in a normal run will be printed to the console for review\n */\n public async Import(\n configSettingsSource: ConfigurationSettingsSource,\n timeout: number,\n strict = false,\n progressCallback?: (progress: ImportProgress) => unknown,\n importMode?: ImportMode,\n dryRun?: boolean\n ) {\n if (importMode == undefined) {\n importMode = ImportMode.IgnoreMatch;\n }\n if (dryRun == undefined) {\n dryRun = false;\n }\n this.validateImportMode(importMode);\n\n const configSettings = await configSettingsSource.GetConfigurationSettings();\n\n const configurationSettingToDelete: ConfigurationSetting<string>[] = [];\n const srcKeyLabelLookUp: KeyLabelLookup = {};\n \n configSettings.forEach((config: SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>) => {\n if (!srcKeyLabelLookUp[config.key]) {\n srcKeyLabelLookUp[config.key] = {};\n }\n srcKeyLabelLookUp[config.key][config.label || \"\"] = true;\n });\n\n // generate correlationRequestId for operations in the same activity\n const customCorrelationRequestId: string = uuidv4();\n const customHeadersOption: OperationOptions = {\n requestOptions: {\n customHeaders: {\n [Constants.CorrelationRequestIdHeader]: customCorrelationRequestId\n }\n }\n };\n\n if (strict || importMode == ImportMode.IgnoreMatch) {\n for await (const existing of this.configurationClient.listConfigurationSettings({...configSettingsSource.FilterOptions, ...customHeadersOption})) {\n\n const isKeyLabelPresent: boolean = srcKeyLabelLookUp[existing.key] && srcKeyLabelLookUp[existing.key][existing.label || \"\"];\n \n if (strict && !isKeyLabelPresent) {\n configurationSettingToDelete.push(existing);\n }\n \n if (importMode == ImportMode.IgnoreMatch) {\n const incoming = configSettings.find(configSetting => configSetting.key == existing.key && \n configSetting.label == existing.label);\n \n if (incoming && isConfigSettingEqual(incoming, existing)) {\n configSettings.splice(configSettings.indexOf(incoming), 1);\n }\n }\n }\n }\n \n if (dryRun) {\n this.printUpdatesToConsole(configSettings, configurationSettingToDelete);\n }\n else {\n await this.applyUpdatesToServer(configSettings, configurationSettingToDelete, timeout, customHeadersOption, progressCallback);\n }\n }\n\n private printUpdatesToConsole(\n settingsToAdd: SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>[], \n settingsToDelete: ConfigurationSetting<string>[]\n ): void {\n console.log(\"The following settings will be removed from App Configuration:\");\n for (const setting of settingsToDelete) {\n\n console.log(JSON.stringify({key: setting.key, label: setting.label, contentType: setting.contentType, tags: setting.tags}));\n } \n\n console.log(\"\\nThe following settings will be written to App Configuration:\");\n for (const setting of settingsToAdd) {\n\n console.log(JSON.stringify({key: setting.key, label: setting.label, contentType: setting.contentType, tags: setting.tags}));\n }\n }\n\n private async applyUpdatesToServer(\n settingsToAdd: SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>[], \n settingsToDelete: ConfigurationSetting<string>[],\n timeout: number,\n options: OperationOptions,\n progressCallback?: (progress: ImportProgress) => unknown | undefined\n ): Promise<void> {\n const deleteTaskManager = this.newAdaptiveTaskManager((setting) => this.configurationClient.deleteConfigurationSetting(setting, options), settingsToDelete);\n const startTime = Date.now();\n await this.executeTasksWithTimeout(deleteTaskManager, timeout);\n const endTime = Date.now();\n const deleteTimeConsumed = (endTime - startTime) / 1000;\n timeout -= deleteTimeConsumed;\n\n const importTaskManager = this.newAdaptiveTaskManager((setting) => this.configurationClient.setConfigurationSetting(setting, options), settingsToAdd);\n await this.executeTasksWithTimeout(importTaskManager, timeout, progressCallback);\n }\n\n private newAdaptiveTaskManager<T>(task: (setting: T) => Promise<any>, configurationSettings: Array<T>) {\n let index = 0;\n return new AdaptiveTaskManager(() => {\n if (index == configurationSettings.length) {\n return undefined;\n }\n const configSet = configurationSettings[index++];\n\n return async () => {\n return task(configSet);\n };\n }, configurationSettings.length);\n }\n\n private async executeTasksWithTimeout<T>(taskManager: AdaptiveTaskManager<T>, timeInSeconds: number, callback?: (progress: ImportProgress) => unknown) {\n let timer: NodeJS.Timeout;\n const taskPromise = taskManager.Start(callback);\n const timeoutPromise = new Promise((_, reject) => {\n timer = setTimeout(() => reject(new OperationTimeoutError()), timeInSeconds * 1000);\n });\n await Promise.race([taskPromise, timeoutPromise]).finally(() => {\n clearTimeout(timer); // clear timeout when importPromise successfully resolve or faultily reject.\n });\n }\n\n private validateImportMode(importMode: ImportMode): void {\n if (importMode && !(importMode == ImportMode.IgnoreMatch || \n importMode == ImportMode.All)) {\n throw new ArgumentError(\"Only options supported for Import Mode are 'All' and 'Ignore-Match'.\");\n }\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * Enums of configuration Format.
5
+ */
6
+ export var ConfigurationFormat;
7
+ (function (ConfigurationFormat) {
8
+ ConfigurationFormat[ConfigurationFormat["Json"] = 0] = "Json";
9
+ ConfigurationFormat[ConfigurationFormat["Properties"] = 1] = "Properties";
10
+ ConfigurationFormat[ConfigurationFormat["Yaml"] = 2] = "Yaml";
11
+ })(ConfigurationFormat || (ConfigurationFormat = {}));
12
+ /**
13
+ * Enums of configuration Profile.
14
+ */
15
+ export var ConfigurationProfile;
16
+ (function (ConfigurationProfile) {
17
+ ConfigurationProfile[ConfigurationProfile["Default"] = 0] = "Default";
18
+ ConfigurationProfile[ConfigurationProfile["KvSet"] = 1] = "KvSet";
19
+ })(ConfigurationProfile || (ConfigurationProfile = {}));
20
+ /**
21
+ * Enums of import mode.
22
+ */
23
+ export var ImportMode;
24
+ (function (ImportMode) {
25
+ ImportMode[ImportMode["All"] = 0] = "All";
26
+ ImportMode[ImportMode["IgnoreMatch"] = 1] = "IgnoreMatch";
27
+ })(ImportMode || (ImportMode = {}));
28
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/enums.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,6DAAI,CAAA;IACJ,yEAAU,CAAA;IACV,6DAAI,CAAA;AACN,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qEAAO,CAAA;IACP,iEAAK,CAAA;AACP,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,yCAAG,CAAA;IACH,yDAAW,CAAA;AACb,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Enums of configuration Format.\n */\nexport enum ConfigurationFormat {\n Json,\n Properties,\n Yaml,\n}\n\n/**\n * Enums of configuration Profile.\n */\nexport enum ConfigurationProfile {\n Default,\n KvSet,\n}\n\n/**\n * Enums of import mode.\n */\nexport enum ImportMode {\n All,\n IgnoreMatch\n}"]}
@@ -0,0 +1,53 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * Custom error type used during input validation
5
+ */
6
+ export class ArgumentError extends Error {
7
+ constructor(message) {
8
+ super();
9
+ this.message = message;
10
+ }
11
+ }
12
+ /**
13
+ * Custom error type used during configuration file parsing
14
+ */
15
+ export class ParseError extends Error {
16
+ constructor(message) {
17
+ super();
18
+ this.message = message;
19
+ }
20
+ }
21
+ /**
22
+ * Custom error type used for set configuration timeout error
23
+ */
24
+ export class OperationTimeoutError extends Error {
25
+ constructor() {
26
+ super();
27
+ this.message = "The operation failed to complete within the specified time limit.";
28
+ }
29
+ }
30
+ /**
31
+ * Custom error type used when null arguments are passed
32
+ */
33
+ export class ArgumentNullError extends Error {
34
+ }
35
+ export class AjvValidationError extends Error {
36
+ constructor(validationErrors) {
37
+ super();
38
+ this.errors = this.parseAjvErrors(validationErrors);
39
+ }
40
+ parseAjvErrors(validationErrors) {
41
+ return validationErrors.map(error => ({
42
+ schemaPath: error.schemaPath,
43
+ message: error.message || ""
44
+ }));
45
+ }
46
+ getFriendlyMessage() {
47
+ return this.errors.map(error => {
48
+ const property = error.schemaPath ? `Property '${error.schemaPath}'` : "A property";
49
+ return `${property} ${error.message}`;
50
+ }).join(", ");
51
+ }
52
+ }
53
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAGnC,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,mEAAmE,CAAC;IACrF,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;CAAG;AAO/C,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAG3C,YAAY,gBAA+B;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;IACtD,CAAC;IAEO,cAAc,CAAC,gBAA+B;QACpD,OAAO,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACpC,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE;SAC7B,CAAC,CAAC,CAAC;IACN,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC;YACpF,OAAO,GAAG,QAAQ,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ErrorObject } from \"ajv\";\n\n/**\n * Custom error type used during input validation\n */\nexport class ArgumentError extends Error {\n constructor(message: string) {\n super();\n\n this.message = message;\n }\n}\n\n/**\n * Custom error type used during configuration file parsing\n */\nexport class ParseError extends Error {\n public message: string;\n\n constructor(message: string) {\n super();\n\n this.message = message;\n }\n}\n\n/**\n * Custom error type used for set configuration timeout error\n */\nexport class OperationTimeoutError extends Error {\n constructor() {\n super();\n this.message = \"The operation failed to complete within the specified time limit.\";\n }\n}\n\n/**\n * Custom error type used when null arguments are passed\n */\nexport class ArgumentNullError extends Error {}\n\nexport interface AjvErrorInfo {\n schemaPath: string;\n message: string;\n}\n\nexport class AjvValidationError extends Error {\n public errors: AjvErrorInfo[];\n\n constructor(validationErrors: ErrorObject[]) {\n super();\n this.errors = this.parseAjvErrors(validationErrors);\n }\n\n private parseAjvErrors(validationErrors: ErrorObject[]): AjvErrorInfo[] {\n return validationErrors.map(error => ({\n schemaPath: error.schemaPath,\n message: error.message || \"\"\n }));\n }\n\n public getFriendlyMessage(): string {\n return this.errors.map(error => {\n const property = error.schemaPath ? `Property '${error.schemaPath}'` : \"A property\";\n return `${property} ${error.message}`;\n }).join(\", \");\n }\n}"]}
@@ -0,0 +1,12 @@
1
+ export var RequirementType;
2
+ (function (RequirementType) {
3
+ RequirementType["Any"] = "Any";
4
+ RequirementType["All"] = "All";
5
+ })(RequirementType || (RequirementType = {}));
6
+ export var StatusOverride;
7
+ (function (StatusOverride) {
8
+ StatusOverride["None"] = "None";
9
+ StatusOverride["Enabled"] = "Enabled";
10
+ StatusOverride["Disabled"] = "Disabled";
11
+ })(StatusOverride || (StatusOverride = {}));
12
+ //# sourceMappingURL=featureFlag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featureFlag.js","sourceRoot":"","sources":["../../src/featureFlag.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,8BAAW,CAAA;IACX,8BAAW,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,qCAAoB,CAAA;IACpB,uCAAqB,CAAA;AACzB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB","sourcesContent":["import { ClientFilter } from \"./models\";\nimport { FeatureFlagValue } from \"@azure/app-configuration\";\n\nexport interface MsFeatureFlagValue extends FeatureFlagValue {\n conditions: {\n clientFilters: ClientFilter[];\n requirementType?: RequirementType\n };\n allocation?: Allocation;\n variants?: Variant[];\n telemetry?: {\n enabled?: boolean;\n metadata?: object;\n };\n}\n\nexport enum RequirementType {\n Any = \"Any\",\n All = \"All\"\n}\n\nexport enum StatusOverride {\n None = \"None\",\n Enabled = \"Enabled\",\n Disabled = \"Disabled\"\n}\n\nexport interface Allocation {\n user?: User [];\n group?: Group[];\n default_when_enabled?: string;\n default_when_disabled?: string;\n percentile?: Percentile[];\n seed?: string;\n}\n\nexport interface User {\n variant: string;\n users: string[]\n}\n\nexport interface Group {\n variant: string;\n groups: string[]\n}\n\nexport interface Percentile {\n variant: string;\n from: number;\n to: number;\n}\n\nexport interface Variant {\n name: string;\n configuration_value?: string | number | object | boolean;\n status_override?: StatusOverride;\n}"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export {};
4
+ //# sourceMappingURL=importOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importOptions.js","sourceRoot":"","sources":["../../src/importOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator, PageSettings } from \"@azure/core-paging\";\nimport { ConfigurationFormat, ConfigurationProfile } from \"./enums\";\nimport { Tags } from \"./models\";\nimport { ConfigurationSetting, ListConfigurationSettingPage } from \"@azure/app-configuration\";\n\ntype Options = {\n label?: string;\n skipFeatureFlags?: boolean;\n prefix?: string;\n contentType?: string;\n tags?: Tags;\n}\n\n/**\n * Base options for configuration import\n *\n * @internal\n */\nexport type SourceOptions = {\n format: ConfigurationFormat;\n separator?: string;\n depth?: number;\n profile?: ConfigurationProfile;\n} & Options;\n\n/**\n * Provides options for importing from string data source\n *\n */\nexport type StringSourceOptions = SourceOptions & {data: string; };\nexport type IterableSourceOptions = Options & { data: PagedAsyncIterableIterator<ConfigurationSetting<string>, ListConfigurationSettingPage, PageSettings>; trimPrefix?: string; };\nexport type ReadableStreamSourceOptions = SourceOptions & { data: ReadableStream<Uint8Array> | NodeJS.ReadableStream };"]}
@@ -0,0 +1,9 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export { AppConfigurationImporter } from "./appConfigurationImporter";
4
+ export * from "./enums";
5
+ export * from "./errors";
6
+ export { StringConfigurationSettingsSource } from "./settingsImport/stringConfigurationSettingsSource";
7
+ export { IterableConfigurationSettingsSource } from "./settingsImport/iterableConfigurationSettingsSource";
8
+ export { ReadableStreamConfigurationSettingsSource } from "./settingsImport/readableStreamConfigurationSettingsSource";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,iCAAiC,EAAE,MAAM,oDAAoD,CAAC;AAEvG,OAAO,EAAE,mCAAmC,EAAE,MAAM,sDAAsD,CAAC;AAC3G,OAAO,EAAE,yCAAyC,EAAE,MAAM,4DAA4D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { AppConfigurationImporter } from \"./appConfigurationImporter\";\nexport {\n StringSourceOptions,\n IterableSourceOptions,\n ReadableStreamSourceOptions\n} from \"./importOptions\";\nexport * from \"./enums\";\nexport * from \"./errors\";\nexport { ImportProgress as ImportResult } from \"./models\";\nexport { StringConfigurationSettingsSource } from \"./settingsImport/stringConfigurationSettingsSource\";\nexport { ConfigurationSettingsSource } from \"./settingsImport/configurationSettingsSource\";\nexport { IterableConfigurationSettingsSource } from \"./settingsImport/iterableConfigurationSettingsSource\";\nexport { ReadableStreamConfigurationSettingsSource } from \"./settingsImport/readableStreamConfigurationSettingsSource\";"]}
@@ -0,0 +1,69 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { BehaviorSubject } from "rxjs";
4
+ /** @internal */
5
+ export class AdaptiveTaskManager {
6
+ constructor(fn, size) {
7
+ this.end = false;
8
+ this.currentMax = 1;
9
+ this.limitation = 50;
10
+ this.finishedCount = 0;
11
+ this.throttledTasks = [];
12
+ this.runningTasks = new Map();
13
+ this.taskWrapper = fn;
14
+ this.observable = new BehaviorSubject(0);
15
+ this.importProgress = {
16
+ importCount: size,
17
+ successCount: 0
18
+ };
19
+ }
20
+ async Start(callback) {
21
+ return new Promise((resolve, reject) => {
22
+ this.observable.subscribe((value) => {
23
+ if (this.end && this.throttledTasks.length == 0) {
24
+ if (this.runningTasks.size == 0)
25
+ resolve(this.finishedCount);
26
+ return;
27
+ }
28
+ while (this.runningTasks.size < this.currentMax) {
29
+ const task = this.throttledTasks.length > 0 ? this.throttledTasks.pop() : this.taskWrapper();
30
+ if (!task) {
31
+ this.end = true;
32
+ this.observable.next(++value);
33
+ return;
34
+ }
35
+ const runningPromise = task();
36
+ runningPromise.then((value) => {
37
+ if (value) {
38
+ this.importProgress.successCount = ++this.finishedCount;
39
+ // If import can complete successfully and it didn't hit the limitation, increase currentMax.
40
+ if (this.currentMax < this.limitation && this.runningTasks.size <= this.currentMax)
41
+ this.currentMax++;
42
+ }
43
+ })
44
+ .catch((reason) => {
45
+ if (reason.statusCode === 429) {
46
+ // Once have any request be throttled, relegate the queue max size to 1, and push it into throttled collection.
47
+ this.currentMax = 1;
48
+ this.throttledTasks.push(this.runningTasks.get(runningPromise));
49
+ }
50
+ else {
51
+ reject(reason);
52
+ }
53
+ })
54
+ .finally(() => {
55
+ // remove the promise from the running collection, no matter it's success or not
56
+ if (this.runningTasks.has(runningPromise)) {
57
+ this.runningTasks.delete(runningPromise);
58
+ }
59
+ if (callback)
60
+ callback(this.importProgress);
61
+ this.observable.next(++value); // trigger next round
62
+ });
63
+ this.runningTasks.set(runningPromise, task);
64
+ }
65
+ });
66
+ });
67
+ }
68
+ }
69
+ //# sourceMappingURL=adaptiveTaskManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptiveTaskManager.js","sourceRoot":"","sources":["../../../src/internal/adaptiveTaskManager.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAIvC,gBAAgB;AAChB,MAAM,OAAO,mBAAmB;IAc9B,YAAY,EAAgD,EAAE,IAAY;QAblE,QAAG,GAAG,KAAK,CAAC;QACZ,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,EAAE,CAAC;QAChB,kBAAa,GAAG,CAAC,CAAC;QAClB,mBAAc,GAA4B,EAA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I,CAAC,aAAa,CAAC;4BACxD,6FAA6F;4BAC7F,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU;gCAAE,IAAI,CAAC,UAAU,EAAE,CAAC;yBACvG;oBACH,CAAC,CAAC;yBACC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;wBAChB,IAAK,MAAoB,CAAC,UAAU,KAAK,GAAG,EAAE;4BAC5C,+GAA+G;4BAC/G,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;4BACpB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAA0B,CAAC,CAAC;yBAC1F;6BACI;4BACH,MAAM,CAAC,MAAM,CAAC,CAAC;yBAChB;oBACH,CAAC,CAAC;yBACD,OAAO,CAAC,GAAS,EAAE;wBAClB,gFAAgF;wBAChF,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;4BACzC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;yBAC1C;wBACD,IAAI,QAAQ;4BAAE,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;wBAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,qBAAqB;oBACtD,CAAC,CAAC,CAAC;oBACL,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;iBAC7C;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { BehaviorSubject } from \"rxjs\";\nimport { ImportProgress } from \"../models\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/** @internal */\nexport class AdaptiveTaskManager<T> {\n private end = false;\n private currentMax = 1;\n private limitation = 50;\n private finishedCount = 0;\n private throttledTasks: IFunction<Promise<T>>[] = [];\n private runningTasks: Map<Promise<T>, IFunction<Promise<T>>> = new Map<\n Promise<T>,\n IFunction<Promise<T>>\n >();\n private taskWrapper: IFunction<IFunction<Promise<T>> | undefined>;\n private observable: BehaviorSubject<number>;\n private importProgress: ImportProgress;\n\n constructor(fn: IFunction<IFunction<Promise<T>> | undefined>, size: number) {\n this.taskWrapper = fn;\n this.observable = new BehaviorSubject(0);\n this.importProgress = {\n importCount: size,\n successCount: 0\n };\n }\n\n public async Start(callback?: (result: ImportProgress) => void) {\n return new Promise((resolve, reject) => {\n this.observable.subscribe((value: any) => {\n if (this.end && this.throttledTasks.length == 0) {\n if (this.runningTasks.size == 0) resolve(this.finishedCount);\n return;\n }\n while (this.runningTasks.size < this.currentMax) {\n const task: IFunction<Promise<T>> | undefined = this.throttledTasks.length > 0 ? this.throttledTasks.pop() : this.taskWrapper();\n\n if (!task) {\n this.end = true;\n this.observable.next(++value);\n return;\n }\n const runningPromise = task();\n runningPromise.then((value: any): void => {\n if (value) {\n this.importProgress.successCount = ++this.finishedCount;\n // If import can complete successfully and it didn't hit the limitation, increase currentMax.\n if (this.currentMax < this.limitation && this.runningTasks.size <= this.currentMax) this.currentMax++;\n }\n })\n .catch((reason) => {\n if ((reason as RestError).statusCode === 429) {\n // Once have any request be throttled, relegate the queue max size to 1, and push it into throttled collection.\n this.currentMax = 1;\n this.throttledTasks.push(this.runningTasks.get(runningPromise) as IFunction<Promise<T>>);\n }\n else {\n reject(reason);\n }\n })\n .finally((): void => {\n // remove the promise from the running collection, no matter it's success or not\n if (this.runningTasks.has(runningPromise)) {\n this.runningTasks.delete(runningPromise);\n }\n if (callback) callback(this.importProgress);\n this.observable.next(++value); // trigger next round\n });\n this.runningTasks.set(runningPromise, task);\n }\n });\n });\n }\n}\n\n/** @internal */\nexport interface IFunction<T> {\n (): T;\n}\n"]}
@@ -0,0 +1,36 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /** @internal*/
4
+ export const Constants = {
5
+ FeatureManagementKeyWords: [
6
+ "FeatureManagement",
7
+ "featureManagement",
8
+ "feature-management",
9
+ "feature_management"
10
+ ],
11
+ EnabledForKeyWords: [
12
+ "EnabledFor",
13
+ "enabledFor",
14
+ "enabled-for",
15
+ "enabled_for"
16
+ ],
17
+ RequirementTypeKeyWords: [
18
+ "RequirementType",
19
+ "requirementType",
20
+ "requirement-type",
21
+ "requirement_type"
22
+ ],
23
+ Separators: [
24
+ ".",
25
+ ",",
26
+ ";",
27
+ "-",
28
+ "_",
29
+ "__",
30
+ "/",
31
+ ":"
32
+ ],
33
+ CorrelationRequestIdHeader: "x-ms-correlation-request-id",
34
+ FeatureFlagsKeyWord: "feature_flags"
35
+ };
36
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/internal/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,eAAe;AACf,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,yBAAyB,EAAE;QACzB,mBAAmB;QACnB,mBAAmB;QACnB,oBAAoB;QACpB,oBAAoB;KACrB;IACD,kBAAkB,EAAE;QAClB,YAAY;QACZ,YAAY;QACZ,aAAa;QACb,aAAa;KACd;IACD,uBAAuB,EAAE;QACvB,iBAAiB;QACjB,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;KACnB;IACD,UAAU,EAAE;QACV,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,IAAI;QACJ,GAAG;QACH,GAAG;KACJ;IACD,0BAA0B,EAAE,6BAA6B;IACzD,mBAAmB,EAAE,eAAe;CACrC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** @internal*/\nexport const Constants = {\n FeatureManagementKeyWords: [\n \"FeatureManagement\",\n \"featureManagement\",\n \"feature-management\",\n \"feature_management\"\n ],\n EnabledForKeyWords: [\n \"EnabledFor\",\n \"enabledFor\",\n \"enabled-for\",\n \"enabled_for\"\n ],\n RequirementTypeKeyWords: [\n \"RequirementType\",\n \"requirementType\",\n \"requirement-type\",\n \"requirement_type\"\n ],\n Separators: [\n \".\",\n \",\",\n \";\",\n \"-\",\n \"_\",\n \"__\",\n \"/\",\n \":\"\n ],\n CorrelationRequestIdHeader: \"x-ms-correlation-request-id\",\n FeatureFlagsKeyWord: \"feature_flags\"\n};\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=configurationSettingsConverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configurationSettingsConverter.js","sourceRoot":"","sources":["../../../../src/internal/parsers/configurationSettingsConverter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n SetConfigurationSettingParam,\n FeatureFlagValue,\n SecretReferenceValue\n} from \"@azure/app-configuration\";\nimport { SourceOptions } from \"../../importOptions\";\n\n/**\n * ConfigurationSettings converter for different configuration content.\n *\n * @internal\n * */\nexport interface ConfigurationSettingsConverter {\n Convert(\n rawConfig: object,\n options?: SourceOptions\n ): Array<SetConfigurationSettingParam<string | FeatureFlagValue | SecretReferenceValue>>;\n}\n"]}