d2l-lms-launch-darkly-feature-converter-plugin
Advanced tools
Comparing version 0.9.0 to 0.11.0
{ | ||
"name": "d2l-lms-launch-darkly-feature-converter-plugin", | ||
"version": "0.9.0", | ||
"version": "0.11.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -8,2 +8,5 @@ const _ = require( 'lodash' ); | ||
const FarmRulesMapper = require( './farm/FarmRulesMapper.js' ); | ||
const FarmTargetsMapper = require( './farm/FarmTargetsMapper.js' ); | ||
const InstanceRulesMapper = require( './instance/InstanceRulesMapper.js' ); | ||
@@ -18,2 +21,4 @@ const InstanceTargetsMapper = require( './instance/InstanceTargetsMapper.js' ); | ||
const farmBooleanSchemaV1_0 = require( '../schemas/farm-boolean/v1_0.json' ); | ||
const instanceBooleanSchemaV1_0 = require( '../schemas/instance-boolean/v1_0.json' ); | ||
@@ -38,2 +43,3 @@ const instanceBooleanSchemaV1_1 = require( '../schemas/instance-boolean/v1_1.json' ); | ||
const generateFlagTag = 'lms-generated-flag'; | ||
const farmFlagTag = 'lms-farm-flag'; | ||
const instanceFlagTag = 'lms-instance-flag'; | ||
@@ -58,2 +64,6 @@ const orgFlagTag = 'lms-org-flag'; | ||
const farmTargetsMapper = new FarmTargetsMapper(); | ||
const farmRulesMapper = new FarmRulesMapper(); | ||
const farmEnvironmentMapper = new EnvironmentMapper( farmTargetsMapper, farmRulesMapper ); | ||
const instanceTargetsMapper = new InstanceTargetsMapper( instanceCatalog ); | ||
@@ -70,2 +80,12 @@ const instanceRulesMapper = new InstanceRulesMapper(); | ||
createSchemaValiators( [ | ||
farmBooleanSchemaV1_0 | ||
] ), | ||
booleanVariationMapper, | ||
farmEnvironmentMapper, | ||
[ generateFlagTag, farmFlagTag ] | ||
); | ||
yield new Converter( | ||
booleanFeatureKind, | ||
createSchemaValiators( [ | ||
instanceBooleanSchemaV1_0, | ||
@@ -72,0 +92,0 @@ instanceBooleanSchemaV1_1, |
const _ = require( 'lodash' ); | ||
const instanceTypeMapper = require( '../instanceTypeMapper' ); | ||
const sortableVersionBuilder = require( '../sortableVersionBuilder.js' ); | ||
const sortableVersionRangeParser = require( '../sortableVersionRangeParser.js' ); | ||
@@ -33,3 +33,3 @@ function* mapClauses( definition ) { | ||
const versions = definition.versions; | ||
const versions = sortableVersionRangeParser( definition.versions ); | ||
if( versions ) { | ||
@@ -41,5 +41,3 @@ | ||
op: 'greaterThanOrEqual', | ||
values: [ | ||
sortableVersionBuilder( versions.start ) | ||
], | ||
values: [ versions.start ], | ||
negate: false | ||
@@ -53,5 +51,3 @@ }; | ||
op: 'lessThanOrEqual', | ||
values: [ | ||
sortableVersionBuilder( versions.end ) | ||
], | ||
values: [ versions.end ], | ||
negate: false | ||
@@ -58,0 +54,0 @@ }; |
const _ = require( 'lodash' ); | ||
const instanceTypeMapper = require( '../instanceTypeMapper' ); | ||
const sortableVersionBuilder = require( '../sortableVersionBuilder.js' ); | ||
const sortableVersionRangeParser = require( '../sortableVersionRangeParser.js' ); | ||
@@ -45,3 +45,3 @@ function* mapClauses( definition ) { | ||
const versions = definition.versions; | ||
const versions = sortableVersionRangeParser( definition.versions ); | ||
if( versions ) { | ||
@@ -53,5 +53,3 @@ | ||
op: 'greaterThanOrEqual', | ||
values: [ | ||
sortableVersionBuilder( versions.start ) | ||
], | ||
values: [ versions.start ], | ||
negate: false | ||
@@ -65,5 +63,3 @@ }; | ||
op: 'lessThanOrEqual', | ||
values: [ | ||
sortableVersionBuilder( versions.end ) | ||
], | ||
values: [ versions.end ], | ||
negate: false | ||
@@ -70,0 +66,0 @@ }; |
@@ -117,2 +117,91 @@ const assert = require( 'chai' ).assert; | ||
} ); | ||
it( 'should map version start and end', function() { | ||
const definition = { | ||
versions: { | ||
start: '10.8.4.12345', | ||
end: '10.8.5.99999' | ||
}, | ||
variation: 'abc' | ||
}; | ||
const rule = mapper.mapRule( definition, variationIndexMap ); | ||
assert.deepEqual( rule, { | ||
clauses: [ | ||
{ | ||
attribute: 'productVersion', | ||
op: 'greaterThanOrEqual', | ||
values: [ | ||
10080412345 | ||
], | ||
negate: false | ||
}, | ||
{ | ||
attribute: 'productVersion', | ||
op: 'lessThanOrEqual', | ||
values: [ | ||
10080599999 | ||
], | ||
negate: false | ||
} | ||
], | ||
variation: 2 | ||
} ); | ||
} ); | ||
it( 'should map specific version', function() { | ||
const definition = { | ||
versions: { | ||
start: '10.8.4.12345', | ||
end: '10.8.4.12345' | ||
}, | ||
variation: 'abc' | ||
}; | ||
const rule = mapper.mapRule( definition, variationIndexMap ); | ||
assert.deepEqual( rule, { | ||
clauses: [ | ||
{ | ||
attribute: 'productVersion', | ||
op: 'greaterThanOrEqual', | ||
values: [ | ||
10080412345 | ||
], | ||
negate: false | ||
}, | ||
{ | ||
attribute: 'productVersion', | ||
op: 'lessThanOrEqual', | ||
values: [ | ||
10080412345 | ||
], | ||
negate: false | ||
} | ||
], | ||
variation: 2 | ||
} ); | ||
} ); | ||
it( 'should throw if start version is greater than end version', function() { | ||
const definition = { | ||
versions: { | ||
start: '10.8.5.0', | ||
end: '10.8.4.0' | ||
}, | ||
variation: 'abc' | ||
}; | ||
assert.throws( | ||
() => { | ||
mapper.mapRule( definition, variationIndexMap ); | ||
}, | ||
/^Version start is greater than version end: 10.8.5.0 > 10.8.4.0$/ | ||
); | ||
} ); | ||
} ); |
@@ -145,2 +145,90 @@ const assert = require( 'chai' ).assert; | ||
} ); | ||
it( 'should map version start and end', function() { | ||
const definition = { | ||
versions: { | ||
start: '10.8.4.12345', | ||
end: '10.8.5.99999' | ||
}, | ||
variation: 'abc' | ||
}; | ||
const rule = mapper.mapRule( definition, variationIndexMap ); | ||
assert.deepEqual( rule, { | ||
clauses: [ | ||
{ | ||
attribute: 'productVersion', | ||
op: 'greaterThanOrEqual', | ||
values: [ | ||
10080412345 | ||
], | ||
negate: false | ||
}, | ||
{ | ||
attribute: 'productVersion', | ||
op: 'lessThanOrEqual', | ||
values: [ | ||
10080599999 | ||
], | ||
negate: false | ||
} | ||
], | ||
variation: 2 | ||
} ); | ||
} ); | ||
it( 'should map specific version', function() { | ||
const definition = { | ||
versions: { | ||
start: '10.8.4.12345', | ||
end: '10.8.4.12345' | ||
}, | ||
variation: 'abc' | ||
}; | ||
const rule = mapper.mapRule( definition, variationIndexMap ); | ||
assert.deepEqual( rule, { | ||
clauses: [ | ||
{ | ||
attribute: 'productVersion', | ||
op: 'greaterThanOrEqual', | ||
values: [ | ||
10080412345 | ||
], | ||
negate: false | ||
}, | ||
{ | ||
attribute: 'productVersion', | ||
op: 'lessThanOrEqual', | ||
values: [ | ||
10080412345 | ||
], | ||
negate: false | ||
} | ||
], | ||
variation: 2 | ||
} ); | ||
} ); | ||
it( 'should throw if start version is greater than end version', function() { | ||
const definition = { | ||
versions: { | ||
start: '10.8.5.0', | ||
end: '10.8.4.0' | ||
}, | ||
variation: 'abc' | ||
}; | ||
assert.throws( | ||
() => { | ||
mapper.mapRule( definition, variationIndexMap ); | ||
}, | ||
/^Version start is greater than version end: 10.8.5.0 > 10.8.4.0$/ | ||
); | ||
} ); | ||
} ); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
161572
66
6794
1
4
11