@secretenvs/cli 1.4.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.
Files changed (2) hide show
  1. package/dist/index.js +86 -11
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -73,6 +73,9 @@ var variableValue = z2.string().refine(
73
73
  message: `Value must be at most ${MAX_VALUE_BYTES} bytes`
74
74
  }
75
75
  );
76
+ var secretExpiry = isoDate.refine((value) => Date.parse(value) > Date.now(), {
77
+ message: "Expiry must be in the future"
78
+ }).nullable();
76
79
  var password2 = z2.string().min(MIN_PASSWORD_LENGTH).max(MAX_PASSWORD_LENGTH);
77
80
  var RegisterInput = z2.object({ email, name, password: password2 }).strict();
78
81
  var authCode = z2.string().trim().min(1, "Enter your code").max(MAX_AUTH_CODE_LENGTH);
@@ -88,7 +91,9 @@ var UserDto = z2.object({
88
91
  createdAt: isoDate,
89
92
  twoFactorEnabled: z2.boolean(),
90
93
  // Name the user gave the authenticator app at setup; null while 2FA is off.
91
- twoFactorAppName: z2.string().nullable()
94
+ twoFactorAppName: z2.string().nullable(),
95
+ // Whether the account may use the /admin pages (set directly in the database).
96
+ isSuperAdmin: z2.boolean()
92
97
  }).strict();
93
98
  var TwoFactorSetupDto = z2.object({ secret: z2.string(), otpauthUri: z2.string() }).strict();
94
99
  var TwoFactorSetupInput = z2.object({ password: z2.string().min(1).max(MAX_PASSWORD_LENGTH) }).strict();
@@ -104,13 +109,16 @@ var RecoveryCodesDto = z2.object({ recoveryCodes: z2.array(z2.string()) }).stric
104
109
  var CreateProjectInput = z2.object({ name, slug, description: z2.string().max(500).optional() }).strict();
105
110
  var UpdateProjectInput = z2.object({
106
111
  name: name.optional(),
107
- description: z2.string().max(500).nullable().optional()
112
+ description: z2.string().max(500).nullable().optional(),
113
+ disabled: z2.boolean().optional()
108
114
  }).strict();
109
115
  var ProjectDto = z2.object({
110
116
  id,
111
117
  name,
112
118
  slug,
113
119
  description: z2.string().nullable(),
120
+ // Null while the project is enabled.
121
+ disabledAt: isoDate.nullable(),
114
122
  createdAt: isoDate,
115
123
  updatedAt: isoDate
116
124
  }).strict();
@@ -131,19 +139,33 @@ var EnvironmentDto = z2.object({
131
139
  createdAt: isoDate,
132
140
  updatedAt: isoDate
133
141
  }).strict();
134
- var CreateVariableInput = z2.object({ key: variableKey, value: variableValue }).strict();
135
- var UpdateVariableInput = z2.object({ value: variableValue }).strict();
142
+ var CreateVariableInput = z2.object({
143
+ key: variableKey,
144
+ value: variableValue,
145
+ expiresAt: secretExpiry.optional()
146
+ }).strict();
147
+ var UpdateVariableInput = z2.object({
148
+ value: variableValue.optional(),
149
+ expiresAt: secretExpiry.optional()
150
+ }).strict().refine(
151
+ (input2) => input2.value !== void 0 || input2.expiresAt !== void 0,
152
+ {
153
+ message: "Provide value and/or expiresAt"
154
+ }
155
+ );
136
156
  var VariableMetaDto = z2.object({
137
157
  id,
138
158
  key: variableKey,
139
159
  currentVersion: z2.number().int().min(1),
160
+ // Null when the secret never expires.
161
+ expiresAt: isoDate.nullable(),
140
162
  updatedAt: isoDate
141
163
  }).strict();
142
164
  var VariableWithValueDto = VariableMetaDto.extend({
143
165
  value: z2.string()
144
166
  });
