Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change FeedRange interface to abstract class #27043

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sdk/cosmosdb/cosmos/review/cosmos.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -943,10 +943,10 @@ export interface FeedOptions extends SharedOptions {
useIncrementalFeed?: boolean;
}

// @public (undocumented)
export interface FeedRange {
maxExclusive: string;
minInclusive: string;
// @public
export abstract class FeedRange {
readonly maxExclusive: string;
readonly minInclusive: string;
}

// @public (undocumented)
Expand Down
36 changes: 22 additions & 14 deletions sdk/cosmosdb/cosmos/src/client/ChangeFeed/FeedRange.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { ErrorResponse } from "../../request";

/**
* @hidden
* Specifies a feed range for the changefeed.
*/
export class FeedRangeInternal implements FeedRange {
export abstract class FeedRange {
/**
* Min value for the feed range.
*/
minInclusive: string;
readonly minInclusive: string;
/**
* Max value for the feed range.
*/
maxExclusive: string;
readonly maxExclusive: string;
/**
* @internal
*/
protected constructor(minInclusive: string, maxExclusive: string) {
// only way to explictly block users from creating FeedRange directly in JS
if (new.target === FeedRange) {
throw new ErrorResponse("Cannot instantiate abstract class FeedRange");
}

constructor(minInclusive: string, maxExclusive: string) {
this.minInclusive = minInclusive;
this.maxExclusive = maxExclusive;
}
}

export interface FeedRange {
/**
* Min value for the feed range.
*/
minInclusive: string;
/**
* Max value for the feed range.
*/
maxExclusive: string;
/**
* @hidden
* Specifies a feed range for the changefeed.
*/
export class FeedRangeInternal extends FeedRange {
/* eslint-disable @typescript-eslint/no-useless-constructor */
constructor(minInclusive: string, maxExclusive: string) {
super(minInclusive, maxExclusive);
}
}