@forumone/throughline-forms 0.4.0 → 0.5.0

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 CHANGED
@@ -1,5 +1,69 @@
1
1
  # @forumone/throughline-forms
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3140ea0: One MCP transport, not seven
8
+
9
+ Every plugin served its own `POST /<prefix>/mcp` on a 146-line JSON-RPC subset of
10
+ the protocol that spoke `tools/list` and `tools/call` and nothing else. Payload
11
+ ships an MCP server built on the official SDK — streamable HTTP, sessions, per-key
12
+ capability checkboxes — and the tools were never the transport. They now reach a
13
+ client through the host's `@payloadcms/plugin-mcp`, on one `/api/mcp`, via the
14
+ collector `createMcpToolCollector` already provided.
15
+
16
+ **Breaking.** Removed from `@forumone/throughline-core`: `createMcpHandler`,
17
+ `McpHandlerOptions`, `createApiKeysCollection`, `ApiKeysCollectionOptions`,
18
+ `DEFAULT_API_KEYS_SLUG`, `createBearerTokenAuthenticator`,
19
+ `BearerTokenAuthenticatorOptions`, `generateApiKey`. Removed from
20
+ `@forumone/throughline-plugin-contract`: `McpAuthenticator`, `McpAuthResult`.
21
+ `sha256Hex` stays exported, from `./utils` rather than `./auth`.
22
+
23
+ `routePrefix` is gone from `auditQueryPlugin`, `componentsPlugin` and
24
+ `integrationsPlugin` — omitted from their options types, so passing one is a
25
+ compile error rather than config that reads as if it does something. `/mcp` was
26
+ the only endpoint any of the three served. `publishingPlugin`, `approvalsPlugin`
27
+ and `formsPlugin` keep theirs; they still serve admin controls, the approval
28
+ action link and the public form post.
29
+
30
+ **A host that passes no `mcpTools` collector now has no MCP surface.** There is no
31
+ per-server endpoint left as a fallback. This is a config change of one line per
32
+ plugin, and `createMcpToolCollector`'s own docs carry the shape.
33
+
34
+ **What this costs, stated plainly.** `requiredScope` is now read by nothing —
35
+ `plugin-mcp` gates on checkboxes generated at config time, which this suite cannot
36
+ fill because every tool is built at `onInit`. So a key that authenticates reaches
37
+ every collected tool, exactly as an all-or-nothing per-server key did. The
38
+ declarations are kept because they are the mapping those checkboxes need; #78
39
+ tracks restoring enforcement, and the type's own doc comment says so.
40
+
41
+ Also drops the key collection from the playground, which leaves that app with no
42
+ MCP surface at all until `mcpPlugin` can be wired there — #79, blocked on moving
43
+ it off `payload@^3.83.0`.
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [3140ea0]
48
+ - @forumone/throughline-plugin-contract@0.4.0
49
+ - @forumone/throughline-core@0.7.0
50
+ - @forumone/throughline-email@0.2.7
51
+
52
+ ## 0.4.1
53
+
54
+ ### Patch Changes
55
+
56
+ - 9131065: Three helpers that existed once per package now exist once
57
+ - **`unwrapRelationshipId`** had four definitions — three private to `approvals`, one exported from `email` — differing only in a null guard that `typeof value === 'string'` already covers. One deliberate change comes with the move: none of the four handled a _numeric_ id, so on Postgres at `depth: 0` they returned `null` for a relationship that was populated fine. No caller reads at depth 0 today, so this fixes nothing and stops a shared helper being wrong for the first caller that does.
58
+ - **`deniedEnvelope`** had three identical definitions, one per server with an access predicate. The role predicates stay where they are: what counts as an audit reader is not what counts as a forms author, and collapsing those would put one package's policy in another's file.
59
+ - **The MCP handler rebuilt `createNamedLogger` inline**, forty lines from the real one in the same package.
60
+
61
+ Nothing else in the duplication audit survived checking. `createFakePayload` has six definitions and three distinct implementations — a query engine, a two-line map read, and a stateful form store — which share a name and nothing else; merging them means building a fake that does all three jobs. `createFakeInngest` has one definition and three importers. The six MCP endpoint stanzas are real duplication that should be deleted rather than merged, once hosts move to `@payloadcms/plugin-mcp`.
62
+
63
+ - Updated dependencies [9131065]
64
+ - @forumone/throughline-core@0.6.0
65
+ - @forumone/throughline-email@0.2.6
66
+
3
67
  ## 0.4.0
4
68
 
5
69
  ### Minor Changes
