@blimu/backend 0.7.0 → 1.1.1
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/README.md +129 -134
- package/dist/client.d.mts +24 -0
- package/dist/client.d.ts +15 -57
- package/dist/client.js +67 -156
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +48 -0
- package/dist/client.mjs.map +1 -0
- package/dist/index.d.mts +36 -0
- package/dist/index.d.ts +25 -26
- package/dist/index.js +1046 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1014 -0
- package/dist/index.mjs.map +1 -0
- package/dist/main.d.mts +19 -0
- package/dist/main.d.ts +19 -0
- package/dist/main.js +1285 -0
- package/dist/main.js.map +1 -0
- package/dist/main.mjs +1275 -0
- package/dist/main.mjs.map +1 -0
- package/dist/schema-B1usIXCr.d.mts +424 -0
- package/dist/schema-B1usIXCr.d.ts +424 -0
- package/dist/schema.d.mts +2 -0
- package/dist/schema.d.ts +2 -381
- package/dist/schema.js +17 -1
- package/dist/schema.js.map +1 -1
- package/dist/schema.mjs +1 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/schema.zod-CRNAHxbc.d.mts +444 -0
- package/dist/schema.zod-CRNAHxbc.d.ts +444 -0
- package/dist/schema.zod.d.mts +2 -0
- package/dist/schema.zod.d.ts +2 -0
- package/dist/schema.zod.js +563 -0
- package/dist/schema.zod.js.map +1 -0
- package/dist/schema.zod.mjs +496 -0
- package/dist/schema.zod.mjs.map +1 -0
- package/dist/services/bulk_resources.d.mts +12 -0
- package/dist/services/bulk_resources.d.ts +9 -4
- package/dist/services/bulk_resources.js +45 -17
- package/dist/services/bulk_resources.js.map +1 -1
- package/dist/services/bulk_resources.mjs +22 -0
- package/dist/services/bulk_resources.mjs.map +1 -0
- package/dist/services/bulk_roles.d.mts +12 -0
- package/dist/services/bulk_roles.d.ts +9 -4
- package/dist/services/bulk_roles.js +45 -17
- package/dist/services/bulk_roles.js.map +1 -1
- package/dist/services/bulk_roles.mjs +22 -0
- package/dist/services/bulk_roles.mjs.map +1 -0
- package/dist/services/entitlements.d.mts +14 -0
- package/dist/services/entitlements.d.ts +11 -6
- package/dist/services/entitlements.js +69 -33
- package/dist/services/entitlements.js.map +1 -1
- package/dist/services/entitlements.mjs +46 -0
- package/dist/services/entitlements.mjs.map +1 -0
- package/dist/services/plans.d.mts +14 -0
- package/dist/services/plans.d.ts +11 -6
- package/dist/services/plans.js +67 -31
- package/dist/services/plans.js.map +1 -1
- package/dist/services/plans.mjs +44 -0
- package/dist/services/plans.mjs.map +1 -0
- package/dist/services/resource_members.d.mts +12 -0
- package/dist/services/resource_members.d.ts +9 -4
- package/dist/services/resource_members.js +45 -16
- package/dist/services/resource_members.js.map +1 -1
- package/dist/services/resource_members.mjs +22 -0
- package/dist/services/resource_members.mjs.map +1 -0
- package/dist/services/resources.d.mts +16 -0
- package/dist/services/resources.d.ts +13 -8
- package/dist/services/resources.js +91 -48
- package/dist/services/resources.js.map +1 -1
- package/dist/services/resources.mjs +68 -0
- package/dist/services/resources.mjs.map +1 -0
- package/dist/services/roles.d.mts +14 -0
- package/dist/services/roles.d.ts +11 -6
- package/dist/services/roles.js +68 -32
- package/dist/services/roles.js.map +1 -1
- package/dist/services/roles.mjs +45 -0
- package/dist/services/roles.mjs.map +1 -0
- package/dist/services/usage.d.mts +16 -0
- package/dist/services/usage.d.ts +13 -8
- package/dist/services/usage.js +93 -51
- package/dist/services/usage.js.map +1 -1
- package/dist/services/usage.mjs +70 -0
- package/dist/services/usage.mjs.map +1 -0
- package/dist/services/users.d.mts +17 -0
- package/dist/services/users.d.ts +13 -8
- package/dist/services/users.js +102 -55
- package/dist/services/users.js.map +1 -1
- package/dist/services/users.mjs +79 -0
- package/dist/services/users.mjs.map +1 -0
- package/dist/token-verifier.d.mts +35 -0
- package/dist/token-verifier.d.ts +8 -6
- package/dist/token-verifier.js +227 -171
- package/dist/token-verifier.js.map +1 -1
- package/dist/token-verifier.mjs +203 -0
- package/dist/token-verifier.mjs.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils.d.mts +20 -0
- package/dist/utils.d.ts +7 -3
- package/dist/utils.js +50 -19
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +29 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +37 -62
- package/src/client.ts +74 -0
- package/src/index.ts +55 -0
- package/src/main.ts +3 -0
- package/src/schema.ts +430 -0
- package/src/schema.zod.ts +558 -0
- package/src/services/bulk_resources.ts +24 -0
- package/src/services/bulk_roles.ts +22 -0
- package/src/services/entitlements.ts +58 -0
- package/src/services/plans.ts +57 -0
- package/src/services/resource_members.ts +25 -0
- package/src/services/resources.ts +91 -0
- package/src/services/roles.ts +58 -0
- package/src/services/usage.ts +93 -0
- package/src/services/users.ts +100 -0
- package/src/token-verifier.ts +280 -0
- package/src/utils.ts +56 -0
- package/bin/blimu +0 -0
- package/scripts/download-binary.js +0 -243
- package/scripts/postinstall.js +0 -24
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
2
|
+
import { j as ResourceMembersListQuery, k as ResourceMemberList } from '../schema-B1usIXCr.js';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class ResourceMembersService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
list(resourceType:
|
|
9
|
+
list(resourceType: ResourceType, resourceId: string, query?: ResourceMembersListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceMemberList>;
|
|
7
10
|
}
|
|
11
|
+
|
|
12
|
+
export { ResourceMembersService };
|
|
@@ -1,18 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/services/resource_members.ts
|
|
21
|
+
var resource_members_exports = {};
|
|
22
|
+
__export(resource_members_exports, {
|
|
23
|
+
ResourceMembersService: () => ResourceMembersService
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(resource_members_exports);
|
|
26
|
+
var ResourceMembersService = class {
|
|
27
|
+
constructor(core) {
|
|
28
|
+
this.core = core;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* GET /v1/resources/{resourceType}/{resourceId}/members*
|
|
32
|
+
* @summary List members for a resource*
|
|
33
|
+
* @description Retrieves a paginated list of users who have roles (direct or inherited) on the specified resource. Supports search functionality to filter users by email or name.*/
|
|
34
|
+
list(resourceType, resourceId, query, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/members`,
|
|
38
|
+
query,
|
|
39
|
+
...init || {}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
ResourceMembersService
|
|
46
|
+
});
|
|
18
47
|
//# sourceMappingURL=resource_members.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/resource_members.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class ResourceMembersService {\n constructor(private core: CoreClient) {}\n\n /**\n * GET /v1/resources/{resourceType}/{resourceId}/members*\n * @summary List members for a resource*\n * @description Retrieves a paginated list of users who have roles (direct or inherited) on the specified resource. Supports search functionality to filter users by email or name.*/\n list(\n resourceType: ResourceType,\n resourceId: string,\n query?: Schema.ResourceMembersListQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.ResourceMemberList> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/members`,\n query,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,KACE,cACA,YACA,OACA,MACoC;AACpC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/services/resource_members.ts
|
|
2
|
+
var ResourceMembersService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* GET /v1/resources/{resourceType}/{resourceId}/members*
|
|
8
|
+
* @summary List members for a resource*
|
|
9
|
+
* @description Retrieves a paginated list of users who have roles (direct or inherited) on the specified resource. Supports search functionality to filter users by email or name.*/
|
|
10
|
+
list(resourceType, resourceId, query, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/members`,
|
|
14
|
+
query,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ResourceMembersService
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=resource_members.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/resource_members.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class ResourceMembersService {\n constructor(private core: CoreClient) {}\n\n /**\n * GET /v1/resources/{resourceType}/{resourceId}/members*\n * @summary List members for a resource*\n * @description Retrieves a paginated list of users who have roles (direct or inherited) on the specified resource. Supports search functionality to filter users by email or name.*/\n list(\n resourceType: ResourceType,\n resourceId: string,\n query?: Schema.ResourceMembersListQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.ResourceMemberList> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/members`,\n query,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";AAIO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,KACE,cACA,YACA,OACA,MACoC;AACpC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
2
|
+
import { l as ResourcesListQuery, m as ResourceList, n as ResourceCreateBody, o as Resource, p as ResourceUpdateBody } from '../schema-B1usIXCr.mjs';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class ResourcesService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
list(resourceType: ResourceType, query?: ResourcesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceList>;
|
|
10
|
+
create(resourceType: ResourceType, body: ResourceCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
11
|
+
delete(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
12
|
+
read(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
13
|
+
update(resourceType: ResourceType, resourceId: string, body: ResourceUpdateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { ResourcesService };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
2
|
+
import { l as ResourcesListQuery, m as ResourceList, n as ResourceCreateBody, o as Resource, p as ResourceUpdateBody } from '../schema-B1usIXCr.js';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class ResourcesService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
list(resourceType:
|
|
7
|
-
create(resourceType:
|
|
8
|
-
delete(resourceType:
|
|
9
|
-
read(resourceType:
|
|
10
|
-
update(resourceType:
|
|
9
|
+
list(resourceType: ResourceType, query?: ResourcesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceList>;
|
|
10
|
+
create(resourceType: ResourceType, body: ResourceCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
11
|
+
delete(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
12
|
+
read(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
13
|
+
update(resourceType: ResourceType, resourceId: string, body: ResourceUpdateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
11
14
|
}
|
|
15
|
+
|
|
16
|
+
export { ResourcesService };
|
|
@@ -1,50 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/services/resources.ts
|
|
21
|
+
var resources_exports = {};
|
|
22
|
+
__export(resources_exports, {
|
|
23
|
+
ResourcesService: () => ResourcesService
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(resources_exports);
|
|
26
|
+
var ResourcesService = class {
|
|
27
|
+
constructor(core) {
|
|
28
|
+
this.core = core;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* GET /v1/resources/{resourceType}*
|
|
32
|
+
* @summary List resources*
|
|
33
|
+
* @description Retrieves a paginated list of resources of the specified type. Supports search and filtering. Resources are returned with their parent relationships and metadata.*/
|
|
34
|
+
list(resourceType, query, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
38
|
+
query,
|
|
39
|
+
...init || {}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* POST /v1/resources/{resourceType}*
|
|
44
|
+
* @summary Create a resource*
|
|
45
|
+
* @description Creates a new resource of the specified type. Resources can have parent relationships to form hierarchies. You can optionally assign initial roles to users when creating the resource. Parent resources must already exist.*/
|
|
46
|
+
create(resourceType, body, init) {
|
|
47
|
+
return this.core.request({
|
|
48
|
+
method: "POST",
|
|
49
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
50
|
+
body,
|
|
51
|
+
...init || {}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* DELETE /v1/resources/{resourceType}/{resourceId}*
|
|
56
|
+
* @summary Delete a resource*
|
|
57
|
+
* @description Deletes a resource by its type and ID. This operation is permanent and cannot be undone. Deleting a resource may affect child resources that depend on it.*/
|
|
58
|
+
delete(resourceType, resourceId, init) {
|
|
59
|
+
return this.core.request({
|
|
60
|
+
method: "DELETE",
|
|
61
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
62
|
+
...init || {}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* GET /v1/resources/{resourceType}/{resourceId}*
|
|
67
|
+
* @summary Read a resource*
|
|
68
|
+
* @description Retrieves a single resource by its type and ID. Returns the resource with its parent relationships and metadata.*/
|
|
69
|
+
read(resourceType, resourceId, init) {
|
|
70
|
+
return this.core.request({
|
|
71
|
+
method: "GET",
|
|
72
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
73
|
+
...init || {}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* PUT /v1/resources/{resourceType}/{resourceId}*
|
|
78
|
+
* @summary Update a resource*
|
|
79
|
+
* @description Updates an existing resource. You can update the resource name and modify parent relationships. Parent resources must already exist.*/
|
|
80
|
+
update(resourceType, resourceId, body, init) {
|
|
81
|
+
return this.core.request({
|
|
82
|
+
method: "PUT",
|
|
83
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
84
|
+
body,
|
|
85
|
+
...init || {}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
ResourcesService
|
|
92
|
+
});
|
|
50
93
|
//# sourceMappingURL=resources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/resources.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class ResourcesService {\n constructor(private core: CoreClient) {}\n\n /**\n * GET /v1/resources/{resourceType}*\n * @summary List resources*\n * @description Retrieves a paginated list of resources of the specified type. Supports search and filtering. Resources are returned with their parent relationships and metadata.*/\n list(\n resourceType: ResourceType,\n query?: Schema.ResourcesListQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.ResourceList> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}`,\n query,\n ...(init || {}),\n });\n }\n\n /**\n * POST /v1/resources/{resourceType}*\n * @summary Create a resource*\n * @description Creates a new resource of the specified type. Resources can have parent relationships to form hierarchies. You can optionally assign initial roles to users when creating the resource. Parent resources must already exist.*/\n create(\n resourceType: ResourceType,\n body: Schema.ResourceCreateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.Resource> {\n return this.core.request({\n method: 'POST',\n path: `/v1/resources/${encodeURIComponent(resourceType)}`,\n body: body as any,\n ...(init || {}),\n });\n }\n\n /**\n * DELETE /v1/resources/{resourceType}/{resourceId}*\n * @summary Delete a resource*\n * @description Deletes a resource by its type and ID. This operation is permanent and cannot be undone. Deleting a resource may affect child resources that depend on it.*/\n delete(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'DELETE',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/resources/{resourceType}/{resourceId}*\n * @summary Read a resource*\n * @description Retrieves a single resource by its type and ID. Returns the resource with its parent relationships and metadata.*/\n read(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.Resource> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n ...(init || {}),\n });\n }\n\n /**\n * PUT /v1/resources/{resourceType}/{resourceId}*\n * @summary Update a resource*\n * @description Updates an existing resource. You can update the resource name and modify parent relationships. Parent resources must already exist.*/\n update(\n resourceType: ResourceType,\n resourceId: string,\n body: Schema.ResourceUpdateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'PUT',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n body: body as any,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,KACE,cACA,OACA,MAC8B;AAC9B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC;AAAA,MACvD;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,MACA,MAC0B;AAC1B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC;AAAA,MACvD;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,YACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KACE,cACA,YACA,MAC0B;AAC1B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,YACA,MACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/services/resources.ts
|
|
2
|
+
var ResourcesService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* GET /v1/resources/{resourceType}*
|
|
8
|
+
* @summary List resources*
|
|
9
|
+
* @description Retrieves a paginated list of resources of the specified type. Supports search and filtering. Resources are returned with their parent relationships and metadata.*/
|
|
10
|
+
list(resourceType, query, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
14
|
+
query,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* POST /v1/resources/{resourceType}*
|
|
20
|
+
* @summary Create a resource*
|
|
21
|
+
* @description Creates a new resource of the specified type. Resources can have parent relationships to form hierarchies. You can optionally assign initial roles to users when creating the resource. Parent resources must already exist.*/
|
|
22
|
+
create(resourceType, body, init) {
|
|
23
|
+
return this.core.request({
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
26
|
+
body,
|
|
27
|
+
...init || {}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* DELETE /v1/resources/{resourceType}/{resourceId}*
|
|
32
|
+
* @summary Delete a resource*
|
|
33
|
+
* @description Deletes a resource by its type and ID. This operation is permanent and cannot be undone. Deleting a resource may affect child resources that depend on it.*/
|
|
34
|
+
delete(resourceType, resourceId, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "DELETE",
|
|
37
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
38
|
+
...init || {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* GET /v1/resources/{resourceType}/{resourceId}*
|
|
43
|
+
* @summary Read a resource*
|
|
44
|
+
* @description Retrieves a single resource by its type and ID. Returns the resource with its parent relationships and metadata.*/
|
|
45
|
+
read(resourceType, resourceId, init) {
|
|
46
|
+
return this.core.request({
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
49
|
+
...init || {}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* PUT /v1/resources/{resourceType}/{resourceId}*
|
|
54
|
+
* @summary Update a resource*
|
|
55
|
+
* @description Updates an existing resource. You can update the resource name and modify parent relationships. Parent resources must already exist.*/
|
|
56
|
+
update(resourceType, resourceId, body, init) {
|
|
57
|
+
return this.core.request({
|
|
58
|
+
method: "PUT",
|
|
59
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
60
|
+
body,
|
|
61
|
+
...init || {}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
ResourcesService
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=resources.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/resources.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class ResourcesService {\n constructor(private core: CoreClient) {}\n\n /**\n * GET /v1/resources/{resourceType}*\n * @summary List resources*\n * @description Retrieves a paginated list of resources of the specified type. Supports search and filtering. Resources are returned with their parent relationships and metadata.*/\n list(\n resourceType: ResourceType,\n query?: Schema.ResourcesListQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.ResourceList> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}`,\n query,\n ...(init || {}),\n });\n }\n\n /**\n * POST /v1/resources/{resourceType}*\n * @summary Create a resource*\n * @description Creates a new resource of the specified type. Resources can have parent relationships to form hierarchies. You can optionally assign initial roles to users when creating the resource. Parent resources must already exist.*/\n create(\n resourceType: ResourceType,\n body: Schema.ResourceCreateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.Resource> {\n return this.core.request({\n method: 'POST',\n path: `/v1/resources/${encodeURIComponent(resourceType)}`,\n body: body as any,\n ...(init || {}),\n });\n }\n\n /**\n * DELETE /v1/resources/{resourceType}/{resourceId}*\n * @summary Delete a resource*\n * @description Deletes a resource by its type and ID. This operation is permanent and cannot be undone. Deleting a resource may affect child resources that depend on it.*/\n delete(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'DELETE',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/resources/{resourceType}/{resourceId}*\n * @summary Read a resource*\n * @description Retrieves a single resource by its type and ID. Returns the resource with its parent relationships and metadata.*/\n read(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.Resource> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n ...(init || {}),\n });\n }\n\n /**\n * PUT /v1/resources/{resourceType}/{resourceId}*\n * @summary Update a resource*\n * @description Updates an existing resource. You can update the resource name and modify parent relationships. Parent resources must already exist.*/\n update(\n resourceType: ResourceType,\n resourceId: string,\n body: Schema.ResourceUpdateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'PUT',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n body: body as any,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";AAIO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,KACE,cACA,OACA,MAC8B;AAC9B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC;AAAA,MACvD;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,MACA,MAC0B;AAC1B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC;AAAA,MACvD;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,YACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KACE,cACA,YACA,MAC0B;AAC1B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,YACA,MACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
2
|
+
import { q as RolesListQuery, r as RoleList, t as RoleCreateBody, u as Role } from '../schema-B1usIXCr.mjs';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class RolesService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
list(userId: string, query?: RolesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<RoleList>;
|
|
10
|
+
create(userId: string, body: RoleCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Role>;
|
|
11
|
+
delete(userId: string, resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { RolesService };
|
package/dist/services/roles.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
2
|
+
import { q as RolesListQuery, r as RoleList, t as RoleCreateBody, u as Role } from '../schema-B1usIXCr.js';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class RolesService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
list(userId: string, query?:
|
|
7
|
-
create(userId: string, body:
|
|
8
|
-
delete(userId: string, resourceType:
|
|
9
|
+
list(userId: string, query?: RolesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<RoleList>;
|
|
10
|
+
create(userId: string, body: RoleCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Role>;
|
|
11
|
+
delete(userId: string, resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
9
12
|
}
|
|
13
|
+
|
|
14
|
+
export { RolesService };
|
package/dist/services/roles.js
CHANGED
|
@@ -1,34 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/services/roles.ts
|
|
21
|
+
var roles_exports = {};
|
|
22
|
+
__export(roles_exports, {
|
|
23
|
+
RolesService: () => RolesService
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(roles_exports);
|
|
26
|
+
var RolesService = class {
|
|
27
|
+
constructor(core) {
|
|
28
|
+
this.core = core;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* GET /v1/users/{userId}/roles*
|
|
32
|
+
* @summary List user roles*
|
|
33
|
+
* @description Retrieves a paginated list of roles assigned to a user. Supports filtering by resource type, resource ID, and role name. Returns both directly assigned roles and inherited roles.*/
|
|
34
|
+
list(userId, query, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
38
|
+
query,
|
|
39
|
+
...init || {}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* POST /v1/users/{userId}/roles*
|
|
44
|
+
* @summary Create a role (assign role to user on resource)*
|
|
45
|
+
* @description Assigns a role to a user on a specific resource. The role must be defined in your resource definitions for the specified resource type. Roles can be inherited from parent resources based on your resource configuration.*/
|
|
46
|
+
create(userId, body, init) {
|
|
47
|
+
return this.core.request({
|
|
48
|
+
method: "POST",
|
|
49
|
+
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
50
|
+
body,
|
|
51
|
+
...init || {}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* DELETE /v1/users/{userId}/roles/{resourceType}/{resourceId}*
|
|
56
|
+
* @summary Delete a role*
|
|
57
|
+
* @description Removes a role assignment from a user on a specific resource. This only removes the direct role assignment and does not affect inherited roles from parent resources.*/
|
|
58
|
+
delete(userId, resourceType, resourceId, init) {
|
|
59
|
+
return this.core.request({
|
|
60
|
+
method: "DELETE",
|
|
61
|
+
path: `/v1/users/${encodeURIComponent(userId)}/roles/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
62
|
+
...init || {}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
RolesService
|
|
69
|
+
});
|
|
34
70
|
//# sourceMappingURL=roles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/roles.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class RolesService {\n constructor(private core: CoreClient) {}\n\n /**\n * GET /v1/users/{userId}/roles*\n * @summary List user roles*\n * @description Retrieves a paginated list of roles assigned to a user. Supports filtering by resource type, resource ID, and role name. Returns both directly assigned roles and inherited roles.*/\n list(\n userId: string,\n query?: Schema.RolesListQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.RoleList> {\n return this.core.request({\n method: 'GET',\n path: `/v1/users/${encodeURIComponent(userId)}/roles`,\n query,\n ...(init || {}),\n });\n }\n\n /**\n * POST /v1/users/{userId}/roles*\n * @summary Create a role (assign role to user on resource)*\n * @description Assigns a role to a user on a specific resource. The role must be defined in your resource definitions for the specified resource type. Roles can be inherited from parent resources based on your resource configuration.*/\n create(\n userId: string,\n body: Schema.RoleCreateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.Role> {\n return this.core.request({\n method: 'POST',\n path: `/v1/users/${encodeURIComponent(userId)}/roles`,\n body: body as any,\n ...(init || {}),\n });\n }\n\n /**\n * DELETE /v1/users/{userId}/roles/{resourceType}/{resourceId}*\n * @summary Delete a role*\n * @description Removes a role assignment from a user on a specific resource. This only removes the direct role assignment and does not affect inherited roles from parent resources.*/\n delete(\n userId: string,\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'DELETE',\n path: `/v1/users/${encodeURIComponent(userId)}/roles/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,KACE,QACA,OACA,MAC0B;AAC1B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,aAAa,mBAAmB,MAAM,CAAC;AAAA,MAC7C;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,QACA,MACA,MACsB;AACtB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,aAAa,mBAAmB,MAAM,CAAC;AAAA,MAC7C;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,QACA,cACA,YACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,aAAa,mBAAmB,MAAM,CAAC,UAAU,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzH,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/services/roles.ts
|
|
2
|
+
var RolesService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* GET /v1/users/{userId}/roles*
|
|
8
|
+
* @summary List user roles*
|
|
9
|
+
* @description Retrieves a paginated list of roles assigned to a user. Supports filtering by resource type, resource ID, and role name. Returns both directly assigned roles and inherited roles.*/
|
|
10
|
+
list(userId, query, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
14
|
+
query,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* POST /v1/users/{userId}/roles*
|
|
20
|
+
* @summary Create a role (assign role to user on resource)*
|
|
21
|
+
* @description Assigns a role to a user on a specific resource. The role must be defined in your resource definitions for the specified resource type. Roles can be inherited from parent resources based on your resource configuration.*/
|
|
22
|
+
create(userId, body, init) {
|
|
23
|
+
return this.core.request({
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
26
|
+
body,
|
|
27
|
+
...init || {}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* DELETE /v1/users/{userId}/roles/{resourceType}/{resourceId}*
|
|
32
|
+
* @summary Delete a role*
|
|
33
|
+
* @description Removes a role assignment from a user on a specific resource. This only removes the direct role assignment and does not affect inherited roles from parent resources.*/
|
|
34
|
+
delete(userId, resourceType, resourceId, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "DELETE",
|
|
37
|
+
path: `/v1/users/${encodeURIComponent(userId)}/roles/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
38
|
+
...init || {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
RolesService
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=roles.mjs.map
|