@sanity/cli 6.0.0-alpha.5 → 6.0.0-alpha.7
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/README.md +2907 -109
- package/dist/actions/dataset/create.d.ts +49 -0
- package/dist/actions/dataset/create.js +48 -0
- package/dist/actions/dataset/create.js.map +1 -0
- package/dist/actions/dataset/determineDatasetAclMode.d.ts +37 -0
- package/dist/actions/dataset/determineDatasetAclMode.js +36 -0
- package/dist/actions/dataset/determineDatasetAclMode.js.map +1 -0
- package/dist/actions/debug/gatherDebugInfo.js +15 -21
- package/dist/actions/debug/gatherDebugInfo.js.map +1 -1
- package/dist/actions/debug/types.d.ts +0 -2
- package/dist/actions/debug/types.js.map +1 -1
- package/dist/actions/deploy/deployApp.js +13 -0
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/init/remoteTemplate.js +1 -1
- package/dist/actions/init/remoteTemplate.js.map +1 -1
- package/dist/actions/manifest/extractAppManifest.d.ts +20 -0
- package/dist/actions/manifest/extractAppManifest.js +51 -0
- package/dist/actions/manifest/extractAppManifest.js.map +1 -0
- package/dist/actions/manifest/extractManifest.js +1 -1
- package/dist/actions/manifest/extractManifest.js.map +1 -1
- package/dist/actions/manifest/types.d.ts +6 -1
- package/dist/actions/manifest/types.js.map +1 -1
- package/dist/actions/media/importAspects.js +2 -1
- package/dist/actions/media/importAspects.js.map +1 -1
- package/dist/actions/schema/utils/uniqByProjectIdDataset.d.ts +1 -1
- package/dist/actions/telemetry/resolveConsent.d.ts +1 -9
- package/dist/actions/telemetry/resolveConsent.js +2 -2
- package/dist/actions/telemetry/resolveConsent.js.map +1 -1
- package/dist/actions/telemetry/setConsent.d.ts +1 -4
- package/dist/actions/telemetry/setConsent.js +4 -8
- package/dist/actions/telemetry/setConsent.js.map +1 -1
- package/dist/commands/dataset/create.d.ts +0 -2
- package/dist/commands/dataset/create.js +8 -54
- package/dist/commands/dataset/create.js.map +1 -1
- package/dist/commands/debug.js +5 -9
- package/dist/commands/debug.js.map +1 -1
- package/dist/commands/init.d.ts +6 -1
- package/dist/commands/init.js +358 -20
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/manifest/extract.js +7 -8
- package/dist/commands/manifest/extract.js.map +1 -1
- package/dist/commands/telemetry/disable.js +0 -1
- package/dist/commands/telemetry/disable.js.map +1 -1
- package/dist/commands/telemetry/enable.js +0 -1
- package/dist/commands/telemetry/enable.js.map +1 -1
- package/dist/commands/telemetry/status.js +1 -3
- package/dist/commands/telemetry/status.js.map +1 -1
- package/dist/config/createCliConfig.d.ts +9 -0
- package/dist/hooks/prerun/flushTelemetry.worker.d.ts +2 -0
- package/dist/hooks/prerun/flushTelemetry.worker.js +22 -0
- package/dist/hooks/prerun/flushTelemetry.worker.js.map +1 -0
- package/dist/hooks/prerun/setupTelemetry.js +65 -1
- package/dist/hooks/prerun/setupTelemetry.js.map +1 -1
- package/dist/prompts/init/promptForTypescript.d.ts +2 -0
- package/dist/prompts/init/promptForTypescript.js +15 -0
- package/dist/prompts/init/promptForTypescript.js.map +1 -0
- package/dist/prompts/promptForDatasetAclMode.d.ts +9 -0
- package/dist/prompts/promptForDatasetAclMode.js +27 -0
- package/dist/prompts/promptForDatasetAclMode.js.map +1 -0
- package/dist/prompts/promptForDatasetName.d.ts +1 -1
- package/dist/prompts/promptForDatasetName.js +4 -1
- package/dist/prompts/promptForDatasetName.js.map +1 -1
- package/dist/services/organizations.d.ts +3 -1
- package/dist/services/organizations.js +2 -1
- package/dist/services/organizations.js.map +1 -1
- package/dist/services/telemetry.d.ts +2 -0
- package/dist/services/telemetry.js +20 -0
- package/dist/services/telemetry.js.map +1 -0
- package/dist/services/user.d.ts +5 -0
- package/dist/services/user.js +12 -1
- package/dist/services/user.js.map +1 -1
- package/dist/services/userApplications.d.ts +3 -1
- package/dist/services/userApplications.js +5 -1
- package/dist/services/userApplications.js.map +1 -1
- package/dist/telemetry/cli.telemetry.d.ts +20 -0
- package/dist/telemetry/cli.telemetry.js +8 -0
- package/dist/telemetry/cli.telemetry.js.map +1 -0
- package/dist/telemetry/store/cleanupOldTelemetryFiles.d.ts +5 -0
- package/dist/telemetry/store/cleanupOldTelemetryFiles.js +30 -0
- package/dist/telemetry/store/cleanupOldTelemetryFiles.js.map +1 -0
- package/dist/telemetry/store/createTelemetryStore.d.ts +39 -0
- package/dist/telemetry/store/createTelemetryStore.js +95 -0
- package/dist/telemetry/store/createTelemetryStore.js.map +1 -0
- package/dist/telemetry/store/createTraceId.d.ts +10 -0
- package/dist/telemetry/store/createTraceId.js +10 -0
- package/dist/telemetry/store/createTraceId.js.map +1 -0
- package/dist/telemetry/store/debug.d.ts +5 -0
- package/dist/telemetry/store/debug.js +7 -0
- package/dist/telemetry/store/debug.js.map +1 -0
- package/dist/telemetry/store/findTelemetryFiles.d.ts +13 -0
- package/dist/telemetry/store/findTelemetryFiles.js +34 -0
- package/dist/telemetry/store/findTelemetryFiles.js.map +1 -0
- package/dist/telemetry/store/flushTelemetryFiles.d.ts +20 -0
- package/dist/telemetry/store/flushTelemetryFiles.js +107 -0
- package/dist/telemetry/store/flushTelemetryFiles.js.map +1 -0
- package/dist/telemetry/store/generateTelemetryFilePath.d.ts +17 -0
- package/dist/telemetry/store/generateTelemetryFilePath.js +30 -0
- package/dist/telemetry/store/generateTelemetryFilePath.js.map +1 -0
- package/dist/telemetry/store/getTelemetryBaseInfo.d.ts +27 -0
- package/dist/telemetry/store/getTelemetryBaseInfo.js +34 -0
- package/dist/telemetry/store/getTelemetryBaseInfo.js.map +1 -0
- package/dist/telemetry/store/logger.d.ts +6 -0
- package/dist/telemetry/store/logger.js +54 -0
- package/dist/telemetry/store/logger.js.map +1 -0
- package/dist/telemetry/store/trace.d.ts +6 -0
- package/dist/telemetry/store/trace.js +150 -0
- package/dist/telemetry/store/trace.js.map +1 -0
- package/dist/telemetry/utils/readNDJSON.d.ts +10 -0
- package/dist/telemetry/utils/readNDJSON.js +18 -0
- package/dist/telemetry/utils/readNDJSON.js.map +1 -0
- package/dist/util/detectRuntime.d.ts +8 -0
- package/dist/util/detectRuntime.js +20 -0
- package/dist/util/detectRuntime.js.map +1 -0
- package/dist/util/isStaging.d.ts +7 -0
- package/dist/util/isStaging.js +10 -0
- package/dist/util/isStaging.js.map +1 -0
- package/dist/util/parseArguments.d.ts +35 -0
- package/dist/util/parseArguments.js +42 -0
- package/dist/util/parseArguments.js.map +1 -0
- package/oclif.manifest.json +7 -1
- package/package.json +25 -18
- package/templates/app-quickstart/src/App.css +20 -0
- package/templates/app-quickstart/src/App.tsx +25 -0
- package/templates/app-quickstart/src/ExampleComponent.css +90 -0
- package/templates/app-quickstart/src/ExampleComponent.tsx +37 -0
- package/templates/app-sanity-ui/src/App.tsx +34 -0
- package/templates/app-sanity-ui/src/ExampleComponent.tsx +34 -0
- package/templates/app-sanity-ui/src/SanityUI.tsx +23 -0
- package/templates/blog/README.md +11 -0
- package/templates/blog/schemaTypes/author.js +50 -0
- package/templates/blog/schemaTypes/blockContent.js +67 -0
- package/templates/blog/schemaTypes/category.js +19 -0
- package/templates/blog/schemaTypes/index.js +6 -0
- package/templates/blog/schemaTypes/post.js +65 -0
- package/templates/blog/static/.gitkeep +1 -0
- package/templates/clean/README.md +9 -0
- package/templates/clean/schemaTypes/index.js +1 -0
- package/templates/clean/static/.gitkeep +1 -0
- package/templates/ecommerce/README.md +11 -0
- package/templates/ecommerce/plugins/.gitkeep +1 -0
- package/templates/ecommerce/plugins/barcode-input/BarcodeInput.js +62 -0
- package/templates/ecommerce/plugins/barcode-input/index.js +9 -0
- package/templates/ecommerce/plugins/barcode-input/schemaType.js +60 -0
- package/templates/ecommerce/schemaTypes/blockContent.js +67 -0
- package/templates/ecommerce/schemaTypes/category.js +39 -0
- package/templates/ecommerce/schemaTypes/index.js +23 -0
- package/templates/ecommerce/schemaTypes/locale/localeBlockContent.js +19 -0
- package/templates/ecommerce/schemaTypes/locale/localeString.js +19 -0
- package/templates/ecommerce/schemaTypes/locale/localeText.js +19 -0
- package/templates/ecommerce/schemaTypes/locale/supportedLanguages.js +5 -0
- package/templates/ecommerce/schemaTypes/product.js +83 -0
- package/templates/ecommerce/schemaTypes/productVariant.js +52 -0
- package/templates/ecommerce/schemaTypes/vendor.js +39 -0
- package/templates/ecommerce/static/.gitkeep +1 -0
- package/templates/get-started/README.md +9 -0
- package/templates/get-started/plugins/.gitkeep +1 -0
- package/templates/get-started/plugins/sanity-plugin-tutorial/CustomDefaultLayout.tsx +16 -0
- package/templates/get-started/plugins/sanity-plugin-tutorial/GetStartedTutorial.tsx +104 -0
- package/templates/get-started/plugins/sanity-plugin-tutorial/index.ts +11 -0
- package/templates/get-started/schemaTypes/index.ts +1 -0
- package/templates/get-started/static/.gitkeep +1 -0
- package/templates/moviedb/README.md +10 -0
- package/templates/moviedb/schemaTypes/blockContent.js +67 -0
- package/templates/moviedb/schemaTypes/castMember.js +37 -0
- package/templates/moviedb/schemaTypes/crewMember.js +52 -0
- package/templates/moviedb/schemaTypes/index.js +22 -0
- package/templates/moviedb/schemaTypes/movie.js +85 -0
- package/templates/moviedb/schemaTypes/person.js +37 -0
- package/templates/moviedb/schemaTypes/plotSummaries.js +20 -0
- package/templates/moviedb/schemaTypes/plotSummary.js +24 -0
- package/templates/moviedb/schemaTypes/screening.js +81 -0
- package/templates/moviedb/static/.gitkeep +1 -0
- package/templates/quickstart/README.md +9 -0
- package/templates/quickstart/schemaTypes/index.js +1 -0
- package/templates/quickstart/static/.gitkeep +1 -0
- package/templates/shared/gitignore.txt +29 -0
- package/templates/shared/tsconfig.json +17 -0
- package/templates/shopify/README.md +85 -0
- package/templates/shopify/components/hotspots/ProductTooltip.tsx +38 -0
- package/templates/shopify/components/icons/Shopify.tsx +20 -0
- package/templates/shopify/components/inputs/CollectionHidden.tsx +23 -0
- package/templates/shopify/components/inputs/PlaceholderString.tsx +20 -0
- package/templates/shopify/components/inputs/ProductHidden.tsx +64 -0
- package/templates/shopify/components/inputs/ProductVariantHidden.tsx +24 -0
- package/templates/shopify/components/inputs/ProxyString.tsx +32 -0
- package/templates/shopify/components/media/ColorTheme.tsx +38 -0
- package/templates/shopify/components/media/ShopifyDocumentStatus.tsx +82 -0
- package/templates/shopify/components/studio/Navbar.tsx +29 -0
- package/templates/shopify/constants.ts +61 -0
- package/templates/shopify/docs/features.md +158 -0
- package/templates/shopify/plugins/customDocumentActions/index.ts +55 -0
- package/templates/shopify/plugins/customDocumentActions/shopifyDelete.tsx +144 -0
- package/templates/shopify/plugins/customDocumentActions/shopifyLink.ts +39 -0
- package/templates/shopify/plugins/customDocumentActions/types.ts +14 -0
- package/templates/shopify/schemaTypes/documents/collection.tsx +142 -0
- package/templates/shopify/schemaTypes/documents/colorTheme.tsx +44 -0
- package/templates/shopify/schemaTypes/documents/page.ts +70 -0
- package/templates/shopify/schemaTypes/documents/product.tsx +132 -0
- package/templates/shopify/schemaTypes/documents/productVariant.tsx +67 -0
- package/templates/shopify/schemaTypes/index.ts +108 -0
- package/templates/shopify/schemaTypes/objects/collection/collectionGroupType.ts +27 -0
- package/templates/shopify/schemaTypes/objects/collection/collectionLinksType.ts +16 -0
- package/templates/shopify/schemaTypes/objects/customProductOption/customProductOptionColorObjectType.tsx +48 -0
- package/templates/shopify/schemaTypes/objects/customProductOption/customProductOptionColorType.tsx +50 -0
- package/templates/shopify/schemaTypes/objects/customProductOption/customProductOptionSizeObjectType.ts +40 -0
- package/templates/shopify/schemaTypes/objects/customProductOption/customProductOptionSizeType.ts +49 -0
- package/templates/shopify/schemaTypes/objects/global/footerType.ts +22 -0
- package/templates/shopify/schemaTypes/objects/global/menuLinksType.ts +21 -0
- package/templates/shopify/schemaTypes/objects/global/menuType.ts +17 -0
- package/templates/shopify/schemaTypes/objects/global/notFoundPageType.ts +37 -0
- package/templates/shopify/schemaTypes/objects/hotspot/imageWithProductHotspotsType.ts +48 -0
- package/templates/shopify/schemaTypes/objects/hotspot/productHotspotsType.tsx +17 -0
- package/templates/shopify/schemaTypes/objects/hotspot/spotType.tsx +60 -0
- package/templates/shopify/schemaTypes/objects/link/linkEmailType.tsx +34 -0
- package/templates/shopify/schemaTypes/objects/link/linkExternalType.tsx +37 -0
- package/templates/shopify/schemaTypes/objects/link/linkInternalType.tsx +33 -0
- package/templates/shopify/schemaTypes/objects/link/linkProductType.tsx +60 -0
- package/templates/shopify/schemaTypes/objects/module/accordionGroupType.ts +33 -0
- package/templates/shopify/schemaTypes/objects/module/accordionType.ts +28 -0
- package/templates/shopify/schemaTypes/objects/module/callToActionType.tsx +85 -0
- package/templates/shopify/schemaTypes/objects/module/calloutType.ts +38 -0
- package/templates/shopify/schemaTypes/objects/module/collectionReferenceType.tsx +47 -0
- package/templates/shopify/schemaTypes/objects/module/gridItemType.ts +41 -0
- package/templates/shopify/schemaTypes/objects/module/gridType.ts +28 -0
- package/templates/shopify/schemaTypes/objects/module/heroType.tsx +40 -0
- package/templates/shopify/schemaTypes/objects/module/imageCallToActionType.tsx +19 -0
- package/templates/shopify/schemaTypes/objects/module/imageFeatureType.ts +80 -0
- package/templates/shopify/schemaTypes/objects/module/imageFeaturesType.tsx +51 -0
- package/templates/shopify/schemaTypes/objects/module/instagramType.ts +35 -0
- package/templates/shopify/schemaTypes/objects/module/productFeaturesType.tsx +50 -0
- package/templates/shopify/schemaTypes/objects/module/productReferenceType.tsx +42 -0
- package/templates/shopify/schemaTypes/objects/seoType.ts +31 -0
- package/templates/shopify/schemaTypes/objects/shopify/collectionRuleType.tsx +37 -0
- package/templates/shopify/schemaTypes/objects/shopify/inventoryType.ts +25 -0
- package/templates/shopify/schemaTypes/objects/shopify/optionType.tsx +31 -0
- package/templates/shopify/schemaTypes/objects/shopify/placeholderStringType.ts +11 -0
- package/templates/shopify/schemaTypes/objects/shopify/priceRangeType.ts +20 -0
- package/templates/shopify/schemaTypes/objects/shopify/productWithVariantType.tsx +142 -0
- package/templates/shopify/schemaTypes/objects/shopify/proxyStringType.ts +12 -0
- package/templates/shopify/schemaTypes/objects/shopify/shopType.ts +15 -0
- package/templates/shopify/schemaTypes/objects/shopify/shopifyCollectionType.ts +84 -0
- package/templates/shopify/schemaTypes/objects/shopify/shopifyProductType.ts +131 -0
- package/templates/shopify/schemaTypes/objects/shopify/shopifyProductVariantType.ts +121 -0
- package/templates/shopify/schemaTypes/portableText/portableTextSimpleType.tsx +45 -0
- package/templates/shopify/schemaTypes/portableText/portableTextType.tsx +52 -0
- package/templates/shopify/schemaTypes/singletons/homeType.ts +49 -0
- package/templates/shopify/schemaTypes/singletons/settingsType.ts +96 -0
- package/templates/shopify/static/.gitkeep +1 -0
- package/templates/shopify/structure/collectionStructure.ts +9 -0
- package/templates/shopify/structure/colorThemeStructure.ts +9 -0
- package/templates/shopify/structure/homeStructure.ts +9 -0
- package/templates/shopify/structure/index.ts +57 -0
- package/templates/shopify/structure/pageStructure.ts +11 -0
- package/templates/shopify/structure/productStructure.ts +51 -0
- package/templates/shopify/structure/settingStructure.ts +9 -0
- package/templates/shopify/utils/blocksToText.ts +20 -0
- package/templates/shopify/utils/defineStructure.ts +11 -0
- package/templates/shopify/utils/getPriceRange.ts +24 -0
- package/templates/shopify/utils/shopifyUrls.ts +22 -0
- package/templates/shopify/utils/validateSlug.ts +18 -0
- package/templates/shopify-online-storefront/README.md +54 -0
- package/templates/shopify-online-storefront/components/icons/Shopify.tsx +22 -0
- package/templates/shopify-online-storefront/components/inputs/CollectionHidden.tsx +23 -0
- package/templates/shopify-online-storefront/components/inputs/PlaceholderString.tsx +25 -0
- package/templates/shopify-online-storefront/components/inputs/ProductHidden.tsx +66 -0
- package/templates/shopify-online-storefront/components/inputs/ProductVariantHidden.tsx +25 -0
- package/templates/shopify-online-storefront/components/inputs/ProxyString.tsx +38 -0
- package/templates/shopify-online-storefront/components/media/ShopifyDocumentStatus.tsx +83 -0
- package/templates/shopify-online-storefront/constants.ts +18 -0
- package/templates/shopify-online-storefront/plugins/shopifyDocumentActions/index.ts +45 -0
- package/templates/shopify-online-storefront/plugins/shopifyDocumentActions/shopifyDelete.tsx +144 -0
- package/templates/shopify-online-storefront/plugins/shopifyDocumentActions/shopifyLink.ts +39 -0
- package/templates/shopify-online-storefront/plugins/shopifyDocumentActions/types.ts +14 -0
- package/templates/shopify-online-storefront/schemaTypes/blocks/blockContent.ts +32 -0
- package/templates/shopify-online-storefront/schemaTypes/documents/collection.tsx +83 -0
- package/templates/shopify-online-storefront/schemaTypes/documents/product.tsx +102 -0
- package/templates/shopify-online-storefront/schemaTypes/documents/productVariant.tsx +82 -0
- package/templates/shopify-online-storefront/schemaTypes/index.ts +43 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/accordion.ts +31 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/accordionGroup.ts +35 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/callout.ts +40 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/inventory.ts +30 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/option.ts +30 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/priceRange.ts +22 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/proxyString.ts +11 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shopifyCollection.ts +109 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shopifyCollectionRule.tsx +45 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shopifyProduct.ts +165 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shopifyProductVariant.ts +151 -0
- package/templates/shopify-online-storefront/structure/collectionStructure.ts +9 -0
- package/templates/shopify-online-storefront/structure/index.ts +37 -0
- package/templates/shopify-online-storefront/structure/productStructure.ts +35 -0
- package/templates/shopify-online-storefront/utils/defineStructure.ts +11 -0
- package/templates/shopify-online-storefront/utils/getPriceRange.ts +24 -0
- package/templates/shopify-online-storefront/utils/shopifyUrls.ts +22 -0
- package/dist/actions/build/__tests__/buildApp.test.js +0 -367
- package/dist/actions/build/__tests__/buildApp.test.js.map +0 -1
- package/dist/actions/build/__tests__/buildStudio.test.js +0 -561
- package/dist/actions/build/__tests__/buildStudio.test.js.map +0 -1
- package/dist/actions/build/__tests__/checkRequiredDependencies.test.js +0 -233
- package/dist/actions/build/__tests__/checkRequiredDependencies.test.js.map +0 -1
- package/dist/actions/build/__tests__/checkStudioDependencyVersions.test.js +0 -414
- package/dist/actions/build/__tests__/checkStudioDependencyVersions.test.js.map +0 -1
- package/dist/actions/build/__tests__/determineBasePath.test.js +0 -24
- package/dist/actions/build/__tests__/determineBasePath.test.js.map +0 -1
- package/dist/actions/build/__tests__/getAutoUpdatesImportMap.test.js +0 -109
- package/dist/actions/build/__tests__/getAutoUpdatesImportMap.test.js.map +0 -1
- package/dist/actions/build/__tests__/getViteConfig.test.js +0 -493
- package/dist/actions/build/__tests__/getViteConfig.test.js.map +0 -1
- package/dist/actions/build/__tests__/renderDocument.test.js +0 -278
- package/dist/actions/build/__tests__/renderDocument.test.js.map +0 -1
- package/dist/actions/build/__tests__/shouldAutoUpdate.test.js +0 -153
- package/dist/actions/build/__tests__/shouldAutoUpdate.test.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/__tests__/renderDocumentWorker.test.js +0 -657
- package/dist/actions/build/renderDocumentWorker/__tests__/renderDocumentWorker.test.js.map +0 -1
- package/dist/actions/dataset/__tests__/validateDatasetName.test.js +0 -182
- package/dist/actions/dataset/__tests__/validateDatasetName.test.js.map +0 -1
- package/dist/actions/deploy/__tests__/checkDir.test.js +0 -120
- package/dist/actions/deploy/__tests__/checkDir.test.js.map +0 -1
- package/dist/actions/docs/__tests__/normalizeDocsPath.test.js +0 -16
- package/dist/actions/docs/__tests__/normalizeDocsPath.test.js.map +0 -1
- package/dist/actions/documents/validation/reporters/prettyReporter/__tests__/formatDocumentValidation.test.js +0 -124
- package/dist/actions/documents/validation/reporters/prettyReporter/__tests__/formatDocumentValidation.test.js.map +0 -1
- package/dist/actions/graphql/__tests__/getGraphQLAPIs.test.js +0 -274
- package/dist/actions/graphql/__tests__/getGraphQLAPIs.test.js.map +0 -1
- package/dist/actions/media/__tests__/importMedia.test.js +0 -182
- package/dist/actions/media/__tests__/importMedia.test.js.map +0 -1
- package/dist/actions/schema/__tests__/formatSchemaValidation.test.js +0 -174
- package/dist/actions/schema/__tests__/formatSchemaValidation.test.js.map +0 -1
- package/dist/actions/schema/__tests__/validateAction.test.js +0 -281
- package/dist/actions/schema/__tests__/validateAction.test.js.map +0 -1
- package/dist/actions/telemetry/__tests__/fetchTelemetryConsent.test.js +0 -27
- package/dist/actions/telemetry/__tests__/fetchTelemetryConsent.test.js.map +0 -1
- package/dist/actions/users/__tests__/validateEmail.test.js +0 -16
- package/dist/actions/users/__tests__/validateEmail.test.js.map +0 -1
- package/dist/commands/__tests__/blueprints.test.js +0 -54
- package/dist/commands/__tests__/blueprints.test.js.map +0 -1
- package/dist/commands/__tests__/build.test.js +0 -132
- package/dist/commands/__tests__/build.test.js.map +0 -1
- package/dist/commands/__tests__/codemod.test.js +0 -271
- package/dist/commands/__tests__/codemod.test.js.map +0 -1
- package/dist/commands/__tests__/debug.test.js +0 -590
- package/dist/commands/__tests__/debug.test.js.map +0 -1
- package/dist/commands/__tests__/deploy.test.js +0 -1945
- package/dist/commands/__tests__/deploy.test.js.map +0 -1
- package/dist/commands/__tests__/dev.test.js +0 -453
- package/dist/commands/__tests__/dev.test.js.map +0 -1
- package/dist/commands/__tests__/exec.test.js +0 -207
- package/dist/commands/__tests__/exec.test.js.map +0 -1
- package/dist/commands/__tests__/init/init.authentication.test.js +0 -73
- package/dist/commands/__tests__/init/init.authentication.test.js.map +0 -1
- package/dist/commands/__tests__/init/init.create-new-project.test.js +0 -195
- package/dist/commands/__tests__/init/init.create-new-project.test.js.map +0 -1
- package/dist/commands/__tests__/init/init.plan.test.js +0 -279
- package/dist/commands/__tests__/init/init.plan.test.js.map +0 -1
- package/dist/commands/__tests__/init/init.setup.test.js +0 -335
- package/dist/commands/__tests__/init/init.setup.test.js.map +0 -1
- package/dist/commands/__tests__/install.test.js +0 -282
- package/dist/commands/__tests__/install.test.js.map +0 -1
- package/dist/commands/__tests__/learn.test.js +0 -29
- package/dist/commands/__tests__/learn.test.js.map +0 -1
- package/dist/commands/__tests__/logout.test.js +0 -91
- package/dist/commands/__tests__/logout.test.js.map +0 -1
- package/dist/commands/__tests__/manage.test.js +0 -110
- package/dist/commands/__tests__/manage.test.js.map +0 -1
- package/dist/commands/__tests__/migration.test.js +0 -119
- package/dist/commands/__tests__/migration.test.js.map +0 -1
- package/dist/commands/__tests__/preview.test.js +0 -261
- package/dist/commands/__tests__/preview.test.js.map +0 -1
- package/dist/commands/__tests__/start.test.js +0 -253
- package/dist/commands/__tests__/start.test.js.map +0 -1
- package/dist/commands/__tests__/undeploy.test.js +0 -382
- package/dist/commands/__tests__/undeploy.test.js.map +0 -1
- package/dist/commands/__tests__/versions.test.js +0 -142
- package/dist/commands/__tests__/versions.test.js.map +0 -1
- package/dist/commands/backup/__tests__/disable.test.js +0 -204
- package/dist/commands/backup/__tests__/disable.test.js.map +0 -1
- package/dist/commands/backup/__tests__/download.test.js +0 -768
- package/dist/commands/backup/__tests__/download.test.js.map +0 -1
- package/dist/commands/backup/__tests__/enable.test.js +0 -286
- package/dist/commands/backup/__tests__/enable.test.js.map +0 -1
- package/dist/commands/backup/__tests__/list.test.js +0 -330
- package/dist/commands/backup/__tests__/list.test.js.map +0 -1
- package/dist/commands/cors/__tests__/add.test.js +0 -376
- package/dist/commands/cors/__tests__/add.test.js.map +0 -1
- package/dist/commands/cors/__tests__/delete.test.js +0 -308
- package/dist/commands/cors/__tests__/delete.test.js.map +0 -1
- package/dist/commands/cors/__tests__/list.test.js +0 -241
- package/dist/commands/cors/__tests__/list.test.js.map +0 -1
- package/dist/commands/dataset/__tests__/copy.test.js +0 -628
- package/dist/commands/dataset/__tests__/copy.test.js.map +0 -1
- package/dist/commands/dataset/__tests__/create.test.js +0 -342
- package/dist/commands/dataset/__tests__/create.test.js.map +0 -1
- package/dist/commands/dataset/__tests__/delete.test.js +0 -231
- package/dist/commands/dataset/__tests__/delete.test.js.map +0 -1
- package/dist/commands/dataset/__tests__/export.test.js +0 -601
- package/dist/commands/dataset/__tests__/export.test.js.map +0 -1
- package/dist/commands/dataset/__tests__/import.test.js +0 -53
- package/dist/commands/dataset/__tests__/import.test.js.map +0 -1
- package/dist/commands/dataset/__tests__/list.test.js +0 -216
- package/dist/commands/dataset/__tests__/list.test.js.map +0 -1
- package/dist/commands/dataset/alias/__tests__/create.test.js +0 -339
- package/dist/commands/dataset/alias/__tests__/create.test.js.map +0 -1
- package/dist/commands/dataset/alias/__tests__/delete.test.js +0 -247
- package/dist/commands/dataset/alias/__tests__/delete.test.js.map +0 -1
- package/dist/commands/dataset/alias/__tests__/link.test.js +0 -376
- package/dist/commands/dataset/alias/__tests__/link.test.js.map +0 -1
- package/dist/commands/dataset/alias/__tests__/unlink.test.js +0 -313
- package/dist/commands/dataset/alias/__tests__/unlink.test.js.map +0 -1
- package/dist/commands/dataset/visibility/__tests__/get.test.js +0 -128
- package/dist/commands/dataset/visibility/__tests__/get.test.js.map +0 -1
- package/dist/commands/dataset/visibility/__tests__/set.test.js +0 -198
- package/dist/commands/dataset/visibility/__tests__/set.test.js.map +0 -1
- package/dist/commands/docs/__tests__/browse.test.js +0 -29
- package/dist/commands/docs/__tests__/browse.test.js.map +0 -1
- package/dist/commands/docs/__tests__/read.test.js +0 -78
- package/dist/commands/docs/__tests__/read.test.js.map +0 -1
- package/dist/commands/docs/__tests__/search.test.js +0 -255
- package/dist/commands/docs/__tests__/search.test.js.map +0 -1
- package/dist/commands/documents/__tests__/create.test.js +0 -1030
- package/dist/commands/documents/__tests__/create.test.js.map +0 -1
- package/dist/commands/documents/__tests__/delete.test.js +0 -300
- package/dist/commands/documents/__tests__/delete.test.js.map +0 -1
- package/dist/commands/documents/__tests__/get.test.js +0 -182
- package/dist/commands/documents/__tests__/get.test.js.map +0 -1
- package/dist/commands/documents/__tests__/query.test.js +0 -300
- package/dist/commands/documents/__tests__/query.test.js.map +0 -1
- package/dist/commands/documents/__tests__/validate.test.js +0 -249
- package/dist/commands/documents/__tests__/validate.test.js.map +0 -1
- package/dist/commands/graphql/__tests__/list.test.js +0 -240
- package/dist/commands/graphql/__tests__/list.test.js.map +0 -1
- package/dist/commands/graphql/__tests__/undeploy.test.js +0 -410
- package/dist/commands/graphql/__tests__/undeploy.test.js.map +0 -1
- package/dist/commands/hook/__tests__/attempt.test.js +0 -275
- package/dist/commands/hook/__tests__/attempt.test.js.map +0 -1
- package/dist/commands/hook/__tests__/create.test.js +0 -119
- package/dist/commands/hook/__tests__/create.test.js.map +0 -1
- package/dist/commands/hook/__tests__/delete.test.js +0 -233
- package/dist/commands/hook/__tests__/delete.test.js.map +0 -1
- package/dist/commands/hook/__tests__/list.test.js +0 -145
- package/dist/commands/hook/__tests__/list.test.js.map +0 -1
- package/dist/commands/hook/__tests__/logs.test.js +0 -798
- package/dist/commands/hook/__tests__/logs.test.js.map +0 -1
- package/dist/commands/manifest/__tests__/extract.test.js +0 -132
- package/dist/commands/manifest/__tests__/extract.test.js.map +0 -1
- package/dist/commands/mcp/__tests__/configure.test.js +0 -397
- package/dist/commands/mcp/__tests__/configure.test.js.map +0 -1
- package/dist/commands/media/__tests__/create-aspect.test.js +0 -173
- package/dist/commands/media/__tests__/create-aspect.test.js.map +0 -1
- package/dist/commands/media/__tests__/delete-aspect.test.js +0 -342
- package/dist/commands/media/__tests__/delete-aspect.test.js.map +0 -1
- package/dist/commands/media/__tests__/deploy-aspect.test.js +0 -619
- package/dist/commands/media/__tests__/deploy-aspect.test.js.map +0 -1
- package/dist/commands/media/__tests__/export.test.js +0 -697
- package/dist/commands/media/__tests__/export.test.js.map +0 -1
- package/dist/commands/media/__tests__/import.test.js +0 -347
- package/dist/commands/media/__tests__/import.test.js.map +0 -1
- package/dist/commands/openapi/__tests__/get.test.js +0 -149
- package/dist/commands/openapi/__tests__/get.test.js.map +0 -1
- package/dist/commands/openapi/__tests__/list.test.js +0 -113
- package/dist/commands/openapi/__tests__/list.test.js.map +0 -1
- package/dist/commands/projects/__tests__/list.test.js +0 -154
- package/dist/commands/projects/__tests__/list.test.js.map +0 -1
- package/dist/commands/schema/__tests__/delete.test.js +0 -454
- package/dist/commands/schema/__tests__/delete.test.js.map +0 -1
- package/dist/commands/schema/__tests__/deploy.test.js +0 -348
- package/dist/commands/schema/__tests__/deploy.test.js.map +0 -1
- package/dist/commands/schema/__tests__/extract.test.js +0 -121
- package/dist/commands/schema/__tests__/extract.test.js.map +0 -1
- package/dist/commands/schema/__tests__/list.test.js +0 -399
- package/dist/commands/schema/__tests__/list.test.js.map +0 -1
- package/dist/commands/schema/__tests__/validate.test.js +0 -121
- package/dist/commands/schema/__tests__/validate.test.js.map +0 -1
- package/dist/commands/telemetry/__tests__/disable.test.js +0 -147
- package/dist/commands/telemetry/__tests__/disable.test.js.map +0 -1
- package/dist/commands/telemetry/__tests__/enable.test.js +0 -133
- package/dist/commands/telemetry/__tests__/enable.test.js.map +0 -1
- package/dist/commands/telemetry/__tests__/status.test.js +0 -155
- package/dist/commands/telemetry/__tests__/status.test.js.map +0 -1
- package/dist/commands/tokens/__tests__/add.test.js +0 -435
- package/dist/commands/tokens/__tests__/add.test.js.map +0 -1
- package/dist/commands/tokens/__tests__/delete.test.js +0 -405
- package/dist/commands/tokens/__tests__/delete.test.js.map +0 -1
- package/dist/commands/tokens/__tests__/list.test.js +0 -395
- package/dist/commands/tokens/__tests__/list.test.js.map +0 -1
- package/dist/commands/users/__tests__/invite.test.js +0 -362
- package/dist/commands/users/__tests__/invite.test.js.map +0 -1
- package/dist/commands/users/__tests__/list.test.js +0 -407
- package/dist/commands/users/__tests__/list.test.js.map +0 -1
- package/dist/hooks/prerun/__tests__/setupTelemetry.test.js +0 -77
- package/dist/hooks/prerun/__tests__/setupTelemetry.test.js.map +0 -1
- package/dist/services/__tests__/datasetAliases.test.js +0 -131
- package/dist/services/__tests__/datasetAliases.test.js.map +0 -1
- package/dist/services/__tests__/datasets.test.js +0 -436
- package/dist/services/__tests__/datasets.test.js.map +0 -1
- package/dist/services/__tests__/graphql.test.js +0 -43
- package/dist/services/__tests__/graphql.test.js.map +0 -1
- package/dist/services/__tests__/mediaLibraries.test.js +0 -88
- package/dist/services/__tests__/mediaLibraries.test.js.map +0 -1
- package/dist/services/__tests__/projects.test.js +0 -41
- package/dist/services/__tests__/projects.test.js.map +0 -1
- package/dist/services/__tests__/userApplications.test.js +0 -113
- package/dist/services/__tests__/userApplications.test.js.map +0 -1
- package/dist/util/__tests__/appId.test.js +0 -31
- package/dist/util/__tests__/appId.test.js.map +0 -1
- package/dist/util/__tests__/cliClient.test.js +0 -184
- package/dist/util/__tests__/cliClient.test.js.map +0 -1
- package/dist/util/__tests__/compareDependencyVersions.test.js +0 -426
- package/dist/util/__tests__/compareDependencyVersions.test.js.map +0 -1
- package/dist/util/__tests__/extractDocumentsFromNdjsonOrTarball.test.js +0 -74
- package/dist/util/__tests__/extractDocumentsFromNdjsonOrTarball.test.js.map +0 -1
- package/dist/util/__tests__/findNdjsonEntry.test.js +0 -54
- package/dist/util/__tests__/findNdjsonEntry.test.js.map +0 -1
- package/dist/util/__tests__/getCliVersion.test.js +0 -28
- package/dist/util/__tests__/getCliVersion.test.js.map +0 -1
- package/dist/util/__tests__/getLocalPackageVersion.test.js +0 -84
- package/dist/util/__tests__/getLocalPackageVersion.test.js.map +0 -1
- package/dist/util/__tests__/getWorkspace.test.js +0 -37
- package/dist/util/__tests__/getWorkspace.test.js.map +0 -1
- package/dist/util/__tests__/readPackageJson.test.js +0 -69
- package/dist/util/__tests__/readPackageJson.test.js.map +0 -1
- package/dist/util/__tests__/warnAboutMissingAppId.test.js +0 -28
- package/dist/util/__tests__/warnAboutMissingAppId.test.js.map +0 -1
- package/dist/util/packageManager/__tests__/installPackages.test.js +0 -388
- package/dist/util/packageManager/__tests__/installPackages.test.js.map +0 -1
- package/dist/util/validation/ __tests__/validateDocuments.test.js +0 -274
- package/dist/util/validation/ __tests__/validateDocuments.test.js.map +0 -1
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { runCommand } from '@oclif/test';
|
|
2
|
-
import { mockApi, testCommand } from '@sanity/cli-test';
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
|
|
4
|
-
import { extractManifestSafe } from '../../../actions/manifest/extractManifest.js';
|
|
5
|
-
import { createManifestReader } from '../../../actions/schema/utils/manifestReader.js';
|
|
6
|
-
import { SCHEMA_API_VERSION } from '../../../services/schemas.js';
|
|
7
|
-
import { NO_DATASET_ID, NO_PROJECT_ID } from '../../../util/errorMessages.js';
|
|
8
|
-
import { ListSchemaCommand } from '../list.js';
|
|
9
|
-
const mockManifest = {
|
|
10
|
-
createdAt: '2024-01-01T00:00:00.000Z',
|
|
11
|
-
studioVersion: '3.0.0',
|
|
12
|
-
version: 3,
|
|
13
|
-
workspaces: [
|
|
14
|
-
{
|
|
15
|
-
basePath: '/',
|
|
16
|
-
dataset: 'production',
|
|
17
|
-
icon: null,
|
|
18
|
-
name: 'default',
|
|
19
|
-
projectId: 'test-project',
|
|
20
|
-
schema: 'default.create-schema.json',
|
|
21
|
-
tools: 'default.create-tools.json'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
basePath: '/staging',
|
|
25
|
-
dataset: 'staging',
|
|
26
|
-
icon: null,
|
|
27
|
-
name: 'staging',
|
|
28
|
-
projectId: 'test-project',
|
|
29
|
-
schema: 'staging.create-schema.json',
|
|
30
|
-
tools: 'staging.create-tools.json'
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
};
|
|
34
|
-
vi.mock('../../../actions/manifest/extractManifest.js');
|
|
35
|
-
vi.mock('../../../actions/schema/utils/manifestReader.js');
|
|
36
|
-
const mockExtractManifestSafe = vi.mocked(extractManifestSafe);
|
|
37
|
-
const mockedCreateManifestReader = vi.mocked(createManifestReader);
|
|
38
|
-
const testProjectId = 'test-project';
|
|
39
|
-
const defaultMocks = {
|
|
40
|
-
cliConfig: {
|
|
41
|
-
api: {
|
|
42
|
-
dataset: 'production',
|
|
43
|
-
projectId: testProjectId
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
projectRoot: {
|
|
47
|
-
directory: '/test/path',
|
|
48
|
-
path: '/test/path/sanity.config.ts',
|
|
49
|
-
type: 'studio'
|
|
50
|
-
},
|
|
51
|
-
token: 'test-token'
|
|
52
|
-
};
|
|
53
|
-
describe('#schema:list', ()=>{
|
|
54
|
-
beforeEach(()=>{
|
|
55
|
-
vi.clearAllMocks();
|
|
56
|
-
mockedCreateManifestReader.mockReturnValue({
|
|
57
|
-
getManifest: vi.fn().mockResolvedValue(mockManifest),
|
|
58
|
-
getWorkspaceSchema: vi.fn()
|
|
59
|
-
});
|
|
60
|
-
mockExtractManifestSafe.mockResolvedValue(undefined);
|
|
61
|
-
});
|
|
62
|
-
afterEach(()=>{
|
|
63
|
-
vi.clearAllMocks();
|
|
64
|
-
});
|
|
65
|
-
test('should show --help text', async ()=>{
|
|
66
|
-
const { stdout } = await runCommand('schema list --help');
|
|
67
|
-
expect(stdout).toMatchInlineSnapshot(`
|
|
68
|
-
"Lists all schemas in the current dataset.
|
|
69
|
-
|
|
70
|
-
USAGE
|
|
71
|
-
$ sanity schema list [--extract-manifest] [--id <schema_id>] [--json]
|
|
72
|
-
[--manifest-dir <directory>]
|
|
73
|
-
|
|
74
|
-
FLAGS
|
|
75
|
-
--[no-]extract-manifest Disables manifest generation - the command will
|
|
76
|
-
fail if no manifest exists
|
|
77
|
-
--id=<schema_id> Fetch a single schema by id
|
|
78
|
-
--json Get schema as json
|
|
79
|
-
--manifest-dir=<directory> [default: ./dist/static] Directory containing
|
|
80
|
-
manifest file
|
|
81
|
-
|
|
82
|
-
DESCRIPTION
|
|
83
|
-
Lists all schemas in the current dataset.
|
|
84
|
-
|
|
85
|
-
**Note**: This command is experimental and subject to change.
|
|
86
|
-
|
|
87
|
-
This operation (re-)generates a manifest file describing the sanity config
|
|
88
|
-
workspace by default.
|
|
89
|
-
To re-use an existing manifest file, use --no-extract-manifest.
|
|
90
|
-
|
|
91
|
-
EXAMPLES
|
|
92
|
-
List all schemas found in any workspace dataset in a table
|
|
93
|
-
|
|
94
|
-
$ sanity schema list
|
|
95
|
-
|
|
96
|
-
Get a schema for a given id
|
|
97
|
-
|
|
98
|
-
$ sanity schema list --id _.schemas.workspaceName
|
|
99
|
-
|
|
100
|
-
Get stored schemas as pretty-printed json-array
|
|
101
|
-
|
|
102
|
-
$ sanity schema list --json
|
|
103
|
-
|
|
104
|
-
Get singular stored schema as pretty-printed json-object
|
|
105
|
-
|
|
106
|
-
$ sanity schema list --json --id _.schemas.workspaceName
|
|
107
|
-
|
|
108
|
-
Runs using a pre-existing manifest file. Config changes in sanity.config
|
|
109
|
-
will not be picked up in this case.
|
|
110
|
-
|
|
111
|
-
$ sanity schema list --no-extract-manifest
|
|
112
|
-
|
|
113
|
-
"
|
|
114
|
-
`);
|
|
115
|
-
});
|
|
116
|
-
test('should list schemas', async ()=>{
|
|
117
|
-
mockApi({
|
|
118
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
119
|
-
uri: `/projects/${testProjectId}/datasets/production/schemas`
|
|
120
|
-
}).reply(200, {
|
|
121
|
-
_createdAt: '2025-01-21T18:49:44Z',
|
|
122
|
-
_id: '_.schemas.default',
|
|
123
|
-
workspace: mockManifest.workspaces[0]
|
|
124
|
-
});
|
|
125
|
-
mockApi({
|
|
126
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
127
|
-
uri: `/projects/${testProjectId}/datasets/staging/schemas`
|
|
128
|
-
}).reply(200, {
|
|
129
|
-
_createdAt: '2025-05-28T18:49:44Z',
|
|
130
|
-
_id: '_.schemas.staging',
|
|
131
|
-
workspace: mockManifest.workspaces[1]
|
|
132
|
-
});
|
|
133
|
-
const { stdout } = await testCommand(ListSchemaCommand, [], {
|
|
134
|
-
mocks: defaultMocks
|
|
135
|
-
});
|
|
136
|
-
expect(stdout).toContain('Id Workspace Dataset ProjectId CreatedAt ');
|
|
137
|
-
expect(stdout).toContain('_.schemas.staging staging staging test-project 2025-05-28T18:49:44Z');
|
|
138
|
-
expect(stdout).toContain('_.schemas.default default production test-project 2025-01-21T18:49:44Z');
|
|
139
|
-
});
|
|
140
|
-
test('should list a specific schema based on id flag', async ()=>{
|
|
141
|
-
mockApi({
|
|
142
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
143
|
-
uri: '/projects/test-project/datasets/production/schemas/_.schemas.staging'
|
|
144
|
-
}).reply(200, []);
|
|
145
|
-
mockApi({
|
|
146
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
147
|
-
uri: '/projects/test-project/datasets/staging/schemas/_.schemas.staging'
|
|
148
|
-
}).reply(200, {
|
|
149
|
-
_createdAt: '2025-05-28T18:49:44Z',
|
|
150
|
-
_id: '_.schemas.staging',
|
|
151
|
-
workspace: mockManifest.workspaces[1]
|
|
152
|
-
});
|
|
153
|
-
const { stdout } = await testCommand(ListSchemaCommand, [
|
|
154
|
-
'--id',
|
|
155
|
-
'_.schemas.staging'
|
|
156
|
-
], {
|
|
157
|
-
mocks: defaultMocks
|
|
158
|
-
});
|
|
159
|
-
expect(stdout).toContain('Id Workspace Dataset ProjectId CreatedAt ');
|
|
160
|
-
expect(stdout).toContain('_.schemas.staging staging staging test-project 2025-05-28T18:49:44Z');
|
|
161
|
-
});
|
|
162
|
-
test('should list schemas in json', async ()=>{
|
|
163
|
-
mockApi({
|
|
164
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
165
|
-
uri: '/projects/test-project/datasets/production/schemas'
|
|
166
|
-
}).reply(200, {
|
|
167
|
-
_createdAt: '2025-01-21T18:49:44Z',
|
|
168
|
-
_id: '_.schemas.default',
|
|
169
|
-
workspace: mockManifest.workspaces[0]
|
|
170
|
-
});
|
|
171
|
-
mockApi({
|
|
172
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
173
|
-
uri: '/projects/test-project/datasets/staging/schemas'
|
|
174
|
-
}).reply(200, {
|
|
175
|
-
_createdAt: '2025-05-28T18:49:44Z',
|
|
176
|
-
_id: '_.schemas.staging',
|
|
177
|
-
workspace: mockManifest.workspaces[1]
|
|
178
|
-
});
|
|
179
|
-
const { stdout } = await testCommand(ListSchemaCommand, [
|
|
180
|
-
'--json'
|
|
181
|
-
], {
|
|
182
|
-
mocks: defaultMocks
|
|
183
|
-
});
|
|
184
|
-
// eslint-disable-next-line no-useless-escape
|
|
185
|
-
expect(stdout).toContain(`\"_id\": \"_.schemas.default\"`);
|
|
186
|
-
});
|
|
187
|
-
test('should list a specific schema based on id flag in json', async ()=>{
|
|
188
|
-
mockApi({
|
|
189
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
190
|
-
uri: '/projects/test-project/datasets/production/schemas/_.schemas.staging'
|
|
191
|
-
}).reply(200, []);
|
|
192
|
-
mockApi({
|
|
193
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
194
|
-
uri: '/projects/test-project/datasets/staging/schemas/_.schemas.staging'
|
|
195
|
-
}).reply(200, {
|
|
196
|
-
_createdAt: '2025-05-28T18:49:44Z',
|
|
197
|
-
_id: '_.schemas.staging',
|
|
198
|
-
workspace: mockManifest.workspaces[1]
|
|
199
|
-
});
|
|
200
|
-
const { stdout } = await testCommand(ListSchemaCommand, [
|
|
201
|
-
'--id',
|
|
202
|
-
'_.schemas.staging',
|
|
203
|
-
'--json'
|
|
204
|
-
], {
|
|
205
|
-
mocks: defaultMocks
|
|
206
|
-
});
|
|
207
|
-
// eslint-disable-next-line no-useless-escape
|
|
208
|
-
expect(stdout).toContain(`\"_id\": \"_.schemas.staging\"`);
|
|
209
|
-
});
|
|
210
|
-
test.each([
|
|
211
|
-
{
|
|
212
|
-
desc: 'no project ID is found',
|
|
213
|
-
projectId: undefined
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
desc: 'project ID is empty string',
|
|
217
|
-
projectId: ''
|
|
218
|
-
}
|
|
219
|
-
])('throws an error if $desc', async ({ projectId })=>{
|
|
220
|
-
const { error } = await testCommand(ListSchemaCommand, [], {
|
|
221
|
-
mocks: {
|
|
222
|
-
...defaultMocks,
|
|
223
|
-
cliConfig: {
|
|
224
|
-
api: {
|
|
225
|
-
dataset: 'production',
|
|
226
|
-
projectId
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
expect(error?.message).toContain(NO_PROJECT_ID);
|
|
232
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
233
|
-
});
|
|
234
|
-
test.each([
|
|
235
|
-
{
|
|
236
|
-
dataset: undefined,
|
|
237
|
-
desc: 'no dataset is found'
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
dataset: '',
|
|
241
|
-
desc: 'dataset is empty string'
|
|
242
|
-
}
|
|
243
|
-
])('throws an error if $desc', async ({ dataset })=>{
|
|
244
|
-
const { error } = await testCommand(ListSchemaCommand, [], {
|
|
245
|
-
mocks: {
|
|
246
|
-
...defaultMocks,
|
|
247
|
-
cliConfig: {
|
|
248
|
-
api: {
|
|
249
|
-
dataset,
|
|
250
|
-
projectId: 'test-project'
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
expect(error?.message).toContain(NO_DATASET_ID);
|
|
256
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
257
|
-
});
|
|
258
|
-
test.each([
|
|
259
|
-
{
|
|
260
|
-
desc: 'empty string',
|
|
261
|
-
expectedError: 'id argument is empty',
|
|
262
|
-
id: ''
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
desc: 'invalid characters (!)',
|
|
266
|
-
expectedError: 'id can only contain characters in [a-zA-Z0-9._-]',
|
|
267
|
-
id: 'test-id!!'
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
desc: 'invalid characters (@)',
|
|
271
|
-
expectedError: 'id can only contain characters in [a-zA-Z0-9._-]',
|
|
272
|
-
id: '_.schemas.default@tag'
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
desc: 'starts with dash',
|
|
276
|
-
expectedError: 'id cannot start with - (dash)',
|
|
277
|
-
id: '-_.schemas.default'
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
desc: 'consecutive periods',
|
|
281
|
-
expectedError: 'id cannot have consecutive . (period) characters',
|
|
282
|
-
id: '_.schemas..default'
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
desc: 'missing required prefix',
|
|
286
|
-
expectedError: 'id must either match _.schemas.<workspaceName>',
|
|
287
|
-
id: 'schemas.default'
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
desc: 'incorrect prefix',
|
|
291
|
-
expectedError: 'id must either match _.schemas.<workspaceName>',
|
|
292
|
-
id: 'sanity.schemas.default'
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
desc: 'workspace name with invalid characters (space)',
|
|
296
|
-
expectedError: 'id can only contain characters in [a-zA-Z0-9._-]',
|
|
297
|
-
id: '_.schemas.my workspace'
|
|
298
|
-
}
|
|
299
|
-
])('throws error when id is $desc', async ({ expectedError, id })=>{
|
|
300
|
-
const { error } = await testCommand(ListSchemaCommand, [
|
|
301
|
-
'--id',
|
|
302
|
-
id
|
|
303
|
-
], {
|
|
304
|
-
mocks: defaultMocks
|
|
305
|
-
});
|
|
306
|
-
expect(error?.message).toContain(expectedError);
|
|
307
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
308
|
-
});
|
|
309
|
-
test('throws an error if no schemas are found', async ()=>{
|
|
310
|
-
mockApi({
|
|
311
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
312
|
-
uri: '/projects/test-project/datasets/production/schemas'
|
|
313
|
-
}).reply(200, []);
|
|
314
|
-
mockApi({
|
|
315
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
316
|
-
uri: '/projects/test-project/datasets/staging/schemas'
|
|
317
|
-
}).reply(200, []);
|
|
318
|
-
const { error } = await testCommand(ListSchemaCommand, [], {
|
|
319
|
-
mocks: defaultMocks
|
|
320
|
-
});
|
|
321
|
-
expect(error?.message).toContain('No schemas found in datasets ["production","staging"]');
|
|
322
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
323
|
-
});
|
|
324
|
-
test('throws an error if a specific schema based on id flag is not found', async ()=>{
|
|
325
|
-
mockApi({
|
|
326
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
327
|
-
uri: '/projects/test-project/datasets/production/schemas/_.schemas.staging'
|
|
328
|
-
}).reply(200, []);
|
|
329
|
-
mockApi({
|
|
330
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
331
|
-
uri: '/projects/test-project/datasets/staging/schemas/_.schemas.staging'
|
|
332
|
-
}).reply(200, []);
|
|
333
|
-
const { error } = await testCommand(ListSchemaCommand, [
|
|
334
|
-
'--id',
|
|
335
|
-
'_.schemas.staging'
|
|
336
|
-
], {
|
|
337
|
-
mocks: defaultMocks
|
|
338
|
-
});
|
|
339
|
-
expect(error?.message).toContain('Schema for id "_.schemas.staging" not found in datasets ["production","staging"]');
|
|
340
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
341
|
-
});
|
|
342
|
-
test('throws an error if schema request fails', async ()=>{
|
|
343
|
-
mockApi({
|
|
344
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
345
|
-
uri: '/projects/test-project/datasets/production/schemas'
|
|
346
|
-
}).reply(400, {
|
|
347
|
-
error: 'Bad request'
|
|
348
|
-
});
|
|
349
|
-
mockApi({
|
|
350
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
351
|
-
uri: '/projects/test-project/datasets/staging/schemas'
|
|
352
|
-
}).reply(200, []);
|
|
353
|
-
const { error } = await testCommand(ListSchemaCommand, [], {
|
|
354
|
-
mocks: defaultMocks
|
|
355
|
-
});
|
|
356
|
-
expect(error?.message).toContain('↳ Failed to fetch schema from "production":\n Bad request');
|
|
357
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
358
|
-
});
|
|
359
|
-
test('throws an error if schema request fails due to permissions', async ()=>{
|
|
360
|
-
mockApi({
|
|
361
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
362
|
-
uri: '/projects/test-project/datasets/production/schemas'
|
|
363
|
-
}).reply(401);
|
|
364
|
-
mockApi({
|
|
365
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
366
|
-
uri: '/projects/test-project/datasets/staging/schemas'
|
|
367
|
-
}).reply(200, []);
|
|
368
|
-
const { stderr } = await testCommand(ListSchemaCommand, [], {
|
|
369
|
-
mocks: defaultMocks
|
|
370
|
-
});
|
|
371
|
-
expect(stderr).toContain('↳ No permissions to read schema from "production".');
|
|
372
|
-
});
|
|
373
|
-
test('skips manifest extraction with no-extract-manifest flag', async ()=>{
|
|
374
|
-
mockApi({
|
|
375
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
376
|
-
uri: '/projects/test-project/datasets/production/schemas'
|
|
377
|
-
}).reply(200, {
|
|
378
|
-
_createdAt: '2025-01-21T18:49:44Z',
|
|
379
|
-
_id: '_.schemas.default',
|
|
380
|
-
workspace: mockManifest.workspaces[0]
|
|
381
|
-
});
|
|
382
|
-
mockApi({
|
|
383
|
-
apiVersion: SCHEMA_API_VERSION,
|
|
384
|
-
uri: '/projects/test-project/datasets/staging/schemas'
|
|
385
|
-
}).reply(200, {
|
|
386
|
-
_createdAt: '2025-05-28T18:49:44Z',
|
|
387
|
-
_id: '_.schemas.staging',
|
|
388
|
-
workspace: mockManifest.workspaces[1]
|
|
389
|
-
});
|
|
390
|
-
await testCommand(ListSchemaCommand, [
|
|
391
|
-
'--no-extract-manifest'
|
|
392
|
-
], {
|
|
393
|
-
mocks: defaultMocks
|
|
394
|
-
});
|
|
395
|
-
expect(mockExtractManifestSafe).not.toHaveBeenCalled();
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
//# sourceMappingURL=list.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/schema/__tests__/list.test.ts"],"sourcesContent":["import {runCommand} from '@oclif/test'\nimport {mockApi, testCommand} from '@sanity/cli-test'\nimport {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'\n\nimport {extractManifestSafe} from '../../../actions/manifest/extractManifest.js'\nimport {createManifestReader} from '../../../actions/schema/utils/manifestReader.js'\nimport {SCHEMA_API_VERSION} from '../../../services/schemas.js'\nimport {NO_DATASET_ID, NO_PROJECT_ID} from '../../../util/errorMessages.js'\nimport {ListSchemaCommand} from '../list.js'\n\nconst mockManifest = {\n createdAt: '2024-01-01T00:00:00.000Z',\n studioVersion: '3.0.0',\n version: 3,\n workspaces: [\n {\n basePath: '/',\n dataset: 'production',\n icon: null,\n name: 'default',\n projectId: 'test-project',\n schema: 'default.create-schema.json',\n tools: 'default.create-tools.json',\n },\n {\n basePath: '/staging',\n dataset: 'staging',\n icon: null,\n name: 'staging',\n projectId: 'test-project',\n schema: 'staging.create-schema.json',\n tools: 'staging.create-tools.json',\n },\n ],\n}\n\nvi.mock('../../../actions/manifest/extractManifest.js')\nvi.mock('../../../actions/schema/utils/manifestReader.js')\n\nconst mockExtractManifestSafe = vi.mocked(extractManifestSafe)\nconst mockedCreateManifestReader = vi.mocked(createManifestReader)\n\nconst testProjectId = 'test-project'\n\nconst defaultMocks = {\n cliConfig: {api: {dataset: 'production', projectId: testProjectId}},\n projectRoot: {\n directory: '/test/path',\n path: '/test/path/sanity.config.ts',\n type: 'studio' as const,\n },\n token: 'test-token',\n}\n\ndescribe('#schema:list', () => {\n beforeEach(() => {\n vi.clearAllMocks()\n\n mockedCreateManifestReader.mockReturnValue({\n getManifest: vi.fn().mockResolvedValue(mockManifest),\n getWorkspaceSchema: vi.fn(),\n })\n\n mockExtractManifestSafe.mockResolvedValue(undefined)\n })\n\n afterEach(() => {\n vi.clearAllMocks()\n })\n\n test('should show --help text', async () => {\n const {stdout} = await runCommand('schema list --help')\n\n expect(stdout).toMatchInlineSnapshot(`\n \"Lists all schemas in the current dataset.\n\n USAGE\n $ sanity schema list [--extract-manifest] [--id <schema_id>] [--json]\n [--manifest-dir <directory>]\n\n FLAGS\n --[no-]extract-manifest Disables manifest generation - the command will\n fail if no manifest exists\n --id=<schema_id> Fetch a single schema by id\n --json Get schema as json\n --manifest-dir=<directory> [default: ./dist/static] Directory containing\n manifest file\n\n DESCRIPTION\n Lists all schemas in the current dataset.\n\n **Note**: This command is experimental and subject to change.\n\n This operation (re-)generates a manifest file describing the sanity config\n workspace by default.\n To re-use an existing manifest file, use --no-extract-manifest.\n\n EXAMPLES\n List all schemas found in any workspace dataset in a table\n\n $ sanity schema list\n\n Get a schema for a given id\n\n $ sanity schema list --id _.schemas.workspaceName\n\n Get stored schemas as pretty-printed json-array\n\n $ sanity schema list --json\n\n Get singular stored schema as pretty-printed json-object\n\n $ sanity schema list --json --id _.schemas.workspaceName\n\n Runs using a pre-existing manifest file. Config changes in sanity.config\n will not be picked up in this case.\n\n $ sanity schema list --no-extract-manifest\n\n \"\n `)\n })\n\n test('should list schemas', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: `/projects/${testProjectId}/datasets/production/schemas`,\n }).reply(200, {\n _createdAt: '2025-01-21T18:49:44Z',\n _id: '_.schemas.default',\n workspace: mockManifest.workspaces[0],\n })\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: `/projects/${testProjectId}/datasets/staging/schemas`,\n }).reply(200, {\n _createdAt: '2025-05-28T18:49:44Z',\n _id: '_.schemas.staging',\n workspace: mockManifest.workspaces[1],\n })\n\n const {stdout} = await testCommand(ListSchemaCommand, [], {mocks: defaultMocks})\n\n expect(stdout).toContain(\n 'Id Workspace Dataset ProjectId CreatedAt ',\n )\n expect(stdout).toContain(\n '_.schemas.staging staging staging test-project 2025-05-28T18:49:44Z',\n )\n expect(stdout).toContain(\n '_.schemas.default default production test-project 2025-01-21T18:49:44Z',\n )\n })\n\n test('should list a specific schema based on id flag', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas/_.schemas.staging',\n }).reply(200, [])\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas/_.schemas.staging',\n }).reply(200, {\n _createdAt: '2025-05-28T18:49:44Z',\n _id: '_.schemas.staging',\n workspace: mockManifest.workspaces[1],\n })\n\n const {stdout} = await testCommand(ListSchemaCommand, ['--id', '_.schemas.staging'], {\n mocks: defaultMocks,\n })\n\n expect(stdout).toContain(\n 'Id Workspace Dataset ProjectId CreatedAt ',\n )\n expect(stdout).toContain(\n '_.schemas.staging staging staging test-project 2025-05-28T18:49:44Z',\n )\n })\n\n test('should list schemas in json', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas',\n }).reply(200, {\n _createdAt: '2025-01-21T18:49:44Z',\n _id: '_.schemas.default',\n workspace: mockManifest.workspaces[0],\n })\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas',\n }).reply(200, {\n _createdAt: '2025-05-28T18:49:44Z',\n _id: '_.schemas.staging',\n workspace: mockManifest.workspaces[1],\n })\n\n const {stdout} = await testCommand(ListSchemaCommand, ['--json'], {mocks: defaultMocks})\n\n // eslint-disable-next-line no-useless-escape\n expect(stdout).toContain(`\\\"_id\\\": \\\"_.schemas.default\\\"`)\n })\n\n test('should list a specific schema based on id flag in json', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas/_.schemas.staging',\n }).reply(200, [])\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas/_.schemas.staging',\n }).reply(200, {\n _createdAt: '2025-05-28T18:49:44Z',\n _id: '_.schemas.staging',\n workspace: mockManifest.workspaces[1],\n })\n\n const {stdout} = await testCommand(ListSchemaCommand, ['--id', '_.schemas.staging', '--json'], {\n mocks: defaultMocks,\n })\n\n // eslint-disable-next-line no-useless-escape\n expect(stdout).toContain(`\\\"_id\\\": \\\"_.schemas.staging\\\"`)\n })\n\n test.each([\n {desc: 'no project ID is found', projectId: undefined},\n {desc: 'project ID is empty string', projectId: ''},\n ])('throws an error if $desc', async ({projectId}) => {\n const {error} = await testCommand(ListSchemaCommand, [], {\n mocks: {\n ...defaultMocks,\n cliConfig: {api: {dataset: 'production', projectId}},\n },\n })\n\n expect(error?.message).toContain(NO_PROJECT_ID)\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test.each([\n {dataset: undefined, desc: 'no dataset is found'},\n {dataset: '', desc: 'dataset is empty string'},\n ])('throws an error if $desc', async ({dataset}) => {\n const {error} = await testCommand(ListSchemaCommand, [], {\n mocks: {\n ...defaultMocks,\n cliConfig: {api: {dataset, projectId: 'test-project'}},\n },\n })\n\n expect(error?.message).toContain(NO_DATASET_ID)\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test.each([\n {\n desc: 'empty string',\n expectedError: 'id argument is empty',\n id: '',\n },\n {\n desc: 'invalid characters (!)',\n expectedError: 'id can only contain characters in [a-zA-Z0-9._-]',\n id: 'test-id!!',\n },\n {\n desc: 'invalid characters (@)',\n expectedError: 'id can only contain characters in [a-zA-Z0-9._-]',\n id: '_.schemas.default@tag',\n },\n {\n desc: 'starts with dash',\n expectedError: 'id cannot start with - (dash)',\n id: '-_.schemas.default',\n },\n {\n desc: 'consecutive periods',\n expectedError: 'id cannot have consecutive . (period) characters',\n id: '_.schemas..default',\n },\n {\n desc: 'missing required prefix',\n expectedError: 'id must either match _.schemas.<workspaceName>',\n id: 'schemas.default',\n },\n {\n desc: 'incorrect prefix',\n expectedError: 'id must either match _.schemas.<workspaceName>',\n id: 'sanity.schemas.default',\n },\n {\n desc: 'workspace name with invalid characters (space)',\n expectedError: 'id can only contain characters in [a-zA-Z0-9._-]',\n id: '_.schemas.my workspace',\n },\n ])('throws error when id is $desc', async ({expectedError, id}) => {\n const {error} = await testCommand(ListSchemaCommand, ['--id', id], {mocks: defaultMocks})\n\n expect(error?.message).toContain(expectedError)\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test('throws an error if no schemas are found', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas',\n }).reply(200, [])\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas',\n }).reply(200, [])\n\n const {error} = await testCommand(ListSchemaCommand, [], {mocks: defaultMocks})\n\n expect(error?.message).toContain('No schemas found in datasets [\"production\",\"staging\"]')\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test('throws an error if a specific schema based on id flag is not found', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas/_.schemas.staging',\n }).reply(200, [])\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas/_.schemas.staging',\n }).reply(200, [])\n\n const {error} = await testCommand(ListSchemaCommand, ['--id', '_.schemas.staging'], {\n mocks: defaultMocks,\n })\n\n expect(error?.message).toContain(\n 'Schema for id \"_.schemas.staging\" not found in datasets [\"production\",\"staging\"]',\n )\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test('throws an error if schema request fails', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas',\n }).reply(400, {\n error: 'Bad request',\n })\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas',\n }).reply(200, [])\n\n const {error} = await testCommand(ListSchemaCommand, [], {mocks: defaultMocks})\n\n expect(error?.message).toContain('↳ Failed to fetch schema from \"production\":\\n Bad request')\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test('throws an error if schema request fails due to permissions', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas',\n }).reply(401)\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas',\n }).reply(200, [])\n\n const {stderr} = await testCommand(ListSchemaCommand, [], {mocks: defaultMocks})\n\n expect(stderr).toContain('↳ No permissions to read schema from \"production\".')\n })\n\n test('skips manifest extraction with no-extract-manifest flag', async () => {\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/production/schemas',\n }).reply(200, {\n _createdAt: '2025-01-21T18:49:44Z',\n _id: '_.schemas.default',\n workspace: mockManifest.workspaces[0],\n })\n mockApi({\n apiVersion: SCHEMA_API_VERSION,\n uri: '/projects/test-project/datasets/staging/schemas',\n }).reply(200, {\n _createdAt: '2025-05-28T18:49:44Z',\n _id: '_.schemas.staging',\n workspace: mockManifest.workspaces[1],\n })\n\n await testCommand(ListSchemaCommand, ['--no-extract-manifest'], {mocks: defaultMocks})\n\n expect(mockExtractManifestSafe).not.toHaveBeenCalled()\n })\n})\n"],"names":["runCommand","mockApi","testCommand","afterEach","beforeEach","describe","expect","test","vi","extractManifestSafe","createManifestReader","SCHEMA_API_VERSION","NO_DATASET_ID","NO_PROJECT_ID","ListSchemaCommand","mockManifest","createdAt","studioVersion","version","workspaces","basePath","dataset","icon","name","projectId","schema","tools","mock","mockExtractManifestSafe","mocked","mockedCreateManifestReader","testProjectId","defaultMocks","cliConfig","api","projectRoot","directory","path","type","token","clearAllMocks","mockReturnValue","getManifest","fn","mockResolvedValue","getWorkspaceSchema","undefined","stdout","toMatchInlineSnapshot","apiVersion","uri","reply","_createdAt","_id","workspace","mocks","toContain","each","desc","error","message","oclif","exit","toBe","expectedError","id","stderr","not","toHaveBeenCalled"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAa;AACtC,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAkB;AACrD,SAAQC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAO,SAAQ;AAExE,SAAQC,mBAAmB,QAAO,+CAA8C;AAChF,SAAQC,oBAAoB,QAAO,kDAAiD;AACpF,SAAQC,kBAAkB,QAAO,+BAA8B;AAC/D,SAAQC,aAAa,EA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AAYtC;YACZuC,KAAK;QACP,GAAGC,KAAK,CAAC,KAAK;YACZC,YAAY;YACZC,KAAK;YACLC,WAAWvC,aAAaI,UAAU,CAAC,EAAE;QACvC;QACAlB,QAAQ;YACNgD,YAAYtC;YACZuC,KAAK;QACP,GAAGC,KAAK,CAAC,KAAK;YACZC,YAAY;YACZC,KAAK;YACLC,WAAWvC,aAAaI,UAAU,CAAC,EAAE;QACvC;QAEA,MAAMjB,YAAYY,mBAAmB;YAAC;SAAwB,EAAE;YAACyC,OAAOvB;QAAY;QAEpF1B,OAAOsB,yBAAyBuC,GAAG,CAACC,gBAAgB;IACtD;AACF"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { runCommand } from '@oclif/test';
|
|
2
|
-
import { testCommand } from '@sanity/cli-test';
|
|
3
|
-
import { describe, expect, test, vi } from 'vitest';
|
|
4
|
-
import { validateAction } from '../../../actions/schema/validateAction.js';
|
|
5
|
-
import { SchemaValidate } from '../validate.js';
|
|
6
|
-
vi.mock('../../../actions/schema/validateAction.js', ()=>({
|
|
7
|
-
validateAction: vi.fn()
|
|
8
|
-
}));
|
|
9
|
-
describe('#schema:validate', ()=>{
|
|
10
|
-
test('--help works', async ()=>{
|
|
11
|
-
const { stdout } = await runCommand([
|
|
12
|
-
'schema:validate',
|
|
13
|
-
'--help'
|
|
14
|
-
]);
|
|
15
|
-
expect(stdout).toMatchInlineSnapshot(`
|
|
16
|
-
"Validates all schema types specified in a workspace
|
|
17
|
-
|
|
18
|
-
USAGE
|
|
19
|
-
$ sanity schema validate [--debug-metafile-path <value>] [--format
|
|
20
|
-
pretty|ndjson|json] [--level error|warning] [--workspace <value>]
|
|
21
|
-
|
|
22
|
-
FLAGS
|
|
23
|
-
--format=<option> [default: pretty] The output format used to print schema
|
|
24
|
-
errors and warnings
|
|
25
|
-
<options: pretty|ndjson|json>
|
|
26
|
-
--level=<option> [default: warning] The minimum level reported out
|
|
27
|
-
<options: error|warning>
|
|
28
|
-
--workspace=<value> The name of the workspace to use when validating all
|
|
29
|
-
schema types
|
|
30
|
-
|
|
31
|
-
DEBUG FLAGS
|
|
32
|
-
--debug-metafile-path=<value> Optional path where a metafile will be written
|
|
33
|
-
for build analysis. Only written on successful
|
|
34
|
-
validation. Can be analyzed at
|
|
35
|
-
https://esbuild.github.io/analyze/
|
|
36
|
-
|
|
37
|
-
DESCRIPTION
|
|
38
|
-
Validates all schema types specified in a workspace
|
|
39
|
-
|
|
40
|
-
EXAMPLES
|
|
41
|
-
Validates all schema types in a Sanity project with more than one workspace
|
|
42
|
-
|
|
43
|
-
$ sanity schema validate --workspace default
|
|
44
|
-
|
|
45
|
-
Save the results of the report into a file
|
|
46
|
-
|
|
47
|
-
$ sanity schema validate > report.txt
|
|
48
|
-
|
|
49
|
-
Report out only errors
|
|
50
|
-
|
|
51
|
-
$ sanity schema validate --level error
|
|
52
|
-
|
|
53
|
-
Generate a report which can be analyzed with
|
|
54
|
-
https://esbuild.github.io/analyze/
|
|
55
|
-
|
|
56
|
-
$ sanity schema validate --debug-metafile-path metafile.json
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
`);
|
|
60
|
-
});
|
|
61
|
-
test('shows error when user inputs incorrect format flag', async ()=>{
|
|
62
|
-
const { error } = await testCommand(SchemaValidate, [
|
|
63
|
-
'--format',
|
|
64
|
-
'invalid'
|
|
65
|
-
], {
|
|
66
|
-
mocks: {
|
|
67
|
-
projectRoot: {
|
|
68
|
-
directory: '/test/project',
|
|
69
|
-
path: '/test/project/sanity.config.ts',
|
|
70
|
-
type: 'studio'
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
expect(error?.message).toContain('Expected --format=invalid to be one of: pretty, ndjson, json');
|
|
75
|
-
});
|
|
76
|
-
test('shows error when user inputs incorrect level flag', async ()=>{
|
|
77
|
-
const { error } = await testCommand(SchemaValidate, [
|
|
78
|
-
'--level',
|
|
79
|
-
'invalid'
|
|
80
|
-
], {
|
|
81
|
-
mocks: {
|
|
82
|
-
projectRoot: {
|
|
83
|
-
directory: '/test/project',
|
|
84
|
-
path: '/test/project/sanity.config.ts',
|
|
85
|
-
type: 'studio'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
expect(error?.message).toContain('Expected --level=invalid to be one of: error, warning');
|
|
90
|
-
});
|
|
91
|
-
test('calls validate action with correct parameters', async ()=>{
|
|
92
|
-
vi.mocked(validateAction).mockResolvedValueOnce(undefined);
|
|
93
|
-
const { error } = await testCommand(SchemaValidate, [
|
|
94
|
-
'--format',
|
|
95
|
-
'json',
|
|
96
|
-
'--level',
|
|
97
|
-
'error',
|
|
98
|
-
'--workspace',
|
|
99
|
-
'default'
|
|
100
|
-
], {
|
|
101
|
-
mocks: {
|
|
102
|
-
projectRoot: {
|
|
103
|
-
directory: '/test/project',
|
|
104
|
-
path: '/test/project/sanity.config.ts',
|
|
105
|
-
type: 'studio'
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
expect(error).toBeUndefined();
|
|
110
|
-
expect(validateAction).toHaveBeenCalledWith({
|
|
111
|
-
debugMetafilePath: undefined,
|
|
112
|
-
format: 'json',
|
|
113
|
-
level: 'error',
|
|
114
|
-
output: expect.any(Object),
|
|
115
|
-
workDir: '/test/project',
|
|
116
|
-
workspace: 'default'
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
//# sourceMappingURL=validate.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/schema/__tests__/validate.test.ts"],"sourcesContent":["import {runCommand} from '@oclif/test'\nimport {testCommand} from '@sanity/cli-test'\nimport {describe, expect, test, vi} from 'vitest'\n\nimport {validateAction} from '../../../actions/schema/validateAction.js'\nimport {SchemaValidate} from '../validate.js'\n\nvi.mock('../../../actions/schema/validateAction.js', () => ({\n validateAction: vi.fn(),\n}))\n\ndescribe('#schema:validate', () => {\n test('--help works', async () => {\n const {stdout} = await runCommand(['schema:validate', '--help'])\n expect(stdout).toMatchInlineSnapshot(`\n \"Validates all schema types specified in a workspace\n\n USAGE\n $ sanity schema validate [--debug-metafile-path <value>] [--format\n pretty|ndjson|json] [--level error|warning] [--workspace <value>]\n\n FLAGS\n --format=<option> [default: pretty] The output format used to print schema\n errors and warnings\n <options: pretty|ndjson|json>\n --level=<option> [default: warning] The minimum level reported out\n <options: error|warning>\n --workspace=<value> The name of the workspace to use when validating all\n schema types\n\n DEBUG FLAGS\n --debug-metafile-path=<value> Optional path where a metafile will be written\n for build analysis. Only written on successful\n validation. Can be analyzed at\n https://esbuild.github.io/analyze/\n\n DESCRIPTION\n Validates all schema types specified in a workspace\n\n EXAMPLES\n Validates all schema types in a Sanity project with more than one workspace\n\n $ sanity schema validate --workspace default\n\n Save the results of the report into a file\n\n $ sanity schema validate > report.txt\n\n Report out only errors\n\n $ sanity schema validate --level error\n\n Generate a report which can be analyzed with\n https://esbuild.github.io/analyze/\n\n $ sanity schema validate --debug-metafile-path metafile.json\n\n \"\n `)\n })\n\n test('shows error when user inputs incorrect format flag', async () => {\n const {error} = await testCommand(SchemaValidate, ['--format', 'invalid'], {\n mocks: {\n projectRoot: {\n directory: '/test/project',\n path: '/test/project/sanity.config.ts',\n type: 'studio',\n },\n },\n })\n\n expect(error?.message).toContain('Expected --format=invalid to be one of: pretty, ndjson, json')\n })\n\n test('shows error when user inputs incorrect level flag', async () => {\n const {error} = await testCommand(SchemaValidate, ['--level', 'invalid'], {\n mocks: {\n projectRoot: {\n directory: '/test/project',\n path: '/test/project/sanity.config.ts',\n type: 'studio',\n },\n },\n })\n\n expect(error?.message).toContain('Expected --level=invalid to be one of: error, warning')\n })\n\n test('calls validate action with correct parameters', async () => {\n vi.mocked(validateAction).mockResolvedValueOnce(undefined)\n\n const {error} = await testCommand(\n SchemaValidate,\n ['--format', 'json', '--level', 'error', '--workspace', 'default'],\n {\n mocks: {\n projectRoot: {\n directory: '/test/project',\n path: '/test/project/sanity.config.ts',\n type: 'studio',\n },\n },\n },\n )\n\n expect(error).toBeUndefined()\n expect(validateAction).toHaveBeenCalledWith({\n debugMetafilePath: undefined,\n format: 'json',\n level: 'error',\n output: expect.any(Object),\n workDir: '/test/project',\n workspace: 'default',\n })\n })\n})\n"],"names":["runCommand","testCommand","describe","expect","test","vi","validateAction","SchemaValidate","mock","fn","stdout","toMatchInlineSnapshot","error","mocks","projectRoot","directory","path","type","message","toContain","mocked","mockResolvedValueOnce","undefined","toBeUndefined","toHaveBeenCalledWith","debugMetafilePath","format","level","output","any","Object","workDir","workspace"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAa;AACtC,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAAQC,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAO,SAAQ;AAEjD,SAAQC,cAAc,QAAO,4CAA2C;AACxE,SAAQC,cAAc,QAAO,iBAAgB;AAE7CF,GAAGG,IAAI,CAAC,6CAA6C,IAAO,CAAA;QAC1DF,gBAAgBD,GAAGI,EAAE;IACvB,CAAA;AAEAP,SAAS,oBAAoB;IAC3BE,KAAK,gBAAgB;QACnB,MAAM,EAACM,MAAM,EAAC,GAAG,MAAMV,WAAW;YAAC;YAAmB;SAAS;QAC/DG,OAAOO,QAAQC,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4CtC,CAAC;IACH;IAEAP,KAAK,sDAAsD;QACzD,MAAM,EAACQ,KAAK,EAAC,GAAG,MAAMX,YAAYM,gBAAgB;YAAC;YAAY;SAAU,EAAE;YACzEM,OAAO;gBACLC,aAAa;oBACXC,WAAW;oBACXC,MAAM;oBACNC,MAAM;gBACR;YACF;QACF;QAEAd,OAAOS,OAAOM,SAASC,SAAS,CAAC;IACnC;IAEAf,KAAK,qDAAqD;QACxD,MAAM,EAACQ,KAAK,EAAC,GAAG,MAAMX,YAAYM,gBAAgB;YAAC;YA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