@loaders.gl/crypto 3.1.0-alpha.4 → 3.1.0-alpha.5

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 (57) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/dist.min.js +1 -1
  3. package/dist/es5/bundle.js +1 -1
  4. package/dist/es5/bundle.js.map +1 -1
  5. package/dist/es5/index.js +11 -11
  6. package/dist/es5/index.js.map +1 -1
  7. package/dist/es5/lib/algorithms/crc32.js +18 -29
  8. package/dist/es5/lib/algorithms/crc32.js.map +1 -1
  9. package/dist/es5/lib/algorithms/crc32c.js +18 -30
  10. package/dist/es5/lib/algorithms/crc32c.js.map +1 -1
  11. package/dist/es5/lib/algorithms/md5-wasm.js +25 -36
  12. package/dist/es5/lib/algorithms/md5-wasm.js.map +1 -1
  13. package/dist/es5/lib/crc32-hash.js +39 -185
  14. package/dist/es5/lib/crc32-hash.js.map +1 -1
  15. package/dist/es5/lib/crc32c-hash.js +38 -184
  16. package/dist/es5/lib/crc32c-hash.js.map +1 -1
  17. package/dist/es5/lib/crypto-hash.js +49 -225
  18. package/dist/es5/lib/crypto-hash.js.map +1 -1
  19. package/dist/es5/lib/hash.js +21 -175
  20. package/dist/es5/lib/hash.js.map +1 -1
  21. package/dist/es5/lib/md5-hash.js +13 -71
  22. package/dist/es5/lib/md5-hash.js.map +1 -1
  23. package/dist/es5/lib/node-hash.js +33 -181
  24. package/dist/es5/lib/node-hash.js.map +1 -1
  25. package/dist/es5/lib/sha256-hash.js +7 -33
  26. package/dist/es5/lib/sha256-hash.js.map +1 -1
  27. package/dist/es5/lib/utils/base64-utils.js +13 -13
  28. package/dist/es5/lib/utils/base64-utils.js.map +1 -1
  29. package/dist/es5/lib/utils/digest-utils.js +2 -4
  30. package/dist/es5/lib/utils/digest-utils.js.map +1 -1
  31. package/dist/es5/workers/worker.js +17 -55
  32. package/dist/es5/workers/worker.js.map +1 -1
  33. package/dist/esm/index.js +1 -1
  34. package/dist/esm/lib/utils/base64-utils.js +1 -1
  35. package/dist/esm/lib/utils/base64-utils.js.map +1 -1
  36. package/dist/esm/lib/utils/digest-utils.js +2 -2
  37. package/dist/esm/lib/utils/digest-utils.js.map +1 -1
  38. package/dist/esm/workers/worker.js +1 -1
  39. package/dist/esm/workers/worker.js.map +1 -1
  40. package/dist/index.d.ts +32 -0
  41. package/dist/lib/algorithms/crc32.d.ts +8 -0
  42. package/dist/lib/algorithms/crc32c.d.ts +10 -0
  43. package/dist/lib/algorithms/md5-wasm.d.ts +4 -0
  44. package/dist/lib/crc32-hash.d.ts +17 -0
  45. package/dist/lib/crc32c-hash.d.ts +21 -0
  46. package/dist/lib/crypto-hash.d.ts +31 -0
  47. package/dist/lib/hash.d.ts +21 -0
  48. package/dist/lib/md5-hash.d.ts +14 -0
  49. package/dist/lib/node-hash.d.ts +27 -0
  50. package/dist/lib/sha256-hash.d.ts +18 -0
  51. package/dist/lib/utils/base64-utils.d.ts +5 -0
  52. package/dist/lib/utils/digest-utils.d.ts +8 -0
  53. package/dist/types.d.ts +9 -0
  54. package/dist/worker.js +22 -22
  55. package/dist/worker.js.map +1 -1
  56. package/dist/workers/worker.d.ts +3 -0
  57. package/package.json +6 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/workers/worker.ts"],"names":["data","options","operation","CRC32Hash","hash","CRC32CHash","MD5Hash","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAKA;AAAA,uEAAa,iBAAOA,IAAP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAaC,YAAAA,OAAb,2DAAuB,EAAvB;AAEJC,YAAAA,SAFI,GAESD,OAFT,CAEJC,SAFI;AAAA,0BAIHA,SAJG;AAAA,4CAKJ,OALI,uBAOJ,QAPI,uBASJ,KATI;AAAA;;AAAA;AAAA;AAAA,mBAMM,IAAIC,oBAAJ,CAAcF,OAAd,EAAuBG,IAAvB,CAA4BJ,IAA5B,CANN;;AAAA;AAAA;;AAAA;AAAA;AAAA,mBAQM,IAAIK,sBAAJ,CAAeJ,OAAf,EAAwBG,IAAxB,CAA6BJ,IAA7B,CARN;;AAAA;AAAA;;AAAA;AAAA;AAAA,mBAUM,IAAIM,gBAAJ,CAAYL,OAAZ,EAAqBG,IAArB,CAA0BJ,IAA1B,CAVN;;AAAA;AAAA;;AAAA;AAAA,kBAYD,IAAIO,KAAJ,2BAA6BL,SAA7B,EAZC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAb;;AAAA;AAAA;AAAA;AAAA","sourcesContent":["import {createWorker} from '@loaders.gl/worker-utils';\nimport {CRC32Hash} from '../lib/crc32-hash';\nimport {CRC32CHash} from '../lib/crc32c-hash';\nimport {MD5Hash} from '../lib/md5-hash';\n\n// Assuming we can bundle as module\nexport {CRC32Hash, CRC32CHash};\n\ncreateWorker(async (data, options = {}) => {\n // @ts-ignore\n const {operation} = options;\n\n switch (operation) {\n case 'crc32':\n return await new CRC32Hash(options).hash(data);\n case 'crc32c':\n return await new CRC32CHash(options).hash(data);\n case 'md5':\n return await new MD5Hash(options).hash(data);\n default:\n throw new Error(`invalid option: ${operation}`);\n }\n});\n"],"file":"worker.js"}
