@based/server 3.4.5 → 4.0.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/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +173 -0
- package/dist/api/index.js.map +1 -0
- package/dist/auth/dummyAuth.d.ts +1 -1
- package/dist/auth/dummyAuth.js +3 -2
- package/dist/auth/dummyAuth.js.map +1 -1
- package/dist/auth/index.d.ts +8 -4
- package/dist/auth/index.js +28 -23
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/parseAuthState.d.ts +2 -0
- package/dist/auth/parseAuthState.js +16 -0
- package/dist/auth/parseAuthState.js.map +1 -0
- package/dist/auth/types.d.ts +10 -0
- package/dist/{handlers/rest/file → auth}/types.js +0 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/compress.d.ts +5 -0
- package/dist/{network/http/compress.js → compress.js} +2 -6
- package/dist/compress.js.map +1 -0
- package/dist/context.d.ts +54 -0
- package/dist/context.js +18 -0
- package/dist/context.js.map +1 -0
- package/dist/error/errorTypeHandlers.d.ts +6 -0
- package/dist/error/errorTypeHandlers.js +130 -0
- package/dist/error/errorTypeHandlers.js.map +1 -0
- package/dist/error/index.d.ts +5 -0
- package/dist/error/index.js +61 -0
- package/dist/error/index.js.map +1 -0
- package/dist/error/types.d.ts +105 -0
- package/dist/error/types.js +30 -0
- package/dist/error/types.js.map +1 -0
- package/dist/functions/index.d.ts +10 -24
- package/dist/functions/index.js +98 -287
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/timeout.d.ts +1 -1
- package/dist/functions/types.d.ts +69 -0
- package/dist/functions/types.js +15 -0
- package/dist/functions/types.js.map +1 -0
- package/dist/incoming/http/authorize.d.ts +4 -0
- package/dist/incoming/http/authorize.js +37 -0
- package/dist/incoming/http/authorize.js.map +1 -0
- package/dist/incoming/http/function.d.ts +4 -0
- package/dist/{network → incoming}/http/function.js +13 -13
- package/dist/incoming/http/function.js.map +1 -0
- package/dist/incoming/http/get.d.ts +4 -0
- package/dist/incoming/http/get.js +155 -0
- package/dist/incoming/http/get.js.map +1 -0
- package/dist/{network → incoming}/http/index.d.ts +0 -0
- package/dist/incoming/http/index.js +134 -0
- package/dist/incoming/http/index.js.map +1 -0
- package/dist/incoming/http/parseQuery.d.ts +4 -0
- package/dist/incoming/http/parseQuery.js +25 -0
- package/dist/incoming/http/parseQuery.js.map +1 -0
- package/dist/incoming/http/readBody.d.ts +4 -0
- package/dist/{network → incoming}/http/readBody.js +27 -32
- package/dist/incoming/http/readBody.js.map +1 -0
- package/dist/{handlers/rest/file → incoming/http/streamFunction}/DataStream.d.ts +0 -0
- package/dist/{network → incoming}/http/streamFunction/DataStream.js +0 -0
- package/dist/incoming/http/streamFunction/DataStream.js.map +1 -0
- package/dist/{network → incoming}/http/streamFunction/getExtension.d.ts +0 -0
- package/dist/{network → incoming}/http/streamFunction/getExtension.js +0 -0
- package/dist/incoming/http/streamFunction/getExtension.js.map +1 -0
- package/dist/incoming/http/streamFunction/index.d.ts +4 -0
- package/dist/incoming/http/streamFunction/index.js +106 -0
- package/dist/incoming/http/streamFunction/index.js.map +1 -0
- package/dist/incoming/http/streamFunction/multipartStream.d.ts +13 -0
- package/dist/{network → incoming}/http/streamFunction/multipartStream.js +12 -12
- package/dist/incoming/http/streamFunction/multipartStream.js.map +1 -0
- package/dist/{network → incoming}/http/streamFunction/stream.d.ts +3 -2
- package/dist/{network → incoming}/http/streamFunction/stream.js +16 -11
- package/dist/incoming/http/streamFunction/stream.js.map +1 -0
- package/dist/incoming/index.d.ts +3 -0
- package/dist/{network → incoming}/index.js +28 -28
- package/dist/incoming/index.js.map +1 -0
- package/dist/incoming/upgrade.d.ts +4 -0
- package/dist/{network → incoming}/upgrade.js +24 -9
- package/dist/incoming/upgrade.js.map +1 -0
- package/dist/incoming/ws/auth.d.ts +5 -0
- package/dist/incoming/ws/auth.js +40 -0
- package/dist/incoming/ws/auth.js.map +1 -0
- package/dist/incoming/ws/function.d.ts +3 -0
- package/dist/incoming/ws/function.js +107 -0
- package/dist/incoming/ws/function.js.map +1 -0
- package/dist/incoming/ws/get.d.ts +3 -0
- package/dist/incoming/ws/get.js +136 -0
- package/dist/incoming/ws/get.js.map +1 -0
- package/dist/incoming/ws/index.d.ts +3 -0
- package/dist/{network/message → incoming/ws}/index.js +17 -18
- package/dist/incoming/ws/index.js.map +1 -0
- package/dist/incoming/ws/observable.d.ts +6 -0
- package/dist/incoming/ws/observable.js +112 -0
- package/dist/incoming/ws/observable.js.map +1 -0
- package/dist/index.d.ts +10 -35
- package/dist/index.js +17 -196
- package/dist/index.js.map +1 -1
- package/dist/ip.d.ts +2 -0
- package/dist/ip.js +8 -0
- package/dist/ip.js.map +1 -0
- package/dist/observable/create.d.ts +3 -0
- package/dist/observable/create.js +30 -0
- package/dist/observable/create.js.map +1 -0
- package/dist/observable/destroy.d.ts +2 -0
- package/dist/observable/destroy.js +51 -0
- package/dist/observable/destroy.js.map +1 -0
- package/dist/observable/error.d.ts +4 -0
- package/dist/observable/error.js +17 -0
- package/dist/observable/error.js.map +1 -0
- package/dist/observable/extendCache.d.ts +2 -0
- package/dist/observable/extendCache.js +11 -0
- package/dist/observable/extendCache.js.map +1 -0
- package/dist/observable/genObservableId.d.ts +1 -0
- package/dist/observable/genObservableId.js +9 -0
- package/dist/observable/genObservableId.js.map +1 -0
- package/dist/observable/get.d.ts +4 -0
- package/dist/observable/get.js +15 -0
- package/dist/observable/get.js.map +1 -0
- package/dist/observable/index.d.ts +11 -8
- package/dist/observable/index.js +25 -151
- package/dist/observable/index.js.map +1 -1
- package/dist/observable/send.d.ts +6 -0
- package/dist/observable/send.js +32 -0
- package/dist/observable/send.js.map +1 -0
- package/dist/observable/start/error.d.ts +3 -0
- package/dist/observable/start/error.js +36 -0
- package/dist/observable/start/error.js.map +1 -0
- package/dist/observable/start/index.d.ts +2 -0
- package/dist/observable/start/index.js +46 -0
- package/dist/observable/start/index.js.map +1 -0
- package/dist/observable/start/update.d.ts +6 -0
- package/dist/observable/start/update.js +104 -0
- package/dist/observable/start/update.js.map +1 -0
- package/dist/observable/subscribe.d.ts +7 -0
- package/dist/observable/subscribe.js +54 -0
- package/dist/observable/subscribe.js.map +1 -0
- package/dist/observable/types.d.ts +26 -0
- package/dist/observable/types.js +3 -0
- package/dist/observable/types.js.map +1 -0
- package/dist/observable/unsub.d.ts +6 -0
- package/dist/observable/unsub.js +43 -0
- package/dist/observable/unsub.js.map +1 -0
- package/dist/observable/verify.d.ts +4 -0
- package/dist/observable/verify.js +18 -0
- package/dist/observable/verify.js.map +1 -0
- package/dist/protocol.d.ts +2 -0
- package/dist/protocol.js +32 -11
- package/dist/protocol.js.map +1 -1
- package/dist/security.d.ts +6 -0
- package/dist/security.js +95 -0
- package/dist/security.js.map +1 -0
- package/dist/sendError.d.ts +5 -0
- package/dist/sendError.js +42 -0
- package/dist/sendError.js.map +1 -0
- package/dist/sendHttpResponse.d.ts +4 -0
- package/dist/sendHttpResponse.js +53 -0
- package/dist/sendHttpResponse.js.map +1 -0
- package/dist/server.d.ts +42 -8
- package/dist/server.js +26 -12
- package/dist/server.js.map +1 -1
- package/package.json +16 -14
- package/.turbo/turbo-build.log +0 -4
- 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/auth/authorize.d.ts +0 -2
- package/dist/auth/authorize.js +0 -8
- package/dist/auth/authorize.js.map +0 -1
- package/dist/clientContext.d.ts +0 -0
- package/dist/clientContext.js +0 -83
- package/dist/clientContext.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/error.d.ts +0 -66
- package/dist/error.js +0 -149
- package/dist/error.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/functions/workerPool.d.ts +0 -0
- package/dist/functions/workerPool.js +0 -5
- package/dist/functions/workerPool.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.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 -105
- 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.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/network/http/authorize.d.ts +0 -3
- package/dist/network/http/authorize.js +0 -28
- package/dist/network/http/authorize.js.map +0 -1
- package/dist/network/http/compress.d.ts +0 -6
- package/dist/network/http/compress.js.map +0 -1
- package/dist/network/http/end.d.ts +0 -4
- package/dist/network/http/end.js +0 -19
- package/dist/network/http/end.js.map +0 -1
- package/dist/network/http/function.d.ts +0 -3
- package/dist/network/http/function.js.map +0 -1
- package/dist/network/http/get.d.ts +0 -3
- package/dist/network/http/get.js +0 -129
- package/dist/network/http/get.js.map +0 -1
- package/dist/network/http/index.js +0 -122
- package/dist/network/http/index.js.map +0 -1
- package/dist/network/http/readBody.d.ts +0 -3
- package/dist/network/http/readBody.js.map +0 -1
- package/dist/network/http/send.d.ts +0 -5
- package/dist/network/http/send.js +0 -60
- package/dist/network/http/send.js.map +0 -1
- package/dist/network/http/streamFunction/DataStream.d.ts +0 -7
- package/dist/network/http/streamFunction/DataStream.js.map +0 -1
- package/dist/network/http/streamFunction/getExtension.js.map +0 -1
- package/dist/network/http/streamFunction/index.d.ts +0 -3
- package/dist/network/http/streamFunction/index.js +0 -81
- package/dist/network/http/streamFunction/index.js.map +0 -1
- package/dist/network/http/streamFunction/multipartStream.d.ts +0 -12
- package/dist/network/http/streamFunction/multipartStream.js.map +0 -1
- package/dist/network/http/streamFunction/stream.js.map +0 -1
- package/dist/network/index.d.ts +0 -4
- package/dist/network/index.js.map +0 -1
- package/dist/network/message/auth.d.ts +0 -4
- package/dist/network/message/auth.js +0 -32
- package/dist/network/message/auth.js.map +0 -1
- package/dist/network/message/function.d.ts +0 -3
- package/dist/network/message/function.js +0 -67
- package/dist/network/message/function.js.map +0 -1
- package/dist/network/message/get.d.ts +0 -3
- package/dist/network/message/get.js +0 -109
- package/dist/network/message/get.js.map +0 -1
- package/dist/network/message/index.d.ts +0 -3
- package/dist/network/message/index.js.map +0 -1
- package/dist/network/message/observable.d.ts +0 -5
- package/dist/network/message/observable.js +0 -103
- package/dist/network/message/observable.js.map +0 -1
- package/dist/network/message/send.d.ts +0 -4
- package/dist/network/message/send.js +0 -11
- package/dist/network/message/send.js.map +0 -1
- package/dist/network/upgrade.d.ts +0 -4
- package/dist/network/upgrade.js.map +0 -1
- package/dist/network/worker/get.d.ts +0 -0
- package/dist/network/worker/get.js +0 -122
- package/dist/network/worker/get.js.map +0 -1
- package/dist/network/worker/observable.d.ts +0 -0
- package/dist/network/worker/observable.js +0 -120
- package/dist/network/worker/observable.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/security/index.d.ts +0 -2
- package/dist/security/index.js +0 -57
- package/dist/security/index.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/worker/authorize.d.ts +0 -5
- package/dist/worker/authorize.js +0 -15
- package/dist/worker/authorize.js.map +0 -1
- package/dist/worker/fnMap.d.ts +0 -2
- package/dist/worker/fnMap.js +0 -5
- package/dist/worker/fnMap.js.map +0 -1
- package/dist/worker/functions.d.ts +0 -3
- package/dist/worker/functions.js +0 -8
- package/dist/worker/functions.js.map +0 -1
- package/dist/worker/http/function.d.ts +0 -4
- package/dist/worker/http/function.js +0 -75
- package/dist/worker/http/function.js.map +0 -1
- package/dist/worker/index.d.ts +0 -1
- package/dist/worker/index.js +0 -101
- package/dist/worker/index.js.map +0 -1
- package/dist/worker/observable.d.ts +0 -15
- package/dist/worker/observable.js +0 -110
- package/dist/worker/observable.js.map +0 -1
- package/dist/worker/ws/function.d.ts +0 -3
- package/dist/worker/ws/function.js +0 -42
- package/dist/worker/ws/function.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
package/dist/index.js
CHANGED
|
@@ -13,203 +13,24 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const closeListener_1 = __importDefault(require("./closeListener"));
|
|
27
|
-
const Client_1 = __importDefault(require("./Client"));
|
|
28
|
-
exports.User = Client_1.default;
|
|
29
|
-
const selva_1 = require("@saulx/selva");
|
|
30
|
-
const utils_1 = require("@saulx/utils");
|
|
31
|
-
const rest_1 = __importDefault(require("./handlers/rest"));
|
|
32
|
-
const BasedServerClient_1 = __importDefault(require("./BasedServerClient"));
|
|
33
|
-
exports.BasedServerClient = BasedServerClient_1.default;
|
|
34
|
-
const Params_1 = require("./Params");
|
|
35
|
-
Object.defineProperty(exports, "Params", { enumerable: true, get: function () { return Params_1.Params; } });
|
|
36
|
-
const getFromConfig_1 = require("./getFromConfig");
|
|
37
|
-
const pkg = require('../package.json');
|
|
38
|
-
__exportStar(require("./types"), exports);
|
|
39
|
-
class BasedServer extends events_1.EventEmitter {
|
|
40
|
-
constructor({ key, cert, useLessMemory, port, db, config, state, }) {
|
|
41
|
-
super();
|
|
42
|
-
this.subscriptions = {};
|
|
43
|
-
// will be clients
|
|
44
|
-
this.clients = {};
|
|
45
|
-
if (state) {
|
|
46
|
-
this.state = state;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
this.state = {};
|
|
50
|
-
}
|
|
51
|
-
if (config?.functionConfig) {
|
|
52
|
-
const interval = ~~(config.functionConfig.idleTimeout / 2);
|
|
53
|
-
const clear = async () => {
|
|
54
|
-
if (config.functions) {
|
|
55
|
-
for (const key in config.functions) {
|
|
56
|
-
// & key !== open && key !== close
|
|
57
|
-
// good name ?
|
|
58
|
-
// based init - will ask project env org (all optional ofc)
|
|
59
|
-
if (key !== 'authorize' && !key.startsWith('event-')) {
|
|
60
|
-
if (config.functions[key].cnt === 2) {
|
|
61
|
-
await config.functionConfig.clear(this, key);
|
|
62
|
-
delete config.functions[key];
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
if (config.functions[key].cnt !== undefined) {
|
|
66
|
-
config.functions[key].cnt++;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
setTimeout(clear, interval);
|
|
73
|
-
};
|
|
74
|
-
setTimeout(clear, interval);
|
|
75
|
-
}
|
|
76
|
-
if (config?.secretsConfig) {
|
|
77
|
-
config.secretsConfig.secretTimeouts = {};
|
|
78
|
-
const interval = ~~(config.secretsConfig.idleTimeout / 2);
|
|
79
|
-
const clear = async () => {
|
|
80
|
-
if (config.secrets) {
|
|
81
|
-
for (const key in config.secretsConfig.secretTimeouts) {
|
|
82
|
-
if (config.secretsConfig.secretTimeouts[key] === 2) {
|
|
83
|
-
// await config.secretsConfig.clear(this, key)
|
|
84
|
-
delete config.secretsConfig.secretTimeouts[key];
|
|
85
|
-
// delete config.secrets[key]
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
if (config.secretsConfig.secretTimeouts[key] !== undefined) {
|
|
89
|
-
config.secretsConfig.secretTimeouts[key]++;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
setTimeout(clear, interval);
|
|
95
|
-
};
|
|
96
|
-
setTimeout(clear, interval);
|
|
97
|
-
}
|
|
98
|
-
const app = key && cert
|
|
99
|
-
? uws_1.default.SSLApp({
|
|
100
|
-
key_file_name: key,
|
|
101
|
-
cert_file_name: cert,
|
|
102
|
-
ssl_prefer_low_memory_usage: useLessMemory,
|
|
103
|
-
})
|
|
104
|
-
: uws_1.default.App();
|
|
105
|
-
if (port) {
|
|
106
|
-
this.port = port;
|
|
107
|
-
}
|
|
108
|
-
app
|
|
109
|
-
.ws('/*', {
|
|
110
|
-
maxPayloadLength: 1024 * 1024 * 16 * 1000,
|
|
111
|
-
idleTimeout: 100,
|
|
112
|
-
compression: uws_1.default.SHARED_COMPRESSOR,
|
|
113
|
-
upgrade: (res, req, ctx) => {
|
|
114
|
-
(0, upgradeListener_1.default)(this, res, req, ctx);
|
|
115
|
-
},
|
|
116
|
-
message: (ws, msg) => {
|
|
117
|
-
(0, handlers_1.default)(this, ws, msg);
|
|
118
|
-
},
|
|
119
|
-
open: (ws) => {
|
|
120
|
-
(0, openListener_1.default)(this, ws);
|
|
121
|
-
},
|
|
122
|
-
close: (ws) => {
|
|
123
|
-
(0, closeListener_1.default)(this, ws);
|
|
124
|
-
},
|
|
125
|
-
drain: (ws) => {
|
|
126
|
-
// call client.drain can be much more efficient
|
|
127
|
-
if (ws.client && ws.client.backpressureQueue) {
|
|
128
|
-
ws.client.drain();
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
})
|
|
132
|
-
// /with name
|
|
133
|
-
.get('/*', (res, req) => (0, rest_1.default)(this, req, res))
|
|
134
|
-
.post('/*', (res, req) => (0, rest_1.default)(this, req, res))
|
|
135
|
-
.options('/*', (res, req) => (0, rest_1.default)(this, req, res));
|
|
136
|
-
this.uwsApp = app;
|
|
137
|
-
this.db = (0, selva_1.connect)(db);
|
|
138
|
-
if (config) {
|
|
139
|
-
const based = new BasedServerClient_1.default(new Params_1.Params(this, {
|
|
140
|
-
payload: {},
|
|
141
|
-
callStack: ['server'],
|
|
142
|
-
}), true);
|
|
143
|
-
this.based = based;
|
|
144
|
-
this.on('open', (client) => {
|
|
145
|
-
if (config.onOpen) {
|
|
146
|
-
config.onOpen({ user: client, based });
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
this.on('close', (client) => {
|
|
150
|
-
if (config.onClose) {
|
|
151
|
-
config.onClose({ user: client, based });
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
this.config = config;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
restartSubscription(name) {
|
|
158
|
-
for (const id in this.subscriptions) {
|
|
159
|
-
const sub = this.subscriptions[id];
|
|
160
|
-
// @ts-ignore
|
|
161
|
-
if (sub.name === name) {
|
|
162
|
-
// @ts-ignore
|
|
163
|
-
sub.restart();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
start(port) {
|
|
168
|
-
if (!port) {
|
|
169
|
-
port = this.port;
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
this.port = port;
|
|
173
|
-
}
|
|
174
|
-
return new Promise((resolve, reject) => {
|
|
175
|
-
this.uwsApp.listen(this.port, (listenSocket) => {
|
|
176
|
-
if (listenSocket) {
|
|
177
|
-
console.info(`💫 Based-server ${pkg.version} listening on port:`, this.port);
|
|
178
|
-
// do this better wrap a nice thing arround it
|
|
179
|
-
this.listenSocket = listenSocket;
|
|
180
|
-
resolve(this);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
console.info('🤮 Based-server error on port:', this.port);
|
|
184
|
-
reject(new Error('Cannot start based-server on port: ' + this.port));
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
async getFunction(name) {
|
|
190
|
-
return (0, getFromConfig_1.getFunction)(this, name);
|
|
191
|
-
}
|
|
192
|
-
async destroy() {
|
|
193
|
-
console.info('🔥 Destroy based-server');
|
|
194
|
-
for (const c in this.clients) {
|
|
195
|
-
this.clients[c].destroy();
|
|
196
|
-
delete this.clients[c];
|
|
197
|
-
}
|
|
198
|
-
if (this.listenSocket) {
|
|
199
|
-
uws_1.default.us_listen_socket_close(this.listenSocket);
|
|
200
|
-
this.listenSocket = null;
|
|
201
|
-
}
|
|
202
|
-
this.listenSocket = null;
|
|
203
|
-
this.uwsApp = null;
|
|
204
|
-
await this.db.destroy();
|
|
205
|
-
this.db = null;
|
|
206
|
-
await (0, utils_1.wait)(1000);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
exports.BasedServer = BasedServer;
|
|
210
|
-
const createServer = async (props) => {
|
|
211
|
-
const basedServer = new BasedServer(props);
|
|
212
|
-
return props.port ? basedServer.start() : basedServer;
|
|
17
|
+
exports.sendError = exports.sendHttpResponse = exports.compress = exports.BasedServer = void 0;
|
|
18
|
+
const server_1 = require("./server");
|
|
19
|
+
Object.defineProperty(exports, "BasedServer", { enumerable: true, get: function () { return server_1.BasedServer; } });
|
|
20
|
+
const createServer = async (props, sharedSocket) => {
|
|
21
|
+
const basedServer = new server_1.BasedServer(props);
|
|
22
|
+
return props.port ? basedServer.start(props.port, sharedSocket) : basedServer;
|
|
213
23
|
};
|
|
214
24
|
exports.default = createServer;
|
|
25
|
+
// maybe send responsed
|
|
26
|
+
var compress_1 = require("./compress");
|
|
27
|
+
Object.defineProperty(exports, "compress", { enumerable: true, get: function () { return compress_1.compress; } });
|
|
28
|
+
var sendHttpResponse_1 = require("./sendHttpResponse");
|
|
29
|
+
Object.defineProperty(exports, "sendHttpResponse", { enumerable: true, get: function () { return sendHttpResponse_1.sendHttpResponse; } });
|
|
30
|
+
var sendError_1 = require("./sendError");
|
|
31
|
+
Object.defineProperty(exports, "sendError", { enumerable: true, get: function () { return sendError_1.sendError; } });
|
|
32
|
+
__exportStar(require("./auth/types"), exports);
|
|
33
|
+
__exportStar(require("./functions/types"), exports);
|
|
34
|
+
__exportStar(require("./error"), exports);
|
|
35
|
+
__exportStar(require("./api"), exports);
|
|
215
36
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAqD;AAU5C,4FAVA,oBAAW,OAUA;AARpB,MAAM,YAAY,GAAG,KAAK,EACxB,KAAoB,EACpB,YAAsB,EACA,EAAE;IACxB,MAAM,WAAW,GAAG,IAAI,oBAAW,CAAC,KAAK,CAAC,CAAA;IAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;AAC/E,CAAC,CAAA;AAID,kBAAe,YAAY,CAAA;AAE3B,uBAAuB;AACvB,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,+CAA4B;AAC5B,oDAAiC;AACjC,0CAAuB;AACvB,wCAAqB"}
|
package/dist/ip.d.ts
ADDED
package/dist/ip.js
ADDED
package/dist/ip.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ip.js","sourceRoot":"","sources":["../src/ip.ts"],"names":[],"mappings":";;;AAEO,MAAM,KAAK,GAAG,CAAC,GAAqB,EAAU,EAAE;IACrD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;AAC7D,CAAC,CAAA;AAFY,QAAA,KAAK,SAEjB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createObs = void 0;
|
|
4
|
+
const start_1 = require("./start");
|
|
5
|
+
const get_1 = require("./get");
|
|
6
|
+
const createObs = (server, name, id, payload) => {
|
|
7
|
+
if ((0, get_1.hasObs)(server, id)) {
|
|
8
|
+
const msg = `Allready has observable ${name} ${id}`;
|
|
9
|
+
console.error(msg);
|
|
10
|
+
throw new Error(msg);
|
|
11
|
+
}
|
|
12
|
+
const obs = {
|
|
13
|
+
payload,
|
|
14
|
+
reusedCache: false,
|
|
15
|
+
clients: new Set(),
|
|
16
|
+
functionObserveClients: new Set(),
|
|
17
|
+
id,
|
|
18
|
+
name,
|
|
19
|
+
isDestroyed: false,
|
|
20
|
+
};
|
|
21
|
+
if (!server.activeObservables[name]) {
|
|
22
|
+
server.activeObservables[name] = new Map();
|
|
23
|
+
}
|
|
24
|
+
server.activeObservables[name].set(id, obs);
|
|
25
|
+
server.activeObservablesById.set(id, obs);
|
|
26
|
+
(0, start_1.start)(server, id);
|
|
27
|
+
return obs;
|
|
28
|
+
};
|
|
29
|
+
exports.createObs = createObs;
|
|
30
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/observable/create.ts"],"names":[],"mappings":";;;AAEA,mCAA+B;AAC/B,+BAA8B;AAEvB,MAAM,SAAS,GAAG,CACvB,MAAmB,EACnB,IAAY,EACZ,EAAU,EACV,OAAY,EACM,EAAE;IACpB,IAAI,IAAA,YAAM,EAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACtB,MAAM,GAAG,GAAG,2BAA2B,IAAI,IAAI,EAAE,EAAE,CAAA;QACnD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;KACrB;IAED,MAAM,GAAG,GAAqB;QAC5B,OAAO;QACP,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,sBAAsB,EAAE,IAAI,GAAG,EAAE;QACjC,EAAE;QACF,IAAI;QACJ,WAAW,EAAE,KAAK;KACnB,CAAA;IAED,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;QACnC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,EAAE,CAAA;KAC3C;IAED,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;IAC3C,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;IAEzC,IAAA,aAAK,EAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAEjB,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAhCY,QAAA,SAAS,aAgCrB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destroyObs = void 0;
|
|
4
|
+
const functions_1 = require("../functions");
|
|
5
|
+
const destroyObs = (server, id) => {
|
|
6
|
+
const obs = server.activeObservablesById.get(id);
|
|
7
|
+
if (!obs) {
|
|
8
|
+
console.error('Observable', id, 'does not exists');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (obs.isDestroyed) {
|
|
12
|
+
console.error('Obs allready destroyed', obs.name);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (obs.clients.size ||
|
|
16
|
+
obs.functionObserveClients.size ||
|
|
17
|
+
obs.onNextData?.size) {
|
|
18
|
+
if (obs.beingDestroyed) {
|
|
19
|
+
console.warn(`Obs being destroyed while clients/workers/getListeners are present ${obs.name} ${obs.id}`, obs.payload);
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const spec = server.functions.specs[obs.name];
|
|
24
|
+
if (!spec || !(0, functions_1.isObservableFunctionSpec)(spec)) {
|
|
25
|
+
console.warn('Cannot find observable function spec!', obs.name);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!obs.beingDestroyed) {
|
|
29
|
+
const memCacheTimeout = spec.memCacheTimeout ?? server.functions.config.memCacheTimeout;
|
|
30
|
+
obs.beingDestroyed = setTimeout(() => {
|
|
31
|
+
// console.info(` Destroy observable ${obs.name} ${obs.id}`, obs.payload)
|
|
32
|
+
obs.beingDestroyed = null;
|
|
33
|
+
if (!server.activeObservables[obs.name]) {
|
|
34
|
+
console.info('Trying to destroy a removed observable function');
|
|
35
|
+
server.activeObservablesById.delete(id);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
server.activeObservables[obs.name].delete(id);
|
|
39
|
+
if (server.activeObservables[obs.name].size === 0) {
|
|
40
|
+
delete server.activeObservables[obs.name];
|
|
41
|
+
}
|
|
42
|
+
server.activeObservablesById.delete(id);
|
|
43
|
+
obs.isDestroyed = true;
|
|
44
|
+
if (obs.closeFunction) {
|
|
45
|
+
obs.closeFunction();
|
|
46
|
+
}
|
|
47
|
+
}, memCacheTimeout);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.destroyObs = destroyObs;
|
|
51
|
+
//# sourceMappingURL=destroy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../src/observable/destroy.ts"],"names":[],"mappings":";;;AAAA,4CAAuD;AAGhD,MAAM,UAAU,GAAG,CAAC,MAAmB,EAAE,EAAU,EAAE,EAAE;IAC5D,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEhD,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;QAClD,OAAM;KACP;IAED,IAAI,GAAG,CAAC,WAAW,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;QACjD,OAAM;KACP;IAED,IACE,GAAG,CAAC,OAAO,CAAC,IAAI;QAChB,GAAG,CAAC,sBAAsB,CAAC,IAAI;QAC/B,GAAG,CAAC,UAAU,EAAE,IAAI,EACpB;QACA,IAAI,GAAG,CAAC,cAAc,EAAE;YACtB,OAAO,CAAC,IAAI,CACV,sEAAsE,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,EAAE,EAC1F,GAAG,CAAC,OAAO,CACZ,CAAA;SACF;QACD,OAAM;KACP;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAE7C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAA,oCAAwB,EAAC,IAAI,CAAC,EAAE;QAC5C,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;QAC/D,OAAM;KACP;IAED,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE;QACvB,MAAM,eAAe,GACnB,IAAI,CAAC,eAAe,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,eAAe,CAAA;QAEjE,GAAG,CAAC,cAAc,GAAG,UAAU,CAAC,GAAG,EAAE;YACnC,2EAA2E;YAC3E,GAAG,CAAC,cAAc,GAAG,IAAI,CAAA;YACzB,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gBACvC,OAAO,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAA;gBAC/D,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;gBACvC,OAAM;aACP;YACD,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YAC7C,IAAI,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;gBACjD,OAAO,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;aAC1C;YACD,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YACvC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAA;YACtB,IAAI,GAAG,CAAC,aAAa,EAAE;gBACrB,GAAG,CAAC,aAAa,EAAE,CAAA;aACpB;QACH,CAAC,EAAE,eAAe,CAAC,CAAA;KACpB;AACH,CAAC,CAAA;AAzDY,QAAA,UAAU,cAyDtB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BasedServer } from '../server';
|
|
2
|
+
import { Context, WebSocketSession, HttpSession } from '../context';
|
|
3
|
+
import { BasedErrorCode, BasedError } from '../error';
|
|
4
|
+
export declare const sendObsGetError: (server: BasedServer, ctx: Context<WebSocketSession | HttpSession>, id: number, name: string, err: BasedError<BasedErrorCode.ObservableFunctionError>) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendObsGetError = void 0;
|
|
4
|
+
const destroy_1 = require("./destroy");
|
|
5
|
+
const sendError_1 = require("../sendError");
|
|
6
|
+
const sendObsGetError = (server, ctx, id, name, err) => {
|
|
7
|
+
(0, sendError_1.sendError)(server, ctx, err.code, {
|
|
8
|
+
observableId: id,
|
|
9
|
+
route: {
|
|
10
|
+
name,
|
|
11
|
+
},
|
|
12
|
+
err: err,
|
|
13
|
+
});
|
|
14
|
+
(0, destroy_1.destroyObs)(server, id);
|
|
15
|
+
};
|
|
16
|
+
exports.sendObsGetError = sendObsGetError;
|
|
17
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/observable/error.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAGtC,4CAAwC;AAEjC,MAAM,eAAe,GAAG,CAC7B,MAAmB,EACnB,GAA4C,EAC5C,EAAU,EACV,IAAY,EACZ,GAAuD,EACvD,EAAE;IACF,IAAA,qBAAS,EAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;QAC/B,YAAY,EAAE,EAAE;QAChB,KAAK,EAAE;YACL,IAAI;SACL;QACD,GAAG,EAAE,GAAG;KACT,CAAC,CAAA;IACF,IAAA,oBAAU,EAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACxB,CAAC,CAAA;AAfY,QAAA,eAAe,mBAe3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extendCache = void 0;
|
|
4
|
+
const extendCache = (obs) => {
|
|
5
|
+
if (obs.beingDestroyed) {
|
|
6
|
+
clearTimeout(obs.beingDestroyed);
|
|
7
|
+
obs.beingDestroyed = null;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
exports.extendCache = extendCache;
|
|
11
|
+
//# sourceMappingURL=extendCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extendCache.js","sourceRoot":"","sources":["../../src/observable/extendCache.ts"],"names":[],"mappings":";;;AAEO,MAAM,WAAW,GAAG,CAAC,GAAqB,EAAE,EAAE;IACnD,IAAI,GAAG,CAAC,cAAc,EAAE;QACtB,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QAChC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAA;KAC1B;AACH,CAAC,CAAA;AALY,QAAA,WAAW,eAKvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const genObservableId: (name: string, payload: any) => number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genObservableId = void 0;
|
|
4
|
+
const hash_1 = require("@saulx/hash");
|
|
5
|
+
const genObservableId = (name, payload) => {
|
|
6
|
+
return (0, hash_1.hashObjectIgnoreKeyOrder)([name, payload]);
|
|
7
|
+
};
|
|
8
|
+
exports.genObservableId = genObservableId;
|
|
9
|
+
//# sourceMappingURL=genObservableId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genObservableId.js","sourceRoot":"","sources":["../../src/observable/genObservableId.ts"],"names":[],"mappings":";;;AAAA,sCAAsD;AAE/C,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,OAAY,EAAU,EAAE;IACpE,OAAO,IAAA,+BAAwB,EAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;AAClD,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasObs = exports.getObs = void 0;
|
|
4
|
+
const extendCache_1 = require("./extendCache");
|
|
5
|
+
const getObs = (server, id) => {
|
|
6
|
+
const obs = server.activeObservablesById.get(id);
|
|
7
|
+
(0, extendCache_1.extendCache)(obs);
|
|
8
|
+
return obs;
|
|
9
|
+
};
|
|
10
|
+
exports.getObs = getObs;
|
|
11
|
+
const hasObs = (server, id) => {
|
|
12
|
+
return server.activeObservablesById.has(id);
|
|
13
|
+
};
|
|
14
|
+
exports.hasObs = hasObs;
|
|
15
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/observable/get.ts"],"names":[],"mappings":";;;AAEA,+CAA2C;AAEpC,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAE,EAAU,EAAoB,EAAE;IAC1E,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAChD,IAAA,yBAAW,EAAC,GAAG,CAAC,CAAA;IAChB,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAJY,QAAA,MAAM,UAIlB;AAEM,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAE,EAAU,EAAW,EAAE;IACjE,OAAO,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAC7C,CAAC,CAAA;AAFY,QAAA,MAAM,UAElB"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
1
|
+
export * from './subscribe';
|
|
2
|
+
export * from './unsub';
|
|
3
|
+
export * from './destroy';
|
|
4
|
+
export * from './create';
|
|
5
|
+
export * from './extendCache';
|
|
6
|
+
export * from './start';
|
|
7
|
+
export * from './verify';
|
|
8
|
+
export * from './send';
|
|
9
|
+
export * from './get';
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './genObservableId';
|