hcloud-sdk 20.4.0 → 21.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 (39) hide show
  1. package/changelog.md +28 -2
  2. package/lib/helper/ValidationHelper.js +1 -1
  3. package/lib/interfaces/cosmo/asset/index.d.ts +12 -3
  4. package/lib/interfaces/cosmo/asset/index.js +1 -0
  5. package/lib/interfaces/cosmo/comment/index.d.ts +19 -2
  6. package/lib/interfaces/cosmo/comment/index.js +17 -1
  7. package/lib/interfaces/cosmo/share/index.d.ts +19 -0
  8. package/lib/interfaces/cosmo/share/index.js +13 -1
  9. package/lib/interfaces/cosmo/space/index.d.ts +32 -0
  10. package/lib/interfaces/cosmo/space/index.js +6 -0
  11. package/lib/interfaces/high5/space/database/document/index.d.ts +14 -6
  12. package/lib/interfaces/high5/space/database/document/index.js +1 -0
  13. package/lib/interfaces/high5/space/job/index.d.ts +9 -10
  14. package/lib/interfaces/high5/space/job/index.js +2 -1
  15. package/lib/interfaces/idp/organization/index.d.ts +1 -1
  16. package/lib/interfaces/idp/organization/index.js +1 -1
  17. package/lib/interfaces/mailer/index.d.ts +76 -20
  18. package/lib/interfaces/mailer/index.js +244 -49
  19. package/lib/interfaces/nats/index.d.ts +4 -0
  20. package/lib/interfaces/nats/index.js +5 -0
  21. package/lib/service/cosmo/asset/index.d.ts +43 -1
  22. package/lib/service/cosmo/asset/index.js +48 -0
  23. package/lib/service/cosmo/index.d.ts +3 -0
  24. package/lib/service/cosmo/index.js +7 -0
  25. package/lib/service/cosmo/share/index.d.ts +15 -7
  26. package/lib/service/cosmo/share/index.js +17 -7
  27. package/lib/service/cosmo/space/index.d.ts +25 -1
  28. package/lib/service/cosmo/space/index.js +30 -0
  29. package/lib/service/cosmo/stack/index.d.ts +68 -0
  30. package/lib/service/cosmo/stack/index.js +102 -0
  31. package/lib/service/high5/space/database/document/{array → collection}/index.d.ts +25 -1
  32. package/lib/service/high5/space/database/document/{array → collection}/index.js +33 -3
  33. package/lib/service/high5/space/database/document/index.d.ts +16 -4
  34. package/lib/service/high5/space/database/document/index.js +20 -5
  35. package/lib/service/high5/space/job/index.d.ts +3 -2
  36. package/lib/service/high5/space/job/index.js +3 -2
  37. package/lib/service/mailer/internal/index.d.ts +12 -3
  38. package/lib/service/mailer/internal/index.js +13 -1
  39. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import Base, { MaybeRaw } from "../../../Base";
2
- import { Share, ShareCreate, SharePatch, ShareWithUsers } from "../../../interfaces/cosmo/share";
2
+ import { EmailCooldown, Share, ShareCreate, SharePatch, ShareWithUsers } from "../../../interfaces/cosmo/share";
3
3
  import { SearchFilter, Sorting } from "../../../interfaces/global";
4
4
  /**
5
5
  * @class Share
@@ -135,25 +135,32 @@ export declare class CosmoShare extends Base {
135
135
  * This will trigger the backend to re-send the share notification email
136
136
  * to every email address that has previously been invited to the share.
137
137
  *
138
- * @typeParam R - When `true`, the raw Axios response is returned instead of `undefined`
138
+ * Returns `undefined` when all emails were sent (204), or an {@link EmailCooldown}
139
+ * object when some recipients were skipped due to cooldown (200).
140
+ *
141
+ * @typeParam R - When `true`, the raw Axios response is returned instead of the parsed result
139
142
  *
140
143
  * @param orgName - The organization identifier
141
144
  * @param spaceName - The space identifier within the organization
142
145
  * @param shareId - The share ID whose emails should be resent
143
146
  * @param raw - Optional flag to return the raw Axios response
144
147
  *
145
- * @returns `undefined` by default, or the raw Axios response when `raw.raw` is `true`
148
+ * @returns `EmailCooldown` when some emails were skipped, `undefined` when all were sent,
149
+ * or the raw Axios response when `raw.raw` is `true`
146
150
  */
