refactor: move session package to pkg directory

This commit is contained in:
Prad Nukala 2024-12-11 12:07:39 -05:00
parent 0e0a46741f
commit 40f50bf37a
15 changed files with 16 additions and 18 deletions

View File

@ -9,10 +9,10 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware" "github.com/labstack/echo/v4/middleware"
"github.com/onsonr/sonr/crypto/ucan" "github.com/onsonr/sonr/crypto/ucan"
"github.com/onsonr/sonr/internal/database/sessions"
"github.com/onsonr/sonr/internal/gateway" "github.com/onsonr/sonr/internal/gateway"
"github.com/onsonr/sonr/internal/gateway/config" "github.com/onsonr/sonr/internal/gateway/config"
"github.com/onsonr/sonr/pkg/common/ipfs" "github.com/onsonr/sonr/pkg/common/ipfs"
"github.com/onsonr/sonr/pkg/database/sessions"
"github.com/onsonr/sonr/pkg/didauth/producer" "github.com/onsonr/sonr/pkg/didauth/producer"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )

View File

@ -5,8 +5,8 @@ import (
"strings" "strings"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/database/sessions"
"github.com/onsonr/sonr/pkg/common" "github.com/onsonr/sonr/pkg/common"
"github.com/onsonr/sonr/pkg/database/sessions"
"github.com/segmentio/ksuid" "github.com/segmentio/ksuid"
) )

View File

@ -4,8 +4,8 @@ import (
"net/http" "net/http"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/database/sessions"
"github.com/onsonr/sonr/internal/gateway/config" "github.com/onsonr/sonr/internal/gateway/config"
"github.com/onsonr/sonr/pkg/database/sessions"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -2,7 +2,7 @@ package context
import ( import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/database/sessions" "github.com/onsonr/sonr/pkg/database/sessions"
) )
// ╭───────────────────────────────────────────────────────╮ // ╭───────────────────────────────────────────────────────╮

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. // Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types package config
type Config struct { type Config struct {
IpfsGatewayUrl string `pkl:"ipfsGatewayUrl" json:"ipfsGatewayUrl,omitempty"` IpfsGatewayUrl string `pkl:"ipfsGatewayUrl" json:"ipfsGatewayUrl,omitempty"`

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. // Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types package config
import ( import (
"context" "context"

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. // Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types package config
type Environment struct { type Environment struct {
IsDevelopment bool `pkl:"isDevelopment" json:"isDevelopment,omitempty"` IsDevelopment bool `pkl:"isDevelopment" json:"isDevelopment,omitempty"`

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. // Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types package config
type Schema struct { type Schema struct {
Version int `pkl:"version"` Version int `pkl:"version"`

View File

@ -5,7 +5,6 @@ import (
"github.com/ipfs/boxo/files" "github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/internal/vault/embed" "github.com/onsonr/sonr/internal/vault/embed"
"github.com/onsonr/sonr/internal/vault/types"
) )
const SchemaVersion = 1 const SchemaVersion = 1
@ -18,7 +17,7 @@ const (
) )
// spawnVaultDirectory creates a new directory with the default files // spawnVaultDirectory creates a new directory with the default files
func NewFS(cfg *types.Config) (files.Directory, error) { func NewVaultFS(cfg *Config) (files.Directory, error) {
manifestBz, err := newWebManifestBytes() manifestBz, err := newWebManifestBytes()
if err != nil { if err != nil {
return nil, err return nil, err
@ -36,9 +35,9 @@ func NewFS(cfg *types.Config) (files.Directory, error) {
}), nil }), nil
} }
// GetVaultConfig returns the default vault config // NewVaultConfig returns the default vault config
func GetVaultConfig(addr string, ucanCID string) *types.Config { func NewVaultConfig(addr string, ucanCID string) *Config {
return &types.Config{ return &Config{
MotrToken: ucanCID, MotrToken: ucanCID,
MotrAddress: addr, MotrAddress: addr,
IpfsGatewayUrl: "http://localhost:80", IpfsGatewayUrl: "http://localhost:80",

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. // Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types package config
import "github.com/apple/pkl-go/pkl" import "github.com/apple/pkl-go/pkl"

View File

@ -4,13 +4,12 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/onsonr/sonr/internal/vault/types"
"github.com/onsonr/sonr/pkg/common/models" "github.com/onsonr/sonr/pkg/common/models"
) )
// DefaultSchema returns the default schema // DefaultSchema returns the default schema
func DefaultSchema() *types.Schema { func DefaultSchema() *Schema {
return &types.Schema{ return &Schema{
Version: SchemaVersion, Version: SchemaVersion,
Account: getSchema(&models.Account{}), Account: getSchema(&models.Account{}),
Asset: getSchema(&models.Asset{}), Asset: getSchema(&models.Asset{}),

View File

@ -1,4 +1,4 @@
@go.Package { name = "github.com/onsonr/sonr/internal/vault/types" } @go.Package { name = "github.com/onsonr/sonr/internal/vault/config" }
module sonr.motr.DWN module sonr.motr.DWN