Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.6 -> main #988

Merged
merged 50 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2005f5a
add grant completion
massimosiani Jun 3, 2023
1f5877f
add revoke
massimosiani Jun 3, 2023
fb73b67
Merge pull request #886 from massimosiani/completion-grant
mpilquist Aug 21, 2023
b7b83a6
Update sbt-typelevel, sbt-typelevel-site to 0.5.0 in series/0.6.x
typelevel-steward[bot] Aug 23, 2023
8dbe3fa
Merge pull request #960 from typelevel/update/series/0.6.x/sbt-typele…
armanbilge Aug 23, 2023
547faf0
Update sbt to 1.9.4 in series/0.6.x
typelevel-steward[bot] Aug 25, 2023
2f58a9a
Update epollcat to 0.1.6 in series/0.6.x
typelevel-steward[bot] Aug 28, 2023
a9dd559
Merge pull request #963 from typelevel/update/series/0.6.x/epollcat-0…
armanbilge Aug 28, 2023
5eee908
Update scalafmt-core to 3.7.13 in series/0.6.x
typelevel-steward[bot] Aug 28, 2023
e9e8bcd
Merge pull request #964 from typelevel/update/series/0.6.x/scalafmt-c…
armanbilge Aug 29, 2023
cebb288
Merge pull request #962 from typelevel/update/series/0.6.x/sbt-1.9.4
armanbilge Aug 29, 2023
219e6d6
Update fs2-core, fs2-io to 3.9.0 in series/0.6.x
typelevel-steward[bot] Aug 30, 2023
0b3ee9e
Fix deprecation
armanbilge Aug 30, 2023
2b34635
Merge pull request #965 from typelevel/update/series/0.6.x/fs2-core-3…
armanbilge Aug 30, 2023
5a35c7b
Update fs2-core, fs2-io to 3.9.1 in series/0.6.x
typelevel-steward[bot] Aug 31, 2023
71f210b
Update circe-core, circe-parser to 0.14.6 in series/0.6.x
typelevel-steward[bot] Aug 31, 2023
bda635a
Update scalafmt-core to 3.7.14 in series/0.6.x
typelevel-steward[bot] Sep 1, 2023
6788a67
Merge pull request #968 from typelevel/update/series/0.6.x/scalafmt-c…
armanbilge Sep 2, 2023
88b7363
Merge pull request #966 from typelevel/update/series/0.6.x/fs2-core-3…
armanbilge Sep 2, 2023
0d729c1
Merge pull request #967 from typelevel/update/series/0.6.x/circe-core…
armanbilge Sep 2, 2023
1853da6
Update nscplugin, sbt-scala-native, ... to 0.4.15 in series/0.6.x
typelevel-steward[bot] Sep 5, 2023
f0511ae
Use `atUnsafe`
armanbilge Sep 5, 2023
3858d85
Merge pull request #969 from typelevel/update/series/0.6.x/nscplugin-…
armanbilge Sep 5, 2023
7fa51d1
Update scala3-library, ... to 3.3.1 in series/0.6.x
typelevel-steward[bot] Sep 7, 2023
e20c0b4
Merge pull request #970 from typelevel/update/series/0.6.x/scala3-lib…
armanbilge Sep 7, 2023
6a623a6
Update sbt-scoverage to 2.0.9 in series/0.6.x
typelevel-steward[bot] Sep 8, 2023
165f045
Merge pull request #971 from typelevel/update/series/0.6.x/sbt-scover…
armanbilge Sep 8, 2023
1db8aee
Update sbt-typelevel, sbt-typelevel-site to 0.5.1 in series/0.6.x
typelevel-steward[bot] Sep 11, 2023
58c01b7
Run prePR with sbt-typelevel
typelevel-steward[bot] Sep 11, 2023
4e38720
Merge pull request #972 from typelevel/update/series/0.6.x/sbt-typele…
armanbilge Sep 11, 2023
e0a4917
Update scala-library to 2.13.12 in series/0.6.x
typelevel-steward[bot] Sep 11, 2023
e61b971
Add explicit types
armanbilge Sep 11, 2023
f814a0f
Merge pull request #973 from typelevel/update/series/0.6.x/scala-libr…
armanbilge Sep 11, 2023
40f2c66
Update sbt-typelevel, sbt-typelevel-site to 0.5.2 in series/0.6.x
typelevel-steward[bot] Sep 11, 2023
03bee84
Restore package object
armanbilge Sep 11, 2023
eeb39e3
Unused import
armanbilge Sep 11, 2023
e060a15
Merge pull request #975 from typelevel/update/series/0.6.x/sbt-typele…
armanbilge Sep 11, 2023
621384a
Update fs2-core, fs2-io to 3.9.2 in series/0.6.x
typelevel-steward[bot] Sep 12, 2023
66adaa4
Merge pull request #976 from typelevel/update/series/0.6.x/fs2-core-3…
armanbilge Sep 12, 2023
e303d94
Update sbt to 1.9.6 in series/0.6.x
typelevel-steward[bot] Sep 15, 2023
cd84f94
Merge pull request #981 from typelevel/update/series/0.6.x/sbt-1.9.6
armanbilge Sep 15, 2023
2814588
Update junit-interface, munit to 1.0.0-M10 in series/0.6.x
typelevel-steward[bot] Sep 15, 2023
fca5aba
Update sbt-typelevel, sbt-typelevel-site to 0.5.3 in series/0.6.x
typelevel-steward[bot] Sep 15, 2023
65c169b
Update sbt-scalajs, scalajs-compiler, ... to 1.14.0 in series/0.6.x
typelevel-steward[bot] Sep 26, 2023
93f4973
Merge pull request #985 from typelevel/update/series/0.6.x/sbt-scalaj…
armanbilge Sep 26, 2023
6b8f2a6
Update cats-effect to 3.5.2 in series/0.6.x
typelevel-steward[bot] Sep 28, 2023
c8c26ee
Merge pull request #986 from typelevel/update/series/0.6.x/cats-effec…
armanbilge Sep 28, 2023
2651423
Merge pull request #982 from typelevel/update/series/0.6.x/junit-inte…
armanbilge Oct 4, 2023
8736cd6
Merge pull request #983 from typelevel/update/series/0.6.x/sbt-typele…
armanbilge Oct 4, 2023
646171d
Merge branch 'series/0.6.x'
armanbilge Oct 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
timeout-minutes: 60
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -308,12 +308,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
scala: [2.13.12]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "3.7.12"
version = "3.7.14"
runner.dialect = Scala213Source3
project.includePaths = [] # disables formatting
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ThisBuild / tlBaseVersion := "1.0"

