@sanity/cli 6.0.0-alpha.5 → 6.0.0-alpha.6
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/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/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/config/createCliConfig.d.ts +9 -0
- 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/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/oclif.manifest.json +113 -113
- package/package.json +16 -12
- 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,113 +0,0 @@
|
|
|
1
|
-
import { runCommand } from '@oclif/test';
|
|
2
|
-
import { testCommand } from '@sanity/cli-test';
|
|
3
|
-
import nock from 'nock';
|
|
4
|
-
import open from 'open';
|
|
5
|
-
import { afterEach, describe, expect, test, vi } from 'vitest';
|
|
6
|
-
import { ListOpenApiCommand } from '../list.js';
|
|
7
|
-
const mockSpecs = [
|
|
8
|
-
{
|
|
9
|
-
description: 'Query documents and other content',
|
|
10
|
-
slug: 'query',
|
|
11
|
-
title: 'Query API'
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
description: 'Create, update and delete documents',
|
|
15
|
-
slug: 'mutate',
|
|
16
|
-
title: 'Mutate API'
|
|
17
|
-
}
|
|
18
|
-
];
|
|
19
|
-
describe('#openapi:list', ()=>{
|
|
20
|
-
afterEach(()=>{
|
|
21
|
-
vi.clearAllMocks();
|
|
22
|
-
const pending = nock.pendingMocks();
|
|
23
|
-
nock.cleanAll();
|
|
24
|
-
expect(pending, 'pending mocks').toEqual([]);
|
|
25
|
-
});
|
|
26
|
-
test('--help works', async ()=>{
|
|
27
|
-
const { stdout } = await runCommand([
|
|
28
|
-
'openapi list',
|
|
29
|
-
'--help'
|
|
30
|
-
]);
|
|
31
|
-
expect(stdout).toContain('List all available OpenAPI specifications');
|
|
32
|
-
});
|
|
33
|
-
test('displays OpenAPI specs correctly', async ()=>{
|
|
34
|
-
nock('https://www.sanity.io').get('/docs/api/openapi').reply(200, {
|
|
35
|
-
specs: mockSpecs
|
|
36
|
-
}, {
|
|
37
|
-
'Content-Type': 'application/json'
|
|
38
|
-
});
|
|
39
|
-
const { stdout } = await testCommand(ListOpenApiCommand);
|
|
40
|
-
expect(stdout).toContain('Title: Query API');
|
|
41
|
-
expect(stdout).toContain('Description: Query documents and other content');
|
|
42
|
-
expect(stdout).toContain('Slug: query');
|
|
43
|
-
expect(stdout).toContain('Title: Mutate API');
|
|
44
|
-
expect(stdout).toContain('Description: Create, update and delete documents');
|
|
45
|
-
expect(stdout).toContain('Slug: mutate');
|
|
46
|
-
});
|
|
47
|
-
test('displays specs in JSON format with --json flag', async ()=>{
|
|
48
|
-
nock('https://www.sanity.io').get('/docs/api/openapi').reply(200, {
|
|
49
|
-
specs: mockSpecs
|
|
50
|
-
}, {
|
|
51
|
-
'Content-Type': 'application/json'
|
|
52
|
-
});
|
|
53
|
-
const { stdout } = await testCommand(ListOpenApiCommand, [
|
|
54
|
-
'--json'
|
|
55
|
-
]);
|
|
56
|
-
expect(stdout).toContain(JSON.stringify(mockSpecs, null, 2));
|
|
57
|
-
});
|
|
58
|
-
test('opens web browser with --web flag', async ()=>{
|
|
59
|
-
const { stdout } = await testCommand(ListOpenApiCommand, [
|
|
60
|
-
'--web'
|
|
61
|
-
]);
|
|
62
|
-
expect(stdout).toContain('Opening https://www.sanity.io/docs/http-reference');
|
|
63
|
-
expect(open).toHaveBeenCalledWith('https://www.sanity.io/docs/http-reference');
|
|
64
|
-
});
|
|
65
|
-
test('handles empty specs list', async ()=>{
|
|
66
|
-
nock('https://www.sanity.io').get('/docs/api/openapi').reply(200, {
|
|
67
|
-
specs: []
|
|
68
|
-
}, {
|
|
69
|
-
'Content-Type': 'application/json'
|
|
70
|
-
});
|
|
71
|
-
const { stdout } = await testCommand(ListOpenApiCommand);
|
|
72
|
-
expect(stdout).toContain('No OpenAPI specifications available.');
|
|
73
|
-
});
|
|
74
|
-
test('handles missing specs property', async ()=>{
|
|
75
|
-
nock('https://www.sanity.io').get('/docs/api/openapi').reply(200, {}, {
|
|
76
|
-
'Content-Type': 'application/json'
|
|
77
|
-
});
|
|
78
|
-
const { stdout } = await testCommand(ListOpenApiCommand);
|
|
79
|
-
expect(stdout).toContain('No OpenAPI specifications available.');
|
|
80
|
-
});
|
|
81
|
-
test('handles specs without description', async ()=>{
|
|
82
|
-
const specsWithoutDesc = [
|
|
83
|
-
{
|
|
84
|
-
slug: 'test',
|
|
85
|
-
title: 'Test API'
|
|
86
|
-
}
|
|
87
|
-
];
|
|
88
|
-
nock('https://www.sanity.io').get('/docs/api/openapi').reply(200, {
|
|
89
|
-
specs: specsWithoutDesc
|
|
90
|
-
}, {
|
|
91
|
-
'Content-Type': 'application/json'
|
|
92
|
-
});
|
|
93
|
-
const { stdout } = await testCommand(ListOpenApiCommand);
|
|
94
|
-
expect(stdout).toContain('Title: Test API');
|
|
95
|
-
expect(stdout).not.toContain(' ');
|
|
96
|
-
});
|
|
97
|
-
test('handles API server error', async ()=>{
|
|
98
|
-
nock('https://www.sanity.io').get('/docs/api/openapi').reply(500, 'Server Error');
|
|
99
|
-
const { error } = await testCommand(ListOpenApiCommand);
|
|
100
|
-
expect(error).toBeInstanceOf(Error);
|
|
101
|
-
expect(error?.message).toContain('The OpenAPI service is currently unavailable. Please try again later.');
|
|
102
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
103
|
-
});
|
|
104
|
-
test('handles network error', async ()=>{
|
|
105
|
-
nock('https://www.sanity.io').get('/docs/api/openapi').replyWithError('Network error');
|
|
106
|
-
const { error } = await testCommand(ListOpenApiCommand);
|
|
107
|
-
expect(error).toBeInstanceOf(Error);
|
|
108
|
-
expect(error?.message).toContain('The OpenAPI service is currently unavailable. Please try again later.');
|
|
109
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=list.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/openapi/__tests__/list.test.ts"],"sourcesContent":["import {runCommand} from '@oclif/test'\nimport {testCommand} from '@sanity/cli-test'\nimport nock from 'nock'\nimport open from 'open'\nimport {afterEach, describe, expect, test, vi} from 'vitest'\n\nimport {ListOpenApiCommand} from '../list.js'\n\nconst mockSpecs = [\n {\n description: 'Query documents and other content',\n slug: 'query',\n title: 'Query API',\n },\n {\n description: 'Create, update and delete documents',\n slug: 'mutate',\n title: 'Mutate API',\n },\n]\n\ndescribe('#openapi:list', () => {\n afterEach(() => {\n vi.clearAllMocks()\n const pending = nock.pendingMocks()\n nock.cleanAll()\n expect(pending, 'pending mocks').toEqual([])\n })\n\n test('--help works', async () => {\n const {stdout} = await runCommand(['openapi list', '--help'])\n\n expect(stdout).toContain('List all available OpenAPI specifications')\n })\n\n test('displays OpenAPI specs correctly', async () => {\n nock('https://www.sanity.io')\n .get('/docs/api/openapi')\n .reply(200, {specs: mockSpecs}, {'Content-Type': 'application/json'})\n\n const {stdout} = await testCommand(ListOpenApiCommand)\n\n expect(stdout).toContain('Title: Query API')\n expect(stdout).toContain('Description: Query documents and other content')\n expect(stdout).toContain('Slug: query')\n expect(stdout).toContain('Title: Mutate API')\n expect(stdout).toContain('Description: Create, update and delete documents')\n expect(stdout).toContain('Slug: mutate')\n })\n\n test('displays specs in JSON format with --json flag', async () => {\n nock('https://www.sanity.io')\n .get('/docs/api/openapi')\n .reply(200, {specs: mockSpecs}, {'Content-Type': 'application/json'})\n\n const {stdout} = await testCommand(ListOpenApiCommand, ['--json'])\n\n expect(stdout).toContain(JSON.stringify(mockSpecs, null, 2))\n })\n\n test('opens web browser with --web flag', async () => {\n const {stdout} = await testCommand(ListOpenApiCommand, ['--web'])\n\n expect(stdout).toContain('Opening https://www.sanity.io/docs/http-reference')\n expect(open).toHaveBeenCalledWith('https://www.sanity.io/docs/http-reference')\n })\n\n test('handles empty specs list', async () => {\n nock('https://www.sanity.io')\n .get('/docs/api/openapi')\n .reply(200, {specs: []}, {'Content-Type': 'application/json'})\n\n const {stdout} = await testCommand(ListOpenApiCommand)\n\n expect(stdout).toContain('No OpenAPI specifications available.')\n })\n\n test('handles missing specs property', async () => {\n nock('https://www.sanity.io')\n .get('/docs/api/openapi')\n .reply(200, {}, {'Content-Type': 'application/json'})\n\n const {stdout} = await testCommand(ListOpenApiCommand)\n\n expect(stdout).toContain('No OpenAPI specifications available.')\n })\n\n test('handles specs without description', async () => {\n const specsWithoutDesc = [{slug: 'test', title: 'Test API'}]\n nock('https://www.sanity.io')\n .get('/docs/api/openapi')\n .reply(200, {specs: specsWithoutDesc}, {'Content-Type': 'application/json'})\n\n const {stdout} = await testCommand(ListOpenApiCommand)\n\n expect(stdout).toContain('Title: Test API')\n expect(stdout).not.toContain(' ')\n })\n\n test('handles API server error', async () => {\n nock('https://www.sanity.io').get('/docs/api/openapi').reply(500, 'Server Error')\n\n const {error} = await testCommand(ListOpenApiCommand)\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain(\n 'The OpenAPI service is currently unavailable. Please try again later.',\n )\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test('handles network error', async () => {\n nock('https://www.sanity.io').get('/docs/api/openapi').replyWithError('Network error')\n\n const {error} = await testCommand(ListOpenApiCommand)\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain(\n 'The OpenAPI service is currently unavailable. Please try again later.',\n )\n expect(error?.oclif?.exit).toBe(1)\n })\n})\n"],"names":["runCommand","testCommand","nock","open","afterEach","describe","expect","test","vi","ListOpenApiCommand","mockSpecs","description","slug","title","clearAllMocks","pending","pendingMocks","cleanAll","toEqual","stdout","toContain","get","reply","specs","JSON","stringify","toHaveBeenCalledWith","specsWithoutDesc","not","error","toBeInstanceOf","Error","message","oclif","exit","toBe","replyWithError"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAa;AACtC,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,OAAOC,UAAU,OAAM;AACvB,OAAOC,UAAU,OAAM;AACvB,SAAQC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAO,SAAQ;AAE5D,SAAQC,kBAAkB,Q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H,OAAOuB,OAAOC,cAAc,CAACC;QAC7BzB,OAAOuB,OAAOG,SAASZ,SAAS,CAC9B;QAEFd,OAAOuB,OAAOI,OAAOC,MAAMC,IAAI,CAAC;IAClC;AACF"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { runCommand } from '@oclif/test';
|
|
2
|
-
import { mockApi, testCommand } from '@sanity/cli-test';
|
|
3
|
-
import nock from 'nock';
|
|
4
|
-
import { afterEach, describe, expect, test } from 'vitest';
|
|
5
|
-
import { PROJECTS_API_VERSION } from '../../../services/projects.js';
|
|
6
|
-
import { List } from '../list.js';
|
|
7
|
-
describe('#list', ()=>{
|
|
8
|
-
afterEach(()=>{
|
|
9
|
-
const pending = nock.pendingMocks();
|
|
10
|
-
nock.cleanAll();
|
|
11
|
-
expect(pending, 'pending mocks').toEqual([]);
|
|
12
|
-
});
|
|
13
|
-
test('--help works', async ()=>{
|
|
14
|
-
const { stdout } = await runCommand([
|
|
15
|
-
'projects list',
|
|
16
|
-
'--help'
|
|
17
|
-
]);
|
|
18
|
-
expect(stdout).toContain('Lists projects connected to your user');
|
|
19
|
-
});
|
|
20
|
-
test('displays projects correctly', async ()=>{
|
|
21
|
-
mockApi({
|
|
22
|
-
apiVersion: PROJECTS_API_VERSION,
|
|
23
|
-
uri: '/projects'
|
|
24
|
-
}).reply(200, [
|
|
25
|
-
{
|
|
26
|
-
createdAt: '2023-01-01',
|
|
27
|
-
displayName: 'Project One',
|
|
28
|
-
id: 'project1',
|
|
29
|
-
members: [
|
|
30
|
-
'user1',
|
|
31
|
-
'user2'
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
createdAt: '2023-01-02',
|
|
36
|
-
displayName: 'Project Two',
|
|
37
|
-
id: 'project2',
|
|
38
|
-
members: [
|
|
39
|
-
'user1'
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
]);
|
|
43
|
-
const { stdout } = await testCommand(List);
|
|
44
|
-
expect(stdout).toMatchSnapshot();
|
|
45
|
-
});
|
|
46
|
-
test('sorts by members when --sort members is specified', async ()=>{
|
|
47
|
-
mockApi({
|
|
48
|
-
apiVersion: PROJECTS_API_VERSION,
|
|
49
|
-
uri: '/projects'
|
|
50
|
-
}).reply(200, [
|
|
51
|
-
{
|
|
52
|
-
createdAt: '2023-01-01',
|
|
53
|
-
displayName: 'Project One',
|
|
54
|
-
id: 'project1',
|
|
55
|
-
members: [
|
|
56
|
-
'user1',
|
|
57
|
-
'user2',
|
|
58
|
-
'user3'
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
createdAt: '2023-01-02',
|
|
63
|
-
displayName: 'Project Two',
|
|
64
|
-
id: 'project2',
|
|
65
|
-
members: [
|
|
66
|
-
'user1'
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
createdAt: '2023-01-03',
|
|
71
|
-
displayName: 'Project Three',
|
|
72
|
-
id: 'project3',
|
|
73
|
-
members: [
|
|
74
|
-
'user1',
|
|
75
|
-
'user2'
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
]);
|
|
79
|
-
const { stdout } = await testCommand(List, [
|
|
80
|
-
'--sort',
|
|
81
|
-
'members'
|
|
82
|
-
]);
|
|
83
|
-
const lines = stdout.split('\n').filter(Boolean);
|
|
84
|
-
// Find the indices of lines containing each project
|
|
85
|
-
const project1Index = lines.findIndex((line)=>line.includes('project1'));
|
|
86
|
-
const project2Index = lines.findIndex((line)=>line.includes('project2'));
|
|
87
|
-
const project3Index = lines.findIndex((line)=>line.includes('project3'));
|
|
88
|
-
// Verify they all exist
|
|
89
|
-
expect(project1Index).toBeGreaterThan(-1);
|
|
90
|
-
expect(project2Index).toBeGreaterThan(-1);
|
|
91
|
-
expect(project3Index).toBeGreaterThan(-1);
|
|
92
|
-
// By default order is desc, so project with most members should come first
|
|
93
|
-
expect(project1Index).toBeLessThan(project3Index);
|
|
94
|
-
expect(project3Index).toBeLessThan(project2Index);
|
|
95
|
-
});
|
|
96
|
-
test('sorts in ascending order when --order asc is specified', async ()=>{
|
|
97
|
-
mockApi({
|
|
98
|
-
apiVersion: PROJECTS_API_VERSION,
|
|
99
|
-
uri: '/projects'
|
|
100
|
-
}).reply(200, [
|
|
101
|
-
{
|
|
102
|
-
createdAt: '2023-01-01',
|
|
103
|
-
displayName: 'Project One',
|
|
104
|
-
id: 'project1',
|
|
105
|
-
members: [
|
|
106
|
-
'user1',
|
|
107
|
-
'user2'
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
createdAt: '2023-01-02',
|
|
112
|
-
displayName: 'Project Two',
|
|
113
|
-
id: 'project2'
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
createdAt: '2023-01-03',
|
|
117
|
-
displayName: 'Project Three',
|
|
118
|
-
id: 'project3',
|
|
119
|
-
members: [
|
|
120
|
-
'user1',
|
|
121
|
-
'user2',
|
|
122
|
-
'user3'
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
]);
|
|
126
|
-
const { stdout } = await testCommand(List, [
|
|
127
|
-
'--order',
|
|
128
|
-
'asc'
|
|
129
|
-
]);
|
|
130
|
-
const lines = stdout.split('\n').filter(Boolean);
|
|
131
|
-
const line2023_01_01 = lines.findIndex((line)=>line.includes('2023-01-01'));
|
|
132
|
-
const line2023_01_02 = lines.findIndex((line)=>line.includes('2023-01-02'));
|
|
133
|
-
const line2023_01_03 = lines.findIndex((line)=>line.includes('2023-01-03'));
|
|
134
|
-
expect(line2023_01_01).toBeGreaterThan(0); // First line is header
|
|
135
|
-
expect(line2023_01_02).toBeGreaterThan(0);
|
|
136
|
-
expect(line2023_01_03).toBeGreaterThan(0);
|
|
137
|
-
// Check the order (ascending)
|
|
138
|
-
expect(line2023_01_01).toBeLessThan(line2023_01_02);
|
|
139
|
-
expect(line2023_01_02).toBeLessThan(line2023_01_03);
|
|
140
|
-
});
|
|
141
|
-
test('displays an error if the API request fails', async ()=>{
|
|
142
|
-
mockApi({
|
|
143
|
-
apiVersion: PROJECTS_API_VERSION,
|
|
144
|
-
uri: '/projects'
|
|
145
|
-
}).reply(500, {
|
|
146
|
-
message: 'Internal Server Error'
|
|
147
|
-
});
|
|
148
|
-
const { error } = await testCommand(List);
|
|
149
|
-
expect(error).toBeInstanceOf(Error);
|
|
150
|
-
expect(error?.message).toContain('Failed to list projects');
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
//# sourceMappingURL=list.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/projects/__tests__/list.test.ts"],"sourcesContent":["import {runCommand} from '@oclif/test'\nimport {mockApi, testCommand} from '@sanity/cli-test'\nimport nock from 'nock'\nimport {afterEach, describe, expect, test} from 'vitest'\n\nimport {PROJECTS_API_VERSION} from '../../../services/projects.js'\nimport {List} from '../list.js'\n\ndescribe('#list', () => {\n afterEach(() => {\n const pending = nock.pendingMocks()\n nock.cleanAll()\n expect(pending, 'pending mocks').toEqual([])\n })\n\n test('--help works', async () => {\n const {stdout} = await runCommand(['projects list', '--help'])\n\n expect(stdout).toContain('Lists projects connected to your user')\n })\n\n test('displays projects correctly', async () => {\n mockApi({\n apiVersion: PROJECTS_API_VERSION,\n uri: '/projects',\n }).reply(200, [\n {\n createdAt: '2023-01-01',\n displayName: 'Project One',\n id: 'project1',\n members: ['user1', 'user2'],\n },\n {\n createdAt: '2023-01-02',\n displayName: 'Project Two',\n id: 'project2',\n members: ['user1'],\n },\n ])\n\n const {stdout} = await testCommand(List)\n\n expect(stdout).toMatchSnapshot()\n })\n\n test('sorts by members when --sort members is specified', async () => {\n mockApi({\n apiVersion: PROJECTS_API_VERSION,\n uri: '/projects',\n }).reply(200, [\n {\n createdAt: '2023-01-01',\n displayName: 'Project One',\n id: 'project1',\n members: ['user1', 'user2', 'user3'],\n },\n {\n createdAt: '2023-01-02',\n displayName: 'Project Two',\n id: 'project2',\n members: ['user1'],\n },\n {\n createdAt: '2023-01-03',\n displayName: 'Project Three',\n id: 'project3',\n members: ['user1', 'user2'],\n },\n ])\n\n const {stdout} = await testCommand(List, ['--sort', 'members'])\n\n const lines = stdout.split('\\n').filter(Boolean)\n\n // Find the indices of lines containing each project\n const project1Index = lines.findIndex((line) => line.includes('project1'))\n const project2Index = lines.findIndex((line) => line.includes('project2'))\n const project3Index = lines.findIndex((line) => line.includes('project3'))\n\n // Verify they all exist\n expect(project1Index).toBeGreaterThan(-1)\n expect(project2Index).toBeGreaterThan(-1)\n expect(project3Index).toBeGreaterThan(-1)\n\n // By default order is desc, so project with most members should come first\n expect(project1Index).toBeLessThan(project3Index)\n expect(project3Index).toBeLessThan(project2Index)\n })\n\n test('sorts in ascending order when --order asc is specified', async () => {\n mockApi({\n apiVersion: PROJECTS_API_VERSION,\n uri: '/projects',\n }).reply(200, [\n {\n createdAt: '2023-01-01',\n displayName: 'Project One',\n id: 'project1',\n members: ['user1', 'user2'],\n },\n {\n createdAt: '2023-01-02',\n displayName: 'Project Two',\n id: 'project2',\n },\n {\n createdAt: '2023-01-03',\n displayName: 'Project Three',\n id: 'project3',\n members: ['user1', 'user2', 'user3'],\n },\n ])\n\n const {stdout} = await testCommand(List, ['--order', 'asc'])\n\n const lines = stdout.split('\\n').filter(Boolean)\n\n const line2023_01_01 = lines.findIndex((line) => line.includes('2023-01-01'))\n const line2023_01_02 = lines.findIndex((line) => line.includes('2023-01-02'))\n const line2023_01_03 = lines.findIndex((line) => line.includes('2023-01-03'))\n\n expect(line2023_01_01).toBeGreaterThan(0) // First line is header\n expect(line2023_01_02).toBeGreaterThan(0)\n expect(line2023_01_03).toBeGreaterThan(0)\n\n // Check the order (ascending)\n expect(line2023_01_01).toBeLessThan(line2023_01_02)\n expect(line2023_01_02).toBeLessThan(line2023_01_03)\n })\n\n test('displays an error if the API request fails', async () => {\n mockApi({\n apiVersion: PROJECTS_API_VERSION,\n uri: '/projects',\n }).reply(500, {message: 'Internal Server Error'})\n\n const {error} = await testCommand(List)\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('Failed to list projects')\n })\n})\n"],"names":["runCommand","mockApi","testCommand","nock","afterEach","describe","expect","test","PROJECTS_API_VERSION","List","pending","pendingMocks","cleanAll","toEqual","stdout","toContain","apiVersion","uri","reply","createdAt","displayName","id","members","toMatchSnapshot","lines","split","filter","Boolean","project1Index","findIndex","line","includes","project2Index","project3Index","toBeGreaterThan","toBeLessThan","line2023_01_01","line2023_01_02","line2023_01_03","message","error","toBeInstanceOf","Error"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAa;AACtC,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAkB;AACrD,OAAOC,UAAU,OAAM;AACvB,SAAQC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,IAAI,QAAO,SAAQ;AAExD,SAAQC,oBAAoB,QAAO,gCAA+B;AAClE,SAAQC,IAAI,QAAO,aAAY;AAE/BJ,SAAS,SAAS;IAChBD,UAAU;QACR,MAAMM,UAAUP,KAAKQ,YAAY;QACjCR,KAAKS,QAAQ;QACbN,OAAOI,SAAS,iBAAiBG,OAAO,CAAC,EAAE;IAC7C;IAEAN,KAAK,gBAAgB;QACnB,MAAM,EAACO,MAAM,EAAC,GAAG,MAAMd,WAAW;YAAC;YAAiB;SAAS;QAE7DM,OAAOQ,QAAQC,SAAS,CAAC;IAC3B;IAEAR,KAAK,+BAA+B;QAClCN,QAAQ;YACNe,YAAYR;YACZS,KAAK;QACP,GAAGC,KAAK,CAAC,KAAK;YACZ;gBACEC,WAAW;gBACXC,aAAa;gBACbC,IAAI;gBACJC,SAAS;oBAAC;oBAAS;iBAAQ;YAC7B;YACA;gBACEH,WAAW;gBACXC,aAAa;gBACbC,IAAI;gBACJC,SAAS;oBAAC;iBAAQ;YACpB;SACD;QAED,MAAM,EAACR,MAAM,EAAC,GAAG,MAAMZ,YAAYO;QAEnCH,OAAOQ,QAAQS,eAAe;IAChC;IAEAhB,KAAK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