hcloud-sdk 21.1.0 → 21.2.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 (36) hide show
  1. package/changelog.md +29 -2
  2. package/lib/helper/ValidationHelper.d.ts +1 -0
  3. package/lib/helper/ValidationHelper.js +10 -2
  4. package/lib/interfaces/auditor/index.d.ts +2 -1
  5. package/lib/interfaces/auditor/index.js +1 -0
  6. package/lib/interfaces/cosmo/asset/index.d.ts +20 -2
  7. package/lib/interfaces/cosmo/comment/index.d.ts +3 -1
  8. package/lib/interfaces/cosmo/share/index.d.ts +4 -0
  9. package/lib/interfaces/cosmo/space/index.d.ts +1 -31
  10. package/lib/interfaces/cosmo/space/index.js +0 -6
  11. package/lib/interfaces/global/Storage.d.ts +40 -0
  12. package/lib/interfaces/global/Storage.js +2 -0
  13. package/lib/interfaces/high5/space/request.d.ts +0 -1
  14. package/lib/interfaces/high5/wave/Wave.d.ts +144 -0
  15. package/lib/interfaces/high5/wave/Wave.js +120 -0
  16. package/lib/interfaces/idp/organization/license/index.d.ts +6 -0
  17. package/lib/interfaces/idp/organization/settings/domain/oidc/index.d.ts +9 -0
  18. package/lib/interfaces/idp/organization/settings/domain/oidc/index.js +2 -0
  19. package/lib/service/cosmo/asset/index.d.ts +7 -34
  20. package/lib/service/cosmo/asset/index.js +2 -36
  21. package/lib/service/cosmo/comment/index.d.ts +24 -0
  22. package/lib/service/cosmo/comment/index.js +32 -0
  23. package/lib/service/cosmo/organization/index.d.ts +30 -0
  24. package/lib/service/cosmo/organization/index.js +34 -0
  25. package/lib/service/cosmo/space/index.d.ts +1 -25
  26. package/lib/service/cosmo/space/index.js +0 -30
  27. package/lib/service/idp/index.d.ts +1 -1
  28. package/lib/service/idp/index.js +2 -1
  29. package/lib/service/idp/organization/index.d.ts +6 -0
  30. package/lib/service/idp/organization/index.js +10 -0
  31. package/lib/service/idp/organization/settings/domain/oidc/index.d.ts +41 -0
  32. package/lib/service/idp/organization/settings/domain/oidc/index.js +70 -0
  33. package/lib/service/idp/organization/storage/index.d.ts +56 -0
  34. package/lib/service/idp/organization/storage/index.js +93 -0
  35. package/lib/service/nats/index.js +4 -5
  36. package/package.json +1 -1
