@iblai/data-layer 1.6.3 → 1.7.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/dist/index.js CHANGED
@@ -40450,30 +40450,127 @@ const coreApiSlice = react.createApi({
40450
40450
  }),
40451
40451
  //RBAC ROLES
40452
40452
  getRbacRoles: builder.query({
40453
- ...buildEndpointFromDmService(CoreService.coreRbacRolesList),
40453
+ ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40454
+ const queryParams = new URLSearchParams({ include_global_roles: 'true' });
40455
+ if (args.platformKey)
40456
+ queryParams.set('platform_key', args.platformKey);
40457
+ if (args.name)
40458
+ queryParams.set('name', args.name);
40459
+ if (args.page !== undefined)
40460
+ queryParams.set('page', String(args.page));
40461
+ if (args.pageSize !== undefined)
40462
+ queryParams.set('page_size', String(args.pageSize));
40463
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/?${queryParams.toString()}`;
40464
+ const response = await fetch(url, {
40465
+ method: 'GET',
40466
+ headers: OpenAPI.HEADERS,
40467
+ credentials: 'omit',
40468
+ });
40469
+ if (!response.ok) {
40470
+ throw Object.assign(new Error('Failed to fetch RBAC roles'), {
40471
+ status: response.status,
40472
+ body: await response.text(),
40473
+ });
40474
+ }
40475
+ return response.json();
40476
+ }),
40454
40477
  providesTags: ['RbacRoles'],
40455
40478
  }),
40456
40479
  createRbacRole: builder.mutation({
40457
- ...buildEndpointFromDmService(CoreService.coreRbacRolesCreate),
40480
+ ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40481
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/?include_global_roles=true`;
40482
+ const response = await fetch(url, {
40483
+ method: 'POST',
40484
+ headers: {
40485
+ ...OpenAPI.HEADERS,
40486
+ 'Content-Type': 'application/json',
40487
+ },
40488
+ credentials: 'omit',
40489
+ body: JSON.stringify(args.requestBody),
40490
+ });
40491
+ if (!response.ok) {
40492
+ throw Object.assign(new Error('Failed to create RBAC role'), {
40493
+ status: response.status,
40494
+ body: await response.text(),
40495
+ });
40496
+ }
40497
+ return response.json();
40498
+ }),
40458
40499
  invalidatesTags: ['RbacRoles'],
40459
40500
  }),
40460
40501
  updateRbacRole: builder.mutation({
40461
- ...buildEndpointFromDmService(CoreService.coreRbacRolesUpdate),
40502
+ ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40503
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?include_global_roles=true`;
40504
+ const response = await fetch(url, {
40505
+ method: 'PUT',
40506
+ headers: {
40507
+ ...OpenAPI.HEADERS,
40508
+ 'Content-Type': 'application/json',
40509
+ },
40510
+ credentials: 'omit',
40511
+ body: JSON.stringify(args.requestBody),
40512
+ });
40513
+ if (!response.ok) {
40514
+ throw Object.assign(new Error('Failed to update RBAC role'), {
40515
+ status: response.status,
40516
+ body: await response.text(),
40517
+ });
40518
+ }
40519
+ return response.json();
40520
+ }),
40462
40521
  invalidatesTags: ['RbacRoles'],
40463
40522
  }),
40464
40523
  partialUpdateRbacRole: builder.mutation({
40465
- ...buildEndpointFromDmService(CoreService.coreRbacRolesPartialUpdate),
40524
+ ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40525
+ var _a;
40526
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?include_global_roles=true`;
40527
+ const response = await fetch(url, {
40528
+ method: 'PATCH',
40529
+ headers: {
40530
+ ...OpenAPI.HEADERS,
40531
+ 'Content-Type': 'application/json',
40532
+ },
40533
+ credentials: 'omit',
40534
+ body: JSON.stringify((_a = args.requestBody) !== null && _a !== void 0 ? _a : {}),
40535
+ });
40536
+ if (!response.ok) {
40537
+ throw Object.assign(new Error('Failed to partially update RBAC role'), {
40538
+ status: response.status,
40539
+ body: await response.text(),
40540
+ });
40541
+ }
40542
+ return response.json();
40543
+ }),
40466
40544
  invalidatesTags: ['RbacRoles'],
40467
40545
  }),
40468
40546
  deleteRbacRole: builder.mutation({
40469
- ...buildEndpointFromDmService(CoreService.coreRbacRolesDestroy),
40547
+ ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40548
+ const queryParams = new URLSearchParams({
40549
+ include_global_roles: 'true',
40550
+ platform_key: args.platformKey,
40551
+ });
40552
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?${queryParams.toString()}`;
40553
+ const response = await fetch(url, {
40554
+ method: 'DELETE',
40555
+ headers: OpenAPI.HEADERS,
40556
+ credentials: 'omit',
40557
+ });
40558
+ if (!response.ok) {
40559
+ throw Object.assign(new Error('Failed to delete RBAC role'), {
40560
+ status: response.status,
40561
+ body: await response.text(),
40562
+ });
40563
+ }
40564
+ }),
40470
40565
  invalidatesTags: ['RbacRoles'],
40471
40566
  }),
40472
40567
  getRbacRoleDetails: builder.query({
40473
40568
  ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40474
- const queryParams = new URLSearchParams({ platform_key: args.platform_key });
40475
- const queryString = queryParams.toString();
40476
- const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?${queryString}`;
40569
+ const queryParams = new URLSearchParams({
40570
+ include_global_roles: 'true',
40571
+ platform_key: args.platform_key,
40572
+ });
40573
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?${queryParams.toString()}`;
40477
40574
  const response = await fetch(url, {
40478
40575
  method: 'GET',
40479
40576
  headers: OpenAPI.HEADERS,