hcloud-sdk 16.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 (80) hide show
  1. package/changelog.md +78 -51
  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 +6 -2
  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 +23 -2
  23. package/lib/interfaces/high5/execution/index.js +2 -0
  24. package/lib/interfaces/high5/space/event/stream/node/index.d.ts +10 -2
  25. package/lib/interfaces/high5/space/event/stream/node/index.js +6 -1
  26. package/lib/interfaces/high5/space/execution/index.d.ts +54 -1
  27. package/lib/interfaces/high5/space/execution/index.js +8 -0
  28. package/lib/interfaces/high5/space/index.d.ts +2 -0
  29. package/lib/interfaces/high5/space/pool/index.d.ts +5 -7
  30. package/lib/interfaces/high5/space/pool/index.js +0 -7
  31. package/lib/interfaces/high5/space/webhook/index.d.ts +3 -1
  32. package/lib/interfaces/high5/wave/index.d.ts +8 -3
  33. package/lib/interfaces/idp/index.d.ts +1 -0
  34. package/lib/interfaces/idp/index.js +1 -0
  35. package/lib/interfaces/idp/organization/license/index.d.ts +11 -0
  36. package/lib/interfaces/idp/organization/member/index.d.ts +1 -0
  37. package/lib/interfaces/idp/organization/service-accounts.d.ts +8 -0
  38. package/lib/interfaces/idp/organization/service-accounts.js +2 -0
  39. package/lib/interfaces/idp/user/GeneralSettings.d.ts +1 -0
  40. package/lib/interfaces/idp/user/GeneralSettings.js +1 -0
  41. package/lib/interfaces/idp/user/Scopes.d.ts +14 -2
  42. package/lib/interfaces/idp/user/Scopes.js +18 -0
  43. package/lib/interfaces/nats/index.d.ts +68 -9
  44. package/lib/interfaces/nats/index.js +100 -12
  45. package/lib/service/agent/context/index.d.ts +5 -0
  46. package/lib/service/agent/context/index.js +14 -0
  47. package/lib/service/dali/DaliAvatar.d.ts +12 -0
  48. package/lib/service/dali/DaliAvatar.js +20 -0
  49. package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +26 -0
  50. package/lib/service/dali/avatar/DaliCosmoSpace.js +58 -0
  51. package/lib/service/dali/avatar/DaliServiceAccount.d.ts +26 -0
  52. package/lib/service/dali/avatar/DaliServiceAccount.js +58 -0
  53. package/lib/service/friday/index.d.ts +13 -0
  54. package/lib/service/friday/index.js +35 -0
  55. package/lib/service/friday/space/database/document/index.d.ts +58 -0
  56. package/lib/service/friday/space/database/document/index.js +97 -0
  57. package/lib/service/friday/space/database/index.d.ts +55 -0
  58. package/lib/service/friday/space/database/index.js +101 -0
  59. package/lib/service/friday/space/index.d.ts +81 -0
  60. package/lib/service/friday/space/index.js +150 -0
  61. package/lib/service/high5/space/event/stream/design/DesignOperations.js +3 -1
  62. package/lib/service/high5/space/execution/index.d.ts +4 -1
  63. package/lib/service/high5/space/execution/index.js +8 -2
  64. package/lib/service/high5/space/execution/status/index.d.ts +13 -6
  65. package/lib/service/high5/space/execution/status/index.js +20 -8
  66. package/lib/service/high5/space/index.d.ts +15 -6
  67. package/lib/service/high5/space/index.js +23 -7
  68. package/lib/service/high5/wave/s3/index.js +17 -10
  69. package/lib/service/idp/organization/index.d.ts +6 -0
  70. package/lib/service/idp/organization/index.js +10 -0
  71. package/lib/service/idp/organization/member/index.d.ts +2 -1
  72. package/lib/service/idp/organization/member/index.js +2 -1
  73. package/lib/service/idp/organization/service-accounts/index.d.ts +64 -0
  74. package/lib/service/idp/organization/service-accounts/index.js +108 -0
  75. package/lib/service/idp/user/index.js +1 -0
  76. package/lib/service/idp/user/password/index.js +1 -1
  77. package/lib/service/mothership/index.js +0 -1
  78. package/lib/service/nats/index.js +2 -3
  79. package/lib/utils/bouncer/features/Provider.js +0 -3
  80. package/package.json +22 -24
