@lumeweb/pinner 0.1.4 → 0.1.5

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.
Files changed (42) hide show
  1. package/dist/esm/api/generated/content/content.msw.d.ts +8 -0
  2. package/dist/esm/api/generated/content/content.msw.js +147 -0
  3. package/dist/esm/api/generated/content/content.msw.js.map +1 -0
  4. package/dist/esm/api/generated/dns/dns.msw.d.ts +8 -0
  5. package/dist/esm/api/generated/dns/dns.msw.js +413 -0
  6. package/dist/esm/api/generated/dns/dns.msw.js.map +1 -0
  7. package/dist/esm/api/generated/files/files.msw.d.ts +8 -0
  8. package/dist/esm/api/generated/files/files.msw.js +150 -0
  9. package/dist/esm/api/generated/files/files.msw.js.map +1 -0
  10. package/dist/esm/api/generated/gateway/gateway.msw.d.ts +8 -0
  11. package/dist/esm/api/generated/gateway/gateway.msw.js +91 -0
  12. package/dist/esm/api/generated/gateway/gateway.msw.js.map +1 -0
  13. package/dist/esm/api/generated/index.msw.d.ts +10 -0
  14. package/dist/esm/api/generated/index.msw.js +11 -0
  15. package/dist/esm/api/generated/internal/internal.msw.d.ts +8 -0
  16. package/dist/esm/api/generated/internal/internal.msw.js +103 -0
  17. package/dist/esm/api/generated/internal/internal.msw.js.map +1 -0
  18. package/dist/esm/api/generated/ipns/ipns.msw.d.ts +8 -0
  19. package/dist/esm/api/generated/ipns/ipns.msw.js +205 -0
  20. package/dist/esm/api/generated/ipns/ipns.msw.js.map +1 -0
  21. package/dist/esm/api/generated/pinning/pinning.msw.d.ts +8 -0
  22. package/dist/esm/api/generated/pinning/pinning.msw.js +282 -0
  23. package/dist/esm/api/generated/pinning/pinning.msw.js.map +1 -0
  24. package/dist/esm/api/generated/schemas/iPNSRepublishResponse.d.ts +43 -0
  25. package/dist/esm/api/generated/schemas/websiteItem.d.ts +3 -0
  26. package/dist/esm/api/generated/schemas/websiteResponse.d.ts +3 -0
  27. package/dist/esm/api/generated/schemas/websiteValidateResponse.d.ts +1 -0
  28. package/dist/esm/api/generated/tus/tus.msw.d.ts +8 -0
  29. package/dist/esm/api/generated/tus/tus.msw.js +98 -0
  30. package/dist/esm/api/generated/tus/tus.msw.js.map +1 -0
  31. package/dist/esm/api/generated/websites/websites.msw.d.ts +8 -0
  32. package/dist/esm/api/generated/websites/websites.msw.js +417 -0
  33. package/dist/esm/api/generated/websites/websites.msw.js.map +1 -0
  34. package/dist/esm/api/ipns.d.ts +3 -2
  35. package/dist/esm/api/ipns.js +2 -3
  36. package/dist/esm/api/ipns.js.map +1 -1
  37. package/dist/esm/api/websites.d.ts +12 -2
  38. package/dist/esm/api/websites.js +19 -1
  39. package/dist/esm/api/websites.js.map +1 -1
  40. package/dist/esm/index.d.ts +2 -2
  41. package/dist/esm/index.js +2 -2
  42. package/package.json +8 -3
