@openshift-migration-advisor/agent-sdk 0.24.0-96217627668a → 0.25.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @openshift-migration-advisor/agent-sdk@0.24.0-96217627668a
1
+ # @openshift-migration-advisor/agent-sdk@0.25.0
2
2
 
3
3
  A TypeScript SDK client for the raw.githubusercontent.com API.
4
4
 
@@ -200,7 +200,7 @@ and is automatically generated by the
200
200
  [OpenAPI Generator](https://openapi-generator.tech) project:
201
201
 
202
202
  - API version: `v2`
203
- - Package version: `0.24.0-96217627668a`
203
+ - Package version: `0.25.0`
204
204
  - Generator version: `7.26.0-SNAPSHOT`
205
205
  - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
206
206
 
@@ -22,6 +22,10 @@ export interface Infra {
22
22
  *
23
23
  */
24
24
  totalHosts: number;
25
+ /**
26
+ * Whether any hosts run without vCenter cluster management (not part of any cluster)
27
+ */
28
+ standaloneHostsDetected?: boolean;
25
29
  /**
26
30
  *
27
31
  */
@@ -37,6 +37,7 @@ export function InfraFromJSONTyped(json, ignoreDiscriminator) {
37
37
  }
38
38
  return {
39
39
  'totalHosts': json['totalHosts'],
40
+ 'standaloneHostsDetected': json['standaloneHostsDetected'] == null ? undefined : json['standaloneHostsDetected'],
40
41
  'totalDatacenters': json['totalDatacenters'] == null ? undefined : json['totalDatacenters'],
41
42
  'totalClusters': json['totalClusters'] == null ? undefined : json['totalClusters'],
42
43
  'clustersPerDatacenter': json['clustersPerDatacenter'] == null ? undefined : json['clustersPerDatacenter'],
@@ -60,6 +61,7 @@ export function InfraToJSONTyped(value, ignoreDiscriminator = false) {
60
61
  }
61
62
  return {
62
63
  'totalHosts': value['totalHosts'],
64
+ 'standaloneHostsDetected': value['standaloneHostsDetected'],
63
65
  'totalDatacenters': value['totalDatacenters'],
64
66
  'totalClusters': value['totalClusters'],
65
67
  'clustersPerDatacenter': value['clustersPerDatacenter'],
@@ -187,8 +187,22 @@ export declare class VoidApiResponse {
187
187
  export declare class BlobApiResponse {
188
188
  raw: Response;
189
189
  constructor(raw: Response);
190
- value(): Promise<Blob>;
190
+ /**
191
+ * The body as a File named after the Content-Disposition header, so that a download keeps the
192
+ * name the server gave it. A File is a Blob: callers reading a Blob are unaffected, and the name
193
+ * is empty when the server did not send one. Runtimes without a global File (Node.js before 20)
194
+ * keep receiving the bare Blob.
195
+ */
196
+ value(): Promise<File>;
191
197
  }
198
+ /**
199
+ * The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
200
+ * `filename*` parameter first, then the plain `filename` as a quoted-string or a token. Parameters
201
+ * are split on `;` outside quoted-strings and matched by name case-insensitively. Any directory
202
+ * part is dropped so that the name is safe to write to disk as is; undefined when no usable name
203
+ * is advertised.
204
+ */
205
+ export declare function parseContentDispositionFilename(headers: Headers): string | undefined;
192
206
  export declare class TextApiResponse {
193
207
  raw: Response;
194
208
  constructor(raw: Response);
@@ -380,13 +380,92 @@ export class BlobApiResponse {
380
380
  constructor(raw) {
381
381
  this.raw = raw;
382
382
  }
383
+ /**
384
+ * The body as a File named after the Content-Disposition header, so that a download keeps the
385
+ * name the server gave it. A File is a Blob: callers reading a Blob are unaffected, and the name
386
+ * is empty when the server did not send one. Runtimes without a global File (Node.js before 20)
387
+ * keep receiving the bare Blob.
388
+ */
383
389
  value() {
384
390
  return __awaiter(this, void 0, void 0, function* () {
385
- return yield this.raw.blob();
391
+ var _a;
392
+ const blob = yield this.raw.blob();
393
+ if (typeof File === 'undefined') {
394
+ return blob;
395
+ }
396
+ return new File([blob], (_a = parseContentDispositionFilename(this.raw.headers)) !== null && _a !== void 0 ? _a : '', { type: blob.type });
386
397
  });
387
398
  }
388
399
  ;
389
400
  }
401
+ /**
402
+ * The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
403
+ * `filename*` parameter first, then the plain `filename` as a quoted-string or a token. Parameters
404
+ * are split on `;` outside quoted-strings and matched by name case-insensitively. Any directory
405
+ * part is dropped so that the name is safe to write to disk as is; undefined when no usable name
406
+ * is advertised.
407
+ */
408
+ export function parseContentDispositionFilename(headers) {
409
+ const value = headers.get('Content-Disposition');
410
+ if (!value) {
411
+ return undefined;
412
+ }
413
+ const params = parseHeaderParameters(value);
414
+ const encoded = params.get('filename*');
415
+ if (encoded !== undefined) {
416
+ const extValue = /^utf-8'[^']*'(.*)$/i.exec(encoded);
417
+ if (extValue) {
418
+ try {
419
+ return basename(decodeURIComponent(extValue[1]));
420
+ }
421
+ catch (_a) {
422
+ // malformed percent-encoding: fall through to the plain form
423
+ }
424
+ }
425
+ }
426
+ const plain = params.get('filename');
427
+ return plain === undefined ? undefined : basename(plain);
428
+ }
429
+ /**
430
+ * The `name=value` parameters of a header value, split on `;` outside quoted-strings. Names are
431
+ * lower-cased, quoted-string values are unquoted with their backslash escapes resolved, and the
432
+ * first occurrence of a name wins.
433
+ */
434
+ function parseHeaderParameters(value) {
435
+ const params = new Map();
436
+ let start = 0;
437
+ let quoted = false;
438
+ for (let i = 0; i <= value.length; i++) {
439
+ const c = value[i];
440
+ if (i === value.length || (c === ';' && !quoted)) {
441
+ const part = value.slice(start, i);
442
+ const eq = part.indexOf('=');
443
+ if (eq !== -1) {
444
+ const name = part.slice(0, eq).trim().toLowerCase();
445
+ let raw = part.slice(eq + 1).trim();
446
+ if (raw.startsWith('"')) {
447
+ raw = raw.slice(1, raw.length > 1 && raw.endsWith('"') ? -1 : undefined).replace(/\\(.)/g, '$1');
448
+ }
449
+ if (name && !params.has(name)) {
450
+ params.set(name, raw);
451
+ }
452
+ }
453
+ start = i + 1;
454
+ }
455
+ else if (c === '"') {
456
+ quoted = !quoted;
457
+ }
458
+ else if (c === '\\' && quoted) {
459
+ i++;
460
+ }
461
+ }
462
+ return params;
463
+ }
464
+ /** The last path segment of a file name, or undefined when nothing usable is left. */
465
+ function basename(name) {
466
+ const base = name.slice(Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\')) + 1).trim();
467
+ return base === '' || base === '.' || base === '..' ? undefined : base;
468
+ }
390
469
  export class TextApiResponse {
391
470
  constructor(raw) {
392
471
  this.raw = raw;
@@ -22,6 +22,10 @@ export interface Infra {
22
22
  *
23
23
  */
24
24
  totalHosts: number;
25
+ /**
26
+ * Whether any hosts run without vCenter cluster management (not part of any cluster)
27
+ */
28
+ standaloneHostsDetected?: boolean;
25
29
  /**
26
30
  *
27
31
  */
@@ -44,6 +44,7 @@ function InfraFromJSONTyped(json, ignoreDiscriminator) {
44
44
  }
45
45
  return {
46
46
  'totalHosts': json['totalHosts'],
47
+ 'standaloneHostsDetected': json['standaloneHostsDetected'] == null ? undefined : json['standaloneHostsDetected'],
47
48
  'totalDatacenters': json['totalDatacenters'] == null ? undefined : json['totalDatacenters'],
48
49
  'totalClusters': json['totalClusters'] == null ? undefined : json['totalClusters'],
49
50
  'clustersPerDatacenter': json['clustersPerDatacenter'] == null ? undefined : json['clustersPerDatacenter'],
@@ -67,6 +68,7 @@ function InfraToJSONTyped(value, ignoreDiscriminator = false) {
67
68
  }
68
69
  return {
69
70
  'totalHosts': value['totalHosts'],
71
+ 'standaloneHostsDetected': value['standaloneHostsDetected'],
70
72
  'totalDatacenters': value['totalDatacenters'],
71
73
  'totalClusters': value['totalClusters'],
72
74
  'clustersPerDatacenter': value['clustersPerDatacenter'],
package/dist/runtime.d.ts CHANGED
@@ -187,8 +187,22 @@ export declare class VoidApiResponse {
187
187
  export declare class BlobApiResponse {
188
188
  raw: Response;
189
189
  constructor(raw: Response);
190
- value(): Promise<Blob>;
190
+ /**
191
+ * The body as a File named after the Content-Disposition header, so that a download keeps the
192
+ * name the server gave it. A File is a Blob: callers reading a Blob are unaffected, and the name
193
+ * is empty when the server did not send one. Runtimes without a global File (Node.js before 20)
194
+ * keep receiving the bare Blob.
195
+ */
196
+ value(): Promise<File>;
191
197
  }
198
+ /**
199
+ * The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
200
+ * `filename*` parameter first, then the plain `filename` as a quoted-string or a token. Parameters
201
+ * are split on `;` outside quoted-strings and matched by name case-insensitively. Any directory
202
+ * part is dropped so that the name is safe to write to disk as is; undefined when no usable name
203
+ * is advertised.
204
+ */
205
+ export declare function parseContentDispositionFilename(headers: Headers): string | undefined;
192
206
  export declare class TextApiResponse {
193
207
  raw: Response;
194
208
  constructor(raw: Response);
package/dist/runtime.js CHANGED
@@ -32,6 +32,7 @@ exports.parseDateTime = parseDateTime;
32
32
  exports.mapValues = mapValues;
33
33
  exports.anyToJSON = anyToJSON;
34
34
  exports.canConsumeForm = canConsumeForm;
35
+ exports.parseContentDispositionFilename = parseContentDispositionFilename;
35
36
  exports.BASE_PATH = "https://raw.githubusercontent.com/api/v2".replace(/\/+$/, "");
36
37
  class Configuration {
37
38
  constructor(configuration = {}) {
@@ -399,14 +400,93 @@ class BlobApiResponse {
399
400
  constructor(raw) {
400
401
  this.raw = raw;
401
402
  }
403
+ /**
404
+ * The body as a File named after the Content-Disposition header, so that a download keeps the
405
+ * name the server gave it. A File is a Blob: callers reading a Blob are unaffected, and the name
406
+ * is empty when the server did not send one. Runtimes without a global File (Node.js before 20)
407
+ * keep receiving the bare Blob.
408
+ */
402
409
  value() {
403
410
  return __awaiter(this, void 0, void 0, function* () {
404
- return yield this.raw.blob();
411
+ var _a;
412
+ const blob = yield this.raw.blob();
413
+ if (typeof File === 'undefined') {
414
+ return blob;
415
+ }
416
+ return new File([blob], (_a = parseContentDispositionFilename(this.raw.headers)) !== null && _a !== void 0 ? _a : '', { type: blob.type });
405
417
  });
406
418
  }
407
419
  ;
408
420
  }
409
421
  exports.BlobApiResponse = BlobApiResponse;
422
+ /**
423
+ * The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
424
+ * `filename*` parameter first, then the plain `filename` as a quoted-string or a token. Parameters
425
+ * are split on `;` outside quoted-strings and matched by name case-insensitively. Any directory
426
+ * part is dropped so that the name is safe to write to disk as is; undefined when no usable name
427
+ * is advertised.
428
+ */
429
+ function parseContentDispositionFilename(headers) {
430
+ const value = headers.get('Content-Disposition');
431
+ if (!value) {
432
+ return undefined;
433
+ }
434
+ const params = parseHeaderParameters(value);
435
+ const encoded = params.get('filename*');
436
+ if (encoded !== undefined) {
437
+ const extValue = /^utf-8'[^']*'(.*)$/i.exec(encoded);
438
+ if (extValue) {
439
+ try {
440
+ return basename(decodeURIComponent(extValue[1]));
441
+ }
442
+ catch (_a) {
443
+ // malformed percent-encoding: fall through to the plain form
444
+ }
445
+ }
446
+ }
447
+ const plain = params.get('filename');
448
+ return plain === undefined ? undefined : basename(plain);
449
+ }
450
+ /**
451
+ * The `name=value` parameters of a header value, split on `;` outside quoted-strings. Names are
452
+ * lower-cased, quoted-string values are unquoted with their backslash escapes resolved, and the
453
+ * first occurrence of a name wins.
454
+ */
455
+ function parseHeaderParameters(value) {
456
+ const params = new Map();
457
+ let start = 0;
458
+ let quoted = false;
459
+ for (let i = 0; i <= value.length; i++) {
460
+ const c = value[i];
461
+ if (i === value.length || (c === ';' && !quoted)) {
462
+ const part = value.slice(start, i);
463
+ const eq = part.indexOf('=');
464
+ if (eq !== -1) {
465
+ const name = part.slice(0, eq).trim().toLowerCase();
466
+ let raw = part.slice(eq + 1).trim();
467
+ if (raw.startsWith('"')) {
468
+ raw = raw.slice(1, raw.length > 1 && raw.endsWith('"') ? -1 : undefined).replace(/\\(.)/g, '$1');
469
+ }
470
+ if (name && !params.has(name)) {
471
+ params.set(name, raw);
472
+ }
473
+ }
474
+ start = i + 1;
475
+ }
476
+ else if (c === '"') {
477
+ quoted = !quoted;
478
+ }
479
+ else if (c === '\\' && quoted) {
480
+ i++;
481
+ }
482
+ }
483
+ return params;
484
+ }
485
+ /** The last path segment of a file name, or undefined when nothing usable is left. */
486
+ function basename(name) {
487
+ const base = name.slice(Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\')) + 1).trim();
488
+ return base === '' || base === '.' || base === '..' ? undefined : base;
489
+ }
410
490
  class TextApiResponse {
411
491
  constructor(raw) {
412
492
  this.raw = raw;
package/docs/Infra.md CHANGED
@@ -7,6 +7,7 @@
7
7
  Name | Type
8
8
  ------------ | -------------
9
9
  `totalHosts` | number
10
+ `standaloneHostsDetected` | boolean
10
11
  `totalDatacenters` | number
11
12
  `totalClusters` | number
12
13
  `clustersPerDatacenter` | Array&lt;number&gt;
@@ -28,6 +29,7 @@ import type { Infra } from '@openshift-migration-advisor/agent-sdk'
28
29
  // TODO: Update the object below with actual values
29
30
  const example = {
30
31
  "totalHosts": null,
32
+ "standaloneHostsDetected": null,
31
33
  "totalDatacenters": null,
32
34
  "totalClusters": null,
33
35
  "clustersPerDatacenter": null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openshift-migration-advisor/agent-sdk",
3
- "version": "0.24.0-96217627668a",
3
+ "version": "0.25.0",
4
4
  "description": "OpenAPI client for @openshift-migration-advisor/agent-sdk",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -45,6 +45,10 @@ export interface Infra {
45
45
  *
46
46
  */
47
47
  totalHosts: number;
48
+ /**
49
+ * Whether any hosts run without vCenter cluster management (not part of any cluster)
50
+ */
51
+ standaloneHostsDetected?: boolean;
48
52
  /**
49
53
  *
50
54
  */
@@ -120,6 +124,7 @@ export function InfraFromJSONTyped(json: any, ignoreDiscriminator: boolean): Inf
120
124
  return {
121
125
 
122
126
  'totalHosts': json['totalHosts'],
127
+ 'standaloneHostsDetected': json['standaloneHostsDetected'] == null ? undefined : json['standaloneHostsDetected'],
123
128
  'totalDatacenters': json['totalDatacenters'] == null ? undefined : json['totalDatacenters'],
124
129
  'totalClusters': json['totalClusters'] == null ? undefined : json['totalClusters'],
125
130
  'clustersPerDatacenter': json['clustersPerDatacenter'] == null ? undefined : json['clustersPerDatacenter'],
@@ -147,6 +152,7 @@ export function InfraToJSONTyped(value?: Infra | null, ignoreDiscriminator: bool
147
152
  return {
148
153
 
149
154
  'totalHosts': value['totalHosts'],
155
+ 'standaloneHostsDetected': value['standaloneHostsDetected'],
150
156
  'totalDatacenters': value['totalDatacenters'],
151
157
  'totalClusters': value['totalClusters'],
152
158
  'clustersPerDatacenter': value['clustersPerDatacenter'],
package/src/runtime.ts CHANGED
@@ -491,11 +491,89 @@ export class VoidApiResponse {
491
491
  export class BlobApiResponse {
492
492
  constructor(public raw: Response) {}
493
493
 
494
- async value(): Promise<Blob> {
495
- return await this.raw.blob();
494
+ /**
495
+ * The body as a File named after the Content-Disposition header, so that a download keeps the
496
+ * name the server gave it. A File is a Blob: callers reading a Blob are unaffected, and the name
497
+ * is empty when the server did not send one. Runtimes without a global File (Node.js before 20)
498
+ * keep receiving the bare Blob.
499
+ */
500
+ async value(): Promise<File> {
501
+ const blob = await this.raw.blob();
502
+ if (typeof File === 'undefined') {
503
+ return blob as File;
504
+ }
505
+ return new File([blob], parseContentDispositionFilename(this.raw.headers) ?? '', { type: blob.type });
496
506
  };
497
507
  }
498
508
 
509
+ /**
510
+ * The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
511
+ * `filename*` parameter first, then the plain `filename` as a quoted-string or a token. Parameters
512
+ * are split on `;` outside quoted-strings and matched by name case-insensitively. Any directory
513
+ * part is dropped so that the name is safe to write to disk as is; undefined when no usable name
514
+ * is advertised.
515
+ */
516
+ export function parseContentDispositionFilename(headers: Headers): string | undefined {
517
+ const value = headers.get('Content-Disposition');
518
+ if (!value) {
519
+ return undefined;
520
+ }
521
+ const params = parseHeaderParameters(value);
522
+ const encoded = params.get('filename*');
523
+ if (encoded !== undefined) {
524
+ const extValue = /^utf-8'[^']*'(.*)$/i.exec(encoded);
525
+ if (extValue) {
526
+ try {
527
+ return basename(decodeURIComponent(extValue[1]));
528
+ } catch {
529
+ // malformed percent-encoding: fall through to the plain form
530
+ }
531
+ }
532
+ }
533
+ const plain = params.get('filename');
534
+ return plain === undefined ? undefined : basename(plain);
535
+ }
536
+
537
+ /**
538
+ * The `name=value` parameters of a header value, split on `;` outside quoted-strings. Names are
539
+ * lower-cased, quoted-string values are unquoted with their backslash escapes resolved, and the
540
+ * first occurrence of a name wins.
541
+ */
542
+ function parseHeaderParameters(value: string): Map<string, string> {
543
+ const params = new Map<string, string>();
544
+ let start = 0;
545
+ let quoted = false;
546
+ for (let i = 0; i <= value.length; i++) {
547
+ const c = value[i];
548
+ if (i === value.length || (c === ';' && !quoted)) {
549
+ const part = value.slice(start, i);
550
+ const eq = part.indexOf('=');
551
+ if (eq !== -1) {
552
+ const name = part.slice(0, eq).trim().toLowerCase();
553
+ let raw = part.slice(eq + 1).trim();
554
+ if (raw.startsWith('"')) {
555
+ raw = raw.slice(1, raw.length > 1 && raw.endsWith('"') ? -1 : undefined).replace(/\\(.)/g, '$1');
556
+ }
557
+ if (name && !params.has(name)) {
558
+ params.set(name, raw);
559
+ }
560
+ }
561
+ start = i + 1;
562
+ } else if (c === '"') {
563
+ quoted = !quoted;
564
+ } else if (c === '\\' && quoted) {
565
+ i++;
566
+ }
567
+ }
568
+ return params;
569
+ }
570
+
571
+ /** The last path segment of a file name, or undefined when nothing usable is left. */
572
+ function basename(name: string): string | undefined {
573
+ const base = name.slice(Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\')) + 1).trim();
574
+ return base === '' || base === '.' || base === '..' ? undefined : base;
575
+ }
576
+
499
577
  export class TextApiResponse {
500
578
  constructor(public raw: Response) {}
501
579