145
167
  var BulkUpsertVariablesInput = z2.object({
146
- variables: z2.array(CreateVariableInput).min(1).max(MAX_BULK_VARIABLES).refine(
168
+ variables: z2.array(CreateVariableInput.omit({ expiresAt: true })).min(1).max(MAX_BULK_VARIABLES).refine(
147
169
  (items) => new Set(items.map((item) => item.key)).size === items.length,
148
170
  { message: "Duplicate keys are not allowed" }
149
171
  )
@@ -154,17 +176,39 @@ var BulkUpsertVariablesResponse = z2.object({
154
176
  unchanged: z2.number().int().min(0)
155
177
  }).strict();
156
178
  var environmentIds = z2.array(id).max(100);
157
- var CreateSharedVariableInput = z2.object({ key: variableKey, value: variableValue, environmentIds }).strict();
179
+ var CreateSharedVariableInput = z2.object({
180
+ key: variableKey,
181
+ value: variableValue,
182
+ environmentIds,
183
+ expiresAt: secretExpiry.optional()
184
+ }).strict();
158
185
  var UpdateSharedVariableInput = z2.object({
159
186
  value: variableValue.optional(),
160
- environmentIds: environmentIds.optional()
187
+ environmentIds: environmentIds.optional(),
188
+ expiresAt: secretExpiry.optional()
161
189
  }).strict().refine(
162
- (input2) => input2.value !== void 0 || input2.environmentIds !== void 0,
190
+ (input2) => input2.value !== void 0 || input2.environmentIds !== void 0 || input2.expiresAt !== void 0,
163
191
  {
164
- message: "Provide value and/or environmentIds"
192
+ message: "Provide value, environmentIds and/or expiresAt"
165
193
  }
166
194
  );
167
195
  var SharedVariableMetaDto = VariableMetaDto.extend({ environmentIds });
196
+ var ExpiringSecretDto = z2.object({
197
+ // The reminder's own id, stable for as long as that stage lasts.
198
+ reminderId: id,
199
+ // Days before the expiry the reminder was raised for; 0 once the secret expired.
200
+ threshold: z2.number().int().min(0),
201
+ // When the reminder was logged.
202
+ raisedAt: isoDate,
203
+ // The secret.
204
+ id,
205
+ key: variableKey,
206
+ kind: z2.enum(["environment", "shared"]),
207
+ expiresAt: isoDate,
208
+ project: z2.object({ id, slug, name }).strict(),
209
+ // Null for a shared variable, which belongs to the project rather than one environment.
210
+ environment: z2.object({ id, slug, name }).strict().nullable()
211
+ }).strict();
168
212
  var ListVersionsQuery = z2.object({
169
213
  cursor: z2.string().min(1).max(256).optional(),
170
214
  limit: z2.coerce.number().int().min(1).max(MAX_VERSIONS_LIMIT).default(20)
@@ -200,6 +244,34 @@ var SdkProjectDto = z2.object({
200
244
  role: ProjectRole,
201
245
  environments: z2.array(SdkEnvironmentDto)
202
246
  }).strict();
247
+ var adminPerson = z2.object({ id, name, email }).strict();
248
+ var AdminProjectDto = ProjectDto.extend({
249
+ owner: adminPerson.nullable(),
250
+ memberCount: z2.number().int().min(0),
251
+ environmentCount: z2.number().int().min(0)
252
+ });
253
+ var AdminUserDto = z2.object({
254
+ id,
255
+ email,
256
+ name,
257
+ createdAt: isoDate,
258
+ // Null while the account is enabled.
259
+ disabledAt: isoDate.nullable(),
260
+ isSuperAdmin: z2.boolean(),
261
+ projectCount: z2.number().int().min(0)
262
+ }).strict();
263
+ var AdminUserDetailDto = AdminUserDto.extend({
264
+ // Every project the user is a member of, with their role there.
265
+ projects: z2.array(z2.object({ id, name, slug, role: ProjectRole }).strict())
266
+ });
267
+ var AdminUpdateUserInput = z2.object({
268
+ name: name.optional(),
269
+ email: email.optional(),
270
+ disabled: z2.boolean().optional()
271
+ }).strict().refine(
272
+ (input2) => input2.name !== void 0 || input2.email !== void 0 || input2.disabled !== void 0,
273
+ { message: "Provide name, email and/or disabled" }
274
+ );
203
275
  var CreateTokenInput = z2.object({
204
276
  name,
205
277
  access: TokenAccess,
@@ -249,7 +321,10 @@ var apiEnvironmentSchema = z3.object({
249
321
  COOKIE_SECURE: z3.enum(["true", "false"]).optional(),
250
322
  VARIABLE_HISTORY_LIMIT: z3.coerce.number().int().min(1).max(500).default(50),
251
323
  // Reverse-proxy hops in front of the API (Express `trust proxy`); 0 trusts none.
252
- TRUST_PROXY: z3.coerce.number().int().min(0).max(10).default(0)
324
+ TRUST_PROXY: z3.coerce.number().int().min(0).max(10).default(0),
325
+ // Shared secret for the daily expiry-reminder call (see docs/DEPLOYMENT.md). Unset turns
326
+ // that endpoint off.
327
+ CRON_SECRET: z3.string().min(32).max(256).optional()
253
328
  }).strict().transform((environment) => ({
254
329
  ...environment,
255
330
  COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true"
@@ -1252,7 +1327,7 @@ async function runCommand(deps, command, flags) {
1252
1327
  }
1253
1328
 
1254
1329
  // src/program.ts
1255
- var VERSION = true ? "1.4.0" : "dev";
1330
+ var VERSION = true ? "1.6.0" : "dev";
1256
1331
  function buildProgram(deps, setExitCode) {
1257
1332
  const program = new Command().name("secretenvs").description("Read and manage SecretEnvs variables from the terminal").version(VERSION).configureOutput({
1258
1333
  writeOut: (text) => deps.stdout.write(text),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretenvs/cli",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Command-line client for reading and managing SecretEnvs variables.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankityadavpurson/secretenvs#readme",
@@ -44,8 +44,8 @@
44
44
  "zod": "^4.1.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@secretenvs/contracts": "1.4.0",
48
- "@secretenvs/sdk": "1.4.0",
47
+ "@secretenvs/contracts": "1.6.0",
48
+ "@secretenvs/sdk": "1.6.0",
49
49
  "@types/cross-spawn": "^6.0.6",
50
50
  "tsup": "^8.5.0",
51
51
  "typescript": "~5.9.3",