atlassian-connect-descriptor 0.4.12.0 → 0.4.13.0
raw patch · 4 files changed
+86/−109 lines, 4 files
Files
- atlassian-connect-descriptor.cabal +76/−104
- src/Data/Connect/Conditions.hs +3/−0
- src/Data/Connect/Descriptor.hs +5/−3
- tests/DescriptorTest.hs +2/−2
atlassian-connect-descriptor.cabal view
@@ -1,126 +1,98 @@--- Initial atlassian-connect-descriptor.cabal generated by cabal init. For--- further documentation, see http://haskell.org/cabal/users-guide/---- The name of the package.-name: atlassian-connect-descriptor---- The package version. See the Haskell package versioning policy (PVP)--- for standards guiding when and how versions should be incremented.--- http://www.haskell.org/haskellwiki/Package_versioning_policy--- PVP summary: +-+------- breaking API changes--- | | +----- non-breaking API additions--- | | | +--- code changes with no API change-version: 0.4.12.0---- A short (one-line) description of the package.-synopsis: Code that helps you create a valid Atlassian Connect Descriptor.---- A longer description of the package.-description: Allows you to generate an Atlassian Connect Descriptor in a typesafe manner and easily convert it- it into JSON using the fantastic Aeson library.---- The license under which the package is released.-license: Apache-2.0---- The file containing the license text.-license-file: LICENSE---- The package author(s).-author: Robert Massaioli---- An email address to which users can send suggestions, bug reports, and--- patches.-maintainer: rmassaioli@atlassian.com---- A copyright notice.--- copyright:--category: Data--build-type: Simple+cabal-version: 1.12 --- Extra files to be distributed with the package, such as examples or a--- README.-extra-source-files: README.markdown+-- This file has been generated from package.yaml by hpack version 0.34.4.+--+-- see: https://github.com/sol/hpack --- Constraint on the version of Cabal needed to build this package.-cabal-version: >=1.10+name: atlassian-connect-descriptor+version: 0.4.13.0+synopsis: Code that helps you create a valid Atlassian Connect Descriptor.+description: Allows you to generate an Atlassian Connect Descriptor in a typesafe manner and easily convert it+ it into JSON using the fantastic Aeson library.+category: Data+author: Robert Massaioli+maintainer: rmassaioli@atlassian.com+license: Apache-2.0+license-file: LICENSE+build-type: Simple+extra-source-files:+ README.markdown source-repository head- type: git+ type: git location: git@bitbucket.org:robertmassaioli/atlassian-connect-descriptor.git flag network-uri- description: Get Network.URI from the network-uri package- default: True+ description: Get Network.URI from the network-uri package+ manual: False+ default: True library- -- Modules exported by the library.- exposed-modules: Data.Connect.Descriptor-- -- Modules included in this library but not exported.- other-modules: Data.Connect.AesonHelpers- , Data.Connect.BaseTypes- , Data.Connect.Conditions- , Data.Connect.Lifecycle- , Data.Connect.Modules- , Data.Connect.OrphanInstances- , Data.Connect.Scopes- , Data.Connect.Webhooks-- -- LANGUAGE extensions used by modules in this package.- -- other-extensions:-- -- Other library packages from which modules are imported.- build-depends: base >=4.6 && <5- , aeson > 0.7.0.3- , text >= 0.11 && <= 1.3- , time-units == 1.*- , cases == 0.1.*- , unordered-containers == 0.2.*-+ exposed-modules:+ Data.Connect.Descriptor+ other-modules:+ Data.Connect.AesonHelpers+ Data.Connect.BaseTypes+ Data.Connect.Conditions+ Data.Connect.Lifecycle+ Data.Connect.Modules+ Data.Connect.OrphanInstances+ Data.Connect.Scopes+ Data.Connect.Webhooks+ Paths_atlassian_connect_descriptor+ hs-source-dirs:+ src+ ghc-options: -Wall+ build-depends:+ aeson >0.7.0.3+ , base >=4.6 && <5+ , cases ==0.1.*+ , text >=0.11 && <=1.3+ , time-units ==1.*+ , unordered-containers ==0.2.* if flag(network-uri)- build-depends: network-uri >= 2.6, network >= 2.6+ build-depends:+ network >=2.6+ , network-uri >=2.6 else- build-depends: network-uri < 2.6, network < 2.6-- -- Directories containing source files.- hs-source-dirs: src-- -- Base language which the package is written in.- default-language: Haskell2010- ghc-options: -Wall--Test-Suite test-descriptor- hs-source-dirs: tests- type: exitcode-stdio-1.0+ build-depends:+ network <2.6+ , network-uri <2.6+ default-language: Haskell2010 +test-suite test-descriptor+ type: exitcode-stdio-1.0 main-is: Main.hs- other-modules: Util- , AssertionHelpers- , ValueExtractors- , ConditionsTest- , ModulesTest- , DescriptorTest-+ other-modules:+ AssertionHelpers+ ConditionsTest+ DescriptorTest+ ModulesTest+ Util+ ValueExtractors+ Paths_atlassian_connect_descriptor+ hs-source-dirs:+ tests+ ghc-options: -Wall build-depends:- base- , atlassian-connect-descriptor- , Cabal >= 1.20+ Cabal >=1.20 , HUnit- , vector , aeson+ , atlassian-connect-descriptor+ , base+ , bytestring+ , cases , scientific , text , time-units- , cases , unordered-containers- , bytestring-+ , vector if flag(network-uri)- build-depends: network-uri >= 2.6, network >= 2.6+ build-depends:+ network >=2.6+ , network-uri >=2.6 else- build-depends: network-uri < 2.6, network < 2.6-- default-language: Haskell2010- ghc-options: -Wall+ build-depends:+ network <2.6+ , network-uri <2.6+ default-language: Haskell2010
src/Data/Connect/Conditions.hs view
@@ -16,6 +16,7 @@ import Data.Connect.AesonHelpers import Data.Connect.OrphanInstances () import GHC.Generics+import qualified Data.Text as T import qualified Data.HashMap.Strict as HM -- | A 'Condition' can be placed on an Atlassian Connect Module to cause it to display or not based on the result it@@ -69,8 +70,10 @@ ] toJSON cc@(CompositeCondition {}) = object [ compositionConditionKey cc .= subConditions cc] +compositionConditionKey :: Condition -> T.Text compositionConditionKey (CompositeCondition _ AndCondition) = "and" compositionConditionKey (CompositeCondition _ OrCondition) = "or"+compositionConditionKey _ = error "This method should not have been passed a non-composite condition" -- | Composite Conditions can be joined together to behave as a single condition. The way that you can join them together -- is decided by the condition type.
src/Data/Connect/Descriptor.hs view
@@ -227,12 +227,14 @@ data ApiMigrations = ApiMigrations { migrationGdpr :: Bool+ , migrationSignedInstall :: Bool } deriving (Show, Generic) instance ToJSON ApiMigrations where- toJSON = genericToJSON baseOptions- { fieldLabelModifier = stripFieldNamePrefix "migration"- }+ toJSON am = object+ [ "gdpr" .= migrationGdpr am+ , "signed-install" .= migrationSignedInstall am+ ] -- | A helper method to generate a bare-bones Atlassian Connect add-on by providing only the absolutely required fields. -- You can then use Haskell record syntax to update the plugin with more details. For example:
tests/DescriptorTest.hs view
@@ -32,7 +32,7 @@ , ("source", toURI "http://bitbucket.org/awesome-devs/connect-addon") ] , scopes = Just [Read, Admin]- , apiMigrations = Just $ ApiMigrations True+ , apiMigrations = Just $ ApiMigrations True True } exampleModules1 :: Modules@@ -85,7 +85,6 @@ basicDescriptorTest :: Test basicDescriptorTest = TestCase $ do let jv = toJSON exampleDescriptor1- BLC.putStrLn . encode $ exampleDescriptor1 isObject jv @? "Expect the descriptor to be one big json object." (getString =<< get "key" jv) `isEqualTo` "my-example-connect" (getString =<< get "baseUrl" jv) `isEqualTo` (T.pack . show $ baseURL)@@ -101,3 +100,4 @@ (getArray =<< get "scopes" jv) `isEqualTo` ["read", "admin"] (not <$> (getBool =<< get "enableLicensing" jv)) @? "Expected licensing to be disabled." (getBool =<< get "gdpr" =<< get "apiMigrations" jv) `isEqualTo` True+ (getBool =<< get "signed-install" =<< get "apiMigrations" jv) `isEqualTo` True