@ainsleydev/payload-helper 0.0.4 → 0.0.6

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.
Files changed (42) hide show
  1. package/dist/cli/types.js +1 -2
  2. package/dist/cli/types.js.map +1 -1
  3. package/dist/collections/Media.d.ts +10 -0
  4. package/dist/collections/Media.js +7 -13
  5. package/dist/collections/Media.js.map +1 -1
  6. package/dist/collections/Redirects.d.ts +10 -0
  7. package/dist/common/SEO.d.ts +6 -0
  8. package/dist/endpoints/slug.d.ts +7 -0
  9. package/dist/globals/Navigation.d.ts +28 -0
  10. package/dist/globals/Settings.d.ts +10 -0
  11. package/dist/globals/Settings.js +3 -3
  12. package/dist/globals/Settings.js.map +1 -1
  13. package/dist/globals/countries.d.ts +1 -0
  14. package/dist/globals/locales.d.ts +7 -0
  15. package/dist/index.d.ts +9 -0
  16. package/dist/index.js +2 -3
  17. package/dist/index.js.map +1 -1
  18. package/dist/plugin/schema.d.ts +21 -0
  19. package/dist/seed/down.d.ts +13 -0
  20. package/dist/seed/down.js +35 -0
  21. package/dist/seed/down.js.map +1 -0
  22. package/dist/seed/seed.d.ts +31 -0
  23. package/dist/seed/seed.js +58 -0
  24. package/dist/seed/seed.js.map +1 -0
  25. package/dist/seed/types.d.ts +125 -0
  26. package/dist/seed/types.js +3 -0
  27. package/dist/seed/types.js.map +1 -0
  28. package/dist/seed/up.d.ts +23 -0
  29. package/dist/seed/up.js +55 -0
  30. package/dist/seed/up.js.map +1 -0
  31. package/dist/types.d.ts +10 -0
  32. package/dist/types.js +4 -0
  33. package/dist/types.js.map +1 -0
  34. package/dist/util/env.d.ts +12 -0
  35. package/dist/util/fields.d.ts +7 -0
  36. package/dist/util/lexical.d.ts +15 -0
  37. package/dist/util/lexical.js +87 -0
  38. package/dist/util/lexical.js.map +1 -0
  39. package/dist/util/lexical.test.js +21 -0
  40. package/dist/util/lexical.test.js.map +1 -0
  41. package/dist/util/validation.d.ts +2 -0
  42. package/package.json +9 -16
package/dist/cli/types.js CHANGED
@@ -9,7 +9,7 @@ import { findConfig, importConfig } from 'payload/node';
9
9
  try {
10
10
  configPath = findConfig();
11
11
  } catch (e) {
12
- console.log('Error finding config: ' + e);
12
+ console.log(`Error finding config: ${e}`);
13
13
  return;
14
14
  }
15
15
  // Set the environment variable to generate Golang types.
@@ -20,7 +20,6 @@ import { findConfig, importConfig } from 'payload/node';
20
20
  config,
21
21
  disableDBConnect: true,
22
22
  disableOnInit: true,
23
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
23
  // @ts-ignore
25
24
  local: true,
