@sanity/cli-core 3.6.1 → 3.8.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.
- package/README.md +18 -0
- package/dist/_exports/commandPolicy.d.ts +149 -0
- package/dist/_exports/commandPolicy.js +3 -0
- package/dist/_exports/commandPolicy.js.map +1 -0
- package/dist/_exports/dates.d.ts +18 -6
- package/dist/_exports/dates.js +1 -1
- package/dist/_exports/dates.js.map +1 -1
- package/dist/_exports/index.d.ts +1 -1
- package/dist/_exports/schemas.d.ts +1 -1
- package/dist/_exports/types.d.ts +1 -1
- package/dist/commandPolicy.js +115 -0
- package/dist/commandPolicy.js.map +1 -0
- package/dist/config/cli/schemas.js +4 -1
- package/dist/config/cli/schemas.js.map +1 -1
- package/dist/{schemas-BUfBJffI.d.ts → schemas-DDpPtgia.d.ts} +2 -1
- package/dist/util/dates.js +30 -6
- package/dist/util/dates.js.map +1 -1
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -27,6 +27,24 @@ Browser environment mock. Note this depends on `jsdom` (~46 MB) and so has non-t
|
|
|
27
27
|
| -------------------------- | ---------------------------------------------- |
|
|
28
28
|
| `mockBrowserEnvironment()` | Set up a mocked browser environment via JSDOM. |
|
|
29
29
|
|
|
30
|
+
## `@sanity/cli-core/commandPolicy`
|
|
31
|
+
|
|
32
|
+
The contract for exposing commands to programmatic invocation sources, such as the remote MCP server.
|
|
33
|
+
|
|
34
|
+
| Export | Description |
|
|
35
|
+
| ------------------------------------------ | ------------------------------------------------------------------------------------ |
|
|
36
|
+
| `allow` | Policy stating every valid invocation of the command is safe. |
|
|
37
|
+
| `deny` | Policy stating no invocation is safe; the command behaves like an unknown one. |
|
|
38
|
+
| `conditionalDenyFlags(...names)` | Policy refusing the named flags, which are also hidden from rendered help. |
|
|
39
|
+
| `conditionalPolicy(options)` | `conditionalDenyFlags` plus an extra predicate on the parsed invocation. |
|
|
40
|
+
| `definePluginInvocationPolicies(policies)` | Type-checked identity helper for authoring a plugin's policy module. |
|
|
41
|
+
| `isCommandPolicySet(value)` | Whether a value is a usable policy table. Used by the host to verify plugin modules. |
|
|
42
|
+
| `isConditionalInvocationPolicy(policy)` | Type-guard narrowing a policy to its conditional form. |
|
|
43
|
+
| `CommandPolicy` | One command's policy: a `kind` and a `validate` predicate. |
|
|
44
|
+
| `CommandPolicySet` | A complete policy table, keyed by oclif command id. |
|
|
45
|
+
| `InvocationSource` | Where an invocation originates; selects the policy to enforce. |
|
|
46
|
+
| `PluginInvocationPolicies` | The policies a plugin declares, keyed by invocation source. |
|
|
47
|
+
|
|
30
48
|
## `@sanity/cli-core/config`
|
|
31
49
|
|
|
32
50
|
CLI, studio, and workspace configuration helpers.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { z } from "zod/mini";
|
|
2
|
+
/**
|
|
3
|
+
* The contract for exposing CLI commands to programmatic invocation sources,
|
|
4
|
+
* such as the remote MCP server.
|
|
5
|
+
*
|
|
6
|
+
* A command reaches a programmatic caller only when it satisfies both halves
|
|
7
|
+
* of this contract:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Capability.** The command must be runnable in isolation, which means
|
|
10
|
+
* extending `SanityCommand` (see `@sanity/cli-core/SanityCommand`). That
|
|
11
|
+
* base class supplies `runInExecutionContext()` and routes output, token
|
|
12
|
+
* resolution, interactivity, and project discovery through the CLI
|
|
13
|
+
* execution context. A command extending oclif's `Command` directly cannot
|
|
14
|
+
* be invoked programmatically, no matter what policy it declares.
|
|
15
|
+
* 2. **Policy.** Something must state that the invocation is safe. For the
|
|
16
|
+
* `@sanity/cli` package's own commands that statement lives in the CLI. A
|
|
17
|
+
* plugin states it for its own commands by declaring a policy module (see
|
|
18
|
+
* {@link PluginInvocationPolicies}).
|
|
19
|
+
*
|
|
20
|
+
* Anything not covered by both halves is denied. The absence of a policy is
|
|
21
|
+
* never read as permission.
|
|
22
|
+
*/
|
|
23
|
+
/** The command invocation a conditional policy is evaluated against. */
|
|
24
|
+
declare const InvocationPolicySchema: z.ZodMiniFunction<z.ZodMiniTuple<[z.ZodMiniObject<{
|
|
25
|
+
args: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
26
|
+
flags: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
27
|
+
}, z.core.$strip>], null>, z.ZodMiniBoolean<boolean>>;
|
|
28
|
+
declare const CommandPolicyConditionalSchema: z.ZodMiniObject<{
|
|
29
|
+
deniedFlags: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
30
|
+
kind: z.ZodMiniLiteral<"conditional">;
|
|
31
|
+
validate: z.ZodMiniFunction<z.ZodMiniTuple<[z.ZodMiniObject<{
|
|
32
|
+
args: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
33
|
+
flags: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
34
|
+
}, z.core.$strip>], null>, z.ZodMiniBoolean<boolean>>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
declare const CommandPolicySchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
37
|
+
kind: z.ZodMiniEnum<{
|
|
38
|
+
allow: "allow";
|
|
39
|
+
deny: "deny";
|
|
40
|
+
}>;
|
|
41
|
+
validate: z.ZodMiniFunction<z.ZodMiniTuple<[z.ZodMiniObject<{
|
|
42
|
+
args: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
43
|
+
flags: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
44
|
+
}, z.core.$strip>], null>, z.ZodMiniBoolean<boolean>>;
|
|
45
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
46
|
+
deniedFlags: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
47
|
+
kind: z.ZodMiniLiteral<"conditional">;
|
|
48
|
+
validate: z.ZodMiniFunction<z.ZodMiniTuple<[z.ZodMiniObject<{
|
|
49
|
+
args: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
50
|
+
flags: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
51
|
+
}, z.core.$strip>], null>, z.ZodMiniBoolean<boolean>>;
|
|
52
|
+
}, z.core.$strip>]>;
|
|
53
|
+
declare const CommandPolicySetSchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
54
|
+
kind: z.ZodMiniEnum<{
|
|
55
|
+
allow: "allow";
|
|
56
|
+
deny: "deny";
|
|
57
|
+
}>;
|
|
58
|
+
validate: z.ZodMiniFunction<z.ZodMiniTuple<[z.ZodMiniObject<{
|
|
59
|
+
args: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
60
|
+
flags: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
61
|
+
}, z.core.$strip>], null>, z.ZodMiniBoolean<boolean>>;
|
|
62
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
63
|
+
deniedFlags: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
64
|
+
kind: z.ZodMiniLiteral<"conditional">;
|
|
65
|
+
validate: z.ZodMiniFunction<z.ZodMiniTuple<[z.ZodMiniObject<{
|
|
66
|
+
args: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
67
|
+
flags: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
68
|
+
}, z.core.$strip>], null>, z.ZodMiniBoolean<boolean>>;
|
|
69
|
+
}, z.core.$strip>]>>;
|
|
70
|
+
type InvocationPolicy = z.infer<typeof InvocationPolicySchema>;
|
|
71
|
+
type ConditionalInvocationPolicy = z.infer<typeof CommandPolicyConditionalSchema>;
|
|
72
|
+
type CommandPolicy = z.infer<typeof CommandPolicySchema>;
|
|
73
|
+
/** A complete policy table, keyed by oclif command id. */
|
|
74
|
+
type CommandPolicySet = z.infer<typeof CommandPolicySetSchema>;
|
|
75
|
+
/** Where an invocation originates; selects the policy to enforce. */
|
|
76
|
+
type InvocationSource = 'mcp';
|
|
77
|
+
/**
|
|
78
|
+
* The policies a plugin declares for the commands it contributes, keyed by
|
|
79
|
+
* invocation source. A source left out denies every command for that source.
|
|
80
|
+
*
|
|
81
|
+
* Declared by pointing at the module from the plugin's package.json:
|
|
82
|
+
*
|
|
83
|
+
* ```json
|
|
84
|
+
* {"sanity": {"invocationPolicies": "./dist/invocationPolicies.js"}}
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* The module must provide this table as a named `invocationPolicies` export.
|
|
88
|
+
* It is resolved once per plugin, so root help stays cheap, and it is code
|
|
89
|
+
* rather than JSON so conditional policies can inspect parsed invocations.
|
|
90
|
+
*
|
|
91
|
+
* Two limits apply, and neither is negotiable by the declaring plugin:
|
|
92
|
+
* entries for commands the plugin does not contribute are ignored, and a
|
|
93
|
+
* command the hosting CLI already governs keeps the CLI's own policy. A
|
|
94
|
+
* declaration is a request to expose surface, not a grant.
|
|
95
|
+
*/
|
|
96
|
+
type PluginInvocationPolicies = Partial<Record<InvocationSource, CommandPolicySet>>;
|
|
97
|
+
/** Every valid invocation of the command is safe. */
|
|
98
|
+
declare const allow: CommandPolicy;
|
|
99
|
+
/** No invocation of the command is safe. Behaves like an unknown command. */
|
|
100
|
+
declare const deny: CommandPolicy;
|
|
101
|
+
/**
|
|
102
|
+
* Conditional policies to deny flags. The flags are also hidden
|
|
103
|
+
* from rendered help, so hosts are never told about surface they cannot use.
|
|
104
|
+
*/
|
|
105
|
+
declare function conditionalDenyFlags(...names: string[]): ConditionalInvocationPolicy;
|
|
106
|
+
/**
|
|
107
|
+
* Conditional policy combining {@link conditionalDenyFlags} with an extra
|
|
108
|
+
* predicate on the parsed invocation, for conditions a flag name alone
|
|
109
|
+
* cannot express — e.g. flag values that would read from the host machine.
|
|
110
|
+
* `deniedFlags` are hidden from rendered help; the predicate is not
|
|
111
|
+
* expressible there, so flags it constrains stay advertised.
|
|
112
|
+
*/
|
|
113
|
+
declare function conditionalPolicy(options: {
|
|
114
|
+
deniedFlags?: string[];
|
|
115
|
+
validate: InvocationPolicy;
|
|
116
|
+
}): ConditionalInvocationPolicy;
|
|
117
|
+
/**
|
|
118
|
+
* Type-checked identity helper for authoring a plugin's policy module.
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* import {allow, definePluginInvocationPolicies, deny} from '@sanity/cli-core/commandPolicy'
|
|
122
|
+
*
|
|
123
|
+
* export const invocationPolicies = definePluginInvocationPolicies({
|
|
124
|
+
* mcp: {
|
|
125
|
+
* 'widgets:list': allow,
|
|
126
|
+
* // Reads widget definitions from the local filesystem.
|
|
127
|
+
* 'widgets:push': deny,
|
|
128
|
+
* },
|
|
129
|
+
* })
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
declare function definePluginInvocationPolicies(policies: PluginInvocationPolicies): PluginInvocationPolicies;
|
|
133
|
+
/**
|
|
134
|
+
* Identified by shape rather than by identity, because a plugin's policies are
|
|
135
|
+
* built against its own copy of this module.
|
|
136
|
+
*
|
|
137
|
+
* `deniedFlags` is checked as well as `kind`, so callers that read it off the
|
|
138
|
+
* narrowed type cannot be handed an object that only claims to be conditional.
|
|
139
|
+
*/
|
|
140
|
+
declare function isConditionalInvocationPolicy(policy: CommandPolicy): policy is ConditionalInvocationPolicy;
|
|
141
|
+
/**
|
|
142
|
+
* Whether an arbitrary value is a usable policy table. Plugin policy modules
|
|
143
|
+
* are third-party code loaded at runtime, so their shape is verified rather
|
|
144
|
+
* than trusted; anything that does not match is treated as no declaration at
|
|
145
|
+
* all, which denies the plugin's commands.
|
|
146
|
+
*/
|
|
147
|
+
declare function isCommandPolicySet(value: unknown): value is CommandPolicySet;
|
|
148
|
+
export { CommandPolicy, CommandPolicySet, InvocationSource, PluginInvocationPolicies, allow, conditionalDenyFlags, conditionalPolicy, definePluginInvocationPolicies, deny, isCommandPolicySet, isConditionalInvocationPolicy };
|
|
149
|
+
//# sourceMappingURL=commandPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/commandPolicy.ts"],"sourcesContent":["export * from '../commandPolicy.js'\n"],"names":[],"mappings":"AAAA,cAAc,sBAAqB"}
|
package/dist/_exports/dates.d.ts
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Formats a timestamp as `YYYY-MM-DD HH:mm:ss` in the local time zone.
|
|
3
|
-
*
|
|
2
|
+
* Formats a timestamp as `YYYY-MM-DD HH:mm:ss` in the local time zone. An unparseable
|
|
3
|
+
* string is returned as-is, so a bad value from the API doesn't fail the command. An
|
|
4
|
+
* invalid `Date` or a non-finite number formats as an empty string.
|
|
4
5
|
*
|
|
5
|
-
* @param timestamp - An ISO 8601 timestamp
|
|
6
|
+
* @param timestamp - An ISO 8601 timestamp, epoch milliseconds, or a `Date`
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
8
|
-
declare function formatDateTime(timestamp: string): string;
|
|
9
|
+
declare function formatDateTime(timestamp: Date | number | string): string;
|
|
9
10
|
/**
|
|
10
11
|
* Formats a duration in milliseconds as an approximate, human readable length of
|
|
11
|
-
* time, eg `less than a minute`, `5 minutes` or `2 days`.
|
|
12
|
+
* time, eg `less than a minute`, `5 minutes` or `2 days`. Use {@link formatElapsed}
|
|
13
|
+
* where the exact length matters.
|
|
12
14
|
*
|
|
13
15
|
* @param ms - The duration in milliseconds
|
|
14
16
|
* @internal
|
|
15
17
|
*/
|
|
16
18
|
declare function formatDuration(ms: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Formats an elapsed time in milliseconds precisely, eg `450ms`, `12s`, `1m 30s` or
|
|
21
|
+
* `2h 5m`. Two adjacent units are shown once the time reaches a minute, so a column
|
|
22
|
+
* of values lines up. Use this for how long an operation took, where a second of
|
|
23
|
+
* difference is meaningful; use {@link formatDuration} for an approximate description.
|
|
24
|
+
*
|
|
25
|
+
* @param ms - The elapsed time in milliseconds
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
declare function formatElapsed(ms: number): string;
|
|
17
29
|
/**
|
|
18
30
|
* Formats a date relative to now, eg `2 days ago` or `in 3 hours`.
|
|
19
31
|
*
|
|
@@ -30,5 +42,5 @@ declare function formatTimeAgo(date: Date, now?: number): string;
|
|
|
30
42
|
* @internal
|
|
31
43
|
*/
|
|
32
44
|
declare function parseDateOnly(value: string): Date | undefined;
|
|
33
|
-
export { formatDateTime, formatDuration, formatTimeAgo, parseDateOnly };
|
|
45
|
+
export { formatDateTime, formatDuration, formatElapsed, formatTimeAgo, parseDateOnly };
|
|
34
46
|
//# sourceMappingURL=dates.d.ts.map
|
package/dist/_exports/dates.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_exports/dates.ts"],"sourcesContent":["export {formatDateTime
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/dates.ts"],"sourcesContent":["export {\n formatDateTime,\n formatDuration,\n formatElapsed,\n formatTimeAgo,\n parseDateOnly,\n} from '../util/dates.js'\n"],"names":["formatDateTime","formatDuration","formatElapsed","formatTimeAgo","parseDateOnly"],"mappings":"AAAA,SACEA,cAAc,EACdC,cAAc,EACdC,aAAa,EACbC,aAAa,EACbC,aAAa,QACR,mBAAkB"}
|
package/dist/_exports/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { a as isCi, i as isInteractive, n as normalizePath, o as importModule, r
|
|
|
18
18
|
import { a as getLocalPackageVersion, i as getLocalPackageDir, n as resolveLocalPackageFrom, r as resolveLocalPackagePath, t as resolveLocalPackage } from "../resolveLocalPackage-Dr-TNTyk.js";
|
|
19
19
|
import { n as ReadPackageJsonOptions, r as readPackageJson, t as PackageJson } from "../readPackageJson-Cr_lbjVR.js";
|
|
20
20
|
import { n as colorizeJson, t as getTimer } from "../timer-Dwu2TIgB.js";
|
|
21
|
-
import { i as studioManifestSchema, n as StudioManifest, r as coreAppManifestSchema, t as CoreAppManifest } from "../schemas-
|
|
21
|
+
import { i as studioManifestSchema, n as StudioManifest, r as coreAppManifestSchema, t as CoreAppManifest } from "../schemas-DDpPtgia.js";
|
|
22
22
|
import { WorkerOptions } from "node:worker_threads";
|
|
23
23
|
interface PromisifyWorkerOptions extends WorkerOptions {
|
|
24
24
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as cliConfigSchema, i as studioManifestSchema, n as StudioManifest, r as coreAppManifestSchema, t as CoreAppManifest } from "../schemas-
|
|
1
|
+
import { a as cliConfigSchema, i as studioManifestSchema, n as StudioManifest, r as coreAppManifestSchema, t as CoreAppManifest } from "../schemas-DDpPtgia.js";
|
|
2
2
|
export { type CoreAppManifest, type StudioManifest, cliConfigSchema, coreAppManifestSchema, studioManifestSchema };
|
package/dist/_exports/types.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ import { n as RequireProps, r as SanityOrgUser, t as Output } from "../types-CwJ
|
|
|
5
5
|
import { SanityCommandInterface } from "../SanityCommand.js";
|
|
6
6
|
import { t as ApplicationType } from "../workbenchApp-DVKwpTyU.js";
|
|
7
7
|
import { n as ReadPackageJsonOptions, t as PackageJson } from "../readPackageJson-Cr_lbjVR.js";
|
|
8
|
-
import { n as StudioManifest, t as CoreAppManifest } from "../schemas-
|
|
8
|
+
import { n as StudioManifest, t as CoreAppManifest } from "../schemas-DDpPtgia.js";
|
|
9
9
|
export type { ApplicationType, CLITelemetryStore, CliConfig, ConfigStore, ConsentInformation, CoreAppManifest, Output, PackageJson, ProjectRootResult, ReactCompilerConfig, ReadPackageJsonOptions, RequireProps, SanityCommandInterface, SanityOrgUser, StudioManifest, TelemetryUserProperties, TypeGenConfig, UserViteConfig };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { z } from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* The contract for exposing CLI commands to programmatic invocation sources,
|
|
4
|
+
* such as the remote MCP server.
|
|
5
|
+
*
|
|
6
|
+
* A command reaches a programmatic caller only when it satisfies both halves
|
|
7
|
+
* of this contract:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Capability.** The command must be runnable in isolation, which means
|
|
10
|
+
* extending `SanityCommand` (see `@sanity/cli-core/SanityCommand`). That
|
|
11
|
+
* base class supplies `runInExecutionContext()` and routes output, token
|
|
12
|
+
* resolution, interactivity, and project discovery through the CLI
|
|
13
|
+
* execution context. A command extending oclif's `Command` directly cannot
|
|
14
|
+
* be invoked programmatically, no matter what policy it declares.
|
|
15
|
+
* 2. **Policy.** Something must state that the invocation is safe. For the
|
|
16
|
+
* `@sanity/cli` package's own commands that statement lives in the CLI. A
|
|
17
|
+
* plugin states it for its own commands by declaring a policy module (see
|
|
18
|
+
* {@link PluginInvocationPolicies}).
|
|
19
|
+
*
|
|
20
|
+
* Anything not covered by both halves is denied. The absence of a policy is
|
|
21
|
+
* never read as permission.
|
|
22
|
+
*/ /** The command invocation a conditional policy is evaluated against. */ const InvocationPolicySchema = z.function({
|
|
23
|
+
input: [
|
|
24
|
+
z.object({
|
|
25
|
+
args: z.record(z.string(), z.unknown()),
|
|
26
|
+
flags: z.record(z.string(), z.unknown())
|
|
27
|
+
})
|
|
28
|
+
],
|
|
29
|
+
output: z.boolean()
|
|
30
|
+
});
|
|
31
|
+
// A conditional entry must carry the deniedFlags list for the help renderer
|
|
32
|
+
// to omit them from the advertised command surface.
|
|
33
|
+
const CommandPolicyConditionalSchema = z.object({
|
|
34
|
+
deniedFlags: z.array(z.string()),
|
|
35
|
+
kind: z.literal('conditional'),
|
|
36
|
+
validate: InvocationPolicySchema
|
|
37
|
+
});
|
|
38
|
+
const CommandPolicySchema = z.union([
|
|
39
|
+
z.object({
|
|
40
|
+
kind: z.enum([
|
|
41
|
+
'allow',
|
|
42
|
+
'deny'
|
|
43
|
+
]),
|
|
44
|
+
validate: InvocationPolicySchema
|
|
45
|
+
}),
|
|
46
|
+
CommandPolicyConditionalSchema
|
|
47
|
+
]);
|
|
48
|
+
const CommandPolicySetSchema = z.record(z.string(), CommandPolicySchema);
|
|
49
|
+
/** Every valid invocation of the command is safe. */ export const allow = {
|
|
50
|
+
kind: 'allow',
|
|
51
|
+
validate: ()=>true
|
|
52
|
+
};
|
|
53
|
+
/** No invocation of the command is safe. Behaves like an unknown command. */ export const deny = {
|
|
54
|
+
kind: 'deny',
|
|
55
|
+
validate: ()=>false
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Conditional policies to deny flags. The flags are also hidden
|
|
59
|
+
* from rendered help, so hosts are never told about surface they cannot use.
|
|
60
|
+
*/ export function conditionalDenyFlags(...names) {
|
|
61
|
+
return {
|
|
62
|
+
deniedFlags: names,
|
|
63
|
+
kind: 'conditional',
|
|
64
|
+
validate: ({ flags })=>names.every((name)=>flags[name] === undefined || flags[name] === false)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Conditional policy combining {@link conditionalDenyFlags} with an extra
|
|
69
|
+
* predicate on the parsed invocation, for conditions a flag name alone
|
|
70
|
+
* cannot express — e.g. flag values that would read from the host machine.
|
|
71
|
+
* `deniedFlags` are hidden from rendered help; the predicate is not
|
|
72
|
+
* expressible there, so flags it constrains stay advertised.
|
|
73
|
+
*/ export function conditionalPolicy(options) {
|
|
74
|
+
const denyFlags = conditionalDenyFlags(...options.deniedFlags ?? []);
|
|
75
|
+
return {
|
|
76
|
+
...denyFlags,
|
|
77
|
+
validate: (invocation)=>denyFlags.validate(invocation) && options.validate(invocation)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Type-checked identity helper for authoring a plugin's policy module.
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* import {allow, definePluginInvocationPolicies, deny} from '@sanity/cli-core/commandPolicy'
|
|
85
|
+
*
|
|
86
|
+
* export const invocationPolicies = definePluginInvocationPolicies({
|
|
87
|
+
* mcp: {
|
|
88
|
+
* 'widgets:list': allow,
|
|
89
|
+
* // Reads widget definitions from the local filesystem.
|
|
90
|
+
* 'widgets:push': deny,
|
|
91
|
+
* },
|
|
92
|
+
* })
|
|
93
|
+
* ```
|
|
94
|
+
*/ export function definePluginInvocationPolicies(policies) {
|
|
95
|
+
return policies;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Identified by shape rather than by identity, because a plugin's policies are
|
|
99
|
+
* built against its own copy of this module.
|
|
100
|
+
*
|
|
101
|
+
* `deniedFlags` is checked as well as `kind`, so callers that read it off the
|
|
102
|
+
* narrowed type cannot be handed an object that only claims to be conditional.
|
|
103
|
+
*/ export function isConditionalInvocationPolicy(policy) {
|
|
104
|
+
return CommandPolicyConditionalSchema.safeParse(policy).success;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Whether an arbitrary value is a usable policy table. Plugin policy modules
|
|
108
|
+
* are third-party code loaded at runtime, so their shape is verified rather
|
|
109
|
+
* than trusted; anything that does not match is treated as no declaration at
|
|
110
|
+
* all, which denies the plugin's commands.
|
|
111
|
+
*/ export function isCommandPolicySet(value) {
|
|
112
|
+
return CommandPolicySetSchema.safeParse(value).success;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=commandPolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commandPolicy.ts"],"sourcesContent":["import {z} from 'zod/mini'\n\n/**\n * The contract for exposing CLI commands to programmatic invocation sources,\n * such as the remote MCP server.\n *\n * A command reaches a programmatic caller only when it satisfies both halves\n * of this contract:\n *\n * 1. **Capability.** The command must be runnable in isolation, which means\n * extending `SanityCommand` (see `@sanity/cli-core/SanityCommand`). That\n * base class supplies `runInExecutionContext()` and routes output, token\n * resolution, interactivity, and project discovery through the CLI\n * execution context. A command extending oclif's `Command` directly cannot\n * be invoked programmatically, no matter what policy it declares.\n * 2. **Policy.** Something must state that the invocation is safe. For the\n * `@sanity/cli` package's own commands that statement lives in the CLI. A\n * plugin states it for its own commands by declaring a policy module (see\n * {@link PluginInvocationPolicies}).\n *\n * Anything not covered by both halves is denied. The absence of a policy is\n * never read as permission.\n */\n\n/** The command invocation a conditional policy is evaluated against. */\nconst InvocationPolicySchema = z.function({\n input: [\n z.object({\n args: z.record(z.string(), z.unknown()),\n flags: z.record(z.string(), z.unknown()),\n }),\n ],\n output: z.boolean(),\n})\n\n// A conditional entry must carry the deniedFlags list for the help renderer\n// to omit them from the advertised command surface.\nconst CommandPolicyConditionalSchema = z.object({\n deniedFlags: z.array(z.string()),\n kind: z.literal('conditional'),\n validate: InvocationPolicySchema,\n})\n\nconst CommandPolicySchema = z.union([\n z.object({\n kind: z.enum(['allow', 'deny']),\n validate: InvocationPolicySchema,\n }),\n CommandPolicyConditionalSchema,\n])\n\nconst CommandPolicySetSchema = z.record(z.string(), CommandPolicySchema)\n\ntype InvocationPolicy = z.infer<typeof InvocationPolicySchema>\n\ntype ConditionalInvocationPolicy = z.infer<typeof CommandPolicyConditionalSchema>\n\nexport type CommandPolicy = z.infer<typeof CommandPolicySchema>\n\n/** A complete policy table, keyed by oclif command id. */\nexport type CommandPolicySet = z.infer<typeof CommandPolicySetSchema>\n\n/** Where an invocation originates; selects the policy to enforce. */\nexport type InvocationSource = 'mcp'\n\n/**\n * The policies a plugin declares for the commands it contributes, keyed by\n * invocation source. A source left out denies every command for that source.\n *\n * Declared by pointing at the module from the plugin's package.json:\n *\n * ```json\n * {\"sanity\": {\"invocationPolicies\": \"./dist/invocationPolicies.js\"}}\n * ```\n *\n * The module must provide this table as a named `invocationPolicies` export.\n * It is resolved once per plugin, so root help stays cheap, and it is code\n * rather than JSON so conditional policies can inspect parsed invocations.\n *\n * Two limits apply, and neither is negotiable by the declaring plugin:\n * entries for commands the plugin does not contribute are ignored, and a\n * command the hosting CLI already governs keeps the CLI's own policy. A\n * declaration is a request to expose surface, not a grant.\n */\nexport type PluginInvocationPolicies = Partial<Record<InvocationSource, CommandPolicySet>>\n\n/** Every valid invocation of the command is safe. */\nexport const allow: CommandPolicy = {kind: 'allow', validate: () => true}\n\n/** No invocation of the command is safe. Behaves like an unknown command. */\nexport const deny: CommandPolicy = {kind: 'deny', validate: () => false}\n\n/**\n * Conditional policies to deny flags. The flags are also hidden\n * from rendered help, so hosts are never told about surface they cannot use.\n */\nexport function conditionalDenyFlags(...names: string[]): ConditionalInvocationPolicy {\n return {\n deniedFlags: names,\n kind: 'conditional',\n validate: ({flags}) =>\n names.every((name) => flags[name] === undefined || flags[name] === false),\n }\n}\n\n/**\n * Conditional policy combining {@link conditionalDenyFlags} with an extra\n * predicate on the parsed invocation, for conditions a flag name alone\n * cannot express — e.g. flag values that would read from the host machine.\n * `deniedFlags` are hidden from rendered help; the predicate is not\n * expressible there, so flags it constrains stay advertised.\n */\nexport function conditionalPolicy(options: {\n deniedFlags?: string[]\n validate: InvocationPolicy\n}): ConditionalInvocationPolicy {\n const denyFlags = conditionalDenyFlags(...(options.deniedFlags ?? []))\n return {\n ...denyFlags,\n validate: (invocation) => denyFlags.validate(invocation) && options.validate(invocation),\n }\n}\n\n/**\n * Type-checked identity helper for authoring a plugin's policy module.\n *\n * ```ts\n * import {allow, definePluginInvocationPolicies, deny} from '@sanity/cli-core/commandPolicy'\n *\n * export const invocationPolicies = definePluginInvocationPolicies({\n * mcp: {\n * 'widgets:list': allow,\n * // Reads widget definitions from the local filesystem.\n * 'widgets:push': deny,\n * },\n * })\n * ```\n */\nexport function definePluginInvocationPolicies(\n policies: PluginInvocationPolicies,\n): PluginInvocationPolicies {\n return policies\n}\n\n/**\n * Identified by shape rather than by identity, because a plugin's policies are\n * built against its own copy of this module.\n *\n * `deniedFlags` is checked as well as `kind`, so callers that read it off the\n * narrowed type cannot be handed an object that only claims to be conditional.\n */\nexport function isConditionalInvocationPolicy(\n policy: CommandPolicy,\n): policy is ConditionalInvocationPolicy {\n return CommandPolicyConditionalSchema.safeParse(policy).success\n}\n\n/**\n * Whether an arbitrary value is a usable policy table. Plugin policy modules\n * are third-party code loaded at runtime, so their shape is verified rather\n * than trusted; anything that does not match is treated as no declaration at\n * all, which denies the plugin's commands.\n */\nexport function isCommandPolicySet(value: unknown): value is CommandPolicySet {\n return CommandPolicySetSchema.safeParse(value).success\n}\n"],"names":["z","InvocationPolicySchema","function","input","object","args","record","string","unknown","flags","output","boolean","CommandPolicyConditionalSchema","deniedFlags","array","kind","literal","validate","CommandPolicySchema","union","enum","CommandPolicySetSchema","allow","deny","conditionalDenyFlags","names","every","name","undefined","conditionalPolicy","options","denyFlags","invocation","definePluginInvocationPolicies","policies","isConditionalInvocationPolicy","policy","safeParse","success","isCommandPolicySet","value"],"mappings":"AAAA,SAAQA,CAAC,QAAO,WAAU;AAE1B;;;;;;;;;;;;;;;;;;;;CAoBC,GAED,sEAAsE,GACtE,MAAMC,yBAAyBD,EAAEE,QAAQ,CAAC;IACxCC,OAAO;QACLH,EAAEI,MAAM,CAAC;YACPC,MAAML,EAAEM,MAAM,CAACN,EAAEO,MAAM,IAAIP,EAAEQ,OAAO;YACpCC,OAAOT,EAAEM,MAAM,CAACN,EAAEO,MAAM,IAAIP,EAAEQ,OAAO;QACvC;KACD;IACDE,QAAQV,EAAEW,OAAO;AACnB;AAEA,4EAA4E;AAC5E,oDAAoD;AACpD,MAAMC,iCAAiCZ,EAAEI,MAAM,CAAC;IAC9CS,aAAab,EAAEc,KAAK,CAACd,EAAEO,MAAM;IAC7BQ,MAAMf,EAAEgB,OAAO,CAAC;IAChBC,UAAUhB;AACZ;AAEA,MAAMiB,sBAAsBlB,EAAEmB,KAAK,CAAC;IAClCnB,EAAEI,MAAM,CAAC;QACPW,MAAMf,EAAEoB,IAAI,CAAC;YAAC;YAAS;SAAO;QAC9BH,UAAUhB;IACZ;IACAW;CACD;AAED,MAAMS,yBAAyBrB,EAAEM,MAAM,CAACN,EAAEO,MAAM,IAAIW;AAmCpD,mDAAmD,GACnD,OAAO,MAAMI,QAAuB;IAACP,MAAM;IAASE,UAAU,IAAM;AAAI,EAAC;AAEzE,2EAA2E,GAC3E,OAAO,MAAMM,OAAsB;IAACR,MAAM;IAAQE,UAAU,IAAM;AAAK,EAAC;AAExE;;;CAGC,GACD,OAAO,SAASO,qBAAqB,GAAGC,KAAe;IACrD,OAAO;QACLZ,aAAaY;QACbV,MAAM;QACNE,UAAU,CAAC,EAACR,KAAK,EAAC,GAChBgB,MAAMC,KAAK,CAAC,CAACC,OAASlB,KAAK,CAACkB,KAAK,KAAKC,aAAanB,KAAK,CAACkB,KAAK,KAAK;IACvE;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASE,kBAAkBC,OAGjC;IACC,MAAMC,YAAYP,wBAAyBM,QAAQjB,WAAW,IAAI,EAAE;IACpE,OAAO;QACL,GAAGkB,SAAS;QACZd,UAAU,CAACe,aAAeD,UAAUd,QAAQ,CAACe,eAAeF,QAAQb,QAAQ,CAACe;IAC/E;AACF;AAEA;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC,+BACdC,QAAkC;IAElC,OAAOA;AACT;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,8BACdC,MAAqB;IAErB,OAAOxB,+BAA+ByB,SAAS,CAACD,QAAQE,OAAO;AACjE;AAEA;;;;;CAKC,GACD,OAAO,SAASC,mBAAmBC,KAAc;IAC/C,OAAOnB,uBAAuBgB,SAAS,CAACG,OAAOF,OAAO;AACxD"}
|
|
@@ -18,7 +18,10 @@ import { APP_VISIBILITIES } from './types/cliConfig.js';
|
|
|
18
18
|
autoUpdates: z.optional(z.boolean()),
|
|
19
19
|
deployment: z.optional(z.object({
|
|
20
20
|
appId: z.optional(z.string()),
|
|
21
|
-
autoUpdates: z.optional(z.boolean())
|
|
21
|
+
autoUpdates: z.optional(z.boolean()),
|
|
22
|
+
studioHost: z.optional(z.never({
|
|
23
|
+
error: 'deployment.studioHost is not supported. Move studioHost to the top level of sanity.cli.ts, or pass --url <hostname> to sanity deploy.'
|
|
24
|
+
}))
|
|
22
25
|
})),
|
|
23
26
|
graphql: z.optional(z.array(z.object({
|
|
24
27
|
filterSuffix: z.optional(z.string()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {z} from 'zod/mini'\n\nimport {\n APP_VISIBILITIES,\n type CliConfig,\n type ReactCompilerConfig,\n type TypeGenConfig,\n} from './types/cliConfig.js'\nimport {type UserViteConfig} from './types/userViteConfig'\n\n/**\n * @public\n */\nexport const cliConfigSchema = z.object({\n api: z.optional(\n z.object({\n dataset: z.optional(z.string()),\n projectId: z.optional(z.string()),\n }),\n ),\n\n app: z.optional(\n z.object({\n entry: z.optional(z.string()),\n icon: z.optional(z.string()),\n id: z.optional(z.string()),\n organizationId: z.optional(z.string()),\n title: z.optional(z.string()),\n visibility: z.optional(z.enum(APP_VISIBILITIES)),\n }),\n ),\n\n autoUpdates: z.optional(z.boolean()),\n\n deployment: z.optional(\n z.object({\n appId: z.optional(z.string()),\n autoUpdates: z.optional(z.boolean()),\n }),\n ),\n\n graphql: z.optional(\n z.array(\n z.object({\n filterSuffix: z.optional(z.string()),\n generation: z.optional(z.enum(['gen1', 'gen2', 'gen3'])),\n id: z.optional(z.string()),\n nonNullDocumentFields: z.optional(z.boolean()),\n playground: z.optional(z.boolean()),\n source: z.optional(z.string()),\n tag: z.optional(z.string()),\n workspace: z.optional(z.string()),\n }),\n ),\n ),\n\n mediaLibrary: z.optional(\n z.object({\n aspectsPath: z.optional(z.string()),\n }),\n ),\n\n project: z.optional(\n z.object({\n basePath: z.optional(z.string()),\n }),\n ),\n\n reactCompiler: z.optional(z.custom<boolean | ReactCompilerConfig>()),\n\n reactStrictMode: z.optional(z.boolean()),\n\n schemaExtraction: z.optional(\n z.object({\n enabled: z.optional(z.boolean()),\n enforceRequiredFields: z.optional(z.boolean()),\n path: z.optional(z.string()),\n watchPatterns: z.optional(z.array(z.string())),\n workspace: z.optional(z.string()),\n }),\n ),\n\n server: z.optional(\n z.object({\n hostname: z.optional(z.string()),\n port: z.optional(z.number()),\n }),\n ),\n\n studioHost: z.optional(z.string()),\n\n unstable_bundledDev: z.optional(z.boolean()),\n\n vite: z.optional(z.custom<UserViteConfig>()),\n\n typegen: z.optional(z.custom<Partial<TypeGenConfig> & {enabled?: boolean}>()),\n}) satisfies z.core.$ZodType<CliConfig>\n"],"names":["z","APP_VISIBILITIES","cliConfigSchema","object","api","optional","dataset","string","projectId","app","entry","icon","id","organizationId","title","visibility","enum","autoUpdates","boolean","deployment","appId","graphql","array","filterSuffix","generation","nonNullDocumentFields","playground","source","tag","workspace","mediaLibrary","aspectsPath","project","basePath","reactCompiler","custom","reactStrictMode","schemaExtraction","enabled","enforceRequiredFields","path","watchPatterns","server","hostname","port","number","
|
|
1
|
+
{"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {z} from 'zod/mini'\n\nimport {\n APP_VISIBILITIES,\n type CliConfig,\n type ReactCompilerConfig,\n type TypeGenConfig,\n} from './types/cliConfig.js'\nimport {type UserViteConfig} from './types/userViteConfig'\n\n/**\n * @public\n */\nexport const cliConfigSchema = z.object({\n api: z.optional(\n z.object({\n dataset: z.optional(z.string()),\n projectId: z.optional(z.string()),\n }),\n ),\n\n app: z.optional(\n z.object({\n entry: z.optional(z.string()),\n icon: z.optional(z.string()),\n id: z.optional(z.string()),\n organizationId: z.optional(z.string()),\n title: z.optional(z.string()),\n visibility: z.optional(z.enum(APP_VISIBILITIES)),\n }),\n ),\n\n autoUpdates: z.optional(z.boolean()),\n\n deployment: z.optional(\n z.object({\n appId: z.optional(z.string()),\n autoUpdates: z.optional(z.boolean()),\n studioHost: z.optional(\n z.never({\n error:\n 'deployment.studioHost is not supported. Move studioHost to the top level of sanity.cli.ts, or pass --url <hostname> to sanity deploy.',\n }),\n ),\n }),\n ),\n\n graphql: z.optional(\n z.array(\n z.object({\n filterSuffix: z.optional(z.string()),\n generation: z.optional(z.enum(['gen1', 'gen2', 'gen3'])),\n id: z.optional(z.string()),\n nonNullDocumentFields: z.optional(z.boolean()),\n playground: z.optional(z.boolean()),\n source: z.optional(z.string()),\n tag: z.optional(z.string()),\n workspace: z.optional(z.string()),\n }),\n ),\n ),\n\n mediaLibrary: z.optional(\n z.object({\n aspectsPath: z.optional(z.string()),\n }),\n ),\n\n project: z.optional(\n z.object({\n basePath: z.optional(z.string()),\n }),\n ),\n\n reactCompiler: z.optional(z.custom<boolean | ReactCompilerConfig>()),\n\n reactStrictMode: z.optional(z.boolean()),\n\n schemaExtraction: z.optional(\n z.object({\n enabled: z.optional(z.boolean()),\n enforceRequiredFields: z.optional(z.boolean()),\n path: z.optional(z.string()),\n watchPatterns: z.optional(z.array(z.string())),\n workspace: z.optional(z.string()),\n }),\n ),\n\n server: z.optional(\n z.object({\n hostname: z.optional(z.string()),\n port: z.optional(z.number()),\n }),\n ),\n\n studioHost: z.optional(z.string()),\n\n unstable_bundledDev: z.optional(z.boolean()),\n\n vite: z.optional(z.custom<UserViteConfig>()),\n\n typegen: z.optional(z.custom<Partial<TypeGenConfig> & {enabled?: boolean}>()),\n}) satisfies z.core.$ZodType<CliConfig>\n"],"names":["z","APP_VISIBILITIES","cliConfigSchema","object","api","optional","dataset","string","projectId","app","entry","icon","id","organizationId","title","visibility","enum","autoUpdates","boolean","deployment","appId","studioHost","never","error","graphql","array","filterSuffix","generation","nonNullDocumentFields","playground","source","tag","workspace","mediaLibrary","aspectsPath","project","basePath","reactCompiler","custom","reactStrictMode","schemaExtraction","enabled","enforceRequiredFields","path","watchPatterns","server","hostname","port","number","unstable_bundledDev","vite","typegen"],"mappings":"AAAA,SAAQA,CAAC,QAAO,WAAU;AAE1B,SACEC,gBAAgB,QAIX,uBAAsB;AAG7B;;CAEC,GACD,OAAO,MAAMC,kBAAkBF,EAAEG,MAAM,CAAC;IACtCC,KAAKJ,EAAEK,QAAQ,CACbL,EAAEG,MAAM,CAAC;QACPG,SAASN,EAAEK,QAAQ,CAACL,EAAEO,MAAM;QAC5BC,WAAWR,EA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MiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
27
|
+
studioHost: z.ZodMiniOptional<z.ZodMiniNever>;
|
|
27
28
|
}, z.core.$strip>>;
|
|
28
29
|
graphql: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
29
30
|
filterSuffix: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -103,4 +104,4 @@ type CoreAppManifest = z.infer<typeof coreAppManifestSchema>;
|
|
|
103
104
|
declare const studioManifestSchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
104
105
|
type StudioManifest = z.infer<typeof studioManifestSchema>;
|
|
105
106
|
export { cliConfigSchema as a, studioManifestSchema as i, StudioManifest as n, coreAppManifestSchema as r, CoreAppManifest as t };
|
|
106
|
-
//# sourceMappingURL=schemas-
|
|
107
|
+
//# sourceMappingURL=schemas-DDpPtgia.d.ts.map
|
package/dist/util/dates.js
CHANGED
|
@@ -65,21 +65,23 @@ function pad(value, length = 2) {
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* Formats a timestamp as `YYYY-MM-DD HH:mm:ss` in the local time zone.
|
|
69
|
-
*
|
|
68
|
+
* Formats a timestamp as `YYYY-MM-DD HH:mm:ss` in the local time zone. An unparseable
|
|
69
|
+
* string is returned as-is, so a bad value from the API doesn't fail the command. An
|
|
70
|
+
* invalid `Date` or a non-finite number formats as an empty string.
|
|
70
71
|
*
|
|
71
|
-
* @param timestamp - An ISO 8601 timestamp
|
|
72
|
+
* @param timestamp - An ISO 8601 timestamp, epoch milliseconds, or a `Date`
|
|
72
73
|
* @internal
|
|
73
74
|
*/ export function formatDateTime(timestamp) {
|
|
74
|
-
const date = new Date(timestamp);
|
|
75
|
-
if (!Number.isFinite(date.getTime())) return timestamp;
|
|
75
|
+
const date = timestamp instanceof Date ? timestamp : new Date(timestamp);
|
|
76
|
+
if (!Number.isFinite(date.getTime())) return typeof timestamp === 'string' ? timestamp : '';
|
|
76
77
|
const day = `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
77
78
|
const time = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
78
79
|
return `${day} ${time}`;
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
81
82
|
* Formats a duration in milliseconds as an approximate, human readable length of
|
|
82
|
-
* time, eg `less than a minute`, `5 minutes` or `2 days`.
|
|
83
|
+
* time, eg `less than a minute`, `5 minutes` or `2 days`. Use {@link formatElapsed}
|
|
84
|
+
* where the exact length matters.
|
|
83
85
|
*
|
|
84
86
|
* @param ms - The duration in milliseconds
|
|
85
87
|
* @internal
|
|
@@ -90,6 +92,28 @@ function pad(value, length = 2) {
|
|
|
90
92
|
const unit = selected.value === 1 ? selected.unit : `${selected.unit}s`;
|
|
91
93
|
return `${selected.value} ${unit}`;
|
|
92
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Formats an elapsed time in milliseconds precisely, eg `450ms`, `12s`, `1m 30s` or
|
|
97
|
+
* `2h 5m`. Two adjacent units are shown once the time reaches a minute, so a column
|
|
98
|
+
* of values lines up. Use this for how long an operation took, where a second of
|
|
99
|
+
* difference is meaningful; use {@link formatDuration} for an approximate description.
|
|
100
|
+
*
|
|
101
|
+
* @param ms - The elapsed time in milliseconds
|
|
102
|
+
* @internal
|
|
103
|
+
*/ export function formatElapsed(ms) {
|
|
104
|
+
if (!Number.isFinite(ms)) return '';
|
|
105
|
+
// Round to whole milliseconds first, so 999.6ms reads as `1s` rather than `1000ms`
|
|
106
|
+
const elapsed = Math.round(Math.abs(ms));
|
|
107
|
+
if (elapsed < MS_IN.second) return `${elapsed}ms`;
|
|
108
|
+
const seconds = Math.floor(elapsed / MS_IN.second);
|
|
109
|
+
if (elapsed < MS_IN.minute) return `${seconds}s`;
|
|
110
|
+
const minutes = Math.floor(elapsed / MS_IN.minute);
|
|
111
|
+
if (elapsed < MS_IN.hour) return `${minutes}m ${seconds % 60}s`;
|
|
112
|
+
const hours = Math.floor(elapsed / MS_IN.hour);
|
|
113
|
+
if (elapsed < MS_IN.day) return `${hours}h ${minutes % 60}m`;
|
|
114
|
+
const days = Math.floor(elapsed / MS_IN.day);
|
|
115
|
+
return `${days}d ${hours % 24}h`;
|
|
116
|
+
}
|
|
93
117
|
/**
|
|
94
118
|
* Formats a date relative to now, eg `2 days ago` or `in 3 hours`.
|
|
95
119
|
*
|
package/dist/util/dates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/dates.ts"],"sourcesContent":["const MS_IN = {\n day: 86_400_000,\n hour: 3_600_000,\n minute: 60_000,\n month: 2_592_000_000, // 30 days\n second: 1000,\n week: 604_800_000,\n year: 31_536_000_000, // 365 days\n} as const\n\n/** Largest unit first, so the first unit the duration fills is the one we report. */\nconst UNITS: {ms: number; unit: Intl.RelativeTimeFormatUnit}[] = [\n {ms: MS_IN.year, unit: 'year'},\n {ms: MS_IN.month, unit: 'month'},\n {ms: MS_IN.week, unit: 'week'},\n {ms: MS_IN.day, unit: 'day'},\n {ms: MS_IN.hour, unit: 'hour'},\n {ms: MS_IN.minute, unit: 'minute'},\n {ms: MS_IN.second, unit: 'second'},\n]\n\nconst relativeTime = new Intl.RelativeTimeFormat('en', {numeric: 'always'})\n\nconst DATE_ONLY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\nfunction pad(value: number, length = 2): string {\n return String(value).padStart(length, '0')\n}\n\n/**\n * Returns the coarsest unit the elapsed time fills and the rounded number of those\n * units, or `undefined` below a second.\n *\n * Rounding can land the value on the boundary of the next unit up, so we promote\n * rather than report `60 minutes` where `1 hour` is meant. Units aren't all whole\n * multiples of each other, so the boundary is the rounded count we'd display, which\n * is why 25+ days reads as `1 month` rather than `4 weeks`.\n */\nfunction selectUnit(\n elapsed: number,\n): {unit: Intl.RelativeTimeFormatUnit; value: number} | undefined {\n let index = UNITS.findIndex(({ms}) => elapsed >= ms)\n if (index === -1) return undefined\n\n while (\n index > 0 &&\n Math.round(elapsed / UNITS[index].ms) >= Math.round(UNITS[index - 1].ms / UNITS[index].ms)\n ) {\n index -= 1\n }\n\n const {ms, unit} = UNITS[index]\n return {unit, value: Math.round(elapsed / ms)}\n}\n\n/**\n * Formats a timestamp as `YYYY-MM-DD HH:mm:ss` in the local time zone.
|
|
1
|
+
{"version":3,"sources":["../../src/util/dates.ts"],"sourcesContent":["const MS_IN = {\n day: 86_400_000,\n hour: 3_600_000,\n minute: 60_000,\n month: 2_592_000_000, // 30 days\n second: 1000,\n week: 604_800_000,\n year: 31_536_000_000, // 365 days\n} as const\n\n/** Largest unit first, so the first unit the duration fills is the one we report. */\nconst UNITS: {ms: number; unit: Intl.RelativeTimeFormatUnit}[] = [\n {ms: MS_IN.year, unit: 'year'},\n {ms: MS_IN.month, unit: 'month'},\n {ms: MS_IN.week, unit: 'week'},\n {ms: MS_IN.day, unit: 'day'},\n {ms: MS_IN.hour, unit: 'hour'},\n {ms: MS_IN.minute, unit: 'minute'},\n {ms: MS_IN.second, unit: 'second'},\n]\n\nconst relativeTime = new Intl.RelativeTimeFormat('en', {numeric: 'always'})\n\nconst DATE_ONLY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\nfunction pad(value: number, length = 2): string {\n return String(value).padStart(length, '0')\n}\n\n/**\n * Returns the coarsest unit the elapsed time fills and the rounded number of those\n * units, or `undefined` below a second.\n *\n * Rounding can land the value on the boundary of the next unit up, so we promote\n * rather than report `60 minutes` where `1 hour` is meant. Units aren't all whole\n * multiples of each other, so the boundary is the rounded count we'd display, which\n * is why 25+ days reads as `1 month` rather than `4 weeks`.\n */\nfunction selectUnit(\n elapsed: number,\n): {unit: Intl.RelativeTimeFormatUnit; value: number} | undefined {\n let index = UNITS.findIndex(({ms}) => elapsed >= ms)\n if (index === -1) return undefined\n\n while (\n index > 0 &&\n Math.round(elapsed / UNITS[index].ms) >= Math.round(UNITS[index - 1].ms / UNITS[index].ms)\n ) {\n index -= 1\n }\n\n const {ms, unit} = UNITS[index]\n return {unit, value: Math.round(elapsed / ms)}\n}\n\n/**\n * Formats a timestamp as `YYYY-MM-DD HH:mm:ss` in the local time zone. An unparseable\n * string is returned as-is, so a bad value from the API doesn't fail the command. An\n * invalid `Date` or a non-finite number formats as an empty string.\n *\n * @param timestamp - An ISO 8601 timestamp, epoch milliseconds, or a `Date`\n * @internal\n */\nexport function formatDateTime(timestamp: Date | number | string): string {\n const date = timestamp instanceof Date ? timestamp : new Date(timestamp)\n if (!Number.isFinite(date.getTime())) return typeof timestamp === 'string' ? timestamp : ''\n\n const day = `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\n const time = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`\n return `${day} ${time}`\n}\n\n/**\n * Formats a duration in milliseconds as an approximate, human readable length of\n * time, eg `less than a minute`, `5 minutes` or `2 days`. Use {@link formatElapsed}\n * where the exact length matters.\n *\n * @param ms - The duration in milliseconds\n * @internal\n */\nexport function formatDuration(ms: number): string {\n if (!Number.isFinite(ms)) return ''\n\n const selected = selectUnit(Math.abs(ms))\n if (!selected || selected.unit === 'second') return 'less than a minute'\n\n const unit = selected.value === 1 ? selected.unit : `${selected.unit}s`\n return `${selected.value} ${unit}`\n}\n\n/**\n * Formats an elapsed time in milliseconds precisely, eg `450ms`, `12s`, `1m 30s` or\n * `2h 5m`. Two adjacent units are shown once the time reaches a minute, so a column\n * of values lines up. Use this for how long an operation took, where a second of\n * difference is meaningful; use {@link formatDuration} for an approximate description.\n *\n * @param ms - The elapsed time in milliseconds\n * @internal\n */\nexport function formatElapsed(ms: number): string {\n if (!Number.isFinite(ms)) return ''\n\n // Round to whole milliseconds first, so 999.6ms reads as `1s` rather than `1000ms`\n const elapsed = Math.round(Math.abs(ms))\n if (elapsed < MS_IN.second) return `${elapsed}ms`\n\n const seconds = Math.floor(elapsed / MS_IN.second)\n if (elapsed < MS_IN.minute) return `${seconds}s`\n\n const minutes = Math.floor(elapsed / MS_IN.minute)\n if (elapsed < MS_IN.hour) return `${minutes}m ${seconds % 60}s`\n\n const hours = Math.floor(elapsed / MS_IN.hour)\n if (elapsed < MS_IN.day) return `${hours}h ${minutes % 60}m`\n\n const days = Math.floor(elapsed / MS_IN.day)\n return `${days}d ${hours % 24}h`\n}\n\n/**\n * Formats a date relative to now, eg `2 days ago` or `in 3 hours`.\n *\n * @param date - The date to describe\n * @param now - The reference point to compare against, defaults to the current time\n * @internal\n */\nexport function formatTimeAgo(date: Date, now: number = Date.now()): string {\n const delta = date.getTime() - now\n if (!Number.isFinite(delta)) return ''\n\n const selected = selectUnit(Math.abs(delta))\n if (!selected) return 'just now'\n\n return relativeTime.format(delta < 0 ? -selected.value : selected.value, selected.unit)\n}\n\n/**\n * Parses a `YYYY-MM-DD` date into a `Date` at local midnight. Returns `undefined`\n * for anything that isn't a real calendar date in that exact format.\n *\n * @param value - The date string to parse\n * @internal\n */\nexport function parseDateOnly(value: string): Date | undefined {\n const match = DATE_ONLY_PATTERN.exec(value)\n if (!match) return undefined\n\n const year = Number(match[1])\n const month = Number(match[2])\n const day = Number(match[3])\n const date = new Date(year, month - 1, day)\n\n // `new Date(2024, 1, 31)` silently rolls over into March, so reject anything\n // that didn't survive the round trip\n const isRoundTrip =\n date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day\n\n return isRoundTrip ? date : undefined\n}\n"],"names":["MS_IN","day","hour","minute","month","second","week","year","UNITS","ms","unit","relativeTime","Intl","RelativeTimeFormat","numeric","DATE_ONLY_PATTERN","pad","value","length","String","padStart","selectUnit","elapsed","index","findIndex","undefined","Math","round","formatDateTime","timestamp","date","Date","Number","isFinite","getTime","getFullYear","getMonth","getDate","time","getHours","getMinutes","getSeconds","formatDuration","selected","abs","formatElapsed","seconds","floor","minutes","hours","days","formatTimeAgo","now","delta","format","parseDateOnly","match","exec","isRoundTrip"],"mappings":"AAAA,MAAMA,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M1B,OAAO,IAAIC,KAAKxB,MAAMH,QAAQ,GAAGH;IAEvC,6EAA6E;IAC7E,qCAAqC;IACrC,MAAMyD,cACJ5B,KAAKK,WAAW,OAAO5B,QAAQuB,KAAKM,QAAQ,OAAOhC,QAAQ,KAAK0B,KAAKO,OAAO,OAAOpC;IAErF,OAAOyD,cAAc5B,OAAOL;AAC9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Sanity CLI core package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
"source": "./src/_exports/browser.ts",
|
|
42
42
|
"default": "./dist/_exports/browser.js"
|
|
43
43
|
},
|
|
44
|
+
"./commandPolicy": {
|
|
45
|
+
"source": "./src/_exports/commandPolicy.ts",
|
|
46
|
+
"default": "./dist/_exports/commandPolicy.js"
|
|
47
|
+
},
|
|
44
48
|
"./config": {
|
|
45
49
|
"source": "./src/_exports/config.ts",
|
|
46
50
|
"default": "./dist/_exports/config.js"
|
|
@@ -117,20 +121,20 @@
|
|
|
117
121
|
"dependencies": {
|
|
118
122
|
"@inquirer/prompts": "^8.5.2",
|
|
119
123
|
"@oclif/core": "^4.11.14",
|
|
120
|
-
"@sanity/client": "^8.
|
|
124
|
+
"@sanity/client": "^8.6.2",
|
|
121
125
|
"boxen": "^8.0.1",
|
|
122
126
|
"empathic": "^2.0.1",
|
|
123
|
-
"get-it": "^9.5.
|
|
127
|
+
"get-it": "^9.5.4",
|
|
124
128
|
"get-tsconfig": "^4.14.3",
|
|
125
129
|
"import-meta-resolve": "^4.2.0",
|
|
126
130
|
"jiti": "^2.7.0",
|
|
127
131
|
"jsdom": "^29.1.1",
|
|
128
132
|
"json-lexer": "^1.2.0",
|
|
129
133
|
"log-symbols": "^7.0.1",
|
|
130
|
-
"obug": "^
|
|
134
|
+
"obug": "^3.0.0",
|
|
131
135
|
"ora": "^9.0.0",
|
|
132
136
|
"rxjs": "^7.8.2",
|
|
133
|
-
"vite": "^8.
|
|
137
|
+
"vite": "^8.3.0",
|
|
134
138
|
"wrap-ansi": "^9.0.2",
|
|
135
139
|
"zod": "^4.5.2"
|
|
136
140
|
},
|
|
@@ -149,7 +153,7 @@
|
|
|
149
153
|
"eslint": "^10.7.0",
|
|
150
154
|
"oxc-transform-react": "^0.147.0",
|
|
151
155
|
"publint": "^0.3.21",
|
|
152
|
-
"sanity": "^6.
|
|
156
|
+
"sanity": "^6.15.0",
|
|
153
157
|
"typescript": "^6.0.3",
|
|
154
158
|
"vitest": "^4.1.11"
|
|
155
159
|
},
|