@shapediver/sdk.geometry-api-sdk-v2 3.6.0 → 3.7.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.
@@ -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 = "3.6.0";
9
+ protected readonly sdkVersion = "3.7.0";
10
10
  readonly useCustomAxios: boolean;
11
11
  readonly maxRetries: number;
12
12
  constructor(param?: ConfigurationParameters);
@@ -6,13 +6,13 @@ class Configuration extends configuration_1.Configuration {
6
6
  constructor(param = {}) {
7
7
  var _a, _b, _c, _d;
8
8
  super(param);
9
- this.sdkVersion = '3.6.0';
9
+ this.sdkVersion = '3.7.0';
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 : {};
13
13
  this.baseOptions.headers = (_d = this.baseOptions.headers) !== null && _d !== void 0 ? _d : {};
14
14
  const userAgent = `sd-sdk/typescript/${this.sdkVersion}`;
15
- if (typeof process === 'object' && !this.baseOptions.headers['User-Agent']) {
15
+ if (detectRuntime() === "node" && !this.baseOptions.headers['User-Agent']) {
16
16
  this.baseOptions.headers['User-Agent'] = userAgent;
17
17
  }
18
18
  else if (!this.baseOptions.headers['X-ShapeDiver-UserAgent']) {
@@ -21,4 +21,19 @@ class Configuration extends configuration_1.Configuration {
21
21
  }
22
22
  }
23
23
  exports.Configuration = Configuration;
24
+ function detectRuntime() {
25
+ var _a, _b;
26
+ const global = globalThis;
27
+ if (typeof ((_b = (_a = global.process) === null || _a === void 0 ? void 0 : _a.versions) === null || _b === void 0 ? void 0 : _b.node) === "string") {
28
+ return "node";
29
+ }
30
+ const isBrowserMainThread = global.window === globalThis &&
31
+ typeof global.document !== "undefined";
32
+ const isBrowserWorker = global.self === globalThis &&
33
+ typeof global.navigator !== "undefined";
34
+ if (isBrowserMainThread || isBrowserWorker) {
35
+ return "browser";
36
+ }
37
+ return "unknown";
38
+ }
24
39
  //# sourceMappingURL=configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":";;;AACA,0DAGgC;AA+BhC,MAAa,aAAc,SAAQ,6BAAY;IAM3C,YAAY,QAAiC,EAAE;;QAC3C,KAAK,CAAC,KAAK,CAAC,CAAC;QANE,eAAU,GAAG,OAAO,CAAC;QAOpC,IAAI,CAAC,cAAc,GAAG,MAAA,KAAK,CAAC,cAAc,mCAAI,IAAI,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,MAAA,KAAK,CAAC,UAAU,mCAAI,CAAC,CAAC;QAExC,IAAI,CAAC,WAAW,GAAG,MAAA,IAAI,CAAC,WAAW,mCAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,WAAW,CAAC,OAAO,mCAAI,EAAE,CAAC;QAE1D,MAAM,SAAS,GAAG,qBAAqB,IAAI,CAAC,UAAU,EAAE,CAAC;QAEzD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YAEzE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;QACvD,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAAC,EAAE,CAAC;YAE7D,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAAC,GAAG,SAAS,CAAC;QACnE,CAAC;IACL,CAAC;CACJ;AAxBD,sCAwBC"}
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/config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Q,KAAK,WAAW,CAAC;IAE3C,MAAM,eAAe,GACjB,MAAM,CAAC,IAAI,KAAK,UAAU;QAC1B,OAAO,MAAM,CAAC,SAAS,KAAK,WAAW,CAAC;IAE5C,IAAI,mBAAmB,IAAI,eAAe,EAAE,CAAC;QACzC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapediver/sdk.geometry-api-sdk-v2",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "SDK to communicate with the Geometry API version 2",
5
5
  "keywords": [
6
6
  "shapediver",
@@ -34,7 +34,7 @@ export interface ConfigurationParameters
34
34
  }
35
35
 
36
36
  export class Configuration extends ClientConfig {
37
- protected readonly sdkVersion = '3.6.0'; // WARNING: This value is updated automatically!
37
+ protected readonly sdkVersion = '3.7.0'; // WARNING: This value is updated automatically!
38
38
 
39
39
  public readonly useCustomAxios: boolean;
40
40
  public readonly maxRetries: number;
@@ -49,7 +49,7 @@ export class Configuration extends ClientConfig {
49
49
 
50
50
  const userAgent = `sd-sdk/typescript/${this.sdkVersion}`;
51
51
 
52
- if (typeof process === 'object' && !this.baseOptions.headers['User-Agent']) {
52
+ if (detectRuntime() === "node" && !this.baseOptions.headers['User-Agent']) {
53
53
  // Overwrite User-Agent on Node.js applications.
54
54
  this.baseOptions.headers['User-Agent'] = userAgent;
55
55
  } else if (!this.baseOptions.headers['X-ShapeDiver-UserAgent']) {
@@ -58,3 +58,35 @@ export class Configuration extends ClientConfig {
58
58
  }
59
59
  }
60
60
  }
61
+
62
+ function detectRuntime(): "node" | "browser" | "unknown" {
63
+ const global = globalThis as typeof globalThis & {
64
+ process?: {
65
+ versions?: {
66
+ node?: unknown;
67
+ };
68
+ };
69
+ window?: unknown;
70
+ document?: unknown;
71
+ self?: unknown;
72
+ navigator?: unknown;
73
+ };
74
+
75
+ if (typeof global.process?.versions?.node === "string") {
76
+ return "node";
77
+ }
78
+
79
+ const isBrowserMainThread =
80
+ global.window === globalThis &&
81
+ typeof global.document !== "undefined";
82
+
83
+ const isBrowserWorker =
84
+ global.self === globalThis &&
85
+ typeof global.navigator !== "undefined";
86
+
87
+ if (isBrowserMainThread || isBrowserWorker) {
88
+ return "browser";
89
+ }
90
+
91
+ return "unknown";
92
+ }