@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
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
43
43
  }>;
44
44
  description: z.ZodOptional<z.ZodString>;
45
45
  enabled: z.ZodDefault<z.ZodBoolean>;
46
+ devOnly: z.ZodOptional<z.ZodBoolean>;
46
47
  icon: z.ZodOptional<z.ZodString>;
47
48
  featureId: z.ZodOptional<z.ZodString>;
48
49
  featureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -325,7 +326,7 @@ declare const SETTINGS_FEATURE_ID: "settings";
325
326
  declare const SEO_FEATURE_ID: "seo";
326
327
  declare const SALES_PIPELINE_SURFACE_ID: "crm.pipeline";
327
328
  declare const PROSPECTING_LISTS_SURFACE_ID: "lead-gen.lists";
328
- declare const OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID: "operations.organization-graph";
329
+ declare const OPERATIONS_COMMAND_VIEW_SURFACE_ID: "operations.command-view";
329
330
 
330
331
  declare const OrganizationModelBrandingSchema: z.ZodObject<{
331
332
  organizationName: z.ZodString;
@@ -694,5 +695,5 @@ declare function createFoundationOrganizationModel(override: DeepPartial<Organiz
694
695
  getOrganizationSurface: (surfaceId: string) => FoundationNavigationSurface | undefined;
695
696
  };
696
697
 
697
- export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_FEATURE_ID, OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
698
+ export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
698
699
  export type { DeepPartial, FoundationBranding, FoundationNavigationSurface, FoundationOrganizationModel, FoundationSurfaceIcon, FoundationSurfaceType, NodeIdPath, NodeIdString, OrganizationModel, OrganizationModelBranding, OrganizationModelCustomerFirmographics, OrganizationModelCustomerSegment, OrganizationModelCustomers, OrganizationModelFeature, OrganizationModelGoals, OrganizationModelKeyResult, OrganizationModelObjective, OrganizationModelOfferings, OrganizationModelOperationEntry, OrganizationModelOperationSemanticClass, OrganizationModelOperations, OrganizationModelPricingModel, OrganizationModelProduct, OrganizationModelProjects, OrganizationModelProspecting, OrganizationModelRole, OrganizationModelRoles, OrganizationModelSales, OrganizationModelStatusEntry, OrganizationModelStatusSemanticClass, OrganizationModelStatuses, OrganizationModelTechStackEntry };
package/dist/index.js CHANGED
@@ -248,7 +248,7 @@ var SETTINGS_FEATURE_ID = "settings";
248
248
  var SEO_FEATURE_ID = "seo";
249
249
  var SALES_PIPELINE_SURFACE_ID = "crm.pipeline";
250
250
  var PROSPECTING_LISTS_SURFACE_ID = "lead-gen.lists";
251
- var OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID = "operations.organization-graph";
251
+ var OPERATIONS_COMMAND_VIEW_SURFACE_ID = "operations.command-view";
252
252
 
253
253
  // src/organization-model/domains/navigation.ts
254
254
  var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]);
@@ -259,6 +259,7 @@ var SurfaceDefinitionSchema = z.object({
259
259
  surfaceType: SurfaceTypeSchema,
260
260
  description: DescriptionSchema.optional(),
261
261
  enabled: z.boolean().default(true),
262
+ devOnly: z.boolean().optional(),
262
263
  icon: IconNameSchema.optional(),
263
264
  featureId: ModelIdSchema.optional(),
264
265
  featureIds: ReferenceIdsSchema,
@@ -889,17 +890,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
889
890
  icon: "operations",
890
891
  uiPosition: "sidebar-primary"
891
892
  },
892
- {
893
- id: "operations.graph",
894
- label: "Organization Graph",
895
- enabled: true,
896
- path: "/operations/organization-graph"
897
- },
898
893
  {
899
894
  id: "operations.command-view",
900
895
  label: "Command View",
901
- enabled: false,
902
- path: "/operations/command-view"
896
+ enabled: true,
897
+ path: "/operations/command-view",
898
+ devOnly: true
903
899
  },
904
900
  {
905
901
  id: "operations.overview",
@@ -1143,13 +1139,12 @@ function createFoundationOrganizationModel(override) {
1143
1139
  }
1144
1140
  return feature;
1145
1141
  }
1146
- const operationsGraphFeature = requireCoreFeature("operations.graph");
1142
+ const operationsFeature = requireCoreFeature("operations");
1147
1143
  const projectsFeature = requireCoreFeature("projects");
1148
1144
  const leadGenFeature = requireCoreFeature("sales.lead-gen");
1149
1145
  const crmFeature = requireCoreFeature("sales.crm");
1150
1146
  const navigationSurfaces = [
1151
- { ...operationsGraphFeature, id: "operations", path: "/operations", icon: "operations", surfaceType: "graph" },
1152
- { ...operationsGraphFeature, path: "/operations", icon: "operations", surfaceType: "graph" },
1147
+ { ...operationsFeature, id: "operations", path: "/operations", icon: "operations", surfaceType: "dashboard" },
1153
1148
  { ...projectsFeature, icon: "projects", surfaceType: "list" },
1154
1149
  { ...leadGenFeature, id: "lead-gen", icon: "lead-gen", surfaceType: "list" },
1155
1150
  { ...crmFeature, id: "crm", icon: "crm", surfaceType: "graph" },
@@ -1178,4 +1173,4 @@ function createFoundationOrganizationModel(override) {
1178
1173
  };
1179
1174
  }
1180
1175
 
1181
- export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_FEATURE_ID, OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
1176
+ export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
@@ -43,6 +43,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
43
43
  }>;
