@azure/app-configuration
Version:
An isomorphic client library for the Azure App Configuration service.
84 lines (83 loc) • 2.73 kB
JavaScript
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 lroShim_exports = {};
__export(lroShim_exports, {
wrapPoller: () => wrapPoller
});
module.exports = __toCommonJS(lroShim_exports);
async function wrapPoller(httpPoller) {
const abortController = new AbortController();
const simplePoller = {
isDone() {
return httpPoller.isDone;
},
isStopped() {
return abortController.signal.aborted;
},
getOperationState() {
if (!httpPoller.operationState) {
throw new Error(
"Operation state is not available. The poller may not have been started; await submitted() before calling getOperationState()."
);
}
return httpPoller.operationState;
},
getResult() {
return httpPoller.result;
},
toString() {
if (!httpPoller.operationState) {
throw new Error(
"Operation state is not available. The poller may not have been started; await submitted() before calling getOperationState()."
);
}
return JSON.stringify({
state: httpPoller.operationState
});
},
stopPolling() {
abortController.abort();
},
onProgress: httpPoller.onProgress,
async poll(options) {
await httpPoller.poll(options);
},
pollUntilDone(pollOptions) {
function abortListener() {
abortController.abort();
}
const inputAbortSignal = pollOptions?.abortSignal;
const abortSignal = abortController.signal;
if (inputAbortSignal?.aborted) {
abortController.abort();
} else if (!abortSignal.aborted) {
inputAbortSignal?.addEventListener("abort", abortListener, {
once: true
});
}
return httpPoller.pollUntilDone({ abortSignal: abortController.signal });
}
};
await httpPoller.submitted();
return simplePoller;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
wrapPoller
});
//# sourceMappingURL=lroShim.js.map