pinata 1.3.0 → 1.4.0

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 CHANGED
@@ -116,6 +116,7 @@ type SignedUrlOptions = {
116
116
  cid: string;
117
117
  date?: number;
118
118
  expires: number;
119
+ gateway?: string;
119
120
  };
120
121
  type GatewayAnalyticsQuery = {
121
122
  gateway_domain: string;
package/dist/index.d.ts CHANGED
@@ -116,6 +116,7 @@ type SignedUrlOptions = {
116
116
  cid: string;
117
117
  date?: number;
118
118
  expires: number;
119
+ gateway?: string;
119
120
  };
120
121
  type GatewayAnalyticsQuery = {
121
122
  gateway_domain: string;
package/dist/index.js CHANGED
@@ -1355,7 +1355,13 @@ var createSignedURL = async (config, options, imgOpts) => {
1355
1355
  if (!config) {
1356
1356
  throw new ValidationError("Pinata configuration is missing");
1357
1357
  }
1358
- let newUrl = `${config?.pinataGateway}/files/${options.cid}`;
1358
+ let baseUrl;
1359
+ if (options?.gateway) {
1360
+ baseUrl = options.gateway.startsWith("https://") ? options.gateway : `https://${options.gateway}`;
1361
+ } else {
1362
+ baseUrl = config.pinataGateway;
1363
+ }
1364
+ let newUrl = `${baseUrl}/files/${options.cid}`;
1359
1365
  const params = new URLSearchParams();
1360
1366
  if (imgOpts) {
1361
1367
  if (imgOpts.width)