@prosopo/datasets 0.2.11 → 0.2.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/captcha/util.ts"],"names":[],"mappings":"AAgBA,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CASpE"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/captcha/util.ts"],"names":[],"mappings":"AAeA,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAYpE"}
@@ -12,10 +12,14 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { ProsopoEnvError } from '@prosopo/common';
15
- import client from 'axios';
16
15
  export async function downloadImage(url) {
17
16
  try {
18
- return new Uint8Array((await client.get(url, { url, method: 'GET', responseType: 'arraybuffer' })).data);
17
+ const response = await fetch(url);
18
+ if (!response.ok) {
19
+ throw new Error(`Network response was not ok, status: ${response.status}`);
20
+ }
21
+ const buffer = await response.arrayBuffer();
22
+ return new Uint8Array(buffer);
19
23
  }
20
24
  catch (error) {
21
25
  // TODO fix/improve error handling
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/captcha/util.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,MAAM,MAAM,OAAO,CAAA;AAE1B,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAW;IAC3C,IAAI;QACA,OAAO,IAAI,UAAU,CACjB,CAAC,MAAM,MAAM,CAAC,GAAG,CAAc,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CACjG,CAAA;KACJ;IAAC,OAAO,KAAK,EAAE;QACZ,kCAAkC;QAClC,MAAM,IAAI,eAAe,CAAC,KAAc,CAAC,CAAA;KAC5C;AACL,CAAC"}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/captcha/util.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAW;IAC3C,IAAI;QACA,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,wCAAwC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;SAC7E;QACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAA;QAC3C,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAA;KAChC;IAAC,OAAO,KAAK,EAAE;QACZ,kCAAkC;QAClC,MAAM,IAAI,eAAe,CAAC,KAAc,CAAC,CAAA;KAC5C;AACL,CAAC"}
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const common = require("@prosopo/common");
4
- const client = require("axios");
5
4
  async function downloadImage(url) {
6
5
  try {
7
- return new Uint8Array(
8
- (await client.get(url, { url, method: "GET", responseType: "arraybuffer" })).data
9
- );
6
+ const response = await fetch(url);
7
+ if (!response.ok) {
8
+ throw new Error(`Network response was not ok, status: ${response.status}`);
9
+ }
10
+ const buffer = await response.arrayBuffer();
11
+ return new Uint8Array(buffer);
10
12
  } catch (error) {
11
13
  throw new common.ProsopoEnvError(error);
12
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/datasets",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,
@@ -38,13 +38,12 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@polkadot/util": "^12.3.2",
41
- "@prosopo/common": "0.2.11",
42
- "@prosopo/types": "0.2.11",
43
- "axios": "^1.5.0",
41
+ "@prosopo/common": "0.2.13",
42
+ "@prosopo/types": "0.2.13",
44
43
  "vitest": "^0.34.6"
45
44
  },
46
45
  "devDependencies": {
47
- "@prosopo/config": "0.2.11",
46
+ "@prosopo/config": "0.2.13",
48
47
  "tslib": "2.6.2",
49
48
  "typescript": "5.1.6"
50
49
  },