@shapediver/sdk.geometry-api-sdk-v2 2.8.0 → 2.9.1

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.
@@ -6,7 +6,7 @@ export interface ConfigurationParameters extends Pick<ClientConfigParams, 'acces
6
6
  maxRetries?: number;
7
7
  }
8
8
  export declare class Configuration extends ClientConfig {
9
- protected readonly sdkVersion = "2.8.0";
9
+ protected readonly sdkVersion = "2.9.1";
10
10
  readonly useCustomAxios: boolean;
11
11
  readonly maxRetries: number;
12
12
  constructor(param?: ConfigurationParameters);
@@ -6,7 +6,7 @@ class Configuration extends configuration_1.Configuration {
6
6
  constructor(param = {}) {
7
7
  var _a, _b, _c, _d;
8
8
  super(param);
9
- this.sdkVersion = '2.8.0';
9
+ this.sdkVersion = '2.9.1';
10
10
  this.useCustomAxios = (_a = param.useCustomAxios) !== null && _a !== void 0 ? _a : true;
11
11
  this.maxRetries = (_b = param.maxRetries) !== null && _b !== void 0 ? _b : 5;
12
12
  this.baseOptions = (_c = this.baseOptions) !== null && _c !== void 0 ? _c : {};
@@ -15,8 +15,8 @@ class Configuration extends configuration_1.Configuration {
15
15
  if (typeof process === 'object' && !this.baseOptions.headers['User-Agent']) {
16
16
  this.baseOptions.headers['User-Agent'] = userAgent;
17
17
  }
18
- else if (!this.baseOptions.headers['x-shapediver-useragent']) {
19
- this.baseOptions.headers['x-shapediver-useragent'] = userAgent;
18
+ else if (!this.baseOptions.headers['X-ShapeDiver-UserAgent']) {
19
+ this.baseOptions.headers['X-ShapeDiver-UserAgent'] = userAgent;
20
20
  }
21
21
  }
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapediver/sdk.geometry-api-sdk-v2",
3
- "version": "2.8.0",
3
+ "version": "2.9.1",
4
4
  "description": "SDK to communicate with the Geometry API version 2",
5
5
  "keywords": [
6
6
  "shapediver",
package/src/UtilsApi.ts CHANGED
@@ -58,6 +58,12 @@ export class UtilsApi extends BaseAPI {
58
58
  const reqHeaders: RawAxiosRequestHeaders = {
59
59
  Authorization: undefined, // Disable by default to avoid accidental token exposure.
60
60
  'Content-Type': contentType,
61
+ /* Override custom ShapeDiver headers to avoid CORS issues. */
62
+ 'X-ShapeDiver-Origin': undefined,
63
+ 'X-ShapeDiver-SessionEngineId': undefined,
64
+ 'X-ShapeDiver-BuildVersion': undefined,
65
+ 'X-ShapeDiver-BuildDate': undefined,
66
+ 'X-ShapeDiver-UserAgent': undefined,
61
67
  };
62
68
  if (filename) reqHeaders['Content-Disposition'] = contentDispositionFromFilename(filename);
63
69
 
@@ -85,6 +91,12 @@ export class UtilsApi extends BaseAPI {
85
91
  const reqHeaders: RawAxiosRequestHeaders = {
86
92
  Authorization: undefined, // Disable by default to avoid accidental token exposure.
87
93
  'Content-Type': headers.contentType,
94
+ /* Override custom ShapeDiver headers to avoid CORS issues. */
95
+ 'X-ShapeDiver-Origin': undefined,
96
+ 'X-ShapeDiver-SessionEngineId': undefined,
97
+ 'X-ShapeDiver-BuildVersion': undefined,
98
+ 'X-ShapeDiver-BuildDate': undefined,
99
+ 'X-ShapeDiver-UserAgent': undefined,
88
100
  };
89
101
  if (headers.contentDisposition)
90
102
  reqHeaders['Content-Disposition'] = headers.contentDisposition;
@@ -434,7 +446,7 @@ export class UtilsApi extends BaseAPI {
434
446
  // Create a new configuration object if necessary to enable mime type detection
435
447
  // in the serialization process.
436
448
  const configuration = this.configuration ?? new Configuration();
437
- reqOptions.data = serializeDataIfNeeded(data, reqOptions, configuration);
449
+ reqOptions.data = this.serializeDataSafely(data, reqOptions, configuration);
438
450
  }
439
451
 
440
452
  // Remove the base path configuration if the URL is a full URL.
@@ -450,6 +462,44 @@ export class UtilsApi extends BaseAPI {
450
462
  };
451
463
  }
452
464
 
465
+ /**
466
+ * A wrapper around the auto-generated `serializeDataIfNeeded` that safely serializes data for
467
+ * Axios. The idea of the base function is to stringify objects for application-json requests.
468
+ * However, this does not work on all data types. Thus, this wrapper passes through all data
469
+ * types that can be handled natively by Axios, and only calls the base function for the rest.
470
+ * @param value The data to serialize.
471
+ * @param requestOptions The request options.
472
+ * @param configuration The API configuration.
473
+ * @returns The serialized data.
474
+ */
475
+ private serializeDataSafely(
476
+ value: any,
477
+ requestOptions: any,
478
+ configuration?: Configuration
479
+ ): any {
480
+ // Helper: detect Node.js stream
481
+ function isStream(val: any): boolean {
482
+ return val !== null && typeof val === 'object' && typeof val.pipe === 'function';
483
+ }
484
+
485
+ // Pass through raw binary types that Axios can handle
486
+ if (
487
+ value instanceof ArrayBuffer ||
488
+ ArrayBuffer.isView(value) || // TypedArray (Uint8Array, Int16Array, etc.) and DataView
489
+ isStream(value) ||
490
+ (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) ||
491
+ (typeof Blob !== 'undefined' && value instanceof Blob) ||
492
+ (typeof File !== 'undefined' && value instanceof File) ||
493
+ (typeof FormData !== 'undefined' && value instanceof FormData) ||
494
+ (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams)
495
+ ) {
496
+ return value;
497
+ }
498
+
499
+ // Fallback to the generated serializer
500
+ return serializeDataIfNeeded(value, requestOptions, configuration);
501
+ }
502
+
453
503
  /** Disable the Authorization header for ShapeDiver URIs if not explicitly set. */
454
504
  private disableAuthHeaderForShapeDiverUris(
455
505
  url: string,
package/src/client/api.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * Geometry Backend API v2
5
5
  * The ShapeDiver Geometry Backend system is used to: * host Grasshopper models in a secure, reliable, scalable, and performant way, * run computations of Grasshopper models, * and cache and output the results of computations and exports.
6
6
  *
7
- * The version of the OpenAPI document: 1.11.0
7
+ * The version of the OpenAPI document: 1.13.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -13402,6 +13402,10 @@ export const SessionApiAxiosParamCreator = function (configuration?: Configurati
13402
13402
  const localVarHeaderParameter = {} as any;
13403
13403
  const localVarQueryParameter = {} as any;
13404
13404
 
13405
+ // authentication JwtAuth required
13406
+ // http bearer authentication required
13407
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
13408
+
13405
13409
  if (modelStateId !== undefined) {
13406
13410
  localVarQueryParameter['modelStateId'] = modelStateId;
13407
13411
  }
@@ -4,7 +4,7 @@
4
4
  * Geometry Backend API v2
5
5
  * The ShapeDiver Geometry Backend system is used to: * host Grasshopper models in a secure, reliable, scalable, and performant way, * run computations of Grasshopper models, * and cache and output the results of computations and exports.
6
6
  *
7
- * The version of the OpenAPI document: 1.11.0
7
+ * The version of the OpenAPI document: 1.13.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -4,7 +4,7 @@
4
4
  * Geometry Backend API v2
5
5
  * The ShapeDiver Geometry Backend system is used to: * host Grasshopper models in a secure, reliable, scalable, and performant way, * run computations of Grasshopper models, * and cache and output the results of computations and exports.
6
6
  *
7
- * The version of the OpenAPI document: 1.11.0
7
+ * The version of the OpenAPI document: 1.13.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -4,7 +4,7 @@
4
4
  * Geometry Backend API v2
5
5
  * The ShapeDiver Geometry Backend system is used to: * host Grasshopper models in a secure, reliable, scalable, and performant way, * run computations of Grasshopper models, * and cache and output the results of computations and exports.
6
6
  *
7
- * The version of the OpenAPI document: 1.11.0
7
+ * The version of the OpenAPI document: 1.13.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -4,7 +4,7 @@
4
4
  * Geometry Backend API v2
5
5
  * The ShapeDiver Geometry Backend system is used to: * host Grasshopper models in a secure, reliable, scalable, and performant way, * run computations of Grasshopper models, * and cache and output the results of computations and exports.
6
6
  *
7
- * The version of the OpenAPI document: 1.11.0
7
+ * The version of the OpenAPI document: 1.13.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -34,7 +34,7 @@ export interface ConfigurationParameters
34
34
  }
35
35
 
36
36
  export class Configuration extends ClientConfig {
37
- protected readonly sdkVersion = '2.8.0'; // WARNING: This value is updated automatically!
37
+ protected readonly sdkVersion = '2.9.1'; // WARNING: This value is updated automatically!
38
38
 
39
39
  public readonly useCustomAxios: boolean;
40
40
  public readonly maxRetries: number;
@@ -52,9 +52,9 @@ export class Configuration extends ClientConfig {
52
52
  if (typeof process === 'object' && !this.baseOptions.headers['User-Agent']) {
53
53
  // Overwrite User-Agent on Node.js applications.
54
54
  this.baseOptions.headers['User-Agent'] = userAgent;
55
- } else if (!this.baseOptions.headers['x-shapediver-useragent']) {
55
+ } else if (!this.baseOptions.headers['X-ShapeDiver-UserAgent']) {
56
56
  // Set a custom User-Agent header on Browser applications.
57
- this.baseOptions.headers['x-shapediver-useragent'] = userAgent;
57
+ this.baseOptions.headers['X-ShapeDiver-UserAgent'] = userAgent;
58
58
  }
59
59
  }
60
60
  }