jscrambler
Advanced tools
Comparing version 6.0.4 to 6.1.0
@@ -83,3 +83,3 @@ #!/usr/bin/env node | ||
_commander2.default.version(require('../../package.json').version).usage('[options] <file ...>').option('-a, --access-key <accessKey>', 'Access key').option('-c, --config <config>', 'Jscrambler configuration options').option('-H, --host <host>', 'Hostname').option('-i, --application-id <id>', 'Application ID').option('-o, --output-dir <dir>', 'Output directory').option('-p, --port <port>', 'Port').option('--base-path <path>', 'Base Path').option('--protocol <protocol>', 'Protocol (http or https)').option('--cafile <path>', 'Internal certificate authority').option('-C, --cwd <dir>', 'Current Working Directory').option('-s, --secret-key <secretKey>', 'Secret key').option('-m, --source-maps <id>', 'Download source maps').option('-R, --randomization-seed <seed>', 'Set randomization seed').option('--instrument', 'Instrument file(s) before start profiling. ATTENTION: previous profiling information will be deleted').option('--start-profiling', 'Starts profiling (assumes an already instrumented application)').option('--stop-profiling', 'Stops profiling').option('--code-hardening-threshold <threshold>', 'Set code hardening file size threshold. Format: {value}{unit="b,kb,mb"}. Example: 200kb', validateCodeHardeningThreshold).option('--recommended-order <bool>', 'Use recommended order', validateBool('recommended-order')).option('-W, --werror <bool>', 'Set werror flag value (default: true)', validateBool('werror')).option('--utc <bool>', 'Set UTC as the request time zone. Otherwise it uses the local time zone (default: true)', validateBool('utc')).option('--tolerate-minification <bool>', 'Don\'t detect minification as malicious tampering (default: true)', validateBool('tolerate-minification')).option('--use-profiling-data <bool>', '(version 6.2 only) Protection should use the existing profiling data (default: true)', validateBool('use-profiling-data')).option('--profiling-data-mode <mode>', '(version 6.3 and above) Select profiling mode (default: automatic)', validateProfilingDataMode).option('--remove-profiling-data', 'Removes the current application profiling information').option('--use-app-classification <bool>', '(version 6.3 and above) Protection should use Application Classification metadata when protecting (default: true)', validateBool('--use-app-classification')).option('--input-symbol-table <file>', '(version 6.3 and above) Protection should use symbol table when protecting. (default: no file)').option('--output-symbol-table <id>', '(version 6.3 and above) Download output symbol table (json)').option('--jscramblerVersion <version>', 'Use a specific Jscrambler version').option('--debugMode', 'Protect in debug mode').option('--skip-sources', 'Prevent source files from being updated').option('--force-app-environment <environment>', '(version 7.1 and above) Override application\'s environment detected automatically. Possible values: ' + availableEnvironments.toString(), validateForceAppEnvironment).parse(process.argv); | ||
_commander2.default.version(require('../../package.json').version).usage('[options] <file ...>').option('-a, --access-key <accessKey>', 'Access key').option('-c, --config <config>', 'Jscrambler configuration options').option('-H, --host <host>', 'Hostname').option('-i, --application-id <id>', 'Application ID').option('-o, --output-dir <dir>', 'Output directory').option('-p, --port <port>', 'Port').option('--base-path <path>', 'Base Path').option('--protocol <protocol>', 'Protocol (http or https)').option('--cafile <path>', 'Internal certificate authority').option('-C, --cwd <dir>', 'Current Working Directory').option('-s, --secret-key <secretKey>', 'Secret key').option('-m, --source-maps <id>', 'Download source maps').option('-R, --randomization-seed <seed>', 'Set randomization seed').option('--instrument', 'Instrument file(s) before start profiling. ATTENTION: previous profiling information will be deleted').option('--start-profiling', 'Starts profiling (assumes an already instrumented application)').option('--stop-profiling', 'Stops profiling').option('--code-hardening-threshold <threshold>', 'Set code hardening file size threshold. Format: {value}{unit="b,kb,mb"}. Example: 200kb', validateCodeHardeningThreshold).option('--recommended-order <bool>', 'Use recommended order', validateBool('recommended-order')).option('-W, --werror <bool>', 'Set werror flag value (default: true)', validateBool('werror')).option('--utc <bool>', 'Set UTC as the request time zone. Otherwise it uses the local time zone (default: true)', validateBool('utc')).option('--tolerate-minification <bool>', 'Don\'t detect minification as malicious tampering (default: true)', validateBool('tolerate-minification')).option('--use-profiling-data <bool>', '(version 6.2 only) Protection should use the existing profiling data (default: true)', validateBool('use-profiling-data')).option('--profiling-data-mode <mode>', '(version 6.3 and above) Select profiling mode (default: automatic)', validateProfilingDataMode).option('--remove-profiling-data', 'Removes the current application profiling information').option('--use-app-classification <bool>', '(version 6.3 and above) Protection should use Application Classification metadata when protecting (default: true)', validateBool('--use-app-classification')).option('--input-symbol-table <file>', '(version 6.3 and above) Protection should use symbol table when protecting. (default: no file)').option('--output-symbol-table <id>', '(version 6.3 and above) Download output symbol table (json)').option('--jscramblerVersion <version>', 'Use a specific Jscrambler version').option('--debugMode', 'Protect in debug mode').option('--skip-sources', 'Prevent source files from being updated').option('--force-app-environment <environment>', '(version 7.1 and above) Override application\'s environment detected automatically. Possible values: ' + availableEnvironments.toString(), validateForceAppEnvironment).option('-n <number>', '(version 7.2 and above) Create multiple protections at once.').parse(process.argv); | ||
@@ -158,2 +158,4 @@ var globSrc = void 0, | ||
config.numberOfProtections = (0, _utils.validateNProtections)(_commander2.default.N); | ||
if (config.codeHardeningThreshold) { | ||
@@ -249,2 +251,3 @@ config.codeHardeningThreshold = validateCodeHardeningThreshold(config.codeHardeningThreshold); | ||
excludeList = _config2.excludeList, | ||
numberOfProtections = _config2.numberOfProtections, | ||
forceAppEnvironment = _config2.forceAppEnvironment; | ||
@@ -427,2 +430,3 @@ | ||
excludeList: excludeList, | ||
numberOfProtections: numberOfProtections, | ||
forceAppEnvironment: forceAppEnvironment | ||
@@ -429,0 +433,0 @@ }); |
@@ -53,3 +53,3 @@ 'use strict'; | ||
// Convert from command line option format to JScrambler API format. | ||
// Convert from command line option format to Jscrambler API format. | ||
function mergeAndParseParams(commander, params) { | ||
@@ -56,0 +56,0 @@ var finalParams = (0, _lodash2.default)(params || {}); |
@@ -87,3 +87,3 @@ 'use strict'; | ||
* @param {String} [options.clientId=0] | ||
* @author José Magalhães (magalhas@gmail.com) | ||
* @author Jscrambler | ||
* @license MIT <http://opensource.org/licenses/MIT> | ||
@@ -90,0 +90,0 @@ */ |
@@ -95,2 +95,4 @@ 'use strict'; | ||
size: 1, | ||
startedAt: 1, | ||
finishedAt: 1, | ||
transformedSize: 1 | ||
@@ -97,0 +99,0 @@ }; |
@@ -23,2 +23,3 @@ 'use strict'; | ||
exports.createApplicationProtection = createApplicationProtection; | ||
exports.createApplicationProtections = createApplicationProtections; | ||
exports.applyTemplate = applyTemplate; | ||
@@ -225,2 +226,8 @@ | ||
var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}, | ||
_ref$mutationName = _ref.mutationName, | ||
mutationName = _ref$mutationName === undefined ? 'createApplicationProtection' : _ref$mutationName, | ||
_ref$mutationInputTyp = _ref.mutationInputType, | ||
mutationInputType = _ref$mutationInputTyp === undefined ? 'ApplicationProtectionCreate' : _ref$mutationInputTyp; | ||
var fragments = _fragments; | ||
@@ -246,3 +253,3 @@ var options = _options; | ||
return { | ||
query: '\n mutation createApplicationProtection ($applicationId: String!, $bail: Boolean, $randomizationSeed: String) {\n createApplicationProtection (applicationId: $applicationId, bail: $bail, randomizationSeed: $randomizationSeed) {\n ' + fragments + '\n }\n }\n ', | ||
query: '\n mutation ' + mutationName + ' ($applicationId: String!, $bail: Boolean, $randomizationSeed: String) {\n ' + mutationName + ' (applicationId: $applicationId, bail: $bail, randomizationSeed: $randomizationSeed) {\n ' + fragments + '\n }\n }\n ', | ||
params: { | ||
@@ -261,3 +268,3 @@ applicationId: applicationId, | ||
return { | ||
query: '\n mutation createApplicationProtection ($applicationId: String!, $data: ApplicationProtectionCreate) {\n createApplicationProtection (applicationId: $applicationId, data: $data) {\n ' + fragments + '\n }\n }\n ', | ||
query: '\n mutation ' + mutationName + ' ($applicationId: String!, $data: ' + mutationInputType + ') {\n ' + mutationName + ' (applicationId: $applicationId, data: $data) {\n ' + fragments + '\n }\n }\n ', | ||
params: { | ||
@@ -271,3 +278,3 @@ applicationId: applicationId, | ||
return { | ||
query: '\n mutation createApplicationProtection ($applicationId: String!, $options: JSON) {\n createApplicationProtection (applicationId: $applicationId, options: $options) {\n ' + fragments + '\n }\n }\n ', | ||
query: '\n mutation ' + mutationName + ' ($applicationId: String!, $options: JSON) {\n ' + mutationName + ' (applicationId: $applicationId, options: $options) {\n ' + fragments + '\n }\n }\n ', | ||
params: { | ||
@@ -280,2 +287,13 @@ applicationId: applicationId, | ||
var createProtectionsDefaultFragments = '\n protections {\n ' + createProtectionDefaultFragments + '\n }\n'; | ||
function createApplicationProtections(applicationId) { | ||
var _fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createProtectionsDefaultFragments; | ||
var _options = arguments[2]; | ||
var args = arguments[3]; | ||
return createApplicationProtection(applicationId, _fragments, _options, args, { mutationName: 'createApplicationProtections', mutationInputType: 'ApplicationProtectionsCreate' }); | ||
} | ||
var applyTemplateDefaultFragments = '\n _id,\n parameters\n'; | ||
@@ -282,0 +300,0 @@ |
@@ -51,5 +51,10 @@ 'use strict'; | ||
var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getApplicationProtectionsDefaultFragments; | ||
var queryArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
return { | ||
query: '\n query getApplicationProtections ($applicationId: String!, $sort: String, $order: String, $limit: Int, $page: Int) {\n applicationProtections(_id: $applicationId, sort: $sort, order: $order, limit: $limit, page: $page) {\n ' + fragments + '\n }\n }\n ', | ||
query: '\n query getApplicationProtections ($applicationId: String!, $sort: String, $order: String, $limit: Int, $page: Int' + queryArgs.map(function (v) { | ||
return ',' + v; | ||
}) + ') {\n applicationProtections(_id: $applicationId, sort: $sort, order: $order, limit: $limit, page: $page' + queryArgs.map(function (v) { | ||
return ', ' + v.split(':')[0].replace('$', '') + ': ' + v.split(':')[0]; | ||
}) + ') {\n ' + fragments + '\n }\n }\n ', | ||
params: JSON.stringify(Object.assign({ | ||
@@ -56,0 +61,0 @@ applicationId: applicationId |
@@ -7,2 +7,3 @@ 'use strict'; | ||
exports.getMatchedFiles = getMatchedFiles; | ||
exports.validateNProtections = validateNProtections; | ||
@@ -34,2 +35,15 @@ var _glob = require('glob'); | ||
return matchedFiles; | ||
} | ||
function validateNProtections(n) { | ||
if (n === undefined) { | ||
return n; | ||
} | ||
var nProtections = parseInt(n, 10); | ||
if (Number.isNaN(nProtections) || nProtections.toString() !== n.toString() || nProtections < 1) { | ||
console.error('*protections* requires an integer greater than 0.'); | ||
process.exit(1); | ||
} | ||
return nProtections; | ||
} |
{ | ||
"name": "jscrambler", | ||
"description": "Jscrambler API client.", | ||
"version": "6.0.4", | ||
"version": "6.1.0", | ||
"homepage": "https://github.com/jscrambler/jscrambler", | ||
"author": { | ||
"name": "magalhas", | ||
"email": "magalhas@gmail.com" | ||
}, | ||
"author": "Jscrambler <code@jscrambler.com>", | ||
"repository": { | ||
@@ -11,0 +8,0 @@ "type": "git", |
@@ -132,2 +132,3 @@ # [![Jscrambler](https://media.jscrambler.com/images/logo_500px.png)](https://jscrambler.com/?utm_source=github.com&utm_medium=referral) | ||
--force-app-environment <environment> (version 7.1 and above) Override application's environment detected automatically. Possible values: node,browser,isomorphic,automatic | ||
-n <number> (version 7.2 and above) Create multiple protections at once. | ||
-h, --help output usage information | ||
@@ -134,0 +135,0 @@ ``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
188188
3870
402