pinata 2.2.1 → 2.3.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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +43 -49
package/dist/index.d.mts
CHANGED
|
@@ -126,7 +126,7 @@ type PinQueueItem = {
|
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
128
|
type PinQueueResponse = {
|
|
129
|
-
|
|
129
|
+
jobs: PinQueueItem[];
|
|
130
130
|
next_page_token: string;
|
|
131
131
|
};
|
|
132
132
|
type SwapCidOptions = {
|
|
@@ -328,6 +328,7 @@ type UploadOptions = {
|
|
|
328
328
|
groupId?: string;
|
|
329
329
|
vectorize?: boolean;
|
|
330
330
|
url?: string;
|
|
331
|
+
streamable?: boolean;
|
|
331
332
|
peerAddresses?: string[];
|
|
332
333
|
};
|
|
333
334
|
type SignedUploadUrlOptions = {
|
|
@@ -339,6 +340,7 @@ type SignedUploadUrlOptions = {
|
|
|
339
340
|
vectorize?: boolean;
|
|
340
341
|
maxFileSize?: number;
|
|
341
342
|
mimeTypes?: string[];
|
|
343
|
+
streamable?: boolean;
|
|
342
344
|
};
|
|
343
345
|
type UploadCIDOptions = {
|
|
344
346
|
metadata?: PinataMetadata;
|
|
@@ -703,6 +705,7 @@ declare class UploadBuilder<T> {
|
|
|
703
705
|
private groupId;
|
|
704
706
|
private vector;
|
|
705
707
|
private uploadUrl;
|
|
708
|
+
private isStreamable;
|
|
706
709
|
private peerAddresses;
|
|
707
710
|
constructor(config: PinataConfig | undefined, uploadFunction: (config: PinataConfig | undefined, ...args: any[]) => Promise<T>, ...args: any[]);
|
|
708
711
|
name(name: string): UploadBuilder<T>;
|
|
@@ -711,6 +714,7 @@ declare class UploadBuilder<T> {
|
|
|
711
714
|
vectorize(): UploadBuilder<T>;
|
|
712
715
|
url(url: string): UploadBuilder<T>;
|
|
713
716
|
group(groupId: string): UploadBuilder<T>;
|
|
717
|
+
streamable(): UploadBuilder<T>;
|
|
714
718
|
peerAddress(peerAddresses: string[]): UploadBuilder<T>;
|
|
715
719
|
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
716
720
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ type PinQueueItem = {
|
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
128
|
type PinQueueResponse = {
|
|
129
|
-
|
|
129
|
+
jobs: PinQueueItem[];
|
|
130
130
|
next_page_token: string;
|
|
131
131
|
};
|
|
132
132
|
type SwapCidOptions = {
|
|
@@ -328,6 +328,7 @@ type UploadOptions = {
|
|
|
328
328
|
groupId?: string;
|
|
329
329
|
vectorize?: boolean;
|
|
330
330
|
url?: string;
|
|
331
|
+
streamable?: boolean;
|
|
331
332
|
peerAddresses?: string[];
|
|
332
333
|
};
|
|
333
334
|
type SignedUploadUrlOptions = {
|
|
@@ -339,6 +340,7 @@ type SignedUploadUrlOptions = {
|
|
|
339
340
|
vectorize?: boolean;
|
|
340
341
|
maxFileSize?: number;
|
|
341
342
|
mimeTypes?: string[];
|
|
343
|
+
streamable?: boolean;
|
|
342
344
|
};
|
|
343
345
|
type UploadCIDOptions = {
|
|
344
346
|
metadata?: PinataMetadata;
|
|
@@ -703,6 +705,7 @@ declare class UploadBuilder<T> {
|
|
|
703
705
|
private groupId;
|
|
704
706
|
private vector;
|
|
705
707
|
private uploadUrl;
|
|
708
|
+
private isStreamable;
|
|
706
709
|
private peerAddresses;
|
|
707
710
|
constructor(config: PinataConfig | undefined, uploadFunction: (config: PinataConfig | undefined, ...args: any[]) => Promise<T>, ...args: any[]);
|
|
708
711
|
name(name: string): UploadBuilder<T>;
|
|
@@ -711,6 +714,7 @@ declare class UploadBuilder<T> {
|
|
|
711
714
|
vectorize(): UploadBuilder<T>;
|
|
712
715
|
url(url: string): UploadBuilder<T>;
|
|
713
716
|
group(groupId: string): UploadBuilder<T>;
|
|
717
|
+
streamable(): UploadBuilder<T>;
|
|
714
718
|
peerAddress(peerAddresses: string[]): UploadBuilder<T>;
|
|
715
719
|
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
716
720
|
}
|
package/dist/index.js
CHANGED
|
@@ -2621,6 +2621,9 @@ var createSignedUploadURL = async (config, options, network) => {
|
|
|
2621
2621
|
if (network) {
|
|
2622
2622
|
payload.network = network;
|
|
2623
2623
|
}
|
|
2624
|
+
if (options.streamable) {
|
|
2625
|
+
payload.streamable = options.streamable;
|
|
2626
|
+
}
|
|
2624
2627
|
if (options.maxFileSize) {
|
|
2625
2628
|
payload.max_file_size = options.maxFileSize;
|
|
2626
2629
|
}
|
|
@@ -2735,6 +2738,9 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2735
2738
|
if (options?.metadata?.keyvalues) {
|
|
2736
2739
|
metadata + `,keyvalues ${btoa(JSON.stringify(options.metadata.keyvalues))}`;
|
|
2737
2740
|
}
|
|
2741
|
+
if (options?.streamable) {
|
|
2742
|
+
metadata + `,keyvalues ${btoa("true")}`;
|
|
2743
|
+
}
|
|
2738
2744
|
let updatedEndpoint = `${endpoint}/files`;
|
|
2739
2745
|
if (options?.url) {
|
|
2740
2746
|
updatedEndpoint = options.url;
|
|
@@ -2862,6 +2868,9 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2862
2868
|
if (options?.metadata?.keyvalues) {
|
|
2863
2869
|
data.append("keyvalues", JSON.stringify(options.metadata.keyvalues));
|
|
2864
2870
|
}
|
|
2871
|
+
if (options?.streamable) {
|
|
2872
|
+
data.append("streamable", "true");
|
|
2873
|
+
}
|
|
2865
2874
|
if (options?.url) {
|
|
2866
2875
|
try {
|
|
2867
2876
|
const request = await fetch(options.url, {
|
|
@@ -4242,7 +4251,7 @@ var FilterQueue = class {
|
|
|
4242
4251
|
async *[Symbol.asyncIterator]() {
|
|
4243
4252
|
while (true) {
|
|
4244
4253
|
const items = await this.fetchPage();
|
|
4245
|
-
for (const item of items.
|
|
4254
|
+
for (const item of items.jobs) {
|
|
4246
4255
|
yield item;
|
|
4247
4256
|
}
|
|
4248
4257
|
if (!this.currentPageToken) {
|
|
@@ -4385,6 +4394,10 @@ var UploadBuilder = class {
|
|
|
4385
4394
|
this.groupId = groupId;
|
|
4386
4395
|
return this;
|
|
4387
4396
|
}
|
|
4397
|
+
streamable() {
|
|
4398
|
+
this.isStreamable = true;
|
|
4399
|
+
return this;
|
|
4400
|
+
}
|
|
4388
4401
|
peerAddress(peerAddresses) {
|
|
4389
4402
|
this.peerAddresses = peerAddresses;
|
|
4390
4403
|
return this;
|
|
@@ -4406,6 +4419,9 @@ var UploadBuilder = class {
|
|
|
4406
4419
|
if (this.uploadUrl) {
|
|
4407
4420
|
options.url = this.uploadUrl;
|
|
4408
4421
|
}
|
|
4422
|
+
if (this.isStreamable) {
|
|
4423
|
+
options.streamable = this.isStreamable;
|
|
4424
|
+
}
|
|
4409
4425
|
if (this.peerAddresses) {
|
|
4410
4426
|
options.peerAddresses = this.peerAddresses;
|
|
4411
4427
|
}
|