mobiletto 2.0.8 → 2.3.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/lib/cjs/index.d.ts +11 -1
- package/lib/cjs/index.js +34 -11
- package/lib/esm/index.d.ts +11 -1
- package/lib/esm/index.js +31 -9
- package/package.json +42 -27
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export * from "mobiletto-base";
|
|
2
|
-
import { MobilettoConnectionFunction } from "mobiletto-base";
|
|
2
|
+
import { MobilettoConnection, MobilettoConnectionFunction, MobilettoDriverParameter, MobilettoOptions } from "mobiletto-base";
|
|
3
|
+
import { MobilettoEncryptionSettings } from "mobiletto-base";
|
|
4
|
+
/** Registers every bundled driver by its canonical (lowercase) name. Idempotent: names
|
|
5
|
+
* that are already registered (by this function or by the caller) are skipped silently. */
|
|
3
6
|
export declare const registerDrivers: () => void;
|
|
4
7
|
export declare const allDrivers: () => Record<string, MobilettoConnectionFunction>;
|
|
8
|
+
/**
|
|
9
|
+
* Batteries included: these shadow mobiletto-base's `mobiletto`/`connect` and register the
|
|
10
|
+
* bundled drivers on first use, so `import { mobiletto } from "mobiletto"` works without a
|
|
11
|
+
* prior registerDrivers() call. (Calling registerDrivers() yourself remains supported.)
|
|
12
|
+
*/
|
|
13
|
+
export declare const mobiletto: (driverPath: string | MobilettoDriverParameter, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings) => Promise<MobilettoConnection>;
|
|
14
|
+
export declare const connect: (driverPath: string | MobilettoDriverParameter, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings) => Promise<MobilettoConnection>;
|
package/lib/cjs/index.js
CHANGED
|
@@ -13,8 +13,17 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
16
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.allDrivers = exports.registerDrivers = void 0;
|
|
26
|
+
exports.connect = exports.mobiletto = exports.allDrivers = exports.registerDrivers = void 0;
|
|
18
27
|
__exportStar(require("mobiletto-base"), exports);
|
|
19
28
|
const mobiletto_base_1 = require("mobiletto-base");
|
|
20
29
|
const mobiletto_driver_local_1 = require("mobiletto-driver-local");
|
|
@@ -22,19 +31,33 @@ const mobiletto_driver_s3_1 = require("mobiletto-driver-s3");
|
|
|
22
31
|
const mobiletto_driver_b2_1 = require("mobiletto-driver-b2");
|
|
23
32
|
const mobiletto_driver_indexeddb_1 = require("mobiletto-driver-indexeddb");
|
|
24
33
|
const mobiletto_driver_generic_1 = require("mobiletto-driver-generic");
|
|
25
|
-
const
|
|
26
|
-
(0, mobiletto_base_1.registerDriver)("local", mobiletto_driver_local_1.storageClient);
|
|
27
|
-
(0, mobiletto_base_1.registerDriver)("s3", mobiletto_driver_s3_1.storageClient);
|
|
28
|
-
(0, mobiletto_base_1.registerDriver)("b2", mobiletto_driver_b2_1.storageClient);
|
|
29
|
-
(0, mobiletto_base_1.registerDriver)("indexeddb", mobiletto_driver_indexeddb_1.storageClient);
|
|
30
|
-
(0, mobiletto_base_1.registerDriver)("generic", mobiletto_driver_generic_1.storageClient);
|
|
31
|
-
};
|
|
32
|
-
exports.registerDrivers = registerDrivers;
|
|
33
|
-
const allDrivers = () => ({
|
|
34
|
+
const BUNDLED_DRIVERS = {
|
|
34
35
|
local: mobiletto_driver_local_1.storageClient,
|
|
35
36
|
s3: mobiletto_driver_s3_1.storageClient,
|
|
36
37
|
b2: mobiletto_driver_b2_1.storageClient,
|
|
37
38
|
indexeddb: mobiletto_driver_indexeddb_1.storageClient,
|
|
38
39
|
generic: mobiletto_driver_generic_1.storageClient,
|
|
39
|
-
}
|
|
40
|
+
};
|
|
41
|
+
/** Registers every bundled driver by its canonical (lowercase) name. Idempotent: names
|
|
42
|
+
* that are already registered (by this function or by the caller) are skipped silently. */
|
|
43
|
+
const registerDrivers = () => {
|
|
44
|
+
for (const [name, driver] of Object.entries(BUNDLED_DRIVERS)) {
|
|
45
|
+
if (!(0, mobiletto_base_1.hasDriver)(name)) {
|
|
46
|
+
(0, mobiletto_base_1.registerDriver)(name, driver);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.registerDrivers = registerDrivers;
|
|
51
|
+
const allDrivers = () => (Object.assign({}, BUNDLED_DRIVERS));
|
|
40
52
|
exports.allDrivers = allDrivers;
|
|
53
|
+
/**
|
|
54
|
+
* Batteries included: these shadow mobiletto-base's `mobiletto`/`connect` and register the
|
|
55
|
+
* bundled drivers on first use, so `import { mobiletto } from "mobiletto"` works without a
|
|
56
|
+
* prior registerDrivers() call. (Calling registerDrivers() yourself remains supported.)
|
|
57
|
+
*/
|
|
58
|
+
const mobiletto = (driverPath, key, secret, opts, encryption) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
(0, exports.registerDrivers)();
|
|
60
|
+
return (0, mobiletto_base_1.mobiletto)(driverPath, key, secret, opts, encryption);
|
|
61
|
+
});
|
|
62
|
+
exports.mobiletto = mobiletto;
|
|
63
|
+
exports.connect = exports.mobiletto;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export * from "mobiletto-base";
|
|
2
|
-
import { MobilettoConnectionFunction } from "mobiletto-base";
|
|
2
|
+
import { MobilettoConnection, MobilettoConnectionFunction, MobilettoDriverParameter, MobilettoOptions } from "mobiletto-base";
|
|
3
|
+
import { MobilettoEncryptionSettings } from "mobiletto-base";
|
|
4
|
+
/** Registers every bundled driver by its canonical (lowercase) name. Idempotent: names
|
|
5
|
+
* that are already registered (by this function or by the caller) are skipped silently. */
|
|
3
6
|
export declare const registerDrivers: () => void;
|
|
4
7
|
export declare const allDrivers: () => Record<string, MobilettoConnectionFunction>;
|
|
8
|
+
/**
|
|
9
|
+
* Batteries included: these shadow mobiletto-base's `mobiletto`/`connect` and register the
|
|
10
|
+
* bundled drivers on first use, so `import { mobiletto } from "mobiletto"` works without a
|
|
11
|
+
* prior registerDrivers() call. (Calling registerDrivers() yourself remains supported.)
|
|
12
|
+
*/
|
|
13
|
+
export declare const mobiletto: (driverPath: string | MobilettoDriverParameter, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings) => Promise<MobilettoConnection>;
|
|
14
|
+
export declare const connect: (driverPath: string | MobilettoDriverParameter, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings) => Promise<MobilettoConnection>;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,21 +1,43 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
export * from "mobiletto-base";
|
|
2
|
-
import { registerDriver } from "mobiletto-base";
|
|
11
|
+
import { hasDriver, registerDriver, mobiletto as baseMobiletto, } from "mobiletto-base";
|
|
3
12
|
import { storageClient as localDriver } from "mobiletto-driver-local";
|
|
4
13
|
import { storageClient as s3Driver } from "mobiletto-driver-s3";
|
|
5
14
|
import { storageClient as b2Driver } from "mobiletto-driver-b2";
|
|
6
15
|
import { storageClient as indexeddbDriver } from "mobiletto-driver-indexeddb";
|
|
7
16
|
import { storageClient as genericDriver } from "mobiletto-driver-generic";
|
|
8
|
-
|
|
9
|
-
registerDriver("local", localDriver);
|
|
10
|
-
registerDriver("s3", s3Driver);
|
|
11
|
-
registerDriver("b2", b2Driver);
|
|
12
|
-
registerDriver("indexeddb", indexeddbDriver);
|
|
13
|
-
registerDriver("generic", genericDriver);
|
|
14
|
-
};
|
|
15
|
-
export const allDrivers = () => ({
|
|
17
|
+
const BUNDLED_DRIVERS = {
|
|
16
18
|
local: localDriver,
|
|
17
19
|
s3: s3Driver,
|
|
18
20
|
b2: b2Driver,
|
|
19
21
|
indexeddb: indexeddbDriver,
|
|
20
22
|
generic: genericDriver,
|
|
23
|
+
};
|
|
24
|
+
/** Registers every bundled driver by its canonical (lowercase) name. Idempotent: names
|
|
25
|
+
* that are already registered (by this function or by the caller) are skipped silently. */
|
|
26
|
+
export const registerDrivers = () => {
|
|
27
|
+
for (const [name, driver] of Object.entries(BUNDLED_DRIVERS)) {
|
|
28
|
+
if (!hasDriver(name)) {
|
|
29
|
+
registerDriver(name, driver);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const allDrivers = () => (Object.assign({}, BUNDLED_DRIVERS));
|
|
34
|
+
/**
|
|
35
|
+
* Batteries included: these shadow mobiletto-base's `mobiletto`/`connect` and register the
|
|
36
|
+
* bundled drivers on first use, so `import { mobiletto } from "mobiletto"` works without a
|
|
37
|
+
* prior registerDrivers() call. (Calling registerDrivers() yourself remains supported.)
|
|
38
|
+
*/
|
|
39
|
+
export const mobiletto = (driverPath, key, secret, opts, encryption) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
registerDrivers();
|
|
41
|
+
return baseMobiletto(driverPath, key, secret, opts, encryption);
|
|
21
42
|
});
|
|
43
|
+
export const connect = mobiletto;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobiletto",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A storage layer that presents a uniform interface to Amazon S3, Backblaze B2, and local storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -22,38 +22,53 @@
|
|
|
22
22
|
"url": "https://github.com/cobbzilla/mobiletto"
|
|
23
23
|
},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
|
-
"scripts": {
|
|
26
|
-
"test": "mocha --timeout 30000 ./test/crypt.spec.js",
|
|
27
|
-
"tsc": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
|
|
28
|
-
"lint": "npx eslint src test",
|
|
29
|
-
"lint:fix": "npm run lint -- --fix",
|
|
30
|
-
"prettier": "npx prettier src test --check",
|
|
31
|
-
"prettier:fix": "npm run prettier -- --write"
|
|
32
|
-
},
|
|
33
25
|
"main": "./lib/cjs/index.js",
|
|
34
26
|
"module": "./lib/esm/index.js",
|
|
35
27
|
"files": [
|
|
36
28
|
"lib/"
|
|
37
29
|
],
|
|
38
30
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"eslint": "^8.
|
|
45
|
-
"eslint
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
31
|
+
"@eslint/eslintrc": "^3.3.7",
|
|
32
|
+
"@eslint/js": "^10.0.1",
|
|
33
|
+
"@types/chai": "^5.2.3",
|
|
34
|
+
"@types/mocha": "^10.0.10",
|
|
35
|
+
"@types/node": "^26.6.6",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^8.73.0",
|
|
37
|
+
"@typescript-eslint/parser": "^8.73.0",
|
|
38
|
+
"chai": "^6.3.0",
|
|
39
|
+
"dotenv": "^18.0.10",
|
|
40
|
+
"eslint": "^10.15.0",
|
|
41
|
+
"eslint-config-prettier": "^10.1.8",
|
|
42
|
+
"globals": "^17.14.0",
|
|
43
|
+
"mobiletto-driver-test": "file:../mobiletto-driver-test",
|
|
44
|
+
"mocha": "^12.0.3",
|
|
45
|
+
"prettier": "^3.10.1",
|
|
46
|
+
"typescript": "^6.0.3"
|
|
50
47
|
},
|
|
51
48
|
"dependencies": {
|
|
52
|
-
"mobiletto-base": "^2.
|
|
53
|
-
"mobiletto-driver-b2": "^2.0
|
|
54
|
-
"mobiletto-driver-generic": "^2.
|
|
55
|
-
"mobiletto-driver-indexeddb": "^2.0
|
|
56
|
-
"mobiletto-driver-local": "^2.0
|
|
57
|
-
"mobiletto-driver-s3": "^2.0
|
|
49
|
+
"mobiletto-base": "^2.3.2",
|
|
50
|
+
"mobiletto-driver-b2": "^2.3.0",
|
|
51
|
+
"mobiletto-driver-generic": "^2.2.3",
|
|
52
|
+
"mobiletto-driver-indexeddb": "^2.3.0",
|
|
53
|
+
"mobiletto-driver-local": "^2.3.0",
|
|
54
|
+
"mobiletto-driver-s3": "^2.3.0"
|
|
55
|
+
},
|
|
56
|
+
"exports": {
|
|
57
|
+
".": {
|
|
58
|
+
"types": "./lib/esm/index.d.ts",
|
|
59
|
+
"import": "./lib/esm/index.js",
|
|
60
|
+
"require": "./lib/cjs/index.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"types": "./lib/esm/index.d.ts",
|
|
64
|
+
"scripts": {
|
|
65
|
+
"test": "if [[ -z \"$SKIP_TESTS\" ]] ; then mocha --timeout 60000 ./test/*.spec.js; else echo 'Skipping tests due to SKIP_TESTS env variable'; fi",
|
|
66
|
+
"tsc": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
|
|
67
|
+
"lint": "npx eslint src test",
|
|
68
|
+
"lint:fix": "npm run lint -- --fix",
|
|
69
|
+
"prettier": "npx prettier src test --check",
|
|
70
|
+
"prettier:fix": "npm run prettier -- --write",
|
|
71
|
+
"smoke": "node --input-type=module -e \"const m = await import('mobiletto'); m.registerDrivers(); console.log('ESM smoke OK:', Object.keys(m.allDrivers()).join(','))\" && node -e \"const m = require('mobiletto'); console.log('CJS smoke OK (require(esm)):', typeof m)\"",
|
|
72
|
+
"release": "pnpm tsc && pnpm smoke && pnpm prettier && pnpm lint && pnpm test"
|
|
58
73
|
}
|
|
59
|
-
}
|
|
74
|
+
}
|