@secretenvs/contracts 1.6.0 → 2.0.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 +62 -62
- package/dist/index.d.cts +41 -47
- package/dist/index.d.ts +41 -47
- package/dist/index.js +60 -50
- 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,
|
|
@@ -43,37 +44,26 @@ __export(index_exports, {
|
|
|
43
44
|
ErrorCode: () => ErrorCode,
|
|
44
45
|
ExpiringSecretDto: () => ExpiringSecretDto,
|
|
45
46
|
ListVersionsQuery: () => ListVersionsQuery,
|
|
46
|
-
LoginInput: () => LoginInput,
|
|
47
|
-
MAX_AUTH_CODE_LENGTH: () => MAX_AUTH_CODE_LENGTH,
|
|
48
47
|
MAX_BULK_VARIABLES: () => MAX_BULK_VARIABLES,
|
|
49
48
|
MAX_KEY_LENGTH: () => MAX_KEY_LENGTH,
|
|
50
49
|
MAX_NAME_LENGTH: () => MAX_NAME_LENGTH,
|
|
51
|
-
MAX_PASSWORD_LENGTH: () => MAX_PASSWORD_LENGTH,
|
|
52
50
|
MAX_VALUE_BYTES: () => MAX_VALUE_BYTES,
|
|
53
51
|
MAX_VERSIONS_LIMIT: () => MAX_VERSIONS_LIMIT,
|
|
54
|
-
MIN_PASSWORD_LENGTH: () => MIN_PASSWORD_LENGTH,
|
|
55
52
|
MemberDto: () => MemberDto,
|
|
56
53
|
PaginatedVersionsResponse: () => PaginatedVersionsResponse,
|
|
57
54
|
ProjectDto: () => ProjectDto,
|
|
58
55
|
ProjectRole: () => ProjectRole,
|
|
59
56
|
ProjectSummaryDto: () => ProjectSummaryDto,
|
|
60
|
-
RECOVERY_CODE_COUNT: () => RECOVERY_CODE_COUNT,
|
|
61
|
-
RecoveryCodesDto: () => RecoveryCodesDto,
|
|
62
|
-
RegisterInput: () => RegisterInput,
|
|
63
57
|
ResolvedVariableDto: () => ResolvedVariableDto,
|
|
64
58
|
ResolvedVariablesResponse: () => ResolvedVariablesResponse,
|
|
65
59
|
SLUG_REGEX: () => SLUG_REGEX,
|
|
66
60
|
SdkEnvironmentDto: () => SdkEnvironmentDto,
|
|
61
|
+
SdkMeDto: () => SdkMeDto,
|
|
67
62
|
SdkProjectDto: () => SdkProjectDto,
|
|
68
63
|
SharedVariableMetaDto: () => SharedVariableMetaDto,
|
|
69
64
|
TOKEN_PREFIX: () => TOKEN_PREFIX,
|
|
70
|
-
TOTP_DIGITS: () => TOTP_DIGITS,
|
|
71
65
|
TokenAccess: () => TokenAccess,
|
|
72
66
|
TokenDto: () => TokenDto,
|
|
73
|
-
TwoFactorConfirmInput: () => TwoFactorConfirmInput,
|
|
74
|
-
TwoFactorEnableInput: () => TwoFactorEnableInput,
|
|
75
|
-
TwoFactorSetupDto: () => TwoFactorSetupDto,
|
|
76
|
-
TwoFactorSetupInput: () => TwoFactorSetupInput,
|
|
77
67
|
UpdateEnvironmentInput: () => UpdateEnvironmentInput,
|
|
78
68
|
UpdateMemberInput: () => UpdateMemberInput,
|
|
79
69
|
UpdateProjectInput: () => UpdateProjectInput,
|
|
@@ -100,16 +90,11 @@ var MAX_NAME_LENGTH = 64;
|
|
|
100
90
|
var MAX_BULK_VARIABLES = 500;
|
|
101
91
|
var EXPIRING_SOON_DAYS = 7;
|
|
102
92
|
var EXPIRY_REMINDER_DAYS = [30, 7, 1];
|
|
103
|
-
var MIN_PASSWORD_LENGTH = 12;
|
|
104
|
-
var MAX_PASSWORD_LENGTH = 256;
|
|
105
93
|
var DEFAULT_VERSIONS_LIMIT = 20;
|
|
106
94
|
var MAX_VERSIONS_LIMIT = 100;
|
|
107
95
|
var CSRF_HEADER_NAME = "x-requested-with";
|
|
108
96
|
var CSRF_HEADER_VALUE = "secretenvs-web";
|
|
109
97
|
var TOKEN_PREFIX = "svt_";
|
|
110
|
-
var TOTP_DIGITS = 6;
|
|
111
|
-
var RECOVERY_CODE_COUNT = 10;
|
|
112
|
-
var MAX_AUTH_CODE_LENGTH = 32;
|
|
113
98
|
|
|
114
99
|
// src/enums.ts
|
|
115
100
|
var import_zod = require("zod");
|
|
@@ -120,7 +105,6 @@ var ErrorCode = import_zod.z.enum([
|
|
|
120
105
|
"VALIDATION_ERROR",
|
|
121
106
|
"BAD_REQUEST",
|
|
122
107
|
"UNAUTHENTICATED",
|
|
123
|
-
"MFA_REQUIRED",
|
|
124
108
|
"FORBIDDEN",
|
|
125
109
|
"NOT_FOUND",
|
|
126
110
|
"CONFLICT",
|
|
@@ -145,36 +129,19 @@ var variableValue = import_zod2.z.string().refine(
|
|
|
145
129
|
var secretExpiry = isoDate.refine((value) => Date.parse(value) > Date.now(), {
|
|
146
130
|
message: "Expiry must be in the future"
|
|
147
131
|
}).nullable();
|
|
148
|
-
var password = import_zod2.z.string().min(MIN_PASSWORD_LENGTH).max(MAX_PASSWORD_LENGTH);
|
|
149
|
-
var RegisterInput = import_zod2.z.object({ email, name, password }).strict();
|
|
150
|
-
var authCode = import_zod2.z.string().trim().min(1, "Enter your code").max(MAX_AUTH_CODE_LENGTH);
|
|
151
|
-
var LoginInput = import_zod2.z.object({
|
|
152
|
-
email,
|
|
153
|
-
password: import_zod2.z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
154
|
-
code: authCode.optional()
|
|
155
|
-
}).strict();
|
|
156
132
|
var UserDto = import_zod2.z.object({
|
|
157
133
|
id,
|
|
158
134
|
email,
|
|
159
135
|
name,
|
|
160
136
|
createdAt: isoDate,
|
|
161
|
-
twoFactorEnabled: import_zod2.z.boolean(),
|
|
162
|
-
// Name the user gave the authenticator app at setup; null while 2FA is off.
|
|
163
|
-
twoFactorAppName: import_zod2.z.string().nullable(),
|
|
164
137
|
// Whether the account may use the /admin pages (set directly in the database).
|
|
165
138
|
isSuperAdmin: import_zod2.z.boolean()
|
|
166
139
|
}).strict();
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
code: import_zod2.z.string().trim().regex(/^\d{6}$/, "Enter the 6-digit code")
|
|
172
|
-
}).strict();
|
|
173
|
-
var TwoFactorConfirmInput = import_zod2.z.object({
|
|
174
|
-
password: import_zod2.z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
175
|
-
code: authCode
|
|
140
|
+
var AuthOptionsDto = import_zod2.z.object({
|
|
141
|
+
// Where people manage their SIAM account (name, email, password, two-factor); null when the
|
|
142
|
+
// server does not say.
|
|
143
|
+
profileUrl: import_zod2.z.string().nullable()
|
|
176
144
|
}).strict();
|
|
177
|
-
var RecoveryCodesDto = import_zod2.z.object({ recoveryCodes: import_zod2.z.array(import_zod2.z.string()) }).strict();
|
|
178
145
|
var CreateProjectInput = import_zod2.z.object({ name, slug, description: import_zod2.z.string().max(500).optional() }).strict();
|
|
179
146
|
var UpdateProjectInput = import_zod2.z.object({
|
|
180
147
|
name: name.optional(),
|
|
@@ -313,6 +280,7 @@ var SdkProjectDto = import_zod2.z.object({
|
|
|
313
280
|
role: ProjectRole,
|
|
314
281
|
environments: import_zod2.z.array(SdkEnvironmentDto)
|
|
315
282
|
}).strict();
|
|
283
|
+
var SdkMeDto = import_zod2.z.object({ id, email, name }).strict();
|
|
316
284
|
var adminPerson = import_zod2.z.object({ id, name, email }).strict();
|
|
317
285
|
var AdminProjectDto = ProjectDto.extend({
|
|
318
286
|
owner: adminPerson.nullable(),
|
|
@@ -333,14 +301,7 @@ var AdminUserDetailDto = AdminUserDto.extend({
|
|
|
333
301
|
// Every project the user is a member of, with their role there.
|
|
334
302
|
projects: import_zod2.z.array(import_zod2.z.object({ id, name, slug, role: ProjectRole }).strict())
|
|
335
303
|
});
|
|
336
|
-
var AdminUpdateUserInput = import_zod2.z.object({
|
|
337
|
-
name: name.optional(),
|
|
338
|
-
email: email.optional(),
|
|
339
|
-
disabled: import_zod2.z.boolean().optional()
|
|
340
|
-
}).strict().refine(
|
|
341
|
-
(input) => input.name !== void 0 || input.email !== void 0 || input.disabled !== void 0,
|
|
342
|
-
{ message: "Provide name, email and/or disabled" }
|
|
343
|
-
);
|
|
304
|
+
var AdminUpdateUserInput = import_zod2.z.object({ disabled: import_zod2.z.boolean() }).strict();
|
|
344
305
|
var CreateTokenInput = import_zod2.z.object({
|
|
345
306
|
name,
|
|
346
307
|
access: TokenAccess,
|
|
@@ -395,10 +356,59 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
395
356
|
TRUST_PROXY: import_zod3.z.coerce.number().int().min(0).max(10).default(0),
|
|
396
357
|
// Shared secret for the daily expiry-reminder call (see docs/DEPLOYMENT.md). Unset turns
|
|
397
358
|
// that endpoint off.
|
|
398
|
-
CRON_SECRET: import_zod3.z.string().min(32).max(256).optional()
|
|
399
|
-
|
|
359
|
+
CRON_SECRET: import_zod3.z.string().min(32).max(256).optional(),
|
|
360
|
+
// Sign-in through SIAM (https://siam.ankityadav.net.in/docs) is the only way in, so the four
|
|
361
|
+
// IAM_* values below are required (see the refinement). The one exception is local
|
|
362
|
+
// development with DEV_SIAM_STUB, and NODE_ENV=test, where tests inject their own SIAM.
|
|
363
|
+
IAM_BASE_URL: import_zod3.z.url().optional(),
|
|
364
|
+
IAM_CLIENT_ID: import_zod3.z.string().min(1).max(256).optional(),
|
|
365
|
+
IAM_CLIENT_SECRET: import_zod3.z.string().min(1).max(512).optional(),
|
|
366
|
+
IAM_REDIRECT_URI: import_zod3.z.url().optional(),
|
|
367
|
+
// The page where people manage their SIAM account (name, email, password, two-factor). The
|
|
368
|
+
// account page links to it. Optional: without it the page just says to use SIAM.
|
|
369
|
+
IAM_PROFILE_URL: import_zod3.z.url().refine(
|
|
370
|
+
(value) => ["http:", "https:"].includes(new URL(value).protocol),
|
|
371
|
+
"Expected an HTTP(S) URL"
|
|
372
|
+
).optional(),
|
|
373
|
+
// A SIAM permission the user must hold to get in (e.g. `secretenvs.access`). Unset: any
|
|
374
|
+
// active SIAM account may sign in. A SIAM superadmin always may.
|
|
375
|
+
IAM_REQUIRED_PERMISSION: import_zod3.z.string().min(1).max(128).optional(),
|
|
376
|
+
// Link a SIAM sign-in to an existing local account with the same email. Off by default,
|
|
377
|
+
// because it is only safe when SIAM verifies that people own the email they sign up with.
|
|
378
|
+
IAM_LINK_BY_EMAIL: import_zod3.z.enum(["true", "false"]).optional(),
|
|
379
|
+
// Local development only: replaces SIAM with a built-in stand-in that signs in one fixed
|
|
380
|
+
// fake user without asking for anything. Refused outside NODE_ENV=development.
|
|
381
|
+
DEV_SIAM_STUB: import_zod3.z.enum(["true", "false"]).optional()
|
|
382
|
+
}).strict().superRefine((environment, context) => {
|
|
383
|
+
const names = [
|
|
384
|
+
"IAM_BASE_URL",
|
|
385
|
+
"IAM_CLIENT_ID",
|
|
386
|
+
"IAM_CLIENT_SECRET",
|
|
387
|
+
"IAM_REDIRECT_URI"
|
|
388
|
+
];
|
|
389
|
+
const stub = environment.DEV_SIAM_STUB === "true";
|
|
390
|
+
if (stub && environment.NODE_ENV !== "development") {
|
|
391
|
+
context.addIssue({
|
|
392
|
+
code: "custom",
|
|
393
|
+
path: ["DEV_SIAM_STUB"],
|
|
394
|
+
message: "Only allowed when NODE_ENV is development"
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
if (stub || environment.NODE_ENV === "test") return;
|
|
398
|
+
for (const name2 of names) {
|
|
399
|
+
if (environment[name2] === void 0) {
|
|
400
|
+
context.addIssue({
|
|
401
|
+
code: "custom",
|
|
402
|
+
path: [name2],
|
|
403
|
+
message: "Required: SIAM is the only way to sign in"
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}).transform((environment) => ({
|
|
400
408
|
...environment,
|
|
401
|
-
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true"
|
|
409
|
+
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true",
|
|
410
|
+
IAM_LINK_BY_EMAIL: environment.IAM_LINK_BY_EMAIL === "true",
|
|
411
|
+
DEV_SIAM_STUB: environment.DEV_SIAM_STUB === "true"
|
|
402
412
|
}));
|
|
403
413
|
// Annotate the CommonJS export names for ESM import in node:
|
|
404
414
|
0 && (module.exports = {
|
|
@@ -408,6 +418,7 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
408
418
|
AdminUserDetailDto,
|
|
409
419
|
AdminUserDto,
|
|
410
420
|
ApiErrorBody,
|
|
421
|
+
AuthOptionsDto,
|
|
411
422
|
BulkUpsertVariablesInput,
|
|
412
423
|
BulkUpsertVariablesResponse,
|
|
413
424
|
CSRF_HEADER_NAME,
|
|
@@ -425,37 +436,26 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
425
436
|
ErrorCode,
|
|
426
437
|
ExpiringSecretDto,
|
|
427
438
|
ListVersionsQuery,
|
|
428
|
-
LoginInput,
|
|
429
|
-
MAX_AUTH_CODE_LENGTH,
|
|
430
439
|
MAX_BULK_VARIABLES,
|
|
431
440
|
MAX_KEY_LENGTH,
|
|
432
441
|
MAX_NAME_LENGTH,
|
|
433
|
-
MAX_PASSWORD_LENGTH,
|
|
434
442
|
MAX_VALUE_BYTES,
|
|
435
443
|
MAX_VERSIONS_LIMIT,
|
|
436
|
-
MIN_PASSWORD_LENGTH,
|
|
437
444
|
MemberDto,
|
|
438
445
|
PaginatedVersionsResponse,
|
|
439
446
|
ProjectDto,
|
|
440
447
|
ProjectRole,
|
|
441
448
|
ProjectSummaryDto,
|
|
442
|
-
RECOVERY_CODE_COUNT,
|
|
443
|
-
RecoveryCodesDto,
|
|
444
|
-
RegisterInput,
|
|
445
449
|
ResolvedVariableDto,
|
|
446
450
|
ResolvedVariablesResponse,
|
|
447
451
|
SLUG_REGEX,
|
|
448
452
|
SdkEnvironmentDto,
|
|
453
|
+
SdkMeDto,
|
|
449
454
|
SdkProjectDto,
|
|
450
455
|
SharedVariableMetaDto,
|
|
451
456
|
TOKEN_PREFIX,
|
|
452
|
-
TOTP_DIGITS,
|
|
453
457
|
TokenAccess,
|
|
454
458
|
TokenDto,
|
|
455
|
-
TwoFactorConfirmInput,
|
|
456
|
-
TwoFactorEnableInput,
|
|
457
|
-
TwoFactorSetupDto,
|
|
458
|
-
TwoFactorSetupInput,
|
|
459
459
|
UpdateEnvironmentInput,
|
|
460
460
|
UpdateMemberInput,
|
|
461
461
|
UpdateProjectInput,
|
package/dist/index.d.cts
CHANGED
|
@@ -8,16 +8,11 @@ declare const MAX_NAME_LENGTH = 64;
|
|
|
8
8
|
declare const MAX_BULK_VARIABLES = 500;
|
|
9
9
|
declare const EXPIRING_SOON_DAYS = 7;
|
|
10
10
|
declare const EXPIRY_REMINDER_DAYS: readonly [30, 7, 1];
|
|
11
|
-
declare const MIN_PASSWORD_LENGTH = 12;
|
|
12
|
-
declare const MAX_PASSWORD_LENGTH = 256;
|
|
13
11
|
declare const DEFAULT_VERSIONS_LIMIT = 20;
|
|
14
12
|
declare const MAX_VERSIONS_LIMIT = 100;
|
|
15
13
|
declare const CSRF_HEADER_NAME = "x-requested-with";
|
|
16
14
|
declare const CSRF_HEADER_VALUE = "secretenvs-web";
|
|
17
15
|
declare const TOKEN_PREFIX = "svt_";
|
|
18
|
-
declare const TOTP_DIGITS = 6;
|
|
19
|
-
declare const RECOVERY_CODE_COUNT = 10;
|
|
20
|
-
declare const MAX_AUTH_CODE_LENGTH = 32;
|
|
21
16
|
|
|
22
17
|
declare const ProjectRole: z.ZodEnum<{
|
|
23
18
|
OWNER: "OWNER";
|
|
@@ -41,7 +36,6 @@ declare const ErrorCode: z.ZodEnum<{
|
|
|
41
36
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
42
37
|
BAD_REQUEST: "BAD_REQUEST";
|
|
43
38
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
44
|
-
MFA_REQUIRED: "MFA_REQUIRED";
|
|
45
39
|
FORBIDDEN: "FORBIDDEN";
|
|
46
40
|
NOT_FOUND: "NOT_FOUND";
|
|
47
41
|
CONFLICT: "CONFLICT";
|
|
@@ -50,51 +44,18 @@ declare const ErrorCode: z.ZodEnum<{
|
|
|
50
44
|
}>;
|
|
51
45
|
type ErrorCode = z.infer<typeof ErrorCode>;
|
|
52
46
|
|
|
53
|
-
declare const RegisterInput: z.ZodObject<{
|
|
54
|
-
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
55
|
-
name: z.ZodString;
|
|
56
|
-
password: z.ZodString;
|
|
57
|
-
}, z.core.$strict>;
|
|
58
|
-
type RegisterInput = z.infer<typeof RegisterInput>;
|
|
59
|
-
declare const LoginInput: z.ZodObject<{
|
|
60
|
-
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
61
|
-
password: z.ZodString;
|
|
62
|
-
code: z.ZodOptional<z.ZodString>;
|
|
63
|
-
}, z.core.$strict>;
|
|
64
|
-
type LoginInput = z.infer<typeof LoginInput>;
|
|
65
47
|
declare const UserDto: z.ZodObject<{
|
|
66
48
|
id: z.ZodUUID;
|
|
67
49
|
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
68
50
|
name: z.ZodString;
|
|
69
51
|
createdAt: z.ZodISODateTime;
|
|
70
|
-
twoFactorEnabled: z.ZodBoolean;
|
|
71
|
-
twoFactorAppName: z.ZodNullable<z.ZodString>;
|
|
72
52
|
isSuperAdmin: z.ZodBoolean;
|
|
73
53
|
}, z.core.$strict>;
|
|
74
54
|
type UserDto = z.infer<typeof UserDto>;
|
|
75
|
-
declare const
|
|
76
|
-
|
|
77
|
-
otpauthUri: z.ZodString;
|
|
78
|
-
}, z.core.$strict>;
|
|
79
|
-
type TwoFactorSetupDto = z.infer<typeof TwoFactorSetupDto>;
|
|
80
|
-
declare const TwoFactorSetupInput: z.ZodObject<{
|
|
81
|
-
password: z.ZodString;
|
|
55
|
+
declare const AuthOptionsDto: z.ZodObject<{
|
|
56
|
+
profileUrl: z.ZodNullable<z.ZodString>;
|
|
82
57
|
}, z.core.$strict>;
|
|
83
|
-
type
|
|
84
|
-
declare const TwoFactorEnableInput: z.ZodObject<{
|
|
85
|
-
appName: z.ZodString;
|
|
86
|
-
code: z.ZodString;
|
|
87
|
-
}, z.core.$strict>;
|
|
88
|
-
type TwoFactorEnableInput = z.infer<typeof TwoFactorEnableInput>;
|
|
89
|
-
declare const TwoFactorConfirmInput: z.ZodObject<{
|
|
90
|
-
password: z.ZodString;
|
|
91
|
-
code: z.ZodString;
|
|
92
|
-
}, z.core.$strict>;
|
|
93
|
-
type TwoFactorConfirmInput = z.infer<typeof TwoFactorConfirmInput>;
|
|
94
|
-
declare const RecoveryCodesDto: z.ZodObject<{
|
|
95
|
-
recoveryCodes: z.ZodArray<z.ZodString>;
|
|
96
|
-
}, z.core.$strict>;
|
|
97
|
-
type RecoveryCodesDto = z.infer<typeof RecoveryCodesDto>;
|
|
58
|
+
type AuthOptionsDto = z.infer<typeof AuthOptionsDto>;
|
|
98
59
|
declare const CreateProjectInput: z.ZodObject<{
|
|
99
60
|
name: z.ZodString;
|
|
100
61
|
slug: z.ZodString;
|
|
@@ -367,6 +328,12 @@ declare const SdkProjectDto: z.ZodObject<{
|
|
|
367
328
|
}, z.core.$strict>>;
|
|
368
329
|
}, z.core.$strict>;
|
|
369
330
|
type SdkProjectDto = z.infer<typeof SdkProjectDto>;
|
|
331
|
+
declare const SdkMeDto: z.ZodObject<{
|
|
332
|
+
id: z.ZodUUID;
|
|
333
|
+
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
334
|
+
name: z.ZodString;
|
|
335
|
+
}, z.core.$strict>;
|
|
336
|
+
type SdkMeDto = z.infer<typeof SdkMeDto>;
|
|
370
337
|
declare const AdminProjectDto: z.ZodObject<{
|
|
371
338
|
id: z.ZodUUID;
|
|
372
339
|
name: z.ZodString;
|
|
@@ -416,9 +383,7 @@ declare const AdminUserDetailDto: z.ZodObject<{
|
|
|
416
383
|
}, z.core.$strict>;
|
|
417
384
|
type AdminUserDetailDto = z.infer<typeof AdminUserDetailDto>;
|
|
418
385
|
declare const AdminUpdateUserInput: z.ZodObject<{
|
|
419
|
-
|
|
420
|
-
email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
|
|
421
|
-
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
386
|
+
disabled: z.ZodBoolean;
|
|
422
387
|
}, z.core.$strict>;
|
|
423
388
|
type AdminUpdateUserInput = z.infer<typeof AdminUpdateUserInput>;
|
|
424
389
|
declare const CreateTokenInput: z.ZodObject<{
|
|
@@ -471,7 +436,6 @@ declare const ApiErrorBody: z.ZodObject<{
|
|
|
471
436
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
472
437
|
BAD_REQUEST: "BAD_REQUEST";
|
|
473
438
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
474
|
-
MFA_REQUIRED: "MFA_REQUIRED";
|
|
475
439
|
FORBIDDEN: "FORBIDDEN";
|
|
476
440
|
NOT_FOUND: "NOT_FOUND";
|
|
477
441
|
CONFLICT: "CONFLICT";
|
|
@@ -502,8 +466,24 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
502
466
|
VARIABLE_HISTORY_LIMIT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
503
467
|
TRUST_PROXY: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
504
468
|
CRON_SECRET: z.ZodOptional<z.ZodString>;
|
|
469
|
+
IAM_BASE_URL: z.ZodOptional<z.ZodURL>;
|
|
470
|
+
IAM_CLIENT_ID: z.ZodOptional<z.ZodString>;
|
|
471
|
+
IAM_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
|
|
472
|
+
IAM_REDIRECT_URI: z.ZodOptional<z.ZodURL>;
|
|
473
|
+
IAM_PROFILE_URL: z.ZodOptional<z.ZodURL>;
|
|
474
|
+
IAM_REQUIRED_PERMISSION: z.ZodOptional<z.ZodString>;
|
|
475
|
+
IAM_LINK_BY_EMAIL: z.ZodOptional<z.ZodEnum<{
|
|
476
|
+
true: "true";
|
|
477
|
+
false: "false";
|
|
478
|
+
}>>;
|
|
479
|
+
DEV_SIAM_STUB: z.ZodOptional<z.ZodEnum<{
|
|
480
|
+
true: "true";
|
|
481
|
+
false: "false";
|
|
482
|
+
}>>;
|
|
505
483
|
}, z.core.$strict>, z.ZodTransform<{
|
|
506
484
|
COOKIE_SECURE: boolean;
|
|
485
|
+
IAM_LINK_BY_EMAIL: boolean;
|
|
486
|
+
DEV_SIAM_STUB: boolean;
|
|
507
487
|
NODE_ENV: "development" | "test" | "production";
|
|
508
488
|
HOST: string;
|
|
509
489
|
PORT: number;
|
|
@@ -513,6 +493,12 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
513
493
|
VARIABLE_HISTORY_LIMIT: number;
|
|
514
494
|
TRUST_PROXY: number;
|
|
515
495
|
CRON_SECRET?: string | undefined;
|
|
496
|
+
IAM_BASE_URL?: string | undefined;
|
|
497
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
498
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
499
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
500
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
501
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
516
502
|
}, {
|
|
517
503
|
NODE_ENV: "development" | "test" | "production";
|
|
518
504
|
HOST: string;
|
|
@@ -524,7 +510,15 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
524
510
|
TRUST_PROXY: number;
|
|
525
511
|
COOKIE_SECURE?: "true" | "false" | undefined;
|
|
526
512
|
CRON_SECRET?: string | undefined;
|
|
513
|
+
IAM_BASE_URL?: string | undefined;
|
|
514
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
515
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
516
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
517
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
518
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
519
|
+
IAM_LINK_BY_EMAIL?: "true" | "false" | undefined;
|
|
520
|
+
DEV_SIAM_STUB?: "true" | "false" | undefined;
|
|
527
521
|
}>>;
|
|
528
522
|
type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
|
|
529
523
|
|
|
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,
|
|
524
|
+
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, MAX_BULK_VARIABLES, MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_BYTES, MAX_VERSIONS_LIMIT, MemberDto, PaginatedVersionsResponse, ProjectDto, ProjectRole, ProjectSummaryDto, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkMeDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TokenAccess, TokenDto, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,16 +8,11 @@ declare const MAX_NAME_LENGTH = 64;
|
|
|
8
8
|
declare const MAX_BULK_VARIABLES = 500;
|
|
9
9
|
declare const EXPIRING_SOON_DAYS = 7;
|
|
10
10
|
declare const EXPIRY_REMINDER_DAYS: readonly [30, 7, 1];
|
|
11
|
-
declare const MIN_PASSWORD_LENGTH = 12;
|
|
12
|
-
declare const MAX_PASSWORD_LENGTH = 256;
|
|
13
11
|
declare const DEFAULT_VERSIONS_LIMIT = 20;
|
|
14
12
|
declare const MAX_VERSIONS_LIMIT = 100;
|
|
15
13
|
declare const CSRF_HEADER_NAME = "x-requested-with";
|
|
16
14
|
declare const CSRF_HEADER_VALUE = "secretenvs-web";
|
|
17
15
|
declare const TOKEN_PREFIX = "svt_";
|
|
18
|
-
declare const TOTP_DIGITS = 6;
|
|
19
|
-
declare const RECOVERY_CODE_COUNT = 10;
|
|
20
|
-
declare const MAX_AUTH_CODE_LENGTH = 32;
|
|
21
16
|
|
|
22
17
|
declare const ProjectRole: z.ZodEnum<{
|
|
23
18
|
OWNER: "OWNER";
|
|
@@ -41,7 +36,6 @@ declare const ErrorCode: z.ZodEnum<{
|
|
|
41
36
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
42
37
|
BAD_REQUEST: "BAD_REQUEST";
|
|
43
38
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
44
|
-
MFA_REQUIRED: "MFA_REQUIRED";
|
|
45
39
|
FORBIDDEN: "FORBIDDEN";
|
|
46
40
|
NOT_FOUND: "NOT_FOUND";
|
|
47
41
|
CONFLICT: "CONFLICT";
|
|
@@ -50,51 +44,18 @@ declare const ErrorCode: z.ZodEnum<{
|
|
|
50
44
|
}>;
|
|
51
45
|
type ErrorCode = z.infer<typeof ErrorCode>;
|
|
52
46
|
|
|
53
|
-
declare const RegisterInput: z.ZodObject<{
|
|
54
|
-
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
55
|
-
name: z.ZodString;
|
|
56
|
-
password: z.ZodString;
|
|
57
|
-
}, z.core.$strict>;
|
|
58
|
-
type RegisterInput = z.infer<typeof RegisterInput>;
|
|
59
|
-
declare const LoginInput: z.ZodObject<{
|
|
60
|
-
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
61
|
-
password: z.ZodString;
|
|
62
|
-
code: z.ZodOptional<z.ZodString>;
|
|
63
|
-
}, z.core.$strict>;
|
|
64
|
-
type LoginInput = z.infer<typeof LoginInput>;
|
|
65
47
|
declare const UserDto: z.ZodObject<{
|
|
66
48
|
id: z.ZodUUID;
|
|
67
49
|
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
68
50
|
name: z.ZodString;
|
|
69
51
|
createdAt: z.ZodISODateTime;
|
|
70
|
-
twoFactorEnabled: z.ZodBoolean;
|
|
71
|
-
twoFactorAppName: z.ZodNullable<z.ZodString>;
|
|
72
52
|
isSuperAdmin: z.ZodBoolean;
|
|
73
53
|
}, z.core.$strict>;
|
|
74
54
|
type UserDto = z.infer<typeof UserDto>;
|
|
75
|
-
declare const
|
|
76
|
-
|
|
77
|
-
otpauthUri: z.ZodString;
|
|
78
|
-
}, z.core.$strict>;
|
|
79
|
-
type TwoFactorSetupDto = z.infer<typeof TwoFactorSetupDto>;
|
|
80
|
-
declare const TwoFactorSetupInput: z.ZodObject<{
|
|
81
|
-
password: z.ZodString;
|
|
55
|
+
declare const AuthOptionsDto: z.ZodObject<{
|
|
56
|
+
profileUrl: z.ZodNullable<z.ZodString>;
|
|
82
57
|
}, z.core.$strict>;
|
|
83
|
-
type
|
|
84
|
-
declare const TwoFactorEnableInput: z.ZodObject<{
|
|
85
|
-
appName: z.ZodString;
|
|
86
|
-
code: z.ZodString;
|
|
87
|
-
}, z.core.$strict>;
|
|
88
|
-
type TwoFactorEnableInput = z.infer<typeof TwoFactorEnableInput>;
|
|
89
|
-
declare const TwoFactorConfirmInput: z.ZodObject<{
|
|
90
|
-
password: z.ZodString;
|
|
91
|
-
code: z.ZodString;
|
|
92
|
-
}, z.core.$strict>;
|
|
93
|
-
type TwoFactorConfirmInput = z.infer<typeof TwoFactorConfirmInput>;
|
|
94
|
-
declare const RecoveryCodesDto: z.ZodObject<{
|
|
95
|
-
recoveryCodes: z.ZodArray<z.ZodString>;
|
|
96
|
-
}, z.core.$strict>;
|
|
97
|
-
type RecoveryCodesDto = z.infer<typeof RecoveryCodesDto>;
|
|
58
|
+
type AuthOptionsDto = z.infer<typeof AuthOptionsDto>;
|
|
98
59
|
declare const CreateProjectInput: z.ZodObject<{
|
|
99
60
|
name: z.ZodString;
|
|
100
61
|
slug: z.ZodString;
|
|
@@ -367,6 +328,12 @@ declare const SdkProjectDto: z.ZodObject<{
|
|
|
367
328
|
}, z.core.$strict>>;
|
|
368
329
|
}, z.core.$strict>;
|
|
369
330
|
type SdkProjectDto = z.infer<typeof SdkProjectDto>;
|
|
331
|
+
declare const SdkMeDto: z.ZodObject<{
|
|
332
|
+
id: z.ZodUUID;
|
|
333
|
+
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
334
|
+
name: z.ZodString;
|
|
335
|
+
}, z.core.$strict>;
|
|
336
|
+
type SdkMeDto = z.infer<typeof SdkMeDto>;
|
|
370
337
|
declare const AdminProjectDto: z.ZodObject<{
|
|
371
338
|
id: z.ZodUUID;
|
|
372
339
|
name: z.ZodString;
|
|
@@ -416,9 +383,7 @@ declare const AdminUserDetailDto: z.ZodObject<{
|
|
|
416
383
|
}, z.core.$strict>;
|
|
417
384
|
type AdminUserDetailDto = z.infer<typeof AdminUserDetailDto>;
|
|
418
385
|
declare const AdminUpdateUserInput: z.ZodObject<{
|
|
419
|
-
|
|
420
|
-
email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
|
|
421
|
-
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
386
|
+
disabled: z.ZodBoolean;
|
|
422
387
|
}, z.core.$strict>;
|
|
423
388
|
type AdminUpdateUserInput = z.infer<typeof AdminUpdateUserInput>;
|
|
424
389
|
declare const CreateTokenInput: z.ZodObject<{
|
|
@@ -471,7 +436,6 @@ declare const ApiErrorBody: z.ZodObject<{
|
|
|
471
436
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
472
437
|
BAD_REQUEST: "BAD_REQUEST";
|
|
473
438
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
474
|
-
MFA_REQUIRED: "MFA_REQUIRED";
|
|
475
439
|
FORBIDDEN: "FORBIDDEN";
|
|
476
440
|
NOT_FOUND: "NOT_FOUND";
|
|
477
441
|
CONFLICT: "CONFLICT";
|
|
@@ -502,8 +466,24 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
502
466
|
VARIABLE_HISTORY_LIMIT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
503
467
|
TRUST_PROXY: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
504
468
|
CRON_SECRET: z.ZodOptional<z.ZodString>;
|
|
469
|
+
IAM_BASE_URL: z.ZodOptional<z.ZodURL>;
|
|
470
|
+
IAM_CLIENT_ID: z.ZodOptional<z.ZodString>;
|
|
471
|
+
IAM_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
|
|
472
|
+
IAM_REDIRECT_URI: z.ZodOptional<z.ZodURL>;
|
|
473
|
+
IAM_PROFILE_URL: z.ZodOptional<z.ZodURL>;
|
|
474
|
+
IAM_REQUIRED_PERMISSION: z.ZodOptional<z.ZodString>;
|
|
475
|
+
IAM_LINK_BY_EMAIL: z.ZodOptional<z.ZodEnum<{
|
|
476
|
+
true: "true";
|
|
477
|
+
false: "false";
|
|
478
|
+
}>>;
|
|
479
|
+
DEV_SIAM_STUB: z.ZodOptional<z.ZodEnum<{
|
|
480
|
+
true: "true";
|
|
481
|
+
false: "false";
|
|
482
|
+
}>>;
|
|
505
483
|
}, z.core.$strict>, z.ZodTransform<{
|
|
506
484
|
COOKIE_SECURE: boolean;
|
|
485
|
+
IAM_LINK_BY_EMAIL: boolean;
|
|
486
|
+
DEV_SIAM_STUB: boolean;
|
|
507
487
|
NODE_ENV: "development" | "test" | "production";
|
|
508
488
|
HOST: string;
|
|
509
489
|
PORT: number;
|
|
@@ -513,6 +493,12 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
513
493
|
VARIABLE_HISTORY_LIMIT: number;
|
|
514
494
|
TRUST_PROXY: number;
|
|
515
495
|
CRON_SECRET?: string | undefined;
|
|
496
|
+
IAM_BASE_URL?: string | undefined;
|
|
497
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
498
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
499
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
500
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
501
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
516
502
|
}, {
|
|
517
503
|
NODE_ENV: "development" | "test" | "production";
|
|
518
504
|
HOST: string;
|
|
@@ -524,7 +510,15 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
524
510
|
TRUST_PROXY: number;
|
|
525
511
|
COOKIE_SECURE?: "true" | "false" | undefined;
|
|
526
512
|
CRON_SECRET?: string | undefined;
|
|
513
|
+
IAM_BASE_URL?: string | undefined;
|
|
514
|
+
IAM_CLIENT_ID?: string | undefined;
|
|
515
|
+
IAM_CLIENT_SECRET?: string | undefined;
|
|
516
|
+
IAM_REDIRECT_URI?: string | undefined;
|
|
517
|
+
IAM_PROFILE_URL?: string | undefined;
|
|
518
|
+
IAM_REQUIRED_PERMISSION?: string | undefined;
|
|
519
|
+
IAM_LINK_BY_EMAIL?: "true" | "false" | undefined;
|
|
520
|
+
DEV_SIAM_STUB?: "true" | "false" | undefined;
|
|
527
521
|
}>>;
|
|
528
522
|
type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
|
|
529
523
|
|
|
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,
|
|
524
|
+
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, MAX_BULK_VARIABLES, MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_BYTES, MAX_VERSIONS_LIMIT, MemberDto, PaginatedVersionsResponse, ProjectDto, ProjectRole, ProjectSummaryDto, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkMeDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TokenAccess, TokenDto, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
package/dist/index.js
CHANGED
|
@@ -10,16 +10,11 @@ var MAX_NAME_LENGTH = 64;
|
|
|
10
10
|
var MAX_BULK_VARIABLES = 500;
|
|
11
11
|
var EXPIRING_SOON_DAYS = 7;
|
|
12
12
|
var EXPIRY_REMINDER_DAYS = [30, 7, 1];
|
|
13
|
-
var MIN_PASSWORD_LENGTH = 12;
|
|
14
|
-
var MAX_PASSWORD_LENGTH = 256;
|
|
15
13
|
var DEFAULT_VERSIONS_LIMIT = 20;
|
|
16
14
|
var MAX_VERSIONS_LIMIT = 100;
|
|
17
15
|
var CSRF_HEADER_NAME = "x-requested-with";
|
|
18
16
|
var CSRF_HEADER_VALUE = "secretenvs-web";
|
|
19
17
|
var TOKEN_PREFIX = "svt_";
|
|
20
|
-
var TOTP_DIGITS = 6;
|
|
21
|
-
var RECOVERY_CODE_COUNT = 10;
|
|
22
|
-
var MAX_AUTH_CODE_LENGTH = 32;
|
|
23
18
|
|
|
24
19
|
// src/enums.ts
|
|
25
20
|
import { z } from "zod";
|
|
@@ -30,7 +25,6 @@ var ErrorCode = z.enum([
|
|
|
30
25
|
"VALIDATION_ERROR",
|
|
31
26
|
"BAD_REQUEST",
|
|
32
27
|
"UNAUTHENTICATED",
|
|
33
|
-
"MFA_REQUIRED",
|
|
34
28
|
"FORBIDDEN",
|
|
35
29
|
"NOT_FOUND",
|
|
36
30
|
"CONFLICT",
|
|
@@ -55,36 +49,19 @@ var variableValue = z2.string().refine(
|
|
|
55
49
|
var secretExpiry = isoDate.refine((value) => Date.parse(value) > Date.now(), {
|
|
56
50
|
message: "Expiry must be in the future"
|
|
57
51
|
}).nullable();
|
|
58
|
-
var password = z2.string().min(MIN_PASSWORD_LENGTH).max(MAX_PASSWORD_LENGTH);
|
|
59
|
-
var RegisterInput = z2.object({ email, name, password }).strict();
|
|
60
|
-
var authCode = z2.string().trim().min(1, "Enter your code").max(MAX_AUTH_CODE_LENGTH);
|
|
61
|
-
var LoginInput = z2.object({
|
|
62
|
-
email,
|
|
63
|
-
password: z2.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
64
|
-
code: authCode.optional()
|
|
65
|
-
}).strict();
|
|
66
52
|
var UserDto = z2.object({
|
|
67
53
|
id,
|
|
68
54
|
email,
|
|
69
55
|
name,
|
|
70
56
|
createdAt: isoDate,
|
|
71
|
-
twoFactorEnabled: z2.boolean(),
|
|
72
|
-
// Name the user gave the authenticator app at setup; null while 2FA is off.
|
|
73
|
-
twoFactorAppName: z2.string().nullable(),
|
|
74
57
|
// Whether the account may use the /admin pages (set directly in the database).
|
|
75
58
|
isSuperAdmin: z2.boolean()
|
|
76
59
|
}).strict();
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
code: z2.string().trim().regex(/^\d{6}$/, "Enter the 6-digit code")
|
|
82
|
-
}).strict();
|
|
83
|
-
var TwoFactorConfirmInput = z2.object({
|
|
84
|
-
password: z2.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
85
|
-
code: authCode
|
|
60
|
+
var AuthOptionsDto = z2.object({
|
|
61
|
+
// Where people manage their SIAM account (name, email, password, two-factor); null when the
|
|
62
|
+
// server does not say.
|
|
63
|
+
profileUrl: z2.string().nullable()
|
|
86
64
|
}).strict();
|
|
87
|
-
var RecoveryCodesDto = z2.object({ recoveryCodes: z2.array(z2.string()) }).strict();
|
|
88
65
|
var CreateProjectInput = z2.object({ name, slug, description: z2.string().max(500).optional() }).strict();
|
|
89
66
|
var UpdateProjectInput = z2.object({
|
|
90
67
|
name: name.optional(),
|
|
@@ -223,6 +200,7 @@ var SdkProjectDto = z2.object({
|
|
|
223
200
|
role: ProjectRole,
|
|
224
201
|
environments: z2.array(SdkEnvironmentDto)
|
|
225
202
|
}).strict();
|
|
203
|
+
var SdkMeDto = z2.object({ id, email, name }).strict();
|
|
226
204
|
var adminPerson = z2.object({ id, name, email }).strict();
|
|
227
205
|
var AdminProjectDto = ProjectDto.extend({
|
|
228
206
|
owner: adminPerson.nullable(),
|
|
@@ -243,14 +221,7 @@ var AdminUserDetailDto = AdminUserDto.extend({
|
|
|
243
221
|
// Every project the user is a member of, with their role there.
|
|
244
222
|
projects: z2.array(z2.object({ id, name, slug, role: ProjectRole }).strict())
|
|
245
223
|
});
|
|
246
|
-
var AdminUpdateUserInput = z2.object({
|
|
247
|
-
name: name.optional(),
|
|
248
|
-
email: email.optional(),
|
|
249
|
-
disabled: z2.boolean().optional()
|
|
250
|
-
}).strict().refine(
|
|
251
|
-
(input) => input.name !== void 0 || input.email !== void 0 || input.disabled !== void 0,
|
|
252
|
-
{ message: "Provide name, email and/or disabled" }
|
|
253
|
-
);
|
|
224
|
+
var AdminUpdateUserInput = z2.object({ disabled: z2.boolean() }).strict();
|
|
254
225
|
var CreateTokenInput = z2.object({
|
|
255
226
|
name,
|
|
256
227
|
access: TokenAccess,
|
|
@@ -305,10 +276,59 @@ var apiEnvironmentSchema = z3.object({
|
|
|
305
276
|
TRUST_PROXY: z3.coerce.number().int().min(0).max(10).default(0),
|
|
306
277
|
// Shared secret for the daily expiry-reminder call (see docs/DEPLOYMENT.md). Unset turns
|
|
307
278
|
// that endpoint off.
|
|
308
|
-
CRON_SECRET: z3.string().min(32).max(256).optional()
|
|
309
|
-
|
|
279
|
+
CRON_SECRET: z3.string().min(32).max(256).optional(),
|
|
280
|
+
// Sign-in through SIAM (https://siam.ankityadav.net.in/docs) is the only way in, so the four
|
|
281
|
+
// IAM_* values below are required (see the refinement). The one exception is local
|
|
282
|
+
// development with DEV_SIAM_STUB, and NODE_ENV=test, where tests inject their own SIAM.
|
|
283
|
+
IAM_BASE_URL: z3.url().optional(),
|
|
284
|
+
IAM_CLIENT_ID: z3.string().min(1).max(256).optional(),
|
|
285
|
+
IAM_CLIENT_SECRET: z3.string().min(1).max(512).optional(),
|
|
286
|
+
IAM_REDIRECT_URI: z3.url().optional(),
|
|
287
|
+
// The page where people manage their SIAM account (name, email, password, two-factor). The
|
|
288
|
+
// account page links to it. Optional: without it the page just says to use SIAM.
|
|
289
|
+
IAM_PROFILE_URL: z3.url().refine(
|
|
290
|
+
(value) => ["http:", "https:"].includes(new URL(value).protocol),
|
|
291
|
+
"Expected an HTTP(S) URL"
|
|
292
|
+
).optional(),
|
|
293
|
+
// A SIAM permission the user must hold to get in (e.g. `secretenvs.access`). Unset: any
|
|
294
|
+
// active SIAM account may sign in. A SIAM superadmin always may.
|
|
295
|
+
IAM_REQUIRED_PERMISSION: z3.string().min(1).max(128).optional(),
|
|
296
|
+
// Link a SIAM sign-in to an existing local account with the same email. Off by default,
|
|
297
|
+
// because it is only safe when SIAM verifies that people own the email they sign up with.
|
|
298
|
+
IAM_LINK_BY_EMAIL: z3.enum(["true", "false"]).optional(),
|
|
299
|
+
// Local development only: replaces SIAM with a built-in stand-in that signs in one fixed
|
|
300
|
+
// fake user without asking for anything. Refused outside NODE_ENV=development.
|
|
301
|
+
DEV_SIAM_STUB: z3.enum(["true", "false"]).optional()
|
|
302
|
+
}).strict().superRefine((environment, context) => {
|
|
303
|
+
const names = [
|
|
304
|
+
"IAM_BASE_URL",
|
|
305
|
+
"IAM_CLIENT_ID",
|
|
306
|
+
"IAM_CLIENT_SECRET",
|
|
307
|
+
"IAM_REDIRECT_URI"
|
|
308
|
+
];
|
|
309
|
+
const stub = environment.DEV_SIAM_STUB === "true";
|
|
310
|
+
if (stub && environment.NODE_ENV !== "development") {
|
|
311
|
+
context.addIssue({
|
|
312
|
+
code: "custom",
|
|
313
|
+
path: ["DEV_SIAM_STUB"],
|
|
314
|
+
message: "Only allowed when NODE_ENV is development"
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
if (stub || environment.NODE_ENV === "test") return;
|
|
318
|
+
for (const name2 of names) {
|
|
319
|
+
if (environment[name2] === void 0) {
|
|
320
|
+
context.addIssue({
|
|
321
|
+
code: "custom",
|
|
322
|
+
path: [name2],
|
|
323
|
+
message: "Required: SIAM is the only way to sign in"
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}).transform((environment) => ({
|
|
310
328
|
...environment,
|
|
311
|
-
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true"
|
|
329
|
+
COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true",
|
|
330
|
+
IAM_LINK_BY_EMAIL: environment.IAM_LINK_BY_EMAIL === "true",
|
|
331
|
+
DEV_SIAM_STUB: environment.DEV_SIAM_STUB === "true"
|
|
312
332
|
}));
|
|
313
333
|
export {
|
|
314
334
|
AddMemberInput,
|
|
@@ -317,6 +337,7 @@ export {
|
|
|
317
337
|
AdminUserDetailDto,
|
|
318
338
|
AdminUserDto,
|
|
319
339
|
ApiErrorBody,
|
|
340
|
+
AuthOptionsDto,
|
|
320
341
|
BulkUpsertVariablesInput,
|
|
321
342
|
BulkUpsertVariablesResponse,
|
|
322
343
|
CSRF_HEADER_NAME,
|
|
@@ -334,37 +355,26 @@ export {
|
|
|
334
355
|
ErrorCode,
|
|
335
356
|
ExpiringSecretDto,
|
|
336
357
|
ListVersionsQuery,
|
|
337
|
-
LoginInput,
|
|
338
|
-
MAX_AUTH_CODE_LENGTH,
|
|
339
358
|
MAX_BULK_VARIABLES,
|
|
340
359
|
MAX_KEY_LENGTH,
|
|
341
360
|
MAX_NAME_LENGTH,
|
|
342
|
-
MAX_PASSWORD_LENGTH,
|
|
343
361
|
MAX_VALUE_BYTES,
|
|
344
362
|
MAX_VERSIONS_LIMIT,
|
|
345
|
-
MIN_PASSWORD_LENGTH,
|
|
346
363
|
MemberDto,
|
|
347
364
|
PaginatedVersionsResponse,
|
|
348
365
|
ProjectDto,
|
|
349
366
|
ProjectRole,
|
|
350
367
|
ProjectSummaryDto,
|
|
351
|
-
RECOVERY_CODE_COUNT,
|
|
352
|
-
RecoveryCodesDto,
|
|
353
|
-
RegisterInput,
|
|
354
368
|
ResolvedVariableDto,
|
|
355
369
|
ResolvedVariablesResponse,
|
|
356
370
|
SLUG_REGEX,
|
|
357
371
|
SdkEnvironmentDto,
|
|
372
|
+
SdkMeDto,
|
|
358
373
|
SdkProjectDto,
|
|
359
374
|
SharedVariableMetaDto,
|
|
360
375
|
TOKEN_PREFIX,
|
|
361
|
-
TOTP_DIGITS,
|
|
362
376
|
TokenAccess,
|
|
363
377
|
TokenDto,
|
|
364
|
-
TwoFactorConfirmInput,
|
|
365
|
-
TwoFactorEnableInput,
|
|
366
|
-
TwoFactorSetupDto,
|
|
367
|
-
TwoFactorSetupInput,
|
|
368
378
|
UpdateEnvironmentInput,
|
|
369
379
|
UpdateMemberInput,
|
|
370
380
|
UpdateProjectInput,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secretenvs/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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",
|