@secretenvs/cli 1.3.1 → 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 +59 -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);
@@ -104,17 +107,23 @@ 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();
117
- var ProjectSummaryDto = ProjectDto.extend({ role: ProjectRole });
123
+ var ProjectSummaryDto = ProjectDto.extend({
124
+ role: ProjectRole,
125
+ joinedAt: isoDate
126
+ });
118
127
  var AddMemberInput = z2.object({ email, role: ProjectRole }).strict();
119
128
  var UpdateMemberInput = z2.object({ role: ProjectRole }).strict();
120
129
  var MemberDto = z2.object({ userId: id, email, name, role: ProjectRole, createdAt: isoDate }).strict();
@@ -128,19 +137,33 @@ var EnvironmentDto = z2.object({
128
137
  createdAt: isoDate,
129
138
  updatedAt: isoDate
130
139
  }).strict();
131
- var CreateVariableInput = z2.object({ key: variableKey, value: variableValue }).strict();
132
- 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
+ );
133
154
  var VariableMetaDto = z2.object({
134
155
  id,
135
156
  key: variableKey,
136
157
  currentVersion: z2.number().int().min(1),
158
+ // Null when the secret never expires.
159
+ expiresAt: isoDate.nullable(),
137
160
  updatedAt: isoDate
138
161
  }).strict();
139
162
  var VariableWithValueDto = VariableMetaDto.extend({
140
163
  value: z2.string()
141
164
  });
142
165
  var BulkUpsertVariablesInput = z2.object({
143
- 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(
144
167
  (items) => new Set(items.map((item) => item.key)).size === items.length,
145
168
  { message: "Duplicate keys are not allowed" }
146
169
  )
@@ -151,17 +174,39 @@ var BulkUpsertVariablesResponse = z2.object({
151
174
  unchanged: z2.number().int().min(0)
152
175
  }).strict();
153
176
  var environmentIds = z2.array(id).max(100);
154
- 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();
155
183
  var UpdateSharedVariableInput = z2.object({
156
184
  value: variableValue.optional(),
157
- environmentIds: environmentIds.optional()
185
+ environmentIds: environmentIds.optional(),
186
+ expiresAt: secretExpiry.optional()
158
187
  }).strict().refine(
159
- (input2) => input2.value !== void 0 || input2.environmentIds !== void 0,
188
+ (input2) => input2.value !== void 0 || input2.environmentIds !== void 0 || input2.expiresAt !== void 0,
160
189
  {
161
- message: "Provide value and/or environmentIds"
190
+ message: "Provide value, environmentIds and/or expiresAt"
162
191
  }
163
192
  );
164
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();
165
210
  var ListVersionsQuery = z2.object({
166
211
  cursor: z2.string().min(1).max(256).optional(),
167
212
  limit: z2.coerce.number().int().min(1).max(MAX_VERSIONS_LIMIT).default(20)
@@ -246,7 +291,10 @@ var apiEnvironmentSchema = z3.object({
246
291
  COOKIE_SECURE: z3.enum(["true", "false"]).optional(),
247
292
  VARIABLE_HISTORY_LIMIT: z3.coerce.number().int().min(1).max(500).default(50),
248
293
  // Reverse-proxy hops in front of the API (Express `trust proxy`); 0 trusts none.
249
- 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()
250
298
  }).strict().transform((environment) => ({
251
299
  ...environment,
252
300
  COOKIE_SECURE: environment.COOKIE_SECURE === void 0 ? environment.NODE_ENV === "production" : environment.COOKIE_SECURE === "true"
@@ -1249,7 +1297,7 @@ async function runCommand(deps, command, flags) {
1249
1297
  }
1250
1298
 
1251
1299
  // src/program.ts
1252
- var VERSION = true ? "1.3.1" : "dev";
1300
+ var VERSION = true ? "1.5.0" : "dev";
1253
1301
  function buildProgram(deps, setExitCode) {
1254
1302
  const program = new Command().name("secretenvs").description("Read and manage SecretEnvs variables from the terminal").version(VERSION).configureOutput({
1255
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.3.1",
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.3.1",
48
- "@secretenvs/sdk": "1.3.1",
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",