@azure/cosmos
Version:
Microsoft Azure Cosmos DB Service Node.js SDK for NOSQL API
77 lines (76 loc) • 3.74 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 ChangeFeedStartFrom_exports = {};
__export(ChangeFeedStartFrom_exports, {
ChangeFeedStartFrom: () => ChangeFeedStartFrom
});
module.exports = __toCommonJS(ChangeFeedStartFrom_exports);
var import_ChangeFeedStartFromNow = require("./ChangeFeedStartFromNow.js");
var import_ChangeFeedStartFromBeginning = require("./ChangeFeedStartFromBeginning.js");
var import_ChangeFeedStartFromTime = require("./ChangeFeedStartFromTime.js");
var import_ChangeFeedStartFromContinuation = require("./ChangeFeedStartFromContinuation.js");
var import_ErrorResponse = require("../../request/ErrorResponse.js");
var import_changeFeedUtils = require("./changeFeedUtils.js");
class ChangeFeedStartFrom {
/**
* Returns an object that tells the ChangeFeedIterator to start from the beginning of time.
* @param cfResource - PartitionKey or FeedRange for which changes are to be fetched. Leave blank for fetching changes for entire container.
*/
static Beginning(cfResource) {
return new import_ChangeFeedStartFromBeginning.ChangeFeedStartFromBeginning(cfResource);
}
/**
* Returns an object that tells the ChangeFeedIterator to start reading changes from this moment onward.
* @param cfResource - PartitionKey or FeedRange for which changes are to be fetched. Leave blank for fetching changes for entire container.
**/
static Now(cfResource) {
return new import_ChangeFeedStartFromNow.ChangeFeedStartFromNow(cfResource);
}
/**
* Returns an object that tells the ChangeFeedIterator to start reading changes from some point in time onward.
* @param startTime - Date object specfiying the time to start reading changes from.
* @param cfResource - PartitionKey or FeedRange for which changes are to be fetched. Leave blank for fetching changes for entire container.
*/
static Time(startTime, cfResource) {
if (!startTime) {
throw new import_ErrorResponse.ErrorResponse("startTime must be present");
}
if (startTime instanceof Date === true) {
return new import_ChangeFeedStartFromTime.ChangeFeedStartFromTime(startTime, cfResource);
} else {
throw new import_ErrorResponse.ErrorResponse("startTime must be a Date object.");
}
}
/**
* Returns an object that tells the ChangeFeedIterator to start reading changes from a save point.
* @param continuation - The continuation to resume from.
*/
static Continuation(continuationToken) {
if (!continuationToken) {
throw new import_ErrorResponse.ErrorResponse("Argument continuation must be passed.");
}
if ((0, import_changeFeedUtils.isNullOrEmpty)(continuationToken)) {
throw new import_ErrorResponse.ErrorResponse("Argument continuationToken must be a non-empty string.");
}
return new import_ChangeFeedStartFromContinuation.ChangeFeedStartFromContinuation(continuationToken);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ChangeFeedStartFrom
});