mobiletto-base
Advanced tools
Comparing version 2.0.17 to 2.0.18
@@ -1,4 +0,5 @@ | ||
import { MobilettoMinimalClient } from "mobiletto-common"; | ||
import { MobilettoMinimalClient, MobilettoFeatureFlagName } from "mobiletto-common"; | ||
import { MobilettoClient } from "./types.js"; | ||
export declare const isFlagEnabled: (client: MobilettoMinimalClient, flag: MobilettoFeatureFlagName, defaultValue?: boolean) => boolean; | ||
export declare const addUtilityFunctions: (client: MobilettoMinimalClient, readOnly?: boolean) => MobilettoClient; | ||
export declare const addCacheFunctions: (client: MobilettoMinimalClient) => MobilettoMinimalClient; |
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.addCacheFunctions = exports.addUtilityFunctions = void 0; | ||
exports.addCacheFunctions = exports.addUtilityFunctions = exports.isFlagEnabled = void 0; | ||
const mobiletto_common_1 = require("mobiletto-common"); | ||
@@ -36,2 +36,10 @@ const shasum_1 = __importDefault(require("shasum")); | ||
} | ||
const isFlagEnabled = (client, flag, defaultValue) => { | ||
if (client && typeof client.flags === "function") { | ||
const flags = client.flags(); | ||
return (flags && flags[flag] === true) || defaultValue || false; | ||
} | ||
return false; | ||
}; | ||
exports.isFlagEnabled = isFlagEnabled; | ||
const READ_FILE_CACHE_SIZE_THRESHOLD = 128 * 1024; // we can cache files of this size | ||
@@ -63,3 +71,3 @@ // noinspection JSUnusedGlobalSymbols,JSUnresolvedFunction | ||
const results = yield client.driver_list(path, recursive, visitor); | ||
if (results.length === 0) { | ||
if (results.length === 0 && (0, exports.isFlagEnabled)(client, "list_tryMetaIfEmpty")) { | ||
// try single meta, is this a file? | ||
@@ -66,0 +74,0 @@ try { |
@@ -1,4 +0,5 @@ | ||
import { MobilettoMinimalClient } from "mobiletto-common"; | ||
import { MobilettoMinimalClient, MobilettoFeatureFlagName } from "mobiletto-common"; | ||
import { MobilettoClient } from "./types.js"; | ||
export declare const isFlagEnabled: (client: MobilettoMinimalClient, flag: MobilettoFeatureFlagName, defaultValue?: boolean) => boolean; | ||
export declare const addUtilityFunctions: (client: MobilettoMinimalClient, readOnly?: boolean) => MobilettoClient; | ||
export declare const addCacheFunctions: (client: MobilettoMinimalClient) => MobilettoMinimalClient; |
@@ -29,2 +29,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
export const isFlagEnabled = (client, flag, defaultValue) => { | ||
if (client && typeof client.flags === "function") { | ||
const flags = client.flags(); | ||
return (flags && flags[flag] === true) || defaultValue || false; | ||
} | ||
return false; | ||
}; | ||
const READ_FILE_CACHE_SIZE_THRESHOLD = 128 * 1024; // we can cache files of this size | ||
@@ -56,3 +63,3 @@ // noinspection JSUnusedGlobalSymbols,JSUnresolvedFunction | ||
const results = yield client.driver_list(path, recursive, visitor); | ||
if (results.length === 0) { | ||
if (results.length === 0 && isFlagEnabled(client, "list_tryMetaIfEmpty")) { | ||
// try single meta, is this a file? | ||
@@ -59,0 +66,0 @@ try { |
{ | ||
"name": "mobiletto-base", | ||
"version": "2.0.17", | ||
"version": "2.0.18", | ||
"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.11", | ||
"mobiletto-common": "^2.0.14", | ||
"node-fetch-commonjs": "^3.3.1", | ||
@@ -56,0 +56,0 @@ "node-redis-scan": "^1.3.6", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154288
2895
Updatedmobiletto-common@^2.0.14