@elevasis/core 0.11.1 → 0.12.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.
Files changed (38) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.js +10 -11
  3. package/dist/organization-model/index.d.ts +2 -2
  4. package/dist/organization-model/index.js +10 -11
  5. package/dist/test-utils/index.d.ts +10 -3
  6. package/dist/test-utils/index.js +6 -6
  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 +27 -270
  10. package/src/auth/multi-tenancy/credentials/server/encryption.ts +83 -39
  11. package/src/auth/multi-tenancy/credentials/server/kek-loader.ts +47 -0
  12. package/src/auth/multi-tenancy/index.ts +3 -0
  13. package/src/auth/multi-tenancy/invitations/api-schemas.ts +104 -107
  14. package/src/auth/multi-tenancy/memberships/api-schemas.ts +6 -5
  15. package/src/auth/multi-tenancy/memberships/membership.ts +130 -138
  16. package/src/auth/multi-tenancy/role-management/api-schemas.ts +78 -0
  17. package/src/auth/multi-tenancy/role-management/index.ts +16 -0
  18. package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +299 -293
  19. package/src/execution/engine/tools/integration/service.test.ts +214 -0
  20. package/src/execution/engine/tools/integration/service.ts +169 -161
  21. package/src/integrations/credentials/__tests__/api-schemas.test.ts +420 -496
  22. package/src/integrations/credentials/api-schemas.ts +127 -143
  23. package/src/integrations/webhook-endpoints/__tests__/api-schemas.test.ts +327 -318
  24. package/src/integrations/webhook-endpoints/api-schemas.ts +103 -102
  25. package/src/integrations/webhook-endpoints/types.ts +58 -51
  26. package/src/operations/activities/api-schemas.ts +80 -79
  27. package/src/operations/activities/types.ts +64 -63
  28. package/src/organization-model/contracts.ts +1 -1
  29. package/src/organization-model/defaults.ts +6 -6
  30. package/src/organization-model/domains/navigation.ts +38 -37
  31. package/src/organization-model/foundation.ts +2 -3
  32. package/src/organization-model/published.ts +3 -3
  33. package/src/platform/constants/versions.ts +1 -1
  34. package/src/reference/_generated/contracts.md +27 -270
  35. package/src/scaffold-registry/__tests__/index.test.ts +72 -7
  36. package/src/scaffold-registry/index.ts +159 -26
  37. package/src/server.ts +281 -272
  38. package/src/supabase/database.types.ts +7 -3
