@forumone/throughline-integrations 0.6.0 → 0.8.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 +86 -0
- package/README.md +29 -2
- package/dist/admin/SyncButton.d.ts +27 -0
- package/dist/admin/SyncButton.d.ts.map +1 -0
- package/dist/admin/SyncButton.js +134 -0
- package/dist/admin/SyncButton.js.map +1 -0
- package/dist/admin/sync-client.d.ts +83 -0
- package/dist/admin/sync-client.d.ts.map +1 -0
- package/dist/admin/sync-client.js +121 -0
- package/dist/admin/sync-client.js.map +1 -0
- package/dist/collection.d.ts +6 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +33 -0
- package/dist/collection.js.map +1 -1
- package/dist/endpoints/sync.d.ts +23 -0
- package/dist/endpoints/sync.d.ts.map +1 -0
- package/dist/endpoints/sync.js +85 -0
- package/dist/endpoints/sync.js.map +1 -0
- package/dist/exports/client.d.ts +12 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +10 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +7 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +24 -5
- package/dist/plugin.js.map +1 -1
- package/dist/sync/manual-sync.d.ts +64 -0
- package/dist/sync/manual-sync.d.ts.map +1 -0
- package/dist/sync/manual-sync.js +88 -0
- package/dist/sync/manual-sync.js.map +1 -0
- package/dist/tools/descriptors.d.ts +26 -0
- package/dist/tools/descriptors.d.ts.map +1 -0
- package/dist/tools/descriptors.js +35 -0
- package/dist/tools/descriptors.js.map +1 -0
- package/dist/tools/get-integration-status.d.ts.map +1 -1
- package/dist/tools/get-integration-status.js +2 -2
- package/dist/tools/get-integration-status.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list-integration-types.d.ts.map +1 -1
- package/dist/tools/list-integration-types.js +2 -2
- package/dist/tools/list-integration-types.js.map +1 -1
- package/dist/tools/list-integrations.d.ts.map +1 -1
- package/dist/tools/list-integrations.js +2 -2
- package/dist/tools/list-integrations.js.map +1 -1
- package/dist/tools/test-integration.d.ts.map +1 -1
- package/dist/tools/test-integration.js +2 -2
- package/dist/tools/test-integration.js.map +1 -1
- package/dist/tools/trigger-sync.d.ts.map +1 -1
- package/dist/tools/trigger-sync.js +15 -32
- package/dist/tools/trigger-sync.js.map +1 -1
- package/package.json +21 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Endpoint } from 'payload';
|
|
2
|
+
import type { Inngest } from 'inngest';
|
|
3
|
+
export interface CreateSyncEndpointDeps {
|
|
4
|
+
collectionSlug: string;
|
|
5
|
+
inngest: Inngest;
|
|
6
|
+
}
|
|
7
|
+
/** Default recorded on the event when the caller supplies no reason of its own. */
|
|
8
|
+
export declare const ADMIN_TRIGGER_REASON = "Triggered from the admin.";
|
|
9
|
+
/**
|
|
10
|
+
* `POST /api/<integrations>/:id/sync` — the admin's path to the same event
|
|
11
|
+
* `trigger_sync` fires.
|
|
12
|
+
*
|
|
13
|
+
* Authenticates off the Payload session cookie, so the person clicking the
|
|
14
|
+
* button needs no API key and the event records them rather than a service
|
|
15
|
+
* principal. The rules are `requestManualSync`'s, not this file's; all that
|
|
16
|
+
* lives here is the admin check and the mapping from a refusal to a status
|
|
17
|
+
* code.
|
|
18
|
+
*
|
|
19
|
+
* Admin-only, matching the MCP tool and the collection's own write access:
|
|
20
|
+
* triggering an integration makes it POST to an external system.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSyncEndpoint(deps: CreateSyncEndpointDeps): Endpoint;
|
|
23
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/endpoints/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAGtC,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAY/D;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,QAAQ,CAiEzE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { requestManualSync } from '../sync/manual-sync.js';
|
|
2
|
+
/** Default recorded on the event when the caller supplies no reason of its own. */
|
|
3
|
+
export const ADMIN_TRIGGER_REASON = 'Triggered from the admin.';
|
|
4
|
+
/** What each refusal means over HTTP. */
|
|
5
|
+
const STATUS = {
|
|
6
|
+
'not-found': 404,
|
|
7
|
+
disabled: 409,
|
|
8
|
+
// The instance is fine; the queue is not. 502 rather than 500 says the
|
|
9
|
+
// failure is downstream, which is the difference between "retry" and
|
|
10
|
+
// "something here is broken".
|
|
11
|
+
'send-failed': 502,
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* `POST /api/<integrations>/:id/sync` — the admin's path to the same event
|
|
15
|
+
* `trigger_sync` fires.
|
|
16
|
+
*
|
|
17
|
+
* Authenticates off the Payload session cookie, so the person clicking the
|
|
18
|
+
* button needs no API key and the event records them rather than a service
|
|
19
|
+
* principal. The rules are `requestManualSync`'s, not this file's; all that
|
|
20
|
+
* lives here is the admin check and the mapping from a refusal to a status
|
|
21
|
+
* code.
|
|
22
|
+
*
|
|
23
|
+
* Admin-only, matching the MCP tool and the collection's own write access:
|
|
24
|
+
* triggering an integration makes it POST to an external system.
|
|
25
|
+
*/
|
|
26
|
+
export function createSyncEndpoint(deps) {
|
|
27
|
+
return {
|
|
28
|
+
path: '/:id/sync',
|
|
29
|
+
method: 'post',
|
|
30
|
+
handler: async (req) => {
|
|
31
|
+
if (!req.user) {
|
|
32
|
+
return json({ error: 'You must be logged in to trigger a sync.' }, 401);
|
|
33
|
+
}
|
|
34
|
+
const roles = req.user['roles'] ?? [];
|
|
35
|
+
if (!roles.includes('admin')) {
|
|
36
|
+
return json({ error: 'Only admins can manually trigger integrations.' }, 403);
|
|
37
|
+
}
|
|
38
|
+
const id = req.routeParams?.['id'];
|
|
39
|
+
if (typeof id !== 'string' && typeof id !== 'number') {
|
|
40
|
+
return json({ error: 'Expected an integration instance id in the path.' }, 400);
|
|
41
|
+
}
|
|
42
|
+
// The button sends no body at all, so an absent or unparseable one is
|
|
43
|
+
// not an error — only a body that is present and wrong.
|
|
44
|
+
let reason = null;
|
|
45
|
+
try {
|
|
46
|
+
const raw = (await req.json?.());
|
|
47
|
+
if (raw && typeof raw === 'object' && typeof raw.reason === 'string') {
|
|
48
|
+
reason = raw.reason.trim() || null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
reason = null;
|
|
53
|
+
}
|
|
54
|
+
const result = await requestManualSync({ payload: req.payload, collectionSlug: deps.collectionSlug, inngest: deps.inngest }, {
|
|
55
|
+
instanceId: String(id),
|
|
56
|
+
triggeredBy: req.user.id ?? null,
|
|
57
|
+
reason: reason ?? `${ADMIN_TRIGGER_REASON} (${req.user['email'] ?? req.user.id})`,
|
|
58
|
+
});
|
|
59
|
+
if (!result.ok) {
|
|
60
|
+
if (result.code === 'send-failed') {
|
|
61
|
+
req.payload.logger.error(`[integrations] could not queue a manual sync for ${String(id)}: ${result.message}`);
|
|
62
|
+
}
|
|
63
|
+
return json({ error: result.message, code: result.code }, STATUS[result.code]);
|
|
64
|
+
}
|
|
65
|
+
return json({
|
|
66
|
+
ok: true,
|
|
67
|
+
triggered: {
|
|
68
|
+
instanceId: result.instanceId,
|
|
69
|
+
instanceName: result.instanceName,
|
|
70
|
+
type: result.integrationType,
|
|
71
|
+
},
|
|
72
|
+
// What the caller polls against. The sync has not run yet.
|
|
73
|
+
lastSyncAt: result.lastSyncAt,
|
|
74
|
+
message: `Queued a sync for "${result.instanceName}". The status fields update when the run finishes.`,
|
|
75
|
+
}, 202);
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function json(body, status) {
|
|
80
|
+
return new Response(JSON.stringify(body), {
|
|
81
|
+
status,
|
|
82
|
+
headers: { 'content-type': 'application/json' },
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/endpoints/sync.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAA0B,MAAM,wBAAwB,CAAA;AAOlF,mFAAmF;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAA;AAE/D,yCAAyC;AACzC,MAAM,MAAM,GAAsC;IAChD,WAAW,EAAE,GAAG;IAChB,QAAQ,EAAE,GAAG;IACb,uEAAuE;IACvE,qEAAqE;IACrE,8BAA8B;IAC9B,aAAa,EAAE,GAAG;CACnB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAA4B;IAC7D,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,KAAK,EAAE,GAAmB,EAAqB,EAAE;YACxD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;gBACd,OAAO,IAAI,CAAC,EAAE,KAAK,EAAE,0CAA0C,EAAE,EAAE,GAAG,CAAC,CAAA;YACzE,CAAC;YAED,MAAM,KAAK,GAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAA0B,IAAI,EAAE,CAAA;YAC/D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,O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EAAE,EAAE,CAAC;gBACf,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;oBAClC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACtB,oDAAoD,MAAM,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CACpF,CAAA;gBACH,CAAC;gBACD,OAAO,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;YAChF,CAAC;YAED,OAAO,IAAI,CACT;gBACE,EAAE,EAAE,IAAI;gBACR,SAAS,EAAE;oBACT,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,YAAY,EAAE,MAAM,CAAC,YAAY;oBACjC,IAAI,EAAE,MAAM,CAAC,eAAe;iBAC7B;gBACD,2DAA2D;gBAC3D,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO,EAAE,sBAAsB,MAAM,CAAC,YAAY,oDAAoD;aACvG,EACD,GAAG,CACJ,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAS,IAAI,CAAC,IAAa,EAAE,MAAc;IACzC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;QACxC,MAAM;QACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client entry point for the admin controls, referenced from Payload's import
|
|
3
|
+
* map as `@forumone/throughline-integrations/client#SyncButton`.
|
|
4
|
+
*
|
|
5
|
+
* Kept separate from the package root so server-only consumers never pull React
|
|
6
|
+
* or `@payloadcms/ui` into their bundle.
|
|
7
|
+
*/
|
|
8
|
+
export { SyncButton } from '../admin/SyncButton.js';
|
|
9
|
+
export type { ThroughlineSyncButtonProps } from '../admin/SyncButton.js';
|
|
10
|
+
export { describeSyncOutcome, fetchSyncStatus, formatSyncTime, syncHasFinished, triggerSync, } from '../admin/sync-client.js';
|
|
11
|
+
export type { FetchSyncStatusArgs, SyncOutcome, SyncStatus, SyncStatusValue, TriggerSyncArgs, TriggerSyncBody, TriggerSyncResult, } from '../admin/sync-client.js';
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,YAAY,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAExE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,yBAAyB,CAAA;AAChC,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client entry point for the admin controls, referenced from Payload's import
|
|
3
|
+
* map as `@forumone/throughline-integrations/client#SyncButton`.
|
|
4
|
+
*
|
|
5
|
+
* Kept separate from the package root so server-only consumers never pull React
|
|
6
|
+
* or `@payloadcms/ui` into their bundle.
|
|
7
|
+
*/
|
|
8
|
+
export { SyncButton } from '../admin/SyncButton.js';
|
|
9
|
+
export { describeSyncOutcome, fetchSyncStatus, formatSyncTime, syncHasFinished, triggerSync, } from '../admin/sync-client.js';
|
|
10
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAGnD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,yBAAyB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,9 @@ export type { IntegrationsPluginOptions } from './options.js';
|
|
|
5
5
|
export { webhookIntegration, WEBHOOK_INTEGRATION_ID } from './integrations/index.js';
|
|
6
6
|
export type { WebhookConfig } from './integrations/index.js';
|
|
7
7
|
export type { Integration, IntegrationCategory, IntegrationContext, IntegrationAuditEvent, IntegrationConfigValidation, IntegrationHealth, IntegrationInstance, IntegrationInstanceLoaded, IntegrationSyncStatus, } from './types.js';
|
|
8
|
+
export { requestManualSync, MANUAL_SYNC_EVENT } from './sync/manual-sync.js';
|
|
9
|
+
export type { ManualSyncRefusal, RequestManualSyncArgs, RequestManualSyncDeps, RequestManualSyncResult, } from './sync/manual-sync.js';
|
|
10
|
+
export { createSyncEndpoint, ADMIN_TRIGGER_REASON } from './endpoints/sync.js';
|
|
11
|
+
export type { CreateSyncEndpointDeps } from './endpoints/sync.js';
|
|
8
12
|
export { createListIntegrationsTool, createGetIntegrationStatusTool, createTriggerSyncTool, createTestIntegrationTool, createListIntegrationTypesTool, } from './tools/index.js';
|
|
9
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,YAAY,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAE7D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,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ACL,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,5 +2,7 @@ export { integrationsPlugin, getIntegrationRegistry, getIntegrationContext, } fr
|
|
|
2
2
|
export { IntegrationRegistry } from './registry.js';
|
|
3
3
|
export { DEFAULT_INTEGRATIONS_SLUG } from './options.js';
|
|
4
4
|
export { webhookIntegration, WEBHOOK_INTEGRATION_ID } from './integrations/index.js';
|
|
5
|
+
export { requestManualSync, MANUAL_SYNC_EVENT } from './sync/manual-sync.js';
|
|
6
|
+
export { createSyncEndpoint, ADMIN_TRIGGER_REASON } from './endpoints/sync.js';
|
|
5
7
|
export { createListIntegrationsTool, createGetIntegrationStatusTool, createTriggerSyncTool, createTestIntegrationTool, createListIntegrationTypesTool, } from './tools/index.js';
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAGxD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAepF,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAGxD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAepF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAQ5E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAG9E,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAA"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -3,15 +3,19 @@ import { type IntegrationsPluginOptions } from './options.js';
|
|
|
3
3
|
import { IntegrationRegistry } from './registry.js';
|
|
4
4
|
import type { IntegrationContext } from './types.js';
|
|
5
5
|
/**
|
|
6
|
-
* Integrations server. Registers the Integrations collection
|
|
7
|
-
*
|
|
8
|
-
* modules. The webhook integration is registered automatically; clients
|
|
6
|
+
* Integrations server. Registers the Integrations collection — with its
|
|
7
|
+
* manual-sync endpoint and the Sync now button in its sidebar — the five-tool
|
|
8
|
+
* MCP server, and a process-local registry of integration modules. The webhook integration is registered automatically; clients
|
|
9
9
|
* extend the registry by passing additional integrations via options.
|
|
10
10
|
*
|
|
11
11
|
* Integration Inngest functions are not served here — they are exposed
|
|
12
12
|
* via `getIntegrationRegistry(payload)` so the client app's Inngest
|
|
13
13
|
* endpoint can merge them with its own functions. See
|
|
14
14
|
* `docs/integrations-wiring.md` in the repository root.
|
|
15
|
+
*
|
|
16
|
+
* The collection carries one admin component, the sidebar's Sync now button,
|
|
17
|
+
* so hosts must run `payload generate:importmap` after adding this plugin (the
|
|
18
|
+
* dev server does it automatically). A stale import map 500s the admin screen.
|
|
15
19
|
*/
|
|
16
20
|
export declare const integrationsPlugin: CorePlugin<IntegrationsPluginOptions>;
|
|
17
21
|
/**
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -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;AAG1F,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,cAAc,CAAA;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,uCAAuC,CAAA;AAG1F,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,cAAc,CAAA;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAInD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAgBpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,yBAAyB,CAsIlE,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
|
@@ -3,22 +3,27 @@ import { createNamedLogger, defaultLogger, getAuditWriter } from '@forumone/thro
|
|
|
3
3
|
import { validateOptions, DEFAULT_INTEGRATIONS_SLUG } from './options.js';
|
|
4
4
|
import { IntegrationRegistry } from './registry.js';
|
|
5
5
|
import { createIntegrationsCollection } from './collection.js';
|
|
6
|
+
import { createSyncEndpoint } from './endpoints/sync.js';
|
|
6
7
|
import { webhookIntegration } from './integrations/index.js';
|
|
7
|
-
import { createGetIntegrationStatusTool, createListIntegrationsTool, createListIntegrationTypesTool, createTestIntegrationTool, createTriggerSyncTool, } from './tools/index.js';
|
|
8
|
+
import { INTEGRATIONS_TOOL_DESCRIPTORS, createGetIntegrationStatusTool, createListIntegrationsTool, createListIntegrationTypesTool, createTestIntegrationTool, createTriggerSyncTool, } from './tools/index.js';
|
|
8
9
|
const PLUGIN_ID = '@forumone/throughline-integrations';
|
|
9
10
|
const PLUGIN_VERSION = '0.1.0';
|
|
10
11
|
const REGISTRY_SYMBOL = Symbol.for('@forumone/throughline/integrations-registry');
|
|
11
12
|
const CONTEXT_SYMBOL = Symbol.for('@forumone/throughline/integrations-context');
|
|
12
13
|
/**
|
|
13
|
-
* Integrations server. Registers the Integrations collection
|
|
14
|
-
*
|
|
15
|
-
* modules. The webhook integration is registered automatically; clients
|
|
14
|
+
* Integrations server. Registers the Integrations collection — with its
|
|
15
|
+
* manual-sync endpoint and the Sync now button in its sidebar — the five-tool
|
|
16
|
+
* MCP server, and a process-local registry of integration modules. The webhook integration is registered automatically; clients
|
|
16
17
|
* extend the registry by passing additional integrations via options.
|
|
17
18
|
*
|
|
18
19
|
* Integration Inngest functions are not served here — they are exposed
|
|
19
20
|
* via `getIntegrationRegistry(payload)` so the client app's Inngest
|
|
20
21
|
* endpoint can merge them with its own functions. See
|
|
21
22
|
* `docs/integrations-wiring.md` in the repository root.
|
|
23
|
+
*
|
|
24
|
+
* The collection carries one admin component, the sidebar's Sync now button,
|
|
25
|
+
* so hosts must run `payload generate:importmap` after adding this plugin (the
|
|
26
|
+
* dev server does it automatically). A stale import map 500s the admin screen.
|
|
22
27
|
*/
|
|
23
28
|
export const integrationsPlugin = (rawOptions) => (incomingConfig) => {
|
|
24
29
|
if (rawOptions.enabled === false)
|
|
@@ -31,7 +36,21 @@ export const integrationsPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
31
36
|
for (const integration of options.integrations ?? []) {
|
|
32
37
|
registry.register(integration);
|
|
33
38
|
}
|
|
34
|
-
const collection = createIntegrationsCollection({
|
|
39
|
+
const collection = createIntegrationsCollection({
|
|
40
|
+
slug: collectionSlug,
|
|
41
|
+
registry,
|
|
42
|
+
// The admin's path to `integration/manual-sync`, sharing
|
|
43
|
+
// `requestManualSync` with the `trigger_sync` MCP tool so the two cannot
|
|
44
|
+
// disagree about what a trigger checks or what event it sends.
|
|
45
|
+
endpoints: [createSyncEndpoint({ collectionSlug, inngest: options.inngest })],
|
|
46
|
+
});
|
|
47
|
+
/*
|
|
48
|
+
Declared here, bound at `onInit` — `mcpPlugin` generates its per-key
|
|
49
|
+
checkboxes from these names and descriptions while the config is built, and
|
|
50
|
+
denies any tool it has no checkbox for. This plugin must therefore come
|
|
51
|
+
before `mcpPlugin` in the host's array.
|
|
52
|
+
*/
|
|
53
|
+
options.mcpTools?.declare(INTEGRATIONS_TOOL_DESCRIPTORS, { serverName: 'integrations' });
|
|
35
54
|
return {
|
|
36
55
|
...incomingConfig,
|
|
37
56
|
collections: [...(incomingConfig.collections ?? []), collection],
|
package/dist/plugin.js.map
CHANGED
|
@@ -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,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC7F,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,oCA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AC,KAAK,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAA;YAEpE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE;gBAC9C,KAAK,EAAE,QAAQ;gBACf,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;aACpB,CAAC,CAAA;YACF,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE;gBAC7C,KAAK,EAAE,OAAO;gBACd,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,KAAK;gBACf,YAAY,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,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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Inngest } from 'inngest';
|
|
2
|
+
import type { Payload } from 'payload';
|
|
3
|
+
/**
|
|
4
|
+
* The event every integration's manual-sync function subscribes to. Fired for
|
|
5
|
+
* *all* integrations, which is why each handler filters the payload down to
|
|
6
|
+
* its own instance rather than trusting the event.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MANUAL_SYNC_EVENT = "integration/manual-sync";
|
|
9
|
+
export interface RequestManualSyncDeps {
|
|
10
|
+
payload: Payload;
|
|
11
|
+
collectionSlug: string;
|
|
12
|
+
inngest: Inngest;
|
|
13
|
+
}
|
|
14
|
+
export interface RequestManualSyncArgs {
|
|
15
|
+
/** Payload id of the instance to sync. */
|
|
16
|
+
instanceId: string;
|
|
17
|
+
/** Who asked. Recorded on the event so the run can be traced back to them. */
|
|
18
|
+
triggeredBy?: number | string | null;
|
|
19
|
+
/** Why. Carried on the event for the audit trail; not otherwise used. */
|
|
20
|
+
reason?: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Why a trigger was refused. Callers map these onto whatever their transport
|
|
24
|
+
* uses to say no — an error envelope for MCP, a status code for HTTP.
|
|
25
|
+
*/
|
|
26
|
+
export type ManualSyncRefusal =
|
|
27
|
+
/** No instance with that id. */
|
|
28
|
+
'not-found'
|
|
29
|
+
/** The instance exists but `enabled` is false. */
|
|
30
|
+
| 'disabled'
|
|
31
|
+
/** Inngest would not take the event. */
|
|
32
|
+
| 'send-failed';
|
|
33
|
+
export type RequestManualSyncResult = {
|
|
34
|
+
ok: true;
|
|
35
|
+
instanceId: string;
|
|
36
|
+
instanceName: string;
|
|
37
|
+
integrationType: string;
|
|
38
|
+
/**
|
|
39
|
+
* The instance's `lastSyncAt` at the moment the event was sent, or null
|
|
40
|
+
* if it has never run. A caller watching for the run to finish compares
|
|
41
|
+
* against this rather than against whatever it last rendered.
|
|
42
|
+
*/
|
|
43
|
+
lastSyncAt: string | null;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
code: ManualSyncRefusal;
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Sends `integration/manual-sync` for one instance, having checked that the
|
|
51
|
+
* instance exists and is enabled.
|
|
52
|
+
*
|
|
53
|
+
* This is the single definition of what triggering a sync *means*, shared by
|
|
54
|
+
* the `trigger_sync` MCP tool and the admin endpoint behind the Sync now
|
|
55
|
+
* button. It deliberately does not check permissions: MCP and HTTP authenticate
|
|
56
|
+
* differently and each caller applies `admin`-only itself, before calling.
|
|
57
|
+
*
|
|
58
|
+
* It fires an event and returns. The sync runs in Inngest and finishes later —
|
|
59
|
+
* an `ok` result means the run was *requested*, never that it succeeded. The
|
|
60
|
+
* outcome lands on the instance's `lastSyncAt` / `lastSyncStatus` / `lastError`
|
|
61
|
+
* when the run completes.
|
|
62
|
+
*/
|
|
63
|
+
export declare function requestManualSync(deps: RequestManualSyncDeps, args: RequestManualSyncArgs): Promise<RequestManualSyncResult>;
|
|
64
|
+
//# sourceMappingURL=manual-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manual-sync.d.ts","sourceRoot":"","sources":["../../src/sync/manual-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,4BAA4B,CAAA;AAE1D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IACpC,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB;AAC3B,gCAAgC;AAC9B,WAAW;AACb,kDAAkD;GAChD,UAAU;AACZ,wCAAwC;GACtC,aAAa,CAAA;AAEjB,MAAM,MAAM,uBAAuB,GAC/B;IACE,EAAE,EAAE,IAAI,CAAA;IACR,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3D;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,qBAAqB,EAC3B,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CA0ElC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The event every integration's manual-sync function subscribes to. Fired for
|
|
3
|
+
* *all* integrations, which is why each handler filters the payload down to
|
|
4
|
+
* its own instance rather than trusting the event.
|
|
5
|
+
*/
|
|
6
|
+
export const MANUAL_SYNC_EVENT = 'integration/manual-sync';
|
|
7
|
+
/**
|
|
8
|
+
* Sends `integration/manual-sync` for one instance, having checked that the
|
|
9
|
+
* instance exists and is enabled.
|
|
10
|
+
*
|
|
11
|
+
* This is the single definition of what triggering a sync *means*, shared by
|
|
12
|
+
* the `trigger_sync` MCP tool and the admin endpoint behind the Sync now
|
|
13
|
+
* button. It deliberately does not check permissions: MCP and HTTP authenticate
|
|
14
|
+
* differently and each caller applies `admin`-only itself, before calling.
|
|
15
|
+
*
|
|
16
|
+
* It fires an event and returns. The sync runs in Inngest and finishes later —
|
|
17
|
+
* an `ok` result means the run was *requested*, never that it succeeded. The
|
|
18
|
+
* outcome lands on the instance's `lastSyncAt` / `lastSyncStatus` / `lastError`
|
|
19
|
+
* when the run completes.
|
|
20
|
+
*/
|
|
21
|
+
export async function requestManualSync(deps, args) {
|
|
22
|
+
let doc = null;
|
|
23
|
+
try {
|
|
24
|
+
doc = (await deps.payload.findByID({
|
|
25
|
+
collection: deps.collectionSlug,
|
|
26
|
+
id: args.instanceId,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
doc = null;
|
|
31
|
+
}
|
|
32
|
+
if (!doc) {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
code: 'not-found',
|
|
36
|
+
message: `No integration instance with id "${args.instanceId}".`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const instanceName = String(doc['name']);
|
|
40
|
+
if (doc['enabled'] !== true) {
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
code: 'disabled',
|
|
44
|
+
message: `Integration "${instanceName}" is disabled. Enable it in the admin before triggering.`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const integrationType = String(doc['integrationType']);
|
|
48
|
+
try {
|
|
49
|
+
await deps.inngest.send({
|
|
50
|
+
name: MANUAL_SYNC_EVENT,
|
|
51
|
+
data: {
|
|
52
|
+
integrationId: integrationType,
|
|
53
|
+
instanceId: args.instanceId,
|
|
54
|
+
triggeredBy: args.triggeredBy ?? null,
|
|
55
|
+
reason: args.reason ?? null,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
/*
|
|
61
|
+
A failed send used to escape as an unhandled rejection, which the MCP
|
|
62
|
+
transport turned into a generic tool error and a button would have turned
|
|
63
|
+
into nothing at all — the worst outcome, because a sync that was never
|
|
64
|
+
requested looks exactly like one that has not finished yet.
|
|
65
|
+
*/
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
code: 'send-failed',
|
|
69
|
+
message: `Could not reach Inngest to queue the sync: ${error instanceof Error ? error.message : String(error)}`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// A `date` field comes back as an ISO string over REST and as a Date from
|
|
73
|
+
// the local API, and this function is called from both.
|
|
74
|
+
const rawLastSyncAt = doc['lastSyncAt'];
|
|
75
|
+
const lastSyncAt = rawLastSyncAt instanceof Date
|
|
76
|
+
? rawLastSyncAt.toISOString()
|
|
77
|
+
: typeof rawLastSyncAt === 'string'
|
|
78
|
+
? rawLastSyncAt
|
|
79
|
+
: null;
|
|
80
|
+
return {
|
|
81
|
+
ok: true,
|
|
82
|
+
instanceId: args.instanceId,
|
|
83
|
+
instanceName,
|
|
84
|
+
integrationType,
|
|
85
|
+
lastSyncAt,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=manual-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manual-sync.js","sourceRoot":"","sources":["../../src/sync/manual-sync.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAA;AA4C1D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAA2B,EAC3B,IAA2B;IAE3B,IAAI,GAAG,GAAmC,IAAI,CAAA;IAC9C,IAAI,CAAC;QACH,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;YACjC,UAAU,EAAE,IAAI,CAAC,cAAc;YAC/B,EAAE,EAAE,IAAI,CAAC,UAAU;SACpB,CAAC,CAAmC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,GAAG,GAAG,IAAI,CAAA;IACZ,CAAC;IAED,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO;YACL,EAAE,EAAE,KAAK;YACT,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,oCAAoC,IAAI,CAAC,UAAU,IAAI;SACjE,CAAA;IACH,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAExC,IAAI,GAAG,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,gBAAgB,YAAY,0DAA0D;SAChG,CAAA;IACH,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAEtD,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACtB,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE;gBACJ,aAAa,EAAE,eAAe;gBAC9B,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI;gBACrC,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;aAC5B;SACF,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf;;;;;UAKE;QACF,OAAO;YACL,EAAE,EAAE,KAAK;YACT,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,8CACP,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE;SACH,CAAA;IACH,CAAC;IAED,0EAA0E;IAC1E,wDAAwD;IACxD,MAAM,aAAa,GAAG,GAAG,CAAC,YAAY,CAAC,CAAA;IACvC,MAAM,UAAU,GACd,aAAa,YAAY,IAAI;QAC3B,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE;QAC7B,CAAC,CAAC,OAAO,aAAa,KAAK,QAAQ;YACjC,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,IAAI,CAAA;IAEZ,OAAO;QACL,EAAE,EAAE,IAAI;QACR,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,YAAY;QACZ,eAAe;QACf,UAAU;KACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { McpToolDescriptor } from '@forumone/throughline-core';
|
|
2
|
+
export declare const INTEGRATIONS_TOOLS: {
|
|
3
|
+
readonly listIntegrations: {
|
|
4
|
+
readonly name: "list_integrations";
|
|
5
|
+
readonly description: "Lists configured integration instances and their last-sync status. Use to answer \"what connections are set up?\" or \"is the webhook to Slack still working?\". Read-only.";
|
|
6
|
+
};
|
|
7
|
+
readonly getIntegrationStatus: {
|
|
8
|
+
readonly name: "get_integration_status";
|
|
9
|
+
readonly description: "Detailed status for a single integration instance — including its last sync time, last error, and current configuration metadata (config values themselves are admin-only and not returned).";
|
|
10
|
+
};
|
|
11
|
+
readonly triggerSync: {
|
|
12
|
+
readonly name: "trigger_sync";
|
|
13
|
+
readonly description: "Manually triggers an integration to send a test payload. Useful for verifying connectivity after a config change or after the integration has been failing. Admin-only because triggering an external POST is a write-side action.";
|
|
14
|
+
};
|
|
15
|
+
readonly testIntegration: {
|
|
16
|
+
readonly name: "test_integration";
|
|
17
|
+
readonly description: "Calls the integration's healthcheck. Use to answer 'is the integration reachable / configured correctly?'. Doesn't fire any system events; the test is local to the integration's healthcheck.";
|
|
18
|
+
};
|
|
19
|
+
readonly listIntegrationTypes: {
|
|
20
|
+
readonly name: "list_integration_types";
|
|
21
|
+
readonly description: "Lists the integration plugins available in this deployment. Use when answering \"what kinds of integrations are supported here?\" or before suggesting that someone add a new instance.";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** Every tool this server contributes, for the collector. */
|
|
25
|
+
export declare const INTEGRATIONS_TOOL_DESCRIPTORS: readonly McpToolDescriptor[];
|
|
26
|
+
//# sourceMappingURL=descriptors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAYnE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;CA0BuB,CAAA;AAEtD,6DAA6D;AAC7D,eAAO,MAAM,6BAA6B,EAAE,SAAS,iBAAiB,EACnC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This server's tools, by name and description, knowable without a Payload.
|
|
3
|
+
|
|
4
|
+
`@payloadcms/plugin-mcp` reads exactly these two fields while the host's config
|
|
5
|
+
is being built, to generate one per-key checkbox per tool, and denies any tool it
|
|
6
|
+
has no checkbox for. The handlers close over `payload` and the integration
|
|
7
|
+
registry, so they cannot exist that early — the names never needed to wait.
|
|
8
|
+
|
|
9
|
+
The factories below spread these, so the two cannot drift.
|
|
10
|
+
*/
|
|
11
|
+
export const INTEGRATIONS_TOOLS = {
|
|
12
|
+
listIntegrations: {
|
|
13
|
+
name: 'list_integrations',
|
|
14
|
+
description: 'Lists configured integration instances and their last-sync status. Use to answer "what connections are set up?" or "is the webhook to Slack still working?". Read-only.',
|
|
15
|
+
},
|
|
16
|
+
getIntegrationStatus: {
|
|
17
|
+
name: 'get_integration_status',
|
|
18
|
+
description: 'Detailed status for a single integration instance — including its last sync time, last error, and current configuration metadata (config values themselves are admin-only and not returned).',
|
|
19
|
+
},
|
|
20
|
+
triggerSync: {
|
|
21
|
+
name: 'trigger_sync',
|
|
22
|
+
description: 'Manually triggers an integration to send a test payload. Useful for verifying connectivity after a config change or after the integration has been failing. Admin-only because triggering an external POST is a write-side action.',
|
|
23
|
+
},
|
|
24
|
+
testIntegration: {
|
|
25
|
+
name: 'test_integration',
|
|
26
|
+
description: "Calls the integration's healthcheck. Use to answer 'is the integration reachable / configured correctly?'. Doesn't fire any system events; the test is local to the integration's healthcheck.",
|
|
27
|
+
},
|
|
28
|
+
listIntegrationTypes: {
|
|
29
|
+
name: 'list_integration_types',
|
|
30
|
+
description: 'Lists the integration plugins available in this deployment. Use when answering "what kinds of integrations are supported here?" or before suggesting that someone add a new instance.',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/** Every tool this server contributes, for the collector. */
|
|
34
|
+
export const INTEGRATIONS_TOOL_DESCRIPTORS = Object.values(INTEGRATIONS_TOOLS);
|
|
35
|
+
//# sourceMappingURL=descriptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;EASE;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,gBAAgB,EAAE;QAChB,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,yKAAyK;KAC5K;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,8LAA8L;KACjM;IACD,WAAW,EAAE;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,oOAAoO;KACvO;IACD,eAAe,EAAE;QACf,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,gMAAgM;KACnM;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,uLAAuL;KAC1L;CACmD,CAAA;AAEtD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,6BAA6B,GACxC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-integration-status.d.ts","sourceRoot":"","sources":["../../src/tools/get-integration-status.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;
|
|
1
|
+
{"version":3,"file":"get-integration-status.d.ts","sourceRoot":"","sources":["../../src/tools/get-integration-status.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;AAI9E,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,QAAA,MAAM,WAAW;;;;;;EAIf,CAAA;AAEF,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,wBAAwB,GAC7B,iBAAiB,CAAC,OAAO,WAAW,CAAC,CAgCvC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { deniedEnvelope, isIntegrationsReader } from './access.js';
|
|
3
|
+
import { INTEGRATIONS_TOOLS } from './descriptors.js';
|
|
3
4
|
const inputSchema = z.object({
|
|
4
5
|
integrationId: z
|
|
5
6
|
.string()
|
|
@@ -7,8 +8,7 @@ const inputSchema = z.object({
|
|
|
7
8
|
});
|
|
8
9
|
export function createGetIntegrationStatusTool(deps) {
|
|
9
10
|
return {
|
|
10
|
-
|
|
11
|
-
description: 'Detailed status for a single integration instance — including its last sync time, last error, and current configuration metadata (config values themselves are admin-only and not returned).',
|
|
11
|
+
...INTEGRATIONS_TOOLS.getIntegrationStatus,
|
|
12
12
|
inputSchema,
|
|
13
13
|
handler: async (input, ctx) => {
|
|
14
14
|
if (!isIntegrationsReader(ctx)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-integration-status.js","sourceRoot":"","sources":["../../src/tools/get-integration-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"get-integration-status.js","sourceRoot":"","sources":["../../src/tools/get-integration-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAOrD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,aAA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C,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW;gBAC/F,SAAS,EAAE,OAAO,GAAG,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;aAC1E,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { INTEGRATIONS_TOOLS, INTEGRATIONS_TOOL_DESCRIPTORS } from './descriptors.js';
|
|
1
2
|
export { createListIntegrationsTool } from './list-integrations.js';
|
|
2
3
|
export type { ListIntegrationsDeps } from './list-integrations.js';
|
|
3
4
|
export { createGetIntegrationStatusTool } from './get-integration-status.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AACnE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAC5E,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAC5E,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AACnE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAC5E,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAC5E,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { INTEGRATIONS_TOOLS, INTEGRATIONS_TOOL_DESCRIPTORS } from './descriptors.js';
|
|
1
2
|
export { createListIntegrationsTool } from './list-integrations.js';
|
|
2
3
|
export { createGetIntegrationStatusTool } from './get-integration-status.js';
|
|
3
4
|
export { createTriggerSyncTool } from './trigger-sync.js';
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAEnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAEnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-integration-types.d.ts","sourceRoot":"","sources":["../../src/tools/list-integration-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"list-integration-types.d.ts","sourceRoot":"","sources":["../../src/tools/list-integration-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAGzD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,mBAAmB,CAAA;CAC9B;AAED,QAAA,MAAM,WAAW,iDAAwB,CAAA;AAEzC,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,wBAAwB,GAC7B,iBAAiB,CAAC,OAAO,WAAW,CAAC,CAiBvC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { INTEGRATIONS_TOOLS } from './descriptors.js';
|
|
2
3
|
const inputSchema = z.object({}).strict();
|
|
3
4
|
export function createListIntegrationTypesTool(deps) {
|
|
4
5
|
return {
|
|
5
|
-
|
|
6
|
-
description: 'Lists the integration plugins available in this deployment. Use when answering "what kinds of integrations are supported here?" or before suggesting that someone add a new instance.',
|
|
6
|
+
...INTEGRATIONS_TOOLS.listIntegrationTypes,
|
|
7
7
|
inputSchema,
|
|
8
8
|
handler: async () => {
|
|
9
9
|
return {
|