neonctl 2.36.0 → 2.36.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.
package/README.md CHANGED
@@ -578,7 +578,7 @@ neon snapshots delete snap-1234
578
578
  # Automatic snapshot (backup) schedule of a branch
579
579
  neon snapshots schedule get --branch main
580
580
  neon snapshots schedule set --branch main --frequency daily --hour 3 --retention 604800
581
- neon snapshots schedule set --branch main --schedule '[{"frequency":"hourly"},{"frequency":"daily","hour":3}]'
581
+ neon snapshots schedule set --branch main --schedule '[{"frequency":"weekly","day":1,"hour":2},{"frequency":"daily","hour":3}]'
582
582
  ```
583
583
 
584
584
  All sub-commands honor the [global options](#global-options), including `--output json|yaml|table`.
@@ -23,13 +23,17 @@ const OPERATION_FIELDS = [
23
23
  "action",
24
24
  "status",
25
25
  ];
26
+ // The values the Neon API accepts for a backup-schedule entry's `frequency`
27
+ // (per the OpenAPI `BackupScheduleItem` description). `satisfies` fails the
28
+ // build if a value listed here leaves the SDK's `SnapshotFrequency` union, so
29
+ // the CLI can never offer a frequency the API rejects.
26
30
  const SNAPSHOT_FREQUENCIES = [
27
- "hourly",
28
31
  "daily",
29
32
  "weekly",
30
33
  "monthly",
31
- "yearly",
32
34
  ];
35
+ /** Narrow an arbitrary string to a supported {@link SnapshotFrequency}. */
36
+ const isSnapshotFrequency = (value) => SNAPSHOT_FREQUENCIES.some((frequency) => frequency === value);
33
37
  export const command = "snapshots";
34
38
  export const describe = "Manage snapshots";
35
39
  export const aliases = ["snapshot"];
@@ -188,7 +192,7 @@ export const builder = (argv) => argv
188
192
  "A daily 03:00 snapshot kept for 7 days",
189
193
  ],
190
194
  [
191
- '$0 snapshots schedule set --branch main --schedule \'[{"frequency":"hourly"},{"frequency":"daily","hour":3}]\'',
195
+ '$0 snapshots schedule set --branch main --schedule \'[{"frequency":"weekly","day":1,"hour":2},{"frequency":"daily","hour":3}]\'',
192
196
  "A multi-entry schedule via JSON",
193
197
  ],
194
198
  ]), (args) => scheduleSet(args))
@@ -395,6 +399,9 @@ const parseScheduleJson = (raw) => {
395
399
  if (typeof frequency !== "string") {
396
400
  throw new Error(`--schedule entry ${index} is missing a string "frequency".`);
397
401
  }
402
+ if (!isSnapshotFrequency(frequency)) {
403
+ throw new Error(`--schedule entry ${index} has an unsupported "frequency": "${frequency}". Use one of: ${SNAPSHOT_FREQUENCIES.join(", ")}.`);
404
+ }
398
405
  const item = { frequency };
399
406
  for (const key of [
400
407
  "hour",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neonctl",
3
- "version": "2.36.0",
3
+ "version": "2.36.1",
4
4
  "description": "CLI tool for Neon Serverless Postgres",
5
5
  "keywords": [
6
6
  "neon",
@@ -51,10 +51,10 @@
51
51
  "which": "3.0.1",
52
52
  "yaml": "^2.9.0",
53
53
  "yargs": "17.7.2",
54
- "@neon/sdk": "1.2.0",
55
- "@neon/config": "0.9.5",
56
- "@neon/config-runtime": "0.9.6",
57
- "@neon/env": "0.11.5"
54
+ "@neon/sdk": "1.3.0",
55
+ "@neon/config": "0.9.6",
56
+ "@neon/env": "0.11.6",
57
+ "@neon/config-runtime": "0.9.7"
58
58
  },
59
59
  "optionalDependencies": {
60
60
  "esbuild": "0.28.1"