pinata 1.0.5 → 1.1.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.
package/dist/index.mjs CHANGED
@@ -128,7 +128,8 @@ var uploadFile = async (config, file, options) => {
128
128
  );
129
129
  }
130
130
  const res = await request.json();
131
- return res;
131
+ const resData = res.data;
132
+ return resData;
132
133
  } catch (error) {
133
134
  if (error instanceof PinataError) {
134
135
  throw error;
@@ -190,7 +191,8 @@ var uploadBase64 = async (config, base64String, options) => {
190
191
  );
191
192
  }
192
193
  const res = await request.json();
193
- return res;
194
+ const resData = res.data;
195
+ return resData;
194
196
  } catch (error) {
195
197
  if (error instanceof PinataError) {
196
198
  throw error;
@@ -264,7 +266,8 @@ var uploadUrl = async (config, url, options) => {
264
266
  );
265
267
  }
266
268
  const res = await request.json();
267
- return res;
269
+ const resData = res.data;
270
+ return resData;
268
271
  } catch (error) {
269
272
  if (error instanceof PinataError) {
270
273
  throw error;
@@ -326,7 +329,8 @@ var uploadJson = async (config, jsonData, options) => {
326
329
  );
327
330
  }
328
331
  const res = await request.json();
329
- return res;
332
+ const resData = res.data;
333
+ return resData;
330
334
  } catch (error) {
331
335
  if (error instanceof PinataError) {
332
336
  throw error;
@@ -1273,6 +1277,10 @@ var FilterFiles = class {
1273
1277
  this.query.cidPending = cidPending;
1274
1278
  return this;
1275
1279
  }
1280
+ pageToken(pageToken) {
1281
+ this.query.pageToken = pageToken;
1282
+ return this;
1283
+ }
1276
1284
  then(onfulfilled) {
1277
1285
  return this.fetchPage().then(onfulfilled);
1278
1286
  }
@@ -1282,7 +1290,7 @@ var FilterFiles = class {
1282
1290
  }
1283
1291
  const response = await listFiles(this.config, this.query);
1284
1292
  this.currentPageToken = response.next_page_token;
1285
- return response.files;
1293
+ return response;
1286
1294
  }
1287
1295
  // // rate limit, hopefully temporary?
1288
1296
  // private async rateLimit(): Promise<void> {
@@ -1301,7 +1309,7 @@ var FilterFiles = class {
1301
1309
  async *[Symbol.asyncIterator]() {
1302
1310
  while (true) {
1303
1311
  const items = await this.fetchPage();
1304
- for (const item of items) {
1312
+ for (const item of items.files) {
1305
1313
  yield item;
1306
1314
  }
1307
1315
  if (!this.currentPageToken) {
@@ -1518,10 +1526,14 @@ var FilterGroups = class {
1518
1526
  this.query.isPublic = isPublic;
1519
1527
  return this;
1520
1528
  }
1529
+ pageToken(pageToken) {
1530
+ this.query.pageToken = pageToken;
1531
+ return this;
1532
+ }
1521
1533
  then(onfulfilled) {
1522
1534
  return this.fetchPage().then((response) => {
1523
1535
  this.nextPageToken = response.next_page_token;
1524
- return response.groups;
1536
+ return response;
1525
1537
  }).then(onfulfilled);
1526
1538
  }
1527
1539
  async fetchPage() {