next-tinacms-cloudinary 0.0.0-ea9b54c-20241003003029 → 0.0.0-eaa6ed5-20250729073245
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/README.md +1 -1
- package/dist/handlers.js +11 -11
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ Call `createMediaHandler` to set up routes and connect your instance of the Medi
|
|
|
92
92
|
|
|
93
93
|
Import `isAuthorized` from [`@tinacms/auth`](https://github.com/tinacms/tinacms/tree/main/packages/%40tinacms/auth).
|
|
94
94
|
|
|
95
|
-
The `authorized` key will make it so only authorized users within
|
|
95
|
+
The `authorized` key will make it so only authorized users within TinaCloud can upload and make media edits.
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
```
|
package/dist/handlers.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -62,6 +66,7 @@ async function uploadMedia(req, res) {
|
|
|
62
66
|
const upload = (0, import_util.promisify)(
|
|
63
67
|
(0, import_multer.default)({
|
|
64
68
|
storage: import_multer.default.diskStorage({
|
|
69
|
+
// @ts-ignore
|
|
65
70
|
directory: (req2, file, cb) => {
|
|
66
71
|
cb(null, "/tmp");
|
|
67
72
|
},
|
|
@@ -86,7 +91,6 @@ async function uploadMedia(req, res) {
|
|
|
86
91
|
}
|
|
87
92
|
}
|
|
88
93
|
async function listMedia(req, res, opts) {
|
|
89
|
-
var _a;
|
|
90
94
|
try {
|
|
91
95
|
const mediaListOptions = {
|
|
92
96
|
directory: req.query.directory || '""',
|
|
@@ -117,14 +121,14 @@ async function listMedia(req, res, opts) {
|
|
|
117
121
|
try {
|
|
118
122
|
folderRes = await import_cloudinary.v2.api.folders(mediaListOptions.directory);
|
|
119
123
|
} catch (e) {
|
|
120
|
-
if (
|
|
124
|
+
if (e.error?.message.startsWith("Can't find folder with path")) {
|
|
121
125
|
} else {
|
|
122
126
|
console.error("Error getting folders");
|
|
123
127
|
console.error(e);
|
|
124
128
|
throw e;
|
|
125
129
|
}
|
|
126
130
|
}
|
|
127
|
-
if (folderRes
|
|
131
|
+
if (folderRes?.folders) {
|
|
128
132
|
folders = folderRes.folders.map(function(folder) {
|
|
129
133
|
"empty-repo/004";
|
|
130
134
|
return {
|
|
@@ -147,20 +151,16 @@ async function listMedia(req, res, opts) {
|
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
var findErrorMessage = (e) => {
|
|
150
|
-
if (typeof e == "string")
|
|
151
|
-
|
|
152
|
-
if (e.message)
|
|
153
|
-
return e.message;
|
|
154
|
-
if (e.error && e.error.message)
|
|
155
|
-
return e.error.message;
|
|
154
|
+
if (typeof e == "string") return e;
|
|
155
|
+
if (e.message) return e.message;
|
|
156
|
+
if (e.error && e.error.message) return e.error.message;
|
|
156
157
|
return "an error occurred";
|
|
157
158
|
};
|
|
158
159
|
async function deleteAsset(req, res) {
|
|
159
160
|
const { media } = req.query;
|
|
160
161
|
const [, public_id] = media;
|
|
161
162
|
import_cloudinary.v2.uploader.destroy(public_id, {}, (err) => {
|
|
162
|
-
if (err)
|
|
163
|
-
res.status(500);
|
|
163
|
+
if (err) res.status(500);
|
|
164
164
|
res.json({
|
|
165
165
|
err,
|
|
166
166
|
public_id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-tinacms-cloudinary",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-eaa6ed5-20250729073245",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/crypto-js": "^3.1.47",
|
|
26
26
|
"@types/js-cookie": "^2.2.7",
|
|
27
|
-
"@types/node": "^22.
|
|
27
|
+
"@types/node": "^22.13.1",
|
|
28
28
|
"next": "14.2.10",
|
|
29
29
|
"react": "^18.3.1",
|
|
30
30
|
"react-dom": "^18.3.1",
|
|
31
|
-
"typescript": "^5.
|
|
32
|
-
"@tinacms/scripts": "1.
|
|
33
|
-
"tinacms": "0.0.0-
|
|
31
|
+
"typescript": "^5.7.3",
|
|
32
|
+
"@tinacms/scripts": "1.4.0",
|
|
33
|
+
"tinacms": "0.0.0-eaa6ed5-20250729073245"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"tinacms": "0.0.0-
|
|
36
|
+
"tinacms": "0.0.0-eaa6ed5-20250729073245"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"registry": "https://registry.npmjs.org"
|