@sanity/cli 6.0.0-alpha.3 → 6.0.0-alpha.5

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.
Files changed (376) hide show
  1. package/dist/actions/auth/login/{index.js → login.js} +1 -1
  2. package/dist/actions/auth/login/{index.js.map → login.js.map} +1 -1
  3. package/dist/actions/dev/startStudioDevServer.js +3 -8
  4. package/dist/actions/dev/startStudioDevServer.js.map +1 -1
  5. package/dist/actions/dev/types.d.ts +1 -3
  6. package/dist/actions/dev/types.js.map +1 -1
  7. package/dist/actions/documents/validate.d.ts +0 -2
  8. package/dist/actions/documents/validate.js +21 -1
  9. package/dist/actions/documents/validate.js.map +1 -1
  10. package/dist/actions/exec/execScript.js +1 -1
  11. package/dist/actions/exec/execScript.js.map +1 -1
  12. package/dist/actions/graphql/__tests__/getGraphQLAPIs.test.js +1 -1
  13. package/dist/actions/graphql/__tests__/getGraphQLAPIs.test.js.map +1 -1
  14. package/dist/actions/graphql/getGraphQLAPIs.js +1 -1
  15. package/dist/actions/graphql/getGraphQLAPIs.js.map +1 -1
  16. package/dist/actions/manifest/extractManifest.js +1 -4
  17. package/dist/actions/manifest/extractManifest.js.map +1 -1
  18. package/dist/actions/organizations/getOrganizationChoices.d.ts +6 -0
  19. package/dist/actions/organizations/getOrganizationChoices.js +23 -0
  20. package/dist/actions/organizations/getOrganizationChoices.js.map +1 -0
  21. package/dist/actions/organizations/getOrganizationsWithAttachGrantInfo.d.ts +2 -0
  22. package/dist/actions/organizations/getOrganizationsWithAttachGrantInfo.js +9 -0
  23. package/dist/actions/organizations/getOrganizationsWithAttachGrantInfo.js.map +1 -0
  24. package/dist/actions/organizations/hasProjectAttachGrant.d.ts +1 -0
  25. package/dist/actions/organizations/hasProjectAttachGrant.js +24 -0
  26. package/dist/actions/organizations/hasProjectAttachGrant.js.map +1 -0
  27. package/dist/actions/schema/deleteSchemaAction.d.ts +13 -5
  28. package/dist/actions/schema/deleteSchemaAction.js +12 -17
  29. package/dist/actions/schema/deleteSchemaAction.js.map +1 -1
  30. package/dist/actions/schema/deploySchemas.d.ts +15 -0
  31. package/dist/actions/schema/deploySchemas.js +98 -0
  32. package/dist/actions/schema/deploySchemas.js.map +1 -0
  33. package/dist/actions/schema/listSchemas.d.ts +12 -0
  34. package/dist/actions/schema/listSchemas.js +119 -0
  35. package/dist/actions/schema/listSchemas.js.map +1 -0
  36. package/dist/actions/schema/schemaStoreTypes.d.ts +0 -11
  37. package/dist/actions/schema/schemaStoreTypes.js.map +1 -1
  38. package/dist/actions/schema/utils/debug.d.ts +2 -0
  39. package/dist/actions/schema/utils/debug.js +5 -0
  40. package/dist/actions/schema/utils/debug.js.map +1 -0
  41. package/dist/actions/schema/utils/manifestExtractor.d.ts +3 -8
  42. package/dist/actions/schema/utils/manifestExtractor.js +12 -17
  43. package/dist/actions/schema/utils/manifestExtractor.js.map +1 -1
  44. package/dist/actions/schema/utils/manifestReader.d.ts +2 -9
  45. package/dist/actions/schema/utils/manifestReader.js +6 -12
  46. package/dist/actions/schema/utils/manifestReader.js.map +1 -1
  47. package/dist/actions/schema/utils/schemaStoreOutStrings.d.ts +0 -1
  48. package/dist/actions/schema/utils/schemaStoreOutStrings.js +1 -1
  49. package/dist/actions/schema/utils/schemaStoreOutStrings.js.map +1 -1
  50. package/dist/actions/schema/utils/schemaStoreValidation.d.ts +10 -62
  51. package/dist/actions/schema/utils/schemaStoreValidation.js +40 -127
  52. package/dist/actions/schema/utils/schemaStoreValidation.js.map +1 -1
  53. package/dist/actions/schema/utils/uniqByProjectIdDataset.d.ts +14 -0
  54. package/dist/actions/schema/utils/uniqByProjectIdDataset.js +9 -0
  55. package/dist/actions/schema/utils/uniqByProjectIdDataset.js.map +1 -0
  56. package/dist/actions/users/getMembersForProject.d.ts +1 -3
  57. package/dist/actions/users/getMembersForProject.js +6 -17
  58. package/dist/actions/users/getMembersForProject.js.map +1 -1
  59. package/dist/actions/users/types.d.ts +0 -11
  60. package/dist/actions/users/types.js.map +1 -1
  61. package/dist/commands/__tests__/debug.test.js +113 -220
  62. package/dist/commands/__tests__/debug.test.js.map +1 -1
  63. package/dist/commands/__tests__/deploy.test.js +325 -293
  64. package/dist/commands/__tests__/deploy.test.js.map +1 -1
  65. package/dist/commands/__tests__/dev.test.js +62 -19
  66. package/dist/commands/__tests__/dev.test.js.map +1 -1
  67. package/dist/commands/__tests__/init/init.authentication.test.js +73 -0
  68. package/dist/commands/__tests__/init/init.authentication.test.js.map +1 -0
  69. package/dist/commands/__tests__/init/init.create-new-project.test.js +195 -0
  70. package/dist/commands/__tests__/init/init.create-new-project.test.js.map +1 -0
  71. package/dist/commands/__tests__/init/init.plan.test.js +279 -0
  72. package/dist/commands/__tests__/init/init.plan.test.js.map +1 -0
  73. package/dist/commands/__tests__/init/init.setup.test.js +335 -0
  74. package/dist/commands/__tests__/init/init.setup.test.js.map +1 -0
  75. package/dist/commands/__tests__/install.test.js +46 -22
  76. package/dist/commands/__tests__/install.test.js.map +1 -1
  77. package/dist/commands/__tests__/logout.test.js +8 -5
  78. package/dist/commands/__tests__/logout.test.js.map +1 -1
  79. package/dist/commands/__tests__/manage.test.js +29 -24
  80. package/dist/commands/__tests__/manage.test.js.map +1 -1
  81. package/dist/commands/__tests__/migration.test.js +119 -0
  82. package/dist/commands/__tests__/migration.test.js.map +1 -0
  83. package/dist/commands/__tests__/versions.test.js +22 -14
  84. package/dist/commands/__tests__/versions.test.js.map +1 -1
  85. package/dist/commands/backup/__tests__/disable.test.js +72 -75
  86. package/dist/commands/backup/__tests__/disable.test.js.map +1 -1
  87. package/dist/commands/backup/__tests__/download.test.js +169 -80
  88. package/dist/commands/backup/__tests__/download.test.js.map +1 -1
  89. package/dist/commands/backup/__tests__/enable.test.js +109 -140
  90. package/dist/commands/backup/__tests__/enable.test.js.map +1 -1
  91. package/dist/commands/backup/__tests__/list.test.js +84 -75
  92. package/dist/commands/backup/__tests__/list.test.js.map +1 -1
  93. package/dist/commands/backup/disable.js +5 -11
  94. package/dist/commands/backup/disable.js.map +1 -1
  95. package/dist/commands/backup/enable.js +5 -11
  96. package/dist/commands/backup/enable.js.map +1 -1
  97. package/dist/commands/backup/list.js +7 -8
  98. package/dist/commands/backup/list.js.map +1 -1
  99. package/dist/commands/cors/__tests__/add.test.js +68 -38
  100. package/dist/commands/cors/__tests__/add.test.js.map +1 -1
  101. package/dist/commands/cors/__tests__/delete.test.js +52 -37
  102. package/dist/commands/cors/__tests__/delete.test.js.map +1 -1
  103. package/dist/commands/cors/__tests__/list.test.js +80 -57
  104. package/dist/commands/cors/__tests__/list.test.js.map +1 -1
  105. package/dist/commands/cors/add.js +5 -13
  106. package/dist/commands/cors/add.js.map +1 -1
  107. package/dist/commands/cors/delete.js +7 -15
  108. package/dist/commands/cors/delete.js.map +1 -1
  109. package/dist/commands/cors/list.js +2 -10
  110. package/dist/commands/cors/list.js.map +1 -1
  111. package/dist/commands/dataset/__tests__/copy.test.js +197 -89
  112. package/dist/commands/dataset/__tests__/copy.test.js.map +1 -1
  113. package/dist/commands/dataset/__tests__/create.test.js +147 -117
  114. package/dist/commands/dataset/__tests__/create.test.js.map +1 -1
  115. package/dist/commands/dataset/__tests__/delete.test.js +75 -68
  116. package/dist/commands/dataset/__tests__/delete.test.js.map +1 -1
  117. package/dist/commands/dataset/__tests__/export.test.js +123 -83
  118. package/dist/commands/dataset/__tests__/export.test.js.map +1 -1
  119. package/dist/commands/dataset/__tests__/import.test.js +2 -2
  120. package/dist/commands/dataset/__tests__/import.test.js.map +1 -1
  121. package/dist/commands/dataset/__tests__/list.test.js +107 -65
  122. package/dist/commands/dataset/__tests__/list.test.js.map +1 -1
  123. package/dist/commands/dataset/alias/__tests__/create.test.js +114 -74
  124. package/dist/commands/dataset/alias/__tests__/create.test.js.map +1 -1
  125. package/dist/commands/dataset/alias/__tests__/delete.test.js +40 -29
  126. package/dist/commands/dataset/alias/__tests__/delete.test.js.map +1 -1
  127. package/dist/commands/dataset/alias/__tests__/link.test.js +114 -74
  128. package/dist/commands/dataset/alias/__tests__/link.test.js.map +1 -1
  129. package/dist/commands/dataset/alias/__tests__/unlink.test.js +44 -29
  130. package/dist/commands/dataset/alias/__tests__/unlink.test.js.map +1 -1
  131. package/dist/commands/dataset/export.js +4 -4
  132. package/dist/commands/dataset/export.js.map +1 -1
  133. package/dist/commands/dataset/visibility/__tests__/get.test.js +48 -67
  134. package/dist/commands/dataset/visibility/__tests__/get.test.js.map +1 -1
  135. package/dist/commands/dataset/visibility/__tests__/set.test.js +76 -123
  136. package/dist/commands/dataset/visibility/__tests__/set.test.js.map +1 -1
  137. package/dist/commands/dev.js +0 -1
  138. package/dist/commands/dev.js.map +1 -1
  139. package/dist/commands/docs/__tests__/search.test.js +8 -7
  140. package/dist/commands/docs/__tests__/search.test.js.map +1 -1
  141. package/dist/commands/documents/__tests__/create.test.js +328 -265
  142. package/dist/commands/documents/__tests__/create.test.js.map +1 -1
  143. package/dist/commands/documents/__tests__/delete.test.js +119 -87
  144. package/dist/commands/documents/__tests__/delete.test.js.map +1 -1
  145. package/dist/commands/documents/__tests__/get.test.js +68 -95
  146. package/dist/commands/documents/__tests__/get.test.js.map +1 -1
  147. package/dist/commands/documents/__tests__/query.test.js +87 -192
  148. package/dist/commands/documents/__tests__/query.test.js.map +1 -1
  149. package/dist/commands/documents/__tests__/validate.test.js +52 -29
  150. package/dist/commands/documents/__tests__/validate.test.js.map +1 -1
  151. package/dist/commands/documents/create.d.ts +1 -0
  152. package/dist/commands/documents/create.js +10 -9
  153. package/dist/commands/documents/create.js.map +1 -1
  154. package/dist/commands/documents/delete.js +2 -3
  155. package/dist/commands/documents/delete.js.map +1 -1
  156. package/dist/commands/documents/get.js +2 -3
  157. package/dist/commands/documents/get.js.map +1 -1
  158. package/dist/commands/documents/query.js +2 -3
  159. package/dist/commands/documents/query.js.map +1 -1
  160. package/dist/commands/documents/validate.js +0 -20
  161. package/dist/commands/documents/validate.js.map +1 -1
  162. package/dist/commands/graphql/__tests__/list.test.js +57 -45
  163. package/dist/commands/graphql/__tests__/list.test.js.map +1 -1
  164. package/dist/commands/graphql/__tests__/undeploy.test.js +85 -59
  165. package/dist/commands/graphql/__tests__/undeploy.test.js.map +1 -1
  166. package/dist/commands/graphql/list.js +2 -2
  167. package/dist/commands/graphql/list.js.map +1 -1
  168. package/dist/commands/graphql/undeploy.js +4 -9
  169. package/dist/commands/graphql/undeploy.js.map +1 -1
  170. package/dist/commands/hook/__tests__/attempt.test.js +48 -33
  171. package/dist/commands/hook/__tests__/attempt.test.js.map +1 -1
  172. package/dist/commands/hook/__tests__/create.test.js +49 -51
  173. package/dist/commands/hook/__tests__/create.test.js.map +1 -1
  174. package/dist/commands/hook/__tests__/delete.test.js +43 -30
  175. package/dist/commands/hook/__tests__/delete.test.js.map +1 -1
  176. package/dist/commands/hook/__tests__/list.test.js +38 -31
  177. package/dist/commands/hook/__tests__/list.test.js.map +1 -1
  178. package/dist/commands/hook/__tests__/logs.test.js +68 -40
  179. package/dist/commands/hook/__tests__/logs.test.js.map +1 -1
  180. package/dist/commands/hook/create.js +2 -6
  181. package/dist/commands/hook/create.js.map +1 -1
  182. package/dist/commands/hook/delete.js +5 -17
  183. package/dist/commands/hook/delete.js.map +1 -1
  184. package/dist/commands/hook/list.js +2 -8
  185. package/dist/commands/hook/list.js.map +1 -1
  186. package/dist/commands/init.d.ts +4 -0
  187. package/dist/commands/init.js +151 -18
  188. package/dist/commands/init.js.map +1 -1
  189. package/dist/commands/login.js +1 -1
  190. package/dist/commands/login.js.map +1 -1
  191. package/dist/commands/manifest/__tests__/extract.test.js +22 -13
  192. package/dist/commands/manifest/__tests__/extract.test.js.map +1 -1
  193. package/dist/commands/media/__tests__/create-aspect.test.js +41 -28
  194. package/dist/commands/media/__tests__/create-aspect.test.js.map +1 -1
  195. package/dist/commands/media/__tests__/delete-aspect.test.js +44 -35
  196. package/dist/commands/media/__tests__/delete-aspect.test.js.map +1 -1
  197. package/dist/commands/media/__tests__/deploy-aspect.test.js +67 -80
  198. package/dist/commands/media/__tests__/deploy-aspect.test.js.map +1 -1
  199. package/dist/commands/media/__tests__/export.test.js +365 -66
  200. package/dist/commands/media/__tests__/export.test.js.map +1 -1
  201. package/dist/commands/media/__tests__/import.test.js +171 -105
  202. package/dist/commands/media/__tests__/import.test.js.map +1 -1
  203. package/dist/commands/media/export.js +2 -2
  204. package/dist/commands/media/export.js.map +1 -1
  205. package/dist/commands/media/import.js +2 -2
  206. package/dist/commands/media/import.js.map +1 -1
  207. package/dist/commands/projects/__tests__/list.test.js +5 -4
  208. package/dist/commands/projects/__tests__/list.test.js.map +1 -1
  209. package/dist/commands/projects/list.js +2 -6
  210. package/dist/commands/projects/list.js.map +1 -1
  211. package/dist/commands/schema/__tests__/delete.test.js +396 -151
  212. package/dist/commands/schema/__tests__/delete.test.js.map +1 -1
  213. package/dist/commands/schema/__tests__/deploy.test.js +348 -0
  214. package/dist/commands/schema/__tests__/deploy.test.js.map +1 -0
  215. package/dist/commands/schema/__tests__/extract.test.js +19 -11
  216. package/dist/commands/schema/__tests__/extract.test.js.map +1 -1
  217. package/dist/commands/schema/__tests__/list.test.js +399 -0
  218. package/dist/commands/schema/__tests__/list.test.js.map +1 -0
  219. package/dist/commands/schema/__tests__/validate.test.js +27 -10
  220. package/dist/commands/schema/__tests__/validate.test.js.map +1 -1
  221. package/dist/commands/schema/delete.d.ts +1 -1
  222. package/dist/commands/schema/delete.js +20 -23
  223. package/dist/commands/schema/delete.js.map +1 -1
  224. package/dist/commands/schema/deploy.d.ts +16 -0
  225. package/dist/commands/schema/deploy.js +98 -0
  226. package/dist/commands/schema/deploy.js.map +1 -0
  227. package/dist/commands/schema/list.d.ts +15 -0
  228. package/dist/commands/schema/list.js +104 -0
  229. package/dist/commands/schema/list.js.map +1 -0
  230. package/dist/commands/telemetry/__tests__/disable.test.js +7 -5
  231. package/dist/commands/telemetry/__tests__/disable.test.js.map +1 -1
  232. package/dist/commands/telemetry/__tests__/enable.test.js +7 -5
  233. package/dist/commands/telemetry/__tests__/enable.test.js.map +1 -1
  234. package/dist/commands/telemetry/__tests__/status.test.js +7 -5
  235. package/dist/commands/telemetry/__tests__/status.test.js.map +1 -1
  236. package/dist/commands/tokens/__tests__/add.test.js +55 -40
  237. package/dist/commands/tokens/__tests__/add.test.js.map +1 -1
  238. package/dist/commands/tokens/__tests__/delete.test.js +72 -42
  239. package/dist/commands/tokens/__tests__/delete.test.js.map +1 -1
  240. package/dist/commands/tokens/__tests__/list.test.js +87 -60
  241. package/dist/commands/tokens/__tests__/list.test.js.map +1 -1
  242. package/dist/commands/tokens/add.js +3 -5
  243. package/dist/commands/tokens/add.js.map +1 -1
  244. package/dist/commands/users/__tests__/invite.test.js +100 -79
  245. package/dist/commands/users/__tests__/invite.test.js.map +1 -1
  246. package/dist/commands/users/__tests__/list.test.js +186 -180
  247. package/dist/commands/users/__tests__/list.test.js.map +1 -1
  248. package/dist/commands/users/invite.js +6 -17
  249. package/dist/commands/users/invite.js.map +1 -1
  250. package/dist/commands/users/list.js +4 -7
  251. package/dist/commands/users/list.js.map +1 -1
  252. package/dist/config/createCliConfig.d.ts +4 -4
  253. package/dist/services/backup.d.ts +8 -0
  254. package/dist/services/backup.js +19 -0
  255. package/dist/services/backup.js.map +1 -1
  256. package/dist/services/cors.d.ts +23 -0
  257. package/dist/services/cors.js +38 -0
  258. package/dist/services/cors.js.map +1 -0
  259. package/dist/services/graphql.d.ts +7 -0
  260. package/dist/services/graphql.js +11 -0
  261. package/dist/services/graphql.js.map +1 -1
  262. package/dist/services/hooks.d.ts +2 -0
  263. package/dist/services/hooks.js +19 -0
  264. package/dist/services/hooks.js.map +1 -1
  265. package/dist/services/organizations.d.ts +40 -0
  266. package/dist/services/organizations.js +41 -0
  267. package/dist/services/organizations.js.map +1 -0
  268. package/dist/services/projects.d.ts +31 -0
  269. package/dist/services/projects.js +71 -1
  270. package/dist/services/projects.js.map +1 -1
  271. package/dist/services/schemas.d.ts +4 -0
  272. package/dist/services/schemas.js +40 -0
  273. package/dist/services/schemas.js.map +1 -0
  274. package/dist/services/user.d.ts +10 -0
  275. package/dist/services/user.js +24 -0
  276. package/dist/services/user.js.map +1 -0
  277. package/dist/util/__tests__/getCliVersion.test.js +2 -2
  278. package/dist/util/__tests__/getCliVersion.test.js.map +1 -1
  279. package/dist/util/errorMessages.d.ts +1 -0
  280. package/dist/util/errorMessages.js +1 -0
  281. package/dist/util/errorMessages.js.map +1 -1
  282. package/dist/util/getCliVersion.js +1 -1
  283. package/dist/util/getCliVersion.js.map +1 -1
  284. package/dist/util/readPackageJson.d.ts +1 -15
  285. package/dist/util/readPackageJson.js +1 -1
  286. package/dist/util/readPackageJson.js.map +1 -1
  287. package/dist/util/uniqBy.d.ts +1 -0
  288. package/dist/util/uniqBy.js +14 -0
  289. package/dist/util/uniqBy.js.map +1 -0
  290. package/oclif.config.js +6 -1
  291. package/oclif.manifest.json +152 -158
  292. package/package.json +30 -31
  293. package/dist/actions/cors/constants.d.ts +0 -1
  294. package/dist/actions/cors/constants.js +0 -3
  295. package/dist/actions/cors/constants.js.map +0 -1
  296. package/dist/actions/cors/types.d.ts +0 -9
  297. package/dist/actions/cors/types.js +0 -3
  298. package/dist/actions/cors/types.js.map +0 -1
  299. package/dist/actions/migration/getMigrationRootDirectory.d.ts +0 -2
  300. package/dist/actions/migration/getMigrationRootDirectory.js +0 -14
  301. package/dist/actions/migration/getMigrationRootDirectory.js.map +0 -1
  302. package/dist/actions/migration/resolveMigrations.d.ts +0 -19
  303. package/dist/actions/migration/resolveMigrations.js +0 -43
  304. package/dist/actions/migration/resolveMigrations.js.map +0 -1
  305. package/dist/actions/migration/templates/__tests__/minimalAdvanced.test.js +0 -65
  306. package/dist/actions/migration/templates/__tests__/minimalAdvanced.test.js.map +0 -1
  307. package/dist/actions/migration/templates/__tests__/minimalSimple.test.js +0 -145
  308. package/dist/actions/migration/templates/__tests__/minimalSimple.test.js.map +0 -1
  309. package/dist/actions/migration/templates/__tests__/renameField.test.js +0 -63
  310. package/dist/actions/migration/templates/__tests__/renameField.test.js.map +0 -1
  311. package/dist/actions/migration/templates/__tests__/renameType.test.js +0 -61
  312. package/dist/actions/migration/templates/__tests__/renameType.test.js.map +0 -1
  313. package/dist/actions/migration/templates/__tests__/stringToPTE.test.js +0 -87
  314. package/dist/actions/migration/templates/__tests__/stringToPTE.test.js.map +0 -1
  315. package/dist/actions/migration/templates/index.d.ts +0 -5
  316. package/dist/actions/migration/templates/index.js +0 -7
  317. package/dist/actions/migration/templates/index.js.map +0 -1
  318. package/dist/actions/migration/templates/minimalAdvanced.d.ts +0 -4
  319. package/dist/actions/migration/templates/minimalAdvanced.js +0 -21
  320. package/dist/actions/migration/templates/minimalAdvanced.js.map +0 -1
  321. package/dist/actions/migration/templates/minimalSimple.d.ts +0 -4
  322. package/dist/actions/migration/templates/minimalSimple.js +0 -61
  323. package/dist/actions/migration/templates/minimalSimple.js.map +0 -1
  324. package/dist/actions/migration/templates/renameField.d.ts +0 -4
  325. package/dist/actions/migration/templates/renameField.js +0 -20
  326. package/dist/actions/migration/templates/renameField.js.map +0 -1
  327. package/dist/actions/migration/templates/renameType.d.ts +0 -4
  328. package/dist/actions/migration/templates/renameType.js +0 -19
  329. package/dist/actions/migration/templates/renameType.js.map +0 -1
  330. package/dist/actions/migration/templates/stringToPTE.d.ts +0 -4
  331. package/dist/actions/migration/templates/stringToPTE.js +0 -32
  332. package/dist/actions/migration/templates/stringToPTE.js.map +0 -1
  333. package/dist/actions/schema/__tests__/deleteSchemaAction.test.js +0 -294
  334. package/dist/actions/schema/__tests__/deleteSchemaAction.test.js.map +0 -1
  335. package/dist/actions/schema/schemaStoreConstants.d.ts +0 -1
  336. package/dist/actions/schema/schemaStoreConstants.js +0 -4
  337. package/dist/actions/schema/schemaStoreConstants.js.map +0 -1
  338. package/dist/actions/schema/utils/schemaActionHelpers.d.ts +0 -1
  339. package/dist/actions/schema/utils/schemaActionHelpers.js +0 -5
  340. package/dist/actions/schema/utils/schemaActionHelpers.js.map +0 -1
  341. package/dist/actions/schema/utils/schemaApiClient.d.ts +0 -6
  342. package/dist/actions/schema/utils/schemaApiClient.js +0 -17
  343. package/dist/actions/schema/utils/schemaApiClient.js.map +0 -1
  344. package/dist/actions/users/apiVersion.d.ts +0 -6
  345. package/dist/actions/users/apiVersion.js +0 -7
  346. package/dist/actions/users/apiVersion.js.map +0 -1
  347. package/dist/commands/__tests__/init.test.js +0 -411
  348. package/dist/commands/__tests__/init.test.js.map +0 -1
  349. package/dist/commands/migration/__tests__/create.test.js +0 -296
  350. package/dist/commands/migration/__tests__/create.test.js.map +0 -1
  351. package/dist/commands/migration/__tests__/list.test.js +0 -166
  352. package/dist/commands/migration/__tests__/list.test.js.map +0 -1
  353. package/dist/commands/migration/__tests__/run.test.js +0 -481
  354. package/dist/commands/migration/__tests__/run.test.js.map +0 -1
  355. package/dist/commands/migration/create.d.ts +0 -17
  356. package/dist/commands/migration/create.js +0 -143
  357. package/dist/commands/migration/create.js.map +0 -1
  358. package/dist/commands/migration/list.d.ts +0 -9
  359. package/dist/commands/migration/list.js +0 -61
  360. package/dist/commands/migration/list.js.map +0 -1
  361. package/dist/commands/migration/run.d.ts +0 -26
  362. package/dist/commands/migration/run.js +0 -271
  363. package/dist/commands/migration/run.js.map +0 -1
  364. package/dist/util/migration/constants.d.ts +0 -3
  365. package/dist/util/migration/constants.js +0 -10
  366. package/dist/util/migration/constants.js.map +0 -1
  367. package/dist/util/migration/ensureApiVersionFormat.d.ts +0 -9
  368. package/dist/util/migration/ensureApiVersionFormat.js +0 -16
  369. package/dist/util/migration/ensureApiVersionFormat.js.map +0 -1
  370. package/dist/util/migration/prettyMutationFormatter.d.ts +0 -8
  371. package/dist/util/migration/prettyMutationFormatter.js +0 -141
  372. package/dist/util/migration/prettyMutationFormatter.js.map +0 -1
  373. package/dist/utils/migration/resolveMigrationScript.d.ts +0 -44
  374. package/dist/utils/migration/resolveMigrationScript.js +0 -74
  375. package/dist/utils/migration/resolveMigrationScript.js.map +0 -1
  376. /package/dist/actions/auth/login/{index.d.ts → login.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "6.0.0-alpha.3",
3
+ "version": "6.0.0-alpha.5",
4
4
  "description": "Sanity CLI tool for managing Sanity projects and organizations",
5
5
  "keywords": [
6
6
  "sanity",
@@ -13,7 +13,11 @@
13
13
  ],
14
14
  "homepage": "https://github.com/sanity-io/cli",
15
15
  "bugs": "https://github.com/sanity-io/cli/issues",
16
- "repository": "sanity-io/cli",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/sanity-io/cli.git",
19
+ "directory": "packages/@sanity/cli"
20
+ },
17
21
  "license": "MIT",
