@instantdb/components 0.22.111-experimental.client-file-deletes.21303729889.1 → 0.22.111-experimental.drewh-clief.21301179372.1
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.22.111-experimental.
|
|
4
|
+
"version": "0.22.111-experimental.drewh-clief.21301179372.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Instant's UI components",
|
|
7
7
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/components",
|
|
@@ -93,11 +93,11 @@
|
|
|
93
93
|
"swr": "^2.2.4",
|
|
94
94
|
"tailwind-merge": "^2.2.1",
|
|
95
95
|
"uuid": "^11.1.0",
|
|
96
|
-
"@instantdb/admin": "0.22.111-experimental.
|
|
97
|
-
"@instantdb/core": "0.22.111-experimental.
|
|
98
|
-
"@instantdb/
|
|
99
|
-
"@instantdb/
|
|
100
|
-
"@instantdb/
|
|
96
|
+
"@instantdb/admin": "0.22.111-experimental.drewh-clief.21301179372.1",
|
|
97
|
+
"@instantdb/core": "0.22.111-experimental.drewh-clief.21301179372.1",
|
|
98
|
+
"@instantdb/react": "0.22.111-experimental.drewh-clief.21301179372.1",
|
|
99
|
+
"@instantdb/platform": "0.22.111-experimental.drewh-clief.21301179372.1",
|
|
100
|
+
"@instantdb/version": "0.22.111-experimental.drewh-clief.21301179372.1"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -867,11 +867,23 @@ export const InnerExplorer: React.FC<{
|
|
|
867
867
|
}
|
|
868
868
|
onClick={async () => {
|
|
869
869
|
try {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
870
|
+
if (selectedNamespace.name === '$files') {
|
|
871
|
+
const filenames = allItems
|
|
872
|
+
.filter((i) => i.id in checkedIds)
|
|
873
|
+
.map((i) => i.path as string);
|
|
874
|
+
await bulkDeleteFiles(
|
|
875
|
+
explorerProps.adminToken,
|
|
876
|
+
explorerProps.appId,
|
|
877
|
+
filenames,
|
|
878
|
+
explorerProps.apiURI,
|
|
879
|
+
);
|
|
880
|
+
} else {
|
|
881
|
+
await db.transact(
|
|
882
|
+
Object.keys(checkedIds).map((id) =>
|
|
883
|
+
tx[selectedNamespace.name][id].delete(),
|
|
884
|
+
),
|
|
885
|
+
);
|
|
886
|
+
}
|
|
875
887
|
} catch (error: any) {
|
|
876
888
|
const errorMessage = error.message;
|
|
877
889
|
errorToast(
|
|
@@ -1471,3 +1483,24 @@ async function upload(
|
|
|
1471
1483
|
|
|
1472
1484
|
return data;
|
|
1473
1485
|
}
|
|
1486
|
+
|
|
1487
|
+
async function bulkDeleteFiles(
|
|
1488
|
+
token: string,
|
|
1489
|
+
appId: string,
|
|
1490
|
+
filenames: string[],
|
|
1491
|
+
apiUri: string,
|
|
1492
|
+
): Promise<any> {
|
|
1493
|
+
const { data } = await jsonFetch(
|
|
1494
|
+
`${apiUri}/dash/apps/${appId}/storage/files/delete`,
|
|
1495
|
+
{
|
|
1496
|
+
method: 'POST',
|
|
1497
|
+
headers: {
|
|
1498
|
+
'content-type': 'application/json',
|
|
1499
|
+
authorization: `Bearer ${token}`,
|
|
1500
|
+
},
|
|
1501
|
+
body: JSON.stringify({ filenames }),
|
|
1502
|
+
},
|
|
1503
|
+
);
|
|
1504
|
+
|
|
1505
|
+
return data;
|
|
1506
|
+
}
|