@@ -1,16 +1,23 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import Base, { Options } from "../../../../../Base";
3
- import { PaginatedResponse } from "../../../../../interfaces/global";
4
- import { High5ExecutionStatus } from "../../../../../interfaces/high5/space/execution";
3
+ import { ExecutionTree, High5ExecutionStatus } from "../../../../../interfaces/high5/space/execution";
5
4
  export declare class High5SpaceExecutionStates extends Base {
6
5
  constructor(options: Options, axios: AxiosInstance);
7
6
  /**
8
- * Retrieves all stream execution logs for a given stream.
7
+ * Retrieves an execution status by ID.
9
8
  * @param orgName Name of the Organization
10
9
  * @param spaceName Name of the Space
11
- * @param streamStatusId ID of the stream status
12
- * @returns Object containing an array of Stream execution logs as well as the total number of results
10
+ * @param executionStatusId ID of the execution status
11
+ * @returns High5ExecutionStatus
13
12
  */
14
- getStreamExecutionStatus(orgName: string, spaceName: string, streamStatusId: string, limit?: number, page?: number): Promise<PaginatedResponse<High5ExecutionStatus>>;
13
+ getStreamExecutionStatus(orgName: string, spaceName: string, executionStatusId: string): Promise<High5ExecutionStatus>;
14
+ /**
15
+ * Retrieves the complete executionTree the stream execution belongs to. An executionTree represents the hierarchical structure of stream executions initiated by a 'Trigger Stream' node.
16
+ * @param orgName Name of the Organization
17
+ * @param spaceName Name of the Space
18
+ * @param executionStatusId ID of the execution status
19
+ * @returns ExecutionTree
20
+ */
21
+ getExecutionTree(orgName: string, spaceName: string, executionStatusId: string): Promise<ExecutionTree>;
15
22
  protected getEndpoint(endpoint: string): string;
16
23
  }
@@ -11,22 +11,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.High5SpaceExecutionStates = void 0;
13
13
  const Base_1 = require("../../../../../Base");
