hcloud-sdk 15.0.0 → 17.0.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.
Files changed (108) hide show
  1. package/changelog.md +78 -33
  2. package/lib/Hcloud.d.ts +3 -0
  3. package/lib/Hcloud.js +7 -0
  4. package/lib/helper/ValidationHelper.d.ts +66 -0
  5. package/lib/helper/ValidationHelper.js +312 -0
  6. package/lib/interfaces/auditor/index.d.ts +10 -4
  7. package/lib/interfaces/auditor/index.js +4 -0
  8. package/lib/interfaces/friday/index.d.ts +3 -0
  9. package/lib/interfaces/friday/index.js +19 -0
  10. package/lib/interfaces/friday/space/database/document/index.d.ts +34 -0
  11. package/lib/interfaces/friday/space/database/document/index.js +13 -0
  12. package/lib/interfaces/friday/space/database/index.d.ts +12 -0
  13. package/lib/interfaces/friday/space/database/index.js +2 -0
  14. package/lib/interfaces/friday/space/index.d.ts +21 -0
  15. package/lib/interfaces/friday/space/index.js +11 -0
  16. package/lib/interfaces/frontend/config/index.d.ts +1 -0
  17. package/lib/interfaces/fuse/space/index.d.ts +1 -0
  18. package/lib/interfaces/global/Products.d.ts +3 -1
  19. package/lib/interfaces/global/Products.js +2 -0
  20. package/lib/interfaces/global/Views.d.ts +2 -1
  21. package/lib/interfaces/global/Views.js +1 -0
  22. package/lib/interfaces/high5/execution/index.d.ts +43 -0
  23. package/lib/interfaces/high5/execution/index.js +12 -0
  24. package/lib/interfaces/high5/index.d.ts +2 -2
  25. package/lib/interfaces/high5/index.js +2 -2
  26. package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +1 -0
  27. package/lib/interfaces/high5/space/event/stream/node/index.d.ts +22 -1
  28. package/lib/interfaces/high5/space/event/stream/node/index.js +6 -1
  29. package/lib/interfaces/high5/space/execution/index.d.ts +57 -1
  30. package/lib/interfaces/high5/space/execution/index.js +8 -0
  31. package/lib/interfaces/high5/space/index.d.ts +2 -0
  32. package/lib/interfaces/high5/space/pool/index.d.ts +28 -0
  33. package/lib/interfaces/high5/space/pool/index.js +2 -0
  34. package/lib/interfaces/high5/space/webhook/index.d.ts +3 -1
  35. package/lib/interfaces/high5/wave/index.d.ts +26 -4
  36. package/lib/interfaces/high5/wave/index.js +4 -0
  37. package/lib/interfaces/idp/index.d.ts +1 -0
  38. package/lib/interfaces/idp/index.js +1 -0
  39. package/lib/interfaces/idp/organization/license/index.d.ts +11 -0
  40. package/lib/interfaces/idp/organization/member/index.d.ts +3 -0
  41. package/lib/interfaces/idp/organization/service-accounts.d.ts +8 -0
  42. package/lib/interfaces/idp/organization/service-accounts.js +2 -0
  43. package/lib/interfaces/idp/organization/settings/oauthApp/index.d.ts +1 -0
  44. package/lib/interfaces/idp/user/GeneralSettings.d.ts +1 -0
  45. package/lib/interfaces/idp/user/GeneralSettings.js +1 -0
  46. package/lib/interfaces/idp/user/Scopes.d.ts +15 -2
  47. package/lib/interfaces/idp/user/Scopes.js +39 -1
  48. package/lib/interfaces/idp/user/Totp.d.ts +4 -2
  49. package/lib/interfaces/idp/user/index.d.ts +1 -0
  50. package/lib/interfaces/nats/index.d.ts +92 -5
  51. package/lib/interfaces/nats/index.js +155 -11
  52. package/lib/service/agent/bundle/dev/index.d.ts +3 -0
  53. package/lib/service/agent/bundle/dev/index.js +16 -0
  54. package/lib/service/agent/context/index.d.ts +5 -0
  55. package/lib/service/agent/context/index.js +14 -0
  56. package/lib/service/dali/DaliAvatar.d.ts +22 -4
  57. package/lib/service/dali/DaliAvatar.js +32 -2
  58. package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +26 -0
  59. package/lib/service/dali/avatar/DaliCosmoSpace.js +58 -0
  60. package/lib/service/dali/avatar/DaliFuseSpace.d.ts +1 -1
  61. package/lib/service/dali/avatar/DaliFuseSpace.js +3 -3
  62. package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +29 -0
  63. package/lib/service/dali/avatar/DaliHigh5Pool.js +61 -0
  64. package/lib/service/dali/avatar/DaliHigh5Space.d.ts +1 -1
  65. package/lib/service/dali/avatar/DaliHigh5Space.js +3 -3
  66. package/lib/service/dali/avatar/DaliServiceAccount.d.ts +26 -0
  67. package/lib/service/dali/avatar/DaliServiceAccount.js +58 -0
  68. package/lib/service/friday/index.d.ts +13 -0
  69. package/lib/service/friday/index.js +35 -0
  70. package/lib/service/friday/space/database/document/index.d.ts +58 -0
  71. package/lib/service/friday/space/database/document/index.js +97 -0
  72. package/lib/service/friday/space/database/index.d.ts +55 -0
  73. package/lib/service/friday/space/database/index.js +101 -0
  74. package/lib/service/friday/space/index.d.ts +81 -0
  75. package/lib/service/friday/space/index.js +150 -0
  76. package/lib/service/high5/execution/index.d.ts +8 -0
  77. package/lib/service/high5/execution/index.js +21 -0
  78. package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +1 -2
  79. package/lib/service/high5/space/event/stream/design/DesignOperations.js +5 -1
  80. package/lib/service/high5/space/execution/index.d.ts +31 -1
  81. package/lib/service/high5/space/execution/index.js +47 -2
  82. package/lib/service/high5/space/execution/status/index.d.ts +13 -6
  83. package/lib/service/high5/space/execution/status/index.js +20 -8
  84. package/lib/service/high5/space/index.d.ts +18 -6
  85. package/lib/service/high5/space/index.js +30 -7
  86. package/lib/service/high5/space/pool/index.d.ts +97 -0
  87. package/lib/service/high5/space/pool/index.js +171 -0
  88. package/lib/service/high5/wave/s3/index.d.ts +8 -1
  89. package/lib/service/high5/wave/s3/index.js +29 -8
  90. package/lib/service/idp/oauth/index.d.ts +2 -2
  91. package/lib/service/idp/oauth/index.js +12 -13
  92. package/lib/service/idp/organization/index.d.ts +6 -0
  93. package/lib/service/idp/organization/index.js +10 -0
  94. package/lib/service/idp/organization/member/index.d.ts +2 -1
  95. package/lib/service/idp/organization/member/index.js +2 -1
  96. package/lib/service/idp/organization/service-accounts/index.d.ts +64 -0
  97. package/lib/service/idp/organization/service-accounts/index.js +108 -0
  98. package/lib/service/idp/registration/index.d.ts +1 -1
  99. package/lib/service/idp/registration/index.js +2 -2
  100. package/lib/service/idp/user/index.d.ts +4 -0
  101. package/lib/service/idp/user/index.js +9 -0
  102. package/lib/service/idp/user/password/index.js +1 -1
  103. package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +1 -1
  104. package/lib/service/idp/user/settings/twoFactor/totp/index.js +1 -1
  105. package/lib/service/mothership/index.js +0 -1
  106. package/lib/service/nats/index.js +2 -3
  107. package/lib/utils/bouncer/features/Provider.js +0 -3
  108. package/package.json +22 -24
