jscrambler 6.0.4 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-MIT +1 -1
- package/README.md +1 -0
- package/dist/bin/jscrambler.js +5 -1
- package/dist/cli.js +1 -1
- package/dist/client.js +1 -1
- package/dist/get-protection-default-fragments.js +2 -0
- package/dist/index.js +894 -572
- package/dist/mutations.js +21 -3
- package/dist/queries.js +6 -1
- package/dist/utils.js +14 -0
- package/package.json +2 -5
package/dist/mutations.js
CHANGED
|
@@ -20,6 +20,7 @@ exports.createTemplate = createTemplate;
|
|
|
20
20
|
exports.removeTemplate = removeTemplate;
|
|
21
21
|
exports.updateTemplate = updateTemplate;
|
|
22
22
|
exports.createApplicationProtection = createApplicationProtection;
|
|
23
|
+
exports.createApplicationProtections = createApplicationProtections;
|
|
23
24
|
exports.applyTemplate = applyTemplate;
|
|
24
25
|
|
|
25
26
|
var _cleanupInputFields3 = require('./cleanup-input-fields');
|
|
@@ -221,6 +222,12 @@ function createApplicationProtection(applicationId) {
|
|
|
221
222
|
var _options = arguments[2];
|
|
222
223
|
var args = arguments[3];
|
|
223
224
|
|
|
225
|
+
var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {},
|
|
226
|
+
_ref$mutationName = _ref.mutationName,
|
|
227
|
+
mutationName = _ref$mutationName === undefined ? 'createApplicationProtection' : _ref$mutationName,
|
|
228
|
+
_ref$mutationInputTyp = _ref.mutationInputType,
|
|
229
|
+
mutationInputType = _ref$mutationInputTyp === undefined ? 'ApplicationProtectionCreate' : _ref$mutationInputTyp;
|
|
230
|
+
|
|
224
231
|
var fragments = _fragments;
|
|
225
232
|
var options = _options;
|
|
226
233
|
|
|
@@ -241,7 +248,7 @@ function createApplicationProtection(applicationId) {
|
|
|
241
248
|
|
|
242
249
|
|
|
243
250
|
return {
|
|
244
|
-
query: '\n mutation
|
|
251
|
+
query: '\n mutation ' + mutationName + ' ($applicationId: String!, $bail: Boolean, $randomizationSeed: String) {\n ' + mutationName + ' (applicationId: $applicationId, bail: $bail, randomizationSeed: $randomizationSeed) {\n ' + fragments + '\n }\n }\n ',
|
|
245
252
|
params: {
|
|
246
253
|
applicationId: applicationId,
|
|
247
254
|
bail: bail,
|
|
@@ -255,7 +262,7 @@ function createApplicationProtection(applicationId) {
|
|
|
255
262
|
return arg.name === 'data';
|
|
256
263
|
})) {
|
|
257
264
|
return {
|
|
258
|
-
query: '\n mutation
|
|
265
|
+
query: '\n mutation ' + mutationName + ' ($applicationId: String!, $data: ' + mutationInputType + ') {\n ' + mutationName + ' (applicationId: $applicationId, data: $data) {\n ' + fragments + '\n }\n }\n ',
|
|
259
266
|
params: {
|
|
260
267
|
applicationId: applicationId,
|
|
261
268
|
data: options
|
|
@@ -264,7 +271,7 @@ function createApplicationProtection(applicationId) {
|
|
|
264
271
|
}
|
|
265
272
|
|
|
266
273
|
return {
|
|
267
|
-
query: '\n mutation
|
|
274
|
+
query: '\n mutation ' + mutationName + ' ($applicationId: String!, $options: JSON) {\n ' + mutationName + ' (applicationId: $applicationId, options: $options) {\n ' + fragments + '\n }\n }\n ',
|
|
268
275
|
params: {
|
|
269
276
|
applicationId: applicationId,
|
|
270
277
|
options: options
|
|
@@ -272,6 +279,17 @@ function createApplicationProtection(applicationId) {
|
|
|
272
279
|
};
|
|
273
280
|
}
|
|
274
281
|
|
|
282
|
+
var createProtectionsDefaultFragments = '\n protections {\n ' + createProtectionDefaultFragments + '\n }\n';
|
|
283
|
+
|
|
284
|
+
function createApplicationProtections(applicationId) {
|
|
285
|
+
var _fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createProtectionsDefaultFragments;
|
|
286
|
+
|
|
287
|
+
var _options = arguments[2];
|
|
288
|
+
var args = arguments[3];
|
|
289
|
+
|
|
290
|
+
return createApplicationProtection(applicationId, _fragments, _options, args, { mutationName: 'createApplicationProtections', mutationInputType: 'ApplicationProtectionsCreate' });
|
|
291
|
+
}
|
|
292
|
+
|
|
275
293
|
var applyTemplateDefaultFragments = '\n _id,\n parameters\n';
|
|
276
294
|
|
|
277
295
|
function applyTemplate(templateId, appId) {
|
package/dist/queries.js
CHANGED
|
@@ -48,9 +48,14 @@ var getApplicationProtectionsDefaultFragments = '\n _id,\n sources,\n paramet
|
|
|
48
48
|
|
|
49
49
|
function getApplicationProtections(applicationId, params) {
|
|
50
50
|
var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getApplicationProtectionsDefaultFragments;
|
|
51
|
+
var queryArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
51
52
|
|
|
52
53
|
return {
|
|
53
|
-
query: '\n query getApplicationProtections ($applicationId: String!, $sort: String, $order: String, $limit: Int, $page: Int
|
|
54
|
+
query: '\n query getApplicationProtections ($applicationId: String!, $sort: String, $order: String, $limit: Int, $page: Int' + queryArgs.map(function (v) {
|
|
55
|
+
return ',' + v;
|
|
56
|
+
}) + ') {\n applicationProtections(_id: $applicationId, sort: $sort, order: $order, limit: $limit, page: $page' + queryArgs.map(function (v) {
|
|
57
|
+
return ', ' + v.split(':')[0].replace('$', '') + ': ' + v.split(':')[0];
|
|
58
|
+
}) + ') {\n ' + fragments + '\n }\n }\n ',
|
|
54
59
|
params: JSON.stringify(Object.assign({
|
|
55
60
|
applicationId: applicationId
|
|
56
61
|
}, params))
|
package/dist/utils.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getMatchedFiles = getMatchedFiles;
|
|
7
|
+
exports.validateNProtections = validateNProtections;
|
|
7
8
|
|
|
8
9
|
var _glob = require('glob');
|
|
9
10
|
|
|
@@ -30,4 +31,17 @@ function getMatchedFiles(pattern) {
|
|
|
30
31
|
matchedFiles = [pattern];
|
|
31
32
|
}
|
|
32
33
|
return matchedFiles;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function validateNProtections(n) {
|
|
37
|
+
if (n === undefined) {
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var nProtections = parseInt(n, 10);
|
|
42
|
+
if (Number.isNaN(nProtections) || nProtections.toString() !== n.toString() || nProtections < 1) {
|
|
43
|
+
console.error('*protections* requires an integer greater than 0.');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
return nProtections;
|
|
33
47
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jscrambler",
|
|
3
3
|
"description": "Jscrambler API client.",
|
|
4
|
-
"version": "6.0
|
|
4
|
+
"version": "6.1.0",
|
|
5
5
|
"homepage": "https://github.com/jscrambler/jscrambler",
|
|
6
|
-
"author":
|
|
7
|
-
"name": "magalhas",
|
|
8
|
-
"email": "magalhas@gmail.com"
|
|
9
|
-
},
|
|
6
|
+
"author": "Jscrambler <code@jscrambler.com>",
|
|
10
7
|
"repository": {
|
|
11
8
|
"type": "git",
|
|
12
9
|
"url": "https://github.com/jscrambler/jscrambler.git"
|