@forumone/throughline-forms 0.0.1 → 0.2.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.
- package/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +132 -40
- package/dist/destinations.d.ts +26 -0
- package/dist/destinations.d.ts.map +1 -0
- package/dist/destinations.js +36 -0
- package/dist/destinations.js.map +1 -0
- package/dist/functions/_shared.d.ts +13 -0
- package/dist/functions/_shared.d.ts.map +1 -0
- package/dist/functions/_shared.js +44 -0
- package/dist/functions/_shared.js.map +1 -0
- package/dist/functions/email-destination.d.ts +25 -0
- package/dist/functions/email-destination.d.ts.map +1 -0
- package/dist/functions/email-destination.js +75 -0
- package/dist/functions/email-destination.js.map +1 -0
- package/dist/functions/fan-out.d.ts +24 -0
- package/dist/functions/fan-out.d.ts.map +1 -0
- package/dist/functions/fan-out.js +71 -0
- package/dist/functions/fan-out.js.map +1 -0
- package/dist/functions/index.d.ts +9 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/functions/index.js +5 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/functions/submitter-confirmation.d.ts +25 -0
- package/dist/functions/submitter-confirmation.d.ts.map +1 -0
- package/dist/functions/submitter-confirmation.js +76 -0
- package/dist/functions/submitter-confirmation.js.map +1 -0
- package/dist/functions/webhook-destination.d.ts +20 -0
- package/dist/functions/webhook-destination.d.ts.map +1 -0
- package/dist/functions/webhook-destination.js +74 -0
- package/dist/functions/webhook-destination.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +74 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +61 -0
- package/dist/options.js.map +1 -0
- package/dist/plugin.d.ts +19 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +180 -0
- package/dist/plugin.js.map +1 -0
- package/dist/policy-fields.d.ts +18 -0
- package/dist/policy-fields.d.ts.map +1 -0
- package/dist/policy-fields.js +115 -0
- package/dist/policy-fields.js.map +1 -0
- package/dist/submit/endpoint.d.ts +16 -0
- package/dist/submit/endpoint.d.ts.map +1 -0
- package/dist/submit/endpoint.js +116 -0
- package/dist/submit/endpoint.js.map +1 -0
- package/dist/submit/ip.d.ts +20 -0
- package/dist/submit/ip.d.ts.map +1 -0
- package/dist/submit/ip.js +48 -0
- package/dist/submit/ip.js.map +1 -0
- package/dist/submit/rate-limit.d.ts +23 -0
- package/dist/submit/rate-limit.d.ts.map +1 -0
- package/dist/submit/rate-limit.js +27 -0
- package/dist/submit/rate-limit.js.map +1 -0
- package/dist/submit/spam.d.ts +10 -0
- package/dist/submit/spam.d.ts.map +1 -0
- package/dist/submit/spam.js +16 -0
- package/dist/submit/spam.js.map +1 -0
- package/dist/templates/FormSubmission.d.ts +21 -0
- package/dist/templates/FormSubmission.d.ts.map +1 -0
- package/dist/templates/FormSubmission.js +32 -0
- package/dist/templates/FormSubmission.js.map +1 -0
- package/dist/templates/SubmitterConfirmation.d.ts +18 -0
- package/dist/templates/SubmitterConfirmation.d.ts.map +1 -0
- package/dist/templates/SubmitterConfirmation.js +14 -0
- package/dist/templates/SubmitterConfirmation.js.map +1 -0
- package/dist/templates/_layout.d.ts +14 -0
- package/dist/templates/_layout.d.ts.map +1 -0
- package/dist/templates/_layout.js +34 -0
- package/dist/templates/_layout.js.map +1 -0
- package/dist/templates/index.d.ts +7 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +4 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/tools/_field-schema.d.ts +68 -0
- package/dist/tools/_field-schema.d.ts.map +1 -0
- package/dist/tools/_field-schema.js +62 -0
- package/dist/tools/_field-schema.js.map +1 -0
- package/dist/tools/access.d.ts +7 -0
- package/dist/tools/access.d.ts.map +1 -0
- package/dist/tools/access.js +16 -0
- package/dist/tools/access.js.map +1 -0
- package/dist/tools/create-form.d.ts +138 -0
- package/dist/tools/create-form.d.ts.map +1 -0
- package/dist/tools/create-form.js +96 -0
- package/dist/tools/create-form.js.map +1 -0
- package/dist/tools/get-form-submissions.d.ts +27 -0
- package/dist/tools/get-form-submissions.d.ts.map +1 -0
- package/dist/tools/get-form-submissions.js +47 -0
- package/dist/tools/get-form-submissions.js.map +1 -0
- package/dist/tools/index.d.ts +14 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-allowed-destinations.d.ts +10 -0
- package/dist/tools/list-allowed-destinations.d.ts.map +1 -0
- package/dist/tools/list-allowed-destinations.js +14 -0
- package/dist/tools/list-allowed-destinations.js.map +1 -0
- package/dist/tools/update-form-destinations.d.ts +45 -0
- package/dist/tools/update-form-destinations.d.ts.map +1 -0
- package/dist/tools/update-form-destinations.js +75 -0
- package/dist/tools/update-form-destinations.js.map +1 -0
- package/dist/tools/update-form-fields.d.ts +101 -0
- package/dist/tools/update-form-fields.d.ts.map +1 -0
- package/dist/tools/update-form-fields.js +65 -0
- package/dist/tools/update-form-fields.js.map +1 -0
- package/dist/tools/validate-form.d.ts +127 -0
- package/dist/tools/validate-form.d.ts.map +1 -0
- package/dist/tools/validate-form.js +50 -0
- package/dist/tools/validate-form.js.map +1 -0
- package/package.json +71 -7
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { withMeta, getAuditWriter } from '@forumone/throughline-core';
|
|
3
|
+
import { validateDestinationLabel } from '../destinations.js';
|
|
4
|
+
import { deniedEnvelope, isFormsAuthor } from './access.js';
|
|
5
|
+
const inputSchema = withMeta({
|
|
6
|
+
formId: z.string(),
|
|
7
|
+
destinationLabels: z.array(z.string()).min(1),
|
|
8
|
+
});
|
|
9
|
+
export function createUpdateFormDestinationsTool(deps) {
|
|
10
|
+
return {
|
|
11
|
+
name: 'update_form_destinations',
|
|
12
|
+
description: "Replaces a form's destinations with the given labels. Every label must be on the allowlist (use list_allowed_destinations to discover). The replace-all semantics are deliberate — incremental destination edits are too easy to misuse via prompt injection.",
|
|
13
|
+
inputSchema,
|
|
14
|
+
handler: async (input, ctx) => {
|
|
15
|
+
if (!isFormsAuthor(ctx)) {
|
|
16
|
+
return deniedEnvelope('Only admins and editors can update form destinations.');
|
|
17
|
+
}
|
|
18
|
+
const seen = new Set();
|
|
19
|
+
for (const label of input.destinationLabels) {
|
|
20
|
+
if (seen.has(label))
|
|
21
|
+
return deniedEnvelope(`Duplicate destination label "${label}".`);
|
|
22
|
+
seen.add(label);
|
|
23
|
+
const check = validateDestinationLabel(deps.resolved.options, label);
|
|
24
|
+
if (!check.ok)
|
|
25
|
+
return deniedEnvelope(check.reason ?? 'Destination not on the allowlist.');
|
|
26
|
+
}
|
|
27
|
+
let existing = null;
|
|
28
|
+
try {
|
|
29
|
+
existing = (await deps.payload.findByID({
|
|
30
|
+
collection: deps.resolved.formsCollectionSlug,
|
|
31
|
+
id: input.formId,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
existing = null;
|
|
36
|
+
}
|
|
37
|
+
if (!existing)
|
|
38
|
+
return deniedEnvelope(`No form with id "${input.formId}".`);
|
|
39
|
+
const policy = (existing['policy'] ?? {});
|
|
40
|
+
const updatedPolicy = {
|
|
41
|
+
...policy,
|
|
42
|
+
destinations: input.destinationLabels.map((label) => ({ label, enabled: true })),
|
|
43
|
+
};
|
|
44
|
+
await deps.payload.update({
|
|
45
|
+
collection: deps.resolved.formsCollectionSlug,
|
|
46
|
+
id: input.formId,
|
|
47
|
+
data: { policy: updatedPolicy },
|
|
48
|
+
});
|
|
49
|
+
const auditWriter = getAuditWriter(deps.payload);
|
|
50
|
+
await auditWriter({
|
|
51
|
+
actor: {
|
|
52
|
+
type: 'user',
|
|
53
|
+
...(ctx.user?.id ? { userId: ctx.user.id } : {}),
|
|
54
|
+
...(ctx.user?.name ? { userName: ctx.user.name } : {}),
|
|
55
|
+
...(ctx.apiKeyName ? { apiKeyName: ctx.apiKeyName } : {}),
|
|
56
|
+
},
|
|
57
|
+
action: 'form.updated',
|
|
58
|
+
mcpServer: 'forms',
|
|
59
|
+
mcpTool: 'update_form_destinations',
|
|
60
|
+
targetCollection: deps.resolved.formsCollectionSlug,
|
|
61
|
+
targetId: input.formId,
|
|
62
|
+
targetTitle: typeof existing['title'] === 'string' ? existing['title'] : undefined,
|
|
63
|
+
...(input._meta?.userPrompt ? { prompt: input._meta.userPrompt } : {}),
|
|
64
|
+
...(input._meta?.reasoning ? { reasoning: input._meta.reasoning } : {}),
|
|
65
|
+
changesSummary: `Set destinations to: ${input.destinationLabels.join(', ')}.`,
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
ok: true,
|
|
69
|
+
formId: input.formId,
|
|
70
|
+
destinations: input.destinationLabels,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=update-form-destinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-form-destinations.js","sourceRoot":"","sources":["../../src/tools/update-form-destinations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3D,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9C,CAAC,CAAA;AAOF,MAAM,UAAU,gCAAgC,CAC9C,IAAgC;IAEhC,OAAO;QACL,IAAI,E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CAAC,CAAC,SAAS;gBAC9F,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACtE,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvE,cAAc,EAAE,wBAAwB,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;aAC9E,CAAC,CAAA;YAEF,OAAO;gBACL,EAAE,EAAE,IAAI;gBACR,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,YAAY,EAAE,KAAK,CAAC,iBAAiB;aACtC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Payload } from 'payload';
|
|
3
|
+
import type { McpToolDefinition } from '@forumone/throughline-plugin-contract';
|
|
4
|
+
import type { ResolvedFormsConfig } from '../options.js';
|
|
5
|
+
declare const inputSchema: z.ZodObject<{
|
|
6
|
+
formId: z.ZodString;
|
|
7
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
8
|
+
blockType: z.ZodEnum<["text", "textarea", "email", "select", "checkbox", "number"]>;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
label: z.ZodString;
|
|
11
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
13
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
+
label: z.ZodString;
|
|
15
|
+
value: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
label: string;
|
|
18
|
+
value: string;
|
|
19
|
+
}, {
|
|
20
|
+
label: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}>, "many">>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
label: string;
|
|
25
|
+
name: string;
|
|
26
|
+
required: boolean;
|
|
27
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
28
|
+
defaultValue?: string | undefined;
|
|
29
|
+
options?: {
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}[] | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
label: string;
|
|
35
|
+
name: string;
|
|
36
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
37
|
+
defaultValue?: string | undefined;
|
|
38
|
+
required?: boolean | undefined;
|
|
39
|
+
options?: {
|
|
40
|
+
label: string;
|
|
41
|
+
value: string;
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
}>, "many">;
|
|
44
|
+
} & {
|
|
45
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
userPrompt: z.ZodOptional<z.ZodString>;
|
|
47
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
48
|
+
changesSummary: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
reasoning?: string | undefined;
|
|
51
|
+
changesSummary?: string | undefined;
|
|
52
|
+
userPrompt?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
reasoning?: string | undefined;
|
|
55
|
+
changesSummary?: string | undefined;
|
|
56
|
+
userPrompt?: string | undefined;
|
|
57
|
+
}>>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
fields: {
|
|
60
|
+
label: string;
|
|
61
|
+
name: string;
|
|
62
|
+
required: boolean;
|
|
63
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
64
|
+
defaultValue?: string | undefined;
|
|
65
|
+
options?: {
|
|
66
|
+
label: string;
|
|
67
|
+
value: string;
|
|
68
|
+
}[] | undefined;
|
|
69
|
+
}[];
|
|
70
|
+
formId: string;
|
|
71
|
+
_meta?: {
|
|
72
|
+
reasoning?: string | undefined;
|
|
73
|
+
changesSummary?: string | undefined;
|
|
74
|
+
userPrompt?: string | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
fields: {
|
|
78
|
+
label: string;
|
|
79
|
+
name: string;
|
|
80
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
81
|
+
defaultValue?: string | undefined;
|
|
82
|
+
required?: boolean | undefined;
|
|
83
|
+
options?: {
|
|
84
|
+
label: string;
|
|
85
|
+
value: string;
|
|
86
|
+
}[] | undefined;
|
|
87
|
+
}[];
|
|
88
|
+
formId: string;
|
|
89
|
+
_meta?: {
|
|
90
|
+
reasoning?: string | undefined;
|
|
91
|
+
changesSummary?: string | undefined;
|
|
92
|
+
userPrompt?: string | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
export interface UpdateFormFieldsDeps {
|
|
96
|
+
payload: Payload;
|
|
97
|
+
resolved: ResolvedFormsConfig;
|
|
98
|
+
}
|
|
99
|
+
export declare function createUpdateFormFieldsTool(deps: UpdateFormFieldsDeps): McpToolDefinition<typeof inputSchema>;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=update-form-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-form-fields.d.ts","sourceRoot":"","sources":["../../src/tools/update-form-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAE9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AASxD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BsB,CAAC;sBAE1B,CAAC;kBACL,CAAJ;;iBAAgD,CAAC;sBAExC,CAAA;kBACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA7BR,CAAA;AAEF,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,mBAAmB,CAAA;CAC9B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,oBAAoB,GACzB,iBAAiB,CAAC,OAAO,WAAW,CAAC,CA0DvC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { withMeta, getAuditWriter } from '@forumone/throughline-core';
|
|
3
|
+
import { FieldSchema, validateFieldSet, validateSubmitterConfirmation, } from './_field-schema.js';
|
|
4
|
+
import { deniedEnvelope, isFormsAuthor } from './access.js';
|
|
5
|
+
const inputSchema = withMeta({
|
|
6
|
+
formId: z.string(),
|
|
7
|
+
fields: z.array(FieldSchema).min(1),
|
|
8
|
+
});
|
|
9
|
+
export function createUpdateFormFieldsTool(deps) {
|
|
10
|
+
return {
|
|
11
|
+
name: 'update_form_fields',
|
|
12
|
+
description: 'Replaces the fields on an existing form. Re-runs the same accessibility / submitter-confirmation checks `create_form` runs against the form\'s current submitterConfirmation config so existing email-field references stay valid.',
|
|
13
|
+
inputSchema,
|
|
14
|
+
handler: async (input, ctx) => {
|
|
15
|
+
if (!isFormsAuthor(ctx)) {
|
|
16
|
+
return deniedEnvelope('Only admins and editors can update form fields.');
|
|
17
|
+
}
|
|
18
|
+
const fieldCheck = validateFieldSet(input.fields);
|
|
19
|
+
if (!fieldCheck.ok)
|
|
20
|
+
return deniedEnvelope(fieldCheck.reason);
|
|
21
|
+
let existing = null;
|
|
22
|
+
try {
|
|
23
|
+
existing = (await deps.payload.findByID({
|
|
24
|
+
collection: deps.resolved.formsCollectionSlug,
|
|
25
|
+
id: input.formId,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
existing = null;
|
|
30
|
+
}
|
|
31
|
+
if (!existing)
|
|
32
|
+
return deniedEnvelope(`No form with id "${input.formId}".`);
|
|
33
|
+
const policy = (existing['policy'] ?? {});
|
|
34
|
+
const submitterConfirmation = (policy['submitterConfirmation'] ?? {});
|
|
35
|
+
const confirmationCheck = validateSubmitterConfirmation(submitterConfirmation, input.fields);
|
|
36
|
+
if (!confirmationCheck.ok)
|
|
37
|
+
return deniedEnvelope(confirmationCheck.reason);
|
|
38
|
+
await deps.payload.update({
|
|
39
|
+
collection: deps.resolved.formsCollectionSlug,
|
|
40
|
+
id: input.formId,
|
|
41
|
+
data: { fields: input.fields },
|
|
42
|
+
});
|
|
43
|
+
const auditWriter = getAuditWriter(deps.payload);
|
|
44
|
+
await auditWriter({
|
|
45
|
+
actor: {
|
|
46
|
+
type: 'user',
|
|
47
|
+
...(ctx.user?.id ? { userId: ctx.user.id } : {}),
|
|
48
|
+
...(ctx.user?.name ? { userName: ctx.user.name } : {}),
|
|
49
|
+
...(ctx.apiKeyName ? { apiKeyName: ctx.apiKeyName } : {}),
|
|
50
|
+
},
|
|
51
|
+
action: 'form.updated',
|
|
52
|
+
mcpServer: 'forms',
|
|
53
|
+
mcpTool: 'update_form_fields',
|
|
54
|
+
targetCollection: deps.resolved.formsCollectionSlug,
|
|
55
|
+
targetId: input.formId,
|
|
56
|
+
targetTitle: typeof existing['title'] === 'string' ? existing['title'] : undefined,
|
|
57
|
+
...(input._meta?.userPrompt ? { prompt: input._meta.userPrompt } : {}),
|
|
58
|
+
...(input._meta?.reasoning ? { reasoning: input._meta.reasoning } : {}),
|
|
59
|
+
changesSummary: `Replaced form fields (${input.fields.length} fields).`,
|
|
60
|
+
});
|
|
61
|
+
return { ok: true, formId: input.formId, fieldCount: input.fields.length };
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=update-form-fields.js.map
|
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AAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC1D;gBACD,MAAM,EAAE,cAAc;gBACtB,SAAS,EAAE,OAAO;gBAClB,OAAO,EAAE,oBAAoB;gBAC7B,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAmB;gBACnD,QAAQ,EAAE,KAAK,CAAC,MAAM;gBACtB,WAAW,EAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,QAAQ,CAAC,OAAO,CAAY,CAAC,CAAC,CAAC,SAAS;gBAC9F,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACtE,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvE,cAAc,EAAE,yBAAyB,KAAK,CAAC,MAAM,CAAC,MAAM,WAAW;aACxE,CAAC,CAAA;YAEF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;QAC5E,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { McpToolDefinition } from '@forumone/throughline-plugin-contract';
|
|
3
|
+
import type { FormsPluginOptions } from '../options.js';
|
|
4
|
+
declare const inputSchema: z.ZodObject<{
|
|
5
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
6
|
+
blockType: z.ZodEnum<["text", "textarea", "email", "select", "checkbox", "number"]>;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
label: z.ZodString;
|
|
9
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
11
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
label: z.ZodString;
|
|
13
|
+
value: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}, {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}>, "many">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
label: string;
|
|
23
|
+
name: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
26
|
+
defaultValue?: string | undefined;
|
|
27
|
+
options?: {
|
|
28
|
+
label: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}[] | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
label: string;
|
|
33
|
+
name: string;
|
|
34
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
35
|
+
defaultValue?: string | undefined;
|
|
36
|
+
required?: boolean | undefined;
|
|
37
|
+
options?: {
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}[] | undefined;
|
|
41
|
+
}>, "many">;
|
|
42
|
+
destinationLabels: z.ZodArray<z.ZodString, "many">;
|
|
43
|
+
submitterConfirmation: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
enabled: z.ZodBoolean;
|
|
45
|
+
emailFieldName: z.ZodOptional<z.ZodString>;
|
|
46
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
47
|
+
body: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
emailFieldName?: string | undefined;
|
|
51
|
+
subject?: string | undefined;
|
|
52
|
+
body?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
emailFieldName?: string | undefined;
|
|
56
|
+
subject?: string | undefined;
|
|
57
|
+
body?: string | undefined;
|
|
58
|
+
}>>;
|
|
59
|
+
} & {
|
|
60
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
userPrompt: z.ZodOptional<z.ZodString>;
|
|
62
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
63
|
+
changesSummary: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
reasoning?: string | undefined;
|
|
66
|
+
changesSummary?: string | undefined;
|
|
67
|
+
userPrompt?: string | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
reasoning?: string | undefined;
|
|
70
|
+
changesSummary?: string | undefined;
|
|
71
|
+
userPrompt?: string | undefined;
|
|
72
|
+
}>>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
fields: {
|
|
75
|
+
label: string;
|
|
76
|
+
name: string;
|
|
77
|
+
required: boolean;
|
|
78
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
79
|
+
defaultValue?: string | undefined;
|
|
80
|
+
options?: {
|
|
81
|
+
label: string;
|
|
82
|
+
value: string;
|
|
83
|
+
}[] | undefined;
|
|
84
|
+
}[];
|
|
85
|
+
destinationLabels: string[];
|
|
86
|
+
submitterConfirmation?: {
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
emailFieldName?: string | undefined;
|
|
89
|
+
subject?: string | undefined;
|
|
90
|
+
body?: string | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
_meta?: {
|
|
93
|
+
reasoning?: string | undefined;
|
|
94
|
+
changesSummary?: string | undefined;
|
|
95
|
+
userPrompt?: string | undefined;
|
|
96
|
+
} | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
fields: {
|
|
99
|
+
label: string;
|
|
100
|
+
name: string;
|
|
101
|
+
blockType: "number" | "email" | "checkbox" | "select" | "textarea" | "text";
|
|
102
|
+
defaultValue?: string | undefined;
|
|
103
|
+
required?: boolean | undefined;
|
|
104
|
+
options?: {
|
|
105
|
+
label: string;
|
|
106
|
+
value: string;
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
}[];
|
|
109
|
+
destinationLabels: string[];
|
|
110
|
+
submitterConfirmation?: {
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
emailFieldName?: string | undefined;
|
|
113
|
+
subject?: string | undefined;
|
|
114
|
+
body?: string | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
_meta?: {
|
|
117
|
+
reasoning?: string | undefined;
|
|
118
|
+
changesSummary?: string | undefined;
|
|
119
|
+
userPrompt?: string | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
}>;
|
|
122
|
+
export interface ValidateFormDeps {
|
|
123
|
+
options: FormsPluginOptions;
|
|
124
|
+
}
|
|
125
|
+
export declare function createValidateFormTool(deps: ValidateFormDeps): McpToolDefinition<typeof inputSchema>;
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=validate-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-form.d.ts","sourceRoot":"","sources":["../../src/tools/validate-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AASvD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BI,CAAC;sBACU,CAAC;kBACb,CAAC;;iBACb,CAAN;sBAA4C,CAAC;kBAEjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAxBb,CAAA;AAEF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,kBAAkB,CAAA;CAC5B;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,gBAAgB,GACrB,iBAAiB,CAAC,OAAO,WAAW,CAAC,CAoCvC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { withMeta } from '@forumone/throughline-core';
|
|
3
|
+
import { validateDestinationLabel } from '../destinations.js';
|
|
4
|
+
import { FieldSchema, validateFieldSet, validateSubmitterConfirmation, } from './_field-schema.js';
|
|
5
|
+
import { deniedEnvelope, isFormsAuthor } from './access.js';
|
|
6
|
+
const inputSchema = withMeta({
|
|
7
|
+
fields: z.array(FieldSchema).min(1),
|
|
8
|
+
destinationLabels: z.array(z.string()).min(1),
|
|
9
|
+
submitterConfirmation: z
|
|
10
|
+
.object({
|
|
11
|
+
enabled: z.boolean(),
|
|
12
|
+
emailFieldName: z.string().optional(),
|
|
13
|
+
subject: z.string().optional(),
|
|
14
|
+
body: z.string().optional(),
|
|
15
|
+
})
|
|
16
|
+
.optional(),
|
|
17
|
+
});
|
|
18
|
+
export function createValidateFormTool(deps) {
|
|
19
|
+
return {
|
|
20
|
+
name: 'validate_form',
|
|
21
|
+
description: 'Runs the same checks `create_form` runs (allowlist, accessibility, submitter-confirmation pointer) without writing anything. Use to confirm a form definition is shippable before persisting it.',
|
|
22
|
+
inputSchema,
|
|
23
|
+
handler: async (input, ctx) => {
|
|
24
|
+
if (!isFormsAuthor(ctx)) {
|
|
25
|
+
return deniedEnvelope('Only admins and editors can validate form definitions.');
|
|
26
|
+
}
|
|
27
|
+
const issues = [];
|
|
28
|
+
for (const label of input.destinationLabels) {
|
|
29
|
+
const check = validateDestinationLabel(deps.options, label);
|
|
30
|
+
if (!check.ok && check.reason)
|
|
31
|
+
issues.push(check.reason);
|
|
32
|
+
}
|
|
33
|
+
const fieldCheck = validateFieldSet(input.fields);
|
|
34
|
+
if (!fieldCheck.ok && fieldCheck.reason)
|
|
35
|
+
issues.push(fieldCheck.reason);
|
|
36
|
+
const confirmationCheck = validateSubmitterConfirmation(input.submitterConfirmation, input.fields);
|
|
37
|
+
if (!confirmationCheck.ok && confirmationCheck.reason) {
|
|
38
|
+
issues.push(confirmationCheck.reason);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
ok: issues.length === 0,
|
|
42
|
+
issues,
|
|
43
|
+
summary: issues.length === 0
|
|
44
|
+
? 'Form definition passes all checks.'
|
|
45
|
+
: `${issues.length} issue${issues.length === 1 ? '' : 's'} found.`,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=validate-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-form.js","sourceRoot":"","sources":["../../src/tools/validate-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,6BAA6B,GAC9B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3D,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,qBAAqB,EAAE,CAAC;SACrB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACrC,OAAO,EAA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,CAAC,MAAM,KAAK,CAAC;gBACvB,MAAM;gBACN,OAAO,EACL,MAAM,CAAC,MAAM,KAAK,CAAC;oBACjB,CAAC,CAAC,oCAAoC;oBACtC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS;aACvE,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forumone/throughline-forms",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Policy-aware forms layer for the Throughline framework. Wraps Payload's Form Builder with privacy notices, consent, honeypot spam protection, IP rate limiting, a destination allowlist, and submitter confirmation. Six MCP tools for Claude-driven form management; submissions fan out to email and webhook destinations via Inngest.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"CHANGELOG.md"
|
|
18
|
+
],
|
|
5
19
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
"throughline",
|
|
21
|
+
"payload",
|
|
22
|
+
"forms",
|
|
23
|
+
"form-builder",
|
|
24
|
+
"mcp"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/forumone/throughline.git",
|
|
30
|
+
"directory": "packages/forms"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/forumone/throughline/tree/main/packages/forms#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/forumone/throughline/issues"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@payloadcms/plugin-form-builder": "^3.0.0",
|
|
41
|
+
"inngest": "^4.0.0",
|
|
42
|
+
"payload": "^3.0.0",
|
|
43
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@react-email/components": "^0.5.4",
|
|
47
|
+
"@react-email/render": "^1.3.2",
|
|
48
|
+
"zod": "^3.23.0",
|
|
49
|
+
"@forumone/throughline-core": "0.2.2",
|
|
50
|
+
"@forumone/throughline-email": "0.2.2",
|
|
51
|
+
"@forumone/throughline-plugin-contract": "0.2.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@payloadcms/plugin-form-builder": "3.83.0",
|
|
55
|
+
"@types/node": "^20.17.0",
|
|
56
|
+
"@types/react": "^19.2.0",
|
|
57
|
+
"eslint": "^9.15.0",
|
|
58
|
+
"inngest": "^4.2.0",
|
|
59
|
+
"payload": "^3.83.0",
|
|
60
|
+
"react": "^19.2.0",
|
|
61
|
+
"typescript": "^5.6.0",
|
|
62
|
+
"vitest": "^2.1.0",
|
|
63
|
+
"@forumone/throughline-eslint-config": "0.0.0",
|
|
64
|
+
"@forumone/throughline-tsconfig": "0.0.0"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsc -b",
|
|
68
|
+
"dev": "tsc -b -w",
|
|
69
|
+
"clean": "rm -rf dist .turbo *.tsbuildinfo",
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
|
+
"lint": "eslint src",
|
|
72
|
+
"test": "vitest run"
|
|
73
|
+
}
|
|
74
|
+
}
|