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