absolutely massive typescript porting time

This commit is contained in:
41666 2019-06-02 18:58:15 -05:00
parent 01f238f515
commit 30d08a630f
No known key found for this signature in database
GPG key ID: BC51D07640DC10AF
159 changed files with 2563 additions and 3861 deletions

View file

@ -0,0 +1,14 @@
linters:
lib/*.{js,jsx}:
- standard --fix
- git add
lib/*.d.ts:
- tslint --fix
- git add
src/*.{ts,tsx}:
- tslint --fix
- stylelint --fix
- jest --bail --findRelatedTests
- git add

View file

@ -0,0 +1,18 @@
{
"name": "@roleypoly/rpc",
"version": "2.0.0",
"devDependencies": {
"lint-staged": "^8.1.7",
"tslint": "^5.17.0",
"typescript": "^3.5.1"
},
"scripts": {
"generate": "bentoc ./**/*.proto",
"build": "tsc",
"precommit": "lint-staged"
},
"private": true,
"dependencies": {
"@kayteh/bento": "^0.1.1"
}
}

View file

@ -0,0 +1,11 @@
/**
* GENERATED FILE. This file was generated by @kayteh/bento. Editing it is a bad idea.
* @generated
*/
import Bento, { IBentoTransport } from '@kayteh/bento'
export type ServerSlug = {
id?: string
name?: string
ownerID?: string
icon?: string
}

View file

@ -0,0 +1,8 @@
syntax = "proto3";
message ServerSlug {
string id = 1;
string name = 2;
string ownerID = 3;
string icon = 4;
}

View file

@ -0,0 +1,41 @@
/**
* GENERATED FILE. This file was generated by @kayteh/bento. Editing it is a bad idea.
* @generated
*/
import Bento, { IBentoTransport } from '@kayteh/bento'
export type ServerQuery = {
id: string
}
export type RootServerItem = {
url?: string
name?: string
members?: number
roles?: number
}
export type RootServerOverview = {
servers?: RootServerItem[]
}
export type ServerSlug = {
id?: string
name?: string
ownerID?: string
icon?: string
}
export interface IServersService {
getServerSlug (ctx: any, request: ServerQuery): Promise<ServerSlug> | ServerSlug
rootGetAllServers (ctx: any, request: void): Promise<RootServerOverview> | RootServerOverview
}
export class ServersClient {
static __SERVICE__: string = 'Servers'
constructor (private bento: Bento, private transport?: IBentoTransport) {}
async getServerSlug (request: ServerQuery): Promise<ServerSlug> {
return this.bento.makeRequest(this.transport || undefined, 'Servers', 'GetServerSlug', request)
}
async rootGetAllServers (request: void): Promise<RootServerOverview> {
return this.bento.makeRequest(this.transport || undefined, 'Servers', 'RootGetAllServers', request)
}
}

View file

@ -0,0 +1,31 @@
syntax = "proto3";
import "../proto-lib/types.proto";
message void {
option render.exclude = true;
};
service Servers {
rpc GetServerSlug (ServerQuery) returns (ServerSlug) {};
// for root only, get all servers for whatever reason
rpc RootGetAllServers (void) returns (RootServerOverview) {
option secureAs.root = true;
};
};
message ServerQuery {
required string id = 1;
}
message RootServerItem {
string url = 1;
string name = 2;
int32 members = 3;
int32 roles = 4;
}
message RootServerOverview {
repeated RootServerItem servers = 1;
};

View file

@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib"
},
"include": [
"./src"
]
}

View file

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}