@se-uulm/snowballr-api-client 0.2.1-alpha.07cd30f → 0.2.1-alpha.08a35a4
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/.openapi-generator/FILES +7 -0
- package/.openapi-generator/VERSION +1 -1
- package/README.md +102 -28
- package/dist/apis/ProjectsControllerApi.d.ts +54 -1
- package/dist/apis/ProjectsControllerApi.js +56 -19
- package/dist/esm/apis/ProjectsControllerApi.d.ts +54 -1
- package/dist/esm/apis/ProjectsControllerApi.js +52 -15
- package/dist/esm/models/CreateProjectRequest.d.ts +0 -2
- package/dist/esm/models/DecisionMatrixPattern.d.ts +0 -4
- package/dist/esm/models/DecisionMatrixPattern.js +1 -1
- package/dist/esm/models/DecisionMatrixPatternEntry.d.ts +0 -4
- package/dist/esm/models/DecisionMatrixPatternEntry.js +1 -1
- package/dist/esm/models/Project.d.ts +0 -14
- package/dist/esm/models/Project.js +4 -3
- package/dist/esm/models/ProjectSettings.d.ts +0 -10
- package/dist/esm/models/ProjectSettings.js +1 -1
- package/dist/esm/models/ReviewDecisionMatrix.d.ts +0 -4
- package/dist/esm/runtime.d.ts +34 -1
- package/dist/esm/runtime.js +130 -4
- package/dist/models/CreateProjectRequest.d.ts +0 -2
- package/dist/models/DecisionMatrixPattern.d.ts +0 -4
- package/dist/models/DecisionMatrixPattern.js +1 -1
- package/dist/models/DecisionMatrixPatternEntry.d.ts +0 -4
- package/dist/models/DecisionMatrixPatternEntry.js +1 -1
- package/dist/models/Project.d.ts +0 -14
- package/dist/models/Project.js +4 -3
- package/dist/models/ProjectSettings.d.ts +0 -10
- package/dist/models/ProjectSettings.js +1 -1
- package/dist/models/ReviewDecisionMatrix.d.ts +0 -4
- package/dist/runtime.d.ts +34 -1
- package/dist/runtime.js +136 -4
- package/docs/CreateProjectRequest.md +34 -0
- package/docs/DecisionMatrixPattern.md +36 -0
- package/docs/DecisionMatrixPatternEntry.md +36 -0
- package/docs/Project.md +46 -0
- package/docs/ProjectSettings.md +42 -0
- package/docs/ProjectsControllerApi.md +264 -0
- package/docs/ReviewDecisionMatrix.md +36 -0
- package/package.json +2 -2
- package/src/apis/ProjectsControllerApi.ts +91 -20
- package/src/models/CreateProjectRequest.ts +0 -2
- package/src/models/DecisionMatrixPattern.ts +1 -5
- package/src/models/DecisionMatrixPatternEntry.ts +1 -5
- package/src/models/Project.ts +4 -18
- package/src/models/ProjectSettings.ts +1 -11
- package/src/models/ReviewDecisionMatrix.ts +0 -4
- package/src/runtime.ts +146 -6
- package/tsconfig.json +1 -1
|
@@ -21,14 +21,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
import * as runtime from '../runtime';
|
|
24
|
-
import { CreateProjectRequestToJSON,
|
|
24
|
+
import { CreateProjectRequestToJSON, } from '../models/CreateProjectRequest';
|
|
25
|
+
import { ProjectFromJSON, } from '../models/Project';
|
|
25
26
|
/**
|
|
26
27
|
*
|
|
27
28
|
*/
|
|
28
29
|
export class ProjectsControllerApi extends runtime.BaseAPI {
|
|
29
30
|
/**
|
|
31
|
+
* Creates request options for createProject without sending the request
|
|
30
32
|
*/
|
|
31
|
-
|
|
33
|
+
createProjectRequestOpts(requestParameters) {
|
|
32
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
35
|
if (requestParameters['createProjectRequest'] == null) {
|
|
34
36
|
throw new runtime.RequiredError('createProjectRequest', 'Required parameter "createProjectRequest" was null or undefined when calling createProject().');
|
|
@@ -37,13 +39,21 @@ export class ProjectsControllerApi extends runtime.BaseAPI {
|
|
|
37
39
|
const headerParameters = {};
|
|
38
40
|
headerParameters['Content-Type'] = 'application/json';
|
|
39
41
|
let urlPath = `/projects`;
|
|
40
|
-
|
|
42
|
+
return {
|
|
41
43
|
path: urlPath,
|
|
42
44
|
method: 'POST',
|
|
43
45
|
headers: headerParameters,
|
|
44
46
|
query: queryParameters,
|
|
45
47
|
body: CreateProjectRequestToJSON(requestParameters['createProjectRequest']),
|
|
46
|
-
}
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
*/
|
|
53
|
+
createProjectRaw(requestParameters, initOverrides) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const requestOptions = yield this.createProjectRequestOpts(requestParameters);
|
|
56
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
47
57
|
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue));
|
|
48
58
|
});
|
|
49
59
|
}
|
|
@@ -56,8 +66,9 @@ export class ProjectsControllerApi extends runtime.BaseAPI {
|
|
|
56
66
|
});
|
|
57
67
|
}
|
|
58
68
|
/**
|
|
69
|
+
* Creates request options for deleteProject without sending the request
|
|
59
70
|
*/
|
|
60
|
-
|
|
71
|
+
deleteProjectRequestOpts(requestParameters) {
|
|
61
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
73
|
if (requestParameters['id'] == null) {
|
|
63
74
|
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteProject().');
|
|
@@ -65,13 +76,21 @@ export class ProjectsControllerApi extends runtime.BaseAPI {
|
|
|
65
76
|
const queryParameters = {};
|
|
66
77
|
const headerParameters = {};
|
|
67
78
|
let urlPath = `/projects/{id}`;
|
|
68
|
-
urlPath = urlPath.replace(
|
|
69
|
-
|
|
79
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
80
|
+
return {
|
|
70
81
|
path: urlPath,
|
|
71
82
|
method: 'DELETE',
|
|
72
83
|
headers: headerParameters,
|
|
73
84
|
query: queryParameters,
|
|
74
|
-
}
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
*/
|
|
90
|
+
deleteProjectRaw(requestParameters, initOverrides) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const requestOptions = yield this.deleteProjectRequestOpts(requestParameters);
|
|
93
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
75
94
|
return new runtime.VoidApiResponse(response);
|
|
76
95
|
});
|
|
77
96
|
}
|
|
@@ -83,18 +102,27 @@ export class ProjectsControllerApi extends runtime.BaseAPI {
|
|
|
83
102
|
});
|
|
84
103
|
}
|
|
85
104
|
/**
|
|
105
|
+
* Creates request options for getAllProjects without sending the request
|
|
86
106
|
*/
|
|
87
|
-
|
|
107
|
+
getAllProjectsRequestOpts() {
|
|
88
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
109
|
const queryParameters = {};
|
|
90
110
|
const headerParameters = {};
|
|
91
111
|
let urlPath = `/projects`;
|
|
92
|
-
|
|
112
|
+
return {
|
|
93
113
|
path: urlPath,
|
|
94
114
|
method: 'GET',
|
|
95
115
|
headers: headerParameters,
|
|
96
116
|
query: queryParameters,
|
|
97
|
-
}
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
*/
|
|
122
|
+
getAllProjectsRaw(initOverrides) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const requestOptions = yield this.getAllProjectsRequestOpts();
|
|
125
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
98
126
|
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ProjectFromJSON));
|
|
99
127
|
});
|
|
100
128
|
}
|
|
@@ -107,8 +135,9 @@ export class ProjectsControllerApi extends runtime.BaseAPI {
|
|
|
107
135
|
});
|
|
108
136
|
}
|
|
109
137
|
/**
|
|
138
|
+
* Creates request options for getProject without sending the request
|
|
110
139
|
*/
|
|
111
|
-
|
|
140
|
+
getProjectRequestOpts(requestParameters) {
|
|
112
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
142
|
if (requestParameters['id'] == null) {
|
|
114
143
|
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getProject().');
|
|
@@ -116,13 +145,21 @@ export class ProjectsControllerApi extends runtime.BaseAPI {
|
|
|
116
145
|
const queryParameters = {};
|
|
117
146
|
const headerParameters = {};
|
|
118
147
|
let urlPath = `/projects/{id}`;
|
|
119
|
-
urlPath = urlPath.replace(
|
|
120
|
-
|
|
148
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
149
|
+
return {
|
|
121
150
|
path: urlPath,
|
|
122
151
|
method: 'GET',
|
|
123
152
|
headers: headerParameters,
|
|
124
153
|
query: queryParameters,
|
|
125
|
-
}
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
*/
|
|
159
|
+
getProjectRaw(requestParameters, initOverrides) {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const requestOptions = yield this.getProjectRequestOpts(requestParameters);
|
|
162
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
126
163
|
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue));
|
|
127
164
|
});
|
|
128
165
|
}
|
|
@@ -18,14 +18,10 @@ import type { DecisionMatrixPatternEntry } from './DecisionMatrixPatternEntry';
|
|
|
18
18
|
export interface DecisionMatrixPattern {
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @type {string}
|
|
22
|
-
* @memberof DecisionMatrixPattern
|
|
23
21
|
*/
|
|
24
22
|
decision?: DecisionMatrixPatternDecisionEnum;
|
|
25
23
|
/**
|
|
26
24
|
*
|
|
27
|
-
* @type {Array<DecisionMatrixPatternEntry>}
|
|
28
|
-
* @memberof DecisionMatrixPattern
|
|
29
25
|
*/
|
|
30
26
|
entries?: Array<DecisionMatrixPatternEntry>;
|
|
31
27
|
}
|
|
@@ -19,7 +19,7 @@ export const DecisionMatrixPatternDecisionEnum = {
|
|
|
19
19
|
UNREVIEWED: 'UNREVIEWED',
|
|
20
20
|
IN_REVIEW: 'IN_REVIEW',
|
|
21
21
|
DECLINED: 'DECLINED',
|
|
22
|
-
ACCEPTED: 'ACCEPTED'
|
|
22
|
+
ACCEPTED: 'ACCEPTED',
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* Check if a given object implements the DecisionMatrixPattern interface.
|
|
@@ -17,14 +17,10 @@
|
|
|
17
17
|
export interface DecisionMatrixPatternEntry {
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof DecisionMatrixPatternEntry
|
|
22
20
|
*/
|
|
23
21
|
decision?: DecisionMatrixPatternEntryDecisionEnum;
|
|
24
22
|
/**
|
|
25
23
|
*
|
|
26
|
-
* @type {number}
|
|
27
|
-
* @memberof DecisionMatrixPatternEntry
|
|
28
24
|
*/
|
|
29
25
|
count?: number;
|
|
30
26
|
}
|
|
@@ -18,44 +18,30 @@ import type { ProjectSettings } from './ProjectSettings';
|
|
|
18
18
|
export interface Project {
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @type {string}
|
|
22
|
-
* @memberof Project
|
|
23
21
|
*/
|
|
24
22
|
id?: string;
|
|
25
23
|
/**
|
|
26
24
|
*
|
|
27
|
-
* @type {string}
|
|
28
|
-
* @memberof Project
|
|
29
25
|
*/
|
|
30
26
|
name?: string;
|
|
31
27
|
/**
|
|
32
28
|
*
|
|
33
|
-
* @type {string}
|
|
34
|
-
* @memberof Project
|
|
35
29
|
*/
|
|
36
30
|
status?: ProjectStatusEnum;
|
|
37
31
|
/**
|
|
38
32
|
*
|
|
39
|
-
* @type {number}
|
|
40
|
-
* @memberof Project
|
|
41
33
|
*/
|
|
42
34
|
currentStage?: number;
|
|
43
35
|
/**
|
|
44
36
|
*
|
|
45
|
-
* @type {number}
|
|
46
|
-
* @memberof Project
|
|
47
37
|
*/
|
|
48
38
|
maxStage?: number;
|
|
49
39
|
/**
|
|
50
40
|
*
|
|
51
|
-
* @type {Date}
|
|
52
|
-
* @memberof Project
|
|
53
41
|
*/
|
|
54
42
|
currentStageStartedAt?: Date;
|
|
55
43
|
/**
|
|
56
44
|
*
|
|
57
|
-
* @type {ProjectSettings}
|
|
58
|
-
* @memberof Project
|
|
59
45
|
*/
|
|
60
46
|
settings?: ProjectSettings;
|
|
61
47
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* https://openapi-generator.tech
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
|
+
import { parseDateTime, serializeDateTime } from '../runtime';
|
|
14
15
|
import { ProjectSettingsFromJSON, ProjectSettingsToJSON, } from './ProjectSettings';
|
|
15
16
|
/**
|
|
16
17
|
* @export
|
|
@@ -20,7 +21,7 @@ export const ProjectStatusEnum = {
|
|
|
20
21
|
ACTIVE_LOCKED: 'ACTIVE_LOCKED',
|
|
21
22
|
ARCHIVED: 'ARCHIVED',
|
|
22
23
|
DELETED: 'DELETED',
|
|
23
|
-
CLEARED: 'CLEARED'
|
|
24
|
+
CLEARED: 'CLEARED',
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
27
|
* Check if a given object implements the Project interface.
|
|
@@ -41,7 +42,7 @@ export function ProjectFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
41
42
|
'status': json['status'] == null ? undefined : json['status'],
|
|
42
43
|
'currentStage': json['currentStage'] == null ? undefined : json['currentStage'],
|
|
43
44
|
'maxStage': json['maxStage'] == null ? undefined : json['maxStage'],
|
|
44
|
-
'currentStageStartedAt': json['currentStageStartedAt'] == null ? undefined : (
|
|
45
|
+
'currentStageStartedAt': json['currentStageStartedAt'] == null ? undefined : (parseDateTime(json['currentStageStartedAt'])),
|
|
45
46
|
'settings': json['settings'] == null ? undefined : ProjectSettingsFromJSON(json['settings']),
|
|
46
47
|
};
|
|
47
48
|
}
|
|
@@ -58,7 +59,7 @@ export function ProjectToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
58
59
|
'status': value['status'],
|
|
59
60
|
'currentStage': value['currentStage'],
|
|
60
61
|
'maxStage': value['maxStage'],
|
|
61
|
-
'currentStageStartedAt': value['currentStageStartedAt'] == null ?
|
|
62
|
+
'currentStageStartedAt': value['currentStageStartedAt'] == null ? value['currentStageStartedAt'] : serializeDateTime(value['currentStageStartedAt']),
|
|
62
63
|
'settings': ProjectSettingsToJSON(value['settings']),
|
|
63
64
|
};
|
|
64
65
|
}
|
|
@@ -18,32 +18,22 @@ import type { ReviewDecisionMatrix } from './ReviewDecisionMatrix';
|
|
|
18
18
|
export interface ProjectSettings {
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @type {number}
|
|
22
|
-
* @memberof ProjectSettings
|
|
23
21
|
*/
|
|
24
22
|
similarityThreshold?: number;
|
|
25
23
|
/**
|
|
26
24
|
*
|
|
27
|
-
* @type {string}
|
|
28
|
-
* @memberof ProjectSettings
|
|
29
25
|
*/
|
|
30
26
|
snowballingType?: ProjectSettingsSnowballingTypeEnum;
|
|
31
27
|
/**
|
|
32
28
|
*
|
|
33
|
-
* @type {boolean}
|
|
34
|
-
* @memberof ProjectSettings
|
|
35
29
|
*/
|
|
36
30
|
reviewMaybeAllowed?: boolean;
|
|
37
31
|
/**
|
|
38
32
|
*
|
|
39
|
-
* @type {ReviewDecisionMatrix}
|
|
40
|
-
* @memberof ProjectSettings
|
|
41
33
|
*/
|
|
42
34
|
reviewDecisionMatrix?: ReviewDecisionMatrix;
|
|
43
35
|
/**
|
|
44
36
|
*
|
|
45
|
-
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
46
|
-
* @memberof ProjectSettings
|
|
47
37
|
*/
|
|
48
38
|
fetchers?: {
|
|
49
39
|
[key: string]: {
|
|
@@ -18,7 +18,7 @@ import { ReviewDecisionMatrixFromJSON, ReviewDecisionMatrixToJSON, } from './Rev
|
|
|
18
18
|
export const ProjectSettingsSnowballingTypeEnum = {
|
|
19
19
|
FORWARD: 'FORWARD',
|
|
20
20
|
BACKWARD: 'BACKWARD',
|
|
21
|
-
BOTH: 'BOTH'
|
|
21
|
+
BOTH: 'BOTH',
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Check if a given object implements the ProjectSettings interface.
|
|
@@ -18,14 +18,10 @@ import type { DecisionMatrixPattern } from './DecisionMatrixPattern';
|
|
|
18
18
|
export interface ReviewDecisionMatrix {
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @type {number}
|
|
22
|
-
* @memberof ReviewDecisionMatrix
|
|
23
21
|
*/
|
|
24
22
|
numberOfReviewers?: number;
|
|
25
23
|
/**
|
|
26
24
|
*
|
|
27
|
-
* @type {Array<DecisionMatrixPattern>}
|
|
28
|
-
* @memberof ReviewDecisionMatrix
|
|
29
25
|
*/
|
|
30
26
|
patterns?: Array<DecisionMatrixPattern>;
|
|
31
27
|
}
|
package/dist/esm/runtime.d.ts
CHANGED
|
@@ -124,9 +124,21 @@ export interface RequestOpts {
|
|
|
124
124
|
}
|
|
125
125
|
export declare function querystring(params: HTTPQuery, prefix?: string): string;
|
|
126
126
|
export declare function exists(json: any, key: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Every generated date call site routes through these.
|
|
129
|
+
*
|
|
130
|
+
* `format: date` is a calendar date, with no time and no offset, so it is converted
|
|
131
|
+
* against the local calendar on both ends: they have to agree or the date shifts by
|
|
132
|
+
* a day. `format: date-time` is an instant and uses UTC.
|
|
133
|
+
*/
|
|
134
|
+
export declare function serializeDateTime(value: Date): string;
|
|
135
|
+
export declare function serializeDate(value: Date): string;
|
|
136
|
+
export declare function parseDate(value: Date | string): Date;
|
|
137
|
+
export declare function parseDateTime(value: any): Date;
|
|
127
138
|
export declare function mapValues(data: any, fn: (item: any) => any): {
|
|
128
139
|
[key: string]: any;
|
|
129
140
|
};
|
|
141
|
+
export declare function anyToJSON(value: any): any;
|
|
130
142
|
export declare function canConsumeForm(consumes: Consume[]): boolean;
|
|
131
143
|
export interface Consume {
|
|
132
144
|
contentType: string;
|
|
@@ -172,11 +184,32 @@ export declare class VoidApiResponse {
|
|
|
172
184
|
constructor(raw: Response);
|
|
173
185
|
value(): Promise<void>;
|
|
174
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* A Blob carrying the file name the server advertised, empty when it did not send one. It is a File
|
|
189
|
+
* wherever one can be built, and the bare Blob given a name otherwise. Same name and shape as the
|
|
190
|
+
* `typescript` generator's browser HttpFile.
|
|
191
|
+
*/
|
|
192
|
+
export type HttpFile = Blob & {
|
|
193
|
+
readonly name: string;
|
|
194
|
+
};
|
|
175
195
|
export declare class BlobApiResponse {
|
|
176
196
|
raw: Response;
|
|
177
197
|
constructor(raw: Response);
|
|
178
|
-
|
|
198
|
+
/**
|
|
199
|
+
* The body named after the Content-Disposition header, so that a download keeps the name the
|
|
200
|
+
* server gave it. A File is built from a native Blob; the Blob itself is named where there is no
|
|
201
|
+
* global File (Node.js before 20), where File cannot be constructed, or where the Blob is not the
|
|
202
|
+
* native one, as returned by an injected fetch implementation such as node-fetch, which a File
|
|
203
|
+
* would stringify instead of wrapping.
|
|
204
|
+
*/
|
|
205
|
+
value(): Promise<HttpFile>;
|
|
179
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
|
|
209
|
+
* `filename*` parameter first, falling back to the plain `filename` when it is malformed, not UTF-8
|
|
210
|
+
* or has no usable name. Any directory part is dropped; undefined when no usable name is advertised.
|
|
211
|
+
*/
|
|
212
|
+
export declare function parseContentDispositionFilename(headers: Headers): string | undefined;
|
|
180
213
|
export declare class TextApiResponse {
|
|
181
214
|
raw: Response;
|
|
182
215
|
constructor(raw: Response);
|
package/dist/esm/runtime.js
CHANGED
|
@@ -210,7 +210,7 @@ export class BaseAPI {
|
|
|
210
210
|
return next;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
BaseAPI.jsonRegex =
|
|
213
|
+
BaseAPI.jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
|
|
214
214
|
;
|
|
215
215
|
function isBlob(value) {
|
|
216
216
|
return typeof Blob !== 'undefined' && value instanceof Blob;
|
|
@@ -223,6 +223,11 @@ export class ResponseError extends Error {
|
|
|
223
223
|
super(msg);
|
|
224
224
|
this.response = response;
|
|
225
225
|
this.name = "ResponseError";
|
|
226
|
+
// restore prototype chain
|
|
227
|
+
const actualProto = new.target.prototype;
|
|
228
|
+
if (Object.setPrototypeOf) {
|
|
229
|
+
Object.setPrototypeOf(this, actualProto);
|
|
230
|
+
}
|
|
226
231
|
}
|
|
227
232
|
}
|
|
228
233
|
export class FetchError extends Error {
|
|
@@ -230,6 +235,11 @@ export class FetchError extends Error {
|
|
|
230
235
|
super(msg);
|
|
231
236
|
this.cause = cause;
|
|
232
237
|
this.name = "FetchError";
|
|
238
|
+
// restore prototype chain
|
|
239
|
+
const actualProto = new.target.prototype;
|
|
240
|
+
if (Object.setPrototypeOf) {
|
|
241
|
+
Object.setPrototypeOf(this, actualProto);
|
|
242
|
+
}
|
|
233
243
|
}
|
|
234
244
|
}
|
|
235
245
|
export class RequiredError extends Error {
|
|
@@ -237,6 +247,11 @@ export class RequiredError extends Error {
|
|
|
237
247
|
super(msg);
|
|
238
248
|
this.field = field;
|
|
239
249
|
this.name = "RequiredError";
|
|
250
|
+
// restore prototype chain
|
|
251
|
+
const actualProto = new.target.prototype;
|
|
252
|
+
if (Object.setPrototypeOf) {
|
|
253
|
+
Object.setPrototypeOf(this, actualProto);
|
|
254
|
+
}
|
|
240
255
|
}
|
|
241
256
|
}
|
|
242
257
|
export const COLLECTION_FORMATS = {
|
|
@@ -263,7 +278,7 @@ function querystringSingleKey(key, value, keyPrefix = '') {
|
|
|
263
278
|
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
264
279
|
}
|
|
265
280
|
if (value instanceof Date) {
|
|
266
|
-
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value
|
|
281
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(serializeDateTime(value))}`;
|
|
267
282
|
}
|
|
268
283
|
if (value instanceof Object) {
|
|
269
284
|
return querystring(value, fullKey);
|
|
@@ -274,6 +289,52 @@ export function exists(json, key) {
|
|
|
274
289
|
const value = json[key];
|
|
275
290
|
return value !== null && value !== undefined;
|
|
276
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Every generated date call site routes through these.
|
|
294
|
+
*
|
|
295
|
+
* `format: date` is a calendar date, with no time and no offset, so it is converted
|
|
296
|
+
* against the local calendar on both ends: they have to agree or the date shifts by
|
|
297
|
+
* a day. `format: date-time` is an instant and uses UTC.
|
|
298
|
+
*/
|
|
299
|
+
export function serializeDateTime(value) {
|
|
300
|
+
return value.toISOString();
|
|
301
|
+
}
|
|
302
|
+
export function serializeDate(value) {
|
|
303
|
+
if (isNaN(value.getTime())) {
|
|
304
|
+
throw new RangeError('Invalid time value');
|
|
305
|
+
}
|
|
306
|
+
const year = ('000' + value.getFullYear()).slice(-4);
|
|
307
|
+
const month = ('0' + (value.getMonth() + 1)).slice(-2);
|
|
308
|
+
const day = ('0' + value.getDate()).slice(-2);
|
|
309
|
+
return `${year}-${month}-${day}`;
|
|
310
|
+
}
|
|
311
|
+
export function parseDate(value) {
|
|
312
|
+
if (value instanceof Date) {
|
|
313
|
+
return value;
|
|
314
|
+
}
|
|
315
|
+
// `new Date("2026-08-05")` would parse as UTC midnight: a different day west of UTC.
|
|
316
|
+
// Local midnight is the stated day everywhere. setFullYear avoids the 1900 offset the
|
|
317
|
+
// multi-argument constructor applies to years 0-99.
|
|
318
|
+
const fullDate = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(value));
|
|
319
|
+
if (fullDate) {
|
|
320
|
+
const year = Number(fullDate[1]);
|
|
321
|
+
const month = Number(fullDate[2]) - 1;
|
|
322
|
+
const day = Number(fullDate[3]);
|
|
323
|
+
const date = new Date(0);
|
|
324
|
+
date.setFullYear(year, month, day);
|
|
325
|
+
date.setHours(0, 0, 0, 0);
|
|
326
|
+
// Out-of-range components (or a day the local zone skipped) silently roll over,
|
|
327
|
+
// which would hand back a date the server never sent.
|
|
328
|
+
if (date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day) {
|
|
329
|
+
return new Date(NaN);
|
|
330
|
+
}
|
|
331
|
+
return date;
|
|
332
|
+
}
|
|
333
|
+
return new Date(value);
|
|
334
|
+
}
|
|
335
|
+
export function parseDateTime(value) {
|
|
336
|
+
return new Date(value);
|
|
337
|
+
}
|
|
277
338
|
export function mapValues(data, fn) {
|
|
278
339
|
const result = {};
|
|
279
340
|
for (const key of Object.keys(data)) {
|
|
@@ -281,9 +342,14 @@ export function mapValues(data, fn) {
|
|
|
281
342
|
}
|
|
282
343
|
return result;
|
|
283
344
|
}
|
|
345
|
+
// Pass-through serializer for `any`-typed properties in form data. See #1877.
|
|
346
|
+
export function anyToJSON(value) {
|
|
347
|
+
return value;
|
|
348
|
+
}
|
|
284
349
|
export function canConsumeForm(consumes) {
|
|
350
|
+
var _a;
|
|
285
351
|
for (const consume of consumes) {
|
|
286
|
-
if ('multipart/form-data'
|
|
352
|
+
if (((_a = consume.contentType) === null || _a === void 0 ? void 0 : _a.startsWith('multipart/form-data')) == true) {
|
|
287
353
|
return true;
|
|
288
354
|
}
|
|
289
355
|
}
|
|
@@ -314,13 +380,73 @@ export class BlobApiResponse {
|
|
|
314
380
|
constructor(raw) {
|
|
315
381
|
this.raw = raw;
|
|
316
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* The body named after the Content-Disposition header, so that a download keeps the name the
|
|
385
|
+
* server gave it. A File is built from a native Blob; the Blob itself is named where there is no
|
|
386
|
+
* global File (Node.js before 20), where File cannot be constructed, or where the Blob is not the
|
|
387
|
+
* native one, as returned by an injected fetch implementation such as node-fetch, which a File
|
|
388
|
+
* would stringify instead of wrapping.
|
|
389
|
+
*/
|
|
317
390
|
value() {
|
|
318
391
|
return __awaiter(this, void 0, void 0, function* () {
|
|
319
|
-
|
|
392
|
+
var _a;
|
|
393
|
+
const blob = yield this.raw.blob();
|
|
394
|
+
const name = (_a = parseContentDispositionFilename(this.raw.headers)) !== null && _a !== void 0 ? _a : '';
|
|
395
|
+
if (typeof File !== 'undefined' && blob instanceof Blob) {
|
|
396
|
+
try {
|
|
397
|
+
return new File([blob], name, { type: blob.type });
|
|
398
|
+
}
|
|
399
|
+
catch (_b) {
|
|
400
|
+
// File cannot be constructed: name the Blob itself
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return Object.assign(blob, { name });
|
|
320
404
|
});
|
|
321
405
|
}
|
|
322
406
|
;
|
|
323
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
|
|
410
|
+
* `filename*` parameter first, falling back to the plain `filename` when it is malformed, not UTF-8
|
|
411
|
+
* or has no usable name. Any directory part is dropped; undefined when no usable name is advertised.
|
|
412
|
+
*/
|
|
413
|
+
export function parseContentDispositionFilename(headers) {
|
|
414
|
+
var _a, _b;
|
|
415
|
+
const params = parseHeaderParameters((_a = headers.get('Content-Disposition')) !== null && _a !== void 0 ? _a : '');
|
|
416
|
+
return (_b = basename(decodeExtValue(params.get('filename*')))) !== null && _b !== void 0 ? _b : basename(params.get('filename'));
|
|
417
|
+
}
|
|
418
|
+
/** The decoded RFC 5987 ext-value, or undefined when it is not UTF-8 or its percent-encoding is malformed. */
|
|
419
|
+
function decodeExtValue(value) {
|
|
420
|
+
const match = value === undefined ? null : /^utf-8'[^']*'(.*)$/i.exec(value);
|
|
421
|
+
try {
|
|
422
|
+
return match ? decodeURIComponent(match[1]) : undefined;
|
|
423
|
+
}
|
|
424
|
+
catch (_a) {
|
|
425
|
+
return undefined;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* The `name=value` parameters of a header value, consumed one at a time so that a quoted-string is
|
|
430
|
+
* taken whole, `;` included. Names are lower-cased, quoted-string values are unquoted with their
|
|
431
|
+
* backslash escapes resolved, and the first occurrence of a name wins.
|
|
432
|
+
*/
|
|
433
|
+
function parseHeaderParameters(value) {
|
|
434
|
+
const params = new Map();
|
|
435
|
+
const parameter = /(?:^|;)\s*([^=;]+?)\s*=\s*(?:"((?:[^"\\]|\\.)*)"?|([^;]*))/g;
|
|
436
|
+
let match;
|
|
437
|
+
while ((match = parameter.exec(value)) !== null) {
|
|
438
|
+
const name = match[1].toLowerCase();
|
|
439
|
+
if (!params.has(name)) {
|
|
440
|
+
params.set(name, match[2] !== undefined ? match[2].replace(/\\(.)/g, '$1') : match[3].trim());
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return params;
|
|
444
|
+
}
|
|
445
|
+
/** The last `/` or `\` separated segment of a file name, or undefined when it is not a file name. */
|
|
446
|
+
function basename(name) {
|
|
447
|
+
const base = name === null || name === void 0 ? void 0 : name.split(/[\\/]/).pop();
|
|
448
|
+
return !base || base === '.' || base === '..' ? undefined : base;
|
|
449
|
+
}
|
|
324
450
|
export class TextApiResponse {
|
|
325
451
|
constructor(raw) {
|
|
326
452
|
this.raw = raw;
|
|
@@ -18,14 +18,10 @@ import type { DecisionMatrixPatternEntry } from './DecisionMatrixPatternEntry';
|
|
|
18
18
|
export interface DecisionMatrixPattern {
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @type {string}
|
|
22
|
-
* @memberof DecisionMatrixPattern
|
|
23
21
|
*/
|
|
24
22
|
decision?: DecisionMatrixPatternDecisionEnum;
|
|
25
23
|
/**
|
|
26
24
|
*
|
|
27
|
-
* @type {Array<DecisionMatrixPatternEntry>}
|
|
28
|
-
* @memberof DecisionMatrixPattern
|
|
29
25
|
*/
|
|
30
26
|
entries?: Array<DecisionMatrixPatternEntry>;
|
|
31
27
|
}
|
|
@@ -27,7 +27,7 @@ exports.DecisionMatrixPatternDecisionEnum = {
|
|
|
27
27
|
UNREVIEWED: 'UNREVIEWED',
|
|
28
28
|
IN_REVIEW: 'IN_REVIEW',
|
|
29
29
|
DECLINED: 'DECLINED',
|
|
30
|
-
ACCEPTED: 'ACCEPTED'
|
|
30
|
+
ACCEPTED: 'ACCEPTED',
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Check if a given object implements the DecisionMatrixPattern interface.
|
|
@@ -17,14 +17,10 @@
|
|
|
17
17
|
export interface DecisionMatrixPatternEntry {
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof DecisionMatrixPatternEntry
|
|
22
20
|
*/
|
|
23
21
|
decision?: DecisionMatrixPatternEntryDecisionEnum;
|
|
24
22
|
/**
|
|
25
23
|
*
|
|
26
|
-
* @type {number}
|
|
27
|
-
* @memberof DecisionMatrixPatternEntry
|
|
28
24
|
*/
|
|
29
25
|
count?: number;
|
|
30
26
|
}
|
|
@@ -25,7 +25,7 @@ exports.DecisionMatrixPatternEntryToJSONTyped = DecisionMatrixPatternEntryToJSON
|
|
|
25
25
|
exports.DecisionMatrixPatternEntryDecisionEnum = {
|
|
26
26
|
DECLINED: 'DECLINED',
|
|
27
27
|
MAYBE: 'MAYBE',
|
|
28
|
-
ACCEPTED: 'ACCEPTED'
|
|
28
|
+
ACCEPTED: 'ACCEPTED',
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Check if a given object implements the DecisionMatrixPatternEntry interface.
|