18
22
  "author": "Sanity.io <hello@sanity.io>",
19
23
  "type": "module",
@@ -41,37 +45,35 @@
41
45
  "@oclif/core": "^4.8.0",
42
46
  "@oclif/plugin-help": "^6.2.36",
43
47
  "@oclif/plugin-not-found": "^3.2.73",
44
- "@sanity/client": "^7.11.2",
48
+ "@sanity/client": "^7.14.0",
45
49
  "@sanity/descriptors": "^1.3.0",
46
- "@sanity/export": "^6.0.0",
50
+ "@sanity/export": "^6.0.2",
47
51
  "@sanity/id-utils": "^1.0.0",
48
- "@sanity/import": "^4.0.0",
49
- "@sanity/migrate": "^5.1.0",
50
- "@sanity/runtime-cli": "^12.1.0",
51
- "@sanity/schema": "^5.1.0",
52
+ "@sanity/import": "^4.0.3",
53
+ "@sanity/migrate": "^5.2.1",
54
+ "@sanity/runtime-cli": "^12.4.0",
55
+ "@sanity/schema": "^5.2.0",
52
56
  "@sanity/telemetry": "^0.8.1",
53
57
  "@sanity/template-validator": "^2.4.3",
54
- "@sanity/types": "^5.1.0",
58
+ "@sanity/types": "^5.2.0",
55
59
  "@sanity/ui": "^3.1.11",
