pssdk 3.0.0-alpha.0

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/index.js ADDED
@@ -0,0 +1,36 @@
1
+ // eslint-disable-next-line no-undef
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');
6
+
7
+ class Peoplesoft {
8
+ constructor(_appServerConfig, _logger = console) {
9
+ this.appServer = new AppServer(_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
+ 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;
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "pssdk",
3
+ "version": "3.0.0-alpha.0",
4
+ "description": "PSSDK to Integrate with Peoplesoft Component Interfaces via GraalNodeJs",
5
+ "keywords": [
6
+ "pssdk",
7
+ "peoplesoft",
8
+ "component",
9
+ "interfaces",
10
+ "graal",
11
+ "graalvm",
12
+ "graalnodejs",
13
+ "graaljs",
14
+ "ci",
15
+ "nodejs"
16
+ ],
17
+ "homepage": "https://github.com/azusapacificuniversity/pssdk#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/azusapacificuniversity/pssdk/issues"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/azusapacificuniversity/pssdk.git"
24
+ },
25
+ "license": "Apache-2.0",
26
+ "author": "Azusa Pacific University",
27
+ "type": "commonjs",
28
+ "main": "index.js",
29
+ "scripts": {
30
+ "test": "echo \"Error: no test specified\" && exit 1"
31
+ },
32
+ "dependencies": {
33
+ "piscina": "^5.1.4"
34
+ }
35
+ }
@@ -0,0 +1,65 @@
1
+ class TreadableCI {
2
+ constructor(ci, pool) {
3
+ this.pool = pool;
4
+ this.ci = ci;
5
+ }
6
+
7
+ get(params) {
8
+ return this.pool
9
+ .run({ ci: this.ci, params }, { name: 'get' })
10
+ .then(() => this);
11
+ }
12
+
13
+ set(params) {
14
+ return this.pool
15
+ .run({ ci: this.ci, params }, { name: 'set' })
16
+ .then(() => this);
17
+ }
18
+
19
+ find(params) {
20
+ return this.pool
21
+ .run({ ci: this.ci, params }, { name: 'find' })
22
+ .then(() => this);
23
+ }
24
+
25
+ create(params) {
26
+ return this.pool
27
+ .run({ ci: this.ci, params }, { name: 'create' })
28
+ .then(() => this);
29
+ }
30
+
31
+ save(params) {
32
+ return this.pool
33
+ .run({ ci: this.ci, params }, { name: 'save' })
34
+ .then(() => this);
35
+ }
36
+
37
+ cancel() {
38
+ return this.pool
39
+ .run({ ci: this.ci }, { name: 'cancel' })
40
+ .then(() => this);
41
+ }
42
+
43
+ execute(methodName, params) {
44
+ return this.pool
45
+ .run({ ci: this.ci, methodName, params }, { name: 'execute' })
46
+ .then(() => this);
47
+ }
48
+
49
+ toJSON() {
50
+ return this.ci.toJSON();
51
+ }
52
+
53
+ setInteractiveMode(params) {
54
+ this.ci.setInteractiveMode(params);
55
+ return this;
56
+ }
57
+
58
+ insert(params) {
59
+ return this.pool
60
+ .run({ ci: this.ci, params }, { name: 'insert' })
61
+ .then(() => this.toJSON());
62
+ }
63
+ }
64
+
65
+ module.exports = TreadableCI;
package/worker.js ADDED
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ get: ({ ci, params }) => ci.get(params),
3
+ set: ({ ci, params }) => ci.set(params),
4
+ find: ({ ci, params }) => ci.find(params),
5
+ create: ({ ci, params }) => ci.create(params),
6
+ save: ({ ci, params }) => ci.save(params),
7
+ cancel: ({ ci }) => ci.cancel(),
8
+ execute: ({ ci, methodName, params }) => ci.execute(methodName, params),
9
+ insert: ({ ci, params }) => ci.create(params).save(params),
10
+ };
11
+