@payloadcms/plugin-redirects 3.46.0-canary.3 → 3.46.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,MAAM,EAAsB,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAIvD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,eAAO,MAAM,eAAe,iBACX,qBAAqB,sBACnB,MAAM,KAAG,MA2FzB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,MAAM,EAAsB,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAIvD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,eAAO,MAAM,eAAe,iBACX,qBAAqB,sBACnB,MAAM,KAAG,MA4FzB,CAAA"}
package/dist/index.js CHANGED
@@ -15,7 +15,8 @@ export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>{
15
15
  type: 'text',
16
16
  index: true,
17
17
  label: 'From URL',
18
- required: true
18
+ required: true,
19
+ unique: true
19
20
  },
20
21
  {
21
22
  name: 'to',
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, SelectField } from 'payload'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport { redirectOptions } from './redirectTypes.js'\n\nexport { redirectOptions, redirectTypes } from './redirectTypes.js'\nexport const redirectsPlugin =\n (pluginConfig: RedirectsPluginConfig) =>\n (incomingConfig: Config): Config => {\n const redirectSelectField: SelectField = {\n name: 'type',\n type: 'select',\n label: 'Redirect Type',\n options: redirectOptions.filter((option) =>\n pluginConfig?.redirectTypes?.includes(option.value),\n ),\n required: true,\n ...((pluginConfig?.redirectTypeFieldOverride || {}) as {\n hasMany: boolean\n } & Partial<SelectField>),\n }\n\n const defaultFields: Field[] = [\n {\n name: 'from',\n type: 'text',\n index: true,\n label: 'From URL',\n required: true,\n },\n {\n name: 'to',\n type: 'group',\n fields: [\n {\n name: 'type',\n type: 'radio',\n admin: {\n layout: 'horizontal',\n },\n defaultValue: 'reference',\n label: 'To URL Type',\n options: [\n {\n label: 'Internal link',\n value: 'reference',\n },\n {\n label: 'Custom URL',\n value: 'custom',\n },\n ],\n },\n {\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n label: 'Document to redirect to',\n relationTo: pluginConfig?.collections || [],\n required: true,\n },\n {\n name: 'url',\n type: 'text',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'custom',\n },\n label: 'Custom URL',\n required: true,\n },\n ],\n label: false,\n },\n ...(pluginConfig?.redirectTypes ? [redirectSelectField] : []),\n ]\n\n const redirectsCollection: CollectionConfig = {\n ...(pluginConfig?.overrides || {}),\n slug: pluginConfig?.overrides?.slug || 'redirects',\n access: {\n read: () => true,\n ...(pluginConfig?.overrides?.access || {}),\n },\n admin: {\n defaultColumns: ['from', 'to.type', 'createdAt'],\n ...(pluginConfig?.overrides?.admin || {}),\n },\n fields:\n pluginConfig?.overrides?.fields && typeof pluginConfig?.overrides?.fields === 'function'\n ? pluginConfig?.overrides.fields({ defaultFields })\n : defaultFields,\n }\n\n return {\n ...incomingConfig,\n collections: [...(incomingConfig?.collections || []), redirectsCollection],\n }\n }\n"],"names":["redirectOptions","redirectTypes","redirectsPlugin","pluginConfig","incomingConfig","redirectSelectField","name","type","label","options","filter","option","includes","value","required","redirectTypeFieldOverride","defaultFields","index","fields","admin","layout","defaultValue","condition","_","siblingData","relationTo","collections","redirectsCollection","overrides","slug","access","read","defaultColumns"],"mappings":"AAIA,SAASA,eAAe,QAAQ,qBAAoB;AAEpD,SAASA,eAAe,EAAEC,aAAa,QAAQ,qBAAoB;AACnE,OAAO,MAAMC,kBACX,CAACC,eACD,CAACC;QACC,MAAMC,sBAAmC;YACvCC,MAAM;YACNC,MAAM;YACNC,OAAO;YACPC,SAAST,gBAAgBU,MAAM,CAAC,CAACC,SAC/BR,cAAcF,eAAeW,SAASD,OAAOE,KAAK;YAEpDC,UAAU;YACV,GAAKX,cAAcY,6BAA6B,CAAC,CAAC;QAGpD;QAEA,MAAMC,gBAAyB;YAC7B;gBACEV,MAAM;gBACNC,MAAM;gBACNU,OAAO;gBACPT,OAAO;gBACPM,UAAU;YACZ;YACA;gBACER,MAAM;gBACNC,MAAM;gBACNW,QAAQ;oBACN;wBACEZ,MAAM;wBACNC,MAAM;wBACNY,OAAO;4BACLC,QAAQ;wBACV;wBACAC,cAAc;wBACdb,OAAO;wBACPC,SAAS;4BACP;gCACED,OAAO;gCACPK,OAAO;4BACT;4BACA;gCACEL,OAAO;gCACPK,OAAO;4BACT;yBACD;oBACH;oBACA;wBACEP,MAAM;wBACNC,MAAM;wBACNY,OAAO;4BACLG,WAAW,CAACC,GAAGC,cAAgBA,aAAajB,SAAS;wBACvD;wBACAC,OAAO;wBACPiB,YAAYtB,cAAcuB,eAAe,EAAE;wBAC3CZ,UAAU;oBACZ;oBACA;wBACER,MAAM;wBACNC,MAAM;wBACNY,OAAO;4BACLG,WAAW,CAACC,GAAGC,cAAgBA,aAAajB,SAAS;wBACvD;wBACAC,OAAO;wBACPM,UAAU;oBACZ;iBACD;gBACDN,OAAO;YACT;eACIL,cAAcF,gBAAgB;gBAACI;aAAoB,GAAG,EAAE;SAC7D;QAED,MAAMsB,sBAAwC;YAC5C,GAAIxB,cAAcyB,aAAa,CAAC,CAAC;YACjCC,MAAM1B,cAAcyB,WAAWC,QAAQ;YACvCC,QAAQ;gBACNC,MAAM,IAAM;gBACZ,GAAI5B,cAAcyB,WAAWE,UAAU,CAAC,CAAC;YAC3C;YACAX,OAAO;gBACLa,gBAAgB;oBAAC;oBAAQ;oBAAW;iBAAY;gBAChD,GAAI7B,cAAcyB,WAAWT,SAAS,CAAC,CAAC;YAC1C;YACAD,QACEf,cAAcyB,WAAWV,UAAU,OAAOf,cAAcyB,WAAWV,WAAW,aAC1Ef,cAAcyB,UAAUV,OAAO;gBAAEF;YAAc,KAC/CA;QACR;QAEA,OAAO;YACL,GAAGZ,cAAc;YACjBsB,aAAa;mBAAKtB,gBAAgBsB,eAAe,EAAE;gBAAGC;aAAoB;QAC5E;IACF,EAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, SelectField } from 'payload'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport { redirectOptions } from './redirectTypes.js'\n\nexport { redirectOptions, redirectTypes } from './redirectTypes.js'\nexport const redirectsPlugin =\n (pluginConfig: RedirectsPluginConfig) =>\n (incomingConfig: Config): Config => {\n const redirectSelectField: SelectField = {\n name: 'type',\n type: 'select',\n label: 'Redirect Type',\n options: redirectOptions.filter((option) =>\n pluginConfig?.redirectTypes?.includes(option.value),\n ),\n required: true,\n ...((pluginConfig?.redirectTypeFieldOverride || {}) as {\n hasMany: boolean\n } & Partial<SelectField>),\n }\n\n const defaultFields: Field[] = [\n {\n name: 'from',\n type: 'text',\n index: true,\n label: 'From URL',\n required: true,\n unique: true,\n },\n {\n name: 'to',\n type: 'group',\n fields: [\n {\n name: 'type',\n type: 'radio',\n admin: {\n layout: 'horizontal',\n },\n defaultValue: 'reference',\n label: 'To URL Type',\n options: [\n {\n label: 'Internal link',\n value: 'reference',\n },\n {\n label: 'Custom URL',\n value: 'custom',\n },\n ],\n },\n {\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n label: 'Document to redirect to',\n relationTo: pluginConfig?.collections || [],\n required: true,\n },\n {\n name: 'url',\n type: 'text',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'custom',\n },\n label: 'Custom URL',\n required: true,\n },\n ],\n label: false,\n },\n ...(pluginConfig?.redirectTypes ? [redirectSelectField] : []),\n ]\n\n const redirectsCollection: CollectionConfig = {\n ...(pluginConfig?.overrides || {}),\n slug: pluginConfig?.overrides?.slug || 'redirects',\n access: {\n read: () => true,\n ...(pluginConfig?.overrides?.access || {}),\n },\n admin: {\n defaultColumns: ['from', 'to.type', 'createdAt'],\n ...(pluginConfig?.overrides?.admin || {}),\n },\n fields:\n pluginConfig?.overrides?.fields && typeof pluginConfig?.overrides?.fields === 'function'\n ? pluginConfig?.overrides.fields({ defaultFields })\n : defaultFields,\n }\n\n return {\n ...incomingConfig,\n collections: [...(incomingConfig?.collections || []), redirectsCollection],\n }\n }\n"],"names":["redirectOptions","redirectTypes","redirectsPlugin","pluginConfig","incomingConfig","redirectSelectField","name","type","label","options","filter","option","includes","value","required","redirectTypeFieldOverride","defaultFields","index","unique","fields","admin","layout","defaultValue","condition","_","siblingData","relationTo","collections","redirectsCollection","overrides","slug","access","read","defaultColumns"],"mappings":"AAIA,SAASA,eAAe,QAAQ,qBAAoB;AAEpD,SAASA,eAAe,EAAEC,aAAa,QAAQ,qBAAoB;AACnE,OAAO,MAAMC,kBACX,CAACC,eACD,CAACC;QACC,MAAMC,sBAAmC;YACvCC,MAAM;YACNC,MAAM;YACNC,OAAO;YACPC,SAAST,gBAAgBU,MAAM,CAAC,CAACC,SAC/BR,cAAcF,eAAeW,SAASD,OAAOE,KAAK;YAEpDC,UAAU;YACV,GAAKX,cAAcY,6BAA6B,CAAC,CAAC;QAGpD;QAEA,MAAMC,gBAAyB;YAC7B;gBACEV,MAAM;gBACNC,MAAM;gBACNU,OAAO;gBACPT,OAAO;gBACPM,UAAU;gBACVI,QAAQ;YACV;YACA;gBACEZ,MAAM;gBACNC,MAAM;gBACNY,QAAQ;oBACN;wBACEb,MAAM;wBACNC,MAAM;wBACNa,OAAO;4BACLC,QAAQ;wBACV;wBACAC,cAAc;wBACdd,OAAO;wBACPC,SAAS;4BACP;gCACED,OAAO;gCACPK,OAAO;4BACT;4BACA;gCACEL,OAAO;gCACPK,OAAO;4BACT;yBACD;oBACH;oBACA;wBACEP,MAAM;wBACNC,MAAM;wBACNa,OAAO;4BACLG,WAAW,CAACC,GAAGC,cAAgBA,aAAalB,SAAS;wBACvD;wBACAC,OAAO;wBACPkB,YAAYvB,cAAcwB,eAAe,EAAE;wBAC3Cb,UAAU;oBACZ;oBACA;wBACER,MAAM;wBACNC,MAAM;wBACNa,OAAO;4BACLG,WAAW,CAACC,GAAGC,cAAgBA,aAAalB,SAAS;wBACvD;wBACAC,OAAO;wBACPM,UAAU;oBACZ;iBACD;gBACDN,OAAO;YACT;eACIL,cAAcF,gBAAgB;gBAACI;aAAoB,GAAG,EAAE;SAC7D;QAED,MAAMuB,sBAAwC;YAC5C,GAAIzB,cAAc0B,aAAa,CAAC,CAAC;YACjCC,MAAM3B,cAAc0B,WAAWC,QAAQ;YACvCC,QAAQ;gBACNC,MAAM,IAAM;gBACZ,GAAI7B,cAAc0B,WAAWE,UAAU,CAAC,CAAC;YAC3C;YACAX,OAAO;gBACLa,gBAAgB;oBAAC;oBAAQ;oBAAW;iBAAY;gBAChD,GAAI9B,cAAc0B,WAAWT,SAAS,CAAC,CAAC;YAC1C;YACAD,QACEhB,cAAc0B,WAAWV,UAAU,OAAOhB,cAAc0B,WAAWV,WAAW,aAC1EhB,cAAc0B,UAAUV,OAAO;gBAAEH;YAAc,KAC/CA;QACR;QAEA,OAAO;YACL,GAAGZ,cAAc;YACjBuB,aAAa;mBAAKvB,gBAAgBuB,eAAe,EAAE;gBAAGC;aAAoB;QAC5E;IACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-redirects",
3
- "version": "3.46.0-canary.3",
3
+ "version": "3.46.0",
4
4
  "description": "Redirects plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -48,10 +48,10 @@
48
48
  ],
49
49
  "devDependencies": {
50
50
  "@payloadcms/eslint-config": "3.28.0",
51
- "payload": "3.46.0-canary.3"
51
+ "payload": "3.46.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "payload": "3.46.0-canary.3"
54
+ "payload": "3.46.0"
55
55
  },
56
56
  "homepage:": "https://payloadcms.com",
57
57
  "scripts": {