@devries-cameron20 / composio Mirror · read-only / commits / 614ae3cd1
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 12:15 UTC

refactor(core): clarify toolkit auth mapping guard

jkomyno committed Sep 15, 2026 at 15:14 UTC 614ae3cd1128f170a4b222c75f6b66abef133dee
1 file changed +15 -20
ts/packages/core/type-tests/toolkit-auth-field-mapping.test-d.ts
+15 -20
@@ -2,21 +2,16 @@
2 * Type-level guard for the toolkit auth field mapping.
3 *
4 * `transformToolkitRetrieveResponse` projects each auth form field key by key.
5 - * A key the generated client declares but the projection forgets is dropped
6 - * silently: zod removes it while validating, and no runtime test notices unless
7 - * someone thought to assert that exact key. That is how `is_secret`,
8 - * `legacy_template_name` and `auth_hint_url` were lost.
5 + * A key the generated client declares but the projection forgets would be
6 + * silently stripped by zod while validating the transformed object.
7 *
10 - * What this file does: it fails the build (tsconfig.type-tests.json) when
11 - * `@composio/client` declares a key in any of the four field groups, or on the
12 - * auth config detail, that is not listed below.
8 + * This file fails the build (tsconfig.type-tests.json) when `@composio/client`
9 + * declares a key in any of the four field groups, or on the auth config detail,
10 + * that is not covered below.
11 *
14 - * What it does NOT do: it does not verify that the transformer still assigns
15 - * those keys. The lists here are hand-written, so removing an assignment from
16 - * the mapper while leaving its key listed stays green at compile time. The
17 - * runtime test pins the projection for the keys known today
18 - * (`test/utils/transformers/toolkits.test.ts`, "maps a whole field without
19 - * losing or inventing keys"); this file covers the keys nobody has seen yet.
12 + * This is only a coverage guard: it does not verify that the transformer still
13 + * assigns listed keys. The runtime test pins the projection for current keys;
14 + * this file covers generated-client keys nobody has seen yet.
15 */
16 import type { ToolkitRetrieveResponse as RawToolkitRetrieveResponse } from '@composio/client/resources/toolkits';
17 import type { ToolkitAuthField, ToolkitAuthConfigDetails } from '../src';
@@ -60,17 +55,17 @@ const everyFieldKeyIsMapped: NoneLeftOver<Exclude<KeysOfUnion<RawAuthField>, Map
55 void everyFieldKeyIsMapped;
56
57 /**
63 - * Wire keys on the auth config detail. `deprecated_auth_provider_details` is
64 - * listed as knowingly skipped: the client marks it `@deprecated` and warns
65 - * against further use, so it is excluded on purpose rather than by oversight.
58 + * Wire keys on the auth config detail that are either mapped or deliberately
59 + * skipped. `deprecated_auth_provider_details` is covered because the client
60 + * marks it `@deprecated` and warns against further use.
61 */
67 -type MappedDetailKeys =
62 +type CoveredDetailKeys =
63 'name' | 'mode' | 'fields' | 'proxy' | 'auth_hint_url' | 'deprecated_auth_provider_details';
64
70 -const everyDetailKeyIsMapped: NoneLeftOver<
71 - Exclude<KeysOfUnion<RawAuthConfigDetail>, MappedDetailKeys>
65 +const everyDetailKeyIsCovered: NoneLeftOver<
66 + Exclude<KeysOfUnion<RawAuthConfigDetail>, CoveredDetailKeys>
67 > = true;
73 -void everyDetailKeyIsMapped;
68 +void everyDetailKeyIsCovered;
69
70 /** The camelCase counterparts must exist on the public types. */
71 type MissingOnField = Exclude<