@secrecy/lib 1.75.7 → 1.75.9

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.
@@ -33,32 +33,15 @@ export async function downloadDataFromLink(opts) {
33
33
  let dataUrl = opts.dataUrl ?? 'https://data.secrecy.tech/';
34
34
  dataUrl = dataUrl.endsWith('/') ? dataUrl : `${dataUrl}/`;
35
35
  const rawDataLinkRes = await fetch(`${dataUrl}${opts.dataLinkSlug}/json`, {
36
- mode: 'no-cors',
37
36
  credentials: 'include',
38
37
  }).catch((err) => {
39
38
  console.error(err);
40
39
  throw new Error(`Unable to fetch "${`${dataUrl}${opts.dataLinkSlug}/json"`}`, { cause: err });
41
40
  });
42
- console.log('rawDataLinkRes.status', rawDataLinkRes.status);
43
- if (!rawDataLinkRes.ok) {
44
- throw new Error(`Unable to fetch data link! Server responded with ${rawDataLinkRes.status} ${rawDataLinkRes.statusText}`);
45
- }
46
- // const rawDataLink = await rawDataLinkRes.json().catch((err) => {
47
- // console.error(err)
48
- // throw new Error('Unable to parse data link json!', { cause: err })
49
- // })
50
- const arrayBuffer = await rawDataLinkRes.bytes();
51
- console.log('arrayBuffer.byteLength', arrayBuffer.byteLength);
52
- const rawDataLinkText = new TextDecoder().decode(arrayBuffer);
53
- console.log('rawDataLinkText', rawDataLinkText);
54
- let rawDataLink;
55
- try {
56
- rawDataLink = JSON.parse(rawDataLinkText);
57
- }
58
- catch (err) {
41
+ const rawDataLink = await rawDataLinkRes.json().catch((err) => {
59
42
  console.error(err);
60
43
  throw new Error('Unable to parse data link json!', { cause: err });
61
- }
44
+ });
62
45
  const dataLink = downloadDataLinkSchema.safeParse(rawDataLink);
63
46
  if (dataLink.error) {
64
47
  throw new Error(`Should not happen!`, { cause: dataLink.error });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@secrecy/lib",
3
3
  "author": "Anonymize <anonymize@gmail.com>",
4
4
  "description": "Anonymize Secrecy Library",
5
- "version": "1.75.7",
5
+ "version": "1.75.9",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/anonymize-org/lib.git"