proto.io 0.0.195 → 0.0.196
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/index.js +2 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -666,12 +666,8 @@ const proxy = (x) => {
|
|
|
666
666
|
for (const name of _.uniq(_.flatMap(prototypes(proxy), x => Object.getOwnPropertyNames(x)))) {
|
|
667
667
|
if (name === 'constructor')
|
|
668
668
|
continue;
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
Object.defineProperty(proxy, name, { get: () => self[name] });
|
|
674
|
-
}
|
|
669
|
+
const value = _.isFunction(self[name]) ? self[name].bind(self) : self[name];
|
|
670
|
+
Object.defineProperty(proxy, name, { get: () => value });
|
|
675
671
|
}
|
|
676
672
|
return proxy;
|
|
677
673
|
};
|
|
@@ -2051,18 +2047,6 @@ var classesRoute = (router, proto) => {
|
|
|
2051
2047
|
// THE SOFTWARE.
|
|
2052
2048
|
//
|
|
2053
2049
|
var functionRoute = (router, proto) => {
|
|
2054
|
-
router.get('/functions/:name', async (req, res) => {
|
|
2055
|
-
res.setHeader('Cache-Control', ['no-cache', 'no-store']);
|
|
2056
|
-
const { name } = req.params;
|
|
2057
|
-
if (_.isNil(proto[PVK].functions[name]))
|
|
2058
|
-
return void res.sendStatus(404);
|
|
2059
|
-
await response(res, () => {
|
|
2060
|
-
const payload = proto.connect(req, x => ({
|
|
2061
|
-
params: null,
|
|
2062
|
-
}));
|
|
2063
|
-
return payload[PVK].run(payload, name, payload, { master: payload.isMaster });
|
|
2064
|
-
});
|
|
2065
|
-
});
|
|
2066
2050
|
router.post('/functions/:name', Server.text({ type: '*/*' }), async (req, res) => {
|
|
2067
2051
|
res.setHeader('Cache-Control', ['no-cache', 'no-store']);
|
|
2068
2052
|
const { name } = req.params;
|
|
@@ -2103,16 +2087,6 @@ var functionRoute = (router, proto) => {
|
|
|
2103
2087
|
// THE SOFTWARE.
|
|
2104
2088
|
//
|
|
2105
2089
|
var jobRoute = (router, proto) => {
|
|
2106
|
-
router.get('/jobs/:name', async (req, res) => {
|
|
2107
|
-
res.setHeader('Cache-Control', ['no-cache', 'no-store']);
|
|
2108
|
-
const { name } = req.params;
|
|
2109
|
-
if (_.isNil(proto[PVK].jobs[name]))
|
|
2110
|
-
return void res.sendStatus(404);
|
|
2111
|
-
await response(res, () => {
|
|
2112
|
-
const payload = proto.connect(req);
|
|
2113
|
-
return payload[PVK].scheduleJob(payload, name, null, { master: payload.isMaster });
|
|
2114
|
-
});
|
|
2115
|
-
});
|
|
2116
2090
|
router.post('/jobs/:name', Server.text({ type: '*/*' }), async (req, res) => {
|
|
2117
2091
|
res.setHeader('Cache-Control', ['no-cache', 'no-store']);
|
|
2118
2092
|
const { name } = req.params;
|