@bubblelab/shared-schemas 0.1.47 → 0.1.49

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/index.js CHANGED
@@ -2859,6 +2859,10 @@ var organizationSchema = z13.object({
2859
2859
  example: "my-team"
2860
2860
  }),
2861
2861
  type: orgTypeSchema,
2862
+ domain: z13.string().nullable().optional().openapi({
2863
+ description: 'Email domain for auto-joining (e.g., "acme.com"). Users with matching email domains are automatically added as members.',
2864
+ example: "acme.com"
2865
+ }),
2862
2866
  role: orgRoleSchema.openapi({
2863
2867
  description: "Current user's role in this organization"
2864
2868
  }),
@@ -2912,6 +2916,13 @@ var createOrganizationSchema = z13.object({
2912
2916
  slug: z13.string().min(3).max(50).regex(/^[a-z0-9-]+$/, "Slug must be lowercase alphanumeric with hyphens").openapi({
2913
2917
  description: "Organization slug for URLs",
2914
2918
  example: "my-team"
2919
+ }),
2920
+ domain: z13.string().regex(
2921
+ /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,
2922
+ "Must be a valid domain (e.g., acme.com)"
2923
+ ).optional().openapi({
2924
+ description: "Email domain for auto-joining. Users with matching email domains are automatically added as members.",
2925
+ example: "acme.com"
2915
2926
  })
2916
2927
  }).openapi("CreateOrganizationRequest");
2917
2928
  var updateOrganizationSchema = z13.object({
@@ -2922,6 +2933,13 @@ var updateOrganizationSchema = z13.object({
2922
2933
  slug: z13.string().min(3).max(50).regex(/^[a-z0-9-]+$/, "Slug must be lowercase alphanumeric with hyphens").optional().openapi({
2923
2934
  description: "Organization slug for URLs",
2924
2935
  example: "my-team"
2936
+ }),
2937
+ domain: z13.string().regex(
2938
+ /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,
2939
+ "Must be a valid domain (e.g., acme.com)"
2940
+ ).nullable().optional().openapi({
2941
+ description: "Email domain for auto-joining. Set to null to disable auto-join.",
2942
+ example: "acme.com"
2925
2943
  })
2926
2944
  }).openapi("UpdateOrganizationRequest");
2927
2945
  var addMemberSchema = z13.object({
@@ -2994,6 +3012,10 @@ var usageSchema = z14.object({
2994
3012
  }),
2995
3013
  serviceUsage: z14.array(ServiceUsageSchema).openapi({
2996
3014
  description: "Service usage and cost breakdown for current month"
3015
+ }),
3016
+ estimatedMonthlyCost: z14.number().optional().openapi({
3017
+ description: "Projected monthly cost based on current usage trend",
3018
+ example: 14.19
2997
3019
  })
2998
3020
  }).openapi("Usage");
2999
3021
  var billingOrganizationSchema = z14.object({
@@ -3134,6 +3156,68 @@ var subscriptionStatusResponseSchema = z14.object({
3134
3156
  description: "Special offer from private metadata (takes precedence over hackathon offer)"
3135
3157
  })
3136
3158
  }).openapi("SubscriptionStatusResponse");
3159
+ var userUsageItemSchema = z14.object({
3160
+ userId: z14.string().openapi({
3161
+ description: "User ID from Clerk",
3162
+ example: "user_30Gbwrzto1VZvAHcGUm5NLQhpkp"
3163
+ }),
3164
+ userName: z14.string().optional().openapi({
3165
+ description: "User display name",
3166
+ example: "John Doe"
3167
+ }),
3168
+ userEmail: z14.string().optional().openapi({
3169
+ description: "User email address",
3170
+ example: "john@acme.com"
3171
+ }),
3172
+ userImageUrl: z14.string().optional().openapi({
3173
+ description: "User profile image URL",
3174
+ example: "https://img.clerk.com/..."
3175
+ }),
3176
+ role: orgRoleSchema.openapi({
3177
+ description: "User's role in the organization"
3178
+ }),
3179
+ executionCount: z14.number().openapi({
3180
+ description: "Number of executions by this user",
3181
+ example: 42
3182
+ }),
3183
+ totalCost: z14.number().openapi({
3184
+ description: "Total cost incurred by this user",
3185
+ example: 5.67
3186
+ })
3187
+ }).openapi("UserUsageItem");
3188
+ var orgUsageBreakdownResponseSchema = z14.object({
3189
+ organizationId: z14.number().openapi({
3190
+ description: "Organization ID",
3191
+ example: 123
3192
+ }),
3193
+ organizationName: z14.string().optional().openapi({
3194
+ description: "Organization name",
3195
+ example: "Acme Inc"
3196
+ }),
3197
+ monthYear: z14.string().openapi({
3198
+ description: "Billing month in YYYY-MM format",
3199
+ example: "2025-01"
3200
+ }),
3201
+ totalOrgCost: z14.number().openapi({
3202
+ description: "Total organization cost for this billing period",
3203
+ example: 45.67
3204
+ }),
3205
+ totalOrgExecutions: z14.number().openapi({
3206
+ description: "Total executions across all users",
3207
+ example: 500
3208
+ }),
3209
+ users: z14.array(userUsageItemSchema).openapi({
3210
+ description: "Usage breakdown by user"
3211
+ })
3212
+ }).openapi("OrgUsageBreakdownResponse");
3213
+ function isAdminOrOwner(subscription) {
3214
+ const role = subscription.organization?.role;
3215
+ return role === "owner" || role === "admin";
3216
+ }
3217
+ function isMember(subscription) {
3218
+ const role = subscription.organization?.role;
3219
+ return role === "member";
3220
+ }
3137
3221
 
3138
3222
  // src/milk-tea.ts
3139
3223
  import { z as z17 } from "zod";
@@ -4367,7 +4451,9 @@ export {
4367
4451
  grantPermissionSchema,
4368
4452
  hackathonOfferSchema,
4369
4453
  hashToVariableId,
4454
+ isAdminOrOwner,
4370
4455
  isBrowserSessionCredential,
4456
+ isMember,
4371
4457
  isOAuthCredential,
4372
4458
  isServiceTrigger,
4373
4459
  isValidBubbleTriggerEvent,
@@ -4386,6 +4472,7 @@ export {
4386
4472
  oauthTokenRefreshResponseSchema,
4387
4473
  orgRoleSchema,
4388
4474
  orgTypeSchema,
4475
+ orgUsageBreakdownResponseSchema,
4389
4476
  organizationDetailSchema,
4390
4477
  organizationMemberSchema,
4391
4478
  organizationSchema,
@@ -4418,6 +4505,7 @@ export {
4418
4505
  updatePermissionSchema,
4419
4506
  usageSchema,
4420
4507
  usedCredentialSchema,
4508
+ userUsageItemSchema,
4421
4509
  validateBubbleFlowCodeResponseSchema,
4422
4510
  validateBubbleFlowCodeSchema,
4423
4511
  validateCronExpression,