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 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;
@@ -93,6 +93,7 @@ var _default = options => (schema, entity) => {
93
93
  }
94
94
  const instance = {
95
95
  driverName: "azureCosmos",
96
+ client,
96
97
  getMany,
97
98
  async clear(ctx) {
98
99
  let currentCursor = null;
@@ -61,6 +61,7 @@ export default (options) => (schema, entity) => {
61
61
  }
62
62
  const instance = {
63
63
  driverName: "azureCosmos",
64
+ client,
64
65
  getMany,
65
66
  async clear(ctx) {
66
67
  let currentCursor = null;
@@ -79,6 +79,7 @@ var _default = options => (schema, entity) => {
79
79
  }
80
80
  const instance = {
81
81
  driverName: "azureStorageBlob",
82
+ client: containerClient,
82
83
  getMany,
83
84
  async clear(ctx) {
84
85
  let currentCursor = null;
@@ -64,6 +64,7 @@ export default (options) => (schema, entity) => {
64
64
  }
65
65
  const instance = {
66
66
  driverName: "azureStorageBlob",
67
+ client: containerClient,
67
68
  getMany,
68
69
  async clear(ctx) {
69
70
  let currentCursor = null;
@@ -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 = new _storageBlob.BlobServiceClient(connectionString, void 0, {
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 = new BlobServiceClient(connectionString, void 0, { retryOptions: { maxTries: 1 } });
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}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.0.8",
3
+ "version": "3.0.10",
4
4
  "files": [
5
5
  "dist",
6
6
  "drivers",