// Our Scala versions.
lazy val `scala-2.13` = "2.13.11"
lazy val `scala-3` = "3.3.0"
lazy val `scala-2.13` = "2.13.12"
lazy val `scala-3` = "3.3.1"

ThisBuild / scalaVersion := `scala-2.13`
ThisBuild / crossScalaVersions := Seq(`scala-2.13`, `scala-3`)
Expand Down Expand Up @@ -57,7 +57,7 @@ ThisBuild / mimaBinaryIssueFilters ++= List(
)

// This is used in a couple places
lazy val fs2Version = "3.8.0"
lazy val fs2Version = "3.9.2"
lazy val openTelemetryVersion = "1.29.0"
lazy val otel4sVersion = "0.2.1"

Expand Down Expand Up @@ -109,7 +109,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
description := "Tagless, non-blocking data access library for Postgres.",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.10.0",
"org.typelevel" %%% "cats-effect" % "3.5.1",
"org.typelevel" %%% "cats-effect" % "3.5.2",
"co.fs2" %%% "fs2-core" % fs2Version,
"co.fs2" %%% "fs2-io" % fs2Version,
"org.scodec" %%% "scodec-bits" % "1.1.37",
Expand Down Expand Up @@ -153,8 +153,8 @@ lazy val circe = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.settings(
name := "skunk-circe",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % "0.14.5",
"io.circe" %%% "circe-parser" % "0.14.5"
"io.circe" %%% "circe-core" % "0.14.6",
"io.circe" %%% "circe-parser" % "0.14.6"
)
)

