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

Clean up Cosmos DB types #127

Merged
merged 1 commit into from
Sep 8, 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
6 changes: 0 additions & 6 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ export function cosmosDB(name: string, options: CosmosDBFunctionOptions): void {
createLeaseCollectionIfNotExists: options.createLeaseCollectionIfNotExists,
databaseName: options.databaseName,
feedPollDelay: options.feedPollDelay,
id: options.id,
leaseAcquireInterval: options.leaseAcquireInterval,
leaseCollectionName: options.leaseCollectionName,
leaseCollectionPrefix: options.leaseCollectionPrefix,
Expand All @@ -195,9 +194,7 @@ export function cosmosDB(name: string, options: CosmosDBFunctionOptions): void {
leaseExpirationInterval: options.leaseExpirationInterval,
leaseRenewInterval: options.leaseRenewInterval,
maxItemsPerInvocation: options.maxItemsPerInvocation,
partitionKey: options.partitionKey,
preferredLocations: options.preferredLocations,
sqlQuery: options.sqlQuery,
startFromBeginning: options.startFromBeginning,
useMultipleWriteLocations: options.useMultipleWriteLocations,
});
Expand All @@ -208,7 +205,6 @@ export function cosmosDB(name: string, options: CosmosDBFunctionOptions): void {
createLeaseContainerIfNotExists: options.createLeaseContainerIfNotExists,
databaseName: options.databaseName,
feedPollDelay: options.feedPollDelay,
id: options.id,
leaseAcquireInterval: options.leaseAcquireInterval,
leaseConnection: options.leaseConnection,
leaseContainerName: options.leaseContainerName,
Expand All @@ -218,9 +214,7 @@ export function cosmosDB(name: string, options: CosmosDBFunctionOptions): void {
leaseRenewInterval: options.leaseRenewInterval,
leasesContainerThroughput: options.leasesContainerThroughput,
maxItemsPerInvocation: options.maxItemsPerInvocation,
partitionKey: options.partitionKey,
preferredLocations: options.preferredLocations,
sqlQuery: options.sqlQuery,
startFromBeginning: options.startFromBeginning,
startFromTime: options.startFromTime,
});
Expand Down
8 changes: 4 additions & 4 deletions types/InvocationContext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export interface InvocationContextExtraInputs {
* Get a secondary Cosmos DB documents input for this invocation
* @input the configuration object for this Cosmos DB input
*/
get(input: CosmosDBInput): unknown[];
get(input: CosmosDBInput): unknown;

/**
* Get a secondary generic input for this invocation
Expand Down Expand Up @@ -156,9 +156,9 @@ export interface InvocationContextExtraOutputs {
/**
* Set a secondary Cosmos DB documents output for this invocation
* @output the configuration object for this Cosmos DB output
* @documents the output documents value
* @documents the output document(s) value
*/
set(output: CosmosDBOutput, documents: unknown[]): void;
set(output: CosmosDBOutput, documents: unknown): void;

/**
* Set a secondary Service Bus queue output for this invocation
Expand All @@ -177,7 +177,7 @@ export interface InvocationContextExtraOutputs {
/**
* Set a secondary Event Hub output for this invocation
* @output the configuration object for this EventHub output
* @message the output messages value
* @message the output message(s) value
*/
set(output: EventHubOutput, messages: unknown): void;

Expand Down
23 changes: 22 additions & 1 deletion types/cosmosDB.v3.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,22 @@ export interface CosmosDBv3InputOptions {
}
export type CosmosDBv3Input = FunctionInput & CosmosDBv3InputOptions;

export interface CosmosDBv3TriggerOptions extends CosmosDBv3InputOptions {
export interface CosmosDBv3TriggerOptions {
/**
* An app setting (or environment variable) with the Cosmos DB connection string
*/
connectionStringSetting: string;

/**
* The name of the Azure Cosmos DB database with the collection being monitored
*/
databaseName: string;

/**
* The name of the collection being monitored
*/
collectionName: string;

/**
* The name of an app setting that contains the connection string to the service which holds the lease collection.
* If not set it will connect to the service defined by `connectionStringSetting`
Expand Down Expand Up @@ -136,6 +151,12 @@ export interface CosmosDBv3TriggerOptions extends CosmosDBv3InputOptions {
*/
startFromBeginning?: boolean;

/**
* Defines preferred locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service.
* Values should be comma-separated. For example, East US,South Central US,North Europe
*/
preferredLocations?: string;

/**
* Enables multi-region accounts for writing to the leases collection.
*/
Expand Down
23 changes: 22 additions & 1 deletion types/cosmosDB.v4.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,22 @@ export interface CosmosDBv4InputOptions {
}
export type CosmosDBv4Input = FunctionInput & CosmosDBv4InputOptions;

export interface CosmosDBv4TriggerOptions extends CosmosDBv4InputOptions {
export interface CosmosDBv4TriggerOptions {
/**
* An app setting (or environment variable) with the Cosmos DB connection string
*/
connection: string;

/**
* The name of the Azure Cosmos DB database with the container being monitored
*/
databaseName: string;

/**
* The name of the container being monitored
*/
containerName: string;

/**
* The name of an app setting that contains the connection string to the service which holds the lease container.
* If not set it will connect to the service defined by `connection`
Expand Down Expand Up @@ -132,6 +147,12 @@ export interface CosmosDBv4TriggerOptions extends CosmosDBv4InputOptions {
* This is only used to set the initial trigger state. After the trigger has a lease state, changing this value has no effect.
*/
startFromTime?: string;

/**
* Defines preferred locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service.
* Values should be comma-separated. For example, East US,South Central US,North Europe
*/
preferredLocations?: string;
}
export type CosmosDBv4Trigger = FunctionTrigger & CosmosDBv4TriggerOptions;

Expand Down