@stackframe/stack-shared 2.8.25 → 2.8.27

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 (124) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/config/format.d.mts +20 -5
  3. package/dist/config/format.d.ts +20 -5
  4. package/dist/config/format.js +39 -14
  5. package/dist/config/format.js.map +1 -1
  6. package/dist/config/schema.d.mts +795 -317
  7. package/dist/config/schema.d.ts +795 -317
  8. package/dist/config/schema.js +471 -84
  9. package/dist/config/schema.js.map +1 -1
  10. package/dist/crud.d.mts +1 -0
  11. package/dist/crud.d.ts +1 -0
  12. package/dist/esm/config/format.js +37 -14
  13. package/dist/esm/config/format.js.map +1 -1
  14. package/dist/esm/config/schema.js +460 -80
  15. package/dist/esm/config/schema.js.map +1 -1
  16. package/dist/esm/helpers/emails.js +136 -30
  17. package/dist/esm/helpers/emails.js.map +1 -1
  18. package/dist/esm/interface/admin-interface.js +19 -29
  19. package/dist/esm/interface/admin-interface.js.map +1 -1
  20. package/dist/esm/known-errors.js +24 -1
  21. package/dist/esm/known-errors.js.map +1 -1
  22. package/dist/esm/schema-fields.js +92 -27
  23. package/dist/esm/schema-fields.js.map +1 -1
  24. package/dist/esm/utils/currencies.js +52 -0
  25. package/dist/esm/utils/currencies.js.map +1 -0
  26. package/dist/esm/utils/dates.js +55 -1
  27. package/dist/esm/utils/dates.js.map +1 -1
  28. package/dist/esm/utils/errors.js.map +1 -1
  29. package/dist/esm/utils/objects.js +2 -0
  30. package/dist/esm/utils/objects.js.map +1 -1
  31. package/dist/esm/utils/strings.js +4 -0
  32. package/dist/esm/utils/strings.js.map +1 -1
  33. package/dist/esm/utils/types.js +45 -0
  34. package/dist/esm/utils/types.js.map +1 -1
  35. package/dist/helpers/emails.d.mts +32 -6
  36. package/dist/helpers/emails.d.ts +32 -6
  37. package/dist/helpers/emails.js +138 -30
  38. package/dist/helpers/emails.js.map +1 -1
  39. package/dist/helpers/password.d.mts +1 -0
  40. package/dist/helpers/password.d.ts +1 -0
  41. package/dist/helpers/production-mode.d.mts +1 -0
  42. package/dist/helpers/production-mode.d.ts +1 -0
  43. package/dist/index.d.mts +2 -2
  44. package/dist/index.d.ts +2 -2
  45. package/dist/interface/admin-interface.d.mts +8 -8
  46. package/dist/interface/admin-interface.d.ts +8 -8
  47. package/dist/interface/admin-interface.js +19 -29
  48. package/dist/interface/admin-interface.js.map +1 -1
  49. package/dist/interface/client-interface.d.mts +1 -0
  50. package/dist/interface/client-interface.d.ts +1 -0
  51. package/dist/interface/crud/connected-accounts.d.mts +1 -0
  52. package/dist/interface/crud/connected-accounts.d.ts +1 -0
  53. package/dist/interface/crud/contact-channels.d.mts +1 -0
  54. package/dist/interface/crud/contact-channels.d.ts +1 -0
  55. package/dist/interface/crud/current-user.d.mts +1 -0
  56. package/dist/interface/crud/current-user.d.ts +1 -0
  57. package/dist/interface/crud/email-templates.d.mts +1 -0
  58. package/dist/interface/crud/email-templates.d.ts +1 -0
  59. package/dist/interface/crud/emails.d.mts +1 -0
  60. package/dist/interface/crud/emails.d.ts +1 -0
  61. package/dist/interface/crud/internal-api-keys.d.mts +1 -0
  62. package/dist/interface/crud/internal-api-keys.d.ts +1 -0
  63. package/dist/interface/crud/notification-preferences.d.mts +1 -0
  64. package/dist/interface/crud/notification-preferences.d.ts +1 -0
  65. package/dist/interface/crud/oauth-providers.d.mts +5 -4
  66. package/dist/interface/crud/oauth-providers.d.ts +5 -4
  67. package/dist/interface/crud/project-api-keys.d.mts +3 -2
  68. package/dist/interface/crud/project-api-keys.d.ts +3 -2
  69. package/dist/interface/crud/project-permissions.d.mts +1 -0
  70. package/dist/interface/crud/project-permissions.d.ts +1 -0
  71. package/dist/interface/crud/projects.d.mts +8 -7
  72. package/dist/interface/crud/projects.d.ts +8 -7
  73. package/dist/interface/crud/sessions.d.mts +1 -0
  74. package/dist/interface/crud/sessions.d.ts +1 -0
  75. package/dist/interface/crud/svix-token.d.mts +1 -0
  76. package/dist/interface/crud/svix-token.d.ts +1 -0
  77. package/dist/interface/crud/team-invitation-details.d.mts +1 -0
  78. package/dist/interface/crud/team-invitation-details.d.ts +1 -0
  79. package/dist/interface/crud/team-invitation.d.mts +1 -0
  80. package/dist/interface/crud/team-invitation.d.ts +1 -0
  81. package/dist/interface/crud/team-member-profiles.d.mts +1 -0
  82. package/dist/interface/crud/team-member-profiles.d.ts +1 -0
  83. package/dist/interface/crud/team-memberships.d.mts +1 -0
  84. package/dist/interface/crud/team-memberships.d.ts +1 -0
  85. package/dist/interface/crud/team-permissions.d.mts +1 -0
  86. package/dist/interface/crud/team-permissions.d.ts +1 -0
  87. package/dist/interface/crud/teams.d.mts +1 -0
  88. package/dist/interface/crud/teams.d.ts +1 -0
  89. package/dist/interface/crud/users.d.mts +1 -0
  90. package/dist/interface/crud/users.d.ts +1 -0
  91. package/dist/interface/server-interface.d.mts +1 -0
  92. package/dist/interface/server-interface.d.ts +1 -0
  93. package/dist/known-errors.d.mts +6 -0
  94. package/dist/known-errors.d.ts +6 -0
  95. package/dist/known-errors.js +24 -1
  96. package/dist/known-errors.js.map +1 -1
  97. package/dist/schema-fields.d.mts +39 -8
  98. package/dist/schema-fields.d.ts +39 -8
  99. package/dist/schema-fields.js +101 -27
  100. package/dist/schema-fields.js.map +1 -1
  101. package/dist/utils/currencies.d.mts +39 -0
  102. package/dist/utils/currencies.d.ts +39 -0
  103. package/dist/utils/currencies.js +78 -0
  104. package/dist/utils/currencies.js.map +1 -0
  105. package/dist/utils/dates.d.mts +5 -1
  106. package/dist/utils/dates.d.ts +5 -1
  107. package/dist/utils/dates.js +58 -2
  108. package/dist/utils/dates.js.map +1 -1
  109. package/dist/utils/errors.d.mts +9 -0
  110. package/dist/utils/errors.d.ts +9 -0
  111. package/dist/utils/errors.js.map +1 -1
  112. package/dist/utils/objects.d.mts +23 -8
  113. package/dist/utils/objects.d.ts +23 -8
  114. package/dist/utils/objects.js +2 -0
  115. package/dist/utils/objects.js.map +1 -1
  116. package/dist/utils/strings.d.mts +3 -1
  117. package/dist/utils/strings.d.ts +3 -1
  118. package/dist/utils/strings.js +5 -0
  119. package/dist/utils/strings.js.map +1 -1
  120. package/dist/utils/types.d.mts +73 -2
  121. package/dist/utils/types.d.ts +73 -2
  122. package/dist/utils/types.js +54 -0
  123. package/dist/utils/types.js.map +1 -1
  124. package/package.json +1 -1
@@ -1,90 +1,107 @@
1
1
  import * as yup from 'yup';
2
- import { DeepMerge, DeepPartial } from '../utils/objects.js';
3
- import { NormalizesTo, Config } from './format.js';
2
+ import { DeepMerge } from '../utils/objects.js';
3
+ import { Result } from '../utils/results.js';
4
+ import { Expand, IsUnion, CollapseObjectUnion } from '../utils/types.js';
5
+ import { Config, NormalizesTo } from './format.js';
6
+ import '../utils/strings.js';
4
7
 
