@webiny/api-file-manager 5.43.3 → 6.0.0-alpha.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/FileManagerContextSetup.js.map +1 -1
- package/README.md +1 -1
- package/cmsFileStorage/CmsFilesStorage.d.ts +3 -3
- package/cmsFileStorage/CmsFilesStorage.js.map +1 -1
- package/cmsFileStorage/ListFilesWhereProcessor.d.ts +2 -2
- package/cmsFileStorage/ListFilesWhereProcessor.js.map +1 -1
- package/cmsFileStorage/ListTagsWhereProcessor.d.ts +2 -2
- package/cmsFileStorage/ListTagsWhereProcessor.js.map +1 -1
- package/createFileManager/files.crud.d.ts +1 -1
- package/createFileManager/files.crud.js.map +1 -1
- package/createFileManager/permissions/FilesPermissions.d.ts +1 -1
- package/createFileManager/permissions/FilesPermissions.js.map +1 -1
- package/delivery/AssetDelivery/AliasAssetRequestResolver.d.ts +4 -3
- package/delivery/AssetDelivery/AliasAssetRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/Asset.d.ts +1 -1
- package/delivery/AssetDelivery/Asset.js.map +1 -1
- package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +2 -2
- package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +1 -1
- package/delivery/AssetDelivery/AssetRequest.d.ts +1 -1
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
- package/delivery/AssetDelivery/FilesAssetRequestResolver.d.ts +2 -2
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/NullAssetOutputStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/NullAssetResolver.d.ts +2 -2
- package/delivery/AssetDelivery/NullAssetResolver.js.map +1 -1
- package/delivery/AssetDelivery/NullRequestResolver.d.ts +1 -1
- package/delivery/AssetDelivery/NullRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/SetCacheControlHeaders.d.ts +2 -2
- package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +1 -1
- package/delivery/AssetDelivery/SetResponseHeaders.d.ts +3 -3
- package/delivery/AssetDelivery/SetResponseHeaders.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetProcessor.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.d.ts +2 -2
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetResolver.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +1 -1
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.d.ts +1 -1
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +2 -2
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateCache.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +3 -2
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +3 -3
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +2 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +2 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/internalIdentity.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/internalIdentity.js.map +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.d.ts +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -1
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.d.ts +1 -1
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +1 -1
- package/delivery/setupAssetDelivery.d.ts +2 -2
- package/delivery/setupAssetDelivery.js.map +1 -1
- package/graphql/baseSchema.d.ts +1 -1
- package/graphql/baseSchema.js.map +1 -1
- package/graphql/createFilesTypeDefs.d.ts +1 -1
- package/graphql/createFilesTypeDefs.js.map +1 -1
- package/graphql/filesSchema.d.ts +2 -2
- package/graphql/filesSchema.js.map +1 -1
- package/graphql/getFileByUrl.d.ts +1 -1
- package/graphql/getFileByUrl.js.map +1 -1
- package/graphql/index.d.ts +1 -1
- package/graphql/index.js.map +1 -1
- package/graphql/utils.d.ts +1 -1
- package/handlers/manage/imageManager.d.ts +1 -1
- package/handlers/manage/imageManager.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js.map +1 -1
- package/modelModifier/CmsModelModifier.d.ts +2 -2
- package/modelModifier/CmsModelModifier.js.map +1 -1
- package/package.json +17 -17
- package/plugins/FilePhysicalStoragePlugin.d.ts +1 -1
- package/plugins/FilePhysicalStoragePlugin.js.map +1 -1
- package/plugins/FileStorageTransformPlugin.d.ts +1 -1
- package/plugins/FileStorageTransformPlugin.js.map +1 -1
- package/storage/FileStorage.d.ts +2 -2
- package/storage/FileStorage.js.map +1 -1
- package/types/file.lifecycle.d.ts +2 -2
- package/types/file.lifecycle.js.map +1 -1
- package/types.d.ts +10 -10
- package/types.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_handlerGraphql","require","_utils","_createFilesTypeDefs","_apiSecurity","createFilesSchema","params","fileManagerGraphQL","GraphQLSchemaPlugin","typeDefs","createFilesTypeDefs","resolvers","Query","fileManager","emptyResolver","Mutation","FmFile","src","file","_","context","settings","getSettings","srcPrefix","key","FmQuery","getFileModel","__","identity","security","getIdentity","NotAuthorizedResponse","resolve","cms","getModel","getFile","args","id","listFiles","data","meta","ListResponse","e","ErrorResponse","listTags","tags","Response","error","FmMutation","createFile","createFiles","createFilesInBatch","updateFile","deleteFile","storage","delete","name","exports"],"sources":["filesSchema.ts"],"sourcesContent":["import {\n ErrorResponse,\n GraphQLSchemaPlugin,\n ListResponse,\n Response\n} from \"@webiny/handler-graphql\";\nimport { FileManagerContext, FilesListOpts } from \"~/types\";\nimport { emptyResolver, resolve } from \"./utils\";\nimport { createFilesTypeDefs
|
|
1
|
+
{"version":3,"names":["_handlerGraphql","require","_utils","_createFilesTypeDefs","_apiSecurity","createFilesSchema","params","fileManagerGraphQL","GraphQLSchemaPlugin","typeDefs","createFilesTypeDefs","resolvers","Query","fileManager","emptyResolver","Mutation","FmFile","src","file","_","context","settings","getSettings","srcPrefix","key","FmQuery","getFileModel","__","identity","security","getIdentity","NotAuthorizedResponse","resolve","cms","getModel","getFile","args","id","listFiles","data","meta","ListResponse","e","ErrorResponse","listTags","tags","Response","error","FmMutation","createFile","createFiles","createFilesInBatch","updateFile","deleteFile","storage","delete","name","exports"],"sources":["filesSchema.ts"],"sourcesContent":["import {\n ErrorResponse,\n GraphQLSchemaPlugin,\n ListResponse,\n Response\n} from \"@webiny/handler-graphql\";\nimport type { FileManagerContext, FilesListOpts } from \"~/types\";\nimport { emptyResolver, resolve } from \"./utils\";\nimport type { CreateFilesTypeDefsParams } from \"~/graphql/createFilesTypeDefs\";\nimport { createFilesTypeDefs } from \"~/graphql/createFilesTypeDefs\";\nimport { NotAuthorizedResponse } from \"@webiny/api-security\";\n\nexport const createFilesSchema = (params: CreateFilesTypeDefsParams) => {\n const fileManagerGraphQL = new GraphQLSchemaPlugin<FileManagerContext>({\n typeDefs: createFilesTypeDefs(params),\n resolvers: {\n Query: {\n fileManager: emptyResolver\n },\n Mutation: {\n fileManager: emptyResolver\n },\n FmFile: {\n async src(file, _, context) {\n const settings = await context.fileManager.getSettings();\n return (settings?.srcPrefix || \"\") + file.key;\n }\n },\n FmQuery: {\n getFileModel(_, __, context) {\n const identity = context.security.getIdentity();\n if (!identity) {\n return new NotAuthorizedResponse();\n }\n\n return resolve(() => context.cms.getModel(\"fmFile\"));\n },\n getFile(_, args: any, context) {\n return resolve(() => context.fileManager.getFile(args.id));\n },\n async listFiles(_, args: FilesListOpts, context) {\n try {\n const [data, meta] = await context.fileManager.listFiles(args);\n\n return new ListResponse(data, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n async listTags(_, args: any, context) {\n try {\n const tags = await context.fileManager.listTags(args || {});\n\n return new Response(tags);\n } catch (error) {\n return new ErrorResponse(error);\n }\n }\n },\n FmMutation: {\n async createFile(_, args: any, context) {\n return resolve(() => {\n return context.fileManager.createFile(args.data, args.meta);\n });\n },\n async createFiles(_, args: any, context) {\n return resolve(() => {\n return context.fileManager.createFilesInBatch(args.data, args.meta);\n });\n },\n async updateFile(_, args: any, context) {\n return resolve(() => {\n return context.fileManager.updateFile(args.id, args.data);\n });\n },\n async deleteFile(_, args: any, context) {\n return resolve(async () => {\n // TODO: Ideally, this should work via a lifecycle hook; first we delete a record from DB, then from cloud storage.\n const file = await context.fileManager.getFile(args.id);\n return await context.fileManager.storage.delete({\n id: file.id,\n key: file.key\n });\n });\n }\n }\n }\n });\n fileManagerGraphQL.name = \"fm.graphql.files\";\n\n return fileManagerGraphQL;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEO,MAAMI,iBAAiB,GAAIC,MAAiC,IAAK;EACpE,MAAMC,kBAAkB,GAAG,IAAIC,mCAAmB,CAAqB;IACnEC,QAAQ,EAAE,IAAAC,wCAAmB,EAACJ,MAAM,CAAC;IACrCK,SAAS,EAAE;MACPC,KAAK,EAAE;QACHC,WAAW,EAAEC;MACjB,CAAC;MACDC,QAAQ,EAAE;QACNF,WAAW,EAAEC;MACjB,CAAC;MACDE,MAAM,EAAE;QACJ,MAAMC,GAAGA,CAACC,IAAI,EAAEC,CAAC,EAAEC,OAAO,EAAE;UACxB,MAAMC,QAAQ,GAAG,MAAMD,OAAO,CAACP,WAAW,CAACS,WAAW,CAAC,CAAC;UACxD,OAAO,CAACD,QAAQ,EAAEE,SAAS,IAAI,EAAE,IAAIL,IAAI,CAACM,GAAG;QACjD;MACJ,CAAC;MACDC,OAAO,EAAE;QACLC,YAAYA,CAACP,CAAC,EAAEQ,EAAE,EAAEP,OAAO,EAAE;UACzB,MAAMQ,QAAQ,GAAGR,OAAO,CAACS,QAAQ,CAACC,WAAW,CAAC,CAAC;UAC/C,IAAI,CAACF,QAAQ,E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AACI,IAAI,CAAC;UAC/D,CAAC,CAAC;QACN,CAAC;QACD,MAAMU,WAAWA,CAAC/B,CAAC,EAAEiB,IAAS,EAAEhB,OAAO,EAAE;UACrC,OAAO,IAAAY,cAAO,EAAC,MAAM;YACjB,OAAOZ,OAAO,CAACP,WAAW,CAACsC,kBAAkB,CAACf,IAAI,CAACG,IAAI,EAAEH,IAAI,CAACI,IAAI,CAAC;UACvE,CAAC,CAAC;QACN,CAAC;QACD,MAAMY,UAAUA,CAACjC,CAAC,EAAEiB,IAAS,EAAEhB,OAAO,EAAE;UACpC,OAAO,IAAAY,cAAO,EAAC,MAAM;YACjB,OAAOZ,OAAO,CAACP,WAAW,CAACuC,UAAU,CAAChB,IAAI,CAACC,EAAE,EAAED,IAAI,CAACG,IAAI,CAAC;UAC7D,CAAC,CAAC;QACN,CAAC;QACD,MAAMc,UAAUA,CAAClC,CAAC,EAAEiB,IAAS,EAAEhB,OAAO,EAAE;UACpC,OAAO,IAAAY,cAAO,EAAC,YAAY;YACvB;YACA,MAAMd,IAAI,GAAG,MAAME,OAAO,CAACP,WAAW,CAACsB,OAAO,CAACC,IAAI,CAACC,EAAE,CAAC;YACvD,OAAO,MAAMjB,OAAO,CAACP,WAAW,CAACyC,OAAO,CAACC,MAAM,CAAC;cAC5ClB,EAAE,EAAEnB,IAAI,CAACmB,EAAE;cACXb,GAAG,EAAEN,IAAI,CAACM;YACd,CAAC,CAAC;UACN,CAAC,CAAC;QACN;MACJ;IACJ;EACJ,CAAC,CAAC;EACFjB,kBAAkB,CAACiD,IAAI,GAAG,kBAAkB;EAE5C,OAAOjD,kBAAkB;AAC7B,CAAC;AAACkD,OAAA,CAAApD,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_handlerGraphql","require","_apiSecurity","getFileByUrl","fileManagerGraphQL","GraphQLSchemaPlugin","typeDefs","resolvers","FmQuery","_","args","context","url","useCase","SecureGetFileByUrl","security","GetFileByUrlUseCase","fileManager","file","execute","Response","NotFoundResponse","error","ErrorResponse","name","exports","constructor","pathname","URL","isAlias","startsWith","query","replace","files","listFiles","where","OR","key","aliases_contains","limit","length","undefined","getIdentity","NotAuthorizedError","message"],"sources":["getFileByUrl.ts"],"sourcesContent":["import { ErrorResponse, GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { Response, NotFoundResponse } from \"@webiny/handler-graphql\";\nimport { FileManagerContext, FileManagerContextObject, File } from \"~/types\";\nimport { Security } from \"@webiny/api-security/types\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\n\nexport const getFileByUrl = () => {\n const fileManagerGraphQL = new GraphQLSchemaPlugin<FileManagerContext>({\n typeDefs: /* GraphQL */ `\n extend type FmQuery {\n getFileByUrl(url: String!): FmFileResponse\n }\n `,\n resolvers: {\n FmQuery: {\n async getFileByUrl(_, args, context) {\n const { url } = args as { url: string };\n const useCase = new SecureGetFileByUrl(\n context.security,\n new GetFileByUrlUseCase(context.fileManager)\n );\n try {\n const file = await useCase.execute(url);\n if (file) {\n return new Response(file);\n }\n return new NotFoundResponse(\"File not found!\");\n } catch (error) {\n return new ErrorResponse(error);\n }\n }\n }\n }\n });\n fileManagerGraphQL.name = \"fm.graphql.getFileByUrl\";\n\n return fileManagerGraphQL;\n};\n\ninterface IGetFileByUrl {\n execute(url: string): Promise<File | undefined>;\n}\n\nclass GetFileByUrlUseCase implements IGetFileByUrl {\n private readonly fileManager: FileManagerContextObject;\n\n constructor(fileManager: FileManagerContextObject) {\n this.fileManager = fileManager;\n }\n\n async execute(url: string): Promise<File | undefined> {\n const { pathname } = new URL(url);\n const isAlias = !pathname.startsWith(\"/files/\") && !pathname.startsWith(\"/private/\");\n const query = isAlias ? pathname : pathname.replace(\"/files/\", \"\").replace(\"/private/\", \"\");\n\n const [files] = await this.fileManager.listFiles({\n where: {\n OR: [{ key: query }, { aliases_contains: query }]\n },\n limit: 1\n });\n\n return files.length ? files[0] : undefined;\n }\n}\n\nclass SecureGetFileByUrl implements IGetFileByUrl {\n private security: Security;\n private useCase: IGetFileByUrl;\n\n constructor(security: Security, useCase: IGetFileByUrl) {\n this.security = security;\n this.useCase = useCase;\n }\n\n execute(url: string): Promise<File | undefined> {\n if (!this.security.getIdentity()) {\n throw new NotAuthorizedError({ message: \"You're not authorized to edit this file!\" });\n }\n\n return this.useCase.execute(url);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AAEO,MAAME,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAMC,kBAAkB,GAAG,IAAIC,mCAAmB,CAAqB;IACnEC,QAAQ,EAAE,aAAc;AAChC;AACA;AACA;AACA,SAAS;IACDC,SAAS,EAAE;MACPC,OAAO,EAAE;QACL,MAAML,YAAYA,CAACM,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE;UACjC,MAAM;YAAEC;UAAI,CAAC,GAAGF,IAAuB;UACvC,MAAMG,OAAO,GAAG,IAAIC,kBAAkB,CAClCH,OAAO,CAACI,QAAQ,EAChB,IAAIC,mBAAmB,CAACL,OAAO,CAACM,WAAW,CAC/C,CAAC;UACD,IAAI;YACA,MAAMC,IAAI,GAAG,MAAML,OAAO,CAACM,OAAO,CAACP,GAAG,CAAC;YACvC,IAAIM,IAAI,EAAE;cACN,OAAO,IAAIE,wBAAQ,CAACF,IAAI,CAAC;YAC7B;YACA,OAAO,IAAIG,gCAAgB,CAAC,iBAAiB,CAAC;UAClD,CAAC,CAAC,OAAOC,KAAK,EAAE;YACZ,OAAO,IAAIC,6BAAa,CAACD,KAAK,CAAC;UACnC;QACJ;MACJ;IACJ;EACJ,CAAC,CAAC;EACFlB,kBAAkB,CAACoB,IAAI,GAAG,yBAAyB;EAEnD,OAAOpB,kBAAkB;AAC7B,CAAC;AAACqB,OAAA,CAAAtB,YAAA,GAAAA,YAAA;AAMF,MAAMa,mBAAmB,CAA0B;EAG/CU,WAAWA,CAACT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Graphql","require","_apiSecurity","getFileByUrl","fileManagerGraphQL","GraphQLSchemaPlugin","typeDefs","resolvers","FmQuery","_","args","context","url","useCase","SecureGetFileByUrl","security","GetFileByUrlUseCase","fileManager","file","execute","Response","NotFoundResponse","error","ErrorResponse","name","exports","constructor","pathname","URL","isAlias","startsWith","query","replace","files","listFiles","where","OR","key","aliases_contains","limit","length","undefined","getIdentity","NotAuthorizedError","message"],"sources":["getFileByUrl.ts"],"sourcesContent":["import { ErrorResponse, GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { Response, NotFoundResponse } from \"@webiny/handler-graphql\";\nimport type { FileManagerContext, FileManagerContextObject, File } from \"~/types\";\nimport type { Security } from \"@webiny/api-security/types\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\n\nexport const getFileByUrl = () => {\n const fileManagerGraphQL = new GraphQLSchemaPlugin<FileManagerContext>({\n typeDefs: /* GraphQL */ `\n extend type FmQuery {\n getFileByUrl(url: String!): FmFileResponse\n }\n `,\n resolvers: {\n FmQuery: {\n async getFileByUrl(_, args, context) {\n const { url } = args as { url: string };\n const useCase = new SecureGetFileByUrl(\n context.security,\n new GetFileByUrlUseCase(context.fileManager)\n );\n try {\n const file = await useCase.execute(url);\n if (file) {\n return new Response(file);\n }\n return new NotFoundResponse(\"File not found!\");\n } catch (error) {\n return new ErrorResponse(error);\n }\n }\n }\n }\n });\n fileManagerGraphQL.name = \"fm.graphql.getFileByUrl\";\n\n return fileManagerGraphQL;\n};\n\ninterface IGetFileByUrl {\n execute(url: string): Promise<File | undefined>;\n}\n\nclass GetFileByUrlUseCase implements IGetFileByUrl {\n private readonly fileManager: FileManagerContextObject;\n\n constructor(fileManager: FileManagerContextObject) {\n this.fileManager = fileManager;\n }\n\n async execute(url: string): Promise<File | undefined> {\n const { pathname } = new URL(url);\n const isAlias = !pathname.startsWith(\"/files/\") && !pathname.startsWith(\"/private/\");\n const query = isAlias ? pathname : pathname.replace(\"/files/\", \"\").replace(\"/private/\", \"\");\n\n const [files] = await this.fileManager.listFiles({\n where: {\n OR: [{ key: query }, { aliases_contains: query }]\n },\n limit: 1\n });\n\n return files.length ? files[0] : undefined;\n }\n}\n\nclass SecureGetFileByUrl implements IGetFileByUrl {\n private security: Security;\n private useCase: IGetFileByUrl;\n\n constructor(security: Security, useCase: IGetFileByUrl) {\n this.security = security;\n this.useCase = useCase;\n }\n\n execute(url: string): Promise<File | undefined> {\n if (!this.security.getIdentity()) {\n throw new NotAuthorizedError({ message: \"You're not authorized to edit this file!\" });\n }\n\n return this.useCase.execute(url);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AAEO,MAAME,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAMC,kBAAkB,GAAG,IAAIC,mCAAmB,CAAqB;IACnEC,QAAQ,EAAE,aAAc;AAChC;AACA;AACA;AACA,SAAS;IACDC,SAAS,EAAE;MACPC,OAAO,EAAE;QACL,MAAML,YAAYA,CAACM,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE;UACjC,MAAM;YAAEC;UAAI,CAAC,GAAGF,IAAuB;UACvC,MAAMG,OAAO,GAAG,IAAIC,kBAAkB,CAClCH,OAAO,CAACI,QAAQ,EAChB,IAAIC,mBAAmB,CAACL,OAAO,CAACM,WAAW,CAC/C,CAAC;UACD,IAAI;YACA,MAAMC,IAAI,GAAG,MAAML,OAAO,CAACM,OAAO,CAACP,GAAG,CAAC;YACvC,IAAIM,IAAI,EAAE;cACN,OAAO,IAAIE,wBAAQ,CAACF,IAAI,CAAC;YAC7B;YACA,OAAO,IAAIG,gCAAgB,CAAC,iBAAiB,CAAC;UAClD,CAAC,CAAC,OAAOC,KAAK,EAAE;YACZ,OAAO,IAAIC,6BAAa,CAACD,KAAK,CAAC;UACnC;QACJ;MACJ;IACJ;EACJ,CAAC,CAAC;EACFlB,kBAAkB,CAACoB,IAAI,GAAG,yBAAyB;EAEnD,OAAOpB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EA,OAAO,IAAI,CAAC/B,OAAO,CAACM,OAAO,CAACP,GAAG,CAAC;EACpC;AACJ","ignoreList":[]}
|
package/graphql/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
|
2
2
|
import { GraphQLSchemaPlugin } from "@webiny/handler-graphql";
|
|
3
|
-
import { FileManagerContext } from "../types";
|
|
3
|
+
import type { FileManagerContext } from "../types";
|
|
4
4
|
export declare const createGraphQLSchemaPlugin: () => (GraphQLSchemaPlugin<FileManagerContext> | ContextPlugin<FileManagerContext>)[];
|
package/graphql/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_api","require","_apiHeadlessCms","_createFieldTypePluginRecords","_getSchemaFromFieldPlugins","_baseSchema","_handlerGraphql","_filesSchema","_getFileByUrl","createGraphQLSchemaPlugin","createBaseSchema","ContextPlugin","context","isHeadlessCmsReady","security","withoutAuthorization","fileModel","cms","getModel","models","listModels","fieldPlugins","createFieldTypePluginRecords","plugins","createGraphQLSchemaPluginFromFieldPlugins","type","fieldTypePlugins","createPlugin","schema","fieldType","plugin","GraphQLSchemaPlugin","name","graphQlPlugin","createFilesSchema","model","register","getFileByUrl","exports"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { createFieldTypePluginRecords } from \"@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords\";\nimport { createGraphQLSchemaPluginFromFieldPlugins } from \"@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins\";\nimport { createBaseSchema } from \"~/graphql/baseSchema\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { createFilesSchema } from \"~/graphql/filesSchema\";\nimport { getFileByUrl } from \"~/graphql/getFileByUrl\";\nimport { FileManagerContext } from \"~/types\";\n\nexport const createGraphQLSchemaPlugin = () => {\n return [\n createBaseSchema(),\n // Files schema is generated dynamically, based on a CMS model, so we need to\n // register it from a ContextPlugin, to perform additional bootstrap.\n new ContextPlugin<FileManagerContext>(async context => {\n if (!(await isHeadlessCmsReady(context))) {\n return;\n }\n\n await context.security.withoutAuthorization(async () => {\n const fileModel = (await context.cms.getModel(\"fmFile\")) as CmsModel;\n const models = await context.cms.listModels();\n const fieldPlugins = createFieldTypePluginRecords(context.plugins);\n /**\n * We need to register all plugins for all the CMS fields.\n */\n const plugins = createGraphQLSchemaPluginFromFieldPlugins({\n models,\n type: \"manage\",\n fieldTypePlugins: fieldPlugins,\n createPlugin: ({ schema, type, fieldType }) => {\n const plugin = new GraphQLSchemaPlugin(schema);\n plugin.name = `fm.graphql.schema.${type}.field.${fieldType}`;\n return plugin;\n }\n });\n\n const graphQlPlugin = createFilesSchema({\n model: fileModel,\n models,\n plugins: fieldPlugins\n });\n\n context.plugins.register([...plugins, graphQlPlugin, getFileByUrl()]);\n });\n })\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,6BAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAGO,MAAMQ,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,CACH,IAAAC,4BAAgB,EAAC,CAAC;EAClB;EACA;EACA,IAAIC,kBAAa,CAAqB,MAAMC,OAAO,IAAI;IACnD,IAAI,EAAE,MAAM,IAAAC,kCAAkB,EAACD,OAAO,CAAC,CAAC,EAAE;MACtC;IACJ;IAEA,MAAMA,OAAO,CAACE,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACpD,MAAMC,SAAS,GAAI,MAAMJ,OAAO,CAACK,GAAG,CAACC,QAAQ,CAAC,QAAQ,CAAc;MACpE,MAAMC,MAAM,GAAG,MAAMP,OAAO,CAACK,GAAG,CAACG,UAAU,CAAC,CAAC;MAC7C,MAAMC,YAAY,GAAG,IAAAC,0DAA4B,EAACV,OAAO,CAACW,OAAO,CAAC;MAClE;AAChB;AACA;MACgB,MAAMA,OAAO,GAAG,IAAAC,oEAAyC,EAAC;QACtDL,MAAM;QACNM,IAAI,EAAE,QAAQ;QACdC,gBAAgB,EAAEL,YAAY;QAC9BM,YAAY,EAAEA,CAAC;UAAEC,MAAM;UAAEH,IAAI;UAAEI;QAAU,CAAC,KAAK;UAC3C,MAAMC,MAAM,GAAG,IAAIC,mCAAmB,CAACH,MAAM,CAAC;UAC9CE,MAAM,CAACE,IAAI,GAAG,qBAAqBP,IAAI,UAAUI,SAAS,EAAE;UAC5D,OAAOC,MAAM;QACjB;MACJ,CAAC,CAAC;MAEF,MAAMG,aAAa,GAAG,IAAAC,8BAAiB,EAAC;QACpCC,KAAK,EAAEnB,SAAS;QAChBG,MAAM;QACNI,OAAO,EAAEF;MACb,CAAC,CAAC;MAEFT,OAAO,CAACW,OAAO,CAACa,QAAQ,CAAC,CAAC,GAAGb,OAAO,EAAEU,aAAa,EAAE,IAAAI,0BAAY,EAAC,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC;EACN,CAAC,CAAC,CACL;AACL,CAAC;AAACC,OAAA,CAAA7B,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_api","require","_apiHeadlessCms","_createFieldTypePluginRecords","_getSchemaFromFieldPlugins","_baseSchema","_handlerGraphql","_filesSchema","_getFileByUrl","createGraphQLSchemaPlugin","createBaseSchema","ContextPlugin","context","isHeadlessCmsReady","security","withoutAuthorization","fileModel","cms","getModel","models","listModels","fieldPlugins","createFieldTypePluginRecords","plugins","createGraphQLSchemaPluginFromFieldPlugins","type","fieldTypePlugins","createPlugin","schema","fieldType","plugin","GraphQLSchemaPlugin","name","graphQlPlugin","createFilesSchema","model","register","getFileByUrl","exports"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { createFieldTypePluginRecords } from \"@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords\";\nimport { createGraphQLSchemaPluginFromFieldPlugins } from \"@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins\";\nimport { createBaseSchema } from \"~/graphql/baseSchema\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { createFilesSchema } from \"~/graphql/filesSchema\";\nimport { getFileByUrl } from \"~/graphql/getFileByUrl\";\nimport type { FileManagerContext } from \"~/types\";\n\nexport const createGraphQLSchemaPlugin = () => {\n return [\n createBaseSchema(),\n // Files schema is generated dynamically, based on a CMS model, so we need to\n // register it from a ContextPlugin, to perform additional bootstrap.\n new ContextPlugin<FileManagerContext>(async context => {\n if (!(await isHeadlessCmsReady(context))) {\n return;\n }\n\n await context.security.withoutAuthorization(async () => {\n const fileModel = (await context.cms.getModel(\"fmFile\")) as CmsModel;\n const models = await context.cms.listModels();\n const fieldPlugins = createFieldTypePluginRecords(context.plugins);\n /**\n * We need to register all plugins for all the CMS fields.\n */\n const plugins = createGraphQLSchemaPluginFromFieldPlugins({\n models,\n type: \"manage\",\n fieldTypePlugins: fieldPlugins,\n createPlugin: ({ schema, type, fieldType }) => {\n const plugin = new GraphQLSchemaPlugin(schema);\n plugin.name = `fm.graphql.schema.${type}.field.${fieldType}`;\n return plugin;\n }\n });\n\n const graphQlPlugin = createFilesSchema({\n model: fileModel,\n models,\n plugins: fieldPlugins\n });\n\n context.plugins.register([...plugins, graphQlPlugin, getFileByUrl()]);\n });\n })\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,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QAAQ,CAAC,CAAC,GAAGb,OAAO,EAAEU,aAAa,EAAE,IAAAI,0BAAY,EAAC,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC;EACN,CAAC,CAAC,CACL;AACL,CAAC;AAACC,OAAA,CAAA7B,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/graphql/utils.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export declare const emptyResolver: () => {};
|
|
|
7
7
|
interface ResolveCallable {
|
|
8
8
|
(): Promise<any>;
|
|
9
9
|
}
|
|
10
|
-
export declare const resolve: (fn: ResolveCallable) => Promise<Response<any
|
|
10
|
+
export declare const resolve: (fn: ResolveCallable) => Promise<ErrorResponse | Response<any>>;
|
|
11
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_path","require","_utils","newUtils","_interopRequireWildcard","legacyUtils","isLegacyKey","key","includes","imageManager","exports","canProcess","params","extension","utils","SUPPORTED_IMAGES","startsWith","OPTIMIZED_IMAGE_PREFIX","OPTIMIZED_TRANSFORMED_IMAGE_PREFIX","process","s3","deleteObject","getObjectParams","getImageKey","SUPPORTED_TRANSFORMABLE_IMAGES","prefix","getOptimizedImageKeyPrefix","dirname","env","getEnvironment","imagesList","listObjects","Bucket","bucket","Prefix","Contents","imageObject","Key"],"sources":["imageManager.ts"],"sourcesContent":["import { dirname } from \"path\";\nimport { S3 } from \"@webiny/aws-sdk/client-s3\";\nimport { getObjectParams, getEnvironment } from \"~/handlers/utils\";\nimport * as newUtils from \"./utils\";\nimport * as legacyUtils from \"./legacyUtils\";\n\nconst isLegacyKey = (key: string) => {\n return !key.includes(\"/\");\n};\n\nexport interface ImageManagerCanProcessParams {\n key: string;\n extension: string;\n}\nexport interface ImageManagerProcessParams {\n s3: S3;\n key: string;\n extension: string;\n}\nexport const imageManager = {\n canProcess: (params: ImageManagerCanProcessParams) => {\n const { key, extension } = params;\n const utils = key.includes(\"/\") ? newUtils : legacyUtils;\n\n if (!utils.SUPPORTED_IMAGES.includes(extension)) {\n return false;\n }\n\n // We only want to process original images, and delete all variations of it at once.\n // We DO NOT want to process the event for the deletion of an optimized/transformed image.\n // Unfortunately, there's no way to filter those events on the S3 bucket itself, so we have to do it this way.\n return !(\n key.startsWith(utils.OPTIMIZED_IMAGE_PREFIX) ||\n key.startsWith(utils.OPTIMIZED_TRANSFORMED_IMAGE_PREFIX)\n );\n },\n async process({ s3, key, extension }: ImageManagerProcessParams) {\n const utils = key.includes(\"/\") ? newUtils : legacyUtils;\n\n // 1. Get optimized image key.\n await s3.deleteObject(getObjectParams(utils.getImageKey({ key })));\n\n if (!utils.SUPPORTED_TRANSFORMABLE_IMAGES.includes(extension)) {\n return;\n }\n\n /**\n * Search for all transformed images and delete those too.\n *\n * For new keys, we take the entire path, up to, but not including, the file name:\n * - demo-pages/60228148f98841000981c724/welcome-to-webiny__idp.svg\n * - 60228148f98841000981c724/welcome-to-webiny__idp.svg\n *\n * Legacy keys don't have sub-folders:\n * - 8ldc5n3w2-custom-field-renderers.mp4\n */\n\n const prefix = isLegacyKey(key)\n ? utils.getOptimizedImageKeyPrefix(key)\n : dirname(key) + \"/\";\n\n const env = getEnvironment();\n const imagesList = await s3.listObjects({\n Bucket: env.bucket,\n Prefix: prefix\n });\n\n if (!imagesList.Contents) {\n return;\n }\n\n for (const imageObject of imagesList.Contents) {\n if (!imageObject.Key) {\n continue;\n }\n await s3.deleteObject(getObjectParams(imageObject.Key));\n }\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,uBAAA,CAAAH,OAAA;AAEA,MAAMK,WAAW,GAAIC,GAAW,IAAK;EACjC,OAAO,CAACA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC;AAC7B,CAAC;AAWM,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,G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,IAAI,CAACK,UAAU,CAACK,QAAQ,EAAE;MACtB;IACJ;IAEA,KAAK,MAAMC,WAAW,IAAIN,UAAU,CAACK,QAAQ,EAAE;MAC3C,IAAI,CAACC,WAAW,CAACC,GAAG,EAAE;QAClB;MACJ;MACA,MAAMjB,EAAE,CAACC,YAAY,CAAC,IAAAC,sBAAe,EAACc,WAAW,CAACC,GAAG,CAAC,CAAC;IAC3D;EACJ;AACJ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_path","require","_utils","newUtils","_interopRequireWildcard","legacyUtils","isLegacyKey","key","includes","imageManager","exports","canProcess","params","extension","utils","SUPPORTED_IMAGES","startsWith","OPTIMIZED_IMAGE_PREFIX","OPTIMIZED_TRANSFORMED_IMAGE_PREFIX","process","s3","deleteObject","getObjectParams","getImageKey","SUPPORTED_TRANSFORMABLE_IMAGES","prefix","getOptimizedImageKeyPrefix","dirname","env","getEnvironment","imagesList","listObjects","Bucket","bucket","Prefix","Contents","imageObject","Key"],"sources":["imageManager.ts"],"sourcesContent":["import { dirname } from \"path\";\nimport type { S3 } from \"@webiny/aws-sdk/client-s3\";\nimport { getObjectParams, getEnvironment } from \"~/handlers/utils\";\nimport * as newUtils from \"./utils\";\nimport * as legacyUtils from \"./legacyUtils\";\n\nconst isLegacyKey = (key: string) => {\n return !key.includes(\"/\");\n};\n\nexport interface ImageManagerCanProcessParams {\n key: string;\n extension: string;\n}\nexport interface ImageManagerProcessParams {\n s3: S3;\n key: string;\n extension: string;\n}\nexport const imageManager = {\n canProcess: (params: ImageManagerCanProcessParams) => {\n const { key, extension } = params;\n const utils = key.includes(\"/\") ? newUtils : legacyUtils;\n\n if (!utils.SUPPORTED_IMAGES.includes(extension)) {\n return false;\n }\n\n // We only want to process original images, and delete all variations of it at once.\n // We DO NOT want to process the event for the deletion of an optimized/transformed image.\n // Unfortunately, there's no way to filter those events on the S3 bucket itself, so we have to do it this way.\n return !(\n key.startsWith(utils.OPTIMIZED_IMAGE_PREFIX) ||\n key.startsWith(utils.OPTIMIZED_TRANSFORMED_IMAGE_PREFIX)\n );\n },\n async process({ s3, key, extension }: ImageManagerProcessParams) {\n const utils = key.includes(\"/\") ? newUtils : legacyUtils;\n\n // 1. Get optimized image key.\n await s3.deleteObject(getObjectParams(utils.getImageKey({ key })));\n\n if (!utils.SUPPORTED_TRANSFORMABLE_IMAGES.includes(extension)) {\n return;\n }\n\n /**\n * Search for all transformed images and delete those too.\n *\n * For new keys, we take the entire path, up to, but not including, the file name:\n * - demo-pages/60228148f98841000981c724/welcome-to-webiny__idp.svg\n * - 60228148f98841000981c724/welcome-to-webiny__idp.svg\n *\n * Legacy keys don't have sub-folders:\n * - 8ldc5n3w2-custom-field-renderers.mp4\n */\n\n const prefix = isLegacyKey(key)\n ? utils.getOptimizedImageKeyPrefix(key)\n : dirname(key) + \"/\";\n\n const env = getEnvironment();\n const imagesList = await s3.listObjects({\n Bucket: env.bucket,\n Prefix: prefix\n });\n\n if (!imagesList.Contents) {\n return;\n }\n\n for (const imageObject of imagesList.Contents) {\n if (!imageObject.Key) {\n continue;\n }\n await s3.deleteObject(getObjectParams(imageObject.Key));\n }\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,uBAAA,CAAAH,OAAA;AAEA,MAAMK,WAAW,GAAIC,GAAW,IAAK;EACjC,OAAO,CAACA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC;AAC7B,CAAC;AAWM,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EACxBE,UAAU,EAAGC,MAAoC,IAAK;IAClD,MAAM;MAAEL,GAAG;MAAEM;IAAU,CAAC,GAAGD,MAAM;IACjC,MAAME,KAAK,GAAGP,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGL,QAAQ,GAAGE,WAAW;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C,YAAY,CAAC,IAAAC,sBAAe,EAACc,WAAW,CAACC,GAAG,CAAC,CAAC;IAC3D;EACJ;AACJ,CAAC","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
|
2
2
|
import type { FileManagerContext } from "./types";
|
|
3
|
-
import { AssetDeliveryParams } from "./delivery/setupAssetDelivery";
|
|
3
|
+
import type { AssetDeliveryParams } from "./delivery/setupAssetDelivery";
|
|
4
4
|
import type { FileManagerConfig } from "./createFileManager/types";
|
|
5
5
|
export * from "./modelModifier/CmsModelModifier";
|
|
6
6
|
export * from "./plugins";
|
|
7
7
|
export * from "./delivery";
|
|
8
8
|
export declare const createFileManagerContext: ({ storageOperations }: Pick<FileManagerConfig, "storageOperations">) => ContextPlugin<FileManagerContext>;
|
|
9
9
|
export declare const createFileManagerGraphQL: () => (import("@webiny/handler-graphql").GraphQLSchemaPlugin<FileManagerContext> | ContextPlugin<FileManagerContext>)[];
|
|
10
|
-
export declare const createAssetDelivery: (config: AssetDeliveryParams) => (import("
|
|
10
|
+
export declare const createAssetDelivery: (config: AssetDeliveryParams) => (import("@webiny/handler").ModifyFastifyPlugin | import("./delivery").AssetDeliveryConfigModifierPlugin)[];
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_api","require","_FileManagerContextSetup","_setupAssetDelivery","_graphql","_applyThreatScanning","_CmsModelModifier","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_plugins","_delivery","createFileManagerContext","storageOperations","plugin","ContextPlugin","context","fmContext","FileManagerContextSetup","fileManager","setupContext","wcp","canUseFileManagerThreatDetection","applyThreatScanning","name","createFileManagerGraphQL","createGraphQLSchemaPlugin","createAssetDelivery","config","setupAssetDelivery"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { FileManagerContext } from \"~/types\";\nimport { FileManagerContextSetup } from \"./FileManagerContextSetup\";\nimport { AssetDeliveryParams
|
|
1
|
+
{"version":3,"names":["_api","require","_FileManagerContextSetup","_setupAssetDelivery","_graphql","_applyThreatScanning","_CmsModelModifier","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_plugins","_delivery","createFileManagerContext","storageOperations","plugin","ContextPlugin","context","fmContext","FileManagerContextSetup","fileManager","setupContext","wcp","canUseFileManagerThreatDetection","applyThreatScanning","name","createFileManagerGraphQL","createGraphQLSchemaPlugin","createAssetDelivery","config","setupAssetDelivery"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { FileManagerContext } from \"~/types\";\nimport { FileManagerContextSetup } from \"./FileManagerContextSetup\";\nimport type { AssetDeliveryParams } from \"./delivery/setupAssetDelivery\";\nimport { setupAssetDelivery } from \"./delivery/setupAssetDelivery\";\nimport { createGraphQLSchemaPlugin } from \"./graphql\";\nimport { applyThreatScanning } from \"./enterprise/applyThreatScanning\";\nimport type { FileManagerConfig } from \"./createFileManager/types\";\n\nexport * from \"./modelModifier/CmsModelModifier\";\nexport * from \"./plugins\";\nexport * from \"./delivery\";\n\nexport const createFileManagerContext = ({\n storageOperations\n}: Pick<FileManagerConfig, \"storageOperations\">) => {\n const plugin = new ContextPlugin<FileManagerContext>(async context => {\n const fmContext = new FileManagerContextSetup(context);\n context.fileManager = await fmContext.setupContext(storageOperations);\n\n if (context.wcp.canUseFileManagerThreatDetection()) {\n context.fileManager = applyThreatScanning(context.fileManager);\n }\n });\n\n plugin.name = \"file-manager.createContext\";\n\n return plugin;\n};\n\nexport const createFileManagerGraphQL = () => {\n return createGraphQLSchemaPlugin();\n};\n\nexport const createAssetDelivery = (config: AssetDeliveryParams) => {\n return setupAssetDelivery(config);\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAD,OAAA;AAEA,IAAAE,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,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,SAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,SAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAEO,MAAMW,wBAAwB,GAAGA,CAAC;EACrCC;AAC0C,CAAC,KAAK;EAChD,MAAMC,MAAM,GAAG,IAAIC,kBAAa,CAAqB,MAAMC,OAAO,IAAI;IAClE,MAAMC,SAAS,GAAG,IAAIC,gDAAuB,CAACF,OAAO,CAAC;IACtDA,OAAO,CAACG,WAAW,GAAG,MAAMF,SAAS,CAACG,YAAY,CAACP,iBAAiB,CAAC;IAErE,IAAIG,OAAO,CAACK,GAAG,CAACC,gCAAgC,CAAC,CAAC,EAAE;MAChDN,OAAO,CAACG,WAAW,GAAG,IAAAI,wCAAmB,EAACP,OAAO,CAACG,WAAW,CAAC;IAClE;EACJ,CAAC,CAAC;EAEFL,MAAM,CAACU,IAAI,GAAG,4BAA4B;EAE1C,OAAOV,MAAM;AACjB,CAAC;AAACR,OAAA,CAAAM,wBAAA,GAAAA,wBAAA;AAEK,MAAMa,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,OAAO,IAAAC,kCAAyB,EAAC,CAAC;AACtC,CAAC;AAACpB,OAAA,CAAAmB,wBAAA,GAAAA,wBAAA;AAEK,MAAME,mBAAmB,GAAIC,MAA2B,IAAK;EAChE,OAAO,IAAAC,sCAAkB,EAACD,MAAM,CAAC;AACrC,CAAC;AAACtB,OAAA,CAAAqB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import { CmsModelField as BaseModelField } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import { CmsPrivateModelFull } from "@webiny/api-headless-cms";
|
|
2
|
+
import type { CmsModelField as BaseModelField } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import type { CmsPrivateModelFull } from "@webiny/api-headless-cms";
|
|
4
4
|
type CmsModelField = Omit<BaseModelField, "storageId"> & {
|
|
5
5
|
bulkEdit?: boolean;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","_apiHeadlessCms","_file","CmsModelFieldsModifier","constructor","fields","addField","field","bulkEdit","tags","rest","push","concat","storageId","type","id","CmsModelModifierPlugin","Plugin","modelId","cb","modifyModel","model","extensionsField","find","fieldId","createModelField","label","settings","layout","modifier","exports","createFileModelModifier","FILE_MODEL_ID"],"sources":["CmsModelModifier.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsModelField as BaseModelField } from \"@webiny/api-headless-cms/types\";\nimport { CmsPrivateModelFull
|
|
1
|
+
{"version":3,"names":["_plugins","require","_apiHeadlessCms","_file","CmsModelFieldsModifier","constructor","fields","addField","field","bulkEdit","tags","rest","push","concat","storageId","type","id","CmsModelModifierPlugin","Plugin","modelId","cb","modifyModel","model","extensionsField","find","fieldId","createModelField","label","settings","layout","modifier","exports","createFileModelModifier","FILE_MODEL_ID"],"sources":["CmsModelModifier.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsModelField as BaseModelField } from \"@webiny/api-headless-cms/types\";\nimport type { CmsPrivateModelFull } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"@webiny/api-headless-cms\";\nimport { FILE_MODEL_ID } from \"~/cmsFileStorage/file.model\";\n\ntype CmsModelField = Omit<BaseModelField, \"storageId\"> & { bulkEdit?: boolean };\n\nclass CmsModelFieldsModifier {\n private fields: BaseModelField[];\n\n constructor(fields: BaseModelField[]) {\n this.fields = fields;\n }\n\n addField(field: CmsModelField) {\n const { bulkEdit, tags, ...rest } = field;\n\n this.fields.push({\n ...rest,\n tags: (tags ?? []).concat(bulkEdit ? [\"$bulk-edit\"] : []),\n storageId: `${field.type}@${field.id}`\n });\n }\n}\n\ninterface CmsModelModifierCallableParams {\n modifier: CmsModelFieldsModifier;\n}\n\ninterface CmsModelModifierCallable {\n (params: CmsModelModifierCallableParams): Promise<void> | void;\n}\n\nexport class CmsModelModifierPlugin extends Plugin {\n public static override type = \"fm.cms-model-modifier\";\n private readonly modelId: string;\n private readonly cb: CmsModelModifierCallable;\n\n constructor(modelId: string, cb: CmsModelModifierCallable) {\n super();\n this.modelId = modelId;\n this.cb = cb;\n }\n\n async modifyModel(model: CmsPrivateModelFull): Promise<void> {\n if (model.modelId !== this.modelId) {\n return;\n }\n\n let extensionsField = model.fields.find(field => field.fieldId === \"extensions\");\n if (!extensionsField) {\n extensionsField = createModelField({\n label: \"Extensions\",\n type: \"object\",\n settings: {\n layout: [],\n fields: []\n }\n });\n model.fields.push(extensionsField);\n }\n\n const modifier = new CmsModelFieldsModifier(extensionsField.settings!.fields!);\n await this.cb({ modifier });\n }\n}\n\nexport const createFileModelModifier = (cb: CmsModelModifierCallable) => {\n return new CmsModelModifierPlugin(FILE_MODEL_ID, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAIA,MAAMG,sBAAsB,CAAC;EAGzBC,WAAWA,CAACC,MAAwB,EAAE;IAClC,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEAC,QAAQA,CAACC,KAAoB,EAAE;IAC3B,MAAM;MAAEC,QAAQ;MAAEC,IAAI;MAAE,GAAGC;IAAK,CAAC,GAAGH,KAAK;IAEzC,IAAI,CAACF,MAAM,CAACM,IAAI,CAAC;MACb,GAAGD,IAAI;MACPD,IAAI,EAAE,CAACA,IAAI,IAAI,EAAE,EAAEG,MAAM,CAACJ,QAAQ,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;MACzDK,SAAS,EAAE,GAAGN,KAAK,CAACO,IAAI,IAAIP,KAAK,CAACQ,EA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3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fm:base"
|
|
@@ -18,27 +18,27 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@webiny/api": "
|
|
22
|
-
"@webiny/api-headless-cms": "
|
|
23
|
-
"@webiny/api-security": "
|
|
24
|
-
"@webiny/api-tenancy": "
|
|
25
|
-
"@webiny/aws-sdk": "
|
|
26
|
-
"@webiny/error": "
|
|
27
|
-
"@webiny/handler": "
|
|
28
|
-
"@webiny/handler-aws": "
|
|
29
|
-
"@webiny/handler-graphql": "
|
|
30
|
-
"@webiny/plugins": "
|
|
31
|
-
"@webiny/project-utils": "
|
|
32
|
-
"@webiny/pubsub": "
|
|
33
|
-
"@webiny/tasks": "
|
|
21
|
+
"@webiny/api": "6.0.0-alpha.1",
|
|
22
|
+
"@webiny/api-headless-cms": "6.0.0-alpha.1",
|
|
23
|
+
"@webiny/api-security": "6.0.0-alpha.1",
|
|
24
|
+
"@webiny/api-tenancy": "6.0.0-alpha.1",
|
|
25
|
+
"@webiny/aws-sdk": "6.0.0-alpha.1",
|
|
26
|
+
"@webiny/error": "6.0.0-alpha.1",
|
|
27
|
+
"@webiny/handler": "6.0.0-alpha.1",
|
|
28
|
+
"@webiny/handler-aws": "6.0.0-alpha.1",
|
|
29
|
+
"@webiny/handler-graphql": "6.0.0-alpha.1",
|
|
30
|
+
"@webiny/plugins": "6.0.0-alpha.1",
|
|
31
|
+
"@webiny/project-utils": "6.0.0-alpha.1",
|
|
32
|
+
"@webiny/pubsub": "6.0.0-alpha.1",
|
|
33
|
+
"@webiny/tasks": "6.0.0-alpha.1",
|
|
34
34
|
"cache-control-parser": "2.0.6",
|
|
35
35
|
"lodash": "4.17.21",
|
|
36
36
|
"object-hash": "3.0.0",
|
|
37
37
|
"zod": "3.23.8"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@webiny/api-i18n": "
|
|
41
|
-
"@webiny/utils": "
|
|
40
|
+
"@webiny/api-i18n": "6.0.0-alpha.1",
|
|
41
|
+
"@webiny/utils": "6.0.0-alpha.1",
|
|
42
42
|
"jest": "29.7.0",
|
|
43
43
|
"rimraf": "6.0.1",
|
|
44
44
|
"typescript": "5.3.3"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "9bd236cf5e689f209a11bec089207dcc2d41a53c"
|
|
65
65
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Plugin } from "@webiny/plugins";
|
|
4
|
-
import { FileManagerSettings } from "../types";
|
|
4
|
+
import type { FileManagerSettings } from "../types";
|
|
5
5
|
export interface FilePhysicalStoragePluginParams<U extends FilePhysicalStoragePluginUploadParams, D extends FilePhysicalStoragePluginDeleteParams> {
|
|
6
6
|
upload: (args: U) => Promise<any>;
|
|
7
7
|
delete: (args: D) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","_error","_interopRequireDefault","FilePhysicalStoragePlugin","Plugin","type","constructor","params","_params","upload","WebinyError","delete","exports"],"sources":["FilePhysicalStoragePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\nimport { FileManagerSettings } from \"~/types\";\n\nexport interface FilePhysicalStoragePluginParams<\n U extends FilePhysicalStoragePluginUploadParams,\n D extends FilePhysicalStoragePluginDeleteParams\n> {\n upload: (args: U) => Promise<any>;\n delete: (args: D) => Promise<void>;\n}\n\nexport interface FilePhysicalStoragePluginUploadParams {\n settings: FileManagerSettings;\n buffer: Buffer;\n}\n\nexport interface FilePhysicalStoragePluginDeleteParams {\n key: string;\n}\n\nexport class FilePhysicalStoragePlugin<\n U extends FilePhysicalStoragePluginUploadParams = FilePhysicalStoragePluginUploadParams,\n D extends FilePhysicalStoragePluginDeleteParams = FilePhysicalStoragePluginDeleteParams\n> extends Plugin {\n public static override readonly type: string = \"api-file-manager-storage\";\n private readonly _params: FilePhysicalStoragePluginParams<U, D>;\n\n public constructor(params: FilePhysicalStoragePluginParams<U, D>) {\n super();\n this._params = params;\n }\n\n public async upload(params: U): Promise<any> {\n if (!this._params.upload) {\n throw new WebinyError(\n `You must define the \"upload\" method of this plugin.`,\n \"UPLOAD_METHOD_ERROR\"\n );\n }\n return this._params.upload(params);\n }\n\n public async delete(params: D): Promise<any> {\n if (!this._params.delete) {\n throw new WebinyError(\n `You must define the \"delete\" method of this plugin.`,\n \"DELETE_METHOD_ERROR\"\n );\n }\n return this._params.delete(params);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAoBO,MAAMG,yBAAyB,SAG5BC,eAAM,CAAC;EACb,OAAgCC,IAAI,GAAW,0BAA0B;EAGlEC,WAAWA,CAACC,MAA6C,EAAE;IAC9D,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM;EACzB;EAEA,MAAaE,MAAMA,CAACF,MAAS,EAAgB;IACzC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACC,MAAM,EAAE;MACtB,MAAM,IAAIC,cAAW,CACjB,qDAAqD,EACrD,qBACJ,CAAC;IACL;IACA,OAAO,IAAI,CAACF,OAAO,CAACC,MAAM,CAACF,MAAM,CAAC;EACtC;EAEA,MAAaI,MAAMA,CAACJ,MAAS,EAAgB;IACzC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACG,MAAM,EAAE;MACtB,MAAM,IAAID,cAAW,CACjB,qDAAqD,EACrD,qBACJ,CAAC;IACL;IACA,OAAO,IAAI,CAACF,OAAO,CAACG,MAAM,CAACJ,MAAM,CAAC;EACtC;AACJ;AAACK,OAAA,CAAAT,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugins","require","_error","_interopRequireDefault","FilePhysicalStoragePlugin","Plugin","type","constructor","params","_params","upload","WebinyError","delete","exports"],"sources":["FilePhysicalStoragePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\nimport type { FileManagerSettings } from \"~/types\";\n\nexport interface FilePhysicalStoragePluginParams<\n U extends FilePhysicalStoragePluginUploadParams,\n D extends FilePhysicalStoragePluginDeleteParams\n> {\n upload: (args: U) => Promise<any>;\n delete: (args: D) => Promise<void>;\n}\n\nexport interface FilePhysicalStoragePluginUploadParams {\n settings: FileManagerSettings;\n buffer: Buffer;\n}\n\nexport interface FilePhysicalStoragePluginDeleteParams {\n key: string;\n}\n\nexport class FilePhysicalStoragePlugin<\n U extends FilePhysicalStoragePluginUploadParams = FilePhysicalStoragePluginUploadParams,\n D extends FilePhysicalStoragePluginDeleteParams = FilePhysicalStoragePluginDeleteParams\n> extends Plugin {\n public static override readonly type: string = \"api-file-manager-storage\";\n private readonly _params: FilePhysicalStoragePluginParams<U, D>;\n\n public constructor(params: FilePhysicalStoragePluginParams<U, D>) {\n super();\n this._params = params;\n }\n\n public async upload(params: U): Promise<any> {\n if (!this._params.upload) {\n throw new WebinyError(\n `You must define the \"upload\" method of this plugin.`,\n \"UPLOAD_METHOD_ERROR\"\n );\n }\n return this._params.upload(params);\n }\n\n public async delete(params: D): Promise<any> {\n if (!this._params.delete) {\n throw new WebinyError(\n `You must define the \"delete\" method of this plugin.`,\n \"DELETE_METHOD_ERROR\"\n );\n }\n return this._params.delete(params);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAoBO,MAAMG,yBAAyB,SAG5BC,eAAM,CAAC;EACb,OAAgCC,IAAI,GAAW,0BAA0B;EAGlEC,WAAWA,CAACC,MAA6C,EAAE;IAC9D,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGD,MAAM;EACzB;EAEA,MAAaE,MAAMA,CAACF,MAAS,EAAgB;IACzC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACC,MAAM,EAAE;MACtB,MAAM,IAAIC,cAAW,CACjB,qDAAqD,EACrD,qBACJ,CAAC;IACL;IACA,OAAO,IAAI,CAACF,OAAO,CAACC,MAAM,CAACF,MAAM,CAAC;EACtC;EAEA,MAAaI,MAAMA,CAACJ,MAAS,EAAgB;IACzC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACG,MAAM,EAAE;MACtB,MAAM,IAAID,cAAW,CACjB,qDAAqD,EACrD,qBACJ,CAAC;IACL;IACA,OAAO,IAAI,CAACF,OAAO,CAACG,MAAM,CAACJ,MAAM,CAAC;EACtC;AACJ;AAACK,OAAA,CAAAT,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","FileStorageTransformPlugin","Plugin","type","constructor","params","_params","toStorage","file","fromStorage","exports"],"sources":["FileStorageTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { File } from \"~/types\";\n\nexport interface FileStorageTransformPluginToParams {\n /**\n * File that is being sent to the storage operations method.\n */\n file: File & Record<string, any>;\n}\n\nexport interface FileStorageTransformPluginFromParams {\n /**\n * File that was fetched from the storage operations method.\n */\n file: File & Record<string, any>;\n}\n\nexport interface FileStorageTransformPluginParams {\n toStorage?: (params: FileStorageTransformPluginToParams) => Promise<File & Record<string, any>>;\n fromStorage?: (\n params: FileStorageTransformPluginFromParams\n ) => Promise<File & Record<string, any>>;\n}\n\nexport class FileStorageTransformPlugin extends Plugin {\n public static override readonly type: string = \"fm.files.storage.transform\";\n private readonly _params: FileStorageTransformPluginParams;\n\n public constructor(params: FileStorageTransformPluginParams) {\n super();\n\n this._params = params;\n }\n\n /**\n * Transform the file value into something that can be stored.\n * Be aware that you must return the whole file object.\n */\n public async toStorage(\n params: FileStorageTransformPluginToParams\n ): Promise<File & Record<string, any>> {\n if (!this._params.toStorage) {\n return params.file;\n }\n return this._params.toStorage(params);\n }\n /**\n * Transform the file value from the storage type to one required by our system.\n * Be aware that you must return the whole file object.\n * This method MUST reverse what ever toStorage method changed on the file object.\n */\n public async fromStorage(\n params: FileStorageTransformPluginFromParams\n ): Promise<File & Record<string, any>> {\n if (!this._params.fromStorage) {\n return params.file;\n }\n return this._params.fromStorage(params);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAwBO,MAAMC,0BAA0B,SAASC,eAAM,CAAC;EACnD,OAAgCC,IAAI,GAAW,4BAA4B;EAGpEC,WAAWA,CAACC,MAAwC,EAAE;IACzD,KAAK,CAAC,CAAC;IAEP,IAAI,CAACC,OAAO,GAAGD,MAAM;EACzB;;EAEA;AACJ;AACA;AACA;EACI,MAAaE,SAASA,CAClBF,MAA0C,EACP;IACnC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACC,SAAS,EAAE;MACzB,OAAOF,MAAM,CAACG,IAAI;IACtB;IACA,OAAO,IAAI,CAACF,OAAO,CAACC,SAAS,CAACF,MAAM,CAAC;EACzC;EACA;AACJ;AACA;AACA;AACA;EACI,MAAaI,WAAWA,CACpBJ,MAA4C,EACT;IACnC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACG,WAAW,EAAE;MAC3B,OAAOJ,MAAM,CAACG,IAAI;IACtB;IACA,OAAO,IAAI,CAACF,OAAO,CAACG,WAAW,CAACJ,MAAM,CAAC;EAC3C;AACJ;AAACK,OAAA,CAAAT,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_plugins","require","FileStorageTransformPlugin","Plugin","type","constructor","params","_params","toStorage","file","fromStorage","exports"],"sources":["FileStorageTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { File } from \"~/types\";\n\nexport interface FileStorageTransformPluginToParams {\n /**\n * File that is being sent to the storage operations method.\n */\n file: File & Record<string, any>;\n}\n\nexport interface FileStorageTransformPluginFromParams {\n /**\n * File that was fetched from the storage operations method.\n */\n file: File & Record<string, any>;\n}\n\nexport interface FileStorageTransformPluginParams {\n toStorage?: (params: FileStorageTransformPluginToParams) => Promise<File & Record<string, any>>;\n fromStorage?: (\n params: FileStorageTransformPluginFromParams\n ) => Promise<File & Record<string, any>>;\n}\n\nexport class FileStorageTransformPlugin extends Plugin {\n public static override readonly type: string = \"fm.files.storage.transform\";\n private readonly _params: FileStorageTransformPluginParams;\n\n public constructor(params: FileStorageTransformPluginParams) {\n super();\n\n this._params = params;\n }\n\n /**\n * Transform the file value into something that can be stored.\n * Be aware that you must return the whole file object.\n */\n public async toStorage(\n params: FileStorageTransformPluginToParams\n ): Promise<File & Record<string, any>> {\n if (!this._params.toStorage) {\n return params.file;\n }\n return this._params.toStorage(params);\n }\n /**\n * Transform the file value from the storage type to one required by our system.\n * Be aware that you must return the whole file object.\n * This method MUST reverse what ever toStorage method changed on the file object.\n */\n public async fromStorage(\n params: FileStorageTransformPluginFromParams\n ): Promise<File & Record<string, any>> {\n if (!this._params.fromStorage) {\n return params.file;\n }\n return this._params.fromStorage(params);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAwBO,MAAMC,0BAA0B,SAASC,eAAM,CAAC;EACnD,OAAgCC,IAAI,GAAW,4BAA4B;EAGpEC,WAAWA,CAACC,MAAwC,EAAE;IACzD,KAAK,CAAC,CAAC;IAEP,IAAI,CAACC,OAAO,GAAGD,MAAM;EACzB;;EAEA;AACJ;AACA;AACA;EACI,MAAaE,SAASA,CAClBF,MAA0C,EACP;IACnC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACC,SAAS,EAAE;MACzB,OAAOF,MAAM,CAACG,IAAI;IACtB;IACA,OAAO,IAAI,CAACF,OAAO,CAACC,SAAS,CAACF,MAAM,CAAC;EACzC;EACA;AACJ;AACA;AACA;AACA;EACI,MAAaI,WAAWA,CACpBJ,MAA4C,EACT;IACnC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACG,WAAW,EAAE;MAC3B,OAAOJ,MAAM,CAACG,IAAI;IACtB;IACA,OAAO,IAAI,CAACF,OAAO,CAACG,WAAW,CAACJ,MAAM,CAAC;EAC3C;AACJ;AAACK,OAAA,CAAAT,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
package/storage/FileStorage.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { FileManagerContext } from "../types";
|
|
4
|
-
import { FilePhysicalStoragePlugin } from "../plugins/FilePhysicalStoragePlugin";
|
|
3
|
+
import type { FileManagerContext } from "../types";
|
|
4
|
+
import type { FilePhysicalStoragePlugin } from "../plugins/FilePhysicalStoragePlugin";
|
|
5
5
|
export type Result = Record<string, any>;
|
|
6
6
|
export interface FileStorageUploadParams {
|
|
7
7
|
buffer: Buffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","storagePluginType","FileStorage","constructor","context","storagePlugin","plugins","byType","pop","WebinyError","upload","params","settings","fileManager","getSettings","file","fileData","createFile","meta","private","Boolean","hideInFileManager","tags","Array","isArray","uploadFiles","files","filesData","Promise","all","map","item","createFilesInBatch","delete","id","key","deleteFile","exports"],"sources":["FileStorage.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { FilePhysicalStoragePlugin } from \"~/plugins/FilePhysicalStoragePlugin\";\n\nexport type Result = Record<string, any>;\n\nconst storagePluginType = \"api-file-manager-storage\";\n\nexport interface FileStorageUploadParams {\n buffer: Buffer;\n hideInFileManager: boolean | string;\n size: number;\n name: string;\n type: string;\n id?: string;\n key?: string;\n tags?: string[];\n keyPrefix?: string;\n}\nexport interface FileStorageDeleteParams {\n id: string;\n key: string;\n}\n\nexport interface FileStorageUploadMultipleParams {\n files: FileStorageUploadParams[];\n}\n\nexport interface FileStorageParams {\n context: FileManagerContext;\n}\nexport class FileStorage {\n private readonly context: FileManagerContext;\n\n constructor({ context }: FileStorageParams) {\n this.context = context;\n }\n\n get storagePlugin() {\n const storagePlugin = this.context.plugins\n .byType<FilePhysicalStoragePlugin>(storagePluginType)\n .pop();\n\n if (!storagePlugin) {\n throw new WebinyError(\n `Missing plugin of type \"${storagePluginType}\".`,\n \"STORAGE_PLUGIN_ERROR\"\n );\n }\n\n return storagePlugin;\n }\n\n async upload(params: FileStorageUploadParams): Promise<Result> {\n const settings = await this.context.fileManager.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n\n // Add file to cloud storage.\n const { file: fileData } = await this.storagePlugin.upload({\n ...params,\n settings\n });\n\n // Save file in DB.\n return this.context.fileManager.createFile({\n ...fileData,\n meta: {\n private: Boolean(params.hideInFileManager)\n },\n tags: Array.isArray(params.tags) ? params.tags : []\n });\n }\n\n async uploadFiles({ files }: FileStorageUploadMultipleParams) {\n const settings = await this.context.fileManager.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n\n const filesData = await Promise.all(\n files.map(async item => {\n // TODO: improve types of this.storagePlugin.\n const { file } = await this.storagePlugin.upload({\n ...item,\n settings\n });\n\n return {\n ...file,\n meta: {\n private: Boolean(item.hideInFileManager)\n },\n tags: Array.isArray(item.tags) ? item.tags : []\n };\n })\n );\n\n return this.context.fileManager.createFilesInBatch(filesData);\n }\n\n async delete(params: FileStorageDeleteParams) {\n const { id, key } = params;\n const { fileManager } = this.context;\n // Delete file from cloud storage.\n await this.storagePlugin.delete({\n key\n });\n\n // Delete file from the DB.\n return await fileManager.deleteFile(id);\n }\n}\n"],"mappings":";;;;;;;AACA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,CAACR,OAAO,CAACS,WAAW,CAACC,WAAW,CAAC,CAAC;IAC7D,IAAI,CAACF,QAAQ,EAAE;MACX,MAAM,IAAIH,cAAW,CAAC,gCAAgC,EAAE,oBAAoB,CAAC;IACjF;IAEA,MAAMkB,SAAS,GAAG,MAAMC,OAAO,CAACC,GAAG,CAC/BH,KAAK,CAACI,GAAG,CAAC,MAAMC,IAAI,IAAI;MACpB;MACA,MAAM;QAAEhB;MAAK,CAAC,GAAG,MAAM,IAAI,CAACV,aAAa,CAACK,MAAM,CAAC;QAC7C,GAAGqB,IAAI;QACPnB;MACJ,CAAC,CAAC;MAEF,OAAO;QACH,GAAGG,IAAI;QACPG,IAAI,EAAE;UACFC,OAAO,EAAEC,OAAO,CAACW,IAAI,CAACV,iBAAiB;QAC3C,CAAC;QACDC,IAAI,EAAEC,KAAK,CAACC,OAAO,CAACO,IAAI,CAACT,IAAI,CAAC,GAAGS,IAAI,CAACT,IAAI,GAAG;MACjD,CAAC;IACL,CAAC,CACL,CAAC;IAED,OAAO,IAAI,CAAClB,OAAO,CAACS,WAAW,CAACmB,kBAAkB,CAACL,SAAS,CAAC;EACjE;EAEA,MAAMM,MAAMA,CAACtB,MAA+B,EAAE;IAC1C,MAAM;MAAEuB,EAAE;MAAEC;IAAI,CAAC,GAAGxB,MAAM;IAC1B,MAAM;MAAEE;IAAY,CAAC,GAAG,IAAI,CAACT,OAAO;IACpC;IACA,MAAM,IAAI,CAACC,aAAa,CAAC4B,MAAM,CAAC;MAC5BE;IACJ,CAAC,CAAC;;IAEF;IACA,OAAO,MAAMtB,WAAW,CAACuB,UAAU,CAACF,EAAE,CAAC;EAC3C;AACJ;AAACG,OAAA,CAAAnC,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","storagePluginType","FileStorage","constructor","context","storagePlugin","plugins","byType","pop","WebinyError","upload","params","settings","fileManager","getSettings","file","fileData","createFile","meta","private","Boolean","hideInFileManager","tags","Array","isArray","uploadFiles","files","filesData","Promise","all","map","item","createFilesInBatch","delete","id","key","deleteFile","exports"],"sources":["FileStorage.ts"],"sourcesContent":["import type { FileManagerContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport type { FilePhysicalStoragePlugin } from \"~/plugins/FilePhysicalStoragePlugin\";\n\nexport type Result = Record<string, any>;\n\nconst storagePluginType = \"api-file-manager-storage\";\n\nexport interface FileStorageUploadParams {\n buffer: Buffer;\n hideInFileManager: boolean | string;\n size: number;\n name: string;\n type: string;\n id?: string;\n key?: string;\n tags?: string[];\n keyPrefix?: string;\n}\nexport interface FileStorageDeleteParams {\n id: string;\n key: string;\n}\n\nexport interface FileStorageUploadMultipleParams {\n files: FileStorageUploadParams[];\n}\n\nexport interface FileStorageParams {\n context: FileManagerContext;\n}\nexport class FileStorage {\n private readonly context: FileManagerContext;\n\n constructor({ context }: FileStorageParams) {\n this.context = context;\n }\n\n get storagePlugin() {\n const storagePlugin = this.context.plugins\n .byType<FilePhysicalStoragePlugin>(storagePluginType)\n .pop();\n\n if (!storagePlugin) {\n throw new WebinyError(\n `Missing plugin of type \"${storagePluginType}\".`,\n \"STORAGE_PLUGIN_ERROR\"\n );\n }\n\n return storagePlugin;\n }\n\n async upload(params: FileStorageUploadParams): Promise<Result> {\n const settings = await this.context.fileManager.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n\n // Add file to cloud storage.\n const { file: fileData } = await this.storagePlugin.upload({\n ...params,\n settings\n });\n\n // Save file in DB.\n return this.context.fileManager.createFile({\n ...fileData,\n meta: {\n private: Boolean(params.hideInFileManager)\n },\n tags: Array.isArray(params.tags) ? params.tags : []\n });\n }\n\n async uploadFiles({ files }: FileStorageUploadMultipleParams) {\n const settings = await this.context.fileManager.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n\n const filesData = await Promise.all(\n files.map(async item => {\n // TODO: improve types of this.storagePlugin.\n const { file } = await this.storagePlugin.upload({\n ...item,\n settings\n });\n\n return {\n ...file,\n meta: {\n private: Boolean(item.hideInFileManager)\n },\n tags: Array.isArray(item.tags) ? item.tags : []\n };\n })\n );\n\n return this.context.fileManager.createFilesInBatch(filesData);\n }\n\n async delete(params: FileStorageDeleteParams) {\n const { id, key } = params;\n const { fileManager } = this.context;\n // Delete file from cloud storage.\n await this.storagePlugin.delete({\n key\n });\n\n // Delete file from the DB.\n return await fileManager.deleteFile(id);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,MAAMC,iBAAiB,GAAG,0BAA0B;AAyB7C,MAAMC,WAAW,CAAC;EAGrBC,WAAWA,CAAC;IAAEC;EAA2B,CAAC,EAAE;IACxC,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;EAEA,IAAIC,aAAaA,CAAA,EAAG;IAChB,MAAMA,aAAa,GAAG,IAAI,CAACD,OAAO,CAACE,OAAO,CACrCC,MAAM,CAA4BN,iBAAiB,CAAC,CACpDO,GAAG,CAAC,CAAC;IAEV,IAAI,CAACH,aAAa,EAAE;MAChB,MAAM,IAAII,cAAW,CACjB,2BAA2BR,iBAAiB,IAAI,EAChD,sBACJ,CAAC;IACL;IAEA,OAAOI,aAAa;EACxB;EAEA,MAAMK,MAAMA,CAACC,MAA+B,EAAmB;IAC3D,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACR,OAAO,CAACS,WAAW,CAACC,WAAW,CAAC,CAAC;IAC7D,IAAI,CAACF,QAAQ,EAAE;MACX,MAAM,IAAIH,cAAW,CAAC,gCAAgC,EAAE,oBAAoB,CAAC;IACjF;;IAEA;IACA,MAAM;MAAEM,IAAI,EAAEC;IAAS,CAAC,GAAG,MAAM,IAAI,CAACX,aAAa,CAACK,MAAM,CAAC;MACvD,GAAGC,MAAM;MACTC;IACJ,CAAC,CAAC;;IAEF;IACA,OAAO,IAAI,CAAC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A,MAAM,IAAI,CAACC,aAAa,CAAC4B,MAAM,CAAC;MAC5BE;IACJ,CAAC,CAAC;;IAEF;IACA,OAAO,MAAMtB,WAAW,CAACuB,UAAU,CAACF,EAAE,CAAC;EAC3C;AACJ;AAACG,OAAA,CAAAnC,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Topic } from "@webiny/pubsub/types";
|
|
2
|
-
import { File } from "./file";
|
|
1
|
+
import type { Topic } from "@webiny/pubsub/types";
|
|
2
|
+
import type { File } from "./file";
|
|
3
3
|
export interface OnFileBeforeCreateTopicParams<TFile extends File = File> {
|
|
4
4
|
file: TFile;
|
|
5
5
|
meta?: Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["file.lifecycle.ts"],"sourcesContent":["import { Topic } from \"@webiny/pubsub/types\";\nimport { File } from \"./file\";\n\nexport interface OnFileBeforeCreateTopicParams<TFile extends File = File> {\n file: TFile;\n meta?: Record<string, any>;\n}\n\nexport interface OnFileAfterCreateTopicParams<TFile extends File = File> {\n file: TFile;\n meta?: Record<string, any>;\n}\n\nexport interface OnFileBeforeBatchCreateTopicParams<TFile extends File = File> {\n files: TFile[];\n meta?: Record<string, any>;\n}\n\nexport interface OnFileAfterBatchCreateTopicParams<TFile extends File = File> {\n files: TFile[];\n meta?: Record<string, any>;\n}\n\nexport interface OnFileBeforeUpdateTopicParams<TFile extends File = File> {\n original: TFile;\n file: TFile;\n input: Record<string, any>;\n}\n\nexport interface OnFileAfterUpdateTopicParams<TFile extends File = File> {\n original: TFile;\n file: TFile;\n input: Record<string, any>;\n}\n\nexport interface OnFileBeforeDeleteTopicParams<TFile extends File = File> {\n file: TFile;\n}\n\nexport interface OnFileAfterDeleteTopicParams<TFile extends File = File> {\n file: TFile;\n}\n\nexport interface FileLifecycleEvents {\n onFileBeforeCreate: Topic<OnFileBeforeCreateTopicParams>;\n onFileAfterCreate: Topic<OnFileAfterCreateTopicParams>;\n onFileBeforeBatchCreate: Topic<OnFileBeforeBatchCreateTopicParams>;\n onFileAfterBatchCreate: Topic<OnFileAfterBatchCreateTopicParams>;\n onFileBeforeUpdate: Topic<OnFileBeforeUpdateTopicParams>;\n onFileAfterUpdate: Topic<OnFileAfterUpdateTopicParams>;\n onFileBeforeDelete: Topic<OnFileBeforeDeleteTopicParams>;\n onFileAfterDelete: Topic<OnFileAfterDeleteTopicParams>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["file.lifecycle.ts"],"sourcesContent":["import type { Topic } from \"@webiny/pubsub/types\";\nimport type { File } from \"./file\";\n\nexport interface OnFileBeforeCreateTopicParams<TFile extends File = File> {\n file: TFile;\n meta?: Record<string, any>;\n}\n\nexport interface OnFileAfterCreateTopicParams<TFile extends File = File> {\n file: TFile;\n meta?: Record<string, any>;\n}\n\nexport interface OnFileBeforeBatchCreateTopicParams<TFile extends File = File> {\n files: TFile[];\n meta?: Record<string, any>;\n}\n\nexport interface OnFileAfterBatchCreateTopicParams<TFile extends File = File> {\n files: TFile[];\n meta?: Record<string, any>;\n}\n\nexport interface OnFileBeforeUpdateTopicParams<TFile extends File = File> {\n original: TFile;\n file: TFile;\n input: Record<string, any>;\n}\n\nexport interface OnFileAfterUpdateTopicParams<TFile extends File = File> {\n original: TFile;\n file: TFile;\n input: Record<string, any>;\n}\n\nexport interface OnFileBeforeDeleteTopicParams<TFile extends File = File> {\n file: TFile;\n}\n\nexport interface OnFileAfterDeleteTopicParams<TFile extends File = File> {\n file: TFile;\n}\n\nexport interface FileLifecycleEvents {\n onFileBeforeCreate: Topic<OnFileBeforeCreateTopicParams>;\n onFileAfterCreate: Topic<OnFileAfterCreateTopicParams>;\n onFileBeforeBatchCreate: Topic<OnFileBeforeBatchCreateTopicParams>;\n onFileAfterBatchCreate: Topic<OnFileAfterBatchCreateTopicParams>;\n onFileBeforeUpdate: Topic<OnFileBeforeUpdateTopicParams>;\n onFileAfterUpdate: Topic<OnFileAfterUpdateTopicParams>;\n onFileBeforeDelete: Topic<OnFileBeforeDeleteTopicParams>;\n onFileAfterDelete: Topic<OnFileAfterDeleteTopicParams>;\n}\n"],"mappings":"","ignoreList":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { I18NContext } from "@webiny/api-i18n/types";
|
|
2
|
-
import { FileStorage } from "./storage/FileStorage";
|
|
3
|
-
import { TenancyContext } from "@webiny/api-tenancy/types";
|
|
4
|
-
import { SecurityContext, SecurityPermission } from "@webiny/api-security/types";
|
|
5
|
-
import { Context } from "@webiny/api/types";
|
|
6
|
-
import { FileLifecycleEvents } from "./types/file.lifecycle";
|
|
7
|
-
import { CreatedBy, File } from "./types/file";
|
|
8
|
-
import { Topic } from "@webiny/pubsub/types";
|
|
9
|
-
import { CmsContext, CmsEntryListSort } from "@webiny/api-headless-cms/types";
|
|
10
|
-
import { Context as TasksContext } from "@webiny/tasks/types";
|
|
1
|
+
import type { I18NContext } from "@webiny/api-i18n/types";
|
|
2
|
+
import type { FileStorage } from "./storage/FileStorage";
|
|
3
|
+
import type { TenancyContext } from "@webiny/api-tenancy/types";
|
|
4
|
+
import type { SecurityContext, SecurityPermission } from "@webiny/api-security/types";
|
|
5
|
+
import type { Context } from "@webiny/api/types";
|
|
6
|
+
import type { FileLifecycleEvents } from "./types/file.lifecycle";
|
|
7
|
+
import type { CreatedBy, File } from "./types/file";
|
|
8
|
+
import type { Topic } from "@webiny/pubsub/types";
|
|
9
|
+
import type { CmsContext, CmsEntryListSort } from "@webiny/api-headless-cms/types";
|
|
10
|
+
import type { Context as TasksContext } from "@webiny/tasks/types";
|
|
11
11
|
export * from "./types/file.lifecycle";
|
|
12
12
|
export * from "./types/file";
|
|
13
13
|
export * from "./types/file";
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_file","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_file2"],"sources":["types.ts"],"sourcesContent":["import { I18NContext } from \"@webiny/api-i18n/types\";\nimport { FileStorage } from \"./storage/FileStorage\";\nimport { TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { SecurityContext, SecurityPermission } from \"@webiny/api-security/types\";\nimport { Context } from \"@webiny/api/types\";\nimport { FileLifecycleEvents } from \"./types/file.lifecycle\";\nimport { CreatedBy, File } from \"./types/file\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsContext, CmsEntryListSort } from \"@webiny/api-headless-cms/types\";\nimport { Context as TasksContext } from \"@webiny/tasks/types\";\n\nexport * from \"./types/file.lifecycle\";\nexport * from \"./types/file\";\nexport * from \"./types/file\";\n\nexport interface FileManagerContextObject extends FilesCRUD, SettingsCRUD, SystemCRUD {\n storage: FileStorage;\n}\n\nexport interface FileManagerContext\n extends Context,\n SecurityContext,\n TenancyContext,\n I18NContext,\n CmsContext,\n TasksContext {\n fileManager: FileManagerContextObject;\n}\n\nexport interface FilePermission extends SecurityPermission {\n name: \"fm.file\";\n rwd?: string;\n own?: boolean;\n}\n\nexport interface SettingsPermission extends SecurityPermission {\n name: \"fm.setting\";\n}\n\nexport interface FileInput {\n id: string;\n\n // In the background, we're actually mapping these to entry-level fields.\n // This is fine since we don't use revisions for files.\n createdOn?: string | Date | null;\n modifiedOn?: string | Date | null;\n savedOn?: string | Date | null;\n createdBy?: CreatedBy | null;\n modifiedBy?: CreatedBy | null;\n savedBy?: CreatedBy | null;\n\n key: string;\n name: string;\n size: number;\n type: string;\n meta: Record<string, any>;\n location?: {\n folderId: string;\n };\n tags: string[];\n aliases: string[];\n extensions?: Record<string, any>;\n}\n\nexport interface FileListWhereParams {\n AND?: FileListWhereParams[];\n OR?: FileListWhereParams[];\n [key: string]: any;\n}\nexport interface FilesListOpts {\n search?: string;\n limit?: number;\n after?: string;\n where?: FileListWhereParams;\n sort?: CmsEntryListSort;\n}\n\nexport interface FileListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\ninterface FilesCrudListTagsWhere {\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n tag_not_startsWith?: string;\n tag_startsWith?: string;\n}\ninterface FilesCrudListTagsParams {\n where?: FilesCrudListTagsWhere;\n limit?: number;\n after?: string;\n}\n\nexport interface ListTagsResponse {\n tag: string;\n count: number;\n}\nexport interface FilesCRUD extends FileLifecycleEvents {\n getFile(id: string): Promise<File>;\n listFiles(opts?: FilesListOpts): Promise<[File[], FileListMeta]>;\n listTags(params: FilesCrudListTagsParams): Promise<ListTagsResponse[]>;\n createFile(data: FileInput, meta?: Record<string, any>): Promise<File>;\n updateFile(id: string, data: Partial<FileInput>): Promise<File>;\n deleteFile(id: string): Promise<boolean>;\n createFilesInBatch(data: FileInput[], meta?: Record<string, any>): Promise<File[]>;\n}\n\nexport interface SystemCRUD {\n onSystemBeforeInstall: Topic;\n onSystemAfterInstall: Topic;\n getVersion(): Promise<string | null>;\n setVersion(version: string): Promise<void>;\n install(args: { srcPrefix: string }): Promise<boolean>;\n}\n\nexport interface FileManagerSettings {\n tenant: string;\n uploadMinFileSize: number;\n uploadMaxFileSize: number;\n srcPrefix: string;\n}\n\nexport interface FileManagerSystem {\n version: string;\n tenant: string;\n}\n\nexport interface OnSettingsBeforeUpdateTopicParams {\n input: Partial<FileManagerSettings>;\n original: FileManagerSettings;\n settings: FileManagerSettings;\n}\n\nexport interface OnSettingsAfterUpdateTopicParams {\n input: Partial<FileManagerSettings>;\n original: FileManagerSettings;\n settings: FileManagerSettings;\n}\n\nexport type SettingsCRUD = {\n getSettings(): Promise<FileManagerSettings | null>;\n createSettings(data?: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n updateSettings(data: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n deleteSettings(): Promise<boolean>;\n\n onSettingsBeforeUpdate: Topic<OnSettingsBeforeUpdateTopicParams>;\n onSettingsAfterUpdate: Topic<OnSettingsAfterUpdateTopicParams>;\n};\n/********\n * Storage operations\n *******/\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsUpdateParams {\n /**\n * The system data to be updated.\n */\n original: FileManagerSystem;\n /**\n * The system data with the updated fields.\n */\n data: FileManagerSystem;\n}\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsCreateParams {\n /**\n * The system fields.\n */\n data: FileManagerSystem;\n}\n\nexport interface FileManagerSystemStorageOperationsGetParams {\n tenant: string;\n}\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n */\nexport interface FileManagerSystemStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: (params: FileManagerSystemStorageOperationsGetParams) => Promise<FileManagerSystem | null>;\n /**\n * Update the FileManager system data..\n */\n update: (params: FileManagerSystemStorageOperationsUpdateParams) => Promise<FileManagerSystem>;\n /**\n * Create the FileManagerSystemData\n */\n create: (params: FileManagerSystemStorageOperationsCreateParams) => Promise<FileManagerSystem>;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsUpdateParams {\n /**\n * Original settings to be updated.\n */\n original: FileManagerSettings;\n /**\n * The settings with the updated fields.\n */\n data: FileManagerSettings;\n}\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsCreateParams {\n /**\n * The settings fields.\n */\n data: FileManagerSettings;\n}\n\nexport interface FileManagerStorageOperationsGetSettingsParams {\n tenant: string;\n}\n\nexport interface FileManagerStorageOperationsDeleteSettings {\n tenant: string;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n */\nexport interface FileManagerSettingsStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: (\n params: FileManagerStorageOperationsGetSettingsParams\n ) => Promise<FileManagerSettings | null>;\n /**\n * Create the FileManagerSettingsData\n */\n create: (\n params: FileManagerSettingsStorageOperationsCreateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Update the FileManager system data..\n */\n update: (\n params: FileManagerSettingsStorageOperationsUpdateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Delete the existing settings.\n */\n delete: (params: FileManagerStorageOperationsDeleteSettings) => Promise<void>;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsGetParams {\n where: {\n id: string;\n tenant: string;\n locale: string;\n };\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsUpdateParams {\n original: File;\n file: File;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsDeleteParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateBatchParams {\n files: File[];\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParamsWhere {\n [key: string]: any;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParams {\n where: FileManagerFilesStorageOperationsListParamsWhere;\n sort: CmsEntryListSort;\n limit: number;\n after: string | null;\n search?: string;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListResponseMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\nexport type FileManagerFilesStorageOperationsListResponse = [\n File[],\n FileManagerFilesStorageOperationsListResponseMeta\n];\n\nexport interface FileManagerFilesStorageOperationsTagsResponse {\n tag: string;\n count: number;\n}\n\nexport interface FileManagerFilesStorageOperationsTagsParamsWhere extends FilesCrudListTagsWhere {\n locale: string;\n tenant: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsTagsParams {\n where: FileManagerFilesStorageOperationsTagsParamsWhere;\n limit: number;\n after?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n */\nexport interface FileManagerFilesStorageOperations {\n /**\n * Get a single file with given ID from the storage.\n */\n get: (params: FileManagerFilesStorageOperationsGetParams) => Promise<File | null>;\n /**\n * Insert the file data into the database.\n */\n create: (params: FileManagerFilesStorageOperationsCreateParams) => Promise<File>;\n /**\n * Update the file data in the database.\n */\n update: (params: FileManagerFilesStorageOperationsUpdateParams) => Promise<File>;\n /**\n * Delete the file from the database.\n */\n delete: (params: FileManagerFilesStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Store multiple files at once to the database.\n */\n createBatch: (params: FileManagerFilesStorageOperationsCreateBatchParams) => Promise<File[]>;\n /**\n * Get a list of files filtered by given parameters.\n */\n list: (\n params: FileManagerFilesStorageOperationsListParams\n ) => Promise<FileManagerFilesStorageOperationsListResponse>;\n /**\n * Get a list of all file tags filtered by given parameters.\n */\n tags: (\n params: FileManagerFilesStorageOperationsTagsParams\n ) => Promise<FileManagerFilesStorageOperationsTagsResponse[]>;\n}\n\nexport interface FileManagerAliasesStorageOperations {\n storeAliases(file: File): Promise<void>;\n deleteAliases(file: File): Promise<void>;\n}\n\nexport interface FileManagerStorageOperations<TContext = FileManagerContext> {\n beforeInit?: (context: TContext) => Promise<void>;\n files: FileManagerFilesStorageOperations;\n aliases: FileManagerAliasesStorageOperations;\n settings: FileManagerSettingsStorageOperations;\n system: FileManagerSystemStorageOperations;\n}\n"],"mappings":";;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AACAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_file","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_file2"],"sources":["types.ts"],"sourcesContent":["import type { I18NContext } from \"@webiny/api-i18n/types\";\nimport type { FileStorage } from \"./storage/FileStorage\";\nimport type { TenancyContext } from \"@webiny/api-tenancy/types\";\nimport type { SecurityContext, SecurityPermission } from \"@webiny/api-security/types\";\nimport type { Context } from \"@webiny/api/types\";\nimport type { FileLifecycleEvents } from \"./types/file.lifecycle\";\nimport type { CreatedBy, File } from \"./types/file\";\nimport type { Topic } from \"@webiny/pubsub/types\";\nimport type { CmsContext, CmsEntryListSort } from \"@webiny/api-headless-cms/types\";\nimport type { Context as TasksContext } from \"@webiny/tasks/types\";\n\nexport * from \"./types/file.lifecycle\";\nexport * from \"./types/file\";\nexport * from \"./types/file\";\n\nexport interface FileManagerContextObject extends FilesCRUD, SettingsCRUD, SystemCRUD {\n storage: FileStorage;\n}\n\nexport interface FileManagerContext\n extends Context,\n SecurityContext,\n TenancyContext,\n I18NContext,\n CmsContext,\n TasksContext {\n fileManager: FileManagerContextObject;\n}\n\nexport interface FilePermission extends SecurityPermission {\n name: \"fm.file\";\n rwd?: string;\n own?: boolean;\n}\n\nexport interface SettingsPermission extends SecurityPermission {\n name: \"fm.setting\";\n}\n\nexport interface FileInput {\n id: string;\n\n // In the background, we're actually mapping these to entry-level fields.\n // This is fine since we don't use revisions for files.\n createdOn?: string | Date | null;\n modifiedOn?: string | Date | null;\n savedOn?: string | Date | null;\n createdBy?: CreatedBy | null;\n modifiedBy?: CreatedBy | null;\n savedBy?: CreatedBy | null;\n\n key: string;\n name: string;\n size: number;\n type: string;\n meta: Record<string, any>;\n location?: {\n folderId: string;\n };\n tags: string[];\n aliases: string[];\n extensions?: Record<string, any>;\n}\n\nexport interface FileListWhereParams {\n AND?: FileListWhereParams[];\n OR?: FileListWhereParams[];\n [key: string]: any;\n}\nexport interface FilesListOpts {\n search?: string;\n limit?: number;\n after?: string;\n where?: FileListWhereParams;\n sort?: CmsEntryListSort;\n}\n\nexport interface FileListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\ninterface FilesCrudListTagsWhere {\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n tag_not_startsWith?: string;\n tag_startsWith?: string;\n}\ninterface FilesCrudListTagsParams {\n where?: FilesCrudListTagsWhere;\n limit?: number;\n after?: string;\n}\n\nexport interface ListTagsResponse {\n tag: string;\n count: number;\n}\nexport interface FilesCRUD extends FileLifecycleEvents {\n getFile(id: string): Promise<File>;\n listFiles(opts?: FilesListOpts): Promise<[File[], FileListMeta]>;\n listTags(params: FilesCrudListTagsParams): Promise<ListTagsResponse[]>;\n createFile(data: FileInput, meta?: Record<string, any>): Promise<File>;\n updateFile(id: string, data: Partial<FileInput>): Promise<File>;\n deleteFile(id: string): Promise<boolean>;\n createFilesInBatch(data: FileInput[], meta?: Record<string, any>): Promise<File[]>;\n}\n\nexport interface SystemCRUD {\n onSystemBeforeInstall: Topic;\n onSystemAfterInstall: Topic;\n getVersion(): Promise<string | null>;\n setVersion(version: string): Promise<void>;\n install(args: { srcPrefix: string }): Promise<boolean>;\n}\n\nexport interface FileManagerSettings {\n tenant: string;\n uploadMinFileSize: number;\n uploadMaxFileSize: number;\n srcPrefix: string;\n}\n\nexport interface FileManagerSystem {\n version: string;\n tenant: string;\n}\n\nexport interface OnSettingsBeforeUpdateTopicParams {\n input: Partial<FileManagerSettings>;\n original: FileManagerSettings;\n settings: FileManagerSettings;\n}\n\nexport interface OnSettingsAfterUpdateTopicParams {\n input: Partial<FileManagerSettings>;\n original: FileManagerSettings;\n settings: FileManagerSettings;\n}\n\nexport type SettingsCRUD = {\n getSettings(): Promise<FileManagerSettings | null>;\n createSettings(data?: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n updateSettings(data: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n deleteSettings(): Promise<boolean>;\n\n onSettingsBeforeUpdate: Topic<OnSettingsBeforeUpdateTopicParams>;\n onSettingsAfterUpdate: Topic<OnSettingsAfterUpdateTopicParams>;\n};\n/********\n * Storage operations\n *******/\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsUpdateParams {\n /**\n * The system data to be updated.\n */\n original: FileManagerSystem;\n /**\n * The system data with the updated fields.\n */\n data: FileManagerSystem;\n}\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsCreateParams {\n /**\n * The system fields.\n */\n data: FileManagerSystem;\n}\n\nexport interface FileManagerSystemStorageOperationsGetParams {\n tenant: string;\n}\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n */\nexport interface FileManagerSystemStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: (params: FileManagerSystemStorageOperationsGetParams) => Promise<FileManagerSystem | null>;\n /**\n * Update the FileManager system data..\n */\n update: (params: FileManagerSystemStorageOperationsUpdateParams) => Promise<FileManagerSystem>;\n /**\n * Create the FileManagerSystemData\n */\n create: (params: FileManagerSystemStorageOperationsCreateParams) => Promise<FileManagerSystem>;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsUpdateParams {\n /**\n * Original settings to be updated.\n */\n original: FileManagerSettings;\n /**\n * The settings with the updated fields.\n */\n data: FileManagerSettings;\n}\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsCreateParams {\n /**\n * The settings fields.\n */\n data: FileManagerSettings;\n}\n\nexport interface FileManagerStorageOperationsGetSettingsParams {\n tenant: string;\n}\n\nexport interface FileManagerStorageOperationsDeleteSettings {\n tenant: string;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n */\nexport interface FileManagerSettingsStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: (\n params: FileManagerStorageOperationsGetSettingsParams\n ) => Promise<FileManagerSettings | null>;\n /**\n * Create the FileManagerSettingsData\n */\n create: (\n params: FileManagerSettingsStorageOperationsCreateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Update the FileManager system data..\n */\n update: (\n params: FileManagerSettingsStorageOperationsUpdateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Delete the existing settings.\n */\n delete: (params: FileManagerStorageOperationsDeleteSettings) => Promise<void>;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsGetParams {\n where: {\n id: string;\n tenant: string;\n locale: string;\n };\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsUpdateParams {\n original: File;\n file: File;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsDeleteParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateBatchParams {\n files: File[];\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParamsWhere {\n [key: string]: any;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParams {\n where: FileManagerFilesStorageOperationsListParamsWhere;\n sort: CmsEntryListSort;\n limit: number;\n after: string | null;\n search?: string;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListResponseMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\nexport type FileManagerFilesStorageOperationsListResponse = [\n File[],\n FileManagerFilesStorageOperationsListResponseMeta\n];\n\nexport interface FileManagerFilesStorageOperationsTagsResponse {\n tag: string;\n count: number;\n}\n\nexport interface FileManagerFilesStorageOperationsTagsParamsWhere extends FilesCrudListTagsWhere {\n locale: string;\n tenant: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsTagsParams {\n where: FileManagerFilesStorageOperationsTagsParamsWhere;\n limit: number;\n after?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n */\nexport interface FileManagerFilesStorageOperations {\n /**\n * Get a single file with given ID from the storage.\n */\n get: (params: FileManagerFilesStorageOperationsGetParams) => Promise<File | null>;\n /**\n * Insert the file data into the database.\n */\n create: (params: FileManagerFilesStorageOperationsCreateParams) => Promise<File>;\n /**\n * Update the file data in the database.\n */\n update: (params: FileManagerFilesStorageOperationsUpdateParams) => Promise<File>;\n /**\n * Delete the file from the database.\n */\n delete: (params: FileManagerFilesStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Store multiple files at once to the database.\n */\n createBatch: (params: FileManagerFilesStorageOperationsCreateBatchParams) => Promise<File[]>;\n /**\n * Get a list of files filtered by given parameters.\n */\n list: (\n params: FileManagerFilesStorageOperationsListParams\n ) => Promise<FileManagerFilesStorageOperationsListResponse>;\n /**\n * Get a list of all file tags filtered by given parameters.\n */\n tags: (\n params: FileManagerFilesStorageOperationsTagsParams\n ) => Promise<FileManagerFilesStorageOperationsTagsResponse[]>;\n}\n\nexport interface FileManagerAliasesStorageOperations {\n storeAliases(file: File): Promise<void>;\n deleteAliases(file: File): Promise<void>;\n}\n\nexport interface FileManagerStorageOperations<TContext = FileManagerContext> {\n beforeInit?: (context: TContext) => Promise<void>;\n files: FileManagerFilesStorageOperations;\n aliases: FileManagerAliasesStorageOperations;\n settings: FileManagerSettingsStorageOperations;\n system: FileManagerSystemStorageOperations;\n}\n"],"mappings":";;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AACAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|