@sanity/cli 8.3.0 → 8.4.2
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 +14 -7
- package/dist/actions/build/buildApp.js.map +1 -1
- package/dist/actions/build/buildStudio.js +3 -3
- package/dist/actions/build/buildStudio.js.map +1 -1
- package/dist/actions/deploy/deployApp.js +32 -25
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/deploy/deployStudio.js +2 -1
- package/dist/actions/deploy/deployStudio.js.map +1 -1
- package/dist/actions/deploy/deployStudioSchemasAndManifests.worker.js +2 -4
- package/dist/actions/deploy/deployStudioSchemasAndManifests.worker.js.map +1 -1
- package/dist/actions/deploy/deploymentPlan.js.map +1 -1
- package/dist/actions/dev/devAction.js +6 -4
- package/dist/actions/dev/devAction.js.map +1 -1
- package/dist/actions/dev/servers/getDevServerConfig.js +13 -6
- package/dist/actions/dev/servers/getDevServerConfig.js.map +1 -1
- package/dist/actions/dev/servers/startAppDevServer.js +4 -2
- package/dist/actions/dev/servers/startAppDevServer.js.map +1 -1
- package/dist/actions/graphql/gen1/generateTypeFilters.js +1 -2
- package/dist/actions/graphql/gen1/generateTypeFilters.js.map +1 -1
- package/dist/actions/graphql/resolveGraphQLApisFromWorkspaces.js +5 -2
- package/dist/actions/graphql/resolveGraphQLApisFromWorkspaces.js.map +1 -1
- package/dist/actions/init/templates/shopify.js +2 -1
- package/dist/actions/init/templates/shopify.js.map +1 -1
- package/dist/actions/manifest/extractManifest.js +5 -37
- package/dist/actions/manifest/extractManifest.js.map +1 -1
- package/dist/actions/manifest/extractStudioManifest.js +1 -1
- package/dist/actions/manifest/extractStudioManifest.js.map +1 -1
- package/dist/actions/preview/previewAction.js +1 -1
- package/dist/actions/preview/previewAction.js.map +1 -1
- package/dist/actions/schema/deleteSchemaAction.js +1 -1
- package/dist/actions/schema/deleteSchemaAction.js.map +1 -1
- package/dist/actions/schema/deploySchemas.js.map +1 -1
- package/dist/actions/schema/extractSanityWorkspace.worker.js +1 -1
- package/dist/actions/schema/extractSanityWorkspace.worker.js.map +1 -1
- package/dist/actions/schema/listSchemas.js +1 -1
- package/dist/actions/schema/listSchemas.js.map +1 -1
- package/dist/actions/schema/schemaTypeHelpers.js +5 -0
- package/dist/actions/schema/schemaTypeHelpers.js.map +1 -0
- package/dist/actions/schema/updateWorkspaceSchema.js +1 -1
- package/dist/actions/schema/updateWorkspaceSchema.js.map +1 -1
- package/dist/actions/schema/utils/schemaStoreValidation.js +2 -2
- package/dist/actions/schema/utils/schemaStoreValidation.js.map +1 -1
- package/dist/actions/schema/utils/workspaceSchemaId.js +1 -1
- package/dist/actions/schema/utils/workspaceSchemaId.js.map +1 -1
- package/dist/actions/versions/getFormatters.js +1 -2
- package/dist/actions/versions/getFormatters.js.map +1 -1
- package/dist/commands/documents/create.js +4 -4
- package/dist/commands/documents/create.js.map +1 -1
- package/dist/commands/hooks/logs.js +1 -2
- package/dist/commands/hooks/logs.js.map +1 -1
- package/dist/commands/projects/list.js +3 -5
- package/dist/commands/projects/list.js.map +1 -1
- package/dist/commands/undeploy.js +7 -5
- package/dist/commands/undeploy.js.map +1 -1
- package/dist/commands/users/list.js +3 -5
- package/dist/commands/users/list.js.map +1 -1
- package/dist/commands/versions.js +1 -2
- package/dist/commands/versions.js.map +1 -1
- package/dist/exports/_internal.d.ts +1 -67
- package/dist/exports/_internal.js +1 -1
- package/dist/exports/_internal.js.map +1 -1
- package/dist/exports/index.d.ts +2 -2
- package/dist/exports/index.js +2 -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 +4 -0
- package/dist/generated/apiRoutes.js.map +1 -1
- package/dist/prompts/selectMediaLibrary.js +2 -3
- package/dist/prompts/selectMediaLibrary.js.map +1 -1
- package/dist/services/mintProject.js +27 -14
- package/dist/services/mintProject.js.map +1 -1
- package/dist/services/schemas.js.map +1 -1
- package/dist/services/userApplications.js.map +1 -1
- package/dist/util/determineIsApp.js +1 -1
- package/dist/util/determineIsApp.js.map +1 -1
- package/dist/util/sortRowsByColumn.js +23 -0
- package/dist/util/sortRowsByColumn.js.map +1 -0
- package/oclif.manifest.json +353 -353
- package/package.json +7 -10
- package/dist/actions/manifest/blockTypeTransformer.js +0 -67
- package/dist/actions/manifest/blockTypeTransformer.js.map +0 -1
- package/dist/actions/manifest/extractCoreAppManifest.js +0 -111
- package/dist/actions/manifest/extractCoreAppManifest.js.map +0 -1
- package/dist/actions/manifest/extractManifest.worker.js +0 -30
- package/dist/actions/manifest/extractManifest.worker.js.map +0 -1
- package/dist/actions/manifest/extractWorkspaceManifest.js +0 -72
- package/dist/actions/manifest/extractWorkspaceManifest.js.map +0 -1
- package/dist/actions/manifest/iconResolver.js +0 -36
- package/dist/actions/manifest/iconResolver.js.map +0 -1
- package/dist/actions/manifest/purifyConfig.js +0 -307
- package/dist/actions/manifest/purifyConfig.js.map +0 -1
- package/dist/actions/manifest/referenceTransformer.js +0 -51
- package/dist/actions/manifest/referenceTransformer.js.map +0 -1
- package/dist/actions/manifest/resolveSchemaIcon.js +0 -43
- package/dist/actions/manifest/resolveSchemaIcon.js.map +0 -1
- package/dist/actions/manifest/sanitizeIcon.js +0 -13
- package/dist/actions/manifest/sanitizeIcon.js.map +0 -1
- package/dist/actions/manifest/schemaTypeHelpers.js +0 -110
- package/dist/actions/manifest/schemaTypeHelpers.js.map +0 -1
- package/dist/actions/manifest/schemaTypeTransformer.js +0 -169
- package/dist/actions/manifest/schemaTypeTransformer.js.map +0 -1
- package/dist/actions/manifest/transformerUtils.js +0 -40
- package/dist/actions/manifest/transformerUtils.js.map +0 -1
- package/dist/actions/manifest/types.js +0 -13
- package/dist/actions/manifest/types.js.map +0 -1
- package/dist/actions/manifest/validationTransformer.js +0 -84
- package/dist/actions/manifest/validationTransformer.js.map +0 -1
- package/dist/actions/manifest/writeManifestFile.js +0 -29
- package/dist/actions/manifest/writeManifestFile.js.map +0 -1
- package/dist/actions/manifest/writeWorkspaceFiles.js +0 -30
- package/dist/actions/manifest/writeWorkspaceFiles.js.map +0 -1
- package/dist/actions/schema/uploadSchemaToLexicon.js +0 -91
- package/dist/actions/schema/uploadSchemaToLexicon.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/hooks/logs.ts"],"sourcesContent":["import {inspect, styleText} from 'node:util'\n\nimport {Args, Flags} from '@oclif/core'\nimport {exitCodes, SanityCommand, subdebug} from '@sanity/cli-core'\nimport {select} from '@sanity/cli-core/ux'\nimport groupBy from 'lodash-es/groupBy.js'\n\nimport {formatFailure} from '../../actions/hook/formatFailure.js'\nimport {type DeliveryAttempt, type Hook, type HookMessage} from '../../actions/hook/types'\nimport {promptForProject} from '../../prompts/promptForProject.js'\nimport {\n getHookAttemptsForProject,\n getHookMessagesForProject,\n getHooksForProject,\n} from '../../services/hooks.js'\nimport {getProjectIdFlag} from '../../util/sharedFlags.js'\n\nconst logsHookDebug = subdebug('hook:logs')\n\nexport class LogsHookCommand extends SanityCommand<typeof LogsHookCommand> {\n static override args = {\n name: Args.string({\n description: 'Name of the webhook to show logs for',\n required: false,\n }),\n }\n\n static override description = 'Show log entries for project webhooks'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Show log entries for project webhooks',\n },\n {\n command: '<%= config.bin %> <%= command.id %> [NAME]',\n description: 'Show log entries for a specific webhook by name',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --project-id abc123',\n description: 'Show log entries for a specific project',\n },\n ]\n\n static override flags = {\n ...getProjectIdFlag({\n description: 'Project ID to view webhook logs for',\n semantics: 'override',\n }),\n detailed: Flags.boolean({\n description: 'Include detailed payload and attempts',\n required: false,\n }),\n }\n\n static override hiddenAliases: string[] = ['hook:logs']\n\n public async run() {\n const {args, flags} = await this.parse(LogsHookCommand)\n\n // Ensure we have project context\n const projectId = await this.getProjectId({\n fallback: () =>\n promptForProject({\n requiredPermissions: [{grant: 'read', permission: 'sanity.project.webhooks'}],\n }),\n })\n\n // Get hooks for the project\n let hooks: Hook[]\n try {\n hooks = await getHooksForProject(projectId)\n } catch (error) {\n const err = error as Error\n logsHookDebug(`Error fetching hooks for project ${projectId}`, err)\n this.error(`Hook list retrieval failed:\\n${err.message}`, {exit: exitCodes.RUNTIME_ERROR})\n }\n\n if (hooks.length === 0) {\n this.error('No hooks currently registered', {exit: exitCodes.RUNTIME_ERROR})\n }\n\n // If hook name is provided, find that specific hook\n let selectedHook: Hook | undefined\n if (args.name) {\n selectedHook = hooks.find((hook) => hook.name.toLowerCase() === args.name?.toLowerCase())\n if (!selectedHook) {\n this.error(`Hook with name \"${args.name}\" not found`, {exit: exitCodes.RUNTIME_ERROR})\n }\n } else if (hooks.length === 1) {\n // If only one hook exists, use that\n selectedHook = hooks[0]\n } else {\n // Otherwise prompt user to select a hook\n if (this.isUnattended()) {\n this.error(\n 'Webhook name is required when multiple webhooks exist. Pass the name as an argument.',\n {\n exit: exitCodes.USAGE_ERROR,\n },\n )\n }\n selectedHook = await this.selectHook(hooks)\n }\n\n if (!selectedHook) {\n this.error('No hook selected', {exit: exitCodes.RUNTIME_ERROR})\n }\n\n // Fetch messages and attempts for the selected hook\n let messages: HookMessage[]\n let attempts: DeliveryAttempt[] = []\n try {\n ;[messages, attempts] = await Promise.all([\n getHookMessagesForProject({\n hookId: selectedHook.id,\n projectId,\n }),\n getHookAttemptsForProject({\n hookId: selectedHook.id,\n projectId,\n }),\n ])\n } catch (error) {\n const err = error as Error\n logsHookDebug(`Error fetching logs for hook ${selectedHook.id}`, err)\n this.error(`Hook logs retrieval failed:\\n${err.message}`, {exit: exitCodes.RUNTIME_ERROR})\n }\n\n // Group attempts by message ID\n const groupedAttempts = groupBy(attempts, 'messageId')\n\n // Populate messages with attempts\n const populated = messages.map((msg): HookMessage & {attempts: DeliveryAttempt[]} => ({\n ...msg,\n attempts: groupedAttempts[msg.id] || [],\n }))\n\n const totalMessages = messages.length - 1\n\n for (const [i, message] of populated.entries()) {\n this.printMessage(message, {detailed: flags.detailed})\n this.printSeparator(totalMessages === i)\n }\n }\n\n private formatAttemptDate(dateString: string): string {\n try {\n return new Date(dateString).toISOString().replace(/\\.\\d+Z$/, 'Z')\n } catch {\n return dateString // fallback to original if parsing fails\n }\n }\n\n private printMessage(\n message: HookMessage & {attempts: DeliveryAttempt[]},\n options: {detailed?: boolean},\n ) {\n const {detailed} = options\n\n this.log(`Date: ${message.createdAt}`)\n this.log(`Status: ${message.status}`)\n if (message.resultCode) {\n this.log(`Result code: ${message.resultCode}`)\n }\n\n if (message.failureCount > 0) {\n this.log(`Failures: ${message.failureCount}`)\n }\n\n if (detailed) {\n this.log('Payload:')\n try {\n const payload = JSON.parse(message.payload)\n this.log(inspect(payload, {colors: true}))\n } catch (error) {\n this.log(`Payload (raw): ${message.payload}`)\n logsHookDebug('Failed to parse payload JSON:', error)\n }\n }\n\n if (detailed && message.attempts && message.attempts.length > 0) {\n this.log('Attempts:')\n for (const attempt of message.attempts) {\n const date = this.formatAttemptDate(attempt.createdAt)\n const prefix = ` [${date}]`\n\n if (attempt.inProgress) {\n this.log(`${prefix} ${styleText('yellow', 'Pending')}`)\n } else if (attempt.isFailure) {\n const failure = formatFailure(attempt, {includeHelp: true})\n this.log(`${prefix} ${styleText('yellow', `Failure: ${failure}`)}`)\n } else {\n this.log(`${prefix} Success: HTTP ${attempt.resultCode} (${attempt.duration}ms)`)\n }\n }\n }\n\n // Leave some empty space between messages\n this.log('')\n }\n\n private printSeparator(skip: boolean) {\n if (!skip) {\n this.log('---\\n')\n }\n }\n\n private async selectHook(hooks: Hook[]) {\n const hookId = await select({\n choices: hooks.map((hook) => ({\n name: hook.name,\n value: hook.id,\n })),\n message: 'Select hook to list logs for',\n })\n\n return hooks.find((hook) => hook.id === hookId)\n }\n}\n"],"names":["inspect","styleText","Args","Flags","exitCodes","SanityCommand","subdebug","select","groupBy","formatFailure","promptForProject","getHookAttemptsForProject","getHookMessagesForProject","getHooksForProject","getProjectIdFlag","logsHookDebug","LogsHookCommand","args","name","string","description","required","examples","command","flags","semantics","detailed","boolean","hiddenAliases","run","parse","projectId","getProjectId","fallback","requiredPermissions","grant","permission","hooks","error","err","message","exit","RUNTIME_ERROR","length","selectedHook","find","hook","toLowerCase","isUnattended","USAGE_ERROR","selectHook","messages","attempts","Promise","all","hookId","id","groupedAttempts","populated","map","msg","totalMessages","i","entries","printMessage","printSeparator","formatAttemptDate","dateString","Date","toISOString","replace","options","log","createdAt","status","resultCode","failureCount","payload","JSON","colors","attempt","date","prefix","inProgress","isFailure","failure","includeHelp","duration","skip","choices","value"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,SAAS,QAAO,YAAW;AAE5C,SAAQC,IAAI,EAAEC,KAAK,QAAO,cAAa;AACvC,SAAQC,SAAS,EAAEC,aAAa,EAAEC,QAAQ,QAAO,mBAAkB;AACnE,SAAQC,MAAM,QAAO,sBAAqB;AAC1C,OAAOC,aAAa,uBAAsB;AAE1C,SAAQC,aAAa,QAAO,sCAAqC;AAEjE,SAAQC,gBAAgB,QAAO,oCAAmC;AAClE,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,kBAAkB,QACb,0BAAyB;AAChC,SAAQC,gBAAgB,QAAO,4BAA2B;AAE1D,MAAMC,gBAAgBT,SAAS;AAE/B,OAAO,MAAMU,wBAAwBX;IACnC,OAAgBY,OAAO;QACrBC,MAAMhB,KAAKiB,MAAM,CAAC;YAChBC,aAAa;YACbC,UAAU;QACZ;IACF,EAAC;IAED,OAAgBD,cAAc,wCAAuC;IAErE,OAAgBE,WAAW;QACzB;YACEC,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;KACD,CAAA;IAED,OAAgBI,QAAQ;QACtB,GAAGV,iBAAiB;YAClBM,aAAa;YACbK,WAAW;QACb,EAA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;gBAE5B,IAAID,QAAQG,UAAU,EAAE;oBACtB,IAAI,CAACX,GAAG,CAAC,GAAGU,OAAO,CAAC,EAAEjF,UAAU,UAAU,YAAY;gBACxD,OAAO,IAAI+E,QAAQI,SAAS,EAAE;oBAC5B,MAAMC,UAAU5E,cAAcuE,SAAS;wBAACM,aAAa;oBAAI;oBACzD,IAAI,CAACd,GAAG,CAAC,GAAGU,OAAO,CAAC,EAAEjF,UAAU,UAAU,CAAC,SAAS,EAAEoF,SAAS,GAAG;gBACpE,OAAO;oBACL,IAAI,CAACb,GAAG,CAAC,GAAGU,OAAO,eAAe,EAAEF,QAAQL,UAAU,CAAC,EAAE,EAAEK,QAAQO,QAAQ,CAAC,GAAG,CAAC;gBAClF;YACF;QACF;QAEA,0CAA0C;QAC1C,IAAI,CAACf,GAAG,CAAC;IACX;IAEQP,eAAeuB,IAAa,EAAE;QACpC,IAAI,CAACA,MAAM;YACT,IAAI,CAAChB,GAAG,CAAC;QACX;IACF;IAEA,MAActB,WAAWb,KAAa,EAAE;QACtC,MAAMkB,SAAS,MAAMhD,OAAO;YAC1BkF,SAASpD,MAAMsB,GAAG,CAAC,CAACb,OAAU,CAAA;oBAC5B5B,MAAM4B,KAAK5B,IAAI;oBACfwE,OAAO5C,KAAKU,EAAE;gBAChB,CAAA;YACAhB,SAAS;QACX;QAEA,OAAOH,MAAMQ,IAAI,CAAC,CAACC,OAASA,KAAKU,EAAE,KAAKD;IAC1C;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/hooks/logs.ts"],"sourcesContent":["import {inspect, styleText} from 'node:util'\n\nimport {Args, Flags} from '@oclif/core'\nimport {exitCodes, SanityCommand, subdebug} from '@sanity/cli-core'\nimport {select} from '@sanity/cli-core/ux'\n\nimport {formatFailure} from '../../actions/hook/formatFailure.js'\nimport {type DeliveryAttempt, type Hook, type HookMessage} from '../../actions/hook/types'\nimport {promptForProject} from '../../prompts/promptForProject.js'\nimport {\n getHookAttemptsForProject,\n getHookMessagesForProject,\n getHooksForProject,\n} from '../../services/hooks.js'\nimport {getProjectIdFlag} from '../../util/sharedFlags.js'\n\nconst logsHookDebug = subdebug('hook:logs')\n\nexport class LogsHookCommand extends SanityCommand<typeof LogsHookCommand> {\n static override args = {\n name: Args.string({\n description: 'Name of the webhook to show logs for',\n required: false,\n }),\n }\n\n static override description = 'Show log entries for project webhooks'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Show log entries for project webhooks',\n },\n {\n command: '<%= config.bin %> <%= command.id %> [NAME]',\n description: 'Show log entries for a specific webhook by name',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --project-id abc123',\n description: 'Show log entries for a specific project',\n },\n ]\n\n static override flags = {\n ...getProjectIdFlag({\n description: 'Project ID to view webhook logs for',\n semantics: 'override',\n }),\n detailed: Flags.boolean({\n description: 'Include detailed payload and attempts',\n required: false,\n }),\n }\n\n static override hiddenAliases: string[] = ['hook:logs']\n\n public async run() {\n const {args, flags} = await this.parse(LogsHookCommand)\n\n // Ensure we have project context\n const projectId = await this.getProjectId({\n fallback: () =>\n promptForProject({\n requiredPermissions: [{grant: 'read', permission: 'sanity.project.webhooks'}],\n }),\n })\n\n // Get hooks for the project\n let hooks: Hook[]\n try {\n hooks = await getHooksForProject(projectId)\n } catch (error) {\n const err = error as Error\n logsHookDebug(`Error fetching hooks for project ${projectId}`, err)\n this.error(`Hook list retrieval failed:\\n${err.message}`, {exit: exitCodes.RUNTIME_ERROR})\n }\n\n if (hooks.length === 0) {\n this.error('No hooks currently registered', {exit: exitCodes.RUNTIME_ERROR})\n }\n\n // If hook name is provided, find that specific hook\n let selectedHook: Hook | undefined\n if (args.name) {\n selectedHook = hooks.find((hook) => hook.name.toLowerCase() === args.name?.toLowerCase())\n if (!selectedHook) {\n this.error(`Hook with name \"${args.name}\" not found`, {exit: exitCodes.RUNTIME_ERROR})\n }\n } else if (hooks.length === 1) {\n // If only one hook exists, use that\n selectedHook = hooks[0]\n } else {\n // Otherwise prompt user to select a hook\n if (this.isUnattended()) {\n this.error(\n 'Webhook name is required when multiple webhooks exist. Pass the name as an argument.',\n {\n exit: exitCodes.USAGE_ERROR,\n },\n )\n }\n selectedHook = await this.selectHook(hooks)\n }\n\n if (!selectedHook) {\n this.error('No hook selected', {exit: exitCodes.RUNTIME_ERROR})\n }\n\n // Fetch messages and attempts for the selected hook\n let messages: HookMessage[]\n let attempts: DeliveryAttempt[] = []\n try {\n ;[messages, attempts] = await Promise.all([\n getHookMessagesForProject({\n hookId: selectedHook.id,\n projectId,\n }),\n getHookAttemptsForProject({\n hookId: selectedHook.id,\n projectId,\n }),\n ])\n } catch (error) {\n const err = error as Error\n logsHookDebug(`Error fetching logs for hook ${selectedHook.id}`, err)\n this.error(`Hook logs retrieval failed:\\n${err.message}`, {exit: exitCodes.RUNTIME_ERROR})\n }\n\n // Group attempts by message ID\n const groupedAttempts = Object.groupBy(attempts, (attempt) => attempt.messageId)\n\n // Populate messages with attempts\n const populated = messages.map((msg): HookMessage & {attempts: DeliveryAttempt[]} => ({\n ...msg,\n attempts: groupedAttempts[msg.id] || [],\n }))\n\n const totalMessages = messages.length - 1\n\n for (const [i, message] of populated.entries()) {\n this.printMessage(message, {detailed: flags.detailed})\n this.printSeparator(totalMessages === i)\n }\n }\n\n private formatAttemptDate(dateString: string): string {\n try {\n return new Date(dateString).toISOString().replace(/\\.\\d+Z$/, 'Z')\n } catch {\n return dateString // fallback to original if parsing fails\n }\n }\n\n private printMessage(\n message: HookMessage & {attempts: DeliveryAttempt[]},\n options: {detailed?: boolean},\n ) {\n const {detailed} = options\n\n this.log(`Date: ${message.createdAt}`)\n this.log(`Status: ${message.status}`)\n if (message.resultCode) {\n this.log(`Result code: ${message.resultCode}`)\n }\n\n if (message.failureCount > 0) {\n this.log(`Failures: ${message.failureCount}`)\n }\n\n if (detailed) {\n this.log('Payload:')\n try {\n const payload = JSON.parse(message.payload)\n this.log(inspect(payload, {colors: true}))\n } catch (error) {\n this.log(`Payload (raw): ${message.payload}`)\n logsHookDebug('Failed to parse payload JSON:', error)\n }\n }\n\n if (detailed && message.attempts && message.attempts.length > 0) {\n this.log('Attempts:')\n for (const attempt of message.attempts) {\n const date = this.formatAttemptDate(attempt.createdAt)\n const prefix = ` [${date}]`\n\n if (attempt.inProgress) {\n this.log(`${prefix} ${styleText('yellow', 'Pending')}`)\n } else if (attempt.isFailure) {\n const failure = formatFailure(attempt, {includeHelp: true})\n this.log(`${prefix} ${styleText('yellow', `Failure: ${failure}`)}`)\n } else {\n this.log(`${prefix} Success: HTTP ${attempt.resultCode} (${attempt.duration}ms)`)\n }\n }\n }\n\n // Leave some empty space between messages\n this.log('')\n }\n\n private printSeparator(skip: boolean) {\n if (!skip) {\n this.log('---\\n')\n }\n }\n\n private async selectHook(hooks: Hook[]) {\n const hookId = await select({\n choices: hooks.map((hook) => ({\n name: hook.name,\n value: hook.id,\n })),\n message: 'Select hook to list logs for',\n })\n\n return hooks.find((hook) => hook.id === hookId)\n }\n}\n"],"names":["inspect","styleText","Args","Flags","exitCodes","SanityCommand","subdebug","select","formatFailure","promptForProject","getHookAttemptsForProject","getHookMessagesForProject","getHooksForProject","getProjectIdFlag","logsHookDebug","LogsHookCommand","args","name","string","description","required","examples","command","flags","semantics","detailed","boolean","hiddenAliases","run","parse","projectId","getProjectId","fallback","requiredPermissions","grant","permission","hooks","error","err","message","exit","RUNTIME_ERROR","length","selectedHook","find","hook","toLowerCase","isUnattended","USAGE_ERROR","selectHook","messages","attempts","Promise","all","hookId","id","groupedAttempts","Object","groupBy","attempt","messageId","populated","map","msg","totalMessages","i","entries","printMessage","printSeparator","formatAttemptDate","dateString","Date","toISOString","replace","options","log","createdAt","status","resultCode","failureCount","payload","JSON","colors","date","prefix","inProgress","isFailure","failure","includeHelp","duration","skip","choices","value"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,SAAS,QAAO,YAAW;AAE5C,SAAQC,IAAI,EAAEC,KAAK,QAAO,cAAa;AACvC,SAAQC,SAAS,EAAE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E;QACpC,IAAI,CAACA,MAAM;YACT,IAAI,CAACf,GAAG,CAAC;QACX;IACF;IAEA,MAAc1B,WAAWb,KAAa,EAAE;QACtC,MAAMkB,SAAS,MAAM/C,OAAO;YAC1BoF,SAASvD,MAAM0B,GAAG,CAAC,CAACjB,OAAU,CAAA;oBAC5B5B,MAAM4B,KAAK5B,IAAI;oBACf2E,OAAO/C,KAAKU,EAAE;gBAChB,CAAA;YACAhB,SAAS;QACX;QAEA,OAAOH,MAAMQ,IAAI,CAAC,CAACC,OAASA,KAAKU,EAAE,KAAKD;IAC1C;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { exitCodes, SanityCommand, subdebug } from '@sanity/cli-core';
|
|
3
|
-
import sortBy from 'lodash-es/sortBy.js';
|
|
4
3
|
import { getManageUrl } from '../../actions/projects/getManageUrl.js';
|
|
5
4
|
import { listProjects } from '../../services/projects.js';
|
|
6
5
|
import { Table } from '../../util/responsiveTable.js';
|
|
6
|
+
import { sortRowsByColumn } from '../../util/sortRowsByColumn.js';
|
|
7
7
|
const sortFields = [
|
|
8
8
|
'id',
|
|
9
9
|
'members',
|
|
@@ -46,7 +46,7 @@ export class List extends SanityCommand {
|
|
|
46
46
|
const { order, sort } = this.flags;
|
|
47
47
|
try {
|
|
48
48
|
const projects = await listProjects();
|
|
49
|
-
const ordered =
|
|
49
|
+
const ordered = sortRowsByColumn(projects.map(({ createdAt, displayName, id, members = [] })=>{
|
|
50
50
|
const manage = getManageUrl(id);
|
|
51
51
|
return [
|
|
52
52
|
id,
|
|
@@ -55,9 +55,7 @@ export class List extends SanityCommand {
|
|
|
55
55
|
manage,
|
|
56
56
|
createdAt
|
|
57
57
|
].map(String);
|
|
58
|
-
}),
|
|
59
|
-
sortFields.indexOf(sort)
|
|
60
|
-
]);
|
|
58
|
+
}), sortFields.indexOf(sort));
|
|
61
59
|
const rows = order === 'asc' ? ordered : ordered.toReversed();
|
|
62
60
|
const table = new Table({
|
|
63
61
|
columns: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/projects/list.ts"],"sourcesContent":["import {Flags} from '@oclif/core'\nimport {exitCodes, SanityCommand, subdebug} from '@sanity/cli-core'\
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/projects/list.ts"],"sourcesContent":["import {Flags} from '@oclif/core'\nimport {exitCodes, SanityCommand, subdebug} from '@sanity/cli-core'\n\nimport {getManageUrl} from '../../actions/projects/getManageUrl.js'\nimport {listProjects} from '../../services/projects.js'\nimport {Table} from '../../util/responsiveTable.js'\nimport {sortRowsByColumn} from '../../util/sortRowsByColumn.js'\n\nconst sortFields = ['id', 'members', 'name', 'url', 'created']\n\nconst projectsDebug = subdebug('projects')\n\nexport class List extends SanityCommand<typeof List> {\n static override description = 'List your projects'\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'List projects',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --sort=members --order=asc',\n description: 'List projects sorted by member count, ascending',\n },\n ]\n\n static override flags = {\n order: Flags.string({\n default: 'desc',\n description: 'Sort direction',\n options: ['asc', 'desc'],\n }),\n sort: Flags.string({\n default: 'created',\n description: 'Sort field',\n options: sortFields,\n }),\n }\n\n static override hiddenAliases: string[] = ['project:list']\n\n public async run() {\n const {order, sort} = this.flags\n\n try {\n const projects = await listProjects()\n const ordered = sortRowsByColumn(\n projects.map(({createdAt, displayName, id, members = []}) => {\n const manage = getManageUrl(id)\n return [id, members.length, displayName, manage, createdAt].map(String)\n }),\n sortFields.indexOf(sort),\n )\n\n const rows = order === 'asc' ? ordered : ordered.toReversed()\n const table = new Table({\n columns: [\n {alignment: 'left', name: 'id', title: 'ID'},\n {alignment: 'left', name: 'members', title: 'Members'},\n {alignment: 'left', name: 'name', title: 'Name'},\n {alignment: 'left', name: 'url', title: 'URL'},\n {alignment: 'left', name: 'created', title: 'Created'},\n ],\n })\n\n for (const [id, members, name, url, created] of rows) {\n table.addRow({created: created.split('T')[0], id, members, name, url})\n }\n\n this.log(table.render())\n } catch (error) {\n projectsDebug('Error listing projects', error)\n this.error('Failed to list projects', {exit: exitCodes.RUNTIME_ERROR})\n }\n }\n}\n"],"names":["Flags","exitCodes","SanityCommand","subdebug","getManageUrl","listProjects","Table","sortRowsByColumn","sortFields","projectsDebug","List","description","examples","command","flags","order","string","default","options","sort","hiddenAliases","run","projects","ordered","map","createdAt","displayName","id","members","manage","length","String","indexOf","rows","toReversed","table","columns","alignment","name","title","url","created","addRow","split","log","render","error","exit","RUNTIME_ERROR"],"mappings":"AAAA,SAAQA,KAAK,QAAO,cAAa;AACjC,SAAQC,SAAS,EAAEC,aAAa,EAAEC,QAAQ,QAAO,mBAAkB;AAEnE,SAAQC,YAAY,QAAO,yCAAwC;AACnE,SAAQC,YAAY,QAAO,6BAA4B;AACvD,SAAQC,KAAK,QAAO,gCAA+B;AACnD,SAAQC,gBAAgB,QAAO,iCAAgC;AAE/D,MAAMC,aAAa;IAAC;IAAM;IAAW;IAAQ;IAAO;CAAU;AAE9D,MAAMC,gBAAgBN,SAAS;AAE/B,OAAO,MAAMO,aAAaR;IACxB,OAAgBS,cAAc,qBAAoB;IAClD,OAAgBC,WAAW;QACzB;YACEC,SAAS;YACTF,aAAa;QACf;QACA;YACEE,SAAS;YACTF,aAAa;QACf;KACD,CAAA;IAED,OAAgBG,QAAQ;QACtBC,OAAOf,MAAMgB,MAAM,CAAC;YAClBC,SAAS;YACTN,aAAa;YACbO,SAAS;gBAAC;gBAAO;aAAO;QAC1B;QACAC,MAAMnB,MAAMgB,MAAM,CAAC;YACjBC,SAAS;YACTN,aAAa;YACbO,SAASV;QACX;IACF,EAAC;IAED,OAAgBY,gBAA0B;QAAC;KAAe,CAAA;IAE1D,MAAaC,MAAM;QACjB,MAAM,EAACN,KAAK,EAAEI,IAAI,EAAC,GAAG,IAAI,CAACL,KAAK;QAEhC,IAAI;YACF,MAAMQ,WAAW,MAAMjB;YACvB,MAAMkB,UAAUhB,iBACde,SAASE,GAAG,CAAC,CAAC,EAACC,SAAS,EAAEC,WAAW,EAAEC,EAAE,EAAEC,UAAU,EAAE,EAAC;gBACtD,MAAMC,SAASzB,aAAauB;gBAC5B,OAAO;oBAACA;oBAAIC,QAAQE,MAAM;oBAAEJ;oBAAaG;oBAAQJ;iBAAU,CAACD,GAAG,CAACO;YAClE,IACAvB,WAAWwB,OAAO,CAACb;YAGrB,MAAMc,OAAOlB,UAAU,QAAQQ,UAAUA,QAAQW,UAAU;YAC3D,MAAMC,QAAQ,IAAI7B,MAAM;gBACtB8B,SAAS;oBACP;wBAACC,WAAW;wBAAQC,MAAM;wBAAMC,OAAO;oBAAI;oBAC3C;wBAACF,WAAW;wBAAQC,MAAM;wBAAWC,OAAO;oBAAS;oBACrD;wBAACF,WAAW;wBAAQC,MAAM;wBAAQC,OAAO;oBAAM;oBAC/C;wBAACF,WAAW;wBAAQC,MAAM;wBAAOC,OAAO;oBAAK;oBAC7C;wBAACF,WAAW;wBAAQC,MAAM;wBAAWC,OAAO;oBAAS;iBACtD;YACH;YAEA,KAAK,MAAM,CAACZ,IAAIC,SAASU,MAAME,KAAKC,QAAQ,IAAIR,KAAM;gBACpDE,MAAMO,MAAM,CAAC;oBAACD,SAASA,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;oBAAEhB;oBAAIC;oBAASU;oBAAME;gBAAG;YACtE;YAEA,IAAI,CAACI,GAAG,CAACT,MAAMU,MAAM;QACvB,EAAE,OAAOC,OAAO;YACdrC,cAAc,0BAA0BqC;YACxC,IAAI,CAACA,KAAK,CAAC,2BAA2B;gBAACC,MAAM9C,UAAU+C,aAAa;YAAA;QACtE;IACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { SanityCommand } from '@sanity/cli-core';
|
|
3
|
-
import { getWorkbench } from '@sanity/workbench-cli/deploy';
|
|
3
|
+
import { getWorkbench, resolveWorkbenchConfig } from '@sanity/workbench-cli/deploy';
|
|
4
4
|
import { createWorkbenchUndeployAdapter } from '@sanity/workbench-cli/undeploy';
|
|
5
5
|
import { createAppUndeployAdapter, createStudioUndeployAdapter } from '../actions/undeploy/adapters.js';
|
|
6
6
|
import { runUndeploy } from '../actions/undeploy/runUndeploy.js';
|
|
@@ -42,14 +42,16 @@ export class UndeployCommand extends SanityCommand {
|
|
|
42
42
|
const { flags } = await this.parse(UndeployCommand);
|
|
43
43
|
const cliConfig = await this.getCliConfig();
|
|
44
44
|
const isApp = determineIsApp(cliConfig);
|
|
45
|
-
// Workbench apps deploy through Brett, so they undeploy through
|
|
46
|
-
// plain projects keep the user-applications backend.
|
|
45
|
+
// Workbench apps and configs deploy through Brett, so they undeploy through
|
|
46
|
+
// it too; plain projects keep the user-applications backend.
|
|
47
47
|
const workbench = getWorkbench(cliConfig);
|
|
48
|
-
const
|
|
48
|
+
const config = resolveWorkbenchConfig(cliConfig);
|
|
49
|
+
const adapter = workbench || config ? createWorkbenchUndeployAdapter({
|
|
49
50
|
appId: getAppId(cliConfig),
|
|
51
|
+
config: config ?? undefined,
|
|
50
52
|
organizationId: cliConfig.app?.organizationId,
|
|
51
53
|
type: isApp ? 'coreApp' : 'studio',
|
|
52
|
-
workbench
|
|
54
|
+
workbench: workbench ?? undefined
|
|
53
55
|
}) : isApp ? createAppUndeployAdapter(cliConfig) : createStudioUndeployAdapter(cliConfig);
|
|
54
56
|
await runUndeploy({
|
|
55
57
|
flags,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/undeploy.ts"],"sourcesContent":["import {Flags} from '@oclif/core'\nimport {SanityCommand} from '@sanity/cli-core'\nimport {type UndeployAdapter} from '@sanity/cli-core/undeploy'\nimport {getWorkbench} from '@sanity/workbench-cli/deploy'\nimport {createWorkbenchUndeployAdapter} from '@sanity/workbench-cli/undeploy'\n\nimport {\n createAppUndeployAdapter,\n createStudioUndeployAdapter,\n} from '../actions/undeploy/adapters.js'\nimport {runUndeploy} from '../actions/undeploy/runUndeploy.js'\nimport {getAppId} from '../util/appId.js'\nimport {determineIsApp} from '../util/determineIsApp.js'\n\nexport class UndeployCommand extends SanityCommand<typeof UndeployCommand> {\n static override description = 'Removes the deployed Sanity Studio/App from Sanity hosting'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Undeploy the studio or application after confirming',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --dry-run',\n description: 'Report what would be undeployed without deleting anything',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --json --yes',\n description: 'Undeploy without prompting and report the result as JSON',\n },\n ]\n\n static override flags = {\n 'dry-run': Flags.boolean({\n default: false,\n description: 'Report what would be undeployed without deleting anything',\n }),\n json: Flags.boolean({\n char: 'j',\n default: false,\n description: 'Output the result as JSON',\n }),\n yes: Flags.boolean({\n char: 'y',\n default: false,\n description:\n 'Unattended mode, answers \"yes\" to any \"yes/no\" prompt and otherwise uses defaults',\n }),\n }\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(UndeployCommand)\n\n const cliConfig = await this.getCliConfig()\n const isApp = determineIsApp(cliConfig)\n\n // Workbench apps deploy through Brett, so they undeploy through it too
|
|
1
|
+
{"version":3,"sources":["../../src/commands/undeploy.ts"],"sourcesContent":["import {Flags} from '@oclif/core'\nimport {SanityCommand} from '@sanity/cli-core'\nimport {type UndeployAdapter} from '@sanity/cli-core/undeploy'\nimport {getWorkbench, resolveWorkbenchConfig} from '@sanity/workbench-cli/deploy'\nimport {createWorkbenchUndeployAdapter} from '@sanity/workbench-cli/undeploy'\n\nimport {\n createAppUndeployAdapter,\n createStudioUndeployAdapter,\n} from '../actions/undeploy/adapters.js'\nimport {runUndeploy} from '../actions/undeploy/runUndeploy.js'\nimport {getAppId} from '../util/appId.js'\nimport {determineIsApp} from '../util/determineIsApp.js'\n\nexport class UndeployCommand extends SanityCommand<typeof UndeployCommand> {\n static override description = 'Removes the deployed Sanity Studio/App from Sanity hosting'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'Undeploy the studio or application after confirming',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --dry-run',\n description: 'Report what would be undeployed without deleting anything',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --json --yes',\n description: 'Undeploy without prompting and report the result as JSON',\n },\n ]\n\n static override flags = {\n 'dry-run': Flags.boolean({\n default: false,\n description: 'Report what would be undeployed without deleting anything',\n }),\n json: Flags.boolean({\n char: 'j',\n default: false,\n description: 'Output the result as JSON',\n }),\n yes: Flags.boolean({\n char: 'y',\n default: false,\n description:\n 'Unattended mode, answers \"yes\" to any \"yes/no\" prompt and otherwise uses defaults',\n }),\n }\n\n public async run(): Promise<void> {\n const {flags} = await this.parse(UndeployCommand)\n\n const cliConfig = await this.getCliConfig()\n const isApp = determineIsApp(cliConfig)\n\n // Workbench apps and configs deploy through Brett, so they undeploy through\n // it too; plain projects keep the user-applications backend.\n const workbench = getWorkbench(cliConfig)\n const config = resolveWorkbenchConfig(cliConfig)\n const adapter: UndeployAdapter =\n workbench || config\n ? createWorkbenchUndeployAdapter({\n appId: getAppId(cliConfig),\n config: config ?? undefined,\n organizationId: cliConfig.app?.organizationId,\n type: isApp ? 'coreApp' : 'studio',\n workbench: workbench ?? undefined,\n })\n : isApp\n ? createAppUndeployAdapter(cliConfig)\n : createStudioUndeployAdapter(cliConfig)\n\n await runUndeploy({flags, isUnattended: this.isUnattended(), output: this.output}, adapter)\n }\n}\n"],"names":["Flags","SanityCommand","getWorkbench","resolveWorkbenchConfig","createWorkbenchUndeployAdapter","createAppUndeployAdapter","createStudioUndeployAdapter","runUndeploy","getAppId","determineIsApp","UndeployCommand","description","examples","command","flags","boolean","default","json","char","yes","run","parse","cliConfig","getCliConfig","isApp","workbench","config","adapter","appId","undefined","organizationId","app","type","isUnattended","output"],"mappings":"AAAA,SAAQA,KAAK,QAAO,cAAa;AACjC,SAAQC,aAAa,QAAO,mBAAkB;AAE9C,SAAQC,YAA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QAAA,GAAGP;IACrF;AACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { styleText } from 'node:util';
|
|
2
2
|
import { Flags } from '@oclif/core';
|
|
3
3
|
import { SanityCommand } from '@sanity/cli-core';
|
|
4
|
-
import sortBy from 'lodash-es/sortBy.js';
|
|
5
4
|
import { getMembersForProject } from '../../actions/users/getMembersForProject.js';
|
|
6
5
|
import { promptForProject } from '../../prompts/promptForProject.js';
|
|
7
6
|
import { Table } from '../../util/responsiveTable.js';
|
|
8
7
|
import { getProjectIdFlag } from '../../util/sharedFlags.js';
|
|
8
|
+
import { sortRowsByColumn } from '../../util/sortRowsByColumn.js';
|
|
9
9
|
const sortFields = [
|
|
10
10
|
'id',
|
|
11
11
|
'name',
|
|
@@ -97,14 +97,12 @@ export class List extends SanityCommand {
|
|
|
97
97
|
this.log('No members found for this project.');
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
const ordered =
|
|
100
|
+
const ordered = sortRowsByColumn(members.map(({ date, id, name, roles })=>[
|
|
101
101
|
id,
|
|
102
102
|
name,
|
|
103
103
|
roles?.map((role)=>role.title).join(', ').trim() || '-',
|
|
104
104
|
date
|
|
105
|
-
]),
|
|
106
|
-
sortFields.indexOf(sort)
|
|
107
|
-
]);
|
|
105
|
+
]), sortFields.indexOf(sort));
|
|
108
106
|
const rows = (order === 'asc' ? ordered : ordered.toReversed()).map(([id, name, roles, date])=>[
|
|
109
107
|
id,
|
|
110
108
|
name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/users/list.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {Flags} from '@oclif/core'\nimport {SanityCommand} from '@sanity/cli-core'\
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/users/list.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {Flags} from '@oclif/core'\nimport {SanityCommand} from '@sanity/cli-core'\n\nimport {getMembersForProject} from '../../actions/users/getMembersForProject.js'\nimport {promptForProject} from '../../prompts/promptForProject.js'\nimport {Table} from '../../util/responsiveTable.js'\nimport {getProjectIdFlag} from '../../util/sharedFlags.js'\nimport {sortRowsByColumn} from '../../util/sortRowsByColumn.js'\n\nconst sortFields = ['id', 'name', 'role', 'date']\n\nfunction dimText(value: string, isDim: boolean): string {\n return isDim ? styleText('dim', value) : value\n}\n\nexport class List extends SanityCommand<typeof List> {\n static override description = 'List project members'\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %>',\n description: 'List all users of the project',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --no-invitations --no-robots',\n description: 'List all users of the project, but exclude pending invitations and robots',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --sort role',\n description: 'List all users, sorted by role',\n },\n {\n command: '<%= config.bin %> <%= command.id %> --project-id abc123',\n description: 'List users for a specific project',\n },\n ]\n static override flags = {\n ...getProjectIdFlag({\n description: 'Project ID to list users for',\n semantics: 'override',\n }),\n invitations: Flags.boolean({\n allowNo: true,\n default: true,\n description: 'Includes or excludes pending invitations',\n }),\n order: Flags.string({\n default: 'asc',\n description: 'Sort output ascending/descending',\n options: ['asc', 'desc'],\n }),\n robots: Flags.boolean({\n allowNo: true,\n default: true,\n description: 'Includes or excludes robots (token users)',\n }),\n sort: Flags.string({\n default: 'date',\n description: 'Sort users by specified column',\n options: ['id', 'name', 'role', 'date'],\n }),\n }\n\n static override hiddenAliases: string[] = ['user:list']\n\n public async run(): Promise<void> {\n const {invitations, order, robots, sort} = this.flags\n\n const projectId = await this.getProjectId({\n fallback: () =>\n promptForProject({\n requiredPermissions: [\n {grant: 'read', permission: 'sanity.project'},\n {grant: 'read', permission: 'sanity.project.members'},\n ],\n }),\n })\n\n const members = await getMembersForProject({\n includeInvitations: invitations,\n includeRobots: robots,\n projectId,\n })\n\n if (members.length === 0) {\n this.log('No members found for this project.')\n return\n }\n\n const ordered = sortRowsByColumn(\n members.map(({date, id, name, roles}) => [\n id,\n name,\n roles\n ?.map((role) => role.title)\n .join(', ')\n .trim() || '-',\n date,\n ]),\n sortFields.indexOf(sort),\n )\n\n const rows = (order === 'asc' ? ordered : ordered.toReversed()).map(\n ([id, name, roles, date]) => [id, name, roles, date.split('T')[0]],\n )\n\n const table = new Table({\n columns: [\n {alignment: 'left', name: 'id', title: 'ID'},\n {alignment: 'left', name: 'name', title: 'Name'},\n {alignment: 'left', name: 'roles', title: 'Roles'},\n {alignment: 'left', name: 'date', title: 'Date'},\n ],\n })\n\n for (const [id, name, roles, date] of rows) {\n const isPending = id === '<pending>'\n table.addRow({\n date: dimText(date, isPending),\n id: dimText(id, isPending),\n name: dimText(name, isPending),\n roles: dimText(roles, isPending),\n })\n }\n\n this.log(table.render())\n }\n}\n"],"names":["styleText","Flags","SanityCommand","getMembersForProject","promptForProject","Table","getProjectIdFlag","sortRowsByColumn","sortFields","dimText","value","isDim","List","description","examples","command","flags","semantics","invitations","boolean","allowNo","default","order","string","options","robots","sort","hiddenAliases","run","projectId","getProjectId","fallback","requiredPermissions","grant","permission","members","includeInvitations","includeRobots","length","log","ordered","map","date","id","name","roles","role","title","join","trim","indexOf","rows","toReversed","split","table","columns","alignment","isPending","addRow","render"],"mappings":"AAAA,SAAQA,SAAS,QAAO,YAAW;AAEnC,SAAQC,KAAK,QAAO,cAAa;AACjC,SAAQC,aAAa,QAAO,mBAAkB;AAE9C,SAAQC,oBAAoB,QAAO,8CAA6C;AAChF,SAAQC,gBAAgB,QAAO,oCAAmC;AAClE,SAAQC,KAAK,QAAO,gCAA+B;AACnD,SAAQC,gBAAgB,QAAO,4BAA2B;AAC1D,SAAQC,gBAAgB,QAAO,iCAAgC;AAE/D,MAAMC,aAAa;IAAC;IAAM;IAAQ;IAAQ;CAAO;AAEjD,SAASC,QAAQC,KAAa,EAAEC,KAAc;IAC5C,OAAOA,QAAQX,UAAU,OAAOU,SAASA;AAC3C;AAEA,OAAO,MAAME,aAAaV;IACxB,OAAgBW,cAAc,uBAAsB;IACpD,OAAgBC,WAAW;QACzB;YAC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;gBACvCF;gBACAC;gBACAC,OACIJ,IAAI,CAACK,OAASA,KAAKC,KAAK,EACzBC,KAAK,MACLC,UAAU;gBACbP;aACD,GACDlC,WAAW0C,OAAO,CAACxB;QAGrB,MAAMyB,OAAO,AAAC7B,CAAAA,UAAU,QAAQkB,UAAUA,QAAQY,UAAU,EAAC,EAAGX,GAAG,CACjE,CAAC,CAACE,IAAIC,MAAMC,OAAOH,KAAK,GAAK;gBAACC;gBAAIC;gBAAMC;gBAAOH,KAAKW,KAAK,CAAC,IAAI,CAAC,EAAE;aAAC;QAGpE,MAAMC,QAAQ,IAAIjD,MAAM;YACtBkD,SAAS;gBACP;oBAACC,WAAW;oBAAQZ,MAAM;oBAAMG,OAAO;gBAAI;gBAC3C;oBAACS,WAAW;oBAAQZ,MAAM;oBAAQG,OAAO;gBAAM;gBAC/C;oBAACS,WAAW;oBAAQZ,MAAM;oBAASG,OAAO;gBAAO;gBACjD;oBAACS,WAAW;oBAAQZ,MAAM;oBAAQG,OAAO;gBAAM;aAChD;QACH;QAEA,KAAK,MAAM,CAACJ,IAAIC,MAAMC,OAAOH,KAAK,IAAIS,KAAM;YAC1C,MAAMM,YAAYd,OAAO;YACzBW,MAAMI,MAAM,CAAC;gBACXhB,MAAMjC,QAAQiC,MAAMe;gBACpBd,IAAIlC,QAAQkC,IAAIc;gBAChBb,MAAMnC,QAAQmC,MAAMa;gBACpBZ,OAAOpC,QAAQoC,OAAOY;YACxB;QACF;QAEA,IAAI,CAAClB,GAAG,CAACe,MAAMK,MAAM;IACvB;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { styleText } from 'node:util';
|
|
2
2
|
import { SanityCommand } from '@sanity/cli-core';
|
|
3
|
-
import padStart from 'lodash-es/padStart.js';
|
|
4
3
|
import { findSanityModulesVersions } from '../actions/versions/findSanityModulesVersions.js';
|
|
5
4
|
import { getDisplayName, getFormatters } from '../actions/versions/getFormatters.js';
|
|
6
5
|
import { versionsDebug } from '../actions/versions/versionsDebug.js';
|
|
@@ -17,7 +16,7 @@ export class Versions extends SanityCommand {
|
|
|
17
16
|
versionsDebug('resolved versions:', versions);
|
|
18
17
|
const { formatName, versionLength } = getFormatters(versions);
|
|
19
18
|
for (const mod of versions){
|
|
20
|
-
const version =
|
|
19
|
+
const version = (mod.installed || '<missing>').padStart(versionLength);
|
|
21
20
|
const latest = mod.installed === mod.latest ? styleText('green', '(up to date)') : `(latest: ${styleText('yellow', mod.latest)})`;
|
|
22
21
|
this.log(`${formatName(getDisplayName(mod))} ${version} ${latest}`);
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/versions.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {SanityCommand} from '@sanity/cli-core'\
|
|
1
|
+
{"version":3,"sources":["../../src/commands/versions.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {SanityCommand} from '@sanity/cli-core'\n\nimport {findSanityModulesVersions} from '../actions/versions/findSanityModulesVersions.js'\nimport {getDisplayName, getFormatters} from '../actions/versions/getFormatters.js'\nimport {versionsDebug} from '../actions/versions/versionsDebug.js'\n\nexport class Versions extends SanityCommand<typeof Versions> {\n static override description = 'Show installed package versions'\n static override examples = ['<%= config.bin %> <%= command.id %>']\n\n public async run(): Promise<void> {\n const root = (await this.getProjectRoot()).directory\n\n const versions = await findSanityModulesVersions({cwd: root})\n\n versionsDebug('resolved versions:', versions)\n\n const {formatName, versionLength} = getFormatters(versions)\n for (const mod of versions) {\n const version = (mod.installed || '<missing>').padStart(versionLength)\n const latest =\n mod.installed === mod.latest\n ? styleText('green', '(up to date)')\n : `(latest: ${styleText('yellow', mod.latest)})`\n\n this.log(`${formatName(getDisplayName(mod))} ${version} ${latest}`)\n }\n }\n}\n"],"names":["styleText","SanityCommand","findSanityModulesVersions","getDisplayName","getFormatters","versionsDebug","Versions","description","examples","run","root","getProjectRoot","directory","versions","cwd","formatName","versionLength","mod","version","installed","padStart","latest","log"],"mappings":"AAAA,SAAQA,SAAS,QAAO,YAAW;AAEnC,SAAQC,aAAa,QAAO,mBAAkB;AAE9C,SAAQC,yBAAyB,QAAO,mDAAkD;AAC1F,SAAQC,cAAc,EAAEC,aAAa,QAAO,uCAAsC;AAClF,SAAQC,aAAa,QAAO,uCAAsC;AAElE,OAAO,MAAMC,iBAAiBL;IAC5B,OAAgBM,cAAc,kCAAiC;IAC/D,OAAgBC,WAAW;QAAC;KAAsC,CAAA;IAElE,MAAaC,MAAqB;QAChC,MAAMC,OAAO,AAAC,CAAA,MAAM,IAAI,CAACC,cAAc,EAAC,EAAGC,SAAS;QAEpD,MAAMC,WAAW,MAAMX,0BAA0B;YAACY,KAAKJ;QAAI;QAE3DL,cAAc,sBAAsBQ;QAEpC,MAAM,EAACE,UAAU,EAAEC,aAAa,EAAC,GAAGZ,cAAcS;QAClD,KAAK,MAAMI,OAAOJ,SAAU;YAC1B,MAAMK,UAAU,AAACD,CAAAA,IAAIE,SAAS,IAAI,WAAU,EAAGC,QAAQ,CAACJ;YACxD,MAAMK,SACJJ,IAAIE,SAAS,KAAKF,IAAII,MAAM,GACxBrB,UAAU,SAAS,kBACnB,CAAC,SAAS,EAAEA,UAAU,UAAUiB,IAAII,MAAM,EAAE,CAAC,CAAC;YAEpD,IAAI,CAACC,GAAG,CAAC,GAAGP,WAAWZ,eAAec,MAAM,CAAC,EAAEC,QAAQ,CAAC,EAAEG,QAAQ;QACpE;IACF;AACF"}
|
|
@@ -1,72 +1,6 @@
|
|
|
1
|
-
import { Schema } from "@sanity/types";
|
|
2
|
-
import "sanity";
|
|
3
|
-
import "zod/mini";
|
|
4
|
-
import "@sanity/cli-core";
|
|
5
1
|
import { Interfaces } from "@oclif/core";
|
|
6
2
|
import { StudioEnvVariablesOptions, getStudioEnvironmentVariables } from "@sanity/cli-build/_internal/env";
|
|
7
|
-
|
|
8
|
-
[k: string]: ManifestSerializable;
|
|
9
|
-
};
|
|
10
|
-
interface ManifestSchemaType {
|
|
11
|
-
name: string;
|
|
12
|
-
type: string;
|
|
13
|
-
deprecated?: {
|
|
14
|
-
reason: string;
|
|
15
|
-
};
|
|
16
|
-
fields?: ManifestField[];
|
|
17
|
-
fieldsets?: ManifestFieldset[];
|
|
18
|
-
hidden?: 'conditional' | boolean;
|
|
19
|
-
lists?: ManifestTitledValue[];
|
|
20
|
-
marks?: {
|
|
21
|
-
annotations?: ManifestArrayMember[];
|
|
22
|
-
decorators?: ManifestTitledValue[];
|
|
23
|
-
};
|
|
24
|
-
of?: ManifestArrayMember[];
|
|
25
|
-
options?: Record<string, ManifestSerializable>;
|
|
26
|
-
preview?: {
|
|
27
|
-
select: Record<string, string>;
|
|
28
|
-
};
|
|
29
|
-
readOnly?: 'conditional' | boolean;
|
|
30
|
-
styles?: ManifestTitledValue[];
|
|
31
|
-
title?: string;
|
|
32
|
-
to?: ManifestReferenceMember[];
|
|
33
|
-
validation?: ManifestValidationGroup[];
|
|
34
|
-
}
|
|
35
|
-
interface ManifestFieldset {
|
|
36
|
-
[index: string]: ManifestSerializable | undefined;
|
|
37
|
-
name: string;
|
|
38
|
-
title?: string;
|
|
39
|
-
}
|
|
40
|
-
interface ManifestTitledValue {
|
|
41
|
-
value: string;
|
|
42
|
-
title?: string;
|
|
43
|
-
}
|
|
44
|
-
type ManifestArrayMember = Omit<ManifestSchemaType, 'name'> & {
|
|
45
|
-
name?: string;
|
|
46
|
-
};
|
|
47
|
-
type ManifestReferenceMember = Omit<ManifestSchemaType, 'name'> & {
|
|
48
|
-
name?: string;
|
|
49
|
-
};
|
|
50
|
-
type ManifestField = ManifestSchemaType & {
|
|
51
|
-
fieldset?: string;
|
|
52
|
-
};
|
|
53
|
-
interface ManifestValidationGroup {
|
|
54
|
-
rules: ManifestValidationRule[];
|
|
55
|
-
level?: 'error' | 'info' | 'warning';
|
|
56
|
-
message?: string;
|
|
57
|
-
}
|
|
58
|
-
type ManifestValidationRule = {
|
|
59
|
-
[index: string]: ManifestSerializable | undefined;
|
|
60
|
-
constraint?: ManifestSerializable;
|
|
61
|
-
flag: string;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Extracts all serializable properties from userland schema types,
|
|
65
|
-
* so they best-effort can be used as definitions for Schema.compile.
|
|
66
|
-
*
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
declare function extractManifestSchemaTypes(schema: Schema, workDir: string): Promise<ManifestSchemaType[]>;
|
|
3
|
+
import { extractManifestSchemaTypes } from "@sanity/cli-build/_internal/manifest";
|
|
70
4
|
interface RedactedFlag {
|
|
71
5
|
canonical: string;
|
|
72
6
|
flags: readonly string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { extractManifestSchemaTypes } from '../actions/manifest/extractWorkspaceManifest.js';
|
|
2
1
|
export { defineCommandTelemetry } from '../util/telemetry/commandTelemetry.js';
|
|
3
2
|
export { getStudioEnvironmentVariables } from '@sanity/cli-build/_internal/env';
|
|
3
|
+
export { extractManifestSchemaTypes } from '@sanity/cli-build/_internal/manifest';
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=_internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/_internal.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../../src/exports/_internal.ts"],"sourcesContent":["export {type CommandTelemetry, defineCommandTelemetry} from '../util/telemetry/commandTelemetry.js'\nexport {\n getStudioEnvironmentVariables,\n type StudioEnvVariablesOptions,\n} from '@sanity/cli-build/_internal/env'\nexport {extractManifestSchemaTypes} from '@sanity/cli-build/_internal/manifest'\n"],"names":["defineCommandTelemetry","getStudioEnvironmentVariables","extractManifestSchemaTypes"],"mappings":"AAAA,SAA+BA,sBAAsB,QAAO,wCAAuC;AACnG,SACEC,6BAA6B,QAExB,kCAAiC;AACxC,SAAQC,0BAA0B,QAAO,uCAAsC"}
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ 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 { DefineAppInput, DefineMediaLibraryInput, MediaLibraryField, unstable_defineApp, unstable_defineMediaLibrary } from "@sanity/workbench-cli";
|
|
5
|
+
import { AssetSourceView, DefineAppInput, DefineAssetSourceViewInput, DefineMediaLibraryInput, DefinePanelViewInput, DefineTileViewInput, DefineWebWorkerInput, DefineWindowViewInput, MediaLibraryField, PanelView, TileView, ViewDeclaration, WebWorker, WindowView, defineApplication, defineApplication as unstable_defineApp, defineAssetSourceView, 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 CliApiConfig, type CliClientOptions, type CliConfig, type DefineAppInput, type DefineMediaLibraryInput, type GraphQLAPIConfig, type MediaLibraryField, type UserViteConfig, createCliConfig, defineCliConfig, getCliClient, loadEnv, unstable_defineApp, unstable_defineMediaLibrary };
|
|
97
|
+
export { type AssetSourceView, 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 PanelView, type TileView, type UserViteConfig, type ViewDeclaration, type WebWorker, type WindowView, createCliConfig, defineApplication, defineAssetSourceView, defineCliConfig, definePanelView, defineTileView, defineWebWorker, defineWindowView, getCliClient, loadEnv, unstable_defineApp, unstable_defineMediaLibrary };
|
|
98
98
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/exports/index.js
CHANGED
|
@@ -2,6 +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 {
|
|
5
|
+
export { defineApplication, defineAssetSourceView, definePanelView, defineTileView, defineWebWorker, defineWindowView, // `sanity/cli` imports this compatibility name from `@sanity/cli`.
|
|
6
|
+
defineApplication as unstable_defineApp, unstable_defineMediaLibrary } from '@sanity/workbench-cli';
|
|
6
7
|
|
|
7
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 DefineAppInput,\n type DefineMediaLibraryInput,\n type MediaLibraryField,\n unstable_defineApp,\n unstable_defineMediaLibrary,\n} from '@sanity/workbench-cli'\n"],"names":["createCliConfig","defineCliConfig","getCliClient","loadEnv","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,
|
|
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 AssetSourceView,\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 PanelView,\n type TileView,\n // `sanity/cli` imports this compatibility name from `@sanity/cli`.\n defineApplication as unstable_defineApp,\n unstable_defineMediaLibrary,\n type ViewDeclaration,\n type WebWorker,\n type WindowView,\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,EAGrBC,eAAe,EAEfC,cAAc,EAEdC,eAAe,EAEfC,gBAAgB,EAKhB,mEAAmE;AACnEL,qBAAqBM,kBAAkB,EACvCC,2BAA2B,QAItB,wBAAuB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AssetSource, AssetSourceComponentProps } from "@sanity/types";
|
|
2
|
-
import { AssetSourceComponent, AssetSourceViewComponents, DefinedService, DefinedView,
|
|
3
|
-
export { type AssetSource, type AssetSourceComponent, type AssetSourceComponentProps, type AssetSourceViewComponents, type DefinedService, type DefinedView, type
|
|
2
|
+
import { AssetSourceComponent, AssetSourceViewComponents, DefinedService, DefinedView, PanelComponent, PanelViewComponents, PanelViewProps, ServiceCallback, ServiceContext, ServiceInfo, ServiceType, TileComponent, TileSize, TileViewComponents, TileViewProps, ViewComponentsBySurface, ViewSurface, 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 ServiceCallback, type ServiceContext, type ServiceInfo, type ServiceType, type TileComponent, type TileSize, type TileViewComponents, type TileViewProps, type ViewComponentsBySurface, type ViewSurface, unstable_defineService, unstable_defineView };
|
package/dist/exports/runtime.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// frontend bundle. The `sanity` runtime package re-exports from here, so the
|
|
7
7
|
// same constraint protects it.
|
|
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
11
|
export { unstable_defineService, unstable_defineView } from '@sanity/workbench-cli';
|
|
12
12
|
|
|
@@ -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/service 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// `
|
|
1
|
+
{"version":3,"sources":["../../src/exports/runtime.ts"],"sourcesContent":["// Browser-safe runtime authoring helpers for the module-federation extension API.\n//\n// View/service 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 ServiceCallback,\n ServiceContext,\n ServiceInfo,\n ServiceType,\n TileComponent,\n TileSize,\n TileViewComponents,\n TileViewProps,\n ViewComponentsBySurface,\n ViewSurface,\n} from '@sanity/workbench-cli'\nexport {unstable_defineService, unstable_defineView} from '@sanity/workbench-cli'\n"],"names":["unstable_defineService","unstable_defineView"],"mappings":"AAAA,kFAAkF;AAClF,EAAE;AACF,8EAA8E;AAC9E,qEAAqE;AACrE,8EAA8E;AAC9E,6EAA6E;AAC7E,+BAA+B;AAC/B,EAAE;AACF,gFAAgF;AAChF,6CAA6C;AAqB7C,SAAQA,sBAAsB,EAAEC,mBAAmB,QAAO,wBAAuB"}
|
|
@@ -84,6 +84,8 @@
|
|
|
84
84
|
'deploy',
|
|
85
85
|
'deploy/quickstart',
|
|
86
86
|
'installations',
|
|
87
|
+
'installations/defaults',
|
|
88
|
+
'installations/managed',
|
|
87
89
|
'installations/{installationId}',
|
|
88
90
|
'installations/{installationId}/access',
|
|
89
91
|
'installations/{installationId}/configs',
|
|
@@ -121,6 +123,8 @@
|
|
|
121
123
|
'deploy',
|
|
122
124
|
'deploy/quickstart',
|
|
123
125
|
'installations',
|
|
126
|
+
'installations/defaults',
|
|
127
|
+
'installations/managed',
|
|
124
128
|
'installations/{installationId}',
|
|
125
129
|
'installations/{installationId}/access',
|
|
126
130
|
'installations/{installationId}/configs',
|
|
@@ -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/{inviteId}',\n 'access/{resourceType}/{resourceId}/permissions',\n 'access/{resourceType}/{resourceId}/permissions/{permissionName}',\n 'access/{resourceType}/{resourceId}/requests',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/accept',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/decline',\n 'access/{resourceType}/{resourceId}/robots',\n 'access/{resourceType}/{resourceId}/robots/{robotId}',\n 'access/{resourceType}/{resourceId}/roles',\n 'access/{resourceType}/{resourceId}/roles/{roleName}',\n 'access/{resourceType}/{resourceId}/user-permissions/me',\n 'access/{resourceType}/{resourceId}/user-permissions/me/check',\n 'access/{resourceType}/{resourceId}/users',\n 'access/{resourceType}/{resourceId}/users/me',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles/{roleName}'\n ],\n slug: 'access-api',\n title: 'Access API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/actions/{dataset}'\n ],\n slug: 'actions',\n title: 'Actions API reference'\n },\n {\n defaultApiVersion: 'v2021-02-01',\n host: 'global',\n pathPatterns: [\n 'activity',\n 'activity/export/csv'\n ],\n slug: 'activity-log',\n title: 'Activity Log API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'agent/action/generate/{dataset}',\n 'agent/action/patch/{dataset}',\n 'agent/action/prompt/{dataset}',\n 'agent/action/transform/{dataset}',\n 'agent/action/translate/{dataset}'\n ],\n slug: 'agent-actions',\n title: 'Agent Actions'\n },\n {\n host: 'global',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n host: 'project',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n defaultApiVersion: 'v2024-06-24',\n host: 'project',\n pathPatterns: [\n 'assets/files/{dataset}',\n 'assets/images/{dataset}',\n 'assets/media-library-link/{dataset}'\n ],\n slug: 'assets',\n title: 'Assets API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{datasetName}/backups',\n 'projects/{projectId}/datasets/{datasetName}/backups/{backupId}',\n 'projects/{projectId}/datasets/{datasetName}/settings/backups'\n ],\n slug: 'backups',\n title: 'Backups API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'global',\n pathPatterns: [\n 'agent/prompt',\n 'agent/{organizationId}/threads/{threadId}'\n ],\n slug: 'content-agent',\n title: 'Content Agent API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{dataset}/copy'\n ],\n slug: 'copy',\n title: 'Copy API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/doc/{dataset}/{documentId}'\n ],\n slug: 'doc',\n title: 'Doc API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'embeddings-index/query/{dataset}/{indexName}',\n 'embeddings-index/{dataset}',\n 'embeddings-index/{dataset}/{indexName}'\n ],\n slug: 'embeddings-index',\n title: 'Embeddings Index API reference'\n },\n {\n defaultApiVersion: 'v2021-03-25',\n host: 'project',\n pathPatterns: [\n 'data/export/{dataset}'\n ],\n slug: 'export',\n title: 'Export API reference'\n },\n {\n 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}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/mutate/{dataset}'\n ],\n slug: 'mutation',\n title: 'Mutation API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'projects',\n 'projects/{projectId}',\n 'projects/{projectId}/cors',\n 'projects/{projectId}/cors/{id}',\n 'projects/{projectId}/datasets',\n 'projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}',\n 'projects/{projectId}/datasets/{name}',\n 'projects/{projectId}/datasets/{name}/copy',\n 'projects/{projectId}/datasets/{name}/settings/embeddings',\n 'projects/{projectId}/datasets/{name}/tags',\n 'projects/{projectId}/features',\n 'projects/{projectId}/permissions',\n 'projects/{projectId}/tags',\n 'projects/{projectId}/tags/{tagIdentifier}',\n 'projects/{projectId}/tokens',\n 'projects/{projectId}/tokens/{tokenId}',\n 'projects/{projectId}/users/{userId}'\n ],\n slug: 'projects-api',\n title: 'Projects API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/query/{dataset}'\n ],\n slug: 'query',\n title: 'Query API reference'\n },\n {\n defaultApiVersion: 'v2021-10-04',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{userId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/roles',\n 'projects/{projectId}/roles/{roleName}'\n ],\n slug: 'roles',\n title: 'Roles API reference'\n },\n {\n defaultApiVersion: 'v2022-04-01',\n host: 'project',\n pathPatterns: [\n 'publish/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}/{scheduleId}',\n 'schedules/{projectId}/{dataset}/{scheduleId}/publish',\n 'unpublish/{projectId}/{dataset}'\n ],\n slug: 'scheduling',\n title: 'Scheduling API reference'\n },\n {\n defaultApiVersion: 'v2026-04-27',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/attribute-definitions',\n 'organizations/{organizationId}/attribute-definitions/{key}',\n 'organizations/{organizationId}/users/me/attributes',\n 'organizations/{organizationId}/users/{sanityUserId}/attributes'\n ],\n slug: 'user-attributes',\n title: 'User attributes API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'hooks/projects/{projectId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/{id}/messages'\n ],\n slug: 'webhooks',\n title: 'Webhooks API reference'\n }\n]\n"],"names":["apiRoutes","defaultApiVersion","host","pathPatterns","slug","title"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,YAA6B;IACxC;QACEC,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;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;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;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;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;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;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;CACD,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../src/generated/apiRoutes.ts"],"sourcesContent":["/**\n * GENERATED FILE - DO NOT EDIT\n *\n * Routing manifest for `sanity api`, distilled from the published OpenAPI\n * specifications at https://www.sanity.io/docs/api/openapi\n *\n * Regenerate with: pnpm generate:api-routes\n */\nimport {type ApiRouteEntry} from '../actions/api/types.js'\n\nexport const apiRoutes: ApiRouteEntry[] = [\n {\n defaultApiVersion: 'v2025-07-11',\n host: 'global',\n pathPatterns: [\n 'access/invites/me',\n 'access/organization/{resourceId}/users/roles/default',\n 'access/requests/me',\n 'access/robots/me',\n 'access/robots/me/rotate',\n 'access/{resourceType}/{resourceId}/invites',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}',\n 'access/{resourceType}/{resourceId}/invites/token/{inviteToken}/accept',\n 'access/{resourceType}/{resourceId}/invites/{inviteId}',\n 'access/{resourceType}/{resourceId}/permissions',\n 'access/{resourceType}/{resourceId}/permissions/{permissionName}',\n 'access/{resourceType}/{resourceId}/requests',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/accept',\n 'access/{resourceType}/{resourceId}/requests/{requestId}/decline',\n 'access/{resourceType}/{resourceId}/robots',\n 'access/{resourceType}/{resourceId}/robots/{robotId}',\n 'access/{resourceType}/{resourceId}/roles',\n 'access/{resourceType}/{resourceId}/roles/{roleName}',\n 'access/{resourceType}/{resourceId}/user-permissions/me',\n 'access/{resourceType}/{resourceId}/user-permissions/me/check',\n 'access/{resourceType}/{resourceId}/users',\n 'access/{resourceType}/{resourceId}/users/me',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles',\n 'access/{resourceType}/{resourceId}/users/{sanityUserId}/roles/{roleName}'\n ],\n slug: 'access-api',\n title: 'Access API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/actions/{dataset}'\n ],\n slug: 'actions',\n title: 'Actions API reference'\n },\n {\n defaultApiVersion: 'v2021-02-01',\n host: 'global',\n pathPatterns: [\n 'activity',\n 'activity/export/csv'\n ],\n slug: 'activity-log',\n title: 'Activity Log API Reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'agent/action/generate/{dataset}',\n 'agent/action/patch/{dataset}',\n 'agent/action/prompt/{dataset}',\n 'agent/action/transform/{dataset}',\n 'agent/action/translate/{dataset}'\n ],\n slug: 'agent-actions',\n title: 'Agent Actions'\n },\n {\n host: 'global',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/defaults',\n 'installations/managed',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n host: 'project',\n pathPatterns: [\n 'applications',\n 'applications/{applicationId}',\n 'applications/{applicationId}/access',\n 'applications/{applicationId}/deployments',\n 'applications/{applicationId}/installations',\n 'applications/{applicationId}/interfaces',\n 'applications/{applicationId}/workspaces',\n 'deploy',\n 'deploy/quickstart',\n 'installations',\n 'installations/defaults',\n 'installations/managed',\n 'installations/{installationId}',\n 'installations/{installationId}/access',\n 'installations/{installationId}/configs',\n 'installations/{installationId}/configs/{configId}',\n 'installations/{installationId}/interfaces',\n 'projects/{projectId}/user-applications',\n 'projects/{projectId}/user-applications/{userApplicationId}',\n 'projects/{projectId}/user-applications/{userApplicationId}/config/{configKey}',\n 'projects/{projectId}/user-applications/{userApplicationId}/deployments',\n 'studiohosts/{appHost}/availability',\n 'user-applications',\n 'user-applications/auto-update-version/{userApplicationId}',\n 'user-applications/resolve/application',\n 'user-applications/resolve/project',\n 'user-applications/workspaces',\n 'user-applications/{userApplicationId}',\n 'user-applications/{userApplicationId}/applicationData',\n 'user-applications/{userApplicationId}/config/{configKey}',\n 'user-applications/{userApplicationId}/deployments',\n 'user-applications/{userApplicationId}/workspaces'\n ],\n slug: 'applications-api',\n title: 'Applications API Reference'\n },\n {\n defaultApiVersion: 'v2024-06-24',\n host: 'project',\n pathPatterns: [\n 'assets/files/{dataset}',\n 'assets/images/{dataset}',\n 'assets/media-library-link/{dataset}'\n ],\n slug: 'assets',\n title: 'Assets API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{datasetName}/backups',\n 'projects/{projectId}/datasets/{datasetName}/backups/{backupId}',\n 'projects/{projectId}/datasets/{datasetName}/settings/backups'\n ],\n slug: 'backups',\n title: 'Backups API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'global',\n pathPatterns: [\n 'agent/prompt',\n 'agent/{organizationId}/threads/{threadId}'\n ],\n slug: 'content-agent',\n title: 'Content Agent API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'global',\n pathPatterns: [\n 'projects/{projectId}/datasets/{dataset}/copy'\n ],\n slug: 'copy',\n title: 'Copy API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/doc/{dataset}/{documentId}'\n ],\n slug: 'doc',\n title: 'Doc API reference'\n },\n {\n defaultApiVersion: 'vX',\n host: 'project',\n pathPatterns: [\n 'embeddings-index/query/{dataset}/{indexName}',\n 'embeddings-index/{dataset}',\n 'embeddings-index/{dataset}/{indexName}'\n ],\n slug: 'embeddings-index',\n title: 'Embeddings Index API reference'\n },\n {\n defaultApiVersion: 'v2021-03-25',\n host: 'project',\n pathPatterns: [\n 'data/export/{dataset}'\n ],\n slug: 'export',\n title: 'Export API reference'\n },\n {\n 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}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'media-libraries/{libraryId}/mutate',\n 'media-libraries/{libraryId}/query',\n 'media-libraries/{libraryId}/references/documents/{assetId}/to',\n 'media-libraries/{libraryId}/refsearch',\n 'media-libraries/{libraryId}/signing-keys',\n 'media-libraries/{libraryId}/signing-keys/{keyId}',\n 'media-libraries/{libraryId}/upload',\n 'media-libraries/{libraryId}/video/{videoId}/playback-info',\n 'media-libraries/{libraryId}/video/{videoId}/playback/{type}',\n 'media-libraries/{libraryId}/video/{videoId}/renditions/{name}',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/upload',\n 'media-libraries/{libraryId}/video/{videoId}/subtitles/{subtitleId}'\n ],\n slug: 'media-library',\n title: 'Media Library API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/mutate/{dataset}'\n ],\n slug: 'mutation',\n title: 'Mutation API reference'\n },\n {\n defaultApiVersion: 'v2021-06-07',\n host: 'global',\n pathPatterns: [\n 'projects',\n 'projects/{projectId}',\n 'projects/{projectId}/cors',\n 'projects/{projectId}/cors/{id}',\n 'projects/{projectId}/datasets',\n 'projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}',\n 'projects/{projectId}/datasets/{name}',\n 'projects/{projectId}/datasets/{name}/copy',\n 'projects/{projectId}/datasets/{name}/settings/embeddings',\n 'projects/{projectId}/datasets/{name}/tags',\n 'projects/{projectId}/features',\n 'projects/{projectId}/permissions',\n 'projects/{projectId}/tags',\n 'projects/{projectId}/tags/{tagIdentifier}',\n 'projects/{projectId}/tokens',\n 'projects/{projectId}/tokens/{tokenId}',\n 'projects/{projectId}/users/{userId}'\n ],\n slug: 'projects-api',\n title: 'Projects API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'data/query/{dataset}'\n ],\n slug: 'query',\n title: 'Query API reference'\n },\n {\n defaultApiVersion: 'v2021-10-04',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/acl',\n 'organizations/{organizationId}/acl/{sanityUserId}',\n 'organizations/{organizationId}/grants',\n 'organizations/{organizationId}/providers/{providerId}/projects/{projectId}/role-mappings',\n 'projects/{projectId}/acl',\n 'projects/{projectId}/acl/{userId}',\n 'projects/{projectId}/datasets/{datasetName}/acl',\n 'projects/{projectId}/datasets/{datasetName}/grants',\n 'projects/{projectId}/grants',\n 'projects/{projectId}/permissionResourceSchemas',\n 'projects/{projectId}/roles',\n 'projects/{projectId}/roles/{roleName}'\n ],\n slug: 'roles',\n title: 'Roles API reference'\n },\n {\n defaultApiVersion: 'v2022-04-01',\n host: 'project',\n pathPatterns: [\n 'publish/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}',\n 'schedules/{projectId}/{dataset}/{scheduleId}',\n 'schedules/{projectId}/{dataset}/{scheduleId}/publish',\n 'unpublish/{projectId}/{dataset}'\n ],\n slug: 'scheduling',\n title: 'Scheduling API reference'\n },\n {\n defaultApiVersion: 'v2026-04-27',\n host: 'global',\n pathPatterns: [\n 'organizations/{organizationId}/attribute-definitions',\n 'organizations/{organizationId}/attribute-definitions/{key}',\n 'organizations/{organizationId}/users/me/attributes',\n 'organizations/{organizationId}/users/{sanityUserId}/attributes'\n ],\n slug: 'user-attributes',\n title: 'User attributes API reference'\n },\n {\n defaultApiVersion: 'v2025-02-19',\n host: 'project',\n pathPatterns: [\n 'hooks/projects/{projectId}',\n 'hooks/projects/{projectId}/{id}',\n 'hooks/projects/{projectId}/{id}/attempts',\n 'hooks/{id}/messages'\n ],\n slug: 'webhooks',\n title: 'Webhooks API reference'\n }\n]\n"],"names":["apiRoutes","defaultApiVersion","host","pathPatterns","slug","title"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,YAA6B;IACxC;QACEC,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEH,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;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;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;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;IACA;QACEJ,mBAAmB;QACnBC,MAAM;QACNC,cAAc;YACZ;YACA;YACA;YACA;SACD;QACDC,MAAM;QACNC,OAAO;IACT;CACD,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { subdebug } from '@sanity/cli-core';
|
|
2
2
|
import { select, Separator, spinner } from '@sanity/cli-core/ux';
|
|
3
|
-
import groupBy from 'lodash-es/groupBy.js';
|
|
4
3
|
import { getMediaLibraries } from '../services/mediaLibraries.js';
|
|
5
4
|
const debug = subdebug('media:determine-target-library');
|
|
6
5
|
/**
|
|
@@ -11,12 +10,12 @@ const debug = subdebug('media:determine-target-library');
|
|
|
11
10
|
const spin = spinner('Fetching available media libraries').start();
|
|
12
11
|
try {
|
|
13
12
|
const activeLibraries = await getMediaLibraries(projectId);
|
|
14
|
-
const byOrg = groupBy(activeLibraries,
|
|
13
|
+
const byOrg = Object.groupBy(activeLibraries, (library)=>library.organizationId);
|
|
15
14
|
spin.succeed();
|
|
16
15
|
// Create flat choices array with separators
|
|
17
16
|
const choices = [];
|
|
18
17
|
for (const [orgId, libs] of Object.entries(byOrg)){
|
|
19
|
-
choices.push(new Separator(`Organization: ${orgId}`), ...libs.map((lib)=>({
|
|
18
|
+
choices.push(new Separator(`Organization: ${orgId}`), ...(libs ?? []).map((lib)=>({
|
|
20
19
|
name: lib.id,
|
|
21
20
|
value: lib.id
|
|
22
21
|
})));
|