pinata 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +76 -135
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -7
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ type PinataConfig = {
|
|
|
5
5
|
customHeaders?: Record<string, string>;
|
|
6
6
|
endpointUrl?: string;
|
|
7
7
|
uploadUrl?: string;
|
|
8
|
+
legacyUploadUrl?: string;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
type AnalyticsQuery = {
|
|
@@ -227,7 +228,9 @@ type UpdateGroupFilesResponse = {
|
|
|
227
228
|
type KeyPermissions = {
|
|
228
229
|
admin?: boolean;
|
|
229
230
|
endpoints?: Endpoints;
|
|
231
|
+
resources?: ResourcePermission[];
|
|
230
232
|
};
|
|
233
|
+
type ResourcePermission = "org:read" | "org:write" | "org:files:read" | "org:files:write" | "org:groups:read" | "org:groups:write" | "org:gateways:read" | "org:gateways:write" | "org:analytics:read" | "org:analytics:write";
|
|
231
234
|
type Endpoints = {
|
|
232
235
|
data?: DataEndponts;
|
|
233
236
|
pinning?: PinningEndpoints;
|
|
@@ -334,6 +337,8 @@ type SignedUploadUrlOptions = {
|
|
|
334
337
|
name?: string;
|
|
335
338
|
keyvalues?: Record<string, string>;
|
|
336
339
|
vectorize?: boolean;
|
|
340
|
+
maxFileSize?: number;
|
|
341
|
+
mimeTypes?: string[];
|
|
337
342
|
};
|
|
338
343
|
type UploadCIDOptions = {
|
|
339
344
|
metadata?: PinataMetadata;
|
|
@@ -800,4 +805,4 @@ declare function getFileIdFromUrl(url: string): string;
|
|
|
800
805
|
|
|
801
806
|
declare const formatConfig: (config: PinataConfig | undefined) => PinataConfig | undefined;
|
|
802
807
|
|
|
803
|
-
export { type AccessLinkOptions, type AnalyticsQuery, AuthenticationError, type ContainsCIDResponse, type ContentType, type DataEndponts, type DeleteResponse, type Endpoints, type FileListItem, type FileListQuery, type FileListResponse, type FileObject, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, NetworkError, type OptimizeImageOptions, type PinByCIDResponse, type PinQueueItem, type PinQueueQuery, type PinQueueResponse, type PinataConfig, PinataError, type PinataMetadata, PinataSDK, type PinningEndpoints, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SignedUploadUrlOptions, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, type UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UploadResponse, type UserPinnedDataResponse, ValidationError, type VectorQueryMatch, type VectorizeFileResponse, type VectorizeQuery, type VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, containsCID, convertIPFSUrl, convertToDesiredGateway, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
|
808
|
+
export { type AccessLinkOptions, type AnalyticsQuery, AuthenticationError, type ContainsCIDResponse, type ContentType, type DataEndponts, type DeleteResponse, type Endpoints, type FileListItem, type FileListQuery, type FileListResponse, type FileObject, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, NetworkError, type OptimizeImageOptions, type PinByCIDResponse, type PinQueueItem, type PinQueueQuery, type PinQueueResponse, type PinataConfig, PinataError, type PinataMetadata, PinataSDK, type PinningEndpoints, type ResourcePermission, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SignedUploadUrlOptions, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, type UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UploadResponse, type UserPinnedDataResponse, ValidationError, type VectorQueryMatch, type VectorizeFileResponse, type VectorizeQuery, type VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, containsCID, convertIPFSUrl, convertToDesiredGateway, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ type PinataConfig = {
|
|
|
5
5
|
customHeaders?: Record<string, string>;
|
|
6
6
|
endpointUrl?: string;
|
|
7
7
|
uploadUrl?: string;
|
|
8
|
+
legacyUploadUrl?: string;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
type AnalyticsQuery = {
|
|
@@ -227,7 +228,9 @@ type UpdateGroupFilesResponse = {
|
|
|
227
228
|
type KeyPermissions = {
|
|
228
229
|
admin?: boolean;
|
|
229
230
|
endpoints?: Endpoints;
|
|
231
|
+
resources?: ResourcePermission[];
|
|
230
232
|
};
|
|
233
|
+
type ResourcePermission = "org:read" | "org:write" | "org:files:read" | "org:files:write" | "org:groups:read" | "org:groups:write" | "org:gateways:read" | "org:gateways:write" | "org:analytics:read" | "org:analytics:write";
|
|
231
234
|
type Endpoints = {
|
|
232
235
|
data?: DataEndponts;
|
|
233
236
|
pinning?: PinningEndpoints;
|
|
@@ -334,6 +337,8 @@ type SignedUploadUrlOptions = {
|
|
|
334
337
|
name?: string;
|
|
335
338
|
keyvalues?: Record<string, string>;
|
|
336
339
|
vectorize?: boolean;
|
|
340
|
+
maxFileSize?: number;
|
|
341
|
+
mimeTypes?: string[];
|
|
337
342
|
};
|
|
338
343
|
type UploadCIDOptions = {
|
|
339
344
|
metadata?: PinataMetadata;
|
|
@@ -800,4 +805,4 @@ declare function getFileIdFromUrl(url: string): string;
|
|
|
800
805
|
|
|
801
806
|
declare const formatConfig: (config: PinataConfig | undefined) => PinataConfig | undefined;
|
|
802
807
|
|
|
803
|
-
export { type AccessLinkOptions, type AnalyticsQuery, AuthenticationError, type ContainsCIDResponse, type ContentType, type DataEndponts, type DeleteResponse, type Endpoints, type FileListItem, type FileListQuery, type FileListResponse, type FileObject, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, NetworkError, type OptimizeImageOptions, type PinByCIDResponse, type PinQueueItem, type PinQueueQuery, type PinQueueResponse, type PinataConfig, PinataError, type PinataMetadata, PinataSDK, type PinningEndpoints, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SignedUploadUrlOptions, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, type UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UploadResponse, type UserPinnedDataResponse, ValidationError, type VectorQueryMatch, type VectorizeFileResponse, type VectorizeQuery, type VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, containsCID, convertIPFSUrl, convertToDesiredGateway, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
|
808
|
+
export { type AccessLinkOptions, type AnalyticsQuery, AuthenticationError, type ContainsCIDResponse, type ContentType, type DataEndponts, type DeleteResponse, type Endpoints, type FileListItem, type FileListQuery, type FileListResponse, type FileObject, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupListResponse, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, NetworkError, type OptimizeImageOptions, type PinByCIDResponse, type PinQueueItem, type PinQueueQuery, type PinQueueResponse, type PinataConfig, PinataError, type PinataMetadata, PinataSDK, type PinningEndpoints, type ResourcePermission, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SignedUploadUrlOptions, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalAnalyticsQuery, type TimeIntervalAnalyticsResponse, type TimePeriodItem, type TopAnalyticsItem, type TopAnalyticsQuery, type TopAnalyticsResponse, type UpdateFileOptions, type UpdateGroupFilesResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UploadResponse, type UserPinnedDataResponse, ValidationError, type VectorQueryMatch, type VectorizeFileResponse, type VectorizeQuery, type VectorizeQueryResponse, addToGroup, analyticsDateInterval, analyticsTopUsage, containsCID, convertIPFSUrl, convertToDesiredGateway, createAccessLink, createGroup, createKey, createSignedUploadURL, deleteFile, deleteFileVectors, deleteGroup, deletePinRequest, deleteSwap, formatConfig, getCid, getFileIdFromUrl, getGroup, listFiles, listGroups, listKeys, pinnedFileCount, queue, removeFromGroup, revokeKeys, swapCid, swapHistory, testAuthentication, totalStorageUsage, updateFile, updateGroup, uploadBase64, uploadCid, uploadFile, uploadFileArray, uploadJson, uploadUrl, vectorizeFile, vectorizeQuery };
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
AuthenticationError: () => AuthenticationError,
|
|
24
24
|
NetworkError: () => NetworkError,
|
|
25
25
|
PinataError: () => PinataError,
|
|
@@ -66,7 +66,7 @@ __export(src_exports, {
|
|
|
66
66
|
vectorizeFile: () => vectorizeFile,
|
|
67
67
|
vectorizeQuery: () => vectorizeQuery
|
|
68
68
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
69
|
+
module.exports = __toCommonJS(index_exports);
|
|
70
70
|
|
|
71
71
|
// src/utils/custom-errors.ts
|
|
72
72
|
var PinataError = class extends Error {
|
|
@@ -118,32 +118,19 @@ var analyticsDateInterval = async (config, options) => {
|
|
|
118
118
|
date_interval,
|
|
119
119
|
sort_by
|
|
120
120
|
} = options;
|
|
121
|
-
if (cid)
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
if (
|
|
134
|
-
params.append("country", country.toString());
|
|
135
|
-
if (region)
|
|
136
|
-
params.append("region", region);
|
|
137
|
-
if (referer)
|
|
138
|
-
params.append("referer", referer.toString());
|
|
139
|
-
if (limit)
|
|
140
|
-
params.append("limit", limit.toString());
|
|
141
|
-
if (sort_order)
|
|
142
|
-
params.append("sort_order", sort_order);
|
|
143
|
-
if (sort_by)
|
|
144
|
-
params.append("sort_by", sort_by);
|
|
145
|
-
if (date_interval)
|
|
146
|
-
params.append("by", date_interval);
|
|
121
|
+
if (cid) params.append("cid", cid);
|
|
122
|
+
if (gateway_domain) params.append("gateway_domain", gateway_domain);
|
|
123
|
+
if (start_date) params.append("start_date", start_date);
|
|
124
|
+
if (end_date) params.append("end_date", end_date);
|
|
125
|
+
if (file_name) params.append("file_name", file_name);
|
|
126
|
+
if (user_agent) params.append("user_agent", user_agent.toString());
|
|
127
|
+
if (country) params.append("country", country.toString());
|
|
128
|
+
if (region) params.append("region", region);
|
|
129
|
+
if (referer) params.append("referer", referer.toString());
|
|
130
|
+
if (limit) params.append("limit", limit.toString());
|
|
131
|
+
if (sort_order) params.append("sort_order", sort_order);
|
|
132
|
+
if (sort_by) params.append("sort_by", sort_by);
|
|
133
|
+
if (date_interval) params.append("by", date_interval);
|
|
147
134
|
}
|
|
148
135
|
let endpoint = "https://api.pinata.cloud/v3";
|
|
149
136
|
if (config.endpointUrl) {
|
|
@@ -235,28 +222,17 @@ var analyticsTopUsage = async (config, options) => {
|
|
|
235
222
|
if (cid) {
|
|
236
223
|
params.append("cid", cid);
|
|
237
224
|
}
|
|
238
|
-
if (start_date)
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
if (
|
|
249
|
-
params.append("region", region);
|
|
250
|
-
if (referer)
|
|
251
|
-
params.append("referer", referer.toString());
|
|
252
|
-
if (limit)
|
|
253
|
-
params.append("limit", limit.toString());
|
|
254
|
-
if (sort_order)
|
|
255
|
-
params.append("sort_order", sort_order);
|
|
256
|
-
if (sort_by)
|
|
257
|
-
params.append("sort_by", sort_by);
|
|
258
|
-
if (attribute)
|
|
259
|
-
params.append("by", attribute);
|
|
225
|
+
if (start_date) params.append("start_date", start_date);
|
|
226
|
+
if (end_date) params.append("end_date", end_date);
|
|
227
|
+
if (file_name) params.append("file_name", file_name);
|
|
228
|
+
if (user_agent) params.append("user_agent", user_agent.toString());
|
|
229
|
+
if (country) params.append("country", country.toString());
|
|
230
|
+
if (region) params.append("region", region);
|
|
231
|
+
if (referer) params.append("referer", referer.toString());
|
|
232
|
+
if (limit) params.append("limit", limit.toString());
|
|
233
|
+
if (sort_order) params.append("sort_order", sort_order);
|
|
234
|
+
if (sort_by) params.append("sort_by", sort_by);
|
|
235
|
+
if (attribute) params.append("by", attribute);
|
|
260
236
|
}
|
|
261
237
|
let endpoint = "https://api.pinata.cloud/v3";
|
|
262
238
|
if (config.endpointUrl) {
|
|
@@ -626,24 +602,15 @@ var listFiles = async (config, privacy, options) => {
|
|
|
626
602
|
metadata,
|
|
627
603
|
noGroup
|
|
628
604
|
} = options;
|
|
629
|
-
if (limit)
|
|
630
|
-
|
|
631
|
-
if (
|
|
632
|
-
|
|
633
|
-
if (
|
|
634
|
-
|
|
635
|
-
if (
|
|
636
|
-
|
|
637
|
-
if (
|
|
638
|
-
params.append("mimeType", mimeType);
|
|
639
|
-
if (order)
|
|
640
|
-
params.append("order", order);
|
|
641
|
-
if (pageToken)
|
|
642
|
-
params.append("pageToken", pageToken);
|
|
643
|
-
if (cidPending)
|
|
644
|
-
params.append("cidPending", "true");
|
|
645
|
-
if (noGroup)
|
|
646
|
-
params.append("group", "null");
|
|
605
|
+
if (limit) params.append("limit", limit.toString());
|
|
606
|
+
if (name) params.append("name", name);
|
|
607
|
+
if (group) params.append("group", group);
|
|
608
|
+
if (cid) params.append("cid", cid);
|
|
609
|
+
if (mimeType) params.append("mimeType", mimeType);
|
|
610
|
+
if (order) params.append("order", order);
|
|
611
|
+
if (pageToken) params.append("pageToken", pageToken);
|
|
612
|
+
if (cidPending) params.append("cidPending", "true");
|
|
613
|
+
if (noGroup) params.append("group", "null");
|
|
647
614
|
if (metadata && typeof metadata === "object") {
|
|
648
615
|
Object.entries(metadata).forEach(([key, value]) => {
|
|
649
616
|
params.append(`keyvalues[${key.toString()}]`, value.toString());
|
|
@@ -1240,16 +1207,11 @@ var queue = async (config, options) => {
|
|
|
1240
1207
|
});
|
|
1241
1208
|
if (options) {
|
|
1242
1209
|
const { cid, status, sort, limit, pageToken } = options;
|
|
1243
|
-
if (cid)
|
|
1244
|
-
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1247
|
-
if (
|
|
1248
|
-
params.append("sort", sort.toString());
|
|
1249
|
-
if (limit)
|
|
1250
|
-
params.append("limit", limit.toString());
|
|
1251
|
-
if (pageToken)
|
|
1252
|
-
params.append("pageToken", pageToken.toString());
|
|
1210
|
+
if (cid) params.append("cid", cid.toString());
|
|
1211
|
+
if (status) params.append("status", status.toString());
|
|
1212
|
+
if (sort) params.append("sort", sort.toString());
|
|
1213
|
+
if (limit) params.append("limit", limit.toString());
|
|
1214
|
+
if (pageToken) params.append("pageToken", pageToken.toString());
|
|
1253
1215
|
}
|
|
1254
1216
|
let endpoint = "https://api.pinata.cloud/v3";
|
|
1255
1217
|
if (config.endpointUrl) {
|
|
@@ -1382,28 +1344,20 @@ var getCid = async (config, cid, gatewayType, options) => {
|
|
|
1382
1344
|
let newUrl = `${config?.pinataGateway}/${gatewayType}/${cid}`;
|
|
1383
1345
|
const params = new URLSearchParams();
|
|
1384
1346
|
if (options) {
|
|
1385
|
-
if (options.width)
|
|
1386
|
-
|
|
1387
|
-
if (options.
|
|
1388
|
-
|
|
1389
|
-
if (options.
|
|
1390
|
-
params.append("img-dpr", options.dpr.toString());
|
|
1391
|
-
if (options.fit)
|
|
1392
|
-
params.append("img-fit", options.fit);
|
|
1393
|
-
if (options.gravity)
|
|
1394
|
-
params.append("img-gravity", options.gravity);
|
|
1347
|
+
if (options.width) params.append("img-width", options.width.toString());
|
|
1348
|
+
if (options.height) params.append("img-height", options.height.toString());
|
|
1349
|
+
if (options.dpr) params.append("img-dpr", options.dpr.toString());
|
|
1350
|
+
if (options.fit) params.append("img-fit", options.fit);
|
|
1351
|
+
if (options.gravity) params.append("img-gravity", options.gravity);
|
|
1395
1352
|
if (options.quality)
|
|
1396
1353
|
params.append("img-quality", options.quality.toString());
|
|
1397
|
-
if (options.format)
|
|
1398
|
-
params.append("img-format", options.format);
|
|
1354
|
+
if (options.format) params.append("img-format", options.format);
|
|
1399
1355
|
if (options.animation !== void 0)
|
|
1400
1356
|
params.append("img-anim", options.animation.toString());
|
|
1401
1357
|
if (options.sharpen)
|
|
1402
1358
|
params.append("img-sharpen", options.sharpen.toString());
|
|
1403
|
-
if (options.onError === true)
|
|
1404
|
-
|
|
1405
|
-
if (options.metadata)
|
|
1406
|
-
params.append("img-metadata", options.metadata);
|
|
1359
|
+
if (options.onError === true) params.append("img-onerror", "redirect");
|
|
1360
|
+
if (options.metadata) params.append("img-metadata", options.metadata);
|
|
1407
1361
|
}
|
|
1408
1362
|
if (config?.pinataGatewayKey) {
|
|
1409
1363
|
params.append("pinataGatewayToken", config.pinataGatewayKey);
|
|
@@ -1654,28 +1608,20 @@ var createAccessLink = async (config, options, imgOpts) => {
|
|
|
1654
1608
|
let newUrl = `${baseUrl}/files/${options.cid}`;
|
|
1655
1609
|
const params = new URLSearchParams();
|
|
1656
1610
|
if (imgOpts) {
|
|
1657
|
-
if (imgOpts.width)
|
|
1658
|
-
|
|
1659
|
-
if (imgOpts.
|
|
1660
|
-
|
|
1661
|
-
if (imgOpts.
|
|
1662
|
-
params.append("img-dpr", imgOpts.dpr.toString());
|
|
1663
|
-
if (imgOpts.fit)
|
|
1664
|
-
params.append("img-fit", imgOpts.fit);
|
|
1665
|
-
if (imgOpts.gravity)
|
|
1666
|
-
params.append("img-gravity", imgOpts.gravity);
|
|
1611
|
+
if (imgOpts.width) params.append("img-width", imgOpts.width.toString());
|
|
1612
|
+
if (imgOpts.height) params.append("img-height", imgOpts.height.toString());
|
|
1613
|
+
if (imgOpts.dpr) params.append("img-dpr", imgOpts.dpr.toString());
|
|
1614
|
+
if (imgOpts.fit) params.append("img-fit", imgOpts.fit);
|
|
1615
|
+
if (imgOpts.gravity) params.append("img-gravity", imgOpts.gravity);
|
|
1667
1616
|
if (imgOpts.quality)
|
|
1668
1617
|
params.append("img-quality", imgOpts.quality.toString());
|
|
1669
|
-
if (imgOpts.format)
|
|
1670
|
-
params.append("img-format", imgOpts.format);
|
|
1618
|
+
if (imgOpts.format) params.append("img-format", imgOpts.format);
|
|
1671
1619
|
if (imgOpts.animation !== void 0)
|
|
1672
1620
|
params.append("img-anim", imgOpts.animation.toString());
|
|
1673
1621
|
if (imgOpts.sharpen)
|
|
1674
1622
|
params.append("img-sharpen", imgOpts.sharpen.toString());
|
|
1675
|
-
if (imgOpts.onError === true)
|
|
1676
|
-
|
|
1677
|
-
if (imgOpts.metadata)
|
|
1678
|
-
params.append("img-metadata", imgOpts.metadata);
|
|
1623
|
+
if (imgOpts.onError === true) params.append("img-onerror", "redirect");
|
|
1624
|
+
if (imgOpts.metadata) params.append("img-metadata", imgOpts.metadata);
|
|
1679
1625
|
}
|
|
1680
1626
|
const queryString = params.toString();
|
|
1681
1627
|
if (queryString) {
|
|
@@ -2063,14 +2009,10 @@ var listGroups = async (config, privacy, options) => {
|
|
|
2063
2009
|
const params = new URLSearchParams();
|
|
2064
2010
|
if (options) {
|
|
2065
2011
|
const { pageToken, name, limit, isPublic } = options;
|
|
2066
|
-
if (pageToken)
|
|
2067
|
-
|
|
2068
|
-
if (
|
|
2069
|
-
|
|
2070
|
-
if (name)
|
|
2071
|
-
params.append("name", name);
|
|
2072
|
-
if (limit !== void 0)
|
|
2073
|
-
params.append("limit", limit.toString());
|
|
2012
|
+
if (pageToken) params.append("pageToken", pageToken.toString());
|
|
2013
|
+
if (isPublic) params.append("isPublic", isPublic.toString());
|
|
2014
|
+
if (name) params.append("name", name);
|
|
2015
|
+
if (limit !== void 0) params.append("limit", limit.toString());
|
|
2074
2016
|
}
|
|
2075
2017
|
let endpoint = "https://api.pinata.cloud/v3";
|
|
2076
2018
|
if (config.endpointUrl) {
|
|
@@ -2366,16 +2308,13 @@ var listKeys = async (config, options) => {
|
|
|
2366
2308
|
const params = new URLSearchParams();
|
|
2367
2309
|
if (options) {
|
|
2368
2310
|
const { offset, name, revoked, limitedUse, exhausted } = options;
|
|
2369
|
-
if (offset)
|
|
2370
|
-
|
|
2371
|
-
if (revoked !== void 0)
|
|
2372
|
-
params.append("revoked", revoked.toString());
|
|
2311
|
+
if (offset) params.append("offset", offset.toString());
|
|
2312
|
+
if (revoked !== void 0) params.append("revoked", revoked.toString());
|
|
2373
2313
|
if (limitedUse !== void 0)
|
|
2374
2314
|
params.append("limitedUse", limitedUse.toString());
|
|
2375
2315
|
if (exhausted !== void 0)
|
|
2376
2316
|
params.append("exhausted", exhausted.toString());
|
|
2377
|
-
if (name)
|
|
2378
|
-
params.append("name", name);
|
|
2317
|
+
if (name) params.append("name", name);
|
|
2379
2318
|
}
|
|
2380
2319
|
let endpoint = "https://api.pinata.cloud/v3";
|
|
2381
2320
|
if (config.endpointUrl) {
|
|
@@ -2682,6 +2621,12 @@ var createSignedUploadURL = async (config, options, network) => {
|
|
|
2682
2621
|
if (network) {
|
|
2683
2622
|
payload.network = network;
|
|
2684
2623
|
}
|
|
2624
|
+
if (options.maxFileSize) {
|
|
2625
|
+
payload.max_file_size = options.maxFileSize;
|
|
2626
|
+
}
|
|
2627
|
+
if (options.mimeTypes) {
|
|
2628
|
+
payload.allow_mime_types = options.mimeTypes;
|
|
2629
|
+
}
|
|
2685
2630
|
let endpoint = "https://uploads.pinata.cloud/v3";
|
|
2686
2631
|
if (config.uploadUrl) {
|
|
2687
2632
|
endpoint = config.uploadUrl;
|
|
@@ -3072,8 +3017,8 @@ var uploadFileArray = async (config, files, network, options) => {
|
|
|
3072
3017
|
};
|
|
3073
3018
|
}
|
|
3074
3019
|
let endpoint = "https://api.pinata.cloud/pinning/pinFileToIPFS";
|
|
3075
|
-
if (config.
|
|
3076
|
-
endpoint = config.
|
|
3020
|
+
if (config.legacyUploadUrl) {
|
|
3021
|
+
endpoint = config.legacyUploadUrl;
|
|
3077
3022
|
}
|
|
3078
3023
|
try {
|
|
3079
3024
|
const request = await fetch(`${endpoint}`, {
|
|
@@ -3649,10 +3594,8 @@ var AnalyticsBandwidth = class extends AnalyticsFilter {
|
|
|
3649
3594
|
this.config = newConfig;
|
|
3650
3595
|
}
|
|
3651
3596
|
customDates(start, end) {
|
|
3652
|
-
if (start)
|
|
3653
|
-
|
|
3654
|
-
if (end)
|
|
3655
|
-
this.query.end_date = end;
|
|
3597
|
+
if (start) this.query.start_date = start;
|
|
3598
|
+
if (end) this.query.end_date = end;
|
|
3656
3599
|
return this;
|
|
3657
3600
|
}
|
|
3658
3601
|
from(domain) {
|
|
@@ -3734,10 +3677,8 @@ var AnalyticsRequests = class extends AnalyticsFilter {
|
|
|
3734
3677
|
this.config = newConfig;
|
|
3735
3678
|
}
|
|
3736
3679
|
customDates(start, end) {
|
|
3737
|
-
if (start)
|
|
3738
|
-
|
|
3739
|
-
if (end)
|
|
3740
|
-
this.query.end_date = end;
|
|
3680
|
+
if (start) this.query.start_date = start;
|
|
3681
|
+
if (end) this.query.end_date = end;
|
|
3741
3682
|
return this;
|
|
3742
3683
|
}
|
|
3743
3684
|
from(domain) {
|