@blimu/backend 1.1.1 → 1.1.3
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 +6 -13
- package/dist/__tests__/token-verifier.test.cjs +17662 -0
- package/dist/__tests__/token-verifier.test.cjs.map +1 -0
- package/dist/__tests__/token-verifier.test.d.mts +2 -0
- package/dist/__tests__/token-verifier.test.d.ts +2 -0
- package/dist/__tests__/token-verifier.test.mjs +17661 -0
- package/dist/__tests__/token-verifier.test.mjs.map +1 -0
- package/dist/auth-strategies.cjs +42 -0
- package/dist/auth-strategies.cjs.map +1 -0
- package/dist/auth-strategies.d.mts +16 -0
- package/dist/auth-strategies.d.ts +16 -0
- package/dist/auth-strategies.mjs +17 -0
- package/dist/auth-strategies.mjs.map +1 -0
- package/dist/client.cjs +483 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.mts +26 -18
- package/dist/client.d.ts +26 -18
- package/dist/client.mjs +447 -39
- package/dist/client.mjs.map +1 -1
- package/dist/{main.js → index.cjs} +290 -407
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +15 -33
- package/dist/index.d.ts +15 -33
- package/dist/index.mjs +440 -339
- package/dist/index.mjs.map +1 -1
- package/dist/{schema-B1usIXCr.d.mts → schema-BbKn_i-U.d.mts} +82 -93
- package/dist/{schema-B1usIXCr.d.ts → schema-BbKn_i-U.d.ts} +82 -93
- package/dist/{schema.js → schema.cjs} +1 -1
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.mts +1 -2
- package/dist/schema.d.ts +1 -2
- package/dist/{schema.zod-CRNAHxbc.d.mts → schema.zod-DtXVS-1g.d.mts} +38 -48
- package/dist/{schema.zod-CRNAHxbc.d.ts → schema.zod-DtXVS-1g.d.ts} +38 -48
- package/dist/{schema.zod.js → schema.zod.cjs} +174 -248
- package/dist/schema.zod.cjs.map +1 -0
- package/dist/schema.zod.d.mts +1 -1
- package/dist/schema.zod.d.ts +1 -1
- package/dist/schema.zod.mjs +173 -242
- package/dist/schema.zod.mjs.map +1 -1
- package/dist/services/{bulk_resources.js → bulk_resources.cjs} +3 -2
- package/dist/services/bulk_resources.cjs.map +1 -0
- package/dist/services/bulk_resources.d.mts +4 -6
- package/dist/services/bulk_resources.d.ts +4 -6
- package/dist/services/bulk_resources.mjs +2 -1
- package/dist/services/bulk_resources.mjs.map +1 -1
- package/dist/services/{bulk_roles.js → bulk_roles.cjs} +3 -2
- package/dist/services/bulk_roles.cjs.map +1 -0
- package/dist/services/bulk_roles.d.mts +3 -5
- package/dist/services/bulk_roles.d.ts +3 -5
- package/dist/services/bulk_roles.mjs +2 -1
- package/dist/services/bulk_roles.mjs.map +1 -1
- package/dist/services/{entitlements.js → entitlements.cjs} +5 -4
- package/dist/services/entitlements.cjs.map +1 -0
- package/dist/services/entitlements.d.mts +4 -6
- package/dist/services/entitlements.d.ts +4 -6
- package/dist/services/entitlements.mjs +4 -3
- package/dist/services/entitlements.mjs.map +1 -1
- package/dist/services/{plans.js → plans.cjs} +5 -4
- package/dist/services/plans.cjs.map +1 -0
- package/dist/services/plans.d.mts +6 -8
- package/dist/services/plans.d.ts +6 -8
- package/dist/services/plans.mjs +4 -3
- package/dist/services/plans.mjs.map +1 -1
- package/dist/services/{resource_members.js → resource_members.cjs} +3 -2
- package/dist/services/resource_members.cjs.map +1 -0
- package/dist/services/resource_members.d.mts +4 -6
- package/dist/services/resource_members.d.ts +4 -6
- package/dist/services/resource_members.mjs +2 -1
- package/dist/services/resource_members.mjs.map +1 -1
- package/dist/services/{resources.js → resources.cjs} +7 -6
- package/dist/services/resources.cjs.map +1 -0
- package/dist/services/resources.d.mts +8 -10
- package/dist/services/resources.d.ts +8 -10
- package/dist/services/resources.mjs +6 -5
- package/dist/services/resources.mjs.map +1 -1
- package/dist/services/{roles.js → roles.cjs} +5 -4
- package/dist/services/roles.cjs.map +1 -0
- package/dist/services/roles.d.mts +4 -6
- package/dist/services/roles.d.ts +4 -6
- package/dist/services/roles.mjs +4 -3
- package/dist/services/roles.mjs.map +1 -1
- package/dist/services/{usage.js → usage.cjs} +7 -6
- package/dist/services/usage.cjs.map +1 -0
- package/dist/services/usage.d.mts +5 -7
- package/dist/services/usage.d.ts +5 -7
- package/dist/services/usage.mjs +6 -5
- package/dist/services/usage.mjs.map +1 -1
- package/dist/services/{users.js → users.cjs} +8 -7
- package/dist/services/users.cjs.map +1 -0
- package/dist/services/users.d.mts +3 -5
- package/dist/services/users.d.ts +3 -5
- package/dist/services/users.mjs +7 -6
- package/dist/services/users.mjs.map +1 -1
- package/dist/{token-verifier.js → token-verifier.cjs} +10 -30
- package/dist/token-verifier.cjs.map +1 -0
- package/dist/token-verifier.d.mts +5 -5
- package/dist/token-verifier.d.ts +5 -5
- package/dist/token-verifier.mjs +10 -33
- package/dist/token-verifier.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{utils.js → utils.cjs} +9 -3
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.mts +4 -3
- package/dist/utils.d.ts +4 -3
- package/dist/utils.mjs +7 -2
- package/dist/utils.mjs.map +1 -1
- package/package.json +36 -24
- package/dist/client.js +0 -71
- package/dist/client.js.map +0 -1
- package/dist/index.js +0 -1052
- package/dist/index.js.map +0 -1
- package/dist/main.d.mts +0 -19
- package/dist/main.d.ts +0 -19
- package/dist/main.js.map +0 -1
- package/dist/main.mjs +0 -1275
- package/dist/main.mjs.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/schema.zod.js.map +0 -1
- package/dist/services/bulk_resources.js.map +0 -1
- package/dist/services/bulk_roles.js.map +0 -1
- package/dist/services/entitlements.js.map +0 -1
- package/dist/services/plans.js.map +0 -1
- package/dist/services/resource_members.js.map +0 -1
- package/dist/services/resources.js.map +0 -1
- package/dist/services/roles.js.map +0 -1
- package/dist/services/usage.js.map +0 -1
- package/dist/services/users.js.map +0 -1
- package/dist/token-verifier.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/src/client.ts +0 -74
- package/src/index.ts +0 -55
- package/src/main.ts +0 -3
- package/src/schema.ts +0 -430
- package/src/schema.zod.ts +0 -558
- package/src/services/bulk_resources.ts +0 -24
- package/src/services/bulk_roles.ts +0 -22
- package/src/services/entitlements.ts +0 -58
- package/src/services/plans.ts +0 -57
- package/src/services/resource_members.ts +0 -25
- package/src/services/resources.ts +0 -91
- package/src/services/roles.ts +0 -58
- package/src/services/usage.ts +0 -93
- package/src/services/users.ts +0 -100
- package/src/token-verifier.ts +0 -280
- package/src/utils.ts +0 -56
|
@@ -23,6 +23,7 @@ __export(resource_members_exports, {
|
|
|
23
23
|
ResourceMembersService: () => ResourceMembersService
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(resource_members_exports);
|
|
26
|
+
var import_fetch = require("@blimu/fetch");
|
|
26
27
|
var ResourceMembersService = class {
|
|
27
28
|
constructor(core) {
|
|
28
29
|
this.core = core;
|
|
@@ -36,7 +37,7 @@ var ResourceMembersService = class {
|
|
|
36
37
|
method: "GET",
|
|
37
38
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/members`,
|
|
38
39
|
query,
|
|
39
|
-
...init
|
|
40
|
+
...init ?? {}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
};
|
|
@@ -44,4 +45,4 @@ var ResourceMembersService = class {
|
|
|
44
45
|
0 && (module.exports = {
|
|
45
46
|
ResourceMembersService
|
|
46
47
|
});
|
|
47
|
-
//# sourceMappingURL=resource_members.
|
|
48
|
+
//# sourceMappingURL=resource_members.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/resource_members.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class ResourceMembersService {\n constructor(private core: FetchClient) {}\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: string,\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;AAAA,mBAA4B;AAGrB,IAAM,yBAAN,MAA6B;AAAA,EAClC,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,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":[]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { j as ResourceMembersListQuery, k as ResourceMemberList } from '../schema-
|
|
3
|
-
import { ResourceType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { j as ResourceMembersListQuery, k as ResourceMemberList } from '../schema-BbKn_i-U.mjs';
|
|
5
3
|
|
|
6
4
|
declare class ResourceMembersService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
9
|
-
list(resourceType:
|
|
6
|
+
constructor(core: FetchClient);
|
|
7
|
+
list(resourceType: string, resourceId: string, query?: ResourceMembersListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceMemberList>;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
export { ResourceMembersService };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { j as ResourceMembersListQuery, k as ResourceMemberList } from '../schema-
|
|
3
|
-
import { ResourceType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { j as ResourceMembersListQuery, k as ResourceMemberList } from '../schema-BbKn_i-U.js';
|
|
5
3
|
|
|
6
4
|
declare class ResourceMembersService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
9
|
-
list(resourceType:
|
|
6
|
+
constructor(core: FetchClient);
|
|
7
|
+
list(resourceType: string, resourceId: string, query?: ResourceMembersListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceMemberList>;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
export { ResourceMembersService };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/services/resource_members.ts
|
|
2
|
+
import "@blimu/fetch";
|
|
2
3
|
var ResourceMembersService = class {
|
|
3
4
|
constructor(core) {
|
|
4
5
|
this.core = core;
|
|
@@ -12,7 +13,7 @@ var ResourceMembersService = class {
|
|
|
12
13
|
method: "GET",
|
|
13
14
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/members`,
|
|
14
15
|
query,
|
|
15
|
-
...init
|
|
16
|
+
...init ?? {}
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/resource_members.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/services/resource_members.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class ResourceMembersService {\n constructor(private core: FetchClient) {}\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: string,\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,OAA4B;AAGrB,IAAM,yBAAN,MAA6B;AAAA,EAClC,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,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":[]}
|
|
@@ -23,6 +23,7 @@ __export(resources_exports, {
|
|
|
23
23
|
ResourcesService: () => ResourcesService
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(resources_exports);
|
|
26
|
+
var import_fetch = require("@blimu/fetch");
|
|
26
27
|
var ResourcesService = class {
|
|
27
28
|
constructor(core) {
|
|
28
29
|
this.core = core;
|
|
@@ -36,7 +37,7 @@ var ResourcesService = class {
|
|
|
36
37
|
method: "GET",
|
|
37
38
|
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
38
39
|
query,
|
|
39
|
-
...init
|
|
40
|
+
...init ?? {}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
@@ -48,7 +49,7 @@ var ResourcesService = class {
|
|
|
48
49
|
method: "POST",
|
|
49
50
|
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
50
51
|
body,
|
|
51
|
-
...init
|
|
52
|
+
...init ?? {}
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
@@ -59,7 +60,7 @@ var ResourcesService = class {
|
|
|
59
60
|
return this.core.request({
|
|
60
61
|
method: "DELETE",
|
|
61
62
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
62
|
-
...init
|
|
63
|
+
...init ?? {}
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
@@ -70,7 +71,7 @@ var ResourcesService = class {
|
|
|
70
71
|
return this.core.request({
|
|
71
72
|
method: "GET",
|
|
72
73
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
73
|
-
...init
|
|
74
|
+
...init ?? {}
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
/**
|
|
@@ -82,7 +83,7 @@ var ResourcesService = class {
|
|
|
82
83
|
method: "PUT",
|
|
83
84
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
84
85
|
body,
|
|
85
|
-
...init
|
|
86
|
+
...init ?? {}
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
};
|
|
@@ -90,4 +91,4 @@ var ResourcesService = class {
|
|
|
90
91
|
0 && (module.exports = {
|
|
91
92
|
ResourcesService
|
|
92
93
|
});
|
|
93
|
-
//# sourceMappingURL=resources.
|
|
94
|
+
//# sourceMappingURL=resources.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/resources.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class ResourcesService {\n constructor(private core: FetchClient) {}\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: string,\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: string,\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,\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: string,\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: string,\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: string,\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,\n ...(init ?? {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4B;AAGrB,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,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":[]}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as ResourcesListQuery, m as ResourceList, n as ResourceCreateBody, o as Resource, p as ResourceUpdateBody } from '../schema-
|
|
3
|
-
import { ResourceType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { l as ResourcesListQuery, m as ResourceList, n as ResourceCreateBody, o as Resource, p as ResourceUpdateBody } from '../schema-BbKn_i-U.mjs';
|
|
5
3
|
|
|
6
4
|
declare class ResourcesService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
9
|
-
list(resourceType:
|
|
10
|
-
create(resourceType:
|
|
11
|
-
delete(resourceType:
|
|
12
|
-
read(resourceType:
|
|
13
|
-
update(resourceType:
|
|
6
|
+
constructor(core: FetchClient);
|
|
7
|
+
list(resourceType: string, query?: ResourcesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceList>;
|
|
8
|
+
create(resourceType: string, body: ResourceCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
9
|
+
delete(resourceType: string, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
10
|
+
read(resourceType: string, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
11
|
+
update(resourceType: string, resourceId: string, body: ResourceUpdateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export { ResourcesService };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as ResourcesListQuery, m as ResourceList, n as ResourceCreateBody, o as Resource, p as ResourceUpdateBody } from '../schema-
|
|
3
|
-
import { ResourceType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { l as ResourcesListQuery, m as ResourceList, n as ResourceCreateBody, o as Resource, p as ResourceUpdateBody } from '../schema-BbKn_i-U.js';
|
|
5
3
|
|
|
6
4
|
declare class ResourcesService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
9
|
-
list(resourceType:
|
|
10
|
-
create(resourceType:
|
|
11
|
-
delete(resourceType:
|
|
12
|
-
read(resourceType:
|
|
13
|
-
update(resourceType:
|
|
6
|
+
constructor(core: FetchClient);
|
|
7
|
+
list(resourceType: string, query?: ResourcesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceList>;
|
|
8
|
+
create(resourceType: string, body: ResourceCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
9
|
+
delete(resourceType: string, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
10
|
+
read(resourceType: string, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Resource>;
|
|
11
|
+
update(resourceType: string, resourceId: string, body: ResourceUpdateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export { ResourcesService };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/services/resources.ts
|
|
2
|
+
import "@blimu/fetch";
|
|
2
3
|
var ResourcesService = class {
|
|
3
4
|
constructor(core) {
|
|
4
5
|
this.core = core;
|
|
@@ -12,7 +13,7 @@ var ResourcesService = class {
|
|
|
12
13
|
method: "GET",
|
|
13
14
|
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
14
15
|
query,
|
|
15
|
-
...init
|
|
16
|
+
...init ?? {}
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
@@ -24,7 +25,7 @@ var ResourcesService = class {
|
|
|
24
25
|
method: "POST",
|
|
25
26
|
path: `/v1/resources/${encodeURIComponent(resourceType)}`,
|
|
26
27
|
body,
|
|
27
|
-
...init
|
|
28
|
+
...init ?? {}
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
@@ -35,7 +36,7 @@ var ResourcesService = class {
|
|
|
35
36
|
return this.core.request({
|
|
36
37
|
method: "DELETE",
|
|
37
38
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
38
|
-
...init
|
|
39
|
+
...init ?? {}
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
@@ -46,7 +47,7 @@ var ResourcesService = class {
|
|
|
46
47
|
return this.core.request({
|
|
47
48
|
method: "GET",
|
|
48
49
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
49
|
-
...init
|
|
50
|
+
...init ?? {}
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
@@ -58,7 +59,7 @@ var ResourcesService = class {
|
|
|
58
59
|
method: "PUT",
|
|
59
60
|
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
60
61
|
body,
|
|
61
|
-
...init
|
|
62
|
+
...init ?? {}
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/resources.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/services/resources.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class ResourcesService {\n constructor(private core: FetchClient) {}\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: string,\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: string,\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,\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: string,\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: string,\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: string,\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,\n ...(init ?? {}),\n });\n }\n}\n"],"mappings":";AAAA,OAA4B;AAGrB,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,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":[]}
|
|
@@ -23,6 +23,7 @@ __export(roles_exports, {
|
|
|
23
23
|
RolesService: () => RolesService
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(roles_exports);
|
|
26
|
+
var import_fetch = require("@blimu/fetch");
|
|
26
27
|
var RolesService = class {
|
|
27
28
|
constructor(core) {
|
|
28
29
|
this.core = core;
|
|
@@ -36,7 +37,7 @@ var RolesService = class {
|
|
|
36
37
|
method: "GET",
|
|
37
38
|
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
38
39
|
query,
|
|
39
|
-
...init
|
|
40
|
+
...init ?? {}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
@@ -48,7 +49,7 @@ var RolesService = class {
|
|
|
48
49
|
method: "POST",
|
|
49
50
|
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
50
51
|
body,
|
|
51
|
-
...init
|
|
52
|
+
...init ?? {}
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
@@ -59,7 +60,7 @@ var RolesService = class {
|
|
|
59
60
|
return this.core.request({
|
|
60
61
|
method: "DELETE",
|
|
61
62
|
path: `/v1/users/${encodeURIComponent(userId)}/roles/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
62
|
-
...init
|
|
63
|
+
...init ?? {}
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
};
|
|
@@ -67,4 +68,4 @@ var RolesService = class {
|
|
|
67
68
|
0 && (module.exports = {
|
|
68
69
|
RolesService
|
|
69
70
|
});
|
|
70
|
-
//# sourceMappingURL=roles.
|
|
71
|
+
//# sourceMappingURL=roles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/roles.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class RolesService {\n constructor(private core: FetchClient) {}\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,\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: string,\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;AAAA,mBAA4B;AAGrB,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,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":[]}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { q as RolesListQuery, r as RoleList, t as RoleCreateBody, u as Role } from '../schema-
|
|
3
|
-
import { ResourceType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { q as RolesListQuery, r as RoleList, t as RoleCreateBody, u as Role } from '../schema-BbKn_i-U.mjs';
|
|
5
3
|
|
|
6
4
|
declare class RolesService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
6
|
+
constructor(core: FetchClient);
|
|
9
7
|
list(userId: string, query?: RolesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<RoleList>;
|
|
10
8
|
create(userId: string, body: RoleCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Role>;
|
|
11
|
-
delete(userId: string, resourceType:
|
|
9
|
+
delete(userId: string, resourceType: string, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
export { RolesService };
|
package/dist/services/roles.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { q as RolesListQuery, r as RoleList, t as RoleCreateBody, u as Role } from '../schema-
|
|
3
|
-
import { ResourceType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { q as RolesListQuery, r as RoleList, t as RoleCreateBody, u as Role } from '../schema-BbKn_i-U.js';
|
|
5
3
|
|
|
6
4
|
declare class RolesService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
6
|
+
constructor(core: FetchClient);
|
|
9
7
|
list(userId: string, query?: RolesListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<RoleList>;
|
|
10
8
|
create(userId: string, body: RoleCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Role>;
|
|
11
|
-
delete(userId: string, resourceType:
|
|
9
|
+
delete(userId: string, resourceType: string, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
export { RolesService };
|
package/dist/services/roles.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/services/roles.ts
|
|
2
|
+
import "@blimu/fetch";
|
|
2
3
|
var RolesService = class {
|
|
3
4
|
constructor(core) {
|
|
4
5
|
this.core = core;
|
|
@@ -12,7 +13,7 @@ var RolesService = class {
|
|
|
12
13
|
method: "GET",
|
|
13
14
|
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
14
15
|
query,
|
|
15
|
-
...init
|
|
16
|
+
...init ?? {}
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
@@ -24,7 +25,7 @@ var RolesService = class {
|
|
|
24
25
|
method: "POST",
|
|
25
26
|
path: `/v1/users/${encodeURIComponent(userId)}/roles`,
|
|
26
27
|
body,
|
|
27
|
-
...init
|
|
28
|
+
...init ?? {}
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
@@ -35,7 +36,7 @@ var RolesService = class {
|
|
|
35
36
|
return this.core.request({
|
|
36
37
|
method: "DELETE",
|
|
37
38
|
path: `/v1/users/${encodeURIComponent(userId)}/roles/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
38
|
-
...init
|
|
39
|
+
...init ?? {}
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/roles.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/services/roles.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class RolesService {\n constructor(private core: FetchClient) {}\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,\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: string,\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,OAA4B;AAGrB,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,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":[]}
|
|
@@ -23,6 +23,7 @@ __export(usage_exports, {
|
|
|
23
23
|
UsageService: () => UsageService
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(usage_exports);
|
|
26
|
+
var import_fetch = require("@blimu/fetch");
|
|
26
27
|
var UsageService = class {
|
|
27
28
|
constructor(core) {
|
|
28
29
|
this.core = core;
|
|
@@ -36,7 +37,7 @@ var UsageService = class {
|
|
|
36
37
|
method: "GET",
|
|
37
38
|
path: `/v1/usage/balance/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
38
39
|
query,
|
|
39
|
-
...init
|
|
40
|
+
...init ?? {}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
@@ -48,7 +49,7 @@ var UsageService = class {
|
|
|
48
49
|
method: "POST",
|
|
49
50
|
path: `/v1/usage/check`,
|
|
50
51
|
body,
|
|
51
|
-
...init
|
|
52
|
+
...init ?? {}
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
@@ -60,7 +61,7 @@ var UsageService = class {
|
|
|
60
61
|
method: "POST",
|
|
61
62
|
path: `/v1/usage/consume`,
|
|
62
63
|
body,
|
|
63
|
-
...init
|
|
64
|
+
...init ?? {}
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
@@ -72,7 +73,7 @@ var UsageService = class {
|
|
|
72
73
|
method: "POST",
|
|
73
74
|
path: `/v1/usage/credit`,
|
|
74
75
|
body,
|
|
75
|
-
...init
|
|
76
|
+
...init ?? {}
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
@@ -84,7 +85,7 @@ var UsageService = class {
|
|
|
84
85
|
method: "GET",
|
|
85
86
|
path: `/v1/usage/transactions/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
86
87
|
query,
|
|
87
|
-
...init
|
|
88
|
+
...init ?? {}
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
};
|
|
@@ -92,4 +93,4 @@ var UsageService = class {
|
|
|
92
93
|
0 && (module.exports = {
|
|
93
94
|
UsageService
|
|
94
95
|
});
|
|
95
|
-
//# sourceMappingURL=usage.
|
|
96
|
+
//# sourceMappingURL=usage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/usage.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class UsageService {\n constructor(private core: FetchClient) {}\n\n /**\n * GET /v1/usage/balance/{resourceType}/{resourceId}/{limitType}*\n * @summary Get wallet balance*\n * @description Retrieves the current balance of a usage wallet for a specific resource and limit type within a given time period. The balance reflects all credits and consumption transactions.*/\n getBalance(\n resourceType: string,\n resourceId: string,\n limitType: string,\n query?: Schema.UsageGetBalanceQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.BalanceResponse> {\n return this.core.request({\n method: 'GET',\n path: `/v1/usage/balance/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,\n query,\n ...(init ?? {}),\n });\n }\n\n /**\n * POST /v1/usage/check*\n * @summary Check if consumption is allowed*\n * @description Checks whether a specific amount of consumption is allowed for a resource and limit type within a given time period. Returns the current balance, requested amount, and remaining balance after the consumption.*/\n checkLimit(\n body: Schema.UsageCheckBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.CheckLimitResponse> {\n return this.core.request({\n method: 'POST',\n path: `/v1/usage/check`,\n body,\n ...(init ?? {}),\n });\n }\n\n /**\n * POST /v1/usage/consume*\n * @summary Record consumption (inserts negative amount)*\n * @description Records consumption from a usage wallet for a specific resource and limit type. This decreases the available balance. Consumption can be tagged for tracking purposes.*/\n consume(\n body: Schema.UsageConsumeBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.UsageWalletResponse> {\n return this.core.request({\n method: 'POST',\n path: `/v1/usage/consume`,\n body,\n ...(init ?? {}),\n });\n }\n\n /**\n * POST /v1/usage/credit*\n * @summary Add credits to wallet (inserts positive amount)*\n * @description Adds credits to a usage wallet for a specific resource and limit type. This increases the available balance for usage-based limits. Credits can be tagged for tracking purposes.*/\n credit(\n body: Schema.UsageCreditBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.UsageWalletResponse> {\n return this.core.request({\n method: 'POST',\n path: `/v1/usage/credit`,\n body,\n ...(init ?? {}),\n });\n }\n\n /**\n * GET /v1/usage/transactions/{resourceType}/{resourceId}/{limitType}*\n * @summary Get transaction history*\n * @description Retrieves the transaction history for a usage wallet, including all credits and consumption records. Supports filtering by time period and date range.*/\n getTransactionHistory(\n resourceType: string,\n resourceId: string,\n limitType: string,\n query?: Schema.UsageGetTransactionHistoryQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.TransactionHistoryResponse> {\n return this.core.request({\n method: 'GET',\n path: `/v1/usage/transactions/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,\n query,\n ...(init ?? {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4B;AAGrB,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,WACE,cACA,YACA,WACA,OACA,MACiC;AACjC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,qBAAqB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC,IAAI,mBAAmB,SAAS,CAAC;AAAA,MAC9H;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WACE,MACA,MACoC;AACpC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,QACE,MACA,MACqC;AACrC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,MACA,MACqC;AACrC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,sBACE,cACA,YACA,WACA,OACA,MAC4C;AAC5C,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,0BAA0B,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC,IAAI,mBAAmB,SAAS,CAAC;AAAA,MACnI;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { U as UsageGetBalanceQuery, B as BalanceResponse, v as UsageCheckBody, C as CheckLimitResponse, w as UsageConsumeBody, x as UsageWalletResponse, y as UsageCreditBody, z as UsageGetTransactionHistoryQuery, T as TransactionHistoryResponse } from '../schema-
|
|
3
|
-
import { ResourceType, UsageLimitType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { U as UsageGetBalanceQuery, B as BalanceResponse, v as UsageCheckBody, C as CheckLimitResponse, w as UsageConsumeBody, x as UsageWalletResponse, y as UsageCreditBody, z as UsageGetTransactionHistoryQuery, T as TransactionHistoryResponse } from '../schema-BbKn_i-U.mjs';
|
|
5
3
|
|
|
6
4
|
declare class UsageService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
9
|
-
getBalance(resourceType:
|
|
6
|
+
constructor(core: FetchClient);
|
|
7
|
+
getBalance(resourceType: string, resourceId: string, limitType: string, query?: UsageGetBalanceQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<BalanceResponse>;
|
|
10
8
|
checkLimit(body: UsageCheckBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<CheckLimitResponse>;
|
|
11
9
|
consume(body: UsageConsumeBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
12
10
|
credit(body: UsageCreditBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
13
|
-
getTransactionHistory(resourceType:
|
|
11
|
+
getTransactionHistory(resourceType: string, resourceId: string, limitType: string, query?: UsageGetTransactionHistoryQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<TransactionHistoryResponse>;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export { UsageService };
|
package/dist/services/usage.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { U as UsageGetBalanceQuery, B as BalanceResponse, v as UsageCheckBody, C as CheckLimitResponse, w as UsageConsumeBody, x as UsageWalletResponse, y as UsageCreditBody, z as UsageGetTransactionHistoryQuery, T as TransactionHistoryResponse } from '../schema-
|
|
3
|
-
import { ResourceType, UsageLimitType } from '@blimu/types';
|
|
4
|
-
import '@blimu/fetch';
|
|
1
|
+
import { FetchClient } from '@blimu/fetch';
|
|
2
|
+
import { U as UsageGetBalanceQuery, B as BalanceResponse, v as UsageCheckBody, C as CheckLimitResponse, w as UsageConsumeBody, x as UsageWalletResponse, y as UsageCreditBody, z as UsageGetTransactionHistoryQuery, T as TransactionHistoryResponse } from '../schema-BbKn_i-U.js';
|
|
5
3
|
|
|
6
4
|
declare class UsageService {
|
|
7
5
|
private core;
|
|
8
|
-
constructor(core:
|
|
9
|
-
getBalance(resourceType:
|
|
6
|
+
constructor(core: FetchClient);
|
|
7
|
+
getBalance(resourceType: string, resourceId: string, limitType: string, query?: UsageGetBalanceQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<BalanceResponse>;
|
|
10
8
|
checkLimit(body: UsageCheckBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<CheckLimitResponse>;
|
|
11
9
|
consume(body: UsageConsumeBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
12
10
|
credit(body: UsageCreditBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
13
|
-
getTransactionHistory(resourceType:
|
|
11
|
+
getTransactionHistory(resourceType: string, resourceId: string, limitType: string, query?: UsageGetTransactionHistoryQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<TransactionHistoryResponse>;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export { UsageService };
|
package/dist/services/usage.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/services/usage.ts
|
|
2
|
+
import "@blimu/fetch";
|
|
2
3
|
var UsageService = class {
|
|
3
4
|
constructor(core) {
|
|
4
5
|
this.core = core;
|
|
@@ -12,7 +13,7 @@ var UsageService = class {
|
|
|
12
13
|
method: "GET",
|
|
13
14
|
path: `/v1/usage/balance/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
14
15
|
query,
|
|
15
|
-
...init
|
|
16
|
+
...init ?? {}
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
@@ -24,7 +25,7 @@ var UsageService = class {
|
|
|
24
25
|
method: "POST",
|
|
25
26
|
path: `/v1/usage/check`,
|
|
26
27
|
body,
|
|
27
|
-
...init
|
|
28
|
+
...init ?? {}
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
@@ -36,7 +37,7 @@ var UsageService = class {
|
|
|
36
37
|
method: "POST",
|
|
37
38
|
path: `/v1/usage/consume`,
|
|
38
39
|
body,
|
|
39
|
-
...init
|
|
40
|
+
...init ?? {}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
@@ -48,7 +49,7 @@ var UsageService = class {
|
|
|
48
49
|
method: "POST",
|
|
49
50
|
path: `/v1/usage/credit`,
|
|
50
51
|
body,
|
|
51
|
-
...init
|
|
52
|
+
...init ?? {}
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
@@ -60,7 +61,7 @@ var UsageService = class {
|
|
|
60
61
|
method: "GET",
|
|
61
62
|
path: `/v1/usage/transactions/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
62
63
|
query,
|
|
63
|
-
...init
|
|
64
|
+
...init ?? {}
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/usage.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/services/usage.ts"],"sourcesContent":["import { FetchClient } from '@blimu/fetch';\nimport * as Schema from '../schema';\n\nexport class UsageService {\n constructor(private core: FetchClient) {}\n\n /**\n * GET /v1/usage/balance/{resourceType}/{resourceId}/{limitType}*\n * @summary Get wallet balance*\n * @description Retrieves the current balance of a usage wallet for a specific resource and limit type within a given time period. The balance reflects all credits and consumption transactions.*/\n getBalance(\n resourceType: string,\n resourceId: string,\n limitType: string,\n query?: Schema.UsageGetBalanceQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.BalanceResponse> {\n return this.core.request({\n method: 'GET',\n path: `/v1/usage/balance/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,\n query,\n ...(init ?? {}),\n });\n }\n\n /**\n * POST /v1/usage/check*\n * @summary Check if consumption is allowed*\n * @description Checks whether a specific amount of consumption is allowed for a resource and limit type within a given time period. Returns the current balance, requested amount, and remaining balance after the consumption.*/\n checkLimit(\n body: Schema.UsageCheckBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.CheckLimitResponse> {\n return this.core.request({\n method: 'POST',\n path: `/v1/usage/check`,\n body,\n ...(init ?? {}),\n });\n }\n\n /**\n * POST /v1/usage/consume*\n * @summary Record consumption (inserts negative amount)*\n * @description Records consumption from a usage wallet for a specific resource and limit type. This decreases the available balance. Consumption can be tagged for tracking purposes.*/\n consume(\n body: Schema.UsageConsumeBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.UsageWalletResponse> {\n return this.core.request({\n method: 'POST',\n path: `/v1/usage/consume`,\n body,\n ...(init ?? {}),\n });\n }\n\n /**\n * POST /v1/usage/credit*\n * @summary Add credits to wallet (inserts positive amount)*\n * @description Adds credits to a usage wallet for a specific resource and limit type. This increases the available balance for usage-based limits. Credits can be tagged for tracking purposes.*/\n credit(\n body: Schema.UsageCreditBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.UsageWalletResponse> {\n return this.core.request({\n method: 'POST',\n path: `/v1/usage/credit`,\n body,\n ...(init ?? {}),\n });\n }\n\n /**\n * GET /v1/usage/transactions/{resourceType}/{resourceId}/{limitType}*\n * @summary Get transaction history*\n * @description Retrieves the transaction history for a usage wallet, including all credits and consumption records. Supports filtering by time period and date range.*/\n getTransactionHistory(\n resourceType: string,\n resourceId: string,\n limitType: string,\n query?: Schema.UsageGetTransactionHistoryQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.TransactionHistoryResponse> {\n return this.core.request({\n method: 'GET',\n path: `/v1/usage/transactions/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,\n query,\n ...(init ?? {}),\n });\n }\n}\n"],"mappings":";AAAA,OAA4B;AAGrB,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxC,WACE,cACA,YACA,WACA,OACA,MACiC;AACjC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,qBAAqB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC,IAAI,mBAAmB,SAAS,CAAC;AAAA,MAC9H;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WACE,MACA,MACoC;AACpC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,QACE,MACA,MACqC;AACrC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,MACA,MACqC;AACrC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,sBACE,cACA,YACA,WACA,OACA,MAC4C;AAC5C,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,0BAA0B,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC,IAAI,mBAAmB,SAAS,CAAC;AAAA,MACnI;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|