@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.
Files changed (116) hide show
  1. package/dist/cjs/cli/doctor.js +3 -3
  2. package/dist/cjs/cli/init.js +3 -3
  3. package/dist/cjs/client/components/access-gate.js +3 -3
  4. package/dist/cjs/client/components/account-sessions.js +3 -3
  5. package/dist/cjs/client/components/app-shell.js +2 -2
  6. package/dist/cjs/client/components/apps-grid.js +3 -3
  7. package/dist/cjs/client/components/feature-gate.js +2 -2
  8. package/dist/cjs/client/components/integrations-modal.js +1 -1
  9. package/dist/cjs/client/components/logo.js +3 -3
  10. package/dist/cjs/client/components/plan-pricing.js +1 -1
  11. package/dist/cjs/client/components/plans.js +6 -6
  12. package/dist/cjs/client/components/readiness.js +3 -3
  13. package/dist/cjs/client/components/subscribe-dialog.js +2 -2
  14. package/dist/cjs/client/components/subscription.js +1 -1
  15. package/dist/cjs/client/components/usage-meter.js +1 -1
  16. package/dist/cjs/client/components/user-menu.js +4 -4
  17. package/dist/cjs/client/index.js +1 -1
  18. package/dist/cjs/client/mark.js +1 -1
  19. package/dist/cjs/client/provider.js +7 -7
  20. package/dist/cjs/client/use-checkout.js +3 -3
  21. package/dist/cjs/errors.js +4 -4
  22. package/dist/cjs/helpers.js +1 -1
  23. package/dist/cjs/index.js +1 -1
  24. package/dist/cjs/next/index.js +2 -2
  25. package/dist/cjs/server/client.js +15 -15
  26. package/dist/cjs/server/handler.js +13 -13
  27. package/dist/cjs/server/http.js +1 -1
  28. package/dist/cjs/server/resources/access.js +3 -3
  29. package/dist/cjs/server/resources/ai.js +1 -1
  30. package/dist/cjs/server/resources/analytics.js +2 -2
  31. package/dist/cjs/server/resources/apps.js +4 -4
  32. package/dist/cjs/server/resources/billing.js +5 -5
  33. package/dist/cjs/server/resources/drive.js +4 -4
  34. package/dist/cjs/server/resources/entitlements.js +7 -7
  35. package/dist/cjs/server/resources/identity.js +4 -4
  36. package/dist/cjs/server/resources/integrations.js +13 -13
  37. package/dist/cjs/server/resources/logs.js +3 -3
  38. package/dist/cjs/server/resources/sessions.js +6 -6
  39. package/dist/cjs/server/webhooks.js +4 -4
  40. package/dist/cjs/types.js +1 -1
  41. package/dist/esm/cli/doctor.js +3 -3
  42. package/dist/esm/cli/init.js +3 -3
  43. package/dist/esm/client/components/access-gate.js +3 -3
  44. package/dist/esm/client/components/account-sessions.js +3 -3
  45. package/dist/esm/client/components/app-shell.js +2 -2
  46. package/dist/esm/client/components/apps-grid.js +3 -3
  47. package/dist/esm/client/components/feature-gate.js +2 -2
  48. package/dist/esm/client/components/integrations-modal.js +1 -1
  49. package/dist/esm/client/components/logo.js +3 -3
  50. package/dist/esm/client/components/plan-pricing.js +1 -1
  51. package/dist/esm/client/components/plans.js +6 -6
  52. package/dist/esm/client/components/readiness.js +3 -3
  53. package/dist/esm/client/components/subscribe-dialog.js +2 -2
  54. package/dist/esm/client/components/subscription.js +1 -1
  55. package/dist/esm/client/components/usage-meter.js +1 -1
  56. package/dist/esm/client/components/user-menu.js +4 -4
  57. package/dist/esm/client/index.js +1 -1
  58. package/dist/esm/client/mark.js +1 -1
  59. package/dist/esm/client/provider.js +7 -7
  60. package/dist/esm/client/use-checkout.js +3 -3
  61. package/dist/esm/errors.js +4 -4
  62. package/dist/esm/helpers.js +1 -1
  63. package/dist/esm/index.js +1 -1
  64. package/dist/esm/next/index.js +2 -2
  65. package/dist/esm/server/client.js +15 -15
  66. package/dist/esm/server/handler.js +13 -13
  67. package/dist/esm/server/http.js +1 -1
  68. package/dist/esm/server/resources/access.js +3 -3
  69. package/dist/esm/server/resources/ai.js +1 -1
  70. package/dist/esm/server/resources/analytics.js +2 -2
  71. package/dist/esm/server/resources/apps.js +4 -4
  72. package/dist/esm/server/resources/billing.js +5 -5
  73. package/dist/esm/server/resources/drive.js +4 -4
  74. package/dist/esm/server/resources/entitlements.js +7 -7
  75. package/dist/esm/server/resources/identity.js +4 -4
  76. package/dist/esm/server/resources/integrations.js +13 -13
  77. package/dist/esm/server/resources/logs.js +3 -3
  78. package/dist/esm/server/resources/sessions.js +6 -6
  79. package/dist/esm/server/webhooks.js +4 -4
  80. package/dist/esm/types.js +1 -1
  81. package/dist/types/client/components/access-gate.d.ts +1 -1
  82. package/dist/types/client/components/account-sessions.d.ts +1 -1
  83. package/dist/types/client/components/app-shell.d.ts +4 -4
  84. package/dist/types/client/components/apps-grid.d.ts +1 -1
  85. package/dist/types/client/components/feature-gate.d.ts +1 -1
  86. package/dist/types/client/components/integrations-modal.d.ts +1 -1
  87. package/dist/types/client/components/logo.d.ts +5 -5
  88. package/dist/types/client/components/plan-pricing.d.ts +2 -2
  89. package/dist/types/client/components/readiness.d.ts +2 -2
  90. package/dist/types/client/components/subscribe-dialog.d.ts +3 -3
  91. package/dist/types/client/components/usage-meter.d.ts +1 -1
  92. package/dist/types/client/components/user-menu.d.ts +2 -2
  93. package/dist/types/client/index.d.ts +1 -1
  94. package/dist/types/client/mark.d.ts +1 -1
  95. package/dist/types/client/provider.d.ts +9 -9
  96. package/dist/types/client/use-checkout.d.ts +3 -3
  97. package/dist/types/errors.d.ts +4 -4
  98. package/dist/types/helpers.d.ts +1 -1
  99. package/dist/types/index.d.ts +1 -1
  100. package/dist/types/next/index.d.ts +1 -1
  101. package/dist/types/server/client.d.ts +13 -13
  102. package/dist/types/server/handler.d.ts +2 -2
  103. package/dist/types/server/resources/access.d.ts +3 -3
  104. package/dist/types/server/resources/ai.d.ts +2 -2
  105. package/dist/types/server/resources/analytics.d.ts +2 -2
  106. package/dist/types/server/resources/apps.d.ts +4 -4
  107. package/dist/types/server/resources/billing.d.ts +4 -4
  108. package/dist/types/server/resources/drive.d.ts +4 -4
  109. package/dist/types/server/resources/entitlements.d.ts +4 -4
  110. package/dist/types/server/resources/identity.d.ts +2 -2
  111. package/dist/types/server/resources/integrations.d.ts +9 -9
  112. package/dist/types/server/resources/logs.d.ts +3 -3
  113. package/dist/types/server/resources/sessions.d.ts +5 -5
  114. package/dist/types/server/webhooks.d.ts +4 -4
  115. package/dist/types/types.d.ts +61 -61
  116. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Wire types for the `/api/v1/service/*` surface - the service-partner API,
