Skip to content

Commit 803d295

Browse files
committed
feat(store): accept a custom StoreFileMeta as generic argument on fileCreateOrUpdate
1 parent 187f083 commit 803d295

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎packages/store/src/file.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export const STORE_FILE_IMAGE_TYPES = [
5454
* in a high-throughput scenario you may want to schedule a job which calls
5555
* {@link fileTransformInPlace} instead of passing this option directly.
5656
*
57+
* @template {import("./generated/common/types.d.ts").StoreFileMetaInput} T
58+
*
5759
* @param {import("postgres").Sql} sql
5860
* @param {import("@aws-sdk/client-s3").S3Client} s3Client
5961
* @param {{
@@ -62,8 +64,10 @@ export const STORE_FILE_IMAGE_TYPES = [
6264
* schedulePlaceholderImageJob?: boolean,
6365
* fileTransformInPlaceOptions?: FileTransformInPlaceOptions,
6466
* }} options
65-
* @param {Partial<import("./generated/common/types.d.ts").StoreFile> & Pick<import("./generated/common/types.d.ts").StoreFile,
66-
* "name">} props
67+
* @param {Omit<Partial<import("./generated/common/types.d.ts").StoreFile>, "name"|"meta"> & {
68+
* name: string;
69+
* meta: T;
70+
* }} props
6771
* @param {import("stream").Readable|string|Buffer} source
6872
* @returns {Promise<import("./generated/common/types.d.ts").StoreFile>}
6973
*/
@@ -103,6 +107,7 @@ export async function fileCreateOrUpdate(
103107
}
104108

105109
props.bucketName = options.bucketName;
110+
// @ts-expect-error this is fine!
106111
props.meta = props.meta ?? {};
107112

108113
if (typeof source === "string") {

0 commit comments

Comments
 (0)