@lumeweb/pinner 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/adapters/pinata/index.d.ts +1 -1
- package/dist/esm/adapters/pinata/shared/index.d.ts +1 -1
- package/dist/esm/adapters/pinata/shared/types.d.ts +41 -1
- package/dist/esm/adapters/pinata/v2/adapter-interface.d.ts +4 -1
- package/dist/esm/adapters/pinata/v2/index.d.ts +1 -1
- package/dist/esm/adapters/pinata/v2/types.d.ts +58 -1
- package/dist/esm/api/client.d.ts +21 -0
- package/dist/esm/api/client.js +54 -0
- package/dist/esm/api/client.js.map +1 -0
- package/dist/esm/api/generated/content/content.msw.js +30 -37
- package/dist/esm/api/generated/content/content.msw.js.map +1 -1
- package/dist/esm/api/generated/dns/dns.msw.js +30 -44
- package/dist/esm/api/generated/dns/dns.msw.js.map +1 -1
- package/dist/esm/api/generated/files/files.msw.js +30 -33
- package/dist/esm/api/generated/files/files.msw.js.map +1 -1
- package/dist/esm/api/generated/gateway/gateway.msw.js +30 -32
- package/dist/esm/api/generated/gateway/gateway.msw.js.map +1 -1
- package/dist/esm/api/generated/internal/internal.msw.js +30 -31
- package/dist/esm/api/generated/internal/internal.msw.js.map +1 -1
- package/dist/esm/api/generated/ipns/ipns.msw.js +30 -37
- package/dist/esm/api/generated/ipns/ipns.msw.js.map +1 -1
- package/dist/esm/api/generated/pinning/pinning.msw.js +30 -35
- package/dist/esm/api/generated/pinning/pinning.msw.js.map +1 -1
- package/dist/esm/api/generated/schemas/blockMetaResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/component.d.ts +29 -29
- package/dist/esm/api/generated/schemas/errorResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/fileManagerItem.d.ts +29 -29
- package/dist/esm/api/generated/schemas/gatewayWebsiteResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/gatewayWebsiteStatusResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/getBlockMetaBatchRequest.d.ts +42 -0
- package/dist/esm/api/generated/schemas/iPNSKeyListResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/iPNSKeyRequest.d.ts +29 -29
- package/dist/esm/api/generated/schemas/iPNSKeyResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/iPNSPublishRequest.d.ts +29 -29
- package/dist/esm/api/generated/schemas/iPNSPublishResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/iPNSRepublishResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/iPNSResolveResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/infoResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/pinRequestMeta.d.ts +29 -29
- package/dist/esm/api/generated/schemas/pinStatusResponseInfo.d.ts +29 -29
- package/dist/esm/api/generated/schemas/postApiUploadBody.d.ts +42 -0
- package/dist/esm/api/generated/schemas/postUploadResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/recordResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/recordResult.d.ts +29 -29
- package/dist/esm/api/generated/schemas/sSLStatusInfo.d.ts +29 -29
- package/dist/esm/api/generated/schemas/sSLStatusUpdateRequest.d.ts +44 -0
- package/dist/esm/api/generated/schemas/uploadResultResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/validationResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/websiteConfigResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/websiteRequest.d.ts +29 -29
- package/dist/esm/api/generated/schemas/websiteUpdateRequest.d.ts +29 -29
- package/dist/esm/api/generated/schemas/websiteValidateResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/zoneListResponse.d.ts +29 -29
- package/dist/esm/api/generated/schemas/zoneResponse.d.ts +29 -29
- package/dist/esm/api/generated/tus/tus.msw.js +30 -34
- package/dist/esm/api/generated/tus/tus.msw.js.map +1 -1
- package/dist/esm/api/generated/websites/websites.msw.js +30 -38
- package/dist/esm/api/generated/websites/websites.msw.js.map +1 -1
- package/dist/esm/api/ipns.d.ts +47 -6
- package/dist/esm/api/ipns.js +46 -39
- package/dist/esm/api/ipns.js.map +1 -1
- package/dist/esm/api/websites.d.ts +57 -6
- package/dist/esm/api/websites.js +57 -41
- package/dist/esm/api/websites.js.map +1 -1
- package/dist/esm/auth/manager.d.ts +29 -0
- package/dist/esm/auth/manager.js +30 -0
- package/dist/esm/auth/manager.js.map +1 -0
- package/dist/esm/blockstore/index.d.ts +1 -1
- package/dist/esm/blockstore/unstorage-base.d.ts +6 -1
- package/dist/esm/blockstore/unstorage-base.js +9 -6
- package/dist/esm/blockstore/unstorage-base.js.map +1 -1
- package/dist/esm/index.d.ts +31 -6
- package/dist/esm/pin/client.js +7 -7
- package/dist/esm/pin/client.js.map +1 -1
- package/dist/esm/pinner.d.ts +22 -0
- package/dist/esm/pinner.js +28 -4
- package/dist/esm/pinner.js.map +1 -1
- package/dist/esm/types/pin.d.ts +42 -0
- package/dist/esm/upload/base-upload.js +3 -1
- package/dist/esm/upload/base-upload.js.map +1 -1
- package/dist/esm/upload/builder.d.ts +1 -1
- package/dist/esm/upload/car.d.ts +18 -0
- package/dist/esm/upload/car.js.map +1 -1
- package/dist/esm/upload/manager.d.ts +32 -1
- package/dist/esm/upload/manager.js +36 -4
- package/dist/esm/upload/manager.js.map +1 -1
- package/dist/esm/upload/normalize.js.map +1 -1
- package/dist/esm/upload/tus-upload.js +3 -3
- package/dist/esm/upload/tus-upload.js.map +1 -1
- package/dist/esm/upload/xhr-upload.js +1 -1
- package/dist/esm/upload/xhr-upload.js.map +1 -1
- package/package.json +17 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PinataAdapter } from "./v2/adapter-interface.js";
|
|
2
2
|
import { pinataAdapter } from "./v2/adapter.js";
|
|
3
|
-
import { AnalyticsQuery, FileListItem, FileListQuery, FileListResponse, PinJobItem, PinJobQuery, PinJobResponse, PinataConfig, PinataMetadata, SignedUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UploadOptions, UploadResponse } from "./shared/types.js";
|
|
3
|
+
import { AnalyticsQuery, ContainsCIDResponse, DeleteResponse, FileListItem, FileListQuery, FileListResponse, FileObject, JsonBody, KeyScopes, PinJobItem, PinJobQuery, PinJobResponse, PinataConfig, PinataMetadata, SignedUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UploadOptions, UploadResponse } from "./shared/types.js";
|
|
4
4
|
import { PinataLegacyAdapter, pinataLegacyAdapter } from "./legacy/adapter.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { AnalyticsQuery, FileListItem, FileListQuery, FileListResponse, PinJobItem, PinJobQuery, PinJobResponse, PinataConfig, PinataMetadata, SignedUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UploadOptions, UploadResponse } from "./types.js";
|
|
1
|
+
import { AnalyticsQuery, ContainsCIDResponse, DeleteResponse, FileListItem, FileListQuery, FileListResponse, FileObject, JsonBody, KeyScopes, PinJobItem, PinJobQuery, PinJobResponse, PinataConfig, PinataMetadata, SignedUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UploadOptions, UploadResponse } from "./types.js";
|
|
@@ -35,6 +35,20 @@ type UploadResponse = {
|
|
|
35
35
|
is_duplicate: true | null;
|
|
36
36
|
vectorized: true | null;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* File object representation
|
|
40
|
+
*/
|
|
41
|
+
type FileObject = {
|
|
42
|
+
name: string;
|
|
43
|
+
size: number;
|
|
44
|
+
type: string;
|
|
45
|
+
lastModified: number;
|
|
46
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* JSON body type
|
|
50
|
+
*/
|
|
51
|
+
type JsonBody = Record<string, unknown>;
|
|
38
52
|
/**
|
|
39
53
|
* Pinata metadata options
|
|
40
54
|
*/
|
|
@@ -52,6 +66,13 @@ type UploadOptions = {
|
|
|
52
66
|
vectorize?: boolean;
|
|
53
67
|
url?: string;
|
|
54
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Delete response
|
|
71
|
+
*/
|
|
72
|
+
type DeleteResponse = {
|
|
73
|
+
id: string;
|
|
74
|
+
status: string;
|
|
75
|
+
};
|
|
55
76
|
/**
|
|
56
77
|
* File list item
|
|
57
78
|
*/
|
|
@@ -192,6 +213,18 @@ type TimeIntervalAnalyticsResponse = {
|
|
|
192
213
|
total_bandwidth: number;
|
|
193
214
|
time_periods: TimePeriodItem[];
|
|
194
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* Key scopes
|
|
218
|
+
*/
|
|
219
|
+
type KeyScopes = {
|
|
220
|
+
endpoints: {
|
|
221
|
+
pinning: {
|
|
222
|
+
pinFileToIPFS: boolean;
|
|
223
|
+
pinJSONToIPFS: boolean;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
admin: boolean;
|
|
227
|
+
};
|
|
195
228
|
/**
|
|
196
229
|
* Swap CID options
|
|
197
230
|
*/
|
|
@@ -213,6 +246,13 @@ type SwapCidResponse = {
|
|
|
213
246
|
mapped_cid: string;
|
|
214
247
|
created_at: string;
|
|
215
248
|
};
|
|
249
|
+
/**
|
|
250
|
+
* Contains CID response
|
|
251
|
+
*/
|
|
252
|
+
type ContainsCIDResponse = {
|
|
253
|
+
containsCid: boolean;
|
|
254
|
+
cid: string | null;
|
|
255
|
+
};
|
|
216
256
|
//#endregion
|
|
217
|
-
export { AnalyticsQuery, FileListItem, FileListQuery, FileListResponse, PinJobItem, PinJobQuery, PinJobResponse, PinataConfig, PinataMetadata, SignedUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UploadOptions, UploadResponse };
|
|
257
|
+
export { AnalyticsQuery, ContainsCIDResponse, DeleteResponse, FileListItem, FileListQuery, FileListResponse, FileObject, JsonBody, KeyScopes, PinJobItem, PinJobQuery, PinJobResponse, PinataConfig, PinataMetadata, SignedUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UploadOptions, UploadResponse };
|
|
218
258
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -158,6 +158,9 @@ interface PinataAdapter {
|
|
|
158
158
|
* Configuration
|
|
159
159
|
*/
|
|
160
160
|
config: PinataConfig;
|
|
161
|
+
/**
|
|
162
|
+
* Update the adapter configuration
|
|
163
|
+
*/
|
|
161
164
|
updateConfig(newConfig: PinataConfig): void;
|
|
162
165
|
/**
|
|
163
166
|
* Upload with public/private separation
|
|
@@ -193,5 +196,5 @@ interface PinataAdapter {
|
|
|
193
196
|
analytics: Analytics;
|
|
194
197
|
}
|
|
195
198
|
//#endregion
|
|
196
|
-
export { PinataAdapter };
|
|
199
|
+
export { Analytics, FilterFiles, FilterGroups, FilterQueue, PinataAdapter, PrivateFiles, PrivateGateways, PrivateGroups, PrivateUpload, PublicFiles, PublicGateways, PublicGroups, PublicUpload, UploadBuilder };
|
|
197
200
|
//# sourceMappingURL=adapter-interface.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AccessLinkOptions, AnalyticsQuery, CidVersion, DeleteResponse, FileListItem, FileListResponse, GetGroupOptions, GroupCIDOptions, GroupListResponse, GroupOptions, GroupResponseItem, PinByCIDResponse, PinQueueItem, PinQueueResponse, PinataConfig, PinataMetadata, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UpdateFileOptions, UpdateGroupFilesResponse, UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse } from "./types.js";
|
|
1
|
+
import { AccessLinkOptions, AnalyticsQuery, CidVersion, ContentType, DeleteResponse, FileListItem, FileListQuery, FileListResponse, GetCIDResponse, GetGroupOptions, GroupCIDOptions, GroupListResponse, GroupOptions, GroupQueryOptions, GroupResponseItem, Network, PinByCIDResponse, PinQueueItem, PinQueueQuery, PinQueueResponse, PinataConfig, PinataMetadata, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UpdateFileOptions, UpdateGroupFilesResponse, UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse, UserPinnedDataResponse } from "./types.js";
|
|
2
2
|
import { PinataAdapter } from "./adapter-interface.js";
|
|
3
3
|
import { pinataAdapter } from "./adapter.js";
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
* CID version type
|
|
13
13
|
*/
|
|
14
14
|
type CidVersion = "v0" | "v1";
|
|
15
|
+
/**
|
|
16
|
+
* Network type
|
|
17
|
+
*/
|
|
18
|
+
type Network = "public" | "private";
|
|
15
19
|
/**
|
|
16
20
|
* Pinata configuration options
|
|
17
21
|
*/
|
|
@@ -120,6 +124,21 @@ type FileListResponse = {
|
|
|
120
124
|
files: FileListItem[];
|
|
121
125
|
next_page_token: string;
|
|
122
126
|
};
|
|
127
|
+
/**
|
|
128
|
+
* File list query
|
|
129
|
+
*/
|
|
130
|
+
type FileListQuery = {
|
|
131
|
+
name?: string;
|
|
132
|
+
group?: string;
|
|
133
|
+
noGroup?: boolean;
|
|
134
|
+
mimeType?: string;
|
|
135
|
+
cid?: string;
|
|
136
|
+
cidPending?: boolean;
|
|
137
|
+
metadata?: Record<string, string>;
|
|
138
|
+
order?: "ASC" | "DESC";
|
|
139
|
+
limit?: number;
|
|
140
|
+
pageToken?: number;
|
|
141
|
+
};
|
|
123
142
|
/**
|
|
124
143
|
* Update file options
|
|
125
144
|
*/
|
|
@@ -155,6 +174,16 @@ type PinQueueItem = {
|
|
|
155
174
|
version: number;
|
|
156
175
|
};
|
|
157
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* Pin queue query
|
|
179
|
+
*/
|
|
180
|
+
type PinQueueQuery = {
|
|
181
|
+
sort?: "ASC" | "DSC";
|
|
182
|
+
status?: "prechecking" | "retrieving" | "expired" | "backfilled" | "over_free_limit" | "over_max_size" | "invalid_object" | "bad_host_node";
|
|
183
|
+
cid?: string;
|
|
184
|
+
limit?: number;
|
|
185
|
+
pageToken?: string;
|
|
186
|
+
};
|
|
158
187
|
/**
|
|
159
188
|
* Pin queue response
|
|
160
189
|
*/
|
|
@@ -192,6 +221,17 @@ type AccessLinkOptions = {
|
|
|
192
221
|
expires: number;
|
|
193
222
|
gateway?: string;
|
|
194
223
|
};
|
|
224
|
+
/**
|
|
225
|
+
* Content type
|
|
226
|
+
*/
|
|
227
|
+
type ContentType = "application/json" | "application/xml" | "text/plain" | "text/html" | "text/css" | "text/javascript" | "application/javascript" | "image/jpeg" | "image/png" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/ogg" | "video/mp4" | "application/pdf" | "application/octet-stream" | string | null;
|
|
228
|
+
/**
|
|
229
|
+
* Get CID response
|
|
230
|
+
*/
|
|
231
|
+
type GetCIDResponse = {
|
|
232
|
+
data?: JSON | string | Blob | null;
|
|
233
|
+
contentType: ContentType;
|
|
234
|
+
};
|
|
195
235
|
/**
|
|
196
236
|
* Group options
|
|
197
237
|
*/
|
|
@@ -229,6 +269,15 @@ type GroupListResponse = {
|
|
|
229
269
|
groups: GroupResponseItem[];
|
|
230
270
|
next_page_token: string;
|
|
231
271
|
};
|
|
272
|
+
/**
|
|
273
|
+
* Group query options
|
|
274
|
+
*/
|
|
275
|
+
type GroupQueryOptions = {
|
|
276
|
+
name?: string;
|
|
277
|
+
limit?: number;
|
|
278
|
+
pageToken?: number;
|
|
279
|
+
isPublic?: boolean;
|
|
280
|
+
};
|
|
232
281
|
/**
|
|
233
282
|
* Group CID options
|
|
234
283
|
*/
|
|
@@ -303,6 +352,14 @@ type TimeIntervalAnalyticsResponse = {
|
|
|
303
352
|
total_bandwidth: number;
|
|
304
353
|
time_periods: TimePeriodItem[];
|
|
305
354
|
};
|
|
355
|
+
/**
|
|
356
|
+
* User pinned data response
|
|
357
|
+
*/
|
|
358
|
+
type UserPinnedDataResponse = {
|
|
359
|
+
pin_count: number;
|
|
360
|
+
pin_size_total: number;
|
|
361
|
+
pin_size_with_replications_total: number;
|
|
362
|
+
};
|
|
306
363
|
//#endregion
|
|
307
|
-
export { AccessLinkOptions, AnalyticsQuery, CidVersion, DeleteResponse, FileListItem, FileListResponse, GetGroupOptions, GroupCIDOptions, GroupListResponse, GroupOptions, GroupResponseItem, PinByCIDResponse, PinQueueItem, PinQueueResponse, PinataConfig, PinataMetadata, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UpdateFileOptions, UpdateGroupFilesResponse, UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse };
|
|
364
|
+
export { AccessLinkOptions, AnalyticsQuery, CidVersion, ContentType, DeleteResponse, FileListItem, FileListQuery, FileListResponse, GetCIDResponse, GetGroupOptions, GroupCIDOptions, GroupListResponse, GroupOptions, GroupQueryOptions, GroupResponseItem, Network, PinByCIDResponse, PinQueueItem, PinQueueQuery, PinQueueResponse, PinataConfig, PinataMetadata, SignedUploadUrlOptions, SwapCidOptions, SwapCidResponse, SwapHistoryOptions, TimeIntervalAnalyticsQuery, TimeIntervalAnalyticsResponse, TimePeriodItem, TopAnalyticsItem, TopAnalyticsQuery, TopAnalyticsResponse, UpdateFileOptions, UpdateGroupFilesResponse, UpdateGroupOptions, UploadCIDOptions, UploadOptions, UploadResponse, UserPinnedDataResponse };
|
|
308
365
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AuthManager } from "../auth/manager.js";
|
|
2
|
+
|
|
3
|
+
//#region src/api/client.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Shared base class for API clients that use ky with Bearer auth.
|
|
6
|
+
*
|
|
7
|
+
* Replaces the duplicated request() + error handling in IpnsClient and WebsitesClient.
|
|
8
|
+
* Auth headers come from AuthManager — one source of truth.
|
|
9
|
+
*/
|
|
10
|
+
declare abstract class ApiClient {
|
|
11
|
+
protected readonly auth: AuthManager;
|
|
12
|
+
protected readonly endpoint: string;
|
|
13
|
+
constructor(auth: AuthManager, endpoint: string);
|
|
14
|
+
protected request<T>(path: string, options?: RequestInit & {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
}): Promise<T>;
|
|
17
|
+
protected mapError(error: unknown): Promise<Error>;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { ApiClient };
|
|
21
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AuthenticationError, NetworkError, NotFoundError, ValidationError } from "../errors/index.js";
|
|
2
|
+
import ky, { HTTPError } from "ky";
|
|
3
|
+
|
|
4
|
+
//#region src/api/client.ts
|
|
5
|
+
/**
|
|
6
|
+
* Shared base class for API clients that use ky with Bearer auth.
|
|
7
|
+
*
|
|
8
|
+
* Replaces the duplicated request() + error handling in IpnsClient and WebsitesClient.
|
|
9
|
+
* Auth headers come from AuthManager — one source of truth.
|
|
10
|
+
*/
|
|
11
|
+
var ApiClient = class {
|
|
12
|
+
auth;
|
|
13
|
+
endpoint;
|
|
14
|
+
constructor(auth, endpoint) {
|
|
15
|
+
this.auth = auth;
|
|
16
|
+
this.endpoint = endpoint;
|
|
17
|
+
}
|
|
18
|
+
async request(path, options) {
|
|
19
|
+
try {
|
|
20
|
+
const response = await ky(path, {
|
|
21
|
+
prefix: this.endpoint,
|
|
22
|
+
headers: {
|
|
23
|
+
...this.auth.getAuthHeaders(),
|
|
24
|
+
"Content-Type": "application/json"
|
|
25
|
+
},
|
|
26
|
+
...options
|
|
27
|
+
});
|
|
28
|
+
if (response.status === 204) return;
|
|
29
|
+
const text = await response.text();
|
|
30
|
+
if (!text) return;
|
|
31
|
+
return JSON.parse(text);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
throw await this.mapError(error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async mapError(error) {
|
|
37
|
+
if (error instanceof HTTPError) {
|
|
38
|
+
const status = error.response.status;
|
|
39
|
+
const body = await error.response.json().catch(() => ({}));
|
|
40
|
+
const message = body.error || body.message;
|
|
41
|
+
if (status === 401 || status === 403) return new AuthenticationError(message || "Authentication failed");
|
|
42
|
+
if (status === 404) return new NotFoundError(message || "Resource not found");
|
|
43
|
+
if (status === 400) return new ValidationError(message || "Invalid request");
|
|
44
|
+
if (status === 410) return new ValidationError(message || "Target is broken or gone");
|
|
45
|
+
return new NetworkError(message || `HTTP error: ${status}`);
|
|
46
|
+
}
|
|
47
|
+
if (error instanceof Error) return new NetworkError(error.message);
|
|
48
|
+
return new NetworkError("Unknown error occurred");
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { ApiClient };
|
|
54
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../../src/api/client.ts"],"sourcesContent":["import ky, { HTTPError } from \"ky\";\nimport type { AuthManager } from \"@/auth\";\nimport {\n AuthenticationError,\n NotFoundError,\n NetworkError,\n ValidationError,\n} from \"@/errors\";\n\n/**\n * Shared base class for API clients that use ky with Bearer auth.\n *\n * Replaces the duplicated request() + error handling in IpnsClient and WebsitesClient.\n * Auth headers come from AuthManager — one source of truth.\n */\nexport abstract class ApiClient {\n protected readonly auth: AuthManager;\n protected readonly endpoint: string;\n\n constructor(auth: AuthManager, endpoint: string) {\n this.auth = auth;\n this.endpoint = endpoint;\n }\n\n protected async request<T>(\n path: string,\n options?: RequestInit & { signal?: AbortSignal },\n ): Promise<T> {\n try {\n const response = await ky(path, {\n prefix: this.endpoint,\n headers: {\n ...this.auth.getAuthHeaders(),\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 throw await this.mapError(error);\n }\n }\n\n protected async mapError(error: unknown): Promise<Error> {\n if (error instanceof HTTPError) {\n const status = error.response.status;\n const body = await error.response.json().catch(() => ({}));\n const message = (body as any).error || (body as any).message;\n\n if (status === 401 || status === 403) {\n return new AuthenticationError(message || \"Authentication failed\");\n }\n if (status === 404) {\n return new NotFoundError(message || \"Resource not found\");\n }\n if (status === 400) {\n return new ValidationError(message || \"Invalid request\");\n }\n if (status === 410) {\n return new ValidationError(message || \"Target is broken or gone\");\n }\n\n return new NetworkError(message || `HTTP error: ${status}`);\n }\n\n if (error instanceof Error) {\n return new NetworkError(error.message);\n }\n\n return new NetworkError(\"Unknown error occurred\");\n }\n}\n"],"mappings":";;;;;;;;;;AAeA,IAAsB,YAAtB,MAAgC;CAC9B,AAAmB;CACnB,AAAmB;CAEnB,YAAY,MAAmB,UAAkB;AAC/C,OAAK,OAAO;AACZ,OAAK,WAAW;;CAGlB,MAAgB,QACd,MACA,SACY;AACZ,MAAI;GACF,MAAM,WAAW,MAAM,GAAG,MAAM;IAC9B,QAAQ,KAAK;IACb,SAAS;KACP,GAAG,KAAK,KAAK,gBAAgB;KAC7B,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,SAAM,MAAM,KAAK,SAAS,MAAM;;;CAIpC,MAAgB,SAAS,OAAgC;AACvD,MAAI,iBAAiB,WAAW;GAC9B,MAAM,SAAS,MAAM,SAAS;GAC9B,MAAM,OAAO,MAAM,MAAM,SAAS,MAAM,CAAC,aAAa,EAAE,EAAE;GAC1D,MAAM,UAAW,KAAa,SAAU,KAAa;AAErD,OAAI,WAAW,OAAO,WAAW,IAC/B,QAAO,IAAI,oBAAoB,WAAW,wBAAwB;AAEpE,OAAI,WAAW,IACb,QAAO,IAAI,cAAc,WAAW,qBAAqB;AAE3D,OAAI,WAAW,IACb,QAAO,IAAI,gBAAgB,WAAW,kBAAkB;AAE1D,OAAI,WAAW,IACb,QAAO,IAAI,gBAAgB,WAAW,2BAA2B;AAGnE,UAAO,IAAI,aAAa,WAAW,eAAe,SAAS;;AAG7D,MAAI,iBAAiB,MACnB,QAAO,IAAI,aAAa,MAAM,QAAQ;AAGxC,SAAO,IAAI,aAAa,yBAAyB"}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { faker } from "@faker-js/faker";
|
|
2
|
-
import { HttpResponse,
|
|
2
|
+
import { HttpResponse, http } from "msw";
|
|
3
3
|
|
|
4
4
|
//#region src/api/generated/content/content.msw.ts
|
|
5
5
|
/**
|
|
6
|
-
* Generated by orval v8.
|
|
6
|
+
* Generated by orval v8.18.0 🍺
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Portal IPFS Plugin API
|
|
9
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
|
-
|
|
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
38
|
* OpenAPI spec version: 1.0.0
|
|
39
39
|
*/
|
|
40
40
|
const getGetApiBlockMetaCidResponseMock = (overrideResponse = {}) => ({
|
|
@@ -120,43 +120,36 @@ const getHeadIpfsCidResponseMock = (overrideResponse = {}) => ({
|
|
|
120
120
|
});
|
|
121
121
|
const getGetApiBlockMetaCidMockHandler = (overrideResponse, options) => {
|
|
122
122
|
return http.get("*/api/block/meta/:cid", async (info) => {
|
|
123
|
-
await delay(0);
|
|
124
123
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiBlockMetaCidResponseMock(), { status: 200 });
|
|
125
124
|
}, options);
|
|
126
125
|
};
|
|
127
126
|
const getPostApiBlockMetaBatchMockHandler = (overrideResponse, options) => {
|
|
128
127
|
return http.post("*/api/block/meta/batch", async (info) => {
|
|
129
|
-
await delay(0);
|
|
130
128
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiBlockMetaBatchResponseMock(), { status: 200 });
|
|
131
129
|
}, options);
|
|
132
130
|
};
|
|
133
131
|
const getGetApiInfoMockHandler = (overrideResponse, options) => {
|
|
134
132
|
return http.get("*/api/info", async (info) => {
|
|
135
|
-
await delay(0);
|
|
136
133
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiInfoResponseMock(), { status: 200 });
|
|
137
134
|
}, options);
|
|
138
135
|
};
|
|
139
136
|
const getPostApiUploadMockHandler = (overrideResponse, options) => {
|
|
140
137
|
return http.post("*/api/upload", async (info) => {
|
|
141
|
-
await delay(0);
|
|
142
138
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiUploadResponseMock(), { status: 200 });
|
|
143
139
|
}, options);
|
|
144
140
|
};
|
|
145
141
|
const getGetApiUploadResultIdentifierMockHandler = (overrideResponse, options) => {
|
|
146
142
|
return http.get("*/api/upload/result/:identifier", async (info) => {
|
|
147
|
-
await delay(0);
|
|
148
143
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiUploadResultIdentifierResponseMock(), { status: 200 });
|
|
149
144
|
}, options);
|
|
150
145
|
};
|
|
151
146
|
const getGetIpfsCidMockHandler = (overrideResponse, options) => {
|
|
152
147
|
return http.get("*/ipfs/:cid", async (info) => {
|
|
153
|
-
await delay(0);
|
|
154
148
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetIpfsCidResponseMock(), { status: 200 });
|
|
155
149
|
}, options);
|
|
156
150
|
};
|
|
157
151
|
const getHeadIpfsCidMockHandler = (overrideResponse, options) => {
|
|
158
152
|
return http.head("*/ipfs/:cid", async (info) => {
|
|
159
|
-
await delay(0);
|
|
160
153
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getHeadIpfsCidResponseMock(), { status: 200 });
|
|
161
154
|
}, options);
|
|
162
155
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.msw.js","names":[],"sources":["../../../../../src/api/generated/content/content.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 BlockMetaResponse,\n ErrorResponse,\n InfoResponse,\n PostUploadResponse,\n UploadResultResponse\n} from '../schemas';\n\n\nexport const getGetApiBlockMetaCidResponseMock = (overrideResponse: Partial<Extract<BlockMetaResponse, object>> = {}): BlockMetaResponse => ({block_size: faker.number.int(), child_cid: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => (faker.string.alpha({length: {min: 10, max: 20}}))), name: faker.string.alpha({length: {min: 10, max: 20}}), type: faker.number.int(), unixfs_size: faker.number.int(), ...overrideResponse})\n\nexport const getPostApiBlockMetaBatchResponseMock = (overrideResponse: Partial<Extract<ErrorResponse, object>> = {}): ErrorResponse => ({error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getGetApiInfoResponseMock = (overrideResponse: Partial<Extract<InfoResponse, object>> = {}): InfoResponse => ({announcement_addresses: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => (faker.string.alpha({length: {min: 10, max: 20}}))), connection_addresses: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => (faker.string.alpha({length: {min: 10, max: 20}}))), peer_id: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getPostApiUploadResponseMock = (overrideResponse: Partial<Extract<PostUploadResponse, object>> = {}): PostUploadResponse => ({CID: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getGetApiUploadResultIdentifierResponseMock = (overrideResponse: Partial<Extract<UploadResultResponse, object>> = {}): UploadResultResponse => ({cid: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), error: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), status: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getGetIpfsCidResponseMock = (overrideResponse: Partial<Extract<ErrorResponse, object>> = {}): ErrorResponse => ({error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getHeadIpfsCidResponseMock = (overrideResponse: Partial<Extract<ErrorResponse, object>> = {}): ErrorResponse => ({error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\n\nexport const getGetApiBlockMetaCidMockHandler = (overrideResponse?: BlockMetaResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<BlockMetaResponse> | BlockMetaResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/block/meta/:cid', 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 : getGetApiBlockMetaCidResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getPostApiBlockMetaBatchMockHandler = (overrideResponse?: ErrorResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<ErrorResponse> | ErrorResponse), options?: RequestHandlerOptions) => {\n return http.post('*/api/block/meta/batch', 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 : getPostApiBlockMetaBatchResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetApiInfoMockHandler = (overrideResponse?: InfoResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<InfoResponse> | InfoResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/info', 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 : getGetApiInfoResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getPostApiUploadMockHandler = (overrideResponse?: PostUploadResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<PostUploadResponse> | PostUploadResponse), options?: RequestHandlerOptions) => {\n return http.post('*/api/upload', 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 : getPostApiUploadResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetApiUploadResultIdentifierMockHandler = (overrideResponse?: UploadResultResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<UploadResultResponse> | UploadResultResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/upload/result/:identifier', 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 : getGetApiUploadResultIdentifierResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetIpfsCidMockHandler = (overrideResponse?: ErrorResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<ErrorResponse> | ErrorResponse), options?: RequestHandlerOptions) => {\n return http.get('*/ipfs/:cid', 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 : getGetIpfsCidResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getHeadIpfsCidMockHandler = (overrideResponse?: ErrorResponse | ((info: Parameters<Parameters<typeof http.head>[1]>[0]) => Promise<ErrorResponse> | ErrorResponse), options?: RequestHandlerOptions) => {\n return http.head('*/ipfs/:cid', async (info: Parameters<Parameters<typeof http.head>[1]>[0]) => {await delay(0);\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getHeadIpfsCidResponseMock(),\n { status: 200\n })\n }, options)\n}\nexport const getContentMock = () => [\n getGetApiBlockMetaCidMockHandler(),\n getPostApiBlockMetaBatchMockHandler(),\n getGetApiInfoMockHandler(),\n getPostApiUploadMockHandler(),\n getGetApiUploadResultIdentifierMockHandler(),\n getGetIpfsCidMockHandler(),\n getHeadIpfsCidMockHandler()\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,qCAAqC,mBAAgE,EAAE,MAAyB;CAAC,YAAY,MAAM,OAAO,KAAK;CAAE,WAAW,MAAM,KAAK,EAAE,QAAQ,MAAM,OAAO,IAAI;EAAC,KAAK;EAAG,KAAK;EAAG,CAAC,EAAE,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC,UAAW,MAAM,OAAO,MAAM,EAAC,QAAQ;EAA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2B;CAC5B"}
|
|
1
|
+
{"version":3,"file":"content.msw.js","names":[],"sources":["../../../../../src/api/generated/content/content.msw.ts"],"sourcesContent":["/**\n * Generated by orval v8.18.0 🍺\n * Do not edit manually.\n * Portal IPFS Plugin API\n *\n * ## Portal IPFS Plugin API\n *\n * A 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 *\n * 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.\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 *\n * All API endpoints require authentication using JWT tokens obtained from the Portal authentication service.\n *\n * ### Rate Limiting\n *\n * API requests are rate-limited based on user account tier. See Portal documentation for current limits.\n *\n * ### Documentation\n *\n * For 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 http\n} from 'msw';\nimport type {\n RequestHandlerOptions\n} from 'msw';\n\nimport type {\n BlockMetaResponse,\n ErrorResponse,\n InfoResponse,\n PostUploadResponse,\n UploadResultResponse\n} from '../schemas';\n\n\nexport const getGetApiBlockMetaCidResponseMock = (overrideResponse: Partial<Extract<BlockMetaResponse, object>> = {}): BlockMetaResponse => ({block_size: faker.number.int(), child_cid: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => (faker.string.alpha({length: {min: 10, max: 20}}))), name: faker.string.alpha({length: {min: 10, max: 20}}), type: faker.number.int(), unixfs_size: faker.number.int(), ...overrideResponse})\n\nexport const getPostApiBlockMetaBatchResponseMock = (overrideResponse: Partial<Extract<ErrorResponse, object>> = {}): ErrorResponse => ({error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getGetApiInfoResponseMock = (overrideResponse: Partial<Extract<InfoResponse, object>> = {}): InfoResponse => ({announcement_addresses: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => (faker.string.alpha({length: {min: 10, max: 20}}))), connection_addresses: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => (faker.string.alpha({length: {min: 10, max: 20}}))), peer_id: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getPostApiUploadResponseMock = (overrideResponse: Partial<Extract<PostUploadResponse, object>> = {}): PostUploadResponse => ({CID: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getGetApiUploadResultIdentifierResponseMock = (overrideResponse: Partial<Extract<UploadResultResponse, object>> = {}): UploadResultResponse => ({cid: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), error: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 20}}), undefined]), status: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getGetIpfsCidResponseMock = (overrideResponse: Partial<Extract<ErrorResponse, object>> = {}): ErrorResponse => ({error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\nexport const getHeadIpfsCidResponseMock = (overrideResponse: Partial<Extract<ErrorResponse, object>> = {}): ErrorResponse => ({error: faker.string.alpha({length: {min: 10, max: 20}}), ...overrideResponse})\n\n\nexport const getGetApiBlockMetaCidMockHandler = (overrideResponse?: BlockMetaResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<BlockMetaResponse> | BlockMetaResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/block/meta/:cid', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetApiBlockMetaCidResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getPostApiBlockMetaBatchMockHandler = (overrideResponse?: ErrorResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<ErrorResponse> | ErrorResponse), options?: RequestHandlerOptions) => {\n return http.post('*/api/block/meta/batch', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getPostApiBlockMetaBatchResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetApiInfoMockHandler = (overrideResponse?: InfoResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<InfoResponse> | InfoResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/info', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetApiInfoResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getPostApiUploadMockHandler = (overrideResponse?: PostUploadResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<PostUploadResponse> | PostUploadResponse), options?: RequestHandlerOptions) => {\n return http.post('*/api/upload', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getPostApiUploadResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetApiUploadResultIdentifierMockHandler = (overrideResponse?: UploadResultResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<UploadResultResponse> | UploadResultResponse), options?: RequestHandlerOptions) => {\n return http.get('*/api/upload/result/:identifier', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetApiUploadResultIdentifierResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getGetIpfsCidMockHandler = (overrideResponse?: ErrorResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<ErrorResponse> | ErrorResponse), options?: RequestHandlerOptions) => {\n return http.get('*/ipfs/:cid', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getGetIpfsCidResponseMock(),\n { status: 200\n })\n }, options)\n}\n\nexport const getHeadIpfsCidMockHandler = (overrideResponse?: ErrorResponse | ((info: Parameters<Parameters<typeof http.head>[1]>[0]) => Promise<ErrorResponse> | ErrorResponse), options?: RequestHandlerOptions) => {\n return http.head('*/ipfs/:cid', async (info: Parameters<Parameters<typeof http.head>[1]>[0]) => {\n\n\n return HttpResponse.json(overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(info) : overrideResponse)\n : getHeadIpfsCidResponseMock(),\n { status: 200\n })\n }, options)\n}\nexport const getContentMock = () => [\n getGetApiBlockMetaCidMockHandler(),\n getPostApiBlockMetaBatchMockHandler(),\n getGetApiInfoMockHandler(),\n getPostApiUploadMockHandler(),\n getGetApiUploadResultIdentifierMockHandler(),\n getGetIpfsCidMockHandler(),\n getHeadIpfsCidMockHandler()\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAa,qCAAqC,mBAAgE,EAAE,MAAyB;CAAC,YAAY,MAAM,OAAO,KAAK;CAAE,WAAW,MAAM,KAAK,EAAE,QAAQ,MAAM,OAAO,IAAI;EAAC,KAAK;EAAG,KAAK;EAAG,CAAC,EAAE,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC,UAAW,MAAM,OAAO,MAAM,EAAC,QAA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generated/dns/dns.msw.ts
|
|
5
5
|
/**
|
|
6
|
-
* Generated by orval v8.
|
|
6
|
+
* Generated by orval v8.18.0 🍺
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Portal IPFS Plugin API
|
|
9
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
|
-
|
|
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
38
|
* OpenAPI spec version: 1.0.0
|
|
39
39
|
*/
|
|
40
40
|
const getGetApiDnsZonesResponseMock = (overrideResponse = {}) => ({
|
|
@@ -307,87 +307,73 @@ const getPostApiDnsZonesIdValidateResponseMock = (overrideResponse = {}) => ({
|
|
|
307
307
|
});
|
|
308
308
|
const getGetApiDnsZonesMockHandler = (overrideResponse, options) => {
|
|
309
309
|
return http.get("*/api/dns/zones", async (info) => {
|
|
310
|
-
await delay(0);
|
|
311
310
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiDnsZonesResponseMock(), { status: 200 });
|
|
312
311
|
}, options);
|
|
313
312
|
};
|
|
314
313
|
const getPostApiDnsZonesMockHandler = (overrideResponse, options) => {
|
|
315
314
|
return http.post("*/api/dns/zones", async (info) => {
|
|
316
|
-
await delay(0);
|
|
317
315
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiDnsZonesResponseMock(), { status: 200 });
|
|
318
316
|
}, options);
|
|
319
317
|
};
|
|
320
318
|
const getDeleteApiDnsZonesIdMockHandler = (overrideResponse, options) => {
|
|
321
319
|
return http.delete("*/api/dns/zones/:id", async (info) => {
|
|
322
|
-
await delay(0);
|
|
323
320
|
const resolvedBody = overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getDeleteApiDnsZonesIdResponseMock();
|
|
324
321
|
return resolvedBody === void 0 ? new HttpResponse(null, { status: 204 }) : HttpResponse.json(resolvedBody, { status: 200 });
|
|
325
322
|
}, options);
|
|
326
323
|
};
|
|
327
324
|
const getGetApiDnsZonesIdMockHandler = (overrideResponse, options) => {
|
|
328
325
|
return http.get("*/api/dns/zones/:id", async (info) => {
|
|
329
|
-
await delay(0);
|
|
330
326
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiDnsZonesIdResponseMock(), { status: 200 });
|
|
331
327
|
}, options);
|
|
332
328
|
};
|
|
333
329
|
const getPutApiDnsZonesIdMockHandler = (overrideResponse, options) => {
|
|
334
330
|
return http.put("*/api/dns/zones/:id", async (info) => {
|
|
335
|
-
await delay(0);
|
|
336
331
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPutApiDnsZonesIdResponseMock(), { status: 200 });
|
|
337
332
|
}, options);
|
|
338
333
|
};
|
|
339
334
|
const getGetApiDnsZonesIdRecordsMockHandler = (overrideResponse, options) => {
|
|
340
335
|
return http.get("*/api/dns/zones/:id/records", async (info) => {
|
|
341
|
-
await delay(0);
|
|
342
336
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiDnsZonesIdRecordsResponseMock(), { status: 200 });
|
|
343
337
|
}, options);
|
|
344
338
|
};
|
|
345
339
|
const getPostApiDnsZonesIdRecordsMockHandler = (overrideResponse, options) => {
|
|
346
340
|
return http.post("*/api/dns/zones/:id/records", async (info) => {
|
|
347
|
-
await delay(0);
|
|
348
341
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiDnsZonesIdRecordsResponseMock(), { status: 200 });
|
|
349
342
|
}, options);
|
|
350
343
|
};
|
|
351
344
|
const getDeleteApiDnsZonesIdRecordsNameTypeMockHandler = (overrideResponse, options) => {
|
|
352
345
|
return http.delete("*/api/dns/zones/:id/records/:name/:type", async (info) => {
|
|
353
|
-
await delay(0);
|
|
354
346
|
const resolvedBody = overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getDeleteApiDnsZonesIdRecordsNameTypeResponseMock();
|
|
355
347
|
return resolvedBody === void 0 ? new HttpResponse(null, { status: 204 }) : HttpResponse.json(resolvedBody, { status: 200 });
|
|
356
348
|
}, options);
|
|
357
349
|
};
|
|
358
350
|
const getGetApiDnsZonesIdRecordsNameTypeMockHandler = (overrideResponse, options) => {
|
|
359
351
|
return http.get("*/api/dns/zones/:id/records/:name/:type", async (info) => {
|
|
360
|
-
await delay(0);
|
|
361
352
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiDnsZonesIdRecordsNameTypeResponseMock(), { status: 200 });
|
|
362
353
|
}, options);
|
|
363
354
|
};
|
|
364
355
|
const getPutApiDnsZonesIdRecordsNameTypeMockHandler = (overrideResponse, options) => {
|
|
365
356
|
return http.put("*/api/dns/zones/:id/records/:name/:type", async (info) => {
|
|
366
|
-
await delay(0);
|
|
367
357
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPutApiDnsZonesIdRecordsNameTypeResponseMock(), { status: 200 });
|
|
368
358
|
}, options);
|
|
369
359
|
};
|
|
370
360
|
const getPostApiDnsZonesIdRecordsBulkMockHandler = (overrideResponse, options) => {
|
|
371
361
|
return http.post("*/api/dns/zones/:id/records/bulk", async (info) => {
|
|
372
|
-
await delay(0);
|
|
373
362
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiDnsZonesIdRecordsBulkResponseMock(), { status: 200 });
|
|
374
363
|
}, options);
|
|
375
364
|
};
|
|
376
365
|
const getPostApiDnsZonesIdRecordsBulkDeleteMockHandler = (overrideResponse, options) => {
|
|
377
366
|
return http.post("*/api/dns/zones/:id/records/bulk-delete", async (info) => {
|
|
378
|
-
await delay(0);
|
|
379
367
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiDnsZonesIdRecordsBulkDeleteResponseMock(), { status: 200 });
|
|
380
368
|
}, options);
|
|
381
369
|
};
|
|
382
370
|
const getGetApiDnsZonesIdStatusMockHandler = (overrideResponse, options) => {
|
|
383
371
|
return http.get("*/api/dns/zones/:id/status", async (info) => {
|
|
384
|
-
await delay(0);
|
|
385
372
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getGetApiDnsZonesIdStatusResponseMock(), { status: 200 });
|
|
386
373
|
}, options);
|
|
387
374
|
};
|
|
388
375
|
const getPostApiDnsZonesIdValidateMockHandler = (overrideResponse, options) => {
|
|
389
376
|
return http.post("*/api/dns/zones/:id/validate", async (info) => {
|
|
390
|
-
await delay(0);
|
|
391
377
|
return HttpResponse.json(overrideResponse !== void 0 ? typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse : getPostApiDnsZonesIdValidateResponseMock(), { status: 200 });
|
|
392
378
|
}, options);
|
|
393
379
|
};
|