1
+ {"version":3,"sources":["../../../src/workers/worker.ts"],"names":["data","options","operation","CRC32Hash","hash","CRC32CHash","MD5Hash","Error"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAKA,+BAAa,OAAOA,IAAP,EAAaC,OAAO,GAAG,EAAvB,KAA8B;AAEzC,QAAM;AAACC,IAAAA;AAAD,MAAcD,OAApB;;AAEA,UAAQC,SAAR;AACE,SAAK,OAAL;AACE,aAAO,MAAM,IAAIC,oBAAJ,CAAcF,OAAd,EAAuBG,IAAvB,CAA4BJ,IAA5B,CAAb;;AACF,SAAK,QAAL;AACE,aAAO,MAAM,IAAIK,sBAAJ,CAAeJ,OAAf,EAAwBG,IAAxB,CAA6BJ,IAA7B,CAAb;;AACF,SAAK,KAAL;AACE,aAAO,MAAM,IAAIM,gBAAJ,CAAYL,OAAZ,EAAqBG,IAArB,CAA0BJ,IAA1B,CAAb;;AACF;AACE,YAAM,IAAIO,KAAJ,2BAA6BL,SAA7B,EAAN;AARJ;AAUD,CAdD","sourcesContent":["import {createWorker} from '@loaders.gl/worker-utils';\nimport {CRC32Hash} from '../lib/crc32-hash';\nimport {CRC32CHash} from '../lib/crc32c-hash';\nimport {MD5Hash} from '../lib/md5-hash';\n\n// Assuming we can bundle as module\nexport {CRC32Hash, CRC32CHash};\n\ncreateWorker(async (data, options = {}) => {\n // @ts-ignore\n const {operation} = options;\n\n switch (operation) {\n case 'crc32':\n return await new CRC32Hash(options).hash(data);\n case 'crc32c':\n return await new CRC32CHash(options).hash(data);\n case 'md5':\n return await new MD5Hash(options).hash(data);\n default:\n throw new Error(`invalid option: ${operation}`);\n }\n});\n"],"file":"worker.js"}
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ export { SHA256Hash } from './lib/sha256-hash';
5
5
  export { CryptoHash } from './lib/crypto-hash';
6
6
  export { NodeHash } from './lib/node-hash';
7
7
  export { hexToBase64 as _hexToBase64, toHex as _toHex } from './lib/utils/digest-utils';
8
- const VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
8
+ const VERSION = typeof "3.1.0-alpha.5" !== 'undefined' ? "3.1.0-alpha.5" : 'latest';
9
9
  export const CryptoWorker = {
10
10
  id: 'crypto',
11
11
  name: 'CRC32, CRC32c and MD5 Hashes',
@@ -1,5 +1,5 @@
1
1
  export function toBase64(string) {
2
- string = `${string}`;
2
+ string = "".concat(string);
3
3
 
4
4
  for (let i = 0; i < string.length; i++) {
5
5
  if (string.charCodeAt(i) > 255) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/utils/base64-utils.js"],"names":["toBase64","string","i","length","charCodeAt","out","groupsOfSix","undefined","j","btoaLookup","idx","String","fromC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,MAAAA,WAAW,CAAC,CAAD,CAAX,GAAiBL,MAAM,CAACG,UAAP,CAAkBF,CAAC,GAAG,CAAtB,IAA2B,IAA5C;AACD;;AACD,SAAK,IAAIM,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,WAAW,CAACH,MAAhC,EAAwCK,CAAC,EAAzC,EAA6C;AAC3C,UAAI,OAAOF,WAAW,CAACE,CAAD,CAAlB,KAA0B,WAA9B,EAA2C;AACzCH,QAAAA,GAAG,IAAI,GAAP;AACD,OAFD,MAEO;AACLA,QAAAA,GAAG,IAAII,UAAU,CAACH,WAAW,CAACE,CAAD,CAAZ,CAAjB;AACD;AACF;AACF;;AACD,SAAOH,GAAP;AACD;;AAMD,SAASI,UAAT,CAAoBC,GAApB,EAAyB;AACvB,MAAIA,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,IAAIN,UAAJ,CAAe,CAAf,CAA1B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AACD,MAAIA,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AAED,SAAOH,SAAP;AACD","sourcesContent":["/**\n * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references\n * RFC 4648.\n */\nexport function toBase64(string) {\n // String conversion as required by Web IDL.\n string = `${string}`;\n // \"The btoa() method must throw an \"InvalidCharacterError\" DOMException if\n // data contains any character whose code point is greater than U+00FF.\"\n for (let i = 0; i < string.length; i++) {\n if (string.charCodeAt(i) > 255) {\n return null;\n }\n }\n let out = '';\n for (let i = 0; i < string.length; i += 3) {\n /** @type {Array[4]} */\n const groupsOfSix = [undefined, undefined, undefined, undefined];\n groupsOfSix[0] = string.charCodeAt(i) >> 2;\n groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;\n if (string.length > i + 1) {\n groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;\n groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;\n }\n if (string.length > i + 2) {\n groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;\n groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;\n }\n for (let j = 0; j < groupsOfSix.length; j++) {\n if (typeof groupsOfSix[j] === 'undefined') {\n out += '=';\n } else {\n out += btoaLookup(groupsOfSix[j]);\n }\n }\n }\n return out;\n}\n\n/**\n * Lookup table for btoa(), which converts a six-bit number into the\n * corresponding ASCII character.\n */\nfunction btoaLookup(idx) {\n if (idx < 26) {\n return String.fromCharCode(idx + 'A'.charCodeAt(0));\n }\n if (idx < 52) {\n return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));\n }\n if (idx < 62) {\n return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));\n }\n if (idx === 62) {\n return '+';\n }\n if (idx === 63) {\n return '/';\n }\n // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the teststring.\n return undefined;\n}\n"],"file":"base64-utils.js"}
1
+ {"version":3,"sources":["../../../../src/lib/utils/base64-utils.js"],"names":["toBase64","string","i","length","charCodeAt","out","groupsOfSix","undefined","j","btoaLookup","idx","String","fromCharCode"],"mappings":"AAIA,OAAO,SAASA,QAAT,CAAkBC,MAAlB,EAA0B;AAE/BA,EAAAA,MAAM,aAAMA,MAAN,CAAN;;AAGA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,EAApC,E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6C;AAC3C,UAAI,OAAOF,WAAW,CAACE,CAAD,CAAlB,KAA0B,WAA9B,EAA2C;AACzCH,QAAAA,GAAG,IAAI,GAAP;AACD,OAFD,MAEO;AACLA,QAAAA,GAAG,IAAII,UAAU,CAACH,WAAW,CAACE,CAAD,CAAZ,CAAjB;AACD;AACF;AACF;;AACD,SAAOH,GAAP;AACD;;AAMD,SAASI,UAAT,CAAoBC,GAApB,EAAyB;AACvB,MAAIA,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,IAAIN,UAAJ,CAAe,CAAf,CAA1B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AACD,MAAIA,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AAED,SAAOH,SAAP;AACD","sourcesContent":["/**\n * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references\n * RFC 4648.\n */\nexport function toBase64(string) {\n // String conversion as required by Web IDL.\n string = `${string}`;\n // \"The btoa() method must throw an \"InvalidCharacterError\" DOMException if\n // data contains any character whose code point is greater than U+00FF.\"\n for (let i = 0; i < string.length; i++) {\n if (string.charCodeAt(i) > 255) {\n return null;\n }\n }\n let out = '';\n for (let i = 0; i < string.length; i += 3) {\n /** @type {Array[4]} */\n const groupsOfSix = [undefined, undefined, undefined, undefined];\n groupsOfSix[0] = string.charCodeAt(i) >> 2;\n groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;\n if (string.length > i + 1) {\n groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;\n groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;\n }\n if (string.length > i + 2) {\n groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;\n groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;\n }\n for (let j = 0; j < groupsOfSix.length; j++) {\n if (typeof groupsOfSix[j] === 'undefined') {\n out += '=';\n } else {\n out += btoaLookup(groupsOfSix[j]);\n }\n }\n }\n return out;\n}\n\n/**\n * Lookup table for btoa(), which converts a six-bit number into the\n * corresponding ASCII character.\n */\nfunction btoaLookup(idx) {\n if (idx < 26) {\n return String.fromCharCode(idx + 'A'.charCodeAt(0));\n }\n if (idx < 52) {\n return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));\n }\n if (idx < 62) {\n return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));\n }\n if (idx === 62) {\n return '+';\n }\n if (idx === 63) {\n return '/';\n }\n // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the teststring.\n return undefined;\n}\n"],"file":"base64-utils.js"}
@@ -1,11 +1,11 @@
1
1
  import { toBase64 } from './base64-utils';
2
2
  export function toHex(cipher) {
3
3
  const hexString = cipher.toString(16);
4
- return hexString === '0' ? `0${hexString}` : hexString;
4
+ return hexString === '0' ? "0".concat(hexString) : hexString;
5
5
  }
6
6
  export function hexToBase64(hexstring) {
7
7
  if (hexstring.length % 2 !== 0) {
8
- hexstring = `0${hexstring}`;
8
+ hexstring = "0".concat(hexstring);
9
9
  }
10
10
 
11
11
  const string = hexstring.match(/\w{2}/g).map(a => String.fromCharCode(parseInt(a, 16))).join('');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/utils/digest-utils.js"],"names":["toBase64","toHex","cipher","hexString","toString","hexToBase64","hexstring","length","string","match","map","a","String","fromCharCode","parseInt","join"],"mappings":"AAAA,SAAQA,QAAR,QAAuB,gBAAvB;AAKA,OAAO,SAASC,KAAT,CAAeC,MAAf,EAAuB;AAC5B,QAAMC,SAAS,GAAGD,MAAM,CAACE,QAAP,CAAgB,EAAhB,CAAlB;AACA,SAAOD,SAAS,KAAK,GAAd,GAAqB,IAAGA,SAAU,EAAlC,GAAsCA,SAA7C;AACD;AAKD,OAAO,SAASE,WAAT,CAAqBC,SAArB,EAAgC;AAGrC,MAAIA,SAAS,CAACC,MAAV,GAAmB,CAAnB,KAAyB,CAA7B,EAAgC;AAC9BD,IAAAA,SAAS,GAAI,IAAGA,SAAU,EAA1B;AACD;;AACD,QAAME,MAAM,GAAGF,SAAS,CACrBG,KADY,CACN,QADM,EAEZC,GAFY,CAEPC,CAAD,IAAOC,MAAM,CAACC,YAAP,CAAoBC,QAAQ,CAACH,CAAD,EAAI,EAAJ,CAA5B,CAFC,EAGZI,IAHY,CAGP,EAHO,CAAf;AAIA,SAAOf,QAAQ,CAACQ,MAAD,CAAf;AACD","sourcesContent":["import {toBase64} from './base64-utils';\n\n/**\n *\n */\nexport function toHex(cipher) {\n const hexString = cipher.toString(16);\n return hexString === '0' ? `0${hexString}` : hexString;\n}\n\n/**\n *\n */\nexport function hexToBase64(hexstring) {\n // Add leading zero to keep even count of digits\n // eg. f85d741 => 0f85d741\n if (hexstring.length % 2 !== 0) {\n hexstring = `0${hexstring}`;\n }\n const string = hexstring\n .match(/\\w{2}/g)\n .map((a) => String.fromCharCode(parseInt(a, 16)))\n .join('');\n return toBase64(string);\n}\n"],"file":"digest-utils.js"}
1
+ {"version":3,"sources":["../../../../src/lib/utils/digest-utils.js"],"names":["toBase64","toHex","cipher","hexString","toString","hexToBase64","hexstring","length","string","match","map","a","String","fromCharCode","parseInt","join"],"mappings":"AAAA,SAAQA,QAAR,QAAuB,gBAAvB;AAKA,OAAO,SAASC,KAAT,CAAeC,MAAf,EAAuB;AAC5B,QAAMC,SAAS,GAAGD,MAAM,CAACE,QAAP,CAAgB,EAAhB,CAAlB;AACA,SAAOD,SAAS,KAAK,GAAd,cAAwBA,SAAxB,IAAsCA,SAA7C;AACD;AAKD,OAAO,SAASE,WAAT,CAAqBC,SAArB,EAAgC;AAGrC,MAAIA,SAAS,CAACC,MAAV,GAAmB,CAAnB,KAAyB,CAA7B,EAAgC;AAC9BD,IAAAA,SAAS,cAAOA,SAAP,CAAT;AACD;;AACD,QAAME,MAAM,GAAGF,SAAS,CACrBG,KADY,CACN,QADM,EAEZC,GAFY,CAEPC,CAAD,IAAOC,MAAM,CAACC,YAAP,CAAoBC,QAAQ,CAACH,CAAD,EAAI,EAAJ,CAA5B,CAFC,EAGZI,IAHY,CAGP,EAHO,CAAf;AAIA,SAAOf,QAAQ,CAACQ,MAAD,CAAf;AACD","sourcesContent":["import {toBase64} from './base64-utils';\n\n/**\n *\n */\nexport function toHex(cipher) {\n const hexString = cipher.toString(16);\n return hexString === '0' ? `0${hexString}` : hexString;\n}\n\n/**\n *\n */\nexport function hexToBase64(hexstring) {\n // Add leading zero to keep even count of digits\n // eg. f85d741 => 0f85d741\n if (hexstring.length % 2 !== 0) {\n hexstring = `0${hexstring}`;\n }\n const string = hexstring\n .match(/\\w{2}/g)\n .map((a) => String.fromCharCode(parseInt(a, 16)))\n .join('');\n return toBase64(string);\n}\n"],"file":"digest-utils.js"}
@@ -19,7 +19,7 @@ createWorker(async (data, options = {}) => {
19
19
  return await new MD5Hash(options).hash(data);
20
20
 
21
21
  default:
22
- throw new Error(`invalid option: ${operation}`);
22
+ throw new Error("invalid option: ".concat(operation));
23
23
  }
24
24
  });
25
25
  //# sourceMappingURL=worker.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/workers/worker.ts"],"names":["createWorker","CRC32Hash","CRC32CHash","MD5Hash","data","options","operation","hash","Error"],"mappings":"AAAA,SAAQA,YAAR,QAA2B,0BAA3B;AACA,SAAQC,SAAR,QAAwB,mBAAxB;AACA,SAAQC,UAAR,QAAyB,oBAAzB;AACA,SAAQC,OAAR,QAAsB,iBAAtB;AAGA,SAAQF,SAAR,EAAmBC,UAAnB;AAEAF,YAAY,CAAC,OAAOI,IAAP,EAAaC,OAAO,GAAG,EAAvB,KAA8B;AAEzC,QAAM;AAACC,IAAAA;AAAD,MAAcD,OAApB;;AAEA,UAAQC,SAAR;AACE,SAAK,OAAL;AACE,aAAO,MAAM,IAAIL,SAAJ,CAAcI,OAAd,EAAuBE,IAAvB,CAA4BH,IAA5B,CAAb;;AACF,SAAK,QAAL;AACE,aAAO,MAAM,IAAIF,UAAJ,CAAeG,OAAf,EAAwBE,IAAxB,CAA6BH,IAA7B,CAAb;;AACF,SAAK,KAAL;AACE,aAAO,MAAM,IAAID,OAAJ,CAAYE,OAAZ,EAAqBE,IAArB,CAA0BH,IAA1B,CAAb;;AACF;AACE,YAAM,IAAII,KAAJ,CAAW,mBAAkBF,SAAU,EAAvC,CAAN;AARJ;AAUD,CAdW,CAAZ","sourcesContent":["import {createWorker} from '@loaders.gl/worker-utils';\nimport {CRC32Hash} from '../lib/crc32-hash';\nimport {CRC32CHash} from '../lib/crc32c-hash';\nimport {MD5Hash} from '../lib/md5-hash';\n\n// Assuming we can bundle as module\nexport {CRC32Hash, CRC32CHash};\n\ncreateWorker(async (data, options = {}) => {\n // @ts-ignore\n const {operation} = options;\n\n switch (operation) {\n case 'crc32':\n return await new CRC32Hash(options).hash(data);\n case 'crc32c':\n return await new CRC32CHash(options).hash(data);\n case 'md5':\n return await new MD5Hash(options).hash(data);\n default:\n throw new Error(`invalid option: ${operation}`);\n }\n});\n"],"file":"worker.js"}
1
+ {"version":3,"sources":["../../../src/workers/worker.ts"],"names":["createWorker","CRC32Hash","CRC32CHash","MD5Hash","data","options","operation","hash","Error"],"mappings":"AAAA,SAAQA,YAAR,QAA2B,0BAA3B;AACA,SAAQC,SAAR,QAAwB,mBAAxB;AACA,SAAQC,UAAR,QAAyB,oBAAzB;AACA,SAAQC,OAAR,QAAsB,iBAAtB;AAGA,SAAQF,SAAR,EAAmBC,UAAnB;AAEAF,YAAY,CAAC,OAAOI,IAAP,EAAaC,OAAO,GAAG,EAAvB,KAA8B;AAEzC,QAAM;AAACC,IAAAA;AAAD,MAAcD,OAApB;;AAEA,UAAQC,SAAR;AACE,SAAK,OAAL;AACE,aAAO,MAAM,IAAIL,SAAJ,CAAcI,OAAd,EAAuBE,IAAvB,CAA4BH,IAA5B,CAAb;;AACF,SAAK,QAAL;AACE,aAAO,MAAM,IAAIF,UAAJ,CAAeG,OAAf,EAAwBE,IAAxB,CAA6BH,IAA7B,CAAb;;AACF,SAAK,KAAL;AACE,aAAO,MAAM,IAAID,OAAJ,CAAYE,OAAZ,EAAqBE,IAArB,CAA0BH,IAA1B,CAAb;;AACF;AACE,YAAM,IAAII,KAAJ,2BAA6BF,SAA7B,EAAN;AARJ;AAUD,CAdW,CAAZ","sourcesContent":["import {createWorker} from '@loaders.gl/worker-utils';\nimport {CRC32Hash} from '../lib/crc32-hash';\nimport {CRC32CHash} from '../lib/crc32c-hash';\nimport {MD5Hash} from '../lib/md5-hash';\n\n// Assuming we can bundle as module\nexport {CRC32Hash, CRC32CHash};\n\ncreateWorker(async (data, options = {}) => {\n // @ts-ignore\n const {operation} = options;\n\n switch (operation) {\n case 'crc32':\n return await new CRC32Hash(options).hash(data);\n case 'crc32c':\n return await new CRC32CHash(options).hash(data);\n case 'md5':\n return await new MD5Hash(options).hash(data);\n default:\n throw new Error(`invalid option: ${operation}`);\n }\n});\n"],"file":"worker.js"}
@@ -0,0 +1,32 @@
1
+ export { CRC32Hash } from './lib/crc32-hash';
2
+ export { CRC32CHash } from './lib/crc32c-hash';
3
+ export { MD5Hash } from './lib/md5-hash';
4
+ export { SHA256Hash } from './lib/sha256-hash';
5
+ export { CryptoHash } from './lib/crypto-hash';
6
+ export { NodeHash } from './lib/node-hash';
7
+ export { hexToBase64 as _hexToBase64, toHex as _toHex } from './lib/utils/digest-utils';
8
+ /**
9
+ * Small, fast worker for CRC32, CRC32c and MD5 Hashes
10
+ */
11
+ export declare const CryptoWorker: {
12
+ id: string;
13
+ name: string;
14
+ module: string;
15
+ version: any;
16
+ options: {
17
+ crypto: {};
18
+ };
19
+ };
20
+ /**
21
+ * Large worker for full complement of Cryptographic Hashes
22
+ * bundles the full crypto.js library
23
+ */
24
+ export declare const CryptoJSWorker: {
25
+ id: string;
26
+ name: string;
27
+ module: string;
28
+ version: any;
29
+ options: {
30
+ cryptojs: {};
31
+ };
32
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Calculates the CRC32 checksum of a string.
3
+ */
4
+ export default class CRC32 {
5
+ crc: number;
6
+ update(arrayBuffer: any): CRC32;
7
+ finalize(): number;
8
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Calculates the CRC32C checksum of a string.
3
+ */
4
+ export default class CRC32C {
5
+ constructor(options?: {});
6
+ options: {};
7
+ crc: number;
8
+ update(arrayBuffer: any): CRC32C;
9
+ finalize(): number;
10
+ }
@@ -0,0 +1,4 @@
1
+ export default function md5WASM(data: any): {
2
+ then(fun: any): any;
3
+ catch(fun: any): any;
4
+ };
@@ -0,0 +1,17 @@
1
+ import { Hash } from './hash';
2
+ /**
3
+ * Calculates CRC32 Cryptographic Hash
4
+ */
5
+ export declare class CRC32Hash extends Hash {
6
+ readonly name = "crc32";
7
+ options: any;
8
+ private _hash;
9
+ constructor(options?: {});
10
+ /**
11
+ * Atomic hash calculation
12
+ * @returns base64 encoded hash
13
+ */
14
+ hash(input: ArrayBuffer): Promise<string>;
15
+ hashSync(input: ArrayBuffer): string;
16
+ hashBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>): AsyncIterable<ArrayBuffer>;
17
+ }
@@ -0,0 +1,21 @@
1
+ import { Hash } from './hash';
2
+ /**
3
+ * A transform that calculates CRC32c Hash
4
+ */
5
+ export declare class CRC32CHash extends Hash {
6
+ readonly name = "crc32c";
7
+ options: any;
8
+ private _hash;
9
+ /**
10
+ * Atomic hash calculation
11
+ * @returns base64 encoded hash
12
+ */
13
+ constructor(options?: {});
14
+ /**
15
+ * Atomic hash calculation
16
+ * @returns base64 encoded hash
17
+ */
18
+ hash(input: ArrayBuffer): Promise<string>;
19
+ hashSync(input: ArrayBuffer): string;
20
+ hashBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>): AsyncIterable<ArrayBuffer>;
21
+ }
@@ -0,0 +1,31 @@
1
+ import { Hash } from './hash';
2
+ declare type CryptoHashOptions = {
3
+ modules: {
4
+ [moduleName: string]: any;
5
+ };
6
+ crypto: {
7
+ algorithm: string;
8
+ onEnd?: (result: {
9
+ hash: string;
10
+ }) => any;
11
+ };
12
+ };
13
+ /**
14
+ * A transform that calculates Cryptographic Hash using Crypto JS library
15
+ * @deprecated Warning, experimental class
16
+ */
17
+ export declare class CryptoHash extends Hash {
18
+ readonly name: any;
19
+ options: CryptoHashOptions;
20
+ private _algorithm;
21
+ private _hash;
22
+ constructor(options: CryptoHashOptions);
23
+ preload(): Promise<void>;
24
+ /**
25
+ * Atomic hash calculation
26
+ * @returns base64 encoded hash
27
+ */
28
+ hash(input: ArrayBuffer): Promise<string>;
29
+ hashBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>): AsyncIterable<ArrayBuffer>;
30
+ }
31
+ export {};
@@ -0,0 +1,21 @@
1
+ declare type HashOptions = {
2
+ modules?: {
3
+ [moduleName: string]: any;
4
+ };
5
+ crypto?: {
6
+ onEnd?: (result: {
7
+ hash: string;
8
+ }) => any;
9
+ };
10
+ };
11
+ /** Abstract hash base class */
12
+ export declare abstract class Hash {
13
+ abstract readonly name: string;
14
+ abstract readonly options: HashOptions;
15
+ constructor(options?: HashOptions);
16
+ preload(): Promise<void>;
17
+ abstract hash(arrayBuffer: ArrayBuffer): Promise<string>;
18
+ hashBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>): AsyncIterable<ArrayBuffer>;
19
+ protected concatenate(asyncIterator: any): Promise<ArrayBuffer>;
20
+ }
21
+ export {};
@@ -0,0 +1,14 @@
1
+ import { Hash } from './hash';
2
+ /**
3
+ * A transform that calculates MD5 hashes, passing data through
4
+ */
5
+ export declare class MD5Hash extends Hash {
6
+ readonly name = "md5";
7
+ readonly options: any;
8
+ constructor(options?: {});
9
+ /**
10
+ * Atomic hash calculation
11
+ * @returns base64 encoded hash
12
+ */
13
+ hash(input: ArrayBuffer): Promise<string>;
14
+ }
@@ -0,0 +1,27 @@
1
+ import { Hash } from './hash';
2
+ declare type CryptoHashOptions = {
3
+ crypto: {
4
+ algorithm: string;
5
+ onEnd?: (result: {
6
+ hash: string;
7
+ }) => any;
8
+ };
9
+ };
10
+ /**
11
+ * Calculates Cryptographic Hash using Node.js crypto library
12
+ * @deprecated Warning, experimental class
13
+ */
14
+ export declare class NodeHash extends Hash {
15
+ readonly name = "crypto-node";
16
+ options: CryptoHashOptions;
17
+ private _algorithm;
18
+ private _hash;
19
+ constructor(options: CryptoHashOptions);
20
+ /**
21
+ * Atomic hash calculation
22
+ * @returns base64 encoded hash
23
+ */
24
+ hash(input: ArrayBuffer): Promise<string>;
25
+ hashBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>): AsyncIterable<ArrayBuffer>;
26
+ }
27
+ export {};
@@ -0,0 +1,18 @@
1
+ import { CryptoHash } from './crypto-hash';
2
+ declare type CryptoHashOptions = {
3
+ modules: {
4
+ [moduleName: string]: any;
5
+ };
6
+ crypto?: {
7
+ onEnd?: (result: {
8
+ hash: string;
9
+ }) => any;
10
+ };
11
+ };
12
+ /**
13
+ * A transform that calculates Cryptographic Hash
14
+ */
15
+ export declare class SHA256Hash extends CryptoHash {
16
+ constructor(options: CryptoHashOptions);
17
+ }
18
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references
3
+ * RFC 4648.
4
+ */
5
+ export function toBase64(string: any): string | null;
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ */
4
+ export function toHex(cipher: any): any;
5
+ /**
6
+ *
7
+ */
8
+ export function hexToBase64(hexstring: any): string;
@@ -0,0 +1,9 @@
1
+ export declare type CryptoHashOptions = {
2
+ modules?: {
3
+ [moduleName: string]: any;
4
+ };
5
+ crypto?: {
6
+ algorithm: any;
7
+ onEnd?: any;
8
+ };
9
+ };
package/dist/worker.js CHANGED
@@ -87,9 +87,9 @@
87
87
  /******/ ({
88
88
 
89
89
  /***/ "../../node_modules/@babel/runtime/helpers/defineProperty.js":
90
- /*!****************************************************************************************!*\
91
- !*** /home/user/apps/loaders.gl/node_modules/@babel/runtime/helpers/defineProperty.js ***!
92
- \****************************************************************************************/
90
+ /*!**************************************************************************************************!*\
91
+ !*** /home/user/apps/loaders.gl_duplicate/node_modules/@babel/runtime/helpers/defineProperty.js ***!
92
+ \**************************************************************************************************/
93
93
  /*! no static exports found */
94
94
  /***/ (function(module, exports) {
95
95
 
@@ -114,9 +114,9 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
114
114
  /***/ }),
115
115
 
116
116
  /***/ "../../node_modules/@probe.gl/stats/dist/esm/index.js":
117
- /*!*********************************************************************************!*\
118
- !*** /home/user/apps/loaders.gl/node_modules/@probe.gl/stats/dist/esm/index.js ***!
119
- \*********************************************************************************/
117
+ /*!*******************************************************************************************!*\
118
+ !*** /home/user/apps/loaders.gl_duplicate/node_modules/@probe.gl/stats/dist/esm/index.js ***!
119
+ \*******************************************************************************************/
120
120
  /*! exports provided: Stats, Stat, _getHiResTimestamp */
121
121
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
122
122
 
@@ -139,9 +139,9 @@ __webpack_require__.r(__webpack_exports__);
139
139
  /***/ }),
140
140
 
141
141
  /***/ "../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js":
142
- /*!************************************************************************************!*\
143
- !*** /home/user/apps/loaders.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js ***!
144
- \************************************************************************************/
142
+ /*!**********************************************************************************************!*\
143
+ !*** /home/user/apps/loaders.gl_duplicate/node_modules/@probe.gl/stats/dist/esm/lib/stat.js ***!
144
+ \**********************************************************************************************/
145
145
  /*! exports provided: default */
146
146
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
147
147
 
@@ -278,9 +278,9 @@ class Stat {
278
278
  /***/ }),
279
279
 
280
280
  /***/ "../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js":
281
- /*!*************************************************************************************!*\
282
- !*** /home/user/apps/loaders.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js ***!
283
- \*************************************************************************************/
281
+ /*!***********************************************************************************************!*\
282
+ !*** /home/user/apps/loaders.gl_duplicate/node_modules/@probe.gl/stats/dist/esm/lib/stats.js ***!
283
+ \***********************************************************************************************/
284
284
  /*! exports provided: default */
285
285
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
286
286
 
@@ -371,9 +371,9 @@ class Stats {
371
371
  /***/ }),
372
372
 
373
373
  /***/ "../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js":
374
- /*!**************************************************************************************************!*\
375
- !*** /home/user/apps/loaders.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js ***!
376
- \**************************************************************************************************/
374
+ /*!************************************************************************************************************!*\
375
+ !*** /home/user/apps/loaders.gl_duplicate/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js ***!
376
+ \************************************************************************************************************/
377
377
  /*! exports provided: default */
378
378
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
379
379
 
@@ -400,9 +400,9 @@ function getHiResTimestamp() {
400
400
  /***/ }),
401
401
 
402
402
  /***/ "../../node_modules/process/browser.js":
403
- /*!******************************************************************!*\
404
- !*** /home/user/apps/loaders.gl/node_modules/process/browser.js ***!
405
- \******************************************************************/
403
+ /*!****************************************************************************!*\
404
+ !*** /home/user/apps/loaders.gl_duplicate/node_modules/process/browser.js ***!
405
+ \****************************************************************************/
406
406
  /*! no static exports found */
407
407
  /***/ (function(module, exports) {
408
408
 
@@ -806,7 +806,7 @@ __webpack_require__.r(__webpack_exports__);
806
806
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_typecheckJSONLoader", function() { return _typecheckJSONLoader; });
807
807
  // __VERSION__ is injected by babel-plugin-version-inline
808
808
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
809
- const VERSION = true ? "3.1.0-alpha.4" : undefined;
809
+ const VERSION = true ? "3.1.0-alpha.5" : undefined;
810
810
  /**
811
811
  * A JSON Micro loader (minimal bundle size)
812
812
  * Alternative to `@loaders.gl/json`
@@ -2489,7 +2489,7 @@ __webpack_require__.r(__webpack_exports__);
2489
2489
  // __VERSION__ is injected by babel-plugin-version-inline
2490
2490
  // Change to `latest` on production branches
2491
2491
  const DEFAULT_VERSION = 'beta';
2492
- const VERSION = true ? "3.1.0-alpha.4" : undefined;
2492
+ const VERSION = true ? "3.1.0-alpha.5" : undefined;
2493
2493
 
2494
2494
  if (false) {}
2495
2495
 
@@ -2518,7 +2518,7 @@ __webpack_require__.r(__webpack_exports__);
2518
2518
  // TODO - unpkg.com doesn't seem to have a `latest` specifier for alpha releases...
2519
2519
 
2520
2520
  const LATEST = 'beta';
2521
- const VERSION = true ? "3.1.0-alpha.4" : undefined;
2521
+ const VERSION = true ? "3.1.0-alpha.5" : undefined;
2522
2522
  const loadLibraryPromises = {}; // promises
2523
2523
 
2524
2524
  /**
@@ -2807,7 +2807,7 @@ __webpack_require__.r(__webpack_exports__);
2807
2807
 
2808
2808
  const NPM_TAG = 'beta'; // Change to 'latest' on release-branch
2809
2809
 
2810
- const VERSION = true ? "3.1.0-alpha.4" : undefined;
2810
+ const VERSION = true ? "3.1.0-alpha.5" : undefined;
2811
2811
  /**
2812
2812
  * Gets worker object's name (for debugging in Chrome thread inspector window)
2813
2813
  */