@elevasis/core 0.11.2 → 0.13.0
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 +2 -1
- package/dist/index.js +8 -1
- package/dist/organization-model/index.d.ts +2 -1
- package/dist/organization-model/index.js +8 -1
- package/dist/test-utils/index.d.ts +27 -15
- package/dist/test-utils/index.js +25 -0
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +27 -270
- package/src/auth/multi-tenancy/credentials/__tests__/encryption.test.ts +217 -216
- package/src/auth/multi-tenancy/credentials/server/encryption.ts +69 -39
- package/src/auth/multi-tenancy/credentials/server/kek-loader.ts +37 -0
- package/src/auth/multi-tenancy/index.ts +3 -0
- package/src/auth/multi-tenancy/invitations/api-schemas.ts +104 -107
- package/src/auth/multi-tenancy/memberships/api-schemas.ts +6 -5
- package/src/auth/multi-tenancy/memberships/membership.ts +130 -138
- package/src/auth/multi-tenancy/permissions.ts +12 -5
- package/src/auth/multi-tenancy/role-management/api-schemas.ts +78 -0
- package/src/auth/multi-tenancy/role-management/index.ts +16 -0
- package/src/business/acquisition/activity-events.ts +142 -0
- package/src/business/acquisition/api-schemas.ts +694 -689
- package/src/business/acquisition/derive-actions.ts +90 -0
- package/src/business/acquisition/index.ts +111 -109
- package/src/execution/engine/index.ts +434 -434
- package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +298 -293
- package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +0 -1
- package/src/execution/engine/tools/integration/service.test.ts +214 -0
- package/src/execution/engine/tools/integration/service.ts +169 -161
- package/src/execution/engine/tools/lead-service-types.ts +882 -879
- package/src/execution/engine/tools/registry.ts +699 -700
- package/src/execution/engine/tools/tool-maps.ts +777 -780
- package/src/integrations/credentials/__tests__/api-schemas.test.ts +420 -496
- package/src/integrations/credentials/api-schemas.ts +127 -143
- package/src/integrations/webhook-endpoints/__tests__/api-schemas.test.ts +327 -318
- package/src/integrations/webhook-endpoints/api-schemas.ts +103 -102
- package/src/integrations/webhook-endpoints/types.ts +58 -51
- package/src/operations/activities/api-schemas.ts +80 -79
- package/src/operations/activities/types.ts +64 -63
- package/src/organization-model/contracts.ts +1 -0
- package/src/organization-model/defaults.ts +6 -0
- package/src/organization-model/domains/navigation.ts +37 -23
- package/src/organization-model/organization-graph.mdx +2 -2
- package/src/organization-model/published.ts +2 -1
- package/src/platform/constants/versions.ts +1 -1
- package/src/reference/_generated/contracts.md +27 -270
- package/src/scaffold-registry/__tests__/index.test.ts +72 -7
- package/src/scaffold-registry/index.ts +163 -29
- package/src/scaffold-registry/schema.ts +68 -62
- package/src/server.ts +281 -272
- package/src/supabase/database.types.ts +16 -10
- package/src/test-utils/rls/RLSTestContext.ts +585 -553
package/dist/index.d.ts
CHANGED
|
@@ -327,6 +327,7 @@ declare const SEO_FEATURE_ID: "seo";
|
|
|
327
327
|
declare const SALES_PIPELINE_SURFACE_ID: "crm.pipeline";
|
|
328
328
|
declare const PROSPECTING_LISTS_SURFACE_ID: "lead-gen.lists";
|
|
329
329
|
declare const OPERATIONS_COMMAND_VIEW_SURFACE_ID: "operations.command-view";
|
|
330
|
+
declare const SETTINGS_ROLES_SURFACE_ID: "settings.roles";
|
|
330
331
|
|
|
331
332
|
declare const OrganizationModelBrandingSchema: z.ZodObject<{
|
|
332
333
|
organizationName: z.ZodString;
|
|
@@ -695,5 +696,5 @@ declare function createFoundationOrganizationModel(override: DeepPartial<Organiz
|
|
|
695
696
|
getOrganizationSurface: (surfaceId: string) => FoundationNavigationSurface | undefined;
|
|
696
697
|
};
|
|
697
698
|
|
|
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 };
|
|
699
|
+
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, SETTINGS_ROLES_SURFACE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
|
|
699
700
|
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
|
@@ -249,6 +249,7 @@ 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
251
|
var OPERATIONS_COMMAND_VIEW_SURFACE_ID = "operations.command-view";
|
|
252
|
+
var SETTINGS_ROLES_SURFACE_ID = "settings.roles";
|
|
252
253
|
|
|
253
254
|
// src/organization-model/domains/navigation.ts
|
|
254
255
|
var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]);
|
|
@@ -988,6 +989,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
988
989
|
enabled: true,
|
|
989
990
|
path: "/settings/appearance"
|
|
990
991
|
},
|
|
992
|
+
{
|
|
993
|
+
id: "settings.roles",
|
|
994
|
+
label: "My Roles",
|
|
995
|
+
enabled: true,
|
|
996
|
+
path: "/settings/roles"
|
|
997
|
+
},
|
|
991
998
|
{
|
|
992
999
|
id: "settings.organization",
|
|
993
1000
|
label: "Organization",
|
|
@@ -1173,4 +1180,4 @@ function createFoundationOrganizationModel(override) {
|
|
|
1173
1180
|
};
|
|
1174
1181
|
}
|
|
1175
1182
|
|
|
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 };
|
|
1183
|
+
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, SETTINGS_ROLES_SURFACE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
|
|
@@ -327,6 +327,7 @@ declare const SEO_FEATURE_ID: "seo";
|
|
|
327
327
|
declare const SALES_PIPELINE_SURFACE_ID: "crm.pipeline";
|
|
328
328
|
declare const PROSPECTING_LISTS_SURFACE_ID: "lead-gen.lists";
|
|
329
329
|
declare const OPERATIONS_COMMAND_VIEW_SURFACE_ID: "operations.command-view";
|
|
330
|
+
declare const SETTINGS_ROLES_SURFACE_ID: "settings.roles";
|
|
330
331
|
|
|
331
332
|
declare const OrganizationModelBrandingSchema: z.ZodObject<{
|
|
332
333
|
organizationName: z.ZodString;
|
|
@@ -695,5 +696,5 @@ declare function createFoundationOrganizationModel(override: DeepPartial<Organiz
|
|
|
695
696
|
getOrganizationSurface: (surfaceId: string) => FoundationNavigationSurface | undefined;
|
|
696
697
|
};
|
|
697
698
|
|
|
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 };
|
|
699
|
+
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, SETTINGS_ROLES_SURFACE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
|
|
699
700
|
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 };
|
|
@@ -249,6 +249,7 @@ 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
251
|
var OPERATIONS_COMMAND_VIEW_SURFACE_ID = "operations.command-view";
|
|
252
|
+
var SETTINGS_ROLES_SURFACE_ID = "settings.roles";
|
|
252
253
|
|
|
253
254
|
// src/organization-model/domains/navigation.ts
|
|
254
255
|
var SurfaceTypeSchema = z.enum(["page", "dashboard", "graph", "detail", "list", "settings"]);
|
|
@@ -988,6 +989,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
988
989
|
enabled: true,
|
|
989
990
|
path: "/settings/appearance"
|
|
990
991
|
},
|
|
992
|
+
{
|
|
993
|
+
id: "settings.roles",
|
|
994
|
+
label: "My Roles",
|
|
995
|
+
enabled: true,
|
|
996
|
+
path: "/settings/roles"
|
|
997
|
+
},
|
|
991
998
|
{
|
|
992
999
|
id: "settings.organization",
|
|
993
1000
|
label: "Organization",
|
|
@@ -1173,4 +1180,4 @@ function createFoundationOrganizationModel(override) {
|
|
|
1173
1180
|
};
|
|
1174
1181
|
}
|
|
1175
1182
|
|
|
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 };
|
|
1183
|
+
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, SETTINGS_ROLES_SURFACE_ID, StatusEntrySchema, StatusSemanticClassSchema, StatusesDomainSchema, TechStackEntrySchema, UiPositionSchema, createFoundationOrganizationModel, defineOrganizationModel, resolveOrganizationModel };
|
|
@@ -413,7 +413,6 @@ type Database = {
|
|
|
413
413
|
acq_deals: {
|
|
414
414
|
Row: {
|
|
415
415
|
activity_log: Json;
|
|
416
|
-
cached_stage: string | null;
|
|
417
416
|
closed_lost_at: string | null;
|
|
418
417
|
closed_lost_reason: string | null;
|
|
419
418
|
contact_email: string;
|
|
@@ -428,6 +427,7 @@ type Database = {
|
|
|
428
427
|
organization_id: string;
|
|
429
428
|
payment_link_sent_at: string | null;
|
|
430
429
|
payment_received_at: string | null;
|
|
430
|
+
pipeline_key: string;
|
|
431
431
|
proposal_data: Json | null;
|
|
432
432
|
proposal_generated_at: string | null;
|
|
433
433
|
proposal_pdf_url: string | null;
|
|
@@ -435,10 +435,11 @@ type Database = {
|
|
|
435
435
|
proposal_reviewed_by: string | null;
|
|
436
436
|
proposal_sent_at: string | null;
|
|
437
437
|
proposal_signed_at: string | null;
|
|
438
|
-
proposal_status: string | null;
|
|
439
438
|
signature_envelope_id: string | null;
|
|
440
439
|
source_list_id: string | null;
|
|
441
440
|
source_type: string | null;
|
|
441
|
+
stage_key: string | null;
|
|
442
|
+
state_key: string | null;
|
|
442
443
|
stripe_payment_id: string | null;
|
|
443
444
|
stripe_payment_link: string | null;
|
|
444
445
|
stripe_payment_link_id: string | null;
|
|
@@ -447,7 +448,6 @@ type Database = {
|
|
|
447
448
|
};
|
|
448
449
|
Insert: {
|
|
449
450
|
activity_log?: Json;
|
|
450
|
-
cached_stage?: string | null;
|
|
451
451
|
closed_lost_at?: string | null;
|
|
452
452
|
closed_lost_reason?: string | null;
|
|
453
453
|
contact_email: string;
|
|
@@ -462,6 +462,7 @@ type Database = {
|
|
|
462
462
|
organization_id: string;
|
|
463
463
|
payment_link_sent_at?: string | null;
|
|
464
464
|
payment_received_at?: string | null;
|
|
465
|
+
pipeline_key?: string;
|
|
465
466
|
proposal_data?: Json | null;
|
|
466
467
|
proposal_generated_at?: string | null;
|
|
467
468
|
proposal_pdf_url?: string | null;
|
|
@@ -469,10 +470,11 @@ type Database = {
|
|
|
469
470
|
proposal_reviewed_by?: string | null;
|
|
470
471
|
proposal_sent_at?: string | null;
|
|
471
472
|
proposal_signed_at?: string | null;
|
|
472
|
-
proposal_status?: string | null;
|
|
473
473
|
signature_envelope_id?: string | null;
|
|
474
474
|
source_list_id?: string | null;
|
|
475
475
|
source_type?: string | null;
|
|
476
|
+
stage_key?: string | null;
|
|
477
|
+
state_key?: string | null;
|
|
476
478
|
stripe_payment_id?: string | null;
|
|
477
479
|
stripe_payment_link?: string | null;
|
|
478
480
|
stripe_payment_link_id?: string | null;
|
|
@@ -481,7 +483,6 @@ type Database = {
|
|
|
481
483
|
};
|
|
482
484
|
Update: {
|
|
483
485
|
activity_log?: Json;
|
|
484
|
-
cached_stage?: string | null;
|
|
485
486
|
closed_lost_at?: string | null;
|
|
486
487
|
closed_lost_reason?: string | null;
|
|
487
488
|
contact_email?: string;
|
|
@@ -496,6 +497,7 @@ type Database = {
|
|
|
496
497
|
organization_id?: string;
|
|
497
498
|
payment_link_sent_at?: string | null;
|
|
498
499
|
payment_received_at?: string | null;
|
|
500
|
+
pipeline_key?: string;
|
|
499
501
|
proposal_data?: Json | null;
|
|
500
502
|
proposal_generated_at?: string | null;
|
|
501
503
|
proposal_pdf_url?: string | null;
|
|
@@ -503,10 +505,11 @@ type Database = {
|
|
|
503
505
|
proposal_reviewed_by?: string | null;
|
|
504
506
|
proposal_sent_at?: string | null;
|
|
505
507
|
proposal_signed_at?: string | null;
|
|
506
|
-
proposal_status?: string | null;
|
|
507
508
|
signature_envelope_id?: string | null;
|
|
508
509
|
source_list_id?: string | null;
|
|
509
510
|
source_type?: string | null;
|
|
511
|
+
stage_key?: string | null;
|
|
512
|
+
state_key?: string | null;
|
|
510
513
|
stripe_payment_id?: string | null;
|
|
511
514
|
stripe_payment_link?: string | null;
|
|
512
515
|
stripe_payment_link_id?: string | null;
|
|
@@ -2623,7 +2626,8 @@ type Database = {
|
|
|
2623
2626
|
created_at: string;
|
|
2624
2627
|
description: string | null;
|
|
2625
2628
|
id: string;
|
|
2626
|
-
|
|
2629
|
+
key_hash: string;
|
|
2630
|
+
key_prefix: string | null;
|
|
2627
2631
|
last_triggered_at: string | null;
|
|
2628
2632
|
name: string;
|
|
2629
2633
|
organization_id: string;
|
|
@@ -2636,7 +2640,8 @@ type Database = {
|
|
|
2636
2640
|
created_at?: string;
|
|
2637
2641
|
description?: string | null;
|
|
2638
2642
|
id?: string;
|
|
2639
|
-
|
|
2643
|
+
key_hash: string;
|
|
2644
|
+
key_prefix?: string | null;
|
|
2640
2645
|
last_triggered_at?: string | null;
|
|
2641
2646
|
name: string;
|
|
2642
2647
|
organization_id: string;
|
|
@@ -2649,7 +2654,8 @@ type Database = {
|
|
|
2649
2654
|
created_at?: string;
|
|
2650
2655
|
description?: string | null;
|
|
2651
2656
|
id?: string;
|
|
2652
|
-
|
|
2657
|
+
key_hash?: string;
|
|
2658
|
+
key_prefix?: string | null;
|
|
2653
2659
|
last_triggered_at?: string | null;
|
|
2654
2660
|
name?: string;
|
|
2655
2661
|
organization_id?: string;
|
|
@@ -2731,6 +2737,10 @@ type Database = {
|
|
|
2731
2737
|
user_id: string;
|
|
2732
2738
|
}[];
|
|
2733
2739
|
};
|
|
2740
|
+
get_platform_credential_kek: {
|
|
2741
|
+
Args: never;
|
|
2742
|
+
Returns: string;
|
|
2743
|
+
};
|
|
2734
2744
|
get_storage_org_id: {
|
|
2735
2745
|
Args: {
|
|
2736
2746
|
file_path: string;
|
|
@@ -2748,12 +2758,6 @@ type Database = {
|
|
|
2748
2758
|
};
|
|
2749
2759
|
Returns: boolean;
|
|
2750
2760
|
};
|
|
2751
|
-
is_org_admin: {
|
|
2752
|
-
Args: {
|
|
2753
|
-
org_id: string;
|
|
2754
|
-
};
|
|
2755
|
-
Returns: boolean;
|
|
2756
|
-
};
|
|
2757
2761
|
is_org_member: {
|
|
2758
2762
|
Args: {
|
|
2759
2763
|
org_id: string;
|
|
@@ -2908,6 +2912,14 @@ declare class RLSTestContext {
|
|
|
2908
2912
|
* Create an organization membership
|
|
2909
2913
|
*/
|
|
2910
2914
|
createMembership(userId: string, organizationId: string, role: Role): Promise<Membership>;
|
|
2915
|
+
/**
|
|
2916
|
+
* Assign a system role to a membership via org_rol_assignments.
|
|
2917
|
+
* After the 2026-04-25 auth refactor, RLS policies read `effective_permissions[]`
|
|
2918
|
+
* (materialized by trigger from org_rol_assignments → org_rol_grants).
|
|
2919
|
+
* Without this assignment, role_slug is informational only and the membership
|
|
2920
|
+
* has zero permissions, causing all has_org_permission() checks to deny.
|
|
2921
|
+
*/
|
|
2922
|
+
private assignSystemRole;
|
|
2911
2923
|
/**
|
|
2912
2924
|
* Create a pre-provisioned organization membership (without WorkOS membership ID)
|
|
2913
2925
|
* Used for testing invitation flows where memberships are created before user accepts
|
package/dist/test-utils/index.js
CHANGED
|
@@ -1991,6 +1991,7 @@ var RLSTestContext = class {
|
|
|
1991
1991
|
throw new Error(`Failed to create membership: ${error.message}`);
|
|
1992
1992
|
}
|
|
1993
1993
|
this.createdIds.memberships.push(data.id);
|
|
1994
|
+
await this.assignSystemRole(data.id, role);
|
|
1994
1995
|
return {
|
|
1995
1996
|
id: data.id,
|
|
1996
1997
|
user_id: data.user_id,
|
|
@@ -1998,6 +1999,23 @@ var RLSTestContext = class {
|
|
|
1998
1999
|
role_slug: data.role_slug
|
|
1999
2000
|
};
|
|
2000
2001
|
}
|
|
2002
|
+
/**
|
|
2003
|
+
* Assign a system role to a membership via org_rol_assignments.
|
|
2004
|
+
* After the 2026-04-25 auth refactor, RLS policies read `effective_permissions[]`
|
|
2005
|
+
* (materialized by trigger from org_rol_assignments → org_rol_grants).
|
|
2006
|
+
* Without this assignment, role_slug is informational only and the membership
|
|
2007
|
+
* has zero permissions, causing all has_org_permission() checks to deny.
|
|
2008
|
+
*/
|
|
2009
|
+
async assignSystemRole(membershipId, slug) {
|
|
2010
|
+
const { data: roleDef, error: roleErr } = await this.adminClient.from("org_rol_definitions").select("id").is("organization_id", null).eq("slug", slug).single();
|
|
2011
|
+
if (roleErr || !roleDef) {
|
|
2012
|
+
throw new Error(`Failed to look up system role '${slug}': ${roleErr?.message ?? "not found"}`);
|
|
2013
|
+
}
|
|
2014
|
+
const { error: assignErr } = await this.adminClient.from("org_rol_assignments").insert({ membership_id: membershipId, role_id: roleDef.id });
|
|
2015
|
+
if (assignErr) {
|
|
2016
|
+
throw new Error(`Failed to assign system role '${slug}' to membership: ${assignErr.message}`);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2001
2019
|
/**
|
|
2002
2020
|
* Create a pre-provisioned organization membership (without WorkOS membership ID)
|
|
2003
2021
|
* Used for testing invitation flows where memberships are created before user accepts
|
|
@@ -2016,6 +2034,7 @@ var RLSTestContext = class {
|
|
|
2016
2034
|
throw new Error(`Failed to create pre-provisioned membership: ${error.message}`);
|
|
2017
2035
|
}
|
|
2018
2036
|
this.createdIds.memberships.push(data.id);
|
|
2037
|
+
await this.assignSystemRole(data.id, role);
|
|
2019
2038
|
return {
|
|
2020
2039
|
id: data.id,
|
|
2021
2040
|
user_id: data.user_id,
|
|
@@ -20318,6 +20337,12 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
20318
20337
|
enabled: true,
|
|
20319
20338
|
path: "/settings/appearance"
|
|
20320
20339
|
},
|
|
20340
|
+
{
|
|
20341
|
+
id: "settings.roles",
|
|
20342
|
+
label: "My Roles",
|
|
20343
|
+
enabled: true,
|
|
20344
|
+
path: "/settings/roles"
|
|
20345
|
+
},
|
|
20321
20346
|
{
|
|
20322
20347
|
id: "settings.organization",
|
|
20323
20348
|
label: "Organization",
|