@@ -0,0 +1,108 @@
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
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const Base_1 = require("../../../../Base");
13
+ const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
14
+ const searchFilter_1 = require("../../../../helper/searchFilter");
15
+ class IdpOrganizationServiceAccounts extends Base_1.default {
16
+ /**
17
+ * Create a service account
18
+ *
19
+ * @param orgName {string} Organization name
20
+ * @param name {string} Name for the service account
21
+ * @returns {ServiceAccount} Created service account
22
+ */
23
+ create(orgName, name) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const res = yield this.axios.post(this.getEndpoint(`/${orgName}/service-accounts`), { name });
26
+ return res.data;
27
+ });
28
+ }
29
+ /**
30
+ * Delete a service account
31
+ *
32
+ * @param orgName {string} Organization name
33
+ * @param id {string} Service account ID
34
+ * @returns {void}
35
+ */
36
+ delete(orgName, id) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ yield this.axios.delete(this.getEndpoint(`/${orgName}/service-accounts/${id}`));
39
+ });
40
+ }
41
+ /**
42
+ * Fetch a service account by ID
43
+ *
44
+ * @param orgName {string} Organization name
45
+ * @param id {string} Service account ID
46
+ * @returns {ServiceAccountNoToken} The service account's token is only visible on creation or token regeneration
47
+ */
48
+ get(orgName, id) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const res = yield this.axios.get(this.getEndpoint(`/${orgName}/service-accounts/${id}`));
51
+ return res.data;
52
+ });
53
+ }
54
+ /**
55
+ * Search the service accounts of the organization
56
+ *
57
+ * @param orgName {string} Organization name
58
+ * @param filters {SearchFilter[]} Filters to apply
59
+ * @param sorting {Sorting|undefined} Sorting to apply
60
+ * @param limit {number|undefined} Page size
61
+ * @param page {number|undefined} Page number
62
+ * @returns {PaginatedResponse<ServiceAccountNoToken>} A paginated response containing the service accounts that matched the search parameters
63
+ */
64
+ search(params) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const limit = params.limit || 25;
67
+ const page = params.page || 0;
68
+ const res = yield this.axios.post(this.getEndpoint(`/${params.orgName}/service-accounts/search?limit=${limit}&page=${page}`), {
69
+ filters: params.filters.map(f => new searchFilter_1.SearchFilterDTO(f)),
70
+ sorting: params.sorting,
71
+ });
72
+ return (0, paginatedResponseHelper_1.createPaginatedResponse)(res);
73
+ });
74
+ }
75
+ /**
76
+ * Regenerate a service account's token
77
+ *
78
+ * @param orgName {string} Organization name
79
+ * @param id {string} Service account ID
80
+ * @returns {ServiceAccount}
81
+ */
82
+ regenerateToken(orgName, id) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ const res = yield this.axios.patch(this.getEndpoint(`/${orgName}/service-accounts/${id}/regenerate`));
85
+ return res.data;
86
+ });
87
+ }
88
+ /**
89
+ * Rename a service account
90
+ *
91
+ * @param orgName {string} Organization name
92
+ * @param id {string} Service account ID
93
+ * @param newName {string} Service account's new name
94
+ * @returns {ServiceAccountNoToken}
95
+ */
96
+ rename(orgName, id, newName) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ const res = yield this.axios.patch(this.getEndpoint(`/${orgName}/service-accounts/${id}/name`), {
99
+ name: newName,
100
+ });
101
+ return res.data;
102
+ });
103
+ }
104
+ getEndpoint(endpoint) {
105
+ return `${this.options.server}/api/account/v1/org${endpoint}`;
106
+ }
107
+ }
108
+ exports.default = IdpOrganizationServiceAccounts;
@@ -13,7 +13,7 @@ export declare class IdpRegistration extends Base {
13
13
  * @param regionId - Optional region id
14
14
  * @param targetUrl Optional url the link in the mail will point to
15
15
  */
16
- register(name: string, email: string, password: string, captcha: string, company?: string, regionId?: string, targetUrl?: string): Promise<void>;
16
+ register(name: string, email: string, password: string, captcha: string, company?: string, regionId?: string, targetUrl?: string, validationCode?: string): Promise<void>;
17
17
  /**
18
18
  * Triggers the registration mail to be resend if the first one got lost
19
19
  * @param name - Name of the User
@@ -24,7 +24,7 @@ class IdpRegistration extends Base_1.default {
24
24
  * @param regionId - Optional region id
25
25
  * @param targetUrl Optional url the link in the mail will point to
26
26
  */
27
- register(name, email, password, captcha, company, regionId, targetUrl) {
27
+ register(name, email, password, captcha, company, regionId, targetUrl, validationCode) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
29
  yield this.axios.post(this.getEndpoint("/v1/register"), {
30
30
  name: name,
@@ -34,7 +34,7 @@ class IdpRegistration extends Base_1.default {
34
34
  company,
35
35
  regionId,
36
36
  targetUrl,
37
- });
37
+ }, { params: { validationCode } });
38
38
  });
