@super-protocol/sdk-js 0.13.4 → 0.13.6-beta.0

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.
@@ -11,7 +11,8 @@ export default class StorJStorageProvider implements IStorageProvider {
11
11
  private _access?;
12
12
  private _project?;
13
13
  private _storj?;
14
- constructor(credentials: any);
14
+ private maximumConcurrent?;
15
+ constructor(credentials: any, maximumConcurrent?: number);
15
16
  uploadFile(inputStream: stream.Readable, remotePath: string, contentLength: number, progressListener?: (total: number, current: number) => void): Promise<void>;
16
17
  downloadFile(remotePath: string, config: DownloadConfig, progressListener?: (total: number, current: number) => void): Promise<stream.Readable>;
17
18
  deleteObject(remotePath: string): Promise<void>;
@@ -63,7 +63,7 @@ var utils_1 = require("../../utils");
63
63
  var stream_1 = __importDefault(require("stream"));
64
64
  var logger_1 = __importDefault(require("../../logger"));
65
65
  var StorJStorageProvider = /** @class */ (function () {
66
- function StorJStorageProvider(credentials) {
66
+ function StorJStorageProvider(credentials, maximumConcurrent) {
67
67
  this.logger = logger_1.default.child({ className: "StorJStorageProvider" });
68
68
  if (!(0, utils_1.isNodeJS)()) {
69
69
  throw Error("StorageProvider: StorJ is supported only in the node.js execution environment");
@@ -79,6 +79,7 @@ var StorJStorageProvider = /** @class */ (function () {
79
79
  this.bucket = credentials.storageId;
80
80
  }
81
81
  this.accessToken = credentials.token;
82
+ this.maximumConcurrent = maximumConcurrent;
82
83
  }
83
84
  StorJStorageProvider.prototype.uploadFile = function (inputStream, remotePath, contentLength, progressListener) {
84
85
  var _a, inputStream_1, inputStream_1_1;
@@ -367,7 +368,7 @@ var StorJStorageProvider = /** @class */ (function () {
367
368
  case 1:
368
369
  access = _b.sent();
369
370
  _a = this;
370
- return [4 /*yield*/, access.openProject()];
371
+ return [4 /*yield*/, access.openProject(this.maximumConcurrent)];
371
372
  case 2:
372
373
  _a._project = _b.sent();
373
374
  _b.label = 3;
@@ -9,7 +9,7 @@ exports.default = (function (storageAccess) {
9
9
  var key = storageAccess.storageType;
10
10
  switch (key) {
11
11
  case dto_js_1.StorageType.StorJ:
12
- return new StorjStorageProvider_1.default(storageAccess.credentials);
12
+ return new StorjStorageProvider_1.default(storageAccess.credentials, storageAccess.maximumConcurrent);
13
13
  default:
14
14
  throw Error("Unsupported storageType ".concat(key));
15
15
  }
@@ -12,5 +12,10 @@ declare class ActiveOrders {
12
12
  * @returns {Promise<string[]>}
13
13
  */
14
14
  static getListOfActiveOrdersRange(begin?: BigNumber | number, end?: BigNumber | number): Promise<string[]>;
15
+ /**
16
+ * Function returns ids of active orders by offers
17
+ * @returns {Promise<string[]>}
18
+ */
19
+ static getActiveOrdersRangeByOffers(offerIds: string[], begin?: BigNumber | number, end?: BigNumber | number): Promise<string[]>;
15
20
  }
16
21
  export default ActiveOrders;
@@ -104,6 +104,44 @@ var ActiveOrders = /** @class */ (function () {
104
104
  });
105
105
  });
106
106
  };
107
+ /**
108
+ * Function returns ids of active orders by offers
109
+ * @returns {Promise<string[]>}
110
+ */
111
+ ActiveOrders.getActiveOrdersRangeByOffers = function (offerIds, begin, end) {
112
+ return __awaiter(this, void 0, void 0, function () {
113
+ var contract, response, _a, _b, _c, _i, offerId, _d, _e;
114
+ return __generator(this, function (_f) {
115
+ switch (_f.label) {
116
+ case 0:
117
+ contract = BlockchainConnector_1.default.getInstance().getContract();
118
+ response = [];
119
+ begin = begin !== null && begin !== void 0 ? begin : 0;
120
+ end = end !== null && end !== void 0 ? end : 999; // max active orders for one offer
121
+ _a = offerIds;
122
+ _b = [];
123
+ for (_c in _a)
124
+ _b.push(_c);
125
+ _i = 0;
126
+ _f.label = 1;
127
+ case 1:
128
+ if (!(_i < _b.length)) return [3 /*break*/, 4];
129
+ _c = _b[_i];
130
+ if (!(_c in _a)) return [3 /*break*/, 3];
131
+ offerId = _c;
132
+ _e = (_d = response).push;
133
+ return [4 /*yield*/, contract.methods.getOfferActiveOrdersRange(offerId, begin, end)];
134
+ case 2:
135
+ _e.apply(_d, [_f.sent()]);
136
+ _f.label = 3;
137
+ case 3:
138
+ _i++;
139
+ return [3 /*break*/, 1];
140
+ case 4: return [2 /*return*/, response];
141
+ }
142
+ });
143
+ });
144
+ };
107
145
  ActiveOrders.logger = logger_1.default.child({ className: "ActiveOrders" });
108
146
  __decorate([
109
147
  (0, utils_1.incrementMethodCall)()
@@ -111,6 +149,9 @@ var ActiveOrders = /** @class */ (function () {
111
149
  __decorate([
112
150
  (0, utils_1.incrementMethodCall)()
113
151
  ], ActiveOrders, "getListOfActiveOrdersRange", null);
152
+ __decorate([
153
+ (0, utils_1.incrementMethodCall)()
154
+ ], ActiveOrders, "getActiveOrdersRangeByOffers", null);
114
155
  return ActiveOrders;
115
156
  }());
116
157
  exports.default = ActiveOrders;
@@ -2,5 +2,6 @@ import { StorageType } from "@super-protocol/dto-js";
2
2
  type StorageAccess = {
3
3
  storageType: StorageType;
4
4
  credentials: any;
5
+ maximumConcurrent?: number;
5
6
  };
6
7
  export default StorageAccess;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-protocol/sdk-js",
3
- "version": "0.13.4",
3
+ "version": "0.13.6-beta.0",
4
4
  "main": "build/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@super-protocol/dto-js": "0.0.24",
56
56
  "@super-protocol/tee-lib": "^0.1.2",
57
- "@super-protocol/uplink-nodejs": "1.2.12",
57
+ "@super-protocol/uplink-nodejs": "1.2.16",
58
58
  "ethers": "^5.5.3",
59
59
  "hybrid-crypto-js": "^0.2.4",
60
60
  "lodash": "^4.17.21",
@@ -64,5 +64,8 @@
64
64
  "web3": "^1.7.1",
65
65
  "web3-parse-receipt-events": "^1.0.2"
66
66
  },
67
- "repository": "git://github.com/Super-Protocol/sdk-js.git"
67
+ "repository": "git://github.com/Super-Protocol/sdk-js.git",
68
+ "resolutions": {
69
+ "wrap-ansi": "7.0.0"
70
+ }
68
71
  }