@elevasis/core 0.10.0 → 0.11.1
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 +69 -159
- package/dist/index.js +324 -613
- package/dist/organization-model/index.d.ts +69 -159
- package/dist/organization-model/index.js +324 -613
- package/dist/test-utils/index.d.ts +192 -45
- package/dist/test-utils/index.js +260 -600
- package/package.json +1 -1
- package/src/__tests__/template-core-compatibility.test.ts +73 -91
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +94 -182
- 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 +102 -97
- package/src/organization-model/__tests__/defaults.test.ts +19 -6
- package/src/organization-model/__tests__/domains/resource-mappings.test.ts +24 -93
- package/src/organization-model/__tests__/graph.test.ts +82 -894
- package/src/organization-model/__tests__/resolve.test.ts +59 -690
- package/src/organization-model/__tests__/schema.test.ts +83 -407
- package/src/organization-model/contracts.ts +4 -3
- package/src/organization-model/defaults.ts +277 -141
- package/src/organization-model/domains/features.ts +31 -22
- package/src/organization-model/domains/navigation.ts +27 -20
- package/src/organization-model/foundation.ts +42 -54
- package/src/organization-model/graph/build.ts +42 -217
- package/src/organization-model/graph/index.ts +4 -4
- package/src/organization-model/graph/link.ts +10 -0
- package/src/organization-model/graph/schema.ts +21 -16
- package/src/organization-model/graph/types.ts +10 -10
- package/src/organization-model/helpers.ts +74 -0
- package/src/organization-model/index.ts +7 -7
- package/src/organization-model/organization-graph.mdx +89 -272
- package/src/organization-model/organization-model.mdx +152 -320
- package/src/organization-model/published.ts +20 -19
- package/src/organization-model/resolve.ts +8 -33
- package/src/organization-model/schema.ts +63 -205
- package/src/organization-model/types.ts +12 -11
- package/src/platform/constants/versions.ts +3 -3
- package/src/platform/registry/__tests__/command-view.test.ts +6 -5
- package/src/platform/registry/__tests__/resource-link.test.ts +30 -0
- package/src/platform/registry/__tests__/resource-registry.integration.test.ts +15 -15
- package/src/platform/registry/command-view.ts +10 -12
- package/src/platform/registry/index.ts +93 -93
- package/src/platform/registry/resource-link.ts +32 -0
- package/src/platform/registry/resource-registry.ts +917 -876
- package/src/platform/registry/serialization.ts +56 -73
- package/src/platform/registry/serialized-types.ts +17 -12
- package/src/platform/registry/types.ts +14 -43
- package/src/reference/_generated/contracts.md +94 -182
- package/src/reference/glossary.md +71 -105
- 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
- package/src/platform/registry/domains.ts +0 -165
|
@@ -1675,6 +1675,7 @@ type Database = {
|
|
|
1675
1675
|
Row: {
|
|
1676
1676
|
config: Json;
|
|
1677
1677
|
created_at: string | null;
|
|
1678
|
+
effective_permissions: string[];
|
|
1678
1679
|
id: string;
|
|
1679
1680
|
membership_status: string | null;
|
|
1680
1681
|
organization_id: string;
|
|
@@ -1686,6 +1687,7 @@ type Database = {
|
|
|
1686
1687
|
Insert: {
|
|
1687
1688
|
config?: Json;
|
|
1688
1689
|
created_at?: string | null;
|
|
1690
|
+
effective_permissions?: string[];
|
|
1689
1691
|
id?: string;
|
|
1690
1692
|
membership_status?: string | null;
|
|
1691
1693
|
organization_id: string;
|
|
@@ -1697,6 +1699,7 @@ type Database = {
|
|
|
1697
1699
|
Update: {
|
|
1698
1700
|
config?: Json;
|
|
1699
1701
|
created_at?: string | null;
|
|
1702
|
+
effective_permissions?: string[];
|
|
1700
1703
|
id?: string;
|
|
1701
1704
|
membership_status?: string | null;
|
|
1702
1705
|
organization_id?: string;
|
|
@@ -1722,6 +1725,147 @@ type Database = {
|
|
|
1722
1725
|
}
|
|
1723
1726
|
];
|
|
1724
1727
|
};
|
|
1728
|
+
org_rol_assignments: {
|
|
1729
|
+
Row: {
|
|
1730
|
+
granted_at: string;
|
|
1731
|
+
granted_by: string | null;
|
|
1732
|
+
membership_id: string;
|
|
1733
|
+
role_id: string;
|
|
1734
|
+
};
|
|
1735
|
+
Insert: {
|
|
1736
|
+
granted_at?: string;
|
|
1737
|
+
granted_by?: string | null;
|
|
1738
|
+
membership_id: string;
|
|
1739
|
+
role_id: string;
|
|
1740
|
+
};
|
|
1741
|
+
Update: {
|
|
1742
|
+
granted_at?: string;
|
|
1743
|
+
granted_by?: string | null;
|
|
1744
|
+
membership_id?: string;
|
|
1745
|
+
role_id?: string;
|
|
1746
|
+
};
|
|
1747
|
+
Relationships: [
|
|
1748
|
+
{
|
|
1749
|
+
foreignKeyName: "org_rol_assignments_granted_by_fkey";
|
|
1750
|
+
columns: ["granted_by"];
|
|
1751
|
+
isOneToOne: false;
|
|
1752
|
+
referencedRelation: "users";
|
|
1753
|
+
referencedColumns: ["id"];
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
foreignKeyName: "org_rol_assignments_membership_id_fkey";
|
|
1757
|
+
columns: ["membership_id"];
|
|
1758
|
+
isOneToOne: false;
|
|
1759
|
+
referencedRelation: "org_memberships";
|
|
1760
|
+
referencedColumns: ["id"];
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
foreignKeyName: "org_rol_assignments_role_id_fkey";
|
|
1764
|
+
columns: ["role_id"];
|
|
1765
|
+
isOneToOne: false;
|
|
1766
|
+
referencedRelation: "org_rol_definitions";
|
|
1767
|
+
referencedColumns: ["id"];
|
|
1768
|
+
}
|
|
1769
|
+
];
|
|
1770
|
+
};
|
|
1771
|
+
org_rol_definitions: {
|
|
1772
|
+
Row: {
|
|
1773
|
+
created_at: string;
|
|
1774
|
+
description: string | null;
|
|
1775
|
+
id: string;
|
|
1776
|
+
is_system: boolean;
|
|
1777
|
+
name: string;
|
|
1778
|
+
organization_id: string | null;
|
|
1779
|
+
slug: string;
|
|
1780
|
+
updated_at: string;
|
|
1781
|
+
};
|
|
1782
|
+
Insert: {
|
|
1783
|
+
created_at?: string;
|
|
1784
|
+
description?: string | null;
|
|
1785
|
+
id?: string;
|
|
1786
|
+
is_system?: boolean;
|
|
1787
|
+
name: string;
|
|
1788
|
+
organization_id?: string | null;
|
|
1789
|
+
slug: string;
|
|
1790
|
+
updated_at?: string;
|
|
1791
|
+
};
|
|
1792
|
+
Update: {
|
|
1793
|
+
created_at?: string;
|
|
1794
|
+
description?: string | null;
|
|
1795
|
+
id?: string;
|
|
1796
|
+
is_system?: boolean;
|
|
1797
|
+
name?: string;
|
|
1798
|
+
organization_id?: string | null;
|
|
1799
|
+
slug?: string;
|
|
1800
|
+
updated_at?: string;
|
|
1801
|
+
};
|
|
1802
|
+
Relationships: [
|
|
1803
|
+
{
|
|
1804
|
+
foreignKeyName: "org_rol_definitions_organization_id_fkey";
|
|
1805
|
+
columns: ["organization_id"];
|
|
1806
|
+
isOneToOne: false;
|
|
1807
|
+
referencedRelation: "organizations";
|
|
1808
|
+
referencedColumns: ["id"];
|
|
1809
|
+
}
|
|
1810
|
+
];
|
|
1811
|
+
};
|
|
1812
|
+
org_rol_grants: {
|
|
1813
|
+
Row: {
|
|
1814
|
+
granted_at: string;
|
|
1815
|
+
permission_key: string;
|
|
1816
|
+
role_id: string;
|
|
1817
|
+
};
|
|
1818
|
+
Insert: {
|
|
1819
|
+
granted_at?: string;
|
|
1820
|
+
permission_key: string;
|
|
1821
|
+
role_id: string;
|
|
1822
|
+
};
|
|
1823
|
+
Update: {
|
|
1824
|
+
granted_at?: string;
|
|
1825
|
+
permission_key?: string;
|
|
1826
|
+
role_id?: string;
|
|
1827
|
+
};
|
|
1828
|
+
Relationships: [
|
|
1829
|
+
{
|
|
1830
|
+
foreignKeyName: "org_rol_grants_permission_key_fkey";
|
|
1831
|
+
columns: ["permission_key"];
|
|
1832
|
+
isOneToOne: false;
|
|
1833
|
+
referencedRelation: "org_rol_permissions";
|
|
1834
|
+
referencedColumns: ["key"];
|
|
1835
|
+
},
|
|
1836
|
+
{
|
|
1837
|
+
foreignKeyName: "org_rol_grants_role_id_fkey";
|
|
1838
|
+
columns: ["role_id"];
|
|
1839
|
+
isOneToOne: false;
|
|
1840
|
+
referencedRelation: "org_rol_definitions";
|
|
1841
|
+
referencedColumns: ["id"];
|
|
1842
|
+
}
|
|
1843
|
+
];
|
|
1844
|
+
};
|
|
1845
|
+
org_rol_permissions: {
|
|
1846
|
+
Row: {
|
|
1847
|
+
created_at: string;
|
|
1848
|
+
description: string;
|
|
1849
|
+
is_org_grantable: boolean;
|
|
1850
|
+
key: string;
|
|
1851
|
+
updated_at: string;
|
|
1852
|
+
};
|
|
1853
|
+
Insert: {
|
|
1854
|
+
created_at?: string;
|
|
1855
|
+
description: string;
|
|
1856
|
+
is_org_grantable?: boolean;
|
|
1857
|
+
key: string;
|
|
1858
|
+
updated_at?: string;
|
|
1859
|
+
};
|
|
1860
|
+
Update: {
|
|
1861
|
+
created_at?: string;
|
|
1862
|
+
description?: string;
|
|
1863
|
+
is_org_grantable?: boolean;
|
|
1864
|
+
key?: string;
|
|
1865
|
+
updated_at?: string;
|
|
1866
|
+
};
|
|
1867
|
+
Relationships: [];
|
|
1868
|
+
};
|
|
1725
1869
|
organizations: {
|
|
1726
1870
|
Row: {
|
|
1727
1871
|
config: Json;
|
|
@@ -2551,6 +2695,13 @@ type Database = {
|
|
|
2551
2695
|
Args: never;
|
|
2552
2696
|
Returns: string;
|
|
2553
2697
|
};
|
|
2698
|
+
can_assign_role_in_org: {
|
|
2699
|
+
Args: {
|
|
2700
|
+
p_role_id: string;
|
|
2701
|
+
p_target_membership_id: string;
|
|
2702
|
+
};
|
|
2703
|
+
Returns: boolean;
|
|
2704
|
+
};
|
|
2554
2705
|
current_user_is_platform_admin: {
|
|
2555
2706
|
Args: never;
|
|
2556
2707
|
Returns: boolean;
|
|
@@ -2590,6 +2741,13 @@ type Database = {
|
|
|
2590
2741
|
Args: never;
|
|
2591
2742
|
Returns: string;
|
|
2592
2743
|
};
|
|
2744
|
+
has_org_permission: {
|
|
2745
|
+
Args: {
|
|
2746
|
+
org_id: string;
|
|
2747
|
+
perm_key: string;
|
|
2748
|
+
};
|
|
2749
|
+
Returns: boolean;
|
|
2750
|
+
};
|
|
2593
2751
|
is_org_admin: {
|
|
2594
2752
|
Args: {
|
|
2595
2753
|
org_id: string;
|
|
@@ -2622,6 +2780,22 @@ type Database = {
|
|
|
2622
2780
|
Args: never;
|
|
2623
2781
|
Returns: Json;
|
|
2624
2782
|
};
|
|
2783
|
+
recompute_all_memberships: {
|
|
2784
|
+
Args: never;
|
|
2785
|
+
Returns: undefined;
|
|
2786
|
+
};
|
|
2787
|
+
sync_all_memberships_with_role: {
|
|
2788
|
+
Args: {
|
|
2789
|
+
p_role_id: string;
|
|
2790
|
+
};
|
|
2791
|
+
Returns: undefined;
|
|
2792
|
+
};
|
|
2793
|
+
sync_one_membership: {
|
|
2794
|
+
Args: {
|
|
2795
|
+
p_membership_id: string;
|
|
2796
|
+
};
|
|
2797
|
+
Returns: undefined;
|
|
2798
|
+
};
|
|
2625
2799
|
upsert_user_profile: {
|
|
2626
2800
|
Args: never;
|
|
2627
2801
|
Returns: {
|
|
@@ -3128,12 +3302,15 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3128
3302
|
label: z.ZodString;
|
|
3129
3303
|
description: z.ZodOptional<z.ZodString>;
|
|
3130
3304
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
3131
|
-
|
|
3305
|
+
path: z.ZodOptional<z.ZodString>;
|
|
3132
3306
|
icon: z.ZodOptional<z.ZodString>;
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3307
|
+
color: z.ZodOptional<z.ZodString>;
|
|
3308
|
+
uiPosition: z.ZodOptional<z.ZodEnum<{
|
|
3309
|
+
"sidebar-primary": "sidebar-primary";
|
|
3310
|
+
"sidebar-bottom": "sidebar-bottom";
|
|
3311
|
+
}>>;
|
|
3312
|
+
requiresAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
3313
|
+
devOnly: z.ZodOptional<z.ZodBoolean>;
|
|
3137
3314
|
}, z.core.$strip>>>;
|
|
3138
3315
|
branding: z.ZodObject<{
|
|
3139
3316
|
organizationName: z.ZodString;
|
|
@@ -3145,22 +3322,23 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3145
3322
|
dark: z.ZodOptional<z.ZodString>;
|
|
3146
3323
|
}, z.core.$strip>>;
|
|
3147
3324
|
}, z.core.$strip>;
|
|
3148
|
-
navigation: z.ZodObject<{
|
|
3325
|
+
navigation: z.ZodDefault<z.ZodObject<{
|
|
3149
3326
|
defaultSurfaceId: z.ZodOptional<z.ZodString>;
|
|
3150
3327
|
surfaces: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3151
3328
|
id: z.ZodString;
|
|
3152
3329
|
label: z.ZodString;
|
|
3153
3330
|
path: z.ZodString;
|
|
3154
3331
|
surfaceType: z.ZodEnum<{
|
|
3155
|
-
list: "list";
|
|
3156
3332
|
settings: "settings";
|
|
3157
3333
|
page: "page";
|
|
3158
3334
|
dashboard: "dashboard";
|
|
3159
3335
|
graph: "graph";
|
|
3160
3336
|
detail: "detail";
|
|
3337
|
+
list: "list";
|
|
3161
3338
|
}>;
|
|
3162
3339
|
description: z.ZodOptional<z.ZodString>;
|
|
3163
3340
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
3341
|
+
devOnly: z.ZodOptional<z.ZodBoolean>;
|
|
3164
3342
|
icon: z.ZodOptional<z.ZodString>;
|
|
3165
3343
|
featureId: z.ZodOptional<z.ZodString>;
|
|
3166
3344
|
featureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -3175,7 +3353,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3175
3353
|
placement: z.ZodString;
|
|
3176
3354
|
surfaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3177
3355
|
}, z.core.$strip>>>;
|
|
3178
|
-
}, z.core.$strip
|
|
3356
|
+
}, z.core.$strip>>;
|
|
3179
3357
|
sales: z.ZodObject<{
|
|
3180
3358
|
entityId: z.ZodString;
|
|
3181
3359
|
defaultPipelineId: z.ZodString;
|
|
@@ -3194,9 +3372,9 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3194
3372
|
semanticClass: z.ZodEnum<{
|
|
3195
3373
|
open: "open";
|
|
3196
3374
|
active: "active";
|
|
3375
|
+
nurturing: "nurturing";
|
|
3197
3376
|
closed_won: "closed_won";
|
|
3198
3377
|
closed_lost: "closed_lost";
|
|
3199
|
-
nurturing: "nurturing";
|
|
3200
3378
|
}>;
|
|
3201
3379
|
surfaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3202
3380
|
resourceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -3357,12 +3535,12 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3357
3535
|
id: z.ZodString;
|
|
3358
3536
|
label: z.ZodString;
|
|
3359
3537
|
semanticClass: z.ZodEnum<{
|
|
3360
|
-
execution: "execution";
|
|
3361
|
-
schedule: "schedule";
|
|
3362
|
-
queue: "queue";
|
|
3363
3538
|
"delivery.project": "delivery.project";
|
|
3364
3539
|
"delivery.milestone": "delivery.milestone";
|
|
3365
3540
|
"delivery.task": "delivery.task";
|
|
3541
|
+
queue: "queue";
|
|
3542
|
+
execution: "execution";
|
|
3543
|
+
schedule: "schedule";
|
|
3366
3544
|
"schedule.run": "schedule.run";
|
|
3367
3545
|
request: "request";
|
|
3368
3546
|
}>;
|
|
@@ -3374,47 +3552,16 @@ declare const OrganizationModelSchema: z.ZodObject<{
|
|
|
3374
3552
|
id: z.ZodString;
|
|
3375
3553
|
label: z.ZodString;
|
|
3376
3554
|
semanticClass: z.ZodEnum<{
|
|
3555
|
+
queue: "queue";
|
|
3556
|
+
executions: "executions";
|
|
3377
3557
|
sessions: "sessions";
|
|
3378
3558
|
notifications: "notifications";
|
|
3379
3559
|
schedules: "schedules";
|
|
3380
|
-
executions: "executions";
|
|
3381
|
-
queue: "queue";
|
|
3382
3560
|
}>;
|
|
3383
3561
|
featureId: z.ZodOptional<z.ZodString>;
|
|
3384
3562
|
supportedStatusSemanticClass: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3385
3563
|
}, z.core.$strip>>>;
|
|
3386
3564
|
}, z.core.$strip>>;
|
|
3387
|
-
resourceMappings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3388
|
-
label: z.ZodString;
|
|
3389
|
-
description: z.ZodOptional<z.ZodString>;
|
|
3390
|
-
color: z.ZodOptional<z.ZodString>;
|
|
3391
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
3392
|
-
id: z.ZodString;
|
|
3393
|
-
resourceId: z.ZodString;
|
|
3394
|
-
resourceType: z.ZodEnum<{
|
|
3395
|
-
agent: "agent";
|
|
3396
|
-
workflow: "workflow";
|
|
3397
|
-
trigger: "trigger";
|
|
3398
|
-
integration: "integration";
|
|
3399
|
-
external: "external";
|
|
3400
|
-
human_checkpoint: "human_checkpoint";
|
|
3401
|
-
}>;
|
|
3402
|
-
featureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3403
|
-
entityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3404
|
-
surfaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3405
|
-
capabilityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3406
|
-
techStack: z.ZodOptional<z.ZodObject<{
|
|
3407
|
-
platform: z.ZodString;
|
|
3408
|
-
purpose: z.ZodString;
|
|
3409
|
-
credentialStatus: z.ZodEnum<{
|
|
3410
|
-
pending: "pending";
|
|
3411
|
-
configured: "configured";
|
|
3412
|
-
expired: "expired";
|
|
3413
|
-
missing: "missing";
|
|
3414
|
-
}>;
|
|
3415
|
-
isSystemOfRecord: z.ZodDefault<z.ZodBoolean>;
|
|
3416
|
-
}, z.core.$strip>>;
|
|
3417
|
-
}, z.core.$strip>>>;
|
|
3418
3565
|
}, z.core.$strip>;
|
|
3419
3566
|
|
|
3420
3567
|
type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
|