@azure/keyvault-certificates 4.10.1-alpha.20250702.2 → 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.
Files changed (138) hide show
  1. package/dist/browser/generated/src/api/keyVaultContext.js +12 -9
  2. package/dist/browser/generated/src/api/keyVaultContext.js.map +1 -1
  3. package/dist/browser/generated/src/api/operations.js +242 -87
  4. package/dist/browser/generated/src/api/operations.js.map +1 -1
  5. package/dist/browser/generated/src/keyVaultClient.js +8 -3
  6. package/dist/browser/generated/src/keyVaultClient.js.map +1 -1
  7. package/dist/browser/generated/src/static-helpers/pagingHelpers.js +31 -50
  8. package/dist/browser/generated/src/static-helpers/pagingHelpers.js.map +1 -1
  9. package/dist/browser/generated/src/static-helpers/urlTemplate.js +2 -2
  10. package/dist/browser/generated/src/static-helpers/urlTemplate.js.map +1 -1
  11. package/dist/browser/identifier.js +4 -1
  12. package/dist/browser/identifier.js.map +1 -1
  13. package/dist/browser/index.js +43 -15
  14. package/dist/browser/index.js.map +1 -1
  15. package/dist/browser/lro/create/operation.js +6 -1
  16. package/dist/browser/lro/create/operation.js.map +1 -1
  17. package/dist/browser/lro/create/poller.js +5 -2
  18. package/dist/browser/lro/create/poller.js.map +1 -1
  19. package/dist/browser/lro/delete/operation.js +3 -0
  20. package/dist/browser/lro/delete/operation.js.map +1 -1
  21. package/dist/browser/lro/delete/poller.js +4 -1
  22. package/dist/browser/lro/delete/poller.js.map +1 -1
  23. package/dist/browser/lro/keyVaultCertificatePoller.js +6 -8
  24. package/dist/browser/lro/keyVaultCertificatePoller.js.map +1 -1
  25. package/dist/browser/lro/operation/operation.js +7 -1
  26. package/dist/browser/lro/operation/operation.js.map +1 -1
  27. package/dist/browser/lro/operation/poller.js +8 -2
  28. package/dist/browser/lro/operation/poller.js.map +1 -1
  29. package/dist/browser/lro/recover/operation.js +3 -0
  30. package/dist/browser/lro/recover/operation.js.map +1 -1
  31. package/dist/browser/lro/recover/poller.js +4 -1
  32. package/dist/browser/lro/recover/poller.js.map +1 -1
  33. package/dist/browser/transformations.js +23 -28
  34. package/dist/browser/transformations.js.map +1 -1
  35. package/dist/commonjs/generated/src/api/keyVaultContext.js +12 -9
  36. package/dist/commonjs/generated/src/api/keyVaultContext.js.map +1 -1
  37. package/dist/commonjs/generated/src/api/operations.js +242 -87
  38. package/dist/commonjs/generated/src/api/operations.js.map +1 -1
  39. package/dist/commonjs/generated/src/keyVaultClient.js +8 -3
  40. package/dist/commonjs/generated/src/keyVaultClient.js.map +1 -1
  41. package/dist/commonjs/generated/src/static-helpers/pagingHelpers.js +31 -50
  42. package/dist/commonjs/generated/src/static-helpers/pagingHelpers.js.map +1 -1
  43. package/dist/commonjs/generated/src/static-helpers/urlTemplate.js +2 -2
  44. package/dist/commonjs/generated/src/static-helpers/urlTemplate.js.map +1 -1
  45. package/dist/commonjs/identifier.js +4 -1
  46. package/dist/commonjs/identifier.js.map +1 -1
  47. package/dist/commonjs/index.js +43 -15
  48. package/dist/commonjs/index.js.map +1 -1
  49. package/dist/commonjs/lro/create/operation.js +6 -1
  50. package/dist/commonjs/lro/create/operation.js.map +1 -1
  51. package/dist/commonjs/lro/create/poller.js +5 -2
  52. package/dist/commonjs/lro/create/poller.js.map +1 -1
  53. package/dist/commonjs/lro/delete/operation.js +3 -0
  54. package/dist/commonjs/lro/delete/operation.js.map +1 -1
  55. package/dist/commonjs/lro/delete/poller.js +4 -1
  56. package/dist/commonjs/lro/delete/poller.js.map +1 -1
  57. package/dist/commonjs/lro/keyVaultCertificatePoller.js +6 -8
  58. package/dist/commonjs/lro/keyVaultCertificatePoller.js.map +1 -1
  59. package/dist/commonjs/lro/operation/operation.js +7 -1
  60. package/dist/commonjs/lro/operation/operation.js.map +1 -1
  61. package/dist/commonjs/lro/operation/poller.js +8 -2
  62. package/dist/commonjs/lro/operation/poller.js.map +1 -1
  63. package/dist/commonjs/lro/recover/operation.js +3 -0
  64. package/dist/commonjs/lro/recover/operation.js.map +1 -1
  65. package/dist/commonjs/lro/recover/poller.js +4 -1
  66. package/dist/commonjs/lro/recover/poller.js.map +1 -1
  67. package/dist/commonjs/transformations.js +23 -28
  68. package/dist/commonjs/transformations.js.map +1 -1
  69. package/dist/commonjs/tsdoc-metadata.json +11 -11
  70. package/dist/esm/generated/src/api/keyVaultContext.js +12 -9
  71. package/dist/esm/generated/src/api/keyVaultContext.js.map +1 -1
  72. package/dist/esm/generated/src/api/operations.js +242 -87
  73. package/dist/esm/generated/src/api/operations.js.map +1 -1
  74. package/dist/esm/generated/src/keyVaultClient.js +8 -3
  75. package/dist/esm/generated/src/keyVaultClient.js.map +1 -1
  76. package/dist/esm/generated/src/static-helpers/pagingHelpers.js +31 -50
  77. package/dist/esm/generated/src/static-helpers/pagingHelpers.js.map +1 -1
  78. package/dist/esm/generated/src/static-helpers/urlTemplate.js +2 -2
  79. package/dist/esm/generated/src/static-helpers/urlTemplate.js.map +1 -1
  80. package/dist/esm/identifier.js +4 -1
  81. package/dist/esm/identifier.js.map +1 -1
  82. package/dist/esm/index.js +43 -15
  83. package/dist/esm/index.js.map +1 -1
  84. package/dist/esm/lro/create/operation.js +6 -1
  85. package/dist/esm/lro/create/operation.js.map +1 -1
  86. package/dist/esm/lro/create/poller.js +5 -2
  87. package/dist/esm/lro/create/poller.js.map +1 -1
  88. package/dist/esm/lro/delete/operation.js +3 -0
  89. package/dist/esm/lro/delete/operation.js.map +1 -1
  90. package/dist/esm/lro/delete/poller.js +4 -1
  91. package/dist/esm/lro/delete/poller.js.map +1 -1
  92. package/dist/esm/lro/keyVaultCertificatePoller.js +6 -8
  93. package/dist/esm/lro/keyVaultCertificatePoller.js.map +1 -1
  94. package/dist/esm/lro/operation/operation.js +7 -1
  95. package/dist/esm/lro/operation/operation.js.map +1 -1
  96. package/dist/esm/lro/operation/poller.js +8 -2
  97. package/dist/esm/lro/operation/poller.js.map +1 -1
  98. package/dist/esm/lro/recover/operation.js +3 -0
  99. package/dist/esm/lro/recover/operation.js.map +1 -1
  100. package/dist/esm/lro/recover/poller.js +4 -1
  101. package/dist/esm/lro/recover/poller.js.map +1 -1
  102. package/dist/esm/transformations.js +23 -28
  103. package/dist/esm/transformations.js.map +1 -1
  104. package/dist/react-native/generated/src/api/keyVaultContext.js +12 -9
  105. package/dist/react-native/generated/src/api/keyVaultContext.js.map +1 -1
  106. package/dist/react-native/generated/src/api/operations.js +242 -87
  107. package/dist/react-native/generated/src/api/operations.js.map +1 -1
  108. package/dist/react-native/generated/src/keyVaultClient.js +8 -3
  109. package/dist/react-native/generated/src/keyVaultClient.js.map +1 -1
  110. package/dist/react-native/generated/src/static-helpers/pagingHelpers.js +31 -50
  111. package/dist/react-native/generated/src/static-helpers/pagingHelpers.js.map +1 -1
  112. package/dist/react-native/generated/src/static-helpers/urlTemplate.js +2 -2
  113. package/dist/react-native/generated/src/static-helpers/urlTemplate.js.map +1 -1
  114. package/dist/react-native/identifier.js +4 -1
  115. package/dist/react-native/identifier.js.map +1 -1
  116. package/dist/react-native/index.js +43 -15
  117. package/dist/react-native/index.js.map +1 -1
  118. package/dist/react-native/lro/create/operation.js +6 -1
  119. package/dist/react-native/lro/create/operation.js.map +1 -1
  120. package/dist/react-native/lro/create/poller.js +5 -2
  121. package/dist/react-native/lro/create/poller.js.map +1 -1
  122. package/dist/react-native/lro/delete/operation.js +3 -0
  123. package/dist/react-native/lro/delete/operation.js.map +1 -1
  124. package/dist/react-native/lro/delete/poller.js +4 -1
  125. package/dist/react-native/lro/delete/poller.js.map +1 -1
  126. package/dist/react-native/lro/keyVaultCertificatePoller.js +6 -8
  127. package/dist/react-native/lro/keyVaultCertificatePoller.js.map +1 -1
  128. package/dist/react-native/lro/operation/operation.js +7 -1
  129. package/dist/react-native/lro/operation/operation.js.map +1 -1
  130. package/dist/react-native/lro/operation/poller.js +8 -2
  131. package/dist/react-native/lro/operation/poller.js.map +1 -1
  132. package/dist/react-native/lro/recover/operation.js +3 -0
  133. package/dist/react-native/lro/recover/operation.js.map +1 -1
  134. package/dist/react-native/lro/recover/poller.js +4 -1
  135. package/dist/react-native/lro/recover/poller.js.map +1 -1
  136. package/dist/react-native/transformations.js +23 -28
  137. package/dist/react-native/transformations.js.map +1 -1
  138. package/package.json +2 -2