147
151
  resendAllEmails<R extends boolean = false>(orgName: string, spaceName: string, shareId: string, raw?: {
148
152
  raw: R;
149
- }): Promise<MaybeRaw<R, undefined>>;
153
+ }): Promise<MaybeRaw<R, EmailCooldown | undefined>>;
150
154
  /**
151
155
  * Resends share emails to **specific recipients** for a share.
152
156
  *
153
157
  * Only the provided email addresses will receive a new share notification.
154
158
  * At least one email address must be provided.
155
159
  *
156
- * @typeParam R - When `true`, the raw Axios response is returned instead of `undefined`
160
+ * Returns `undefined` when all emails were sent (204), or an {@link EmailCooldown}
161
+ * object when some recipients were skipped due to cooldown (200).
162
+ *
163
+ * @typeParam R - When `true`, the raw Axios response is returned instead of the parsed result
157
164
  *
158
165
  * @param orgName - The organization identifier
159
166
  * @param spaceName - The space identifier within the organization
@@ -161,11 +168,12 @@ export declare class CosmoShare extends Base {
161
168
  * @param emails - A non-empty list of email addresses to resend the share to
162
169
  * @param raw - Optional flag to return the raw Axios response
163
170
  *
164
- * @returns `undefined` by default, or the raw Axios response when `raw.raw` is `true`
171
+ * @returns `EmailCooldown` when some emails were skipped, `undefined` when all were sent,
172
+ * or the raw Axios response when `raw.raw` is `true`
165
173
  */
166
174
  resendEmails<R extends boolean = false>(orgName: string, spaceName: string, shareId: string, emails: [string, ...string[]], raw?: {
167
175
  raw: R;
168
- }): Promise<MaybeRaw<R, undefined>>;
176
+ }): Promise<MaybeRaw<R, EmailCooldown | undefined>>;
169
177
  /**
170
178
  * Sends a share email to a **specific recipient** after he clicks a public link.
171
179
  *
@@ -186,19 +186,23 @@ class CosmoShare extends Base_1.default {
186
186
  * This will trigger the backend to re-send the share notification email
187
187
  * to every email address that has previously been invited to the share.
188
188
  *
189
- * @typeParam R - When `true`, the raw Axios response is returned instead of `undefined`
189
+ * Returns `undefined` when all emails were sent (204), or an {@link EmailCooldown}
190
+ * object when some recipients were skipped due to cooldown (200).
191
+ *
192
+ * @typeParam R - When `true`, the raw Axios response is returned instead of the parsed result
190
193
  *
191
194
  * @param orgName - The organization identifier
192
195
  * @param spaceName - The space identifier within the organization
193
196
  * @param shareId - The share ID whose emails should be resent
194
197
  * @param raw - Optional flag to return the raw Axios response
195
198
  *
196
- * @returns `undefined` by default, or the raw Axios response when `raw.raw` is `true`
199
+ * @returns `EmailCooldown` when some emails were skipped, `undefined` when all were sent,
200
+ * or the raw Axios response when `raw.raw` is `true`
197
201
  */
