pssdk 3.0.1-rc9 → 3.1.0-rc2
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/package.json +1 -1
- package/threadableCI.js +22 -9
- package/worker.js +1 -0
package/package.json
CHANGED
package/threadableCI.js
CHANGED
|
@@ -34,10 +34,19 @@ class TreadableCI {
|
|
|
34
34
|
.then(() => this);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Invokes a non-standard method defined on the CI.
|
|
39
|
+
*
|
|
40
|
+
* Unlike the other methods, this one does not resolve to the CI, so it is not chainable.
|
|
41
|
+
*
|
|
42
|
+
* @param methodName The name of the non-standard method.
|
|
43
|
+
* @param params Optional. Data to set on the CI before invoking the method.
|
|
44
|
+
* @return a promise of whatever the method returns: a boolean, number, string, or null.
|
|
45
|
+
* @throws PssdkException If the method is unsupported or fails to invoke.
|
|
46
|
+
*/
|
|
37
47
|
execute(methodName, params) {
|
|
38
48
|
return this.pool
|
|
39
|
-
.run({ ci: this.ci, methodName, params }, { name: 'execute' })
|
|
40
|
-
.then(() => this);
|
|
49
|
+
.run({ ci: this.ci, methodName, params }, { name: 'execute' });
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
toJSON() {
|
|
@@ -63,6 +72,10 @@ class TreadableCI {
|
|
|
63
72
|
return this.ci.cancel();
|
|
64
73
|
}
|
|
65
74
|
|
|
75
|
+
close() {
|
|
76
|
+
return this.ci.close();
|
|
77
|
+
}
|
|
78
|
+
|
|
66
79
|
/*********************************/
|
|
67
80
|
/******** HELPER METHODS *********/
|
|
68
81
|
/*********************************/
|
|
@@ -77,8 +90,8 @@ class TreadableCI {
|
|
|
77
90
|
return Promise.resolve(params)
|
|
78
91
|
.then(() => this.create(params))
|
|
79
92
|
.then(() => this.save(params))
|
|
80
|
-
.then(() => this.
|
|
81
|
-
.finally(() => this.
|
|
93
|
+
.then(() => this.toObject())
|
|
94
|
+
.finally(() => this.close());
|
|
82
95
|
}
|
|
83
96
|
|
|
84
97
|
/**
|
|
@@ -91,8 +104,8 @@ class TreadableCI {
|
|
|
91
104
|
fetch(params) {
|
|
92
105
|
return Promise.resolve(params)
|
|
93
106
|
.then(() => this.get(params))
|
|
94
|
-
.then(() => this.
|
|
95
|
-
.finally(() => this.
|
|
107
|
+
.then(() => this.toObject())
|
|
108
|
+
.finally(() => this.close());
|
|
96
109
|
}
|
|
97
110
|
|
|
98
111
|
/**
|
|
@@ -106,8 +119,8 @@ class TreadableCI {
|
|
|
106
119
|
return Promise.resolve(params)
|
|
107
120
|
.then(() => this.get(params))
|
|
108
121
|
.then(() => this.save(params))
|
|
109
|
-
.then(() => this.
|
|
110
|
-
.finally(() => this.
|
|
122
|
+
.then(() => this.toObject())
|
|
123
|
+
.finally(() => this.close());
|
|
111
124
|
}
|
|
112
125
|
|
|
113
126
|
/**
|
|
@@ -121,7 +134,7 @@ class TreadableCI {
|
|
|
121
134
|
return Promise.resolve(params)
|
|
122
135
|
.then(() => this.find(params))
|
|
123
136
|
.then(() => this.toArray())
|
|
124
|
-
.finally(() => this.
|
|
137
|
+
.finally(() => this.close());
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
140
|
|
package/worker.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = {
|
|
|
5
5
|
create: ({ ci, params }) => ci.create(params),
|
|
6
6
|
save: ({ ci, params }) => ci.save(params),
|
|
7
7
|
cancel: ({ ci }) => ci.cancel(),
|
|
8
|
+
close: ({ ci }) => ci.close(),
|
|
8
9
|
toObject: ({ ci }) => JSON.parse(JSON.stringify(ci.toProxyObject())),
|
|
9
10
|
toArray: ({ ci }) => JSON.parse(JSON.stringify(ci.toProxyArrayOfProxyObjects())),
|
|
10
11
|
execute: ({ ci, methodName, params }) => ci.execute(methodName, params),
|