@secretenvs/cli 1.4.0 → 1.5.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 +55 -10
  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);
@@ -104,13 +107,16 @@ var RecoveryCodesDto = z2.object({ recoveryCodes: z2.array(z2.string()) }).stric
104
107
  var CreateProjectInput = z2.object({ name, slug, description: z2.string().max(500).optional() }).strict();
105
108
  var UpdateProjectInput = z2.object({
106
109
  name: name.optional(),
107
- description: z2.string().max(500).nullable().optional()
110
+ description: z2.string().max(500).nullable().optional(),
111
+ disabled: z2.boolean().optional()
108
112
  }).strict();
109
113
  var ProjectDto = z2.object({
110
114
  id,
111
115
  name,
112
116
  slug,
113
117
  description: z2.string().nullable(),
118
+ // Null while the project is enabled.
119
+ disabledAt: isoDate.nullable(),
114
120
  createdAt: isoDate,
115
121
  updatedAt: isoDate
116
122
  }).strict();
@@ -131,19 +137,33 @@ var EnvironmentDto = z2.object({
131
137
  createdAt: isoDate,
132
138
  updatedAt: isoDate
133
139
  }).strict();
134
- var CreateVariableInput = z2.object({ key: variableKey, value: variableValue }).strict();
135
- var UpdateVariableInput = z2.object({ value: variableValue }).strict();
140
+ var CreateVariableInput = z2.object({
141
+ key: variableKey,
142
+ value: variableValue,
143
+ expiresAt: secretExpiry.optional()
144
+ }).strict();
145
+ var UpdateVariableInput = z2.object({
146
+ value: variableValue.optional(),
147
+ expiresAt: secretExpiry.optional()
148
+ }).strict().refine(
149
+ (input2) => input2.value !== void 0 || input2.expiresAt !== void 0,
150
+ {
151
+ message: "Provide value and/or expiresAt"
152
+ }
153
+ );
136
154
  var VariableMetaDto = z2.object({
137
155
  id,
138
156
  key: variableKey,
139
157
  currentVersion: z2.number().int().min(1),
158
+ // Null when the secret never expires.
159
+ expiresAt: isoDate.nullable(),
140
160
  updatedAt: isoDate
141
161
  }).strict();
142
162
  var VariableWithValueDto = VariableMetaDto.extend({
143
163
  value: z2.string()
144
164
  });
145
165
  var BulkUpsertVariablesInput = z2.object({
146
- variables: z2.array(CreateVariableInput).min(1).max(MAX_BULK_VARIABLES).refine(
166
+ variables: z2.array(CreateVariableInput.omit({ expiresAt: true })).min(1).max(MAX_BULK_VARIABLES).refine(
147
167
  (items) => new Set(items.map((item) => item.key)).size === items.length,
148
168
  { message: "Duplicate keys are not allowed" }
149
169
  )
@@ -154,17 +174,39 @@ var BulkUpsertVariablesResponse = z2.object({
154
174
  unchanged: z2.number().int().min(0)
155
175
  }).strict();
156
176
  var environmentIds = z2.array(id).max(100);
157
- var CreateSharedVariableInput = z2.object({ key: variableKey, value: variableValue, environmentIds }).strict();
177
+ var CreateSharedVariableInput = z2.object({
178
+ key: variableKey,
179
+ value: variableValue,
180
+ environmentIds,
181
+ expiresAt: secretExpiry.optional()
182
+ }).strict();
158
183
  var UpdateSharedVariableInput = z2.object({
159
184
  value: variableValue.optional(),
160
- environmentIds: environmentIds.optional()
185
+ environmentIds: environmentIds.optional(),
186
+ expiresAt: secretExpiry.optional()
161
187
  }).strict().refine(
162
- (input2) => input2.value !== void 0 || input2.environmentIds !== void 0,
188
+ (input2) => input2.value !== void 0 || input2.environmentIds !== void 0 || input2.expiresAt !== void 0,
163
189
  {
164
- message: "Provide value and/or environmentIds"
190
+ message: "Provide value, environmentIds and/or expiresAt"
165
191
  }
166
192
  );
167
193
  var SharedVariableMetaDto = VariableMetaDto.extend({ environmentIds });
194
+ var ExpiringSecretDto = z2.object({
195
+ // The reminder's own id, stable for as long as that stage lasts.
196
+ reminderId: id,
197
+ // Days before the expiry the reminder was raised for; 0 once the secret expired.
198
+ threshold: z2.number().int().min(0),
199
+ // When the reminder was logged.
200
+ raisedAt: isoDate,
201
+ // The secret.
202
+ id,
203
+ key: variableKey,
204
+ kind: z2.enum(["environment", "shared"]),
205
+ expiresAt: isoDate,
206
+ project: z2.object({ id, slug, name }).strict(),
207
+ // Null for a shared variable, which belongs to the project rather than one environment.
208
+ environment: z2.object({ id, slug, name }).strict().nullable()
209
+ }).strict();
168
210
  var ListVersionsQuery = z2.object({
169
211
  cursor: z2.string().min(1).max(256).optional(),
170
212
  limit: z2.coerce.number().int().min(1).max(MAX_VERSIONS_LIMIT).default(20)
@@ -249,7 +291,10 @@ var apiEnvironmentSchema = z3.object({
249
291
  COOKIE_SECURE: z3.enum(["true", "false"]).optional(),
250
292
  VARIABLE_HISTORY_LIMIT: z3.coerce.number().int().min(1).max(500).default(50),
251
293
  // 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)
294
+ TRUST_PROXY: z3.coerce.number().int().min(0).max(10).default(0),
295
+ // Shared secret for the daily expiry-reminder call (see docs/DEPLOYMENT.md). Unset turns
296
+ // that endpoint off.
297
+ CRON_SECRET: z3.string().min(32).max(256).optional()
253
298
  }).strict().transform((environment) => ({
254
299
  ...environment,
255
300
  COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true"
@@ -1252,7 +1297,7 @@ async function runCommand(deps, command, flags) {
1252
1297
  }
1253
1298
 
1254
1299
  // src/program.ts
1255
- var VERSION = true ? "1.4.0" : "dev";
1300
+ var VERSION = true ? "1.5.0" : "dev";
1256
1301
  function buildProgram(deps, setExitCode) {
1257
1302
  const program = new Command().name("secretenvs").description("Read and manage SecretEnvs variables from the terminal").version(VERSION).configureOutput({
1258
1303
  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.5.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.5.0",
48
+ "@secretenvs/sdk": "1.5.0",
49
49
  "@types/cross-spawn": "^6.0.6",
50
50
  "tsup": "^8.5.0",
51
51
  "typescript": "~5.9.3",