@secretenvs/contracts 0.0.0-stage → 1.0.1

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.
@@ -0,0 +1,405 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const VARIABLE_KEY_REGEX: RegExp;
4
+ declare const SLUG_REGEX: RegExp;
5
+ declare const MAX_KEY_LENGTH = 128;
6
+ declare const MAX_VALUE_BYTES: number;
7
+ declare const MAX_NAME_LENGTH = 64;
8
+ declare const MAX_BULK_VARIABLES = 500;
9
+ declare const MIN_PASSWORD_LENGTH = 12;
10
+ declare const MAX_PASSWORD_LENGTH = 256;
11
+ declare const DEFAULT_VERSIONS_LIMIT = 20;
12
+ declare const MAX_VERSIONS_LIMIT = 100;
13
+ declare const CSRF_HEADER_NAME = "x-requested-with";
14
+ declare const CSRF_HEADER_VALUE = "secretenvs-web";
15
+ declare const TOKEN_PREFIX = "svt_";
16
+
17
+ declare const ProjectRole: z.ZodEnum<{
18
+ OWNER: "OWNER";
19
+ ADMIN: "ADMIN";
20
+ EDITOR: "EDITOR";
21
+ VIEWER: "VIEWER";
22
+ }>;
23
+ type ProjectRole = z.infer<typeof ProjectRole>;
24
+ declare const TokenAccess: z.ZodEnum<{
25
+ READ: "READ";
26
+ READ_WRITE: "READ_WRITE";
27
+ }>;
28
+ type TokenAccess = z.infer<typeof TokenAccess>;
29
+ declare const VersionChangeType: z.ZodEnum<{
30
+ CREATED: "CREATED";
31
+ UPDATED: "UPDATED";
32
+ ROLLBACK: "ROLLBACK";
33
+ }>;
34
+ type VersionChangeType = z.infer<typeof VersionChangeType>;
35
+ declare const ErrorCode: z.ZodEnum<{
36
+ VALIDATION_ERROR: "VALIDATION_ERROR";
37
+ BAD_REQUEST: "BAD_REQUEST";
38
+ UNAUTHENTICATED: "UNAUTHENTICATED";
39
+ FORBIDDEN: "FORBIDDEN";
40
+ NOT_FOUND: "NOT_FOUND";
41
+ CONFLICT: "CONFLICT";
42
+ RATE_LIMITED: "RATE_LIMITED";
43
+ INTERNAL: "INTERNAL";
44
+ }>;
45
+ type ErrorCode = z.infer<typeof ErrorCode>;
46
+
47
+ declare const RegisterInput: z.ZodObject<{
48
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
49
+ name: z.ZodString;
50
+ password: z.ZodString;
51
+ }, z.core.$strict>;
52
+ type RegisterInput = z.infer<typeof RegisterInput>;
53
+ declare const LoginInput: z.ZodObject<{
54
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
55
+ password: z.ZodString;
56
+ }, z.core.$strict>;
57
+ type LoginInput = z.infer<typeof LoginInput>;
58
+ declare const UserDto: z.ZodObject<{
59
+ id: z.ZodUUID;
60
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
61
+ name: z.ZodString;
62
+ createdAt: z.ZodISODateTime;
63
+ }, z.core.$strict>;
64
+ type UserDto = z.infer<typeof UserDto>;
65
+ declare const CreateProjectInput: z.ZodObject<{
66
+ name: z.ZodString;
67
+ slug: z.ZodString;
68
+ description: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strict>;
70
+ type CreateProjectInput = z.infer<typeof CreateProjectInput>;
71
+ declare const UpdateProjectInput: z.ZodObject<{
72
+ name: z.ZodOptional<z.ZodString>;
73
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ }, z.core.$strict>;
75
+ type UpdateProjectInput = z.infer<typeof UpdateProjectInput>;
76
+ declare const ProjectDto: z.ZodObject<{
77
+ id: z.ZodUUID;
78
+ name: z.ZodString;
79
+ slug: z.ZodString;
80
+ description: z.ZodNullable<z.ZodString>;
81
+ createdAt: z.ZodISODateTime;
82
+ updatedAt: z.ZodISODateTime;
83
+ }, z.core.$strict>;
84
+ type ProjectDto = z.infer<typeof ProjectDto>;
85
+ declare const ProjectSummaryDto: z.ZodObject<{
86
+ id: z.ZodUUID;
87
+ name: z.ZodString;
88
+ slug: z.ZodString;
89
+ description: z.ZodNullable<z.ZodString>;
90
+ createdAt: z.ZodISODateTime;
91
+ updatedAt: z.ZodISODateTime;
92
+ role: z.ZodEnum<{
93
+ OWNER: "OWNER";
94
+ ADMIN: "ADMIN";
95
+ EDITOR: "EDITOR";
96
+ VIEWER: "VIEWER";
97
+ }>;
98
+ }, z.core.$strict>;
99
+ type ProjectSummaryDto = z.infer<typeof ProjectSummaryDto>;
100
+ declare const AddMemberInput: z.ZodObject<{
101
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
102
+ role: z.ZodEnum<{
103
+ OWNER: "OWNER";
104
+ ADMIN: "ADMIN";
105
+ EDITOR: "EDITOR";
106
+ VIEWER: "VIEWER";
107
+ }>;
108
+ }, z.core.$strict>;
109
+ type AddMemberInput = z.infer<typeof AddMemberInput>;
110
+ declare const UpdateMemberInput: z.ZodObject<{
111
+ role: z.ZodEnum<{
112
+ OWNER: "OWNER";
113
+ ADMIN: "ADMIN";
114
+ EDITOR: "EDITOR";
115
+ VIEWER: "VIEWER";
116
+ }>;
117
+ }, z.core.$strict>;
118
+ type UpdateMemberInput = z.infer<typeof UpdateMemberInput>;
119
+ declare const MemberDto: z.ZodObject<{
120
+ userId: z.ZodUUID;
121
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
122
+ name: z.ZodString;
123
+ role: z.ZodEnum<{
124
+ OWNER: "OWNER";
125
+ ADMIN: "ADMIN";
126
+ EDITOR: "EDITOR";
127
+ VIEWER: "VIEWER";
128
+ }>;
129
+ createdAt: z.ZodISODateTime;
130
+ }, z.core.$strict>;
131
+ type MemberDto = z.infer<typeof MemberDto>;
132
+ declare const CreateEnvironmentInput: z.ZodObject<{
133
+ name: z.ZodString;
134
+ slug: z.ZodString;
135
+ }, z.core.$strict>;
136
+ type CreateEnvironmentInput = z.infer<typeof CreateEnvironmentInput>;
137
+ declare const UpdateEnvironmentInput: z.ZodObject<{
138
+ name: z.ZodOptional<z.ZodString>;
139
+ slug: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strict>;
141
+ type UpdateEnvironmentInput = z.infer<typeof UpdateEnvironmentInput>;
142
+ declare const EnvironmentDto: z.ZodObject<{
143
+ id: z.ZodUUID;
144
+ projectId: z.ZodUUID;
145
+ name: z.ZodString;
146
+ slug: z.ZodString;
147
+ createdAt: z.ZodISODateTime;
148
+ updatedAt: z.ZodISODateTime;
149
+ }, z.core.$strict>;
150
+ type EnvironmentDto = z.infer<typeof EnvironmentDto>;
151
+ declare const CreateVariableInput: z.ZodObject<{
152
+ key: z.ZodString;
153
+ value: z.ZodString;
154
+ }, z.core.$strict>;
155
+ type CreateVariableInput = z.infer<typeof CreateVariableInput>;
156
+ declare const UpdateVariableInput: z.ZodObject<{
157
+ value: z.ZodString;
158
+ }, z.core.$strict>;
159
+ type UpdateVariableInput = z.infer<typeof UpdateVariableInput>;
160
+ declare const VariableMetaDto: z.ZodObject<{
161
+ id: z.ZodUUID;
162
+ key: z.ZodString;
163
+ currentVersion: z.ZodNumber;
164
+ updatedAt: z.ZodISODateTime;
165
+ }, z.core.$strict>;
166
+ type VariableMetaDto = z.infer<typeof VariableMetaDto>;
167
+ declare const VariableWithValueDto: z.ZodObject<{
168
+ id: z.ZodUUID;
169
+ key: z.ZodString;
170
+ currentVersion: z.ZodNumber;
171
+ updatedAt: z.ZodISODateTime;
172
+ value: z.ZodString;
173
+ }, z.core.$strict>;
174
+ type VariableWithValueDto = z.infer<typeof VariableWithValueDto>;
175
+ declare const BulkUpsertVariablesInput: z.ZodObject<{
176
+ variables: z.ZodArray<z.ZodObject<{
177
+ key: z.ZodString;
178
+ value: z.ZodString;
179
+ }, z.core.$strict>>;
180
+ }, z.core.$strict>;
181
+ type BulkUpsertVariablesInput = z.infer<typeof BulkUpsertVariablesInput>;
182
+ declare const BulkUpsertVariablesResponse: z.ZodObject<{
183
+ created: z.ZodNumber;
184
+ updated: z.ZodNumber;
185
+ unchanged: z.ZodNumber;
186
+ }, z.core.$strict>;
187
+ type BulkUpsertVariablesResponse = z.infer<typeof BulkUpsertVariablesResponse>;
188
+ declare const CreateSharedVariableInput: z.ZodObject<{
189
+ key: z.ZodString;
190
+ value: z.ZodString;
191
+ environmentIds: z.ZodArray<z.ZodUUID>;
192
+ }, z.core.$strict>;
193
+ type CreateSharedVariableInput = z.infer<typeof CreateSharedVariableInput>;
194
+ declare const UpdateSharedVariableInput: z.ZodObject<{
195
+ value: z.ZodOptional<z.ZodString>;
196
+ environmentIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
197
+ }, z.core.$strict>;
198
+ type UpdateSharedVariableInput = z.infer<typeof UpdateSharedVariableInput>;
199
+ declare const SharedVariableMetaDto: z.ZodObject<{
200
+ id: z.ZodUUID;
201
+ key: z.ZodString;
202
+ currentVersion: z.ZodNumber;
203
+ updatedAt: z.ZodISODateTime;
204
+ environmentIds: z.ZodArray<z.ZodUUID>;
205
+ }, z.core.$strict>;
206
+ type SharedVariableMetaDto = z.infer<typeof SharedVariableMetaDto>;
207
+ declare const ListVersionsQuery: z.ZodObject<{
208
+ cursor: z.ZodOptional<z.ZodString>;
209
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
210
+ }, z.core.$strict>;
211
+ type ListVersionsQuery = z.infer<typeof ListVersionsQuery>;
212
+ declare const VariableVersionMetaDto: z.ZodObject<{
213
+ version: z.ZodNumber;
214
+ changeType: z.ZodEnum<{
215
+ CREATED: "CREATED";
216
+ UPDATED: "UPDATED";
217
+ ROLLBACK: "ROLLBACK";
218
+ }>;
219
+ restoredFromVersion: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
220
+ changedBy: z.ZodNullable<z.ZodObject<{
221
+ id: z.ZodUUID;
222
+ name: z.ZodString;
223
+ }, z.core.$strict>>;
224
+ createdAt: z.ZodISODateTime;
225
+ isCurrent: z.ZodBoolean;
226
+ }, z.core.$strict>;
227
+ type VariableVersionMetaDto = z.infer<typeof VariableVersionMetaDto>;
228
+ declare const PaginatedVersionsResponse: z.ZodObject<{
229
+ items: z.ZodArray<z.ZodObject<{
230
+ version: z.ZodNumber;
231
+ changeType: z.ZodEnum<{
232
+ CREATED: "CREATED";
233
+ UPDATED: "UPDATED";
234
+ ROLLBACK: "ROLLBACK";
235
+ }>;
236
+ restoredFromVersion: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
237
+ changedBy: z.ZodNullable<z.ZodObject<{
238
+ id: z.ZodUUID;
239
+ name: z.ZodString;
240
+ }, z.core.$strict>>;
241
+ createdAt: z.ZodISODateTime;
242
+ isCurrent: z.ZodBoolean;
243
+ }, z.core.$strict>>;
244
+ nextCursor: z.ZodOptional<z.ZodString>;
245
+ }, z.core.$strict>;
246
+ type PaginatedVersionsResponse = z.infer<typeof PaginatedVersionsResponse>;
247
+ declare const VariableVersionValueDto: z.ZodObject<{
248
+ version: z.ZodNumber;
249
+ value: z.ZodString;
250
+ }, z.core.$strict>;
251
+ type VariableVersionValueDto = z.infer<typeof VariableVersionValueDto>;
252
+ declare const ResolvedVariableDto: z.ZodObject<{
253
+ key: z.ZodString;
254
+ value: z.ZodString;
255
+ source: z.ZodEnum<{
256
+ environment: "environment";
257
+ shared: "shared";
258
+ }>;
259
+ }, z.core.$strict>;
260
+ type ResolvedVariableDto = z.infer<typeof ResolvedVariableDto>;
261
+ declare const ResolvedVariablesResponse: z.ZodObject<{
262
+ project: z.ZodObject<{
263
+ id: z.ZodUUID;
264
+ slug: z.ZodString;
265
+ }, z.core.$strict>;
266
+ environment: z.ZodObject<{
267
+ id: z.ZodUUID;
268
+ slug: z.ZodString;
269
+ }, z.core.$strict>;
270
+ variables: z.ZodArray<z.ZodObject<{
271
+ key: z.ZodString;
272
+ value: z.ZodString;
273
+ source: z.ZodEnum<{
274
+ environment: "environment";
275
+ shared: "shared";
276
+ }>;
277
+ }, z.core.$strict>>;
278
+ }, z.core.$strict>;
279
+ type ResolvedVariablesResponse = z.infer<typeof ResolvedVariablesResponse>;
280
+ declare const SdkEnvironmentDto: z.ZodObject<{
281
+ id: z.ZodUUID;
282
+ slug: z.ZodString;
283
+ name: z.ZodString;
284
+ }, z.core.$strict>;
285
+ type SdkEnvironmentDto = z.infer<typeof SdkEnvironmentDto>;
286
+ declare const SdkProjectDto: z.ZodObject<{
287
+ id: z.ZodUUID;
288
+ slug: z.ZodString;
289
+ name: z.ZodString;
290
+ role: z.ZodEnum<{
291
+ OWNER: "OWNER";
292
+ ADMIN: "ADMIN";
293
+ EDITOR: "EDITOR";
294
+ VIEWER: "VIEWER";
295
+ }>;
296
+ environments: z.ZodArray<z.ZodObject<{
297
+ id: z.ZodUUID;
298
+ slug: z.ZodString;
299
+ name: z.ZodString;
300
+ }, z.core.$strict>>;
301
+ }, z.core.$strict>;
302
+ type SdkProjectDto = z.infer<typeof SdkProjectDto>;
303
+ declare const CreateTokenInput: z.ZodObject<{
304
+ name: z.ZodString;
305
+ access: z.ZodEnum<{
306
+ READ: "READ";
307
+ READ_WRITE: "READ_WRITE";
308
+ }>;
309
+ projectId: z.ZodOptional<z.ZodUUID>;
310
+ environmentId: z.ZodOptional<z.ZodUUID>;
311
+ expiresInDays: z.ZodOptional<z.ZodNumber>;
312
+ }, z.core.$strict>;
313
+ type CreateTokenInput = z.infer<typeof CreateTokenInput>;
314
+ declare const TokenDto: z.ZodObject<{
315
+ id: z.ZodUUID;
316
+ name: z.ZodString;
317
+ prefix: z.ZodString;
318
+ access: z.ZodEnum<{
319
+ READ: "READ";
320
+ READ_WRITE: "READ_WRITE";
321
+ }>;
322
+ projectId: z.ZodNullable<z.ZodUUID>;
323
+ environmentId: z.ZodNullable<z.ZodUUID>;
324
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
325
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
326
+ lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
327
+ createdAt: z.ZodISODateTime;
328
+ }, z.core.$strict>;
329
+ type TokenDto = z.infer<typeof TokenDto>;
330
+ declare const CreatedTokenDto: z.ZodObject<{
331
+ id: z.ZodUUID;
332
+ name: z.ZodString;
333
+ prefix: z.ZodString;
334
+ access: z.ZodEnum<{
335
+ READ: "READ";
336
+ READ_WRITE: "READ_WRITE";
337
+ }>;
338
+ projectId: z.ZodNullable<z.ZodUUID>;
339
+ environmentId: z.ZodNullable<z.ZodUUID>;
340
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
341
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
342
+ lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
343
+ createdAt: z.ZodISODateTime;
344
+ token: z.ZodString;
345
+ }, z.core.$strict>;
346
+ type CreatedTokenDto = z.infer<typeof CreatedTokenDto>;
347
+ declare const ApiErrorBody: z.ZodObject<{
348
+ error: z.ZodObject<{
349
+ code: z.ZodEnum<{
350
+ VALIDATION_ERROR: "VALIDATION_ERROR";
351
+ BAD_REQUEST: "BAD_REQUEST";
352
+ UNAUTHENTICATED: "UNAUTHENTICATED";
353
+ FORBIDDEN: "FORBIDDEN";
354
+ NOT_FOUND: "NOT_FOUND";
355
+ CONFLICT: "CONFLICT";
356
+ RATE_LIMITED: "RATE_LIMITED";
357
+ INTERNAL: "INTERNAL";
358
+ }>;
359
+ message: z.ZodString;
360
+ details: z.ZodOptional<z.ZodUnknown>;
361
+ }, z.core.$strict>;
362
+ }, z.core.$strict>;
363
+ type ApiErrorBody = z.infer<typeof ApiErrorBody>;
364
+
365
+ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
366
+ NODE_ENV: z.ZodEnum<{
367
+ development: "development";
368
+ test: "test";
369
+ production: "production";
370
+ }>;
371
+ HOST: z.ZodDefault<z.ZodString>;
372
+ PORT: z.ZodCoercedNumber<unknown>;
373
+ WEB_ORIGIN: z.ZodURL;
374
+ DATABASE_URL: z.ZodURL;
375
+ MASTER_KEY: z.ZodString;
376
+ COOKIE_SECURE: z.ZodOptional<z.ZodEnum<{
377
+ true: "true";
378
+ false: "false";
379
+ }>>;
380
+ VARIABLE_HISTORY_LIMIT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
381
+ TRUST_PROXY: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
382
+ }, z.core.$strict>, z.ZodTransform<{
383
+ COOKIE_SECURE: boolean;
384
+ NODE_ENV: "development" | "test" | "production";
385
+ HOST: string;
386
+ PORT: number;
387
+ WEB_ORIGIN: string;
388
+ DATABASE_URL: string;
389
+ MASTER_KEY: string;
390
+ VARIABLE_HISTORY_LIMIT: number;
391
+ TRUST_PROXY: number;
392
+ }, {
393
+ NODE_ENV: "development" | "test" | "production";
394
+ HOST: string;
395
+ PORT: number;
396
+ WEB_ORIGIN: string;
397
+ DATABASE_URL: string;
398
+ MASTER_KEY: string;
399
+ VARIABLE_HISTORY_LIMIT: number;
400
+ TRUST_PROXY: number;
401
+ COOKIE_SECURE?: "true" | "false" | undefined;
402
+ }>>;
403
+ type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
404
+
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 };