Compare commits

..

3 Commits

Author SHA1 Message Date
Jeff McCune
3d4ae44ddd (#113) Fix goreleaser try 2
goreleaser fails with Failure: plugin connect-query: could not find protoc plugin for name connect-query - please make sure protoc-gen-connect-query is installed and present on your $PATH
2024-04-09 16:23:35 -07:00
Jeff McCune
1efb1faa40 (#113) Fix goreleaser
git executable must come before actions checkout
2024-04-09 16:04:42 -07:00
Jeff McCune
bfd6a56397 (#113) Fix actions workflows 2024-04-09 15:57:31 -07:00
30 changed files with 706 additions and 1673 deletions

View File

@@ -17,11 +17,30 @@ jobs:
name: lint
runs-on: gha-rs
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: false
- name: Install tools
run: sudo apt update && sudo apt -qq -y install curl zip unzip tar bzip2 make
- name: Install Deps
run: |
make go-deps
go generate ./...
make frontend-deps
make frontend
go mod tidy
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:

View File

@@ -14,23 +14,46 @@ jobs:
goreleaser:
runs-on: gha-rs
steps:
# Must come before Checkout, otherwise goreleaser fails
- name: Provide GPG and Git
run: sudo apt update && sudo apt -qq -y install gnupg git
run: sudo apt update && sudo apt -qq -y install gnupg git curl zip unzip tar bzip2 make
# Must come after git executable is provided
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install Deps
run: |
make go-deps
go generate ./...
make frontend-deps
make frontend
go mod tidy
- name: Find protoc-gen-connect-query
run: find / -name protoc-gen-connect-query
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_CODE_SIGNING_SECRETKEY }}
passphrase: ${{ secrets.GPG_CODE_SIGNING_PASSPHRASE }}
- name: List keys
run: gpg -K
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:

View File

@@ -18,13 +18,18 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Provide unzip for Helm
run: sudo apt update && sudo apt -qq -y install curl zip unzip tar bzip2
- name: Install tools
run: sudo apt update && sudo apt -qq -y install curl zip unzip tar bzip2 make
- name: Set up Helm
uses: azure/setup-helm@v4
@@ -32,5 +37,13 @@ jobs:
- name: Set up Kubectl
uses: azure/setup-kubectl@v3
- name: Install Deps
run: |
make go-deps
go generate ./...
make frontend-deps
make frontend
go mod tidy
- name: Test
run: ./scripts/test

2
.gitignore vendored
View File

@@ -2,7 +2,7 @@ bin/
vendor/
.idea/
coverage.out
dist/
/dist/
*.hold/
/deploy/
.vscode/

View File

@@ -10,9 +10,7 @@ version: 1
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
@@ -23,6 +21,9 @@ builds:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
signs:
- artifacts: checksum

View File

@@ -12,6 +12,9 @@ IMAGE_NAME=$(DOCKER_REPO)
$( shell mkdir -p bin)
# For buf plugin protoc-gen-connect-es
export PATH := $(PWD)/internal/server/frontend/node_modules/.bin:$(PATH)
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TREE_STATE=$(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
BUILD_DATE=$(shell date -Iseconds)
@@ -94,6 +97,40 @@ coverage: test ## Test coverage profile.
snapshot: ## Go release snapshot
goreleaser release --snapshot --clean
.PHONY: buf
buf: ## buf generate
cd service && buf mod update
buf generate
.PHONY: go-deps
go-deps: ## install go executables
go install github.com/bufbuild/buf/cmd/buf@v1
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@v1
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1
go install connectrpc.com/connect/cmd/protoc-gen-connect-go@v1
go install honnef.co/go/tools/cmd/staticcheck@latest
# curl https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash
.PHONY: frontend-deps
frontend-deps: ## Setup npm and vite
cd internal/server/frontend && npm install
cd internal/server/frontend && npm install --save-dev @bufbuild/buf @connectrpc/protoc-gen-connect-es
cd internal/server/frontend && npm install @connectrpc/connect @connectrpc/connect-web @bufbuild/protobuf
# https://github.com/connectrpc/connect-query-es/blob/1350b6f07b6aead81793917954bdb1cc3ce09df9/packages/protoc-gen-connect-query/README.md?plain=1#L23
cd internal/server/frontend && npm install --save-dev @connectrpc/protoc-gen-connect-query @bufbuild/protoc-gen-es
cd internal/server/frontend && npm install @connectrpc/connect-query @bufbuild/protobuf
# https://github.com/aleclarson/vite-tsconfig-paths
cd internal/server/frontend && npm install --save-dev vite-tsconfig-paths
.PHONY: frontend
frontend: buf
mkdir -p internal/server/frontend/dist
cd internal/server/frontend/dist && rm -rf app
cd internal/server/frontend && ./node_modules/.bin/vite build
# Necessary to force go build cache miss
touch internal/server/frontend/frontend.go
.PHONY: help
help: ## Display this help menu.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

24
buf.gen.yaml Normal file
View File

@@ -0,0 +1,24 @@
# Generates gRPC and ConnectRPC bindings for Go and TypeScript
#
# Note: protoc-gen-connect-query is the primary method of wiring up the React
# frontend.
version: v1
plugins:
- plugin: go
out: service/gen
opt: paths=source_relative
- plugin: connect-go
out: service/gen
opt: paths=source_relative
- plugin: es
out: internal/server/frontend/gen
opt:
- target=ts
- plugin: connect-es
out: internal/server/frontend/gen
opt:
- target=ts
- plugin: connect-query
out: internal/server/frontend/gen
opt:
- target=ts

8
buf.lock Normal file
View File

@@ -0,0 +1,8 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: bufbuild
repository: protovalidate
commit: b983156c5e994cc9892e0ce3e64e17e0
digest: shake256:fb47a62989d38c2529bcc5cd86ded43d800eb84cee82b42b9e8a9e815d4ee8134a0fb9d0ce8299b27c2d2bbb7d6ade0c4ad5a8a4d467e1e2c7ca619ae9f634e2

3
buf.work.yaml Normal file
View File

@@ -0,0 +1,3 @@
version: v1
directories:
- service

2
go.mod
View File

@@ -24,7 +24,6 @@ require (
golang.org/x/net v0.22.0
golang.org/x/tools v0.19.0
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.29.2
k8s.io/apimachinery v0.29.2
k8s.io/client-go v0.29.2
@@ -103,6 +102,7 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231206194836-bf4651e18aa8 // indirect
k8s.io/utils v0.0.0-20231127182322-b307cd553661 // indirect

View File

@@ -7,8 +7,8 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
/gen/
node_modules
dist
dist-ssr
*.local

View File

@@ -0,0 +1 @@
/app/

View File

@@ -1,35 +0,0 @@
// @generated by protoc-gen-connect-query v1.1.3 with parameter "target=ts"
// @generated from file holos/v1alpha1/holos.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { MethodKind } from "@bufbuild/protobuf";
import { GetUserClaimsRequest, GetUserClaimsResponse, RegisterUserRequest, RegisterUserResponse } from "./holos_pb.js";
/**
* @generated from rpc holos.v1alpha1.HolosService.GetUserClaims
*/
export const getUserClaims = {
localName: "getUserClaims",
name: "GetUserClaims",
kind: MethodKind.Unary,
I: GetUserClaimsRequest,
O: GetUserClaimsResponse,
service: {
typeName: "holos.v1alpha1.HolosService"
}
} as const;
/**
* @generated from rpc holos.v1alpha1.HolosService.RegisterUser
*/
export const registerUser = {
localName: "registerUser",
name: "RegisterUser",
kind: MethodKind.Unary,
I: RegisterUserRequest,
O: RegisterUserResponse,
service: {
typeName: "holos.v1alpha1.HolosService"
}
} as const;

View File

@@ -1,35 +0,0 @@
// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts"
// @generated from file holos/v1alpha1/holos.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { GetUserClaimsRequest, GetUserClaimsResponse, RegisterUserRequest, RegisterUserResponse } from "./holos_pb.js";
import { MethodKind } from "@bufbuild/protobuf";
/**
* @generated from service holos.v1alpha1.HolosService
*/
export const HolosService = {
typeName: "holos.v1alpha1.HolosService",
methods: {
/**
* @generated from rpc holos.v1alpha1.HolosService.GetUserClaims
*/
getUserClaims: {
name: "GetUserClaims",
I: GetUserClaimsRequest,
O: GetUserClaimsResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc holos.v1alpha1.HolosService.RegisterUser
*/
registerUser: {
name: "RegisterUser",
I: RegisterUserRequest,
O: RegisterUserResponse,
kind: MethodKind.Unary,
},
}
} as const;

View File

@@ -1,296 +0,0 @@
// @generated by protoc-gen-es v1.6.0 with parameter "target=ts"
// @generated from file holos/v1alpha1/holos.proto (package holos.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3, Timestamp } from "@bufbuild/protobuf";
/**
* @generated from message holos.v1alpha1.Timestamps
*/
export class Timestamps extends Message<Timestamps> {
/**
* Created at timestamp
*
* @generated from field: google.protobuf.Timestamp created_at = 1;
*/
createdAt?: Timestamp;
/**
* Updated at timestamp
*
* @generated from field: google.protobuf.Timestamp updated_at = 2;
*/
updatedAt?: Timestamp;
constructor(data?: PartialMessage<Timestamps>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.Timestamps";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "created_at", kind: "message", T: Timestamp },
{ no: 2, name: "updated_at", kind: "message", T: Timestamp },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Timestamps {
return new Timestamps().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Timestamps {
return new Timestamps().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Timestamps {
return new Timestamps().fromJsonString(jsonString, options);
}
static equals(a: Timestamps | PlainMessage<Timestamps> | undefined, b: Timestamps | PlainMessage<Timestamps> | undefined): boolean {
return proto3.util.equals(Timestamps, a, b);
}
}
/**
* Empty request, claims are pulled from the id token
*
* @generated from message holos.v1alpha1.GetUserClaimsRequest
*/
export class GetUserClaimsRequest extends Message<GetUserClaimsRequest> {
constructor(data?: PartialMessage<GetUserClaimsRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.GetUserClaimsRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserClaimsRequest {
return new GetUserClaimsRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserClaimsRequest {
return new GetUserClaimsRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserClaimsRequest {
return new GetUserClaimsRequest().fromJsonString(jsonString, options);
}
static equals(a: GetUserClaimsRequest | PlainMessage<GetUserClaimsRequest> | undefined, b: GetUserClaimsRequest | PlainMessage<GetUserClaimsRequest> | undefined): boolean {
return proto3.util.equals(GetUserClaimsRequest, a, b);
}
}
/**
* UserClaims represents id token claims
*
* @generated from message holos.v1alpha1.GetUserClaimsResponse
*/
export class GetUserClaimsResponse extends Message<GetUserClaimsResponse> {
/**
* @generated from field: string iss = 1;
*/
iss = "";
/**
* @generated from field: string sub = 2;
*/
sub = "";
/**
* @generated from field: string email = 3;
*/
email = "";
/**
* @generated from field: bool email_verified = 4;
*/
emailVerified = false;
/**
* @generated from field: string name = 5;
*/
name = "";
constructor(data?: PartialMessage<GetUserClaimsResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.GetUserClaimsResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "iss", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "sub", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 4, name: "email_verified", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 5, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserClaimsResponse {
return new GetUserClaimsResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserClaimsResponse {
return new GetUserClaimsResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserClaimsResponse {
return new GetUserClaimsResponse().fromJsonString(jsonString, options);
}
static equals(a: GetUserClaimsResponse | PlainMessage<GetUserClaimsResponse> | undefined, b: GetUserClaimsResponse | PlainMessage<GetUserClaimsResponse> | undefined): boolean {
return proto3.util.equals(GetUserClaimsResponse, a, b);
}
}
/**
* User represents a human user in the system. See db schema in ent/schema/user.go
*
* @generated from message holos.v1alpha1.User
*/
export class User extends Message<User> {
/**
* Unique id assigned by the server.
*
* @generated from field: string id = 1;
*/
id = "";
/**
* @generated from field: string email = 2;
*/
email = "";
/**
* @generated from field: bool email_verified = 3;
*/
emailVerified = false;
/**
* @generated from field: string name = 4;
*/
name = "";
/**
* @generated from field: holos.v1alpha1.Timestamps timestamps = 5;
*/
timestamps?: Timestamps;
constructor(data?: PartialMessage<User>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.User";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "email_verified", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 4, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 5, name: "timestamps", kind: "message", T: Timestamps },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): User {
return new User().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): User {
return new User().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): User {
return new User().fromJsonString(jsonString, options);
}
static equals(a: User | PlainMessage<User> | undefined, b: User | PlainMessage<User> | undefined): boolean {
return proto3.util.equals(User, a, b);
}
}
/**
* @generated from message holos.v1alpha1.RegisterUserRequest
*/
export class RegisterUserRequest extends Message<RegisterUserRequest> {
/**
* @generated from field: optional string name = 1;
*/
name?: string;
constructor(data?: PartialMessage<RegisterUserRequest>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.RegisterUserRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RegisterUserRequest {
return new RegisterUserRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RegisterUserRequest {
return new RegisterUserRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RegisterUserRequest {
return new RegisterUserRequest().fromJsonString(jsonString, options);
}
static equals(a: RegisterUserRequest | PlainMessage<RegisterUserRequest> | undefined, b: RegisterUserRequest | PlainMessage<RegisterUserRequest> | undefined): boolean {
return proto3.util.equals(RegisterUserRequest, a, b);
}
}
/**
* @generated from message holos.v1alpha1.RegisterUserResponse
*/
export class RegisterUserResponse extends Message<RegisterUserResponse> {
/**
* @generated from field: holos.v1alpha1.User user = 1;
*/
user?: User;
/**
* @generated from field: bool already_exists = 2;
*/
alreadyExists = false;
constructor(data?: PartialMessage<RegisterUserResponse>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "holos.v1alpha1.RegisterUserResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "user", kind: "message", T: User },
{ no: 2, name: "already_exists", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RegisterUserResponse {
return new RegisterUserResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RegisterUserResponse {
return new RegisterUserResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RegisterUserResponse {
return new RegisterUserResponse().fromJsonString(jsonString, options);
}
static equals(a: RegisterUserResponse | PlainMessage<RegisterUserResponse> | undefined, b: RegisterUserResponse | PlainMessage<RegisterUserResponse> | undefined): boolean {
return proto3.util.equals(RegisterUserResponse, a, b);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write src/**/*.{js,jsx,ts,tsx,json,css,scss,md}",
"preview": "vite preview",
"prepare": "cd .. && husky install frontend/.husky"
"prepare": "cd ../../.. && husky install internal/server/frontend/.husky"
},
"husky": {
"hooks": {
@@ -22,10 +22,10 @@
]
},
"dependencies": {
"@bufbuild/protobuf": "^1.6.0",
"@connectrpc/connect": "^1.3.0",
"@connectrpc/connect-query": "^1.1.3",
"@connectrpc/connect-web": "^1.3.0",
"@bufbuild/protobuf": "^1.8.0",
"@connectrpc/connect": "^1.4.0",
"@connectrpc/connect-query": "^1.3.1",
"@connectrpc/connect-web": "^1.4.0",
"@patternfly/patternfly": "^5.1.0",
"@patternfly/react-core": "^5.1.2",
"react": "^18.2.0",
@@ -33,10 +33,10 @@
"react-router-dom": "^6.21.1"
},
"devDependencies": {
"@bufbuild/buf": "^1.28.1",
"@bufbuild/protoc-gen-es": "^1.6.0",
"@connectrpc/protoc-gen-connect-es": "^1.3.0",
"@connectrpc/protoc-gen-connect-query": "^1.1.3",
"@bufbuild/buf": "^1.30.1",
"@bufbuild/protoc-gen-es": "^1.8.0",
"@connectrpc/protoc-gen-connect-es": "^1.4.0",
"@connectrpc/protoc-gen-connect-query": "^1.3.1",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.14.0",
@@ -51,6 +51,6 @@
"prettier": "^3.1.1",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"vite-tsconfig-paths": "^4.2.3"
"vite-tsconfig-paths": "^4.3.2"
}
}

View File

@@ -10,7 +10,7 @@ import {
EmptyStateIcon,
EmptyStateVariant,
} from "@patternfly/react-core";
import PathMissingIcon from "@patternfly/react-icons/dist/esm/icons/pathMissing-icon";
import PathMissingIcon from "@patternfly/react-icons/dist/esm/icons/path-missing-icon";
const PageNotFound: React.FunctionComponent = () => (
<EmptyState variant={EmptyStateVariant.xl}>

View File

@@ -6,8 +6,8 @@ import (
"connectrpc.com/connect"
"github.com/holos-run/holos/internal/server/ent"
"github.com/holos-run/holos/internal/server/middleware/authn"
holos "github.com/holos-run/holos/internal/server/service/gen/holos/v1alpha1"
"github.com/holos-run/holos/pkg/errors"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
"google.golang.org/protobuf/types/known/timestamppb"
)

View File

@@ -15,10 +15,10 @@ import (
"github.com/holos-run/holos/internal/server/ent"
"github.com/holos-run/holos/internal/server/handler"
"github.com/holos-run/holos/internal/server/middleware/authn"
holosSvc "github.com/holos-run/holos/internal/server/service/gen/holos/v1alpha1"
"github.com/holos-run/holos/internal/server/service/gen/holos/v1alpha1/holosconnect"
"github.com/holos-run/holos/internal/server/testutils"
"github.com/holos-run/holos/pkg/holos"
holosSvc "github.com/holos-run/holos/service/gen/holos/v1alpha1"
"github.com/holos-run/holos/service/gen/holos/v1alpha1/holosconnect"
"github.com/stretchr/testify/assert"
)

View File

@@ -9,8 +9,8 @@ import (
"github.com/holos-run/holos/internal/server/ent/useridentity"
"github.com/holos-run/holos/internal/server/middleware/authn"
"github.com/holos-run/holos/internal/server/middleware/logger"
holos "github.com/holos-run/holos/internal/server/service/gen/holos/v1alpha1"
"github.com/holos-run/holos/pkg/errors"
holos "github.com/holos-run/holos/service/gen/holos/v1alpha1"
)
func createUser(ctx context.Context, client *ent.Client, name string, claims authn.Identity) (*ent.User, error) {

View File

@@ -14,9 +14,9 @@ import (
"github.com/holos-run/holos/internal/server/handler"
"github.com/holos-run/holos/internal/server/middleware/authn"
"github.com/holos-run/holos/internal/server/middleware/logger"
"github.com/holos-run/holos/internal/server/service/gen/holos/v1alpha1/holosconnect"
"github.com/holos-run/holos/pkg/errors"
"github.com/holos-run/holos/pkg/holos"
"github.com/holos-run/holos/service/gen/holos/v1alpha1/holosconnect"
"github.com/prometheus/client_golang/prometheus/promhttp"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"

View File

@@ -1,8 +0,0 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: bufbuild
repository: protovalidate
commit: 0de7443d03cf41228f8a9790b12b417e
digest: shake256:3c0676a73cef06439c107cb9560627354815adbc254976f807d645de7e2c1bf19d0438d5d56d5bc92465377e0d9315951e986fc6ced2871e450534b2b8c953b0

View File

@@ -1,594 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: holos/v1alpha1/holos.proto
package holos
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Timestamps struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Created at timestamp
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
// Updated at timestamp
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
}
func (x *Timestamps) Reset() {
*x = Timestamps{}
if protoimpl.UnsafeEnabled {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Timestamps) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Timestamps) ProtoMessage() {}
func (x *Timestamps) ProtoReflect() protoreflect.Message {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Timestamps.ProtoReflect.Descriptor instead.
func (*Timestamps) Descriptor() ([]byte, []int) {
return file_holos_v1alpha1_holos_proto_rawDescGZIP(), []int{0}
}
func (x *Timestamps) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
func (x *Timestamps) GetUpdatedAt() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedAt
}
return nil
}
// Empty request, claims are pulled from the id token
type GetUserClaimsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *GetUserClaimsRequest) Reset() {
*x = GetUserClaimsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserClaimsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserClaimsRequest) ProtoMessage() {}
func (x *GetUserClaimsRequest) ProtoReflect() protoreflect.Message {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserClaimsRequest.ProtoReflect.Descriptor instead.
func (*GetUserClaimsRequest) Descriptor() ([]byte, []int) {
return file_holos_v1alpha1_holos_proto_rawDescGZIP(), []int{1}
}
// UserClaims represents id token claims
type GetUserClaimsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Iss string `protobuf:"bytes,1,opt,name=iss,proto3" json:"iss,omitempty"`
Sub string `protobuf:"bytes,2,opt,name=sub,proto3" json:"sub,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
EmailVerified bool `protobuf:"varint,4,opt,name=email_verified,json=emailVerified,proto3" json:"email_verified,omitempty"`
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
}
func (x *GetUserClaimsResponse) Reset() {
*x = GetUserClaimsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserClaimsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserClaimsResponse) ProtoMessage() {}
func (x *GetUserClaimsResponse) ProtoReflect() protoreflect.Message {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserClaimsResponse.ProtoReflect.Descriptor instead.
func (*GetUserClaimsResponse) Descriptor() ([]byte, []int) {
return file_holos_v1alpha1_holos_proto_rawDescGZIP(), []int{2}
}
func (x *GetUserClaimsResponse) GetIss() string {
if x != nil {
return x.Iss
}
return ""
}
func (x *GetUserClaimsResponse) GetSub() string {
if x != nil {
return x.Sub
}
return ""
}
func (x *GetUserClaimsResponse) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *GetUserClaimsResponse) GetEmailVerified() bool {
if x != nil {
return x.EmailVerified
}
return false
}
func (x *GetUserClaimsResponse) GetName() string {
if x != nil {
return x.Name
}
return ""
}
// User represents a human user in the system. See db schema in ent/schema/user.go
type User struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Unique id assigned by the server.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
EmailVerified bool `protobuf:"varint,3,opt,name=email_verified,json=emailVerified,proto3" json:"email_verified,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Timestamps *Timestamps `protobuf:"bytes,5,opt,name=timestamps,proto3" json:"timestamps,omitempty"`
}
func (x *User) Reset() {
*x = User{}
if protoimpl.UnsafeEnabled {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *User) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
return file_holos_v1alpha1_holos_proto_rawDescGZIP(), []int{3}
}
func (x *User) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *User) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *User) GetEmailVerified() bool {
if x != nil {
return x.EmailVerified
}
return false
}
func (x *User) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *User) GetTimestamps() *Timestamps {
if x != nil {
return x.Timestamps
}
return nil
}
type RegisterUserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name *string `protobuf:"bytes,1,opt,name=name,proto3,oneof" json:"name,omitempty"`
}
func (x *RegisterUserRequest) Reset() {
*x = RegisterUserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RegisterUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterUserRequest) ProtoMessage() {}
func (x *RegisterUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RegisterUserRequest.ProtoReflect.Descriptor instead.
func (*RegisterUserRequest) Descriptor() ([]byte, []int) {
return file_holos_v1alpha1_holos_proto_rawDescGZIP(), []int{4}
}
func (x *RegisterUserRequest) GetName() string {
if x != nil && x.Name != nil {
return *x.Name
}
return ""
}
type RegisterUserResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
AlreadyExists bool `protobuf:"varint,2,opt,name=already_exists,json=alreadyExists,proto3" json:"already_exists,omitempty"`
}
func (x *RegisterUserResponse) Reset() {
*x = RegisterUserResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RegisterUserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterUserResponse) ProtoMessage() {}
func (x *RegisterUserResponse) ProtoReflect() protoreflect.Message {
mi := &file_holos_v1alpha1_holos_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RegisterUserResponse.ProtoReflect.Descriptor instead.
func (*RegisterUserResponse) Descriptor() ([]byte, []int) {
return file_holos_v1alpha1_holos_proto_rawDescGZIP(), []int{5}
}
func (x *RegisterUserResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
func (x *RegisterUserResponse) GetAlreadyExists() bool {
if x != nil {
return x.AlreadyExists
}
return false
}
var File_holos_v1alpha1_holos_proto protoreflect.FileDescriptor
var file_holos_v1alpha1_holos_proto_rawDesc = []byte{
0x0a, 0x1a, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
0x2f, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x68, 0x6f,
0x6c, 0x6f, 0x73, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x62,
0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x01, 0x0a, 0x0a, 0x54,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x12, 0x43, 0x0a, 0x0a, 0x63, 0x72, 0x65,
0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xba, 0x48, 0x05, 0xb2, 0x01,
0x02, 0x38, 0x01, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x43,
0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08,
0xba, 0x48, 0x05, 0xb2, 0x01, 0x02, 0x38, 0x01, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x64, 0x41, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c,
0x61, 0x69, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x15,
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x69, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x62, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x75, 0x62, 0x12, 0x1d, 0x0a, 0x05, 0x65, 0x6d, 0x61,
0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x60,
0x01, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6d, 0x61, 0x69,
0x6c, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08,
0x52, 0x0d, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12,
0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba,
0x48, 0x04, 0x72, 0x02, 0x18, 0x64, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xbf, 0x01, 0x0a,
0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12,
0x1d, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
0xba, 0x48, 0x04, 0x72, 0x02, 0x60, 0x01, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x25,
0x0a, 0x0e, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72,
0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x18, 0x64, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73,
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2e, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x73, 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x22, 0x40,
0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x18, 0x64, 0x48, 0x00, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
0x22, 0x67, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2e, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73,
0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x5f, 0x65, 0x78,
0x69, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x72, 0x65,
0x61, 0x64, 0x79, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x32, 0xcb, 0x01, 0x0a, 0x0c, 0x48, 0x6f,
0x6c, 0x6f, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0d, 0x47, 0x65,
0x74, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x68, 0x6f,
0x6c, 0x6f, 0x73, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74,
0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x25, 0x2e, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x0c, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x68, 0x6f, 0x6c,
0x6f, 0x73, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69,
0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x24, 0x2e, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2d, 0x72, 0x75, 0x6e, 0x2f,
0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x2f, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x68, 0x6f, 0x6c, 0x6f, 0x73, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_holos_v1alpha1_holos_proto_rawDescOnce sync.Once
file_holos_v1alpha1_holos_proto_rawDescData = file_holos_v1alpha1_holos_proto_rawDesc
)
func file_holos_v1alpha1_holos_proto_rawDescGZIP() []byte {
file_holos_v1alpha1_holos_proto_rawDescOnce.Do(func() {
file_holos_v1alpha1_holos_proto_rawDescData = protoimpl.X.CompressGZIP(file_holos_v1alpha1_holos_proto_rawDescData)
})
return file_holos_v1alpha1_holos_proto_rawDescData
}
var file_holos_v1alpha1_holos_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_holos_v1alpha1_holos_proto_goTypes = []interface{}{
(*Timestamps)(nil), // 0: holos.v1alpha1.Timestamps
(*GetUserClaimsRequest)(nil), // 1: holos.v1alpha1.GetUserClaimsRequest
(*GetUserClaimsResponse)(nil), // 2: holos.v1alpha1.GetUserClaimsResponse
(*User)(nil), // 3: holos.v1alpha1.User
(*RegisterUserRequest)(nil), // 4: holos.v1alpha1.RegisterUserRequest
(*RegisterUserResponse)(nil), // 5: holos.v1alpha1.RegisterUserResponse
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
}
var file_holos_v1alpha1_holos_proto_depIdxs = []int32{
6, // 0: holos.v1alpha1.Timestamps.created_at:type_name -> google.protobuf.Timestamp
6, // 1: holos.v1alpha1.Timestamps.updated_at:type_name -> google.protobuf.Timestamp
0, // 2: holos.v1alpha1.User.timestamps:type_name -> holos.v1alpha1.Timestamps
3, // 3: holos.v1alpha1.RegisterUserResponse.user:type_name -> holos.v1alpha1.User
1, // 4: holos.v1alpha1.HolosService.GetUserClaims:input_type -> holos.v1alpha1.GetUserClaimsRequest
4, // 5: holos.v1alpha1.HolosService.RegisterUser:input_type -> holos.v1alpha1.RegisterUserRequest
2, // 6: holos.v1alpha1.HolosService.GetUserClaims:output_type -> holos.v1alpha1.GetUserClaimsResponse
5, // 7: holos.v1alpha1.HolosService.RegisterUser:output_type -> holos.v1alpha1.RegisterUserResponse
6, // [6:8] is the sub-list for method output_type
4, // [4:6] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_holos_v1alpha1_holos_proto_init() }
func file_holos_v1alpha1_holos_proto_init() {
if File_holos_v1alpha1_holos_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_holos_v1alpha1_holos_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Timestamps); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_holos_v1alpha1_holos_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserClaimsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_holos_v1alpha1_holos_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserClaimsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_holos_v1alpha1_holos_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*User); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_holos_v1alpha1_holos_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterUserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_holos_v1alpha1_holos_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterUserResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_holos_v1alpha1_holos_proto_msgTypes[4].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_holos_v1alpha1_holos_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_holos_v1alpha1_holos_proto_goTypes,
DependencyIndexes: file_holos_v1alpha1_holos_proto_depIdxs,
MessageInfos: file_holos_v1alpha1_holos_proto_msgTypes,
}.Build()
File_holos_v1alpha1_holos_proto = out.File
file_holos_v1alpha1_holos_proto_rawDesc = nil
file_holos_v1alpha1_holos_proto_goTypes = nil
file_holos_v1alpha1_holos_proto_depIdxs = nil
}

View File

@@ -1,132 +0,0 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: holos/v1alpha1/holos.proto
package holosconnect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
v1alpha1 "github.com/holos-run/holos/internal/server/service/gen/holos/v1alpha1"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion0_1_0
const (
// HolosServiceName is the fully-qualified name of the HolosService service.
HolosServiceName = "holos.v1alpha1.HolosService"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// HolosServiceGetUserClaimsProcedure is the fully-qualified name of the HolosService's
// GetUserClaims RPC.
HolosServiceGetUserClaimsProcedure = "/holos.v1alpha1.HolosService/GetUserClaims"
// HolosServiceRegisterUserProcedure is the fully-qualified name of the HolosService's RegisterUser
// RPC.
HolosServiceRegisterUserProcedure = "/holos.v1alpha1.HolosService/RegisterUser"
)
// HolosServiceClient is a client for the holos.v1alpha1.HolosService service.
type HolosServiceClient interface {
GetUserClaims(context.Context, *connect.Request[v1alpha1.GetUserClaimsRequest]) (*connect.Response[v1alpha1.GetUserClaimsResponse], error)
RegisterUser(context.Context, *connect.Request[v1alpha1.RegisterUserRequest]) (*connect.Response[v1alpha1.RegisterUserResponse], error)
}
// NewHolosServiceClient constructs a client for the holos.v1alpha1.HolosService service. By
// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
// connect.WithGRPC() or connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewHolosServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) HolosServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
return &holosServiceClient{
getUserClaims: connect.NewClient[v1alpha1.GetUserClaimsRequest, v1alpha1.GetUserClaimsResponse](
httpClient,
baseURL+HolosServiceGetUserClaimsProcedure,
opts...,
),
registerUser: connect.NewClient[v1alpha1.RegisterUserRequest, v1alpha1.RegisterUserResponse](
httpClient,
baseURL+HolosServiceRegisterUserProcedure,
opts...,
),
}
}
// holosServiceClient implements HolosServiceClient.
type holosServiceClient struct {
getUserClaims *connect.Client[v1alpha1.GetUserClaimsRequest, v1alpha1.GetUserClaimsResponse]
registerUser *connect.Client[v1alpha1.RegisterUserRequest, v1alpha1.RegisterUserResponse]
}
// GetUserClaims calls holos.v1alpha1.HolosService.GetUserClaims.
func (c *holosServiceClient) GetUserClaims(ctx context.Context, req *connect.Request[v1alpha1.GetUserClaimsRequest]) (*connect.Response[v1alpha1.GetUserClaimsResponse], error) {
return c.getUserClaims.CallUnary(ctx, req)
}
// RegisterUser calls holos.v1alpha1.HolosService.RegisterUser.
func (c *holosServiceClient) RegisterUser(ctx context.Context, req *connect.Request[v1alpha1.RegisterUserRequest]) (*connect.Response[v1alpha1.RegisterUserResponse], error) {
return c.registerUser.CallUnary(ctx, req)
}
// HolosServiceHandler is an implementation of the holos.v1alpha1.HolosService service.
type HolosServiceHandler interface {
GetUserClaims(context.Context, *connect.Request[v1alpha1.GetUserClaimsRequest]) (*connect.Response[v1alpha1.GetUserClaimsResponse], error)
RegisterUser(context.Context, *connect.Request[v1alpha1.RegisterUserRequest]) (*connect.Response[v1alpha1.RegisterUserResponse], error)
}
// NewHolosServiceHandler builds an HTTP handler from the service implementation. It returns the
// path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewHolosServiceHandler(svc HolosServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
holosServiceGetUserClaimsHandler := connect.NewUnaryHandler(
HolosServiceGetUserClaimsProcedure,
svc.GetUserClaims,
opts...,
)
holosServiceRegisterUserHandler := connect.NewUnaryHandler(
HolosServiceRegisterUserProcedure,
svc.RegisterUser,
opts...,
)
return "/holos.v1alpha1.HolosService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case HolosServiceGetUserClaimsProcedure:
holosServiceGetUserClaimsHandler.ServeHTTP(w, r)
case HolosServiceRegisterUserProcedure:
holosServiceRegisterUserHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedHolosServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedHolosServiceHandler struct{}
func (UnimplementedHolosServiceHandler) GetUserClaims(context.Context, *connect.Request[v1alpha1.GetUserClaimsRequest]) (*connect.Response[v1alpha1.GetUserClaimsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("holos.v1alpha1.HolosService.GetUserClaims is not implemented"))
}
func (UnimplementedHolosServiceHandler) RegisterUser(context.Context, *connect.Request[v1alpha1.RegisterUserRequest]) (*connect.Response[v1alpha1.RegisterUserResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("holos.v1alpha1.HolosService.RegisterUser is not implemented"))
}

View File

@@ -1 +1 @@
0
3

1
service/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/gen/

8
service/buf.lock Normal file
View File

@@ -0,0 +1,8 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: bufbuild
repository: protovalidate
commit: b983156c5e994cc9892e0ce3e64e17e0
digest: shake256:fb47a62989d38c2529bcc5cd86ded43d800eb84cee82b42b9e8a9e815d4ee8134a0fb9d0ce8299b27c2d2bbb7d6ade0c4ad5a8a4d467e1e2c7ca619ae9f634e2

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package holos.v1alpha1;
option go_package = "github.com/holos-run/holos/internal/server/service/gen/holos/v1alpha1;holos";
option go_package = "github.com/holos-run/holos/service/gen/holos/v1alpha1;holos";
import "google/protobuf/timestamp.proto";
// git clone https://github.com/bufbuild/protovalidate then add <parent>/protovalidate/proto/protovalidate to your editor proto search path