Skip to content

Commit

Permalink
Update to spicedb head
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Feb 4, 2025
1 parent df339c4 commit 49a926e
Show file tree
Hide file tree
Showing 18 changed files with 11 additions and 123 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@ temp/
# Local-only files
go.work
go.work.sum

go.work
go.work.sum

go.work
go.work.sum
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2
github.com/authzed/authzed-go v1.3.0
github.com/authzed/grpcutil v0.0.0-20240123194739-2ea1e3d2d98b
github.com/authzed/spicedb v1.40.0
github.com/authzed/spicedb v1.40.1-0.20250203174657-98e88a128ae5
github.com/brianvoe/gofakeit/v6 v6.28.0
github.com/ccoveille/go-safecast v1.5.0
github.com/cenkalti/backoff/v4 v4.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,8 @@ github.com/authzed/consistent v0.1.0 h1:tlh1wvKoRbjRhMm2P+X5WQQyR54SRoS4MyjLOg17
github.com/authzed/consistent v0.1.0/go.mod h1:plwHlrN/EJUCwQ+Bca0MhM1KnisPs7HEkZI5giCXrcc=
github.com/authzed/grpcutil v0.0.0-20240123194739-2ea1e3d2d98b h1:wbh8IK+aMLTCey9sZasO7b6BWLAJnHHvb79fvWCXwxw=
github.com/authzed/grpcutil v0.0.0-20240123194739-2ea1e3d2d98b/go.mod h1:s3qC7V7XIbiNWERv7Lfljy/Lx25/V1Qlexb0WJuA8uQ=
github.com/authzed/spicedb v1.40.0 h1:VcYmSZEHNjZXmEI+VIn1qDP8SgeFTFbZuW7UilYj3ns=
github.com/authzed/spicedb v1.40.0/go.mod h1:/UVC4ZJkMUZFN4MVjjOLAU7m/fqitkBP57ZPffyicOs=
github.com/authzed/spicedb v1.40.1-0.20250203174657-98e88a128ae5 h1:3BcKukzgDYDwyUKiYn8b6nxgSZBrDfd4eHvfz15+Sos=
github.com/authzed/spicedb v1.40.1-0.20250203174657-98e88a128ae5/go.mod h1:/UVC4ZJkMUZFN4MVjjOLAU7m/fqitkBP57ZPffyicOs=
github.com/aws/aws-sdk-go-v2 v1.32.7 h1:ky5o35oENWi0JYWUZkB7WYvVPP+bcRF5/Iq7JWSb5Rw=
github.com/aws/aws-sdk-go-v2 v1.32.7/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U=
github.com/aws/aws-sdk-go-v2/config v1.28.7 h1:GduUnoTXlhkgnxTD93g1nv4tVPILbdNQOzav+Wpg7AE=
Expand Down
18 changes: 8 additions & 10 deletions internal/cmd/preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"

newcompiler "github.com/authzed/spicedb/pkg/composableschemadsl/compiler"
Expand All @@ -26,6 +25,7 @@ func registerPreviewCmd(rootCmd *cobra.Command) {
previewCmd.AddCommand(schemaCmd)

schemaCmd.AddCommand(schemaCompileCmd)
schemaCompileCmd.Flags().String("out", "", "output filepath; omitting writes to stdout")
}

var previewCmd = &cobra.Command{
Expand All @@ -42,16 +42,19 @@ var schemaCompileCmd = &cobra.Command{
Use: "compile <file>",
Args: cobra.ExactArgs(1),
Short: "Compile a schema that uses extended syntax into one that can be written to SpiceDB",
// TODO: add longer example
// TODO: is this correct?
Example: `
Write to stdout:
zed preview schema compile root.zed
Write to an output file:
zed preview schema compile --out compiled.zed
`,
ValidArgsFunction: commands.FileExtensionCompletions("zed"),
RunE: schemaCompileCmdFunc,
}

// Compiles an input schema written in the new composable schema syntax
// and produces it as a fully-realized schema
func schemaCompileCmdFunc(cmd *cobra.Command, args []string) error {
// TODO: should we maintain the validate semantics where you can provide any URL?
stdOutFd, err := safecast.ToInt(uint(os.Stdout.Fd()))
if err != nil {
return err
Expand All @@ -61,12 +64,7 @@ func schemaCompileCmdFunc(cmd *cobra.Command, args []string) error {
return fmt.Errorf("must provide stdout or output file path")
}

relativeInputFilepath := args[0]
cwd, err := os.Getwd()
if err != nil {
return err
}
inputFilepath := path.Join(cwd, relativeInputFilepath)
inputFilepath := args[0]
inputSourceFolder := filepath.Dir(inputFilepath)
var schemaBytes []byte
schemaBytes, err = os.ReadFile(inputFilepath)
Expand Down
6 changes: 0 additions & 6 deletions temp/blah.zed

This file was deleted.

15 changes: 0 additions & 15 deletions temp/folder/four.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions temp/folder/one.zed

This file was deleted.

7 changes: 0 additions & 7 deletions temp/folder/subfolder/five.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions temp/folder/three.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions temp/folder/two.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions temp/schemas/blah.zed

This file was deleted.

6 changes: 0 additions & 6 deletions temp/schemas/folder/root.zed

This file was deleted.

1 change: 0 additions & 1 deletion temp/schemas/folder/user.zed

This file was deleted.

11 changes: 0 additions & 11 deletions temp/schemas/out.zed

This file was deleted.

7 changes: 0 additions & 7 deletions temp/schemas/root.zed

This file was deleted.

11 changes: 0 additions & 11 deletions temp/schemas/somethingelse.zed

This file was deleted.

6 changes: 0 additions & 6 deletions temp/schemas/subjects.zed

This file was deleted.

1 change: 0 additions & 1 deletion temp/schemas/user.zed

This file was deleted.

0 comments on commit 49a926e

Please sign in to comment.