1
-import {
2
- Context,
3
- Data,
4
- Effect,
5
- Layer,
6
- Option,
7
- Predicate,
8
- Schema,
9
- Array,
10
- Order,
11
- String,
12
-} from 'effect';
1
+import { Context, Effect, Layer, Option, Stream, Array, Order, String } from 'effect';
2
import * as FileSystem from 'effect/FileSystem';
3
import * as Path from 'effect/Path';
4
import type { Cause } from 'effect';
16
-import { Composio as _RawComposioClient, APIError, type RequestOptions } from '@composio/client';
17
-import { paginate, type CursorPage } from '@composio/client/pagination';
18
-import type { AuthConfigCreateParams } from '@composio/client/resources/auth-configs';
19
-import type { ConnectedAccountListParams } from '@composio/client/resources/connected-accounts';
20
-import type { OrgListResponse, ProjectListResponse } from '@composio/client/resources/org';
21
-import type {
22
- ConsumerListConnectedToolkitsResponse,
23
- ProjectResolveResponse,
24
-} from '@composio/client/resources/org/consumer';
25
-import type { SessionRetrieveInfoResponse } from '@composio/client/resources/auth';
26
-import { Toolkit, Toolkits, ToolkitDetailed, type ToolkitSearchResult } from 'src/models/toolkits';
27
-import { AuthConfigItem, AuthConfigItems } from 'src/models/auth-configs';
28
-import { ConnectedAccountItem, ConnectedAccountItems } from 'src/models/connected-accounts';
29
-import { TriggerInstanceItems } from 'src/models/triggers';
5
+import { FetchHttpClient, HttpClient } from 'effect/http';
6
+import {
7
+ make as makeComposioClient,
8
+ VERSION as clientLibraryVersion,
9
+ type ComposioClientShape,
10
+} from '@composio/client/effect';
11
+import { Toolkit, Toolkits, ToolkitDetailed } from 'src/models/toolkits';
12
import { ToolsAsEnums, Tools } from 'src/models/tools';
13
import {
14
groupByVersion,
16
type ToolkitVersionOverrides,
17
} from 'src/effects/toolkit-version-overrides';
18
import { Session, RetrievedSession } from 'src/models/session';
37
-import { TriggerType, TriggerTypes, TriggerTypesAsEnums } from 'src/models/trigger-types';
38
-import { VERSION as clientLibraryVersion } from '@composio/client';
19
+import { TriggerTypes, TriggerTypesAsEnums } from 'src/models/trigger-types';
20
import { cliRequestHeaders } from './client-provenance';
21
import { getCurrentCwdSessionId } from 'src/analytics/dispatch';
22
import { ComposioUserContext, ComposioUserContextLive } from './user-context';
23
import { ProjectContext } from './project-context';
24
import { makeClientMetricsCollector } from './composio-client-metrics';
25
+import { ComposioClientConfigurationError, type ClientError } from './composio-errors';
26
+import { MAX_CONCURRENT_REQUESTS_PER_ENDPOINT, decode, undecoded } from './composio-request';
27
+import { lookupOperations, resourceOperations } from './composio-resource-operations';
28
+import { composioSchemaLoaders } from './composio-schema-loaders';
29
import { NodeOs } from './node-os';
30
+import {
31
+ InvalidToolkitsError,
32
+ invalidToolkitOn404,
33
+ validateToolkitVersionsImpl,
34
+ type InvalidToolkitVersionsError,
35
+} from './toolkit-version-validation';
36
37
type NoSuchElementError = Cause.NoSuchElementError;
38
48
-/**
49
- * Error types
50
- */
51
-
52
-/**
53
- * Structured error details from the Composio API error envelope.
54
- */
55
-export interface HttpErrorDetails {
56
- readonly message: string;
57
- readonly suggestedFix?: string;
58
- readonly code: number;
59
-}
60
-
61
-/**
62
- * Error thrown when a HTTP request fails.
63
- *
64
- * `status`, `details`, and `requestId` are populated from the client's
65
- * `APIError` when the failure is an API response; a connection failure or an
66
- * unexpected rejection carries only `cause`.
67
- */
68
-export class HttpServerError extends Data.TaggedError('services/HttpServerError')<{
69
- readonly cause?: unknown;
70
- readonly status?: number;
71
- readonly details?: HttpErrorDetails;
72
- readonly requestId?: string;
73
-}> {}
74
-
75
-/**
76
- * Error thrown when a client cannot be constructed from the current configuration.
77
- */
78
-export class ComposioClientConfigurationError extends Data.TaggedError(
79
- 'services/ComposioClientConfigurationError'
80
-)<{
81
- readonly message: string;
82
- readonly cause: unknown;
83
-}> {}
84
-
85
-/**
86
- * Error thrown when one or more toolkit slugs are invalid.
87
- */
88
-export class InvalidToolkitsError extends Data.TaggedError('services/InvalidToolkitsError')<{
89
- readonly invalidToolkits: ReadonlyArray<string>;
90
- readonly availableToolkits: ReadonlyArray<string>;
91
-}> {}
92
-
93
-/**
94
- * Details about a single invalid version override.
95
- */
96
-export interface InvalidVersionDetail {
97
- readonly toolkit: string;
98
- readonly requestedVersion: string;
99
- readonly availableVersions: ReadonlyArray<string>;
100
-}
101
-
102
-/**
103
- * Error thrown when one or more toolkit version overrides are invalid.
104
- */
105
-export class InvalidToolkitVersionsError extends Data.TaggedError(
106
- 'services/InvalidToolkitVersionsError'
107
-)<{
108
- readonly invalidVersions: ReadonlyArray<InvalidVersionDetail>;
109
-}> {}
110
-
111
-/**
112
- * Error thrown when a HTTP response doesn't match the expected response schema.
113
- */
114
-export class HttpDecodingError extends Data.TaggedError('services/HttpDecodingError')<{
115
- readonly cause?: unknown;
116
-}> {}
117
-
118
-export type HttpError = HttpServerError | HttpDecodingError;
119
-
120
-/**
121
- * Every failure a client call can produce: the request itself, decoding a
122
- * CLI-owned contract, or obtaining a client from the singleton.
123
- */
124
-export type ClientError = HttpError | ComposioClientConfigurationError | NoSuchElementError;
125
-
39
/**
40
* Request helpers
41
*/
43
// Maximum items per page allowed by the server
44
const MAX_PAGE_SIZE = 1000;
45
133
-// Maximum concurrent requests per each endpoint
134
-const MAX_CONCURRENT_REQUESTS_PER_ENDPOINT = 4;
135
-
136
-const toHttpServerError = (cause: unknown): HttpServerError => {
137
- if (cause instanceof APIError) {
138
- const details = cause.details;
139
- return new HttpServerError({
140
- cause,
141
- status: cause.status,
142
- requestId: cause.requestId,
143
- details: details
144
- ? { message: details.message, code: details.code, suggestedFix: details.suggested_fix }
145
- : undefined,
146
- });
147
- }
148
- return new HttpServerError({ cause });
149
-};
150
-
46
/**
152
- * Runs one client call. The client parses JSON and rejects on non-2xx, so the
153
- * only work left is mapping its rejection onto `HttpServerError`.
47
+ * Runs a paginated listing to exhaustion and returns every item. A page is
48
+ * requested only once the one before it arrived, so interrupting the listing
49
+ * sends no further request.
50
*/
155
-const request = <A, E>(
156
- client: Effect.Effect<_RawComposioClient, E>,
157
- call: (client: _RawComposioClient, signal: AbortSignal) => PromiseLike<A>
158
-): Effect.Effect<A, E | HttpServerError> =>
159
- client.pipe(
160
- Effect.flatMap(resolved =>
161
- Effect.tryPromise({ try: signal => call(resolved, signal), catch: toHttpServerError })
162
- )
163
- );
164
-
165
-/**
166
- * Runs a paginated client call to exhaustion and returns every item, asking
167
- * for `MAX_PAGE_SIZE` items per page.
168
- */
169
-const requestAll = <Page extends CursorPage<unknown>, E>(
170
- client: Effect.Effect<_RawComposioClient, E>,
171
- fetchPage: (
172
- client: _RawComposioClient,
173
- page: { readonly cursor: string | undefined; readonly limit: number },
174
- signal: AbortSignal
175
- ) => PromiseLike<Page>
176
-) =>
177
- request(client, (resolved, signal) =>
178
- paginate<Page>(({ cursor }) =>
179
- fetchPage(resolved, { cursor, limit: MAX_PAGE_SIZE }, signal)
180
- ).toArray()
181
- );
182
-
183
-/**
184
- * Decodes a payload against a CLI-owned contract.
185
- */
186
-const decode =
187
- <S extends Schema.Top>(schema: S) =>
188
- (input: unknown): Effect.Effect<S['Type'], HttpDecodingError, S['DecodingServices']> =>
189
- Schema.decodeUnknownEffect(schema)(input).pipe(
190
- Effect.catchTag(
191
- 'SchemaError',
192
- e =>
193
- new HttpDecodingError({
194
- cause: `SchemaError\n ${e.message}`,
195
- })
196
- )
197
- );
51
+const collectAll = <A, E, E2>(
52
+ client: Effect.Effect<ComposioClientShape, E>,
53
+ list: (client: ComposioClientShape) => Stream.Stream<A, E2>
54
+): Effect.Effect<Array<A>, E | E2> =>
55
+ Effect.flatMap(client, resolved => Stream.runCollect(list(resolved)));
56
57
// Sort items by slug.
58
// TODO: make sure this happens on the server-side.
64
Order.mapInput(Order.String, (item: T) => item.slug)
65
);
66
209
-/**
210
- * Converts a 404 from a toolkit lookup into `InvalidToolkitsError` naming
211
- * that slug; every other failure propagates unchanged.
212
- */
213
-const invalidToolkitOn404 = <A>(slug: string, toolkit: Effect.Effect<A, ClientError>) =>
214
- Effect.catchTag(
215
- toolkit,
216
- 'services/HttpServerError',
217
- (e): Effect.Effect<never, InvalidToolkitsError | HttpServerError> =>
218
- e.status === 404
219
- ? Effect.fail(
220
- new InvalidToolkitsError({
221
- invalidToolkits: [slug],
222
- availableToolkits: [],
223
- })
224
- )
225
- : Effect.fail(e)
226
- );
227
-
228
-const validateToolkitVersionsImpl = (
229
- retrieveToolkit: (slug: string) => Effect.Effect<Toolkit, ClientError, never>,
230
- overrides: ToolkitVersionOverrides,
231
- relevantToolkits?: ReadonlyArray<string>
232
-): Effect.Effect<
233
- {
234
- validatedOverrides: ToolkitVersionOverrides;
235
- warnings: ReadonlyArray<string>;
236
- },
237
- InvalidToolkitVersionsError | InvalidToolkitsError | ClientError
238
-> =>
239
- Effect.gen(function* () {
240
- const determineOverridesToValidate = (
241
- overrides: ToolkitVersionOverrides,
242
- relevantToolkits?: ReadonlyArray<string>
243
- ): {
244
- overridesToValidate: Array<[toolkit: string, requestedVersion: string]>;
245
- warnings: Array<string>;
246
- } => {
247
- const warnings: string[] = [];
248
- const overridesToValidate: Array<[toolkit: string, requestedVersion: string]> = [];
249
-
250
- if (relevantToolkits) {
251
- const relevantSet = new Set(relevantToolkits.map(s => String.toLowerCase(s)));
252
-
253
- for (const [toolkit, version] of overrides) {
254
- if (relevantSet.has(toolkit)) {
255
- overridesToValidate.push([toolkit, version]);
256
- } else {
257
- warnings.push(
258
- `Version override for "${toolkit}" will be ignored (toolkit not in --toolkits filter)`
259
- );
260
- }
261
- }
262
- } else {
263
- overridesToValidate.push(...overrides.entries());
264
- }
265
-
266
- return { overridesToValidate, warnings };
267
- };
268
-
269
- const fetchToolkitVersionValidationResults = (
270
- overridesToValidate: ReadonlyArray<[toolkit: string, requestedVersion: string]>
271
- ): Effect.Effect<
272
- ReadonlyArray<{
273
- toolkit: string;
274
- requestedVersion: string;
275
- availableVersions: ReadonlyArray<string>;
276
- isValid: boolean;
277
- }>,
278
- InvalidToolkitsError | ClientError
279
- > =>
280
- Effect.all(
281
- overridesToValidate.map(([toolkit, requestedVersion]) =>
282
- invalidToolkitOn404(
283
- toolkit,
284
- retrieveToolkit(toolkit).pipe(
285
- Effect.map(toolkitData => ({
286
- toolkit,
287
- requestedVersion,
288
- availableVersions: toolkitData.meta.available_versions,
289
- isValid: toolkitData.meta.available_versions.includes(requestedVersion),
290
- }))
291
- )
292
- )
293
- ),
294
- { concurrency: MAX_CONCURRENT_REQUESTS_PER_ENDPOINT }
295
- );
296
-
297
- const collectInvalidVersions = (
298
- validationResults: ReadonlyArray<{
299
- toolkit: string;
300
- requestedVersion: string;
301
- availableVersions: ReadonlyArray<string>;
302
- isValid: boolean;
303
- }>
304
- ): ReadonlyArray<InvalidVersionDetail> =>
305
- validationResults
306
- .filter(result => !result.isValid)
307
- .map(result => ({
308
- toolkit: result.toolkit,
309
- requestedVersion: result.requestedVersion,
310
- availableVersions: result.availableVersions,
311
- }));
312
-
313
- if (overrides.size === 0) {
314
- return { validatedOverrides: overrides, warnings: [] as ReadonlyArray<string> };
315
- }
316
-
317
- const { overridesToValidate, warnings } = determineOverridesToValidate(
318
- overrides,
319
- relevantToolkits
320
- );
321
-
322
- if (overridesToValidate.length === 0) {
323
- return {
324
- validatedOverrides: new Map() as ToolkitVersionOverrides,
325
- warnings: warnings as ReadonlyArray<string>,
326
- };
327
- }
328
-
329
- const validationResults = yield* fetchToolkitVersionValidationResults(overridesToValidate);
330
- const invalidVersions = collectInvalidVersions(validationResults);
331
-
332
- if (invalidVersions.length > 0) {
333
- return yield* Effect.fail(new InvalidToolkitVersionsError({ invalidVersions }));
334
- }
335
-
336
- const validatedOverrides = new Map(overridesToValidate) as ToolkitVersionOverrides;
337
- return { validatedOverrides, warnings: warnings as ReadonlyArray<string> };
338
- });
339
-
340
-/**
341
- * CLI-owned response contracts
342
- *
343
- * Response types otherwise come from `@composio/client`. A schema stays here
344
- * only where the CLI owns the contract: output allowlists that keep
345
- * credential-bearing fields off stdout, and the single escape-hatch endpoint
346
- * the client does not type.
347
- */
348
-
349
-// Auth config list response (single page with total_items for "Listing X of Y" display)
350
-export const AuthConfigListResponse = Schema.Struct({
351
- items: AuthConfigItems,
352
- total_items: Schema.Int,
353
- total_pages: Schema.Int,
354
- current_page: Schema.Int,
355
- next_cursor: Schema.NullOr(Schema.String).pipe(
356
- Schema.withDecodingDefaultType(Effect.succeed(null))
357
- ),
358
-}).annotate({ identifier: 'AuthConfigListResponse' });
359
-export type AuthConfigListResponse = Schema.Schema.Type<typeof AuthConfigListResponse>;
360
-
361
-// Connected account list response (single page with total_items for "Listing X of Y" display)
362
-export const ConnectedAccountListResponse = Schema.Struct({
363
- items: ConnectedAccountItems,
364
- total_items: Schema.Int,
365
- total_pages: Schema.Int,
366
- current_page: Schema.Int,
367
- next_cursor: Schema.NullOr(Schema.String).pipe(
368
- Schema.withDecodingDefaultType(Effect.succeed(null))
369
- ),
370
-}).annotate({ identifier: 'ConnectedAccountListResponse' });
371
-export type ConnectedAccountListResponse = Schema.Schema.Type<typeof ConnectedAccountListResponse>;
372
-
373
-// `auth-configs create` prints this response to stdout, so it stays an
374
-// allowlist rather than the client's full type: a field the API adds later
375
-// must not reach a pipe without a decision here.
376
-export const AuthConfigCreateResponse = Schema.Struct({
377
- auth_config: Schema.Struct({
378
- id: Schema.String,
379
- auth_scheme: Schema.String,
380
- is_composio_managed: Schema.Boolean,
381
- }),
382
- toolkit: Schema.Struct({
383
- slug: Schema.String,
384
- }),
385
-}).annotate({ identifier: 'AuthConfigCreateResponse' });
386
-export type AuthConfigCreateResponse = Schema.Schema.Type<typeof AuthConfigCreateResponse>;
387
-
388
-export const LatestToolVersionResponse = Schema.Struct({
389
- tool_slug: Schema.String,
390
- version: Schema.String,
391
-}).annotate({ identifier: 'LatestToolVersionResponse' });
392
-export type LatestToolVersionResponse = Schema.Schema.Type<typeof LatestToolVersionResponse>;
393
-
394
-/**
395
- * Session info as the CLI consumes it: the client's response with `project`
396
- * present. The endpoint answers `project: null` for org-level credentials,
397
- * which every caller here treats as an unusable session.
398
- */
399
-export type SessionInfoResponse = SessionRetrieveInfoResponse & {
400
- readonly project: NonNullable<SessionRetrieveInfoResponse['project']>;
401
-};
402
-
403
-const requireSessionProject = (
404
- info: SessionRetrieveInfoResponse
405
-): Effect.Effect<SessionInfoResponse, HttpDecodingError> =>
406
- info.project === null
407
- ? Effect.fail(
408
- new HttpDecodingError({
409
- cause: 'Session info response has no project (org-level credentials)',
410
- })
411
- )
412
- : Effect.succeed({ ...info, project: info.project });
413
-
414
-/**
415
- * The org member's user id, falling back to the member id. The backend still
416
- * sends `org_member.user_id` although the v3.1 spec omits it, and the persisted
417
- * test user id derives from it, so it is read defensively.
418
- */
419
-export const sessionUserIdOf = (info: SessionInfoResponse): string => {
420
- const member: object = info.org_member;
421
- return Predicate.hasProperty(member, 'user_id') && Predicate.isString(member.user_id)
422
- ? member.user_id
423
- : info.org_member.id;
424
-};
425
-
426
-/**
427
- * The project API key carried by a session, or null. The v3.1 spec names the
428
- * field `key`, and older responses spell it `api_key`; reading both keeps
429
- * `composio dev init` from minting a second key when the backend sends the
430
- * older spelling.
431
- */
432
-export const sessionProjectApiKeyOf = (info: SessionInfoResponse): string | null => {
433
- const apiKey: object | null = info.api_key;
434
- if (apiKey === null) return null;
435
- if (Predicate.hasProperty(apiKey, 'api_key') && Predicate.isString(apiKey.api_key)) {
436
- return apiKey.api_key;
437
- }
438
- return info.api_key?.key ?? null;
439
-};
440
-
441
-/**
442
- * A single project entry returned by GET /api/v3.1/org/project/list.
443
- */
444
-export type OrgProject = ProjectListResponse.Data;
445
-
446
-/**
447
- * Response from GET /api/v3.1/org/project/list.
448
- */
449
-export type OrgProjectListResponse = ProjectListResponse;
450
-
451
-export interface OrganizationSummary {
452
- readonly id: string;
453
- readonly name: string;
454
-}
455
-
456
-export interface OrganizationListResponse {
457
- readonly data: ReadonlyArray<OrganizationSummary>;
458
- readonly total_items: number;
459
-}
460
-
461
-export interface OrganizationProjectSummary {
462
- readonly id: string;
463
- readonly name: string;
464
-}
465
-
466
-export interface OrganizationProjectListResponse {
467
- readonly data: ReadonlyArray<OrganizationProjectSummary>;
468
- readonly total_items: number;
469
-}
470
-
471
-export type ConsumerProjectResolveResponse = ProjectResolveResponse;
472
-export type ConsumerConnectedToolkitsResponse = ConsumerListConnectedToolkitsResponse;
473
-
474
-export interface TriggerInstancesListActiveParams {
475
- user_ids?: string[];
476
- connected_account_ids?: string[];
477
- auth_config_ids?: string[];
478
- trigger_ids?: string[];
479
- trigger_names?: string[];
480
- show_disabled?: boolean;
481
- limit?: number;
482
-}
483
-
484
-export interface TriggerInstanceUpsertParams {
485
- connected_account_id?: string;
486
- trigger_config?: Record<string, unknown>;
487
-}
488
-
67
/**
68
* Client singleton
69
*/
102
* Shape exposed by {@link ComposioClientSingleton}.
103
*/
104
export interface ComposioClientSingletonShape {
105
+ /**
106
+ * The client for the user's key and, when the working directory resolves to
107
+ * a project, that project's org and project.
108
+ */
109
readonly get: () => Effect.Effect<
528
- _RawComposioClient,
110
+ ComposioClientShape,
111
ComposioClientConfigurationError | NoSuchElementError
112
>;
113
+ /**
114
+ * The client for an explicit scope. `userApiKey` defaults to the user's key.
115
+ */
116
readonly getFor: (params: {
117
userApiKey?: string;
118
orgId?: string;
119
projectId?: string;
535
- }) => Effect.Effect<_RawComposioClient, ComposioClientConfigurationError | NoSuchElementError>;
120
+ }) => Effect.Effect<ComposioClientShape, ComposioClientConfigurationError | NoSuchElementError>;
121
/**
122
* Returns a snapshot of the accumulated metrics (total bytes received and
123
* request count) across every client this singleton built.
130
131
/**
132
* Singleton service that lazily accesses `Config` only when needed, which is used to build and provide
548
- * a raw (uneffectful, Promise-based) Composio client instance.
133
+ * a Composio client instance from `@composio/client/effect`.
134
*
550
- * Clients are built with `Composio.fromEnv({}, ...)` so the ambient process
551
- * environment is never consulted: every credential and the base URL come from
552
- * the CLI's own configuration. Custom HTTP base URLs remain supported. The user key is
135
+ * Clients are built with `make`, which never consults the ambient process
136
+ * environment: every credential and the base URL come from the CLI's own
137
+ * configuration. Custom HTTP base URLs remain supported. The user key is
138
* placed in `defaultHeaders` as `x-user-api-key`, which keeps today's wire
139
* bytes on every operation; it is also passed as `userApiKey`, while the
140
* caller-placed header still wins at dispatch.
146
const path = yield* Path.Path;
147
const os = yield* NodeOs;
148
const metrics = makeClientMetricsCollector();
564
- const cache = new Map<string, _RawComposioClient>();
149
+ // A private memo map: under an application that already built
150
+ // `FetchHttpClient.layer`, a shared one would hand back that transport,
151
+ // which calls `globalThis.fetch` directly and counts nothing.
152
+ const httpClient = yield* Effect.provide(
153
+ HttpClient.HttpClient,
154
+ Layer.provide(FetchHttpClient.layer, Layer.succeed(FetchHttpClient.Fetch, metrics.fetch)),
155
+ { local: true }
156
+ );
157
+ const cache = new Map<string, ComposioClientShape>();
158
159
const getFor = (params?: { userApiKey?: string; orgId?: string; projectId?: string }) =>
160
Effect.gen(function* () {
177
178
const client = yield* Effect.try({
179
try: () =>
587
- // An empty environment prevents implicit env reads, including COMPOSIO_CUSTOM_HEADERS.
588
- _RawComposioClient.fromEnv(
589
- {},
180
+ // Responses are validated against the CLI's loader table unless a
181
+ // call passes `decode: false`.
182
+ makeComposioClient(
183
{
184
apiKey: null,
185
userApiKey: apiKey ?? null,
187
baseURL: ctx.data.baseURL,
188
// Preserve support for explicitly configured HTTP backends.
189
allowInsecureHTTP: true,
597
- logLevel: 'off',
190
+ deprecationNotices: 'off',
191
defaultHeaders: buildDefaultHeaders({
192
userApiKey: apiKey,
193
orgId: params?.orgId,
194
projectId: params?.projectId,
195
cliSessionId,
196
}),
604
- fetch: metrics.fetch,
605
- }
197
+ decode: true,
198
+ schemas: composioSchemaLoaders,
199
+ },
200
+ httpClient
201
),
202
catch: cause =>
203
new ComposioClientConfigurationError({
253
Layer.provide(ComposioUserContextLive)
254
);
255
}
661
-
662
-/**
663
- * Account, session-info, and consumer helpers
664
- *
665
- * Standalone functions rather than repository methods: they take explicit
666
- * credentials and scope, and callers already run inside layers that provide
667
- * `ComposioClientSingleton`.
668
- */
669
-
670
-const orgScopedOptions = (orgId: string | undefined): RequestOptions | undefined =>
671
- orgId ? { headers: { 'x-org-id': orgId } } : undefined;
672
-
673
-/**
674
- * Lists organizations available to the current user API key.
675
- */
676
-export const listOrganizations = (params: {
677
- apiKey: string;
678
- limit?: number;
679
-}): Effect.Effect<OrganizationListResponse, ClientError, ComposioClientSingleton> =>
680
- Effect.gen(function* () {
681
- const clientSingleton = yield* ComposioClientSingleton;
682
- const response = yield* request(clientSingleton.getFor({ userApiKey: params.apiKey }), client =>
683
- client.org.list({ limit: params.limit ?? 50 })
684
- );
685
- const organizations = response.organizations.map(
686
- (organization: OrgListResponse.Organization) =>
687
- ({ id: organization.id, name: organization.name }) satisfies OrganizationSummary
688
- );
689
-
690
- return {
691
- data: organizations,
692
- total_items: organizations.length,
693
- };
694
- });
695
-
696
-/**
697
- * Lists projects for a specific organization.
698
- */
699
-export const listOrganizationProjects = (params: {
700
- apiKey: string;
701
- orgId: string;
702
- limit?: number;
703
-}): Effect.Effect<OrganizationProjectListResponse, ClientError, ComposioClientSingleton> =>
704
- Effect.gen(function* () {
705
- const clientSingleton = yield* ComposioClientSingleton;
706
- const response = yield* request(clientSingleton.getFor({ userApiKey: params.apiKey }), client =>
707
- client.org.project.list({ limit: params.limit ?? 50 }, orgScopedOptions(params.orgId))
708
- );
709
- const projects = response.data.map(
710
- (project: OrgProject) =>
711
- ({ id: project.id, name: project.name }) satisfies OrganizationProjectSummary
712
- );
713
-
714
- return {
715
- data: projects,
716
- total_items: projects.length,
717
- };
718
- });
719
-
720
-/**
721
- * Lists all projects for the logged-in user's organization.
722
- *
723
- * @param params.apiKey - UAK (sent as `x-user-api-key`)
724
- * @param params.orgId - Organization ID (sent as `x-org-id`)
725
- * @param params.limit - Max projects to return (default 50)
726
- */
727
-export const listOrgProjects = (params: {
728
- apiKey: string;
729
- orgId: string;
730
- limit?: number;
731
-}): Effect.Effect<OrgProjectListResponse, ClientError, ComposioClientSingleton> =>
732
- Effect.gen(function* () {
733
- const clientSingleton = yield* ComposioClientSingleton;
734
- return yield* request(clientSingleton.getFor({ userApiKey: params.apiKey }), client =>
735
- client.org.project.list(
736
- { list_all_org_projects: true, limit: params.limit ?? 50 },
737
- orgScopedOptions(params.orgId)
738
- )
739
- );
740
- });
741
-
742
-/**
743
- * Calls GET /api/v3.1/auth/session/info with the full layered auth headers.
744
- */
745
-export const getSessionInfo = (params: {
746
- apiKey: string;
747
- orgId: string;
748
- projectId: string;
749
-}): Effect.Effect<SessionInfoResponse, ClientError, ComposioClientSingleton> =>
750
- Effect.gen(function* () {
751
- const clientSingleton = yield* ComposioClientSingleton;
752
- const info = yield* request(
753
- clientSingleton.getFor({
754
- userApiKey: params.apiKey,
755
- orgId: params.orgId,
756
- projectId: params.projectId,
757
- }),
758
- client => client.auth.session.retrieveInfo()
759
- );
760
- return yield* requireSessionProject(info);
761
- });
762
-
763
-/**
764
- * Calls GET /api/v3.1/auth/session/info using the x-user-api-key header.
765
- * Unlike getSessionInfo which requires both org AND project IDs, this variant
766
- * resolves session metadata from the UAK alone — useful during login before
767
- * org/project context is known.
768
- *
769
- * When `orgId` is provided, it is forwarded as `x-org-id` so the backend
770
- * resolves the session against the caller's currently-selected global org
771
- * (set via `composio orgs switch`). Without it, the backend falls back to the
772
- * API key's home org, which makes the response ignore any org switch.
773
- */
774
-export const getSessionInfoByUserApiKey = (params: {
775
- userApiKey: string;
776
- orgId?: string;
777
-}): Effect.Effect<SessionInfoResponse, ClientError, ComposioClientSingleton> =>
778
- Effect.gen(function* () {
779
- const clientSingleton = yield* ComposioClientSingleton;
780
- const info = yield* request(clientSingleton.getFor({ userApiKey: params.userApiKey }), client =>
781
- client.auth.session.retrieveInfo(orgScopedOptions(params.orgId))
782
- );
783
- return yield* requireSessionProject(info);
784
- });
785
-
786
-// The create-api-key response shape is not documented in the client. Walk the
787
-// body for the first `uak_`/`ak_`-prefixed string under a key-like name.
788
-const getApiKeyFromPayload = (payload: unknown): string | undefined => {
789
- const candidates = new Set<string>(['api_key', 'apiKey', 'key', 'token']);
790
- const keyPrefixes = ['uak_', 'ak_'];
791
- const queue: unknown[] = [payload];
792
-
793
- while (queue.length > 0) {
794
- const current = queue.shift();
795
- if (!current || typeof current !== 'object') continue;
796
-
797
- if (Array.isArray(current)) {
798
- queue.push(...current);
799
- continue;
800
- }
801
-
802
- const entries = Object.entries(current as Record<string, unknown>);
803
- for (const [key, value] of entries) {
804
- if (
805
- typeof value === 'string' &&
806
- candidates.has(key) &&
807
- keyPrefixes.some(prefix => value.startsWith(prefix))
808
- ) {
809
- return value;
810
- }
811
- if (value && typeof value === 'object') {
812
- queue.push(value);
813
- }
814
- }
815
- }
816
-
817
- return undefined;
818
-};
819
-
820
-/**
821
- * Mints a project API key. Never retried: a retry after a timed-out create
822
- * would mint a second key the caller never sees.
823
- */
824
-export const createProjectApiKey = (params: {
825
- apiKey: string;
826
- orgId: string;
827
- projectId: string;
828
- name: string;
829
-}): Effect.Effect<string, ClientError, ComposioClientSingleton> =>
830
- Effect.gen(function* () {
831
- const clientSingleton = yield* ComposioClientSingleton;
832
- const payload = yield* request(
833
- clientSingleton.getFor({
834
- userApiKey: params.apiKey,
835
- orgId: params.orgId,
836
- projectId: params.projectId,
837
- }),
838
- client =>
839
- client.post<unknown>(`/api/v3/org/project/${params.projectId}/api_keys/create`, {
840
- body: { name: params.name },
841
- maxRetries: 0,
842
- })
843
- );
844
- const createdApiKey = getApiKeyFromPayload(payload);
845
-
846
- if (!createdApiKey) {
847
- return yield* Effect.fail(
848
- new HttpDecodingError({
849
- cause: 'Create API key response did not contain an API key',
850
- })
851
- );
852
- }
853
-
854
- return createdApiKey;
855
- });
856
-
857
-export const resolveConsumerProject = (params: {
858
- apiKey: string;
859
- orgId: string;
860
-}): Effect.Effect<ConsumerProjectResolveResponse, ClientError, ComposioClientSingleton> =>
861
- Effect.gen(function* () {
862
- const clientSingleton = yield* ComposioClientSingleton;
863
- return yield* request(clientSingleton.getFor({ userApiKey: params.apiKey }), client =>
864
- client.org.consumer.project.resolve({
865
- 'x-user-api-key': params.apiKey,
866
- 'x-org-id': params.orgId,
867
- })
868
- );
869
- });
870
-
871
-/**
872
- * Resolves the latest version of a tool. When `projectApiKey` is given the
873
- * request carries `x-api-key` instead of the user key, so exactly one
874
- * credential is sent.
875
- */
876
-export const getLatestToolVersion = (params: {
877
- apiKey: string;
878
- toolSlug: string;
879
- orgId?: string;
880
- projectId?: string;
881
- projectApiKey?: string;
882
-}): Effect.Effect<LatestToolVersionResponse, ClientError, ComposioClientSingleton> =>
883
- Effect.gen(function* () {
884
- const clientSingleton = yield* ComposioClientSingleton;
885
- const headers = {
886
- ...(params.projectApiKey
887
- ? { 'x-api-key': params.projectApiKey, 'x-user-api-key': null }
888
- : {}),
889
- ...(params.orgId ? { 'x-org-id': params.orgId } : {}),
890
- ...(params.projectId ? { 'x-project-id': params.projectId } : {}),
891
- };
892
- const payload = yield* request(
893
- clientSingleton.getFor({
894
- userApiKey: params.apiKey,
895
- orgId: params.orgId,
896
- projectId: params.projectId,
897
- }),
898
- client =>
899
- client.get<unknown>(
900
- `/api/v3/tools/${encodeURIComponent(params.toolSlug)}/get_latest_version`,
901
- { headers }
902
- )
903
- );
904
- return yield* decode(LatestToolVersionResponse)(payload);
905
- });
906
-
907
-export const getConsumerConnectedToolkits = (params: {
908
- apiKey: string;
909
- orgId: string;
910
- consumerUserId: string;
911
-}): Effect.Effect<ConsumerConnectedToolkitsResponse, ClientError, ComposioClientSingleton> =>
912
- Effect.gen(function* () {
913
- const clientSingleton = yield* ComposioClientSingleton;
914
- return yield* request(clientSingleton.getFor({ userApiKey: params.apiKey }), client =>
915
- client.org.consumer.listConnectedToolkits({
916
- user_id: params.consumerUserId,
917
- 'x-user-api-key': params.apiKey,
918
- 'x-org-id': params.orgId,
919
- })
920
- );
921
- });
922
-
923
-export class DeveloperProjectNotFoundError extends Data.TaggedError(
924
- 'services/DeveloperProjectNotFoundError'
925
-)<{
926
- readonly orgId: string;
927
- readonly projectName: string;
928
-}> {}
929
-
930
-export class AmbiguousDeveloperProjectNameError extends Data.TaggedError(
931
- 'services/AmbiguousDeveloperProjectNameError'
932
-)<{
933
- readonly orgId: string;
934
- readonly projectName: string;
935
- readonly matches: ReadonlyArray<OrganizationProjectSummary>;
936
-}> {}
937
-
938
-export const findDeveloperProjectByName = (params: {
939
- apiKey: string;
940
- orgId: string;
941
- name: string;
942
- limit?: number;
943
-}): Effect.Effect<
944
- OrganizationProjectSummary,
945
- DeveloperProjectNotFoundError | AmbiguousDeveloperProjectNameError | ClientError,
946
- ComposioClientSingleton
947
-> =>
948
- Effect.gen(function* () {
949
- const projects = yield* listOrgProjects({
950
- apiKey: params.apiKey,
951
- orgId: params.orgId,
952
- limit: params.limit,
953
- });
954
-
955
- const normalizedName = String.toLowerCase(params.name.trim());
956
- const matches = projects.data.filter(
957
- project => String.toLowerCase(project.name) === normalizedName
958
- );
959
-
960
- if (matches.length === 0) {
961
- return yield* Effect.fail(
962
- new DeveloperProjectNotFoundError({
963
- orgId: params.orgId,
964
- projectName: params.name,
965
- })
966
- );
967
- }
968
-
969
- if (matches.length > 1) {
970
- return yield* Effect.fail(
971
- new AmbiguousDeveloperProjectNameError({
972
- orgId: params.orgId,
973
- projectName: params.name,
974
- matches,
975
- })
976
- );
977
- }
978
-
979
- return matches[0];
980
- });
981
-
256
/**
257
* Repositories
258
*/
259
986
-/**
987
- * Auth config, connected account, and trigger instance operations: single-page
988
- * CRUD with no catalog caching.
989
- */
990
-const resourceOperations = (client: Effect.Effect<_RawComposioClient, ClientError>) => ({
991
- /**
992
- * Lists auth configs with optional filters. Returns a single page of results.
993
- * @param params - Search/filter parameters
994
- */
995
- listAuthConfigs: (params: {
996
- search?: string;
997
- toolkit_slug?: string;
998
- limit?: number;
999
- show_disabled?: boolean;
1000
- }) =>
1001
- request(client, c =>
1002
- c.authConfigs.list({
1003
- search: params.search,
1004
- toolkit_slug: params.toolkit_slug,
1005
- limit: params.limit,
1006
- show_disabled: params.show_disabled ?? true,
1007
- })
1008
- ).pipe(Effect.flatMap(decode(AuthConfigListResponse))),
1009
- /**
1010
- * Retrieves detailed info about a single auth config by its nanoid.
1011
- * @param nanoid - Auth config ID
1012
- */
1013
- getAuthConfig: (nanoid: string) =>
1014
- request(client, c => c.authConfigs.retrieve(nanoid)).pipe(
1015
- Effect.flatMap(decode(AuthConfigItem))
1016
- ),
1017
- /**
1018
- * Creates a new auth config for a toolkit.
1019
- * @param params - Create parameters (discriminated union: use_composio_managed_auth | use_custom_auth)
1020
- */
1021
- createAuthConfig: (params: AuthConfigCreateParams) =>
1022
- request(client, c => c.authConfigs.create(params)).pipe(
1023
- Effect.flatMap(decode(AuthConfigCreateResponse))
1024
- ),
1025
- /**
1026
- * Soft-deletes an auth config by its nanoid.
1027
- * @param nanoid - Auth config ID
1028
- */
1029
- deleteAuthConfig: (nanoid: string) => request(client, c => c.authConfigs.delete(nanoid)),
1030
- /**
1031
- * List connected accounts with optional filters. Returns a single page of results.
1032
- * @param params - Search/filter parameters
1033
- */
1034
- listConnectedAccounts: (params: {
1035
- toolkit_slugs?: string[];
1036
- user_ids?: string[];
1037
- statuses?: ConnectedAccountListParams['statuses'];
1038
- limit?: number;
1039
- }) =>
1040
- request(client, c =>
1041
- c.connectedAccounts.list({
1042
- toolkit_slugs: params.toolkit_slugs,
1043
- user_ids: params.user_ids,
1044
- statuses: params.statuses,
1045
- limit: params.limit,
1046
- })
1047
- ).pipe(Effect.flatMap(decode(ConnectedAccountListResponse))),
1048
- /**
1049
- * Retrieves detailed info about a single connected account by its nanoid.
1050
- * @param nanoid - Connected account ID (e.g. "con_1a2b3c4d5e6f")
1051
- */
1052
- getConnectedAccount: (nanoid: string) =>
1053
- request(client, c => c.connectedAccounts.retrieve(nanoid)).pipe(
1054
- Effect.flatMap(decode(ConnectedAccountItem))
1055
- ),
1056
- /**
1057
- * Soft-deletes a connected account by its nanoid.
1058
- * @param nanoid - Connected account ID
1059
- */
1060
- deleteConnectedAccount: (nanoid: string) =>
1061
- request(client, c => c.connectedAccounts.delete(nanoid)),
1062
- /**
1063
- * Creates a new authentication link session for connecting an external account.
1064
- * @param params - auth_config_id and user_id
1065
- */
1066
- createConnectedAccountLink: (params: { auth_config_id: string; user_id: string }) =>
1067
- request(client, c => c.link.create(params)),
1068
- /**
1069
- * Lists active trigger instances with optional filters.
1070
- * Returns a single page of results.
1071
- */
1072
- listActiveTriggers: (params: TriggerInstancesListActiveParams) =>
1073
- request(client, c =>
1074
- c.triggerInstances.listActive({
1075
- user_ids: params.user_ids,
1076
- connected_account_ids: params.connected_account_ids,
1077
- auth_config_ids: params.auth_config_ids,
1078
- trigger_ids: params.trigger_ids,
1079
- trigger_names: params.trigger_names,
1080
- show_disabled: params.show_disabled,
1081
- limit: params.limit,
1082
- })
1083
- ).pipe(
1084
- Effect.flatMap(response =>
1085
- decode(TriggerInstanceItems)(response.items).pipe(
1086
- // `triggers status` prints `total_items` directly, so a response that
1087
- // omits a count renders as a number rather than `undefined`.
1088
- Effect.map(items => ({
1089
- ...response,
1090
- items,
1091
- total_items: response.total_items ?? items.length,
1092
- total_pages: response.total_pages ?? 1,
1093
- current_page: response.current_page ?? 1,
1094
- next_cursor: response.next_cursor ?? null,
1095
- }))
1096
- )
1097
- )
1098
- ),
1099
- createTrigger: (triggerSlug: string, params?: TriggerInstanceUpsertParams) =>
1100
- request(client, c => c.triggerInstances.upsert(triggerSlug, params)),
1101
- enableTrigger: (triggerId: string) =>
1102
- request(client, c => c.triggerInstances.manage.update(triggerId, { status: 'enable' })),
1103
- disableTrigger: (triggerId: string) =>
1104
- request(client, c => c.triggerInstances.manage.update(triggerId, { status: 'disable' })),
1105
- deleteTrigger: (triggerId: string) =>
1106
- request(client, c => c.triggerInstances.manage.delete(triggerId)),
1107
-});
1108
-
260
const makeComposioToolkitsRepository = Effect.gen(function* () {
261
const clientSingleton = yield* ComposioClientSingleton;
262
const client = clientSingleton.get();
263
264
const listToolkits = (managedBy?: 'project', scope?: ToolkitProjectScope) =>
1114
- requestAll(scope ? clientSingleton.getFor(scope) : client, (c, { cursor, limit }, signal) =>
1115
- c.toolkits.list({ cursor, limit, managed_by: managedBy }, { signal })
265
+ collectAll(scope ? clientSingleton.getFor(scope) : client, c =>
266
+ c.toolkits.listStream({ limit: MAX_PAGE_SIZE, managed_by: managedBy }, undecoded)
267
).pipe(Effect.flatMap(decode(Toolkits)), Effect.map(sortBySlug));
268
269
const getToolkitDetailed = (slug: string) =>
1119
- request(client, c => c.toolkits.retrieve(slug)).pipe(Effect.flatMap(decode(ToolkitDetailed)));
270
+ client.pipe(
271
+ Effect.flatMap(c => c.toolkits.retrieve(slug, undefined, undecoded)),
272
+ Effect.flatMap(decode(ToolkitDetailed))
273
+ );
274
275
// The retrieve endpoint omits `auth_schemes`; fill it so the result
276
// satisfies the catalog `Toolkit` contract.
305
).pipe(Effect.map(sortBySlug));
306
307
const listTools = (query: { toolkit_slug?: string; toolkit_versions: string }) =>
1154
- requestAll(client, (c, { cursor, limit }, signal) =>
1155
- c.tools.list({ ...query, cursor, limit }, { signal })
1156
- ).pipe(Effect.flatMap(decode(Tools)));
308
+ collectAll(client, c => c.tools.listStream({ ...query, limit: MAX_PAGE_SIZE }, undecoded)).pipe(
309
+ Effect.flatMap(decode(Tools))
310
+ );
311
312
return {
313
getToolkits,
318
* Retrieve a list of all available tool enumeration values (tool slugs) for the project.
319
*/
320
getToolsAsEnums: () =>
1167
- request(client, c => c.tools.retrieveEnum()).pipe(Effect.flatMap(decode(ToolsAsEnums))),
321
+ client.pipe(
322
+ Effect.flatMap(c => c.tools.retrieveEnum(undecoded)),
323
+ Effect.flatMap(decode(ToolsAsEnums))
324
+ ),
325
/**
326
* Fetches tools with optional toolkit filtering, always at the latest
327
* toolkit version. For per-toolkit versions use `getToolsByVersionSpecs`.
348
* Retrieves a list of all available trigger type enum values that can be used across the API.
349
*/
350
getTriggerTypesAsEnums: () =>
1194
- request(client, c => c.triggersTypes.retrieveEnum()).pipe(
351
+ client.pipe(
352
+ Effect.flatMap(c => c.triggersTypes.retrieveEnum(undecoded)),
353
Effect.flatMap(decode(TriggerTypesAsEnums))
354
),
1197
- /**
1198
- * Retrieves detailed info about a single trigger type by slug.
1199
- * @param slug - Trigger type slug (e.g. "GMAIL_NEW_GMAIL_MESSAGE")
1200
- */
1201
- getTriggerTypeDetailed: (slug: string) =>
1202
- request(client, c => c.triggersTypes.retrieve(slug)).pipe(
1203
- Effect.flatMap(decode(TriggerType))
1204
- ),
355
/**
356
* Fetches trigger types with optional toolkit filtering.
357
* When toolkitSlugs is provided, fetches all matching trigger types.
358
* @param toolkitSlugs - Optional array of toolkit slugs to filter by
359
*/
360
getTriggerTypes: (toolkitSlugs?: ReadonlyArray<string>) =>
1211
- requestAll(client, (c, { cursor, limit }, signal) =>
1212
- c.triggersTypes.list(
1213
- {
1214
- cursor,
1215
- limit,
1216
- toolkit_slugs: toolkitSlugs ? [...toolkitSlugs] : undefined,
1217
- },
1218
- { signal }
361
+ collectAll(client, c =>
362
+ c.triggersTypes.listStream(
363
+ { limit: MAX_PAGE_SIZE, toolkit_slugs: toolkitSlugs ? [...toolkitSlugs] : undefined },
364
+ undecoded
365
)
366
).pipe(Effect.flatMap(decode(TriggerTypes)), Effect.map(sortBySlug)),
367
/**
424
},
425
InvalidToolkitVersionsError | InvalidToolkitsError | ClientError
426
> => validateToolkitVersionsImpl(getToolkit, overrides, relevantToolkits),
1281
- /**
1282
- * Searches toolkits with optional filters. Returns a single page of results.
1283
- * @param params - Search/filter parameters
1284
- */
1285
- searchToolkits: (params: {
1286
- search?: string;
1287
- category?: string;
1288
- limit?: number;
1289
- cursor?: string;
1290
- }): Effect.Effect<ToolkitSearchResult, ClientError> =>
1291
- request(client, c =>
1292
- c.toolkits.list({
1293
- search: params.search,
1294
- category: params.category,
1295
- limit: params.limit,
1296
- cursor: params.cursor,
1297
- })
1298
- ).pipe(
1299
- Effect.flatMap(response =>
1300
- decode(Toolkits)(response.items).pipe(
1301
- Effect.map(
1302
- items =>
1303
- ({
1304
- items,
1305
- total_items: response.total_items,
1306
- total_pages: response.total_pages,
1307
- next_cursor: response.next_cursor ?? null,
1308
- }) satisfies ToolkitSearchResult
1309
- )
1310
- )
1311
- )
1312
- ),
427
/**
428
* Retrieves detailed toolkit info including auth_config_details.
429
* @param slug - Toolkit slug
430
*/
431
getToolkitDetailed,
1318
- /**
1319
- * Searches tools with optional filters. Returns a single page of results.
1320
- * @param params - Search/filter parameters
1321
- */
1322
- searchTools: (params: {
1323
- search?: string;
1324
- toolkit_slug?: string;
1325
- tags?: string;
1326
- limit?: number;
1327
- cursor?: string;
1328
- }) =>
1329
- request(client, c =>
1330
- c.tools.list({
1331
- search: params.search,
1332
- toolkit_slug: params.toolkit_slug,
1333
- tags: params.tags ? params.tags.split(',').map(t => t.trim()) : undefined,
1334
- limit: params.limit,
1335
- cursor: params.cursor,
1336
- toolkit_versions: 'latest',
1337
- })
1338
- ),
1339
- /**
1340
- * Retrieves detailed info about a single tool by slug.
1341
- * @param slug - Tool slug (e.g. "GMAIL_SEND_EMAIL")
1342
- */
1343
- getToolDetailed: (slug: string) =>
1344
- request(client, c => c.tools.retrieve(slug, { toolkit_versions: 'latest' })),
432
+ ...lookupOperations(client),
433
...resourceOperations(client),
434
};
435
});
456
* @param params.scope - 'user' for login, 'project' for init (future)
457
*/
458
createSession: (params?: { scope?: 'user' | 'project' }) =>
1371
- request(client, c => c.cli.createSession({ scope: params?.scope ?? 'user' })).pipe(
459
+ client.pipe(
460
+ Effect.flatMap(c => c.cli.createSession({ scope: params?.scope ?? 'user' }, undecoded)),
461
Effect.flatMap(decode(Session))
462
),
463
/**
464
* Retrieves the current state of a CLI session using either the session ID (UUID) or the 6-character code.
465
*/
466
getSession: (session: { id: string }) =>
1378
- request(client, c => c.cli.getSession({ id: session.id })).pipe(
467
+ client.pipe(
468
+ Effect.flatMap(c => c.cli.getSession({ id: session.id }, undecoded)),
469
Effect.flatMap(decode(RetrievedSession))
470
),
1381
- getRealtimeCredentials: () => request(client, c => c.cli.realtime.credentials()),
471
+ getRealtimeCredentials: () => Effect.flatMap(client, c => c.cli.realtime.credentials()),
472
authRealtimeChannel: (params: { channel_name: string; socket_id: string }) =>
1383
- request(client, c => c.cli.realtime.auth(params)),
473
+ Effect.flatMap(client, c => c.cli.realtime.auth(params, undecoded)),
474
};
475
});
476