@based/server 6.3.0 → 6.4.1
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/channel/start.js +1 -1
- package/dist/channel/start.js.map +1 -1
- package/dist/incoming/http/function.js +40 -0
- package/dist/incoming/http/function.js.map +1 -1
- package/dist/incoming/http/index.js +3 -0
- package/dist/incoming/http/index.js.map +1 -1
- package/dist/incoming/upgrade.js +2 -0
- package/dist/incoming/upgrade.js.map +1 -1
- package/dist/incoming/ws/function.js +1 -1
- package/dist/incoming/ws/function.js.map +1 -1
- package/dist/query/start/index.js +1 -1
- package/dist/query/start/index.js.map +1 -1
- package/dist/query/start/relay.d.ts +4 -1
- package/dist/query/start/relay.js +2 -2
- package/dist/query/start/relay.js.map +1 -1
- package/dist/security.js +1 -0
- package/dist/security.js.map +1 -1
- package/package.json +1 -1
- package/dist/BasedServerClient.d.ts +0 -71
- package/dist/BasedServerClient.js +0 -390
- package/dist/BasedServerClient.js.map +0 -1
- package/dist/Client.d.ts +0 -75
- package/dist/Client.js +0 -277
- package/dist/Client.js.map +0 -1
- package/dist/Params.d.ts +0 -20
- package/dist/Params.js +0 -48
- package/dist/Params.js.map +0 -1
- package/dist/closeListener.d.ts +0 -4
- package/dist/closeListener.js +0 -13
- package/dist/closeListener.js.map +0 -1
- package/dist/createSimpleServer.d.ts +0 -34
- package/dist/createSimpleServer.js +0 -209
- package/dist/createSimpleServer.js.map +0 -1
- package/dist/findPrefix.d.ts +0 -3
- package/dist/findPrefix.js +0 -20
- package/dist/findPrefix.js.map +0 -1
- package/dist/getFromConfig.d.ts +0 -3
- package/dist/getFromConfig.js +0 -50
- package/dist/getFromConfig.js.map +0 -1
- package/dist/handlers/authorize.d.ts +0 -5
- package/dist/handlers/authorize.js +0 -196
- package/dist/handlers/authorize.js.map +0 -1
- package/dist/handlers/bulkUpdate/index.d.ts +0 -5
- package/dist/handlers/bulkUpdate/index.js +0 -26
- package/dist/handlers/bulkUpdate/index.js.map +0 -1
- package/dist/handlers/configuration/index.d.ts +0 -10
- package/dist/handlers/configuration/index.js +0 -74
- package/dist/handlers/configuration/index.js.map +0 -1
- package/dist/handlers/configuration/observable/index.d.ts +0 -46
- package/dist/handlers/configuration/observable/index.js +0 -277
- package/dist/handlers/configuration/observable/index.js.map +0 -1
- package/dist/handlers/configure/index.d.ts +0 -5
- package/dist/handlers/configure/index.js +0 -44
- package/dist/handlers/configure/index.js.map +0 -1
- package/dist/handlers/copy/index.d.ts +0 -8
- package/dist/handlers/copy/index.js +0 -135
- package/dist/handlers/copy/index.js.map +0 -1
- package/dist/handlers/delete/index.d.ts +0 -5
- package/dist/handlers/delete/index.js +0 -34
- package/dist/handlers/delete/index.js.map +0 -1
- package/dist/handlers/digest/index.d.ts +0 -5
- package/dist/handlers/digest/index.js +0 -23
- package/dist/handlers/digest/index.js.map +0 -1
- package/dist/handlers/functions/call.d.ts +0 -6
- package/dist/handlers/functions/call.js +0 -54
- package/dist/handlers/functions/call.js.map +0 -1
- package/dist/handlers/functions/observable/Observable.d.ts +0 -49
- package/dist/handlers/functions/observable/Observable.js +0 -290
- package/dist/handlers/functions/observable/Observable.js.map +0 -1
- package/dist/handlers/functions/observable/SharedObservable.d.ts +0 -45
- package/dist/handlers/functions/observable/SharedObservable.js +0 -291
- package/dist/handlers/functions/observable/SharedObservable.js.map +0 -1
- package/dist/handlers/functions/observable/index.d.ts +0 -14
- package/dist/handlers/functions/observable/index.js +0 -130
- package/dist/handlers/functions/observable/index.js.map +0 -1
- package/dist/handlers/get/index.d.ts +0 -5
- package/dist/handlers/get/index.js +0 -23
- package/dist/handlers/get/index.js.map +0 -1
- package/dist/handlers/getConfig/index.d.ts +0 -5
- package/dist/handlers/getConfig/index.js +0 -38
- package/dist/handlers/getConfig/index.js.map +0 -1
- package/dist/handlers/handleRequests.d.ts +0 -5
- package/dist/handlers/handleRequests.js +0 -78
- package/dist/handlers/handleRequests.js.map +0 -1
- package/dist/handlers/index.d.ts +0 -4
- package/dist/handlers/index.js +0 -49
- package/dist/handlers/index.js.map +0 -1
- package/dist/handlers/messageParser.d.ts +0 -5
- package/dist/handlers/messageParser.js +0 -122
- package/dist/handlers/messageParser.js.map +0 -1
- package/dist/handlers/removeField/index.d.ts +0 -5
- package/dist/handlers/removeField/index.js +0 -42
- package/dist/handlers/removeField/index.js.map +0 -1
- package/dist/handlers/removeType/index.d.ts +0 -5
- package/dist/handlers/removeType/index.js +0 -30
- package/dist/handlers/removeType/index.js.map +0 -1
- package/dist/handlers/rest/file/DataStream.d.ts +0 -7
- package/dist/handlers/rest/file/DataStream.js +0 -17
- package/dist/handlers/rest/file/DataStream.js.map +0 -1
- package/dist/handlers/rest/file/formStream.d.ts +0 -4
- package/dist/handlers/rest/file/formStream.js +0 -188
- package/dist/handlers/rest/file/formStream.js.map +0 -1
- package/dist/handlers/rest/file/getExtenstion.d.ts +0 -2
- package/dist/handlers/rest/file/getExtenstion.js +0 -22
- package/dist/handlers/rest/file/getExtenstion.js.map +0 -1
- package/dist/handlers/rest/file/index.d.ts +0 -4
- package/dist/handlers/rest/file/index.js +0 -53
- package/dist/handlers/rest/file/index.js.map +0 -1
- package/dist/handlers/rest/file/storeFile.d.ts +0 -6
- package/dist/handlers/rest/file/storeFile.js +0 -44
- package/dist/handlers/rest/file/storeFile.js.map +0 -1
- package/dist/handlers/rest/file/stream.d.ts +0 -5
- package/dist/handlers/rest/file/stream.js +0 -104
- package/dist/handlers/rest/file/stream.js.map +0 -1
- package/dist/handlers/rest/file/types.d.ts +0 -9
- package/dist/handlers/rest/file/types.js +0 -3
- package/dist/handlers/rest/file/types.js.map +0 -1
- package/dist/handlers/rest/getReqMessage.d.ts +0 -3
- package/dist/handlers/rest/getReqMessage.js +0 -92
- package/dist/handlers/rest/getReqMessage.js.map +0 -1
- package/dist/handlers/rest/index.d.ts +0 -4
- package/dist/handlers/rest/index.js +0 -121
- package/dist/handlers/rest/index.js.map +0 -1
- package/dist/handlers/rest/invalidReq.d.ts +0 -4
- package/dist/handlers/rest/invalidReq.js +0 -20
- package/dist/handlers/rest/invalidReq.js.map +0 -1
- package/dist/handlers/rest/parseResponse.d.ts +0 -6
- package/dist/handlers/rest/parseResponse.js +0 -230
- package/dist/handlers/rest/parseResponse.js.map +0 -1
- package/dist/handlers/rest/playground/index.d.ts +0 -5
- package/dist/handlers/rest/playground/index.js +0 -308
- package/dist/handlers/rest/playground/index.js.map +0 -1
- package/dist/handlers/rest/readBody.d.ts +0 -3
- package/dist/handlers/rest/readBody.js +0 -45
- package/dist/handlers/rest/readBody.js.map +0 -1
- package/dist/handlers/set/index.d.ts +0 -5
- package/dist/handlers/set/index.js +0 -20
- package/dist/handlers/set/index.js.map +0 -1
- package/dist/handlers/subscription/index.d.ts +0 -32
- package/dist/handlers/subscription/index.js +0 -223
- package/dist/handlers/subscription/index.js.map +0 -1
- package/dist/handlers/token.d.ts +0 -5
- package/dist/handlers/token.js +0 -122
- package/dist/handlers/token.js.map +0 -1
- package/dist/handlers/track/index.d.ts +0 -7
- package/dist/handlers/track/index.js +0 -102
- package/dist/handlers/track/index.js.map +0 -1
- package/dist/handlers/userAuth/index.d.ts +0 -5
- package/dist/handlers/userAuth/index.js +0 -78
- package/dist/handlers/userAuth/index.js.map +0 -1
- package/dist/incoming/ws/observable.d.ts +0 -7
- package/dist/incoming/ws/observable.js +0 -91
- package/dist/incoming/ws/observable.js.map +0 -1
- package/dist/observable/cleanup.d.ts +0 -2
- package/dist/observable/cleanup.js +0 -66
- package/dist/observable/cleanup.js.map +0 -1
- package/dist/observable/create.d.ts +0 -3
- package/dist/observable/create.js +0 -35
- package/dist/observable/create.js.map +0 -1
- package/dist/observable/destroy.d.ts +0 -4
- package/dist/observable/destroy.js +0 -47
- package/dist/observable/destroy.js.map +0 -1
- package/dist/observable/extendCache.d.ts +0 -2
- package/dist/observable/extendCache.js +0 -10
- package/dist/observable/extendCache.js.map +0 -1
- package/dist/observable/genObservableId.d.ts +0 -1
- package/dist/observable/genObservableId.js +0 -12
- package/dist/observable/genObservableId.js.map +0 -1
- package/dist/observable/get.d.ts +0 -4
- package/dist/observable/get.js +0 -15
- package/dist/observable/get.js.map +0 -1
- package/dist/observable/index.d.ts +0 -10
- package/dist/observable/index.js +0 -27
- package/dist/observable/index.js.map +0 -1
- package/dist/observable/send.d.ts +0 -5
- package/dist/observable/send.js +0 -26
- package/dist/observable/send.js.map +0 -1
- package/dist/observable/start/error.d.ts +0 -3
- package/dist/observable/start/error.js +0 -43
- package/dist/observable/start/error.js.map +0 -1
- package/dist/observable/start/index.d.ts +0 -2
- package/dist/observable/start/index.js +0 -67
- package/dist/observable/start/index.js.map +0 -1
- package/dist/observable/start/relay.d.ts +0 -4
- package/dist/observable/start/relay.js +0 -14
- package/dist/observable/start/relay.js.map +0 -1
- package/dist/observable/start/update.d.ts +0 -3
- package/dist/observable/start/update.js +0 -116
- package/dist/observable/start/update.js.map +0 -1
- package/dist/observable/subscribe.d.ts +0 -7
- package/dist/observable/subscribe.js +0 -47
- package/dist/observable/subscribe.js.map +0 -1
- package/dist/observable/types.d.ts +0 -25
- package/dist/observable/types.js +0 -3
- package/dist/observable/types.js.map +0 -1
- package/dist/observable/unsub.d.ts +0 -6
- package/dist/observable/unsub.js +0 -46
- package/dist/observable/unsub.js.map +0 -1
- package/dist/openListener.d.ts +0 -4
- package/dist/openListener.js +0 -13
- package/dist/openListener.js.map +0 -1
- package/dist/secrets.d.ts +0 -9
- package/dist/secrets.js +0 -150
- package/dist/secrets.js.map +0 -1
- package/dist/types.d.ts +0 -129
- package/dist/types.js +0 -17
- package/dist/types.js.map +0 -1
- package/dist/upgradeListener.d.ts +0 -4
- package/dist/upgradeListener.js +0 -47
- package/dist/upgradeListener.js.map +0 -1
- package/dist/workers/index.d.ts +0 -0
- package/dist/workers/index.js +0 -20
- package/dist/workers/index.js.map +0 -1
- package/dist/workers/workerCode.d.ts +0 -12
- package/dist/workers/workerCode.js +0 -46
- package/dist/workers/workerCode.js.map +0 -1
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const readBody_1 = __importDefault(require("./readBody"));
|
|
7
|
-
const Client_1 = require("../../Client");
|
|
8
|
-
const getReqMessage_1 = __importDefault(require("./getReqMessage"));
|
|
9
|
-
const handleRequests_1 = __importDefault(require("../handleRequests"));
|
|
10
|
-
const querystring_1 = __importDefault(require("querystring"));
|
|
11
|
-
const file_1 = __importDefault(require("./file"));
|
|
12
|
-
const invalidReq_1 = __importDefault(require("./invalidReq"));
|
|
13
|
-
const playground_1 = __importDefault(require("./playground"));
|
|
14
|
-
const execMessages = (server, res, message, token, format = 0) => {
|
|
15
|
-
const client = new Client_1.Client(server, undefined, res, format);
|
|
16
|
-
const messages = [message];
|
|
17
|
-
if (token) {
|
|
18
|
-
client.setToken(token);
|
|
19
|
-
}
|
|
20
|
-
res.client = client;
|
|
21
|
-
(0, handleRequests_1.default)(server, client, messages);
|
|
22
|
-
};
|
|
23
|
-
exports.default = async (server, req, res) => {
|
|
24
|
-
const url = req.getUrl();
|
|
25
|
-
res.onAborted(() => {
|
|
26
|
-
res.aborted = true;
|
|
27
|
-
if (res.client) {
|
|
28
|
-
res.client.destroy();
|
|
29
|
-
res.client = null;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
if (!url) {
|
|
33
|
-
(0, invalidReq_1.default)(res);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const fn = url.split('/');
|
|
37
|
-
const handler = fn[1];
|
|
38
|
-
if (!(handler &&
|
|
39
|
-
(handler === 'call' ||
|
|
40
|
-
handler === 'file' ||
|
|
41
|
-
handler === 'playground' ||
|
|
42
|
-
handler === 'get' ||
|
|
43
|
-
handler === 'delete' ||
|
|
44
|
-
handler === 'copy' ||
|
|
45
|
-
handler === 'set' ||
|
|
46
|
-
handler === 'configure' ||
|
|
47
|
-
handler === 'update-schema' ||
|
|
48
|
-
handler === 'updateSchema' ||
|
|
49
|
-
handler === 'configuration' ||
|
|
50
|
-
handler === 'track' ||
|
|
51
|
-
handler === 'schema' ||
|
|
52
|
-
handler === 'digest'))) {
|
|
53
|
-
(0, invalidReq_1.default)(res);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (handler === 'file') {
|
|
57
|
-
return (0, file_1.default)(server, req, res, url);
|
|
58
|
-
}
|
|
59
|
-
else if (handler === 'playground') {
|
|
60
|
-
const format = 0;
|
|
61
|
-
const client = new Client_1.Client(server, undefined, res, format);
|
|
62
|
-
return (0, playground_1.default)(server, client, req, res, url);
|
|
63
|
-
}
|
|
64
|
-
let token = req.getHeader('authorization');
|
|
65
|
-
const acceptEncoding = req.getHeader('accept-encoding');
|
|
66
|
-
const method = req.getMethod();
|
|
67
|
-
const contentType = req.getHeader('content-type') || 'application/json';
|
|
68
|
-
// have to make this cleaner...
|
|
69
|
-
if (acceptEncoding) {
|
|
70
|
-
res.acceptEncoding = acceptEncoding;
|
|
71
|
-
}
|
|
72
|
-
let format = 0;
|
|
73
|
-
const last = fn[fn.length - 1];
|
|
74
|
-
if (last.endsWith('.csv')) {
|
|
75
|
-
format = 1;
|
|
76
|
-
fn[fn.length - 1] = last.slice(0, -4);
|
|
77
|
-
}
|
|
78
|
-
res.ua = req.getHeader('user-agent');
|
|
79
|
-
// TODO also: how do we do want to do this? (why dont we just give access to the request object or the headers?)
|
|
80
|
-
res.acceptLanguage = req.getHeader('accept-language');
|
|
81
|
-
res.host = req.getHeader('host');
|
|
82
|
-
if (method === 'post') {
|
|
83
|
-
(0, readBody_1.default)(res, handler === 'digest' ? 'text/plain' : contentType, (d) => {
|
|
84
|
-
const message = (0, getReqMessage_1.default)(fn, d);
|
|
85
|
-
if (!message) {
|
|
86
|
-
(0, invalidReq_1.default)(res);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
execMessages(server, res, message, token, format);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (method === 'get') {
|
|
95
|
-
const query = req.getQuery();
|
|
96
|
-
let payload;
|
|
97
|
-
if (query) {
|
|
98
|
-
const x = querystring_1.default.parse(query);
|
|
99
|
-
const p = x.q || x.payload;
|
|
100
|
-
if (x.token && !token) {
|
|
101
|
-
if (typeof x.token === 'string') {
|
|
102
|
-
token = x.token;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (p) {
|
|
106
|
-
try {
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
payload = JSON.parse(p);
|
|
109
|
-
}
|
|
110
|
-
catch (err) { }
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const message = (0, getReqMessage_1.default)(fn, payload);
|
|
114
|
-
if (message) {
|
|
115
|
-
execMessages(server, res, message, token, format);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
(0, invalidReq_1.default)(res);
|
|
120
|
-
};
|
|
121
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/rest/index.ts"],"names":[],"mappings":";;;;;AAEA,0DAAiC;AACjC,yCAAqC;AACrC,oEAA2C;AAE3C,uEAA8C;AAC9C,8DAA4B;AAC5B,kDAAyB;AACzB,8DAAqC;AACrC,8DAAqC;AAErC,MAAM,YAAY,GAAG,CACnB,MAAmB,EACnB,GAAqB,EACrB,OAA+B,EAC/B,KAAc,EACd,SAAgB,CAAC,EACjB,EAAE;IACF,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IACzD,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAA;IAC1B,IAAI,KAAK,EAAE;QACT,MAAM,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GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;YACjD,OAAM;SACP;KACF;IAED,IAAA,oBAAU,EAAC,GAAG,CAAC,CAAA;AACjB,CAAC,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invalidReqNoCors = void 0;
|
|
4
|
-
const invalidReq = (res) => {
|
|
5
|
-
res.aborted = true;
|
|
6
|
-
res
|
|
7
|
-
.writeStatus('400 Invalid Request')
|
|
8
|
-
.writeHeader('Access-Control-Allow-Origin', '*')
|
|
9
|
-
.writeHeader('Access-Control-Allow-Headers', 'content-type')
|
|
10
|
-
.end(`{"code":400,"error":"Invalid Request"}`);
|
|
11
|
-
};
|
|
12
|
-
const invalidReqNoCors = (res) => {
|
|
13
|
-
res.aborted = true;
|
|
14
|
-
res
|
|
15
|
-
.writeStatus('400 Invalid Request')
|
|
16
|
-
.end(`{"code":400,"error":"Invalid Request"}`);
|
|
17
|
-
};
|
|
18
|
-
exports.invalidReqNoCors = invalidReqNoCors;
|
|
19
|
-
exports.default = invalidReq;
|
|
20
|
-
//# sourceMappingURL=invalidReq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invalidReq.js","sourceRoot":"","sources":["../../../src/handlers/rest/invalidReq.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,CAAC,GAAqB,EAAE,EAAE;IAC3C,GAAG,CAAC,OAAO,GAAG,IAAI,CAAA;IAClB,GAAG;SACA,WAAW,CAAC,qBAAqB,CAAC;SAClC,WAAW,CAAC,6BAA6B,EAAE,GAAG,CAAC;SAC/C,WAAW,CAAC,8BAA8B,EAAE,cAAc,CAAC;SAC3D,GAAG,CAAC,wCAAwC,CAAC,CAAA;AAClD,CAAC,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAC,GAAqB,EAAE,EAAE;IACxD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAA;IAClB,GAAG;SACA,WAAW,CAAC,qBAAqB,CAAC;SAClC,GAAG,CAAC,wCAAwC,CAAC,CAAA;AAClD,CAAC,CAAA;AALY,QAAA,gBAAgB,oBAK5B;AAED,kBAAe,UAAU,CAAA"}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const client_1 = require("@based/client");
|
|
7
|
-
const hash_1 = require("@saulx/hash");
|
|
8
|
-
const zlib_1 = __importDefault(require("zlib"));
|
|
9
|
-
const jsonexport_1 = __importDefault(require("jsonexport"));
|
|
10
|
-
const invalid = (res, error, statusMsg = 'Invald request') => {
|
|
11
|
-
res.aborted = true;
|
|
12
|
-
res.writeStatus('400 ' + statusMsg);
|
|
13
|
-
res.writeHeader('Access-Control-Allow-Origin', '*');
|
|
14
|
-
res.writeHeader('Access-Control-Allow-Headers', 'content-type');
|
|
15
|
-
res.writeHeader('Content-Type', 'application/json');
|
|
16
|
-
res.end(JSON.stringify({ error, code: 400 }));
|
|
17
|
-
};
|
|
18
|
-
const ok = (res) => {
|
|
19
|
-
res.writeStatus('200 OK');
|
|
20
|
-
res.writeHeader('Access-Control-Allow-Origin', '*');
|
|
21
|
-
res.writeHeader('Access-Control-Allow-Headers', 'content-type');
|
|
22
|
-
};
|
|
23
|
-
exports.default = (res, payload, type, version, headers) => {
|
|
24
|
-
if (res.aborted) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let result;
|
|
28
|
-
let reqType;
|
|
29
|
-
let isParsed = false;
|
|
30
|
-
if (headers) {
|
|
31
|
-
result = payload[2];
|
|
32
|
-
if (headers['Content-Type']) {
|
|
33
|
-
isParsed = true;
|
|
34
|
-
}
|
|
35
|
-
else if (typeof result === 'string') {
|
|
36
|
-
res.writeHeader('Content-Type', 'text/plain');
|
|
37
|
-
isParsed = true;
|
|
38
|
-
}
|
|
39
|
-
if (!headers['Cache-Control']) {
|
|
40
|
-
res.writeHeader('Cache-Control', 'max-age=10');
|
|
41
|
-
}
|
|
42
|
-
for (const key in headers) {
|
|
43
|
-
res.writeHeader(key, headers[key]);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else if (typeof payload === 'string') {
|
|
47
|
-
let secondIndex = 0;
|
|
48
|
-
let lastIndex = 0;
|
|
49
|
-
const len = payload.length - 1;
|
|
50
|
-
for (let i = 4; i < 20; i++) {
|
|
51
|
-
const s = payload[i];
|
|
52
|
-
if (!secondIndex && s === ',') {
|
|
53
|
-
secondIndex = i;
|
|
54
|
-
if (lastIndex) {
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (!lastIndex) {
|
|
59
|
-
if (payload[len - i] === ',') {
|
|
60
|
-
lastIndex = len - i;
|
|
61
|
-
if (secondIndex) {
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (!secondIndex && !lastIndex) {
|
|
68
|
-
invalid(res, 'Invalid Request');
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
result = payload.slice(secondIndex + 1, lastIndex);
|
|
72
|
-
const checksum = version || (0, hash_1.hash)(result);
|
|
73
|
-
ok(res);
|
|
74
|
-
res.writeHeader('ETag', String(checksum));
|
|
75
|
-
res.writeHeader('Cache-Control', 'max-age=0, must-revalidate');
|
|
76
|
-
isParsed = true;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
reqType = payload[0];
|
|
80
|
-
if (reqType === client_1.RequestTypes.Get) {
|
|
81
|
-
if (payload[3]) {
|
|
82
|
-
invalid(res, payload[3], 'Invalid Query');
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
const r = payload[2];
|
|
87
|
-
const checksum = (0, hash_1.hashObjectIgnoreKeyOrder)(r);
|
|
88
|
-
ok(res);
|
|
89
|
-
res.writeHeader('ETag', String(checksum));
|
|
90
|
-
res.writeHeader('Cache-Control', 'max-age=0, must-revalidate');
|
|
91
|
-
result = r;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else if (reqType === client_1.RequestTypes.Set ||
|
|
95
|
-
reqType === client_1.RequestTypes.Copy ||
|
|
96
|
-
reqType === client_1.RequestTypes.Configuration ||
|
|
97
|
-
reqType === client_1.RequestTypes.Digest ||
|
|
98
|
-
reqType === client_1.RequestTypes.GetConfiguration ||
|
|
99
|
-
reqType === client_1.RequestTypes.Delete) {
|
|
100
|
-
if (payload[3]) {
|
|
101
|
-
invalid(res, payload[3]);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
ok(res);
|
|
106
|
-
result = payload[2];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
else if (reqType === client_1.RequestTypes.Call) {
|
|
110
|
-
if (payload[3]) {
|
|
111
|
-
invalid(res, payload[3]);
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
ok(res);
|
|
116
|
-
result = payload[2];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else if (reqType === client_1.RequestTypes.Subscription) {
|
|
120
|
-
if (payload[4]) {
|
|
121
|
-
invalid(res, payload[4]);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
ok(res);
|
|
126
|
-
res.writeHeader('ETag', String(payload[3]));
|
|
127
|
-
res.writeHeader('Cache-Control', 'max-age=0, must-revalidate');
|
|
128
|
-
result = payload[2];
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
invalid(res, 'Invalid Request');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (!headers) {
|
|
136
|
-
if (reqType === client_1.RequestTypes.Digest) {
|
|
137
|
-
res.writeHeader('Content-Type', 'text/plain');
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
if (type === 1) {
|
|
141
|
-
res.writeHeader('Content-Type', 'text/csv');
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
res.writeHeader('Content-Type', 'application/json');
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (result !== undefined) {
|
|
149
|
-
let parsed;
|
|
150
|
-
let csvParser;
|
|
151
|
-
if (type === 0) {
|
|
152
|
-
parsed = isParsed ? result : JSON.stringify(result);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
csvParser = (0, jsonexport_1.default)();
|
|
156
|
-
}
|
|
157
|
-
if (!headers?.['Content-Encoding'] && res.acceptEncoding) {
|
|
158
|
-
const acceptEncoding = res.acceptEncoding;
|
|
159
|
-
let compressor;
|
|
160
|
-
if (acceptEncoding.includes('deflate')) {
|
|
161
|
-
res.writeHeader('Content-Encoding', 'deflate');
|
|
162
|
-
compressor = zlib_1.default.createDeflate();
|
|
163
|
-
}
|
|
164
|
-
else if (acceptEncoding.includes('gzip')) {
|
|
165
|
-
res.writeHeader('Content-Encoding', 'gzip');
|
|
166
|
-
compressor = zlib_1.default.createGzip();
|
|
167
|
-
}
|
|
168
|
-
else if (acceptEncoding.includes('br')) {
|
|
169
|
-
res.writeHeader('Content-Encoding', 'br');
|
|
170
|
-
compressor = zlib_1.default.createBrotliCompress();
|
|
171
|
-
}
|
|
172
|
-
if (compressor) {
|
|
173
|
-
compressor.on('data', (buffer) => {
|
|
174
|
-
if (!res.aborted) {
|
|
175
|
-
res.write(buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength));
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
compressor.on('end', () => {
|
|
179
|
-
if (!res.aborted) {
|
|
180
|
-
res.end();
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
if (csvParser) {
|
|
184
|
-
if (!res.aborted) {
|
|
185
|
-
csvParser.pipe(compressor);
|
|
186
|
-
csvParser.write(Buffer.from(isParsed ? result : JSON.stringify(result)));
|
|
187
|
-
csvParser.end();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
if (!res.aborted) {
|
|
192
|
-
compressor.write(Buffer.from(parsed));
|
|
193
|
-
compressor.end();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
if (csvParser) {
|
|
200
|
-
csvParser.on('end', () => {
|
|
201
|
-
console.info('end');
|
|
202
|
-
if (!res.aborted) {
|
|
203
|
-
res.end();
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
csvParser.on('data', (buffer) => {
|
|
207
|
-
if (!res.aborted) {
|
|
208
|
-
res.write(buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength));
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
if (!res.aborted) {
|
|
212
|
-
csvParser.write(Buffer.from(isParsed ? result : JSON.stringify(result)));
|
|
213
|
-
csvParser.end();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
if (!res.aborted) {
|
|
218
|
-
res.end(parsed);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
if (!res.aborted) {
|
|
224
|
-
res.end();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
// fix
|
|
228
|
-
res.client = null;
|
|
229
|
-
};
|
|
230
|
-
//# sourceMappingURL=parseResponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseResponse.js","sourceRoot":"","sources":["../../../src/handlers/rest/parseResponse.ts"],"names":[],"mappings":";;;;;AACA,0CAA0D;AAC1D,sCAA4D;AAC5D,gDAAuB;AACvB,4DAAmC;AAEnC,MAA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,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;gBACxE,SAAS,CAAC,GAAG,EAAE,CAAA;aAChB;SACF;aAAM;YACL,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;gBAChB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;aAChB;SACF;KACF;SAAM;QACL,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YAChB,GAAG,CAAC,GAAG,EAAE,CAAA;SACV;KACF;IACD,MAAM;IACN,GAAG,CAAC,MAAM,GAAG,IAAI,CAAA;AACnB,CAAC,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import uws from '@based/uws';
|
|
2
|
-
import { BasedServer } from '../../..';
|
|
3
|
-
import { Client } from '../../../types';
|
|
4
|
-
declare const _default: (server: BasedServer, client: Client, req: uws.HttpRequest, res: uws.HttpResponse, url: string) => Promise<void>;
|
|
5
|
-
export default _default;
|