39
39
  }
40
40
  /**
@@ -79,5 +79,9 @@ export declare class IdpUser extends Base {
79
79
  limit?: number;
80
80
  page?: number;
81
81
  }): Promise<PaginatedResponse<OrganizationMemberInvitation>>;
82
+ /**
83
+ * Maintains a user's online status
84
+ */
85
+ ping(): Promise<void>;
82
86
  protected getEndpoint(endpoint: string): string;
83
87
  }
@@ -111,6 +111,7 @@ class IdpUser extends Base_1.default {
111
111
  * @param options (optional) Defines query options to retrieve additional properties for the returned Organization objects.
112
112
  * @returns Object containing an array of Organizations and the total number of results found in the database (independent of limit and page)
113
113
  */
114
+ // eslint-disable-next-line complexity
114
115
  searchOrganizations(params) {
115
116
  return __awaiter(this, void 0, void 0, function* () {
116
117
  var _a, _b, _c;
@@ -153,6 +154,14 @@ class IdpUser extends Base_1.default {
153
154
  return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
154
155
  });
155
156
  }
157
+ /**
158
+ * Maintains a user's online status
159
+ */
160
+ ping() {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ yield this.axios.get(this.getEndpoint("/v1/user/ping"));
163
+ });
164
+ }
156
165
  getEndpoint(endpoint) {
157
166
  return `${this.options.server}/api/account${endpoint}`;
158
167
  }
