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