56
60
  "@vercel/frameworks": "3.8.4",
57
61
  "@vercel/fs-detectors": "5.5.2",
58
- "@vitejs/plugin-react": "^4.5.0",
62
+ "@vitejs/plugin-react": "^5.1.2",
59
63
  "boxen": "^8.0.1",
60
64
  "chokidar": "^4.0.3",
61
65
  "console-table-printer": "^2.14.6",
62
66
  "date-fns": "^4.1.0",
63
67
  "debug": "^4.4.3",
64
- "eventsource": "^4.0.0",
68
+ "eventsource": "^4.1.0",
65
69
  "execa": "^9.6.0",
66
70
  "form-data": "^4.0.5",
67
71
  "get-it": "^8.7.0",
68
72
  "get-latest-version": "^5.1.0",
69
- "get-tsconfig": "^4.10.1",
70
- "glob": "^11.0.3",
73
+ "get-tsconfig": "^4.13.0",
71
74
  "gunzip-maybe": "^1.4.2",
72
75
  "is-tar": "^1.0.0",
73
76
  "isomorphic-dompurify": "^2.32.0",
74
- "jsdom": "^26.0.0",
75
77
  "json5": "^2.2.3",
76
78
  "lodash-es": "^4.17.21",
77
79
  "nanoid": "^5.1.5",
