mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
begin implementing entityToTempEntity
This commit is contained in:
parent
70ff3105bb
commit
dc26b0bb56
@ -10,58 +10,59 @@ flags:
|
||||
ghc-options: -Wall
|
||||
|
||||
dependencies:
|
||||
- semialign
|
||||
- these
|
||||
- ListLike
|
||||
- aeson
|
||||
- async
|
||||
- base
|
||||
- bytes
|
||||
- bytestring
|
||||
- configurator
|
||||
- containers >= 0.6.3
|
||||
- nonempty-containers
|
||||
- cryptonite
|
||||
- directory
|
||||
- either
|
||||
- errors
|
||||
- extra
|
||||
- filepath
|
||||
- generic-lens
|
||||
- haskeline
|
||||
- http-client >= 0.7.6
|
||||
- http-client-tls
|
||||
- http-types
|
||||
- jwt
|
||||
- lens
|
||||
- lock-file
|
||||
- megaparsec >= 5.0.0 && < 7.0.0
|
||||
- memory
|
||||
- mtl
|
||||
- transformers
|
||||
- network-uri
|
||||
- nonempty-containers
|
||||
- open-browser
|
||||
- random >= 1.2.0
|
||||
- regex-tdfa
|
||||
- semialign
|
||||
- servant
|
||||
- servant-client
|
||||
- stm
|
||||
- text
|
||||
- these
|
||||
- time
|
||||
- transformers
|
||||
- unison-codebase
|
||||
- unison-codebase-sqlite
|
||||
- unison-core1
|
||||
- unison-parser-typechecker
|
||||
- unison-prelude
|
||||
- unison-pretty-printer
|
||||
- unison-share-api
|
||||
- unison-share-api
|
||||
- unison-util
|
||||
- unison-util-base32hex
|
||||
- unison-util-relation
|
||||
- unison-pretty-printer
|
||||
- unison-share-api
|
||||
- unliftio
|
||||
- network-uri
|
||||
- aeson
|
||||
- http-client >= 0.7.6
|
||||
- http-client-tls
|
||||
- http-types
|
||||
- warp
|
||||
- vector
|
||||
- wai
|
||||
- memory
|
||||
- time
|
||||
- lock-file
|
||||
- jwt
|
||||
- either
|
||||
- unison-share-api
|
||||
- servant-client
|
||||
- servant
|
||||
- warp
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
|
@ -18,12 +18,14 @@ import qualified Data.Map.NonEmpty as NEMap
|
||||
import qualified Data.Set as Set
|
||||
import Data.Set.NonEmpty (NESet)
|
||||
import qualified Data.Set.NonEmpty as NESet
|
||||
import qualified Data.Vector as Vector
|
||||
import U.Codebase.HashTags (CausalHash (unCausalHash))
|
||||
import qualified U.Codebase.Sqlite.Branch.Format as NamespaceFormat
|
||||
import qualified U.Codebase.Sqlite.Causal as Causal
|
||||
import U.Codebase.Sqlite.Connection (Connection)
|
||||
import U.Codebase.Sqlite.DbId (BranchHashId, CausalHashId, HashId, ObjectId)
|
||||
import qualified U.Codebase.Sqlite.Decl.Format as DeclFormat
|
||||
import U.Codebase.Sqlite.LocalIds (LocalIds' (..))
|
||||
import qualified U.Codebase.Sqlite.Patch.Format as PatchFormat
|
||||
import qualified U.Codebase.Sqlite.Queries as Q
|
||||
import U.Codebase.Sqlite.TempEntity (TempEntity)
|
||||
@ -481,19 +483,31 @@ insertTempEntity ::
|
||||
insertTempEntity hash entity missingDependencies =
|
||||
Q.insertTempEntity
|
||||
(Share.toBase32Hex hash)
|
||||
tempEntity
|
||||
(entityToTempEntity entity)
|
||||
( NESet.map
|
||||
( \Share.DecodedHashJWT {claims = Share.HashJWTClaims {hash}, hashJWT} ->
|
||||
(Share.toBase32Hex hash, Share.unHashJWT hashJWT)
|
||||
)
|
||||
missingDependencies
|
||||
)
|
||||
|
||||
entityToTempEntity :: Share.Entity Text Share.Hash Share.HashJWT -> TempEntity
|
||||
entityToTempEntity = \case
|
||||
Share.TC (Share.TermComponent terms) ->
|
||||
terms
|
||||
& Vector.fromList
|
||||
& Vector.map (Lens.over Lens._1 mungeLocalIds)
|
||||
& TermFormat.SyncLocallyIndexedComponent
|
||||
& TermFormat.SyncTerm
|
||||
& TempEntity.TC
|
||||
Share.DC _ -> undefined -- (TempEntity.DC _)
|
||||
Share.P _ -> undefined -- (TempEntity.P _)
|
||||
Share.N _ -> undefined -- (TempEntity.N _)
|
||||
Share.C _ -> undefined -- (TempEntity.C _)
|
||||
where
|
||||
tempEntity :: TempEntity
|
||||
tempEntity =
|
||||
case entity of
|
||||
Share.TC _ -> undefined -- (TempEntity.TC _)
|
||||
Share.DC _ -> undefined -- (TempEntity.DC _)
|
||||
Share.P _ -> undefined -- (TempEntity.P _)
|
||||
Share.N _ -> undefined -- (TempEntity.N _)
|
||||
Share.C _ -> undefined -- (TempEntity.C _)
|
||||
mungeLocalIds :: Share.LocalIds Text Share.HashJWT -> LocalIds' Text TempEntity.HashJWT
|
||||
mungeLocalIds Share.LocalIds {texts, hashes} =
|
||||
LocalIds
|
||||
{ textLookup = Vector.fromList texts,
|
||||
defnLookup = Vector.map Share.unHashJWT (Vector.fromList hashes)
|
||||
}
|
||||
|
@ -142,6 +142,7 @@ library
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
, vector
|
||||
, wai
|
||||
, warp
|
||||
if flag(optimized)
|
||||
@ -240,6 +241,7 @@ executable cli-integration-tests
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
, vector
|
||||
, wai
|
||||
, warp
|
||||
if flag(optimized)
|
||||
@ -333,6 +335,7 @@ executable transcripts
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
, vector
|
||||
, wai
|
||||
, warp
|
||||
if flag(optimized)
|
||||
@ -430,6 +433,7 @@ executable unison
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
, vector
|
||||
, wai
|
||||
, warp
|
||||
if flag(optimized)
|
||||
@ -531,6 +535,7 @@ test-suite cli-tests
|
||||
, unison-util-base32hex
|
||||
, unison-util-relation
|
||||
, unliftio
|
||||
, vector
|
||||
, wai
|
||||
, warp
|
||||
if flag(optimized)
|
||||
|
Loading…
Reference in New Issue
Block a user