@@ -28,40 +28,6 @@ class CosmoAsset extends Base_1.default {
28
28
  getEndpoint(endpoint) {
29
29
  return `${this.options.server}/api/cosmo${endpoint}`;
30
30
  }
31
- /**
32
- * Browse assets
33
- *
34
- * @param orgName Name of the Organization
35
- * @param spaceName Name of the Space
36
- * @param context Context to search in (e.g., ORGANIZATION, TRASH, SHARE)
37
- * @param limit Maximum number of Assets to return
38
- * @param page Page number for pagination
39
- * @param spaceName Name of Space to restrict search (mandatory if context is not ORGANIZATION)
40
- * @param namespace Name of Namespace to restrict search
41
- * @param parentId ID of parent (folder, etc.) to restrict search
42
- * @param shareId ID of Share to restrict search (mandatory if context is SHARE)
43
- * @param assetFilter Filter criteria for Assets
44
- * @param sorting Sorting criteria for the results
45
- * @returns List of found Assets
46
- */
47
- browse(_a, raw_1) {
48
- return __awaiter(this, arguments, void 0, function* ({ orgName, spaceName, context, limit, page, namespace, parentId, shareId, assetFilter, sorting, }, raw) {
49
- limit = limit !== null && limit !== void 0 ? limit : 100;
50
- page = page !== null && page !== void 0 ? page : 0;
51
- const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/assets/browse`), Object.assign({ filters: assetFilter !== null && assetFilter !== void 0 ? assetFilter : [] }, (sorting ? { sorting } : {})), {
52
- params: {
53
- context,
54
- limit,
55
- page,
56
- spaceName,
57
- namespace,
58
- parentId,
59
- shareId,
60
- },
61
- });
62
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
63
- });
64
- }
65
31
  /**
66
32
  * Create a new Asset in Cosmo inside the specified Organization and Space.
67
33
  * @remarks
@@ -398,9 +364,9 @@ class CosmoAsset extends Base_1.default {
398
364
  * @param page Page number for pagination
399
365
  * @returns A list of users allowed to be mentioned in a comment of the asset
400
366
  */
401
- listUsersAllowedToMention(orgName, spaceName, assetId, limit, page, raw) {
367
+ listUsersAllowedToMention(orgName, spaceName, assetId, search, limit, page, raw) {
402
368
  return __awaiter(this, void 0, void 0, function* () {
403
- const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/assets/${assetId}/users`), {
369
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/assets/${assetId}/users${(search === null || search === void 0 ? void 0 : search.length) ? `?search=${encodeURIComponent(search)}` : ""}`), {
404
370
  params: { limit, page },
405
371
  });
406
372
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
@@ -1,5 +1,6 @@
1
1
  import Base, { MaybeRaw } from "../../../Base";
2
2
  import { Comment, CommentSortDirection, CommentSortField, CreateComment, EditComment, Reply } from "../../../interfaces/cosmo/comment";
3
+ import { SearchFilter, Sorting } from "../../../interfaces/global";
3
4
  /**
4
5
  * @class Comment
5
6
  * @extends Base
@@ -47,6 +48,29 @@ export declare class CosmoComment extends Base {
47
48
  listComments<R extends boolean = false, A extends string = "application/json">(orgName: string, spaceName: string, namespaceName: string, refId: string, limit?: number, page?: number, annotation?: boolean, replySample?: number, sortField?: CommentSortField, sortDirection?: CommentSortDirection, accept?: A, raw?: {
48
49
  raw: R;
49
50
  }): Promise<A extends "application/mediacomposer+xml" | "application/fcp+xml" | "text/edl" ? ArrayBuffer : MaybeRaw<R, Comment[]>>;
51
+ /**
52
+ * Search Comments referring to a specific entity, applying filters and sorting.
53
+ * @remarks
54
+ * ** Under development, breaking changes possible**
55
+ *
56
+ * The total number of matching Comments (independent of `limit` and `page`) is returned in the `total`
57
+ * response header. Pass `{ raw: true }` to access it via `resp.headers["total"]` for pagination.
58
+ * @param orgName Name of the Organization
59
+ * @param spaceName Name of the Space
60
+ * @param namespaceName Name of the Namespace
61
+ * @param refId ID of the entity the Comments refer to
62
+ * @param search Search criteria including optional sorting and filters
63
+ * @param limit Maximum number of Comments to return (1-100; defaults to 25)
64
+ * @param page Page number to skip the first (page * limit) results (defaults to 0)
65
+ * @param annotation Whether to include annotations in the response
66
+ * @returns The page of matching Comments
67
+ */
68
+ searchComments<R extends boolean = false>(orgName: string, spaceName: string, namespaceName: string, refId: string, search: {
69
+ sorting?: Sorting;
70
+ filters?: SearchFilter[];
71
+ }, limit?: number, page?: number, annotation?: boolean, raw?: {
72
+ raw: R;
73
+ }): Promise<MaybeRaw<R, Comment[]>>;
50
74
  /**
51
75
  * Edit a Comment
52
76
  * @remarks
@@ -78,6 +78,38 @@ class CosmoComment extends Base_1.default {
78
78
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
79
79
  });
80
80
  }
81
+ /**
82
+ * Search Comments referring to a specific entity, applying filters and sorting.
83
+ * @remarks
84
+ * ** Under development, breaking changes possible**
85
+ *
86
+ * The total number of matching Comments (independent of `limit` and `page`) is returned in the `total`
87
+ * response header. Pass `{ raw: true }` to access it via `resp.headers["total"]` for pagination.
88
+ * @param orgName Name of the Organization
89
+ * @param spaceName Name of the Space
90
+ * @param namespaceName Name of the Namespace
91
+ * @param refId ID of the entity the Comments refer to
92
+ * @param search Search criteria including optional sorting and filters
93
+ * @param limit Maximum number of Comments to return (1-100; defaults to 25)
94
+ * @param page Page number to skip the first (page * limit) results (defaults to 0)
95
+ * @param annotation Whether to include annotations in the response
96
+ * @returns The page of matching Comments
97
+ */
98
+ searchComments(orgName_1, spaceName_1, namespaceName_1, refId_1, search_1, limit_1, page_1) {
99
+ return __awaiter(this, arguments, void 0, function* (orgName, spaceName, namespaceName, refId, search, limit, page, annotation = false, raw) {
100
+ limit = limit !== null && limit !== void 0 ? limit : 25;
101
+ page = page !== null && page !== void 0 ? page : 0;
102
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/namespaces/${namespaceName}/comments/search`), search, {
103
+ params: {
104
+ refId,
105
+ limit,
106
+ page,
107
+ annotation,
108
+ },
109
+ });
110
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
111
+ });
112
+ }
81
113
  /**
82
114
  * Edit a Comment
83
115
  * @remarks
@@ -44,4 +44,34 @@ export declare class CosmoOrganization extends Base {
44
44
  }, raw?: {
45
45
  raw: R;
46
46
  }): Promise<MaybeRaw<R, Asset[]>>;
47
+ /**
48
+ * Browse assets
49
+ *
50
+ * @param orgName Name of the Organization
51
+ * @param spaceName Name of the Space
52
+ * @param context Context to search in (e.g., ORGANIZATION, TRASH, SHARE)
53
+ * @param limit Maximum number of Assets to return
54
+ * @param page Page number for pagination
55
+ * @param spaceName Name of Space to restrict search (mandatory if context is not ORGANIZATION)
56
+ * @param namespace Name of Namespace to restrict search
57
+ * @param parentId ID of parent (folder, etc.) to restrict search
58
+ * @param shareId ID of Share to restrict search (mandatory if context is SHARE)
59
+ * @param assetFilter Filter criteria for Assets
60
+ * @param sorting Sorting criteria for the results
61
+ * @returns List of found Assets
62
+ */
63
+ browse<R extends boolean = false>({ orgName, spaceName, context, limit, page, namespace, parentId, shareId, assetFilter, sorting, }: {
64
+ orgName: string;
65
+ spaceName?: string;
66
+ context: AssetSearchContext;
67
+ limit?: number;
68
+ page?: number;
69
+ namespace?: string[] | string;
70
+ parentId?: string;
71
+ shareId?: string;
72
+ assetFilter?: AssetFilter[];
73
+ sorting?: Sorting;
74
+ }, raw?: {
75
+ raw: R;
76
+ }): Promise<MaybeRaw<R, Asset[]>>;
47
77
  }