198
202
  resendAllEmails(orgName, spaceName, shareId, raw) {
199
203
  return __awaiter(this, void 0, void 0, function* () {
200
204
  const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/shares/${shareId}/email/all`));
201
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
205
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.status === 200 ? resp.data : undefined);
202
206
  });
203
207
  }
204
208
  /**
@@ -207,7 +211,10 @@ class CosmoShare extends Base_1.default {
207
211
  * Only the provided email addresses will receive a new share notification.
208
212
  * At least one email address must be provided.
209
213
  *
210
- * @typeParam R - When `true`, the raw Axios response is returned instead of `undefined`
214
+ * Returns `undefined` when all emails were sent (204), or an {@link EmailCooldown}
215
+ * object when some recipients were skipped due to cooldown (200).
216
+ *
217
+ * @typeParam R - When `true`, the raw Axios response is returned instead of the parsed result
211
218
  *
212
219
  * @param orgName - The organization identifier
213
220
  * @param spaceName - The space identifier within the organization
@@ -215,12 +222,15 @@ class CosmoShare extends Base_1.default {
215
222
  * @param emails - A non-empty list of email addresses to resend the share to
216
223
  * @param raw - Optional flag to return the raw Axios response
217
224
  *
218
- * @returns `undefined` by default, or the raw Axios response when `raw.raw` is `true`
225
+ * @returns `EmailCooldown` when some emails were skipped, `undefined` when all were sent,
226
+ * or the raw Axios response when `raw.raw` is `true`
219
227
  */
220
228
  resendEmails(orgName, spaceName, shareId, emails, raw) {
221
229
  return __awaiter(this, void 0, void 0, function* () {
222
- const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/shares/${shareId}/email`), { emails });
223
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
230
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/shares/${shareId}/email`), {
231
+ emails,
232
+ });
233
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.status === 200 ? resp.data : undefined);
224
234
  });
225
235
  }
226
236
  /**
@@ -1,5 +1,5 @@
1
1
  import Base, { MaybeRaw } from "../../../Base";
2
- import { High5SpaceInfo, CosmoSpace as ICosmoSpace, SpaceUser, TrashPolicy } from "../../../interfaces/cosmo/space";
2
+ import { High5SpaceInfo, CosmoSpace as ICosmoSpace, SpacePatchStorageDto, SpacePatchStorageValidationDto, SpaceUser, TrashPolicy } from "../../../interfaces/cosmo/space";
3
3
  /**
4
4
  * @class Space
5
5
  * @extends Base
@@ -128,4 +128,28 @@ 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>>;
131
155
  }
@@ -186,5 +186,35 @@ 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
+ }
189
219
  }
190
220
  exports.CosmoSpace = CosmoSpace;
@@ -0,0 +1,68 @@
1
+ import Base, { MaybeRaw } from "../../../Base";
2
+ import { Stack } from "../../../interfaces/cosmo/asset";
3
+ export declare class CosmoStack extends Base {
4
+ /**
5
+ * Create a new Stack in Cosmo inside the specified Organization and Space.
6
+ *
7
+ * @param organizationName Name of the Organization
8
+ * @param spaceName Name of the Space
9
+ * @param assetIds Array of Asset IDs to include in the Stack
10
+ * @param raw (optional) If true, returns the raw Axios response
11
+ * @returns The created Stack
12
+ */
13
+ createStack<R extends boolean = false>(organizationName: string, spaceName: string, assetIds: [string, string, ...string[]], raw?: {
14
+ raw: R;
15
+ }): Promise<MaybeRaw<R, Stack>>;
16
+ /**
17
+ * Attach an Asset to an existing Stack in Cosmo.
18
+ *
19
+ * @param organizationName Name of the Organization
20
+ * @param spaceName Name of the Space
21
+ * @param stackId ID of the Stack
22
+ * @param assetId ID of the Asset to attach
23
+ * @param raw (optional) If true, returns the raw Axios response
24
+ * @returns The updated Stack
25
+ */
26
+ attachAssetToStack<R extends boolean = false>(organizationName: string, spaceName: string, stackId: string, assetId: string, raw?: {
27
+ raw: R;
28
+ }): Promise<MaybeRaw<R, Stack>>;
29
+ /**
30
+ * Detach an Asset from a Stack in Cosmo.
31
+ *
32
+ * @param organizationName Name of the Organization
33
+ * @param spaceName Name of the Space
34
+ * @param stackId ID of the Stack
35
+ * @param assetId ID of the Asset to detach
36
+ * @param raw (optional) If true, returns the raw Axios response
37
+ * @returns The updated Stack
38
+ */
39
+ detachAssetFromStack<R extends boolean = false>(organizationName: string, spaceName: string, stackId: string, assetId: string, raw?: {
40
+ raw: R;
41
+ }): Promise<MaybeRaw<R, Stack>>;
42
+ /**
43
+ * Reorder the Assets in a Stack in Cosmo.
44
+ *
45
+ * @param organizationName Name of the Organization
46
+ * @param spaceName Name of the Space
47
+ * @param stackId ID of the Stack
48
+ * @param assetIds New ordered array of Asset IDs
49
+ * @param raw (optional) If true, returns the raw Axios response
50
+ * @returns The updated Stack with reordered Assets
51
+ */
52
+ reorderStack<R extends boolean = false>(organizationName: string, spaceName: string, stackId: string, assetIds: [string, string, ...string[]], raw?: {
53
+ raw: R;
54
+ }): Promise<MaybeRaw<R, Stack>>;
55
+ /**
56
+ * Disband (delete) a Stack in Cosmo.
57
+ *
58
+ * @param organizationName Name of the Organization
59
+ * @param spaceName Name of the Space
60
+ * @param stackId ID of the Stack to delete
61
+ * @param raw (optional) If true, returns the raw Axios response
62
+ * @returns void
63
+ */
64
+ disbandStack<R extends boolean = false>(organizationName: string, spaceName: string, stackId: string, raw?: {
65
+ raw: R;
66
+ }): Promise<MaybeRaw<R, void>>;
67
+ protected getEndpoint(endpoint: string): string;
68
+ }
@@ -0,0 +1,102 @@
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.CosmoStack = void 0;
16
+ const Base_1 = __importDefault(require("../../../Base"));
17
+ class CosmoStack extends Base_1.default {
18
+ /**
19
+ * Create a new Stack in Cosmo inside the specified Organization and Space.
20
+ *
21
+ * @param organizationName Name of the Organization
22
+ * @param spaceName Name of the Space
23
+ * @param assetIds Array of Asset IDs to include in the Stack
24
+ * @param raw (optional) If true, returns the raw Axios response
25
+ * @returns The created Stack
26
+ */
27
+ createStack(organizationName, spaceName, assetIds, raw) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${organizationName}/spaces/${spaceName}/stacks`), { assetIds });
30
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
31
+ });
32
+ }
33
+ /**
34
+ * Attach an Asset to an existing Stack in Cosmo.
35
+ *
36
+ * @param organizationName Name of the Organization
37
+ * @param spaceName Name of the Space
38
+ * @param stackId ID of the Stack
39
+ * @param assetId ID of the Asset to attach
40
+ * @param raw (optional) If true, returns the raw Axios response
41
+ * @returns The updated Stack
42
+ */
43
+ attachAssetToStack(organizationName, spaceName, stackId, assetId, raw) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${organizationName}/spaces/${spaceName}/stacks/${stackId}/assets/${assetId}`));
46
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
47
+ });
48
+ }
49
+ /**
50
+ * Detach an Asset from a Stack in Cosmo.
51
+ *
52
+ * @param organizationName Name of the Organization
53
+ * @param spaceName Name of the Space
54
+ * @param stackId ID of the Stack
55
+ * @param assetId ID of the Asset to detach
56
+ * @param raw (optional) If true, returns the raw Axios response
57
+ * @returns The updated Stack
58
+ */
59
+ detachAssetFromStack(organizationName, spaceName, stackId, assetId, raw) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${organizationName}/spaces/${spaceName}/stacks/${stackId}/assets/${assetId}`));
62
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
63
+ });
64
+ }
65
+ /**
66
+ * Reorder the Assets in a Stack in Cosmo.
67
+ *
68
+ * @param organizationName Name of the Organization
69
+ * @param spaceName Name of the Space
70
+ * @param stackId ID of the Stack
71
+ * @param assetIds New ordered array of Asset IDs
72
+ * @param raw (optional) If true, returns the raw Axios response
73
+ * @returns The updated Stack with reordered Assets
74
+ */
75
+ reorderStack(organizationName, spaceName, stackId, assetIds, raw) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${organizationName}/spaces/${spaceName}/stacks/${stackId}/order`), {
78
+ assetIds,
79
+ });
80
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
81
+ });
82
+ }
83
+ /**
84
+ * Disband (delete) a Stack in Cosmo.
85
+ *
86
+ * @param organizationName Name of the Organization
87
+ * @param spaceName Name of the Space
88
+ * @param stackId ID of the Stack to delete
89
+ * @param raw (optional) If true, returns the raw Axios response
90
+ * @returns void
91
+ */
92
+ disbandStack(organizationName, spaceName, stackId, raw) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${organizationName}/spaces/${spaceName}/stacks/${stackId}`));
95
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
96
+ });
97
+ }
98
+ getEndpoint(endpoint) {
99
+ return `${this.options.server}/api/cosmo${endpoint}`;
100
+ }
101
+ }
102
+ exports.CosmoStack = CosmoStack;
@@ -1,7 +1,7 @@
1
1
  import Base, { MaybeRaw } from "../../../../../../Base";
