@secretenvs/contracts 1.5.0 → 1.6.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 CHANGED
@@ -21,6 +21,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AddMemberInput: () => AddMemberInput,
24
+ AdminProjectDto: () => AdminProjectDto,
25
+ AdminUpdateUserInput: () => AdminUpdateUserInput,
26
+ AdminUserDetailDto: () => AdminUserDetailDto,
27
+ AdminUserDto: () => AdminUserDto,
24
28
  ApiErrorBody: () => ApiErrorBody,
25
29
  BulkUpsertVariablesInput: () => BulkUpsertVariablesInput,
26
30
  BulkUpsertVariablesResponse: () => BulkUpsertVariablesResponse,
@@ -156,7 +160,9 @@ var UserDto = import_zod2.z.object({
156
160
  createdAt: isoDate,
157
161
  twoFactorEnabled: import_zod2.z.boolean(),
158
162
  // Name the user gave the authenticator app at setup; null while 2FA is off.
159
- twoFactorAppName: import_zod2.z.string().nullable()
163
+ twoFactorAppName: import_zod2.z.string().nullable(),
164
+ // Whether the account may use the /admin pages (set directly in the database).
165
+ isSuperAdmin: import_zod2.z.boolean()
160
166
  }).strict();
161
167
  var TwoFactorSetupDto = import_zod2.z.object({ secret: import_zod2.z.string(), otpauthUri: import_zod2.z.string() }).strict();
162
168
  var TwoFactorSetupInput = import_zod2.z.object({ password: import_zod2.z.string().min(1).max(MAX_PASSWORD_LENGTH) }).strict();
@@ -307,6 +313,34 @@ var SdkProjectDto = import_zod2.z.object({
307
313
  role: ProjectRole,
308
314
  environments: import_zod2.z.array(SdkEnvironmentDto)
309
315
  }).strict();