14
- const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
15
14
  class High5SpaceExecutionStates extends Base_1.default {
16
15
  constructor(options, axios) {
17
16
  super(options, axios);
18
17
  }
19
18
  /**
20
- * Retrieves all stream execution logs for a given stream.
19
+ * Retrieves an execution status by ID.
21
20
  * @param orgName Name of the Organization
22
21
  * @param spaceName Name of the Space
23
- * @param streamStatusId ID of the stream status
24
- * @returns Object containing an array of Stream execution logs as well as the total number of results
22
+ * @param executionStatusId ID of the execution status
23
+ * @returns High5ExecutionStatus
25
24
  */
26
- getStreamExecutionStatus(orgName_1, spaceName_1, streamStatusId_1) {
27
- return __awaiter(this, arguments, void 0, function* (orgName, spaceName, streamStatusId, limit = 25, page = 0) {
28
- const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/execution/streams/status/${streamStatusId}?page=${page}&limit=${limit}`));
29
- return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
25
+ getStreamExecutionStatus(orgName, spaceName, executionStatusId) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/execution/streams/status/${executionStatusId}`));
28
+ return resp.data;
29
+ });
30
+ }
31
+ /**
32
+ * Retrieves the complete executionTree the stream execution belongs to. An executionTree represents the hierarchical structure of stream executions initiated by a 'Trigger Stream' node.
33
+ * @param orgName Name of the Organization
34
+ * @param spaceName Name of the Space
35
+ * @param executionStatusId ID of the execution status
36
+ * @returns ExecutionTree
37
+ */
38
+ getExecutionTree(orgName, spaceName, executionStatusId) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/execution/streams/executionTree/${executionStatusId}`));
41
+ return resp.data;
30
42
  });
31
43
  }
32
44
  getEndpoint(endpoint) {
@@ -39,7 +39,7 @@ export declare class High5Space extends Base {
39
39
  /**
40
40
  * Retrieves permissions of a space matching the search filter(s). Will return all permissions of the space if no search filter is provided.
41
41
  * @param orgName Name of the organization
42
- * @param spaceName Name of the space
42
+ * @param spaceName Name of the Space
43
43
  * @param filters (optional) Array of search filters
44
44
  * @param sorting (optional) Sorting object
45
45
  * @param limit (optional) Max number of results (1-100; defaults to 25)
@@ -53,7 +53,7 @@ export declare class High5Space extends Base {
53
53
  /**
54
54
  * Retrieves a High5 Space by its name.
55
55
  * @param orgName Name of the Organization
56
- * @param spaceId ID of the High5 Space
56
+ * @param spaceName Name of the space
57
57
  * @returns The requested Space
58
58
  */
59
59
  getSpace(orgName: string, spaceName: string): Promise<Space>;
@@ -61,9 +61,10 @@ export declare class High5Space extends Base {
61
61
  * Creates a new High5 Space in the specified Organization.
62
62
  * @param orgName Name of the Organization
63
63
  * @param name Name for the new Space
64
+ * @param enableDev (optional) Specifies to the front-end whether to display the versions in the development of Wave Engines and Node Catalogs
64
65
  * @returns The created Space
65
66
  */
66
- createSpace(orgName: string, name: string): Promise<Space>;
67
+ createSpace(orgName: string, name: string, enableDev?: boolean): Promise<Space>;
67
68
  /**
68
69
  * Delete a space by its name.
69
70
  * @param orgName Name of the Organization
@@ -91,7 +92,7 @@ export declare class High5Space extends Base {
91
92
  /**
92
93
  * Retrieves all streams of a space matching the search filter(s). Will return all streams if no search filter is provided.
93
94
  * @param orgName Name of the organization
94
- * @param orgName Name of the space
95
+ * @param spaceName Name of the space
95
96
  * @param filters (optional) Array of search filters
96
97
  * @param sorting (optional) Sorting object
97
98
  * @param limit (optional) Max number of results (1-100; defaults to 25)
@@ -105,10 +106,18 @@ export declare class High5Space extends Base {
105
106
  /**
106
107
  * Updates the name of a space.
107
108
  * @param orgName Name of the organization
108
- * @param newSpaceName Current name of the space
109
- * @param newName New name for the space
109
+ * @param spaceName Current name of the space
110
+ * @param newSpaceName New name for the space
110
111
  * @returns The updated space
111
112
  */
112
113
  renameSpace(orgName: string, spaceName: string, newSpaceName: string): Promise<Space>;
114
+ /**
115
+ * Specifies to the front-end whether to display the versions under development of Wave Engines and Node Catalogs.
116
+ * @param orgName Name of the organization
117
+ * @param spaceName Name of the space
118
+ * @param enableDev Specifies to the front-end whether to display the versions under development of Wave Engines and Node Catalogs
119
+ * @returns The updated space
120
+ */
121
+ enableDev(orgName: string, spaceName: string, enableDev: boolean): Promise<Space>;
113
122
  protected getEndpoint(endpoint: string): string;
114
123
  }
@@ -85,7 +85,7 @@ class High5Space extends Base_1.default {
85
85
  /**
86
86
  * Retrieves permissions of a space matching the search filter(s). Will return all permissions of the space if no search filter is provided.
87
87
  * @param orgName Name of the organization
88
- * @param spaceName Name of the space
88
+ * @param spaceName Name of the Space
89
89
  * @param filters (optional) Array of search filters
90
90
  * @param sorting (optional) Sorting object
91
91
  * @param limit (optional) Max number of results (1-100; defaults to 25)
@@ -105,7 +105,7 @@ class High5Space extends Base_1.default {
105
105
  /**
106
106
  * Retrieves a High5 Space by its name.
107
107
  * @param orgName Name of the Organization
108
- * @param spaceId ID of the High5 Space
108
+ * @param spaceName Name of the space
109
109
  * @returns The requested Space
110
110
  */
111
111
  getSpace(orgName, spaceName) {
@@ -118,11 +118,12 @@ class High5Space extends Base_1.default {
118
118
  * Creates a new High5 Space in the specified Organization.
119
119
  * @param orgName Name of the Organization
120
120
  * @param name Name for the new Space
121
+ * @param enableDev (optional) Specifies to the front-end whether to display the versions in the development of Wave Engines and Node Catalogs
121
122
  * @returns The created Space
122
123
  */
123
- createSpace(orgName, name) {
124
+ createSpace(orgName, name, enableDev) {
124
125
  return __awaiter(this, void 0, void 0, function* () {
125
- const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces`), { name: name });
126
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces`), { name, enableDev: Boolean(enableDev) });
126
127
  return resp.data;
127
128
  });
128
129
  }
@@ -173,7 +174,7 @@ class High5Space extends Base_1.default {
173
174
  /**
174
175
  * Retrieves all streams of a space matching the search filter(s). Will return all streams if no search filter is provided.
175
176
  * @param orgName Name of the organization
176
- * @param orgName Name of the space
177
+ * @param spaceName Name of the space
177
178
  * @param filters (optional) Array of search filters
178
179
  * @param sorting (optional) Sorting object
179
180
  * @param limit (optional) Max number of results (1-100; defaults to 25)
@@ -193,8 +194,8 @@ class High5Space extends Base_1.default {
193
194
  /**
194
195
  * Updates the name of a space.
195
196
  * @param orgName Name of the organization
196
- * @param newSpaceName Current name of the space
197
- * @param newName New name for the space
197
+ * @param spaceName Current name of the space
198
+ * @param newSpaceName New name for the space
198
199
  * @returns The updated space
199
200
  */
200
201
  renameSpace(orgName, spaceName, newSpaceName) {
@@ -205,6 +206,21 @@ class High5Space extends Base_1.default {
205
206
  return resp.data;
206
207
  });
207
208
  }
209
+ /**
210
+ * Specifies to the front-end whether to display the versions under development of Wave Engines and Node Catalogs.
211
+ * @param orgName Name of the organization
212
+ * @param spaceName Name of the space
213
+ * @param enableDev Specifies to the front-end whether to display the versions under development of Wave Engines and Node Catalogs
214
+ * @returns The updated space
215
+ */
216
+ enableDev(orgName, spaceName, enableDev) {
217
+ return __awaiter(this, void 0, void 0, function* () {
218
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/dev`), {
219
+ enableDev,
220
+ });
221
+ return resp.data;
222
+ });
223
+ }
208
224
  getEndpoint(endpoint) {
209
225
  return `${this.options.server}/api/high5${endpoint}`;
210
226
  }
