sanity 3.72.2-server-side-schemas-1.19 → 3.72.2-server-side-schemas.21

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.
@@ -74,14 +74,18 @@ async function deployStudioAction(args, context) {
74
74
  ...buildArgs,
75
75
  extOptions: {},
76
76
  extraArguments: []
77
- }, context), storeManifestSchemasArgs = {
77
+ }, context);
78
+ if (flags["schema-required"] && extractManifestError)
79
+ throw output.error(`Schema extraction error: ${extractManifestError.message}`), extractManifestError;
80
+ const storeManifestSchemasArgs = {
78
81
  ...args,
79
82
  extOptions: {
80
- path: `${sourceDir}/static`
83
+ path: `${sourceDir}/static`,
84
+ "schema-required": flags["schema-required"]
81
85
  },
82
86
  extraArguments: []
83
87
  };
84
- extractManifestError || await storeSchemasAction.default(storeManifestSchemasArgs, context);
88
+ await storeSchemasAction.default(storeManifestSchemasArgs, context);
85
89
  }
86
90
  spinner = output.spinner("Verifying local content").start();
87
91
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"deployAction.js","sources":["../../src/_internal/cli/actions/deploy/deployAction.ts"],"sourcesContent":["/* eslint-disable max-statements */\nimport path from 'node:path'\nimport zlib from 'node:zlib'\n\nimport {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\nimport tar from 'tar-fs'\n\nimport {shouldAutoUpdate} from '../../util/shouldAutoUpdate'\nimport buildSanityStudio, {type BuildSanityStudioCommandFlags} from '../build/buildAction'\nimport {extractManifestSafe} from '../manifest/extractManifestAction'\nimport storeManifestSchemas from '../schema/storeSchemasAction'\nimport {\n checkDir,\n createDeployment,\n debug,\n dirIsEmptyOrNonExistent,\n getInstalledSanityVersion,\n getOrCreateUserApplication,\n getOrCreateUserApplicationFromConfig,\n type UserApplication,\n} from './helpers'\n\nexport interface DeployStudioActionFlags extends BuildSanityStudioCommandFlags {\n build?: boolean\n}\n\nexport default async function deployStudioAction(\n args: CliCommandArguments<DeployStudioActionFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const {apiClient, workDir, chalk, output, prompt, cliConfig} = context\n const flags = {build: true, ...args.extOptions}\n const customSourceDir = args.argsWithoutOptions[0]\n const sourceDir = path.resolve(process.cwd(), customSourceDir || path.join(workDir, 'dist'))\n const isAutoUpdating = shouldAutoUpdate({flags, cliConfig})\n\n const installedSanityVersion = await getInstalledSanityVersion()\n const configStudioHost = cliConfig && 'studioHost' in cliConfig && cliConfig.studioHost\n\n const client = apiClient({\n requireUser: true,\n requireProject: true,\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n if (customSourceDir === 'graphql') {\n throw new Error('Did you mean `sanity graphql deploy`?')\n }\n\n if (customSourceDir) {\n let relativeOutput = path.relative(process.cwd(), sourceDir)\n if (relativeOutput[0] !== '.') {\n relativeOutput = `./${relativeOutput}`\n }\n\n const isEmpty = await dirIsEmptyOrNonExistent(sourceDir)\n const shouldProceed =\n isEmpty ||\n (await prompt.single({\n type: 'confirm',\n message: `\"${relativeOutput}\" is not empty, do you want to proceed?`,\n default: false,\n }))\n\n if (!shouldProceed) {\n output.print('Cancelled.')\n return\n }\n\n output.print(`Building to ${relativeOutput}\\n`)\n }\n\n // Check that the project has a studio hostname\n let spinner = output.spinner('Checking project info').start()\n\n let userApplication: UserApplication\n\n try {\n // If the user has provided a studioHost in the config, use that\n if (configStudioHost) {\n userApplication = await getOrCreateUserApplicationFromConfig({\n client,\n context,\n spinner,\n appHost: configStudioHost,\n })\n } else {\n userApplication = await getOrCreateUserApplication({\n client,\n context,\n spinner,\n })\n }\n } catch (err) {\n if (err.message) {\n output.error(chalk.red(err.message))\n return\n }\n\n debug('Error creating user application', err)\n throw err\n }\n\n // Always build the project, unless --no-build is passed\n const shouldBuild = flags.build\n if (shouldBuild) {\n const buildArgs = {\n ...args,\n extOptions: flags,\n argsWithoutOptions: [customSourceDir].filter(Boolean),\n }\n const {didCompile} = await buildSanityStudio(buildArgs, context, {basePath: '/'})\n\n if (!didCompile) {\n return\n }\n\n const extractManifestError = await extractManifestSafe(\n {\n ...buildArgs,\n extOptions: {},\n extraArguments: [],\n },\n context,\n )\n\n const storeManifestSchemasArgs = {\n ...args,\n extOptions: {\n path: `${sourceDir}/static`,\n },\n extraArguments: [],\n }\n\n if (!extractManifestError) await storeManifestSchemas(storeManifestSchemasArgs, context)\n }\n\n // Ensure that the directory exists, is a directory and seems to have valid content\n spinner = output.spinner('Verifying local content').start()\n try {\n await checkDir(sourceDir)\n spinner.succeed()\n } catch (err) {\n spinner.fail()\n debug('Error checking directory', err)\n throw err\n }\n\n // Now create a tarball of the given directory\n const parentDir = path.dirname(sourceDir)\n const base = path.basename(sourceDir)\n const tarball = tar.pack(parentDir, {entries: [base]}).pipe(zlib.createGzip())\n\n spinner = output.spinner('Deploying to Sanity.Studio').start()\n try {\n const {location} = await createDeployment({\n client,\n applicationId: userApplication.id,\n version: installedSanityVersion,\n isAutoUpdating,\n tarball,\n })\n\n spinner.succeed()\n\n // And let the user know we're done\n output.print(`\\nSuccess! Studio deployed to ${chalk.cyan(location)}`)\n\n if (!configStudioHost) {\n output.print(`\\nAdd ${chalk.cyan(`studioHost: '${userApplication.appHost}'`)}`)\n output.print('to defineCliConfig root properties in sanity.cli.js or sanity.cli.ts')\n output.print('to avoid prompting for hostname on next deploy.')\n }\n } catch (err) {\n spinner.fail()\n debug('Error deploying studio', err)\n throw err\n }\n}\n"],"names":["deployStudioAction","args","context","apiClient","workDir","chalk","output","prompt","cliConfig","flags","build","extOptions","customSourceDir","argsWithoutOptions","sourceDir","path","resolve","process","cwd","join","isAutoUpdating","shouldAutoUpdate","installedSanityVersion","getInstalledSanityVersion","configStudioHost","studioHost","client","requireUser","requireProject","withConfig","apiVersion","Error","relativeOutput","relative","dirIsEmptyOrNonExistent","single","type","message","default","print","spinner","start","userApplication","getOrCreateUserApplicationFromConfig","appHost","getOrCreateUserApplication","err","error","red","debug","buildArgs","filter","Boolean","didCompile","buildSanityStudio","basePath","extractManifestError","extractManifestSafe","extraArguments","storeManifestSchemasArgs","storeManifestSchemas","checkDir","succeed","fail","parentDir","dirname","base","basename","tarball","tar","pack","entries","pipe","zlib","createGzip","location","createDeployment","applicationId","id","version","cyan"],"mappings":";;;;;;AA0B8BA,eAAAA,mBAC5BC,MACAC,SACe;AACT,QAAA;AAAA,IAACC;AAAAA,IAAWC;AAAAA,IAASC;AAAAA,IAAOC;AAAAA,IAAQC;AAAAA,IAAQC;AAAAA,EAAAA,IAAaN,SACzDO,QAAQ;AAAA,IAACC,OAAO;AAAA,IAAM,GAAGT,KAAKU;AAAAA,EAAAA,GAC9BC,kBAAkBX,KAAKY,mBAAmB,CAAC,GAC3CC,YAAYC,cAAAA,QAAKC,QAAQC,QAAQC,OAAON,mBAAmBG,sBAAKI,KAAKf,SAAS,MAAM,CAAC,GACrFgB,iBAAiBC,6BAAiB;AAAA,IAACZ;AAAAA,IAAOD;AAAAA,EAAU,CAAA,GAEpDc,yBAAyB,MAAMC,QAA0B,0BAAA,GACzDC,mBAAmBhB,aAAa,gBAAgBA,aAAaA,UAAUiB,YAEvEC,SAASvB,UAAU;AAAA,IACvBwB,aAAa;AAAA,IACbC,gBAAgB;AAAA,EACjB,CAAA,EAAEC,WAAW;AAAA,IAACC,YAAY;AAAA,EAAA,CAAc;AAEzC,MAAIlB,oBAAoB;AAChB,UAAA,IAAImB,MAAM,uCAAuC;AAGzD,MAAInB,iBAAiB;AACnB,QAAIoB,iBAAiBjB,cAAAA,QAAKkB,SAAShB,QAAQC,OAAOJ,SAAS;AAc3D,QAbIkB,eAAe,CAAC,MAAM,QACxBA,iBAAiB,KAAKA,cAAc,KAYlC,EATY,MAAME,QAAwBpB,wBAAAA,SAAS,KAGpD,MAAMP,OAAO4B,OAAO;AAAA,MACnBC,MAAM;AAAA,MACNC,SAAS,IAAIL,cAAc;AAAA,MAC3BM,SAAS;AAAA,IACV,CAAA,IAEiB;AAClBhC,aAAOiC,MAAM,YAAY;AACzB;AAAA,IAAA;AAGKA,WAAAA,MAAM,eAAeP,cAAc;AAAA,CAAI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AQsB,QAAQ;AAAA,WACThB,KAAK;AACZN,UAAAA,QAAQuB,KAAK,GACbd,QAAM,MAAA,4BAA4BH,GAAG,GAC/BA;AAAAA,EAAAA;AAIR,QAAMkB,YAAYjD,cAAAA,QAAKkD,QAAQnD,SAAS,GAClCoD,OAAOnD,cAAAA,QAAKoD,SAASrD,SAAS,GAC9BsD,UAAUC,aAAAA,QAAIC,KAAKN,WAAW;AAAA,IAACO,SAAS,CAACL,IAAI;AAAA,EAAE,CAAA,EAAEM,KAAKC,sBAAKC,YAAY;AAE7ElC,YAAUlC,OAAOkC,QAAQ,4BAA4B,EAAEC,MAAM;AACzD,MAAA;AACI,UAAA;AAAA,MAACkC;AAAAA,IAAQ,IAAI,MAAMC,QAAAA,iBAAiB;AAAA,MACxClD;AAAAA,MACAmD,eAAenC,gBAAgBoC;AAAAA,MAC/BC,SAASzD;AAAAA,MACTF;AAAAA,MACAgD;AAAAA,IAAAA,CACD;AAEON,YAAAA,QAAAA,GAGRxD,OAAOiC,MAAM;AAAA,8BAAiClC,MAAM2E,KAAKL,QAAQ,CAAC,EAAE,GAE/DnD,qBACHlB,OAAOiC,MAAM;AAAA,MAASlC,MAAM2E,KAAK,gBAAgBtC,gBAAgBE,OAAO,GAAG,CAAC,EAAE,GAC9EtC,OAAOiC,MAAM,sEAAsE,GACnFjC,OAAOiC,MAAM,iDAAiD;AAAA,WAEzDO,KAAK;AACZN,UAAAA,QAAQuB,KAAK,GACbd,QAAM,MAAA,0BAA0BH,GAAG,GAC7BA;AAAAA,EAAAA;AAEV;;"}
1
+ {"version":3,"file":"deployAction.js","sources":["../../src/_internal/cli/actions/deploy/deployAction.ts"],"sourcesContent":["/* eslint-disable max-statements */\nimport path from 'node:path'\nimport zlib from 'node:zlib'\n\nimport {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\nimport tar from 'tar-fs'\n\nimport {shouldAutoUpdate} from '../../util/shouldAutoUpdate'\nimport buildSanityStudio, {type BuildSanityStudioCommandFlags} from '../build/buildAction'\nimport {extractManifestSafe} from '../manifest/extractManifestAction'\nimport storeManifestSchemas from '../schema/storeSchemasAction'\nimport {\n checkDir,\n createDeployment,\n debug,\n dirIsEmptyOrNonExistent,\n getInstalledSanityVersion,\n getOrCreateUserApplication,\n getOrCreateUserApplicationFromConfig,\n type UserApplication,\n} from './helpers'\n\nexport interface DeployStudioActionFlags extends BuildSanityStudioCommandFlags {\n 'build'?: boolean\n 'schema-required'?: boolean\n}\n\nexport default async function deployStudioAction(\n args: CliCommandArguments<DeployStudioActionFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const {apiClient, workDir, chalk, output, prompt, cliConfig} = context\n const flags = {build: true, ...args.extOptions}\n const customSourceDir = args.argsWithoutOptions[0]\n const sourceDir = path.resolve(process.cwd(), customSourceDir || path.join(workDir, 'dist'))\n const isAutoUpdating = shouldAutoUpdate({flags, cliConfig})\n\n const installedSanityVersion = await getInstalledSanityVersion()\n const configStudioHost = cliConfig && 'studioHost' in cliConfig && cliConfig.studioHost\n\n const client = apiClient({\n requireUser: true,\n requireProject: true,\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n if (customSourceDir === 'graphql') {\n throw new Error('Did you mean `sanity graphql deploy`?')\n }\n\n if (customSourceDir) {\n let relativeOutput = path.relative(process.cwd(), sourceDir)\n if (relativeOutput[0] !== '.') {\n relativeOutput = `./${relativeOutput}`\n }\n\n const isEmpty = await dirIsEmptyOrNonExistent(sourceDir)\n const shouldProceed =\n isEmpty ||\n (await prompt.single({\n type: 'confirm',\n message: `\"${relativeOutput}\" is not empty, do you want to proceed?`,\n default: false,\n }))\n\n if (!shouldProceed) {\n output.print('Cancelled.')\n return\n }\n\n output.print(`Building to ${relativeOutput}\\n`)\n }\n\n // Check that the project has a studio hostname\n let spinner = output.spinner('Checking project info').start()\n\n let userApplication: UserApplication\n\n try {\n // If the user has provided a studioHost in the config, use that\n if (configStudioHost) {\n userApplication = await getOrCreateUserApplicationFromConfig({\n client,\n context,\n spinner,\n appHost: configStudioHost,\n })\n } else {\n userApplication = await getOrCreateUserApplication({\n client,\n context,\n spinner,\n })\n }\n } catch (err) {\n if (err.message) {\n output.error(chalk.red(err.message))\n return\n }\n\n debug('Error creating user application', err)\n throw err\n }\n\n // Always build the project, unless --no-build is passed\n const shouldBuild = flags.build\n if (shouldBuild) {\n const buildArgs = {\n ...args,\n extOptions: flags,\n argsWithoutOptions: [customSourceDir].filter(Boolean),\n }\n const {didCompile} = await buildSanityStudio(buildArgs, context, {basePath: '/'})\n\n if (!didCompile) {\n return\n }\n\n const extractManifestError = await extractManifestSafe(\n {\n ...buildArgs,\n extOptions: {},\n extraArguments: [],\n },\n context,\n )\n if (flags['schema-required'] && extractManifestError) {\n output.error(`Schema extraction error: ${extractManifestError.message}`)\n throw extractManifestError\n }\n\n const storeManifestSchemasArgs = {\n ...args,\n extOptions: {\n 'path': `${sourceDir}/static`,\n 'schema-required': flags['schema-required'],\n },\n extraArguments: [],\n }\n\n await storeManifestSchemas(storeManifestSchemasArgs, context)\n }\n\n // Ensure that the directory exists, is a directory and seems to have valid content\n spinner = output.spinner('Verifying local content').start()\n try {\n await checkDir(sourceDir)\n spinner.succeed()\n } catch (err) {\n spinner.fail()\n debug('Error checking directory', err)\n throw err\n }\n\n // Now create a tarball of the given directory\n const parentDir = path.dirname(sourceDir)\n const base = path.basename(sourceDir)\n const tarball = tar.pack(parentDir, {entries: [base]}).pipe(zlib.createGzip())\n\n spinner = output.spinner('Deploying to Sanity.Studio').start()\n try {\n const {location} = await createDeployment({\n client,\n applicationId: userApplication.id,\n version: installedSanityVersion,\n isAutoUpdating,\n tarball,\n })\n\n spinner.succeed()\n\n // And let the user know we're done\n output.print(`\\nSuccess! Studio deployed to ${chalk.cyan(location)}`)\n\n if (!configStudioHost) {\n output.print(`\\nAdd ${chalk.cyan(`studioHost: '${userApplication.appHost}'`)}`)\n output.print('to defineCliConfig root properties in sanity.cli.js or sanity.cli.ts')\n output.print('to avoid prompting for hostname on next deploy.')\n }\n } catch (err) {\n spinner.fail()\n debug('Error deploying studio', err)\n throw err\n }\n}\n"],"names":["deployStudioAction","args","context","apiClient","workDir","chalk","output","prompt","cliConfig","flags","build","extOptions","customSourceDir","argsWithoutOptions","sourceDir","path","resolve","process","cwd","join","isAutoUpdating","shouldAutoUpdate","installedSanityVersion","getInstalledSanityVersion","configStudioHost","studioHost","client","requireUser","requireProject","withConfig","apiVersion","Error","relativeOutput","relative","dirIsEmptyOrNonExistent","single","type","message","default","print","spinner","start","userApplication","getOrCreateUserApplicationFromConfig","appHost","getOrCreateUserApplication","err","error","red","debug","buildArgs","filter","Boolean","didCompile","buildSanityStudio","basePath","extractManifestError","extractManifestSafe","extraArguments","storeManifestSchemasArgs","storeManifestSchemas","checkDir","succeed","fail","parentDir","dirname","base","basename","tarball","tar","pack","entries","pipe","zlib","createGzip","location","createDeployment","applicationId","id","version","cyan"],"mappings":";;;;;;AA2B8BA,eAAAA,mBAC5BC,MACAC,SACe;AACT,QAAA;AAAA,IAACC;AAAAA,IAAWC;AAAAA,IAASC;AAAAA,IAAOC;AAAAA,IAAQC;AAAAA,IAAQC;AAAAA,EAAAA,IAAaN,SACzDO,QAAQ;AAAA,IAACC,OAAO;AAAA,IAAM,GAAGT,KAAKU;AAAAA,EAAAA,GAC9BC,kBAAkBX,KAAKY,mBAAmB,CAAC,GAC3CC,YAAYC,cAAAA,QAAKC,QAAQC,QAAQC,OAAON,mBAAmBG,sBAAKI,KAAKf,SAAS,MAAM,CAAC,GACrFgB,iBAAiBC,6BAAiB;AAAA,IAACZ;AAAAA,IAAOD;AAAAA,EAAU,CAAA,GAEpDc,yBAAyB,MAAMC,QAA0B,0BAAA,GACzDC,mBAAmBhB,aAAa,gBAAgBA,aAAaA,UAAUiB,YAEvEC,SAASvB,UAAU;AAAA,IACvBwB,aAAa;AAAA,IACbC,gBAAgB;AAAA,EACjB,CAAA,EAAEC,WAAW;AAAA,IAACC,YAAY;AAAA,EAAA,CAAc;AAEzC,MAAIlB,oBAAoB;AA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KAAKL,QAAQ,CAAC,EAAE,GAE/DnD,qBACHlB,OAAOiC,MAAM;AAAA,MAASlC,MAAM2E,KAAK,gBAAgBtC,gBAAgBE,OAAO,GAAG,CAAC,EAAE,GAC9EtC,OAAOiC,MAAM,sEAAsE,GACnFjC,OAAOiC,MAAM,iDAAiD;AAAA,WAEzDO,KAAK;AACZN,UAAAA,QAAQuB,KAAK,GACbd,QAAM,MAAA,0BAA0BH,GAAG,GAC7BA;AAAAA,EAAAA;AAEV;;"}
@@ -44,8 +44,11 @@ async function storeManifestSchemas(args, context) {
44
44
  await Promise.all(manifest.workspaces.map(async (workspace) => {
45
45
  await saveSchema(workspace);
46
46
  }));
47
+ return;
47
48
  } catch (err) {
48
- output.error(err);
49
+ if (output.error(err), flags["schema-required"])
50
+ throw err;
51
+ return err;
49
52
  }
