Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backfill-config

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backfill-config - npm Package Compare versions

Comparing version 6.0.0-alpha.0 to 6.0.0

CHANGELOG.json

46

lib/cacheConfig.d.ts
import { Logger } from "backfill-logger";
export declare type AzureBlobCacheStorageOptions = {
connectionString: string;
container: string;
maxSize?: number;
connectionString: string;
container: string;
maxSize?: number;
};
export declare type NpmCacheStorageOptions = {
npmPackageName: string;
registryUrl: string;
npmrcUserconfig?: string;
npmPackageName: string;
registryUrl: string;
npmrcUserconfig?: string;
};
export declare type AzureBlobCacheStorageConfig = {
provider: "azure-blob";
options: AzureBlobCacheStorageOptions;
provider: "azure-blob";
options: AzureBlobCacheStorageOptions;
};
export declare type NpmCacheStorageConfig = {
provider: "npm";
options: NpmCacheStorageOptions;
provider: "npm";
options: NpmCacheStorageOptions;
};
export declare type CacheStorageConfig =
| {
provider: "local";
}
| {
provider: "local-skip";
}
| NpmCacheStorageConfig
| AzureBlobCacheStorageConfig;
export declare function getNpmConfigFromSerializedOptions(
options: string,
logger: Logger
): NpmCacheStorageConfig;
export declare function getAzureBlobConfigFromSerializedOptions(
options: string,
logger: Logger
): AzureBlobCacheStorageConfig;
//# sourceMappingURL=cacheConfig.d.ts.map
export declare type CacheStorageConfig = {
provider: "local";
} | {
provider: "local-skip";
} | NpmCacheStorageConfig | AzureBlobCacheStorageConfig;
export declare function getNpmConfigFromSerializedOptions(options: string, logger: Logger): NpmCacheStorageConfig;
export declare function getAzureBlobConfigFromSerializedOptions(options: string, logger: Logger): AzureBlobCacheStorageConfig;
//# sourceMappingURL=cacheConfig.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function getNpmConfigFromSerializedOptions(options, logger) {
try {
const parsedOptions = JSON.parse(options);
if (
typeof parsedOptions.npmPackageName !== "string" ||
typeof parsedOptions.registryUrl !== "string"
) {
throw new Error("Incorrect npm storage configuration");
try {
const parsedOptions = JSON.parse(options);
if (typeof parsedOptions.npmPackageName !== "string" ||
typeof parsedOptions.registryUrl !== "string") {
throw new Error("Incorrect npm storage configuration");
}
return {
provider: "npm",
options: { ...parsedOptions }
};
}
return {
provider: "npm",
options: { ...parsedOptions }
};
} catch (error) {
logger.error(error);
throw new Error("Invalid npm storage options");
}
catch (error) {
logger.error(error);
throw new Error("Invalid npm storage options");
}
}
exports.getNpmConfigFromSerializedOptions = getNpmConfigFromSerializedOptions;
function getAzureBlobConfigFromSerializedOptions(options, logger) {
try {
const parsedOptions = JSON.parse(options);
if (
typeof parsedOptions.connectionString !== "string" ||
typeof parsedOptions.container !== "string" ||
!(
typeof parsedOptions.maxSize === "undefined" ||
typeof parsedOptions.maxSize === "number"
)
) {
throw new Error("Incorrect blob storage configuration");
try {
const parsedOptions = JSON.parse(options);
if (typeof parsedOptions.connectionString !== "string" ||
typeof parsedOptions.container !== "string" ||
!(typeof parsedOptions.maxSize === "undefined" ||
typeof parsedOptions.maxSize === "number")) {
throw new Error("Incorrect blob storage configuration");
}
return {
provider: "azure-blob",
options: { ...parsedOptions }
};
}
return {
provider: "azure-blob",
options: { ...parsedOptions }
};
} catch (error) {
logger.error(error);
throw new Error("Invalid blob storage options");
}
catch (error) {
logger.error(error);
throw new Error("Invalid blob storage options");
}
}
exports.getAzureBlobConfigFromSerializedOptions = getAzureBlobConfigFromSerializedOptions;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGVDb25maWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY2FjaGVDb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFrQ0EsU0FBZ0IsaUNBQWlDLENBQy9DLE9BQWUsRUFDZixNQUFjO0lBRWQsSUFBSTtRQUNGLE1BQU0sYUFBYSxHQUFHLEl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yxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBRTFDLElBQ0UsT0FBTyxhQUFhLENBQUMsZ0JBQWdCLEtBQUssUUFBUTtZQUNsRCxPQUFPLGFBQWEsQ0FBQyxTQUFTLEtBQUssUUFBUTtZQUMzQyxDQUFDLENBQ0MsT0FBTyxhQUFhLENBQUMsT0FBTyxLQUFLLFdBQVc7Z0JBQzVDLE9BQU8sYUFBYSxDQUFDLE9BQU8sS0FBSyxRQUFRLENBQzFDLEVBQ0Q7WUFDQSxNQUFNLElBQUksS0FBSyxDQUFDLHNDQUFzQyxDQUFDLENBQUM7U0FDekQ7UUFFRCxPQUFPO1lBQ0wsUUFBUSxFQUFFLFlBQVk7WUFDdEIsT0FBTyxFQUFFLEVBQUUsR0FBRyxhQUFhLEVBQUU7U0FDOUIsQ0FBQztLQUNIO0lBQUMsT0FBTyxLQUFLLEVBQUU7UUFDZCxNQUFNLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ3BCLE1BQU0sSUFBSSxLQUFLLENBQUMsOEJBQThCLENBQUMsQ0FBQztLQUNqRDtBQUNILENBQUM7QUExQkQsMEZBMEJDIn0=
import { Logger } from "backfill-logger";
import { Config } from "./index";
export declare function getEnvConfig(logger: Logger): Partial<Config>;
//# sourceMappingURL=envConfig.d.ts.map
//# sourceMappingURL=envConfig.d.ts.map

@@ -7,65 +7,55 @@ "use strict";

function getEnvConfig(logger) {
const config = {};
const cacheProvider = process.env["BACKFILL_CACHE_PROVIDER"];
const serializedCacheProviderOptions =
process.env["BACKFILL_CACHE_PROVIDER_OPTIONS"];
if (cacheProvider === "azure-blob" && serializedCacheProviderOptions) {
config[
"cacheStorageConfig"
] = cacheConfig_1.getAzureBlobConfigFromSerializedOptions(
serializedCacheProviderOptions,
logger
);
} else if (cacheProvider === "npm" && serializedCacheProviderOptions) {
config[
"cacheStorageConfig"
] = cacheConfig_1.getNpmConfigFromSerializedOptions(
serializedCacheProviderOptions,
logger
);
} else if (cacheProvider === "local") {
// local cache has no config at the moment
}
const internalCacheFolder = process.env["BACKFILL_INTERNAL_CACHE_FOLDER"];
if (internalCacheFolder) {
config["internalCacheFolder"] = internalCacheFolder;
}
const logFolder = process.env["BACKFILL_LOG_FOLDER"];
if (logFolder) {
config["logFolder"] = logFolder;
}
const mode = process.env["BACKFILL_MODE"];
if (mode) {
if (index_1.isCorrectMode(mode)) {
config["mode"] = mode;
} else {
throw `Backfill config option "BACKFILL_MODE" was set, but with the wrong value: "${mode}".`;
const config = {};
const cacheProvider = process.env["BACKFILL_CACHE_PROVIDER"];
const serializedCacheProviderOptions = process.env["BACKFILL_CACHE_PROVIDER_OPTIONS"];
if (cacheProvider === "azure-blob" && serializedCacheProviderOptions) {
config["cacheStorageConfig"] = cacheConfig_1.getAzureBlobConfigFromSerializedOptions(serializedCacheProviderOptions, logger);
}
}
const logLevel = process.env["BACKFILL_LOG_LEVEL"];
if (logLevel) {
if (backfill_logger_1.isCorrectLogLevel(logLevel)) {
config["logLevel"] = logLevel;
} else {
throw `Backfill config option "BACKFILL_LOG_LEVEL" was set, but with the wrong value: "${logLevel}".`;
else if (cacheProvider === "npm" && serializedCacheProviderOptions) {
config["cacheStorageConfig"] = cacheConfig_1.getNpmConfigFromSerializedOptions(serializedCacheProviderOptions, logger);
}
}
const performanceReportName = process.env["BACKFILL_PERFORMANCE_REPORT_NAME"];
if (performanceReportName) {
config["performanceReportName"] = performanceReportName;
}
const producePerformanceLogs =
process.env["BACKFILL_PRODUCE_PERFORMANCE_LOGS"];
if (producePerformanceLogs) {
config["producePerformanceLogs"] = Boolean(
producePerformanceLogs === "true"
);
}
const validateOutput = process.env["BACKFILL_VALIDATE_OUTPUT"];
if (validateOutput) {
config["validateOutput"] = Boolean(validateOutput === "true");
}
return config;
else if (cacheProvider === "local") {
// local cache has no config at the moment
}
const internalCacheFolder = process.env["BACKFILL_INTERNAL_CACHE_FOLDER"];
if (internalCacheFolder) {
config["internalCacheFolder"] = internalCacheFolder;
}
const logFolder = process.env["BACKFILL_LOG_FOLDER"];
if (logFolder) {
config["logFolder"] = logFolder;
}
const mode = process.env["BACKFILL_MODE"];
if (mode) {
if (index_1.isCorrectMode(mode)) {
config["mode"] = mode;
}
else {
throw `Backfill config option "BACKFILL_MODE" was set, but with the wrong value: "${mode}".`;
}
}
const logLevel = process.env["BACKFILL_LOG_LEVEL"];
if (logLevel) {
if (backfill_logger_1.isCorrectLogLevel(logLevel)) {
config["logLevel"] = logLevel;
}
else {
throw `Backfill config option "BACKFILL_LOG_LEVEL" was set, but with the wrong value: "${logLevel}".`;
}
}
const performanceReportName = process.env["BACKFILL_PERFORMANCE_REPORT_NAME"];
if (performanceReportName) {
config["performanceReportName"] = performanceReportName;
}
const producePerformanceLogs = process.env["BACKFILL_PRODUCE_PERFORMANCE_LOGS"];
if (producePerformanceLogs) {
config["producePerformanceLogs"] = Boolean(producePerformanceLogs === "true");
}
const validateOutput = process.env["BACKFILL_VALIDATE_OUTPUT"];
if (validateOutput) {
config["validateOutput"] = Boolean(validateOutput === "true");
}
return config;
}
exports.getEnvConfig = getEnvConfig;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW52Q29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2VudkNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFEQUE0RDtBQUU1RCwrQ0FHdUI7QUFDdkIsbUNBQWdEO0FBRWhELFNBQWdCLFlBQVksQ0FBQyxNQUFjO0lBQ3pDLE1BQU0sTUFBTSxHQUFvQixFQUFFLENBQUM7SUFFbkMsTUFBTSxhQUFhLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyx5QkFBeUIsQ0FBQyxDQUFDO0lBQzdELE1BQU0sOEJBQThCLEdBQ2xDLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUNBQWlDLENBQUMsQ0FBQztJQUVqRCxJQU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UFFO1FBQ2xCLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxHQUFHLE9BQU8sQ0FBQyxjQUFjLEtBQUssTUFBTSxDQUFDLENBQUM7S0FDL0Q7SUFFRCxPQUFPLE1BQU0sQ0FBQztBQUNoQixDQUFDO0FBcEVELG9DQW9FQyJ9

@@ -7,21 +7,21 @@ import { LogLevel, Logger } from "backfill-logger";

export declare const modesObject: {
READ_ONLY: string;
WRITE_ONLY: string;
READ_WRITE: string;
PASS: string;
READ_ONLY: string;
WRITE_ONLY: string;
READ_WRITE: string;
PASS: string;
};
export declare type BackfillModes = keyof typeof modesObject;
export declare type Config = {
cacheStorageConfig: CacheStorageConfig;
clearOutput: boolean;
internalCacheFolder: string;
logFolder: string;
logLevel: LogLevel;
name: string;
mode: BackfillModes;
outputGlob: string[];
packageRoot: string;
performanceReportName?: string;
producePerformanceLogs: boolean;
validateOutput: boolean;
cacheStorageConfig: CacheStorageConfig;
clearOutput: boolean;
internalCacheFolder: string;
logFolder: string;
logLevel: LogLevel;
name: string;
mode: BackfillModes;
outputGlob: string[];
packageRoot: string;
performanceReportName?: string;
producePerformanceLogs: boolean;
validateOutput: boolean;
};

@@ -33,2 +33,2 @@ export declare function isCorrectMode(mode: string): mode is BackfillModes;

export declare function createConfig(logger: Logger, fromPath: string): Config;
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __importDefault =
(this && this.__importDefault) ||
function(mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,86 +16,75 @@ const path_1 = __importDefault(require("path"));

exports.modesObject = {
READ_ONLY: "",
WRITE_ONLY: "",
READ_WRITE: "",
PASS: ""
READ_ONLY: "",
WRITE_ONLY: "",
READ_WRITE: "",
PASS: ""
};
function isCorrectMode(mode) {
return exports.modesObject.hasOwnProperty(mode);
return exports.modesObject.hasOwnProperty(mode);
}
exports.isCorrectMode = isCorrectMode;
function getName(packageRoot) {
return (
require(path_1.default.join(packageRoot, "package.json")).name ||
path_1.default.basename(path_1.default.dirname(packageRoot))
);
return (require(path_1.default.join(packageRoot, "package.json")).name ||
path_1.default.basename(path_1.default.dirname(packageRoot)));
}
exports.getName = getName;
function getSearchPaths(fromPath) {
const searchPaths = [];
let nextPath = fromPath;
while (nextPath) {
const configLocation = find_up_1.default.sync("backfill.config.js", {
cwd: nextPath
});
if (configLocation) {
searchPaths.push(configLocation);
nextPath = path_1.default.join(
path_1.default.dirname(configLocation),
".."
);
} else {
nextPath = undefined;
const searchPaths = [];
let nextPath = fromPath;
while (nextPath) {
const configLocation = find_up_1.default.sync("backfill.config.js", { cwd: nextPath });
if (configLocation) {
searchPaths.push(configLocation);
nextPath = path_1.default.join(path_1.default.dirname(configLocation), "..");
}
else {
nextPath = undefined;
}
}
}
return searchPaths.reverse();
return searchPaths.reverse();
}
exports.getSearchPaths = getSearchPaths;
function createDefaultConfig(fromPath) {
const packageRoot = pkg_dir_1.default.sync(fromPath) || fromPath;
const defaultCacheFolder = path_1.default.join(
packageRoot,
"node_modules",
".cache",
"backfill"
);
const outputGlob = ["lib/**"];
return {
cacheStorageConfig: {
provider: "local"
},
clearOutput: false,
internalCacheFolder: defaultCacheFolder,
logFolder: defaultCacheFolder,
logLevel: "info",
name: getName(packageRoot),
mode: "READ_WRITE",
outputGlob,
packageRoot,
producePerformanceLogs: false,
validateOutput: false
};
const packageRoot = pkg_dir_1.default.sync(fromPath) || fromPath;
const defaultCacheFolder = path_1.default.join(packageRoot, "node_modules", ".cache", "backfill");
const outputGlob = ["lib/**"];
return {
cacheStorageConfig: {
provider: "local"
},
clearOutput: false,
internalCacheFolder: defaultCacheFolder,
logFolder: defaultCacheFolder,
logLevel: "info",
name: getName(packageRoot),
mode: "READ_WRITE",
outputGlob,
packageRoot,
producePerformanceLogs: false,
validateOutput: false
};
}
exports.createDefaultConfig = createDefaultConfig;
function createConfig(logger, fromPath) {
const defaultConfig = createDefaultConfig(fromPath);
const fileBasedConfig = getSearchPaths(fromPath).reduce((acc, configPath) => {
const config = require(configPath);
if (config["mode"]) {
if (!isCorrectMode(config["mode"])) {
throw `Backfill config option "mode" was set, but with the wrong value: "${config["mode"]}".`;
}
}
const defaultConfig = createDefaultConfig(fromPath);
const fileBasedConfig = getSearchPaths(fromPath).reduce((acc, configPath) => {
const config = require(configPath);
if (config["mode"]) {
if (!isCorrectMode(config["mode"])) {
throw `Backfill config option "mode" was set, but with the wrong value: "${config["mode"]}".`;
}
}
return {
...acc,
...config
};
}, {});
const envBasedConfig = envConfig_1.getEnvConfig(logger);
return {
...acc,
...config
...defaultConfig,
...fileBasedConfig,
...envBasedConfig
};
}, {});
const envBasedConfig = envConfig_1.getEnvConfig(logger);
return {
...defaultConfig,
...fileBasedConfig,
...envBasedConfig
};
}
exports.createConfig = createConfig;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFBQSxnREFBd0I7QUFDeEIsc0RBQTZCO0FBQzdCLHNEQUE2QjtBQUs3QiwyQ0FBMkM7QUFFM0MsbUNBQThCO0FBQzlCLGlDQUE0QjtBQUlmLFFBQUEsV0FBVyxHQUFHO0lBQ3pCLFNBQVMsRUFBRSxFQUFFO0lBQ2IsVUFBVSxFQUFFLEVBQUU7SUFDZCxVQUFVLEVBQUUsRUFBRTtJQUNkLElBQUksRUFBRSxFQUFFO0NBQ1QsQ0FBQztBQW1CRixTQUFnQixhQUFhLENBQUMsSUFBWTtJQUN4QyxPQUFPLG1CQUF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0lBRTVDLE9BQU87UUFDTCxHQUFHLGFBQWE7UUFDaEIsR0FBRyxlQUFlO1FBQ2xCLEdBQUcsY0FBYztLQUNsQixDQUFDO0FBQ0osQ0FBQztBQXhCRCxvQ0F3QkMifQ==

@@ -10,3 +10,3 @@ {

},
"version": "6.0.0-alpha.0",
"version": "6.0.0",
"main": "lib/index.js",

@@ -32,4 +32,3 @@ "scripts": {

"typescript": "3.7.4"
},
"gitHead": "57feb33599689d3825701193bf40df3c94dcc859"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc