@karixi/payload-ai 0.1.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.
@@ -0,0 +1,279 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-wcPFST8Q.mjs";
2
+ //#region src/core/field-analyzer.ts
3
+ function normalizeOptions(options) {
4
+ return options.map((opt) => {
5
+ if (typeof opt === "string") return {
6
+ label: opt,
7
+ value: opt
8
+ };
9
+ if (typeof opt === "object" && opt !== null && "value" in opt) {
10
+ const o = opt;
11
+ return {
12
+ label: typeof o.label === "string" ? o.label : typeof o.label === "object" && o.label !== null ? Object.values(o.label)[0] ?? String(o.value) : String(o.value),
13
+ value: String(o.value)
14
+ };
15
+ }
16
+ return {
17
+ label: String(opt),
18
+ value: String(opt)
19
+ };
20
+ });
21
+ }
22
+ function buildPath(parentPath, name) {
23
+ return parentPath ? `${parentPath}.${name}` : name;
24
+ }
25
+ function analyzeTabs(tabs, parentPath) {
26
+ const result = [];
27
+ for (const tab of tabs) {
28
+ const tabName = "name" in tab && typeof tab.name === "string" ? tab.name : void 0;
29
+ const tabPath = tabName ? buildPath(parentPath, tabName) : parentPath;
30
+ result.push(...analyzeFields(tab.fields, tabPath));
31
+ }
32
+ return result;
33
+ }
34
+ function isSelectField(field) {
35
+ return field.type === "select";
36
+ }
37
+ function isRadioField(field) {
38
+ return field.type === "radio";
39
+ }
40
+ function isRelationshipField(field) {
41
+ return field.type === "relationship";
42
+ }
43
+ function isUploadField(field) {
44
+ return field.type === "upload";
45
+ }
46
+ function isArrayField(field) {
47
+ return field.type === "array";
48
+ }
49
+ function isGroupField(field) {
50
+ return field.type === "group";
51
+ }
52
+ function isCollapsibleField(field) {
53
+ return field.type === "collapsible";
54
+ }
55
+ function isRowField(field) {
56
+ return field.type === "row";
57
+ }
58
+ function isBlocksField(field) {
59
+ return field.type === "blocks";
60
+ }
61
+ function isTabsField(field) {
62
+ return field.type === "tabs";
63
+ }
64
+ function isUIField(field) {
65
+ return field.type === "ui";
66
+ }
67
+ function isRichTextField(field) {
68
+ return field.type === "richText";
69
+ }
70
+ function detectLexicalFeatures(field) {
71
+ const features = [];
72
+ const editor = field.editor;
73
+ if (!editor || typeof editor !== "object") return features;
74
+ const editorObj = editor;
75
+ const editorConfig = editorObj.editorConfig ?? editorObj.lexicalConfig ?? editorObj;
76
+ if (typeof editorConfig === "object" && editorConfig !== null) {
77
+ const cfg = editorConfig;
78
+ const featureList = cfg.features ?? cfg.resolvedFeatures;
79
+ if (Array.isArray(featureList)) {
80
+ for (const f of featureList) if (f && typeof f === "object") {
81
+ const fObj = f;
82
+ const key = fObj.key ?? fObj.feature ?? fObj.name;
83
+ if (typeof key === "string") features.push(key);
84
+ }
85
+ }
86
+ }
87
+ return features;
88
+ }
89
+ function analyzeFields(fields, parentPath) {
90
+ const result = [];
91
+ for (const field of fields) {
92
+ if (isUIField(field)) continue;
93
+ if (isTabsField(field)) {
94
+ result.push(...analyzeTabs(field.tabs, parentPath));
95
+ continue;
96
+ }
97
+ if (isRowField(field) || isCollapsibleField(field)) {
98
+ result.push(...analyzeFields(field.fields, parentPath));
99
+ continue;
100
+ }
101
+ const namedField = field;
102
+ if (!("name" in namedField) || typeof namedField.name !== "string") continue;
103
+ const name = namedField.name;
104
+ const path = buildPath(parentPath, name);
105
+ const required = "required" in field && field.required === true;
106
+ if (isRelationshipField(field)) {
107
+ const schema = {
108
+ name,
109
+ type: "relationship",
110
+ required,
111
+ path,
112
+ relationTo: field.relationTo,
113
+ hasMany: field.hasMany === true
114
+ };
115
+ result.push(schema);
116
+ continue;
117
+ }
118
+ if (isUploadField(field)) {
119
+ result.push({
120
+ name,
121
+ type: "upload",
122
+ required,
123
+ path,
124
+ relationTo: field.relationTo,
125
+ hasMany: false
126
+ });
127
+ continue;
128
+ }
129
+ if (isSelectField(field)) {
130
+ result.push({
131
+ name,
132
+ type: "select",
133
+ required,
134
+ path,
135
+ options: normalizeOptions(field.options),
136
+ hasMany: field.hasMany === true
137
+ });
138
+ continue;
139
+ }
140
+ if (isRadioField(field)) {
141
+ result.push({
142
+ name,
143
+ type: "radio",
144
+ required,
145
+ path,
146
+ options: normalizeOptions(field.options)
147
+ });
148
+ continue;
149
+ }
150
+ if (isArrayField(field)) {
151
+ const subFields = analyzeFields(field.fields, path);
152
+ result.push({
153
+ name,
154
+ type: "array",
155
+ required,
156
+ path,
157
+ fields: subFields
158
+ });
159
+ continue;
160
+ }
161
+ if (isGroupField(field)) {
162
+ const subFields = analyzeFields(field.fields, path);
163
+ result.push({
164
+ name,
165
+ type: "group",
166
+ required,
167
+ path,
168
+ fields: subFields
169
+ });
170
+ continue;
171
+ }
172
+ if (isBlocksField(field)) {
173
+ const blocks = field.blocks.map((block) => ({
174
+ slug: block.slug,
175
+ fields: analyzeFields(block.fields, path)
176
+ }));
177
+ result.push({
178
+ name,
179
+ type: "blocks",
180
+ required,
181
+ path,
182
+ blocks
183
+ });
184
+ continue;
185
+ }
186
+ if (isRichTextField(field)) {
187
+ const lexicalFeatures = detectLexicalFeatures(field);
188
+ result.push({
189
+ name,
190
+ type: "richText",
191
+ required,
192
+ path,
193
+ ...lexicalFeatures.length > 0 ? { lexicalFeatures } : {}
194
+ });
195
+ continue;
196
+ }
197
+ result.push({
198
+ name,
199
+ type: field.type,
200
+ required,
201
+ path
202
+ });
203
+ }
204
+ return result;
205
+ }
206
+ //#endregion
207
+ //#region src/core/schema-reader.ts
208
+ var schema_reader_exports = /* @__PURE__ */ __exportAll({
209
+ readAllCollectionSchemas: () => readAllCollectionSchemas,
210
+ readCollectionSchema: () => readCollectionSchema
211
+ });
212
+ /** Collections that should not be auto-populated by default */
213
+ const NON_POPULATABLE_SLUGS = new Set([
214
+ "orders",
215
+ "carts",
216
+ "transactions"
217
+ ]);
218
+ function extractRelationships(fields, collectionSlug) {
219
+ const result = [];
220
+ for (const field of fields) {
221
+ if (field.type === "relationship" || field.type === "upload") {
222
+ if (field.relationTo !== void 0) {
223
+ const collections = Array.isArray(field.relationTo) ? field.relationTo : [field.relationTo];
224
+ for (const col of collections) result.push({
225
+ field: field.path,
226
+ collection: field.relationTo,
227
+ hasMany: field.hasMany === true,
228
+ isSelfReferential: col === collectionSlug
229
+ });
230
+ }
231
+ }
232
+ if (field.fields && field.fields.length > 0) result.push(...extractRelationships(field.fields, collectionSlug));
233
+ if (field.blocks) for (const block of field.blocks) result.push(...extractRelationships(block.fields, collectionSlug));
234
+ }
235
+ return result;
236
+ }
237
+ function collectRequiredPaths(fields) {
238
+ const required = [];
239
+ for (const field of fields) {
240
+ if (field.required) required.push(field.path);
241
+ if (field.fields) required.push(...collectRequiredPaths(field.fields));
242
+ if (field.blocks) for (const block of field.blocks) required.push(...collectRequiredPaths(block.fields));
243
+ }
244
+ return required;
245
+ }
246
+ function collectLexicalFeatures(fields) {
247
+ const features = [];
248
+ for (const field of fields) {
249
+ if (field.type === "richText" && field.lexicalFeatures) features.push(...field.lexicalFeatures);
250
+ if (field.fields) features.push(...collectLexicalFeatures(field.fields));
251
+ if (field.blocks) for (const block of field.blocks) features.push(...collectLexicalFeatures(block.fields));
252
+ }
253
+ return [...new Set(features)];
254
+ }
255
+ function readCollectionSchema(payload, slug, options) {
256
+ const collection = payload.collections[slug];
257
+ if (!collection) throw new Error(`Collection "${slug}" not found in payload.collections`);
258
+ const config = collection.config;
259
+ const fields = analyzeFields(config.fields);
260
+ const nonPopulatable = new Set([...NON_POPULATABLE_SLUGS, ...options?.nonPopulatableSlugs ?? []]);
261
+ const relationships = extractRelationships(fields, slug);
262
+ const requiredFields = collectRequiredPaths(fields);
263
+ const lexicalFeatures = collectLexicalFeatures(fields);
264
+ return {
265
+ slug,
266
+ fields,
267
+ relationships,
268
+ requiredFields,
269
+ populatable: !nonPopulatable.has(slug),
270
+ ...lexicalFeatures.length > 0 ? { lexicalFeatures } : {}
271
+ };
272
+ }
273
+ function readAllCollectionSchemas(payload, options) {
274
+ return Object.keys(payload.collections).map((slug) => readCollectionSchema(payload, slug, options));
275
+ }
276
+ //#endregion
277
+ export { readCollectionSchema as n, schema_reader_exports as r, readAllCollectionSchemas as t };
278
+
279
+ //# sourceMappingURL=schema-reader-ZkoI6Pwi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-reader-ZkoI6Pwi.mjs","names":[],"sources":["../src/core/field-analyzer.ts","../src/core/schema-reader.ts"],"sourcesContent":["import type {\n ArrayField,\n BlocksField,\n CollapsibleField,\n Field,\n GroupField,\n RadioField,\n RelationshipField,\n RichTextField,\n RowField,\n SelectField,\n Tab,\n TabsField,\n UIField,\n UploadField,\n} from 'payload'\nimport type { FieldSchema } from '../types.js'\n\nfunction normalizeOptions(options: readonly unknown[]): Array<{ label: string; value: string }> {\n return options.map((opt) => {\n if (typeof opt === 'string') {\n return { label: opt, value: opt }\n }\n if (typeof opt === 'object' && opt !== null && 'value' in opt) {\n const o = opt as { label?: unknown; value: unknown }\n const label =\n typeof o.label === 'string'\n ? o.label\n : typeof o.label === 'object' && o.label !== null\n ? (Object.values(o.label)[0] ?? String(o.value))\n : String(o.value)\n return { label, value: String(o.value) }\n }\n return { label: String(opt), value: String(opt) }\n })\n}\n\nfunction buildPath(parentPath: string | undefined, name: string): string {\n return parentPath ? `${parentPath}.${name}` : name\n}\n\nfunction analyzeTabs(tabs: Tab[], parentPath?: string): FieldSchema[] {\n const result: FieldSchema[] = []\n for (const tab of tabs) {\n // Named tabs create a named path segment; unnamed tabs are transparent\n const tabName = 'name' in tab && typeof tab.name === 'string' ? tab.name : undefined\n const tabPath = tabName ? buildPath(parentPath, tabName) : parentPath\n result.push(...analyzeFields(tab.fields, tabPath))\n }\n return result\n}\n\nfunction isSelectField(field: Field): field is SelectField {\n return field.type === 'select'\n}\n\nfunction isRadioField(field: Field): field is RadioField {\n return field.type === 'radio'\n}\n\nfunction isRelationshipField(field: Field): field is RelationshipField {\n return field.type === 'relationship'\n}\n\nfunction isUploadField(field: Field): field is UploadField {\n return field.type === 'upload'\n}\n\nfunction isArrayField(field: Field): field is ArrayField {\n return field.type === 'array'\n}\n\nfunction isGroupField(field: Field): field is GroupField {\n return field.type === 'group'\n}\n\nfunction isCollapsibleField(field: Field): field is CollapsibleField {\n return field.type === 'collapsible'\n}\n\nfunction isRowField(field: Field): field is RowField {\n return field.type === 'row'\n}\n\nfunction isBlocksField(field: Field): field is BlocksField {\n return field.type === 'blocks'\n}\n\nfunction isTabsField(field: Field): field is TabsField {\n return field.type === 'tabs'\n}\n\nfunction isUIField(field: Field): field is UIField {\n return field.type === 'ui'\n}\n\nfunction isRichTextField(field: Field): field is RichTextField {\n return field.type === 'richText'\n}\n\nfunction detectLexicalFeatures(field: RichTextField): string[] {\n const features: string[] = []\n const editor = field.editor\n if (!editor || typeof editor !== 'object') return features\n // Lexical editor config is often stored in editor.editorConfig or similar\n // We do a best-effort detection via known property names\n const editorObj = editor as Record<string, unknown>\n const editorConfig = editorObj.editorConfig ?? editorObj.lexicalConfig ?? editorObj\n if (typeof editorConfig === 'object' && editorConfig !== null) {\n const cfg = editorConfig as Record<string, unknown>\n const featureList = cfg.features ?? cfg.resolvedFeatures\n if (Array.isArray(featureList)) {\n for (const f of featureList) {\n if (f && typeof f === 'object') {\n const fObj = f as Record<string, unknown>\n const key = fObj.key ?? fObj.feature ?? fObj.name\n if (typeof key === 'string') features.push(key)\n }\n }\n }\n }\n return features\n}\n\nexport function analyzeFields(fields: Field[], parentPath?: string): FieldSchema[] {\n const result: FieldSchema[] = []\n\n for (const field of fields) {\n // Skip UI fields — they carry no data\n if (isUIField(field)) continue\n\n if (isTabsField(field)) {\n result.push(...analyzeTabs(field.tabs, parentPath))\n continue\n }\n\n if (isRowField(field) || isCollapsibleField(field)) {\n result.push(...analyzeFields(field.fields, parentPath))\n continue\n }\n\n // Fields from here need a name\n const namedField = field as Field & { name?: string }\n if (!('name' in namedField) || typeof namedField.name !== 'string') {\n // Unnamed group/collapsible already handled above; skip anything else unnamed\n continue\n }\n\n const name = namedField.name\n const path = buildPath(parentPath, name)\n const required = 'required' in field && field.required === true\n\n if (isRelationshipField(field)) {\n const _isSelfRef = false // computed in schema-reader at collection level\n const schema: FieldSchema = {\n name,\n type: 'relationship',\n required,\n path,\n relationTo: field.relationTo,\n hasMany: field.hasMany === true,\n }\n result.push(schema)\n continue\n }\n\n if (isUploadField(field)) {\n result.push({\n name,\n type: 'upload',\n required,\n path,\n relationTo: field.relationTo,\n hasMany: false,\n })\n continue\n }\n\n if (isSelectField(field)) {\n result.push({\n name,\n type: 'select',\n required,\n path,\n options: normalizeOptions(field.options),\n hasMany: field.hasMany === true,\n })\n continue\n }\n\n if (isRadioField(field)) {\n result.push({\n name,\n type: 'radio',\n required,\n path,\n options: normalizeOptions(field.options),\n })\n continue\n }\n\n if (isArrayField(field)) {\n const subFields = analyzeFields(field.fields, path)\n result.push({\n name,\n type: 'array',\n required,\n path,\n fields: subFields,\n })\n continue\n }\n\n if (isGroupField(field)) {\n // GroupField can be named or unnamed; we already checked name above\n const subFields = analyzeFields(field.fields as Field[], path)\n result.push({\n name,\n type: 'group',\n required,\n path,\n fields: subFields,\n })\n continue\n }\n\n if (isBlocksField(field)) {\n const blocks = field.blocks.map((block) => ({\n slug: block.slug,\n fields: analyzeFields(block.fields, path),\n }))\n result.push({\n name,\n type: 'blocks',\n required,\n path,\n blocks,\n })\n continue\n }\n\n if (isRichTextField(field)) {\n const lexicalFeatures = detectLexicalFeatures(field)\n result.push({\n name,\n type: 'richText',\n required,\n path,\n ...(lexicalFeatures.length > 0 ? { lexicalFeatures } : {}),\n })\n continue\n }\n\n // All remaining scalar field types\n result.push({\n name,\n type: field.type,\n required,\n path,\n })\n }\n\n return result\n}\n","import type { Payload } from 'payload'\nimport type { CollectionSchema, FieldSchema, RelationshipInfo } from '../types.js'\nimport { analyzeFields } from './field-analyzer.js'\n\n/** Collections that should not be auto-populated by default */\nconst NON_POPULATABLE_SLUGS = new Set(['orders', 'carts', 'transactions'])\n\nexport type SchemaReaderOptions = {\n /** Override which slugs are considered non-populatable */\n nonPopulatableSlugs?: string[]\n}\n\nfunction extractRelationships(fields: FieldSchema[], collectionSlug: string): RelationshipInfo[] {\n const result: RelationshipInfo[] = []\n\n for (const field of fields) {\n if (field.type === 'relationship' || field.type === 'upload') {\n if (field.relationTo !== undefined) {\n const collections = Array.isArray(field.relationTo) ? field.relationTo : [field.relationTo]\n\n for (const col of collections) {\n result.push({\n field: field.path,\n collection: field.relationTo,\n hasMany: field.hasMany === true,\n isSelfReferential: col === collectionSlug,\n })\n }\n }\n }\n\n // Recurse into nested fields\n if (field.fields && field.fields.length > 0) {\n result.push(...extractRelationships(field.fields, collectionSlug))\n }\n\n if (field.blocks) {\n for (const block of field.blocks) {\n result.push(...extractRelationships(block.fields, collectionSlug))\n }\n }\n }\n\n return result\n}\n\nfunction collectRequiredPaths(fields: FieldSchema[]): string[] {\n const required: string[] = []\n for (const field of fields) {\n if (field.required) required.push(field.path)\n if (field.fields) required.push(...collectRequiredPaths(field.fields))\n if (field.blocks) {\n for (const block of field.blocks) {\n required.push(...collectRequiredPaths(block.fields))\n }\n }\n }\n return required\n}\n\nfunction collectLexicalFeatures(fields: FieldSchema[]): string[] {\n const features: string[] = []\n for (const field of fields) {\n if (field.type === 'richText' && field.lexicalFeatures) {\n features.push(...field.lexicalFeatures)\n }\n if (field.fields) features.push(...collectLexicalFeatures(field.fields))\n if (field.blocks) {\n for (const block of field.blocks) {\n features.push(...collectLexicalFeatures(block.fields))\n }\n }\n }\n return [...new Set(features)]\n}\n\nexport function readCollectionSchema(\n payload: Payload,\n slug: string,\n options?: SchemaReaderOptions,\n): CollectionSchema {\n const collection = payload.collections[slug]\n if (!collection) {\n throw new Error(`Collection \"${slug}\" not found in payload.collections`)\n }\n\n const config = collection.config\n const fields = analyzeFields(config.fields)\n\n const nonPopulatable = new Set([\n ...NON_POPULATABLE_SLUGS,\n ...(options?.nonPopulatableSlugs ?? []),\n ])\n\n const relationships = extractRelationships(fields, slug)\n const requiredFields = collectRequiredPaths(fields)\n const lexicalFeatures = collectLexicalFeatures(fields)\n\n return {\n slug,\n fields,\n relationships,\n requiredFields,\n populatable: !nonPopulatable.has(slug),\n ...(lexicalFeatures.length > 0 ? { lexicalFeatures } : {}),\n }\n}\n\nexport function readAllCollectionSchemas(\n payload: Payload,\n options?: SchemaReaderOptions,\n): CollectionSchema[] {\n const slugs = Object.keys(payload.collections)\n return slugs.map((slug) => readCollectionSchema(payload, slug, options))\n}\n"],"mappings":";;AAkBA,SAAS,iBAAiB,SAAsE;AAC9F,QAAO,QAAQ,KAAK,QAAQ;AAC1B,MAAI,OAAO,QAAQ,SACjB,QAAO;GAAE,OAAO;GAAK,OAAO;GAAK;AAEnC,MAAI,OAAO,QAAQ,YAAY,QAAQ,QAAQ,WAAW,KAAK;GAC7D,MAAM,IAAI;AAOV,UAAO;IAAE,OALP,OAAO,EAAE,UAAU,WACf,EAAE,QACF,OAAO,EAAE,UAAU,YAAY,EAAE,UAAU,OACxC,OAAO,OAAO,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,MAAM,GAC7C,OAAO,EAAE,MAAM;IACP,OAAO,OAAO,EAAE,MAAM;IAAE;;AAE1C,SAAO;GAAE,OAAO,OAAO,IAAI;GAAE,OAAO,OAAO,IAAI;GAAE;GACjD;;AAGJ,SAAS,UAAU,YAAgC,MAAsB;AACvE,QAAO,aAAa,GAAG,WAAW,GAAG,SAAS;;AAGhD,SAAS,YAAY,MAAa,YAAoC;CACpE,MAAM,SAAwB,EAAE;AAChC,MAAK,MAAM,OAAO,MAAM;EAEtB,MAAM,UAAU,UAAU,OAAO,OAAO,IAAI,SAAS,WAAW,IAAI,OAAO,KAAA;EAC3E,MAAM,UAAU,UAAU,UAAU,YAAY,QAAQ,GAAG;AAC3D,SAAO,KAAK,GAAG,cAAc,IAAI,QAAQ,QAAQ,CAAC;;AAEpD,QAAO;;AAGT,SAAS,cAAc,OAAoC;AACzD,QAAO,MAAM,SAAS;;AAGxB,SAAS,aAAa,OAAmC;AACvD,QAAO,MAAM,SAAS;;AAGxB,S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
+ {
2
+ "name": "@karixi/payload-ai",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "main": "dist/index.mjs",
6
+ "types": "dist/index.d.mts",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "types": "./dist/index.d.mts",
11
+ "default": "./dist/index.mjs"
12
+ }
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "peerDependencies": {
19
+ "payload": "^3.81.0",
20
+ "@payloadcms/plugin-mcp": "^3.81.0"
21
+ },
22
+ "peerDependenciesMeta": {
23
+ "@anthropic-ai/stagehand": {
24
+ "optional": true
25
+ }
26
+ },
27
+ "dependencies": {
28
+ "zod": "^4.3.6"
29
+ },
30
+ "devDependencies": {
31
+ "@biomejs/biome": "^2.4.10",
32
+ "@payloadcms/plugin-mcp": "^3.81.0",
33
+ "@types/react": "^19.2.14",
34
+ "bumpp": "^11.0.1",
35
+ "payload": "^3.81.0",
36
+ "react": "^19.2.4",
37
+ "tsdown": "^0.21.7",
38
+ "typescript": "^6.0.2",
39
+ "vitest": "^4.1.2"
40
+ },
41
+ "scripts": {
42
+ "build": "tsdown",
43
+ "typecheck": "tsc --noEmit",
44
+ "prepublishOnly": "bun run build",
45
+ "release": "bumpp",
46
+ "test": "vitest run",
47
+ "lint": "biome check .",
48
+ "lint:fix": "biome check --write .",
49
+ "format": "biome format --write ."
50
+ }
51
+ }