This commit is contained in:
2019-09-21 02:58:42 +02:00
11 changed files with 54 additions and 39 deletions
+22
View File
@@ -0,0 +1,22 @@
kind: pipeline
name: default
steps:
- name: npm install
image: node:12
commands:
- npm install
- name: npm run build
image: node:12
commands:
- npm run build
- name: npm publish
image: plugins/npm
settings:
username: frontwork
password:
from_secret: npm_password
email: frontwork.me@gmail.com
+1 -2
View File
@@ -1,4 +1,5 @@
node_modules node_modules
js
src/**/*.js src/**/*.js
src/**/*.d.ts src/**/*.d.ts
@@ -8,5 +9,3 @@ test/**/*.d.ts
*.d.ts *.d.ts
*.js *.js
lib
+9 -1
View File
@@ -1,7 +1,15 @@
import * as Back from './src/Backend'; import * as Back from './src/Backend';
import * as Front from './src/Frontend'; import * as Front from './src/Frontend';
import * as Types from './src/Types';
import * as Utils from './src/Utils';
import * as Interfaces from './src/Interfaces';
import * as Responses from './src/Responses';
export { export {
Back as Backend, Back as Backend,
Front as Frontend Front as Frontend,
Types,
Utils,
Interfaces,
Responses
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "rpclibrary", "name": "rpclibrary",
"version": "1.0.3", "version": "1.0.4",
"description": "", "description": "",
"main": "./js/Index.js", "main": "./js/Index.js",
"scripts": { "scripts": {
+1 -9
View File
@@ -6,16 +6,8 @@ import bsock = require('bsock');
import * as T from './Types'; import * as T from './Types';
import * as U from './Utils'; import * as U from './Utils';
import * as I from './Interfaces'; import * as I from './Interfaces';
import * as R from './Responses';
export { export class RPCServer{
T as Types,
U as Utils,
I as Interfaces,
R as Responses
}
export class Server{
private ws = http.createServer() private ws = http.createServer()
private io = bsock.createServer() private io = bsock.createServer()
private visibility:T.Visibility private visibility:T.Visibility
+2 -11
View File
@@ -3,27 +3,18 @@
import bsock = require('bsock'); import bsock = require('bsock');
import * as T from './Types'; import * as T from './Types';
import * as U from './Utils';
import * as I from './Interfaces'; import * as I from './Interfaces';
import * as R from './Responses';
export {
T as Types,
U as Utils,
I as Interfaces,
R as Responses
}
//fix args with defaults like "force = true" -> "force" //fix args with defaults like "force = true" -> "force"
function stripAfterEquals(str:string){ function stripAfterEquals(str:string){
return str.split("=")[0] return str.split("=")[0]
} }
export class Client implements I.Socket{ export class RPCSocket implements I.Socket{
private socket: I.Socket private socket: I.Socket
constructor(public port:number, private server: string, private tls: boolean = false){ constructor(public port:number, private server: string, private tls: boolean = false){
Object.defineProperty(this, 'socket', {value: undefined, writable: true})
} }
public hook(name: T.Name, args: T.Arg){ public hook(name: T.Name, args: T.Arg){
-1
View File
@@ -1,7 +1,6 @@
export type Outcome = "Success" | "Error" export type Outcome = "Success" | "Error"
/* Responses */
export class Response{ export class Response{
constructor( constructor(
public message?:string public message?:string
+9 -4
View File
@@ -1,9 +1,9 @@
const path = require('path'); const path = require('path');
const frontendConf = { module.exports = {
mode: 'production', mode: 'production',
target: "web", target: "web",
entry: path.resolve(__dirname, '..', 'js', 'src', 'Frontend.js'), entry: path.resolve(__dirname, 'Frontend.ts'),
output: { output: {
path: path.resolve(__dirname, '..', 'js', 'rpclibrary.browser.js'), path: path.resolve(__dirname, '..', 'js', 'rpclibrary.browser.js'),
filename: "Frontend.js", filename: "Frontend.js",
@@ -12,9 +12,14 @@ const frontendConf = {
resolve: { resolve: {
extensions: [".ts", ".tsx", ".js"] extensions: [".ts", ".tsx", ".js"]
}, },
module: {
rules: [
{ test: /\.ts?$/, loader: "ts-loader" }
]
},
optimization: { optimization: {
minimize: false, minimize: false,
}, },
externals: {
}
} }
module.exports = [frontendConf]
+3 -3
View File
@@ -1,9 +1,9 @@
import { Server } from '../src/Backend' import { RPCServer } from '../src/Backend'
import { SubscriptionResponse } from '../src/Responses' import { SubscriptionResponse } from '../src/Responses'
let subcallback let subcallback
new Server(20000, [{ new RPCServer(20000, [{
name: "HelloWorldRPCGroup", name: "HelloWorldRPCGroup",
exportRPCs: () => [{ exportRPCs: () => [{
type: 'Call', type: 'Call',
@@ -25,7 +25,7 @@ new Server(20000, [{
}]) }])
try{ try{
new Server(20001, [{ new RPCServer(20001, [{
name: "bad", name: "bad",
exportRPCs: () => [ exportRPCs: () => [
(aaa,bbb,ccc) => { return aaa+bbb+ccc } (aaa,bbb,ccc) => { return aaa+bbb+ccc }
+2 -3
View File
@@ -1,6 +1,5 @@
import { Client } from '../src/Frontend' import { RPCSocket } from '../src/Frontend'
console.log(Client) const client = new RPCSocket(20000, 'localhost')
const client = new Client(20000, 'localhost')
client.connect().then(async _ => { client.connect().then(async _ => {
await client.info().then(console.log) await client.info().then(console.log)
+1 -1
View File
@@ -1 +1 @@
<script src="../lib/RPCaller.min.js"></script> <script src="../js/Frontend.min.js"></script>