2
2
  import { PaginatedResponse, SearchParams } from "../../../../../../interfaces/global";
3
3
  import { Document } from "../../../../../../interfaces/high5";
4
- export declare class High5DocumentArray extends Base {
4
+ export declare class High5DocumentCollection extends Base {
5
5
  /**
6
6
  * Retrieves all items of a specified array document which match the provided search filter(s). Will return all items of the array if no filter is provided.
7
7
  * @param orgName Name of the Organization
@@ -69,5 +69,29 @@ export declare class High5DocumentArray extends Base {
69
69
  unshiftItems<R extends boolean = false>(orgName: string, spaceName: string, dbName: string, key: string, items: Array<unknown>, raw?: {
70
70
  raw: R;
71
71
  }): Promise<MaybeRaw<R, Document>>;
72
+ /**
73
+ * Add or update one or more key/value pairs inside an object document without replacing the entire value.
74
+ * @param orgName Name of the Organization
75
+ * @param spaceName Name of the Space
76
+ * @param dbName Name of the Database
77
+ * @param key Key of the Document
78
+ * @param pairs Key/value pairs to upsert into the object document
79
+ * @returns Updated Document
80
+ */
81
+ upsertObjectPairs<R extends boolean = false>(orgName: string, spaceName: string, dbName: string, key: string, pairs: Record<string, any>, raw?: {
82
+ raw: R;
83
+ }): Promise<MaybeRaw<R, Document>>;
84
+ /**
85
+ * Remove one or more keys from an object document.
86
+ * @param orgName Name of the Organization
87
+ * @param spaceName Name of the Space
88
+ * @param dbName Name of the Database
89
+ * @param key Key of the Document
90
+ * @param keys List of keys to remove from the object document
91
+ * @returns Updated Document
92
+ */
93
+ deleteObjectKeys<R extends boolean = false>(orgName: string, spaceName: string, dbName: string, key: string, keys: string[], raw?: {
94
+ raw: R;
95
+ }): Promise<MaybeRaw<R, Document>>;
72
96
  protected getEndpoint(endpoint: string): string;
73
97
  }
@@ -12,11 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.High5DocumentArray = void 0;
15
+ exports.High5DocumentCollection = void 0;
16
16
  const Base_1 = __importDefault(require("../../../../../../Base"));
17
17
  const paginatedResponseHelper_1 = require("../../../../../../helper/paginatedResponseHelper");
18
18
  const searchFilter_1 = require("../../../../../../helper/searchFilter");
19
- class High5DocumentArray extends Base_1.default {
19
+ class High5DocumentCollection extends Base_1.default {
20
20
  /**
21
21
  * Retrieves all items of a specified array document which match the provided search filter(s). Will return all items of the array if no filter is provided.
22
22
  * @param orgName Name of the Organization
@@ -98,8 +98,38 @@ class High5DocumentArray extends Base_1.default {
98
98
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
99
99
  });
100
100
  }
101
+ /**
102
+ * Add or update one or more key/value pairs inside an object document without replacing the entire value.
103
+ * @param orgName Name of the Organization
104
+ * @param spaceName Name of the Space
105
+ * @param dbName Name of the Database
106
+ * @param key Key of the Document
107
+ * @param pairs Key/value pairs to upsert into the object document
108
+ * @returns Updated Document
109
+ */
110
+ upsertObjectPairs(orgName, spaceName, dbName, key, pairs, raw) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents/${key}/partial`), { pairs });
113
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
114
+ });
115
+ }
116
+ /**
117
+ * Remove one or more keys from an object document.
118
+ * @param orgName Name of the Organization
119
+ * @param spaceName Name of the Space
120
+ * @param dbName Name of the Database
121
+ * @param key Key of the Document
122
+ * @param keys List of keys to remove from the object document
123
+ * @returns Updated Document
124
+ */
125
+ deleteObjectKeys(orgName, spaceName, dbName, key, keys, raw) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents/${key}/keys`), { keys });
128
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
129
+ });
130
+ }
101
131
  getEndpoint(endpoint) {
102
132
  return `${this.options.server}/api/high5${endpoint}`;
103
133
  }
