-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54cb8f6
commit 30dead3
Showing
14 changed files
with
125 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/acls/AclOps.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ch.epfl.bluebrain.nexus.ship.acls | ||
|
||
import cats.effect.{Clock, IO} | ||
import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclsImpl | ||
import ch.epfl.bluebrain.nexus.delta.sdk.permissions.model.Permission | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.Transactors | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.config.EventLogConfig | ||
|
||
object AclOps { | ||
|
||
def acls(config: EventLogConfig, clock: Clock[IO], xas: Transactors) = { | ||
val permissionSet = Set(Permission.unsafe("resources/read")) | ||
AclsImpl( | ||
IO.pure(permissionSet), | ||
AclsImpl.findUnknownRealms(xas), | ||
permissionSet, | ||
config, | ||
xas, | ||
clock | ||
) | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/resolvers/ResolverOps.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ch.epfl.bluebrain.nexus.ship.resolvers | ||
|
||
import cats.effect.IO | ||
import cats.effect.kernel.Clock | ||
import ch.epfl.bluebrain.nexus.delta.kernel.utils.UUIDF | ||
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.JsonLdApi | ||
import ch.epfl.bluebrain.nexus.delta.sdk.projects.FetchContext | ||
import ch.epfl.bluebrain.nexus.delta.sdk.resolvers.{ResolverContextResolution, ResolversImpl} | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.Transactors | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.config.EventLogConfig | ||
|
||
object ResolverOps { | ||
|
||
def resolvers(fetchContext: FetchContext, config: EventLogConfig, clock: Clock[IO], xas: Transactors)(implicit | ||
jsonLdApi: JsonLdApi, | ||
uuidF: UUIDF | ||
) = | ||
ResolversImpl( | ||
fetchContext, | ||
// We rely on the parsed values and not on the original value | ||
ResolverContextResolution.never, | ||
config, | ||
xas, | ||
clock | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/schemas/SchemaOps.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package ch.epfl.bluebrain.nexus.ship.schemas | ||
|
||
import cats.effect.{Clock, IO} | ||
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.JsonLdApi | ||
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution | ||
import ch.epfl.bluebrain.nexus.delta.rdf.shacl.ShaclShapesGraph | ||
import ch.epfl.bluebrain.nexus.delta.sdk.schemas.Schemas.SchemaLog | ||
import ch.epfl.bluebrain.nexus.delta.sdk.schemas.{FetchSchema, Schemas, ValidateSchema} | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.{ScopedEventLog, Transactors} | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.config.EventLogConfig | ||
|
||
object SchemaOps { | ||
|
||
def validateSchema(implicit api: JsonLdApi): IO[ValidateSchema] = { | ||
val rcr = RemoteContextResolution.never | ||
ShaclShapesGraph.shaclShaclShapes.map(ValidateSchema(api, _, rcr)) | ||
} | ||
|
||
def schemaLog(config: EventLogConfig, clock: Clock[IO], xas: Transactors)(implicit api: JsonLdApi): IO[SchemaLog] = | ||
for { | ||
validate <- validateSchema | ||
schemaDef = Schemas.definition(validate, clock) | ||
} yield ScopedEventLog(schemaDef, config, xas) | ||
|
||
def fetchSchema(config: EventLogConfig, clock: Clock[IO], xas: Transactors)(implicit | ||
api: JsonLdApi | ||
): IO[FetchSchema] = | ||
for { | ||
log <- schemaLog(config, clock, xas) | ||
} yield FetchSchema(log) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters