@blimu/backend 0.6.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -134
- package/dist/client.d.mts +24 -0
- package/dist/client.d.ts +15 -57
- package/dist/client.js +67 -157
- 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 +1037 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1005 -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 +1273 -0
- package/dist/main.js.map +1 -0
- package/dist/main.mjs +1264 -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 -2
- 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 +562 -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 -18
- 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 -18
- 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 -34
- 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 -32
- 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 -17
- 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 -49
- 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 -33
- 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 -52
- 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 -56
- 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 +225 -172
- package/dist/token-verifier.js.map +1 -1
- package/dist/token-verifier.mjs +201 -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 -20
- 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
|
@@ -0,0 +1 @@
|
|
|
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":";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,16 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
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-B1usIXCr.mjs';
|
|
3
|
+
import { ResourceType, UsageLimitType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class UsageService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
getBalance(resourceType: ResourceType, resourceId: string, limitType: UsageLimitType, query?: UsageGetBalanceQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<BalanceResponse>;
|
|
10
|
+
checkLimit(body: UsageCheckBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<CheckLimitResponse>;
|
|
11
|
+
consume(body: UsageConsumeBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
12
|
+
credit(body: UsageCreditBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
13
|
+
getTransactionHistory(resourceType: ResourceType, resourceId: string, limitType: UsageLimitType, query?: UsageGetTransactionHistoryQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<TransactionHistoryResponse>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { UsageService };
|
package/dist/services/usage.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
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-B1usIXCr.js';
|
|
3
|
+
import { ResourceType, UsageLimitType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class UsageService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
getBalance(resourceType:
|
|
7
|
-
checkLimit(body:
|
|
8
|
-
consume(body:
|
|
9
|
-
credit(body:
|
|
10
|
-
getTransactionHistory(resourceType:
|
|
9
|
+
getBalance(resourceType: ResourceType, resourceId: string, limitType: UsageLimitType, query?: UsageGetBalanceQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<BalanceResponse>;
|
|
10
|
+
checkLimit(body: UsageCheckBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<CheckLimitResponse>;
|
|
11
|
+
consume(body: UsageConsumeBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
12
|
+
credit(body: UsageCreditBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UsageWalletResponse>;
|
|
13
|
+
getTransactionHistory(resourceType: ResourceType, resourceId: string, limitType: UsageLimitType, query?: UsageGetTransactionHistoryQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<TransactionHistoryResponse>;
|
|
11
14
|
}
|
|
15
|
+
|
|
16
|
+
export { UsageService };
|
package/dist/services/usage.js
CHANGED
|
@@ -1,53 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/services/usage.ts
|
|
20
|
+
var usage_exports = {};
|
|
21
|
+
__export(usage_exports, {
|
|
22
|
+
UsageService: () => UsageService
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(usage_exports);
|
|
25
|
+
var UsageService = class {
|
|
26
|
+
constructor(core) {
|
|
27
|
+
this.core = core;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* GET /v1/usage/balance/{resourceType}/{resourceId}/{limitType}*
|
|
31
|
+
* @summary Get wallet balance*
|
|
32
|
+
* @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.*/
|
|
33
|
+
getBalance(resourceType, resourceId, limitType, query, init) {
|
|
34
|
+
return this.core.request({
|
|
35
|
+
method: "GET",
|
|
36
|
+
path: `/v1/usage/balance/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
37
|
+
query,
|
|
38
|
+
...init || {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* POST /v1/usage/check*
|
|
43
|
+
* @summary Check if consumption is allowed*
|
|
44
|
+
* @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.*/
|
|
45
|
+
checkLimit(body, init) {
|
|
46
|
+
return this.core.request({
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: `/v1/usage/check`,
|
|
49
|
+
body,
|
|
50
|
+
...init || {}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* POST /v1/usage/consume*
|
|
55
|
+
* @summary Record consumption (inserts negative amount)*
|
|
56
|
+
* @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.*/
|
|
57
|
+
consume(body, init) {
|
|
58
|
+
return this.core.request({
|
|
59
|
+
method: "POST",
|
|
60
|
+
path: `/v1/usage/consume`,
|
|
61
|
+
body,
|
|
62
|
+
...init || {}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* POST /v1/usage/credit*
|
|
67
|
+
* @summary Add credits to wallet (inserts positive amount)*
|
|
68
|
+
* @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.*/
|
|
69
|
+
credit(body, init) {
|
|
70
|
+
return this.core.request({
|
|
71
|
+
method: "POST",
|
|
72
|
+
path: `/v1/usage/credit`,
|
|
73
|
+
body,
|
|
74
|
+
...init || {}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* GET /v1/usage/transactions/{resourceType}/{resourceId}/{limitType}*
|
|
79
|
+
* @summary Get transaction history*
|
|
80
|
+
* @description Retrieves the transaction history for a usage wallet, including all credits and consumption records. Supports filtering by time period and date range.*/
|
|
81
|
+
getTransactionHistory(resourceType, resourceId, limitType, query, init) {
|
|
82
|
+
return this.core.request({
|
|
83
|
+
method: "GET",
|
|
84
|
+
path: `/v1/usage/transactions/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
85
|
+
query,
|
|
86
|
+
...init || {}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
UsageService
|
|
93
|
+
});
|
|
53
94
|
//# sourceMappingURL=usage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/usage.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType, UsageLimitType } from '@blimu/types';\n\nexport class UsageService {\n constructor(private core: CoreClient) {}\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: ResourceType,\n resourceId: string,\n limitType: UsageLimitType,\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: body as any,\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: body as any,\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: body as any,\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: ResourceType,\n resourceId: string,\n limitType: UsageLimitType,\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;AAIO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,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":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/services/usage.ts
|
|
2
|
+
var UsageService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* GET /v1/usage/balance/{resourceType}/{resourceId}/{limitType}*
|
|
8
|
+
* @summary Get wallet balance*
|
|
9
|
+
* @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.*/
|
|
10
|
+
getBalance(resourceType, resourceId, limitType, query, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: `/v1/usage/balance/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
14
|
+
query,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* POST /v1/usage/check*
|
|
20
|
+
* @summary Check if consumption is allowed*
|
|
21
|
+
* @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.*/
|
|
22
|
+
checkLimit(body, init) {
|
|
23
|
+
return this.core.request({
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: `/v1/usage/check`,
|
|
26
|
+
body,
|
|
27
|
+
...init || {}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* POST /v1/usage/consume*
|
|
32
|
+
* @summary Record consumption (inserts negative amount)*
|
|
33
|
+
* @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.*/
|
|
34
|
+
consume(body, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "POST",
|
|
37
|
+
path: `/v1/usage/consume`,
|
|
38
|
+
body,
|
|
39
|
+
...init || {}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* POST /v1/usage/credit*
|
|
44
|
+
* @summary Add credits to wallet (inserts positive amount)*
|
|
45
|
+
* @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.*/
|
|
46
|
+
credit(body, init) {
|
|
47
|
+
return this.core.request({
|
|
48
|
+
method: "POST",
|
|
49
|
+
path: `/v1/usage/credit`,
|
|
50
|
+
body,
|
|
51
|
+
...init || {}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* GET /v1/usage/transactions/{resourceType}/{resourceId}/{limitType}*
|
|
56
|
+
* @summary Get transaction history*
|
|
57
|
+
* @description Retrieves the transaction history for a usage wallet, including all credits and consumption records. Supports filtering by time period and date range.*/
|
|
58
|
+
getTransactionHistory(resourceType, resourceId, limitType, query, init) {
|
|
59
|
+
return this.core.request({
|
|
60
|
+
method: "GET",
|
|
61
|
+
path: `/v1/usage/transactions/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/${encodeURIComponent(limitType)}`,
|
|
62
|
+
query,
|
|
63
|
+
...init || {}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
UsageService
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=usage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/usage.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType, UsageLimitType } from '@blimu/types';\n\nexport class UsageService {\n constructor(private core: CoreClient) {}\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: ResourceType,\n resourceId: string,\n limitType: UsageLimitType,\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: body as any,\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: body as any,\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: body as any,\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: ResourceType,\n resourceId: string,\n limitType: UsageLimitType,\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":";AAIO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,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":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
2
|
+
import { A as UsersListQuery, D as UserList, F as UserCreateBody, G as User, H as UserUpdateBody, I as UserResourceList } from '../schema-B1usIXCr.mjs';
|
|
3
|
+
import '@blimu/fetch';
|
|
4
|
+
import '@blimu/types';
|
|
5
|
+
|
|
6
|
+
declare class UsersService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
list(query?: UsersListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UserList>;
|
|
10
|
+
create(body: UserCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<User>;
|
|
11
|
+
delete(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
12
|
+
read(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<User>;
|
|
13
|
+
update(userId: string, body: UserUpdateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<User>;
|
|
14
|
+
listEffectiveUserResourcesRoles(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UserResourceList>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { UsersService };
|
package/dist/services/users.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
2
|
+
import { A as UsersListQuery, D as UserList, F as UserCreateBody, G as User, H as UserUpdateBody, I as UserResourceList } from '../schema-B1usIXCr.js';
|
|
3
|
+
import '@blimu/fetch';
|
|
4
|
+
import '@blimu/types';
|
|
5
|
+
|
|
6
|
+
declare class UsersService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
list(query?:
|
|
7
|
-
create(body:
|
|
9
|
+
list(query?: UsersListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UserList>;
|
|
10
|
+
create(body: UserCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<User>;
|
|
8
11
|
delete(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
9
|
-
read(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<
|
|
10
|
-
update(userId: string, body:
|
|
11
|
-
listEffectiveUserResourcesRoles(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<
|
|
12
|
+
read(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<User>;
|
|
13
|
+
update(userId: string, body: UserUpdateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<User>;
|
|
14
|
+
listEffectiveUserResourcesRoles(userId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<UserResourceList>;
|
|
12
15
|
}
|
|
16
|
+
|
|
17
|
+
export { UsersService };
|
package/dist/services/users.js
CHANGED
|
@@ -1,57 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/services/users.ts
|
|
20
|
+
var users_exports = {};
|
|
21
|
+
__export(users_exports, {
|
|
22
|
+
UsersService: () => UsersService
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(users_exports);
|
|
25
|
+
var UsersService = class {
|
|
26
|
+
constructor(core) {
|
|
27
|
+
this.core = core;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* GET /v1/users*
|
|
31
|
+
* @summary List users*
|
|
32
|
+
* @description Retrieves a paginated list of users in your environment. Supports search functionality to filter users by email, name, or lookup key.*/
|
|
33
|
+
list(query, init) {
|
|
34
|
+
return this.core.request({
|
|
35
|
+
method: "GET",
|
|
36
|
+
path: `/v1/users`,
|
|
37
|
+
query,
|
|
38
|
+
...init || {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* POST /v1/users*
|
|
43
|
+
* @summary Create a user*
|
|
44
|
+
* @description Creates a new user in your environment. The lookupKey is a unique identifier that you can use to reference the user in your system. It should be stable and not change over time.*/
|
|
45
|
+
create(body, init) {
|
|
46
|
+
return this.core.request({
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: `/v1/users`,
|
|
49
|
+
body,
|
|
50
|
+
...init || {}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* DELETE /v1/users/{userId}*
|
|
55
|
+
* @summary Delete a user*
|
|
56
|
+
* @description Deletes a user by their ID or lookup key. This operation is permanent and cannot be undone. Deleting a user will also remove all role assignments for that user.*/
|
|
57
|
+
delete(userId, init) {
|
|
58
|
+
return this.core.request({
|
|
59
|
+
method: "DELETE",
|
|
60
|
+
path: `/v1/users/${encodeURIComponent(userId)}`,
|
|
61
|
+
...init || {}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* GET /v1/users/{userId}*
|
|
66
|
+
* @summary Get a user by ID*
|
|
67
|
+
* @description Retrieves a single user by their ID or lookup key. Returns user information including email, name, and metadata.*/
|
|
68
|
+
read(userId, init) {
|
|
69
|
+
return this.core.request({
|
|
70
|
+
method: "GET",
|
|
71
|
+
path: `/v1/users/${encodeURIComponent(userId)}`,
|
|
72
|
+
...init || {}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* PUT /v1/users/{userId}*
|
|
77
|
+
* @summary Update a user*
|
|
78
|
+
* @description Updates an existing user. You can modify email, name, and other user properties. The lookupKey can be updated but should remain stable.*/
|
|
79
|
+
update(userId, body, init) {
|
|
80
|
+
return this.core.request({
|
|
81
|
+
method: "PUT",
|
|
82
|
+
path: `/v1/users/${encodeURIComponent(userId)}`,
|
|
83
|
+
body,
|
|
84
|
+
...init || {}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* GET /v1/users/{userId}/effective-user-resources-roles*
|
|
89
|
+
* @summary List effective user resources roles*
|
|
90
|
+
* @description Retrieves all resources and roles for a user, including inherited roles from parent resources. The response indicates whether each role is directly assigned or inherited through resource hierarchies.*/
|
|
91
|
+
listEffectiveUserResourcesRoles(userId, init) {
|
|
92
|
+
return this.core.request({
|
|
93
|
+
method: "GET",
|
|
94
|
+
path: `/v1/users/${encodeURIComponent(userId)}/effective-user-resources-roles`,
|
|
95
|
+
...init || {}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
UsersService
|
|
102
|
+
});
|
|
57
103
|
//# sourceMappingURL=users.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/users.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\n\nexport class UsersService {\n constructor(private core: CoreClient) {}\n\n /**\n * GET /v1/users*\n * @summary List users*\n * @description Retrieves a paginated list of users in your environment. Supports search functionality to filter users by email, name, or lookup key.*/\n list(\n query?: Schema.UsersListQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.UserList> {\n return this.core.request({\n method: 'GET',\n path: `/v1/users`,\n query,\n ...(init || {}),\n });\n }\n\n /**\n * POST /v1/users*\n * @summary Create a user*\n * @description Creates a new user in your environment. The lookupKey is a unique identifier that you can use to reference the user in your system. It should be stable and not change over time.*/\n create(\n body: Schema.UserCreateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.User> {\n return this.core.request({\n method: 'POST',\n path: `/v1/users`,\n body: body as any,\n ...(init || {}),\n });\n }\n\n /**\n * DELETE /v1/users/{userId}*\n * @summary Delete a user*\n * @description Deletes a user by their ID or lookup key. This operation is permanent and cannot be undone. Deleting a user will also remove all role assignments for that user.*/\n delete(\n userId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'DELETE',\n path: `/v1/users/${encodeURIComponent(userId)}`,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/users/{userId}*\n * @summary Get a user by ID*\n * @description Retrieves a single user by their ID or lookup key. Returns user information including email, name, and metadata.*/\n read(\n userId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.User> {\n return this.core.request({\n method: 'GET',\n path: `/v1/users/${encodeURIComponent(userId)}`,\n ...(init || {}),\n });\n }\n\n /**\n * PUT /v1/users/{userId}*\n * @summary Update a user*\n * @description Updates an existing user. You can modify email, name, and other user properties. The lookupKey can be updated but should remain stable.*/\n update(\n userId: string,\n body: Schema.UserUpdateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.User> {\n return this.core.request({\n method: 'PUT',\n path: `/v1/users/${encodeURIComponent(userId)}`,\n body: body as any,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/users/{userId}/effective-user-resources-roles*\n * @summary List effective user resources roles*\n * @description Retrieves all resources and roles for a user, including inherited roles from parent resources. The response indicates whether each role is directly assigned or inherited through resource hierarchies.*/\n listEffectiveUserResourcesRoles(\n userId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.UserResourceList> {\n return this.core.request({\n method: 'GET',\n path: `/v1/users/${encodeURIComponent(userId)}/effective-user-resources-roles`,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,KACE,OACA,MAC0B;AAC1B,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,MACsB;AACtB,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,QACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,aAAa,mBAAmB,MAAM,CAAC;AAAA,MAC7C,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KACE,QACA,MACsB;AACtB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,aAAa,mBAAmB,MAAM,CAAC;AAAA,MAC7C,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,gCACE,QACA,MACkC;AAClC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,aAAa,mBAAmB,MAAM,CAAC;AAAA,MAC7C,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/services/users.ts
|
|
2
|
+
var UsersService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* GET /v1/users*
|
|
8
|
+
* @summary List users*
|
|
9
|
+
* @description Retrieves a paginated list of users in your environment. Supports search functionality to filter users by email, name, or lookup key.*/
|
|
10
|
+
list(query, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: `/v1/users`,
|
|
14
|
+
query,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* POST /v1/users*
|
|
20
|
+
* @summary Create a user*
|
|
21
|
+
* @description Creates a new user in your environment. The lookupKey is a unique identifier that you can use to reference the user in your system. It should be stable and not change over time.*/
|
|
22
|
+
create(body, init) {
|
|
23
|
+
return this.core.request({
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: `/v1/users`,
|
|
26
|
+
body,
|
|
27
|
+
...init || {}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* DELETE /v1/users/{userId}*
|
|
32
|
+
* @summary Delete a user*
|
|
33
|
+
* @description Deletes a user by their ID or lookup key. This operation is permanent and cannot be undone. Deleting a user will also remove all role assignments for that user.*/
|
|
34
|
+
delete(userId, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "DELETE",
|
|
37
|
+
path: `/v1/users/${encodeURIComponent(userId)}`,
|
|
38
|
+
...init || {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* GET /v1/users/{userId}*
|
|
43
|
+
* @summary Get a user by ID*
|
|
44
|
+
* @description Retrieves a single user by their ID or lookup key. Returns user information including email, name, and metadata.*/
|
|
45
|
+
read(userId, init) {
|
|
46
|
+
return this.core.request({
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: `/v1/users/${encodeURIComponent(userId)}`,
|
|
49
|
+
...init || {}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* PUT /v1/users/{userId}*
|
|
54
|
+
* @summary Update a user*
|
|
55
|
+
* @description Updates an existing user. You can modify email, name, and other user properties. The lookupKey can be updated but should remain stable.*/
|
|
56
|
+
update(userId, body, init) {
|
|
57
|
+
return this.core.request({
|
|
58
|
+
method: "PUT",
|
|
59
|
+
path: `/v1/users/${encodeURIComponent(userId)}`,
|
|
60
|
+
body,
|
|
61
|
+
...init || {}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* GET /v1/users/{userId}/effective-user-resources-roles*
|
|
66
|
+
* @summary List effective user resources roles*
|
|
67
|
+
* @description Retrieves all resources and roles for a user, including inherited roles from parent resources. The response indicates whether each role is directly assigned or inherited through resource hierarchies.*/
|
|
68
|
+
listEffectiveUserResourcesRoles(userId, init) {
|
|
69
|
+
return this.core.request({
|
|
70
|
+
method: "GET",
|
|
71
|
+
path: `/v1/users/${encodeURIComponent(userId)}/effective-user-resources-roles`,
|
|
72
|
+
...init || {}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
UsersService
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=users.mjs.map
|