@@ -10,8 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.S3 = void 0;
13
+ const axios_1 = require("axios");
14
+ const package_json_1 = require("../../../../../package.json");
13
15
  const Base_1 = require("../../../../Base");
14
- const axios_1 = require("../../../../interfaces/axios");
16
+ const axios_2 = require("../../../../interfaces/axios");
17
+ const sdkVersion = "hcloud-sdk-js/v" + package_json_1.version;
15
18
  /**
16
19
  * Class for reading the S3 bucket of a wave engine and catalogs
17
20
  */
@@ -26,7 +29,9 @@ class S3 extends Base_1.default {
26
29
  */
27
30
  getCatalogRegistry(waveBucketUrl) {
28
31
  return __awaiter(this, void 0, void 0, function* () {
29
- const resp = yield this.axios.get(`${waveBucketUrl}/catalogs/registry.json`, { headers: axios_1.disableCacheHeaders });
32
+ const resp = yield axios_1.default.get(`${waveBucketUrl}/catalogs/registry.json`, {
33
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
34
+ });
30
35
  return resp.data;
31
36
  });
32
37
  }
@@ -37,7 +42,9 @@ class S3 extends Base_1.default {
37
42
  */
38
43
  getEngineRegistry(waveBucketUrl) {
39
44
  return __awaiter(this, void 0, void 0, function* () {
40
- const resp = yield this.axios.get(`${waveBucketUrl}/engines/registry.json`, { headers: axios_1.disableCacheHeaders });
45
+ const resp = yield axios_1.default.get(`${waveBucketUrl}/engines/registry.json`, {
46
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
47
+ });
41
48
  return resp.data;
42
49
  });
43
50
  }
@@ -48,7 +55,7 @@ class S3 extends Base_1.default {
48
55
  */
49
56
  getCatalog(catalogUrl) {
50
57
  return __awaiter(this, void 0, void 0, function* () {
51
- const resp = yield this.axios.get(`${catalogUrl}`, { headers: axios_1.disableCacheHeaders });
58
+ const resp = yield axios_1.default.get(`${catalogUrl}`, { headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }) });
52
59
  return resp.data;
53
60
  });
54
61
  }
@@ -59,7 +66,7 @@ class S3 extends Base_1.default {
59
66
  */
60
67
  getEngine(engineUrl) {
61
68
  return __awaiter(this, void 0, void 0, function* () {
62
- const resp = yield this.axios.get(`${engineUrl}`, { headers: axios_1.disableCacheHeaders });
69
+ const resp = yield axios_1.default.get(`${engineUrl}`, { headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }) });
63
70
  return resp.data;
64
71
  });
65
72
  }