@@ -36,7 +36,7 @@ class UserPasswordService extends Base_1.default {
36
36
  try {
37
37
  obj = JSON.parse(decoded);
38
38
  }
39
- catch (err) {
39
+ catch (_a) {
40
40
  throw new Error(`Token ${token} is poorly formatted. Decoded to ${decoded}.`);
41
41
  }
42
42
  if (!("email" in obj) || !("nonce" in obj)) {
@@ -3,7 +3,7 @@ import { ActivatedTotp, DeactivatedTotp, UserTotp } from "../../../../../../inte
3
3
  export declare class IdpTotp extends Base {
4
4
  /**
5
5
  * Creates a new TOTP for the requesting User.
6
- * @returns A deactivated TOTP object containing a QR code and the OTPAuth URL
6
+ * @returns A deactivated TOTP object containing all necessary data to create a QR code
7
7
  */
8
8
  createTotp(): Promise<DeactivatedTotp>;
9
9
  /**
@@ -14,7 +14,7 @@ const Base_1 = require("../../../../../../Base");
14
14
  class IdpTotp extends Base_1.default {
15
15
  /**
16
16
  * Creates a new TOTP for the requesting User.
17
- * @returns A deactivated TOTP object containing a QR code and the OTPAuth URL
17
+ * @returns A deactivated TOTP object containing all necessary data to create a QR code
18
18
  */
19
19
  createTotp() {
20
20
  return __awaiter(this, void 0, void 0, function* () {
@@ -67,7 +67,6 @@ class MothershipService extends Base_1.default {
67
67
  * @param publicKey the public key of the agent that will be used for cryptography. The agent should remember its private key.
68
68
  * @return an object holding a secret encrypted with the public key. The agent must decrypt it using its private key in order to use the /hello endpoint.
69
69
  */
70
- // eslint-disable-next-line complexity
71
70
  register(uuid, info, publicKey) {
72
71
  return __awaiter(this, void 0, void 0, function* () {
73
72
  if (typeof publicKey !== "string") {
@@ -22,7 +22,6 @@ class Nats extends Base_1.default {
22
22
  return this.natsConnection;
23
23
  };
24
24
  }
25
- // eslint-disable-next-line complexity
26
25
  connect(params) {
27
26
  return __awaiter(this, void 0, void 0, function* () {
28
27
  if (params.forceWebsocket) {
@@ -63,7 +62,7 @@ class Nats extends Base_1.default {
63
62
  try {
64
63
  callback(err);
65
64
  }
66
- catch (ignored) {
65
+ catch (_a) {
67
66
  // ignore callback errors
68
67
  }
69
68
  return;
@@ -80,7 +79,7 @@ class Nats extends Base_1.default {
80
79
  try {
81
80
  callback(null, parsedData, msg);
82
81
  }
83
- catch (ignored) {
82
+ catch (_b) {
84
83
  // ignore callback errors
85
84
  }
86
85
  } });
@@ -64,7 +64,6 @@ class BouncerProvider {
64
64
  }
65
65
  this.processRefs();
66
66
  }
67
- /* eslint-disable @typescript-eslint/no-non-null-assertion*/
68
67
  doesMatchRegion(feature, context) {
69
68
  if (feature.regions.length) {
70
69
  if (context === null || context === void 0 ? void 0 : context.region) {
@@ -75,7 +74,6 @@ class BouncerProvider {
75
74
  }
76
75
  return true;
77
76
  }
78
- /* eslint-disable @typescript-eslint/no-non-null-assertion*/
79
77
  doesMatchUser(feature, context) {
80
78
  if (feature.users.length) {
81
79
  if (context === null || context === void 0 ? void 0 : context.email) {
@@ -85,7 +83,6 @@ class BouncerProvider {
85
83
  }
86
84
  return true;
87
85
  }
88
- /* eslint-disable @typescript-eslint/no-non-null-assertion*/
89
86
  doesMatchOrganization(feature, context) {
90
87
  if (feature.organizations.length) {
91
88
  if (context === null || context === void 0 ? void 0 : context.organization) {
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "15.0.0",
3
+ "version": "17.0.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
- "test": "mocha -r ts-node/register tests/**/*.test.ts",
9
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.test.ts\"",
10
- "lint": "eslint --max-warnings=0 --fix src/ tests/ --ext .ts",
8
+ "format": "prettier --write \"src/**/*.ts\"",
9
+ "lint": "eslint --max-warnings=0 --fix src/",
11
10
  "doc:build": "vuepress build _docs/src",
12
11
  "doc:dev": "vuepress dev _docs/src",
13
12
  "doc:export": "vuepress export _docs/src",
@@ -28,32 +27,31 @@
28
27
  "author": "moovit-sp-gmbh",
29
28
  "homepage": "https://github.com/moovit-sp-gmbh/hcloud-sdk-js#readme",
30
29
  "devDependencies": {
31
- "@commitlint/cli": "^18.6.1",
32
- "@commitlint/config-conventional": "^18.6.3",
30
+ "@commitlint/cli": "^19.8.1",
31
+ "@commitlint/config-conventional": "^19.8.1",
32
+ "@eslint/compat": "^1.2.9",
33
+ "@eslint/eslintrc": "^3.3.1",
34
+ "@eslint/js": "^9.27.0",
33
35
  "@semantic-release/changelog": "^6.0.3",
34
36
  "@semantic-release/git": "^10.0.1",
35
- "@trivago/prettier-plugin-sort-imports": "^4.3.0",
36
- "@types/chai": "^4.3.17",
37
- "@types/mocha": "^10.0.7",
38
- "@types/node": "^20.14.8",
39
- "@typescript-eslint/eslint-plugin": "^7.0.2",
40
- "@typescript-eslint/parser": "^7.0.2",
41
- "chai": "^4.5.0",
37
+ "@trivago/prettier-plugin-sort-imports": "^5.2.2",
38
+ "@types/node": "^22.15.19",
39
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
40
+ "@typescript-eslint/parser": "^8.32.1",
42
41
  "conventional-changelog-conventionalcommits": "^8.0.0",
43
- "dayjs": "^1.11.12",
44
- "eslint": "^8.57.0",
45
- "eslint-config-prettier": "^8.10.0",
46
- "eslint-plugin-import": "^2.29.1",
47
- "mocha": "^10.7.3",
48
- "prettier": "^3.3.3",
49
- "semantic-release": "^23.1.1",
42
+ "eslint": "^9.27.0",
43
+ "eslint-config-prettier": "^10.1.5",
44
+ "eslint-plugin-import": "^2.31.0",
45
+ "globals": "^16.1.0",
46
+ "prettier": "^3.5.3",
47
+ "semantic-release": "^24.2.4",
50
48
  "semantic-release-telegram": "^1.6.2",
51
49
  "ts-node": "^10.9.2",
52
- "typescript": "^5.5.4"
50
+ "typescript": "^5.8.3"
53
51
  },
54
52
  "dependencies": {
55
- "axios": "^1.7.3",
56
- "nats": "^2.28.2",
57
- "nats.ws": "^1.29.2"
53
+ "axios": "^1.9.0",
54
+ "nats": "^2.29.3",
55
+ "nats.ws": "^1.30.3"
58
56
  }
59
57
  }