50
53
  }
51
54
  exports.default = storeManifestSchemas;
@@ -1 +1 @@
1
- {"version":3,"file":"storeSchemasAction.js","sources":["../../src/_internal/cli/actions/schema/storeSchemasAction.ts"],"sourcesContent":["import {readFileSync} from 'node:fs'\nimport path, {join, resolve} from 'node:path'\n\nimport {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\n\nimport {\n type CreateManifest,\n type ManifestSchemaType,\n type ManifestWorkspaceFile,\n} from '../../../manifest/manifestTypes'\n\nexport interface StoreManifestSchemasFlags {\n 'path'?: string\n 'workspace'?: string\n 'custom-id'?: string\n}\n\nexport default async function storeManifestSchemas(\n args: CliCommandArguments<StoreManifestSchemasFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const flags = args.extOptions\n const workspaceName = flags.workspace\n const customId = flags['custom-id']\n const {output, workDir, apiClient} = context\n\n const defaultOutputDir = resolve(join(workDir, 'dist'))\n\n const outputDir = resolve(defaultOutputDir)\n const defaultStaticPath = join(outputDir, 'static')\n\n const staticPath = flags.path ?? defaultStaticPath\n\n try {\n const manifestPath = path.resolve(process.cwd(), staticPath)\n const client = apiClient({\n requireUser: true,\n requireProject: true,\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n const projectId = client.config().projectId\n\n const manifest: CreateManifest = JSON.parse(\n readFileSync(`${manifestPath}/create-manifest.json`, 'utf-8'),\n )\n\n const saveSchema = async (workspace: ManifestWorkspaceFile) => {\n const spinner = output.spinner({}).start('Storing schemas')\n const id = customId || `sanity.workspace.schema.${workspace.name}`\n try {\n if (workspace.projectId !== projectId && workspaceName !== workspace.name) {\n spinner.fail(\n `Cannot store schema for ${workspace.name} because manifest projectId does not match: ${projectId} !== ${workspace.projectId}`,\n )\n return\n }\n const schema = JSON.parse(\n readFileSync(`${manifestPath}/${workspace.schema}`, 'utf-8'),\n ) as ManifestSchemaType\n await client\n .withConfig({\n dataset: workspace.dataset,\n projectId: workspace.projectId,\n })\n .transaction()\n .createOrReplace({_type: 'sanity.workspace.schema', _id: id, workspace, schema})\n .commit()\n spinner.succeed(\n `Schema stored for workspace ${workspace.name} (shcemaId: ${id}, projectId: ${projectId}, dataset: ${workspace.dataset})`,\n )\n } catch (error) {\n spinner.fail(`Error storing schema for workspace ${workspace.name}: ${error}`)\n }\n }\n\n if (workspaceName) {\n const schemaToSave = manifest.workspaces.find((workspace) => workspace.name === workspaceName)\n if (schemaToSave) {\n await saveSchema(schemaToSave)\n } else {\n output.error(`Workspace ${workspaceName} not found in manifest: projectID: ${projectId}`)\n }\n } else {\n await Promise.all(\n manifest.workspaces.map(async (workspace): Promise<void> => {\n await saveSchema(workspace)\n }),\n )\n }\n } catch (err) {\n output.error(err)\n }\n}\n"],"names":["storeManifestSchemas","args","context","flags","extOptions","workspaceName","workspace","customId","output","workDir","apiClient","defaultOutputDir","resolve","join","outputDir","defaultStaticPath","staticPath","path","manifestPath","process","cwd","client","requireUser","requireProject","withConfig","apiVersion","projectId","config","manifest","JSON","parse","readFileSync","saveSchema","spinner","start","id","name","fail","schema","dataset","transaction","createOrReplace","_type","_id","commit","succeed","error","schemaToSave","workspaces","find","Promise","all","map","err"],"mappings":";;;;;;AAiB8BA,eAAAA,qBAC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AA2BC,KAAKR;AAAAA,UAAI7B;AAAAA,UAAWgC;AAAAA,QAAAA,CAAO,EAC9EM,OAAAA,GACHX,QAAQY,QACN,+BAA+BvC,UAAU8B,IAAI,eAAeD,EAAE,gBAAgBT,SAAS,cAAcpB,UAAUiC,OAAO,GACxH;AAAA,eACOO,OAAO;AACdb,gBAAQI,KAAK,sCAAsC/B,UAAU8B,IAAI,KAAKU,KAAK,EAAE;AAAA,MAAA;AAAA,IAEjF;AAEA,QAAIzC,eAAe;AACjB,YAAM0C,eAAenB,SAASoB,WAAWC,KAAM3C,CAAcA,cAAAA,UAAU8B,SAAS/B,aAAa;AACzF0C,qBACF,MAAMf,WAAWe,YAAY,IAE7BvC,OAAOsC,MAAM,aAAazC,aAAa,sCAAsCqB,SAAS,EAAE;AAAA,IAE5F;AACE,YAAMwB,QAAQC,IACZvB,SAASoB,WAAWI,IAAI,OAAO9C,cAA6B;AAC1D,cAAM0B,WAAW1B,SAAS;AAAA,MAAA,CAC3B,CACH;AAAA,WAEK+C,KAAK;AACZ7C,WAAOsC,MAAMO,GAAG;AAAA,EAAA;AAEpB;;"}
1
+ {"version":3,"file":"storeSchemasAction.js","sources":["../../src/_internal/cli/actions/schema/storeSchemasAction.ts"],"sourcesContent":["import {readFileSync} from 'node:fs'\nimport path, {join, resolve} from 'node:path'\n\nimport {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\n\nimport {\n type CreateManifest,\n type ManifestSchemaType,\n type ManifestWorkspaceFile,\n} from '../../../manifest/manifestTypes'\n\nexport interface StoreManifestSchemasFlags {\n 'path'?: string\n 'workspace'?: string\n 'custom-id'?: string\n 'schema-required'?: boolean\n}\n\nexport default async function storeManifestSchemas(\n args: CliCommandArguments<StoreManifestSchemasFlags>,\n context: CliCommandContext,\n): Promise<Error | undefined> {\n const flags = args.extOptions\n const workspaceName = flags.workspace\n const customId = flags['custom-id']\n const {output, workDir, apiClient} = context\n\n const defaultOutputDir = resolve(join(workDir, 'dist'))\n\n const outputDir = resolve(defaultOutputDir)\n const defaultStaticPath = join(outputDir, 'static')\n\n const staticPath = flags.path ?? defaultStaticPath\n\n try {\n const manifestPath = path.resolve(process.cwd(), staticPath)\n const client = apiClient({\n requireUser: true,\n requireProject: true,\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n const projectId = client.config().projectId\n\n const manifest: CreateManifest = JSON.parse(\n readFileSync(`${manifestPath}/create-manifest.json`, 'utf-8'),\n )\n\n const saveSchema = async (workspace: ManifestWorkspaceFile) => {\n const spinner = output.spinner({}).start('Storing schemas')\n const id = customId || `sanity.workspace.schema.${workspace.name}`\n try {\n if (workspace.projectId !== projectId && workspaceName !== workspace.name) {\n spinner.fail(\n `Cannot store schema for ${workspace.name} because manifest projectId does not match: ${projectId} !== ${workspace.projectId}`,\n )\n return\n }\n const schema = JSON.parse(\n readFileSync(`${manifestPath}/${workspace.schema}`, 'utf-8'),\n ) as ManifestSchemaType\n await client\n .withConfig({\n dataset: workspace.dataset,\n projectId: workspace.projectId,\n })\n .transaction()\n .createOrReplace({_type: 'sanity.workspace.schema', _id: id, workspace, schema})\n .commit()\n spinner.succeed(\n `Schema stored for workspace ${workspace.name} (shcemaId: ${id}, projectId: ${projectId}, dataset: ${workspace.dataset})`,\n )\n } catch (error) {\n spinner.fail(`Error storing schema for workspace ${workspace.name}: ${error}`)\n }\n }\n\n if (workspaceName) {\n const schemaToSave = manifest.workspaces.find((workspace) => workspace.name === workspaceName)\n if (schemaToSave) {\n await saveSchema(schemaToSave)\n } else {\n output.error(`Workspace ${workspaceName} not found in manifest: projectID: ${projectId}`)\n }\n } else {\n await Promise.all(\n manifest.workspaces.map(async (workspace): Promise<void> => {\n await saveSchema(workspace)\n }),\n )\n }\n return undefined\n } catch (err) {\n output.error(err)\n if (flags['schema-required']) {\n throw err\n }\n return err\n }\n}\n"],"names":["storeManifestSchemas","args","context","flags","extOptions","workspaceName","workspace","customId","output","workDir","apiClient","defaultOutputDir","resolve","join","outputDir","defaultStaticPath","staticPath","path","manifestPath","process","cwd","client","requireUser","requireProject","withConfig","apiVersion","projectId","config","manifest","JSON","parse","readFileSync","saveSchema","spinner","start","id","name","fail","schema","dataset","transaction","createOrReplace","_type","_id","commit","succeed","error","schemaToSave","workspaces","find","Promise","all","map","err"],"mappings":";;;;;;AAkB8BA,eAAAA,qBAC5BC,MACAC,SAC4B;AACtBC,QAAAA,QAAQF,KAAKG,YACbC,gBAAgBF,MAAMG,WACtBC,WAAWJ,MAAM,WAAW,GAC5B;AAAA,IAACK;AAAAA,IAAQC;AAAAA,IAASC;AAAAA,EAAAA,IAAaR,SAE/BS,mBAAmBC,aAAQC,KAAAA,KAAKJ,SAAS,MAAM,CAAC,GAEhDK,YAAYF,KAAAA,QAAQD,gBAAgB,GACpCI,oBAAoBF,KAAAA,KAAKC,WAAW,QAAQ,GAE5CE,aAAab,MAAMc,QAAQF;AAE7B,MAAA;AACIG,UAAAA,eAAeD,sBAAKL,QAAQO,QAAQC,OAAOJ,UAAU,GACrDK,SAASX,UAAU;AAAA,MACvBY,aAAa;AAAA,MACbC,gBAAgB;AAAA,IACjB,CAAA,EAAEC,WAAW;AAAA,MAACC,YAAY;AAAA,IAAA,CAAc,GAEnCC,YAAYL,OAAOM,OAAO,EAAED,WAE5BE,WAA2BC,KAAKC,MACpCC,GAAa,aAAA,GAAGb,YAAY,yBAAyB,OAAO,CAC9D,GAEMc,aAAa,OAAO1B,cAAqC;AAC7D,YAAM2B,UAAUzB,OAAOyB,QAAQ,CAAE,CAAA,EAAEC,MAAM,iBAAiB,GACpDC,KAAK5B,YAAY,2BAA2BD,UAAU8B,IAAI;AAC5D,UAAA;AACF,YAAI9B,UAAUoB,cAAcA,aAAarB,kBAAkBC,UAAU8B,MAAM;AACjEC,kBAAAA,KACN,2BAA2B/B,UAAU8B,IAAI,+CAA+CV,SAAS,QAAQpB,UAAUoB,SAAS,EAC9H;AACA;AAAA,QAAA;AAEIY,cAAAA,SAAST,KAAKC,MAClBC,GAAa,aAAA,GAAGb,YAAY,IAAIZ,UAAUgC,MAAM,IAAI,OAAO,CAC7D;AACA,cAAMjB,OACHG,WAAW;AAAA,UACVe,SAASjC,UAAUiC;AAAAA,UACnBb,WAAWpB,UAAUoB;AAAAA,QAAAA,CACtB,EACAc,YAAY,EACZC,gBAAgB;AAAA,UAACC,OAAO;AAAA,UAA2BC,KAAKR;AAAAA,UAAI7B;AAAAA,UAAWgC;AAAAA,QAAAA,CAAO,EAC9EM,OAAAA,GACHX,QAAQY,QACN,+BAA+BvC,UAAU8B,IAAI,eAAeD,EAAE,gBAAgBT,SAAS,cAAcpB,UAAUiC,OAAO,GACxH;AAAA,eACOO,OAAO;AACdb,gBAAQI,KAAK,sCAAsC/B,UAAU8B,IAAI,KAAKU,KAAK,EAAE;AAAA,MAAA;AAAA,IAEjF;AAEA,QAAIzC,eAAe;AACjB,YAAM0C,eAAenB,SAASoB,WAAWC,KAAM3C,CAAcA,cAAAA,UAAU8B,SAAS/B,aAAa;AACzF0C,qBACF,MAAMf,WAAWe,YAAY,IAE7BvC,OAAOsC,MAAM,aAAazC,aAAa,sCAAsCqB,SAAS,EAAE;AAAA,IAE5F;AACE,YAAMwB,QAAQC,IACZvB,SAASoB,WAAWI,IAAI,OAAO9C,cAA6B;AAC1D,cAAM0B,WAAW1B,SAAS;AAAA,MAAA,CAC3B,CACH;AAEF;AAAA,WACO+C,KAAK;AAEZ,QADA7C,OAAOsC,MAAMO,GAAG,GACZlD,MAAM,iBAAiB;AACnBkD,YAAAA;AAEDA,WAAAA;AAAAA,EAAAA;AAEX;;"}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const SANITY_VERSION = "3.72.2-server-side-schemas-1.19+859744ea04";
2
+ const SANITY_VERSION = "3.72.2-server-side-schemas.21+d5aa085f9d";
3
3
  exports.SANITY_VERSION = SANITY_VERSION;