44
44
  description: z.ZodOptional<z.ZodString>;
45
45
  enabled: z.ZodDefault<z.ZodBoolean>;
46
+ devOnly: z.ZodOptional<z.ZodBoolean>;
46
47
  icon: z.ZodOptional<z.ZodString>;
47
48
  featureId: z.ZodOptional<z.ZodString>;
48
49
  featureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -325,7 +326,7 @@ declare const SETTINGS_FEATURE_ID: "settings";
325
326
  declare const SEO_FEATURE_ID: "seo";
326
327
  declare const SALES_PIPELINE_SURFACE_ID: "crm.pipeline";
327
328
  declare const PROSPECTING_LISTS_SURFACE_ID: "lead-gen.lists";
328
- declare const OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID: "operations.organization-graph";
329
+ declare const OPERATIONS_COMMAND_VIEW_SURFACE_ID: "operations.command-view";
329
330
 
330
331
  declare const OrganizationModelBrandingSchema: z.ZodObject<{
331
332
  organizationName: z.ZodString;
@@ -694,5 +695,5 @@ declare function createFoundationOrganizationModel(override: DeepPartial<Organiz
694
695
  getOrganizationSurface: (surfaceId: string) => FoundationNavigationSurface | undefined;
695
696
  };
696
697
 
697
- export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_FEATURE_ID, OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
698
+ export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
698
699
  export type { DeepPartial, FoundationBranding, FoundationNavigationSurface, FoundationOrganizationModel, FoundationSurfaceIcon, FoundationSurfaceType, NodeIdPath, NodeIdString, OrganizationModel, OrganizationModelBranding, OrganizationModelCustomerFirmographics, OrganizationModelCustomerSegment, OrganizationModelCustomers, OrganizationModelFeature, OrganizationModelGoals, OrganizationModelKeyResult, OrganizationModelObjective, OrganizationModelOfferings, OrganizationModelOperationEntry, OrganizationModelOperationSemanticClass, OrganizationModelOperations, OrganizationModelPricingModel, OrganizationModelProduct, OrganizationModelProjects, OrganizationModelProspecting, OrganizationModelRole, OrganizationModelRoles, OrganizationModelSales, OrganizationModelStatusEntry, OrganizationModelStatusSemanticClass, OrganizationModelStatuses, OrganizationModelTechStackEntry };
@@ -248,7 +248,7 @@ var SETTINGS_FEATURE_ID = "settings";
248
248
  var SEO_FEATURE_ID = "seo";
249
249
  var SALES_PIPELINE_SURFACE_ID = "crm.pipeline";
250
250
  var PROSPECTING_LISTS_SURFACE_ID = "lead-gen.lists";
251
- var OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID = "operations.organization-graph";
251
+ var OPERATIONS_COMMAND_VIEW_SURFACE_ID = "operations.command-view";
252
252
 
253
253
  // src/organization-model/domains/navigation.ts
254
254
  var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]);
