@shapediver/sdk.platform-api-sdk-v1 2.28.9 → 2.29.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,61 +1,61 @@
1
- <p style="text-align: center">
2
- <a href="https://www.shapediver.com/">
3
- <img
4
- alt="ShapeDiver"
5
- src="https://sduse1-assets.shapediver.com/production/assets/img/apple-icon.png"
6
- />
7
- </a>
8
- </p>
9
-
10
- # ShapeDiver Platform SDK
11
- [ShapeDiver](https://www.shapediver.com/) is a cloud platform that provides the right tools and scalable infrastructure to help you transform your Grasshopper files into online applications. It allows you to share the power of Grasshopper and Parametric Design with partners, clients and other key stakeholders wherever they are.
12
-
13
- The **ShapeDiver Platform SDK** allows to access the functionality of the [ShapeDiver Platform](https://www.shapediver.com/app/) (or white labelled instances of it) by means of the [ShapeDiver Platform API](https://help.shapediver.com/doc/platform-backend).
14
- The SDK exposes all TypeScript-types describing request and response objects.
15
-
16
- The authentication system is based on **JWT tokens**, which the SDK allows you to request from the **ShapeDiver Platform** using the OAuth 2.0 functionality integrated with the [ShapeDiver Platform API](https://help.shapediver.com/doc/platform-backend).
17
-
18
- ## Usage
19
-
20
- * Add npm package:
21
- ```sh
22
- npm i @shapediver/sdk.platform-api-sdk-v1
23
- ```
24
- * Import constructor function:
25
- ```javascript
26
- import { create } from '@shapediver/sdk.platform-api-sdk-v1';
27
- ```
28
-
29
- * Create and authorize client:
30
- ```javascript
31
- const client = create({clientId: "CLIENT_ID", baseUrl: "SHAPEDIVER_PLATFORM_API_ENDPOINT"});
32
- await client.authorization.passwordGrant("USERNAME OR ACCESS KEY ID", "PASSWORD OR ACCESS KEY SECRET");
33
- ```
34
-
35
- Whenever possible do not use your username and password for usage of the SDK. Instead log in to the [ShapeDiver Platform](https://www.shapediver.com/app/) and create an access key pair, consisting of an
36
-
37
- * access key id (to be used instead of your username), and an
38
- * access key secret (to be used instead of your password).
39
-
40
- Using access keys allows you to keep your application secure, because access keys
41
-
42
- * can be limited in scope (e.g. they can be limited to be read only)
43
- * can easily be revoked at any time
44
- * can be time limited.
45
-
46
- ## Versioning
47
- We take care to provide backwards compatibility for older versions of the SDK and the API, but might introduce breaking changes in case of major version upgrades.
48
- New features of the SDK might be limited to newer versions of the API. We recommend always using the newest SDK version out there.
49
-
50
- ## Support
51
-
52
- * [Plaform Backend documentation](https://help.shapediver.com/doc/platform-backend)
53
- * [ShapeDiver Help Center](https://help.shapediver.com)
54
- * [Forum](https://forum.shapediver.com)
55
-
56
- If you have further questions, [reach out to us](https://www.shapediver.com/?open_contact=true).
57
-
58
- Find out more about ShapeDiver [right here](https://www.shapediver.com/)!
59
-
60
- ## Licensing
61
- The ShapeDiver Platform SDK is released under the [MIT License](LICENSE).
1
+ <p style="text-align: center">
2
+ <a href="https://www.shapediver.com/">
3
+ <img
4
+ alt="ShapeDiver"
5
+ src="https://sduse1-assets.shapediver.com/production/assets/img/apple-icon.png"
6
+ />
7
+ </a>
8
+ </p>
9
+
10
+ # ShapeDiver Platform SDK
11
+ [ShapeDiver](https://www.shapediver.com/) is a cloud platform that provides the right tools and scalable infrastructure to help you transform your Grasshopper files into online applications. It allows you to share the power of Grasshopper and Parametric Design with partners, clients and other key stakeholders wherever they are.
12
+
13
+ The **ShapeDiver Platform SDK** allows to access the functionality of the [ShapeDiver Platform](https://www.shapediver.com/app/) (or white labelled instances of it) by means of the [ShapeDiver Platform API](https://help.shapediver.com/doc/platform-backend).
14
+ The SDK exposes all TypeScript-types describing request and response objects.
15
+
16
+ The authentication system is based on **JWT tokens**, which the SDK allows you to request from the **ShapeDiver Platform** using the OAuth 2.0 functionality integrated with the [ShapeDiver Platform API](https://help.shapediver.com/doc/platform-backend).
17
+
18
+ ## Usage
19
+
20
+ * Add npm package:
21
+ ```sh
22
+ npm i @shapediver/sdk.platform-api-sdk-v1
23
+ ```
24
+ * Import constructor function:
25
+ ```javascript
26
+ import { create } from '@shapediver/sdk.platform-api-sdk-v1';
27
+ ```
28
+
29
+ * Create and authorize client:
30
+ ```javascript
31
+ const client = create({clientId: "CLIENT_ID", baseUrl: "SHAPEDIVER_PLATFORM_API_ENDPOINT"});
32
+ await client.authorization.passwordGrant("USERNAME OR ACCESS KEY ID", "PASSWORD OR ACCESS KEY SECRET");
33
+ ```
34
+
35
+ Whenever possible do not use your username and password for usage of the SDK. Instead log in to the [ShapeDiver Platform](https://www.shapediver.com/app/) and create an access key pair, consisting of an
36
+
37
+ * access key id (to be used instead of your username), and an
38
+ * access key secret (to be used instead of your password).
39
+
40
+ Using access keys allows you to keep your application secure, because access keys
41
+
42
+ * can be limited in scope (e.g. they can be limited to be read only)
43
+ * can easily be revoked at any time
44
+ * can be time limited.
45
+
46
+ ## Versioning
47
+ We take care to provide backwards compatibility for older versions of the SDK and the API, but might introduce breaking changes in case of major version upgrades.
48
+ New features of the SDK might be limited to newer versions of the API. We recommend always using the newest SDK version out there.
49
+
50
+ ## Support
51
+
52
+ * [Plaform Backend documentation](https://help.shapediver.com/doc/platform-backend)
53
+ * [ShapeDiver Help Center](https://help.shapediver.com)
54
+ * [Forum](https://forum.shapediver.com)
55
+
56
+ If you have further questions, [reach out to us](https://www.shapediver.com/?open_contact=true).
57
+
58
+ Find out more about ShapeDiver [right here](https://www.shapediver.com/)!
59
+
60
+ ## Licensing
61
+ The ShapeDiver Platform SDK is released under the [MIT License](LICENSE).
@@ -1 +1 @@
1
- {"version":3,"file":"SdPlatformWebhookApi.d.ts","sourceRoot":"","sources":["../../src/resources/SdPlatformWebhookApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,sCAAsC,EAAE,oCAAoC,EAAE,oCAAoC,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAA;AACxM,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAA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BAAsB,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,0BAA0B;IAW1K;;;;;OAKG;IACI,cAAc,CAAC,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,sCAAsC,GAAG,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAQ5I;;;;;MAKE;IACK,YAAY,CAAC,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,oCAAoC,GAAG,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAQxI;;;;;MAKE;IACK,YAAY,CAAC,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,oCAAoC,GAAG,OAAO,CAAC,sBAAsB,CAAC,8BAA8B,CAAC,CAAC;IAQlK;;;;;;;;;;;;;;;OAeG;IACU,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUpH;;;;;;;;;;;;;;;;OAgBG;IACU,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAUpI"}
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.SdPlatformWebhookApi = void 0;
4
13
  const SdPlatformRequestId_1 = require("../api/SdPlatformRequestId");
@@ -80,10 +89,12 @@ class SdPlatformWebhookApi {
80
89
  * - if no matching property is found by previous case, parameter from the request body is ignored.
81
90
  */
82
91
  modelComputation(identifier, secret, modelSlug, body) {
83
- var path = this.__getPath(`${identifier}/${modelSlug}/output`);
84
- const header = (0, SdWebhookSignature_1.createWebhookSignature)(secret, body);
85
- return this.__api.post(SdPlatformRequestId_1.RequestId.WebhookModelComputation, path, body, this.__resolveRequestConfig({}), {
86
- "X-WEBHOOK-SIGNATURE": header
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ var path = this.__getPath(`${identifier}/${modelSlug}/output`);
94
+ const header = yield (0, SdWebhookSignature_1.createWebhookSignature)(secret, body);
95
+ return this.__api.post(SdPlatformRequestId_1.RequestId.WebhookModelComputation, path, body, this.__resolveRequestConfig({}), {
96
+ "X-WEBHOOK-SIGNATURE": header
97
+ });
87
98
  });
88
99
  }
89
100
  /**
@@ -104,10 +115,12 @@ class SdPlatformWebhookApi {
104
115
  * - if no matching property is found by previous case, parameter from the request body is ignored.
105
116
  */
106
117
  modelExport(identifier, secret, modelSlug, exportId, body) {
107
- var path = this.__getPath(`${identifier}/${modelSlug}/export/${exportId}`);
108
- const header = (0, SdWebhookSignature_1.createWebhookSignature)(secret, body);
109
- return this.__api.post(SdPlatformRequestId_1.RequestId.WebhookModelExport, path, body, this.__resolveRequestConfig({}), {
110
- "X-WEBHOOK-SIGNATURE": header
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ var path = this.__getPath(`${identifier}/${modelSlug}/export/${exportId}`);
120
+ const header = yield (0, SdWebhookSignature_1.createWebhookSignature)(secret, body);
121
+ return this.__api.post(SdPlatformRequestId_1.RequestId.WebhookModelExport, path, body, this.__resolveRequestConfig({}), {
122
+ "X-WEBHOOK-SIGNATURE": header
123
+ });
111
124
  });
112
125
  }
113
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SdPlatformWebhookApi.js","sourceRoot":"","sources":["../../src/resources/SdPlatformWebhookApi.ts"],"names":[],"mappings":";;;AACA,oEAAuD;AAKvD,mEAAoE;AAcpE;;GAEG;AACH,MAAa,oBAAoB;IAK7B;;OAEG;IACH,YAAsB,SAA+B;QAA/B,cAAS,GAAT,SAAS,CAAsB;QAN3C,iBAAY,GAAW,YAAY,CAAC;QAQ1C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC;IAC/B,CAAC;IAES,SAAS,CAAC,YAA2B,IAAI;QAE/C,OAAO,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC;IAC/C,CAAC;IAES,sBAAsB,CAAC,OAA4G;QAEzI,OAAO;YACH,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,YAAY,EAAE,OAAO,CAAC,mBAAmB;YACzC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;YAC9C,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ;SAC5C,CAAA;IACL,CAAC;IAED;;;;;OAKG;IACI,cAAc,CAAC,IAAgC,EAAE,IAA4C;QAEhG,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,+BAAS,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,sBAAsB,CAAC;YACzH,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SAC1B,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;;;;MAKE;IACK,YAAY,CAAC,IAAgC,EAAE,IAA0C;Q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;gBACnG,qBAAqB,EAAG,MAAM;aACjC,CAAC,CAAC;QACP,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;OAgBG;IACU,WAAW,CAAC,UAAkB,EAAE,MAAc,EAAE,SAAiB,EAAE,QAAgB,EAAE,IAAY;;YAC1G,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,UAAU,IAAI,SAAS,WAAW,QAAQ,EAAE,CAAC,CAAC;YAE3E,MAAM,MAAM,GAAG,MAAM,IAAA,2CAAsB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAE1D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,+BAAS,CAAC,kBAAkB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,sBAAsB,CAAC,EAAE,CAAC,EAAE;gBAC9F,qBAAqB,EAAG,MAAM;aACjC,CAAC,CAAC;QACP,CAAC;KAAA;CAEJ;AA5HD,oDA4HC"}
@@ -5,5 +5,5 @@
5
5
  * @param body
6
6
  * @returns
7
7
  */
8
- export declare function createWebhookSignature(secret: string, body: any): string;
8
+ export declare function createWebhookSignature(secret: string, body: unknown): Promise<string>;
9
9
  //# sourceMappingURL=SdWebhookSignature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SdWebhookSignature.d.ts","sourceRoot":"","sources":["../../src/util/SdWebhookSignature.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,UAQ/D"}
1
+ {"version":3,"file":"SdWebhookSignature.d.ts","sourceRoot":"","sources":["../../src/util/SdWebhookSignature.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
@@ -1,10 +1,38 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
4
33
  };
5
34
  Object.defineProperty(exports, "__esModule", { value: true });
6
35
  exports.createWebhookSignature = void 0;
7
- const crypto_1 = __importDefault(require("crypto"));
8
36
  /**
9
37
  * Computes the value to be used for the X-WEBHOOK-SIGNATURE header for webhook calls.
10
38
  * See https://shapediver.atlassian.net/wiki/spaces/SS/pages/2184839185/Platform+Backend+-+Webhook+receivers#Verification-of-request-body
@@ -13,11 +41,18 @@ const crypto_1 = __importDefault(require("crypto"));
13
41
  * @returns
14
42
  */
15
43
  function createWebhookSignature(secret, body) {
16
- const hmac = crypto_1.default.createHmac('sha256', Buffer.from(secret, 'utf-8'));
17
- const json = JSON.stringify(body);
18
- hmac.update(Buffer.from(json, 'utf-8'));
19
- const hashBytes = hmac.digest();
20
- return hashBytes.toString('hex').toLowerCase();
44
+ var _a;
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const encoder = new TextEncoder();
47
+ // Fallbacks for Node.js versions 16-18.
48
+ const cryptoObj = (_a = globalThis.crypto) !== null && _a !== void 0 ? _a : (yield Promise.resolve().then(() => __importStar(require("crypto")))).webcrypto;
49
+ const key = yield cryptoObj.subtle.importKey("raw", encoder.encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
50
+ const data = encoder.encode(JSON.stringify(body));
51
+ const signature = yield cryptoObj.subtle.sign("HMAC", key, data);
52
+ return Array.from(new Uint8Array(signature))
53
+ .map((b) => b.toString(16).padStart(2, "0"))
54
+ .join("");
55
+ });
21
56
  }
22
57
  exports.createWebhookSignature = createWebhookSignature;
23
58
  //# sourceMappingURL=SdWebhookSignature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SdWebhookSignature.js","sourceRoot":"","sources":["../../src/util/SdWebhookSignature.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,MAAc,EAAE,IAAS;IAC5D,MAAM,IAAI,GAAG,gBAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAElC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;I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argv.length !== 4) {
8
8
  }
9
9
  const secret = process.argv[2];
10
10
  const body = JSON.parse(process.argv[3]);
11
- const header = (0, SdWebhookSignature_1.createWebhookSignature)(secret, body);
12
- console.log(`X-WEBHOOK-SIGNATURE: ${header}`);
11
+ (0, SdWebhookSignature_1.createWebhookSignature)(secret, body)
12
+ .then((result) => {
13
+ console.log(`X-WEBHOOK-SIGNATURE: ${result}`);
14
+ })
15
+ .catch((err) => {
16
+ console.error('Error creating webhook signature:', err);
17
+ process.exit(1);
18
+ });
13
19
  //# sourceMappingURL=webhookSignatureCli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhookSignatureCli.js","sourceRoot":"","sources":["../../src/util/webhookSignatureCli.ts"],"names":[],"mappings":";;;AAEA,6DAA8D;AAE9D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACnB;AAED,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzC,MAAM,MAAM,GAAG,IAAA,2CAAsB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAEpD,OAAO,CAAC,GAAG,CAAC,wBAAwB,MAAM,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"webhookSignatureCli.js","sourceRoot":"","sources":["../../src/util/webhookSignatureCli.ts"],"names":[],"mappings":";;;AAEA,6DAA8D;AAE9D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACnB;AAED,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzC,IAAA,2CAAsB,EAAC,MAAM,EAAE,IAAI,CAAC;KAC/B,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;IACb,OAAO,CAAC,GAAG,CAAC,wBAAwB,MAAM,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapediver/sdk.platform-api-sdk-v1",
3
- "version": "2.28.9",
3
+ "version": "2.29.0",
4
4
  "description": "SDK to communicate with the Platform API version 1",
5
5
  "keywords": [
6
6
  "shapediver",
@@ -38,18 +38,18 @@
38
38
  "post-publish": "bash ../../scripts/post-publish.sh"
39
39
  },
40
40
  "dependencies": {
41
- "@shapediver/api.platform-api-dto-v1": "~2.28.9",
41
+ "@shapediver/api.platform-api-dto-v1": "2.29.0",
42
42
  "@shapediver/sdk.geometry-api-sdk-v2": "2.10.0",
43
- "axios": "^1.13.2",
44
- "jwt-decode": "~3.1.2"
43
+ "axios": "1.13.2",
44
+ "jwt-decode": "3.1.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node-fetch": "~2.6.4",
48
- "dotenv": "~16.0.3",
49
- "jest": "~27.5.1",
50
- "lerna": "^6.6.2",
51
- "ts-node": "~10.9.1",
52
- "typescript": "~4.9.5"
47
+ "@types/node-fetch": "2.6.13",
48
+ "dotenv": "16.6.1",
49
+ "jest": "27.5.1",
50
+ "lerna": "6.6.2",
51
+ "ts-node": "10.9.2",
52
+ "typescript": "4.9.5"
53
53
  },
54
54
  "gitHead": "bbc446830cacb0aae7847fcc4438e0fbcc04865e"
55
55
  }