@@ -1,102 +1,103 @@
1
- import { z } from 'zod'
2
- import { UuidSchema, NonEmptyStringSchema, PaginationSchema } from '../../platform/utils/validation'
3
-
4
- /**
5
- * Webhook Endpoint API Validation Schemas
6
- *
7
- * HTTP request/response validation for the webhook endpoints CRUD API.
8
- * These schemas are browser-safe and shared between API and frontend.
9
- *
10
- * Design notes:
11
- * - Request schemas use `.strict()` to reject unknown fields (mass assignment prevention)
12
- * - Response schemas do NOT use `.strict()` (allows forward-compatible additions)
13
- * - Update schema requires at least one field via `.refine()`
14
- */
15
-
16
- /**
17
- * Status enum for webhook endpoints
18
- */
19
- export const WebhookEndpointStatusSchema = z.enum(['active', 'paused'])
20
-
21
- /**
22
- * POST /api/webhook-endpoints - Create a new webhook endpoint
23
- *
24
- * The `key` and `id` are generated server-side and not accepted in the request.
25
- */
26
- export const CreateWebhookEndpointRequestSchema = z
27
- .object({
28
- /** User-facing label for the endpoint */
29
- name: NonEmptyStringSchema,
30
- /** Target workflow resourceId to invoke on inbound requests (can be set later) */
31
- resourceId: NonEmptyStringSchema.optional(),
32
- /** Optional description */
33
- description: z.string().optional()
34
- })
35
- .strict()
36
-
37
- export type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>
38
-
39
- /**
40
- * PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
41
- *
42
- * At least one field must be provided.
43
- */
44
- export const UpdateWebhookEndpointRequestSchema = z
45
- .object({
46
- name: NonEmptyStringSchema.optional(),
47
- description: z.string().optional(),
48
- resourceId: NonEmptyStringSchema.optional(),
49
- status: WebhookEndpointStatusSchema.optional()
50
- })
51
- .strict()
52
- .refine(
53
- (data) =>
54
- data.name !== undefined ||
55
- data.description !== undefined ||
56
- data.resourceId !== undefined ||
57
- data.status !== undefined,
58
- { message: 'At least one field (name, description, resourceId, or status) must be provided' }
59
- )
60
-
61
- export type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>
62
-
63
- /**
64
- * Response shape for a single webhook endpoint.
65
- * NOT strict — response schemas allow extra fields for forward compatibility.
66
- */
67
- export const WebhookEndpointResponseSchema = z.object({
68
- id: UuidSchema,
69
- organizationId: UuidSchema,
70
- key: z.string(),
71
- name: z.string(),
72
- description: z.string().nullable(),
73
- resourceId: z.string().nullable(),
74
- status: WebhookEndpointStatusSchema,
75
- lastTriggeredAt: z.string().datetime().nullable(),
76
- requestCount: z.number().int().min(0),
77
- createdAt: z.string().datetime(),
78
- updatedAt: z.string().datetime()
79
- })
80
-
81
- export type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>
82
-
83
- /**
84
- * GET /api/webhook-endpoints - List webhook endpoints query params
85
- *
86
- * Extends standard pagination with optional status filter.
87
- */
88
- export const ListWebhookEndpointsQuerySchema = PaginationSchema.extend({
89
- status: WebhookEndpointStatusSchema.optional()
90
- })
91
-
92
- export type ListWebhookEndpointsQuery = z.infer<typeof ListWebhookEndpointsQuerySchema>
93
-
94
- /**
95
- * Named collection of all webhook endpoint schemas for route registration
96
- */
97
- export const WebhookEndpointSchemas = {
98
- CreateRequest: CreateWebhookEndpointRequestSchema,
99
- UpdateRequest: UpdateWebhookEndpointRequestSchema,
100
- Response: WebhookEndpointResponseSchema,
101
- ListQuery: ListWebhookEndpointsQuerySchema
102
- }
1
+ import { z } from 'zod'
2
+ import { UuidSchema, NonEmptyStringSchema, PaginationSchema } from '../../platform/utils/validation'
3
+
4
+ /**
5
+ * Webhook Endpoint API Validation Schemas
6
+ *
7
+ * HTTP request/response validation for the webhook endpoints CRUD API.
8
+ * These schemas are browser-safe and shared between API and frontend.
9
+ *
10
+ * Design notes:
11
+ * - Request schemas use `.strict()` to reject unknown fields (mass assignment prevention)
12
+ * - Response schemas do NOT use `.strict()` (allows forward-compatible additions)
13
+ * - Update schema requires at least one field via `.refine()`
14
+ */
15
+
16
+ /**
17
+ * Status enum for webhook endpoints
18
+ */
19
+ export const WebhookEndpointStatusSchema = z.enum(['active', 'paused'])
20
+
21
+ /**
22
+ * POST /api/webhook-endpoints - Create a new webhook endpoint
23
+ *
24
+ * The `key` and `id` are generated server-side and not accepted in the request.
25
+ */
26
+ export const CreateWebhookEndpointRequestSchema = z
27
+ .object({
28
+ /** User-facing label for the endpoint */
29
+ name: NonEmptyStringSchema,
30
+ /** Target workflow resourceId to invoke on inbound requests (can be set later) */
31
+ resourceId: NonEmptyStringSchema.optional(),
32
+ /** Optional description */
33
+ description: z.string().optional()
34
+ })
35
+ .strict()
36
+
37
+ export type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>
38
+
39
+ /**
40
+ * PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
41
+ *
42
+ * At least one field must be provided.
43
+ */
44
+ export const UpdateWebhookEndpointRequestSchema = z
45
+ .object({
46
+ name: NonEmptyStringSchema.optional(),
47
+ description: z.string().optional(),
48
+ resourceId: NonEmptyStringSchema.optional(),
49
+ status: WebhookEndpointStatusSchema.optional()
50
+ })
51
+ .strict()
52
+ .refine(
53
+ (data) =>
54
+ data.name !== undefined ||
55
+ data.description !== undefined ||
56
+ data.resourceId !== undefined ||
57
+ data.status !== undefined,
58
+ { message: 'At least one field (name, description, resourceId, or status) must be provided' }
59
+ )
60
+
61
+ export type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>
62
+
63
+ /**
64
+ * Response shape for a single webhook endpoint.
65
+ * NOT strict — response schemas allow extra fields for forward compatibility.
66
+ */
67
+ export const WebhookEndpointResponseSchema = z.object({
68
+ id: UuidSchema,
69
+ organizationId: UuidSchema,
70
+ key: z.string().optional(),
71
+ keyPrefix: z.string().nullable(),
72
+ name: z.string(),
73
+ description: z.string().nullable(),
74
+ resourceId: z.string().nullable(),
75
+ status: WebhookEndpointStatusSchema,
76
+ lastTriggeredAt: z.string().datetime().nullable(),
77
+ requestCount: z.number().int().min(0),
78
+ createdAt: z.string().datetime(),
79
+ updatedAt: z.string().datetime()
80
+ })
81
+
82
+ export type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>
83
+
84
+ /**
85
+ * GET /api/webhook-endpoints - List webhook endpoints query params
86
+ *
87
+ * Extends standard pagination with optional status filter.
88
+ */
89
+ export const ListWebhookEndpointsQuerySchema = PaginationSchema.extend({
90
+ status: WebhookEndpointStatusSchema.optional()
91
+ })
92
+
93
+ export type ListWebhookEndpointsQuery = z.infer<typeof ListWebhookEndpointsQuerySchema>
94
+
95
+ /**
96
+ * Named collection of all webhook endpoint schemas for route registration
97
+ */
98
+ export const WebhookEndpointSchemas = {
99
+ CreateRequest: CreateWebhookEndpointRequestSchema,
100
+ UpdateRequest: UpdateWebhookEndpointRequestSchema,
101
+ Response: WebhookEndpointResponseSchema,
102
+ ListQuery: ListWebhookEndpointsQuerySchema
103
+ }
@@ -1,51 +1,58 @@
1
- /**
2
- * Webhook Endpoint Domain Types
3
- *
4
- * Browser-safe domain types for generic inbound webhook endpoints.
5
- * These are camelCase representations of the `webhook_endpoints` DB table.
6
- *
7
- * Transform from snake_case DB rows happens in the API service layer,
8
- * not here (per core-package.md conventions).
9
- */
10
-
11
- /**
12
- * Lifecycle status of a webhook endpoint.
13
- * - `active`: Endpoint accepts inbound requests and triggers the target workflow
14
- * - `paused`: Endpoint exists but rejects inbound requests with 404
15
- */
16
- export type WebhookEndpointStatus = 'active' | 'paused'
17
-
18
- /**
19
- * Generic inbound webhook endpoint domain type.
20
- *
21
- * Each endpoint gets a unique opaque URL (`/api/webhooks/inbound/:key`)
22
- * that maps to a target workflow resource within an organization.
23
- */
24
- export interface WebhookEndpoint {
25
- /** UUID primary key */
26
- id: string
27
- /** Organization this endpoint belongs to */
28
- organizationId: string
29
- /**
30
- * Unique opaque key used in the inbound URL.
31
- * Format: `wh_` + 32 crypto-random hex chars (128 bits of entropy).
32
- * This key IS the credential — it must be kept secret.
33
- */
34
- key: string
35
- /** User-facing label (e.g., "Zapier → Lead Intake") */
36
- name: string
37
- /** Optional description for the endpoint */
38
- description: string | null
39
- /** Target workflow resourceId to invoke on inbound request, or null if not yet assigned */
40
- resourceId: string | null
41
- /** Whether the endpoint is accepting requests */
42
- status: WebhookEndpointStatus
43
- /** Timestamp of the most recent successful inbound request, or null */
44
- lastTriggeredAt: string | null
45
- /** Running total of inbound requests received */
46
- requestCount: number
47
- /** ISO 8601 creation timestamp */
48
- createdAt: string
49
- /** ISO 8601 last-updated timestamp */
50
- updatedAt: string
51
- }
1
+ /**
2
+ * Webhook Endpoint Domain Types
3
+ *
4
+ * Browser-safe domain types for generic inbound webhook endpoints.
5
+ * These are camelCase representations of the `webhook_endpoints` DB table.
6
+ *
7
+ * Transform from snake_case DB rows happens in the API service layer,
8
+ * not here (per core-package.md conventions).
9
+ */
10
+
11
+ /**
12
+ * Lifecycle status of a webhook endpoint.
13
+ * - `active`: Endpoint accepts inbound requests and triggers the target workflow
14
+ * - `paused`: Endpoint exists but rejects inbound requests with 404
15
+ */
16
+ export type WebhookEndpointStatus = 'active' | 'paused'
17
+
18
+ /**
19
+ * Generic inbound webhook endpoint domain type.
20
+ *
21
+ * Each endpoint gets a unique opaque URL (`/api/webhooks/inbound/:key`)
22
+ * that maps to a target workflow resource within an organization.
23
+ */
24
+ export interface WebhookEndpoint {
25
+ /** UUID primary key */
26
+ id: string
27
+ /** Organization this endpoint belongs to */
28
+ organizationId: string
29
+ /**
30
+ * Unique opaque key used in the inbound URL.
31
+ * Format: `wh_` + 32 crypto-random hex chars (128 bits of entropy).
32
+ * This key IS the credential — it must be kept secret.
33
+ * Set ONLY on the return value of `create()` — undefined on list/get/getEndpointByKey responses.
34
+ */
35
+ key?: string
36
+ /**
37
+ * First 8 characters of the plaintext key for display and grep hints.
38
+ * Safe to show in list views — not sufficient to reconstruct the full key.
39
+ * Null on legacy rows that predate the key_hash migration.
40
+ */
41
+ keyPrefix: string | null
42
+ /** User-facing label (e.g., "Zapier → Lead Intake") */
43
+ name: string
44
+ /** Optional description for the endpoint */
45
+ description: string | null
46
+ /** Target workflow resourceId to invoke on inbound request, or null if not yet assigned */
47
+ resourceId: string | null
48
+ /** Whether the endpoint is accepting requests */
49
+ status: WebhookEndpointStatus
50
+ /** Timestamp of the most recent successful inbound request, or null */
51
+ lastTriggeredAt: string | null
52
+ /** Running total of inbound requests received */
53
+ requestCount: number
54
+ /** ISO 8601 creation timestamp */
55
+ createdAt: string
56
+ /** ISO 8601 last-updated timestamp */
57
+ updatedAt: string
58
+ }
@@ -1,79 +1,80 @@
1
- import { z } from 'zod'
2
- import { NonEmptyStringSchema } from '../../platform/utils/validation'
3
-
4
- /**
5
- * Activity Log API Validation Schemas
6
- *
7
- * Zod schemas for Activity Log endpoints with security controls:
8
- * - Mass assignment prevention (.strict() mode)
9
- * - Size limits (title: 200 chars, description: 1000 chars)
10
- * - Enum validation (activityType, status)
11
- * - Metadata size limits (50KB)
12
- */
13
-
14
- // Activity type enum
15
- export const ActivityTypeSchema = z.enum([
16
- 'workflow_execution',
17
- 'agent_run',
18
- 'hitl_action',
19
- 'webhook_received',
20
- 'webhook_executed',
21
- 'webhook_failed',
22
- 'credential_change',
23
- 'api_key_change',
24
- 'deployment_change',
25
- 'membership_change'
26
- ])
27
-
28
- // Activity status enum
29
- export const ActivityStatusSchema = z.enum(['success', 'failure', 'pending', 'approved', 'rejected', 'completed'])
30
-
31
- // Metadata schema with size limit (50KB)
32
- const MetadataSchema = z
33
- .record(z.string(), z.unknown())
34
- .refine((val) => JSON.stringify(val).length <= 50_000, 'Metadata exceeds 50KB limit')
35
- .optional()
36
-
37
- // POST /api/activities - Create activity
38
- export const CreateActivitySchema = z
39
- .object({
40
- activityType: ActivityTypeSchema,
41
- status: ActivityStatusSchema,
42
- title: NonEmptyStringSchema.max(200),
43
- description: z.string().max(1000).optional(),
44
- entityType: NonEmptyStringSchema.max(100),
45
- entityId: NonEmptyStringSchema.max(255),
46
- entityName: z.string().max(255).optional(),
47
- metadata: MetadataSchema,
48
- occurredAt: z.string().datetime().optional(),
49
- actorId: z.string().uuid().optional(),
50
- actorType: z.enum(['user', 'system', 'api_key']).optional()
51
- // NO organizationId (always from JWT/API key context)
52
- })
53
- .strict()
54
-
55
- // GET /api/activities/trend - Activity trend timestamps query params
56
- export const ActivityTrendQuerySchema = z
57
- .object({
58
- activityType: ActivityTypeSchema.optional(),
59
- entityType: z.string().max(100).optional(),
60
- entityId: z.string().max(255).optional(),
61
- startDate: z.string().datetime().optional(),
62
- endDate: z.string().datetime().optional()
63
- })
64
- .strict()
65
-
66
- // GET /api/activities - List activities query params
67
- export const ListActivitiesQuerySchema = z
68
- .object({
69
- limit: z.coerce.number().int().min(1).max(100).default(50),
70
- offset: z.coerce.number().int().min(0).default(0),
71
- activityType: ActivityTypeSchema.optional(),
72
- entityType: z.string().max(100).optional(),
73
- entityId: z.string().max(255).optional(),
74
- startDate: z.string().datetime().optional(),
75
- endDate: z.string().datetime().optional(),
76
- status: ActivityStatusSchema.optional(),
77
- search: z.string().max(200).optional()
78
- })
79
- .strict()
1
+ import { z } from 'zod'
2
+ import { NonEmptyStringSchema } from '../../platform/utils/validation'
3
+
4
+ /**
5
+ * Activity Log API Validation Schemas
6
+ *
7
+ * Zod schemas for Activity Log endpoints with security controls:
8
+ * - Mass assignment prevention (.strict() mode)
9
+ * - Size limits (title: 200 chars, description: 1000 chars)
10
+ * - Enum validation (activityType, status)
11
+ * - Metadata size limits (50KB)
12
+ */
13
+
14
+ // Activity type enum
15
+ export const ActivityTypeSchema = z.enum([
16
+ 'workflow_execution',
17
+ 'agent_run',
18
+ 'hitl_action',
19
+ 'webhook_received',
20
+ 'webhook_executed',
21
+ 'webhook_failed',
22
+ 'credential_change',
23
+ 'credential_read',
24
+ 'api_key_change',
25
+ 'deployment_change',
26
+ 'membership_change'
27
+ ])
28
+
29
+ // Activity status enum
30
+ export const ActivityStatusSchema = z.enum(['success', 'failure', 'pending', 'approved', 'rejected', 'completed'])
31
+
32
+ // Metadata schema with size limit (50KB)
33
+ const MetadataSchema = z
34
+ .record(z.string(), z.unknown())
35
+ .refine((val) => JSON.stringify(val).length <= 50_000, 'Metadata exceeds 50KB limit')
36
+ .optional()
37
+
38
+ // POST /api/activities - Create activity
39
+ export const CreateActivitySchema = z
40
+ .object({
41
+ activityType: ActivityTypeSchema,
42
+ status: ActivityStatusSchema,
43
+ title: NonEmptyStringSchema.max(200),
44
+ description: z.string().max(1000).optional(),
45
+ entityType: NonEmptyStringSchema.max(100),
46
+ entityId: NonEmptyStringSchema.max(255),
47
+ entityName: z.string().max(255).optional(),
48
+ metadata: MetadataSchema,
49
+ occurredAt: z.string().datetime().optional(),
50
+ actorId: z.string().uuid().optional(),
51
+ actorType: z.enum(['user', 'system', 'api_key']).optional()
52
+ // NO organizationId (always from JWT/API key context)
53
+ })
54
+ .strict()
55
+
56
+ // GET /api/activities/trend - Activity trend timestamps query params
57
+ export const ActivityTrendQuerySchema = z
58
+ .object({
59
+ activityType: ActivityTypeSchema.optional(),
60
+ entityType: z.string().max(100).optional(),
61
+ entityId: z.string().max(255).optional(),
62
+ startDate: z.string().datetime().optional(),
63
+ endDate: z.string().datetime().optional()
64
+ })
65
+ .strict()
66
+
67
+ // GET /api/activities - List activities query params
68
+ export const ListActivitiesQuerySchema = z
69
+ .object({
70
+ limit: z.coerce.number().int().min(1).max(100).default(50),
71
+ offset: z.coerce.number().int().min(0).default(0),
72
+ activityType: ActivityTypeSchema.optional(),
73
+ entityType: z.string().max(100).optional(),
74
+ entityId: z.string().max(255).optional(),
75
+ startDate: z.string().datetime().optional(),
76
+ endDate: z.string().datetime().optional(),
77
+ status: ActivityStatusSchema.optional(),
78
+ search: z.string().max(200).optional()
79
+ })
80
+ .strict()
@@ -1,63 +1,64 @@
1
- import type { Database } from '../../supabase/database.types'
2
-
3
- export type ActivityRow = Database['public']['Tables']['activities']['Row']
4
- export type ActivityInsert = Database['public']['Tables']['activities']['Insert']
5
-
6
- export type ActivityType =
7
- | 'workflow_execution'
8
- | 'agent_run'
9
- | 'hitl_action'
10
- | 'webhook_received'
11
- | 'webhook_executed'
12
- | 'webhook_failed'
13
- | 'credential_change'
14
- | 'api_key_change'
15
- | 'deployment_change'
16
- | 'membership_change'
17
-
18
- export type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed'
19
-
20
- export interface Activity {
21
- id: string
22
- organizationId: string
23
- activityType: ActivityType
24
- status: ActivityStatus
25
- title: string
26
- description: string | null
27
- entityType: string
28
- entityId: string
29
- entityName: string | null
30
- metadata: Record<string, unknown> | null
31
- actorId: string | null
32
- actorType: string | null
33
- occurredAt: Date
34
- createdAt: Date
35
- }
36
-
37
- export interface CreateActivityParams {
38
- organizationId: string
39
- activityType: ActivityType
40
- status: ActivityStatus
41
- title: string
42
- description?: string
43
- entityType: string
44
- entityId: string
45
- entityName?: string
46
- metadata?: Record<string, unknown>
47
- actorId?: string
48
- actorType?: string
49
- occurredAt?: Date
50
- }
51
-
52
- export interface ListActivitiesParams {
53
- organizationId: string
54
- limit?: number
55
- offset?: number
56
- activityType?: ActivityType
57
- entityType?: string
58
- entityId?: string
59
- startDate?: string
60
- endDate?: string
61
- status?: string
62
- search?: string
63
- }
1
+ import type { Database } from '../../supabase/database.types'
2
+
3
+ export type ActivityRow = Database['public']['Tables']['activities']['Row']
4
+ export type ActivityInsert = Database['public']['Tables']['activities']['Insert']
5
+
6
+ export type ActivityType =
7
+ | 'workflow_execution'
8
+ | 'agent_run'
9
+ | 'hitl_action'
10
+ | 'webhook_received'
11
+ | 'webhook_executed'
12
+ | 'webhook_failed'
13
+ | 'credential_change'
14
+ | 'credential_read'
15
+ | 'api_key_change'
16
+ | 'deployment_change'
17
+ | 'membership_change'
18
+
19
+ export type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed'
20
+
21
+ export interface Activity {
22
+ id: string
23
+ organizationId: string
24
+ activityType: ActivityType
25
+ status: ActivityStatus
26
+ title: string
27
+ description: string | null
28
+ entityType: string
29
+ entityId: string
30
+ entityName: string | null
31
+ metadata: Record<string, unknown> | null
32
+ actorId: string | null
33
+ actorType: string | null
34
+ occurredAt: Date
35
+ createdAt: Date
36
+ }
37
+
38
+ export interface CreateActivityParams {
39
+ organizationId: string
40
+ activityType: ActivityType
41
+ status: ActivityStatus
42
+ title: string
43
+ description?: string
44
+ entityType: string
45
+ entityId: string
46
+ entityName?: string
47
+ metadata?: Record<string, unknown>
48
+ actorId?: string
49
+ actorType?: string
50
+ occurredAt?: Date
51
+ }
52
+
53
+ export interface ListActivitiesParams {
54
+ organizationId: string
55
+ limit?: number
56
+ offset?: number
57
+ activityType?: ActivityType
58
+ entityType?: string
59
+ entityId?: string
60
+ startDate?: string
61
+ endDate?: string
62
+ status?: string
63
+ search?: string
64
+ }
@@ -11,5 +11,5 @@ export const SEO_FEATURE_ID = 'seo' as const
11
11
 
