@forumone/throughline-integrations 0.3.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,64 @@
1
1
  # @forumone/throughline-integrations
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0d7501d: `Integration.createFunctions` is generic in its return type
8
+
9
+ It named `InngestFunction.Any`, and nothing in this package inspects or invokes what comes back — the one use anywhere is `.length`, for a log line saying how many functions an integration contributed. The host serves them.
10
+
11
+ Naming the type cost a consumer two casts. pnpm keys an `inngest` instance by its resolved peer set, and `inngest` declares optional peers on `express`, `hono` and `next` — so a host that installs anything pulling one of those in (in this case `@payloadcms/plugin-mcp`, via `mcp-handler`) ends up with a structurally identical, nominally different `InngestFunction.Any`, and the assignment stops compiling.
12
+
13
+ Generic, the host's own type flows through:
14
+
15
+ ```ts
16
+ export const myIntegration: Integration<MyConfig, InngestFunction.Any> = { … }
17
+ ```
18
+
19
+ `unknown` by default, so nothing existing has to change — `webhookIntegration` in this package is untouched.
20
+
21
+ - 88d7e4f: `IntegrationRegistry` and `getIntegrationRegistry` are generic in the function type too
22
+
23
+ Making `Integration.createFunctions` generic was half the fix: the registry still stored integrations at the default `unknown`, so `list()` handed back `unknown[]` and a host had to assert its way back to its own Inngest type before calling `serve()` — the assertion the generic existed to delete.
24
+
25
+ `getIntegrationRegistry<InngestFunction.Any>(payload)` now names it once, where the host reads the registry, and the type survives the round trip.
26
+
27
+ `unknown` by default, so nothing existing changes.
28
+
29
+ ### Patch Changes
30
+
31
+ - 9131065: Three helpers that existed once per package now exist once
32
+ - **`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.
33
+ - **`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.
34
+ - **The MCP handler rebuilt `createNamedLogger` inline**, forty lines from the real one in the same package.
35
+
36
+ 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`.
37
+
38
+ - Updated dependencies [9131065]
39
+ - @forumone/throughline-core@0.6.0
40
+
41
+ ## 0.4.0
42
+
43
+ ### Minor Changes
44
+
45
+ - 1a4a441: Let every server's tools be served by Payload's own MCP plugin
46
+
47
+ `createMcpToolCollector()` in core, and an `mcpTools` option on all six servers. The host hands the collector's array to `@payloadcms/plugin-mcp` at config time and each plugin fills it at `onInit` — which works because the plugin reads `mcp.tools` inside the handler it builds per request, so an array handed over empty is read populated.
48
+
49
+ That ordering is the whole problem this solves: every tool in the suite is built at `onInit` because every one closes over `payload`, and `mcpPlugin` takes its tools as a config option.
50
+
51
+ Omit `mcpTools` and nothing changes — each server keeps its own `/mcp` endpoint, which is what lets a host move one at a time rather than all six at once.
52
+
53
+ Duplicate tool names are refused, naming both servers. Six servers each owning a `publish` was fine while each had its own endpoint; one server is one namespace, and an MCP client offered two tools under one name gets whichever registered last.
54
+
55
+ **Also fixes a defect the integration test found.** `service.loadDocument` called `findByID` without `disableErrors`, so a missing document threw `NotFound` before the pipeline ran — which made the `exist` step's `not-found` branch unreachable from every caller, and turned "publish a document that does not exist" into a thrown error instead of the diagnostic the pipeline exists to return. The step's own tests passed it an empty document and so never noticed. `unpublish` now distinguishes a missing document from one that is merely already a draft.
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies [1a4a441]
60
+ - @forumone/throughline-core@0.5.0
61
+
3
62
  ## 0.3.0
4
63
 
5
64
  ### Minor Changes
package/dist/options.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { McpToolCollector } from '@forumone/throughline-core';
1
2
  import type { Inngest } from 'inngest';
2
3
  import type { BaseCorePluginOptions } from '@forumone/throughline-plugin-contract';
3
4
  import type { Integration } from './types.js';
@@ -17,6 +18,19 @@ export interface IntegrationsPluginOptions extends BaseCorePluginOptions {
17
18
  integrations?: Integration[];
18
19
  /** Override the Integrations collection slug. Default: 'integrations'. */
19
20
  collectionSlug?: string;
21
+ /**
22
+ * Where to put this server's MCP tools so Payload's own MCP plugin can serve
23
+ * them.
24
+ *
25
+ * `createMcpToolCollector()` from `@forumone/throughline-core`. The host hands
26
+ * its array to `@payloadcms/plugin-mcp` at config time and this plugin fills
27
+ * it at `onInit` — which is the first moment the tools can exist, since they
28
+ * close over `payload`, and still before any request reads the array.
29
+ *
30
+ * Omit it and nothing changes: this server keeps its own `/mcp` endpoint,
31
+ * which is what lets a host move one server at a time.
32
+ */
33
+ mcpTools?: McpToolCollector;
20
34
  }
21
35
  export declare function validateOptions(options: IntegrationsPluginOptions): IntegrationsPluginOptions;
22
36
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,yBAAyB,iBAAiB,CAAA;AAEvD,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,yBAAyB,CAK7F"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,yBAAyB,iBAAiB,CAAA;AAEvD,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,yBAAyB,CAK7F"}
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAA;AAmBvD,MAAM,UAAU,eAAe,CAAC,OAAkC;IAChE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;IACvF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAA;AAiCvD,MAAM,UAAU,eAAe,CAAC,OAAkC;IAChE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;IACvF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
package/dist/plugin.d.ts CHANGED
@@ -14,6 +14,22 @@ import type { IntegrationContext } from './types.js';
14
14
  * `docs/integrations-wiring.md` in the repository root.
15
15
  */
16
16
  export declare const integrationsPlugin: CorePlugin<IntegrationsPluginOptions>;
17
- export declare function getIntegrationRegistry(payload: unknown): IntegrationRegistry | undefined;
17
+ /**
18
+ * The registry this plugin attached at init, if it did.
19
+ *
20
+ * `Fn` is the host's own Inngest function type. Naming it is what lets the host
21
+ * serve `createFunctions()` results without asserting them back — the registry
22
+ * stores integrations at `unknown` otherwise, and an `unknown[]` cannot be
23
+ * handed to `serve()`:
24
+ *
25
+ * ```ts
26
+ * const registry = getIntegrationRegistry<InngestFunction.Any>(payload)
27
+ * ```
28
+ *
29
+ * There is no checking behind it either way — the value comes off a symbol on
30
+ * the Payload instance. What the parameter buys is that the assertion happens
31
+ * once, here, in terms of the host's own types, rather than at every read.
32
+ */
33
+ export declare function getIntegrationRegistry<Fn = unknown>(payload: unknown): IntegrationRegistry<Fn> | undefined;
18
34
  export declare function getIntegrationContext(payload: unknown): IntegrationContext | undefined;
19
35
  //# sourceMappingURL=plugin.d.ts.map
@@ -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;AAQ1F,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,cAAc,CAAA;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAkBpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,yBAAyB,CAoJlE,CAAA;AAEH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,GAAG,SAAS,CAExF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAEtF"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,uCAAuC,CAAA;AAQ1F,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,cAAc,CAAA;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAkBpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,yBAAyB,CAyJlE,CAAA;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,GAAG,OAAO,EACjD,OAAO,EAAE,OAAO,GACf,mBAAmB,CAAC,EAAE,CAAC,GAAG,SAAS,CAIrC;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAEtF"}
package/dist/plugin.js CHANGED
@@ -116,6 +116,10 @@ export const integrationsPlugin = (rawOptions) => (incomingConfig) => {
116
116
  createTestIntegrationTool({ ...deps, registry }),
117
117
  createListIntegrationTypesTool({ registry }),
118
118
  ];
119
+ // Payload's own MCP plugin, when the host is using it. See the option's
120
+ // note — `onInit` is both the earliest these tools can exist and still
121
+ // early enough that the array is read populated.
122
+ options.mcpTools?.add(tools, { serverName: 'integrations', logger });
119
123
  const handler = createMcpHandler({
120
124
  payload,
121
125
  serverName: 'integrations',
@@ -153,6 +157,22 @@ export const integrationsPlugin = (rawOptions) => (incomingConfig) => {
153
157
  },
154
158
  };
155
159
  };
160
+ /**
161
+ * The registry this plugin attached at init, if it did.
162
+ *
163
+ * `Fn` is the host's own Inngest function type. Naming it is what lets the host
164
+ * serve `createFunctions()` results without asserting them back — the registry
165
+ * stores integrations at `unknown` otherwise, and an `unknown[]` cannot be
166
+ * handed to `serve()`:
167
+ *
168
+ * ```ts
169
+ * const registry = getIntegrationRegistry<InngestFunction.Any>(payload)
170
+ * ```
171
+ *
172
+ * There is no checking behind it either way — the value comes off a symbol on
173
+ * the Payload instance. What the parameter buys is that the assertion happens
174
+ * once, here, in terms of the host's own types, rather than at every read.
175
+ */
156
176
  export function getIntegrationRegistry(payload) {
157
177
  return payload[REGISTRY_SYMBOL];
158
178
  }
@@ -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,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAkC,eAAe,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,SAAS,GAAG,oCAAoC,CAAA;AACtD,MAAM,cAAc,GAAG,OAAO,CAAA;AAE9B,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;AACvF,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAA;AACjF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAA;AAI/E;;;;;;;;;;GAUG;AACH,MAAM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Y,EAAE,KAAK;aACpB,CAAC,CAAA;YAEF,cAAc,CAAC,QAAQ,CAAC;gBACtB,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,cAAc;gBACvB,YAAY,EAAE,CAAC,cAAc,EAAE,sBAAsB,CAAC;aACvD,CAAC,CAAA;YAEF,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;gBACvC,cAAc;gBACd,WAAW;gBACX,gBAAgB,EAAE,QAAQ,CAAC,IAAI;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAgB;IAEhB,OAAQ,OAAmC,CAAC,eAAe,CAE9C,CAAA;AACf,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,OAAQ,OAAmC,CAAC,cAAc,CAAmC,CAAA;AAC/F,CAAC"}
@@ -3,12 +3,24 @@ import type { Integration } from './types.js';
3
3
  * Tiny registry keyed by integration id. Construction is per-plugin-init
4
4
  * (not a module-level singleton) so two Payload configs in the same process
5
5
  * don't share state. Keeps duplicate-id detection synchronous and simple.
6
+ *
7
+ * Generic in the integrations' function type, and `unknown` by default, for the
8
+ * same reason `Integration` is: this package never touches what
9
+ * `createFunctions` returns, and the host that serves them should not have to
10
+ * assert its way back to its own type after putting them in here.
11
+ *
12
+ * A host names it once, where it reads the registry:
13
+ *
14
+ * ```ts
15
+ * const registry = getIntegrationRegistry<InngestFunction.Any>(payload)
16
+ * const functions = registry?.list().flatMap((i) => i.createFunctions(ctx)) ?? []
17
+ * ```
6
18
  */
7
- export declare class IntegrationRegistry {
19
+ export declare class IntegrationRegistry<Fn = unknown> {
8
20
  private readonly byId;
9
- register(integration: Integration): void;
10
- get(id: string): Integration | undefined;
11
- list(): Integration[];
21
+ register(integration: Integration<Record<string, unknown>, Fn>): void;
22
+ get(id: string): Integration<Record<string, unknown>, Fn> | undefined;
23
+ list(): Integration<Record<string, unknown>, Fn>[];
12
24
  has(id: string): boolean;
13
25
  get size(): number;
14
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiC;IAEtD,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAOxC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIxC,IAAI,IAAI,WAAW,EAAE;IAIrB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,mBAAmB,CAAC,EAAE,GAAG,OAAO;IAC3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8D;IAEnF,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI;IAOrE,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS;IAIrE,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE;IAIlD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
package/dist/registry.js CHANGED
@@ -2,6 +2,18 @@
2
2
  * Tiny registry keyed by integration id. Construction is per-plugin-init
3
3
  * (not a module-level singleton) so two Payload configs in the same process
4
4
  * don't share state. Keeps duplicate-id detection synchronous and simple.
5
+ *
6
+ * Generic in the integrations' function type, and `unknown` by default, for the
7
+ * same reason `Integration` is: this package never touches what
8
+ * `createFunctions` returns, and the host that serves them should not have to
9
+ * assert its way back to its own type after putting them in here.
10
+ *
11
+ * A host names it once, where it reads the registry:
12
+ *
13
+ * ```ts
14
+ * const registry = getIntegrationRegistry<InngestFunction.Any>(payload)
15
+ * const functions = registry?.list().flatMap((i) => i.createFunctions(ctx)) ?? []
16
+ * ```
5
17
  */
6
18
  export class IntegrationRegistry {
7
19
  byId = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IACb,IAAI,GAAG,IAAI,GAAG,EAAuB,CAAA;IAEtD,QAAQ,CAAC,WAAwB;QAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,gBAAgB,WAAW,CAAC,EAAE,yBAAyB,CAAC,CAAA;QAC1E,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IAC5C,CAAC;IAED,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACvC,CAAC;IAED,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACvB,CAAC;CACF"}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,mBAAmB;IACb,IAAI,GAAG,IAAI,GAAG,EAAoD,CAAA;IAEnF,QAAQ,CAAC,WAAqD;QAC5D,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,gBAAgB,WAAW,CAAC,EAAE,yBAAyB,CAAC,CAAA;QAC1E,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IAC5C,CAAC;IAED,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACvC,CAAC;IAED,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACvB,CAAC;CACF"}
@@ -1,7 +1,5 @@
1
1
  import type { McpToolContext } from '@forumone/throughline-plugin-contract';
2
2
  export declare function isIntegrationsReader(ctx: McpToolContext): boolean;
3
3
  export declare function isIntegrationsAdmin(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,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAIjE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAGhE;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,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAIjE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAGhE;AAGD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA"}
@@ -9,7 +9,6 @@ export function isIntegrationsAdmin(ctx) {
9
9
  return false;
10
10
  return ctx.user.roles.includes('admin');
11
11
  }
12
- export function deniedEnvelope(reason) {
13
- return { error: reason };
14
- }
12
+ // `deniedEnvelope` lives in core: three servers had identical copies.
13
+ export { deniedEnvelope } from '@forumone/throughline-core';
15
14
  //# sourceMappingURL=access.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/tools/access.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,GAAmB;IACtD,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,mBAAmB,CAAC,GAAmB;IACrD,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AACzC,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,oBAAoB,CAAC,GAAmB;IACtD,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,mBAAmB,CAAC,GAAmB;IACrD,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IAC3B,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC;AAED,sEAAsE;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Field } from 'payload';
2
- import type { Inngest, InngestFunction } from 'inngest';
2
+ import type { Inngest } from 'inngest';
3
3
  import type { McpToolDefinition } from '@forumone/throughline-plugin-contract';
4
4
  export type IntegrationCategory = 'crm' | 'marketing' | 'analytics' | 'webhook' | 'storage' | 'messaging' | 'other';
5
5
  export type IntegrationSyncStatus = 'success' | 'partial' | 'failed' | 'never-run';
@@ -23,7 +23,7 @@ export interface IntegrationHealth {
23
23
  * {@link Integration.createFunctions} and emit their own results events as
24
24
  * needed. They never call other integrations directly.
25
25
  */
26
- export interface Integration<Config = Record<string, unknown>> {
26
+ export interface Integration<Config = Record<string, unknown>, Fn = unknown> {
27
27
  /** Unique slug. Used as the `integrationType` value in the collection. */
28
28
  id: string;
29
29
  /** Display name shown in the admin and `list_integration_types`. */
@@ -55,8 +55,24 @@ export interface Integration<Config = Record<string, unknown>> {
55
55
  * during plugin init; the returned functions are exposed via the registry
56
56
  * so the client app's Inngest endpoint can serve them. See
57
57
  * `docs/integrations-wiring.md`.
58
+ *
59
+ * **Generic in the function type, and `unknown` by default, on purpose.**
60
+ * This plugin never inspects or invokes what comes back — the one use
61
+ * anywhere is `.length`, for a log line saying how many an integration
62
+ * contributed. The host serves them.
63
+ *
64
+ * Naming `InngestFunction.Any` here instead cost a consumer two casts. A host
65
+ * whose dependency graph resolves a different `inngest` instance — pnpm keys
66
+ * one by its peer set, and `inngest` has optional peers on `express`, `hono`
67
+ * and `next`, so installing anything that pulls one in is enough — got a type
68
+ * that is structurally identical and nominally different. Generic, the host's
69
+ * own `InngestFunction.Any` flows through and the question never arises:
70
+ *
71
+ * ```ts
72
+ * export const myIntegration: Integration<MyConfig, InngestFunction.Any> = { … }
73
+ * ```
58
74
  */
59
- createFunctions: (ctx: IntegrationContext) => InngestFunction.Any[];
75
+ createFunctions: (ctx: IntegrationContext) => Fn[];
60
76
  /**
61
77
  * Optional MCP tools the integration adds to the integrations server. Most
62
78
  * integrations need only the five built-in tools; this is for cases where
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAE9E,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,WAAW,GACX,OAAO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,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,qBAAqB,CAAA;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forumone/throughline-integrations",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Plugin architecture for connecting Throughline-powered Payload sites to external systems. Ships the Integration contract, registry, collection, MCP tools, and a generic outbound-webhook integration as the first concrete example.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "zod": "^3.23.0",
45
- "@forumone/throughline-core": "0.4.0",
45
+ "@forumone/throughline-core": "0.6.0",
46
46
  "@forumone/throughline-plugin-contract": "0.3.0"
47
47
  },
48
48
  "devDependencies": {