hcloud-sdk 21.7.1 → 21.8.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.
- package/changelog.md +9 -2
- package/lib/helper/ValidationHelper.js +4 -1
- package/lib/interfaces/cosmo/asset/index.d.ts +1 -0
- package/lib/service/cosmo/space/index.d.ts +3 -1
- package/lib/service/dali/DaliAvatar.d.ts +6 -0
- package/lib/service/dali/DaliAvatar.js +10 -0
- package/lib/service/dali/avatar/DaliStorage.d.ts +33 -0
- package/lib/service/dali/avatar/DaliStorage.js +62 -0
- package/lib/service/idp/organization/storage/index.d.ts +10 -0
- package/lib/service/idp/organization/storage/index.js +17 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
## [21.
|
|
1
|
+
## [21.8.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v21.7.2...v21.8.0) (2026-07-13)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* add change storage avatar endpoint ([b393aac](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/b393aace86072b7a374b8fa5c98ae5b92bb1d1b7))
|
|
6
|
+
* extend list space endpoint response object by hasMediaAssets property ([530d44d](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/530d44db3fc5746ad089677bf9afc5c4cb0f1384))
|
|
7
|
+
* implement dali storage endpoints ([bf7983a](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/bf7983ae1c4cbdf9e40a293b54a9d03a011a862f))
|
|
8
|
+
* implements upload url variable in Upload object ([8997a44](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/8997a44e31ba3af0a69a8e4ef66f937ed878eb4b))
|
|
2
9
|
|
|
3
10
|
### Bug Fixes
|
|
4
11
|
|
|
5
|
-
*
|
|
12
|
+
* set explicit pnpm version for build ([078b2e1](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/078b2e151c99ea88d44b3d4a702b4e8085c59307))
|
|
@@ -145,7 +145,10 @@ const entityCollection = {
|
|
|
145
145
|
maxLength: 32,
|
|
146
146
|
},
|
|
147
147
|
[Entity.USER_ORGANIZATION_NAME]: {
|
|
148
|
-
|
|
148
|
+
// Allows Unicode letters (incl. ß, é, …) so email-style values like staßburg@test.de are accepted, plus combining marks, numbers, underscores, plus, at, dots, and hyphens
|
|
149
|
+
pattern: /^[\p{L}\p{M}0-9_+@.-]{3,255}$/u,
|
|
150
|
+
// Set explicitly because the auto-derivation in sanitize() rebuilds the char class without the /u flag, which breaks the \p{…} Unicode property escapes
|
|
151
|
+
symbols: /[\p{L}\p{M}0-9_+@.-]/u,
|
|
149
152
|
minLength: 3,
|
|
150
153
|
maxLength: 255,
|
|
151
154
|
},
|
|
@@ -33,7 +33,9 @@ export declare class CosmoSpace extends Base {
|
|
|
33
33
|
*/
|
|
34
34
|
listSpaces<R extends boolean = false>(orgName: string, limit: number, page: number, raw?: {
|
|
35
35
|
raw: R;
|
|
36
|
-
}): Promise<MaybeRaw<R, ICosmoSpace
|
|
36
|
+
}): Promise<MaybeRaw<R, (ICosmoSpace & {
|
|
37
|
+
hasMediaAssets: boolean;
|
|
38
|
+
})[]>>;
|
|
37
39
|
/**
|
|
38
40
|
* Fetch a single space by its Name.
|
|
39
41
|
* @remarks
|
|
@@ -5,6 +5,7 @@ import { DaliHigh5Space } from "./avatar/DaliHigh5Space";
|
|
|
5
5
|
import { DaliOAuthApp } from "./avatar/DaliOAuthApp";
|
|
6
6
|
import { DaliOrganization } from "./avatar/DaliOrganization";
|
|
7
7
|
import { DaliServiceAccount } from "./avatar/DaliServiceAccount";
|
|
8
|
+
import { DaliStorage } from "./avatar/DaliStorage";
|
|
8
9
|
import { DaliTeam } from "./avatar/DaliTeam";
|
|
9
10
|
import { DaliUser } from "./avatar/DaliUser";
|
|
10
11
|
export declare class DaliAvatar extends Base {
|
|
@@ -48,5 +49,10 @@ export declare class DaliAvatar extends Base {
|
|
|
48
49
|
*/
|
|
49
50
|
get oauth(): DaliOAuthApp;
|
|
50
51
|
private _oauth?;
|
|
52
|
+
/**
|
|
53
|
+
* Handles everything around storage avatars
|
|
54
|
+
*/
|
|
55
|
+
get storage(): DaliStorage;
|
|
56
|
+
private _storage?;
|
|
51
57
|
protected getEndpoint(endpoint: string): string;
|
|
52
58
|
}
|
|
@@ -11,6 +11,7 @@ const DaliHigh5Space_1 = require("./avatar/DaliHigh5Space");
|
|
|
11
11
|
const DaliOAuthApp_1 = require("./avatar/DaliOAuthApp");
|
|
12
12
|
const DaliOrganization_1 = require("./avatar/DaliOrganization");
|
|
13
13
|
const DaliServiceAccount_1 = require("./avatar/DaliServiceAccount");
|
|
14
|
+
const DaliStorage_1 = require("./avatar/DaliStorage");
|
|
14
15
|
const DaliTeam_1 = require("./avatar/DaliTeam");
|
|
15
16
|
const DaliUser_1 = require("./avatar/DaliUser");
|
|
16
17
|
class DaliAvatar extends Base_1.default {
|
|
@@ -86,6 +87,15 @@ class DaliAvatar extends Base_1.default {
|
|
|
86
87
|
}
|
|
87
88
|
return this._oauth;
|
|
88
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Handles everything around storage avatars
|
|
92
|
+
*/
|
|
93
|
+
get storage() {
|
|
94
|
+
if (this._storage === undefined) {
|
|
95
|
+
this._storage = new DaliStorage_1.DaliStorage(this.options, this.axios);
|
|
96
|
+
}
|
|
97
|
+
return this._storage;
|
|
98
|
+
}
|
|
89
99
|
getEndpoint(endpoint) {
|
|
90
100
|
return `${this.options.server}/api/dali${endpoint}`;
|
|
91
101
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { AvatarCreated } from "../../../interfaces/dali";
|
|
3
|
+
import { StorageDto } from "../../../interfaces/global/Storage";
|
|
4
|
+
export declare class DaliStorage extends Base {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a default avatar for the specified storage.
|
|
7
|
+
* @param orgName Name of the organization
|
|
8
|
+
* @param storageName Name of the storage
|
|
9
|
+
* @returns Public URL of the created avatar
|
|
10
|
+
*/
|
|
11
|
+
createAvatar<R extends boolean = false>(orgName: string, storageName: string, raw?: {
|
|
12
|
+
raw: R;
|
|
13
|
+
}): Promise<MaybeRaw<R, AvatarCreated>>;
|
|
14
|
+
/**
|
|
15
|
+
* Deletes the avatar of the storage from cloud storage. If you want to update it instead, use updateAvatar().
|
|
16
|
+
* @param orgName Name of the organization
|
|
17
|
+
* @param storageName Name of the storage
|
|
18
|
+
*/
|
|
19
|
+
deleteAvatar<R extends boolean = false>(orgName: string, storageName: string, raw?: {
|
|
20
|
+
raw: R;
|
|
21
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Updates the avatar of the specified storage.
|
|
24
|
+
* @param orgName Name of the organization
|
|
25
|
+
* @param storageName Name of the storage
|
|
26
|
+
* @param file Image as Javascript File
|
|
27
|
+
* @returns Public URL of the new avatar
|
|
28
|
+
*/
|
|
29
|
+
updateAvatar<R extends boolean = false>(orgName: string, storageName: string, file: File, raw?: {
|
|
30
|
+
raw: R;
|
|
31
|
+
}): Promise<MaybeRaw<R, StorageDto>>;
|
|
32
|
+
protected getEndpoint(endpoint: string): string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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.DaliStorage = void 0;
|
|
16
|
+
const Base_1 = __importDefault(require("../../../Base"));
|
|
17
|
+
class DaliStorage extends Base_1.default {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a default avatar for the specified storage.
|
|
20
|
+
* @param orgName Name of the organization
|
|
21
|
+
* @param storageName Name of the storage
|
|
22
|
+
* @returns Public URL of the created avatar
|
|
23
|
+
*/
|
|
24
|
+
createAvatar(orgName, storageName, raw) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/avatar/org/${orgName}/storages/${storageName}`), {});
|
|
27
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Deletes the avatar of the storage from cloud storage. If you want to update it instead, use updateAvatar().
|
|
32
|
+
* @param orgName Name of the organization
|
|
33
|
+
* @param storageName Name of the storage
|
|
34
|
+
*/
|
|
35
|
+
deleteAvatar(orgName, storageName, raw) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const resp = yield this.axios.delete(this.getEndpoint(`/v1/avatar/org/${orgName}/storages/${storageName}`));
|
|
38
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Updates the avatar of the specified storage.
|
|
43
|
+
* @param orgName Name of the organization
|
|
44
|
+
* @param storageName Name of the storage
|
|
45
|
+
* @param file Image as Javascript File
|
|
46
|
+
* @returns Public URL of the new avatar
|
|
47
|
+
*/
|
|
48
|
+
updateAvatar(orgName, storageName, file, raw) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const data = new FormData();
|
|
51
|
+
data.append("avatar", file);
|
|
52
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/avatar/org/${orgName}/storages/${storageName}`), data, {
|
|
53
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
54
|
+
});
|
|
55
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
getEndpoint(endpoint) {
|
|
59
|
+
return `${this.options.server}/api/dali${endpoint}`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.DaliStorage = DaliStorage;
|
|
@@ -52,5 +52,15 @@ export declare class IdpOrganizationStorages extends Base {
|
|
|
52
52
|
getStorageConfig<R extends boolean = false>(pat: string, storageId?: string, decrypt?: boolean, raw?: {
|
|
53
53
|
raw: R;
|
|
54
54
|
}): Promise<MaybeRaw<R, StorageConfiguration>>;
|
|
55
|
+
/**
|
|
56
|
+
* Updates the avatar of the specified storage
|
|
57
|
+
* @param orgName Name of the organization
|
|
58
|
+
* @param storageId ID of the storage
|
|
59
|
+
* @param file Image as Javascript File
|
|
60
|
+
* @returns Storage with updated avatarUrl
|
|
61
|
+
*/
|
|
62
|
+
updateAvatar<R extends boolean = false>(orgName: string, storageId: string, file: File, raw?: {
|
|
63
|
+
raw: R;
|
|
64
|
+
}): Promise<MaybeRaw<R, StorageDto>>;
|
|
55
65
|
protected getEndpoint(endpoint: string): string;
|
|
56
66
|
}
|
|
@@ -86,6 +86,23 @@ class IdpOrganizationStorages extends Base_1.default {
|
|
|
86
86
|
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Updates the avatar of the specified storage
|
|
91
|
+
* @param orgName Name of the organization
|
|
92
|
+
* @param storageId ID of the storage
|
|
93
|
+
* @param file Image as Javascript File
|
|
94
|
+
* @returns Storage with updated avatarUrl
|
|
95
|
+
*/
|
|
96
|
+
updateAvatar(orgName, storageId, file, raw) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const data = new FormData();
|
|
99
|
+
data.append("avatar", file);
|
|
100
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/${orgName}/storage/${storageId}/avatar`), data, {
|
|
101
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
102
|
+
});
|
|
103
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
89
106
|
getEndpoint(endpoint) {
|
|
90
107
|
return `${this.options.server}/api/account/v1/org${endpoint}`;
|
|
91
108
|
}
|