Repository navigation
Expand file tree
/
Copy pathtwins.ts
More file actions
77 lines (73 loc) · 3.59 KB
/
Copy pathtwins.ts
File metadata and controls
77 lines (73 loc) · 3.59 KB
1
2
3
4
5
6
7
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import {
EMAIL_CAPABILITY,
inspectCapability,
} from '../../apps/sim/lib/core/config/env-capabilities.ts'
/**
* Server/client feature-flag pairs that must be set together — server code
* reads the bare var, the browser bundle reads the NEXT_PUBLIC_ twin
* (apps/sim/lib/core/config/env-flags.ts documents each). Note the one
* mismatched pair: DEPLOY_AS_BLOCK ↔ NEXT_PUBLIC_CUSTOM_BLOCKS_ENABLED.
*/
export const FLAG_TWINS: ReadonlyArray<{ server: string; client: string }> = [
{ server: 'BILLING_ENABLED', client: 'NEXT_PUBLIC_BILLING_ENABLED' },
{ server: 'ENTERPRISE_ENABLED', client: 'NEXT_PUBLIC_ENTERPRISE_ENABLED' },
{ server: 'ACCESS_CONTROL_ENABLED', client: 'NEXT_PUBLIC_ACCESS_CONTROL_ENABLED' },
{ server: 'ORGANIZATIONS_ENABLED', client: 'NEXT_PUBLIC_ORGANIZATIONS_ENABLED' },
{ server: 'WHITELABELING_ENABLED', client: 'NEXT_PUBLIC_WHITELABELING_ENABLED' },
{ server: 'AUDIT_LOGS_ENABLED', client: 'NEXT_PUBLIC_AUDIT_LOGS_ENABLED' },
{ server: 'DATA_RETENTION_ENABLED', client: 'NEXT_PUBLIC_DATA_RETENTION_ENABLED' },
{ server: 'SESSION_POLICIES_ENABLED', client: 'NEXT_PUBLIC_SESSION_POLICIES_ENABLED' },
{ server: 'DATA_DRAINS_ENABLED', client: 'NEXT_PUBLIC_DATA_DRAINS_ENABLED' },
{ server: 'FORKING_ENABLED', client: 'NEXT_PUBLIC_FORKING_ENABLED' },
{ server: 'INBOX_ENABLED', client: 'NEXT_PUBLIC_INBOX_ENABLED' },
{ server: 'DISABLE_INVITATIONS', client: 'NEXT_PUBLIC_DISABLE_INVITATIONS' },
{ server: 'DISABLE_PUBLIC_API', client: 'NEXT_PUBLIC_DISABLE_PUBLIC_API' },
{ server: 'SSO_ENABLED', client: 'NEXT_PUBLIC_SSO_ENABLED' },
{ server: 'EMAIL_PASSWORD_SIGNUP_ENABLED', client: 'NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED' },
{ server: 'E2B_ENABLED', client: 'NEXT_PUBLIC_E2B_ENABLED' },
{ server: 'DEPLOY_AS_BLOCK', client: 'NEXT_PUBLIC_CUSTOM_BLOCKS_ENABLED' },
]
/** Self-host feature unlocks offered by the wizard's Custom flow. */
export const SELF_HOST_UNLOCKS: ReadonlyArray<{ server: string; label: string; hint: string }> = [
{
server: 'ENTERPRISE_ENABLED',
label: 'All enterprise features',
hint: 'enables everything below',
},
{
server: 'ACCESS_CONTROL_ENABLED',
label: 'Access control',
hint: 'permission groups (implies organizations)',
},
{ server: 'ORGANIZATIONS_ENABLED', label: 'Organizations', hint: 'multi-workspace orgs' },
{ server: 'AUDIT_LOGS_ENABLED', label: 'Audit logs', hint: '' },
{ server: 'DATA_RETENTION_ENABLED', label: 'Data retention', hint: 'deletes expired data' },
{ server: 'SESSION_POLICIES_ENABLED', label: 'Session policies', hint: 'session lifetime caps' },
{ server: 'DATA_DRAINS_ENABLED', label: 'Data drains', hint: 'export streams' },
{ server: 'FORKING_ENABLED', label: 'Workflow forking', hint: '' },
{ server: 'INBOX_ENABLED', label: 'Inbox', hint: '' },
{ server: 'WHITELABELING_ENABLED', label: 'Whitelabeling', hint: 'custom branding' },
{
server: 'DEPLOY_AS_BLOCK',
label: 'Deploy as block',
hint: 'publish workflows as reusable blocks',
},
]
export function getConfiguredMailProvider(vars: Map<string, string>): string {
const inspection = inspectCapability(EMAIL_CAPABILITY, vars)
return (
inspection.providerIds[0] ??
inspection.providers.find((provider) => provider.active)?.id ??
'console'
)
}
export const LOGIN_PROVIDERS = [
{ id: 'google', label: 'Google', idKey: 'GOOGLE_CLIENT_ID', secretKey: 'GOOGLE_CLIENT_SECRET' },
{ id: 'github', label: 'GitHub', idKey: 'GITHUB_CLIENT_ID', secretKey: 'GITHUB_CLIENT_SECRET' },
{
id: 'microsoft',
label: 'Microsoft',
idKey: 'MICROSOFT_CLIENT_ID',
secretKey: 'MICROSOFT_CLIENT_SECRET',
},
] as const