Expand All @@ -167,8 +167,8 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.settings(
tlFatalWarnings := false,
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % "1.0.0-M8",
"org.scalameta" % "junit-interface" % "1.0.0-M8",
"org.scalameta" %%% "munit" % "1.0.0-M10",
"org.scalameta" % "junit-interface" % "1.0.0-M10",
"org.typelevel" %%% "scalacheck-effect-munit" % "2.0.0-M2",
"org.typelevel" %%% "munit-cats-effect" % "2.0.0-M3",
"org.typelevel" %%% "cats-free" % "2.10.0",
Expand Down Expand Up @@ -201,7 +201,7 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform, NativePlatform)
)
.nativeEnablePlugins(ScalaNativeBrewedConfigPlugin)
.nativeSettings(
libraryDependencies += "com.armanbilge" %%% "epollcat" % "0.1.5",
libraryDependencies += "com.armanbilge" %%% "epollcat" % "0.1.6",
Test / nativeBrewFormulas ++= Set("s2n", "utf8proc"),
Test / envVars ++= Map("S2N_DONT_MLOCK" -> "1")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ private[message] trait PasswordMessagePlatform {
// First round
if (EVP_DigestInit_ex(ctx, `type`, null) != 1)
throw new RuntimeException("EVP_DigestInit_ex")
if (EVP_DigestUpdate(ctx, password.getBytes.at(0), password.length.toULong) != 1)
if (EVP_DigestUpdate(ctx, password.getBytes.atUnsafe(0), password.length.toULong) != 1)
throw new RuntimeException("EVP_DigestUpdate")
if (EVP_DigestUpdate(ctx, user.getBytes.at(0), user.length.toULong) != 1)
if (EVP_DigestUpdate(ctx, user.getBytes.atUnsafe(0), user.length.toULong) != 1)
throw new RuntimeException("EVP_DigestUpdate")
if (EVP_DigestFinal_ex(ctx, md.at(0), size) != 1)
if (EVP_DigestFinal_ex(ctx, md.atUnsafe(0), size) != 1)
throw new RuntimeException("EVP_DigestFinal_ex")
var hex = BigInt(1, md.take((!size).toInt)).toString(16)
while (hex.length < 32)
Expand All @@ -48,11 +48,11 @@ private[message] trait PasswordMessagePlatform {
// Second round
if (EVP_DigestInit_ex(ctx, `type`, null) != 1)
throw new RuntimeException("EVP_DigestInit_ex")
if (EVP_DigestUpdate(ctx, hex.getBytes.at(0), 32.toULong) != 1)
if (EVP_DigestUpdate(ctx, hex.getBytes.atUnsafe(0), 32.toULong) != 1)
throw new RuntimeException("EVP_DigestUpdate")
if (EVP_DigestUpdate(ctx, salt.at(0), salt.length.toULong) != 1)
if (EVP_DigestUpdate(ctx, salt.atUnsafe(0), salt.length.toULong) != 1)
throw new RuntimeException("EVP_DigestUpdate")
if (EVP_DigestFinal_ex(ctx, md.at(0), size) != 1)
if (EVP_DigestFinal_ex(ctx, md.atUnsafe(0), size) != 1)
throw new RuntimeException("EVP_DigestFinal_ex")
hex = BigInt(1, md.take((!size).toInt)).toString(16)
while (hex.length < 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private[message] trait ScramPlatform { this: Scram.type =>

def clientFirstBareWithRandomNonce: ByteVector = {
val buf = new Array[Byte](32)
if (RAND_bytes(buf.at(0), 32) != 1)
if (RAND_bytes(buf.atUnsafe(0), 32) != 1)
throw new RuntimeException("RAND_bytes")
val nonce = ByteVector.view(buf).toBase64
clientFirstBareWithNonce(nonce)
Expand All @@ -27,7 +27,7 @@ private[message] trait ScramPlatform { this: Scram.type =>
throw new RuntimeException("EVP_get_digestbyname")
val md = new Array[Byte](EVP_MAX_MD_SIZE)
val mdLen = stackalloc[CUnsignedInt]()
if (openssl.HMAC(evpMd, key.toArrayUnsafe.at(0), key.size.toInt, str.toArrayUnsafe.at(0), str.size.toULong, md.at(0), mdLen) == null)
if (openssl.HMAC(evpMd, key.toArrayUnsafe.atUnsafe(0), key.size.toInt, str.toArrayUnsafe.atUnsafe(0), str.size.toULong, md.atUnsafe(0), mdLen) == null)
throw new RuntimeException("HMAC")
ByteVector.view(md, 0, (!mdLen).toInt)
}
Expand All @@ -38,7 +38,7 @@ private[message] trait ScramPlatform { this: Scram.type =>
val `type` = EVP_get_digestbyname(c"SHA256")
if (`type` == null)
throw new RuntimeException("EVP_get_digestbyname")
if (EVP_Digest(input.toArrayUnsafe.at(0), input.size.toULong, md.at(0), size, `type`, null) != 1)
if (EVP_Digest(input.toArrayUnsafe.atUnsafe(0), input.size.toULong, md.atUnsafe(0), size, `type`, null) != 1)
throw new RuntimeException("EVP_Digest")
ByteVector.view(md, 0, (!size).toInt)
}
Expand All @@ -48,7 +48,7 @@ private[message] trait ScramPlatform { this: Scram.type =>
if (digest == null)
throw new RuntimeException("EVP_get_digestbyname")
val out = new Array[Byte](32)
if (PKCS5_PBKDF2_HMAC(str.getBytes.at(0), str.length, salt.toArrayUnsafe.at(0), salt.size.toInt, iterations, digest, 32, out.at(0)) != 1)
if (PKCS5_PBKDF2_HMAC(str.getBytes.atUnsafe(0), str.length, salt.toArrayUnsafe.atUnsafe(0), salt.size.toInt, iterations, digest, 32, out.atUnsafe(0)) != 1)
throw new RuntimeException("PKCS5_PBKDF2_HMAC")
ByteVector.view(out)
}
Expand Down
2 changes: 1 addition & 1 deletion modules/core/shared/src/main/scala/PreparedQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object PreparedQuery {
Stream.resource(proto.bind(args, or)).flatMap { cursor =>
def chunks: Stream[F, B] =
Stream.eval(cursor.execute(chunkSize)).flatMap { case (bs, more) =>
val s = Stream.chunk(Chunk.seq(bs))
val s = Stream.chunk(Chunk.from(bs))
if (more) s ++ chunks
else s
}
Expand Down
2 changes: 2 additions & 0 deletions modules/core/shared/src/main/scala/data/Completion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ object Completion {
case object DropTrigger extends Completion
case object SetConstraints extends Completion
case object Explain extends Completion
case object Grant extends Completion
case object Revoke extends Completion
// more ...

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ object CommandComplete {
case Patterns.Copy(s) => apply(Completion.Copy(s.toInt))
case "SET CONSTRAINTS" => apply(Completion.SetConstraints)
case "EXPLAIN" => apply(Completion.Explain)
case "GRANT" => apply(Completion.Grant)
case "REVOKE" => apply(Completion.Revoke)
// more .. fill in as we hit them

case s => apply(Completion.Unknown(s))
Expand Down
6 changes: 1 addition & 5 deletions modules/core/shared/src/main/scala/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT

package skunk

import cats.effect.Resource
import org.typelevel.scalaccompat.annotation._
import org.typelevel.twiddles.TwiddleCompat

/**
Expand Down Expand Up @@ -126,8 +123,7 @@ import org.typelevel.twiddles.TwiddleCompat
* @groupname Companions Companion Objects
* @groupprio Companions 999
*/
@nowarn213("msg=package object inheritance is deprecated")
object `package` extends TwiddleCompat { // aka package object skunk, yes this actually works ...
package object skunk extends TwiddleCompat {

// we can use this to defeat value discarding warnings for erasable proof terms
private[skunk] def void(a: Any*): Unit = (a, ())._2
Expand Down
4 changes: 2 additions & 2 deletions modules/core/shared/src/main/scala/util/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object Typer {
val Static: Typer = new Typer {
import Type._

val strategy = Strategy.BuiltinsOnly
val strategy: Strategy = Strategy.BuiltinsOnly

val staticByOid: Map[Int, Type] =
Map(
Expand Down Expand Up @@ -232,7 +232,7 @@ object Typer {
(p.typeInfoMap, p.relInfoMap).mapN { (tim, rim) =>
Static orElse new Typer {

val strategy = Strategy.SearchPath
val strategy: Strategy = Strategy.SearchPath

val nameToOid: Map[String, Int] =
tim.map { case (k, v) => v.name -> k }
Expand Down
26 changes: 26 additions & 0 deletions modules/tests/shared/src/test/scala/CommandTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ class CommandTest extends SkunkTest {
ON city;
""".command

val grant: Command[Void] =
sql"""
GRANT ALL PRIVILEGES
ON ALL TABLES IN SCHEMA public
TO skunk_role
""".command

val revoke: Command[Void] =
sql"""
REVOKE ALL PRIVILEGES
ON ALL TABLES IN SCHEMA public
FROM skunk_role
""".command

sessionTest("create table, create index, drop index, alter table and drop table") { s =>
for {
c <- s.execute(createTable)
Expand Down Expand Up @@ -545,4 +559,16 @@ class CommandTest extends SkunkTest {
.as("ok")
}

sessionTest("grant, revoke") { s =>
for{
_ <- s.execute(createRole)
c <- s.execute(grant)
_ <- assert("completion", c == Completion.Grant)
c <- s.execute(revoke)
_ <- assert("completion", c == Completion.Revoke)
_ <- s.execute(dropRole)
_ <- s.assertHealthy
} yield "ok"
}

}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.3
sbt.version=1.9.6
10 changes: 5 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ ThisBuild / libraryDependencySchemes ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
)

addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.5.0-RC12")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.5.0-RC12")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.5.3")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.5.3")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15")
addSbtPlugin("com.armanbilge" % "sbt-scala-native-config-brew-github-actions" % "0.2.0-RC1")