5
8
  declare const configLevels: readonly ["project", "branch", "environment", "organization"];
6
9
  type ConfigLevel = typeof configLevels[number];
10
+ declare module "yup" {
11
+ interface CustomSchemaMetadata {
12
+ stackConfigCanNoLongerBeOverridden?: true;
13
+ }
14
+ }
7
15
  /**
8
16
  * All fields that can be overridden at this level.
9
17
  */
10
18
  declare const projectConfigSchema: yup.ObjectSchema<{
11
19
  sourceOfTruth: {
12
- type?: "hosted" | undefined;
20
+ type: "hosted";
13
21
  } | {
14
- type?: "neon" | undefined;
22
+ type: "neon";
15
23
  connectionStrings: Record<string, string>;
16
24
  } | {
17
- type?: "postgres" | undefined;
25
+ type: "postgres";
18
26
  connectionString: string;
19
- } | undefined;
27
+ };
20
28
  }, yup.AnyObject, {
21
29
  sourceOfTruth: undefined;
22
30
  }, "">;
23
- declare const branchConfigSchema: yup.ObjectSchema<{} & {
31
+ declare const branchConfigSchema: yup.Schema<Omit<Omit<{
32
+ sourceOfTruth: {
33
+ type: "hosted";
34
+ } | {
35
+ type: "neon";
36
+ connectionStrings: Record<string, string>;
37
+ } | {
38
+ type: "postgres";
39
+ connectionString: string;
40
+ };
41
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
42
+ domains: {
43
+ allowLocalhost?: boolean | undefined;
44
+ };
45
+ teams: {
46
+ createPersonalTeamOnSignUp?: boolean | undefined;
47
+ allowClientTeamCreation?: boolean | undefined;
48
+ };
24
49
  rbac: {
25
- permissions?: Record<string, {
50
+ permissions: Record<string, {
26
51
  description?: string | undefined;
27
52
  scope?: "team" | "project" | undefined;
28
53
  containedPermissionIds?: Record<string, true | undefined> | undefined;
29
- } | undefined> | undefined;
30
- defaultPermissions?: {
31
- teamCreator?: Record<string, true | undefined> | undefined;
32
- teamMember?: Record<string, true | undefined> | undefined;
33
- signUp?: Record<string, true | undefined> | undefined;
34
- } | undefined;
35
- } | undefined;
36
- teams: {
37
- createPersonalTeamOnSignUp?: boolean | undefined;
38
- allowClientTeamCreation?: boolean | undefined;
39
- } | undefined;
40
- users: {
41
- allowClientUserDeletion?: boolean | undefined;
42
- } | undefined;
54
+ } | undefined>;
55
+ defaultPermissions: {
56
+ teamCreator: Record<string, true | undefined>;
57
+ teamMember: Record<string, true | undefined>;
58
+ signUp: Record<string, true | undefined>;
59
+ };
60
+ };
43
61
  apiKeys: {
44
- enabled?: {
62
+ enabled: {
45
63
  user?: boolean | undefined;
46
64
  team?: boolean | undefined;
47
- } | undefined;
48
- } | undefined;
49
- domains: {
50
- allowLocalhost?: boolean | undefined;
51
- } | undefined;
65
+ };
66
+ };
52
67
  auth: {
53
- password?: {
54
- allowSignIn?: boolean | undefined;
55
- } | undefined;
56
68
  allowSignUp?: boolean | undefined;
57
- otp?: {
69
+ password: {
58
70
  allowSignIn?: boolean | undefined;
59
- } | undefined;
60
- passkey?: {
71
+ };
72
+ otp: {
61
73
  allowSignIn?: boolean | undefined;
62
- } | undefined;
63
- oauth?: {
74
+ };
75
+ passkey: {
76
+ allowSignIn?: boolean | undefined;
77
+ };
78
+ oauth: {
64
79
  accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
65
- providers?: Record<string, {
80
+ providers: Record<string, {
66
81
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
67
82
  allowSignIn?: boolean | undefined;
68
83
  allowConnectedAccounts?: boolean | undefined;
69
- }> | undefined;
70
- } | undefined;
71
- } | undefined;
84
+ }>;
85
+ };
86
+ };
87
+ users: {
88
+ allowClientUserDeletion?: boolean | undefined;
89
+ };
72
90
  emails: {
73
- theme?: string | undefined;
74
- themeList?: Record<string, {
91
+ selectedThemeId?: string | undefined;
92
+ themes: Record<string, {
75
93
  displayName: string;
76
94
  tsxSource: string;
77
- }> | undefined;
78
- templateList?: Record<string, {
79
- description: string;
95
+ }>;
96
+ templates: Record<string, {
97
+ themeId?: string | false | undefined;
80
98
  displayName: string;
81
99
  tsxSource: string;
82
- variables: string[];
83
- subject: string;
84
- }> | undefined;
100
+ }>;
85
101
  };
