pinata 2.4.7 → 2.4.8
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.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2529,13 +2529,13 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2529
2529
|
const name = options?.metadata?.name || file.name || "File from SDK";
|
|
2530
2530
|
let metadata = `filename ${btoa(name)},filetype ${btoa(file.type)},network ${btoa(network)}`;
|
|
2531
2531
|
if (options?.groupId) {
|
|
2532
|
-
metadata
|
|
2532
|
+
metadata += `,group_id ${btoa(options.groupId)}`;
|
|
2533
2533
|
}
|
|
2534
2534
|
if (options?.metadata?.keyvalues) {
|
|
2535
|
-
metadata
|
|
2535
|
+
metadata += `,keyvalues ${btoa(JSON.stringify(options.metadata.keyvalues))}`;
|
|
2536
2536
|
}
|
|
2537
2537
|
if (options?.streamable) {
|
|
2538
|
-
metadata
|
|
2538
|
+
metadata += `,streamable ${btoa("true")}`;
|
|
2539
2539
|
}
|
|
2540
2540
|
let updatedEndpoint = `${endpoint}/files`;
|
|
2541
2541
|
if (options?.url) {
|
|
@@ -2611,6 +2611,22 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2611
2611
|
}
|
|
2612
2612
|
if (uploadReq.status === 204) {
|
|
2613
2613
|
const cid = uploadReq.headers.get("upload-cid");
|
|
2614
|
+
if (!config.pinataJwt) {
|
|
2615
|
+
const data3 = {
|
|
2616
|
+
id: "",
|
|
2617
|
+
name: "",
|
|
2618
|
+
cid,
|
|
2619
|
+
size: file.size,
|
|
2620
|
+
created_at: "",
|
|
2621
|
+
number_of_files: 1,
|
|
2622
|
+
group_id: null,
|
|
2623
|
+
mime_type: "",
|
|
2624
|
+
keyvalues: {},
|
|
2625
|
+
vectorized: false,
|
|
2626
|
+
network: ""
|
|
2627
|
+
};
|
|
2628
|
+
return data3;
|
|
2629
|
+
}
|
|
2614
2630
|
let dataEndpoint;
|
|
2615
2631
|
if (config.endpointUrl) {
|
|
2616
2632
|
dataEndpoint = config.endpointUrl;
|