@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.
- package/dist/actions/auth/login/{index.js → login.js} +1 -1
- package/dist/actions/auth/login/{index.js.map → login.js.map} +1 -1
- package/dist/actions/dev/startStudioDevServer.js +3 -8
- package/dist/actions/dev/startStudioDevServer.js.map +1 -1
- package/dist/actions/dev/types.d.ts +1 -3
- package/dist/actions/dev/types.js.map +1 -1
- package/dist/actions/documents/validate.d.ts +0 -2
- package/dist/actions/documents/validate.js +21 -1
- package/dist/actions/documents/validate.js.map +1 -1
- package/dist/actions/exec/execScript.js +1 -1
- package/dist/actions/exec/execScript.js.map +1 -1
- package/dist/actions/graphql/__tests__/getGraphQLAPIs.test.js +1 -1
- package/dist/actions/graphql/__tests__/getGraphQLAPIs.test.js.map +1 -1
- package/dist/actions/graphql/getGraphQLAPIs.js +1 -1
- package/dist/actions/graphql/getGraphQLAPIs.js.map +1 -1
- package/dist/actions/manifest/extractManifest.js +1 -4
- package/dist/actions/manifest/extractManifest.js.map +1 -1
- package/dist/actions/organizations/getOrganizationChoices.d.ts +6 -0
- package/dist/actions/organizations/getOrganizationChoices.js +23 -0
- package/dist/actions/organizations/getOrganizationChoices.js.map +1 -0
- package/dist/actions/organizations/getOrganizationsWithAttachGrantInfo.d.ts +2 -0
- package/dist/actions/organizations/getOrganizationsWithAttachGrantInfo.js +9 -0
- package/dist/actions/organizations/getOrganizationsWithAttachGrantInfo.js.map +1 -0
- package/dist/actions/organizations/hasProjectAttachGrant.d.ts +1 -0
- package/dist/actions/organizations/hasProjectAttachGrant.js +24 -0
- package/dist/actions/organizations/hasProjectAttachGrant.js.map +1 -0
- package/dist/actions/schema/deleteSchemaAction.d.ts +13 -5
- package/dist/actions/schema/deleteSchemaAction.js +12 -17
- package/dist/actions/schema/deleteSchemaAction.js.map +1 -1
- package/dist/actions/schema/deploySchemas.d.ts +15 -0
- package/dist/actions/schema/deploySchemas.js +98 -0
- package/dist/actions/schema/deploySchemas.js.map +1 -0
- package/dist/actions/schema/listSchemas.d.ts +12 -0
- package/dist/actions/schema/listSchemas.js +119 -0
- package/dist/actions/schema/listSchemas.js.map +1 -0
- package/dist/actions/schema/schemaStoreTypes.d.ts +0 -11
- package/dist/actions/schema/schemaStoreTypes.js.map +1 -1
- package/dist/actions/schema/utils/debug.d.ts +2 -0
- package/dist/actions/schema/utils/debug.js +5 -0
- package/dist/actions/schema/utils/debug.js.map +1 -0
- package/dist/actions/schema/utils/manifestExtractor.d.ts +3 -8
- package/dist/actions/schema/utils/manifestExtractor.js +12 -17
- package/dist/actions/schema/utils/manifestExtractor.js.map +1 -1
- package/dist/actions/schema/utils/manifestReader.d.ts +2 -9
- package/dist/actions/schema/utils/manifestReader.js +6 -12
- package/dist/actions/schema/utils/manifestReader.js.map +1 -1
- package/dist/actions/schema/utils/schemaStoreOutStrings.d.ts +0 -1
- package/dist/actions/schema/utils/schemaStoreOutStrings.js +1 -1
- package/dist/actions/schema/utils/schemaStoreOutStrings.js.map +1 -1
- package/dist/actions/schema/utils/schemaStoreValidation.d.ts +10 -62
- package/dist/actions/schema/utils/schemaStoreValidation.js +40 -127
- package/dist/actions/schema/utils/schemaStoreValidation.js.map +1 -1
- package/dist/actions/schema/utils/uniqByProjectIdDataset.d.ts +14 -0
- package/dist/actions/schema/utils/uniqByProjectIdDataset.js +9 -0
- package/dist/actions/schema/utils/uniqByProjectIdDataset.js.map +1 -0
- package/dist/actions/users/getMembersForProject.d.ts +1 -3
- package/dist/actions/users/getMembersForProject.js +6 -17
- package/dist/actions/users/getMembersForProject.js.map +1 -1
- package/dist/actions/users/types.d.ts +0 -11
- package/dist/actions/users/types.js.map +1 -1
- package/dist/commands/__tests__/debug.test.js +113 -220
- package/dist/commands/__tests__/debug.test.js.map +1 -1
- package/dist/commands/__tests__/deploy.test.js +325 -293
- package/dist/commands/__tests__/deploy.test.js.map +1 -1
- package/dist/commands/__tests__/dev.test.js +62 -19
- package/dist/commands/__tests__/dev.test.js.map +1 -1
- package/dist/commands/__tests__/init/init.authentication.test.js +73 -0
- package/dist/commands/__tests__/init/init.authentication.test.js.map +1 -0
- package/dist/commands/__tests__/init/init.create-new-project.test.js +195 -0
- package/dist/commands/__tests__/init/init.create-new-project.test.js.map +1 -0
- package/dist/commands/__tests__/init/init.plan.test.js +279 -0
- package/dist/commands/__tests__/init/init.plan.test.js.map +1 -0
- package/dist/commands/__tests__/init/init.setup.test.js +335 -0
- package/dist/commands/__tests__/init/init.setup.test.js.map +1 -0
- package/dist/commands/__tests__/install.test.js +46 -22
- package/dist/commands/__tests__/install.test.js.map +1 -1
- package/dist/commands/__tests__/logout.test.js +8 -5
- package/dist/commands/__tests__/logout.test.js.map +1 -1
- package/dist/commands/__tests__/manage.test.js +29 -24
- package/dist/commands/__tests__/manage.test.js.map +1 -1
- package/dist/commands/__tests__/migration.test.js +119 -0
- package/dist/commands/__tests__/migration.test.js.map +1 -0
- package/dist/commands/__tests__/versions.test.js +22 -14
- package/dist/commands/__tests__/versions.test.js.map +1 -1
- package/dist/commands/backup/__tests__/disable.test.js +72 -75
- package/dist/commands/backup/__tests__/disable.test.js.map +1 -1
- package/dist/commands/backup/__tests__/download.test.js +169 -80
- package/dist/commands/backup/__tests__/download.test.js.map +1 -1
- package/dist/commands/backup/__tests__/enable.test.js +109 -140
- package/dist/commands/backup/__tests__/enable.test.js.map +1 -1
- package/dist/commands/backup/__tests__/list.test.js +84 -75
- package/dist/commands/backup/__tests__/list.test.js.map +1 -1
- package/dist/commands/backup/disable.js +5 -11
- package/dist/commands/backup/disable.js.map +1 -1
- package/dist/commands/backup/enable.js +5 -11
- package/dist/commands/backup/enable.js.map +1 -1
- package/dist/commands/backup/list.js +7 -8
- package/dist/commands/backup/list.js.map +1 -1
- package/dist/commands/cors/__tests__/add.test.js +68 -38
- package/dist/commands/cors/__tests__/add.test.js.map +1 -1
- package/dist/commands/cors/__tests__/delete.test.js +52 -37
- package/dist/commands/cors/__tests__/delete.test.js.map +1 -1
- package/dist/commands/cors/__tests__/list.test.js +80 -57
- package/dist/commands/cors/__tests__/list.test.js.map +1 -1
- package/dist/commands/cors/add.js +5 -13
- package/dist/commands/cors/add.js.map +1 -1
- package/dist/commands/cors/delete.js +7 -15
- package/dist/commands/cors/delete.js.map +1 -1
- package/dist/commands/cors/list.js +2 -10
- package/dist/commands/cors/list.js.map +1 -1
- package/dist/commands/dataset/__tests__/copy.test.js +197 -89
- package/dist/commands/dataset/__tests__/copy.test.js.map +1 -1
- package/dist/commands/dataset/__tests__/create.test.js +147 -117
- package/dist/commands/dataset/__tests__/create.test.js.map +1 -1
- package/dist/commands/dataset/__tests__/delete.test.js +75 -68
- package/dist/commands/dataset/__tests__/delete.test.js.map +1 -1
- package/dist/commands/dataset/__tests__/export.test.js +123 -83
- package/dist/commands/dataset/__tests__/export.test.js.map +1 -1
- package/dist/commands/dataset/__tests__/import.test.js +2 -2
- package/dist/commands/dataset/__tests__/import.test.js.map +1 -1
- package/dist/commands/dataset/__tests__/list.test.js +107 -65
- package/dist/commands/dataset/__tests__/list.test.js.map +1 -1
- package/dist/commands/dataset/alias/__tests__/create.test.js +114 -74
- package/dist/commands/dataset/alias/__tests__/create.test.js.map +1 -1
- package/dist/commands/dataset/alias/__tests__/delete.test.js +40 -29
- package/dist/commands/dataset/alias/__tests__/delete.test.js.map +1 -1
- package/dist/commands/dataset/alias/__tests__/link.test.js +114 -74
- package/dist/commands/dataset/alias/__tests__/link.test.js.map +1 -1
- package/dist/commands/dataset/alias/__tests__/unlink.test.js +44 -29
- package/dist/commands/dataset/alias/__tests__/unlink.test.js.map +1 -1
- package/dist/commands/dataset/export.js +4 -4
- package/dist/commands/dataset/export.js.map +1 -1
- package/dist/commands/dataset/visibility/__tests__/get.test.js +48 -67
- package/dist/commands/dataset/visibility/__tests__/get.test.js.map +1 -1
- package/dist/commands/dataset/visibility/__tests__/set.test.js +76 -123
- package/dist/commands/dataset/visibility/__tests__/set.test.js.map +1 -1
- package/dist/commands/dev.js +0 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs/__tests__/search.test.js +8 -7
- package/dist/commands/docs/__tests__/search.test.js.map +1 -1
- package/dist/commands/documents/__tests__/create.test.js +328 -265
- package/dist/commands/documents/__tests__/create.test.js.map +1 -1
- package/dist/commands/documents/__tests__/delete.test.js +119 -87
- package/dist/commands/documents/__tests__/delete.test.js.map +1 -1
- package/dist/commands/documents/__tests__/get.test.js +68 -95
- package/dist/commands/documents/__tests__/get.test.js.map +1 -1
- package/dist/commands/documents/__tests__/query.test.js +87 -192
- package/dist/commands/documents/__tests__/query.test.js.map +1 -1
- package/dist/commands/documents/__tests__/validate.test.js +52 -29
- package/dist/commands/documents/__tests__/validate.test.js.map +1 -1
- package/dist/commands/documents/create.d.ts +1 -0
- package/dist/commands/documents/create.js +10 -9
- package/dist/commands/documents/create.js.map +1 -1
- package/dist/commands/documents/delete.js +2 -3
- package/dist/commands/documents/delete.js.map +1 -1
- package/dist/commands/documents/get.js +2 -3
- package/dist/commands/documents/get.js.map +1 -1
- package/dist/commands/documents/query.js +2 -3
- package/dist/commands/documents/query.js.map +1 -1
- package/dist/commands/documents/validate.js +0 -20
- package/dist/commands/documents/validate.js.map +1 -1
- package/dist/commands/graphql/__tests__/list.test.js +57 -45
- package/dist/commands/graphql/__tests__/list.test.js.map +1 -1
- package/dist/commands/graphql/__tests__/undeploy.test.js +85 -59
- package/dist/commands/graphql/__tests__/undeploy.test.js.map +1 -1
- package/dist/commands/graphql/list.js +2 -2
- package/dist/commands/graphql/list.js.map +1 -1
- package/dist/commands/graphql/undeploy.js +4 -9
- package/dist/commands/graphql/undeploy.js.map +1 -1
- package/dist/commands/hook/__tests__/attempt.test.js +48 -33
- package/dist/commands/hook/__tests__/attempt.test.js.map +1 -1
- package/dist/commands/hook/__tests__/create.test.js +49 -51
- package/dist/commands/hook/__tests__/create.test.js.map +1 -1
- package/dist/commands/hook/__tests__/delete.test.js +43 -30
- package/dist/commands/hook/__tests__/delete.test.js.map +1 -1
- package/dist/commands/hook/__tests__/list.test.js +38 -31
- package/dist/commands/hook/__tests__/list.test.js.map +1 -1
- package/dist/commands/hook/__tests__/logs.test.js +68 -40
- package/dist/commands/hook/__tests__/logs.test.js.map +1 -1
- package/dist/commands/hook/create.js +2 -6
- package/dist/commands/hook/create.js.map +1 -1
- package/dist/commands/hook/delete.js +5 -17
- package/dist/commands/hook/delete.js.map +1 -1
- package/dist/commands/hook/list.js +2 -8
- package/dist/commands/hook/list.js.map +1 -1
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +151 -18
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/manifest/__tests__/extract.test.js +22 -13
- package/dist/commands/manifest/__tests__/extract.test.js.map +1 -1
- package/dist/commands/media/__tests__/create-aspect.test.js +41 -28
- package/dist/commands/media/__tests__/create-aspect.test.js.map +1 -1
- package/dist/commands/media/__tests__/delete-aspect.test.js +44 -35
- package/dist/commands/media/__tests__/delete-aspect.test.js.map +1 -1
- package/dist/commands/media/__tests__/deploy-aspect.test.js +67 -80
- package/dist/commands/media/__tests__/deploy-aspect.test.js.map +1 -1
- package/dist/commands/media/__tests__/export.test.js +365 -66
- package/dist/commands/media/__tests__/export.test.js.map +1 -1
- package/dist/commands/media/__tests__/import.test.js +171 -105
- package/dist/commands/media/__tests__/import.test.js.map +1 -1
- package/dist/commands/media/export.js +2 -2
- package/dist/commands/media/export.js.map +1 -1
- package/dist/commands/media/import.js +2 -2
- package/dist/commands/media/import.js.map +1 -1
- package/dist/commands/projects/__tests__/list.test.js +5 -4
- package/dist/commands/projects/__tests__/list.test.js.map +1 -1
- package/dist/commands/projects/list.js +2 -6
- package/dist/commands/projects/list.js.map +1 -1
- package/dist/commands/schema/__tests__/delete.test.js +396 -151
- package/dist/commands/schema/__tests__/delete.test.js.map +1 -1
- package/dist/commands/schema/__tests__/deploy.test.js +348 -0
- package/dist/commands/schema/__tests__/deploy.test.js.map +1 -0
- package/dist/commands/schema/__tests__/extract.test.js +19 -11
- package/dist/commands/schema/__tests__/extract.test.js.map +1 -1
- package/dist/commands/schema/__tests__/list.test.js +399 -0
- package/dist/commands/schema/__tests__/list.test.js.map +1 -0
- package/dist/commands/schema/__tests__/validate.test.js +27 -10
- package/dist/commands/schema/__tests__/validate.test.js.map +1 -1
- package/dist/commands/schema/delete.d.ts +1 -1
- package/dist/commands/schema/delete.js +20 -23
- package/dist/commands/schema/delete.js.map +1 -1
- package/dist/commands/schema/deploy.d.ts +16 -0
- package/dist/commands/schema/deploy.js +98 -0
- package/dist/commands/schema/deploy.js.map +1 -0
- package/dist/commands/schema/list.d.ts +15 -0
- package/dist/commands/schema/list.js +104 -0
- package/dist/commands/schema/list.js.map +1 -0
- package/dist/commands/telemetry/__tests__/disable.test.js +7 -5
- package/dist/commands/telemetry/__tests__/disable.test.js.map +1 -1
- package/dist/commands/telemetry/__tests__/enable.test.js +7 -5
- package/dist/commands/telemetry/__tests__/enable.test.js.map +1 -1
- package/dist/commands/telemetry/__tests__/status.test.js +7 -5
- package/dist/commands/telemetry/__tests__/status.test.js.map +1 -1
- package/dist/commands/tokens/__tests__/add.test.js +55 -40
- package/dist/commands/tokens/__tests__/add.test.js.map +1 -1
- package/dist/commands/tokens/__tests__/delete.test.js +72 -42
- package/dist/commands/tokens/__tests__/delete.test.js.map +1 -1
- package/dist/commands/tokens/__tests__/list.test.js +87 -60
- package/dist/commands/tokens/__tests__/list.test.js.map +1 -1
- package/dist/commands/tokens/add.js +3 -5
- package/dist/commands/tokens/add.js.map +1 -1
- package/dist/commands/users/__tests__/invite.test.js +100 -79
- package/dist/commands/users/__tests__/invite.test.js.map +1 -1
- package/dist/commands/users/__tests__/list.test.js +186 -180
- package/dist/commands/users/__tests__/list.test.js.map +1 -1
- package/dist/commands/users/invite.js +6 -17
- package/dist/commands/users/invite.js.map +1 -1
- package/dist/commands/users/list.js +4 -7
- package/dist/commands/users/list.js.map +1 -1
- package/dist/config/createCliConfig.d.ts +4 -4
- package/dist/services/backup.d.ts +8 -0
- package/dist/services/backup.js +19 -0
- package/dist/services/backup.js.map +1 -1
- package/dist/services/cors.d.ts +23 -0
- package/dist/services/cors.js +38 -0
- package/dist/services/cors.js.map +1 -0
- package/dist/services/graphql.d.ts +7 -0
- package/dist/services/graphql.js +11 -0
- package/dist/services/graphql.js.map +1 -1
- package/dist/services/hooks.d.ts +2 -0
- package/dist/services/hooks.js +19 -0
- package/dist/services/hooks.js.map +1 -1
- package/dist/services/organizations.d.ts +40 -0
- package/dist/services/organizations.js +41 -0
- package/dist/services/organizations.js.map +1 -0
- package/dist/services/projects.d.ts +31 -0
- package/dist/services/projects.js +71 -1
- package/dist/services/projects.js.map +1 -1
- package/dist/services/schemas.d.ts +4 -0
- package/dist/services/schemas.js +40 -0
- package/dist/services/schemas.js.map +1 -0
- package/dist/services/user.d.ts +10 -0
- package/dist/services/user.js +24 -0
- package/dist/services/user.js.map +1 -0
- package/dist/util/__tests__/getCliVersion.test.js +2 -2
- package/dist/util/__tests__/getCliVersion.test.js.map +1 -1
- package/dist/util/errorMessages.d.ts +1 -0
- package/dist/util/errorMessages.js +1 -0
- package/dist/util/errorMessages.js.map +1 -1
- package/dist/util/getCliVersion.js +1 -1
- package/dist/util/getCliVersion.js.map +1 -1
- package/dist/util/readPackageJson.d.ts +1 -15
- package/dist/util/readPackageJson.js +1 -1
- package/dist/util/readPackageJson.js.map +1 -1
- package/dist/util/uniqBy.d.ts +1 -0
- package/dist/util/uniqBy.js +14 -0
- package/dist/util/uniqBy.js.map +1 -0
- package/oclif.config.js +6 -1
- package/oclif.manifest.json +152 -158
- package/package.json +30 -31
- package/dist/actions/cors/constants.d.ts +0 -1
- package/dist/actions/cors/constants.js +0 -3
- package/dist/actions/cors/constants.js.map +0 -1
- package/dist/actions/cors/types.d.ts +0 -9
- package/dist/actions/cors/types.js +0 -3
- package/dist/actions/cors/types.js.map +0 -1
- package/dist/actions/migration/getMigrationRootDirectory.d.ts +0 -2
- package/dist/actions/migration/getMigrationRootDirectory.js +0 -14
- package/dist/actions/migration/getMigrationRootDirectory.js.map +0 -1
- package/dist/actions/migration/resolveMigrations.d.ts +0 -19
- package/dist/actions/migration/resolveMigrations.js +0 -43
- package/dist/actions/migration/resolveMigrations.js.map +0 -1
- package/dist/actions/migration/templates/__tests__/minimalAdvanced.test.js +0 -65
- package/dist/actions/migration/templates/__tests__/minimalAdvanced.test.js.map +0 -1
- package/dist/actions/migration/templates/__tests__/minimalSimple.test.js +0 -145
- package/dist/actions/migration/templates/__tests__/minimalSimple.test.js.map +0 -1
- package/dist/actions/migration/templates/__tests__/renameField.test.js +0 -63
- package/dist/actions/migration/templates/__tests__/renameField.test.js.map +0 -1
- package/dist/actions/migration/templates/__tests__/renameType.test.js +0 -61
- package/dist/actions/migration/templates/__tests__/renameType.test.js.map +0 -1
- package/dist/actions/migration/templates/__tests__/stringToPTE.test.js +0 -87
- package/dist/actions/migration/templates/__tests__/stringToPTE.test.js.map +0 -1
- package/dist/actions/migration/templates/index.d.ts +0 -5
- package/dist/actions/migration/templates/index.js +0 -7
- package/dist/actions/migration/templates/index.js.map +0 -1
- package/dist/actions/migration/templates/minimalAdvanced.d.ts +0 -4
- package/dist/actions/migration/templates/minimalAdvanced.js +0 -21
- package/dist/actions/migration/templates/minimalAdvanced.js.map +0 -1
- package/dist/actions/migration/templates/minimalSimple.d.ts +0 -4
- package/dist/actions/migration/templates/minimalSimple.js +0 -61
- package/dist/actions/migration/templates/minimalSimple.js.map +0 -1
- package/dist/actions/migration/templates/renameField.d.ts +0 -4
- package/dist/actions/migration/templates/renameField.js +0 -20
- package/dist/actions/migration/templates/renameField.js.map +0 -1
- package/dist/actions/migration/templates/renameType.d.ts +0 -4
- package/dist/actions/migration/templates/renameType.js +0 -19
- package/dist/actions/migration/templates/renameType.js.map +0 -1
- package/dist/actions/migration/templates/stringToPTE.d.ts +0 -4
- package/dist/actions/migration/templates/stringToPTE.js +0 -32
- package/dist/actions/migration/templates/stringToPTE.js.map +0 -1
- package/dist/actions/schema/__tests__/deleteSchemaAction.test.js +0 -294
- package/dist/actions/schema/__tests__/deleteSchemaAction.test.js.map +0 -1
- package/dist/actions/schema/schemaStoreConstants.d.ts +0 -1
- package/dist/actions/schema/schemaStoreConstants.js +0 -4
- package/dist/actions/schema/schemaStoreConstants.js.map +0 -1
- package/dist/actions/schema/utils/schemaActionHelpers.d.ts +0 -1
- package/dist/actions/schema/utils/schemaActionHelpers.js +0 -5
- package/dist/actions/schema/utils/schemaActionHelpers.js.map +0 -1
- package/dist/actions/schema/utils/schemaApiClient.d.ts +0 -6
- package/dist/actions/schema/utils/schemaApiClient.js +0 -17
- package/dist/actions/schema/utils/schemaApiClient.js.map +0 -1
- package/dist/actions/users/apiVersion.d.ts +0 -6
- package/dist/actions/users/apiVersion.js +0 -7
- package/dist/actions/users/apiVersion.js.map +0 -1
- package/dist/commands/__tests__/init.test.js +0 -411
- package/dist/commands/__tests__/init.test.js.map +0 -1
- package/dist/commands/migration/__tests__/create.test.js +0 -296
- package/dist/commands/migration/__tests__/create.test.js.map +0 -1
- package/dist/commands/migration/__tests__/list.test.js +0 -166
- package/dist/commands/migration/__tests__/list.test.js.map +0 -1
- package/dist/commands/migration/__tests__/run.test.js +0 -481
- package/dist/commands/migration/__tests__/run.test.js.map +0 -1
- package/dist/commands/migration/create.d.ts +0 -17
- package/dist/commands/migration/create.js +0 -143
- package/dist/commands/migration/create.js.map +0 -1
- package/dist/commands/migration/list.d.ts +0 -9
- package/dist/commands/migration/list.js +0 -61
- package/dist/commands/migration/list.js.map +0 -1
- package/dist/commands/migration/run.d.ts +0 -26
- package/dist/commands/migration/run.js +0 -271
- package/dist/commands/migration/run.js.map +0 -1
- package/dist/util/migration/constants.d.ts +0 -3
- package/dist/util/migration/constants.js +0 -10
- package/dist/util/migration/constants.js.map +0 -1
- package/dist/util/migration/ensureApiVersionFormat.d.ts +0 -9
- package/dist/util/migration/ensureApiVersionFormat.js +0 -16
- package/dist/util/migration/ensureApiVersionFormat.js.map +0 -1
- package/dist/util/migration/prettyMutationFormatter.d.ts +0 -8
- package/dist/util/migration/prettyMutationFormatter.js +0 -141
- package/dist/util/migration/prettyMutationFormatter.js.map +0 -1
- package/dist/utils/migration/resolveMigrationScript.d.ts +0 -44
- package/dist/utils/migration/resolveMigrationScript.js +0 -74
- package/dist/utils/migration/resolveMigrationScript.js.map +0 -1
- /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
|
+
"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":
|
|
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.
|
|
48
|
+
"@sanity/client": "^7.14.0",
|
|
45
49
|
"@sanity/descriptors": "^1.3.0",
|
|
46
|
-
"@sanity/export": "^6.0.
|
|
50
|
+
"@sanity/export": "^6.0.2",
|
|
47
51
|
"@sanity/id-utils": "^1.0.0",
|
|
48
|
-
"@sanity/import": "^4.0.
|
|
49
|
-
"@sanity/migrate": "^5.1
|
|
50
|
-
"@sanity/runtime-cli": "^12.
|
|
51
|
-
"@sanity/schema": "^5.
|
|
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.
|
|
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": "^
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
102
|
-
"vite": "^7.
|
|
103
|
+
"tsx": "^4.21.0",
|
|
104
|
+
"vite": "^7.3.0",
|
|
103
105
|
"which": "^5.0.0",
|
|
104
|
-
"zod": "^3.
|
|
105
|
-
"@sanity/cli-core": "0.1.0-alpha.
|
|
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.
|
|
111
|
-
"@swc/core": "^1.
|
|
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.
|
|
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
|
-
"
|
|
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.
|
|
134
|
-
"vite-tsconfig-paths": "^6.0.
|
|
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
|
-
"@
|
|
138
|
-
"@sanity/cli
|
|
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 +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 +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,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"}
|