@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,22 @@
|
|
|
1
|
+
// src/services/bulk_resources.ts
|
|
2
|
+
var BulkResourcesService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* POST /v1/resources/{resourceType}/bulk*
|
|
8
|
+
* @summary Bulk create resources*
|
|
9
|
+
* @description Creates multiple resources of the specified type in a single request. This operation supports partial success - some resources may be created while others fail. The response includes details about successful creations and any errors encountered. Resources can have parent relationships and initial role assignments.*/
|
|
10
|
+
create(resourceType, body, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "POST",
|
|
13
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/bulk`,
|
|
14
|
+
body,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
BulkResourcesService
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=bulk_resources.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/bulk_resources.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class BulkResourcesService {\n constructor(private core: CoreClient) {}\n\n /**\n * POST /v1/resources/{resourceType}/bulk*\n * @summary Bulk create resources*\n * @description Creates multiple resources of the specified type in a single request. This operation supports partial success - some resources may be created while others fail. The response includes details about successful creations and any errors encountered. Resources can have parent relationships and initial role assignments.*/\n create(\n resourceType: ResourceType,\n body: Schema.ResourceBulkCreateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.ResourceBulkResult> {\n return this.core.request({\n method: 'POST',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/bulk`,\n body: body as any,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";AAIO,IAAM,uBAAN,MAA2B;AAAA,EAChC,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OACE,cACA,MACA,MACoC;AACpC,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;AACF;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
2
|
+
import { b as RoleBulkCreateBody, c as RoleBulkResult } from '../schema-B1usIXCr.mjs';
|
|
3
|
+
import '@blimu/fetch';
|
|
4
|
+
import '@blimu/types';
|
|
5
|
+
|
|
6
|
+
declare class BulkRolesService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
create(body: RoleBulkCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<RoleBulkResult>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { BulkRolesService };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
2
|
+
import { b as RoleBulkCreateBody, c as RoleBulkResult } from '../schema-B1usIXCr.js';
|
|
3
|
+
import '@blimu/fetch';
|
|
4
|
+
import '@blimu/types';
|
|
5
|
+
|
|
6
|
+
declare class BulkRolesService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
create(body:
|
|
9
|
+
create(body: RoleBulkCreateBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<RoleBulkResult>;
|
|
7
10
|
}
|
|
11
|
+
|
|
12
|
+
export { BulkRolesService };
|
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
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/bulk_roles.ts
|
|
20
|
+
var bulk_roles_exports = {};
|
|
21
|
+
__export(bulk_roles_exports, {
|
|
22
|
+
BulkRolesService: () => BulkRolesService
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(bulk_roles_exports);
|
|
25
|
+
var BulkRolesService = class {
|
|
26
|
+
constructor(core) {
|
|
27
|
+
this.core = core;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* POST /v1/users/roles/bulk*
|
|
31
|
+
* @summary Bulk create roles*
|
|
32
|
+
* @description Assigns multiple roles to users on resources in a single request. This operation supports partial success - some role assignments may succeed while others fail. The response includes details about successful assignments and any errors encountered. All roles must be valid according to your resource definitions.*/
|
|
33
|
+
create(body, init) {
|
|
34
|
+
return this.core.request({
|
|
35
|
+
method: "POST",
|
|
36
|
+
path: `/v1/users/roles/bulk`,
|
|
37
|
+
body,
|
|
38
|
+
...init || {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
BulkRolesService
|
|
45
|
+
});
|
|
19
46
|
//# sourceMappingURL=bulk_roles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/bulk_roles.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\n\nexport class BulkRolesService {\n constructor(private core: CoreClient) {}\n\n /**\n * POST /v1/users/roles/bulk*\n * @summary Bulk create roles*\n * @description Assigns multiple roles to users on resources in a single request. This operation supports partial success - some role assignments may succeed while others fail. The response includes details about successful assignments and any errors encountered. All roles must be valid according to your resource definitions.*/\n create(\n body: Schema.RoleBulkCreateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.RoleBulkResult> {\n return this.core.request({\n method: 'POST',\n path: `/v1/users/roles/bulk`,\n body: body as any,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OACE,MACA,MACgC;AAChC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/services/bulk_roles.ts
|
|
2
|
+
var BulkRolesService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* POST /v1/users/roles/bulk*
|
|
8
|
+
* @summary Bulk create roles*
|
|
9
|
+
* @description Assigns multiple roles to users on resources in a single request. This operation supports partial success - some role assignments may succeed while others fail. The response includes details about successful assignments and any errors encountered. All roles must be valid according to your resource definitions.*/
|
|
10
|
+
create(body, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "POST",
|
|
13
|
+
path: `/v1/users/roles/bulk`,
|
|
14
|
+
body,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
BulkRolesService
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=bulk_roles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/bulk_roles.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\n\nexport class BulkRolesService {\n constructor(private core: CoreClient) {}\n\n /**\n * POST /v1/users/roles/bulk*\n * @summary Bulk create roles*\n * @description Assigns multiple roles to users on resources in a single request. This operation supports partial success - some role assignments may succeed while others fail. The response includes details about successful assignments and any errors encountered. All roles must be valid according to your resource definitions.*/\n create(\n body: Schema.RoleBulkCreateBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.RoleBulkResult> {\n return this.core.request({\n method: 'POST',\n path: `/v1/users/roles/bulk`,\n body: body as any,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";AAGO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OACE,MACA,MACgC;AAChC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
2
|
+
import { E as EntitlementCheckBody, d as EntitlementCheckResult, e as EntitlementsListForResourceQuery, f as EntitlementsListResult, g as EntitlementsListForTenantQuery } from '../schema-B1usIXCr.mjs';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class EntitlementsService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
checkEntitlement(body: EntitlementCheckBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<EntitlementCheckResult>;
|
|
10
|
+
listForResource(resourceType: ResourceType, resourceId: string, query?: EntitlementsListForResourceQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<EntitlementsListResult>;
|
|
11
|
+
listForTenant(tenantResourceId: string, query?: EntitlementsListForTenantQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<EntitlementsListResult>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { EntitlementsService };
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
2
|
+
import { E as EntitlementCheckBody, d as EntitlementCheckResult, e as EntitlementsListForResourceQuery, f as EntitlementsListResult, g as EntitlementsListForTenantQuery } from '../schema-B1usIXCr.js';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class EntitlementsService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
checkEntitlement(body:
|
|
7
|
-
listForResource(resourceType:
|
|
8
|
-
listForTenant(tenantResourceId: string, query?:
|
|
9
|
+
checkEntitlement(body: EntitlementCheckBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<EntitlementCheckResult>;
|
|
10
|
+
listForResource(resourceType: ResourceType, resourceId: string, query?: EntitlementsListForResourceQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<EntitlementsListResult>;
|
|
11
|
+
listForTenant(tenantResourceId: string, query?: EntitlementsListForTenantQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<EntitlementsListResult>;
|
|
9
12
|
}
|
|
13
|
+
|
|
14
|
+
export { EntitlementsService };
|
|
@@ -1,35 +1,70 @@
|
|
|
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
|
-
|
|
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/entitlements.ts
|
|
20
|
+
var entitlements_exports = {};
|
|
21
|
+
__export(entitlements_exports, {
|
|
22
|
+
EntitlementsService: () => EntitlementsService
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(entitlements_exports);
|
|
25
|
+
var EntitlementsService = class {
|
|
26
|
+
constructor(core) {
|
|
27
|
+
this.core = core;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* POST /v1/entitlements/check*
|
|
31
|
+
* @summary Check if a user has a specific entitlement on a resource*
|
|
32
|
+
* @description Checks whether a user has permission to perform a specific action (entitlement) on a resource. This endpoint evaluates role-based access, plan gating, and usage limits. The response includes detailed information about why access was granted or denied, including which roles were checked, plan requirements, and usage limit status.*/
|
|
33
|
+
checkEntitlement(body, init) {
|
|
34
|
+
return this.core.request({
|
|
35
|
+
method: "POST",
|
|
36
|
+
path: `/v1/entitlements/check`,
|
|
37
|
+
body,
|
|
38
|
+
...init || {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* GET /v1/entitlements/list-for-resource/{resourceType}/{resourceId}*
|
|
43
|
+
* @summary List entitlements for a specific resource*
|
|
44
|
+
* @description Returns entitlements for a specific resource and user. Only evaluates roles and plans (excludes limits). Provides detailed information about why entitlements are allowed or denied, including current roles, allowed roles, current plan, and allowed plans. Results are cached per resource for performance.*/
|
|
45
|
+
listForResource(resourceType, resourceId, query, init) {
|
|
46
|
+
return this.core.request({
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: `/v1/entitlements/list-for-resource/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
49
|
+
query,
|
|
50
|
+
...init || {}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* GET /v1/entitlements/list-for-tenant/{tenantResourceId}*
|
|
55
|
+
* @summary List entitlements for a tenant and all its sub-resources*
|
|
56
|
+
* @description Returns entitlements for a tenant resource and all its descendant resources. This endpoint scopes queries to a single tenant, preventing cross-tenant data access. Only evaluates roles and plans (excludes limits). Results are cached per resource for performance. The tenant resource type is automatically determined from the environment definition (resource marked as `is_tenant: true`).*/
|
|
57
|
+
listForTenant(tenantResourceId, query, init) {
|
|
58
|
+
return this.core.request({
|
|
59
|
+
method: "GET",
|
|
60
|
+
path: `/v1/entitlements/list-for-tenant/${encodeURIComponent(tenantResourceId)}`,
|
|
61
|
+
query,
|
|
62
|
+
...init || {}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
EntitlementsService
|
|
69
|
+
});
|
|
35
70
|
//# sourceMappingURL=entitlements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/entitlements.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class EntitlementsService {\n constructor(private core: CoreClient) {}\n\n /**\n * POST /v1/entitlements/check*\n * @summary Check if a user has a specific entitlement on a resource*\n * @description Checks whether a user has permission to perform a specific action (entitlement) on a resource. This endpoint evaluates role-based access, plan gating, and usage limits. The response includes detailed information about why access was granted or denied, including which roles were checked, plan requirements, and usage limit status.*/\n checkEntitlement(\n body: Schema.EntitlementCheckBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.EntitlementCheckResult> {\n return this.core.request({\n method: 'POST',\n path: `/v1/entitlements/check`,\n body: body as any,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/entitlements/list-for-resource/{resourceType}/{resourceId}*\n * @summary List entitlements for a specific resource*\n * @description Returns entitlements for a specific resource and user. Only evaluates roles and plans (excludes limits). Provides detailed information about why entitlements are allowed or denied, including current roles, allowed roles, current plan, and allowed plans. Results are cached per resource for performance.*/\n listForResource(\n resourceType: ResourceType,\n resourceId: string,\n query?: Schema.EntitlementsListForResourceQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.EntitlementsListResult> {\n return this.core.request({\n method: 'GET',\n path: `/v1/entitlements/list-for-resource/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n query,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/entitlements/list-for-tenant/{tenantResourceId}*\n * @summary List entitlements for a tenant and all its sub-resources*\n * @description Returns entitlements for a tenant resource and all its descendant resources. This endpoint scopes queries to a single tenant, preventing cross-tenant data access. Only evaluates roles and plans (excludes limits). Results are cached per resource for performance. The tenant resource type is automatically determined from the environment definition (resource marked as `is_tenant: true`).*/\n listForTenant(\n tenantResourceId: string,\n query?: Schema.EntitlementsListForTenantQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.EntitlementsListResult> {\n return this.core.request({\n method: 'GET',\n path: `/v1/entitlements/list-for-tenant/${encodeURIComponent(tenantResourceId)}`,\n query,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,sBAAN,MAA0B;AAAA,EAC/B,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,iBACE,MACA,MACwC;AACxC,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,gBACE,cACA,YACA,OACA,MACwC;AACxC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,sCAAsC,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MAC9G;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cACE,kBACA,OACA,MACwC;AACxC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,oCAAoC,mBAAmB,gBAAgB,CAAC;AAAA,MAC9E;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/services/entitlements.ts
|
|
2
|
+
var EntitlementsService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* POST /v1/entitlements/check*
|
|
8
|
+
* @summary Check if a user has a specific entitlement on a resource*
|
|
9
|
+
* @description Checks whether a user has permission to perform a specific action (entitlement) on a resource. This endpoint evaluates role-based access, plan gating, and usage limits. The response includes detailed information about why access was granted or denied, including which roles were checked, plan requirements, and usage limit status.*/
|
|
10
|
+
checkEntitlement(body, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "POST",
|
|
13
|
+
path: `/v1/entitlements/check`,
|
|
14
|
+
body,
|
|
15
|
+
...init || {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* GET /v1/entitlements/list-for-resource/{resourceType}/{resourceId}*
|
|
20
|
+
* @summary List entitlements for a specific resource*
|
|
21
|
+
* @description Returns entitlements for a specific resource and user. Only evaluates roles and plans (excludes limits). Provides detailed information about why entitlements are allowed or denied, including current roles, allowed roles, current plan, and allowed plans. Results are cached per resource for performance.*/
|
|
22
|
+
listForResource(resourceType, resourceId, query, init) {
|
|
23
|
+
return this.core.request({
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: `/v1/entitlements/list-for-resource/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,
|
|
26
|
+
query,
|
|
27
|
+
...init || {}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* GET /v1/entitlements/list-for-tenant/{tenantResourceId}*
|
|
32
|
+
* @summary List entitlements for a tenant and all its sub-resources*
|
|
33
|
+
* @description Returns entitlements for a tenant resource and all its descendant resources. This endpoint scopes queries to a single tenant, preventing cross-tenant data access. Only evaluates roles and plans (excludes limits). Results are cached per resource for performance. The tenant resource type is automatically determined from the environment definition (resource marked as `is_tenant: true`).*/
|
|
34
|
+
listForTenant(tenantResourceId, query, init) {
|
|
35
|
+
return this.core.request({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/v1/entitlements/list-for-tenant/${encodeURIComponent(tenantResourceId)}`,
|
|
38
|
+
query,
|
|
39
|
+
...init || {}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
EntitlementsService
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=entitlements.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/entitlements.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class EntitlementsService {\n constructor(private core: CoreClient) {}\n\n /**\n * POST /v1/entitlements/check*\n * @summary Check if a user has a specific entitlement on a resource*\n * @description Checks whether a user has permission to perform a specific action (entitlement) on a resource. This endpoint evaluates role-based access, plan gating, and usage limits. The response includes detailed information about why access was granted or denied, including which roles were checked, plan requirements, and usage limit status.*/\n checkEntitlement(\n body: Schema.EntitlementCheckBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.EntitlementCheckResult> {\n return this.core.request({\n method: 'POST',\n path: `/v1/entitlements/check`,\n body: body as any,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/entitlements/list-for-resource/{resourceType}/{resourceId}*\n * @summary List entitlements for a specific resource*\n * @description Returns entitlements for a specific resource and user. Only evaluates roles and plans (excludes limits). Provides detailed information about why entitlements are allowed or denied, including current roles, allowed roles, current plan, and allowed plans. Results are cached per resource for performance.*/\n listForResource(\n resourceType: ResourceType,\n resourceId: string,\n query?: Schema.EntitlementsListForResourceQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.EntitlementsListResult> {\n return this.core.request({\n method: 'GET',\n path: `/v1/entitlements/list-for-resource/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`,\n query,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/entitlements/list-for-tenant/{tenantResourceId}*\n * @summary List entitlements for a tenant and all its sub-resources*\n * @description Returns entitlements for a tenant resource and all its descendant resources. This endpoint scopes queries to a single tenant, preventing cross-tenant data access. Only evaluates roles and plans (excludes limits). Results are cached per resource for performance. The tenant resource type is automatically determined from the environment definition (resource marked as `is_tenant: true`).*/\n listForTenant(\n tenantResourceId: string,\n query?: Schema.EntitlementsListForTenantQuery,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.EntitlementsListResult> {\n return this.core.request({\n method: 'GET',\n path: `/v1/entitlements/list-for-tenant/${encodeURIComponent(tenantResourceId)}`,\n query,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";AAIO,IAAM,sBAAN,MAA0B;AAAA,EAC/B,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,iBACE,MACA,MACwC;AACxC,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,gBACE,cACA,YACA,OACA,MACwC;AACxC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,sCAAsC,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MAC9G;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cACE,kBACA,OACA,MACwC;AACxC,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,oCAAoC,mBAAmB,gBAAgB,CAAC;AAAA,MAC9E;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
2
|
+
import { P as PlanDeleteResponse, h as PlanResponse, i as PlanAssignBody } from '../schema-B1usIXCr.mjs';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class PlansService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
delete(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<PlanDeleteResponse>;
|
|
10
|
+
read(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<PlanResponse>;
|
|
11
|
+
assign(resourceType: ResourceType, resourceId: string, body: PlanAssignBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { PlansService };
|
package/dist/services/plans.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { CoreClient } from '../client';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { CoreClient } from '../client.js';
|
|
2
|
+
import { P as PlanDeleteResponse, h as PlanResponse, i as PlanAssignBody } from '../schema-B1usIXCr.js';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class PlansService {
|
|
4
7
|
private core;
|
|
5
8
|
constructor(core: CoreClient);
|
|
6
|
-
delete(resourceType:
|
|
7
|
-
read(resourceType:
|
|
8
|
-
assign(resourceType:
|
|
9
|
+
delete(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<PlanDeleteResponse>;
|
|
10
|
+
read(resourceType: ResourceType, resourceId: string, init?: Omit<RequestInit, 'method' | 'body'>): Promise<PlanResponse>;
|
|
11
|
+
assign(resourceType: ResourceType, resourceId: string, body: PlanAssignBody, init?: Omit<RequestInit, 'method' | 'body'>): Promise<unknown>;
|
|
9
12
|
}
|
|
13
|
+
|
|
14
|
+
export { PlansService };
|
package/dist/services/plans.js
CHANGED
|
@@ -1,33 +1,68 @@
|
|
|
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
|
-
|
|
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/plans.ts
|
|
20
|
+
var plans_exports = {};
|
|
21
|
+
__export(plans_exports, {
|
|
22
|
+
PlansService: () => PlansService
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(plans_exports);
|
|
25
|
+
var PlansService = class {
|
|
26
|
+
constructor(core) {
|
|
27
|
+
this.core = core;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* DELETE /v1/resources/{resourceType}/{resourceId}/plan*
|
|
31
|
+
* @summary Remove plan assignment from a tenant resource*
|
|
32
|
+
* @description Removes the billing plan assignment from a tenant resource. After removal, the resource will have no plan and will be subject to default limits.*/
|
|
33
|
+
delete(resourceType, resourceId, init) {
|
|
34
|
+
return this.core.request({
|
|
35
|
+
method: "DELETE",
|
|
36
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,
|
|
37
|
+
...init || {}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* GET /v1/resources/{resourceType}/{resourceId}/plan*
|
|
42
|
+
* @summary Get the plan assigned to a tenant resource*
|
|
43
|
+
* @description Retrieves the billing plan currently assigned to a tenant resource, if any.*/
|
|
44
|
+
read(resourceType, resourceId, init) {
|
|
45
|
+
return this.core.request({
|
|
46
|
+
method: "GET",
|
|
47
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,
|
|
48
|
+
...init || {}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* POST /v1/resources/{resourceType}/{resourceId}/plan*
|
|
53
|
+
* @summary Assign a plan to a tenant resource*
|
|
54
|
+
* @description Assigns a billing plan to a tenant resource. Plans control feature access and usage limits based on your plan definitions. The resource must be marked as a tenant in your resource definitions.*/
|
|
55
|
+
assign(resourceType, resourceId, body, init) {
|
|
56
|
+
return this.core.request({
|
|
57
|
+
method: "POST",
|
|
58
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,
|
|
59
|
+
body,
|
|
60
|
+
...init || {}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
PlansService
|
|
67
|
+
});
|
|
33
68
|
//# sourceMappingURL=plans.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/services/plans.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class PlansService {\n constructor(private core: CoreClient) {}\n\n /**\n * DELETE /v1/resources/{resourceType}/{resourceId}/plan*\n * @summary Remove plan assignment from a tenant resource*\n * @description Removes the billing plan assignment from a tenant resource. After removal, the resource will have no plan and will be subject to default limits.*/\n delete(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.PlanDeleteResponse> {\n return this.core.request({\n method: 'DELETE',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/resources/{resourceType}/{resourceId}/plan*\n * @summary Get the plan assigned to a tenant resource*\n * @description Retrieves the billing plan currently assigned to a tenant resource, if any.*/\n read(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.PlanResponse> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,\n ...(init || {}),\n });\n }\n\n /**\n * POST /v1/resources/{resourceType}/{resourceId}/plan*\n * @summary Assign a plan to a tenant resource*\n * @description Assigns a billing plan to a tenant resource. Plans control feature access and usage limits based on your plan definitions. The resource must be marked as a tenant in your resource definitions.*/\n assign(\n resourceType: ResourceType,\n resourceId: string,\n body: Schema.PlanAssignBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'POST',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,\n body: body as any,\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,OACE,cACA,YACA,MACoC;AACpC,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,MAC8B;AAC9B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,YACA,MACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/services/plans.ts
|
|
2
|
+
var PlansService = class {
|
|
3
|
+
constructor(core) {
|
|
4
|
+
this.core = core;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* DELETE /v1/resources/{resourceType}/{resourceId}/plan*
|
|
8
|
+
* @summary Remove plan assignment from a tenant resource*
|
|
9
|
+
* @description Removes the billing plan assignment from a tenant resource. After removal, the resource will have no plan and will be subject to default limits.*/
|
|
10
|
+
delete(resourceType, resourceId, init) {
|
|
11
|
+
return this.core.request({
|
|
12
|
+
method: "DELETE",
|
|
13
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,
|
|
14
|
+
...init || {}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* GET /v1/resources/{resourceType}/{resourceId}/plan*
|
|
19
|
+
* @summary Get the plan assigned to a tenant resource*
|
|
20
|
+
* @description Retrieves the billing plan currently assigned to a tenant resource, if any.*/
|
|
21
|
+
read(resourceType, resourceId, init) {
|
|
22
|
+
return this.core.request({
|
|
23
|
+
method: "GET",
|
|
24
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,
|
|
25
|
+
...init || {}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* POST /v1/resources/{resourceType}/{resourceId}/plan*
|
|
30
|
+
* @summary Assign a plan to a tenant resource*
|
|
31
|
+
* @description Assigns a billing plan to a tenant resource. Plans control feature access and usage limits based on your plan definitions. The resource must be marked as a tenant in your resource definitions.*/
|
|
32
|
+
assign(resourceType, resourceId, body, init) {
|
|
33
|
+
return this.core.request({
|
|
34
|
+
method: "POST",
|
|
35
|
+
path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,
|
|
36
|
+
body,
|
|
37
|
+
...init || {}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
PlansService
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=plans.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/plans.ts"],"sourcesContent":["import { CoreClient } from '../client';\nimport * as Schema from '../schema';\nimport type { ResourceType } from '@blimu/types';\n\nexport class PlansService {\n constructor(private core: CoreClient) {}\n\n /**\n * DELETE /v1/resources/{resourceType}/{resourceId}/plan*\n * @summary Remove plan assignment from a tenant resource*\n * @description Removes the billing plan assignment from a tenant resource. After removal, the resource will have no plan and will be subject to default limits.*/\n delete(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.PlanDeleteResponse> {\n return this.core.request({\n method: 'DELETE',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,\n ...(init || {}),\n });\n }\n\n /**\n * GET /v1/resources/{resourceType}/{resourceId}/plan*\n * @summary Get the plan assigned to a tenant resource*\n * @description Retrieves the billing plan currently assigned to a tenant resource, if any.*/\n read(\n resourceType: ResourceType,\n resourceId: string,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<Schema.PlanResponse> {\n return this.core.request({\n method: 'GET',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,\n ...(init || {}),\n });\n }\n\n /**\n * POST /v1/resources/{resourceType}/{resourceId}/plan*\n * @summary Assign a plan to a tenant resource*\n * @description Assigns a billing plan to a tenant resource. Plans control feature access and usage limits based on your plan definitions. The resource must be marked as a tenant in your resource definitions.*/\n assign(\n resourceType: ResourceType,\n resourceId: string,\n body: Schema.PlanAssignBody,\n init?: Omit<RequestInit, 'method' | 'body'>\n ): Promise<unknown> {\n return this.core.request({\n method: 'POST',\n path: `/v1/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/plan`,\n body: body as any,\n ...(init || {}),\n });\n }\n}\n"],"mappings":";AAIO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OACE,cACA,YACA,MACoC;AACpC,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,MAC8B;AAC9B,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OACE,cACA,YACA,MACA,MACkB;AAClB,WAAO,KAAK,KAAK,QAAQ;AAAA,MACvB,QAAQ;AAAA,MACR,MAAM,iBAAiB,mBAAmB,YAAY,CAAC,IAAI,mBAAmB,UAAU,CAAC;AAAA,MACzF;AAAA,MACA,GAAI,QAAQ,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CoreClient } from '../client.mjs';
|
|
2
|
+
import { j as ResourceMembersListQuery, k as ResourceMemberList } from '../schema-B1usIXCr.mjs';
|
|
3
|
+
import { ResourceType } from '@blimu/types';
|
|
4
|
+
import '@blimu/fetch';
|
|
5
|
+
|
|
6
|
+
declare class ResourceMembersService {
|
|
7
|
+
private core;
|
|
8
|
+
constructor(core: CoreClient);
|
|
9
|
+
list(resourceType: ResourceType, resourceId: string, query?: ResourceMembersListQuery, init?: Omit<RequestInit, 'method' | 'body'>): Promise<ResourceMemberList>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { ResourceMembersService };
|