@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,308 +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, vi } from 'vitest';
|
|
5
|
-
import { CORS_API_VERSION } from '../../../services/cors.js';
|
|
6
|
-
import { NO_PROJECT_ID } from '../../../util/errorMessages.js';
|
|
7
|
-
import { Delete } from '../delete.js';
|
|
8
|
-
const createCorsOrigin = (overrides)=>({
|
|
9
|
-
allowCredentials: true,
|
|
10
|
-
createdAt: '2023-01-01T00:00:00Z',
|
|
11
|
-
deletedAt: null,
|
|
12
|
-
projectId: 'test-project',
|
|
13
|
-
updatedAt: null,
|
|
14
|
-
...overrides
|
|
15
|
-
});
|
|
16
|
-
const TEST_ORIGINS = {
|
|
17
|
-
APP_EXAMPLE: createCorsOrigin({
|
|
18
|
-
allowCredentials: false,
|
|
19
|
-
id: 2,
|
|
20
|
-
origin: 'https://app.example.com'
|
|
21
|
-
}),
|
|
22
|
-
CASE_MIXED: createCorsOrigin({
|
|
23
|
-
id: 1,
|
|
24
|
-
origin: 'https://Example.Com'
|
|
25
|
-
}),
|
|
26
|
-
EXAMPLE: createCorsOrigin({
|
|
27
|
-
id: 1,
|
|
28
|
-
origin: 'https://example.com'
|
|
29
|
-
}),
|
|
30
|
-
LOCALHOST: createCorsOrigin({
|
|
31
|
-
id: 1,
|
|
32
|
-
origin: 'http://localhost:3000'
|
|
33
|
-
}),
|
|
34
|
-
SPECIAL_CHARS: createCorsOrigin({
|
|
35
|
-
id: 1,
|
|
36
|
-
origin: 'https://café.example.com'
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
const testProjectId = 'test-project';
|
|
40
|
-
const defaultMocks = {
|
|
41
|
-
cliConfig: {
|
|
42
|
-
api: {
|
|
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
|
-
vi.mock('@sanity/cli-core/ux', async ()=>{
|
|
54
|
-
const actual = await vi.importActual('@sanity/cli-core/ux');
|
|
55
|
-
return {
|
|
56
|
-
...actual,
|
|
57
|
-
select: vi.fn()
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
describe('#cors:delete', ()=>{
|
|
61
|
-
afterEach(()=>{
|
|
62
|
-
vi.clearAllMocks();
|
|
63
|
-
const pending = nock.pendingMocks();
|
|
64
|
-
nock.cleanAll();
|
|
65
|
-
expect(pending, 'pending mocks').toEqual([]);
|
|
66
|
-
});
|
|
67
|
-
test('--help works', async ()=>{
|
|
68
|
-
const { stdout } = await runCommand([
|
|
69
|
-
'cors delete',
|
|
70
|
-
'--help'
|
|
71
|
-
]);
|
|
72
|
-
expect(stdout).toContain('Delete an existing CORS origin from your project');
|
|
73
|
-
});
|
|
74
|
-
test('deletes a specific CORS origin', async ()=>{
|
|
75
|
-
mockApi({
|
|
76
|
-
apiVersion: CORS_API_VERSION,
|
|
77
|
-
uri: '/projects/test-project/cors'
|
|
78
|
-
}).reply(200, [
|
|
79
|
-
TEST_ORIGINS.EXAMPLE,
|
|
80
|
-
TEST_ORIGINS.APP_EXAMPLE
|
|
81
|
-
]);
|
|
82
|
-
mockApi({
|
|
83
|
-
apiVersion: CORS_API_VERSION,
|
|
84
|
-
method: 'delete',
|
|
85
|
-
uri: '/projects/test-project/cors/1'
|
|
86
|
-
}).reply(204);
|
|
87
|
-
const { stdout } = await testCommand(Delete, [
|
|
88
|
-
'https://example.com'
|
|
89
|
-
], {
|
|
90
|
-
mocks: defaultMocks
|
|
91
|
-
});
|
|
92
|
-
expect(stdout).toBe('Origin deleted\n');
|
|
93
|
-
});
|
|
94
|
-
test('prompts user to select origin when none specified', async ()=>{
|
|
95
|
-
const { select } = await import('@sanity/cli-core/ux');
|
|
96
|
-
vi.mocked(select).mockResolvedValue(2);
|
|
97
|
-
mockApi({
|
|
98
|
-
apiVersion: CORS_API_VERSION,
|
|
99
|
-
uri: '/projects/test-project/cors'
|
|
100
|
-
}).reply(200, [
|
|
101
|
-
TEST_ORIGINS.EXAMPLE,
|
|
102
|
-
TEST_ORIGINS.APP_EXAMPLE
|
|
103
|
-
]);
|
|
104
|
-
mockApi({
|
|
105
|
-
apiVersion: CORS_API_VERSION,
|
|
106
|
-
method: 'delete',
|
|
107
|
-
uri: '/projects/test-project/cors/2'
|
|
108
|
-
}).reply(204);
|
|
109
|
-
const { stdout } = await testCommand(Delete, [], {
|
|
110
|
-
mocks: defaultMocks
|
|
111
|
-
});
|
|
112
|
-
expect(stdout).toBe('Origin deleted\n');
|
|
113
|
-
expect(select).toHaveBeenCalledWith({
|
|
114
|
-
choices: [
|
|
115
|
-
{
|
|
116
|
-
name: 'https://example.com',
|
|
117
|
-
value: 1
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: 'https://app.example.com',
|
|
121
|
-
value: 2
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
message: 'Select origin to delete'
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
test('handles case-insensitive origin matching', async ()=>{
|
|
128
|
-
mockApi({
|
|
129
|
-
apiVersion: CORS_API_VERSION,
|
|
130
|
-
uri: '/projects/test-project/cors'
|
|
131
|
-
}).reply(200, [
|
|
132
|
-
TEST_ORIGINS.CASE_MIXED
|
|
133
|
-
]);
|
|
134
|
-
mockApi({
|
|
135
|
-
apiVersion: CORS_API_VERSION,
|
|
136
|
-
method: 'delete',
|
|
137
|
-
uri: '/projects/test-project/cors/1'
|
|
138
|
-
}).reply(204);
|
|
139
|
-
const { stdout } = await testCommand(Delete, [
|
|
140
|
-
'https://example.com'
|
|
141
|
-
], {
|
|
142
|
-
mocks: defaultMocks
|
|
143
|
-
});
|
|
144
|
-
expect(stdout).toBe('Origin deleted\n');
|
|
145
|
-
});
|
|
146
|
-
test('throws error when specified origin is not found', async ()=>{
|
|
147
|
-
mockApi({
|
|
148
|
-
apiVersion: CORS_API_VERSION,
|
|
149
|
-
uri: '/projects/test-project/cors'
|
|
150
|
-
}).reply(200, [
|
|
151
|
-
TEST_ORIGINS.EXAMPLE
|
|
152
|
-
]);
|
|
153
|
-
const { error } = await testCommand(Delete, [
|
|
154
|
-
'https://nonexistent.com'
|
|
155
|
-
], {
|
|
156
|
-
mocks: defaultMocks
|
|
157
|
-
});
|
|
158
|
-
expect(error).toBeInstanceOf(Error);
|
|
159
|
-
expect(error?.message).toEqual('Origin "https://nonexistent.com" not found');
|
|
160
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
161
|
-
});
|
|
162
|
-
test('throws error when no CORS origins exist', async ()=>{
|
|
163
|
-
mockApi({
|
|
164
|
-
apiVersion: CORS_API_VERSION,
|
|
165
|
-
uri: '/projects/test-project/cors'
|
|
166
|
-
}).reply(200, []);
|
|
167
|
-
const { error } = await testCommand(Delete, [
|
|
168
|
-
'https://example.com'
|
|
169
|
-
], {
|
|
170
|
-
mocks: defaultMocks
|
|
171
|
-
});
|
|
172
|
-
expect(error).toBeInstanceOf(Error);
|
|
173
|
-
expect(error?.message).toEqual('No CORS origins configured for this project.');
|
|
174
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
175
|
-
});
|
|
176
|
-
test.each([
|
|
177
|
-
{
|
|
178
|
-
desc: 'when fetching origins',
|
|
179
|
-
message: 'Internal Server Error',
|
|
180
|
-
statusCode: 500
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
desc: 'with 404 error when fetching origins',
|
|
184
|
-
message: 'Project not found',
|
|
185
|
-
statusCode: 404
|
|
186
|
-
}
|
|
187
|
-
])('handles API error $desc', async ({ message, statusCode })=>{
|
|
188
|
-
mockApi({
|
|
189
|
-
apiVersion: CORS_API_VERSION,
|
|
190
|
-
uri: '/projects/test-project/cors'
|
|
191
|
-
}).reply(statusCode, {
|
|
192
|
-
message
|
|
193
|
-
});
|
|
194
|
-
const { error } = await testCommand(Delete, [
|
|
195
|
-
'https://example.com'
|
|
196
|
-
], {
|
|
197
|
-
mocks: defaultMocks
|
|
198
|
-
});
|
|
199
|
-
expect(error).toBeInstanceOf(Error);
|
|
200
|
-
expect(error?.message).toContain('Failed to fetch CORS origins');
|
|
201
|
-
expect(error?.message).toContain(message);
|
|
202
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
203
|
-
});
|
|
204
|
-
test.each([
|
|
205
|
-
{
|
|
206
|
-
desc: 'when deleting origin',
|
|
207
|
-
message: 'Failed to delete',
|
|
208
|
-
statusCode: 500
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
desc: 'with 404 error when deleting origin',
|
|
212
|
-
message: 'Origin not found',
|
|
213
|
-
statusCode: 404
|
|
214
|
-
}
|
|
215
|
-
])('handles API error $desc', async ({ message, statusCode })=>{
|
|
216
|
-
mockApi({
|
|
217
|
-
apiVersion: CORS_API_VERSION,
|
|
218
|
-
uri: '/projects/test-project/cors'
|
|
219
|
-
}).reply(200, [
|
|
220
|
-
TEST_ORIGINS.EXAMPLE
|
|
221
|
-
]);
|
|
222
|
-
mockApi({
|
|
223
|
-
apiVersion: CORS_API_VERSION,
|
|
224
|
-
method: 'delete',
|
|
225
|
-
uri: '/projects/test-project/cors/1'
|
|
226
|
-
}).reply(statusCode, {
|
|
227
|
-
message
|
|
228
|
-
});
|
|
229
|
-
const { error } = await testCommand(Delete, [
|
|
230
|
-
'https://example.com'
|
|
231
|
-
], {
|
|
232
|
-
mocks: defaultMocks
|
|
233
|
-
});
|
|
234
|
-
expect(error).toBeInstanceOf(Error);
|
|
235
|
-
expect(error?.message).toContain('Origin deletion failed');
|
|
236
|
-
expect(error?.message).toContain(message);
|
|
237
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
238
|
-
});
|
|
239
|
-
test.each([
|
|
240
|
-
{
|
|
241
|
-
desc: 'no project ID is found',
|
|
242
|
-
projectId: undefined
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
desc: 'project ID is empty string',
|
|
246
|
-
projectId: ''
|
|
247
|
-
}
|
|
248
|
-
])('throws error when $desc', async ({ projectId })=>{
|
|
249
|
-
const { error } = await testCommand(Delete, [
|
|
250
|
-
'https://example.com'
|
|
251
|
-
], {
|
|
252
|
-
mocks: {
|
|
253
|
-
...defaultMocks,
|
|
254
|
-
cliConfig: {
|
|
255
|
-
api: {
|
|
256
|
-
projectId
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
expect(error).toBeInstanceOf(Error);
|
|
262
|
-
expect(error?.message).toEqual(NO_PROJECT_ID);
|
|
263
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
264
|
-
});
|
|
265
|
-
test('handles network errors when fetching origins', async ()=>{
|
|
266
|
-
// Don't set up any mock to simulate network failure
|
|
267
|
-
const { error } = await testCommand(Delete, [
|
|
268
|
-
'https://example.com'
|
|
269
|
-
], {
|
|
270
|
-
mocks: defaultMocks
|
|
271
|
-
});
|
|
272
|
-
expect(error).toBeInstanceOf(Error);
|
|
273
|
-
expect(error?.message).toContain('Failed to fetch CORS origins');
|
|
274
|
-
expect(error?.oclif?.exit).toBe(1);
|
|
275
|
-
});
|
|
276
|
-
test.each([
|
|
277
|
-
{
|
|
278
|
-
desc: 'special characters',
|
|
279
|
-
input: 'https://café.example.com',
|
|
280
|
-
origin: TEST_ORIGINS.SPECIAL_CHARS
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
desc: 'ports',
|
|
284
|
-
input: 'http://localhost:3000',
|
|
285
|
-
origin: TEST_ORIGINS.LOCALHOST
|
|
286
|
-
}
|
|
287
|
-
])('handles $desc in origin names', async ({ input, origin })=>{
|
|
288
|
-
mockApi({
|
|
289
|
-
apiVersion: CORS_API_VERSION,
|
|
290
|
-
uri: '/projects/test-project/cors'
|
|
291
|
-
}).reply(200, [
|
|
292
|
-
origin
|
|
293
|
-
]);
|
|
294
|
-
mockApi({
|
|
295
|
-
apiVersion: CORS_API_VERSION,
|
|
296
|
-
method: 'delete',
|
|
297
|
-
uri: '/projects/test-project/cors/1'
|
|
298
|
-
}).reply(204);
|
|
299
|
-
const { stdout } = await testCommand(Delete, [
|
|
300
|
-
input
|
|
301
|
-
], {
|
|
302
|
-
mocks: defaultMocks
|
|
303
|
-
});
|
|
304
|
-
expect(stdout).toBe('Origin deleted\n');
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
//# sourceMappingURL=delete.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/cors/__tests__/delete.test.ts"],"sourcesContent":["import {runCommand} from '@oclif/test'\nimport {mockApi, testCommand} from '@sanity/cli-test'\nimport nock from 'nock'\nimport {afterEach, describe, expect, test, vi} from 'vitest'\n\nimport {CORS_API_VERSION, type CorsOrigin} from '../../../services/cors.js'\nimport {NO_PROJECT_ID} from '../../../util/errorMessages.js'\nimport {Delete} from '../delete.js'\n\nconst createCorsOrigin = (\n overrides: Partial<CorsOrigin> & {id: number; origin: string},\n): CorsOrigin => ({\n allowCredentials: true,\n createdAt: '2023-01-01T00:00:00Z',\n deletedAt: null,\n projectId: 'test-project',\n updatedAt: null,\n ...overrides,\n})\n\nconst TEST_ORIGINS = {\n APP_EXAMPLE: createCorsOrigin({\n allowCredentials: false,\n id: 2,\n origin: 'https://app.example.com',\n }),\n CASE_MIXED: createCorsOrigin({id: 1, origin: 'https://Example.Com'}),\n EXAMPLE: createCorsOrigin({id: 1, origin: 'https://example.com'}),\n LOCALHOST: createCorsOrigin({id: 1, origin: 'http://localhost:3000'}),\n SPECIAL_CHARS: createCorsOrigin({id: 1, origin: 'https://café.example.com'}),\n} as const\n\nconst testProjectId = 'test-project'\n\nconst defaultMocks = {\n cliConfig: {api: {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\nvi.mock('@sanity/cli-core/ux', async () => {\n const actual = await vi.importActual<typeof import('@sanity/cli-core/ux')>('@sanity/cli-core/ux')\n return {\n ...actual,\n select: vi.fn(),\n }\n})\n\ndescribe('#cors:delete', () => {\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(['cors delete', '--help'])\n expect(stdout).toContain('Delete an existing CORS origin from your project')\n })\n\n test('deletes a specific CORS origin', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(200, [TEST_ORIGINS.EXAMPLE, TEST_ORIGINS.APP_EXAMPLE])\n\n mockApi({\n apiVersion: CORS_API_VERSION,\n method: 'delete',\n uri: '/projects/test-project/cors/1',\n }).reply(204)\n\n const {stdout} = await testCommand(Delete, ['https://example.com'], {mocks: defaultMocks})\n expect(stdout).toBe('Origin deleted\\n')\n })\n\n test('prompts user to select origin when none specified', async () => {\n const {select} = await import('@sanity/cli-core/ux')\n vi.mocked(select).mockResolvedValue(2)\n\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(200, [TEST_ORIGINS.EXAMPLE, TEST_ORIGINS.APP_EXAMPLE])\n\n mockApi({\n apiVersion: CORS_API_VERSION,\n method: 'delete',\n uri: '/projects/test-project/cors/2',\n }).reply(204)\n\n const {stdout} = await testCommand(Delete, [], {mocks: defaultMocks})\n expect(stdout).toBe('Origin deleted\\n')\n expect(select).toHaveBeenCalledWith({\n choices: [\n {name: 'https://example.com', value: 1},\n {name: 'https://app.example.com', value: 2},\n ],\n message: 'Select origin to delete',\n })\n })\n\n test('handles case-insensitive origin matching', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(200, [TEST_ORIGINS.CASE_MIXED])\n\n mockApi({\n apiVersion: CORS_API_VERSION,\n method: 'delete',\n uri: '/projects/test-project/cors/1',\n }).reply(204)\n\n const {stdout} = await testCommand(Delete, ['https://example.com'], {mocks: defaultMocks})\n expect(stdout).toBe('Origin deleted\\n')\n })\n\n test('throws error when specified origin is not found', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(200, [TEST_ORIGINS.EXAMPLE])\n\n const {error} = await testCommand(Delete, ['https://nonexistent.com'], {mocks: defaultMocks})\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toEqual('Origin \"https://nonexistent.com\" not found')\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test('throws error when no CORS origins exist', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(200, [])\n\n const {error} = await testCommand(Delete, ['https://example.com'], {mocks: defaultMocks})\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toEqual('No CORS origins configured for this project.')\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test.each([\n {desc: 'when fetching origins', message: 'Internal Server Error', statusCode: 500},\n {desc: 'with 404 error when fetching origins', message: 'Project not found', statusCode: 404},\n ])('handles API error $desc', async ({message, statusCode}) => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(statusCode, {message})\n\n const {error} = await testCommand(Delete, ['https://example.com'], {mocks: defaultMocks})\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('Failed to fetch CORS origins')\n expect(error?.message).toContain(message)\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test.each([\n {desc: 'when deleting origin', message: 'Failed to delete', statusCode: 500},\n {desc: 'with 404 error when deleting origin', message: 'Origin not found', statusCode: 404},\n ])('handles API error $desc', async ({message, statusCode}) => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(200, [TEST_ORIGINS.EXAMPLE])\n\n mockApi({\n apiVersion: CORS_API_VERSION,\n method: 'delete',\n uri: '/projects/test-project/cors/1',\n }).reply(statusCode, {message})\n\n const {error} = await testCommand(Delete, ['https://example.com'], {mocks: defaultMocks})\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('Origin deletion failed')\n expect(error?.message).toContain(message)\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test.each([\n {desc: 'no project ID is found', projectId: undefined},\n {desc: 'project ID is empty string', projectId: ''},\n ])('throws error when $desc', async ({projectId}) => {\n const {error} = await testCommand(Delete, ['https://example.com'], {\n mocks: {\n ...defaultMocks,\n cliConfig: {api: {projectId}},\n },\n })\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toEqual(NO_PROJECT_ID)\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test('handles network errors when fetching origins', async () => {\n // Don't set up any mock to simulate network failure\n const {error} = await testCommand(Delete, ['https://example.com'], {mocks: defaultMocks})\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('Failed to fetch CORS origins')\n expect(error?.oclif?.exit).toBe(1)\n })\n\n test.each([\n {\n desc: 'special characters',\n input: 'https://café.example.com',\n origin: TEST_ORIGINS.SPECIAL_CHARS,\n },\n {desc: 'ports', input: 'http://localhost:3000', origin: TEST_ORIGINS.LOCALHOST},\n ])('handles $desc in origin names', async ({input, origin}) => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: '/projects/test-project/cors',\n }).reply(200, [origin])\n\n mockApi({\n apiVersion: CORS_API_VERSION,\n method: 'delete',\n uri: '/projects/test-project/cors/1',\n }).reply(204)\n\n const {stdout} = await testCommand(Delete, [input], {mocks: defaultMocks})\n expect(stdout).toBe('Origin deleted\\n')\n })\n})\n"],"names":["runCommand","mockApi","testCommand","nock","afterEach","describe","expect","test","vi","CORS_API_VERSION","NO_PROJECT_ID","Delete","createCorsOrigin","overrides","allowCredentials","createdAt","deletedAt","projectId","updatedAt","TEST_ORIGINS","APP_EXAMPLE","id","origin","CASE_MIXED","EXAMPLE","LOCALHOST","SPECIAL_CHARS","testProjectId","defaultMocks","cliConfig","api","projectRoot","directory","path","type","token","mock","actual","importActual","select","fn","clearAllMocks","pending","pendingMocks","cleanAll","toEqual","stdout","toContain","apiVersion","uri","reply","method","mocks","toBe","mocked","mockResolvedValue","toHaveBeenCalledWith","choices","name","value","message","error","toBeInstanceOf","Error","oclif","exit","each","desc","statusCode","undefined","input"],"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,EAAEC,EAAE,QAAO,SAAQ;AAE5D,SAAQC,gBAAgB,QAAwB,4BAA2B;AAC3E,SAAQC,aAAa,QAAO,iCAAgC;AAC5D,SAAQC,MAAM,QAAO,eAAc;AAEnC,MAAMC,mBAAmB,CACvBC,YACgB,CAAA;QAChBC,kBAAkB;QAClBC,WAAW;QACXC,WAAW;QACXC,WAAW;QACXC,WAAW;QACX,GAAGL,SAAS;IACd,CAAA;AAEA,MAAMM,eAAe;IACnBC,aAAaR,iBAAiB;QAC5BE,kBAAkB;QAClBO,IAAI;QACJC,QAAQ;IACV;IACAC,YAAYX,iBAAiB;QAACS,IAAI;QAAGC,QAAQ;IAAqB;IAClEE,SAASZ,iBAAiB;QAACS,IAAI;QAAGC,QAAQ;IAAqB;IAC/DG,WAAWb,iBAAiB;QAACS,IAAI;QAAGC,QAAQ;IAAuB;IACnEI,eAAed,iBAAiB;QAACS,IAAI;QAAGC,QAAQ;IAA0B;AAC5E;AAEA,M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YvC;YACZwC,KAAK;QACP,GAAGC,KAAK,CAAC,KAAK;YAAC5B;SAAO;QAEtBrB,QAAQ;YACN+C,YAAYvC;YACZ0C,QAAQ;YACRF,KAAK;QACP,GAAGC,KAAK,CAAC;QAET,MAAM,EAACJ,MAAM,EAAC,GAAG,MAAM5C,YAAYS,QAAQ;YAAC2D;SAAM,EAAE;YAAClB,OAAOxB;QAAY;QACxEtB,OAAOwC,QAAQO,IAAI,CAAC;IACtB;AACF"}
|
|
@@ -1,241 +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, vi } from 'vitest';
|
|
5
|
-
import { CORS_API_VERSION } from '../../../services/cors.js';
|
|
6
|
-
import { NO_PROJECT_ID } from '../../../util/errorMessages.js';
|
|
7
|
-
import { List } from '../list.js';
|
|
8
|
-
const testProjectId = 'test-project';
|
|
9
|
-
const defaultMocks = {
|
|
10
|
-
cliConfig: {
|
|
11
|
-
api: {
|
|
12
|
-
projectId: testProjectId
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
projectRoot: {
|
|
16
|
-
directory: '/test/path',
|
|
17
|
-
path: '/test/path/sanity.config.ts',
|
|
18
|
-
type: 'studio'
|
|
19
|
-
},
|
|
20
|
-
token: 'test-token'
|
|
21
|
-
};
|
|
22
|
-
describe('#list', ()=>{
|
|
23
|
-
afterEach(()=>{
|
|
24
|
-
vi.clearAllMocks();
|
|
25
|
-
const pending = nock.pendingMocks();
|
|
26
|
-
nock.cleanAll();
|
|
27
|
-
expect(pending, 'pending mocks').toEqual([]);
|
|
28
|
-
});
|
|
29
|
-
test('--help works', async ()=>{
|
|
30
|
-
const { stdout } = await runCommand([
|
|
31
|
-
'cors list',
|
|
32
|
-
'--help'
|
|
33
|
-
]);
|
|
34
|
-
expect(stdout).toContain('List all origins allowed to access the API for this project');
|
|
35
|
-
});
|
|
36
|
-
test('displays CORS origins correctly', async ()=>{
|
|
37
|
-
mockApi({
|
|
38
|
-
apiVersion: CORS_API_VERSION,
|
|
39
|
-
uri: `/projects/${testProjectId}/cors`
|
|
40
|
-
}).reply(200, [
|
|
41
|
-
{
|
|
42
|
-
allowCredentials: true,
|
|
43
|
-
createdAt: '2023-01-01T00:00:00Z',
|
|
44
|
-
deletedAt: null,
|
|
45
|
-
id: 1,
|
|
46
|
-
origin: 'https://example.com',
|
|
47
|
-
projectId: testProjectId,
|
|
48
|
-
updatedAt: '2023-01-02T00:00:00Z'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
allowCredentials: false,
|
|
52
|
-
createdAt: '2023-01-01T00:00:00Z',
|
|
53
|
-
deletedAt: null,
|
|
54
|
-
id: 2,
|
|
55
|
-
origin: 'https://app.example.com',
|
|
56
|
-
projectId: testProjectId,
|
|
57
|
-
updatedAt: null
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
allowCredentials: true,
|
|
61
|
-
createdAt: '2023-01-03T00:00:00Z',
|
|
62
|
-
deletedAt: null,
|
|
63
|
-
id: 3,
|
|
64
|
-
origin: 'http://localhost:3000',
|
|
65
|
-
projectId: testProjectId,
|
|
66
|
-
updatedAt: null
|
|
67
|
-
}
|
|
68
|
-
]);
|
|
69
|
-
const { stdout } = await testCommand(List, [], {
|
|
70
|
-
mocks: defaultMocks
|
|
71
|
-
});
|
|
72
|
-
expect(stdout).toBe('https://example.com\nhttps://app.example.com\nhttp://localhost:3000\n');
|
|
73
|
-
});
|
|
74
|
-
test('displays single CORS origin correctly', async ()=>{
|
|
75
|
-
mockApi({
|
|
76
|
-
apiVersion: CORS_API_VERSION,
|
|
77
|
-
uri: `/projects/${testProjectId}/cors`
|
|
78
|
-
}).reply(200, [
|
|
79
|
-
{
|
|
80
|
-
allowCredentials: true,
|
|
81
|
-
createdAt: '2023-01-01T00:00:00Z',
|
|
82
|
-
deletedAt: null,
|
|
83
|
-
id: 1,
|
|
84
|
-
origin: 'https://single-origin.com',
|
|
85
|
-
projectId: testProjectId,
|
|
86
|
-
updatedAt: null
|
|
87
|
-
}
|
|
88
|
-
]);
|
|
89
|
-
const { stdout } = await testCommand(List, [], {
|
|
90
|
-
mocks: defaultMocks
|
|
91
|
-
});
|
|
92
|
-
expect(stdout).toBe('https://single-origin.com\n');
|
|
93
|
-
});
|
|
94
|
-
test('handles empty CORS origins list', async ()=>{
|
|
95
|
-
mockApi({
|
|
96
|
-
apiVersion: CORS_API_VERSION,
|
|
97
|
-
uri: `/projects/${testProjectId}/cors`
|
|
98
|
-
}).reply(200, []);
|
|
99
|
-
const { stdout } = await testCommand(List, [], {
|
|
100
|
-
mocks: defaultMocks
|
|
101
|
-
});
|
|
102
|
-
expect(stdout).toBe('No CORS origins configured for this project.\n');
|
|
103
|
-
});
|
|
104
|
-
test('displays an error if the API request fails', async ()=>{
|
|
105
|
-
mockApi({
|
|
106
|
-
apiVersion: CORS_API_VERSION,
|
|
107
|
-
uri: `/projects/${testProjectId}/cors`
|
|
108
|
-
}).reply(500, {
|
|
109
|
-
message: 'Internal Server Error'
|
|
110
|
-
});
|
|
111
|
-
const { error } = await testCommand(List, [], {
|
|
112
|
-
mocks: defaultMocks
|
|
113
|
-
});
|
|
114
|
-
expect(error).toBeInstanceOf(Error);
|
|
115
|
-
expect(error?.message).toContain('CORS origins list retrieval failed');
|
|
116
|
-
expect(error?.message).toContain('Internal Server Error');
|
|
117
|
-
});
|
|
118
|
-
test('handles network errors gracefully', async ()=>{
|
|
119
|
-
// Don't set up any mock to simulate network failure
|
|
120
|
-
const { error } = await testCommand(List, [], {
|
|
121
|
-
mocks: defaultMocks
|
|
122
|
-
});
|
|
123
|
-
expect(error).toBeInstanceOf(Error);
|
|
124
|
-
expect(error?.message).toContain('CORS origins list retrieval failed');
|
|
125
|
-
// The actual error can vary (authorization, network, etc.) so just check the wrapper
|
|
126
|
-
});
|
|
127
|
-
test('throws error when no project ID is found', async ()=>{
|
|
128
|
-
const { error } = await testCommand(List, [], {
|
|
129
|
-
mocks: {
|
|
130
|
-
...defaultMocks,
|
|
131
|
-
cliConfig: {
|
|
132
|
-
api: {
|
|
133
|
-
projectId: undefined
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
expect(error).toBeInstanceOf(Error);
|
|
139
|
-
expect(error?.message).toEqual(NO_PROJECT_ID);
|
|
140
|
-
});
|
|
141
|
-
test('throws error when project ID is null', async ()=>{
|
|
142
|
-
const { error } = await testCommand(List, [], {
|
|
143
|
-
mocks: {
|
|
144
|
-
...defaultMocks,
|
|
145
|
-
cliConfig: {
|
|
146
|
-
api: {
|
|
147
|
-
projectId: undefined
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
expect(error).toBeInstanceOf(Error);
|
|
153
|
-
expect(error?.message).toEqual(NO_PROJECT_ID);
|
|
154
|
-
});
|
|
155
|
-
test('throws error when project ID is empty string', async ()=>{
|
|
156
|
-
const { error } = await testCommand(List, [], {
|
|
157
|
-
mocks: {
|
|
158
|
-
...defaultMocks,
|
|
159
|
-
cliConfig: {
|
|
160
|
-
api: {
|
|
161
|
-
projectId: ''
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
expect(error).toBeInstanceOf(Error);
|
|
167
|
-
expect(error?.message).toEqual(NO_PROJECT_ID);
|
|
168
|
-
});
|
|
169
|
-
test('handles non-array API response', async ()=>{
|
|
170
|
-
mockApi({
|
|
171
|
-
apiVersion: CORS_API_VERSION,
|
|
172
|
-
uri: `/projects/${testProjectId}/cors`
|
|
173
|
-
}).reply(200, {
|
|
174
|
-
message: 'Not an array'
|
|
175
|
-
});
|
|
176
|
-
const { error } = await testCommand(List, [], {
|
|
177
|
-
mocks: defaultMocks
|
|
178
|
-
});
|
|
179
|
-
expect(error).toBeInstanceOf(Error);
|
|
180
|
-
expect(error?.message).toContain('origins.map is not a function');
|
|
181
|
-
});
|
|
182
|
-
test('handles 404 error gracefully', async ()=>{
|
|
183
|
-
mockApi({
|
|
184
|
-
apiVersion: CORS_API_VERSION,
|
|
185
|
-
uri: `/projects/${testProjectId}/cors`
|
|
186
|
-
}).reply(404, {
|
|
187
|
-
message: 'Project not found'
|
|
188
|
-
});
|
|
189
|
-
const { error } = await testCommand(List, [], {
|
|
190
|
-
mocks: defaultMocks
|
|
191
|
-
});
|
|
192
|
-
expect(error).toBeInstanceOf(Error);
|
|
193
|
-
expect(error?.message).toContain('CORS origins list retrieval failed');
|
|
194
|
-
expect(error?.message).toContain('Project not found');
|
|
195
|
-
});
|
|
196
|
-
test('handles 403 forbidden error', async ()=>{
|
|
197
|
-
mockApi({
|
|
198
|
-
apiVersion: CORS_API_VERSION,
|
|
199
|
-
uri: `/projects/${testProjectId}/cors`
|
|
200
|
-
}).reply(403, {
|
|
201
|
-
message: 'Forbidden'
|
|
202
|
-
});
|
|
203
|
-
const { error } = await testCommand(List, [], {
|
|
204
|
-
mocks: defaultMocks
|
|
205
|
-
});
|
|
206
|
-
expect(error).toBeInstanceOf(Error);
|
|
207
|
-
expect(error?.message).toContain('CORS origins list retrieval failed');
|
|
208
|
-
expect(error?.message).toContain('Forbidden');
|
|
209
|
-
});
|
|
210
|
-
test('handles origins with special characters', async ()=>{
|
|
211
|
-
mockApi({
|
|
212
|
-
apiVersion: CORS_API_VERSION,
|
|
213
|
-
uri: `/projects/${testProjectId}/cors`
|
|
214
|
-
}).reply(200, [
|
|
215
|
-
{
|
|
216
|
-
allowCredentials: true,
|
|
217
|
-
createdAt: '2023-01-01T00:00:00Z',
|
|
218
|
-
deletedAt: null,
|
|
219
|
-
id: 1,
|
|
220
|
-
origin: 'https://café.example.com',
|
|
221
|
-
projectId: testProjectId,
|
|
222
|
-
updatedAt: null
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
allowCredentials: false,
|
|
226
|
-
createdAt: '2023-01-02T00:00:00Z',
|
|
227
|
-
deletedAt: null,
|
|
228
|
-
id: 2,
|
|
229
|
-
origin: 'https://example.com:8080',
|
|
230
|
-
projectId: testProjectId,
|
|
231
|
-
updatedAt: null
|
|
232
|
-
}
|
|
233
|
-
]);
|
|
234
|
-
const { stdout } = await testCommand(List, [], {
|
|
235
|
-
mocks: defaultMocks
|
|
236
|
-
});
|
|
237
|
-
expect(stdout).toBe('https://café.example.com\nhttps://example.com:8080\n');
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
//# sourceMappingURL=list.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/cors/__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, vi} from 'vitest'\n\nimport {CORS_API_VERSION} from '../../../services/cors.js'\nimport {NO_PROJECT_ID} from '../../../util/errorMessages.js'\nimport {List} from '../list.js'\n\nconst testProjectId = 'test-project'\n\nconst defaultMocks = {\n cliConfig: {api: {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('#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(['cors list', '--help'])\n\n expect(stdout).toContain('List all origins allowed to access the API for this project')\n })\n\n test('displays CORS origins correctly', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(200, [\n {\n allowCredentials: true,\n createdAt: '2023-01-01T00:00:00Z',\n deletedAt: null,\n id: 1,\n origin: 'https://example.com',\n projectId: testProjectId,\n updatedAt: '2023-01-02T00:00:00Z',\n },\n {\n allowCredentials: false,\n createdAt: '2023-01-01T00:00:00Z',\n deletedAt: null,\n id: 2,\n origin: 'https://app.example.com',\n projectId: testProjectId,\n updatedAt: null,\n },\n {\n allowCredentials: true,\n createdAt: '2023-01-03T00:00:00Z',\n deletedAt: null,\n id: 3,\n origin: 'http://localhost:3000',\n projectId: testProjectId,\n updatedAt: null,\n },\n ])\n\n const {stdout} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(stdout).toBe('https://example.com\\nhttps://app.example.com\\nhttp://localhost:3000\\n')\n })\n\n test('displays single CORS origin correctly', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(200, [\n {\n allowCredentials: true,\n createdAt: '2023-01-01T00:00:00Z',\n deletedAt: null,\n id: 1,\n origin: 'https://single-origin.com',\n projectId: testProjectId,\n updatedAt: null,\n },\n ])\n\n const {stdout} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(stdout).toBe('https://single-origin.com\\n')\n })\n\n test('handles empty CORS origins list', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(200, [])\n\n const {stdout} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(stdout).toBe('No CORS origins configured for this project.\\n')\n })\n\n test('displays an error if the API request fails', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(500, {message: 'Internal Server Error'})\n\n const {error} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('CORS origins list retrieval failed')\n expect(error?.message).toContain('Internal Server Error')\n })\n\n test('handles network errors gracefully', async () => {\n // Don't set up any mock to simulate network failure\n const {error} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('CORS origins list retrieval failed')\n // The actual error can vary (authorization, network, etc.) so just check the wrapper\n })\n\n test('throws error when no project ID is found', async () => {\n const {error} = await testCommand(List, [], {\n mocks: {\n ...defaultMocks,\n cliConfig: {api: {projectId: undefined}},\n },\n })\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toEqual(NO_PROJECT_ID)\n })\n\n test('throws error when project ID is null', async () => {\n const {error} = await testCommand(List, [], {\n mocks: {\n ...defaultMocks,\n cliConfig: {api: {projectId: undefined}},\n },\n })\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toEqual(NO_PROJECT_ID)\n })\n\n test('throws error when project ID is empty string', async () => {\n const {error} = await testCommand(List, [], {\n mocks: {\n ...defaultMocks,\n cliConfig: {api: {projectId: ''}},\n },\n })\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toEqual(NO_PROJECT_ID)\n })\n\n test('handles non-array API response', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(200, {message: 'Not an array'})\n\n const {error} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('origins.map is not a function')\n })\n\n test('handles 404 error gracefully', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(404, {message: 'Project not found'})\n\n const {error} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('CORS origins list retrieval failed')\n expect(error?.message).toContain('Project not found')\n })\n\n test('handles 403 forbidden error', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(403, {message: 'Forbidden'})\n\n const {error} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(error).toBeInstanceOf(Error)\n expect(error?.message).toContain('CORS origins list retrieval failed')\n expect(error?.message).toContain('Forbidden')\n })\n\n test('handles origins with special characters', async () => {\n mockApi({\n apiVersion: CORS_API_VERSION,\n uri: `/projects/${testProjectId}/cors`,\n }).reply(200, [\n {\n allowCredentials: true,\n createdAt: '2023-01-01T00:00:00Z',\n deletedAt: null,\n id: 1,\n origin: 'https://café.example.com',\n projectId: testProjectId,\n updatedAt: null,\n },\n {\n allowCredentials: false,\n createdAt: '2023-01-02T00:00:00Z',\n deletedAt: null,\n id: 2,\n origin: 'https://example.com:8080',\n projectId: testProjectId,\n updatedAt: null,\n },\n ])\n\n const {stdout} = await testCommand(List, [], {mocks: defaultMocks})\n\n expect(stdout).toBe('https://café.example.com\\nhttps://example.com:8080\\n')\n })\n})\n"],"names":["runCommand","mockApi","testCommand","nock","afterEach","describe","expect","test","vi","CORS_API_VERSION","NO_PROJECT_ID","List","testProjectId","defaultMocks","cliConfig","api","projectId","projectRoot","directory","path","type","token","clearAllMocks","pending","pendingMocks","cleanAll","toEqual","stdout","toContain","apiVersion","uri","reply","allowCredentials","createdAt","deletedAt","id","origin","updatedAt","mocks","toBe","message","error","toBeInstanceOf","Error","undefined"],"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,EAAEC,EAAE,QAAO,SAAQ;AAE5D,SAAQC,gBAAgB,QAAO,4BAA2B;AAC1D,SAAQC,aAAa,QAAO,iCAAgC;AAC5D,SAAQC,IAAI,QAAO,aAAY;AAE/B,MAAMC,gBAAgB;AAEtB,MAAMC,eAAe;IACnBC,WAAW;QAACC,KAAK;YAACC,WAAWJ;QAAa;IAAC;IAC3CK,aAAa;QACXC,WAAW;QACXC,MAAM;QACNC,MAAM;IACR;IACAC,OAAO;AACT;AAEAhB,SAAS,SAAS;IAChBD,UAAU;QACRI,GAAGc,aAAa;QAChB,MAAMC,UAAUpB,KAAKqB,YAAY;QACjCrB,KAAKsB,QAAQ;QACbnB,OAAOiB,SAAS,iBAAiBG,OAAO,CAAC,EAAE;IAC7C;IAEAnB,KAAK,gBAAgB;QACnB,MAAM,EAACoB,MA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