hcloud-sdk 16.0.0 → 18.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.
- package/changelog.md +178 -51
- package/lib/Base.d.ts +2 -1
- package/lib/Hcloud.d.ts +6 -0
- package/lib/Hcloud.js +18 -0
- package/lib/helper/ValidationHelper.d.ts +74 -0
- package/lib/helper/ValidationHelper.js +360 -0
- package/lib/interfaces/auditor/index.d.ts +17 -2
- package/lib/interfaces/auditor/index.js +12 -0
- package/lib/interfaces/cosmo/asset/index.d.ts +185 -0
- package/lib/interfaces/cosmo/asset/index.js +82 -0
- package/lib/interfaces/cosmo/comment/index.d.ts +38 -0
- package/lib/interfaces/cosmo/comment/index.js +8 -0
- package/lib/interfaces/cosmo/event/index.d.ts +31 -0
- package/lib/interfaces/cosmo/event/index.js +17 -0
- package/lib/interfaces/cosmo/location/index.d.ts +4 -0
- package/lib/interfaces/cosmo/location/index.js +2 -0
- package/lib/interfaces/cosmo/namespace/index.d.ts +9 -0
- package/lib/interfaces/cosmo/namespace/index.js +9 -0
- package/lib/interfaces/cosmo/permissions.d.ts +96 -0
- package/lib/interfaces/cosmo/permissions.js +58 -0
- package/lib/interfaces/cosmo/share/index.d.ts +28 -0
- package/lib/interfaces/cosmo/share/index.js +2 -0
- package/lib/interfaces/cosmo/space/index.d.ts +25 -0
- package/lib/interfaces/cosmo/space/index.js +2 -0
- package/lib/interfaces/cosmo/tag/tag.d.ts +12 -0
- package/lib/interfaces/cosmo/tag/tag.js +2 -0
- package/lib/interfaces/frontend/config/index.d.ts +1 -0
- package/lib/interfaces/fuse/space/index.d.ts +1 -0
- package/lib/interfaces/global/Products.d.ts +3 -1
- package/lib/interfaces/global/Products.js +2 -0
- package/lib/interfaces/global/Views.d.ts +2 -1
- package/lib/interfaces/global/Views.js +1 -0
- package/lib/interfaces/high5/execution/index.d.ts +23 -2
- package/lib/interfaces/high5/execution/index.js +2 -0
- package/lib/interfaces/high5/index.d.ts +7 -7
- package/lib/interfaces/high5/index.js +7 -7
- package/lib/interfaces/high5/space/database/document/index.d.ts +34 -0
- package/lib/interfaces/high5/space/database/document/index.js +14 -0
- package/lib/interfaces/high5/space/database/index.d.ts +12 -0
- package/lib/interfaces/high5/space/database/index.js +2 -0
- package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +9 -2
- package/lib/interfaces/high5/space/event/stream/node/index.d.ts +10 -2
- package/lib/interfaces/high5/space/event/stream/node/index.js +6 -1
- package/lib/interfaces/high5/space/execution/index.d.ts +56 -2
- package/lib/interfaces/high5/space/execution/index.js +8 -0
- package/lib/interfaces/high5/space/index.d.ts +2 -0
- package/lib/interfaces/high5/space/job/JobLog.d.ts +16 -0
- package/lib/interfaces/high5/space/job/JobLog.js +2 -0
- package/lib/interfaces/high5/space/job/index.d.ts +38 -0
- package/lib/interfaces/high5/space/job/index.js +8 -0
- package/lib/interfaces/high5/space/pool/index.d.ts +5 -7
- package/lib/interfaces/high5/space/pool/index.js +0 -7
- package/lib/interfaces/high5/space/webhook/index.d.ts +3 -1
- package/lib/interfaces/high5/stats.d.ts +21 -0
- package/lib/interfaces/high5/stats.js +2 -0
- package/lib/interfaces/high5/wave/index.d.ts +8 -3
- package/lib/interfaces/idp/index.d.ts +1 -0
- package/lib/interfaces/idp/index.js +1 -0
- package/lib/interfaces/idp/oauth/index.d.ts +4 -3
- package/lib/interfaces/idp/organization/index.d.ts +1 -0
- package/lib/interfaces/idp/organization/index.js +1 -0
- package/lib/interfaces/idp/organization/license/index.d.ts +13 -0
- package/lib/interfaces/idp/organization/member/index.d.ts +2 -0
- package/lib/interfaces/idp/organization/service-accounts.d.ts +8 -0
- package/lib/interfaces/idp/organization/service-accounts.js +2 -0
- package/lib/interfaces/idp/organization/stats.d.ts +7 -0
- package/lib/interfaces/idp/organization/stats.js +2 -0
- package/lib/interfaces/idp/organization/team/index.d.ts +0 -1
- package/lib/interfaces/idp/user/GeneralSettings.d.ts +1 -0
- package/lib/interfaces/idp/user/GeneralSettings.js +1 -0
- package/lib/interfaces/idp/user/Message.d.ts +21 -0
- package/lib/interfaces/idp/user/Message.js +14 -0
- package/lib/interfaces/idp/user/NotificationSettings.d.ts +1 -0
- package/lib/interfaces/idp/user/Scopes.d.ts +8 -2
- package/lib/interfaces/idp/user/Scopes.js +9 -0
- package/lib/interfaces/idp/user/index.d.ts +2 -1
- package/lib/interfaces/mailer/index.d.ts +30 -1
- package/lib/interfaces/mailer/index.js +87 -1
- package/lib/interfaces/mothership/index.d.ts +3 -1
- package/lib/interfaces/mothership/index.js +15 -0
- package/lib/interfaces/mothership/stats.d.ts +4 -0
- package/lib/interfaces/mothership/stats.js +2 -0
- package/lib/interfaces/nats/index.d.ts +98 -9
- package/lib/interfaces/nats/index.js +136 -19
- package/lib/interfaces/shorts/index.d.ts +10 -0
- package/lib/interfaces/shorts/index.js +2 -0
- package/lib/service/agent/bundle/dev/index.d.ts +16 -6
- package/lib/service/agent/bundle/dev/index.js +12 -10
- package/lib/service/agent/bundle/index.d.ts +10 -4
- package/lib/service/agent/bundle/index.js +6 -6
- package/lib/service/agent/context/index.d.ts +26 -7
- package/lib/service/agent/context/index.js +27 -12
- package/lib/service/auditor/index.d.ts +8 -4
- package/lib/service/auditor/index.js +5 -5
- package/lib/service/auditor/internal/index.d.ts +27 -3
- package/lib/service/auditor/internal/index.js +34 -5
- package/lib/service/bouncer/features/index.d.ts +4 -2
- package/lib/service/bouncer/features/index.js +2 -2
- package/lib/service/cosmo/asset/index.d.ts +219 -0
- package/lib/service/cosmo/asset/index.js +314 -0
- package/lib/service/cosmo/comment/index.d.ts +122 -0
- package/lib/service/cosmo/comment/index.js +161 -0
- package/lib/service/cosmo/event/index.d.ts +23 -0
- package/lib/service/cosmo/event/index.js +40 -0
- package/lib/service/cosmo/folder/index.d.ts +27 -0
- package/lib/service/cosmo/folder/index.js +47 -0
- package/lib/service/cosmo/index.d.ts +49 -0
- package/lib/service/cosmo/index.js +119 -0
- package/lib/service/cosmo/internal/index.d.ts +7 -0
- package/lib/service/cosmo/internal/index.js +17 -0
- package/lib/service/cosmo/internal/space/index.d.ts +15 -0
- package/lib/service/cosmo/internal/space/index.js +34 -0
- package/lib/service/cosmo/location/index.d.ts +40 -0
- package/lib/service/cosmo/location/index.js +63 -0
- package/lib/service/cosmo/namespace/index.d.ts +42 -0
- package/lib/service/cosmo/namespace/index.js +65 -0
- package/lib/service/cosmo/organization/index.d.ts +47 -0
- package/lib/service/cosmo/organization/index.js +64 -0
- package/lib/service/cosmo/permissions/index.d.ts +131 -0
- package/lib/service/cosmo/permissions/index.js +181 -0
- package/lib/service/cosmo/production/index.d.ts +26 -0
- package/lib/service/cosmo/production/index.js +45 -0
- package/lib/service/cosmo/share/index.d.ts +161 -0
- package/lib/service/cosmo/share/index.js +215 -0
- package/lib/service/cosmo/space/index.d.ts +104 -0
- package/lib/service/cosmo/space/index.js +146 -0
- package/lib/service/cosmo/tag/index.d.ts +67 -0
- package/lib/service/cosmo/tag/index.js +93 -0
- package/lib/service/dali/DaliAvatar.d.ts +12 -0
- package/lib/service/dali/DaliAvatar.js +20 -0
- package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +32 -0
- package/lib/service/dali/avatar/DaliCosmoSpace.js +59 -0
- package/lib/service/dali/avatar/DaliFuseSpace.d.ts +10 -4
- package/lib/service/dali/avatar/DaliFuseSpace.js +7 -6
- package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +10 -4
- package/lib/service/dali/avatar/DaliHigh5Pool.js +7 -6
- package/lib/service/dali/avatar/DaliHigh5Space.d.ts +10 -4
- package/lib/service/dali/avatar/DaliHigh5Space.js +7 -6
- package/lib/service/dali/avatar/DaliOAuthApp.d.ts +10 -4
- package/lib/service/dali/avatar/DaliOAuthApp.js +7 -6
- package/lib/service/dali/avatar/DaliOrganization.d.ts +10 -4
- package/lib/service/dali/avatar/DaliOrganization.js +7 -6
- package/lib/service/dali/avatar/DaliServiceAccount.d.ts +32 -0
- package/lib/service/dali/avatar/DaliServiceAccount.js +59 -0
- package/lib/service/dali/avatar/DaliTeam.d.ts +10 -4
- package/lib/service/dali/avatar/DaliTeam.js +7 -6
- package/lib/service/dali/avatar/DaliUser.d.ts +10 -4
- package/lib/service/dali/avatar/DaliUser.js +7 -6
- package/lib/service/dali/index.d.ts +4 -5
- package/lib/service/dali/index.js +2 -5
- package/lib/service/fuse/index.d.ts +4 -2
- package/lib/service/fuse/index.js +2 -2
- package/lib/service/fuse/internal/index.d.ts +4 -2
- package/lib/service/fuse/internal/index.js +3 -2
- package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +4 -2
- package/lib/service/fuse/internal/space/cronjob/log/index.js +2 -2
- package/lib/service/fuse/internal/space/index.d.ts +7 -3
- package/lib/service/fuse/internal/space/index.js +6 -4
- package/lib/service/fuse/space/cronjob/index.d.ts +35 -13
- package/lib/service/fuse/space/cronjob/index.js +48 -50
- package/lib/service/fuse/space/cronjob/log/index.d.ts +8 -4
- package/lib/service/fuse/space/cronjob/log/index.js +5 -5
- package/lib/service/fuse/space/index.d.ts +27 -11
- package/lib/service/fuse/space/index.js +19 -18
- package/lib/service/high5/execution/index.d.ts +4 -2
- package/lib/service/high5/execution/index.js +3 -2
- package/lib/service/high5/execution/status/index.d.ts +5 -3
- package/lib/service/high5/execution/status/index.js +3 -3
- package/lib/service/high5/index.d.ts +7 -2
- package/lib/service/high5/index.js +9 -2
- package/lib/service/high5/internal/index.d.ts +4 -2
- package/lib/service/high5/internal/index.js +3 -2
- package/lib/service/high5/internal/space/index.d.ts +10 -3
- package/lib/service/high5/internal/space/index.js +13 -4
- package/lib/service/high5/internal/space/job/index.d.ts +7 -0
- package/lib/service/high5/internal/space/job/index.js +17 -0
- package/lib/service/high5/internal/space/job/log/index.d.ts +17 -0
- package/lib/service/high5/internal/space/job/log/index.js +34 -0
- package/lib/service/high5/joinToken/index.d.ts +14 -6
- package/lib/service/high5/joinToken/index.js +10 -9
- package/lib/service/high5/space/database/document/array/index.d.ts +73 -0
- package/lib/service/high5/space/database/document/array/index.js +102 -0
- package/lib/service/high5/space/database/document/index.d.ts +74 -0
- package/lib/service/high5/space/database/document/index.js +112 -0
- package/lib/service/high5/space/database/document/number/index.d.ts +51 -0
- package/lib/service/high5/space/database/document/number/index.js +77 -0
- package/lib/service/high5/space/database/index.d.ts +65 -0
- package/lib/service/high5/space/database/index.js +102 -0
- package/lib/service/high5/space/event/index.d.ts +17 -7
- package/lib/service/high5/space/event/index.js +12 -11
- package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +4 -2
- package/lib/service/high5/space/event/stream/design/DesignOperations.js +5 -3
- package/lib/service/high5/space/event/stream/design/index.d.ts +10 -4
- package/lib/service/high5/space/event/stream/design/index.js +7 -6
- package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +16 -6
- package/lib/service/high5/space/event/stream/design/snapshot/index.js +12 -10
- package/lib/service/high5/space/event/stream/index.d.ts +32 -12
- package/lib/service/high5/space/event/stream/index.js +22 -21
- package/lib/service/high5/space/execution/index.d.ts +22 -7
- package/lib/service/high5/space/execution/index.js +23 -12
- package/lib/service/high5/space/execution/log/index.d.ts +8 -4
- package/lib/service/high5/space/execution/log/index.js +5 -5
- package/lib/service/high5/space/execution/status/index.d.ts +18 -7
- package/lib/service/high5/space/execution/status/index.js +20 -8
- package/lib/service/high5/space/index.d.ts +56 -18
- package/lib/service/high5/space/index.js +65 -27
- package/lib/service/high5/space/job/index.d.ts +145 -0
- package/lib/service/high5/space/job/index.js +201 -0
- package/lib/service/high5/space/job/log/index.d.ts +35 -0
- package/lib/service/high5/space/job/log/index.js +58 -0
- package/lib/service/high5/space/node/index.d.ts +20 -8
- package/lib/service/high5/space/node/index.js +14 -13
- package/lib/service/high5/space/pool/index.d.ts +27 -11
- package/lib/service/high5/space/pool/index.js +19 -18
- package/lib/service/high5/space/secret/index.d.ts +17 -7
- package/lib/service/high5/space/secret/index.js +12 -11
- package/lib/service/high5/space/stat/index.d.ts +12 -0
- package/lib/service/high5/space/stat/index.js +31 -0
- package/lib/service/high5/space/wave/index.d.ts +16 -6
- package/lib/service/high5/space/wave/index.js +11 -10
- package/lib/service/high5/space/webhook/index.d.ts +32 -12
- package/lib/service/high5/space/webhook/index.js +25 -21
- package/lib/service/high5/space/webhook/log/index.d.ts +4 -2
- package/lib/service/high5/space/webhook/log/index.js +2 -2
- package/lib/service/high5/stat/index.d.ts +11 -0
- package/lib/service/high5/stat/index.js +30 -0
- package/lib/service/high5/wave/s3/index.d.ts +31 -8
- package/lib/service/high5/wave/s3/index.js +52 -24
- package/lib/service/idp/guest/index.d.ts +42 -0
- package/lib/service/idp/guest/index.js +66 -0
- package/lib/service/idp/index.d.ts +25 -7
- package/lib/service/idp/index.js +23 -12
- package/lib/service/idp/internal/index.d.ts +5 -3
- package/lib/service/idp/internal/index.js +5 -3
- package/lib/service/idp/oauth/index.d.ts +16 -6
- package/lib/service/idp/oauth/index.js +15 -15
- package/lib/service/idp/organization/index.d.ts +25 -5
- package/lib/service/idp/organization/index.js +29 -8
- package/lib/service/idp/organization/license/index.d.ts +7 -3
- package/lib/service/idp/organization/license/index.js +4 -4
- package/lib/service/idp/organization/member/index.d.ts +21 -8
- package/lib/service/idp/organization/member/index.js +16 -13
- package/lib/service/idp/organization/member/invitations/index.d.ts +23 -9
- package/lib/service/idp/organization/member/invitations/index.js +72 -59
- package/lib/service/idp/organization/service-accounts/index.d.ts +76 -0
- package/lib/service/idp/organization/service-accounts/index.js +109 -0
- package/lib/service/idp/organization/settings/domain/index.d.ts +13 -5
- package/lib/service/idp/organization/settings/domain/index.js +9 -8
- package/lib/service/idp/organization/settings/domain/saml/index.d.ts +16 -6
- package/lib/service/idp/organization/settings/domain/saml/index.js +19 -18
- package/lib/service/idp/organization/settings/oauth/index.d.ts +23 -9
- package/lib/service/idp/organization/settings/oauth/index.js +16 -15
- package/lib/service/idp/organization/stat/index.d.ts +11 -0
- package/lib/service/idp/organization/stat/index.js +30 -0
- package/lib/service/idp/organization/team/index.d.ts +22 -10
- package/lib/service/idp/organization/team/index.js +14 -13
- package/lib/service/idp/registration/index.d.ts +10 -4
- package/lib/service/idp/registration/index.js +15 -9
- package/lib/service/idp/user/index.d.ts +33 -11
- package/lib/service/idp/user/index.js +30 -16
- package/lib/service/idp/user/license/index.d.ts +7 -3
- package/lib/service/idp/user/license/index.js +4 -4
- package/lib/service/idp/user/message/index.d.ts +61 -0
- package/lib/service/idp/user/message/index.js +92 -0
- package/lib/service/idp/user/password/index.d.ts +4 -2
- package/lib/service/idp/user/password/index.js +3 -3
- package/lib/service/idp/user/settings/connections/index.d.ts +4 -2
- package/lib/service/idp/user/settings/connections/index.js +2 -2
- package/lib/service/idp/user/settings/general/index.d.ts +10 -4
- package/lib/service/idp/user/settings/general/index.js +6 -6
- package/lib/service/idp/user/settings/notifications/index.d.ts +7 -3
- package/lib/service/idp/user/settings/notifications/index.js +4 -4
- package/lib/service/idp/user/settings/oauthApps/index.d.ts +7 -3
- package/lib/service/idp/user/settings/oauthApps/index.js +6 -5
- package/lib/service/idp/user/settings/pats/index.d.ts +22 -8
- package/lib/service/idp/user/settings/pats/index.js +17 -15
- package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +16 -6
- package/lib/service/idp/user/settings/twoFactor/totp/index.js +13 -10
- package/lib/service/mailer/index.d.ts +4 -2
- package/lib/service/mailer/index.js +2 -2
- package/lib/service/mailer/internal/index.d.ts +13 -5
- package/lib/service/mailer/internal/index.js +8 -8
- package/lib/service/mothership/index.d.ts +35 -13
- package/lib/service/mothership/index.js +32 -18
- package/lib/service/nats/index.js +58 -44
- package/lib/service/shorts/index.d.ts +18 -0
- package/lib/service/shorts/index.js +38 -0
- package/lib/service/shorts/internal/index.d.ts +72 -0
- package/lib/service/shorts/internal/index.js +104 -0
- package/lib/utils/bouncer/features/Provider.js +0 -3
- package/package.json +22 -24
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { Asset, AssetFilter } from "../../../interfaces/cosmo/asset";
|
|
3
|
+
import { Location } from "../../../interfaces/cosmo/location";
|
|
4
|
+
/**
|
|
5
|
+
* @class Location
|
|
6
|
+
* @extends Base
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* **Under development, breaking changes possible**
|
|
10
|
+
*
|
|
11
|
+
* Represents a Location resource in Cosmo, providing methods to interact with the Location API.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CosmoLocation extends Base {
|
|
14
|
+
protected getEndpoint(endpoint: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new Location in the specified Organization and Space.
|
|
17
|
+
* @remarks
|
|
18
|
+
* ** Under development, breaking changes possible**
|
|
19
|
+
* @param orgName Name of the Organization
|
|
20
|
+
* @param spaceName Name of the Space
|
|
21
|
+
* @param locationName Name of the Location to create
|
|
22
|
+
* @returns The created Location
|
|
23
|
+
*/
|
|
24
|
+
createLocation<R extends boolean = false>(orgName: string, spaceName: string, locationName: string, raw?: {
|
|
25
|
+
raw: R;
|
|
26
|
+
}): Promise<MaybeRaw<R, Location>>;
|
|
27
|
+
/**
|
|
28
|
+
* Search assets of a Location.
|
|
29
|
+
* @remarks
|
|
30
|
+
* ** Under development, breaking changes possible**
|
|
31
|
+
* @param orgName Name of the Organization
|
|
32
|
+
* @param spaceName Name of the Space
|
|
33
|
+
* @param locationId ID of the Location to search
|
|
34
|
+
* @param assetFilter Filter for assets in the Space
|
|
35
|
+
* @returns The found Assets
|
|
36
|
+
*/
|
|
37
|
+
searchAssetsOfLocation<R extends boolean = false>(orgName: string, spaceName: string, locationId: string, assetFilter: AssetFilter[], raw?: {
|
|
38
|
+
raw: R;
|
|
39
|
+
}): Promise<MaybeRaw<R, Asset[]>>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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.CosmoLocation = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
/**
|
|
15
|
+
* @class Location
|
|
16
|
+
* @extends Base
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* **Under development, breaking changes possible**
|
|
20
|
+
*
|
|
21
|
+
* Represents a Location resource in Cosmo, providing methods to interact with the Location API.
|
|
22
|
+
*/
|
|
23
|
+
class CosmoLocation extends Base_1.default {
|
|
24
|
+
getEndpoint(endpoint) {
|
|
25
|
+
return `${this.options.server}/api/cosmo${endpoint}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a new Location in the specified Organization and Space.
|
|
29
|
+
* @remarks
|
|
30
|
+
* ** Under development, breaking changes possible**
|
|
31
|
+
* @param orgName Name of the Organization
|
|
32
|
+
* @param spaceName Name of the Space
|
|
33
|
+
* @param locationName Name of the Location to create
|
|
34
|
+
* @returns The created Location
|
|
35
|
+
*/
|
|
36
|
+
createLocation(orgName, spaceName, locationName, raw) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/locations`), {
|
|
39
|
+
name: locationName,
|
|
40
|
+
});
|
|
41
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Search assets of a Location.
|
|
46
|
+
* @remarks
|
|
47
|
+
* ** Under development, breaking changes possible**
|
|
48
|
+
* @param orgName Name of the Organization
|
|
49
|
+
* @param spaceName Name of the Space
|
|
50
|
+
* @param locationId ID of the Location to search
|
|
51
|
+
* @param assetFilter Filter for assets in the Space
|
|
52
|
+
* @returns The found Assets
|
|
53
|
+
*/
|
|
54
|
+
searchAssetsOfLocation(orgName, spaceName, locationId, assetFilter, raw) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/locations/${locationId}/assets`), {
|
|
57
|
+
filters: assetFilter,
|
|
58
|
+
});
|
|
59
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.CosmoLocation = CosmoLocation;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { Asset, NamespaceRushStatus } from "../../../interfaces/cosmo/asset";
|
|
3
|
+
import { Namespace } from "../../../interfaces/cosmo/namespace";
|
|
4
|
+
/**
|
|
5
|
+
* @class Namespace
|
|
6
|
+
* @extends Base
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* **Under development, breaking changes possible**
|
|
10
|
+
*
|
|
11
|
+
* Represents a Namespace resource in Cosmo, providing methods to interact with the Namespace API.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CosmoNamespace extends Base {
|
|
14
|
+
protected getEndpoint(endpoint: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new Namespace in the specified Organization and Space.
|
|
17
|
+
* @remarks
|
|
18
|
+
* ** Under development, breaking changes possible**
|
|
19
|
+
* @param orgName Name of the Organization
|
|
20
|
+
* @param spaceName Name of the Space
|
|
21
|
+
* @param namespaceName Name of the Namespace to create
|
|
22
|
+
* @param defaultStatus Status that asset references within this namespace will have by default
|
|
23
|
+
* @returns The created Namespace
|
|
24
|
+
*/
|
|
25
|
+
createNamespace<R extends boolean = false>(orgName: string, spaceName: string, namespaceName: string, defaultStatus?: string, raw?: {
|
|
26
|
+
raw: R;
|
|
27
|
+
}): Promise<MaybeRaw<R, Namespace>>;
|
|
28
|
+
/**
|
|
29
|
+
* Change the status of a reference (e.g. Asset)
|
|
30
|
+
* @remarks
|
|
31
|
+
* ** Under development, breaking changes possible**
|
|
32
|
+
* @param orgName Name of the Organization
|
|
33
|
+
* @param spaceName Name of the Space
|
|
34
|
+
* @param namespaceName Name of the Namespace
|
|
35
|
+
* @param refId ID of the reference to change status
|
|
36
|
+
* @param status New status to set for the reference
|
|
37
|
+
* @returns The updated Reference
|
|
38
|
+
*/
|
|
39
|
+
changeStatus<R extends boolean = false>(orgName: string, spaceName: string, refId: string, namespaceName: string, status: NamespaceRushStatus, raw?: {
|
|
40
|
+
raw: R;
|
|
41
|
+
}): Promise<MaybeRaw<R, Asset>>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.CosmoNamespace = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
/**
|
|
15
|
+
* @class Namespace
|
|
16
|
+
* @extends Base
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* **Under development, breaking changes possible**
|
|
20
|
+
*
|
|
21
|
+
* Represents a Namespace resource in Cosmo, providing methods to interact with the Namespace API.
|
|
22
|
+
*/
|
|
23
|
+
class CosmoNamespace extends Base_1.default {
|
|
24
|
+
getEndpoint(endpoint) {
|
|
25
|
+
return `${this.options.server}/api/cosmo${endpoint}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a new Namespace in the specified Organization and Space.
|
|
29
|
+
* @remarks
|
|
30
|
+
* ** Under development, breaking changes possible**
|
|
31
|
+
* @param orgName Name of the Organization
|
|
32
|
+
* @param spaceName Name of the Space
|
|
33
|
+
* @param namespaceName Name of the Namespace to create
|
|
34
|
+
* @param defaultStatus Status that asset references within this namespace will have by default
|
|
35
|
+
* @returns The created Namespace
|
|
36
|
+
*/
|
|
37
|
+
createNamespace(orgName_1, spaceName_1, namespaceName_1) {
|
|
38
|
+
return __awaiter(this, arguments, void 0, function* (orgName, spaceName, namespaceName, defaultStatus = "none", raw) {
|
|
39
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/namespaces`), {
|
|
40
|
+
name: namespaceName,
|
|
41
|
+
defaultStatus,
|
|
42
|
+
});
|
|
43
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Change the status of a reference (e.g. Asset)
|
|
48
|
+
* @remarks
|
|
49
|
+
* ** Under development, breaking changes possible**
|
|
50
|
+
* @param orgName Name of the Organization
|
|
51
|
+
* @param spaceName Name of the Space
|
|
52
|
+
* @param namespaceName Name of the Namespace
|
|
53
|
+
* @param refId ID of the reference to change status
|
|
54
|
+
* @param status New status to set for the reference
|
|
55
|
+
* @returns The updated Reference
|
|
56
|
+
*/
|
|
57
|
+
changeStatus(orgName, spaceName, refId, namespaceName, status, raw) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/namespaces/${namespaceName}/ref/${refId}/status`), { status });
|
|
60
|
+
// TypeScript can't infer conditional type at runtime, so we assert
|
|
61
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.CosmoNamespace = CosmoNamespace;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { Asset, AssetFilter, AssetSearchContext } from "../../../interfaces/cosmo/asset";
|
|
3
|
+
import { Sorting } from "../../../interfaces/global";
|
|
4
|
+
/**
|
|
5
|
+
* @class Organization
|
|
6
|
+
* @extends Base
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* **Under development, breaking changes possible**
|
|
10
|
+
*
|
|
11
|
+
* Represents an Organization resource in Cosmo, providing methods to interact with the Organization API.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CosmoOrganization extends Base {
|
|
14
|
+
protected getEndpoint(endpoint: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Search Assets of an Organization across all Spaces
|
|
17
|
+
* @remarks
|
|
18
|
+
* ** Under development, breaking changes possible**
|
|
19
|
+
* @param orgName Name of the Organization
|
|
20
|
+
* @param context Context to search in (e.g., ORGANIZATION, TRASH, SHARE)
|
|
21
|
+
* @param limit Maximum number of Assets to return
|
|
22
|
+
* @param page Page number for pagination
|
|
23
|
+
* @param recursive Flag for searching recursively
|
|
24
|
+
* @param spaceName Name of Space to restrict search (mandatory if context is not ORGANIZATION)
|
|
25
|
+
* @param namespace Name of Namespace to restrict search
|
|
26
|
+
* @param parentId ID of parent (folder, etc.) to restrict search
|
|
27
|
+
* @param shareId ID of Share to restrict search (mandatory if context is SHARE)
|
|
28
|
+
* @param assetFilter Filter criteria for Assets
|
|
29
|
+
* @param sorting Sorting criteria for the results
|
|
30
|
+
* @returns List of found Assets
|
|
31
|
+
*/
|
|
32
|
+
searchAssets<R extends boolean = false>({ orgName, context, limit, page, recursive, spaceName, namespace, parentId, shareId, assetFilter, sorting, }: {
|
|
33
|
+
orgName: string;
|
|
34
|
+
context: AssetSearchContext;
|
|
35
|
+
limit?: number;
|
|
36
|
+
page?: number;
|
|
37
|
+
recursive?: boolean;
|
|
38
|
+
spaceName?: string;
|
|
39
|
+
namespace?: string[] | string;
|
|
40
|
+
parentId?: string;
|
|
41
|
+
shareId?: string;
|
|
42
|
+
assetFilter?: AssetFilter[];
|
|
43
|
+
sorting?: Sorting;
|
|
44
|
+
}, raw?: {
|
|
45
|
+
raw: R;
|
|
46
|
+
}): Promise<MaybeRaw<R, Asset[]>>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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.CosmoOrganization = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
/**
|
|
15
|
+
* @class Organization
|
|
16
|
+
* @extends Base
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* **Under development, breaking changes possible**
|
|
20
|
+
*
|
|
21
|
+
* Represents an Organization resource in Cosmo, providing methods to interact with the Organization API.
|
|
22
|
+
*/
|
|
23
|
+
class CosmoOrganization extends Base_1.default {
|
|
24
|
+
getEndpoint(endpoint) {
|
|
25
|
+
return `${this.options.server}/api/cosmo${endpoint}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Search Assets of an Organization across all Spaces
|
|
29
|
+
* @remarks
|
|
30
|
+
* ** Under development, breaking changes possible**
|
|
31
|
+
* @param orgName Name of the Organization
|
|
32
|
+
* @param context Context to search in (e.g., ORGANIZATION, TRASH, SHARE)
|
|
33
|
+
* @param limit Maximum number of Assets to return
|
|
34
|
+
* @param page Page number for pagination
|
|
35
|
+
* @param recursive Flag for searching recursively
|
|
36
|
+
* @param spaceName Name of Space to restrict search (mandatory if context is not ORGANIZATION)
|
|
37
|
+
* @param namespace Name of Namespace to restrict search
|
|
38
|
+
* @param parentId ID of parent (folder, etc.) to restrict search
|
|
39
|
+
* @param shareId ID of Share to restrict search (mandatory if context is SHARE)
|
|
40
|
+
* @param assetFilter Filter criteria for Assets
|
|
41
|
+
* @param sorting Sorting criteria for the results
|
|
42
|
+
* @returns List of found Assets
|
|
43
|
+
*/
|
|
44
|
+
searchAssets(_a, raw_1) {
|
|
45
|
+
return __awaiter(this, arguments, void 0, function* ({ orgName, context, limit, page, recursive = false, spaceName, namespace, parentId, shareId, assetFilter, sorting, }, raw) {
|
|
46
|
+
limit = limit !== null && limit !== void 0 ? limit : 100;
|
|
47
|
+
page = page !== null && page !== void 0 ? page : 0;
|
|
48
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/assets/search`), Object.assign({ filters: assetFilter !== null && assetFilter !== void 0 ? assetFilter : [] }, (sorting ? { sorting } : {})), {
|
|
49
|
+
params: {
|
|
50
|
+
context,
|
|
51
|
+
limit,
|
|
52
|
+
page,
|
|
53
|
+
recursive,
|
|
54
|
+
spaceName,
|
|
55
|
+
namespace,
|
|
56
|
+
parentId,
|
|
57
|
+
shareId,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.CosmoOrganization = CosmoOrganization;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { DetailedRole, Permission, PermissionDiscovery, Role } from "../../../interfaces/cosmo/permissions";
|
|
3
|
+
import { SearchFilter, Sorting } from "../../../interfaces/global";
|
|
4
|
+
export declare class CosmoPermissions extends Base {
|
|
5
|
+
/**
|
|
6
|
+
* Fetches a list of all available permissions that can be assigned to roles.
|
|
7
|
+
*
|
|
8
|
+
* @returns A promise resolving to the permission discovery metadata.
|
|
9
|
+
*/
|
|
10
|
+
listAllPermissions<R extends boolean = false>(raw?: {
|
|
11
|
+
raw: R;
|
|
12
|
+
}): Promise<MaybeRaw<R, PermissionDiscovery>>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new role within a specified organization and space.
|
|
15
|
+
*
|
|
16
|
+
* @param orgName - The name of the organization.
|
|
17
|
+
* @param spaceName - The name of the space.
|
|
18
|
+
* @param roleName - The name of the new role.
|
|
19
|
+
* @param permissions - A record of resource keys to arrays of permission names.
|
|
20
|
+
* @returns A promise resolving to the created role object.
|
|
21
|
+
*/
|
|
22
|
+
createRole<R extends boolean = false>(orgName: string, spaceName: string, roleName: string, permissions: Record<string, Permission["name"][]>, raw?: {
|
|
23
|
+
raw: R;
|
|
24
|
+
}): Promise<MaybeRaw<R, Role>>;
|
|
25
|
+
/**
|
|
26
|
+
* Searches for roles within a space based on filters, sorting, and pagination.
|
|
27
|
+
*
|
|
28
|
+
* @param options - An object containing search parameters.
|
|
29
|
+
* @param options.orgName - The name of the organization.
|
|
30
|
+
* @param options.spaceName - The name of the space.
|
|
31
|
+
* @param options.filters - Optional array of search filters.
|
|
32
|
+
* @param options.sorting - Optional sorting criteria.
|
|
33
|
+
* @param options.limit - Optional limit for pagination.
|
|
34
|
+
* @param options.page - Optional page number for pagination.
|
|
35
|
+
* @returns A promise resolving to a list of matching role objects.
|
|
36
|
+
*/
|
|
37
|
+
searchRoles<R extends boolean = false>({ orgName, spaceName, filters, sorting, limit, page, }: {
|
|
38
|
+
orgName: string;
|
|
39
|
+
spaceName: string;
|
|
40
|
+
filters?: SearchFilter[];
|
|
41
|
+
sorting?: Sorting;
|
|
42
|
+
limit?: number;
|
|
43
|
+
page?: number;
|
|
44
|
+
}, raw?: {
|
|
45
|
+
raw: R;
|
|
46
|
+
}): Promise<MaybeRaw<R, Role[]>>;
|
|
47
|
+
/**
|
|
48
|
+
* Updates an existing role's name and permissions.
|
|
49
|
+
*
|
|
50
|
+
* @param orgName - The name of the organization.
|
|
51
|
+
* @param spaceName - The name of the space.
|
|
52
|
+
* @param roleId - The ID of the role to update.
|
|
53
|
+
* @param newName - The new name for the role.
|
|
54
|
+
* @param permissions - The updated permissions mapping.
|
|
55
|
+
* @returns A promise resolving to the updated role.
|
|
56
|
+
*/
|
|
57
|
+
updateRole<R extends boolean = false>(orgName: string, spaceName: string, roleId: string, newName: string, permissions: Record<string, Permission["name"][]>, raw?: {
|
|
58
|
+
raw: R;
|
|
59
|
+
}): Promise<MaybeRaw<R, Role>>;
|
|
60
|
+
/**
|
|
61
|
+
* Fetches detailed information about a specific role.
|
|
62
|
+
*
|
|
63
|
+
* @param orgName - The name of the organization.
|
|
64
|
+
* @param spaceName - The name of the space.
|
|
65
|
+
* @param roleId - The ID of the role to retrieve.
|
|
66
|
+
* @returns A promise resolving to the detailed role object.
|
|
67
|
+
*/
|
|
68
|
+
fetchRole<R extends boolean = false>(orgName: string, spaceName: string, roleId: string, raw?: {
|
|
69
|
+
raw: R;
|
|
70
|
+
}): Promise<MaybeRaw<R, DetailedRole>>;
|
|
71
|
+
/**
|
|
72
|
+
* Deletes a role by its ID.
|
|
73
|
+
*
|
|
74
|
+
* @param orgName - The name of the organization.
|
|
75
|
+
* @param spaceName - The name of the space.
|
|
76
|
+
* @param roleId - The ID of the role to delete.
|
|
77
|
+
* @returns A promise that resolves when the role is deleted.
|
|
78
|
+
*/
|
|
79
|
+
deleteRole<R extends boolean = false>(orgName: string, spaceName: string, roleId: string, raw?: {
|
|
80
|
+
raw: R;
|
|
81
|
+
}): Promise<MaybeRaw<R, DetailedRole>>;
|
|
82
|
+
/**
|
|
83
|
+
* Assigns a user to a role.
|
|
84
|
+
*
|
|
85
|
+
* @param orgName - The name of the organization.
|
|
86
|
+
* @param spaceName - The name of the space.
|
|
87
|
+
* @param roleId - The ID of the role.
|
|
88
|
+
* @param userId - The ID of the user to assign.
|
|
89
|
+
* @returns A promise that resolves when the assignment is complete.
|
|
90
|
+
*/
|
|
91
|
+
assignUserToRole<R extends boolean = false>(orgName: string, spaceName: string, roleId: string, userId: string, raw?: {
|
|
92
|
+
raw: R;
|
|
93
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
94
|
+
/**
|
|
95
|
+
* Unassigns a user from a role.
|
|
96
|
+
*
|
|
97
|
+
* @param orgName - The name of the organization.
|
|
98
|
+
* @param spaceName - The name of the space.
|
|
99
|
+
* @param roleId - The ID of the role.
|
|
100
|
+
* @param userId - The ID of the user to unassign.
|
|
101
|
+
* @returns A promise that resolves when the user is removed.
|
|
102
|
+
*/
|
|
103
|
+
unassignUserFromRole<R extends boolean = false>(orgName: string, spaceName: string, roleId: string, userId: string, raw?: {
|
|
104
|
+
raw: R;
|
|
105
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
106
|
+
/**
|
|
107
|
+
* Assigns a team to a role.
|
|
108
|
+
*
|
|
109
|
+
* @param orgName - The name of the organization.
|
|
110
|
+
* @param spaceName - The name of the space.
|
|
111
|
+
* @param roleId - The ID of the role.
|
|
112
|
+
* @param teamName - The name of the team to assign.
|
|
113
|
+
* @returns A promise that resolves when the assignment is complete.
|
|
114
|
+
*/
|
|
115
|
+
assignTeamToRole<R extends boolean = false>(orgName: string, spaceName: string, roleId: string, teamName: string, raw?: {
|
|
116
|
+
raw: R;
|
|
117
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
118
|
+
/**
|
|
119
|
+
* Unassigns a team from a role.
|
|
120
|
+
*
|
|
121
|
+
* @param orgName - The name of the organization.
|
|
122
|
+
* @param spaceName - The name of the space.
|
|
123
|
+
* @param roleId - The ID of the role.
|
|
124
|
+
* @param teamName - The name of the team to unassign.
|
|
125
|
+
* @returns A promise that resolves when the team is removed.
|
|
126
|
+
*/
|
|
127
|
+
unassignTeamFromRole<R extends boolean = false>(orgName: string, spaceName: string, roleId: string, teamName: string, raw?: {
|
|
128
|
+
raw: R;
|
|
129
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
130
|
+
protected getEndpoint(endpoint: string): string;
|
|
131
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
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.CosmoPermissions = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
class CosmoPermissions extends Base_1.default {
|
|
15
|
+
/**
|
|
16
|
+
* Fetches a list of all available permissions that can be assigned to roles.
|
|
17
|
+
*
|
|
18
|
+
* @returns A promise resolving to the permission discovery metadata.
|
|
19
|
+
*/
|
|
20
|
+
listAllPermissions(raw) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const res = yield this.axios.get(`/v1/permissions/discovery`);
|
|
23
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new role within a specified organization and space.
|
|
28
|
+
*
|
|
29
|
+
* @param orgName - The name of the organization.
|
|
30
|
+
* @param spaceName - The name of the space.
|
|
31
|
+
* @param roleName - The name of the new role.
|
|
32
|
+
* @param permissions - A record of resource keys to arrays of permission names.
|
|
33
|
+
* @returns A promise resolving to the created role object.
|
|
34
|
+
*/
|
|
35
|
+
createRole(orgName, spaceName, roleName, permissions, raw) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const res = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles`), {
|
|
38
|
+
name: roleName,
|
|
39
|
+
permissions,
|
|
40
|
+
});
|
|
41
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Searches for roles within a space based on filters, sorting, and pagination.
|
|
46
|
+
*
|
|
47
|
+
* @param options - An object containing search parameters.
|
|
48
|
+
* @param options.orgName - The name of the organization.
|
|
49
|
+
* @param options.spaceName - The name of the space.
|
|
50
|
+
* @param options.filters - Optional array of search filters.
|
|
51
|
+
* @param options.sorting - Optional sorting criteria.
|
|
52
|
+
* @param options.limit - Optional limit for pagination.
|
|
53
|
+
* @param options.page - Optional page number for pagination.
|
|
54
|
+
* @returns A promise resolving to a list of matching role objects.
|
|
55
|
+
*/
|
|
56
|
+
searchRoles(_a, raw_1) {
|
|
57
|
+
return __awaiter(this, arguments, void 0, function* ({ orgName, spaceName, filters, sorting, limit, page, }, raw) {
|
|
58
|
+
const res = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/search`), {
|
|
59
|
+
filters,
|
|
60
|
+
sorting,
|
|
61
|
+
}, {
|
|
62
|
+
params: {
|
|
63
|
+
limit,
|
|
64
|
+
page,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Updates an existing role's name and permissions.
|
|
72
|
+
*
|
|
73
|
+
* @param orgName - The name of the organization.
|
|
74
|
+
* @param spaceName - The name of the space.
|
|
75
|
+
* @param roleId - The ID of the role to update.
|
|
76
|
+
* @param newName - The new name for the role.
|
|
77
|
+
* @param permissions - The updated permissions mapping.
|
|
78
|
+
* @returns A promise resolving to the updated role.
|
|
79
|
+
*/
|
|
80
|
+
updateRole(orgName, spaceName, roleId, newName, permissions, raw) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const res = yield this.axios.put(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/${roleId}`), {
|
|
83
|
+
name: newName,
|
|
84
|
+
permissions,
|
|
85
|
+
});
|
|
86
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Fetches detailed information about a specific role.
|
|
91
|
+
*
|
|
92
|
+
* @param orgName - The name of the organization.
|
|
93
|
+
* @param spaceName - The name of the space.
|
|
94
|
+
* @param roleId - The ID of the role to retrieve.
|
|
95
|
+
* @returns A promise resolving to the detailed role object.
|
|
96
|
+
*/
|
|
97
|
+
fetchRole(orgName, spaceName, roleId, raw) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const res = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/${roleId}`));
|
|
100
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Deletes a role by its ID.
|
|
105
|
+
*
|
|
106
|
+
* @param orgName - The name of the organization.
|
|
107
|
+
* @param spaceName - The name of the space.
|
|
108
|
+
* @param roleId - The ID of the role to delete.
|
|
109
|
+
* @returns A promise that resolves when the role is deleted.
|
|
110
|
+
*/
|
|
111
|
+
deleteRole(orgName, spaceName, roleId, raw) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/${roleId}`));
|
|
114
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Assigns a user to a role.
|
|
119
|
+
*
|
|
120
|
+
* @param orgName - The name of the organization.
|
|
121
|
+
* @param spaceName - The name of the space.
|
|
122
|
+
* @param roleId - The ID of the role.
|
|
123
|
+
* @param userId - The ID of the user to assign.
|
|
124
|
+
* @returns A promise that resolves when the assignment is complete.
|
|
125
|
+
*/
|
|
126
|
+
assignUserToRole(orgName, spaceName, roleId, userId, raw) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const resp = yield this.axios.put(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/${roleId}/user`), { userId });
|
|
129
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Unassigns a user from a role.
|
|
134
|
+
*
|
|
135
|
+
* @param orgName - The name of the organization.
|
|
136
|
+
* @param spaceName - The name of the space.
|
|
137
|
+
* @param roleId - The ID of the role.
|
|
138
|
+
* @param userId - The ID of the user to unassign.
|
|
139
|
+
* @returns A promise that resolves when the user is removed.
|
|
140
|
+
*/
|
|
141
|
+
unassignUserFromRole(orgName, spaceName, roleId, userId, raw) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/${roleId}/user/${userId}`));
|
|
144
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Assigns a team to a role.
|
|
149
|
+
*
|
|
150
|
+
* @param orgName - The name of the organization.
|
|
151
|
+
* @param spaceName - The name of the space.
|
|
152
|
+
* @param roleId - The ID of the role.
|
|
153
|
+
* @param teamName - The name of the team to assign.
|
|
154
|
+
* @returns A promise that resolves when the assignment is complete.
|
|
155
|
+
*/
|
|
156
|
+
assignTeamToRole(orgName, spaceName, roleId, teamName, raw) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
const resp = yield this.axios.put(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/${roleId}/team`), { teamName });
|
|
159
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Unassigns a team from a role.
|
|
164
|
+
*
|
|
165
|
+
* @param orgName - The name of the organization.
|
|
166
|
+
* @param spaceName - The name of the space.
|
|
167
|
+
* @param roleId - The ID of the role.
|
|
168
|
+
* @param teamName - The name of the team to unassign.
|
|
169
|
+
* @returns A promise that resolves when the team is removed.
|
|
170
|
+
*/
|
|
171
|
+
unassignTeamFromRole(orgName, spaceName, roleId, teamName, raw) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/roles/${roleId}/team/${teamName}`));
|
|
174
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
getEndpoint(endpoint) {
|
|
178
|
+
return `${this.options.server}/api/cosmo${endpoint}`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.CosmoPermissions = CosmoPermissions;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { Asset } from "../../../interfaces/cosmo/asset";
|
|
3
|
+
/**
|
|
4
|
+
* @class Production
|
|
5
|
+
* @extends Base
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* **Under development, breaking changes possible**
|
|
9
|
+
*
|
|
10
|
+
* Represents a Production resource in Cosmo, providing methods to interact with the Production API.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CosmoProduction extends Base {
|
|
13
|
+
protected getEndpoint(endpoint: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new Production in the specified Organization and Space.
|
|
16
|
+
* @remarks
|
|
17
|
+
* ** Under development, breaking changes possible**
|
|
18
|
+
* @param orgName Name of the Organization
|
|
19
|
+
* @param spaceName Name of the Space
|
|
20
|
+
* @param productionName Name of the Production to create
|
|
21
|
+
* @returns The created Production
|
|
22
|
+
*/
|
|
23
|
+
createProduction<R extends boolean = false>(orgName: string, spaceName: string, productionName: string, raw?: {
|
|
24
|
+
raw: R;
|
|
25
|
+
}): Promise<MaybeRaw<R, Asset>>;
|
|
26
|
+
}
|