@azure/cosmos
Version:
Microsoft Azure Cosmos DB Service Node.js SDK for NOSQL API
59 lines (58 loc) • 2.15 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 FetchResult_exports = {};
__export(FetchResult_exports, {
FetchResult: () => FetchResult,
FetchResultType: () => FetchResultType
});
module.exports = __toCommonJS(FetchResult_exports);
var FetchResultType = /* @__PURE__ */ ((FetchResultType2) => {
FetchResultType2[FetchResultType2["Done"] = 0] = "Done";
FetchResultType2[FetchResultType2["Exception"] = 1] = "Exception";
FetchResultType2[FetchResultType2["Result"] = 2] = "Result";
return FetchResultType2;
})(FetchResultType || {});
class FetchResult {
feedResponse;
headers;
fetchResultType;
error;
/**
* Wraps fetch results for the document producer.
* This allows the document producer to buffer exceptions so that actual results don't get flushed during splits.
*
* @param feedReponse - The response the document producer got back on a successful fetch
* @param error - The exception meant to be buffered on an unsuccessful fetch
* @hidden
*/
constructor(feedResponse, error, headers) {
if (feedResponse !== void 0) {
this.feedResponse = feedResponse;
this.headers = headers;
this.fetchResultType = 2 /* Result */;
} else {
this.error = error;
this.fetchResultType = 1 /* Exception */;
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FetchResult,
FetchResultType
});