@@ -0,0 +1,417 @@
1
+ import { faker } from "/home/runner/work/web/web/node_modules/.pnpm/@faker-js+faker@10.4.0/node_modules/@faker-js/faker/dist/index.js";
2
+ import { HttpResponse, delay, http } from "/home/runner/work/web/web/node_modules/.pnpm/msw@2.14.6_@types+node@25.9.1_typescript@6.0.3/node_modules/msw/lib/core/index.mjs";
3
+
4
+ //#region src/api/generated/websites/websites.msw.ts
5
+ /**
6
+ * Generated by orval v8.10.0 🍺
7
+ * Do not edit manually.
8
+ * Portal IPFS Plugin API
9
+ *
10
+ ## Portal IPFS Plugin API
11
+
12
+ A comprehensive API for IPFS content management, including pinning services, file operations, IPNS key management, and website hosting.
13
+
14
+ ### IPFS Pinning Service API Compatibility
15
+
16
+ This API is fully compatible with the [IPFS Pinning Service API specification](https://github.com/ipfs/pinning-services-api-spec), an implementation-agnostic API standard for pinning service providers. This ensures interoperability with existing IPFS pinning clients and tools.
17
+
18
+ ### Features
19
+
20
+ - **Pinning**: Add, list, update, and remove pinned content
21
+ - **Content**: Upload files, retrieve IPFS content, and manage metadata
22
+ - **IPNS**: Manage IPNS keys and publish content
23
+ - **Files**: Browse and manage pinned files with directory navigation
24
+ - **Websites**: Create and manage website hosting with DNS and SSL automation
25
+
26
+ ### Authentication
27
+
28
+ All API endpoints require authentication using JWT tokens obtained from the Portal authentication service.
29
+
30
+ ### Rate Limiting
31
+
32
+ API requests are rate-limited based on user account tier. See Portal documentation for current limits.
33
+
34
+ ### Documentation
35
+
36
+ For detailed API usage examples and integration guides, visit the Portal documentation website.
37
+
38
+ * OpenAPI spec version: 1.0.0
39
+ */
40
+ const getGetApiWebsitesResponseMock = (overrideResponse = {}) => ({
41
+ data: Array.from({ length: faker.number.int({
42
+ min: 1,
43
+ max: 10
44
+ }) }, (_, i) => i + 1).map(() => ({
45
+ active_cid: faker.helpers.arrayElement([faker.string.alpha({ length: {
46
+ min: 10,
47
+ max: 20
48
+ } }), void 0]),
49
+ created: faker.date.past().toISOString().slice(0, 19) + "Z",
50
+ dns_hosting_enabled: faker.datatype.boolean(),
51
+ dns_zone_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
52
+ domain: faker.string.alpha({ length: {
53
+ min: 10,
54
+ max: 20
55
+ } }),
56
+ expired: faker.datatype.boolean(),
57
+ gateway_domain: faker.helpers.arrayElement([faker.string.alpha({ length: {
58
+ min: 10,
59
+ max: 20
60
+ } }), void 0]),
61
+ id: faker.number.int(),
62
+ ipns_key_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
63
+ is_subdomain: faker.datatype.boolean(),
64
+ last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
65
+ ssl: faker.helpers.arrayElement([{
66
+ error: faker.helpers.arrayElement([faker.string.alpha({ length: {
67
+ min: 10,
68
+ max: 20
69
+ } }), void 0]),
70
+ issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
71
+ last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
72
+ status: faker.string.alpha({ length: {
73
+ min: 10,
74
+ max: 20
75
+ } })
76
+ }, void 0]),
77
+ status: faker.string.alpha({ length: {
78
+ min: 10,
79
+ max: 20
80
+ } }),
81
+ target_hash: faker.string.alpha({ length: {
82
+ min: 10,
83
+ max: 20
84
+ } }),
85
+ target_type: faker.string.alpha({ length: {
86
+ min: 10,
87
+ max: 20
88
+ } }),
89
+ updated: faker.date.past().toISOString().slice(0, 19) + "Z",
90
+ validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
91
+ validation_token: faker.string.alpha({ length: {
92
+ min: 10,
93
+ max: 20
94
+ } })
95
+ })),
96
+ total: faker.number.int(),
97
+ ...overrideResponse
98
+ });
99
+ const getPostApiWebsitesResponseMock = (overrideResponse = {}) => faker.helpers.arrayElement([{
100
+ error: faker.string.alpha({ length: {
101
+ min: 10,
102
+ max: 20
103
+ } }),
104
+ ...overrideResponse
105
+ }, {
106
+ active_cid: faker.helpers.arrayElement([faker.string.alpha({ length: {
107
+ min: 10,
108
+ max: 20
109
+ } }), void 0]),
110
+ created: faker.date.past().toISOString().slice(0, 19) + "Z",
111
+ dns_hosting_enabled: faker.datatype.boolean(),
112
+ dns_zone_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
113
+ domain: faker.string.alpha({ length: {
114
+ min: 10,
115
+ max: 20
116
+ } }),
117
+ expired: faker.datatype.boolean(),
118
+ gateway_domain: faker.helpers.arrayElement([faker.string.alpha({ length: {
119
+ min: 10,
120
+ max: 20
121
+ } }), void 0]),
122
+ id: faker.number.int(),
123
+ ipns_key_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
124
+ is_subdomain: faker.datatype.boolean(),
125
+ last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
126
+ ssl: faker.helpers.arrayElement([{
127
+ error: faker.helpers.arrayElement([faker.string.alpha({ length: {
128
+ min: 10,
129
+ max: 20
130
+ } }), void 0]),
131
+ issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
132
+ last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
133
+ status: faker.string.alpha({ length: {
134
+ min: 10,
135
+ max: 20
136
+ } })
137
+ }, void 0]),
138
+ status: faker.string.alpha({ length: {
139
+ min: 10,
140
+ max: 20
141
+ } }),
142
+ target_hash: faker.string.alpha({ length: {
143
+ min: 10,
144
+ max: 20
145
+ } }),
146
+ target_type: faker.string.alpha({ length: {
147
+ min: 10,
148
+ max: 20
149
+ } }),
150
+ updated: faker.date.past().toISOString().slice(0, 19) + "Z",
151
+ validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
152
+ validation_token: faker.string.alpha({ length: {
153
+ min: 10,
154
+ max: 20
155
+ } }),
156
+ ...overrideResponse
157
+ }]);
158
+ const getGetApiWebsitesDomainSslStatusResponseMock = (overrideResponse = {}) => ({
159
+ active_cid: faker.helpers.arrayElement([faker.string.alpha({ length: {
160
+ min: 10,
161
+ max: 20
162
+ } }), void 0]),
163
+ created: faker.date.past().toISOString().slice(0, 19) + "Z",
164
+ dns_hosting_enabled: faker.datatype.boolean(),
165
+ dns_zone_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
166
+ domain: faker.string.alpha({ length: {
167
+ min: 10,
168
+ max: 20
169
+ } }),
170
+ expired: faker.datatype.boolean(),
171
+ gateway_domain: faker.helpers.arrayElement([faker.string.alpha({ length: {
172
+ min: 10,
173
+ max: 20
174
+ } }), void 0]),
175
+ id: faker.number.int(),
176
+ ipns_key_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
177
+ is_subdomain: faker.datatype.boolean(),
178
+ last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
179
+ ssl: faker.helpers.arrayElement([{
180
+ error: faker.helpers.arrayElement([faker.string.alpha({ length: {
181
+ min: 10,
182
+ max: 20
183
+ } }), void 0]),
184
+ issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
185
+ last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
186
+ status: faker.string.alpha({ length: {
187
+ min: 10,
188
+ max: 20
189
+ } })
190
+ }, void 0]),
191
+ status: faker.string.alpha({ length: {
192
+ min: 10,
193
+ max: 20
194
+ } }),
195
+ target_hash: faker.string.alpha({ length: {
196
+ min: 10,
197
+ max: 20
198
+ } }),
199
+ target_type: faker.string.alpha({ length: {
200
+ min: 10,
201
+ max: 20
202
+ } }),
203
+ updated: faker.date.past().toISOString().slice(0, 19) + "Z",
204
+ validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
205
+ validation_token: faker.string.alpha({ length: {
206
+ min: 10,
207
+ max: 20
208
+ } }),
209
+ ...overrideResponse
210
+ });
211
+ const getDeleteApiWebsitesIdResponseMock = (overrideResponse = {}) => ({
212
+ error: faker.string.alpha({ length: {
213
+ min: 10,
214
+ max: 20
215
+ } }),
216
+ ...overrideResponse
217
+ });
218
+ const getGetApiWebsitesIdResponseMock = (overrideResponse = {}) => ({
219
+ active_cid: faker.helpers.arrayElement([faker.string.alpha({ length: {
220
+ min: 10,
221
+ max: 20
222
+ } }), void 0]),
223
+ created: faker.date.past().toISOString().slice(0, 19) + "Z",
224
+ dns_hosting_enabled: faker.datatype.boolean(),
225
+ dns_zone_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
226
+ domain: faker.string.alpha({ length: {
227
+ min: 10,
228
+ max: 20
229
+ } }),
230
+ expired: faker.datatype.boolean(),
231
+ gateway_domain: faker.helpers.arrayElement([faker.string.alpha({ length: {
232
+ min: 10,
233
+ max: 20
234
+ } }), void 0]),
235
+ id: faker.number.int(),
236
+ ipns_key_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
237
+ is_subdomain: faker.datatype.boolean(),
238
+ last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
239
+ ssl: faker.helpers.arrayElement([{
240
+ error: faker.helpers.arrayElement([faker.string.alpha({ length: {
241
+ min: 10,
242
+ max: 20
243
+ } }), void 0]),
244
+ issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
245
+ last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
246
+ status: faker.string.alpha({ length: {
247
+ min: 10,
248
+ max: 20
249
+ } })
250
+ }, void 0]),
251
+ status: faker.string.alpha({ length: {
252
+ min: 10,
253
+ max: 20
254
+ } }),
255
+ target_hash: faker.string.alpha({ length: {
256
+ min: 10,
257
+ max: 20
258
+ } }),
259
+ target_type: faker.string.alpha({ length: {
260
+ min: 10,
261
+ max: 20
262
+ } }),
263
+ updated: faker.date.past().toISOString().slice(0, 19) + "Z",
264
+ validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
265
+ validation_token: faker.string.alpha({ length: {
266
+ min: 10,
267
+ max: 20
268
+ } }),
269
+ ...overrideResponse
270
+ });
271
+ const getPutApiWebsitesIdResponseMock = (overrideResponse = {}) => ({
272
+ active_cid: faker.helpers.arrayElement([faker.string.alpha({ length: {
273
+ min: 10,
274
+ max: 20
275
+ } }), void 0]),
276
+ created: faker.date.past().toISOString().slice(0, 19) + "Z",
277
+ dns_hosting_enabled: faker.datatype.boolean(),
278
+ dns_zone_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
279
+ domain: faker.string.alpha({ length: {
280
+ min: 10,
281
+ max: 20
282
+ } }),
283
+ expired: faker.datatype.boolean(),
284
+ gateway_domain: faker.helpers.arrayElement([faker.string.alpha({ length: {
285
+ min: 10,
286
+ max: 20
287
+ } }), void 0]),
288
+ id: faker.number.int(),
289
+ ipns_key_id: faker.helpers.arrayElement([faker.number.int(), void 0]),
290
+ is_subdomain: faker.datatype.boolean(),
291
+ last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
292
+ ssl: faker.helpers.arrayElement([{
293
+ error: faker.helpers.arrayElement([faker.string.alpha({ length: {
294
+ min: 10,
295
+ max: 20
296
+ } }), void 0]),
297
+ issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
298
+ last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
299
+ status: faker.string.alpha({ length: {
300
+ min: 10,
301
+ max: 20
302
+ } })
303
+ }, void 0]),
304
+ status: faker.string.alpha({ length: {
305
+ min: 10,
306
+ max: 20
307
+ } }),
308
+ target_hash: faker.string.alpha({ length: {
309
+ min: 10,
310
+ max: 20
311
+ } }),
312
+ target_type: faker.string.alpha({ length: {
313
+ min: 10,
314
+ max: 20
315
+ } }),
316
+ updated: faker.date.past().toISOString().slice(0, 19) + "Z",
317
+ validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + "Z", void 0]),
318
+ validation_token: faker.string.alpha({ length: {
319
+ min: 10,
320
+ max: 20
321
+ } }),
322
+ ...overrideResponse
323
+ });
324
+ const getPostApiWebsitesIdValidateResponseMock = (overrideResponse = {}) => ({
325
+ domain: faker.string.alpha({ length: {
326
+ min: 10,
327
+ max: 20
328
+ } }),
329
+ id: faker.number.int(),
330
+ message: faker.string.alpha({ length: {
331
+ min: 10,
332
+ max: 20
333
+ } }),
334
+ reason: faker.string.alpha({ length: {
335
+ min: 10,
336
+ max: 20
337
+ } }),
338
+ valid: faker.datatype.boolean(),
339
+ ...overrideResponse
340
+ });
341
+ const getGetApiWebsitesConfigResponseMock = (overrideResponse = {}) => ({
342
+ gateway_domain: faker.helpers.arrayElement([faker.string.alpha({ length: {
343
+ min: 10,
344
+ max: 20
345
+ } }), void 0]),
346
+ nameservers: faker.helpers.arrayElement([Array.from({ length: faker.number.int({
347
+ min: 1,
348
+ max: 10
349
+ }) }, (_, i) => i + 1).map(() => faker.string.alpha({ length: {
350
+ min: 10,
351
+ max: 20
352
+ } })), void 0]),
353
+ ...overrideResponse
354
+ });
355
+ const getGetApiWebsitesMockHandler = (overrideResponse, options) => {
356
+ return http.get("*/api/websites", async (info) => {
357
+ await delay(0);
358
+ return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiWebsitesResponseMock(), { status: 200 });
359
+ }, options);
360
+ };
361
+ const getPostApiWebsitesMockHandler = (overrideResponse, options) => {
362
+ return http.post("*/api/websites", async (info) => {
363
+ await delay(0);
364
+ return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiWebsitesResponseMock(), { status: 200 });
365
+ }, options);
366
+ };
367
+ const getGetApiWebsitesDomainSslStatusMockHandler = (overrideResponse, options) => {
368
+ return http.get("*/api/websites/:domain/ssl-status", async (info) => {
369
+ await delay(0);
370
+ return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiWebsitesDomainSslStatusResponseMock(), { status: 200 });
371
+ }, options);
372
+ };
373
+ const getDeleteApiWebsitesIdMockHandler = (overrideResponse, options) => {
374
+ return http.delete("*/api/websites/:id", async (info) => {
375
+ await delay(0);
376
+ const resolvedBody = overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getDeleteApiWebsitesIdResponseMock();
377
+ return resolvedBody === void 0 ? new HttpResponse(null, { status: 204 }) : HttpResponse.json(resolvedBody, { status: 200 });
378
+ }, options);
379
+ };
380
+ const getGetApiWebsitesIdMockHandler = (overrideResponse, options) => {
381
+ return http.get("*/api/websites/:id", async (info) => {
382
+ await delay(0);
383
+ return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiWebsitesIdResponseMock(), { status: 200 });
384
+ }, options);
385
+ };
386
+ const getPutApiWebsitesIdMockHandler = (overrideResponse, options) => {
387
+ return http.put("*/api/websites/:id", async (info) => {
388
+ await delay(0);
389
+ return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPutApiWebsitesIdResponseMock(), { status: 200 });
390
+ }, options);
391
+ };
392
+ const getPostApiWebsitesIdValidateMockHandler = (overrideResponse, options) => {
393
+ return http.post("*/api/websites/:id/validate", async (info) => {
394
+ await delay(0);
395
+ return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiWebsitesIdValidateResponseMock(), { status: 200 });
396
+ }, options);
397
+ };
398
+ const getGetApiWebsitesConfigMockHandler = (overrideResponse, options) => {
399
+ return http.get("*/api/websites/config", async (info) => {
400
+ await delay(0);
401
+ return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiWebsitesConfigResponseMock(), { status: 200 });
402
+ }, options);
403
+ };
404
+ const getWebsitesMock = () => [
405
+ getGetApiWebsitesMockHandler(),
406
+ getPostApiWebsitesMockHandler(),
407
+ getGetApiWebsitesDomainSslStatusMockHandler(),
408
+ getDeleteApiWebsitesIdMockHandler(),
409
+ getGetApiWebsitesIdMockHandler(),
410
+ getPutApiWebsitesIdMockHandler(),
411
+ getPostApiWebsitesIdValidateMockHandler(),
412
+ getGetApiWebsitesConfigMockHandler()
413
+ ];
414
+
415
+ //#endregion
416
+ export { getWebsitesMock };
417
+ //# sourceMappingURL=websites.msw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websites.msw.js","names":[],"sources":["../../../../../src/api/generated/websites/websites.msw.ts"],"sourcesContent":["/**\n * Generated by orval v8.10.0 🍺\n * Do not edit manually.\n * Portal IPFS Plugin API\n *\n## Portal IPFS Plugin API\n\nA comprehensive API for IPFS content management, including pinning services, file operations, IPNS key management, and website hosting.\n\n### IPFS Pinning Service API Compatibility\n\nThis API is fully compatible with the [IPFS Pinning Service API specification](https://github.com/ipfs/pinning-services-api-spec), an implementation-agnostic API standard for pinning service providers. This ensures interoperability with existing IPFS pinning clients and tools.\n\n### Features\n\n- **Pinning**: Add, list, update, and remove pinned content\n- **Content**: Upload files, retrieve IPFS content, and manage metadata\n- **IPNS**: Manage IPNS keys and publish content\n- **Files**: Browse and manage pinned files with directory navigation\n- **Websites**: Create and manage website hosting with DNS and SSL automation\n\n### Authentication\n\nAll API endpoints require authentication using JWT tokens obtained from the Portal authentication service.\n\n### Rate Limiting\n\nAPI requests are rate-limited based on user account tier. See Portal documentation for current limits.\n\n### Documentation\n\nFor detailed API usage examples and integration guides, visit the Portal documentation website.\n\n * OpenAPI spec version: 1.0.0\n */\nimport {\n faker\n} from '@faker-js/faker';\n\nimport {\n HttpResponse,\n delay,\n http\n} from 'msw';\nimport type {\n RequestHandlerOptions\n} from 'msw';\n\nimport type {\n ErrorResponse,\n WebsiteConfigResponse,\n WebsiteItemResponse,\n WebsiteResponse,\n WebsiteValidateResponse\n} from '../schemas';\n\n\nexport const getGetApiWebsitesResponseMock = (overrideResponse: Partial<Extract<WebsiteItemResponse, object>> = {}): WebsiteItemResponse => ({data: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({active_cid: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), created: faker.date.past().toISOString().slice(0, 19) + 'Z', dns_hosting_enabled: faker.datatype.boolean(), dns_zone_id: faker.helpers.arrayElement([faker.number.int(), undefined]), domain: faker.string.alpha({length: {min: 10, max: 20}}), expired: faker.datatype.boolean(), gateway_domain: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), id: faker.number.int(), ipns_key_id: faker.helpers.arrayElement([faker.number.int(), undefined]), is_subdomain: faker.datatype.boolean(), last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), ssl: faker.helpers.arrayElement([{error: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), status: faker.string.alpha({length: {min: 10, max: 20}})}, undefined]), status: faker.string.alpha({length: {min: 10, max: 20}}), target_hash: faker.string.alpha({length: {min: 10, max: 20}}), target_type: faker.string.alpha({length: {min: 10, max: 20}}), updated: faker.date.past().toISOString().slice(0, 19) + 'Z', validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), validation_token: faker.string.alpha({length: {min: 10, max: 20}})})), total: faker.number.int(), ...overrideResponse})\n\nexport const getPostApiWebsitesResponseMock = (overrideResponse: Partial<Extract<ErrorResponse | WebsiteResponse, object>> = {}): ErrorResponse | WebsiteResponse => (faker.helpers.arrayElement([{error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse}, {active_cid: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), created: faker.date.past().toISOString().slice(0, 19) + 'Z', dns_hosting_enabled: faker.datatype.boolean(), dns_zone_id: faker.helpers.arrayElement([faker.number.int(), undefined]), domain: faker.string.alpha({length: {min: 10, max: 20}}), expired: faker.datatype.boolean(), gateway_domain: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), id: faker.number.int(), ipns_key_id: faker.helpers.arrayElement([faker.number.int(), undefined]), is_subdomain: faker.datatype.boolean(), last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), ssl: faker.helpers.arrayElement([{error: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), status: faker.string.alpha({length: {min: 10, max: 20}})}, undefined]), status: faker.string.alpha({length: {min: 10, max: 20}}), target_hash: faker.string.alpha({length: {min: 10, max: 20}}), target_type: faker.string.alpha({length: {min: 10, max: 20}}), updated: faker.date.past().toISOString().slice(0, 19) + 'Z', validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), validation_token: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse}]))\n\nexport const getGetApiWebsitesDomainSslStatusResponseMock = (overrideResponse: Partial<Extract<WebsiteResponse, object>> = {}): WebsiteResponse => ({active_cid: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), created: faker.date.past().toISOString().slice(0, 19) + 'Z', dns_hosting_enabled: faker.datatype.boolean(), dns_zone_id: faker.helpers.arrayElement([faker.number.int(), undefined]), domain: faker.string.alpha({length: {min: 10, max: 20}}), expired: faker.datatype.boolean(), gateway_domain: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), id: faker.number.int(), ipns_key_id: faker.helpers.arrayElement([faker.number.int(), undefined]), is_subdomain: faker.datatype.boolean(), last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), ssl: faker.helpers.arrayElement([{error: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), status: faker.string.alpha({length: {min: 10, max: 20}})}, undefined]), status: faker.string.alpha({length: {min: 10, max: 20}}), target_hash: faker.string.alpha({length: {min: 10, max: 20}}), target_type: faker.string.alpha({length: {min: 10, max: 20}}), updated: faker.date.past().toISOString().slice(0, 19) + 'Z', validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), validation_token: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getDeleteApiWebsitesIdResponseMock = (overrideResponse: Partial<Extract<ErrorResponse, object>> = {}): ErrorResponse => ({error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getGetApiWebsitesIdResponseMock = (overrideResponse: Partial<Extract<WebsiteResponse, object>> = {}): WebsiteResponse => ({active_cid: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), created: faker.date.past().toISOString().slice(0, 19) + 'Z', dns_hosting_enabled: faker.datatype.boolean(), dns_zone_id: faker.helpers.arrayElement([faker.number.int(), undefined]), domain: faker.string.alpha({length: {min: 10, max: 20}}), expired: faker.datatype.boolean(), gateway_domain: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), id: faker.number.int(), ipns_key_id: faker.helpers.arrayElement([faker.number.int(), undefined]), is_subdomain: faker.datatype.boolean(), last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), ssl: faker.helpers.arrayElement([{error: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), status: faker.string.alpha({length: {min: 10, max: 20}})}, undefined]), status: faker.string.alpha({length: {min: 10, max: 20}}), target_hash: faker.string.alpha({length: {min: 10, max: 20}}), target_type: faker.string.alpha({length: {min: 10, max: 20}}), updated: faker.date.past().toISOString().slice(0, 19) + 'Z', validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), validation_token: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getPutApiWebsitesIdResponseMock = (overrideResponse: Partial<Extract<WebsiteResponse, object>> = {}): WebsiteResponse => ({active_cid: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), created: faker.date.past().toISOString().slice(0, 19) + 'Z', dns_hosting_enabled: faker.datatype.boolean(), dns_zone_id: faker.helpers.arrayElement([faker.number.int(), undefined]), domain: faker.string.alpha({length: {min: 10, max: 20}}), expired: faker.datatype.boolean(), gateway_domain: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), id: faker.number.int(), ipns_key_id: faker.helpers.arrayElement([faker.number.int(), undefined]), is_subdomain: faker.datatype.boolean(), last_checked_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), ssl: faker.helpers.arrayElement([{error: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), issued_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), last_updated_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), status: faker.string.alpha({length: {min: 10, max: 20}})}, undefined]), status: faker.string.alpha({length: {min: 10, max: 20}}), target_hash: faker.string.alpha({length: {min: 10, max: 20}}), target_type: faker.string.alpha({length: {min: 10, max: 20}}), updated: faker.date.past().toISOString().slice(0, 19) + 'Z', validation_expires_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z', undefined]), validation_token: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getPostApiWebsitesIdValidateResponseMock = (overrideResponse: Partial<Extract<WebsiteValidateResponse, object>> = {}): WebsiteValidateResponse => ({domain: faker.string.alpha({length: {min: 10, max: 20}}), id: faker.number.int(), message: faker.string.alpha({length: {min: 10, max: 20}}), reason: faker.string.alpha({length: {min: 10, max: 20}}), valid: faker.datatype.boolean(), ...overrideResponse})\n\nexport const getGetApiWebsitesConfigResponseMock = (overrideResponse: Partial<Extract<WebsiteConfigResponse, object>> = {}): WebsiteConfigResponse => ({gateway_domain: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), nameservers: faker.helpers.arrayElement([Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => (faker.string.alpha({length: {min: 10, max: 20}}))), undefined]), ...overrideResponse})\n\n\nexport const getGetApiWebsitesMockHandler = (overrideResponse?: WebsiteItemResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<WebsiteItemResponse> | WebsiteItemResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/websites', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetApiWebsitesResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getPostApiWebsitesMockHandler = (overrideResponse?: ErrorResponse | WebsiteResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<ErrorResponse | WebsiteResponse> | ErrorResponse | WebsiteResponse), options?: RequestHandlerOptions) => {\n return http.post('*/api/websites', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getPostApiWebsitesResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetApiWebsitesDomainSslStatusMockHandler = (overrideResponse?: WebsiteResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<WebsiteResponse> | WebsiteResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/websites/:domain/ssl-status', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetApiWebsitesDomainSslStatusResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getDeleteApiWebsitesIdMockHandler = (overrideResponse?: ErrorResponse | void | ((info: Parameters<Parameters<typeof http.delete>[1]>[0]) => Promise<ErrorResponse | void> | ErrorResponse | void), options?: RequestHandlerOptions) => {\n return http.delete('*/api/websites/:id', async (info: Parameters<Parameters<typeof http.delete>[1]>[0]) => {await delay(0);\n\n const resolvedBody = overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getDeleteApiWebsitesIdResponseMock();\n return resolvedBody === undefined\n ? new HttpResponse(null, { status: 204 })\n : HttpResponse.json(resolvedBody, { status: 200 })\n }, options)\n}\n\nexport const getGetApiWebsitesIdMockHandler = (overrideResponse?: WebsiteResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<WebsiteResponse> | WebsiteResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/websites/:id', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetApiWebsitesIdResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getPutApiWebsitesIdMockHandler = (overrideResponse?: WebsiteResponse | ((info: Parameters<Parameters<typeof http.put>[1]>[0]) => Promise<WebsiteResponse> | WebsiteResponse), options?: RequestHandlerOptions) => {\n return http.put('*/api/websites/:id', async (info: Parameters<Parameters<typeof http.put>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getPutApiWebsitesIdResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getPostApiWebsitesIdValidateMockHandler = (overrideResponse?: WebsiteValidateResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<WebsiteValidateResponse> | WebsiteValidateResponse), options?: RequestHandlerOptions) => {\n return http.post('*/api/websites/:id/validate', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getPostApiWebsitesIdValidateResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetApiWebsitesConfigMockHandler = (overrideResponse?: WebsiteConfigResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<WebsiteConfigResponse> | WebsiteConfigResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/websites/config', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetApiWebsitesConfigResponseMock(),\n { status: 200\n })\n }, options)\n}\nexport const getWebsitesMock = () => [\n getGetApiWebsitesMockHandler(),\n getPostApiWebsitesMockHandler(),\n getGetApiWebsitesDomainSslStatusMockHandler(),\n getDeleteApiWebsitesIdMockHandler(),\n getGetApiWebsitesIdMockHandler(),\n getPutApiWebsitesIdMockHandler(),\n getPostApiWebsitesIdValidateMockHandler(),\n getGetApiWebsitesConfigMockHandler()\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,iCAAiC,mBAAkE,EAAE,MAA2B;CAAC,MAAM,MAAM,KAAK,EAAE,QAAQ,MAAM,OAAO,IAAI;EAAC,KAAK;EAAG,KAAK;EAAG,CAAC,EAAE,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC,WAAW;EAAC,YAAY,MAAM,QAAQ,aAAa,CAAC,MAAM,OAAO,MAAM,EAAC,QAAQ;GAAC,KAAK;GAAI,KAAK;GAAG,EAAC,CAAC,EAAE,OAAU,CAAC;EAAE,SAAS,MAAM,KAAK,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,GAAG,GAAG;EAAK,qBAAqB,MAAM,SAAS,SAAS;EAAE,aAAa,MAAM,QAAQ,aAAa,CAAC,MAAM,OAAO,KAAK,EAAE,OAAU,CAAC;EAAE,QAAQ,MAAM,OAAO,MAAM,EAAC,QAAQ;GAAC,KAAK;GAAI,KAAK;GAAG,EAAC,CAAC;EAAE,SAAS,MAAM,SAAS,SAA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M,iBAAiB,KAAK,GAAG,mBACzE,qCAAqC,EACrC,EAAE,QAAQ,KACT,CAAC;IACH,QAAQ;;AAEb,MAAa,wBAAwB;CACnC,8BAA8B;CAC9B,+BAA+B;CAC/B,6CAA6C;CAC7C,mCAAmC;CACnC,gCAAgC;CAChC,gCAAgC;CAChC,yCAAyC;CACzC,oCAAoC;CACrC"}
@@ -1,10 +1,11 @@
1
- import { PinnerConfig } from "../config.js";
2
1
  import { IPNSKeyListResponseResponse } from "./generated/schemas/iPNSKeyListResponseResponse.js";
