pssdk 3.0.0-alpha.0 → 3.0.0-alpha.2
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/appServer.js +26 -0
- package/index.js +4 -35
- package/package.json +1 -1
- package/threadableCI.js +63 -4
package/appServer.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// eslint-disable-next-line no-undef
|
|
2
|
+
const JavaAppServer = Java.type('edu.apu.pssdk.AppServer');
|
|
3
|
+
const Piscina = require('piscina');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const ThreadableCI = require('./threadableCI.js');
|
|
6
|
+
|
|
7
|
+
class AppServer {
|
|
8
|
+
constructor(_appServerConfig, _logger = console) {
|
|
9
|
+
this.appServer = new JavaAppServer(_appServerConfig);
|
|
10
|
+
this.logger = _logger;
|
|
11
|
+
this.pool = new Piscina({
|
|
12
|
+
filename: path.resolve(__dirname, 'worker.js'),
|
|
13
|
+
idleTimeout: 60000,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ci(ciName, opts = {}) {
|
|
18
|
+
return new ThreadableCI(
|
|
19
|
+
this.appServer.ciFactory(ciName, opts),
|
|
20
|
+
this.pool,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = AppServer;
|
package/index.js
CHANGED
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
const AppServer = Java.type('edu.apu.pssdk.AppServer');
|
|
3
|
-
const Piscina = require('piscina');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const ThreadableCI = require('./threadableCI.js');
|
|
1
|
+
const AppServer = require('./appServer.js');
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.logger = _logger;
|
|
11
|
-
this.pool = new Piscina({
|
|
12
|
-
filename: path.resolve(__dirname, 'worker.js'),
|
|
13
|
-
idleTimeout: 60000,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
ci(ciName, opts = {}) {
|
|
18
|
-
return new ThreadableCI(
|
|
19
|
-
this.appServer.ciFactory(ciName, opts),
|
|
20
|
-
this.pool,
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
ping() {
|
|
25
|
-
return this.ci('APU_APPLICATION_UPDATE')
|
|
26
|
-
.get({
|
|
27
|
-
ADM_APPL_NBR: '00275505',
|
|
28
|
-
EMPLID: '001610517',
|
|
29
|
-
ACAD_CAREER: 'GR',
|
|
30
|
-
INSTITUTION: 'APU',
|
|
31
|
-
})
|
|
32
|
-
.then(() => 'pong');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
module.exports = Peoplesoft;
|
|
3
|
+
module.exports = {
|
|
4
|
+
AppServer,
|
|
5
|
+
};
|
package/package.json
CHANGED
package/threadableCI.js
CHANGED
|
@@ -50,15 +50,74 @@ class TreadableCI {
|
|
|
50
50
|
return this.ci.toJSON();
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
toArray() {
|
|
54
|
+
return this.ci.toList();
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
setInteractiveMode(params) {
|
|
54
58
|
this.ci.setInteractiveMode(params);
|
|
55
59
|
return this;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
/*********************************/
|
|
63
|
+
/******** HELPER METHODS *********/
|
|
64
|
+
/*********************************/
|
|
65
|
+
/**
|
|
66
|
+
* Helper method to create and then save a new object.
|
|
67
|
+
*
|
|
68
|
+
* @param data The data for the new object.
|
|
69
|
+
* @return a resulting object that could be JSON stringified.
|
|
70
|
+
* @throws PssdkException If a PSDK specific error occurs.
|
|
71
|
+
*/
|
|
72
|
+
add(params) {
|
|
73
|
+
return Promise.resolve(params)
|
|
74
|
+
.then(() => this.create(params))
|
|
75
|
+
.then(() => this.save(params))
|
|
76
|
+
.then(() => this.toJSON())
|
|
77
|
+
.finally(() => this.cancel());
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Helper method to get a new object and return its data.
|
|
82
|
+
*
|
|
83
|
+
* @param data an object containing the GET keys/values.
|
|
84
|
+
* @return a resulting object that could be JSON stringified.
|
|
85
|
+
* @throws PssdkException If a PSDK specific error occurs.
|
|
86
|
+
*/
|
|
87
|
+
fetch(params) {
|
|
88
|
+
return Promise.resolve(params)
|
|
89
|
+
.then(() => this.get(params))
|
|
90
|
+
.then(() => this.toJSON())
|
|
91
|
+
.finally(() => this.cancel());
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Helper method to get and then save an object.
|
|
96
|
+
*
|
|
97
|
+
* @param The data for the object to update.
|
|
98
|
+
* @return a resulting object that could be JSON stringified.
|
|
99
|
+
* @throws PssdkException If a PSDK specific error occurs.
|
|
100
|
+
*/
|
|
101
|
+
update(params) {
|
|
102
|
+
return Promise.resolve(params)
|
|
103
|
+
.then(() => this.get(params))
|
|
104
|
+
.then(() => this.save(params))
|
|
105
|
+
.then(() => this.toJSON())
|
|
106
|
+
.finally(() => this.cancel());
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Helper method to do a find and return the resulting js array
|
|
111
|
+
*
|
|
112
|
+
* @param an object containing the FIND keys/values.
|
|
113
|
+
* @return a resulting array that could be JSON stringified.
|
|
114
|
+
* @throws PssdkException If a PSDK specific error occurs.
|
|
115
|
+
*/
|
|
116
|
+
search(params) {
|
|
117
|
+
return Promise.resolve(params)
|
|
118
|
+
.then(() => this.find(params))
|
|
119
|
+
.then(() => this.toArray())
|
|
120
|
+
.finally(() => this.cancel());
|
|
62
121
|
}
|
|
63
122
|
}
|
|
64
123
|
|