Skip to content

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

fix(connected-accounts): address review feedback on #3424

venkat82123b8d6f3449
diff --git a/ts/packages/core/src/composio.ts b/ts/packages/core/src/composio.ts
index cb03ac591..9995254f2 100644
--- a/ts/packages/core/src/composio.ts
+++ b/ts/packages/core/src/composio.ts
@@ -5,6 +5,7 @@ import { Toolkits } from './models/Toolkits';
import { Triggers } from './models/Triggers';
import { AuthConfigs } from './models/AuthConfigs';
import { ConnectedAccounts } from './models/ConnectedAccounts';
+import { Experimental } from './models/Experimental';
import { MCP } from './models/MCP';
import { telemetry } from './telemetry/Telemetry';
import { getSDKConfig, getToolkitVersionsFromEnv } from './utils/sdk';
@@ -194,6 +195,14 @@ export class Composio<
authConfigs: AuthConfigs;
/** Manage authenticated connections */
connectedAccounts: ConnectedAccounts;
+ /**
+ * Experimental SDK methods whose shape may change in future releases.
+ * Houses stateful operations like {@link Experimental.updateAcl} that
+ * take a client and perform I/O. Stateless experimental factories
+ * (e.g. `experimental_createTool`) stay at the top level.
+ * @experimental
+ */
+ experimental: Experimental;
/** Model Context Protocol server management */
mcp: MCP;
/**
@@ -331,6 +340,7 @@ export class Composio<
fileDownloadDir: this.config.fileDownloadDir,
});
this.connectedAccounts = new ConnectedAccounts(this.client);
+ this.experimental = new Experimental(this.client);
this.toolRouter = new ToolRouter(this.client, this.config);
/**
diff --git a/ts/packages/core/src/errors/ConnectedAccountsErrors.ts b/ts/packages/core/src/errors/ConnectedAccountsErrors.ts
index 6d334df2a..f28e61639 100644
--- a/ts/packages/core/src/errors/ConnectedAccountsErrors.ts
+++ b/ts/packages/core/src/errors/ConnectedAccountsErrors.ts
@@ -74,7 +74,7 @@ export class ComposioSharedAccessDeniedError extends ComposioError {
code: ConnectedAccountErrorCodes.SHARED_ACCESS_DENIED,
statusCode: 403,
possibleFixes: options.possibleFixes || [
- "Ask the connection's creator to grant access via composio.connectedAccounts.updateAcl() — set allowAllUsers, add the userId to allowedUserIds, or remove it from notAllowedUserIds.",
+ "Ask the connection's creator to grant access via composio.experimental.updateAcl() — set allowAllUsers, add the userId to allowedUserIds, or remove it from notAllowedUserIds.",
],
});
this.name = 'ComposioSharedAccessDeniedError';
@@ -119,7 +119,7 @@ export class ComposioSharedConnectionNotAccessibleError extends ComposioError {
code: ConnectedAccountErrorCodes.SHARED_CONNECTION_NOT_ACCESSIBLE,
statusCode: 400,
possibleFixes: options.possibleFixes || [
- "Grant the session user access via composio.connectedAccounts.updateAcl() on the pinned connection, or pin a different connection the user can use.",
+ 'Grant the session user access via composio.experimental.updateAcl() on the pinned connection, or pin a different connection the user can use.',
],
});
this.name = 'ComposioSharedConnectionNotAccessibleError';
diff --git a/ts/packages/core/src/index.ts b/ts/packages/core/src/index.ts
index e5f17c9ac..eaae17224 100644
--- a/ts/packages/core/src/index.ts
+++ b/ts/packages/core/src/index.ts
@@ -38,8 +38,12 @@ export { default as logger } from './utils/logger';
export { createCustomTool as experimental_createTool } from './models/CustomTool';
export { createCustomToolkit as experimental_createToolkit } from './models/CustomTool';
-// Experimental shared connected accounts — shape may change in future releases
-export { experimental_updateAcl } from './models/ConnectedAccounts';
+// Experimental shared connected accounts — shape may change in future releases.
+// `updateAcl` is mounted as a method on `composio.experimental.updateAcl(...)`
+// because it takes a client and performs I/O. The `Experimental` class
+// itself is re-exported so callers can type their own composio handles
+// (e.g. in test helpers).
+export { Experimental } from './models/Experimental';
// Error handling exports
export * from './errors';
diff --git a/ts/packages/core/src/models/ConnectedAccounts.ts b/ts/packages/core/src/models/ConnectedAccounts.ts
index 6c566aad6..2a85825ca 100644
--- a/ts/packages/core/src/models/ConnectedAccounts.ts
+++ b/ts/packages/core/src/models/ConnectedAccounts.ts
@@ -9,8 +9,6 @@ import ComposioClient, { BadRequestError } from '@composio/client';
import {
ConnectedAccountCreateResponse,
ConnectedAccountDeleteResponse,
- ConnectedAccountPatchParams,
- ConnectedAccountPatchResponse,
ConnectedAccountRefreshParams,
ConnectedAccountRefreshResponse,
ConnectedAccountUpdateStatusParams,
@@ -32,11 +30,10 @@ import {
ConnectedAccountRefreshOptionsSchema,
UpdateConnectedAccountParams,
UpdateConnectedAccountParamsSchema,
- UpdateConnectedAccountAclParams,
- UpdateConnectedAccountAclParamsSchema,
} from '../types/connectedAccounts.types';
import { ConnectionRequest } from '../types/connectionRequest.types';
import { createConnectionRequest } from './ConnectionRequest';
+import { ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT, serializeExperimentalForWire } from './Experimental';
import { ValidationError } from '../errors/ValidationErrors';
import { telemetry } from '../telemetry/Telemetry';
import {
@@ -56,51 +53,6 @@ import { ConnectionData } from '../types/connectedAccountAuthStates.types';
// warning on every initiate() call.
let _legacyInitiateWarningEmitted = false;
-/**
- * Serialise the SDK's `aclConfigForShared` (camelCase) to the wire's
- * `acl_config_for_shared` block. Returns `undefined` when the caller
- * didn't pass anything (PATCH-style "don't touch ACL"); returns `{}`
- * when the caller passed an explicit empty object — both mean
- * deny-by-default, but the explicit form preserves the caller's intent
- * in network traces.
- */
-export function serializeAclConfigForWire(
- acl:
- | {
- allowAllUsers?: boolean;
- allowedUserIds?: string[];
- notAllowedUserIds?: string[];
- }
- | undefined
-): LinkCreateParams.Experimental.ACLConfigForShared | undefined {
- if (acl === undefined) return undefined;
- return {
- ...(acl.allowAllUsers !== undefined && { allow_all_users: acl.allowAllUsers }),
- ...(acl.allowedUserIds !== undefined && { allowed_user_ids: acl.allowedUserIds }),
- ...(acl.notAllowedUserIds !== undefined && { not_allowed_user_ids: acl.notAllowedUserIds }),
- };
-}
-
-/**
- * Serialise the SDK's `experimental` block (camelCase) into the wire's
- * `experimental` block (snake_case). Returns `undefined` when the caller
- * didn't pass anything.
- */
-function serializeExperimentalForWire(
- experimental: import('../types/connectedAccounts.types').ConnectedAccountExperimental | undefined
-): LinkCreateParams.Experimental | undefined {
- if (experimental === undefined) return undefined;
- const aclWire = serializeAclConfigForWire(experimental.aclConfigForShared);
- const wire: LinkCreateParams.Experimental = {};
- if (experimental.accountType !== undefined) {
- wire.account_type = experimental.accountType;
- }
- if (aclWire !== undefined) {
- wire.acl_config_for_shared = aclWire;
- }
- return wire;
-}
-
/**
* ConnectedAccounts class
*
@@ -446,7 +398,7 @@ export class ConnectedAccounts {
if (
error instanceof BadRequestError &&
typeof error.message === 'string' &&
- error.message.includes('acl_config_for_shared is only valid on SHARED')
+ error.message.includes(ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT)
) {
throw new ComposioAclOnlyForSharedError(error.message, { cause: error });
}
@@ -639,8 +591,8 @@ export class ConnectedAccounts {
/**
* Enable or disable a connected account. Accepts `{ enabled: boolean }`.
*
- * For ACL writes on SHARED connections, see `experimental_updateAcl`
- * exported at the top level of `@composio/core`.
+ * For ACL writes on SHARED connections, see
+ * `composio.experimental.updateAcl()`.
*
* @param {string} nanoid - The unique identifier of the connected account
* @param {UpdateConnectedAccountParams} params - The update parameters
@@ -666,92 +618,3 @@ export class ConnectedAccounts {
return this.client.connectedAccounts.updateStatus(nanoid, parsedParams.data);
}
}
-
-/**
- * Update the per-user ACL on a SHARED connected account. Experimental —
- * shape may change in future releases.
- *
- * Only meaningful for SHARED connections — calling this on a PRIVATE
- * connection raises `ComposioAclOnlyForSharedError` (400). ACL writes
- * require the connection's creator or an API key.
- *
- * PATCH semantics: omit a field to leave it unchanged; pass an empty array
- * to clear an allow/deny list. At least one field must be provided.
- *
- * Resolution rule (deny wins):
- * 1. requesting `userId` in `notAllowedUserIds` → DENY
- * 2. `allowAllUsers === true` → ALLOW
- * 3. requesting `userId` in `allowedUserIds` → ALLOW
- * 4. otherwise → DENY
- *
- * @example
- * ```typescript
- * import { Composio, experimental_updateAcl } from '@composio/core';
- *
- * const composio = new Composio({ apiKey: '...' });
- *
- * // Allow every userId to use this connection
- * await experimental_updateAcl(composio, 'ca_abc', { allowAllUsers: true });
- *
- * // Everyone except a specific user
- * await experimental_updateAcl(composio, 'ca_abc', {
- * allowAllUsers: true,
- * notAllowedUserIds: ['user_bob'],
- * });
- *
- * // Targeted allow
- * await experimental_updateAcl(composio, 'ca_abc', {
- * allowedUserIds: ['user_alice', 'user_bob'],
- * });
- *
- * // Revoke a previously-granted allow list (back to deny-by-default)
- * await experimental_updateAcl(composio, 'ca_abc', { allowedUserIds: [] });
- * ```
- *
- * **Empty-array semantics — read carefully.** Passing `[]` for either
- * list **replaces** the list, it does not extend it:
- *
- * - `allowedUserIds: []` → revoke all previously-granted user IDs (state
- * reverts to deny-by-default unless `allowAllUsers` is true).
- * - `notAllowedUserIds: []` → **clears the deny list**, which silently
- * re-grants access to users you previously blocked. Always pair an
- * empty deny list with a deliberate audit of the allow side.
- *
- * @returns The PATCH response (`{ id, status, success }`). To read the
- * updated ACL block, call `composio.connectedAccounts.get(nanoid)`
- * after the promise resolves and inspect `account.experimental?.aclConfigForShared`.
- */
-export async function experimental_updateAcl(
- composio: { getClient: () => ComposioClient },
- nanoid: string,
- params: UpdateConnectedAccountAclParams
-): Promise<ConnectedAccountPatchResponse> {
- const parsedParams = UpdateConnectedAccountAclParamsSchema.safeParse(params);
- if (!parsedParams.success) {
- throw new ValidationError('Failed to parse connected account ACL update params', {
- cause: parsedParams.error,
- });
- }
-
- const client = composio.getClient();
- const body: ConnectedAccountPatchParams = {
- experimental: {
- acl_config_for_shared: serializeAclConfigForWire(parsedParams.data),
- },
- };
-
- try {
- return await client.connectedAccounts.patch(nanoid, body);
- } catch (error) {
- // Same ACL-on-PRIVATE rejection the create path can hit — surface
- // it as a typed error.
- if (
- error instanceof BadRequestError &&
- typeof error.message === 'string' &&
- error.message.includes('acl_config_for_shared is only valid on SHARED')
- ) {
- throw new ComposioAclOnlyForSharedError(error.message, { cause: error });
- }
- throw error;
- }
-}
diff --git a/ts/packages/core/src/models/Experimental.ts b/ts/packages/core/src/models/Experimental.ts
new file mode 100644
index 000000000..0bef8319d
--- /dev/null
+++ b/ts/packages/core/src/models/Experimental.ts
@@ -0,0 +1,198 @@
+/**
+ * @fileoverview The `composio.experimental` namespace. Houses experimental
+ * SDK methods whose shape may change in future releases.
+ *
+ * For experimental stateless factories (e.g. `experimental_createTool`),
+ * see the top-level `experimental_*` exports from `@composio/core`.
+ * Anything that takes a Composio client and performs I/O belongs here.
+ */
+import ComposioClient, { BadRequestError } from '@composio/client';
+import {
+ ConnectedAccountPatchParams,
+ ConnectedAccountPatchResponse,
+ ConnectedAccountListParams as ConnectedAccountListParamsRaw,
+} from '@composio/client/resources/connected-accounts';
+import { LinkCreateParams } from '@composio/client/resources/link';
+import { SessionLinkParams } from '@composio/client/resources/tool-router/session/session';
+import {
+ ConnectedAccountExperimental,
+ UpdateConnectedAccountAclParams,
+ UpdateConnectedAccountAclParamsSchema,
+} from '../types/connectedAccounts.types';
+import { ValidationError } from '../errors/ValidationErrors';
+import { ComposioAclOnlyForSharedError } from '../errors';
+import { telemetry } from '../telemetry/Telemetry';
+
+/**
+ * Server-side 400 message the API uses to reject ACL writes against a
+ * PRIVATE connection. Substring-matched in `updateAcl` here, and in the
+ * sibling `connectedAccounts.link()` / `session.authorize()` call sites
+ * — kept as a single constant so a server-side message tweak only
+ * requires one edit.
+ */
+export const ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT = 'acl_config_for_shared is only valid on SHARED';
+
+/**
+ * Structural shape of the wire's experimental block on requests. Both
+ * `LinkCreateParams.Experimental` and `SessionLinkParams.Experimental`
+ * (Stainless-generated, nominally distinct) accept this shape.
+ */
+type ExperimentalWire = {
+ account_type?: 'PRIVATE' | 'SHARED';
+ acl_config_for_shared?: {
+ allow_all_users?: boolean;
+ allowed_user_ids?: string[];
+ not_allowed_user_ids?: string[];
+ };
+};
+
+/**
+ * Serialise the SDK's `aclConfigForShared` (camelCase) to the wire's
+ * `acl_config_for_shared` block. Returns `undefined` when the caller
+ * didn't pass anything (PATCH-style "don't touch ACL"); returns `{}`
+ * when the caller passed an explicit empty object.
+ */
+export function serializeAclConfigForWire(
+ acl:
+ | {
+ allowAllUsers?: boolean;
+ allowedUserIds?: string[];
+ notAllowedUserIds?: string[];
+ }
+ | undefined
+): NonNullable<ExperimentalWire['acl_config_for_shared']> | undefined {
+ if (acl === undefined) return undefined;
+ return {
+ ...(acl.allowAllUsers !== undefined && { allow_all_users: acl.allowAllUsers }),
+ ...(acl.allowedUserIds !== undefined && { allowed_user_ids: acl.allowedUserIds }),
+ ...(acl.notAllowedUserIds !== undefined && { not_allowed_user_ids: acl.notAllowedUserIds }),
+ };
+}
+
+/**
+ * Serialise the SDK's `experimental` options block (camelCase) to the
+ * wire's `experimental` block (snake_case). Used by both
+ * `connectedAccounts.link()` and `session.authorize()`. Returns
+ * `undefined` when the caller didn't pass the block at all.
+ */
+export function serializeExperimentalForWire(
+ experimental: ConnectedAccountExperimental | undefined
+): ExperimentalWire | undefined {
+ if (experimental === undefined) return undefined;
+ const aclWire = serializeAclConfigForWire(experimental.aclConfigForShared);
+ const wire: ExperimentalWire = {};
+ if (experimental.accountType !== undefined) {
+ wire.account_type = experimental.accountType;
+ }
+ if (aclWire !== undefined) {
+ wire.acl_config_for_shared = aclWire;
+ }
+ return wire;
+}
+
+/**
+ * `composio.experimental` namespace. Mirrors the Python SDK's
+ * `composio.experimental` mount, with one method per experimental
+ * surface. **Shape may change in future releases.**
+ */
+export class Experimental {
+ private client: ComposioClient;
+
+ constructor(client: ComposioClient) {
+ this.client = client;
+ telemetry.instrument(this, 'Experimental');
+ }
+
+ /**
+ * Update the per-user ACL on a SHARED connected account.
+ * **Experimental — shape may change in future releases.**
+ *
+ * Only meaningful for SHARED connections — calling this on a PRIVATE
+ * connection raises `ComposioAclOnlyForSharedError` (400). ACL writes
+ * require the connection's creator or an API key.
+ *
+ * PATCH semantics: omit a field to leave it unchanged; pass an empty
+ * array to clear an allow/deny list. At least one field must be
+ * provided.
+ *
+ * Resolution rule (deny wins):
+ * 1. requesting `userId` in `notAllowedUserIds` → DENY
+ * 2. `allowAllUsers === true` → ALLOW
+ * 3. requesting `userId` in `allowedUserIds` → ALLOW
+ * 4. otherwise → DENY
+ *
+ * @example
+ * ```typescript
+ * import { Composio } from '@composio/core';
+ *
+ * const composio = new Composio({ apiKey: '...' });
+ *
+ * // Allow every userId to use this connection
+ * await composio.experimental.updateAcl('ca_abc', { allowAllUsers: true });
+ *
+ * // Everyone except a specific user
+ * await composio.experimental.updateAcl('ca_abc', {
+ * allowAllUsers: true,
+ * notAllowedUserIds: ['user_bob'],
+ * });
+ *
+ * // Targeted allow
+ * await composio.experimental.updateAcl('ca_abc', {
+ * allowedUserIds: ['user_alice', 'user_bob'],
+ * });
+ *
+ * // Revoke a previously-granted allow list (back to deny-by-default)
+ * await composio.experimental.updateAcl('ca_abc', { allowedUserIds: [] });
+ * ```
+ *
+ * **Empty-array semantics — read carefully.** Passing `[]` for either
+ * list **replaces** the list, it does not extend it:
+ *
+ * - `allowedUserIds: []` → revoke all previously-granted user IDs (state
+ * reverts to deny-by-default unless `allowAllUsers` is true).
+ * - `notAllowedUserIds: []` → **clears the deny list**, which silently
+ * re-grants access to users you previously blocked. Always pair an
+ * empty deny list with a deliberate audit of the allow side.
+ *
+ * @returns The PATCH response (`{ id, status, success }`). To read
+ * the updated ACL block, call
+ * `composio.connectedAccounts.get(nanoid)` after the promise
+ * resolves and inspect `account.experimental?.aclConfigForShared`.
+ */
+ async updateAcl(
+ nanoid: string,
+ params: UpdateConnectedAccountAclParams
+ ): Promise<ConnectedAccountPatchResponse> {
+ const parsedParams = UpdateConnectedAccountAclParamsSchema.safeParse(params);
+ if (!parsedParams.success) {
+ throw new ValidationError('Failed to parse connected account ACL update params', {
+ cause: parsedParams.error,
+ });
+ }
+
+ const body: ConnectedAccountPatchParams = {
+ experimental: {
+ acl_config_for_shared: serializeAclConfigForWire(parsedParams.data),
+ },
+ };
+
+ try {
+ return await this.client.connectedAccounts.patch(nanoid, body);
+ } catch (error) {
+ if (
+ error instanceof BadRequestError &&
+ typeof error.message === 'string' &&
+ error.message.includes(ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT)
+ ) {
+ throw new ComposioAclOnlyForSharedError(error.message, { cause: error });
+ }
+ throw error;
+ }
+ }
+}
+
+// Re-exports so the wire-shape helpers stay reachable from the existing
+// callsites in `models/` without bouncing through `experimental.ts` —
+// the canonical home is here, but the imports look unchanged at the
+// caller.
+export type { LinkCreateParams, SessionLinkParams, ConnectedAccountListParamsRaw };
diff --git a/ts/packages/core/src/models/ToolRouterSession.ts b/ts/packages/core/src/models/ToolRouterSession.ts
index 2109036d5..4c148e6f3 100644
--- a/ts/packages/core/src/models/ToolRouterSession.ts
+++ b/ts/packages/core/src/models/ToolRouterSession.ts
@@ -27,12 +27,12 @@ import { SessionMetaToolOptions } from '../types/modifiers.types';
import { ConnectionRequest } from '../types/connectionRequest.types';
import { createConnectionRequest } from './ConnectionRequest';
import {
- ConnectedAccountAclConfigSchema,
+ ConnectedAccountExperimentalSchema,
ConnectedAccountStatuses,
ConnectedAccountType,
- ConnectedAccountTypeSchema,
ConnectedAccountAclConfig,
} from '../types/connectedAccounts.types';
+import { ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT, serializeExperimentalForWire } from './Experimental';
import { z } from 'zod/v3';
import { transform } from '../utils/transform';
import { ToolkitConnectionStateSchema } from '../types/toolRouter.types';
@@ -83,12 +83,7 @@ export const DIRECT_CUSTOM_TOOL_DESCRIPTION_PREFIX =
const AuthorizeOptionsSchema = z.object({
callbackUrl: z.string().optional(),
alias: z.string().optional(),
- experimental: z
- .object({
- accountType: ConnectedAccountTypeSchema.optional(),
- aclConfigForShared: ConnectedAccountAclConfigSchema.optional(),
- })
- .optional(),
+ experimental: ConnectedAccountExperimentalSchema.optional(),
});
export class ToolRouterSession<
@@ -360,35 +355,14 @@ export class ToolRouterSession<
});
}
const opts = requestOptions.data;
- const experimentalIn = opts.experimental;
- const aclWire: SessionLinkParams.Experimental.ACLConfigForShared | undefined =
- experimentalIn?.aclConfigForShared === undefined
- ? undefined
- : {
- ...(experimentalIn.aclConfigForShared.allowAllUsers !== undefined && {
- allow_all_users: experimentalIn.aclConfigForShared.allowAllUsers,
- }),
- ...(experimentalIn.aclConfigForShared.allowedUserIds !== undefined && {
- allowed_user_ids: experimentalIn.aclConfigForShared.allowedUserIds,
- }),
- ...(experimentalIn.aclConfigForShared.notAllowedUserIds !== undefined && {
- not_allowed_user_ids: experimentalIn.aclConfigForShared.notAllowedUserIds,
- }),
- };
- const experimentalWire: SessionLinkParams.Experimental | undefined =
- experimentalIn === undefined
- ? undefined
- : {
- ...(experimentalIn.accountType !== undefined && {
- account_type: experimentalIn.accountType,
- }),
- ...(aclWire !== undefined && { acl_config_for_shared: aclWire }),
- };
+ const experimentalWire = serializeExperimentalForWire(opts.experimental);
const body: SessionLinkParams = {
toolkit,
...(opts.callbackUrl !== undefined && { callback_url: opts.callbackUrl }),
...(opts.alias !== undefined && { alias: opts.alias }),
- ...(experimentalWire !== undefined && { experimental: experimentalWire }),
+ ...(experimentalWire !== undefined && {
+ experimental: experimentalWire as SessionLinkParams.Experimental,
+ }),
};
let response;
@@ -400,7 +374,7 @@ export class ToolRouterSession<
if (
error instanceof BadRequestError &&
typeof error.message === 'string' &&
- error.message.includes('acl_config_for_shared is only valid on SHARED')
+ error.message.includes(ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT)
) {
throw new ComposioAclOnlyForSharedError(error.message, { cause: error });
}
diff --git a/ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts b/ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts
index e2bf68836..5229d3cf9 100644
--- a/ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts
+++ b/ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts
@@ -1,6 +1,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { mockClient } from '../utils/mocks/client.mock';
-import { ConnectedAccounts, experimental_updateAcl } from '../../src/models/ConnectedAccounts';
+import { ConnectedAccounts } from '../../src/models/ConnectedAccounts';
+import { Experimental } from '../../src/models/Experimental';
import ComposioClient from '@composio/client';
import { ConnectedAccountRetrieveResponse } from '@composio/client/resources/connected-accounts.mjs';
import {
@@ -1677,11 +1678,11 @@ describe('ConnectedAccounts', () => {
});
});
- describe('experimental_updateAcl', () => {
- let composioHandle: { getClient: () => typeof extendedMockClient };
+ describe('composio.experimental.updateAcl', () => {
+ let experimental: Experimental;
beforeEach(() => {
- composioHandle = { getClient: () => extendedMockClient };
+ experimental = new Experimental(extendedMockClient as unknown as ComposioClient);
});
it('serializes PATCH body under experimental.acl_config_for_shared', async () => {
@@ -1691,7 +1692,7 @@ describe('ConnectedAccounts', () => {
success: true,
});
- const result = await experimental_updateAcl(composioHandle, 'ca_abc', {
+ const result = await experimental.updateAcl('ca_abc', {
allowAllUsers: true,
notAllowedUserIds: ['user_bob'],
});
@@ -1714,7 +1715,7 @@ describe('ConnectedAccounts', () => {
success: true,
});
- await experimental_updateAcl(composioHandle, 'ca_abc', { allowedUserIds: ['user_alice'] });
+ await experimental.updateAcl('ca_abc', { allowedUserIds: ['user_alice'] });
expect(extendedMockClient.connectedAccounts.patch).toHaveBeenCalledWith('ca_abc', {
experimental: {
@@ -1730,7 +1731,7 @@ describe('ConnectedAccounts', () => {
success: true,
});
- await experimental_updateAcl(composioHandle, 'ca_abc', { allowedUserIds: [] });
+ await experimental.updateAcl('ca_abc', { allowedUserIds: [] });
expect(extendedMockClient.connectedAccounts.patch).toHaveBeenCalledWith('ca_abc', {
experimental: { acl_config_for_shared: { allowed_user_ids: [] } },
@@ -1738,7 +1739,7 @@ describe('ConnectedAccounts', () => {
});
it('rejects an empty params object via the refine', async () => {
- await expect(experimental_updateAcl(composioHandle, 'ca_abc', {})).rejects.toMatchObject({
+ await expect(experimental.updateAcl('ca_abc', {})).rejects.toMatchObject({
name: 'ValidationError',
});
expect(extendedMockClient.connectedAccounts.patch).not.toHaveBeenCalled();
@@ -1755,7 +1756,7 @@ describe('ConnectedAccounts', () => {
);
await expect(
- experimental_updateAcl(composioHandle, 'ca_abc', { allowAllUsers: true })
+ experimental.updateAcl('ca_abc', { allowAllUsers: true })
).rejects.toBeInstanceOf(ComposioAclOnlyForSharedError);
});
@@ -1763,9 +1764,9 @@ describe('ConnectedAccounts', () => {
const otherError = new Error('connection lost');
extendedMockClient.connectedAccounts.patch.mockRejectedValueOnce(otherError);
- await expect(
- experimental_updateAcl(composioHandle, 'ca_abc', { allowAllUsers: true })
- ).rejects.toBe(otherError);
+ await expect(experimental.updateAcl('ca_abc', { allowAllUsers: true })).rejects.toBe(
+ otherError
+ );
});
});
});