2
+ * Wire types for the `/api/v1/application/*` surface - the application-partner API,
3
3
  * and the only thing this SDK covers.
4
4
  *
5
5
  * Hand-written rather than generated so the published package carries no
@@ -25,11 +25,11 @@ export interface ConnectUser {
25
25
  * failing outright - so pair the two rather than branching on `null`.
26
26
  */
27
27
  photoUrl: string | null;
28
- organizationId: string;
29
- organizationName: string;
28
+ workspaceId: string;
29
+ workspaceName: string;
30
30
  }
31
31
  export type SubscriptionStatus = "created" | "authenticated" | "active" | "paused" | "cancelled";
32
- /** The compact subscription block returned alongside identity - `null` when the org has never subscribed to this service. */
32
+ /** The compact subscription block returned alongside identity - `null` when the workspace has never subscribed to this application. */
33
33
  export interface SessionSubscription {
34
34
  planId: string;
35
35
  status: SubscriptionStatus;
@@ -38,11 +38,11 @@ export interface SessionSubscription {
38
38
  isTrialing: boolean;
39
39
  }
40
40
  /**
41
- * What this member may do on *your* service - resolved for your `client_id`,
42
- * not their org-wide roles. `role` is `null` when their granted permissions
41
+ * What this member may do on *your* application - resolved for your `client_id`,
42
+ * not their workspace-wide roles. `role` is `null` when their granted permissions
43
43
  * match no single defined role, including when they have no access at all.
44
44
  */
45
- export interface ServiceRole {
45
+ export interface ApplicationRole {
46
46
  role: string | null;
47
47
  granted: string[];
48
48
  }
@@ -57,12 +57,12 @@ export interface TokenResponse {
57
57
  sessionTokenExpiresIn: number;
58
58
  user: ConnectUser;
59
59
  subscription: SessionSubscription | null;
60
- serviceRole: ServiceRole;
60
+ applicationRole: ApplicationRole;
61
61
  }
62
62
  export interface UserResponse {
63
63
  user: ConnectUser;
64
64
  subscription: SessionSubscription | null;
65
- serviceRole: ServiceRole;
65
+ applicationRole: ApplicationRole;
66
66
  /** ISO 8601. Refresh proactively off this rather than waiting for a 401. */
67
67
  sessionExpiresAt: string;
68
68
  }
@@ -83,28 +83,28 @@ export interface IdTokenClaims {
83
83
  export type LogoutScope = "device" | "all";
84
84
  export interface UserRolesResponse {
85
85
  userId: string;
86
- organizationId: string;
86
+ workspaceId: string;
87
87
  role: string | null;
88
88
  granted: string[];
89
89
  }
90
- export interface ServicePermission {
90
+ export interface ApplicationPermission {
91
91
  id: string;
92
92
  label: string;
93
93
  description: string;
94
94
  }
95
- export interface ServiceRoleDefinition {
95
+ export interface ApplicationRoleDefinition {
96
96
  key: string;
97
97
  name: string;
98
98
  description: string;
99
99
  permissions: string[];
100
100
  }
101
101
  export interface RolesResponse {
102
- serviceId: string;
103
- serviceKey: string | null;
104
- permissionCatalog: ServicePermission[];
105
- roles: ServiceRoleDefinition[];
102
+ applicationId: string;
103
+ applicationKey: string | null;
104
+ permissionCatalog: ApplicationPermission[];
105
+ roles: ApplicationRoleDefinition[];
106
106
  }
107
- export type ReadinessBlockerCode = "subscription_missing" | "subscription_inactive" | "audience_mismatch" | "verification_required" | "verification_pending" | "verification_rejected" | "verification_expired" | "payment_method_missing" | "seat_limit_reached" | "organization_not_found" | "onboarding_approval_pending" | "onboarding_approval_rejected" | "organization_suspended" | "payment_retry_pending";
107
+ export type ReadinessBlockerCode = "subscription_missing" | "subscription_inactive" | "audience_mismatch" | "verification_required" | "verification_pending" | "verification_rejected" | "verification_expired" | "payment_method_missing" | "seat_limit_reached" | "workspace_not_found" | "onboarding_approval_pending" | "onboarding_approval_rejected" | "workspace_suspended" | "payment_retry_pending";
108
108
  export interface ReadinessBlocker {
109
109
  /**
110
110
  * Branch on this. Typed as a union for the codes that exist today, widened
@@ -121,8 +121,8 @@ export interface ReadinessBlocker {
121
121
  graceEndsAt?: string | null;
122
122
  }
123
123
  export interface ReadinessResponse {
124
- organizationId: string;
125
- serviceId: string;
124
+ workspaceId: string;
125
+ applicationId: string;
126
126
  /** `false` if any blocker is `"blocking"`. */
127
127
  ready: boolean;
128
128
  readiness: {
@@ -159,7 +159,7 @@ export interface PlanAddon {
159
159
  *
160
160
  * Note the asymmetry with `SubscribedPlan.features`, which is bare
161
161
  * `string[]` and stays that way. That field is a gating contract - your
162
- * backend calls `hasFeature(orgId, "campaign-module")` against it, and
162
+ * backend calls `hasFeature(workspaceId, "campaign-module")` against it, and
163
163
  * `ConnectFeatureGate` matches on it - so turning it into objects would break
164
164
  * every check for a label nobody gates on. This one exists to be rendered,
165
165
  * and rendering a bare key puts "campaign-module" on a pricing card where it
@@ -170,7 +170,7 @@ export interface PlanAddon {
170
170
  export interface PlanFeature {
171
171
  /** The same value `SubscribedPlan.features` holds and `hasFeature` gates on. */
172
172
  key: string;
173
- /** Human label. Falls back to `key` for a plan predating the service's feature catalog. */
173
+ /** Human label. Falls back to `key` for a plan predating the application's feature catalog. */
174
174
  name: string;
175
175
  /** Empty string when the catalog carries no description. */
176
176
  description: string;
@@ -253,15 +253,15 @@ export interface SubscriptionDetail {
253
253
  appliedDiscount: AppliedDiscount | null;
254
254
  }
255
255
  export interface SubscriptionResponse {
256
- organizationId: string;
257
- serviceId: string;
256
+ workspaceId: string;
257
+ applicationId: string;
258
258
  /** Equivalent to `subscription?.status === "active"`. */
259
259
  hasActiveSubscription: boolean;
260
260
  subscription: SubscriptionDetail | null;
261
261
  /** `null` exactly when `subscription` is. */
262
262
  plan: SubscribedPlan | null;
263
263
  }
264
- /** One consumable add-on's remaining balance on an organization's subscription. */
264
+ /** One consumable add-on's remaining balance on a workspace's subscription. */
265
265
  export interface AddonUsage {
266
266
  addonId: string;
267
267
  name: string;
@@ -284,10 +284,10 @@ export interface AddonUsage {
284
284
  maxOverageUnits: number | null;
285
285
  }
286
286
  export interface AddonUsageResponse {
287
- organizationId: string;
288
- serviceId: string;
287
+ workspaceId: string;
288
+ applicationId: string;
289
289
  /**
290
- * Empty when the organization has no subscription, the plan has no
290
+ * Empty when the workspace has no subscription, the plan has no
291
291
  * consumable add-ons, or none are selected. All three mean "nothing to
292
292
  * meter" and none is an error.
293
293
  *
@@ -301,7 +301,7 @@ export interface AddonUsageResponse {
301
301
  resetsAt: string | null;
302
302
  }
303
303
  export interface ConsumeAddonInput {
304
- organizationId: string;
304
+ workspaceId: string;
305
305
  addonId: string;
306
306
  /** Whole units of the add-on's `unit`. */
307
307
  quantity: number;
@@ -358,8 +358,8 @@ export interface WriteLogInput {
358
358
  * `sessionToken` - the same one the token exchange handed you.
359
359
  *
360
360
  * **There is no `userId` to send, deliberately.** The token is verified and
361
- * checked to have been minted for *your* service before anything is
362
- * attributed, exactly as `serviceId` comes from your API key rather than
361
+ * checked to have been minted for *your* application before anything is
362
+ * attributed, exactly as `applicationId` comes from your API key rather than
363
363
  * your body. An actor a caller could type is not an actor worth recording.
364
364
  *
365
365
  * Omit it for genuine server-to-server events with no user behind them.
@@ -384,10 +384,10 @@ export interface ChatMessage {
384
384
  role: "user" | "assistant" | "system";
385
385
  [field: string]: unknown;
386
386
  }
387
- export interface OrganizationApp {
388
- serviceId: string;
389
- /** Stable, human-readable key - branch on this, not `serviceId`, which is per-environment. */
390
- serviceKey: string | null;
387
+ export interface WorkspaceApp {
388
+ applicationId: string;
389
+ /** Stable, human-readable key - branch on this, not `applicationId`, which is per-environment. */
390
+ applicationKey: string | null;
391
391
  name: string;
392
392
  /** Plain text, HTML already stripped server-side. */
393
393
  description: string;
@@ -395,9 +395,9 @@ export interface OrganizationApp {
395
395
  iconUrl: string | null;
396
396
  /** A `lucide-react` icon name from Connect's curated set. */
397
397
  icon: string;
398
- /** Where a tile navigates. `null` when the service registered no site. */
398
+ /** Where a tile navigates. `null` when the application registered no site. */
399
399
  launchUrl: string | null;
400
- /** True for the service whose API key made the call - render it as the active tile. */
400
+ /** True for the application whose API key made the call - render it as the active tile. */
401
401
  isCurrent: boolean;
402
402
  /** Launchable but not healthy (paused, or cancelling at period end) - badge it, do not hide it. */
403
403
  needsAttention: boolean;
@@ -413,9 +413,9 @@ export interface SessionDevice {
413
413
  }
414
414
  /**
415
415
  * One login to the Connect account behind the `sessionToken` you called with -
416
- * not scoped to this service. A Connect session is one browser's login to
417
- * Connect itself, and it fans out to every partner service's own session -
418
- * Connect has no per-service session concept to filter by. `sessions.list()`
416
+ * not scoped to this application. A Connect session is one browser's login to
417
+ * Connect itself, and it fans out to every partner application's own session -
418
+ * Connect has no per-application session concept to filter by. `sessions.list()`
419
419
  * returns every one of them, exactly like Connect's own account settings
420
420
  * page does for the user themselves.
421
421
  */
@@ -445,15 +445,15 @@ export interface RevokeOtherSessionsResponse {
445
445
  export type ThemeMode = "light" | "dark" | "system";
446
446
  /**
447
447
  * `not_connected` never travels over the wire as a persisted state - it's
448
- * what `ListOrganizationIntegrationsUseCase` reports for a toolkit this
449
- * organization has no `IntegrationConnection` record for at all.
448
+ * what `ListWorkspaceIntegrationsUseCase` reports for a toolkit this
449
+ * workspace has no `IntegrationConnection` record for at all.
450
450
  */
451
451
  export type IntegrationConnectionStatus = "not_connected" | "pending" | "active" | "failed" | "disconnected" | "expired";
452
452
  /**
453
453
  * A Composio-hosted third-party toolkit (Google Calendar, Slack, Twitter/X,
454
- * ...) this organization can see - only ever one a platform admin enabled in
455
- * Connect's own Console, joined with this org's own connection status.
456
- * Connections are org-shared: one covers every member, the way a Slack app
454
+ * ...) this workspace can see - only ever one a platform admin enabled in
455
+ * Connect's own Console, joined with this workspace's own connection status.
456
+ * Connections are workspace-shared: one covers every member, the way a Slack app
457
457
  * install is shared rather than per-user.
458
458
  */
459
459
  export interface IntegrationToolkit {
@@ -481,7 +481,7 @@ export interface ExecuteIntegrationActionResponse {
481
481
  successful: boolean;
482
482
  }
483
483
  /**
484
- * The metrics Connect can report for your service.
484
+ * The metrics Connect can report for your application.
485
485
  *
486
486
  * Hand-written here rather than imported from Connect's own registry, like
487
487
  * every other wire type in this file, so the published package carries none of
@@ -530,7 +530,7 @@ export interface EmitEventInput {
530
530
  name: string;
531
531
  /** Defaults to now. Clamped server-side to within 48 hours. */
532
532
  occurredAt?: string | Date;
533
- /** Attributes the event to the signed-in user and their organization. */
533
+ /** Attributes the event to the signed-in user and their workspace. */
534
534
  sessionToken?: string;
535
535
  /** A whole number in the smallest unit of `unit` - paise, bytes, milliseconds. */
536
536
  value?: number;
@@ -551,18 +551,18 @@ export interface EmitEventsResponse {
551
551
  * `createConnectWebhookHandler` simply ignores anything you have not
552
552
  * registered a handler for.
553
553
  */
554
- export type ConnectWebhookEventType = "organization.deletion_scheduled" | "organization.deletion_cancelled" | "organization.deleted" | "subscription.cancelled";
554
+ export type ConnectWebhookEventType = "workspace.deletion_scheduled" | "workspace.deletion_cancelled" | "workspace.deleted" | "subscription.cancelled";
555
555
  /**
556
556
  * A workspace's deletion has been confirmed and the grace window is running.
557
557
  *
558
558
  * Access is *already* denied - readiness reports
559
- * `organization_pending_deletion` from this moment - so treat this as "stop
559
+ * `workspace_pending_deletion` from this moment - so treat this as "stop
560
560
  * writing", not "start planning". `purgeAfter` is what makes this event worth
561
561
  * having: the customer's data still exists until then, so an export or a
562
562
  * wind-down can run on the same clock rather than after everything is gone.
563
563
  */
564
- export interface OrganizationDeletionScheduledEvent {
565
- organizationId: string;
564
+ export interface WorkspaceDeletionScheduledEvent {
565
+ workspaceId: string;
566
566
  /** ISO-8601. When Connect destroys the workspace. */
567
567
  purgeAfter: string;
568
568
  requestedBy: "owner" | "platform_admin";
@@ -572,30 +572,30 @@ export interface OrganizationDeletionScheduledEvent {
572
572
  * The deletion was withdrawn and the workspace is live again.
573
573
  *
574
574
  * **Handle this one.** It is the event integrations forget, and its absence
575
- * is the worst failure of the set: a service that froze a workspace on
576
- * `organization.deletion_scheduled` and never unfreezes leaves a paying
575
+ * is the worst failure of the set: an application that froze a workspace on
576
+ * `workspace.deletion_scheduled` and never unfreezes leaves a paying
577
577
  * customer locked out of something that has no idea anything changed.
578
578
  */
579
- export interface OrganizationDeletionCancelledEvent {
580
- organizationId: string;
579
+ export interface WorkspaceDeletionCancelledEvent {
580
+ workspaceId: string;
581
581
  }
582
582
  /** The grace window closed and Connect purged the workspace. Purge your own copy. */
583
- export interface OrganizationDeletedEvent {
584
- organizationId: string;
583
+ export interface WorkspaceDeletedEvent {
584
+ workspaceId: string;
585
585
  /** ISO-8601. */
586
586
  purgedAt: string;
587
587
  }
588
588
  /** A subscription ended. Fires on its own, not only as part of a deletion. */
589
589
  export interface SubscriptionCancelledEvent {
590
- organizationId: string;
590
+ workspaceId: string;
591
591
  subscriptionId: string;
592
- serviceId: string;
592
+ applicationId: string;
593
593
  }
594
594
  /** Maps each event type to the shape of its `data`. */
595
595
  export interface ConnectWebhookEventMap {
596
- "organization.deletion_scheduled": OrganizationDeletionScheduledEvent;
597
- "organization.deletion_cancelled": OrganizationDeletionCancelledEvent;
598
- "organization.deleted": OrganizationDeletedEvent;
596
+ "workspace.deletion_scheduled": WorkspaceDeletionScheduledEvent;
597
+ "workspace.deletion_cancelled": WorkspaceDeletionCancelledEvent;
598
+ "workspace.deleted": WorkspaceDeletedEvent;
599
599
  "subscription.cancelled": SubscriptionCancelledEvent;
600
600
  }
601
601
  /** The envelope, as it arrives on the wire. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmoops/connect-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Official server-side SDK for the CosmoOps Connect platform API - Login with Connect, entitlements, billing and metering.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "commonjs",