mobiletto-base
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -24,4 +24,2 @@ /// <reference types="node" /> | ||
export declare const normalizeIV: (iv?: string, key?: Buffer | string | null) => Buffer | null; | ||
export declare const setDefaultKey: (key: string) => void; | ||
export declare const setDefaultIV: (iv: string) => void; | ||
export declare const getCipher: (enc: MobilettoEncryptionConfig) => crypto.Cipher; | ||
@@ -28,0 +26,0 @@ export declare const encrypt: (plainText: string, encryption: MobilettoEncryptionConfig, outputEncoding?: BufferEncoding) => string; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decrypt = exports.getDecipher = exports.encrypt = exports.getCipher = exports.setDefaultIV = exports.setDefaultKey = exports.normalizeIV = exports.normalizeKey = exports.DEFAULT_META_WORKERS = exports.DEFAULT_DIR_LEVELS = exports.DEFAULT_CRYPT_ALGO = exports.MIN_KEY_LEN = void 0; | ||
exports.decrypt = exports.getDecipher = exports.encrypt = exports.getCipher = exports.normalizeIV = exports.normalizeKey = exports.DEFAULT_META_WORKERS = exports.DEFAULT_DIR_LEVELS = exports.DEFAULT_CRYPT_ALGO = exports.MIN_KEY_LEN = void 0; | ||
const crypto = __importStar(require("crypto")); | ||
@@ -47,14 +47,2 @@ const shasum_1 = __importDefault(require("shasum")); | ||
exports.normalizeIV = normalizeIV; | ||
// ensure key long enough for security, and is 32 bytes for AES-256 | ||
let KEY = null; | ||
const setDefaultKey = (key) => { | ||
KEY = (0, exports.normalizeKey)(key); | ||
}; | ||
exports.setDefaultKey = setDefaultKey; | ||
// ensure IV is 16 bytes for AES-256 | ||
let CRYPTO_IV = null; | ||
const setDefaultIV = (iv) => { | ||
CRYPTO_IV = (0, exports.normalizeIV)(iv, KEY); | ||
}; | ||
exports.setDefaultIV = setDefaultIV; | ||
const getCipher = (enc) => { | ||
@@ -61,0 +49,0 @@ const algo = enc.algo ? enc.algo : exports.DEFAULT_CRYPT_ALGO; |
@@ -1,3 +0,4 @@ | ||
import { MobilettoClient, MobilettoMinimalClient } from "./types.js"; | ||
import { MobilettoMinimalClient } from "mobiletto-common"; | ||
import { MobilettoClient } from "./types.js"; | ||
export declare const addUtilityFunctions: (client: MobilettoMinimalClient, readOnly?: boolean) => MobilettoClient; | ||
export declare const addCacheFunctions: (client: MobilettoMinimalClient) => MobilettoMinimalClient; |
@@ -1,10 +0,6 @@ | ||
import { MobilettoConnection, MobilettoOptions } from "./types.js"; | ||
import { MobilettoEncryptionSettings } from "./crypt.js"; | ||
import { mobiletto } from "./mobiletto.js"; | ||
export declare function connect(driverPath: string, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings): Promise<MobilettoConnection>; | ||
export { MobilettoError, MobilettoNotFoundError } from "mobiletto-common"; | ||
export { MobilettoVisitor, MobilettoMetadata, MobilettoDriver, MobilettoListOptions, MobilettoRemoveOptions, MobilettoMirrorResults, MobilettoMinimalClient, MobilettoRedisConfig, MobilettoWriteSource, } from "./types.js"; | ||
export { encrypt, decrypt } from "./crypt.js"; | ||
export { mobiletto, MobilettoOptions, MobilettoEncryptionSettings, MobilettoConnection }; | ||
export * from "mobiletto-common"; | ||
export * from "./types.js"; | ||
export * from "./mobiletto.js"; | ||
export { registerDriver, closeRedis } from "./register.js"; | ||
export { flushAll } from "./redis.js"; | ||
export { MobilettoEncryptionSettings, encrypt, decrypt } from "./crypt.js"; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.flushAll = exports.closeRedis = exports.registerDriver = exports.mobiletto = exports.decrypt = exports.encrypt = exports.MobilettoNotFoundError = exports.MobilettoError = exports.connect = void 0; | ||
const mobiletto_js_1 = require("./mobiletto.js"); | ||
Object.defineProperty(exports, "mobiletto", { enumerable: true, get: function () { return mobiletto_js_1.mobiletto; } }); | ||
function connect(driverPath, key, secret, opts, encryption) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, mobiletto_js_1.mobiletto)(driverPath, key, secret, opts, encryption); | ||
}); | ||
} | ||
exports.connect = connect; | ||
var mobiletto_common_1 = require("mobiletto-common"); | ||
Object.defineProperty(exports, "MobilettoError", { enumerable: true, get: function () { return mobiletto_common_1.MobilettoError; } }); | ||
Object.defineProperty(exports, "MobilettoNotFoundError", { enumerable: true, get: function () { return mobiletto_common_1.MobilettoNotFoundError; } }); | ||
var crypt_js_1 = require("./crypt.js"); | ||
Object.defineProperty(exports, "encrypt", { enumerable: true, get: function () { return crypt_js_1.encrypt; } }); | ||
Object.defineProperty(exports, "decrypt", { enumerable: true, get: function () { return crypt_js_1.decrypt; } }); | ||
exports.decrypt = exports.encrypt = exports.flushAll = exports.closeRedis = exports.registerDriver = void 0; | ||
__exportStar(require("mobiletto-common"), exports); | ||
__exportStar(require("./types.js"), exports); | ||
__exportStar(require("./mobiletto.js"), exports); | ||
var register_js_1 = require("./register.js"); | ||
@@ -32,1 +26,4 @@ Object.defineProperty(exports, "registerDriver", { enumerable: true, get: function () { return register_js_1.registerDriver; } }); | ||
Object.defineProperty(exports, "flushAll", { enumerable: true, get: function () { return redis_js_1.flushAll; } }); | ||
var crypt_js_1 = require("./crypt.js"); | ||
Object.defineProperty(exports, "encrypt", { enumerable: true, get: function () { return crypt_js_1.encrypt; } }); | ||
Object.defineProperty(exports, "decrypt", { enumerable: true, get: function () { return crypt_js_1.decrypt; } }); |
@@ -1,3 +0,5 @@ | ||
import { MobilettoConnection, MobilettoOptions } from "./types.js"; | ||
import { MobilettoOptions } from "mobiletto-common"; | ||
import { MobilettoConnection } from "./types.js"; | ||
import { MobilettoEncryptionSettings } from "./crypt.js"; | ||
export declare function mobiletto(driverPath: string, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings): Promise<MobilettoConnection>; | ||
export declare function connect(driverPath: string, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings): Promise<MobilettoConnection>; |
@@ -38,3 +38,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mobiletto = void 0; | ||
exports.connect = exports.mobiletto = void 0; | ||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
@@ -551,1 +551,7 @@ const path_1 = require("path"); | ||
exports.mobiletto = mobiletto; | ||
function connect(driverPath, key, secret, opts, encryption) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield mobiletto(driverPath, key, secret, opts, encryption); | ||
}); | ||
} | ||
exports.connect = connect; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { CacheLike } from "./cache"; | ||
import { MobilettoEntryType } from "mobiletto-common"; | ||
import { ReadStream } from "fs"; | ||
import fs from "fs"; | ||
import { Readable, Transform } from "stream"; | ||
export type MobilettoMetadata = { | ||
name: string; | ||
type: MobilettoEntryType; | ||
size?: number; | ||
ctime?: number; | ||
mtime?: number; | ||
}; | ||
export type MobilettoVisitor = (meta: MobilettoMetadata) => Promise<unknown>; | ||
export type MobilettoListOptions = { | ||
recursive?: boolean; | ||
visitor?: MobilettoVisitor; | ||
}; | ||
export type MobilettoRemoveOptions = { | ||
recursive?: boolean; | ||
quiet?: boolean; | ||
}; | ||
export type MobilettoMirrorResults = { | ||
success: number; | ||
errors: number; | ||
}; | ||
export type MobilettoReadFunc = { | ||
next: () => { | ||
value: Buffer; | ||
}; | ||
}; | ||
export type MobilettoByteCounter = { | ||
count: number; | ||
}; | ||
export type MobilettoWriteSource = Buffer | string | MobilettoGenerator | ReadStream; | ||
export type MobilettoReadable = fs.ReadStream | Transform | Readable; | ||
export type MobilettoGenerator = Generator<Buffer | string, void> | Iterator<Buffer | string>; | ||
export type MobilettoPatchable = { | ||
[func: string]: any; | ||
}; | ||
export type MobilettoFunctions = Record<string, (client: MobilettoMinimalClient) => (...params: any[]) => any>; | ||
export type MobilettoConflictFunction = (m: MobilettoMinimalClient, s: string) => boolean; | ||
export type MobilettoMinimalClient = MobilettoPatchable & { | ||
testConfig: () => unknown; | ||
list: (pth?: string, optsOrRecursive?: MobilettoListOptions | boolean, visitor?: MobilettoVisitor) => Promise<MobilettoMetadata[]>; | ||
metadata: (path: string) => Promise<MobilettoMetadata>; | ||
read: (path: string, callback: (chunk: Buffer) => void, endCallback?: () => void) => Promise<number>; | ||
write: (path: string, data: MobilettoWriteSource) => Promise<number>; | ||
remove: (path: string, optsOrRecursive?: MobilettoRemoveOptions | boolean, quiet?: boolean) => Promise<string | string[]>; | ||
}; | ||
import { MobilettoListOptions, MobilettoMetadata, MobilettoMinimalClient, MobilettoMirrorResults, MobilettoOptions, MobilettoRedisConfig, MobilettoWriteSource, MobilettoVisitor } from "mobiletto-common"; | ||
export type MobilettoConnection = MobilettoMinimalClient & { | ||
@@ -61,12 +12,2 @@ safeList: (path?: string, opts?: MobilettoListOptions) => Promise<MobilettoMetadata[]>; | ||
}; | ||
export type MobilettoRedisConfig = { | ||
host?: string; | ||
port?: number; | ||
prefix?: string; | ||
enabled?: boolean; | ||
}; | ||
export type MobilettoOptions = { | ||
readOnly?: boolean; | ||
redisConfig: MobilettoRedisConfig; | ||
}; | ||
export type MobilettoConnectionFunction = (key: string, secret?: string, opts?: MobilettoOptions) => MobilettoMinimalClient; | ||
@@ -73,0 +14,0 @@ export type MobilettoDriver = { |
/// <reference types="node" /> | ||
import crypto from "crypto"; | ||
import { MobilettoByteCounter, MobilettoWriteSource } from "./types.js"; | ||
import { MobilettoByteCounter, MobilettoWriteSource } from "mobiletto-common"; | ||
import { MobilettoEncryptionConfig } from "./crypt.js"; | ||
@@ -5,0 +5,0 @@ export declare const reader: (chunks: Buffer[]) => (chunk: Buffer) => void; |
@@ -24,4 +24,2 @@ /// <reference types="node" /> | ||
export declare const normalizeIV: (iv?: string, key?: Buffer | string | null) => Buffer | null; | ||
export declare const setDefaultKey: (key: string) => void; | ||
export declare const setDefaultIV: (iv: string) => void; | ||
export declare const getCipher: (enc: MobilettoEncryptionConfig) => crypto.Cipher; | ||
@@ -28,0 +26,0 @@ export declare const encrypt: (plainText: string, encryption: MobilettoEncryptionConfig, outputEncoding?: BufferEncoding) => string; |
@@ -15,12 +15,2 @@ import * as crypto from "crypto"; | ||
: null; | ||
// ensure key long enough for security, and is 32 bytes for AES-256 | ||
let KEY = null; | ||
export const setDefaultKey = (key) => { | ||
KEY = normalizeKey(key); | ||
}; | ||
// ensure IV is 16 bytes for AES-256 | ||
let CRYPTO_IV = null; | ||
export const setDefaultIV = (iv) => { | ||
CRYPTO_IV = normalizeIV(iv, KEY); | ||
}; | ||
export const getCipher = (enc) => { | ||
@@ -27,0 +17,0 @@ const algo = enc.algo ? enc.algo : DEFAULT_CRYPT_ALGO; |
@@ -1,3 +0,4 @@ | ||
import { MobilettoClient, MobilettoMinimalClient } from "./types.js"; | ||
import { MobilettoMinimalClient } from "mobiletto-common"; | ||
import { MobilettoClient } from "./types.js"; | ||
export declare const addUtilityFunctions: (client: MobilettoMinimalClient, readOnly?: boolean) => MobilettoClient; | ||
export declare const addCacheFunctions: (client: MobilettoMinimalClient) => MobilettoMinimalClient; |
@@ -1,10 +0,6 @@ | ||
import { MobilettoConnection, MobilettoOptions } from "./types.js"; | ||
import { MobilettoEncryptionSettings } from "./crypt.js"; | ||
import { mobiletto } from "./mobiletto.js"; | ||
export declare function connect(driverPath: string, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings): Promise<MobilettoConnection>; | ||
export { MobilettoError, MobilettoNotFoundError } from "mobiletto-common"; | ||
export { MobilettoVisitor, MobilettoMetadata, MobilettoDriver, MobilettoListOptions, MobilettoRemoveOptions, MobilettoMirrorResults, MobilettoMinimalClient, MobilettoRedisConfig, MobilettoWriteSource, } from "./types.js"; | ||
export { encrypt, decrypt } from "./crypt.js"; | ||
export { mobiletto, MobilettoOptions, MobilettoEncryptionSettings, MobilettoConnection }; | ||
export * from "mobiletto-common"; | ||
export * from "./types.js"; | ||
export * from "./mobiletto.js"; | ||
export { registerDriver, closeRedis } from "./register.js"; | ||
export { flushAll } from "./redis.js"; | ||
export { MobilettoEncryptionSettings, encrypt, decrypt } from "./crypt.js"; |
@@ -1,20 +0,6 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
import { mobiletto } from "./mobiletto.js"; | ||
export function connect(driverPath, key, secret, opts, encryption) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield mobiletto(driverPath, key, secret, opts, encryption); | ||
}); | ||
} | ||
export { MobilettoError, MobilettoNotFoundError } from "mobiletto-common"; | ||
export { encrypt, decrypt } from "./crypt.js"; | ||
export { mobiletto }; | ||
export * from "mobiletto-common"; | ||
export * from "./types.js"; | ||
export * from "./mobiletto.js"; | ||
export { registerDriver, closeRedis } from "./register.js"; | ||
export { flushAll } from "./redis.js"; | ||
export { encrypt, decrypt } from "./crypt.js"; |
@@ -1,3 +0,5 @@ | ||
import { MobilettoConnection, MobilettoOptions } from "./types.js"; | ||
import { MobilettoOptions } from "mobiletto-common"; | ||
import { MobilettoConnection } from "./types.js"; | ||
import { MobilettoEncryptionSettings } from "./crypt.js"; | ||
export declare function mobiletto(driverPath: string, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings): Promise<MobilettoConnection>; | ||
export declare function connect(driverPath: string, key: string, secret?: string | null, opts?: MobilettoOptions | null, encryption?: MobilettoEncryptionSettings): Promise<MobilettoConnection>; |
@@ -520,1 +520,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
export function connect(driverPath, key, secret, opts, encryption) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield mobiletto(driverPath, key, secret, opts, encryption); | ||
}); | ||
} |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { CacheLike } from "./cache"; | ||
import { MobilettoEntryType } from "mobiletto-common"; | ||
import { ReadStream } from "fs"; | ||
import fs from "fs"; | ||
import { Readable, Transform } from "stream"; | ||
export type MobilettoMetadata = { | ||
name: string; | ||
type: MobilettoEntryType; | ||
size?: number; | ||
ctime?: number; | ||
mtime?: number; | ||
}; | ||
export type MobilettoVisitor = (meta: MobilettoMetadata) => Promise<unknown>; | ||
export type MobilettoListOptions = { | ||
recursive?: boolean; | ||
visitor?: MobilettoVisitor; | ||
}; | ||
export type MobilettoRemoveOptions = { | ||
recursive?: boolean; | ||
quiet?: boolean; | ||
}; | ||
export type MobilettoMirrorResults = { | ||
success: number; | ||
errors: number; | ||
}; | ||
export type MobilettoReadFunc = { | ||
next: () => { | ||
value: Buffer; | ||
}; | ||
}; | ||
export type MobilettoByteCounter = { | ||
count: number; | ||
}; | ||
export type MobilettoWriteSource = Buffer | string | MobilettoGenerator | ReadStream; | ||
export type MobilettoReadable = fs.ReadStream | Transform | Readable; | ||
export type MobilettoGenerator = Generator<Buffer | string, void> | Iterator<Buffer | string>; | ||
export type MobilettoPatchable = { | ||
[func: string]: any; | ||
}; | ||
export type MobilettoFunctions = Record<string, (client: MobilettoMinimalClient) => (...params: any[]) => any>; | ||
export type MobilettoConflictFunction = (m: MobilettoMinimalClient, s: string) => boolean; | ||
export type MobilettoMinimalClient = MobilettoPatchable & { | ||
testConfig: () => unknown; | ||
list: (pth?: string, optsOrRecursive?: MobilettoListOptions | boolean, visitor?: MobilettoVisitor) => Promise<MobilettoMetadata[]>; | ||
metadata: (path: string) => Promise<MobilettoMetadata>; | ||
read: (path: string, callback: (chunk: Buffer) => void, endCallback?: () => void) => Promise<number>; | ||
write: (path: string, data: MobilettoWriteSource) => Promise<number>; | ||
remove: (path: string, optsOrRecursive?: MobilettoRemoveOptions | boolean, quiet?: boolean) => Promise<string | string[]>; | ||
}; | ||
import { MobilettoListOptions, MobilettoMetadata, MobilettoMinimalClient, MobilettoMirrorResults, MobilettoOptions, MobilettoRedisConfig, MobilettoWriteSource, MobilettoVisitor } from "mobiletto-common"; | ||
export type MobilettoConnection = MobilettoMinimalClient & { | ||
@@ -61,12 +12,2 @@ safeList: (path?: string, opts?: MobilettoListOptions) => Promise<MobilettoMetadata[]>; | ||
}; | ||
export type MobilettoRedisConfig = { | ||
host?: string; | ||
port?: number; | ||
prefix?: string; | ||
enabled?: boolean; | ||
}; | ||
export type MobilettoOptions = { | ||
readOnly?: boolean; | ||
redisConfig: MobilettoRedisConfig; | ||
}; | ||
export type MobilettoConnectionFunction = (key: string, secret?: string, opts?: MobilettoOptions) => MobilettoMinimalClient; | ||
@@ -73,0 +14,0 @@ export type MobilettoDriver = { |
/// <reference types="node" /> | ||
import crypto from "crypto"; | ||
import { MobilettoByteCounter, MobilettoWriteSource } from "./types.js"; | ||
import { MobilettoByteCounter, MobilettoWriteSource } from "mobiletto-common"; | ||
import { MobilettoEncryptionConfig } from "./crypt.js"; | ||
@@ -5,0 +5,0 @@ export declare const reader: (chunks: Buffer[]) => (chunk: Buffer) => void; |
{ | ||
"name": "mobiletto-base", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"type": "module", | ||
@@ -53,3 +53,3 @@ "description": "A storage layer that presents a uniform interface to Amazon S3, Backblaze B2, local and other storage systems.", | ||
"lru-cache": "^10.0.0", | ||
"mobiletto-common": "^2.0.4", | ||
"mobiletto-common": "^2.0.11", | ||
"node-fetch-commonjs": "^3.3.1", | ||
@@ -56,0 +56,0 @@ "node-redis-scan": "^1.3.6", |
150602
2824
Updatedmobiletto-common@^2.0.11