Skip to content

Commit e53dbaa

Browse files
committed
feat(marketplace): finish Vercel Marketplace integration (billing fix + dashboard + go-live wiring) (#1013)
Synced from sferarc/pgbeam@bb681f4
1 parent c102c10 commit e53dbaa

7 files changed

Lines changed: 199 additions & 0 deletions

File tree

src/generated/describe-map.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const describeByOperationId: Record<string, DescribeEndpoint> = {
4545
"exportAuditLogs": {"operationId":"exportAuditLogs","method":"GET","path":"/v1/projects/{project_id}/audit-logs/export","summary":"Export agent audit logs as CSV","description":"Streams the project's agent audit entries as a CSV file, newest first, honoring the same credential, event, decision, source and date-range filters as the list endpoint. The full filtered set is streamed (no pagination); the result is suitable for spreadsheets, SIEM ingestion, and compliance archives.","parameters":[{"name":"project_id","in":"path","required":true,"type":"string","description":"Unique project identifier (prefixed, e.g. prj_xxx)."},{"name":"credential_id","in":"query","required":false,"type":"string","description":"Filter to a single agent credential."},{"name":"event","in":"query","required":false,"type":"string","description":"Filter to a single event type (e.g. blocked, masked, query)."},{"name":"decision","in":"query","required":false,"type":"\"allow\" | \"block\" | \"mask\" | \"truncate\"","description":"Coarse outcome filter that groups events. `allow` = query; `block` = blocked, budget_exhausted, auth_failed, credential_expired; `mask` = masked; `truncate` = truncated."},{"name":"source","in":"query","required":false,"type":"\"wire\" | \"mcp\" | \"control\"","description":"Filter by statement origin (wire, mcp, or control)."},{"name":"start","in":"query","required":false,"type":"string","description":"Return entries at or after this timestamp (inclusive lower bound)."},{"name":"end","in":"query","required":false,"type":"string","description":"Return entries strictly older than this timestamp (cursor / upper bound)."}],"requestBodyType":"","requestBodyRequired":false,"responseType":"","responseStatus":"200"},
4646
"listPlans": {"operationId":"listPlans","method":"GET","path":"/v1/plans","summary":"List available plans","description":"Returns all available plan tiers with their limits and pricing.","parameters":[],"requestBodyType":"","requestBodyRequired":false,"responseType":"{ plans: ({ annual_price?: number; description?: string; label: string; limits: { bytes_per_month: number; included_seats: number; max_connections: number; max_databases: number; max_projects: number; max_query_shapes: number; queries_per_day: number; queries_per_second: number }; monthly_price: number; name: string; overage_text?: string; trial_days?: number })[] }","responseStatus":"200"},
4747
"getOrganizationPlan": {"operationId":"getOrganizationPlan","method":"GET","path":"/v1/organizations/{org_id}/plan","summary":"Get organization plan","description":"Returns the current plan and limits for the organization.","parameters":[{"name":"org_id","in":"path","required":true,"type":"string","description":"Unique organization identifier."}],"requestBodyType":"","requestBodyRequired":false,"responseType":"{ billing_provider?: \"stripe\" | \"vercel\" | \"aws\" | \"manual\"; created_at?: string; current_period_end?: string; custom_pricing?: boolean; enabled?: boolean; limits: { bytes_per_month: number; included_seats: number; max_connections: number; max_databases: number; max_projects: number; max_query_shapes: number; queries_per_day: number; queries_per_second: number }; org_id: string; plan: \"starter\" | \"pro\" | \"scale\" | \"enterprise\"; spend_limit?: number; subscription_status?: \"none\" | \"active\" | \"trialing\" | \"past_due\" | \"canceled\" | \"unpaid\" | \"incomplete\" | \"incomplete_expired\" | \"paused\"; updated_at?: string }","responseStatus":"200"},
48+
"getVercelInstallation": {"operationId":"getVercelInstallation","method":"GET","path":"/v1/organizations/{org_id}/vercel-installation","summary":"Get Vercel Marketplace installation status","description":"Returns the Vercel Marketplace installation for the organization,\nincluding its provisioned resources and their current-period usage.\nReturns 404 when the organization was not provisioned through the\nVercel Marketplace. Powers the dashboard's Vercel integration page.\n","parameters":[{"name":"org_id","in":"path","required":true,"type":"string","description":"Unique organization identifier."}],"requestBodyType":"","requestBodyRequired":false,"responseType":"{ created_at?: string; installation_id: string; plan: string; resources: ({ billing_plan_id: string; name: string; period_bytes: number; period_queries: number; project_id: string; resource_id: string; status: \"ready\" | \"suspended\" | \"deleted\" })[]; status: string; vercel_account_id: string }","responseStatus":"200"},
4849
"updateSpendLimit": {"operationId":"updateSpendLimit","method":"PUT","path":"/v1/organizations/{org_id}/spend-limit","summary":"Update spend limit","description":"Sets the monthly spend limit for an organization. Null removes the limit.","parameters":[{"name":"org_id","in":"path","required":true,"type":"string","description":"Unique organization identifier."}],"requestBodyType":"{ spend_limit?: number }","requestBodyRequired":true,"responseType":"{ billing_provider?: \"stripe\" | \"vercel\" | \"aws\" | \"manual\"; created_at?: string; current_period_end?: string; custom_pricing?: boolean; enabled?: boolean; limits: { bytes_per_month: number; included_seats: number; max_connections: number; max_databases: number; max_projects: number; max_query_shapes: number; queries_per_day: number; queries_per_second: number }; org_id: string; plan: \"starter\" | \"pro\" | \"scale\" | \"enterprise\"; spend_limit?: number; subscription_status?: \"none\" | \"active\" | \"trialing\" | \"past_due\" | \"canceled\" | \"unpaid\" | \"incomplete\" | \"incomplete_expired\" | \"paused\"; updated_at?: string }","responseStatus":"200"},
4950
"submitCancellationFeedback": {"operationId":"submitCancellationFeedback","method":"POST","path":"/v1/organizations/{org_id}/cancellation-feedback","summary":"Submit cancellation feedback","description":"Records optional feedback when a user cancels their subscription.","parameters":[{"name":"org_id","in":"path","required":true,"type":"string","description":"Unique organization identifier."}],"requestBodyType":"{ feedback?: string; reason?: string }","requestBodyRequired":true,"responseType":"","responseStatus":"204"},
5051
"listDatabaseBranches": {"operationId":"listDatabaseBranches","method":"GET","path":"/v1/projects/{project_id}/branches","summary":"List sandbox branches","description":"Lists ephemeral sandbox branches for the project's databases.","parameters":[{"name":"project_id","in":"path","required":true,"type":"string","description":"Unique project identifier (prefixed, e.g. prj_xxx)."},{"name":"status","in":"query","required":false,"type":"\"pending\" | \"ready\" | \"error\" | \"discarded\"","description":"Filter to a single status."},{"name":"page_size","in":"query","required":false,"type":"number","description":"Maximum number of items to return (1-100, default 20)."},{"name":"page_token","in":"query","required":false,"type":"string","description":"Opaque token for cursor-based pagination."}],"requestBodyType":"","requestBodyRequired":false,"responseType":"{ branches: ({ branch_name: string; created_at: string; credential_id?: string; database_id: string; discarded_at?: string; error?: string; expires_at?: string; id: string; session_id?: string; status: \"pending\" | \"ready\" | \"error\" | \"discarded\" })[]; next_page_token?: string }","responseStatus":"200"},

src/generated/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export type { GetProjectUsagePathProjectId, GetProjectUsageQueryEndDate, GetProj
6464
export type { GetSchemaCatalogPathDatabaseId, GetSchemaCatalogPathProjectId, GetSchemaCatalogRequestConfig, GetSchemaCatalogResponse, GetSchemaCatalogResponses, GetSchemaCatalogStatus200, GetSchemaCatalogStatus400, GetSchemaCatalogStatus401, GetSchemaCatalogStatus403, GetSchemaCatalogStatus404, GetSchemaCatalogStatus429 } from "./types/GetSchemaCatalog";
6565
export type { GetSupportCasePathCaseId, GetSupportCasePathOrgId, GetSupportCaseRequestConfig, GetSupportCaseResponses, GetSupportCaseStatus200, GetSupportCaseStatus400, GetSupportCaseStatus401, GetSupportCaseStatus403, GetSupportCaseStatus404 } from "./types/GetSupportCase";
6666
export type { GetSupportCaseResponse } from "./types/GetSupportCaseResponse";
67+
export type { GetVercelInstallationPathOrgId, GetVercelInstallationRequestConfig, GetVercelInstallationResponse, GetVercelInstallationResponses, GetVercelInstallationStatus200, GetVercelInstallationStatus400, GetVercelInstallationStatus401, GetVercelInstallationStatus403, GetVercelInstallationStatus404, GetVercelInstallationStatus429 } from "./types/GetVercelInstallation";
6768
export type { GetWebhookEndpointPathProjectId, GetWebhookEndpointPathWebhookId, GetWebhookEndpointRequestConfig, GetWebhookEndpointResponse, GetWebhookEndpointResponses, GetWebhookEndpointStatus200, GetWebhookEndpointStatus400, GetWebhookEndpointStatus401, GetWebhookEndpointStatus403, GetWebhookEndpointStatus404 } from "./types/GetWebhookEndpoint";
6869
export type { HandleSlackSupportEventData, HandleSlackSupportEventRequestConfig, HandleSlackSupportEventResponse, HandleSlackSupportEventResponses, HandleSlackSupportEventStatus200, HandleSlackSupportEventStatus400, HandleSlackSupportEventStatus401, HandleSlackSupportEventStatus404 } from "./types/HandleSlackSupportEvent";
6970
export type { HealthResponse, HealthResponseStatusEnumKey } from "./types/HealthResponse";
@@ -165,6 +166,8 @@ export type { UpdateSupportCaseData, UpdateSupportCasePathCaseId, UpdateSupportC
165166
export type { UpdateSupportCaseRequest } from "./types/UpdateSupportCaseRequest";
166167
export type { UpdateWebhookEndpointData, UpdateWebhookEndpointPathProjectId, UpdateWebhookEndpointPathWebhookId, UpdateWebhookEndpointRequestConfig, UpdateWebhookEndpointResponse, UpdateWebhookEndpointResponses, UpdateWebhookEndpointStatus200, UpdateWebhookEndpointStatus400, UpdateWebhookEndpointStatus401, UpdateWebhookEndpointStatus403, UpdateWebhookEndpointStatus404 } from "./types/UpdateWebhookEndpoint";
167168
export type { UsageResponse } from "./types/UsageResponse";
169+
export type { VercelInstallationStatus } from "./types/VercelInstallationStatus";
170+
export type { VercelResourceStatus, VercelResourceStatusStatusEnumKey } from "./types/VercelResourceStatus";
168171
export type { VerifyCustomDomainPathDomainId, VerifyCustomDomainPathProjectId, VerifyCustomDomainRequestConfig, VerifyCustomDomainResponses, VerifyCustomDomainStatus200, VerifyCustomDomainStatus400, VerifyCustomDomainStatus401, VerifyCustomDomainStatus403, VerifyCustomDomainStatus404, VerifyCustomDomainStatus429 } from "./types/VerifyCustomDomain";
169172
export type { VerifyCustomDomainResponse } from "./types/VerifyCustomDomainResponse";
170173
export type { WebhookEndpoint, WebhookEndpointFormatEnumKey } from "./types/WebhookEndpoint";
@@ -202,5 +205,6 @@ export { supportMessageSource } from "./types/SupportMessageSource";
202205
export { updateAgentCredentialStatusRequestStatusEnum } from "./types/UpdateAgentCredentialStatusRequest";
203206
export { updateAnomalyAlertRequestStatusEnum } from "./types/UpdateAnomalyAlertRequest";
204207
export { updateOnboardingRequestStepEnum } from "./types/UpdateOnboardingRequest";
208+
export { vercelResourceStatusStatusEnum } from "./types/VercelResourceStatus";
205209
export { webhookEndpointFormatEnum } from "./types/WebhookEndpoint";
206210
export { webhookEndpointInputFormatEnum } from "./types/WebhookEndpointInput";

src/generated/operations-map.gen.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import type { ListAuditLogsRequestConfig, ListAuditLogsStatus200 } from "./types
1919
import type { ExportAuditLogsRequestConfig, ExportAuditLogsStatus200 } from "./types/ExportAuditLogs";
2020
import type { ListPlansStatus200 } from "./types/ListPlans";
2121
import type { GetOrganizationPlanRequestConfig, GetOrganizationPlanStatus200 } from "./types/GetOrganizationPlan";
22+
import type { GetVercelInstallationRequestConfig, GetVercelInstallationStatus200 } from "./types/GetVercelInstallation";
2223
import type { UpdateSpendLimitRequestConfig, UpdateSpendLimitStatus200 } from "./types/UpdateSpendLimit";
2324
import type { SubmitCancellationFeedbackRequestConfig } from "./types/SubmitCancellationFeedback";
2425
import type { ListDatabaseBranchesRequestConfig, ListDatabaseBranchesStatus200 } from "./types/ListDatabaseBranches";
@@ -101,6 +102,7 @@ export const operationsByTag = {
101102
analytics: {
102103
listPlans: { method: "GET", path: "/v1/plans" },
103104
getOrganizationPlan: { method: "GET", path: "/v1/organizations/{org_id}/plan" },
105+
getVercelInstallation: { method: "GET", path: "/v1/organizations/{org_id}/vercel-installation" },
104106
updateSpendLimit: { method: "PUT", path: "/v1/organizations/{org_id}/spend-limit" },
105107
submitCancellationFeedback: { method: "POST", path: "/v1/organizations/{org_id}/cancellation-feedback" },
106108
getProjectInsights: { method: "GET", path: "/v1/projects/{project_id}/insights" },
@@ -190,6 +192,7 @@ export const operationsByPath = {
190192
"GET /v1/projects/{project_id}/audit-logs/export": { method: "GET", path: "/v1/projects/{project_id}/audit-logs/export", operationId: "exportAuditLogs" },
191193
"GET /v1/plans": { method: "GET", path: "/v1/plans", operationId: "listPlans" },
192194
"GET /v1/organizations/{org_id}/plan": { method: "GET", path: "/v1/organizations/{org_id}/plan", operationId: "getOrganizationPlan" },
195+
"GET /v1/organizations/{org_id}/vercel-installation": { method: "GET", path: "/v1/organizations/{org_id}/vercel-installation", operationId: "getVercelInstallation" },
193196
"PUT /v1/organizations/{org_id}/spend-limit": { method: "PUT", path: "/v1/organizations/{org_id}/spend-limit", operationId: "updateSpendLimit" },
194197
"POST /v1/organizations/{org_id}/cancellation-feedback": { method: "POST", path: "/v1/organizations/{org_id}/cancellation-feedback", operationId: "submitCancellationFeedback" },
195198
"GET /v1/projects/{project_id}/branches": { method: "GET", path: "/v1/projects/{project_id}/branches", operationId: "listDatabaseBranches" },
@@ -259,6 +262,7 @@ type RejectApprovalRequestParams = { pathParams: NonNullable<RejectApprovalReque
259262
type ListAuditLogsParams = { pathParams: NonNullable<ListAuditLogsRequestConfig["pathParams"]>; queryParams?: NonNullable<ListAuditLogsRequestConfig["queryParams"]> };
260263
type ExportAuditLogsParams = { pathParams: NonNullable<ExportAuditLogsRequestConfig["pathParams"]>; queryParams?: NonNullable<ExportAuditLogsRequestConfig["queryParams"]> };
261264
type GetOrganizationPlanParams = { pathParams: NonNullable<GetOrganizationPlanRequestConfig["pathParams"]> };
265+
type GetVercelInstallationParams = { pathParams: NonNullable<GetVercelInstallationRequestConfig["pathParams"]> };
262266
type UpdateSpendLimitParams = { pathParams: NonNullable<UpdateSpendLimitRequestConfig["pathParams"]>; body: NonNullable<UpdateSpendLimitRequestConfig["data"]> };
263267
type SubmitCancellationFeedbackParams = { pathParams: NonNullable<SubmitCancellationFeedbackRequestConfig["pathParams"]>; body: NonNullable<SubmitCancellationFeedbackRequestConfig["data"]> };
264268
type ListDatabaseBranchesParams = { pathParams: NonNullable<ListDatabaseBranchesRequestConfig["pathParams"]>; queryParams?: NonNullable<ListDatabaseBranchesRequestConfig["queryParams"]> };
@@ -339,6 +343,7 @@ export interface ApiOperations {
339343
analytics: {
340344
listPlans(): Promise<ListPlansStatus200>;
341345
getOrganizationPlan(params: GetOrganizationPlanParams): Promise<GetOrganizationPlanStatus200>;
346+
getVercelInstallation(params: GetVercelInstallationParams): Promise<GetVercelInstallationStatus200>;
342347
updateSpendLimit(params: UpdateSpendLimitParams): Promise<UpdateSpendLimitStatus200>;
343348
submitCancellationFeedback(params: SubmitCancellationFeedbackParams): Promise<void>;
344349
getProjectInsights(params: GetProjectInsightsParams): Promise<GetProjectInsightsStatus200>;
@@ -428,6 +433,7 @@ export interface RequestMap {
428433
"GET /v1/projects/{project_id}/audit-logs/export": { params: ExportAuditLogsParams; response: ExportAuditLogsStatus200 };
429434
"GET /v1/plans": { params?: undefined; response: ListPlansStatus200 };
430435
"GET /v1/organizations/{org_id}/plan": { params: GetOrganizationPlanParams; response: GetOrganizationPlanStatus200 };
436+
"GET /v1/organizations/{org_id}/vercel-installation": { params: GetVercelInstallationParams; response: GetVercelInstallationStatus200 };
431437
"PUT /v1/organizations/{org_id}/spend-limit": { params: UpdateSpendLimitParams; response: UpdateSpendLimitStatus200 };
432438
"POST /v1/organizations/{org_id}/cancellation-feedback": { params: SubmitCancellationFeedbackParams; response: void };
433439
"GET /v1/projects/{project_id}/branches": { params: ListDatabaseBranchesParams; response: ListDatabaseBranchesStatus200 };
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* Generated by Kubb (https://kubb.dev/).
3+
* Do not edit manually.
4+
*/
5+
6+
import type { Error } from "./Error";
7+
import type { VercelInstallationStatus } from "./VercelInstallationStatus";
8+
9+
/**
10+
* @description Unique organization identifier.
11+
* @pattern ^[a-zA-Z0-9_.-]+$
12+
* @example org_abc123
13+
* @type string
14+
*/
15+
export type GetVercelInstallationPathOrgId = string;
16+
17+
/**
18+
* @description Vercel Marketplace installation status for an organization, including its resources.
19+
* @type object
20+
*/
21+
export type GetVercelInstallationStatus200 = VercelInstallationStatus;
22+
23+
/**
24+
* @description Standard error response envelope for PgBeam API requests.
25+
* @type object
26+
*/
27+
export type GetVercelInstallationStatus400 = Error;
28+
29+
/**
30+
* @description Standard error response envelope for PgBeam API requests.
31+
* @type object
32+
*/
33+
export type GetVercelInstallationStatus401 = Error;
34+
35+
/**
36+
* @description Standard error response envelope for PgBeam API requests.
37+
* @type object
38+
*/
39+
export type GetVercelInstallationStatus403 = Error;
40+
41+
/**
42+
* @description Standard error response envelope for PgBeam API requests.
43+
* @type object
44+
*/
45+
export type GetVercelInstallationStatus404 = Error;
46+
47+
/**
48+
* @description Standard error response envelope for PgBeam API requests.
49+
* @type object
50+
*/
51+
export type GetVercelInstallationStatus429 = Error;
52+
53+
/**
54+
* @type object
55+
*/
56+
export type GetVercelInstallationRequestConfig = {
57+
data?: never;
58+
/**
59+
* @type object
60+
*/
61+
pathParams: {
62+
org_id: GetVercelInstallationPathOrgId;
63+
};
64+
queryParams?: never;
65+
headerParams?: never;
66+
/**
67+
* @type string
68+
*/
69+
url: `/v1/organizations/${string}/vercel-installation`;
70+
};
71+
72+
/**
73+
* @type object
74+
*/
75+
export type GetVercelInstallationResponses = {
76+
"200": GetVercelInstallationStatus200;
77+
"400": GetVercelInstallationStatus400;
78+
"401": GetVercelInstallationStatus401;
79+
"403": GetVercelInstallationStatus403;
80+
"404": GetVercelInstallationStatus404;
81+
"429": GetVercelInstallationStatus429;
82+
};
83+
84+
/**
85+
* @description Union of all possible responses
86+
*/
87+
export type GetVercelInstallationResponse = (GetVercelInstallationStatus200 | GetVercelInstallationStatus400 | GetVercelInstallationStatus401 | GetVercelInstallationStatus403 | GetVercelInstallationStatus404 | GetVercelInstallationStatus429);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Generated by Kubb (https://kubb.dev/).
3+
* Do not edit manually.
4+
*/
5+
6+
import type { VercelResourceStatus } from "./VercelResourceStatus";
7+
8+
/**
9+
* @description Vercel Marketplace installation status for an organization, including its resources.
10+
* @type object
11+
*/
12+
export type VercelInstallationStatus = {
13+
/**
14+
* @description Vercel installation (integration configuration) identifier.
15+
* @type string
16+
*/
17+
installation_id: string;
18+
/**
19+
* @description Vercel account/team identifier that owns the installation.
20+
* @type string
21+
*/
22+
vercel_account_id: string;
23+
/**
24+
* @description Current plan tier for the organization.
25+
* @type string
26+
*/
27+
plan: string;
28+
/**
29+
* @description Installation status (active).
30+
* @type string
31+
*/
32+
status: string;
33+
/**
34+
* @description When the installation was created.
35+
* @type string | undefined
36+
*/
37+
created_at?: string;
38+
/**
39+
* @description Resources (projects) provisioned under this installation.
40+
* @type array
41+
*/
42+
resources: VercelResourceStatus[];
43+
};

0 commit comments

Comments
 (0)