@elevasis/core 0.15.1 → 0.16.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 +1662 -23
- package/dist/index.js +171 -24
- package/dist/organization-model/index.d.ts +1662 -23
- package/dist/organization-model/index.js +171 -24
- package/dist/test-utils/index.d.ts +711 -10
- package/dist/test-utils/index.js +159 -16
- package/package.json +7 -3
- package/src/__tests__/publish.test.ts +14 -13
- package/src/__tests__/template-core-compatibility.test.ts +4 -4
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +305 -201
- package/src/auth/multi-tenancy/index.ts +3 -0
- package/src/auth/multi-tenancy/theme-presets.ts +45 -0
- package/src/auth/multi-tenancy/types.ts +57 -83
- package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
- package/src/business/acquisition/activity-events.ts +1 -1
- package/src/business/acquisition/api-schemas.ts +1196 -1177
- package/src/business/acquisition/crm-state-actions.test.ts +139 -139
- package/src/business/acquisition/types.ts +381 -390
- package/src/business/crm/api-schemas.ts +40 -0
- package/src/business/crm/index.ts +1 -0
- package/src/business/deals/api-schemas.ts +79 -0
- package/src/business/deals/index.ts +1 -0
- package/src/business/projects/types.ts +124 -88
- package/src/execution/core/runner-types.ts +61 -80
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
- package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
- package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
- package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
- package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
- package/src/execution/engine/tools/integration/tool.ts +255 -253
- package/src/execution/engine/tools/lead-service-types.ts +895 -894
- package/src/execution/engine/tools/messages.ts +43 -0
- package/src/execution/engine/tools/platform/acquisition/types.ts +2 -1
- package/src/execution/engine/tools/platform/email/types.ts +97 -96
- package/src/execution/engine/tools/types.ts +234 -233
- package/src/execution/engine/workflow/types.ts +195 -193
- package/src/execution/external/api-schemas.ts +40 -0
- package/src/execution/external/index.ts +1 -0
- package/src/knowledge/README.md +32 -0
- package/src/knowledge/__tests__/queries.test.ts +504 -0
- package/src/knowledge/format.ts +99 -0
- package/src/knowledge/index.ts +5 -0
- package/src/knowledge/queries.ts +256 -0
- package/src/organization-model/__tests__/defaults.test.ts +172 -172
- package/src/organization-model/__tests__/foundation.test.ts +7 -7
- package/src/organization-model/__tests__/icons.test.ts +27 -0
- package/src/organization-model/__tests__/knowledge.test.ts +214 -0
- package/src/organization-model/contracts.ts +17 -15
- package/src/organization-model/defaults.ts +74 -19
- package/src/organization-model/domains/knowledge.ts +53 -0
- package/src/organization-model/domains/navigation.ts +416 -399
- package/src/organization-model/domains/shared.ts +6 -5
- package/src/organization-model/foundation.ts +10 -6
- package/src/organization-model/graph/build.ts +209 -182
- package/src/organization-model/graph/schema.ts +37 -34
- package/src/organization-model/graph/types.ts +47 -31
- package/src/organization-model/icons.ts +81 -0
- package/src/organization-model/index.ts +8 -3
- package/src/organization-model/organization-model.mdx +1 -1
- package/src/organization-model/published.ts +103 -86
- package/src/organization-model/schema.ts +90 -85
- package/src/organization-model/types.ts +40 -33
- package/src/platform/index.ts +23 -27
- package/src/platform/registry/index.ts +0 -4
- package/src/platform/registry/resource-registry.ts +0 -77
- package/src/platform/registry/serialized-types.ts +148 -219
- package/src/platform/registry/stats-types.ts +60 -60
- package/src/reference/_generated/contracts.md +1265 -1154
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Single source of truth for all active theme preset names.
|
|
5
|
+
*
|
|
6
|
+
* This is the canonical list. To add a preset:
|
|
7
|
+
* 1. Add the name here.
|
|
8
|
+
* 2. Create `packages/ui/src/theme/presets/{name}.ts` exporting `{name}Preset: ThemePreset`.
|
|
9
|
+
* 3. Add to `PRESETS` record in `packages/ui/src/theme/presets/index.ts`.
|
|
10
|
+
* 4. Add to `PresetName` union in `packages/ui/src/theme/presets/types.ts`.
|
|
11
|
+
* 5. Add a card in `apps/command-center/src/features/settings/appearance/components/AppearanceSettings.tsx`.
|
|
12
|
+
*
|
|
13
|
+
* The union type (`ThemePresetName`) and Zod enum (`ThemePresetEnum`) are derived
|
|
14
|
+
* automatically — no other files need updating.
|
|
15
|
+
*/
|
|
16
|
+
export const THEME_PRESETS = [
|
|
17
|
+
'default',
|
|
18
|
+
'tactical',
|
|
19
|
+
'regal',
|
|
20
|
+
'cyber-volt',
|
|
21
|
+
'aurora',
|
|
22
|
+
'rose-gold',
|
|
23
|
+
'midnight',
|
|
24
|
+
'titanium',
|
|
25
|
+
'canopy',
|
|
26
|
+
'slate',
|
|
27
|
+
'cyber-strike',
|
|
28
|
+
'cyber-chrome',
|
|
29
|
+
'cyber-void',
|
|
30
|
+
'nirvana',
|
|
31
|
+
'wave',
|
|
32
|
+
'synapse',
|
|
33
|
+
'cortex',
|
|
34
|
+
'helios',
|
|
35
|
+
'graphite',
|
|
36
|
+
'quarry'
|
|
37
|
+
] as const satisfies readonly string[]
|
|
38
|
+
|
|
39
|
+
export type ThemePresetName = (typeof THEME_PRESETS)[number]
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Zod enum derived from THEME_PRESETS.
|
|
43
|
+
* Use `.catch('default')` at write-path callsites to tolerate stale/unknown values.
|
|
44
|
+
*/
|
|
45
|
+
export const ThemePresetEnum = z.enum(THEME_PRESETS)
|
|
@@ -1,83 +1,57 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multi-tenancy configuration types
|
|
3
|
-
*
|
|
4
|
-
* Config is stored in dedicated `config` columns (NOT nested in metadata):
|
|
5
|
-
* - organizations.config: Org-level config (no feature toggles -- all features available by default)
|
|
6
|
-
* - org_memberships.config: Per-user-per-org feature overrides
|
|
7
|
-
* - users.config: User-global config
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
completedAt?: string // ISO date
|
|
59
|
-
role?: string
|
|
60
|
-
primaryUseCase?: string[]
|
|
61
|
-
experienceLevel?: string
|
|
62
|
-
/** Onboarding guide system state (set by checklist/tour system) */
|
|
63
|
-
guides?: {
|
|
64
|
-
completedIds?: string[] // e.g. ["explore-dashboard", "view-workflow"]
|
|
65
|
-
dismissed?: boolean // user manually dismissed checklist
|
|
66
|
-
completedAt?: string // ISO date — all guides finished
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* OrgMetadata - Contains WorkOS sync data only
|
|
73
|
-
* Note: This is kept separate from config for clarity
|
|
74
|
-
*/
|
|
75
|
-
export interface OrgMetadata {
|
|
76
|
-
domains?: {
|
|
77
|
-
verified: string[]
|
|
78
|
-
pending: string[]
|
|
79
|
-
all: string[]
|
|
80
|
-
}
|
|
81
|
-
workos_created_at?: string
|
|
82
|
-
workos_updated_at?: string
|
|
83
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Multi-tenancy configuration types
|
|
3
|
+
*
|
|
4
|
+
* Config is stored in dedicated `config` columns (NOT nested in metadata):
|
|
5
|
+
* - organizations.config: Org-level config (no feature toggles -- all features available by default)
|
|
6
|
+
* - org_memberships.config: Per-user-per-org feature overrides
|
|
7
|
+
* - users.config: User-global config
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ThemePresetName } from './theme-presets'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Per-user-per-org config (stored in org_memberships.config)
|
|
14
|
+
* Controls which features a specific member can access within their org.
|
|
15
|
+
* Keys are feature IDs from the organization model (e.g. crm, lead-gen, projects, seo).
|
|
16
|
+
*/
|
|
17
|
+
export interface MembershipFeatureConfig {
|
|
18
|
+
features?: Record<string, boolean>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* User-global config (stored in users.config)
|
|
23
|
+
* Theme and onboarding are user-specific, NOT org-specific
|
|
24
|
+
*/
|
|
25
|
+
export interface UserConfig {
|
|
26
|
+
theme?: {
|
|
27
|
+
preset?: ThemePresetName
|
|
28
|
+
colorScheme?: 'light' | 'dark' | 'auto'
|
|
29
|
+
}
|
|
30
|
+
onboarding?: {
|
|
31
|
+
completed?: boolean
|
|
32
|
+
completedAt?: string // ISO date
|
|
33
|
+
role?: string
|
|
34
|
+
primaryUseCase?: string[]
|
|
35
|
+
experienceLevel?: string
|
|
36
|
+
/** Onboarding guide system state (set by checklist/tour system) */
|
|
37
|
+
guides?: {
|
|
38
|
+
completedIds?: string[] // e.g. ["explore-dashboard", "view-workflow"]
|
|
39
|
+
dismissed?: boolean // user manually dismissed checklist
|
|
40
|
+
completedAt?: string // ISO date — all guides finished
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* OrgMetadata - Contains WorkOS sync data only
|
|
47
|
+
* Note: This is kept separate from config for clarity
|
|
48
|
+
*/
|
|
49
|
+
export interface OrgMetadata {
|
|
50
|
+
domains?: {
|
|
51
|
+
verified: string[]
|
|
52
|
+
pending: string[]
|
|
53
|
+
all: string[]
|
|
54
|
+
}
|
|
55
|
+
workos_created_at?: string
|
|
56
|
+
workos_updated_at?: string
|
|
57
|
+
}
|
|
@@ -1,194 +1,165 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Users Domain - Zod Validation Schemas
|
|
3
|
-
*
|
|
4
|
-
* Validation schemas for user management endpoints.
|
|
5
|
-
* Includes request bodies, query params, and path params.
|
|
6
|
-
*
|
|
7
|
-
* Security:
|
|
8
|
-
* - All schemas use .strict() to prevent mass assignment attacks
|
|
9
|
-
* - UUID validation prevents invalid references
|
|
10
|
-
* - Email validation prevents email injection attacks
|
|
11
|
-
* - emailVerified field excluded from create/update (admin-only)
|
|
12
|
-
* - String length limits prevent DoS
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { z } from 'zod'
|
|
16
|
-
import { EmailSchema, createStringSchema } from '../../../platform/utils/validation'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* -
|
|
53
|
-
* -
|
|
54
|
-
* -
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* -
|
|
75
|
-
* -
|
|
76
|
-
* -
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.
|
|
85
|
-
.
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// ============================================================================
|
|
159
|
-
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
* Filters:
|
|
167
|
-
* - email: Filter by email
|
|
168
|
-
* - organizationId: Filter by organization
|
|
169
|
-
* - limit: Max results (pagination handled by WorkOS)
|
|
170
|
-
*
|
|
171
|
-
* Security:
|
|
172
|
-
* - Email validated (prevents injection)
|
|
173
|
-
* - organizationId validated (UUID format)
|
|
174
|
-
*/
|
|
175
|
-
export const ListUsersQuerySchema = z
|
|
176
|
-
.object({
|
|
177
|
-
email: EmailSchema.optional(),
|
|
178
|
-
organizationId: z.string().optional(), // WorkOS org IDs can be UUID or 'org_' prefixed
|
|
179
|
-
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
180
|
-
before: z.string().optional(), // WorkOS pagination cursor
|
|
181
|
-
after: z.string().optional() // WorkOS pagination cursor
|
|
182
|
-
})
|
|
183
|
-
.strict()
|
|
184
|
-
|
|
185
|
-
// ============================================================================
|
|
186
|
-
// TypeScript Type Exports
|
|
187
|
-
// ============================================================================
|
|
188
|
-
|
|
189
|
-
// Export inferred types for use in route handlers
|
|
190
|
-
export type UpdateUserInput = z.infer<typeof UpdateUserSchema>
|
|
191
|
-
export type UpdateMyProfileInput = z.infer<typeof UpdateMyProfileSchema>
|
|
192
|
-
export type ListUsersQuery = z.infer<typeof ListUsersQuerySchema>
|
|
193
|
-
export type UserIdParam = z.infer<typeof UserIdParamSchema>
|
|
194
|
-
export type ExternalIdParam = z.infer<typeof ExternalIdParamSchema>
|
|
1
|
+
/**
|
|
2
|
+
* Users Domain - Zod Validation Schemas
|
|
3
|
+
*
|
|
4
|
+
* Validation schemas for user management endpoints.
|
|
5
|
+
* Includes request bodies, query params, and path params.
|
|
6
|
+
*
|
|
7
|
+
* Security:
|
|
8
|
+
* - All schemas use .strict() to prevent mass assignment attacks
|
|
9
|
+
* - UUID validation prevents invalid references
|
|
10
|
+
* - Email validation prevents email injection attacks
|
|
11
|
+
* - emailVerified field excluded from create/update (admin-only)
|
|
12
|
+
* - String length limits prevent DoS
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { z } from 'zod'
|
|
16
|
+
import { EmailSchema, createStringSchema } from '../../../platform/utils/validation'
|
|
17
|
+
import { ThemePresetEnum } from '../theme-presets'
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Path Parameters
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Validate user ID in URL path
|
|
25
|
+
* Used by: GET/PUT/DELETE /users/:id
|
|
26
|
+
*/
|
|
27
|
+
export const UserIdParamSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
id: z.string().min(1) // WorkOS user IDs can be UUID or 'user_' prefixed strings
|
|
30
|
+
})
|
|
31
|
+
.strict()
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Validate external ID in URL path
|
|
35
|
+
* Used by: GET /users/external/:externalId
|
|
36
|
+
*/
|
|
37
|
+
export const ExternalIdParamSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
externalId: z.string().min(1)
|
|
40
|
+
})
|
|
41
|
+
.strict()
|
|
42
|
+
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// Request Bodies
|
|
45
|
+
// ============================================================================
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Update user profile
|
|
49
|
+
* PUT /users/:id
|
|
50
|
+
*
|
|
51
|
+
* Security:
|
|
52
|
+
* - All fields optional (partial update)
|
|
53
|
+
* - Email format validated
|
|
54
|
+
* - emailVerified NOT accepted (managed by WorkOS only)
|
|
55
|
+
* - Strict mode prevents unknown field injection
|
|
56
|
+
*/
|
|
57
|
+
export const UpdateUserSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
email: EmailSchema.optional(),
|
|
60
|
+
firstName: createStringSchema(1, 100, 'First name').optional(),
|
|
61
|
+
lastName: createStringSchema(1, 100, 'Last name').optional()
|
|
62
|
+
})
|
|
63
|
+
.strict()
|
|
64
|
+
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// Self-Service Profile
|
|
67
|
+
// ============================================================================
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Self-service profile update (subset of admin UpdateUserSchema)
|
|
71
|
+
* PATCH /users/me
|
|
72
|
+
*
|
|
73
|
+
* Security:
|
|
74
|
+
* - All fields optional (partial update)
|
|
75
|
+
* - Server identifies user from JWT (no user ID in body)
|
|
76
|
+
* - Config restricted to theme and onboarding only
|
|
77
|
+
* - Strict mode prevents unknown field injection
|
|
78
|
+
*/
|
|
79
|
+
export const UpdateMyProfileSchema = z
|
|
80
|
+
.object({
|
|
81
|
+
firstName: createStringSchema(1, 100, 'First name').optional(),
|
|
82
|
+
lastName: createStringSchema(1, 100, 'Last name').optional(),
|
|
83
|
+
profilePictureUrl: z
|
|
84
|
+
.string()
|
|
85
|
+
.url()
|
|
86
|
+
.refine((url) => url.startsWith('https://'), { message: 'Only HTTPS URLs are allowed' })
|
|
87
|
+
.optional(),
|
|
88
|
+
lastVisitedOrg: z.string().uuid().optional(),
|
|
89
|
+
config: z
|
|
90
|
+
.object({
|
|
91
|
+
theme: z
|
|
92
|
+
.object({
|
|
93
|
+
// `.catch('default')` makes the write path tolerant of stale/unknown preset strings.
|
|
94
|
+
// Any value that fails enum validation silently coerces to 'default' instead of 400ing.
|
|
95
|
+
// This protects against preset renames (e.g. cyber-punk → cyber-chrome) and drift between
|
|
96
|
+
// the enum and legacy DB values. Paired with a read-path sync-back in main.tsx that
|
|
97
|
+
// persists the corrected value back to DB on next profile load.
|
|
98
|
+
// ThemePresetEnum is derived from THEME_PRESETS — the single source of truth in
|
|
99
|
+
// packages/core/src/auth/multi-tenancy/theme-presets.ts.
|
|
100
|
+
preset: ThemePresetEnum.catch('default').optional(),
|
|
101
|
+
colorScheme: z.enum(['light', 'dark', 'auto']).catch('auto').optional()
|
|
102
|
+
})
|
|
103
|
+
.strict()
|
|
104
|
+
.optional(),
|
|
105
|
+
onboarding: z
|
|
106
|
+
.object({
|
|
107
|
+
completed: z.boolean().optional(),
|
|
108
|
+
completedAt: z.string().datetime().nullable().optional(),
|
|
109
|
+
role: z.string().max(100).nullable().optional(),
|
|
110
|
+
primaryUseCase: z.array(z.string().max(100)).max(10).nullable().optional(),
|
|
111
|
+
experienceLevel: z.string().max(100).nullable().optional(),
|
|
112
|
+
guides: z
|
|
113
|
+
.object({
|
|
114
|
+
completedIds: z.array(z.string().max(100)).max(20).optional(),
|
|
115
|
+
dismissed: z.boolean().optional(),
|
|
116
|
+
completedAt: z.string().datetime().nullable().optional()
|
|
117
|
+
})
|
|
118
|
+
.strict()
|
|
119
|
+
.optional()
|
|
120
|
+
})
|
|
121
|
+
.strict()
|
|
122
|
+
.optional()
|
|
123
|
+
})
|
|
124
|
+
.strict()
|
|
125
|
+
.optional()
|
|
126
|
+
})
|
|
127
|
+
.strict()
|
|
128
|
+
|
|
129
|
+
// ============================================================================
|
|
130
|
+
// Query Parameters
|
|
131
|
+
// ============================================================================
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* List users with filters
|
|
135
|
+
* GET /users
|
|
136
|
+
*
|
|
137
|
+
* Filters:
|
|
138
|
+
* - email: Filter by email
|
|
139
|
+
* - organizationId: Filter by organization
|
|
140
|
+
* - limit: Max results (pagination handled by WorkOS)
|
|
141
|
+
*
|
|
142
|
+
* Security:
|
|
143
|
+
* - Email validated (prevents injection)
|
|
144
|
+
* - organizationId validated (UUID format)
|
|
145
|
+
*/
|
|
146
|
+
export const ListUsersQuerySchema = z
|
|
147
|
+
.object({
|
|
148
|
+
email: EmailSchema.optional(),
|
|
149
|
+
organizationId: z.string().optional(), // WorkOS org IDs can be UUID or 'org_' prefixed
|
|
150
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
151
|
+
before: z.string().optional(), // WorkOS pagination cursor
|
|
152
|
+
after: z.string().optional() // WorkOS pagination cursor
|
|
153
|
+
})
|
|
154
|
+
.strict()
|
|
155
|
+
|
|
156
|
+
// ============================================================================
|
|
157
|
+
// TypeScript Type Exports
|
|
158
|
+
// ============================================================================
|
|
159
|
+
|
|
160
|
+
// Export inferred types for use in route handlers
|
|
161
|
+
export type UpdateUserInput = z.infer<typeof UpdateUserSchema>
|
|
162
|
+
export type UpdateMyProfileInput = z.infer<typeof UpdateMyProfileSchema>
|
|
163
|
+
export type ListUsersQuery = z.infer<typeof ListUsersQuerySchema>
|
|
164
|
+
export type UserIdParam = z.infer<typeof UserIdParamSchema>
|
|
165
|
+
export type ExternalIdParam = z.infer<typeof ExternalIdParamSchema>
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod'
|
|
|
4
4
|
// Platform event member schemas (9 members — closed union, stays in @repo/core)
|
|
5
5
|
//
|
|
6
6
|
// Domain-specific events (reply_received, booking_nudge_sent, etc.) live in
|
|
7
|
-
//
|
|
7
|
+
// @repo/elevasis-operations as CrmDomainActivityEventSchema.
|
|
8
8
|
// See Open Decision #5 in crm-action-system.mdx for rationale.
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
|