From f8cdf6bf45ed18d8d003e4e6009c83ffc3b8298b Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Sat, 30 Mar 2024 04:17:24 -0700 Subject: [PATCH] update ts --- client/core/ts/src/responses.ts | 2 +- client/core/ts/src/types.ts | 100 ++++++++++++++++---------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/client/core/ts/src/responses.ts b/client/core/ts/src/responses.ts index 053947116..43a95d3f9 100644 --- a/client/core/ts/src/responses.ts +++ b/client/core/ts/src/responses.ts @@ -5,11 +5,11 @@ export type AuthResponses = { CreateLocalUser: Types.CreateLocalUserResponse; LoginLocalUser: Types.LoginLocalUserResponse; ExchangeForJwt: Types.ExchangeForJwtResponse; + GetUser: Types.GetUserResponse; }; export type ReadResponses = { GetVersion: Types.GetVersionResponse; - GetUser: Types.GetUserResponse; GetUsers: Types.GetUsersResponse; GetUsername: Types.GetUsernameResponse; GetCoreInfo: Types.GetCoreInfoResponse; diff --git a/client/core/ts/src/types.ts b/client/core/ts/src/types.ts index 36e28a17c..cffbbec77 100644 --- a/client/core/ts/src/types.ts +++ b/client/core/ts/src/types.ts @@ -8,8 +8,53 @@ export interface MongoIdObj { export type MongoId = MongoIdObj; +export type UserConfig = + /** User that logs in with username / password */ + | { type: "Local", data: { + password: string; +}} + /** User that logs in via Google Oauth */ + | { type: "Google", data: { + google_id: string; + avatar: string; +}} + /** User that logs in via Github Oauth */ + | { type: "Github", data: { + github_id: string; + avatar: string; +}} + /** Non-human managed user, can have it's own permissions / api keys */ + | { type: "Service", data: { + description: string; +}}; + export type I64 = number; +export type ResourceTarget = + | { type: "System", id: string } + | { type: "Build", id: string } + | { type: "Builder", id: string } + | { type: "Deployment", id: string } + | { type: "Server", id: string } + | { type: "Repo", id: string } + | { type: "Alerter", id: string } + | { type: "Procedure", id: string }; + +export interface User { + _id?: MongoId; + username: string; + enabled?: boolean; + admin?: boolean; + create_server_permissions?: boolean; + create_build_permissions?: boolean; + config: UserConfig; + last_update_view?: I64; + recently_viewed?: ResourceTarget[]; + updated_at?: I64; +} + +export type GetUserResponse = User; + export interface Resource { _id?: MongoId; name: string; @@ -252,51 +297,6 @@ export interface DeploymentActionState { export type GetDeploymentActionStateResponse = DeploymentActionState; -export type UserConfig = - /** User that logs in with username / password */ - | { type: "Local", data: { - password: string; -}} - /** User that logs in via Google Oauth */ - | { type: "Google", data: { - google_id: string; - avatar: string; -}} - /** User that logs in via Github Oauth */ - | { type: "Github", data: { - github_id: string; - avatar: string; -}} - /** Non-human managed user, can have it's own permissions / api keys */ - | { type: "Service", data: { - description: string; -}}; - -export type ResourceTarget = - | { type: "System", id: string } - | { type: "Build", id: string } - | { type: "Builder", id: string } - | { type: "Deployment", id: string } - | { type: "Server", id: string } - | { type: "Repo", id: string } - | { type: "Alerter", id: string } - | { type: "Procedure", id: string }; - -export interface User { - _id?: MongoId; - username: string; - enabled?: boolean; - admin?: boolean; - create_server_permissions?: boolean; - create_build_permissions?: boolean; - config: UserConfig; - last_update_view?: I64; - recently_viewed?: ResourceTarget[]; - updated_at?: I64; -} - -export type GetUserResponse = User; - export interface ApiKey { /** UNIQUE KEY ASSOCIATED WITH SECRET */ key: string; @@ -856,6 +856,9 @@ export interface ExchangeForJwtResponse { jwt: string; } +export interface GetUser { +} + export interface RunBuild { /** Can be id or name */ build: string; @@ -1161,9 +1164,6 @@ export interface GetVersionResponse { version: string; } -export interface GetUser { -} - export interface ListApiKeys { } @@ -1777,7 +1777,8 @@ export type AuthRequest = | { type: "GetLoginOptions", params: GetLoginOptions } | { type: "CreateLocalUser", params: CreateLocalUser } | { type: "LoginLocalUser", params: LoginLocalUser } - | { type: "ExchangeForJwt", params: ExchangeForJwt }; + | { type: "ExchangeForJwt", params: ExchangeForJwt } + | { type: "GetUser", params: GetUser }; export type ExecuteRequest = | { type: "PruneContainers", params: PruneDockerContainers } @@ -1796,7 +1797,6 @@ export type ExecuteRequest = export type ReadRequest = | { type: "GetVersion", params: GetVersion } - | { type: "GetUser", params: GetUser } | { type: "GetUsers", params: GetUsers } | { type: "GetUsername", params: GetUsername } | { type: "GetCoreInfo", params: GetCoreInfo }