pinata 0.3.3 → 0.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
@@ -124,6 +124,19 @@ type GetCIDResponse = {
124
124
  data?: JSON | string | Blob | null;
125
125
  contentType: ContentType;
126
126
  };
127
+ type OptimizeImageOptions = {
128
+ width?: number;
129
+ height?: number;
130
+ dpr?: number;
131
+ fit?: "scaleDown" | "contain" | "cover" | "crop" | "pad";
132
+ gravity?: "auto" | "side" | string;
133
+ quality?: number;
134
+ format?: "auto" | "webp";
135
+ animation?: boolean;
136
+ sharpen?: number;
137
+ onError?: boolean;
138
+ metadata?: "keep" | "copyright" | "none";
139
+ };
127
140
  type GatewayAnalyticsQuery = {
128
141
  gateway_domain: string;
129
142
  start_date: string;
@@ -280,6 +293,10 @@ type SwapCidResponse = {
280
293
  mappedCid: string;
281
294
  createdAt: string;
282
295
  };
296
+ type ContainsCIDResponse = {
297
+ containsCid: boolean;
298
+ cid: string | null;
299
+ };
283
300
 
284
301
  declare class PinataSDK {
285
302
  config: PinataConfig | undefined;
@@ -352,8 +369,9 @@ declare class Gateways {
352
369
  config: PinataConfig | undefined;
353
370
  constructor(config?: PinataConfig);
354
371
  updateConfig(newConfig: PinataConfig): void;
355
- get(cid: string): Promise<GetCIDResponse>;
356
- convert(url: string): Promise<string>;
372
+ get(cid: string): OptimizeImage;
373
+ convert(url: string, gatewayPrefix?: string): Promise<string>;
374
+ containsCID(cid: string): Promise<ContainsCIDResponse>;
357
375
  topUsageAnalytics(options: {
358
376
  domain: string;
359
377
  start: string;
@@ -371,6 +389,14 @@ declare class Gateways {
371
389
  swapHistory(options: SwapHistoryOptions): Promise<SwapCidResponse[]>;
372
390
  deleteSwap(cid: string): Promise<string>;
373
391
  }
392
+ declare class OptimizeImage {
393
+ private config;
394
+ private cid;
395
+ private options;
396
+ constructor(config: PinataConfig | undefined, cid: string);
397
+ optimizeImage(options: OptimizeImageOptions): OptimizeImage;
398
+ then(onfulfilled?: ((value: GetCIDResponse) => any) | null): Promise<any>;
399
+ }
374
400
  declare class FilterPinJobs {
375
401
  private config;
376
402
  private query;
@@ -445,7 +471,7 @@ declare class FilterGroups {
445
471
  offset(offset: number): FilterGroups;
446
472
  name(nameContains: string): FilterGroups;
447
473
  limit(limit: number): FilterGroups;
448
- then(onfulfilled?: ((value: GroupResponseItem[]) => any) | null): Promise<any>;
474
+ then(onfulfilled?: ((value: GroupResponseItem[]) => any) | null): Promise<GroupResponseItem[]>;
449
475
  private rateLimit;
450
476
  [Symbol.asyncIterator](): AsyncGenerator<GroupResponseItem, void, unknown>;
451
477
  all(): Promise<GroupResponseItem[]>;
@@ -490,4 +516,4 @@ declare class TimeIntervalGatewayAnalyticsBuilder extends GatewayAnalyticsBuilde
490
516
  all(): Promise<TimeIntervalGatewayAnalyticsResponse>;
491
517
  }
492
518
 
493
- export { type AuthTestResponse, type ContentType, type DataEndponts, type Endpoints, type FileObject, type GatewayAnalyticsQuery, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, type PinByCIDResponse, type PinJobItem, type PinJobQuery, type PinJobResponse, type PinListItem, type PinListQuery, type PinListResponse, type PinResponse, type PinataConfig, type PinataMetadata, type PinataMetadataUpdate, PinataSDK, type PinningEndpoints, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalGatewayAnalyticsQuery, type TimeIntervalGatewayAnalyticsResponse, type TimePeriodItem, type TopGatewayAnalyticsItem, type TopGatewayAnalyticsQuery, type UnpinResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UserPinnedDataResponse };
519
+ export { type AuthTestResponse, type ContainsCIDResponse, type ContentType, type DataEndponts, type Endpoints, type FileObject, type GatewayAnalyticsQuery, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, type OptimizeImageOptions, type PinByCIDResponse, type PinJobItem, type PinJobQuery, type PinJobResponse, type PinListItem, type PinListQuery, type PinListResponse, type PinResponse, type PinataConfig, type PinataMetadata, type PinataMetadataUpdate, PinataSDK, type PinningEndpoints, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalGatewayAnalyticsQuery, type TimeIntervalGatewayAnalyticsResponse, type TimePeriodItem, type TopGatewayAnalyticsItem, type TopGatewayAnalyticsQuery, type UnpinResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UserPinnedDataResponse };
package/dist/index.d.ts CHANGED
@@ -124,6 +124,19 @@ type GetCIDResponse = {
124
124
  data?: JSON | string | Blob | null;
125
125
  contentType: ContentType;
126
126
  };
127
+ type OptimizeImageOptions = {
128
+ width?: number;
129
+ height?: number;
130
+ dpr?: number;
131
+ fit?: "scaleDown" | "contain" | "cover" | "crop" | "pad";
132
+ gravity?: "auto" | "side" | string;
133
+ quality?: number;
134
+ format?: "auto" | "webp";
135
+ animation?: boolean;
136
+ sharpen?: number;
137
+ onError?: boolean;
138
+ metadata?: "keep" | "copyright" | "none";
139
+ };
127
140
  type GatewayAnalyticsQuery = {
128
141
  gateway_domain: string;
129
142
  start_date: string;
@@ -280,6 +293,10 @@ type SwapCidResponse = {
280
293
  mappedCid: string;
281
294
  createdAt: string;
282
295
  };
296
+ type ContainsCIDResponse = {
297
+ containsCid: boolean;
298
+ cid: string | null;
299
+ };
283
300
 
284
301
  declare class PinataSDK {
285
302
  config: PinataConfig | undefined;
@@ -352,8 +369,9 @@ declare class Gateways {
352
369
  config: PinataConfig | undefined;
353
370
  constructor(config?: PinataConfig);
354
371
  updateConfig(newConfig: PinataConfig): void;
355
- get(cid: string): Promise<GetCIDResponse>;
356
- convert(url: string): Promise<string>;
372
+ get(cid: string): OptimizeImage;
373
+ convert(url: string, gatewayPrefix?: string): Promise<string>;
374
+ containsCID(cid: string): Promise<ContainsCIDResponse>;
357
375
  topUsageAnalytics(options: {
358
376
  domain: string;
359
377
  start: string;
@@ -371,6 +389,14 @@ declare class Gateways {
371
389
  swapHistory(options: SwapHistoryOptions): Promise<SwapCidResponse[]>;
372
390
  deleteSwap(cid: string): Promise<string>;
373
391
  }
392
+ declare class OptimizeImage {
393
+ private config;
394
+ private cid;
395
+ private options;
396
+ constructor(config: PinataConfig | undefined, cid: string);
397
+ optimizeImage(options: OptimizeImageOptions): OptimizeImage;
398
+ then(onfulfilled?: ((value: GetCIDResponse) => any) | null): Promise<any>;
399
+ }
374
400
  declare class FilterPinJobs {
375
401
  private config;
376
402
  private query;
@@ -445,7 +471,7 @@ declare class FilterGroups {
445
471
  offset(offset: number): FilterGroups;
446
472
  name(nameContains: string): FilterGroups;
447
473
  limit(limit: number): FilterGroups;
448
- then(onfulfilled?: ((value: GroupResponseItem[]) => any) | null): Promise<any>;
474
+ then(onfulfilled?: ((value: GroupResponseItem[]) => any) | null): Promise<GroupResponseItem[]>;
449
475
  private rateLimit;
450
476
  [Symbol.asyncIterator](): AsyncGenerator<GroupResponseItem, void, unknown>;
451
477
  all(): Promise<GroupResponseItem[]>;
@@ -490,4 +516,4 @@ declare class TimeIntervalGatewayAnalyticsBuilder extends GatewayAnalyticsBuilde
490
516
  all(): Promise<TimeIntervalGatewayAnalyticsResponse>;
491
517
  }
492
518
 
493
- export { type AuthTestResponse, type ContentType, type DataEndponts, type Endpoints, type FileObject, type GatewayAnalyticsQuery, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, type PinByCIDResponse, type PinJobItem, type PinJobQuery, type PinJobResponse, type PinListItem, type PinListQuery, type PinListResponse, type PinResponse, type PinataConfig, type PinataMetadata, type PinataMetadataUpdate, PinataSDK, type PinningEndpoints, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalGatewayAnalyticsQuery, type TimeIntervalGatewayAnalyticsResponse, type TimePeriodItem, type TopGatewayAnalyticsItem, type TopGatewayAnalyticsQuery, type UnpinResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UserPinnedDataResponse };
519
+ export { type AuthTestResponse, type ContainsCIDResponse, type ContentType, type DataEndponts, type Endpoints, type FileObject, type GatewayAnalyticsQuery, type GetCIDResponse, type GetGroupOptions, type GroupCIDOptions, type GroupOptions, type GroupQueryOptions, type GroupResponseItem, type JsonBody, type KeyListItem, type KeyListQuery, type KeyListResponse, type KeyOptions, type KeyPermissions, type KeyResponse, type OptimizeImageOptions, type PinByCIDResponse, type PinJobItem, type PinJobQuery, type PinJobResponse, type PinListItem, type PinListQuery, type PinListResponse, type PinResponse, type PinataConfig, type PinataMetadata, type PinataMetadataUpdate, PinataSDK, type PinningEndpoints, type RevokeKeyResponse, type SignatureOptions, type SignatureResponse, type SwapCidOptions, type SwapCidResponse, type SwapHistoryOptions, type TimeIntervalGatewayAnalyticsQuery, type TimeIntervalGatewayAnalyticsResponse, type TimePeriodItem, type TopGatewayAnalyticsItem, type TopGatewayAnalyticsQuery, type UnpinResponse, type UpdateGroupOptions, type UploadCIDOptions, type UploadOptions, type UserPinnedDataResponse };