Skip to content

Commit

Permalink
[Cosmos] Make changeFeed options optional. Fix Azure#6232
Browse files Browse the repository at this point in the history
  • Loading branch information
southpolesteve committed Nov 21, 2019
1 parent f8c7cc4 commit 3f65ba4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
28 changes: 14 additions & 14 deletions sdk/cosmosdb/cosmos/review/cosmos.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface ConflictDefinition {
operationType?: OperationType;
resourceId?: string;
// Warning: (ae-forgotten-export) The symbol "ResourceType" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
resourceType?: ResourceType;
}
Expand Down Expand Up @@ -261,7 +261,7 @@ export class Container {
// @deprecated
getPartitionKeyDefinition(): Promise<ResourceResponse<PartitionKeyDefinition>>;
// Warning: (ae-forgotten-export) The symbol "PartitionedQueryExecutionInfo" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
getQueryPlan(query: string | SqlQuerySpec): Promise<Response<PartitionedQueryExecutionInfo>>;
// (undocumented)
Expand Down Expand Up @@ -327,7 +327,7 @@ export interface CosmosClientOptions {
connectionPolicy?: ConnectionPolicy;
consistencyLevel?: keyof typeof ConsistencyLevel;
// Warning: (ae-forgotten-export) The symbol "CosmosHeaders" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
defaultHeaders?: CosmosHeaders_2;
endpoint: string;
Expand Down Expand Up @@ -432,7 +432,7 @@ export interface ErrorResponse extends Error {
// (undocumented)
activityId?: string;
// Warning: (ae-forgotten-export) The symbol "ErrorBody" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
body?: ErrorBody;
// (undocumented)
Expand All @@ -451,7 +451,7 @@ export interface ErrorResponse extends Error {
export function extractPartitionKey(document: any, partitionKeyDefinition: PartitionKeyDefinition): PartitionKey[];

// Warning: (ae-forgotten-export) The symbol "SharedOptions" needs to be exported by the entry point index.d.ts
//
//
// @public
export interface FeedOptions extends SharedOptions {
accessCondition?: {
Expand Down Expand Up @@ -561,9 +561,9 @@ export class ItemResponse<T extends ItemDefinition> extends ResourceResponse<T &
// @public
export class Items {
constructor(container: Container, clientContext: ClientContext);
changeFeed(partitionKey: string | number | boolean, changeFeedOptions: ChangeFeedOptions): ChangeFeedIterator<any>;
changeFeed(partitionKey: string | number | boolean, changeFeedOptions?: ChangeFeedOptions): ChangeFeedIterator<any>;
changeFeed(changeFeedOptions?: ChangeFeedOptions): ChangeFeedIterator<any>;
changeFeed<T>(partitionKey: string | number | boolean, changeFeedOptions: ChangeFeedOptions): ChangeFeedIterator<T>;
changeFeed<T>(partitionKey: string | number | boolean, changeFeedOptions?: ChangeFeedOptions): ChangeFeedIterator<T>;
changeFeed<T>(changeFeedOptions?: ChangeFeedOptions): ChangeFeedIterator<T>;
// (undocumented)
readonly container: Container;
Expand All @@ -574,7 +574,7 @@ export class Items {
readAll<T extends ItemDefinition>(options?: FeedOptions): QueryIterator<T>;
// Warning: (ae-forgotten-export) The symbol "ChangeFeedOptions" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ChangeFeedIterator" needs to be exported by the entry point index.d.ts
//
//
// @deprecated
readChangeFeed(partitionKey: string | number | boolean, changeFeedOptions: ChangeFeedOptions): ChangeFeedIterator<any>;
// @deprecated
Expand Down Expand Up @@ -724,7 +724,7 @@ export enum PermissionMode {
}

// Warning: (ae-forgotten-export) The symbol "PermissionBody" needs to be exported by the entry point index.d.ts
//
//
// @public (undocumented)
export class PermissionResponse extends ResourceResponse<PermissionDefinition & PermissionBody & Resource> {
constructor(resource: PermissionDefinition & PermissionBody & Resource, headers: CosmosHeaders, statusCode: number, permission: Permission);
Expand Down Expand Up @@ -883,17 +883,17 @@ export interface RequestContext {
// (undocumented)
endpoint?: string;
// Warning: (ae-forgotten-export) The symbol "GlobalEndpointManager" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
globalEndpointManager: GlobalEndpointManager;
// (undocumented)
headers?: CosmosHeaders_2;
// Warning: (ae-forgotten-export) The symbol "LocationRouting" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
locationRouting?: LocationRouting;
// Warning: (ae-forgotten-export) The symbol "HTTPMethod" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
method: HTTPMethod;
// (undocumented)
Expand Down Expand Up @@ -975,11 +975,11 @@ export class ResourceResponse<TResource> {
// (undocumented)
readonly resource: TResource;
// Warning: (ae-forgotten-export) The symbol "StatusCode" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
readonly statusCode: StatusCode;
// Warning: (ae-forgotten-export) The symbol "SubStatusCode" needs to be exported by the entry point index.d.ts
//
//
// (undocumented)
readonly substatus?: SubStatusCode;
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/cosmosdb/cosmos/src/client/Item/Items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class Items {
*/
public changeFeed(
partitionKey: string | number | boolean,
changeFeedOptions: ChangeFeedOptions
changeFeedOptions?: ChangeFeedOptions
): ChangeFeedIterator<any>;
/**
* Create a `ChangeFeedIterator` to iterate over pages of changes
Expand All @@ -185,7 +185,7 @@ export class Items {
*/
public changeFeed<T>(
partitionKey: string | number | boolean,
changeFeedOptions: ChangeFeedOptions
changeFeedOptions?: ChangeFeedOptions
): ChangeFeedIterator<T>;
/**
* Create a `ChangeFeedIterator` to iterate over pages of changes
Expand All @@ -209,7 +209,7 @@ export class Items {
}

if (!changeFeedOptions) {
throw new Error("changeFeedOptions must be a valid object");
changeFeedOptions = {};
}

const path = getPathFromLink(this.container.url, ResourceType.item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe("Change Feed Iterator", function() {
});

it("should fetch new items only", async function() {
const iterator = container.items.changeFeed("0", {});
const iterator = container.items.changeFeed("0");

const { result: items, headers } = await iterator.fetchNext();
assert(headers.etag, "change feed response should have etag header");
Expand Down

0 comments on commit 3f65ba4

Please sign in to comment.