Skip to content

Commit 9dbe1be

Browse files
Claudehotlong
andauthored
chore: successful build and test pass for all packages
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/aa3eae47-a3e8-4c08-b445-791da48b4fb9 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent a48e68e commit 9dbe1be

4 files changed

Lines changed: 222 additions & 1 deletion

File tree

content/docs/references/cloud/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ This section contains all protocol schemas for the cloud layer of ObjectStack.
1010
<Card href="/docs/references/cloud/developer-portal" title="Developer Portal" description="Source: packages/spec/src/cloud/developer-portal.zod.ts" />
1111
<Card href="/docs/references/cloud/marketplace" title="Marketplace" description="Source: packages/spec/src/cloud/marketplace.zod.ts" />
1212
<Card href="/docs/references/cloud/marketplace-admin" title="Marketplace Admin" description="Source: packages/spec/src/cloud/marketplace-admin.zod.ts" />
13+
<Card href="/docs/references/cloud/tenant" title="Tenant" description="Source: packages/spec/src/cloud/tenant.zod.ts" />
1314
</Cards>

content/docs/references/cloud/meta.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"app-store",
55
"developer-portal",
66
"marketplace",
7-
"marketplace-admin"
7+
"marketplace-admin",
8+
"provisioning",
9+
"tenant"
810
]
911
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Provisioning
3+
description: Provisioning protocol schemas
4+
---
5+
6+
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}
7+
8+
<Callout type="info">
9+
**Source:** `packages/spec/src/cloud/provisioning.zod.ts`
10+
</Callout>
11+
12+
## TypeScript Usage
13+
14+
```typescript
15+
import { TenantPlan } from '@objectstack/spec/cloud';
16+
import type { TenantPlan } from '@objectstack/spec/cloud';
17+
18+
// Validate data
19+
const result = TenantPlan.parse(data);
20+
```
21+
22+
---
23+
24+
## TenantPlan
25+
26+
### Allowed Values
27+
28+
* `free`
29+
* `starter`
30+
* `pro`
31+
* `enterprise`
32+
* `custom`
33+
34+
35+
---
36+
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
---
2+
title: Tenant
3+
description: Tenant protocol schemas
4+
---
5+
6+
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}
7+
8+
Multi-Tenant Architecture Schema
9+
10+
Defines the schema for managing multi-tenant architecture with:
11+
12+
- Global control plane: Single database for auth, org management, tenant registry
13+
14+
- Tenant data plane: Isolated databases per organization (UUID-based naming)
15+
16+
Design decisions:
17+
18+
- Database naming: \{uuid\}.turso.io (not org-slug, since slugs can be modified)
19+
20+
- Each tenant has its own Turso database for complete data isolation
21+
22+
- Global database stores user auth, organizations, and tenant metadata
23+
24+
<Callout type="info">
25+
**Source:** `packages/spec/src/cloud/tenant.zod.ts`
26+
</Callout>
27+
28+
## TypeScript Usage
29+
30+
```typescript
31+
import { PackageInstallation, PackageInstallationStatus, ProvisionTenantRequest, ProvisionTenantResponse, TenantContext, TenantDatabase, TenantDatabaseStatus, TenantIdentificationSource, TenantRoutingConfig } from '@objectstack/spec/cloud';
32+
import type { PackageInstallation, PackageInstallationStatus, ProvisionTenantRequest, ProvisionTenantResponse, TenantContext, TenantDatabase, TenantDatabaseStatus, TenantIdentificationSource, TenantRoutingConfig } from '@objectstack/spec/cloud';
33+
34+
// Validate data
35+
const result = PackageInstallation.parse(data);
36+
```
37+
38+
---
39+
40+
## PackageInstallation
41+
42+
### Properties
43+
44+
| Property | Type | Required | Description |
45+
| :--- | :--- | :--- | :--- |
46+
| **id** | `string` || Unique installation identifier |
47+
| **tenantId** | `string` || Tenant database ID |
48+
| **packageId** | `string` || Package identifier |
49+
| **version** | `string` || Installed package version |
50+
| **status** | `Enum<'installing' \| 'active' \| 'disabled' \| 'uninstalling' \| 'failed'>` || Installation status |
51+
| **installedAt** | `string` || Installation timestamp |
52+
| **installedBy** | `string` || User ID who installed the package |
53+
| **config** | `Record<string, any>` | optional | Package-specific configuration |
54+
| **updatedAt** | `string` || Last update timestamp |
55+
56+
57+
---
58+
59+
## PackageInstallationStatus
60+
61+
### Allowed Values
62+
63+
* `installing`
64+
* `active`
65+
* `disabled`
66+
* `uninstalling`
67+
* `failed`
68+
69+
70+
---
71+
72+
## ProvisionTenantRequest
73+
74+
### Properties
75+
76+
| Property | Type | Required | Description |
77+
| :--- | :--- | :--- | :--- |
78+
| **organizationId** | `string` || Organization ID |
79+
| **region** | `string` | optional | Deployment region preference |
80+
| **plan** | `Enum<'free' \| 'starter' \| 'pro' \| 'enterprise' \| 'custom'>` || Tenant plan tier |
81+
| **storageLimitMb** | `integer` | optional | Storage limit in megabytes |
82+
| **metadata** | `Record<string, any>` | optional | Custom tenant metadata |
83+
84+
85+
---
86+
87+
## ProvisionTenantResponse
88+
89+
### Properties
90+
91+
| Property | Type | Required | Description |
92+
| :--- | :--- | :--- | :--- |
93+
| **tenant** | `Object` || Provisioned tenant database |
94+
| **durationMs** | `number` || Provisioning duration in milliseconds |
95+
| **warnings** | `string[]` | optional | Provisioning warnings |
96+
97+
98+
---
99+
100+
## TenantContext
101+
102+
### Properties
103+
104+
| Property | Type | Required | Description |
105+
| :--- | :--- | :--- | :--- |
106+
| **tenantId** | `string` || Current tenant database ID |
107+
| **organizationId** | `string` || Current organization ID |
108+
| **organizationSlug** | `string` | optional | Organization slug |
109+
| **databaseUrl** | `string` || Tenant database URL |
110+
| **plan** | `Enum<'free' \| 'starter' \| 'pro' \| 'enterprise' \| 'custom'>` || Tenant plan tier |
111+
| **metadata** | `Record<string, any>` | optional | Custom tenant metadata |
112+
113+
114+
---
115+
116+
## TenantDatabase
117+
118+
### Properties
119+
120+
| Property | Type | Required | Description |
121+
| :--- | :--- | :--- | :--- |
122+
| **id** | `string` || Unique tenant database identifier (UUID) |
123+
| **organizationId** | `string` || Organization ID (foreign key to sys_organization) |
124+
| **databaseName** | `string` || Database name (UUID-based) |
125+
| **databaseUrl** | `string` || Full database URL |
126+
| **authToken** | `string` || Encrypted tenant-specific auth token |
127+
| **status** | `Enum<'provisioning' \| 'active' \| 'suspended' \| 'archived' \| 'failed'>` || Database status |
128+
| **region** | `string` || Deployment region |
129+
| **plan** | `Enum<'free' \| 'starter' \| 'pro' \| 'enterprise' \| 'custom'>` || Tenant plan tier |
130+
| **storageLimitMb** | `integer` || Storage limit in megabytes |
131+
| **createdAt** | `string` || Database creation timestamp |
132+
| **updatedAt** | `string` || Last update timestamp |
133+
| **lastAccessedAt** | `string` | optional | Last accessed timestamp |
134+
| **metadata** | `Record<string, any>` | optional | Custom tenant configuration |
135+
136+
137+
---
138+
139+
## TenantDatabaseStatus
140+
141+
### Allowed Values
142+
143+
* `provisioning`
144+
* `active`
145+
* `suspended`
146+
* `archived`
147+
* `failed`
148+
149+
150+
---
151+
152+
## TenantIdentificationSource
153+
154+
### Allowed Values
155+
156+
* `subdomain`
157+
* `custom_domain`
158+
* `header`
159+
* `jwt_claim`
160+
* `session`
161+
* `default`
162+
163+
164+
---
165+
166+
## TenantRoutingConfig
167+
168+
### Properties
169+
170+
| Property | Type | Required | Description |
171+
| :--- | :--- | :--- | :--- |
172+
| **enabled** | `boolean` || Enable multi-tenant mode |
173+
| **identificationSources** | `Enum<'subdomain' \| 'custom_domain' \| 'header' \| 'jwt_claim' \| 'session' \| 'default'>[]` || Tenant identification strategy (in order of precedence) |
174+
| **defaultTenantId** | `string` | optional | Default tenant ID |
175+
| **subdomainPattern** | `string` | optional | Subdomain pattern for tenant extraction |
176+
| **customDomainMapping** | `Record<string, string>` | optional | Custom domain to tenant ID mapping |
177+
| **tenantHeaderName** | `string` || Header name for tenant ID |
178+
| **jwtOrganizationClaim** | `string` || JWT claim name for organization ID |
179+
180+
181+
---
182+

0 commit comments

Comments
 (0)