mobiletto-driver-s3 2.0.8 → 2.0.9

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.
@@ -1,10 +1,11 @@
1
- import { MobilettoError, MobilettoNotFoundError, MobilettoOptions, MobilettoVisitor, MobilettoMetadata, MobilettoWriteSource, MobilettoListOptions, MobilettoRemoveOptions } from "mobiletto-base";
1
+ import { MobilettoError, MobilettoNotFoundError, MobilettoOptions, MobilettoVisitor, MobilettoMetadata, MobilettoWriteSource, MobilettoListOptions, MobilettoRemoveOptions, MobilettoDriverInfo } from "mobiletto-base";
2
2
  export type S3Options = MobilettoOptions & {
3
3
  bucket?: string;
4
4
  prefix?: string;
5
5
  delimiter?: string;
6
6
  region?: string;
7
7
  };
8
+ export declare const S3Info: MobilettoDriverInfo;
8
9
  declare class StorageClient {
9
10
  private client;
10
11
  private region;
@@ -14,6 +15,7 @@ declare class StorageClient {
14
15
  private normalizeRegex;
15
16
  constructor(key: string, secret: string, opts: S3Options);
16
17
  testConfig: () => Promise<MobilettoMetadata[]>;
18
+ info: () => MobilettoDriverInfo;
17
19
  stripPrefix: (name: string) => string;
18
20
  nameToObj: (name: string) => MobilettoMetadata;
19
21
  list(path: string | undefined, recursiveOrOpts: MobilettoListOptions | boolean, visitor?: MobilettoVisitor): Promise<MobilettoMetadata[] | undefined>;
package/lib/cjs/index.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.storageClient = void 0;
12
+ exports.storageClient = exports.S3Info = void 0;
13
13
  const mobiletto_base_1 = require("mobiletto-base");
14
14
  const path_1 = require("path");
15
15
  const client_s3_1 = require("@aws-sdk/client-s3");
@@ -19,10 +19,15 @@ const DEFAULT_REGION = "us-east-1";
19
19
  const DEFAULT_PREFIX = "";
20
20
  const DEFAULT_DELIMITER = "/";
21
21
  const DELETE_OBJECTS_MAX_KEYS = 1000;
22
+ exports.S3Info = {
23
+ driver: "s3",
24
+ scope: "global",
25
+ };
22
26
  class StorageClient {
23
27
  constructor(key, secret, opts) {
24
28
  // noinspection JSUnusedGlobalSymbols -- called by driver init
25
29
  this.testConfig = () => __awaiter(this, void 0, void 0, function* () { return yield this._list("", false, undefined, { MaxKeys: 1 }); });
30
+ this.info = () => exports.S3Info;
26
31
  this.stripPrefix = (name) => (name.startsWith(this.prefix) ? name.substring(this.prefix.length) : name);
27
32
  this.nameToObj = (name) => {
28
33
  const relName = this.stripPrefix(name);
@@ -1,10 +1,11 @@
1
- import { MobilettoError, MobilettoNotFoundError, MobilettoOptions, MobilettoVisitor, MobilettoMetadata, MobilettoWriteSource, MobilettoListOptions, MobilettoRemoveOptions } from "mobiletto-base";
1
+ import { MobilettoError, MobilettoNotFoundError, MobilettoOptions, MobilettoVisitor, MobilettoMetadata, MobilettoWriteSource, MobilettoListOptions, MobilettoRemoveOptions, MobilettoDriverInfo } from "mobiletto-base";
2
2
  export type S3Options = MobilettoOptions & {
3
3
  bucket?: string;
4
4
  prefix?: string;
5
5
  delimiter?: string;
6
6
  region?: string;
7
7
  };
8
+ export declare const S3Info: MobilettoDriverInfo;
8
9
  declare class StorageClient {
9
10
  private client;
10
11
  private region;
@@ -14,6 +15,7 @@ declare class StorageClient {
14
15
  private normalizeRegex;
15
16
  constructor(key: string, secret: string, opts: S3Options);
16
17
  testConfig: () => Promise<MobilettoMetadata[]>;
18
+ info: () => MobilettoDriverInfo;
17
19
  stripPrefix: (name: string) => string;
18
20
  nameToObj: (name: string) => MobilettoMetadata;
19
21
  list(path: string | undefined, recursiveOrOpts: MobilettoListOptions | boolean, visitor?: MobilettoVisitor): Promise<MobilettoMetadata[] | undefined>;
package/lib/esm/index.js CHANGED
@@ -16,10 +16,15 @@ const DEFAULT_REGION = "us-east-1";
16
16
  const DEFAULT_PREFIX = "";
17
17
  const DEFAULT_DELIMITER = "/";
18
18
  const DELETE_OBJECTS_MAX_KEYS = 1000;
19
+ export const S3Info = {
20
+ driver: "s3",
21
+ scope: "global",
22
+ };
19
23
  class StorageClient {
20
24
  constructor(key, secret, opts) {
21
25
  // noinspection JSUnusedGlobalSymbols -- called by driver init
22
26
  this.testConfig = () => __awaiter(this, void 0, void 0, function* () { return yield this._list("", false, undefined, { MaxKeys: 1 }); });
27
+ this.info = () => S3Info;
23
28
  this.stripPrefix = (name) => (name.startsWith(this.prefix) ? name.substring(this.prefix.length) : name);
24
29
  this.nameToObj = (name) => {
25
30
  const relName = this.stripPrefix(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobiletto-driver-s3",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "type": "module",
5
5
  "description": "The Amazon S3 driver for mobiletto. This package is intended to be used with mobiletto-base, which does not include any drivers",
6
6
  "main": "./lib/cjs/index.js",
@@ -44,7 +44,7 @@
44
44
  "dotenv": "^16.3.1",
45
45
  "eslint": "^8.44.0",
46
46
  "eslint-config-prettier": "^8.8.0",
47
- "mobiletto-base": "^2.0.31",
47
+ "mobiletto-base": "^2.0.32",
48
48
  "mobiletto-driver-local": "^2.0.7",
49
49
  "mocha": "^10.2.0",
50
50
  "prettier": "^2.8.8",