@@ -79,8 +81,8 @@
79
81
  "oneline": "^2.0.0",
80
82
  "open": "^10.1.0",
81
83
  "p-map": "^7.0.3",
84
+ "package-directory": "^8.1.0",
82
85
  "peek-stream": "^1.1.3",
83
- "pkg-dir": "^8.0.0",
84
86
  "preferred-pm": "^4.1.1",
85
87
  "pretty-ms": "^9.3.0",
86
88
  "promise-props-recursive": "^2.0.2",
@@ -90,7 +92,7 @@
90
92
  "read-package-up": "^11.0.0",
91
93
  "resolve-from": "^5.0.0",
92
94
  "rxjs": "^7.8.1",
93
- "sanity": "^5.1.0",
95
+ "sanity": "^5.2.0",
94
96
  "semver": "^7.7.2",
95
97
  "semver-compare": "^1.0.0",
96
98
  "styled-components": "^6.1.19",
@@ -98,22 +100,21 @@
98
100
  "tar-fs": "^3.1.0",
99
101
  "tar-stream": "^3.1.7",
100
102
  "tinyglobby": "^0.2.15",
101
- "tsx": "^4.19.3",
102
- "vite": "^7.1.6",
103
+ "tsx": "^4.21.0",
104
+ "vite": "^7.3.0",
103
105
  "which": "^5.0.0",
104
- "zod": "^3.24.2",
105
- "@sanity/cli-core": "0.1.0-alpha.3"
106
+ "zod": "^4.3.5",
107
+ "@sanity/cli-core": "0.1.0-alpha.5"
106
108
  },
