@uizard/nx-fast-s3-cache
Version:
Nx s3 cache using GNU tar, pigz and multipart s3 uploads/downloads
33 lines (32 loc) • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWriteOnly = exports.isReadOnly = exports.buildCommonCommandInput = void 0;
const buildCommonCommandInput = ({ bucket, prefix, filename, }) => ({
/* eslint-disable @typescript-eslint/naming-convention */
Bucket: bucket || "",
Key: `${prefix}${filename}`,
/* eslint-enable @typescript-eslint/naming-convention */
});
exports.buildCommonCommandInput = buildCommonCommandInput;
const isReadOnly = (options, envReadOnly) => {
var _a, _b, _c;
if (typeof process.env[envReadOnly] !== "undefined") {
if (((_a = process.env[envReadOnly]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "true")
return true;
if (((_b = process.env[envReadOnly]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "false")
return false;
}
return (_c = options.readOnly) !== null && _c !== void 0 ? _c : false;
};
exports.isReadOnly = isReadOnly;
const isWriteOnly = (options, envWriteOnly) => {
var _a, _b, _c;
if (typeof process.env[envWriteOnly] !== "undefined") {
if (((_a = process.env[envWriteOnly]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "true")
return true;
if (((_b = process.env[envWriteOnly]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "false")
return false;
}
return (_c = options.writeOnly) !== null && _c !== void 0 ? _c : false;
};
exports.isWriteOnly = isWriteOnly;