@arbium/enterprise-agent-connect 0.2.0 → 0.2.1-dev.fd7a648
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 +6 -1
- package/dist/connectors/http/openapi.d.ts +62 -0
- package/dist/connectors/http/openapi.js +342 -0
- package/dist/connectors/http/openapi.js.map +1 -0
- package/dist/packages/server/migrations/0008_internal_apps.sql +16 -0
- package/dist/packages/server/migrations/rollback/to-legacy.sql +2 -0
- package/dist/packages/server/src/api.d.ts +2717 -569
- package/dist/packages/server/src/api.js +82 -1
- package/dist/packages/server/src/api.js.map +1 -1
- package/dist/packages/server/src/app.js +26 -1
- package/dist/packages/server/src/app.js.map +1 -1
- package/dist/packages/server/src/index.js +27 -18
- package/dist/packages/server/src/index.js.map +1 -1
- package/dist/packages/server/src/service.d.ts +1092 -0
- package/dist/packages/server/src/service.js +257 -19
- package/dist/packages/server/src/service.js.map +1 -1
- package/dist/packages/server/src/store.d.ts +41 -1
- package/dist/packages/server/src/store.js +79 -0
- package/dist/packages/server/src/store.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -185,6 +185,10 @@ const orders: ConnectorJson = {
|
|
|
185
185
|
};
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
+
**Your own app, per organization.** Each organization can add its own apps through the admin
|
|
189
|
+
API, as many as it wants, without a restart: see [Add internal apps through the admin
|
|
190
|
+
API](docs/http-connector.md#add-internal-apps-through-the-admin-api).
|
|
191
|
+
|
|
188
192
|
**Your own app, as code.** Build a `ConnectorModule` on the connector kit and give it its
|
|
189
193
|
definition as `connector` ([docs/connectors.md](docs/connectors.md)). `create` gets a
|
|
190
194
|
`ConnectorContext`, `{ connector }`: the definition parsed, with the branding filled in.
|
|
@@ -249,7 +253,8 @@ authority signed, name a ConfigMap or Secret holding its bundle in `caBundle`
|
|
|
249
253
|
described only in its `connector.json` (docs/http-connector.md, docs/soap-connector.md,
|
|
250
254
|
docs/odata-connector.md, docs/sql-connector.md)
|
|
251
255
|
- `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
|
|
256
|
+
- `scripts/openapi-to-connector.ts`: drafts an http connector from an OpenAPI 3.x spec (the
|
|
257
|
+
drafting itself is `connectors/http/openapi.ts`, also behind the admin API's internal app drafts)
|
|
253
258
|
- `examples/legacy-apps`: a SOAP and an SAP OData connector, described only in JSON
|
|
254
259
|
- `scripts/wsdl-to-connector.ts`, `scripts/odata-to-connector.ts`: draft a connector from a WSDL
|
|
255
260
|
or an OData `$metadata`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
type Json = Record<string, unknown>;
|
|
2
|
+
export type DraftOptions = {
|
|
3
|
+
id: string;
|
|
4
|
+
operations?: string[];
|
|
5
|
+
tags?: string[];
|
|
6
|
+
source?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function draftConnector(spec: Json, options: DraftOptions): {
|
|
9
|
+
connector: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
logo: string;
|
|
14
|
+
identity: string;
|
|
15
|
+
accountKey: string;
|
|
16
|
+
connectionKind: string;
|
|
17
|
+
setup: {
|
|
18
|
+
title: string;
|
|
19
|
+
body: string;
|
|
20
|
+
}[];
|
|
21
|
+
afterConnect: never[];
|
|
22
|
+
fields: Json[];
|
|
23
|
+
capabilities: {
|
|
24
|
+
scopes: never[];
|
|
25
|
+
permissions: never[];
|
|
26
|
+
tools: string[];
|
|
27
|
+
destructive?: boolean | undefined;
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}[];
|
|
32
|
+
limits: never[];
|
|
33
|
+
verify: {
|
|
34
|
+
method: string;
|
|
35
|
+
path: string;
|
|
36
|
+
label: string;
|
|
37
|
+
show: string;
|
|
38
|
+
};
|
|
39
|
+
revoke: string;
|
|
40
|
+
http: {
|
|
41
|
+
auth: Json;
|
|
42
|
+
tools: {
|
|
43
|
+
result?: {
|
|
44
|
+
fields: string[];
|
|
45
|
+
items?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
items: string;
|
|
48
|
+
fields: string[];
|
|
49
|
+
} | undefined;
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
method: string;
|
|
53
|
+
path: string;
|
|
54
|
+
params: Record<string, Json>;
|
|
55
|
+
}[];
|
|
56
|
+
allowInsecureHttp?: boolean | undefined;
|
|
57
|
+
baseUrl: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
notes: string[];
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
// Drafts a connector.json for the http connector from an OpenAPI 3.x spec (JSON), for
|
|
2
|
+
// scripts/openapi-to-connector.ts and the admin API's internal app drafts. The draft loads, but
|
|
3
|
+
// a person finishes it: copy, capabilities, limits, answer limits.
|
|
4
|
+
const METHODS = ["get", "post", "put", "patch", "delete"];
|
|
5
|
+
const SCALARS = new Set(["string", "number", "integer", "boolean"]);
|
|
6
|
+
const snake = (s) => s
|
|
7
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1_$2")
|
|
8
|
+
.toLowerCase()
|
|
9
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
10
|
+
.replace(/^[^a-z]+|_+$/g, "");
|
|
11
|
+
const firstLine = (s) => typeof s === "string"
|
|
12
|
+
? s
|
|
13
|
+
.trim()
|
|
14
|
+
.split(/\n\s*\n|\r?\n/)[0]
|
|
15
|
+
.slice(0, 300)
|
|
16
|
+
: "";
|
|
17
|
+
export function draftConnector(spec, options) {
|
|
18
|
+
const notes = [];
|
|
19
|
+
if (typeof spec.openapi !== "string" || !spec.openapi.startsWith("3."))
|
|
20
|
+
throw new Error("This takes an OpenAPI 3.x spec (its openapi field starts with 3.)");
|
|
21
|
+
// Follows local $refs (#/components/...); other specs' refs are left out.
|
|
22
|
+
const resolve = (node, seen = 0) => {
|
|
23
|
+
if (!node || typeof node !== "object")
|
|
24
|
+
return {};
|
|
25
|
+
const ref = node.$ref;
|
|
26
|
+
if (typeof ref !== "string")
|
|
27
|
+
return node;
|
|
28
|
+
if (!ref.startsWith("#/") || seen > 20) {
|
|
29
|
+
notes.push(`Left out ${ref}: only references inside the spec are followed`);
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
const target = ref
|
|
33
|
+
.slice(2)
|
|
34
|
+
.split("/")
|
|
35
|
+
.reduce((at, key) => at?.[key.replace(/~1/g, "/").replace(/~0/g, "~")], spec);
|
|
36
|
+
return resolve(target, seen + 1);
|
|
37
|
+
};
|
|
38
|
+
const objectOf = (raw) => {
|
|
39
|
+
const s = resolve(raw);
|
|
40
|
+
const parts = Array.isArray(s.allOf) ? s.allOf.map((p) => objectOf(p)) : [];
|
|
41
|
+
return {
|
|
42
|
+
properties: Object.assign({}, ...parts.map((p) => p.properties), s.properties ?? {}),
|
|
43
|
+
required: [
|
|
44
|
+
...parts.flatMap((p) => p.required),
|
|
45
|
+
...(Array.isArray(s.required) ? s.required : []),
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const typeOf = (s) => (Array.isArray(s.type) ? s.type.find((t) => t !== "null") : s.type);
|
|
50
|
+
// The http connector's param fields for a schema, or null for one it cannot take (an object).
|
|
51
|
+
const shape = (raw) => {
|
|
52
|
+
const s = resolve(raw);
|
|
53
|
+
const type = typeOf(s);
|
|
54
|
+
const items = type === "array" ? resolve(s.items) : null;
|
|
55
|
+
const scalar = items ? typeOf(items) : type;
|
|
56
|
+
if (!scalar || !SCALARS.has(scalar))
|
|
57
|
+
return null;
|
|
58
|
+
const fits = (v) => scalar === "integer"
|
|
59
|
+
? Number.isInteger(v)
|
|
60
|
+
: typeof v === (scalar === "integer" ? "number" : scalar);
|
|
61
|
+
const values = (items ?? s).enum;
|
|
62
|
+
const allowed = Array.isArray(values) && values.length && values.every(fits) ? values : undefined;
|
|
63
|
+
const ok = (v) => fits(v) && (!allowed || allowed.includes(v));
|
|
64
|
+
const noDefault = s.default === undefined ||
|
|
65
|
+
(items ? !Array.isArray(s.default) || !s.default.every(ok) : !ok(s.default));
|
|
66
|
+
return {
|
|
67
|
+
type: items ? "array" : scalar,
|
|
68
|
+
...(items ? { items: scalar } : {}),
|
|
69
|
+
...(allowed ? { enum: allowed } : {}),
|
|
70
|
+
...(noDefault ? {} : { default: s.default }),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const scalarFields = (raw) => Object.entries(objectOf(raw).properties)
|
|
74
|
+
.filter(([, p]) => SCALARS.has(typeOf(resolve(p)) ?? ""))
|
|
75
|
+
.map(([k]) => k);
|
|
76
|
+
const resultOf = (op) => {
|
|
77
|
+
const responses = resolve(op.responses);
|
|
78
|
+
const ok = Object.keys(responses).find((code) => /^2/.test(code));
|
|
79
|
+
const schema = ok && resolve(resolve(resolve(responses[ok]).content)["application/json"]).schema;
|
|
80
|
+
if (!schema)
|
|
81
|
+
return undefined;
|
|
82
|
+
const s = resolve(schema);
|
|
83
|
+
if (typeOf(s) === "array") {
|
|
84
|
+
const fields = scalarFields(s.items);
|
|
85
|
+
return fields.length ? { fields } : undefined;
|
|
86
|
+
}
|
|
87
|
+
const props = objectOf(s).properties;
|
|
88
|
+
// A list of records inside an object is taken as the page, e.g. {issues: [...], next}.
|
|
89
|
+
const lists = Object.entries(props)
|
|
90
|
+
.filter(([, p]) => typeOf(resolve(p)) === "array")
|
|
91
|
+
.map(([k, p]) => [k, scalarFields(resolve(p).items)])
|
|
92
|
+
.filter(([, fields]) => fields.length);
|
|
93
|
+
if (lists.length === 1)
|
|
94
|
+
return { items: lists[0][0], fields: lists[0][1] };
|
|
95
|
+
const fields = scalarFields(s);
|
|
96
|
+
return fields.length ? { fields } : undefined;
|
|
97
|
+
};
|
|
98
|
+
const app = snake(options.id);
|
|
99
|
+
const info = resolve(spec.info);
|
|
100
|
+
const title = typeof info.title === "string" && info.title.trim() ? info.title.trim() : options.id;
|
|
101
|
+
const picked = [];
|
|
102
|
+
for (const [path, rawItem] of Object.entries(resolve(spec.paths))) {
|
|
103
|
+
const item = resolve(rawItem);
|
|
104
|
+
for (const method of METHODS) {
|
|
105
|
+
const op = item[method];
|
|
106
|
+
if (!op)
|
|
107
|
+
continue;
|
|
108
|
+
const tags = Array.isArray(op.tags) ? op.tags : [];
|
|
109
|
+
if (options.operations?.includes(op.operationId) ||
|
|
110
|
+
options.tags?.some((t) => tags.includes(t)))
|
|
111
|
+
picked.push({ path, method, op, shared: item.parameters ?? [] });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const missing = (options.operations ?? []).filter((id) => !picked.some((p) => p.op.operationId === id));
|
|
115
|
+
if (missing.length)
|
|
116
|
+
throw new Error(`No operation has the id ${missing.join(", ")}`);
|
|
117
|
+
if (!picked.length)
|
|
118
|
+
throw new Error("No operation matched: name operations or tags");
|
|
119
|
+
const tools = picked.map(({ path, method, op, shared }) => {
|
|
120
|
+
const opId = typeof op.operationId === "string" ? op.operationId : `${method} ${path}`;
|
|
121
|
+
const base = snake(opId);
|
|
122
|
+
const name = base.startsWith(`${app}_`) ? base : `${app}_${base}`;
|
|
123
|
+
const params = {};
|
|
124
|
+
const add = (key, param, why) => {
|
|
125
|
+
if (params[key])
|
|
126
|
+
notes.push(`${name}: left out ${why}, its name is taken by another param`);
|
|
127
|
+
else
|
|
128
|
+
params[key] = param;
|
|
129
|
+
};
|
|
130
|
+
const byPlace = new Map();
|
|
131
|
+
for (const raw of [...shared, ...(op.parameters ?? [])]) {
|
|
132
|
+
const p = resolve(raw);
|
|
133
|
+
byPlace.set(`${p.in}:${p.name}`, p);
|
|
134
|
+
}
|
|
135
|
+
let template = path;
|
|
136
|
+
for (const p of byPlace.values()) {
|
|
137
|
+
const wire = String(p.name);
|
|
138
|
+
if (p.in !== "path" && p.in !== "query") {
|
|
139
|
+
notes.push(`${name}: left out the ${p.in} param ${wire} (a fixed header goes in http.headers)`);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const fields = shape(p.schema);
|
|
143
|
+
if (!fields) {
|
|
144
|
+
notes.push(`${name}: left out ${wire}, whose type the http connector cannot take`);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const key = snake(wire) || "param";
|
|
148
|
+
if (p.in === "path")
|
|
149
|
+
template = template.replaceAll(`{${wire}}`, `{${key}}`);
|
|
150
|
+
if (p.in === "path")
|
|
151
|
+
delete fields.default;
|
|
152
|
+
const style = p.style ?? "form";
|
|
153
|
+
const join = fields.type === "array" && p.in === "query"
|
|
154
|
+
? style === "spaceDelimited"
|
|
155
|
+
? " "
|
|
156
|
+
: style === "pipeDelimited"
|
|
157
|
+
? "|"
|
|
158
|
+
: p.explode === false
|
|
159
|
+
? ","
|
|
160
|
+
: undefined
|
|
161
|
+
: undefined;
|
|
162
|
+
add(key, {
|
|
163
|
+
...fields,
|
|
164
|
+
description: firstLine(p.description) || firstLine(resolve(p.schema).description) || wire,
|
|
165
|
+
in: p.in,
|
|
166
|
+
...(key === wire || p.in === "path" ? {} : { name: wire }),
|
|
167
|
+
...(p.in === "path" || p.required === true || fields.default !== undefined
|
|
168
|
+
? {}
|
|
169
|
+
: { required: false }),
|
|
170
|
+
...(join ? { join } : {}),
|
|
171
|
+
}, `query param ${wire}`);
|
|
172
|
+
}
|
|
173
|
+
const body = resolve(op.requestBody);
|
|
174
|
+
const content = resolve(body.content);
|
|
175
|
+
if (method === "get" && op.requestBody)
|
|
176
|
+
notes.push(`${name}: left out its request body (a GET)`);
|
|
177
|
+
else if (op.requestBody && !content["application/json"])
|
|
178
|
+
notes.push(`${name}: left out its request body, which is not JSON`);
|
|
179
|
+
else if (op.requestBody) {
|
|
180
|
+
const { properties, required } = objectOf(resolve(content["application/json"]).schema);
|
|
181
|
+
if (!Object.keys(properties).length)
|
|
182
|
+
notes.push(`${name}: its request body has no listed fields, so it sends none`);
|
|
183
|
+
for (const [wire, raw] of Object.entries(properties)) {
|
|
184
|
+
const prop = resolve(raw);
|
|
185
|
+
if (prop.readOnly)
|
|
186
|
+
continue;
|
|
187
|
+
const fields = shape(prop);
|
|
188
|
+
if (!fields) {
|
|
189
|
+
notes.push(`${name}: left out body field ${wire}, an object or a type not supported`);
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const key = snake(wire) || "field";
|
|
193
|
+
add(key, {
|
|
194
|
+
...fields,
|
|
195
|
+
description: firstLine(prop.description) || wire,
|
|
196
|
+
in: "body",
|
|
197
|
+
...(key === wire ? {} : { name: wire }),
|
|
198
|
+
...(required.includes(wire) || fields.default !== undefined ? {} : { required: false }),
|
|
199
|
+
}, `body field ${wire}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const result = method === "get" ? resultOf(op) : undefined;
|
|
203
|
+
if (result)
|
|
204
|
+
notes.push(`${name}: its answer is trimmed to fields guessed from the spec; check them`);
|
|
205
|
+
return {
|
|
206
|
+
name,
|
|
207
|
+
description: firstLine(op.summary) || firstLine(op.description) || `${method.toUpperCase()} ${path}`,
|
|
208
|
+
method: method.toUpperCase(),
|
|
209
|
+
path: template,
|
|
210
|
+
params,
|
|
211
|
+
...(result ? { result } : {}),
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
const baseUrl = (() => {
|
|
215
|
+
const server = resolve(spec.servers?.[0]);
|
|
216
|
+
let url = typeof server.url === "string" ? server.url : "";
|
|
217
|
+
for (const [name, v] of Object.entries(resolve(server.variables)))
|
|
218
|
+
url = url.replaceAll(`{${name}}`, String(resolve(v).default ?? ""));
|
|
219
|
+
if (!url || !URL.canParse(url, options.source)) {
|
|
220
|
+
notes.push("The spec names no server address: set http.baseUrl");
|
|
221
|
+
return "https://app.example.com";
|
|
222
|
+
}
|
|
223
|
+
return new URL(url, options.source).href.replace(/\/+$/, "");
|
|
224
|
+
})();
|
|
225
|
+
const auth = authOf();
|
|
226
|
+
function authOf() {
|
|
227
|
+
const requirement = [
|
|
228
|
+
...(picked[0].op.security ?? spec.security ?? []),
|
|
229
|
+
][0];
|
|
230
|
+
const schemeName = requirement && Object.keys(requirement)[0];
|
|
231
|
+
const scheme = schemeName
|
|
232
|
+
? resolve(resolve(resolve(spec.components).securitySchemes)[schemeName])
|
|
233
|
+
: {};
|
|
234
|
+
const secret = (id, label) => ({ id, label, secret: true });
|
|
235
|
+
const plain = (id, label) => ({ id, label, secret: false });
|
|
236
|
+
if (scheme.type === "apiKey" && scheme.in === "header") {
|
|
237
|
+
if (String(scheme.name).toLowerCase() === "authorization")
|
|
238
|
+
notes.push("The key goes in Authorization: add auth.prefix if a word comes before it");
|
|
239
|
+
return {
|
|
240
|
+
auth: { type: "header", header: scheme.name, value: "api_key" },
|
|
241
|
+
fields: [secret("api_key", "API key")],
|
|
242
|
+
credential: "an API key",
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
if (scheme.type === "apiKey" && scheme.in === "query")
|
|
246
|
+
return {
|
|
247
|
+
auth: { type: "query", param: scheme.name, value: "api_key" },
|
|
248
|
+
fields: [secret("api_key", "API key")],
|
|
249
|
+
credential: "an API key",
|
|
250
|
+
};
|
|
251
|
+
if (scheme.type === "http" && String(scheme.scheme).toLowerCase() === "basic")
|
|
252
|
+
return {
|
|
253
|
+
auth: { type: "basic", username: "username", password: "password" },
|
|
254
|
+
fields: [plain("username", "Username"), secret("password", "Password")],
|
|
255
|
+
credential: "a username and password",
|
|
256
|
+
};
|
|
257
|
+
const flow = resolve(resolve(scheme.flows).clientCredentials);
|
|
258
|
+
if (scheme.type === "oauth2" && typeof flow.tokenUrl === "string")
|
|
259
|
+
return {
|
|
260
|
+
auth: {
|
|
261
|
+
type: "oauth2",
|
|
262
|
+
tokenUrl: new URL(flow.tokenUrl, baseUrl).href,
|
|
263
|
+
clientId: "client_id",
|
|
264
|
+
clientSecret: "client_secret",
|
|
265
|
+
},
|
|
266
|
+
fields: [plain("client_id", "Client ID"), secret("client_secret", "Client secret")],
|
|
267
|
+
credential: "a client ID and secret",
|
|
268
|
+
};
|
|
269
|
+
if (!(scheme.type === "http" && String(scheme.scheme).toLowerCase() === "bearer"))
|
|
270
|
+
notes.push(schemeName
|
|
271
|
+
? `Sign-in ${schemeName} (${String(scheme.type)}) does not map to one the http connector has; the draft uses a token, which may work if the app issues tokens for services`
|
|
272
|
+
: "The spec names no sign-in; the draft uses a token");
|
|
273
|
+
return {
|
|
274
|
+
auth: { type: "bearer", token: "token" },
|
|
275
|
+
fields: [secret("token", "Token")],
|
|
276
|
+
credential: "a token",
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const insecure = !baseUrl.startsWith("https://");
|
|
280
|
+
if (insecure)
|
|
281
|
+
notes.push("The address is plain http: allowInsecureHttp is on, check that it must be");
|
|
282
|
+
const group = (label, id, description, list, destructive = false) => list.length
|
|
283
|
+
? [
|
|
284
|
+
{
|
|
285
|
+
id,
|
|
286
|
+
label,
|
|
287
|
+
description,
|
|
288
|
+
...(destructive ? { destructive: true } : {}),
|
|
289
|
+
scopes: [],
|
|
290
|
+
permissions: [],
|
|
291
|
+
tools: list.map((t) => t.name),
|
|
292
|
+
},
|
|
293
|
+
]
|
|
294
|
+
: [];
|
|
295
|
+
const reads = tools.filter((t) => t.method === "GET");
|
|
296
|
+
const writes = tools.filter((t) => !["GET", "DELETE"].includes(t.method));
|
|
297
|
+
if (writes.length)
|
|
298
|
+
notes.push("Writes: mark any tool that overwrites data destructive, and move it with the deletes");
|
|
299
|
+
const check = reads.find((t) => Object.values(t.params).every((p) => p.required === false || p.default !== undefined));
|
|
300
|
+
if (!check)
|
|
301
|
+
notes.push("No read without required params to check the connection with: set verify.path");
|
|
302
|
+
const shown = check?.result?.fields?.[0] ?? "id";
|
|
303
|
+
const connector = {
|
|
304
|
+
id: options.id,
|
|
305
|
+
name: title,
|
|
306
|
+
description: firstLine(info.description) || `Let agents use ${title}.`,
|
|
307
|
+
logo: `/brand/registry/${options.id}.svg`,
|
|
308
|
+
identity: `${auth.credential.replace(/^\w/, (c) => c.toUpperCase())} for ${title}.`,
|
|
309
|
+
accountKey: "host",
|
|
310
|
+
connectionKind: "guided",
|
|
311
|
+
setup: [
|
|
312
|
+
{
|
|
313
|
+
title: "Create a credential for agents",
|
|
314
|
+
body: `In ${title}, create ${auth.credential} for agents, with only the access they need.`,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
afterConnect: [],
|
|
318
|
+
fields: auth.fields,
|
|
319
|
+
capabilities: [
|
|
320
|
+
...group("Read", "read", `Look things up in ${title}.`, reads),
|
|
321
|
+
...group("Make changes", "write", `Create and change things in ${title}.`, writes),
|
|
322
|
+
...group("Delete", "delete", `Delete things in ${title}.`, tools.filter((t) => t.method === "DELETE"), true),
|
|
323
|
+
],
|
|
324
|
+
limits: [],
|
|
325
|
+
verify: {
|
|
326
|
+
method: "GET",
|
|
327
|
+
path: check?.path ?? "/",
|
|
328
|
+
label: `${title} answers`,
|
|
329
|
+
show: shown,
|
|
330
|
+
},
|
|
331
|
+
revoke: `Delete the credential in ${title}.`,
|
|
332
|
+
http: {
|
|
333
|
+
baseUrl,
|
|
334
|
+
...(insecure ? { allowInsecureHttp: true } : {}),
|
|
335
|
+
auth: auth.auth,
|
|
336
|
+
tools,
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
notes.push("Add limits (and answerLimits on reads by id) for the values agents may be narrowed to", "Add paging to list tools that take a cursor or page number", "Rewrite the name, description, setup and revoke copy in plain words for the admin");
|
|
340
|
+
return { connector, notes };
|
|
341
|
+
}
|
|
342
|
+
//# sourceMappingURL=openapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../../connectors/http/openapi.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,gGAAgG;AAChG,mEAAmE;AAMnE,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ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CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,EAC1C,IAAI,CACL;SACF;QACD,MAAM,EAAE,EAAE;QACV,MAAM,EAAE;YACN,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,GAAG;YACxB,KAAK,EAAE,GAAG,KAAK,UAAU;YACzB,IAAI,EAAE,KAAK;SACZ;QACD,MAAM,EAAE,4BAA4B,KAAK,GAAG;QAC5C,IAAI,EAAE;YACJ,OAAO;YACP,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACN;KACF,CAAC;IACF,KAAK,CAAC,IAAI,CACR,uFAAuF,EACvF,4DAA4D,EAC5D,mFAAmF,CACpF,CAAC;IACF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- An organization's own apps, added through the admin API: a connector.json (with an http,
|
|
2
|
+
-- soap, odata or sql block) kept as written, run on the generic module of its kind. Never
|
|
3
|
+
-- holds a secret: those are entered at connect time and sealed in connections.
|
|
4
|
+
create table internal_apps (
|
|
5
|
+
organization_id uuid not null references organizations (id) on delete cascade,
|
|
6
|
+
id text not null check (id ~ '^[a-z0-9-]+$'),
|
|
7
|
+
definition jsonb not null,
|
|
8
|
+
created_by text not null,
|
|
9
|
+
created_at timestamptz not null default now(),
|
|
10
|
+
updated_by text not null,
|
|
11
|
+
updated_at timestamptz not null default now(),
|
|
12
|
+
primary key (organization_id, id)
|
|
13
|
+
);
|
|
14
|
+
alter table internal_apps enable row level security;
|
|
15
|
+
alter table internal_apps force row level security;
|
|
16
|
+
create policy service on internal_apps for all to current_user using (true) with check (true);
|
|
@@ -12,6 +12,8 @@ drop view if exists public.agent_connect_agents, public.agent_connect_providers,
|
|
|
12
12
|
public.agent_connect_teams_conversations, public.agent_connect_teams_events,
|
|
13
13
|
public.agent_connect_teams_triggers, public.agent_connect_teams_runs,
|
|
14
14
|
public.agent_connect_teams_spend;
|
|
15
|
+
-- 0008: organizations' own apps, which 0.7.5 does not have.
|
|
16
|
+
drop table agent_connect.internal_apps;
|
|
15
17
|
-- 0007: app events and their triggers, which 0.7.5 does not have.
|
|
16
18
|
drop table agent_connect.event_runs, agent_connect.event_triggers, agent_connect.app_events,
|
|
17
19
|
agent_connect.event_subscriptions;
|