104
134
  }
105
- exports.High5DocumentArray = High5DocumentArray;
135
+ exports.High5DocumentCollection = High5DocumentCollection;
@@ -1,13 +1,13 @@
1
1
  import Base, { MaybeRaw } from "../../../../../Base";
2
2
  import { PaginatedResponse, SearchParams } from "../../../../../interfaces/global";
3
- import { Document, DocumentCreateDto, DocumentPatchDto } from "../../../../../interfaces/high5";
4
- import { High5DocumentArray } from "./array";
3
+ import { Document, DocumentCreateDto, DocumentPatchDto, DocumentUpsertDto } from "../../../../../interfaces/high5";
4
+ import { High5DocumentCollection } from "./collection";
5
5
  import { High5DocumentNumber } from "./number";
6
6
  export declare class High5Document extends Base {
7
7
  get number(): High5DocumentNumber;
8
8
  private _number?;
9
- get array(): High5DocumentArray;
10
- private _array?;
9
+ get collection(): High5DocumentCollection;
10
+ private _collection?;
11
11
  /**
12
12
  * Retrieves all Documents of a High5 Database which match the provided search filter(s). Will return all Documents of the Database if no filter is provided.
13
13
  * @param orgName Name of the Organization
@@ -60,6 +60,18 @@ export declare class High5Document extends Base {
60
60
  updateDocument<R extends boolean = false>(orgName: string, spaceName: string, dbName: string, key: string, document: DocumentPatchDto, raw?: {
61
61
  raw: R;
62
62
  }): Promise<MaybeRaw<R, Document>>;
63
+ /**
64
+ * Creates the document if it does not exist, or updates it if it does
65
+ * @param orgName Name of the Organization
66
+ * @param spaceName Name of the Space
67
+ * @param dbName Name of the Database
68
+ * @param key Key of the Document
69
+ * @param document New value to upsert the Document
70
+ * @returns Updated or created Document
71
+ */
72
+ upsertDocument<R extends boolean = false>(orgName: string, spaceName: string, dbName: string, key: string, document: DocumentUpsertDto, raw?: {
73
+ raw: R;
74
+ }): Promise<MaybeRaw<R, Document>>;
63
75
  /**
64
76
  * Deletes a Document by its key.
65
77
  * @param orgName Name of the Organization
@@ -16,7 +16,7 @@ exports.High5Document = void 0;
16
16
  const Base_1 = __importDefault(require("../../../../../Base"));
17
17
  const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
18
18
  const searchFilter_1 = require("../../../../../helper/searchFilter");
19
- const array_1 = require("./array");
19
+ const collection_1 = require("./collection");
20
20
  const number_1 = require("./number");
21
21
  class High5Document extends Base_1.default {
22
22
  get number() {
@@ -25,11 +25,11 @@ class High5Document extends Base_1.default {
25
25
  }
26
26
  return this._number;
27
27
  }
28
- get array() {
29
- if (this._array === undefined) {
30
- this._array = new array_1.High5DocumentArray(this.options, this.axios);
28
+ get collection() {
29
+ if (this._collection === undefined) {
30
+ this._collection = new collection_1.High5DocumentCollection(this.options, this.axios);
31
31
  }
32
- return this._array;
32
+ return this._collection;
33
33
  }
34
34
  /**
35
35
  * Retrieves all Documents of a High5 Database which match the provided search filter(s). Will return all Documents of the Database if no filter is provided.
@@ -95,6 +95,21 @@ class High5Document extends Base_1.default {
95
95
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
96
96
  });
97
97
  }
98
+ /**
99
+ * Creates the document if it does not exist, or updates it if it does
100
+ * @param orgName Name of the Organization
101
+ * @param spaceName Name of the Space
102
+ * @param dbName Name of the Database
103
+ * @param key Key of the Document
104
+ * @param document New value to upsert the Document
105
+ * @returns Updated or created Document
106
+ */
107
+ upsertDocument(orgName, spaceName, dbName, key, document, raw) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const resp = yield this.axios.put(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/databases/${dbName}/documents/${key}`), document);
110
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
111
+ });
112
+ }
98
113
  /**
99
114
  * Deletes a Document by its key.
100
115
  * @param orgName Name of the Organization
@@ -1,6 +1,6 @@
1
1
  import Base, { MaybeRaw } from "../../../../Base";
2
2
  import { PaginatedResponse, SearchParams } from "../../../../interfaces/global";
3
- import { Job, JobCreate } from "../../../../interfaces/high5/space/job";
3
+ import { CronjobType, Job, JobCreate } from "../../../../interfaces/high5/space/job";
4
4
  import { High5JobLogInternal } from "../../internal/space/job/log";
5
5
  import { High5JobLog } from "./log";
6
6
  export declare class High5Job extends Base {
@@ -59,9 +59,10 @@ export declare class High5Job extends Base {
59
59
  * @param jobId ID of the cronjob
60
60
  * @param expression New cron expression
61
61
  * @param exposeNextExecution (optional) Show the next execution as a Unix timestamp (in milliseconds) in the response object
62
+ * @param time (optional) Schedule selection preset used on frontend
62
63
  * @returns The patched cronjob
63
64
  */
64
- patchCronjobExpression<R extends boolean = false>(orgName: string, spaceName: string, jobId: string, expression: string, exposeNextExecution?: boolean, raw?: {
65
+ patchCronjobExpression<R extends boolean = false>(orgName: string, spaceName: string, jobId: string, expression: string, exposeNextExecution?: boolean, time?: CronjobType, raw?: {
65
66
  raw: R;
66
67
  }): Promise<MaybeRaw<R, Job>>;
67
68
  /**
@@ -94,11 +94,12 @@ class High5Job extends Base_1.default {
94
94
  * @param jobId ID of the cronjob
95
95
  * @param expression New cron expression
96
96
  * @param exposeNextExecution (optional) Show the next execution as a Unix timestamp (in milliseconds) in the response object
97
+ * @param time (optional) Schedule selection preset used on frontend
97
98
  * @returns The patched cronjob
98
99
  */
99
100
  patchCronjobExpression(orgName_1, spaceName_1, jobId_1, expression_1) {
100
- return __awaiter(this, arguments, void 0, function* (orgName, spaceName, jobId, expression, exposeNextExecution = false, raw) {
101
- const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/jobs/${jobId}/expression?nextExecution=${exposeNextExecution}`), { expression: expression });
101
+ return __awaiter(this, arguments, void 0, function* (orgName, spaceName, jobId, expression, exposeNextExecution = false, time, raw) {
102
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/jobs/${jobId}/expression?nextExecution=${exposeNextExecution}`), { expression, time });
102
103
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
103
104
  });
104
105
  }
@@ -1,13 +1,13 @@
1
1
  import Base, { MaybeRaw } from "../../../Base";
2
- import { HtmlMail, MailjetMailDTO, MailjetResponse, MustacheMail, TemplateMail } from "../../../interfaces/mailer";
2
+ import { HtmlMail, MailDTO, MailjetResponse, MustacheMail, ResendResponse, TemplateMail } from "../../../interfaces/mailer";
3
3
  export default class MailerInternal extends Base {
4
4
  /**
5
5
  * Sends a new mail based on a mailjet template.
6
6
  *
7
7
  * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
8
- * @param mail MailjetMailDTO
8
+ * @param mail MailDTO
9
9
  */
10
- sendMailMailjet<R extends boolean = false>(mail: MailjetMailDTO, raw?: {
10
+ sendMailMailjet<R extends boolean = false>(mail: MailDTO, raw?: {
11
11
  raw: R;
12
12
  }): Promise<MaybeRaw<R, MailjetResponse>>;
13
13
  /**
@@ -40,5 +40,14 @@ export default class MailerInternal extends Base {
40
40
  sendMailTemplate<R extends boolean = false>(mail: TemplateMail, raw?: {
41
41
  raw: R;
42
42
  }): Promise<MaybeRaw<R, void>>;
43
+ /**
44
+ * Sends a new mail based on an existing react-mail template using resend.com
45
+ *
46
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
47
+ * @param mail MailDTO
48
+ */
49
+ sendMailResend<R extends boolean = false>(mail: MailDTO, raw?: {
50
+ raw: R;
51
+ }): Promise<MaybeRaw<R, ResendResponse>>;
43
52
  protected getEndpoint(endpoint: string): string;
44
53
  }
@@ -18,7 +18,7 @@ class MailerInternal extends Base_1.default {
18
18
  * Sends a new mail based on a mailjet template.
19
19
  *
20
20
  * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
21
- * @param mail MailjetMailDTO
21
+ * @param mail MailDTO
22
22
  */
23
23
  sendMailMailjet(mail, raw) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
@@ -65,6 +65,18 @@ class MailerInternal extends Base_1.default {
65
65
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
66
66
  });
67
67
  }
68
+ /**
69
+ * Sends a new mail based on an existing react-mail template using resend.com
70
+ *
71
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
72
+ * @param mail MailDTO
73
+ */
74
+ sendMailResend(mail, raw) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ const resp = yield this.axios.post(this.getEndpoint("/v1/send/resend"), mail);
77
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
78
+ });
79
+ }
68
80
  getEndpoint(endpoint) {
69
81
  return `${this.options.server}/api/mailer/internal${endpoint}`;
70
82
  }