eservices-core 1.0.310 → 1.0.311

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.
Files changed (2) hide show
  1. package/dist/index.js +370 -410
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.310
2
+ * eservices-core v1.0.311
3
3
  * (c) 2022 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -10,12 +10,10 @@ var vue = require('vue');
10
10
  var jenesiusVueModal = require('jenesius-vue-modal');
11
11
  var vueRouter = require('vue-router');
12
12
  var dateAndTime = require('date-and-time');
13
- var require$$0 = require('crypto');
14
13
 
15
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
15
 
17
16
  var dateAndTime__default = /*#__PURE__*/_interopDefaultLegacy(dateAndTime);
18
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
19
17
 
20
18
  var script$R = vue.defineComponent({
21
19
  props: {
@@ -4723,464 +4721,426 @@ styleInject(css_248z$d);
4723
4721
  script$e.__scopeId = "data-v-476fe206";
4724
4722
  script$e.__file = "core/widgets/interface/interface-navigation-row.vue";
4725
4723
 
4726
- var objectHash = {exports: {}};
4724
+ var lib = {exports: {}};
4727
4725
 
4728
- (function (module, exports) {
4726
+ var util = {exports: {}};
4729
4727
 
4730
- var crypto = require$$0__default["default"];
4728
+ (function (module) {
4729
+ const util = module.exports;
4730
+
4731
+ util.digitCount = function digitCount (value) {
4732
+ // Add a digit for negative numbers, as the sign will be prefixed
4733
+ const sign = value < 0 ? 1 : 0;
4734
+ // Guard against negative numbers & zero going into log10(),
4735
+ // as that would return -Infinity
4736
+ value = Math.abs(Number(value || 1));
4737
+ return Math.floor(Math.log10(value)) + 1 + sign
4738
+ };
4739
+
4740
+ util.getType = function getType (value) {
4741
+ if (Buffer.isBuffer(value)) return 'buffer'
4742
+ if (ArrayBuffer.isView(value)) return 'arraybufferview'
4743
+ if (Array.isArray(value)) return 'array'
4744
+ if (value instanceof Number) return 'number'
4745
+ if (value instanceof Boolean) return 'boolean'
4746
+ if (value instanceof Set) return 'set'
4747
+ if (value instanceof Map) return 'map'
4748
+ if (value instanceof String) return 'string'
4749
+ if (value instanceof ArrayBuffer) return 'arraybuffer'
4750
+ return typeof value
4751
+ };
4752
+ }(util));
4753
+
4754
+ const { getType: getType$1 } = util.exports;
4731
4755
 
4732
4756
  /**
4733
- * Exported function
4734
- *
4735
- * Options:
4736
- *
4737
- * - `algorithm` hash algo to be used by this instance: *'sha1', 'md5'
4738
- * - `excludeValues` {true|*false} hash object keys, values ignored
4739
- * - `encoding` hash encoding, supports 'buffer', '*hex', 'binary', 'base64'
4740
- * - `ignoreUnknown` {true|*false} ignore unknown object types
4741
- * - `replacer` optional function that replaces values before hashing
4742
- * - `respectFunctionProperties` {*true|false} consider function properties when hashing
4743
- * - `respectFunctionNames` {*true|false} consider 'name' property of functions for hashing
4744
- * - `respectType` {*true|false} Respect special properties (prototype, constructor)
4745
- * when hashing to distinguish between types
4746
- * - `unorderedArrays` {true|*false} Sort all arrays before hashing
4747
- * - `unorderedSets` {*true|false} Sort `Set` and `Map` instances before hashing
4748
- * * = default
4757
+ * Encodes data in bencode.
4749
4758
  *
4750
- * @param {object} object value to hash
4751
- * @param {object} options hashing options
4752
- * @return {string} hash value
4753
- * @api public
4759
+ * @param {Buffer|Array|String|Object|Number|Boolean} data
4760
+ * @return {Buffer}
4754
4761
  */
4755
- exports = module.exports = objectHash;
4762
+ function encode (data, buffer, offset) {
4763
+ const buffers = [];
4764
+ let result = null;
4756
4765
 
4757
- function objectHash(object, options){
4758
- options = applyDefaults(object, options);
4766
+ encode._encode(buffers, data);
4767
+ result = Buffer.concat(buffers);
4768
+ encode.bytes = result.length;
4759
4769
 
4760
- return hash(object, options);
4770
+ if (Buffer.isBuffer(buffer)) {
4771
+ result.copy(buffer, offset);
4772
+ return buffer
4773
+ }
4774
+
4775
+ return result
4761
4776
  }
4762
4777
 
4763
- /**
4764
- * Exported sugar methods
4765
- *
4766
- * @param {object} object value to hash
4767
- * @return {string} hash value
4768
- * @api public
4769
- */
4770
- exports.sha1 = function(object){
4771
- return objectHash(object);
4778
+ encode.bytes = -1;
4779
+ encode._floatConversionDetected = false;
4780
+
4781
+ encode._encode = function (buffers, data) {
4782
+ if (data == null) { return }
4783
+
4784
+ switch (getType$1(data)) {
4785
+ case 'buffer': encode.buffer(buffers, data); break
4786
+ case 'object': encode.dict(buffers, data); break
4787
+ case 'map': encode.dictMap(buffers, data); break
4788
+ case 'array': encode.list(buffers, data); break
4789
+ case 'set': encode.listSet(buffers, data); break
4790
+ case 'string': encode.string(buffers, data); break
4791
+ case 'number': encode.number(buffers, data); break
4792
+ case 'boolean': encode.number(buffers, data); break
4793
+ case 'arraybufferview': encode.buffer(buffers, Buffer.from(data.buffer, data.byteOffset, data.byteLength)); break
4794
+ case 'arraybuffer': encode.buffer(buffers, Buffer.from(data)); break
4795
+ }
4772
4796
  };
4773
- exports.keys = function(object){
4774
- return objectHash(object, {excludeValues: true, algorithm: 'sha1', encoding: 'hex'});
4797
+
4798
+ const buffE = Buffer.from('e');
4799
+ const buffD = Buffer.from('d');
4800
+ const buffL = Buffer.from('l');
4801
+
4802
+ encode.buffer = function (buffers, data) {
4803
+ buffers.push(Buffer.from(data.length + ':'), data);
4775
4804
  };
4776
- exports.MD5 = function(object){
4777
- return objectHash(object, {algorithm: 'md5', encoding: 'hex'});
4805
+
4806
+ encode.string = function (buffers, data) {
4807
+ buffers.push(Buffer.from(Buffer.byteLength(data) + ':' + data));
4778
4808
  };
4779
- exports.keysMD5 = function(object){
4780
- return objectHash(object, {algorithm: 'md5', encoding: 'hex', excludeValues: true});
4809
+
4810
+ encode.number = function (buffers, data) {
4811
+ const maxLo = 0x80000000;
4812
+ const hi = (data / maxLo) << 0;
4813
+ const lo = (data % maxLo) << 0;
4814
+ const val = hi * maxLo + lo;
4815
+
4816
+ buffers.push(Buffer.from('i' + val + 'e'));
4817
+
4818
+ if (val !== data && !encode._floatConversionDetected) {
4819
+ encode._floatConversionDetected = true;
4820
+ console.warn(
4821
+ 'WARNING: Possible data corruption detected with value "' + data + '":',
4822
+ 'Bencoding only defines support for integers, value was converted to "' + val + '"'
4823
+ );
4824
+ console.trace();
4825
+ }
4781
4826
  };
4782
4827
 
4783
- // Internals
4784
- var hashes = crypto.getHashes ? crypto.getHashes().slice() : ['sha1', 'md5'];
4785
- hashes.push('passthrough');
4786
- var encodings = ['buffer', 'hex', 'binary', 'base64'];
4787
-
4788
- function applyDefaults(object, sourceOptions){
4789
- sourceOptions = sourceOptions || {};
4790
-
4791
- // create a copy rather than mutating
4792
- var options = {};
4793
- options.algorithm = sourceOptions.algorithm || 'sha1';
4794
- options.encoding = sourceOptions.encoding || 'hex';
4795
- options.excludeValues = sourceOptions.excludeValues ? true : false;
4796
- options.algorithm = options.algorithm.toLowerCase();
4797
- options.encoding = options.encoding.toLowerCase();
4798
- options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true; // default to false
4799
- options.respectType = sourceOptions.respectType === false ? false : true; // default to true
4800
- options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
4801
- options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
4802
- options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true; // default to false
4803
- options.unorderedSets = sourceOptions.unorderedSets === false ? false : true; // default to false
4804
- options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true; // default to true
4805
- options.replacer = sourceOptions.replacer || undefined;
4806
- options.excludeKeys = sourceOptions.excludeKeys || undefined;
4807
-
4808
- if(typeof object === 'undefined') {
4809
- throw new Error('Object argument required.');
4828
+ encode.dict = function (buffers, data) {
4829
+ buffers.push(buffD);
4830
+
4831
+ let j = 0;
4832
+ let k;
4833
+ // fix for issue #13 - sorted dicts
4834
+ const keys = Object.keys(data).sort();
4835
+ const kl = keys.length;
4836
+
4837
+ for (; j < kl; j++) {
4838
+ k = keys[j];
4839
+ if (data[k] == null) continue
4840
+ encode.string(buffers, k);
4841
+ encode._encode(buffers, data[k]);
4810
4842
  }
4811
4843
 
4812
- // if there is a case-insensitive match in the hashes list, accept it
4813
- // (i.e. SHA256 for sha256)
4814
- for (var i = 0; i < hashes.length; ++i) {
4815
- if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
4816
- options.algorithm = hashes[i];
4817
- }
4844
+ buffers.push(buffE);
4845
+ };
4846
+
4847
+ encode.dictMap = function (buffers, data) {
4848
+ buffers.push(buffD);
4849
+
4850
+ const keys = Array.from(data.keys()).sort();
4851
+
4852
+ for (const key of keys) {
4853
+ if (data.get(key) == null) continue
4854
+ Buffer.isBuffer(key)
4855
+ ? encode._encode(buffers, key)
4856
+ : encode.string(buffers, String(key));
4857
+ encode._encode(buffers, data.get(key));
4858
+ }
4859
+
4860
+ buffers.push(buffE);
4861
+ };
4862
+
4863
+ encode.list = function (buffers, data) {
4864
+ let i = 0;
4865
+ const c = data.length;
4866
+ buffers.push(buffL);
4867
+
4868
+ for (; i < c; i++) {
4869
+ if (data[i] == null) continue
4870
+ encode._encode(buffers, data[i]);
4818
4871
  }
4819
4872
 
4820
- if(hashes.indexOf(options.algorithm) === -1){
4821
- throw new Error('Algorithm "' + options.algorithm + '" not supported. ' +
4822
- 'supported values: ' + hashes.join(', '));
4873
+ buffers.push(buffE);
4874
+ };
4875
+
4876
+ encode.listSet = function (buffers, data) {
4877
+ buffers.push(buffL);
4878
+
4879
+ for (const item of data) {
4880
+ if (item == null) continue
4881
+ encode._encode(buffers, item);
4823
4882
  }
4824
4883
 
4825
- if(encodings.indexOf(options.encoding) === -1 &&
4826
- options.algorithm !== 'passthrough'){
4827
- throw new Error('Encoding "' + options.encoding + '" not supported. ' +
4828
- 'supported values: ' + encodings.join(', '));
4884
+ buffers.push(buffE);
4885
+ };
4886
+
4887
+ var encode_1 = encode;
4888
+
4889
+ const INTEGER_START = 0x69; // 'i'
4890
+ const STRING_DELIM = 0x3A; // ':'
4891
+ const DICTIONARY_START = 0x64; // 'd'
4892
+ const LIST_START = 0x6C; // 'l'
4893
+ const END_OF_TYPE = 0x65; // 'e'
4894
+
4895
+ /**
4896
+ * replaces parseInt(buffer.toString('ascii', start, end)).
4897
+ * For strings with less then ~30 charachters, this is actually a lot faster.
4898
+ *
4899
+ * @param {Buffer} data
4900
+ * @param {Number} start
4901
+ * @param {Number} end
4902
+ * @return {Number} calculated number
4903
+ */
4904
+ function getIntFromBuffer (buffer, start, end) {
4905
+ let sum = 0;
4906
+ let sign = 1;
4907
+
4908
+ for (let i = start; i < end; i++) {
4909
+ const num = buffer[i];
4910
+
4911
+ if (num < 58 && num >= 48) {
4912
+ sum = sum * 10 + (num - 48);
4913
+ continue
4914
+ }
4915
+
4916
+ if (i === start && num === 43) { // +
4917
+ continue
4918
+ }
4919
+
4920
+ if (i === start && num === 45) { // -
4921
+ sign = -1;
4922
+ continue
4923
+ }
4924
+
4925
+ if (num === 46) { // .
4926
+ // its a float. break here.
4927
+ break
4928
+ }
4929
+
4930
+ throw new Error('not a number: buffer[' + i + '] = ' + num)
4829
4931
  }
4830
4932
 
4831
- return options;
4933
+ return sum * sign
4832
4934
  }
4833
4935
 
4834
- /** Check if the given function is a native function */
4835
- function isNativeFunction(f) {
4836
- if ((typeof f) !== 'function') {
4837
- return false;
4936
+ /**
4937
+ * Decodes bencoded data.
4938
+ *
4939
+ * @param {Buffer} data
4940
+ * @param {Number} start (optional)
4941
+ * @param {Number} end (optional)
4942
+ * @param {String} encoding (optional)
4943
+ * @return {Object|Array|Buffer|String|Number}
4944
+ */
4945
+ function decode (data, start, end, encoding) {
4946
+ if (data == null || data.length === 0) {
4947
+ return null
4948
+ }
4949
+
4950
+ if (typeof start !== 'number' && encoding == null) {
4951
+ encoding = start;
4952
+ start = undefined;
4953
+ }
4954
+
4955
+ if (typeof end !== 'number' && encoding == null) {
4956
+ encoding = end;
4957
+ end = undefined;
4838
4958
  }
4839
- var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
4840
- return exp.exec(Function.prototype.toString.call(f)) != null;
4959
+
4960
+ decode.position = 0;
4961
+ decode.encoding = encoding || null;
4962
+
4963
+ decode.data = !(Buffer.isBuffer(data))
4964
+ ? Buffer.from(data)
4965
+ : data.slice(start, end);
4966
+
4967
+ decode.bytes = decode.data.length;
4968
+
4969
+ return decode.next()
4841
4970
  }
4842
4971
 
4843
- function hash(object, options) {
4844
- var hashingStream;
4972
+ decode.bytes = 0;
4973
+ decode.position = 0;
4974
+ decode.data = null;
4975
+ decode.encoding = null;
4976
+
4977
+ decode.next = function () {
4978
+ switch (decode.data[decode.position]) {
4979
+ case DICTIONARY_START:
4980
+ return decode.dictionary()
4981
+ case LIST_START:
4982
+ return decode.list()
4983
+ case INTEGER_START:
4984
+ return decode.integer()
4985
+ default:
4986
+ return decode.buffer()
4987
+ }
4988
+ };
4845
4989
 
4846
- if (options.algorithm !== 'passthrough') {
4847
- hashingStream = crypto.createHash(options.algorithm);
4848
- } else {
4849
- hashingStream = new PassThrough();
4990
+ decode.find = function (chr) {
4991
+ let i = decode.position;
4992
+ const c = decode.data.length;
4993
+ const d = decode.data;
4994
+
4995
+ while (i < c) {
4996
+ if (d[i] === chr) return i
4997
+ i++;
4850
4998
  }
4851
4999
 
4852
- if (typeof hashingStream.write === 'undefined') {
4853
- hashingStream.write = hashingStream.update;
4854
- hashingStream.end = hashingStream.update;
5000
+ throw new Error(
5001
+ 'Invalid data: Missing delimiter "' +
5002
+ String.fromCharCode(chr) + '" [0x' +
5003
+ chr.toString(16) + ']'
5004
+ )
5005
+ };
5006
+
5007
+ decode.dictionary = function () {
5008
+ decode.position++;
5009
+
5010
+ const dict = {};
5011
+
5012
+ while (decode.data[decode.position] !== END_OF_TYPE) {
5013
+ dict[decode.buffer()] = decode.next();
4855
5014
  }
4856
5015
 
4857
- var hasher = typeHasher(options, hashingStream);
4858
- hasher.dispatch(object);
4859
- if (!hashingStream.update) {
4860
- hashingStream.end('');
5016
+ decode.position++;
5017
+
5018
+ return dict
5019
+ };
5020
+
5021
+ decode.list = function () {
5022
+ decode.position++;
5023
+
5024
+ const lst = [];
5025
+
5026
+ while (decode.data[decode.position] !== END_OF_TYPE) {
5027
+ lst.push(decode.next());
4861
5028
  }
4862
5029
 
4863
- if (hashingStream.digest) {
4864
- return hashingStream.digest(options.encoding === 'buffer' ? undefined : options.encoding);
5030
+ decode.position++;
5031
+
5032
+ return lst
5033
+ };
5034
+
5035
+ decode.integer = function () {
5036
+ const end = decode.find(END_OF_TYPE);
5037
+ const number = getIntFromBuffer(decode.data, decode.position + 1, end);
5038
+
5039
+ decode.position += end + 1 - decode.position;
5040
+
5041
+ return number
5042
+ };
5043
+
5044
+ decode.buffer = function () {
5045
+ let sep = decode.find(STRING_DELIM);
5046
+ const length = getIntFromBuffer(decode.data, decode.position, sep);
5047
+ const end = ++sep + length;
5048
+
5049
+ decode.position = end;
5050
+
5051
+ return decode.encoding
5052
+ ? decode.data.toString(decode.encoding, sep, end)
5053
+ : decode.data.slice(sep, end)
5054
+ };
5055
+
5056
+ var decode_1 = decode;
5057
+
5058
+ const { digitCount, getType } = util.exports;
5059
+
5060
+ function listLength (list) {
5061
+ let length = 1 + 1; // type marker + end-of-type marker
5062
+
5063
+ for (const value of list) {
5064
+ length += encodingLength(value);
4865
5065
  }
4866
5066
 
4867
- var buf = hashingStream.read();
4868
- if (options.encoding === 'buffer') {
4869
- return buf;
5067
+ return length
5068
+ }
5069
+
5070
+ function mapLength (map) {
5071
+ let length = 1 + 1; // type marker + end-of-type marker
5072
+
5073
+ for (const [key, value] of map) {
5074
+ const keyLength = Buffer.byteLength(key);
5075
+ length += digitCount(keyLength) + 1 + keyLength;
5076
+ length += encodingLength(value);
4870
5077
  }
4871
5078
 
4872
- return buf.toString(options.encoding);
5079
+ return length
4873
5080
  }
4874
5081
 
4875
- /**
4876
- * Expose streaming API
4877
- *
4878
- * @param {object} object Value to serialize
4879
- * @param {object} options Options, as for hash()
4880
- * @param {object} stream A stream to write the serializiation to
4881
- * @api public
4882
- */
4883
- exports.writeToStream = function(object, options, stream) {
4884
- if (typeof stream === 'undefined') {
4885
- stream = options;
4886
- options = {};
5082
+ function objectLength (value) {
5083
+ let length = 1 + 1; // type marker + end-of-type marker
5084
+ const keys = Object.keys(value);
5085
+
5086
+ for (let i = 0; i < keys.length; i++) {
5087
+ const keyLength = Buffer.byteLength(keys[i]);
5088
+ length += digitCount(keyLength) + 1 + keyLength;
5089
+ length += encodingLength(value[keys[i]]);
4887
5090
  }
4888
5091
 
4889
- options = applyDefaults(object, options);
5092
+ return length
5093
+ }
4890
5094
 
4891
- return typeHasher(options, stream).dispatch(object);
4892
- };
5095
+ function stringLength (value) {
5096
+ const length = Buffer.byteLength(value);
5097
+ return digitCount(length) + 1 + length
5098
+ }
4893
5099
 
4894
- function typeHasher(options, writeTo, context){
4895
- context = context || [];
4896
- var write = function(str) {
4897
- if (writeTo.update) {
4898
- return writeTo.update(str, 'utf8');
4899
- } else {
4900
- return writeTo.write(str, 'utf8');
4901
- }
4902
- };
4903
-
4904
- return {
4905
- dispatch: function(value){
4906
- if (options.replacer) {
4907
- value = options.replacer(value);
4908
- }
4909
-
4910
- var type = typeof value;
4911
- if (value === null) {
4912
- type = 'null';
4913
- }
4914
-
4915
- //console.log("[DEBUG] Dispatch: ", value, "->", type, " -> ", "_" + type);
4916
-
4917
- return this['_' + type](value);
4918
- },
4919
- _object: function(object) {
4920
- var pattern = (/\[object (.*)\]/i);
4921
- var objString = Object.prototype.toString.call(object);
4922
- var objType = pattern.exec(objString);
4923
- if (!objType) { // object type did not match [object ...]
4924
- objType = 'unknown:[' + objString + ']';
4925
- } else {
4926
- objType = objType[1]; // take only the class name
4927
- }
4928
-
4929
- objType = objType.toLowerCase();
4930
-
4931
- var objectNumber = null;
4932
-
4933
- if ((objectNumber = context.indexOf(object)) >= 0) {
4934
- return this.dispatch('[CIRCULAR:' + objectNumber + ']');
4935
- } else {
4936
- context.push(object);
4937
- }
4938
-
4939
- if (typeof Buffer !== 'undefined' && Buffer.isBuffer && Buffer.isBuffer(object)) {
4940
- write('buffer:');
4941
- return write(object);
4942
- }
4943
-
4944
- if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction') {
4945
- if(this['_' + objType]) {
4946
- this['_' + objType](object);
4947
- } else if (options.ignoreUnknown) {
4948
- return write('[' + objType + ']');
4949
- } else {
4950
- throw new Error('Unknown object type "' + objType + '"');
4951
- }
4952
- }else {
4953
- var keys = Object.keys(object);
4954
- if (options.unorderedObjects) {
4955
- keys = keys.sort();
4956
- }
4957
- // Make sure to incorporate special properties, so
4958
- // Types with different prototypes will produce
4959
- // a different hash and objects derived from
4960
- // different functions (`new Foo`, `new Bar`) will
4961
- // produce different hashes.
4962
- // We never do this for native functions since some
4963
- // seem to break because of that.
4964
- if (options.respectType !== false && !isNativeFunction(object)) {
4965
- keys.splice(0, 0, 'prototype', '__proto__', 'constructor');
4966
- }
4967
-
4968
- if (options.excludeKeys) {
4969
- keys = keys.filter(function(key) { return !options.excludeKeys(key); });
4970
- }
4971
-
4972
- write('object:' + keys.length + ':');
4973
- var self = this;
4974
- return keys.forEach(function(key){
4975
- self.dispatch(key);
4976
- write(':');
4977
- if(!options.excludeValues) {
4978
- self.dispatch(object[key]);
4979
- }
4980
- write(',');
4981
- });
4982
- }
4983
- },
4984
- _array: function(arr, unordered){
4985
- unordered = typeof unordered !== 'undefined' ? unordered :
4986
- options.unorderedArrays !== false; // default to options.unorderedArrays
4987
-
4988
- var self = this;
4989
- write('array:' + arr.length + ':');
4990
- if (!unordered || arr.length <= 1) {
4991
- return arr.forEach(function(entry) {
4992
- return self.dispatch(entry);
4993
- });
4994
- }
4995
-
4996
- // the unordered case is a little more complicated:
4997
- // since there is no canonical ordering on objects,
4998
- // i.e. {a:1} < {a:2} and {a:1} > {a:2} are both false,
4999
- // we first serialize each entry using a PassThrough stream
5000
- // before sorting.
5001
- // also: we can’t use the same context array for all entries
5002
- // since the order of hashing should *not* matter. instead,
5003
- // we keep track of the additions to a copy of the context array
5004
- // and add all of them to the global context array when we’re done
5005
- var contextAdditions = [];
5006
- var entries = arr.map(function(entry) {
5007
- var strm = new PassThrough();
5008
- var localContext = context.slice(); // make copy
5009
- var hasher = typeHasher(options, strm, localContext);
5010
- hasher.dispatch(entry);
5011
- // take only what was added to localContext and append it to contextAdditions
5012
- contextAdditions = contextAdditions.concat(localContext.slice(context.length));
5013
- return strm.read().toString();
5014
- });
5015
- context = context.concat(contextAdditions);
5016
- entries.sort();
5017
- return this._array(entries, false);
5018
- },
5019
- _date: function(date){
5020
- return write('date:' + date.toJSON());
5021
- },
5022
- _symbol: function(sym){
5023
- return write('symbol:' + sym.toString());
5024
- },
5025
- _error: function(err){
5026
- return write('error:' + err.toString());
5027
- },
5028
- _boolean: function(bool){
5029
- return write('bool:' + bool.toString());
5030
- },
5031
- _string: function(string){
5032
- write('string:' + string.length + ':');
5033
- write(string.toString());
5034
- },
5035
- _function: function(fn){
5036
- write('fn:');
5037
- if (isNativeFunction(fn)) {
5038
- this.dispatch('[native]');
5039
- } else {
5040
- this.dispatch(fn.toString());
5041
- }
5042
-
5043
- if (options.respectFunctionNames !== false) {
5044
- // Make sure we can still distinguish native functions
5045
- // by their name, otherwise String and Function will
5046
- // have the same hash
5047
- this.dispatch("function-name:" + String(fn.name));
5048
- }
5049
-
5050
- if (options.respectFunctionProperties) {
5051
- this._object(fn);
5052
- }
5053
- },
5054
- _number: function(number){
5055
- return write('number:' + number.toString());
5056
- },
5057
- _xml: function(xml){
5058
- return write('xml:' + xml.toString());
5059
- },
5060
- _null: function() {
5061
- return write('Null');
5062
- },
5063
- _undefined: function() {
5064
- return write('Undefined');
5065
- },
5066
- _regexp: function(regex){
5067
- return write('regex:' + regex.toString());
5068
- },
5069
- _uint8array: function(arr){
5070
- write('uint8array:');
5071
- return this.dispatch(Array.prototype.slice.call(arr));
5072
- },
5073
- _uint8clampedarray: function(arr){
5074
- write('uint8clampedarray:');
5075
- return this.dispatch(Array.prototype.slice.call(arr));
5076
- },
5077
- _int8array: function(arr){
5078
- write('int8array:');
5079
- return this.dispatch(Array.prototype.slice.call(arr));
5080
- },
5081
- _uint16array: function(arr){
5082
- write('uint16array:');
5083
- return this.dispatch(Array.prototype.slice.call(arr));
5084
- },
5085
- _int16array: function(arr){
5086
- write('int16array:');
5087
- return this.dispatch(Array.prototype.slice.call(arr));
5088
- },
5089
- _uint32array: function(arr){
5090
- write('uint32array:');
5091
- return this.dispatch(Array.prototype.slice.call(arr));
5092
- },
5093
- _int32array: function(arr){
5094
- write('int32array:');
5095
- return this.dispatch(Array.prototype.slice.call(arr));
5096
- },
5097
- _float32array: function(arr){
5098
- write('float32array:');
5099
- return this.dispatch(Array.prototype.slice.call(arr));
5100
- },
5101
- _float64array: function(arr){
5102
- write('float64array:');
5103
- return this.dispatch(Array.prototype.slice.call(arr));
5104
- },
5105
- _arraybuffer: function(arr){
5106
- write('arraybuffer:');
5107
- return this.dispatch(new Uint8Array(arr));
5108
- },
5109
- _url: function(url) {
5110
- return write('url:' + url.toString());
5111
- },
5112
- _map: function(map) {
5113
- write('map:');
5114
- var arr = Array.from(map);
5115
- return this._array(arr, options.unorderedSets !== false);
5116
- },
5117
- _set: function(set) {
5118
- write('set:');
5119
- var arr = Array.from(set);
5120
- return this._array(arr, options.unorderedSets !== false);
5121
- },
5122
- _file: function(file) {
5123
- write('file:');
5124
- return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
5125
- },
5126
- _blob: function() {
5127
- if (options.ignoreUnknown) {
5128
- return write('[blob]');
5129
- }
5130
-
5131
- throw Error('Hashing Blob objects is currently not supported\n' +
5132
- '(see https://github.com/puleos/object-hash/issues/26)\n' +
5133
- 'Use "options.replacer" or "options.ignoreUnknown"\n');
5134
- },
5135
- _domwindow: function() { return write('domwindow'); },
5136
- _bigint: function(number){
5137
- return write('bigint:' + number.toString());
5138
- },
5139
- /* Node.js standard native objects */
5140
- _process: function() { return write('process'); },
5141
- _timer: function() { return write('timer'); },
5142
- _pipe: function() { return write('pipe'); },
5143
- _tcp: function() { return write('tcp'); },
5144
- _udp: function() { return write('udp'); },
5145
- _tty: function() { return write('tty'); },
5146
- _statwatcher: function() { return write('statwatcher'); },
5147
- _securecontext: function() { return write('securecontext'); },
5148
- _connection: function() { return write('connection'); },
5149
- _zlib: function() { return write('zlib'); },
5150
- _context: function() { return write('context'); },
5151
- _nodescript: function() { return write('nodescript'); },
5152
- _httpparser: function() { return write('httpparser'); },
5153
- _dataview: function() { return write('dataview'); },
5154
- _signal: function() { return write('signal'); },
5155
- _fsevent: function() { return write('fsevent'); },
5156
- _tlswrap: function() { return write('tlswrap'); },
5157
- };
5100
+ function arrayBufferLength (value) {
5101
+ const length = value.byteLength - value.byteOffset;
5102
+ return digitCount(length) + 1 + length
5158
5103
  }
5159
5104
 
5160
- // Mini-implementation of stream.PassThrough
5161
- // We are far from having need for the full implementation, and we can
5162
- // make assumptions like "many writes, then only one final read"
5163
- // and we can ignore encoding specifics
5164
- function PassThrough() {
5165
- return {
5166
- buf: '',
5105
+ function encodingLength (value) {
5106
+ const length = 0;
5167
5107
 
5168
- write: function(b) {
5169
- this.buf += b;
5170
- },
5108
+ if (value == null) return length
5171
5109
 
5172
- end: function(b) {
5173
- this.buf += b;
5174
- },
5110
+ const type = getType(value);
5175
5111
 
5176
- read: function() {
5177
- return this.buf;
5178
- }
5179
- };
5112
+ switch (type) {
5113
+ case 'buffer': return digitCount(value.length) + 1 + value.length
5114
+ case 'arraybufferview': return arrayBufferLength(value)
5115
+ case 'string': return stringLength(value)
5116
+ case 'array': case 'set': return listLength(value)
5117
+ case 'number': return 1 + digitCount(Math.floor(value)) + 1
5118
+ case 'bigint': return 1 + value.toString().length + 1
5119
+ case 'object': return objectLength(value)
5120
+ case 'map': return mapLength(value)
5121
+ default:
5122
+ throw new TypeError(`Unsupported value of type "${type}"`)
5123
+ }
5180
5124
  }
5181
- }(objectHash, objectHash.exports));
5182
5125
 
5183
- var hash = objectHash.exports;
5126
+ var encodingLength_1 = encodingLength;
5127
+
5128
+ (function (module) {
5129
+ const bencode = module.exports;
5130
+
5131
+ bencode.encode = encode_1;
5132
+ bencode.decode = decode_1;
5133
+
5134
+ /**
5135
+ * Determines the amount of bytes
5136
+ * needed to encode the given value
5137
+ * @param {Object|Array|Buffer|String|Number|Boolean} value
5138
+ * @return {Number} byteCount
5139
+ */
5140
+ bencode.byteLength = bencode.encodingLength = encodingLength_1;
5141
+ }(lib));
5142
+
5143
+ var bencode = lib.exports;
5184
5144
 
5185
5145
  const _hoisted_1$d = { class: "" };
5186
5146
  var script$d = /*#__PURE__*/ vue.defineComponent({
@@ -5194,7 +5154,7 @@ var script$d = /*#__PURE__*/ vue.defineComponent({
5194
5154
  * объекта.
5195
5155
  * */
5196
5156
  const parsedConfig = vue.computed(() => props.config.map(elem => {
5197
- return Object.assign(Object.assign({}, elem), { hash: hash(elem).toString() });
5157
+ return Object.assign(Object.assign({}, elem), { hash: bencode.encode(elem).toString() });
5198
5158
  }));
5199
5159
  vue.reactive({
5200
5160
  activeRow: null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.310",
3
+ "version": "1.0.311",
4
4
  "description": "----",
5
5
  "author": "",
6
6
  "scripts": {
@@ -16,9 +16,9 @@
16
16
  "main": "dist/index.js",
17
17
  "dependencies": {
18
18
  "@rollup/plugin-commonjs": "^21.0.1",
19
+ "bencode": "^2.0.3",
19
20
  "date-and-time": "^2.0.1",
20
21
  "jenesius-event-emitter": "^1.0.4",
21
- "object-hash": "^3.0.0",
22
22
  "rollup-plugin-styles": "^4.0.0",
23
23
  "rollup-plugin-typescript2": "^0.31.1",
24
24
  "socket.io": "^4.4.1",
@@ -30,6 +30,7 @@
30
30
  "@babel/preset-typescript": "^7.16.5",
31
31
  "@rollup/plugin-node-resolve": "^13.1.3",
32
32
  "@rollup/plugin-typescript": "^8.3.0",
33
+ "@types/bencode": "^2.0.1",
33
34
  "@types/date-and-time": "^0.13.0",
34
35
  "@types/jest": "^24.9.1",
35
36
  "@types/object-hash": "^2.2.1",