316
+ var adminPerson = import_zod2.z.object({ id, name, email }).strict();
317
+ var AdminProjectDto = ProjectDto.extend({
318
+ owner: adminPerson.nullable(),
319
+ memberCount: import_zod2.z.number().int().min(0),
320
+ environmentCount: import_zod2.z.number().int().min(0)
321
+ });
322
+ var AdminUserDto = import_zod2.z.object({
323
+ id,
324
+ email,
325
+ name,
326
+ createdAt: isoDate,
327
+ // Null while the account is enabled.
328
+ disabledAt: isoDate.nullable(),
329
+ isSuperAdmin: import_zod2.z.boolean(),
330
+ projectCount: import_zod2.z.number().int().min(0)
331
+ }).strict();
332
+ var AdminUserDetailDto = AdminUserDto.extend({
333
+ // Every project the user is a member of, with their role there.
334
+ projects: import_zod2.z.array(import_zod2.z.object({ id, name, slug, role: ProjectRole }).strict())
335
+ });
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
+ );
310
344
  var CreateTokenInput = import_zod2.z.object({
311
345
  name,
312
346
  access: TokenAccess,
@@ -369,6 +403,10 @@ var apiEnvironmentSchema = import_zod3.z.object({
369
403
  // Annotate the CommonJS export names for ESM import in node:
370
404
  0 && (module.exports = {
371
405
  AddMemberInput,
406
+ AdminProjectDto,
407
+ AdminUpdateUserInput,
408
+ AdminUserDetailDto,
409
+ AdminUserDto,
372
410
  ApiErrorBody,
373
411
  BulkUpsertVariablesInput,
374
412
  BulkUpsertVariablesResponse,
package/dist/index.d.cts CHANGED
@@ -69,6 +69,7 @@ declare const UserDto: z.ZodObject<{
69
69
  createdAt: z.ZodISODateTime;
70
70
  twoFactorEnabled: z.ZodBoolean;
71
71
  twoFactorAppName: z.ZodNullable<z.ZodString>;
72
+ isSuperAdmin: z.ZodBoolean;
72
73
  }, z.core.$strict>;
73
74
  type UserDto = z.infer<typeof UserDto>;
74
75
  declare const TwoFactorSetupDto: z.ZodObject<{
@@ -366,6 +367,60 @@ declare const SdkProjectDto: z.ZodObject<{
366
367
  }, z.core.$strict>>;
367
368
  }, z.core.$strict>;
368
369
  type SdkProjectDto = z.infer<typeof SdkProjectDto>;
370
+ declare const AdminProjectDto: z.ZodObject<{
371
+ id: z.ZodUUID;
372
+ name: z.ZodString;
373
+ slug: z.ZodString;
374
+ description: z.ZodNullable<z.ZodString>;
375
+ disabledAt: z.ZodNullable<z.ZodISODateTime>;
376
+ createdAt: z.ZodISODateTime;
377
+ updatedAt: z.ZodISODateTime;
378
+ owner: z.ZodNullable<z.ZodObject<{
379
+ id: z.ZodUUID;
380
+ name: z.ZodString;
381
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
382
+ }, z.core.$strict>>;
383
+ memberCount: z.ZodNumber;
384
+ environmentCount: z.ZodNumber;
385
+ }, z.core.$strict>;
386
+ type AdminProjectDto = z.infer<typeof AdminProjectDto>;
387
+ declare const AdminUserDto: z.ZodObject<{
388
+ id: z.ZodUUID;
389
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
390
+ name: z.ZodString;
391
+ createdAt: z.ZodISODateTime;
392
+ disabledAt: z.ZodNullable<z.ZodISODateTime>;
393
+ isSuperAdmin: z.ZodBoolean;
394
+ projectCount: z.ZodNumber;
395
+ }, z.core.$strict>;
396
+ type AdminUserDto = z.infer<typeof AdminUserDto>;
397
+ declare const AdminUserDetailDto: z.ZodObject<{
398
+ id: z.ZodUUID;
399
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
400
+ name: z.ZodString;
401
+ createdAt: z.ZodISODateTime;
402
+ disabledAt: z.ZodNullable<z.ZodISODateTime>;
403
+ isSuperAdmin: z.ZodBoolean;
404
+ projectCount: z.ZodNumber;
405
+ projects: z.ZodArray<z.ZodObject<{
406
+ id: z.ZodUUID;
407
+ name: z.ZodString;
408
+ slug: z.ZodString;
409
+ role: z.ZodEnum<{
410
+ OWNER: "OWNER";
411
+ ADMIN: "ADMIN";
412
+ EDITOR: "EDITOR";
413
+ VIEWER: "VIEWER";
414
+ }>;
415
+ }, z.core.$strict>>;
416
+ }, z.core.$strict>;
417
+ type AdminUserDetailDto = z.infer<typeof AdminUserDetailDto>;
418
+ declare const AdminUpdateUserInput: z.ZodObject<{
419
+ name: z.ZodOptional<z.ZodString>;
420
+ email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
421
+ disabled: z.ZodOptional<z.ZodBoolean>;
422
+ }, z.core.$strict>;
423
+ type AdminUpdateUserInput = z.infer<typeof AdminUpdateUserInput>;
369
424
  declare const CreateTokenInput: z.ZodObject<{
370
425
  name: z.ZodString;
371
426
  access: z.ZodEnum<{
@@ -472,4 +527,4 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
472
527
  }>>;
473
528
  type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
474
529
 
475
- export { AddMemberInput, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,7 @@ declare const UserDto: z.ZodObject<{
69
69
  createdAt: z.ZodISODateTime;
70
70
  twoFactorEnabled: z.ZodBoolean;
71
71
  twoFactorAppName: z.ZodNullable<z.ZodString>;
72
+ isSuperAdmin: z.ZodBoolean;
72
73
  }, z.core.$strict>;
73
74
  type UserDto = z.infer<typeof UserDto>;
74
75
  declare const TwoFactorSetupDto: z.ZodObject<{
@@ -366,6 +367,60 @@ declare const SdkProjectDto: z.ZodObject<{
366
367
  }, z.core.$strict>>;
367
368
  }, z.core.$strict>;
368
369
  type SdkProjectDto = z.infer<typeof SdkProjectDto>;
370
+ declare const AdminProjectDto: z.ZodObject<{
371
+ id: z.ZodUUID;
372
+ name: z.ZodString;
373
+ slug: z.ZodString;
374
+ description: z.ZodNullable<z.ZodString>;
375
+ disabledAt: z.ZodNullable<z.ZodISODateTime>;
376
+ createdAt: z.ZodISODateTime;
377
+ updatedAt: z.ZodISODateTime;
378
+ owner: z.ZodNullable<z.ZodObject<{
379
+ id: z.ZodUUID;
380
+ name: z.ZodString;
381
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
382
+ }, z.core.$strict>>;
383
+ memberCount: z.ZodNumber;
384
+ environmentCount: z.ZodNumber;
385
+ }, z.core.$strict>;
386
+ type AdminProjectDto = z.infer<typeof AdminProjectDto>;
387
+ declare const AdminUserDto: z.ZodObject<{
388
+ id: z.ZodUUID;
389
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
390
+ name: z.ZodString;
391
+ createdAt: z.ZodISODateTime;
392
+ disabledAt: z.ZodNullable<z.ZodISODateTime>;
393
+ isSuperAdmin: z.ZodBoolean;
394
+ projectCount: z.ZodNumber;
395
+ }, z.core.$strict>;
396
+ type AdminUserDto = z.infer<typeof AdminUserDto>;
397
+ declare const AdminUserDetailDto: z.ZodObject<{
398
+ id: z.ZodUUID;
399
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
400
+ name: z.ZodString;
401
+ createdAt: z.ZodISODateTime;
402
+ disabledAt: z.ZodNullable<z.ZodISODateTime>;
403
+ isSuperAdmin: z.ZodBoolean;
404
+ projectCount: z.ZodNumber;
405
+ projects: z.ZodArray<z.ZodObject<{
406
+ id: z.ZodUUID;
407
+ name: z.ZodString;
408
+ slug: z.ZodString;
409
+ role: z.ZodEnum<{
410
+ OWNER: "OWNER";
411
+ ADMIN: "ADMIN";
412
+ EDITOR: "EDITOR";
413
+ VIEWER: "VIEWER";
414
+ }>;
415
+ }, z.core.$strict>>;
416
+ }, z.core.$strict>;
417
+ type AdminUserDetailDto = z.infer<typeof AdminUserDetailDto>;
418
+ declare const AdminUpdateUserInput: z.ZodObject<{
419
+ name: z.ZodOptional<z.ZodString>;
420
+ email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
421
+ disabled: z.ZodOptional<z.ZodBoolean>;
422
+ }, z.core.$strict>;
423
+ type AdminUpdateUserInput = z.infer<typeof AdminUpdateUserInput>;
369
424
  declare const CreateTokenInput: z.ZodObject<{
370
425
  name: z.ZodString;
371
426
  access: z.ZodEnum<{
@@ -472,4 +527,4 @@ declare const apiEnvironmentSchema: z.ZodPipe<z.ZodObject<{
472
527
  }>>;
473
528
  type ApiEnvironment = z.infer<typeof apiEnvironmentSchema>;
474
529
 
475
- export { AddMemberInput, 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 };
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 };
package/dist/index.js CHANGED
@@ -70,7 +70,9 @@ var UserDto = z2.object({
70
70
  createdAt: isoDate,
71
71
  twoFactorEnabled: z2.boolean(),
72
72
  // Name the user gave the authenticator app at setup; null while 2FA is off.
73
- twoFactorAppName: z2.string().nullable()
73
+ twoFactorAppName: z2.string().nullable(),
74
+ // Whether the account may use the /admin pages (set directly in the database).
75
+ isSuperAdmin: z2.boolean()
74
76
  }).strict();
75
77
  var TwoFactorSetupDto = z2.object({ secret: z2.string(), otpauthUri: z2.string() }).strict();
76
78
  var TwoFactorSetupInput = z2.object({ password: z2.string().min(1).max(MAX_PASSWORD_LENGTH) }).strict();
@@ -221,6 +223,34 @@ var SdkProjectDto = z2.object({
221
223
  role: ProjectRole,
222
224
  environments: z2.array(SdkEnvironmentDto)
223
225
  }).strict();
226
+ var adminPerson = z2.object({ id, name, email }).strict();
227
+ var AdminProjectDto = ProjectDto.extend({
228
+ owner: adminPerson.nullable(),
229
+ memberCount: z2.number().int().min(0),
230
+ environmentCount: z2.number().int().min(0)
231
+ });
232
+ var AdminUserDto = z2.object({
233
+ id,
234
+ email,
235
+ name,
236
+ createdAt: isoDate,
237
+ // Null while the account is enabled.
238
+ disabledAt: isoDate.nullable(),
239
+ isSuperAdmin: z2.boolean(),
240
+ projectCount: z2.number().int().min(0)
241
+ }).strict();
242
+ var AdminUserDetailDto = AdminUserDto.extend({
243
+ // Every project the user is a member of, with their role there.
244
+ projects: z2.array(z2.object({ id, name, slug, role: ProjectRole }).strict())
245
+ });
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
254
  var CreateTokenInput = z2.object({
225
255
  name,
226
256
  access: TokenAccess,
@@ -282,6 +312,10 @@ var apiEnvironmentSchema = z3.object({
282
312
  }));
283
313
  export {
284
314
  AddMemberInput,
315
+ AdminProjectDto,
316
+ AdminUpdateUserInput,
317
+ AdminUserDetailDto,
318
+ AdminUserDto,
285
319
  ApiErrorBody,
286
320
  BulkUpsertVariablesInput,
287
321
  BulkUpsertVariablesResponse,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretenvs/contracts",
3
- "version": "1.5.0",
3
+ "version": "1.6.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",