pinata 2.3.0 → 2.4.1
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/chunk-7UIMBFJ5.mjs +423 -0
- package/dist/chunk-7UIMBFJ5.mjs.map +1 -0
- package/dist/chunk-P556VRQU.js +433 -0
- package/dist/chunk-P556VRQU.js.map +1 -0
- package/dist/index-CQFQEo3K.d.mts +228 -0
- package/dist/index-CQFQEo3K.d.ts +228 -0
- package/dist/index.d.mts +4 -211
- package/dist/index.d.ts +4 -211
- package/dist/index.js +361 -547
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -197
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +32 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +3 -0
- package/dist/react/index.mjs.map +1 -0
- package/package.json +59 -43
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
type FileObject = {
|
|
2
|
+
name: string;
|
|
3
|
+
size: number;
|
|
4
|
+
type: string;
|
|
5
|
+
lastModified: number;
|
|
6
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
7
|
+
};
|
|
8
|
+
type JsonBody = Record<string, unknown>;
|
|
9
|
+
type PinataMetadata = {
|
|
10
|
+
name?: string;
|
|
11
|
+
keyvalues?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
type UpdateFileOptions = {
|
|
14
|
+
id: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
keyvalues?: Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
type DeleteResponse = {
|
|
19
|
+
id: string;
|
|
20
|
+
status: string;
|
|
21
|
+
};
|
|
22
|
+
type FileListItem = {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string | null;
|
|
25
|
+
cid: "pending" | string;
|
|
26
|
+
size: number;
|
|
27
|
+
number_of_files: number;
|
|
28
|
+
mime_type: string;
|
|
29
|
+
keyvalues: Record<string, string>;
|
|
30
|
+
group_id: string | null;
|
|
31
|
+
created_at: string;
|
|
32
|
+
};
|
|
33
|
+
type FileListResponse = {
|
|
34
|
+
files: FileListItem[];
|
|
35
|
+
next_page_token: string;
|
|
36
|
+
};
|
|
37
|
+
type FileListQuery = {
|
|
38
|
+
name?: string;
|
|
39
|
+
group?: string;
|
|
40
|
+
noGroup?: boolean;
|
|
41
|
+
mimeType?: string;
|
|
42
|
+
cid?: string;
|
|
43
|
+
cidPending?: boolean;
|
|
44
|
+
metadata?: Record<string, string>;
|
|
45
|
+
order?: "ASC" | "DESC";
|
|
46
|
+
limit?: number;
|
|
47
|
+
pageToken?: string;
|
|
48
|
+
};
|
|
49
|
+
type PinQueueQuery = {
|
|
50
|
+
sort?: "ASC" | "DSC";
|
|
51
|
+
status?: "prechecking" | "retrieving" | "expired" | "backfilled" | "over_free_limit" | "over_max_size" | "invalid_object" | "bad_host_node";
|
|
52
|
+
cid?: string;
|
|
53
|
+
limit?: number;
|
|
54
|
+
pageToken?: string;
|
|
55
|
+
};
|
|
56
|
+
type PinQueueItem = {
|
|
57
|
+
id: string;
|
|
58
|
+
cid?: string;
|
|
59
|
+
ipfs_pin_hash?: string;
|
|
60
|
+
date_queued: string;
|
|
61
|
+
name: string;
|
|
62
|
+
status: string;
|
|
63
|
+
keyvalues: any;
|
|
64
|
+
host_nodes: string[];
|
|
65
|
+
pin_policy: {
|
|
66
|
+
regions: {
|
|
67
|
+
id: string;
|
|
68
|
+
desiredReplicationCount: number;
|
|
69
|
+
}[];
|
|
70
|
+
version: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
type PinQueueResponse = {
|
|
74
|
+
jobs: PinQueueItem[];
|
|
75
|
+
next_page_token: string;
|
|
76
|
+
};
|
|
77
|
+
type SwapCidOptions = {
|
|
78
|
+
cid: string;
|
|
79
|
+
swapCid: string;
|
|
80
|
+
};
|
|
81
|
+
type SwapHistoryOptions = {
|
|
82
|
+
cid: string;
|
|
83
|
+
domain: string;
|
|
84
|
+
};
|
|
85
|
+
type SwapCidResponse = {
|
|
86
|
+
mapped_cid: string;
|
|
87
|
+
created_at: string;
|
|
88
|
+
};
|
|
89
|
+
type VectorizeFileResponse = {
|
|
90
|
+
status: boolean;
|
|
91
|
+
};
|
|
92
|
+
type VectorizeQuery = {
|
|
93
|
+
groupId: string;
|
|
94
|
+
query: string;
|
|
95
|
+
returnFile?: boolean;
|
|
96
|
+
};
|
|
97
|
+
type VectorQueryMatch = {
|
|
98
|
+
file_id: string;
|
|
99
|
+
cid: string;
|
|
100
|
+
score: number;
|
|
101
|
+
};
|
|
102
|
+
type VectorizeQueryResponse = {
|
|
103
|
+
count: number;
|
|
104
|
+
matches: VectorQueryMatch[];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type ContentType = "application/json" | "application/xml" | "text/plain" | "text/html" | "text/css" | "text/javascript" | "application/javascript" | "image/jpeg" | "image/png" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/ogg" | "video/mp4" | "application/pdf" | "application/octet-stream" | string | null;
|
|
108
|
+
type GetCIDResponse = {
|
|
109
|
+
data?: JSON | string | Blob | null;
|
|
110
|
+
contentType: ContentType;
|
|
111
|
+
};
|
|
112
|
+
type OptimizeImageOptions = {
|
|
113
|
+
width?: number;
|
|
114
|
+
height?: number;
|
|
115
|
+
dpr?: number;
|
|
116
|
+
fit?: "scaleDown" | "contain" | "cover" | "crop" | "pad";
|
|
117
|
+
gravity?: "auto" | "side" | string;
|
|
118
|
+
quality?: number;
|
|
119
|
+
format?: "auto" | "webp";
|
|
120
|
+
animation?: boolean;
|
|
121
|
+
sharpen?: number;
|
|
122
|
+
onError?: boolean;
|
|
123
|
+
metadata?: "keep" | "copyright" | "none";
|
|
124
|
+
};
|
|
125
|
+
type AccessLinkOptions = {
|
|
126
|
+
cid: string;
|
|
127
|
+
date?: number;
|
|
128
|
+
expires: number;
|
|
129
|
+
gateway?: string;
|
|
130
|
+
};
|
|
131
|
+
type ContainsCIDResponse = {
|
|
132
|
+
containsCid: boolean;
|
|
133
|
+
cid: string | null;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
type UploadResponse = {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
cid: string;
|
|
140
|
+
size: number;
|
|
141
|
+
created_at: string;
|
|
142
|
+
number_of_files: number;
|
|
143
|
+
mime_type: string;
|
|
144
|
+
group_id: string | null;
|
|
145
|
+
keyvalues: {
|
|
146
|
+
[key: string]: string;
|
|
147
|
+
};
|
|
148
|
+
vectorized: boolean;
|
|
149
|
+
network: string;
|
|
150
|
+
};
|
|
151
|
+
type UploadOptions = {
|
|
152
|
+
metadata?: PinataMetadata;
|
|
153
|
+
keys?: string;
|
|
154
|
+
groupId?: string;
|
|
155
|
+
vectorize?: boolean;
|
|
156
|
+
url?: string;
|
|
157
|
+
streamable?: boolean;
|
|
158
|
+
peerAddresses?: string[];
|
|
159
|
+
};
|
|
160
|
+
type SignedUploadUrlOptions = {
|
|
161
|
+
date?: number;
|
|
162
|
+
expires: number;
|
|
163
|
+
groupId?: string;
|
|
164
|
+
name?: string;
|
|
165
|
+
keyvalues?: Record<string, string>;
|
|
166
|
+
vectorize?: boolean;
|
|
167
|
+
maxFileSize?: number;
|
|
168
|
+
mimeTypes?: string[];
|
|
169
|
+
streamable?: boolean;
|
|
170
|
+
};
|
|
171
|
+
type UploadCIDOptions = {
|
|
172
|
+
metadata?: PinataMetadata;
|
|
173
|
+
peerAddresses?: string[];
|
|
174
|
+
keys?: string;
|
|
175
|
+
groupId?: string;
|
|
176
|
+
};
|
|
177
|
+
type PinByCIDResponse = {
|
|
178
|
+
id: string;
|
|
179
|
+
cid: string;
|
|
180
|
+
date_queued: string;
|
|
181
|
+
name: string;
|
|
182
|
+
status: string;
|
|
183
|
+
keyvalues: Record<string, any> | null;
|
|
184
|
+
host_nodes: string[] | null;
|
|
185
|
+
group_id: string | null;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
interface ErrorDetails {
|
|
189
|
+
error?: string;
|
|
190
|
+
code?: string;
|
|
191
|
+
metadata?: Record<string, any>;
|
|
192
|
+
}
|
|
193
|
+
declare class PinataError extends Error {
|
|
194
|
+
statusCode?: number | undefined;
|
|
195
|
+
details?: ErrorDetails | undefined;
|
|
196
|
+
constructor(message: string, statusCode?: number | undefined, details?: ErrorDetails | undefined);
|
|
197
|
+
}
|
|
198
|
+
declare class NetworkError extends PinataError {
|
|
199
|
+
constructor(message: string, statusCode?: number, details?: ErrorDetails);
|
|
200
|
+
}
|
|
201
|
+
declare class AuthenticationError extends PinataError {
|
|
202
|
+
constructor(message: string, statusCode?: number, details?: ErrorDetails);
|
|
203
|
+
}
|
|
204
|
+
declare class ValidationError extends PinataError {
|
|
205
|
+
constructor(message: string, details?: ErrorDetails);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
declare function containsCID(input: string): Promise<ContainsCIDResponse>;
|
|
209
|
+
declare function convertToDesiredGateway(sourceUrl: string, desiredGatewayPrefix: string | undefined): Promise<string>;
|
|
210
|
+
|
|
211
|
+
type UploadResult = UploadResponse | string;
|
|
212
|
+
interface ReactUploadOptions extends UploadOptions {
|
|
213
|
+
chunkSize?: number;
|
|
214
|
+
}
|
|
215
|
+
type UseUploadReturn = {
|
|
216
|
+
progress: number;
|
|
217
|
+
loading: boolean;
|
|
218
|
+
error: Error | null;
|
|
219
|
+
uploadResponse: UploadResult | null;
|
|
220
|
+
upload: (file: File, network: "public" | "private", url: string, options?: UploadOptions) => Promise<void>;
|
|
221
|
+
pause: () => void;
|
|
222
|
+
resume: () => void;
|
|
223
|
+
cancel: () => void;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
declare const useUpload: () => UseUploadReturn;
|
|
227
|
+
|
|
228
|
+
export { type AccessLinkOptions as A, type ContentType 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 ReactUploadOptions as R, 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 ContainsCIDResponse as q, PinataError as r, AuthenticationError as s, ValidationError as t, containsCID as u, convertToDesiredGateway as v, useUpload as w, type UploadResult as x, type UseUploadReturn as y };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
type FileObject = {
|
|
2
|
+
name: string;
|
|
3
|
+
size: number;
|
|
4
|
+
type: string;
|
|
5
|
+
lastModified: number;
|
|
6
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
7
|
+
};
|
|
8
|
+
type JsonBody = Record<string, unknown>;
|
|
9
|
+
type PinataMetadata = {
|
|
10
|
+
name?: string;
|
|
11
|
+
keyvalues?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
type UpdateFileOptions = {
|
|
14
|
+
id: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
keyvalues?: Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
type DeleteResponse = {
|
|
19
|
+
id: string;
|
|
20
|
+
status: string;
|
|
21
|
+
};
|
|
22
|
+
type FileListItem = {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string | null;
|
|
25
|
+
cid: "pending" | string;
|
|
26
|
+
size: number;
|
|
27
|
+
number_of_files: number;
|
|
28
|
+
mime_type: string;
|
|
29
|
+
keyvalues: Record<string, string>;
|
|
30
|
+
group_id: string | null;
|
|
31
|
+
created_at: string;
|
|
32
|
+
};
|
|
33
|
+
type FileListResponse = {
|
|
34
|
+
files: FileListItem[];
|
|
35
|
+
next_page_token: string;
|
|
36
|
+
};
|
|
37
|
+
type FileListQuery = {
|
|
38
|
+
name?: string;
|
|
39
|
+
group?: string;
|
|
40
|
+
noGroup?: boolean;
|
|
41
|
+
mimeType?: string;
|
|
42
|
+
cid?: string;
|
|
43
|
+
cidPending?: boolean;
|
|
44
|
+
metadata?: Record<string, string>;
|
|
45
|
+
order?: "ASC" | "DESC";
|
|
46
|
+
limit?: number;
|
|
47
|
+
pageToken?: string;
|
|
48
|
+
};
|
|
49
|
+
type PinQueueQuery = {
|
|
50
|
+
sort?: "ASC" | "DSC";
|
|
51
|
+
status?: "prechecking" | "retrieving" | "expired" | "backfilled" | "over_free_limit" | "over_max_size" | "invalid_object" | "bad_host_node";
|
|
52
|
+
cid?: string;
|
|
53
|
+
limit?: number;
|
|
54
|
+
pageToken?: string;
|
|
55
|
+
};
|
|
56
|
+
type PinQueueItem = {
|
|
57
|
+
id: string;
|
|
58
|
+
cid?: string;
|
|
59
|
+
ipfs_pin_hash?: string;
|
|
60
|
+
date_queued: string;
|
|
61
|
+
name: string;
|
|
62
|
+
status: string;
|
|
63
|
+
keyvalues: any;
|
|
64
|
+
host_nodes: string[];
|
|
65
|
+
pin_policy: {
|
|
66
|
+
regions: {
|
|
67
|
+
id: string;
|
|
68
|
+
desiredReplicationCount: number;
|
|
69
|
+
}[];
|
|
70
|
+
version: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
type PinQueueResponse = {
|
|
74
|
+
jobs: PinQueueItem[];
|
|
75
|
+
next_page_token: string;
|
|
76
|
+
};
|
|
77
|
+
type SwapCidOptions = {
|
|
78
|
+
cid: string;
|
|
79
|
+
swapCid: string;
|
|
80
|
+
};
|
|
81
|
+
type SwapHistoryOptions = {
|
|
82
|
+
cid: string;
|
|
83
|
+
domain: string;
|
|
84
|
+
};
|
|
85
|
+
type SwapCidResponse = {
|
|
86
|
+
mapped_cid: string;
|
|
87
|
+
created_at: string;
|
|
88
|
+
};
|
|
89
|
+
type VectorizeFileResponse = {
|
|
90
|
+
status: boolean;
|
|
91
|
+
};
|
|
92
|
+
type VectorizeQuery = {
|
|
93
|
+
groupId: string;
|
|
94
|
+
query: string;
|
|
95
|
+
returnFile?: boolean;
|
|
96
|
+
};
|
|
97
|
+
type VectorQueryMatch = {
|
|
98
|
+
file_id: string;
|
|
99
|
+
cid: string;
|
|
100
|
+
score: number;
|
|
101
|
+
};
|
|
102
|
+
type VectorizeQueryResponse = {
|
|
103
|
+
count: number;
|
|
104
|
+
matches: VectorQueryMatch[];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type ContentType = "application/json" | "application/xml" | "text/plain" | "text/html" | "text/css" | "text/javascript" | "application/javascript" | "image/jpeg" | "image/png" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/ogg" | "video/mp4" | "application/pdf" | "application/octet-stream" | string | null;
|
|
108
|
+
type GetCIDResponse = {
|
|
109
|
+
data?: JSON | string | Blob | null;
|
|
110
|
+
contentType: ContentType;
|
|
111
|
+
};
|
|
112
|
+
type OptimizeImageOptions = {
|
|
113
|
+
width?: number;
|
|
114
|
+
height?: number;
|
|
115
|
+
dpr?: number;
|
|
116
|
+
fit?: "scaleDown" | "contain" | "cover" | "crop" | "pad";
|
|
117
|
+
gravity?: "auto" | "side" | string;
|
|
118
|
+
quality?: number;
|
|
119
|
+
format?: "auto" | "webp";
|
|
120
|
+
animation?: boolean;
|
|
121
|
+
sharpen?: number;
|
|
122
|
+
onError?: boolean;
|
|
123
|
+
metadata?: "keep" | "copyright" | "none";
|
|
124
|
+
};
|
|
125
|
+
type AccessLinkOptions = {
|
|
126
|
+
cid: string;
|
|
127
|
+
date?: number;
|
|
128
|
+
expires: number;
|
|
129
|
+
gateway?: string;
|
|
130
|
+
};
|
|
131
|
+
type ContainsCIDResponse = {
|
|
132
|
+
containsCid: boolean;
|
|
133
|
+
cid: string | null;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
type UploadResponse = {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
cid: string;
|
|
140
|
+
size: number;
|
|
141
|
+
created_at: string;
|
|
142
|
+
number_of_files: number;
|
|
143
|
+
mime_type: string;
|
|
144
|
+
group_id: string | null;
|
|
145
|
+
keyvalues: {
|
|
146
|
+
[key: string]: string;
|
|
147
|
+
};
|
|
148
|
+
vectorized: boolean;
|
|
149
|
+
network: string;
|
|
150
|
+
};
|
|
151
|
+
type UploadOptions = {
|
|
152
|
+
metadata?: PinataMetadata;
|
|
153
|
+
keys?: string;
|
|
154
|
+
groupId?: string;
|
|
155
|
+
vectorize?: boolean;
|
|
156
|
+
url?: string;
|
|
157
|
+
streamable?: boolean;
|
|
158
|
+
peerAddresses?: string[];
|
|
159
|
+
};
|
|
160
|
+
type SignedUploadUrlOptions = {
|
|
161
|
+
date?: number;
|
|
162
|
+
expires: number;
|
|
163
|
+
groupId?: string;
|
|
164
|
+
name?: string;
|
|
165
|
+
keyvalues?: Record<string, string>;
|
|
166
|
+
vectorize?: boolean;
|
|
167
|
+
maxFileSize?: number;
|
|
168
|
+
mimeTypes?: string[];
|
|
169
|
+
streamable?: boolean;
|
|
170
|
+
};
|
|
171
|
+
type UploadCIDOptions = {
|
|
172
|
+
metadata?: PinataMetadata;
|
|
173
|
+
peerAddresses?: string[];
|
|
174
|
+
keys?: string;
|
|
175
|
+
groupId?: string;
|
|
176
|
+
};
|
|
177
|
+
type PinByCIDResponse = {
|
|
178
|
+
id: string;
|
|
179
|
+
cid: string;
|
|
180
|
+
date_queued: string;
|
|
181
|
+
name: string;
|
|
182
|
+
status: string;
|
|
183
|
+
keyvalues: Record<string, any> | null;
|
|
184
|
+
host_nodes: string[] | null;
|
|
185
|
+
group_id: string | null;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
interface ErrorDetails {
|
|
189
|
+
error?: string;
|
|
190
|
+
code?: string;
|
|
191
|
+
metadata?: Record<string, any>;
|
|
192
|
+
}
|
|
193
|
+
declare class PinataError extends Error {
|
|
194
|
+
statusCode?: number | undefined;
|
|
195
|
+
details?: ErrorDetails | undefined;
|
|
196
|
+
constructor(message: string, statusCode?: number | undefined, details?: ErrorDetails | undefined);
|
|
197
|
+
}
|
|
198
|
+
declare class NetworkError extends PinataError {
|
|
199
|
+
constructor(message: string, statusCode?: number, details?: ErrorDetails);
|
|
200
|
+
}
|
|
201
|
+
declare class AuthenticationError extends PinataError {
|
|
202
|
+
constructor(message: string, statusCode?: number, details?: ErrorDetails);
|
|
203
|
+
}
|
|
204
|
+
declare class ValidationError extends PinataError {
|
|
205
|
+
constructor(message: string, details?: ErrorDetails);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
declare function containsCID(input: string): Promise<ContainsCIDResponse>;
|
|
209
|
+
declare function convertToDesiredGateway(sourceUrl: string, desiredGatewayPrefix: string | undefined): Promise<string>;
|
|
210
|
+
|
|
211
|
+
type UploadResult = UploadResponse | string;
|
|
212
|
+
interface ReactUploadOptions extends UploadOptions {
|
|
213
|
+
chunkSize?: number;
|
|
214
|
+
}
|
|
215
|
+
type UseUploadReturn = {
|
|
216
|
+
progress: number;
|
|
217
|
+
loading: boolean;
|
|
218
|
+
error: Error | null;
|
|
219
|
+
uploadResponse: UploadResult | null;
|
|
220
|
+
upload: (file: File, network: "public" | "private", url: string, options?: UploadOptions) => Promise<void>;
|
|
221
|
+
pause: () => void;
|
|
222
|
+
resume: () => void;
|
|
223
|
+
cancel: () => void;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
declare const useUpload: () => UseUploadReturn;
|
|
227
|
+
|
|
228
|
+
export { type AccessLinkOptions as A, type ContentType 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 ReactUploadOptions as R, 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 ContainsCIDResponse as q, PinataError as r, AuthenticationError as s, ValidationError as t, containsCID as u, convertToDesiredGateway as v, useUpload as w, type UploadResult as x, type UseUploadReturn as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
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 './index-CQFQEo3K.mjs';
|
|
2
|
+
export { s as AuthenticationError, q as ContainsCIDResponse, C as ContentType, n as FileObject, N as NetworkError, r as PinataError, o as PinataMetadata, R as ReactUploadOptions, x as UploadResult, y as UseUploadReturn, t as ValidationError, p as VectorQueryMatch, u as containsCID, v as convert, v as convertToDesiredGateway, w as useUpload } from './index-CQFQEo3K.mjs';
|
|
3
|
+
|
|
1
4
|
type PinataConfig = {
|
|
2
5
|
pinataJwt?: string;
|
|
3
6
|
pinataGateway?: string;
|
|
@@ -53,141 +56,6 @@ type UserPinnedDataResponse = {
|
|
|
53
56
|
pin_size_with_replications_total: number;
|
|
54
57
|
};
|
|
55
58
|
|
|
56
|
-
type FileObject = {
|
|
57
|
-
name: string;
|
|
58
|
-
size: number;
|
|
59
|
-
type: string;
|
|
60
|
-
lastModified: number;
|
|
61
|
-
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
62
|
-
};
|
|
63
|
-
type JsonBody = Record<string, unknown>;
|
|
64
|
-
type PinataMetadata = {
|
|
65
|
-
name?: string;
|
|
66
|
-
keyvalues?: Record<string, string>;
|
|
67
|
-
};
|
|
68
|
-
type UpdateFileOptions = {
|
|
69
|
-
id: string;
|
|
70
|
-
name?: string;
|
|
71
|
-
keyvalues?: Record<string, string>;
|
|
72
|
-
};
|
|
73
|
-
type DeleteResponse = {
|
|
74
|
-
id: string;
|
|
75
|
-
status: string;
|
|
76
|
-
};
|
|
77
|
-
type FileListItem = {
|
|
78
|
-
id: string;
|
|
79
|
-
name: string | null;
|
|
80
|
-
cid: "pending" | string;
|
|
81
|
-
size: number;
|
|
82
|
-
number_of_files: number;
|
|
83
|
-
mime_type: string;
|
|
84
|
-
keyvalues: Record<string, string>;
|
|
85
|
-
group_id: string | null;
|
|
86
|
-
created_at: string;
|
|
87
|
-
};
|
|
88
|
-
type FileListResponse = {
|
|
89
|
-
files: FileListItem[];
|
|
90
|
-
next_page_token: string;
|
|
91
|
-
};
|
|
92
|
-
type FileListQuery = {
|
|
93
|
-
name?: string;
|
|
94
|
-
group?: string;
|
|
95
|
-
noGroup?: boolean;
|
|
96
|
-
mimeType?: string;
|
|
97
|
-
cid?: string;
|
|
98
|
-
cidPending?: boolean;
|
|
99
|
-
metadata?: Record<string, string>;
|
|
100
|
-
order?: "ASC" | "DESC";
|
|
101
|
-
limit?: number;
|
|
102
|
-
pageToken?: string;
|
|
103
|
-
};
|
|
104
|
-
type PinQueueQuery = {
|
|
105
|
-
sort?: "ASC" | "DSC";
|
|
106
|
-
status?: "prechecking" | "retrieving" | "expired" | "backfilled" | "over_free_limit" | "over_max_size" | "invalid_object" | "bad_host_node";
|
|
107
|
-
cid?: string;
|
|
108
|
-
limit?: number;
|
|
109
|
-
pageToken?: string;
|
|
110
|
-
};
|
|
111
|
-
type PinQueueItem = {
|
|
112
|
-
id: string;
|
|
113
|
-
cid?: string;
|
|
114
|
-
ipfs_pin_hash?: string;
|
|
115
|
-
date_queued: string;
|
|
116
|
-
name: string;
|
|
117
|
-
status: string;
|
|
118
|
-
keyvalues: any;
|
|
119
|
-
host_nodes: string[];
|
|
120
|
-
pin_policy: {
|
|
121
|
-
regions: {
|
|
122
|
-
id: string;
|
|
123
|
-
desiredReplicationCount: number;
|
|
124
|
-
}[];
|
|
125
|
-
version: number;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
type PinQueueResponse = {
|
|
129
|
-
jobs: PinQueueItem[];
|
|
130
|
-
next_page_token: string;
|
|
131
|
-
};
|
|
132
|
-
type SwapCidOptions = {
|
|
133
|
-
cid: string;
|
|
134
|
-
swapCid: string;
|
|
135
|
-
};
|
|
136
|
-
type SwapHistoryOptions = {
|
|
137
|
-
cid: string;
|
|
138
|
-
domain: string;
|
|
139
|
-
};
|
|
140
|
-
type SwapCidResponse = {
|
|
141
|
-
mapped_cid: string;
|
|
142
|
-
created_at: string;
|
|
143
|
-
};
|
|
144
|
-
type VectorizeFileResponse = {
|
|
145
|
-
status: boolean;
|
|
146
|
-
};
|
|
147
|
-
type VectorizeQuery = {
|
|
148
|
-
groupId: string;
|
|
149
|
-
query: string;
|
|
150
|
-
returnFile?: boolean;
|
|
151
|
-
};
|
|
152
|
-
type VectorQueryMatch = {
|
|
153
|
-
file_id: string;
|
|
154
|
-
cid: string;
|
|
155
|
-
score: number;
|
|
156
|
-
};
|
|
157
|
-
type VectorizeQueryResponse = {
|
|
158
|
-
count: number;
|
|
159
|
-
matches: VectorQueryMatch[];
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
type ContentType = "application/json" | "application/xml" | "text/plain" | "text/html" | "text/css" | "text/javascript" | "application/javascript" | "image/jpeg" | "image/png" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/ogg" | "video/mp4" | "application/pdf" | "application/octet-stream" | string | null;
|
|
163
|
-
type GetCIDResponse = {
|
|
164
|
-
data?: JSON | string | Blob | null;
|
|
165
|
-
contentType: ContentType;
|
|
166
|
-
};
|
|
167
|
-
type OptimizeImageOptions = {
|
|
168
|
-
width?: number;
|
|
169
|
-
height?: number;
|
|
170
|
-
dpr?: number;
|
|
171
|
-
fit?: "scaleDown" | "contain" | "cover" | "crop" | "pad";
|
|
172
|
-
gravity?: "auto" | "side" | string;
|
|
173
|
-
quality?: number;
|
|
174
|
-
format?: "auto" | "webp";
|
|
175
|
-
animation?: boolean;
|
|
176
|
-
sharpen?: number;
|
|
177
|
-
onError?: boolean;
|
|
178
|
-
metadata?: "keep" | "copyright" | "none";
|
|
179
|
-
};
|
|
180
|
-
type AccessLinkOptions = {
|
|
181
|
-
cid: string;
|
|
182
|
-
date?: number;
|
|
183
|
-
expires: number;
|
|
184
|
-
gateway?: string;
|
|
185
|
-
};
|
|
186
|
-
type ContainsCIDResponse = {
|
|
187
|
-
containsCid: boolean;
|
|
188
|
-
cid: string | null;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
59
|
type GroupOptions = {
|
|
192
60
|
name: string;
|
|
193
61
|
isPublic?: boolean;
|
|
@@ -307,58 +175,6 @@ type SignatureResponse = {
|
|
|
307
175
|
signature: string;
|
|
308
176
|
};
|
|
309
177
|
|
|
310
|
-
type UploadResponse = {
|
|
311
|
-
id: string;
|
|
312
|
-
name: string;
|
|
313
|
-
cid: string;
|
|
314
|
-
size: number;
|
|
315
|
-
created_at: string;
|
|
316
|
-
number_of_files: number;
|
|
317
|
-
mime_type: string;
|
|
318
|
-
group_id: string | null;
|
|
319
|
-
keyvalues: {
|
|
320
|
-
[key: string]: string;
|
|
321
|
-
};
|
|
322
|
-
vectorized: boolean;
|
|
323
|
-
network: string;
|
|
324
|
-
};
|
|
325
|
-
type UploadOptions = {
|
|
326
|
-
metadata?: PinataMetadata;
|
|
327
|
-
keys?: string;
|
|
328
|
-
groupId?: string;
|
|
329
|
-
vectorize?: boolean;
|
|
330
|
-
url?: string;
|
|
331
|
-
streamable?: boolean;
|
|
332
|
-
peerAddresses?: string[];
|
|
333
|
-
};
|
|
334
|
-
type SignedUploadUrlOptions = {
|
|
335
|
-
date?: number;
|
|
336
|
-
expires: number;
|
|
337
|
-
groupId?: string;
|
|
338
|
-
name?: string;
|
|
339
|
-
keyvalues?: Record<string, string>;
|
|
340
|
-
vectorize?: boolean;
|
|
341
|
-
maxFileSize?: number;
|
|
342
|
-
mimeTypes?: string[];
|
|
343
|
-
streamable?: boolean;
|
|
344
|
-
};
|
|
345
|
-
type UploadCIDOptions = {
|
|
346
|
-
metadata?: PinataMetadata;
|
|
347
|
-
peerAddresses?: string[];
|
|
348
|
-
keys?: string;
|
|
349
|
-
groupId?: string;
|
|
350
|
-
};
|
|
351
|
-
type PinByCIDResponse = {
|
|
352
|
-
id: string;
|
|
353
|
-
cid: string;
|
|
354
|
-
date_queued: string;
|
|
355
|
-
name: string;
|
|
356
|
-
status: string;
|
|
357
|
-
keyvalues: Record<string, any> | null;
|
|
358
|
-
host_nodes: string[] | null;
|
|
359
|
-
group_id: string | null;
|
|
360
|
-
};
|
|
361
|
-
|
|
362
178
|
declare const analyticsDateInterval: (config: PinataConfig | undefined, options?: TimeIntervalAnalyticsQuery) => Promise<TimeIntervalAnalyticsResponse>;
|
|
363
179
|
|
|
364
180
|
declare const analyticsTopUsage: (config: PinataConfig | undefined, options?: TopAnalyticsQuery) => Promise<TopAnalyticsResponse>;
|
|
@@ -782,31 +598,8 @@ declare class PinataSDK {
|
|
|
782
598
|
testAuthentication(): Promise<string>;
|
|
783
599
|
}
|
|
784
600
|
|
|
785
|
-
interface ErrorDetails {
|
|
786
|
-
error?: string;
|
|
787
|
-
code?: string;
|
|
788
|
-
metadata?: Record<string, any>;
|
|
789
|
-
}
|
|
790
|
-
declare class PinataError extends Error {
|
|
791
|
-
statusCode?: number | undefined;
|
|
792
|
-
details?: ErrorDetails | undefined;
|
|
793
|
-
constructor(message: string, statusCode?: number | undefined, details?: ErrorDetails | undefined);
|
|
794
|
-
}
|
|
795
|
-
declare class NetworkError extends PinataError {
|
|
796
|
-
constructor(message: string, statusCode?: number, details?: ErrorDetails);
|
|
797
|
-
}
|
|
798
|
-
declare class AuthenticationError extends PinataError {
|
|
799
|
-
constructor(message: string, statusCode?: number, details?: ErrorDetails);
|
|
800
|
-
}
|
|
801
|
-
declare class ValidationError extends PinataError {
|
|
802
|
-
constructor(message: string, details?: ErrorDetails);
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
declare function containsCID(input: string): Promise<ContainsCIDResponse>;
|
|
806
|
-
declare function convertToDesiredGateway(sourceUrl: string, desiredGatewayPrefix: string | undefined): Promise<string>;
|
|
807
|
-
|
|
808
601
|
declare function getFileIdFromUrl(url: string): string;
|
|
809
602
|
|
|
810
603
|
declare const formatConfig: (config: PinataConfig | undefined) => PinataConfig | undefined;
|
|
811
604
|
|
|
812
|
-
export {
|
|
605
|
+
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 };
|