@cosmoops/connect-sdk 0.6.0 → 0.9.0
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/CHANGELOG.md +165 -0
- package/README.md +273 -91
- package/dist/cjs/cli/doctor.js +3 -3
- package/dist/cjs/cli/init.js +3 -3
- package/dist/cjs/client/components/access-gate.js +42 -7
- package/dist/cjs/client/components/account-sessions.js +3 -3
- package/dist/cjs/client/components/ai-format.js +135 -0
- package/dist/cjs/client/components/ai-widgets.js +232 -0
- package/dist/cjs/client/components/app-shell.js +9 -8
- package/dist/cjs/client/components/apps-grid.js +3 -3
- package/dist/cjs/client/components/ask-ai.js +334 -0
- package/dist/cjs/client/components/feature-gate.js +2 -2
- package/dist/cjs/client/components/integrations-modal.js +1 -1
- package/dist/cjs/client/components/logo.js +3 -3
- package/dist/cjs/client/components/nav.js +1 -1
- package/dist/cjs/client/components/plan-pricing.js +1 -1
- package/dist/cjs/client/components/plans.js +6 -6
- package/dist/cjs/client/components/readiness.js +3 -3
- package/dist/cjs/client/components/side-nav.js +1 -1
- package/dist/cjs/client/components/subscribe-dialog.js +2 -2
- package/dist/cjs/client/components/subscription.js +1 -1
- package/dist/cjs/client/components/usage-meter.js +1 -1
- package/dist/cjs/client/components/user-menu.js +31 -8
- package/dist/cjs/client/components/workspace-type-gate.js +48 -0
- package/dist/cjs/client/index.js +32 -4
- package/dist/cjs/client/mark.js +1 -1
- package/dist/cjs/client/provider.js +50 -7
- package/dist/cjs/client/use-checkout.js +3 -3
- package/dist/cjs/errors.js +4 -4
- package/dist/cjs/helpers.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/next/index.js +2 -2
- package/dist/cjs/server/client.js +15 -15
- package/dist/cjs/server/handler.js +56 -13
- package/dist/cjs/server/http.js +47 -25
- package/dist/cjs/server/resources/access.js +3 -3
- package/dist/cjs/server/resources/ai.js +1 -1
- package/dist/cjs/server/resources/analytics.js +2 -2
- package/dist/cjs/server/resources/apps.js +4 -4
- package/dist/cjs/server/resources/billing.js +5 -5
- package/dist/cjs/server/resources/drive.js +4 -4
- package/dist/cjs/server/resources/entitlements.js +48 -7
- package/dist/cjs/server/resources/identity.js +6 -4
- package/dist/cjs/server/resources/integrations.js +13 -13
- package/dist/cjs/server/resources/logs.js +3 -3
- package/dist/cjs/server/resources/sessions.js +6 -6
- package/dist/cjs/server/webhooks.js +4 -4
- package/dist/cjs/types.js +1 -1
- package/dist/esm/cli/doctor.js +3 -3
- package/dist/esm/cli/init.js +3 -3
- package/dist/esm/client/components/access-gate.js +43 -8
- package/dist/esm/client/components/account-sessions.js +3 -3
- package/dist/esm/client/components/ai-format.js +129 -0
- package/dist/esm/client/components/ai-widgets.js +223 -0
- package/dist/esm/client/components/app-shell.js +8 -7
- package/dist/esm/client/components/apps-grid.js +3 -3
- package/dist/esm/client/components/ask-ai.js +331 -0
- package/dist/esm/client/components/feature-gate.js +2 -2
- package/dist/esm/client/components/integrations-modal.js +1 -1
- package/dist/esm/client/components/logo.js +3 -3
- package/dist/esm/client/components/nav.js +1 -1
- package/dist/esm/client/components/plan-pricing.js +1 -1
- package/dist/esm/client/components/plans.js +6 -6
- package/dist/esm/client/components/readiness.js +3 -3
- package/dist/esm/client/components/side-nav.js +1 -1
- package/dist/esm/client/components/subscribe-dialog.js +2 -2
- package/dist/esm/client/components/subscription.js +1 -1
- package/dist/esm/client/components/usage-meter.js +1 -1
- package/dist/esm/client/components/user-menu.js +31 -8
- package/dist/esm/client/components/workspace-type-gate.js +45 -0
- package/dist/esm/client/index.js +14 -3
- package/dist/esm/client/mark.js +1 -1
- package/dist/esm/client/provider.js +48 -7
- package/dist/esm/client/use-checkout.js +3 -3
- package/dist/esm/errors.js +4 -4
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/next/index.js +2 -2
- package/dist/esm/server/client.js +15 -15
- package/dist/esm/server/handler.js +56 -13
- package/dist/esm/server/http.js +47 -25
- package/dist/esm/server/resources/access.js +3 -3
- package/dist/esm/server/resources/ai.js +1 -1
- package/dist/esm/server/resources/analytics.js +2 -2
- package/dist/esm/server/resources/apps.js +4 -4
- package/dist/esm/server/resources/billing.js +5 -5
- package/dist/esm/server/resources/drive.js +4 -4
- package/dist/esm/server/resources/entitlements.js +48 -7
- package/dist/esm/server/resources/identity.js +6 -4
- package/dist/esm/server/resources/integrations.js +13 -13
- package/dist/esm/server/resources/logs.js +3 -3
- package/dist/esm/server/resources/sessions.js +6 -6
- package/dist/esm/server/webhooks.js +4 -4
- package/dist/esm/types.js +1 -1
- package/dist/theme.css +87 -0
- package/dist/types/client/components/access-gate.d.ts +18 -4
- package/dist/types/client/components/account-sessions.d.ts +1 -1
- package/dist/types/client/components/ai-format.d.ts +24 -0
- package/dist/types/client/components/ai-widgets.d.ts +42 -0
- package/dist/types/client/components/app-shell.d.ts +25 -9
- package/dist/types/client/components/apps-grid.d.ts +1 -1
- package/dist/types/client/components/ask-ai.d.ts +73 -0
- package/dist/types/client/components/feature-gate.d.ts +1 -1
- package/dist/types/client/components/integrations-modal.d.ts +1 -1
- package/dist/types/client/components/logo.d.ts +5 -5
- package/dist/types/client/components/nav.d.ts +3 -3
- package/dist/types/client/components/plan-pricing.d.ts +2 -2
- package/dist/types/client/components/readiness.d.ts +2 -2
- package/dist/types/client/components/side-nav.d.ts +1 -1
- package/dist/types/client/components/subscribe-dialog.d.ts +3 -3
- package/dist/types/client/components/usage-meter.d.ts +1 -1
- package/dist/types/client/components/user-menu.d.ts +4 -3
- package/dist/types/client/components/workspace-type-gate.d.ts +48 -0
- package/dist/types/client/index.d.ts +11 -4
- package/dist/types/client/mark.d.ts +1 -1
- package/dist/types/client/provider.d.ts +52 -9
- package/dist/types/client/use-checkout.d.ts +3 -3
- package/dist/types/errors.d.ts +4 -4
- package/dist/types/helpers.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/next/index.d.ts +1 -1
- package/dist/types/server/client.d.ts +13 -13
- package/dist/types/server/handler.d.ts +2 -2
- package/dist/types/server/http.d.ts +6 -1
- package/dist/types/server/resources/access.d.ts +3 -3
- package/dist/types/server/resources/ai.d.ts +2 -2
- package/dist/types/server/resources/analytics.d.ts +2 -2
- package/dist/types/server/resources/apps.d.ts +4 -4
- package/dist/types/server/resources/billing.d.ts +4 -4
- package/dist/types/server/resources/drive.d.ts +4 -4
- package/dist/types/server/resources/entitlements.d.ts +37 -5
- package/dist/types/server/resources/identity.d.ts +2 -2
- package/dist/types/server/resources/integrations.d.ts +9 -9
- package/dist/types/server/resources/logs.d.ts +3 -3
- package/dist/types/server/resources/sessions.d.ts +5 -5
- package/dist/types/server/webhooks.d.ts +4 -4
- package/dist/types/types.d.ts +235 -61
- package/package.json +8 -2
|
@@ -57,7 +57,7 @@ export declare function useConnectCheckout(): ConnectCheckoutState & {
|
|
|
57
57
|
export interface CheckoutUrlOptions {
|
|
58
58
|
/** Connect's origin, from `useConnect().appUrl`. */
|
|
59
59
|
appUrl: string;
|
|
60
|
-
|
|
60
|
+
applicationId: string;
|
|
61
61
|
planId: string;
|
|
62
62
|
/**
|
|
63
63
|
* The live subscription's id, when there is one. Present means "change the
|
|
@@ -85,9 +85,9 @@ export declare function buildCancelUrl({ appUrl, subscriptionId }: {
|
|
|
85
85
|
* The Connect URL that completes a subscribe or a plan change.
|
|
86
86
|
*
|
|
87
87
|
* Both land on a modal Connect renders over the relevant page (an intercepted
|
|
88
|
-
* parallel route - `app/@modal/(.)
|
|
88
|
+
* parallel route - `app/@modal/(.)applications/...` and
|
|
89
89
|
* `app/@modal/(.)billing/...`), so the customer arrives already looking at the
|
|
90
90
|
* confirmation for the plan they picked here, not at a catalogue they have to
|
|
91
91
|
* find it in again.
|
|
92
92
|
*/
|
|
93
|
-
export declare function buildCheckoutUrl({ appUrl,
|
|
93
|
+
export declare function buildCheckoutUrl({ appUrl, applicationId, planId, subscriptionId, coupon, }: CheckoutUrlOptions): string;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Every failure the Connect
|
|
2
|
+
* Every failure the Connect application API can report, as one class.
|
|
3
3
|
*
|
|
4
4
|
* The API speaks two error dialects and this collapses them: the
|
|
5
|
-
* `/api/v1/
|
|
5
|
+
* `/api/v1/application/*` endpoints use `{ error: { code, message } }`, while the
|
|
6
6
|
* three `/sso/*` ones use OAuth2's `{ error, error_description }` (RFC 6749
|
|
7
7
|
* §5.2). Both land here with `code` populated, so integrating code branches on
|
|
8
8
|
* one field either way.
|
|
@@ -40,7 +40,7 @@ export declare class ConnectError extends Error {
|
|
|
40
40
|
* Whether the user's Connect sign-in is over and they need to go back
|
|
41
41
|
* through `identity.authorizeUrl()`. Collapses every session-side failure,
|
|
42
42
|
* matching how the API reports them - unknown, expired, revoked, or issued
|
|
43
|
-
* to a different
|
|
43
|
+
* to a different application all arrive as one `invalid_token`.
|
|
44
44
|
*/
|
|
45
45
|
get isSessionExpired(): boolean;
|
|
46
46
|
/**
|
|
@@ -52,7 +52,7 @@ export declare class ConnectError extends Error {
|
|
|
52
52
|
* guessing keys. These two are the exception: reaching them required
|
|
53
53
|
* presenting a key whose hash matched, so you already hold it, and what you
|
|
54
54
|
* need to know is that no retry and no scope change will fix this - the key
|
|
55
|
-
* has to be reissued from the
|
|
55
|
+
* has to be reissued from the application's Integration tab.
|
|
56
56
|
*
|
|
57
57
|
* Worth alerting on. It is the one failure that will not resolve itself and
|
|
58
58
|
* takes down every call your integration makes.
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type WirePlanFeature = string | PlanFeature;
|
|
|
21
21
|
* Coerces either wire shape into `PlanFeature[]`.
|
|
22
22
|
*
|
|
23
23
|
* A bare key becomes `{ key, name: key, description: "" }` - the same
|
|
24
|
-
* fallback the server applies for a plan older than its
|
|
24
|
+
* fallback the server applies for a plan older than its application's feature
|
|
25
25
|
* catalog, so an un-upgraded Connect renders exactly what it always did
|
|
26
26
|
* rather than a column of blanks.
|
|
27
27
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@cosmoops/connect-sdk` - the official client for the CosmoOps Connect
|
|
3
|
-
* **
|
|
3
|
+
* **application-partner API** (`/api/v1/application/*`).
|
|
4
4
|
*
|
|
5
5
|
* This root entry is the isomorphic surface: wire types, the error class, and
|
|
6
6
|
* pure helpers. It pulls in neither Node-only code nor React, so it is safe to
|
|
@@ -125,7 +125,7 @@ export declare function getConnectSession(request?: Request, options?: {
|
|
|
125
125
|
* A thin wrapper, not a framework of its own - reach for `getConnectSession`
|
|
126
126
|
* plus your own check when "not signed in" isn't "redirect to sign-in"
|
|
127
127
|
* (an API route returning 401, say). Role and entitlement checks stay
|
|
128
|
-
* outside this function on purpose: `session.
|
|
128
|
+
* outside this function on purpose: `session.applicationRole.granted` and
|
|
129
129
|
* `connect.entitlements.*` are one line each on top of the session this
|
|
130
130
|
* already gives you, and where that line redirects (a plans page, a
|
|
131
131
|
* "forbidden" screen) is a decision only your app can make - see
|
|
@@ -14,7 +14,7 @@ import { SessionsResource } from "./resources/sessions.js";
|
|
|
14
14
|
export declare const DEFAULT_BASE_URL = "https://connect.cosmoops.com";
|
|
15
15
|
export interface ConnectClientOptions {
|
|
16
16
|
/**
|
|
17
|
-
* The API key plaintext from this
|
|
17
|
+
* The API key plaintext from this application's Integration tab, shown once at
|
|
18
18
|
* creation.
|
|
19
19
|
*
|
|
20
20
|
* One credential does three jobs: it is the `Authorization: Bearer` value
|
|
@@ -39,9 +39,9 @@ export interface ConnectClientOptions {
|
|
|
39
39
|
fetch?: FetchLike;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* The CosmoOps Connect
|
|
42
|
+
* The CosmoOps Connect application-partner API.
|
|
43
43
|
*
|
|
44
|
-
* Covers `/api/v1/
|
|
44
|
+
* Covers `/api/v1/application/*` and nothing else - the surface an application platform
|
|
45
45
|
* integrates against. Connect's internal API is not part of this package and
|
|
46
46
|
* never will be.
|
|
47
47
|
*
|
|
@@ -52,7 +52,7 @@ export interface ConnectClientOptions {
|
|
|
52
52
|
* });
|
|
53
53
|
*
|
|
54
54
|
* const session = await connect.identity.exchangeCode({ code, redirectUri });
|
|
55
|
-
* const { ready } = await connect.entitlements.getReadiness(session.user.
|
|
55
|
+
* const { ready } = await connect.entitlements.getReadiness(session.user.workspaceId);
|
|
56
56
|
* ```
|
|
57
57
|
*
|
|
58
58
|
* Every failure throws a `ConnectError` carrying a stable `code`. Nothing here
|
|
@@ -61,29 +61,29 @@ export interface ConnectClientOptions {
|
|
|
61
61
|
export declare class ConnectClient {
|
|
62
62
|
/** "Login with Connect" - the OAuth2 handshake and the session after it. */
|
|
63
63
|
readonly identity: IdentityResource;
|
|
64
|
-
/** What a signed-in member may do on your
|
|
64
|
+
/** What a signed-in member may do on your application. */
|
|
65
65
|
readonly access: AccessResource;
|
|
66
|
-
/** The
|
|
66
|
+
/** The applications a workspace can open - for a launcher grid. */
|
|
67
67
|
readonly apps: AppsResource;
|
|
68
|
-
/** Whether a workspace may use your
|
|
68
|
+
/** Whether a workspace may use your application, and on what plan. */
|
|
69
69
|
readonly entitlements: EntitlementsResource;
|
|
70
70
|
/** Your plan catalog, and metering usage against add-on balances. */
|
|
71
71
|
readonly billing: BillingResource;
|
|
72
|
-
/** Files in
|
|
72
|
+
/** Files in a workspace's Drive. */
|
|
73
73
|
readonly drive: DriveResource;
|
|
74
74
|
/** RAG chat and structured extraction. */
|
|
75
75
|
readonly ai: AiResource;
|
|
76
76
|
/** WhatsApp/SMS phone verification. */
|
|
77
77
|
readonly otp: OtpResource;
|
|
78
|
-
/** Feature events into the Console's audit log, filterable to your
|
|
78
|
+
/** Feature events into the Console's audit log, filterable to your application. */
|
|
79
79
|
readonly logs: LogsResource;
|
|
80
|
-
/** Emit product events and read back this
|
|
80
|
+
/** Emit product events and read back this application's aggregated numbers. */
|
|
81
81
|
readonly analytics: AnalyticsResource;
|
|
82
|
-
/** This Connect account's own login sessions - account-wide, not scoped to this
|
|
82
|
+
/** This Connect account's own login sessions - account-wide, not scoped to this application. Requires the `sessions:manage` scope. */
|
|
83
83
|
readonly sessions: SessionsResource;
|
|
84
|
-
/** Composio-hosted third-party connections (Google Calendar, Slack, ...)
|
|
84
|
+
/** Composio-hosted third-party connections (Google Calendar, Slack, ...) a workspace has connected. */
|
|
85
85
|
readonly integrations: IntegrationsResource;
|
|
86
86
|
constructor(options: ConnectClientOptions);
|
|
87
87
|
}
|
|
88
88
|
/** Kept in step with `package.json` by `sdk.test.ts`. */
|
|
89
|
-
export declare const SDK_VERSION = "0.
|
|
89
|
+
export declare const SDK_VERSION = "0.9.0";
|
|
@@ -59,9 +59,9 @@ export interface ConnectHandlerOptions {
|
|
|
59
59
|
* export { handler as GET, handler as POST };
|
|
60
60
|
* ```
|
|
61
61
|
*
|
|
62
|
-
* Every route resolves the
|
|
62
|
+
* Every route resolves the workspace from the caller's *own* session, never
|
|
63
63
|
* from a query parameter. A browser must not be able to ask about an
|
|
64
|
-
*
|
|
64
|
+
* workspace it is not signed into, and a client-supplied `workspaceId`
|
|
65
65
|
* is exactly that hole.
|
|
66
66
|
*/
|
|
67
67
|
export declare function createConnectHandler(options: ConnectHandlerOptions): (request: Request) => Promise<Response>;
|
|
@@ -12,7 +12,12 @@ export interface RequestSpec {
|
|
|
12
12
|
headers?: Record<string, string>;
|
|
13
13
|
/** Bearer API key (default), or none - the `/sso/*` endpoints authenticate inside the form body instead. */
|
|
14
14
|
auth?: "bearer" | "none";
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Skip JSON parsing and hand back the raw `Response` - for streaming
|
|
17
|
+
* endpoints.
|
|
18
|
+
*
|
|
19
|
+
* Also stops `timeoutMs` from applying to the *body*: see `request`.
|
|
20
|
+
*/
|
|
16
21
|
raw?: boolean;
|
|
17
22
|
signal?: AbortSignal;
|
|
18
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TransportOptions } from "../http.js";
|
|
2
2
|
import type { RolesResponse, UserRolesResponse } from "../../types.js";
|
|
3
|
-
/** What a signed-in member may do on your
|
|
3
|
+
/** What a signed-in member may do on your application, and the role catalog behind it. */
|
|
4
4
|
export declare class AccessResource {
|
|
5
5
|
private readonly transport;
|
|
6
6
|
constructor(transport: TransportOptions);
|
|
@@ -10,8 +10,8 @@ export declare class AccessResource {
|
|
|
10
10
|
* and already know who the user is.
|
|
11
11
|
*/
|
|
12
12
|
getUserRoles(userId: string, input: {
|
|
13
|
-
|
|
13
|
+
workspaceId: string;
|
|
14
14
|
}): Promise<UserRolesResponse>;
|
|
15
|
-
/** Your
|
|
15
|
+
/** Your application's own permission catalog and role definitions - the definitions `getUserRoles` resolves against. */
|
|
16
16
|
listRoles(): Promise<RolesResponse>;
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TransportOptions } from "../http.js";
|
|
2
2
|
import type { ChatMessage } from "../../types.js";
|
|
3
|
-
/** RAG chat and structured extraction against
|
|
3
|
+
/** RAG chat and structured extraction against a workspace's data. */
|
|
4
4
|
export declare class AiResource {
|
|
5
5
|
private readonly transport;
|
|
6
6
|
constructor(transport: TransportOptions);
|
|
@@ -11,7 +11,7 @@ export declare class AiResource {
|
|
|
11
11
|
* `response.body` onward, or hand it to the AI SDK's own reader.
|
|
12
12
|
*/
|
|
13
13
|
chat(input: {
|
|
14
|
-
|
|
14
|
+
workspaceId: string;
|
|
15
15
|
messages: ChatMessage[];
|
|
16
16
|
}, options?: {
|
|
17
17
|
signal?: AbortSignal;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type TransportOptions } from "../http.js";
|
|
2
2
|
import type { AnalyticsQuery, AnalyticsResponse, EmitEventInput, EmitEventsResponse } from "../../types.js";
|
|
3
3
|
/**
|
|
4
|
-
* Your
|
|
4
|
+
* Your application's own analytics: emit product events, and read back the daily
|
|
5
5
|
* numbers Connect aggregates from them.
|
|
6
6
|
*
|
|
7
|
-
* There is no way to name
|
|
7
|
+
* There is no way to name an application in either call. The scope is always the one
|
|
8
8
|
* your API key belongs to - that is the endpoint's security model, not an
|
|
9
9
|
* omission.
|
|
10
10
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type TransportOptions } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
/** The
|
|
2
|
+
import type { WorkspaceApp } from "../../types.js";
|
|
3
|
+
/** The applications a workspace can open - the data behind a launcher grid. */
|
|
4
4
|
export declare class AppsResource {
|
|
5
5
|
private readonly transport;
|
|
6
6
|
constructor(transport: TransportOptions);
|
|
7
7
|
/**
|
|
8
8
|
* Launchable apps only, so a grid tile is never a dead end. The calling
|
|
9
|
-
*
|
|
9
|
+
* application is included and flagged `isCurrent` rather than filtered out.
|
|
10
10
|
*/
|
|
11
|
-
list(
|
|
11
|
+
list(workspaceId: string): Promise<WorkspaceApp[]>;
|
|
12
12
|
}
|
|
@@ -5,7 +5,7 @@ export declare class BillingResource {
|
|
|
5
5
|
private readonly transport;
|
|
6
6
|
constructor(transport: TransportOptions);
|
|
7
7
|
/**
|
|
8
|
-
* Your
|
|
8
|
+
* Your application's active plans - render live pricing instead of hardcoding it.
|
|
9
9
|
*
|
|
10
10
|
* `features` is normalised on the way out: Connect used to send bare keys
|
|
11
11
|
* and now sends `{ key, name, description }`, and this SDK is versioned
|
|
@@ -15,7 +15,7 @@ export declare class BillingResource {
|
|
|
15
15
|
*/
|
|
16
16
|
listPlans(): Promise<PlansResponse>;
|
|
17
17
|
/**
|
|
18
|
-
* What is left of every consumable add-on on
|
|
18
|
+
* What is left of every consumable add-on on a workspace's
|
|
19
19
|
* subscription - the read half of `consumeAddon`.
|
|
20
20
|
*
|
|
21
21
|
* Needs a key scoped to `addons:read`, which is separate from
|
|
@@ -25,10 +25,10 @@ export declare class BillingResource {
|
|
|
25
25
|
* Returns an empty `addons` array rather than throwing when there is
|
|
26
26
|
* nothing to meter, so a caller can render it unconditionally.
|
|
27
27
|
*/
|
|
28
|
-
getAddonUsage(
|
|
28
|
+
getAddonUsage(workspaceId: string): Promise<AddonUsageResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* Debit a consumable add-on's per-cycle balance on behalf of an
|
|
31
|
-
*
|
|
31
|
+
* workspace's users. Call it at whatever cadence your usage happens.
|
|
32
32
|
*
|
|
33
33
|
* An `Idempotency-Key` is always sent, generated per call when you do not
|
|
34
34
|
* supply one: a balance cannot be un-spent, so a retried consume without a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type TransportOptions } from "../http.js";
|
|
2
2
|
import type { ThumbnailSize, UploadedFile } from "../../types.js";
|
|
3
3
|
export interface UploadInput {
|
|
4
|
-
|
|
4
|
+
workspaceId: string;
|
|
5
5
|
/** Any `Blob`/`File`. In Node, `new Blob([buffer])` or `fs.openAsBlob(path)`. */
|
|
6
6
|
file: Blob;
|
|
7
7
|
/** Defaults to the `Blob`'s own name when it has one. */
|
|
@@ -9,18 +9,18 @@ export interface UploadInput {
|
|
|
9
9
|
/** Target folder. Omit for the Drive root. */
|
|
10
10
|
parentId?: string;
|
|
11
11
|
}
|
|
12
|
-
/** Files in
|
|
12
|
+
/** Files in a workspace's Drive - upload, and signed URLs to read back. */
|
|
13
13
|
export declare class DriveResource {
|
|
14
14
|
private readonly transport;
|
|
15
15
|
constructor(transport: TransportOptions);
|
|
16
16
|
upload(input: UploadInput): Promise<UploadedFile>;
|
|
17
17
|
/** A signed URL for the original bytes. Short-lived - fetch it when you need it, do not store it. */
|
|
18
18
|
getFileUrl(fileId: string, input: {
|
|
19
|
-
|
|
19
|
+
workspaceId: string;
|
|
20
20
|
}): Promise<string>;
|
|
21
21
|
/** A signed URL for the thumbnail. Same lifetime caveat as `getFileUrl`. */
|
|
22
22
|
getPreviewUrl(fileId: string, input: {
|
|
23
|
-
|
|
23
|
+
workspaceId: string;
|
|
24
24
|
size?: ThumbnailSize;
|
|
25
25
|
}): Promise<string>;
|
|
26
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TransportOptions } from "../http.js";
|
|
2
|
-
import type { ReadinessResponse, SubscriptionResponse } from "../../types.js";
|
|
2
|
+
import type { ApplicationSubscriber, ReadinessResponse, SubscribersResponse, SubscriptionResponse } from "../../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* The two checks worth making on every request: may this workspace be here at
|
|
5
5
|
* all, and what is it paying for.
|
|
@@ -8,7 +8,7 @@ export declare class EntitlementsResource {
|
|
|
8
8
|
private readonly transport;
|
|
9
9
|
constructor(transport: TransportOptions);
|
|
10
10
|
/**
|
|
11
|
-
* Every gate Connect owns between
|
|
11
|
+
* Every gate Connect owns between a workspace and your application -
|
|
12
12
|
* subscription, KYC/KYB, a chargeable payment method, seat headroom -
|
|
13
13
|
* resolved in one call.
|
|
14
14
|
*
|
|
@@ -16,9 +16,9 @@ export declare class EntitlementsResource {
|
|
|
16
16
|
* Connect screen that fixes it, so you can route them somewhere useful
|
|
17
17
|
* instead of refusing them with nowhere to go.
|
|
18
18
|
*/
|
|
19
|
-
getReadiness(
|
|
19
|
+
getReadiness(workspaceId: string): Promise<ReadinessResponse>;
|
|
20
20
|
/** The live plan and subscription, including `plan.features`. */
|
|
21
|
-
getSubscription(
|
|
21
|
+
getSubscription(workspaceId: string): Promise<SubscriptionResponse>;
|
|
22
22
|
/**
|
|
23
23
|
* Whether an active subscription unlocks a plan feature - the check that
|
|
24
24
|
* gates a plan-restricted module.
|
|
@@ -27,5 +27,37 @@ export declare class EntitlementsResource {
|
|
|
27
27
|
* all: "not entitled" is the same answer either way, and a feature gate
|
|
28
28
|
* should not need a try/catch around it.
|
|
29
29
|
*/
|
|
30
|
-
hasFeature(
|
|
30
|
+
hasFeature(workspaceId: string, feature: string): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* One page of the workspaces subscribed to your application, newest first.
|
|
33
|
+
*
|
|
34
|
+
* The inverse of `getSubscription`, which asks about one workspace you
|
|
35
|
+
* already know. This asks who your subscribers *are* - what a partner
|
|
36
|
+
* dashboard, an MRR total or a churn report is built on.
|
|
37
|
+
*
|
|
38
|
+
* Rate-limited far more tightly than the per-workspace read (10/min per
|
|
39
|
+
* key, against 60): it walks your whole subscriber base and is a reporting
|
|
40
|
+
* call, not a per-request gate. Use `getSubscription` in a hot path.
|
|
41
|
+
*
|
|
42
|
+
* Your application is resolved from the API key, so there is no parameter
|
|
43
|
+
* for it and no way to ask about anyone else's.
|
|
44
|
+
*/
|
|
45
|
+
listSubscribers(options?: {
|
|
46
|
+
status?: ApplicationSubscriber["status"];
|
|
47
|
+
/** Cursor from a previous page's `nextBefore`. */
|
|
48
|
+
before?: string;
|
|
49
|
+
/** 1..100, default 25. */
|
|
50
|
+
limit?: number;
|
|
51
|
+
}): Promise<SubscribersResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Every subscriber, paged through for you.
|
|
54
|
+
*
|
|
55
|
+
* An async generator rather than an array: a large subscriber base is
|
|
56
|
+
* exactly where an accidental full materialisation hurts, and `for await`
|
|
57
|
+
* reads the same as a loop over one page.
|
|
58
|
+
*/
|
|
59
|
+
iterateSubscribers(options?: {
|
|
60
|
+
status?: ApplicationSubscriber["status"];
|
|
61
|
+
pageSize?: number;
|
|
62
|
+
}): AsyncGenerator<ApplicationSubscriber>;
|
|
31
63
|
}
|
|
@@ -16,7 +16,7 @@ export interface AuthorizeUrlInput {
|
|
|
16
16
|
* sign-in, since by definition it will never show them a login screen.
|
|
17
17
|
*/
|
|
18
18
|
prompt?: "create" | "none";
|
|
19
|
-
/** Required only if this
|
|
19
|
+
/** Required only if this application enforces PKCE. */
|
|
20
20
|
codeChallenge?: string;
|
|
21
21
|
}
|
|
22
22
|
export interface ExchangeCodeInput {
|
|
@@ -69,7 +69,7 @@ export declare class IdentityResource {
|
|
|
69
69
|
* rest of its ~15-day life. Discard your own copy of `sessionToken` too;
|
|
70
70
|
* this does not do that for you.
|
|
71
71
|
*
|
|
72
|
-
* `scope` defaults to `"device"`: this sign-in, every other
|
|
72
|
+
* `scope` defaults to `"device"`: this sign-in, every other application signed
|
|
73
73
|
* into from the same browser, and Connect's own session on that one device.
|
|
74
74
|
* `"all"` ends every session on every device - an explicit "sign out
|
|
75
75
|
* everywhere" action only.
|
|
@@ -8,15 +8,15 @@ export interface ExecuteIntegrationActionInput {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Composio-hosted third-party connections (Google Calendar, Slack,
|
|
11
|
-
* Twitter/X, ...)
|
|
12
|
-
* here - your
|
|
11
|
+
* Twitter/X, ...) a workspace has connected. Connect proxies every call
|
|
12
|
+
* here - your application never sees or holds the underlying OAuth token, which
|
|
13
13
|
* stays with Composio.
|
|
14
14
|
*/
|
|
15
15
|
export declare class IntegrationsResource {
|
|
16
16
|
private readonly transport;
|
|
17
17
|
constructor(transport: TransportOptions);
|
|
18
|
-
/** Enabled toolkits and this
|
|
19
|
-
list(
|
|
18
|
+
/** Enabled toolkits and this workspace's connection status for each. */
|
|
19
|
+
list(workspaceId: string): Promise<IntegrationsListResponse["toolkits"]>;
|
|
20
20
|
/**
|
|
21
21
|
* Starts a Composio-hosted connection for one toolkit. The returned
|
|
22
22
|
* `redirectUrl` is where the browser completes the provider's OAuth
|
|
@@ -28,13 +28,13 @@ export declare class IntegrationsResource {
|
|
|
28
28
|
* itself. Reconnecting a disconnected/failed toolkit calls this same
|
|
29
29
|
* method - there is no separate reconnect.
|
|
30
30
|
*
|
|
31
|
-
* Meant to be called on behalf of a signed-in
|
|
31
|
+
* Meant to be called on behalf of a signed-in workspace admin (this is what the
|
|
32
32
|
* bridge's fixed `POST /integrations/connect` route does), not as a bare
|
|
33
33
|
* background action with no admin present to complete the OAuth screen.
|
|
34
34
|
*/
|
|
35
|
-
initiateConnect(
|
|
35
|
+
initiateConnect(workspaceId: string, toolkitSlug: string, returnUrl: string): Promise<InitiateIntegrationConnectionResponse>;
|
|
36
36
|
/** Idempotent - disconnecting a toolkit that was never connected, or is already disconnected, is a success. */
|
|
37
|
-
disconnect(
|
|
38
|
-
/** Calls a Composio action against this
|
|
39
|
-
execute(
|
|
37
|
+
disconnect(workspaceId: string, toolkitSlug: string): Promise<DisconnectIntegrationResponse>;
|
|
38
|
+
/** Calls a Composio action against this workspace's connected account for the named toolkit. */
|
|
39
|
+
execute(workspaceId: string, input: ExecuteIntegrationActionInput): Promise<ExecuteIntegrationActionResponse>;
|
|
40
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TransportOptions } from "../http.js";
|
|
2
2
|
import type { WriteLogInput, WriteLogResponse } from "../../types.js";
|
|
3
|
-
/** Push feature events into the Console's audit log, filterable to your
|
|
3
|
+
/** Push feature events into the Console's audit log, filterable to your application. */
|
|
4
4
|
export declare class LogsResource {
|
|
5
5
|
private readonly transport;
|
|
6
6
|
constructor(transport: TransportOptions);
|
|
@@ -10,9 +10,9 @@ export declare class LogsResource {
|
|
|
10
10
|
* reported through the return value.
|
|
11
11
|
*
|
|
12
12
|
* Pass `sessionToken` to attribute the event to the end user it belongs to.
|
|
13
|
-
* Both scopes on the stored entry come from something verified - the
|
|
13
|
+
* Both scopes on the stored entry come from something verified - the application
|
|
14
14
|
* from your API key, the user from that token, which Connect checks was
|
|
15
|
-
* minted for your
|
|
15
|
+
* minted for your application before attributing anything. `attributed` in the
|
|
16
16
|
* result says whether it resolved; a `false` there still means the line was
|
|
17
17
|
* stored, just without a user on it.
|
|
18
18
|
*/
|
|
@@ -5,11 +5,11 @@ import type { ConnectUserSession, RevokeOtherSessionsResponse } from "../../type
|
|
|
5
5
|
* timestamps - the same list Connect's own account settings page shows the
|
|
6
6
|
* user themselves.
|
|
7
7
|
*
|
|
8
|
-
* **Account-wide, not scoped to this
|
|
9
|
-
* browser's login to Connect, and it fans out to every partner
|
|
10
|
-
* `sessionToken` - Connect has no per-
|
|
8
|
+
* **Account-wide, not scoped to this application.** A Connect session is one
|
|
9
|
+
* browser's login to Connect, and it fans out to every partner application's own
|
|
10
|
+
* `sessionToken` - Connect has no per-application session concept to filter by.
|
|
11
11
|
* `list()` returns every session on the account, including ones that
|
|
12
|
-
* originated from a completely different, unrelated
|
|
12
|
+
* originated from a completely different, unrelated application. Requires the
|
|
13
13
|
* `sessions:manage` scope on your API key - unlike `identity`'s base `sso`
|
|
14
14
|
* capability, this is never granted to a zero-scope legacy key by default.
|
|
15
15
|
*
|
|
@@ -25,7 +25,7 @@ export declare class SessionsResource {
|
|
|
25
25
|
list(sessionToken: string): Promise<ConnectUserSession[]>;
|
|
26
26
|
/**
|
|
27
27
|
* Ends one specific session by id - not necessarily the one `sessionToken`
|
|
28
|
-
* itself was minted from. Cascades to every partner-
|
|
28
|
+
* itself was minted from. Cascades to every partner-application sign-in that
|
|
29
29
|
* originated from that same browser, same as Connect's own "sign out this
|
|
30
30
|
* device".
|
|
31
31
|
*/
|
|
@@ -35,10 +35,10 @@ export interface ConnectWebhookHandlerOptions {
|
|
|
35
35
|
* export const POST = createConnectWebhookHandler({
|
|
36
36
|
* secret: process.env.CONNECT_WEBHOOK_SECRET!,
|
|
37
37
|
* on: {
|
|
38
|
-
* "
|
|
39
|
-
* freeze(
|
|
40
|
-
* "
|
|
41
|
-
* "
|
|
38
|
+
* "workspace.deletion_scheduled": ({ workspaceId, purgeAfter }) =>
|
|
39
|
+
* freeze(workspaceId, purgeAfter),
|
|
40
|
+
* "workspace.deletion_cancelled": ({ workspaceId }) => unfreeze(workspaceId),
|
|
41
|
+
* "workspace.deleted": ({ workspaceId }) => purge(workspaceId),
|
|
42
42
|
* },
|
|
43
43
|
* })
|
|
44
44
|
* ```
|