3
2
  import { IPNSKeyRequest } from "./generated/schemas/iPNSKeyRequest.js";
4
3
  import { IPNSKeyResponse } from "./generated/schemas/iPNSKeyResponse.js";
5
4
  import { IPNSPublishRequest } from "./generated/schemas/iPNSPublishRequest.js";
6
5
  import { IPNSPublishResponse } from "./generated/schemas/iPNSPublishResponse.js";
6
+ import { IPNSRepublishResponse } from "./generated/schemas/iPNSRepublishResponse.js";
7
7
  import { IPNSResolveResponse } from "./generated/schemas/iPNSResolveResponse.js";
8
+ import { PinnerConfig } from "../config.js";
8
9
 
9
10
  //#region src/api/ipns.d.ts
10
11
  interface IpnsClientOptions {
@@ -20,7 +21,7 @@ declare class IpnsClient {
20
21
  createKey(request: IPNSKeyRequest, options?: IpnsClientOptions): Promise<IPNSKeyResponse>;
21
22
  deleteKey(id: number, options?: IpnsClientOptions): Promise<void>;
22
23
  publish(request: IPNSPublishRequest, options?: IpnsClientOptions): Promise<IPNSPublishResponse>;
23
- republish(name: string, options?: IpnsClientOptions): Promise<void>;
24
+ republish(id: number, options?: IpnsClientOptions): Promise<IPNSRepublishResponse>;
24
25
  resolve(name: string, options?: IpnsClientOptions): Promise<IPNSResolveResponse>;
25
26
  }
26
27
  //#endregion
@@ -66,10 +66,9 @@ var IpnsClient = class {
66
66
  signal: options?.signal
67
67
  });
