pinata 2.5.3 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +1 -1
- package/dist/{gateway-tools-C0QGU-4p.d.mts → gateway-tools-C-tdEyF2.d.mts} +8 -0
- package/dist/{gateway-tools-C0QGU-4p.d.ts → gateway-tools-C-tdEyF2.d.ts} +8 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/package.json +63 -69
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -14,6 +14,10 @@ type UpdateFileOptions = {
|
|
|
14
14
|
id: string;
|
|
15
15
|
name?: string;
|
|
16
16
|
keyvalues?: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Unix timestamp (in seconds) when the file should expire (must be in the future)
|
|
19
|
+
*/
|
|
20
|
+
expires_at?: number;
|
|
17
21
|
};
|
|
18
22
|
type DeleteResponse = {
|
|
19
23
|
id: string;
|
|
@@ -162,6 +166,10 @@ type UploadOptions = {
|
|
|
162
166
|
* CID version "v1" or "v0" (defaults to v1 if falsy)
|
|
163
167
|
*/
|
|
164
168
|
cid_version?: CidVersion;
|
|
169
|
+
/**
|
|
170
|
+
* Unix timestamp (in seconds) when the file should expire (must be in the future)
|
|
171
|
+
*/
|
|
172
|
+
expires_at?: number;
|
|
165
173
|
};
|
|
166
174
|
type SignedUploadUrlOptions = {
|
|
167
175
|
date?: number;
|
|
@@ -14,6 +14,10 @@ type UpdateFileOptions = {
|
|
|
14
14
|
id: string;
|
|
15
15
|
name?: string;
|
|
16
16
|
keyvalues?: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Unix timestamp (in seconds) when the file should expire (must be in the future)
|
|
19
|
+
*/
|
|
20
|
+
expires_at?: number;
|
|
17
21
|
};
|
|
18
22
|
type DeleteResponse = {
|
|
19
23
|
id: string;
|
|
@@ -162,6 +166,10 @@ type UploadOptions = {
|
|
|
162
166
|
* CID version "v1" or "v0" (defaults to v1 if falsy)
|
|
163
167
|
*/
|
|
164
168
|
cid_version?: CidVersion;
|
|
169
|
+
/**
|
|
170
|
+
* Unix timestamp (in seconds) when the file should expire (must be in the future)
|
|
171
|
+
*/
|
|
172
|
+
expires_at?: number;
|
|
165
173
|
};
|
|
166
174
|
type SignedUploadUrlOptions = {
|
|
167
175
|
date?: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem, C as CidVersion } from './gateway-tools-
|
|
2
|
-
export { t as AuthenticationError, r as ContainsCIDResponse, q as ContentType, n as FileObject, N as NetworkError, s as PinataError, o as PinataMetadata, u as ValidationError, p as VectorQueryMatch, v as containsCID, w as convertToDesiredGateway } from './gateway-tools-
|
|
1
|
+
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem, C as CidVersion } from './gateway-tools-C-tdEyF2.mjs';
|
|
2
|
+
export { t as AuthenticationError, r as ContainsCIDResponse, q as ContentType, n as FileObject, N as NetworkError, s as PinataError, o as PinataMetadata, u as ValidationError, p as VectorQueryMatch, v as containsCID, w as convertToDesiredGateway } from './gateway-tools-C-tdEyF2.mjs';
|
|
3
3
|
|
|
4
4
|
type PinataConfig = {
|
|
5
5
|
pinataJwt?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem, C as CidVersion } from './gateway-tools-
|
|
2
|
-
export { t as AuthenticationError, r as ContainsCIDResponse, q as ContentType, n as FileObject, N as NetworkError, s as PinataError, o as PinataMetadata, u as ValidationError, p as VectorQueryMatch, v as containsCID, w as convertToDesiredGateway } from './gateway-tools-
|
|
1
|
+
import { D as DeleteResponse, V as VectorizeFileResponse, F as FileListQuery, a as FileListResponse, S as SwapCidOptions, b as SwapCidResponse, c as SwapHistoryOptions, U as UpdateFileOptions, d as FileListItem, e as VectorizeQuery, f as VectorizeQueryResponse, G as GetCIDResponse, P as PinQueueQuery, g as PinQueueResponse, O as OptimizeImageOptions, A as AccessLinkOptions, h as UploadOptions, i as UploadResponse, j as SignedUploadUrlOptions, J as JsonBody, k as UploadCIDOptions, l as PinByCIDResponse, m as PinQueueItem, C as CidVersion } from './gateway-tools-C-tdEyF2.js';
|
|
2
|
+
export { t as AuthenticationError, r as ContainsCIDResponse, q as ContentType, n as FileObject, N as NetworkError, s as PinataError, o as PinataMetadata, u as ValidationError, p as VectorQueryMatch, v as containsCID, w as convertToDesiredGateway } from './gateway-tools-C-tdEyF2.js';
|
|
3
3
|
|
|
4
4
|
type PinataConfig = {
|
|
5
5
|
pinataJwt?: string;
|
package/dist/index.js
CHANGED
|
@@ -885,9 +885,9 @@ var updateFile = async (config, options, privacy) => {
|
|
|
885
885
|
if (!config) {
|
|
886
886
|
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
887
887
|
}
|
|
888
|
-
if (!options.name && (!options.keyvalues || Object.keys(options.keyvalues).length === 0)) {
|
|
888
|
+
if (!options.name && (!options.keyvalues || Object.keys(options.keyvalues).length === 0) && options.expires_at === void 0) {
|
|
889
889
|
throw new chunkBK3CLF3Z_js.ValidationError(
|
|
890
|
-
"At least one of 'name' or '
|
|
890
|
+
"At least one of 'name', 'keyvalues', or 'expires_at' must be provided"
|
|
891
891
|
);
|
|
892
892
|
}
|
|
893
893
|
const data = {};
|
|
@@ -897,6 +897,9 @@ var updateFile = async (config, options, privacy) => {
|
|
|
897
897
|
if (options.keyvalues && Object.keys(options.keyvalues).length > 0) {
|
|
898
898
|
data.keyvalues = options.keyvalues;
|
|
899
899
|
}
|
|
900
|
+
if (options.expires_at !== void 0) {
|
|
901
|
+
data.expires_at = options.expires_at;
|
|
902
|
+
}
|
|
900
903
|
const body = JSON.stringify(data);
|
|
901
904
|
let headers;
|
|
902
905
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -2559,6 +2562,9 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2559
2562
|
if (options?.cid_version !== void 0) {
|
|
2560
2563
|
metadata += `,cid_version ${btoa(options.cid_version)}`;
|
|
2561
2564
|
}
|
|
2565
|
+
if (options?.expires_at !== void 0) {
|
|
2566
|
+
metadata += `,expires_at ${btoa(options.expires_at.toString())}`;
|
|
2567
|
+
}
|
|
2562
2568
|
let updatedEndpoint = `${endpoint}/files`;
|
|
2563
2569
|
if (options?.url) {
|
|
2564
2570
|
updatedEndpoint = options.url;
|
|
@@ -2735,6 +2741,9 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2735
2741
|
if (options?.cid_version !== void 0) {
|
|
2736
2742
|
data.append("cid_version", options.cid_version.toString());
|
|
2737
2743
|
}
|
|
2744
|
+
if (options?.expires_at !== void 0) {
|
|
2745
|
+
data.append("expires_at", options.expires_at.toString());
|
|
2746
|
+
}
|
|
2738
2747
|
if (options?.url) {
|
|
2739
2748
|
try {
|
|
2740
2749
|
const url = new URL(options.url);
|