@azure/keyvault-keys 4.10.1-alpha.20250717.1 → 4.10.1-alpha.20250722.2
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/browser/cryptography/remoteCryptographyProvider.js +34 -11
- package/dist/browser/cryptography/remoteCryptographyProvider.js.map +1 -1
- package/dist/browser/cryptographyClient.js +12 -5
- package/dist/browser/cryptographyClient.js.map +1 -1
- package/dist/browser/generated/src/api/keyVaultContext.js +12 -9
- package/dist/browser/generated/src/api/keyVaultContext.js.map +1 -1
- package/dist/browser/generated/src/api/operations.js +229 -78
- package/dist/browser/generated/src/api/operations.js.map +1 -1
- package/dist/browser/generated/src/keyVaultClient.js +8 -3
- package/dist/browser/generated/src/keyVaultClient.js.map +1 -1
- package/dist/browser/generated/src/static-helpers/pagingHelpers.js +31 -50
- package/dist/browser/generated/src/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/browser/generated/src/static-helpers/urlTemplate.js +2 -2
- package/dist/browser/generated/src/static-helpers/urlTemplate.js.map +1 -1
- package/dist/browser/identifier.js +4 -1
- package/dist/browser/identifier.js.map +1 -1
- package/dist/browser/index.js +43 -29
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/lro/delete/operation.js +3 -0
- package/dist/browser/lro/delete/operation.js.map +1 -1
- package/dist/browser/lro/delete/poller.js +4 -1
- package/dist/browser/lro/delete/poller.js.map +1 -1
- package/dist/browser/lro/keyVaultKeyPoller.js +6 -8
- package/dist/browser/lro/keyVaultKeyPoller.js.map +1 -1
- package/dist/browser/lro/recover/operation.js +5 -2
- package/dist/browser/lro/recover/operation.js.map +1 -1
- package/dist/browser/lro/recover/poller.js +4 -1
- package/dist/browser/lro/recover/poller.js.map +1 -1
- package/dist/browser/transformations.js +30 -41
- package/dist/browser/transformations.js.map +1 -1
- package/dist/commonjs/cryptography/aesCryptographyProvider.js +25 -25
- package/dist/commonjs/cryptography/aesCryptographyProvider.js.map +1 -1
- package/dist/commonjs/cryptography/remoteCryptographyProvider.js +34 -11
- package/dist/commonjs/cryptography/remoteCryptographyProvider.js.map +1 -1
- package/dist/commonjs/cryptography/rsaCryptographyProvider.js +39 -36
- package/dist/commonjs/cryptography/rsaCryptographyProvider.js.map +1 -1
- package/dist/commonjs/cryptographyClient.js +12 -5
- package/dist/commonjs/cryptographyClient.js.map +1 -1
- package/dist/commonjs/generated/src/api/keyVaultContext.js +12 -9
- package/dist/commonjs/generated/src/api/keyVaultContext.js.map +1 -1
- package/dist/commonjs/generated/src/api/operations.js +229 -78
- package/dist/commonjs/generated/src/api/operations.js.map +1 -1
- package/dist/commonjs/generated/src/keyVaultClient.js +8 -3
- package/dist/commonjs/generated/src/keyVaultClient.js.map +1 -1
- package/dist/commonjs/generated/src/static-helpers/pagingHelpers.js +31 -50
- package/dist/commonjs/generated/src/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/commonjs/generated/src/static-helpers/urlTemplate.js +2 -2
- package/dist/commonjs/generated/src/static-helpers/urlTemplate.js.map +1 -1
- package/dist/commonjs/identifier.js +4 -1
- package/dist/commonjs/identifier.js.map +1 -1
- package/dist/commonjs/index.js +43 -29
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lro/delete/operation.js +3 -0
- package/dist/commonjs/lro/delete/operation.js.map +1 -1
- package/dist/commonjs/lro/delete/poller.js +4 -1
- package/dist/commonjs/lro/delete/poller.js.map +1 -1
- package/dist/commonjs/lro/keyVaultKeyPoller.js +6 -8
- package/dist/commonjs/lro/keyVaultKeyPoller.js.map +1 -1
- package/dist/commonjs/lro/recover/operation.js +5 -2
- package/dist/commonjs/lro/recover/operation.js.map +1 -1
- package/dist/commonjs/lro/recover/poller.js +4 -1
- package/dist/commonjs/lro/recover/poller.js.map +1 -1
- package/dist/commonjs/transformations.js +30 -41
- package/dist/commonjs/transformations.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/cryptography/aesCryptographyProvider.js +25 -25
- package/dist/esm/cryptography/aesCryptographyProvider.js.map +1 -1
- package/dist/esm/cryptography/remoteCryptographyProvider.js +34 -11
- package/dist/esm/cryptography/remoteCryptographyProvider.js.map +1 -1
- package/dist/esm/cryptography/rsaCryptographyProvider.js +39 -36
- package/dist/esm/cryptography/rsaCryptographyProvider.js.map +1 -1
- package/dist/esm/cryptographyClient.js +12 -5
- package/dist/esm/cryptographyClient.js.map +1 -1
- package/dist/esm/generated/src/api/keyVaultContext.js +12 -9
- package/dist/esm/generated/src/api/keyVaultContext.js.map +1 -1
- package/dist/esm/generated/src/api/operations.js +229 -78
- package/dist/esm/generated/src/api/operations.js.map +1 -1
- package/dist/esm/generated/src/keyVaultClient.js +8 -3
- package/dist/esm/generated/src/keyVaultClient.js.map +1 -1
- package/dist/esm/generated/src/static-helpers/pagingHelpers.js +31 -50
- package/dist/esm/generated/src/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/esm/generated/src/static-helpers/urlTemplate.js +2 -2
- package/dist/esm/generated/src/static-helpers/urlTemplate.js.map +1 -1
- package/dist/esm/identifier.js +4 -1
- package/dist/esm/identifier.js.map +1 -1
- package/dist/esm/index.js +43 -29
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lro/delete/operation.js +3 -0
- package/dist/esm/lro/delete/operation.js.map +1 -1
- package/dist/esm/lro/delete/poller.js +4 -1
- package/dist/esm/lro/delete/poller.js.map +1 -1
- package/dist/esm/lro/keyVaultKeyPoller.js +6 -8
- package/dist/esm/lro/keyVaultKeyPoller.js.map +1 -1
- package/dist/esm/lro/recover/operation.js +5 -2
- package/dist/esm/lro/recover/operation.js.map +1 -1
- package/dist/esm/lro/recover/poller.js +4 -1
- package/dist/esm/lro/recover/poller.js.map +1 -1
- package/dist/esm/transformations.js +30 -41
- package/dist/esm/transformations.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
3
|
import { parseKeyVaultKeyIdentifier } from "./identifier.js";
|
|
5
4
|
/**
|
|
6
5
|
* @internal
|
|
@@ -58,7 +57,12 @@ export function getDeletedKeyFromDeletedKeyItem(keyItem) {
|
|
|
58
57
|
},
|
|
59
58
|
id: keyItem.kid,
|
|
60
59
|
name: commonProperties.name,
|
|
61
|
-
properties:
|
|
60
|
+
properties: {
|
|
61
|
+
...commonProperties,
|
|
62
|
+
recoveryId: keyItem.recoveryId,
|
|
63
|
+
scheduledPurgeDate: keyItem.scheduledPurgeDate,
|
|
64
|
+
deletedOn: keyItem.deletedDate,
|
|
65
|
+
},
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
68
|
/**
|
|
@@ -70,15 +74,15 @@ export function getKeyPropertiesFromKeyItem(keyItem) {
|
|
|
70
74
|
const attributes = keyItem.attributes || {};
|
|
71
75
|
const resultObject = {
|
|
72
76
|
createdOn: attributes.created,
|
|
73
|
-
enabled: attributes
|
|
74
|
-
expiresOn: attributes
|
|
77
|
+
enabled: attributes?.enabled,
|
|
78
|
+
expiresOn: attributes?.expires,
|
|
75
79
|
id: keyItem.kid,
|
|
76
80
|
managed: keyItem.managed,
|
|
77
81
|
name: parsedId.name,
|
|
78
|
-
notBefore: attributes
|
|
79
|
-
recoverableDays: attributes
|
|
80
|
-
recoveryLevel: attributes
|
|
81
|
-
hsmPlatform: attributes
|
|
82
|
+
notBefore: attributes?.notBefore,
|
|
83
|
+
recoverableDays: attributes?.recoverableDays,
|
|
84
|
+
recoveryLevel: attributes?.recoveryLevel,
|
|
85
|
+
hsmPlatform: attributes?.hsmPlatform,
|
|
82
86
|
tags: keyItem.tags,
|
|
83
87
|
updatedOn: attributes.updated,
|
|
84
88
|
vaultUrl: parsedId.vaultUrl,
|
|
@@ -102,12 +106,11 @@ function getNormalizedActionType(caseInsensitiveActionType) {
|
|
|
102
106
|
*/
|
|
103
107
|
export const keyRotationTransformations = {
|
|
104
108
|
propertiesToGenerated: function (parameters) {
|
|
105
|
-
var _a;
|
|
106
109
|
const policy = {
|
|
107
110
|
attributes: {
|
|
108
111
|
expiryTime: parameters.expiresIn,
|
|
109
112
|
},
|
|
110
|
-
lifetimeActions:
|
|
113
|
+
lifetimeActions: parameters.lifetimeActions?.map((action) => {
|
|
111
114
|
const generatedAction = {
|
|
112
115
|
action: { type: action.action },
|
|
113
116
|
trigger: {},
|
|
@@ -124,18 +127,16 @@ export const keyRotationTransformations = {
|
|
|
124
127
|
return policy;
|
|
125
128
|
},
|
|
126
129
|
generatedToPublic(generated) {
|
|
127
|
-
var _a, _b, _c, _d;
|
|
128
130
|
const policy = {
|
|
129
131
|
id: generated.id,
|
|
130
|
-
createdOn:
|
|
131
|
-
updatedOn:
|
|
132
|
-
expiresIn:
|
|
133
|
-
lifetimeActions:
|
|
134
|
-
var _a, _b;
|
|
132
|
+
createdOn: generated.attributes?.created,
|
|
133
|
+
updatedOn: generated.attributes?.updated,
|
|
134
|
+
expiresIn: generated.attributes?.expiryTime,
|
|
135
|
+
lifetimeActions: generated.lifetimeActions?.map((action) => {
|
|
135
136
|
return {
|
|
136
137
|
action: getNormalizedActionType(action.action.type),
|
|
137
|
-
timeAfterCreate:
|
|
138
|
-
timeBeforeExpiry:
|
|
138
|
+
timeAfterCreate: action.trigger?.timeAfterCreate,
|
|
139
|
+
timeBeforeExpiry: action.trigger?.timeBeforeExpiry,
|
|
139
140
|
};
|
|
140
141
|
}),
|
|
141
142
|
};
|
|
@@ -155,34 +156,22 @@ export function mapPagedAsyncIterable(options, operation, mapper) {
|
|
|
155
156
|
let iter = undefined;
|
|
156
157
|
return {
|
|
157
158
|
async next() {
|
|
158
|
-
iter
|
|
159
|
+
iter ??= operation({ ...options, maxresults: undefined });
|
|
159
160
|
const result = await iter.next();
|
|
160
|
-
return
|
|
161
|
+
return {
|
|
162
|
+
...result,
|
|
163
|
+
value: result.value && mapper(result.value),
|
|
164
|
+
};
|
|
161
165
|
},
|
|
162
166
|
[Symbol.asyncIterator]() {
|
|
163
167
|
return this;
|
|
164
168
|
},
|
|
165
|
-
byPage(settings) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
for (var _d = true, iteratorByPage_1 = __asyncValues(iteratorByPage), iteratorByPage_1_1; iteratorByPage_1_1 = yield __await(iteratorByPage_1.next()), _a = iteratorByPage_1_1.done, !_a; _d = true) {
|
|
172
|
-
_c = iteratorByPage_1_1.value;
|
|
173
|
-
_d = false;
|
|
174
|
-
const page = _c;
|
|
175
|
-
yield yield __await(page.map(mapper));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
179
|
-
finally {
|
|
180
|
-
try {
|
|
181
|
-
if (!_d && !_a && (_b = iteratorByPage_1.return)) yield __await(_b.call(iteratorByPage_1));
|
|
182
|
-
}
|
|
183
|
-
finally { if (e_1) throw e_1.error; }
|
|
184
|
-
}
|
|
185
|
-
});
|
|
169
|
+
async *byPage(settings) {
|
|
170
|
+
// Pass the maxPageSize value to the underlying page operation
|
|
171
|
+
const iteratorByPage = operation({ ...options, maxresults: settings?.maxPageSize }).byPage(settings);
|
|
172
|
+
for await (const page of iteratorByPage) {
|
|
173
|
+
yield page.map(mapper);
|
|
174
|
+
}
|
|
186
175
|
},
|
|
187
176
|
};
|
|
188
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformations.js","sourceRoot":"","sources":["../../src/transformations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAWlC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAY7D;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAoC;IAEpC,MAAM,SAAS,GAAG,MAAmB,CAAC;IACtC,MAAM,gBAAgB,GAAG,MAA0B,CAAC;IAEpD,MAAM,QAAQ,GAAG,0BAA0B,CAAC,SA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AAI,GAAK,SAAS,iCAAM,OAAO,KAAE,UAAU,EAAE,SAAS,IAAG,EAAC;YAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAEjC,uCACK,MAAM,KACT,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAC3C;QACJ,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACM,MAAM,CAA4D,QAAoB;;;gBAC3F,8DAA8D;gBAC9D,MAAM,cAAc,GAAG,SAAS,iCAAM,OAAO,KAAE,UAAU,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,IAAG,CAAC,MAAM,CACxF,QAAQ,CACT,CAAC;;oBACF,KAAyB,eAAA,mBAAA,cAAA,cAAc,CAAA,oBAAA,6GAAE,CAAC;wBAAjB,8BAAc;wBAAd,WAAc;wBAA5B,MAAM,IAAI,KAAA,CAAA;wBACnB,oBAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA,CAAC;oBACzB,CAAC;;;;;;;;;YACH,CAAC;SAAA;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n DeletedKeyBundle,\n DeletedKeyItem,\n KeyRotationPolicy as GeneratedPolicy,\n KeyAttributes,\n KeyBundle,\n KeyItem,\n LifetimeActions,\n} from \"./generated/src/models/index.js\";\nimport { parseKeyVaultKeyIdentifier } from \"./identifier.js\";\nimport type {\n DeletedKey,\n KeyProperties,\n KeyRotationPolicy,\n KeyRotationPolicyAction,\n KeyRotationPolicyProperties,\n KeyVaultKey,\n} from \"./keysModels.js\";\nimport type { PagedAsyncIterableIterator, PageSettings } from \"./generated/src/index.js\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\n\n/**\n * @internal\n * Shapes the exposed {@link KeyVaultKey} based on either a received key bundle or deleted key bundle.\n */\nexport function getKeyFromKeyBundle(\n bundle: KeyBundle | DeletedKeyBundle,\n): KeyVaultKey | DeletedKey {\n const keyBundle = bundle as KeyBundle;\n const deletedKeyBundle = bundle as DeletedKeyBundle;\n\n const parsedId = parseKeyVaultKeyIdentifier(keyBundle.key!.kid!);\n\n const attributes: KeyAttributes = keyBundle.attributes || {};\n\n const resultObject: KeyVaultKey | DeletedKey = {\n key: keyBundle.key,\n id: keyBundle.key ? keyBundle.key.kid : undefined,\n name: parsedId.name,\n keyOperations: keyBundle.key ? keyBundle.key.keyOps : undefined,\n keyType: keyBundle.key ? keyBundle.key.kty : undefined,\n properties: {\n tags: keyBundle.tags,\n\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n expiresOn: attributes.expires,\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n recoverableDays: attributes.recoverableDays,\n recoveryLevel: attributes.recoveryLevel,\n exportable: attributes.exportable,\n releasePolicy: keyBundle.releasePolicy,\n hsmPlatform: attributes.hsmPlatform,\n\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n name: parsedId.name,\n managed: keyBundle.managed,\n\n id: keyBundle.key ? keyBundle.key.kid : undefined,\n },\n };\n\n if (deletedKeyBundle.recoveryId) {\n (resultObject as any).properties.recoveryId = deletedKeyBundle.recoveryId;\n (resultObject as any).properties.scheduledPurgeDate = deletedKeyBundle.scheduledPurgeDate;\n (resultObject as any).properties.deletedOn = deletedKeyBundle.deletedDate;\n }\n\n if (attributes.attestation) {\n resultObject.properties.attestation = attributes.attestation;\n }\n\n return resultObject;\n}\n\n/**\n * @internal\n * Shapes the exposed {@link DeletedKey} based on a received KeyItem.\n */\nexport function getDeletedKeyFromDeletedKeyItem(keyItem: DeletedKeyItem): DeletedKey {\n const commonProperties = getKeyPropertiesFromKeyItem(keyItem);\n\n return {\n key: {\n kid: keyItem.kid,\n },\n id: keyItem.kid,\n name: commonProperties.name,\n properties: {\n ...commonProperties,\n recoveryId: keyItem.recoveryId,\n scheduledPurgeDate: keyItem.scheduledPurgeDate,\n deletedOn: keyItem.deletedDate,\n },\n };\n}\n\n/**\n * @internal\n * Shapes the exposed {@link KeyProperties} based on a received KeyItem.\n */\nexport function getKeyPropertiesFromKeyItem(keyItem: KeyItem): KeyProperties {\n const parsedId = parseKeyVaultKeyIdentifier(keyItem.kid!);\n const attributes = keyItem.attributes || {};\n\n const resultObject: KeyProperties = {\n createdOn: attributes.created,\n enabled: attributes?.enabled,\n expiresOn: attributes?.expires,\n id: keyItem.kid,\n managed: keyItem.managed,\n name: parsedId.name,\n notBefore: attributes?.notBefore,\n recoverableDays: attributes?.recoverableDays,\n recoveryLevel: attributes?.recoveryLevel,\n hsmPlatform: attributes?.hsmPlatform,\n tags: keyItem.tags,\n updatedOn: attributes.updated,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n };\n\n return resultObject;\n}\n\nconst actionTypeCaseInsensitiveMapping: Record<string, KeyRotationPolicyAction> = {\n rotate: \"Rotate\",\n notify: \"Notify\",\n};\n\nfunction getNormalizedActionType(caseInsensitiveActionType: string): KeyRotationPolicyAction {\n const result = actionTypeCaseInsensitiveMapping[caseInsensitiveActionType.toLowerCase()];\n if (result) {\n return result;\n }\n\n throw new Error(`Unrecognized action type: ${caseInsensitiveActionType}`);\n}\n\n/**\n * @internal\n */\nexport const keyRotationTransformations = {\n propertiesToGenerated: function (\n parameters: KeyRotationPolicyProperties,\n ): Partial<GeneratedPolicy> {\n const policy: GeneratedPolicy = {\n attributes: {\n expiryTime: parameters.expiresIn,\n },\n lifetimeActions: parameters.lifetimeActions?.map((action) => {\n const generatedAction: LifetimeActions = {\n action: { type: action.action },\n trigger: {},\n };\n\n if (action.timeAfterCreate) {\n generatedAction.trigger!.timeAfterCreate = action.timeAfterCreate;\n }\n\n if (action.timeBeforeExpiry) {\n generatedAction.trigger!.timeBeforeExpiry = action.timeBeforeExpiry;\n }\n\n return generatedAction;\n }),\n };\n return policy;\n },\n generatedToPublic(generated: GeneratedPolicy): KeyRotationPolicy {\n const policy: KeyRotationPolicy = {\n id: generated.id,\n createdOn: generated.attributes?.created,\n updatedOn: generated.attributes?.updated,\n expiresIn: generated.attributes?.expiryTime,\n lifetimeActions: generated.lifetimeActions?.map((action) => {\n return {\n action: getNormalizedActionType(action.action!.type!),\n timeAfterCreate: action.trigger?.timeAfterCreate,\n timeBeforeExpiry: action.trigger?.timeBeforeExpiry,\n };\n }),\n };\n return policy;\n },\n};\n\n/**\n * A helper supporting compatibility between modular and legacy paged async iterables.\n *\n * Provides the following compatibility:\n * 1. Maps the values of the paged async iterable using the provided mapper function.\n * 2. Supports `maxPageSize` operation on the paged async iterable.\n *\n * TODO: move this to keyvault-common once everything is merged\n */\nexport function mapPagedAsyncIterable<\n TGenerated,\n TPublic,\n TOptions extends OperationOptions & { maxresults?: number },\n>(\n options: TOptions,\n operation: (options: TOptions) => PagedAsyncIterableIterator<TGenerated>,\n mapper: (x: TGenerated) => TPublic,\n): PagedAsyncIterableIterator<TPublic> {\n let iter: ReturnType<typeof operation> | undefined = undefined;\n return {\n async next() {\n iter ??= operation({ ...options, maxresults: undefined });\n const result = await iter.next();\n\n return {\n ...result,\n value: result.value && mapper(result.value),\n };\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n async *byPage<TSettings extends PageSettings & { maxPageSize?: number }>(settings?: TSettings) {\n // Pass the maxPageSize value to the underlying page operation\n const iteratorByPage = operation({ ...options, maxresults: settings?.maxPageSize }).byPage(\n settings,\n );\n for await (const page of iteratorByPage) {\n yield page.map(mapper);\n }\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"transformations.js","sourceRoot":"","sources":["../../src/transformations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAY7D;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAoC;IAEpC,MAAM,SAAS,GAAG,MAAmB,CAAC;IACtC,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gBACL,GAAG,MAAM;gBACT,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC5C,CAAC;QACJ,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,CAAC,MAAM,CAA4D,QAAoB;YAC3F,8DAA8D;YAC9D,MAAM,cAAc,GAAG,SAAS,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,CACxF,QAAQ,CACT,CAAC;YACF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;gBACxC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n DeletedKeyBundle,\n DeletedKeyItem,\n KeyRotationPolicy as GeneratedPolicy,\n KeyAttributes,\n KeyBundle,\n KeyItem,\n LifetimeActions,\n} from \"./generated/src/models/index.js\";\nimport { parseKeyVaultKeyIdentifier } from \"./identifier.js\";\nimport type {\n DeletedKey,\n KeyProperties,\n KeyRotationPolicy,\n KeyRotationPolicyAction,\n KeyRotationPolicyProperties,\n KeyVaultKey,\n} from \"./keysModels.js\";\nimport type { PagedAsyncIterableIterator, PageSettings } from \"./generated/src/index.js\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\n\n/**\n * @internal\n * Shapes the exposed {@link KeyVaultKey} based on either a received key bundle or deleted key bundle.\n */\nexport function getKeyFromKeyBundle(\n bundle: KeyBundle | DeletedKeyBundle,\n): KeyVaultKey | DeletedKey {\n const keyBundle = bundle as KeyBundle;\n const deletedKeyBundle = bundle as DeletedKeyBundle;\n\n const parsedId = parseKeyVaultKeyIdentifier(keyBundle.key!.kid!);\n\n const attributes: KeyAttributes = keyBundle.attributes || {};\n\n const resultObject: KeyVaultKey | DeletedKey = {\n key: keyBundle.key,\n id: keyBundle.key ? keyBundle.key.kid : undefined,\n name: parsedId.name,\n keyOperations: keyBundle.key ? keyBundle.key.keyOps : undefined,\n keyType: keyBundle.key ? keyBundle.key.kty : undefined,\n properties: {\n tags: keyBundle.tags,\n\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n expiresOn: attributes.expires,\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n recoverableDays: attributes.recoverableDays,\n recoveryLevel: attributes.recoveryLevel,\n exportable: attributes.exportable,\n releasePolicy: keyBundle.releasePolicy,\n hsmPlatform: attributes.hsmPlatform,\n\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n name: parsedId.name,\n managed: keyBundle.managed,\n\n id: keyBundle.key ? keyBundle.key.kid : undefined,\n },\n };\n\n if (deletedKeyBundle.recoveryId) {\n (resultObject as any).properties.recoveryId = deletedKeyBundle.recoveryId;\n (resultObject as any).properties.scheduledPurgeDate = deletedKeyBundle.scheduledPurgeDate;\n (resultObject as any).properties.deletedOn = deletedKeyBundle.deletedDate;\n }\n\n if (attributes.attestation) {\n resultObject.properties.attestation = attributes.attestation;\n }\n\n return resultObject;\n}\n\n/**\n * @internal\n * Shapes the exposed {@link DeletedKey} based on a received KeyItem.\n */\nexport function getDeletedKeyFromDeletedKeyItem(keyItem: DeletedKeyItem): DeletedKey {\n const commonProperties = getKeyPropertiesFromKeyItem(keyItem);\n\n return {\n key: {\n kid: keyItem.kid,\n },\n id: keyItem.kid,\n name: commonProperties.name,\n properties: {\n ...commonProperties,\n recoveryId: keyItem.recoveryId,\n scheduledPurgeDate: keyItem.scheduledPurgeDate,\n deletedOn: keyItem.deletedDate,\n },\n };\n}\n\n/**\n * @internal\n * Shapes the exposed {@link KeyProperties} based on a received KeyItem.\n */\nexport function getKeyPropertiesFromKeyItem(keyItem: KeyItem): KeyProperties {\n const parsedId = parseKeyVaultKeyIdentifier(keyItem.kid!);\n const attributes = keyItem.attributes || {};\n\n const resultObject: KeyProperties = {\n createdOn: attributes.created,\n enabled: attributes?.enabled,\n expiresOn: attributes?.expires,\n id: keyItem.kid,\n managed: keyItem.managed,\n name: parsedId.name,\n notBefore: attributes?.notBefore,\n recoverableDays: attributes?.recoverableDays,\n recoveryLevel: attributes?.recoveryLevel,\n hsmPlatform: attributes?.hsmPlatform,\n tags: keyItem.tags,\n updatedOn: attributes.updated,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n };\n\n return resultObject;\n}\n\nconst actionTypeCaseInsensitiveMapping: Record<string, KeyRotationPolicyAction> = {\n rotate: \"Rotate\",\n notify: \"Notify\",\n};\n\nfunction getNormalizedActionType(caseInsensitiveActionType: string): KeyRotationPolicyAction {\n const result = actionTypeCaseInsensitiveMapping[caseInsensitiveActionType.toLowerCase()];\n if (result) {\n return result;\n }\n\n throw new Error(`Unrecognized action type: ${caseInsensitiveActionType}`);\n}\n\n/**\n * @internal\n */\nexport const keyRotationTransformations = {\n propertiesToGenerated: function (\n parameters: KeyRotationPolicyProperties,\n ): Partial<GeneratedPolicy> {\n const policy: GeneratedPolicy = {\n attributes: {\n expiryTime: parameters.expiresIn,\n },\n lifetimeActions: parameters.lifetimeActions?.map((action) => {\n const generatedAction: LifetimeActions = {\n action: { type: action.action },\n trigger: {},\n };\n\n if (action.timeAfterCreate) {\n generatedAction.trigger!.timeAfterCreate = action.timeAfterCreate;\n }\n\n if (action.timeBeforeExpiry) {\n generatedAction.trigger!.timeBeforeExpiry = action.timeBeforeExpiry;\n }\n\n return generatedAction;\n }),\n };\n return policy;\n },\n generatedToPublic(generated: GeneratedPolicy): KeyRotationPolicy {\n const policy: KeyRotationPolicy = {\n id: generated.id,\n createdOn: generated.attributes?.created,\n updatedOn: generated.attributes?.updated,\n expiresIn: generated.attributes?.expiryTime,\n lifetimeActions: generated.lifetimeActions?.map((action) => {\n return {\n action: getNormalizedActionType(action.action!.type!),\n timeAfterCreate: action.trigger?.timeAfterCreate,\n timeBeforeExpiry: action.trigger?.timeBeforeExpiry,\n };\n }),\n };\n return policy;\n },\n};\n\n/**\n * A helper supporting compatibility between modular and legacy paged async iterables.\n *\n * Provides the following compatibility:\n * 1. Maps the values of the paged async iterable using the provided mapper function.\n * 2. Supports `maxPageSize` operation on the paged async iterable.\n *\n * TODO: move this to keyvault-common once everything is merged\n */\nexport function mapPagedAsyncIterable<\n TGenerated,\n TPublic,\n TOptions extends OperationOptions & { maxresults?: number },\n>(\n options: TOptions,\n operation: (options: TOptions) => PagedAsyncIterableIterator<TGenerated>,\n mapper: (x: TGenerated) => TPublic,\n): PagedAsyncIterableIterator<TPublic> {\n let iter: ReturnType<typeof operation> | undefined = undefined;\n return {\n async next() {\n iter ??= operation({ ...options, maxresults: undefined });\n const result = await iter.next();\n\n return {\n ...result,\n value: result.value && mapper(result.value),\n };\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n async *byPage<TSettings extends PageSettings & { maxPageSize?: number }>(settings?: TSettings) {\n // Pass the maxPageSize value to the underlying page operation\n const iteratorByPage = operation({ ...options, maxresults: settings?.maxPageSize }).byPage(\n settings,\n );\n for await (const page of iteratorByPage) {\n yield page.map(mapper);\n }\n },\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure/keyvault-keys",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "4.10.1-alpha.
|
|
5
|
+
"version": "4.10.1-alpha.20250722.2",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Isomorphic client library for Azure KeyVault's keys.",
|
|
8
8
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/keyvault/keyvault-keys/README.md",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"browser"
|
|
120
120
|
],
|
|
121
121
|
"selfLink": false,
|
|
122
|
-
"project": "
|
|
122
|
+
"project": "../../../tsconfig.src.build.json"
|
|
123
123
|
},
|
|
124
124
|
"exports": {
|
|
125
125
|
"./package.json": "./package.json",
|