server: move ordered Aeson into its own package

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4939
GitOrigin-RevId: 62e83ae7c69f4e0a5334cf1e0c85c22a5d378f59
This commit is contained in:
Jesse Hallett 2022-07-07 11:54:32 -04:00 committed by hasura-bot
parent 967f4047ac
commit f4328c3076
8 changed files with 164 additions and 4 deletions

View File

@ -96,3 +96,5 @@ source-repository-package
location: https://github.com/hasura/text.git
tag: 874c3164fadf39a83382359d2b6ce941a3e134da
packages: server/lib/*/*.cabal

View File

@ -10,4 +10,8 @@ cradle:
component: "graphql-engine:bench:cache"
- path: "server/tests-hspec"
component: "graphql-engine:test:tests-hspec"
- path: "server/src-emit-metadata-openapi"
component: "graphql-engine:exe:emit-metadata-openapi"
- path: "server/lib/aeson-ordered/src"
component: "lib:aeson-ordered"

View File

@ -139,6 +139,7 @@ common lib-depends
build-depends: Spock-core
, aeson
, aeson-casing
, aeson-ordered
, attoparsec
, attoparsec-iso8601 >= 1.0
, autodocodec
@ -393,7 +394,6 @@ library
, Control.Monad.Unique
, Data.Aeson.Extended
, Data.Aeson.KeyMap.Extended
, Data.Aeson.Ordered
, Data.Environment
, Data.HashMap.Strict.Extended
, Data.HashMap.Strict.Multi

View File

@ -0,0 +1,5 @@
# Revision history for aeson-ordered
## 0.1.0.0 -- 2022-07-30
* First version. Released on an unsuspecting world.

View File

@ -0,0 +1,32 @@
Copyright (c) 2011 MailRank, Inc.
Copyright (c) 2014-2021 Aeson project contributors
Copyright (c) 2022 Hasura Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of his contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,59 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.34.7.
--
-- see: https://github.com/sol/hpack
name: aeson-ordered
version: 0.1.0.0
description: Provides a data type that mirrors Aeson's 'Value', but that preserves order of object properties using an insertion-ordered map.
homepage: https://github.com/hasura/github-engine-mono#readme
bug-reports: https://github.com/hasura/github-engine-mono/issues
author: Anon Ray <anon@hasura.io>,
Bryan O'Sullivan <bos@serpentine.com>,
MailRank, Inc.
maintainer: Anon Ray <anon@hasura.io>,
Bryan O'Sullivan <bos@serpentine.com>,
MailRank, Inc.
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
CHANGELOG.md
LICENSE
source-repository head
type: git
location: https://github.com/hasura/github-engine-mono
library
exposed-modules:
Data.Aeson.Ordered
other-modules:
Paths_aeson_ordered
hs-source-dirs:
src
default-extensions:
BangPatterns
DeriveDataTypeable
DeriveGeneric
DerivingStrategies
GeneralizedNewtypeDeriving
ImportQualifiedPost
LambdaCase
OverloadedStrings
StrictData
ghc-options: -foptimal-applicative-do -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
build-depends:
aeson
, attoparsec
, base
, bytestring
, hashable
, insert-ordered-containers
, lens
, lens-aeson
, scientific
, text
, vector
default-language: Haskell2010

View File

@ -0,0 +1,52 @@
spec-version: 0.34.7
name: aeson-ordered
description: >
Provides a data type that mirrors Aeson's 'Value', but that preserves order of
object properties using an insertion-ordered map.
version: 0.1.0.0
author:
- Anon Ray <anon@hasura.io>
- Bryan O'Sullivan <bos@serpentine.com>
- MailRank, Inc.
license: BSD3
github: hasura/github-engine-mono
extra-source-files:
- CHANGELOG.md
- LICENSE
ghc-options:
- "-foptimal-applicative-do"
- "-Wall"
- "-Wcompat"
- "-Wincomplete-record-updates"
- "-Wincomplete-uni-patterns"
- "-Wredundant-constraints"
default-extensions:
- BangPatterns
- DeriveDataTypeable
- DeriveGeneric
- DerivingStrategies
- GeneralizedNewtypeDeriving
- ImportQualifiedPost
- LambdaCase
- OverloadedStrings
- StrictData
library:
source-dirs:
- src
dependencies:
- base
- aeson
- attoparsec
- bytestring
- hashable
- insert-ordered-containers
- lens
- lens-aeson
- scientific
- text
- vector

View File

@ -3,6 +3,7 @@
-- | A version of aeson that parses with key order preserved.
--
-- Copyright:
-- (c) 2022 Hasura Inc.
-- (c) 2011-2016 Bryan O'Sullivan
-- (c) 2011 MailRank, Inc.
module Data.Aeson.Ordered
@ -28,7 +29,7 @@ module Data.Aeson.Ordered
)
where
import Control.Applicative hiding (empty)
import Control.Applicative ()
import Control.Lens (prism)
import Data.Aeson qualified as J
import Data.Aeson.Key qualified as K
@ -41,14 +42,19 @@ import Data.Attoparsec.ByteString.Char8 qualified as A8
import Data.Bifunctor (bimap, second)
import Data.ByteString (ByteString)
import Data.ByteString.Lazy qualified as L
import Data.Data (Typeable)
import Data.Data (Data, Typeable)
import Data.Functor (($>))
import Data.HashMap.Strict.InsOrd (InsOrdHashMap)
import Data.HashMap.Strict.InsOrd qualified as OMap
import Data.Hashable (Hashable (..))
import Data.List (foldl')
import Data.Scientific (Scientific)
import Data.String (IsString)
import Data.Text (Text)
import Data.Text qualified as T
import Data.Vector (Vector)
import Data.Vector qualified as V
import Hasura.Prelude hiding (empty, first, second)
import GHC.Generics (Generic)
--------------------------------------------------------------------------------
-- Copied constants from aeson