26
25
  secret: '--unused--'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/types.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport { configToJSONSchema, getPayload } from 'payload';\nimport { findConfig, importConfig } from 'payload/node';\n\n/**\n * Creates JSON schema types of Payloads Collections & Globals\n */\nexport async function generateTypes(outFile: string): Promise<void> {\n\tconsole.log('Compiling JSON types for Collections and Globals...');\n\n\tlet configPath = '';\n\ttry {\n\t\tconfigPath = findConfig();\n\t} catch (e) {\n\t\tconsole.log('Error finding config: ' + e);\n\t\treturn;\n\t}\n\n\t// Set the environment variable to generate Golang types.\n\tprocess.env.GEN_GOLANG = 'true';\n\n\tconst config = await importConfig(configPath);\n\tconst outputFile = (process.env.PAYLOAD_TS_OUTPUT_PATH || config.typescript.outputFile).replace(\n\t\t'.ts',\n\t\t'.json',\n\t);\n\n\tconst payload = await getPayload({\n\t\tconfig,\n\t\tdisableDBConnect: true,\n\t\tdisableOnInit: true,\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-ignore\n\t\tlocal: true,\n\t\tsecret: '--unused--',\n\t});\n\n\tconst jsonSchema = configToJSONSchema(payload.config, payload.db.defaultIDType);\n\tconst prettyJSON = JSON.stringify(jsonSchema, null, 4);\n\n\tfs.writeFileSync(outputFile, prettyJSON);\n\n\tconsole.log(`JSON types written to: ${outputFile}`);\n\n\tdelete process.env.GEN_GOLANG;\n}\n"],"names":["fs","configToJSONSchema","getPayload","findConfig","importConfig","generateTypes","outFile","console","log","configPath","e","process","env","GEN_GOLANG","config","outputFile","PAYLOAD_TS_OUTPUT_PATH","typescript","replace","payload","disableDBConnect","disableOnInit","local","secret","jsonSchema","db","defaultIDType","prettyJSON","JSON","stringify","writeFileSync"],"mappings":"AAAA,YAAYA,QAAQ,UAAU;AAC9B,SAASC,kBAAkB,EAAEC,UAAU,QAAQ,UAAU;AACzD,SAASC,UAAU,EAAEC,YAAY,QAAQ,eAAe;AAExD;;CAEC,GACD,OAAO,eAAeC,cAAcC,OAAe;IAClDC,QAAQC,GAAG,CAAC;IAEZ,IAAIC,aAAa;IACjB,IAAI;QACHA,aAAaN;IACd,EAAE,OAAOO,GAAG;QACXH,QAAQC,GAAG,CAAC,2BAA2BE;QACvC;IACD;IAEA,yDAAyD;IACzDC,QAAQC,GAAG,CAACC,UAAU,GAAG;IAEzB,MAAMC,SAAS,MAAMV,aAAaK;IAClC,MAAMM,aAAa,AAACJ,CAAAA,QAAQC,GAAG,CAACI,sBAAsB,IAAIF,OAAOG,UAAU,CAACF,UAAU,AAAD,EAAGG,OAAO,CAC9F,OACA;IAGD,MAAMC,UAAU,MAAMjB,WAAW;QAChCY;QACAM,kBAAkB;QAClBC,eAAe;QACf,6DAA6D;QAC7D,aAAa;QACbC,OAAO;QACPC,QAAQ;IACT;IAEA,MAAMC,aAAavB,mBAAmBkB,QAAQL,MAAM,EAAEK,QAAQM,EAAE,CAACC,aAAa;IAC9E,MAAMC,aAAaC,KAAKC,SAAS,CAACL,YAAY,MAAM;IAEpDxB,GAAG8B,aAAa,CAACf,YAAYY;IAE7BpB,QAAQC,GAAG,CAAC,CAAC,uBAAuB,EAAEO,WAAW,CAAC;IAElD,OAAOJ,QAAQC,GAAG,CAACC,UAAU;AAC9B"}
1
+ {"version":3,"sources":["../../src/cli/types.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport { configToJSONSchema, getPayload } from 'payload';\nimport { findConfig, importConfig } from 'payload/node';\n\n/**\n * Creates JSON schema types of Payloads Collections & Globals\n */\nexport async function generateTypes(outFile: string): Promise<void> {\n\tconsole.log('Compiling JSON types for Collections and Globals...');\n\n\tlet configPath = '';\n\ttry {\n\t\tconfigPath = findConfig();\n\t} catch (e) {\n\t\tconsole.log(`Error finding config: ${e}`);\n\t\treturn;\n\t}\n\n\t// Set the environment variable to generate Golang types.\n\tprocess.env.GEN_GOLANG = 'true';\n\n\tconst config = await importConfig(configPath);\n\tconst outputFile = (process.env.PAYLOAD_TS_OUTPUT_PATH || config.typescript.outputFile).replace(\n\t\t'.ts',\n\t\t'.json',\n\t);\n\n\tconst payload = await getPayload({\n\t\tconfig,\n\t\tdisableDBConnect: true,\n\t\tdisableOnInit: true,\n\t\t// @ts-ignore\n\t\tlocal: true,\n\t\tsecret: '--unused--',\n\t});\n\n\tconst jsonSchema = configToJSONSchema(payload.config, payload.db.defaultIDType);\n\tconst prettyJSON = JSON.stringify(jsonSchema, null, 4);\n\n\tfs.writeFileSync(outputFile, prettyJSON);\n\n\tconsole.log(`JSON types written to: ${outputFile}`);\n\n\tdelete process.env.GEN_GOLANG;\n}\n"],"names":["fs","configToJSONSchema","getPayload","findConfig","importConfig","generateTypes","outFile","console","log","configPath","e","process","env","GEN_GOLANG","config","outputFile","PAYLOAD_TS_OUTPUT_PATH","typescript","replace","payload","disableDBConnect","disableOnInit","local","secret","jsonSchema","db","defaultIDType","prettyJSON","JSON","stringify","writeFileSync"],"mappings":"AAAA,YAAYA,QAAQ,UAAU;AAC9B,SAASC,kBAAkB,EAAEC,UAAU,QAAQ,UAAU;AACzD,SAASC,UAAU,EAAEC,YAAY,QAAQ,eAAe;AAExD;;CAEC,GACD,OAAO,eAAeC,cAAcC,OAAe;IAClDC,QAAQC,GAAG,CAAC;IAEZ,IAAIC,aAAa;IACjB,IAAI;QACHA,aAAaN;IACd,EAAE,OAAOO,GAAG;QACXH,QAAQC,GAAG,CAAC,CAAC,sBAAsB,EAAEE,EAAE,CAAC;QACxC;IACD;IAEA,yDAAyD;IACzDC,QAAQC,GAAG,CAACC,UAAU,GAAG;IAEzB,MAAMC,SAAS,MAAMV,aAAaK;IAClC,MAAMM,aAAa,AAACJ,CAAAA,QAAQC,GAAG,CAACI,sBAAsB,IAAIF,OAAOG,UAAU,CAACF,UAAU,AAAD,EAAGG,OAAO,CAC9F,OACA;IAGD,MAAMC,UAAU,MAAMjB,WAAW;QAChCY;QACAM,kBAAkB;QAClBC,eAAe;QACf,aAAa;QACbC,OAAO;QACPC,QAAQ;IACT;IAEA,MAAMC,aAAavB,mBAAmBkB,QAAQL,MAAM,EAAEK,QAAQM,EAAE,CAACC,aAAa;IAC9E,MAAMC,aAAaC,KAAKC,SAAS,CAACL,YAAY,MAAM;IAEpDxB,GAAG8B,aAAa,CAACf,YAAYY;IAE7BpB,QAAQC,GAAG,CAAC,CAAC,uBAAuB,EAAEO,WAAW,CAAC;IAElD,OAAOJ,QAAQC,GAAG,CAACC,UAAU;AAC9B"}
@@ -0,0 +1,10 @@
1
+ import type { CollectionConfig, Field } from 'payload';
2
+ /**
3
+ * Media Collection Configuration
4
+ * Additional fields will be appended to the media collection.
5
+ *
6
+ * @constructor
7
+ * @param editor
8
+ * @param additionalFields
9
+ */
10
+ export declare const Media: (additionalFields?: Field[]) => CollectionConfig;
@@ -1,3 +1,7 @@
1
+ // import type {
2
+ // LexicalRichTextAdapterProvider,
3
+ // LexicalEditorProps,
4
+ // } from '@payloadcms/richtext-lexical';
1
5
  /**
2
6
  * Media Collection Configuration
3
7
  * Additional fields will be appended to the media collection.
@@ -5,7 +9,8 @@
5
9
  * @constructor
6
10
  * @param editor
7
11
  * @param additionalFields
8
- */ export const Media = (editor, additionalFields)=>{
12
+ */ export const Media = (//editor?: (props?: LexicalEditorProps) => LexicalRichTextAdapterProvider,
13
+ additionalFields)=>{
9
14
  return {
10
15
  slug: 'media',
11
16
  access: {
@@ -20,18 +25,7 @@
20
25
  {
21
26
  name: 'caption',
22
27
  type: 'richText',
23
- required: false,
24
- editor: editor({
25
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
- // @ts-ignore
27
- features: ({ defaultFeatures })=>{
28
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
29
- // @ts-ignore
30
- return defaultFeatures.filter((feature)=>{
31
- return feature.key === 'paragraph' || feature.key === 'link';
32
- });
33
- }
34
- })
28
+ required: false
35
29
  },
36
30
  ...additionalFields ? additionalFields : []
37
31
  ],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/Media.ts"],"sourcesContent":["import type { CollectionConfig, Field } from 'payload';\n\nimport {\n\tLexicalEditorProps,\n\tLexicalRichTextAdapterProvider,\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n} from '@payloadcms/richtext-lexical/dist/types';\n\n/**\n * Media Collection Configuration\n * Additional fields will be appended to the media collection.\n *\n * @constructor\n * @param editor\n * @param additionalFields\n */\nexport const Media = (\n\teditor: (props?: LexicalEditorProps) => LexicalRichTextAdapterProvider,\n\tadditionalFields?: Field[],\n): 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: editor({\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tfeatures: ({ defaultFeatures }) => {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t\t\t\t// @ts-ignore\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\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: 400,\n\t\t\t\t\theight: 300,\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: 400,\n\t\t\t\t\theight: 300,\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: 400,\n\t\t\t\t\theight: 300,\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: 768,\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: 768,\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: 768,\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: 1024,\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: 1024,\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: 1024,\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":["Media","editor","additionalFields","slug","access","read","fields","name","type","required","features","defaultFeatures","filter","feature","key","upload","staticDir","imageSizes","width","undefined","height","formatOptions","format","options","quality","position"],"mappings":"AASA;;;;;;;CAOC,GACD,OAAO,MAAMA,QAAQ,CACpBC,QACAC;IAEA,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;gBACVR,QAAQA,OAAO;oBACd,6DAA6D;oBAC7D,aAAa;oBACbS,UAAU,CAAC,EAAEC,eAAe,EAAE;wBAC7B,6DAA6D;wBAC7D,aAAa;wBACb,OAAOA,gBAAgBC,MAAM,CAAC,CAACC;4BAC9B,OAAOA,QAAQC,GAAG,KAAK,eAAeD,QAAQC,GAAG,KAAK;wBACvD;oBACD;gBACD;YACD;eACIZ,mBAAmBA,mBAAmB,EAAE;SAC5C;QACDa,QAAQ;YACPC,WAAW;YACXC,YAAY;gBACX,kCAAkC;gBAClC;oBACCV,MAAM;oBACNW,OAAOC;oBACPC,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCjB,MAAM;oBACNW,OAAOC;oBACPC,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA,kBAAkB;gBAClB;oBACCjB,MAAM;oBACNW,OAAO;oBACPE,QAAQ;oBACRK,UAAU;gBACX;gBACA;oBACClB,MAAM;oBACNW,OAAO;oBACPE,QAAQ;oBACRK,UAAU;oBACVJ,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCjB,MAAM;oBACNW,OAAO;oBACPE,QAAQ;oBACRK,UAAU;oBACVJ,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA,eAAe;gBACf;oBACCjB,MAAM;oBACNW,OAAO;oBACPE,QAAQD;gBACT;gBACA;oBACCZ,MAAM;oBACNW,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCjB,MAAM;oBACNW,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA,eAAe;gBACf;oBACCjB,MAAM;oBACNW,OAAO;oBACPE,QAAQD;gBACT;gBACA;oBACCZ,MAAM;oBACNW,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCjB,MAAM;oBACNW,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;aACA;QACF;IACD;AACD,EAAE"}
1
+ {"version":3,"sources":["../../src/collections/Media.ts"],"sourcesContent":["import type { CollectionConfig, Field } from 'payload';\n// import type {\n// \tLexicalRichTextAdapterProvider,\n// \tLexicalEditorProps,\n// } from '@payloadcms/richtext-lexical';\n\n/**\n * Media Collection Configuration\n * Additional fields will be appended to the media collection.\n *\n * @constructor\n * @param editor\n * @param additionalFields\n */\nexport const Media = (\n\t//editor?: (props?: LexicalEditorProps) => LexicalRichTextAdapterProvider,\n\tadditionalFields?: Field[],\n): 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\t// editor: editor({\n\t\t\t\t// \t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t\t// \t// @ts-ignore\n\t\t\t\t// \tfeatures: ({ defaultFeatures }) => {\n\t\t\t\t// \t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t\t// \t\t// @ts-ignore\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\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: 400,\n\t\t\t\t\theight: 300,\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: 400,\n\t\t\t\t\theight: 300,\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: 400,\n\t\t\t\t\theight: 300,\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: 768,\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: 768,\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: 768,\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: 1024,\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: 1024,\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: 1024,\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":["Media","additionalFields","slug","access","read","fields","name","type","required","upload","staticDir","imageSizes","width","undefined","height","formatOptions","format","options","quality","position"],"mappings":"AACA,gBAAgB;AAChB,mCAAmC;AACnC,uBAAuB;AACvB,yCAAyC;AAEzC;;;;;;;CAOC,GACD,OAAO,MAAMA,QAAQ,CACpB,0EAA0E;AAC1EC;IAEA,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;YAYX;eACIP,mBAAmBA,mBAAmB,EAAE;SAC5C;QACDQ,QAAQ;YACPC,WAAW;YACXC,YAAY;gBACX,kCAAkC;gBAClC;oBACCL,MAAM;oBACNM,OAAOC;oBACPC,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCZ,MAAM;oBACNM,OAAOC;oBACPC,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA,kBAAkB;gBAClB;oBACCZ,MAAM;oBACNM,OAAO;oBACPE,QAAQ;oBACRK,UAAU;gBACX;gBACA;oBACCb,MAAM;oBACNM,OAAO;oBACPE,QAAQ;oBACRK,UAAU;oBACVJ,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCZ,MAAM;oBACNM,OAAO;oBACPE,QAAQ;oBACRK,UAAU;oBACVJ,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA,eAAe;gBACf;oBACCZ,MAAM;oBACNM,OAAO;oBACPE,QAAQD;gBACT;gBACA;oBACCP,MAAM;oBACNM,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCZ,MAAM;oBACNM,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA,eAAe;gBACf;oBACCZ,MAAM;oBACNM,OAAO;oBACPE,QAAQD;gBACT;gBACA;oBACCP,MAAM;oBACNM,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;gBACA;oBACCZ,MAAM;oBACNM,OAAO;oBACPE,QAAQD;oBACRE,eAAe;wBACdC,QAAQ;wBACRC,SAAS;4BACRC,SAAS;wBACV;oBACD;gBACD;aACA;QACF;IACD;AACD,EAAE"}
@@ -0,0 +1,10 @@
1
+ import type { CollectionConfig } from 'payload';
2
+ /**
3
+ * Redirects Collection Configuration
4
+ * In favour of the native plugin for more granular control.
5
+ *
6
+ * TODO: Potential to add regex redirects here, i.e product-category/(.*)$ => /category/$1
7
+ *
8
+ * @constructor
9
+ */
10
+ export declare const Redirects: (overrides?: Partial<CollectionConfig>) => CollectionConfig;
@@ -0,0 +1,6 @@
1
+ import { Field } from 'payload';
2
+ /**
3
+ * SEO Fields define the additional fields that appear
4
+ * within the Payload SEO plugin.
5
+ */
6
+ export declare const SEOFields: Field[];
@@ -0,0 +1,7 @@
1
+ import { PayloadHandler } from 'payload';
2
+ /**
3
+ * Find a document in the given collection by its slug.
4
+ *
5
+ * @param collection
6
+ */
7
+ export declare const findBySlug: (collection: string) => PayloadHandler;
@@ -0,0 +1,28 @@
1
+ import type { GlobalConfig, Tab, Field } from 'payload';
2
+ /**
3
+ * Navigation Configuration for the header and footer
4
+ * nav links.
5
+ */
6
+ interface NavigationConfig {
7
+ includeFooter?: boolean;
8
+ header?: NavigationMenuConfig;
9
+ footer?: NavigationMenuConfig;
10
+ additionalTabs?: Tab[];
11
+ }
12
+ /**
13
+ * Navigation Menu Configuration defines the config for an
14
+ * individual navigation menu, i.e Header or Footer.
15
+ */
16
+ interface NavigationMenuConfig {
17
+ maxDepth?: number;
18
+ additionalFields?: Field[];
19
+ }
20
+ /**
21
+ * Navigation Global Configuration
22
+ * Additional fields will be appended to each navigation item.
23
+ *
24
+ * @constructor
25
+ * @param config
26
+ */
27
+ export declare const Navigation: (config?: NavigationConfig) => GlobalConfig;
28
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { GlobalConfig, Tab } from 'payload';
2
+ /**
3
+ * Settings Global Configuration
4
+ * Additional tabs will be appended to the settings page.
5
+ * TODO, type error in here somewhere.
6
+ *
7
+ * @param additionalTabs
8
+ * @constructor
9
+ */
10
+ export declare const Settings: (additionalTabs: Tab[]) => GlobalConfig;
@@ -1,6 +1,6 @@
1
- import { validatePostcode, validateURL } from '../util/validation';
2
- import { languages } from './locales';
3
- import { countries } from './countries';
1
+ import { validatePostcode, validateURL } from '../util/validation.js';
2
+ import { languages } from './locales.js';
3
+ import { countries } from './countries.js';
4
4
  /**
5
5
  * Settings Global Configuration
6
6
  * Additional tabs will be appended to the settings page.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/globals/Settings.ts"],"sourcesContent":["import type { GlobalConfig, GroupField, Tab, UploadField } from 'payload';\nimport { validatePostcode, validateURL } from '../util/validation';\nimport { languages } from './locales';\nimport { countries } from './countries';\n\n/**\n * Settings Global Configuration\n * Additional tabs will be appended to the settings page.\n * TODO, type error in here somewhere.\n *\n * @param additionalTabs\n * @constructor\n */\nexport const Settings = (additionalTabs: Tab[]): GlobalConfig => {\n\treturn {\n\t\tslug: 'settings',\n\t\ttypescript: {\n\t\t\tinterface: 'Settings',\n\t\t},\n\t\tgraphQL: {\n\t\t\tname: 'Settings',\n\t\t},\n\t\taccess: {\n\t\t\tread: () => true,\n\t\t},\n\t\tfields: [\n\t\t\t{\n\t\t\t\ttype: 'tabs',\n\t\t\t\ttabs: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Global',\n\t\t\t\t\t\tdescription: 'Configure global settings for the website.',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'siteName',\n\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Site Name',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Add a site name for the website, this will be outputted in the Open Graph schema as well as a suffix for the meta title.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'locale',\n\t\t\t\t\t\t\t\t\t\ttype: 'select',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Locale',\n\t\t\t\t\t\t\t\t\t\tdefaultValue: 'en_GB',\n\t\t\t\t\t\t\t\t\t\toptions: languages.map((l) => {\n\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: l.name,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: l.code,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Add a locale for the website, this will be outputted in the Open Graph schema and the top level HTML tag. Defaults to en_GB.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ttypescriptSchema: [\n\t\t\t\t\t\t\t\t\t\t\t() => ({\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'tagLine',\n\t\t\t\t\t\t\t\ttype: 'textarea',\n\t\t\t\t\t\t\t\tlabel: 'Tag Line',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\tdescription: 'In a few words, explain what this site is about',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'logo',\n\t\t\t\t\t\t\t\ttype: 'upload',\n\t\t\t\t\t\t\t\trelationTo: 'media',\n\t\t\t\t\t\t\t\tfilterOptions: {\n\t\t\t\t\t\t\t\t\tmimeType: {\n\t\t\t\t\t\t\t\t\t\tcontains: 'image',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t'Add a logo for the website that will be displayed in the header & across the website.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} as UploadField,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'robots',\n\t\t\t\t\t\t\t\ttype: 'textarea',\n\t\t\t\t\t\t\t\tlabel: 'Robots.txt',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t'Robots.txt is a text file webmasters create to instruct web robots (typically search engine robots) how to crawl pages on their website.',\n\t\t\t\t\t\t\t\t},\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\t{\n\t\t\t\t\t\tlabel: 'Code Injection',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Code injection allows you to inject a small snippet of HTML into your site. It can be a css override, analytics of a block javascript.',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'codeInjection',\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'head',\n\t\t\t\t\t\t\t\t\t\ttype: 'code',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Head',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tlanguage: 'html',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Outputs code within the <head> of the website.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'footer',\n\t\t\t\t\t\t\t\t\t\ttype: 'code',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Footer',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tlanguage: 'html',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Outputs code in the footer of the website.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\t{\n\t\t\t\t\t\tlabel: 'Contact Details',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'contact',\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\thideGutter: true,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t'Add global contact details for the website that will be used in schema & contact pages.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'email',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'email',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Email',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'telephone',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Telephone',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} as GroupField,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tname: 'address',\n\t\t\t\t\t\t\t\tlabel: 'Address',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\thideGutter: true,\n\t\t\t\t\t\t\t\t\tdescription: 'Add an address for the website.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'line1',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Line 1',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'line2',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Line 2',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'city',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'City',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'county',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'County',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'postcode',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Postcode',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validatePostcode,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'country',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'select',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Country',\n\t\t\t\t\t\t\t\t\t\t\t\toptions: countries.map((c) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: c,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: c,\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} as GroupField,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tname: 'social',\n\t\t\t\t\t\t\t\tlabel: 'Social Links',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\thideGutter: true,\n\t\t\t\t\t\t\t\t\tdescription: 'Add social links for the website.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'linkedIn',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'LinkedIn',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'x',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'X',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'facebook',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Facebook',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'instagram',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Instagram',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'youtube',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Youtube',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'tiktok',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'TikTok',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} as GroupField,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Maintenance',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'maintenance',\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'enabled',\n\t\t\t\t\t\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Enable',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Enable maintenance mode for the site, this will use a maintenance page template and not include any of the sites functioanlity.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'title',\n\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Title',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tdescription: 'Add a title for the maintenance page.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'content',\n\t\t\t\t\t\t\t\t\t\ttype: 'textarea',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Content',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Add content for the maintenance page, it will appear beneath the title.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\t...(additionalTabs ? additionalTabs : []),\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n};\n"],"names":["validatePostcode","validateURL","languages","countries","Settings","additionalTabs","slug","typescript","interface","graphQL","name","access","read","fields","type","tabs","label","description","admin","width","defaultValue","options","map","l","value","code","typescriptSchema","relationTo","filterOptions","mimeType","contains","language","hideGutter","validate","c"],"mappings":"AACA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,qBAAqB;AACnE,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,SAAS,QAAQ,cAAc;AAExC;;;;;;;CAOC,GACD,OAAO,MAAMC,WAAW,CAACC;IACxB,OAAO;QACNC,MAAM;QACNC,YAAY;YACXC,WAAW;QACZ;QACAC,SAAS;YACRC,MAAM;QACP;QACAC,QAAQ;YACPC,MAAM,IAAM;QACb;QACAC,QAAQ;YACP;gBACCC,MAAM;gBACNC,MAAM;oBACL;wBACCC,OAAO;wBACPC,aAAa;wBACbJ,QAAQ;4BACP;gCACCC,MAAM;gCACND,QAAQ;oCACP;wCACCH,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACNC,OAAO;4CACPF,aACC;wCACF;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPI,cAAc;wCACdC,SAASnB,UAAUoB,GAAG,CAAC,CAACC;4CACvB,OAAO;gDACNP,OAAOO,EAAEb,IAAI;gDACbc,OAAOD,EAAEE,IAAI;4CACd;wCACD;wCACAP,OAAO;4CACNC,OAAO;4CACPF,aACC;wCACF;wCACAS,kBAAkB;4CACjB,IAAO,CAAA;oDACNZ,MAAM;gDACP,CAAA;yCACA;oCACF;iCACA;4BACF;4BACA;gCACCJ,MAAM;gCACNI,MAAM;gCACNE,OAAO;gCACPE,OAAO;oCACND,aAAa;gCACd;4BACD;4BACA;gCACCP,MAAM;gCACNI,MAAM;gCACNa,YAAY;gCACZC,eAAe;oCACdC,UAAU;wCACTC,UAAU;oCACX;gCACD;gCACAZ,OAAO;oCACND,aACC;gCACF;4BACD;4BACA;gCACCP,MAAM;gCACNI,MAAM;gCACNE,OAAO;gCACPE,OAAO;oCACND,aACC;gCACF;4BACD;yBACA;oBACF;oBACA;wBACCD,OAAO;wBACPC,aACC;wBACDJ,QAAQ;4BACP;gCACCH,MAAM;gCACNI,MAAM;gCACND,QAAQ;oCACP;wCACCH,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACNa,UAAU;4CACVd,aACC;wCACF;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACNa,UAAU;4CACVd,aACC;wCACF;oCACD;iCACA;4BACF;yBACA;oBACF;oBACA;wBACCD,OAAO;wBACPH,QAAQ;4BACP;gCACCH,MAAM;gCACNI,MAAM;gCACNI,OAAO;oCACNc,YAAY;oCACZf,aACC;gCACF;gCACAJ,QAAQ;oCACP;wCACCC,MAAM;wCACND,QAAQ;4CACP;gDACCH,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;yCACA;oCACF;iCACA;4BACF;4BACA;gCACCL,MAAM;gCACNJ,MAAM;gCACNM,OAAO;gCACPE,OAAO;oCACNc,YAAY;oCACZf,aAAa;gCACd;gCACAJ,QAAQ;oCACP;wCACCC,MAAM;wCACND,QAAQ;4CACP;gDACCH,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUjC;gDACVkB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPK,SAASlB,UAAUmB,GAAG,CAAC,CAACY;oDACvB,OAAO;wDACNlB,OAAOkB;wDACPV,OAAOU;oDACR;gDACD;gDACAhB,OAAO;oDACNC,OAAO;gDACR;4CACD;yCACA;oCACF;iCACA;4BACF;4BACA;gCACCL,MAAM;gCACNJ,MAAM;gCACNM,OAAO;gCACPE,OAAO;oCACNc,YAAY;oCACZf,aAAa;gCACd;gCACAJ,QAAQ;oCACP;wCACCC,MAAM;wCACND,QAAQ;4CACP;gDACCH,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;yCACA;oCACF;iCACA;4BACF;yBACA;oBACF;oBACA;wBACCH,OAAO;wBACPH,QAAQ;4BACP;gCACCH,MAAM;gCACNI,MAAM;gCACND,QAAQ;oCACP;wCACCH,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACND,aACC;wCACF;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACND,aAAa;wCACd;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACND,aACC;wCACF;oCACD;iCACA;4BACF;yBACA;oBACF;uBACIZ,iBAAiBA,iBAAiB,EAAE;iBACxC;YACF;SACA;IACF;AACD,EAAE"}
1
+ {"version":3,"sources":["../../src/globals/Settings.ts"],"sourcesContent":["import type { GlobalConfig, GroupField, Tab, UploadField } from 'payload';\nimport { validatePostcode, validateURL } from '../util/validation.js';\nimport { languages } from './locales.js';\nimport { countries } from './countries.js';\n\n/**\n * Settings Global Configuration\n * Additional tabs will be appended to the settings page.\n * TODO, type error in here somewhere.\n *\n * @param additionalTabs\n * @constructor\n */\nexport const Settings = (additionalTabs: Tab[]): GlobalConfig => {\n\treturn {\n\t\tslug: 'settings',\n\t\ttypescript: {\n\t\t\tinterface: 'Settings',\n\t\t},\n\t\tgraphQL: {\n\t\t\tname: 'Settings',\n\t\t},\n\t\taccess: {\n\t\t\tread: () => true,\n\t\t},\n\t\tfields: [\n\t\t\t{\n\t\t\t\ttype: 'tabs',\n\t\t\t\ttabs: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Global',\n\t\t\t\t\t\tdescription: 'Configure global settings for the website.',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'siteName',\n\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Site Name',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Add a site name for the website, this will be outputted in the Open Graph schema as well as a suffix for the meta title.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'locale',\n\t\t\t\t\t\t\t\t\t\ttype: 'select',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Locale',\n\t\t\t\t\t\t\t\t\t\tdefaultValue: 'en_GB',\n\t\t\t\t\t\t\t\t\t\toptions: languages.map((l) => {\n\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: l.name,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: l.code,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Add a locale for the website, this will be outputted in the Open Graph schema and the top level HTML tag. Defaults to en_GB.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\ttypescriptSchema: [\n\t\t\t\t\t\t\t\t\t\t\t() => ({\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'tagLine',\n\t\t\t\t\t\t\t\ttype: 'textarea',\n\t\t\t\t\t\t\t\tlabel: 'Tag Line',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\tdescription: 'In a few words, explain what this site is about',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'logo',\n\t\t\t\t\t\t\t\ttype: 'upload',\n\t\t\t\t\t\t\t\trelationTo: 'media',\n\t\t\t\t\t\t\t\tfilterOptions: {\n\t\t\t\t\t\t\t\t\tmimeType: {\n\t\t\t\t\t\t\t\t\t\tcontains: 'image',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t'Add a logo for the website that will be displayed in the header & across the website.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} as UploadField,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'robots',\n\t\t\t\t\t\t\t\ttype: 'textarea',\n\t\t\t\t\t\t\t\tlabel: 'Robots.txt',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t'Robots.txt is a text file webmasters create to instruct web robots (typically search engine robots) how to crawl pages on their website.',\n\t\t\t\t\t\t\t\t},\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\t{\n\t\t\t\t\t\tlabel: 'Code Injection',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Code injection allows you to inject a small snippet of HTML into your site. It can be a css override, analytics of a block javascript.',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'codeInjection',\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'head',\n\t\t\t\t\t\t\t\t\t\ttype: 'code',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Head',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tlanguage: 'html',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Outputs code within the <head> of the website.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'footer',\n\t\t\t\t\t\t\t\t\t\ttype: 'code',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Footer',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tlanguage: 'html',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Outputs code in the footer of the website.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\t{\n\t\t\t\t\t\tlabel: 'Contact Details',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'contact',\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\thideGutter: true,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t'Add global contact details for the website that will be used in schema & contact pages.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'email',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'email',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Email',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'telephone',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Telephone',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} as GroupField,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tname: 'address',\n\t\t\t\t\t\t\t\tlabel: 'Address',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\thideGutter: true,\n\t\t\t\t\t\t\t\t\tdescription: 'Add an address for the website.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'line1',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Line 1',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'line2',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Line 2',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'city',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'City',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'county',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'County',\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'postcode',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Postcode',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validatePostcode,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'country',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'select',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Country',\n\t\t\t\t\t\t\t\t\t\t\t\toptions: countries.map((c) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: c,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: c,\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} as GroupField,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tname: 'social',\n\t\t\t\t\t\t\t\tlabel: 'Social Links',\n\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\thideGutter: true,\n\t\t\t\t\t\t\t\t\tdescription: 'Add social links for the website.',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'row',\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'linkedIn',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'LinkedIn',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'x',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'X',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'facebook',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Facebook',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'instagram',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Instagram',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'youtube',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Youtube',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: 'tiktok',\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'TikTok',\n\t\t\t\t\t\t\t\t\t\t\t\tvalidate: validateURL,\n\t\t\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: '50%',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} as GroupField,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: 'Maintenance',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'maintenance',\n\t\t\t\t\t\t\t\ttype: 'group',\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'enabled',\n\t\t\t\t\t\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Enable',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Enable maintenance mode for the site, this will use a maintenance page template and not include any of the sites functioanlity.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'title',\n\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Title',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tdescription: 'Add a title for the maintenance page.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'content',\n\t\t\t\t\t\t\t\t\t\ttype: 'textarea',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Content',\n\t\t\t\t\t\t\t\t\t\tadmin: {\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'Add content for the maintenance page, it will appear beneath the title.',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\t...(additionalTabs ? additionalTabs : []),\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n};\n"],"names":["validatePostcode","validateURL","languages","countries","Settings","additionalTabs","slug","typescript","interface","graphQL","name","access","read","fields","type","tabs","label","description","admin","width","defaultValue","options","map","l","value","code","typescriptSchema","relationTo","filterOptions","mimeType","contains","language","hideGutter","validate","c"],"mappings":"AACA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,wBAAwB;AACtE,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,SAAS,QAAQ,iBAAiB;AAE3C;;;;;;;CAOC,GACD,OAAO,MAAMC,WAAW,CAACC;IACxB,OAAO;QACNC,MAAM;QACNC,YAAY;YACXC,WAAW;QACZ;QACAC,SAAS;YACRC,MAAM;QACP;QACAC,QAAQ;YACPC,MAAM,IAAM;QACb;QACAC,QAAQ;YACP;gBACCC,MAAM;gBACNC,MAAM;oBACL;wBACCC,OAAO;wBACPC,aAAa;wBACbJ,QAAQ;4BACP;gCACCC,MAAM;gCACND,QAAQ;oCACP;wCACCH,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACNC,OAAO;4CACPF,aACC;wCACF;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPI,cAAc;wCACdC,SAASnB,UAAUoB,GAAG,CAAC,CAACC;4CACvB,OAAO;gDACNP,OAAOO,EAAEb,IAAI;gDACbc,OAAOD,EAAEE,IAAI;4CACd;wCACD;wCACAP,OAAO;4CACNC,OAAO;4CACPF,aACC;wCACF;wCACAS,kBAAkB;4CACjB,IAAO,CAAA;oDACNZ,MAAM;gDACP,CAAA;yCACA;oCACF;iCACA;4BACF;4BACA;gCACCJ,MAAM;gCACNI,MAAM;gCACNE,OAAO;gCACPE,OAAO;oCACND,aAAa;gCACd;4BACD;4BACA;gCACCP,MAAM;gCACNI,MAAM;gCACNa,YAAY;gCACZC,eAAe;oCACdC,UAAU;wCACTC,UAAU;oCACX;gCACD;gCACAZ,OAAO;oCACND,aACC;gCACF;4BACD;4BACA;gCACCP,MAAM;gCACNI,MAAM;gCACNE,OAAO;gCACPE,OAAO;oCACND,aACC;gCACF;4BACD;yBACA;oBACF;oBACA;wBACCD,OAAO;wBACPC,aACC;wBACDJ,QAAQ;4BACP;gCACCH,MAAM;gCACNI,MAAM;gCACND,QAAQ;oCACP;wCACCH,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACNa,UAAU;4CACVd,aACC;wCACF;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACNa,UAAU;4CACVd,aACC;wCACF;oCACD;iCACA;4BACF;yBACA;oBACF;oBACA;wBACCD,OAAO;wBACPH,QAAQ;4BACP;gCACCH,MAAM;gCACNI,MAAM;gCACNI,OAAO;oCACNc,YAAY;oCACZf,aACC;gCACF;gCACAJ,QAAQ;oCACP;wCACCC,MAAM;wCACND,QAAQ;4CACP;gDACCH,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;yCACA;oCACF;iCACA;4BACF;4BACA;gCACCL,MAAM;gCACNJ,MAAM;gCACNM,OAAO;gCACPE,OAAO;oCACNc,YAAY;oCACZf,aAAa;gCACd;gCACAJ,QAAQ;oCACP;wCACCC,MAAM;wCACND,QAAQ;4CACP;gDACCH,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPE,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUjC;gDACVkB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPK,SAASlB,UAAUmB,GAAG,CAAC,CAACY;oDACvB,OAAO;wDACNlB,OAAOkB;wDACPV,OAAOU;oDACR;gDACD;gDACAhB,OAAO;oDACNC,OAAO;gDACR;4CACD;yCACA;oCACF;iCACA;4BACF;4BACA;gCACCL,MAAM;gCACNJ,MAAM;gCACNM,OAAO;gCACPE,OAAO;oCACNc,YAAY;oCACZf,aAAa;gCACd;gCACAJ,QAAQ;oCACP;wCACCC,MAAM;wCACND,QAAQ;4CACP;gDACCH,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;4CACA;gDACCT,MAAM;gDACNI,MAAM;gDACNE,OAAO;gDACPiB,UAAUhC;gDACViB,OAAO;oDACNC,OAAO;gDACR;4CACD;yCACA;oCACF;iCACA;4BACF;yBACA;oBACF;oBACA;wBACCH,OAAO;wBACPH,QAAQ;4BACP;gCACCH,MAAM;gCACNI,MAAM;gCACND,QAAQ;oCACP;wCACCH,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACND,aACC;wCACF;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACND,aAAa;wCACd;oCACD;oCACA;wCACCP,MAAM;wCACNI,MAAM;wCACNE,OAAO;wCACPE,OAAO;4CACND,aACC;wCACF;oCACD;iCACA;4BACF;yBACA;oBACF;uBACIZ,iBAAiBA,iBAAiB,EAAE;iBACxC;YACF;SACA;IACF;AACD,EAAE"}
@@ -0,0 +1 @@
1
+ export declare const countries: string[];
@@ -0,0 +1,7 @@
1
+ interface Language {
2
+ code: string;
3
+ name: string;
4
+ encoding: string;
5
+ }
6
+ export declare const languages: Language[];
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Config } from 'payload';
2
+ import type { PayloadHelperPluginConfig } from "./types.js";
3
+ /**
4
+ * Payload Helper Plugin for websites at ainsley.dev
5
+ *
6
+ * @constructor
7
+ * @param pluginOptions
8
+ */
9
+ export declare const payloadHelper: (pluginOptions: PayloadHelperPluginConfig) => (incomingConfig: Config) => Config;
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
1
- import { fieldMapper, schemas } from './plugin/schema';
2
- import env from './util/env';
1
+ import { fieldMapper, schemas } from './plugin/schema.js';
2
+ import env from './util/env.js';
3
3
  /**
4
4
  * Payload Helper Plugin for websites at ainsley.dev
5
5
  *
6
6
  * @constructor
7
7
  * @param pluginOptions
8
8
  */ export const payloadHelper = (pluginOptions)=>(incomingConfig)=>{
9
- console.log(pluginOptions);
10
9
  const genGoLang = env.bool('GEN_GOLANG', false);
11
10
  if (genGoLang) {
12
11
  incomingConfig.typescript = {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload';\nimport { fieldMapper, schemas } from './plugin/schema';\nimport env from './util/env';\n\n/**\n * Plugin Options\n */\nexport interface PluginOptions {\n\tSEOFields?: boolean;\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: {}) =>\n\t(incomingConfig: Config): Config => {\n\t\tconsole.log(pluginOptions);\n\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\tincomingConfig = fieldMapper(incomingConfig);\n\t\t}\n\n\t\tincomingConfig.typescript = incomingConfig.typescript || {};\n\t\tincomingConfig.typescript.outputFile = './src/types/payload.ts';\n\n\t\treturn incomingConfig;\n\t};\n"],"names":["fieldMapper","schemas","env","payloadHelper","pluginOptions","incomingConfig","console","log","genGoLang","bool","typescript","schema","outputFile"],"mappings":"AACA,SAASA,WAAW,EAAEC,OAAO,QAAQ,kBAAkB;AACvD,OAAOC,SAAS,aAAa;AAS7B;;;;;CAKC,GACD,OAAO,MAAMC,gBACZ,CAACC,gBACD,CAACC;QACAC,QAAQC,GAAG,CAACH;QAEZ,MAAMI,YAAYN,IAAIO,IAAI,CAAC,cAAc;QACzC,IAAID,WAAW;YACdH,eAAeK,UAAU,GAAG;gBAC3B,GAAGL,eAAeK,UAAU;gBAC5BC,QAAQV;YACT;YACAI,iBAAiBL,YAAYK;QAC9B;QAEAA,eAAeK,UAAU,GAAGL,eAAeK,UAAU,IAAI,CAAC;QAC1DL,eAAeK,UAAU,CAACE,UAAU,GAAG;QAEvC,OAAOP;IACR,EAAE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload';\nimport { fieldMapper, schemas } from './plugin/schema.js';\nimport env from './util/env.js';\nimport type {PayloadHelperPluginConfig} from \"./types.js\";\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\tincomingConfig = fieldMapper(incomingConfig);\n\t\t}\n\n\t\tincomingConfig.typescript = incomingConfig.typescript || {};\n\t\tincomingConfig.typescript.outputFile = './src/types/payload.ts';\n\n\t\treturn incomingConfig;\n\t};\n"],"names":["fieldMapper","schemas","env","payloadHelper","pluginOptions","incomingConfig","genGoLang","bool","typescript","schema","outputFile"],"mappings":"AACA,SAASA,WAAW,EAAEC,OAAO,QAAQ,qBAAqB;AAC1D,OAAOC,SAAS,gBAAgB;AAGhC;;;;;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;YACAI,iBAAiBL,YAAYK;QAC9B;QAEAA,eAAeG,UAAU,GAAGH,eAAeG,UAAU,IAAI,CAAC;QAC1DH,eAAeG,UAAU,CAACE,UAAU,GAAG;QAEvC,OAAOL;IACR,EAAE"}
@@ -0,0 +1,21 @@
1
+ import type { JSONSchema4 } from 'json-schema';
2
+ import type { Config } from 'payload';
3
+ /**
4
+ * Adds the necessary GoLang type conversions as a helper func.
5
+ */
6
+ export declare const addGoJSONSchema: (type: string, nillable: boolean) => Record<string, unknown>;
7
+ /**
8
+ * Iterates over all the fields within the config, for both collections
9
+ * and globals, and transforms the JSON schema
10
+ * to include the necessary GoLang schema.
11
+ *
12
+ * @param config
13
+ */
14
+ export declare const fieldMapper: (config: Config) => Config;
15
+ /**
16
+ * Adjusts the JSON schema to include the necessary GoLang schema
17
+ *
18
+ */
19
+ export declare const schemas: Array<(args: {
20
+ jsonSchema: JSONSchema4;
21
+ }) => JSONSchema4>;
@@ -0,0 +1,13 @@
1
+ import type { Payload, PayloadRequest } from 'payload';
2
+ import type { Seeder } from './seed.js';
3
+ /**
4
+ * Down script to remove all media and drop all tables.
5
+ *
6
+ * @param payload
7
+ * @param req
8
+ */
9
+ export declare const down: ({ payload, }: {
10
+ payload: Payload;
11
+ req: PayloadRequest;
12
+ seeder: Seeder;
13
+ }) => Promise<void>;
@@ -0,0 +1,35 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import env from '../util/env.js';
5
+ const filename = fileURLToPath(import.meta.url);
6
+ const dirname = path.dirname(filename);
7
+ const postgresDrop = async (payload)=>{
8
+ // @ts-expect-error
9
+ const db = payload.db.pool;
10
+ const client = await db.connect();
11
+ await client.query('drop schema public cascade; create schema public;');
12
+ };
13
+ const sqlDrop = async (payload)=>{};
14
+ /**
15
+ * Down script to remove all media and drop all tables.
16
+ *
17
+ * @param payload
18
+ * @param req
19
+ */ export const down = async ({ payload })=>{
20
+ payload.logger.info('Running down script');
21
+ // Clearing local media
22
+ if (!env.isProduction) {
23
+ payload.logger.info('Clearing media...');
24
+ const mediaDir = path.resolve(dirname, '../../media');
25
+ if (fs.existsSync(mediaDir)) {
26
+ fs.rmSync(mediaDir, {
27
+ recursive: true,
28
+ force: true
29
+ });
30
+ }
31
+ }
32
+ payload.logger.info('Dropping tables in database...');
33
+ };
34
+
35
+ //# sourceMappingURL=down.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/seed/down.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport env from '../util/env.js';\nimport type { Payload, PayloadRequest} from 'payload';\nimport type { Seeder } from './seed.js';\n\nconst filename = fileURLToPath(import.meta.url);\nconst dirname = path.dirname(filename);\n\nconst postgresDrop = async (payload: Payload): Promise<void> => {\n\t// @ts-expect-error\n\tconst db = payload.db.pool;\n\tconst client = await db.connect();\n\tawait client.query('drop schema public cascade; create schema public;');\n};\n\nconst sqlDrop = async (payload: Payload): Promise<void> => {}\n\n/**\n * Down script to remove all media and drop all tables.\n *\n * @param payload\n * @param req\n */\nexport const down = async ({\n\tpayload,\n}: {\n\tpayload: Payload;\n\treq: PayloadRequest;\n\tseeder: Seeder;\n}): Promise<void> => {\n\tpayload.logger.info('Running down script');\n\n\t// Clearing local media\n\tif (!env.isProduction) {\n\t\tpayload.logger.info('Clearing media...');\n\t\tconst mediaDir = path.resolve(dirname, '../../media');\n\t\tif (fs.existsSync(mediaDir)) {\n\t\t\tfs.rmSync(mediaDir, { recursive: true, force: true });\n\t\t}\n\t}\n\n\tpayload.logger.info('Dropping tables in database...');\n};\n"],"names":["fs","path","fileURLToPath","env","filename","url","dirname","postgresDrop","payload","db","pool","client","connect","query","sqlDrop","down","logger","info","isProduction","mediaDir","resolve","existsSync","rmSync","recursive","force"],"mappings":"AAAA,OAAOA,QAAQ,UAAU;AACzB,OAAOC,UAAU,YAAY;AAC7B,SAASC,aAAa,QAAQ,WAAW;AACzC,OAAOC,SAAS,iBAAiB;AAIjC,MAAMC,WAAWF,cAAc,YAAYG,GAAG;AAC9C,MAAMC,UAAUL,KAAKK,OAAO,CAACF;AAE7B,MAAMG,eAAe,OAAOC;IAC3B,mBAAmB;IACnB,MAAMC,KAAKD,QAAQC,EAAE,CAACC,IAAI;IAC1B,MAAMC,SAAS,MAAMF,GAAGG,OAAO;IAC/B,MAAMD,OAAOE,KAAK,CAAC;AACpB;AAEA,MAAMC,UAAU,OAAON,WAAqC;AAE5D;;;;;CAKC,GACD,OAAO,MAAMO,OAAO,OAAO,EAC1BP,OAAO,EAKP;IACAA,QAAQQ,MAAM,CAACC,IAAI,CAAC;IAEpB,uBAAuB;IACvB,IAAI,CAACd,IAAIe,YAAY,EAAE;QACtBV,QAAQQ,MAAM,CAACC,IAAI,CAAC;QACpB,MAAME,WAAWlB,KAAKmB,OAAO,CAACd,SAAS;QACvC,IAAIN,GAAGqB,UAAU,CAACF,WAAW;YAC5BnB,GAAGsB,MAAM,CAACH,UAAU;gBAAEI,WAAW;gBAAMC,OAAO;YAAK;QACpD;IACD;IAEAhB,QAAQQ,MAAM,CAACC,IAAI,CAAC;AACrB,EAAE"}
@@ -0,0 +1,31 @@
1
+ import { type PayloadRequest, type Payload } from 'payload';
2
+ /**
3
+ * A function that seeds the database with initial data.
4
+ */
5
+ export type Seeder = (args: {
6
+ payload: Payload;
7
+ req: PayloadRequest;
8
+ }) => Promise<void>;
9
+ /**
10
+ * Options for the seed function.
11
+ * Note: You must use path.resolve for the paths, i.e. path.resolve(__dirname, 'path/to/file')
12
+ */
13
+ export type SeedOptions = {
14
+ envPath: string;
15
+ configPath: string;
16
+ dbAdapter: DBAdapter;
17
+ seeder: Seeder;
18
+ };
19
+ /**
20
+ * The database adapter to use, which will remove and recreate the database.
21
+ */
22
+ export declare enum DBAdapter {
23
+ Postgres = "postgres"
24
+ }
25
+ /**
26
+ * Seeds the database with initial data.
27
+ *
28
+ * @param opts - The options for seeding.
29
+ * @returns A promise that resolves when the seeding is complete.
30
+ */
31
+ export declare const seed: (opts: SeedOptions) => void;
@@ -0,0 +1,58 @@
1
+ import dotenv from 'dotenv';
2
+ import { commitTransaction, getPayload, initTransaction, killTransaction } from 'payload';
3
+ import { importConfig } from 'payload/node';
4
+ import { down } from './down.js';
5
+ import { up } from './up.js';
6
+ export var DBAdapter;
7
+ (function(DBAdapter) {
8
+ DBAdapter["Postgres"] = "postgres";
9
+ })(DBAdapter || (DBAdapter = {}));
10
+ /**
11
+ * Seeds the database with initial data.
12
+ *
13
+ * @param opts - The options for seeding.
14
+ * @returns A promise that resolves when the seeding is complete.
15
+ */ export const seed = (opts)=>{
16
+ const fn = async ()=>{
17
+ dotenv.config({
18
+ path: opts.envPath
19
+ });
20
+ for (const fn of [
21
+ down,
22
+ up
23
+ ]){
24
+ if (fn === down) {
25
+ process.env.PAYLOAD_DROP_DATABASE = 'true';
26
+ } else {
27
+ delete process.env.PAYLOAD_DROP_DATABASE; // Ensure it is not set for other functions
28
+ }
29
+ const config = await importConfig(opts.configPath);
30
+ const payload = await getPayload({
31
+ config
32
+ });
33
+ const req = {
34
+ payload
35
+ };
36
+ await initTransaction(req);
37
+ try {
38
+ await fn({
39
+ payload,
40
+ req,
41
+ seeder: opts.seeder
42
+ });
43
+ payload.logger.info('Seed complete');
44
+ await commitTransaction(req);
45
+ } catch (err) {
46
+ const message = err instanceof Error ? err.message : 'Unknown error';
47
+ payload.logger.error(`Seed failed: ${message}`);
48
+ await killTransaction(req);
49
+ }
50
+ }
51
+ };
52
+ fn().then(()=>process.exit(0)).catch((e)=>{
53
+ console.error(e);
54
+ process.exit(1);
55
+ });
56
+ };
57
+
58
+ //# sourceMappingURL=seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/seed/seed.ts"],"sourcesContent":["import dotenv from 'dotenv';\nimport {\n\ttype PayloadRequest,\n\tcommitTransaction,\n\tgetPayload,\n\tinitTransaction,\n\tkillTransaction,\n\ttype Payload,\n} from 'payload';\nimport { importConfig } from 'payload/node';\nimport { down } from './down.js';\nimport { up } from './up.js';\n\n/**\n * A function that seeds the database with initial data.\n */\nexport type Seeder = (args: { payload: Payload; req: PayloadRequest }) => Promise<void>;\n\n/**\n * Options for the seed function.\n * Note: You must use path.resolve for the paths, i.e. path.resolve(__dirname, 'path/to/file')\n */\nexport type SeedOptions = {\n\tenvPath: string;\n\tconfigPath: string;\n\tdbAdapter: DBAdapter;\n\tseeder: Seeder;\n};\n\n/**\n * The database adapter to use, which will remove and recreate the database.\n */\nexport enum DBAdapter {\n\tPostgres = 'postgres',\n}\n\n/**\n * Seeds the database with initial data.\n *\n * @param opts - The options for seeding.\n * @returns A promise that resolves when the seeding is complete.\n */\nexport const seed = (opts: SeedOptions) => {\n\tconst fn = async () => {\n\t\tdotenv.config({\n\t\t\tpath: opts.envPath,\n\t\t});\n\n\t\tfor (const fn of [down, up]) {\n\t\t\tif (fn === down) {\n\t\t\t\tprocess.env.PAYLOAD_DROP_DATABASE = 'true';\n\t\t\t} else {\n\t\t\t\tdelete process.env.PAYLOAD_DROP_DATABASE; // Ensure it is not set for other functions\n\t\t\t}\n\n\t\t\tconst config = await importConfig(opts.configPath);\n\t\t\tconst payload = await getPayload({ config });\n\t\t\tconst req = { payload } as PayloadRequest;\n\n\t\t\tawait initTransaction(req);\n\n\t\t\ttry {\n\t\t\t\tawait fn({ payload, req, seeder: opts.seeder });\n\t\t\t\tpayload.logger.info('Seed complete');\n\t\t\t\tawait commitTransaction(req);\n\t\t\t} catch (err) {\n\t\t\t\tconst message = err instanceof Error ? err.message : 'Unknown error';\n\t\t\t\tpayload.logger.error(`Seed failed: ${message}`);\n\t\t\t\tawait killTransaction(req);\n\t\t\t}\n\t\t}\n\t};\n\n\tfn().then(() => process.exit(0)).catch((e) => {\n\t\tconsole.error(e);\n\t\tprocess.exit(1);\n\t});\n};\n"],"names":["dotenv","commitTransaction","getPayload","initTransaction","killTransaction","importConfig","down","up","DBAdapter","seed","opts","fn","config","path","envPath","process","env","PAYLOAD_DROP_DATABASE","configPath","payload","req","seeder","logger","info","err","message","Error","error","then","exit","catch","e","console"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,SAECC,iBAAiB,EACjBC,UAAU,EACVC,eAAe,EACfC,eAAe,QAET,UAAU;AACjB,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,EAAE,QAAQ,UAAU;;UAqBjBC;;GAAAA,cAAAA;AAIZ;;;;;CAKC,GACD,OAAO,MAAMC,OAAO,CAACC;IACpB,MAAMC,KAAK;QACVX,OAAOY,MAAM,CAAC;YACbC,MAAMH,KAAKI,OAAO;QACnB;QAEA,KAAK,MAAMH,MAAM;YAACL;YAAMC;SAAG,CAAE;YAC5B,IAAII,OAAOL,MAAM;gBAChBS,QAAQC,GAAG,CAACC,qBAAqB,GAAG;YACrC,OAAO;gBACN,OAAOF,QAAQC,GAAG,CAACC,qBAAqB,EAAE,2CAA2C;YACtF;YAEA,MAAML,SAAS,MAAMP,aAAaK,KAAKQ,UAAU;YACjD,MAAMC,UAAU,MAAMjB,WAAW;gBAAEU;YAAO;YAC1C,MAAMQ,MAAM;gBAAED;YAAQ;YAEtB,MAAMhB,gBAAgBiB;YAEtB,IAAI;gBACH,MAAMT,GAAG;oBAAEQ;oBAASC;oBAAKC,QAAQX,KAAKW,MAAM;gBAAC;gBAC7CF,QAAQG,MAAM,CAACC,IAAI,CAAC;gBACpB,MAAMtB,kBAAkBmB;YACzB,EAAE,OAAOI,KAAK;gBACb,MAAMC,UAAUD,eAAeE,QAAQF,IAAIC,OAAO,GAAG;gBACrDN,QAAQG,MAAM,CAACK,KAAK,CAAC,CAAC,aAAa,EAAEF,QAAQ,CAAC;gBAC9C,MAAMrB,gBAAgBgB;YACvB;QACD;IACD;IAEAT,KAAKiB,IAAI,CAAC,IAAMb,QAAQc,IAAI,CAAC,IAAIC,KAAK,CAAC,CAACC;QACvCC,QAAQL,KAAK,CAACI;QACdhB,QAAQc,IAAI,CAAC;IACd;AACD,EAAE"}
@@ -0,0 +1,125 @@
1
+ export interface MediaSeed {
2
+ path: string;
3
+ alt: string;
4
+ caption?: string;
5
+ }
6
+ export interface Media {
7
+ id: number;
8
+ alt: string;
9
+ caption?: {
10
+ root: {
11
+ type: string;
12
+ children: {
13
+ type: string;
14
+ version: number;
15
+ [k: string]: unknown;
16
+ }[];
17
+ direction: ('ltr' | 'rtl') | null;
18
+ format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
19
+ indent: number;
20
+ version: number;
21
+ };
22
+ [k: string]: unknown;
23
+ } | null;
24
+ updatedAt: string;
25
+ createdAt: string;
26
+ url?: string | null;
27
+ thumbnailURL?: string | null;
28
+ filename?: string | null;
29
+ mimeType?: string | null;
30
+ filesize?: number | null;
31
+ width?: number | null;
32
+ height?: number | null;
33
+ focalX?: number | null;
34
+ focalY?: number | null;
35
+ sizes?: {
36
+ webp?: {
37
+ url?: string | null;
38
+ width?: number | null;
39
+ height?: number | null;
40
+ mimeType?: string | null;
41
+ filesize?: number | null;
42
+ filename?: string | null;
43
+ };
44
+ avif?: {
45
+ url?: string | null;
46
+ width?: number | null;
47
+ height?: number | null;
48
+ mimeType?: string | null;
49
+ filesize?: number | null;
50
+ filename?: string | null;
51
+ };
52
+ thumbnail?: {
53
+ url?: string | null;
54
+ width?: number | null;
55
+ height?: number | null;
56
+ mimeType?: string | null;
57
+ filesize?: number | null;
58
+ filename?: string | null;
59
+ };
60
+ thumbnail_webp?: {
61
+ url?: string | null;
62
+ width?: number | null;
63
+ height?: number | null;
64
+ mimeType?: string | null;
65
+ filesize?: number | null;
66
+ filename?: string | null;
67
+ };
68
+ thumbnail_avif?: {
69
+ url?: string | null;
70
+ width?: number | null;
71
+ height?: number | null;
72
+ mimeType?: string | null;
73
+ filesize?: number | null;
74
+ filename?: string | null;
75
+ };
76
+ mobile?: {
77
+ url?: string | null;
78
+ width?: number | null;
79
+ height?: number | null;
80
+ mimeType?: string | null;
81
+ filesize?: number | null;
82
+ filename?: string | null;
83
+ };
84
+ mobile_webp?: {
85
+ url?: string | null;
86
+ width?: number | null;
87
+ height?: number | null;
88
+ mimeType?: string | null;
89
+ filesize?: number | null;
90
+ filename?: string | null;
91
+ };
92
+ mobile_avif?: {
93
+ url?: string | null;
94
+ width?: number | null;
95
+ height?: number | null;
96
+ mimeType?: string | null;
97
+ filesize?: number | null;
98
+ filename?: string | null;
99
+ };
100
+ tablet?: {
101
+ url?: string | null;
102
+ width?: number | null;
103
+ height?: number | null;
104
+ mimeType?: string | null;
105
+ filesize?: number | null;
106
+ filename?: string | null;
107
+ };
108
+ tablet_webp?: {
109
+ url?: string | null;
110
+ width?: number | null;
111
+ height?: number | null;
112
+ mimeType?: string | null;
113
+ filesize?: number | null;
114
+ filename?: string | null;
115
+ };
116
+ tablet_avif?: {
117
+ url?: string | null;
118
+ width?: number | null;
119
+ height?: number | null;
120
+ mimeType?: string | null;
121
+ filesize?: number | null;
122
+ filename?: string | null;
123
+ };
124
+ };
125
+ }
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/seed/types.ts"],"sourcesContent":["export interface MediaSeed {\n\tpath: string;\n\talt: string;\n\tcaption?: string;\n}\n\nexport interface Media {\n\tid: number;\n\talt: string;\n\tcaption?: {\n\t\troot: {\n\t\t\ttype: string;\n\t\t\tchildren: {\n\t\t\t\ttype: string;\n\t\t\t\tversion: number;\n\t\t\t\t[k: string]: unknown;\n\t\t\t}[];\n\t\t\tdirection: ('ltr' | 'rtl') | null;\n\t\t\tformat: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';\n\t\t\tindent: number;\n\t\t\tversion: number;\n\t\t};\n\t\t[k: string]: unknown;\n\t} | null;\n\tupdatedAt: string;\n\tcreatedAt: string;\n\turl?: string | null;\n\tthumbnailURL?: string | null;\n\tfilename?: string | null;\n\tmimeType?: string | null;\n\tfilesize?: number | null;\n\twidth?: number | null;\n\theight?: number | null;\n\tfocalX?: number | null;\n\tfocalY?: number | null;\n\tsizes?: {\n\t\twebp?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\tavif?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\tthumbnail?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\tthumbnail_webp?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\tthumbnail_avif?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\tmobile?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\tmobile_webp?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\tmobile_avif?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\ttablet?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\ttablet_webp?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t\ttablet_avif?: {\n\t\t\turl?: string | null;\n\t\t\twidth?: number | null;\n\t\t\theight?: number | null;\n\t\t\tmimeType?: string | null;\n\t\t\tfilesize?: number | null;\n\t\t\tfilename?: string | null;\n\t\t};\n\t};\n}\n"],"names":[],"mappings":"AAMA,WAuHC"}
@@ -0,0 +1,23 @@
1
+ import type { Payload, PayloadRequest } from 'payload';
2
+ import type { Media, MediaSeed } from './types.js';
3
+ import type { Seeder } from "./seed.js";
4
+ /**
5
+ *
6
+ * @param req
7
+ * @param payload
8
+ * @param dirname
9
+ * @param media
10
+ */
11
+ export declare const uploadMedia: (req: PayloadRequest, payload: Payload, dirname: string, media: MediaSeed) => Promise<Media>;
12
+ /**
13
+ * Up script to create tables and seed data.
14
+ *
15
+ * @param payload
16
+ * @param req
17
+ * @param seeder
18
+ */
19
+ export declare const up: ({ payload, req, seeder, }: {
20
+ payload: Payload;
21
+ req: PayloadRequest;
22
+ seeder: Seeder;
23
+ }) => Promise<void>;
@@ -0,0 +1,55 @@
1
+ import path from 'node:path';
2
+ import { getFileByPath } from 'payload';
3
+ import { htmlToLexical } from '../util/lexical.js';
4
+ /**
5
+ *
6
+ * @param req
7
+ * @param payload
8
+ * @param dirname
9
+ * @param media
10
+ */ export const uploadMedia = async (req, payload, dirname, media)=>{
11
+ try {
12
+ const image = await getFileByPath(path.resolve(dirname, media.path));
13
+ const caption = media.caption ? await htmlToLexical(media.caption) : null;
14
+ return await payload.create({
15
+ collection: 'media',
16
+ file: image,
17
+ data: {
18
+ alt: media.alt,
19
+ caption: caption
20
+ },
21
+ req
22
+ });
23
+ } catch (error) {
24
+ payload.logger.error(`Uploading media: ${error}`);
25
+ throw error;
26
+ }
27
+ };
28
+ /**
29
+ * Up script to create tables and seed data.
30
+ *
31
+ * @param payload
32
+ * @param req
33
+ * @param seeder
34
+ */ export const up = async ({ payload, req, seeder })=>{
35
+ payload.logger.info('Running up script');
36
+ await payload.init({
37
+ config: payload.config
38
+ });
39
+ // Creating new tables
40
+ payload.logger.info('Creating indexes...');
41
+ try {
42
+ if (payload.db.init) {
43
+ await payload.db.init();
44
+ }
45
+ } catch (error) {
46
+ payload.logger.error(`Creating database: ${error}`);
47
+ return;
48
+ }
49
+ await seeder({
50
+ payload,
51
+ req
52
+ });
53
+ };
54
+
55
+ //# sourceMappingURL=up.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/seed/up.ts"],"sourcesContent":["import path from 'node:path';\nimport type { Payload, PayloadRequest } from 'payload';\nimport { getFileByPath } from 'payload';\nimport type { Media, MediaSeed } from './types.js';\nimport { htmlToLexical } from '../util/lexical.js';\nimport type {Seeder} from \"./seed.js\";\n\n\n/**\n *\n * @param req\n * @param payload\n * @param dirname\n * @param media\n */\nexport const uploadMedia = async (\n\treq: PayloadRequest,\n\tpayload: Payload,\n\tdirname: string,\n\tmedia: MediaSeed,\n): Promise<Media> => {\n\ttry {\n\t\tconst image = await getFileByPath(path.resolve(dirname, media.path));\n\t\tconst caption = media.caption ? await htmlToLexical(media.caption) : null;\n\n\t\treturn (await payload.create({\n\t\t\tcollection: 'media',\n\t\t\tfile: image,\n\t\t\tdata: {\n\t\t\t\talt: media.alt,\n\t\t\t\tcaption: caption,\n\t\t\t},\n\t\t\treq,\n\t\t})) as unknown as Media;\n\t} catch (error) {\n\t\tpayload.logger.error(`Uploading media: ${error}`);\n\t\tthrow error;\n\t}\n};\n\n/**\n * Up script to create tables and seed data.\n *\n * @param payload\n * @param req\n * @param seeder\n */\nexport const up = async ({\n\tpayload,\n\treq,\n\tseeder,\n}: {\n\tpayload: Payload;\n\treq: PayloadRequest;\n\tseeder: Seeder;\n}): Promise<void> => {\n\tpayload.logger.info('Running up script');\n\n\tawait payload.init({\n\t\tconfig: payload.config,\n\t});\n\n\t// Creating new tables\n\tpayload.logger.info('Creating indexes...');\n\ttry {\n\t\tif (payload.db.init) {\n\t\t\tawait payload.db.init();\n\t\t}\n\t} catch (error) {\n\t\tpayload.logger.error(`Creating database: ${error}`);\n\t\treturn;\n\t}\n\n\tawait seeder({ payload, req });\n};\n"],"names":["path","getFileByPath","htmlToLexical","uploadMedia","req","payload","dirname","media","image","resolve","caption","create","collection","file","data","alt","error","logger","up","seeder","info","init","config","db"],"mappings":"AAAA,OAAOA,UAAU,YAAY;AAE7B,SAASC,aAAa,QAAQ,UAAU;AAExC,SAASC,aAAa,QAAQ,qBAAqB;AAInD;;;;;;CAMC,GACD,OAAO,MAAMC,cAAc,OAC1BC,KACAC,SACAC,SACAC;IAEA,IAAI;QACH,MAAMC,QAAQ,MAAMP,cAAcD,KAAKS,OAAO,CAACH,SAASC,MAAMP,IAAI;QAClE,MAAMU,UAAUH,MAAMG,OAAO,GAAG,MAAMR,cAAcK,MAAMG,OAAO,IAAI;QAErE,OAAQ,MAAML,QAAQM,MAAM,CAAC;YAC5BC,YAAY;YACZC,MAAML;YACNM,MAAM;gBACLC,KAAKR,MAAMQ,GAAG;gBACdL,SAASA;YACV;YACAN;QACD;IACD,EAAE,OAAOY,OAAO;QACfX,QAAQY,MAAM,CAACD,KAAK,CAAC,CAAC,iBAAiB,EAAEA,MAAM,CAAC;QAChD,MAAMA;IACP;AACD,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAME,KAAK,OAAO,EACxBb,OAAO,EACPD,GAAG,EACHe,MAAM,EAKN;IACAd,QAAQY,MAAM,CAACG,IAAI,CAAC;IAEpB,MAAMf,QAAQgB,IAAI,CAAC;QAClBC,QAAQjB,QAAQiB,MAAM;IACvB;IAEA,sBAAsB;IACtBjB,QAAQY,MAAM,CAACG,IAAI,CAAC;IACpB,IAAI;QACH,IAAIf,QAAQkB,EAAE,CAACF,IAAI,EAAE;YACpB,MAAMhB,QAAQkB,EAAE,CAACF,IAAI;QACtB;IACD,EAAE,OAAOL,OAAO;QACfX,QAAQY,MAAM,CAACD,KAAK,CAAC,CAAC,mBAAmB,EAAEA,MAAM,CAAC;QAClD;IACD;IAEA,MAAMG,OAAO;QAAEd;QAASD;IAAI;AAC7B,EAAE"}
@@ -0,0 +1,10 @@
1
+ import type { GlobalConfig, Tab } from 'payload';
2
+ export type SettingsConfig = {
3
+ additionalTabs?: Tab[];
4
+ override: (args: {
5
+ config: GlobalConfig;
6
+ }) => GlobalConfig;
7
+ };
8
+ export type PayloadHelperPluginConfig = {
9
+ settings?: SettingsConfig;
10
+ };
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ // import type { SEOPluginConfig } from "@payloadcms/plugin-seo/types";
2
+ export { };
3
+
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["// import type { SEOPluginConfig } from \"@payloadcms/plugin-seo/types\";\nimport type { GlobalConfig, Tab } from 'payload';\n\nexport type SettingsConfig = {\n\tadditionalTabs?: Tab[];\n\toverride: (args: {\n\t\tconfig: GlobalConfig;\n\t}) => GlobalConfig;\n};\nexport type PayloadHelperPluginConfig = {\n\tsettings?: SettingsConfig;\n\t// seo?: (args: {\n\t// \tconfig: SEOPluginConfig;\n\t// }) => SEOPluginConfig;\n};\n"],"names":[],"mappings":"AAAA,uEAAuE;AASvE,WAKE"}
@@ -0,0 +1,12 @@
1
+ declare function envFn<T>(key: string, defaultValue: T): string | T;
2
+ declare const env: typeof envFn & {
3
+ isProduction: boolean;
4
+ int(key: string, defaultValue?: number): number | undefined;
5
+ float(key: string, defaultValue?: number): number | undefined;
6
+ bool(key: string, defaultValue?: boolean): boolean | undefined;
7
+ json(key: string, defaultValue?: object): any;
8
+ array(key: string, defaultValue?: string[]): string[] | undefined;
9
+ date(key: string, defaultValue?: Date): Date | undefined;
10
+ oneOf(key: string, expectedValues?: unknown[], defaultValue?: unknown): unknown;
11
+ };
12
+ export default env;
@@ -0,0 +1,7 @@
1
+ import { Field } from 'payload';
2
+ /**
3
+ * Determines if a Payload field has a name property.
4
+ *
5
+ * @param field
6
+ */
7
+ export declare const fieldHasName: (field: Field) => boolean;
@@ -0,0 +1,15 @@
1
+ import type { SerializedEditorState } from 'lexical';
2
+ /**
3
+ * Converts an HTML string to a Lexical editor state.
4
+ *
5
+ * @param {string} html - The HTML string to convert.
6
+ * @returns {SerializedEditorState} The serialized editor state.
7
+ */
8
+ export declare const htmlToLexical: (html: string) => SerializedEditorState;
9
+ /**
10
+ * Converts a Lexical editor state to an HTML string.
11
+ *
12
+ * @param {SerializedEditorState} json - The serialized editor state to convert.
13
+ * @returns {string} The HTML string.
14
+ */
15
+ export declare const lexicalToHtml: (json: SerializedEditorState) => string;
@@ -0,0 +1,87 @@
1
+ import { createHeadlessEditor } from '@lexical/headless';
2
+ import { $generateNodesFromDOM, $generateHtmlFromNodes } from '@lexical/html';
3
+ import { $getRoot, $getSelection } from 'lexical';
4
+ import { JSDOM } from 'jsdom';
5
+ import { getPayload } from "payload";
6
+ import { buildConfig } from 'payload';
7
+ import { sqliteAdapter } from '@payloadcms/db-sqlite';
8
+ import { defaultEditorConfig, getEnabledNodes, lexicalEditor, sanitizeServerEditorConfig } from '@payloadcms/richtext-lexical';
9
+ const loadEditor = async ()=>{
10
+ const config = {
11
+ secret: "testing",
12
+ editor: lexicalEditor({
13
+ admin: {
14
+ hideGutter: false
15
+ }
16
+ }),
17
+ db: sqliteAdapter({
18
+ client: {
19
+ url: 'file:./local.db'
20
+ }
21
+ })
22
+ };
23
+ const instance = await getPayload({
24
+ config: buildConfig(config)
25
+ });
26
+ const editorConfig = await sanitizeServerEditorConfig(defaultEditorConfig, instance.config);
27
+ return createHeadlessEditor({
28
+ nodes: getEnabledNodes({
29
+ editorConfig
30
+ })
31
+ });
32
+ };
33
+ /**
34
+ * Converts an HTML string to a Lexical editor state.
35
+ *
36
+ * @param {string} html - The HTML string to convert.
37
+ * @returns {SerializedEditorState} The serialized editor state.
38
+ */ export const htmlToLexical = (html)=>{
39
+ let state = {};
40
+ loadEditor().then((editor)=>{
41
+ editor.update(()=>{
42
+ // In a headless environment you can use a package such as JSDom to parse the HTML string.
43
+ const dom = new JSDOM(`<!DOCTYPE html><body>${html}</body>`);
44
+ // Once you have the DOM instance it's easy to generate LexicalNodes.
45
+ const nodes = $generateNodesFromDOM(editor, dom.window.document);
46
+ // Select the root
47
+ $getRoot().select();
48
+ // Insert them at a selection.
49
+ const selection = $getSelection();
50
+ if (selection) selection.insertNodes(nodes);
51
+ }, {
52
+ discrete: true
53
+ });
54
+ state = editor.getEditorState().toJSON();
55
+ });
56
+ return state;
57
+ };
58
+ /**
59
+ * Converts a Lexical editor state to an HTML string.
60
+ *
61
+ * @param {SerializedEditorState} json - The serialized editor state to convert.
62
+ * @returns {string} The HTML string.
63
+ */ export const lexicalToHtml = (json)=>{
64
+ const editor = createHeadlessEditor({
65
+ nodes: [],
66
+ onError: (error)=>{
67
+ console.error(error);
68
+ }
69
+ });
70
+ // Initialize a JSDOM instance
71
+ const dom = new JSDOM('');
72
+ // @ts-ignore
73
+ globalThis.window = dom.window;
74
+ globalThis.document = dom.window.document;
75
+ editor.update(()=>{
76
+ const editorState = editor.parseEditorState(json);
77
+ editor.setEditorState(editorState);
78
+ });
79
+ // Convert the editor state to HTML
80
+ let html = '';
81
+ editor.getEditorState().read(()=>{
82
+ html = $generateHtmlFromNodes(editor);
83
+ });
84
+ return html;
85
+ };
86
+
87
+ //# sourceMappingURL=lexical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/lexical.ts"],"sourcesContent":["import { createHeadlessEditor } from '@lexical/headless';\nimport { $generateNodesFromDOM, $generateHtmlFromNodes } from '@lexical/html';\nimport {$getRoot, $getSelection, LexicalEditor} from 'lexical';\nimport { JSDOM } from 'jsdom';\nimport type { SerializedEditorState } from 'lexical';\nimport {getPayload, SanitizedConfig} from \"payload\";\nimport { Payload, buildConfig } from 'payload';\nimport { sqliteAdapter } from '@payloadcms/db-sqlite';\nimport {\n\tdefaultEditorConfig,\n\tgetEnabledNodes, lexicalEditor,\n\tsanitizeServerEditorConfig,\n} from '@payloadcms/richtext-lexical';\n\nconst loadEditor = async (): Promise<LexicalEditor> => {\n\tconst config = {\n\t\tsecret: \"testing\",\n\t\teditor: lexicalEditor({\n\t\t\tadmin: {\n\t\t\t\thideGutter: false,\n\t\t\t},\n\t\t}),\n\t\tdb: sqliteAdapter({\n\t\t\tclient: {\n\t\t\t\turl: 'file:./local.db'\n\t\t\t},\n\t\t}),\n\t};\n\n\tconst instance = await getPayload({\n\t\tconfig: buildConfig(config),\n\t});\n\n\tconst editorConfig = await sanitizeServerEditorConfig(\n\t\tdefaultEditorConfig,\n\t\tinstance.config,\n\t);\n\n\treturn createHeadlessEditor({\n\t\tnodes: getEnabledNodes({\n\t\t\teditorConfig,\n\t\t}),\n\t});\n}\n\n/**\n * Converts an HTML string to a Lexical editor state.\n *\n * @param {string} html - The HTML string to convert.\n * @returns {SerializedEditorState} The serialized editor state.\n */\nexport const htmlToLexical = (html: string): SerializedEditorState => {\n\tlet state = {};\n\n\tloadEditor().then(editor => {\n\t\teditor.update(\n\t\t\t() => {\n\t\t\t\t// In a headless environment you can use a package such as JSDom to parse the HTML string.\n\t\t\t\tconst dom = new JSDOM(`<!DOCTYPE html><body>${html}</body>`);\n\n\t\t\t\t// Once you have the DOM instance it's easy to generate LexicalNodes.\n\t\t\t\tconst nodes = $generateNodesFromDOM(editor, dom.window.document);\n\n\t\t\t\t// Select the root\n\t\t\t\t$getRoot().select();\n\n\t\t\t\t// Insert them at a selection.\n\t\t\t\tconst selection = $getSelection();\n\n\t\t\t\tif (selection) selection.insertNodes(nodes);\n\t\t\t},\n\t\t\t{ discrete: true },\n\t\t);\n\n\t\tstate = editor.getEditorState().toJSON();\n\t});\n\n\treturn state as SerializedEditorState;\n};\n\n/**\n * Converts a Lexical editor state to an HTML string.\n *\n * @param {SerializedEditorState} json - The serialized editor state to convert.\n * @returns {string} The HTML string.\n */\nexport const lexicalToHtml = (json: SerializedEditorState): string => {\n\tconst editor = createHeadlessEditor({\n\t\tnodes: [],\n\t\tonError: (error) => {\n\t\t\tconsole.error(error);\n\t\t},\n\t});\n\n\t// Initialize a JSDOM instance\n\tconst dom = new JSDOM('');\n\n\t// @ts-ignore\n\tglobalThis.window = dom.window;\n\tglobalThis.document = dom.window.document;\n\n\teditor.update(() => {\n\t\tconst editorState = editor.parseEditorState(json);\n\t\teditor.setEditorState(editorState);\n\t});\n\n\t// Convert the editor state to HTML\n\tlet html = '';\n\teditor.getEditorState().read(() => {\n\t\thtml = $generateHtmlFromNodes(editor);\n\t});\n\n\treturn html;\n};\n"],"names":["createHeadlessEditor","$generateNodesFromDOM","$generateHtmlFromNodes","$getRoot","$getSelection","JSDOM","getPayload","buildConfig","sqliteAdapter","defaultEditorConfig","getEnabledNodes","lexicalEditor","sanitizeServerEditorConfig","loadEditor","config","secret","editor","admin","hideGutter","db","client","url","instance","editorConfig","nodes","htmlToLexical","html","state","then","update","dom","window","document","select","selection","insertNodes","discrete","getEditorState","toJSON","lexicalToHtml","json","onError","error","console","globalThis","editorState","parseEditorState","setEditorState","read"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,oBAAoB;AACzD,SAASC,qBAAqB,EAAEC,sBAAsB,QAAQ,gBAAgB;AAC9E,SAAQC,QAAQ,EAAEC,aAAa,QAAsB,UAAU;AAC/D,SAASC,KAAK,QAAQ,QAAQ;AAE9B,SAAQC,UAAU,QAAwB,UAAU;AACpD,SAAkBC,WAAW,QAAQ,UAAU;AAC/C,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SACCC,mBAAmB,EACnBC,eAAe,EAAEC,aAAa,EAC9BC,0BAA0B,QACpB,+BAA+B;AAEtC,MAAMC,aAAa;IAClB,MAAMC,SAAS;QACdC,QAAQ;QACRC,QAAQL,cAAc;YACrBM,OAAO;gBACNC,YAAY;YACb;QACD;QACAC,IAAIX,cAAc;YACjBY,QAAQ;gBACPC,KAAK;YACN;QACD;IACD;IAEA,MAAMC,WAAW,MAAMhB,WAAW;QACjCQ,QAAQP,YAAYO;IACrB;IAEA,MAAMS,eAAe,MAAMX,2BAC1BH,qBACAa,SAASR,MAAM;IAGhB,OAAOd,qBAAqB;QAC3BwB,OAAOd,gBAAgB;YACtBa;QACD;IACD;AACD;AAEA;;;;;CAKC,GACD,OAAO,MAAME,gBAAgB,CAACC;IAC7B,IAAIC,QAAQ,CAAC;IAEbd,aAAae,IAAI,CAACZ,CAAAA;QACjBA,OAAOa,MAAM,CACZ;YACC,0FAA0F;YAC1F,MAAMC,MAAM,IAAIzB,MAAM,CAAC,qBAAqB,EAAEqB,KAAK,OAAO,CAAC;YAE3D,qEAAqE;YACrE,MAAMF,QAAQvB,sBAAsBe,QAAQc,IAAIC,MAAM,CAACC,QAAQ;YAE/D,kBAAkB;YAClB7B,WAAW8B,MAAM;YAEjB,8BAA8B;YAC9B,MAAMC,YAAY9B;YAElB,IAAI8B,WAAWA,UAAUC,WAAW,CAACX;QACtC,GACA;YAAEY,UAAU;QAAK;QAGlBT,QAAQX,OAAOqB,cAAc,GAAGC,MAAM;IACvC;IAEA,OAAOX;AACR,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMY,gBAAgB,CAACC;IAC7B,MAAMxB,SAAShB,qBAAqB;QACnCwB,OAAO,EAAE;QACTiB,SAAS,CAACC;YACTC,QAAQD,KAAK,CAACA;QACf;IACD;IAEA,8BAA8B;IAC9B,MAAMZ,MAAM,IAAIzB,MAAM;IAEtB,aAAa;IACbuC,WAAWb,MAAM,GAAGD,IAAIC,MAAM;IAC9Ba,WAAWZ,QAAQ,GAAGF,IAAIC,MAAM,CAACC,QAAQ;IAEzChB,OAAOa,MAAM,CAAC;QACb,MAAMgB,cAAc7B,OAAO8B,gBAAgB,CAACN;QAC5CxB,OAAO+B,cAAc,CAACF;IACvB;IAEA,mCAAmC;IACnC,IAAInB,OAAO;IACXV,OAAOqB,cAAc,GAAGW,IAAI,CAAC;QAC5BtB,OAAOxB,uBAAuBc;IAC/B;IAEA,OAAOU;AACR,EAAE"}
@@ -0,0 +1,21 @@
1
+ import { htmlToLexical } from './lexical';
2
+ describe('htmlToLexical', ()=>{
3
+ it('should convert an HTML string to a Lexical editor state', ()=>{
4
+ const html = '<p>Hello, world!</p>';
5
+ const editorState = htmlToLexical(html);
6
+ expect(editorState).toEqual({
7
+ nodes: [
8
+ {
9
+ type: 'paragraph',
10
+ children: [
11
+ {
12
+ text: 'Hello, world!'
13
+ }
14
+ ]
15
+ }
16
+ ]
17
+ });
18
+ });
19
+ });
20
+
21
+ //# sourceMappingURL=lexical.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/lexical.test.ts"],"sourcesContent":["import { htmlToLexical } from './lexical';\n\ndescribe('htmlToLexical', () => {\n\tit('should convert an HTML string to a Lexical editor state', () => {\n\t\tconst html = '<p>Hello, world!</p>';\n\t\tconst editorState = htmlToLexical(html);\n\n\t\texpect(editorState).toEqual({\n\t\t\tnodes: [\n\t\t\t\t{\n\t\t\t\t\ttype: 'paragraph',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Hello, world!',\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":["htmlToLexical","describe","it","html","editorState","expect","toEqual","nodes","type","children","text"],"mappings":"AAAA,SAASA,aAAa,QAAQ,YAAY;AAE1CC,SAAS,iBAAiB;IACzBC,GAAG,2DAA2D;QAC7D,MAAMC,OAAO;QACb,MAAMC,cAAcJ,cAAcG;QAElCE,OAAOD,aAAaE,OAAO,CAAC;YAC3BC,OAAO;gBACN;oBACCC,MAAM;oBACNC,UAAU;wBACT;4BACCC,MAAM;wBACP;qBACA;gBACF;aACA;QACF;IACD;AACD"}
@@ -0,0 +1,2 @@
1
+ export declare const validateURL: (value: string) => Promise<true | "Please enter a valid URL">;
2
+ export declare const validatePostcode: (value: string) => Promise<true | "Invalid postcode format">;
package/package.json CHANGED
@@ -1,16 +1,10 @@
1
1
  {
2
2
  "name": "@ainsleydev/payload-helper",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Payload CMS utilities, collections and global types for ainsley.dev builds",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "keywords": [
8
- "payload",
9
- "cms",
10
- "plugin",
11
- "typescript",
12
- "react"
13
- ],
7
+ "keywords": ["payload", "cms", "plugin", "typescript", "react"],
14
8
  "repository": {
15
9
  "type": "git",
16
10
  "url": "https://github.com/ainsleydev/webkit.git",
@@ -21,8 +15,8 @@
21
15
  "email": "hello@ainsley.dev",
22
16
  "url": "https://ainsley.dev"
23
17
  },
24
- "main": "./src/index.ts",
25
- "types": "./src/index.ts",
18
+ "main": "./dist/index.js",
19
+ "types": "./dist/types.d.ts",
26
20
  "scripts": {
27
21
  "build": "pnpm run clean && pnpm build:types && pnpm build:swc",
28
22
  "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
@@ -36,21 +30,20 @@
36
30
  "bin": {
37
31
  "payload-helper": "bin.js"
38
32
  },
39
- "files": [
40
- "dist",
41
- "bin.js"
42
- ],
33
+ "files": ["dist", "bin.js", "types.js", "types.ts", "types.d.ts"],
43
34
  "dependencies": {
44
35
  "@lexical/headless": "^0.16.1",
45
36
  "@lexical/html": "^0.16.1",
46
37
  "@nouance/payload-better-fields-plugin": "^1.4.1",
47
- "@payloadcms/richtext-lexical": "3.0.0-beta.67",
38
+ "@payloadcms/db-sqlite": "3.0.0-canary.2c2c95f",
39
+ "@payloadcms/richtext-lexical": "3.0.0-beta.72",
48
40
  "@types/json-schema": "^7.0.15",
49
41
  "chalk": "^5.3.0",
50
42
  "commander": "^12.1.0",
43
+ "dotenv": "^16.4.5",
51
44
  "jsdom": "^24.1.1",
52
45
  "lexical": "^0.16.1",
53
- "payload": "3.0.0-beta.67"
46
+ "payload": "3.0.0-beta.72"
54
47
  },
55
48
  "devDependencies": {
56
49
  "@ainsleydev/eslint-config": "workspace:*",