4
4
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
- const SANITY_VERSION = "3.72.2-server-side-schemas-1.19+859744ea04";
1
+ const SANITY_VERSION = "3.72.2-server-side-schemas.21+d5aa085f9d";
2
2
  export {
3
3
  SANITY_VERSION
4
4
  };
@@ -1,4 +1,4 @@
1
- const SANITY_VERSION = "3.72.2-server-side-schemas-1.19+859744ea04";
1
+ const SANITY_VERSION = "3.72.2-server-side-schemas.21+d5aa085f9d";
2
2
  export {
3
3
  SANITY_VERSION
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity",
3
- "version": "3.72.2-server-side-schemas-1.19+859744ea04",
3
+ "version": "3.72.2-server-side-schemas.21+d5aa085f9d",
4
4
  "description": "Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches",
5
5
  "keywords": [
6
6
  "sanity",
@@ -160,11 +160,11 @@
160
160
  "@rexxars/react-json-inspector": "^9.0.1",
161
161
  "@sanity/asset-utils": "^2.0.6",
162
162
  "@sanity/bifur-client": "^0.4.1",
163
- "@sanity/cli": "3.72.2-server-side-schemas-1.19+859744ea04",
163
+ "@sanity/cli": "3.72.2-server-side-schemas.21+d5aa085f9d",
164
164
  "@sanity/client": "^6.27.2",
165
165
  "@sanity/color": "^3.0.0",
166
166
  "@sanity/comlink": "^3.0.1",
167
- "@sanity/diff": "3.72.2-server-side-schemas-1.19+859744ea04",
167
+ "@sanity/diff": "3.72.2-server-side-schemas.21+d5aa085f9d",
168
168
  "@sanity/diff-match-patch": "^3.1.1",
169
169
  "@sanity/eventsource": "^5.0.0",
170
170
  "@sanity/export": "^3.42.2",
@@ -173,15 +173,15 @@
173
173
  "@sanity/import": "^3.37.9",
174
174
  "@sanity/insert-menu": "1.0.20",
175
175
  "@sanity/logos": "^2.1.13",
176
- "@sanity/migrate": "3.72.2-server-side-schemas-1.19+859744ea04",
177
- "@sanity/mutator": "3.72.2-server-side-schemas-1.19+859744ea04",
176
+ "@sanity/migrate": "3.72.2-server-side-schemas.21+d5aa085f9d",
177
+ "@sanity/mutator": "3.72.2-server-side-schemas.21+d5aa085f9d",
178
178
  "@sanity/presentation-comlink": "^1.0.4",
179
179
  "@sanity/preview-url-secret": "^2.1.4",
180
- "@sanity/schema": "3.72.2-server-side-schemas-1.19+859744ea04",
180
+ "@sanity/schema": "3.72.2-server-side-schemas.21+d5aa085f9d",
181
181
  "@sanity/telemetry": "^0.7.7",
182
- "@sanity/types": "3.72.2-server-side-schemas-1.19+859744ea04",
182
+ "@sanity/types": "3.72.2-server-side-schemas.21+d5aa085f9d",
183
183
  "@sanity/ui": "^2.11.7",
184
- "@sanity/util": "3.72.2-server-side-schemas-1.19+859744ea04",
184
+ "@sanity/util": "3.72.2-server-side-schemas.21+d5aa085f9d",
185
185
  "@sanity/uuid": "^3.0.2",
186
186
  "@sentry/react": "^8.33.0",
187
187
  "@tanstack/react-table": "^8.16.0",
@@ -280,7 +280,7 @@
280
280
  "@repo/dev-aliases": "3.72.1",
281
281
  "@repo/package.config": "3.72.1",
282
282
  "@repo/test-config": "3.72.1",
283
- "@sanity/codegen": "3.72.2-server-side-schemas-1.19+859744ea04",
283
+ "@sanity/codegen": "3.72.2-server-side-schemas.21+d5aa085f9d",
284
284
  "@sanity/generate-help-url": "^3.0.0",
285
285
  "@sanity/pkg-utils": "6.13.4",
286
286
  "@sanity/tsdoc": "1.0.169",
@@ -324,5 +324,5 @@
324
324
  "engines": {
325
325
  "node": ">=18"
326
326
  },
327
- "gitHead": "859744ea0435d9fb9eb06195517f9c5f81049f4e"
327
+ "gitHead": "d5aa085f9d6ac08ff8661d5936f9ca228236bc73"
328
328
  }
@@ -21,7 +21,8 @@ import {
21
21
  } from './helpers'
22
22
 
23
23
  export interface DeployStudioActionFlags extends BuildSanityStudioCommandFlags {
24
- build?: boolean
24
+ 'build'?: boolean
25
+ 'schema-required'?: boolean
25
26
  }
26
27
 
27
28
  export default async function deployStudioAction(
@@ -122,16 +123,21 @@ export default async function deployStudioAction(
122
123
  },
123
124
  context,
124
125
  )
126
+ if (flags['schema-required'] && extractManifestError) {
127
+ output.error(`Schema extraction error: ${extractManifestError.message}`)
128
+ throw extractManifestError
129
+ }
125
130
 
126
131
  const storeManifestSchemasArgs = {
127
132
  ...args,
128
133
  extOptions: {
129
- path: `${sourceDir}/static`,
134
+ 'path': `${sourceDir}/static`,
135
+ 'schema-required': flags['schema-required'],
130
136
  },
131
137
  extraArguments: [],
132
138
  }
133
139
 
134
- if (!extractManifestError) await storeManifestSchemas(storeManifestSchemasArgs, context)
140
+ await storeManifestSchemas(storeManifestSchemasArgs, context)
135
141
  }