86
- }, yup.AnyObject, {
102
+ }, yup.AnyObject, Omit<Omit<{
87
103
  sourceOfTruth: undefined;
104
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
88
105
  rbac: {
89
106
  permissions: undefined;
90
107
  defaultPermissions: {
@@ -126,139 +143,120 @@ declare const branchConfigSchema: yup.ObjectSchema<{} & {
126
143
  };
127
144
  };
128
145
  emails: {
129
- theme: undefined;
130
- themeList: undefined;
131
- templateList: undefined;
146
+ selectedThemeId: undefined;
147
+ themes: undefined;
148
+ templates: undefined;
132
149
  };
133
150
  }, "">;
134
- declare const environmentConfigSchema: yup.ObjectSchema<{
151
+ declare const environmentConfigSchema: yup.Schema<Omit<NonNullable<Omit<Omit<{
152
+ sourceOfTruth: {
153
+ type: "hosted";
154
+ } | {
155
+ type: "neon";
156
+ connectionStrings: Record<string, string>;
157
+ } | {
158
+ type: "postgres";
159
+ connectionString: string;
160
+ };
161
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
162
+ domains: {
163
+ allowLocalhost?: boolean | undefined;
164
+ };
165
+ teams: {
166
+ createPersonalTeamOnSignUp?: boolean | undefined;
167
+ allowClientTeamCreation?: boolean | undefined;
168
+ };
135
169
  rbac: {
136
- permissions?: Record<string, {
170
+ permissions: Record<string, {
137
171
  description?: string | undefined;
138
172
  scope?: "team" | "project" | undefined;
139
173
  containedPermissionIds?: Record<string, true | undefined> | undefined;
140
- } | undefined> | undefined;
141
- defaultPermissions?: {
142
- teamCreator?: Record<string, true | undefined> | undefined;
143
- teamMember?: Record<string, true | undefined> | undefined;
144
- signUp?: Record<string, true | undefined> | undefined;
145
- } | undefined;
146
- } | undefined;
147
- teams: {
148
- createPersonalTeamOnSignUp?: boolean | undefined;
149
- allowClientTeamCreation?: boolean | undefined;
150
- } | undefined;
151
- users: {
152
- allowClientUserDeletion?: boolean | undefined;
153
- } | undefined;
174
+ } | undefined>;
175
+ defaultPermissions: {
176
+ teamCreator: Record<string, true | undefined>;
177
+ teamMember: Record<string, true | undefined>;
178
+ signUp: Record<string, true | undefined>;
179
+ };
180
+ };
154
181
  apiKeys: {
155
- enabled?: {
182
+ enabled: {
156
183
  user?: boolean | undefined;
157
184
  team?: boolean | undefined;
158
- } | undefined;
159
- } | undefined;
160
- domains: (Omit<{
161
- allowLocalhost?: boolean | undefined;
162
- }, "trustedDomains"> & {
163
- trustedDomains?: Record<string, {
164
- baseUrl?: string | undefined;
165
- handlerPath?: string | undefined;
166
- }> | undefined;
167
- }) | undefined;
168
- auth: (Omit<{
169
- password?: {
170
- allowSignIn?: boolean | undefined;
171
- } | undefined;
185
+ };
186
+ };
187
+ auth: {
172
188
  allowSignUp?: boolean | undefined;
173
- otp?: {
189
+ password: {
174
190
  allowSignIn?: boolean | undefined;
175
- } | undefined;
176
- passkey?: {
191
+ };
192
+ otp: {
177
193
  allowSignIn?: boolean | undefined;
178
- } | undefined;
179
- oauth?: {
180
- accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
181
- providers?: Record<string, {
182
- type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
183
- allowSignIn?: boolean | undefined;
184
- allowConnectedAccounts?: boolean | undefined;
185
- }> | undefined;
186
- } | undefined;
187
- }, "oauth"> & {
188
- oauth?: (Omit<{
194
+ };
195
+ passkey: {
196
+ allowSignIn?: boolean | undefined;
197
+ };
198
+ oauth: {
189
199
  accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
190
- providers?: Record<string, {
200
+ providers: Record<string, {
191
201
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
192
202
  allowSignIn?: boolean | undefined;
193
203
  allowConnectedAccounts?: boolean | undefined;
194
- }> | undefined;
195
- }, never> & {
196
- providers?: Record<string, {
197
- type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
198
- clientId?: string | undefined;
199
- clientSecret?: string | undefined;
200
- allowSignIn?: boolean | undefined;
201
- allowConnectedAccounts?: boolean | undefined;
202
- isShared?: boolean | undefined;
203
- facebookConfigId?: string | undefined;
204
- microsoftTenantId?: string | undefined;
205
- }> | undefined;
206
- }) | undefined;
207
- }) | undefined;
208
- emails: Omit<{
209
- theme?: string | undefined;
210
- themeList?: Record<string, {
204
+ }>;
205
+ };
206
+ };
207
+ users: {
208
+ allowClientUserDeletion?: boolean | undefined;
209
+ };
210
+ emails: {
211
+ selectedThemeId?: string | undefined;
212
+ themes: Record<string, {
211
213
  displayName: string;
212
214
  tsxSource: string;
213
- }> | undefined;
214
- templateList?: Record<string, {
215
- description: string;
215
+ }>;
216
+ templates: Record<string, {
217
+ themeId?: string | false | undefined;
216
218
  displayName: string;
217
219
  tsxSource: string;
218
- variables: string[];
219
- subject: string;
220
- }> | undefined;
221
- }, never> & {
222
- server: {
223
- host?: string | undefined;
224
- port?: number | undefined;
225
- username?: string | undefined;
226
- password?: string | undefined;
227
- isShared?: boolean | undefined;
228
- senderName?: string | undefined;
229
- senderEmail?: string | undefined;
230
- };
220
+ }>;
231
221
  };
232
- } & {
233
- auth: (Omit<{
234
- password?: {
235
- allowSignIn?: boolean | undefined;
236
- } | undefined;
222
+ }>, "domains" | "auth" | "emails"> & {
223
+ domains: Omit<{
224
+ allowLocalhost?: boolean | undefined;
225
+ }, "trustedDomains"> & {
226
+ trustedDomains: Record<string, {
227
+ baseUrl?: string | undefined;
228
+ handlerPath?: string | undefined;
229
+ }>;
230
+ };
231
+ auth: Omit<{
237
232
  allowSignUp?: boolean | undefined;
238
- otp?: {
233
+ password: {
239
234
  allowSignIn?: boolean | undefined;
240
- } | undefined;
241
- passkey?: {
235
+ };
236
+ otp: {
242
237
  allowSignIn?: boolean | undefined;
243
- } | undefined;
244
- oauth?: {
238
+ };
239
+ passkey: {
240
+ allowSignIn?: boolean | undefined;
241
+ };
242
+ oauth: {
245
243
  accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
246
- providers?: Record<string, {
244
+ providers: Record<string, {
247
245
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
248
246
  allowSignIn?: boolean | undefined;
249
247
  allowConnectedAccounts?: boolean | undefined;
250
- }> | undefined;
251
- } | undefined;
248
+ }>;
249
+ };
252
250
  }, "oauth"> & {
253
- oauth?: (Omit<{
251
+ oauth: Omit<{
254
252
  accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
255
- providers?: Record<string, {
253
+ providers: Record<string, {
256
254
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
257
255
  allowSignIn?: boolean | undefined;
258
256
  allowConnectedAccounts?: boolean | undefined;
259
- }> | undefined;
260
- }, never> & {
261
- providers?: Record<string, {
257
+ }>;
258
+ }, "providers"> & {
259
+ providers: Record<string, {
262
260
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
263
261
  clientId?: string | undefined;
264
262
  clientSecret?: string | undefined;
@@ -267,23 +265,21 @@ declare const environmentConfigSchema: yup.ObjectSchema<{
267
265
  isShared?: boolean | undefined;
268
266
  facebookConfigId?: string | undefined;
269
267
  microsoftTenantId?: string | undefined;
270
- }> | undefined;
271
- }) | undefined;
272
- }) | undefined;
268
+ }>;
269
+ };
270
+ };
273
271
  emails: Omit<{
274
- theme?: string | undefined;
275
- themeList?: Record<string, {
272
+ selectedThemeId?: string | undefined;
273
+ themes: Record<string, {
276
274
  displayName: string;
277
275
  tsxSource: string;
278
- }> | undefined;
279
- templateList?: Record<string, {
280
- description: string;
276
+ }>;
277
+ templates: Record<string, {
278
+ themeId?: string | false | undefined;
281
279
  displayName: string;
282
280
  tsxSource: string;
283
- variables: string[];
284
- subject: string;
285
- }> | undefined;
286
- }, never> & {
281
+ }>;
282
+ }, "server"> & {
287
283
  server: {
288
284
  host?: string | undefined;
289
285
  port?: number | undefined;
@@ -294,16 +290,9 @@ declare const environmentConfigSchema: yup.ObjectSchema<{
294
290
  senderEmail?: string | undefined;
295
291
  };
296
292
  };
297
- domains: (Omit<{
298
- allowLocalhost?: boolean | undefined;
299
- }, "trustedDomains"> & {
300
- trustedDomains?: Record<string, {
301
- baseUrl?: string | undefined;
302
- handlerPath?: string | undefined;
303
- }> | undefined;
304
- }) | undefined;
305
- }, yup.AnyObject, {
293
+ }, yup.AnyObject, Omit<NonNullable<Omit<Omit<{
306
294
  sourceOfTruth: undefined;
295
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
307
296
  rbac: {
308
297
  permissions: undefined;
309
298
  defaultPermissions: {
@@ -326,7 +315,33 @@ declare const environmentConfigSchema: yup.ObjectSchema<{
326
315
  };
327
316
  };
328
317
  domains: {
318
+ allowLocalhost: undefined;
319
+ };
320
+ auth: {
321
+ allowSignUp: undefined;
322
+ password: {
323
+ allowSignIn: undefined;
324
+ };
325
+ otp: {
326
+ allowSignIn: undefined;
327
+ };
328
+ passkey: {
329
+ allowSignIn: undefined;
330
+ };
331
+ oauth: {
332
+ accountMergeStrategy: undefined;
333
+ providers: undefined;
334
+ };
335
+ };
336
+ emails: {
337
+ selectedThemeId: undefined;
338
+ themes: undefined;
339
+ templates: undefined;
340
+ };
341
+ }>, "domains" | "auth" | "emails"> & {
342
+ auth: Omit<NonNullable<Omit<Omit<{
329
343
  sourceOfTruth: undefined;
344
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
330
345
  rbac: {
331
346
  permissions: undefined;
332
347
  defaultPermissions: {
@@ -368,13 +383,66 @@ declare const environmentConfigSchema: yup.ObjectSchema<{
368
383
  };
369
384
  };
370
385
  emails: {
371
- theme: undefined;
372
- themeList: undefined;
373
- templateList: undefined;
386
+ selectedThemeId: undefined;
387
+ themes: undefined;
388
+ templates: undefined;
389
+ };
390
+ }>, "oauth"> & {
391
+ oauth: Omit<NonNullable<Omit<Omit<{
392
+ sourceOfTruth: undefined;
393
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
394
+ rbac: {
395
+ permissions: undefined;
396
+ defaultPermissions: {
397
+ teamCreator: undefined;
398
+ teamMember: undefined;
399
+ signUp: undefined;
400
+ };
401
+ };
402
+ teams: {
403
+ createPersonalTeamOnSignUp: undefined;
404
+ allowClientTeamCreation: undefined;
405
+ };
406
+ users: {
407
+ allowClientUserDeletion: undefined;
408
+ };
409
+ apiKeys: {
410
+ enabled: {
411
+ team: undefined;
412
+ user: undefined;
413
+ };
414
+ };
415
+ domains: {
416
+ allowLocalhost: undefined;
417
+ };
418
+ auth: {
419
+ allowSignUp: undefined;
420
+ password: {
421
+ allowSignIn: undefined;
422
+ };
423
+ otp: {
424
+ allowSignIn: undefined;
425
+ };
426
+ passkey: {
427
+ allowSignIn: undefined;
428
+ };
429
+ oauth: {
430
+ accountMergeStrategy: undefined;
431
+ providers: undefined;
432
+ };
433
+ };
434
+ emails: {
435
+ selectedThemeId: undefined;
436
+ themes: undefined;
437
+ templates: undefined;
438
+ };
439
+ }>, "providers"> & {
440
+ providers: undefined;
374
441
  };
375
442
  };
376
- auth: {
443
+ emails: Omit<NonNullable<Omit<Omit<{
377
444
  sourceOfTruth: undefined;
445
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
378
446
  rbac: {
379
447
  permissions: undefined;
380
448
  defaultPermissions: {
@@ -416,13 +484,24 @@ declare const environmentConfigSchema: yup.ObjectSchema<{
416
484
  };
417
485
  };
418
486
  emails: {
419
- theme: undefined;
420
- themeList: undefined;
421
- templateList: undefined;
487
+ selectedThemeId: undefined;
488
+ themes: undefined;
489
+ templates: undefined;
490
+ };
491
+ }>, "server"> & {
492
+ server: {
493
+ isShared: undefined;
494
+ host: undefined;
495
+ port: undefined;
496
+ username: undefined;
497
+ password: undefined;
498
+ senderName: undefined;
499
+ senderEmail: undefined;
422
500
  };
423
501
  };
424
- emails: {
502
+ domains: Omit<NonNullable<Omit<Omit<{
425
503
  sourceOfTruth: undefined;
504
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
426
505
  rbac: {
427
506
  permissions: undefined;
428
507
  defaultPermissions: {
@@ -464,75 +543,123 @@ declare const environmentConfigSchema: yup.ObjectSchema<{
464
543
  };
465
544
  };
466
545
  emails: {
467
- theme: undefined;
468
- themeList: undefined;
469
- templateList: undefined;
546
+ selectedThemeId: undefined;
547
+ themes: undefined;
548
+ templates: undefined;
470
549
  };
550
+ }>, "trustedDomains"> & {
551
+ trustedDomains: undefined;
471
552
  };
472
553
  }, "">;
473
- declare const organizationConfigSchema: yup.ObjectSchema<{
554
+ declare const organizationConfigSchema: yup.Schema<Omit<NonNullable<Omit<NonNullable<Omit<Omit<{
555
+ sourceOfTruth: {
556
+ type: "hosted";
557
+ } | {
558
+ type: "neon";
559
+ connectionStrings: Record<string, string>;
560
+ } | {
561
+ type: "postgres";
562
+ connectionString: string;
563
+ };
564
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
565
+ domains: {
566
+ allowLocalhost?: boolean | undefined;
567
+ };
568
+ teams: {
569
+ createPersonalTeamOnSignUp?: boolean | undefined;
570
+ allowClientTeamCreation?: boolean | undefined;
571
+ };
474
572
  rbac: {
475
- permissions?: Record<string, {
573
+ permissions: Record<string, {
476
574
  description?: string | undefined;
477
575
  scope?: "team" | "project" | undefined;
478
576
  containedPermissionIds?: Record<string, true | undefined> | undefined;
479
- } | undefined> | undefined;
480
- defaultPermissions?: {
481
- teamCreator?: Record<string, true | undefined> | undefined;
482
- teamMember?: Record<string, true | undefined> | undefined;
483
- signUp?: Record<string, true | undefined> | undefined;
484
- } | undefined;
485
- } | undefined;
486
- teams: {
487
- createPersonalTeamOnSignUp?: boolean | undefined;
488
- allowClientTeamCreation?: boolean | undefined;
489
- } | undefined;
490
- users: {
491
- allowClientUserDeletion?: boolean | undefined;
492
- } | undefined;
577
+ } | undefined>;
578
+ defaultPermissions: {
579
+ teamCreator: Record<string, true | undefined>;
580
+ teamMember: Record<string, true | undefined>;
581
+ signUp: Record<string, true | undefined>;
582
+ };
583
+ };
493
584
  apiKeys: {
494
- enabled?: {
585
+ enabled: {
495
586
  user?: boolean | undefined;
496
587
  team?: boolean | undefined;
497
- } | undefined;
498
- } | undefined;
499
- domains: (Omit<{
588
+ };
589
+ };
590
+ auth: {
591
+ allowSignUp?: boolean | undefined;
592
+ password: {
593
+ allowSignIn?: boolean | undefined;
594
+ };
595
+ otp: {
596
+ allowSignIn?: boolean | undefined;
597
+ };
598
+ passkey: {
599
+ allowSignIn?: boolean | undefined;
600
+ };
601
+ oauth: {
602
+ accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
603
+ providers: Record<string, {
604
+ type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
605
+ allowSignIn?: boolean | undefined;
606
+ allowConnectedAccounts?: boolean | undefined;
607
+ }>;
608
+ };
609
+ };
610
+ users: {
611
+ allowClientUserDeletion?: boolean | undefined;
612
+ };
613
+ emails: {
614
+ selectedThemeId?: string | undefined;
615
+ themes: Record<string, {
616
+ displayName: string;
617
+ tsxSource: string;
618
+ }>;
619
+ templates: Record<string, {
620
+ themeId?: string | false | undefined;
621
+ displayName: string;
622
+ tsxSource: string;
623
+ }>;
624
+ };
625
+ }>, "domains" | "auth" | "emails"> & {
626
+ domains: Omit<{
500
627
  allowLocalhost?: boolean | undefined;
501
628
  }, "trustedDomains"> & {
502
- trustedDomains?: Record<string, {
629
+ trustedDomains: Record<string, {
503
630
  baseUrl?: string | undefined;
504
631
  handlerPath?: string | undefined;
505
- }> | undefined;
506
- }) | undefined;
507
- auth: (Omit<{
508
- password?: {
509
- allowSignIn?: boolean | undefined;
510
- } | undefined;
632
+ }>;
633
+ };
634
+ auth: Omit<{
511
635
  allowSignUp?: boolean | undefined;
512
- otp?: {
636
+ password: {
513
637
  allowSignIn?: boolean | undefined;
514
- } | undefined;
515
- passkey?: {
638
+ };
639
+ otp: {
516
640
  allowSignIn?: boolean | undefined;
517
- } | undefined;
518
- oauth?: {
641
+ };
642
+ passkey: {
643
+ allowSignIn?: boolean | undefined;
644
+ };
645
+ oauth: {
519
646
  accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
520
- providers?: Record<string, {
647
+ providers: Record<string, {
521
648
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
522
649
  allowSignIn?: boolean | undefined;
523
650
  allowConnectedAccounts?: boolean | undefined;
524
- }> | undefined;
525
- } | undefined;
651
+ }>;
652
+ };
526
653
  }, "oauth"> & {
527
- oauth?: (Omit<{
654
+ oauth: Omit<{
528
655
  accountMergeStrategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
529
- providers?: Record<string, {
656
+ providers: Record<string, {
530
657
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
531
658
  allowSignIn?: boolean | undefined;
532
659
  allowConnectedAccounts?: boolean | undefined;
533
- }> | undefined;
534
- }, never> & {
535
- providers?: Record<string, {
660
+ }>;
661
+ }, "providers"> & {
662
+ providers: Record<string, {
536
663
  type?: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
537
664
  clientId?: string | undefined;
538
665
  clientSecret?: string | undefined;
@@ -541,23 +668,21 @@ declare const organizationConfigSchema: yup.ObjectSchema<{
541
668
  isShared?: boolean | undefined;
542
669
  facebookConfigId?: string | undefined;
543
670
  microsoftTenantId?: string | undefined;
544
- }> | undefined;
545
- }) | undefined;
546
- }) | undefined;
671
+ }>;
672
+ };
673
+ };
547
674
  emails: Omit<{
548
- theme?: string | undefined;
549
- themeList?: Record<string, {
675
+ selectedThemeId?: string | undefined;
676
+ themes: Record<string, {
550
677
  displayName: string;
551
678
  tsxSource: string;
552
- }> | undefined;
553
- templateList?: Record<string, {
554
- description: string;
679
+ }>;
680
+ templates: Record<string, {
681
+ themeId?: string | false | undefined;
555
682
  displayName: string;
556
683
  tsxSource: string;
557
- variables: string[];
558
- subject: string;
559
- }> | undefined;
560
- }, never> & {
684
+ }>;
685
+ }, "server"> & {
561
686
  server: {
562
687
  host?: string | undefined;
563
688
  port?: number | undefined;
@@ -568,8 +693,9 @@ declare const organizationConfigSchema: yup.ObjectSchema<{
568
693
  senderEmail?: string | undefined;
569
694
  };
570
695
  };
571
- } & {}, yup.AnyObject, {
696
+ }>, never> & {}, yup.AnyObject, Omit<NonNullable<Omit<NonNullable<Omit<Omit<{
572
697
  sourceOfTruth: undefined;
698
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
573
699
  rbac: {
574
700
  permissions: undefined;
575
701
  defaultPermissions: {
@@ -592,7 +718,33 @@ declare const organizationConfigSchema: yup.ObjectSchema<{
592
718
  };
593
719
  };
594
720
  domains: {
721
+ allowLocalhost: undefined;
722
+ };
723
+ auth: {
724
+ allowSignUp: undefined;
725
+ password: {
726
+ allowSignIn: undefined;
727
+ };
728
+ otp: {
729
+ allowSignIn: undefined;
730
+ };
731
+ passkey: {
732
+ allowSignIn: undefined;
733
+ };
734
+ oauth: {
735
+ accountMergeStrategy: undefined;
736
+ providers: undefined;
737
+ };
738
+ };
739
+ emails: {
740
+ selectedThemeId: undefined;
741
+ themes: undefined;
742
+ templates: undefined;
743
+ };
744
+ }>, "domains" | "auth" | "emails"> & {
745
+ auth: Omit<NonNullable<Omit<Omit<{
595
746
  sourceOfTruth: undefined;
747
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
596
748
  rbac: {
597
749
  permissions: undefined;
598
750
  defaultPermissions: {
@@ -634,13 +786,66 @@ declare const organizationConfigSchema: yup.ObjectSchema<{
634
786
  };
635
787
  };
636
788
  emails: {
637
- theme: undefined;
638
- themeList: undefined;
639
- templateList: undefined;
789
+ selectedThemeId: undefined;
790
+ themes: undefined;
791
+ templates: undefined;
792
+ };
793
+ }>, "oauth"> & {
794
+ oauth: Omit<NonNullable<Omit<Omit<{
795
+ sourceOfTruth: undefined;
796
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
797
+ rbac: {
798
+ permissions: undefined;
799
+ defaultPermissions: {
800
+ teamCreator: undefined;
801
+ teamMember: undefined;
802
+ signUp: undefined;
803
+ };
804
+ };
805
+ teams: {
806
+ createPersonalTeamOnSignUp: undefined;
807
+ allowClientTeamCreation: undefined;
808
+ };
809
+ users: {
810
+ allowClientUserDeletion: undefined;
811
+ };
812
+ apiKeys: {
813
+ enabled: {
814
+ team: undefined;
815
+ user: undefined;
816
+ };
817
+ };
818
+ domains: {
819
+ allowLocalhost: undefined;
820
+ };
821
+ auth: {
822
+ allowSignUp: undefined;
823
+ password: {
824
+ allowSignIn: undefined;
825
+ };
826
+ otp: {
827
+ allowSignIn: undefined;
828
+ };
829
+ passkey: {
830
+ allowSignIn: undefined;
831
+ };
832
+ oauth: {
833
+ accountMergeStrategy: undefined;
834
+ providers: undefined;
835
+ };
836
+ };
837
+ emails: {
838
+ selectedThemeId: undefined;
839
+ themes: undefined;
840
+ templates: undefined;
841
+ };
842
+ }>, "providers"> & {
843
+ providers: undefined;
640
844
  };
641
845
  };
642
- auth: {
846
+ emails: Omit<NonNullable<Omit<Omit<{
643
847
  sourceOfTruth: undefined;
848
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
644
849
  rbac: {
645
850
  permissions: undefined;
646
851
  defaultPermissions: {
@@ -682,13 +887,24 @@ declare const organizationConfigSchema: yup.ObjectSchema<{
682
887
  };
683
888
  };
684
889
  emails: {
685
- theme: undefined;
686
- themeList: undefined;
687
- templateList: undefined;
890
+ selectedThemeId: undefined;
891
+ themes: undefined;
892
+ templates: undefined;
893
+ };
894
+ }>, "server"> & {
895
+ server: {
896
+ isShared: undefined;
897
+ host: undefined;
898
+ port: undefined;
899
+ username: undefined;
900
+ password: undefined;
901
+ senderName: undefined;
902
+ senderEmail: undefined;
688
903
  };
689
904
  };
690
- emails: {
905
+ domains: Omit<NonNullable<Omit<Omit<{
691
906
  sourceOfTruth: undefined;
907
+ }, string>, "domains" | "teams" | "rbac" | "apiKeys" | "auth" | "users" | "emails"> & {
692
908
  rbac: {
693
909
  permissions: undefined;
694
910
  defaultPermissions: {
@@ -730,73 +946,97 @@ declare const organizationConfigSchema: yup.ObjectSchema<{
730
946
  };
731
947
  };
732
948
  emails: {
733
- theme: undefined;
734
- themeList: undefined;
735
- templateList: undefined;
949
+ selectedThemeId: undefined;
950
+ themes: undefined;
951
+ templates: undefined;
736
952
  };
953
+ }>, "trustedDomains"> & {
954
+ trustedDomains: undefined;
737
955
  };
738
- }, "">;
956
+ }>, never> & {}, "">;
957
+ declare function migrateConfigOverride(type: "project" | "branch" | "environment" | "organization", oldUnmigratedConfigOverride: any): any;
739
958
  declare const projectConfigDefaults: {
740
- sourceOfTruth: {
741
- type: "hosted";
959
+ readonly sourceOfTruth: {
960
+ readonly type: "hosted";
961
+ readonly connectionStrings: undefined;
962
+ readonly connectionString: undefined;
742
963
  };
743
964
  };
744
965
  declare const branchConfigDefaults: {};
745
966
  declare const environmentConfigDefaults: {};
746
967
  declare const organizationConfigDefaults: {
747
- rbac: {
748
- permissions: (key: string) => {};
749
- defaultPermissions: {
750
- teamCreator: {};
751
- teamMember: {};
752
- signUp: {};
968
+ readonly rbac: {
969
+ readonly permissions: (key: string) => {
970
+ containedPermissionIds: (key: string) => undefined;
971
+ description: undefined;
972
+ scope: undefined;
973
+ };
974
+ readonly defaultPermissions: {
975
+ readonly teamCreator: (key: string) => undefined;
976
+ readonly teamMember: (key: string) => undefined;
977
+ readonly signUp: (key: string) => undefined;
753
978
  };
754
979
  };
755
- apiKeys: {
756
- enabled: {
757
- team: false;
758
- user: false;
980
+ readonly apiKeys: {
981
+ readonly enabled: {
982
+ readonly team: false;
983
+ readonly user: false;
759
984
  };
760
985
  };
761
- teams: {
762
- createPersonalTeamOnSignUp: false;
763
- allowClientTeamCreation: false;
986
+ readonly teams: {
987
+ readonly createPersonalTeamOnSignUp: false;
988
+ readonly allowClientTeamCreation: false;
764
989
  };
765
- users: {
766
- allowClientUserDeletion: false;
990
+ readonly users: {
991
+ readonly allowClientUserDeletion: false;
767
992
  };
768
- domains: {
769
- allowLocalhost: false;
770
- trustedDomains: (key: string) => {
771
- handlerPath: string;
993
+ readonly domains: {
994
+ readonly allowLocalhost: false;
995
+ readonly trustedDomains: (key: string) => {
996
+ readonly baseUrl: undefined;
997
+ readonly handlerPath: "/handler";
772
998
  };
773
999
  };
774
- auth: {
775
- allowSignUp: true;
776
- password: {
777
- allowSignIn: false;
1000
+ readonly auth: {
1001
+ readonly allowSignUp: true;
1002
+ readonly password: {
1003
+ readonly allowSignIn: false;
778
1004
  };
779
- otp: {
780
- allowSignIn: false;
1005
+ readonly otp: {
1006
+ readonly allowSignIn: false;
781
1007
  };
782
- passkey: {
783
- allowSignIn: false;
1008
+ readonly passkey: {
1009
+ readonly allowSignIn: false;
784
1010
  };
785
- oauth: {
786
- accountMergeStrategy: "link_method";
787
- providers: (key: string) => {
1011
+ readonly oauth: {
1012
+ readonly accountMergeStrategy: "link_method";
1013
+ readonly providers: (key: string) => {
1014
+ type: undefined;
788
1015
  isShared: true;
789
1016
  allowSignIn: false;
790
1017
  allowConnectedAccounts: false;
1018
+ clientId: undefined;
1019
+ clientSecret: undefined;
1020
+ facebookConfigId: undefined;
1021
+ microsoftTenantId: undefined;
791
1022
  };
792
1023
  };
793
1024
  };
794
- emails: {
795
- server: {
796
- isShared: true;
797
- };
798
- theme: string;
799
- themeList: {
1025
+ readonly emails: {
1026
+ readonly server: {
1027
+ readonly isShared: true;
1028
+ readonly host: undefined;
1029
+ readonly port: undefined;
1030
+ readonly username: undefined;
1031
+ readonly password: undefined;
1032
+ readonly senderName: undefined;
1033
+ readonly senderEmail: undefined;
1034
+ };
1035
+ readonly selectedThemeId: "1df07ae6-abf3-4a40-83a5-a1a2cbe336ac";
1036
+ readonly themes: ((key: string) => {
1037
+ displayName: string;
1038
+ tsxSource: string;
1039
+ }) & {
800
1040
  "1df07ae6-abf3-4a40-83a5-a1a2cbe336ac": {
801
1041
  displayName: string;
802
1042
  tsxSource: string;
@@ -806,48 +1046,286 @@ declare const organizationConfigDefaults: {
806
1046
  tsxSource: string;
807
1047
  };
808
1048
  };
809
- templateList: {
1049
+ readonly templates: ((key: string) => {
1050
+ displayName: string;
1051
+ tsxSource: string;
1052
+ themeId: undefined;
1053
+ }) & {
810
1054
  "e7d009ce-8d47-4528-b245-5bf119f2ffa3": {
811
1055
  displayName: string;
812
- description: string;
813
- variables: string[];
814
- subject: string;
815
1056
  tsxSource: string;
1057
+ themeId: undefined;
1058
+ };
1059
+ "a70fb3a4-56c1-4e42-af25-49d25603abd0": {
1060
+ displayName: string;
1061
+ tsxSource: string;
1062
+ themeId: undefined;
1063
+ };
1064
+ "822687fe-8d0a-4467-a0d1-416b6e639478": {
1065
+ displayName: string;
1066
+ tsxSource: string;
1067
+ themeId: undefined;
1068
+ };
1069
+ "e84de395-2076-4831-9c19-8e9a96a868e4": {
1070
+ displayName: string;
1071
+ tsxSource: string;
1072
+ themeId: undefined;
1073
+ };
1074
+ "066dd73c-36da-4fd0-b6d6-ebf87683f8bc": {
1075
+ displayName: string;
1076
+ tsxSource: string;
1077
+ themeId: undefined;
816
1078
  };
817
1079
  };
818
1080
  };
819
1081
  };
820
- type DeepReplaceAllowFunctionsForObjects<T> = T extends object ? {
821
- [K in keyof T]: DeepReplaceAllowFunctionsForObjects<T[K]>;
822
- } | ((arg: keyof T) => DeepReplaceAllowFunctionsForObjects<T[keyof T]>) : T;
823
- type DeepReplaceFunctionsWithObjects<T> = T extends (arg: infer K extends string) => infer R ? DeepReplaceFunctionsWithObjects<Record<K, R>> : (T extends object ? {
824
- [K in keyof T]: DeepReplaceFunctionsWithObjects<T[K]>;
825
- } : T);
826
- type ApplyDefaults<D extends object | ((key: string) => unknown), C extends object> = DeepMerge<DeepReplaceFunctionsWithObjects<D>, C>;
827
- declare function applyDefaults<D extends object | ((key: string) => unknown), C extends object>(defaults: D, config: C): ApplyDefaults<D, C>;
828
- type ProjectConfigNormalizedOverride = yup.InferType<typeof projectConfigSchema>;
829
- type BranchConfigNormalizedOverride = yup.InferType<typeof branchConfigSchema>;
830
- type EnvironmentConfigNormalizedOverride = yup.InferType<typeof environmentConfigSchema>;
831
- type OrganizationConfigNormalizedOverride = yup.InferType<typeof organizationConfigSchema>;
832
- type ProjectConfigStrippedNormalizedOverride = Omit<ProjectConfigNormalizedOverride, keyof BranchConfigNormalizedOverride | keyof EnvironmentConfigNormalizedOverride | keyof OrganizationConfigNormalizedOverride>;
833
- type BranchConfigStrippedNormalizedOverride = Omit<BranchConfigNormalizedOverride, keyof EnvironmentConfigNormalizedOverride | keyof OrganizationConfigNormalizedOverride>;
834
- type EnvironmentConfigStrippedNormalizedOverride = Omit<EnvironmentConfigNormalizedOverride, keyof OrganizationConfigNormalizedOverride>;
835
- type OrganizationConfigStrippedNormalizedOverride = OrganizationConfigNormalizedOverride;
1082
+ type ReplaceFunctionsWithObjects<T> = T & (T extends (arg: infer K extends string) => infer R ? Record<K, R> & object : unknown);
1083
+ type DeepReplaceFunctionsWithObjects<T> = T extends object ? {
1084
+ [K in keyof ReplaceFunctionsWithObjects<T>]: DeepReplaceFunctionsWithObjects<ReplaceFunctionsWithObjects<T>[K]>;
1085
+ } : T;
1086
+ type ApplyDefaults<D extends object | ((key: string) => unknown), C extends object> = {} extends D ? C : DeepMerge<DeepReplaceFunctionsWithObjects<D>, C>;
1087
+ declare function applyProjectDefaults<T extends ProjectRenderedConfigBeforeDefaults>(config: T): DeepMerge<{
1088
+ readonly sourceOfTruth: {
1089
+ readonly type: "hosted";
1090
+ readonly connectionStrings: undefined;
1091
+ readonly connectionString: undefined;
1092
+ };
1093
+ }, T>;
1094
+ declare function applyBranchDefaults<T extends BranchRenderedConfigBeforeDefaults>(config: T): DeepMerge<{
1095
+ readonly sourceOfTruth: {
1096
+ readonly type: "hosted";
1097
+ readonly connectionStrings: undefined;
1098
+ readonly connectionString: undefined;
1099
+ };
1100
+ }, T>;
1101
+ declare function applyEnvironmentDefaults<T extends EnvironmentRenderedConfigBeforeDefaults>(config: T): ApplyDefaults<typeof environmentConfigDefaults, ApplyDefaults<typeof branchConfigDefaults, ApplyDefaults<typeof projectConfigDefaults, T>>>;
1102
+ declare function applyOrganizationDefaults(config: OrganizationRenderedConfigBeforeDefaults): ApplyDefaults<typeof organizationConfigDefaults, ApplyDefaults<typeof environmentConfigDefaults, ApplyDefaults<typeof branchConfigDefaults, ApplyDefaults<typeof projectConfigDefaults, OrganizationRenderedConfigBeforeDefaults>>>>;
1103
+ declare function sanitizeProjectConfig<T extends ProjectRenderedConfigBeforeSanitization>(config: T): Promise<T & {
1104
+ sourceOfTruth: {
1105
+ readonly type: "neon";
1106
+ readonly connectionStrings: {
1107
+ readonly [x: string]: string;
1108
+ };
1109
+ readonly connectionString?: undefined;
1110
+ } | {
1111
+ readonly type: "postgres";
1112
+ readonly connectionString: string;
1113
+ readonly connectionStrings?: undefined;
1114
+ } | {
1115
+ readonly type: "hosted";
1116
+ readonly connectionStrings?: undefined;
1117
+ readonly connectionString?: undefined;
1118
+ };
1119
+ }>;
1120
+ declare function sanitizeBranchConfig<T extends BranchRenderedConfigBeforeSanitization>(config: T): Promise<T & {
1121
+ sourceOfTruth: {
1122
+ readonly type: "neon";
1123
+ readonly connectionStrings: {
1124
+ readonly [x: string]: string;
1125
+ };
1126
+ readonly connectionString?: undefined;
1127
+ } | {
1128
+ readonly type: "postgres";
1129
+ readonly connectionString: string;
1130
+ readonly connectionStrings?: undefined;
1131
+ } | {
1132
+ readonly type: "hosted";
1133
+ readonly connectionStrings?: undefined;
1134
+ readonly connectionString?: undefined;
1135
+ };
1136
+ }>;
1137
+ declare function sanitizeEnvironmentConfig<T extends EnvironmentRenderedConfigBeforeSanitization>(config: T): Promise<T & {
1138
+ sourceOfTruth: {
1139
+ readonly type: "neon";
1140
+ readonly connectionStrings: {
1141
+ readonly [x: string]: string;
1142
+ };
1143
+ readonly connectionString?: undefined;
1144
+ } | {
1145
+ readonly type: "postgres";
1146
+ readonly connectionString: string;
1147
+ readonly connectionStrings?: undefined;
1148
+ } | {
1149
+ readonly type: "hosted";
1150
+ readonly connectionStrings?: undefined;
1151
+ readonly connectionString?: undefined;
1152
+ };
1153
+ }>;
1154
+ declare function sanitizeOrganizationConfig(config: OrganizationRenderedConfigBeforeSanitization): Promise<{
1155
+ emails: {
1156
+ selectedThemeId: string;
1157
+ themes: {
1158
+ [x: string]: {
1159
+ displayName: string;
1160
+ tsxSource: string;
1161
+ };
1162
+ };
1163
+ templates: {
1164
+ [x: string]: {
1165
+ displayName: string;
1166
+ tsxSource: string;
1167
+ themeId: string | false | undefined;
1168
+ };
1169
+ };
1170
+ server: {
1171
+ host: string | undefined;
1172
+ port: number | undefined;
1173
+ username: string | undefined;
1174
+ password: string | undefined;
1175
+ isShared: boolean;
1176
+ senderName: string | undefined;
1177
+ senderEmail: string | undefined;
1178
+ };
1179
+ };
1180
+ sourceOfTruth: {
1181
+ type: "hosted" | "neon" | "postgres";
1182
+ connectionStrings: {
1183
+ [x: string]: string | undefined;
1184
+ } | undefined;
1185
+ connectionString: string | undefined;
1186
+ } & ({
1187
+ readonly type: "neon";
1188
+ readonly connectionStrings: {
1189
+ readonly [x: string]: string;
1190
+ };
1191
+ readonly connectionString?: undefined;
1192
+ } | {
1193
+ readonly type: "postgres";
1194
+ readonly connectionString: string;
1195
+ readonly connectionStrings?: undefined;
1196
+ } | {
1197
+ readonly type: "hosted";
1198
+ readonly connectionStrings?: undefined;
1199
+ readonly connectionString?: undefined;
1200
+ });
1201
+ domains: {
1202
+ allowLocalhost: boolean;
1203
+ trustedDomains: {
1204
+ [x: string]: {
1205
+ baseUrl: string | undefined;
1206
+ handlerPath: string;
1207
+ };
1208
+ };
1209
+ };
1210
+ teams: {
1211
+ createPersonalTeamOnSignUp: boolean;
1212
+ allowClientTeamCreation: boolean;
1213
+ };
1214
+ rbac: {
1215
+ permissions: {
1216
+ [x: string]: {
1217
+ description: string | undefined;
1218
+ scope: "team" | "project" | undefined;
1219
+ containedPermissionIds: {
1220
+ [x: string]: true | undefined;
1221
+ };
1222
+ };
1223
+ };
1224
+ defaultPermissions: {
1225
+ teamCreator: {
1226
+ [x: string]: true | undefined;
1227
+ };
1228
+ teamMember: {
1229
+ [x: string]: true | undefined;
1230
+ };
1231
+ signUp: {
1232
+ [x: string]: true | undefined;
1233
+ };
1234
+ };
1235
+ };
1236
+ apiKeys: {
1237
+ enabled: {
1238
+ user: boolean;
1239
+ team: boolean;
1240
+ };
1241
+ };
1242
+ auth: {
1243
+ password: {
1244
+ allowSignIn: boolean;
1245
+ };
1246
+ allowSignUp: boolean;
1247
+ otp: {
1248
+ allowSignIn: boolean;
1249
+ };
1250
+ passkey: {
1251
+ allowSignIn: boolean;
1252
+ };
1253
+ oauth: {
1254
+ accountMergeStrategy: "link_method" | "raise_error" | "allow_duplicates";
1255
+ providers: {
1256
+ [x: string]: {
1257
+ type: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined;
1258
+ clientId: string | undefined;
1259
+ clientSecret: string | undefined;
1260
+ allowSignIn: boolean;
1261
+ allowConnectedAccounts: boolean;
1262
+ isShared: boolean;
1263
+ facebookConfigId: string | undefined;
1264
+ microsoftTenantId: string | undefined;
1265
+ };
1266
+ };
1267
+ };
1268
+ };
1269
+ users: {
1270
+ allowClientUserDeletion: boolean;
1271
+ };
1272
+ }>;
1273
+ /**
1274
+ * Does not require a base config, and hence solely relies on the override itself to validate the config. If it returns
1275
+ * no error, you know that the
1276
+ *
1277
+ * It's crucial that our DB never contains any configs that are not valid according to this function, as this would mean
1278
+ * that the config object does not satisfy the ValidatedToHaveNoConfigOverrideErrors type (which is used as an assumption
1279
+ * in a whole bunch of places in the code).
1280
+ */
1281
+ declare function getConfigOverrideErrors<T extends yup.AnySchema>(schema: T, configOverride: unknown, options?: {
1282
+ allowPropertiesThatCanNoLongerBeOverridden?: boolean;
1283
+ }): Promise<Result<null, string>>;
1284
+ declare function assertNoConfigOverrideErrors<T extends yup.AnySchema>(schema: T, config: unknown, options?: {
1285
+ allowPropertiesThatCanNoLongerBeOverridden?: boolean;
1286
+ extraInfo?: any;
1287
+ }): Promise<void>;
1288
+ type _ValidatedToHaveNoConfigOverrideErrorsImpl<T> = IsUnion<T & object> extends true ? _ValidatedToHaveNoConfigOverrideErrorsImpl<CollapseObjectUnion<T & object> | Exclude<T, object>> : T extends object ? (T extends any[] ? T : {
1289
+ [K in keyof T]+?: _ValidatedToHaveNoConfigOverrideErrorsImpl<T[K]>;
1290
+ }) : T;
1291
+ type ValidatedToHaveNoConfigOverrideErrors<T extends yup.AnySchema> = _ValidatedToHaveNoConfigOverrideErrorsImpl<yup.InferType<T>>;
1292
+ /**
1293
+ * Checks whether there are any warnings in the incomplete config. A warning doesn't stop the config from being valid,
1294
+ * but may require action regardless.
1295
+ *
1296
+ * The DB can contain configs that are not valid according to this function, as long as they are valid according to
1297
+ * the getConfigOverrideErrors function. (This is necessary, because a changing base config may make an override invalid
1298
+ * that was previously valid.)
1299
+ */
1300
+ declare function getIncompleteConfigWarnings<T extends yup.AnySchema>(schema: T, incompleteConfig: Config): Promise<Result<null, string>>;
1301
+ type ValidatedToHaveNoIncompleteConfigWarnings<T extends yup.AnySchema> = yup.InferType<T>;
1302
+ type ProjectConfigNormalizedOverride = Expand<ValidatedToHaveNoConfigOverrideErrors<typeof projectConfigSchema>>;
1303
+ type BranchConfigNormalizedOverride = Expand<ValidatedToHaveNoConfigOverrideErrors<typeof branchConfigSchema>>;
1304
+ type EnvironmentConfigNormalizedOverride = Expand<ValidatedToHaveNoConfigOverrideErrors<typeof environmentConfigSchema>>;
1305
+ type OrganizationConfigNormalizedOverride = Expand<ValidatedToHaveNoConfigOverrideErrors<typeof organizationConfigSchema>>;
836
1306
  type ProjectConfigOverride = NormalizesTo<ProjectConfigNormalizedOverride>;
837
1307
  type BranchConfigOverride = NormalizesTo<BranchConfigNormalizedOverride>;
838
1308
  type EnvironmentConfigOverride = NormalizesTo<EnvironmentConfigNormalizedOverride>;
839
1309
  type OrganizationConfigOverride = NormalizesTo<OrganizationConfigNormalizedOverride>;
840
- type ProjectConfigOverrideOverride = Config & DeepPartial<ProjectConfigOverride>;
841
- type BranchConfigOverrideOverride = Config & DeepPartial<BranchConfigOverride>;
842
- type EnvironmentConfigOverrideOverride = Config & DeepPartial<EnvironmentConfigOverride>;
843
- type OrganizationConfigOverrideOverride = Config & DeepPartial<OrganizationConfigOverride>;
844
- type ProjectIncompleteConfig = ApplyDefaults<typeof projectConfigDefaults, ProjectConfigNormalizedOverride>;
845
- type BranchIncompleteConfig = ApplyDefaults<typeof branchConfigDefaults, ProjectIncompleteConfig & BranchConfigNormalizedOverride>;
846
- type EnvironmentIncompleteConfig = ApplyDefaults<typeof environmentConfigDefaults, BranchIncompleteConfig & EnvironmentConfigNormalizedOverride>;
847
- type OrganizationIncompleteConfig = ApplyDefaults<typeof organizationConfigDefaults, EnvironmentIncompleteConfig & OrganizationConfigNormalizedOverride>;
848
- type ProjectRenderedConfig = Omit<ProjectIncompleteConfig, keyof BranchConfigNormalizedOverride | keyof EnvironmentConfigNormalizedOverride | keyof OrganizationConfigNormalizedOverride>;
849
- type BranchRenderedConfig = Omit<BranchIncompleteConfig, keyof EnvironmentConfigNormalizedOverride | keyof OrganizationConfigNormalizedOverride>;
850
- type EnvironmentRenderedConfig = Omit<EnvironmentIncompleteConfig, keyof OrganizationConfigNormalizedOverride>;
851
- type OrganizationRenderedConfig = OrganizationIncompleteConfig;
1310
+ type ProjectConfigOverrideOverride = ProjectConfigOverride;
1311
+ type BranchConfigOverrideOverride = BranchConfigOverride;
1312
+ type EnvironmentConfigOverrideOverride = EnvironmentConfigOverride;
1313
+ type OrganizationConfigOverrideOverride = OrganizationConfigOverride;
1314
+ type ProjectIncompleteConfig = Expand<ProjectConfigNormalizedOverride>;
1315
+ type BranchIncompleteConfig = Expand<ProjectIncompleteConfig & BranchConfigNormalizedOverride>;
1316
+ type EnvironmentIncompleteConfig = Expand<BranchIncompleteConfig & EnvironmentConfigNormalizedOverride>;
1317
+ type OrganizationIncompleteConfig = Expand<EnvironmentIncompleteConfig & OrganizationConfigNormalizedOverride>;
1318
+ type ProjectRenderedConfigBeforeDefaults = Omit<ProjectIncompleteConfig, keyof BranchConfigNormalizedOverride | keyof EnvironmentConfigNormalizedOverride | keyof OrganizationConfigNormalizedOverride>;
1319
+ type BranchRenderedConfigBeforeDefaults = Omit<BranchIncompleteConfig, keyof EnvironmentConfigNormalizedOverride | keyof OrganizationConfigNormalizedOverride>;
1320
+ type EnvironmentRenderedConfigBeforeDefaults = Omit<EnvironmentIncompleteConfig, keyof OrganizationConfigNormalizedOverride>;
1321
+ type OrganizationRenderedConfigBeforeDefaults = OrganizationIncompleteConfig;
1322
+ type ProjectRenderedConfigBeforeSanitization = Expand<Awaited<ReturnType<typeof applyProjectDefaults<ProjectRenderedConfigBeforeDefaults>>>>;
1323
+ type BranchRenderedConfigBeforeSanitization = Expand<Awaited<ReturnType<typeof applyBranchDefaults<BranchRenderedConfigBeforeDefaults>>>>;
1324
+ type EnvironmentRenderedConfigBeforeSanitization = Expand<Awaited<ReturnType<typeof applyEnvironmentDefaults<EnvironmentRenderedConfigBeforeDefaults>>>>;
1325
+ type OrganizationRenderedConfigBeforeSanitization = Expand<Awaited<ReturnType<typeof applyOrganizationDefaults>>>;
1326
+ type ProjectRenderedConfig = Expand<Awaited<ReturnType<typeof sanitizeProjectConfig<ProjectRenderedConfigBeforeSanitization>>>>;
1327
+ type BranchRenderedConfig = Expand<Awaited<ReturnType<typeof sanitizeBranchConfig<BranchRenderedConfigBeforeSanitization>>>>;
1328
+ type EnvironmentRenderedConfig = Expand<Awaited<ReturnType<typeof sanitizeEnvironmentConfig<EnvironmentRenderedConfigBeforeSanitization>>>>;
1329
+ type OrganizationRenderedConfig = Expand<Awaited<ReturnType<typeof sanitizeOrganizationConfig>>>;
852
1330
 
853
- export { type ApplyDefaults, type BranchConfigNormalizedOverride, type BranchConfigOverride, type BranchConfigOverrideOverride, type BranchConfigStrippedNormalizedOverride, type BranchIncompleteConfig, type BranchRenderedConfig, type ConfigLevel, type DeepReplaceAllowFunctionsForObjects, type DeepReplaceFunctionsWithObjects, type EnvironmentConfigNormalizedOverride, type EnvironmentConfigOverride, type EnvironmentConfigOverrideOverride, type EnvironmentConfigStrippedNormalizedOverride, type EnvironmentIncompleteConfig, type EnvironmentRenderedConfig, type OrganizationConfigNormalizedOverride, type OrganizationConfigOverride, type OrganizationConfigOverrideOverride, type OrganizationConfigStrippedNormalizedOverride, type OrganizationIncompleteConfig, type OrganizationRenderedConfig, type ProjectConfigNormalizedOverride, type ProjectConfigOverride, type ProjectConfigOverrideOverride, type ProjectConfigStrippedNormalizedOverride, type ProjectIncompleteConfig, type ProjectRenderedConfig, applyDefaults, branchConfigDefaults, branchConfigSchema, configLevels, environmentConfigDefaults, environmentConfigSchema, organizationConfigDefaults, organizationConfigSchema, projectConfigDefaults, projectConfigSchema };
1331
+ export { type BranchConfigOverride, type BranchConfigOverrideOverride, type BranchIncompleteConfig, type BranchRenderedConfig, type ConfigLevel, type EnvironmentConfigOverride, type EnvironmentConfigOverrideOverride, type EnvironmentIncompleteConfig, type EnvironmentRenderedConfig, type OrganizationConfigOverride, type OrganizationConfigOverrideOverride, type OrganizationIncompleteConfig, type OrganizationRenderedConfig, type ProjectConfigOverride, type ProjectConfigOverrideOverride, type ProjectIncompleteConfig, type ProjectRenderedConfig, type ValidatedToHaveNoConfigOverrideErrors, type ValidatedToHaveNoIncompleteConfigWarnings, applyBranchDefaults, applyEnvironmentDefaults, applyOrganizationDefaults, applyProjectDefaults, assertNoConfigOverrideErrors, branchConfigSchema, configLevels, environmentConfigSchema, getConfigOverrideErrors, getIncompleteConfigWarnings, migrateConfigOverride, organizationConfigSchema, projectConfigSchema, sanitizeBranchConfig, sanitizeEnvironmentConfig, sanitizeOrganizationConfig, sanitizeProjectConfig };