@secretenvs/contracts 1.6.0 → 1.7.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.cjs +55 -4
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +54 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
AdminUserDetailDto: () => AdminUserDetailDto,
|
|
27
27
|
AdminUserDto: () => AdminUserDto,
|
|
28
28
|
ApiErrorBody: () => ApiErrorBody,
|
|
29
|
+
AuthOptionsDto: () => AuthOptionsDto,
|
|
29
30
|
BulkUpsertVariablesInput: () => BulkUpsertVariablesInput,
|
|
30
31
|
BulkUpsertVariablesResponse: () => BulkUpsertVariablesResponse,
|
|
31
32
|
CSRF_HEADER_NAME: () => CSRF_HEADER_NAME,
|
|
@@ -162,7 +163,18 @@ var UserDto = import_zod2.z.object({
|
|
|
162
163
|
// Name the user gave the authenticator app at setup; null while 2FA is off.
|
|
163
164
|
twoFactorAppName: import_zod2.z.string().nullable(),
|
|
164
165
|
// Whether the account may use the /admin pages (set directly in the database).
|
|
165
|
-
isSuperAdmin: import_zod2.z.boolean()
|
|
166
|
+
isSuperAdmin: import_zod2.z.boolean(),
|
|
167
|
+
// Linked to a SIAM account: name and email follow SIAM, so they are not edited here.
|
|
168
|
+
managedBySiam: import_zod2.z.boolean(),
|
|
169
|
+
// Has a password of its own. Accounts created through SIAM do not, and SIAM handles their
|
|
170
|
+
// password and two-factor authentication.
|
|
171
|
+
hasPassword: import_zod2.z.boolean()
|
|
172
|
+
}).strict();
|
|
173
|
+
var AuthOptionsDto = import_zod2.z.object({
|
|
174
|
+
// Sign-in through SIAM is configured on this server.
|
|
175
|
+
siam: import_zod2.z.boolean(),
|
|
176
|
+
// Where people manage their SIAM account; null when it is not configured or SIAM is off.
|
|
177
|
+
profileUrl: import_zod2.z.string().nullable()
|
|
166
178
|
}).strict();
|
|
167
179
|
var TwoFactorSetupDto = import_zod2.z.object({ secret: import_zod2.z.string(), otpauthUri: import_zod2.z.string() }).strict();
|
|
168
180
|
var TwoFactorSetupInput = import_zod2.z.object({ password: import_zod2.z.string().min(1).max(MAX_PASSWORD_LENGTH) }).strict();
|
|
@@ -327,6 +339,8 @@ var AdminUserDto = import_zod2.z.object({
|
|
|
327
339
|
// Null while the account is enabled.
|
|
328
340
|
disabledAt: isoDate.nullable(),
|
|
329
341
|
isSuperAdmin: import_zod2.z.boolean(),
|
|
342
|
+
// Linked to a SIAM account: its name and email belong to SIAM and cannot be edited here.
|
|
343
|
+
managedBySiam: import_zod2.z.boolean(),
|
|
330
344
|
projectCount: import_zod2.z.number().int().min(0)
|
|
331
345
|
}).strict();
|
|
332
346
|
var AdminUserDetailDto = AdminUserDto.extend({
|
|
@@ -395,10 +409,46 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
395
409
|
TRUST_PROXY: import_zod3.z.coerce.number().int().min(0).max(10).default(0),
|
|
396
410
|
// Shared secret for the daily expiry-reminder call (see docs/DEPLOYMENT.md). Unset turns
|
|
397
411
|
// that endpoint off.
|
|
398
|
-
CRON_SECRET: import_zod3.z.string().min(32).max(256).optional()
|
|
399
|
-
|
|
412
|
+
CRON_SECRET: import_zod3.z.string().min(32).max(256).optional(),
|
|
413
|
+
// Sign-in through SIAM (https://siam.ankityadav.net.in/docs). The four IAM_* values go
|
|
414
|
+
// together: leave them all unset to keep SIAM sign-in off.
|
|
415
|
+
IAM_BASE_URL: import_zod3.z.url().optional(),
|
|
416
|
+
IAM_CLIENT_ID: import_zod3.z.string().min(1).max(256).optional(),
|
|
417
|
+
IAM_CLIENT_SECRET: import_zod3.z.string().min(1).max(512).optional(),
|
|
418
|
+
IAM_REDIRECT_URI: import_zod3.z.url().optional(),
|
|
419
|
+
// The page where people manage their SIAM account (name, email, password, two-factor). The
|
|
420
|
+
// account page links to it. Optional: without it the page just says to use SIAM.
|
|
421
|
+
IAM_PROFILE_URL: import_zod3.z.url().refine(
|
|
422
|
+
(value) => ["http:", "https:"].includes(new URL(value).protocol),
|
|
423
|
+
"Expected an HTTP(S) URL"
|
|
424
|
+
).optional(),
|
|
425
|
+
// A SIAM permission the user must hold to get in (e.g. `secretenvs.access`). Unset: any
|
|
426
|
+
// active SIAM account may sign in. A SIAM superadmin always may.
|
|
427
|
+
IAM_REQUIRED_PERMISSION: import_zod3.z.string().min(1).max(128).optional(),
|
|
428
|
+
// Link a SIAM sign-in to an existing local account with the same email. Off by default,
|
|
429
|
+
// because it is only safe when SIAM verifies that people own the email they sign up with.
|
|
430
|
+
IAM_LINK_BY_EMAIL: import_zod3.z.enum(["true", "false"]).optional()
|
|
431
|
+
}).strict().superRefine((environment, context) => {
|
|
432
|
+
const names = [
|
|
433
|
+
"IAM_BASE_URL",
|
|
434
|
+
"IAM_CLIENT_ID",
|
|
435
|
+
"IAM_CLIENT_SECRET",
|
|
436
|
+
"IAM_REDIRECT_URI"
|
|
437
|
+
];
|
|
438
|
+
const missing = names.filter((name2) => environment[name2] === void 0);
|
|
439
|
+
if (missing.length > 0 && missing.length < names.length) {
|
|
440
|
+
for (const name2 of missing) {
|
|
441
|
+
context.addIssue({
|
|
442
|
+
code: "custom",
|
|
443
|
+
path: [name2],
|
|
444
|
+
message: "Required when any other IAM_* value is set"
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}).transform((environment) => ({
|
|
400
449
|
...environment,
|
|
401
|
-
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true"
|
|
450
|
+
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true",
|
|
451
|
+
IAM_LINK_BY_EMAIL: environment.IAM_LINK_BY_EMAIL === "true"
|
|
402
452
|
}));
|
|
403
453
|
// Annotate the CommonJS export names for ESM import in node:
|
|
404
454
|
0 && (module.exports = {
|
|
@@ -408,6 +458,7 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
408
458
|
AdminUserDetailDto,
|
|
409
459
|
AdminUserDto,
|
|
410
460
|
ApiErrorBody,
|
|
461
|
+
AuthOptionsDto,
|
|
411
462
|
BulkUpsertVariablesInput,
|
|
412
463
|
BulkUpsertVariablesResponse,
|
|
413
464
|
CSRF_HEADER_NAME,
|
package/dist/index.d.cts
CHANGED
|
@@ -70,8 +70,15 @@ declare const UserDto: z.ZodObject<{
|
|
|
70
70
|
twoFactorEnabled: z.ZodBoolean;
|
|
71
71
|
twoFactorAppName: z.ZodNullable<z.ZodString>;
|
|
72
72
|
isSuperAdmin: z.ZodBoolean;
|
|
73
|
+
managedBySiam: z.ZodBoolean;
|
|
74
|
+
hasPassword: z.ZodBoolean;
|
|
73
75
|
}, z.core.$strict>;
|
|
74
76
|
type UserDto = z.infer<typeof UserDto>;
|
|
77
|
+
declare const AuthOptionsDto: z.ZodObject<{
|
|
78
|
+
siam: z.ZodBoolean;
|
|
79
|
+
profileUrl: z.ZodNullable<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>;
|
|
81
|
+
type AuthOptionsDto = z.infer<typeof AuthOptionsDto>;
|
|
75
82
|
declare const TwoFactorSetupDto: z.ZodObject<{
|
|
76
83
|
secret: z.ZodString;
|
|
77
84
|
otpauthUri: z.ZodString;
|
|
@@ -391,6 +398,7 @@ declare const AdminUserDto: z.ZodObject<{
|
|
|
391
398
|
createdAt: z.ZodISODateTime;
|
|
392
399
|
disabledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
393
400
|
isSuperAdmin: z.ZodBoolean;
|
|
401
|
+
managedBySiam: z.ZodBoolean;
|
|
394
402
|
projectCount: z.ZodNumber;
|
|
395
403
|
}, z.core.$strict>;
|
|
396
404
|
type AdminUserDto = z.infer<typeof AdminUserDto>;
|
|
@@ -401,6 +409,7 @@ declare const AdminUserDetailDto: z.ZodObject<{
|
|
|
401
409
|
createdAt: z.ZodISODateTime;
|
|
402
410
|
disabledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
403
411
|
isSuperAdmin: z.ZodBoolean;
|
|
412
|
+
managedBySiam: z.ZodBoolean;
|
|
404
413
|
projectCount: z.ZodNumber;
|
|
405
414
|
projects: z.ZodArray<z.ZodObject<{
|
|
406
415
|
id: z.ZodUUID;
|
|
@@ -502,8 +511,19 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
502
511
|
VARIABLE_HISTORY_LIMIT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
503
512
|
TRUST_PROXY: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
504
513
|
CRON_SECRET: z.ZodOptional<z.ZodString>;
|
|
514
|
+
IAM_BASE_URL: z.ZodOptional<z.ZodURL>;
|
|
515
|
+
IAM_CLIENT_ID: z.ZodOptional<z.ZodString>;
|
|
516
|
+
IAM_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
|
|
517
|
+
IAM_REDIRECT_URI: z.ZodOptional<z.ZodURL>;
|
|
518
|
+
IAM_PROFILE_URL: z.ZodOptional<z.ZodURL>;
|
|
519
|
+
IAM_REQUIRED_PERMISSION: z.ZodOptional<z.ZodString>;
|
|
520
|
+
IAM_LINK_BY_EMAIL: z.ZodOptional<z.ZodEnum<{
|
|
521
|
+
true: "true";
|
|
522
|
+
false: "false";
|
|
523
|
+
}>>;
|
|
505
524
|
}, z.core.$strict>, z.ZodTransform<{
|
|
506
525
|
COOKIE_SECURE: boolean;
|
|
526
|
+
IAM_LINK_BY_EMAIL: boolean;
|
|
507
527
|
NODE_ENV: "development" | "test" | "production";
|
|
508
528
|
HOST: string;
|
|
509
529
|
PORT: number;
|
|
@@ -513,6 +533,12 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
513
533
|
VARIABLE_HISTORY_LIMIT: number;
|
|
514
534
|
TRUST_PROXY: number;
|
|
515
535
|
CRON_SECRET?: string | undefined;
|
|
536
|
+
IAM_BASE_URL?: string | undefined;
|
|
537
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
538
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
539
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
540
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
541
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
516
542
|
}, {
|
|
517
543
|
NODE_ENV: "development" | "test" | "production";
|
|
518
544
|
HOST: string;
|
|
@@ -524,7 +550,14 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
524
550
|
TRUST_PROXY: number;
|
|
525
551
|
COOKIE_SECURE?: "true" | "false" | undefined;
|
|
526
552
|
CRON_SECRET?: string | undefined;
|
|
553
|
+
IAM_BASE_URL?: string | undefined;
|
|
554
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
555
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
556
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
557
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
558
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
559
|
+
IAM_LINK_BY_EMAIL?: "true" | "false" | undefined;
|
|
527
560
|
}>>;
|
|
528
561
|
type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
|
|
529
562
|
|
|
530
|
-
export { AddMemberInput, AdminProjectDto, AdminUpdateUserInput, AdminUserDetailDto, AdminUserDto, type ApiEnvironment, ApiErrorBody, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EXPIRING_SOON_DAYS, EXPIRY_REMINDER_DAYS, EnvironmentDto, ErrorCode, ExpiringSecretDto, ListVersionsQuery, LoginInput, MAX_AUTH_CODE_LENGTH, MAX_BULK_VARIABLES, MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_PASSWORD_LENGTH, MAX_VALUE_BYTES, MAX_VERSIONS_LIMIT, MIN_PASSWORD_LENGTH, MemberDto, PaginatedVersionsResponse, ProjectDto, ProjectRole, ProjectSummaryDto, RECOVERY_CODE_COUNT, RecoveryCodesDto, RegisterInput, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TOTP_DIGITS, TokenAccess, TokenDto, TwoFactorConfirmInput, TwoFactorEnableInput, TwoFactorSetupDto, TwoFactorSetupInput, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
|
563
|
+
export { AddMemberInput, AdminProjectDto, AdminUpdateUserInput, AdminUserDetailDto, AdminUserDto, type ApiEnvironment, ApiErrorBody, AuthOptionsDto, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EXPIRING_SOON_DAYS, EXPIRY_REMINDER_DAYS, EnvironmentDto, ErrorCode, ExpiringSecretDto, ListVersionsQuery, LoginInput, MAX_AUTH_CODE_LENGTH, MAX_BULK_VARIABLES, MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_PASSWORD_LENGTH, MAX_VALUE_BYTES, MAX_VERSIONS_LIMIT, MIN_PASSWORD_LENGTH, MemberDto, PaginatedVersionsResponse, ProjectDto, ProjectRole, ProjectSummaryDto, RECOVERY_CODE_COUNT, RecoveryCodesDto, RegisterInput, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TOTP_DIGITS, TokenAccess, TokenDto, TwoFactorConfirmInput, TwoFactorEnableInput, TwoFactorSetupDto, TwoFactorSetupInput, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -70,8 +70,15 @@ declare const UserDto: z.ZodObject<{
|
|
|
70
70
|
twoFactorEnabled: z.ZodBoolean;
|
|
71
71
|
twoFactorAppName: z.ZodNullable<z.ZodString>;
|
|
72
72
|
isSuperAdmin: z.ZodBoolean;
|
|
73
|
+
managedBySiam: z.ZodBoolean;
|
|
74
|
+
hasPassword: z.ZodBoolean;
|
|
73
75
|
}, z.core.$strict>;
|
|
74
76
|
type UserDto = z.infer<typeof UserDto>;
|
|
77
|
+
declare const AuthOptionsDto: z.ZodObject<{
|
|
78
|
+
siam: z.ZodBoolean;
|
|
79
|
+
profileUrl: z.ZodNullable<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>;
|
|
81
|
+
type AuthOptionsDto = z.infer<typeof AuthOptionsDto>;
|
|
75
82
|
declare const TwoFactorSetupDto: z.ZodObject<{
|
|
76
83
|
secret: z.ZodString;
|
|
77
84
|
otpauthUri: z.ZodString;
|
|
@@ -391,6 +398,7 @@ declare const AdminUserDto: z.ZodObject<{
|
|
|
391
398
|
createdAt: z.ZodISODateTime;
|
|
392
399
|
disabledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
393
400
|
isSuperAdmin: z.ZodBoolean;
|
|
401
|
+
managedBySiam: z.ZodBoolean;
|
|
394
402
|
projectCount: z.ZodNumber;
|
|
395
403
|
}, z.core.$strict>;
|
|
396
404
|
type AdminUserDto = z.infer<typeof AdminUserDto>;
|
|
@@ -401,6 +409,7 @@ declare const AdminUserDetailDto: z.ZodObject<{
|
|
|
401
409
|
createdAt: z.ZodISODateTime;
|
|
402
410
|
disabledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
403
411
|
isSuperAdmin: z.ZodBoolean;
|
|
412
|
+
managedBySiam: z.ZodBoolean;
|
|
404
413
|
projectCount: z.ZodNumber;
|
|
405
414
|
projects: z.ZodArray<z.ZodObject<{
|
|
406
415
|
id: z.ZodUUID;
|
|
@@ -502,8 +511,19 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
502
511
|
VARIABLE_HISTORY_LIMIT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
503
512
|
TRUST_PROXY: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
504
513
|
CRON_SECRET: z.ZodOptional<z.ZodString>;
|
|
514
|
+
IAM_BASE_URL: z.ZodOptional<z.ZodURL>;
|
|
515
|
+
IAM_CLIENT_ID: z.ZodOptional<z.ZodString>;
|
|
516
|
+
IAM_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
|
|
517
|
+
IAM_REDIRECT_URI: z.ZodOptional<z.ZodURL>;
|
|
518
|
+
IAM_PROFILE_URL: z.ZodOptional<z.ZodURL>;
|
|
519
|
+
IAM_REQUIRED_PERMISSION: z.ZodOptional<z.ZodString>;
|
|
520
|
+
IAM_LINK_BY_EMAIL: z.ZodOptional<z.ZodEnum<{
|
|
521
|
+
true: "true";
|
|
522
|
+
false: "false";
|
|
523
|
+
}>>;
|
|
505
524
|
}, z.core.$strict>, z.ZodTransform<{
|
|
506
525
|
COOKIE_SECURE: boolean;
|
|
526
|
+
IAM_LINK_BY_EMAIL: boolean;
|
|
507
527
|
NODE_ENV: "development" | "test" | "production";
|
|
508
528
|
HOST: string;
|
|
509
529
|
PORT: number;
|
|
@@ -513,6 +533,12 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
513
533
|
VARIABLE_HISTORY_LIMIT: number;
|
|
514
534
|
TRUST_PROXY: number;
|
|
515
535
|
CRON_SECRET?: string | undefined;
|
|
536
|
+
IAM_BASE_URL?: string | undefined;
|
|
537
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
538
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
539
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
540
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
541
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
516
542
|
}, {
|
|
517
543
|
NODE_ENV: "development" | "test" | "production";
|
|
518
544
|
HOST: string;
|
|
@@ -524,7 +550,14 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
524
550
|
TRUST_PROXY: number;
|
|
525
551
|
COOKIE_SECURE?: "true" | "false" | undefined;
|
|
526
552
|
CRON_SECRET?: string | undefined;
|
|
553
|
+
IAM_BASE_URL?: string | undefined;
|
|
554
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
555
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
556
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
557
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
558
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
559
|
+
IAM_LINK_BY_EMAIL?: "true" | "false" | undefined;
|
|
527
560
|
}>>;
|
|
528
561
|
type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
|
|
529
562
|
|
|
530
|
-
export { AddMemberInput, AdminProjectDto, AdminUpdateUserInput, AdminUserDetailDto, AdminUserDto, type ApiEnvironment, ApiErrorBody, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EXPIRING_SOON_DAYS, EXPIRY_REMINDER_DAYS, EnvironmentDto, ErrorCode, ExpiringSecretDto, ListVersionsQuery, LoginInput, MAX_AUTH_CODE_LENGTH, MAX_BULK_VARIABLES, MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_PASSWORD_LENGTH, MAX_VALUE_BYTES, MAX_VERSIONS_LIMIT, MIN_PASSWORD_LENGTH, MemberDto, PaginatedVersionsResponse, ProjectDto, ProjectRole, ProjectSummaryDto, RECOVERY_CODE_COUNT, RecoveryCodesDto, RegisterInput, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TOTP_DIGITS, TokenAccess, TokenDto, TwoFactorConfirmInput, TwoFactorEnableInput, TwoFactorSetupDto, TwoFactorSetupInput, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
|
563
|
+
export { AddMemberInput, AdminProjectDto, AdminUpdateUserInput, AdminUserDetailDto, AdminUserDto, type ApiEnvironment, ApiErrorBody, AuthOptionsDto, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EXPIRING_SOON_DAYS, EXPIRY_REMINDER_DAYS, EnvironmentDto, ErrorCode, ExpiringSecretDto, ListVersionsQuery, LoginInput, MAX_AUTH_CODE_LENGTH, MAX_BULK_VARIABLES, MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_PASSWORD_LENGTH, MAX_VALUE_BYTES, MAX_VERSIONS_LIMIT, MIN_PASSWORD_LENGTH, MemberDto, PaginatedVersionsResponse, ProjectDto, ProjectRole, ProjectSummaryDto, RECOVERY_CODE_COUNT, RecoveryCodesDto, RegisterInput, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TOTP_DIGITS, TokenAccess, TokenDto, TwoFactorConfirmInput, TwoFactorEnableInput, TwoFactorSetupDto, TwoFactorSetupInput, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,18 @@ var UserDto = z2.object({
|
|
|
72
72
|
// Name the user gave the authenticator app at setup; null while 2FA is off.
|
|
73
73
|
twoFactorAppName: z2.string().nullable(),
|
|
74
74
|
// Whether the account may use the /admin pages (set directly in the database).
|
|
75
|
-
isSuperAdmin: z2.boolean()
|
|
75
|
+
isSuperAdmin: z2.boolean(),
|
|
76
|
+
// Linked to a SIAM account: name and email follow SIAM, so they are not edited here.
|
|
77
|
+
managedBySiam: z2.boolean(),
|
|
78
|
+
// Has a password of its own. Accounts created through SIAM do not, and SIAM handles their
|
|
79
|
+
// password and two-factor authentication.
|
|
80
|
+
hasPassword: z2.boolean()
|
|
81
|
+
}).strict();
|
|
82
|
+
var AuthOptionsDto = z2.object({
|
|
83
|
+
// Sign-in through SIAM is configured on this server.
|
|
84
|
+
siam: z2.boolean(),
|
|
85
|
+
// Where people manage their SIAM account; null when it is not configured or SIAM is off.
|
|
86
|
+
profileUrl: z2.string().nullable()
|
|
76
87
|
}).strict();
|
|
77
88
|
var TwoFactorSetupDto = z2.object({ secret: z2.string(), otpauthUri: z2.string() }).strict();
|
|
78
89
|
var TwoFactorSetupInput = z2.object({ password: z2.string().min(1).max(MAX_PASSWORD_LENGTH) }).strict();
|
|
@@ -237,6 +248,8 @@ var AdminUserDto = z2.object({
|
|
|
237
248
|
// Null while the account is enabled.
|
|
238
249
|
disabledAt: isoDate.nullable(),
|
|
239
250
|
isSuperAdmin: z2.boolean(),
|
|
251
|
+
// Linked to a SIAM account: its name and email belong to SIAM and cannot be edited here.
|
|
252
|
+
managedBySiam: z2.boolean(),
|
|
240
253
|
projectCount: z2.number().int().min(0)
|
|
241
254
|
}).strict();
|
|
242
255
|
var AdminUserDetailDto = AdminUserDto.extend({
|
|
@@ -305,10 +318,46 @@ var apiEnvironmentSchema = z3.object({
|
|
|
305
318
|
TRUST_PROXY: z3.coerce.number().int().min(0).max(10).default(0),
|
|
306
319
|
// Shared secret for the daily expiry-reminder call (see docs/DEPLOYMENT.md). Unset turns
|
|
307
320
|
// that endpoint off.
|
|
308
|
-
CRON_SECRET: z3.string().min(32).max(256).optional()
|
|
309
|
-
|
|
321
|
+
CRON_SECRET: z3.string().min(32).max(256).optional(),
|
|
322
|
+
// Sign-in through SIAM (https://siam.ankityadav.net.in/docs). The four IAM_* values go
|
|
323
|
+
// together: leave them all unset to keep SIAM sign-in off.
|
|
324
|
+
IAM_BASE_URL: z3.url().optional(),
|
|
325
|
+
IAM_CLIENT_ID: z3.string().min(1).max(256).optional(),
|
|
326
|
+
IAM_CLIENT_SECRET: z3.string().min(1).max(512).optional(),
|
|
327
|
+
IAM_REDIRECT_URI: z3.url().optional(),
|
|
328
|
+
// The page where people manage their SIAM account (name, email, password, two-factor). The
|
|
329
|
+
// account page links to it. Optional: without it the page just says to use SIAM.
|
|
330
|
+
IAM_PROFILE_URL: z3.url().refine(
|
|
331
|
+
(value) => ["http:", "https:"].includes(new URL(value).protocol),
|
|
332
|
+
"Expected an HTTP(S) URL"
|
|
333
|
+
).optional(),
|
|
334
|
+
// A SIAM permission the user must hold to get in (e.g. `secretenvs.access`). Unset: any
|
|
335
|
+
// active SIAM account may sign in. A SIAM superadmin always may.
|
|
336
|
+
IAM_REQUIRED_PERMISSION: z3.string().min(1).max(128).optional(),
|
|
337
|
+
// Link a SIAM sign-in to an existing local account with the same email. Off by default,
|
|
338
|
+
// because it is only safe when SIAM verifies that people own the email they sign up with.
|
|
339
|
+
IAM_LINK_BY_EMAIL: z3.enum(["true", "false"]).optional()
|
|
340
|
+
}).strict().superRefine((environment, context) => {
|
|
341
|
+
const names = [
|
|
342
|
+
"IAM_BASE_URL",
|
|
343
|
+
"IAM_CLIENT_ID",
|
|
344
|
+
"IAM_CLIENT_SECRET",
|
|
345
|
+
"IAM_REDIRECT_URI"
|
|
346
|
+
];
|
|
347
|
+
const missing = names.filter((name2) => environment[name2] === void 0);
|
|
348
|
+
if (missing.length > 0 && missing.length < names.length) {
|
|
349
|
+
for (const name2 of missing) {
|
|
350
|
+
context.addIssue({
|
|
351
|
+
code: "custom",
|
|
352
|
+
path: [name2],
|
|
353
|
+
message: "Required when any other IAM_* value is set"
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}).transform((environment) => ({
|
|
310
358
|
...environment,
|
|
311
|
-
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true"
|
|
359
|
+
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true",
|
|
360
|
+
IAM_LINK_BY_EMAIL: environment.IAM_LINK_BY_EMAIL === "true"
|
|
312
361
|
}));
|
|
313
362
|
export {
|
|
314
363
|
AddMemberInput,
|
|
@@ -317,6 +366,7 @@ export {
|
|
|
317
366
|
AdminUserDetailDto,
|
|
318
367
|
AdminUserDto,
|
|
319
368
|
ApiErrorBody,
|
|
369
|
+
AuthOptionsDto,
|
|
320
370
|
BulkUpsertVariablesInput,
|
|
321
371
|
BulkUpsertVariablesResponse,
|
|
322
372
|
CSRF_HEADER_NAME,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secretenvs/contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Shared Zod schemas, types and constants for the SecretEnvs API, SDK and CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ankityadavpurson/secretenvs#readme",
|