jscrambler 8.8.5 → 8.8.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # jscrambler
2
2
 
3
+ ## 8.8.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [8818c8e]: Use max/min file size instead ao file size threshold
8
+
3
9
  ## 8.8.5
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -79,6 +79,15 @@ function printSourcesErrors(errors) {
79
79
  }
80
80
  console.error();
81
81
  }
82
+ function normalizeFileSizeFilter(parameters, fileSizeOption) {
83
+ const validateFileSizeThreshold = (0, _utils.validateThresholdFn)(fileSizeOption);
84
+ parameters.filter(parameter => typeof parameter[fileSizeOption] === 'string').forEach(parameter => {
85
+ // change from "1kb" to 1024 bytes
86
+
87
+ // eslint-disable-next-line no-param-reassign
88
+ parameter[fileSizeOption] = validateFileSizeThreshold(parameter[fileSizeOption]);
89
+ });
90
+ }
82
91
  function normalizeParameters(parameters) {
83
92
  let result;
84
93
  if (!Array.isArray(parameters)) {
@@ -92,18 +101,8 @@ function normalizeParameters(parameters) {
92
101
  } else {
93
102
  result = parameters;
94
103
  }
95
- const validateFileSizeThreshold = (0, _utils.validateThresholdFn)('fileSizeThreshold');
96
- result.filter(_ref => {
97
- let {
98
- fileSizeThreshold
99
- } = _ref;
100
- return typeof fileSizeThreshold === 'string';
101
- }).forEach(parameter => {
102
- // change from "1kb" to 1024 bytes
103
-
104
- // eslint-disable-next-line no-param-reassign
105
- parameter.fileSizeThreshold = validateFileSizeThreshold(parameter.fileSizeThreshold);
106
- });
104
+ normalizeFileSizeFilter(result, 'minFileSize');
105
+ normalizeFileSizeFilter(result, 'maxFileSize');
107
106
  return result;
108
107
  }
109
108
  function buildFinalConfig(configPathOrObject) {
@@ -129,7 +128,7 @@ var _default = exports.default = {
129
128
  * }} opts
130
129
  * @returns {Promise<{extension: string, filename: string, content: *}>}
131
130
  */
132
- async updateApplicationSources(client, applicationId, _ref2) {
131
+ async updateApplicationSources(client, applicationId, _ref) {
133
132
  let {
134
133
  sources,
135
134
  filesSrc,
@@ -137,7 +136,7 @@ var _default = exports.default = {
137
136
  appProfiling,
138
137
  saveSrc = true,
139
138
  runBeforeProtection = []
140
- } = _ref2;
139
+ } = _ref;
141
140
  if (sources || filesSrc && filesSrc.length) {
142
141
  // prevent removing sources if profiling state is READY
143
142
  if (appProfiling && appProfiling.data && appProfiling.data.state === 'READY') {
@@ -416,10 +415,10 @@ var _default = exports.default = {
416
415
  }
417
416
  const createApplicationProtectionRes = await this.createApplicationProtections(client, applicationId, protectionOptions);
418
417
  errorHandler(createApplicationProtectionRes);
419
- const protectionIds = createApplicationProtectionRes.data.protections.map(_ref3 => {
418
+ const protectionIds = createApplicationProtectionRes.data.protections.map(_ref2 => {
420
419
  let {
421
420
  _id
422
- } = _ref3;
421
+ } = _ref2;
423
422
  return _id;
424
423
  });
425
424
  const onExitCancelProtection = async () => {
@@ -867,26 +866,26 @@ var _default = exports.default = {
867
866
  console.log('Error polling protection', applicationProtections.errors);
868
867
  throw new Error("Protection failed. For more information visit: ".concat(APP_URL, "."));
869
868
  } else {
870
- const ended = applicationProtections.data.applicationProtections.filter(_ref4 => {
869
+ const ended = applicationProtections.data.applicationProtections.filter(_ref3 => {
871
870
  let {
872
871
  state
873
- } = _ref4;
872
+ } = _ref3;
874
873
  return state === 'finished' || state === 'errored' || state === 'canceled';
875
874
  });
876
875
  // print progress
877
- ended.filter(_ref5 => {
876
+ ended.filter(_ref4 => {
878
877
  let {
879
878
  _id,
880
879
  state
881
- } = _ref5;
880
+ } = _ref4;
882
881
  return !seen[_id] && state !== 'canceled';
883
- }).forEach(_ref6 => {
882
+ }).forEach(_ref5 => {
884
883
  let {
885
884
  _id,
886
885
  startedAt,
887
886
  finishedAt,
888
887
  state
889
- } = _ref6;
888
+ } = _ref5;
890
889
  seen[_id] = true;
891
890
  console.log("[".concat(Object.keys(seen).length, "/").concat(protectionIds.length, "] Protection=").concat(_id, ", state=").concat(state, ", build-time=").concat(Math.round((new Date(finishedAt) - new Date(startedAt)) / 1000), "s"));
892
891
  });
@@ -1157,10 +1156,10 @@ var _default = exports.default = {
1157
1156
  clientId
1158
1157
  });
1159
1158
  const appSource = await (0, _getProtectionDefaultFragments.getIntrospection)(client, 'ApplicationSource');
1160
- if (!appSource.fields.some(_ref7 => {
1159
+ if (!appSource.fields.some(_ref6 => {
1161
1160
  let {
1162
1161
  name
1163
- } = _ref7;
1162
+ } = _ref6;
1164
1163
  return name === 'transformedContentHash';
1165
1164
  })) {
1166
1165
  console.error("\"Protection report\" it's only available on Jscrambler version 8.4 and above.");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jscrambler",
3
3
  "description": "Jscrambler Code Integrity API client.",
4
- "version": "8.8.5",
4
+ "version": "8.8.6",
5
5
  "homepage": "https://github.com/jscrambler/jscrambler",
6
6
  "author": "Jscrambler <support@jscrambler.com>",
7
7
  "repository": {