@sanity/cli 8.35.0 → 8.37.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/dist/actions/build/buildApp.js +1 -4
- package/dist/actions/build/buildApp.js.map +1 -1
- package/dist/actions/build/buildStudio.js +1 -0
- package/dist/actions/build/buildStudio.js.map +1 -1
- package/dist/actions/deploy/deployApp.js +32 -12
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/deploy/deployChecks.js +2 -1
- package/dist/actions/deploy/deployChecks.js.map +1 -1
- package/dist/actions/deploy/deployDashboardConfig.js +124 -0
- package/dist/actions/deploy/deployDashboardConfig.js.map +1 -0
- package/dist/actions/deploy/deployRunner.js.map +1 -1
- package/dist/actions/deploy/deployStudio.js +26 -9
- package/dist/actions/deploy/deployStudio.js.map +1 -1
- package/dist/actions/deploy/resolveDeployTarget.js +2 -2
- package/dist/actions/deploy/resolveDeployTarget.js.map +1 -1
- package/dist/actions/dev/servers/getDevServerConfig.js +2 -5
- package/dist/actions/dev/servers/getDevServerConfig.js.map +1 -1
- package/dist/actions/graphql/extractGraphQLAPIs.js +6 -4
- package/dist/actions/graphql/extractGraphQLAPIs.js.map +1 -1
- package/dist/actions/graphql/extractGraphQLAPIs.worker.js +2 -1
- package/dist/actions/graphql/extractGraphQLAPIs.worker.js.map +1 -1
- package/dist/actions/preview/previewAction.js +2 -2
- package/dist/actions/preview/previewAction.js.map +1 -1
- package/dist/actions/targets/resolveCommandTarget.js +130 -0
- package/dist/actions/targets/resolveCommandTarget.js.map +1 -0
- package/dist/actions/undeploy/runUndeploy.js +33 -5
- package/dist/actions/undeploy/runUndeploy.js.map +1 -1
- package/dist/actions/undeploy/undeployPlan.js +2 -2
- package/dist/actions/undeploy/undeployPlan.js.map +1 -1
- package/dist/commands/build.js +8 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/deploy.js +15 -3
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/documents/query.js +26 -11
- package/dist/commands/documents/query.js.map +1 -1
- package/dist/commands/media/prune-aspect-data.js +1 -1
- package/dist/commands/media/prune-aspect-data.js.map +1 -1
- package/dist/commands/media/pull-aspects.js +1 -1
- package/dist/commands/media/pull-aspects.js.map +1 -1
- package/dist/exports/index.d.ts +2 -2
- package/dist/exports/index.js +1 -1
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/runtime.d.ts +2 -2
- package/dist/exports/runtime.js +1 -1
- package/dist/exports/runtime.js.map +1 -1
- package/dist/generated/apiRoutes.js +37 -0
- package/dist/generated/apiRoutes.js.map +1 -1
- package/dist/prompts/promptForProject.js +9 -3
- package/dist/prompts/promptForProject.js.map +1 -1
- package/dist/services/blueprints.js +18 -0
- package/dist/services/blueprints.js.map +1 -0
- package/dist/util/checkoutBlueprint.js +33 -0
- package/dist/util/checkoutBlueprint.js.map +1 -0
- package/dist/util/sharedFlags.js +10 -0
- package/dist/util/sharedFlags.js.map +1 -1
- package/oclif.manifest.json +1143 -1136
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/media/pull-aspects.ts"],"sourcesContent":["import {access, mkdir, readFile, writeFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport {styleText} from 'node:util'\n\nimport {Flags} from '@oclif/core'\nimport {\n type CliConfig,\n exitCodes,\n ProjectRootNotFoundError,\n SanityCommand,\n subdebug,\n} from '@sanity/cli-core'\nimport {confirm, logSymbols, spinner} from '@sanity/cli-core/ux'\nimport {resolveWorkbenchConfig} from '@sanity/workbench-cli/deploy'\n\nimport {appendFieldEntries} from '../../actions/media/cliConfigFields.js'\nimport {\n convertAspectDocuments,\n formatFieldEntries,\n type GeneratedFieldModule,\n type SkippedAspect,\n} from '../../actions/media/pullAspects.js'\nimport {resolveMediaLibraryId} from '../../actions/media/resolveMediaLibraryId.js'\nimport {getAspects} from '../../services/mediaLibraries.js'\nimport {pluralize} from '../../util/pluralize.js'\nimport {defineCommandTelemetry} from '../../util/telemetry/commandTelemetry.js'\n\nconst pullAspectsDebug = subdebug('media:pull-aspects')\n\nconst NOT_A_CONFIG_APP =\n 'This command must be run inside a Media Library config app — a project whose ' +\n '`sanity.cli.ts` declares `unstable_defineMediaLibrary(...)`. Scaffold one with ' +\n '`sanity init --template media-library-config`.'\n\nconst flags = {\n 'media-library-id': Flags.string({\n description:\n 'The id of the media library to pull from (defaults to the single active library of the configured organization)',\n }),\n 'out-dir': Flags.string({\n default: 'src/fields',\n description: 'Directory to write the generated field modules to, relative to the project root',\n }),\n overwrite: Flags.boolean({\n description:\n 'Overwrite existing field modules and re-generate fields already declared in the config',\n }),\n 'update-config': Flags.boolean({\n allowNo: true,\n description:\n 'Declare the generated fields in sanity.cli.ts (--no-update-config to skip). Prompted when omitted; unattended runs only print the entries',\n }),\n}\n\n/**\n * The outcome of offering to declare the generated fields in `sanity.cli.ts`:\n * written, turned down (flag, prompt, or unattended), or not writable (the\n * config shape could not be edited safely — the `reason` says why).\n */\ntype Registration = 'added' | 'declined' | {reason: string}\n\nexport class MediaPullAspectsCommand extends SanityCommand<typeof MediaPullAspectsCommand> {\n static override description =\n \"Generate field modules from a media library's stored aspect documents\"\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Generate src/fields/<name>.tsx modules from the stored aspects',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --media-library-id ml123 --overwrite',\n description: 'Pull from a specific media library, overwriting existing modules',\n },\n ]\n\n static override flags = flags\n\n // Part of the beta config-app flow: only usable inside a config app (like\n // the unlisted media-library-config init template, which points to it), and\n // listing it next to the legacy aspect commands would mix the two\n // paradigms. Unhide when the config app leaves beta.\n static override hidden = true\n\n // --out-dir is a local filesystem path.\n static telemetry = defineCommandTelemetry(flags, {redact: ['out-dir']})\n\n public async run(): Promise<void> {\n const {\n 'media-library-id': mediaLibraryIdFlag,\n 'out-dir': outDir,\n overwrite = false,\n } = this.flags\n\n let cliConfig: CliConfig\n try {\n cliConfig = await this.getCliConfig()\n } catch (err) {\n if (err instanceof ProjectRootNotFoundError) {\n this.error(NOT_A_CONFIG_APP, {exit: exitCodes.RUNTIME_ERROR})\n }\n throw err\n }\n\n const config = resolveWorkbenchConfig(cliConfig)\n if (!config) {\n this.error(NOT_A_CONFIG_APP, {exit: exitCodes.RUNTIME_ERROR})\n }\n\n const root = await this.getProjectRoot()\n // The generated `src:` entries and the ownership story both assume the\n // modules live inside the project; a path escaping the root is a mistake.\n // `outDirRelative` (not the raw flag) feeds the report so an absolute\n // --out-dir inside the root still prints proper relative `src:` entries.\n const outDirAbsolute = path.resolve(root.directory, outDir)\n const outDirRelative = path.relative(root.directory, outDirAbsolute)\n if (\n path.isAbsolute(outDirRelative) ||\n outDirRelative === '..' ||\n outDirRelative.startsWith(`..${path.sep}`)\n ) {\n this.error(`--out-dir must stay inside the project root (got \"${outDir}\")`, {\n exit: exitCodes.USAGE_ERROR,\n })\n }\n\n try {\n const mediaLibraryId = await resolveMediaLibraryId({\n mediaLibraryIdFlag,\n organizationId: config.organizationId,\n unattended: this.isUnattended(),\n })\n\n const spin = spinner('Fetching stored aspect documents').start()\n let documents: Awaited<ReturnType<typeof getAspects>>\n try {\n documents = await getAspects(mediaLibraryId)\n } finally {\n // Also on failure — a spinner left running garbles the error output.\n spin.stop()\n }\n\n if (documents.length === 0) {\n this.log(\n `Media library ${styleText('bold', mediaLibraryId)} has no stored aspects — nothing to pull.`,\n )\n return\n }\n\n // Names already declared in the config are owned by existing field\n // modules; pulling the stored mirror back over them would regress local\n // edits, so they are skipped unless --overwrite says otherwise.\n const configuredNames = new Set(config.fields.map((field) => field.name))\n const configuredSrcByName = new Map(config.fields.map((field) => [field.name, field.src]))\n\n // One module per field name; name collisions and invalid documents are skipped.\n const {modules: winners, skipped} = convertAspectDocuments(documents)\n\n const generated: GeneratedFieldModule[] = []\n // Module name -> written path relative to the project root, so the\n // report shows where each module actually landed.\n const writtenPaths = new Map<string, string>()\n // Module name -> path of a module skipped because it already exists on\n // disk. Those fields may still be undeclared and need registration.\n const existingPaths = new Map<string, string>()\n for (const module of winners) {\n if (!overwrite && configuredNames.has(module.name)) {\n skipped.push({\n id: module.name,\n reasons: ['Already declared in sanity.cli.ts (pass --overwrite to re-generate)'],\n status: 'skipped',\n validationErrors: [],\n })\n continue\n }\n\n const defaultDestination = path.join(outDirAbsolute, module.filename)\n // The pull generates `.tsx`, but a hand-written module for the same\n // field may be plain `.ts` — treat both as taken.\n const existing = await firstExisting([\n defaultDestination,\n defaultDestination.replace(/\\.tsx$/, '.ts'),\n ])\n if (!overwrite && existing) {\n // The file is left alone, but the field is undeclared (declared\n // names were skipped above) — so it still joins the registration\n // offer below. An on-disk module without a config entry is exactly\n // the state the next deploy punishes, however the file got there.\n existingPaths.set(module.name, path.relative(root.directory, existing))\n skipped.push({\n id: module.name,\n reasons: [\n `A file already exists at ${path.relative(root.directory, existing)} (pass --overwrite to replace it)`,\n ],\n status: 'skipped',\n validationErrors: [],\n })\n continue\n }\n\n // When overwriting a field the config already declares, the module\n // must land at the declared `src` path — writing <out-dir>/<name>.tsx\n // instead would orphan the new file while deploy keeps evaluating the\n // old one. Failing that, replace the module found on disk (which may\n // be the .ts variant), and only then fall back to the default.\n const declaredSrc = overwrite ? configuredSrcByName.get(module.name) : undefined\n const destination = declaredSrc\n ? await resolveDeclaredSrc(path.resolve(root.directory, declaredSrc), module.filename)\n : (existing ?? defaultDestination)\n\n await mkdir(path.dirname(destination), {recursive: true})\n await writeFile(destination, module.source)\n writtenPaths.set(module.name, path.relative(root.directory, destination))\n generated.push(module)\n }\n\n // Fields present locally — written this run or already on disk — but not\n // declared get offered for registration: the deploy mirrors config to\n // stored documents, so an undeclared stored aspect is deleted by the\n // next deploy — leaving the entries unpasted is a data hazard, not just\n // friction. Existing files count because a prior pull may have been\n // declined (or edited by hand): the file being there does not make the\n // field declared.\n const entryPaths = new Map([...writtenPaths, ...existingPaths])\n const newEntries = winners.filter(\n (module) => !configuredNames.has(module.name) && entryPaths.has(module.name),\n )\n const entryLines =\n newEntries.length > 0\n ? formatFieldEntries(newEntries, outDirRelative, entryPaths).split('\\n')\n : []\n const registration =\n newEntries.length > 0\n ? await this.maybeRegisterFields({configPath: root.path, entryLines})\n : null\n\n this.report({\n configuredNames,\n entryLines,\n generated,\n newEntries,\n outDir: outDirRelative,\n registration,\n skipped,\n writtenPaths,\n })\n } catch (error) {\n // Ctrl+C on the library prompt and errors that already carry their exit\n // code (`this.error` inside helpers) pass through to SanityCommand.catch.\n if (error instanceof Error && error.name === 'ExitPromptError') throw error\n if (error && typeof error === 'object' && 'oclif' in error) throw error\n const err = error as Error\n pullAspectsDebug('Failed to pull aspects', {error: err, mediaLibraryId: mediaLibraryIdFlag})\n this.error(\n styleText('bold', 'Failed to pull aspects') + `\\n\\n${styleText('red', err.message)}`,\n {exit: exitCodes.RUNTIME_ERROR},\n )\n }\n }\n\n /**\n * Offer to declare the generated fields in `sanity.cli.ts`. `--update-config`\n * / `--no-update-config` decide outright; otherwise an interactive run\n * prompts (default yes) and an unattended run leaves the config alone.\n */\n private async maybeRegisterFields({\n configPath,\n entryLines,\n }: {\n configPath: string\n entryLines: string[]\n }): Promise<Registration> {\n const flag = this.flags['update-config']\n const shouldUpdate =\n flag ??\n (this.isUnattended()\n ? false\n : await confirm({\n default: true,\n message: `Declare the ${entryLines.length} pulled ${pluralize('field', entryLines.length)} in sanity.cli.ts?`,\n }))\n if (!shouldUpdate) return 'declined'\n\n const source = await readFile(configPath, 'utf8')\n const result = appendFieldEntries(source, entryLines)\n if (!result.ok) return {reason: result.reason}\n await writeFile(configPath, result.updated)\n return 'added'\n }\n\n private report({\n configuredNames,\n entryLines,\n generated,\n newEntries,\n outDir,\n registration,\n skipped,\n writtenPaths,\n }: {\n configuredNames: Set<string>\n entryLines: string[]\n generated: GeneratedFieldModule[]\n newEntries: GeneratedFieldModule[]\n outDir: string\n registration: Registration | null\n skipped: SkippedAspect[]\n writtenPaths: Map<string, string>\n }): void {\n if (skipped.length > 0) {\n this.logToStderr('')\n this.warn(\n styleText('bold', `Skipped ${skipped.length} ${pluralize('aspect', skipped.length)}`),\n )\n for (const aspect of skipped) {\n const errors = aspect.validationErrors.flatMap((group) => group.map(({message}) => message))\n const reasons = [...aspect.reasons, ...errors]\n this.logToStderr(` - ${aspect.id} ${styleText('dim', reasons.join('; '))}`)\n }\n }\n\n // No modules written and nothing to declare: done. Skipped-but-undeclared\n // fields keep the report alive — their registration outcome still matters.\n if (generated.length === 0 && newEntries.length === 0) {\n this.log('')\n this.log('No field modules generated.')\n return\n }\n\n if (generated.length === 0) {\n this.log('')\n this.log('No field modules generated.')\n } else {\n this.log('')\n this.log(\n `${logSymbols.success} ${styleText('bold', `Generated ${generated.length} field ${pluralize('module', generated.length)}`)}`,\n )\n for (const module of generated) {\n const location = writtenPaths.get(module.name) ?? path.join(outDir, module.filename)\n this.log(` - ${module.name} ${styleText('dim', location)}`)\n for (const warning of module.warnings) {\n this.log(` ${logSymbols.warning} ${warning}`)\n }\n }\n }\n\n if (newEntries.length > 0 && registration === 'added') {\n this.log('')\n this.log(\n `${logSymbols.success} Declared ${newEntries.length} ${pluralize('field', newEntries.length)} in ${styleText('bold', 'sanity.cli.ts')}`,\n )\n } else if (newEntries.length > 0) {\n if (registration !== null && typeof registration === 'object') {\n this.warn(`Could not update sanity.cli.ts automatically: ${registration.reason}`)\n }\n this.log('')\n this.log(\n configuredNames.size > 0\n ? `Add the pulled ${pluralize('field', newEntries.length)} to the \\`fields\\` array in ${styleText('bold', 'sanity.cli.ts')}:`\n : `Declare the pulled ${pluralize('field', newEntries.length)} in ${styleText('bold', 'sanity.cli.ts')}:`,\n )\n this.log('')\n this.log(entryLines.map((line) => ` ${line}`).join('\\n'))\n // The deploy mirrors config into stored documents; a pulled-but-undeclared\n // field reads as stale there, so leaving the entries out is destructive.\n this.warn(\n '`sanity deploy` deletes the stored definition of any field not declared in sanity.cli.ts.',\n )\n }\n\n this.log('')\n this.log(\n 'Once declared in sanity.cli.ts, the config app owns these definitions — deploying the',\n )\n this.log('config overwrites the stored documents this pull read from. Stored definitions')\n this.log('not declared in sanity.cli.ts are deleted on deploy.')\n }\n}\n\n/**\n * The write target for a declared `src` path. A declared path may omit the\n * extension — the bundler and jiti both resolve `./src/fields/notes` to\n * `notes.ts(x)` — so writing it literally would create an extensionless file\n * next to the module deploy actually evaluates. Resolve to the existing\n * module file; if none exists, append the generated module's extension.\n */\nasync function resolveDeclaredSrc(declaredPath: string, moduleFilename: string): Promise<string> {\n if (path.extname(declaredPath) !== '') return declaredPath\n const existing = await firstExisting([`${declaredPath}.ts`, `${declaredPath}.tsx`])\n return existing ?? `${declaredPath}${path.extname(moduleFilename)}`\n}\n\n/** The first path in `paths` that exists, or `undefined`. */\nasync function firstExisting(paths: string[]): Promise<string | undefined> {\n for (const filePath of paths) {\n const exists = await access(filePath).then(\n () => true,\n () => false,\n )\n if (exists) return filePath\n }\n return undefined\n}\n"],"names":["access","mkdir","readFile","writeFile","path","styleText","Flags","exitCodes","ProjectRootNotFoundError","SanityCommand","subdebug","confirm","logSymbols","spinner","resolveWorkbenchConfig","appendFieldEntries","convertAspectDocuments","formatFieldEntries","resolveMediaLibraryId","getAspects","pluralize","defineCommandTelemetry","pullAspectsDebug","NOT_A_CONFIG_APP","flags","string","description","default","overwrite","boolean","allowNo","MediaPullAspectsCommand","examples","command","hidden","telemetry","redact","run","mediaLibraryIdFlag","outDir","cliConfig","getCliConfig","err","error","exit","RUNTIME_ERROR","config","root","getProjectRoot","outDirAbsolute","resolve","directory","outDirRelative","relative","isAbsolute","startsWith","sep","USAGE_ERROR","mediaLibraryId","organizationId","unattended","isUnattended","spin","start","documents","stop","length","log","configuredNames","Set","fields","map","field","name","configuredSrcByName","Map","src","modules","winners","skipped","generated","writtenPaths","existingPaths","module","has","push","id","reasons","status","validationErrors","defaultDestination","join","filename","existing","firstExisting","replace","set","declaredSrc","get","undefined","destination","resolveDeclaredSrc","dirname","recursive","source","entryPaths","newEntries","filter","entryLines","split","registration","maybeRegisterFields","configPath","report","Error","message","flag","shouldUpdate","result","ok","reason","updated","logToStderr","warn","aspect","errors","flatMap","group","success","location","warning","warnings","size","line","declaredPath","moduleFilename","extname","paths","filePath","exists","then"],"mappings":"AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,QAAO,mBAAkB;AACnE,OAAOC,UAAU,YAAW;AAC5B,SAAQC,SAAS,QAAO,YAAW;AAEnC,SAAQC,KAAK,QAAO,cAAa;AACjC,SAEEC,SAAS,EACTC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,QACH,mBAAkB;AACzB,SAAQC,OAAO,EAAEC,UAAU,EAAEC,OAAO,QAAO,sBAAqB;AAChE,SAAQC,sBAAsB,QAAO,+BAA8B;AAEnE,SAAQC,kBAAkB,QAAO,yCAAwC;AACzE,SACEC,sBAAsB,EACtBC,kBAAkB,QAGb,qCAAoC;AAC3C,SAAQC,qBAAqB,QAAO,+CAA8C;AAClF,SAAQC,UAAU,QAAO,mCAAkC;AAC3D,SAAQC,SAAS,QAAO,0BAAyB;AACjD,SAAQC,sBAAsB,QAAO,2CAA0C;AAE/E,MAAMC,mBAAmBZ,SAAS;AAElC,MAAMa,mBACJ,kFACA,oFACA;AAEF,MAAMC,QAAQ;IACZ,oBAAoBlB,MAAMmB,MAAM,CAAC;QAC/BC,aACE;IACJ;IACA,WAAWpB,MAAMmB,MAAM,CAAC;QACtBE,SAAS;QACTD,aAAa;IACf;IACAE,WAAWtB,MAAMuB,OAAO,CAAC;QACvBH,aACE;IACJ;IACA,iBAAiBpB,MAAMuB,OAAO,CAAC;QAC7BC,SAAS;QACTJ,aACE;IACJ;AACF;AASA,OAAO,MAAMK,gCAAgCtB;IAC3C,OAAgBiB,cACd,wEAAuE;IAEzE,OAAgBM,WAAW;QACzB;YACEC,SAAS;YACTP,aAAa;QACf;QACA;YACEO,SAAS;YACTP,aAAa;QACf;KACD,CAAA;IAED,OAAgBF,QAAQA,MAAK;IAE7B,0EAA0E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ASsF,WAAWxC,MAAM,EAAE,IAAI,EAAE7D,UAAU,QAAQ,iBAAiB,CAAC,CAAC;YAE7G,IAAI,CAAC8D,GAAG,CAAC;YACT,IAAI,CAACA,GAAG,CAACyC,WAAWrC,GAAG,CAAC,CAAC8D,OAAS,CAAC,EAAE,EAAEA,MAAM,EAAE1C,IAAI,CAAC;YACpD,2EAA2E;YAC3E,yEAAyE;YACzE,IAAI,CAACgC,IAAI,CACP;QAEJ;QAEA,IAAI,CAACxD,GAAG,CAAC;QACT,IAAI,CAACA,GAAG,CACN;QAEF,IAAI,CAACA,GAAG,CAAC;QACT,IAAI,CAACA,GAAG,CAAC;IACX;AACF;AAEA;;;;;;CAMC,GACD,eAAekC,mBAAmBiC,YAAoB,EAAEC,cAAsB;IAC5E,IAAInI,KAAKoI,OAAO,CAACF,kBAAkB,IAAI,OAAOA;IAC9C,MAAMzC,WAAW,MAAMC,cAAc;QAAC,GAAGwC,aAAa,GAAG,CAAC;QAAE,GAAGA,aAAa,IAAI,CAAC;KAAC;IAClF,OAAOzC,YAAY,GAAGyC,eAAelI,KAAKoI,OAAO,CAACD,iBAAiB;AACrE;AAEA,2DAA2D,GAC3D,eAAezC,cAAc2C,KAAe;IAC1C,KAAK,MAAMC,YAAYD,MAAO;QAC5B,MAAME,SAAS,MAAM3I,OAAO0I,UAAUE,IAAI,CACxC,IAAM,MACN,IAAM;QAER,IAAID,QAAQ,OAAOD;IACrB;IACA,OAAOvC;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/media/pull-aspects.ts"],"sourcesContent":["import {access, mkdir, readFile, writeFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport {styleText} from 'node:util'\n\nimport {Flags} from '@oclif/core'\nimport {\n type CliConfig,\n exitCodes,\n ProjectRootNotFoundError,\n SanityCommand,\n subdebug,\n} from '@sanity/cli-core'\nimport {confirm, logSymbols, spinner} from '@sanity/cli-core/ux'\nimport {resolveWorkbenchConfig} from '@sanity/workbench-cli/deploy'\n\nimport {appendFieldEntries} from '../../actions/media/cliConfigFields.js'\nimport {\n convertAspectDocuments,\n formatFieldEntries,\n type GeneratedFieldModule,\n type SkippedAspect,\n} from '../../actions/media/pullAspects.js'\nimport {resolveMediaLibraryId} from '../../actions/media/resolveMediaLibraryId.js'\nimport {getAspects} from '../../services/mediaLibraries.js'\nimport {pluralize} from '../../util/pluralize.js'\nimport {defineCommandTelemetry} from '../../util/telemetry/commandTelemetry.js'\n\nconst pullAspectsDebug = subdebug('media:pull-aspects')\n\nconst NOT_A_CONFIG_APP =\n 'This command must be run inside a Media Library config app — a project whose ' +\n '`sanity.cli.ts` declares `unstable_defineMediaLibrary(...)`. Scaffold one with ' +\n '`sanity init --template media-library-config`.'\n\nconst flags = {\n 'media-library-id': Flags.string({\n description:\n 'The id of the media library to pull from (defaults to the single active library of the configured organization)',\n }),\n 'out-dir': Flags.string({\n default: 'src/fields',\n description: 'Directory to write the generated field modules to, relative to the project root',\n }),\n overwrite: Flags.boolean({\n description:\n 'Overwrite existing field modules and re-generate fields already declared in the config',\n }),\n 'update-config': Flags.boolean({\n allowNo: true,\n description:\n 'Declare the generated fields in sanity.cli.ts (--no-update-config to skip). Prompted when omitted; unattended runs only print the entries',\n }),\n}\n\n/**\n * The outcome of offering to declare the generated fields in `sanity.cli.ts`:\n * written, turned down (flag, prompt, or unattended), or not writable (the\n * config shape could not be edited safely — the `reason` says why).\n */\ntype Registration = 'added' | 'declined' | {reason: string}\n\nexport class MediaPullAspectsCommand extends SanityCommand<typeof MediaPullAspectsCommand> {\n static override description =\n \"Generate field modules from a media library's stored aspect documents\"\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Generate src/fields/<name>.tsx modules from the stored aspects',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --media-library-id ml123 --overwrite',\n description: 'Pull from a specific media library, overwriting existing modules',\n },\n ]\n\n static override flags = flags\n\n // Part of the beta config-app flow: only usable inside a config app (like\n // the unlisted media-library-config init template, which points to it), and\n // listing it next to the legacy aspect commands would mix the two\n // paradigms. Unhide when the config app leaves beta.\n static override hidden = true\n\n // --out-dir is a local filesystem path.\n static telemetry = defineCommandTelemetry(flags, {redact: ['out-dir']})\n\n public async run(): Promise<void> {\n const {\n 'media-library-id': mediaLibraryIdFlag,\n 'out-dir': outDir,\n overwrite = false,\n } = this.flags\n\n let cliConfig: CliConfig\n try {\n cliConfig = await this.getCliConfig()\n } catch (err) {\n if (err instanceof ProjectRootNotFoundError) {\n this.error(NOT_A_CONFIG_APP, {exit: exitCodes.RUNTIME_ERROR})\n }\n throw err\n }\n\n const config = resolveWorkbenchConfig(cliConfig)\n if (config?.appType !== 'media-library') {\n this.error(NOT_A_CONFIG_APP, {exit: exitCodes.RUNTIME_ERROR})\n }\n\n const root = await this.getProjectRoot()\n // The generated `src:` entries and the ownership story both assume the\n // modules live inside the project; a path escaping the root is a mistake.\n // `outDirRelative` (not the raw flag) feeds the report so an absolute\n // --out-dir inside the root still prints proper relative `src:` entries.\n const outDirAbsolute = path.resolve(root.directory, outDir)\n const outDirRelative = path.relative(root.directory, outDirAbsolute)\n if (\n path.isAbsolute(outDirRelative) ||\n outDirRelative === '..' ||\n outDirRelative.startsWith(`..${path.sep}`)\n ) {\n this.error(`--out-dir must stay inside the project root (got \"${outDir}\")`, {\n exit: exitCodes.USAGE_ERROR,\n })\n }\n\n try {\n const mediaLibraryId = await resolveMediaLibraryId({\n mediaLibraryIdFlag,\n organizationId: config.organizationId,\n unattended: this.isUnattended(),\n })\n\n const spin = spinner('Fetching stored aspect documents').start()\n let documents: Awaited<ReturnType<typeof getAspects>>\n try {\n documents = await getAspects(mediaLibraryId)\n } finally {\n // Also on failure — a spinner left running garbles the error output.\n spin.stop()\n }\n\n if (documents.length === 0) {\n this.log(\n `Media library ${styleText('bold', mediaLibraryId)} has no stored aspects — nothing to pull.`,\n )\n return\n }\n\n // Names already declared in the config are owned by existing field\n // modules; pulling the stored mirror back over them would regress local\n // edits, so they are skipped unless --overwrite says otherwise.\n const configuredNames = new Set(config.fields.map((field) => field.name))\n const configuredSrcByName = new Map(config.fields.map((field) => [field.name, field.src]))\n\n // One module per field name; name collisions and invalid documents are skipped.\n const {modules: winners, skipped} = convertAspectDocuments(documents)\n\n const generated: GeneratedFieldModule[] = []\n // Module name -> written path relative to the project root, so the\n // report shows where each module actually landed.\n const writtenPaths = new Map<string, string>()\n // Module name -> path of a module skipped because it already exists on\n // disk. Those fields may still be undeclared and need registration.\n const existingPaths = new Map<string, string>()\n for (const module of winners) {\n if (!overwrite && configuredNames.has(module.name)) {\n skipped.push({\n id: module.name,\n reasons: ['Already declared in sanity.cli.ts (pass --overwrite to re-generate)'],\n status: 'skipped',\n validationErrors: [],\n })\n continue\n }\n\n const defaultDestination = path.join(outDirAbsolute, module.filename)\n // The pull generates `.tsx`, but a hand-written module for the same\n // field may be plain `.ts` — treat both as taken.\n const existing = await firstExisting([\n defaultDestination,\n defaultDestination.replace(/\\.tsx$/, '.ts'),\n ])\n if (!overwrite && existing) {\n // The file is left alone, but the field is undeclared (declared\n // names were skipped above) — so it still joins the registration\n // offer below. An on-disk module without a config entry is exactly\n // the state the next deploy punishes, however the file got there.\n existingPaths.set(module.name, path.relative(root.directory, existing))\n skipped.push({\n id: module.name,\n reasons: [\n `A file already exists at ${path.relative(root.directory, existing)} (pass --overwrite to replace it)`,\n ],\n status: 'skipped',\n validationErrors: [],\n })\n continue\n }\n\n // When overwriting a field the config already declares, the module\n // must land at the declared `src` path — writing <out-dir>/<name>.tsx\n // instead would orphan the new file while deploy keeps evaluating the\n // old one. Failing that, replace the module found on disk (which may\n // be the .ts variant), and only then fall back to the default.\n const declaredSrc = overwrite ? configuredSrcByName.get(module.name) : undefined\n const destination = declaredSrc\n ? await resolveDeclaredSrc(path.resolve(root.directory, declaredSrc), module.filename)\n : (existing ?? defaultDestination)\n\n await mkdir(path.dirname(destination), {recursive: true})\n await writeFile(destination, module.source)\n writtenPaths.set(module.name, path.relative(root.directory, destination))\n generated.push(module)\n }\n\n // Fields present locally — written this run or already on disk — but not\n // declared get offered for registration: the deploy mirrors config to\n // stored documents, so an undeclared stored aspect is deleted by the\n // next deploy — leaving the entries unpasted is a data hazard, not just\n // friction. Existing files count because a prior pull may have been\n // declined (or edited by hand): the file being there does not make the\n // field declared.\n const entryPaths = new Map([...writtenPaths, ...existingPaths])\n const newEntries = winners.filter(\n (module) => !configuredNames.has(module.name) && entryPaths.has(module.name),\n )\n const entryLines =\n newEntries.length > 0\n ? formatFieldEntries(newEntries, outDirRelative, entryPaths).split('\\n')\n : []\n const registration =\n newEntries.length > 0\n ? await this.maybeRegisterFields({configPath: root.path, entryLines})\n : null\n\n this.report({\n configuredNames,\n entryLines,\n generated,\n newEntries,\n outDir: outDirRelative,\n registration,\n skipped,\n writtenPaths,\n })\n } catch (error) {\n // Ctrl+C on the library prompt and errors that already carry their exit\n // code (`this.error` inside helpers) pass through to SanityCommand.catch.\n if (error instanceof Error && error.name === 'ExitPromptError') throw error\n if (error && typeof error === 'object' && 'oclif' in error) throw error\n const err = error as Error\n pullAspectsDebug('Failed to pull aspects', {error: err, mediaLibraryId: mediaLibraryIdFlag})\n this.error(\n styleText('bold', 'Failed to pull aspects') + `\\n\\n${styleText('red', err.message)}`,\n {exit: exitCodes.RUNTIME_ERROR},\n )\n }\n }\n\n /**\n * Offer to declare the generated fields in `sanity.cli.ts`. `--update-config`\n * / `--no-update-config` decide outright; otherwise an interactive run\n * prompts (default yes) and an unattended run leaves the config alone.\n */\n private async maybeRegisterFields({\n configPath,\n entryLines,\n }: {\n configPath: string\n entryLines: string[]\n }): Promise<Registration> {\n const flag = this.flags['update-config']\n const shouldUpdate =\n flag ??\n (this.isUnattended()\n ? false\n : await confirm({\n default: true,\n message: `Declare the ${entryLines.length} pulled ${pluralize('field', entryLines.length)} in sanity.cli.ts?`,\n }))\n if (!shouldUpdate) return 'declined'\n\n const source = await readFile(configPath, 'utf8')\n const result = appendFieldEntries(source, entryLines)\n if (!result.ok) return {reason: result.reason}\n await writeFile(configPath, result.updated)\n return 'added'\n }\n\n private report({\n configuredNames,\n entryLines,\n generated,\n newEntries,\n outDir,\n registration,\n skipped,\n writtenPaths,\n }: {\n configuredNames: Set<string>\n entryLines: string[]\n generated: GeneratedFieldModule[]\n newEntries: GeneratedFieldModule[]\n outDir: string\n registration: Registration | null\n skipped: SkippedAspect[]\n writtenPaths: Map<string, string>\n }): void {\n if (skipped.length > 0) {\n this.logToStderr('')\n this.warn(\n styleText('bold', `Skipped ${skipped.length} ${pluralize('aspect', skipped.length)}`),\n )\n for (const aspect of skipped) {\n const errors = aspect.validationErrors.flatMap((group) => group.map(({message}) => message))\n const reasons = [...aspect.reasons, ...errors]\n this.logToStderr(` - ${aspect.id} ${styleText('dim', reasons.join('; '))}`)\n }\n }\n\n // No modules written and nothing to declare: done. Skipped-but-undeclared\n // fields keep the report alive — their registration outcome still matters.\n if (generated.length === 0 && newEntries.length === 0) {\n this.log('')\n this.log('No field modules generated.')\n return\n }\n\n if (generated.length === 0) {\n this.log('')\n this.log('No field modules generated.')\n } else {\n this.log('')\n this.log(\n `${logSymbols.success} ${styleText('bold', `Generated ${generated.length} field ${pluralize('module', generated.length)}`)}`,\n )\n for (const module of generated) {\n const location = writtenPaths.get(module.name) ?? path.join(outDir, module.filename)\n this.log(` - ${module.name} ${styleText('dim', location)}`)\n for (const warning of module.warnings) {\n this.log(` ${logSymbols.warning} ${warning}`)\n }\n }\n }\n\n if (newEntries.length > 0 && registration === 'added') {\n this.log('')\n this.log(\n `${logSymbols.success} Declared ${newEntries.length} ${pluralize('field', newEntries.length)} in ${styleText('bold', 'sanity.cli.ts')}`,\n )\n } else if (newEntries.length > 0) {\n if (registration !== null && typeof registration === 'object') {\n this.warn(`Could not update sanity.cli.ts automatically: ${registration.reason}`)\n }\n this.log('')\n this.log(\n configuredNames.size > 0\n ? `Add the pulled ${pluralize('field', newEntries.length)} to the \\`fields\\` array in ${styleText('bold', 'sanity.cli.ts')}:`\n : `Declare the pulled ${pluralize('field', newEntries.length)} in ${styleText('bold', 'sanity.cli.ts')}:`,\n )\n this.log('')\n this.log(entryLines.map((line) => ` ${line}`).join('\\n'))\n // The deploy mirrors config into stored documents; a pulled-but-undeclared\n // field reads as stale there, so leaving the entries out is destructive.\n this.warn(\n '`sanity deploy` deletes the stored definition of any field not declared in sanity.cli.ts.',\n )\n }\n\n this.log('')\n this.log(\n 'Once declared in sanity.cli.ts, the config app owns these definitions — deploying the',\n )\n this.log('config overwrites the stored documents this pull read from. Stored definitions')\n this.log('not declared in sanity.cli.ts are deleted on deploy.')\n }\n}\n\n/**\n * The write target for a declared `src` path. A declared path may omit the\n * extension — the bundler and jiti both resolve `./src/fields/notes` to\n * `notes.ts(x)` — so writing it literally would create an extensionless file\n * next to the module deploy actually evaluates. Resolve to the existing\n * module file; if none exists, append the generated module's extension.\n */\nasync function resolveDeclaredSrc(declaredPath: string, moduleFilename: string): Promise<string> {\n if (path.extname(declaredPath) !== '') return declaredPath\n const existing = await firstExisting([`${declaredPath}.ts`, `${declaredPath}.tsx`])\n return existing ?? `${declaredPath}${path.extname(moduleFilename)}`\n}\n\n/** The first path in `paths` that exists, or `undefined`. */\nasync function firstExisting(paths: string[]): Promise<string | undefined> {\n for (const filePath of paths) {\n const exists = await access(filePath).then(\n () => true,\n () => false,\n )\n if (exists) return filePath\n }\n return undefined\n}\n"],"names":["access","mkdir","readFile","writeFile","path","styleText","Flags","exitCodes","ProjectRootNotFoundError","SanityCommand","subdebug","confirm","logSymbols","spinner","resolveWorkbenchConfig","appendFieldEntries","convertAspectDocuments","formatFieldEntries","resolveMediaLibraryId","getAspects","pluralize","defineCommandTelemetry","pullAspectsDebug","NOT_A_CONFIG_APP","flags","string","description","default","overwrite","boolean","allowNo","MediaPullAspectsCommand","examples","command","hidden","telemetry","redact","run","mediaLibraryIdFlag","outDir","cliConfig","getCliConfig","err","error","exit","RUNTIME_ERROR","config","appType","root","getProjectRoot","outDirAbsolute","resolve","directory","outDirRelative","relative","isAbsolute","startsWith","sep","USAGE_ERROR","mediaLibraryId","organizationId","unattended","isUnattended","spin","start","documents","stop","length","log","configuredNames","Set","fields","map","field","name","configuredSrcByName","Map","src","modules","winners","skipped","generated","writtenPaths","existingPaths","module","has","push","id","reasons","status","validationErrors","defaultDestination","join","filename","existing","firstExisting","replace","set","declaredSrc","get","undefined","destination","resolveDeclaredSrc","dirname","recursive","source","entryPaths","newEntries","filter","entryLines","split","registration","maybeRegisterFields","configPath","report","Error","message","flag","shouldUpdate","result","ok","reason","updated","logToStderr","warn","aspect","errors","flatMap","group","success","location","warning","warnings","size","line","declaredPath","moduleFilename","extname","paths","filePath","exists","then"],"mappings":"AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,QAAO,mBAAkB;AACnE,OAAOC,UAAU,YAAW;AAC5B,SAAQC,SAAS,QAAO,YAAW;AAEnC,SAAQC,KAAK,QAAO,cAAa;AACjC,SAEEC,SAAS,EACTC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,QACH,mBAAkB;AACzB,SAAQC,OAAO,EAAEC,UAAU,EAAEC,OAAO,QAAO,sBAAqB;AAChE,SAAQC,sBAAsB,QAAO,+BAA8B;AAEnE,SAAQC,kBAAkB,QAAO,yCAAwC;AACzE,SACEC,sBAAsB,EACtBC,kBAAkB,QAGb,qCAAoC;AAC3C,SAAQC,qBAAqB,QAAO,+CAA8C;AAClF,SAAQC,UAAU,QAAO,mCAAkC;AAC3D,SAAQC,SAAS,QAAO,0BAAyB;AACjD,SAAQC,sBAAsB,QAAO,2CAA0C;AAE/E,MAAMC,mBAAmBZ,SAAS;AAElC,MAAMa,mBACJ,kFACA,oFACA;AAEF,MAAMC,QAAQ;IACZ,oBAAoBlB,MAAMmB,MAAM,CAAC;QAC/BC,aACE;IACJ;IACA,WAAWpB,MAAMmB,MAAM,CAAC;QACtBE,SAAS;QACTD,aAAa;IACf;IACAE,WAAWtB,MAAMuB,OAAO,CAAC;QACvBH,aACE;IACJ;IACA,i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 @@ import "@sanity/types";
|
|
|
2
2
|
import { CliConfig, CliConfig as CliConfig$1, UserViteConfig } from "@sanity/cli-core";
|
|
3
3
|
import { ClientConfig, SanityClient } from "@sanity/client";
|
|
4
4
|
import { loadEnv } from "vite";
|
|
5
|
-
import { AssetSourceViewDeclaration, DefineAppInput, DefineAssetSourceViewInput, DefineMediaLibraryInput, DefinePanelViewInput, DefineTileViewInput, DefineWebWorkerInput, DefineWindowViewInput, MediaLibraryField, PanelViewDeclaration, TileViewDeclaration, ViewDeclaration, WebWorkerDeclaration, WindowViewDeclaration, defineApplication, defineApplication as unstable_defineApp, defineAssetSourceView, definePanelView, defineTileView, defineWebWorker, defineWindowView, unstable_defineMediaLibrary } from "@sanity/workbench-cli";
|
|
5
|
+
import { AssetSourceViewDeclaration, DefineAppInput, DefineAssetSourceViewInput, DefineDashboardInput, DefineMediaLibraryInput, DefinePanelViewInput, DefineTileViewInput, DefineWebWorkerInput, DefineWindowViewInput, MediaLibraryField, PanelViewDeclaration, TileViewDeclaration, ViewDeclaration, WebWorkerDeclaration, WindowViewDeclaration, defineApplication, defineApplication as unstable_defineApp, defineAssetSourceView, defineDashboard, definePanelView, defineTileView, defineWebWorker, defineWindowView, unstable_defineMediaLibrary } from "@sanity/workbench-cli";
|
|
6
6
|
/**
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
@@ -94,5 +94,5 @@ type CliClientGetter = ((options?: CliClientOptions) => SanityClient) & {
|
|
|
94
94
|
*/
|
|
95
95
|
__internal__getToken: () => string | undefined;
|
|
96
96
|
};
|
|
97
|
-
export { type AssetSourceViewDeclaration, type CliApiConfig, type CliClientOptions, type CliConfig, type DefineAppInput, type DefineAssetSourceViewInput, type DefineMediaLibraryInput, type DefinePanelViewInput, type DefineTileViewInput, type DefineWebWorkerInput, type DefineWindowViewInput, type GraphQLAPIConfig, type MediaLibraryField, type PanelViewDeclaration, type TileViewDeclaration, type UserViteConfig, type ViewDeclaration, type WebWorkerDeclaration, type WindowViewDeclaration, createCliConfig, defineApplication, defineAssetSourceView, defineCliConfig, definePanelView, defineTileView, defineWebWorker, defineWindowView, getCliClient, loadEnv, unstable_defineApp, unstable_defineMediaLibrary };
|
|
97
|
+
export { type AssetSourceViewDeclaration, type CliApiConfig, type CliClientOptions, type CliConfig, type DefineAppInput, type DefineAssetSourceViewInput, type DefineDashboardInput, type DefineMediaLibraryInput, type DefinePanelViewInput, type DefineTileViewInput, type DefineWebWorkerInput, type DefineWindowViewInput, type GraphQLAPIConfig, type MediaLibraryField, type PanelViewDeclaration, type TileViewDeclaration, type UserViteConfig, type ViewDeclaration, type WebWorkerDeclaration, type WindowViewDeclaration, createCliConfig, defineApplication, defineAssetSourceView, defineCliConfig, defineDashboard, definePanelView, defineTileView, defineWebWorker, defineWindowView, getCliClient, loadEnv, unstable_defineApp, unstable_defineMediaLibrary };
|
|
98
98
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/exports/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { createCliConfig } from '../config/createCliConfig.js';
|
|
|
2
2
|
export { defineCliConfig } from '../config/defineCliConfig.js';
|
|
3
3
|
export { getCliClient } from '../util/cliClient.js';
|
|
4
4
|
export { loadEnv } from '../util/loadEnv.js';
|
|
5
|
-
export { defineApplication, defineAssetSourceView, definePanelView, defineTileView, defineWebWorker, defineWindowView, // Older `sanity/cli` versions import this compatibility name from `@sanity/cli`.
|
|
5
|
+
export { defineApplication, defineAssetSourceView, defineDashboard, definePanelView, defineTileView, defineWebWorker, defineWindowView, // Older `sanity/cli` versions import this compatibility name from `@sanity/cli`.
|
|
6
6
|
defineApplication as unstable_defineApp, unstable_defineMediaLibrary } from '@sanity/workbench-cli';
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/index.ts"],"sourcesContent":["export type {GraphQLAPIConfig} from '../actions/graphql/types.js'\nexport {createCliConfig} from '../config/createCliConfig.js'\nexport {defineCliConfig} from '../config/defineCliConfig.js'\nexport type {CliApiConfig} from '../types.js'\nexport {type CliClientOptions, getCliClient} from '../util/cliClient.js'\nexport {loadEnv} from '../util/loadEnv.js'\nexport type {CliConfig, UserViteConfig} from '@sanity/cli-core'\n\nexport {\n type AssetSourceViewDeclaration,\n type DefineAppInput,\n defineApplication,\n defineAssetSourceView,\n type DefineAssetSourceViewInput,\n type DefineMediaLibraryInput,\n definePanelView,\n type DefinePanelViewInput,\n defineTileView,\n type DefineTileViewInput,\n defineWebWorker,\n type DefineWebWorkerInput,\n defineWindowView,\n type DefineWindowViewInput,\n type MediaLibraryField,\n type PanelViewDeclaration,\n type TileViewDeclaration,\n // Older `sanity/cli` versions import this compatibility name from `@sanity/cli`.\n defineApplication as unstable_defineApp,\n unstable_defineMediaLibrary,\n type ViewDeclaration,\n type WebWorkerDeclaration,\n type WindowViewDeclaration,\n} from '@sanity/workbench-cli'\n"],"names":["createCliConfig","defineCliConfig","getCliClient","loadEnv","defineApplication","defineAssetSourceView","definePanelView","defineTileView","defineWebWorker","defineWindowView","unstable_defineApp","unstable_defineMediaLibrary"],"mappings":"AACA,SAAQA,eAAe,QAAO,+BAA8B;AAC5D,SAAQC,eAAe,QAAO,+BAA8B;AAE5D,SAA+BC,YAAY,QAAO,uBAAsB;AACxE,SAAQC,OAAO,QAAO,qBAAoB;AAG1C,SAGEC,iBAAiB,EACjBC,qBAAqB,
|
|
1
|
+
{"version":3,"sources":["../../src/exports/index.ts"],"sourcesContent":["export type {GraphQLAPIConfig} from '../actions/graphql/types.js'\nexport {createCliConfig} from '../config/createCliConfig.js'\nexport {defineCliConfig} from '../config/defineCliConfig.js'\nexport type {CliApiConfig} from '../types.js'\nexport {type CliClientOptions, getCliClient} from '../util/cliClient.js'\nexport {loadEnv} from '../util/loadEnv.js'\nexport type {CliConfig, UserViteConfig} from '@sanity/cli-core'\n\nexport {\n type AssetSourceViewDeclaration,\n type DefineAppInput,\n defineApplication,\n defineAssetSourceView,\n type DefineAssetSourceViewInput,\n defineDashboard,\n type DefineDashboardInput,\n type DefineMediaLibraryInput,\n definePanelView,\n type DefinePanelViewInput,\n defineTileView,\n type DefineTileViewInput,\n defineWebWorker,\n type DefineWebWorkerInput,\n defineWindowView,\n type DefineWindowViewInput,\n type MediaLibraryField,\n type PanelViewDeclaration,\n type TileViewDeclaration,\n // Older `sanity/cli` versions import this compatibility name from `@sanity/cli`.\n defineApplication as unstable_defineApp,\n unstable_defineMediaLibrary,\n type ViewDeclaration,\n type WebWorkerDeclaration,\n type WindowViewDeclaration,\n} from '@sanity/workbench-cli'\n"],"names":["createCliConfig","defineCliConfig","getCliClient","loadEnv","defineApplication","defineAssetSourceView","defineDashboard","definePanelView","defineTileView","defineWebWorker","defineWindowView","unstable_defineApp","unstable_defineMediaLibrary"],"mappings":"AACA,SAAQA,eAAe,QAAO,+BAA8B;AAC5D,SAAQC,eAAe,QAAO,+BAA8B;AAE5D,SAA+BC,YAAY,QAAO,uBAAsB;AACxE,SAAQC,OAAO,QAAO,qBAAoB;AAG1C,SAGEC,iBAAiB,EACjBC,qBAAqB,EAErBC,eAAe,EAGfC,eAAe,EAEfC,cAAc,EAEdC,eAAe,EAEfC,gBAAgB,EAKhB,iFAAiF;AACjFN,qBAAqBO,kBAAkB,EACvCC,2BAA2B,QAItB,wBAAuB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AssetSource, AssetSourceComponentProps } from "@sanity/types";
|
|
2
|
-
import { AssetSourceComponent, AssetSourceViewComponents, DefinedService, DefinedView, PanelComponent, PanelViewComponents, PanelViewProps, ServiceBus, ServiceCallback, ServiceContext, ServiceInfo, ServiceType, TileComponent, TileSize, TileViewComponents, TileViewProps, ViewComponentsBySurface, ViewSurface, WebWorkerBus, WebWorkerInfo, WebWorkerProps, WebWorkerType, unstable_defineService, unstable_defineView } from "@sanity/workbench-cli";
|
|
3
|
-
export { type AssetSource, type AssetSourceComponent, type AssetSourceComponentProps, type AssetSourceViewComponents, type DefinedService, type DefinedView, type PanelComponent, type PanelViewComponents, type PanelViewProps, type ServiceBus, type ServiceCallback, type ServiceContext, type ServiceInfo, type ServiceType, type TileComponent, type TileSize, type TileViewComponents, type TileViewProps, type ViewComponentsBySurface, type ViewSurface, type WebWorkerBus, type WebWorkerInfo, type WebWorkerProps, type WebWorkerType, unstable_defineService, unstable_defineView };
|
|
2
|
+
import { AssetSourceComponent, AssetSourceViewComponents, DefinedService, DefinedView, PanelComponent, PanelViewComponents, PanelViewProps, ServiceBus, ServiceCallback, ServiceContext, ServiceInfo, ServiceType, TileComponent, TileSize, TileViewComponents, TileViewProps, ViewComponentsBySurface, ViewSurface, WebWorkerBus, WebWorkerInfo, WebWorkerProps, WebWorkerType, defineDashboardConfig, unstable_defineService, unstable_defineView } from "@sanity/workbench-cli";
|
|
3
|
+
export { type AssetSource, type AssetSourceComponent, type AssetSourceComponentProps, type AssetSourceViewComponents, type DefinedService, type DefinedView, type PanelComponent, type PanelViewComponents, type PanelViewProps, type ServiceBus, type ServiceCallback, type ServiceContext, type ServiceInfo, type ServiceType, type TileComponent, type TileSize, type TileViewComponents, type TileViewProps, type ViewComponentsBySurface, type ViewSurface, type WebWorkerBus, type WebWorkerInfo, type WebWorkerProps, type WebWorkerType, defineDashboardConfig, unstable_defineService, unstable_defineView };
|
package/dist/exports/runtime.js
CHANGED
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
//
|
|
9
9
|
// `defineApplication` is config-time (Node) and stays on the main `@sanity/cli`
|
|
10
10
|
// entry; only the runtime helpers live here.
|
|
11
|
-
export { unstable_defineService, unstable_defineView } from '@sanity/workbench-cli';
|
|
11
|
+
export { defineDashboardConfig, unstable_defineService, unstable_defineView } from '@sanity/workbench-cli';
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/runtime.ts"],"sourcesContent":["// Browser-safe runtime authoring helpers for the module-federation extension API.\n//\n// View/web worker src files bundle to the browser, so this entry re-exports ONLY\n// from dependency-light, browser-safe modules — it must never import\n// `@sanity/cli-core` or anything Node-only, or it would drag the CLI into the\n// frontend bundle. The `sanity` runtime package re-exports from here, so the\n// same constraint protects it.\n//\n// `defineApplication` is config-time (Node) and stays on the main `@sanity/cli`\n// entry; only the runtime helpers live here.\nexport type {AssetSource, AssetSourceComponentProps} from '@sanity/types'\nexport type {\n AssetSourceComponent,\n AssetSourceViewComponents,\n DefinedService,\n DefinedView,\n PanelComponent,\n PanelViewComponents,\n PanelViewProps,\n ServiceBus,\n ServiceCallback,\n ServiceContext,\n ServiceInfo,\n ServiceType,\n TileComponent,\n TileSize,\n TileViewComponents,\n TileViewProps,\n ViewComponentsBySurface,\n ViewSurface,\n WebWorkerBus,\n WebWorkerInfo,\n WebWorkerProps,\n WebWorkerType,\n} from '@sanity/workbench-cli'\nexport {unstable_defineService
|
|
1
|
+
{"version":3,"sources":["../../src/exports/runtime.ts"],"sourcesContent":["// Browser-safe runtime authoring helpers for the module-federation extension API.\n//\n// View/web worker src files bundle to the browser, so this entry re-exports ONLY\n// from dependency-light, browser-safe modules — it must never import\n// `@sanity/cli-core` or anything Node-only, or it would drag the CLI into the\n// frontend bundle. The `sanity` runtime package re-exports from here, so the\n// same constraint protects it.\n//\n// `defineApplication` is config-time (Node) and stays on the main `@sanity/cli`\n// entry; only the runtime helpers live here.\nexport type {AssetSource, AssetSourceComponentProps} from '@sanity/types'\nexport type {\n AssetSourceComponent,\n AssetSourceViewComponents,\n DefinedService,\n DefinedView,\n PanelComponent,\n PanelViewComponents,\n PanelViewProps,\n ServiceBus,\n ServiceCallback,\n ServiceContext,\n ServiceInfo,\n ServiceType,\n TileComponent,\n TileSize,\n TileViewComponents,\n TileViewProps,\n ViewComponentsBySurface,\n ViewSurface,\n WebWorkerBus,\n WebWorkerInfo,\n WebWorkerProps,\n WebWorkerType,\n} from '@sanity/workbench-cli'\nexport {\n defineDashboardConfig,\n unstable_defineService,\n unstable_defineView,\n} from '@sanity/workbench-cli'\n"],"names":["defineDashboardConfig","unstable_defineService","unstable_defineView"],"mappings":"AAAA,kFAAkF;AAClF,EAAE;AACF,iFAAiF;AACjF,qEAAqE;AACrE,8EAA8E;AAC9E,6EAA6E;AAC7E,+BAA+B;AAC/B,EAAE;AACF,gFAAgF;AAChF,6CAA6C;AA0B7C,SACEA,qBAAqB,EACrBC,sBAAsB,EACtBC,mBAAmB,QACd,wBAAuB"}
|
|
@@ -241,6 +241,43 @@
|
|
|
241
241
|
slug: 'content-agent',
|
|
242
242
|
title: 'Content Agent API reference'
|
|
243
243
|
},
|
|
244
|
+
{
|
|
245
|
+
host: 'global',
|
|
246
|
+
pathPatterns: [
|
|
247
|
+
'context/knowledge-bases',
|
|
248
|
+
'context/knowledge-bases/{knowledgeBaseId}',
|
|
249
|
+
'context/knowledge-bases/{knowledgeBaseId}/apply',
|
|
250
|
+
'context/knowledge-bases/{knowledgeBaseId}/build',
|
|
251
|
+
'context/knowledge-bases/{knowledgeBaseId}/build/cancel',
|
|
252
|
+
'context/knowledge-bases/{knowledgeBaseId}/discard',
|
|
253
|
+
'context/knowledge-bases/{knowledgeBaseId}/documents',
|
|
254
|
+
'context/knowledge-bases/{knowledgeBaseId}/documents/{documentId}',
|
|
255
|
+
'context/knowledge-bases/{knowledgeBaseId}/documents/{documentId}/content',
|
|
256
|
+
'context/knowledge-bases/{knowledgeBaseId}/entries/{entryPath}/rebuild',
|
|
257
|
+
'context/knowledge-bases/{knowledgeBaseId}/instructions',
|
|
258
|
+
'context/knowledge-bases/{knowledgeBaseId}/instructions/check',
|
|
259
|
+
'context/knowledge-bases/{knowledgeBaseId}/instructions/draft',
|
|
260
|
+
'context/knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}',
|
|
261
|
+
'context/knowledge-bases/{knowledgeBaseId}/issues/apply',
|
|
262
|
+
'context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/dismiss',
|
|
263
|
+
'context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/reopen',
|
|
264
|
+
'context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve',
|
|
265
|
+
'context/knowledge-bases/{knowledgeBaseId}/jobs/{jobId}',
|
|
266
|
+
'context/knowledge-bases/{knowledgeBaseId}/sources',
|
|
267
|
+
'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',
|
|
268
|
+
'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs',
|
|
269
|
+
'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}',
|
|
270
|
+
'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/uploads',
|
|
271
|
+
'context/knowledge-bases/{knowledgeBaseId}/sync',
|
|
272
|
+
'context/organizations/{organizationId}/conversations/{threadId}',
|
|
273
|
+
'context/organizations/{organizationId}/mcp',
|
|
274
|
+
'context/organizations/{organizationId}/mcp/{mcpEndpoint}',
|
|
275
|
+
'context/organizations/{organizationId}/mcp/{mcpEndpoint}/initial-context',
|
|
276
|
+
'context/organizations/{organizationId}/mcp/{mcpEndpoint}/status'
|
|
277
|
+
],
|
|
278
|
+
slug: 'context-api',
|
|
279
|
+
title: 'Context API reference'
|
|
280
|
+
},
|
|
244
281
|
{
|
|
245
282
|
defaultApiVersion: 'v2025-02-19',
|
|
246
283
|
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/dashboards',\n 'applications/dashboards/{dashboardId}',\n 'applications/dashboards/{dashboardId}/configs',\n 'applications/dashboards/{dashboardId}/configs/{configId}',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/embeddable',\n 'applications/{applicationId}/icon',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/interfaces/{interfaceId}/icon',\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 'organizations/{organizationId}/applications/{applicationId}',\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/dashboards',\n 'applications/dashboards/{dashboardId}',\n 'applications/dashboards/{dashboardId}/configs',\n 'applications/dashboards/{dashboardId}/configs/{configId}',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/embeddable',\n 'applications/{applicationId}/icon',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/interfaces/{interfaceId}/icon',\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 'organizations/{organizationId}/applications/{applicationId}',\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 'collaboration/comments',\n 'collaboration/comments/listen',\n 'collaboration/comments/query',\n 'collaboration/comments/{id}',\n 'collaboration/comments/{id}/reactions',\n 'collaboration/comments/{id}/reactions/{shortName}'\n ],\n slug: 'comments-api',\n title: 'Comments API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'collaboration/comments',\n 'collaboration/comments/listen',\n 'collaboration/comments/query',\n 'collaboration/comments/{id}',\n 'collaboration/comments/{id}/reactions',\n 'collaboration/comments/{id}/reactions/{shortName}'\n ],\n slug: 'comments-api',\n title: 'Comments 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/copy',\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: 'v2025-02-19',\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/durables/callback/{callbackId}/failure',\n 'functions/durables/callback/{callbackId}/success',\n 'functions/durables/{functionId}/executions',\n 'functions/durables/{functionId}/executions/{executionId}',\n 'functions/durables/{functionId}/executions/{executionId}/stop',\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-09-09',\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/copy',\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 'auth/organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{projectUserId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/grants/{projectUserId}',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/permissionResources',\n 'projects/{projectId}/permissionResources/{resourceId}',\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-09-01',\n host: 'global',\n pathPatterns: [\n 'usage/{resourceType}/{resourceId}/history',\n 'usage/{resourceType}/{resourceId}/snapshot',\n 'usage/{resourceType}/{resourceId}/{scope}/history',\n 'usage/{resourceType}/{resourceId}/{scope}/snapshot'\n ],\n slug: 'usage-api',\n title: 'Usage 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}/attempts/{attemptId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/projects/{projectId}/{id}/messages',\n 'hooks/projects/{projectId}/{id}/messages/{messageId}/attempts'\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;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;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;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;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;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;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;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;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;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;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/dashboards',\n 'applications/dashboards/{dashboardId}',\n 'applications/dashboards/{dashboardId}/configs',\n 'applications/dashboards/{dashboardId}/configs/{configId}',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/embeddable',\n 'applications/{applicationId}/icon',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/interfaces/{interfaceId}/icon',\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 'organizations/{organizationId}/applications/{applicationId}',\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/dashboards',\n 'applications/dashboards/{dashboardId}',\n 'applications/dashboards/{dashboardId}/configs',\n 'applications/dashboards/{dashboardId}/configs/{configId}',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/embeddable',\n 'applications/{applicationId}/icon',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/interfaces/{interfaceId}/icon',\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 'organizations/{organizationId}/applications/{applicationId}',\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 'collaboration/comments',\n 'collaboration/comments/listen',\n 'collaboration/comments/query',\n 'collaboration/comments/{id}',\n 'collaboration/comments/{id}/reactions',\n 'collaboration/comments/{id}/reactions/{shortName}'\n ],\n slug: 'comments-api',\n title: 'Comments API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'collaboration/comments',\n 'collaboration/comments/listen',\n 'collaboration/comments/query',\n 'collaboration/comments/{id}',\n 'collaboration/comments/{id}/reactions',\n 'collaboration/comments/{id}/reactions/{shortName}'\n ],\n slug: 'comments-api',\n title: 'Comments 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 host: 'global',\n pathPatterns: [\n 'context/knowledge-bases',\n 'context/knowledge-bases/{knowledgeBaseId}',\n 'context/knowledge-bases/{knowledgeBaseId}/apply',\n 'context/knowledge-bases/{knowledgeBaseId}/build',\n 'context/knowledge-bases/{knowledgeBaseId}/build/cancel',\n 'context/knowledge-bases/{knowledgeBaseId}/discard',\n 'context/knowledge-bases/{knowledgeBaseId}/documents',\n 'context/knowledge-bases/{knowledgeBaseId}/documents/{documentId}',\n 'context/knowledge-bases/{knowledgeBaseId}/documents/{documentId}/content',\n 'context/knowledge-bases/{knowledgeBaseId}/entries/{entryPath}/rebuild',\n 'context/knowledge-bases/{knowledgeBaseId}/instructions',\n 'context/knowledge-bases/{knowledgeBaseId}/instructions/check',\n 'context/knowledge-bases/{knowledgeBaseId}/instructions/draft',\n 'context/knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}',\n 'context/knowledge-bases/{knowledgeBaseId}/issues/apply',\n 'context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/dismiss',\n 'context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/reopen',\n 'context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve',\n 'context/knowledge-bases/{knowledgeBaseId}/jobs/{jobId}',\n 'context/knowledge-bases/{knowledgeBaseId}/sources',\n 'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',\n 'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs',\n 'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}',\n 'context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/uploads',\n 'context/knowledge-bases/{knowledgeBaseId}/sync',\n 'context/organizations/{organizationId}/conversations/{threadId}',\n 'context/organizations/{organizationId}/mcp',\n 'context/organizations/{organizationId}/mcp/{mcpEndpoint}',\n 'context/organizations/{organizationId}/mcp/{mcpEndpoint}/initial-context',\n 'context/organizations/{organizationId}/mcp/{mcpEndpoint}/status'\n ],\n slug: 'context-api',\n title: 'Context API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/copy',\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: 'v2025-02-19',\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/durables/callback/{callbackId}/failure',\n 'functions/durables/callback/{callbackId}/success',\n 'functions/durables/{functionId}/executions',\n 'functions/durables/{functionId}/executions/{executionId}',\n 'functions/durables/{functionId}/executions/{executionId}/stop',\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-09-09',\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/copy',\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 'auth/organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{projectUserId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/grants/{projectUserId}',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/permissionResources',\n 'projects/{projectId}/permissionResources/{resourceId}',\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-09-01',\n host: 'global',\n pathPatterns: [\n 'usage/{resourceType}/{resourceId}/history',\n 'usage/{resourceType}/{resourceId}/snapshot',\n 'usage/{resourceType}/{resourceId}/{scope}/history',\n 'usage/{resourceType}/{resourceId}/{scope}/snapshot'\n ],\n slug: 'usage-api',\n title: 'Usage 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}/attempts/{attemptId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/projects/{projectId}/{id}/messages',\n 'hooks/projects/{projectId}/{id}/messages/{messageId}/attempts'\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;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;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;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;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;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;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;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;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;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;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;CACD,CAAA"}
|
|
@@ -14,18 +14,24 @@ const debug = subdebug('prompt:project');
|
|
|
14
14
|
if (!isInteractive()) {
|
|
15
15
|
throw new NonInteractiveError('select');
|
|
16
16
|
}
|
|
17
|
-
const { requiredPermissions } = options;
|
|
17
|
+
const { organizationId, requiredPermissions } = options;
|
|
18
18
|
debug('Fetching projects and grants');
|
|
19
19
|
const spin = spinner('Fetching available projects').start();
|
|
20
|
-
const [
|
|
21
|
-
listProjects(
|
|
20
|
+
const [availableProjects, grants] = await Promise.all([
|
|
21
|
+
organizationId ? listProjects({
|
|
22
|
+
onlyExplicitMembership: false
|
|
23
|
+
}) : listProjects(),
|
|
22
24
|
requiredPermissions ? getUserGrants() : undefined
|
|
23
25
|
]).catch((error)=>{
|
|
24
26
|
spin.fail(requiredPermissions ? 'Failed to fetch projects or permissions' : 'Failed to fetch projects');
|
|
25
27
|
throw error;
|
|
26
28
|
});
|
|
29
|
+
const projects = organizationId ? availableProjects.filter((project)=>project.organizationId === organizationId) : availableProjects;
|
|
27
30
|
if (projects.length === 0) {
|
|
28
31
|
spin.fail('No projects found');
|
|
32
|
+
if (organizationId) {
|
|
33
|
+
throw new Error(`No accessible projects found in organization ${organizationId}. Try again with \`--project <project-id>\`.`);
|
|
34
|
+
}
|
|
29
35
|
throw new Error('No projects found. Create a project at https://www.sanity.io/manage');
|
|
30
36
|
}
|
|
31
37
|
spin.succeed();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/prompts/promptForProject.ts"],"sourcesContent":["import {isInteractive, NonInteractiveError, subdebug} from '@sanity/cli-core'\nimport {select, Separator, spinner} from '@sanity/cli-core/ux'\n\nimport {getUserGrants} from '../services/grants.js'\nimport {listProjects} from '../services/projects.js'\nimport {type RequiredPermission} from '../types/grants.js'\nimport {getProjectsWithPermissions} from '../util/checkProjectPermissions.js'\n\nconst debug = subdebug('prompt:project')\n\ninterface PromptForProjectOptions {\n requiredPermissions?: RequiredPermission[]\n}\n\n/**\n * Prompt the user to select a project from their available projects.\n *\n * When `requiredPermissions` is provided, projects are filtered by grants:\n * only permitted projects are shown as selectable, with a single disabled\n * summary item indicating how many projects were hidden due to insufficient permissions.\n */\nexport async function promptForProject(options: PromptForProjectOptions = {}): Promise<string> {\n if (!isInteractive()) {\n throw new NonInteractiveError('select')\n }\n\n const {requiredPermissions} = options\n\n debug('Fetching projects and grants')\n const spin = spinner('Fetching available projects').start()\n\n const [
|
|
1
|
+
{"version":3,"sources":["../../src/prompts/promptForProject.ts"],"sourcesContent":["import {isInteractive, NonInteractiveError, subdebug} from '@sanity/cli-core'\nimport {select, Separator, spinner} from '@sanity/cli-core/ux'\n\nimport {getUserGrants} from '../services/grants.js'\nimport {listProjects} from '../services/projects.js'\nimport {type RequiredPermission} from '../types/grants.js'\nimport {getProjectsWithPermissions} from '../util/checkProjectPermissions.js'\n\nconst debug = subdebug('prompt:project')\n\ninterface PromptForProjectOptions {\n organizationId?: string\n requiredPermissions?: RequiredPermission[]\n}\n\n/**\n * Prompt the user to select a project from their available projects.\n *\n * When `requiredPermissions` is provided, projects are filtered by grants:\n * only permitted projects are shown as selectable, with a single disabled\n * summary item indicating how many projects were hidden due to insufficient permissions.\n */\nexport async function promptForProject(options: PromptForProjectOptions = {}): Promise<string> {\n if (!isInteractive()) {\n throw new NonInteractiveError('select')\n }\n\n const {organizationId, requiredPermissions} = options\n\n debug('Fetching projects and grants')\n const spin = spinner('Fetching available projects').start()\n\n const [availableProjects, grants] = await Promise.all([\n organizationId ? listProjects({onlyExplicitMembership: false}) : listProjects(),\n requiredPermissions ? getUserGrants() : undefined,\n ]).catch((error) => {\n spin.fail(\n requiredPermissions ? 'Failed to fetch projects or permissions' : 'Failed to fetch projects',\n )\n throw error\n })\n\n const projects = organizationId\n ? availableProjects.filter((project) => project.organizationId === organizationId)\n : availableProjects\n if (projects.length === 0) {\n spin.fail('No projects found')\n if (organizationId) {\n throw new Error(\n `No accessible projects found in organization ${organizationId}. Try again with \\`--project <project-id>\\`.`,\n )\n }\n throw new Error('No projects found. Create a project at https://www.sanity.io/manage')\n }\n\n spin.succeed()\n\n const permittedIds =\n grants && requiredPermissions\n ? getProjectsWithPermissions(grants, requiredPermissions)\n : undefined\n\n const sorted = projects.toSorted((a, b) => b.createdAt.localeCompare(a.createdAt))\n\n const choices: Array<Separator | {disabled?: string; name: string; value: string}> = []\n let insufficientCount = 0\n\n for (const project of sorted) {\n const label = `${project.displayName} (${project.id})`\n if (permittedIds && !permittedIds.has(project.id)) {\n insufficientCount++\n } else {\n choices.push({name: label, value: project.id})\n }\n }\n\n if (insufficientCount > 0) {\n if (choices.length === 0) {\n throw new Error('None of your projects have sufficient permissions for this operation')\n }\n\n const suffix = insufficientCount === 1 ? 'project' : 'projects'\n choices.push(new Separator(), {\n disabled: '(insufficient permissions)',\n name: `${insufficientCount} other ${suffix} hidden`,\n value: '',\n })\n }\n\n return select({\n choices,\n message: 'Select project',\n })\n}\n"],"names":["isInteractive","NonInteractiveError","subdebug","select","Separator","spinner","getUserGrants","listProjects","getProjectsWithPermissions","debug","promptForProject","options","organizationId","requiredPermissions","spin","start","availableProjects","grants","Promise","all","onlyExplicitMembership","undefined","catch","error","fail","projects","filter","project","length","Error","succeed","permittedIds","sorted","toSorted","a","b","createdAt","localeCompare","choices","insufficientCount","label","displayName","id","has","push","name","value","suffix","disabled","message"],"mappings":"AAAA,SAAQA,aAAa,EAAEC,mBAAmB,EAAEC,QAAQ,QAAO,mBAAkB;AAC7E,SAAQC,MAAM,EAAEC,SAAS,EAAEC,OAAO,QAAO,sBAAqB;AAE9D,SAAQC,aAAa,QAAO,wBAAuB;AACnD,SAAQC,YAAY,QAAO,0BAAyB;AAEpD,SAAQC,0BAA0B,QAAO,qCAAoC;AAE7E,MAAMC,QAAQP,SAAS;AAOvB;;;;;;CAMC,GACD,OAAO,eAAeQ,iBAAiBC,UAAmC,CAAC,CAAC;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EA,IAAIH,oBAAoB,GAAG;QACzB,IAAID,QAAQV,MAAM,KAAK,GAAG;YACxB,MAAM,IAAIC,MAAM;QAClB;QAEA,MAAMkB,SAASR,sBAAsB,IAAI,YAAY;QACrDD,QAAQM,IAAI,CAAC,IAAIxC,aAAa;YAC5B4C,UAAU;YACVH,MAAM,GAAGN,kBAAkB,OAAO,EAAEQ,OAAO,OAAO,CAAC;YACnDD,OAAO;QACT;IACF;IAEA,OAAO3C,OAAO;QACZmC;QACAW,SAAS;IACX;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DEFAULT_BLUEPRINTS_API_VERSION } from '@sanity/blueprints/resolve';
|
|
2
|
+
import { getGlobalCliClient } from '@sanity/cli-core';
|
|
3
|
+
export async function getDeployedStack({ scopeId, scopeType, stackId }) {
|
|
4
|
+
const client = await getGlobalCliClient({
|
|
5
|
+
apiVersion: process.env.SANITY_BLUEPRINTS_API_VERSION ?? DEFAULT_BLUEPRINTS_API_VERSION,
|
|
6
|
+
maxRetries: 0,
|
|
7
|
+
requireUser: true
|
|
8
|
+
});
|
|
9
|
+
return client.request({
|
|
10
|
+
headers: {
|
|
11
|
+
'x-sanity-scope-id': scopeId,
|
|
12
|
+
'x-sanity-scope-type': scopeType
|
|
13
|
+
},
|
|
14
|
+
url: `/blueprints/stacks/${encodeURIComponent(stackId)}`
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=blueprints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/blueprints.ts"],"sourcesContent":["import {\n DEFAULT_BLUEPRINTS_API_VERSION,\n type DeployedStack,\n type ScopeType,\n} from '@sanity/blueprints/resolve'\nimport {getGlobalCliClient} from '@sanity/cli-core'\n\nexport async function getDeployedStack({\n scopeId,\n scopeType,\n stackId,\n}: {\n scopeId: string\n scopeType: ScopeType\n stackId: string\n}): Promise<DeployedStack> {\n const client = await getGlobalCliClient({\n apiVersion: process.env.SANITY_BLUEPRINTS_API_VERSION ?? DEFAULT_BLUEPRINTS_API_VERSION,\n maxRetries: 0,\n requireUser: true,\n })\n return client.request<DeployedStack>({\n headers: {'x-sanity-scope-id': scopeId, 'x-sanity-scope-type': scopeType},\n url: `/blueprints/stacks/${encodeURIComponent(stackId)}`,\n })\n}\n"],"names":["DEFAULT_BLUEPRINTS_API_VERSION","getGlobalCliClient","getDeployedStack","scopeId","scopeType","stackId","client","apiVersion","process","env","SANITY_BLUEPRINTS_API_VERSION","maxRetries","requireUser","request","headers","url","encodeURIComponent"],"mappings":"AAAA,SACEA,8BAA8B,QAGzB,6BAA4B;AACnC,SAAQC,kBAAkB,QAAO,mBAAkB;AAEnD,OAAO,eAAeC,iBAAiB,EACrCC,OAAO,EACPC,SAAS,EACTC,OAAO,EAKR;IACC,MAAMC,SAAS,MAAML,mBAAmB;QACtCM,YAAYC,QAAQC,GAAG,CAACC,6BAA6B,IAAIV;QACzDW,YAAY;QACZC,aAAa;IACf;IACA,OAAON,OAAOO,OAAO,CAAgB;QACnCC,SAAS;YAAC,qBAAqBX;YAAS,uBAAuBC;QAAS;QACxEW,KAAK,CAAC,mBAAmB,EAAEC,mBAAmBX,UAAU;IAC1D;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
import { BLUEPRINT_FILE_NAMES, readStackConfigFile } from '@sanity/blueprints/resolve';
|
|
4
|
+
import { getCliExecutionContext } from '@sanity/cli-core/executionContext';
|
|
5
|
+
export function getCheckoutBlueprint(cwd = process.cwd()) {
|
|
6
|
+
if (getCliExecutionContext()) return;
|
|
7
|
+
let directory = resolve(cwd);
|
|
8
|
+
while(true){
|
|
9
|
+
const link = readStackConfigFile(directory);
|
|
10
|
+
if (link?.stackId && link.projectId) {
|
|
11
|
+
return {
|
|
12
|
+
scopeId: link.projectId,
|
|
13
|
+
scopeType: 'project',
|
|
14
|
+
stackId: link.stackId
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (link?.stackId && link.organizationId) {
|
|
18
|
+
return {
|
|
19
|
+
scopeId: link.organizationId,
|
|
20
|
+
scopeType: 'organization',
|
|
21
|
+
stackId: link.stackId
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const parent = dirname(directory);
|
|
25
|
+
// An unlinked Blueprint or nested checkout must not inherit a parent's Stack.
|
|
26
|
+
if (link || directory === parent || existsSync(join(directory, '.git')) || BLUEPRINT_FILE_NAMES.some((name)=>existsSync(join(directory, name)))) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
directory = parent;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=checkoutBlueprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/util/checkoutBlueprint.ts"],"sourcesContent":["import {existsSync} from 'node:fs'\nimport {dirname, join, resolve} from 'node:path'\n\nimport {BLUEPRINT_FILE_NAMES, readStackConfigFile, type ScopeType} from '@sanity/blueprints/resolve'\nimport {getCliExecutionContext} from '@sanity/cli-core/executionContext'\n\nexport interface CheckoutStack {\n scopeId: string\n scopeType: ScopeType\n stackId: string\n}\n\nexport function getCheckoutBlueprint(cwd = process.cwd()): CheckoutStack | undefined {\n if (getCliExecutionContext()) return\n\n let directory = resolve(cwd)\n while (true) {\n const link = readStackConfigFile(directory)\n if (link?.stackId && link.projectId) {\n return {scopeId: link.projectId, scopeType: 'project', stackId: link.stackId}\n }\n if (link?.stackId && link.organizationId) {\n return {scopeId: link.organizationId, scopeType: 'organization', stackId: link.stackId}\n }\n\n const parent = dirname(directory)\n // An unlinked Blueprint or nested checkout must not inherit a parent's Stack.\n if (\n link ||\n directory === parent ||\n existsSync(join(directory, '.git')) ||\n BLUEPRINT_FILE_NAMES.some((name) => existsSync(join(directory, name)))\n ) {\n return\n }\n directory = parent\n }\n}\n"],"names":["existsSync","dirname","join","resolve","BLUEPRINT_FILE_NAMES","readStackConfigFile","getCliExecutionContext","getCheckoutBlueprint","cwd","process","directory","link","stackId","projectId","scopeId","scopeType","organizationId","parent","some","name"],"mappings":"AAAA,SAAQA,UAAU,QAAO,UAAS;AAClC,SAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,QAAO,YAAW;AAEhD,SAAQC,oBAAoB,EAAEC,mBAAmB,QAAuB,6BAA4B;AACpG,SAAQC,sBAAsB,QAAO,oCAAmC;AAQxE,OAAO,SAASC,qBAAqBC,MAAMC,QAAQD,GAAG,EAAE;IACtD,IAAIF,0BAA0B;IAE9B,IAAII,YAAYP,QAAQK;IACxB,MAAO,KAAM;QACX,MAAMG,OAAON,oBAAoBK;QACjC,IAAIC,MAAMC,WAAWD,KAAKE,SAAS,EAAE;YACnC,OAAO;gBAACC,SAASH,KAAKE,SAAS;gBAAEE,WAAW;gBAAWH,SAASD,KAAKC,OAAO;YAAA;QAC9E;QACA,IAAID,MAAMC,WAAWD,KAAKK,cAAc,EAAE;YACxC,OAAO;gBAACF,SAASH,KAAKK,cAAc;gBAAED,WAAW;gBAAgBH,SAASD,KAAKC,OAAO;YAAA;QACxF;QAEA,MAAMK,SAAShB,QAAQS;QACvB,8EAA8E;QAC9E,IACEC,QACAD,cAAcO,UACdjB,WAAWE,KAAKQ,WAAW,YAC3BN,qBAAqBc,IAAI,CAAC,CAACC,OAASnB,WAAWE,KAAKQ,WAAWS,SAC/D;YACA;QACF;QACAT,YAAYO;IACd;AACF"}
|
package/dist/util/sharedFlags.js
CHANGED
|
@@ -78,5 +78,15 @@ const OVERRIDE_SUFFIX = ' (overrides CLI configuration)';
|
|
|
78
78
|
})
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Opt in to Blueprint-aware behavior for this invocation.
|
|
83
|
+
*/ export function getWithBlueprintsFlag() {
|
|
84
|
+
return {
|
|
85
|
+
'with-blueprints': Flags.boolean({
|
|
86
|
+
description: 'Use Blueprint-aware behavior',
|
|
87
|
+
hidden: true
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
}
|
|
81
91
|
|
|
82
92
|
//# sourceMappingURL=sharedFlags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/sharedFlags.ts"],"sourcesContent":["import {Flags} from '@oclif/core'\n\n/**\n * Controls how the flag relates to CLI configuration:\n *\n * - `'override'` — The command falls back to CLI config (sanity.cli.ts) when the flag is not\n * provided. The flag description automatically gets an \" (overrides CLI configuration)\" suffix,\n * and `helpGroup` defaults to `'OVERRIDE'`.\n *\n * - `'specify'` — The command does NOT fall back to CLI config; the flag is simply how the user\n * provides the value. No suffix is appended, and no default `helpGroup` is set.\n */\ntype FlagSemantics = 'override' | 'specify'\n\n/**\n * Options accepted by the shared flag getters.\n * Locked properties (char, parse, name, helpValue) are excluded to ensure\n * consistent behavior across all commands.\n */\ninterface SharedFlagOptions {\n /**\n * Controls description suffix and default helpGroup.\n * @see {@link FlagSemantics}\n */\n semantics: FlagSemantics\n\n atLeastOne?: string[]\n dependsOn?: string[]\n description?: string\n env?: string\n exclusive?: string[]\n helpGroup?: string\n hidden?: boolean\n required?: boolean\n}\n\nconst OVERRIDE_SUFFIX = ' (overrides CLI configuration)'\n\n/**\n * Returns a `--project` / `-p` flag definition with a deprecated `--project-id` alias.\n *\n * Locked: flag name (`project`), char (`p`), `helpValue` (`<id>`), and parse (trims + validates non-empty).\n */\nexport function getProjectIdFlag(options: SharedFlagOptions) {\n const {description: baseDescription, helpGroup, semantics, ...rest} = options\n const isOverride = semantics === 'override'\n const description = (baseDescription ?? 'Project ID to use') + (isOverride ? OVERRIDE_SUFFIX : '')\n\n return {\n project: Flags.string({\n aliases: ['project-id'],\n deprecateAliases: true,\n description,\n helpGroup: helpGroup ?? (isOverride ? 'OVERRIDE' : undefined),\n helpValue: '<id>',\n ...rest,\n char: 'p',\n parse: async (input: string) => {\n const trimmed = input.trim()\n if (trimmed === '') {\n throw new Error('`--project` cannot be empty if provided')\n }\n return trimmed\n },\n }),\n }\n}\n\n/**\n * Returns an `--organization` flag definition.\n *\n * Locked: flag name (`organization`), `helpValue` (`<id>`), and parse (trims + validates non-empty).\n */\nexport function getOrganizationFlag(options: SharedFlagOptions) {\n const {description: baseDescription, helpGroup, semantics, ...rest} = options\n const isOverride = semantics === 'override'\n const description =\n (baseDescription ?? 'Organization ID to use') + (isOverride ? OVERRIDE_SUFFIX : '')\n\n return {\n organization: Flags.string({\n description,\n helpGroup: helpGroup ?? (isOverride ? 'OVERRIDE' : undefined),\n helpValue: '<id>',\n ...rest,\n parse: async (input: string) => {\n const trimmed = input.trim()\n if (trimmed === '') {\n throw new Error('`--organization` cannot be empty if provided')\n }\n return trimmed\n },\n }),\n }\n}\n\n/**\n * Returns a `--dataset` / `-d` flag definition.\n *\n * Locked: flag name (`dataset`), char (`d`), `helpValue` (`<name>`), and parse (trims + validates non-empty).\n */\nexport function getDatasetFlag(options: SharedFlagOptions) {\n const {description: baseDescription, helpGroup, semantics, ...rest} = options\n const isOverride = semantics === 'override'\n const description = (baseDescription ?? 'Dataset to use') + (isOverride ? OVERRIDE_SUFFIX : '')\n\n return {\n dataset: Flags.string({\n description,\n helpGroup: helpGroup ?? (isOverride ? 'OVERRIDE' : undefined),\n helpValue: '<name>',\n ...rest,\n char: 'd',\n parse: async (input: string) => {\n const trimmed = input.trim()\n if (trimmed === '') {\n throw new Error('`--dataset` cannot be empty if provided')\n }\n return trimmed\n },\n }),\n }\n}\n"],"names":["Flags","OVERRIDE_SUFFIX","getProjectIdFlag","options","description","baseDescription","helpGroup","semantics","rest","isOverride","project","string","aliases","deprecateAliases","undefined","helpValue","char","parse","input","trimmed","trim","Error","getOrganizationFlag","organization","getDatasetFlag","dataset"],"mappings":"AAAA,SAAQA,KAAK,QAAO,cAAa;AAoCjC,MAAMC,kBAAkB;AAExB;;;;CAIC,GACD,OAAO,SAASC,iBAAiBC,OAA0B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AAc,AAACC,CAAAA,mBAAmB,gBAAe,IAAMI,CAAAA,aAAaR,kBAAkB,EAAC;IAE7F,OAAO;QACLwB,SAASzB,MAAMW,MAAM,CAAC;YACpBP;YACAE,WAAWA,aAAcG,CAAAA,aAAa,aAAaK,SAAQ;YAC3DC,WAAW;YACX,GAAGP,IAAI;YACPQ,MAAM;YACNC,OAAO,OAAOC;gBACZ,MAAMC,UAAUD,MAAME,IAAI;gBAC1B,IAAID,YAAY,IAAI;oBAClB,MAAM,IAAIE,MAAM;gBAClB;gBACA,OAAOF;YACT;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/util/sharedFlags.ts"],"sourcesContent":["import {Flags} from '@oclif/core'\n\n/**\n * Controls how the flag relates to CLI configuration:\n *\n * - `'override'` — The command falls back to CLI config (sanity.cli.ts) when the flag is not\n * provided. The flag description automatically gets an \" (overrides CLI configuration)\" suffix,\n * and `helpGroup` defaults to `'OVERRIDE'`.\n *\n * - `'specify'` — The command does NOT fall back to CLI config; the flag is simply how the user\n * provides the value. No suffix is appended, and no default `helpGroup` is set.\n */\ntype FlagSemantics = 'override' | 'specify'\n\n/**\n * Options accepted by the shared flag getters.\n * Locked properties (char, parse, name, helpValue) are excluded to ensure\n * consistent behavior across all commands.\n */\ninterface SharedFlagOptions {\n /**\n * Controls description suffix and default helpGroup.\n * @see {@link FlagSemantics}\n */\n semantics: FlagSemantics\n\n atLeastOne?: string[]\n dependsOn?: string[]\n description?: string\n env?: string\n exclusive?: string[]\n helpGroup?: string\n hidden?: boolean\n required?: boolean\n}\n\nconst OVERRIDE_SUFFIX = ' (overrides CLI configuration)'\n\n/**\n * Returns a `--project` / `-p` flag definition with a deprecated `--project-id` alias.\n *\n * Locked: flag name (`project`), char (`p`), `helpValue` (`<id>`), and parse (trims + validates non-empty).\n */\nexport function getProjectIdFlag(options: SharedFlagOptions) {\n const {description: baseDescription, helpGroup, semantics, ...rest} = options\n const isOverride = semantics === 'override'\n const description = (baseDescription ?? 'Project ID to use') + (isOverride ? OVERRIDE_SUFFIX : '')\n\n return {\n project: Flags.string({\n aliases: ['project-id'],\n deprecateAliases: true,\n description,\n helpGroup: helpGroup ?? (isOverride ? 'OVERRIDE' : undefined),\n helpValue: '<id>',\n ...rest,\n char: 'p',\n parse: async (input: string) => {\n const trimmed = input.trim()\n if (trimmed === '') {\n throw new Error('`--project` cannot be empty if provided')\n }\n return trimmed\n },\n }),\n }\n}\n\n/**\n * Returns an `--organization` flag definition.\n *\n * Locked: flag name (`organization`), `helpValue` (`<id>`), and parse (trims + validates non-empty).\n */\nexport function getOrganizationFlag(options: SharedFlagOptions) {\n const {description: baseDescription, helpGroup, semantics, ...rest} = options\n const isOverride = semantics === 'override'\n const description =\n (baseDescription ?? 'Organization ID to use') + (isOverride ? OVERRIDE_SUFFIX : '')\n\n return {\n organization: Flags.string({\n description,\n helpGroup: helpGroup ?? (isOverride ? 'OVERRIDE' : undefined),\n helpValue: '<id>',\n ...rest,\n parse: async (input: string) => {\n const trimmed = input.trim()\n if (trimmed === '') {\n throw new Error('`--organization` cannot be empty if provided')\n }\n return trimmed\n },\n }),\n }\n}\n\n/**\n * Returns a `--dataset` / `-d` flag definition.\n *\n * Locked: flag name (`dataset`), char (`d`), `helpValue` (`<name>`), and parse (trims + validates non-empty).\n */\nexport function getDatasetFlag(options: SharedFlagOptions) {\n const {description: baseDescription, helpGroup, semantics, ...rest} = options\n const isOverride = semantics === 'override'\n const description = (baseDescription ?? 'Dataset to use') + (isOverride ? OVERRIDE_SUFFIX : '')\n\n return {\n dataset: Flags.string({\n description,\n helpGroup: helpGroup ?? (isOverride ? 'OVERRIDE' : undefined),\n helpValue: '<name>',\n ...rest,\n char: 'd',\n parse: async (input: string) => {\n const trimmed = input.trim()\n if (trimmed === '') {\n throw new Error('`--dataset` cannot be empty if provided')\n }\n return trimmed\n },\n }),\n }\n}\n\n/**\n * Opt in to Blueprint-aware behavior for this invocation.\n */\nexport function getWithBlueprintsFlag() {\n return {\n 'with-blueprints': Flags.boolean({\n description: 'Use Blueprint-aware behavior',\n hidden: true,\n }),\n }\n}\n"],"names":["Flags","OVERRIDE_SUFFIX","getProjectIdFlag","options","description","baseDescription","helpGroup","semantics","rest","isOverride","project","string","aliases","deprecateAliases","undefined","helpValue","char","parse","input","trimmed","trim","Error","getOrganizationFlag","organization","getDatasetFlag","dataset","getWithBlueprintsFlag","boolean","hidden"],"mappings":"AAAA,SAAQA,KAAK,QAAO,cAAa;AAoCjC,MAAMC,kBAAkB;AAExB;;;;CAIC,GACD,OAAO,SAASC,iBAAiBC,OAA0B;IACzD,MAAM,EAACC,aAAaC,eAAe,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGC,MAAK,GAAGL;IACtE,MAAMM,aAAaF,cAAc;IACjC,MAAMH,cAAc,AAACC,CAAAA,mBAAmB,mBAAkB,IAAMI,CAAAA,aAAaR,kBAAkB,EAAC;IAEhG,OAAO;QACLS,SAASV,MAAMW,MAAM,CAAC;YACpBC,SAAS;gBAAC;aAAa;YACvBC,kBAAkB;YAClBT;YACAE,WAAWA,aAAcG,CAAAA,aAAa,aAAaK,SAAQ;YAC3DC,WAAW;YACX,GAAGP,IAAI;YACPQ,MAAM;YACNC,OAAO,OAAOC;gBACZ,MAAMC,UAAUD,MAAME,IAAI;gBAC1B,IAAID,YAAY,IAAI;oBAClB,MAAM,IAAIE,MAAM;gBAClB;gBACA,OAAOF;YACT;QACF;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASG,oBAAoBnB,OAA0B;IAC5D,MAAM,EAACC,aAAaC,eAAe,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGC,MAAK,GAAGL;IACtE,MAAMM,aAAaF,cAAc;IACjC,MAAMH,cACJ,AAACC,CAAAA,mBAAmB,wBAAuB,IAAMI,CAAAA,aAAaR,kBAAkB,EAAC;IAEnF,OAAO;QACLsB,cAAcvB,MAAMW,MAAM,CAAC;YACzBP;YACAE,WAAWA,aAAcG,CAAAA,aAAa,aAAaK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