@@ -8,6 +8,9 @@ import { tracingClient } from "../../tracing.js";
8
8
  * which is represented locally as the "operation" of an active LRO Poller.
9
9
  */
10
10
  export class CertificateOperationPollOperation extends KeyVaultCertificatePollOperation {
11
+ state;
12
+ client;
13
+ operationOptions;
11
14
  constructor(state, client, operationOptions = {}) {
12
15
  super(state);
13
16
  this.state = state;
@@ -84,7 +87,10 @@ export class CertificateOperationPollOperation extends KeyVaultCertificatePollOp
84
87
  * Serializes the certificate's poll operation
85
88
  */
86
89
  toString() {
87
- const state = Object.assign({ certificateOperation: this.state.certificateOperation }, cleanState(this.state));
90
+ const state = {
91
+ certificateOperation: this.state.certificateOperation,
92
+ ...cleanState(this.state),
93
+ };
88
94
  return JSON.stringify({
89
95
  state,
90
96
  });
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/operation/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AAE/F,OAAO,EACL,wCAAwC,EACxC,6CAA6C,GAC9C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD;;;GAGG;AACH,MAAM,OAAO,iCAAkC,SAAQ,gCAGtD;IACC,YACS,KAAgC,EAC/B,MAAsB,EACtB,mBAAqC,EAAE;QAE/C,KAAK,CAAC,KAAK,CAAC,CAAC;QAJN,UAAK,GAAL,KAAK,CAA2B;QAC/B,WAAM,GAAN,MAAM,CAAgB;QACtB,qBAAgB,GAAhB,gBAAgB,CAAuB;IAGjD,CAAC;IAED;;OAEG;IACK,0BAA0B,CAChC,eAAuB,EACvB,UA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,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QAC1D,CAAC;QAED,KAAK,CAAC,oBAAoB,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAChE,eAAe,EACf,IAAI,CAAC,gBAAgB,CACtB,CAAC;QAEF,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,MAAM,KAAK,mBACT,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB,IAClD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAC1B,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type {\n CancelCertificateOperationOptions,\n CertificateOperation,\n GetCertificateOptions,\n GetPlainCertificateOperationOptions,\n KeyVaultCertificateWithPolicy,\n} from \"../../certificatesModels.js\";\nimport type { KeyVaultCertificatePollOperationState } from \"../keyVaultCertificatePoller.js\";\nimport { cleanState, KeyVaultCertificatePollOperation } from \"../keyVaultCertificatePoller.js\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport {\n getCertificateOperationFromCoreOperation,\n getCertificateWithPolicyFromCertificateBundle,\n} from \"../../transformations.js\";\nimport { tracingClient } from \"../../tracing.js\";\n\n/**\n * An interface representing the publicly available properties of the state of the CertificateOperationPoller.\n */\nexport interface CertificateOperationState\n extends KeyVaultCertificatePollOperationState<KeyVaultCertificateWithPolicy> {\n /**\n * The operation of the certificate\n */\n certificateOperation?: CertificateOperation;\n}\n\n/**\n * An interface representing the active operation of a certificate's creation,\n * which is represented locally as the \"operation\" of an active LRO Poller.\n */\nexport class CertificateOperationPollOperation extends KeyVaultCertificatePollOperation<\n CertificateOperationState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(\n public state: CertificateOperationState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state);\n }\n\n /**\n * Cancels a certificate creation operation that is already in progress. This operation requires the certificates/update permission.\n */\n private cancelCertificateOperation(\n certificateName: string,\n options: CancelCertificateOperationOptions = {},\n ): Promise<CertificateOperation> {\n return tracingClient.withSpan(\n \"CertificateOperationPoller.cancelCertificateOperation\",\n options,\n async (updatedOptions) => {\n const response = await this.client.updateCertificateOperation(\n certificateName,\n { cancellationRequested: true },\n updatedOptions,\n );\n return getCertificateOperationFromCoreOperation(certificateName, response);\n },\n );\n }\n\n /**\n * Gets the latest information available from a specific certificate, including the certificate's policy. This operation requires the certificates/get permission.\n */\n private getCertificate(\n certificateName: string,\n options: GetCertificateOptions = {},\n ): Promise<KeyVaultCertificateWithPolicy> {\n return tracingClient.withSpan(\n \"CertificateOperationPoller.getCertificate\",\n options,\n async (updatedOptions) => {\n const result = await this.client.getCertificate(certificateName, \"\", updatedOptions);\n return getCertificateWithPolicyFromCertificateBundle(result);\n },\n );\n }\n\n /**\n * Gets the certificate operation.\n */\n private getPlainCertificateOperation(\n certificateName: string,\n options: GetPlainCertificateOperationOptions = {},\n ): Promise<CertificateOperation> {\n return tracingClient.withSpan(\n \"CertificateOperationPoller.getPlainCertificateOperation\",\n options,\n async (updatedOptions) => {\n const response = await this.client.getCertificateOperation(certificateName, updatedOptions);\n return getCertificateOperationFromCoreOperation(certificateName, response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the poll operation.\n */\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: CertificateOperationState) => void;\n } = {},\n ): Promise<CertificateOperationPollOperation> {\n const state = this.state;\n const certificateName = state.certificateName!;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n state.isStarted = true;\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n state.certificateOperation = await this.getPlainCertificateOperation(\n certificateName,\n this.operationOptions,\n );\n } else if (!state.isCompleted) {\n state.certificateOperation = await this.getPlainCertificateOperation(\n certificateName,\n this.operationOptions,\n );\n }\n\n if (state.certificateOperation && state.certificateOperation.status !== \"inProgress\") {\n state.isCompleted = true;\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n if (state.certificateOperation.error) {\n state.error = new Error(state.certificateOperation.error.message);\n }\n }\n\n return this;\n }\n\n /**\n * Reaches to the service and cancels the certificate's operation, also updating the poll operation.\n */\n async cancel(\n this: CertificateOperationPollOperation,\n options: { abortSignal?: AbortSignal } = {},\n ): Promise<CertificateOperationPollOperation> {\n const state = this.state;\n const certificateName = state.certificateName!;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n state.certificateOperation = await this.cancelCertificateOperation(\n certificateName,\n this.operationOptions,\n );\n\n this.state.isCancelled = true;\n return this;\n }\n\n /**\n * Serializes the certificate's poll operation\n */\n public toString(): string {\n const state: CertificateOperationState = {\n certificateOperation: this.state.certificateOperation,\n ...cleanState(this.state),\n };\n return JSON.stringify({\n state,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/operation/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AAE/F,OAAO,EACL,wCAAwC,EACxC,6CAA6C,GAC9C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD;;;GAGG;AACH,MAAM,OAAO,iCAAkC,SAAQ,gCAGtD;IAEU;IACC;IACA;IAHV,YACS,KAAgC,EAC/B,MAAsB,EACtB,mBAAqC,EAAE;QAE/C,KAAK,CAAC,KAAK,CAAC,CAAC;QAJN,UAAK,GAAL,KAAK,CAA2B;QAC/B,WAAM,GAAN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MAAM,eAAe,GAAG,KAAK,CAAC,eAAgB,CAAC;QAE/C,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,CAAC,gBAAgB,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QAC1D,CAAC;QAED,KAAK,CAAC,oBAAoB,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAChE,eAAe,EACf,IAAI,CAAC,gBAAgB,CACtB,CAAC;QAEF,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,MAAM,KAAK,GAA8B;YACvC,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB;YACrD,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;SAC1B,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type {\n CancelCertificateOperationOptions,\n CertificateOperation,\n GetCertificateOptions,\n GetPlainCertificateOperationOptions,\n KeyVaultCertificateWithPolicy,\n} from \"../../certificatesModels.js\";\nimport type { KeyVaultCertificatePollOperationState } from \"../keyVaultCertificatePoller.js\";\nimport { cleanState, KeyVaultCertificatePollOperation } from \"../keyVaultCertificatePoller.js\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport {\n getCertificateOperationFromCoreOperation,\n getCertificateWithPolicyFromCertificateBundle,\n} from \"../../transformations.js\";\nimport { tracingClient } from \"../../tracing.js\";\n\n/**\n * An interface representing the publicly available properties of the state of the CertificateOperationPoller.\n */\nexport interface CertificateOperationState\n extends KeyVaultCertificatePollOperationState<KeyVaultCertificateWithPolicy> {\n /**\n * The operation of the certificate\n */\n certificateOperation?: CertificateOperation;\n}\n\n/**\n * An interface representing the active operation of a certificate's creation,\n * which is represented locally as the \"operation\" of an active LRO Poller.\n */\nexport class CertificateOperationPollOperation extends KeyVaultCertificatePollOperation<\n CertificateOperationState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(\n public state: CertificateOperationState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state);\n }\n\n /**\n * Cancels a certificate creation operation that is already in progress. This operation requires the certificates/update permission.\n */\n private cancelCertificateOperation(\n certificateName: string,\n options: CancelCertificateOperationOptions = {},\n ): Promise<CertificateOperation> {\n return tracingClient.withSpan(\n \"CertificateOperationPoller.cancelCertificateOperation\",\n options,\n async (updatedOptions) => {\n const response = await this.client.updateCertificateOperation(\n certificateName,\n { cancellationRequested: true },\n updatedOptions,\n );\n return getCertificateOperationFromCoreOperation(certificateName, response);\n },\n );\n }\n\n /**\n * Gets the latest information available from a specific certificate, including the certificate's policy. This operation requires the certificates/get permission.\n */\n private getCertificate(\n certificateName: string,\n options: GetCertificateOptions = {},\n ): Promise<KeyVaultCertificateWithPolicy> {\n return tracingClient.withSpan(\n \"CertificateOperationPoller.getCertificate\",\n options,\n async (updatedOptions) => {\n const result = await this.client.getCertificate(certificateName, \"\", updatedOptions);\n return getCertificateWithPolicyFromCertificateBundle(result);\n },\n );\n }\n\n /**\n * Gets the certificate operation.\n */\n private getPlainCertificateOperation(\n certificateName: string,\n options: GetPlainCertificateOperationOptions = {},\n ): Promise<CertificateOperation> {\n return tracingClient.withSpan(\n \"CertificateOperationPoller.getPlainCertificateOperation\",\n options,\n async (updatedOptions) => {\n const response = await this.client.getCertificateOperation(certificateName, updatedOptions);\n return getCertificateOperationFromCoreOperation(certificateName, response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the poll operation.\n */\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: CertificateOperationState) => void;\n } = {},\n ): Promise<CertificateOperationPollOperation> {\n const state = this.state;\n const certificateName = state.certificateName!;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n state.isStarted = true;\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n state.certificateOperation = await this.getPlainCertificateOperation(\n certificateName,\n this.operationOptions,\n );\n } else if (!state.isCompleted) {\n state.certificateOperation = await this.getPlainCertificateOperation(\n certificateName,\n this.operationOptions,\n );\n }\n\n if (state.certificateOperation && state.certificateOperation.status !== \"inProgress\") {\n state.isCompleted = true;\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n if (state.certificateOperation.error) {\n state.error = new Error(state.certificateOperation.error.message);\n }\n }\n\n return this;\n }\n\n /**\n * Reaches to the service and cancels the certificate's operation, also updating the poll operation.\n */\n async cancel(\n this: CertificateOperationPollOperation,\n options: { abortSignal?: AbortSignal } = {},\n ): Promise<CertificateOperationPollOperation> {\n const state = this.state;\n const certificateName = state.certificateName!;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n state.certificateOperation = await this.cancelCertificateOperation(\n certificateName,\n this.operationOptions,\n );\n\n this.state.isCancelled = true;\n return this;\n }\n\n /**\n * Serializes the certificate's poll operation\n */\n public toString(): string {\n const state: CertificateOperationState = {\n certificateOperation: this.state.certificateOperation,\n ...cleanState(this.state),\n };\n return JSON.stringify({\n state,\n });\n }\n}\n"]}
@@ -12,7 +12,10 @@ export class CertificateOperationPoller extends KeyVaultCertificatePoller {
12
12
  if (resumeFrom) {
13
13
  state = JSON.parse(resumeFrom).state;
14
14
  }
15
- const operation = new CertificateOperationPollOperation(Object.assign(Object.assign({}, state), { certificateName }), client, operationOptions);
15
+ const operation = new CertificateOperationPollOperation({
16
+ ...state,
17
+ certificateName,
18
+ }, client, operationOptions);
16
19
  super(operation);
17
20
  this.intervalInMs = intervalInMs;
18
21
  }
@@ -20,7 +23,10 @@ export class CertificateOperationPoller extends KeyVaultCertificatePoller {
20
23
  * Gets the public state of the polling operation
21
24
  */
22
25
  getOperationState() {
23
- return Object.assign(Object.assign({}, cleanState(this.operation.state)), { certificateOperation: this.operation.state.certificateOperation });
26
+ return {
27
+ ...cleanState(this.operation.state),
28
+ certificateOperation: this.operation.state.certificateOperation,
29
+ };
24
30
  }
25
31
  }
26
32
  //# sourceMappingURL=poller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/operation/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAGnE,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAIxF;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,yBAG/C;IACC,YAAY,OAA0C;QACpD,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/F,IAAI,KAA4C,CAAC;QAEjD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,iCAAiC,iCAEhD,KAAK,KACR,eAAe,KAEjB,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,uCACK,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KACnC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,oBAAoB,IAC/D;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CertificateOperationState } from \"./operation.js\";\nimport { CertificateOperationPollOperation } from \"./operation.js\";\nimport type { KeyVaultCertificateWithPolicy } from \"../../certificatesModels.js\";\nimport type { KeyVaultCertificatePollerOptions } from \"../keyVaultCertificatePoller.js\";\nimport { KeyVaultCertificatePoller, cleanState } from \"../keyVaultCertificatePoller.js\";\n\nexport interface CertificateOperationPollerOptions extends KeyVaultCertificatePollerOptions {}\n\n/**\n * Class that creates a poller that waits until a certificate finishes being created\n */\nexport class CertificateOperationPoller extends KeyVaultCertificatePoller<\n CertificateOperationState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(options: CertificateOperationPollerOptions) {\n const { client, certificateName, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: CertificateOperationState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new CertificateOperationPollOperation(\n {\n ...state,\n certificateName,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n\n /**\n * Gets the public state of the polling operation\n */\n public getOperationState(): CertificateOperationState {\n return {\n ...cleanState(this.operation.state),\n certificateOperation: this.operation.state.certificateOperation,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/operation/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAGnE,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAIxF;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,yBAG/C;IACC,YAAY,OAA0C;QACpD,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/F,IAAI,KAA4C,CAAC;QAEjD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,iCAAiC,CACrD;YACE,GAAG,KAAK;YACR,eAAe;SAChB,EACD,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO;YACL,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YACnC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,oBAAoB;SAChE,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CertificateOperationState } from \"./operation.js\";\nimport { CertificateOperationPollOperation } from \"./operation.js\";\nimport type { KeyVaultCertificateWithPolicy } from \"../../certificatesModels.js\";\nimport type { KeyVaultCertificatePollerOptions } from \"../keyVaultCertificatePoller.js\";\nimport { KeyVaultCertificatePoller, cleanState } from \"../keyVaultCertificatePoller.js\";\n\nexport interface CertificateOperationPollerOptions extends KeyVaultCertificatePollerOptions {}\n\n/**\n * Class that creates a poller that waits until a certificate finishes being created\n */\nexport class CertificateOperationPoller extends KeyVaultCertificatePoller<\n CertificateOperationState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(options: CertificateOperationPollerOptions) {\n const { client, certificateName, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: CertificateOperationState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new CertificateOperationPollOperation(\n {\n ...state,\n certificateName,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n\n /**\n * Gets the public state of the polling operation\n */\n public getOperationState(): CertificateOperationState {\n return {\n ...cleanState(this.operation.state),\n certificateOperation: this.operation.state.certificateOperation,\n };\n }\n}\n"]}
@@ -7,6 +7,9 @@ import { KeyVaultCertificatePollOperation } from "../keyVaultCertificatePoller.j
7
7
  * An interface representing the recovery of a deleted certificate's poll operation
8
8
  */
9
9
  export class RecoverDeletedCertificatePollOperation extends KeyVaultCertificatePollOperation {
10
+ state;
11
+ client;
12
+ operationOptions;
10
13
  constructor(state, client, operationOptions = {}) {
11
14
  super(state, {
12
15
  cancelMessage: "Canceling the recovery of a deleted certificate is not supported.",
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/recover/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,6CAA6C,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AAQnF;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,gCAG3D;IACC,YACS,KAAqC,EACpC,MAAsB,EACtB,mBAAqC,EAAE;QAE/C,KAAK,CAAC,KAAK,EAAE;YACX,aAAa,EAAE,mEAAmE;SACnF,CAAC,CAAC;QANI,UAAK,GAAL,KAAK,CAAgC;QACpC,WAAM,GAAN,MAAM,CAAgB;QACtB,qBAAgB,GAAhB,gBAAgB,CAAuB;IAKjD,CAAC;IAED;;OAEG;IACK,cAAc,CACpB,eAAuB,EACvB,UAAiC,EAAE;QAEnC,OAAO,aAAa,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;YACrF,OAAO,6CAA6C,CAAC,MAAM,CAAC,CAAC;QAC/D,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,yBAAyB,CAC/B,eAAuB,EACvB,UAA4C,EAAE;QAE9C,OAAO,aAAa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AAG,IAAI,CAAC;YAC3B,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,6EAA6E;oBAC7E,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC3B,CAAC;qBAAM,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;oBACzB,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type {\n GetCertificateOptions,\n KeyVaultCertificateWithPolicy,\n RecoverDeletedCertificateOptions,\n} from \"../../certificatesModels.js\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport { tracingClient } from \"../../tracing.js\";\nimport { getCertificateWithPolicyFromCertificateBundle } from \"../../transformations.js\";\nimport type { KeyVaultCertificatePollOperationState } from \"../keyVaultCertificatePoller.js\";\nimport { KeyVaultCertificatePollOperation } from \"../keyVaultCertificatePoller.js\";\n\n/**\n * Deprecated: Public representation of the recovery of a deleted certificate poll operation\n */\nexport type RecoverDeletedCertificateState =\n KeyVaultCertificatePollOperationState<KeyVaultCertificateWithPolicy>;\n\n/**\n * An interface representing the recovery of a deleted certificate's poll operation\n */\nexport class RecoverDeletedCertificatePollOperation extends KeyVaultCertificatePollOperation<\n RecoverDeletedCertificateState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(\n public state: RecoverDeletedCertificateState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state, {\n cancelMessage: \"Canceling the recovery of a deleted certificate is not supported.\",\n });\n }\n\n /**\n * Gets the latest information available from a specific certificate, including the certificate's policy. This operation requires the certificates/get permission.\n */\n private getCertificate(\n certificateName: string,\n options: GetCertificateOptions = {},\n ): Promise<KeyVaultCertificateWithPolicy> {\n return tracingClient.withSpan(\n \"RecoverDeletedCertificatePoller.getCertificate\",\n options,\n async (updatedOptions) => {\n const result = await this.client.getCertificate(certificateName, \"\", updatedOptions);\n return getCertificateWithPolicyFromCertificateBundle(result);\n },\n );\n }\n\n /**\n * Recovers the deleted certificate in the specified vault. This operation can only be performed on a soft-delete enabled vault. This operation\n * requires the certificate/recover permission.\n */\n private recoverDeletedCertificate(\n certificateName: string,\n options: RecoverDeletedCertificateOptions = {},\n ): Promise<KeyVaultCertificateWithPolicy> {\n return tracingClient.withSpan(\n \"RecoverDeletedCertificatePoller.recoverDeletedCertificate\",\n options,\n async (updatedOptions) => {\n const response = await this.client.recoverDeletedCertificate(\n certificateName,\n updatedOptions,\n );\n return getCertificateWithPolicyFromCertificateBundle(response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the poll operation.\n */\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: RecoverDeletedCertificateState) => void;\n } = {},\n ): Promise<RecoverDeletedCertificatePollOperation> {\n const state = this.state;\n const { certificateName } = state;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n try {\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n state.isCompleted = true;\n } catch (e: any) {\n // getCertificate will only work once the LRO is completed.\n }\n if (!state.isCompleted) {\n state.result = await this.recoverDeletedCertificate(certificateName, this.operationOptions);\n state.isStarted = true;\n }\n }\n\n if (!state.isCompleted) {\n try {\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n state.isCompleted = true;\n } catch (error: any) {\n if (error.statusCode === 403) {\n // At this point, the resource exists but the user doesn't have access to it.\n state.isCompleted = true;\n } else if (error.statusCode !== 404) {\n state.error = error;\n state.isCompleted = true;\n throw error;\n }\n }\n }\n\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/recover/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,6CAA6C,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AAQnF;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,gCAG3D;IAEU;IACC;IACA;IAHV,YACS,KAAqC,EACpC,MAAsB,EACtB,mBAAqC,EAAE;QAE/C,KAAK,CAAC,KAAK,EAAE;YACX,aAAa,EAAE,mEAAmE;SACnF,CAAC,CAAC;QANI,UAAK,GAAL,KAAK,CAAgC;QACpC,WAAM,GAAN,MAAM,CAAgB;QACtB,qBAAgB,GAAhB,gBAAgB,CAAuB;IAKjD,CAAC;IAED;;OAEG;IACK,cAAc,CACpB,eAAuB,EACvB,UAAiC,EAAE;QAEnC,OAAO,aAAa,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;YACrF,OAAO,6CAA6C,CAAC,MAAM,CAAC,CAAC;QAC/D,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,yBAAyB,CAC/B,eAAuB,EACvB,UAA4C,EAAE;QAE9C,OAAO,aAAa,CAAC,QAAQ,CAC3B,2DAA2D,EAC3D,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAC1D,eAAe,EACf,cAAc,CACf,CAAC;YACF,OAAO,6CAA6C,CAAC,QAAQ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K,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;oBACzB,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type {\n GetCertificateOptions,\n KeyVaultCertificateWithPolicy,\n RecoverDeletedCertificateOptions,\n} from \"../../certificatesModels.js\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport { tracingClient } from \"../../tracing.js\";\nimport { getCertificateWithPolicyFromCertificateBundle } from \"../../transformations.js\";\nimport type { KeyVaultCertificatePollOperationState } from \"../keyVaultCertificatePoller.js\";\nimport { KeyVaultCertificatePollOperation } from \"../keyVaultCertificatePoller.js\";\n\n/**\n * Deprecated: Public representation of the recovery of a deleted certificate poll operation\n */\nexport type RecoverDeletedCertificateState =\n KeyVaultCertificatePollOperationState<KeyVaultCertificateWithPolicy>;\n\n/**\n * An interface representing the recovery of a deleted certificate's poll operation\n */\nexport class RecoverDeletedCertificatePollOperation extends KeyVaultCertificatePollOperation<\n RecoverDeletedCertificateState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(\n public state: RecoverDeletedCertificateState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state, {\n cancelMessage: \"Canceling the recovery of a deleted certificate is not supported.\",\n });\n }\n\n /**\n * Gets the latest information available from a specific certificate, including the certificate's policy. This operation requires the certificates/get permission.\n */\n private getCertificate(\n certificateName: string,\n options: GetCertificateOptions = {},\n ): Promise<KeyVaultCertificateWithPolicy> {\n return tracingClient.withSpan(\n \"RecoverDeletedCertificatePoller.getCertificate\",\n options,\n async (updatedOptions) => {\n const result = await this.client.getCertificate(certificateName, \"\", updatedOptions);\n return getCertificateWithPolicyFromCertificateBundle(result);\n },\n );\n }\n\n /**\n * Recovers the deleted certificate in the specified vault. This operation can only be performed on a soft-delete enabled vault. This operation\n * requires the certificate/recover permission.\n */\n private recoverDeletedCertificate(\n certificateName: string,\n options: RecoverDeletedCertificateOptions = {},\n ): Promise<KeyVaultCertificateWithPolicy> {\n return tracingClient.withSpan(\n \"RecoverDeletedCertificatePoller.recoverDeletedCertificate\",\n options,\n async (updatedOptions) => {\n const response = await this.client.recoverDeletedCertificate(\n certificateName,\n updatedOptions,\n );\n return getCertificateWithPolicyFromCertificateBundle(response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the poll operation.\n */\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: RecoverDeletedCertificateState) => void;\n } = {},\n ): Promise<RecoverDeletedCertificatePollOperation> {\n const state = this.state;\n const { certificateName } = state;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n try {\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n state.isCompleted = true;\n } catch (e: any) {\n // getCertificate will only work once the LRO is completed.\n }\n if (!state.isCompleted) {\n state.result = await this.recoverDeletedCertificate(certificateName, this.operationOptions);\n state.isStarted = true;\n }\n }\n\n if (!state.isCompleted) {\n try {\n state.result = await this.getCertificate(certificateName, this.operationOptions);\n state.isCompleted = true;\n } catch (error: any) {\n if (error.statusCode === 403) {\n // At this point, the resource exists but the user doesn't have access to it.\n state.isCompleted = true;\n } else if (error.statusCode !== 404) {\n state.error = error;\n state.isCompleted = true;\n throw error;\n }\n }\n }\n\n return this;\n }\n}\n"]}
@@ -12,7 +12,10 @@ export class RecoverDeletedCertificatePoller extends KeyVaultCertificatePoller {
12
12
  if (resumeFrom) {
13
13
  state = JSON.parse(resumeFrom).state;
14
14
  }
15
- const operation = new RecoverDeletedCertificatePollOperation(Object.assign(Object.assign({}, state), { certificateName }), client, operationOptions);
15
+ const operation = new RecoverDeletedCertificatePollOperation({
16
+ ...state,
17
+ certificateName,
18
+ }, client, operationOptions);
16
19
  super(operation);
17
20
  this.intervalInMs = intervalInMs;
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/recover/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAI5E;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,yBAGpD;IACC,YAAY,OAA+C;QACzD,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/F,IAAI,KAAiD,CAAC;QAEtD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,sCAAsC,iCAErD,KAAK,KACR,eAAe,KAEjB,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RecoverDeletedCertificateState } from \"./operation.js\";\nimport { RecoverDeletedCertificatePollOperation } from \"./operation.js\";\nimport type { KeyVaultCertificateWithPolicy } from \"../../certificatesModels.js\";\nimport type { KeyVaultCertificatePollerOptions } from \"../keyVaultCertificatePoller.js\";\nimport { KeyVaultCertificatePoller } from \"../keyVaultCertificatePoller.js\";\n\nexport interface RecoverDeletedCertificatePollerOptions extends KeyVaultCertificatePollerOptions {}\n\n/**\n * Class that creates a poller that waits until a deleted certificate is fully recovered.\n */\nexport class RecoverDeletedCertificatePoller extends KeyVaultCertificatePoller<\n RecoverDeletedCertificateState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(options: RecoverDeletedCertificatePollerOptions) {\n const { client, certificateName, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: RecoverDeletedCertificateState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new RecoverDeletedCertificatePollOperation(\n {\n ...state,\n certificateName,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n}\n"]}
1
+ {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/recover/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sCAAsC,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAI5E;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,yBAGpD;IACC,YAAY,OAA+C;QACzD,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/F,IAAI,KAAiD,CAAC;QAEtD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,sCAAsC,CAC1D;YACE,GAAG,KAAK;YACR,eAAe;SAChB,EACD,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RecoverDeletedCertificateState } from \"./operation.js\";\nimport { RecoverDeletedCertificatePollOperation } from \"./operation.js\";\nimport type { KeyVaultCertificateWithPolicy } from \"../../certificatesModels.js\";\nimport type { KeyVaultCertificatePollerOptions } from \"../keyVaultCertificatePoller.js\";\nimport { KeyVaultCertificatePoller } from \"../keyVaultCertificatePoller.js\";\n\nexport interface RecoverDeletedCertificatePollerOptions extends KeyVaultCertificatePollerOptions {}\n\n/**\n * Class that creates a poller that waits until a deleted certificate is fully recovered.\n */\nexport class RecoverDeletedCertificatePoller extends KeyVaultCertificatePoller<\n RecoverDeletedCertificateState,\n KeyVaultCertificateWithPolicy\n> {\n constructor(options: RecoverDeletedCertificatePollerOptions) {\n const { client, certificateName, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: RecoverDeletedCertificateState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new RecoverDeletedCertificatePollOperation(\n {\n ...state,\n certificateName,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n}\n"]}
@@ -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 { uint8ArrayToString } from "@azure/core-util";
5
4
  import { parseKeyVaultCertificateIdentifier } from "./identifier.js";
