@api-client/core 0.3.12 → 0.4.2
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 +10 -8
- package/build/browser.js +11 -7
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +12 -11
- package/build/index.js +9 -9
- package/build/index.js.map +1 -1
- package/build/src/data/JmesparthReader.d.ts +1 -1
- package/build/src/data/JmesparthReader.js +1 -1
- package/build/src/events/models/ProjectEvents.d.ts +1 -1
- package/build/src/events/models/ProjectEvents.js +1 -2
- package/build/src/events/models/ProjectEvents.js.map +1 -1
- package/build/src/lib/transformers/PayloadSerializer.d.ts +2 -2
- package/build/src/lib/transformers/PayloadSerializer.js +3 -3
- package/build/src/lib/transformers/PayloadSerializer.js.map +1 -1
- package/build/src/mocking/ProjectMock.d.ts +1 -1
- package/build/src/mocking/lib/Request.d.ts +2 -2
- package/build/src/mocking/lib/Request.js +3 -2
- package/build/src/mocking/lib/Request.js.map +1 -1
- package/build/src/mocking/lib/Response.d.ts +6 -6
- package/build/src/mocking/lib/Response.js +6 -6
- package/build/src/mocking/lib/Response.js.map +1 -1
- package/build/src/mocking/lib/User.js +3 -0
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/models/AuthorizationData.d.ts +2 -2
- package/build/src/models/AuthorizationData.js +2 -2
- package/build/src/models/ClientCertificate.d.ts +1 -1
- package/build/src/models/Environment.d.ts +3 -3
- package/build/src/models/Environment.js +3 -3
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/ErrorResponse.d.ts +1 -1
- package/build/src/models/ErrorResponse.js +1 -1
- package/build/src/models/HostRule.d.ts +4 -4
- package/build/src/models/HostRule.js +4 -4
- package/build/src/models/HostRule.js.map +1 -1
- package/build/src/models/HttpHistory.d.ts +30 -1
- package/build/src/models/HttpHistory.js +1 -1
- package/build/src/models/HttpHistory.js.map +1 -1
- package/build/src/models/HttpProject.d.ts +41 -6
- package/build/src/models/HttpProject.js +52 -4
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/HttpProjectListItem.d.ts +1 -1
- package/build/src/models/HttpProjectListItem.js +1 -1
- package/build/src/models/HttpProjectListItem.js.map +1 -1
- package/build/src/models/HttpRequest.d.ts +2 -2
- package/build/src/models/HttpRequest.js +2 -2
- package/build/src/models/HttpRequest.js.map +1 -1
- package/build/src/models/HttpResponse.d.ts +2 -2
- package/build/src/models/HttpResponse.js +3 -3
- package/build/src/models/HttpResponse.js.map +1 -1
- package/build/src/models/License.d.ts +3 -3
- package/build/src/models/License.js +3 -3
- package/build/src/models/License.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts +2 -2
- package/build/src/models/ProjectFolder.js +3 -3
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/ProjectItem.d.ts +1 -1
- package/build/src/models/ProjectItem.js +2 -2
- package/build/src/models/ProjectItem.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts +2 -2
- package/build/src/models/ProjectRequest.js +1 -1
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/ProjectSchema.d.ts +2 -2
- package/build/src/models/ProjectSchema.js +1 -1
- package/build/src/models/ProjectSchema.js.map +1 -1
- package/build/src/models/Property.d.ts +4 -4
- package/build/src/models/Property.js +4 -4
- package/build/src/models/Property.js.map +1 -1
- package/build/src/models/Provider.d.ts +3 -3
- package/build/src/models/Provider.js +3 -3
- package/build/src/models/Provider.js.map +1 -1
- package/build/src/models/Request.d.ts +2 -2
- package/build/src/models/Request.js +3 -3
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/RequestActions.d.ts +2 -4
- package/build/src/models/RequestActions.js +2 -4
- package/build/src/models/RequestActions.js.map +1 -1
- package/build/src/models/RequestAuthorization.d.ts +3 -5
- package/build/src/models/RequestAuthorization.js +2 -4
- package/build/src/models/RequestAuthorization.js.map +1 -1
- package/build/src/models/RequestConfig.d.ts +3 -5
- package/build/src/models/RequestConfig.js +1 -3
- package/build/src/models/RequestConfig.js.map +1 -1
- package/build/src/models/RequestLog.d.ts +14 -8
- package/build/src/models/RequestLog.js +18 -7
- package/build/src/models/RequestLog.js.map +1 -1
- package/build/src/models/RequestTime.d.ts +4 -6
- package/build/src/models/RequestTime.js +2 -4
- package/build/src/models/RequestTime.js.map +1 -1
- package/build/src/models/RequestUiMeta.d.ts +5 -5
- package/build/src/models/RequestUiMeta.js +2 -2
- package/build/src/models/RequestUiMeta.js.map +1 -1
- package/build/src/models/RequestsSize.d.ts +1 -3
- package/build/src/models/RequestsSize.js +1 -3
- package/build/src/models/RequestsSize.js.map +1 -1
- package/build/src/models/{ArcResponse.d.ts → Response.d.ts} +7 -9
- package/build/src/models/{ArcResponse.js → Response.js} +4 -6
- package/build/src/models/Response.js.map +1 -0
- package/build/src/models/ResponseAuthorization.d.ts +3 -3
- package/build/src/models/ResponseAuthorization.js +3 -3
- package/build/src/models/ResponseAuthorization.js.map +1 -1
- package/build/src/models/ResponseRedirect.d.ts +3 -5
- package/build/src/models/ResponseRedirect.js +1 -3
- package/build/src/models/ResponseRedirect.js.map +1 -1
- package/build/src/models/RevisionInfo.d.ts +1 -1
- package/build/src/models/RevisionInfo.js +1 -1
- package/build/src/models/RevisionInfo.js.map +1 -1
- package/build/src/models/SentRequest.d.ts +2 -4
- package/build/src/models/SentRequest.js +1 -3
- package/build/src/models/SentRequest.js.map +1 -1
- package/build/src/models/Server.d.ts +3 -3
- package/build/src/models/Server.js +3 -3
- package/build/src/models/Server.js.map +1 -1
- package/build/src/models/Thing.d.ts +3 -3
- package/build/src/models/Thing.js +3 -3
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/Url.d.ts +2 -4
- package/build/src/models/Url.js +2 -4
- package/build/src/models/Url.js.map +1 -1
- package/build/src/models/User.d.ts +2 -1
- package/build/src/models/User.js +1 -1
- package/build/src/models/User.js.map +1 -1
- package/build/src/models/WebApi.d.ts +1 -1
- package/build/src/models/WebApi.js +1 -1
- package/build/src/models/WebApi.js.map +1 -1
- package/build/src/models/WebApiIndex.d.ts +1 -1
- package/build/src/models/WebApiIndex.js +1 -1
- package/build/src/models/WebApiIndex.js.map +1 -1
- package/build/src/models/Workspace.d.ts +4 -4
- package/build/src/models/Workspace.js +4 -4
- package/build/src/models/Workspace.js.map +1 -1
- package/build/src/models/actions/Action.d.ts +2 -2
- package/build/src/models/actions/Action.js +1 -1
- package/build/src/models/actions/Action.js.map +1 -1
- package/build/src/models/actions/Condition.d.ts +2 -2
- package/build/src/models/actions/Condition.js +1 -1
- package/build/src/models/actions/Condition.js.map +1 -1
- package/build/src/models/actions/RunnableAction.d.ts +1 -1
- package/build/src/models/actions/RunnableAction.js +1 -1
- package/build/src/models/actions/RunnableAction.js.map +1 -1
- package/build/src/models/actions/runnable/DeleteCookieAction.d.ts +2 -2
- package/build/src/models/actions/runnable/DeleteCookieAction.js +1 -1
- package/build/src/models/actions/runnable/DeleteCookieAction.js.map +1 -1
- package/build/src/models/actions/runnable/SetCookieAction.d.ts +2 -2
- package/build/src/models/actions/runnable/SetCookieAction.js +1 -1
- package/build/src/models/actions/runnable/SetCookieAction.js.map +1 -1
- package/build/src/models/actions/runnable/SetVariableAction.d.ts +2 -2
- package/build/src/models/actions/runnable/SetVariableAction.js +1 -1
- package/build/src/models/actions/runnable/SetVariableAction.js.map +1 -1
- package/build/src/models/transformers/ImportUtils.d.ts +1 -1
- package/build/src/models/transformers/ImportUtils.js +1 -1
- package/build/src/models/transformers/PostmanBackupTransformer.js +2 -1
- package/build/src/models/transformers/PostmanBackupTransformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV21Transformer.js +2 -1
- package/build/src/models/transformers/PostmanV21Transformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV2Transformer.js +2 -1
- package/build/src/models/transformers/PostmanV2Transformer.js.map +1 -1
- package/build/src/runtime/actions/RunnableCondition.d.ts +6 -7
- package/build/src/runtime/actions/RunnableCondition.js +4 -5
- package/build/src/runtime/actions/RunnableCondition.js.map +1 -1
- package/build/src/runtime/http-engine/{ArcEngine.d.ts → CoreEngine.d.ts} +3 -3
- package/build/src/runtime/http-engine/{ArcEngine.js → CoreEngine.js} +8 -8
- package/build/src/runtime/http-engine/CoreEngine.js.map +1 -0
- package/build/src/runtime/http-engine/HttpEngine.d.ts +3 -3
- package/build/src/runtime/http-engine/HttpEngine.js +3 -20
- package/build/src/runtime/http-engine/HttpEngine.js.map +1 -1
- package/build/src/runtime/modules/BasicAuthCache.js +2 -5
- package/build/src/runtime/modules/BasicAuthCache.js.map +1 -1
- package/build/src/runtime/modules/RequestCookies.d.ts +1 -1
- package/build/src/runtime/modules/RequestCookies.js +3 -2
- package/build/src/runtime/modules/RequestCookies.js.map +1 -1
- package/build/src/runtime/node/InteropInterfaces.d.ts +115 -0
- package/build/src/runtime/node/InteropInterfaces.js +2 -0
- package/build/src/runtime/node/InteropInterfaces.js.map +1 -0
- package/build/src/runtime/node/ProjectParallelRunner.d.ts +2 -7
- package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.d.ts +17 -49
- package/build/src/runtime/node/ProjectRequestRunner.js +39 -10
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts +1 -59
- package/build/src/runtime/node/ProjectRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
- package/build/src/runtime/node/RequestFactory.d.ts +1 -1
- package/build/src/runtime/node/RequestFactory.js +3 -3
- package/build/src/runtime/node/RequestFactory.js.map +1 -1
- package/build/src/runtime/reporters/ProjectRunCliReporter.js.map +1 -1
- package/build/src/runtime/reporters/Reporter.js.map +1 -1
- package/build/src/runtime/store/AuthSdk.d.ts +28 -0
- package/build/src/runtime/store/AuthSdk.js +123 -0
- package/build/src/runtime/store/AuthSdk.js.map +1 -0
- package/build/src/runtime/store/BackendSdk.d.ts +8 -0
- package/build/src/runtime/store/BackendSdk.js +25 -0
- package/build/src/runtime/store/BackendSdk.js.map +1 -0
- package/build/src/runtime/store/HistorySdk.d.ts +48 -0
- package/build/src/runtime/store/HistorySdk.js +142 -0
- package/build/src/runtime/store/HistorySdk.js.map +1 -0
- package/build/src/runtime/store/Http.d.ts +14 -0
- package/build/src/runtime/store/Http.js +4 -0
- package/build/src/runtime/store/Http.js.map +1 -0
- package/build/src/runtime/store/HttpNode.d.ts +16 -0
- package/build/src/runtime/store/HttpNode.js +95 -0
- package/build/src/runtime/store/HttpNode.js.map +1 -0
- package/build/src/runtime/store/HttpWeb.d.ts +15 -0
- package/build/src/runtime/store/HttpWeb.js +83 -0
- package/build/src/runtime/store/HttpWeb.js.map +1 -0
- package/build/src/runtime/store/ProjectsSdk.d.ts +43 -0
- package/build/src/runtime/store/ProjectsSdk.js +144 -0
- package/build/src/runtime/store/ProjectsSdk.js.map +1 -0
- package/build/src/runtime/store/RouteBuilder.d.ts +42 -0
- package/build/src/runtime/store/RouteBuilder.js +75 -0
- package/build/src/runtime/store/RouteBuilder.js.map +1 -0
- package/build/src/runtime/store/Sdk.d.ts +79 -0
- package/build/src/runtime/store/Sdk.js +117 -0
- package/build/src/runtime/store/Sdk.js.map +1 -0
- package/build/src/runtime/store/SdkBase.d.ts +45 -0
- package/build/src/runtime/store/SdkBase.js +40 -0
- package/build/src/runtime/store/SdkBase.js.map +1 -0
- package/build/src/runtime/store/SpacesSdk.d.ts +50 -0
- package/build/src/runtime/store/SpacesSdk.js +185 -0
- package/build/src/runtime/store/SpacesSdk.js.map +1 -0
- package/build/src/runtime/store/StoreSdkNode.d.ts +10 -0
- package/build/src/runtime/store/StoreSdkNode.js +11 -0
- package/build/src/runtime/store/StoreSdkNode.js.map +1 -0
- package/build/src/runtime/store/StoreSdkWeb.d.ts +10 -0
- package/build/src/runtime/store/StoreSdkWeb.js +11 -0
- package/build/src/runtime/store/StoreSdkWeb.js.map +1 -0
- package/build/src/runtime/store/UsersSdk.d.ts +18 -0
- package/build/src/runtime/store/UsersSdk.js +88 -0
- package/build/src/runtime/store/UsersSdk.js.map +1 -0
- package/build/src/runtime/store/WsClient.d.ts +24 -0
- package/build/src/runtime/store/WsClient.js +4 -0
- package/build/src/runtime/store/WsClient.js.map +1 -0
- package/build/src/runtime/store/WsClientNode.d.ts +24 -0
- package/build/src/runtime/store/WsClientNode.js +66 -0
- package/build/src/runtime/store/WsClientNode.js.map +1 -0
- package/build/src/runtime/store/WsClientWeb.d.ts +23 -0
- package/build/src/runtime/store/WsClientWeb.js +73 -0
- package/build/src/runtime/store/WsClientWeb.js.map +1 -0
- package/package.json +6 -8
- package/readme.md +5 -5
- package/src/data/JmesparthReader.ts +1 -1
- package/src/events/models/ProjectEvents.ts +2 -2
- package/src/events/readme.md +1 -1
- package/src/lib/transformers/PayloadSerializer.ts +3 -3
- package/src/mocking/ProjectMock.ts +1 -1
- package/src/mocking/lib/Request.ts +5 -5
- package/src/mocking/lib/Response.ts +10 -10
- package/src/mocking/lib/User.ts +2 -1
- package/src/models/AuthorizationData.ts +2 -2
- package/src/models/ClientCertificate.ts +1 -1
- package/src/models/Environment.ts +4 -4
- package/src/models/ErrorResponse.ts +1 -1
- package/src/models/HostRule.ts +5 -5
- package/src/models/HttpHistory.ts +31 -1
- package/src/models/HttpProject.ts +87 -7
- package/src/models/HttpProjectListItem.ts +1 -1
- package/src/models/HttpRequest.ts +2 -2
- package/src/models/HttpResponse.ts +3 -3
- package/src/models/License.ts +4 -4
- package/src/models/ProjectFolder.ts +3 -3
- package/src/models/ProjectItem.ts +2 -2
- package/src/models/ProjectRequest.ts +2 -2
- package/src/models/ProjectSchema.ts +2 -2
- package/src/models/Property.ts +5 -5
- package/src/models/Provider.ts +4 -4
- package/src/models/README.md +2 -2
- package/src/models/Request.ts +4 -4
- package/src/models/RequestActions.ts +2 -4
- package/src/models/RequestAuthorization.ts +3 -5
- package/src/models/RequestConfig.ts +3 -5
- package/src/models/RequestLog.ts +25 -11
- package/src/models/RequestTime.ts +4 -6
- package/src/models/RequestUiMeta.ts +5 -5
- package/src/models/RequestsSize.ts +1 -3
- package/src/models/{ArcResponse.ts → Response.ts} +12 -14
- package/src/models/ResponseAuthorization.ts +4 -4
- package/src/models/ResponseRedirect.ts +3 -5
- package/src/models/RevisionInfo.ts +1 -1
- package/src/models/SentRequest.ts +2 -4
- package/src/models/Server.ts +4 -4
- package/src/models/Thing.ts +4 -4
- package/src/models/Url.ts +2 -4
- package/src/models/User.ts +2 -1
- package/src/models/WebApi.ts +1 -1
- package/src/models/WebApiIndex.ts +1 -1
- package/src/models/Workspace.ts +5 -5
- package/src/models/actions/Action.ts +2 -2
- package/src/models/actions/Condition.ts +2 -2
- package/src/models/actions/RunnableAction.ts +1 -1
- package/src/models/actions/runnable/DeleteCookieAction.ts +2 -2
- package/src/models/actions/runnable/SetCookieAction.ts +2 -2
- package/src/models/actions/runnable/SetVariableAction.ts +2 -2
- package/src/models/transformers/ImportUtils.ts +1 -1
- package/src/models/transformers/PostmanBackupTransformer.ts +2 -1
- package/src/models/transformers/PostmanV21Transformer.ts +2 -1
- package/src/models/transformers/PostmanV2Transformer.ts +2 -1
- package/src/runtime/actions/RunnableCondition.ts +6 -7
- package/src/runtime/http-engine/{ArcEngine.ts → CoreEngine.ts} +7 -7
- package/src/runtime/http-engine/HttpEngine.ts +5 -24
- package/src/runtime/modules/BasicAuthCache.ts +2 -6
- package/src/runtime/modules/RequestCookies.ts +6 -5
- package/src/runtime/node/InteropInterfaces.ts +121 -0
- package/src/runtime/node/ProjectParallelRunner.ts +2 -9
- package/src/runtime/node/ProjectRequestRunner.ts +42 -61
- package/src/runtime/node/ProjectRunner.ts +1 -60
- package/src/runtime/node/ProjectRunnerWorker.ts +2 -1
- package/src/runtime/node/RequestFactory.ts +3 -3
- package/src/runtime/reporters/ProjectRunCliReporter.ts +2 -2
- package/src/runtime/reporters/Reporter.ts +4 -4
- package/src/runtime/store/AuthSdk.ts +126 -0
- package/src/runtime/store/BackendSdk.ts +25 -0
- package/src/runtime/store/HistorySdk.ts +157 -0
- package/src/runtime/store/Http.ts +18 -0
- package/src/runtime/store/HttpNode.ts +100 -0
- package/src/runtime/store/HttpWeb.ts +89 -0
- package/src/runtime/store/ProjectsSdk.ts +147 -0
- package/src/runtime/store/RouteBuilder.ts +89 -0
- package/src/runtime/store/Sdk.ts +131 -0
- package/src/runtime/store/SdkBase.ts +72 -0
- package/src/runtime/store/SpacesSdk.ts +190 -0
- package/src/runtime/store/StoreSdkNode.ts +13 -0
- package/src/runtime/store/StoreSdkWeb.ts +13 -0
- package/src/runtime/store/UsersSdk.ts +89 -0
- package/src/runtime/store/WsClient.ts +28 -0
- package/src/runtime/store/WsClientNode.ts +68 -0
- package/src/runtime/store/WsClientWeb.ts +75 -0
- package/build/src/models/ArcResponse.js.map +0 -1
- package/build/src/models/HistoryIndex.d.ts +0 -43
- package/build/src/models/HistoryIndex.js +0 -53
- package/build/src/models/HistoryIndex.js.map +0 -1
- package/build/src/models/HistoryRequest.d.ts +0 -13
- package/build/src/models/HistoryRequest.js +0 -25
- package/build/src/models/HistoryRequest.js.map +0 -1
- package/build/src/runtime/http-engine/ArcEngine.js.map +0 -1
- package/build/src/runtime/http-engine/NodeEngine.d.ts +0 -154
- package/build/src/runtime/http-engine/NodeEngine.js +0 -766
- package/build/src/runtime/http-engine/NodeEngine.js.map +0 -1
- package/build/src/runtime/http-engine/NodeEngineDirect.d.ts +0 -113
- package/build/src/runtime/http-engine/NodeEngineDirect.js +0 -449
- package/build/src/runtime/http-engine/NodeEngineDirect.js.map +0 -1
- package/build/src/runtime/store/StoreSdk.d.ts +0 -279
- package/build/src/runtime/store/StoreSdk.js +0 -840
- package/build/src/runtime/store/StoreSdk.js.map +0 -1
- package/src/models/HistoryIndex.ts +0 -76
- package/src/models/HistoryRequest.ts +0 -28
- package/src/runtime/http-engine/NodeEngine.ts +0 -792
- package/src/runtime/http-engine/NodeEngineDirect.ts +0 -482
- package/src/runtime/store/StoreSdk.ts +0 -895
|
@@ -11,7 +11,7 @@ export { Kind };
|
|
|
11
11
|
/**
|
|
12
12
|
* An HTTP response object.
|
|
13
13
|
*/
|
|
14
|
-
export interface
|
|
14
|
+
export interface IResponse extends IHttpResponse {
|
|
15
15
|
/**
|
|
16
16
|
* The request timings.
|
|
17
17
|
* Some HTTP clients may not give this information.
|
|
@@ -27,7 +27,7 @@ export interface IArcResponse extends IHttpResponse {
|
|
|
27
27
|
auth?: IResponseAuthorization;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export class
|
|
30
|
+
export class Response extends HttpResponse {
|
|
31
31
|
/**
|
|
32
32
|
* The request timings.
|
|
33
33
|
* Some HTTP clients may not give this information.
|
|
@@ -42,8 +42,8 @@ export class ArcResponse extends HttpResponse {
|
|
|
42
42
|
*/
|
|
43
43
|
auth?: ResponseAuthorization;
|
|
44
44
|
|
|
45
|
-
static fromValues(status: number, statusText?: string, headers?: string):
|
|
46
|
-
return new
|
|
45
|
+
static fromValues(status: number, statusText?: string, headers?: string): Response {
|
|
46
|
+
return new Response({
|
|
47
47
|
kind: Kind,
|
|
48
48
|
status,
|
|
49
49
|
statusText,
|
|
@@ -52,8 +52,8 @@ export class ArcResponse extends HttpResponse {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
static async fromLegacy(input: LegacyResponse): Promise<
|
|
56
|
-
const init:
|
|
55
|
+
static async fromLegacy(input: LegacyResponse): Promise<Response> {
|
|
56
|
+
const init: IResponse = {
|
|
57
57
|
kind: Kind,
|
|
58
58
|
status: input.status || 0,
|
|
59
59
|
loadingTime: input.loadingTime || 0,
|
|
@@ -83,15 +83,15 @@ export class ArcResponse extends HttpResponse {
|
|
|
83
83
|
if (input.timings) {
|
|
84
84
|
init.timings = new RequestTime(input.timings).toJSON();
|
|
85
85
|
}
|
|
86
|
-
return new
|
|
86
|
+
return new Response(init);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* @param input The response definition used to restore the state.
|
|
91
91
|
*/
|
|
92
|
-
constructor(input?: string|
|
|
92
|
+
constructor(input?: string|IResponse) {
|
|
93
93
|
super();
|
|
94
|
-
let init:
|
|
94
|
+
let init: IResponse;
|
|
95
95
|
if (typeof input === 'string') {
|
|
96
96
|
init = JSON.parse(input);
|
|
97
97
|
} else if (typeof input === 'object') {
|
|
@@ -108,10 +108,8 @@ export class ArcResponse extends HttpResponse {
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Creates a new response clearing anything that is so far defined.
|
|
111
|
-
*
|
|
112
|
-
* Note, this throws an error when the object is not an ARC response.
|
|
113
111
|
*/
|
|
114
|
-
new(init:
|
|
112
|
+
new(init: IResponse): void {
|
|
115
113
|
super.new(init);
|
|
116
114
|
const { loadingTime=0, timings, auth } = init;
|
|
117
115
|
this.loadingTime = loadingTime;
|
|
@@ -127,8 +125,8 @@ export class ArcResponse extends HttpResponse {
|
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
toJSON():
|
|
131
|
-
const response = super.toJSON() as
|
|
128
|
+
toJSON(): IResponse {
|
|
129
|
+
const response = super.toJSON() as IResponse;
|
|
132
130
|
response.loadingTime = this.loadingTime;
|
|
133
131
|
if (this.timings) {
|
|
134
132
|
response.timings = this.timings.toJSON();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const Kind = '
|
|
1
|
+
export const Kind = 'Core#ResponseAuthorization';
|
|
2
2
|
|
|
3
3
|
export interface IResponseAuthorization {
|
|
4
|
-
kind:
|
|
4
|
+
kind: typeof Kind;
|
|
5
5
|
/**
|
|
6
6
|
* The requested by the authorization server authentication method
|
|
7
7
|
*/
|
|
@@ -60,11 +60,11 @@ export class ResponseAuthorization {
|
|
|
60
60
|
/**
|
|
61
61
|
* Creates a new response authorization clearing anything that is so far defined.
|
|
62
62
|
*
|
|
63
|
-
* Note, this throws an error when the object is not
|
|
63
|
+
* Note, this throws an error when the object is not a response authorization.
|
|
64
64
|
*/
|
|
65
65
|
new(init: IResponseAuthorization): void {
|
|
66
66
|
if (!ResponseAuthorization.isResponseAuthorization(init)) {
|
|
67
|
-
throw new Error(`Not
|
|
67
|
+
throw new Error(`Not a response authorization.`);
|
|
68
68
|
}
|
|
69
69
|
const { method, state, headers, challengeHeader } = init;
|
|
70
70
|
this.kind = Kind;
|
|
@@ -2,13 +2,13 @@ import { IHttpResponse, HttpResponse, Kind as ResponseKind } from './HttpRespons
|
|
|
2
2
|
import { IRequestTime, RequestTime } from './RequestTime.js';
|
|
3
3
|
import { ResponseRedirect as LegacyRedirect } from './legacy/request/ArcResponse.js';
|
|
4
4
|
|
|
5
|
-
export const Kind = '
|
|
5
|
+
export const Kind = 'Core#HttpResponseRedirect';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* An information about a redirect
|
|
9
9
|
*/
|
|
10
10
|
export interface IResponseRedirect {
|
|
11
|
-
kind:
|
|
11
|
+
kind: typeof Kind;
|
|
12
12
|
/**
|
|
13
13
|
* Redirection response
|
|
14
14
|
*/
|
|
@@ -33,7 +33,7 @@ export interface IResponseRedirect {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
export class ResponseRedirect {
|
|
36
|
-
kind = Kind;
|
|
36
|
+
kind: typeof Kind = Kind;
|
|
37
37
|
/**
|
|
38
38
|
* Redirection response
|
|
39
39
|
*/
|
|
@@ -119,8 +119,6 @@ export class ResponseRedirect {
|
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Creates a new redirect clearing anything that is so far defined.
|
|
122
|
-
*
|
|
123
|
-
* Note, this throws an error when the object is not an ARC redirect.
|
|
124
122
|
*/
|
|
125
123
|
new(init: IResponseRedirect): void {
|
|
126
124
|
const { response, timings, startTime=0, endTime=0, url='', kind=Kind } = init;
|
|
@@ -21,7 +21,7 @@ export interface IBaseSentRequest extends IBaseHttpRequest {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* An interface describing a request made by the HTTP transport.
|
|
24
|
-
* Each transport used by
|
|
24
|
+
* Each transport used by API Client must return this structure in the response event.
|
|
25
25
|
* This is not a replacement for the editor request that also has to be returned.
|
|
26
26
|
*
|
|
27
27
|
* Another difference is that this headers contains a final list of headers sent to the
|
|
@@ -103,9 +103,7 @@ export class SentRequest extends HttpRequest {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
* Creates a new request clearing anything that is so far defined.
|
|
107
|
-
*
|
|
108
|
-
* Note, this throws an error when the object is not an ARC request.
|
|
106
|
+
* Creates a new sent request clearing anything that is so far defined.
|
|
109
107
|
*/
|
|
110
108
|
new(init: ISentRequest): void {
|
|
111
109
|
super.new(init);
|
package/src/models/Server.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const Kind = '
|
|
1
|
+
export const Kind = 'Core#Server';
|
|
2
2
|
|
|
3
3
|
export interface IServer {
|
|
4
|
-
kind:
|
|
4
|
+
kind: typeof Kind;
|
|
5
5
|
/**
|
|
6
6
|
* The base URI of the server.
|
|
7
7
|
*
|
|
@@ -85,11 +85,11 @@ export class Server {
|
|
|
85
85
|
/**
|
|
86
86
|
* Creates a new server clearing anything that is so far defined.
|
|
87
87
|
*
|
|
88
|
-
* Note, this throws an error when the server is not
|
|
88
|
+
* Note, this throws an error when the server is not a server.
|
|
89
89
|
*/
|
|
90
90
|
new(init: IServer): void {
|
|
91
91
|
if (!Server.isServer(init)) {
|
|
92
|
-
throw new Error(`Not
|
|
92
|
+
throw new Error(`Not a server.`);
|
|
93
93
|
}
|
|
94
94
|
const { uri, description, protocol, basePath } = init;
|
|
95
95
|
this.kind = Kind;
|
package/src/models/Thing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const Kind = '
|
|
1
|
+
export const Kind = 'Core#Thing';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An interface describing a base metadata of a thing.
|
|
@@ -7,7 +7,7 @@ export declare interface IThing {
|
|
|
7
7
|
/**
|
|
8
8
|
* The data kind. The application ignores the input with an unknown `kind`, unless it can be determined from the context.
|
|
9
9
|
*/
|
|
10
|
-
kind?:
|
|
10
|
+
kind?: typeof Kind;
|
|
11
11
|
/**
|
|
12
12
|
* The name of the thing.
|
|
13
13
|
*/
|
|
@@ -68,11 +68,11 @@ export class Thing {
|
|
|
68
68
|
/**
|
|
69
69
|
* Creates a new thing clearing anything that is so far defined.
|
|
70
70
|
*
|
|
71
|
-
* Note, this throws an error when the server is not
|
|
71
|
+
* Note, this throws an error when the server is not a thing.
|
|
72
72
|
*/
|
|
73
73
|
new(init: IThing): void {
|
|
74
74
|
if (!Thing.isThing(init)) {
|
|
75
|
-
throw new Error(`Not
|
|
75
|
+
throw new Error(`Not a thing.`);
|
|
76
76
|
}
|
|
77
77
|
const { description, name, version } = init;
|
|
78
78
|
this.kind = Kind;
|
package/src/models/Url.ts
CHANGED
|
@@ -41,7 +41,7 @@ export class Url {
|
|
|
41
41
|
midnight?: number;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* @param input The
|
|
44
|
+
* @param input The URL definition used to restore the state.
|
|
45
45
|
*/
|
|
46
46
|
constructor(input: string|IUrl) {
|
|
47
47
|
let init: IUrl;
|
|
@@ -60,9 +60,7 @@ export class Url {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Creates a new
|
|
64
|
-
*
|
|
65
|
-
* Note, this throws an error when the environment is not an ARC environment.
|
|
63
|
+
* Creates a new URL clearing anything that is so far defined.
|
|
66
64
|
*/
|
|
67
65
|
new(init: IUrl): void {
|
|
68
66
|
const { url='', cnt=0, time = Date.now(), midnight } = init;
|
package/src/models/User.ts
CHANGED
package/src/models/WebApi.ts
CHANGED
package/src/models/Workspace.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { AccessControlLevel } from "./User.js";
|
|
|
2
2
|
import { IThing, Thing, Kind as ThingKind } from './Thing.js';
|
|
3
3
|
import v4 from '../lib/uuid.js';
|
|
4
4
|
|
|
5
|
-
export const Kind = '
|
|
5
|
+
export const Kind = 'Core#Space';
|
|
6
6
|
/**
|
|
7
7
|
* A definition of the working space for users.
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@ export const Kind = 'ARC#Space';
|
|
|
10
10
|
* created by the system users, where they can store their projects and other data.
|
|
11
11
|
*/
|
|
12
12
|
export interface IWorkspace {
|
|
13
|
-
kind:
|
|
13
|
+
kind: typeof Kind;
|
|
14
14
|
/**
|
|
15
15
|
* The space identifier.
|
|
16
16
|
*/
|
|
@@ -75,7 +75,7 @@ export class Workspace {
|
|
|
75
75
|
*/
|
|
76
76
|
projects: string[] = [];
|
|
77
77
|
/**
|
|
78
|
-
* Only set when the object was created from the data received by the
|
|
78
|
+
* Only set when the object was created from the data received by the API Client backend.
|
|
79
79
|
* Level access of the current user to the space.
|
|
80
80
|
* Note, this information is never serialized with the object.
|
|
81
81
|
*/
|
|
@@ -127,11 +127,11 @@ export class Workspace {
|
|
|
127
127
|
/**
|
|
128
128
|
* Creates a new environment clearing anything that is so far defined.
|
|
129
129
|
*
|
|
130
|
-
* Note, this throws an error when the environment is not
|
|
130
|
+
* Note, this throws an error when the environment is not a space.
|
|
131
131
|
*/
|
|
132
132
|
new(init: IWorkspace | IUserWorkspace): void {
|
|
133
133
|
if (!Workspace.isWorkspace(init)) {
|
|
134
|
-
throw new Error(`Not
|
|
134
|
+
throw new Error(`Not a space.`);
|
|
135
135
|
}
|
|
136
136
|
const { key = v4(), projects = [], info, owner = DefaultOwner, users } = init;
|
|
137
137
|
this.kind = Kind;
|
|
@@ -5,13 +5,13 @@ import { Kind as SetCookieKind, SetCookieAction, ISetCookieAction } from './runn
|
|
|
5
5
|
import { Kind as SetVariableKind, SetVariableAction, ISetVariableAction } from './runnable/SetVariableAction.js';
|
|
6
6
|
import { Action as LegacyAction, SetCookieConfig, SetVariableConfig, DeleteCookieConfig } from '../legacy/actions/Actions.js';
|
|
7
7
|
|
|
8
|
-
export const Kind = '
|
|
8
|
+
export const Kind = 'Core#Action';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An interface representing a single action.
|
|
12
12
|
*/
|
|
13
13
|
export interface IAction {
|
|
14
|
-
kind?:
|
|
14
|
+
kind?: typeof Kind;
|
|
15
15
|
/**
|
|
16
16
|
* Action name.
|
|
17
17
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionTypeEnum, RequestDataSourceEnum, ResponseDataSourceEnum, OperatorEnum } from './Enums.js';
|
|
2
2
|
import { Condition as LegacyCondition } from '../legacy/actions/Actions.js';
|
|
3
3
|
|
|
4
|
-
export const Kind = '
|
|
4
|
+
export const Kind = 'Core#Condition';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A base interface describing a configuration to extract data from a request or a response.
|
|
@@ -33,7 +33,7 @@ export interface IDataSource {
|
|
|
33
33
|
* Describes action's condition configuration.
|
|
34
34
|
*/
|
|
35
35
|
export interface ICondition extends IDataSource {
|
|
36
|
-
kind:
|
|
36
|
+
kind: typeof Kind,
|
|
37
37
|
/**
|
|
38
38
|
* The comparison operator.
|
|
39
39
|
*/
|
|
@@ -2,7 +2,7 @@ import { ICondition, Condition } from './Condition.js';
|
|
|
2
2
|
import { IAction, Action } from './Action.js';
|
|
3
3
|
import { RunnableAction as LegacyRunnable } from '../legacy/actions/Actions.js';
|
|
4
4
|
|
|
5
|
-
export const Kind = '
|
|
5
|
+
export const Kind = 'Core#RunnableAction';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* An interface representing a runnable set of action in a condition.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DeleteCookieConfig } from '../../legacy/actions/Actions.js';
|
|
2
2
|
import { Runnable, IRunnable } from './Runnable.js';
|
|
3
3
|
|
|
4
|
-
export const Kind = '
|
|
4
|
+
export const Kind = 'Core#DeleteCookieAction';
|
|
5
5
|
|
|
6
6
|
export interface IDeleteCookieAction extends IRunnable {
|
|
7
|
-
kind?:
|
|
7
|
+
kind?: typeof Kind;
|
|
8
8
|
/**
|
|
9
9
|
* When set it uses request URL instead of defined URL in the action.
|
|
10
10
|
*/
|
|
@@ -3,10 +3,10 @@ import { Runnable, IRunnable } from './Runnable.js';
|
|
|
3
3
|
import { IDataSource } from '../Condition.js';
|
|
4
4
|
import { RequestDataSourceEnum } from '../Enums.js';
|
|
5
5
|
|
|
6
|
-
export const Kind = '
|
|
6
|
+
export const Kind = 'Core#SetCookieAction';
|
|
7
7
|
|
|
8
8
|
export interface ISetCookieAction extends IRunnable {
|
|
9
|
-
kind?:
|
|
9
|
+
kind?: typeof Kind;
|
|
10
10
|
/**
|
|
11
11
|
* Name of the cookie
|
|
12
12
|
*/
|
|
@@ -3,10 +3,10 @@ import { Runnable, IRunnable } from './Runnable.js';
|
|
|
3
3
|
import { IDataSource } from '../Condition.js';
|
|
4
4
|
import { RequestDataSourceEnum } from '../Enums.js';
|
|
5
5
|
|
|
6
|
-
export const Kind = '
|
|
6
|
+
export const Kind = 'Core#SetVariableAction';
|
|
7
7
|
|
|
8
8
|
export interface ISetVariableAction extends IRunnable {
|
|
9
|
-
kind?:
|
|
9
|
+
kind?: typeof Kind;
|
|
10
10
|
/**
|
|
11
11
|
* Name of the variable to set
|
|
12
12
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
/* eslint-disable no-plusplus */
|
|
3
3
|
/**
|
|
4
|
-
* User can export single request in ARC. In this case
|
|
4
|
+
* User can export single request in ARC. In this case the app opens new tab
|
|
5
5
|
* rather actually imports the data. This function tests if this is the case.
|
|
6
6
|
* @param data Normalized import data
|
|
7
7
|
*/
|
|
@@ -5,6 +5,7 @@ import { ProjectFolder } from '../ProjectFolder.js';
|
|
|
5
5
|
import { ProjectRequest } from '../ProjectRequest.js';
|
|
6
6
|
import { IMultipartBody } from '../../lib/transformers/PayloadSerializer.js';
|
|
7
7
|
import { Environment } from '../Environment.js';
|
|
8
|
+
import { Kind as ThingKind } from '../Thing.js';
|
|
8
9
|
|
|
9
10
|
interface PostmanBackupV1 {
|
|
10
11
|
version: number;
|
|
@@ -147,7 +148,7 @@ export class PostmanBackupTransformer extends PostmanTransformer {
|
|
|
147
148
|
definitions: {},
|
|
148
149
|
environments: [],
|
|
149
150
|
info: {
|
|
150
|
-
kind:
|
|
151
|
+
kind: ThingKind,
|
|
151
152
|
name,
|
|
152
153
|
},
|
|
153
154
|
items: [],
|
|
@@ -6,6 +6,7 @@ import { ProjectRequest } from '../ProjectRequest.js';
|
|
|
6
6
|
import { IMultipartBody } from '../../lib/transformers/PayloadSerializer.js';
|
|
7
7
|
import v4 from '../../lib/uuid.js';
|
|
8
8
|
import { Environment } from '../Environment.js';
|
|
9
|
+
import { Kind as ThingKind } from '../Thing.js';
|
|
9
10
|
|
|
10
11
|
export const currentItemValue = Symbol('currentItemValue');
|
|
11
12
|
|
|
@@ -134,7 +135,7 @@ export class PostmanV21Transformer extends PostmanTransformer {
|
|
|
134
135
|
definitions: {},
|
|
135
136
|
environments: [],
|
|
136
137
|
info: {
|
|
137
|
-
kind:
|
|
138
|
+
kind: ThingKind,
|
|
138
139
|
name: info.name || 'Unnamed Postman project',
|
|
139
140
|
},
|
|
140
141
|
items: [],
|
|
@@ -6,6 +6,7 @@ import { ProjectRequest } from '../ProjectRequest.js';
|
|
|
6
6
|
import { IMultipartBody } from '../../lib/transformers/PayloadSerializer.js';
|
|
7
7
|
import v4 from '../../lib/uuid.js';
|
|
8
8
|
import { Environment } from '../Environment.js';
|
|
9
|
+
import { Kind as ThingKind } from '../Thing.js';
|
|
9
10
|
|
|
10
11
|
export const currentItemValue = Symbol('currentItemValue');
|
|
11
12
|
|
|
@@ -131,7 +132,7 @@ export class PostmanV2Transformer extends PostmanTransformer {
|
|
|
131
132
|
definitions: {},
|
|
132
133
|
environments: [],
|
|
133
134
|
info: {
|
|
134
|
-
kind:
|
|
135
|
+
kind: ThingKind,
|
|
135
136
|
name: info.name || 'Unnamed Postman project',
|
|
136
137
|
},
|
|
137
138
|
items: [],
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { IRunnableAction, RunnableAction } from '../../models/actions/RunnableAction.js';
|
|
2
2
|
import { IHttpRequest } from '../../models/HttpRequest.js';
|
|
3
|
-
import {
|
|
3
|
+
import { IResponse } from '../../models/Response.js';
|
|
4
4
|
import { ISentRequest } from '../../models/SentRequest.js';
|
|
5
5
|
import { IErrorResponse } from '../../models/ErrorResponse.js';
|
|
6
6
|
import { RequestDataExtractor } from '../../data/RequestDataExtractor.js';
|
|
7
7
|
import { checkCondition } from './ConditionRunner.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* A class that represents
|
|
10
|
+
* A class that represents API Client condition that runs actions when the condition is met.
|
|
11
11
|
*/
|
|
12
12
|
export class RunnableCondition extends RunnableAction {
|
|
13
13
|
/**
|
|
14
14
|
* Tests whether the condition is satisfied for request and/or response.
|
|
15
15
|
*
|
|
16
|
-
* @param request The
|
|
17
|
-
* @param
|
|
18
|
-
* @param response The ARC response object, if available.
|
|
16
|
+
* @param request The API Client request object.
|
|
17
|
+
* @param response The API Client response object, if available.
|
|
19
18
|
* @return True when the condition is satisfied.
|
|
20
19
|
*/
|
|
21
|
-
async satisfied(request: IHttpRequest | ISentRequest, response?:
|
|
20
|
+
async satisfied(request: IHttpRequest | ISentRequest, response?: IResponse | IErrorResponse): Promise<boolean> {
|
|
22
21
|
if (this.enabled === false) {
|
|
23
22
|
return false;
|
|
24
23
|
}
|
|
@@ -38,7 +37,7 @@ export class RunnableCondition extends RunnableAction {
|
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
39
|
* Maps runnables interface to
|
|
41
|
-
* If an item is not an instance of `
|
|
40
|
+
* If an item is not an instance of `RunnableCondition` then it creates an instance of it
|
|
42
41
|
* by passing the map as an argument.
|
|
43
42
|
*
|
|
44
43
|
* @param value Passed list of actions.
|
|
@@ -5,7 +5,7 @@ import https from 'https';
|
|
|
5
5
|
import { HttpEngine, HttpEngineOptions, HeadersReceivedDetail } from './HttpEngine.js';
|
|
6
6
|
import { IRequestLog } from 'src/models/RequestLog.js';
|
|
7
7
|
import { IHttpRequest } from '../../models/HttpRequest.js';
|
|
8
|
-
import {
|
|
8
|
+
import { Response } from '../../models/Response.js';
|
|
9
9
|
import { SerializableError } from '../../models/SerializableError.js';
|
|
10
10
|
import { Headers } from '../../lib/headers/Headers.js';
|
|
11
11
|
import { PayloadSupport } from './PayloadSupport.js';
|
|
@@ -34,11 +34,11 @@ interface ResponseInfo {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* API Client's HTTP engine.
|
|
38
38
|
* An HTTP 1.1 engine working directly on the socket. It communicates with the remote machine and
|
|
39
39
|
* collects stats about the request and response.
|
|
40
40
|
*/
|
|
41
|
-
export class
|
|
41
|
+
export class CoreEngine extends HttpEngine {
|
|
42
42
|
state = RequestState.Status;
|
|
43
43
|
rawHeaders?: Buffer;
|
|
44
44
|
_hostTestReg = /^\s*host\s*:/im;
|
|
@@ -119,7 +119,7 @@ export class ArcEngine extends HttpEngine {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Prepares an HTTP message from
|
|
122
|
+
* Prepares an HTTP message from API Client's request object.
|
|
123
123
|
*
|
|
124
124
|
* @returns Resolved promise to an `ArrayBuffer`.
|
|
125
125
|
*/
|
|
@@ -539,7 +539,7 @@ export class ArcEngine extends HttpEngine {
|
|
|
539
539
|
* @return Redirect response object
|
|
540
540
|
*/
|
|
541
541
|
async _createRedirectResponse(location: string): Promise<ResponseRedirect> {
|
|
542
|
-
const { currentResponse = new
|
|
542
|
+
const { currentResponse = new Response() } = this;
|
|
543
543
|
this.currentResponse = currentResponse;
|
|
544
544
|
if (!this.currentResponse.payload) {
|
|
545
545
|
if (this._rawBody) {
|
|
@@ -626,7 +626,7 @@ export class ArcEngine extends HttpEngine {
|
|
|
626
626
|
if (this.aborted) {
|
|
627
627
|
return;
|
|
628
628
|
}
|
|
629
|
-
const response =
|
|
629
|
+
const response = Response.fromValues(0);
|
|
630
630
|
response.loadingTime = 0;
|
|
631
631
|
this.currentResponse = response;
|
|
632
632
|
if (!data) {
|
|
@@ -1000,7 +1000,7 @@ export class ArcEngine extends HttpEngine {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
if (res.statusCode === 401) {
|
|
1002
1002
|
this.currentHeaders = new Headers(res.headers);
|
|
1003
|
-
const currentResponse =
|
|
1003
|
+
const currentResponse = Response.fromValues(res.statusCode, res.statusMessage, this.currentHeaders.toString());
|
|
1004
1004
|
currentResponse.loadingTime = 0;
|
|
1005
1005
|
this.currentResponse = currentResponse;
|
|
1006
1006
|
if (head.length) {
|
|
@@ -12,7 +12,7 @@ import { IRequestAuthorization } from '../../models/RequestAuthorization.js';
|
|
|
12
12
|
import { HostRule } from '../../models/HostRule.js';
|
|
13
13
|
import { IRequestCertificate } from '../../models/ClientCertificate.js';
|
|
14
14
|
import { SentRequest } from '../../models/SentRequest.js';
|
|
15
|
-
import {
|
|
15
|
+
import { Response } from '../../models/Response.js';
|
|
16
16
|
import { ErrorResponse } from '../../models/ErrorResponse.js';
|
|
17
17
|
import { RequestsSize } from '../../models/RequestsSize.js';
|
|
18
18
|
import { HttpResponse } from '../../models/HttpResponse.js';
|
|
@@ -154,7 +154,7 @@ export abstract class HttpEngine extends EventEmitter {
|
|
|
154
154
|
/**
|
|
155
155
|
* The response object build during the execution.
|
|
156
156
|
*/
|
|
157
|
-
currentResponse?:
|
|
157
|
+
currentResponse?: Response;
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
160
|
* @return True if following redirects is allowed.
|
|
@@ -470,7 +470,7 @@ export abstract class HttpEngine extends EventEmitter {
|
|
|
470
470
|
* @return Redirect response object
|
|
471
471
|
*/
|
|
472
472
|
async _createRedirectResponse(location: string): Promise<ResponseRedirect> {
|
|
473
|
-
const { currentResponse = new
|
|
473
|
+
const { currentResponse = new Response() } = this;
|
|
474
474
|
|
|
475
475
|
const response = HttpResponse.fromValues(
|
|
476
476
|
currentResponse.status,
|
|
@@ -498,7 +498,7 @@ export abstract class HttpEngine extends EventEmitter {
|
|
|
498
498
|
*
|
|
499
499
|
* @return A response object.
|
|
500
500
|
*/
|
|
501
|
-
async _createResponse(): Promise<
|
|
501
|
+
async _createResponse(): Promise<Response | undefined> {
|
|
502
502
|
if (this.aborted) {
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
@@ -513,36 +513,17 @@ It means that the successful connection wasn't made.
|
|
|
513
513
|
Check your request parameters.`);
|
|
514
514
|
}
|
|
515
515
|
const body = await this.decompress(this._rawBody);
|
|
516
|
-
const response =
|
|
516
|
+
const response = Response.fromValues(
|
|
517
517
|
status,
|
|
518
518
|
currentResponse.statusText,
|
|
519
519
|
currentResponse.headers,
|
|
520
520
|
);
|
|
521
521
|
response.timings = this._computeStats(this.stats);
|
|
522
522
|
response.loadingTime = response.timings.total();
|
|
523
|
-
|
|
524
|
-
// const response = /** @type ArcResponse */ ({
|
|
525
|
-
// size: {
|
|
526
|
-
// request: 0,
|
|
527
|
-
// response: 0,
|
|
528
|
-
// },
|
|
529
|
-
// });
|
|
530
|
-
|
|
531
523
|
if (body) {
|
|
532
524
|
await response.writePayload(body);
|
|
533
525
|
currentResponse.payload = response.payload;
|
|
534
526
|
}
|
|
535
|
-
// if (body) {
|
|
536
|
-
// response.payload = body;
|
|
537
|
-
// currentResponse.payload = body;
|
|
538
|
-
// response.size.response = body.length;
|
|
539
|
-
// }
|
|
540
|
-
// if (this.sentRequest.httpMessage) {
|
|
541
|
-
// response.size.request = Buffer.from(this.sentRequest.httpMessage).length;
|
|
542
|
-
// }
|
|
543
|
-
// if (opts.includeRedirects && this.redirects.length) {
|
|
544
|
-
// response.redirects = Array.from(this.redirects);
|
|
545
|
-
// }
|
|
546
527
|
if (status === 401) {
|
|
547
528
|
response.auth = this._getAuth();
|
|
548
529
|
}
|
|
@@ -2,7 +2,7 @@ import { Headers } from '../../lib/headers/Headers.js';
|
|
|
2
2
|
import { IHttpRequest } from '../../models/HttpRequest.js';
|
|
3
3
|
import { INtlmAuthorization, IBasicAuthorization } from '../../models/Authorization.js';
|
|
4
4
|
import { ExecutionContext } from './ModulesRegistry.js';
|
|
5
|
-
import { IRequestAuthorization } from '../../models/RequestAuthorization.js';
|
|
5
|
+
import { IRequestAuthorization, Kind as RequestAuthorizationKind } from '../../models/RequestAuthorization.js';
|
|
6
6
|
|
|
7
7
|
const cache: any = {};
|
|
8
8
|
|
|
@@ -89,16 +89,12 @@ export function applyRequestBasicAuthData(request: IHttpRequest, data: IBasicAut
|
|
|
89
89
|
* but whole NTLM configuration object.
|
|
90
90
|
*
|
|
91
91
|
* Applied the `auth` object to the event's `detail.auth` object.
|
|
92
|
-
*
|
|
93
|
-
* @param {ArcBaseRequest} request The event's detail object. Changes made here will be propagated to
|
|
94
|
-
* the event.
|
|
95
|
-
* @param {NtlmAuthorization} values The authorization data to apply.
|
|
96
92
|
*/
|
|
97
93
|
function applyRequestNtlmAuthData(authorization: IRequestAuthorization[], values: INtlmAuthorization): void {
|
|
98
94
|
let ntlm: IRequestAuthorization | undefined = authorization.find(((method) => method.type === 'ntlm'));
|
|
99
95
|
if (!ntlm) {
|
|
100
96
|
ntlm = {
|
|
101
|
-
kind:
|
|
97
|
+
kind: RequestAuthorizationKind,
|
|
102
98
|
enabled: true,
|
|
103
99
|
type: 'ntlm',
|
|
104
100
|
config: {},
|