107
109
  "devDependencies": {
108
110
  "@eslint/compat": "^2.0.0",
109
111
  "@oclif/test": "^4.1.15",
110
- "@swc/cli": "^0.7.8",
111
- "@swc/core": "^1.14.0",
112
+ "@swc/cli": "^0.7.9",
113
+ "@swc/core": "^1.15.8",
112
114
  "@types/debug": "^4.1.12",
113
115
  "@types/gunzip-maybe": "^1.4.3",
114
- "@types/jsdom": "^21.1.7",
115
116
  "@types/lodash-es": "^4.17.12",
116
- "@types/node": "^20.19.24",
117
+ "@types/node": "^20.19.27",
117
118
  "@types/react": "^19.2.7",
118
119
  "@types/react-dom": "^19.2.3",
119
120
  "@types/react-is": "^19.2.0",
@@ -124,18 +125,16 @@
124
125
  "@types/which": "^3.0.4",
125
126
  "@vitest/coverage-istanbul": "^3.2.4",
126
127
  "babel-plugin-react-compiler": "^1.0.0",
127
- "chokidar": "^4.0.3",
128
- "eslint": "^9.39.1",
129
- "glob": "^11.0.3",
128
+ "eslint": "^9.39.2",
130
129
  "nock": "^14.0.10",
131
130
  "oclif": "^4.22.57",
132
131
  "rimraf": "^6.0.1",
133
- "typescript": "^5.8.3",
134
- "vite-tsconfig-paths": "^6.0.1",
132
+ "typescript": "^5.9.3",
133
+ "vite-tsconfig-paths": "^6.0.3",
135
134
  "vitest": "^3.2.4",
136
135
  "@repo/tsconfig": "3.70.0",
137
- "@repo/eslint-config": "0.0.0",
138
- "@sanity/cli-test": "0.0.2-alpha.2"
136
+ "@sanity/cli-test": "0.0.2-alpha.4",
137
+ "@sanity/eslint-config-cli": "0.0.0-alpha.1"
139
138
  },
