@ainsleydev/payload-helper 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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,QA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C,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.21",
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",