@ainsleydev/payload-helper 0.0.20 → 0.0.22

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.
@@ -31,6 +31,7 @@ import * as mime from 'mime-types';
31
31
  ],
32
32
  upload: {
33
33
  staticDir: 'media',
34
+ adminThumbnail: 'thumbnail',
34
35
  handlers: [
35
36
  async (req, args)=>{
36
37
  const logger = req.payload.logger;
@@ -70,7 +71,11 @@ import * as mime from 'mime-types';
70
71
  formatOptions: {
71
72
  format: 'avif',
72
73
  options: {
73
- quality: 80
74
+ quality: 60,
75
+ effort: 1,
76
+ chromaSubsampling: '4:4:4',
77
+ bitdepth: 8,
78
+ lossless: false
74
79
  }
75
80
  }
76
81
  },
@@ -101,7 +106,11 @@ import * as mime from 'mime-types';
101
106
  formatOptions: {
102
107
  format: 'avif',
103
108
  options: {
104
- quality: 80
109
+ quality: 60,
110
+ effort: 1,
111
+ chromaSubsampling: '4:4:4',
112
+ bitdepth: 8,
113
+ lossless: false
105
114
  }
106
115
  }
107
116
  },
@@ -129,7 +138,11 @@ import * as mime from 'mime-types';
129
138
  formatOptions: {
130
139
  format: 'avif',
131
140
  options: {
132
- quality: 80
141
+ quality: 60,
142
+ effort: 1,
143
+ chromaSubsampling: '4:4:4',
144
+ bitdepth: 8,
145
+ lossless: false
133
146
  }
134
147
  }
135
148
  },
@@ -157,7 +170,11 @@ import * as mime from 'mime-types';
157
170
  formatOptions: {
158
171
  format: 'avif',
159
172
  options: {
160
- quality: 80
173
+ quality: 60,
174
+ effort: 1,
175
+ chromaSubsampling: '4:4:4',
176
+ bitdepth: 8,
177
+ lossless: false
161
178
  }
162
179
  }
