@nsshunt/stsappframework 3.0.103 → 3.0.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authutilsnode.js +6 -7
- package/dist/authutilsnode.js.map +1 -1
- package/dist/influxdb/influxDBManager.js +16 -17
- package/dist/influxdb/influxDBManager.js.map +1 -1
- package/dist/influxdb/influxDBManagerAgent.js +9 -13
- package/dist/influxdb/influxDBManagerAgent.js.map +1 -1
- package/dist/influxdb/influxDBManagerBase.js +2 -6
- package/dist/influxdb/influxDBManagerBase.js.map +1 -1
- package/dist/influxdb/influxDBManagerService.js +10 -14
- package/dist/influxdb/influxDBManagerService.js.map +1 -1
- package/dist/instrumentationsubscriber.js +11 -15
- package/dist/instrumentationsubscriber.js.map +1 -1
- package/dist/kafka/IMKafkaManager.js +2 -6
- package/dist/kafka/IMKafkaManager.js.map +1 -1
- package/dist/kafkatesting/produce.js +1 -5
- package/dist/kafkatesting/produce.js.map +1 -1
- package/dist/masterprocessbase.js +19 -20
- package/dist/masterprocessbase.js.map +1 -1
- package/dist/processbase.js +8 -10
- package/dist/processbase.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/singleprocessbase.js +3 -4
- package/dist/singleprocessbase.js.map +1 -1
- package/dist/tcpclient/app2.js +2 -2
- package/dist/tcpserver/appmaster.js +39 -16
- package/dist/tcpserver/appmaster.js.map +1 -1
- package/dist/workerprocessbase.js +3 -4
- package/dist/workerprocessbase.js.map +1 -1
- package/package.json +7 -7
- package/src/authutilsnode.ts +8 -10
- package/src/influxdb/influxDBManager.ts +16 -18
- package/src/influxdb/influxDBManagerAgent.ts +9 -11
- package/src/influxdb/influxDBManagerBase.ts +2 -4
- package/src/influxdb/influxDBManagerService.ts +10 -12
- package/src/instrumentationsubscriber.ts +11 -14
- package/src/kafka/IMKafkaManager.ts +2 -4
- package/src/kafkatesting/produce.ts +1 -3
- package/src/masterprocessbase.ts +32 -24
- package/src/processbase.ts +7 -11
- package/src/server.ts +1 -1
- package/src/singleprocessbase.ts +3 -5
- package/src/tcpclient/app2.ts +2 -2
- package/src/tcpserver/appmaster.ts +39 -17
- package/src/workerprocessbase.ts +3 -5
- package/types/authutilsnode.d.ts.map +1 -1
- package/types/influxdb/influxDBManager.d.ts.map +1 -1
- package/types/influxdb/influxDBManagerAgent.d.ts.map +1 -1
- package/types/influxdb/influxDBManagerBase.d.ts.map +1 -1
- package/types/influxdb/influxDBManagerService.d.ts.map +1 -1
- package/types/instrumentationsubscriber.d.ts.map +1 -1
- package/types/kafka/IMKafkaManager.d.ts.map +1 -1
- package/types/masterprocessbase.d.ts.map +1 -1
- package/types/processbase.d.ts +2 -2
- package/types/processbase.d.ts.map +1 -1
- package/types/singleprocessbase.d.ts.map +1 -1
- package/types/tcpserver/appmaster.d.ts.map +1 -1
- package/types/workerprocessbase.d.ts.map +1 -1
- package/src_new/authDefs.ts +0 -37
- package/src_new/authutilsnode.ts +0 -375
- package/src_new/commonTypes.ts +0 -239
- package/src_new/index.ts +0 -22
- package/src_new/influxdb/influxDBManager.ts +0 -972
- package/src_new/influxdb/influxDBManagerAgent.ts +0 -316
- package/src_new/influxdb/influxDBManagerBase.ts +0 -111
- package/src_new/influxdb/influxDBManagerService.ts +0 -375
- package/src_new/instrumentationsubscriber.ts +0 -286
- package/src_new/kafka/IMKafkaManager.ts +0 -154
- package/src_new/kafka/kafkaconsumer.ts +0 -82
- package/src_new/kafka/kafkamanager.ts +0 -186
- package/src_new/kafka/kafkaproducer.ts +0 -58
- package/src_new/kafkatesting/config.ts +0 -10
- package/src_new/kafkatesting/consume.ts +0 -116
- package/src_new/kafkatesting/produce.ts +0 -155
- package/src_new/masterprocessbase.ts +0 -590
- package/src_new/middleware/serverNetworkMiddleware.ts +0 -240
- package/src_new/network.ts +0 -36
- package/src_new/processbase.ts +0 -413
- package/src_new/processoptions.ts +0 -164
- package/src_new/publishertransports/publishTransportDirect.ts +0 -45
- package/src_new/publishertransports/publishTransportUtils.ts +0 -53
- package/src_new/server.ts +0 -141
- package/src_new/serverprocessbase.ts +0 -393
- package/src_new/singleprocessbase.ts +0 -123
- package/src_new/socketIoServerHelper.ts +0 -177
- package/src_new/stscontrollerbase.ts +0 -15
- package/src_new/stslatencycontroller.ts +0 -27
- package/src_new/stslatencyroute.ts +0 -16
- package/src_new/stsrouterbase.ts +0 -22
- package/src_new/tcpclient/app.ts +0 -19
- package/src_new/tcpclient/app2.ts +0 -56
- package/src_new/tcpserver/app.ts +0 -11
- package/src_new/tcpserver/appConfig.ts +0 -65
- package/src_new/tcpserver/appmaster.ts +0 -522
- package/src_new/validation/errors.ts +0 -6
- package/src_new/webworkertesting/app.ts +0 -49
- package/src_new/webworkertesting/worker.ts +0 -24
- package/src_new/workerprocessbase.test.ts +0 -47
- package/src_new/workerprocessbase.ts +0 -187
- package/src_working/authDefs.ts +0 -37
- package/src_working/authutilsnode.ts +0 -373
- package/src_working/commonTypes.ts +0 -239
- package/src_working/index.ts +0 -22
- package/src_working/influxdb/influxDBManager.ts +0 -970
- package/src_working/influxdb/influxDBManagerAgent.ts +0 -314
- package/src_working/influxdb/influxDBManagerBase.ts +0 -109
- package/src_working/influxdb/influxDBManagerService.ts +0 -373
- package/src_working/instrumentationsubscriber.ts +0 -283
- package/src_working/kafka/IMKafkaManager.ts +0 -152
- package/src_working/kafka/kafkaconsumer.ts +0 -82
- package/src_working/kafka/kafkamanager.ts +0 -186
- package/src_working/kafka/kafkaproducer.ts +0 -58
- package/src_working/kafkatesting/config.ts +0 -10
- package/src_working/kafkatesting/consume.ts +0 -116
- package/src_working/kafkatesting/produce.ts +0 -153
- package/src_working/masterprocessbase.ts +0 -598
- package/src_working/middleware/serverNetworkMiddleware.ts +0 -240
- package/src_working/network.ts +0 -36
- package/src_working/processbase.ts +0 -411
- package/src_working/processoptions.ts +0 -164
- package/src_working/publishertransports/publishTransportDirect.ts +0 -45
- package/src_working/publishertransports/publishTransportUtils.ts +0 -53
- package/src_working/server.ts +0 -141
- package/src_working/serverprocessbase.ts +0 -393
- package/src_working/singleprocessbase.ts +0 -121
- package/src_working/socketIoServerHelper.ts +0 -177
- package/src_working/stscontrollerbase.ts +0 -15
- package/src_working/stslatencycontroller.ts +0 -27
- package/src_working/stslatencyroute.ts +0 -16
- package/src_working/stsrouterbase.ts +0 -22
- package/src_working/tcpclient/app.ts +0 -19
- package/src_working/tcpclient/app2.ts +0 -56
- package/src_working/tcpserver/app.ts +0 -11
- package/src_working/tcpserver/appConfig.ts +0 -65
- package/src_working/tcpserver/appmaster.ts +0 -544
- package/src_working/validation/errors.ts +0 -6
- package/src_working/webworkertesting/app.ts +0 -49
- package/src_working/webworkertesting/worker.ts +0 -24
- package/src_working/workerprocessbase.test.ts +0 -47
- package/src_working/workerprocessbase.ts +0 -185
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
-
import { IProcessBase } from './commonTypes';
|
|
3
|
-
|
|
4
|
-
export abstract class STSControllerBase
|
|
5
|
-
{
|
|
6
|
-
#stsApp: any;
|
|
7
|
-
|
|
8
|
-
constructor(stsApp: IProcessBase) {
|
|
9
|
-
this.#stsApp = stsApp;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get stsApp(): IProcessBase {
|
|
13
|
-
return this.#stsApp
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
-
import { StatusCodes } from 'http-status-codes'
|
|
3
|
-
import { STSControllerBase } from './stscontrollerbase'
|
|
4
|
-
import { IProcessBase } from './commonTypes'
|
|
5
|
-
|
|
6
|
-
export class STSLatencyController extends STSControllerBase
|
|
7
|
-
{
|
|
8
|
-
constructor(stsApp: IProcessBase) {
|
|
9
|
-
super(stsApp);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// curl http://localhost:3000/api/v1/latency/latency
|
|
13
|
-
async stslatency(req: any, res: any)
|
|
14
|
-
{
|
|
15
|
-
try {
|
|
16
|
-
const retVal = {
|
|
17
|
-
data: `Ping Completed At: ${Date.now()}`,
|
|
18
|
-
pid: process.pid,
|
|
19
|
-
ppid: process.ppid
|
|
20
|
-
};
|
|
21
|
-
return res.status(StatusCodes.OK).send(retVal);
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error(error);
|
|
24
|
-
return res.status(StatusCodes.INTERNAL_SERVER_ERROR).send( { status: StatusCodes.INTERNAL_SERVER_ERROR, error: 'Operation was not successful', detail: error } );
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { STSRouterBase } from './stsrouterbase'
|
|
2
|
-
import { STSLatencyController } from './stslatencycontroller'
|
|
3
|
-
import { IProcessBase } from './commonTypes'
|
|
4
|
-
|
|
5
|
-
export class STSLatencyRoute extends STSRouterBase
|
|
6
|
-
{
|
|
7
|
-
constructor(stsApp: IProcessBase)
|
|
8
|
-
{
|
|
9
|
-
super(stsApp);
|
|
10
|
-
|
|
11
|
-
const latencyController = new STSLatencyController(stsApp);
|
|
12
|
-
const { stslatency } = latencyController;
|
|
13
|
-
|
|
14
|
-
this.router.get('/latency', stslatency.bind(latencyController)); // Create new test
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src_new/stsrouterbase.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
-
import { Router } from 'express';
|
|
3
|
-
import { IProcessBase } from './commonTypes';
|
|
4
|
-
|
|
5
|
-
export abstract class STSRouterBase
|
|
6
|
-
{
|
|
7
|
-
#router: Router;
|
|
8
|
-
#stsApp: any;
|
|
9
|
-
|
|
10
|
-
constructor(stsApp: IProcessBase) {
|
|
11
|
-
this.#stsApp = stsApp;
|
|
12
|
-
this.#router = Router();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get router(): Router {
|
|
16
|
-
return this.#router;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get stsApp(): IProcessBase {
|
|
20
|
-
return this.#stsApp
|
|
21
|
-
}
|
|
22
|
-
}
|
package/src_new/tcpclient/app.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
2
|
-
import jayson from 'jayson'
|
|
3
|
-
|
|
4
|
-
// Read node's tls documentation for more information about these options:
|
|
5
|
-
// https://nodejs.org/api/tls.html#tls_tls_connect_options_callback
|
|
6
|
-
const options: jayson.TcpClientOptions = {
|
|
7
|
-
port: 3003,
|
|
8
|
-
host: 'stscore.stsmda.org'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const client = jayson.client.tls(options);
|
|
12
|
-
|
|
13
|
-
// create a client
|
|
14
|
-
|
|
15
|
-
// invoke "add"
|
|
16
|
-
client.request('add', [1, 1], function(err: any, response: any) {
|
|
17
|
-
if(err) throw err;
|
|
18
|
-
console.log(response.result); // 2
|
|
19
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-explicit-any: 0, @typescript-eslint/no-unused-vars: 0 */ // --> OFF
|
|
2
|
-
import tls from 'tls';
|
|
3
|
-
import { Sleep } from '@nsshunt/stsutils'
|
|
4
|
-
|
|
5
|
-
import 'colors'
|
|
6
|
-
|
|
7
|
-
const options = {
|
|
8
|
-
port: 3003,
|
|
9
|
-
host: 'stscore.stsmda.org'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const done: boolean[] = [];
|
|
13
|
-
|
|
14
|
-
const dosomework = (socket: any, index: number) => {
|
|
15
|
-
console.log('Connected');
|
|
16
|
-
socket.write("Hello From Client " + JSON.stringify(socket.address()));
|
|
17
|
-
(async () => {
|
|
18
|
-
for (;;) {
|
|
19
|
-
const msg = `${new Date()}: Hello`;
|
|
20
|
-
console.log(`sending: [${msg}]`);
|
|
21
|
-
socket.write(msg);
|
|
22
|
-
await Sleep(1000);
|
|
23
|
-
if (done[index]) {
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
})();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (let i=0; i < 6; i++) {
|
|
31
|
-
const socket1 = tls.connect(options);
|
|
32
|
-
done[i] = false;
|
|
33
|
-
socket1.on('secureConnect', () => {
|
|
34
|
-
dosomework(socket1, i);
|
|
35
|
-
});
|
|
36
|
-
socket1.on('close', function(data: any) {
|
|
37
|
-
console.log(`CLOSED: ${socket1.remoteAddress} ${socket1.remotePort}`.yellow);
|
|
38
|
-
done[i]=true;
|
|
39
|
-
});
|
|
40
|
-
socket1.on('data', function(data: any) {
|
|
41
|
-
console.log(`DATA ${socket1.remoteAddress} ${socket1.remotePort} ${data}`.yellow);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/*
|
|
46
|
-
const socket2 = tls.connect(options);
|
|
47
|
-
socket2.on('secureConnect', () => {
|
|
48
|
-
dosomework(socket2);
|
|
49
|
-
});
|
|
50
|
-
socket2.on('close', function(data: any) {
|
|
51
|
-
console.log(chalk.green(`CLOSED: ${socket2.remoteAddress} ${socket2.remotePort}`));
|
|
52
|
-
});
|
|
53
|
-
socket2.on('data', function(data: any) {
|
|
54
|
-
console.log(chalk.green(`DATA ${socket2.remoteAddress} ${socket2.remotePort} ${data}`));
|
|
55
|
-
});
|
|
56
|
-
*/
|
package/src_new/tcpserver/app.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ServiceConfigOptions } from './appConfig.js'
|
|
2
|
-
import { WorkerProcessBase } from '../index'
|
|
3
|
-
import { AppMaster } from './appmaster'
|
|
4
|
-
|
|
5
|
-
import cluster from 'cluster';
|
|
6
|
-
|
|
7
|
-
if (cluster.isPrimary) {
|
|
8
|
-
new AppMaster(ServiceConfigOptions(true, cluster.isPrimary)).SetupServer();
|
|
9
|
-
} else {
|
|
10
|
-
new WorkerProcessBase(ServiceConfigOptions(true, cluster.isPrimary)).SetupServer();
|
|
11
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
|
|
3
|
-
import { $Options } from '@nsshunt/stsconfig'
|
|
4
|
-
const goptions = $Options()
|
|
5
|
-
|
|
6
|
-
import { ProcessOptions, STSServerType } from '../index'
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
// nid: `${goptions.rest01servicename} @ ${goptions.rest01serviceversion} | ${this.options.globalServiceData.serviceInstanceId} @ ${os.hostname()} ^ ${process.pid} @ ${(cluster.isMaster ? process.pid : process.ppid)}`,
|
|
10
|
-
// <serviceId> <serviceInstanceId> <serviceInstanceProcessId>
|
|
11
|
-
// <serviceName> <serviceVersion> <sid> <hostName> <pid> <ppid>
|
|
12
|
-
// << ............... Static Nid ............... >> << ............... Dynamic Nid ............... >>
|
|
13
|
-
// Note: The final nid will NOT contain the NID_SEPERATOR character. This will be replaced with the SEPERATOR character.
|
|
14
|
-
const Context = (isMaster, serviceInstanceId) => {
|
|
15
|
-
return {
|
|
16
|
-
nid: `\
|
|
17
|
-
${goptions.rest01servicename}${ModelDelimeter.COMPONENT_SEPERATOR}${goptions.rest01serviceversion}\
|
|
18
|
-
${ModelDelimeter.SEPERATOR}\
|
|
19
|
-
${serviceInstanceId}${ModelDelimeter.COMPONENT_SEPERATOR}${os.hostname()}\
|
|
20
|
-
${ModelDelimeter.NID_SEPERATOR}\
|
|
21
|
-
${process.pid}${ModelDelimeter.COMPONENT_SEPERATOR}${(isMaster ? process.pid : process.ppid)}`
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
export function ServiceConfigOptions(clusterMode: boolean, isMaster: boolean): ProcessOptions {
|
|
27
|
-
if (isMaster === true) {
|
|
28
|
-
const serviceInstanceId = uuidv4();
|
|
29
|
-
const data: ProcessOptions = {
|
|
30
|
-
serverType: STSServerType.TCPRAW_TLS,
|
|
31
|
-
|
|
32
|
-
clusterMode: clusterMode,
|
|
33
|
-
wssServer: false,
|
|
34
|
-
useLatency: false,
|
|
35
|
-
httpsServerKeyPath: goptions.httpsserverkeypath,
|
|
36
|
-
httpsServerCertificatePath: goptions.httpsservercertpath,
|
|
37
|
-
processExitOnTerminate: true,
|
|
38
|
-
serviceInstanceId: serviceInstanceId,
|
|
39
|
-
useDatabase: true,
|
|
40
|
-
|
|
41
|
-
isMaster: isMaster,
|
|
42
|
-
endpoint: goptions.rest01endpoint,
|
|
43
|
-
apiRoot: goptions.rest01apiroot,
|
|
44
|
-
listenPort: goptions.rest01hostport,
|
|
45
|
-
port: goptions.rest01port,
|
|
46
|
-
|
|
47
|
-
prometheusSupport: false,
|
|
48
|
-
prometheusClusterPort: goptions.rest01prometheusclusterport,
|
|
49
|
-
|
|
50
|
-
serviceName: goptions.rest01servicename,
|
|
51
|
-
serviceVersion: goptions.rest01serviceversion,
|
|
52
|
-
consoleLogging: true,
|
|
53
|
-
instrumentLogging: true,
|
|
54
|
-
|
|
55
|
-
instrumentationObservationInterval: goptions.instrumentationObservationInterval,
|
|
56
|
-
instrumentationTimeWindow: goptions.instrumentationTimeWindow,
|
|
57
|
-
|
|
58
|
-
useRedisAdaptor: false
|
|
59
|
-
}
|
|
60
|
-
return data;
|
|
61
|
-
} else {
|
|
62
|
-
const data: ProcessOptions = JSON.parse(process.env['STS_GSD_SII'] as string) as ProcessOptions;
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
}
|