@vectorstores/azure 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.cjs +1656 -0
- package/dist/index.d.cts +585 -0
- package/dist/index.d.ts +585 -0
- package/dist/index.edge-light.d.ts +585 -0
- package/dist/index.edge-light.js +1636 -0
- package/dist/index.js +1636 -0
- package/dist/storage.cjs +458 -0
- package/dist/storage.d.cts +220 -0
- package/dist/storage.d.ts +220 -0
- package/dist/storage.edge-light.d.ts +220 -0
- package/dist/storage.edge-light.js +451 -0
- package/dist/storage.js +451 -0
- package/package.json +77 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { BaseKVStore, KVDocumentStore, KVIndexStore } from '@vectorstores/core';
|
|
2
|
+
import { MongoClient } from 'mongodb';
|
|
3
|
+
import { CosmosClient } from '@azure/cosmos';
|
|
4
|
+
import { TokenCredential } from '@azure/identity';
|
|
5
|
+
|
|
6
|
+
interface VcoreConnectionStringOptions extends AzureCosmosVCoreKVStoreConfig {
|
|
7
|
+
connectionString?: string;
|
|
8
|
+
}
|
|
9
|
+
interface AzureCosmosVCoreKVStoreConfig {
|
|
10
|
+
mongoClient?: MongoClient;
|
|
11
|
+
dbName?: string;
|
|
12
|
+
collectionName?: string;
|
|
13
|
+
}
|
|
14
|
+
declare class AzureCosmosVCoreKVStore extends BaseKVStore {
|
|
15
|
+
private mongoClient;
|
|
16
|
+
private dbName;
|
|
17
|
+
private collectionName;
|
|
18
|
+
private collection?;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new AzureCosmosDBNoSQLVectorStore instance.
|
|
21
|
+
*/
|
|
22
|
+
constructor({ mongoClient, dbName, collectionName, }: AzureCosmosVCoreKVStoreConfig);
|
|
23
|
+
client(): MongoClient;
|
|
24
|
+
private ensureCollection;
|
|
25
|
+
put(key: string, val: Record<string, any>): Promise<void>;
|
|
26
|
+
get(key: string): Promise<Record<string, any> | null>;
|
|
27
|
+
getAll(): Promise<Record<string, Record<string, any>>>;
|
|
28
|
+
delete(key: string): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface AzureCosmosVCoreDocumentStoreArgs {
|
|
32
|
+
azureCosmosVCoreKVStore: AzureCosmosVCoreKVStore;
|
|
33
|
+
namespace?: string;
|
|
34
|
+
}
|
|
35
|
+
declare class AzureCosmosVCoreDocumentStore extends KVDocumentStore {
|
|
36
|
+
constructor({ azureCosmosVCoreKVStore, namespace, }: AzureCosmosVCoreDocumentStoreArgs);
|
|
37
|
+
/**
|
|
38
|
+
* Static method for creating an instance using a MongoClient.
|
|
39
|
+
* @returns Instance of AzureCosmosVCoreDocumentStore
|
|
40
|
+
* @param mongoClient - MongoClient instance
|
|
41
|
+
* @param dbName - Database name
|
|
42
|
+
* @param collectionName - Collection name
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const mongoClient = new MongoClient("mongodb://localhost:27017");
|
|
46
|
+
* const indexStore = AzureCosmosVCoreDocumentStore.fromMongoClient(mongoClient, "my_db", "my_collection");
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
static fromMongoClient(mongoClient: MongoClient, dbName?: string, collectionName?: string): AzureCosmosVCoreDocumentStore;
|
|
50
|
+
/**
|
|
51
|
+
* Static method for creating an instance using a connection string.
|
|
52
|
+
* @returns Instance of AzureCosmosVCoreDocumentStore
|
|
53
|
+
* @param connectionString - MongoDB connection string
|
|
54
|
+
* @param dbName - Database name
|
|
55
|
+
* @param collectionName - Collection name
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const indexStore = AzureCosmosVCoreDocumentStore.fromConnectionString("mongodb://localhost:27017", "my_db", "my_collection");
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
static fromConnectionString(connectionString: string, dbName?: string, collectionName?: string): AzureCosmosVCoreDocumentStore;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface CosmosDatabaseProperties {
|
|
65
|
+
throughput?: number;
|
|
66
|
+
}
|
|
67
|
+
interface CosmosContainerProperties {
|
|
68
|
+
partitionKey: any;
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}
|
|
71
|
+
interface ConnectionStringOptions extends AzureCosmosNoSqlKVStoreConfig {
|
|
72
|
+
connectionString?: string;
|
|
73
|
+
}
|
|
74
|
+
interface AccountAndKeyOptions extends AzureCosmosNoSqlKVStoreConfig {
|
|
75
|
+
endpoint?: string;
|
|
76
|
+
key?: string;
|
|
77
|
+
}
|
|
78
|
+
interface AadTokenOptions extends AzureCosmosNoSqlKVStoreConfig {
|
|
79
|
+
endpoint?: string;
|
|
80
|
+
credential?: TokenCredential;
|
|
81
|
+
}
|
|
82
|
+
interface AzureCosmosNoSqlKVStoreConfig {
|
|
83
|
+
cosmosClient?: CosmosClient;
|
|
84
|
+
dbName?: string;
|
|
85
|
+
containerName?: string;
|
|
86
|
+
cosmosContainerProperties?: CosmosContainerProperties;
|
|
87
|
+
cosmosDatabaseProperties?: CosmosDatabaseProperties;
|
|
88
|
+
}
|
|
89
|
+
declare class AzureCosmosNoSqlKVStore extends BaseKVStore {
|
|
90
|
+
private cosmosClient;
|
|
91
|
+
private database;
|
|
92
|
+
private container;
|
|
93
|
+
private initPromise?;
|
|
94
|
+
private dbName;
|
|
95
|
+
private containerName;
|
|
96
|
+
private cosmosContainerProperties;
|
|
97
|
+
private cosmosDatabaseProperties;
|
|
98
|
+
private initialize;
|
|
99
|
+
constructor({ cosmosClient, dbName, containerName, cosmosContainerProperties, cosmosDatabaseProperties, }: AzureCosmosNoSqlKVStoreConfig);
|
|
100
|
+
client(): CosmosClient;
|
|
101
|
+
private init;
|
|
102
|
+
/**
|
|
103
|
+
* Static method for creating an instance using a connection string.
|
|
104
|
+
* If no connection string is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_CONNECTION_STRING` as connection string.
|
|
105
|
+
* @returns Instance of AzureCosmosNoSqlKVStore
|
|
106
|
+
*/
|
|
107
|
+
static fromConnectionString(config?: {
|
|
108
|
+
connectionString?: string;
|
|
109
|
+
} & AzureCosmosNoSqlKVStoreConfig): AzureCosmosNoSqlKVStore;
|
|
110
|
+
/**
|
|
111
|
+
* Static method for creating an instance using a account endpoint and key.
|
|
112
|
+
* If no endpoint and key is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as enpoint and `AZURE_COSMOSDB_NOSQL_ACCOUNT_KEY` as key.
|
|
113
|
+
* @returns Instance of AzureCosmosNoSqlKVStore
|
|
114
|
+
*/
|
|
115
|
+
static fromAccountAndKey(config?: {
|
|
116
|
+
endpoint?: string;
|
|
117
|
+
key?: string;
|
|
118
|
+
} & AzureCosmosNoSqlKVStoreConfig): AzureCosmosNoSqlKVStore;
|
|
119
|
+
/**
|
|
120
|
+
* Static method for creating an instance using AAD token.
|
|
121
|
+
* If no endpoint and credentials are provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as endpoint and use DefaultAzureCredential() as credentials.
|
|
122
|
+
* @returns Instance of AzureCosmosNoSqlKVStore
|
|
123
|
+
*/
|
|
124
|
+
static fromAadToken(config?: {
|
|
125
|
+
endpoint?: string;
|
|
126
|
+
credential?: TokenCredential;
|
|
127
|
+
} & AzureCosmosNoSqlKVStoreConfig): AzureCosmosNoSqlKVStore;
|
|
128
|
+
put(key: string, val: Record<string, any>): Promise<void>;
|
|
129
|
+
get(key: string): Promise<Record<string, any> | null>;
|
|
130
|
+
getAll(): Promise<Record<string, Record<string, any>>>;
|
|
131
|
+
delete(key: string): Promise<boolean>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface AzureCosmosNoSqlDocumentStoreArgs {
|
|
135
|
+
azureCosmosNoSqlKVStore: AzureCosmosNoSqlKVStore;
|
|
136
|
+
namespace?: string;
|
|
137
|
+
}
|
|
138
|
+
declare class AzureCosmosNoSqlDocumentStore extends KVDocumentStore {
|
|
139
|
+
constructor({ azureCosmosNoSqlKVStore, namespace, }: AzureCosmosNoSqlDocumentStoreArgs);
|
|
140
|
+
/**
|
|
141
|
+
* Static method for creating an instance using a connection string.
|
|
142
|
+
* If no connection string is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_CONNECTION_STRING` as connection string.
|
|
143
|
+
* @returns Instance of AzureCosmosNoSqlDocumentStore
|
|
144
|
+
*/
|
|
145
|
+
static fromConnectionString(options?: ConnectionStringOptions): AzureCosmosNoSqlDocumentStore;
|
|
146
|
+
/**
|
|
147
|
+
* Static method for creating an instance using a account endpoint and key.
|
|
148
|
+
* If no endpoint and key is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as enpoint and `AZURE_COSMOSDB_NOSQL_ACCOUNT_KEY` as key.
|
|
149
|
+
* @returns Instance of AzureCosmosNoSqlDocumentStore
|
|
150
|
+
*/
|
|
151
|
+
static fromAccountAndKey(options?: AccountAndKeyOptions): AzureCosmosNoSqlDocumentStore;
|
|
152
|
+
/**
|
|
153
|
+
* Static method for creating an instance using AAD token.
|
|
154
|
+
* If no endpoint and credentials are provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as endpoint and use DefaultAzureCredential() as credentials.
|
|
155
|
+
* @returns Instance of AzureCosmosNoSqlDocumentStore
|
|
156
|
+
*/
|
|
157
|
+
static fromAadToken(options?: AadTokenOptions): AzureCosmosNoSqlDocumentStore;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface AzureCosmosVCoreIndexStoreArgs {
|
|
161
|
+
azureCosmosVCoreKVStore: AzureCosmosVCoreKVStore;
|
|
162
|
+
namespace?: string;
|
|
163
|
+
}
|
|
164
|
+
declare class AzureCosmosVCoreIndexStore extends KVIndexStore {
|
|
165
|
+
constructor({ azureCosmosVCoreKVStore, namespace, }: AzureCosmosVCoreIndexStoreArgs);
|
|
166
|
+
/**
|
|
167
|
+
* Static method for creating an instance using a MongoClient.
|
|
168
|
+
* @returns Instance of AzureCosmosVCoreIndexStore
|
|
169
|
+
* @param mongoClient - MongoClient instance
|
|
170
|
+
* @param dbName - Database name
|
|
171
|
+
* @param collectionName - Collection name
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const mongoClient = new MongoClient("mongodb://localhost:27017");
|
|
175
|
+
* const indexStore = AzureCosmosVCoreIndexStore.fromMongoClient(mongoClient, "my_db", "my_collection");
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
static fromMongoClient(mongoClient: MongoClient, dbName?: string, collectionName?: string): AzureCosmosVCoreIndexStore;
|
|
179
|
+
/**
|
|
180
|
+
* Static method for creating an instance using a connection string.
|
|
181
|
+
* @returns Instance of AzureCosmosVCoreIndexStore
|
|
182
|
+
* @param connectionString - MongoDB connection string
|
|
183
|
+
* @param dbName - Database name
|
|
184
|
+
* @param collectionName - Collection name
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const indexStore = AzureCosmosVCoreIndexStore.fromConnectionString("mongodb://localhost:27017", "my_db", "my_collection");
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
static fromConnectionString(connectionString: string, dbName?: string, collectionName?: string): AzureCosmosVCoreIndexStore;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface AzureCosmosNoSqlIndexStoreArgs {
|
|
194
|
+
azureCosmosNoSqlKVStore: AzureCosmosNoSqlKVStore;
|
|
195
|
+
namespace?: string;
|
|
196
|
+
}
|
|
197
|
+
declare class AzureCosmosNoSqlIndexStore extends KVIndexStore {
|
|
198
|
+
constructor({ azureCosmosNoSqlKVStore, namespace, }: AzureCosmosNoSqlIndexStoreArgs);
|
|
199
|
+
/**
|
|
200
|
+
* Static method for creating an instance using a connection string.
|
|
201
|
+
* If no connection string is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_CONNECTION_STRING` as connection string.
|
|
202
|
+
* @returns Instance of AzureCosmosNoSqlIndexStore
|
|
203
|
+
*/
|
|
204
|
+
static fromConnectionString(options?: ConnectionStringOptions): AzureCosmosNoSqlIndexStore;
|
|
205
|
+
/**
|
|
206
|
+
* Static method for creating an instance using a account endpoint and key.
|
|
207
|
+
* If no endpoint and key is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as enpoint and `AZURE_COSMOSDB_NOSQL_ACCOUNT_KEY` as key.
|
|
208
|
+
* @returns Instance of AzureCosmosNoSqlIndexStore
|
|
209
|
+
*/
|
|
210
|
+
static fromAccountAndKey(options?: AccountAndKeyOptions): AzureCosmosNoSqlIndexStore;
|
|
211
|
+
/**
|
|
212
|
+
* Static method for creating an instance using AAD token.
|
|
213
|
+
* If no endpoint and credentials are provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as endpoint and use DefaultAzureCredential() as credentials.
|
|
214
|
+
* @returns Instance of AzureCosmosNoSqlIndexStore
|
|
215
|
+
*/
|
|
216
|
+
static fromAadToken(options?: AadTokenOptions): AzureCosmosNoSqlIndexStore;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export { AzureCosmosNoSqlDocumentStore, AzureCosmosNoSqlIndexStore, AzureCosmosNoSqlKVStore, AzureCosmosVCoreDocumentStore, AzureCosmosVCoreIndexStore, AzureCosmosVCoreKVStore };
|
|
220
|
+
export type { AadTokenOptions, AccountAndKeyOptions, AzureCosmosNoSqlDocumentStoreArgs, AzureCosmosNoSqlIndexStoreArgs, AzureCosmosNoSqlKVStoreConfig, AzureCosmosVCoreDocumentStoreArgs, AzureCosmosVCoreIndexStoreArgs, AzureCosmosVCoreKVStoreConfig, ConnectionStringOptions, CosmosContainerProperties, CosmosDatabaseProperties, VcoreConnectionStringOptions };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { BaseKVStore, KVDocumentStore, KVIndexStore } from '@vectorstores/core';
|
|
2
|
+
import { MongoClient } from 'mongodb';
|
|
3
|
+
import { CosmosClient } from '@azure/cosmos';
|
|
4
|
+
import { TokenCredential } from '@azure/identity';
|
|
5
|
+
|
|
6
|
+
interface VcoreConnectionStringOptions extends AzureCosmosVCoreKVStoreConfig {
|
|
7
|
+
connectionString?: string;
|
|
8
|
+
}
|
|
9
|
+
interface AzureCosmosVCoreKVStoreConfig {
|
|
10
|
+
mongoClient?: MongoClient;
|
|
11
|
+
dbName?: string;
|
|
12
|
+
collectionName?: string;
|
|
13
|
+
}
|
|
14
|
+
declare class AzureCosmosVCoreKVStore extends BaseKVStore {
|
|
15
|
+
private mongoClient;
|
|
16
|
+
private dbName;
|
|
17
|
+
private collectionName;
|
|
18
|
+
private collection?;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new AzureCosmosDBNoSQLVectorStore instance.
|
|
21
|
+
*/
|
|
22
|
+
constructor({ mongoClient, dbName, collectionName, }: AzureCosmosVCoreKVStoreConfig);
|
|
23
|
+
client(): MongoClient;
|
|
24
|
+
private ensureCollection;
|
|
25
|
+
put(key: string, val: Record<string, any>): Promise<void>;
|
|
26
|
+
get(key: string): Promise<Record<string, any> | null>;
|
|
27
|
+
getAll(): Promise<Record<string, Record<string, any>>>;
|
|
28
|
+
delete(key: string): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface AzureCosmosVCoreDocumentStoreArgs {
|
|
32
|
+
azureCosmosVCoreKVStore: AzureCosmosVCoreKVStore;
|
|
33
|
+
namespace?: string;
|
|
34
|
+
}
|
|
35
|
+
declare class AzureCosmosVCoreDocumentStore extends KVDocumentStore {
|
|
36
|
+
constructor({ azureCosmosVCoreKVStore, namespace, }: AzureCosmosVCoreDocumentStoreArgs);
|
|
37
|
+
/**
|
|
38
|
+
* Static method for creating an instance using a MongoClient.
|
|
39
|
+
* @returns Instance of AzureCosmosVCoreDocumentStore
|
|
40
|
+
* @param mongoClient - MongoClient instance
|
|
41
|
+
* @param dbName - Database name
|
|
42
|
+
* @param collectionName - Collection name
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const mongoClient = new MongoClient("mongodb://localhost:27017");
|
|
46
|
+
* const indexStore = AzureCosmosVCoreDocumentStore.fromMongoClient(mongoClient, "my_db", "my_collection");
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
static fromMongoClient(mongoClient: MongoClient, dbName?: string, collectionName?: string): AzureCosmosVCoreDocumentStore;
|
|
50
|
+
/**
|
|
51
|
+
* Static method for creating an instance using a connection string.
|
|
52
|
+
* @returns Instance of AzureCosmosVCoreDocumentStore
|
|
53
|
+
* @param connectionString - MongoDB connection string
|
|
54
|
+
* @param dbName - Database name
|
|
55
|
+
* @param collectionName - Collection name
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const indexStore = AzureCosmosVCoreDocumentStore.fromConnectionString("mongodb://localhost:27017", "my_db", "my_collection");
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
static fromConnectionString(connectionString: string, dbName?: string, collectionName?: string): AzureCosmosVCoreDocumentStore;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface CosmosDatabaseProperties {
|
|
65
|
+
throughput?: number;
|
|
66
|
+
}
|
|
67
|
+
interface CosmosContainerProperties {
|
|
68
|
+
partitionKey: any;
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}
|
|
71
|
+
interface ConnectionStringOptions extends AzureCosmosNoSqlKVStoreConfig {
|
|
72
|
+
connectionString?: string;
|
|
73
|
+
}
|
|
74
|
+
interface AccountAndKeyOptions extends AzureCosmosNoSqlKVStoreConfig {
|
|
75
|
+
endpoint?: string;
|
|
76
|
+
key?: string;
|
|
77
|
+
}
|
|
78
|
+
interface AadTokenOptions extends AzureCosmosNoSqlKVStoreConfig {
|
|
79
|
+
endpoint?: string;
|
|
80
|
+
credential?: TokenCredential;
|
|
81
|
+
}
|
|
82
|
+
interface AzureCosmosNoSqlKVStoreConfig {
|
|
83
|
+
cosmosClient?: CosmosClient;
|
|
84
|
+
dbName?: string;
|
|
85
|
+
containerName?: string;
|
|
86
|
+
cosmosContainerProperties?: CosmosContainerProperties;
|
|
87
|
+
cosmosDatabaseProperties?: CosmosDatabaseProperties;
|
|
88
|
+
}
|
|
89
|
+
declare class AzureCosmosNoSqlKVStore extends BaseKVStore {
|
|
90
|
+
private cosmosClient;
|
|
91
|
+
private database;
|
|
92
|
+
private container;
|
|
93
|
+
private initPromise?;
|
|
94
|
+
private dbName;
|
|
95
|
+
private containerName;
|
|
96
|
+
private cosmosContainerProperties;
|
|
97
|
+
private cosmosDatabaseProperties;
|
|
98
|
+
private initialize;
|
|
99
|
+
constructor({ cosmosClient, dbName, containerName, cosmosContainerProperties, cosmosDatabaseProperties, }: AzureCosmosNoSqlKVStoreConfig);
|
|
100
|
+
client(): CosmosClient;
|
|
101
|
+
private init;
|
|
102
|
+
/**
|
|
103
|
+
* Static method for creating an instance using a connection string.
|
|
104
|
+
* If no connection string is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_CONNECTION_STRING` as connection string.
|
|
105
|
+
* @returns Instance of AzureCosmosNoSqlKVStore
|
|
106
|
+
*/
|
|
107
|
+
static fromConnectionString(config?: {
|
|
108
|
+
connectionString?: string;
|
|
109
|
+
} & AzureCosmosNoSqlKVStoreConfig): AzureCosmosNoSqlKVStore;
|
|
110
|
+
/**
|
|
111
|
+
* Static method for creating an instance using a account endpoint and key.
|
|
112
|
+
* If no endpoint and key is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as enpoint and `AZURE_COSMOSDB_NOSQL_ACCOUNT_KEY` as key.
|
|
113
|
+
* @returns Instance of AzureCosmosNoSqlKVStore
|
|
114
|
+
*/
|
|
115
|
+
static fromAccountAndKey(config?: {
|
|
116
|
+
endpoint?: string;
|
|
117
|
+
key?: string;
|
|
118
|
+
} & AzureCosmosNoSqlKVStoreConfig): AzureCosmosNoSqlKVStore;
|
|
119
|
+
/**
|
|
120
|
+
* Static method for creating an instance using AAD token.
|
|
121
|
+
* If no endpoint and credentials are provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as endpoint and use DefaultAzureCredential() as credentials.
|
|
122
|
+
* @returns Instance of AzureCosmosNoSqlKVStore
|
|
123
|
+
*/
|
|
124
|
+
static fromAadToken(config?: {
|
|
125
|
+
endpoint?: string;
|
|
126
|
+
credential?: TokenCredential;
|
|
127
|
+
} & AzureCosmosNoSqlKVStoreConfig): AzureCosmosNoSqlKVStore;
|
|
128
|
+
put(key: string, val: Record<string, any>): Promise<void>;
|
|
129
|
+
get(key: string): Promise<Record<string, any> | null>;
|
|
130
|
+
getAll(): Promise<Record<string, Record<string, any>>>;
|
|
131
|
+
delete(key: string): Promise<boolean>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface AzureCosmosNoSqlDocumentStoreArgs {
|
|
135
|
+
azureCosmosNoSqlKVStore: AzureCosmosNoSqlKVStore;
|
|
136
|
+
namespace?: string;
|
|
137
|
+
}
|
|
138
|
+
declare class AzureCosmosNoSqlDocumentStore extends KVDocumentStore {
|
|
139
|
+
constructor({ azureCosmosNoSqlKVStore, namespace, }: AzureCosmosNoSqlDocumentStoreArgs);
|
|
140
|
+
/**
|
|
141
|
+
* Static method for creating an instance using a connection string.
|
|
142
|
+
* If no connection string is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_CONNECTION_STRING` as connection string.
|
|
143
|
+
* @returns Instance of AzureCosmosNoSqlDocumentStore
|
|
144
|
+
*/
|
|
145
|
+
static fromConnectionString(options?: ConnectionStringOptions): AzureCosmosNoSqlDocumentStore;
|
|
146
|
+
/**
|
|
147
|
+
* Static method for creating an instance using a account endpoint and key.
|
|
148
|
+
* If no endpoint and key is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as enpoint and `AZURE_COSMOSDB_NOSQL_ACCOUNT_KEY` as key.
|
|
149
|
+
* @returns Instance of AzureCosmosNoSqlDocumentStore
|
|
150
|
+
*/
|
|
151
|
+
static fromAccountAndKey(options?: AccountAndKeyOptions): AzureCosmosNoSqlDocumentStore;
|
|
152
|
+
/**
|
|
153
|
+
* Static method for creating an instance using AAD token.
|
|
154
|
+
* If no endpoint and credentials are provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as endpoint and use DefaultAzureCredential() as credentials.
|
|
155
|
+
* @returns Instance of AzureCosmosNoSqlDocumentStore
|
|
156
|
+
*/
|
|
157
|
+
static fromAadToken(options?: AadTokenOptions): AzureCosmosNoSqlDocumentStore;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface AzureCosmosVCoreIndexStoreArgs {
|
|
161
|
+
azureCosmosVCoreKVStore: AzureCosmosVCoreKVStore;
|
|
162
|
+
namespace?: string;
|
|
163
|
+
}
|
|
164
|
+
declare class AzureCosmosVCoreIndexStore extends KVIndexStore {
|
|
165
|
+
constructor({ azureCosmosVCoreKVStore, namespace, }: AzureCosmosVCoreIndexStoreArgs);
|
|
166
|
+
/**
|
|
167
|
+
* Static method for creating an instance using a MongoClient.
|
|
168
|
+
* @returns Instance of AzureCosmosVCoreIndexStore
|
|
169
|
+
* @param mongoClient - MongoClient instance
|
|
170
|
+
* @param dbName - Database name
|
|
171
|
+
* @param collectionName - Collection name
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const mongoClient = new MongoClient("mongodb://localhost:27017");
|
|
175
|
+
* const indexStore = AzureCosmosVCoreIndexStore.fromMongoClient(mongoClient, "my_db", "my_collection");
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
static fromMongoClient(mongoClient: MongoClient, dbName?: string, collectionName?: string): AzureCosmosVCoreIndexStore;
|
|
179
|
+
/**
|
|
180
|
+
* Static method for creating an instance using a connection string.
|
|
181
|
+
* @returns Instance of AzureCosmosVCoreIndexStore
|
|
182
|
+
* @param connectionString - MongoDB connection string
|
|
183
|
+
* @param dbName - Database name
|
|
184
|
+
* @param collectionName - Collection name
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const indexStore = AzureCosmosVCoreIndexStore.fromConnectionString("mongodb://localhost:27017", "my_db", "my_collection");
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
static fromConnectionString(connectionString: string, dbName?: string, collectionName?: string): AzureCosmosVCoreIndexStore;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface AzureCosmosNoSqlIndexStoreArgs {
|
|
194
|
+
azureCosmosNoSqlKVStore: AzureCosmosNoSqlKVStore;
|
|
195
|
+
namespace?: string;
|
|
196
|
+
}
|
|
197
|
+
declare class AzureCosmosNoSqlIndexStore extends KVIndexStore {
|
|
198
|
+
constructor({ azureCosmosNoSqlKVStore, namespace, }: AzureCosmosNoSqlIndexStoreArgs);
|
|
199
|
+
/**
|
|
200
|
+
* Static method for creating an instance using a connection string.
|
|
201
|
+
* If no connection string is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_CONNECTION_STRING` as connection string.
|
|
202
|
+
* @returns Instance of AzureCosmosNoSqlIndexStore
|
|
203
|
+
*/
|
|
204
|
+
static fromConnectionString(options?: ConnectionStringOptions): AzureCosmosNoSqlIndexStore;
|
|
205
|
+
/**
|
|
206
|
+
* Static method for creating an instance using a account endpoint and key.
|
|
207
|
+
* If no endpoint and key is provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as enpoint and `AZURE_COSMOSDB_NOSQL_ACCOUNT_KEY` as key.
|
|
208
|
+
* @returns Instance of AzureCosmosNoSqlIndexStore
|
|
209
|
+
*/
|
|
210
|
+
static fromAccountAndKey(options?: AccountAndKeyOptions): AzureCosmosNoSqlIndexStore;
|
|
211
|
+
/**
|
|
212
|
+
* Static method for creating an instance using AAD token.
|
|
213
|
+
* If no endpoint and credentials are provided, it will attempt to use the env variable `AZURE_COSMOSDB_NOSQL_ACCOUNT_ENDPOINT` as endpoint and use DefaultAzureCredential() as credentials.
|
|
214
|
+
* @returns Instance of AzureCosmosNoSqlIndexStore
|
|
215
|
+
*/
|
|
216
|
+
static fromAadToken(options?: AadTokenOptions): AzureCosmosNoSqlIndexStore;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export { AzureCosmosNoSqlDocumentStore, AzureCosmosNoSqlIndexStore, AzureCosmosNoSqlKVStore, AzureCosmosVCoreDocumentStore, AzureCosmosVCoreIndexStore, AzureCosmosVCoreKVStore };
|
|
220
|
+
export type { AadTokenOptions, AccountAndKeyOptions, AzureCosmosNoSqlDocumentStoreArgs, AzureCosmosNoSqlIndexStoreArgs, AzureCosmosNoSqlKVStoreConfig, AzureCosmosVCoreDocumentStoreArgs, AzureCosmosVCoreIndexStoreArgs, AzureCosmosVCoreKVStoreConfig, ConnectionStringOptions, CosmosContainerProperties, CosmosDatabaseProperties, VcoreConnectionStringOptions };
|