Ship Composio as a built-in integration and trim Settings
- Resolve the API key from cred.txt at the project root in development and the packaged resources directory in production; the file is the source of truth, so a rotated key replaces the stored one. Fixes the 401 packaged builds hit when a stale database key won. - Remove the user-facing Composio key editor; the key ships with the product and is not configurable. - Remove the Migration console from Settings. - Remove the Connectors and Home refresh buttons; connector statuses sync when the page opens.
This commit is contained in:
1 parent
947cd8605b
commit
256e0680c6
16 files changed
+53
-396
No files matched your search
@@ -40,30 +40,39 @@ describe("composio credential resolution", () => {
|
||||
test("seeds the database from the credential file", () => {
|
||||
const h = harness();
|
||||
writeCred(h, "ak_first");
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBe("ak_first");
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBe("ak_first");
|
||||
expect(storedKey(h)).toBe("ak_first");
|
||||
});
|
||||
|
||||
test("a rotated credential file replaces the stale stored key", () => {
|
||||
const h = harness();
|
||||
writeCred(h, "ak_old");
|
||||
resolveComposioApiKey(h.connection.db, h.orgId, h.credDir);
|
||||
resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir]);
|
||||
writeCred(h, "ak_rotated");
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBe("ak_rotated");
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBe("ak_rotated");
|
||||
expect(storedKey(h)).toBe("ak_rotated");
|
||||
});
|
||||
|
||||
test("finds the credential file in a later directory when the first has none", () => {
|
||||
const h = harness();
|
||||
writeCred(h, "ak_resources");
|
||||
const emptyDir = join(tmpdir(), `ac-cred-empty-${randomUUID()}`);
|
||||
mkdirSync(emptyDir, { recursive: true });
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, [emptyDir, h.credDir])).toBe("ak_resources");
|
||||
expect(storedKey(h)).toBe("ak_resources");
|
||||
});
|
||||
|
||||
test("without a credential file the stored key stands", () => {
|
||||
const h = harness();
|
||||
const now = new Date().toISOString();
|
||||
h.connection.db.prepare(
|
||||
"insert into composio_settings(org_id, key, value, updated_at) values (?, 'api_key', 'ak_settings', ?)",
|
||||
).run(h.orgId, now);
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBe("ak_settings");
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBe("ak_settings");
|
||||
});
|
||||
|
||||
test("no file and no stored key yields null", () => {
|
||||
const h = harness();
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBeNull();
|
||||
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user