@@ -71,8 +78,8 @@ class S3 extends Base_1.default {
71
78
  */
72
79
  getWildcardsOfEngine(engineUrl, engineVersion) {
73
80
  return __awaiter(this, void 0, void 0, function* () {
74
- const resp = yield this.axios.get(`${engineUrl.replace("/index.json", "")}/${engineVersion}/wildcards.json`, {
75
- headers: axios_1.disableCacheHeaders,
81
+ const resp = yield axios_1.default.get(`${engineUrl.replace("/index.json", "")}/${engineVersion}/wildcards.json`, {
82
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
76
83
  });
77
84
  return resp.data;
78
85
  });
@@ -86,8 +93,8 @@ class S3 extends Base_1.default {
86
93
  getCatalogVersion(catalogUrl, version) {
87
94
  return __awaiter(this, void 0, void 0, function* () {
88
95
  const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + "/" + version + "/specification.json";
89
- const resp = yield this.axios.get(specificationUrl, {
90
- headers: axios_1.disableCacheHeaders,
96
+ const resp = yield axios_1.default.get(specificationUrl, {
97
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
91
98
  });
92
99
  return resp.data;
93
100
  });
@@ -101,7 +108,7 @@ class S3 extends Base_1.default {
101
108
  getNodeDocumentation(catalogUrl, version, nodeName) {
102
109
  return __awaiter(this, void 0, void 0, function* () {
103
110
  const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + `/${version}/docs/${nodeName}.md`;
104
- const resp = yield this.axios.get(specificationUrl).catch(err => {
111
+ const resp = yield axios_1.default.get(specificationUrl).catch(err => {
105
112
  throw new Error(`Node documentation not found: ${err}`);
106
113
  });
107
114
  return resp.data;
@@ -2,6 +2,7 @@ import Base from "../../../Base";
2
2
  import { Organization, OrganizationQueryOptions } from "../../../interfaces/idp/organization";
3
3
  import { IdpOrganizationLicense } from "./license";
4
4
  import { IdpOrganizationMember } from "./member";
5
+ import IdpOrganizationServiceAccounts from "./service-accounts";
5
6
  import IdpOrganizationSettings from "./settings";
6
7
  import { IdpOrganizationTeams } from "./team";
7
8
  export declare class IdpOrganization extends Base {
@@ -25,6 +26,11 @@ export declare class IdpOrganization extends Base {
25
26
  */
26
27
  get license(): IdpOrganizationLicense;
27
28
  private _license?;
29
+ /**
30
+ * Handles everything around organization service accounts
31
+ */
32
+ get serviceAccounts(): IdpOrganizationServiceAccounts;
33
+ private _serviceAccounts?;
28
34
  /**
29
35
  * Updates an Organization.
30
36
  * @param orgName Current name of the Organization
@@ -13,6 +13,7 @@ exports.IdpOrganization = void 0;
13
13
  const Base_1 = require("../../../Base");
14
14
  const license_1 = require("./license");
15
15
  const member_1 = require("./member");
16
+ const service_accounts_1 = require("./service-accounts");
16
17
  const settings_1 = require("./settings");
17
18
  const team_1 = require("./team");
18
19
  class IdpOrganization extends Base_1.default {
@@ -52,6 +53,15 @@ class IdpOrganization extends Base_1.default {
52
53
  }
53
54
  return this._license;
54
55
  }
56
+ /**
57
+ * Handles everything around organization service accounts
58
+ */
59
+ get serviceAccounts() {
60
+ if (this._serviceAccounts === undefined) {
61
+ this._serviceAccounts = new service_accounts_1.default(this.options, this.axios);
62
+ }
63
+ return this._serviceAccounts;
64
+ }
55
65
  /**
56
66
  * Updates an Organization.
57
67
  * @param orgName Current name of the Organization
@@ -15,9 +15,10 @@ export declare class IdpOrganizationMember extends Base {
15
15
  * @param page (optional) Page number to skip the first (page * limit) results (defaults to 0)
16
16
  * @returns Object containing an array of Organization Members and the total number of results found in the database (independent of limit and page)
17
17
  */
18
- searchOrganizationMembers({ orgName, filters, excludeTeamByName, sorting, limit, page, }: SearchParams & {
18
+ searchOrganizationMembers({ orgName, filters, excludeTeamByName, excludeServiceAccounts, sorting, limit, page, }: SearchParams & {
19
19
  orgName: string;
20
20
  excludeTeamByName?: string;
21
+ excludeServiceAccounts?: boolean;
21
22
  }): Promise<PaginatedResponse<OrganizationMember>>;
22
23
  /**
23
24
  * Retrieves an organization member by its user ID.
@@ -32,7 +32,7 @@ class IdpOrganizationMember extends Base_1.default {
32
32
  * @returns Object containing an array of Organization Members and the total number of results found in the database (independent of limit and page)
33
33
  */
34
34
  searchOrganizationMembers(_a) {
35
- return __awaiter(this, arguments, void 0, function* ({ orgName, filters, excludeTeamByName, sorting, limit = 25, page = 0, }) {
35
+ return __awaiter(this, arguments, void 0, function* ({ orgName, filters, excludeTeamByName, excludeServiceAccounts, sorting, limit = 25, page = 0, }) {
36
36
  const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
37
37
  return new searchFilter_1.SearchFilterDTO(f);
38
38
  });
@@ -40,6 +40,7 @@ class IdpOrganizationMember extends Base_1.default {
40
40
  filters: filtersDTO,
41
41
  sorting,
42
42
  excludeTeamByName,
43
+ excludeServiceAccounts,
43
44
  });
44
45
  return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
45
46
  });
@@ -0,0 +1,64 @@
1
+ import Base from "../../../../Base";
2
+ import { PaginatedResponse, SearchFilter, Sorting } from "../../../../interfaces/global";
3
+ import { ServiceAccount, ServiceAccountNoToken } from "../../../../interfaces/idp/organization/service-accounts";
4
+ export default class IdpOrganizationServiceAccounts extends Base {
5
+ /**
6
+ * Create a service account
7
+ *
8
+ * @param orgName {string} Organization name
9
+ * @param name {string} Name for the service account
10
+ * @returns {ServiceAccount} Created service account
11
+ */
12
+ create(orgName: string, name: string): Promise<ServiceAccount>;
13
+ /**
14
+ * Delete a service account
15
+ *
16
+ * @param orgName {string} Organization name
17
+ * @param id {string} Service account ID
18
+ * @returns {void}
19
+ */
20
+ delete(orgName: string, id: string): Promise<void>;
21
+ /**
22
+ * Fetch a service account by ID
23
+ *
24
+ * @param orgName {string} Organization name
25
+ * @param id {string} Service account ID
26
+ * @returns {ServiceAccountNoToken} The service account's token is only visible on creation or token regeneration
27
+ */
28
+ get(orgName: string, id: string): Promise<ServiceAccountNoToken>;
29
+ /**
30
+ * Search the service accounts of the organization
31
+ *
32
+ * @param orgName {string} Organization name
33
+ * @param filters {SearchFilter[]} Filters to apply
34
+ * @param sorting {Sorting|undefined} Sorting to apply
35
+ * @param limit {number|undefined} Page size
36
+ * @param page {number|undefined} Page number
37
+ * @returns {PaginatedResponse<ServiceAccountNoToken>} A paginated response containing the service accounts that matched the search parameters
38
+ */
39
+ search(params: {
40
+ orgName: string;
41
+ filters: SearchFilter[];
42
+ sorting?: Sorting;
43
+ limit?: number;
44
+ page?: number;
45
+ }): Promise<PaginatedResponse<ServiceAccountNoToken>>;
46
+ /**
47
+ * Regenerate a service account's token
48
+ *
49
+ * @param orgName {string} Organization name
50
+ * @param id {string} Service account ID
51
+ * @returns {ServiceAccount}
52
+ */
53
+ regenerateToken(orgName: string, id: string): Promise<ServiceAccount>;
54
+ /**
55
+ * Rename a service account
56
+ *
57
+ * @param orgName {string} Organization name
58
+ * @param id {string} Service account ID
59
+ * @param newName {string} Service account's new name
60
+ * @returns {ServiceAccountNoToken}
61
+ */
62
+ rename(orgName: string, id: string, newName: string): Promise<ServiceAccountNoToken>;
63
+ protected getEndpoint(endpoint: string): string;
64
+ }
@@ -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;
@@ -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;
@@ -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)) {
@@ -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) {