@elevasis/core 0.11.0 → 0.11.2
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.d.ts +3 -2
- package/dist/index.js +8 -13
- package/dist/organization-model/index.d.ts +3 -2
- package/dist/organization-model/index.js +8 -13
- package/dist/test-utils/index.d.ts +175 -0
- package/dist/test-utils/index.js +8 -8
- package/package.json +1 -1
- package/src/__tests__/template-core-compatibility.test.ts +6 -15
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +36 -38
- package/src/auth/multi-tenancy/index.ts +20 -17
- package/src/auth/multi-tenancy/memberships/api-schemas.ts +142 -126
- package/src/auth/multi-tenancy/memberships/index.ts +26 -22
- package/src/auth/multi-tenancy/permissions.test.ts +42 -0
- package/src/auth/multi-tenancy/permissions.ts +104 -0
- package/src/organization-model/README.md +1 -0
- package/src/organization-model/__tests__/defaults.test.ts +19 -6
- package/src/organization-model/contracts.ts +3 -3
- package/src/organization-model/defaults.ts +3 -8
- package/src/organization-model/domains/navigation.ts +26 -32
- package/src/organization-model/foundation.ts +2 -3
- package/src/organization-model/organization-model.mdx +3 -0
- package/src/organization-model/published.ts +5 -5
- package/src/platform/constants/versions.ts +3 -3
- package/src/platform/registry/index.ts +86 -91
- package/src/platform/registry/resource-registry.ts +905 -866
- package/src/reference/_generated/contracts.md +36 -38
- package/src/scaffold-registry/__tests__/index.test.ts +125 -1
- package/src/scaffold-registry/__tests__/schema.test.ts +48 -20
- package/src/scaffold-registry/index.ts +236 -188
- package/src/scaffold-registry/schema.ts +47 -22
- package/src/supabase/database.types.ts +2880 -2719
- package/src/test-utils/fixtures/memberships.ts +82 -80
|
@@ -1,80 +1,82 @@
|
|
|
1
|
-
import type { SupabaseOrgMembership, SupabaseMembershipWithOrganization } from '../../supabase'
|
|
2
|
-
import { TEST_USERS } from './users'
|
|
3
|
-
import { TEST_ORGS } from './organizations'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Test membership fixtures using actual Supabase types
|
|
7
|
-
*/
|
|
8
|
-
export const TEST_MEMBERSHIPS: Record<string, SupabaseOrgMembership> = {
|
|
9
|
-
regularUserAcme: {
|
|
10
|
-
id: '00000000-0000-0000-0000-000000000020',
|
|
11
|
-
user_id: TEST_USERS.regularUser.id,
|
|
12
|
-
organization_id: TEST_ORGS.acme.id,
|
|
13
|
-
workos_membership_id: 'mem_regular_acme',
|
|
14
|
-
role_slug: 'admin',
|
|
15
|
-
membership_status: 'active',
|
|
16
|
-
config: {},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import type { SupabaseOrgMembership, SupabaseMembershipWithOrganization } from '../../supabase'
|
|
2
|
+
import { TEST_USERS } from './users'
|
|
3
|
+
import { TEST_ORGS } from './organizations'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Test membership fixtures using actual Supabase types
|
|
7
|
+
*/
|
|
8
|
+
export const TEST_MEMBERSHIPS: Record<string, SupabaseOrgMembership> = {
|
|
9
|
+
regularUserAcme: {
|
|
10
|
+
id: '00000000-0000-0000-0000-000000000020',
|
|
11
|
+
user_id: TEST_USERS.regularUser.id,
|
|
12
|
+
organization_id: TEST_ORGS.acme.id,
|
|
13
|
+
workos_membership_id: 'mem_regular_acme',
|
|
14
|
+
role_slug: 'admin',
|
|
15
|
+
membership_status: 'active',
|
|
16
|
+
config: {},
|
|
17
|
+
effective_permissions: [],
|
|
18
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
19
|
+
updated_at: '2025-01-01T00:00:00Z'
|
|
20
|
+
},
|
|
21
|
+
regularUserBeta: {
|
|
22
|
+
id: '00000000-0000-0000-0000-000000000021',
|
|
23
|
+
user_id: TEST_USERS.regularUser.id,
|
|
24
|
+
organization_id: TEST_ORGS.beta.id,
|
|
25
|
+
workos_membership_id: 'mem_regular_beta',
|
|
26
|
+
role_slug: 'member',
|
|
27
|
+
membership_status: 'active',
|
|
28
|
+
config: {},
|
|
29
|
+
effective_permissions: [],
|
|
30
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
31
|
+
updated_at: '2025-01-01T00:00:00Z'
|
|
32
|
+
},
|
|
33
|
+
inactiveUserAcme: {
|
|
34
|
+
id: '00000000-0000-0000-0000-000000000022',
|
|
35
|
+
user_id: TEST_USERS.inactiveUser.id,
|
|
36
|
+
organization_id: TEST_ORGS.acme.id,
|
|
37
|
+
workos_membership_id: 'mem_inactive_acme',
|
|
38
|
+
role_slug: 'member',
|
|
39
|
+
membership_status: 'inactive',
|
|
40
|
+
config: {},
|
|
41
|
+
effective_permissions: [],
|
|
42
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
43
|
+
updated_at: '2025-01-01T00:00:00Z'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Composite memberships with organization data (for joined queries)
|
|
49
|
+
*/
|
|
50
|
+
export const TEST_MEMBERSHIPS_WITH_ORG: Record<string, SupabaseMembershipWithOrganization> = {
|
|
51
|
+
regularUserAcme: {
|
|
52
|
+
...TEST_MEMBERSHIPS.regularUserAcme,
|
|
53
|
+
organization: TEST_ORGS.acme
|
|
54
|
+
},
|
|
55
|
+
regularUserBeta: {
|
|
56
|
+
...TEST_MEMBERSHIPS.regularUserBeta,
|
|
57
|
+
organization: TEST_ORGS.beta
|
|
58
|
+
},
|
|
59
|
+
inactiveUserAcme: {
|
|
60
|
+
...TEST_MEMBERSHIPS.inactiveUserAcme,
|
|
61
|
+
organization: TEST_ORGS.acme
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Helper to create custom membership fixture
|
|
67
|
+
*/
|
|
68
|
+
export function createTestMembership(overrides: Partial<SupabaseOrgMembership>): SupabaseOrgMembership {
|
|
69
|
+
return {
|
|
70
|
+
id: '00000000-0000-0000-0000-999999999999',
|
|
71
|
+
user_id: TEST_USERS.regularUser.id,
|
|
72
|
+
organization_id: TEST_ORGS.acme.id,
|
|
73
|
+
workos_membership_id: 'mem_custom_test',
|
|
74
|
+
role_slug: 'member',
|
|
75
|
+
membership_status: 'active',
|
|
76
|
+
config: {},
|
|
77
|
+
effective_permissions: [],
|
|
78
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
79
|
+
updated_at: '2025-01-01T00:00:00Z',
|
|
80
|
+
...overrides
|
|
81
|
+
}
|
|
82
|
+
}
|