@api-client/core 0.6.29 → 0.7.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/build/browser.d.ts +6 -14
- package/build/browser.js +11 -16
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +8 -20
- package/build/index.js +13 -25
- package/build/index.js.map +1 -1
- package/build/src/amf/ApiSchemaValues.d.ts +2 -0
- package/build/src/amf/ApiSchemaValues.js +29 -23
- package/build/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/src/authorization/lib/Utils.d.ts +1 -1
- package/build/src/cookies/CookieJar.d.ts +23 -0
- package/build/src/cookies/CookieJar.js +3 -0
- package/build/src/cookies/CookieJar.js.map +1 -0
- package/build/src/cookies/CookieParser.d.ts +67 -0
- package/build/src/cookies/CookieParser.js +316 -0
- package/build/src/cookies/CookieParser.js.map +1 -0
- package/build/src/cookies/InMemoryCookieJar.d.ts +12 -0
- package/build/src/cookies/InMemoryCookieJar.js +68 -0
- package/build/src/cookies/InMemoryCookieJar.js.map +1 -0
- package/build/src/cookies/Punycode.d.ts +12 -0
- package/build/src/cookies/Punycode.js +124 -0
- package/build/src/cookies/Punycode.js.map +1 -0
- package/build/src/data/RequestDataExtractor.d.ts +8 -7
- package/build/src/data/RequestDataExtractor.js +8 -10
- package/build/src/data/RequestDataExtractor.js.map +1 -1
- package/build/src/events/CustomEvent.js +5 -0
- package/build/src/events/CustomEvent.js.map +1 -1
- package/build/src/events/EventTypes.d.ts +43 -43
- package/build/src/events/amf/AmfEventTypes.d.ts +4 -4
- package/build/src/events/authorization/AuthorizationEventTypes.d.ts +4 -4
- package/build/src/events/cookies/CookieEventTypes.d.ts +9 -9
- package/build/src/events/encryption/EncryptionEventTypes.d.ts +2 -2
- package/build/src/events/environment/EnvironmentEventTypes.d.ts +1 -1
- package/build/src/events/models/ModelEventTypes.d.ts +7 -7
- package/build/src/events/process/ProcessEventTypes.d.ts +3 -3
- package/build/src/events/reporting/ReportingEventTypes.d.ts +1 -1
- package/build/src/events/telemetry/TelemetryEventTypes.d.ts +6 -6
- package/build/src/events/transport/TransportEventTypes.d.ts +6 -6
- package/build/src/events/transport/TransportEvents.d.ts +2 -2
- package/build/src/mocking/ProjectMock.d.ts +3 -2
- package/build/src/mocking/ProjectMock.js +3 -3
- package/build/src/mocking/ProjectMock.js.map +1 -1
- package/build/src/mocking/lib/App.d.ts +36 -0
- package/build/src/mocking/lib/App.js +70 -0
- package/build/src/mocking/lib/App.js.map +1 -0
- package/build/src/models/{arc/ArcProject.d.ts → AppProject.d.ts} +296 -134
- package/build/src/models/{arc/ArcProject.js → AppProject.js} +436 -79
- package/build/src/models/AppProject.js.map +1 -0
- package/build/src/models/AppRequest.d.ts +69 -0
- package/build/src/models/AppRequest.js +150 -0
- package/build/src/models/AppRequest.js.map +1 -0
- package/build/src/models/ClientCertificate.d.ts +2 -2
- package/build/src/models/Environment.d.ts +8 -1
- package/build/src/models/Environment.js +21 -0
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/HostRule.d.ts +2 -2
- package/build/src/models/HttpCookie.d.ts +63 -12
- package/build/src/models/HttpCookie.js +178 -44
- package/build/src/models/HttpCookie.js.map +1 -1
- package/build/src/models/HttpHistory.d.ts +8 -3
- package/build/src/models/HttpHistory.js +3 -3
- package/build/src/models/HttpHistory.js.map +1 -1
- package/build/src/models/HttpProject.d.ts +34 -1
- package/build/src/models/HttpProject.js +104 -8
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts +2 -0
- package/build/src/models/ProjectFolder.js +14 -0
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/ProjectItem.d.ts +2 -0
- package/build/src/models/ProjectItem.js +20 -0
- package/build/src/models/ProjectItem.js.map +1 -1
- package/build/src/models/ProjectParent.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts +3 -2
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/Property.d.ts +2 -2
- package/build/src/models/Property.js +2 -2
- package/build/src/models/Property.js.map +1 -1
- package/build/src/models/Request.d.ts +16 -8
- package/build/src/models/Request.js +20 -15
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/RequestAuthorization.js.map +1 -1
- package/build/src/models/RequestUiMeta.d.ts +0 -14
- package/build/src/models/RequestUiMeta.js +1 -10
- package/build/src/models/RequestUiMeta.js.map +1 -1
- package/build/src/models/Server.d.ts +1 -2
- package/build/src/models/Server.js.map +1 -1
- package/build/src/models/http-actions/HttpActions.d.ts +256 -0
- package/build/src/models/http-actions/HttpActions.js +46 -0
- package/build/src/models/http-actions/HttpActions.js.map +1 -0
- package/build/src/models/http-actions/LegacyTranslator.d.ts +17 -0
- package/build/src/models/http-actions/LegacyTranslator.js +222 -0
- package/build/src/models/http-actions/LegacyTranslator.js.map +1 -0
- package/build/src/models/store/Backend.d.ts +136 -1
- package/build/src/models/store/File.d.ts +1 -1
- package/build/src/models/store/File.js +2 -0
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/User.d.ts +3 -3
- package/build/src/runtime/http-engine/CoreEngine.d.ts +2 -0
- package/build/src/runtime/http-engine/CoreEngine.js +1 -0
- package/build/src/runtime/http-engine/CoreEngine.js.map +1 -1
- package/build/src/runtime/http-engine/HttpEngine.d.ts +13 -0
- package/build/src/runtime/http-engine/HttpEngine.js +39 -31
- package/build/src/runtime/http-engine/HttpEngine.js.map +1 -1
- package/build/src/runtime/{actions/ConditionRunner.d.ts → http-runner/ConditionCheck.d.ts} +2 -2
- package/build/src/runtime/{actions/ConditionRunner.js → http-runner/ConditionCheck.js} +2 -2
- package/build/src/runtime/http-runner/ConditionCheck.js.map +1 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.d.ts +62 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.js +217 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.js.map +1 -0
- package/build/src/runtime/{node/RequestFactory.d.ts → http-runner/HttpRequestRunner.d.ts} +40 -54
- package/build/src/runtime/http-runner/HttpRequestRunner.js +316 -0
- package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -0
- package/build/src/runtime/http-runner/HttpRuntimeEnvironment.d.ts +25 -0
- package/build/src/runtime/http-runner/HttpRuntimeEnvironment.js +2 -0
- package/build/src/runtime/http-runner/HttpRuntimeEnvironment.js.map +1 -0
- package/build/src/runtime/http-runner/RequestAuthorizationProcessor.d.ts +56 -0
- package/build/src/runtime/http-runner/RequestAuthorizationProcessor.js +143 -0
- package/build/src/runtime/http-runner/RequestAuthorizationProcessor.js.map +1 -0
- package/build/src/runtime/http-runner/RequestCookiesProcessor.d.ts +24 -0
- package/build/src/runtime/http-runner/RequestCookiesProcessor.js +65 -0
- package/build/src/runtime/http-runner/RequestCookiesProcessor.js.map +1 -0
- package/build/src/runtime/node/InteropInterfaces.d.ts +21 -6
- package/build/src/runtime/node/ProjectParallelRunner.js +3 -1
- package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.d.ts +24 -10
- package/build/src/runtime/node/ProjectRequestRunner.js +116 -45
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts +5 -7
- package/build/src/runtime/node/ProjectRunner.js +30 -14
- package/build/src/runtime/node/ProjectRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunnerWorker.js +3 -0
- package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
- package/build/src/runtime/reporters/Reporter.d.ts +5 -0
- package/build/src/runtime/reporters/Reporter.js.map +1 -1
- package/build/src/runtime/store/FilesSdk.js +4 -4
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/src/runtime/store/HistorySdk.js +1 -1
- package/build/src/runtime/store/HistorySdk.js.map +1 -1
- package/build/src/runtime/store/HttpClientSdk.d.ts +167 -0
- package/build/src/runtime/store/HttpClientSdk.js +624 -0
- package/build/src/runtime/store/HttpClientSdk.js.map +1 -0
- package/build/src/runtime/store/RouteBuilder.d.ts +17 -2
- package/build/src/runtime/store/RouteBuilder.js +60 -3
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +5 -0
- package/build/src/runtime/store/Sdk.js +5 -0
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.js +1 -1
- package/build/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/src/runtime/store/UsersSdk.js +1 -1
- package/build/src/runtime/store/UsersSdk.js.map +1 -1
- package/package.json +2 -2
- package/src/amf/ApiSchemaValues.ts +41 -33
- package/src/cookies/CookieJar.ts +26 -0
- package/src/cookies/CookieParser.ts +327 -0
- package/src/cookies/InMemoryCookieJar.ts +70 -0
- package/src/cookies/Punycode.ts +133 -0
- package/src/data/RequestDataExtractor.ts +14 -15
- package/src/events/CustomEvent.ts +4 -0
- package/src/mocking/ProjectMock.ts +4 -3
- package/src/mocking/lib/App.ts +101 -0
- package/src/models/{arc/ArcProject.ts → AppProject.ts} +671 -225
- package/src/models/AppRequest.ts +176 -0
- package/src/models/ClientCertificate.ts +2 -2
- package/src/models/Environment.ts +24 -2
- package/src/models/HostRule.ts +2 -2
- package/src/models/HttpCookie.ts +210 -48
- package/src/models/HttpHistory.ts +12 -5
- package/src/models/HttpProject.ts +113 -10
- package/src/models/ProjectFolder.ts +16 -0
- package/src/models/ProjectItem.ts +18 -0
- package/src/models/ProjectParent.ts +4 -1
- package/src/models/ProjectRequest.ts +4 -3
- package/src/models/Property.ts +4 -4
- package/src/models/Request.ts +29 -19
- package/src/models/RequestAuthorization.ts +4 -4
- package/src/models/RequestUiMeta.ts +1 -21
- package/src/models/Server.ts +1 -2
- package/src/models/http-actions/HttpActions.ts +270 -0
- package/src/models/http-actions/LegacyTranslator.ts +223 -0
- package/src/models/store/Backend.ts +148 -2
- package/src/models/store/File.ts +3 -1
- package/src/models/store/User.ts +3 -3
- package/src/runtime/http-engine/CoreEngine.ts +3 -2
- package/src/runtime/http-engine/HttpEngine.ts +48 -30
- package/src/runtime/{actions/ConditionRunner.ts → http-runner/ConditionCheck.ts} +3 -3
- package/src/runtime/http-runner/HttpFlowRunner.ts +232 -0
- package/src/runtime/http-runner/HttpRequestRunner.ts +353 -0
- package/src/runtime/http-runner/HttpRuntimeEnvironment.ts +27 -0
- package/src/runtime/http-runner/RequestAuthorizationProcessor.ts +144 -0
- package/src/runtime/http-runner/RequestCookiesProcessor.ts +74 -0
- package/src/runtime/node/InteropInterfaces.ts +24 -6
- package/src/runtime/node/ProjectParallelRunner.ts +4 -2
- package/src/runtime/node/ProjectRequestRunner.ts +130 -60
- package/src/runtime/node/ProjectRunner.ts +37 -22
- package/src/runtime/node/ProjectRunnerWorker.ts +3 -0
- package/src/runtime/reporters/Reporter.ts +5 -0
- package/src/runtime/store/FilesSdk.ts +4 -4
- package/src/runtime/store/HistorySdk.ts +1 -1
- package/src/runtime/store/HttpClientSdk.ts +629 -0
- package/src/runtime/store/RouteBuilder.ts +75 -3
- package/src/runtime/store/Sdk.ts +6 -0
- package/src/runtime/store/SharedSdk.ts +1 -1
- package/src/runtime/store/UsersSdk.ts +1 -1
- package/build/src/lib/cookies/Cookie.d.ts +0 -123
- package/build/src/lib/cookies/Cookie.js +0 -257
- package/build/src/lib/cookies/Cookie.js.map +0 -1
- package/build/src/lib/cookies/Cookies.d.ts +0 -90
- package/build/src/lib/cookies/Cookies.js +0 -310
- package/build/src/lib/cookies/Cookies.js.map +0 -1
- package/build/src/lib/cookies/Utils.d.ts +0 -47
- package/build/src/lib/cookies/Utils.js +0 -163
- package/build/src/lib/cookies/Utils.js.map +0 -1
- package/build/src/mocking/lib/Arc.d.ts +0 -10
- package/build/src/mocking/lib/Arc.js +0 -31
- package/build/src/mocking/lib/Arc.js.map +0 -1
- package/build/src/models/RequestActions.d.ts +0 -65
- package/build/src/models/RequestActions.js +0 -114
- package/build/src/models/RequestActions.js.map +0 -1
- package/build/src/models/actions/Action.d.ts +0 -75
- package/build/src/models/actions/Action.js +0 -188
- package/build/src/models/actions/Action.js.map +0 -1
- package/build/src/models/actions/ActionView.d.ts +0 -15
- package/build/src/models/actions/ActionView.js +0 -33
- package/build/src/models/actions/ActionView.js.map +0 -1
- package/build/src/models/actions/Condition.d.ts +0 -81
- package/build/src/models/actions/Condition.js +0 -185
- package/build/src/models/actions/Condition.js.map +0 -1
- package/build/src/models/actions/ConditionView.d.ts +0 -17
- package/build/src/models/actions/ConditionView.js +0 -34
- package/build/src/models/actions/ConditionView.js.map +0 -1
- package/build/src/models/actions/Enums.d.ts +0 -26
- package/build/src/models/actions/Enums.js +0 -31
- package/build/src/models/actions/Enums.js.map +0 -1
- package/build/src/models/actions/RunnableAction.d.ts +0 -59
- package/build/src/models/actions/RunnableAction.js +0 -106
- package/build/src/models/actions/RunnableAction.js.map +0 -1
- package/build/src/models/actions/runnable/DeleteCookieAction.d.ts +0 -44
- package/build/src/models/actions/runnable/DeleteCookieAction.js +0 -92
- package/build/src/models/actions/runnable/DeleteCookieAction.js.map +0 -1
- package/build/src/models/actions/runnable/Runnable.d.ts +0 -8
- package/build/src/models/actions/runnable/Runnable.js +0 -4
- package/build/src/models/actions/runnable/Runnable.js.map +0 -1
- package/build/src/models/actions/runnable/SetCookieAction.d.ts +0 -87
- package/build/src/models/actions/runnable/SetCookieAction.js +0 -176
- package/build/src/models/actions/runnable/SetCookieAction.js.map +0 -1
- package/build/src/models/actions/runnable/SetVariableAction.d.ts +0 -31
- package/build/src/models/actions/runnable/SetVariableAction.js +0 -63
- package/build/src/models/actions/runnable/SetVariableAction.js.map +0 -1
- package/build/src/models/actions/runnable/index.d.ts +0 -7
- package/build/src/models/actions/runnable/index.js +0 -2
- package/build/src/models/actions/runnable/index.js.map +0 -1
- package/build/src/models/arc/ArcHttpRequest.d.ts +0 -39
- package/build/src/models/arc/ArcHttpRequest.js +0 -106
- package/build/src/models/arc/ArcHttpRequest.js.map +0 -1
- package/build/src/models/arc/ArcProject.js.map +0 -1
- package/build/src/runtime/actions/ActionRunner.d.ts +0 -17
- package/build/src/runtime/actions/ActionRunner.js +0 -74
- package/build/src/runtime/actions/ActionRunner.js.map +0 -1
- package/build/src/runtime/actions/ConditionRunner.js.map +0 -1
- package/build/src/runtime/actions/RunnableCondition.d.ts +0 -27
- package/build/src/runtime/actions/RunnableCondition.js +0 -50
- package/build/src/runtime/actions/RunnableCondition.js.map +0 -1
- package/build/src/runtime/actions/runnable/ActionRunnable.d.ts +0 -13
- package/build/src/runtime/actions/runnable/ActionRunnable.js +0 -13
- package/build/src/runtime/actions/runnable/ActionRunnable.js.map +0 -1
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.d.ts +0 -7
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js +0 -36
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js.map +0 -1
- package/build/src/runtime/actions/runnable/SetCookieRunnable.d.ts +0 -10
- package/build/src/runtime/actions/runnable/SetCookieRunnable.js +0 -89
- package/build/src/runtime/actions/runnable/SetCookieRunnable.js.map +0 -1
- package/build/src/runtime/actions/runnable/SetVariableRunnable.d.ts +0 -10
- package/build/src/runtime/actions/runnable/SetVariableRunnable.js +0 -49
- package/build/src/runtime/actions/runnable/SetVariableRunnable.js.map +0 -1
- package/build/src/runtime/modules/BasicAuthCache.d.ts +0 -39
- package/build/src/runtime/modules/BasicAuthCache.js +0 -122
- package/build/src/runtime/modules/BasicAuthCache.js.map +0 -1
- package/build/src/runtime/modules/ExecutionResponse.d.ts +0 -4
- package/build/src/runtime/modules/ExecutionResponse.js +0 -6
- package/build/src/runtime/modules/ExecutionResponse.js.map +0 -1
- package/build/src/runtime/modules/ModulesRegistry.d.ts +0 -93
- package/build/src/runtime/modules/ModulesRegistry.js +0 -69
- package/build/src/runtime/modules/ModulesRegistry.js.map +0 -1
- package/build/src/runtime/modules/RequestAuthorization.d.ts +0 -6
- package/build/src/runtime/modules/RequestAuthorization.js +0 -110
- package/build/src/runtime/modules/RequestAuthorization.js.map +0 -1
- package/build/src/runtime/modules/RequestCookies.d.ts +0 -17
- package/build/src/runtime/modules/RequestCookies.js +0 -134
- package/build/src/runtime/modules/RequestCookies.js.map +0 -1
- package/build/src/runtime/node/RequestFactory.js +0 -406
- package/build/src/runtime/node/RequestFactory.js.map +0 -1
- package/build/src/runtime/node/VariablesStore.d.ts +0 -9
- package/build/src/runtime/node/VariablesStore.js +0 -19
- package/build/src/runtime/node/VariablesStore.js.map +0 -1
- package/src/lib/cookies/Cookie.ts +0 -312
- package/src/lib/cookies/Cookies.ts +0 -326
- package/src/lib/cookies/Utils.ts +0 -168
- package/src/mocking/lib/Arc.ts +0 -34
- package/src/models/RequestActions.ts +0 -161
- package/src/models/actions/Action.ts +0 -213
- package/src/models/actions/ActionView.ts +0 -40
- package/src/models/actions/Condition.ts +0 -207
- package/src/models/actions/ConditionView.ts +0 -42
- package/src/models/actions/Enums.ts +0 -29
- package/src/models/actions/RunnableAction.ts +0 -144
- package/src/models/actions/runnable/DeleteCookieAction.ts +0 -113
- package/src/models/actions/runnable/Runnable.ts +0 -9
- package/src/models/actions/runnable/SetCookieAction.ts +0 -216
- package/src/models/actions/runnable/SetVariableAction.ts +0 -81
- package/src/models/arc/ArcHttpRequest.ts +0 -121
- package/src/models/arc/readme.md +0 -3
- package/src/runtime/actions/ActionRunner.ts +0 -83
- package/src/runtime/actions/RunnableCondition.ts +0 -56
- package/src/runtime/actions/runnable/ActionRunnable.ts +0 -19
- package/src/runtime/actions/runnable/DeleteCookieRunnable.ts +0 -39
- package/src/runtime/actions/runnable/SetCookieRunnable.ts +0 -92
- package/src/runtime/actions/runnable/SetVariableRunnable.ts +0 -53
- package/src/runtime/modules/BasicAuthCache.ts +0 -129
- package/src/runtime/modules/ExecutionResponse.ts +0 -4
- package/src/runtime/modules/ModulesRegistry.ts +0 -136
- package/src/runtime/modules/RequestAuthorization.ts +0 -106
- package/src/runtime/modules/RequestCookies.ts +0 -146
- package/src/runtime/node/RequestFactory.ts +0 -432
- package/src/runtime/node/VariablesStore.ts +0 -25
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Kind as DeleteCookieKind } from '../../models/actions/runnable/DeleteCookieAction.js';
|
|
2
|
-
import { Kind as SetCookieKind } from '../../models/actions/runnable/SetCookieAction.js';
|
|
3
|
-
import { Kind as SetVariableKind } from '../../models/actions/runnable/SetVariableAction.js';
|
|
4
|
-
import { DeleteCookieRunnable } from './runnable/DeleteCookieRunnable.js';
|
|
5
|
-
import { SetCookieRunnable } from './runnable/SetCookieRunnable.js';
|
|
6
|
-
import { SetVariableRunnable } from './runnable/SetVariableRunnable.js';
|
|
7
|
-
/**
|
|
8
|
-
* A class that is responsible for running a single action.
|
|
9
|
-
*/
|
|
10
|
-
export class ActionRunner {
|
|
11
|
-
action;
|
|
12
|
-
eventTarget;
|
|
13
|
-
constructor(action, eventTarget) {
|
|
14
|
-
this.action = action;
|
|
15
|
-
this.eventTarget = eventTarget;
|
|
16
|
-
}
|
|
17
|
-
async request(request) {
|
|
18
|
-
const runnable = this.getActionRunnable();
|
|
19
|
-
if (!runnable) {
|
|
20
|
-
throw new Error(`Invalid action configuration. The runnable configuration is not defined.`);
|
|
21
|
-
}
|
|
22
|
-
const { action } = this;
|
|
23
|
-
if (action.sync === false) {
|
|
24
|
-
this.requestAsync(runnable, request);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
await runnable.request(request);
|
|
28
|
-
}
|
|
29
|
-
async requestAsync(runnable, request) {
|
|
30
|
-
const { action } = this;
|
|
31
|
-
try {
|
|
32
|
-
await runnable.request(request);
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
const err = e;
|
|
36
|
-
console.error(`Unable to run a request action: ${action.name || 'unknown name'}: ${err.message}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
getActionRunnable() {
|
|
40
|
-
const { action, eventTarget } = this;
|
|
41
|
-
const config = action.config;
|
|
42
|
-
if (!config) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
switch (config.kind) {
|
|
46
|
-
case DeleteCookieKind: return new DeleteCookieRunnable(config.toJSON(), eventTarget);
|
|
47
|
-
case SetCookieKind: return new SetCookieRunnable(config.toJSON(), eventTarget);
|
|
48
|
-
case SetVariableKind: return new SetVariableRunnable(config.toJSON(), eventTarget);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async response(log) {
|
|
52
|
-
const runnable = this.getActionRunnable();
|
|
53
|
-
if (!runnable) {
|
|
54
|
-
throw new Error(`Invalid action configuration. The runnable configuration is not defined.`);
|
|
55
|
-
}
|
|
56
|
-
const { action } = this;
|
|
57
|
-
if (action.sync === false) {
|
|
58
|
-
this.responseAsync(runnable, log);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
await runnable.response(log);
|
|
62
|
-
}
|
|
63
|
-
async responseAsync(runnable, log) {
|
|
64
|
-
const { action } = this;
|
|
65
|
-
try {
|
|
66
|
-
await runnable.response(log);
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
const err = e;
|
|
70
|
-
console.error(`Unable to run a response action: ${action.name || 'unknown name'}: ${err.message}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=ActionRunner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunner.js","sourceRoot":"","sources":["../../../../src/runtime/actions/ActionRunner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,IAAI,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,oDAAoD,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE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AC,KAAK,EAAE,SAAS,CAAC,CAAC;QACzC,KAAK,oBAAoB;YACvB,OAAO,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC9C,KAAK,WAAW;YACd,OAAO,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACtC,KAAK,iBAAiB;YACpB,OAAO,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3C,KAAK,UAAU;YACb,OAAO,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACpC,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACnC;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IRunnableAction, RunnableAction } from '../../models/actions/RunnableAction.js';
|
|
2
|
-
import { IHttpRequest } from '../../models/HttpRequest.js';
|
|
3
|
-
import { IResponse } from '../../models/Response.js';
|
|
4
|
-
import { ISentRequest } from '../../models/SentRequest.js';
|
|
5
|
-
import { IErrorResponse } from '../../models/ErrorResponse.js';
|
|
6
|
-
/**
|
|
7
|
-
* A class that represents API Client condition that runs actions when the condition is met.
|
|
8
|
-
*/
|
|
9
|
-
export declare class RunnableCondition extends RunnableAction {
|
|
10
|
-
/**
|
|
11
|
-
* Tests whether the condition is satisfied for request and/or response.
|
|
12
|
-
*
|
|
13
|
-
* @param request The API Client request object.
|
|
14
|
-
* @param response The API Client response object, if available.
|
|
15
|
-
* @return True when the condition is satisfied.
|
|
16
|
-
*/
|
|
17
|
-
satisfied(request: IHttpRequest | ISentRequest, response?: IResponse | IErrorResponse): Promise<boolean>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Maps runnables interface to
|
|
21
|
-
* If an item is not an instance of `RunnableCondition` then it creates an instance of it
|
|
22
|
-
* by passing the map as an argument.
|
|
23
|
-
*
|
|
24
|
-
* @param value Passed list of actions.
|
|
25
|
-
* @returns Mapped actions.
|
|
26
|
-
*/
|
|
27
|
-
export declare const mapRunnables: (value: (IRunnableAction | RunnableCondition)[]) => RunnableCondition[];
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { RunnableAction } from '../../models/actions/RunnableAction.js';
|
|
2
|
-
import { RequestDataExtractor } from '../../data/RequestDataExtractor.js';
|
|
3
|
-
import { checkCondition } from './ConditionRunner.js';
|
|
4
|
-
/**
|
|
5
|
-
* A class that represents API Client condition that runs actions when the condition is met.
|
|
6
|
-
*/
|
|
7
|
-
export class RunnableCondition extends RunnableAction {
|
|
8
|
-
/**
|
|
9
|
-
* Tests whether the condition is satisfied for request and/or response.
|
|
10
|
-
*
|
|
11
|
-
* @param request The API Client request object.
|
|
12
|
-
* @param response The API Client response object, if available.
|
|
13
|
-
* @return True when the condition is satisfied.
|
|
14
|
-
*/
|
|
15
|
-
async satisfied(request, response) {
|
|
16
|
-
if (this.enabled === false) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (this.condition.alwaysPass === true) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
const extractor = new RequestDataExtractor(request, response);
|
|
23
|
-
const value = await extractor.extract(this.condition);
|
|
24
|
-
const op = this.condition.operator;
|
|
25
|
-
if (!op || !this.condition.value) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
return checkCondition(value, op, this.condition.value);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Maps runnables interface to
|
|
33
|
-
* If an item is not an instance of `RunnableCondition` then it creates an instance of it
|
|
34
|
-
* by passing the map as an argument.
|
|
35
|
-
*
|
|
36
|
-
* @param value Passed list of actions.
|
|
37
|
-
* @returns Mapped actions.
|
|
38
|
-
*/
|
|
39
|
-
export const mapRunnables = (value) => {
|
|
40
|
-
if (!Array.isArray(value)) {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
return value.map((item) => {
|
|
44
|
-
if (!(item instanceof RunnableCondition)) {
|
|
45
|
-
return new RunnableCondition(item);
|
|
46
|
-
}
|
|
47
|
-
return item;
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=RunnableCondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RunnableCondition.js","sourceRoot":"","sources":["../../../../src/runtime/actions/RunnableCondition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAKzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACnD;;;;;;OAMG;IACH,KAAK,CAAC,SAAS,CAAC,OAAoC,EAAE,QAAqC;QACzF,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE;YAC1B,OAAO,KAAK,CAAC;SACd;QACD,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,KAAK,IAAI,EAAE;YACtC,OAAO,IAAI,CAAC;SACb;QACD,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtD,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QACnC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;QACD,OAAO,cAAc,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAA8C,EAAuB,EAAE;IAClG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,OAAO,EAAE,CAAC;KACX;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,IAAI,CAAC,CAAC,IAAI,YAAY,iBAAiB,CAAC,EAAE;YACxC,OAAO,IAAI,iBAAiB,CAAC,IAAuB,CAAC,CAAC;SACvD;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IHttpRequest } from '../../../models/HttpRequest.js';
|
|
2
|
-
import { IRequestLog } from '../../../models/RequestLog.js';
|
|
3
|
-
export declare abstract class ActionRunnable {
|
|
4
|
-
/**
|
|
5
|
-
* The specific action configuration.
|
|
6
|
-
* This depends on the action.
|
|
7
|
-
*/
|
|
8
|
-
config: unknown;
|
|
9
|
-
eventTarget: EventTarget;
|
|
10
|
-
constructor(config: unknown, eventTarget: EventTarget);
|
|
11
|
-
abstract request(request: IHttpRequest): Promise<void>;
|
|
12
|
-
abstract response(log: IRequestLog): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export class ActionRunnable {
|
|
2
|
-
/**
|
|
3
|
-
* The specific action configuration.
|
|
4
|
-
* This depends on the action.
|
|
5
|
-
*/
|
|
6
|
-
config;
|
|
7
|
-
eventTarget;
|
|
8
|
-
constructor(config, eventTarget) {
|
|
9
|
-
this.config = Object.freeze(config);
|
|
10
|
-
this.eventTarget = eventTarget;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ActionRunnable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunnable.js","sourceRoot":"","sources":["../../../../../src/runtime/actions/runnable/ActionRunnable.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,cAAc;IAClC;;;OAGG;IACH,MAAM,CAAU;IAChB,WAAW,CAAc;IAEzB,YAAY,MAAe,EAAE,WAAwB;QACnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CAIF"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { IHttpRequest } from '../../../models/HttpRequest.js';
|
|
2
|
-
import { ActionRunnable } from './ActionRunnable.js';
|
|
3
|
-
import { IRequestLog } from '../../../models/RequestLog.js';
|
|
4
|
-
export declare class DeleteCookieRunnable extends ActionRunnable {
|
|
5
|
-
response(log: IRequestLog): Promise<void>;
|
|
6
|
-
request(request: IHttpRequest): Promise<void>;
|
|
7
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ActionRunnable } from './ActionRunnable.js';
|
|
2
|
-
import { Events } from '../../../events/Events.js';
|
|
3
|
-
export class DeleteCookieRunnable extends ActionRunnable {
|
|
4
|
-
async response(log) {
|
|
5
|
-
if (!log.request) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
const config = this.config;
|
|
9
|
-
let url;
|
|
10
|
-
if (config.useRequestUrl) {
|
|
11
|
-
url = log.request.url;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
url = config.url;
|
|
15
|
-
}
|
|
16
|
-
if (!url) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
Events.Cookie.deleteUrl(url, config.name, this.eventTarget);
|
|
20
|
-
}
|
|
21
|
-
async request(request) {
|
|
22
|
-
const config = this.config;
|
|
23
|
-
let url;
|
|
24
|
-
if (config.useRequestUrl) {
|
|
25
|
-
url = request.url;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
url = config.url;
|
|
29
|
-
}
|
|
30
|
-
if (!url) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
Events.Cookie.deleteUrl(url, config.name, this.eventTarget);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=DeleteCookieRunnable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteCookieRunnable.js","sourceRoot":"","sources":["../../../../../src/runtime/actions/runnable/DeleteCookieRunnable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGnD,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IACtD,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YAChB,OAAO;SACR;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAA6B,CAAC;QAClD,IAAI,GAAG,CAAC;QACR,IAAI,MAAM,CAAC,aAAa,EAAE;YACxB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;SACvB;aAAM;YACL,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;SAClB;QACD,IAAI,CAAC,GAAG,EAAE;YACR,OAAO;SACR;QACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAA6B,CAAC;QAElD,IAAI,GAAG,CAAC;QACR,IAAI,MAAM,CAAC,aAAa,EAAE;YACxB,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;SACnB;aAAM;YACL,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;SAClB;QACD,IAAI,CAAC,GAAG,EAAE;YACR,OAAO;SACR;QACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IHttpRequest } from '../../../models/HttpRequest.js';
|
|
2
|
-
import { ActionRunnable } from './ActionRunnable.js';
|
|
3
|
-
import { ISetCookieAction } from '../../../models/actions/runnable/SetCookieAction.js';
|
|
4
|
-
import { IRequestLog } from '../../../models/RequestLog.js';
|
|
5
|
-
export declare class SetCookieRunnable extends ActionRunnable {
|
|
6
|
-
request(request: IHttpRequest): Promise<void>;
|
|
7
|
-
readRequestValue(request: IHttpRequest, config: ISetCookieAction): Promise<string | number | undefined>;
|
|
8
|
-
setCookie(request: IHttpRequest, config: ISetCookieAction, value: string): Promise<void>;
|
|
9
|
-
response(log: IRequestLog): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { ActionRunnable } from './ActionRunnable.js';
|
|
2
|
-
import { Events } from '../../../events/Events.js';
|
|
3
|
-
import { RequestDataExtractor } from '../../../data/RequestDataExtractor.js';
|
|
4
|
-
export class SetCookieRunnable extends ActionRunnable {
|
|
5
|
-
async request(request) {
|
|
6
|
-
const config = this.config;
|
|
7
|
-
const value = await this.readRequestValue(request, config);
|
|
8
|
-
if (typeof value === 'undefined') {
|
|
9
|
-
throw new Error(`Cannot read value for the action`);
|
|
10
|
-
}
|
|
11
|
-
await this.setCookie(request, config, String(value));
|
|
12
|
-
}
|
|
13
|
-
async readRequestValue(request, config) {
|
|
14
|
-
const { source } = config;
|
|
15
|
-
let value;
|
|
16
|
-
if (source.source === 'value') {
|
|
17
|
-
value = source.value;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const extractor = new RequestDataExtractor(request);
|
|
21
|
-
value = await extractor.extract(source);
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
async setCookie(request, config, value) {
|
|
26
|
-
let url;
|
|
27
|
-
if (config.useRequestUrl) {
|
|
28
|
-
url = request.url;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
url = config.url;
|
|
32
|
-
}
|
|
33
|
-
if (!url) {
|
|
34
|
-
throw new Error('The set cookie action has no URL defined.');
|
|
35
|
-
}
|
|
36
|
-
const parser = new URL(url);
|
|
37
|
-
const cookie = {
|
|
38
|
-
name: config.name,
|
|
39
|
-
value,
|
|
40
|
-
sameSite: 'unspecified',
|
|
41
|
-
domain: parser.host,
|
|
42
|
-
path: parser.pathname,
|
|
43
|
-
};
|
|
44
|
-
if (config.expires) {
|
|
45
|
-
const typedNumber = Number(config.expires);
|
|
46
|
-
if (Number.isNaN(typedNumber)) {
|
|
47
|
-
const exp = new Date(config.expires);
|
|
48
|
-
cookie.expirationDate = exp.getTime();
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
const exp = new Date(typedNumber);
|
|
52
|
-
cookie.expirationDate = exp.getTime();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (typeof config.hostOnly === 'boolean') {
|
|
56
|
-
cookie.hostOnly = config.hostOnly;
|
|
57
|
-
}
|
|
58
|
-
if (typeof config.httpOnly === 'boolean') {
|
|
59
|
-
cookie.httpOnly = config.httpOnly;
|
|
60
|
-
}
|
|
61
|
-
if (typeof config.session === 'boolean') {
|
|
62
|
-
cookie.session = config.session;
|
|
63
|
-
}
|
|
64
|
-
if (typeof config.secure === 'boolean') {
|
|
65
|
-
cookie.secure = config.secure;
|
|
66
|
-
}
|
|
67
|
-
Events.Cookie.update(cookie, this.eventTarget);
|
|
68
|
-
}
|
|
69
|
-
async response(log) {
|
|
70
|
-
if (!log.request || !log.response) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const config = this.config;
|
|
74
|
-
const { source } = config;
|
|
75
|
-
let value;
|
|
76
|
-
if (source.source === 'value') {
|
|
77
|
-
value = source.value;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
const extractor = new RequestDataExtractor(log.request, log.response);
|
|
81
|
-
value = await extractor.extract(source);
|
|
82
|
-
}
|
|
83
|
-
if (typeof value === 'undefined') {
|
|
84
|
-
throw new Error(`Cannot read value for the action`);
|
|
85
|
-
}
|
|
86
|
-
await this.setCookie(log.request, config, String(value));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=SetCookieRunnable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetCookieRunnable.js","sourceRoot":"","sources":["../../../../../src/runtime/actions/runnable/SetCookieRunnable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAG7E,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACnD,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAA0B,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3D,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACrD;QACD,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAqB,EAAE,MAAwB;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,IAAI,KAAkC,CAAC;QACvC,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE;YAC7B,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;SACtB;aAAM;YACL,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACpD,KAAK,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;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ISetVariableAction } from '../../../models/actions/runnable/SetVariableAction.js';
|
|
4
|
-
import { IRequestLog } from '../../../models/RequestLog.js';
|
|
5
|
-
export declare class SetVariableRunnable extends ActionRunnable {
|
|
6
|
-
request(request: IHttpRequest): Promise<void>;
|
|
7
|
-
readRequestValue(request: IHttpRequest, config: ISetVariableAction): Promise<string | number | undefined>;
|
|
8
|
-
setVariable(config: ISetVariableAction, value: string): Promise<void>;
|
|
9
|
-
response(log: IRequestLog): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ActionRunnable } from './ActionRunnable.js';
|
|
2
|
-
import { Events } from '../../../events/Events.js';
|
|
3
|
-
import { RequestDataExtractor } from '../../../data/RequestDataExtractor.js';
|
|
4
|
-
export class SetVariableRunnable extends ActionRunnable {
|
|
5
|
-
async request(request) {
|
|
6
|
-
const config = this.config;
|
|
7
|
-
const value = await this.readRequestValue(request, config);
|
|
8
|
-
if (typeof value === 'undefined') {
|
|
9
|
-
throw new Error(`Cannot read value for the action`);
|
|
10
|
-
}
|
|
11
|
-
await this.setVariable(config, String(value));
|
|
12
|
-
}
|
|
13
|
-
async readRequestValue(request, config) {
|
|
14
|
-
const { source } = config;
|
|
15
|
-
let value;
|
|
16
|
-
if (source.source === 'value') {
|
|
17
|
-
value = source.value;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const extractor = new RequestDataExtractor(request);
|
|
21
|
-
value = await extractor.extract(source);
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
async setVariable(config, value) {
|
|
26
|
-
const { name } = config;
|
|
27
|
-
Events.Environment.set(name, value, this.eventTarget);
|
|
28
|
-
}
|
|
29
|
-
async response(log) {
|
|
30
|
-
if (!log.request || !log.response) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const config = this.config;
|
|
34
|
-
let value;
|
|
35
|
-
const { source } = config;
|
|
36
|
-
if (source.source === 'value') {
|
|
37
|
-
value = source.value;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const extractor = new RequestDataExtractor(log.request, log.response);
|
|
41
|
-
value = await extractor.extract(source);
|
|
42
|
-
}
|
|
43
|
-
if (typeof value === 'undefined') {
|
|
44
|
-
throw new Error(`Cannot read value for the action`);
|
|
45
|
-
}
|
|
46
|
-
await this.setVariable(config, String(value));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=SetVariableRunnable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetVariableRunnable.js","sourceRoot":"","sources":["../../../../../src/runtime/actions/runnable/SetVariableRunnable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAG7E,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IACrD,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAA4B,CAAC;QACjD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3D,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACrD;QACD,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAqB,EAAE,MAA0B;QACtE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,IAAI,KAAkC,CAAC;QACvC,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE;YAC7B,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;SACtB;aAAM;YACL,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACpD,KAAK,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SACzC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAA0B,EAAE,KAAa;QACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QACxB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACjC,OAAO;SACR;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAA4B,CAAC;QACjD,IAAI,KAAkC,CAAC;QACvC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE;YAC7B,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;SACtB;aAAM;YACL,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;YACtE,KAAK,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SACzC;QACD,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACrD;QACD,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { IHttpRequest } from '../../models/HttpRequest.js';
|
|
2
|
-
import { INtlmAuthorization, IBasicAuthorization } from '../../models/Authorization.js';
|
|
3
|
-
import { ExecutionContext } from './ModulesRegistry.js';
|
|
4
|
-
/**
|
|
5
|
-
* Removes query parameters and the fragment part from the URL
|
|
6
|
-
* @param url The URL to process.
|
|
7
|
-
* @returns The canonical URL.
|
|
8
|
-
*/
|
|
9
|
-
export declare function computeUrlPath(url: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Finds an auth data for given `url`.
|
|
12
|
-
*
|
|
13
|
-
* @param type Authorization type.
|
|
14
|
-
* @param url The URL of the request.
|
|
15
|
-
* @return Auth data if exists in the cache.
|
|
16
|
-
*/
|
|
17
|
-
export declare function findCachedAuthData(type: string, url: string): IBasicAuthorization | INtlmAuthorization | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Updates cached authorization data
|
|
20
|
-
*
|
|
21
|
-
* @param type Authorization type.
|
|
22
|
-
* @param url The URL of the request.
|
|
23
|
-
* @param value Auth data to set
|
|
24
|
-
*/
|
|
25
|
-
export declare function updateCache(type: string, url: string, value: IBasicAuthorization | INtlmAuthorization): void;
|
|
26
|
-
/**
|
|
27
|
-
* Applies the basic authorization data to the request.
|
|
28
|
-
*
|
|
29
|
-
* If the header value have changed then it fires `request-headers-changed` custom event.
|
|
30
|
-
* It sets computed value of the readers to the event's detail object.
|
|
31
|
-
*
|
|
32
|
-
* @param request The event's detail object. Changes made here will be propagated to the event.
|
|
33
|
-
* @param data The authorization data to apply.
|
|
34
|
-
*/
|
|
35
|
-
export declare function applyRequestBasicAuthData(request: IHttpRequest, data: IBasicAuthorization): void;
|
|
36
|
-
/**
|
|
37
|
-
* Adds basic authorization data to the request, when during this session basic auth was used
|
|
38
|
-
*/
|
|
39
|
-
export default function applyCachedBasicAuthData(request: IHttpRequest, context: ExecutionContext): void;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { Headers } from '../../lib/headers/Headers.js';
|
|
2
|
-
import { Kind as RequestAuthorizationKind } from '../../models/RequestAuthorization.js';
|
|
3
|
-
const cache = {};
|
|
4
|
-
/**
|
|
5
|
-
* Removes query parameters and the fragment part from the URL
|
|
6
|
-
* @param url The URL to process.
|
|
7
|
-
* @returns The canonical URL.
|
|
8
|
-
*/
|
|
9
|
-
export function computeUrlPath(url) {
|
|
10
|
-
if (!url) {
|
|
11
|
-
return '';
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
const u = new URL(url);
|
|
15
|
-
u.hash = '';
|
|
16
|
-
u.search = '';
|
|
17
|
-
let result = u.toString();
|
|
18
|
-
// polyfill library has some error and leaves '?#' if was set
|
|
19
|
-
result = result.replace('?', '');
|
|
20
|
-
result = result.replace('#', '');
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
return url;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Finds an auth data for given `url`.
|
|
29
|
-
*
|
|
30
|
-
* @param type Authorization type.
|
|
31
|
-
* @param url The URL of the request.
|
|
32
|
-
* @return Auth data if exists in the cache.
|
|
33
|
-
*/
|
|
34
|
-
export function findCachedAuthData(type, url) {
|
|
35
|
-
const key = computeUrlPath(url);
|
|
36
|
-
if (!cache || !type || !key || !cache[type]) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
return cache[type][key];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Updates cached authorization data
|
|
43
|
-
*
|
|
44
|
-
* @param type Authorization type.
|
|
45
|
-
* @param url The URL of the request.
|
|
46
|
-
* @param value Auth data to set
|
|
47
|
-
*/
|
|
48
|
-
export function updateCache(type, url, value) {
|
|
49
|
-
const key = computeUrlPath(url);
|
|
50
|
-
if (!cache[type]) {
|
|
51
|
-
cache[type] = {};
|
|
52
|
-
}
|
|
53
|
-
cache[type][key] = value;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Applies the basic authorization data to the request.
|
|
57
|
-
*
|
|
58
|
-
* If the header value have changed then it fires `request-headers-changed` custom event.
|
|
59
|
-
* It sets computed value of the readers to the event's detail object.
|
|
60
|
-
*
|
|
61
|
-
* @param request The event's detail object. Changes made here will be propagated to the event.
|
|
62
|
-
* @param data The authorization data to apply.
|
|
63
|
-
*/
|
|
64
|
-
export function applyRequestBasicAuthData(request, data) {
|
|
65
|
-
const { username = '', password = '' } = data;
|
|
66
|
-
const headers = new Headers(request.headers || '');
|
|
67
|
-
let hash;
|
|
68
|
-
let decoded = `${username}:${password}`;
|
|
69
|
-
if (typeof Buffer === 'function' && typeof Buffer.from === 'function') {
|
|
70
|
-
hash = Buffer.from(decoded).toString('base64');
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
hash = btoa(decoded);
|
|
74
|
-
}
|
|
75
|
-
headers.set('authorization', `Basic ${hash}`);
|
|
76
|
-
request.headers = headers.toString();
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Applies the NTLM authorization data to the request.
|
|
80
|
-
*
|
|
81
|
-
* Because NTLM requires certain operations on a socket it's bot just about setting a headers
|
|
82
|
-
* but whole NTLM configuration object.
|
|
83
|
-
*
|
|
84
|
-
* Applied the `auth` object to the event's `detail.auth` object.
|
|
85
|
-
*/
|
|
86
|
-
function applyRequestNtlmAuthData(authorization, values) {
|
|
87
|
-
let ntlm = authorization.find(((method) => method.type === 'ntlm'));
|
|
88
|
-
if (!ntlm) {
|
|
89
|
-
ntlm = {
|
|
90
|
-
kind: RequestAuthorizationKind,
|
|
91
|
-
enabled: true,
|
|
92
|
-
type: 'ntlm',
|
|
93
|
-
config: {},
|
|
94
|
-
valid: true,
|
|
95
|
-
};
|
|
96
|
-
authorization.push(ntlm);
|
|
97
|
-
}
|
|
98
|
-
const cnf = ntlm.config;
|
|
99
|
-
if (cnf.username) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
cnf.username = values.username;
|
|
103
|
-
cnf.password = values.password;
|
|
104
|
-
cnf.domain = values.domain;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Adds basic authorization data to the request, when during this session basic auth was used
|
|
108
|
-
*/
|
|
109
|
-
export default function applyCachedBasicAuthData(request, context) {
|
|
110
|
-
// Try to find an auth data for the URL. If has a match, apply it to the request
|
|
111
|
-
let authData = findCachedAuthData('basic', request.url);
|
|
112
|
-
if (authData) {
|
|
113
|
-
applyRequestBasicAuthData(request, authData);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
// Try NTLM
|
|
117
|
-
authData = findCachedAuthData('ntlm', request.url);
|
|
118
|
-
if (authData && Array.isArray(context.authorization)) {
|
|
119
|
-
applyRequestNtlmAuthData(context.authorization, authData);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=BasicAuthCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BasicAuthCache.js","sourceRoot":"","sources":["../../../../src/runtime/modules/BasicAuthCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAIvD,OAAO,EAAyB,IAAI,IAAI,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAE/G,MAAM,KAAK,GAAQ,EAAE,CAAC;AAEtB;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,CAAC;KACX;IACD,IAAI;QACF,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QACZ,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC;QACd,IAAI,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC1B,6DAA6D;QAC7D,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACjC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC;KACf;IAAC,OAAO,CAAC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C,CAAC;IACnD,IAAI,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpD,wBAAwB,CAAC,OAAO,CAAC,aAAa,EAAE,QAA8B,CAAC,CAAC;KACjF;AACH,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export var ExecutionResponse;
|
|
2
|
-
(function (ExecutionResponse) {
|
|
3
|
-
ExecutionResponse[ExecutionResponse["OK"] = 0] = "OK";
|
|
4
|
-
ExecutionResponse[ExecutionResponse["ABORT"] = 1] = "ABORT";
|
|
5
|
-
})(ExecutionResponse || (ExecutionResponse = {}));
|
|
6
|
-
//# sourceMappingURL=ExecutionResponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutionResponse.js","sourceRoot":"","sources":["../../../../src/runtime/modules/ExecutionResponse.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,qDAAE,CAAA;IACF,2DAAK,CAAA;AACP,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B"}
|