allow some config options to be optional

This commit is contained in:
Ben Irvin 2023-09-20 11:44:56 +02:00
parent 79c6df7da0
commit 821832048a
5 changed files with 14 additions and 14 deletions

View File

@ -61,9 +61,9 @@ export default async (opts: CmdOptions) => {
const engine = createTransferEngine(source, destination, {
versionStrategy: 'ignore', // for an export to file, versionStrategy will always be skipped
schemaStrategy: 'ignore', // for an export to file, schemaStrategy will always be skipped
exclude: opts.exclude ?? [],
only: opts.only ?? [],
throttle: opts.throttle ?? 0,
exclude: opts.exclude,
only: opts.only,
throttle: opts.throttle,
transforms: {
links: [
{

View File

@ -72,9 +72,9 @@ export default async (opts: CmdOptions) => {
const engineOptions: EngineOptions = {
versionStrategy: DEFAULT_VERSION_STRATEGY,
schemaStrategy: DEFAULT_SCHEMA_STRATEGY,
exclude: opts.exclude ?? [],
only: opts.only ?? [],
throttle: opts.throttle ?? 0,
exclude: opts.exclude,
only: opts.only,
throttle: opts.throttle,
transforms: {
links: [
{

View File

@ -111,9 +111,9 @@ export default async (opts: CmdOptions) => {
const engine = createTransferEngine(source, destination, {
versionStrategy: 'exact',
schemaStrategy: 'strict',
exclude: opts.exclude ?? [],
only: opts.only ?? [],
throttle: opts.throttle ?? 0,
exclude: opts.exclude,
only: opts.only,
throttle: opts.throttle,
transforms: {
links: [
{

View File

@ -483,13 +483,13 @@ class TransferEngine<
// everything is included by default unless 'only' has been set
let included = isEmpty(only);
if (only?.length > 0) {
if (only && only.length > 0) {
included = only.some((transferGroup) => {
return TransferGroupPresets[transferGroup][stage];
});
}
if (exclude?.length > 0) {
if (exclude && exclude.length > 0) {
if (included) {
included = !exclude.some((transferGroup) => {
return TransferGroupPresets[transferGroup][stage];

View File

@ -170,9 +170,9 @@ export interface ITransferEngineOptions {
transforms?: TransferTransforms;
// List of TransferTransformList preset options to exclude/include
exclude: TransferFilterPreset[];
only: TransferFilterPreset[];
exclude?: TransferFilterPreset[];
only?: TransferFilterPreset[];
// delay after each record
throttle: number;
throttle?: number;
}