@cedarjs/storage 2.8.1-next.109 → 2.8.1-rc.3
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/cjs/createSavers.d.ts +2 -2
- package/dist/cjs/createSavers.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +10 -10
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/prismaExtension.d.ts +10 -9
- package/dist/cjs/prismaExtension.d.ts.map +1 -1
- package/dist/createSavers.d.ts +2 -2
- package/dist/createSavers.d.ts.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/prismaExtension.d.ts +10 -9
- package/dist/prismaExtension.d.ts.map +1 -1
- package/package.json +6 -10
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { SaveOptionsOverride, BaseStorageAdapter } from './adapters/BaseStorageAdapter.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelNames, UploadsConfig } from './prismaExtension.js';
|
|
3
3
|
type MakeFilesString<T> = {
|
|
4
4
|
[K in keyof T]: T[K] extends File ? string : T[K];
|
|
5
5
|
};
|
|
6
6
|
export declare const createFileListSaver: (storage: BaseStorageAdapter) => (files?: File[], pathOverrideOnly?: {
|
|
7
7
|
path?: string;
|
|
8
8
|
}) => Promise<string[]>;
|
|
9
|
-
export declare const createUploadSavers: <
|
|
9
|
+
export declare const createUploadSavers: <MNames extends ModelNames = ModelNames>(uploadConfig: UploadsConfig<MNames>, storage: BaseStorageAdapter) => { [K in `for${Capitalize<MNames>}`]: <T extends Record<string, any>>(data: T, overrideSaveOptions?: SaveOptionsOverride) => Promise<MakeFilesString<T>>; } & {
|
|
10
10
|
inList: (files?: File[], pathOverrideOnly?: {
|
|
11
11
|
path?: string;
|
|
12
12
|
}) => Promise<string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSavers.d.ts","sourceRoot":"","sources":["../../src/createSavers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createSavers.d.ts","sourceRoot":"","sources":["../../src/createSavers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGrE,KAAK,eAAe,CAAC,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CAClD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,SAAS,kBAAkB,MAC/C,QAAO,IAAI,EAAO,EAAE,mBAAmB;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,sBAUvE,CAAA;AAMD,eAAO,MAAM,kBAAkB,GAAI,MAAM,SAAS,UAAU,GAAG,UAAU,EACvE,cAAc,aAAa,CAAC,MAAM,CAAC,EACnC,SAAS,kBAAkB,QAMxB,CAAC,kCAAwB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAC/C,CAAC,wBACe,mBAAmB,KACtC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;qBA3Bb,IAAI,EAAE,qBAA0B;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CA2EvE,CAAA"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BaseStorageAdapter } from './adapters/BaseStorageAdapter.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelNames, UploadConfigForModel, UploadsConfig } from './prismaExtension.js';
|
|
3
3
|
import type { UrlSigner } from './UrlSigner.js';
|
|
4
|
-
type SetupStorageOptions<
|
|
5
|
-
uploadsConfig: UploadsConfig<
|
|
4
|
+
type SetupStorageOptions<MNames extends ModelNames> = {
|
|
5
|
+
uploadsConfig: UploadsConfig<MNames>;
|
|
6
6
|
storageAdapter: BaseStorageAdapter;
|
|
7
7
|
urlSigner?: UrlSigner;
|
|
8
8
|
};
|
|
9
|
-
export declare const setupStorage: <
|
|
10
|
-
storagePrismaExtension: (client: any) => import("@prisma/client/extension").PrismaClientExtends<import("@prisma/client/runtime/
|
|
9
|
+
export declare const setupStorage: <MNames extends ModelNames>({ uploadsConfig, storageAdapter, urlSigner, }: SetupStorageOptions<MNames>) => {
|
|
10
|
+
storagePrismaExtension: (client: any) => import("@prisma/client/extension").PrismaClientExtends<import("@prisma/client/runtime/library").InternalArgs<{ [K in MNames]: {
|
|
11
11
|
withDataUri: {
|
|
12
12
|
needs: Record<string, boolean>;
|
|
13
13
|
compute: (modelData: Record<string, unknown>) => <T>(this: T) => Promise<T>;
|
|
@@ -18,8 +18,8 @@ export declare const setupStorage: <TClient, MNames extends ModelNamesFor<TClien
|
|
|
18
18
|
expiresIn?: number;
|
|
19
19
|
}) => T;
|
|
20
20
|
};
|
|
21
|
-
}; }, {}, {}, {}> & import("@prisma/client/runtime/
|
|
22
|
-
saveFiles: { [K in `for${Capitalize<
|
|
21
|
+
}; }, {}, {}, {}> & import("@prisma/client/runtime/library").DefaultArgs>;
|
|
22
|
+
saveFiles: { [K in `for${Capitalize<MNames>}`]: <T extends Record<string, any>>(data: T, overrideSaveOptions?: import("./adapters/BaseStorageAdapter.js").SaveOptionsOverride) => Promise<{ [K_2 in keyof T]: T[K_2] extends File ? string : T[K_2]; }>; } & {
|
|
23
23
|
inList: (files?: File[], pathOverrideOnly?: {
|
|
24
24
|
path?: string;
|
|
25
25
|
}) => Promise<string[]>;
|
|
@@ -33,8 +33,8 @@ export declare const setupStorage: <TClient, MNames extends ModelNamesFor<TClien
|
|
|
33
33
|
* @param uploadsConfig The uploads configuration object.
|
|
34
34
|
* @returns The same uploads configuration object, but with filtered types
|
|
35
35
|
*/
|
|
36
|
-
export declare function createUploadsConfig<
|
|
37
|
-
[K in
|
|
36
|
+
export declare function createUploadsConfig<T extends Partial<{
|
|
37
|
+
[K in ModelNames]?: UploadConfigForModel<K>;
|
|
38
38
|
}>>(uploadsConfig: T): T;
|
|
39
|
-
export type {
|
|
39
|
+
export type { ModelNames, UploadsConfig } from './prismaExtension.js';
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAE1E,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAE1E,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACd,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,KAAK,mBAAmB,CAAC,MAAM,SAAS,UAAU,IAAI;IACpD,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACpC,cAAc,EAAE,kBAAkB,CAAA;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,UAAU,EAAE,+CAIrD,mBAAmB,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;gBARV,CAAC;;;CAqBpB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,SAAS,OAAO,CAAC;KACf,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;CAC5C,CAAC,EACF,aAAa,EAAE,CAAC,GAAG,CAAC,CAErB;AAED,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PrismaClient } from '@prisma/client';
|
|
2
|
+
import type { Prisma } from '@prisma/client';
|
|
2
3
|
import type { BaseStorageAdapter } from './adapters/BaseStorageAdapter.js';
|
|
3
4
|
import type { UrlSigner } from './UrlSigner.js';
|
|
4
5
|
type FilterOutDollarPrefixed<T> = T extends `$${string}` ? never : T extends symbol ? never : T;
|
|
5
|
-
export type
|
|
6
|
-
type PrismaModelFields<
|
|
7
|
-
export type UploadConfigForModel<
|
|
8
|
-
fields: PrismaModelFields<
|
|
6
|
+
export type ModelNames = FilterOutDollarPrefixed<keyof PrismaClient>;
|
|
7
|
+
type PrismaModelFields<MName extends ModelNames> = keyof Prisma.Result<PrismaClient[MName], any, 'findFirstOrThrow'>;
|
|
8
|
+
export type UploadConfigForModel<TPrismaModelName extends ModelNames> = {
|
|
9
|
+
fields: PrismaModelFields<TPrismaModelName> | PrismaModelFields<TPrismaModelName>[];
|
|
9
10
|
};
|
|
10
|
-
export type UploadsConfig<
|
|
11
|
-
[K in MNames]?: UploadConfigForModel<
|
|
11
|
+
export type UploadsConfig<MNames extends ModelNames = ModelNames> = {
|
|
12
|
+
[K in MNames]?: UploadConfigForModel<K>;
|
|
12
13
|
};
|
|
13
14
|
type WithSignedUrlArgs = {
|
|
14
15
|
expiresIn?: number;
|
|
15
16
|
};
|
|
16
|
-
export declare const createUploadsExtension: <
|
|
17
|
+
export declare const createUploadsExtension: <MNames extends ModelNames = ModelNames>(config: UploadsConfig<MNames>, storageAdapter: BaseStorageAdapter, urlSigner?: UrlSigner) => (client: any) => import("@prisma/client/extension").PrismaClientExtends<import("@prisma/client/runtime/library").InternalArgs<{ [K in MNames]: {
|
|
17
18
|
withDataUri: {
|
|
18
19
|
needs: Record<string, boolean>;
|
|
19
20
|
compute: (modelData: Record<string, unknown>) => <T>(this: T) => Promise<T>;
|
|
@@ -22,6 +23,6 @@ export declare const createUploadsExtension: <TClient, MNames extends ModelNames
|
|
|
22
23
|
needs: Record<string, boolean>;
|
|
23
24
|
compute: (modelData: Record<string, unknown>) => <T>(this: T, signArgs?: WithSignedUrlArgs) => T;
|
|
24
25
|
};
|
|
25
|
-
}; }, {}, {}, {}> & import("@prisma/client/runtime/
|
|
26
|
+
}; }, {}, {}, {}> & import("@prisma/client/runtime/library").DefaultArgs>;
|
|
26
27
|
export {};
|
|
27
28
|
//# sourceMappingURL=prismaExtension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prismaExtension.d.ts","sourceRoot":"","sources":["../../src/prismaExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prismaExtension.d.ts","sourceRoot":"","sources":["../../src/prismaExtension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAG5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,KAAK,uBAAuB,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,EAAE,GACpD,KAAK,GACL,CAAC,SAAS,MAAM,GACd,KAAK,GACL,CAAC,CAAA;AAGP,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC,MAAM,YAAY,CAAC,CAAA;AAEpE,KAAK,iBAAiB,CAAC,KAAK,SAAS,UAAU,IAAI,MAAM,MAAM,CAAC,MAAM,CACpE,YAAY,CAAC,KAAK,CAAC,EACnB,GAAG,EACH,kBAAkB,CACnB,CAAA;AAED,MAAM,MAAM,oBAAoB,CAAC,gBAAgB,SAAS,UAAU,IAAI;IACtE,MAAM,EACF,iBAAiB,CAAC,gBAAgB,CAAC,GACnC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,IAAI;KACjE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;CACxC,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,MAAM,SAAS,UAAU,GAAG,UAAU,EAC3E,QAAQ,aAAa,CAAC,MAAM,CAAC,EAC7B,gBAAgB,kBAAkB,EAClC,YAAY,SAAS,sIAGlB,CAAC;iBACa;QACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9B,OAAO,EAAE,CACP,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;KAChC;mBACc;QACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9B,OAAO,EAAE,CACP,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,iBAAiB,KAAK,CAAC,CAAA;KACrD;yEAoRN,CAAA"}
|
package/dist/createSavers.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { SaveOptionsOverride, BaseStorageAdapter } from './adapters/BaseStorageAdapter.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelNames, UploadsConfig } from './prismaExtension.js';
|
|
3
3
|
type MakeFilesString<T> = {
|
|
4
4
|
[K in keyof T]: T[K] extends File ? string : T[K];
|
|
5
5
|
};
|
|
6
6
|
export declare const createFileListSaver: (storage: BaseStorageAdapter) => (files?: File[], pathOverrideOnly?: {
|
|
7
7
|
path?: string;
|
|
8
8
|
}) => Promise<string[]>;
|
|
9
|
-
export declare const createUploadSavers: <
|
|
9
|
+
export declare const createUploadSavers: <MNames extends ModelNames = ModelNames>(uploadConfig: UploadsConfig<MNames>, storage: BaseStorageAdapter) => { [K in `for${Capitalize<MNames>}`]: <T extends Record<string, any>>(data: T, overrideSaveOptions?: SaveOptionsOverride) => Promise<MakeFilesString<T>>; } & {
|
|
10
10
|
inList: (files?: File[], pathOverrideOnly?: {
|
|
11
11
|
path?: string;
|
|
12
12
|
}) => Promise<string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSavers.d.ts","sourceRoot":"","sources":["../src/createSavers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createSavers.d.ts","sourceRoot":"","sources":["../src/createSavers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGrE,KAAK,eAAe,CAAC,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CAClD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,SAAS,kBAAkB,MAC/C,QAAO,IAAI,EAAO,EAAE,mBAAmB;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,sBAUvE,CAAA;AAMD,eAAO,MAAM,kBAAkB,GAAI,MAAM,SAAS,UAAU,GAAG,UAAU,EACvE,cAAc,aAAa,CAAC,MAAM,CAAC,EACnC,SAAS,kBAAkB,QAMxB,CAAC,kCAAwB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAC/C,CAAC,wBACe,mBAAmB,KACtC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;qBA3Bb,IAAI,EAAE,qBAA0B;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CA2EvE,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BaseStorageAdapter } from './adapters/BaseStorageAdapter.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelNames, UploadConfigForModel, UploadsConfig } from './prismaExtension.js';
|
|
3
3
|
import type { UrlSigner } from './UrlSigner.js';
|
|
4
|
-
type SetupStorageOptions<
|
|
5
|
-
uploadsConfig: UploadsConfig<
|
|
4
|
+
type SetupStorageOptions<MNames extends ModelNames> = {
|
|
5
|
+
uploadsConfig: UploadsConfig<MNames>;
|
|
6
6
|
storageAdapter: BaseStorageAdapter;
|
|
7
7
|
urlSigner?: UrlSigner;
|
|
8
8
|
};
|
|
9
|
-
export declare const setupStorage: <
|
|
10
|
-
storagePrismaExtension: (client: any) => import("@prisma/client/extension").PrismaClientExtends<import("@prisma/client/runtime/
|
|
9
|
+
export declare const setupStorage: <MNames extends ModelNames>({ uploadsConfig, storageAdapter, urlSigner, }: SetupStorageOptions<MNames>) => {
|
|
10
|
+
storagePrismaExtension: (client: any) => import("@prisma/client/extension").PrismaClientExtends<import("@prisma/client/runtime/library").InternalArgs<{ [K in MNames]: {
|
|
11
11
|
withDataUri: {
|
|
12
12
|
needs: Record<string, boolean>;
|
|
13
13
|
compute: (modelData: Record<string, unknown>) => <T>(this: T) => Promise<T>;
|
|
@@ -18,8 +18,8 @@ export declare const setupStorage: <TClient, MNames extends ModelNamesFor<TClien
|
|
|
18
18
|
expiresIn?: number;
|
|
19
19
|
}) => T;
|
|
20
20
|
};
|
|
21
|
-
}; }, {}, {}, {}> & import("@prisma/client/runtime/
|
|
22
|
-
saveFiles: { [K in `for${Capitalize<
|
|
21
|
+
}; }, {}, {}, {}> & import("@prisma/client/runtime/library").DefaultArgs>;
|
|
22
|
+
saveFiles: { [K in `for${Capitalize<MNames>}`]: <T extends Record<string, any>>(data: T, overrideSaveOptions?: import("./adapters/BaseStorageAdapter.js").SaveOptionsOverride) => Promise<{ [K_2 in keyof T]: T[K_2] extends File ? string : T[K_2]; }>; } & {
|
|
23
23
|
inList: (files?: File[], pathOverrideOnly?: {
|
|
24
24
|
path?: string;
|
|
25
25
|
}) => Promise<string[]>;
|
|
@@ -33,8 +33,8 @@ export declare const setupStorage: <TClient, MNames extends ModelNamesFor<TClien
|
|
|
33
33
|
* @param uploadsConfig The uploads configuration object.
|
|
34
34
|
* @returns The same uploads configuration object, but with filtered types
|
|
35
35
|
*/
|
|
36
|
-
export declare function createUploadsConfig<
|
|
37
|
-
[K in
|
|
36
|
+
export declare function createUploadsConfig<T extends Partial<{
|
|
37
|
+
[K in ModelNames]?: UploadConfigForModel<K>;
|
|
38
38
|
}>>(uploadsConfig: T): T;
|
|
39
|
-
export type {
|
|
39
|
+
export type { ModelNames, UploadsConfig } from './prismaExtension.js';
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAE1E,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAE1E,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACd,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,KAAK,mBAAmB,CAAC,MAAM,SAAS,UAAU,IAAI;IACpD,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACpC,cAAc,EAAE,kBAAkB,CAAA;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,UAAU,EAAE,+CAIrD,mBAAmB,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;gBARV,CAAC;;;CAqBpB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,SAAS,OAAO,CAAC;KACf,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;CAC5C,CAAC,EACF,aAAa,EAAE,CAAC,GAAG,CAAC,CAErB;AAED,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PrismaClient } from '@prisma/client';
|
|
2
|
+
import type { Prisma } from '@prisma/client';
|
|
2
3
|
import type { BaseStorageAdapter } from './adapters/BaseStorageAdapter.js';
|
|
3
4
|
import type { UrlSigner } from './UrlSigner.js';
|
|
4
5
|
type FilterOutDollarPrefixed<T> = T extends `$${string}` ? never : T extends symbol ? never : T;
|
|
5
|
-
export type
|
|
6
|
-
type PrismaModelFields<
|
|
7
|
-
export type UploadConfigForModel<
|
|
8
|
-
fields: PrismaModelFields<
|
|
6
|
+
export type ModelNames = FilterOutDollarPrefixed<keyof PrismaClient>;
|
|
7
|
+
type PrismaModelFields<MName extends ModelNames> = keyof Prisma.Result<PrismaClient[MName], any, 'findFirstOrThrow'>;
|
|
8
|
+
export type UploadConfigForModel<TPrismaModelName extends ModelNames> = {
|
|
9
|
+
fields: PrismaModelFields<TPrismaModelName> | PrismaModelFields<TPrismaModelName>[];
|
|
9
10
|
};
|
|
10
|
-
export type UploadsConfig<
|
|
11
|
-
[K in MNames]?: UploadConfigForModel<
|
|
11
|
+
export type UploadsConfig<MNames extends ModelNames = ModelNames> = {
|
|
12
|
+
[K in MNames]?: UploadConfigForModel<K>;
|
|
12
13
|
};
|
|
13
14
|
type WithSignedUrlArgs = {
|
|
14
15
|
expiresIn?: number;
|
|
15
16
|
};
|
|
16
|
-
export declare const createUploadsExtension: <
|
|
17
|
+
export declare const createUploadsExtension: <MNames extends ModelNames = ModelNames>(config: UploadsConfig<MNames>, storageAdapter: BaseStorageAdapter, urlSigner?: UrlSigner) => (client: any) => import("@prisma/client/extension").PrismaClientExtends<import("@prisma/client/runtime/library").InternalArgs<{ [K in MNames]: {
|
|
17
18
|
withDataUri: {
|
|
18
19
|
needs: Record<string, boolean>;
|
|
19
20
|
compute: (modelData: Record<string, unknown>) => <T>(this: T) => Promise<T>;
|
|
@@ -22,6 +23,6 @@ export declare const createUploadsExtension: <TClient, MNames extends ModelNames
|
|
|
22
23
|
needs: Record<string, boolean>;
|
|
23
24
|
compute: (modelData: Record<string, unknown>) => <T>(this: T, signArgs?: WithSignedUrlArgs) => T;
|
|
24
25
|
};
|
|
25
|
-
}; }, {}, {}, {}> & import("@prisma/client/runtime/
|
|
26
|
+
}; }, {}, {}, {}> & import("@prisma/client/runtime/library").DefaultArgs>;
|
|
26
27
|
export {};
|
|
27
28
|
//# sourceMappingURL=prismaExtension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prismaExtension.d.ts","sourceRoot":"","sources":["../src/prismaExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prismaExtension.d.ts","sourceRoot":"","sources":["../src/prismaExtension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAG5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,KAAK,uBAAuB,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,EAAE,GACpD,KAAK,GACL,CAAC,SAAS,MAAM,GACd,KAAK,GACL,CAAC,CAAA;AAGP,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC,MAAM,YAAY,CAAC,CAAA;AAEpE,KAAK,iBAAiB,CAAC,KAAK,SAAS,UAAU,IAAI,MAAM,MAAM,CAAC,MAAM,CACpE,YAAY,CAAC,KAAK,CAAC,EACnB,GAAG,EACH,kBAAkB,CACnB,CAAA;AAED,MAAM,MAAM,oBAAoB,CAAC,gBAAgB,SAAS,UAAU,IAAI;IACtE,MAAM,EACF,iBAAiB,CAAC,gBAAgB,CAAC,GACnC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,IAAI;KACjE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;CACxC,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,MAAM,SAAS,UAAU,GAAG,UAAU,EAC3E,QAAQ,aAAa,CAAC,MAAM,CAAC,EAC7B,gBAAgB,kBAAkB,EAClC,YAAY,SAAS,sIAGlB,CAAC;iBACa;QACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9B,OAAO,EAAE,CACP,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;KAChC;mBACc;QACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9B,OAAO,EAAE,CACP,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,iBAAiB,KAAK,CAAC,CAAA;KACrD;yEAoRN,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/storage",
|
|
3
|
-
"version": "2.8.1-
|
|
3
|
+
"version": "2.8.1-rc.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -47,27 +47,23 @@
|
|
|
47
47
|
"build:types-cjs": "tsc --build --verbose tsconfig.types-cjs.json",
|
|
48
48
|
"check:attw": "tsx attw.ts",
|
|
49
49
|
"check:package": "concurrently npm:check:attw yarn publint",
|
|
50
|
-
"setup:test": "npx prisma db push --accept-data-loss --config ./src/__tests__/prisma.config.ts
|
|
50
|
+
"setup:test": "npx prisma db push --accept-data-loss --config ./src/__tests__/prisma.config.ts",
|
|
51
51
|
"test": "vitest run",
|
|
52
52
|
"test:types": "yarn setup:test && tstyche",
|
|
53
53
|
"test:watch": "vitest watch"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@cedarjs/project-config": "2.8.1-
|
|
56
|
+
"@cedarjs/project-config": "2.8.1-rc.3",
|
|
57
57
|
"mime-types": "2.1.35",
|
|
58
58
|
"ulid": "3.0.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@arethetypeswrong/cli": "0.18.2",
|
|
62
|
-
"@cedarjs/framework-tools": "2.8.1-
|
|
63
|
-
"@prisma/
|
|
64
|
-
"@prisma/client": "7.5.0",
|
|
65
|
-
"@types/better-sqlite3": "7.6.13",
|
|
62
|
+
"@cedarjs/framework-tools": "2.8.1-rc.3",
|
|
63
|
+
"@prisma/client": "6.19.2",
|
|
66
64
|
"@types/mime-types": "2.1.4",
|
|
67
|
-
"better-sqlite3": "12.8.0",
|
|
68
65
|
"concurrently": "9.2.1",
|
|
69
66
|
"esbuild": "0.21.5",
|
|
70
|
-
"prisma": "7.5.0",
|
|
71
67
|
"publint": "0.3.18",
|
|
72
68
|
"tstyche": "5.0.2",
|
|
73
69
|
"tsx": "4.21.0",
|
|
@@ -77,5 +73,5 @@
|
|
|
77
73
|
"publishConfig": {
|
|
78
74
|
"access": "public"
|
|
79
75
|
},
|
|
80
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "f778a5b70b97c0b129246e918083f42c63a6dc0a"
|
|
81
77
|
}
|