6
5
  export function toCoreAttributes(properties) {
@@ -65,13 +64,22 @@ export function toPublicPolicy(policy = {}) {
65
64
  if (x509Properties.subjectAlternativeNames) {
66
65
  const names = x509Properties.subjectAlternativeNames;
67
66
  if (names.emails && names.emails.length) {
68
- subjectAlternativeNames = Object.assign(Object.assign({}, subjectAlternativeNames), { emails: names.emails });
67
+ subjectAlternativeNames = {
68
+ ...subjectAlternativeNames,
69
+ emails: names.emails,
70
+ };
69
71
  }
70
72
  if (names.dnsNames && names.dnsNames.length) {
71
- subjectAlternativeNames = Object.assign(Object.assign({}, subjectAlternativeNames), { dnsNames: names.dnsNames });
73
+ subjectAlternativeNames = {
74
+ ...subjectAlternativeNames,
75
+ dnsNames: names.dnsNames,
76
+ };
72
77
  }
73
78
  if (names.upns && names.upns.length) {
74
- subjectAlternativeNames = Object.assign(Object.assign({}, subjectAlternativeNames), { userPrincipalNames: names.upns });
79
+ subjectAlternativeNames = {
80
+ ...subjectAlternativeNames,
81
+ userPrincipalNames: names.upns,
82
+ };
75
83
  }
76
84
  }
77
85
  }
@@ -212,7 +220,6 @@ export function getDeletedCertificateFromDeletedCertificateBundle(certificateBun
212
220
  };
213
221
  }
