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.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -14,9 +14,11 @@ type UploadResponse = {
|
|
|
14
14
|
name: string;
|
|
15
15
|
cid: string;
|
|
16
16
|
size: number;
|
|
17
|
+
created_at: string;
|
|
17
18
|
number_of_files: number;
|
|
18
19
|
mime_type: string;
|
|
19
20
|
user_id: string;
|
|
21
|
+
group_id: string | null;
|
|
20
22
|
};
|
|
21
23
|
type FileObject = {
|
|
22
24
|
name: string;
|
|
@@ -49,7 +51,7 @@ type FileListItem = {
|
|
|
49
51
|
size: number;
|
|
50
52
|
number_of_files: number;
|
|
51
53
|
mime_type: string;
|
|
52
|
-
group_id: string;
|
|
54
|
+
group_id: string | null;
|
|
53
55
|
created_at: string;
|
|
54
56
|
};
|
|
55
57
|
type FileListResponse = {
|
|
@@ -325,7 +327,8 @@ declare class FilterFiles {
|
|
|
325
327
|
constructor(config: PinataConfig | undefined);
|
|
326
328
|
limit(limit: number): FilterFiles;
|
|
327
329
|
cidPending(cidPending: boolean): FilterFiles;
|
|
328
|
-
|
|
330
|
+
pageToken(pageToken: string): FilterFiles;
|
|
331
|
+
then(onfulfilled?: ((value: FileListResponse) => any) | null): Promise<any>;
|
|
329
332
|
private fetchPage;
|
|
330
333
|
[Symbol.asyncIterator](): AsyncGenerator<FileListItem, void, unknown>;
|
|
331
334
|
all(): Promise<FileListItem[]>;
|
|
@@ -375,7 +378,8 @@ declare class FilterGroups {
|
|
|
375
378
|
constructor(config: PinataConfig | undefined);
|
|
376
379
|
limit(limit: number): FilterGroups;
|
|
377
380
|
isPublic(isPublic: boolean): FilterGroups;
|
|
378
|
-
|
|
381
|
+
pageToken(pageToken: string): FilterGroups;
|
|
382
|
+
then(onfulfilled?: ((value: GroupListResponse) => any) | null): Promise<GroupListResponse>;
|
|
379
383
|
private fetchPage;
|
|
380
384
|
[Symbol.asyncIterator](): AsyncGenerator<GroupResponseItem, void, unknown>;
|
|
381
385
|
all(): Promise<GroupResponseItem[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,9 +14,11 @@ type UploadResponse = {
|
|
|
14
14
|
name: string;
|
|
15
15
|
cid: string;
|
|
16
16
|
size: number;
|
|
17
|
+
created_at: string;
|
|
17
18
|
number_of_files: number;
|
|
18
19
|
mime_type: string;
|
|
19
20
|
user_id: string;
|
|
21
|
+
group_id: string | null;
|
|
20
22
|
};
|
|
21
23
|
type FileObject = {
|
|
22
24
|
name: string;
|
|
@@ -49,7 +51,7 @@ type FileListItem = {
|
|
|
49
51
|
size: number;
|
|
50
52
|
number_of_files: number;
|
|
51
53
|
mime_type: string;
|
|
52
|
-
group_id: string;
|
|
54
|
+
group_id: string | null;
|
|
53
55
|
created_at: string;
|
|
54
56
|
};
|
|
55
57
|
type FileListResponse = {
|
|
@@ -325,7 +327,8 @@ declare class FilterFiles {
|
|
|
325
327
|
constructor(config: PinataConfig | undefined);
|
|
326
328
|
limit(limit: number): FilterFiles;
|
|
327
329
|
cidPending(cidPending: boolean): FilterFiles;
|
|
328
|
-
|
|
330
|
+
pageToken(pageToken: string): FilterFiles;
|
|
331
|
+
then(onfulfilled?: ((value: FileListResponse) => any) | null): Promise<any>;
|
|
329
332
|
private fetchPage;
|
|
330
333
|
[Symbol.asyncIterator](): AsyncGenerator<FileListItem, void, unknown>;
|
|
331
334
|
all(): Promise<FileListItem[]>;
|
|
@@ -375,7 +378,8 @@ declare class FilterGroups {
|
|
|
375
378
|
constructor(config: PinataConfig | undefined);
|
|
376
379
|
limit(limit: number): FilterGroups;
|
|
377
380
|
isPublic(isPublic: boolean): FilterGroups;
|
|
378
|
-
|
|
381
|
+
pageToken(pageToken: string): FilterGroups;
|
|
382
|
+
then(onfulfilled?: ((value: GroupListResponse) => any) | null): Promise<GroupListResponse>;
|
|
379
383
|
private fetchPage;
|
|
380
384
|
[Symbol.asyncIterator](): AsyncGenerator<GroupResponseItem, void, unknown>;
|
|
381
385
|
all(): Promise<GroupResponseItem[]>;
|
package/dist/index.js
CHANGED
|
@@ -154,7 +154,8 @@ var uploadFile = async (config, file, options) => {
|
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
const res = await request.json();
|
|
157
|
-
|
|
157
|
+
const resData = res.data;
|
|
158
|
+
return resData;
|
|
158
159
|
} catch (error) {
|
|
159
160
|
if (error instanceof PinataError) {
|
|
160
161
|
throw error;
|
|
@@ -216,7 +217,8 @@ var uploadBase64 = async (config, base64String, options) => {
|
|
|
216
217
|
);
|
|
217
218
|
}
|
|
218
219
|
const res = await request.json();
|
|
219
|
-
|
|
220
|
+
const resData = res.data;
|
|
221
|
+
return resData;
|
|
220
222
|
} catch (error) {
|
|
221
223
|
if (error instanceof PinataError) {
|
|
222
224
|
throw error;
|
|
@@ -290,7 +292,8 @@ var uploadUrl = async (config, url, options) => {
|
|
|
290
292
|
);
|
|
291
293
|
}
|
|
292
294
|
const res = await request.json();
|
|
293
|
-
|
|
295
|
+
const resData = res.data;
|
|
296
|
+
return resData;
|
|
294
297
|
} catch (error) {
|
|
295
298
|
if (error instanceof PinataError) {
|
|
296
299
|
throw error;
|
|
@@ -352,7 +355,8 @@ var uploadJson = async (config, jsonData, options) => {
|
|
|
352
355
|
);
|
|
353
356
|
}
|
|
354
357
|
const res = await request.json();
|
|
355
|
-
|
|
358
|
+
const resData = res.data;
|
|
359
|
+
return resData;
|
|
356
360
|
} catch (error) {
|
|
357
361
|
if (error instanceof PinataError) {
|
|
358
362
|
throw error;
|
|
@@ -1299,6 +1303,10 @@ var FilterFiles = class {
|
|
|
1299
1303
|
this.query.cidPending = cidPending;
|
|
1300
1304
|
return this;
|
|
1301
1305
|
}
|
|
1306
|
+
pageToken(pageToken) {
|
|
1307
|
+
this.query.pageToken = pageToken;
|
|
1308
|
+
return this;
|
|
1309
|
+
}
|
|
1302
1310
|
then(onfulfilled) {
|
|
1303
1311
|
return this.fetchPage().then(onfulfilled);
|
|
1304
1312
|
}
|
|
@@ -1308,7 +1316,7 @@ var FilterFiles = class {
|
|
|
1308
1316
|
}
|
|
1309
1317
|
const response = await listFiles(this.config, this.query);
|
|
1310
1318
|
this.currentPageToken = response.next_page_token;
|
|
1311
|
-
return response
|
|
1319
|
+
return response;
|
|
1312
1320
|
}
|
|
1313
1321
|
// // rate limit, hopefully temporary?
|
|
1314
1322
|
// private async rateLimit(): Promise<void> {
|
|
@@ -1327,7 +1335,7 @@ var FilterFiles = class {
|
|
|
1327
1335
|
async *[Symbol.asyncIterator]() {
|
|
1328
1336
|
while (true) {
|
|
1329
1337
|
const items = await this.fetchPage();
|
|
1330
|
-
for (const item of items) {
|
|
1338
|
+
for (const item of items.files) {
|
|
1331
1339
|
yield item;
|
|
1332
1340
|
}
|
|
1333
1341
|
if (!this.currentPageToken) {
|
|
@@ -1544,10 +1552,14 @@ var FilterGroups = class {
|
|
|
1544
1552
|
this.query.isPublic = isPublic;
|
|
1545
1553
|
return this;
|
|
1546
1554
|
}
|
|
1555
|
+
pageToken(pageToken) {
|
|
1556
|
+
this.query.pageToken = pageToken;
|
|
1557
|
+
return this;
|
|
1558
|
+
}
|
|
1547
1559
|
then(onfulfilled) {
|
|
1548
1560
|
return this.fetchPage().then((response) => {
|
|
1549
1561
|
this.nextPageToken = response.next_page_token;
|
|
1550
|
-
return response
|
|
1562
|
+
return response;
|
|
1551
1563
|
}).then(onfulfilled);
|
|
1552
1564
|
}
|
|
1553
1565
|
async fetchPage() {
|