@cosmoops/connect-sdk 0.6.0 → 0.7.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/dist/cjs/cli/doctor.js +3 -3
- package/dist/cjs/cli/init.js +3 -3
- package/dist/cjs/client/components/access-gate.js +3 -3
- package/dist/cjs/client/components/account-sessions.js +3 -3
- package/dist/cjs/client/components/app-shell.js +2 -2
- package/dist/cjs/client/components/apps-grid.js +3 -3
- 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/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/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 +4 -4
- package/dist/cjs/client/index.js +1 -1
- package/dist/cjs/client/mark.js +1 -1
- package/dist/cjs/client/provider.js +7 -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 +13 -13
- package/dist/cjs/server/http.js +1 -1
- 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 +7 -7
- package/dist/cjs/server/resources/identity.js +4 -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 +3 -3
- package/dist/esm/client/components/account-sessions.js +3 -3
- package/dist/esm/client/components/app-shell.js +2 -2
- package/dist/esm/client/components/apps-grid.js +3 -3
- 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/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/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 +4 -4
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/client/mark.js +1 -1
- package/dist/esm/client/provider.js +7 -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 +13 -13
- package/dist/esm/server/http.js +1 -1
- 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 +7 -7
- package/dist/esm/server/resources/identity.js +4 -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/types/client/components/access-gate.d.ts +1 -1
- package/dist/types/client/components/account-sessions.d.ts +1 -1
- package/dist/types/client/components/app-shell.d.ts +4 -4
- package/dist/types/client/components/apps-grid.d.ts +1 -1
- 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/plan-pricing.d.ts +2 -2
- package/dist/types/client/components/readiness.d.ts +2 -2
- 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 +2 -2
- package/dist/types/client/index.d.ts +1 -1
- package/dist/types/client/mark.d.ts +1 -1
- package/dist/types/client/provider.d.ts +9 -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/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 +4 -4
- 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 +61 -61
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ export interface ConnectUserMenuProps {
|
|
|
26
26
|
* in place, which is why it sits alone in the footer rather than as a fourth
|
|
27
27
|
* item in the same list as three navigations.
|
|
28
28
|
*
|
|
29
|
-
* The session list is account-wide, not scoped to this
|
|
29
|
+
* The session list is account-wide, not scoped to this application - see
|
|
30
30
|
* `ConnectUserSession`'s doc comment in `types.ts`. Appearance only renders
|
|
31
31
|
* when both `theme` and `onThemeChange` are supplied.
|
|
32
32
|
*
|
|
@@ -55,7 +55,7 @@ export declare function ConnectManageSubscriptionButton({ className }: Readonly<
|
|
|
55
55
|
* Invoices and payment history, on Connect.
|
|
56
56
|
*
|
|
57
57
|
* A deep link rather than a component that lists them, and that is not a
|
|
58
|
-
* placeholder: nothing in `/api/v1/
|
|
58
|
+
* placeholder: nothing in `/api/v1/application/*` exposes invoices, so an SDK-side
|
|
59
59
|
* list would have nothing to read. It is also the right answer regardless -
|
|
60
60
|
* a GST tax invoice is a legal document with a fixed format, downloadable and
|
|
61
61
|
* emailed from one place, and a partner-rendered copy of one would be a second
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Styling is HeroUI v3 semantic tokens only (`accent`, `muted`, `surface`,
|
|
9
9
|
* `separator`, ...), never a hardcoded colour - so these components inherit
|
|
10
|
-
* whatever theme the host
|
|
10
|
+
* whatever theme the host application platform already configured, and one theme
|
|
11
11
|
* change lands identically in all of them.
|
|
12
12
|
*/
|
|
13
13
|
export { ConnectProvider, useConnect, useConnectUser, useConnectEntitlements, useConnectPlans, useConnectApps, useConnectAddonUsage, useConnectSessions, useConnectIntegrations, useConnectResource, CONNECT_APP_URL, } from "./provider.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The Connect mark - concentric rings on a solid accent badge.
|
|
3
3
|
*
|
|
4
4
|
* Painted from `--accent` / `--accent-foreground`, the same HeroUI tokens the
|
|
5
|
-
* host app themes, so the badge tracks whatever palette
|
|
5
|
+
* host app themes, so the badge tracks whatever palette an application platform has
|
|
6
6
|
* configured rather than carrying a hardcoded CosmoOps green into someone
|
|
7
7
|
* else's brand.
|
|
8
8
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { AddonUsageResponse, ConnectUser, IntegrationsListResponse,
|
|
2
|
+
import type { AddonUsageResponse, ConnectUser, IntegrationsListResponse, WorkspaceApp, PlansResponse, ReadinessResponse, ApplicationRole, SessionsListResponse, SessionSubscription, SubscriptionResponse } from "../types.js";
|
|
3
3
|
export declare const CONNECT_APP_URL = "https://connect.cosmoops.com";
|
|
4
4
|
export interface ConnectSession {
|
|
5
5
|
user: ConnectUser | null;
|
|
6
6
|
subscription: SessionSubscription | null;
|
|
7
|
-
|
|
7
|
+
applicationRole: ApplicationRole | null;
|
|
8
8
|
}
|
|
9
9
|
export interface ConnectContextValue {
|
|
10
10
|
/**
|
|
@@ -61,7 +61,7 @@ export interface ConnectContextValue {
|
|
|
61
61
|
}
|
|
62
62
|
export interface ConnectProviderProps {
|
|
63
63
|
/**
|
|
64
|
-
* This
|
|
64
|
+
* This application's public `client_id`, from its Integration tab in Connect.
|
|
65
65
|
*
|
|
66
66
|
* Not needed for the default sign-in flow: `signIn()` with no `redirectUri`
|
|
67
67
|
* bounces the browser to your own `/signin` route, which already knows
|
|
@@ -148,7 +148,7 @@ export declare function useConnectEntitlements(): {
|
|
|
148
148
|
/**
|
|
149
149
|
* What is left of every consumable add-on on this workspace's subscription.
|
|
150
150
|
*
|
|
151
|
-
* The read half of `client.billing.consumeAddon` -
|
|
151
|
+
* The read half of `client.billing.consumeAddon` - an application that meters its
|
|
152
152
|
* own end users had no way to show them what remained until this existed.
|
|
153
153
|
* Empty `addons` means there is nothing to meter, which is not an error.
|
|
154
154
|
*/
|
|
@@ -165,7 +165,7 @@ export declare function useConnectAddonUsage(): {
|
|
|
165
165
|
*/
|
|
166
166
|
refetch(): void;
|
|
167
167
|
};
|
|
168
|
-
/** This
|
|
168
|
+
/** This application's plan catalog. */
|
|
169
169
|
export declare function useConnectPlans(): {
|
|
170
170
|
data: PlansResponse | null;
|
|
171
171
|
isLoading: boolean;
|
|
@@ -179,10 +179,10 @@ export declare function useConnectPlans(): {
|
|
|
179
179
|
*/
|
|
180
180
|
refetch(): void;
|
|
181
181
|
};
|
|
182
|
-
/** The apps this
|
|
182
|
+
/** The apps this workspace can open. */
|
|
183
183
|
export declare function useConnectApps(): {
|
|
184
184
|
data: {
|
|
185
|
-
apps:
|
|
185
|
+
apps: WorkspaceApp[];
|
|
186
186
|
} | null;
|
|
187
187
|
isLoading: boolean;
|
|
188
188
|
error: string | null;
|
|
@@ -195,7 +195,7 @@ export declare function useConnectApps(): {
|
|
|
195
195
|
*/
|
|
196
196
|
refetch(): void;
|
|
197
197
|
};
|
|
198
|
-
/** Enabled Composio-hosted toolkits and this
|
|
198
|
+
/** Enabled Composio-hosted toolkits and this workspace's connection status for each. */
|
|
199
199
|
export declare function useConnectIntegrations(): {
|
|
200
200
|
data: IntegrationsListResponse | null;
|
|
201
201
|
isLoading: boolean;
|
|
@@ -211,7 +211,7 @@ export declare function useConnectIntegrations(): {
|
|
|
211
211
|
};
|
|
212
212
|
/**
|
|
213
213
|
* This Connect account's own login sessions - account-wide, not scoped to
|
|
214
|
-
* this
|
|
214
|
+
* this application, see `SessionsListResponse`'s doc comment. The component
|
|
215
215
|
* that calls this is also the one that must own any revoke actions and call
|
|
216
216
|
* the returned `refetch()` afterward - see `mutateResource`'s doc comment
|
|
217
217
|
* for why nothing does that automatically.
|
|
@@ -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.7.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>;
|
|
@@ -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
|
}
|
|
@@ -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,5 @@ 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
31
|
}
|
|
@@ -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
|
* ```
|