From 0502f52ec061fd6d48d97abfc6b08d55fe813263 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Wed, 11 Dec 2024 12:21:52 -0500 Subject: [PATCH] refactor: migrate to new configuration system and model definitions --- Makefile | 16 +- cmd/hway/cmds.go | 8 +- crypto/ucan/attns/{ATN.pkl.go => UCAN.pkl.go} | 14 +- .../ucan/attns/capability/Capability.pkl.go | 2 +- crypto/ucan/attns/init.pkl.go | 4 +- .../ucan/attns/policytype/PolicyType.pkl.go | 2 +- .../attns/resourcetype/ResourceType.pkl.go | 2 +- internal/gateway/config/init.pkl.go | 8 - internal/vault/config/init.pkl.go | 11 - internal/vault/context/middleware.go | 6 +- internal/vault/{config => embed}/fs.go | 16 +- internal/vault/{config => embed}/manifest.go | 2 +- internal/vault/{config => embed}/schema.go | 7 +- pkg/common/models/Account.pkl.go | 2 +- pkg/common/models/Asset.pkl.go | 2 +- pkg/common/models/Chain.pkl.go | 2 +- pkg/common/models/Credential.pkl.go | 2 +- pkg/common/models/DID.pkl.go | 2 +- pkg/common/models/Grant.pkl.go | 2 +- pkg/common/models/JWK.pkl.go | 2 +- pkg/common/models/Keyshare.pkl.go | 2 +- .../models/{ORM.pkl.go => Models.pkl.go} | 14 +- pkg/common/models/Profile.pkl.go | 2 +- pkg/common/models/assettype/AssetType.pkl.go | 2 +- pkg/common/models/didmethod/DIDMethod.pkl.go | 2 +- pkg/common/models/init.pkl.go | 22 +- .../models/keyalgorithm/KeyAlgorithm.pkl.go | 2 +- pkg/common/models/keycurve/KeyCurve.pkl.go | 2 +- .../models/keyencoding/KeyEncoding.pkl.go | 2 +- pkg/common/models/keyrole/KeyRole.pkl.go | 2 +- .../models/keysharerole/KeyShareRole.pkl.go | 2 +- pkg/common/models/keytype/KeyType.pkl.go | 2 +- .../permissiongrant/PermissionGrant.pkl.go | 2 +- .../permissionscope/PermissionScope.pkl.go | 2 +- {internal/gateway => pkg}/config/env.go | 13 +- .../Env.pkl.go => pkg/config/hway/Hway.pkl.go | 36 +-- pkg/config/hway/init.pkl.go | 8 + .../config => pkg/config/motr}/Config.pkl.go | 4 +- .../config/motr}/Environment.pkl.go | 4 +- .../DWN.pkl.go => pkg/config/motr/Motr.pkl.go | 16 +- .../config => pkg/config/motr}/Schema.pkl.go | 4 +- pkg/config/motr/init.pkl.go | 11 + pkl/ipfs.net/Config.pkl | 275 ------------------ pkl/ipfs.net/PklProject | 22 -- pkl/{sonr.hway/Env.pkl => sonr.conf/Hway.pkl} | 4 +- pkl/{sonr.motr/DWN.pkl => sonr.conf/Motr.pkl} | 4 +- pkl/{sonr.motr => sonr.conf}/PklProject | 2 +- .../PklProject.deps.json | 0 pkl/sonr.motr/PklProject.deps.json | 4 - .../ORM.pkl => sonr.orm/Models.pkl} | 2 +- pkl/{sonr.hway => sonr.orm}/PklProject | 4 +- .../PklProject.deps.json | 0 pkl/{sonr.motr/ATN.pkl => sonr.orm/UCAN.pkl} | 2 +- scripts/init_env.sh | 12 + 54 files changed, 155 insertions(+), 444 deletions(-) rename crypto/ucan/attns/{ATN.pkl.go => UCAN.pkl.go} (70%) delete mode 100644 internal/gateway/config/init.pkl.go delete mode 100644 internal/vault/config/init.pkl.go rename internal/vault/{config => embed}/fs.go (72%) rename internal/vault/{config => embed}/manifest.go (99%) rename internal/vault/{config => embed}/schema.go (89%) rename pkg/common/models/{ORM.pkl.go => Models.pkl.go} (71%) rename {internal/gateway => pkg}/config/env.go (62%) rename internal/gateway/config/Env.pkl.go => pkg/config/hway/Hway.pkl.go (65%) create mode 100644 pkg/config/hway/init.pkl.go rename {internal/vault/config => pkg/config/motr}/Config.pkl.go (86%) rename {internal/vault/config => pkg/config/motr}/Environment.pkl.go (83%) rename internal/vault/config/DWN.pkl.go => pkg/config/motr/Motr.pkl.go (68%) rename {internal/vault/config => pkg/config/motr}/Schema.pkl.go (86%) create mode 100644 pkg/config/motr/init.pkl.go delete mode 100644 pkl/ipfs.net/Config.pkl delete mode 100644 pkl/ipfs.net/PklProject rename pkl/{sonr.hway/Env.pkl => sonr.conf/Hway.pkl} (79%) rename pkl/{sonr.motr/DWN.pkl => sonr.conf/Motr.pkl} (91%) rename pkl/{sonr.motr => sonr.conf}/PklProject (97%) rename pkl/{ipfs.net => sonr.conf}/PklProject.deps.json (100%) delete mode 100644 pkl/sonr.motr/PklProject.deps.json rename pkl/{sonr.hway/ORM.pkl => sonr.orm/Models.pkl} (99%) rename pkl/{sonr.hway => sonr.orm}/PklProject (95%) rename pkl/{sonr.hway => sonr.orm}/PklProject.deps.json (100%) rename pkl/{sonr.motr/ATN.pkl => sonr.orm/UCAN.pkl} (98%) diff --git a/Makefile b/Makefile index 930674dad..23ef78c2b 100644 --- a/Makefile +++ b/Makefile @@ -308,15 +308,13 @@ sh-testnet: mod-tidy ############################################################################### .PHONY: gen-pkl gen-templ -gen-pkl: - go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest - pkl-gen-go pkl/sonr.motr/ATN.pkl - pkl-gen-go pkl/sonr.hway/Env.pkl - pkl-gen-go pkl/sonr.motr/DWN.pkl - pkl-gen-go pkl/sonr.hway/ORM.pkl - -gen-templ: - @go install github.com/a-h/templ/cmd/templ@latest +gen-pkl: init-env + pkl-gen-go pkl/sonr.orm/UCAN.pkl + pkl-gen-go pkl/sonr.orm/Models.pkl + pkl-gen-go pkl/sonr.conf/Hway.pkl + pkl-gen-go pkl/sonr.conf/Motr.pkl + +gen-templ: init-env templ generate diff --git a/cmd/hway/cmds.go b/cmd/hway/cmds.go index e31677449..1c90b34d3 100644 --- a/cmd/hway/cmds.go +++ b/cmd/hway/cmds.go @@ -10,8 +10,8 @@ import ( "github.com/labstack/echo/v4/middleware" "github.com/onsonr/sonr/crypto/ucan" "github.com/onsonr/sonr/internal/gateway" - "github.com/onsonr/sonr/internal/gateway/config" "github.com/onsonr/sonr/pkg/common/ipfs" + config "github.com/onsonr/sonr/pkg/config/hway" "github.com/onsonr/sonr/pkg/database/sessions" "github.com/onsonr/sonr/pkg/didauth/producer" "github.com/spf13/cobra" @@ -60,13 +60,13 @@ func rootCmd() *cobra.Command { return cmd } -func loadEnvImplFromArgs(args []string) (config.Env, error) { +func loadEnvImplFromArgs(args []string) (config.Hway, error) { cmd := rootCmd() if err := cmd.ParseFlags(args); err != nil { return nil, err } - env := &config.EnvImpl{ + env := &config.HwayImpl{ ServePort: servePort, ConfigDir: configDir, SqliteFile: sqliteFile, @@ -80,7 +80,7 @@ func loadEnvImplFromArgs(args []string) (config.Env, error) { } // setupServer sets up the server -func setupServer(env config.Env) (*echo.Echo, error) { +func setupServer(env config.Hway) (*echo.Echo, error) { ipc, err := ipfs.NewClient() if err != nil { return nil, err diff --git a/crypto/ucan/attns/ATN.pkl.go b/crypto/ucan/attns/UCAN.pkl.go similarity index 70% rename from crypto/ucan/attns/ATN.pkl.go rename to crypto/ucan/attns/UCAN.pkl.go index 83be0a801..e11a05ce6 100644 --- a/crypto/ucan/attns/ATN.pkl.go +++ b/crypto/ucan/attns/UCAN.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT. package attns import ( @@ -7,11 +7,11 @@ import ( "github.com/apple/pkl-go/pkl" ) -type ATN struct { +type UCAN struct { } -// LoadFromPath loads the pkl module at the given path and evaluates it into a ATN -func LoadFromPath(ctx context.Context, path string) (ret *ATN, err error) { +// LoadFromPath loads the pkl module at the given path and evaluates it into a UCAN +func LoadFromPath(ctx context.Context, path string) (ret *UCAN, err error) { evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) if err != nil { return nil, err @@ -26,9 +26,9 @@ func LoadFromPath(ctx context.Context, path string) (ret *ATN, err error) { return ret, err } -// Load loads the pkl module at the given source and evaluates it with the given evaluator into a ATN -func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*ATN, error) { - var ret ATN +// Load loads the pkl module at the given source and evaluates it with the given evaluator into a UCAN +func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*UCAN, error) { + var ret UCAN if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil { return nil, err } diff --git a/crypto/ucan/attns/capability/Capability.pkl.go b/crypto/ucan/attns/capability/Capability.pkl.go index 678a12caa..621a0100f 100644 --- a/crypto/ucan/attns/capability/Capability.pkl.go +++ b/crypto/ucan/attns/capability/Capability.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT. package capability import ( diff --git a/crypto/ucan/attns/init.pkl.go b/crypto/ucan/attns/init.pkl.go index 7df3d778f..931f6989d 100644 --- a/crypto/ucan/attns/init.pkl.go +++ b/crypto/ucan/attns/init.pkl.go @@ -1,8 +1,8 @@ -// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT. package attns import "github.com/apple/pkl-go/pkl" func init() { - pkl.RegisterMapping("sonr.motr.ATN", ATN{}) + pkl.RegisterMapping("sonr.orm.UCAN", UCAN{}) } diff --git a/crypto/ucan/attns/policytype/PolicyType.pkl.go b/crypto/ucan/attns/policytype/PolicyType.pkl.go index a6e852003..02fc6403e 100644 --- a/crypto/ucan/attns/policytype/PolicyType.pkl.go +++ b/crypto/ucan/attns/policytype/PolicyType.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT. package policytype import ( diff --git a/crypto/ucan/attns/resourcetype/ResourceType.pkl.go b/crypto/ucan/attns/resourcetype/ResourceType.pkl.go index 61ffb4a9b..1d3695f05 100644 --- a/crypto/ucan/attns/resourcetype/ResourceType.pkl.go +++ b/crypto/ucan/attns/resourcetype/ResourceType.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT. package resourcetype import ( diff --git a/internal/gateway/config/init.pkl.go b/internal/gateway/config/init.pkl.go deleted file mode 100644 index b1bcb5508..000000000 --- a/internal/gateway/config/init.pkl.go +++ /dev/null @@ -1,8 +0,0 @@ -// Code generated from Pkl module `sonr.hway.Env`. DO NOT EDIT. -package config - -import "github.com/apple/pkl-go/pkl" - -func init() { - pkl.RegisterMapping("sonr.hway.Env", EnvImpl{}) -} diff --git a/internal/vault/config/init.pkl.go b/internal/vault/config/init.pkl.go deleted file mode 100644 index 7fc1ae454..000000000 --- a/internal/vault/config/init.pkl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. -package config - -import "github.com/apple/pkl-go/pkl" - -func init() { - pkl.RegisterMapping("sonr.motr.DWN", DWN{}) - pkl.RegisterMapping("sonr.motr.DWN#Config", Config{}) - pkl.RegisterMapping("sonr.motr.DWN#Schema", Schema{}) - pkl.RegisterMapping("sonr.motr.DWN#Environment", Environment{}) -} diff --git a/internal/vault/context/middleware.go b/internal/vault/context/middleware.go index b8fb09baa..996018b1e 100644 --- a/internal/vault/context/middleware.go +++ b/internal/vault/context/middleware.go @@ -5,8 +5,8 @@ import ( "net/http" "github.com/labstack/echo/v4" + config "github.com/onsonr/sonr/pkg/config/motr" - "github.com/onsonr/sonr/internal/vault/types" "github.com/onsonr/sonr/pkg/common" ) @@ -33,7 +33,7 @@ func Get(c echo.Context) (SessionCtx, error) { } // WebNodeMiddleware establishes a Session Cookie. -func Middleware(config *types.Config) echo.MiddlewareFunc { +func Middleware(config *config.Config) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { err := injectConfig(c, config) @@ -46,7 +46,7 @@ func Middleware(config *types.Config) echo.MiddlewareFunc { } } -func injectConfig(c echo.Context, config *types.Config) error { +func injectConfig(c echo.Context, config *config.Config) error { common.HeaderWrite(c, common.SonrAPIURL, config.SonrApiUrl) common.HeaderWrite(c, common.SonrRPCURL, config.SonrRpcUrl) diff --git a/internal/vault/config/fs.go b/internal/vault/embed/fs.go similarity index 72% rename from internal/vault/config/fs.go rename to internal/vault/embed/fs.go index b78f5d2c4..03256003f 100644 --- a/internal/vault/config/fs.go +++ b/internal/vault/embed/fs.go @@ -1,10 +1,10 @@ -package config +package embed import ( "encoding/json" "github.com/ipfs/boxo/files" - "github.com/onsonr/sonr/internal/vault/embed" + config "github.com/onsonr/sonr/pkg/config/motr" ) const SchemaVersion = 1 @@ -17,7 +17,7 @@ const ( ) // spawnVaultDirectory creates a new directory with the default files -func NewVaultFS(cfg *Config) (files.Directory, error) { +func NewVaultFS(cfg *config.Config) (files.Directory, error) { manifestBz, err := newWebManifestBytes() if err != nil { return nil, err @@ -29,15 +29,15 @@ func NewVaultFS(cfg *Config) (files.Directory, error) { return files.NewMapDirectory(map[string]files.Node{ AppManifestFileName: files.NewBytesFile(manifestBz), DWNConfigFileName: files.NewBytesFile(cnfBz), - IndexHTMLFileName: files.NewBytesFile(embed.IndexHTML), - MainJSFileName: files.NewBytesFile(embed.MainJS), - ServiceWorkerFileName: files.NewBytesFile(embed.WorkerJS), + IndexHTMLFileName: files.NewBytesFile(IndexHTML), + MainJSFileName: files.NewBytesFile(MainJS), + ServiceWorkerFileName: files.NewBytesFile(WorkerJS), }), nil } // NewVaultConfig returns the default vault config -func NewVaultConfig(addr string, ucanCID string) *Config { - return &Config{ +func NewVaultConfig(addr string, ucanCID string) *config.Config { + return &config.Config{ MotrToken: ucanCID, MotrAddress: addr, IpfsGatewayUrl: "http://localhost:80", diff --git a/internal/vault/config/manifest.go b/internal/vault/embed/manifest.go similarity index 99% rename from internal/vault/config/manifest.go rename to internal/vault/embed/manifest.go index 07e9b4a4c..560ce1233 100644 --- a/internal/vault/config/manifest.go +++ b/internal/vault/embed/manifest.go @@ -1,4 +1,4 @@ -package config +package embed import "encoding/json" diff --git a/internal/vault/config/schema.go b/internal/vault/embed/schema.go similarity index 89% rename from internal/vault/config/schema.go rename to internal/vault/embed/schema.go index 6eac6dde1..2697018fe 100644 --- a/internal/vault/config/schema.go +++ b/internal/vault/embed/schema.go @@ -1,15 +1,16 @@ -package config +package embed import ( "reflect" "strings" "github.com/onsonr/sonr/pkg/common/models" + config "github.com/onsonr/sonr/pkg/config/motr" ) // DefaultSchema returns the default schema -func DefaultSchema() *Schema { - return &Schema{ +func DefaultSchema() *config.Schema { + return &config.Schema{ Version: SchemaVersion, Account: getSchema(&models.Account{}), Asset: getSchema(&models.Asset{}), diff --git a/pkg/common/models/Account.pkl.go b/pkg/common/models/Account.pkl.go index f996980df..e43491247 100644 --- a/pkg/common/models/Account.pkl.go +++ b/pkg/common/models/Account.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type Account struct { diff --git a/pkg/common/models/Asset.pkl.go b/pkg/common/models/Asset.pkl.go index 1008899c1..639c30100 100644 --- a/pkg/common/models/Asset.pkl.go +++ b/pkg/common/models/Asset.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type Asset struct { diff --git a/pkg/common/models/Chain.pkl.go b/pkg/common/models/Chain.pkl.go index ee4553e22..45379718b 100644 --- a/pkg/common/models/Chain.pkl.go +++ b/pkg/common/models/Chain.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type Chain struct { diff --git a/pkg/common/models/Credential.pkl.go b/pkg/common/models/Credential.pkl.go index 90a325860..b91a26f69 100644 --- a/pkg/common/models/Credential.pkl.go +++ b/pkg/common/models/Credential.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type Credential struct { diff --git a/pkg/common/models/DID.pkl.go b/pkg/common/models/DID.pkl.go index 229ca2ad8..ac3cf6a63 100644 --- a/pkg/common/models/DID.pkl.go +++ b/pkg/common/models/DID.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models import ( diff --git a/pkg/common/models/Grant.pkl.go b/pkg/common/models/Grant.pkl.go index 6f636552b..44ea6d949 100644 --- a/pkg/common/models/Grant.pkl.go +++ b/pkg/common/models/Grant.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type Grant struct { diff --git a/pkg/common/models/JWK.pkl.go b/pkg/common/models/JWK.pkl.go index 2fe0df9eb..9f04853a0 100644 --- a/pkg/common/models/JWK.pkl.go +++ b/pkg/common/models/JWK.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type JWK struct { diff --git a/pkg/common/models/Keyshare.pkl.go b/pkg/common/models/Keyshare.pkl.go index 49f774405..f48317520 100644 --- a/pkg/common/models/Keyshare.pkl.go +++ b/pkg/common/models/Keyshare.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type Keyshare struct { diff --git a/pkg/common/models/ORM.pkl.go b/pkg/common/models/Models.pkl.go similarity index 71% rename from pkg/common/models/ORM.pkl.go rename to pkg/common/models/Models.pkl.go index 811c9b7bf..7cfbef491 100644 --- a/pkg/common/models/ORM.pkl.go +++ b/pkg/common/models/Models.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models import ( @@ -7,14 +7,14 @@ import ( "github.com/apple/pkl-go/pkl" ) -type ORM struct { +type Models struct { DbName string `pkl:"db_name"` DbVersion int `pkl:"db_version"` } -// LoadFromPath loads the pkl module at the given path and evaluates it into a ORM -func LoadFromPath(ctx context.Context, path string) (ret *ORM, err error) { +// LoadFromPath loads the pkl module at the given path and evaluates it into a Models +func LoadFromPath(ctx context.Context, path string) (ret *Models, err error) { evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) if err != nil { return nil, err @@ -29,9 +29,9 @@ func LoadFromPath(ctx context.Context, path string) (ret *ORM, err error) { return ret, err } -// Load loads the pkl module at the given source and evaluates it with the given evaluator into a ORM -func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*ORM, error) { - var ret ORM +// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Models +func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Models, error) { + var ret Models if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil { return nil, err } diff --git a/pkg/common/models/Profile.pkl.go b/pkg/common/models/Profile.pkl.go index 3d5babb38..34df147f3 100644 --- a/pkg/common/models/Profile.pkl.go +++ b/pkg/common/models/Profile.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models type Profile struct { diff --git a/pkg/common/models/assettype/AssetType.pkl.go b/pkg/common/models/assettype/AssetType.pkl.go index 3f3b5e870..17193a817 100644 --- a/pkg/common/models/assettype/AssetType.pkl.go +++ b/pkg/common/models/assettype/AssetType.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package assettype import ( diff --git a/pkg/common/models/didmethod/DIDMethod.pkl.go b/pkg/common/models/didmethod/DIDMethod.pkl.go index 1c9b3e6de..2e56b9a68 100644 --- a/pkg/common/models/didmethod/DIDMethod.pkl.go +++ b/pkg/common/models/didmethod/DIDMethod.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package didmethod import ( diff --git a/pkg/common/models/init.pkl.go b/pkg/common/models/init.pkl.go index ff1a7ca1f..3fbf17a2d 100644 --- a/pkg/common/models/init.pkl.go +++ b/pkg/common/models/init.pkl.go @@ -1,17 +1,17 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package models import "github.com/apple/pkl-go/pkl" func init() { - pkl.RegisterMapping("sonr.motr.ORM", ORM{}) - pkl.RegisterMapping("sonr.motr.ORM#Account", Account{}) - pkl.RegisterMapping("sonr.motr.ORM#Asset", Asset{}) - pkl.RegisterMapping("sonr.motr.ORM#Chain", Chain{}) - pkl.RegisterMapping("sonr.motr.ORM#Credential", Credential{}) - pkl.RegisterMapping("sonr.motr.ORM#DID", DID{}) - pkl.RegisterMapping("sonr.motr.ORM#JWK", JWK{}) - pkl.RegisterMapping("sonr.motr.ORM#Grant", Grant{}) - pkl.RegisterMapping("sonr.motr.ORM#Keyshare", Keyshare{}) - pkl.RegisterMapping("sonr.motr.ORM#Profile", Profile{}) + pkl.RegisterMapping("sonr.orm.Models", Models{}) + pkl.RegisterMapping("sonr.orm.Models#Account", Account{}) + pkl.RegisterMapping("sonr.orm.Models#Asset", Asset{}) + pkl.RegisterMapping("sonr.orm.Models#Chain", Chain{}) + pkl.RegisterMapping("sonr.orm.Models#Credential", Credential{}) + pkl.RegisterMapping("sonr.orm.Models#DID", DID{}) + pkl.RegisterMapping("sonr.orm.Models#JWK", JWK{}) + pkl.RegisterMapping("sonr.orm.Models#Grant", Grant{}) + pkl.RegisterMapping("sonr.orm.Models#Keyshare", Keyshare{}) + pkl.RegisterMapping("sonr.orm.Models#Profile", Profile{}) } diff --git a/pkg/common/models/keyalgorithm/KeyAlgorithm.pkl.go b/pkg/common/models/keyalgorithm/KeyAlgorithm.pkl.go index 3c36f6318..78b18018e 100644 --- a/pkg/common/models/keyalgorithm/KeyAlgorithm.pkl.go +++ b/pkg/common/models/keyalgorithm/KeyAlgorithm.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package keyalgorithm import ( diff --git a/pkg/common/models/keycurve/KeyCurve.pkl.go b/pkg/common/models/keycurve/KeyCurve.pkl.go index 98db6f7b2..673bf90d7 100644 --- a/pkg/common/models/keycurve/KeyCurve.pkl.go +++ b/pkg/common/models/keycurve/KeyCurve.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package keycurve import ( diff --git a/pkg/common/models/keyencoding/KeyEncoding.pkl.go b/pkg/common/models/keyencoding/KeyEncoding.pkl.go index 848471c47..3b6170061 100644 --- a/pkg/common/models/keyencoding/KeyEncoding.pkl.go +++ b/pkg/common/models/keyencoding/KeyEncoding.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package keyencoding import ( diff --git a/pkg/common/models/keyrole/KeyRole.pkl.go b/pkg/common/models/keyrole/KeyRole.pkl.go index a88e749d4..efe8c32a3 100644 --- a/pkg/common/models/keyrole/KeyRole.pkl.go +++ b/pkg/common/models/keyrole/KeyRole.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package keyrole import ( diff --git a/pkg/common/models/keysharerole/KeyShareRole.pkl.go b/pkg/common/models/keysharerole/KeyShareRole.pkl.go index a83aa6f3b..41a3ee61a 100644 --- a/pkg/common/models/keysharerole/KeyShareRole.pkl.go +++ b/pkg/common/models/keysharerole/KeyShareRole.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package keysharerole import ( diff --git a/pkg/common/models/keytype/KeyType.pkl.go b/pkg/common/models/keytype/KeyType.pkl.go index 91e6e831a..f2c56539f 100644 --- a/pkg/common/models/keytype/KeyType.pkl.go +++ b/pkg/common/models/keytype/KeyType.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package keytype import ( diff --git a/pkg/common/models/permissiongrant/PermissionGrant.pkl.go b/pkg/common/models/permissiongrant/PermissionGrant.pkl.go index 6d122ab9b..76278832d 100644 --- a/pkg/common/models/permissiongrant/PermissionGrant.pkl.go +++ b/pkg/common/models/permissiongrant/PermissionGrant.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package permissiongrant import ( diff --git a/pkg/common/models/permissionscope/PermissionScope.pkl.go b/pkg/common/models/permissionscope/PermissionScope.pkl.go index 52ca785f6..6d72f2925 100644 --- a/pkg/common/models/permissionscope/PermissionScope.pkl.go +++ b/pkg/common/models/permissionscope/PermissionScope.pkl.go @@ -1,4 +1,4 @@ -// Code generated from Pkl module `sonr.motr.ORM`. DO NOT EDIT. +// Code generated from Pkl module `sonr.orm.Models`. DO NOT EDIT. package permissionscope import ( diff --git a/internal/gateway/config/env.go b/pkg/config/env.go similarity index 62% rename from internal/gateway/config/env.go rename to pkg/config/env.go index c3345967e..9e6dd9d34 100644 --- a/internal/gateway/config/env.go +++ b/pkg/config/env.go @@ -4,16 +4,17 @@ import ( "context" "github.com/apple/pkl-go/pkl" + hwayconfig "github.com/onsonr/sonr/pkg/config/hway" ) // LoadFromBytes loads the environment from the given bytes -func LoadFromBytes(data []byte) (Env, error) { +func LoadHwayFromBytes(data []byte) (hwayconfig.Hway, error) { text := string(data) - return LoadFromString(text) + return LoadHwayFromString(text) } // LoadFromString loads the environment from the given string -func LoadFromString(text string) (Env, error) { +func LoadHwayFromString(text string) (hwayconfig.Hway, error) { evaluator, err := pkl.NewEvaluator(context.Background(), pkl.PreconfiguredOptions) if err != nil { return nil, err @@ -24,12 +25,12 @@ func LoadFromString(text string) (Env, error) { err = cerr } }() - ret, err := Load(context.Background(), evaluator, pkl.TextSource(text)) + ret, err := hwayconfig.Load(context.Background(), evaluator, pkl.TextSource(text)) return ret, err } // LoadFromURL loads the environment from the given URL -func LoadFromURL(url string) (Env, error) { +func LoadFromURL(url string) (hwayconfig.Hway, error) { evaluator, err := pkl.NewEvaluator(context.Background(), pkl.PreconfiguredOptions) if err != nil { return nil, err @@ -40,6 +41,6 @@ func LoadFromURL(url string) (Env, error) { err = cerr } }() - ret, err := Load(context.Background(), evaluator, pkl.UriSource(url)) + ret, err := hwayconfig.Load(context.Background(), evaluator, pkl.UriSource(url)) return ret, err } diff --git a/internal/gateway/config/Env.pkl.go b/pkg/config/hway/Hway.pkl.go similarity index 65% rename from internal/gateway/config/Env.pkl.go rename to pkg/config/hway/Hway.pkl.go index 2ffbaf1e3..7859e50e7 100644 --- a/internal/gateway/config/Env.pkl.go +++ b/pkg/config/hway/Hway.pkl.go @@ -1,5 +1,5 @@ -// Code generated from Pkl module `sonr.hway.Env`. DO NOT EDIT. -package config +// Code generated from Pkl module `sonr.conf.Hway`. DO NOT EDIT. +package hway import ( "context" @@ -7,7 +7,7 @@ import ( "github.com/apple/pkl-go/pkl" ) -type Env interface { +type Hway interface { GetServePort() int GetConfigDir() string @@ -25,9 +25,9 @@ type Env interface { GetSonrRpcUrl() string } -var _ Env = (*EnvImpl)(nil) +var _ Hway = (*HwayImpl)(nil) -type EnvImpl struct { +type HwayImpl struct { ServePort int `pkl:"servePort"` ConfigDir string `pkl:"configDir"` @@ -45,40 +45,40 @@ type EnvImpl struct { SonrRpcUrl string `pkl:"sonrRpcUrl"` } -func (rcv *EnvImpl) GetServePort() int { +func (rcv *HwayImpl) GetServePort() int { return rcv.ServePort } -func (rcv *EnvImpl) GetConfigDir() string { +func (rcv *HwayImpl) GetConfigDir() string { return rcv.ConfigDir } -func (rcv *EnvImpl) GetSqliteFile() string { +func (rcv *HwayImpl) GetSqliteFile() string { return rcv.SqliteFile } -func (rcv *EnvImpl) GetChainId() string { +func (rcv *HwayImpl) GetChainId() string { return rcv.ChainId } -func (rcv *EnvImpl) GetIpfsGatewayUrl() string { +func (rcv *HwayImpl) GetIpfsGatewayUrl() string { return rcv.IpfsGatewayUrl } -func (rcv *EnvImpl) GetSonrApiUrl() string { +func (rcv *HwayImpl) GetSonrApiUrl() string { return rcv.SonrApiUrl } -func (rcv *EnvImpl) GetSonrGrpcUrl() string { +func (rcv *HwayImpl) GetSonrGrpcUrl() string { return rcv.SonrGrpcUrl } -func (rcv *EnvImpl) GetSonrRpcUrl() string { +func (rcv *HwayImpl) GetSonrRpcUrl() string { return rcv.SonrRpcUrl } -// LoadFromPath loads the pkl module at the given path and evaluates it into a Env -func LoadFromPath(ctx context.Context, path string) (ret Env, err error) { +// LoadFromPath loads the pkl module at the given path and evaluates it into a Hway +func LoadFromPath(ctx context.Context, path string) (ret Hway, err error) { evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) if err != nil { return nil, err @@ -93,9 +93,9 @@ func LoadFromPath(ctx context.Context, path string) (ret Env, err error) { return ret, err } -// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Env -func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (Env, error) { - var ret EnvImpl +// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Hway +func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (Hway, error) { + var ret HwayImpl if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil { return nil, err } diff --git a/pkg/config/hway/init.pkl.go b/pkg/config/hway/init.pkl.go new file mode 100644 index 000000000..d4ed3bee2 --- /dev/null +++ b/pkg/config/hway/init.pkl.go @@ -0,0 +1,8 @@ +// Code generated from Pkl module `sonr.conf.Hway`. DO NOT EDIT. +package hway + +import "github.com/apple/pkl-go/pkl" + +func init() { + pkl.RegisterMapping("sonr.conf.Hway", HwayImpl{}) +} diff --git a/internal/vault/config/Config.pkl.go b/pkg/config/motr/Config.pkl.go similarity index 86% rename from internal/vault/config/Config.pkl.go rename to pkg/config/motr/Config.pkl.go index b2b410bdf..2957560c9 100644 --- a/internal/vault/config/Config.pkl.go +++ b/pkg/config/motr/Config.pkl.go @@ -1,5 +1,5 @@ -// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. -package config +// Code generated from Pkl module `sonr.conf.Motr`. DO NOT EDIT. +package motr type Config struct { IpfsGatewayUrl string `pkl:"ipfsGatewayUrl" json:"ipfsGatewayUrl,omitempty"` diff --git a/internal/vault/config/Environment.pkl.go b/pkg/config/motr/Environment.pkl.go similarity index 83% rename from internal/vault/config/Environment.pkl.go rename to pkg/config/motr/Environment.pkl.go index 9bbcbdf5d..5824d6ecc 100644 --- a/internal/vault/config/Environment.pkl.go +++ b/pkg/config/motr/Environment.pkl.go @@ -1,5 +1,5 @@ -// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. -package config +// Code generated from Pkl module `sonr.conf.Motr`. DO NOT EDIT. +package motr type Environment struct { IsDevelopment bool `pkl:"isDevelopment" json:"isDevelopment,omitempty"` diff --git a/internal/vault/config/DWN.pkl.go b/pkg/config/motr/Motr.pkl.go similarity index 68% rename from internal/vault/config/DWN.pkl.go rename to pkg/config/motr/Motr.pkl.go index 4f5e265cc..35beff0b0 100644 --- a/internal/vault/config/DWN.pkl.go +++ b/pkg/config/motr/Motr.pkl.go @@ -1,5 +1,5 @@ -// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. -package config +// Code generated from Pkl module `sonr.conf.Motr`. DO NOT EDIT. +package motr import ( "context" @@ -7,11 +7,11 @@ import ( "github.com/apple/pkl-go/pkl" ) -type DWN struct { +type Motr struct { } -// LoadFromPath loads the pkl module at the given path and evaluates it into a DWN -func LoadFromPath(ctx context.Context, path string) (ret *DWN, err error) { +// LoadFromPath loads the pkl module at the given path and evaluates it into a Motr +func LoadFromPath(ctx context.Context, path string) (ret *Motr, err error) { evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) if err != nil { return nil, err @@ -26,9 +26,9 @@ func LoadFromPath(ctx context.Context, path string) (ret *DWN, err error) { return ret, err } -// Load loads the pkl module at the given source and evaluates it with the given evaluator into a DWN -func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*DWN, error) { - var ret DWN +// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Motr +func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Motr, error) { + var ret Motr if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil { return nil, err } diff --git a/internal/vault/config/Schema.pkl.go b/pkg/config/motr/Schema.pkl.go similarity index 86% rename from internal/vault/config/Schema.pkl.go rename to pkg/config/motr/Schema.pkl.go index adb9b185a..8ea43bd32 100644 --- a/internal/vault/config/Schema.pkl.go +++ b/pkg/config/motr/Schema.pkl.go @@ -1,5 +1,5 @@ -// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT. -package config +// Code generated from Pkl module `sonr.conf.Motr`. DO NOT EDIT. +package motr type Schema struct { Version int `pkl:"version"` diff --git a/pkg/config/motr/init.pkl.go b/pkg/config/motr/init.pkl.go new file mode 100644 index 000000000..0b9d6ee41 --- /dev/null +++ b/pkg/config/motr/init.pkl.go @@ -0,0 +1,11 @@ +// Code generated from Pkl module `sonr.conf.Motr`. DO NOT EDIT. +package motr + +import "github.com/apple/pkl-go/pkl" + +func init() { + pkl.RegisterMapping("sonr.conf.Motr", Motr{}) + pkl.RegisterMapping("sonr.conf.Motr#Config", Config{}) + pkl.RegisterMapping("sonr.conf.Motr#Schema", Schema{}) + pkl.RegisterMapping("sonr.conf.Motr#Environment", Environment{}) +} diff --git a/pkl/ipfs.net/Config.pkl b/pkl/ipfs.net/Config.pkl deleted file mode 100644 index 996dc6d3f..000000000 --- a/pkl/ipfs.net/Config.pkl +++ /dev/null @@ -1,275 +0,0 @@ -module ipfs.net.Config - -API: API - -Addresses: Addresses - -AutoNAT: Dynamic - -Bootstrap: Listing - -DNS: DNS - -Datastore: Datastore - -Discovery: Discovery - -Experimental: Experimental - -Gateway: Gateway - -Identity: Identity - -Internal: Dynamic - -Ipns: Ipns - -Migration: Migration - -Mounts: Mounts - -Peering: Peering - -Pinning: Pinning - -Plugins: Plugins - -Provider: Provider - -Pubsub: Pubsub - -Reprovider: Reprovider - -Routing: Routing - -Swarm: Swarm - -class API { - HTTPHeaders: HTTPHeaders -} - -class HTTPHeaders { - `Access-Control-Allow-Origin`: Listing -} - -class Addresses { - API: String - - Announce: Listing - - AppendAnnounce: Listing - - Gateway: String - - NoAnnounce: Listing - - Swarm: Listing -} - -class DNS { - Resolvers: Dynamic -} - -class Datastore { - BloomFilterSize: Int - - GCPeriod: String - - HashOnRead: Boolean - - Spec: Spec - - StorageGCWatermark: Int - - StorageMax: String -} - -class Spec { - mounts: Listing - - type: String -} - -class MountsItem0 { - child: Child - - mountpoint: String - - prefix: String - - type: String -} - -class Child { - path: String - - shardFunc: String - - sync: Boolean - - type: String -} - -class MountsItem1 { - child: MountsItem1Child - - mountpoint: String - - prefix: String - - type: String -} - -class MountsItem1Child { - compression: String - - path: String - - type: String -} - -class Discovery { - MDNS: MDNS -} - -class MDNS { - Enabled: Boolean -} - -class Experimental { - AcceleratedDHTClient: Boolean - - FilestoreEnabled: Boolean - - GraphsyncEnabled: Boolean - - Libp2pStreamMounting: Boolean - - P2pHttpProxy: Boolean - - StrategicProviding: Boolean - - UrlstoreEnabled: Boolean -} - -class Gateway { - APICommands: Listing - - HTTPHeaders: GatewayHTTPHeaders - - NoDNSLink: Boolean - - NoFetch: Boolean - - PathPrefixes: Listing - - PublicGateways: Any - - RootRedirect: String - - Writable: Boolean -} - -class GatewayHTTPHeaders { - `Access-Control-Allow-Headers`: Listing - - `Access-Control-Allow-Methods`: Listing - - `Access-Control-Allow-Origin`: Listing -} - -class Identity { - PeerID: String - - PrivKey: String -} - -class Ipns { - RecordLifetime: String - - RepublishPeriod: String - - ResolveCacheSize: Int -} - -class Migration { - DownloadSources: Listing - - Keep: String -} - -class Mounts { - FuseAllowOther: Boolean - - IPFS: String - - IPNS: String -} - -class Peering { - Peers: Listing -} - -class PeersItem11 { - Addrs: Listing - - ID: String -} - -class Pinning { - RemoteServices: Dynamic -} - -class Plugins { - Plugins: Any -} - -class Provider { - Strategy: String -} - -class Pubsub { - DisableSigning: Boolean - - Router: String -} - -class Reprovider { - Interval: String - - Strategy: String -} - -class Routing { - Methods: Any - - Routers: Any - - Type: String -} - -class Swarm { - AddrFilters: Any - - ConnMgr: Dynamic - - DisableBandwidthMetrics: Boolean - - DisableNatPortMap: Boolean - - RelayClient: Dynamic - - RelayService: Dynamic - - ResourceMgr: Dynamic - - Transports: Transports -} - -class Transports { - Multiplexers: Dynamic - - Network: Dynamic - - Security: Dynamic -} diff --git a/pkl/ipfs.net/PklProject b/pkl/ipfs.net/PklProject deleted file mode 100644 index 1539ef8ba..000000000 --- a/pkl/ipfs.net/PklProject +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//===----------------------------------------------------------------------===// -/// Configuration files for integrating the Matrix service -amends "../basePklProject.pkl" - -package { - name = "ipfs.net" - version = "0.0.4" -} diff --git a/pkl/sonr.hway/Env.pkl b/pkl/sonr.conf/Hway.pkl similarity index 79% rename from pkl/sonr.hway/Env.pkl rename to pkl/sonr.conf/Hway.pkl index b6a097264..de5223012 100644 --- a/pkl/sonr.hway/Env.pkl +++ b/pkl/sonr.conf/Hway.pkl @@ -1,7 +1,7 @@ -@go.Package { name = "github.com/onsonr/sonr/internal/gateway/config" } +@go.Package { name = "github.com/onsonr/sonr/pkg/config/hway" } -open module sonr.hway.Env +open module sonr.conf.Hway import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" diff --git a/pkl/sonr.motr/DWN.pkl b/pkl/sonr.conf/Motr.pkl similarity index 91% rename from pkl/sonr.motr/DWN.pkl rename to pkl/sonr.conf/Motr.pkl index 233bb6b9f..88d89a28f 100644 --- a/pkl/sonr.motr/DWN.pkl +++ b/pkl/sonr.conf/Motr.pkl @@ -1,6 +1,6 @@ -@go.Package { name = "github.com/onsonr/sonr/internal/vault/config" } +@go.Package { name = "github.com/onsonr/sonr/pkg/config/motr" } -module sonr.motr.DWN +module sonr.conf.Motr import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" diff --git a/pkl/sonr.motr/PklProject b/pkl/sonr.conf/PklProject similarity index 97% rename from pkl/sonr.motr/PklProject rename to pkl/sonr.conf/PklProject index 27197f00f..9aaf524d8 100644 --- a/pkl/sonr.motr/PklProject +++ b/pkl/sonr.conf/PklProject @@ -17,6 +17,6 @@ amends "../basePklProject.pkl" package { - name = "sonr.motr" + name = "sonr.conf" version = "0.0.1" } diff --git a/pkl/ipfs.net/PklProject.deps.json b/pkl/sonr.conf/PklProject.deps.json similarity index 100% rename from pkl/ipfs.net/PklProject.deps.json rename to pkl/sonr.conf/PklProject.deps.json diff --git a/pkl/sonr.motr/PklProject.deps.json b/pkl/sonr.motr/PklProject.deps.json deleted file mode 100644 index 836079aad..000000000 --- a/pkl/sonr.motr/PklProject.deps.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "schemaVersion": 1, - "resolvedDependencies": {} -} \ No newline at end of file diff --git a/pkl/sonr.hway/ORM.pkl b/pkl/sonr.orm/Models.pkl similarity index 99% rename from pkl/sonr.hway/ORM.pkl rename to pkl/sonr.orm/Models.pkl index 658ee5f2a..29ec55b74 100644 --- a/pkl/sonr.hway/ORM.pkl +++ b/pkl/sonr.orm/Models.pkl @@ -1,6 +1,6 @@ @go.Package { name = "github.com/onsonr/sonr/pkg/common/models" } -module sonr.motr.ORM +module sonr.orm.Models import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" diff --git a/pkl/sonr.hway/PklProject b/pkl/sonr.orm/PklProject similarity index 95% rename from pkl/sonr.hway/PklProject rename to pkl/sonr.orm/PklProject index b7e9fa249..82020b1ae 100644 --- a/pkl/sonr.hway/PklProject +++ b/pkl/sonr.orm/PklProject @@ -17,6 +17,6 @@ amends "../basePklProject.pkl" package { - name = "sonr.hway" - version = "0.0.3" + name = "sonr.orm" + version = "0.0.1" } diff --git a/pkl/sonr.hway/PklProject.deps.json b/pkl/sonr.orm/PklProject.deps.json similarity index 100% rename from pkl/sonr.hway/PklProject.deps.json rename to pkl/sonr.orm/PklProject.deps.json diff --git a/pkl/sonr.motr/ATN.pkl b/pkl/sonr.orm/UCAN.pkl similarity index 98% rename from pkl/sonr.motr/ATN.pkl rename to pkl/sonr.orm/UCAN.pkl index fed61e58f..2458af38c 100644 --- a/pkl/sonr.motr/ATN.pkl +++ b/pkl/sonr.orm/UCAN.pkl @@ -1,6 +1,6 @@ @go.Package { name = "github.com/onsonr/sonr/crypto/ucan/attns" } -module sonr.motr.ATN +module sonr.orm.UCAN import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" diff --git a/scripts/init_env.sh b/scripts/init_env.sh index 5d9bb5548..d12e13015 100755 --- a/scripts/init_env.sh +++ b/scripts/init_env.sh @@ -32,3 +32,15 @@ if [ ! -f "$ROOT_DIR/bin/process-compose" ]; then sh -c "$(curl --location https://raw.githubusercontent.com/F1bonacc1/process-compose/main/scripts/get-pc.sh)" -- -d -b $ROOT_DIR/bin fi +# Check if pkl-gen-go is installed to $GOPATH/bin +if [ ! -f "$GOPATH/bin/pkl-gen-go" ]; then + echo "pkl-gen-go not found. Installing..." + go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest +fi + +# Check if templ is installed to $GOPATH/bin +if [ ! -f "$GOPATH/bin/templ" ]; then + echo "templ not found. Installing..." + go install github.com/a-h/templ/cmd/templ@latest +fi +