@api-client/core 0.3.12 → 0.4.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 +4 -5
- package/build/browser.js +4 -5
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +5 -6
- package/build/index.js +5 -6
- 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/HistoryIndex.d.ts +3 -1
- package/build/src/models/HistoryIndex.js +3 -0
- package/build/src/models/HistoryIndex.js.map +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 +1 -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 +4 -5
- package/build/src/models/HttpProject.js +3 -3
- 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 +6 -8
- package/build/src/models/RequestLog.js +4 -6
- 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/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/StoreSdk.js +4 -2
- package/build/src/runtime/store/StoreSdk.js.map +1 -1
- package/package.json +3 -3
- 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/HistoryIndex.ts +6 -1
- package/src/models/HostRule.ts +5 -5
- package/src/models/HttpHistory.ts +1 -1
- package/src/models/HttpProject.ts +5 -6
- 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 +8 -10
- 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/RequestFactory.ts +3 -3
- package/src/runtime/reporters/ProjectRunCliReporter.ts +2 -2
- package/src/runtime/reporters/Reporter.ts +4 -4
- package/src/runtime/store/StoreSdk.ts +4 -4
- package/build/src/models/ArcResponse.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/src/models/HistoryRequest.ts +0 -28
- package/src/runtime/http-engine/NodeEngine.ts +0 -792
- package/src/runtime/http-engine/NodeEngineDirect.ts +0 -482
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRequestLog, RequestLog, Kind as RequestLogKind } from './RequestLog.js';
|
|
2
2
|
|
|
3
|
-
export const Kind = '
|
|
3
|
+
export const Kind = 'Core#HttpHistory';
|
|
4
4
|
export const createdSymbol = Symbol('created');
|
|
5
5
|
export const midnightSymbol = Symbol('midnight');
|
|
6
6
|
|
|
@@ -14,8 +14,7 @@ import { ARCSavedRequest, ARCHistoryRequest } from './legacy/request/ArcRequest.
|
|
|
14
14
|
import { ArcLegacyProject, ARCProject } from './legacy/models/ArcLegacyProject.js';
|
|
15
15
|
import { PostmanDataTransformer } from './transformers/PostmanDataTransformer.js';
|
|
16
16
|
|
|
17
|
-
export
|
|
18
|
-
export const Kind = 'ARC#HttpProject';
|
|
17
|
+
export const Kind = 'Core#HttpProject';
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* A list of options to initialize a project in various situations.
|
|
@@ -167,12 +166,12 @@ export interface IProjectRequestIterator {
|
|
|
167
166
|
}
|
|
168
167
|
|
|
169
168
|
/**
|
|
170
|
-
* The new definition of a project in
|
|
169
|
+
* The new definition of a project in API Client.
|
|
171
170
|
* Note, this is not the same as future `ApiProject` which is reserved for building APIs
|
|
172
171
|
* using RAML or OAS.
|
|
173
172
|
*/
|
|
174
173
|
export interface IHttpProject extends IProjectDefinitionProperty {
|
|
175
|
-
kind:
|
|
174
|
+
kind: typeof Kind;
|
|
176
175
|
/**
|
|
177
176
|
* The license information for this HTTP project.
|
|
178
177
|
*/
|
|
@@ -340,11 +339,11 @@ export class HttpProject extends ProjectParent {
|
|
|
340
339
|
/**
|
|
341
340
|
* Creates a new project definition clearing anything that is so far defined.
|
|
342
341
|
*
|
|
343
|
-
* Note, this throws an error when the project is not an
|
|
342
|
+
* Note, this throws an error when the project is not an API Client project.
|
|
344
343
|
*/
|
|
345
344
|
new(init: IHttpProject): void {
|
|
346
345
|
if (!init || !init.definitions || !init.items) {
|
|
347
|
-
throw new Error(`Not
|
|
346
|
+
throw new Error(`Not a project.`);
|
|
348
347
|
}
|
|
349
348
|
const { key = v4(), definitions = {}, items, info, license, provider, environments } = init;
|
|
350
349
|
this.key = key;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SerializablePayload } from './SerializablePayload.js';
|
|
2
2
|
import { Payload } from '../lib/transformers/PayloadSerializer.js';
|
|
3
3
|
|
|
4
|
-
export const Kind = '
|
|
4
|
+
export const Kind = 'Core#HttpRequest';
|
|
5
5
|
|
|
6
6
|
export interface IBaseHttpRequest {
|
|
7
7
|
/**
|
|
@@ -85,7 +85,7 @@ export class HttpRequest extends SerializablePayload {
|
|
|
85
85
|
/**
|
|
86
86
|
* Creates a new request clearing anything that is so far defined.
|
|
87
87
|
*
|
|
88
|
-
* Note, this throws an error when the object is not
|
|
88
|
+
* Note, this throws an error when the object is not a request.
|
|
89
89
|
*/
|
|
90
90
|
new(init: IHttpRequest): void {
|
|
91
91
|
const { url, method='GET', headers, payload, kind = Kind } = init;
|
|
@@ -3,7 +3,7 @@ import { Payload, PayloadSerializer } from '../lib/transformers/PayloadSerialize
|
|
|
3
3
|
import { HTTPResponse as LegacyHttpResponse } from './legacy/request/ArcResponse.js';
|
|
4
4
|
import { Normalizer } from './legacy/Normalizer.js';
|
|
5
5
|
|
|
6
|
-
export const Kind = '
|
|
6
|
+
export const Kind = 'Core#HttpResponse';
|
|
7
7
|
|
|
8
8
|
export interface IHttpResponse {
|
|
9
9
|
kind?: string;
|
|
@@ -91,11 +91,11 @@ export class HttpResponse extends SerializablePayload {
|
|
|
91
91
|
/**
|
|
92
92
|
* Creates a new response clearing anything that is so far defined.
|
|
93
93
|
*
|
|
94
|
-
* Note, this throws an error when the object is not
|
|
94
|
+
* Note, this throws an error when the object is not a response.
|
|
95
95
|
*/
|
|
96
96
|
new(init: IHttpResponse): void {
|
|
97
97
|
if (!HttpResponse.isHttpResponse(init)) {
|
|
98
|
-
throw new Error(`Not
|
|
98
|
+
throw new Error(`Not a response.`);
|
|
99
99
|
}
|
|
100
100
|
const { status, statusText, headers, payload, kind=Kind } = init;
|
|
101
101
|
this.kind = kind;
|
package/src/models/License.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const Kind = '
|
|
1
|
+
export const Kind = 'Core#License';
|
|
2
2
|
|
|
3
3
|
export interface ILicense {
|
|
4
|
-
kind:
|
|
4
|
+
kind: typeof Kind;
|
|
5
5
|
/**
|
|
6
6
|
* The URL to the license text.
|
|
7
7
|
* Only `url` or `content` can be used at a time.
|
|
@@ -71,11 +71,11 @@ export class License {
|
|
|
71
71
|
/**
|
|
72
72
|
* Creates a new license clearing anything that is so far defined.
|
|
73
73
|
*
|
|
74
|
-
* Note, this throws an error when the license is not
|
|
74
|
+
* Note, this throws an error when the license is not a license object.
|
|
75
75
|
*/
|
|
76
76
|
new(init: ILicense): void {
|
|
77
77
|
if (!License.isLicense(init)) {
|
|
78
|
-
throw new Error(`Not
|
|
78
|
+
throw new Error(`Not a license.`);
|
|
79
79
|
}
|
|
80
80
|
const { url, content, name } = init;
|
|
81
81
|
this.kind = Kind;
|
|
@@ -6,7 +6,7 @@ import { HttpProject } from './HttpProject.js';
|
|
|
6
6
|
import { IThing, Thing, Kind as ThingKind } from './Thing.js';
|
|
7
7
|
import v4 from '../lib/uuid.js';
|
|
8
8
|
|
|
9
|
-
export const Kind = '
|
|
9
|
+
export const Kind = 'Core#ProjectFolder';
|
|
10
10
|
export const DefaultFolderName = 'New folder';
|
|
11
11
|
|
|
12
12
|
export interface IFolderAddOptions {
|
|
@@ -126,11 +126,11 @@ export class ProjectFolder extends ProjectParent {
|
|
|
126
126
|
/**
|
|
127
127
|
* Creates a new project folder clearing anything that is so far defined.
|
|
128
128
|
*
|
|
129
|
-
* Note, this throws an error when the project folder is not
|
|
129
|
+
* Note, this throws an error when the project folder is not a project folder.
|
|
130
130
|
*/
|
|
131
131
|
new(init: IProjectFolder): void {
|
|
132
132
|
if (!ProjectFolder.isProjectFolder(init)) {
|
|
133
|
-
throw new Error(`Not
|
|
133
|
+
throw new Error(`Not a project folder.`);
|
|
134
134
|
}
|
|
135
135
|
const { key = v4(), created = Date.now(), updated = Date.now(), items, environments, info } = init;
|
|
136
136
|
this.kind = Kind;
|
|
@@ -92,11 +92,11 @@ export class ProjectItem {
|
|
|
92
92
|
/**
|
|
93
93
|
* Creates a new project item clearing anything that is so far defined.
|
|
94
94
|
*
|
|
95
|
-
* Note, this throws an error when the project item is not
|
|
95
|
+
* Note, this throws an error when the project item is not a project item.
|
|
96
96
|
*/
|
|
97
97
|
new(init: IProjectItem): void {
|
|
98
98
|
if (!ProjectItem.isProjectItem(init)) {
|
|
99
|
-
throw new Error(`Not
|
|
99
|
+
throw new Error(`Not a project item.`);
|
|
100
100
|
}
|
|
101
101
|
const { kind, key } = init;
|
|
102
102
|
this.kind = kind;
|
|
@@ -6,10 +6,10 @@ import { HttpProject } from './HttpProject.js';
|
|
|
6
6
|
import v4 from '../lib/uuid.js';
|
|
7
7
|
import { IRequest, Request } from './Request.js';
|
|
8
8
|
|
|
9
|
-
export const Kind = '
|
|
9
|
+
export const Kind = 'Core#ProjectRequest';
|
|
10
10
|
|
|
11
11
|
export interface IProjectRequest extends IProjectDefinitionProperty, IRequest {
|
|
12
|
-
kind:
|
|
12
|
+
kind: typeof Kind;
|
|
13
13
|
/**
|
|
14
14
|
* The identifier of the request.
|
|
15
15
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import v4 from '../lib/uuid.js';
|
|
2
2
|
import { Property, IProperty, PropertyType, Kind as PropertyKind } from './Property.js';
|
|
3
|
-
export const Kind = '
|
|
3
|
+
export const Kind = 'Core#ProjectSchema';
|
|
4
4
|
|
|
5
5
|
export interface IProjectSchema {
|
|
6
|
-
kind?:
|
|
6
|
+
kind?: typeof Kind;
|
|
7
7
|
/**
|
|
8
8
|
* The identifier of the environment.
|
|
9
9
|
*/
|
package/src/models/Property.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ApiType } from './legacy/models/ApiTypes.js';
|
|
|
3
3
|
export type PropertyType = 'string' | 'integer' | 'float' | 'nil' | 'boolean' | 'date' | 'datetime' | 'time' | 'int32' | 'int64' | 'uint32' | 'uint64' | 'sint32' | 'sint64' | 'fixed32' | 'fixed64' | 'sfixed32' | 'sfixed64' | 'double' | 'bytes';
|
|
4
4
|
|
|
5
5
|
export interface IProperty {
|
|
6
|
-
kind:
|
|
6
|
+
kind: typeof Kind;
|
|
7
7
|
/**
|
|
8
8
|
* Property name
|
|
9
9
|
*/
|
|
@@ -42,7 +42,7 @@ export interface IProperty {
|
|
|
42
42
|
repeated?: boolean;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export const Kind = '
|
|
45
|
+
export const Kind = 'Core#Property';
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* A property of an HTTP request.
|
|
@@ -358,13 +358,13 @@ export class Property {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
/**
|
|
361
|
-
* Creates a new
|
|
361
|
+
* Creates a new property.
|
|
362
362
|
*
|
|
363
|
-
* Note, this throws an error when the property is not
|
|
363
|
+
* Note, this throws an error when the property is not a property.
|
|
364
364
|
*/
|
|
365
365
|
new(init: IProperty): void {
|
|
366
366
|
if (!Property.isProperty(init)) {
|
|
367
|
-
throw new Error(`Not
|
|
367
|
+
throw new Error(`Not a property.`);
|
|
368
368
|
}
|
|
369
369
|
const { name, value, default: defaultValue, description, enabled, enum: enumValue, required, type, repeated } = init;
|
|
370
370
|
this.kind = Kind;
|
package/src/models/Provider.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare interface IProvider {
|
|
|
5
5
|
/**
|
|
6
6
|
* The data kind. The application ignores the input with an unknown `kind`, unless it can be determined from the context.
|
|
7
7
|
*/
|
|
8
|
-
kind:
|
|
8
|
+
kind: typeof Kind;
|
|
9
9
|
/**
|
|
10
10
|
* The URL to the provider
|
|
11
11
|
*/
|
|
@@ -20,7 +20,7 @@ export declare interface IProvider {
|
|
|
20
20
|
email?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const Kind = '
|
|
23
|
+
export const Kind = 'Core#Provider';
|
|
24
24
|
|
|
25
25
|
export class Provider {
|
|
26
26
|
kind = Kind;
|
|
@@ -56,11 +56,11 @@ export class Provider {
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates a new provider clearing anything that is so far defined.
|
|
58
58
|
*
|
|
59
|
-
* Note, this throws an error when the provider is not
|
|
59
|
+
* Note, this throws an error when the provider is not a provider object.
|
|
60
60
|
*/
|
|
61
61
|
new(init: IProvider): void {
|
|
62
62
|
if (!Provider.isProvider(init)) {
|
|
63
|
-
throw new Error(`Not
|
|
63
|
+
throw new Error(`Not a provider.`);
|
|
64
64
|
}
|
|
65
65
|
const { url, email, name } = init;
|
|
66
66
|
this.kind = Kind;
|
package/src/models/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# API Client
|
|
1
|
+
# API Client models
|
|
2
2
|
|
|
3
3
|
## Principles for designing a data model
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ We aim to be interoperable with AMF so when designing a data model first design
|
|
|
13
13
|
|
|
14
14
|
### The "kind" as the object type identifier
|
|
15
15
|
|
|
16
|
-
Each data object that can exist by itself or in multiple contexts' should contain the `kind` property that uniquely identifies the type. For example, the `HttpProject` class has the `
|
|
16
|
+
Each data object that can exist by itself or in multiple contexts' should contain the `kind` property that uniquely identifies the type. For example, the `HttpProject` class has the `Core#HttpProject`. These kinds are used by other libraries to identify which data types they are given as the input.
|
|
17
17
|
|
|
18
18
|
### Validation
|
|
19
19
|
|
package/src/models/Request.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { IRequestAuthorization, RequestAuthorization } from './RequestAuthorizat
|
|
|
6
6
|
import { IRequestLog, RequestLog, Kind as LogKind } from './RequestLog.js';
|
|
7
7
|
import { SentRequest } from './SentRequest.js';
|
|
8
8
|
import { ErrorResponse } from './ErrorResponse.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Response } from './Response.js';
|
|
10
10
|
import { RequestsSize } from './RequestsSize.js';
|
|
11
11
|
import { IHttpRequest, HttpRequest, Kind as HttpRequestKind } from './HttpRequest.js';
|
|
12
12
|
import { ARCSavedRequest, ARCHistoryRequest } from './legacy/request/ArcRequest.js';
|
|
@@ -14,13 +14,13 @@ import { ErrorResponse as LegacyErrorResponse, Response as LegacyResponse } from
|
|
|
14
14
|
import { PayloadSerializer } from '../lib/transformers/PayloadSerializer.js';
|
|
15
15
|
import { Normalizer } from './legacy/Normalizer.js';
|
|
16
16
|
|
|
17
|
-
export const Kind = '
|
|
17
|
+
export const Kind = 'Core#Request';
|
|
18
18
|
export const createdSymbol = Symbol('created');
|
|
19
19
|
export const updatedSymbol = Symbol('updated');
|
|
20
20
|
export const midnightSymbol = Symbol('midnight');
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* The definition of a request object that functions inside
|
|
23
|
+
* The definition of a request object that functions inside API Client
|
|
24
24
|
* with the full configuration.
|
|
25
25
|
*/
|
|
26
26
|
export interface IRequest {
|
|
@@ -228,7 +228,7 @@ export class Request {
|
|
|
228
228
|
log.response = await ErrorResponse.fromLegacy(typedError);
|
|
229
229
|
} else {
|
|
230
230
|
const typedResponse = normalized.response as LegacyResponse;
|
|
231
|
-
log.response = await
|
|
231
|
+
log.response = await Response.fromLegacy(typedResponse);
|
|
232
232
|
if (Array.isArray(typedResponse.redirects) && typedResponse.redirects.length) {
|
|
233
233
|
const promises = typedResponse.redirects.map((redirect) => log.addLegacyRedirect(redirect));
|
|
234
234
|
await Promise.allSettled(promises);
|
|
@@ -55,7 +55,7 @@ export class RequestActions {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* @param input The
|
|
58
|
+
* @param input The request actions definition used to restore the state.
|
|
59
59
|
*/
|
|
60
60
|
constructor(input?: string | IRequestActions) {
|
|
61
61
|
let init: IRequestActions;
|
|
@@ -70,9 +70,7 @@ export class RequestActions {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Creates a new
|
|
74
|
-
*
|
|
75
|
-
* Note, this throws an error when the provider is not an ARC provider object.
|
|
73
|
+
* Creates a new request actions clearing anything that is so far defined.
|
|
76
74
|
*/
|
|
77
75
|
new(init: IRequestActions): void {
|
|
78
76
|
const { request, response } = init;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IAuthorizationSettingsUnion, AuthorizationType } from './Authorization.js';
|
|
2
2
|
import { RequestAuthorization as LegacyAuthorization } from './legacy/request/ArcRequest.js';
|
|
3
3
|
|
|
4
|
-
export const Kind = '
|
|
4
|
+
export const Kind = 'Core#RequestAuthorization';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Authorization configuration for the request.
|
|
8
8
|
*/
|
|
9
9
|
export interface IRequestAuthorization {
|
|
10
|
-
kind:
|
|
10
|
+
kind: typeof Kind;
|
|
11
11
|
/**
|
|
12
12
|
* Authorization configuration
|
|
13
13
|
*/
|
|
@@ -89,9 +89,7 @@ export class RequestAuthorization {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* Creates a new
|
|
93
|
-
*
|
|
94
|
-
* Note, this throws an error when the provider is not an ARC provider object.
|
|
92
|
+
* Creates a new request authorization clearing anything that is so far defined.
|
|
95
93
|
*/
|
|
96
94
|
new(init: IRequestAuthorization): void {
|
|
97
95
|
const { config, type, enabled, valid } = init;
|
|
@@ -2,7 +2,7 @@ import { IHostRule, HostRule } from './HostRule.js';
|
|
|
2
2
|
import { IProperty, Property } from './Property.js';
|
|
3
3
|
import { RequestConfig as LegacyConfig } from './legacy/request/ArcRequest.js';
|
|
4
4
|
|
|
5
|
-
export const Kind = '
|
|
5
|
+
export const Kind = 'Core#RequestConfig';
|
|
6
6
|
|
|
7
7
|
export interface IRequestBaseConfig {
|
|
8
8
|
/**
|
|
@@ -62,10 +62,10 @@ export interface IRequestBaseConfig {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* API Client request `config` object.
|
|
66
66
|
*/
|
|
67
67
|
export interface IRequestConfig extends IRequestBaseConfig {
|
|
68
|
-
kind:
|
|
68
|
+
kind: typeof Kind;
|
|
69
69
|
/**
|
|
70
70
|
* Whether the processor should use this configuration.
|
|
71
71
|
*/
|
|
@@ -205,8 +205,6 @@ export class RequestConfig {
|
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
* Creates a new request configuration clearing anything that is so far defined.
|
|
208
|
-
*
|
|
209
|
-
* Note, this throws an error when the object is not an ARC request configuration.
|
|
210
208
|
*/
|
|
211
209
|
new(init: IRequestConfig): void {
|
|
212
210
|
const {
|
package/src/models/RequestLog.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { IResponseRedirect, ResponseRedirect } from './ResponseRedirect.js';
|
|
2
2
|
import { ISentRequest, SentRequest } from './SentRequest.js';
|
|
3
3
|
import { IErrorResponse, ErrorResponse } from './ErrorResponse.js';
|
|
4
|
-
import {
|
|
4
|
+
import { IResponse, Response } from './Response.js';
|
|
5
5
|
import { IRequestsSize, RequestsSize } from './RequestsSize.js';
|
|
6
6
|
import { ResponseRedirect as LegacyRedirect } from './legacy/request/ArcResponse.js';
|
|
7
7
|
|
|
8
|
-
export const Kind = '
|
|
8
|
+
export const Kind = 'Core#ResponseLog';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Describes a request / response pair associated with a request.
|
|
12
12
|
*/
|
|
13
13
|
export interface IRequestLog {
|
|
14
|
-
kind:
|
|
14
|
+
kind: typeof Kind;
|
|
15
15
|
/**
|
|
16
16
|
* Describes an HTTP request sent by the transport.
|
|
17
17
|
*/
|
|
@@ -19,7 +19,7 @@ export interface IRequestLog {
|
|
|
19
19
|
/**
|
|
20
20
|
* The last response made with this request, if any.
|
|
21
21
|
*/
|
|
22
|
-
response?:
|
|
22
|
+
response?: IResponse | IErrorResponse;
|
|
23
23
|
/**
|
|
24
24
|
* The list of redirects, if any.
|
|
25
25
|
*/
|
|
@@ -42,7 +42,7 @@ export class RequestLog {
|
|
|
42
42
|
/**
|
|
43
43
|
* The last response made with this request, if any.
|
|
44
44
|
*/
|
|
45
|
-
response?:
|
|
45
|
+
response?: Response | ErrorResponse;
|
|
46
46
|
/**
|
|
47
47
|
* The list of redirects, if any.
|
|
48
48
|
*/
|
|
@@ -59,7 +59,7 @@ export class RequestLog {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
static fromRequestResponse(request: ISentRequest, response:
|
|
62
|
+
static fromRequestResponse(request: ISentRequest, response: IResponse | IErrorResponse): RequestLog {
|
|
63
63
|
return new RequestLog({
|
|
64
64
|
kind: Kind,
|
|
65
65
|
request,
|
|
@@ -86,8 +86,6 @@ export class RequestLog {
|
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Creates a new response clearing anything that is so far defined.
|
|
89
|
-
*
|
|
90
|
-
* Note, this throws an error when the object is not an ARC response.
|
|
91
89
|
*/
|
|
92
90
|
new(init: IRequestLog): void {
|
|
93
91
|
const { request, response, redirects, size } = init;
|
|
@@ -96,10 +94,10 @@ export class RequestLog {
|
|
|
96
94
|
this.request = new SentRequest(request);
|
|
97
95
|
}
|
|
98
96
|
if (response) {
|
|
99
|
-
if (
|
|
97
|
+
if (Response.isErrorResponse(response)) {
|
|
100
98
|
this.response = new ErrorResponse(response as IErrorResponse);
|
|
101
99
|
} else {
|
|
102
|
-
this.response = new
|
|
100
|
+
this.response = new Response(response as IResponse);
|
|
103
101
|
}
|
|
104
102
|
} else {
|
|
105
103
|
this.response = undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export const Kind = '
|
|
1
|
+
export const Kind = 'Core#RequestTime';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Schema definition for
|
|
4
|
+
* Schema definition for API Client request timings. This is mostly consistent with HAR timings.
|
|
5
5
|
*/
|
|
6
6
|
export interface IRequestTime {
|
|
7
|
-
kind?:
|
|
7
|
+
kind?: typeof Kind;
|
|
8
8
|
connect: number;
|
|
9
9
|
receive: number;
|
|
10
10
|
send: number;
|
|
@@ -48,9 +48,7 @@ export class RequestTime {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* Creates a new
|
|
52
|
-
*
|
|
53
|
-
* Note, this throws an error when the server is not an ARC thing.
|
|
51
|
+
* Creates a new timing clearing anything that is so far defined.
|
|
54
52
|
*/
|
|
55
53
|
new(init: IRequestTime): void {
|
|
56
54
|
const { connect=-1, receive=-1, send=-1, wait=-1, blocked=-1, dns=-1, ssl=-1 } = init;
|
|
@@ -2,7 +2,7 @@ import { IProperty, Property } from './Property.js';
|
|
|
2
2
|
import { IMultipartBody } from '../lib/transformers/PayloadSerializer.js';
|
|
3
3
|
import { RequestUiMeta as LegacyRequestUiMeta } from './legacy/request/ArcRequest.js';
|
|
4
4
|
|
|
5
|
-
export const Kind = '
|
|
5
|
+
export const Kind = 'Core#RequestUiMeta';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* URL editor meta data.
|
|
@@ -41,7 +41,7 @@ export interface IAuthMeta {
|
|
|
41
41
|
|
|
42
42
|
export interface IActionsMeta {
|
|
43
43
|
/**
|
|
44
|
-
* The index of the selected
|
|
44
|
+
* The index of the selected API Client actions view.
|
|
45
45
|
*/
|
|
46
46
|
selected?: number;
|
|
47
47
|
}
|
|
@@ -64,7 +64,7 @@ export interface IResponseUiMeta {
|
|
|
64
64
|
*/
|
|
65
65
|
export interface IBodyMetaModel {
|
|
66
66
|
/**
|
|
67
|
-
* The id of the editor. Each editor in
|
|
67
|
+
* The id of the editor. Each editor in API Client has own id.
|
|
68
68
|
*/
|
|
69
69
|
type: string;
|
|
70
70
|
/**
|
|
@@ -124,7 +124,7 @@ export interface IRequestUiMeta {
|
|
|
124
124
|
*/
|
|
125
125
|
authorization?: IAuthMeta;
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
127
|
+
* API Client request actions editor UI config.
|
|
128
128
|
*/
|
|
129
129
|
actions?: IActionsMeta;
|
|
130
130
|
/**
|
|
@@ -156,7 +156,7 @@ export class RequestUiMeta {
|
|
|
156
156
|
*/
|
|
157
157
|
authorization?: IAuthMeta;
|
|
158
158
|
/**
|
|
159
|
-
*
|
|
159
|
+
* API Client request actions editor UI config.
|
|
160
160
|
*/
|
|
161
161
|
actions?: IActionsMeta;
|
|
162
162
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const Kind = '
|
|
1
|
+
export const Kind = 'Core#ResponseSize';
|
|
2
2
|
|
|
3
3
|
export interface IRequestsSize {
|
|
4
4
|
kind?: typeof Kind;
|
|
@@ -44,8 +44,6 @@ export class RequestsSize {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Creates a new response size clearing anything that is so far defined.
|
|
47
|
-
*
|
|
48
|
-
* Note, this throws an error when the object is not an ARC response size.
|
|
49
47
|
*/
|
|
50
48
|
new(init: IRequestsSize): void {
|
|
51
49
|
const { request, response } = init;
|
|
@@ -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;
|