163
180
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/Media.ts"],"sourcesContent":["import { lexicalEditor } from '@payloadcms/richtext-lexical';\nimport * as mime from 'mime-types';\nimport type { CollectionConfig, Field, PayloadRequest } from 'payload';\n\n/**\n * Media Collection Configuration\n * Additional fields will be appended to the media collection.\n */\nexport const Media = (additionalFields?: Field[]): CollectionConfig => {\n\treturn {\n\t\tslug: 'media',\n\t\taccess: {\n\t\t\tread: () => true,\n\t\t},\n\t\tfields: [\n\t\t\t{\n\t\t\t\tname: 'alt',\n\t\t\t\ttype: 'text',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'caption',\n\t\t\t\ttype: 'richText',\n\t\t\t\trequired: false,\n\t\t\t\teditor: lexicalEditor({\n\t\t\t\t\tfeatures: ({ defaultFeatures }) => {\n\t\t\t\t\t\treturn defaultFeatures.filter((feature) => {\n\t\t\t\t\t\t\treturn feature.key === 'paragraph' || feature.key === 'link';\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t},\n\t\t\t...(additionalFields ? additionalFields : []),\n\t\t],\n\t\tupload: {\n\t\t\tstaticDir: 'media',\n\t\t\thandlers: [\n\t\t\t\tasync (req: PayloadRequest, args) => {\n\t\t\t\t\tconst logger = req.payload.logger;\n\t\t\t\t\tconst { params } = args;\n\t\t\t\t\tconst { collection, filename } = params;\n\n\t\t\t\t\tif (collection !== 'media') {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst contentType = mime.lookup(filename);\n\t\t\t\t\tif (!contentType) {\n\t\t\t\t\t\tlogger.error(`Unable to find mime type for file: ${filename}`);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst headers = new Headers();\n\t\t\t\t\theaders.set('Content-Type', contentType);\n\t\t\t\t\theaders.set('Cache-Control', 'public, max-age=31536000');\n\n\t\t\t\t\treq.responseHeaders = headers;\n\t\t\t\t},\n\t\t\t],\n\t\t\timageSizes: [\n\t\t\t\t// Original Size (for WebP & Avif)\n\t\t\t\t{\n\t\t\t\t\tname: 'webp',\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'avif',\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Thumbnail Sizes\n\t\t\t\t{\n\t\t\t\t\tname: 'thumbnail',\n\t\t\t\t\twidth: 200,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tposition: 'centre',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'thumbnail_webp',\n\t\t\t\t\twidth: 200,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tposition: 'centre',\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'thumbnail_avif',\n\t\t\t\t\twidth: 200,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tposition: 'centre',\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Mobile Sizes\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile',\n\t\t\t\t\twidth: 500,\n\t\t\t\t\theight: undefined,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile_webp',\n\t\t\t\t\twidth: 500,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile_avif',\n\t\t\t\t\twidth: 500,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Tablet Sizes\n\t\t\t\t{\n\t\t\t\t\tname: 'tablet',\n\t\t\t\t\twidth: 800,\n\t\t\t\t\theight: undefined,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'tablet_webp',\n\t\t\t\t\twidth: 800,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'tablet_avif',\n\t\t\t\t\twidth: 800,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Desktop Sizes\n\t\t\t\t// {\n\t\t\t\t// \tname: 'desktop',\n\t\t\t\t// \twidth: 1200,\n\t\t\t\t// \theight: undefined,\n\t\t\t\t// },\n\t\t\t\t// {\n\t\t\t\t// \tname: 'desktop_webp',\n\t\t\t\t// \twidth: 1200,\n\t\t\t\t// \theight: undefined,\n\t\t\t\t// \tformatOptions: {\n\t\t\t\t// \t\tformat: 'webp',\n\t\t\t\t// \t\toptions: {\n\t\t\t\t// \t\t\tquality: 80,\n\t\t\t\t// \t\t},\n\t\t\t\t// \t},\n\t\t\t\t// },\n\t\t\t\t// {\n\t\t\t\t// \tname: 'desktop_avif',\n\t\t\t\t// \twidth: 1200,\n\t\t\t\t// \theight: undefined,\n\t\t\t\t// \tformatOptions: {\n\t\t\t\t// \t\tformat: 'avif',\n\t\t\t\t// \t\toptions: {\n\t\t\t\t// \t\t\tquality: 80,\n\t\t\t\t// \t\t},\n\t\t\t\t// \t},\n\t\t\t\t// },\n\t\t\t],\n\t\t},\n\t};\n};\n"],"names":["lexicalEditor","mime","Media","additionalFields","slug","access","read","fields","name","type","required","editor","features","defaultFeatures","filter","feature","key","upload","staticDir","handlers","req","args","logger","payload","params","collection","filename","contentType","lookup","error","headers","Headers","set","responseHeaders","imageSizes","width","undefined","height","formatOptions","format","options","quality","position"],"mappings":"AAAA,SAASA,aAAa,QAAQ,+BAA+B;AAC7D,YAAYC,UAAU,aAAa;AAGnC;;;CAGC,GACD,OAAO,MAAMC,QAAQ,CAACC;IACrB,OAAO;QACNC,MAAM;QACNC,QAAQ;YACPC,MAAM,IAAM;QACb;QACAC,QAAQ;YACP;gBACCC,MAAM;gBACNC,MAAM;gBACNC,UAAU;YACX;YACA;gBACCF,MAAM;gBACNC,MAAM;gBACNC,UAAU;gBACVC,QAAQX,cAAc;oBACrBY,UAAU,CAAC,EAAEC,eAAe,EAAE;wBAC7B,OAAOA,gBAAgBC,MAAM,CAAC,CAACC;4BAC9B,OAAOA,QAAQC,GAAG,KAAK,eAAeD,QAAQC,GAAG,KAAK;wBACvD;oBACD;gBACD;YACD;eACIb,mBAAmBA,mBAAmB,EAAE;SAC5C;QACDc,QAAQ;YACPC,WAAW;YACXC,UAAU;gBACT,OAAOC,KAAqBC;oBAC3B,MAAMC,SAASF,IAAIG,OAAO,CAACD,MAAM;oBACjC,MAAM,EAAEE,MAAM,EAAE,GAAGH;oBACnB,MAAM,EAAEI,UAAU,EAAEC,QAAQ,EAAE,GAAGF;oBAEjC,IAAIC,eAAe,SAAS;wBAC3B;oBACD;oB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AAe;gBACf;oBACCjC,MAAM;oBACN2B,OAAO;oBACPE,QAAQD;gBACT;gBACA;oBACC5B,MAAM;oBACN2B,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCjC,MAAM;oBACN2B,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;aA6BA;QACF;IACD;AACD,EAAE"}
1
+ {"version":3,"sources":["../../src/collections/Media.ts"],"sourcesContent":["import { lexicalEditor } from '@payloadcms/richtext-lexical';\nimport * as mime from 'mime-types';\nimport type { CollectionConfig, Field, PayloadRequest } from 'payload';\n\n/**\n * Media Collection Configuration\n * Additional fields will be appended to the media collection.\n */\nexport const Media = (additionalFields?: Field[]): CollectionConfig => {\n\treturn {\n\t\tslug: 'media',\n\t\taccess: {\n\t\t\tread: () => true,\n\t\t},\n\t\tfields: [\n\t\t\t{\n\t\t\t\tname: 'alt',\n\t\t\t\ttype: 'text',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'caption',\n\t\t\t\ttype: 'richText',\n\t\t\t\trequired: false,\n\t\t\t\teditor: lexicalEditor({\n\t\t\t\t\tfeatures: ({ defaultFeatures }) => {\n\t\t\t\t\t\treturn defaultFeatures.filter((feature) => {\n\t\t\t\t\t\t\treturn feature.key === 'paragraph' || feature.key === 'link';\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t},\n\t\t\t...(additionalFields ? additionalFields : []),\n\t\t],\n\t\tupload: {\n\t\t\tstaticDir: 'media',\n\t\t\tadminThumbnail: 'thumbnail',\n\t\t\thandlers: [\n\t\t\t\tasync (req: PayloadRequest, args) => {\n\t\t\t\t\tconst logger = req.payload.logger;\n\t\t\t\t\tconst { params } = args;\n\t\t\t\t\tconst { collection, filename } = params;\n\n\t\t\t\t\tif (collection !== 'media') {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst contentType = mime.lookup(filename);\n\t\t\t\t\tif (!contentType) {\n\t\t\t\t\t\tlogger.error(`Unable to find mime type for file: ${filename}`);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst headers = new Headers();\n\t\t\t\t\theaders.set('Content-Type', contentType);\n\t\t\t\t\theaders.set('Cache-Control', 'public, max-age=31536000');\n\n\t\t\t\t\treq.responseHeaders = headers;\n\t\t\t\t},\n\t\t\t],\n\t\t\timageSizes: [\n\t\t\t\t// Original Size (for WebP & Avif)\n\t\t\t\t{\n\t\t\t\t\tname: 'webp',\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'avif',\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 60,\n\t\t\t\t\t\t\teffort: 1,\n\t\t\t\t\t\t\tchromaSubsampling: '4:4:4',\n\t\t\t\t\t\t\tbitdepth: 8,\n\t\t\t\t\t\t\tlossless: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Thumbnail Sizes\n\t\t\t\t{\n\t\t\t\t\tname: 'thumbnail',\n\t\t\t\t\twidth: 200,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tposition: 'centre',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'thumbnail_webp',\n\t\t\t\t\twidth: 200,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tposition: 'centre',\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'thumbnail_avif',\n\t\t\t\t\twidth: 200,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tposition: 'centre',\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 60,\n\t\t\t\t\t\t\teffort: 1,\n\t\t\t\t\t\t\tchromaSubsampling: '4:4:4',\n\t\t\t\t\t\t\tbitdepth: 8,\n\t\t\t\t\t\t\tlossless: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Mobile Sizes\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile',\n\t\t\t\t\twidth: 500,\n\t\t\t\t\theight: undefined,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile_webp',\n\t\t\t\t\twidth: 500,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile_avif',\n\t\t\t\t\twidth: 500,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 60,\n\t\t\t\t\t\t\teffort: 1,\n\t\t\t\t\t\t\tchromaSubsampling: '4:4:4',\n\t\t\t\t\t\t\tbitdepth: 8,\n\t\t\t\t\t\t\tlossless: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Tablet Sizes\n\t\t\t\t{\n\t\t\t\t\tname: 'tablet',\n\t\t\t\t\twidth: 800,\n\t\t\t\t\theight: undefined,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'tablet_webp',\n\t\t\t\t\twidth: 800,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'webp',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'tablet_avif',\n\t\t\t\t\twidth: 800,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\tformatOptions: {\n\t\t\t\t\t\tformat: 'avif',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tquality: 60,\n\t\t\t\t\t\t\teffort: 1,\n\t\t\t\t\t\t\tchromaSubsampling: '4:4:4',\n\t\t\t\t\t\t\tbitdepth: 8,\n\t\t\t\t\t\t\tlossless: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// Desktop Sizes\n\t\t\t\t// {\n\t\t\t\t// \tname: 'desktop',\n\t\t\t\t// \twidth: 1200,\n\t\t\t\t// \theight: undefined,\n\t\t\t\t// },\n\t\t\t\t// {\n\t\t\t\t// \tname: 'desktop_webp',\n\t\t\t\t// \twidth: 1200,\n\t\t\t\t// \theight: undefined,\n\t\t\t\t// \tformatOptions: {\n\t\t\t\t// \t\tformat: 'webp',\n\t\t\t\t// \t\toptions: {\n\t\t\t\t// \t\t\tquality: 80,\n\t\t\t\t// \t\t},\n\t\t\t\t// \t},\n\t\t\t\t// },\n\t\t\t\t// {\n\t\t\t\t// \tname: 'desktop_avif',\n\t\t\t\t// \twidth: 1200,\n\t\t\t\t// \theight: undefined,\n\t\t\t\t// \tformatOptions: {\n\t\t\t\t// \t\tformat: 'avif',\n\t\t\t\t// \t\toptions: {\n\t\t\t\t// \t\t\tquality: 80,\n\t\t\t\t// \t\t},\n\t\t\t\t// \t},\n\t\t\t\t// },\n\t\t\t],\n\t\t},\n\t};\n};\n"],"names":["lexicalEditor","mime","Media","additionalFields","slug","access","read","fields","name","type","required","editor","features","defaultFeatures","filter","feature","key","upload","staticDir","adminThumbnail","handlers","req","args","logger","payload","params","collection","filename","contentType","lookup","error","headers","Headers","set","responseHeaders","imageSizes","width","undefined","height","formatOptions","format","options","quality","effort","chromaSubsampling","bitdepth","lossless","position"],"mappings":"AAAA,SAASA,aAAa,QAAQ,+BAA+B;AAC7D,YAAYC,UAAU,aAAa;AAGnC;;;CAGC,GACD,OAAO,MAAMC,QAAQ,CAACC;IACrB,OAAO;QACNC,MAAM;QACNC,QAAQ;YACPC,MAAM,IAAM;QACb;QACAC,QAAQ;YACP;gBACCC,MAAM;gBACNC,MAAM;gBACNC,UAAU;YACX;YACA;gBACCF,MAAM;gBACNC,MAAM;gBACNC,UAAU;gBACVC,QAAQX,cAAc;oBACrBY,UAAU,CAAC,EAAEC,eAAe,EAAE;wBAC7B,OAAOA,gBAAgBC,MAAM,CAAC,CAACC;4BAC9B,OAAOA,QAAQC,GAAG,KAAK,eAAeD,QAAQC,GAAG,KAAK;wBACvD;oBACD;gBACD;YACD;eACIb,mBAAmBA,mBAAmB,EAAE;SAC5C;QACDc,QAAQ;YACPC,WAAW;YACXC,gBAAgB;YAChBC,UAAU;gBACT,OAAOC,KAAqBC;oBAC3B,MAAMC,SAASF,IAAIG,OAAO,CAACD,MAAM;oBACjC,MAAM,EAAEE,MAAM,EAAE,GAAGH;oBACnB,MAAM,EAAEI,UAAU,EAAEC,QAAQ,EAAE,GAAGF;oBAEjC,IAAIC,eAAe,SAAS;wBAC3B;oBACD;oBAEA,MAAME,cAAc3B,KAAK4B,MAAM,CAACF;oBAChC,IAAI,CAACC,aAAa;wBACjBL,OAAOO,KAAK,CAAC,CAAC,mCAAmC,EAAEH,SAAS,CAAC;wBAC7D;oBACD;oBAEA,MAAMI,UAAU,IA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ACA,eAAe;gBACf;oBACCtC,MAAM;oBACN4B,OAAO;oBACPE,QAAQD;gBACT;gBACA;oBACC7B,MAAM;oBACN4B,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACClC,MAAM;oBACN4B,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;4BACTC,QAAQ;4BACRC,mBAAmB;4BACnBC,UAAU;4BACVC,UAAU;wBACX;oBACD;gBACD;aA6BA;QACF;IACD;AACD,EAAE"}
package/dist/index.js CHANGED
@@ -39,6 +39,9 @@ import env from './util/env.js';
39
39
  incomingConfig.typescript.outputFile = './src/types/payload.ts';
40
40
  // Map collections & add hooks
41
41
  incomingConfig.collections = (incomingConfig.collections || []).map((collection)=>{
42
+ if (collection.upload) {
43
+ return collection;
44
+ }
42
45
  return {
43
46
  ...collection,
44
47
  hooks: {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Plugin } from 'payload';\nimport { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';\nimport { fieldMapper, schemas } from './plugin/schema.js';\nimport type { PayloadHelperPluginConfig } from './types.js';\nimport env from './util/env.js';\nimport { seoPlugin } from '@payloadcms/plugin-seo';\nimport { SEOFields } from './common/SEO.js';\n\n// export const test = (pluginOptions: PayloadHelperPluginConfig): Plugin[] => {\n// \treturn [\n// \t\tseoPlugin({\n// \t\t\tcollections: pluginOptions?.seo?.collections,\n// \t\t\tglobals: pluginOptions?.seo?.globals,\n// \t\t\tfields: [...SEOFields, pluginOptions.seo?.fields],\n// \t\t\ttabbedUI: true,\n// \t\t\tuploadsCollection: 'media',\n// \t\t\tgenerateTitle: pluginOptions?.seo?.generateTitle ?\n// \t\t\t\tpluginOptions?.seo?.generateTitle :\n// \t\t\t\t({ doc }) => `${pluginOptions.siteName} — ${doc?.title?.value ?? ''}`,\n// \t\t\tgenerateDescription: pluginOptions?.seo?.generateDescription ?\n// \t\t\t\tpluginOptions?.seo?.generateDescription :\n// \t\t\t\t({ doc }) => doc?.excerpt?.value,\n// \t\t}),\n// \t];\n// };\n\n/**\n * Payload Helper Plugin for websites at ainsley.dev\n *\n * @constructor\n * @param pluginOptions\n */\nexport const payloadHelper =\n\t(pluginOptions: PayloadHelperPluginConfig) =>\n\t(incomingConfig: Config): Config => {\n\t\tconst genGoLang = env.bool('GEN_GOLANG', false);\n\t\tif (genGoLang) {\n\t\t\tincomingConfig.typescript = {\n\t\t\t\t...incomingConfig.typescript,\n\t\t\t\tschema: schemas,\n\t\t\t};\n\t\t\t// biome-ignore lint/style/noParameterAssign: Need to change field mapper.\n\t\t\tincomingConfig = fieldMapper(incomingConfig);\n\t\t}\n\n\t\t// TODO: Validate Config\n\n\t\t// Update typescript generation file\n\t\tincomingConfig.typescript = incomingConfig.typescript || {};\n\t\tincomingConfig.typescript.outputFile = './src/types/payload.ts';\n\n\t\t// Map collections & add hooks\n\t\tincomingConfig.collections = (incomingConfig.collections || []).map(\n\t\t\t(collection): CollectionConfig => {\n\t\t\t\treturn {\n\t\t\t\t\t...collection,\n\t\t\t\t\thooks: {\n\t\t\t\t\t\tafterChange: [\n\t\t\t\t\t\t\tcacheHookCollections({\n\t\t\t\t\t\t\t\tserver: pluginOptions.webServer,\n\t\t\t\t\t\t\t\tslug: collection.slug,\n\t\t\t\t\t\t\t\tfields: collection.fields,\n\t\t\t\t\t\t\t\tisCollection: true,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t);\n\n\t\t// Map globals & add hooks\n\t\tincomingConfig.globals = (incomingConfig.globals || []).map((global) => {\n\t\t\treturn {\n\t\t\t\t...global,\n\t\t\t\thooks: {\n\t\t\t\t\tafterChange: [\n\t\t\t\t\t\tcacheHookGlobals({\n\t\t\t\t\t\t\tserver: pluginOptions.webServer,\n\t\t\t\t\t\t\tslug: global.slug,\n\t\t\t\t\t\t\tfields: global.fields,\n\t\t\t\t\t\t\tisCollection: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\n\t\treturn incomingConfig;\n\t};\n"],"names":["cacheHookCollections","cacheHookGlobals","fieldMapper","schemas","env","payloadHelper","pluginOptions","incomingConfig","genGoLang","bool","typescript","schema","outputFile","collections","map","collection","hooks","afterChange","server","webServer","slug","fields","isCollection","globals","global"],"mappings":"AACA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,oBAAoB;AAC3E,SAASC,WAAW,EAAEC,OAAO,QAAQ,qBAAqB;AAE1D,OAAOC,SAAS,gBAAgB;AAIhC,gFAAgF;AAChF,YAAY;AACZ,gBAAgB;AAChB,mDAAmD;AACnD,2CAA2C;AAC3C,wDAAwD;AACxD,qBAAqB;AACrB,iCAAiC;AACjC,wDAAwD;AACxD,0CAA0C;AAC1C,6EAA6E;AAC7E,oEAAoE;AACpE,gDAAgD;AAChD,wCAAwC;AACxC,QAAQ;AACR,MAAM;AACN,KAAK;AAEL;;;;;CAKC,GACD,OAAO,MAAMC,gBACZ,CAACC,gBACD,CAACC;QACA,MAAMC,YAAYJ,IAAIK,IAAI,CAAC,cAAc;QACzC,IAAID,WAAW;YACdD,eAAeG,UAAU,GAAG;gBAC3B,GAAGH,eAAeG,UAAU;gBAC5BC,QAAQR;YACT;YACA,0EAA0E;YAC1EI,iBAAiBL,YAAYK;QAC9B;QAEA,wBAAwB;QAExB,oCAAoC;QACpCA,eAAeG,UAAU,GAAGH,eAAeG,UAAU,IAAI,CAAC;QAC1DH,eAAeG,UAAU,CAACE,UAAU,GAAG;QAEvC,8BAA8B;QAC9BL,eAAeM,WAAW,GAAG,AAACN,CAAAA,eAAeM,WAAW,IAAI,EAAE,AAAD,EAAGC,GAAG,CAClE,CAACC;YACA,OAAO;gBACN,GAAGA,UAAU;gBACbC,OAAO;oBACNC,aAAa;wBACZjB,qBAAqB;4BACpBkB,QAAQZ,cAAca,SAAS;4BAC/BC,MAAML,WAAWK,IAAI;4BACrBC,QAAQN,WAAWM,MAAM;4BACzBC,cAAc;wBACf;qBACA;gBACF;YACD;QACD;QAGD,0BAA0B;QAC1Bf,eAAegB,OAAO,GAAG,AAAChB,CAAAA,eAAegB,OAAO,IAAI,EAAE,AAAD,EAAGT,GAAG,CAAC,CAACU;YAC5D,OAAO;gBACN,GAAGA,MAAM;gBACTR,OAAO;oBACNC,aAAa;wBACZhB,iBAAiB;4BAChBiB,QAAQZ,cAAca,SAAS;4BAC/BC,MAAMI,OAAOJ,IAAI;4BACjBC,QAAQG,OAAOH,MAAM;4BACrBC,cAAc;wBACf;qBACA;gBACF;YACD;QACD;QAEA,OAAOf;IACR,EAAE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config } from 'payload';\nimport { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';\nimport { fieldMapper, schemas } from './plugin/schema.js';\nimport type { PayloadHelperPluginConfig } from './types.js';\nimport env from './util/env.js';\n\n// export const test = (pluginOptions: PayloadHelperPluginConfig): Plugin[] => {\n// \treturn [\n// \t\tseoPlugin({\n// \t\t\tcollections: pluginOptions?.seo?.collections,\n// \t\t\tglobals: pluginOptions?.seo?.globals,\n// \t\t\tfields: [...SEOFields, pluginOptions.seo?.fields],\n// \t\t\ttabbedUI: true,\n// \t\t\tuploadsCollection: 'media',\n// \t\t\tgenerateTitle: pluginOptions?.seo?.generateTitle ?\n// \t\t\t\tpluginOptions?.seo?.generateTitle :\n// \t\t\t\t({ doc }) => `${pluginOptions.siteName} — ${doc?.title?.value ?? ''}`,\n// \t\t\tgenerateDescription: pluginOptions?.seo?.generateDescription ?\n// \t\t\t\tpluginOptions?.seo?.generateDescription :\n// \t\t\t\t({ doc }) => doc?.excerpt?.value,\n// \t\t}),\n// \t];\n// };\n\n/**\n * Payload Helper Plugin for websites at ainsley.dev\n *\n * @constructor\n * @param pluginOptions\n */\nexport const payloadHelper =\n\t(pluginOptions: PayloadHelperPluginConfig) =>\n\t(incomingConfig: Config): Config => {\n\t\tconst genGoLang = env.bool('GEN_GOLANG', false);\n\t\tif (genGoLang) {\n\t\t\tincomingConfig.typescript = {\n\t\t\t\t...incomingConfig.typescript,\n\t\t\t\tschema: schemas,\n\t\t\t};\n\t\t\t// biome-ignore lint/style/noParameterAssign: Need to change field mapper.\n\t\t\tincomingConfig = fieldMapper(incomingConfig);\n\t\t}\n\n\t\t// TODO: Validate Config\n\n\t\t// Update typescript generation file\n\t\tincomingConfig.typescript = incomingConfig.typescript || {};\n\t\tincomingConfig.typescript.outputFile = './src/types/payload.ts';\n\n\t\t// Map collections & add hooks\n\t\tincomingConfig.collections = (incomingConfig.collections || []).map(\n\t\t\t(collection): CollectionConfig => {\n\t\t\t\tif (collection.upload) {\n\t\t\t\t\treturn collection;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\t...collection,\n\t\t\t\t\thooks: {\n\t\t\t\t\t\tafterChange: [\n\t\t\t\t\t\t\tcacheHookCollections({\n\t\t\t\t\t\t\t\tserver: pluginOptions.webServer,\n\t\t\t\t\t\t\t\tslug: collection.slug,\n\t\t\t\t\t\t\t\tfields: collection.fields,\n\t\t\t\t\t\t\t\tisCollection: true,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t);\n\n\t\t// Map globals & add hooks\n\t\tincomingConfig.globals = (incomingConfig.globals || []).map((global) => {\n\t\t\treturn {\n\t\t\t\t...global,\n\t\t\t\thooks: {\n\t\t\t\t\tafterChange: [\n\t\t\t\t\t\tcacheHookGlobals({\n\t\t\t\t\t\t\tserver: pluginOptions.webServer,\n\t\t\t\t\t\t\tslug: global.slug,\n\t\t\t\t\t\t\tfields: global.fields,\n\t\t\t\t\t\t\tisCollection: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\n\t\treturn incomingConfig;\n\t};\n"],"names":["cacheHookCollections","cacheHookGlobals","fieldMapper","schemas","env","payloadHelper","pluginOptions","incomingConfig","genGoLang","bool","typescript","schema","outputFile","collections","map","collection","upload","hooks","afterChange","server","webServer","slug","fields","isCollection","globals","global"],"mappings":"AACA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,oBAAoB;AAC3E,SAASC,WAAW,EAAEC,OAAO,QAAQ,qBAAqB;AAE1D,OAAOC,SAAS,gBAAgB;AAEhC,gFAAgF;AAChF,YAAY;AACZ,gBAAgB;AAChB,mDAAmD;AACnD,2CAA2C;AAC3C,wDAAwD;AACxD,qBAAqB;AACrB,iCAAiC;AACjC,wDAAwD;AACxD,0CAA0C;AAC1C,6EAA6E;AAC7E,oEAAoE;AACpE,gDAAgD;AAChD,wCAAwC;AACxC,QAAQ;AACR,MAAM;AACN,KAAK;AAEL;;;;;CAKC,GACD,OAAO,MAAMC,gBACZ,CAACC,gBACD,CAACC;QACA,MAAMC,YAAYJ,IAAIK,IAAI,CAAC,cAAc;QACzC,IAAID,WAAW;YACdD,eAAeG,UAAU,GAAG;gBAC3B,GAAGH,eAAeG,UAAU;gBAC5BC,QAAQR;YACT;YACA,0EAA0E;YAC1EI,iBAAiBL,YAAYK;QAC9B;QAEA,wBAAwB;QAExB,oCAAoC;QACpCA,eAAeG,UAAU,GAAGH,eAAeG,UAAU,IAAI,CAAC;QAC1DH,eAAeG,UAAU,CAACE,UAAU,GAAG;QAEvC,8BAA8B;QAC9BL,eAAeM,WAAW,GAAG,AAACN,CAAAA,eAAeM,WAAW,IAAI,EAAE,AAAD,EAAGC,GAAG,CAClE,CAACC;YACA,IAAIA,WAAWC,MAAM,EAAE;gBACtB,OAAOD;YACR;YACA,OAAO;gBACN,GAAGA,UAAU;gBACbE,OAAO;oBACNC,aAAa;wBACZlB,qBAAqB;4BACpBmB,QAAQb,cAAcc,SAAS;4BAC/BC,MAAMN,WAAWM,IAAI;4BACrBC,QAAQP,WAAWO,MAAM;4BACzBC,cAAc;wBACf;qBACA;gBACF;YACD;QACD;QAGD,0BAA0B;QAC1BhB,eAAeiB,OAAO,GAAG,AAACjB,CAAAA,eAAeiB,OAAO,IAAI,EAAE,AAAD,EAAGV,GAAG,CAAC,CAACW;YAC5D,OAAO;gBACN,GAAGA,MAAM;gBACTR,OAAO;oBACNC,aAAa;wBACZjB,iBAAiB;4BAChBkB,QAAQb,cAAcc,SAAS;4BAC/BC,MAAMI,OAAOJ,IAAI;4BACjBC,QAAQG,OAAOH,MAAM;4BACrBC,cAAc;wBACf;qBACA;gBACF;YACD;QACD;QAEA,OAAOhB;IACR,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainsleydev/payload-helper",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "Payload CMS utilities, collections and global types for ainsley.dev builds",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,7 +37,6 @@
37
37
  "@nouance/payload-better-fields-plugin": "^1.4.1",
38
38
  "@payloadcms/db-sqlite": "3.0.0-beta.76",
39
39
  "@payloadcms/richtext-lexical": "3.0.0-beta.76",
40
- "@payloadcms/storage-s3": "3.0.0-beta.76",
41
40
  "@payloadcms/plugin-form-builder": "3.0.0-beta.76",
42
41
  "@payloadcms/plugin-seo": "3.0.0-beta.76",
43
42
  "@types/json-schema": "^7.0.15",