pinata 2.5.1 → 2.5.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.
- package/dist/{gateway-tools-Cd7xutmh.d.mts → gateway-tools-C0QGU-4p.d.mts} +10 -1
- package/dist/{gateway-tools-Cd7xutmh.d.ts → gateway-tools-C0QGU-4p.d.ts} +10 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -6
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/package.json +3 -2
|
@@ -133,6 +133,7 @@ type ContainsCIDResponse = {
|
|
|
133
133
|
cid: string | null;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
type CidVersion = "v0" | "v1";
|
|
136
137
|
type UploadResponse = {
|
|
137
138
|
id: string;
|
|
138
139
|
name: string;
|
|
@@ -157,6 +158,10 @@ type UploadOptions = {
|
|
|
157
158
|
streamable?: boolean;
|
|
158
159
|
peerAddresses?: string[];
|
|
159
160
|
car?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* CID version "v1" or "v0" (defaults to v1 if falsy)
|
|
163
|
+
*/
|
|
164
|
+
cid_version?: CidVersion;
|
|
160
165
|
};
|
|
161
166
|
type SignedUploadUrlOptions = {
|
|
162
167
|
date?: number;
|
|
@@ -169,6 +174,10 @@ type SignedUploadUrlOptions = {
|
|
|
169
174
|
mimeTypes?: string[];
|
|
170
175
|
streamable?: boolean;
|
|
171
176
|
car?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* CID version "v1" or "v0" (defaults to v1 if falsy)
|
|
179
|
+
*/
|
|
180
|
+
cid_version?: CidVersion;
|
|
172
181
|
};
|
|
173
182
|
type UploadCIDOptions = {
|
|
174
183
|
metadata?: PinataMetadata;
|
|
@@ -210,4 +219,4 @@ declare class ValidationError extends PinataError {
|
|
|
210
219
|
declare function containsCID(input: string): Promise<ContainsCIDResponse>;
|
|
211
220
|
declare function convertToDesiredGateway(sourceUrl: string, desiredGatewayPrefix: string | undefined): Promise<string>;
|
|
212
221
|
|
|
213
|
-
export { type AccessLinkOptions as A, type
|
|
222
|
+
export { type AccessLinkOptions as A, type CidVersion as C, type DeleteResponse as D, type FileListQuery as F, type GetCIDResponse as G, type JsonBody as J, NetworkError as N, type OptimizeImageOptions as O, type PinQueueQuery as P, type SwapCidOptions as S, type UpdateFileOptions as U, type VectorizeFileResponse as V, type FileListResponse as a, type SwapCidResponse as b, type SwapHistoryOptions as c, type FileListItem as d, type VectorizeQuery as e, type VectorizeQueryResponse as f, type PinQueueResponse as g, type UploadOptions as h, type UploadResponse as i, type SignedUploadUrlOptions as j, type UploadCIDOptions as k, type PinByCIDResponse as l, type PinQueueItem as m, type FileObject as n, type PinataMetadata as o, type VectorQueryMatch as p, type ContentType as q, type ContainsCIDResponse as r, PinataError as s, AuthenticationError as t, ValidationError as u, containsCID as v, convertToDesiredGateway as w };
|
|
@@ -133,6 +133,7 @@ type ContainsCIDResponse = {
|
|
|
133
133
|
cid: string | null;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
type CidVersion = "v0" | "v1";
|
|
136
137
|
type UploadResponse = {
|
|
137
138
|
id: string;
|
|
138
139
|
name: string;
|
|
@@ -157,6 +158,10 @@ type UploadOptions = {
|
|
|
157
158
|
streamable?: boolean;
|
|
158
159
|
peerAddresses?: string[];
|
|
159
160
|
car?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* CID version "v1" or "v0" (defaults to v1 if falsy)
|
|
163
|
+
*/
|
|
164
|
+
cid_version?: CidVersion;
|
|
160
165
|
};
|
|
161
166
|
type SignedUploadUrlOptions = {
|
|
162
167
|
date?: number;
|
|
@@ -169,6 +174,10 @@ type SignedUploadUrlOptions = {
|
|
|
169
174
|
mimeTypes?: string[];
|
|
170
175
|
streamable?: boolean;
|
|
171
176
|
car?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* CID version "v1" or "v0" (defaults to v1 if falsy)
|
|
179
|
+
*/
|
|
180
|
+
cid_version?: CidVersion;
|
|
172
181
|
};
|
|
173
182
|
type UploadCIDOptions = {
|
|
174
183
|
metadata?: PinataMetadata;
|
|
@@ -210,4 +219,4 @@ declare class ValidationError extends PinataError {
|
|
|
210
219
|
declare function containsCID(input: string): Promise<ContainsCIDResponse>;
|
|
211
220
|
declare function convertToDesiredGateway(sourceUrl: string, desiredGatewayPrefix: string | undefined): Promise<string>;
|
|
212
221
|
|
|
213
|
-
export { type AccessLinkOptions as A, type
|
|
222
|
+
export { type AccessLinkOptions as A, type CidVersion as C, type DeleteResponse as D, type FileListQuery as F, type GetCIDResponse as G, type JsonBody as J, NetworkError as N, type OptimizeImageOptions as O, type PinQueueQuery as P, type SwapCidOptions as S, type UpdateFileOptions as U, type VectorizeFileResponse as V, type FileListResponse as a, type SwapCidResponse as b, type SwapHistoryOptions as c, type FileListItem as d, type VectorizeQuery as e, type VectorizeQueryResponse as f, type PinQueueResponse as g, type UploadOptions as h, type UploadResponse as i, type SignedUploadUrlOptions as j, type UploadCIDOptions as k, type PinByCIDResponse as l, type PinQueueItem as m, type FileObject as n, type PinataMetadata as o, type VectorQueryMatch as p, type ContentType as q, type ContainsCIDResponse as r, PinataError as s, AuthenticationError as t, ValidationError as u, containsCID as v, convertToDesiredGateway as w };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem } from './gateway-tools-
|
|
2
|
-
export {
|
|
1
|
+
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem, C as CidVersion } from './gateway-tools-C0QGU-4p.mjs';
|
|
2
|
+
export { t as AuthenticationError, r as ContainsCIDResponse, q as ContentType, n as FileObject, N as NetworkError, s as PinataError, o as PinataMetadata, u as ValidationError, p as VectorQueryMatch, v as containsCID, w as convertToDesiredGateway } from './gateway-tools-C0QGU-4p.mjs';
|
|
3
3
|
|
|
4
4
|
type PinataConfig = {
|
|
5
5
|
pinataJwt?: string;
|
|
@@ -524,12 +524,14 @@ declare class UploadBuilder<T> {
|
|
|
524
524
|
private isStreamable;
|
|
525
525
|
private peerAddresses;
|
|
526
526
|
private carFormat;
|
|
527
|
+
private _cidVersion;
|
|
527
528
|
constructor(config: PinataConfig | undefined, uploadFunction: (config: PinataConfig | undefined, ...args: any[]) => Promise<T>, ...args: any[]);
|
|
528
529
|
name(name: string): UploadBuilder<T>;
|
|
529
530
|
keyvalues(keyvalues: Record<string, string>): UploadBuilder<T>;
|
|
530
531
|
key(jwt: string): UploadBuilder<T>;
|
|
531
532
|
vectorize(): UploadBuilder<T>;
|
|
532
533
|
url(url: string): UploadBuilder<T>;
|
|
534
|
+
cidVersion(v: CidVersion): UploadBuilder<T>;
|
|
533
535
|
group(groupId: string): UploadBuilder<T>;
|
|
534
536
|
streamable(): UploadBuilder<T>;
|
|
535
537
|
car(): UploadBuilder<T>;
|
|
@@ -604,4 +606,4 @@ declare function getFileIdFromUrl(url: string): string;
|
|
|
604
606
|
|
|
605
607
|
declare const formatConfig: (config: PinataConfig | undefined) => PinataConfig | undefined;
|
|
606
608
|
|
|
607
|
-
export { AccessLinkOptions, type AnalyticsQuery, type DataEndponts, DeleteResponse, type Endpoints, FileListItem, FileListQuery, FileListResponse, GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, OptimizeImageOptions, PinByCIDResponse, PinQueueItem, PinQueueQuery, PinQueueResponse, type PinataConfig, PinataSDK, type PinningEndpoints, type ResourcePermission, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse, type UserPinnedDataResponse, VectorizeFileResponse, VectorizeQuery, VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, convertIPFSUrl, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
|
609
|
+
export { AccessLinkOptions, type AnalyticsQuery, CidVersion, type DataEndponts, DeleteResponse, type Endpoints, FileListItem, FileListQuery, FileListResponse, GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, OptimizeImageOptions, PinByCIDResponse, PinQueueItem, PinQueueQuery, PinQueueResponse, type PinataConfig, PinataSDK, type PinningEndpoints, type ResourcePermission, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse, type UserPinnedDataResponse, VectorizeFileResponse, VectorizeQuery, VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, convertIPFSUrl, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem } from './gateway-tools-
|
|
2
|
-
export {
|
|
1
|
+
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem, C as CidVersion } from './gateway-tools-C0QGU-4p.js';
|
|
2
|
+
export { t as AuthenticationError, r as ContainsCIDResponse, q as ContentType, n as FileObject, N as NetworkError, s as PinataError, o as PinataMetadata, u as ValidationError, p as VectorQueryMatch, v as containsCID, w as convertToDesiredGateway } from './gateway-tools-C0QGU-4p.js';
|
|
3
3
|
|
|
4
4
|
type PinataConfig = {
|
|
5
5
|
pinataJwt?: string;
|
|
@@ -524,12 +524,14 @@ declare class UploadBuilder<T> {
|
|
|
524
524
|
private isStreamable;
|
|
525
525
|
private peerAddresses;
|
|
526
526
|
private carFormat;
|
|
527
|
+
private _cidVersion;
|
|
527
528
|
constructor(config: PinataConfig | undefined, uploadFunction: (config: PinataConfig | undefined, ...args: any[]) => Promise<T>, ...args: any[]);
|
|
528
529
|
name(name: string): UploadBuilder<T>;
|
|
529
530
|
keyvalues(keyvalues: Record<string, string>): UploadBuilder<T>;
|
|
530
531
|
key(jwt: string): UploadBuilder<T>;
|
|
531
532
|
vectorize(): UploadBuilder<T>;
|
|
532
533
|
url(url: string): UploadBuilder<T>;
|
|
534
|
+
cidVersion(v: CidVersion): UploadBuilder<T>;
|
|
533
535
|
group(groupId: string): UploadBuilder<T>;
|
|
534
536
|
streamable(): UploadBuilder<T>;
|
|
535
537
|
car(): UploadBuilder<T>;
|
|
@@ -604,4 +606,4 @@ declare function getFileIdFromUrl(url: string): string;
|
|
|
604
606
|
|
|
605
607
|
declare const formatConfig: (config: PinataConfig | undefined) => PinataConfig | undefined;
|
|
606
608
|
|
|
607
|
-
export { AccessLinkOptions, type AnalyticsQuery, type DataEndponts, DeleteResponse, type Endpoints, FileListItem, FileListQuery, FileListResponse, GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, OptimizeImageOptions, PinByCIDResponse, PinQueueItem, PinQueueQuery, PinQueueResponse, type PinataConfig, PinataSDK, type PinningEndpoints, type ResourcePermission, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse, type UserPinnedDataResponse, VectorizeFileResponse, VectorizeQuery, VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, convertIPFSUrl, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
|
609
|
+
export { AccessLinkOptions, type AnalyticsQuery, CidVersion, type DataEndponts, DeleteResponse, type Endpoints, FileListItem, FileListQuery, FileListResponse, GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, OptimizeImageOptions, PinByCIDResponse, PinQueueItem, PinQueueQuery, PinQueueResponse, type PinataConfig, PinataSDK, type PinningEndpoints, type ResourcePermission, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse, type UserPinnedDataResponse, VectorizeFileResponse, VectorizeQuery, VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, convertIPFSUrl, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
package/dist/index.js
CHANGED
|
@@ -2556,11 +2556,21 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2556
2556
|
if (options?.car) {
|
|
2557
2557
|
metadata += `,car ${btoa("true")}`;
|
|
2558
2558
|
}
|
|
2559
|
+
if (options?.cid_version !== void 0) {
|
|
2560
|
+
metadata += `,cid_version ${btoa(options.cid_version)}`;
|
|
2561
|
+
}
|
|
2559
2562
|
let updatedEndpoint = `${endpoint}/files`;
|
|
2560
2563
|
if (options?.url) {
|
|
2561
2564
|
updatedEndpoint = options.url;
|
|
2562
2565
|
}
|
|
2563
|
-
const
|
|
2566
|
+
const requestUrl = new URL(updatedEndpoint);
|
|
2567
|
+
if (options?.cid_version !== void 0) {
|
|
2568
|
+
requestUrl.searchParams.set(
|
|
2569
|
+
"X-Upload-Option-Cid-Version",
|
|
2570
|
+
options.cid_version.toString()
|
|
2571
|
+
);
|
|
2572
|
+
}
|
|
2573
|
+
const urlReq = await fetch(requestUrl.toString(), {
|
|
2564
2574
|
method: "POST",
|
|
2565
2575
|
headers: {
|
|
2566
2576
|
"Upload-Length": `${file.size}`,
|
|
@@ -2722,9 +2732,13 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2722
2732
|
if (options?.car) {
|
|
2723
2733
|
data.append("car", "true");
|
|
2724
2734
|
}
|
|
2735
|
+
if (options?.cid_version !== void 0) {
|
|
2736
|
+
data.append("cid_version", options.cid_version.toString());
|
|
2737
|
+
}
|
|
2725
2738
|
if (options?.url) {
|
|
2726
2739
|
try {
|
|
2727
|
-
const
|
|
2740
|
+
const url = new URL(options.url);
|
|
2741
|
+
const request = await fetch(url.toString(), {
|
|
2728
2742
|
method: "POST",
|
|
2729
2743
|
headers,
|
|
2730
2744
|
body: data
|
|
@@ -4244,10 +4258,10 @@ var UploadBuilder = class {
|
|
|
4244
4258
|
this.uploadUrl = url;
|
|
4245
4259
|
return this;
|
|
4246
4260
|
}
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4261
|
+
cidVersion(v) {
|
|
4262
|
+
this._cidVersion = v;
|
|
4263
|
+
return this;
|
|
4264
|
+
}
|
|
4251
4265
|
group(groupId) {
|
|
4252
4266
|
this.groupId = groupId;
|
|
4253
4267
|
return this;
|
|
@@ -4290,6 +4304,9 @@ var UploadBuilder = class {
|
|
|
4290
4304
|
if (this.carFormat) {
|
|
4291
4305
|
options.car = this.carFormat;
|
|
4292
4306
|
}
|
|
4307
|
+
if (this._cidVersion !== void 0) {
|
|
4308
|
+
options.cid_version = this._cidVersion;
|
|
4309
|
+
}
|
|
4293
4310
|
this.args[this.args.length - 1] = options;
|
|
4294
4311
|
return this.uploadFunction(this.config, ...this.args).then(
|
|
4295
4312
|
onfulfilled,
|