@based/server 4.0.1 → 4.0.3
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/auth/defaultConfig.d.ts +3 -0
- package/dist/auth/defaultConfig.js +12 -0
- package/dist/auth/defaultConfig.js.map +1 -0
- package/dist/auth/index.d.ts +12 -6
- package/dist/auth/index.js +31 -20
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/parseAuthState.d.ts +2 -1
- package/dist/auth/parseAuthState.js +28 -6
- package/dist/auth/parseAuthState.js.map +1 -1
- package/dist/authorize.d.ts +9 -0
- package/dist/authorize.js +59 -0
- package/dist/authorize.js.map +1 -0
- package/dist/compress.js +3 -0
- package/dist/compress.js.map +1 -1
- package/dist/createSimpleServer.d.ts +20 -10
- package/dist/createSimpleServer.js +64 -53
- package/dist/createSimpleServer.js.map +1 -1
- package/dist/error/errorTypeHandlers.js +31 -12
- package/dist/error/errorTypeHandlers.js.map +1 -1
- package/dist/error/index.d.ts +11 -1
- package/dist/error/index.js +9 -10
- package/dist/error/index.js.map +1 -1
- package/dist/error/types.d.ts +41 -45
- package/dist/error/types.js +3 -1
- package/dist/error/types.js.map +1 -1
- package/dist/functionApi/callFunction copy.d.ts +3 -0
- package/dist/functionApi/callFunction copy.js +29 -0
- package/dist/functionApi/callFunction copy.js.map +1 -0
- package/dist/functionApi/callFunction.d.ts +3 -0
- package/dist/functionApi/callFunction.js +29 -0
- package/dist/functionApi/callFunction.js.map +1 -0
- package/dist/functionApi/client/index.d.ts +17 -0
- package/dist/functionApi/client/index.js +54 -0
- package/dist/functionApi/client/index.js.map +1 -0
- package/dist/functionApi/client/query.d.ts +11 -0
- package/dist/functionApi/client/query.js +32 -0
- package/dist/functionApi/client/query.js.map +1 -0
- package/dist/functionApi/get.d.ts +3 -0
- package/dist/functionApi/get.js +71 -0
- package/dist/functionApi/get.js.map +1 -0
- package/dist/functionApi/index.d.ts +5 -0
- package/dist/functionApi/index.js +25 -0
- package/dist/functionApi/index.js.map +1 -0
- package/dist/functionApi/observe.d.ts +4 -0
- package/dist/functionApi/observe.js +44 -0
- package/dist/functionApi/observe.js.map +1 -0
- package/dist/functionApi/stream.d.ts +3 -0
- package/dist/functionApi/stream.js +30 -0
- package/dist/functionApi/stream.js.map +1 -0
- package/dist/functions/index.d.ts +16 -8
- package/dist/functions/index.js +39 -10
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/timeout.d.ts +3 -3
- package/dist/functions/timeout.js.map +1 -1
- package/dist/functions/types.d.ts +45 -31
- package/dist/functions/types.js +40 -12
- package/dist/functions/types.js.map +1 -1
- package/dist/incoming/http/function.d.ts +3 -4
- package/dist/incoming/http/function.js +29 -35
- package/dist/incoming/http/function.js.map +1 -1
- package/dist/incoming/http/get.d.ts +3 -3
- package/dist/incoming/http/get.js +44 -43
- package/dist/incoming/http/get.js.map +1 -1
- package/dist/incoming/http/index.js +50 -31
- package/dist/incoming/http/index.js.map +1 -1
- package/dist/incoming/http/parseQuery.d.ts +1 -1
- package/dist/incoming/http/parseQuery.js +3 -1
- package/dist/incoming/http/parseQuery.js.map +1 -1
- package/dist/incoming/http/query.d.ts +4 -0
- package/dist/incoming/http/query.js +165 -0
- package/dist/incoming/http/query.js.map +1 -0
- package/dist/incoming/http/readBody.d.ts +4 -3
- package/dist/incoming/http/readBody.js +32 -8
- package/dist/incoming/http/readBody.js.map +1 -1
- package/dist/incoming/http/streamFunction/DataStream.d.ts +8 -0
- package/dist/incoming/http/streamFunction/DataStream.js +42 -3
- package/dist/incoming/http/streamFunction/DataStream.js.map +1 -1
- package/dist/incoming/http/streamFunction/getExtension.d.ts +1 -1
- package/dist/incoming/http/streamFunction/index.d.ts +3 -3
- package/dist/incoming/http/streamFunction/index.js +6 -87
- package/dist/incoming/http/streamFunction/index.js.map +1 -1
- package/dist/incoming/http/streamFunction/multiPart/index.d.ts +4 -0
- package/dist/incoming/http/streamFunction/multiPart/index.js +66 -0
- package/dist/incoming/http/streamFunction/multiPart/index.js.map +1 -0
- package/dist/incoming/http/streamFunction/multiPart/readFormData.d.ts +12 -0
- package/dist/incoming/http/streamFunction/{multipartStream.js → multiPart/readFormData.js} +80 -86
- package/dist/incoming/http/streamFunction/multiPart/readFormData.js.map +1 -0
- package/dist/incoming/http/streamFunction/stream/createStream.d.ts +6 -0
- package/dist/incoming/http/streamFunction/{stream.js → stream/createStream.js} +5 -38
- package/dist/incoming/http/streamFunction/stream/createStream.js.map +1 -0
- package/dist/incoming/http/streamFunction/stream/index.d.ts +4 -0
- package/dist/incoming/http/streamFunction/stream/index.js +70 -0
- package/dist/incoming/http/streamFunction/stream/index.js.map +1 -0
- package/dist/incoming/index.d.ts +1 -1
- package/dist/incoming/index.js +13 -11
- package/dist/incoming/index.js.map +1 -1
- package/dist/incoming/upgrade.js +18 -9
- package/dist/incoming/upgrade.js.map +1 -1
- package/dist/incoming/ws/auth.d.ts +4 -4
- package/dist/incoming/ws/auth.js +37 -19
- package/dist/incoming/ws/auth.js.map +1 -1
- package/dist/incoming/ws/function.d.ts +2 -3
- package/dist/incoming/ws/function.js +21 -73
- package/dist/incoming/ws/function.js.map +1 -1
- package/dist/incoming/ws/get.d.ts +2 -3
- package/dist/incoming/ws/get.js +33 -54
- package/dist/incoming/ws/get.js.map +1 -1
- package/dist/incoming/ws/index.d.ts +1 -1
- package/dist/incoming/ws/index.js +2 -1
- package/dist/incoming/ws/index.js.map +1 -1
- package/dist/incoming/ws/observable.d.ts +7 -6
- package/dist/incoming/ws/observable.js +25 -49
- package/dist/incoming/ws/observable.js.map +1 -1
- package/dist/incoming/ws/types.d.ts +3 -0
- package/dist/{auth → incoming/ws}/types.js +0 -0
- package/dist/{auth → incoming/ws}/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/installFn.d.ts +4 -0
- package/dist/installFn.js +94 -0
- package/dist/installFn.js.map +1 -0
- package/dist/observable/create.d.ts +1 -1
- package/dist/observable/create.js +5 -1
- package/dist/observable/create.js.map +1 -1
- package/dist/observable/destroy.js +1 -1
- package/dist/observable/destroy.js.map +1 -1
- package/dist/observable/index.d.ts +0 -1
- package/dist/observable/index.js +0 -1
- package/dist/observable/index.js.map +1 -1
- package/dist/observable/send.d.ts +3 -3
- package/dist/observable/send.js +2 -8
- package/dist/observable/send.js.map +1 -1
- package/dist/observable/start/error.d.ts +2 -1
- package/dist/observable/start/error.js +13 -11
- package/dist/observable/start/error.js.map +1 -1
- package/dist/observable/start/index.js +17 -8
- package/dist/observable/start/index.js.map +1 -1
- package/dist/observable/subscribe.d.ts +3 -3
- package/dist/observable/subscribe.js +6 -12
- package/dist/observable/subscribe.js.map +1 -1
- package/dist/observable/types.d.ts +6 -5
- package/dist/observable/unsub.d.ts +1 -1
- package/dist/observable/unsub.js.map +1 -1
- package/dist/protocol.d.ts +1 -0
- package/dist/protocol.js +11 -1
- package/dist/protocol.js.map +1 -1
- package/dist/security.d.ts +1 -1
- package/dist/security.js +1 -1
- package/dist/security.js.map +1 -1
- package/dist/sendError.d.ts +3 -2
- package/dist/sendError.js +30 -16
- package/dist/sendError.js.map +1 -1
- package/dist/sendHttpResponse.d.ts +3 -2
- package/dist/sendHttpResponse.js +62 -10
- package/dist/sendHttpResponse.js.map +1 -1
- package/dist/server.d.ts +10 -3
- package/dist/server.js +16 -4
- package/dist/server.js.map +1 -1
- package/dist/verifyRoute.d.ts +14 -0
- package/dist/verifyRoute.js +99 -0
- package/dist/verifyRoute.js.map +1 -0
- package/package.json +4 -2
- 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/api/index.d.ts +0 -7
- package/dist/api/index.js +0 -173
- package/dist/api/index.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/auth/dummyAuth.d.ts +0 -2
- package/dist/auth/dummyAuth.js +0 -8
- package/dist/auth/dummyAuth.js.map +0 -1
- package/dist/auth/types.d.ts +0 -10
- 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/context.d.ts +0 -54
- package/dist/context.js +0 -18
- package/dist/context.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.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/http/authorize.d.ts +0 -4
- package/dist/incoming/http/authorize.js +0 -37
- package/dist/incoming/http/authorize.js.map +0 -1
- package/dist/incoming/http/streamFunction/multipartStream.d.ts +0 -13
- package/dist/incoming/http/streamFunction/multipartStream.js.map +0 -1
- package/dist/incoming/http/streamFunction/stream.d.ts +0 -6
- package/dist/incoming/http/streamFunction/stream.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 +0 -56
- 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 +0 -47
- 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.d.ts +0 -3
- 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 +0 -112
- 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 +0 -19
- package/dist/network/http/streamFunction/DataStream.js.map +0 -1
- package/dist/network/http/streamFunction/getExtension.d.ts +0 -2
- package/dist/network/http/streamFunction/getExtension.js +0 -29
- 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 +0 -208
- package/dist/network/http/streamFunction/multipartStream.js.map +0 -1
- package/dist/network/http/streamFunction/stream.d.ts +0 -5
- package/dist/network/http/streamFunction/stream.js +0 -103
- package/dist/network/http/streamFunction/stream.js.map +0 -1
- package/dist/network/index.d.ts +0 -4
- package/dist/network/index.js +0 -84
- 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 +0 -62
- 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 +0 -49
- 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/observable/error.d.ts +0 -4
- package/dist/observable/error.js +0 -17
- package/dist/observable/error.js.map +0 -1
- package/dist/observable/verify.d.ts +0 -4
- package/dist/observable/verify.js +0 -18
- package/dist/observable/verify.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 -3
- package/dist/security/index.js +0 -66
- 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
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.httpGet = void 0;
|
|
7
|
-
const functions_1 = require("../../functions");
|
|
8
7
|
const sendHttpResponse_1 = require("../../sendHttpResponse");
|
|
9
8
|
const compress_1 = require("../../compress");
|
|
10
9
|
const observable_1 = require("../../observable");
|
|
@@ -13,8 +12,10 @@ const utils_1 = require("@saulx/utils");
|
|
|
13
12
|
const error_1 = require("../../error");
|
|
14
13
|
const sendError_1 = require("../../sendError");
|
|
15
14
|
const node_util_1 = require("node:util");
|
|
15
|
+
const authorize_1 = require("../../authorize");
|
|
16
|
+
const installFn_1 = require("../../installFn");
|
|
16
17
|
const inflate = (0, node_util_1.promisify)(node_zlib_1.default.inflate);
|
|
17
|
-
const sendCacheSwapEncoding = async (server, route, ctx, buffer, checksum) => {
|
|
18
|
+
const sendCacheSwapEncoding = async (server, route, ctx, buffer, checksum, headers, status = '200 OK') => {
|
|
18
19
|
try {
|
|
19
20
|
const inflated = await inflate(buffer.slice(20));
|
|
20
21
|
const { payload, encoding } = await (0, compress_1.compress)(inflated, ctx.session.headers.encoding);
|
|
@@ -22,7 +23,7 @@ const sendCacheSwapEncoding = async (server, route, ctx, buffer, checksum) => {
|
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
ctx.session.res.cork(() => {
|
|
25
|
-
ctx.session.res.writeStatus(
|
|
26
|
+
ctx.session.res.writeStatus(status);
|
|
26
27
|
if (encoding) {
|
|
27
28
|
ctx.session.res.writeHeader('Content-Encoding', encoding);
|
|
28
29
|
}
|
|
@@ -34,9 +35,9 @@ const sendCacheSwapEncoding = async (server, route, ctx, buffer, checksum) => {
|
|
|
34
35
|
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.UnsupportedContentEncoding, route);
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
const sendCache = (ctx, buffer, checksum, isDeflate) => {
|
|
38
|
+
const sendCache = (ctx, buffer, checksum, isDeflate, headers, status = '200 OK') => {
|
|
38
39
|
ctx.session.res.cork(() => {
|
|
39
|
-
ctx.session.res.writeStatus(
|
|
40
|
+
ctx.session.res.writeStatus(status);
|
|
40
41
|
ctx.session.res.writeHeader('ETag', String(checksum));
|
|
41
42
|
if (isDeflate) {
|
|
42
43
|
ctx.session.res.writeHeader('Content-Encoding', 'deflate');
|
|
@@ -44,14 +45,15 @@ const sendCache = (ctx, buffer, checksum, isDeflate) => {
|
|
|
44
45
|
(0, sendHttpResponse_1.end)(ctx, buffer.slice(20));
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
|
-
const sendNotModified = (ctx) => {
|
|
48
|
+
const sendNotModified = (ctx, headers, status = '304 Not Modified') => {
|
|
48
49
|
ctx.session.res.cork(() => {
|
|
49
|
-
ctx.session.res.writeStatus(
|
|
50
|
+
ctx.session.res.writeStatus(status);
|
|
50
51
|
(0, sendHttpResponse_1.end)(ctx);
|
|
51
52
|
});
|
|
52
53
|
};
|
|
53
|
-
const
|
|
54
|
+
const sendGetResponseInternal = (route, server, id, obs, checksum, ctx, headers, status) => {
|
|
54
55
|
if (!ctx.session) {
|
|
56
|
+
(0, observable_1.destroyObs)(server, id);
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
59
|
const encoding = ctx.session.headers.encoding;
|
|
@@ -64,14 +66,14 @@ const sendGetResponse = (route, server, id, obs, checksum, ctx) => {
|
|
|
64
66
|
}
|
|
65
67
|
else if (obs.isDeflate) {
|
|
66
68
|
if (typeof encoding === 'string' && encoding.includes('deflate')) {
|
|
67
|
-
sendCache(ctx, obs.cache, obs.checksum, true);
|
|
69
|
+
sendCache(ctx, obs.cache, obs.checksum, true, headers, status);
|
|
68
70
|
}
|
|
69
71
|
else {
|
|
70
|
-
sendCacheSwapEncoding(server, route, ctx, obs.cache, obs.checksum);
|
|
72
|
+
sendCacheSwapEncoding(server, route, ctx, obs.cache, obs.checksum, headers, status);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
else {
|
|
74
|
-
sendCache(ctx, obs.cache, obs.checksum, false);
|
|
76
|
+
sendCache(ctx, obs.cache, obs.checksum, false, headers, status);
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
else {
|
|
@@ -79,10 +81,21 @@ const sendGetResponse = (route, server, id, obs, checksum, ctx) => {
|
|
|
79
81
|
}
|
|
80
82
|
(0, observable_1.destroyObs)(server, id);
|
|
81
83
|
};
|
|
84
|
+
const sendGetResponse = (route, server, id, obs, checksum, ctx) => {
|
|
85
|
+
if ('httpResponse' in route) {
|
|
86
|
+
// response data does not work for query responses
|
|
87
|
+
const send = (responseData, headers, status) => {
|
|
88
|
+
sendGetResponseInternal(route, server, id, obs, checksum, ctx, headers, typeof status === 'string' ? status : String(status));
|
|
89
|
+
};
|
|
90
|
+
route.httpResponse(server.client, obs.payload, obs.cache, send, ctx);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
sendGetResponseInternal(route, server, id, obs, checksum, ctx);
|
|
94
|
+
};
|
|
82
95
|
const getFromExisting = (server, id, ctx, route, checksum) => {
|
|
83
96
|
const obs = (0, observable_1.getObs)(server, id);
|
|
84
97
|
if (obs.error) {
|
|
85
|
-
(0, observable_1.sendObsGetError)(server, ctx, obs.id, obs.
|
|
98
|
+
(0, observable_1.sendObsGetError)(server, ctx, obs.id, obs.error);
|
|
86
99
|
return;
|
|
87
100
|
}
|
|
88
101
|
if (obs.cache) {
|
|
@@ -94,62 +107,50 @@ const getFromExisting = (server, id, ctx, route, checksum) => {
|
|
|
94
107
|
return;
|
|
95
108
|
}
|
|
96
109
|
if (err) {
|
|
97
|
-
(0, observable_1.sendObsGetError)(server, ctx, obs.id,
|
|
110
|
+
(0, observable_1.sendObsGetError)(server, ctx, obs.id, err);
|
|
98
111
|
}
|
|
99
112
|
else {
|
|
100
113
|
sendGetResponse(route, server, id, obs, checksum, ctx);
|
|
101
114
|
}
|
|
102
115
|
});
|
|
103
116
|
};
|
|
104
|
-
const
|
|
105
|
-
if (!ctx.session) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (payload === undefined && 'query' in ctx.session) {
|
|
109
|
-
try {
|
|
110
|
-
payload = (0, utils_1.parseQuery)(decodeURIComponent(ctx.session.query));
|
|
111
|
-
}
|
|
112
|
-
catch (err) { }
|
|
113
|
-
}
|
|
117
|
+
const isAuthorized = (route, server, ctx, payload, id, checksum) => {
|
|
114
118
|
const name = route.name;
|
|
115
|
-
const id = (0, observable_1.genObservableId)(name, payload);
|
|
116
119
|
if ((0, observable_1.hasObs)(server, id)) {
|
|
117
120
|
getFromExisting(server, id, ctx, route, checksum);
|
|
118
121
|
return;
|
|
119
122
|
}
|
|
120
|
-
server.
|
|
121
|
-
|
|
122
|
-
.then((spec) => {
|
|
123
|
-
if (!ctx.session) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (!spec) {
|
|
127
|
-
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, route);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (!(0, functions_1.isObservableFunctionSpec)(spec)) {
|
|
131
|
-
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.FunctionIsNotObservable, route);
|
|
123
|
+
(0, installFn_1.installFn)(server, ctx, route, id).then((spec) => {
|
|
124
|
+
if (spec === null) {
|
|
132
125
|
return;
|
|
133
126
|
}
|
|
134
127
|
if ((0, observable_1.hasObs)(server, id)) {
|
|
135
128
|
getFromExisting(server, id, ctx, route, checksum);
|
|
136
129
|
return;
|
|
137
130
|
}
|
|
138
|
-
const obs = (0, observable_1.createObs)(server, name, id, payload);
|
|
131
|
+
const obs = (0, observable_1.createObs)(server, name, id, payload, true);
|
|
139
132
|
(0, observable_1.subscribeNext)(obs, (err) => {
|
|
140
133
|
if (err) {
|
|
141
|
-
(0, observable_1.sendObsGetError)(server, ctx, obs.id,
|
|
134
|
+
(0, observable_1.sendObsGetError)(server, ctx, obs.id, err);
|
|
142
135
|
}
|
|
143
136
|
else {
|
|
144
137
|
sendGetResponse(route, server, id, obs, checksum, ctx);
|
|
145
138
|
}
|
|
146
139
|
});
|
|
147
|
-
|
|
148
|
-
.catch((err) => {
|
|
149
|
-
// TODO: error type
|
|
150
|
-
console.error('Internal: Unxpected error in observable', err);
|
|
151
|
-
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, route);
|
|
140
|
+
(0, observable_1.start)(server, id);
|
|
152
141
|
});
|
|
153
142
|
};
|
|
143
|
+
const httpGet = (route, payload, ctx, server, checksum) => {
|
|
144
|
+
if (!ctx.session) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (payload === undefined && 'query' in ctx.session) {
|
|
148
|
+
try {
|
|
149
|
+
payload = (0, utils_1.parseQuery)(decodeURIComponent(ctx.session.query));
|
|
150
|
+
}
|
|
151
|
+
catch (err) { }
|
|
152
|
+
}
|
|
153
|
+
(0, authorize_1.authorize)(route, server, ctx, payload, isAuthorized, (0, observable_1.genObservableId)(route.name, payload), checksum);
|
|
154
|
+
};
|
|
154
155
|
exports.httpGet = httpGet;
|
|
155
156
|
//# sourceMappingURL=get.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/incoming/http/get.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/incoming/http/get.ts"],"names":[],"mappings":";;;;;;AAQA,6DAA4C;AAC5C,6CAAyC;AACzC,iDAUyB;AACzB,0DAA4B;AAC5B,wCAAyC;AACzC,uCAA4C;AAC5C,+CAA2C;AAC3C,yCAAqC;AACrC,+CAAgE;AAChE,+CAA2C;AAE3C,MAAM,OAAO,GAAG,IAAA,qBAAS,EAAC,mBAAI,CAAC,OAAO,CAAC,CAAA;AAEvC,MA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;IAED,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE;QACnD,IAAI;YACF,OAAO,GAAG,IAAA,kBAAU,EAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;SAC5D;QAAC,OAAO,GAAG,EAAE,GAAE;KACjB;IAED,IAAA,qBAAS,EACP,KAAK,EACL,MAAM,EACN,GAAG,EACH,OAAO,EACP,YAAY,EACZ,IAAA,4BAAe,EAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,EACpC,QAAQ,CACT,CAAA;AACH,CAAC,CAAA;AA1BY,QAAA,OAAO,WA0BnB"}
|
|
@@ -6,15 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.httpHandler = void 0;
|
|
7
7
|
const function_1 = require("./function");
|
|
8
8
|
const streamFunction_1 = require("./streamFunction");
|
|
9
|
-
const
|
|
9
|
+
const functions_1 = require("../../functions");
|
|
10
|
+
const query_1 = require("./query");
|
|
10
11
|
const readBody_1 = require("./readBody");
|
|
11
|
-
const authorize_1 = require("./authorize");
|
|
12
12
|
const error_1 = require("../../error");
|
|
13
13
|
const sendError_1 = require("../../sendError");
|
|
14
14
|
const security_1 = require("../../security");
|
|
15
|
-
const auth_1 = require("../../auth");
|
|
16
15
|
const parseQuery_1 = __importDefault(require("./parseQuery"));
|
|
17
16
|
const ip_1 = require("../../ip");
|
|
17
|
+
const auth_1 = require("../../auth");
|
|
18
|
+
const authorize_1 = require("../../authorize");
|
|
19
|
+
const sendHttpResponse_1 = require("../../sendHttpResponse");
|
|
18
20
|
let clientId = 0;
|
|
19
21
|
const handleRequest = (server, method, ctx, route, ready) => {
|
|
20
22
|
if (method === 'post') {
|
|
@@ -34,11 +36,11 @@ const httpHandler = (server, req, res) => {
|
|
|
34
36
|
if ((0, security_1.blockIncomingRequest)(server, ip, res, req, server.rateLimit.http, 1)) {
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
39
|
+
const method = req.getMethod();
|
|
37
40
|
const url = req.getUrl();
|
|
38
41
|
const path = url.split('/');
|
|
39
42
|
const route = server.functions.route(path[1], url);
|
|
40
|
-
|
|
41
|
-
if (route === false) {
|
|
43
|
+
if (route === null || route.internalOnly === true) {
|
|
42
44
|
(0, sendError_1.sendError)(server, {
|
|
43
45
|
session: {
|
|
44
46
|
ua: req.getHeader('user-agent'),
|
|
@@ -46,12 +48,16 @@ const httpHandler = (server, req, res) => {
|
|
|
46
48
|
method,
|
|
47
49
|
id: ++clientId,
|
|
48
50
|
headers: {},
|
|
51
|
+
authState: {},
|
|
49
52
|
res,
|
|
50
53
|
req,
|
|
51
54
|
},
|
|
52
|
-
}, error_1.BasedErrorCode.FunctionNotFound, path[1]
|
|
55
|
+
}, error_1.BasedErrorCode.FunctionNotFound, path[1]
|
|
56
|
+
? { route: { name: path[1] } }
|
|
57
|
+
: { route: { name: '', path: url } });
|
|
53
58
|
return;
|
|
54
59
|
}
|
|
60
|
+
const authorization = req.getHeader('authorization');
|
|
55
61
|
const ctx = {
|
|
56
62
|
session: {
|
|
57
63
|
res,
|
|
@@ -60,7 +66,7 @@ const httpHandler = (server, req, res) => {
|
|
|
60
66
|
ua: req.getHeader('user-agent'),
|
|
61
67
|
ip,
|
|
62
68
|
id: ++clientId,
|
|
63
|
-
authState: (0, auth_1.parseAuthState)(
|
|
69
|
+
authState: authorization ? (0, auth_1.parseAuthState)(authorization) : {},
|
|
64
70
|
headers: {
|
|
65
71
|
'content-type': req.getHeader('content-type'),
|
|
66
72
|
'content-encoding': req.getHeader('content-encoding'),
|
|
@@ -68,9 +74,16 @@ const httpHandler = (server, req, res) => {
|
|
|
68
74
|
},
|
|
69
75
|
},
|
|
70
76
|
};
|
|
77
|
+
if (route.headers) {
|
|
78
|
+
for (const header of route.headers) {
|
|
79
|
+
ctx.session.headers[header] = req.getHeader(header);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
71
82
|
if ((0, security_1.rateLimitRequest)(server, ctx, route.rateLimitTokens, server.rateLimit.http)) {
|
|
83
|
+
(0, security_1.endRateLimitHttp)(res);
|
|
72
84
|
return;
|
|
73
85
|
}
|
|
86
|
+
// double check impact
|
|
74
87
|
const query = req.getQuery();
|
|
75
88
|
if (query) {
|
|
76
89
|
ctx.session.query = query;
|
|
@@ -94,40 +107,46 @@ const httpHandler = (server, req, res) => {
|
|
|
94
107
|
}
|
|
95
108
|
}
|
|
96
109
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
if ((0, functions_1.isQueryFunctionRoute)(route)) {
|
|
111
|
+
// handle HEAD
|
|
112
|
+
if (method !== 'post' && method !== 'get') {
|
|
113
|
+
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.MethodNotAllowed, route);
|
|
100
114
|
return;
|
|
101
115
|
}
|
|
102
116
|
const checksumRaw = req.getHeader('if-none-match');
|
|
103
117
|
const checksumNum = Number(checksumRaw);
|
|
104
118
|
const checksum = !isNaN(checksumNum) ? checksumNum : 0;
|
|
105
119
|
handleRequest(server, method, ctx, route, (payload) => {
|
|
106
|
-
(0,
|
|
107
|
-
(0, get_1.httpGet)(route, payload, ctx, server, checksum);
|
|
108
|
-
});
|
|
120
|
+
(0, query_1.httpGet)(route, payload, ctx, server, checksum);
|
|
109
121
|
});
|
|
122
|
+
return;
|
|
110
123
|
}
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.LengthRequired, route);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
(0, streamFunction_1.httpStreamFunction)(server, ctx, (0, parseQuery_1.default)(ctx), route);
|
|
124
|
+
if ((0, functions_1.isStreamFunctionRoute)(route)) {
|
|
125
|
+
if (method === 'options') {
|
|
126
|
+
(0, sendHttpResponse_1.end)(ctx);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (method !== 'post') {
|
|
130
|
+
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.MethodNotAllowed, route);
|
|
131
|
+
return;
|
|
123
132
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
});
|
|
133
|
+
if (ctx.session.headers['content-length'] === 0) {
|
|
134
|
+
// zero is also not allowed for streams
|
|
135
|
+
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.LengthRequired, route);
|
|
136
|
+
return;
|
|
130
137
|
}
|
|
138
|
+
(0, streamFunction_1.httpStreamFunction)(server, ctx, route);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if ((0, functions_1.isFunctionRoute)(route)) {
|
|
142
|
+
// handle HEAD
|
|
143
|
+
if (method !== 'post' && method !== 'get') {
|
|
144
|
+
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.MethodNotAllowed, route);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
handleRequest(server, method, ctx, route, (payload) => {
|
|
148
|
+
(0, authorize_1.authorize)(route, server, ctx, payload, function_1.httpFunction);
|
|
149
|
+
});
|
|
131
150
|
}
|
|
132
151
|
};
|
|
133
152
|
exports.httpHandler = httpHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/incoming/http/index.ts"],"names":[],"mappings":";;;;;;AAGA,yCAAyC;AACzC,qDAAqD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/incoming/http/index.ts"],"names":[],"mappings":";;;;;;AAGA,yCAAyC;AACzC,qDAAqD;AACrD,+CAKwB;AACxB,mCAAiC;AACjC,yCAAqC;AACrC,uCAA4C;AAC5C,+CAA2C;AAC3C,6CAIuB;AACvB,8DAAqC;AACrC,iCAAgC;AAChC,qCAA2C;AAC3C,+CAA2C;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I,IAAA,2BAAe,EAAC,KAAK,CAAC,EAAE;QAC1B,cAAc;QACd,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE;YACzC,IAAA,qBAAS,EAAC,MAAM,EAAE,GAAG,EAAE,sBAAc,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;YAC9D,OAAM;SACP;QACD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;YACpD,IAAA,qBAAS,EAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,uBAAY,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAvJY,QAAA,WAAW,eAuJvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, HttpSession } from '
|
|
1
|
+
import { Context, HttpSession } from '@based/functions';
|
|
2
2
|
import { parseQuery } from '@saulx/utils';
|
|
3
3
|
declare const _default: (ctx: Context<HttpSession>) => ReturnType<typeof parseQuery>;
|
|
4
4
|
export default _default;
|
|
@@ -11,7 +11,9 @@ exports.default = (ctx) => {
|
|
|
11
11
|
}
|
|
12
12
|
try {
|
|
13
13
|
ctx.session.parsedQuery = (0, utils_1.parseQuery)(ctx.session.query);
|
|
14
|
-
if (
|
|
14
|
+
// TODO chekc if this is a good idea (can also call it 'autState')
|
|
15
|
+
if (!ctx.session.authState.token &&
|
|
16
|
+
!ctx.session.authState.refreshToken &&
|
|
15
17
|
ctx.session.parsedQuery &&
|
|
16
18
|
'token' in ctx.session.parsedQuery) {
|
|
17
19
|
ctx.session.authState = (0, auth_1.parseAuthState)(ctx.session.parsedQuery.token);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseQuery.js","sourceRoot":"","sources":["../../../src/incoming/http/parseQuery.ts"],"names":[],"mappings":";;AACA,wCAAyC;AACzC,qCAA2C;AAE3C,kBAAe,CAAC,GAAyB,E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,EAAE;QACZ,GAAG,CAAC,OAAO,CAAC,WAAW,GAAG,SAAS,CAAA;KACpC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BasedServer } from '../../server';
|
|
2
|
+
import { HttpSession, Context } from '@based/functions';
|
|
3
|
+
import { BasedQueryFunctionRoute } from '../../functions';
|
|
4
|
+
export declare const httpGet: (route: BasedQueryFunctionRoute, payload: any, ctx: Context<HttpSession>, server: BasedServer, checksum: number) => void;
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
exports.httpGet = void 0;
|
|
7
|
+
const sendHttpResponse_1 = require("../../sendHttpResponse");
|
|
8
|
+
const compress_1 = require("../../compress");
|
|
9
|
+
const observable_1 = require("../../observable");
|
|
10
|
+
const node_zlib_1 = __importDefault(require("node:zlib"));
|
|
11
|
+
const utils_1 = require("@saulx/utils");
|
|
12
|
+
const error_1 = require("../../error");
|
|
13
|
+
const sendError_1 = require("../../sendError");
|
|
14
|
+
const node_util_1 = require("node:util");
|
|
15
|
+
const authorize_1 = require("../../authorize");
|
|
16
|
+
const installFn_1 = require("../../installFn");
|
|
17
|
+
const inflate = (0, node_util_1.promisify)(node_zlib_1.default.inflate);
|
|
18
|
+
const sendCacheSwapEncoding = async (server, route, ctx, buffer, checksum, headers, status = '200 OK') => {
|
|
19
|
+
try {
|
|
20
|
+
const inflated = await inflate(buffer.slice(20));
|
|
21
|
+
const { payload, encoding } = await (0, compress_1.compress)(inflated, ctx.session.headers.encoding);
|
|
22
|
+
if (!ctx.session.res) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
ctx.session.res.cork(() => {
|
|
26
|
+
if (headers) {
|
|
27
|
+
(0, sendHttpResponse_1.sendHeaders)(ctx, headers);
|
|
28
|
+
}
|
|
29
|
+
ctx.session.res.writeStatus(status);
|
|
30
|
+
if (encoding) {
|
|
31
|
+
ctx.session.res.writeHeader('Content-Encoding', encoding);
|
|
32
|
+
}
|
|
33
|
+
ctx.session.res.writeHeader('ETag', String(checksum));
|
|
34
|
+
(0, sendHttpResponse_1.end)(ctx, payload);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.UnsupportedContentEncoding, route);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const sendCache = (ctx, buffer, checksum, isDeflate, headers, status = '200 OK') => {
|
|
42
|
+
ctx.session.res.cork(() => {
|
|
43
|
+
if (headers) {
|
|
44
|
+
(0, sendHttpResponse_1.sendHeaders)(ctx, headers);
|
|
45
|
+
}
|
|
46
|
+
ctx.session.res.writeStatus(status);
|
|
47
|
+
ctx.session.res.writeHeader('ETag', String(checksum));
|
|
48
|
+
if (isDeflate) {
|
|
49
|
+
ctx.session.res.writeHeader('Content-Encoding', 'deflate');
|
|
50
|
+
}
|
|
51
|
+
(0, sendHttpResponse_1.end)(ctx, buffer.slice(20));
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const sendNotModified = (ctx, headers, status = '304 Not Modified') => {
|
|
55
|
+
ctx.session.res.cork(() => {
|
|
56
|
+
if (headers) {
|
|
57
|
+
(0, sendHttpResponse_1.sendHeaders)(ctx, headers);
|
|
58
|
+
}
|
|
59
|
+
ctx.session.res.writeStatus(status);
|
|
60
|
+
(0, sendHttpResponse_1.end)(ctx);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const sendGetResponseInternal = (route, server, id, obs, checksum, ctx, headers, status) => {
|
|
64
|
+
if (!ctx.session) {
|
|
65
|
+
(0, observable_1.destroyObs)(server, id);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const encoding = ctx.session.headers.encoding;
|
|
69
|
+
if (checksum === 0 || checksum !== obs.checksum) {
|
|
70
|
+
if (!obs.cache) {
|
|
71
|
+
(0, sendError_1.sendError)(server, ctx, error_1.BasedErrorCode.NoOservableCacheAvailable, {
|
|
72
|
+
observableId: id,
|
|
73
|
+
route: { name: obs.name },
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else if (obs.isDeflate) {
|
|
77
|
+
if (typeof encoding === 'string' && encoding.includes('deflate')) {
|
|
78
|
+
sendCache(ctx, obs.cache, obs.checksum, true, headers, status);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
sendCacheSwapEncoding(server, route, ctx, obs.cache, obs.checksum, headers, status);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
sendCache(ctx, obs.cache, obs.checksum, false, headers, status);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
sendNotModified(ctx);
|
|
90
|
+
}
|
|
91
|
+
(0, observable_1.destroyObs)(server, id);
|
|
92
|
+
};
|
|
93
|
+
const sendGetResponse = (route, spec, server, id, obs, checksum, ctx) => {
|
|
94
|
+
if ('httpResponse' in spec) {
|
|
95
|
+
// response data does not work for query responses
|
|
96
|
+
const send = (responseData, headers, status) => {
|
|
97
|
+
sendGetResponseInternal(route, server, id, obs, checksum, ctx, headers, typeof status === 'string' ? status : String(status));
|
|
98
|
+
};
|
|
99
|
+
spec.httpResponse(server.client, obs.payload, obs.cache, send, ctx);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
sendGetResponseInternal(route, server, id, obs, checksum, ctx);
|
|
103
|
+
};
|
|
104
|
+
const getFromExisting = (server, id, ctx, route, spec, checksum) => {
|
|
105
|
+
const obs = (0, observable_1.getObs)(server, id);
|
|
106
|
+
if (obs.error) {
|
|
107
|
+
(0, observable_1.sendObsGetError)(server, ctx, obs.id, obs.error);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (obs.cache) {
|
|
111
|
+
sendGetResponse(route, spec, server, id, obs, checksum, ctx);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
(0, observable_1.subscribeNext)(obs, (err) => {
|
|
115
|
+
if (!ctx.session) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (err) {
|
|
119
|
+
(0, observable_1.sendObsGetError)(server, ctx, obs.id, err);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
sendGetResponse(route, spec, server, id, obs, checksum, ctx);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const isAuthorized = (route, server, ctx, payload, id, checksum) => {
|
|
127
|
+
const name = route.name;
|
|
128
|
+
// if (hasObs(server, id)) {
|
|
129
|
+
// getFromExisting(server, id, ctx, route, checksum)
|
|
130
|
+
// return
|
|
131
|
+
// }
|
|
132
|
+
(0, installFn_1.installFn)(server, ctx, route, id).then((spec) => {
|
|
133
|
+
if (spec === null) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if ((0, observable_1.hasObs)(server, id)) {
|
|
137
|
+
getFromExisting(server, id, ctx, route, spec, checksum);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const obs = (0, observable_1.createObs)(server, name, id, payload, true);
|
|
141
|
+
(0, observable_1.subscribeNext)(obs, (err) => {
|
|
142
|
+
if (err) {
|
|
143
|
+
(0, observable_1.sendObsGetError)(server, ctx, obs.id, err);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
sendGetResponse(route, spec, server, id, obs, checksum, ctx);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
(0, observable_1.start)(server, id);
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
const httpGet = (route, payload, ctx, server, checksum) => {
|
|
153
|
+
if (!ctx.session) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (payload === undefined && 'query' in ctx.session) {
|
|
157
|
+
try {
|
|
158
|
+
payload = (0, utils_1.parseQuery)(decodeURIComponent(ctx.session.query));
|
|
159
|
+
}
|
|
160
|
+
catch (err) { }
|
|
161
|
+
}
|
|
162
|
+
(0, authorize_1.authorize)(route, server, ctx, payload, isAuthorized, (0, observable_1.genObservableId)(route.name, payload), checksum);
|
|
163
|
+
};
|
|
164
|
+
exports.httpGet = httpGet;
|
|
165
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/incoming/http/query.ts"],"names":[],"mappings":";;;;;;AAYA,6DAAyD;AACzD,6CAAyC;AACzC,iDAUyB;AACzB,0DAA4B;AAC5B,wCAAyC;AACzC,uCAA4C;AAC5C,+CAA2C;AAC3C,yCAAqC;AACrC,+CAAgE;AAChE,+CAA2C;AAE3C,MAAM,OAAO,GAAG,IAAA,qBAAS,EAAC,mBAAI,CAAC,OAAO,CAAC,CAAA;AAEvC,MAAM,qBAAqB,GAAG,KAAK,EACjC,MAAmB,EACnB,KAAyB,EACzB,GAAyB,EACzB,MAAkB,EAClB,QAAgB,EAChB,OAAqB,EACrB,SAAiB,QAAQ,EACzB,EAAE;IACF,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;QAChD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,mBAAQ,EAC1C,QAAQ,EACR,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAC7B,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE;YACpB,OAAM;SACP;QACD,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE;YACxB,IAAI,OAAO,EAAE;gBACX,IAAA,8BAAW,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;aAC1B;YACD,GAAG,CAAC,OAAO,CAA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BY,QAAA,OAAO,WA0BnB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { HttpSession, Context } from '
|
|
2
|
-
import { BasedFunctionRoute } from '../../functions';
|
|
1
|
+
import { HttpSession, Context } from '@based/functions';
|
|
2
|
+
import { BasedFunctionRoute, BasedQueryFunctionRoute } from '../../functions';
|
|
3
3
|
import { BasedServer } from '../../server';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const parseHttpPayload: (server: BasedServer, ctx: Context<HttpSession>, data: Uint8Array, route: BasedFunctionRoute | BasedQueryFunctionRoute) => any;
|
|
5
|
+
export declare const readBody: (server: BasedServer, ctx: Context<HttpSession>, onData: (data: any | void) => void, route: BasedFunctionRoute | BasedQueryFunctionRoute) => void;
|