@@ -259,6 +259,7 @@ var SurfaceDefinitionSchema = z.object({
259
259
  surfaceType: SurfaceTypeSchema,
260
260
  description: DescriptionSchema.optional(),
261
261
  enabled: z.boolean().default(true),
262
+ devOnly: z.boolean().optional(),
262
263
  icon: IconNameSchema.optional(),
263
264
  featureId: ModelIdSchema.optional(),
264
265
  featureIds: ReferenceIdsSchema,
@@ -889,17 +890,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
889
890
  icon: "operations",
890
891
  uiPosition: "sidebar-primary"
891
892
  },
892
- {
893
- id: "operations.graph",
894
- label: "Organization Graph",
895
- enabled: true,
896
- path: "/operations/organization-graph"
897
- },
898
893
  {
899
894
  id: "operations.command-view",
900
895
  label: "Command View",
901
- enabled: false,
902
- path: "/operations/command-view"
896
+ enabled: true,
897
+ path: "/operations/command-view",
898
+ devOnly: true
903
899
  },
904
900
  {
905
901
  id: "operations.overview",
@@ -1143,13 +1139,12 @@ function createFoundationOrganizationModel(override) {
1143
1139
  }
1144
1140
  return feature;
1145
1141
  }
1146
- const operationsGraphFeature = requireCoreFeature("operations.graph");
1142
+ const operationsFeature = requireCoreFeature("operations");
1147
1143
  const projectsFeature = requireCoreFeature("projects");
1148
1144
  const leadGenFeature = requireCoreFeature("sales.lead-gen");
1149
1145
  const crmFeature = requireCoreFeature("sales.crm");
1150
1146
  const navigationSurfaces = [
1151
- { ...operationsGraphFeature, id: "operations", path: "/operations", icon: "operations", surfaceType: "graph" },
1152
- { ...operationsGraphFeature, path: "/operations", icon: "operations", surfaceType: "graph" },
1147
+ { ...operationsFeature, id: "operations", path: "/operations", icon: "operations", surfaceType: "dashboard" },
1153
1148
  { ...projectsFeature, icon: "projects", surfaceType: "list" },
1154
1149
  { ...leadGenFeature, id: "lead-gen", icon: "lead-gen", surfaceType: "list" },
1155
1150
  { ...crmFeature, id: "crm", icon: "crm", surfaceType: "graph" },
@@ -1178,4 +1173,4 @@ function createFoundationOrganizationModel(override) {
1178
1173
  };
1179
1174
  }
1180
1175
 
1181
- export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_FEATURE_ID, OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
1176
+ export { CustomerSegmentSchema, CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_STATUSES, FeatureSchema, FirmographicsSchema, GoalsDomainSchema, KeyResultSchema, LinkSchema, MONITORING_FEATURE_ID, NodeIdPathSchema, NodeIdStringSchema, OPERATIONS_COMMAND_VIEW_SURFACE_ID, OPERATIONS_FEATURE_ID, ObjectiveSchema, OfferingsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema, OperationsDomainSchema, OrganizationModelSchema, PROJECTS_FEATURE_ID, PROJECTS_INDEX_SURFACE_ID, PROJECTS_VIEW_CAPABILITY_ID, PROSPECTING_FEATURE_ID, PROSPECTING_LISTS_SURFACE_ID, PricingModelSchema, ProductSchema, RoleSchema, RolesDomainSchema, SALES_FEATURE_ID, SALES_PIPELINE_SURFACE_ID, SEO_FEATURE_ID, SETTINGS_FEATURE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
@@ -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: {
@@ -3164,6 +3338,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
3164
3338
  }>;
3165
3339
  description: z.ZodOptional<z.ZodString>;
3166
3340
  enabled: z.ZodDefault<z.ZodBoolean>;
3341
+ devOnly: z.ZodOptional<z.ZodBoolean>;
3167
3342
  icon: z.ZodOptional<z.ZodString>;
3168
3343
  featureId: z.ZodOptional<z.ZodString>;
3169
3344
  featureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -2404,6 +2404,7 @@ var TEST_MEMBERSHIPS = {
2404
2404
  role_slug: "admin",
2405
2405
  membership_status: "active",
2406
2406
  config: {},
2407
+ effective_permissions: [],
2407
2408
  created_at: "2025-01-01T00:00:00Z",
2408
2409
  updated_at: "2025-01-01T00:00:00Z"
2409
2410
  },
@@ -2415,6 +2416,7 @@ var TEST_MEMBERSHIPS = {
2415
2416
  role_slug: "member",
2416
2417
  membership_status: "active",
2417
2418
  config: {},
2419
+ effective_permissions: [],
2418
2420
  created_at: "2025-01-01T00:00:00Z",
2419
2421
  updated_at: "2025-01-01T00:00:00Z"
2420
2422
  },
@@ -2426,6 +2428,7 @@ var TEST_MEMBERSHIPS = {
2426
2428
  role_slug: "member",
2427
2429
  membership_status: "inactive",
2428
2430
  config: {},
2431
+ effective_permissions: [],
2429
2432
  created_at: "2025-01-01T00:00:00Z",
2430
2433
  updated_at: "2025-01-01T00:00:00Z"
2431
2434
  }
@@ -2453,6 +2456,7 @@ function createTestMembership(overrides) {
2453
2456
  role_slug: "member",
2454
2457
  membership_status: "active",
2455
2458
  config: {},
2459
+ effective_permissions: [],
2456
2460
  created_at: "2025-01-01T00:00:00Z",
2457
2461
  updated_at: "2025-01-01T00:00:00Z",
2458
2462
  ...overrides
@@ -19635,6 +19639,7 @@ var SurfaceDefinitionSchema = z.object({
19635
19639
  surfaceType: SurfaceTypeSchema,
19636
19640
  description: DescriptionSchema.optional(),
19637
19641
  enabled: z.boolean().default(true),
19642
+ devOnly: z.boolean().optional(),
19638
19643
  icon: IconNameSchema.optional(),
19639
19644
  featureId: ModelIdSchema.optional(),
19640
19645
  featureIds: ReferenceIdsSchema,
@@ -20215,17 +20220,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
20215
20220
  icon: "operations",
20216
20221
  uiPosition: "sidebar-primary"
20217
20222
  },
20218
- {
20219
- id: "operations.graph",
20220
- label: "Organization Graph",
20221
- enabled: true,
20222
- path: "/operations/organization-graph"
20223
- },
20224
20223
  {
20225
20224
  id: "operations.command-view",
20226
20225
  label: "Command View",
20227
- enabled: false,
20228
- path: "/operations/command-view"
20226
+ enabled: true,
20227
+ path: "/operations/command-view",
20228
+ devOnly: true
20229
20229
  },
20230
20230
  {
20231
20231
  id: "operations.overview",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/core",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "license": "MIT",
5
5
  "description": "Minimal shared constants across Elevasis monorepo",
6
6
  "sideEffects": false,
@@ -12,28 +12,21 @@ describe('template core compatibility', () => {
12
12
  expect(foundationOrganizationModel.navigation.homeLabel).toBe(homeLabel)
13
13
  expect(foundationOrganizationModel.navigation.quickAccessSurfaceIds).toEqual(quickAccessSurfaceIds)
14
14
  expect(foundationOrganizationModel.version).toBe(1)
15
- expect(foundationOrganizationModel.navigation.defaultSurfaceId).toBe('operations')
15
+ expect(foundationOrganizationModel.navigation.defaultSurfaceId).toBe('operations')
16
16
  expect(getOrganizationSurface('operations')).toMatchObject({
17
17
  id: 'operations',
18
- label: 'Organization Graph',
18
+ label: 'Operations',
19
19
  path: '/operations',
20
- surfaceType: 'graph'
21
- })
22
-
23
- expect(getOrganizationSurface('operations.graph')).toMatchObject({
24
- id: 'operations.graph',
25
- label: 'Organization Graph',
26
- path: '/operations',
27
- surfaceType: 'graph'
20
+ surfaceType: 'dashboard'
28
21
  })
29
22
  })
30
23
 
31
24
  it('projects legacy template aliases with canonical navigation metadata', () => {
32
25
  const legacySurfaces = [
33
- {
26
+ {
34
27
  id: 'operations',
35
- label: 'Organization Graph',
36
- surfaceType: 'graph',
28
+ label: 'Operations',
29
+ surfaceType: 'dashboard',
37
30
  expectedIcon: 'operations',
38
31
  expectedPath: '/operations',
39
32
  },
@@ -60,8 +53,6 @@ describe('template core compatibility', () => {
60
53
  }
61
54
  ] as const
62
55
 
63
- expect(getOrganizationSurface('operations.graph')).toBeDefined()
64
-
65
56
  for (const surface of legacySurfaces) {
66
57
  expect(getOrganizationSurface(surface.id)).toMatchObject({
67
58
  id: surface.id,
@@ -198,6 +198,12 @@ export type FeatureIconComponent = ComponentType<{ size?: number;
198
198
  export type FeatureIconComponent = ComponentType<{ size?: number;
199
199
  ```
200
200
 
201
+ ### `FeatureSidebarWidthResolver`
202
+
203
+ ```typescript
204
+ export type FeatureSidebarWidthResolver = number | ((context: { currentPath: string }) => number)
205
+ ```
206
+
201
207
  ### `FeatureModule`
202
208
 
203
209
  ```typescript
@@ -212,6 +218,8 @@ export interface FeatureModule {
212
218
  icon?: FeatureIconComponent
213
219
  /** Sidebar component rendered when this feature's subtree route is active. */
214
220
  sidebar?: FeatureSidebarComponent
221
+ /** Optional shell sidebar width override. Defaults to 250px. */
222
+ sidebarWidth?: FeatureSidebarWidthResolver
215
223
  /** Operations-only bridge connecting this feature to the organization graph node. */
216
224
  organizationGraph?: OrganizationGraphFeatureBridge
217
225
  }
@@ -1007,44 +1015,34 @@ export interface HumanCheckpointDefinition extends ResourceDefinition {
1007
1015
  ### `DeploymentSpec`
1008
1016
 
1009
1017
  ```typescript
1010
- /** Supabase Storage path: "{orgId}/{deploymentId}/bundle.js" */
1011
- storagePath: string
1012
- /** Deployment record ID */
1013
- deploymentId: string
1014
- /** OS temp path to bundle -- set after first download, used by worker threads */
1015
- cachedTempPath?: string
1016
- /** Platform tool name -> credential name mapping */
1017
- toolCredentials?: Record<string, string>
1018
- /** SDK version used to deploy this bundle */
1019
- sdkVersion?: string
1020
- /** Deployment version (semver) of the deployed bundle */
1021
- deploymentVersion?: string
1022
- }
1023
-
1024
- /**
1025
- * Organization-specific resource collection
1026
- *
1027
- * Complete manifest of all automation resources for an organization.
1028
- * Used by ResourceRegistry for discovery and Command View for visualization.
1018
+ /** Always undefined for system resources; present for API compatibility with RemoteOrgConfig consumers */
1019
+ sdkVersion?: never
1020
+ }
1021
+
1022
+ /**
1023
+ * Organization-specific resource collection
1024
+ *
1025
+ * Complete manifest of all automation resources for an organization.
1026
+ * Used by ResourceRegistry for discovery and Command View for visualization.
1029
1027
  */
1030
- export interface DeploymentSpec {
1031
- /** Deployment version (semver) */
1032
- version: string
1033
- /** Workflow definitions */
1034
- workflows?: WorkflowDefinition[]
1035
- /** Agent definitions */
1036
- agents?: AgentDefinition[]
1037
-
1038
- // Resource Manifest fields (optional for backwards compatibility)
1039
- /** Trigger definitions - entry points that initiate executions */
1040
- triggers?: TriggerDefinition[]
1041
- /** Integration definitions - external service connections */
1042
- integrations?: IntegrationDefinition[]
1043
- /** Explicit relationship declarations between resources */
1044
- relationships?: ResourceRelationships
1045
- /** External automation resources (n8n, Make, Zapier, etc.) */
1046
- externalResources?: ExternalResourceDefinition[]
1047
- /** Human checkpoint definitions - human decision points in automation */
1048
- humanCheckpoints?: HumanCheckpointDefinition[]
1028
+ export interface DeploymentSpec {
1029
+ /** Deployment version (semver) */
1030
+ version: string
1031
+ /** Workflow definitions */
1032
+ workflows?: WorkflowDefinition[]
1033
+ /** Agent definitions */
1034
+ agents?: AgentDefinition[]
1035
+
1036
+ // Resource Manifest fields (optional for backwards compatibility)
1037
+ /** Trigger definitions - entry points that initiate executions */
1038
+ triggers?: TriggerDefinition[]
1039
+ /** Integration definitions - external service connections */
1040
+ integrations?: IntegrationDefinition[]
1041
+ /** Explicit relationship declarations between resources */
1042
+ relationships?: ResourceRelationships
1043
+ /** External automation resources (n8n, Make, Zapier, etc.) */
1044
+ externalResources?: ExternalResourceDefinition[]
1045
+ /** Human checkpoint definitions - human decision points in automation */
1046
+ humanCheckpoints?: HumanCheckpointDefinition[]
1049
1047
  }
1050
1048
  ```
@@ -1,17 +1,20 @@
1
- // Config types
2
- export * from './types'
3
-
4
- // Organization types
5
- export * from './organizations/index'
6
-
7
- // User types
8
- export * from './users/index'
9
-
10
- // Membership types
11
- export * from './memberships/index'
12
-
13
- // Invitation types
14
- export * from './invitations/index'
15
-
16
- // Credentials types
17
- export * from './credentials/index'
1
+ // Config types
2
+ export * from './types'
3
+
4
+ // Permission catalog (canonical PERMISSIONS constant + types)
5
+ export * from './permissions'
6
+
7
+ // Organization types
8
+ export * from './organizations/index'
9
+
10
+ // User types
11
+ export * from './users/index'
12
+
13
+ // Membership types
14
+ export * from './memberships/index'
15
+
16
+ // Invitation types
17
+ export * from './invitations/index'
18
+
19
+ // Credentials types
20
+ export * from './credentials/index'