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,61 @@
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
+ exports.DaliHigh5Pool = void 0;
13
+ const Base_1 = require("../../../Base");
14
+ class DaliHigh5Pool extends Base_1.default {
15
+ /**
16
+ * Creates a default avatar for the specified High5 pool.
17
+ * @param orgName Name of the organization
18
+ * @param spaceName Name of the space
19
+ * @param poolName Name of the pool
20
+ * @returns Public URL of the created avatar
21
+ */
22
+ createAvatar(orgName, spaceName, poolName) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/avatar/org/${orgName}/spaces/high5/${spaceName}/pools/${poolName}`), {});
25
+ return resp.data;
26
+ });
27
+ }
28
+ /**
29
+ * Deletes the avatar of the High5 pool from cloud storage. If you want to update it instead, use updateAvatar().
30
+ * @param orgName Name of the organization
31
+ * @param spaceName Name of the space
32
+ * @param poolName Name of the pool
33
+ */
34
+ deleteAvatar(orgName, spaceName, poolName) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ yield this.axios.delete(this.getEndpoint(`/v1/avatar/org/${orgName}/spaces/high5/${spaceName}/pools/${poolName}`));
37
+ });
38
+ }
39
+ /**
40
+ * Updates the avatar of the specified High5 pool
41
+ * @param orgName Name of the organization
42
+ * @param spaceName Name of the space
43
+ * @param poolName Name of the pool
44
+ * @param file Image as Javascript File
45
+ * @returns Public URL of the new avatar
46
+ */
47
+ updateAvatar(orgName, spaceName, poolName, file) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ const data = new FormData();
50
+ data.append("avatar", file);
51
+ const resp = yield this.axios.put(this.getEndpoint(`/v1/avatar/org/${orgName}/spaces/high5/${spaceName}/pools/${poolName}`), data, {
52
+ headers: { "Content-Type": "multipart/form-data" },
53
+ });
54
+ return resp.data;
55
+ });
56
+ }
57
+ getEndpoint(endpoint) {
58
+ return `${this.options.server}/api/dali${endpoint}`;
59
+ }
60
+ }
61
+ exports.DaliHigh5Pool = DaliHigh5Pool;
@@ -1,6 +1,6 @@
1
1
  import Base from "../../../Base";
2
2
  import { AvatarCreated } from "../../../interfaces/dali";
3
- export declare class DaliHigh5 extends Base {
3
+ export declare class DaliHigh5Space extends Base {
4
4
  /**
5
5
  * Creates a default avatar for the specified High5 space.
6
6
  * @param orgName Name of the organization
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DaliHigh5 = void 0;
12
+ exports.DaliHigh5Space = void 0;
13
13
  const Base_1 = require("../../../Base");
14
- class DaliHigh5 extends Base_1.default {
14
+ class DaliHigh5Space extends Base_1.default {
15
15
  /**
16
16
  * Creates a default avatar for the specified High5 space.
17
17
  * @param orgName Name of the organization
@@ -55,4 +55,4 @@ class DaliHigh5 extends Base_1.default {
55
55
  return `${this.options.server}/api/dali${endpoint}`;
56
56
  }
57
57
  }
58
- exports.DaliHigh5 = DaliHigh5;
58
+ exports.DaliHigh5Space = DaliHigh5Space;
@@ -0,0 +1,26 @@
1
+ import Base from "../../../Base";
2
+ import { AvatarCreated } from "../../../interfaces/dali";
3
+ export declare class DaliServiceAccount extends Base {
4
+ /**
5
+ * Creates a default avatar for the specified service account.
6
+ * @param orgName Name of the organization
7
+ * @param serviceAccountId ID of the service account
8
+ * @returns Public URL of the created avatar
9
+ */
10
+ createAvatar(orgName: string, serviceAccountId: string): Promise<AvatarCreated>;
11
+ /**
12
+ * Deletes the avatar of the service account from cloud storage. If you want to update it instead, use updateAvatar().
13
+ * @param orgName Name of the organization
14
+ * @param serviceAccountId ID of the service account
15
+ */
16
+ deleteAvatar(orgName: string, serviceAccountId: string): Promise<void>;
17
+ /**
18
+ * Updates the avatar of the specified service account.
19
+ * @param orgName Name of the organization
20
+ * @param serviceAccountId ID of the service account
21
+ * @param file Image as Javascript File
22
+ * @returns Public URL of the new avatar
23
+ */
24
+ updateAvatar(orgName: string, serviceAccountId: string, file: File): Promise<AvatarCreated>;
25
+ protected getEndpoint(endpoint: string): string;
26
+ }
@@ -0,0 +1,58 @@
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
+ exports.DaliServiceAccount = void 0;
13
+ const Base_1 = require("../../../Base");
14
+ class DaliServiceAccount extends Base_1.default {
15
+ /**
16
+ * Creates a default avatar for the specified service account.
17
+ * @param orgName Name of the organization
18
+ * @param serviceAccountId ID of the service account
19
+ * @returns Public URL of the created avatar
20
+ */
21
+ createAvatar(orgName, serviceAccountId) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/avatar/org/${orgName}/service-accounts/${serviceAccountId}`), {});
24
+ return resp.data;
25
+ });
26
+ }
27
+ /**
28
+ * Deletes the avatar of the service account from cloud storage. If you want to update it instead, use updateAvatar().
29
+ * @param orgName Name of the organization
30
+ * @param serviceAccountId ID of the service account
31
+ */
32
+ deleteAvatar(orgName, serviceAccountId) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ yield this.axios.delete(this.getEndpoint(`/v1/avatar/org/${orgName}/service-accounts/${serviceAccountId}`));
35
+ });
36
+ }
37
+ /**
38
+ * Updates the avatar of the specified service account.
39
+ * @param orgName Name of the organization
40
+ * @param serviceAccountId ID of the service account
41
+ * @param file Image as Javascript File
42
+ * @returns Public URL of the new avatar
43
+ */
44
+ updateAvatar(orgName, serviceAccountId, file) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const data = new FormData();
47
+ data.append("avatar", file);
48
+ const resp = yield this.axios.put(this.getEndpoint(`/v1/avatar/org/${orgName}/service-accounts/${serviceAccountId}`), data, {
49
+ headers: { "Content-Type": "multipart/form-data" },
50
+ });
51
+ return resp.data;
52
+ });
53
+ }
54
+ getEndpoint(endpoint) {
55
+ return `${this.options.server}/api/dali${endpoint}`;
56
+ }
57
+ }
58
+ exports.DaliServiceAccount = DaliServiceAccount;
@@ -0,0 +1,13 @@
1
+ import Base from "../../Base";
2
+ import { Version } from "../../interfaces/global";
3
+ import { FridaySpace } from "./space";
4
+ export default class Friday extends Base {
5
+ get space(): FridaySpace;
6
+ private _space?;
7
+ /**
8
+ * Requests the endpoint version
9
+ * @returns Version object
10
+ */
11
+ version(): Promise<Version>;
12
+ protected getEndpoint(endpoint: string): string;
13
+ }
@@ -0,0 +1,35 @@
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 space_1 = require("./space");
14
+ class Friday extends Base_1.default {
15
+ get space() {
16
+ if (this._space === undefined) {
17
+ this._space = new space_1.FridaySpace(this.options, this.axios);
18
+ }
19
+ return this._space;
20
+ }
21
+ /**
22
+ * Requests the endpoint version
23
+ * @returns Version object
24
+ */
25
+ version() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
28
+ return resp.data;
29
+ });
30
+ }
31
+ getEndpoint(endpoint) {
32
+ return `${this.options.server}/api/friday${endpoint}`;
33
+ }
34
+ }
35
+ exports.default = Friday;
@@ -0,0 +1,58 @@
1
+ import Base from "../../../../../Base";
2
+ import { Document, DocumentCreateDto, DocumentPatchDto } from "../../../../../interfaces/friday";
3
+ import { PaginatedResponse, SearchParams } from "../../../../../interfaces/global";
4
+ export declare class FridayDocument extends Base {
5
+ /**
6
+ * Retrieves all Documents of a Friday Database which match the provided search filter(s). Will return all Documents of the Database if no filter is provided.
7
+ * @param orgName Name of the Organization
8
+ * @param spaceName Name of the Space
9
+ * @param dbName Name of the Database
10
+ * @param filters (optional) Array of search filters
11
+ * @param sorting (optional) Sorting object
12
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
13
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
14
+ * @returns Object containing an array of Documents and the total number of results found in the database (independent of limit and page)
15
+ */
16
+ searchDatabases({ orgName, spaceName, dbName, filters, sorting, limit, page, }: SearchParams & {
17
+ orgName: string;
18
+ spaceName: string;
19
+ dbName: string;
20
+ }): Promise<PaginatedResponse<Document>>;
21
+ /**
22
+ * Retrieves a Document by its name.
23
+ * @param orgName Name of the Organization
24
+ * @param spaceName Name of the Space
25
+ * @param dbName Name of the Database
26
+ * @param key Key of the Document
27
+ * @returns The requested Document
28
+ */
29
+ getDocument(orgName: string, spaceName: string, dbName: string, key: string): Promise<Document>;
30
+ /**
31
+ * Creates a new Document in the provided Database.
32
+ * @param orgName Name of the Organization
33
+ * @param spaceName Name of the Space
34
+ * @param dbName Name of the Database
35
+ * @param document New document details
36
+ * @returns The created Document
37
+ */
38
+ createDocument(orgName: string, spaceName: string, dbName: string, document: DocumentCreateDto): Promise<Document>;
39
+ /**
40
+ * Update existing Document
41
+ * @param orgName Name of the Organization
42
+ * @param spaceName Name of the Space
43
+ * @param dbName Name of the Database
44
+ * @param key Key of the Document
45
+ * @param document New value to update the Document
46
+ * @returns Updated Document
47
+ */
48
+ updateDocument(orgName: string, spaceName: string, dbName: string, key: string, document: DocumentPatchDto): Promise<Document>;
49
+ /**
50
+ * Deletes a Document by its key.
51
+ * @param orgName Name of the Organization
52
+ * @param spaceName Name of the Space
53
+ * @param dbName Name of the Database
54
+ * @param key Key of the Document
55
+ */
56
+ deleteDocument(orgName: string, spaceName: string, dbName: string, key: string): Promise<void>;
57
+ protected getEndpoint(endpoint: string): string;
58
+ }
@@ -0,0 +1,97 @@
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
+ exports.FridayDocument = void 0;
13
+ const Base_1 = require("../../../../../Base");
14
+ const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
15
+ const searchFilter_1 = require("../../../../../helper/searchFilter");
16
+ class FridayDocument extends Base_1.default {
17
+ /**
18
+ * Retrieves all Documents of a Friday Database which match the provided search filter(s). Will return all Documents of the Database if no filter is provided.
19
+ * @param orgName Name of the Organization
20
+ * @param spaceName Name of the Space
21
+ * @param dbName Name of the Database
22
+ * @param filters (optional) Array of search filters
23
+ * @param sorting (optional) Sorting object
24
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
25
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
26
+ * @returns Object containing an array of Documents and the total number of results found in the database (independent of limit and page)
27
+ */
28
+ searchDatabases(_a) {
29
+ return __awaiter(this, arguments, void 0, function* ({ orgName, spaceName, dbName, filters, sorting, limit = 25, page = 0, }) {
30
+ const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => new searchFilter_1.SearchFilterDTO(f));
31
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents/search?page=${page}&limit=${limit}`), {
32
+ filters: filtersDTO,
33
+ sorting: sorting,
34
+ });
35
+ return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
36
+ });
37
+ }
38
+ /**
39
+ * Retrieves a Document by its name.
40
+ * @param orgName Name of the Organization
41
+ * @param spaceName Name of the Space
42
+ * @param dbName Name of the Database
43
+ * @param key Key of the Document
44
+ * @returns The requested Document
45
+ */
46
+ getDocument(orgName, spaceName, dbName, key) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents/${key}`));
49
+ return resp.data;
50
+ });
51
+ }
52
+ /**
53
+ * Creates a new Document in the provided Database.
54
+ * @param orgName Name of the Organization
55
+ * @param spaceName Name of the Space
56
+ * @param dbName Name of the Database
57
+ * @param document New document details
58
+ * @returns The created Document
59
+ */
60
+ createDocument(orgName, spaceName, dbName, document) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents`), document);
63
+ return resp.data;
64
+ });
65
+ }
66
+ /**
67
+ * Update existing Document
68
+ * @param orgName Name of the Organization
69
+ * @param spaceName Name of the Space
70
+ * @param dbName Name of the Database
71
+ * @param key Key of the Document
72
+ * @param document New value to update the Document
73
+ * @returns Updated Document
74
+ */
75
+ updateDocument(orgName, spaceName, dbName, key, document) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents/${key}`), document);
78
+ return resp.data;
79
+ });
80
+ }
81
+ /**
82
+ * Deletes a Document by its key.
83
+ * @param orgName Name of the Organization
84
+ * @param spaceName Name of the Space
85
+ * @param dbName Name of the Database
86
+ * @param key Key of the Document
87
+ */
88
+ deleteDocument(orgName, spaceName, dbName, key) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents/${key}`));
91
+ });
92
+ }
93
+ getEndpoint(endpoint) {
94
+ return `${this.options.server}/api/friday${endpoint}`;
95
+ }
96
+ }
97
+ exports.FridayDocument = FridayDocument;
@@ -0,0 +1,55 @@
1
+ import Base from "../../../../Base";
2
+ import { Database } from "../../../../interfaces/friday";
3
+ import { PaginatedResponse, SearchParams } from "../../../../interfaces/global";
4
+ import { FridayDocument } from "./document";
5
+ export declare class FridayDatabase extends Base {
6
+ get document(): FridayDocument;
7
+ private _document?;
8
+ /**
9
+ * Retrieves all Databases of a Friday Space which match the provided search filter(s). Will return all Databases of the Space if no filter is provided.
10
+ * @param orgName Name of the Organization
11
+ * @param spaceName Name of the Space
12
+ * @param filters (optional) Array of search filters
13
+ * @param sorting (optional) Sorting object
14
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
15
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
16
+ * @returns Object containing an array of Databases and the total number of results found in the database (independent of limit and page)
17
+ */
18
+ searchDatabases({ orgName, spaceName, filters, sorting, limit, page, }: SearchParams & {
19
+ orgName: string;
20
+ spaceName: string;
21
+ }): Promise<PaginatedResponse<Database>>;
22
+ /**
23
+ * Retrieves a Database by its name.
24
+ * @param orgName Name of the Organization
25
+ * @param spaceName Name of the Space
26
+ * @param dbName Name of the Database
27
+ * @returns The requested Database
28
+ */
29
+ getDatabase(orgName: string, spaceName: string, dbName: string): Promise<Database>;
30
+ /**
31
+ * Creates a new Database in the provided Space.
32
+ * @param orgName Name of the Organization
33
+ * @param spaceName Name of the Space
34
+ * @param name Name of the new Database
35
+ * @returns The created Database
36
+ */
37
+ createDatabase(orgName: string, spaceName: string, name: string): Promise<Database>;
38
+ /**
39
+ * Rename a Database
40
+ * @param orgName Name of the Organization
41
+ * @param spaceName Name of the Space
42
+ * @param dbName Name of the Database
43
+ * @param name New name of the Database
44
+ * @returns Updated Database
45
+ */
46
+ renameDatabase(orgName: string, spaceName: string, dbName: string, name: string): Promise<Database>;
47
+ /**
48
+ * Deletes a Database by its name.
49
+ * @param orgName Name of the Organization
50
+ * @param spaceName Name of the Space
51
+ * @param dbName Name of the Database
52
+ */
53
+ deleteDatabase(orgName: string, spaceName: string, dbName: string): Promise<void>;
54
+ protected getEndpoint(endpoint: string): string;
55
+ }
@@ -0,0 +1,101 @@
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
+ exports.FridayDatabase = void 0;
13
+ const Base_1 = require("../../../../Base");
14
+ const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
15
+ const searchFilter_1 = require("../../../../helper/searchFilter");
16
+ const document_1 = require("./document");
17
+ class FridayDatabase extends Base_1.default {
18
+ get document() {
19
+ if (this._document === undefined) {
20
+ this._document = new document_1.FridayDocument(this.options, this.axios);
21
+ }
22
+ return this._document;
23
+ }
24
+ /**
25
+ * Retrieves all Databases of a Friday Space which match the provided search filter(s). Will return all Databases of the Space if no filter is provided.
26
+ * @param orgName Name of the Organization
27
+ * @param spaceName Name of the Space
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 Databases and the total number of results found in the database (independent of limit and page)
33
+ */
34
+ searchDatabases(_a) {
35
+ return __awaiter(this, arguments, void 0, function* ({ orgName, spaceName, filters, sorting, limit = 25, page = 0, }) {
36
+ const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => new searchFilter_1.SearchFilterDTO(f));
37
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/search?page=${page}&limit=${limit}`), {
38
+ filters: filtersDTO,
39
+ sorting: sorting,
40
+ });
41
+ return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
42
+ });
43
+ }
44
+ /**
45
+ * Retrieves a Database by its name.
46
+ * @param orgName Name of the Organization
47
+ * @param spaceName Name of the Space
48
+ * @param dbName Name of the Database
49
+ * @returns The requested Database
50
+ */
51
+ getDatabase(orgName, spaceName, dbName) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}`));
54
+ return resp.data;
55
+ });
56
+ }
57
+ /**
58
+ * Creates a new Database in the provided Space.
59
+ * @param orgName Name of the Organization
60
+ * @param spaceName Name of the Space
61
+ * @param name Name of the new Database
62
+ * @returns The created Database
63
+ */
64
+ createDatabase(orgName, spaceName, name) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases`), { name });
67
+ return resp.data;
68
+ });
69
+ }
70
+ /**
71
+ * Rename a Database
72
+ * @param orgName Name of the Organization
73
+ * @param spaceName Name of the Space
74
+ * @param dbName Name of the Database
75
+ * @param name New name of the Database
76
+ * @returns Updated Database
77
+ */
78
+ renameDatabase(orgName, spaceName, dbName, name) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/name`), {
81
+ name: name,
82
+ });
83
+ return resp.data;
84
+ });
85
+ }
86
+ /**
87
+ * Deletes a Database by its name.
88
+ * @param orgName Name of the Organization
89
+ * @param spaceName Name of the Space
90
+ * @param dbName Name of the Database
91
+ */
92
+ deleteDatabase(orgName, spaceName, dbName) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}`));
95
+ });
96
+ }
97
+ getEndpoint(endpoint) {
98
+ return `${this.options.server}/api/friday${endpoint}`;
99
+ }
100
+ }
101
+ exports.FridayDatabase = FridayDatabase;
@@ -0,0 +1,81 @@
1
+ import Base from "../../../Base";
2
+ import { FridaySpace as Space, FridaySpaceEntityPermission as SpaceEntityPermission, FridaySpacePermission as SpacePermission } from "../../../interfaces/friday/space";
3
+ import { PaginatedResponse, SearchParams } from "../../../interfaces/global";
4
+ import { FridayDatabase } from "./database";
5
+ export declare class FridaySpace extends Base {
6
+ get database(): FridayDatabase;
7
+ private _database?;
8
+ /**
9
+ * Retrieves all Friday Spaces of the specified Organization matching the search filter(s). Will return all Spaces if no search filter is provided.
10
+ * @param orgName Name of the organization
11
+ * @param filters (optional) Array of search filters
12
+ * @param sorting (optional) Sorting object
13
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
14
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
15
+ * @returns Object containing an array of Friday Spaces and the total number of results found in the database (independent of limit and page)
16
+ */
17
+ searchSpaces({ orgName, filters, sorting, limit, page }: SearchParams & {
18
+ orgName: string;
19
+ }): Promise<PaginatedResponse<Space>>;
20
+ /**
21
+ * Retrieves a Friday Space by its name.
22
+ * @param orgName Name of the Organization
23
+ * @param spaceName Name of the Friday Space
24
+ * @returns The requested Space
25
+ */
26
+ getSpace(orgName: string, spaceName: string): Promise<Space>;
27
+ /**
28
+ * Creates a new Friday Space in the specified Organization.
29
+ * @param orgName Name of the Organization
30
+ * @param name Name for the new Space
31
+ * @returns The created Space
32
+ */
33
+ createSpace(orgName: string, name: string): Promise<Space>;
34
+ /**
35
+ * Delete a space by its name.
36
+ * @param orgName Name of the Organization
37
+ * @param spaceName Name of the Space
38
+ */
39
+ deleteSpace(orgName: string, spaceName: string): Promise<void>;
40
+ /**
41
+ * Updates the name of a space.
42
+ * @param orgName Name of the organization
43
+ * @param spaceName Current name of the space
44
+ * @param newSpaceName New name for the space
45
+ * @returns The updated space
46
+ */
47
+ renameSpace(orgName: string, spaceName: string, newSpaceName: string): Promise<Space>;
48
+ /**
49
+ * Retrieves permissions of a space matching the search filter(s). Will return all permissions of the space if no search filter is provided.
50
+ * @param orgName Name of the organization
51
+ * @param spaceName Name of the space
52
+ * @param filters (optional) Array of search filters
53
+ * @param sorting (optional) Sorting object
54
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
55
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
56
+ * @returns Object containing an array of Friday Space Permissions and the total number of results found in the database (independent of limit and page)
57
+ */
58
+ searchSpacePermissions({ orgName, spaceName, filters, sorting, limit, page, }: SearchParams & {
59
+ orgName: string;
60
+ spaceName: string;
61
+ }): Promise<PaginatedResponse<SpaceEntityPermission>>;
62
+ /**
63
+ * Adds/Updates/Removes the permission a user has in the specified space.
64
+ * @param orgName Name of the Organization
65
+ * @param spaceName Name of the Space
66
+ * @param userId ID of the User
67
+ * @param permission New permission
68
+ * @returns The Space with updated permissions
69
+ */
70
+ updateUserSpacePermission(orgName: string, spaceName: string, userId: string, permission: SpacePermission): Promise<SpaceEntityPermission>;
71
+ /**
72
+ * Adds/Updates/Removes the permission a team has in the specified space. Note: A team cannot be an owner of a Space.
73
+ * @param orgName Name of the Organization
74
+ * @param spaceName Name of the Space
75
+ * @param teamName Name of the Team
76
+ * @param permission New permission
77
+ * @returns The Space with updated permissions
78
+ */
79
+ updateTeamSpacePermission(orgName: string, spaceName: string, teamName: string, permission: SpacePermission): Promise<SpaceEntityPermission>;
80
+ protected getEndpoint(endpoint: string): string;
81
+ }