140
139
  "engines": {
141
140
  "node": ">=20.19.1 <22 || >=22.12"
@@ -1 +0,0 @@
1
- export declare const CORS_API_VERSION = "v2025-08-14";
@@ -1,3 +0,0 @@
1
- export const CORS_API_VERSION = 'v2025-08-14';
2
-
3
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/cors/constants.ts"],"sourcesContent":["export const CORS_API_VERSION = 'v2025-08-14'\n"],"names":["CORS_API_VERSION"],"mappings":"AAAA,OAAO,MAAMA,mBAAmB,cAAa"}
@@ -1,9 +0,0 @@
1
- export interface CorsOrigin {
2
- allowCredentials: boolean;
3
- createdAt: string;
4
- deletedAt: string | null;
5
- id: number;
6
- origin: string;
7
- projectId: string;
8
- updatedAt: string | null;
9
- }
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/cors/types.ts"],"sourcesContent":["export interface CorsOrigin {\n allowCredentials: boolean\n createdAt: string\n deletedAt: string | null\n id: number\n origin: string\n projectId: string\n updatedAt: string | null\n}\n"],"names":[],"mappings":"AAAA,WAQC"}
@@ -1,2 +0,0 @@
1
- import { Output } from '@sanity/cli-core';
2
- export declare function getMigrationRootDirectory(output: Output): Promise<string>;
@@ -1,14 +0,0 @@
1
- import { findProjectRoot } from '@sanity/cli-core';
2
- export async function getMigrationRootDirectory(output) {
3
- try {
4
- const projectRoot = await findProjectRoot(process.cwd());
5
- return projectRoot.directory;
6
- } catch (error) {
7
- const message = error instanceof Error ? error.message : 'Could not find Sanity project root';
8
- output.error(message, {
9
- exit: 1
10
- });
11
- }
12
- }
13
-
14
- //# sourceMappingURL=getMigrationRootDirectory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/migration/getMigrationRootDirectory.ts"],"sourcesContent":["import {findProjectRoot, Output} from '@sanity/cli-core'\n\nexport async function getMigrationRootDirectory(output: Output): Promise<string> {\n try {\n const projectRoot = await findProjectRoot(process.cwd())\n return projectRoot.directory\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Could not find Sanity project root'\n output.error(message, {exit: 1})\n }\n}\n"],"names":["findProjectRoot","getMigrationRootDirectory","output","projectRoot","process","cwd","directory","error","message","Error","exit"],"mappings":"AAAA,SAAQA,eAAe,QAAe,mBAAkB;AAExD,OAAO,eAAeC,0BAA0BC,MAAc;IAC5D,IAAI;QACF,MAAMC,cAAc,MAAMH,gBAAgBI,QAAQC,GAAG;QACrD,OAAOF,YAAYG,SAAS;IAC9B,EAAE,OAAOC,OAAO;QACd,MAAMC,UAAUD,iBAAiBE,QAAQF,MAAMC,OAAO,GAAG;QACzDN,OAAOK,KAAK,CAACC,SAAS;YAACE,MAAM;QAAC;IAChC;AACF"}
@@ -1,19 +0,0 @@
1
- import { type Migration } from '@sanity/migrate';
2
- /**
3
- * A resolved migration, where you are guaranteed that the migration file exists
4
- *
5
- * @internal
6
- */
7
- interface ResolvedMigration {
8
- id: string;
9
- migration: Migration;
10
- }
11
- /**
12
- * Resolves all migrations in the studio working directory
13
- *
14
- * @param workDir - The studio working directory
15
- * @returns Array of migrations and their respective paths
16
- * @internal
17
- */
18
- export declare function resolveMigrations(workDir: string): Promise<ResolvedMigration[]>;
19
- export {};
@@ -1,43 +0,0 @@
1
- import { readdir } from 'node:fs/promises';
2
- import path from 'node:path';
3
- import { MIGRATION_SCRIPT_EXTENSIONS, MIGRATIONS_DIRECTORY } from '../../util/migration/constants.js';
4
- import { isLoadableMigrationScript, resolveMigrationScript } from '../../utils/migration/resolveMigrationScript.js';
5
- /**
6
- * Removes migration script extensions from a filename
7
- *
8
- * @param fileName - The filename to process
9
- * @returns The filename without the extension
10
- * @internal
11
- */ function removeMigrationScriptExtension(fileName) {
12
- // Remove `.ts`, `.js` etc from the end of a filename
13
- const ext = MIGRATION_SCRIPT_EXTENSIONS.find((e)=>fileName.endsWith(`.${e}`));
14
- return ext ? path.basename(fileName, `.${ext}`) : fileName;
15
- }
16
- /**
17
- * Resolves all migrations in the studio working directory
18
- *
19
- * @param workDir - The studio working directory
20
- * @returns Array of migrations and their respective paths
21
- * @internal
22
- */ export async function resolveMigrations(workDir) {
23
- const migrationsDir = path.join(workDir, MIGRATIONS_DIRECTORY);
24
- const migrationEntries = await readdir(migrationsDir, {
25
- withFileTypes: true
26
- });
27
- const migrations = [];
28
- for (const entry of migrationEntries){
29
- const entryName = entry.isDirectory() ? entry.name : removeMigrationScriptExtension(entry.name);
30
- const candidates = await resolveMigrationScript(workDir, entryName);
31
- for (const candidate of candidates){
32
- if (isLoadableMigrationScript(candidate)) {
33
- migrations.push({
34
- id: entryName,
35
- migration: candidate.mod.default
36
- });
37
- }
38
- }
39
- }
40
- return migrations;
41
- }
42
-
43
- //# sourceMappingURL=resolveMigrations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/migration/resolveMigrations.ts"],"sourcesContent":["import {readdir} from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {type Migration} from '@sanity/migrate'\n\nimport {MIGRATION_SCRIPT_EXTENSIONS, MIGRATIONS_DIRECTORY} from '../../util/migration/constants.js'\nimport {\n isLoadableMigrationScript,\n resolveMigrationScript,\n} from '../../utils/migration/resolveMigrationScript.js'\n\n/**\n * A resolved migration, where you are guaranteed that the migration file exists\n *\n * @internal\n */\ninterface ResolvedMigration {\n id: string\n migration: Migration\n}\n\n/**\n * Removes migration script extensions from a filename\n *\n * @param fileName - The filename to process\n * @returns The filename without the extension\n * @internal\n */\nfunction removeMigrationScriptExtension(fileName: string): string {\n // Remove `.ts`, `.js` etc from the end of a filename\n const ext = MIGRATION_SCRIPT_EXTENSIONS.find((e) => fileName.endsWith(`.${e}`))\n return ext ? path.basename(fileName, `.${ext}`) : fileName\n}\n\n/**\n * Resolves all migrations in the studio working directory\n *\n * @param workDir - The studio working directory\n * @returns Array of migrations and their respective paths\n * @internal\n */\nexport async function resolveMigrations(workDir: string): Promise<ResolvedMigration[]> {\n const migrationsDir = path.join(workDir, MIGRATIONS_DIRECTORY)\n const migrationEntries = await readdir(migrationsDir, {withFileTypes: true})\n\n const migrations: ResolvedMigration[] = []\n for (const entry of migrationEntries) {\n const entryName = entry.isDirectory() ? entry.name : removeMigrationScriptExtension(entry.name)\n const candidates = await resolveMigrationScript(workDir, entryName)\n for (const candidate of candidates) {\n if (isLoadableMigrationScript(candidate)) {\n migrations.push({\n id: entryName,\n migration: candidate.mod.default,\n })\n }\n }\n }\n\n return migrations\n}\n"],"names":["readdir","path","MIGRATION_SCRIPT_EXTENSIONS","MIGRATIONS_DIRECTORY","isLoadableMigrationScript","resolveMigrationScript","removeMigrationScriptExtension","fileName","ext","find","e","endsWith","basename","resolveMigrations","workDir","migrationsDir","join","migrationEntries","withFileTypes","migrations","entry","entryName","isDirectory","name","candidates","candidate","push","id","migration","mod","default"],"mappings":"AAAA,SAAQA,OAAO,QAAO,mBAAkB;AACxC,OAAOC,UAAU,YAAW;AAI5B,SAAQC,2BAA2B,EAAEC,oBAAoB,QAAO,oCAAmC;AACnG,SACEC,yBAAyB,EACzBC,sBAAsB,QACjB,kDAAiD;AAYxD;;;;;;CAMC,GACD,SAASC,+BAA+BC,QAAgB;IACtD,qDAAqD;IACrD,MAAMC,MAAMN,4BAA4BO,IAAI,CAAC,CAACC,IAAMH,SAASI,QAAQ,CAAC,CAAC,CAAC,EAAED,GAAG;IAC7E,OAAOF,MAAMP,KAAKW,QAAQ,CAACL,UAAU,CAAC,CAAC,EAAEC,KAAK,IAAID;AACpD;AAEA;;;;;;CAMC,GACD,OAAO,eAAeM,kBAAkBC,OAAe;IACrD,MAAMC,gBAAgBd,KAAKe,IAAI,CAACF,SAASX;IACzC,MAAMc,mBAAmB,MAAMjB,QAAQe,eAAe;QAACG,eAAe;IAAI;IAE1E,MAAMC,aAAkC,EAAE;IAC1C,KAAK,MAAMC,SAASH,iBAAkB;QACpC,MAAMI,YAAYD,MAAME,WAAW,KAAKF,MAAMG,IAAI,GAAGjB,+BAA+Bc,MAAMG,IAAI;QAC9F,MAAMC,aAAa,MAAMnB,uBAAuBS,SAASO;QACzD,KAAK,MAAMI,aAAaD,WAAY;YAClC,IAAIpB,0BAA0BqB,YAAY;gBACxCN,WAAWO,IAAI,CAAC;oBACdC,IAAIN;oBACJO,WAAWH,UAAUI,GAAG,CAACC,OAAO;gBAClC;YACF;QACF;IACF;IAEA,OAAOX;AACT"}
@@ -1,65 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import { minimalAdvanced } from '../minimalAdvanced';
3
- describe('#minimalAdvanced', ()=>{
4
- test('creates template with no doc types', ()=>{
5
- const minimalAdvancedTemplate = minimalAdvanced({
6
- documentTypes: [],
7
- migrationName: 'My Migration'
8
- });
9
- expect(minimalAdvancedTemplate).toMatchInlineSnapshot(`
10
- "import {defineMigration, patch, at, setIfMissing} from '@sanity/migrate'
11
-
12
- /**
13
- * this migration will set \`Default title\` on all documents that are missing a title
14
- * and make \`true\` the default value for the \`enabled\` field
15
- */
16
- export default defineMigration({
17
- title: "My Migration",
18
-
19
- async *migrate(documents, context) {
20
- for await (const document of documents()) {
21
- yield patch(document._id, [
22
- at('title', setIfMissing('Default title')),
23
- at('enabled', setIfMissing(true)),
24
- ])
25
- }
26
- }
27
- })
28
- "
29
- `);
30
- });
31
- test('creates template with doc types', ()=>{
32
- const minimalAdvancedTemplate = minimalAdvanced({
33
- documentTypes: [
34
- 'document-1',
35
- 'document-2',
36
- 'document-3'
37
- ],
38
- migrationName: 'My Migration'
39
- });
40
- expect(minimalAdvancedTemplate).toMatchInlineSnapshot(`
41
- "import {defineMigration, patch, at, setIfMissing} from '@sanity/migrate'
42
-
43
- /**
44
- * this migration will set \`Default title\` on all documents that are missing a title
45
- * and make \`true\` the default value for the \`enabled\` field
46
- */
47
- export default defineMigration({
48
- title: "My Migration",
49
- documentTypes: ["document-1", "document-2", "document-3"],
50
-
51
- async *migrate(documents, context) {
52
- for await (const document of documents()) {
53
- yield patch(document._id, [
54
- at('title', setIfMissing('Default title')),
55
- at('enabled', setIfMissing(true)),
56
- ])
57
- }
58
- }
59
- })
60
- "
61
- `);
62
- });
63
- });
64
-
65
- //# sourceMappingURL=minimalAdvanced.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/actions/migration/templates/__tests__/minimalAdvanced.test.ts"],"sourcesContent":["import {describe, expect, test} from 'vitest'\n\nimport {minimalAdvanced} from '../minimalAdvanced'\n\ndescribe('#minimalAdvanced', () => {\n test('creates template with no doc types', () => {\n const minimalAdvancedTemplate = minimalAdvanced({\n documentTypes: [],\n migrationName: 'My Migration',\n })\n\n expect(minimalAdvancedTemplate).toMatchInlineSnapshot(`\n \"import {defineMigration, patch, at, setIfMissing} from '@sanity/migrate'\n\n /**\n * this migration will set \\`Default title\\` on all documents that are missing a title\n * and make \\`true\\` the default value for the \\`enabled\\` field\n */\n export default defineMigration({\n title: \"My Migration\",\n\n async *migrate(documents, context) {\n for await (const document of documents()) {\n yield patch(document._id, [\n at('title', setIfMissing('Default title')),\n at('enabled', setIfMissing(true)),\n ])\n }\n }\n })\n \"\n `)\n })\n\n test('creates template with doc types', () => {\n const minimalAdvancedTemplate = minimalAdvanced({\n documentTypes: ['document-1', 'document-2', 'document-3'],\n migrationName: 'My Migration',\n })\n\n expect(minimalAdvancedTemplate).toMatchInlineSnapshot(`\n \"import {defineMigration, patch, at, setIfMissing} from '@sanity/migrate'\n\n /**\n * this migration will set \\`Default title\\` on all documents that are missing a title\n * and make \\`true\\` the default value for the \\`enabled\\` field\n */\n export default defineMigration({\n title: \"My Migration\",\n documentTypes: [\"document-1\", \"document-2\", \"document-3\"],\n\n async *migrate(documents, context) {\n for await (const document of documents()) {\n yield patch(document._id, [\n at('title', setIfMissing('Default title')),\n at('enabled', setIfMissing(true)),\n ])\n }\n }\n })\n \"\n `)\n })\n})\n"],"names":["describe","expect","test","minimalAdvanced","minimalAdvancedTemplate","documentTypes","migrationName","toMatchInlineSnapshot"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,QAAO,SAAQ;AAE7C,SAAQC,eAAe,QAAO,qBAAoB;AAElDH,SAAS,oBAAoB;IAC3BE,KAAK,sCAAsC;QACzC,MAAME,0BAA0BD,gBAAgB;YAC9CE,eAAe,EAAE;YACjBC,eAAe;QACjB;QAEAL,OAAOG,yBAAyBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;IAoBvD,CAAC;IACH;IAEAL,KAAK,mCAAmC;QACtC,MAAME,0BAA0BD,gBAAgB;YAC9CE,eAAe;gBAAC;gBAAc;gBAAc;aAAa;YACzDC,eAAe;QACjB;QAEAL,OAAOG,yBAAyBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;IAqBvD,CAAC;IACH;AACF"}
@@ -1,145 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import { minimalSimple } from '../minimalSimple';
3
- describe('#minimalSimple', ()=>{
4
- test('creates template with no doc types', ()=>{
5
- const minimalSimpleTemplate = minimalSimple({
6
- documentTypes: [],
7
- migrationName: 'My Migration'
8
- });
9
- expect(minimalSimpleTemplate).toMatchInlineSnapshot(`
10
- "import {at, defineMigration, setIfMissing, unset} from '@sanity/migrate'
11
-
12
- export default defineMigration({
13
- title: "My Migration",
14
-
15
- migrate: {
16
- document(doc, context) {
17
- // this will be called for every document of the matching type
18
- // any patch returned will be applied to the document
19
- // you can also return mutations that touches other documents
20
-
21
- return at('title', setIfMissing('Default title'))
22
- },
23
- node(node, path, context) {
24
- // this will be called for every node in every document of the matching type
25
- // any patch returned will be applied to the document
26
- // you can also return mutations that touches other documents
27
-
28
- if (typeof node === 'string' && node === 'deleteme') {
29
- return unset()
30
- }
31
- },
32
- object(node, path, context) {
33
- // this will be called for every object node in every document of the matching type
34
- // any patch returned will be applied to the document
35
- // you can also return mutations that touches other documents
36
- if (node._type === 'author') {
37
- // make sure all authors objects have a books array
38
- return at('books', setIfMissing([]))
39
- }
40
- },
41
- array(node, path, context) {
42
- // this will be called for every array node in every document of the matching type
43
- // any patch returned will be applied to the document
44
- // you can also return mutations that touches other documents
45
- },
46
- string(node, path, context) {
47
- // this will be called for every string node in every document of the matching type
48
- // any patch returned will be applied to the document
49
- // you can also return mutations that touches other documents
50
- },
51
- number(node, path, context) {
52
- // this will be called for every number node in every document of the matching type
53
- // any patch returned will be applied to the document
54
- // you can also return mutations that touches other documents
55
- },
56
- boolean(node, path, context) {
57
- // this will be called for every boolean node in every document of the matching type
58
- // any patch returned will be applied to the document
59
- // you can also return mutations that touches other documents
60
- },
61
- null(node, path, context) {
62
- // this will be called for every null node in every document of the matching type
63
- // any patch returned will be applied to the document
64
- // you can also return mutations that touches other documents
65
- },
66
- },
67
- })
68
- "
69
- `);
70
- });
71
- test('creates template with doc types', ()=>{
72
- const minimalSimpleTemplate = minimalSimple({
73
- documentTypes: [
74
- 'document-1',
75
- 'document-2',
76
- 'document-3'
77
- ],
78
- migrationName: 'My Migration'
79
- });
80
- expect(minimalSimpleTemplate).toMatchInlineSnapshot(`
81
- "import {at, defineMigration, setIfMissing, unset} from '@sanity/migrate'
82
-
83
- export default defineMigration({
84
- title: "My Migration",
85
- documentTypes: ["document-1", "document-2", "document-3"],
86
-
87
- migrate: {
88
- document(doc, context) {
89
- // this will be called for every document of the matching type
90
- // any patch returned will be applied to the document
91
- // you can also return mutations that touches other documents
92
-
93
- return at('title', setIfMissing('Default title'))
94
- },
95
- node(node, path, context) {
96
- // this will be called for every node in every document of the matching type
97
- // any patch returned will be applied to the document
98
- // you can also return mutations that touches other documents
99
-
100
- if (typeof node === 'string' && node === 'deleteme') {
101
- return unset()
102
- }
103
- },
104
- object(node, path, context) {
105
- // this will be called for every object node in every document of the matching type
106
- // any patch returned will be applied to the document
107
- // you can also return mutations that touches other documents
108
- if (node._type === 'author') {
109
- // make sure all authors objects have a books array
110
- return at('books', setIfMissing([]))
111
- }
112
- },
113
- array(node, path, context) {
114
- // this will be called for every array node in every document of the matching type
115
- // any patch returned will be applied to the document
116
- // you can also return mutations that touches other documents
117
- },
118
- string(node, path, context) {
119
- // this will be called for every string node in every document of the matching type
120
- // any patch returned will be applied to the document
121
- // you can also return mutations that touches other documents
122
- },
123
- number(node, path, context) {
124
- // this will be called for every number node in every document of the matching type
125
- // any patch returned will be applied to the document
126
- // you can also return mutations that touches other documents
127
- },
128
- boolean(node, path, context) {
129
- // this will be called for every boolean node in every document of the matching type
130
- // any patch returned will be applied to the document
131
- // you can also return mutations that touches other documents
132
- },
133
- null(node, path, context) {
134
- // this will be called for every null node in every document of the matching type
135
- // any patch returned will be applied to the document
136
- // you can also return mutations that touches other documents
137
- },
138
- },
139
- })
140
- "
141
- `);
142
- });
143
- });
144
-
145
- //# sourceMappingURL=minimalSimple.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/actions/migration/templates/__tests__/minimalSimple.test.ts"],"sourcesContent":["import {describe, expect, test} from 'vitest'\n\nimport {minimalSimple} from '../minimalSimple'\n\ndescribe('#minimalSimple', () => {\n test('creates template with no doc types', () => {\n const minimalSimpleTemplate = minimalSimple({\n documentTypes: [],\n migrationName: 'My Migration',\n })\n\n expect(minimalSimpleTemplate).toMatchInlineSnapshot(`\n \"import {at, defineMigration, setIfMissing, unset} from '@sanity/migrate'\n\n export default defineMigration({\n title: \"My Migration\",\n\n migrate: {\n document(doc, context) {\n // this will be called for every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n\n return at('title', setIfMissing('Default title'))\n },\n node(node, path, context) {\n // this will be called for every node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n\n if (typeof node === 'string' && node === 'deleteme') {\n return unset()\n }\n },\n object(node, path, context) {\n // this will be called for every object node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n if (node._type === 'author') {\n // make sure all authors objects have a books array\n return at('books', setIfMissing([]))\n }\n },\n array(node, path, context) {\n // this will be called for every array node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n string(node, path, context) {\n // this will be called for every string node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n number(node, path, context) {\n // this will be called for every number node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n boolean(node, path, context) {\n // this will be called for every boolean node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n null(node, path, context) {\n // this will be called for every null node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n },\n })\n \"\n `)\n })\n\n test('creates template with doc types', () => {\n const minimalSimpleTemplate = minimalSimple({\n documentTypes: ['document-1', 'document-2', 'document-3'],\n migrationName: 'My Migration',\n })\n\n expect(minimalSimpleTemplate).toMatchInlineSnapshot(`\n \"import {at, defineMigration, setIfMissing, unset} from '@sanity/migrate'\n\n export default defineMigration({\n title: \"My Migration\",\n documentTypes: [\"document-1\", \"document-2\", \"document-3\"],\n\n migrate: {\n document(doc, context) {\n // this will be called for every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n\n return at('title', setIfMissing('Default title'))\n },\n node(node, path, context) {\n // this will be called for every node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n\n if (typeof node === 'string' && node === 'deleteme') {\n return unset()\n }\n },\n object(node, path, context) {\n // this will be called for every object node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n if (node._type === 'author') {\n // make sure all authors objects have a books array\n return at('books', setIfMissing([]))\n }\n },\n array(node, path, context) {\n // this will be called for every array node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n string(node, path, context) {\n // this will be called for every string node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n number(node, path, context) {\n // this will be called for every number node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n boolean(node, path, context) {\n // this will be called for every boolean node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n null(node, path, context) {\n // this will be called for every null node in every document of the matching type\n // any patch returned will be applied to the document\n // you can also return mutations that touches other documents\n },\n },\n })\n \"\n `)\n })\n})\n"],"names":["describe","expect","test","minimalSimple","minimalSimpleTemplate","documentTypes","migrationName","toMatchInlineSnapshot"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,QAAO,SAAQ;AAE7C,SAAQC,aAAa,QAAO,mBAAkB;AAE9CH,SAAS,kBAAkB;IACzBE,KAAK,sCAAsC;QACzC,MAAME,wBAAwBD,cAAc;YAC1CE,eAAe,EAAE;YACjBC,eAAe;QACjB;QAEAL,OAAOG,uBAAuBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4DrD,CAAC;IACH;IAEAL,KAAK,mCAAmC;QACtC,MAAME,wBAAwBD,cAAc;YAC1CE,eAAe;gBAAC;gBAAc;gBAAc;aAAa;YACzDC,eAAe;QACjB;QAEAL,OAAOG,uBAAuBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DrD,CAAC;IACH;AACF"}
@@ -1,63 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import { renameField } from '../renameField';
3
- describe('#renameField', ()=>{
4
- test('creates template with no doc types', ()=>{
5
- const renameFieldTemplate = renameField({
6
- documentTypes: [],
7
- migrationName: 'My Migration'
8
- });
9
- expect(renameFieldTemplate).toMatchInlineSnapshot(`
10
- "import {defineMigration, at, setIfMissing, unset} from '@sanity/migrate'
11
-
12
- const from = 'oldFieldName'
13
- const to = 'newFieldName'
14
-
15
- export default defineMigration({
16
- title: "My Migration",
17
-
18
- migrate: {
19
- document(doc, context) {
20
- return [
21
- at(to, setIfMissing(doc[from])),
22
- at(from, unset())
23
- ]
24
- }
25
- }
26
- })
27
- "
28
- `);
29
- });
30
- test('creates template with doc types', ()=>{
31
- const renameFieldTemplate = renameField({
32
- documentTypes: [
33
- 'document-1',
34
- 'document-2',
35
- 'document-3'
36
- ],
37
- migrationName: 'My Migration'
38
- });
39
- expect(renameFieldTemplate).toMatchInlineSnapshot(`
40
- "import {defineMigration, at, setIfMissing, unset} from '@sanity/migrate'
41
-
42
- const from = 'oldFieldName'
43
- const to = 'newFieldName'
44
-
45
- export default defineMigration({
46
- title: "My Migration",
47
- documentTypes: ["document-1", "document-2", "document-3"],
48
-
49
- migrate: {
50
- document(doc, context) {
51
- return [
52
- at(to, setIfMissing(doc[from])),
53
- at(from, unset())
54
- ]
55
- }
56
- }
57
- })
58
- "
59
- `);
60
- });
61
- });
62
-
63
- //# sourceMappingURL=renameField.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/actions/migration/templates/__tests__/renameField.test.ts"],"sourcesContent":["import {describe, expect, test} from 'vitest'\n\nimport {renameField} from '../renameField'\n\ndescribe('#renameField', () => {\n test('creates template with no doc types', () => {\n const renameFieldTemplate = renameField({\n documentTypes: [],\n migrationName: 'My Migration',\n })\n\n expect(renameFieldTemplate).toMatchInlineSnapshot(`\n \"import {defineMigration, at, setIfMissing, unset} from '@sanity/migrate'\n\n const from = 'oldFieldName'\n const to = 'newFieldName'\n\n export default defineMigration({\n title: \"My Migration\",\n\n migrate: {\n document(doc, context) {\n return [\n at(to, setIfMissing(doc[from])),\n at(from, unset())\n ]\n }\n }\n })\n \"\n `)\n })\n\n test('creates template with doc types', () => {\n const renameFieldTemplate = renameField({\n documentTypes: ['document-1', 'document-2', 'document-3'],\n migrationName: 'My Migration',\n })\n\n expect(renameFieldTemplate).toMatchInlineSnapshot(`\n \"import {defineMigration, at, setIfMissing, unset} from '@sanity/migrate'\n\n const from = 'oldFieldName'\n const to = 'newFieldName'\n\n export default defineMigration({\n title: \"My Migration\",\n documentTypes: [\"document-1\", \"document-2\", \"document-3\"],\n\n migrate: {\n document(doc, context) {\n return [\n at(to, setIfMissing(doc[from])),\n at(from, unset())\n ]\n }\n }\n })\n \"\n `)\n })\n})\n"],"names":["describe","expect","test","renameField","renameFieldTemplate","documentTypes","migrationName","toMatchInlineSnapshot"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,QAAO,SAAQ;AAE7C,SAAQC,WAAW,QAAO,iBAAgB;AAE1CH,SAAS,gBAAgB;IACvBE,KAAK,sCAAsC;QACzC,MAAME,sBAAsBD,YAAY;YACtCE,eAAe,EAAE;YACjBC,eAAe;QACjB;QAEAL,OAAOG,qBAAqBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;IAmBnD,CAAC;IACH;IAEAL,KAAK,mCAAmC;QACtC,MAAME,sBAAsBD,YAAY;YACtCE,eAAe;gBAAC;gBAAc;gBAAc;aAAa;YACzDC,eAAe;QACjB;QAEAL,OAAOG,qBAAqBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;IAoBnD,CAAC;IACH;AACF"}
@@ -1,61 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import { renameType } from '../renameType';
3
- describe('#renameType', ()=>{
4
- test('creates template with no doc types', ()=>{
5
- const renameTypeTemplate = renameType({
6
- documentTypes: [],
7
- migrationName: 'My Migration'
8
- });
9
- expect(renameTypeTemplate).toMatchInlineSnapshot(`
10
- "import {defineMigration, at, set} from '@sanity/migrate'
11
-
12
- const oldType = 'old'
13
- const newType = 'new'
14
-
15
- export default defineMigration({
16
- title: "My Migration",
17
-
18
- migrate: {
19
- object(object, path, context) {
20
- if (object._type === oldType) {
21
- return at('_type', set(newType))
22
- }
23
- }
24
- }
25
- })
26
- "
27
- `);
28
- });
29
- test('creates template with doc types', ()=>{
30
- const renameTypeTemplate = renameType({
31
- documentTypes: [
32
- 'document-1',
33
- 'document-2',
34
- 'document-3'
35
- ],
36
- migrationName: 'My Migration'
37
- });
38
- expect(renameTypeTemplate).toMatchInlineSnapshot(`
39
- "import {defineMigration, at, set} from '@sanity/migrate'
40
-
41
- const oldType = 'old'
42
- const newType = 'new'
43
-
44
- export default defineMigration({
45
- title: "My Migration",
46
- documentTypes: ["document-1", "document-2", "document-3"],
47
-
48
- migrate: {
49
- object(object, path, context) {
50
- if (object._type === oldType) {
51
- return at('_type', set(newType))
52
- }
53
- }
54
- }
55
- })
56
- "
57
- `);
58
- });
59
- });
60
-
61
- //# sourceMappingURL=renameType.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/actions/migration/templates/__tests__/renameType.test.ts"],"sourcesContent":["import {describe, expect, test} from 'vitest'\n\nimport {renameType} from '../renameType'\n\ndescribe('#renameType', () => {\n test('creates template with no doc types', () => {\n const renameTypeTemplate = renameType({\n documentTypes: [],\n migrationName: 'My Migration',\n })\n\n expect(renameTypeTemplate).toMatchInlineSnapshot(`\n \"import {defineMigration, at, set} from '@sanity/migrate'\n\n const oldType = 'old'\n const newType = 'new'\n\n export default defineMigration({\n title: \"My Migration\",\n\n migrate: {\n object(object, path, context) {\n if (object._type === oldType) {\n return at('_type', set(newType))\n }\n }\n }\n })\n \"\n `)\n })\n\n test('creates template with doc types', () => {\n const renameTypeTemplate = renameType({\n documentTypes: ['document-1', 'document-2', 'document-3'],\n migrationName: 'My Migration',\n })\n\n expect(renameTypeTemplate).toMatchInlineSnapshot(`\n \"import {defineMigration, at, set} from '@sanity/migrate'\n\n const oldType = 'old'\n const newType = 'new'\n\n export default defineMigration({\n title: \"My Migration\",\n documentTypes: [\"document-1\", \"document-2\", \"document-3\"],\n\n migrate: {\n object(object, path, context) {\n if (object._type === oldType) {\n return at('_type', set(newType))\n }\n }\n }\n })\n \"\n `)\n })\n})\n"],"names":["describe","expect","test","renameType","renameTypeTemplate","documentTypes","migrationName","toMatchInlineSnapshot"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,QAAO,SAAQ;AAE7C,SAAQC,UAAU,QAAO,gBAAe;AAExCH,SAAS,eAAe;IACtBE,KAAK,sCAAsC;QACzC,MAAME,qBAAqBD,WAAW;YACpCE,eAAe,EAAE;YACjBC,eAAe;QACjB;QAEAL,OAAOG,oBAAoBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;IAkBlD,CAAC;IACH;IAEAL,KAAK,mCAAmC;QACtC,MAAME,qBAAqBD,WAAW;YACpCE,eAAe;gBAAC;gBAAc;gBAAc;aAAa;YACzDC,eAAe;QACjB;QAEAL,OAAOG,oBAAoBG,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;IAmBlD,CAAC;IACH;AACF"}