136
142
 
137
143
  // Ensure that the directory exists, is a directory and seems to have valid content
@@ -13,12 +13,13 @@ export interface StoreManifestSchemasFlags {
13
13
  'path'?: string
14
14
  'workspace'?: string
15
15
  'custom-id'?: string
16
+ 'schema-required'?: boolean
16
17
  }
17
18
 
18
19
  export default async function storeManifestSchemas(
19
20
  args: CliCommandArguments<StoreManifestSchemasFlags>,
20
21
  context: CliCommandContext,
21
- ): Promise<void> {
22
+ ): Promise<Error | undefined> {
22
23
  const flags = args.extOptions
23
24
  const workspaceName = flags.workspace
24
25
  const customId = flags['custom-id']
@@ -87,7 +88,12 @@ export default async function storeManifestSchemas(
87
88
  }),
88
89
  )
89
90
  }
91
+ return undefined
90
92
  } catch (err) {
91
93
  output.error(err)
94
+ if (flags['schema-required']) {
95
+ throw err
96
+ }
97
+ return err
92
98
  }
93
99
  }
@@ -10,9 +10,9 @@ const helpText = `
10
10
  Options
11
11
  --source-maps Enable source maps for built bundles (increases size of bundle)
12
12
  --auto-updates / --no-auto-updates Enable/disable auto updates of studio versions
13
- --schema-path / path to schema folder if custom schema folder is used
14
13
  --no-minify Skip minifying built JavaScript (speeds up build, increases size of bundle)
15
14
  --no-build Don't build the studio prior to deploy, instead deploying the version currently in \`dist/\`
15
+ --schema-required Require schema extraction and storing to be successful
16
16
  -y, --yes Unattended mode, answers "yes" to any "yes/no" prompt and otherwise uses defaults
17
17
 
18
18
  Examples