@arbium/enterprise-agent-connect 0.1.1 → 0.1.2-dev.75145ef
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/README.md +164 -12
- package/dist/connectors/dell-techdirect/index.d.ts +8 -0
- package/dist/connectors/dell-techdirect/tools.d.ts +2 -0
- package/dist/connectors/dell-techdirect/vendor.d.ts +6 -0
- package/dist/connectors/dynamics-365/connector.json +228 -0
- package/dist/connectors/dynamics-365/index.d.ts +8 -0
- package/dist/connectors/dynamics-365/index.js +10 -0
- package/dist/connectors/dynamics-365/index.js.map +1 -0
- package/dist/connectors/dynamics-365/tools.d.ts +35 -0
- package/dist/connectors/dynamics-365/tools.js +806 -0
- package/dist/connectors/dynamics-365/tools.js.map +1 -0
- package/dist/connectors/dynamics-365/vendor.d.ts +9 -0
- package/dist/connectors/dynamics-365/vendor.js +110 -0
- package/dist/connectors/dynamics-365/vendor.js.map +1 -0
- package/dist/connectors/entra/index.d.ts +2 -0
- package/dist/connectors/entra/tools.d.ts +14 -0
- package/dist/connectors/fedex/index.d.ts +8 -0
- package/dist/connectors/fedex/tools.d.ts +3 -0
- package/dist/connectors/fedex/vendor.d.ts +7 -0
- package/dist/connectors/gong/connector.json +127 -0
- package/dist/connectors/gong/index.d.ts +8 -0
- package/dist/connectors/gong/index.js +7 -0
- package/dist/connectors/gong/index.js.map +1 -0
- package/dist/connectors/gong/tools.d.ts +8 -0
- package/dist/connectors/gong/tools.js +424 -0
- package/dist/connectors/gong/tools.js.map +1 -0
- package/dist/connectors/gong/vendor.d.ts +4 -0
- package/dist/connectors/gong/vendor.js +89 -0
- package/dist/connectors/gong/vendor.js.map +1 -0
- package/dist/connectors/http/index.d.ts +34 -0
- package/dist/connectors/http/index.js +154 -64
- package/dist/connectors/http/index.js.map +1 -1
- package/dist/connectors/intune/index.d.ts +2 -0
- package/dist/connectors/intune/tools.d.ts +12 -0
- package/dist/connectors/jamf/connector.json +182 -0
- package/dist/connectors/jamf/index.d.ts +8 -0
- package/dist/connectors/jamf/index.js +7 -0
- package/dist/connectors/jamf/index.js.map +1 -0
- package/dist/connectors/jamf/tools.d.ts +7 -0
- package/dist/connectors/jamf/tools.js +659 -0
- package/dist/connectors/jamf/tools.js.map +1 -0
- package/dist/connectors/jamf/vendor.d.ts +5 -0
- package/dist/connectors/jamf/vendor.js +70 -0
- package/dist/connectors/jamf/vendor.js.map +1 -0
- package/dist/connectors/jira/connector.json +146 -3
- package/dist/connectors/jira/index.d.ts +8 -0
- package/dist/connectors/jira/jql.d.ts +4 -0
- package/dist/connectors/jira/tools.d.ts +3 -0
- package/dist/connectors/jira/vendor.d.ts +3 -0
- package/dist/connectors/jira/vendor.js +8 -2
- package/dist/connectors/jira/vendor.js.map +1 -1
- package/dist/connectors/microsoft/client.d.ts +66 -0
- package/dist/connectors/microsoft/client.js +26 -8
- package/dist/connectors/microsoft/client.js.map +1 -1
- package/dist/connectors/netsuite/connector.json +317 -0
- package/dist/connectors/netsuite/index.d.ts +8 -0
- package/dist/connectors/netsuite/index.js +7 -0
- package/dist/connectors/netsuite/index.js.map +1 -0
- package/dist/connectors/netsuite/tools.d.ts +24 -0
- package/dist/connectors/netsuite/tools.js +447 -0
- package/dist/connectors/netsuite/tools.js.map +1 -0
- package/dist/connectors/netsuite/vendor.d.ts +26 -0
- package/dist/connectors/netsuite/vendor.js +247 -0
- package/dist/connectors/netsuite/vendor.js.map +1 -0
- package/dist/connectors/odata/index.d.ts +33 -0
- package/dist/connectors/odata/index.js +460 -0
- package/dist/connectors/odata/index.js.map +1 -0
- package/dist/connectors/okta/connector.json +194 -0
- package/dist/connectors/okta/index.d.ts +8 -0
- package/dist/connectors/okta/index.js +7 -0
- package/dist/connectors/okta/index.js.map +1 -0
- package/dist/connectors/okta/tools.d.ts +6 -0
- package/dist/connectors/okta/tools.js +429 -0
- package/dist/connectors/okta/tools.js.map +1 -0
- package/dist/connectors/okta/vendor.d.ts +14 -0
- package/dist/connectors/okta/vendor.js +204 -0
- package/dist/connectors/okta/vendor.js.map +1 -0
- package/dist/connectors/outlook-calendar/index.d.ts +2 -0
- package/dist/connectors/outlook-calendar/tools.d.ts +65 -0
- package/dist/connectors/outlook-mail/index.d.ts +2 -0
- package/dist/connectors/outlook-mail/tools.d.ts +8 -0
- package/dist/connectors/salesforce/index.d.ts +8 -0
- package/dist/connectors/salesforce/soql.d.ts +3 -0
- package/dist/connectors/salesforce/tools.d.ts +9 -0
- package/dist/connectors/salesforce/vendor.d.ts +3 -0
- package/dist/connectors/salesforce/vendor.js +9 -3
- package/dist/connectors/salesforce/vendor.js.map +1 -1
- package/dist/connectors/sap-s4hana/connector.json +264 -0
- package/dist/connectors/sap-s4hana/index.d.ts +8 -0
- package/dist/connectors/sap-s4hana/index.js +7 -0
- package/dist/connectors/sap-s4hana/index.js.map +1 -0
- package/dist/connectors/sap-s4hana/tools.d.ts +4 -0
- package/dist/connectors/sap-s4hana/tools.js +761 -0
- package/dist/connectors/sap-s4hana/tools.js.map +1 -0
- package/dist/connectors/sap-s4hana/vendor.d.ts +5 -0
- package/dist/connectors/sap-s4hana/vendor.js +176 -0
- package/dist/connectors/sap-s4hana/vendor.js.map +1 -0
- package/dist/connectors/servicenow/connector.json +228 -0
- package/dist/connectors/servicenow/index.d.ts +8 -0
- package/dist/connectors/servicenow/index.js +7 -0
- package/dist/connectors/servicenow/index.js.map +1 -0
- package/dist/connectors/servicenow/tools.d.ts +4 -0
- package/dist/connectors/servicenow/tools.js +884 -0
- package/dist/connectors/servicenow/tools.js.map +1 -0
- package/dist/connectors/servicenow/vendor.d.ts +3 -0
- package/dist/connectors/servicenow/vendor.js +106 -0
- package/dist/connectors/servicenow/vendor.js.map +1 -0
- package/dist/connectors/sharepoint-files/excel.d.ts +16 -0
- package/dist/connectors/sharepoint-files/index.d.ts +8 -0
- package/dist/connectors/sharepoint-files/index.js.map +1 -1
- package/dist/connectors/sharepoint-files/tools.d.ts +52 -0
- package/dist/connectors/sharepoint-files/vendor.d.ts +11 -0
- package/dist/connectors/slack/connector.json +148 -0
- package/dist/connectors/slack/index.d.ts +8 -0
- package/dist/connectors/slack/index.js +7 -0
- package/dist/connectors/slack/index.js.map +1 -0
- package/dist/connectors/slack/tools.d.ts +3 -0
- package/dist/connectors/slack/tools.js +355 -0
- package/dist/connectors/slack/tools.js.map +1 -0
- package/dist/connectors/slack/vendor.d.ts +17 -0
- package/dist/connectors/slack/vendor.js +189 -0
- package/dist/connectors/slack/vendor.js.map +1 -0
- package/dist/connectors/soap/index.d.ts +16 -0
- package/dist/connectors/soap/index.js +248 -0
- package/dist/connectors/soap/index.js.map +1 -0
- package/dist/connectors/soap/xml.d.ts +12 -0
- package/dist/connectors/soap/xml.js +126 -0
- package/dist/connectors/soap/xml.js.map +1 -0
- package/dist/connectors/sql/engines.d.ts +58 -0
- package/dist/connectors/sql/engines.js +292 -0
- package/dist/connectors/sql/engines.js.map +1 -0
- package/dist/connectors/sql/index.d.ts +16 -0
- package/dist/connectors/sql/index.js +214 -0
- package/dist/connectors/sql/index.js.map +1 -0
- package/dist/connectors/teams/index.d.ts +2 -0
- package/dist/connectors/teams/tools.d.ts +7 -0
- package/dist/connectors/teams/tools.js +3 -2
- package/dist/connectors/teams/tools.js.map +1 -1
- package/dist/connectors/workday/connector.json +188 -0
- package/dist/connectors/workday/index.d.ts +8 -0
- package/dist/connectors/workday/index.js +7 -0
- package/dist/connectors/workday/index.js.map +1 -0
- package/dist/connectors/workday/tools.d.ts +33 -0
- package/dist/connectors/workday/tools.js +410 -0
- package/dist/connectors/workday/tools.js.map +1 -0
- package/dist/connectors/workday/vendor.d.ts +18 -0
- package/dist/connectors/workday/vendor.js +199 -0
- package/dist/connectors/workday/vendor.js.map +1 -0
- package/dist/packages/connector-kit/src/branding.d.ts +57 -0
- package/dist/packages/connector-kit/src/certificate.d.ts +19 -0
- package/dist/packages/connector-kit/src/common.d.ts +36 -0
- package/dist/packages/connector-kit/src/common.js +4 -1
- package/dist/packages/connector-kit/src/common.js.map +1 -1
- package/dist/packages/connector-kit/src/connector.d.ts +1356 -0
- package/dist/packages/connector-kit/src/connector.js +634 -53
- package/dist/packages/connector-kit/src/connector.js.map +1 -1
- package/dist/packages/connector-kit/src/fetch.d.ts +6 -0
- package/dist/packages/connector-kit/src/fetch.js +44 -0
- package/dist/packages/connector-kit/src/fetch.js.map +1 -0
- package/dist/packages/connector-kit/src/index.d.ts +5 -0
- package/dist/packages/connector-kit/src/index.js +6 -0
- package/dist/packages/connector-kit/src/index.js.map +1 -0
- package/dist/packages/connector-kit/src/oauth.d.ts +15 -0
- package/dist/packages/connector-kit/src/oauth.js +25 -6
- package/dist/packages/connector-kit/src/oauth.js.map +1 -1
- package/dist/packages/connector-kit/src/types.d.ts +87 -0
- package/dist/packages/connector-kit/src/types.js.map +1 -1
- package/dist/packages/server/migrations/0007_app_events.sql +110 -0
- package/dist/packages/server/migrations/rollback/to-legacy.sql +3 -0
- package/dist/packages/server/src/api.d.ts +3730 -0
- package/dist/packages/server/src/api.js +137 -1
- package/dist/packages/server/src/api.js.map +1 -1
- package/dist/packages/server/src/app.d.ts +23 -0
- package/dist/packages/server/src/app.js +24 -1
- package/dist/packages/server/src/app.js.map +1 -1
- package/dist/packages/server/src/builtin.d.ts +5 -0
- package/dist/packages/server/src/builtin.js +18 -0
- package/dist/packages/server/src/builtin.js.map +1 -1
- package/dist/packages/server/src/consent.d.ts +27 -0
- package/dist/packages/server/src/events/admin.d.ts +156 -0
- package/dist/packages/server/src/events/admin.js +255 -0
- package/dist/packages/server/src/events/admin.js.map +1 -0
- package/dist/packages/server/src/events/deliver.d.ts +43 -0
- package/dist/packages/server/src/events/deliver.js +129 -0
- package/dist/packages/server/src/events/deliver.js.map +1 -0
- package/dist/packages/server/src/events/runtime.d.ts +28 -0
- package/dist/packages/server/src/events/runtime.js +404 -0
- package/dist/packages/server/src/events/runtime.js.map +1 -0
- package/dist/packages/server/src/events/store.d.ts +172 -0
- package/dist/packages/server/src/events/store.js +275 -0
- package/dist/packages/server/src/events/store.js.map +1 -0
- package/dist/packages/server/src/index.d.ts +40 -0
- package/dist/packages/server/src/index.js +68 -11
- package/dist/packages/server/src/index.js.map +1 -1
- package/dist/packages/server/src/migrate.d.ts +11 -0
- package/dist/packages/server/src/openapi.d.ts +4 -0
- package/dist/packages/server/src/openapi.js +2 -2
- package/dist/packages/server/src/openapi.js.map +1 -1
- package/dist/packages/server/src/queue.d.ts +10 -0
- package/dist/packages/server/src/queue.js +45 -0
- package/dist/packages/server/src/queue.js.map +1 -0
- package/dist/packages/server/src/secrets.d.ts +19 -0
- package/dist/packages/server/src/server.d.ts +1 -0
- package/dist/packages/server/src/server.js +14 -1
- package/dist/packages/server/src/server.js.map +1 -1
- package/dist/packages/server/src/service.d.ts +767 -0
- package/dist/packages/server/src/service.js +19 -3
- package/dist/packages/server/src/service.js.map +1 -1
- package/dist/packages/server/src/store.d.ts +157 -0
- package/dist/packages/server/src/store.js +4 -0
- package/dist/packages/server/src/store.js.map +1 -1
- package/dist/packages/server/src/teams/activity.d.ts +123 -0
- package/dist/packages/server/src/teams/activity.js +6 -5
- package/dist/packages/server/src/teams/activity.js.map +1 -1
- package/dist/packages/server/src/teams/admin.d.ts +335 -0
- package/dist/packages/server/src/teams/admin.js +1 -1
- package/dist/packages/server/src/teams/admin.js.map +1 -1
- package/dist/packages/server/src/teams/approval.d.ts +57 -0
- package/dist/packages/server/src/teams/bot.d.ts +25 -0
- package/dist/packages/server/src/teams/claude.d.ts +46 -0
- package/dist/packages/server/src/teams/jwt.d.ts +17 -0
- package/dist/packages/server/src/teams/package.d.ts +79 -0
- package/dist/packages/server/src/teams/provision.d.ts +84 -0
- package/dist/packages/server/src/teams/runner.d.ts +80 -0
- package/dist/packages/server/src/teams/runner.js +50 -6
- package/dist/packages/server/src/teams/runner.js.map +1 -1
- package/dist/packages/server/src/teams/runtime.d.ts +91 -0
- package/dist/packages/server/src/teams/runtime.js +25 -47
- package/dist/packages/server/src/teams/runtime.js.map +1 -1
- package/dist/packages/server/src/teams/store.d.ts +233 -0
- package/package.json +28 -2
package/README.md
CHANGED
|
@@ -5,17 +5,27 @@ grant it. Agents reach the apps through one MCP endpoint; every call is checked
|
|
|
5
5
|
agent's grants and written to an audit log. Agents never hold the apps' credentials.
|
|
6
6
|
|
|
7
7
|
- **Built-in apps:** Jira, Microsoft 365 (Outlook mail and calendar, SharePoint files and Excel,
|
|
8
|
-
Teams, Entra ID, Intune), Salesforce,
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Teams, Entra ID, Intune, Dynamics 365), Jamf Pro, Okta, Slack, Salesforce, Gong, SAP S/4HANA,
|
|
9
|
+
Oracle NetSuite, ServiceNow, Workday, FedEx, Dell TechDirect.
|
|
10
|
+
- **Your own apps without code:** describe an internal REST API or a SaaS app's in one
|
|
11
|
+
`connector.json`, or draft one from its OpenAPI spec
|
|
12
|
+
([docs/http-connector.md](docs/http-connector.md)); a SOAP service
|
|
13
|
+
([docs/soap-connector.md](docs/soap-connector.md)) or an OData service such as SAP S/4HANA,
|
|
14
|
+
Dynamics 365 or SuccessFactors ([docs/odata-connector.md](docs/odata-connector.md)), drafted
|
|
15
|
+
from its WSDL or `$metadata`; or a database (PostgreSQL, SQL Server, MySQL, MariaDB, Oracle)
|
|
16
|
+
as named queries ([docs/sql-connector.md](docs/sql-connector.md)).
|
|
11
17
|
- **Per-agent access:** tick what each agent can do per app, and limit it to values (mailboxes,
|
|
12
18
|
sites, projects, customers). Anything that deletes needs an explicit confirmation.
|
|
19
|
+
- **Agents started by app events:** a Jira issue created or updated starts the agents you choose,
|
|
20
|
+
each within its own limits, by webhook or by polling apps that cannot send one
|
|
21
|
+
([docs/triggers.md](docs/triggers.md)).
|
|
13
22
|
- **Self-hosted:** one Node service and Postgres. No UI ships; the admin API
|
|
14
23
|
(`packages/server/openapi.json`) and the typed client (`packages/client`) are for building
|
|
15
24
|
your own admin pages.
|
|
16
25
|
|
|
17
26
|
How it is secured: [docs/security.md](docs/security.md). Adding apps:
|
|
18
|
-
[docs/connectors.md](docs/connectors.md).
|
|
27
|
+
[docs/connectors.md](docs/connectors.md). Running it next to internal systems (your own
|
|
28
|
+
certificate authority, a proxy in front): [docs/inside-your-network.md](docs/inside-your-network.md).
|
|
19
29
|
|
|
20
30
|
## Quick start (about 10 minutes)
|
|
21
31
|
|
|
@@ -81,27 +91,169 @@ delete the database too).
|
|
|
81
91
|
**Going further:** connect a real app from `GET /agent-connect/admin/v1/connectors` (each one
|
|
82
92
|
lists its setup steps, as click paths and as commands), add your own app
|
|
83
93
|
([docs/http-connector.md](docs/http-connector.md)), or embed the service in your own Node app
|
|
84
|
-
|
|
85
|
-
@arbium/enterprise-agent-connect`; the typed admin client is `@arbium/enterprise-agent-connect-client`).
|
|
94
|
+
(below).
|
|
86
95
|
|
|
87
|
-
Only `/agent-connect/mcp` and `/agent-connect/
|
|
96
|
+
Only `/agent-connect/mcp`, `/agent-connect/teams` and `/agent-connect/events` may be public. The admin API refuses any
|
|
88
97
|
request that carries `X-Forwarded-For`, so never route it through a public load balancer.
|
|
89
98
|
|
|
99
|
+
## Use it in your code
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
npm install @arbium/enterprise-agent-connect @arbium/enterprise-agent-connect-client
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Both packages ship TypeScript types. Every snippet here is run by `scripts/consumer-test.sh`
|
|
106
|
+
(full files: `scripts/consumer/`) against the packed packages, in CI.
|
|
107
|
+
|
|
108
|
+
**Embed the service.** One instance per process, in a module of its own:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { builtinConnectors, createAgentConnect } from "@arbium/enterprise-agent-connect";
|
|
112
|
+
|
|
113
|
+
export const eac = await createAgentConnect({
|
|
114
|
+
database: { url: process.env.DATABASE_URL! }, // or a postgres.js instance
|
|
115
|
+
encryptionKey: process.env.CONNECT_ENCRYPTION_KEY!,
|
|
116
|
+
adminToken: process.env.AGENT_CONNECT_ADMIN_TOKEN!,
|
|
117
|
+
connectors: [...builtinConnectors, orders, inventory], // default: every built-in app
|
|
118
|
+
});
|
|
119
|
+
eac.start(); // the Teams and app event workers; await eac.stop() on shutdown
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`connectors` is the list of apps this deployment offers. Leave it out for every built-in app;
|
|
123
|
+
pass `builtinConnectors.filter((c) => ["jira", "fedex"].includes(c.id))` for only some.
|
|
124
|
+
|
|
125
|
+
`eac.fetch` is a plain `(Request) => Promise<Response>` serving `/agent-connect/*`. Mount it at
|
|
126
|
+
that path, before any body parser (Express and plain Node use `@hono/node-server`):
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
// Hono
|
|
130
|
+
app.all("/agent-connect/*", (c) => eac.fetch(c.req.raw));
|
|
131
|
+
|
|
132
|
+
// Express 5
|
|
133
|
+
import { getRequestListener } from "@hono/node-server";
|
|
134
|
+
app.all("/agent-connect/*splat", getRequestListener(eac.fetch));
|
|
135
|
+
|
|
136
|
+
// Next.js: app/agent-connect/[...path]/route.ts (Node runtime)
|
|
137
|
+
const handler = (req: Request) => eac.fetch(req);
|
|
138
|
+
export { handler as GET, handler as POST, handler as PUT, handler as PATCH, handler as DELETE };
|
|
139
|
+
|
|
140
|
+
// Plain Node
|
|
141
|
+
import { serve } from "@hono/node-server";
|
|
142
|
+
serve({ fetch: eac.fetch, port: 3000 });
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**The typed admin client.** The admin API refuses requests that came through a load balancer
|
|
146
|
+
(`X-Forwarded-For`), so call it from your server, over the network or in the same process
|
|
147
|
+
(behind a proxy: [docs/inside-your-network.md](docs/inside-your-network.md)):
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { createClient } from "@arbium/enterprise-agent-connect-client";
|
|
151
|
+
|
|
152
|
+
const admin = createClient({ baseUrl: "http://localhost:3000", token: process.env.AGENT_CONNECT_ADMIN_TOKEN! });
|
|
153
|
+
// In the same process as eac, with no network hop:
|
|
154
|
+
// createClient({ baseUrl: "http://agent-connect", token, fetch: (input, init) => eac.fetch(new Request(input, init)) })
|
|
155
|
+
|
|
156
|
+
const org = await admin.organizations.create("Example Org");
|
|
157
|
+
await admin.connect(org.id, "orders", {
|
|
158
|
+
capabilities: ["read"],
|
|
159
|
+
fields: { api_key: "example-key" },
|
|
160
|
+
connectedBy: "Example Admin",
|
|
161
|
+
});
|
|
162
|
+
const { agent, key } = await admin.createAgent(org.id, { name: "demo", createdBy: "Example Admin" });
|
|
163
|
+
await admin.setGrant(org.id, agent.id, "orders", ["read"], { customers: ["acme"] }, "Example Admin");
|
|
164
|
+
const rows = await admin.audit(org.id, { agent: agent.id });
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Your own app, no code.** Pass a connector definition with an `http` block
|
|
168
|
+
([docs/http-connector.md](docs/http-connector.md)), or a `soap` or `odata` block, straight into
|
|
169
|
+
`connectors`. It is checked like
|
|
170
|
+
a `connector.json`; the type is `ConnectorJson`:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
import type { ConnectorJson } from "@arbium/enterprise-agent-connect";
|
|
174
|
+
|
|
175
|
+
const orders: ConnectorJson = {
|
|
176
|
+
id: "orders",
|
|
177
|
+
name: "Orders",
|
|
178
|
+
// ...setup steps, fields, capabilities, limits and verify, as in a connector.json
|
|
179
|
+
http: {
|
|
180
|
+
baseUrl: "https://orders.internal.example.com/api",
|
|
181
|
+
auth: { type: "header", header: "X-Api-Key", value: "api_key" },
|
|
182
|
+
tools: [{ name: "orders_get", description: "Read one order by its id.", method: "GET", path: "/orders/{id}",
|
|
183
|
+
params: { id: { type: "string", description: "The order id", in: "path" } } }],
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Your own app, as code.** Build a `ConnectorModule` on the connector kit and give it its
|
|
189
|
+
definition as `connector` ([docs/connectors.md](docs/connectors.md)). `create` gets a
|
|
190
|
+
`ConnectorContext`, `{ connector }`: the definition parsed, with the branding filled in.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { z } from "zod";
|
|
194
|
+
import { audited, Denied, json, listLimit, type ConnectorModule } from "@arbium/enterprise-agent-connect/kit";
|
|
195
|
+
|
|
196
|
+
const inventory: ConnectorModule = {
|
|
197
|
+
id: "inventory",
|
|
198
|
+
connector: { id: "inventory", /* ...the rest of its connector.json */ },
|
|
199
|
+
create: () => ({
|
|
200
|
+
vendor: { connect: async (fields) => ({ ... }), call: async (connection, request) => ({ ... }) },
|
|
201
|
+
toolset: {
|
|
202
|
+
names: ["inventory_get_stock"],
|
|
203
|
+
register(server, ctx, allowed) {
|
|
204
|
+
if (allowed.has("inventory_get_stock"))
|
|
205
|
+
server.registerTool("inventory_get_stock",
|
|
206
|
+
{ description: "How many of one item are in stock.", inputSchema: z.object({ sku: z.string() }) },
|
|
207
|
+
({ sku }) => audited(ctx, "inventory_get_stock", sku, async (mark) => {
|
|
208
|
+
const skus = listLimit(ctx.limits, "skus");
|
|
209
|
+
if (skus && !skus.includes(sku)) throw new Denied(`This agent may not read ${sku}`);
|
|
210
|
+
const res = await ctx.call({ method: "GET", path: `/stock/${encodeURIComponent(sku)}` });
|
|
211
|
+
mark(res.status);
|
|
212
|
+
return json(res.data);
|
|
213
|
+
}));
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
}),
|
|
217
|
+
};
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Connect an agent.** Each agent uses its own key (`key` above) on one MCP endpoint,
|
|
221
|
+
`<your origin>/agent-connect/mcp`:
|
|
222
|
+
|
|
223
|
+
- Claude Code: `claude mcp add --transport http agent-connect https://agents.example.com/agent-connect/mcp --header "Authorization: Bearer $KEY"`
|
|
224
|
+
- The Claude API's MCP connector (beta `mcp-client-2025-11-20`): `mcp_servers: [{ type: "url", url: "https://agents.example.com/agent-connect/mcp", name: "agent-connect", authorization_token: key }]` with `tools: [{ type: "mcp_toolset", mcp_server_name: "agent-connect" }]`. The endpoint must be reachable from the internet.
|
|
225
|
+
- Claude Managed Agents: a vault `static_bearer` credential holding the key, keyed on the same URL.
|
|
226
|
+
- Any MCP client over Streamable HTTP: `Authorization: Bearer <key>`; the quick start's `curl` shows the raw call.
|
|
227
|
+
|
|
90
228
|
## Kubernetes
|
|
91
229
|
|
|
92
|
-
|
|
93
|
-
|
|
230
|
+
To offer only some built-in apps, set `BUILTIN_APPS` to their ids, comma-separated (for example
|
|
231
|
+
`jira,servicenow,sap-s4hana`; `GET /agent-connect/admin/v1/connectors` lists every id). Unset, every
|
|
232
|
+
built-in app is offered. Apps you add with `CONNECTOR_DIRS` are always offered.
|
|
233
|
+
|
|
234
|
+
`deploy/helm/agent-connect` is a small chart: one replica (Teams and app event run limits are
|
|
235
|
+
counted in one process), a Service, and an optional Ingress with only the public paths. It needs the image
|
|
94
236
|
(`image.repository`, `image.tag`; releases are `ghcr.io/try-caret/enterprise-agent-connect:<version>`) and a Secret with `DATABASE_URL`, `CONNECT_ENCRYPTION_KEY`
|
|
95
|
-
and `AGENT_CONNECT_ADMIN_TOKEN` (`existingSecret`).
|
|
237
|
+
and `AGENT_CONNECT_ADMIN_TOKEN` (`existingSecret`). For apps whose certificates your own
|
|
238
|
+
authority signed, name a ConfigMap or Secret holding its bundle in `caBundle`
|
|
239
|
+
([docs/inside-your-network.md](docs/inside-your-network.md)).
|
|
96
240
|
|
|
97
241
|
## Layout
|
|
98
242
|
|
|
99
|
-
- `packages/server`: the service (HTTP, admin API, MCP, Teams, store,
|
|
243
|
+
- `packages/server`: the service (HTTP, admin API, MCP, Teams, app events, store,
|
|
244
|
+
migrations) and its tests
|
|
100
245
|
- `packages/connector-kit`: what a connector builds on (schemas, tool helpers, vendor types)
|
|
101
246
|
- `packages/client`: typed admin API client
|
|
102
247
|
- `connectors/<app>`: one folder per app: `connector.json`, `index.ts`, `tools.ts`, `vendor.ts`
|
|
103
|
-
- `connectors/http`:
|
|
248
|
+
- `connectors/http`, `connectors/soap`, `connectors/odata`, `connectors/sql`: run any app
|
|
249
|
+
described only in its `connector.json` (docs/http-connector.md, docs/soap-connector.md,
|
|
250
|
+
docs/odata-connector.md, docs/sql-connector.md)
|
|
104
251
|
- `examples/internal-app`: a small internal API and its connector, for the quick start
|
|
252
|
+
- `scripts/openapi-to-connector.ts`: drafts an http connector from an OpenAPI 3.x spec
|
|
253
|
+
- `examples/legacy-apps`: a SOAP and an SAP OData connector, described only in JSON
|
|
254
|
+
- `scripts/wsdl-to-connector.ts`, `scripts/odata-to-connector.ts`: draft a connector from a WSDL
|
|
255
|
+
or an OData `$metadata`
|
|
256
|
+
- `examples/legacy-orders`: a small orders database and its connector
|
|
105
257
|
- `deploy/docker`, `deploy/helm`: image, Compose file and chart
|
|
106
258
|
|
|
107
259
|
## License
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Fetch, type Vendor } from "../../packages/connector-kit/src/types.js";
|
|
2
|
+
export declare const DELL_API = "https://apigtwb2c.us.dell.com";
|
|
3
|
+
export declare const DELL_TOKEN_URL = "https://apigtwb2c.us.dell.com/auth/oauth/v2/token";
|
|
4
|
+
export declare const ENTITLEMENTS_PATH = "/PROD/sbil/eapi/v5/asset-entitlements";
|
|
5
|
+
export declare const PROBE_SERVICE_TAG = "0000000";
|
|
6
|
+
export declare function dellVendor(fetchImpl?: Fetch): Vendor;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "dynamics-365",
|
|
3
|
+
"name": "Dynamics 365",
|
|
4
|
+
"description": "Let agents work with your Dynamics 365 customers, opportunities and cases: find and update accounts and contacts, close opportunities, resolve cases, add notes, tasks and phone calls, and read other tables you list.",
|
|
5
|
+
"logo": "/brand/registry/dynamics-365.svg",
|
|
6
|
+
"identity": "Your Microsoft app registration, through the Microsoft connection, added to one Dynamics 365 environment as an application user. It reaches only what its security role allows. Each API key can be kept to records of chosen business units or teams.",
|
|
7
|
+
"provider": "microsoft",
|
|
8
|
+
"order": 8,
|
|
9
|
+
"accountKey": "environment",
|
|
10
|
+
"connectionKind": "guided",
|
|
11
|
+
"scopes": ["prvReadUser"],
|
|
12
|
+
"setup": [
|
|
13
|
+
{
|
|
14
|
+
"title": "Create a security role for agents",
|
|
15
|
+
"body": "In your Dynamics 365 environment, create a role that gives only what agents need: {scopes}. Each is a privilege on a table, for example prvReadAccount is Read on Account and prvCreateActivity is Create on Activity. Choose Organization access to let agents reach every record, or Business Unit to keep them to one business unit. You can keep each agent to some business units or teams here later.",
|
|
16
|
+
"link": {
|
|
17
|
+
"label": "Open Power Platform admin center",
|
|
18
|
+
"href": "https://admin.powerplatform.microsoft.com/environments"
|
|
19
|
+
},
|
|
20
|
+
"click": [
|
|
21
|
+
"In the Power Platform admin center, go to Manage, then Environments, and open your environment.",
|
|
22
|
+
"Select Settings, then Users + permissions, then Security roles, and select New role.",
|
|
23
|
+
"Name it {brand.microsoft.appName} agents, keep the root business unit and select Save.",
|
|
24
|
+
"For each privilege above, find its table (Account, Contact, Opportunity, Case, Activity, Note, User) and set that privilege's access level. Leave everything else at None and select Save."
|
|
25
|
+
],
|
|
26
|
+
"copy": [
|
|
27
|
+
"# Needs the Azure CLI, signed in as a Dynamics 365 system administrator. Replace the address with your environment URL.",
|
|
28
|
+
"$environment = 'https://your-org.crm.dynamics.com'",
|
|
29
|
+
"$api = \"$environment/api/data/v9.2\"",
|
|
30
|
+
"$headers = @{ Authorization = \"Bearer $(az account get-access-token --resource $environment --query accessToken -o tsv)\"; 'Content-Type' = 'application/json' }",
|
|
31
|
+
"$root = (Invoke-RestMethod -Headers $headers \"$api/businessunits?`$filter=_parentbusinessunitid_value eq null&`$select=businessunitid\").value[0].businessunitid",
|
|
32
|
+
"$role = Invoke-RestMethod -Method Post -Headers ($headers + @{ Prefer = 'return=representation' }) \"$api/roles\" -Body (@{ name = '{brand.microsoft.appName} agents'; 'businessunitid@odata.bind' = \"/businessunits($root)\" } | ConvertTo-Json)",
|
|
33
|
+
"# Global is Organization access; use Local to keep agents to the business unit.",
|
|
34
|
+
"$names = @(",
|
|
35
|
+
" '{scope}'",
|
|
36
|
+
")",
|
|
37
|
+
"$privileges = foreach ($name in $names) { @{ PrivilegeId = (Invoke-RestMethod -Headers $headers \"$api/privileges?`$filter=name eq '$name'&`$select=privilegeid\").value[0].privilegeid; Depth = 'Global'; BusinessUnitId = $root } }",
|
|
38
|
+
"Invoke-RestMethod -Method Post -Headers $headers \"$api/roles($($role.roleid))/Microsoft.Dynamics.CRM.AddPrivilegesRole\" -Body (@{ Privileges = @($privileges) } | ConvertTo-Json -Depth 4)"
|
|
39
|
+
],
|
|
40
|
+
"shell": "powershell"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"title": "Add the app as an application user",
|
|
44
|
+
"body": "Agents act as this application user. It needs no license, and the app needs no API permission in Microsoft Entra for this: what agents can reach is what the security role allows. Use the Application (client) ID {clientId}. With Commands, the application user goes to your own business unit.",
|
|
45
|
+
"click": [
|
|
46
|
+
"In the environment, select Settings, then Users + permissions, then Application users.",
|
|
47
|
+
"Select New app user, then Add an app, search for {clientId} and select Add.",
|
|
48
|
+
"Choose the business unit agents work in (the root one reaches every unit the role allows).",
|
|
49
|
+
"Under Security roles select the pencil, choose {brand.microsoft.appName} agents, then select Save and Create."
|
|
50
|
+
],
|
|
51
|
+
"copy": [
|
|
52
|
+
"# Needs the Power Platform CLI (pac). Replace the address with your environment URL.",
|
|
53
|
+
"$environment = 'https://your-org.crm.dynamics.com'",
|
|
54
|
+
"pac auth create --environment $environment",
|
|
55
|
+
"pac admin assign-user --environment $environment --user '{clientId}' --role '{brand.microsoft.appName} agents' --application-user"
|
|
56
|
+
],
|
|
57
|
+
"shell": "powershell"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"title": "Copy the environment URL",
|
|
61
|
+
"body": "The address of the environment agents will use, such as https://your-org.crm.dynamics.com. Enter it below.",
|
|
62
|
+
"click": [
|
|
63
|
+
"In the Power Platform admin center, go to Manage, then Environments, and open your environment.",
|
|
64
|
+
"Copy the Environment URL from its Details."
|
|
65
|
+
],
|
|
66
|
+
"copy": ["pac admin list"],
|
|
67
|
+
"shell": "powershell"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"afterConnect": [],
|
|
71
|
+
"fields": [
|
|
72
|
+
{
|
|
73
|
+
"id": "environment",
|
|
74
|
+
"label": "Environment URL",
|
|
75
|
+
"help": "From the environment's Details in the Power Platform admin center.",
|
|
76
|
+
"placeholder": "https://your-org.crm.dynamics.com",
|
|
77
|
+
"secret": false
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"capabilities": [
|
|
81
|
+
{
|
|
82
|
+
"id": "read_customers",
|
|
83
|
+
"label": "Read accounts and contacts",
|
|
84
|
+
"description": "Find accounts and contacts and read their details.",
|
|
85
|
+
"scopes": ["prvReadAccount", "prvReadContact"],
|
|
86
|
+
"permissions": [],
|
|
87
|
+
"tools": ["dynamics_search_customers", "dynamics_get_customer"],
|
|
88
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": "write_customers",
|
|
92
|
+
"label": "Create and update accounts and contacts",
|
|
93
|
+
"description": "Add accounts and contacts and change their details, such as phone numbers and addresses.",
|
|
94
|
+
"scopes": [
|
|
95
|
+
"prvReadAccount",
|
|
96
|
+
"prvCreateAccount",
|
|
97
|
+
"prvWriteAccount",
|
|
98
|
+
"prvAppendToAccount",
|
|
99
|
+
"prvReadContact",
|
|
100
|
+
"prvCreateContact",
|
|
101
|
+
"prvWriteContact",
|
|
102
|
+
"prvAppendContact"
|
|
103
|
+
],
|
|
104
|
+
"permissions": [],
|
|
105
|
+
"tools": ["dynamics_create_customer", "dynamics_update_customer"],
|
|
106
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}."
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "read_opportunities",
|
|
110
|
+
"label": "Read opportunities",
|
|
111
|
+
"description": "Find opportunities and read their value, stage, close date and status.",
|
|
112
|
+
"scopes": ["prvReadOpportunity"],
|
|
113
|
+
"permissions": [],
|
|
114
|
+
"tools": ["dynamics_search_opportunities", "dynamics_get_opportunity"],
|
|
115
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}."
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": "close_opportunities",
|
|
119
|
+
"label": "Close opportunities as won or lost",
|
|
120
|
+
"description": "Close open opportunities, with a reason and, for a win, the actual revenue.",
|
|
121
|
+
"scopes": ["prvReadOpportunity", "prvWriteOpportunity", "prvCreateActivity"],
|
|
122
|
+
"permissions": [],
|
|
123
|
+
"tools": ["dynamics_close_opportunity"],
|
|
124
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "read_cases",
|
|
128
|
+
"label": "Read cases",
|
|
129
|
+
"description": "Find customer service cases and read their status, priority and description.",
|
|
130
|
+
"scopes": ["prvReadIncident"],
|
|
131
|
+
"permissions": [],
|
|
132
|
+
"tools": ["dynamics_search_cases", "dynamics_get_case"],
|
|
133
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}."
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "close_cases",
|
|
137
|
+
"label": "Resolve and cancel cases",
|
|
138
|
+
"description": "Resolve cases with a resolution, or cancel them.",
|
|
139
|
+
"scopes": ["prvReadIncident", "prvWriteIncident", "prvCreateActivity"],
|
|
140
|
+
"permissions": [],
|
|
141
|
+
"tools": ["dynamics_close_case"],
|
|
142
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}."
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "read_activities",
|
|
146
|
+
"label": "Read activities and notes",
|
|
147
|
+
"description": "List the tasks, phone calls, emails, appointments and notes of the accounts, contacts, opportunities and cases an agent may use.",
|
|
148
|
+
"scopes": ["prvReadActivity", "prvReadNote"],
|
|
149
|
+
"permissions": [],
|
|
150
|
+
"tools": ["dynamics_list_activities"],
|
|
151
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}, and Read on the record's own table."
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"id": "add_activities",
|
|
155
|
+
"label": "Add notes, tasks and phone calls",
|
|
156
|
+
"description": "Add notes, tasks and logged phone calls to the accounts, contacts, opportunities and cases an agent may use.",
|
|
157
|
+
"scopes": [
|
|
158
|
+
"prvCreateActivity",
|
|
159
|
+
"prvWriteActivity",
|
|
160
|
+
"prvAppendActivity",
|
|
161
|
+
"prvCreateNote",
|
|
162
|
+
"prvAppendNote"
|
|
163
|
+
],
|
|
164
|
+
"permissions": [],
|
|
165
|
+
"tools": ["dynamics_add_activity"],
|
|
166
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}, plus Read and Append To on the record's own table."
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"id": "read_tables",
|
|
170
|
+
"label": "Read other tables",
|
|
171
|
+
"description": "Read rows of the tables you list on each API key, such as products or your own tables, with simple conditions. Nothing is read from a table you do not list.",
|
|
172
|
+
"note": "Give the security role Read on each table you list.",
|
|
173
|
+
"scopes": [],
|
|
174
|
+
"permissions": [],
|
|
175
|
+
"tools": ["dynamics_list_rows", "dynamics_get_row"],
|
|
176
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs Read on this table."
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"id": "delete",
|
|
180
|
+
"label": "Delete records",
|
|
181
|
+
"description": "Delete accounts, contacts, opportunities, cases, tasks, phone calls and notes. Dynamics also deletes what belongs to a record, such as its activities and notes. An agent kept to business units or teams can delete only tasks, phone calls and notes.",
|
|
182
|
+
"destructive": true,
|
|
183
|
+
"scopes": [
|
|
184
|
+
"prvDeleteAccount",
|
|
185
|
+
"prvDeleteContact",
|
|
186
|
+
"prvDeleteOpportunity",
|
|
187
|
+
"prvDeleteIncident",
|
|
188
|
+
"prvDeleteActivity",
|
|
189
|
+
"prvDeleteNote"
|
|
190
|
+
],
|
|
191
|
+
"permissions": [],
|
|
192
|
+
"tools": ["dynamics_delete_record"],
|
|
193
|
+
"forbidden": "Dynamics 365 refused this. The agents' security role needs {scopes}."
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"limits": [
|
|
197
|
+
{
|
|
198
|
+
"id": "business_units",
|
|
199
|
+
"label": "Business units",
|
|
200
|
+
"help": "Optional: only records owned in these business units (their ids). To see them, open https://your-org.crm.dynamics.com/api/data/v9.2/businessunits?$select=name in your browser while signed in. With teams set too, a record of either is allowed. Leave both empty for every record the security role reaches.",
|
|
201
|
+
"kind": "list",
|
|
202
|
+
"required": false,
|
|
203
|
+
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"id": "teams",
|
|
207
|
+
"label": "Owning teams",
|
|
208
|
+
"help": "Optional: only records owned by these teams (their ids). To see them, open https://your-org.crm.dynamics.com/api/data/v9.2/teams?$select=name in your browser while signed in. Records this agent creates go to its team (name one when there are several).",
|
|
209
|
+
"kind": "list",
|
|
210
|
+
"required": false,
|
|
211
|
+
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": "tables",
|
|
215
|
+
"label": "Other tables",
|
|
216
|
+
"help": "For Read other tables: the tables this key may read, by logical name, such as product or new_project (in Power Apps, under Tables, then the table's Properties). Under business units or teams, only tables whose records have an owner.",
|
|
217
|
+
"kind": "list",
|
|
218
|
+
"required": false,
|
|
219
|
+
"pattern": "^[a-z][a-z0-9_]{0,63}$"
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"verify": {
|
|
223
|
+
"label": "Security roles of the application user",
|
|
224
|
+
"check": "access",
|
|
225
|
+
"ifEmpty": "The application user has no security role yet. Give it the agents' role, then check again."
|
|
226
|
+
},
|
|
227
|
+
"revoke": "In the Power Platform admin center, open the environment's Application users and deactivate {brand.microsoft.appName}'s application user, or remove its security role. Agents lose access at once. To stop every Microsoft app at once, remove the app registration (see the Microsoft connection)."
|
|
228
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
id: string;
|
|
3
|
+
create: ({ microsoft }: import("../microsoft/client.js").BuiltinContext) => {
|
|
4
|
+
vendor: import("../../packages/connector-kit/src/types.js").Vendor;
|
|
5
|
+
toolset: import("../../packages/connector-kit/src/common.js").Toolset;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { dynamicsTools } from "./tools.js";
|
|
2
|
+
import { dynamicsVendor } from "./vendor.js";
|
|
3
|
+
export default {
|
|
4
|
+
id: "dynamics-365",
|
|
5
|
+
create: ({ microsoft }) => ({
|
|
6
|
+
vendor: dynamicsVendor(microsoft),
|
|
7
|
+
toolset: dynamicsTools,
|
|
8
|
+
}),
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../connectors/dynamics-365/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAe;IACb,EAAE,EAAE,cAAc;IAClB,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;QAC1B,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC;QACjC,OAAO,EAAE,aAAa;KACvB,CAAC;CACqB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type Toolset } from "../../packages/connector-kit/src/common.js";
|
|
3
|
+
type Row = Record<string, unknown>;
|
|
4
|
+
type Scope = {
|
|
5
|
+
units: string[];
|
|
6
|
+
teams: string[];
|
|
7
|
+
} | null;
|
|
8
|
+
export declare function scopeFilter(scope: NonNullable<Scope>): string;
|
|
9
|
+
export declare function inScope(scope: Scope, row: Row): boolean;
|
|
10
|
+
/** One answer value as an OData literal: GUIDs, dates, numbers and booleans as they are, any
|
|
11
|
+
* other text quoted. */
|
|
12
|
+
export declare function literal(value: string | number | boolean): string;
|
|
13
|
+
declare const filterSchema: z.ZodObject<{
|
|
14
|
+
column: z.ZodString;
|
|
15
|
+
op: z.ZodEnum<{
|
|
16
|
+
null: "null";
|
|
17
|
+
eq: "eq";
|
|
18
|
+
ne: "ne";
|
|
19
|
+
gt: "gt";
|
|
20
|
+
ge: "ge";
|
|
21
|
+
lt: "lt";
|
|
22
|
+
le: "le";
|
|
23
|
+
contains: "contains";
|
|
24
|
+
startswith: "startswith";
|
|
25
|
+
not_null: "not_null";
|
|
26
|
+
}>;
|
|
27
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
type Filter = z.infer<typeof filterSchema>;
|
|
30
|
+
export declare function filterExpression(filters: Filter[]): string[];
|
|
31
|
+
/** A row as agents get it: lookups as {id, name, table}, option sets and money as their
|
|
32
|
+
* labels, text and dates as they are (long text shortened). */
|
|
33
|
+
export declare function trimRow(row: Row, idColumn: string): Row;
|
|
34
|
+
export declare const dynamicsTools: Toolset;
|
|
35
|
+
export {};
|