214
222
  export function getDeletedCertificateFromItem(item) {
215
- var _a, _b;
216
223
  const parsedId = parseKeyVaultCertificateIdentifier(item.id);
217
224
  const attributes = item.attributes || {};
218
225
  const abstractProperties = {
@@ -226,8 +233,8 @@ export function getDeletedCertificateFromItem(item) {
226
233
  tags: item.tags,
227
234
  x509Thumbprint: item.x509Thumbprint,
228
235
  x509ThumbprintString: item.x509Thumbprint && uint8ArrayToString(item.x509Thumbprint, "hex"),
229
- recoverableDays: (_a = item.attributes) === null || _a === void 0 ? void 0 : _a.recoverableDays,
230
- recoveryLevel: (_b = item.attributes) === null || _b === void 0 ? void 0 : _b.recoveryLevel,
236
+ recoverableDays: item.attributes?.recoverableDays,
237
+ recoveryLevel: item.attributes?.recoveryLevel,
231
238
  };
232
239
  return {
233
240
  deletedOn: item.deletedDate,
@@ -299,31 +306,19 @@ export function mapPagedAsyncIterable(iter, mapper) {
299
306
  return {
300
307
  async next() {
301
308
  const result = await iter.next();
302
- return Object.assign(Object.assign({}, result), { value: result.value && mapper(result.value) });
309
+ return {
310
+ ...result,
311
+ value: result.value && mapper(result.value),
312
+ };
303
313
  },
304
314
  [Symbol.asyncIterator]() {
305
315
  return this;
306
316
  },
307
- byPage(settings) {
308
- return __asyncGenerator(this, arguments, function* byPage_1() {
309
- var _a, e_1, _b, _c;
310
- const iteratorByPage = iter.byPage(settings);
311
- try {
312
- 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) {
313
- _c = iteratorByPage_1_1.value;
314
- _d = false;
315
- const page = _c;
316
- yield yield __await(page.map(mapper));
317
- }
318
- }
319
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
320
- finally {
321
- try {
322
- if (!_d && !_a && (_b = iteratorByPage_1.return)) yield __await(_b.call(iteratorByPage_1));
323
- }
324
- finally { if (e_1) throw e_1.error; }
325
- }
326
- });
317
+ async *byPage(settings) {
318
+ const iteratorByPage = iter.byPage(settings);
319
+ for await (const page of iteratorByPage) {
320
+ yield page.map(mapper);
321
+ }
327
322
  },
328
323
  };
329
324
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transformations.js","sourceRoot":"","sources":["../../src/transformations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA8BtD,OAAO,EAAE,kCAAkC,EAAE,MAAM,iBAAiB,CAAC;AAGrE,MAAM,UAAU,gBAAgB,CAAC,UAAiC;IAChE,OAAO;QACL,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,OAAO,EAAE,UAAU,CAAC,SAAS;QAC7B,OAAO,EAAE,UAAU,CAAC,SAAS;QAC7B,OAAO,EAAE,UAAU,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,EAAsB,EACtB,MAAyB,EACzB,aAAoC,EAAE;IAEtC,IAAI,uBAAuB,GAAgC,EAAE,CAAC;IAC9D,IAAI,MAAM,CAAC,uBAAuB,EAAE,CAAC;QACnC,uBAAuB,GAAG;YACxB,MAAM,EAAE,MAAM,CAAC,uBAAuB,CAAC,MAAM;YAC7C,QAAQ,EAAE,MAAM,CAAC,uBAAuB,CAAC,QAAQ;YACjD,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AI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;;oBAC7C,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 { uint8ArrayToString } from \"@azure/core-util\";\nimport type {\n ArrayOneOrMore,\n CertificateContentType,\n CertificateOperation,\n CertificateIssuer,\n CertificatePolicy,\n CertificateProperties,\n DeletedCertificate,\n KeyVaultCertificate,\n KeyVaultCertificateWithPolicy,\n SubjectAlternativeNames,\n CertificateContact,\n CertificateOperationError,\n} from \"./certificatesModels.js\";\nimport type {\n CertificateAttributes,\n CertificateBundle,\n CertificatePolicy as CoreCertificatePolicy,\n DeletedCertificateBundle,\n DeletedCertificateItem,\n IssuerAttributes,\n IssuerBundle,\n SubjectAlternativeNames as CoreSubjectAlternativeNames,\n X509CertificateProperties,\n CertificateOperation as CoreCertificateOperation,\n Contacts as CoreContacts,\n JsonWebKeyType as CertificateKeyType,\n ErrorModel,\n} from \"./generated/src/models/index.js\";\nimport { parseKeyVaultCertificateIdentifier } from \"./identifier.js\";\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nexport function toCoreAttributes(properties: CertificateProperties): CertificateAttributes {\n return {\n recoveryLevel: properties.recoveryLevel,\n enabled: properties.enabled,\n notBefore: properties.notBefore,\n expires: properties.expiresOn,\n created: properties.createdOn,\n updated: properties.updatedOn,\n };\n}\n\nexport function toCorePolicy(\n id: string | undefined,\n policy: CertificatePolicy,\n attributes: CertificateAttributes = {},\n): CoreCertificatePolicy {\n let subjectAlternativeNames: CoreSubjectAlternativeNames = {};\n if (policy.subjectAlternativeNames) {\n subjectAlternativeNames = {\n emails: policy.subjectAlternativeNames.emails,\n dnsNames: policy.subjectAlternativeNames.dnsNames,\n upns: policy.subjectAlternativeNames.userPrincipalNames,\n };\n }\n\n return {\n id,\n lifetimeActions: policy.lifetimeActions\n ? policy.lifetimeActions.map((action) => ({\n action: { actionType: action.action },\n trigger: {\n lifetimePercentage: action.lifetimePercentage,\n daysBeforeExpiry: action.daysBeforeExpiry,\n },\n }))\n : undefined,\n keyProperties: {\n keyType: policy.keyType,\n keySize: policy.keySize,\n reuseKey: policy.reuseKey,\n curve: policy.keyCurveName,\n exportable: policy.exportable,\n },\n secretProperties: {\n contentType: policy.contentType,\n },\n x509CertificateProperties: {\n subject: policy.subject,\n ekus: policy.enhancedKeyUsage,\n subjectAlternativeNames,\n keyUsage: policy.keyUsage,\n validityInMonths: policy.validityInMonths,\n },\n issuerParameters: {\n name: policy.issuerName,\n certificateType: policy.certificateType,\n certificateTransparency: policy.certificateTransparency,\n },\n attributes,\n };\n}\n\nexport function toPublicPolicy(policy: CoreCertificatePolicy = {}): CertificatePolicy {\n let subjectAlternativeNames: SubjectAlternativeNames | undefined;\n const x509Properties: X509CertificateProperties = policy.x509CertificateProperties || {};\n\n if (policy.x509CertificateProperties) {\n if (x509Properties.subjectAlternativeNames) {\n const names = x509Properties.subjectAlternativeNames;\n if (names.emails && names.emails.length) {\n subjectAlternativeNames = {\n ...subjectAlternativeNames,\n emails: names.emails as ArrayOneOrMore<string>,\n };\n }\n if (names.dnsNames && names.dnsNames.length) {\n subjectAlternativeNames = {\n ...subjectAlternativeNames,\n dnsNames: names.dnsNames as ArrayOneOrMore<string>,\n };\n }\n if (names.upns && names.upns.length) {\n subjectAlternativeNames = {\n ...subjectAlternativeNames,\n userPrincipalNames: names.upns as ArrayOneOrMore<string>,\n };\n }\n }\n }\n\n const certificatePolicy: CertificatePolicy = {\n lifetimeActions: policy.lifetimeActions\n ? policy.lifetimeActions.map((action) => ({\n action: action.action ? action.action.actionType : undefined,\n daysBeforeExpiry: action.trigger ? action.trigger.daysBeforeExpiry : undefined,\n lifetimePercentage: action.trigger ? action.trigger.lifetimePercentage : undefined,\n }))\n : undefined,\n contentType: policy.secretProperties\n ? (policy.secretProperties.contentType as CertificateContentType)\n : undefined,\n enhancedKeyUsage: x509Properties.ekus,\n keyUsage: x509Properties.keyUsage,\n validityInMonths: x509Properties.validityInMonths,\n subject: x509Properties.subject,\n subjectAlternativeNames: subjectAlternativeNames!,\n };\n\n if (policy.attributes) {\n certificatePolicy.enabled = policy.attributes.enabled;\n }\n\n if (policy.keyProperties) {\n certificatePolicy.keyType = policy.keyProperties.keyType as CertificateKeyType;\n certificatePolicy.keySize = policy.keyProperties.keySize;\n certificatePolicy.reuseKey = policy.keyProperties.reuseKey;\n certificatePolicy.keyCurveName = policy.keyProperties.curve;\n certificatePolicy.exportable = policy.keyProperties.exportable;\n }\n\n if (policy.issuerParameters) {\n certificatePolicy.issuerName = policy.issuerParameters && policy.issuerParameters.name;\n certificatePolicy.certificateType = policy.issuerParameters\n .certificateType as CertificateContentType;\n certificatePolicy.certificateTransparency = policy.issuerParameters.certificateTransparency;\n }\n\n return certificatePolicy;\n}\n\nexport function toPublicIssuer(issuer: IssuerBundle = {}): CertificateIssuer {\n const parsedId = parseKeyVaultCertificateIdentifier(issuer.id!);\n const attributes: IssuerAttributes = issuer.attributes || {};\n\n const publicIssuer: CertificateIssuer = {\n id: issuer.id,\n name: parsedId.name,\n provider: issuer.provider,\n accountId: issuer.credentials && issuer.credentials.accountId,\n password: issuer.credentials && issuer.credentials.password,\n enabled: attributes.enabled,\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n };\n\n if (issuer.organizationDetails) {\n publicIssuer.organizationId = issuer.organizationDetails.id;\n publicIssuer.administratorContacts = issuer.organizationDetails.adminDetails\n ? issuer.organizationDetails.adminDetails.map((x) => ({\n email: x.emailAddress,\n phone: x.phone,\n firstName: x.firstName,\n lastName: x.lastName,\n }))\n : undefined;\n }\n return publicIssuer;\n}\n\nexport function getCertificateFromCertificateBundle(\n certificateBundle: CertificateBundle,\n): KeyVaultCertificate {\n const parsedId = parseKeyVaultCertificateIdentifier(certificateBundle.id!);\n\n const attributes: CertificateAttributes = certificateBundle.attributes || {};\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n id: certificateBundle.id,\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n recoveryLevel: attributes.recoveryLevel,\n name: parsedId.name,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n tags: certificateBundle.tags,\n x509Thumbprint: certificateBundle.x509Thumbprint,\n x509ThumbprintString:\n certificateBundle.x509Thumbprint &&\n uint8ArrayToString(certificateBundle.x509Thumbprint, \"hex\"),\n recoverableDays: attributes.recoverableDays,\n preserveCertificateOrder: certificateBundle.preserveCertOrder,\n };\n\n return {\n keyId: certificateBundle.kid,\n secretId: certificateBundle.sid,\n name: parsedId.name,\n cer: certificateBundle.cer,\n properties: abstractProperties,\n };\n}\n\nexport function getCertificateWithPolicyFromCertificateBundle(\n certificateBundle: CertificateBundle,\n): KeyVaultCertificateWithPolicy {\n const parsedId = parseKeyVaultCertificateIdentifier(certificateBundle.id!);\n\n const attributes: CertificateAttributes = certificateBundle.attributes || {};\n const policy = toPublicPolicy(certificateBundle.policy || {});\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n id: certificateBundle.id,\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n recoveryLevel: attributes.recoveryLevel,\n name: parsedId.name,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n tags: certificateBundle.tags,\n x509Thumbprint: certificateBundle.x509Thumbprint,\n x509ThumbprintString:\n certificateBundle.x509Thumbprint &&\n uint8ArrayToString(certificateBundle.x509Thumbprint, \"hex\"),\n recoverableDays: attributes.recoverableDays,\n preserveCertificateOrder: certificateBundle.preserveCertOrder,\n };\n\n return {\n keyId: certificateBundle.kid,\n secretId: certificateBundle.sid,\n name: parsedId.name,\n cer: certificateBundle.cer,\n policy,\n properties: abstractProperties,\n };\n}\n\nexport function getDeletedCertificateFromDeletedCertificateBundle(\n certificateBundle: DeletedCertificateBundle,\n): DeletedCertificate {\n const certificate: KeyVaultCertificateWithPolicy =\n getCertificateWithPolicyFromCertificateBundle(certificateBundle);\n\n return {\n policy: certificate.policy,\n cer: certificate.cer,\n id: certificate.id,\n keyId: certificate.keyId,\n secretId: certificate.secretId,\n name: certificate.name,\n properties: certificate.properties,\n recoveryId: certificateBundle.recoveryId,\n scheduledPurgeDate: certificateBundle.scheduledPurgeDate,\n deletedOn: certificateBundle.deletedDate,\n };\n}\n\nexport function getDeletedCertificateFromItem(item: DeletedCertificateItem): DeletedCertificate {\n const parsedId = parseKeyVaultCertificateIdentifier(item.id!);\n\n const attributes: any = item.attributes || {};\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n name: parsedId.name,\n\n id: item.id,\n tags: item.tags,\n x509Thumbprint: item.x509Thumbprint,\n x509ThumbprintString: item.x509Thumbprint && uint8ArrayToString(item.x509Thumbprint, \"hex\"),\n recoverableDays: item.attributes?.recoverableDays,\n recoveryLevel: item.attributes?.recoveryLevel,\n };\n\n return {\n deletedOn: item.deletedDate,\n recoveryId: item.recoveryId,\n scheduledPurgeDate: item.scheduledPurgeDate,\n name: parsedId.name,\n properties: abstractProperties,\n };\n}\n\nfunction getCertificateOperationErrorFromErrorModel(\n error?: ErrorModel | null,\n): CertificateOperationError | undefined {\n if (error) {\n return {\n code: error.code,\n innerError: getCertificateOperationErrorFromErrorModel(error.innerError),\n message: error.message,\n };\n }\n return undefined;\n}\n\nexport function getCertificateOperationFromCoreOperation(\n certificateName: string,\n operation: CoreCertificateOperation,\n): CertificateOperation {\n return {\n cancellationRequested: operation.cancellationRequested,\n name: certificateName,\n issuerName: operation.issuerParameters ? operation.issuerParameters.name : undefined,\n certificateTransparency: operation.issuerParameters\n ? operation.issuerParameters.certificateTransparency\n : undefined,\n certificateType: operation.issuerParameters\n ? operation.issuerParameters.certificateType\n : undefined,\n csr: operation.csr,\n error: getCertificateOperationErrorFromErrorModel(operation.error),\n id: operation.id,\n requestId: operation.requestId,\n status: operation.status,\n statusDetails: operation.statusDetails,\n target: operation.target,\n };\n}\n\nexport function coreContactsToCertificateContacts(contacts: CoreContacts): CertificateContact[] {\n return contacts.contactList\n ? contacts.contactList.map(\n (x) => ({ email: x.emailAddress, phone: x.phone, name: x.name }) as CertificateContact,\n )\n : [];\n}\n\nexport function getPropertiesFromCertificateBundle(\n certificateBundle: CertificateBundle,\n): CertificateProperties {\n const parsedId = parseKeyVaultCertificateIdentifier(certificateBundle.id!);\n const attributes: CertificateAttributes = certificateBundle.attributes || {};\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n id: certificateBundle.id,\n name: parsedId.name,\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n recoveryLevel: attributes.recoveryLevel,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n tags: certificateBundle.tags,\n x509Thumbprint: certificateBundle.x509Thumbprint,\n x509ThumbprintString:\n certificateBundle.x509Thumbprint &&\n uint8ArrayToString(certificateBundle.x509Thumbprint, \"hex\"),\n recoverableDays: attributes.recoverableDays,\n preserveCertificateOrder: certificateBundle.preserveCertOrder,\n };\n\n return abstractProperties;\n}\n\nexport function mapPagedAsyncIterable<T, U>(\n iter: PagedAsyncIterableIterator<T>,\n mapper: (x: T) => U,\n): PagedAsyncIterableIterator<U> {\n return {\n async next() {\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(settings) {\n const iteratorByPage = iter.byPage(settings);\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;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA8BtD,OAAO,EAAE,kCAAkC,EAAE,MAAM,iBAAiB,CAAC;AAGrE,MAAM,UAAU,gBAAgB,CAAC,UAAiC;IAChE,OAAO;QACL,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,OAAO,EAAE,UAAU,CAAC,SAAS;QAC7B,OAAO,EAAE,UAAU,CAAC,SAAS;QAC7B,OAAO,EAAE,UAAU,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,EAAsB,EACtB,MAAyB,EACzB,aAAoC,EAAE;IAEtC,IAAI,uBAAuB,GAAgC,EAAE,CAAC;IAC9D,IAAI,MAAM,CAAC,uBAAuB,EAAE,CAAC;QACnC,uBAAuB,GAAG;YACxB,MAAM,EAAE,MAAM,CAAC,uBAAuB,CAAC,MAAM;YAC7C,QAAQ,EAAE,MAAM,CAAC,uBAAuB,CAAC,QAAQ;YACjD,IAAI,EAAE,MAAM,CAAC,uBAAuB,CAAC,kBAAkB;SACxD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE;QACF,eAAe,EAAE,MAAM,CAAC,eAAe;YACrC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACtC,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;gBACrC,OAAO,EAAE;oBACP,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;oBAC7C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;iBAC1C;aACF,CAA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C,OAAO;QAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,IAAI,EAAE,iBAAiB,CAAC,IAAI;QAC5B,cAAc,EAAE,iBAAiB,CAAC,cAAc;QAChD,oBAAoB,EAClB,iBAAiB,CAAC,cAAc;YAChC,kBAAkB,CAAC,iBAAiB,CAAC,cAAc,EAAE,KAAK,CAAC;QAC7D,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,wBAAwB,EAAE,iBAAiB,CAAC,iBAAiB;KAC9D,CAAC;IAEF,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,IAAmC,EACnC,MAAmB;IAEnB,OAAO;QACL,KAAK,CAAC,IAAI;YACR,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAEjC,OAAO;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,CAAC,QAAQ;YACpB,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7C,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 { uint8ArrayToString } from \"@azure/core-util\";\nimport type {\n ArrayOneOrMore,\n CertificateContentType,\n CertificateOperation,\n CertificateIssuer,\n CertificatePolicy,\n CertificateProperties,\n DeletedCertificate,\n KeyVaultCertificate,\n KeyVaultCertificateWithPolicy,\n SubjectAlternativeNames,\n CertificateContact,\n CertificateOperationError,\n} from \"./certificatesModels.js\";\nimport type {\n CertificateAttributes,\n CertificateBundle,\n CertificatePolicy as CoreCertificatePolicy,\n DeletedCertificateBundle,\n DeletedCertificateItem,\n IssuerAttributes,\n IssuerBundle,\n SubjectAlternativeNames as CoreSubjectAlternativeNames,\n X509CertificateProperties,\n CertificateOperation as CoreCertificateOperation,\n Contacts as CoreContacts,\n JsonWebKeyType as CertificateKeyType,\n ErrorModel,\n} from \"./generated/src/models/index.js\";\nimport { parseKeyVaultCertificateIdentifier } from \"./identifier.js\";\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\nexport function toCoreAttributes(properties: CertificateProperties): CertificateAttributes {\n return {\n recoveryLevel: properties.recoveryLevel,\n enabled: properties.enabled,\n notBefore: properties.notBefore,\n expires: properties.expiresOn,\n created: properties.createdOn,\n updated: properties.updatedOn,\n };\n}\n\nexport function toCorePolicy(\n id: string | undefined,\n policy: CertificatePolicy,\n attributes: CertificateAttributes = {},\n): CoreCertificatePolicy {\n let subjectAlternativeNames: CoreSubjectAlternativeNames = {};\n if (policy.subjectAlternativeNames) {\n subjectAlternativeNames = {\n emails: policy.subjectAlternativeNames.emails,\n dnsNames: policy.subjectAlternativeNames.dnsNames,\n upns: policy.subjectAlternativeNames.userPrincipalNames,\n };\n }\n\n return {\n id,\n lifetimeActions: policy.lifetimeActions\n ? policy.lifetimeActions.map((action) => ({\n action: { actionType: action.action },\n trigger: {\n lifetimePercentage: action.lifetimePercentage,\n daysBeforeExpiry: action.daysBeforeExpiry,\n },\n }))\n : undefined,\n keyProperties: {\n keyType: policy.keyType,\n keySize: policy.keySize,\n reuseKey: policy.reuseKey,\n curve: policy.keyCurveName,\n exportable: policy.exportable,\n },\n secretProperties: {\n contentType: policy.contentType,\n },\n x509CertificateProperties: {\n subject: policy.subject,\n ekus: policy.enhancedKeyUsage,\n subjectAlternativeNames,\n keyUsage: policy.keyUsage,\n validityInMonths: policy.validityInMonths,\n },\n issuerParameters: {\n name: policy.issuerName,\n certificateType: policy.certificateType,\n certificateTransparency: policy.certificateTransparency,\n },\n attributes,\n };\n}\n\nexport function toPublicPolicy(policy: CoreCertificatePolicy = {}): CertificatePolicy {\n let subjectAlternativeNames: SubjectAlternativeNames | undefined;\n const x509Properties: X509CertificateProperties = policy.x509CertificateProperties || {};\n\n if (policy.x509CertificateProperties) {\n if (x509Properties.subjectAlternativeNames) {\n const names = x509Properties.subjectAlternativeNames;\n if (names.emails && names.emails.length) {\n subjectAlternativeNames = {\n ...subjectAlternativeNames,\n emails: names.emails as ArrayOneOrMore<string>,\n };\n }\n if (names.dnsNames && names.dnsNames.length) {\n subjectAlternativeNames = {\n ...subjectAlternativeNames,\n dnsNames: names.dnsNames as ArrayOneOrMore<string>,\n };\n }\n if (names.upns && names.upns.length) {\n subjectAlternativeNames = {\n ...subjectAlternativeNames,\n userPrincipalNames: names.upns as ArrayOneOrMore<string>,\n };\n }\n }\n }\n\n const certificatePolicy: CertificatePolicy = {\n lifetimeActions: policy.lifetimeActions\n ? policy.lifetimeActions.map((action) => ({\n action: action.action ? action.action.actionType : undefined,\n daysBeforeExpiry: action.trigger ? action.trigger.daysBeforeExpiry : undefined,\n lifetimePercentage: action.trigger ? action.trigger.lifetimePercentage : undefined,\n }))\n : undefined,\n contentType: policy.secretProperties\n ? (policy.secretProperties.contentType as CertificateContentType)\n : undefined,\n enhancedKeyUsage: x509Properties.ekus,\n keyUsage: x509Properties.keyUsage,\n validityInMonths: x509Properties.validityInMonths,\n subject: x509Properties.subject,\n subjectAlternativeNames: subjectAlternativeNames!,\n };\n\n if (policy.attributes) {\n certificatePolicy.enabled = policy.attributes.enabled;\n }\n\n if (policy.keyProperties) {\n certificatePolicy.keyType = policy.keyProperties.keyType as CertificateKeyType;\n certificatePolicy.keySize = policy.keyProperties.keySize;\n certificatePolicy.reuseKey = policy.keyProperties.reuseKey;\n certificatePolicy.keyCurveName = policy.keyProperties.curve;\n certificatePolicy.exportable = policy.keyProperties.exportable;\n }\n\n if (policy.issuerParameters) {\n certificatePolicy.issuerName = policy.issuerParameters && policy.issuerParameters.name;\n certificatePolicy.certificateType = policy.issuerParameters\n .certificateType as CertificateContentType;\n certificatePolicy.certificateTransparency = policy.issuerParameters.certificateTransparency;\n }\n\n return certificatePolicy;\n}\n\nexport function toPublicIssuer(issuer: IssuerBundle = {}): CertificateIssuer {\n const parsedId = parseKeyVaultCertificateIdentifier(issuer.id!);\n const attributes: IssuerAttributes = issuer.attributes || {};\n\n const publicIssuer: CertificateIssuer = {\n id: issuer.id,\n name: parsedId.name,\n provider: issuer.provider,\n accountId: issuer.credentials && issuer.credentials.accountId,\n password: issuer.credentials && issuer.credentials.password,\n enabled: attributes.enabled,\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n };\n\n if (issuer.organizationDetails) {\n publicIssuer.organizationId = issuer.organizationDetails.id;\n publicIssuer.administratorContacts = issuer.organizationDetails.adminDetails\n ? issuer.organizationDetails.adminDetails.map((x) => ({\n email: x.emailAddress,\n phone: x.phone,\n firstName: x.firstName,\n lastName: x.lastName,\n }))\n : undefined;\n }\n return publicIssuer;\n}\n\nexport function getCertificateFromCertificateBundle(\n certificateBundle: CertificateBundle,\n): KeyVaultCertificate {\n const parsedId = parseKeyVaultCertificateIdentifier(certificateBundle.id!);\n\n const attributes: CertificateAttributes = certificateBundle.attributes || {};\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n id: certificateBundle.id,\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n recoveryLevel: attributes.recoveryLevel,\n name: parsedId.name,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n tags: certificateBundle.tags,\n x509Thumbprint: certificateBundle.x509Thumbprint,\n x509ThumbprintString:\n certificateBundle.x509Thumbprint &&\n uint8ArrayToString(certificateBundle.x509Thumbprint, \"hex\"),\n recoverableDays: attributes.recoverableDays,\n preserveCertificateOrder: certificateBundle.preserveCertOrder,\n };\n\n return {\n keyId: certificateBundle.kid,\n secretId: certificateBundle.sid,\n name: parsedId.name,\n cer: certificateBundle.cer,\n properties: abstractProperties,\n };\n}\n\nexport function getCertificateWithPolicyFromCertificateBundle(\n certificateBundle: CertificateBundle,\n): KeyVaultCertificateWithPolicy {\n const parsedId = parseKeyVaultCertificateIdentifier(certificateBundle.id!);\n\n const attributes: CertificateAttributes = certificateBundle.attributes || {};\n const policy = toPublicPolicy(certificateBundle.policy || {});\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n id: certificateBundle.id,\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n recoveryLevel: attributes.recoveryLevel,\n name: parsedId.name,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n tags: certificateBundle.tags,\n x509Thumbprint: certificateBundle.x509Thumbprint,\n x509ThumbprintString:\n certificateBundle.x509Thumbprint &&\n uint8ArrayToString(certificateBundle.x509Thumbprint, \"hex\"),\n recoverableDays: attributes.recoverableDays,\n preserveCertificateOrder: certificateBundle.preserveCertOrder,\n };\n\n return {\n keyId: certificateBundle.kid,\n secretId: certificateBundle.sid,\n name: parsedId.name,\n cer: certificateBundle.cer,\n policy,\n properties: abstractProperties,\n };\n}\n\nexport function getDeletedCertificateFromDeletedCertificateBundle(\n certificateBundle: DeletedCertificateBundle,\n): DeletedCertificate {\n const certificate: KeyVaultCertificateWithPolicy =\n getCertificateWithPolicyFromCertificateBundle(certificateBundle);\n\n return {\n policy: certificate.policy,\n cer: certificate.cer,\n id: certificate.id,\n keyId: certificate.keyId,\n secretId: certificate.secretId,\n name: certificate.name,\n properties: certificate.properties,\n recoveryId: certificateBundle.recoveryId,\n scheduledPurgeDate: certificateBundle.scheduledPurgeDate,\n deletedOn: certificateBundle.deletedDate,\n };\n}\n\nexport function getDeletedCertificateFromItem(item: DeletedCertificateItem): DeletedCertificate {\n const parsedId = parseKeyVaultCertificateIdentifier(item.id!);\n\n const attributes: any = item.attributes || {};\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n name: parsedId.name,\n\n id: item.id,\n tags: item.tags,\n x509Thumbprint: item.x509Thumbprint,\n x509ThumbprintString: item.x509Thumbprint && uint8ArrayToString(item.x509Thumbprint, \"hex\"),\n recoverableDays: item.attributes?.recoverableDays,\n recoveryLevel: item.attributes?.recoveryLevel,\n };\n\n return {\n deletedOn: item.deletedDate,\n recoveryId: item.recoveryId,\n scheduledPurgeDate: item.scheduledPurgeDate,\n name: parsedId.name,\n properties: abstractProperties,\n };\n}\n\nfunction getCertificateOperationErrorFromErrorModel(\n error?: ErrorModel | null,\n): CertificateOperationError | undefined {\n if (error) {\n return {\n code: error.code,\n innerError: getCertificateOperationErrorFromErrorModel(error.innerError),\n message: error.message,\n };\n }\n return undefined;\n}\n\nexport function getCertificateOperationFromCoreOperation(\n certificateName: string,\n operation: CoreCertificateOperation,\n): CertificateOperation {\n return {\n cancellationRequested: operation.cancellationRequested,\n name: certificateName,\n issuerName: operation.issuerParameters ? operation.issuerParameters.name : undefined,\n certificateTransparency: operation.issuerParameters\n ? operation.issuerParameters.certificateTransparency\n : undefined,\n certificateType: operation.issuerParameters\n ? operation.issuerParameters.certificateType\n : undefined,\n csr: operation.csr,\n error: getCertificateOperationErrorFromErrorModel(operation.error),\n id: operation.id,\n requestId: operation.requestId,\n status: operation.status,\n statusDetails: operation.statusDetails,\n target: operation.target,\n };\n}\n\nexport function coreContactsToCertificateContacts(contacts: CoreContacts): CertificateContact[] {\n return contacts.contactList\n ? contacts.contactList.map(\n (x) => ({ email: x.emailAddress, phone: x.phone, name: x.name }) as CertificateContact,\n )\n : [];\n}\n\nexport function getPropertiesFromCertificateBundle(\n certificateBundle: CertificateBundle,\n): CertificateProperties {\n const parsedId = parseKeyVaultCertificateIdentifier(certificateBundle.id!);\n const attributes: CertificateAttributes = certificateBundle.attributes || {};\n\n const abstractProperties: CertificateProperties = {\n createdOn: attributes.created,\n updatedOn: attributes.updated,\n expiresOn: attributes.expires,\n id: certificateBundle.id,\n name: parsedId.name,\n enabled: attributes.enabled,\n notBefore: attributes.notBefore,\n recoveryLevel: attributes.recoveryLevel,\n vaultUrl: parsedId.vaultUrl,\n version: parsedId.version,\n tags: certificateBundle.tags,\n x509Thumbprint: certificateBundle.x509Thumbprint,\n x509ThumbprintString:\n certificateBundle.x509Thumbprint &&\n uint8ArrayToString(certificateBundle.x509Thumbprint, \"hex\"),\n recoverableDays: attributes.recoverableDays,\n preserveCertificateOrder: certificateBundle.preserveCertOrder,\n };\n\n return abstractProperties;\n}\n\nexport function mapPagedAsyncIterable<T, U>(\n iter: PagedAsyncIterableIterator<T>,\n mapper: (x: T) => U,\n): PagedAsyncIterableIterator<U> {\n return {\n async next() {\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(settings) {\n const iteratorByPage = iter.byPage(settings);\n for await (const page of iteratorByPage) {\n yield page.map(mapper);\n }\n },\n };\n}\n"]}
@@ -1,25 +1,28 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { __rest } from "tslib";
4
3
  import { logger } from "../logger.js";
5
4
  import { getClient } from "@azure-rest/core-client";
6
5
  /** The key vault client performs cryptographic key operations and vault operations against the Key Vault service. */
7
6
  export function createKeyVault(endpointParam, credential, options = {}) {
8
- var _a, _b, _c, _d, _e, _f, _g, _h;
9
- const endpointUrl = (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUrl) !== null && _b !== void 0 ? _b : String(endpointParam);
10
- const prefixFromOptions = (_c = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _c === void 0 ? void 0 : _c.userAgentPrefix;
7
+ const endpointUrl = options.endpoint ?? options.baseUrl ?? String(endpointParam);
8
+ const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
11
9
  const userAgentInfo = `azsdk-js-keyvault-certificates/1.0.0-beta.1`;
12
10
  const userAgentPrefix = prefixFromOptions
13
11
  ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
14
12
  : `azsdk-js-api ${userAgentInfo}`;
15
- const _j = Object.assign(Object.assign({}, options), { userAgentOptions: { userAgentPrefix }, loggingOptions: { logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info }, credentials: {
16
- scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : [
13
+ const { apiVersion: _, ...updatedOptions } = {
14
+ ...options,
15
+ userAgentOptions: { userAgentPrefix },
16
+ loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
17
+ credentials: {
18
+ scopes: options.credentials?.scopes ?? [
17
19
  "https://vault.azure.net/.default",
18
20
  ],
19
- } }), { apiVersion: _ } = _j, updatedOptions = __rest(_j, ["apiVersion"]);
21
+ },
22
+ };
20
23
  const clientContext = getClient(endpointUrl, credential, updatedOptions);
21
24
  clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
22
- const apiVersion = (_h = options.apiVersion) !== null && _h !== void 0 ? _h : "7.6";
25
+ const apiVersion = options.apiVersion ?? "7.6";
23
26
  clientContext.pipeline.addPolicy({
24
27
  name: "ClientApiVersionPolicy",
25
28
  sendRequest: (req, next) => {
@@ -32,6 +35,6 @@ export function createKeyVault(endpointParam, credential, options = {}) {
32
35
  return next(req);
33
36
  },
34
37
  });
35
- return Object.assign(Object.assign({}, clientContext), { apiVersion });
38
+ return { ...clientContext, apiVersion };
36
39
  }
37
40
  //# sourceMappingURL=keyVaultContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyVaultContext.js","sourceRoot":"","sources":["../../../../../src/generated/src/api/keyVaultContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAiB3E,qHAAqH;AACrH,MAAM,UAAU,cAAc,CAC5B,aAAqB,EACrB,UAA2B,EAC3B,UAAwC,EAAE;;IAE1C,MAAM,WAAW,GACf,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,MAAM,CAAC,aAAa,CAAC,CAAC;IAC/D,MAAM,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,0CAAE,eAAe,CAAC;IACrE,MAAM,aAAa,GAAG,6CAA6C,CAAC;IACpE,MAAM,eAAe,GAAG,iBAAiB;QACvC,CAAC,CAAC,GAAG,iBAAiB,iBAAiB,aAAa,EAAE;QACtD,CAAC,CAAC,gBAAgB,aAAa,EAAE,CAAC;IACpC,MAAM,qCACD,OAAO,KACV,gBAAgB,EAAE,EAAE,eAAe,EAAE,EACrC,cAAc,EAAE,EAAE,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI,EAAE,EACzE,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI;gBACrC,kCAAkC;aACnC;SACF,GACF,EATK,EAAE,UAAU,EAAE,CAAC,OASpB,EATyB,cAAc,cAAlC,cAAoC,CASzC,CAAC;IACF,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IACzE,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,KAAK,CAAC;IAC/C,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC/B,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,gCAAK,aAAa,KAAE,UAAU,GAAqB,CAAC;AAC7D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\n/** The key vault client performs cryptographic key operations and vault operations against the Key Vault service. */\nexport interface KeyVaultContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface KeyVaultClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\n/** The key vault client performs cryptographic key operations and vault operations against the Key Vault service. */\nexport function createKeyVault(\n endpointParam: string,\n credential: TokenCredential,\n options: KeyVaultClientOptionalParams = {},\n): KeyVaultContext {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? String(endpointParam);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-keyvault-certificates/1.0.0-beta.1`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://vault.azure.net/.default\",\n ],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"7.6\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as KeyVaultContext;\n}\n"]}
1
+ {"version":3,"file":"keyVaultContext.js","sourceRoot":"","sources":["../../../../../src/generated/src/api/keyVaultContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAiB3E,qHAAqH;AACrH,MAAM,UAAU,cAAc,CAC5B,aAAqB,EACrB,UAA2B,EAC3B,UAAwC,EAAE;IAE1C,MAAM,WAAW,GACf,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,MA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IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,aAAa,EAAE,UAAU,EAAqB,CAAC;AAC7D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\n/** The key vault client performs cryptographic key operations and vault operations against the Key Vault service. */\nexport interface KeyVaultContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface KeyVaultClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\n/** The key vault client performs cryptographic key operations and vault operations against the Key Vault service. */\nexport function createKeyVault(\n endpointParam: string,\n credential: TokenCredential,\n options: KeyVaultClientOptionalParams = {},\n): KeyVaultContext {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? String(endpointParam);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-keyvault-certificates/1.0.0-beta.1`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://vault.azure.net/.default\",\n ],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"7.6\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as KeyVaultContext;\n}\n"]}