@payloadcms/plugin-cloud-storage 3.0.0-beta.9 → 3.0.0-canary.220bb7c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -124
- package/azure.d.ts +2 -0
- package/azure.js +3 -0
- package/dist/adapters/azure/index.d.ts +5 -0
- package/dist/adapters/azure/index.d.ts.map +1 -1
- package/dist/adapters/azure/index.js +6 -1
- package/dist/adapters/azure/index.js.map +1 -1
- package/dist/adapters/azure/staticHandler.js +3 -2
- package/dist/adapters/azure/staticHandler.js.map +1 -1
- package/dist/adapters/gcs/index.d.ts +5 -0
- package/dist/adapters/gcs/index.d.ts.map +1 -1
- package/dist/adapters/gcs/index.js +6 -1
- package/dist/adapters/gcs/index.js.map +1 -1
- package/dist/adapters/gcs/staticHandler.js +3 -2
- package/dist/adapters/gcs/staticHandler.js.map +1 -1
- package/dist/adapters/s3/index.d.ts +5 -0
- package/dist/adapters/s3/index.d.ts.map +1 -1
- package/dist/adapters/s3/index.js +6 -1
- package/dist/adapters/s3/index.js.map +1 -1
- package/dist/adapters/s3/staticHandler.js +3 -2
- package/dist/adapters/s3/staticHandler.js.map +1 -1
- package/dist/adapters/vercelBlob/index.d.ts +5 -0
- package/dist/adapters/vercelBlob/index.d.ts.map +1 -1
- package/dist/adapters/vercelBlob/index.js +6 -1
- package/dist/adapters/vercelBlob/index.js.map +1 -1
- package/dist/adapters/vercelBlob/staticHandler.d.ts.map +1 -1
- package/dist/adapters/vercelBlob/staticHandler.js +2 -1
- package/dist/adapters/vercelBlob/staticHandler.js.map +1 -1
- package/dist/fields/getFields.d.ts.map +1 -1
- package/dist/fields/getFields.js +3 -1
- package/dist/fields/getFields.js.map +1 -1
- package/dist/hooks/afterDelete.js +4 -2
- package/dist/hooks/afterDelete.js.map +1 -1
- package/dist/hooks/afterRead.d.ts.map +1 -1
- package/dist/hooks/afterRead.js +1 -0
- package/dist/hooks/afterRead.js.map +1 -1
- package/dist/hooks/beforeChange.d.ts.map +1 -1
- package/dist/hooks/beforeChange.js +4 -1
- package/dist/hooks/beforeChange.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +2 -1
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +16 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/getFilePrefix.d.ts +4 -3
- package/dist/utilities/getFilePrefix.d.ts.map +1 -1
- package/dist/utilities/getFilePrefix.js +1 -3
- package/dist/utilities/getFilePrefix.js.map +1 -1
- package/dist/utilities/getIncomingFiles.d.ts +2 -2
- package/dist/utilities/getIncomingFiles.d.ts.map +1 -1
- package/dist/utilities/getIncomingFiles.js.map +1 -1
- package/gcs.d.ts +2 -0
- package/gcs.js +3 -0
- package/package.json +41 -41
- package/s3.d.ts +2 -0
- package/s3.js +3 -0
- package/src/index.ts +0 -1
package/dist/fields/getFields.js
CHANGED
|
@@ -19,7 +19,8 @@ export const getFields = ({ adapter, collection, disablePayloadAccessControl, ge
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
const fields = [
|
|
22
|
-
...collection.fields
|
|
22
|
+
...collection.fields,
|
|
23
|
+
...adapter.fields || []
|
|
23
24
|
];
|
|
24
25
|
// Inject a hook into all URL fields to generate URLs
|
|
25
26
|
let existingURLFieldIndex = -1;
|
|
@@ -75,6 +76,7 @@ export const getFields = ({ adapter, collection, disablePayloadAccessControl, ge
|
|
|
75
76
|
name: size.name,
|
|
76
77
|
type: 'group',
|
|
77
78
|
fields: [
|
|
79
|
+
...adapter.fields || [],
|
|
78
80
|
{
|
|
79
81
|
...existingSizeURLField || {},
|
|
80
82
|
...baseURLField,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fields/getFields.ts"],"sourcesContent":["import type { GroupField, TextField } from 'payload/types'\nimport type { CollectionConfig, Field } from 'payload/types'\n\nimport path from 'path'\n\nimport type { GenerateFileURL, GeneratedAdapter } from '../types.js'\n\nimport { getAfterReadHook } from '../hooks/afterRead.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n disablePayloadAccessControl?: true\n generateFileURL?: GenerateFileURL\n prefix?: string\n}\n\nexport const getFields = ({\n adapter,\n collection,\n disablePayloadAccessControl,\n generateFileURL,\n prefix,\n}: Args): Field[] => {\n const baseURLField: Field = {\n name: 'url',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'URL',\n }\n\n const basePrefixField: Field = {\n name: 'prefix',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n }\n\n const fields = [...collection.fields]\n\n // Inject a hook into all URL fields to generate URLs\n\n let existingURLFieldIndex = -1\n\n const existingURLField = fields.find((existingField, i) => {\n if ('name' in existingField && existingField.name === 'url') {\n existingURLFieldIndex = i\n return true\n }\n return false\n }) as TextField\n\n if (existingURLFieldIndex > -1) {\n fields.splice(existingURLFieldIndex, 1)\n }\n\n fields.push({\n ...baseURLField,\n ...(existingURLField || {}),\n hooks: {\n afterRead: [\n getAfterReadHook({ adapter, collection, disablePayloadAccessControl, generateFileURL }),\n ...(existingURLField?.hooks?.afterRead || []),\n ],\n },\n })\n\n if (typeof collection.upload === 'object' && collection.upload.imageSizes) {\n let existingSizesFieldIndex = -1\n\n const existingSizesField = fields.find((existingField, i) => {\n if ('name' in existingField && existingField.name === 'sizes') {\n existingSizesFieldIndex = i\n return true\n }\n\n return false\n }) as GroupField\n\n if (existingSizesFieldIndex > -1) {\n fields.splice(existingSizesFieldIndex, 1)\n }\n\n const sizesField: Field = {\n ...(existingSizesField || {}),\n name: 'sizes',\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: collection.upload.imageSizes.map((size) => {\n const existingSizeField = existingSizesField?.fields.find(\n (existingField) => 'name' in existingField && existingField.name === size.name,\n ) as GroupField\n\n const existingSizeURLField = existingSizeField?.fields.find(\n (existingField) => 'name' in existingField && existingField.name === 'url',\n ) as GroupField\n\n return {\n ...existingSizeField,\n name: size.name,\n type: 'group',\n fields: [\n {\n ...(existingSizeURLField || {}),\n ...baseURLField,\n hooks: {\n afterRead: [\n getAfterReadHook({\n adapter,\n collection,\n disablePayloadAccessControl,\n generateFileURL,\n size,\n }),\n ...(existingSizeURLField?.hooks?.afterRead || []),\n ],\n },\n },\n ],\n }\n }),\n }\n\n fields.push(sizesField)\n }\n\n // If prefix is enabled, save it to db\n if (typeof prefix !== 'undefined') {\n let existingPrefixFieldIndex = -1\n\n const existingPrefixField = fields.find((existingField, i) => {\n if ('name' in existingField && existingField.name === 'prefix') {\n existingPrefixFieldIndex = i\n return true\n }\n return false\n }) as TextField\n\n if (existingPrefixFieldIndex > -1) {\n fields.splice(existingPrefixFieldIndex, 1)\n }\n\n fields.push({\n ...basePrefixField,\n ...(existingPrefixField || {}),\n defaultValue: path.posix.join(prefix),\n })\n }\n\n return fields\n}\n"],"names":["path","getAfterReadHook","getFields","adapter","collection","disablePayloadAccessControl","generateFileURL","prefix","baseURLField","name","type","admin","hidden","readOnly","label","basePrefixField","fields","existingURLFieldIndex","existingURLField","find","existingField","i","splice","push","hooks","afterRead","upload","imageSizes","existingSizesFieldIndex","existingSizesField","sizesField","map","size","existingSizeField","existingSizeURLField","existingPrefixFieldIndex","existingPrefixField","defaultValue","posix","join"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/fields/getFields.ts"],"sourcesContent":["import type { GroupField, TextField } from 'payload/types'\nimport type { CollectionConfig, Field } from 'payload/types'\n\nimport path from 'path'\n\nimport type { GenerateFileURL, GeneratedAdapter } from '../types.js'\n\nimport { getAfterReadHook } from '../hooks/afterRead.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n disablePayloadAccessControl?: true\n generateFileURL?: GenerateFileURL\n prefix?: string\n}\n\nexport const getFields = ({\n adapter,\n collection,\n disablePayloadAccessControl,\n generateFileURL,\n prefix,\n}: Args): Field[] => {\n const baseURLField: Field = {\n name: 'url',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'URL',\n }\n\n const basePrefixField: Field = {\n name: 'prefix',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n }\n\n const fields = [...collection.fields, ...(adapter.fields || [])]\n\n // Inject a hook into all URL fields to generate URLs\n\n let existingURLFieldIndex = -1\n\n const existingURLField = fields.find((existingField, i) => {\n if ('name' in existingField && existingField.name === 'url') {\n existingURLFieldIndex = i\n return true\n }\n return false\n }) as TextField\n\n if (existingURLFieldIndex > -1) {\n fields.splice(existingURLFieldIndex, 1)\n }\n\n fields.push({\n ...baseURLField,\n ...(existingURLField || {}),\n hooks: {\n afterRead: [\n getAfterReadHook({ adapter, collection, disablePayloadAccessControl, generateFileURL }),\n ...(existingURLField?.hooks?.afterRead || []),\n ],\n },\n })\n\n if (typeof collection.upload === 'object' && collection.upload.imageSizes) {\n let existingSizesFieldIndex = -1\n\n const existingSizesField = fields.find((existingField, i) => {\n if ('name' in existingField && existingField.name === 'sizes') {\n existingSizesFieldIndex = i\n return true\n }\n\n return false\n }) as GroupField\n\n if (existingSizesFieldIndex > -1) {\n fields.splice(existingSizesFieldIndex, 1)\n }\n\n const sizesField: Field = {\n ...(existingSizesField || {}),\n name: 'sizes',\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: collection.upload.imageSizes.map((size) => {\n const existingSizeField = existingSizesField?.fields.find(\n (existingField) => 'name' in existingField && existingField.name === size.name,\n ) as GroupField\n\n const existingSizeURLField = existingSizeField?.fields.find(\n (existingField) => 'name' in existingField && existingField.name === 'url',\n ) as GroupField\n\n return {\n ...existingSizeField,\n name: size.name,\n type: 'group',\n fields: [\n ...(adapter.fields || []),\n {\n ...(existingSizeURLField || {}),\n ...baseURLField,\n hooks: {\n afterRead: [\n getAfterReadHook({\n adapter,\n collection,\n disablePayloadAccessControl,\n generateFileURL,\n size,\n }),\n ...(existingSizeURLField?.hooks?.afterRead || []),\n ],\n },\n },\n ],\n }\n }),\n }\n\n fields.push(sizesField)\n }\n\n // If prefix is enabled, save it to db\n if (typeof prefix !== 'undefined') {\n let existingPrefixFieldIndex = -1\n\n const existingPrefixField = fields.find((existingField, i) => {\n if ('name' in existingField && existingField.name === 'prefix') {\n existingPrefixFieldIndex = i\n return true\n }\n return false\n }) as TextField\n\n if (existingPrefixFieldIndex > -1) {\n fields.splice(existingPrefixFieldIndex, 1)\n }\n\n fields.push({\n ...basePrefixField,\n ...(existingPrefixField || {}),\n defaultValue: path.posix.join(prefix),\n })\n }\n\n return fields\n}\n"],"names":["path","getAfterReadHook","getFields","adapter","collection","disablePayloadAccessControl","generateFileURL","prefix","baseURLField","name","type","admin","hidden","readOnly","label","basePrefixField","fields","existingURLFieldIndex","existingURLField","find","existingField","i","splice","push","hooks","afterRead","upload","imageSizes","existingSizesFieldIndex","existingSizesField","sizesField","map","size","existingSizeField","existingSizeURLField","existingPrefixFieldIndex","existingPrefixField","defaultValue","posix","join"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,OAAOA,UAAU,OAAM;AAIvB,SAASC,gBAAgB,QAAQ,wBAAuB;AAUxD,OAAO,MAAMC,YAAY,CAAC,EACxBC,OAAO,EACPC,UAAU,EACVC,2BAA2B,EAC3BC,eAAe,EACfC,MAAM,EACD;IACL,MAAMC,eAAsB;QAC1BC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,QAAQ;YACRC,UAAU;QACZ;QACAC,OAAO;IACT;IAEA,MAAMC,kBAAyB;QAC7BN,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,QAAQ;YACRC,UAAU;QACZ;IACF;IAEA,MAAMG,SAAS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BAAmBjB,OAAOG,KACrD,CAACC,gBAAkB,UAAUA,iBAAiBA,cAAcX,IAAI,KAAK;gBAGvE,OAAO;oBACL,GAAGwB,iBAAiB;oBACpBxB,MAAMuB,KAAKvB,IAAI;oBACfC,MAAM;oBACNM,QAAQ;2BACFb,QAAQa,MAAM,IAAI,EAAE;wBACxB;4BACE,GAAIkB,wBAAwB,CAAC,CAAC;4BAC9B,GAAG1B,YAAY;4BACfgB,OAAO;gCACLC,WAAW;oCACTxB,iBAAiB;wCACfE;wCACAC;wCACAC;wCACAC;wCACA0B;oCACF;uCACIE,sBAAsBV,OAAOC,aAAa,EAAE;iCACjD;4BACH;wBACF;qBACD;gBACH;YACF;QACF;QAEAT,OAAOO,IAAI,CAACO;IACd;IAEA,sCAAsC;IACtC,IAAI,OAAOvB,WAAW,aAAa;QACjC,IAAI4B,2BAA2B,CAAC;QAEhC,MAAMC,sBAAsBpB,OAAOG,IAAI,CAAC,CAACC,eAAeC;YACtD,IAAI,UAAUD,iBAAiBA,cAAcX,IAAI,KAAK,UAAU;gBAC9D0B,2BAA2Bd;gBAC3B,OAAO;YACT;YACA,OAAO;QACT;QAEA,IAAIc,2BAA2B,CAAC,GAAG;YACjCnB,OAAOM,MAAM,CAACa,0BAA0B;QAC1C;QAEAnB,OAAOO,IAAI,CAAC;YACV,GAAGR,eAAe;YAClB,GAAIqB,uBAAuB,CAAC,CAAC;YAC7BC,cAAcrC,KAAKsC,KAAK,CAACC,IAAI,CAAChC;QAChC;IACF;IAEA,OAAOS;AACT,EAAC"}
|
|
@@ -15,8 +15,10 @@ export const getAfterDeleteHook = ({ adapter, collection })=>{
|
|
|
15
15
|
});
|
|
16
16
|
await Promise.all(promises);
|
|
17
17
|
} catch (err) {
|
|
18
|
-
req.payload.logger.error(
|
|
19
|
-
|
|
18
|
+
req.payload.logger.error({
|
|
19
|
+
err,
|
|
20
|
+
msg: `There was an error while deleting files corresponding to the ${collection.labels?.singular} with ID ${doc.id}.`
|
|
21
|
+
});
|
|
20
22
|
}
|
|
21
23
|
return doc;
|
|
22
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/afterDelete.ts"],"sourcesContent":["import type { FileData, TypeWithID } from 'payload/types'\nimport type { CollectionAfterDeleteHook, CollectionConfig } from 'payload/types'\n\nimport type { GeneratedAdapter, TypeWithPrefix } from '../types.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n}\n\nexport const getAfterDeleteHook = ({\n adapter,\n collection,\n}: Args): CollectionAfterDeleteHook<FileData & TypeWithID & TypeWithPrefix> => {\n return async ({ doc, req }) => {\n try {\n const filesToDelete: string[] = [\n doc.filename,\n ...Object.values(doc?.sizes || []).map((resizedFileData) => resizedFileData?.filename),\n ]\n\n const promises = filesToDelete.map(async (filename) => {\n if (filename) await adapter.handleDelete({ collection, doc, filename, req })\n })\n\n await Promise.all(promises)\n } catch (err: unknown) {\n req.payload.logger.error(\n `There was an error while deleting files corresponding to the ${collection.labels?.singular} with ID ${doc.id}
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/afterDelete.ts"],"sourcesContent":["import type { FileData, TypeWithID } from 'payload/types'\nimport type { CollectionAfterDeleteHook, CollectionConfig } from 'payload/types'\n\nimport type { GeneratedAdapter, TypeWithPrefix } from '../types.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n}\n\nexport const getAfterDeleteHook = ({\n adapter,\n collection,\n}: Args): CollectionAfterDeleteHook<FileData & TypeWithID & TypeWithPrefix> => {\n return async ({ doc, req }) => {\n try {\n const filesToDelete: string[] = [\n doc.filename,\n ...Object.values(doc?.sizes || []).map((resizedFileData) => resizedFileData?.filename),\n ]\n\n const promises = filesToDelete.map(async (filename) => {\n if (filename) await adapter.handleDelete({ collection, doc, filename, req })\n })\n\n await Promise.all(promises)\n } catch (err: unknown) {\n req.payload.logger.error({\n err,\n msg: `There was an error while deleting files corresponding to the ${collection.labels?.singular} with ID ${doc.id}.`,\n })\n }\n return doc\n }\n}\n"],"names":["getAfterDeleteHook","adapter","collection","doc","req","filesToDelete","filename","Object","values","sizes","map","resizedFileData","promises","handleDelete","Promise","all","err","payload","logger","error","msg","labels","singular","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAUA,OAAO,MAAMA,qBAAqB,CAAC,EACjCC,OAAO,EACPC,UAAU,EACL;IACL,OAAO,OAAO,EAAEC,GAAG,EAAEC,GAAG,EAAE;QACxB,IAAI;YACF,MAAMC,gBAA0B;gBAC9BF,IAAIG,QAAQ;mBACTC,OAAOC,MAAM,CAACL,KAAKM,SAAS,EAAE,EAAEC,GAAG,CAAC,CAACC,kBAAoBA,iBAAiBL;aAC9E;YAED,MAAMM,WAAWP,cAAcK,GAAG,CAAC,OAAOJ;gBACxC,IAAIA,UAAU,MAAML,QAAQY,YAAY,CAAC;oBAAEX;oBAAYC;oBAAKG;oBAAUF;gBAAI;YAC5E;YAEA,MAAMU,QAAQC,GAAG,CAACH;QACpB,EAAE,OAAOI,KAAc;YACrBZ,IAAIa,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;gBACvBH;gBACAI,KAAK,CAAC,6DAA6D,EAAElB,WAAWmB,MAAM,EAAEC,SAAS,SAAS,EAAEnB,IAAIoB,EAAE,CAAC,CAAC,CAAC;YACvH;QACF;QACA,OAAOpB;IACT;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afterRead.d.ts","sourceRoot":"","sources":["../../src/hooks/afterRead.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE3E,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEpE,UAAU,IAAI;IACZ,OAAO,EAAE,gBAAgB,CAAA;IACzB,UAAU,EAAE,gBAAgB,CAAA;IAC5B,2BAA2B,CAAC,EAAE,OAAO,CAAA;IACrC,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,eAAO,MAAM,gBAAgB,gFACmD,IAAI,KAAG,
|
|
1
|
+
{"version":3,"file":"afterRead.d.ts","sourceRoot":"","sources":["../../src/hooks/afterRead.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE3E,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEpE,UAAU,IAAI;IACZ,OAAO,EAAE,gBAAgB,CAAA;IACzB,UAAU,EAAE,gBAAgB,CAAA;IAC5B,2BAA2B,CAAC,EAAE,OAAO,CAAA;IACrC,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,eAAO,MAAM,gBAAgB,gFACmD,IAAI,KAAG,SAyBpF,CAAA"}
|
package/dist/hooks/afterRead.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/afterRead.ts"],"sourcesContent":["import type { CollectionConfig, FieldHook, ImageSize } from 'payload/types'\n\nimport type { GenerateFileURL, GeneratedAdapter } from '../types.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n disablePayloadAccessControl?: boolean\n generateFileURL?: GenerateFileURL\n size?: ImageSize\n}\n\nexport const getAfterReadHook =\n ({ adapter, collection, disablePayloadAccessControl, generateFileURL, size }: Args): FieldHook =>\n async ({ data, value }) => {\n const filename = size ? data?.sizes?.[size.name]?.filename : data?.filename\n const prefix = data?.prefix\n let url = value\n\n if (disablePayloadAccessControl && filename) {\n url = await adapter.generateURL({\n collection,\n filename,\n prefix,\n })\n }\n\n if (generateFileURL) {\n url = await generateFileURL({\n collection,\n filename,\n prefix,\n size,\n })\n }\n\n return url\n }\n"],"names":["getAfterReadHook","adapter","collection","disablePayloadAccessControl","generateFileURL","size","data","value","filename","sizes","name","prefix","url","generateURL"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/afterRead.ts"],"sourcesContent":["import type { CollectionConfig, FieldHook, ImageSize } from 'payload/types'\n\nimport type { GenerateFileURL, GeneratedAdapter } from '../types.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n disablePayloadAccessControl?: boolean\n generateFileURL?: GenerateFileURL\n size?: ImageSize\n}\n\nexport const getAfterReadHook =\n ({ adapter, collection, disablePayloadAccessControl, generateFileURL, size }: Args): FieldHook =>\n async ({ data, value }) => {\n const filename = size ? data?.sizes?.[size.name]?.filename : data?.filename\n const prefix = data?.prefix\n let url = value\n\n if (disablePayloadAccessControl && filename) {\n url = await adapter.generateURL({\n collection,\n data,\n filename,\n prefix,\n })\n }\n\n if (generateFileURL) {\n url = await generateFileURL({\n collection,\n filename,\n prefix,\n size,\n })\n }\n\n return url\n }\n"],"names":["getAfterReadHook","adapter","collection","disablePayloadAccessControl","generateFileURL","size","data","value","filename","sizes","name","prefix","url","generateURL"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAYA,OAAO,MAAMA,mBACX,CAAC,EAAEC,OAAO,EAAEC,UAAU,EAAEC,2BAA2B,EAAEC,eAAe,EAAEC,IAAI,EAAQ,GAClF,OAAO,EAAEC,IAAI,EAAEC,KAAK,EAAE;QACpB,MAAMC,WAAWH,OAAOC,MAAMG,OAAO,CAACJ,KAAKK,IAAI,CAAC,EAAEF,WAAWF,MAAME;QACnE,MAAMG,SAASL,MAAMK;QACrB,IAAIC,MAAML;QAEV,IAAIJ,+BAA+BK,UAAU;YAC3CI,MAAM,MAAMX,QAAQY,WAAW,CAAC;gBAC9BX;gBACAI;gBACAE;gBACAG;YACF;QACF;QAEA,IAAIP,iBAAiB;YACnBQ,MAAM,MAAMR,gBAAgB;gBAC1BF;gBACAM;gBACAG;gBACAN;YACF;QACF;QAEA,OAAOO;IACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beforeChange.d.ts","sourceRoot":"","sources":["../../src/hooks/beforeChange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,UAAU,IAAI;IACZ,OAAO,EAAE,gBAAgB,CAAA;IACzB,UAAU,EAAE,gBAAgB,CAAA;CAC7B;AAED,eAAO,MAAM,mBAAmB,4BACJ,IAAI,KAAG,2BAA2B,QAAQ,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"beforeChange.d.ts","sourceRoot":"","sources":["../../src/hooks/beforeChange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,UAAU,IAAI;IACZ,OAAO,EAAE,gBAAgB,CAAA;IACzB,UAAU,EAAE,gBAAgB,CAAA;CAC7B;AAED,eAAO,MAAM,mBAAmB,4BACJ,IAAI,KAAG,2BAA2B,QAAQ,GAAG,UAAU,CA+ChF,CAAA"}
|
|
@@ -41,7 +41,10 @@ export const getBeforeChangeHook = ({ adapter, collection })=>async ({ data, ori
|
|
|
41
41
|
}
|
|
42
42
|
} catch (err) {
|
|
43
43
|
req.payload.logger.error(`There was an error while uploading files corresponding to the collection ${collection.slug} with filename ${data.filename}:`);
|
|
44
|
-
req.payload.logger.error(
|
|
44
|
+
req.payload.logger.error({
|
|
45
|
+
err
|
|
46
|
+
});
|
|
47
|
+
throw err;
|
|
45
48
|
}
|
|
46
49
|
return data;
|
|
47
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/beforeChange.ts"],"sourcesContent":["import type { FileData, TypeWithID } from 'payload/types'\nimport type { CollectionBeforeChangeHook, CollectionConfig } from 'payload/types'\n\nimport type { GeneratedAdapter } from '../types.js'\n\nimport { getIncomingFiles } from '../utilities/getIncomingFiles.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n}\n\nexport const getBeforeChangeHook =\n ({ adapter, collection }: Args): CollectionBeforeChangeHook<FileData & TypeWithID> =>\n async ({ data, originalDoc, req }) => {\n try {\n const files = getIncomingFiles({ data, req })\n\n if (files.length > 0) {\n // If there is an original doc,\n // And we have new files,\n // We need to delete the old files before uploading new\n if (originalDoc) {\n let filesToDelete: string[] = []\n\n if (typeof originalDoc?.filename === 'string') {\n filesToDelete.push(originalDoc.filename)\n }\n\n if (typeof originalDoc.sizes === 'object') {\n filesToDelete = filesToDelete.concat(\n Object.values(originalDoc?.sizes || []).map(\n (resizedFileData) => resizedFileData?.filename,\n ),\n )\n }\n\n const deletionPromises = filesToDelete.map(async (filename) => {\n if (filename) {\n await adapter.handleDelete({ collection, doc: originalDoc, filename, req })\n }\n })\n\n await Promise.all(deletionPromises)\n }\n\n const promises = files.map(async (file) => {\n await adapter.handleUpload({ collection, data, file, req })\n })\n\n await Promise.all(promises)\n }\n } catch (err: unknown) {\n req.payload.logger.error(\n `There was an error while uploading files corresponding to the collection ${collection.slug} with filename ${data.filename}:`,\n )\n req.payload.logger.error(err)\n }\n return data\n }\n"],"names":["getIncomingFiles","getBeforeChangeHook","adapter","collection","data","originalDoc","req","files","length","filesToDelete","filename","push","sizes","concat","Object","values","map","resizedFileData","deletionPromises","handleDelete","doc","Promise","all","promises","file","handleUpload","err","payload","logger","error","slug"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/beforeChange.ts"],"sourcesContent":["import type { FileData, TypeWithID } from 'payload/types'\nimport type { CollectionBeforeChangeHook, CollectionConfig } from 'payload/types'\n\nimport type { GeneratedAdapter } from '../types.js'\n\nimport { getIncomingFiles } from '../utilities/getIncomingFiles.js'\n\ninterface Args {\n adapter: GeneratedAdapter\n collection: CollectionConfig\n}\n\nexport const getBeforeChangeHook =\n ({ adapter, collection }: Args): CollectionBeforeChangeHook<FileData & TypeWithID> =>\n async ({ data, originalDoc, req }) => {\n try {\n const files = getIncomingFiles({ data, req })\n\n if (files.length > 0) {\n // If there is an original doc,\n // And we have new files,\n // We need to delete the old files before uploading new\n if (originalDoc) {\n let filesToDelete: string[] = []\n\n if (typeof originalDoc?.filename === 'string') {\n filesToDelete.push(originalDoc.filename)\n }\n\n if (typeof originalDoc.sizes === 'object') {\n filesToDelete = filesToDelete.concat(\n Object.values(originalDoc?.sizes || []).map(\n (resizedFileData) => resizedFileData?.filename,\n ),\n )\n }\n\n const deletionPromises = filesToDelete.map(async (filename) => {\n if (filename) {\n await adapter.handleDelete({ collection, doc: originalDoc, filename, req })\n }\n })\n\n await Promise.all(deletionPromises)\n }\n\n const promises = files.map(async (file) => {\n await adapter.handleUpload({ collection, data, file, req })\n })\n\n await Promise.all(promises)\n }\n } catch (err: unknown) {\n req.payload.logger.error(\n `There was an error while uploading files corresponding to the collection ${collection.slug} with filename ${data.filename}:`,\n )\n req.payload.logger.error({ err })\n throw err\n }\n return data\n }\n"],"names":["getIncomingFiles","getBeforeChangeHook","adapter","collection","data","originalDoc","req","files","length","filesToDelete","filename","push","sizes","concat","Object","values","map","resizedFileData","deletionPromises","handleDelete","doc","Promise","all","promises","file","handleUpload","err","payload","logger","error","slug"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAKA,SAASA,gBAAgB,QAAQ,mCAAkC;AAOnE,OAAO,MAAMC,sBACX,CAAC,EAAEC,OAAO,EAAEC,UAAU,EAAQ,GAC9B,OAAO,EAAEC,IAAI,E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export {
|
|
1
|
+
export { cloudStoragePlugin } from './plugin.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { cloudStoragePlugin } from './plugin.js'\n"],"names":["cloudStoragePlugin"],"rangeMappings":"","mappings":"AAAA,SAASA,kBAAkB,QAAQ,cAAa"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Config } from 'payload/config';
|
|
2
2
|
import type { PluginOptions } from './types.js';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const cloudStoragePlugin: (pluginOptions: PluginOptions) => (incomingConfig: Config) => Config;
|
|
4
4
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAe/C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAe/C,eAAO,MAAM,kBAAkB,kBACb,aAAa,sBACZ,MAAM,KAAG,MA4EzB,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getBeforeChangeHook } from './hooks/beforeChange.js';
|
|
|
7
7
|
// Adapters are responsible for providing four actions that this plugin will use:
|
|
8
8
|
// 1. handleUpload, 2. handleDelete, 3. generateURL, 4. staticHandler
|
|
9
9
|
// Optionally, the adapter can specify any Webpack config overrides if they are necessary.
|
|
10
|
-
export const
|
|
10
|
+
export const cloudStoragePlugin = (pluginOptions)=>(incomingConfig)=>{
|
|
11
11
|
const { collections: allCollectionOptions, enabled } = pluginOptions;
|
|
12
12
|
const config = {
|
|
13
13
|
...incomingConfig
|
|
@@ -62,6 +62,7 @@ export const cloudStorage = (pluginOptions)=>(incomingConfig)=>{
|
|
|
62
62
|
},
|
|
63
63
|
upload: {
|
|
64
64
|
...typeof existingCollection.upload === 'object' ? existingCollection.upload : {},
|
|
65
|
+
adapter: adapter.name,
|
|
65
66
|
disableLocalStorage: typeof options.disableLocalStorage === 'boolean' ? options.disableLocalStorage : true,
|
|
66
67
|
handlers
|
|
67
68
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Config } from 'payload/config'\n\nimport type { PluginOptions } from './types.js'\n\nimport { getFields } from './fields/getFields.js'\nimport { getAfterDeleteHook } from './hooks/afterDelete.js'\nimport { getBeforeChangeHook } from './hooks/beforeChange.js'\n\n// This plugin extends all targeted collections by offloading uploaded files\n// to cloud storage instead of solely storing files locally.\n\n// It is based on an adapter approach, where adapters can be written for any cloud provider.\n// Adapters are responsible for providing four actions that this plugin will use:\n// 1. handleUpload, 2. handleDelete, 3. generateURL, 4. staticHandler\n\n// Optionally, the adapter can specify any Webpack config overrides if they are necessary.\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Config } from 'payload/config'\n\nimport type { PluginOptions } from './types.js'\n\nimport { getFields } from './fields/getFields.js'\nimport { getAfterDeleteHook } from './hooks/afterDelete.js'\nimport { getBeforeChangeHook } from './hooks/beforeChange.js'\n\n// This plugin extends all targeted collections by offloading uploaded files\n// to cloud storage instead of solely storing files locally.\n\n// It is based on an adapter approach, where adapters can be written for any cloud provider.\n// Adapters are responsible for providing four actions that this plugin will use:\n// 1. handleUpload, 2. handleDelete, 3. generateURL, 4. staticHandler\n\n// Optionally, the adapter can specify any Webpack config overrides if they are necessary.\n\nexport const cloudStoragePlugin =\n (pluginOptions: PluginOptions) =>\n (incomingConfig: Config): Config => {\n const { collections: allCollectionOptions, enabled } = pluginOptions\n const config = { ...incomingConfig }\n\n // Return early if disabled. Only webpack config mods are applied.\n if (enabled === false) {\n return config\n }\n\n const initFunctions: Array<() => void> = []\n\n return {\n ...config,\n collections: (config.collections || []).map((existingCollection) => {\n const options = allCollectionOptions[existingCollection.slug]\n\n if (options?.adapter) {\n const adapter = options.adapter({\n collection: existingCollection,\n prefix: options.prefix,\n })\n\n if (adapter.onInit) initFunctions.push(adapter.onInit)\n\n const fields = getFields({\n adapter,\n collection: existingCollection,\n disablePayloadAccessControl: options.disablePayloadAccessControl,\n generateFileURL: options.generateFileURL,\n prefix: options.prefix,\n })\n\n const handlers = [\n ...(typeof existingCollection.upload === 'object' &&\n Array.isArray(existingCollection.upload.handlers)\n ? existingCollection.upload.handlers\n : []),\n ]\n\n if (!options.disablePayloadAccessControl) {\n handlers.push(adapter.staticHandler)\n }\n\n return {\n ...existingCollection,\n fields,\n hooks: {\n ...(existingCollection.hooks || {}),\n afterDelete: [\n ...(existingCollection.hooks?.afterDelete || []),\n getAfterDeleteHook({ adapter, collection: existingCollection }),\n ],\n beforeChange: [\n ...(existingCollection.hooks?.beforeChange || []),\n getBeforeChangeHook({ adapter, collection: existingCollection }),\n ],\n },\n upload: {\n ...(typeof existingCollection.upload === 'object' ? existingCollection.upload : {}),\n adapter: adapter.name,\n disableLocalStorage:\n typeof options.disableLocalStorage === 'boolean'\n ? options.disableLocalStorage\n : true,\n handlers,\n },\n }\n }\n\n return existingCollection\n }),\n onInit: async (payload) => {\n initFunctions.forEach((fn) => fn())\n if (config.onInit) await config.onInit(payload)\n },\n }\n }\n"],"names":["getFields","getAfterDeleteHook","getBeforeChangeHook","cloudStoragePlugin","pluginOptions","incomingConfig","collections","allCollectionOptions","enabled","config","initFunctions","map","existingCollection","options","slug","adapter","collection","prefix","onInit","push","fields","disablePayloadAccessControl","generateFileURL","handlers","upload","Array","isArray","staticHandler","hooks","afterDelete","beforeChange","name","disableLocalStorage","payload","forEach","fn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,SAAS,QAAQ,wBAAuB;AACjD,SAASC,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,mBAAmB,QAAQ,0BAAyB;AAE7D,4EAA4E;AAC5E,4DAA4D;AAE5D,4FAA4F;AAC5F,iFAAiF;AACjF,qEAAqE;AAErE,0FAA0F;AAE1F,OAAO,MAAMC,qBACX,CAACC,gBACD,CAACC;QACC,MAAM,EAAEC,aAAaC,oBAAoB,EAAEC,OAAO,EAAE,GAAGJ;QACvD,MAAMK,SAAS;YAAE,GAAGJ,cAAc;QAAC;QAEnC,kEAAkE;QAClE,IAAIG,YAAY,OAAO;YACrB,OAAOC;QACT;QAEA,MAAMC,gBAAmC,EAAE;QAE3C,OAAO;YACL,GAAGD,MAAM;YACTH,aAAa,AAACG,CAAAA,OAAOH,WAAW,IAAI,EAAE,AAAD,EAAGK,GAAG,CAAC,CAACC;gBAC3C,MAAMC,UAAUN,oBAAoB,CAACK,mBAAmBE,IAAI,CAAC;gBAE7D,IAAID,SAASE,SAAS;oBACpB,MAAMA,UAAUF,QAAQ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OS,MAAM,EAAE,MAAMT,OAAOS,MAAM,CAACe;YACzC;QACF;IACF,EAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { FileData, ImageSize } from 'payload/types';
|
|
2
|
+
import type { Field, FileData, ImageSize } from 'payload/types';
|
|
3
3
|
import type { TypeWithID } from 'payload/types';
|
|
4
|
-
import type { CollectionConfig,
|
|
4
|
+
import type { CollectionConfig, PayloadRequestWithData } from 'payload/types';
|
|
5
5
|
export interface File {
|
|
6
6
|
buffer: Buffer;
|
|
7
7
|
filename: string;
|
|
@@ -13,7 +13,7 @@ export type HandleUpload = (args: {
|
|
|
13
13
|
collection: CollectionConfig;
|
|
14
14
|
data: any;
|
|
15
15
|
file: File;
|
|
16
|
-
req:
|
|
16
|
+
req: PayloadRequestWithData;
|
|
17
17
|
}) => Promise<void> | void;
|
|
18
18
|
export interface TypeWithPrefix {
|
|
19
19
|
prefix?: string;
|
|
@@ -22,23 +22,33 @@ export type HandleDelete = (args: {
|
|
|
22
22
|
collection: CollectionConfig;
|
|
23
23
|
doc: TypeWithID & FileData & TypeWithPrefix;
|
|
24
24
|
filename: string;
|
|
25
|
-
req:
|
|
25
|
+
req: PayloadRequestWithData;
|
|
26
26
|
}) => Promise<void> | void;
|
|
27
27
|
export type GenerateURL = (args: {
|
|
28
28
|
collection: CollectionConfig;
|
|
29
|
+
data: any;
|
|
29
30
|
filename: string;
|
|
30
31
|
prefix?: string;
|
|
31
32
|
}) => Promise<string> | string;
|
|
32
|
-
export type StaticHandler = (req:
|
|
33
|
+
export type StaticHandler = (req: PayloadRequestWithData, args: {
|
|
34
|
+
doc?: TypeWithID;
|
|
33
35
|
params: {
|
|
34
36
|
collection: string;
|
|
35
37
|
filename: string;
|
|
36
38
|
};
|
|
37
39
|
}) => Promise<Response> | Response;
|
|
38
40
|
export interface GeneratedAdapter {
|
|
39
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Additional fields to be injected into the base collection and image sizes
|
|
43
|
+
*/
|
|
44
|
+
fields?: Field[];
|
|
45
|
+
/**
|
|
46
|
+
* Generates the public URL for a file
|
|
47
|
+
*/
|
|
48
|
+
generateURL?: GenerateURL;
|
|
40
49
|
handleDelete: HandleDelete;
|
|
41
50
|
handleUpload: HandleUpload;
|
|
51
|
+
name: string;
|
|
42
52
|
onInit?: () => void;
|
|
43
53
|
staticHandler: StaticHandler;
|
|
44
54
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE7E,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE;IAChC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,GAAG,CAAA;IACT,IAAI,EAAE,IAAI,CAAA;IACV,GAAG,EAAE,sBAAsB,CAAA;CAC5B,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAE1B,MAAM,WAAW,cAAc;IAC7B,MAAM,CAA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MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE;IACnC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;AAE9B,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,2BAA2B,CAAC,EAAE,IAAI,CAAA;IAClC,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC9C;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { FileData, ImageSize } from 'payload/types'\nimport type { TypeWithID } from 'payload/types'\nimport type { CollectionConfig,
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Field, FileData, ImageSize } from 'payload/types'\nimport type { TypeWithID } from 'payload/types'\nimport type { CollectionConfig, PayloadRequestWithData } from 'payload/types'\n\nexport interface File {\n buffer: Buffer\n filename: string\n filesize: number\n mimeType: string\n tempFilePath?: string\n}\n\nexport type HandleUpload = (args: {\n collection: CollectionConfig\n data: any\n file: File\n req: PayloadRequestWithData\n}) => Promise<void> | void\n\nexport interface TypeWithPrefix {\n prefix?: string\n}\n\nexport type HandleDelete = (args: {\n collection: CollectionConfig\n doc: TypeWithID & FileData & TypeWithPrefix\n filename: string\n req: PayloadRequestWithData\n}) => Promise<void> | void\n\nexport type GenerateURL = (args: {\n collection: CollectionConfig\n data: any\n filename: string\n prefix?: string\n}) => Promise<string> | string\n\nexport type StaticHandler = (\n req: PayloadRequestWithData,\n args: { doc?: TypeWithID; params: { collection: string; filename: string } },\n) => Promise<Response> | Response\n\nexport interface GeneratedAdapter {\n /**\n * Additional fields to be injected into the base collection and image sizes\n */\n fields?: Field[]\n /**\n * Generates the public URL for a file\n */\n generateURL?: GenerateURL\n handleDelete: HandleDelete\n handleUpload: HandleUpload\n name: string\n onInit?: () => void\n staticHandler: StaticHandler\n}\n\nexport type Adapter = (args: { collection: CollectionConfig; prefix?: string }) => GeneratedAdapter\n\nexport type GenerateFileURL = (args: {\n collection: CollectionConfig\n filename: string\n prefix?: string\n size?: ImageSize\n}) => Promise<string> | string\n\nexport interface CollectionOptions {\n adapter: Adapter | null\n disableLocalStorage?: boolean\n disablePayloadAccessControl?: true\n generateFileURL?: GenerateFileURL\n prefix?: string\n}\n\nexport interface PluginOptions {\n collections: Record<string, CollectionOptions>\n /**\n * Whether or not to enable the plugin\n *\n * Default: true\n */\n enabled?: boolean\n}\n"],"names":[],"rangeMappings":"","mappings":"AA2EA,WAQC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { CollectionConfig,
|
|
2
|
-
export declare function getFilePrefix({ collection, req, }: {
|
|
1
|
+
import type { CollectionConfig, PayloadRequestWithData } from 'payload/types';
|
|
2
|
+
export declare function getFilePrefix({ collection, req, filename, }: {
|
|
3
3
|
collection: CollectionConfig;
|
|
4
|
-
req:
|
|
4
|
+
req: PayloadRequestWithData;
|
|
5
|
+
filename: string;
|
|
5
6
|
}): Promise<string>;
|
|
6
7
|
//# sourceMappingURL=getFilePrefix.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilePrefix.d.ts","sourceRoot":"","sources":["../../src/utilities/getFilePrefix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"getFilePrefix.d.ts","sourceRoot":"","sources":["../../src/utilities/getFilePrefix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAgB,MAAM,eAAe,CAAA;AAE3F,wBAAsB,aAAa,CAAC,EAClC,UAAU,EACV,GAAG,EACH,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,gBAAgB,CAAA;IAC5B,GAAG,EAAE,sBAAsB,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBlB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export async function getFilePrefix({ collection, req }) {
|
|
1
|
+
export async function getFilePrefix({ collection, req, filename }) {
|
|
2
2
|
const imageSizes = collection?.upload?.imageSizes || [];
|
|
3
|
-
const { routeParams } = req;
|
|
4
|
-
const filename = routeParams['filename'];
|
|
5
3
|
const files = await req.payload.find({
|
|
6
4
|
collection: collection.slug,
|
|
7
5
|
depth: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getFilePrefix.ts"],"sourcesContent":["import type { CollectionConfig,
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/getFilePrefix.ts"],"sourcesContent":["import type { CollectionConfig, PayloadRequestWithData, UploadConfig } from 'payload/types'\n\nexport async function getFilePrefix({\n collection,\n req,\n filename,\n}: {\n collection: CollectionConfig\n req: PayloadRequestWithData\n filename: string\n}): Promise<string> {\n const imageSizes = (collection?.upload as UploadConfig)?.imageSizes || []\n\n const files = await req.payload.find({\n collection: collection.slug,\n depth: 0,\n limit: 1,\n pagination: false,\n where: {\n or: [\n {\n filename: { equals: filename },\n },\n ...imageSizes.map((imageSize) => ({\n [`sizes.${imageSize.name}.filename`]: { equals: filename },\n })),\n ],\n },\n })\n const prefix = files?.docs?.[0]?.prefix\n return prefix ? (prefix as string) : ''\n}\n"],"names":["getFilePrefix","collection","req","filename","imageSizes","upload","files","payload","find","slug","depth","limit","pagination","where","or","equals","map","imageSize","name","prefix","docs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,eAAeA,cAAc,EAClCC,UAAU,EACVC,GAAG,EACHC,QAAQ,EAKT;IACC,MAAMC,aAAa,AAACH,YAAYI,QAAyBD,cAAc,EAAE;IAEzE,MAAME,QAAQ,MAAMJ,IAAIK,OAAO,CAACC,IAAI,CAAC;QACnCP,YAAYA,WAAWQ,IAAI;QAC3BC,OAAO;QACPC,OAAO;QACPC,YAAY;QACZC,OAAO;YACLC,IAAI;gBACF;oBACEX,UAAU;wBAAEY,QAAQZ;oBAAS;gBAC/B;mBACGC,WAAWY,GAAG,CAAC,CAACC,YAAe,CAAA;wBAChC,CAAC,CAAC,MAAM,EAAEA,UAAUC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE;4BAAEH,QAAQZ;wBAAS;oBAC3D,CAAA;aACD;QACH;IACF;IACA,MAAMgB,SAASb,OAAOc,MAAM,CAAC,EAAE,EAAED;IACjC,OAAOA,SAAUA,SAAoB;AACvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { FileData,
|
|
1
|
+
import type { FileData, PayloadRequestWithData } from 'payload/types';
|
|
2
2
|
import type { File } from '../types.js';
|
|
3
3
|
export declare function getIncomingFiles({ data, req, }: {
|
|
4
4
|
data: Partial<FileData>;
|
|
5
|
-
req:
|
|
5
|
+
req: PayloadRequestWithData;
|
|
6
6
|
}): File[];
|
|
7
7
|
//# sourceMappingURL=getIncomingFiles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIncomingFiles.d.ts","sourceRoot":"","sources":["../../src/utilities/getIncomingFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"getIncomingFiles.d.ts","sourceRoot":"","sources":["../../src/utilities/getIncomingFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IACvB,GAAG,EAAE,sBAAsB,CAAA;CAC5B,GAAG,IAAI,EAAE,CAiCT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getIncomingFiles.ts"],"sourcesContent":["import type { FileData,
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/getIncomingFiles.ts"],"sourcesContent":["import type { FileData, PayloadRequestWithData } from 'payload/types'\n\nimport type { File } from '../types.js'\n\nexport function getIncomingFiles({\n data,\n req,\n}: {\n data: Partial<FileData>\n req: PayloadRequestWithData\n}): File[] {\n const file = req.file\n\n let files: File[] = []\n\n if (file && data.filename && data.mimeType) {\n const mainFile: File = {\n buffer: file.data,\n filename: data.filename,\n filesize: file.size,\n mimeType: data.mimeType,\n tempFilePath: file.tempFilePath,\n }\n\n files = [mainFile]\n\n if (data?.sizes) {\n Object.entries(data.sizes).forEach(([key, resizedFileData]) => {\n if (req.payloadUploadSizes?.[key] && data.mimeType) {\n files = files.concat([\n {\n buffer: req.payloadUploadSizes[key],\n filename: `${resizedFileData.filename}`,\n filesize: req.payloadUploadSizes[key].length,\n mimeType: data.mimeType,\n },\n ])\n }\n })\n }\n }\n\n return files\n}\n"],"names":["getIncomingFiles","data","req","file","files","filename","mimeType","mainFile","buffer","filesize","size","tempFilePath","sizes","Object","entries","forEach","key","resizedFileData","payloadUploadSizes","concat","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,OAAO,SAASA,iBAAiB,EAC/BC,IAAI,EACJC,GAAG,EAIJ;IACC,MAAMC,OAAOD,IAAIC,IAAI;IAErB,IAAIC,QAAgB,EAAE;IAEtB,IAAID,QAAQF,KAAKI,QAAQ,IAAIJ,KAAKK,QAAQ,EAAE;QAC1C,MAAMC,WAAiB;YACrBC,QAAQL,KAAKF,IAAI;YACjBI,UAAUJ,KAAKI,QAAQ;YACvBI,UAAUN,KAAKO,IAAI;YACnBJ,UAAUL,KAAKK,QAAQ;YACvBK,cAAcR,KAAKQ,YAAY;QACjC;QAEAP,QAAQ;YAACG;SAAS;QAElB,IAAIN,MAAMW,OAAO;YACfC,OAAOC,OAAO,CAACb,KAAKW,KAAK,EAAEG,OAAO,CAAC,CAAC,CAACC,KAAKC,gBAAgB;gBACxD,IAAIf,IAAIgB,kBAAkB,EAAE,CAACF,IAAI,IAAIf,KAAKK,QAAQ,EAAE;oBAClDF,QAAQA,MAAMe,MAAM,CAAC;wBACnB;4BACEX,QAAQN,IAAIgB,kBAAkB,CAACF,IAAI;4BACnCX,UAAU,CAAC,EAAEY,gBAAgBZ,QAAQ,CAAC,CAAC;4BACvCI,UAAUP,IAAIgB,kBAAkB,CAACF,IAAI,CAACI,MAAM;4BAC5Cd,UAAUL,KAAKK,QAAQ;wBACzB;qBACD;gBACH;YACF;QACF;IACF;IAEA,OAAOF;AACT"}
|
package/gcs.d.ts
ADDED
package/gcs.js
ADDED
package/package.json
CHANGED
|
@@ -1,17 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-cloud-storage",
|
|
3
|
+
"version": "3.0.0-canary.220bb7c",
|
|
3
4
|
"description": "The official cloud storage plugin for Payload CMS",
|
|
4
|
-
"version": "3.0.0-beta.9",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"license": "MIT",
|
|
9
5
|
"homepage": "https://payloadcms.com",
|
|
10
6
|
"repository": {
|
|
11
7
|
"type": "git",
|
|
12
8
|
"url": "https://github.com/payloadcms/payload.git",
|
|
13
9
|
"directory": "packages/plugin-cloud-storage"
|
|
14
10
|
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./types": {
|
|
20
|
+
"import": "./dist/types.js",
|
|
21
|
+
"require": "./dist/types.js",
|
|
22
|
+
"types": "./dist/types.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./*": {
|
|
25
|
+
"import": "./dist/exports/*.js",
|
|
26
|
+
"require": "./dist/exports/*.js",
|
|
27
|
+
"types": "./dist/exports/*.d.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"*.js",
|
|
35
|
+
"*.d.ts"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"find-node-modules": "^2.1.3",
|
|
39
|
+
"range-parser": "^1.2.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@aws-sdk/client-s3": "^3.525.0",
|
|
43
|
+
"@aws-sdk/lib-storage": "^3.525.0",
|
|
44
|
+
"@azure/storage-blob": "^12.11.0",
|
|
45
|
+
"@google-cloud/storage": "^7.7.0",
|
|
46
|
+
"@types/find-node-modules": "^2.1.2",
|
|
47
|
+
"@vercel/blob": "^0.22.3",
|
|
48
|
+
"payload": "3.0.0-canary.220bb7c"
|
|
49
|
+
},
|
|
15
50
|
"peerDependencies": {
|
|
16
51
|
"@aws-sdk/client-s3": "^3.525.0",
|
|
17
52
|
"@aws-sdk/lib-storage": "^3.525.0",
|
|
@@ -19,7 +54,7 @@
|
|
|
19
54
|
"@azure/storage-blob": "^12.11.0",
|
|
20
55
|
"@google-cloud/storage": "^7.7.0",
|
|
21
56
|
"@vercel/blob": "^0.22.3",
|
|
22
|
-
"payload": "3.0.0-
|
|
57
|
+
"payload": "3.0.0-canary.220bb7c"
|
|
23
58
|
},
|
|
24
59
|
"peerDependenciesMeta": {
|
|
25
60
|
"@aws-sdk/client-s3": {
|
|
@@ -41,41 +76,6 @@
|
|
|
41
76
|
"optional": true
|
|
42
77
|
}
|
|
43
78
|
},
|
|
44
|
-
"files": [
|
|
45
|
-
"dist",
|
|
46
|
-
"*.js",
|
|
47
|
-
"*.d.ts"
|
|
48
|
-
],
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@aws-sdk/client-s3": "^3.525.0",
|
|
51
|
-
"@aws-sdk/lib-storage": "^3.525.0",
|
|
52
|
-
"@azure/storage-blob": "^12.11.0",
|
|
53
|
-
"@google-cloud/storage": "^7.7.0",
|
|
54
|
-
"@types/find-node-modules": "^2.1.2",
|
|
55
|
-
"@vercel/blob": "^0.22.3",
|
|
56
|
-
"payload": "3.0.0-beta.9"
|
|
57
|
-
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"find-node-modules": "^2.1.3",
|
|
60
|
-
"range-parser": "^1.2.1"
|
|
61
|
-
},
|
|
62
|
-
"exports": {
|
|
63
|
-
".": {
|
|
64
|
-
"import": "./dist/index.js",
|
|
65
|
-
"require": "./dist/index.js",
|
|
66
|
-
"types": "./dist/index.d.ts"
|
|
67
|
-
},
|
|
68
|
-
"./types": {
|
|
69
|
-
"import": "./dist/types.js",
|
|
70
|
-
"require": "./dist/types.js",
|
|
71
|
-
"types": "./dist/types.d.ts"
|
|
72
|
-
},
|
|
73
|
-
"./*": {
|
|
74
|
-
"import": "./dist/exports/*.js",
|
|
75
|
-
"require": "./dist/exports/*.js",
|
|
76
|
-
"types": "./dist/exports/*.d.ts"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"registry": "https://registry.npmjs.org/"
|
|
81
81
|
},
|
package/s3.d.ts
ADDED
package/s3.js
ADDED
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { cloudStorage } from './plugin.js'
|