@se-uulm/snowballr-api-client 0.2.1-alpha.19bc333 → 0.2.1-alpha.21b9721

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.
Files changed (53) hide show
  1. package/.openapi-generator/FILES +8 -0
  2. package/.openapi-generator/VERSION +1 -1
  3. package/README.md +102 -28
  4. package/dist/apis/ProjectsControllerApi.d.ts +54 -1
  5. package/dist/apis/ProjectsControllerApi.js +56 -19
  6. package/dist/esm/apis/ProjectsControllerApi.d.ts +54 -1
  7. package/dist/esm/apis/ProjectsControllerApi.js +52 -15
  8. package/dist/esm/models/CreateProjectRequest.d.ts +0 -2
  9. package/dist/esm/models/DecisionMatrixPattern.d.ts +0 -4
  10. package/dist/esm/models/DecisionMatrixPattern.js +1 -1
  11. package/dist/esm/models/DecisionMatrixPatternEntry.d.ts +0 -4
  12. package/dist/esm/models/DecisionMatrixPatternEntry.js +1 -1
  13. package/dist/esm/models/Project.d.ts +3 -54
  14. package/dist/esm/models/Project.js +7 -22
  15. package/dist/esm/models/ProjectSettings.d.ts +60 -0
  16. package/dist/esm/models/ProjectSettings.js +58 -0
  17. package/dist/esm/models/ReviewDecisionMatrix.d.ts +0 -4
  18. package/dist/esm/models/index.d.ts +1 -0
  19. package/dist/esm/models/index.js +1 -0
  20. package/dist/esm/runtime.d.ts +34 -1
  21. package/dist/esm/runtime.js +130 -4
  22. package/dist/models/CreateProjectRequest.d.ts +0 -2
  23. package/dist/models/DecisionMatrixPattern.d.ts +0 -4
  24. package/dist/models/DecisionMatrixPattern.js +1 -1
  25. package/dist/models/DecisionMatrixPatternEntry.d.ts +0 -4
  26. package/dist/models/DecisionMatrixPatternEntry.js +1 -1
  27. package/dist/models/Project.d.ts +3 -54
  28. package/dist/models/Project.js +8 -23
  29. package/dist/models/ProjectSettings.d.ts +60 -0
  30. package/dist/models/ProjectSettings.js +66 -0
  31. package/dist/models/ReviewDecisionMatrix.d.ts +0 -4
  32. package/dist/models/index.d.ts +1 -0
  33. package/dist/models/index.js +1 -0
  34. package/dist/runtime.d.ts +34 -1
  35. package/dist/runtime.js +136 -4
  36. package/docs/CreateProjectRequest.md +34 -0
  37. package/docs/DecisionMatrixPattern.md +36 -0
  38. package/docs/DecisionMatrixPatternEntry.md +36 -0
  39. package/docs/Project.md +46 -0
  40. package/docs/ProjectSettings.md +42 -0
  41. package/docs/ProjectsControllerApi.md +264 -0
  42. package/docs/ReviewDecisionMatrix.md +36 -0
  43. package/package.json +2 -2
  44. package/src/apis/ProjectsControllerApi.ts +91 -20
  45. package/src/models/CreateProjectRequest.ts +0 -2
  46. package/src/models/DecisionMatrixPattern.ts +1 -5
  47. package/src/models/DecisionMatrixPatternEntry.ts +1 -5
  48. package/src/models/Project.ts +14 -70
  49. package/src/models/ProjectSettings.ts +107 -0
  50. package/src/models/ReviewDecisionMatrix.ts +0 -4
  51. package/src/models/index.ts +1 -0
  52. package/src/runtime.ts +146 -6
  53. package/tsconfig.json +1 -1
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 = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
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.toISOString())}`;
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' === consume.contentType) {
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
- async value(): Promise<Blob> {
422
- return await this.raw.blob();
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
 
package/tsconfig.json CHANGED
@@ -3,8 +3,8 @@
3
3
  "declaration": true,
4
4
  "target": "es6",
5
5
  "module": "commonjs",
6
- "moduleResolution": "node",
7
6
  "outDir": "dist",
7
+ "rootDir": "src",
8
8
  "typeRoots": [
9
9
  "node_modules/@types"
10
10
  ]