package/README.md CHANGED
@@ -9,7 +9,7 @@ After this package, an authorized user can ask Claude "build me a contact form t
9
9
  - **`formsPlugin`** — composes the Form Builder plugin and adds the policy layer.
10
10
  - **`addFormPolicyFields`** — appends the `policy` group (privacy notice, consent, spam protection, destinations, submitter confirmation) to the Forms collection's fields.
11
11
  - **Submit endpoint** at `/api/<routePrefix>/submit` (default `/api/forms/submit`) — public POST that runs honeypot → form lookup → consent → rate limit → persist → fan-out.
12
- - **MCP server** at `/api/<routePrefix>/mcp` with six tools:
12
+ - **Six MCP tools**, handed to the host's collector at `onInit` and served by `@payloadcms/plugin-mcp` on one `/api/mcp`. Pass `mcpTools` or they reach nobody:
13
13
 
14
14
  | Tool | Use it for | Access |
15
15
  |---|---|---|
@@ -127,7 +127,7 @@ Consent is enforced server-side. A request to `/api/forms/submit` with `consent:
127
127
  | `ipHashSecret` | `FORMS_IP_HASH_SECRET` env | Required, ≥32 chars |
128
128
  | `formsCollectionSlug` | `'forms'` | |
129
129
  | `submissionsCollectionSlug` | `'form-submissions'` | |
130
- | `routePrefix` | `'/forms'` | Payload prepends `/api`; submit lands at `/api/forms/submit`, MCP at `/api/forms/mcp` |
130
+ | `routePrefix` | `'/forms'` | Payload prepends `/api`; the public submit endpoint lands at `/api/forms/submit`. It is the only endpoint this plugin serves |
131
131
  | `enabled` | `true` | Set to false to no-op |
132
132
 
133
133
  ## Related packages
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,uCAAuC,CAAA;AAI1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,cAAc,CAAA;AAgCvE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAsKpD,CAAA;AAEH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC,GAAG,EAAE,CAKzE"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,uCAAuC,CAAA;AAI1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,cAAc,CAAA;AA6BvE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAuIpD,CAAA;AAEH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC,GAAG,EAAE,CAKzE"}
package/dist/plugin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { getPluginRegistry } from '@forumone/throughline-plugin-contract';
2
- import { createMcpHandler, createNamedLogger, defaultLogger } from '@forumone/throughline-core';
2
+ import { createNamedLogger, defaultLogger } from '@forumone/throughline-core';
3
3
  import { getEmailClient as readEmailClient } from '@forumone/throughline-email';
4
4
  import { formBuilderPlugin } from '@payloadcms/plugin-form-builder';
5
5
  import { validateOptions } from './options.js';
@@ -10,7 +10,6 @@ import { createCreateFormTool, createGetFormSubmissionsTool, createListAllowedDe
10
10
  import { createEmailDestinationFunction, createFormFanOutFunction, createSubmitterConfirmationFunction, createWebhookDestinationFunction, } from './functions/index.js';
11
11
  const PLUGIN_ID = '@forumone/throughline-forms';
12
12
  const PLUGIN_VERSION = '0.1.0';
13
- const MCP_HANDLER_SYMBOL = Symbol.for('@forumone/throughline/forms-mcp-handler');
14
13
  const FUNCTIONS_SYMBOL = Symbol.for('@forumone/throughline/forms-functions');
15
14
  /**
16
15
  * Forms plugin. Composes the official Form Builder plugin with the
@@ -100,26 +99,11 @@ export const formsPlugin = (rawOptions) => (incomingConfig) => {
100
99
  });
101
100
  const withFormBuilder = formBuilderConfig(incomingConfig);
102
101
  const submitEndpoint = createSubmitEndpoint(resolved);
103
- const mcpEndpoint = {
104
- path: `${resolved.routePrefix}/mcp`,
105
- method: 'post',
106
- handler: async (req) => {
107
- const handler = req.payload[MCP_HANDLER_SYMBOL];
108
- if (!handler) {
109
- return new Response(JSON.stringify({ error: 'Forms MCP not initialized' }), {
110
- status: 503,
111
- headers: { 'content-type': 'application/json' },
112
- });
113
- }
114
- return handler(req);
115
- },
116
- };
117
102
  return {
118
103
  ...withFormBuilder,
119
104
  endpoints: [
120
105
  ...(withFormBuilder.endpoints ?? []),
121
106
  submitEndpoint,
122
- mcpEndpoint,
123
107
  ],
124
108
  onInit: async (payload) => {
125
109
  if (withFormBuilder.onInit)
@@ -135,22 +119,10 @@ export const formsPlugin = (rawOptions) => (incomingConfig) => {
135
119
  createUpdateFormDestinationsTool({ payload, resolved }),
136
120
  createGetFormSubmissionsTool({ payload, resolved }),
137
121
  ];
138
- // Payload's own MCP plugin, when the host is using it. See the option's
139
- // note — `onInit` is both the earliest these tools can exist and still
140
- // early enough that the array is read populated.
122
+ // Payload's own MCP plugin, and the only transport these tools have.
123
+ // `onInit` is both the earliest they can exist and still early enough
124
+ // that `mcpPlugin` reads the array populated.
141
125
  resolved.options.mcpTools?.add(tools, { serverName: 'forms', logger });
142
- const handler = createMcpHandler({
143
- payload,
144
- serverName: 'forms',
145
- tools,
146
- logger,
147
- });
148
- Object.defineProperty(payload, MCP_HANDLER_SYMBOL, {
149
- value: handler,
150
- enumerable: false,
151
- writable: false,
152
- configurable: false,
153
- });
154
126
  const fanOutDeps = { inngest: resolved.options.inngest, payload, resolved };
155
127
  const getEmailClient = () => readEmailClient(payload);
156
128
  const functions = [
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/F,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE/E,OAAO,EAAE,iBAAiB,EAA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OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;YAC3E,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;YACrD,MAAM,SAAS,GAA0B;gBACvC,wBAAwB,CAAC,UAAU,CAAC;gBACpC,8BAA8B,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,CAAC;gBACjE,gCAAgC,CAAC,UAAU,CAAC;gBAC5C,mCAAmC,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,CAAC;aACvE,CAAA;YAED,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE;gBAC/C,KAAK,EAAE,SAAS;gBAChB,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;aACpB,CAAC,CAAA;YAEF,QAAQ,CAAC,QAAQ,CAAC;gBAChB,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,cAAc;gBACvB,YAAY,EAAE,CAAC,OAAO,EAAE,wBAAwB,CAAC;aAClD,CAAC,CAAA;YAEF,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBAChC,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM;gBAChE,WAAW,EAAE,QAAQ,CAAC,WAAW;aAClC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAEH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,OAAO,CACH,OAAmC,CAAC,gBAAgB,CAAuC;QAC7F,EAAE,CACH,CAAA;AACH,CAAC"}
@@ -1,7 +1,5 @@
1
1
  import type { McpToolContext } from '@forumone/throughline-plugin-contract';
2
2
  export declare function isFormsAuthor(ctx: McpToolContext): boolean;
3
3
  export declare function isPiiReader(ctx: McpToolContext): boolean;
4
- export declare function deniedEnvelope(reason: string): {
5
- error: string;
6
- };
4
+ export { deniedEnvelope } from '@forumone/throughline-core';
7
5
  //# sourceMappingURL=access.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/tools/access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAE3E,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAI1D;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAIxD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAEhE"}
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/tools/access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAE3E,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAI1D;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAIxD;AAGD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA"}
@@ -10,7 +10,6 @@ export function isPiiReader(ctx) {
10
10
  const roles = ctx.user.roles;
11
11
  return roles.includes('admin') || roles.includes('form-admin');
12
12
  }
13
- export function deniedEnvelope(reason) {
14
- return { error: reason };
15
- }
13
+ // `deniedEnvelope` lives in core: three servers had identical copies.
14
+ export { deniedEnvelope } from '@forumone/throughline-core';
16
15
  //# sourceMappingURL=access.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/tools/access.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,GAAmB;IAC/C,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAA;IAC5B,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAmB;IAC7C,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAA;IAC5B,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC1B,CAAC"}
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/tools/access.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,GAAmB;IAC/C,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAA;IAC5B,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAmB;IAC7C,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAA;IAC5B,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;AAChE,CAAC;AAED,sEAAsE;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forumone/throughline-forms",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
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
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,9 +46,9 @@
46
46
  "@react-email/components": "^0.5.4",
47
47
  "@react-email/render": "^1.3.2",
48
48
  "zod": "^3.23.0",
49
- "@forumone/throughline-core": "0.5.0",
50
- "@forumone/throughline-email": "0.2.5",
51
- "@forumone/throughline-plugin-contract": "0.3.0"
49
+ "@forumone/throughline-core": "0.7.0",
50
+ "@forumone/throughline-email": "0.2.7",
51
+ "@forumone/throughline-plugin-contract": "0.4.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@payloadcms/plugin-form-builder": "3.83.0",