@blimu/backend 1.2.0 → 1.2.2
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 +67 -58
- package/dist/client.cjs +164 -14
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.mts +36 -2
- package/dist/client.d.ts +36 -2
- package/dist/client.mjs +161 -11
- package/dist/client.mjs.map +1 -1
- package/dist/index.cjs +530 -236
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +265 -108
- package/dist/index.d.ts +265 -108
- package/dist/index.mjs +518 -226
- package/dist/index.mjs.map +1 -1
- package/dist/{schema-BbKn_i-U.d.mts → schema-CdEZKE7E.d.mts} +162 -39
- package/dist/{schema-BbKn_i-U.d.ts → schema-CdEZKE7E.d.ts} +162 -39
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.mts +2 -1
- package/dist/schema.d.ts +2 -1
- package/dist/services/auth_jwks.cjs +69 -0
- package/dist/services/auth_jwks.cjs.map +1 -0
- package/dist/services/auth_jwks.d.mts +13 -0
- package/dist/services/auth_jwks.d.ts +13 -0
- package/dist/services/auth_jwks.mjs +44 -0
- package/dist/services/auth_jwks.mjs.map +1 -0
- package/dist/services/bulk_resources.cjs +47 -0
- package/dist/services/bulk_resources.cjs.map +1 -0
- package/dist/services/bulk_resources.d.mts +11 -0
- package/dist/services/bulk_resources.d.ts +11 -0
- package/dist/services/bulk_resources.mjs +22 -0
- package/dist/services/bulk_resources.mjs.map +1 -0
- package/dist/services/bulk_roles.cjs +47 -0
- package/dist/services/bulk_roles.cjs.map +1 -0
- package/dist/services/bulk_roles.d.mts +11 -0
- package/dist/services/bulk_roles.d.ts +11 -0
- package/dist/services/bulk_roles.mjs +22 -0
- package/dist/services/bulk_roles.mjs.map +1 -0
- package/dist/services/entitlements.cjs +71 -0
- package/dist/services/entitlements.cjs.map +1 -0
- package/dist/services/entitlements.d.mts +13 -0
- package/dist/services/entitlements.d.ts +13 -0
- package/dist/services/entitlements.mjs +46 -0
- package/dist/services/entitlements.mjs.map +1 -0
- package/dist/services/oauth.cjs +142 -0
- package/dist/services/oauth.cjs.map +1 -0
- package/dist/services/oauth.d.mts +19 -0
- package/dist/services/oauth.d.ts +19 -0
- package/dist/services/oauth.mjs +117 -0
- package/dist/services/oauth.mjs.map +1 -0
- package/dist/services/plans.cjs +69 -0
- package/dist/services/plans.cjs.map +1 -0
- package/dist/services/plans.d.mts +13 -0
- package/dist/services/plans.d.ts +13 -0
- package/dist/services/plans.mjs +44 -0
- package/dist/services/plans.mjs.map +1 -0
- package/dist/services/resource_members.cjs +47 -0
- package/dist/services/resource_members.cjs.map +1 -0
- package/dist/services/resource_members.d.mts +11 -0
- package/dist/services/resource_members.d.ts +11 -0
- package/dist/services/resource_members.mjs +22 -0
- package/dist/services/resource_members.mjs.map +1 -0
- package/dist/services/resources.cjs +93 -0
- package/dist/services/resources.cjs.map +1 -0
- package/dist/services/resources.d.mts +15 -0
- package/dist/services/resources.d.ts +15 -0
- package/dist/services/resources.mjs +68 -0
- package/dist/services/resources.mjs.map +1 -0
- package/dist/services/roles.cjs +70 -0
- package/dist/services/roles.cjs.map +1 -0
- package/dist/services/roles.d.mts +13 -0
- package/dist/services/roles.d.ts +13 -0
- package/dist/services/roles.mjs +45 -0
- package/dist/services/roles.mjs.map +1 -0
- package/dist/services/usage.cjs +95 -0
- package/dist/services/usage.cjs.map +1 -0
- package/dist/services/usage.d.mts +15 -0
- package/dist/services/usage.d.ts +15 -0
- package/dist/services/usage.mjs +70 -0
- package/dist/services/usage.mjs.map +1 -0
- package/dist/services/users.cjs +104 -0
- package/dist/services/users.cjs.map +1 -0
- package/dist/services/users.d.mts +16 -0
- package/dist/services/users.d.ts +16 -0
- package/dist/services/users.mjs +79 -0
- package/dist/services/users.mjs.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/dist/client-B-ZYoU15.d.mts +0 -95
- package/dist/client-GKBT3WCg.d.ts +0 -95
package/README.md
CHANGED
|
@@ -19,7 +19,12 @@ import { BlimuClient } from '@blimu/backend';
|
|
|
19
19
|
const client = new BlimuClient({
|
|
20
20
|
baseURL: 'https://api.blimu.dev',
|
|
21
21
|
timeoutMs: 10000,
|
|
22
|
-
retry: {
|
|
22
|
+
retry: {
|
|
23
|
+
retries: 2,
|
|
24
|
+
strategy: 'exponential',
|
|
25
|
+
backoffMs: 300,
|
|
26
|
+
retryOn: [429, 500, 502, 503, 504],
|
|
27
|
+
},
|
|
23
28
|
// Auth configuration
|
|
24
29
|
authStrategies: [
|
|
25
30
|
{
|
|
@@ -29,12 +34,20 @@ const client = new BlimuClient({
|
|
|
29
34
|
],
|
|
30
35
|
});
|
|
31
36
|
|
|
37
|
+
// Example: Get JSON Web Key Set for environment (Public)
|
|
38
|
+
try {
|
|
39
|
+
const result = await client.authJwks.getJwks();
|
|
40
|
+
console.log('Result:', result);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
// FetchError with structured data
|
|
43
|
+
console.error(error);
|
|
44
|
+
}
|
|
32
45
|
// Example: Bulk create resources
|
|
33
46
|
try {
|
|
34
47
|
const result = await client.bulkResources.create(
|
|
35
|
-
'resourceType'
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
'resourceType',
|
|
49
|
+
|
|
50
|
+
{
|
|
38
51
|
// Request body data
|
|
39
52
|
}
|
|
40
53
|
);
|
|
@@ -45,13 +58,9 @@ try {
|
|
|
45
58
|
}
|
|
46
59
|
// Example: Bulk create roles
|
|
47
60
|
try {
|
|
48
|
-
const result = await client.bulkRoles.create(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
// Request body data
|
|
53
|
-
}
|
|
54
|
-
);
|
|
61
|
+
const result = await client.bulkRoles.create({
|
|
62
|
+
// Request body data
|
|
63
|
+
});
|
|
55
64
|
console.log('Result:', result);
|
|
56
65
|
} catch (error) {
|
|
57
66
|
// FetchError with structured data
|
|
@@ -59,13 +68,19 @@ try {
|
|
|
59
68
|
}
|
|
60
69
|
// Example: Check if a user has a specific entitlement on a resource
|
|
61
70
|
try {
|
|
62
|
-
const result = await client.entitlements.checkEntitlement(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
);
|
|
71
|
+
const result = await client.entitlements.checkEntitlement({
|
|
72
|
+
// Request body data
|
|
73
|
+
});
|
|
74
|
+
console.log('Result:', result);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
// FetchError with structured data
|
|
77
|
+
console.error(error);
|
|
78
|
+
}
|
|
79
|
+
// Example: Check consent requirement
|
|
80
|
+
try {
|
|
81
|
+
const result = await client.oauth.checkConsentRequired({
|
|
82
|
+
client_id: 'example',
|
|
83
|
+
});
|
|
69
84
|
console.log('Result:', result);
|
|
70
85
|
} catch (error) {
|
|
71
86
|
// FetchError with structured data
|
|
@@ -73,11 +88,7 @@ try {
|
|
|
73
88
|
}
|
|
74
89
|
// Example: Remove plan assignment from a tenant resource
|
|
75
90
|
try {
|
|
76
|
-
const result = await client.plans.delete(
|
|
77
|
-
'resourceType', 'resourceId'
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
);
|
|
91
|
+
const result = await client.plans.delete('resourceType', 'resourceId');
|
|
81
92
|
console.log('Result:', result);
|
|
82
93
|
} catch (error) {
|
|
83
94
|
// FetchError with structured data
|
|
@@ -85,12 +96,7 @@ try {
|
|
|
85
96
|
}
|
|
86
97
|
// Example: List members for a resource
|
|
87
98
|
try {
|
|
88
|
-
const result = await client.resourceMembers.list(
|
|
89
|
-
'resourceType', 'resourceId'
|
|
90
|
-
, {
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
);
|
|
99
|
+
const result = await client.resourceMembers.list('resourceType', 'resourceId', {});
|
|
94
100
|
console.log('Result:', result);
|
|
95
101
|
} catch (error) {
|
|
96
102
|
// FetchError with structured data
|
|
@@ -98,12 +104,7 @@ try {
|
|
|
98
104
|
}
|
|
99
105
|
// Example: List resources
|
|
100
106
|
try {
|
|
101
|
-
const result = await client.resources.list(
|
|
102
|
-
'resourceType'
|
|
103
|
-
, {
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
);
|
|
107
|
+
const result = await client.resources.list('resourceType', {});
|
|
107
108
|
console.log('Result:', result);
|
|
108
109
|
} catch (error) {
|
|
109
110
|
// FetchError with structured data
|
|
@@ -111,12 +112,7 @@ try {
|
|
|
111
112
|
}
|
|
112
113
|
// Example: List user roles
|
|
113
114
|
try {
|
|
114
|
-
const result = await client.roles.list(
|
|
115
|
-
'userId'
|
|
116
|
-
, {
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
);
|
|
115
|
+
const result = await client.roles.list('userId', {});
|
|
120
116
|
console.log('Result:', result);
|
|
121
117
|
} catch (error) {
|
|
122
118
|
// FetchError with structured data
|
|
@@ -124,13 +120,9 @@ try {
|
|
|
124
120
|
}
|
|
125
121
|
// Example: Get wallet balance
|
|
126
122
|
try {
|
|
127
|
-
const result = await client.usage.getBalance(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
period: undefined,
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
);
|
|
123
|
+
const result = await client.usage.getBalance('resourceType', 'resourceId', 'limitType', {
|
|
124
|
+
period: undefined,
|
|
125
|
+
});
|
|
134
126
|
console.log('Result:', result);
|
|
135
127
|
} catch (error) {
|
|
136
128
|
// FetchError with structured data
|
|
@@ -138,12 +130,7 @@ try {
|
|
|
138
130
|
}
|
|
139
131
|
// Example: List users
|
|
140
132
|
try {
|
|
141
|
-
const result = await client.users.list(
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
);
|
|
133
|
+
const result = await client.users.list({});
|
|
147
134
|
console.log('Result:', result);
|
|
148
135
|
} catch (error) {
|
|
149
136
|
// FetchError with structured data
|
|
@@ -158,11 +145,13 @@ This SDK is written in TypeScript and provides full type safety:
|
|
|
158
145
|
```typescript
|
|
159
146
|
import { BlimuClient, Schema } from '@blimu/backend';
|
|
160
147
|
|
|
161
|
-
const client = new BlimuClient({
|
|
148
|
+
const client = new BlimuClient({
|
|
149
|
+
/* config */
|
|
150
|
+
});
|
|
162
151
|
|
|
163
152
|
// All methods are fully typed
|
|
164
153
|
// Schema types are available
|
|
165
|
-
const data: Schema.
|
|
154
|
+
const data: Schema.AuthorizeRequest = {
|
|
166
155
|
// Fully typed object
|
|
167
156
|
};
|
|
168
157
|
```
|
|
@@ -189,30 +178,48 @@ const client = new BlimuClient({
|
|
|
189
178
|
|
|
190
179
|
The SDK includes the following TypeScript interfaces:
|
|
191
180
|
|
|
181
|
+
- **AuthorizeRequest**
|
|
192
182
|
- **BalanceResponse**
|
|
193
183
|
- **CheckLimitResponse**
|
|
184
|
+
- **ConsentCheckResponse**
|
|
185
|
+
- **DeviceAuthorizeRequest**
|
|
186
|
+
- **DeviceAuthorizeResponse**
|
|
187
|
+
- **DeviceCodeInfoResponse**
|
|
188
|
+
- **DeviceCodeRequest**
|
|
189
|
+
- **DeviceCodeResponse**
|
|
190
|
+
- **DeviceTokenRequest**
|
|
194
191
|
- **EntitlementCheckBody**
|
|
195
192
|
- **EntitlementCheckResult**
|
|
193
|
+
- **EntitlementType**: Entitlement identifier
|
|
196
194
|
- **EntitlementsListResult**
|
|
195
|
+
- **IntrospectionRequest**
|
|
196
|
+
- **IntrospectionResponse**
|
|
197
|
+
- **JWK**
|
|
197
198
|
- **PlanAssignBody**
|
|
198
199
|
- **PlanDeleteResponse**
|
|
199
200
|
- **PlanResponse**
|
|
201
|
+
- **PlanType**: Plan type identifier
|
|
200
202
|
- **Resource**
|
|
201
203
|
- **ResourceBulkCreateBody**
|
|
202
204
|
- **ResourceBulkResult**
|
|
203
205
|
- **ResourceCreateBody**
|
|
204
206
|
- **ResourceList**
|
|
205
207
|
- **ResourceMemberList**
|
|
208
|
+
- **ResourceType**: Resource type identifier
|
|
206
209
|
- **ResourceUpdateBody**
|
|
210
|
+
- **RevocationRequest**
|
|
207
211
|
- **Role**
|
|
208
212
|
- **RoleBulkCreateBody**
|
|
209
213
|
- **RoleBulkResult**
|
|
210
214
|
- **RoleCreateBody**
|
|
211
215
|
- **RoleList**
|
|
216
|
+
- **TokenRequest**
|
|
217
|
+
- **TokenResponse**
|
|
212
218
|
- **TransactionHistoryResponse**
|
|
213
219
|
- **UsageCheckBody**
|
|
214
220
|
- **UsageConsumeBody**
|
|
215
221
|
- **UsageCreditBody**
|
|
222
|
+
- **UsageLimitType**: Usage-based limit type identifier
|
|
216
223
|
- **UsageWalletResponse**
|
|
217
224
|
- **User**
|
|
218
225
|
- **UserCreateBody**
|
|
@@ -226,12 +233,14 @@ All types are available under the `Schema` namespace:
|
|
|
226
233
|
import { Schema } from '@blimu/backend';
|
|
227
234
|
|
|
228
235
|
// Use any model type
|
|
229
|
-
const user: Schema.User = {
|
|
236
|
+
const user: Schema.User = {
|
|
237
|
+
/* ... */
|
|
238
|
+
};
|
|
230
239
|
```
|
|
231
240
|
|
|
232
241
|
## Contributing
|
|
233
242
|
|
|
234
|
-
This SDK is auto-generated. Please do not edit the generated files directly.
|
|
243
|
+
This SDK is auto-generated. Please do not edit the generated files directly.
|
|
235
244
|
If you find issues, please report them in the main project repository.
|
|
236
245
|
|
|
237
246
|
## License
|
package/dist/client.cjs
CHANGED
|
@@ -22,11 +22,11 @@ var client_exports = {};
|
|
|
22
22
|
__export(client_exports, {
|
|
23
23
|
Blimu: () => Blimu,
|
|
24
24
|
BlimuError: () => BlimuError,
|
|
25
|
-
FetchError: () =>
|
|
25
|
+
FetchError: () => import_fetch.FetchError
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(client_exports);
|
|
28
|
-
var
|
|
29
|
-
var
|
|
28
|
+
var import_fetch = require("@blimu/fetch");
|
|
29
|
+
var import_fetch2 = require("@blimu/fetch");
|
|
30
30
|
|
|
31
31
|
// src/auth-strategies.ts
|
|
32
32
|
function buildAuthStrategies(cfg) {
|
|
@@ -42,8 +42,48 @@ function buildAuthStrategies(cfg) {
|
|
|
42
42
|
return authStrategies;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// src/services/auth_jwks.ts
|
|
46
|
+
var AuthJwksService = class {
|
|
47
|
+
constructor(core) {
|
|
48
|
+
this.core = core;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* GET /v1/auth/.well-known/jwks.json*
|
|
52
|
+
* @summary Get JSON Web Key Set for environment (Public)*
|
|
53
|
+
* @description Returns the public keys used to verify JWT tokens issued by this environment. Authenticate using either x-api-key header (secretKey) or x-blimu-publishable-key header (publishableKey).*/
|
|
54
|
+
getJwks(init) {
|
|
55
|
+
return this.core.request({
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: `/v1/auth/.well-known/jwks.json`,
|
|
58
|
+
...init ?? {}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* GET /v1/auth/.well-known/public-key.pem*
|
|
63
|
+
* @summary Get environment public key (PEM)*
|
|
64
|
+
* @description Returns the public key in PEM format for verifying JWT tokens. Authenticate with x-api-key or x-blimu-publishable-key.*/
|
|
65
|
+
getPublicKeyPem(init) {
|
|
66
|
+
return this.core.request({
|
|
67
|
+
method: "GET",
|
|
68
|
+
path: `/v1/auth/.well-known/public-key.pem`,
|
|
69
|
+
...init ?? {}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* GET /v1/auth/oauth/.well-known/jwks.json*
|
|
74
|
+
* @summary Get JSON Web Key Set for OAuth app (Public)*
|
|
75
|
+
* @description Returns the public key for a specific OAuth app to verify JWT tokens. This is a public endpoint following OAuth2/OIDC standards. Provide client_id to get keys for a specific OAuth app, or use authenticated endpoint for environment keys.*/
|
|
76
|
+
getOAuthAppJwks(query, init) {
|
|
77
|
+
return this.core.request({
|
|
78
|
+
method: "GET",
|
|
79
|
+
path: `/v1/auth/oauth/.well-known/jwks.json`,
|
|
80
|
+
query,
|
|
81
|
+
...init ?? {}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
45
86
|
// src/services/bulk_resources.ts
|
|
46
|
-
var import_fetch = require("@blimu/fetch");
|
|
47
87
|
var BulkResourcesService = class {
|
|
48
88
|
constructor(core) {
|
|
49
89
|
this.core = core;
|
|
@@ -63,7 +103,6 @@ var BulkResourcesService = class {
|
|
|
63
103
|
};
|
|
64
104
|
|
|
65
105
|
// src/services/bulk_roles.ts
|
|
66
|
-
var import_fetch2 = require("@blimu/fetch");
|
|
67
106
|
var BulkRolesService = class {
|
|
68
107
|
constructor(core) {
|
|
69
108
|
this.core = core;
|
|
@@ -83,7 +122,6 @@ var BulkRolesService = class {
|
|
|
83
122
|
};
|
|
84
123
|
|
|
85
124
|
// src/services/entitlements.ts
|
|
86
|
-
var import_fetch3 = require("@blimu/fetch");
|
|
87
125
|
var EntitlementsService = class {
|
|
88
126
|
constructor(core) {
|
|
89
127
|
this.core = core;
|
|
@@ -126,8 +164,121 @@ var EntitlementsService = class {
|
|
|
126
164
|
}
|
|
127
165
|
};
|
|
128
166
|
|
|
167
|
+
// src/services/oauth.ts
|
|
168
|
+
var OauthService = class {
|
|
169
|
+
constructor(core) {
|
|
170
|
+
this.core = core;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* GET /v1/oauth/authorize*
|
|
174
|
+
* @summary Check consent requirement*
|
|
175
|
+
* @description Checks if user consent is required for the OAuth2 app and requested scopes.*/
|
|
176
|
+
checkConsentRequired(query, init) {
|
|
177
|
+
return this.core.request({
|
|
178
|
+
method: "GET",
|
|
179
|
+
path: `/v1/oauth/authorize`,
|
|
180
|
+
query,
|
|
181
|
+
...init ?? {}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* POST /v1/oauth/authorize*
|
|
186
|
+
* @summary Authorize OAuth2 application*
|
|
187
|
+
* @description Handles user consent approval/denial. Validates auto_approved flag against consent requirements.*/
|
|
188
|
+
authorize(body, init) {
|
|
189
|
+
return this.core.request({
|
|
190
|
+
method: "POST",
|
|
191
|
+
path: `/v1/oauth/authorize`,
|
|
192
|
+
body,
|
|
193
|
+
...init ?? {}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* POST /v1/oauth/device/authorize*
|
|
198
|
+
* @summary Authorize or deny device code*
|
|
199
|
+
* @description Allows an authenticated user to authorize or deny a device code request. Requires valid user session.*/
|
|
200
|
+
authorizeDeviceCode(body, init) {
|
|
201
|
+
return this.core.request({
|
|
202
|
+
method: "POST",
|
|
203
|
+
path: `/v1/oauth/device/authorize`,
|
|
204
|
+
body,
|
|
205
|
+
...init ?? {}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* POST /v1/oauth/device/code*
|
|
210
|
+
* @summary Request device authorization codes*
|
|
211
|
+
* @description Initiates device authorization flow. Returns device_code (for polling) and user_code (for user entry).*/
|
|
212
|
+
requestDeviceCode(body, init) {
|
|
213
|
+
return this.core.request({
|
|
214
|
+
method: "POST",
|
|
215
|
+
path: `/v1/oauth/device/code`,
|
|
216
|
+
body,
|
|
217
|
+
...init ?? {}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* GET /v1/oauth/device/code/{user_code}*
|
|
222
|
+
* @summary Get device code information*
|
|
223
|
+
* @description Returns device code information including app name, scopes, and consent requirement status.*/
|
|
224
|
+
getDeviceCodeInfo(user_code, init) {
|
|
225
|
+
return this.core.request({
|
|
226
|
+
method: "GET",
|
|
227
|
+
path: `/v1/oauth/device/code/${encodeURIComponent(user_code)}`,
|
|
228
|
+
...init ?? {}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* POST /v1/oauth/device/token*
|
|
233
|
+
* @summary Poll for device authorization tokens*
|
|
234
|
+
* @description Client polls this endpoint to exchange device_code for tokens once user has authorized.*/
|
|
235
|
+
exchangeDeviceCode(body, init) {
|
|
236
|
+
return this.core.request({
|
|
237
|
+
method: "POST",
|
|
238
|
+
path: `/v1/oauth/device/token`,
|
|
239
|
+
body,
|
|
240
|
+
...init ?? {}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* POST /v1/oauth/introspect*
|
|
245
|
+
* @summary Introspect token*
|
|
246
|
+
* @description Validates a token and returns metadata. Requires client authentication.*/
|
|
247
|
+
introspect(body, init) {
|
|
248
|
+
return this.core.request({
|
|
249
|
+
method: "POST",
|
|
250
|
+
path: `/v1/oauth/introspect`,
|
|
251
|
+
body,
|
|
252
|
+
...init ?? {}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* POST /v1/oauth/revoke*
|
|
257
|
+
* @summary Revoke token*
|
|
258
|
+
* @description Revokes an access or refresh token. Requires client authentication.*/
|
|
259
|
+
revoke(body, init) {
|
|
260
|
+
return this.core.request({
|
|
261
|
+
method: "POST",
|
|
262
|
+
path: `/v1/oauth/revoke`,
|
|
263
|
+
body,
|
|
264
|
+
...init ?? {}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* POST /v1/oauth/token*
|
|
269
|
+
* @summary Token endpoint*
|
|
270
|
+
* @description Issues access and refresh tokens. Supports authorization_code and refresh_token (always available per OAuth2 spec).*/
|
|
271
|
+
token(body, init) {
|
|
272
|
+
return this.core.request({
|
|
273
|
+
method: "POST",
|
|
274
|
+
path: `/v1/oauth/token`,
|
|
275
|
+
body,
|
|
276
|
+
...init ?? {}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
129
281
|
// src/services/plans.ts
|
|
130
|
-
var import_fetch4 = require("@blimu/fetch");
|
|
131
282
|
var PlansService = class {
|
|
132
283
|
constructor(core) {
|
|
133
284
|
this.core = core;
|
|
@@ -169,7 +320,6 @@ var PlansService = class {
|
|
|
169
320
|
};
|
|
170
321
|
|
|
171
322
|
// src/services/resource_members.ts
|
|
172
|
-
var import_fetch5 = require("@blimu/fetch");
|
|
173
323
|
var ResourceMembersService = class {
|
|
174
324
|
constructor(core) {
|
|
175
325
|
this.core = core;
|
|
@@ -189,7 +339,6 @@ var ResourceMembersService = class {
|
|
|
189
339
|
};
|
|
190
340
|
|
|
191
341
|
// src/services/resources.ts
|
|
192
|
-
var import_fetch6 = require("@blimu/fetch");
|
|
193
342
|
var ResourcesService = class {
|
|
194
343
|
constructor(core) {
|
|
195
344
|
this.core = core;
|
|
@@ -255,7 +404,6 @@ var ResourcesService = class {
|
|
|
255
404
|
};
|
|
256
405
|
|
|
257
406
|
// src/services/roles.ts
|
|
258
|
-
var import_fetch7 = require("@blimu/fetch");
|
|
259
407
|
var RolesService = class {
|
|
260
408
|
constructor(core) {
|
|
261
409
|
this.core = core;
|
|
@@ -298,7 +446,6 @@ var RolesService = class {
|
|
|
298
446
|
};
|
|
299
447
|
|
|
300
448
|
// src/services/usage.ts
|
|
301
|
-
var import_fetch8 = require("@blimu/fetch");
|
|
302
449
|
var UsageService = class {
|
|
303
450
|
constructor(core) {
|
|
304
451
|
this.core = core;
|
|
@@ -366,7 +513,6 @@ var UsageService = class {
|
|
|
366
513
|
};
|
|
367
514
|
|
|
368
515
|
// src/services/users.ts
|
|
369
|
-
var import_fetch9 = require("@blimu/fetch");
|
|
370
516
|
var UsersService = class {
|
|
371
517
|
constructor(core) {
|
|
372
518
|
this.core = core;
|
|
@@ -444,9 +590,11 @@ var UsersService = class {
|
|
|
444
590
|
|
|
445
591
|
// src/client.ts
|
|
446
592
|
var Blimu = class {
|
|
593
|
+
authJwks;
|
|
447
594
|
bulkResources;
|
|
448
595
|
bulkRoles;
|
|
449
596
|
entitlements;
|
|
597
|
+
oauth;
|
|
450
598
|
plans;
|
|
451
599
|
resourceMembers;
|
|
452
600
|
resources;
|
|
@@ -457,14 +605,16 @@ var Blimu = class {
|
|
|
457
605
|
const restCfg = { ...options ?? {} };
|
|
458
606
|
delete restCfg.apiKey;
|
|
459
607
|
const authStrategies = buildAuthStrategies(options ?? {});
|
|
460
|
-
const core = new
|
|
608
|
+
const core = new import_fetch.FetchClient({
|
|
461
609
|
...restCfg,
|
|
462
610
|
baseURL: options?.baseURL ?? "https://api.blimu.dev",
|
|
463
611
|
...authStrategies.length > 0 ? { authStrategies } : {}
|
|
464
612
|
});
|
|
613
|
+
this.authJwks = new AuthJwksService(core);
|
|
465
614
|
this.bulkResources = new BulkResourcesService(core);
|
|
466
615
|
this.bulkRoles = new BulkRolesService(core);
|
|
467
616
|
this.entitlements = new EntitlementsService(core);
|
|
617
|
+
this.oauth = new OauthService(core);
|
|
468
618
|
this.plans = new PlansService(core);
|
|
469
619
|
this.resourceMembers = new ResourceMembersService(core);
|
|
470
620
|
this.resources = new ResourcesService(core);
|
|
@@ -473,7 +623,7 @@ var Blimu = class {
|
|
|
473
623
|
this.users = new UsersService(core);
|
|
474
624
|
}
|
|
475
625
|
};
|
|
476
|
-
var BlimuError =
|
|
626
|
+
var BlimuError = import_fetch.FetchError;
|
|
477
627
|
// Annotate the CommonJS export names for ESM import in node:
|
|
478
628
|
0 && (module.exports = {
|
|
479
629
|
Blimu,
|