@mvriu5/payload-ai 1.6.3 → 1.6.4
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.
- package/dist/components/action-toast/ActionToast.d.ts +1 -14
- package/dist/components/action-toast/ActionToast.js +1 -1
- package/dist/components/ai-input/AIInput.js +1 -1
- package/dist/components/audit-log-list/AuditLogList.d.ts +2 -3
- package/dist/components/diff-dialog/DiffDialog.d.ts +2 -6
- package/dist/components/diff-dialog/DiffDialog.js +1 -1
- package/dist/components/hooks/useAIChatStream.d.ts +1 -1
- package/dist/components/hooks/useAISettings.d.ts +1 -1
- package/dist/components/hooks/useAISettings.js +1 -1
- package/dist/components/hooks/useDocumentMentionSuggestions.js +1 -1
- package/dist/components/hooks/useMentions.js +1 -1
- package/dist/components/hooks/usePluginConfig.d.ts +6 -6
- package/dist/components/hooks/usePluginConfig.js +1 -1
- package/dist/{payload → features}/collectionPermissions.js +1 -1
- package/dist/{ai → features}/promptCaching.d.ts +2 -2
- package/dist/features/proposals/containerNormalization.d.ts +8 -0
- package/dist/features/proposals/containerNormalization.js +112 -0
- package/dist/{payload/proposalData.d.ts → features/proposals/data.d.ts} +5 -10
- package/dist/features/proposals/data.js +113 -0
- package/dist/features/proposals/fieldNormalization.d.ts +2 -0
- package/dist/features/proposals/fieldNormalization.js +69 -0
- package/dist/features/proposals/normalizationTypes.d.ts +31 -0
- package/dist/features/proposals/normalizationTypes.js +1 -0
- package/dist/features/proposals/optionInference.d.ts +13 -0
- package/dist/features/proposals/optionInference.js +46 -0
- package/dist/features/proposals/recordNormalization.d.ts +6 -0
- package/dist/features/proposals/recordNormalization.js +78 -0
- package/dist/features/proposals/relationshipNormalization.d.ts +8 -0
- package/dist/features/proposals/relationshipNormalization.js +71 -0
- package/dist/{ai/proposalRepair.d.ts → features/proposals/repair.d.ts} +1 -1
- package/dist/{ai/proposalSigning.d.ts → features/proposals/signing.d.ts} +2 -5
- package/dist/{ai/proposalSigning.js → features/proposals/signing.js} +1 -1
- package/dist/features/proposals/target.d.ts +52 -0
- package/dist/features/proposals/target.js +125 -0
- package/dist/features/proposals/types.d.ts +49 -0
- package/dist/features/proposals/types.js +1 -0
- package/dist/features/proposals/validation.d.ts +12 -0
- package/dist/features/proposals/validation.js +26 -0
- package/dist/features/providers/requestContext.d.ts +53 -0
- package/dist/features/providers/requestContext.js +90 -0
- package/dist/{ai/providerRuntime.d.ts → features/providers/runtime.d.ts} +1 -1
- package/dist/{ai/providerRuntime.js → features/providers/runtime.js} +1 -1
- package/dist/features/schema/context.d.ts +7 -0
- package/dist/features/schema/context.js +11 -0
- package/dist/{payload/schemaContext.d.ts → features/schema/description.d.ts} +6 -33
- package/dist/{payload/schemaContext.js → features/schema/description.js} +3 -207
- package/dist/{payload/toolFieldSelection.d.ts → features/schema/fieldSelection.d.ts} +1 -1
- package/dist/{payload/toolFieldSelection.js → features/schema/fieldSelection.js} +2 -2
- package/dist/features/schema/mentionDocuments.d.ts +15 -0
- package/dist/features/schema/mentionDocuments.js +50 -0
- package/dist/features/schema/mentions.d.ts +18 -0
- package/dist/features/schema/mentions.js +100 -0
- package/dist/{payload/normalizeData.js → features/schema/normalize.js} +1 -1
- package/dist/features/schema/registry.d.ts +30 -0
- package/dist/features/schema/registry.js +73 -0
- package/dist/{payload → features/schema}/toolSchemas.d.ts +1 -1
- package/dist/{payload → features/schema}/toolSchemas.js +1 -1
- package/dist/{ai → features}/sensitiveData.js +1 -1
- package/dist/{ai → features}/tokenUsage.d.ts +1 -2
- package/dist/handlers/apply/audit.d.ts +42 -0
- package/dist/handlers/apply/audit.js +150 -0
- package/dist/handlers/apply/operations.d.ts +18 -0
- package/dist/handlers/apply/operations.js +377 -0
- package/dist/handlers/apply/types.d.ts +33 -0
- package/dist/handlers/apply/types.js +1 -0
- package/dist/handlers/apply/validation.d.ts +45 -0
- package/dist/handlers/apply/validation.js +125 -0
- package/dist/handlers/applyActionHandler.d.ts +1 -6
- package/dist/handlers/applyActionHandler.js +13 -757
- package/dist/handlers/auditLogHandler.js +4 -8
- package/dist/handlers/chat/intent.d.ts +32 -0
- package/dist/handlers/chat/intent.js +155 -0
- package/dist/handlers/chat/prompt.d.ts +20 -0
- package/dist/handlers/chat/prompt.js +55 -0
- package/dist/handlers/chat/proposalTools.d.ts +96 -0
- package/dist/handlers/chat/proposalTools.js +451 -0
- package/dist/handlers/chat/streaming.d.ts +38 -0
- package/dist/handlers/chat/streaming.js +136 -0
- package/dist/handlers/chat/toolFactory.d.ts +79 -0
- package/dist/handlers/chat/toolFactory.js +156 -0
- package/dist/handlers/chat/types.d.ts +57 -0
- package/dist/handlers/chat/types.js +1 -0
- package/dist/handlers/chatHandler.d.ts +1 -44
- package/dist/handlers/chatHandler.js +186 -1162
- package/dist/handlers/generateFieldHandler.d.ts +3 -8
- package/dist/handlers/generateFieldHandler.js +26 -97
- package/dist/handlers/http.d.ts +17 -0
- package/dist/handlers/http.js +21 -0
- package/dist/handlers/mediaUploadHandler.js +12 -34
- package/dist/handlers/mentionSuggestionHandler.d.ts +1 -1
- package/dist/handlers/mentionSuggestionHandler.js +6 -10
- package/dist/handlers/proposalDiffHandler.d.ts +1 -1
- package/dist/handlers/proposalDiffHandler.js +72 -195
- package/dist/handlers/translateDocumentHandler.d.ts +3 -8
- package/dist/handlers/translateDocumentHandler.js +26 -82
- package/dist/index.d.ts +4 -30
- package/dist/index.js +31 -421
- package/dist/plugin/admin.d.ts +30 -0
- package/dist/plugin/admin.js +155 -0
- package/dist/plugin/collections.d.ts +3 -0
- package/dist/plugin/collections.js +169 -0
- package/dist/plugin/endpoints.d.ts +23 -0
- package/dist/plugin/endpoints.js +84 -0
- package/dist/plugin/options.d.ts +4 -0
- package/dist/plugin/options.js +13 -0
- package/dist/plugin/types.d.ts +28 -0
- package/dist/plugin/types.js +1 -0
- package/dist/{payload/shared.d.ts → utils/data.d.ts} +2 -12
- package/package.json +1 -1
- package/dist/payload/proposalData.js +0 -578
- /package/dist/{payload → features}/collectionPermissions.d.ts +0 -0
- /package/dist/{payload → features/content}/documentTranslation.d.ts +0 -0
- /package/dist/{payload → features/content}/documentTranslation.js +0 -0
- /package/dist/{payload/textFieldGeneration.d.ts → features/content/fieldGeneration.d.ts} +0 -0
- /package/dist/{payload/textFieldGeneration.js → features/content/fieldGeneration.js} +0 -0
- /package/dist/{ai → features}/promptCaching.js +0 -0
- /package/dist/{ai/proposalRepair.js → features/proposals/repair.js} +0 -0
- /package/dist/{ai/providerOptions.d.ts → features/providers/options.d.ts} +0 -0
- /package/dist/{ai/providerOptions.js → features/providers/options.js} +0 -0
- /package/dist/{payload/normalizeData.d.ts → features/schema/normalize.d.ts} +0 -0
- /package/dist/{ai → features}/sensitiveData.d.ts +0 -0
- /package/dist/{ai → features}/tokenUsage.js +0 -0
- /package/dist/{payload/shared.js → utils/data.js} +0 -0
- /package/dist/{payload → utils}/logging.d.ts +0 -0
- /package/dist/{payload → utils}/logging.js +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { tokenUsageCollectionSlug } from "../features/tokenUsage.js";
|
|
2
|
+
export const createAIChangesCollection = ()=>({
|
|
3
|
+
slug: "payload-ai-auditlog",
|
|
4
|
+
access: {
|
|
5
|
+
create: ()=>false,
|
|
6
|
+
delete: ()=>false,
|
|
7
|
+
read: ({ req })=>Boolean(req.user),
|
|
8
|
+
update: ()=>false
|
|
9
|
+
},
|
|
10
|
+
admin: {
|
|
11
|
+
defaultColumns: [
|
|
12
|
+
"title",
|
|
13
|
+
"action",
|
|
14
|
+
"additions",
|
|
15
|
+
"removals",
|
|
16
|
+
"createdAt"
|
|
17
|
+
],
|
|
18
|
+
group: "AI",
|
|
19
|
+
useAsTitle: "title"
|
|
20
|
+
},
|
|
21
|
+
labels: {
|
|
22
|
+
plural: "AI Changes",
|
|
23
|
+
singular: "AI Change"
|
|
24
|
+
},
|
|
25
|
+
fields: [
|
|
26
|
+
{
|
|
27
|
+
name: "title",
|
|
28
|
+
type: "text",
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "action",
|
|
33
|
+
type: "select",
|
|
34
|
+
options: [
|
|
35
|
+
"create",
|
|
36
|
+
"update",
|
|
37
|
+
"delete",
|
|
38
|
+
"updateGlobal"
|
|
39
|
+
],
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "targetType",
|
|
44
|
+
type: "select",
|
|
45
|
+
options: [
|
|
46
|
+
"collection",
|
|
47
|
+
"global"
|
|
48
|
+
],
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "collection",
|
|
53
|
+
type: "text"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "slug",
|
|
57
|
+
type: "text"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "documentID",
|
|
61
|
+
type: "text"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "targetURL",
|
|
65
|
+
type: "text"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "additions",
|
|
69
|
+
type: "number",
|
|
70
|
+
defaultValue: 0
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "removals",
|
|
74
|
+
type: "number",
|
|
75
|
+
defaultValue: 0
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "before",
|
|
79
|
+
type: "json"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "after",
|
|
83
|
+
type: "json"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "proposal",
|
|
87
|
+
type: "json"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "prompt",
|
|
91
|
+
type: "textarea"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "inputTokens",
|
|
95
|
+
type: "number"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "outputTokens",
|
|
99
|
+
type: "number"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "totalTokens",
|
|
103
|
+
type: "number"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "aiResponse",
|
|
107
|
+
type: "textarea"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "userID",
|
|
111
|
+
type: "text"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "userLabel",
|
|
115
|
+
type: "text"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
timestamps: true
|
|
119
|
+
});
|
|
120
|
+
export const createAITokenUsageCollection = ()=>({
|
|
121
|
+
slug: tokenUsageCollectionSlug,
|
|
122
|
+
access: {
|
|
123
|
+
create: ()=>false,
|
|
124
|
+
delete: ()=>false,
|
|
125
|
+
read: ()=>false,
|
|
126
|
+
update: ()=>false
|
|
127
|
+
},
|
|
128
|
+
admin: {
|
|
129
|
+
hidden: true
|
|
130
|
+
},
|
|
131
|
+
fields: [
|
|
132
|
+
{
|
|
133
|
+
name: "userID",
|
|
134
|
+
type: "text",
|
|
135
|
+
index: true,
|
|
136
|
+
required: true
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "provider",
|
|
140
|
+
type: "text",
|
|
141
|
+
required: true
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "model",
|
|
145
|
+
type: "text",
|
|
146
|
+
required: true
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "inputTokens",
|
|
150
|
+
type: "number"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "outputTokens",
|
|
154
|
+
type: "number"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "totalTokens",
|
|
158
|
+
type: "number",
|
|
159
|
+
required: true
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "recordedAt",
|
|
163
|
+
type: "date",
|
|
164
|
+
index: true,
|
|
165
|
+
required: true
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
timestamps: true
|
|
169
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Config } from "payload";
|
|
2
|
+
import type { getResolvedAIModelConfig, ResolvedAIProviderConfig } from "../features/providers/options.js";
|
|
3
|
+
import type { ResolvedMaxTokenUsageOptions } from "../features/tokenUsage.js";
|
|
4
|
+
import { type MediaUploadOptions } from "../handlers/mediaUploadHandler.js";
|
|
5
|
+
import type { ResolvedCollectionPermissionMap } from "../features/collectionPermissions.js";
|
|
6
|
+
import type { TranslationPageContext } from "../features/content/documentTranslation.js";
|
|
7
|
+
import type { TextGenerationPageContext } from "../features/content/fieldGeneration.js";
|
|
8
|
+
type RegisterAIEndpointsOptions = {
|
|
9
|
+
allowUserApiKeys: boolean;
|
|
10
|
+
collectionPermissions?: ResolvedCollectionPermissionMap;
|
|
11
|
+
config: Config;
|
|
12
|
+
generateFields: boolean;
|
|
13
|
+
maxOutputTokens?: number;
|
|
14
|
+
maxTokenUsage?: ResolvedMaxTokenUsageOptions;
|
|
15
|
+
mediaUploadOptions: MediaUploadOptions | null;
|
|
16
|
+
modelConfig: ReturnType<typeof getResolvedAIModelConfig>;
|
|
17
|
+
promptCaching: boolean;
|
|
18
|
+
providerConfigs: ResolvedAIProviderConfig[];
|
|
19
|
+
textGenerationPageContexts: Map<string, TextGenerationPageContext>;
|
|
20
|
+
translationPageContexts: Map<string, TranslationPageContext>;
|
|
21
|
+
};
|
|
22
|
+
export declare const registerAIEndpoints: ({ allowUserApiKeys, collectionPermissions, config, generateFields, maxOutputTokens, maxTokenUsage, mediaUploadOptions, modelConfig, promptCaching, providerConfigs, textGenerationPageContexts, translationPageContexts, }: RegisterAIEndpointsOptions) => void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createApplyActionHandler } from "../handlers/applyActionHandler.js";
|
|
2
|
+
import { createAuditLogHandler } from "../handlers/auditLogHandler.js";
|
|
3
|
+
import { createChatHandler } from "../handlers/chatHandler.js";
|
|
4
|
+
import { createGenerateFieldHandler } from "../handlers/generateFieldHandler.js";
|
|
5
|
+
import { createMediaUploadHandler } from "../handlers/mediaUploadHandler.js";
|
|
6
|
+
import { createMentionSuggestionHandler } from "../handlers/mentionSuggestionHandler.js";
|
|
7
|
+
import { createProposalDiffHandler } from "../handlers/proposalDiffHandler.js";
|
|
8
|
+
import { createTranslateDocumentHandler } from "../handlers/translateDocumentHandler.js";
|
|
9
|
+
export const registerAIEndpoints = ({ allowUserApiKeys, collectionPermissions, config, generateFields, maxOutputTokens, maxTokenUsage, mediaUploadOptions, modelConfig, promptCaching, providerConfigs, textGenerationPageContexts, translationPageContexts })=>{
|
|
10
|
+
if (!config.endpoints) config.endpoints = [];
|
|
11
|
+
config.endpoints.push({
|
|
12
|
+
handler: createChatHandler({
|
|
13
|
+
allowUserApiKeys,
|
|
14
|
+
collections: collectionPermissions,
|
|
15
|
+
maxOutputTokens,
|
|
16
|
+
maxTokenUsage,
|
|
17
|
+
models: modelConfig,
|
|
18
|
+
promptCaching,
|
|
19
|
+
providers: providerConfigs
|
|
20
|
+
}),
|
|
21
|
+
method: "post",
|
|
22
|
+
path: "/ai-chat"
|
|
23
|
+
}, {
|
|
24
|
+
handler: createApplyActionHandler({
|
|
25
|
+
changeLogCollection: "payload-ai-auditlog",
|
|
26
|
+
collections: collectionPermissions
|
|
27
|
+
}),
|
|
28
|
+
method: "post",
|
|
29
|
+
path: "/ai-apply-action"
|
|
30
|
+
}, {
|
|
31
|
+
handler: createAuditLogHandler({
|
|
32
|
+
changeLogCollection: "payload-ai-auditlog"
|
|
33
|
+
}),
|
|
34
|
+
method: "get",
|
|
35
|
+
path: "/ai-audit-log"
|
|
36
|
+
}, {
|
|
37
|
+
handler: createProposalDiffHandler({
|
|
38
|
+
collections: collectionPermissions
|
|
39
|
+
}),
|
|
40
|
+
method: "post",
|
|
41
|
+
path: "/ai-proposal-diff"
|
|
42
|
+
}, {
|
|
43
|
+
handler: createMentionSuggestionHandler({
|
|
44
|
+
collections: collectionPermissions
|
|
45
|
+
}),
|
|
46
|
+
method: "post",
|
|
47
|
+
path: "/ai-mention-suggestion"
|
|
48
|
+
});
|
|
49
|
+
if (generateFields) {
|
|
50
|
+
config.endpoints.push({
|
|
51
|
+
handler: createGenerateFieldHandler({
|
|
52
|
+
allowUserApiKeys,
|
|
53
|
+
maxOutputTokens,
|
|
54
|
+
maxTokenUsage,
|
|
55
|
+
models: modelConfig,
|
|
56
|
+
pageContexts: textGenerationPageContexts,
|
|
57
|
+
providers: providerConfigs
|
|
58
|
+
}),
|
|
59
|
+
method: "post",
|
|
60
|
+
path: "/ai-generate-field"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (translationPageContexts.size > 0) {
|
|
64
|
+
config.endpoints.push({
|
|
65
|
+
handler: createTranslateDocumentHandler({
|
|
66
|
+
allowUserApiKeys,
|
|
67
|
+
maxOutputTokens,
|
|
68
|
+
maxTokenUsage,
|
|
69
|
+
models: modelConfig,
|
|
70
|
+
pageContexts: translationPageContexts,
|
|
71
|
+
providers: providerConfigs
|
|
72
|
+
}),
|
|
73
|
+
method: "post",
|
|
74
|
+
path: "/ai-translate-document"
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (mediaUploadOptions) {
|
|
78
|
+
config.endpoints.push({
|
|
79
|
+
handler: createMediaUploadHandler(mediaUploadOptions),
|
|
80
|
+
method: "post",
|
|
81
|
+
path: "/ai-upload-media"
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MediaUploadOptions } from "../handlers/mediaUploadHandler.js";
|
|
2
|
+
import type { PayloadAIPluginOptions } from "./types.js";
|
|
3
|
+
export declare const resolveMediaUploadOptions: (media?: PayloadAIPluginOptions["media"]) => MediaUploadOptions | null;
|
|
4
|
+
export declare const resolveMaxOutputTokens: (maxOutputTokens?: number) => number | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const resolveMediaUploadOptions = (media)=>{
|
|
2
|
+
if (!media || media.enabled === false) return null;
|
|
3
|
+
return {
|
|
4
|
+
...media.acceptedMimeTypes ? {
|
|
5
|
+
acceptedMimeTypes: media.acceptedMimeTypes
|
|
6
|
+
} : {},
|
|
7
|
+
collectionSlug: media.collectionSlug || "media",
|
|
8
|
+
...typeof media.maxFileSize === "number" && Number.isFinite(media.maxFileSize) && media.maxFileSize > 0 ? {
|
|
9
|
+
maxFileSize: Math.floor(media.maxFileSize)
|
|
10
|
+
} : {}
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export const resolveMaxOutputTokens = (maxOutputTokens)=>typeof maxOutputTokens === "number" && Number.isFinite(maxOutputTokens) && maxOutputTokens > 0 ? Math.floor(maxOutputTokens) : undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AIModelConfig, AIProviderConfig } from "../features/providers/options.js";
|
|
2
|
+
import type { MaxTokenUsageOptions } from "../features/tokenUsage.js";
|
|
3
|
+
import type { CollectionPermissionMap } from "../features/collectionPermissions.js";
|
|
4
|
+
export type CollectionTypeAIOptions = {
|
|
5
|
+
aiInput?: boolean;
|
|
6
|
+
generateFields?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type PayloadAIPluginOptions = {
|
|
9
|
+
aiInput?: boolean;
|
|
10
|
+
allowUserApiKeys?: boolean;
|
|
11
|
+
authCollections?: CollectionTypeAIOptions;
|
|
12
|
+
collections?: CollectionPermissionMap;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
generateFields?: boolean;
|
|
15
|
+
maxOutputTokens?: number;
|
|
16
|
+
maxTokenUsage?: MaxTokenUsageOptions;
|
|
17
|
+
media?: {
|
|
18
|
+
acceptedMimeTypes?: string[];
|
|
19
|
+
collectionSlug?: string;
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
maxFileSize?: number;
|
|
22
|
+
};
|
|
23
|
+
models?: AIModelConfig;
|
|
24
|
+
promptCaching?: boolean;
|
|
25
|
+
providers?: AIProviderConfig[];
|
|
26
|
+
translate?: boolean;
|
|
27
|
+
uploadCollections?: CollectionTypeAIOptions;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import type { PayloadHandler } from "payload";
|
|
2
|
-
|
|
3
|
-
export type AIActionProposalLike = {
|
|
4
|
-
action: "create" | "delete" | "update" | "updateGlobal";
|
|
5
|
-
collection?: string;
|
|
6
|
-
data?: Record<string, unknown>;
|
|
7
|
-
id?: string;
|
|
8
|
-
label: string;
|
|
9
|
-
locale?: string;
|
|
10
|
-
localizedData?: LocalizedDataInput;
|
|
11
|
-
slug?: string;
|
|
12
|
-
};
|
|
2
|
+
import type { ActionProposal, LocalizedDataInput } from "../features/proposals/types.js";
|
|
13
3
|
export declare const getSerializableLabel: (label: unknown, fallback?: string) => string;
|
|
14
4
|
export declare const isInternalCollection: (slug: string) => boolean;
|
|
15
5
|
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
@@ -20,7 +10,7 @@ export declare const hasLocalizedData: <Value>(value: Value) => value is Value &
|
|
|
20
10
|
};
|
|
21
11
|
export declare const getDefaultLocale: (req: Parameters<PayloadHandler>[0]) => string | null;
|
|
22
12
|
export declare const getJSONLineKey: (line: string) => string | null;
|
|
23
|
-
export declare const isActionProposal: (proposal: unknown) => proposal is
|
|
13
|
+
export declare const isActionProposal: (proposal: unknown) => proposal is ActionProposal;
|
|
24
14
|
export declare const getOptionalNumber: (value: unknown) => number | undefined;
|
|
25
15
|
export declare const getNumber: (value: unknown) => number;
|
|
26
16
|
export declare const getString: (value: unknown) => string | null;
|