@sanity/cli 8.12.0 → 8.13.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 +10 -3
- package/dist/commands/undeploy.js +41 -5
- package/dist/commands/undeploy.js.map +1 -1
- package/dist/generated/apiRoutes.js +12 -0
- package/dist/generated/apiRoutes.js.map +1 -1
- package/dist/util/update/resolveRunnerPackage.js +1 -1
- package/dist/util/update/resolveRunnerPackage.js.map +1 -1
- package/dist/util/update/resolveUpdateTarget.js +1 -1
- package/dist/util/update/resolveUpdateTarget.js.map +1 -1
- package/dist/util/update/updateChecker.js +7 -2
- package/dist/util/update/updateChecker.js.map +1 -1
- package/dist/util/update/updateCheckerDebug.js +1 -1
- package/dist/util/update/updateCheckerDebug.js.map +1 -1
- package/oclif.manifest.json +1242 -1233
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -135,7 +135,7 @@ Code for sanity cli
|
|
|
135
135
|
- [`sanity tokens list`](#sanity-tokens-list)
|
|
136
136
|
- [`sanity tokens rotate`](#sanity-tokens-rotate)
|
|
137
137
|
- [`sanity typegen generate`](#sanity-typegen-generate)
|
|
138
|
-
- [`sanity undeploy`](#sanity-undeploy)
|
|
138
|
+
- [`sanity undeploy [APPID]`](#sanity-undeploy-appid)
|
|
139
139
|
- [`sanity users invite [EMAIL]`](#sanity-users-invite-email)
|
|
140
140
|
- [`sanity users list`](#sanity-users-list)
|
|
141
141
|
- [`sanity versions`](#sanity-versions)
|
|
@@ -4276,13 +4276,16 @@ EXAMPLES
|
|
|
4276
4276
|
$ sanity typegen generate
|
|
4277
4277
|
```
|
|
4278
4278
|
|
|
4279
|
-
## `sanity undeploy`
|
|
4279
|
+
## `sanity undeploy [APPID]`
|
|
4280
4280
|
|
|
4281
4281
|
Removes the deployed Sanity Studio/App from Sanity hosting
|
|
4282
4282
|
|
|
4283
4283
|
```
|
|
4284
4284
|
USAGE
|
|
4285
|
-
$ sanity undeploy [--dry-run] [-j] [-y]
|
|
4285
|
+
$ sanity undeploy [APPID] [--dry-run] [-j] [-y]
|
|
4286
|
+
|
|
4287
|
+
ARGUMENTS
|
|
4288
|
+
[APPID] ID of the application to undeploy. Overrides `deployment.appId` in sanity.cli.ts
|
|
4286
4289
|
|
|
4287
4290
|
FLAGS
|
|
4288
4291
|
-j, --json Output the result as JSON
|
|
@@ -4297,6 +4300,10 @@ EXAMPLES
|
|
|
4297
4300
|
|
|
4298
4301
|
$ sanity undeploy
|
|
4299
4302
|
|
|
4303
|
+
Undeploy the studio or application with the given ID
|
|
4304
|
+
|
|
4305
|
+
$ sanity undeploy abc123
|
|
4306
|
+
|
|
4300
4307
|
Report what would be undeployed without deleting anything
|
|
4301
4308
|
|
|
4302
4309
|
$ sanity undeploy --dry-run
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Flags } from '@oclif/core';
|
|
2
|
-
import { SanityCommand } from '@sanity/cli-core';
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { exitCodes, SanityCommand } from '@sanity/cli-core';
|
|
3
3
|
import { getWorkbench, resolveWorkbenchConfig } from '@sanity/workbench-cli/deploy';
|
|
4
4
|
import { createWorkbenchUndeployAdapter } from '@sanity/workbench-cli/undeploy';
|
|
5
5
|
import { createAppUndeployAdapter, createStudioUndeployAdapter } from '../actions/undeploy/adapters.js';
|
|
@@ -7,12 +7,21 @@ import { runUndeploy } from '../actions/undeploy/runUndeploy.js';
|
|
|
7
7
|
import { getAppId } from '../util/appId.js';
|
|
8
8
|
import { determineIsApp } from '../util/determineIsApp.js';
|
|
9
9
|
export class UndeployCommand extends SanityCommand {
|
|
10
|
+
static args = {
|
|
11
|
+
appId: Args.string({
|
|
12
|
+
description: 'ID of the application to undeploy. Overrides `deployment.appId` in sanity.cli.ts'
|
|
13
|
+
})
|
|
14
|
+
};
|
|
10
15
|
static description = 'Removes the deployed Sanity Studio/App from Sanity hosting';
|
|
11
16
|
static examples = [
|
|
12
17
|
{
|
|
13
18
|
command: '<%= config.bin %> <%= command.id %>',
|
|
14
19
|
description: 'Undeploy the studio or application after confirming'
|
|
15
20
|
},
|
|
21
|
+
{
|
|
22
|
+
command: '<%= config.bin %> <%= command.id %> abc123',
|
|
23
|
+
description: 'Undeploy the studio or application with the given ID'
|
|
24
|
+
},
|
|
16
25
|
{
|
|
17
26
|
command: '<%= config.bin %> <%= command.id %> --dry-run',
|
|
18
27
|
description: 'Report what would be undeployed without deleting anything'
|
|
@@ -39,13 +48,28 @@ export class UndeployCommand extends SanityCommand {
|
|
|
39
48
|
})
|
|
40
49
|
};
|
|
41
50
|
async run() {
|
|
42
|
-
const { flags } = await this.parse(UndeployCommand);
|
|
43
|
-
const
|
|
44
|
-
const isApp = determineIsApp(
|
|
51
|
+
const { args, flags } = await this.parse(UndeployCommand);
|
|
52
|
+
const projectConfig = await this.getCliConfig();
|
|
53
|
+
const isApp = determineIsApp(projectConfig);
|
|
54
|
+
if (args.appId) this.warnIfOverridingConfig(args.appId, projectConfig, isApp);
|
|
55
|
+
// An explicit ID stands in for `deployment.appId`, which every adapter
|
|
56
|
+
// already prefers over `studioHost` and the deprecated `app.id`.
|
|
57
|
+
const cliConfig = args.appId ? {
|
|
58
|
+
...projectConfig,
|
|
59
|
+
deployment: {
|
|
60
|
+
...projectConfig.deployment,
|
|
61
|
+
appId: args.appId
|
|
62
|
+
}
|
|
63
|
+
} : projectConfig;
|
|
45
64
|
// Workbench apps and configs deploy through Brett, so they undeploy through
|
|
46
65
|
// it too; plain projects keep the user-applications backend.
|
|
47
66
|
const workbench = getWorkbench(cliConfig);
|
|
48
67
|
const config = resolveWorkbenchConfig(cliConfig);
|
|
68
|
+
if (args.appId && config) {
|
|
69
|
+
this.error('An app ID cannot be used to undeploy a config. Run without the argument.', {
|
|
70
|
+
exit: exitCodes.USAGE_ERROR
|
|
71
|
+
});
|
|
72
|
+
}
|
|
49
73
|
const adapter = workbench || config ? createWorkbenchUndeployAdapter({
|
|
50
74
|
appId: getAppId(cliConfig),
|
|
51
75
|
config: config ?? undefined,
|
|
@@ -59,6 +83,18 @@ export class UndeployCommand extends SanityCommand {
|
|
|
59
83
|
output: this.output
|
|
60
84
|
}, adapter);
|
|
61
85
|
}
|
|
86
|
+
warnIfOverridingConfig(appId, cliConfig, isApp) {
|
|
87
|
+
const configuredAppId = getAppId(cliConfig);
|
|
88
|
+
if (configuredAppId) {
|
|
89
|
+
if (configuredAppId !== appId) {
|
|
90
|
+
this.output.warn(`Using app ID "${appId}" instead of "${configuredAppId}" configured in sanity.cli.ts`);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!isApp && cliConfig.studioHost) {
|
|
95
|
+
this.output.warn(`Using app ID "${appId}" instead of studio host "${cliConfig.studioHost}" configured in sanity.cli.ts`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
62
98
|
}
|
|
63
99
|
|
|
64
100
|
//# sourceMappingURL=undeploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/undeploy.ts"],"sourcesContent":["import {Flags} from '@oclif/core'\nimport {SanityCommand} from '@sanity/cli-core'\nimport {type UndeployAdapter} from '@sanity/cli-core/undeploy'\nimport {getWorkbench, resolveWorkbenchConfig} from '@sanity/workbench-cli/deploy'\nimport {createWorkbenchUndeployAdapter} from '@sanity/workbench-cli/undeploy'\n\nimport {\n createAppUndeployAdapter,\n createStudioUndeployAdapter,\n} from '../actions/undeploy/adapters.js'\nimport {runUndeploy} from '../actions/undeploy/runUndeploy.js'\nimport {getAppId} from '../util/appId.js'\nimport {determineIsApp} from '../util/determineIsApp.js'\n\nexport class UndeployCommand extends SanityCommand<typeof UndeployCommand> {\n static override description = 'Removes the deployed Sanity Studio/App from Sanity hosting'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Undeploy the studio or application after confirming',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --dry-run',\n description: 'Report what would be undeployed without deleting anything',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --json --yes',\n description: 'Undeploy without prompting and report the result as JSON',\n },\n ]\n\n static override flags = {\n 'dry-run': Flags.boolean({\n default: false,\n description: 'Report what would be undeployed without deleting anything',\n }),\n json: Flags.boolean({\n char: 'j',\n default: false,\n description: 'Output the result as JSON',\n }),\n yes: Flags.boolean({\n char: 'y',\n default: false,\n description:\n 'Unattended mode, answers \"yes\" to any \"yes/no\" prompt and otherwise uses defaults',\n }),\n }\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(UndeployCommand)\n\n const
|
|
1
|
+
{"version":3,"sources":["../../src/commands/undeploy.ts"],"sourcesContent":["import {Args, Flags} from '@oclif/core'\nimport {type CliConfig, exitCodes, SanityCommand} from '@sanity/cli-core'\nimport {type UndeployAdapter} from '@sanity/cli-core/undeploy'\nimport {getWorkbench, resolveWorkbenchConfig} from '@sanity/workbench-cli/deploy'\nimport {createWorkbenchUndeployAdapter} from '@sanity/workbench-cli/undeploy'\n\nimport {\n createAppUndeployAdapter,\n createStudioUndeployAdapter,\n} from '../actions/undeploy/adapters.js'\nimport {runUndeploy} from '../actions/undeploy/runUndeploy.js'\nimport {getAppId} from '../util/appId.js'\nimport {determineIsApp} from '../util/determineIsApp.js'\n\nexport class UndeployCommand extends SanityCommand<typeof UndeployCommand> {\n static override args = {\n appId: Args.string({\n description:\n 'ID of the application to undeploy. Overrides `deployment.appId` in sanity.cli.ts',\n }),\n }\n\n static override description = 'Removes the deployed Sanity Studio/App from Sanity hosting'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Undeploy the studio or application after confirming',\n },\n {\n command: '<%= config.bin %> <%= command.id %> abc123',\n description: 'Undeploy the studio or application with the given ID',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --dry-run',\n description: 'Report what would be undeployed without deleting anything',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --json --yes',\n description: 'Undeploy without prompting and report the result as JSON',\n },\n ]\n\n static override flags = {\n 'dry-run': Flags.boolean({\n default: false,\n description: 'Report what would be undeployed without deleting anything',\n }),\n json: Flags.boolean({\n char: 'j',\n default: false,\n description: 'Output the result as JSON',\n }),\n yes: Flags.boolean({\n char: 'y',\n default: false,\n description:\n 'Unattended mode, answers \"yes\" to any \"yes/no\" prompt and otherwise uses defaults',\n }),\n }\n\n public async run(): Promise<void> {\n const {args, flags} = await this.parse(UndeployCommand)\n\n const projectConfig = await this.getCliConfig()\n const isApp = determineIsApp(projectConfig)\n if (args.appId) this.warnIfOverridingConfig(args.appId, projectConfig, isApp)\n // An explicit ID stands in for `deployment.appId`, which every adapter\n // already prefers over `studioHost` and the deprecated `app.id`.\n const cliConfig = args.appId\n ? {...projectConfig, deployment: {...projectConfig.deployment, appId: args.appId}}\n : projectConfig\n\n // Workbench apps and configs deploy through Brett, so they undeploy through\n // it too; plain projects keep the user-applications backend.\n const workbench = getWorkbench(cliConfig)\n const config = resolveWorkbenchConfig(cliConfig)\n if (args.appId && config) {\n this.error('An app ID cannot be used to undeploy a config. Run without the argument.', {\n exit: exitCodes.USAGE_ERROR,\n })\n }\n\n const adapter: UndeployAdapter =\n workbench || config\n ? createWorkbenchUndeployAdapter({\n appId: getAppId(cliConfig),\n config: config ?? undefined,\n organizationId: cliConfig.app?.organizationId,\n type: isApp ? 'coreApp' : 'studio',\n workbench: workbench ?? undefined,\n })\n : isApp\n ? createAppUndeployAdapter(cliConfig)\n : createStudioUndeployAdapter(cliConfig)\n\n await runUndeploy({flags, isUnattended: this.isUnattended(), output: this.output}, adapter)\n }\n\n private warnIfOverridingConfig(appId: string, cliConfig: CliConfig, isApp: boolean): void {\n const configuredAppId = getAppId(cliConfig)\n if (configuredAppId) {\n if (configuredAppId !== appId) {\n this.output.warn(\n `Using app ID \"${appId}\" instead of \"${configuredAppId}\" configured in sanity.cli.ts`,\n )\n }\n return\n }\n\n if (!isApp && cliConfig.studioHost) {\n this.output.warn(\n `Using app ID \"${appId}\" instead of studio host \"${cliConfig.studioHost}\" configured in sanity.cli.ts`,\n )\n }\n }\n}\n"],"names":["Args","Flags","exitCodes","SanityCommand","getWorkbench","resolveWorkbenchConfig","createWorkbenchUndeployAdapter","createAppUndeployAdapter","createStudioUndeployAdapter","runUndeploy","getAppId","determineIsApp","UndeployCommand","args","appId","string","description","examples","command","flags","boolean","default","json","char","yes","run","parse","projectConfig","getCliConfig","isApp","warnIfOverridingConfig","cliConfig","deployment","workbench","config","error","exit","USAGE_ERROR","adapter","undefined","organizationId","app","type","isUnattended","output","configuredAppId","warn","studioHost"],"mappings":"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"}
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
'deploy',
|
|
87
87
|
'deploy/quickstart',
|
|
88
88
|
'installations',
|
|
89
|
+
'installations/ai-features',
|
|
89
90
|
'installations/catalog',
|
|
90
91
|
'installations/defaults',
|
|
91
92
|
'installations/{installationId}',
|
|
@@ -125,6 +126,7 @@
|
|
|
125
126
|
'deploy',
|
|
126
127
|
'deploy/quickstart',
|
|
127
128
|
'installations',
|
|
129
|
+
'installations/ai-features',
|
|
128
130
|
'installations/catalog',
|
|
129
131
|
'installations/defaults',
|
|
130
132
|
'installations/{installationId}',
|
|
@@ -175,6 +177,16 @@
|
|
|
175
177
|
slug: 'backups',
|
|
176
178
|
title: 'Backups API reference'
|
|
177
179
|
},
|
|
180
|
+
{
|
|
181
|
+
defaultApiVersion: 'v1',
|
|
182
|
+
host: 'global',
|
|
183
|
+
pathPatterns: [
|
|
184
|
+
'projects/{project_id}/datasets/{dataset_name}/assets/{asset_id}/purges',
|
|
185
|
+
'projects/{project_id}/datasets/{dataset_name}/purges'
|
|
186
|
+
],
|
|
187
|
+
slug: 'cdn-cache-purge',
|
|
188
|
+
title: 'CDN Cache Purge API Reference'
|
|
189
|
+
},
|
|
178
190
|
{
|
|
179
191
|
defaultApiVersion: 'vX',
|
|
180
192
|
host: 'global',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generated/apiRoutes.ts"],"sourcesContent":["/**\n * GENERATED FILE - DO NOT EDIT\n *\n * Routing manifest for `sanity api`, distilled from the published OpenAPI\n * specifications at https://www.sanity.io/docs/api/openapi\n *\n * Regenerate with: pnpm generate:api-routes\n */\nimport {type ApiRouteEntry} from '../actions/api/types.js'\n\nexport const apiRoutes: ApiRouteEntry[] = [\n {\n defaultApiVersion: 'v2025-07-11',\n host: 'global',\n pathPatterns: [\n 'access/invites/me',\n 'access/organization/{resourceId}/users/roles/default',\n 'access/requests/me',\n 'access/robots/me',\n 'access/robots/me/rotate',\n 'access/{resourceType}/{resourceId}/invites',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/accept',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/eligibility',\n 'access/{resourceType}/{resourceId}/invites/{inviteId}',\n 'access/{resourceType}/{resourceId}/permissions',\n 'access/{resourceType}/{resourceId}/permissions/{permissionName}',\n 'access/{resourceType}/{resourceId}/requests',\n 'access/{resourceType}/{resourceId}/requests/state',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/accept',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/decline',\n 'access/{resourceType}/{resourceId}/robots',\n 'access/{resourceType}/{resourceId}/robots/{robotId}',\n 'access/{resourceType}/{resourceId}/roles',\n 'access/{resourceType}/{resourceId}/roles/{roleName}',\n 'access/{resourceType}/{resourceId}/user-permissions/me',\n 'access/{resourceType}/{resourceId}/user-permissions/me/check',\n 'access/{resourceType}/{resourceId}/users',\n 'access/{resourceType}/{resourceId}/users/me',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles/{roleName}'\n ],\n slug: 'access-api',\n title: 'Access API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/actions/{dataset}'\n ],\n slug: 'actions',\n title: 'Actions API reference'\n },\n {\n defaultApiVersion: 'v2021-02-01',\n host: 'global',\n pathPatterns: [\n 'activity',\n 'activity/export/csv'\n ],\n slug: 'activity-log',\n title: 'Activity Log API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'agent/action/generate/{dataset}',\n 'agent/action/patch/{dataset}',\n 'agent/action/prompt/{dataset}',\n 'agent/action/transform/{dataset}',\n 'agent/action/translate/{dataset}'\n ],\n slug: 'agent-actions',\n title: 'Agent Actions'\n },\n {\n host: 'global',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n host: 'project',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n defaultApiVersion: 'v2024-06-24',\n host: 'project',\n pathPatterns: [\n 'assets/files/{dataset}',\n 'assets/files/{dataset}/from-url',\n 'assets/images/{dataset}',\n 'assets/images/{dataset}/from-url',\n 'assets/media-library-link/{dataset}'\n ],\n slug: 'assets',\n title: 'Assets API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{datasetName}/backups',\n 'projects/{projectId}/datasets/{datasetName}/backups/{backupId}',\n 'projects/{projectId}/datasets/{datasetName}/settings/backups'\n ],\n slug: 'backups',\n title: 'Backups API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'global',\n pathPatterns: [\n 'agent/prompt',\n 'agent/{organizationId}/threads/{threadId}'\n ],\n slug: 'content-agent',\n title: 'Content Agent API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{dataset}/copy'\n ],\n slug: 'copy',\n title: 'Copy API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/doc/{dataset}/{documentId}'\n ],\n slug: 'doc',\n title: 'Doc API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'embeddings-index/query/{dataset}/{indexName}',\n 'embeddings-index/{dataset}',\n 'embeddings-index/{dataset}/{indexName}'\n ],\n slug: 'embeddings-index',\n title: 'Embeddings Index API reference (deprecated)'\n },\n {\n defaultApiVersion: 'v2021-03-25',\n host: 'project',\n pathPatterns: [\n 'data/export/{dataset}'\n ],\n slug: 'export',\n title: 'Export API reference'\n },\n {\n host: 'global',\n pathPatterns: [\n 'functions',\n 'functions/{functionId}',\n 'functions/{functionId}/envvars',\n 'functions/{functionId}/envvars/{envVarKey}',\n 'functions/{functionId}/invoke',\n 'functions/{functionId}/logs',\n 'functions/{functionId}/logs/stream'\n ],\n slug: 'functions-api',\n title: 'Functions API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/history/{dataset}/documents/{documentId}',\n 'data/history/{dataset}/transactions',\n 'data/history/{dataset}/transactions/{documentIds}'\n ],\n slug: 'history',\n title: 'History API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'jobs/{jobId}',\n 'jobs/{jobId}/listen'\n ],\n slug: 'jobs',\n title: 'Jobs API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/listen/{dataset}'\n ],\n slug: 'listen',\n title: 'Listen API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/live/events/{dataset}'\n ],\n slug: 'live',\n title: 'Live Content API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/mutate/{dataset}'\n ],\n slug: 'mutation',\n title: 'Mutation API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'projects',\n 'projects/{projectId}',\n 'projects/{projectId}/cors',\n 'projects/{projectId}/cors/{id}',\n 'projects/{projectId}/datasets',\n 'projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}',\n 'projects/{projectId}/datasets/{name}',\n 'projects/{projectId}/datasets/{name}/copy',\n 'projects/{projectId}/datasets/{name}/settings/embeddings',\n 'projects/{projectId}/datasets/{name}/tags',\n 'projects/{projectId}/features',\n 'projects/{projectId}/permissions',\n 'projects/{projectId}/tags',\n 'projects/{projectId}/tags/{tagIdentifier}',\n 'projects/{projectId}/tokens',\n 'projects/{projectId}/tokens/{tokenId}',\n 'projects/{projectId}/users/{userId}'\n ],\n slug: 'projects-api',\n title: 'Projects API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/query/{dataset}'\n ],\n slug: 'query',\n title: 'Query API reference'\n },\n {\n defaultApiVersion: 'v2021-10-04',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{userId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/roles',\n 'projects/{projectId}/roles/{roleName}'\n ],\n slug: 'roles',\n title: 'Roles API reference'\n },\n {\n defaultApiVersion: 'v2022-04-01',\n host: 'project',\n pathPatterns: [\n 'publish/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}/{scheduleId}',\n 'schedules/{projectId}/{dataset}/{scheduleId}/publish',\n 'unpublish/{projectId}/{dataset}'\n ],\n slug: 'scheduling',\n title: 'Scheduling API reference'\n },\n {\n defaultApiVersion: 'v2026-04-27',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/attribute-definitions',\n 'organizations/{organizationId}/attribute-definitions/{key}',\n 'organizations/{organizationId}/users/me/attributes',\n 'organizations/{organizationId}/users/{sanityUserId}/attributes'\n ],\n slug: 'user-attributes',\n title: 'User attributes API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'hooks/projects/{projectId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/{id}/messages'\n ],\n slug: 'webhooks',\n title: 'Webhooks API reference'\n }\n]\n"],"names":["apiRoutes","defaultApiVersion","host","pathPatterns","slug","title"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,YAA6B;IACxC;QACEC,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;CACD,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../src/generated/apiRoutes.ts"],"sourcesContent":["/**\n * GENERATED FILE - DO NOT EDIT\n *\n * Routing manifest for `sanity api`, distilled from the published OpenAPI\n * specifications at https://www.sanity.io/docs/api/openapi\n *\n * Regenerate with: pnpm generate:api-routes\n */\nimport {type ApiRouteEntry} from '../actions/api/types.js'\n\nexport const apiRoutes: ApiRouteEntry[] = [\n {\n defaultApiVersion: 'v2025-07-11',\n host: 'global',\n pathPatterns: [\n 'access/invites/me',\n 'access/organization/{resourceId}/users/roles/default',\n 'access/requests/me',\n 'access/robots/me',\n 'access/robots/me/rotate',\n 'access/{resourceType}/{resourceId}/invites',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/accept',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/eligibility',\n 'access/{resourceType}/{resourceId}/invites/{inviteId}',\n 'access/{resourceType}/{resourceId}/permissions',\n 'access/{resourceType}/{resourceId}/permissions/{permissionName}',\n 'access/{resourceType}/{resourceId}/requests',\n 'access/{resourceType}/{resourceId}/requests/state',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/accept',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/decline',\n 'access/{resourceType}/{resourceId}/robots',\n 'access/{resourceType}/{resourceId}/robots/{robotId}',\n 'access/{resourceType}/{resourceId}/roles',\n 'access/{resourceType}/{resourceId}/roles/{roleName}',\n 'access/{resourceType}/{resourceId}/user-permissions/me',\n 'access/{resourceType}/{resourceId}/user-permissions/me/check',\n 'access/{resourceType}/{resourceId}/users',\n 'access/{resourceType}/{resourceId}/users/me',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles/{roleName}'\n ],\n slug: 'access-api',\n title: 'Access API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/actions/{dataset}'\n ],\n slug: 'actions',\n title: 'Actions API reference'\n },\n {\n defaultApiVersion: 'v2021-02-01',\n host: 'global',\n pathPatterns: [\n 'activity',\n 'activity/export/csv'\n ],\n slug: 'activity-log',\n title: 'Activity Log API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'agent/action/generate/{dataset}',\n 'agent/action/patch/{dataset}',\n 'agent/action/prompt/{dataset}',\n 'agent/action/transform/{dataset}',\n 'agent/action/translate/{dataset}'\n ],\n slug: 'agent-actions',\n title: 'Agent Actions'\n },\n {\n host: 'global',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/ai-features',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n host: 'project',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/ai-features',\n 'installations/catalog',\n 'installations/defaults',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n defaultApiVersion: 'v2024-06-24',\n host: 'project',\n pathPatterns: [\n 'assets/files/{dataset}',\n 'assets/files/{dataset}/from-url',\n 'assets/images/{dataset}',\n 'assets/images/{dataset}/from-url',\n 'assets/media-library-link/{dataset}'\n ],\n slug: 'assets',\n title: 'Assets API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{datasetName}/backups',\n 'projects/{projectId}/datasets/{datasetName}/backups/{backupId}',\n 'projects/{projectId}/datasets/{datasetName}/settings/backups'\n ],\n slug: 'backups',\n title: 'Backups API reference'\n },\n {\n defaultApiVersion: 'v1',\n host: 'global',\n pathPatterns: [\n 'projects/{project_id}/datasets/{dataset_name}/assets/{asset_id}/purges',\n 'projects/{project_id}/datasets/{dataset_name}/purges'\n ],\n slug: 'cdn-cache-purge',\n title: 'CDN Cache Purge API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'global',\n pathPatterns: [\n 'agent/prompt',\n 'agent/{organizationId}/threads/{threadId}'\n ],\n slug: 'content-agent',\n title: 'Content Agent API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{dataset}/copy'\n ],\n slug: 'copy',\n title: 'Copy API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/doc/{dataset}/{documentId}'\n ],\n slug: 'doc',\n title: 'Doc API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'embeddings-index/query/{dataset}/{indexName}',\n 'embeddings-index/{dataset}',\n 'embeddings-index/{dataset}/{indexName}'\n ],\n slug: 'embeddings-index',\n title: 'Embeddings Index API reference (deprecated)'\n },\n {\n defaultApiVersion: 'v2021-03-25',\n host: 'project',\n pathPatterns: [\n 'data/export/{dataset}'\n ],\n slug: 'export',\n title: 'Export API reference'\n },\n {\n host: 'global',\n pathPatterns: [\n 'functions',\n 'functions/{functionId}',\n 'functions/{functionId}/envvars',\n 'functions/{functionId}/envvars/{envVarKey}',\n 'functions/{functionId}/invoke',\n 'functions/{functionId}/logs',\n 'functions/{functionId}/logs/stream'\n ],\n slug: 'functions-api',\n title: 'Functions API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/history/{dataset}/documents/{documentId}',\n 'data/history/{dataset}/transactions',\n 'data/history/{dataset}/transactions/{documentIds}'\n ],\n slug: 'history',\n title: 'History API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'jobs/{jobId}',\n 'jobs/{jobId}/listen'\n ],\n slug: 'jobs',\n title: 'Jobs API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/listen/{dataset}'\n ],\n slug: 'listen',\n title: 'Listen API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/live/events/{dataset}'\n ],\n slug: 'live',\n title: 'Live Content API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'media-libraries/{libraryId}/from-url',\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/mutate/{dataset}'\n ],\n slug: 'mutation',\n title: 'Mutation API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'projects',\n 'projects/{projectId}',\n 'projects/{projectId}/cors',\n 'projects/{projectId}/cors/{id}',\n 'projects/{projectId}/datasets',\n 'projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}',\n 'projects/{projectId}/datasets/{name}',\n 'projects/{projectId}/datasets/{name}/copy',\n 'projects/{projectId}/datasets/{name}/settings/embeddings',\n 'projects/{projectId}/datasets/{name}/tags',\n 'projects/{projectId}/features',\n 'projects/{projectId}/permissions',\n 'projects/{projectId}/tags',\n 'projects/{projectId}/tags/{tagIdentifier}',\n 'projects/{projectId}/tokens',\n 'projects/{projectId}/tokens/{tokenId}',\n 'projects/{projectId}/users/{userId}'\n ],\n slug: 'projects-api',\n title: 'Projects API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/query/{dataset}'\n ],\n slug: 'query',\n title: 'Query API reference'\n },\n {\n defaultApiVersion: 'v2021-10-04',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{userId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/roles',\n 'projects/{projectId}/roles/{roleName}'\n ],\n slug: 'roles',\n title: 'Roles API reference'\n },\n {\n defaultApiVersion: 'v2022-04-01',\n host: 'project',\n pathPatterns: [\n 'publish/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}/{scheduleId}',\n 'schedules/{projectId}/{dataset}/{scheduleId}/publish',\n 'unpublish/{projectId}/{dataset}'\n ],\n slug: 'scheduling',\n title: 'Scheduling API reference'\n },\n {\n defaultApiVersion: 'v2026-04-27',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/attribute-definitions',\n 'organizations/{organizationId}/attribute-definitions/{key}',\n 'organizations/{organizationId}/users/me/attributes',\n 'organizations/{organizationId}/users/{sanityUserId}/attributes'\n ],\n slug: 'user-attributes',\n title: 'User attributes API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'hooks/projects/{projectId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/{id}/messages'\n ],\n slug: 'webhooks',\n title: 'Webhooks API reference'\n }\n]\n"],"names":["apiRoutes","defaultApiVersion","host","pathPatterns","slug","title"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,YAA6B;IACxC;QACEC,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;CACD,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile, realpath } from 'node:fs/promises';
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { subdebug } from '@sanity/cli-core';
|
|
3
|
+
import { subdebug } from '@sanity/cli-core/debug';
|
|
4
4
|
const debug = subdebug('updateChecker');
|
|
5
5
|
const KNOWN_PACKAGES = new Set([
|
|
6
6
|
'@sanity/cli',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/util/update/resolveRunnerPackage.ts"],"sourcesContent":["import {readFile, realpath} from 'node:fs/promises'\nimport {dirname, resolve} from 'node:path'\n\nimport {subdebug} from '@sanity/cli-core'\n\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\nconst KNOWN_PACKAGES = new Set<SanityPackage>(['@sanity/cli', 'sanity'])\nconst MAX_WALK_ITERATIONS = 25\n\ninterface RunnerPackage {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Resolve the Sanity package name + installed version from a runner install.\n * Falls back to `sanity` + `fallbackVersion` when the walk can't determine them.\n */\nexport async function resolveRunnerPackage(\n binaryPath: string = process.argv[1] ?? '',\n fallbackVersion = '',\n): Promise<RunnerPackage> {\n try {\n // Follow the runner's .bin/sanity symlink to the real bin file, then walk\n // up until we hit a package.json for a known Sanity package.\n let dir = dirname(await realpath(binaryPath))\n for (let i = 0; i < MAX_WALK_ITERATIONS && dir !== resolve(dir, '..'); i++) {\n try {\n const pkg = JSON.parse(await readFile(resolve(dir, 'package.json'), 'utf8'))\n if (\n typeof pkg.name === 'string' &&\n typeof pkg.version === 'string' &&\n isKnownSanityPackage(pkg.name)\n ) {\n return {installedVersion: pkg.version, packageName: pkg.name}\n }\n } catch {\n // ignore missing/malformed package.json and keep walking\n }\n dir = dirname(dir)\n }\n debug('resolveRunnerPackage: walk exhausted without finding a known Sanity package')\n } catch (err) {\n debug('resolveRunnerPackage: realpath failed for %s (%s)', binaryPath, err)\n }\n\n return {installedVersion: fallbackVersion, packageName: 'sanity'}\n}\n\nfunction isKnownSanityPackage(name: string): name is SanityPackage {\n return KNOWN_PACKAGES.has(name as SanityPackage)\n}\n"],"names":["readFile","realpath","dirname","resolve","subdebug","debug","KNOWN_PACKAGES","Set","MAX_WALK_ITERATIONS","resolveRunnerPackage","binaryPath","process","argv","fallbackVersion","dir","i","pkg","JSON","parse","name","version","isKnownSanityPackage","installedVersion","packageName","err","has"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,QAAQ,QAAO,mBAAkB;AACnD,SAAQC,OAAO,EAAEC,OAAO,QAAO,YAAW;AAE1C,SAAQC,QAAQ,QAAO,
|
|
1
|
+
{"version":3,"sources":["../../../src/util/update/resolveRunnerPackage.ts"],"sourcesContent":["import {readFile, realpath} from 'node:fs/promises'\nimport {dirname, resolve} from 'node:path'\n\nimport {subdebug} from '@sanity/cli-core/debug'\n\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\nconst KNOWN_PACKAGES = new Set<SanityPackage>(['@sanity/cli', 'sanity'])\nconst MAX_WALK_ITERATIONS = 25\n\ninterface RunnerPackage {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Resolve the Sanity package name + installed version from a runner install.\n * Falls back to `sanity` + `fallbackVersion` when the walk can't determine them.\n */\nexport async function resolveRunnerPackage(\n binaryPath: string = process.argv[1] ?? '',\n fallbackVersion = '',\n): Promise<RunnerPackage> {\n try {\n // Follow the runner's .bin/sanity symlink to the real bin file, then walk\n // up until we hit a package.json for a known Sanity package.\n let dir = dirname(await realpath(binaryPath))\n for (let i = 0; i < MAX_WALK_ITERATIONS && dir !== resolve(dir, '..'); i++) {\n try {\n const pkg = JSON.parse(await readFile(resolve(dir, 'package.json'), 'utf8'))\n if (\n typeof pkg.name === 'string' &&\n typeof pkg.version === 'string' &&\n isKnownSanityPackage(pkg.name)\n ) {\n return {installedVersion: pkg.version, packageName: pkg.name}\n }\n } catch {\n // ignore missing/malformed package.json and keep walking\n }\n dir = dirname(dir)\n }\n debug('resolveRunnerPackage: walk exhausted without finding a known Sanity package')\n } catch (err) {\n debug('resolveRunnerPackage: realpath failed for %s (%s)', binaryPath, err)\n }\n\n return {installedVersion: fallbackVersion, packageName: 'sanity'}\n}\n\nfunction isKnownSanityPackage(name: string): name is SanityPackage {\n return KNOWN_PACKAGES.has(name as SanityPackage)\n}\n"],"names":["readFile","realpath","dirname","resolve","subdebug","debug","KNOWN_PACKAGES","Set","MAX_WALK_ITERATIONS","resolveRunnerPackage","binaryPath","process","argv","fallbackVersion","dir","i","pkg","JSON","parse","name","version","isKnownSanityPackage","installedVersion","packageName","err","has"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,QAAQ,QAAO,mBAAkB;AACnD,SAAQC,OAAO,EAAEC,OAAO,QAAO,YAAW;AAE1C,SAAQC,QAAQ,QAAO,yBAAwB;AAI/C,MAAMC,QAAQD,SAAS;AAEvB,MAAME,iBAAiB,IAAIC,IAAmB;IAAC;IAAe;CAAS;AACvE,MAAMC,sBAAsB;AAO5B;;;CAGC,GACD,OAAO,eAAeC,qBACpBC,aAAqBC,QAAQC,IAAI,CAAC,EAAE,IAAI,EAAE,EAC1CC,kBAAkB,EAAE;IAEpB,IAAI;QACF,0EAA0E;QAC1E,6DAA6D;QAC7D,IAAIC,MAAMZ,QAAQ,MAAMD,SAASS;QACjC,IAAK,IAAIK,IAAI,GAAGA,IAAIP,uBAAuBM,QAAQX,QAAQW,KAAK,OAAOC,IAAK;YAC1E,IAAI;gBACF,MAAMC,MAAMC,KAAKC,KAAK,CAAC,MAAMlB,SAASG,QAAQW,KAAK,iBAAiB;gBACpE,IACE,OAAOE,IAAIG,IAAI,KAAK,YACpB,OAAOH,IAAII,OAAO,KAAK,YACvBC,qBAAqBL,IAAIG,IAAI,GAC7B;oBACA,OAAO;wBAACG,kBAAkBN,IAAII,OAAO;wBAAEG,aAAaP,IAAIG,IAAI;oBAAA;gBAC9D;YACF,EAAE,OAAM;YACN,yDAAyD;YAC3D;YACAL,MAAMZ,QAAQY;QAChB;QACAT,MAAM;IACR,EAAE,OAAOmB,KAAK;QACZnB,MAAM,qDAAqDK,YAAYc;IACzE;IAEA,OAAO;QAACF,kBAAkBT;QAAiBU,aAAa;IAAQ;AAClE;AAEA,SAASF,qBAAqBF,IAAY;IACxC,OAAOb,eAAemB,GAAG,CAACN;AAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/util/update/resolveUpdateTarget.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core'\n\nimport {\n findInstalledPackage,\n findPackageDeclaration,\n} from '../packageManager/installationInfo/detectPackages.js'\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\ninterface UpdateTarget {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Determine which package to check for updates and what version is currently installed.\n *\n * If the user's project declares `sanity` as a dependency and it's installed,\n * we check `sanity` (since that's what the user manages). Otherwise, we fall back\n * to `@sanity/cli` (the currently running CLI binary).\n */\nexport async function resolveUpdateTarget(cwd: string, cliVersion: string): Promise<UpdateTarget> {\n // Check if `sanity` is a dependency in the local project\n const sanityDeclaration = await findPackageDeclaration('sanity', cwd)\n\n if (sanityDeclaration) {\n debug('Project declares sanity as a dependency, checking installed version')\n const sanityInstalled = await findInstalledPackage('sanity', cwd)\n\n if (sanityInstalled) {\n debug('Installed sanity version: %s', sanityInstalled.version)\n return {installedVersion: sanityInstalled.version, packageName: 'sanity'}\n }\n\n debug('sanity is declared but not installed, falling back to @sanity/cli')\n }\n\n return {installedVersion: cliVersion, packageName: '@sanity/cli'}\n}\n"],"names":["subdebug","findInstalledPackage","findPackageDeclaration","debug","resolveUpdateTarget","cwd","cliVersion","sanityDeclaration","sanityInstalled","version","installedVersion","packageName"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,
|
|
1
|
+
{"version":3,"sources":["../../../src/util/update/resolveUpdateTarget.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core/debug'\n\nimport {\n findInstalledPackage,\n findPackageDeclaration,\n} from '../packageManager/installationInfo/detectPackages.js'\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\n\nconst debug = subdebug('updateChecker')\n\ninterface UpdateTarget {\n installedVersion: string\n packageName: SanityPackage\n}\n\n/**\n * Determine which package to check for updates and what version is currently installed.\n *\n * If the user's project declares `sanity` as a dependency and it's installed,\n * we check `sanity` (since that's what the user manages). Otherwise, we fall back\n * to `@sanity/cli` (the currently running CLI binary).\n */\nexport async function resolveUpdateTarget(cwd: string, cliVersion: string): Promise<UpdateTarget> {\n // Check if `sanity` is a dependency in the local project\n const sanityDeclaration = await findPackageDeclaration('sanity', cwd)\n\n if (sanityDeclaration) {\n debug('Project declares sanity as a dependency, checking installed version')\n const sanityInstalled = await findInstalledPackage('sanity', cwd)\n\n if (sanityInstalled) {\n debug('Installed sanity version: %s', sanityInstalled.version)\n return {installedVersion: sanityInstalled.version, packageName: 'sanity'}\n }\n\n debug('sanity is declared but not installed, falling back to @sanity/cli')\n }\n\n return {installedVersion: cliVersion, packageName: '@sanity/cli'}\n}\n"],"names":["subdebug","findInstalledPackage","findPackageDeclaration","debug","resolveUpdateTarget","cwd","cliVersion","sanityDeclaration","sanityInstalled","version","installedVersion","packageName"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,yBAAwB;AAE/C,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB,uDAAsD;AAG7D,MAAMC,QAAQH,SAAS;AAOvB;;;;;;CAMC,GACD,OAAO,eAAeI,oBAAoBC,GAAW,EAAEC,UAAkB;IACvE,yDAAyD;IACzD,MAAMC,oBAAoB,MAAML,uBAAuB,UAAUG;IAEjE,IAAIE,mBAAmB;QACrBJ,MAAM;QACN,MAAMK,kBAAkB,MAAMP,qBAAqB,UAAUI;QAE7D,IAAIG,iBAAiB;YACnBL,MAAM,gCAAgCK,gBAAgBC,OAAO;YAC7D,OAAO;gBAACC,kBAAkBF,gBAAgBC,OAAO;gBAAEE,aAAa;YAAQ;QAC1E;QAEAR,MAAM;IACR;IAEA,OAAO;QAACO,kBAAkBJ;QAAYK,aAAa;IAAa;AAClE"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { getUserConfig
|
|
3
|
+
import { getUserConfig } from '@sanity/cli-core/config';
|
|
4
|
+
import { subdebug } from '@sanity/cli-core/debug';
|
|
5
|
+
import { isCi } from '@sanity/cli-core/util';
|
|
4
6
|
import { gt as semverGt } from 'semver';
|
|
5
7
|
import { detectPackageRunner } from './packageRunner.js';
|
|
6
8
|
import { resolveRunnerPackage } from './resolveRunnerPackage.js';
|
|
7
9
|
import { resolveUpdateTarget } from './resolveUpdateTarget.js';
|
|
8
|
-
import { showUpdateNotification } from './showNotificationUpdate.js';
|
|
9
10
|
const debug = subdebug('updateChecker');
|
|
10
11
|
const TWELVE_HOURS = 12 * 60 * 60 * 1000;
|
|
11
12
|
/**
|
|
@@ -41,6 +42,10 @@ const TWELVE_HOURS = 12 * 60 * 60 * 1000;
|
|
|
41
42
|
debug('Update is available (%s), already notified for this cache cycle', latestVersion);
|
|
42
43
|
} else {
|
|
43
44
|
debug('Update is available (%s)', latestVersion);
|
|
45
|
+
// Imported lazily: the notification pulls in the ux helpers, and this
|
|
46
|
+
// check runs on every invocation, including `--version` and `--help`.
|
|
47
|
+
// eslint-disable-next-line no-restricted-syntax -- static relative import, not a user file path
|
|
48
|
+
const { showUpdateNotification } = await import('./showNotificationUpdate.js');
|
|
44
49
|
await showUpdateNotification(installedVersion, latestVersion, packageName, runner);
|
|
45
50
|
store.set(notifiedKey, updatedAt);
|
|
46
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/util/update/updateChecker.ts"],"sourcesContent":["import {spawn} from 'node:child_process'\nimport {fileURLToPath} from 'node:url'\n\nimport {getUserConfig
|
|
1
|
+
{"version":3,"sources":["../../../src/util/update/updateChecker.ts"],"sourcesContent":["import {spawn} from 'node:child_process'\nimport {fileURLToPath} from 'node:url'\n\nimport {getUserConfig} from '@sanity/cli-core/config'\nimport {subdebug} from '@sanity/cli-core/debug'\nimport {isCi} from '@sanity/cli-core/util'\nimport {gt as semverGt} from 'semver'\n\nimport {type SanityPackage} from '../packageManager/installationInfo/types.js'\nimport {detectPackageRunner} from './packageRunner.js'\nimport {resolveRunnerPackage} from './resolveRunnerPackage.js'\nimport {resolveUpdateTarget} from './resolveUpdateTarget.js'\n\nconst debug = subdebug('updateChecker')\n\nconst TWELVE_HOURS = 12 * 60 * 60 * 1000\n\n/**\n * Check for CLI updates and notify the user if a new version is available.\n *\n * The main process resolves the local update target (which package and installed version),\n * then reads the latest version from the config cache. It never makes network requests.\n * If the cache is empty or expired, a detached worker process is spawned to fetch the\n * latest version from npm and write it to the cache. The notification is shown on the\n * next CLI invocation when the cached result is available instantly.\n */\nexport async function updateChecker(config: {version: string}): Promise<void> {\n debug(`Installed CLI version is ${config.version}`)\n\n // Skip in CI or if disabled\n if (isCi() || process.env.NO_UPDATE_NOTIFIER) {\n debug('Running on CI, or explicitly disabled, skipping update check')\n return\n }\n\n if (!process.stdout.isTTY) {\n return\n }\n\n const runner = detectPackageRunner()\n const {installedVersion, packageName} = runner\n ? await resolveRunnerPackage(process.argv[1] ?? '', config.version)\n : await resolveUpdateTarget(process.cwd(), config.version)\n debug('Update target: %s@%s%s', packageName, installedVersion, runner ? ` via ${runner}` : '')\n\n const store = getUserConfig()\n const cacheKey = `latestVersion:${packageName}`\n const cached = readCachedLatestVersion(store, cacheKey)\n\n if (cached) {\n const {expired, latestVersion, updatedAt} = cached\n\n debug(\n 'Cache %s for %s: installed=%s, latest=%s',\n expired ? 'expired' : 'hit',\n packageName,\n installedVersion,\n latestVersion,\n )\n\n if (semverGt(latestVersion, installedVersion)) {\n const notifiedKey = `notifiedAt:${packageName}`\n if (store.get(notifiedKey) === updatedAt) {\n debug('Update is available (%s), already notified for this cache cycle', latestVersion)\n } else {\n debug('Update is available (%s)', latestVersion)\n // Imported lazily: the notification pulls in the ux helpers, and this\n // check runs on every invocation, including `--version` and `--help`.\n // eslint-disable-next-line no-restricted-syntax -- static relative import, not a user file path\n const {showUpdateNotification} = await import('./showNotificationUpdate.js')\n await showUpdateNotification(installedVersion, latestVersion, packageName, runner)\n store.set(notifiedKey, updatedAt)\n }\n } else {\n debug('No update found')\n }\n\n if (expired) {\n debug('Cache expired, spawning worker to refresh')\n spawnFetchWorker(config.version, packageName)\n }\n } else {\n debug('No cached update info, spawning worker to fetch')\n spawnFetchWorker(config.version, packageName)\n }\n}\n\n/**\n * Read and validate the cached latest version for a specific package.\n * The cache only stores the latest npm version (globally valid) - the installed\n * version is always resolved locally to avoid cross-project confusion.\n */\nfunction readCachedLatestVersion(\n store: ReturnType<typeof getUserConfig>,\n cacheKey: string,\n): {expired: boolean; latestVersion: string; updatedAt: number} | null {\n const stored: unknown = store.get(cacheKey)\n\n if (\n !stored ||\n typeof stored !== 'object' ||\n !('updatedAt' in stored) ||\n typeof stored.updatedAt !== 'number' ||\n !('value' in stored) ||\n typeof stored.value !== 'string'\n ) {\n return null\n }\n\n const expired = Date.now() - stored.updatedAt > TWELVE_HOURS\n return {expired, latestVersion: stored.value, updatedAt: stored.updatedAt}\n}\n\n/**\n * Spawn a detached worker process to fetch the latest version and update the cache.\n * The worker is unref'd so the parent CLI can exit immediately.\n */\nfunction spawnFetchWorker(cliVersion: string, packageName: SanityPackage): void {\n const workerPath = fileURLToPath(new URL('fetchUpdateInfo.worker.js', import.meta.url))\n debug(`Spawning update check worker: ${process.execPath} ${workerPath}`)\n\n spawn(process.execPath, [workerPath], {\n detached: true,\n env: {\n ...process.env,\n SANITY_UPDATE_CHECK_CLI_VERSION: cliVersion,\n SANITY_UPDATE_CHECK_CWD: process.cwd(),\n SANITY_UPDATE_CHECK_PACKAGE: packageName,\n },\n stdio: debug.enabled ? 'inherit' : 'ignore',\n }).unref()\n}\n"],"names":["spawn","fileURLToPath","getUserConfig","subdebug","isCi","gt","semverGt","detectPackageRunner","resolveRunnerPackage","resolveUpdateTarget","debug","TWELVE_HOURS","updateChecker","config","version","process","env","NO_UPDATE_NOTIFIER","stdout","isTTY","runner","installedVersion","packageName","argv","cwd","store","cacheKey","cached","readCachedLatestVersion","expired","latestVersion","updatedAt","notifiedKey","get","showUpdateNotification","set","spawnFetchWorker","stored","value","Date","now","cliVersion","workerPath","URL","url","execPath","detached","SANITY_UPDATE_CHECK_CLI_VERSION","SANITY_UPDATE_CHECK_CWD","SANITY_UPDATE_CHECK_PACKAGE","stdio","enabled","unref"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/util/update/updateCheckerDebug.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core'\n\nexport const updateCheckerDebug = subdebug('updateChecker')\n"],"names":["subdebug","updateCheckerDebug"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,
|
|
1
|
+
{"version":3,"sources":["../../../src/util/update/updateCheckerDebug.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core/debug'\n\nexport const updateCheckerDebug = subdebug('updateChecker')\n"],"names":["subdebug","updateCheckerDebug"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,yBAAwB;AAE/C,OAAO,MAAMC,qBAAqBD,SAAS,iBAAgB"}
|