@azure/app-configuration 1.9.2-alpha.20251029.1 → 1.9.2-alpha.20251105.1
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/README.md +15 -9
- package/dist/browser/appConfigurationClient.d.ts +2 -3
- package/dist/browser/appConfigurationClient.d.ts.map +1 -1
- package/dist/browser/appConfigurationClient.js.map +1 -1
- package/dist/browser/featureFlag.d.ts +0 -1
- package/dist/browser/featureFlag.d.ts.map +1 -1
- package/dist/browser/featureFlag.js +0 -4
- package/dist/browser/featureFlag.js.map +1 -1
- package/dist/browser/index.d.ts +0 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +0 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/internal/helpers.d.ts +1 -2
- package/dist/browser/internal/helpers.d.ts.map +1 -1
- package/dist/browser/internal/helpers.js +0 -12
- package/dist/browser/internal/helpers.js.map +1 -1
- package/dist/browser/internal/jsonModels.d.ts +1 -8
- package/dist/browser/internal/jsonModels.d.ts.map +1 -1
- package/dist/browser/internal/jsonModels.js.map +1 -1
- package/dist/browser/internal/queryParamPolicy.d.ts.map +1 -1
- package/dist/browser/internal/queryParamPolicy.js +38 -33
- package/dist/browser/internal/queryParamPolicy.js.map +1 -1
- package/dist/browser/internal/syncTokenPolicy.js +1 -1
- package/dist/browser/internal/syncTokenPolicy.js.map +1 -1
- package/dist/browser/models.d.ts +4 -5
- package/dist/browser/models.d.ts.map +1 -1
- package/dist/browser/models.js.map +1 -1
- package/dist/browser/secretReference.d.ts +1 -1
- package/dist/browser/secretReference.js +1 -1
- package/dist/browser/secretReference.js.map +1 -1
- package/dist/commonjs/appConfigurationClient.d.ts +2 -3
- package/dist/commonjs/appConfigurationClient.d.ts.map +1 -1
- package/dist/commonjs/appConfigurationClient.js.map +1 -1
- package/dist/commonjs/featureFlag.d.ts +0 -1
- package/dist/commonjs/featureFlag.d.ts.map +1 -1
- package/dist/commonjs/featureFlag.js +0 -4
- package/dist/commonjs/featureFlag.js.map +1 -1
- package/dist/commonjs/index.d.ts +0 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -5
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/internal/helpers.d.ts +1 -2
- package/dist/commonjs/internal/helpers.d.ts.map +1 -1
- package/dist/commonjs/internal/helpers.js +0 -12
- package/dist/commonjs/internal/helpers.js.map +1 -1
- package/dist/commonjs/internal/jsonModels.d.ts +1 -8
- package/dist/commonjs/internal/jsonModels.d.ts.map +1 -1
- package/dist/commonjs/internal/jsonModels.js.map +1 -1
- package/dist/commonjs/internal/queryParamPolicy.d.ts.map +1 -1
- package/dist/commonjs/internal/queryParamPolicy.js +38 -33
- package/dist/commonjs/internal/queryParamPolicy.js.map +1 -1
- package/dist/commonjs/internal/syncTokenPolicy.js +1 -1
- package/dist/commonjs/internal/syncTokenPolicy.js.map +1 -1
- package/dist/commonjs/models.d.ts +4 -5
- package/dist/commonjs/models.d.ts.map +1 -1
- package/dist/commonjs/models.js.map +1 -1
- package/dist/commonjs/secretReference.d.ts +1 -1
- package/dist/commonjs/secretReference.js +1 -1
- package/dist/commonjs/secretReference.js.map +1 -1
- package/dist/esm/appConfigurationClient.d.ts +2 -3
- package/dist/esm/appConfigurationClient.d.ts.map +1 -1
- package/dist/esm/appConfigurationClient.js.map +1 -1
- package/dist/esm/featureFlag.d.ts +0 -1
- package/dist/esm/featureFlag.d.ts.map +1 -1
- package/dist/esm/featureFlag.js +0 -4
- package/dist/esm/featureFlag.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/helpers.d.ts +1 -2
- package/dist/esm/internal/helpers.d.ts.map +1 -1
- package/dist/esm/internal/helpers.js +0 -12
- package/dist/esm/internal/helpers.js.map +1 -1
- package/dist/esm/internal/jsonModels.d.ts +1 -8
- package/dist/esm/internal/jsonModels.d.ts.map +1 -1
- package/dist/esm/internal/jsonModels.js.map +1 -1
- package/dist/esm/internal/queryParamPolicy.d.ts.map +1 -1
- package/dist/esm/internal/queryParamPolicy.js +38 -33
- package/dist/esm/internal/queryParamPolicy.js.map +1 -1
- package/dist/esm/internal/syncTokenPolicy.js +1 -1
- package/dist/esm/internal/syncTokenPolicy.js.map +1 -1
- package/dist/esm/models.d.ts +4 -5
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/secretReference.d.ts +1 -1
- package/dist/esm/secretReference.js +1 -1
- package/dist/esm/secretReference.js.map +1 -1
- package/dist/react-native/appConfigurationClient.d.ts +2 -3
- package/dist/react-native/appConfigurationClient.d.ts.map +1 -1
- package/dist/react-native/appConfigurationClient.js.map +1 -1
- package/dist/react-native/featureFlag.d.ts +0 -1
- package/dist/react-native/featureFlag.d.ts.map +1 -1
- package/dist/react-native/featureFlag.js +0 -4
- package/dist/react-native/featureFlag.js.map +1 -1
- package/dist/react-native/index.d.ts +0 -1
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +0 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/internal/helpers.d.ts +1 -2
- package/dist/react-native/internal/helpers.d.ts.map +1 -1
- package/dist/react-native/internal/helpers.js +0 -12
- package/dist/react-native/internal/helpers.js.map +1 -1
- package/dist/react-native/internal/jsonModels.d.ts +1 -8
- package/dist/react-native/internal/jsonModels.d.ts.map +1 -1
- package/dist/react-native/internal/jsonModels.js.map +1 -1
- package/dist/react-native/internal/queryParamPolicy.d.ts.map +1 -1
- package/dist/react-native/internal/queryParamPolicy.js +38 -33
- package/dist/react-native/internal/queryParamPolicy.js.map +1 -1
- package/dist/react-native/internal/syncTokenPolicy.js +1 -1
- package/dist/react-native/internal/syncTokenPolicy.js.map +1 -1
- package/dist/react-native/models.d.ts +4 -5
- package/dist/react-native/models.d.ts.map +1 -1
- package/dist/react-native/models.js.map +1 -1
- package/dist/react-native/secretReference.d.ts +1 -1
- package/dist/react-native/secretReference.js +1 -1
- package/dist/react-native/secretReference.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/snapshotReference.d.ts +0 -34
- package/dist/browser/snapshotReference.d.ts.map +0 -1
- package/dist/browser/snapshotReference.js +0 -57
- package/dist/browser/snapshotReference.js.map +0 -1
- package/dist/commonjs/snapshotReference.d.ts +0 -34
- package/dist/commonjs/snapshotReference.d.ts.map +0 -1
- package/dist/commonjs/snapshotReference.js +0 -62
- package/dist/commonjs/snapshotReference.js.map +0 -1
- package/dist/esm/snapshotReference.d.ts +0 -34
- package/dist/esm/snapshotReference.d.ts.map +0 -1
- package/dist/esm/snapshotReference.js +0 -57
- package/dist/esm/snapshotReference.js.map +0 -1
- package/dist/react-native/snapshotReference.d.ts +0 -34
- package/dist/react-native/snapshotReference.d.ts.map +0 -1
- package/dist/react-native/snapshotReference.js +0 -57
- package/dist/react-native/snapshotReference.js.map +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ConfigurationSetting, ConfigurationSettingParam } from "./models.js";
|
|
2
|
-
/**
|
|
3
|
-
* content-type for the snapshot reference.
|
|
4
|
-
*/
|
|
5
|
-
export declare const snapshotReferenceContentType = "application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8";
|
|
6
|
-
/**
|
|
7
|
-
* Necessary fields for updating or creating a new snapshot reference.
|
|
8
|
-
*/
|
|
9
|
-
export interface SnapshotReferenceValue {
|
|
10
|
-
/**
|
|
11
|
-
* snapshot name.
|
|
12
|
-
*/
|
|
13
|
-
snapshotName: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export declare const SnapshotReferenceHelper: {
|
|
19
|
-
/**
|
|
20
|
-
* Takes the SnapshotReference (JSON) and returns a ConfigurationSetting (with the props encoded in the value).
|
|
21
|
-
*/
|
|
22
|
-
toConfigurationSettingParam: (snapshotReference: ConfigurationSettingParam<SnapshotReferenceValue>) => ConfigurationSettingParam;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Takes the ConfigurationSetting as input and returns the ConfigurationSetting<SnapshotReferenceValue> by parsing the value string.
|
|
26
|
-
*/
|
|
27
|
-
export declare function parseSnapshotReference(setting: ConfigurationSetting): ConfigurationSetting<SnapshotReferenceValue>;
|
|
28
|
-
/**
|
|
29
|
-
* Lets you know if the ConfigurationSetting is a snapshot reference.
|
|
30
|
-
*
|
|
31
|
-
* [Checks if the content type is snapshotReferenceContentType `"application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8"`]
|
|
32
|
-
*/
|
|
33
|
-
export declare function isSnapshotReference(setting: ConfigurationSetting): setting is ConfigurationSetting & Required<Pick<ConfigurationSetting, "value">>;
|
|
34
|
-
//# sourceMappingURL=snapshotReference.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotReference.d.ts","sourceRoot":"","sources":["../../src/snapshotReference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAInF;;GAEG;AACH,eAAO,MAAM,4BAA4B,gGACoD,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB;IAClC;;OAEG;qDAEkB,yBAAyB,CAAC,sBAAsB,CAAC,KACnE,yBAAyB;CAiB7B,CAAC;AAEF;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,oBAAoB,GAC5B,oBAAoB,CAAC,sBAAsB,CAAC,CAmB9C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,IAAI,oBAAoB,GAAG,QAAQ,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAMjF"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { logger } from "./logger.js";
|
|
4
|
-
/**
|
|
5
|
-
* content-type for the snapshot reference.
|
|
6
|
-
*/
|
|
7
|
-
export const snapshotReferenceContentType = 'application/json; profile="https://azconfig.io/mime-profiles/snapshot-ref"; charset=utf-8';
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export const SnapshotReferenceHelper = {
|
|
12
|
-
/**
|
|
13
|
-
* Takes the SnapshotReference (JSON) and returns a ConfigurationSetting (with the props encoded in the value).
|
|
14
|
-
*/
|
|
15
|
-
toConfigurationSettingParam: (snapshotReference) => {
|
|
16
|
-
logger.info("Encoding SnapshotReference value in a ConfigurationSetting:", snapshotReference);
|
|
17
|
-
if (!snapshotReference.value) {
|
|
18
|
-
logger.error(`SnapshotReference has an unexpected value`, snapshotReference);
|
|
19
|
-
throw new TypeError(`SnapshotReference has an unexpected value - ${snapshotReference.value}`);
|
|
20
|
-
}
|
|
21
|
-
const jsonSnapshotReferenceValue = {
|
|
22
|
-
snapshot_name: snapshotReference.value.snapshotName,
|
|
23
|
-
};
|
|
24
|
-
const configSetting = {
|
|
25
|
-
...snapshotReference,
|
|
26
|
-
value: JSON.stringify(jsonSnapshotReferenceValue),
|
|
27
|
-
};
|
|
28
|
-
return configSetting;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Takes the ConfigurationSetting as input and returns the ConfigurationSetting<SnapshotReferenceValue> by parsing the value string.
|
|
33
|
-
*/
|
|
34
|
-
export function parseSnapshotReference(setting) {
|
|
35
|
-
logger.info("[parseSnapshotReference] Parsing the value to return the SnapshotReferenceValue", setting);
|
|
36
|
-
if (!isSnapshotReference(setting)) {
|
|
37
|
-
logger.error("Invalid SnapshotReference input", setting);
|
|
38
|
-
throw TypeError(`Setting with key ${setting.key} is not a valid SnapshotReference, make sure to have the correct content-type and a valid non-null value.`);
|
|
39
|
-
}
|
|
40
|
-
const jsonSnapshotReferenceValue = JSON.parse(setting.value);
|
|
41
|
-
const snapshotReference = {
|
|
42
|
-
...setting,
|
|
43
|
-
value: { snapshotName: jsonSnapshotReferenceValue.snapshot_name },
|
|
44
|
-
};
|
|
45
|
-
return snapshotReference;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Lets you know if the ConfigurationSetting is a snapshot reference.
|
|
49
|
-
*
|
|
50
|
-
* [Checks if the content type is snapshotReferenceContentType `"application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8"`]
|
|
51
|
-
*/
|
|
52
|
-
export function isSnapshotReference(setting) {
|
|
53
|
-
return (setting &&
|
|
54
|
-
setting.contentType === snapshotReferenceContentType &&
|
|
55
|
-
typeof setting.value === "string");
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=snapshotReference.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotReference.js","sourceRoot":"","sources":["../../src/snapshotReference.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,2FAA2F,CAAC;AAY9F;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC;;OAEG;IACH,2BAA2B,EAAE,CAC3B,iBAAoE,EACzC,EAAE;QAC7B,MAAM,CAAC,IAAI,CAAC,6DAA6D,EAAE,iBAAiB,CAAC,CAAC;QAC9F,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,2CAA2C,EAAE,iBAAiB,CAAC,CAAC;YAC7E,MAAM,IAAI,SAAS,CAAC,+CAA+C,iBAAiB,CAAC,KAAK,EAAE,CAAC,CAAC;QAChG,CAAC;QAED,MAAM,0BAA0B,GAA+B;YAC7D,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,YAAY;SACpD,CAAC;QAEF,MAAM,aAAa,GAAG;YACpB,GAAG,iBAAiB;YACpB,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,0BAA0B,CAAC;SAClD,CAAC;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAA6B;IAE7B,MAAM,CAAC,IAAI,CACT,iFAAiF,EACjF,OAAO,CACR,CAAC;IACF,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,SAAS,CACb,oBAAoB,OAAO,CAAC,GAAG,2GAA2G,CAC3I,CAAC;IACJ,CAAC;IAED,MAAM,0BAA0B,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAA+B,CAAC;IAE3F,MAAM,iBAAiB,GAAiD;QACtE,GAAG,OAAO;QACV,KAAK,EAAE,EAAE,YAAY,EAAE,0BAA0B,CAAC,aAAa,EAAE;KAClE,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA6B;IAE7B,OAAO,CACL,OAAO;QACP,OAAO,CAAC,WAAW,KAAK,4BAA4B;QACpD,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAClC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ConfigurationSetting, ConfigurationSettingParam } from \"./models.js\";\nimport type { JsonSnapshotReferenceValue } from \"./internal/jsonModels.js\";\nimport { logger } from \"./logger.js\";\n\n/**\n * content-type for the snapshot reference.\n */\nexport const snapshotReferenceContentType =\n 'application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8';\n\n/**\n * Necessary fields for updating or creating a new snapshot reference.\n */\nexport interface SnapshotReferenceValue {\n /**\n * snapshot name.\n */\n snapshotName: string;\n}\n\n/**\n * @internal\n */\nexport const SnapshotReferenceHelper = {\n /**\n * Takes the SnapshotReference (JSON) and returns a ConfigurationSetting (with the props encoded in the value).\n */\n toConfigurationSettingParam: (\n snapshotReference: ConfigurationSettingParam<SnapshotReferenceValue>,\n ): ConfigurationSettingParam => {\n logger.info(\"Encoding SnapshotReference value in a ConfigurationSetting:\", snapshotReference);\n if (!snapshotReference.value) {\n logger.error(`SnapshotReference has an unexpected value`, snapshotReference);\n throw new TypeError(`SnapshotReference has an unexpected value - ${snapshotReference.value}`);\n }\n\n const jsonSnapshotReferenceValue: JsonSnapshotReferenceValue = {\n snapshot_name: snapshotReference.value.snapshotName,\n };\n\n const configSetting = {\n ...snapshotReference,\n value: JSON.stringify(jsonSnapshotReferenceValue),\n };\n return configSetting;\n },\n};\n\n/**\n * Takes the ConfigurationSetting as input and returns the ConfigurationSetting<SnapshotReferenceValue> by parsing the value string.\n */\nexport function parseSnapshotReference(\n setting: ConfigurationSetting,\n): ConfigurationSetting<SnapshotReferenceValue> {\n logger.info(\n \"[parseSnapshotReference] Parsing the value to return the SnapshotReferenceValue\",\n setting,\n );\n if (!isSnapshotReference(setting)) {\n logger.error(\"Invalid SnapshotReference input\", setting);\n throw TypeError(\n `Setting with key ${setting.key} is not a valid SnapshotReference, make sure to have the correct content-type and a valid non-null value.`,\n );\n }\n\n const jsonSnapshotReferenceValue = JSON.parse(setting.value) as JsonSnapshotReferenceValue;\n\n const snapshotReference: ConfigurationSetting<SnapshotReferenceValue> = {\n ...setting,\n value: { snapshotName: jsonSnapshotReferenceValue.snapshot_name },\n };\n return snapshotReference;\n}\n\n/**\n * Lets you know if the ConfigurationSetting is a snapshot reference.\n *\n * [Checks if the content type is snapshotReferenceContentType `\"application/json; profile=\\\"https://azconfig.io/mime-profiles/snapshot-ref\\\"; charset=utf-8\"`]\n */\nexport function isSnapshotReference(\n setting: ConfigurationSetting,\n): setting is ConfigurationSetting & Required<Pick<ConfigurationSetting, \"value\">> {\n return (\n setting &&\n setting.contentType === snapshotReferenceContentType &&\n typeof setting.value === \"string\"\n );\n}\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ConfigurationSetting, ConfigurationSettingParam } from "./models.js";
|
|
2
|
-
/**
|
|
3
|
-
* content-type for the snapshot reference.
|
|
4
|
-
*/
|
|
5
|
-
export declare const snapshotReferenceContentType = "application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8";
|
|
6
|
-
/**
|
|
7
|
-
* Necessary fields for updating or creating a new snapshot reference.
|
|
8
|
-
*/
|
|
9
|
-
export interface SnapshotReferenceValue {
|
|
10
|
-
/**
|
|
11
|
-
* snapshot name.
|
|
12
|
-
*/
|
|
13
|
-
snapshotName: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export declare const SnapshotReferenceHelper: {
|
|
19
|
-
/**
|
|
20
|
-
* Takes the SnapshotReference (JSON) and returns a ConfigurationSetting (with the props encoded in the value).
|
|
21
|
-
*/
|
|
22
|
-
toConfigurationSettingParam: (snapshotReference: ConfigurationSettingParam<SnapshotReferenceValue>) => ConfigurationSettingParam;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Takes the ConfigurationSetting as input and returns the ConfigurationSetting<SnapshotReferenceValue> by parsing the value string.
|
|
26
|
-
*/
|
|
27
|
-
export declare function parseSnapshotReference(setting: ConfigurationSetting): ConfigurationSetting<SnapshotReferenceValue>;
|
|
28
|
-
/**
|
|
29
|
-
* Lets you know if the ConfigurationSetting is a snapshot reference.
|
|
30
|
-
*
|
|
31
|
-
* [Checks if the content type is snapshotReferenceContentType `"application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8"`]
|
|
32
|
-
*/
|
|
33
|
-
export declare function isSnapshotReference(setting: ConfigurationSetting): setting is ConfigurationSetting & Required<Pick<ConfigurationSetting, "value">>;
|
|
34
|
-
//# sourceMappingURL=snapshotReference.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotReference.d.ts","sourceRoot":"","sources":["../../src/snapshotReference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAInF;;GAEG;AACH,eAAO,MAAM,4BAA4B,gGACoD,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB;IAClC;;OAEG;qDAEkB,yBAAyB,CAAC,sBAAsB,CAAC,KACnE,yBAAyB;CAiB7B,CAAC;AAEF;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,oBAAoB,GAC5B,oBAAoB,CAAC,sBAAsB,CAAC,CAmB9C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,IAAI,oBAAoB,GAAG,QAAQ,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAMjF"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { logger } from "./logger.js";
|
|
4
|
-
/**
|
|
5
|
-
* content-type for the snapshot reference.
|
|
6
|
-
*/
|
|
7
|
-
export const snapshotReferenceContentType = 'application/json; profile="https://azconfig.io/mime-profiles/snapshot-ref"; charset=utf-8';
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export const SnapshotReferenceHelper = {
|
|
12
|
-
/**
|
|
13
|
-
* Takes the SnapshotReference (JSON) and returns a ConfigurationSetting (with the props encoded in the value).
|
|
14
|
-
*/
|
|
15
|
-
toConfigurationSettingParam: (snapshotReference) => {
|
|
16
|
-
logger.info("Encoding SnapshotReference value in a ConfigurationSetting:", snapshotReference);
|
|
17
|
-
if (!snapshotReference.value) {
|
|
18
|
-
logger.error(`SnapshotReference has an unexpected value`, snapshotReference);
|
|
19
|
-
throw new TypeError(`SnapshotReference has an unexpected value - ${snapshotReference.value}`);
|
|
20
|
-
}
|
|
21
|
-
const jsonSnapshotReferenceValue = {
|
|
22
|
-
snapshot_name: snapshotReference.value.snapshotName,
|
|
23
|
-
};
|
|
24
|
-
const configSetting = {
|
|
25
|
-
...snapshotReference,
|
|
26
|
-
value: JSON.stringify(jsonSnapshotReferenceValue),
|
|
27
|
-
};
|
|
28
|
-
return configSetting;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Takes the ConfigurationSetting as input and returns the ConfigurationSetting<SnapshotReferenceValue> by parsing the value string.
|
|
33
|
-
*/
|
|
34
|
-
export function parseSnapshotReference(setting) {
|
|
35
|
-
logger.info("[parseSnapshotReference] Parsing the value to return the SnapshotReferenceValue", setting);
|
|
36
|
-
if (!isSnapshotReference(setting)) {
|
|
37
|
-
logger.error("Invalid SnapshotReference input", setting);
|
|
38
|
-
throw TypeError(`Setting with key ${setting.key} is not a valid SnapshotReference, make sure to have the correct content-type and a valid non-null value.`);
|
|
39
|
-
}
|
|
40
|
-
const jsonSnapshotReferenceValue = JSON.parse(setting.value);
|
|
41
|
-
const snapshotReference = {
|
|
42
|
-
...setting,
|
|
43
|
-
value: { snapshotName: jsonSnapshotReferenceValue.snapshot_name },
|
|
44
|
-
};
|
|
45
|
-
return snapshotReference;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Lets you know if the ConfigurationSetting is a snapshot reference.
|
|
49
|
-
*
|
|
50
|
-
* [Checks if the content type is snapshotReferenceContentType `"application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8"`]
|
|
51
|
-
*/
|
|
52
|
-
export function isSnapshotReference(setting) {
|
|
53
|
-
return (setting &&
|
|
54
|
-
setting.contentType === snapshotReferenceContentType &&
|
|
55
|
-
typeof setting.value === "string");
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=snapshotReference.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotReference.js","sourceRoot":"","sources":["../../src/snapshotReference.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,2FAA2F,CAAC;AAY9F;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC;;OAEG;IACH,2BAA2B,EAAE,CAC3B,iBAAoE,EACzC,EAAE;QAC7B,MAAM,CAAC,IAAI,CAAC,6DAA6D,EAAE,iBAAiB,CAAC,CAAC;QAC9F,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,2CAA2C,EAAE,iBAAiB,CAAC,CAAC;YAC7E,MAAM,IAAI,SAAS,CAAC,+CAA+C,iBAAiB,CAAC,KAAK,EAAE,CAAC,CAAC;QAChG,CAAC;QAED,MAAM,0BAA0B,GAA+B;YAC7D,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,YAAY;SACpD,CAAC;QAEF,MAAM,aAAa,GAAG;YACpB,GAAG,iBAAiB;YACpB,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,0BAA0B,CAAC;SAClD,CAAC;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAA6B;IAE7B,MAAM,CAAC,IAAI,CACT,iFAAiF,EACjF,OAAO,CACR,CAAC;IACF,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,SAAS,CACb,oBAAoB,OAAO,CAAC,GAAG,2GAA2G,CAC3I,CAAC;IACJ,CAAC;IAED,MAAM,0BAA0B,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAA+B,CAAC;IAE3F,MAAM,iBAAiB,GAAiD;QACtE,GAAG,OAAO;QACV,KAAK,EAAE,EAAE,YAAY,EAAE,0BAA0B,CAAC,aAAa,EAAE;KAClE,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA6B;IAE7B,OAAO,CACL,OAAO;QACP,OAAO,CAAC,WAAW,KAAK,4BAA4B;QACpD,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAClC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ConfigurationSetting, ConfigurationSettingParam } from \"./models.js\";\nimport type { JsonSnapshotReferenceValue } from \"./internal/jsonModels.js\";\nimport { logger } from \"./logger.js\";\n\n/**\n * content-type for the snapshot reference.\n */\nexport const snapshotReferenceContentType =\n 'application/json; profile=\"https://azconfig.io/mime-profiles/snapshot-ref\"; charset=utf-8';\n\n/**\n * Necessary fields for updating or creating a new snapshot reference.\n */\nexport interface SnapshotReferenceValue {\n /**\n * snapshot name.\n */\n snapshotName: string;\n}\n\n/**\n * @internal\n */\nexport const SnapshotReferenceHelper = {\n /**\n * Takes the SnapshotReference (JSON) and returns a ConfigurationSetting (with the props encoded in the value).\n */\n toConfigurationSettingParam: (\n snapshotReference: ConfigurationSettingParam<SnapshotReferenceValue>,\n ): ConfigurationSettingParam => {\n logger.info(\"Encoding SnapshotReference value in a ConfigurationSetting:\", snapshotReference);\n if (!snapshotReference.value) {\n logger.error(`SnapshotReference has an unexpected value`, snapshotReference);\n throw new TypeError(`SnapshotReference has an unexpected value - ${snapshotReference.value}`);\n }\n\n const jsonSnapshotReferenceValue: JsonSnapshotReferenceValue = {\n snapshot_name: snapshotReference.value.snapshotName,\n };\n\n const configSetting = {\n ...snapshotReference,\n value: JSON.stringify(jsonSnapshotReferenceValue),\n };\n return configSetting;\n },\n};\n\n/**\n * Takes the ConfigurationSetting as input and returns the ConfigurationSetting<SnapshotReferenceValue> by parsing the value string.\n */\nexport function parseSnapshotReference(\n setting: ConfigurationSetting,\n): ConfigurationSetting<SnapshotReferenceValue> {\n logger.info(\n \"[parseSnapshotReference] Parsing the value to return the SnapshotReferenceValue\",\n setting,\n );\n if (!isSnapshotReference(setting)) {\n logger.error(\"Invalid SnapshotReference input\", setting);\n throw TypeError(\n `Setting with key ${setting.key} is not a valid SnapshotReference, make sure to have the correct content-type and a valid non-null value.`,\n );\n }\n\n const jsonSnapshotReferenceValue = JSON.parse(setting.value) as JsonSnapshotReferenceValue;\n\n const snapshotReference: ConfigurationSetting<SnapshotReferenceValue> = {\n ...setting,\n value: { snapshotName: jsonSnapshotReferenceValue.snapshot_name },\n };\n return snapshotReference;\n}\n\n/**\n * Lets you know if the ConfigurationSetting is a snapshot reference.\n *\n * [Checks if the content type is snapshotReferenceContentType `\"application/json; profile=\\\"https://azconfig.io/mime-profiles/snapshot-ref\\\"; charset=utf-8\"`]\n */\nexport function isSnapshotReference(\n setting: ConfigurationSetting,\n): setting is ConfigurationSetting & Required<Pick<ConfigurationSetting, \"value\">> {\n return (\n setting &&\n setting.contentType === snapshotReferenceContentType &&\n typeof setting.value === \"string\"\n );\n}\n"]}
|