UNPKG

@azure/keyvault-certificates

Version:
92 lines (91 loc) 2.88 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var keyVaultCertificatePoller_exports = {}; __export(keyVaultCertificatePoller_exports, { KeyVaultCertificatePollOperation: () => KeyVaultCertificatePollOperation, KeyVaultCertificatePoller: () => KeyVaultCertificatePoller, cleanState: () => cleanState }); module.exports = __toCommonJS(keyVaultCertificatePoller_exports); var import_core_util = require("@azure/core-util"); var import_core_lro = require("@azure/core-lro"); function cleanState(state) { return { certificateName: state.certificateName, isStarted: state.isStarted, isCancelled: state.isCancelled, isCompleted: state.isCompleted, error: state.error, result: state.result }; } class KeyVaultCertificatePoller extends import_core_lro.Poller { /** * Defines how much time the poller is going to wait before making a new request to the service. */ intervalInMs = 2e3; /** * The method used by the poller to wait before attempting to update its operation. */ async delay() { return (0, import_core_util.delay)(this.intervalInMs); } /** * Gets the public state of the polling operation */ getOperationState() { return cleanState(this.operation.state); } } class KeyVaultCertificatePollOperation { constructor(state, options = {}) { this.state = state; if (options.cancelMessage) { this.cancelMessage = options.cancelMessage; } } state; cancelMessage = ""; /** * Meant to reach to the service and update the Poller operation. */ async update() { throw new Error("Operation not supported."); } /** * Meant to reach to the service and cancel the Poller operation. */ async cancel() { throw new Error(this.cancelMessage); } /** * Serializes the create certificate's poll operation */ toString() { return JSON.stringify({ state: cleanState(this.state) }); } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { KeyVaultCertificatePollOperation, KeyVaultCertificatePoller, cleanState }); //# sourceMappingURL=keyVaultCertificatePoller.js.map