12
12
  export const SALES_PIPELINE_SURFACE_ID = 'crm.pipeline' as const
13
13
  export const PROSPECTING_LISTS_SURFACE_ID = 'lead-gen.lists' as const
14
- export const OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID = 'operations.organization-graph' as const
15
14
  export const OPERATIONS_COMMAND_VIEW_SURFACE_ID = 'operations.command-view' as const
15
+ export const SETTINGS_ROLES_SURFACE_ID = 'settings.roles' as const
@@ -68,12 +68,6 @@ export const DEFAULT_ORGANIZATION_MODEL: OrganizationModel = {
68
68
  icon: 'operations',
69
69
  uiPosition: 'sidebar-primary'
70
70
  },
71
- {
72
- id: 'operations.graph',
73
- label: 'Organization Graph',
74
- enabled: true,
75
- path: '/operations/organization-graph'
76
- },
77
71
  {
78
72
  id: 'operations.command-view',
79
73
  label: 'Command View',
@@ -172,6 +166,12 @@ export const DEFAULT_ORGANIZATION_MODEL: OrganizationModel = {
172
166
  enabled: true,
173
167
  path: '/settings/appearance'
174
168
  },
169
+ {
170
+ id: 'settings.roles',
171
+ label: 'My Roles',
172
+ enabled: true,
173
+ path: '/settings/roles'
174
+ },
175
175
  {
176
176
  id: 'settings.organization',
177
177
  label: 'Organization',