@se-uulm/snowballr-api-client 0.2.1-beta.79fd7d5 → 0.2.1-beta.7e95850
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
|
@@ -29,32 +29,22 @@ import {
|
|
|
29
29
|
export interface ProjectSettings {
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
|
-
* @type {number}
|
|
33
|
-
* @memberof ProjectSettings
|
|
34
32
|
*/
|
|
35
33
|
similarityThreshold?: number;
|
|
36
34
|
/**
|
|
37
35
|
*
|
|
38
|
-
* @type {string}
|
|
39
|
-
* @memberof ProjectSettings
|
|
40
36
|
*/
|
|
41
37
|
snowballingType?: ProjectSettingsSnowballingTypeEnum;
|
|
42
38
|
/**
|
|
43
39
|
*
|
|
44
|
-
* @type {boolean}
|
|
45
|
-
* @memberof ProjectSettings
|
|
46
40
|
*/
|
|
47
41
|
reviewMaybeAllowed?: boolean;
|
|
48
42
|
/**
|
|
49
43
|
*
|
|
50
|
-
* @type {ReviewDecisionMatrix}
|
|
51
|
-
* @memberof ProjectSettings
|
|
52
44
|
*/
|
|
53
45
|
reviewDecisionMatrix?: ReviewDecisionMatrix;
|
|
54
46
|
/**
|
|
55
47
|
*
|
|
56
|
-
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
57
|
-
* @memberof ProjectSettings
|
|
58
48
|
*/
|
|
59
49
|
fetchers?: { [key: string]: { [key: string]: string; }; };
|
|
60
50
|
}
|
|
@@ -66,7 +56,7 @@ export interface ProjectSettings {
|
|
|
66
56
|
export const ProjectSettingsSnowballingTypeEnum = {
|
|
67
57
|
FORWARD: 'FORWARD',
|
|
68
58
|
BACKWARD: 'BACKWARD',
|
|
69
|
-
BOTH: 'BOTH'
|
|
59
|
+
BOTH: 'BOTH',
|
|
70
60
|
} as const;
|
|
71
61
|
export type ProjectSettingsSnowballingTypeEnum = typeof ProjectSettingsSnowballingTypeEnum[keyof typeof ProjectSettingsSnowballingTypeEnum];
|
|
72
62
|
|
|
@@ -29,14 +29,10 @@ import {
|
|
|
29
29
|
export interface ReviewDecisionMatrix {
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
|
-
* @type {number}
|
|
33
|
-
* @memberof ReviewDecisionMatrix
|
|
34
32
|
*/
|
|
35
33
|
numberOfReviewers?: number;
|
|
36
34
|
/**
|
|
37
35
|
*
|
|
38
|
-
* @type {Array<DecisionMatrixPattern>}
|
|
39
|
-
* @memberof ReviewDecisionMatrix
|
|
40
36
|
*/
|
|
41
37
|
patterns?: Array<DecisionMatrixPattern>;
|
|
42
38
|
}
|
package/src/runtime.ts
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
17
16
|
|
|
18
17
|
export interface ConfigurationParameters {
|
|
@@ -91,7 +90,7 @@ export const DefaultConfig = new Configuration();
|
|
|
91
90
|
*/
|
|
92
91
|
export class BaseAPI {
|
|
93
92
|
|
|
94
|
-
private static readonly jsonRegex =
|
|
93
|
+
private static readonly jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
|
|
95
94
|
private middleware: Middleware[];
|
|
96
95
|
|
|
97
96
|
constructor(protected configuration = DefaultConfig) {
|
|
@@ -261,6 +260,12 @@ export class ResponseError extends Error {
|
|
|
261
260
|
override name: "ResponseError" = "ResponseError";
|
|
262
261
|
constructor(public response: Response, msg?: string) {
|
|
263
262
|
super(msg);
|
|
263
|
+
|
|
264
|
+
// restore prototype chain
|
|
265
|
+
const actualProto = new.target.prototype;
|
|
266
|
+
if (Object.setPrototypeOf) {
|
|
267
|
+
Object.setPrototypeOf(this, actualProto);
|
|
268
|
+
}
|
|
264
269
|
}
|
|
265
270
|
}
|
|
266
271
|
|
|
@@ -268,6 +273,12 @@ export class FetchError extends Error {
|
|
|
268
273
|
override name: "FetchError" = "FetchError";
|
|
269
274
|
constructor(public cause: Error, msg?: string) {
|
|
270
275
|
super(msg);
|
|
276
|
+
|
|
277
|
+
// restore prototype chain
|
|
278
|
+
const actualProto = new.target.prototype;
|
|
279
|
+
if (Object.setPrototypeOf) {
|
|
280
|
+
Object.setPrototypeOf(this, actualProto);
|
|
281
|
+
}
|
|
271
282
|
}
|
|
272
283
|
}
|
|
273
284
|
|
|
@@ -275,6 +286,12 @@ export class RequiredError extends Error {
|
|
|
275
286
|
override name: "RequiredError" = "RequiredError";
|
|
276
287
|
constructor(public field: string, msg?: string) {
|
|
277
288
|
super(msg);
|
|
289
|
+
|
|
290
|
+
// restore prototype chain
|
|
291
|
+
const actualProto = new.target.prototype;
|
|
292
|
+
if (Object.setPrototypeOf) {
|
|
293
|
+
Object.setPrototypeOf(this, actualProto);
|
|
294
|
+
}
|
|
278
295
|
}
|
|
279
296
|
}
|
|
280
297
|
|
|
@@ -329,7 +346,7 @@ function querystringSingleKey(key: string, value: string | number | null | undef
|
|
|
329
346
|
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
330
347
|
}
|
|
331
348
|
if (value instanceof Date) {
|
|
332
|
-
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value
|
|
349
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(serializeDateTime(value))}`;
|
|
333
350
|
}
|
|
334
351
|
if (value instanceof Object) {
|
|
335
352
|
return querystring(value as HTTPQuery, fullKey);
|
|
@@ -342,6 +359,57 @@ export function exists(json: any, key: string) {
|
|
|
342
359
|
return value !== null && value !== undefined;
|
|
343
360
|
}
|
|
344
361
|
|
|
362
|
+
/**
|
|
363
|
+
* Every generated date call site routes through these.
|
|
364
|
+
*
|
|
365
|
+
* `format: date` is a calendar date, with no time and no offset, so it is converted
|
|
366
|
+
* against the local calendar on both ends: they have to agree or the date shifts by
|
|
367
|
+
* a day. `format: date-time` is an instant and uses UTC.
|
|
368
|
+
*/
|
|
369
|
+
export function serializeDateTime(value: Date): string {
|
|
370
|
+
return value.toISOString();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export function serializeDate(value: Date): string {
|
|
374
|
+
if (isNaN(value.getTime())) {
|
|
375
|
+
throw new RangeError('Invalid time value');
|
|
376
|
+
}
|
|
377
|
+
const year = ('000' + value.getFullYear()).slice(-4);
|
|
378
|
+
const month = ('0' + (value.getMonth() + 1)).slice(-2);
|
|
379
|
+
const day = ('0' + value.getDate()).slice(-2);
|
|
380
|
+
return `${year}-${month}-${day}`;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
export function parseDate(value: Date | string): Date {
|
|
385
|
+
if (value instanceof Date) {
|
|
386
|
+
return value;
|
|
387
|
+
}
|
|
388
|
+
// `new Date("2026-08-05")` would parse as UTC midnight: a different day west of UTC.
|
|
389
|
+
// Local midnight is the stated day everywhere. setFullYear avoids the 1900 offset the
|
|
390
|
+
// multi-argument constructor applies to years 0-99.
|
|
391
|
+
const fullDate = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(value));
|
|
392
|
+
if (fullDate) {
|
|
393
|
+
const year = Number(fullDate[1]);
|
|
394
|
+
const month = Number(fullDate[2]) - 1;
|
|
395
|
+
const day = Number(fullDate[3]);
|
|
396
|
+
const date = new Date(0);
|
|
397
|
+
date.setFullYear(year, month, day);
|
|
398
|
+
date.setHours(0, 0, 0, 0);
|
|
399
|
+
// Out-of-range components (or a day the local zone skipped) silently roll over,
|
|
400
|
+
// which would hand back a date the server never sent.
|
|
401
|
+
if (date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day) {
|
|
402
|
+
return new Date(NaN);
|
|
403
|
+
}
|
|
404
|
+
return date;
|
|
405
|
+
}
|
|
406
|
+
return new Date(value);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export function parseDateTime(value: any): Date {
|
|
410
|
+
return new Date(value);
|
|
411
|
+
}
|
|
412
|
+
|
|
345
413
|
export function mapValues(data: any, fn: (item: any) => any) {
|
|
346
414
|
const result: { [key: string]: any } = {};
|
|
347
415
|
for (const key of Object.keys(data)) {
|
|
@@ -350,9 +418,14 @@ export function mapValues(data: any, fn: (item: any) => any) {
|
|
|
350
418
|
return result;
|
|
351
419
|
}
|
|
352
420
|
|
|
421
|
+
// Pass-through serializer for `any`-typed properties in form data. See #1877.
|
|
422
|
+
export function anyToJSON(value: any): any {
|
|
423
|
+
return value;
|
|
424
|
+
}
|
|
425
|
+
|
|
353
426
|
export function canConsumeForm(consumes: Consume[]): boolean {
|
|
354
427
|
for (const consume of consumes) {
|
|
355
|
-
if ('multipart/form-data'
|
|
428
|
+
if (consume.contentType?.startsWith('multipart/form-data') == true) {
|
|
356
429
|
return true;
|
|
357
430
|
}
|
|
358
431
|
}
|
|
@@ -415,14 +488,81 @@ export class VoidApiResponse {
|
|
|
415
488
|
}
|
|
416
489
|
}
|
|
417
490
|
|
|
491
|
+
/**
|
|
492
|
+
* A Blob carrying the file name the server advertised, empty when it did not send one. It is a File
|
|
493
|
+
* wherever one can be built, and the bare Blob given a name otherwise. Same name and shape as the
|
|
494
|
+
* `typescript` generator's browser HttpFile.
|
|
495
|
+
*/
|
|
496
|
+
export type HttpFile = Blob & { readonly name: string };
|
|
497
|
+
|
|
418
498
|
export class BlobApiResponse {
|
|
419
499
|
constructor(public raw: Response) {}
|
|
420
500
|
|
|
421
|
-
|
|
422
|
-
|
|
501
|
+
/**
|
|
502
|
+
* The body named after the Content-Disposition header, so that a download keeps the name the
|
|
503
|
+
* server gave it. A File is built from a native Blob; the Blob itself is named where there is no
|
|
504
|
+
* global File (Node.js before 20), where File cannot be constructed, or where the Blob is not the
|
|
505
|
+
* native one, as returned by an injected fetch implementation such as node-fetch, which a File
|
|
506
|
+
* would stringify instead of wrapping.
|
|
507
|
+
*/
|
|
508
|
+
async value(): Promise<HttpFile> {
|
|
509
|
+
const blob = await this.raw.blob();
|
|
510
|
+
const name = parseContentDispositionFilename(this.raw.headers) ?? '';
|
|
511
|
+
if (typeof File !== 'undefined' && blob instanceof Blob) {
|
|
512
|
+
try {
|
|
513
|
+
return new File([blob], name, { type: blob.type });
|
|
514
|
+
} catch {
|
|
515
|
+
// File cannot be constructed: name the Blob itself
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return Object.assign(blob, { name });
|
|
423
519
|
};
|
|
424
520
|
}
|
|
425
521
|
|
|
522
|
+
/**
|
|
523
|
+
* The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
|
|
524
|
+
* `filename*` parameter first, falling back to the plain `filename` when it is malformed, not UTF-8
|
|
525
|
+
* or has no usable name. Any directory part is dropped; undefined when no usable name is advertised.
|
|
526
|
+
*/
|
|
527
|
+
export function parseContentDispositionFilename(headers: Headers): string | undefined {
|
|
528
|
+
const params = parseHeaderParameters(headers.get('Content-Disposition') ?? '');
|
|
529
|
+
return basename(decodeExtValue(params.get('filename*'))) ?? basename(params.get('filename'));
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** The decoded RFC 5987 ext-value, or undefined when it is not UTF-8 or its percent-encoding is malformed. */
|
|
533
|
+
function decodeExtValue(value: string | undefined): string | undefined {
|
|
534
|
+
const match = value === undefined ? null : /^utf-8'[^']*'(.*)$/i.exec(value);
|
|
535
|
+
try {
|
|
536
|
+
return match ? decodeURIComponent(match[1]) : undefined;
|
|
537
|
+
} catch {
|
|
538
|
+
return undefined;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* The `name=value` parameters of a header value, consumed one at a time so that a quoted-string is
|
|
544
|
+
* taken whole, `;` included. Names are lower-cased, quoted-string values are unquoted with their
|
|
545
|
+
* backslash escapes resolved, and the first occurrence of a name wins.
|
|
546
|
+
*/
|
|
547
|
+
function parseHeaderParameters(value: string): Map<string, string> {
|
|
548
|
+
const params = new Map<string, string>();
|
|
549
|
+
const parameter = /(?:^|;)\s*([^=;]+?)\s*=\s*(?:"((?:[^"\\]|\\.)*)"?|([^;]*))/g;
|
|
550
|
+
let match: RegExpExecArray | null;
|
|
551
|
+
while ((match = parameter.exec(value)) !== null) {
|
|
552
|
+
const name = match[1].toLowerCase();
|
|
553
|
+
if (!params.has(name)) {
|
|
554
|
+
params.set(name, match[2] !== undefined ? match[2].replace(/\\(.)/g, '$1') : match[3].trim());
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return params;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** The last `/` or `\` separated segment of a file name, or undefined when it is not a file name. */
|
|
561
|
+
function basename(name: string | undefined): string | undefined {
|
|
562
|
+
const base = name?.split(/[\\/]/).pop();
|
|
563
|
+
return !base || base === '.' || base === '..' ? undefined : base;
|
|
564
|
+
}
|
|
565
|
+
|
|
426
566
|
export class TextApiResponse {
|
|
427
567
|
constructor(public raw: Response) {}
|
|
428
568
|
|