@ai-stack/payloadcms 3.2.8-beta → 3.2.10-beta

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 (110) hide show
  1. package/README.md +42 -21
  2. package/dist/ai/models/anthropic/generateRichText.d.ts +1 -1
  3. package/dist/ai/models/anthropic/generateRichText.d.ts.map +1 -1
  4. package/dist/ai/models/anthropic/generateRichText.js +5 -6
  5. package/dist/ai/models/anthropic/generateRichText.js.map +1 -1
  6. package/dist/ai/models/anthropic/index.js +15 -12
  7. package/dist/ai/models/anthropic/index.js.map +1 -1
  8. package/dist/ai/models/openai/generateImage.d.ts +2 -6
  9. package/dist/ai/models/openai/generateImage.d.ts.map +1 -1
  10. package/dist/ai/models/openai/generateImage.js +19 -9
  11. package/dist/ai/models/openai/generateImage.js.map +1 -1
  12. package/dist/ai/models/openai/generateRichText.d.ts +1 -1
  13. package/dist/ai/models/openai/generateRichText.d.ts.map +1 -1
  14. package/dist/ai/models/openai/generateRichText.js +5 -6
  15. package/dist/ai/models/openai/generateRichText.js.map +1 -1
  16. package/dist/ai/models/openai/index.d.ts.map +1 -1
  17. package/dist/ai/models/openai/index.js +133 -4
  18. package/dist/ai/models/openai/index.js.map +1 -1
  19. package/dist/ai/prompts.js +6 -6
  20. package/dist/ai/prompts.js.map +1 -1
  21. package/dist/ai/schemas/lexicalJsonSchema.d.ts +20 -370
  22. package/dist/ai/schemas/lexicalJsonSchema.d.ts.map +1 -1
  23. package/dist/ai/schemas/lexicalJsonSchema.js +81 -9
  24. package/dist/ai/schemas/lexicalJsonSchema.js.map +1 -1
  25. package/dist/ai/utils/editImagesWithOpenAI.d.ts +11 -0
  26. package/dist/ai/utils/editImagesWithOpenAI.d.ts.map +1 -0
  27. package/dist/ai/utils/editImagesWithOpenAI.js +37 -0
  28. package/dist/ai/utils/editImagesWithOpenAI.js.map +1 -0
  29. package/dist/ai/utils/filterEditorSchemaByNodes.d.ts +72 -0
  30. package/dist/ai/utils/filterEditorSchemaByNodes.d.ts.map +1 -0
  31. package/dist/ai/utils/filterEditorSchemaByNodes.js +43 -0
  32. package/dist/ai/utils/filterEditorSchemaByNodes.js.map +1 -0
  33. package/dist/ai/utils/isObjectSchema.d.ts +3 -0
  34. package/dist/ai/utils/isObjectSchema.d.ts.map +1 -0
  35. package/dist/ai/utils/isObjectSchema.js +5 -0
  36. package/dist/ai/utils/isObjectSchema.js.map +1 -0
  37. package/dist/collections/Instructions.d.ts.map +1 -1
  38. package/dist/collections/Instructions.js +43 -29
  39. package/dist/collections/Instructions.js.map +1 -1
  40. package/dist/defaults.d.ts +1 -1
  41. package/dist/defaults.js +1 -1
  42. package/dist/defaults.js.map +1 -1
  43. package/dist/endpoints/fetchFields.d.ts +2 -1
  44. package/dist/endpoints/fetchFields.d.ts.map +1 -1
  45. package/dist/endpoints/fetchFields.js +33 -17
  46. package/dist/endpoints/fetchFields.js.map +1 -1
  47. package/dist/endpoints/index.d.ts.map +1 -1
  48. package/dist/endpoints/index.js +65 -15
  49. package/dist/endpoints/index.js.map +1 -1
  50. package/dist/fields/ComposeField/ComposeField.js +3 -2
  51. package/dist/fields/ComposeField/ComposeField.js.map +1 -1
  52. package/dist/fields/LexicalEditor/ComposeFeatureComponent.d.ts.map +1 -1
  53. package/dist/fields/LexicalEditor/ComposeFeatureComponent.js +3 -2
  54. package/dist/fields/LexicalEditor/ComposeFeatureComponent.js.map +1 -1
  55. package/dist/fields/PromptEditorField/PromptEditorField.d.ts.map +1 -1
  56. package/dist/fields/PromptEditorField/PromptEditorField.js +46 -16
  57. package/dist/fields/PromptEditorField/PromptEditorField.js.map +1 -1
  58. package/dist/fields/PromptEditorField/defaultStyle.d.ts +50 -0
  59. package/dist/fields/PromptEditorField/defaultStyle.d.ts.map +1 -0
  60. package/dist/fields/PromptEditorField/defaultStyle.js +51 -0
  61. package/dist/fields/PromptEditorField/defaultStyle.js.map +1 -0
  62. package/dist/init.d.ts.map +1 -1
  63. package/dist/init.js +5 -3
  64. package/dist/init.js.map +1 -1
  65. package/dist/plugin.js +3 -3
  66. package/dist/plugin.js.map +1 -1
  67. package/dist/providers/InstructionsProvider/InstructionsProvider.d.ts +3 -0
  68. package/dist/providers/InstructionsProvider/InstructionsProvider.d.ts.map +1 -1
  69. package/dist/providers/InstructionsProvider/InstructionsProvider.js +14 -4
  70. package/dist/providers/InstructionsProvider/InstructionsProvider.js.map +1 -1
  71. package/dist/providers/InstructionsProvider/useInstructions.d.ts.map +1 -1
  72. package/dist/providers/InstructionsProvider/useInstructions.js +54 -29
  73. package/dist/providers/InstructionsProvider/useInstructions.js.map +1 -1
  74. package/dist/types.d.ts +28 -3
  75. package/dist/types.d.ts.map +1 -1
  76. package/dist/types.js.map +1 -1
  77. package/dist/ui/Compose/Compose.d.ts +2 -1
  78. package/dist/ui/Compose/Compose.d.ts.map +1 -1
  79. package/dist/ui/Compose/Compose.js +7 -6
  80. package/dist/ui/Compose/Compose.js.map +1 -1
  81. package/dist/ui/Compose/hooks/menu/TranslateMenu.d.ts.map +1 -1
  82. package/dist/ui/Compose/hooks/menu/TranslateMenu.js +4 -0
  83. package/dist/ui/Compose/hooks/menu/TranslateMenu.js.map +1 -1
  84. package/dist/ui/Compose/hooks/menu/useMenu.d.ts +2 -2
  85. package/dist/ui/Compose/hooks/menu/useMenu.d.ts.map +1 -1
  86. package/dist/ui/Compose/hooks/menu/useMenu.js +9 -4
  87. package/dist/ui/Compose/hooks/menu/useMenu.js.map +1 -1
  88. package/dist/ui/Compose/hooks/useGenerate.d.ts.map +1 -1
  89. package/dist/ui/Compose/hooks/useGenerate.js +11 -4
  90. package/dist/ui/Compose/hooks/useGenerate.js.map +1 -1
  91. package/dist/utilities/extractImageData.d.ts +10 -0
  92. package/dist/utilities/extractImageData.d.ts.map +1 -0
  93. package/dist/utilities/extractImageData.js +22 -0
  94. package/dist/utilities/extractImageData.js.map +1 -0
  95. package/dist/utilities/isPluginActivated.d.ts +1 -1
  96. package/dist/utilities/isPluginActivated.d.ts.map +1 -1
  97. package/dist/utilities/isPluginActivated.js.map +1 -1
  98. package/dist/utilities/setSafeLexicalState.js +5 -2
  99. package/dist/utilities/setSafeLexicalState.js.map +1 -1
  100. package/package.json +19 -14
  101. package/dist/ai/models/example-prompt-rich-text.md +0 -47
  102. package/dist/ai/models/example.d.ts +0 -73
  103. package/dist/ai/models/example.d.ts.map +0 -1
  104. package/dist/ai/models/example.js +0 -126
  105. package/dist/ai/models/example.js.map +0 -1
  106. package/dist/libraries/autocomplete/AutocompleteTextArea.d.ts +0 -8
  107. package/dist/libraries/autocomplete/AutocompleteTextArea.d.ts.map +0 -1
  108. package/dist/libraries/autocomplete/AutocompleteTextArea.js +0 -437
  109. package/dist/libraries/autocomplete/AutocompleteTextArea.js.map +0 -1
  110. package/dist/libraries/autocomplete/AutocompleteTextArea.module.scss +0 -35
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"sourcesContent":["export const documentSchema = {\n type: 'object',\n $schema: 'http://json-schema.org/draft-07/schema#',\n additionalProperties: false,\n definitions: {\n // Text Node (Leaf Node)\n TextNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['text'] },\n detail: {\n type: 'number',\n description: 'Text detail flags',\n enum: [\n 0, // No details\n 1, // IS_DIRECTIONLESS\n 2, // IS_UNMERGEABLE\n 3, // IS_DIRECTIONLESS + IS_UNMERGEABLE\n ],\n examples: [\n { description: 'No special details', value: 0 },\n { description: 'Directionless', value: 1 },\n { description: 'Unmergeable', value: 2 },\n { description: 'Directionless + Unmergeable', value: 3 },\n ],\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: {\n type: 'number',\n description: `Format flags for text:\n 0 = No format\n 1 = Bold\n 2 = Italic\n 3 = Bold + Italic (1|2)\n 4 = Strikethrough\n 8 = Underline\n 9 = Bold + Underline (1|8)\n 16 = Code\n 32 = Subscript\n 64 = Superscript\n 128 = Highlight\n \n Formats can be combined using binary OR (|).\n Example combinations:\n - Bold + Italic = 1|2 = 3\n - Bold + Underline = 1|8 = 9\n - Italic + Underline = 2|8 = 10\n - Bold + Italic + Underline = 1|2|8 = 11`,\n },\n indent: { type: 'number' },\n mode: {\n type: 'number',\n description: 'Text mode flags',\n enum: [\n 0, // Normal\n 1, // Token\n 2, // Segmented\n ],\n examples: [\n { description: 'Normal text', value: 0 },\n { description: 'Token text', value: 1 },\n { description: 'Segmented text', value: 2 },\n ],\n },\n style: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n text: { type: 'string' },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'text',\n 'format',\n 'style',\n 'mode',\n 'detail',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Cell Node\n TableCellNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablecell'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n colSpan: { type: 'number' },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n headerState: { type: 'number' },\n indent: { type: 'number' },\n version: { type: 'number' },\n width: {\n type: ['null'],\n enum: [null],\n },\n },\n required: [\n 'type',\n 'children',\n 'headerState',\n 'colSpan',\n 'width',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Row Node\n TableRowNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablerow'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableCellNode',\n },\n },\n height: { type: 'number' },\n },\n required: ['type', 'children', 'height'],\n },\n // Styled Table Node\n TableNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['table'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableRowNode',\n },\n },\n },\n required: ['type', 'children'],\n },\n // Heading Node\n HeadingNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['heading'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/TextNode' }, { $ref: '#/definitions/LinkNode' }],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n tag: { type: 'string', enum: ['h1', 'h2', 'h3'] },\n version: { type: 'number' },\n },\n required: ['type', 'tag', 'children', 'direction', 'indent', 'version'],\n },\n // Paragraph Node\n ParagraphNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['paragraph'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/CodeNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: { type: 'string', enum: ['start', 'center', 'right'] },\n indent: { type: 'number' },\n textFormat: { type: 'number' },\n textStyle: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'children',\n 'direction',\n 'format',\n 'indent',\n 'textFormat',\n 'textStyle',\n 'version',\n ],\n },\n // Link Node\n LinkNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['link'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n url: { type: 'string' },\n },\n required: ['type', 'url', 'children'],\n },\n // List Item Node\n ListItemNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n indent: { type: 'number', enum: [0, 1] },\n type: { type: 'string', enum: ['listitem'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/ParagraphNode' }, { $ref: '#/definitions/ListNode' }],\n },\n },\n },\n required: ['indent', 'type', 'children'],\n },\n // List Node\n ListNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['list'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/ListItemNode',\n },\n },\n listType: { type: 'string', enum: ['bullet', 'number'] },\n },\n required: ['type', 'listType', 'children'],\n },\n // Quote Node\n QuoteNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['quote'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/TextNode' }, { $ref: '#/definitions/ParagraphNode' }],\n },\n },\n },\n required: ['type', 'children'],\n },\n // Code Node\n CodeNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['code'] },\n code: { type: 'string' },\n language: { type: 'string' },\n },\n required: ['type', 'code', 'language'],\n },\n // Horizontal Rule Node\n HorizontalRuleNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['horizontalrule'] },\n },\n required: ['type'],\n },\n // Image Node\n ImageNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['image'] },\n alt: { type: 'string' },\n caption: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n src: { type: 'string' },\n },\n required: ['type', 'src', 'alt', 'caption'],\n },\n // Root Node\n RootNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['root'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/HeadingNode' },\n { $ref: '#/definitions/ParagraphNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/ListNode' },\n { $ref: '#/definitions/QuoteNode' },\n { $ref: '#/definitions/CodeNode' },\n { $ref: '#/definitions/HorizontalRuleNode' },\n { $ref: '#/definitions/ImageNode' },\n { $ref: '#/definitions/TableNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n version: { type: 'number' },\n },\n required: ['type', 'children', 'direction', 'indent', 'version'],\n },\n },\n properties: {\n root: {\n $ref: '#/definitions/RootNode',\n },\n },\n required: ['root'],\n}\n\nexport const lexicalJsonSchema = (customNodes = []) => {\n const schema = JSON.parse(JSON.stringify(documentSchema))\n\n // Add custom nodes to the Node definition\n if (customNodes.length > 0) {\n customNodes.forEach((customNode, index) => {\n const customNodeName = `CustomNode${index + 1}`\n schema.definitions[customNodeName] = customNode\n schema.definitions.Node.oneOf.push({ $ref: `#/definitions/${customNodeName}` })\n })\n }\n\n return schema\n}\n"],"names":["documentSchema","type","$schema","additionalProperties","definitions","TextNode","properties","enum","detail","description","examples","value","direction","format","indent","mode","style","text","version","required","TableCellNode","children","items","$ref","colSpan","headerState","width","TableRowNode","height","TableNode","HeadingNode","anyOf","tag","ParagraphNode","textFormat","textStyle","LinkNode","url","ListItemNode","ListNode","listType","QuoteNode","CodeNode","code","language","HorizontalRuleNode","ImageNode","alt","caption","src","RootNode","root","lexicalJsonSchema","customNodes","schema","JSON","parse","stringify","length","forEach","customNode","index","customNodeName","Node","oneOf","push"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB;IAC5BC,MAAM;IACNC,SAAS;IACTC,sBAAsB;IACtBC,aAAa;QACX,wBAAwB;QACxBC,UAAU;YACRJ,MAAM;YACNE,sBAAsB;YACtBG,YAAY;gBACVL,MAAM;oBAAEA,MAAM;oBAAUM,MAAM;wBAAC;qBAAO;gBAAC;gBACvCC,QAAQ;oBACNP,MAAM;oBACNQ,aAAa;oBACbF,MAAM;wBACJ;wBACA;wBACA;wBACA;qBACD;oBACDG,UAAU;wBACR;4BAAED,aAAa;4BAAsBE,OAAO;wBAAE;wBAC9C;4BAAEF,aAAa;4BAAiBE,OAAO;wBAAE;wBACzC;4BAAEF,aAAa;4BAAeE,OAAO;wBAAE;wBACvC;4BAAEF,aAAa;4BAA+BE,OAAO;wBAAE;qBACxD;gBACH;gBACAC,WAAW;oBACTX,MAAM;wBAAC;wBAAU;qBAAO;oBACxBM,MAAM;wBAAC;wBAAO;qBAAK;gBACrB;gBACAM,QAAQ;oBACNZ,MAAM;oBACNQ,aAAa,CAAC;;;;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CP,OAAOlD,WAAW,CAAC0D,eAAe,GAAGF;YACrCN,OAAOlD,WAAW,CAAC2D,IAAI,CAACC,KAAK,CAACC,IAAI,CAAC;gBAAE1C,MAAM,CAAC,cAAc,EAAEuC,gBAAgB;YAAC;QAC/E;IACF;IAEA,OAAOR;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"sourcesContent":["import type { JSONSchema7 } from 'json-schema'\n\nimport { isObjectSchema } from '../utils/isObjectSchema.js'\n\nexport interface LexicalNodeSchema extends JSONSchema7 {\n additionalProperties?: boolean\n properties: {\n [key: string]: any\n children?: {\n items: {\n $ref?: string\n anyOf?: { $ref: string }[]\n }\n type: 'array'\n }\n type?: {\n enum: string[]\n type: 'string'\n }\n }\n required?: string[]\n type: 'object'\n}\n\nexport const documentSchema: LexicalNodeSchema = {\n type: 'object',\n $schema: 'http://json-schema.org/draft-07/schema#',\n additionalProperties: false,\n definitions: {\n LineBreakNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['linebreak'] },\n version: { type: 'number' },\n },\n required: ['type', 'version'],\n },\n TabNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tab'] },\n version: { type: 'number' },\n },\n required: ['type', 'version'],\n },\n // Text Node (Leaf Node)\n TextNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['text'] },\n detail: {\n type: 'number',\n description: 'Text detail flags',\n enum: [\n 0, // No details\n 1, // IS_DIRECTIONLESS\n 2, // IS_UNMERGEABLE\n 3, // IS_DIRECTIONLESS + IS_UNMERGEABLE\n ],\n examples: [\n { description: 'No special details', value: 0 },\n { description: 'Directionless', value: 1 },\n { description: 'Unmergeable', value: 2 },\n { description: 'Directionless + Unmergeable', value: 3 },\n ],\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: {\n type: 'number',\n description: `Format flags for text:\n 0 = No format\n 1 = Bold\n 2 = Italic\n 3 = Bold + Italic (1|2)\n 4 = Strikethrough\n 8 = Underline\n 9 = Bold + Underline (1|8)\n 16 = Code\n 32 = Subscript\n 64 = Superscript\n 128 = Highlight\n \n Formats can be combined using binary OR (|).\n Example combinations:\n - Bold + Italic = 1|2 = 3\n - Bold + Underline = 1|8 = 9\n - Italic + Underline = 2|8 = 10\n - Bold + Italic + Underline = 1|2|8 = 11`,\n },\n indent: { type: 'number' },\n mode: {\n type: 'number',\n description: 'Text mode flags',\n enum: [\n 0, // Normal\n 1, // Token\n 2, // Segmented\n ],\n examples: [\n { description: 'Normal text', value: 0 },\n { description: 'Token text', value: 1 },\n { description: 'Segmented text', value: 2 },\n ],\n },\n style: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n text: { type: 'string' },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'text',\n 'format',\n 'style',\n 'mode',\n 'detail',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Cell Node\n TableCellNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablecell'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n colSpan: { type: 'number' },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n headerState: { type: 'number' },\n indent: { type: 'number' },\n version: { type: 'number' },\n width: {\n type: ['null'],\n enum: [null],\n },\n },\n required: [\n 'type',\n 'children',\n 'headerState',\n 'colSpan',\n 'width',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Row Node\n TableRowNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablerow'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableCellNode',\n },\n },\n height: { type: 'number' },\n },\n required: ['type', 'children', 'height'],\n },\n // Styled Table Node\n TableNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['table'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableRowNode',\n },\n },\n },\n required: ['type', 'children'],\n },\n // Heading Node\n HeadingNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['heading'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/LineBreakNode' },\n { $ref: '#/definitions/TabNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n tag: { type: 'string', enum: ['h1', 'h2', 'h3'] },\n version: { type: 'number' },\n },\n required: ['type', 'tag', 'children', 'direction', 'indent', 'version'],\n },\n // Paragraph Node\n ParagraphNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['paragraph'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/CodeNode' },\n { $ref: '#/definitions/LineBreakNode' },\n { $ref: '#/definitions/TabNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: {\n type: 'string',\n description:\n 'Format alignment based on content. Prioritize \"start\", then \"center\", and use \"right\" only when appropriate.',\n enum: ['start', 'center', 'right'],\n },\n indent: { type: 'number' },\n textFormat: { type: 'number' },\n textStyle: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'children',\n 'direction',\n 'format',\n 'indent',\n 'textFormat',\n 'textStyle',\n 'version',\n ],\n },\n // Link Node\n LinkNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['link'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n url: { type: 'string' },\n },\n required: ['type', 'url', 'children'],\n },\n // List Item Node\n ListItemNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n // NOTE: Do not change the position of \"indent\", models like gpt generate properties as they are\n // defined in schema, moving the position of property \"indent\"\n // can cause issue with schema validation while streaming generated json to lexical editor\n indent: { type: 'number', enum: [0, 1] },\n\n type: { type: 'string', enum: ['listitem'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/ParagraphNode' },\n { $ref: '#/definitions/ListNode' },\n { $ref: '#/definitions/LineBreakNode' },\n ],\n },\n },\n },\n required: ['indent', 'type', 'children'],\n },\n // List Node\n ListNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['list'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/ListItemNode',\n },\n },\n listType: { type: 'string', enum: ['bullet', 'number'] },\n },\n required: ['type', 'listType', 'children'],\n },\n // Quote Node\n QuoteNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['quote'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/ParagraphNode' },\n { $ref: '#/definitions/LineBreakNode' },\n { $ref: '#/definitions/TabNode' },\n ],\n },\n },\n },\n required: ['type', 'children'],\n },\n // Code Node\n CodeNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['code'] },\n code: { type: 'string' },\n language: { type: 'string' },\n },\n required: ['type', 'code', 'language'],\n },\n // Horizontal Rule Node\n HorizontalRuleNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['horizontalrule'] },\n },\n required: ['type'],\n },\n // Image Node\n ImageNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['image'] },\n alt: { type: 'string' },\n caption: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n src: { type: 'string' },\n },\n required: ['type', 'src', 'alt', 'caption'],\n },\n // Root Node\n RootNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['root'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/HeadingNode' },\n { $ref: '#/definitions/ParagraphNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/ListNode' },\n { $ref: '#/definitions/QuoteNode' },\n { $ref: '#/definitions/CodeNode' },\n { $ref: '#/definitions/HorizontalRuleNode' },\n { $ref: '#/definitions/ImageNode' },\n { $ref: '#/definitions/TableNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n version: { type: 'number' },\n },\n required: ['type', 'children', 'direction', 'indent', 'version'],\n },\n },\n properties: {\n root: {\n $ref: '#/definitions/RootNode',\n },\n },\n required: ['root'],\n}\n\nexport const lexicalJsonSchema = (customNodes = []) => {\n const schema = structuredClone(documentSchema)\n\n if (Array.isArray(customNodes) && customNodes.length > 0) {\n customNodes.forEach((nodeObj) => {\n for (const [nodeName, nodeDefinition] of Object.entries(nodeObj)) {\n schema.definitions[nodeName] = nodeDefinition\n\n const rootNode = schema.definitions['RootNode']\n if (isObjectSchema(rootNode)) {\n const children = rootNode.properties?.children\n const items = children?.items\n const anyOfList = (items as any)?.anyOf\n\n if (Array.isArray(anyOfList)) {\n anyOfList.push({ $ref: `#/definitions/${nodeName}` })\n }\n }\n }\n })\n }\n\n return schema\n}\n"],"names":["isObjectSchema","documentSchema","type","$schema","additionalProperties","definitions","LineBreakNode","properties","enum","version","required","TabNode","TextNode","detail","description","examples","value","direction","format","indent","mode","style","text","TableCellNode","children","items","$ref","colSpan","headerState","width","TableRowNode","height","TableNode","HeadingNode","anyOf","tag","ParagraphNode","textFormat","textStyle","LinkNode","url","ListItemNode","ListNode","listType","QuoteNode","CodeNode","code","language","HorizontalRuleNode","ImageNode","alt","caption","src","RootNode","root","lexicalJsonSchema","customNodes","schema","structuredClone","Array","isArray","length","forEach","nodeObj","nodeName","nodeDefinition","Object","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AAgBA,YAAYK,MAAM,GAAG,GAAG;QACxDL,YAAYM,OAAO,CAAC,CAACC;YACnB,KAAK,MAAM,CAACC,UAAUC,eAAe,IAAIC,OAAOC,OAAO,CAACJ,SAAU;gBAChEN,OAAOpD,WAAW,CAAC2D,SAAS,GAAGC;gBAE/B,MAAMG,WAAWX,OAAOpD,WAAW,CAAC,WAAW;gBAC/C,IAAIL,eAAeoE,WAAW;oBAC5B,MAAM5C,WAAW4C,SAAS7D,UAAU,EAAEiB;oBACtC,MAAMC,QAAQD,UAAUC;oBACxB,MAAM4C,YAAa5C,OAAeS;oBAElC,IAAIyB,MAAMC,OAAO,CAACS,YAAY;wBAC5BA,UAAUC,IAAI,CAAC;4BAAE5C,MAAM,CAAC,cAAc,EAAEsC,UAAU;wBAAC;oBACrD;gBACF;YACF;QACF;IACF;IAEA,OAAOP;AACT,EAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ImageReference } from '../../types.js';
2
+ /**
3
+ * Send multiple images as `image[]` to OpenAI's image edit endpoint using gpt-image-1.
4
+ * @param images
5
+ * @param prompt Prompt to guide the image edit
6
+ * @param model
7
+ * @returns base64 string of the edited image
8
+ * @note: Remove this function, once https://github.com/openai/openai-node/issues/1492 is fixed.
9
+ */
10
+ export declare function editImagesWithOpenAI(images: ImageReference[], prompt: string, model?: string): Promise<any>;
11
+ //# sourceMappingURL=editImagesWithOpenAI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editImagesWithOpenAI.d.ts","sourceRoot":"","sources":["../../../src/ai/utils/editImagesWithOpenAI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,cAAc,EAAE,EACxB,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAsB,gBAmC9B"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Send multiple images as `image[]` to OpenAI's image edit endpoint using gpt-image-1.
3
+ * @param images
4
+ * @param prompt Prompt to guide the image edit
5
+ * @param model
6
+ * @returns base64 string of the edited image
7
+ * @note: Remove this function, once https://github.com/openai/openai-node/issues/1492 is fixed.
8
+ */ export async function editImagesWithOpenAI(images, prompt, model = 'gpt-image-1') {
9
+ try {
10
+ const formData = new FormData();
11
+ for (const [_, img] of images.entries()){
12
+ const extension = img.data.type.split('/')[1];
13
+ formData.append('image[]', img.data, `${img.name}.${extension}`);
14
+ }
15
+ formData.append('prompt', prompt);
16
+ formData.append('model', model);
17
+ const baseURL = process.env.OPENAI_BASE_URL ?? 'https://api.openai.com/v1';
18
+ const openaiRes = await fetch(`${baseURL}/images/edits`, {
19
+ body: formData,
20
+ headers: {
21
+ Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
22
+ 'OpenAI-Organization': process.env.OPENAI_ORG_ID || ''
23
+ },
24
+ method: 'POST'
25
+ });
26
+ if (!openaiRes.ok) {
27
+ const errorText = await openaiRes.text();
28
+ throw new Error(`OpenAI edit error: ${openaiRes.status} - ${errorText}`);
29
+ }
30
+ return openaiRes.json();
31
+ } catch (e) {
32
+ console.error('Error editing images: ', e);
33
+ throw Error('Image edit request failed. Please ensure the images are accessible and hosted publicly.');
34
+ }
35
+ }
36
+
37
+ //# sourceMappingURL=editImagesWithOpenAI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ai/utils/editImagesWithOpenAI.ts"],"sourcesContent":["import type { ImageReference } from '../../types.js'\n\n/**\n * Send multiple images as `image[]` to OpenAI's image edit endpoint using gpt-image-1.\n * @param images\n * @param prompt Prompt to guide the image edit\n * @param model\n * @returns base64 string of the edited image\n * @note: Remove this function, once https://github.com/openai/openai-node/issues/1492 is fixed.\n */\nexport async function editImagesWithOpenAI(\n images: ImageReference[],\n prompt: string,\n model: string = 'gpt-image-1',\n) {\n try {\n const formData = new FormData()\n\n for (const [_, img] of images.entries()) {\n const extension = img.data.type.split('/')[1]\n formData.append('image[]', img.data, `${img.name}.${extension}`)\n }\n\n formData.append('prompt', prompt)\n formData.append('model', model)\n\n const baseURL = process.env.OPENAI_BASE_URL ?? 'https://api.openai.com/v1'\n const openaiRes = await fetch(`${baseURL}/images/edits`, {\n body: formData,\n headers: {\n Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,\n 'OpenAI-Organization': process.env.OPENAI_ORG_ID || '',\n },\n method: 'POST',\n })\n\n if (!openaiRes.ok) {\n const errorText = await openaiRes.text()\n throw new Error(`OpenAI edit error: ${openaiRes.status} - ${errorText}`)\n }\n\n return openaiRes.json()\n } catch (e) {\n console.error('Error editing images: ', e)\n throw Error(\n 'Image edit request failed. Please ensure the images are accessible and hosted publicly.',\n )\n }\n}\n"],"names":["editImagesWithOpenAI","images","prompt","model","formData","FormData","_","img","entries","extension","data","type","split","append","name","baseURL","process","env","OPENAI_BASE_URL","openaiRes","fetch","body","headers","Authorization","OPENAI_API_KEY","OPENAI_ORG_ID","method","ok","errorText","text","Error","status","json","e","console","error"],"mappings":"AAEA;;;;;;;CAOC,GACD,OAAO,eAAeA,qBACpBC,MAAwB,EACxBC,MAAc,EACdC,QAAgB,aAAa;IAE7B,IAAI;QACF,MAAMC,WAAW,IAAIC;QAErB,KAAK,MAAM,CAACC,GAAGC,IAAI,IAAIN,OAAOO,OAAO,GAAI;YACvC,MAAMC,YAAYF,IAAIG,IAAI,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;YAC7CR,SAASS,MAAM,CAAC,WAAWN,IAAIG,IAAI,EAAE,GAAGH,IAAIO,IAAI,CAAC,CAAC,EAAEL,WAAW;QACjE;QAEAL,SAASS,MAAM,CAAC,UAAUX;QAC1BE,SAASS,MAAM,CAAC,SAASV;QAEzB,MAAMY,UAAUC,QAAQC,GAAG,CAACC,eAAe,IAAI;QAC/C,MAAMC,YAAY,MAAMC,MAAM,GAAGL,QAAQ,aAAa,CAAC,EAAE;YACvDM,MAAMjB;YACNkB,SAAS;gBACPC,eAAe,CAAC,OAAO,EAAEP,QAAQC,GAAG,CAACO,cAAc,EAAE;gBACrD,uBAAuBR,QAAQC,GAAG,CAACQ,aAAa,IAAI;YACtD;YACAC,QAAQ;QACV;QAEA,IAAI,CAACP,UAAUQ,EAAE,EAAE;YACjB,MAAMC,YAAY,MAAMT,UAAUU,IAAI;YACtC,MAAM,IAAIC,MAAM,CAAC,mBAAmB,EAAEX,UAAUY,MAAM,CAAC,GAAG,EAAEH,WAAW;QACzE;QAEA,OAAOT,UAAUa,IAAI;IACvB,EAAE,OAAOC,GAAG;QACVC,QAAQC,KAAK,CAAC,0BAA0BF;QACxC,MAAMH,MACJ;IAEJ;AACF"}
@@ -0,0 +1,72 @@
1
+ import type { LexicalNodeSchema } from '../schemas/lexicalJsonSchema.js';
2
+ export declare function filterEditorSchemaByNodes(schema: LexicalNodeSchema, allowedNodes: any): {
3
+ definitions: {};
4
+ additionalProperties?: boolean;
5
+ properties: {
6
+ [key: string]: any;
7
+ children?: {
8
+ items: {
9
+ $ref?: string;
10
+ anyOf?: {
11
+ $ref: string;
12
+ }[];
13
+ };
14
+ type: "array";
15
+ };
16
+ type?: {
17
+ enum: string[];
18
+ type: "string";
19
+ };
20
+ };
21
+ required?: string[];
22
+ type: "object";
23
+ $id?: string | undefined;
24
+ $ref?: string | undefined;
25
+ $schema?: import("json-schema").JSONSchema7Version | undefined;
26
+ $comment?: string | undefined;
27
+ $defs?: {
28
+ [key: string]: import("json-schema").JSONSchema7Definition;
29
+ } | undefined;
30
+ enum?: import("json-schema").JSONSchema7Type[] | undefined;
31
+ const?: import("json-schema").JSONSchema7Type | undefined;
32
+ multipleOf?: number | undefined;
33
+ maximum?: number | undefined;
34
+ exclusiveMaximum?: number | undefined;
35
+ minimum?: number | undefined;
36
+ exclusiveMinimum?: number | undefined;
37
+ maxLength?: number | undefined;
38
+ minLength?: number | undefined;
39
+ pattern?: string | undefined;
40
+ items?: import("json-schema").JSONSchema7Definition | import("json-schema").JSONSchema7Definition[] | undefined;
41
+ additionalItems?: import("json-schema").JSONSchema7Definition | undefined;
42
+ maxItems?: number | undefined;
43
+ minItems?: number | undefined;
44
+ uniqueItems?: boolean | undefined;
45
+ contains?: import("json-schema").JSONSchema7Definition | undefined;
46
+ maxProperties?: number | undefined;
47
+ minProperties?: number | undefined;
48
+ patternProperties?: {
49
+ [key: string]: import("json-schema").JSONSchema7Definition;
50
+ } | undefined;
51
+ dependencies?: {
52
+ [key: string]: import("json-schema").JSONSchema7Definition | string[];
53
+ } | undefined;
54
+ propertyNames?: import("json-schema").JSONSchema7Definition | undefined;
55
+ if?: import("json-schema").JSONSchema7Definition | undefined;
56
+ then?: import("json-schema").JSONSchema7Definition | undefined;
57
+ else?: import("json-schema").JSONSchema7Definition | undefined;
58
+ allOf?: import("json-schema").JSONSchema7Definition[] | undefined;
59
+ anyOf?: import("json-schema").JSONSchema7Definition[] | undefined;
60
+ oneOf?: import("json-schema").JSONSchema7Definition[] | undefined;
61
+ not?: import("json-schema").JSONSchema7Definition | undefined;
62
+ format?: string | undefined;
63
+ contentMediaType?: string | undefined;
64
+ contentEncoding?: string | undefined;
65
+ title?: string | undefined;
66
+ description?: string | undefined;
67
+ default?: import("json-schema").JSONSchema7Type | undefined;
68
+ readOnly?: boolean | undefined;
69
+ writeOnly?: boolean | undefined;
70
+ examples?: import("json-schema").JSONSchema7Type | undefined;
71
+ };
72
+ //# sourceMappingURL=filterEditorSchemaByNodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterEditorSchemaByNodes.d.ts","sourceRoot":"","sources":["../../../src/ai/utils/filterEditorSchemaByNodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAIxE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,KAAA;;;;;gBAC5C,CAAC;;oBAEf,CAAC;qBAEZ,CAAC;;;;;;YAA+D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC5E"}
@@ -0,0 +1,43 @@
1
+ import { isObjectSchema } from './isObjectSchema.js';
2
+ export function filterEditorSchemaByNodes(schema, allowedNodes) {
3
+ const allowedTypes = new Set(allowedNodes);
4
+ const filteredDefinitions = {};
5
+ // First pass: collect definitions whose "type.enum" includes an allowed type
6
+ for (const [key, def] of Object.entries(schema.definitions)){
7
+ if (isObjectSchema(def)) {
8
+ const typeEnum = def.properties?.type?.enum;
9
+ if (typeEnum && typeEnum.some((t)=>allowedTypes.has(t))) {
10
+ filteredDefinitions[key] = JSON.parse(JSON.stringify(def)) // Deep copy to safely mutate
11
+ ;
12
+ }
13
+ }
14
+ }
15
+ // Helper to check if a $ref points to an allowed definition
16
+ const isAllowedRef = (ref)=>{
17
+ if (typeof ref !== 'string') return false;
18
+ const defName = ref.replace('#/definitions/', '');
19
+ return defName in filteredDefinitions;
20
+ };
21
+ // Second pass: update "children" in each definition to only include allowed refs
22
+ for (const def of Object.values(filteredDefinitions)){
23
+ if (isObjectSchema(def) && def.properties?.children?.items) {
24
+ const items = def.properties.children.items;
25
+ if (Array.isArray(items.anyOf)) {
26
+ // Filter anyOf to only allowed $refs
27
+ items.anyOf = items.anyOf.filter((entry)=>isAllowedRef(entry.$ref));
28
+ if (items.anyOf.length === 0) {
29
+ delete def.properties.children;
30
+ }
31
+ } else if (items.$ref && !isAllowedRef(items.$ref)) {
32
+ delete def.properties.children;
33
+ }
34
+ }
35
+ }
36
+ // Return the new schema with pruned definitions
37
+ return {
38
+ ...schema,
39
+ definitions: filteredDefinitions
40
+ };
41
+ }
42
+
43
+ //# sourceMappingURL=filterEditorSchemaByNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ai/utils/filterEditorSchemaByNodes.ts"],"sourcesContent":["import type { LexicalNodeSchema } from '../schemas/lexicalJsonSchema.js'\n\nimport { isObjectSchema } from './isObjectSchema.js'\n\nexport function filterEditorSchemaByNodes(schema: LexicalNodeSchema, allowedNodes) {\n const allowedTypes = new Set(allowedNodes)\n\n const filteredDefinitions = {}\n\n // First pass: collect definitions whose \"type.enum\" includes an allowed type\n for (const [key, def] of Object.entries(schema.definitions)) {\n if(isObjectSchema(def)) {\n const typeEnum = def.properties?.type?.enum\n if (typeEnum && typeEnum.some((t) => allowedTypes.has(t))) {\n filteredDefinitions[key] = JSON.parse(JSON.stringify(def)) // Deep copy to safely mutate\n }\n }\n }\n\n // Helper to check if a $ref points to an allowed definition\n const isAllowedRef = (ref) => {\n if (typeof ref !== 'string') return false\n const defName = ref.replace('#/definitions/', '')\n return defName in filteredDefinitions\n }\n\n // Second pass: update \"children\" in each definition to only include allowed refs\n for (const def of Object.values(filteredDefinitions)) {\n if (isObjectSchema(def) && def.properties?.children?.items) {\n const items = def.properties.children.items\n\n if (Array.isArray(items.anyOf)) {\n // Filter anyOf to only allowed $refs\n items.anyOf = items.anyOf.filter((entry) => isAllowedRef(entry.$ref))\n if (items.anyOf.length === 0) {\n delete def.properties.children\n }\n } else if (items.$ref && !isAllowedRef(items.$ref)) {\n delete def.properties.children\n }\n }\n }\n\n // Return the new schema with pruned definitions\n return {\n ...schema,\n definitions: filteredDefinitions,\n }\n}\n"],"names":["isObjectSchema","filterEditorSchemaByNodes","schema","allowedNodes","allowedTypes","Set","filteredDefinitions","key","def","Object","entries","definitions","typeEnum","properties","type","enum","some","t","has","JSON","parse","stringify","isAllowedRef","ref","defName","replace","values","children","items","Array","isArray","anyOf","filter","entry","$ref","length"],"mappings":"AAEA,SAASA,cAAc,QAAQ,sBAAqB;AAEpD,OAAO,SAASC,0BAA0BC,MAAyB,EAAEC,YAAY;IAC/E,MAAMC,eAAe,IAAIC,IAAIF;IAE7B,MAAMG,sBAAsB,CAAC;IAE7B,6EAA6E;IAC7E,KAAK,MAAM,CAACC,KAAKC,IAAI,IAAIC,OAAOC,OAAO,CAACR,OAAOS,WAAW,EAAG;QAC3D,IAAGX,eAAeQ,MAAM;YACtB,MAAMI,WAAWJ,IAAIK,UAAU,EAAEC,MAAMC;YACvC,IAAIH,YAAYA,SAASI,IAAI,CAAC,CAACC,IAAMb,aAAac,GAAG,CAACD,KAAK;gBACzDX,mBAAmB,CAACC,IAAI,GAAGY,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACb,MAAM,6BAA6B;;YAC1F;QACF;IACF;IAEA,4DAA4D;IAC5D,MAAMc,eAAe,CAACC;QACpB,IAAI,OAAOA,QAAQ,UAAU,OAAO;QACpC,MAAMC,UAAUD,IAAIE,OAAO,CAAC,kBAAkB;QAC9C,OAAOD,WAAWlB;IACpB;IAEA,iFAAiF;IACjF,KAAK,MAAME,OAAOC,OAAOiB,MAAM,CAACpB,qBAAsB;QACpD,IAAIN,eAAeQ,QAAQA,IAAIK,UAAU,EAAEc,UAAUC,OAAO;YAC1D,MAAMA,QAAQpB,IAAIK,UAAU,CAACc,QAAQ,CAACC,KAAK;YAE3C,IAAIC,MAAMC,OAAO,CAACF,MAAMG,KAAK,GAAG;gBAC9B,qCAAqC;gBACrCH,MAAMG,KAAK,GAAGH,MAAMG,KAAK,CAACC,MAAM,CAAC,CAACC,QAAUX,aAAaW,MAAMC,IAAI;gBACnE,IAAIN,MAAMG,KAAK,CAACI,MAAM,KAAK,GAAG;oBAC5B,OAAO3B,IAAIK,UAAU,CAACc,QAAQ;gBAChC;YACF,OAAO,IAAIC,MAAMM,IAAI,IAAI,CAACZ,aAAaM,MAAMM,IAAI,GAAG;gBAClD,OAAO1B,IAAIK,UAAU,CAACc,QAAQ;YAChC;QACF;IACF;IAEA,gDAAgD;IAChD,OAAO;QACL,GAAGzB,MAAM;QACTS,aAAaL;IACf;AACF"}
@@ -0,0 +1,3 @@
1
+ import type { LexicalNodeSchema } from '../schemas/lexicalJsonSchema.js';
2
+ export declare function isObjectSchema(schema: unknown): schema is LexicalNodeSchema;
3
+ //# sourceMappingURL=isObjectSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isObjectSchema.d.ts","sourceRoot":"","sources":["../../../src/ai/utils/isObjectSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAExE,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,iBAAiB,CAE3E"}
@@ -0,0 +1,5 @@
1
+ export function isObjectSchema(schema) {
2
+ return typeof schema === 'object' && schema !== null && !Array.isArray(schema);
3
+ }
4
+
5
+ //# sourceMappingURL=isObjectSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ai/utils/isObjectSchema.ts"],"sourcesContent":["import type { LexicalNodeSchema } from '../schemas/lexicalJsonSchema.js'\n\nexport function isObjectSchema(schema: unknown): schema is LexicalNodeSchema {\n return typeof schema === 'object' && schema !== null && !Array.isArray(schema)\n}\n"],"names":["isObjectSchema","schema","Array","isArray"],"mappings":"AAEA,OAAO,SAASA,eAAeC,MAAe;IAC5C,OAAO,OAAOA,WAAW,YAAYA,WAAW,QAAQ,CAACC,MAAMC,OAAO,CAACF;AACzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Instructions.d.ts","sourceRoot":"","sources":["../../src/collections/Instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAiChD,eAAO,MAAM,sBAAsB,GACjC,cAAc,YAAY,EAC1B,UAAU,OAAO,CAAC,gBAAgB,CAAC,KAElC,gBAuKA,CAAA"}
1
+ {"version":3,"file":"Instructions.d.ts","sourceRoot":"","sources":["../../src/collections/Instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAiChD,eAAO,MAAM,sBAAsB,GACjC,cAAc,YAAY,EAC1B,UAAU,OAAO,CAAC,gBAAgB,CAAC,KAElC,gBA8LA,CAAA"}
@@ -1,5 +1,5 @@
1
- import { getGenerationModels } from '../utilities/getGenerationModels.js';
2
1
  import { PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js';
2
+ import { getGenerationModels } from '../utilities/getGenerationModels.js';
3
3
  const groupSettings = (pluginConfig)=>getGenerationModels(pluginConfig).reduce((fields, model)=>{
4
4
  if (model.settings) {
5
5
  fields.push(model.settings);
@@ -106,9 +106,7 @@ export const instructionsCollection = (pluginConfig, options)=>({
106
106
  type: 'tabs',
107
107
  tabs: [
108
108
  {
109
- // TODO: Add some info about the field to guide user
110
- // TODO: Add some info about the field to guide user
111
- description: 'The Prompt field allows you to define dynamic templates using placeholders (e.g., {{ fieldName }}) to customize output based on your data fields.',
109
+ description: 'Define dynamic templates using {{ fieldName }}. Type { to see available field suggestions.',
112
110
  fields: [
113
111
  {
114
112
  name: 'prompt',
@@ -125,16 +123,41 @@ export const instructionsCollection = (pluginConfig, options)=>({
125
123
  label: 'Prompt'
126
124
  },
127
125
  {
126
+ admin: {
127
+ condition: (_, current)=>{
128
+ return current['field-type'] === 'upload' && current['model-id'] === 'gpt-image-1';
129
+ }
130
+ },
131
+ description: 'These images will be used to generate new visuals in a similar style, layout, or content. You can combine multiple references for more controlled results.',
132
+ fields: [
133
+ {
134
+ name: 'images',
135
+ type: 'array',
136
+ fields: [
137
+ {
138
+ name: 'image',
139
+ type: 'upload',
140
+ admin: {
141
+ description: 'Please make sure the image is publicly accessible.'
142
+ },
143
+ relationTo: 'media'
144
+ }
145
+ ]
146
+ }
147
+ ],
148
+ label: 'Sample Images'
149
+ },
150
+ {
151
+ admin: {
152
+ condition: (_, current)=>{
153
+ return current['field-type'] === 'richText';
154
+ }
155
+ },
128
156
  description: '',
129
157
  fields: [
130
158
  {
131
159
  name: 'system',
132
160
  type: 'textarea',
133
- admin: {
134
- condition: (_, current)=>{
135
- return current['field-type'] === 'richText';
136
- }
137
- },
138
161
  defaultValue: `INSTRUCTIONS:
139
162
  You are a highly skilled and professional blog writer,
140
163
  renowned for crafting engaging and well-organized articles.
@@ -146,31 +169,22 @@ informative and accurate but also captivating and beautifully structured.`,
146
169
  label: 'System prompt'
147
170
  },
148
171
  {
149
- // Note: Update when tabs PR is merged: https://github.com/payloadcms/payload/pull/8406
150
- // admin: {
151
- // condition: (_, current) => {
152
- // console.log('condition in tab', current)
153
- // return current['field-type'] === 'richText'
154
- // },
155
- // },
156
- // Note: Update when tabs PR is merged: https://github.com/payloadcms/payload/pull/8406
157
- // admin: {
158
- // condition: (_, current) => {
159
- // console.log('condition in tab', current)
160
- // return current['field-type'] === 'richText'
161
- // },
162
- // },
172
+ admin: {
173
+ condition: (_, current)=>{
174
+ return current['field-type'] === 'richText';
175
+ }
176
+ },
163
177
  description: '',
164
178
  fields: [
165
179
  {
166
- /**TODO's:
180
+ /** TODO:
167
181
  * - Layouts can be saved in as an array
168
- * - user can add their own layout to collections and use it later for generate specific rich text
169
- * - user can select previously added layout
170
- */ /**TODO's:
182
+ * - User can add their own layout to collections and use it later for generate specific rich text
183
+ * - User can select previously added layout
184
+ */ /** TODO:
171
185
  * - Layouts can be saved in as an array
172
- * - user can add their own layout to collections and use it later for generate specific rich text
173
- * - user can select previously added layout
186
+ * - User can add their own layout to collections and use it later for generate specific rich text
187
+ * - User can select previously added layout
174
188
  */ name: 'layout',
175
189
  type: 'textarea',
176
190
  admin: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/Instructions.ts"],"sourcesContent":["import type { CollectionConfig, GroupField } from 'payload'\nimport type { PluginConfig } from 'src/types.js'\n\nimport { getGenerationModels } from '../utilities/getGenerationModels.js'\nimport { PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js'\n\nconst groupSettings = (pluginConfig: PluginConfig) =>\n getGenerationModels(pluginConfig).reduce((fields, model) => {\n if (model.settings) {\n fields.push(model.settings)\n }\n return fields\n }, [] as GroupField[])\n\nconst modelOptions = (pluginConfig: PluginConfig) =>\n getGenerationModels(pluginConfig).map((model) => {\n return {\n fields: model.fields,\n label: model.name,\n value: model.id,\n }\n })\n\nconst defaultAccessConfig = {\n create: () => true,\n read: () => true,\n update: () => true,\n}\n\nconst defaultAdminConfig = {\n group: 'Plugins',\n hidden: true,\n}\n\nexport const instructionsCollection = (\n pluginConfig: PluginConfig,\n options?: Partial<CollectionConfig>,\n) =>\n <CollectionConfig>{\n slug: PLUGIN_INSTRUCTIONS_TABLE,\n access: {\n ...defaultAccessConfig,\n ...options?.access,\n },\n admin: {\n ...defaultAdminConfig,\n ...options?.admin,\n group: 'Plugins',\n },\n fields: [\n {\n name: 'schema-path',\n type: 'text',\n admin: {\n description: \"Please don’t change this unless you're sure of what you're doing\",\n },\n unique: true,\n },\n {\n name: 'field-type',\n type: 'select',\n admin: {\n description: \"Please don’t change this unless you're sure of what you're doing\",\n },\n defaultValue: 'text',\n label: 'Field type',\n options: [\n {\n label: 'text',\n value: 'text',\n },\n {\n label: 'textarea',\n value: 'textarea',\n },\n {\n label: 'upload',\n value: 'upload',\n },\n {\n label: 'richText',\n value: 'richText',\n },\n ],\n },\n {\n name: 'relation-to',\n type: 'text',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'upload'\n },\n },\n label: 'Relation to',\n },\n {\n name: 'model-id',\n type: 'select',\n admin: {\n components: {\n Field: {\n clientProps: {\n filterByField: 'field-type',\n options: modelOptions(pluginConfig),\n },\n path: '@ai-stack/payloadcms/fields#SelectField',\n },\n },\n },\n label: 'Model',\n options: modelOptions(pluginConfig).map((option) => {\n return {\n label: option.label,\n value: option.value,\n }\n }),\n },\n {\n id: 'ai-prompts-tabs',\n type: 'tabs',\n tabs: [\n {\n // TODO: Add some info about the field to guide user\n description:\n 'The Prompt field allows you to define dynamic templates using placeholders (e.g., {{ fieldName }}) to customize output based on your data fields.',\n fields: [\n {\n name: 'prompt',\n type: 'textarea',\n admin: {\n components: {\n Field: '@ai-stack/payloadcms/fields#PromptEditorField',\n },\n description: \"Click 'Compose' to run this custom prompt and generate content\",\n },\n label: '',\n },\n ],\n label: 'Prompt',\n },\n {\n description: '',\n fields: [\n {\n name: 'system',\n type: 'textarea',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'richText'\n },\n },\n defaultValue: `INSTRUCTIONS:\nYou are a highly skilled and professional blog writer,\nrenowned for crafting engaging and well-organized articles.\nWhen given a title, you meticulously create blogs that are not only\ninformative and accurate but also captivating and beautifully structured.`,\n label: '',\n },\n ],\n label: 'System prompt',\n },\n {\n // Note: Update when tabs PR is merged: https://github.com/payloadcms/payload/pull/8406\n // admin: {\n // condition: (_, current) => {\n // console.log('condition in tab', current)\n // return current['field-type'] === 'richText'\n // },\n // },\n description: '',\n fields: [\n {\n /**TODO's:\n * - Layouts can be saved in as an array\n * - user can add their own layout to collections and use it later for generate specific rich text\n * - user can select previously added layout\n */\n name: 'layout',\n type: 'textarea',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'richText'\n },\n },\n defaultValue: `[paragraph] - Write a concise introduction (2-3 sentences) that outlines the main topic.\n[horizontalrule] - Insert a horizontal rule to separate the introduction from the main content.\n[list] - Create a list with 3-5 items. Each list item should contain:\n a. [heading] - A brief, descriptive heading (up to 5 words)\n b. [paragraph] - A short explanation or elaboration (1-2 sentences)\n[horizontalrule] - Insert another horizontal rule to separate the main content from the conclusion.\n[paragraph] - Compose a brief conclusion (2-3 sentences) summarizing the key points.\n[quote] - Include a relevant quote from a famous person, directly related to the topic. Format: \"Quote text.\" - Author Name`,\n label: '',\n },\n ],\n label: 'Layout',\n },\n ],\n },\n ...groupSettings(pluginConfig),\n ],\n labels: {\n plural: 'Compose Settings',\n singular: 'Compose Setting',\n },\n }\n"],"names":["getGenerationModels","PLUGIN_INSTRUCTIONS_TABLE","groupSettings","pluginConfig","reduce","fields","model","settings","push","modelOptions","map","label","name","value","id","defaultAccessConfig","create","read","update","defaultAdminConfig","group","hidden","instructionsCollection","options","slug","access","admin","type","description","unique","defaultValue","condition","_","current","components","Field","clientProps","filterByField","path","option","tabs","labels","plural","singular"],"mappings":"AAGA,SAASA,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,yBAAyB,QAAQ,iBAAgB;AAE1D,MAAMC,gBAAgB,CAACC,eACrBH,oBAAoBG,cAAcC,MAAM,CAAC,CAACC,QAAQC;QAChD,IAAIA,MAAMC,QAAQ,EAAE;YAClBF,OAAOG,IAAI,CAACF,MAAMC,QAAQ;QAC5B;QACA,OAAOF;IACT,GAAG,EAAE;AAEP,MAAMI,eAAe,CAACN,eACpBH,oBAAoBG,cAAcO,GAAG,CAAC,CAACJ;QACrC,OAAO;YACLD,QAAQC,MAAMD,MAAM;YACpBM,OAAOL,MAAMM,IAAI;YACjBC,OAAOP,MAAMQ,EAAE;QACjB;IACF;AAEF,MAAMC,sBAAsB;IAC1BC,QAAQ,IAAM;IACdC,MAAM,IAAM;IACZC,QAAQ,IAAM;AAChB;AAEA,MAAMC,qBAAqB;IACzBC,OAAO;IACPC,QAAQ;AACV;AAEA,OAAO,MAAMC,yBAAyB,CACpCnB,cACAoB,UAEkB,CAAA;QAChBC,MAAMvB;QACNwB,QAAQ;YACN,GAAGV,mBAAmB;YACtB,GAAGQ,SAASE,MAAM;QACpB;QACAC,OAAO;YACL,GAAGP,kBAAkB;YACrB,GAAGI,SAASG,KAAK;YACjBN,OAAO;QACT;QACAf,QAAQ;YACN;gBACEO,MAAM;gBACNe,MAAM;gBACND,OAAO;oBACLE,aAAa;gBACf;gBACAC,QAAQ;YACV;YACA;gBACEjB,MAAM;gBACNe,MAAM;gBACND,OAAO;oBACLE,aAAa;gBACf;gBACAE,cAAc;gBACdnB,OAAO;gBACPY,SAAS;oBACP;wBACEZ,OAAO;wBACPE,OAAO;oBACT;oBACA;wBACEF,OAAO;wBACPE,OAAO;oBACT;oBACA;wBACEF,OAAO;wBACPE,OAAO;oBACT;oBACA;wBACEF,OAAO;wBACPE,OAAO;oBACT;iBACD;YACH;YACA;gBACED,MAAM;gBACNe,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,OAAO;oCACLK,WAAW,CAACC,GAAGC;wCACb,OAAOA,OAAO,CAAC,aAAa,KAAK;oCACnC;gCACF;gCACAH,cAAc,CAAC;;;;;;;2HAO4F,CAAC;gCAC5GnB,OAAO;4BACT;yBACD;wBACDA,OAAO;oBACT;iBACD;YACH;eACGT,cAAcC;SAClB;QACDsC,QAAQ;YACNC,QAAQ;YACRC,UAAU;QACZ;IACF,CAAA,EAAC"}
1
+ {"version":3,"sources":["../../src/collections/Instructions.ts"],"sourcesContent":["import type { CollectionConfig, GroupField } from 'payload'\nimport type { PluginConfig } from 'src/types.js'\n\nimport { PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js'\nimport { getGenerationModels } from '../utilities/getGenerationModels.js'\n\nconst groupSettings = (pluginConfig: PluginConfig) =>\n getGenerationModels(pluginConfig).reduce((fields, model) => {\n if (model.settings) {\n fields.push(model.settings)\n }\n return fields\n }, [] as GroupField[])\n\nconst modelOptions = (pluginConfig: PluginConfig) =>\n getGenerationModels(pluginConfig).map((model) => {\n return {\n fields: model.fields,\n label: model.name,\n value: model.id,\n }\n })\n\nconst defaultAccessConfig = {\n create: () => true,\n read: () => true,\n update: () => true,\n}\n\nconst defaultAdminConfig = {\n group: 'Plugins',\n hidden: true,\n}\n\nexport const instructionsCollection = (\n pluginConfig: PluginConfig,\n options?: Partial<CollectionConfig>,\n) =>\n <CollectionConfig>{\n slug: PLUGIN_INSTRUCTIONS_TABLE,\n access: {\n ...defaultAccessConfig,\n ...options?.access,\n },\n admin: {\n ...defaultAdminConfig,\n ...options?.admin,\n group: 'Plugins',\n },\n fields: [\n {\n name: 'schema-path',\n type: 'text',\n admin: {\n description: \"Please don’t change this unless you're sure of what you're doing\",\n },\n unique: true,\n },\n {\n name: 'field-type',\n type: 'select',\n admin: {\n description: \"Please don’t change this unless you're sure of what you're doing\",\n },\n defaultValue: 'text',\n label: 'Field type',\n options: [\n {\n label: 'text',\n value: 'text',\n },\n {\n label: 'textarea',\n value: 'textarea',\n },\n {\n label: 'upload',\n value: 'upload',\n },\n {\n label: 'richText',\n value: 'richText',\n },\n ],\n },\n {\n name: 'relation-to',\n type: 'text',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'upload'\n },\n },\n label: 'Relation to',\n },\n {\n name: 'model-id',\n type: 'select',\n admin: {\n components: {\n Field: {\n clientProps: {\n filterByField: 'field-type',\n options: modelOptions(pluginConfig),\n },\n path: '@ai-stack/payloadcms/fields#SelectField',\n },\n },\n },\n label: 'Model',\n options: modelOptions(pluginConfig).map((option) => {\n return {\n label: option.label,\n value: option.value,\n }\n }),\n },\n {\n id: 'ai-prompts-tabs',\n type: 'tabs',\n tabs: [\n {\n description:\n 'Define dynamic templates using {{ fieldName }}. Type { to see available field suggestions.',\n fields: [\n {\n name: 'prompt',\n type: 'textarea',\n admin: {\n components: {\n Field: '@ai-stack/payloadcms/fields#PromptEditorField',\n },\n description: \"Click 'Compose' to run this custom prompt and generate content\",\n },\n label: '',\n },\n ],\n label: 'Prompt',\n },\n {\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'upload' && current['model-id'] === 'gpt-image-1'\n },\n },\n description:\n 'These images will be used to generate new visuals in a similar style, layout, or content. You can combine multiple references for more controlled results.',\n fields: [\n {\n name: 'images',\n type: 'array',\n fields: [\n {\n name: 'image',\n type: 'upload',\n admin: {\n description: 'Please make sure the image is publicly accessible.',\n },\n relationTo: 'media',\n },\n ],\n },\n ],\n label: 'Sample Images',\n },\n {\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'richText'\n },\n },\n description: '',\n fields: [\n {\n name: 'system',\n type: 'textarea',\n defaultValue: `INSTRUCTIONS:\nYou are a highly skilled and professional blog writer,\nrenowned for crafting engaging and well-organized articles.\nWhen given a title, you meticulously create blogs that are not only\ninformative and accurate but also captivating and beautifully structured.`,\n label: '',\n },\n ],\n label: 'System prompt',\n },\n {\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'richText'\n },\n },\n description: '',\n fields: [\n {\n /** TODO:\n * - Layouts can be saved in as an array\n * - User can add their own layout to collections and use it later for generate specific rich text\n * - User can select previously added layout\n */\n name: 'layout',\n type: 'textarea',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'richText'\n },\n },\n defaultValue: `[paragraph] - Write a concise introduction (2-3 sentences) that outlines the main topic.\n[horizontalrule] - Insert a horizontal rule to separate the introduction from the main content.\n[list] - Create a list with 3-5 items. Each list item should contain:\n a. [heading] - A brief, descriptive heading (up to 5 words)\n b. [paragraph] - A short explanation or elaboration (1-2 sentences)\n[horizontalrule] - Insert another horizontal rule to separate the main content from the conclusion.\n[paragraph] - Compose a brief conclusion (2-3 sentences) summarizing the key points.\n[quote] - Include a relevant quote from a famous person, directly related to the topic. Format: \"Quote text.\" - Author Name`,\n label: '',\n },\n ],\n label: 'Layout',\n },\n ],\n },\n ...groupSettings(pluginConfig),\n ],\n labels: {\n plural: 'Compose Settings',\n singular: 'Compose Setting',\n },\n }\n"],"names":["PLUGIN_INSTRUCTIONS_TABLE","getGenerationModels","groupSettings","pluginConfig","reduce","fields","model","settings","push","modelOptions","map","label","name","value","id","defaultAccessConfig","create","read","update","defaultAdminConfig","group","hidden","instructionsCollection","options","slug","access","admin","type","description","unique","defaultValue","condition","_","current","components","Field","clientProps","filterByField","path","option","tabs","relationTo","labels","plural","singular"],"mappings":"AAGA,SAASA,yBAAyB,QAAQ,iBAAgB;AAC1D,SAASC,mBAAmB,QAAQ,sCAAqC;AAEzE,MAAMC,gBAAgB,CAACC,eACrBF,oBAAoBE,cAAcC,MAAM,CAAC,CAACC,QAAQC;QAChD,IAAIA,MAAMC,QAAQ,EAAE;YAClBF,OAAOG,IAAI,CAACF,MAAMC,QAAQ;QAC5B;QACA,OAAOF;IACT,GAAG,EAAE;AAEP,MAAMI,eAAe,CAACN,eACpBF,oBAAoBE,cAAcO,GAAG,CAAC,CAACJ;QACrC,OAAO;YACLD,QAAQC,MAAMD,MAAM;YACpBM,OAAOL,MAAMM,IAAI;YACjBC,OAAOP,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6,5 @@ export declare const PLUGIN_API_ENDPOINT_GENERATE = "/plugin-ai/generate";
6
6
  export declare const PLUGIN_API_ENDPOINT_GENERATE_UPLOAD = "/plugin-ai/generate/upload";
7
7
  export declare const PLUGIN_FETCH_FIELDS_ENDPOINT = "/plugin-ai/fetch-fields";
8
8
  export declare const PLUGIN_DEFAULT_OPENAI_MODEL = "gpt-4o-mini";
9
- export declare const PLUGIN_DEFAULT_ANTHROPIC_MODEL = "claude-3-sonnet-20240229";
9
+ export declare const PLUGIN_DEFAULT_ANTHROPIC_MODEL = "claude-3-5-sonnet-latest";
10
10
  //# sourceMappingURL=defaults.d.ts.map
package/dist/defaults.js CHANGED
@@ -8,6 +8,6 @@ export const PLUGIN_API_ENDPOINT_GENERATE_UPLOAD = `${PLUGIN_API_ENDPOINT_GENERA
8
8
  export const PLUGIN_FETCH_FIELDS_ENDPOINT = `${PLUGIN_API_ENDPOINT_BASE}/fetch-fields`;
9
9
  // LLM Settings
10
10
  export const PLUGIN_DEFAULT_OPENAI_MODEL = `gpt-4o-mini`;
11
- export const PLUGIN_DEFAULT_ANTHROPIC_MODEL = `claude-3-sonnet-20240229`;
11
+ export const PLUGIN_DEFAULT_ANTHROPIC_MODEL = `claude-3-5-sonnet-latest`;
12
12
 
13
13
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.ts"],"sourcesContent":["export const PLUGIN_NAME = 'plugin-ai'\nexport const PLUGIN_INSTRUCTIONS_TABLE = `${PLUGIN_NAME}-instructions`\nexport const PLUGIN_LEXICAL_EDITOR_FEATURE = `${PLUGIN_NAME}-actions-feature`\n\n// Endpoint defaults\nexport const PLUGIN_API_ENDPOINT_BASE = `/${PLUGIN_NAME}`\nexport const PLUGIN_API_ENDPOINT_GENERATE = `${PLUGIN_API_ENDPOINT_BASE}/generate`\nexport const PLUGIN_API_ENDPOINT_GENERATE_UPLOAD = `${PLUGIN_API_ENDPOINT_GENERATE}/upload`\nexport const PLUGIN_FETCH_FIELDS_ENDPOINT = `${PLUGIN_API_ENDPOINT_BASE}/fetch-fields`\n\n// LLM Settings\nexport const PLUGIN_DEFAULT_OPENAI_MODEL = `gpt-4o-mini`\nexport const PLUGIN_DEFAULT_ANTHROPIC_MODEL = `claude-3-sonnet-20240229`\n"],"names":["PLUGIN_NAME","PLUGIN_INSTRUCTIONS_TABLE","PLUGIN_LEXICAL_EDITOR_FEATURE","PLUGIN_API_ENDPOINT_BASE","PLUGIN_API_ENDPOINT_GENERATE","PLUGIN_API_ENDPOINT_GENERATE_UPLOAD","PLUGIN_FETCH_FIELDS_ENDPOINT","PLUGIN_DEFAULT_OPENAI_MODEL","PLUGIN_DEFAULT_ANTHROPIC_MODEL"],"mappings":"AAAA,OAAO,MAAMA,cAAc,YAAW;AACtC,OAAO,MAAMC,4BAA4B,GAAGD,YAAY,aAAa,CAAC,CAAA;AACtE,OAAO,MAAME,gCAAgC,GAAGF,YAAY,gBAAgB,CAAC,CAAA;AAE7E,oBAAoB;AACpB,OAAO,MAAMG,2BAA2B,CAAC,CAAC,EAAEH,aAAa,CAAA;AACzD,OAAO,MAAMI,+BAA+B,GAAGD,yBAAyB,SAAS,CAAC,CAAA;AAClF,OAAO,MAAME,sCAAsC,GAAGD,6BAA6B,OAAO,CAAC,CAAA;AAC3F,OAAO,MAAME,+BAA+B,GAAGH,yBAAyB,aAAa,CAAC,CAAA;AAEtF,eAAe;AACf,OAAO,MAAMI,8BAA8B,CAAC,WAAW,CAAC,CAAA;AACxD,OAAO,MAAMC,iCAAiC,CAAC,wBAAwB,CAAC,CAAA"}
1
+ {"version":3,"sources":["../src/defaults.ts"],"sourcesContent":["export const PLUGIN_NAME = 'plugin-ai'\nexport const PLUGIN_INSTRUCTIONS_TABLE = `${PLUGIN_NAME}-instructions`\nexport const PLUGIN_LEXICAL_EDITOR_FEATURE = `${PLUGIN_NAME}-actions-feature`\n\n// Endpoint defaults\nexport const PLUGIN_API_ENDPOINT_BASE = `/${PLUGIN_NAME}`\nexport const PLUGIN_API_ENDPOINT_GENERATE = `${PLUGIN_API_ENDPOINT_BASE}/generate`\nexport const PLUGIN_API_ENDPOINT_GENERATE_UPLOAD = `${PLUGIN_API_ENDPOINT_GENERATE}/upload`\nexport const PLUGIN_FETCH_FIELDS_ENDPOINT = `${PLUGIN_API_ENDPOINT_BASE}/fetch-fields`\n\n// LLM Settings\nexport const PLUGIN_DEFAULT_OPENAI_MODEL = `gpt-4o-mini`\nexport const PLUGIN_DEFAULT_ANTHROPIC_MODEL = `claude-3-5-sonnet-latest`\n"],"names":["PLUGIN_NAME","PLUGIN_INSTRUCTIONS_TABLE","PLUGIN_LEXICAL_EDITOR_FEATURE","PLUGIN_API_ENDPOINT_BASE","PLUGIN_API_ENDPOINT_GENERATE","PLUGIN_API_ENDPOINT_GENERATE_UPLOAD","PLUGIN_FETCH_FIELDS_ENDPOINT","PLUGIN_DEFAULT_OPENAI_MODEL","PLUGIN_DEFAULT_ANTHROPIC_MODEL"],"mappings":"AAAA,OAAO,MAAMA,cAAc,YAAW;AACtC,OAAO,MAAMC,4BAA4B,GAAGD,YAAY,aAAa,CAAC,CAAA;AACtE,OAAO,MAAME,gCAAgC,GAAGF,YAAY,gBAAgB,CAAC,CAAA;AAE7E,oBAAoB;AACpB,OAAO,MAAMG,2BAA2B,CAAC,CAAC,EAAEH,aAAa,CAAA;AACzD,OAAO,MAAMI,+BAA+B,GAAGD,yBAAyB,SAAS,CAAC,CAAA;AAClF,OAAO,MAAME,sCAAsC,GAAGD,6BAA6B,OAAO,CAAC,CAAA;AAC3F,OAAO,MAAME,+BAA+B,GAAGH,yBAAyB,aAAa,CAAC,CAAA;AAEtF,eAAe;AACf,OAAO,MAAMI,8BAA8B,CAAC,WAAW,CAAC,CAAA;AACxD,OAAO,MAAMC,iCAAiC,CAAC,wBAAwB,CAAC,CAAA"}
@@ -1,3 +1,4 @@
1
1
  import type { Endpoint } from 'payload';
2
- export declare const fetchFields: Endpoint;
2
+ import type { PluginConfigAccess } from '../types.js';
3
+ export declare const fetchFields: (access: PluginConfigAccess) => Endpoint;
3
4
  //# sourceMappingURL=fetchFields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchFields.d.ts","sourceRoot":"","sources":["../../src/endpoints/fetchFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAA;AAIvD,eAAO,MAAM,WAAW,EAAE,QAmBzB,CAAA"}
1
+ {"version":3,"file":"fetchFields.d.ts","sourceRoot":"","sources":["../../src/endpoints/fetchFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAA;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIrD,eAAO,MAAM,WAAW,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,QAkCzD,CAAA"}
@@ -1,21 +1,37 @@
1
1
  import { PLUGIN_FETCH_FIELDS_ENDPOINT, PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js';
2
- export const fetchFields = {
3
- handler: async (req)=>{
4
- const { docs = [] } = await req.payload.find({
5
- collection: PLUGIN_INSTRUCTIONS_TABLE,
6
- pagination: false
7
- });
8
- const fieldMap = {};
9
- docs.forEach((doc)=>{
10
- fieldMap[doc['schema-path']] = {
11
- id: doc.id,
12
- fieldType: doc['field-type']
13
- };
14
- });
15
- return Response.json(fieldMap);
16
- },
17
- method: 'get',
18
- path: PLUGIN_FETCH_FIELDS_ENDPOINT
2
+ export const fetchFields = (access)=>{
3
+ return {
4
+ handler: async (req)=>{
5
+ const { docs = [] } = await req.payload.find({
6
+ collection: PLUGIN_INSTRUCTIONS_TABLE,
7
+ pagination: false
8
+ });
9
+ let isConfigAllowed = true // Users allowed to update prompts by default
10
+ ;
11
+ if (access?.settings) {
12
+ try {
13
+ isConfigAllowed = await access.settings({
14
+ req
15
+ });
16
+ } catch (e) {
17
+ req.payload.logger.error('Please check your "access.settings" for request:', req);
18
+ }
19
+ }
20
+ const fieldMap = {};
21
+ docs.forEach((doc)=>{
22
+ fieldMap[doc['schema-path']] = {
23
+ id: doc.id,
24
+ fieldType: doc['field-type']
25
+ };
26
+ });
27
+ return Response.json({
28
+ fields: fieldMap,
29
+ isConfigAllowed
30
+ });
31
+ },
32
+ method: 'get',
33
+ path: PLUGIN_FETCH_FIELDS_ENDPOINT
34
+ };
19
35
  };
20
36
 
21
37
  //# sourceMappingURL=fetchFields.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/endpoints/fetchFields.ts"],"sourcesContent":["import type { Endpoint, PayloadRequest } from 'payload'\n\nimport { PLUGIN_FETCH_FIELDS_ENDPOINT, PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js'\n\nexport const fetchFields: Endpoint = {\n handler: async (req: PayloadRequest) => {\n const { docs = [] } = await req.payload.find({\n collection: PLUGIN_INSTRUCTIONS_TABLE,\n pagination: false,\n })\n\n const fieldMap = {}\n docs.forEach((doc) => {\n fieldMap[doc['schema-path']] = {\n id: doc.id,\n fieldType: doc['field-type'],\n }\n })\n\n return Response.json(fieldMap)\n },\n method: 'get',\n path: PLUGIN_FETCH_FIELDS_ENDPOINT,\n}\n"],"names":["PLUGIN_FETCH_FIELDS_ENDPOINT","PLUGIN_INSTRUCTIONS_TABLE","fetchFields","handler","req","docs","payload","find","collection","pagination","fieldMap","forEach","doc","id","fieldType","Response","json","method","path"],"mappings":"AAEA,SAASA,4BAA4B,EAAEC,yBAAyB,QAAQ,iBAAgB;AAExF,OAAO,MAAMC,cAAwB;IACnCC,SAAS,OAAOC;QACd,MAAM,EAAEC,OAAO,EAAE,EAAE,GAAG,MAAMD,IAAIE,OAAO,CAACC,IAAI,CAAC;YAC3CC,YAAYP;YACZQ,YAAY;QACd;QAEA,MAAMC,WAAW,CAAC;QAClBL,KAAKM,OAAO,CAAC,CAACC;YACZF,QAAQ,CAACE,GAAG,CAAC,cAAc,CAAC,GAAG;gBAC7BC,IAAID,IAAIC,EAAE;gBACVC,WAAWF,GAAG,CAAC,aAAa;YAC9B;QACF;QAEA,OAAOG,SAASC,IAAI,CAACN;IACvB;IACAO,QAAQ;IACRC,MAAMlB;AACR,EAAC"}
1
+ {"version":3,"sources":["../../src/endpoints/fetchFields.ts"],"sourcesContent":["import type { Endpoint, PayloadRequest } from 'payload'\n\nimport type { PluginConfigAccess } from '../types.js'\n\nimport { PLUGIN_FETCH_FIELDS_ENDPOINT, PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js'\n\nexport const fetchFields: (access: PluginConfigAccess) => Endpoint = (access) => {\n return {\n handler: async (req: PayloadRequest) => {\n const { docs = [] } = await req.payload.find({\n collection: PLUGIN_INSTRUCTIONS_TABLE,\n pagination: false,\n })\n\n let isConfigAllowed = true // Users allowed to update prompts by default\n\n if (access?.settings) {\n try {\n isConfigAllowed = await access.settings({ req })\n } catch (e) {\n req.payload.logger.error('Please check your \"access.settings\" for request:', req)\n }\n }\n\n const fieldMap = {}\n docs.forEach((doc) => {\n fieldMap[doc['schema-path']] = {\n id: doc.id,\n fieldType: doc['field-type'],\n }\n })\n\n return Response.json({\n fields: fieldMap,\n isConfigAllowed,\n })\n },\n method: 'get',\n path: PLUGIN_FETCH_FIELDS_ENDPOINT,\n }\n}\n"],"names":["PLUGIN_FETCH_FIELDS_ENDPOINT","PLUGIN_INSTRUCTIONS_TABLE","fetchFields","access","handler","req","docs","payload","find","collection","pagination","isConfigAllowed","settings","e","logger","error","fieldMap","forEach","doc","id","fieldType","Response","json","fields","method","path"],"mappings":"AAIA,SAASA,4BAA4B,EAAEC,yBAAyB,QAAQ,iBAAgB;AAExF,OAAO,MAAMC,cAAwD,CAACC;IACpE,OAAO;QACLC,SAAS,OAAOC;YACd,MAAM,EAAEC,OAAO,EAAE,EAAE,GAAG,MAAMD,IAAIE,OAAO,CAACC,IAAI,CAAC;gBAC3CC,YAAYR;gBACZS,YAAY;YACd;YAEA,IAAIC,kBAAkB,KAAK,6CAA6C;;YAExE,IAAIR,QAAQS,UAAU;gBACpB,IAAI;oBACFD,kBAAkB,MAAMR,OAAOS,QAAQ,CAAC;wBAAEP;oBAAI;gBAChD,EAAE,OAAOQ,GAAG;oBACVR,IAAIE,OAAO,CAACO,MAAM,CAACC,KAAK,CAAC,oDAAoDV;gBAC/E;YACF;YAEA,MAAMW,WAAW,CAAC;YAClBV,KAAKW,OAAO,CAAC,CAACC;gBACZF,QAAQ,CAACE,GAAG,CAAC,cAAc,CAAC,GAAG;oBAC7BC,IAAID,IAAIC,EAAE;oBACVC,WAAWF,GAAG,CAAC,aAAa;gBAC9B;YACF;YAEA,OAAOG,SAASC,IAAI,CAAC;gBACnBC,QAAQP;gBACRL;YACF;QACF;QACAa,QAAQ;QACRC,MAAMzB;IACR;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/endpoints/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAuE3E,eAAO,MAAM,SAAS,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,SA+HhC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/endpoints/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAyE3E,eAAO,MAAM,SAAS,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,SAmLhC,CAAA"}