@secretenvs/contracts 1.1.0 → 1.2.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 +46 -2
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +38 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
ErrorCode: () => ErrorCode,
|
|
38
38
|
ListVersionsQuery: () => ListVersionsQuery,
|
|
39
39
|
LoginInput: () => LoginInput,
|
|
40
|
+
MAX_AUTH_CODE_LENGTH: () => MAX_AUTH_CODE_LENGTH,
|
|
40
41
|
MAX_BULK_VARIABLES: () => MAX_BULK_VARIABLES,
|
|
41
42
|
MAX_KEY_LENGTH: () => MAX_KEY_LENGTH,
|
|
42
43
|
MAX_NAME_LENGTH: () => MAX_NAME_LENGTH,
|
|
@@ -49,6 +50,8 @@ __export(index_exports, {
|
|
|
49
50
|
ProjectDto: () => ProjectDto,
|
|
50
51
|
ProjectRole: () => ProjectRole,
|
|
51
52
|
ProjectSummaryDto: () => ProjectSummaryDto,
|
|
53
|
+
RECOVERY_CODE_COUNT: () => RECOVERY_CODE_COUNT,
|
|
54
|
+
RecoveryCodesDto: () => RecoveryCodesDto,
|
|
52
55
|
RegisterInput: () => RegisterInput,
|
|
53
56
|
ResolvedVariableDto: () => ResolvedVariableDto,
|
|
54
57
|
ResolvedVariablesResponse: () => ResolvedVariablesResponse,
|
|
@@ -57,8 +60,13 @@ __export(index_exports, {
|
|
|
57
60
|
SdkProjectDto: () => SdkProjectDto,
|
|
58
61
|
SharedVariableMetaDto: () => SharedVariableMetaDto,
|
|
59
62
|
TOKEN_PREFIX: () => TOKEN_PREFIX,
|
|
63
|
+
TOTP_DIGITS: () => TOTP_DIGITS,
|
|
60
64
|
TokenAccess: () => TokenAccess,
|
|
61
65
|
TokenDto: () => TokenDto,
|
|
66
|
+
TwoFactorConfirmInput: () => TwoFactorConfirmInput,
|
|
67
|
+
TwoFactorEnableInput: () => TwoFactorEnableInput,
|
|
68
|
+
TwoFactorSetupDto: () => TwoFactorSetupDto,
|
|
69
|
+
TwoFactorSetupInput: () => TwoFactorSetupInput,
|
|
62
70
|
UpdateEnvironmentInput: () => UpdateEnvironmentInput,
|
|
63
71
|
UpdateMemberInput: () => UpdateMemberInput,
|
|
64
72
|
UpdateProjectInput: () => UpdateProjectInput,
|
|
@@ -90,6 +98,9 @@ var MAX_VERSIONS_LIMIT = 100;
|
|
|
90
98
|
var CSRF_HEADER_NAME = "x-requested-with";
|
|
91
99
|
var CSRF_HEADER_VALUE = "secretenvs-web";
|
|
92
100
|
var TOKEN_PREFIX = "svt_";
|
|
101
|
+
var TOTP_DIGITS = 6;
|
|
102
|
+
var RECOVERY_CODE_COUNT = 10;
|
|
103
|
+
var MAX_AUTH_CODE_LENGTH = 32;
|
|
93
104
|
|
|
94
105
|
// src/enums.ts
|
|
95
106
|
var import_zod = require("zod");
|
|
@@ -100,6 +111,7 @@ var ErrorCode = import_zod.z.enum([
|
|
|
100
111
|
"VALIDATION_ERROR",
|
|
101
112
|
"BAD_REQUEST",
|
|
102
113
|
"UNAUTHENTICATED",
|
|
114
|
+
"MFA_REQUIRED",
|
|
103
115
|
"FORBIDDEN",
|
|
104
116
|
"NOT_FOUND",
|
|
105
117
|
"CONFLICT",
|
|
@@ -123,8 +135,32 @@ var variableValue = import_zod2.z.string().refine(
|
|
|
123
135
|
);
|
|
124
136
|
var password = import_zod2.z.string().min(MIN_PASSWORD_LENGTH).max(MAX_PASSWORD_LENGTH);
|
|
125
137
|
var RegisterInput = import_zod2.z.object({ email, name, password }).strict();
|
|
126
|
-
var
|
|
127
|
-
var
|
|
138
|
+
var authCode = import_zod2.z.string().trim().min(1, "Enter your code").max(MAX_AUTH_CODE_LENGTH);
|
|
139
|
+
var LoginInput = import_zod2.z.object({
|
|
140
|
+
email,
|
|
141
|
+
password: import_zod2.z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
142
|
+
code: authCode.optional()
|
|
143
|
+
}).strict();
|
|
144
|
+
var UserDto = import_zod2.z.object({
|
|
145
|
+
id,
|
|
146
|
+
email,
|
|
147
|
+
name,
|
|
148
|
+
createdAt: isoDate,
|
|
149
|
+
twoFactorEnabled: import_zod2.z.boolean(),
|
|
150
|
+
// Name the user gave the authenticator app at setup; null while 2FA is off.
|
|
151
|
+
twoFactorAppName: import_zod2.z.string().nullable()
|
|
152
|
+
}).strict();
|
|
153
|
+
var TwoFactorSetupDto = import_zod2.z.object({ secret: import_zod2.z.string(), otpauthUri: import_zod2.z.string() }).strict();
|
|
154
|
+
var TwoFactorSetupInput = import_zod2.z.object({ password: import_zod2.z.string().min(1).max(MAX_PASSWORD_LENGTH) }).strict();
|
|
155
|
+
var TwoFactorEnableInput = import_zod2.z.object({
|
|
156
|
+
appName: import_zod2.z.string().trim().min(1, "Enter the app name").max(MAX_NAME_LENGTH),
|
|
157
|
+
code: import_zod2.z.string().trim().regex(/^\d{6}$/, "Enter the 6-digit code")
|
|
158
|
+
}).strict();
|
|
159
|
+
var TwoFactorConfirmInput = import_zod2.z.object({
|
|
160
|
+
password: import_zod2.z.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
161
|
+
code: authCode
|
|
162
|
+
}).strict();
|
|
163
|
+
var RecoveryCodesDto = import_zod2.z.object({ recoveryCodes: import_zod2.z.array(import_zod2.z.string()) }).strict();
|
|
128
164
|
var CreateProjectInput = import_zod2.z.object({ name, slug, description: import_zod2.z.string().max(500).optional() }).strict();
|
|
129
165
|
var UpdateProjectInput = import_zod2.z.object({
|
|
130
166
|
name: name.optional(),
|
|
@@ -296,6 +332,7 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
296
332
|
ErrorCode,
|
|
297
333
|
ListVersionsQuery,
|
|
298
334
|
LoginInput,
|
|
335
|
+
MAX_AUTH_CODE_LENGTH,
|
|
299
336
|
MAX_BULK_VARIABLES,
|
|
300
337
|
MAX_KEY_LENGTH,
|
|
301
338
|
MAX_NAME_LENGTH,
|
|
@@ -308,6 +345,8 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
308
345
|
ProjectDto,
|
|
309
346
|
ProjectRole,
|
|
310
347
|
ProjectSummaryDto,
|
|
348
|
+
RECOVERY_CODE_COUNT,
|
|
349
|
+
RecoveryCodesDto,
|
|
311
350
|
RegisterInput,
|
|
312
351
|
ResolvedVariableDto,
|
|
313
352
|
ResolvedVariablesResponse,
|
|
@@ -316,8 +355,13 @@ var apiEnvironmentSchema = import_zod3.z.object({
|
|
|
316
355
|
SdkProjectDto,
|
|
317
356
|
SharedVariableMetaDto,
|
|
318
357
|
TOKEN_PREFIX,
|
|
358
|
+
TOTP_DIGITS,
|
|
319
359
|
TokenAccess,
|
|
320
360
|
TokenDto,
|
|
361
|
+
TwoFactorConfirmInput,
|
|
362
|
+
TwoFactorEnableInput,
|
|
363
|
+
TwoFactorSetupDto,
|
|
364
|
+
TwoFactorSetupInput,
|
|
321
365
|
UpdateEnvironmentInput,
|
|
322
366
|
UpdateMemberInput,
|
|
323
367
|
UpdateProjectInput,
|
package/dist/index.d.cts
CHANGED
|
@@ -13,6 +13,9 @@ declare const MAX_VERSIONS_LIMIT = 100;
|
|
|
13
13
|
declare const CSRF_HEADER_NAME = "x-requested-with";
|
|
14
14
|
declare const CSRF_HEADER_VALUE = "secretenvs-web";
|
|
15
15
|
declare const TOKEN_PREFIX = "svt_";
|
|
16
|
+
declare const TOTP_DIGITS = 6;
|
|
17
|
+
declare const RECOVERY_CODE_COUNT = 10;
|
|
18
|
+
declare const MAX_AUTH_CODE_LENGTH = 32;
|
|
16
19
|
|
|
17
20
|
declare const ProjectRole: z.ZodEnum<{
|
|
18
21
|
OWNER: "OWNER";
|
|
@@ -36,6 +39,7 @@ declare const ErrorCode: z.ZodEnum<{
|
|
|
36
39
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
37
40
|
BAD_REQUEST: "BAD_REQUEST";
|
|
38
41
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
42
|
+
MFA_REQUIRED: "MFA_REQUIRED";
|
|
39
43
|
FORBIDDEN: "FORBIDDEN";
|
|
40
44
|
NOT_FOUND: "NOT_FOUND";
|
|
41
45
|
CONFLICT: "CONFLICT";
|
|
@@ -53,6 +57,7 @@ type RegisterInput = z.infer<typeof RegisterInput>;
|
|
|
53
57
|
declare const LoginInput: z.ZodObject<{
|
|
54
58
|
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
55
59
|
password: z.ZodString;
|
|
60
|
+
code: z.ZodOptional<z.ZodString>;
|
|
56
61
|
}, z.core.$strict>;
|
|
57
62
|
type LoginInput = z.infer<typeof LoginInput>;
|
|
58
63
|
declare const UserDto: z.ZodObject<{
|
|
@@ -60,8 +65,33 @@ declare const UserDto: z.ZodObject<{
|
|
|
60
65
|
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
61
66
|
name: z.ZodString;
|
|
62
67
|
createdAt: z.ZodISODateTime;
|
|
68
|
+
twoFactorEnabled: z.ZodBoolean;
|
|
69
|
+
twoFactorAppName: z.ZodNullable<z.ZodString>;
|
|
63
70
|
}, z.core.$strict>;
|
|
64
71
|
type UserDto = z.infer<typeof UserDto>;
|
|
72
|
+
declare const TwoFactorSetupDto: z.ZodObject<{
|
|
73
|
+
secret: z.ZodString;
|
|
74
|
+
otpauthUri: z.ZodString;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
type TwoFactorSetupDto = z.infer<typeof TwoFactorSetupDto>;
|
|
77
|
+
declare const TwoFactorSetupInput: z.ZodObject<{
|
|
78
|
+
password: z.ZodString;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
type TwoFactorSetupInput = z.infer<typeof TwoFactorSetupInput>;
|
|
81
|
+
declare const TwoFactorEnableInput: z.ZodObject<{
|
|
82
|
+
appName: z.ZodString;
|
|
83
|
+
code: z.ZodString;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
type TwoFactorEnableInput = z.infer<typeof TwoFactorEnableInput>;
|
|
86
|
+
declare const TwoFactorConfirmInput: z.ZodObject<{
|
|
87
|
+
password: z.ZodString;
|
|
88
|
+
code: z.ZodString;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
type TwoFactorConfirmInput = z.infer<typeof TwoFactorConfirmInput>;
|
|
91
|
+
declare const RecoveryCodesDto: z.ZodObject<{
|
|
92
|
+
recoveryCodes: z.ZodArray<z.ZodString>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
type RecoveryCodesDto = z.infer<typeof RecoveryCodesDto>;
|
|
65
95
|
declare const CreateProjectInput: z.ZodObject<{
|
|
66
96
|
name: z.ZodString;
|
|
67
97
|
slug: z.ZodString;
|
|
@@ -350,6 +380,7 @@ declare const ApiErrorBody: z.ZodObject<{
|
|
|
350
380
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
351
381
|
BAD_REQUEST: "BAD_REQUEST";
|
|
352
382
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
383
|
+
MFA_REQUIRED: "MFA_REQUIRED";
|
|
353
384
|
FORBIDDEN: "FORBIDDEN";
|
|
354
385
|
NOT_FOUND: "NOT_FOUND";
|
|
355
386
|
CONFLICT: "CONFLICT";
|
|
@@ -402,4 +433,4 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
402
433
|
}>>;
|
|
403
434
|
type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
|
|
404
435
|
|
|
405
|
-
export { AddMemberInput, type ApiEnvironment, ApiErrorBody, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EnvironmentDto, ErrorCode, ListVersionsQuery, LoginInput, 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, RegisterInput, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TokenAccess, TokenDto, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
|
436
|
+
export { AddMemberInput, type ApiEnvironment, ApiErrorBody, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EnvironmentDto, ErrorCode, 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
|
@@ -13,6 +13,9 @@ declare const MAX_VERSIONS_LIMIT = 100;
|
|
|
13
13
|
declare const CSRF_HEADER_NAME = "x-requested-with";
|
|
14
14
|
declare const CSRF_HEADER_VALUE = "secretenvs-web";
|
|
15
15
|
declare const TOKEN_PREFIX = "svt_";
|
|
16
|
+
declare const TOTP_DIGITS = 6;
|
|
17
|
+
declare const RECOVERY_CODE_COUNT = 10;
|
|
18
|
+
declare const MAX_AUTH_CODE_LENGTH = 32;
|
|
16
19
|
|
|
17
20
|
declare const ProjectRole: z.ZodEnum<{
|
|
18
21
|
OWNER: "OWNER";
|
|
@@ -36,6 +39,7 @@ declare const ErrorCode: z.ZodEnum<{
|
|
|
36
39
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
37
40
|
BAD_REQUEST: "BAD_REQUEST";
|
|
38
41
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
42
|
+
MFA_REQUIRED: "MFA_REQUIRED";
|
|
39
43
|
FORBIDDEN: "FORBIDDEN";
|
|
40
44
|
NOT_FOUND: "NOT_FOUND";
|
|
41
45
|
CONFLICT: "CONFLICT";
|
|
@@ -53,6 +57,7 @@ type RegisterInput = z.infer<typeof RegisterInput>;
|
|
|
53
57
|
declare const LoginInput: z.ZodObject<{
|
|
54
58
|
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
55
59
|
password: z.ZodString;
|
|
60
|
+
code: z.ZodOptional<z.ZodString>;
|
|
56
61
|
}, z.core.$strict>;
|
|
57
62
|
type LoginInput = z.infer<typeof LoginInput>;
|
|
58
63
|
declare const UserDto: z.ZodObject<{
|
|
@@ -60,8 +65,33 @@ declare const UserDto: z.ZodObject<{
|
|
|
60
65
|
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
61
66
|
name: z.ZodString;
|
|
62
67
|
createdAt: z.ZodISODateTime;
|
|
68
|
+
twoFactorEnabled: z.ZodBoolean;
|
|
69
|
+
twoFactorAppName: z.ZodNullable<z.ZodString>;
|
|
63
70
|
}, z.core.$strict>;
|
|
64
71
|
type UserDto = z.infer<typeof UserDto>;
|
|
72
|
+
declare const TwoFactorSetupDto: z.ZodObject<{
|
|
73
|
+
secret: z.ZodString;
|
|
74
|
+
otpauthUri: z.ZodString;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
type TwoFactorSetupDto = z.infer<typeof TwoFactorSetupDto>;
|
|
77
|
+
declare const TwoFactorSetupInput: z.ZodObject<{
|
|
78
|
+
password: z.ZodString;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
type TwoFactorSetupInput = z.infer<typeof TwoFactorSetupInput>;
|
|
81
|
+
declare const TwoFactorEnableInput: z.ZodObject<{
|
|
82
|
+
appName: z.ZodString;
|
|
83
|
+
code: z.ZodString;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
type TwoFactorEnableInput = z.infer<typeof TwoFactorEnableInput>;
|
|
86
|
+
declare const TwoFactorConfirmInput: z.ZodObject<{
|
|
87
|
+
password: z.ZodString;
|
|
88
|
+
code: z.ZodString;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
type TwoFactorConfirmInput = z.infer<typeof TwoFactorConfirmInput>;
|
|
91
|
+
declare const RecoveryCodesDto: z.ZodObject<{
|
|
92
|
+
recoveryCodes: z.ZodArray<z.ZodString>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
type RecoveryCodesDto = z.infer<typeof RecoveryCodesDto>;
|
|
65
95
|
declare const CreateProjectInput: z.ZodObject<{
|
|
66
96
|
name: z.ZodString;
|
|
67
97
|
slug: z.ZodString;
|
|
@@ -350,6 +380,7 @@ declare const ApiErrorBody: z.ZodObject<{
|
|
|
350
380
|
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
351
381
|
BAD_REQUEST: "BAD_REQUEST";
|
|
352
382
|
UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
383
|
+
MFA_REQUIRED: "MFA_REQUIRED";
|
|
353
384
|
FORBIDDEN: "FORBIDDEN";
|
|
354
385
|
NOT_FOUND: "NOT_FOUND";
|
|
355
386
|
CONFLICT: "CONFLICT";
|
|
@@ -402,4 +433,4 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
402
433
|
}>>;
|
|
403
434
|
type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
|
|
404
435
|
|
|
405
|
-
export { AddMemberInput, type ApiEnvironment, ApiErrorBody, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EnvironmentDto, ErrorCode, ListVersionsQuery, LoginInput, 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, RegisterInput, ResolvedVariableDto, ResolvedVariablesResponse, SLUG_REGEX, SdkEnvironmentDto, SdkProjectDto, SharedVariableMetaDto, TOKEN_PREFIX, TokenAccess, TokenDto, UpdateEnvironmentInput, UpdateMemberInput, UpdateProjectInput, UpdateSharedVariableInput, UpdateVariableInput, UserDto, VARIABLE_KEY_REGEX, VariableMetaDto, VariableVersionMetaDto, VariableVersionValueDto, VariableWithValueDto, VersionChangeType, apiEnvironmentSchema };
|
|
436
|
+
export { AddMemberInput, type ApiEnvironment, ApiErrorBody, BulkUpsertVariablesInput, BulkUpsertVariablesResponse, CSRF_HEADER_NAME, CSRF_HEADER_VALUE, CreateEnvironmentInput, CreateProjectInput, CreateSharedVariableInput, CreateTokenInput, CreateVariableInput, CreatedTokenDto, DEFAULT_VERSIONS_LIMIT, EnvironmentDto, ErrorCode, 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
|
@@ -15,6 +15,9 @@ var MAX_VERSIONS_LIMIT = 100;
|
|
|
15
15
|
var CSRF_HEADER_NAME = "x-requested-with";
|
|
16
16
|
var CSRF_HEADER_VALUE = "secretenvs-web";
|
|
17
17
|
var TOKEN_PREFIX = "svt_";
|
|
18
|
+
var TOTP_DIGITS = 6;
|
|
19
|
+
var RECOVERY_CODE_COUNT = 10;
|
|
20
|
+
var MAX_AUTH_CODE_LENGTH = 32;
|
|
18
21
|
|
|
19
22
|
// src/enums.ts
|
|
20
23
|
import { z } from "zod";
|
|
@@ -25,6 +28,7 @@ var ErrorCode = z.enum([
|
|
|
25
28
|
"VALIDATION_ERROR",
|
|
26
29
|
"BAD_REQUEST",
|
|
27
30
|
"UNAUTHENTICATED",
|
|
31
|
+
"MFA_REQUIRED",
|
|
28
32
|
"FORBIDDEN",
|
|
29
33
|
"NOT_FOUND",
|
|
30
34
|
"CONFLICT",
|
|
@@ -48,8 +52,32 @@ var variableValue = z2.string().refine(
|
|
|
48
52
|
);
|
|
49
53
|
var password = z2.string().min(MIN_PASSWORD_LENGTH).max(MAX_PASSWORD_LENGTH);
|
|
50
54
|
var RegisterInput = z2.object({ email, name, password }).strict();
|
|
51
|
-
var
|
|
52
|
-
var
|
|
55
|
+
var authCode = z2.string().trim().min(1, "Enter your code").max(MAX_AUTH_CODE_LENGTH);
|
|
56
|
+
var LoginInput = z2.object({
|
|
57
|
+
email,
|
|
58
|
+
password: z2.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
59
|
+
code: authCode.optional()
|
|
60
|
+
}).strict();
|
|
61
|
+
var UserDto = z2.object({
|
|
62
|
+
id,
|
|
63
|
+
email,
|
|
64
|
+
name,
|
|
65
|
+
createdAt: isoDate,
|
|
66
|
+
twoFactorEnabled: z2.boolean(),
|
|
67
|
+
// Name the user gave the authenticator app at setup; null while 2FA is off.
|
|
68
|
+
twoFactorAppName: z2.string().nullable()
|
|
69
|
+
}).strict();
|
|
70
|
+
var TwoFactorSetupDto = z2.object({ secret: z2.string(), otpauthUri: z2.string() }).strict();
|
|
71
|
+
var TwoFactorSetupInput = z2.object({ password: z2.string().min(1).max(MAX_PASSWORD_LENGTH) }).strict();
|
|
72
|
+
var TwoFactorEnableInput = z2.object({
|
|
73
|
+
appName: z2.string().trim().min(1, "Enter the app name").max(MAX_NAME_LENGTH),
|
|
74
|
+
code: z2.string().trim().regex(/^\d{6}$/, "Enter the 6-digit code")
|
|
75
|
+
}).strict();
|
|
76
|
+
var TwoFactorConfirmInput = z2.object({
|
|
77
|
+
password: z2.string().min(1).max(MAX_PASSWORD_LENGTH),
|
|
78
|
+
code: authCode
|
|
79
|
+
}).strict();
|
|
80
|
+
var RecoveryCodesDto = z2.object({ recoveryCodes: z2.array(z2.string()) }).strict();
|
|
53
81
|
var CreateProjectInput = z2.object({ name, slug, description: z2.string().max(500).optional() }).strict();
|
|
54
82
|
var UpdateProjectInput = z2.object({
|
|
55
83
|
name: name.optional(),
|
|
@@ -220,6 +248,7 @@ export {
|
|
|
220
248
|
ErrorCode,
|
|
221
249
|
ListVersionsQuery,
|
|
222
250
|
LoginInput,
|
|
251
|
+
MAX_AUTH_CODE_LENGTH,
|
|
223
252
|
MAX_BULK_VARIABLES,
|
|
224
253
|
MAX_KEY_LENGTH,
|
|
225
254
|
MAX_NAME_LENGTH,
|
|
@@ -232,6 +261,8 @@ export {
|
|
|
232
261
|
ProjectDto,
|
|
233
262
|
ProjectRole,
|
|
234
263
|
ProjectSummaryDto,
|
|
264
|
+
RECOVERY_CODE_COUNT,
|
|
265
|
+
RecoveryCodesDto,
|
|
235
266
|
RegisterInput,
|
|
236
267
|
ResolvedVariableDto,
|
|
237
268
|
ResolvedVariablesResponse,
|
|
@@ -240,8 +271,13 @@ export {
|
|
|
240
271
|
SdkProjectDto,
|
|
241
272
|
SharedVariableMetaDto,
|
|
242
273
|
TOKEN_PREFIX,
|
|
274
|
+
TOTP_DIGITS,
|
|
243
275
|
TokenAccess,
|
|
244
276
|
TokenDto,
|
|
277
|
+
TwoFactorConfirmInput,
|
|
278
|
+
TwoFactorEnableInput,
|
|
279
|
+
TwoFactorSetupDto,
|
|
280
|
+
TwoFactorSetupInput,
|
|
245
281
|
UpdateEnvironmentInput,
|
|
246
282
|
UpdateMemberInput,
|
|
247
283
|
UpdateProjectInput,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secretenvs/contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.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",
|