@sanity/cli 3.87.0 → 3.87.1-canary.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "3.87.0",
3
+ "version": "3.87.1-canary.4+84c6362d84",
4
4
  "description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
5
5
  "keywords": [
6
6
  "sanity",
@@ -58,12 +58,12 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@babel/traverse": "^7.23.5",
61
- "@sanity/client": "^6.29.1",
62
- "@sanity/codegen": "3.87.0",
61
+ "@sanity/client": "^7.0.0",
62
+ "@sanity/codegen": "3.87.1-canary.4+84c6362d84",
63
63
  "@sanity/runtime-cli": "^3.0.0",
64
64
  "@sanity/telemetry": "^0.8.0",
65
65
  "@sanity/template-validator": "^2.4.3",
66
- "@sanity/util": "3.87.0",
66
+ "@sanity/util": "3.87.1-canary.4+84c6362d84",
67
67
  "chalk": "^4.1.2",
68
68
  "debug": "^4.3.4",
69
69
  "decompress": "^4.2.0",
@@ -83,7 +83,7 @@
83
83
  "@rollup/plugin-node-resolve": "^15.2.3",
84
84
  "@sanity/eslint-config-studio": "^4.0.0",
85
85
  "@sanity/generate-help-url": "^3.0.0",
86
- "@sanity/types": "3.87.0",
86
+ "@sanity/types": "3.87.1-canary.4+84c6362d84",
87
87
  "@types/babel__traverse": "^7.20.5",
88
88
  "@types/configstore": "^5.0.1",
89
89
  "@types/cpx": "^1.5.2",
@@ -135,5 +135,5 @@
135
135
  "engines": {
136
136
  "node": ">=18"
137
137
  },
138
- "gitHead": "97c3b32940f2324a9f0fc25097c33f1813374644"
138
+ "gitHead": "84c6362d849ed7a45de7126d3652f9f1e1d2ba03"
139
139
  }
@@ -686,7 +686,7 @@ export default async function initSanity(
686
686
  )
687
687
  } else {
688
688
  print(`\n${chalk.green('Success!')} Now, use these commands to continue:\n`)
689
- print(`First: ${chalk.cyan(`cd ${outputPath}`)} - to enter projects directory`)
689
+ print(`First: ${chalk.cyan(`cd ${outputPath}`)} - to enter project's directory`)
690
690
  print(
691
691
  `Then: ${chalk.cyan(devCommand)} -to run ${isAppTemplate ? 'your Sanity application' : 'Sanity Studio'}\n`,
692
692
  )
@@ -1408,21 +1408,38 @@ export default async function initSanity(
1408
1408
  .clone()
1409
1409
  .config({apiVersion: 'v2021-06-07'})
1410
1410
 
1411
- const grants = await client.request({uri: `organizations/${orgId}/grants`})
1412
- const group: {grants: {name: string}[]}[] = grants[requiredGrantGroup] || []
1413
- return group.some(
1414
- (resource) =>
1415
- resource.grants && resource.grants.some((grant) => grant.name === requiredGrant),
1416
- )
1411
+ try {
1412
+ const grants = await client.request({uri: `organizations/${orgId}/grants`})
1413
+ const group: {grants: {name: string}[]}[] = grants[requiredGrantGroup] || []
1414
+ return group.some(
1415
+ (resource) =>
1416
+ resource.grants && resource.grants.some((grant) => grant.name === requiredGrant),
1417
+ )
1418
+ } catch (err) {
1419
+ // If we get a 401, it means we don't have access to this organization
1420
+ // probably because of implicit membership
1421
+ if (err.statusCode === 401) {
1422
+ debug('No access to organization %s (401)', orgId)
1423
+ return false
1424
+ }
1425
+ // For other errors, log them but still return false to be safe
1426
+ debug('Error checking grants for organization %s: %s', orgId, err.message)
1427
+ return false
1428
+ }
1417
1429
  }
1418
1430
 
1419
1431
  function getOrganizationsWithAttachGrantInfo(organizations: ProjectOrganization[]) {
1420
1432
  return pMap(
1421
1433
  organizations,
1422
- async (organization) => ({
1423
- hasAttachGrant: await hasProjectAttachGrant(organization.id),
1424
- organization,
1425
- }),
1434
+ async (organization) => {
1435
+ try {
1436
+ const hasAttachGrant = await hasProjectAttachGrant(organization.id)
1437
+ return {hasAttachGrant, organization}
1438
+ } catch (err) {
1439
+ debug('Error checking grants for organization %s: %s', organization.id, err.message)
1440
+ return {hasAttachGrant: false, organization}
1441
+ }
1442
+ },
1426
1443
  {concurrency: 3},
1427
1444
  )
1428
1445
  }