@@ -63,5 +63,39 @@ class CosmoOrganization extends Base_1.default {
63
63
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
64
64
  });
65
65
  }
66
+ /**
67
+ * Browse assets
68
+ *
69
+ * @param orgName Name of the Organization
70
+ * @param spaceName Name of the Space
71
+ * @param context Context to search in (e.g., ORGANIZATION, TRASH, SHARE)
72
+ * @param limit Maximum number of Assets to return
73
+ * @param page Page number for pagination
74
+ * @param spaceName Name of Space to restrict search (mandatory if context is not ORGANIZATION)
75
+ * @param namespace Name of Namespace to restrict search
76
+ * @param parentId ID of parent (folder, etc.) to restrict search
77
+ * @param shareId ID of Share to restrict search (mandatory if context is SHARE)
78
+ * @param assetFilter Filter criteria for Assets
79
+ * @param sorting Sorting criteria for the results
80
+ * @returns List of found Assets
81
+ */
82
+ browse(_a, raw_1) {
83
+ return __awaiter(this, arguments, void 0, function* ({ orgName, spaceName, context, limit, page, namespace, parentId, shareId, assetFilter, sorting, }, raw) {
84
+ limit = limit !== null && limit !== void 0 ? limit : 100;
85
+ page = page !== null && page !== void 0 ? page : 0;
86
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/assets/browse`), Object.assign({ filters: assetFilter !== null && assetFilter !== void 0 ? assetFilter : [] }, (sorting ? { sorting } : {})), {
87
+ params: {
88
+ context,
89
+ limit,
90
+ page,
91
+ spaceName,
92
+ namespace,
93
+ parentId,
94
+ shareId,
95
+ },
96
+ });
97
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
98
+ });
99
+ }
66
100
  }
67
101
  exports.CosmoOrganization = CosmoOrganization;
@@ -1,5 +1,5 @@
1
1
  import Base, { MaybeRaw } from "../../../Base";
2
- import { High5SpaceInfo, CosmoSpace as ICosmoSpace, SpacePatchStorageDto, SpacePatchStorageValidationDto, SpaceUser, TrashPolicy } from "../../../interfaces/cosmo/space";
2
+ import { High5SpaceInfo, CosmoSpace as ICosmoSpace, SpaceUser, TrashPolicy } from "../../../interfaces/cosmo/space";
3
3
  /**
4
4
  * @class Space
5
5
  * @extends Base
@@ -128,28 +128,4 @@ export declare class CosmoSpace extends Base {
128
128
  updateTrashbinPolicy<R extends boolean = false>(orgName: string, spaceName: string, policy: TrashPolicy, raw?: {
129
129
  raw: R;
130
130
  }): Promise<MaybeRaw<R, ICosmoSpace>>;
131
- /**
132
- * Update the storage configuration of a Space.
133
- * @remarks
134
- * ** Under development, breaking changes possible**
135
- * @param orgName Name of the Organization
136
- * @param spaceName Name of the Space
137
- * @param storage New storage configuration for the Space
138
- * @returns The updated Space
139
- */
140
- patchStorage<R extends boolean = false>(orgName: string, spaceName: string, storage: SpacePatchStorageDto, raw?: {
141
- raw: R;
142
- }): Promise<MaybeRaw<R, ICosmoSpace>>;
143
- /**
144
- * Sets storage as valid or unvalid with errors.
145
- * @remarks
146
- * ** Under development, breaking changes possible**
147
- * @param orgName Name of the Organization
148
- * @param spaceName Name of the Space
149
- * @param storage Storage validation
150
- * @returns The updated Space
151
- */
152
- patchStorageValid<R extends boolean = false>(orgName: string, spaceName: string, storage: SpacePatchStorageValidationDto, raw?: {
153
- raw: R;
154
- }): Promise<MaybeRaw<R, ICosmoSpace>>;
155
131
  }
@@ -186,35 +186,5 @@ class CosmoSpace extends Base_1.default {
186
186
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
187
187
  });
188
188
  }
189
- /**
190
- * Update the storage configuration of a Space.
191
- * @remarks
192
- * ** Under development, breaking changes possible**
193
- * @param orgName Name of the Organization
194
- * @param spaceName Name of the Space
195
- * @param storage New storage configuration for the Space
196
- * @returns The updated Space
197
- */
198
- patchStorage(orgName, spaceName, storage, raw) {
199
- return __awaiter(this, void 0, void 0, function* () {
200
- const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/storage`), storage);
201
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
202
- });
203
- }
204
- /**
205
- * Sets storage as valid or unvalid with errors.
206
- * @remarks
207
- * ** Under development, breaking changes possible**
208
- * @param orgName Name of the Organization
209
- * @param spaceName Name of the Space
210
- * @param storage Storage validation
211
- * @returns The updated Space
212
- */
213
- patchStorageValid(orgName, spaceName, storage, raw) {
214
- return __awaiter(this, void 0, void 0, function* () {
215
- const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/storage/valid`), storage);
216
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
217
- });
218
- }
219
189
  }
220
190
  exports.CosmoSpace = CosmoSpace;
@@ -85,7 +85,7 @@ export default class Idp extends Base {
85
85
  * @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
86
86
  * or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
87
87
  */
88
- preLogin<R extends boolean = false>(email: string, origin: string, raw?: {
88
+ preLogin<R extends boolean = false>(email: string, origin: string, redirect?: "true" | "false", raw?: {
89
89
  raw: R;
90
90
  }): Promise<MaybeRaw<R, PreLoginResponse>>;
91
91
  /**
@@ -168,12 +168,13 @@ class Idp extends Base_1.default {
168
168
  * @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
169
169
  * or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
170
170
  */
171
- preLogin(email, origin, raw) {
171
+ preLogin(email, origin, redirect, raw) {
172
172
  return __awaiter(this, void 0, void 0, function* () {
173
173
  const resp = yield this.axios.get(this.getEndpoint("/v1/login/pre"), {
174
174
  params: {
175
175
  origin,
176
176
  email,
177
+ redirect,
177
178
  },
178
179
  });
179
180
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
@@ -5,6 +5,7 @@ import { IdpOrganizationMember } from "./member";
5
5
  import IdpOrganizationServiceAccounts from "./service-accounts";
6
6
  import IdpOrganizationSettings from "./settings";
7
7
  import { IdpOrganizationStat } from "./stat";
8
+ import { IdpOrganizationStorages } from "./storage";
8
9
  import { IdpOrganizationTeams } from "./team";
9
10
  export declare class IdpOrganization extends Base {
10
11
  /**
@@ -37,6 +38,11 @@ export declare class IdpOrganization extends Base {
37
38
  */
38
39
  get stat(): IdpOrganizationStat;
39
40
  private _stat?;
41
+ /**
42
+ * Handles everything around storage of organizations.
43
+ */
44
+ get storages(): IdpOrganizationStorages;
45
+ private _storages?;
40
46
  /**
41
47
  * Updates an Organization.
42
48
  * @param orgName Current name of the Organization
@@ -19,6 +19,7 @@ const member_1 = require("./member");
19
19
  const service_accounts_1 = __importDefault(require("./service-accounts"));
20
20
  const settings_1 = __importDefault(require("./settings"));
21
21
  const stat_1 = require("./stat");
22
+ const storage_1 = require("./storage");
22
23
  const team_1 = require("./team");
23
24
  class IdpOrganization extends Base_1.default {
24
25
  /**
@@ -75,6 +76,15 @@ class IdpOrganization extends Base_1.default {
75
76
  }
76
77
  return this._stat;
77
78
  }
79
+ /**
80
+ * Handles everything around storage of organizations.
81
+ */
82
+ get storages() {
83
+ if (this._storages === undefined) {
84
+ this._storages = new storage_1.IdpOrganizationStorages(this.options, this.axios);
85
+ }
86
+ return this._storages;
87
+ }
78
88
  /**
79
89
  * Updates an Organization.
80
90
  * @param orgName Current name of the Organization
@@ -0,0 +1,41 @@
1
+ import Base, { MaybeRaw } from "../../../../../../Base";
2
+ import { OIDCProvider, OIDCProviderCreateDto } from "../../../../../../interfaces/idp/organization/settings/domain/oidc";
3
+ export declare class IdpOIDCProvider extends Base {
4
+ /**
5
+ * Retrieves all OIDC providers associated with a given Organization.
6
+ * @param orgName Name of the Organization
7
+ * @returns Array of OIDC providers
8
+ */
9
+ getAllOIDCProvidersOfOrganization<R extends boolean = false>(orgName: string, raw?: {
10
+ raw: R;
11
+ }): Promise<MaybeRaw<R, OIDCProvider[]>>;
12
+ /**
13
+ * Creates a new OIDC provider for the specified domain.
14
+ * @param orgName Name of the Organization
15
+ * @param domainName Name of the Domain
16
+ * @param provider OIDC provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
17
+ * @returns The created OIDC provider
18
+ */
19
+ createProvider<R extends boolean = false>(orgName: string, domainName: string, provider: OIDCProviderCreateDto, raw?: {
20
+ raw: R;
21
+ }): Promise<MaybeRaw<R, OIDCProvider>>;
22
+ /**
23
+ * Patches a OIDC provider for the specified domain
24
+ * @param orgName Name of the Organization
25
+ * @param domainName Name of the Domain
26
+ * @param provider Parial OIDC provider object
27
+ * @returns The updated OIDC provider
28
+ */
29
+ patchProvider<R extends boolean = false>(orgName: string, domainName: string, provider: Partial<OIDCProviderCreateDto>, raw?: {
30
+ raw: R;
31
+ }): Promise<MaybeRaw<R, OIDCProvider>>;
32
+ /**
33
+ * Removes a OIDC provider from the specified domain
34
+ * @param orgName Name of the Organization
35
+ * @param domainName Name of the Domain
36
+ */
37
+ deleteProvider<R extends boolean = false>(orgName: string, domainName: string, raw?: {
38
+ raw: R;
39
+ }): Promise<MaybeRaw<R, void>>;
40
+ protected getEndpoint(endpoint: string): string;
41
+ }
@@ -0,0 +1,70 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.IdpOIDCProvider = void 0;
16
+ const Base_1 = __importDefault(require("../../../../../../Base"));
17
+ class IdpOIDCProvider extends Base_1.default {
18
+ /**
19
+ * Retrieves all OIDC providers associated with a given Organization.
20
+ * @param orgName Name of the Organization
21
+ * @returns Array of OIDC providers
22
+ */
23
+ getAllOIDCProvidersOfOrganization(orgName, raw) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/settings/domains/oidc`));
26
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
27
+ });
28
+ }
29
+ /**
30
+ * Creates a new OIDC provider for the specified domain.
31
+ * @param orgName Name of the Organization
32
+ * @param domainName Name of the Domain
33
+ * @param provider OIDC provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
34
+ * @returns The created OIDC provider
35
+ */
36
+ createProvider(orgName, domainName, provider, raw) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/oidc`), provider);
39
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
40
+ });
41
+ }
42
+ /**
43
+ * Patches a OIDC provider for the specified domain
44
+ * @param orgName Name of the Organization
45
+ * @param domainName Name of the Domain
46
+ * @param provider Parial OIDC provider object
47
+ * @returns The updated OIDC provider
48
+ */
49
+ patchProvider(orgName, domainName, provider, raw) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/oidc`), provider);
52
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
53
+ });
54
+ }
55
+ /**
56
+ * Removes a OIDC provider from the specified domain
57
+ * @param orgName Name of the Organization
58
+ * @param domainName Name of the Domain
59
+ */
60
+ deleteProvider(orgName, domainName, raw) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/oidc`));
63
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
64
+ });
65
+ }
66
+ getEndpoint(endpoint) {
67
+ return `${this.options.server}/api/account${endpoint}`;
68
+ }
69
+ }
70
+ exports.IdpOIDCProvider = IdpOIDCProvider;
@@ -0,0 +1,56 @@
1
+ import Base, { MaybeRaw } from "../../../../Base";
2
+ import { PaginatedResponse, SearchFilter, Sorting } from "../../../../interfaces/global";
3
+ import { StorageConfiguration, StorageCreateDto, StorageDto, StoragePatchDto } from "../../../../interfaces/global/Storage";
4
+ export declare class IdpOrganizationStorages extends Base {
5
+ /**
6
+ * Creates a new Storage in the specified Organization.
7
+ * @param orgName Name of the Organization
8
+ * @param storageCreate Storage creation data
9
+ * @returns The created Storage
10
+ */
11
+ createStorage<R extends boolean = false>(orgName: string, storageCreate: StorageCreateDto, raw?: {
12
+ raw: R;
13
+ }): Promise<MaybeRaw<R, StorageDto>>;
14
+ /**
15
+ * Updates an existing Storage.
16
+ * @param orgName Name of the Organization
17
+ * @param storageId ID of the Storage
18
+ * @param storagePatchDto Storage patch data
19
+ * @param raw (optional) If true, returns the raw Axios response instead of the data
20
+ * @returns The updated Storage object
21
+ */
22
+ patchStorage<R extends boolean = false>(orgName: string, storageId: string, storagePatchDto: StoragePatchDto, raw?: {
23
+ raw: R;
24
+ }): Promise<MaybeRaw<R, StorageDto>>;
25
+ /**
26
+ * Retrieves all Storages of an Organization that match the provided search filter(s). Returns all Storages if no search filter is provided.
27
+ * @param orgName Name of the organization
28
+ * @param filters (optional) Array of search filters
29
+ * @param sorting (optional) Sorting object
30
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
31
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
32
+ * @returns Object containing an array of Storages and the total number of results found in the database (independent of limit and page)
33
+ */
34
+ searchStorages<R extends boolean = false>(params: {
35
+ orgName: string;
36
+ filters: SearchFilter[];
37
+ sorting?: Sorting;
38
+ limit?: number;
39
+ page?: number;
40
+ }, raw?: {
41
+ raw: R;
42
+ }): Promise<MaybeRaw<R, PaginatedResponse<StorageDto>>>;
43
+ /**
44
+ * Retrieves the Storage configuration for the specified Storage ID or the default Storage if no ID is provided. Requires a Personal Access Token (PAT) with appropriate permissions.
45
+ *
46
+ * @param pat Personal Access Token
47
+ * @param storageId (optional) ID of storage. If not provided or "default", retrieves the default storage configuration.
48
+ * @param decrypt (optional) If true, decrypts the storage configuration
49
+ * @param raw (optional) If true, returns the raw Axios response instead of the data
50
+ * @returns The Storage configuration
51
+ */
52
+ getStorageConfig<R extends boolean = false>(pat: string, storageId?: string, decrypt?: boolean, raw?: {
53
+ raw: R;
54
+ }): Promise<MaybeRaw<R, StorageConfiguration>>;
55
+ protected getEndpoint(endpoint: string): string;
56
+ }
@@ -0,0 +1,93 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.IdpOrganizationStorages = void 0;
16
+ const Base_1 = __importDefault(require("../../../../Base"));
17
+ const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
18
+ const searchFilter_1 = require("../../../../helper/searchFilter");
19
+ class IdpOrganizationStorages extends Base_1.default {
20
+ /**
21
+ * Creates a new Storage in the specified Organization.
22
+ * @param orgName Name of the Organization
23
+ * @param storageCreate Storage creation data
24
+ * @returns The created Storage
25
+ */
26
+ createStorage(orgName, storageCreate, raw) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const resp = yield this.axios.post(this.getEndpoint(`/${orgName}/storage`), storageCreate);
29
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
30
+ });
31
+ }
32
+ /**
33
+ * Updates an existing Storage.
34
+ * @param orgName Name of the Organization
35
+ * @param storageId ID of the Storage
36
+ * @param storagePatchDto Storage patch data
37
+ * @param raw (optional) If true, returns the raw Axios response instead of the data
38
+ * @returns The updated Storage object
39
+ */
40
+ patchStorage(orgName, storageId, storagePatchDto, raw) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ const resp = yield this.axios.patch(this.getEndpoint(`/${orgName}/storage/${storageId}`), storagePatchDto);
43
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
44
+ });
45
+ }
46
+ /**
47
+ * Retrieves all Storages of an Organization that match the provided search filter(s). Returns all Storages if no search filter is provided.
48
+ * @param orgName Name of the organization
49
+ * @param filters (optional) Array of search filters
50
+ * @param sorting (optional) Sorting object
51
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
52
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
53
+ * @returns Object containing an array of Storages and the total number of results found in the database (independent of limit and page)
54
+ */
55
+ searchStorages(params, raw) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const limit = params.limit || 25;
58
+ const page = params.page || 0;
59
+ const filtersDTO = params.filters.map((f) => {
60
+ return new searchFilter_1.SearchFilterDTO(f);
61
+ });
62
+ const resp = yield this.axios.post(this.getEndpoint(`/${params.orgName}/storage/search?limit=${limit}&page=${page}`), {
63
+ filters: filtersDTO,
64
+ sorting: params.sorting,
65
+ });
66
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? Object.assign(Object.assign({}, resp), { data: (0, paginatedResponseHelper_1.createPaginatedResponse)(resp) }) : (0, paginatedResponseHelper_1.createPaginatedResponse)(resp));
67
+ });
68
+ }
69
+ /**
70
+ * Retrieves the Storage configuration for the specified Storage ID or the default Storage if no ID is provided. Requires a Personal Access Token (PAT) with appropriate permissions.
71
+ *
72
+ * @param pat Personal Access Token
73
+ * @param storageId (optional) ID of storage. If not provided or "default", retrieves the default storage configuration.
74
+ * @param decrypt (optional) If true, decrypts the storage configuration
75
+ * @param raw (optional) If true, returns the raw Axios response instead of the data
76
+ * @returns The Storage configuration
77
+ */
78
+ getStorageConfig(pat_1) {
79
+ return __awaiter(this, arguments, void 0, function* (pat, storageId = "default", decrypt = false, raw) {
80
+ const resp = yield this.axios.get(`${this.options.server}/api/account/v1/storage/${storageId}?decrypt=${decrypt}`, {
81
+ headers: {
82
+ Authorization: `Bearer ${pat}`,
83
+ "x-hcloud-login-enforce": "true",
84
+ },
85
+ });
86
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
87
+ });
88
+ }
89
+ getEndpoint(endpoint) {
90
+ return `${this.options.server}/api/account/v1/org${endpoint}`;
91
+ }
92
+ }
93
+ exports.IdpOrganizationStorages = IdpOrganizationStorages;
@@ -85,19 +85,18 @@ class Nats extends Base_1.default {
85
85
  }
86
86
  return;
87
87
  }
88
- let parsedData;
88
+ let parsedData = undefined;
89
89
  try {
90
90
  const data = new TextDecoder("utf-8").decode(msg.data);
91
91
  parsedData = JSON.parse(data);
92
92
  }
93
- catch (e) {
94
- callback(e);
95
- return;
93
+ catch (_b) {
94
+ // if the message is not JSON just pass the raw message
96
95
  }
97
96
  try {
98
97
  callback(null, parsedData, msg);
99
98
  }
100
- catch (_b) {
99
+ catch (_c) {
101
100
  // ignore callback errors
102
101
  }
103
102
  } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",