rads-db 3.0.8 → 3.0.10
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/dist/index.d.ts +4 -1
- package/drivers/azureCosmos.cjs +1 -0
- package/drivers/azureCosmos.mjs +1 -0
- package/drivers/azureStorageBlob.cjs +1 -0
- package/drivers/azureStorageBlob.mjs +1 -0
- package/fileUploadDrivers/azureStorageBlob.cjs +4 -2
- package/fileUploadDrivers/azureStorageBlob.d.ts +2 -0
- package/fileUploadDrivers/azureStorageBlob.mjs +5 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -205,6 +205,7 @@ interface TypeDefinition {
|
|
|
205
205
|
}
|
|
206
206
|
interface FileUploadDriver {
|
|
207
207
|
driverName: string;
|
|
208
|
+
client?: any;
|
|
208
209
|
uploadFile(args: FileUploadArgs, ctx?: RadsRequestContext): Promise<{
|
|
209
210
|
url: string;
|
|
210
211
|
}>;
|
|
@@ -231,6 +232,8 @@ interface FileUploadArgs {
|
|
|
231
232
|
}
|
|
232
233
|
interface MinimalDriver {
|
|
233
234
|
driverName: string;
|
|
235
|
+
/** raw underlying data access service - e.g. sql client or azure storage client */
|
|
236
|
+
client?: any;
|
|
234
237
|
putMany: (item: Record<string, any>[], ctx?: RadsRequestContext) => MaybePromise<void>;
|
|
235
238
|
getMany: (args?: GetManyArgsAny, ctx?: RadsRequestContext) => MaybePromise<{
|
|
236
239
|
nodes: Record<string, any>[];
|
|
@@ -243,7 +246,7 @@ interface MinimalDriver {
|
|
|
243
246
|
put?: (data: Record<string, any>, ctx?: RadsRequestContext) => MaybePromise<void>;
|
|
244
247
|
verifyMany?: (args?: VerifyManyArgsAny, ctx?: RadsRequestContext) => MaybePromise<VerifyManyResponse>;
|
|
245
248
|
}
|
|
246
|
-
type Driver = Required<Omit<MinimalDriver, 'verifyMany'>> & Pick<MinimalDriver, 'verifyMany'>;
|
|
249
|
+
type Driver = Required<Omit<MinimalDriver, 'verifyMany' | 'client'>> & Pick<MinimalDriver, 'verifyMany' | 'client'>;
|
|
247
250
|
interface FieldDefinition {
|
|
248
251
|
name: string;
|
|
249
252
|
type: string;
|
package/drivers/azureCosmos.cjs
CHANGED
package/drivers/azureCosmos.mjs
CHANGED
|
@@ -8,13 +8,15 @@ var _storageBlob = require("@azure/storage-blob");
|
|
|
8
8
|
var _default = options => {
|
|
9
9
|
const defaultContainer = options.defaultContainer || "rads";
|
|
10
10
|
const connectionString = options.connectionString;
|
|
11
|
-
const client =
|
|
11
|
+
const client = _storageBlob.BlobServiceClient.fromConnectionString(connectionString, {
|
|
12
12
|
retryOptions: {
|
|
13
13
|
maxTries: 1
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
|
+
...options.options
|
|
15
16
|
});
|
|
16
17
|
const driver = {
|
|
17
18
|
driverName: "azureStorageBlob",
|
|
19
|
+
client,
|
|
18
20
|
async uploadFile(args) {
|
|
19
21
|
const containerClient = client.getContainerClient(args.containerName || defaultContainer);
|
|
20
22
|
const fileName = `${options.fileNamePrefix || ""}${args.fileName}`;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { StoragePipelineOptions } from '@azure/storage-blob';
|
|
1
2
|
interface AzureStorageBlobUploadDriverOptions {
|
|
2
3
|
connectionString: string;
|
|
3
4
|
defaultContainer?: string;
|
|
4
5
|
fileNamePrefix?: string;
|
|
6
|
+
options?: StoragePipelineOptions;
|
|
5
7
|
}
|
|
6
8
|
declare const _default: (options: AzureStorageBlobUploadDriverOptions) => FileUploadDriver;
|
|
7
9
|
export default _default;
|
|
@@ -2,9 +2,13 @@ import { BlobServiceClient } from "@azure/storage-blob";
|
|
|
2
2
|
export default (options) => {
|
|
3
3
|
const defaultContainer = options.defaultContainer || "rads";
|
|
4
4
|
const connectionString = options.connectionString;
|
|
5
|
-
const client =
|
|
5
|
+
const client = BlobServiceClient.fromConnectionString(connectionString, {
|
|
6
|
+
retryOptions: { maxTries: 1 },
|
|
7
|
+
...options.options
|
|
8
|
+
});
|
|
6
9
|
const driver = {
|
|
7
10
|
driverName: "azureStorageBlob",
|
|
11
|
+
client,
|
|
8
12
|
async uploadFile(args) {
|
|
9
13
|
const containerClient = client.getContainerClient(args.containerName || defaultContainer);
|
|
10
14
|
const fileName = `${options.fileNamePrefix || ""}${args.fileName}`;
|