68
68
  }
69
- async republish(name, options) {
70
- await this.request("api/ipns/republish", {
69
+ async republish(id, options) {
70
+ return this.request(`api/ipns/keys/${id}/republish`, {
71
71
  method: "POST",
72
- body: JSON.stringify({ name }),
73
72
  signal: options?.signal
74
73
  });
75
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ipns.js","names":[],"sources":["../../../src/api/ipns.ts"],"sourcesContent":["import ky, { HTTPError } from \"ky\";\nimport type { PinnerConfig } from \"../config\";\nimport type {\n IPNSKeyListResponseResponse,\n IPNSKeyRequest,\n IPNSKeyResponse,\n IPNSPublishRequest,\n IPNSPublishResponse,\n IPNSResolveResponse,\n} from \"./generated/schemas/index\";\nimport {\n ConfigurationError,\n AuthenticationError,\n NotFoundError,\n NetworkError,\n ValidationError,\n} from \"@/errors\";\n\nexport interface IpnsClientOptions {\n signal?: AbortSignal;\n}\n\nexport class IpnsClient {\n private config: PinnerConfig;\n\n constructor(config: PinnerConfig) {\n if (!config.jwt) {\n throw new ConfigurationError(\"JWT token is required\");\n }\n this.config = config;\n }\n\n private getEndpoint(): string {\n return this.config.endpoint ?? \"https://ipfs.pinner.xyz\";\n }\n\n private async request<T>(\n path: string,\n options?: RequestInit & { signal?: AbortSignal },\n ): Promise<T> {\n if (!this.config.jwt) {\n throw new ConfigurationError(\"JWT token is required\");\n }\n\n try {\n const response = await ky(path, {\n prefix: this.getEndpoint(),\n headers: {\n Authorization: `Bearer ${this.config.jwt}`,\n \"Content-Type\": \"application/json\",\n },\n ...options,\n });\n\n if (response.status === 204) {\n return undefined as T;\n }\n\n const text = await response.text();\n if (!text) {\n return undefined as T;\n }\n\n return JSON.parse(text) as T;\n } catch (error) {\n if (error instanceof HTTPError) {\n const status = error.response.status;\n const body = await error.response.json().catch(() => ({}));\n\n if (status === 401) {\n throw new AuthenticationError(\n body.error || \"Authentication failed\",\n );\n }\n if (status === 403) {\n throw new AuthenticationError(\n body.error || \"Access forbidden\",\n );\n }\n if (status === 404) {\n throw new NotFoundError(body.error || \"Resource not found\");\n }\n if (status === 400) {\n throw new ValidationError(body.error || \"Invalid request\");\n }\n\n throw new NetworkError(\n body.error || `HTTP error: ${status}`,\n status,\n );\n }\n\n if (error instanceof Error) {\n throw new NetworkError(error.message);\n }\n\n throw new NetworkError(\"Unknown error occurred\");\n }\n }\n\n async listKeys(options?: IpnsClientOptions): Promise<IPNSKeyListResponseResponse> {\n return this.request<IPNSKeyListResponseResponse>(\"api/ipns/keys\", {\n signal: options?.signal,\n });\n }\n\n async getKey(id: number, options?: IpnsClientOptions): Promise<IPNSKeyResponse> {\n return this.request<IPNSKeyResponse>(`api/ipns/keys/${id}`, {\n signal: options?.signal,\n });\n }\n\n async createKey(\n request: IPNSKeyRequest,\n options?: IpnsClientOptions,\n ): Promise<IPNSKeyResponse> {\n return this.request<IPNSKeyResponse>(\"api/ipns/keys\", {\n method: \"POST\",\n body: JSON.stringify(request),\n signal: options?.signal,\n });\n }\n\n async deleteKey(id: number, options?: IpnsClientOptions): Promise<void> {\n await this.request<void>(`api/ipns/keys/${id}`, {\n method: \"DELETE\",\n signal: options?.signal,\n });\n }\n\n async publish(\n request: IPNSPublishRequest,\n options?: IpnsClientOptions,\n ): Promise<IPNSPublishResponse> {\n return this.request<IPNSPublishResponse>(\"api/ipns/publish\", {\n method: \"POST\",\n body: JSON.stringify(request),\n signal: options?.signal,\n });\n }\n\n async republish(\n name: string,\n options?: IpnsClientOptions,\n ): Promise<void> {\n await this.request<void>(\"api/ipns/republish\", {\n method: \"POST\",\n body: JSON.stringify({ name }),\n signal: options?.signal,\n });\n }\n\n async resolve(\n name: string,\n options?: IpnsClientOptions,\n ): Promise<IPNSResolveResponse> {\n return this.request<IPNSResolveResponse>(`api/ipns/resolve/${name}`, {\n signal: options?.signal,\n });\n }\n}\n"],"mappings":";;;;AAsBA,IAAa,aAAb,MAAwB;CACtB,AAAQ;CAER,YAAY,QAAsB;AAChC,MAAI,CAAC,OAAO,IACV,OAAM,IAAI,mBAAmB,wBAAwB;AAEvD,OAAK,SAAS;;CAGhB,AAAQ,cAAsB;AAC5B,SAAO,KAAK,OAAO,YAAY;;CAGjC,MAAc,QACZ,MACA,S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,UAAU,IAAY,SAA4C;AACtE,QAAM,KAAK,QAAc,iBAAiB,MAAM;GAC9C,QAAQ;GACR,QAAQ,SAAS;GAClB,CAAC;;CAGJ,MAAM,QACJ,SACA,SAC8B;AAC9B,SAAO,KAAK,QAA6B,oBAAoB;GAC3D,QAAQ;GACR,MAAM,KAAK,UAAU,QAAQ;GAC7B,QAAQ,SAAS;GAClB,CAAC;;CAGJ,MAAM,UACJ,MACA,SACe;AACf,QAAM,KAAK,QAAc,sBAAsB;GAC7C,QAAQ;GACR,MAAM,KAAK,UAAU,EAAE,MAAM,CAAC;GAC9B,QAAQ,SAAS;GAClB,CAAC;;CAGJ,MAAM,QACJ,MACA,SAC8B;AAC9B,SAAO,KAAK,QAA6B,oBAAoB,QAAQ,EACnE,QAAQ,SAAS,QAClB,CAAC"}
1
+ {"version":3,"file":"ipns.js","names":[],"sources":["../../../src/api/ipns.ts"],"sourcesContent":["import ky, { HTTPError } from \"ky\";\nimport type { PinnerConfig } from \"../config\";\nimport type {\n IPNSKeyListResponseResponse,\n IPNSKeyRequest,\n IPNSKeyResponse,\n IPNSPublishRequest,\n IPNSPublishResponse,\n IPNSRepublishResponse,\n IPNSResolveResponse,\n} from \"./generated/schemas/index\";\nimport {\n ConfigurationError,\n AuthenticationError,\n NotFoundError,\n NetworkError,\n ValidationError,\n} from \"@/errors\";\n\nexport interface IpnsClientOptions {\n signal?: AbortSignal;\n}\n\nexport class IpnsClient {\n private config: PinnerConfig;\n\n constructor(config: PinnerConfig) {\n if (!config.jwt) {\n throw new ConfigurationError(\"JWT token is required\");\n }\n this.config = config;\n }\n\n private getEndpoint(): string {\n return this.config.endpoint ?? \"https://ipfs.pinner.xyz\";\n }\n\n private async request<T>(\n path: string,\n options?: RequestInit & { signal?: AbortSignal },\n ): Promise<T> {\n if (!this.config.jwt) {\n throw new ConfigurationError(\"JWT token is required\");\n }\n\n try {\n const response = await ky(path, {\n prefix: this.getEndpoint(),\n headers: {\n Authorization: `Bearer ${this.config.jwt}`,\n \"Content-Type\": \"application/json\",\n },\n ...options,\n });\n\n if (response.status === 204) {\n return undefined as T;\n }\n\n const text = await response.text();\n if (!text) {\n return undefined as T;\n }\n\n return JSON.parse(text) as T;\n } catch (error) {\n if (error instanceof HTTPError) {\n const status = error.response.status;\n const body = await error.response.json().catch(() => ({}));\n\n if (status === 401) {\n throw new AuthenticationError(\n body.error || \"Authentication failed\",\n );\n }\n if (status === 403) {\n throw new AuthenticationError(\n body.error || \"Access forbidden\",\n );\n }\n if (status === 404) {\n throw new NotFoundError(body.error || \"Resource not found\");\n }\n if (status === 400) {\n throw new ValidationError(body.error || \"Invalid request\");\n }\n\n throw new NetworkError(\n body.error || `HTTP error: ${status}`,\n status,\n );\n }\n\n if (error instanceof Error) {\n throw new NetworkError(error.message);\n }\n\n throw new NetworkError(\"Unknown error occurred\");\n }\n }\n\n async listKeys(options?: IpnsClientOptions): Promise<IPNSKeyListResponseResponse> {\n return this.request<IPNSKeyListResponseResponse>(\"api/ipns/keys\", {\n signal: options?.signal,\n });\n }\n\n async getKey(id: number, options?: IpnsClientOptions): Promise<IPNSKeyResponse> {\n return this.request<IPNSKeyResponse>(`api/ipns/keys/${id}`, {\n signal: options?.signal,\n });\n }\n\n async createKey(\n request: IPNSKeyRequest,\n options?: IpnsClientOptions,\n ): Promise<IPNSKeyResponse> {\n return this.request<IPNSKeyResponse>(\"api/ipns/keys\", {\n method: \"POST\",\n body: JSON.stringify(request),\n signal: options?.signal,\n });\n }\n\n async deleteKey(id: number, options?: IpnsClientOptions): Promise<void> {\n await this.request<void>(`api/ipns/keys/${id}`, {\n method: \"DELETE\",\n signal: options?.signal,\n });\n }\n\n async publish(\n request: IPNSPublishRequest,\n options?: IpnsClientOptions,\n ): Promise<IPNSPublishResponse> {\n return this.request<IPNSPublishResponse>(\"api/ipns/publish\", {\n method: \"POST\",\n body: JSON.stringify(request),\n signal: options?.signal,\n });\n }\n\n async republish(\n id: number,\n options?: IpnsClientOptions,\n ): Promise<IPNSRepublishResponse> {\n return this.request<IPNSRepublishResponse>(`api/ipns/keys/${id}/republish`, {\n method: \"POST\",\n signal: options?.signal,\n });\n }\n\n async resolve(\n name: string,\n options?: IpnsClientOptions,\n ): Promise<IPNSResolveResponse> {\n return this.request<IPNSResolveResponse>(`api/ipns/resolve/${name}`, {\n signal: options?.signal,\n });\n }\n}\n"],"mappings":";;;;AAuBA,IAAa,aAAb,MAAwB;CACtB,AAAQ;CAER,YAAY,QAAsB;AAChC,MAAI,CAAC,OAAO,IACV,OAAM,IAAI,mBAAmB,wBAAwB;AAEvD,OAAK,SAAS;;CAGhB,AAAQ,cAAsB;AAC5B,SAAO,KAAK,OAAO,YAAY;;CAGjC,MAAc,QACZ,MACA,SACY;AACZ,MAAI,CAAC,KAAK,OAAO,IACf,OAAM,IAAI,mBAAmB,wBAAwB;AAGvD,MAAI;GACF,MAAM,WAAW,MAAM,GAAG,MAAM;IAC9B,QAAQ,KAAK,aAAa;IAC1B,SAAS;KACP,eAAe,UAAU,KAAK,OAAO;KACrC,gBAAgB;KACjB;IACD,GAAG;IACJ,CAAC;AAEF,OAAI,SAAS,WAAW,IACtB;GAGF,MAAM,OAAO,MAAM,SAAS,MAAM;AAClC,OAAI,CAAC,KACH;AAGF,UAAO,KAAK,MAAM,KAAK;WAChB,OAAO;AACd,OAAI,iBAAiB,WAAW;IAC9B,MAAM,SAAS,MAAM,SAAS;IAC9B,MAAM,OAAO,MAAM,MAAM,SAAS,MAAM,CAAC,aAAa,EAAE,EAAE;AAE1D,QAAI,WAAW,IACb,OAAM,IAAI,oBACR,KAAK,SAAS,wBACf;AAEH,QAAI,WAAW,IACb,OAAM,IAAI,oBACR,KAAK,SAAS,mBACf;AAEH,QAAI,WAAW,IACb,OAAM,IAAI,cAAc,KAAK,SAAS,qBAAqB;AAE7D,QAAI,WAAW,IACb,OAAM,IAAI,gBAAgB,KAAK,SAAS,kBAAkB;AAG5D,UAAM,IAAI,aACR,KAAK,SAAS,eAAe,UAC7B,OACD;;AAGH,OAAI,iBAAiB,MACnB,OAAM,IAAI,aAAa,MAAM,QAAQ;AAGvC,SAAM,IAAI,aAAa,yBAAyB;;;CAIpD,MAAM,SAAS,SAAmE;AAChF,SAAO,KAAK,QAAqC,iBAAiB,EAChE,QAAQ,SAAS,QAClB,CAAC;;CAGJ,MAAM,OAAO,IAAY,SAAuD;AAC9E,SAAO,KAAK,QAAyB,iBAAiB,MAAM,EAC1D,QAAQ,SAAS,QAClB,CAAC;;CAGJ,MAAM,UACJ,SACA,SAC0B;AAC1B,SAAO,KAAK,QAAyB,iBAAiB;GACpD,QAAQ;GACR,MAAM,KAAK,UAAU,QAAQ;GAC7B,QAAQ,SAAS;GAClB,CAAC;;CAGJ,MAAM,UAAU,IAAY,SAA4C;AACtE,QAAM,KAAK,QAAc,iBAAiB,MAAM;GAC9C,QAAQ;GACR,QAAQ,SAAS;GAClB,CAAC;;CAGJ,MAAM,QACJ,SACA,SAC8B;AAC9B,SAAO,KAAK,QAA6B,oBAAoB;GAC3D,QAAQ;GACR,MAAM,KAAK,UAAU,QAAQ;GAC7B,QAAQ,SAAS;GAClB,CAAC;;CAGJ,MAAM,UACJ,IACA,SACgC;AAChC,SAAO,KAAK,QAA+B,iBAAiB,GAAG,aAAa;GAC1E,QAAQ;GACR,QAAQ,SAAS;GAClB,CAAC;;CAGJ,MAAM,QACJ,MACA,SAC8B;AAC9B,SAAO,KAAK,QAA6B,oBAAoB,QAAQ,EACnE,QAAQ,SAAS,QAClB,CAAC"}
@@ -1,4 +1,3 @@
1
- import { PinnerConfig } from "../config.js";
2
1
  import { SSLStatusInfo } from "./generated/schemas/sSLStatusInfo.js";
3
2
  import { WebsiteConfigResponse } from "./generated/schemas/websiteConfigResponse.js";
4
3
  import { WebsiteItemResponse } from "./generated/schemas/websiteItemResponse.js";
@@ -6,8 +5,19 @@ import { WebsiteRequest } from "./generated/schemas/websiteRequest.js";
6
5
  import { WebsiteResponse } from "./generated/schemas/websiteResponse.js";
7
6
  import { WebsiteUpdateRequest } from "./generated/schemas/websiteUpdateRequest.js";
8
7
  import { WebsiteValidateResponse } from "./generated/schemas/websiteValidateResponse.js";
8
+ import { PinnerConfig } from "../config.js";
9
9
 
10
10
  //#region src/api/websites.d.ts
11
+ declare const WebsiteValidationReason: {
12
+ readonly VALIDATED: "validated";
13
+ readonly TOKEN_EXPIRED: "token_expired";
14
+ readonly DNS_MISSING: "dns_missing";
15
+ readonly DNS_MISMATCH: "dns_mismatch";
16
+ readonly TOKEN_MISSING: "token_missing";
17
+ };
18
+ type WebsiteValidationReasonValue = (typeof WebsiteValidationReason)[keyof typeof WebsiteValidationReason];
19
+ declare function getValidationReason(response: WebsiteValidateResponse | null | undefined): WebsiteValidationReasonValue | "";
20
+ declare function isValidationReason(response: WebsiteValidateResponse | null | undefined, reason: WebsiteValidationReasonValue): boolean;
11
21
  interface WebsitesClientOptions {
12
22
  signal?: AbortSignal;
13
23
  }
@@ -44,5 +54,5 @@ interface SSLError extends Error {
44
54
  details?: string;
45
55
  }
46
56
  //#endregion
47
- export { WebsitesClient };
57
+ export { WebsiteValidationReason, WebsiteValidationReasonValue, WebsitesClient, getValidationReason, isValidationReason };
48
58
  //# sourceMappingURL=websites.d.ts.map
@@ -11,6 +11,24 @@ const SSLStatus = {
11
11
  FAILED: "failed",
12
12
  ERROR: "error"
13
13
  };
14
+ const WebsiteValidationReason = {
15
+ VALIDATED: "validated",
16
+ TOKEN_EXPIRED: "token_expired",
17
+ DNS_MISSING: "dns_missing",
18
+ DNS_MISMATCH: "dns_mismatch",
19
+ TOKEN_MISSING: "token_missing"
20
+ };
21
+ const validationReasonValues = Object.values(WebsiteValidationReason);
22
+ function getValidationReason(response) {
23
+ if (!response) return "";
24
+ const reason = response.reason;
25
+ if (typeof reason === "string" && validationReasonValues.includes(reason)) return reason;
26
+ return "";
27
+ }
28
+ function isValidationReason(response, reason) {
29
+ if (!response) return false;
30
+ return response.reason === reason;
31
+ }
14
32
  var WebsitesClient = class {
15
33
  config;
16
34
  constructor(config) {
@@ -164,5 +182,5 @@ var SSLWatcherImpl = class {
164
182
  };
165
183
 
166
184
  //#endregion
167
- export { WebsitesClient };
185
+ export { WebsiteValidationReason, WebsitesClient, getValidationReason, isValidationReason };
168
186
  //# sourceMappingURL=websites.js.map