Skip to content

Commit f02f3a8

Browse files
authored
Merge pull request #139 from objectstack-ai/copilot/update-github-actions-workflow
2 parents d96f78e + 03f6ecb commit f02f3a8

2 files changed

Lines changed: 67 additions & 13 deletions

File tree

packages/spec/src/data/validation.test.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
736736
type: 'custom' as const,
737737
name: 'custom_business_rule',
738738
message: 'Custom validation failed',
739-
field: 'business_field',
740-
validatorFunction: 'validateBusinessRule',
739+
handler: 'validateBusinessRule',
741740
};
742741

743742
expect(() => ValidationRuleSchema.parse(customValidation)).not.toThrow();
@@ -748,8 +747,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
748747
type: 'custom' as const,
749748
name: 'complex_validation',
750749
message: 'Validation failed',
751-
field: 'data',
752-
validatorFunction: 'complexValidator',
750+
handler: 'complexValidator',
753751
params: {
754752
threshold: 100,
755753
mode: 'strict',
@@ -764,7 +762,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
764762
type: 'custom' as const,
765763
name: 'record_level_check',
766764
message: 'Record validation failed',
767-
validatorFunction: 'validateEntireRecord',
765+
handler: 'validateEntireRecord',
768766
};
769767

770768
expect(() => ValidationRuleSchema.parse(validation)).not.toThrow();
@@ -1058,7 +1056,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
10581056
type: 'custom',
10591057
name: 'business_logic',
10601058
message: 'Business logic validation failed',
1061-
validatorFunction: 'validateBusinessRules',
1059+
handler: 'validateBusinessRules',
10621060
},
10631061
{
10641062
type: 'conditional',
@@ -1212,8 +1210,7 @@ describe('ValidationRuleSchema - Edge Cases and Null Handling', () => {
12121210
type: 'custom' as const,
12131211
name: 'custom_validation',
12141212
message: 'Validation failed',
1215-
field: undefined, // Optional for record-level validation
1216-
validatorFunction: 'validateRecord',
1213+
handler: 'validateRecord',
12171214
params: undefined,
12181215
};
12191216

@@ -1225,7 +1222,7 @@ describe('ValidationRuleSchema - Edge Cases and Null Handling', () => {
12251222
type: 'custom' as const,
12261223
name: 'custom_validation',
12271224
message: 'Validation failed',
1228-
validatorFunction: 'validateRecord',
1225+
handler: 'validateRecord',
12291226
params: {},
12301227
};
12311228

@@ -1339,7 +1336,7 @@ describe('ValidationRuleSchema - Type Coercion Edge Cases', () => {
13391336
type: 'custom' as const,
13401337
name: 'custom_test',
13411338
message: 'Test',
1342-
validatorFunction: 'validate',
1339+
handler: 'validate',
13431340
params,
13441341
};
13451342

packages/spec/src/hub/tenant.zod.ts

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,66 @@ export const TenantQuotaSchema = z.object({
4848

4949
export type TenantQuota = z.infer<typeof TenantQuotaSchema>;
5050

51-
// Tenant Schema REMOVED.
52-
// The concept of a "Tenant" is now an attribute of a "Space".
53-
// See HubSpaceSchema in space.zod.ts which embeds TenantIsolationLevel and TenantQuotaSchema.
51+
/**
52+
* Tenant Schema
53+
*
54+
* @deprecated This schema is maintained for backward compatibility only.
55+
* New implementations should use HubSpaceSchema which embeds tenant concepts.
56+
*
57+
* **Migration Guide:**
58+
* ```typescript
59+
* // Old approach (deprecated):
60+
* const tenant: Tenant = {
61+
* id: 'tenant_123',
62+
* name: 'My Tenant',
63+
* isolationLevel: 'shared_schema',
64+
* quotas: { maxUsers: 100 }
65+
* };
66+
*
67+
* // New approach (recommended):
68+
* const space: HubSpace = {
69+
* id: '...uuid...',
70+
* name: 'My Tenant',
71+
* slug: 'my-tenant',
72+
* ownerId: 'user_id',
73+
* runtime: {
74+
* isolation: 'shared_schema',
75+
* quotas: { maxUsers: 100 }
76+
* },
77+
* bom: { ... }
78+
* };
79+
* ```
80+
*
81+
* See HubSpaceSchema in space.zod.ts for the recommended approach.
82+
*/
83+
export const TenantSchema = z.object({
84+
/**
85+
* Unique tenant identifier
86+
*/
87+
id: z.string().describe('Unique tenant identifier'),
88+
89+
/**
90+
* Tenant display name
91+
*/
92+
name: z.string().describe('Tenant display name'),
93+
94+
/**
95+
* Data isolation level
96+
*/
97+
isolationLevel: TenantIsolationLevel,
98+
99+
/**
100+
* Custom configuration values
101+
*/
102+
customizations: z.record(z.any()).optional().describe('Custom configuration values'),
103+
104+
/**
105+
* Resource quotas
106+
*/
107+
quotas: TenantQuotaSchema.optional(),
108+
});
109+
110+
export type Tenant = z.infer<typeof TenantSchema>;
54111

55112
/**
56113
* Tenant Isolation Strategy Documentation

0 commit comments

Comments
 (0)