-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcache.ts
More file actions
34 lines (32 loc) · 831 Bytes
/
cache.ts
File metadata and controls
34 lines (32 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { kv, z } from "./zcli.ts";
export const CACHE_PATH = `${Deno.env.get("HOME")}/.paperspace/cache.toml`;
/**
* This is a local key-value cache that is used to store things like the latest
* version of the CLI. You can add TTLs to the keys if you want to expire them
* after a certain amount of time.
*/
export const cache = kv(
{
updateAvailable: z
.object({
version: z
.string()
.describe(`The version of the update that is available.`),
assets: z
.array(
z.object({
name: z.string(),
url: z.string(),
}),
)
.describe(
`The assets that are available to download for the update.`,
),
})
.strict()
.optional(),
},
{
path: CACHE_PATH,
},
);