@lumeweb/pinner 0.1.0 → 0.1.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/README.md +35 -18
- package/dist/cjs/adapters/pinata/index.cjs +6 -3
- package/dist/cjs/adapters/pinata/legacy/adapter.cjs +83 -0
- package/dist/cjs/adapters/pinata/legacy/adapter.cjs.map +1 -0
- package/dist/cjs/adapters/pinata/legacy/adapter.d.cts +74 -0
- package/dist/cjs/adapters/pinata/legacy/index.cjs +1 -0
- package/dist/cjs/adapters/pinata/shared/index.cjs +1 -0
- package/dist/cjs/adapters/pinata/shared/types.d.cts +218 -0
- package/dist/cjs/adapters/pinata/shared/utils.cjs +83 -0
- package/dist/cjs/adapters/pinata/shared/utils.cjs.map +1 -0
- package/dist/cjs/adapters/pinata/v2/adapter-interface.d.cts +198 -0
- package/dist/cjs/adapters/pinata/v2/adapter.cjs +636 -0
- package/dist/cjs/adapters/pinata/v2/adapter.cjs.map +1 -0
- package/dist/cjs/adapters/pinata/v2/adapter.d.cts +17 -0
- package/dist/cjs/adapters/pinata/v2/index.cjs +1 -0
- package/dist/cjs/adapters/pinata/v2/types.d.cts +308 -0
- package/dist/cjs/index.cjs +3 -1
- package/dist/cjs/index.d.cts +5 -3
- package/dist/cjs/pin/client.cjs +5 -3
- package/dist/cjs/pin/client.cjs.map +1 -1
- package/dist/cjs/pinner.cjs +6 -0
- package/dist/cjs/pinner.cjs.map +1 -1
- package/dist/cjs/pinner.d.cts +4 -0
- package/dist/cjs/types/constants.cjs +6 -1
- package/dist/cjs/types/constants.cjs.map +1 -1
- package/dist/cjs/types/pin.d.cts +4 -0
- package/dist/esm/adapters/pinata/index.d.ts +7 -4
- package/dist/esm/adapters/pinata/index.js +6 -3
- package/dist/esm/adapters/pinata/legacy/adapter.d.ts +74 -0
- package/dist/esm/adapters/pinata/legacy/adapter.js +83 -0
- package/dist/esm/adapters/pinata/legacy/adapter.js.map +1 -0
- package/dist/esm/adapters/pinata/legacy/index.d.ts +1 -0
- package/dist/esm/adapters/pinata/legacy/index.js +1 -0
- package/dist/esm/adapters/pinata/shared/index.d.ts +2 -0
- package/dist/esm/adapters/pinata/shared/index.js +1 -0
- package/dist/esm/adapters/pinata/shared/types.d.ts +218 -0
- package/dist/esm/adapters/pinata/shared/utils.d.ts +1 -0
- package/dist/esm/adapters/pinata/shared/utils.js +78 -0
- package/dist/esm/adapters/pinata/shared/utils.js.map +1 -0
- package/dist/esm/adapters/pinata/v2/adapter-interface.d.ts +198 -0
- package/dist/esm/adapters/pinata/v2/adapter.d.ts +17 -0
- package/dist/esm/adapters/pinata/v2/adapter.js +636 -0
- package/dist/esm/adapters/pinata/v2/adapter.js.map +1 -0
- package/dist/esm/adapters/pinata/v2/index.d.ts +3 -0
- package/dist/esm/adapters/pinata/v2/index.js +1 -0
- package/dist/esm/adapters/pinata/v2/types.d.ts +308 -0
- package/dist/esm/index.d.ts +5 -3
- package/dist/esm/index.js +3 -2
- package/dist/esm/pin/client.js +5 -3
- package/dist/esm/pin/client.js.map +1 -1
- package/dist/esm/pinner.d.ts +4 -0
- package/dist/esm/pinner.js +6 -0
- package/dist/esm/pinner.js.map +1 -1
- package/dist/esm/types/constants.js +6 -2
- package/dist/esm/types/constants.js.map +1 -1
- package/dist/esm/types/pin.d.ts +4 -0
- package/package.json +3 -3
- package/dist/cjs/adapters/pinata/adapter.cjs +0 -88
- package/dist/cjs/adapters/pinata/adapter.cjs.map +0 -1
- package/dist/cjs/adapters/pinata/adapter.d.cts +0 -35
- package/dist/cjs/adapters/pinata/builder.cjs +0 -194
- package/dist/cjs/adapters/pinata/builder.cjs.map +0 -1
- package/dist/cjs/adapters/pinata/list-builder.cjs +0 -52
- package/dist/cjs/adapters/pinata/list-builder.cjs.map +0 -1
- package/dist/cjs/types/pinata.d.cts +0 -99
- package/dist/esm/adapters/pinata/adapter.d.ts +0 -35
- package/dist/esm/adapters/pinata/adapter.js +0 -87
- package/dist/esm/adapters/pinata/adapter.js.map +0 -1
- package/dist/esm/adapters/pinata/builder.d.ts +0 -1
- package/dist/esm/adapters/pinata/builder.js +0 -187
- package/dist/esm/adapters/pinata/builder.js.map +0 -1
- package/dist/esm/adapters/pinata/list-builder.d.ts +0 -1
- package/dist/esm/adapters/pinata/list-builder.js +0 -51
- package/dist/esm/adapters/pinata/list-builder.js.map +0 -1
- package/dist/esm/types/pinata.d.ts +0 -99
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
import { DEFAULT_GATEWAY } from "../../../types/constants.js";
|
|
2
|
+
import { notSupported, parseCID } from "../shared/utils.js";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/pinata/v2/adapter.ts
|
|
5
|
+
/**
|
|
6
|
+
* Implementation of UploadBuilder
|
|
7
|
+
*/
|
|
8
|
+
var UploadBuilderImpl = class {
|
|
9
|
+
_name;
|
|
10
|
+
_keyvalues;
|
|
11
|
+
constructor(pinner, executeFn) {
|
|
12
|
+
this.pinner = pinner;
|
|
13
|
+
this.executeFn = executeFn;
|
|
14
|
+
}
|
|
15
|
+
name(name) {
|
|
16
|
+
this._name = name;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
keyvalues(keyvalues) {
|
|
20
|
+
this._keyvalues = keyvalues;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
async execute() {
|
|
24
|
+
return this.executeFn(this._name, this._keyvalues);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Implementation of FilterFiles
|
|
29
|
+
*/
|
|
30
|
+
var FilterFilesImpl = class {
|
|
31
|
+
query = {};
|
|
32
|
+
currentPageToken;
|
|
33
|
+
privacy;
|
|
34
|
+
constructor(pinner, privacy) {
|
|
35
|
+
this.pinner = pinner;
|
|
36
|
+
this.privacy = privacy;
|
|
37
|
+
}
|
|
38
|
+
name(name) {
|
|
39
|
+
this.query.name = name;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
group(group) {
|
|
43
|
+
this.query.group = group;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
cid(cid) {
|
|
47
|
+
this.query.cid = cid;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
mimeType(mimeType) {
|
|
51
|
+
this.query.mimeType = mimeType;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
order(order) {
|
|
55
|
+
this.query.order = order;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
limit(limit) {
|
|
59
|
+
this.query.limit = limit;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
cidPending(cidPending) {
|
|
63
|
+
this.query.cidPending = cidPending;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
keyvalues(keyvalues) {
|
|
67
|
+
this.query.metadata = keyvalues;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
noGroup(noGroup) {
|
|
71
|
+
this.query.noGroup = noGroup;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
pageToken(pageToken) {
|
|
75
|
+
this.query.pageToken = Number.parseInt(pageToken, 10);
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
then(onfulfilled, onrejected) {
|
|
79
|
+
return this.fetchPage().then(onfulfilled, onrejected);
|
|
80
|
+
}
|
|
81
|
+
async fetchPage() {
|
|
82
|
+
return {
|
|
83
|
+
files: (await this.pinner.listPins({ limit: this.query.limit })).map((pin) => ({
|
|
84
|
+
id: pin.cid.toString(),
|
|
85
|
+
name: pin.name || null,
|
|
86
|
+
cid: pin.cid.toString(),
|
|
87
|
+
size: pin.size || 0,
|
|
88
|
+
number_of_files: 1,
|
|
89
|
+
mime_type: "application/octet-stream",
|
|
90
|
+
keyvalues: pin.metadata || {},
|
|
91
|
+
group_id: null,
|
|
92
|
+
created_at: pin.created.toISOString()
|
|
93
|
+
})),
|
|
94
|
+
next_page_token: this.currentPageToken || ""
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async *[Symbol.asyncIterator]() {
|
|
98
|
+
while (true) {
|
|
99
|
+
const items = await this.fetchPage();
|
|
100
|
+
for (const item of items.files) yield item;
|
|
101
|
+
if (!this.currentPageToken) break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async all() {
|
|
105
|
+
const allItems = [];
|
|
106
|
+
for await (const item of this) allItems.push(item);
|
|
107
|
+
return allItems;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Implementation of FilterQueue
|
|
112
|
+
*/
|
|
113
|
+
var FilterQueueImpl = class {
|
|
114
|
+
query = {};
|
|
115
|
+
currentPageToken;
|
|
116
|
+
constructor(pinner) {
|
|
117
|
+
this.pinner = pinner;
|
|
118
|
+
}
|
|
119
|
+
cid(cid) {
|
|
120
|
+
this.query.cid = cid;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
status(status) {
|
|
124
|
+
this.query.status = status;
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
pageLimit(limit) {
|
|
128
|
+
this.query.limit = limit;
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
pageToken(pageToken) {
|
|
132
|
+
this.query.pageToken = pageToken;
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
sort(sort) {
|
|
136
|
+
this.query.sort = sort;
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
then(onfulfilled, onrejected) {
|
|
140
|
+
return this.fetchPage().then(onfulfilled, onrejected);
|
|
141
|
+
}
|
|
142
|
+
async fetchPage() {
|
|
143
|
+
return {
|
|
144
|
+
jobs: (await this.pinner.listPins({ limit: this.query.limit })).map((pin) => ({
|
|
145
|
+
id: pin.cid.toString(),
|
|
146
|
+
cid: pin.cid.toString(),
|
|
147
|
+
date_queued: pin.created.toISOString(),
|
|
148
|
+
name: pin.name || "",
|
|
149
|
+
status: pin.status || "pinned",
|
|
150
|
+
keyvalues: pin.metadata || {},
|
|
151
|
+
host_nodes: [],
|
|
152
|
+
pin_policy: {
|
|
153
|
+
regions: [],
|
|
154
|
+
version: 1
|
|
155
|
+
}
|
|
156
|
+
})),
|
|
157
|
+
next_page_token: this.currentPageToken || ""
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
async *[Symbol.asyncIterator]() {
|
|
161
|
+
while (true) {
|
|
162
|
+
const items = await this.fetchPage();
|
|
163
|
+
for (const item of items.jobs) yield item;
|
|
164
|
+
if (!this.currentPageToken) break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async all() {
|
|
168
|
+
const allItems = [];
|
|
169
|
+
for await (const item of this) allItems.push(item);
|
|
170
|
+
return allItems;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Implementation of FilterGroups
|
|
175
|
+
*/
|
|
176
|
+
var FilterGroupsImpl = class {
|
|
177
|
+
currentPageToken;
|
|
178
|
+
privacy;
|
|
179
|
+
constructor(pinner, privacy) {
|
|
180
|
+
this.pinner = pinner;
|
|
181
|
+
this.privacy = privacy;
|
|
182
|
+
}
|
|
183
|
+
name(name) {
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
limit(limit) {
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
pageToken(pageToken) {
|
|
190
|
+
this.currentPageToken = pageToken;
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
isPublic(isPublic) {
|
|
194
|
+
return this;
|
|
195
|
+
}
|
|
196
|
+
then(onfulfilled, onrejected) {
|
|
197
|
+
return this.fetchPage().then(onfulfilled, onrejected);
|
|
198
|
+
}
|
|
199
|
+
async fetchPage() {
|
|
200
|
+
return {
|
|
201
|
+
groups: [],
|
|
202
|
+
next_page_token: this.currentPageToken || ""
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
async *[Symbol.asyncIterator]() {
|
|
206
|
+
const items = await this.fetchPage();
|
|
207
|
+
for (const item of items.groups) yield item;
|
|
208
|
+
}
|
|
209
|
+
async all() {
|
|
210
|
+
const allItems = [];
|
|
211
|
+
for await (const item of this) allItems.push(item);
|
|
212
|
+
return allItems;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Implementation of PublicUpload
|
|
217
|
+
*/
|
|
218
|
+
var PublicUploadImpl = class {
|
|
219
|
+
constructor(pinner, config) {
|
|
220
|
+
this.pinner = pinner;
|
|
221
|
+
this.config = config;
|
|
222
|
+
}
|
|
223
|
+
file(file, options) {
|
|
224
|
+
return new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {
|
|
225
|
+
const result = await this.pinner.uploadAndWait(file, {
|
|
226
|
+
name: name || options?.metadata?.name,
|
|
227
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues
|
|
228
|
+
});
|
|
229
|
+
return {
|
|
230
|
+
id: result.cid,
|
|
231
|
+
name: file.name,
|
|
232
|
+
cid: result.cid,
|
|
233
|
+
size: result.size,
|
|
234
|
+
created_at: result.createdAt.toISOString(),
|
|
235
|
+
number_of_files: 1,
|
|
236
|
+
mime_type: file.type || "application/octet-stream",
|
|
237
|
+
group_id: null,
|
|
238
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues || {},
|
|
239
|
+
vectorized: false,
|
|
240
|
+
network: "public"
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
fileArray(files, options) {
|
|
245
|
+
return new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {
|
|
246
|
+
const result = await (await this.pinner.uploadDirectory(files, {
|
|
247
|
+
name: name || options?.metadata?.name,
|
|
248
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues
|
|
249
|
+
})).result;
|
|
250
|
+
return {
|
|
251
|
+
id: result.cid,
|
|
252
|
+
name: name || options?.metadata?.name || "directory",
|
|
253
|
+
cid: result.cid,
|
|
254
|
+
size: result.size,
|
|
255
|
+
created_at: result.createdAt.toISOString(),
|
|
256
|
+
number_of_files: files.length,
|
|
257
|
+
mime_type: "application/octet-stream",
|
|
258
|
+
group_id: null,
|
|
259
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues || {},
|
|
260
|
+
vectorized: false,
|
|
261
|
+
network: "public"
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
base64(base64String, options) {
|
|
266
|
+
return new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {
|
|
267
|
+
const binaryString = atob(base64String);
|
|
268
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
269
|
+
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
|
|
270
|
+
const blob = new Blob([bytes], { type: "application/octet-stream" });
|
|
271
|
+
const file = new File([blob], name || options?.metadata?.name || "file.bin", { type: "application/octet-stream" });
|
|
272
|
+
const result = await this.pinner.uploadAndWait(file, {
|
|
273
|
+
name: name || options?.metadata?.name,
|
|
274
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues
|
|
275
|
+
});
|
|
276
|
+
return {
|
|
277
|
+
id: result.cid,
|
|
278
|
+
name: file.name,
|
|
279
|
+
cid: result.cid,
|
|
280
|
+
size: result.size,
|
|
281
|
+
created_at: result.createdAt.toISOString(),
|
|
282
|
+
number_of_files: 1,
|
|
283
|
+
mime_type: "application/octet-stream",
|
|
284
|
+
group_id: null,
|
|
285
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues || {},
|
|
286
|
+
vectorized: false,
|
|
287
|
+
network: "public"
|
|
288
|
+
};
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
url(url, options) {
|
|
292
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
293
|
+
notSupported("URL upload");
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
json(data, options) {
|
|
297
|
+
return new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {
|
|
298
|
+
const jsonString = JSON.stringify(data);
|
|
299
|
+
const file = new File([jsonString], name || options?.metadata?.name || "data.json", { type: "application/json" });
|
|
300
|
+
const result = await this.pinner.uploadAndWait(file, {
|
|
301
|
+
name: name || options?.metadata?.name,
|
|
302
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues
|
|
303
|
+
});
|
|
304
|
+
return {
|
|
305
|
+
id: result.cid,
|
|
306
|
+
name: file.name,
|
|
307
|
+
cid: result.cid,
|
|
308
|
+
size: result.size,
|
|
309
|
+
created_at: result.createdAt.toISOString(),
|
|
310
|
+
number_of_files: 1,
|
|
311
|
+
mime_type: "application/json",
|
|
312
|
+
group_id: null,
|
|
313
|
+
keyvalues: keyvalues || options?.metadata?.keyvalues || {},
|
|
314
|
+
vectorized: false,
|
|
315
|
+
network: "public"
|
|
316
|
+
};
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
cid(cid, options) {
|
|
320
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
321
|
+
const cidObj = parseCID(cid);
|
|
322
|
+
const generator = await this.pinner.pinByHash(cidObj, {
|
|
323
|
+
name: options?.metadata?.name,
|
|
324
|
+
metadata: options?.metadata?.keyvalues
|
|
325
|
+
});
|
|
326
|
+
for await (const _ of generator);
|
|
327
|
+
return {
|
|
328
|
+
id: cid,
|
|
329
|
+
cid,
|
|
330
|
+
date_queued: (/* @__PURE__ */ new Date()).toISOString(),
|
|
331
|
+
name: options?.metadata?.name || "",
|
|
332
|
+
status: "pinned",
|
|
333
|
+
keyvalues: options?.metadata?.keyvalues || null,
|
|
334
|
+
host_nodes: null,
|
|
335
|
+
group_id: options?.groupId || null
|
|
336
|
+
};
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
async createSignedURL(options) {
|
|
340
|
+
notSupported("Signed upload URLs");
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Implementation of PrivateUpload
|
|
345
|
+
*/
|
|
346
|
+
var PrivateUploadImpl = class {
|
|
347
|
+
constructor(pinner, config) {
|
|
348
|
+
this.pinner = pinner;
|
|
349
|
+
this.config = config;
|
|
350
|
+
}
|
|
351
|
+
file(file, options) {
|
|
352
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
353
|
+
notSupported("Private upload");
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
fileArray(files, options) {
|
|
357
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
358
|
+
notSupported("Private upload");
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
base64(base64String, options) {
|
|
362
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
363
|
+
notSupported("Private upload");
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
url(url, options) {
|
|
367
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
368
|
+
notSupported("Private upload");
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
json(data, options) {
|
|
372
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
373
|
+
notSupported("Private upload");
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
cid(cid, options) {
|
|
377
|
+
return new UploadBuilderImpl(this.pinner, async () => {
|
|
378
|
+
notSupported("Private upload");
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
async createSignedURL(options) {
|
|
382
|
+
notSupported("Private upload");
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Implementation of PublicFiles
|
|
387
|
+
*/
|
|
388
|
+
var PublicFilesImpl = class {
|
|
389
|
+
constructor(pinner, config) {
|
|
390
|
+
this.pinner = pinner;
|
|
391
|
+
this.config = config;
|
|
392
|
+
}
|
|
393
|
+
list() {
|
|
394
|
+
return new FilterFilesImpl(this.pinner, "public");
|
|
395
|
+
}
|
|
396
|
+
async get(id) {
|
|
397
|
+
const cidObj = parseCID(id);
|
|
398
|
+
const pin = await this.pinner.getPinStatus(cidObj);
|
|
399
|
+
return {
|
|
400
|
+
id: pin.cid.toString(),
|
|
401
|
+
name: pin.name || null,
|
|
402
|
+
cid: pin.cid.toString(),
|
|
403
|
+
size: pin.size || 0,
|
|
404
|
+
number_of_files: 1,
|
|
405
|
+
mime_type: "application/octet-stream",
|
|
406
|
+
keyvalues: pin.metadata || {},
|
|
407
|
+
group_id: null,
|
|
408
|
+
created_at: pin.created.toISOString()
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
async delete(files) {
|
|
412
|
+
const results = [];
|
|
413
|
+
for (const file of files) {
|
|
414
|
+
await this.pinner.unpin(file);
|
|
415
|
+
results.push({
|
|
416
|
+
id: file,
|
|
417
|
+
status: "deleted"
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return results;
|
|
421
|
+
}
|
|
422
|
+
async update(options) {
|
|
423
|
+
await this.pinner.setPinMetadata(options.id, options.keyvalues || {});
|
|
424
|
+
const pin = await this.pinner.getPinStatus(parseCID(options.id));
|
|
425
|
+
return {
|
|
426
|
+
id: pin.cid.toString(),
|
|
427
|
+
name: pin.name || null,
|
|
428
|
+
cid: pin.cid.toString(),
|
|
429
|
+
size: pin.size || 0,
|
|
430
|
+
number_of_files: 1,
|
|
431
|
+
mime_type: "application/octet-stream",
|
|
432
|
+
keyvalues: pin.metadata || {},
|
|
433
|
+
group_id: null,
|
|
434
|
+
created_at: pin.created.toISOString()
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
async addSwap(options) {
|
|
438
|
+
notSupported("Swap CID");
|
|
439
|
+
}
|
|
440
|
+
async getSwapHistory(options) {
|
|
441
|
+
return [];
|
|
442
|
+
}
|
|
443
|
+
async deleteSwap(cid) {
|
|
444
|
+
notSupported("Swap CID");
|
|
445
|
+
}
|
|
446
|
+
queue() {
|
|
447
|
+
return new FilterQueueImpl(this.pinner);
|
|
448
|
+
}
|
|
449
|
+
async deletePinRequest(requestId) {
|
|
450
|
+
await this.pinner.unpinByRequestId(requestId);
|
|
451
|
+
return requestId;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
/**
|
|
455
|
+
* Implementation of PrivateFiles
|
|
456
|
+
*/
|
|
457
|
+
var PrivateFilesImpl = class {
|
|
458
|
+
constructor(pinner, config) {
|
|
459
|
+
this.pinner = pinner;
|
|
460
|
+
this.config = config;
|
|
461
|
+
}
|
|
462
|
+
list() {
|
|
463
|
+
notSupported("Private files");
|
|
464
|
+
}
|
|
465
|
+
async get(id) {
|
|
466
|
+
notSupported("Private files");
|
|
467
|
+
}
|
|
468
|
+
async delete(files) {
|
|
469
|
+
notSupported("Private files");
|
|
470
|
+
}
|
|
471
|
+
async update(options) {
|
|
472
|
+
notSupported("Private files");
|
|
473
|
+
}
|
|
474
|
+
async addSwap(options) {
|
|
475
|
+
notSupported("Private files");
|
|
476
|
+
}
|
|
477
|
+
async getSwapHistory(options) {
|
|
478
|
+
notSupported("Private files");
|
|
479
|
+
}
|
|
480
|
+
async deleteSwap(cid) {
|
|
481
|
+
notSupported("Private files");
|
|
482
|
+
}
|
|
483
|
+
queue() {
|
|
484
|
+
notSupported("Private files");
|
|
485
|
+
}
|
|
486
|
+
async deletePinRequest(requestId) {
|
|
487
|
+
notSupported("Private files");
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* Implementation of PublicGateways
|
|
492
|
+
*/
|
|
493
|
+
var PublicGatewaysImpl = class {
|
|
494
|
+
constructor(pinner, config) {
|
|
495
|
+
this.pinner = pinner;
|
|
496
|
+
this.config = config;
|
|
497
|
+
}
|
|
498
|
+
get(cid) {
|
|
499
|
+
return {
|
|
500
|
+
cid,
|
|
501
|
+
gateway: this.config?.pinataGateway || DEFAULT_GATEWAY,
|
|
502
|
+
url: `${this.config?.pinataGateway || DEFAULT_GATEWAY}/ipfs/${cid}`
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
async convert(url, gatewayPrefix) {
|
|
506
|
+
const gateway = gatewayPrefix || this.config?.pinataGateway || DEFAULT_GATEWAY;
|
|
507
|
+
return url.replace("ipfs://", `${gateway}/ipfs/`);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Implementation of PrivateGateways
|
|
512
|
+
*/
|
|
513
|
+
var PrivateGatewaysImpl = class {
|
|
514
|
+
constructor(pinner, config) {
|
|
515
|
+
this.pinner = pinner;
|
|
516
|
+
this.config = config;
|
|
517
|
+
}
|
|
518
|
+
get(cid) {
|
|
519
|
+
notSupported("Private gateways");
|
|
520
|
+
}
|
|
521
|
+
createAccessLink(options) {
|
|
522
|
+
notSupported("Private gateways");
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* Implementation of PublicGroups
|
|
527
|
+
*/
|
|
528
|
+
var PublicGroupsImpl = class {
|
|
529
|
+
constructor(pinner, config) {
|
|
530
|
+
this.pinner = pinner;
|
|
531
|
+
this.config = config;
|
|
532
|
+
}
|
|
533
|
+
async create(options) {
|
|
534
|
+
notSupported("Groups");
|
|
535
|
+
}
|
|
536
|
+
list() {
|
|
537
|
+
return new FilterGroupsImpl(this.pinner, "public");
|
|
538
|
+
}
|
|
539
|
+
async get(options) {
|
|
540
|
+
notSupported("Groups");
|
|
541
|
+
}
|
|
542
|
+
async addFiles(options) {
|
|
543
|
+
notSupported("Groups");
|
|
544
|
+
}
|
|
545
|
+
async removeFiles(options) {
|
|
546
|
+
notSupported("Groups");
|
|
547
|
+
}
|
|
548
|
+
async update(options) {
|
|
549
|
+
notSupported("Groups");
|
|
550
|
+
}
|
|
551
|
+
async delete(options) {
|
|
552
|
+
notSupported("Groups");
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
/**
|
|
556
|
+
* Implementation of PrivateGroups
|
|
557
|
+
*/
|
|
558
|
+
var PrivateGroupsImpl = class {
|
|
559
|
+
constructor(pinner, config) {
|
|
560
|
+
this.pinner = pinner;
|
|
561
|
+
this.config = config;
|
|
562
|
+
}
|
|
563
|
+
async create(options) {
|
|
564
|
+
notSupported("Private groups");
|
|
565
|
+
}
|
|
566
|
+
list() {
|
|
567
|
+
notSupported("Private groups");
|
|
568
|
+
}
|
|
569
|
+
async get(options) {
|
|
570
|
+
notSupported("Private groups");
|
|
571
|
+
}
|
|
572
|
+
async addFiles(options) {
|
|
573
|
+
notSupported("Private groups");
|
|
574
|
+
}
|
|
575
|
+
async removeFiles(options) {
|
|
576
|
+
notSupported("Private groups");
|
|
577
|
+
}
|
|
578
|
+
async update(options) {
|
|
579
|
+
notSupported("Private groups");
|
|
580
|
+
}
|
|
581
|
+
async delete(options) {
|
|
582
|
+
notSupported("Private groups");
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* Implementation of Analytics
|
|
587
|
+
*/
|
|
588
|
+
var AnalyticsImpl = class {
|
|
589
|
+
async requests(query) {
|
|
590
|
+
return { data: [] };
|
|
591
|
+
}
|
|
592
|
+
async bandwidth(query) {
|
|
593
|
+
return {
|
|
594
|
+
total_requests: 0,
|
|
595
|
+
total_bandwidth: 0,
|
|
596
|
+
time_periods: []
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* Create Pinata Adapter
|
|
602
|
+
*
|
|
603
|
+
* @param pinner - Pinner client instance
|
|
604
|
+
* @param config - Pinata configuration
|
|
605
|
+
* @returns PinataAdapter
|
|
606
|
+
*/
|
|
607
|
+
function pinataAdapter(pinner, config) {
|
|
608
|
+
const effectiveConfig = config || {};
|
|
609
|
+
return {
|
|
610
|
+
config: effectiveConfig,
|
|
611
|
+
updateConfig(newConfig) {
|
|
612
|
+
Object.assign(effectiveConfig, newConfig);
|
|
613
|
+
},
|
|
614
|
+
upload: {
|
|
615
|
+
public: new PublicUploadImpl(pinner, effectiveConfig),
|
|
616
|
+
private: new PrivateUploadImpl(pinner, effectiveConfig)
|
|
617
|
+
},
|
|
618
|
+
files: {
|
|
619
|
+
public: new PublicFilesImpl(pinner, effectiveConfig),
|
|
620
|
+
private: new PrivateFilesImpl(pinner, effectiveConfig)
|
|
621
|
+
},
|
|
622
|
+
gateways: {
|
|
623
|
+
public: new PublicGatewaysImpl(pinner, effectiveConfig),
|
|
624
|
+
private: new PrivateGatewaysImpl(pinner, effectiveConfig)
|
|
625
|
+
},
|
|
626
|
+
groups: {
|
|
627
|
+
public: new PublicGroupsImpl(pinner, effectiveConfig),
|
|
628
|
+
private: new PrivateGroupsImpl(pinner, effectiveConfig)
|
|
629
|
+
},
|
|
630
|
+
analytics: new AnalyticsImpl()
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
//#endregion
|
|
635
|
+
export { pinataAdapter };
|
|
636
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","names":[],"sources":["../../../../../src/adapters/pinata/v2/adapter.ts"],"sourcesContent":["/**\n * Pinata SDK 2.x Adapter Implementation\n * Provides compatibility with Pinata SDK 2.x API\n *\n * Source: https://github.com/PinataCloud/pinata/commit/cdc0c06116aaadaf7c4b287a2673cd23b6ba1125\n * - src/core/pinataSDK.ts\n * - src/core/types/index.ts\n * - src/core/classes/index.ts\n *\n * Copyright © 2024 Pinata Cloud Technologies\n * Type definitions and API interfaces adapted from Pinata SDK for compatibility.\n * Original Pinata SDK: https://github.com/PinataCloud/pinata\n */\n\nimport type { Pinner } from \"@/pinner\";\nimport type {\n\tPinataConfig,\n\tUploadResponse,\n\tUploadOptions,\n\tUploadCIDOptions,\n\tPinByCIDResponse,\n\tSignedUploadUrlOptions,\n\tFileListItem,\n\tFileListQuery,\n\tFileListResponse,\n\tUpdateFileOptions,\n\tDeleteResponse,\n\tPinQueueQuery,\n\tPinQueueResponse,\n\tSwapCidOptions,\n\tSwapCidResponse,\n\tSwapHistoryOptions,\n\tAccessLinkOptions,\n\tGroupOptions,\n\tUpdateGroupOptions,\n\tGetGroupOptions,\n\tGroupResponseItem,\n\tGroupCIDOptions,\n\tUpdateGroupFilesResponse,\n\tTopAnalyticsQuery,\n\tTopAnalyticsResponse,\n\tTimeIntervalAnalyticsQuery,\n\tTimeIntervalAnalyticsResponse,\n} from \"./types\";\nimport type {\n\tPinataAdapter,\n\tPublicUpload,\n\tPrivateUpload,\n\tPublicFiles,\n\tPrivateFiles,\n\tPublicGateways,\n\tPrivateGateways,\n\tPublicGroups,\n\tPrivateGroups,\n\tAnalytics,\n\tUploadBuilder,\n\tFilterFiles,\n\tFilterQueue,\n\tFilterGroups,\n} from \"./adapter-interface\";\nimport { parseCID, notSupported } from \"../shared/utils\";\nimport { DEFAULT_GATEWAY } from \"@/types/constants\";\n\n/**\n * Implementation of UploadBuilder\n */\nclass UploadBuilderImpl<TResult> implements UploadBuilder<TResult> {\n\tprivate _name?: string;\n\tprivate _keyvalues?: Record<string, string>;\n\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate executeFn: (name?: string, keyvalues?: Record<string, string>) => Promise<TResult>,\n\t) {}\n\n\tname(name: string): this {\n\t\tthis._name = name;\n\t\treturn this;\n\t}\n\n\tkeyvalues(keyvalues: Record<string, string>): this {\n\t\tthis._keyvalues = keyvalues;\n\t\treturn this;\n\t}\n\n\tasync execute(): Promise<TResult> {\n\t\treturn this.executeFn(this._name, this._keyvalues);\n\t}\n}\n\n/**\n * Implementation of FilterFiles\n */\nclass FilterFilesImpl implements FilterFiles {\n\tprivate query: FileListQuery = {};\n\tprivate currentPageToken: string | undefined;\n\tprivate privacy: \"public\" | \"private\";\n\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivacy: \"public\" | \"private\",\n\t) {\n\t\tthis.privacy = privacy;\n\t}\n\n\tname(name: string): FilterFiles {\n\t\tthis.query.name = name;\n\t\treturn this;\n\t}\n\n\tgroup(group: string): FilterFiles {\n\t\tthis.query.group = group;\n\t\treturn this;\n\t}\n\n\tcid(cid: string): FilterFiles {\n\t\tthis.query.cid = cid;\n\t\treturn this;\n\t}\n\n\tmimeType(mimeType: string): FilterFiles {\n\t\tthis.query.mimeType = mimeType;\n\t\treturn this;\n\t}\n\n\torder(order: \"ASC\" | \"DESC\"): FilterFiles {\n\t\tthis.query.order = order;\n\t\treturn this;\n\t}\n\n\tlimit(limit: number): FilterFiles {\n\t\tthis.query.limit = limit;\n\t\treturn this;\n\t}\n\n\tcidPending(cidPending: boolean): FilterFiles {\n\t\tthis.query.cidPending = cidPending;\n\t\treturn this;\n\t}\n\n\tkeyvalues(keyvalues: Record<string, string>): FilterFiles {\n\t\tthis.query.metadata = keyvalues;\n\t\treturn this;\n\t}\n\n\tnoGroup(noGroup: boolean): FilterFiles {\n\t\tthis.query.noGroup = noGroup;\n\t\treturn this;\n\t}\n\n\tpageToken(pageToken: string): FilterFiles {\n\t\tthis.query.pageToken = Number.parseInt(pageToken, 10);\n\t\treturn this;\n\t}\n\n\tthen(\n\t\tonfulfilled?: ((value: FileListResponse) => any) | null,\n\t\tonrejected?: ((reason: any) => any) | null,\n\t): Promise<any> {\n\t\treturn this.fetchPage().then(onfulfilled, onrejected);\n\t}\n\n\tprivate async fetchPage(): Promise<FileListResponse> {\n\t\tconst pins = await this.pinner.listPins({\n\t\t\tlimit: this.query.limit,\n\t\t});\n\n\t\treturn {\n\t\t\tfiles: pins.map((pin) => ({\n\t\t\t\tid: pin.cid.toString(),\n\t\t\t\tname: pin.name || null,\n\t\t\t\tcid: pin.cid.toString(),\n\t\t\t\tsize: pin.size || 0,\n\t\t\t\tnumber_of_files: 1,\n\t\t\t\tmime_type: \"application/octet-stream\",\n\t\t\t\tkeyvalues: pin.metadata || {},\n\t\t\t\tgroup_id: null,\n\t\t\t\tcreated_at: pin.created.toISOString(),\n\t\t\t})),\n\t\t\tnext_page_token: this.currentPageToken || \"\",\n\t\t};\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncGenerator<FileListItem, void, unknown> {\n\t\twhile (true) {\n\t\t\tconst items = await this.fetchPage();\n\t\t\tfor (const item of items.files) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t\tif (!this.currentPageToken) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tasync all(): Promise<FileListItem[]> {\n\t\tconst allItems: FileListItem[] = [];\n\t\tfor await (const item of this) {\n\t\t\tallItems.push(item);\n\t\t}\n\t\treturn allItems;\n\t}\n}\n\n/**\n * Implementation of FilterQueue\n */\nclass FilterQueueImpl implements FilterQueue {\n\tprivate query: PinQueueQuery = {};\n\tprivate currentPageToken: string | undefined;\n\n\tconstructor(private pinner: Pinner) {}\n\n\tcid(cid: string): FilterQueue {\n\t\tthis.query.cid = cid;\n\t\treturn this;\n\t}\n\n\tstatus(\n\t\tstatus:\n\t\t\t| \"prechecking\"\n\t\t\t| \"retrieving\"\n\t\t\t| \"expired\"\n\t\t\t| \"backfilled\"\n\t\t\t| \"over_free_limit\"\n\t\t\t| \"over_max_size\"\n\t\t\t| \"invalid_object\"\n\t\t\t| \"bad_host_node\",\n\t): FilterQueue {\n\t\tthis.query.status = status;\n\t\treturn this;\n\t}\n\n\tpageLimit(limit: number): FilterQueue {\n\t\tthis.query.limit = limit;\n\t\treturn this;\n\t}\n\n\tpageToken(pageToken: string): FilterQueue {\n\t\tthis.query.pageToken = pageToken;\n\t\treturn this;\n\t}\n\n\tsort(sort: \"ASC\" | \"DSC\"): FilterQueue {\n\t\tthis.query.sort = sort;\n\t\treturn this;\n\t}\n\n\tthen(\n\t\tonfulfilled?: ((value: PinQueueResponse) => any) | null,\n\t\tonrejected?: ((reason: any) => any) | null,\n\t): Promise<any> {\n\t\treturn this.fetchPage().then(onfulfilled, onrejected);\n\t}\n\n\tprivate async fetchPage(): Promise<PinQueueResponse> {\n\t\tconst pins = await this.pinner.listPins({\n\t\t\tlimit: this.query.limit,\n\t\t});\n\n\t\treturn {\n\t\t\tjobs: pins.map((pin) => ({\n\t\t\t\tid: pin.cid.toString(),\n\t\t\t\tcid: pin.cid.toString(),\n\t\t\t\tdate_queued: pin.created.toISOString(),\n\t\t\t\tname: pin.name || \"\",\n\t\t\t\tstatus: pin.status || \"pinned\",\n\t\t\t\tkeyvalues: pin.metadata || {},\n\t\t\t\thost_nodes: [],\n\t\t\t\tpin_policy: {\n\t\t\t\t\tregions: [],\n\t\t\t\t\tversion: 1,\n\t\t\t\t},\n\t\t\t})),\n\t\t\tnext_page_token: this.currentPageToken || \"\",\n\t\t};\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncGenerator<\n\t\timport(\"./types\").PinQueueItem,\n\t\tvoid,\n\t\tunknown\n\t> {\n\t\twhile (true) {\n\t\t\tconst items = await this.fetchPage();\n\t\t\tfor (const item of items.jobs) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t\tif (!this.currentPageToken) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tasync all(): Promise<import(\"./types\").PinQueueItem[]> {\n\t\tconst allItems: import(\"./types\").PinQueueItem[] = [];\n\t\tfor await (const item of this) {\n\t\t\tallItems.push(item);\n\t\t}\n\t\treturn allItems;\n\t}\n}\n\n/**\n * Implementation of FilterGroups\n */\nclass FilterGroupsImpl implements FilterGroups {\n\tprivate currentPageToken: string | undefined;\n\tprivate privacy: \"public\" | \"private\";\n\n\tconstructor(private pinner: Pinner, privacy: \"public\" | \"private\") {\n\t\tthis.privacy = privacy;\n\t}\n\n\tname(name: string): FilterGroups {\n\t\t// Pinner doesn't support groups, return empty\n\t\treturn this;\n\t}\n\n\tlimit(limit: number): FilterGroups {\n\t\treturn this;\n\t}\n\n\tpageToken(pageToken: string): FilterGroups {\n\t\tthis.currentPageToken = pageToken;\n\t\treturn this;\n\t}\n\n\tisPublic(isPublic: boolean): FilterGroups {\n\t\treturn this;\n\t}\n\n\tthen(\n\t\tonfulfilled?: ((value: import(\"./types\").GroupListResponse) => any) | null,\n\t\tonrejected?: ((reason: any) => any) | null,\n\t): Promise<any> {\n\t\treturn this.fetchPage().then(onfulfilled, onrejected);\n\t}\n\n\tprivate async fetchPage(): Promise<import(\"./types\").GroupListResponse> {\n\t\t// Pinner doesn't support groups\n\t\treturn {\n\t\t\tgroups: [],\n\t\t\tnext_page_token: this.currentPageToken || \"\",\n\t\t};\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncGenerator<GroupResponseItem, void, unknown> {\n\t\tconst items = await this.fetchPage();\n\t\tfor (const item of items.groups) {\n\t\t\tyield item;\n\t\t}\n\t}\n\n\tasync all(): Promise<GroupResponseItem[]> {\n\t\tconst allItems: GroupResponseItem[] = [];\n\t\tfor await (const item of this) {\n\t\t\tallItems.push(item);\n\t\t}\n\t\treturn allItems;\n\t}\n}\n\n/**\n * Implementation of PublicUpload\n */\nclass PublicUploadImpl implements PublicUpload {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tfile(file: File, options?: UploadOptions): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {\n\t\t\tconst result = await this.pinner.uploadAndWait(file, {\n\t\t\t\tname: name || options?.metadata?.name,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues,\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tid: result.cid,\n\t\t\t\tname: file.name,\n\t\t\t\tcid: result.cid,\n\t\t\t\tsize: result.size,\n\t\t\t\tcreated_at: result.createdAt.toISOString(),\n\t\t\t\tnumber_of_files: 1,\n\t\t\t\tmime_type: file.type || \"application/octet-stream\",\n\t\t\t\tgroup_id: null,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues || {},\n\t\t\t\tvectorized: false,\n\t\t\t\tnetwork: \"public\",\n\t\t\t};\n\t\t});\n\t}\n\n\tfileArray(\n\t\tfiles: File[],\n\t\toptions?: UploadOptions,\n\t): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {\n\t\t\tconst operation = await this.pinner.uploadDirectory(files, {\n\t\t\t\tname: name || options?.metadata?.name,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues,\n\t\t\t});\n\t\t\tconst result = await operation.result;\n\n\t\t\treturn {\n\t\t\t\tid: result.cid,\n\t\t\t\tname: name || options?.metadata?.name || \"directory\",\n\t\t\t\tcid: result.cid,\n\t\t\t\tsize: result.size,\n\t\t\t\tcreated_at: result.createdAt.toISOString(),\n\t\t\t\tnumber_of_files: files.length,\n\t\t\t\tmime_type: \"application/octet-stream\",\n\t\t\t\tgroup_id: null,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues || {},\n\t\t\t\tvectorized: false,\n\t\t\t\tnetwork: \"public\",\n\t\t\t};\n\t\t});\n\t}\n\n\tbase64(\n\t\tbase64String: string,\n\t\toptions?: UploadOptions,\n\t): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {\n\t\t\t// Convert base64 to file\n\t\t\tconst binaryString = atob(base64String);\n\t\t\tconst bytes = new Uint8Array(binaryString.length);\n\t\t\tfor (let i = 0; i < binaryString.length; i++) {\n\t\t\t\tbytes[i] = binaryString.charCodeAt(i);\n\t\t\t}\n\t\t\tconst blob = new Blob([bytes], {\n\t\t\t\ttype: \"application/octet-stream\",\n\t\t\t});\n\t\t\tconst file = new File(\n\t\t\t\t[blob],\n\t\t\t\tname || options?.metadata?.name || \"file.bin\",\n\t\t\t\t{ type: \"application/octet-stream\" },\n\t\t\t);\n\n\t\t\tconst result = await this.pinner.uploadAndWait(file, {\n\t\t\t\tname: name || options?.metadata?.name,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues,\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tid: result.cid,\n\t\t\t\tname: file.name,\n\t\t\t\tcid: result.cid,\n\t\t\t\tsize: result.size,\n\t\t\t\tcreated_at: result.createdAt.toISOString(),\n\t\t\t\tnumber_of_files: 1,\n\t\t\t\tmime_type: \"application/octet-stream\",\n\t\t\t\tgroup_id: null,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues || {},\n\t\t\t\tvectorized: false,\n\t\t\t\tnetwork: \"public\",\n\t\t\t};\n\t\t});\n\t}\n\n\turl(url: string, options?: UploadOptions): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tnotSupported(\"URL upload\");\n\t\t});\n\t}\n\n\tjson(data: object, options?: UploadOptions): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async (name, keyvalues) => {\n\t\t\tconst jsonString = JSON.stringify(data);\n\t\t\tconst file = new File(\n\t\t\t\t[jsonString],\n\t\t\t\tname || options?.metadata?.name || \"data.json\",\n\t\t\t\t{ type: \"application/json\" },\n\t\t\t);\n\n\t\t\tconst result = await this.pinner.uploadAndWait(file, {\n\t\t\t\tname: name || options?.metadata?.name,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues,\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tid: result.cid,\n\t\t\t\tname: file.name,\n\t\t\t\tcid: result.cid,\n\t\t\t\tsize: result.size,\n\t\t\t\tcreated_at: result.createdAt.toISOString(),\n\t\t\t\tnumber_of_files: 1,\n\t\t\t\tmime_type: \"application/json\",\n\t\t\t\tgroup_id: null,\n\t\t\t\tkeyvalues: keyvalues || options?.metadata?.keyvalues || {},\n\t\t\t\tvectorized: false,\n\t\t\t\tnetwork: \"public\",\n\t\t\t};\n\t\t});\n\t}\n\n\tcid(cid: string, options?: UploadCIDOptions): UploadBuilder<PinByCIDResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tconst cidObj = parseCID(cid);\n\t\t\tconst generator = await this.pinner.pinByHash(cidObj, {\n\t\t\t\tname: options?.metadata?.name,\n\t\t\t\tmetadata: options?.metadata?.keyvalues,\n\t\t\t});\n\n\t\t\tfor await (const _ of generator) {\n\t\t\t\t// Wait for pin to complete\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tid: cid,\n\t\t\t\tcid: cid,\n\t\t\t\tdate_queued: new Date().toISOString(),\n\t\t\t\tname: options?.metadata?.name || \"\",\n\t\t\t\tstatus: \"pinned\",\n\t\t\t\tkeyvalues: options?.metadata?.keyvalues || null,\n\t\t\t\thost_nodes: null,\n\t\t\t\tgroup_id: options?.groupId || null,\n\t\t\t};\n\t\t});\n\t}\n\n\tasync createSignedURL(\n\t\toptions: SignedUploadUrlOptions,\n\t): Promise<string> {\n\t\tnotSupported(\"Signed upload URLs\");\n\t}\n}\n\n/**\n * Implementation of PrivateUpload\n */\nclass PrivateUploadImpl implements PrivateUpload {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tfile(file: File, options?: UploadOptions): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tnotSupported(\"Private upload\");\n\t\t});\n\t}\n\n\tfileArray(\n\t\tfiles: File[],\n\t\toptions?: UploadOptions,\n\t): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tnotSupported(\"Private upload\");\n\t\t});\n\t}\n\n\tbase64(\n\t\tbase64String: string,\n\t\toptions?: UploadOptions,\n\t): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tnotSupported(\"Private upload\");\n\t\t});\n\t}\n\n\turl(url: string, options?: UploadOptions): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tnotSupported(\"Private upload\");\n\t\t});\n\t}\n\n\tjson(data: object, options?: UploadOptions): UploadBuilder<UploadResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tnotSupported(\"Private upload\");\n\t\t});\n\t}\n\n\tcid(cid: string, options?: UploadCIDOptions): UploadBuilder<PinByCIDResponse> {\n\t\treturn new UploadBuilderImpl(this.pinner, async () => {\n\t\t\tnotSupported(\"Private upload\");\n\t\t});\n\t}\n\n\tasync createSignedURL(\n\t\toptions: SignedUploadUrlOptions,\n\t): Promise<string> {\n\t\tnotSupported(\"Private upload\");\n\t}\n}\n\n/**\n * Implementation of PublicFiles\n */\nclass PublicFilesImpl implements PublicFiles {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tlist(): FilterFiles {\n\t\treturn new FilterFilesImpl(this.pinner, \"public\");\n\t}\n\n\tasync get(id: string): Promise<FileListItem> {\n\t\tconst cidObj = parseCID(id);\n\t\tconst pin = await this.pinner.getPinStatus(cidObj);\n\n\t\treturn {\n\t\t\tid: pin.cid.toString(),\n\t\t\tname: pin.name || null,\n\t\t\tcid: pin.cid.toString(),\n\t\t\tsize: pin.size || 0,\n\t\t\tnumber_of_files: 1,\n\t\t\tmime_type: \"application/octet-stream\",\n\t\t\tkeyvalues: pin.metadata || {},\n\t\t\tgroup_id: null,\n\t\t\tcreated_at: pin.created.toISOString(),\n\t\t};\n\t}\n\n\tasync delete(files: string[]): Promise<DeleteResponse[]> {\n\t\tconst results: DeleteResponse[] = [];\n\t\tfor (const file of files) {\n\t\t\tawait this.pinner.unpin(file);\n\t\t\tresults.push({ id: file, status: \"deleted\" });\n\t\t}\n\t\treturn results;\n\t}\n\n\tasync update(options: UpdateFileOptions): Promise<FileListItem> {\n\t\tawait this.pinner.setPinMetadata(options.id, options.keyvalues || {});\n\n\t\tconst pin = await this.pinner.getPinStatus(parseCID(options.id));\n\t\treturn {\n\t\t\tid: pin.cid.toString(),\n\t\t\tname: pin.name || null,\n\t\t\tcid: pin.cid.toString(),\n\t\t\tsize: pin.size || 0,\n\t\t\tnumber_of_files: 1,\n\t\t\tmime_type: \"application/octet-stream\",\n\t\t\tkeyvalues: pin.metadata || {},\n\t\t\tgroup_id: null,\n\t\t\tcreated_at: pin.created.toISOString(),\n\t\t};\n\t}\n\n\tasync addSwap(options: SwapCidOptions): Promise<SwapCidResponse> {\n\t\tnotSupported(\"Swap CID\");\n\t}\n\n\tasync getSwapHistory(\n\t\toptions: SwapHistoryOptions,\n\t): Promise<SwapCidResponse[]> {\n\t\treturn [];\n\t}\n\n\tasync deleteSwap(cid: string): Promise<string> {\n\t\tnotSupported(\"Swap CID\");\n\t}\n\n\tqueue(): FilterQueue {\n\t\treturn new FilterQueueImpl(this.pinner);\n\t}\n\n\tasync deletePinRequest(requestId: string): Promise<string> {\n\t\t// Delete pin by request ID (not CID)\n\t\tawait this.pinner.unpinByRequestId(requestId);\n\t\treturn requestId;\n\t}\n}\n\n/**\n * Implementation of PrivateFiles\n */\nclass PrivateFilesImpl implements PrivateFiles {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tlist(): FilterFiles {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tasync get(id: string): Promise<FileListItem> {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tasync delete(files: string[]): Promise<DeleteResponse[]> {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tasync update(options: UpdateFileOptions): Promise<FileListItem> {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tasync addSwap(options: SwapCidOptions): Promise<SwapCidResponse> {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tasync getSwapHistory(\n\t\toptions: SwapHistoryOptions,\n\t): Promise<SwapCidResponse[]> {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tasync deleteSwap(cid: string): Promise<string> {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tqueue(): FilterQueue {\n\t\tnotSupported(\"Private files\");\n\t}\n\n\tasync deletePinRequest(requestId: string): Promise<string> {\n\t\tnotSupported(\"Private files\");\n\t}\n}\n\n/**\n * Implementation of PublicGateways\n */\nclass PublicGatewaysImpl implements PublicGateways {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tget(cid: string): any {\n\t\t// Return an object that can be used to fetch CID\n\t\treturn {\n\t\t\tcid,\n\t\t\tgateway: this.config?.pinataGateway || DEFAULT_GATEWAY,\n\t\t\turl: `${this.config?.pinataGateway || DEFAULT_GATEWAY}/ipfs/${cid}`,\n\t\t};\n\t}\n\n\tasync convert(\n\t\turl: string,\n\t\tgatewayPrefix?: string,\n\t): Promise<string> {\n\t\t// Convert IPFS URL to gateway URL\n\t\tconst gateway = gatewayPrefix || this.config?.pinataGateway || DEFAULT_GATEWAY;\n\t\treturn url.replace(\"ipfs://\", `${gateway}/ipfs/`);\n\t}\n}\n\n/**\n * Implementation of PrivateGateways\n */\nclass PrivateGatewaysImpl implements PrivateGateways {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tget(cid: string): any {\n\t\tnotSupported(\"Private gateways\");\n\t}\n\n\tcreateAccessLink(options: AccessLinkOptions): any {\n\t\tnotSupported(\"Private gateways\");\n\t}\n}\n\n/**\n * Implementation of PublicGroups\n */\nclass PublicGroupsImpl implements PublicGroups {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tasync create(options: GroupOptions): Promise<GroupResponseItem> {\n\t\tnotSupported(\"Groups\");\n\t}\n\n\tlist(): FilterGroups {\n\t\treturn new FilterGroupsImpl(this.pinner, \"public\");\n\t}\n\n\tasync get(options: GetGroupOptions): Promise<GroupResponseItem> {\n\t\tnotSupported(\"Groups\");\n\t}\n\n\tasync addFiles(\n\t\toptions: GroupCIDOptions,\n\t): Promise<UpdateGroupFilesResponse[]> {\n\t\tnotSupported(\"Groups\");\n\t}\n\n\tasync removeFiles(\n\t\toptions: GroupCIDOptions,\n\t): Promise<UpdateGroupFilesResponse[]> {\n\t\tnotSupported(\"Groups\");\n\t}\n\n\tasync update(options: UpdateGroupOptions): Promise<GroupResponseItem> {\n\t\tnotSupported(\"Groups\");\n\t}\n\n\tasync delete(options: GetGroupOptions): Promise<string> {\n\t\tnotSupported(\"Groups\");\n\t}\n}\n\n/**\n * Implementation of PrivateGroups\n */\nclass PrivateGroupsImpl implements PrivateGroups {\n\tconstructor(\n\t\tprivate pinner: Pinner,\n\t\tprivate config?: PinataConfig,\n\t) {}\n\n\tasync create(options: GroupOptions): Promise<GroupResponseItem> {\n\t\tnotSupported(\"Private groups\");\n\t}\n\n\tlist(): FilterGroups {\n\t\tnotSupported(\"Private groups\");\n\t}\n\n\tasync get(options: GetGroupOptions): Promise<GroupResponseItem> {\n\t\tnotSupported(\"Private groups\");\n\t}\n\n\tasync addFiles(\n\t\toptions: GroupCIDOptions,\n\t): Promise<UpdateGroupFilesResponse[]> {\n\t\tnotSupported(\"Private groups\");\n\t}\n\n\tasync removeFiles(\n\t\toptions: GroupCIDOptions,\n\t): Promise<UpdateGroupFilesResponse[]> {\n\t\tnotSupported(\"Private groups\");\n\t}\n\n\tasync update(options: UpdateGroupOptions): Promise<GroupResponseItem> {\n\t\tnotSupported(\"Private groups\");\n\t}\n\n\tasync delete(options: GetGroupOptions): Promise<string> {\n\t\tnotSupported(\"Private groups\");\n\t}\n}\n\n/**\n * Implementation of Analytics\n */\nclass AnalyticsImpl implements Analytics {\n\tasync requests(query: TopAnalyticsQuery): Promise<TopAnalyticsResponse> {\n\t\t// Pinner doesn't support analytics\n\t\treturn {\n\t\t\tdata: [],\n\t\t};\n\t}\n\n\tasync bandwidth(\n\t\tquery: TimeIntervalAnalyticsQuery,\n\t): Promise<TimeIntervalAnalyticsResponse> {\n\t\t// Pinner doesn't support analytics\n\t\treturn {\n\t\t\ttotal_requests: 0,\n\t\t\ttotal_bandwidth: 0,\n\t\t\ttime_periods: [],\n\t\t};\n\t}\n}\n\n/**\n * Create Pinata Adapter\n *\n * @param pinner - Pinner client instance\n * @param config - Pinata configuration\n * @returns PinataAdapter\n */\nexport function pinataAdapter(\n\tpinner: Pinner,\n\tconfig?: PinataConfig,\n): PinataAdapter {\n\tconst effectiveConfig: PinataConfig = config || {};\n\n\treturn {\n\t\tconfig: effectiveConfig,\n\t\tupdateConfig(newConfig: PinataConfig): void {\n\t\t\tObject.assign(effectiveConfig, newConfig);\n\t\t},\n\n\t\tupload: {\n\t\t\tpublic: new PublicUploadImpl(pinner, effectiveConfig),\n\t\t\tprivate: new PrivateUploadImpl(pinner, effectiveConfig),\n\t\t},\n\n\t\tfiles: {\n\t\t\tpublic: new PublicFilesImpl(pinner, effectiveConfig),\n\t\t\tprivate: new PrivateFilesImpl(pinner, effectiveConfig),\n\t\t},\n\n\t\tgateways: {\n\t\t\tpublic: new PublicGatewaysImpl(pinner, effectiveConfig),\n\t\t\tprivate: new PrivateGatewaysImpl(pinner, effectiveConfig),\n\t\t},\n\n\t\tgroups: {\n\t\t\tpublic: new PublicGroupsImpl(pinner, effectiveConfig),\n\t\t\tprivate: new PrivateGroupsImpl(pinner, effectiveConfig),\n\t\t},\n\n\t\tanalytics: new AnalyticsImpl(),\n\t};\n}\n\n// Re-export interface\nexport type { PinataAdapter } from \"./adapter-interface\";\n"],"mappings":";;;;;;;AAkEA,IAAM,oBAAN,MAAmE;CAClE,AAAQ;CACR,AAAQ;CAER,YACC,AAAQ,QACR,AAAQ,WACP;EAFO;EACA;;CAGT,KAAK,MAAoB;AACxB,OAAK,QAAQ;AACb,SAAO;;CAGR,UAAU,WAAyC;AAClD,OAAK,aAAa;AAClB,SAAO;;CAGR,MAAM,UAA4B;AACjC,SAAO,KAAK,UAAU,KAAK,OAAO,KAAK,WAAW;;;;;;AAOpD,IAAM,kBAAN,MAA6C;CAC5C,AAAQ,QAAuB,EAAE;CACjC,AAAQ;CACR,AAAQ;CAER,YACC,AAAQ,QACR,SACC;EAFO;AAGR,OAAK,UAAU;;CAGhB,KAAK,MAA2B;AAC/B,OAAK,MAAM,OAAO;AAClB,SAAO;;CAGR,MAAM,OAA4B;AACjC,OAAK,MAAM,QAAQ;AACnB,SAAO;;CAGR,IAAI,KAA0B;AAC7B,OAAK,MAAM,MAAM;AACjB,SAAO;;CAGR,SAAS,UAA+B;AACvC,OAAK,MAAM,WAAW;AACtB,SAAO;;CAGR,MAAM,OAAoC;AACzC,OAAK,MAAM,QAAQ;AACnB,SAA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