omnipin 1.6.0 → 1.6.2

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/cli.js +13 -9
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -6,8 +6,11 @@ import { styleText } from "node:util";
6
6
  import * as nc from "node:crypto";
7
7
  import { createHash, createHmac } from "node:crypto";
8
8
  import { randomInt as randomInt2 } from "node:crypto";
9
+ import { setTimeout as setTimeout4 } from "node:timers/promises";
9
10
  import crypto3 from "node:crypto";
10
11
  import { randomInt } from "node:crypto";
12
+ import { setTimeout as setTimeout2 } from "node:timers/promises";
13
+ import { setTimeout as setTimeout3 } from "node:timers/promises";
11
14
  import * as nodeCrypto from "crypto";
12
15
  import crypto5 from "crypto";
13
16
  import fs from "fs";
@@ -28,6 +31,7 @@ import { tmpdir } from "node:os";
28
31
  import { styleText as styleText2 } from "node:util";
29
32
  import path2 from "node:path";
30
33
  import { styleText as styleText3 } from "node:util";
34
+ import { setTimeout as setTimeout5 } from "node:timers/promises";
31
35
  import { styleText as styleText5 } from "node:util";
32
36
  import { styleText as styleText6 } from "node:util";
33
37
  import { writeFile } from "node:fs/promises";
@@ -14431,7 +14435,7 @@ var waitForTransaction = async (provider, hash2) => {
14431
14435
  return fromRpc3({ ...rawReceipt, chainId });
14432
14436
  }
14433
14437
  const delay = Math.min(1e3 * 2 ** attempt, 3e4);
14434
- await new Promise((resolve) => setTimeout(resolve, delay));
14438
+ await setTimeout2(delay);
14435
14439
  }
14436
14440
  throw new Error(`Transaction ${hash2} not mined within timeout period`);
14437
14441
  };
@@ -15319,7 +15323,7 @@ var waitForDatasetReady = async (statusUrl) => {
15319
15323
  ${await res.text()}`);
15320
15324
  }
15321
15325
  if (!json.dataSetCreated) {
15322
- await new Promise((resolve) => setTimeout(resolve, 3e3));
15326
+ await setTimeout3(3e3);
15323
15327
  continue;
15324
15328
  }
15325
15329
  if (json.txStatus === "confirmed" && json.dataSetCreated) {
@@ -15393,6 +15397,8 @@ var uploadToFilecoin = async ({
15393
15397
  await waitForTransaction(filProvider[chainId], hash3);
15394
15398
  await waitForDatasetReady(statusUrl2);
15395
15399
  logger.success("Data set registered");
15400
+ logger.info("Waiting for 5 seconds to ensure everything is in sync");
15401
+ await setTimeout4(5e3);
15396
15402
  } else {
15397
15403
  logger.info(`Using existing dataset: ${providerDataSets[0].dataSetId}`);
15398
15404
  datasetId = providerDataSets[0].dataSetId;
@@ -15452,7 +15458,7 @@ var uploadToFilecoin = async ({
15452
15458
  if (res.ok) {
15453
15459
  break;
15454
15460
  }
15455
- await new Promise((resolve) => setTimeout(resolve, 1e3));
15461
+ await setTimeout4(1e3);
15456
15462
  }
15457
15463
  logger.success("Piece found");
15458
15464
  const { hash: hash2, statusUrl } = await uploadPieceToDataSet({
@@ -24311,10 +24317,8 @@ var uploadCAR = async (conf, car) => {
24311
24317
  const piece = fromDigest(multihashDigest).link;
24312
24318
  const content2 = create2(code6, digest4);
24313
24319
  const offer = await exports_storefront.filecoinOffer({
24314
- issuer: conf.issuer,
24315
- audience: uploadServicePrincipal,
24316
- with: conf.issuer.did(),
24317
- proofs: conf.proofs
24320
+ ...conf,
24321
+ audience: uploadServicePrincipal
24318
24322
  }, content2, piece, {});
24319
24323
  if (offer.out?.error) {
24320
24324
  throw new Error("failed to offer piece for aggregation into filecoin deal", {
@@ -30152,7 +30156,7 @@ var pingAction = async ({
30152
30156
  if (response.status === 504) {
30153
30157
  if (attempt < maxRetries) {
30154
30158
  logger.text(`\u{1F504} Retrying in ${retryInterval / 1e3} seconds...`);
30155
- await new Promise((resolve) => setTimeout(resolve, retryInterval));
30159
+ await setTimeout5(retryInterval);
30156
30160
  } else {
30157
30161
  return logger.error(gwOfflineMessage);
30158
30162
  }
@@ -30162,7 +30166,7 @@ var pingAction = async ({
30162
30166
  } catch (error3) {
30163
30167
  if (error3 instanceof DOMException && attempt < maxRetries) {
30164
30168
  logger.info(`\u231B Timed out. Retrying...`);
30165
- await new Promise((resolve) => setTimeout(resolve, retryInterval));
30169
+ await setTimeout5(retryInterval);
30166
30170
  } else {
30167
30171
  logger.error(error3 instanceof DOMException ? gwOfflineMessage : `Error fetching endpoint: ${error3.message}`);
30168
30172
  throw error3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnipin",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "author": "v1rtl <hi@v1rtl.site>",
5
5
  "repository": {
6
6
  "type": "git",