next-tinacms-dos 1.1.2 → 1.2.0
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/dos-media-store.d.ts +0 -1
- package/dist/handlers.js +5 -3
- package/dist/index.es.js +54878 -21
- package/dist/index.js +54880 -23
- package/package.json +4 -4
|
@@ -8,7 +8,6 @@ export declare class DOSMediaStore implements MediaStore {
|
|
|
8
8
|
persist(media: MediaUploadOptions[]): Promise<Media[]>;
|
|
9
9
|
delete(media: Media): Promise<void>;
|
|
10
10
|
list(options: MediaListOptions): Promise<MediaList>;
|
|
11
|
-
previewSrc: (publicId: string | Media) => string;
|
|
12
11
|
parse: (img: any) => any;
|
|
13
12
|
private buildQuery;
|
|
14
13
|
}
|
package/dist/handlers.js
CHANGED
|
@@ -96,13 +96,14 @@ async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
|
96
96
|
};
|
|
97
97
|
const command = new import_client_s3.PutObjectCommand(params);
|
|
98
98
|
try {
|
|
99
|
+
const src = cdnUrl + prefix + filename;
|
|
99
100
|
await client.send(command);
|
|
100
101
|
res.json({
|
|
101
102
|
type: "file",
|
|
102
103
|
id: prefix + filename,
|
|
103
104
|
filename,
|
|
104
105
|
directory: prefix,
|
|
105
|
-
|
|
106
|
+
thumbnail: src,
|
|
106
107
|
src: cdnUrl + (mediaRoot ? import_path.default.join(mediaRoot, prefix + filename) : prefix + filename)
|
|
107
108
|
});
|
|
108
109
|
} catch (e) {
|
|
@@ -201,12 +202,13 @@ function getDOSToTinaFunc(cdnUrl, mediaRoot) {
|
|
|
201
202
|
const strippedKey = stripMediaRoot(mediaRoot, file.Key);
|
|
202
203
|
const filename = import_path.default.basename(strippedKey);
|
|
203
204
|
const directory = import_path.default.dirname(strippedKey) + "/";
|
|
205
|
+
const src = cdnUrl + file.Key;
|
|
204
206
|
return {
|
|
205
207
|
id: file.Key,
|
|
206
208
|
filename,
|
|
207
209
|
directory,
|
|
208
|
-
src
|
|
209
|
-
|
|
210
|
+
src,
|
|
211
|
+
thumbnail: src,
|
|
210
212
|
type: "file"
|
|
211
213
|
};
|
|
212
214
|
};
|