UNPKG

@azure/cosmos

Version:
52 lines (51 loc) 2.25 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 ChangeFeedStartFromContinuation_exports = {}; __export(ChangeFeedStartFromContinuation_exports, { ChangeFeedStartFromContinuation: () => ChangeFeedStartFromContinuation }); module.exports = __toCommonJS(ChangeFeedStartFromContinuation_exports); var import_request = require("../../request/index.js"); var import_ChangeFeedEnums = require("./ChangeFeedEnums.js"); class ChangeFeedStartFromContinuation { continuationToken; constructor(continuation) { this.continuationToken = continuation; } getCfResource() { return this.continuationToken; } getCfResourceJson() { return JSON.parse(this.continuationToken); } getResourceType() { const cToken = this.getCfResourceJson(); if (Object.prototype.hasOwnProperty.call(cToken, "partitionKey") && Object.prototype.hasOwnProperty.call(cToken, "Continuation") && typeof cToken.Continuation === "string") { return import_ChangeFeedEnums.ChangeFeedResourceType.PartitionKey; } else if (Object.prototype.hasOwnProperty.call(cToken, "Continuation") && Array.isArray(cToken.Continuation) && cToken.Continuation.length > 0) { return import_ChangeFeedEnums.ChangeFeedResourceType.FeedRange; } else { throw new import_request.ErrorResponse("Invalid continuation token."); } } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ChangeFeedStartFromContinuation }); //# sourceMappingURL=ChangeFeedStartFromContinuation.js.map