@ai-stack/payloadcms 3.0.0-beta.104.0 → 3.0.0-beta.104.1

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":"updateFieldsConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/updateFieldsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,UAAU,kBAAkB;IAC1B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,uBAAuB,EAAE,gBAAgB,CAAA;CAC1C;AAED,eAAO,MAAM,kBAAkB,qBAAsB,gBAAgB,KAAG,kBAiGvE,CAAA"}
1
+ {"version":3,"file":"updateFieldsConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/updateFieldsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,UAAU,kBAAkB;IAC1B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,uBAAuB,EAAE,gBAAgB,CAAA;CAC1C;AAED,eAAO,MAAM,kBAAkB,qBAAsB,gBAAgB,KAAG,kBAgGvE,CAAA"}
@@ -79,10 +79,9 @@ export const updateFieldsConfig = (collectionConfig)=>{
79
79
  fields: collectionConfig.fields.map((field)=>updateField(field))
80
80
  };
81
81
  if (customComponentsFound) {
82
- console.warn(`\n— Oops! AI Plugin Alert 🚨:
83
- Uh-oh, custom component(s) spotted!
84
- We might not be able to inject the AI Composer automatically šŸ¤–.
85
- No worries, though! You can add it manually using this path:
82
+ console.warn(`\n— AI Plugin Alert 🚨:
83
+ Uh-oh, custom component(s) spotted! We might not be able to inject the AI Composer automatically for these components šŸ¤–.
84
+ No worries, though! You can add it manually using below path:
86
85
  '@ai-stack/payloadcms/fields#DescriptionField'.\n`);
87
86
  }
88
87
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/updateFieldsConfig.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\ninterface UpdateFieldsConfig {\n schemaPathMap: Record<string, string>\n updatedCollectionConfig: CollectionConfig\n}\n\nexport const updateFieldsConfig = (collectionConfig: CollectionConfig): UpdateFieldsConfig => {\n let schemaPathMap = {}\n let customComponentsFound = false\n function updateField(field: any, parentPath = ''): any {\n const currentPath = parentPath ? `${parentPath}.${field.name}` : field.name\n const currentSchemaPath = `${collectionConfig.slug}.${currentPath}`\n\n if (field.admin?.disabled || field.admin?.readOnly || field.admin?.hidden) {\n return field\n }\n\n // Map field path for global fieldInstructionsMap to load related instructions\n // This is done due to save extra API call to get instructions when Field components are loaded in admin\n // Doing is will only call instructions data when user clicks on settings\n if (['richText', 'text', 'textarea', 'upload'].includes(field.type)) {\n schemaPathMap = {\n ...schemaPathMap,\n [currentSchemaPath]: {\n type: field.type,\n label: field.label || field.name,\n },\n }\n }\n\n // Inject AI actions, richText is not included here as it has to be explicitly defined by user\n if (['text', 'textarea', 'upload'].includes(field.type)) {\n let customField = {}\n if (field.admin?.components?.Field || field.admin?.components?.Description) {\n customComponentsFound = true\n }\n\n return {\n ...field,\n admin: {\n ...field.admin,\n components: {\n ...(field.admin?.components || {}),\n Description: '@ai-stack/payloadcms/fields#DescriptionField',\n ...customField,\n },\n },\n }\n }\n\n if (field.fields) {\n return {\n ...field,\n fields: field.fields.map((subField: any) => updateField(subField, currentPath)),\n }\n }\n\n if (field.tabs) {\n return {\n ...field,\n tabs: field.tabs.map((tab: any) => {\n return {\n ...tab,\n fields: tab.fields.map((subField: any) => updateField(subField, tab.name)),\n }\n }),\n }\n }\n\n if (field.blocks) {\n return {\n ...field,\n blocks: field.blocks.map((block: any) => ({\n ...block,\n fields: block.fields.map((subField: any) =>\n updateField(subField, `${currentPath}.${block.slug}`),\n ),\n })),\n }\n }\n\n return field\n }\n\n const updatedCollectionConfig = {\n ...collectionConfig,\n fields: collectionConfig.fields.map((field) => updateField(field)),\n }\n\n if (customComponentsFound) {\n console.warn(\n `\\n— Oops! AI Plugin Alert 🚨:\n Uh-oh, custom component(s) spotted!\n We might not be able to inject the AI Composer automatically šŸ¤–.\n No worries, though! You can add it manually using this path:\n '@ai-stack/payloadcms/fields#DescriptionField'.\\n`,\n )\n }\n\n return {\n schemaPathMap,\n updatedCollectionConfig,\n }\n}\n"],"names":["updateFieldsConfig","collectionConfig","schemaPathMap","customComponentsFound","updateField","field","parentPath","currentPath","name","currentSchemaPath","slug","admin","disabled","readOnly","hidden","includes","type","label","customField","components","Field","Description","fields","map","subField","tabs","tab","blocks","block","updatedCollectionConfig","console","warn"],"mappings":"AAOA,OAAO,MAAMA,qBAAqB,CAACC;IACjC,IAAIC,gBAAgB,CAAC;IACrB,IAAIC,wBAAwB;IAC5B,SAASC,YAAYC,KAAU,EAAEC,aAAa,EAAE;QAC9C,MAAMC,cAAcD,aAAa,CAAC,EAAEA,WAAW,CAAC,EAAED,MAAMG,IAAI,CAAC,CAAC,GAAGH,MAAMG,IAAI;QAC3E,MAAMC,oBAAoB,CAAC,EAAER,iBAAiBS,IAAI,CAAC,CAAC,EAAEH,YAAY,CAAC;QAEnE,IAAIF,MAAMM,KAAK,EAAEC,YAAYP,MAAMM,KAAK,EAAEE,YAAYR,MAAMM,KAAK,EAAEG,QAAQ;YACzE,OAAOT;QACT;QAEA,8EAA8E;QAC9E,wGAAwG;QACxG,yEAAyE;QACzE,IAAI;YAAC;YAAY;YAAQ;YAAY;SAAS,CAACU,QAAQ,CAACV,MAAMW,IAAI,GAAG;YACnEd,gBAAgB;gBACd,GAAGA,aAAa;gBAChB,CAACO,kBAAkB,EAAE;oBACnBO,MAAMX,MAAMW,IAAI;oBAChBC,OAAOZ,MAAMY,KAAK,IAAIZ,MAAMG,IAAI;gBAClC;YACF;QACF;QAEA,8FAA8F;QAC9F,IAAI;YAAC;YAAQ;YAAY;SAAS,CAACO,QAAQ,CAACV,MAA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D;IAEA,IAAIF,uBAAuB;QACzB2B,QAAQC,IAAI,CACV,CAAC;;;;mDAI4C,CAAC;IAElD;IAEA,OAAO;QACL7B;QACA2B;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/updateFieldsConfig.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\ninterface UpdateFieldsConfig {\n schemaPathMap: Record<string, string>\n updatedCollectionConfig: CollectionConfig\n}\n\nexport const updateFieldsConfig = (collectionConfig: CollectionConfig): UpdateFieldsConfig => {\n let schemaPathMap = {}\n let customComponentsFound = false\n function updateField(field: any, parentPath = ''): any {\n const currentPath = parentPath ? `${parentPath}.${field.name}` : field.name\n const currentSchemaPath = `${collectionConfig.slug}.${currentPath}`\n\n if (field.admin?.disabled || field.admin?.readOnly || field.admin?.hidden) {\n return field\n }\n\n // Map field path for global fieldInstructionsMap to load related instructions\n // This is done due to save extra API call to get instructions when Field components are loaded in admin\n // Doing is will only call instructions data when user clicks on settings\n if (['richText', 'text', 'textarea', 'upload'].includes(field.type)) {\n schemaPathMap = {\n ...schemaPathMap,\n [currentSchemaPath]: {\n type: field.type,\n label: field.label || field.name,\n },\n }\n }\n\n // Inject AI actions, richText is not included here as it has to be explicitly defined by user\n if (['text', 'textarea', 'upload'].includes(field.type)) {\n let customField = {}\n if (field.admin?.components?.Field || field.admin?.components?.Description) {\n customComponentsFound = true\n }\n\n return {\n ...field,\n admin: {\n ...field.admin,\n components: {\n ...(field.admin?.components || {}),\n Description: '@ai-stack/payloadcms/fields#DescriptionField',\n ...customField,\n },\n },\n }\n }\n\n if (field.fields) {\n return {\n ...field,\n fields: field.fields.map((subField: any) => updateField(subField, currentPath)),\n }\n }\n\n if (field.tabs) {\n return {\n ...field,\n tabs: field.tabs.map((tab: any) => {\n return {\n ...tab,\n fields: tab.fields.map((subField: any) => updateField(subField, tab.name)),\n }\n }),\n }\n }\n\n if (field.blocks) {\n return {\n ...field,\n blocks: field.blocks.map((block: any) => ({\n ...block,\n fields: block.fields.map((subField: any) =>\n updateField(subField, `${currentPath}.${block.slug}`),\n ),\n })),\n }\n }\n\n return field\n }\n\n const updatedCollectionConfig = {\n ...collectionConfig,\n fields: collectionConfig.fields.map((field) => updateField(field)),\n }\n\n if (customComponentsFound) {\n console.warn(\n `\\n— AI Plugin Alert 🚨:\n Uh-oh, custom component(s) spotted! We might not be able to inject the AI Composer automatically for these components šŸ¤–.\n No worries, though! You can add it manually using below path:\n '@ai-stack/payloadcms/fields#DescriptionField'.\\n`,\n )\n }\n\n return {\n schemaPathMap,\n updatedCollectionConfig,\n }\n}\n"],"names":["updateFieldsConfig","collectionConfig","schemaPathMap","customComponentsFound","updateField","field","parentPath","currentPath","name","currentSchemaPath","slug","admin","disabled","readOnly","hidden","includes","type","label","customField","components","Field","Description","fields","map","subField","tabs","tab","blocks","block","updatedCollectionConfig","console","warn"],"mappings":"AAOA,OAAO,MAAMA,qBAAqB,CAACC;IACjC,IAAIC,gBAAgB,CAAC;IACrB,IAAIC,wBAAwB;IAC5B,SAASC,YAAYC,KAAU,EAAEC,aAAa,EAAE;QAC9C,MAAMC,cAAcD,aAAa,CAAC,EAAEA,WAAW,CAAC,EAAED,MAAMG,IAAI,CAAC,CAAC,GAAGH,MAAMG,IAAI;QAC3E,MAAMC,oBAAoB,CAAC,EAAER,iBAAiBS,IAAI,CAAC,CAAC,EAAEH,YAAY,CAAC;QAEnE,IAAIF,MAAMM,KAAK,EAAEC,YAAYP,MAAMM,KAAK,EAAEE,YAAYR,MAAMM,KAAK,EAAEG,QAAQ;YACzE,OAAOT;QACT;QAEA,8EAA8E;QAC9E,wGAAwG;QACxG,yEAAyE;QACzE,IAAI;YAAC;YAAY;YAAQ;YAAY;SAAS,CAACU,QAAQ,CAACV,MAAMW,IAAI,GAAG;YACnEd,gBAAgB;gBACd,GAAGA,aAAa;gBAChB,CAACO,kBAAkB,EAAE;oBACnBO,MAAMX,MAAMW,IAAI;oBAChBC,OAAOZ,MAAMY,KAAK,IAAIZ,MA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;QAC9B,GAAG5B,gBAAgB;QACnBqB,QAAQrB,iBAAiBqB,MAAM,CAACC,GAAG,CAAC,CAAClB,QAAUD,YAAYC;IAC7D;IAEA,IAAIF,uBAAuB;QACzB2B,QAAQC,IAAI,CACV,CAAC;;;mDAG4C,CAAC;IAElD;IAEA,OAAO;QACL7B;QACA2B;IACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-stack/payloadcms",
3
- "version": "3.0.0-beta.104.0",
3
+ "version": "3.0.0-beta.104.1",
4
4
  "private": false,
5
5
  "bugs": "https://github.com/ashbuilds/payload-ai/issues",
6
6
  "repository": "https://github.com/ashbuilds/payload-ai",