@iblai/data-layer 1.6.3 → 1.7.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/dist/index.esm.js CHANGED
@@ -39468,7 +39468,19 @@ const chatApiSlice = createApi({
39468
39468
  providesTags: ['pinnedMessages'],
39469
39469
  }),
39470
39470
  unPinMessage: builder.mutation({
39471
- ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersPinMessageDestroy),
39471
+ // The generated `aiMentorOrgsUsersPinMessageDestroy` only sends org/user
39472
+ // path params and omits the body, but the DELETE pin-message endpoint
39473
+ // needs `{ session_id }` to know which pinned message to remove.
39474
+ queryFn: async (args, api, extraOptions) => {
39475
+ const url = `/api/ai-mentor/orgs/${args.org}/users/${args.userId}/pin-message/`;
39476
+ return iblFetchBaseQuery({
39477
+ url,
39478
+ method: 'DELETE',
39479
+ body: args.requestBody,
39480
+ service: SERVICES.DM,
39481
+ }, api, extraOptions);
39482
+ },
39483
+ invalidatesTags: ['pinnedMessages'],
39472
39484
  }),
39473
39485
  addPinnedMessage: builder.mutation({
39474
39486
  ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersPinMessageCreate),
@@ -40448,30 +40460,127 @@ const coreApiSlice = createApi({
40448
40460
  }),
40449
40461
  //RBAC ROLES
40450
40462
  getRbacRoles: builder.query({
40451
- ...buildEndpointFromDmService(CoreService.coreRbacRolesList),
40463
+ ...buildEndpointFromService(SERVICES.DM, async (args) => {
40464
+ const queryParams = new URLSearchParams({ include_global_roles: 'true' });
40465
+ if (args.platformKey)
40466
+ queryParams.set('platform_key', args.platformKey);
40467
+ if (args.name)
40468
+ queryParams.set('name', args.name);
40469
+ if (args.page !== undefined)
40470
+ queryParams.set('page', String(args.page));
40471
+ if (args.pageSize !== undefined)
40472
+ queryParams.set('page_size', String(args.pageSize));
40473
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/?${queryParams.toString()}`;
40474
+ const response = await fetch(url, {
40475
+ method: 'GET',
40476
+ headers: OpenAPI.HEADERS,
40477
+ credentials: 'omit',
40478
+ });
40479
+ if (!response.ok) {
40480
+ throw Object.assign(new Error('Failed to fetch RBAC roles'), {
40481
+ status: response.status,
40482
+ body: await response.text(),
40483
+ });
40484
+ }
40485
+ return response.json();
40486
+ }),
40452
40487
  providesTags: ['RbacRoles'],
40453
40488
  }),
40454
40489
  createRbacRole: builder.mutation({
40455
- ...buildEndpointFromDmService(CoreService.coreRbacRolesCreate),
40490
+ ...buildEndpointFromService(SERVICES.DM, async (args) => {
40491
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/?include_global_roles=true`;
40492
+ const response = await fetch(url, {
40493
+ method: 'POST',
40494
+ headers: {
40495
+ ...OpenAPI.HEADERS,
40496
+ 'Content-Type': 'application/json',
40497
+ },
40498
+ credentials: 'omit',
40499
+ body: JSON.stringify(args.requestBody),
40500
+ });
40501
+ if (!response.ok) {
40502
+ throw Object.assign(new Error('Failed to create RBAC role'), {
40503
+ status: response.status,
40504
+ body: await response.text(),
40505
+ });
40506
+ }
40507
+ return response.json();
40508
+ }),
40456
40509
  invalidatesTags: ['RbacRoles'],
40457
40510
  }),
40458
40511
  updateRbacRole: builder.mutation({
40459
- ...buildEndpointFromDmService(CoreService.coreRbacRolesUpdate),
40512
+ ...buildEndpointFromService(SERVICES.DM, async (args) => {
40513
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?include_global_roles=true`;
40514
+ const response = await fetch(url, {
40515
+ method: 'PUT',
40516
+ headers: {
40517
+ ...OpenAPI.HEADERS,
40518
+ 'Content-Type': 'application/json',
40519
+ },
40520
+ credentials: 'omit',
40521
+ body: JSON.stringify(args.requestBody),
40522
+ });
40523
+ if (!response.ok) {
40524
+ throw Object.assign(new Error('Failed to update RBAC role'), {
40525
+ status: response.status,
40526
+ body: await response.text(),
40527
+ });
40528
+ }
40529
+ return response.json();
40530
+ }),
40460
40531
  invalidatesTags: ['RbacRoles'],
40461
40532
  }),
40462
40533
  partialUpdateRbacRole: builder.mutation({
40463
- ...buildEndpointFromDmService(CoreService.coreRbacRolesPartialUpdate),
40534
+ ...buildEndpointFromService(SERVICES.DM, async (args) => {
40535
+ var _a;
40536
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?include_global_roles=true`;
40537
+ const response = await fetch(url, {
40538
+ method: 'PATCH',
40539
+ headers: {
40540
+ ...OpenAPI.HEADERS,
40541
+ 'Content-Type': 'application/json',
40542
+ },
40543
+ credentials: 'omit',
40544
+ body: JSON.stringify((_a = args.requestBody) !== null && _a !== void 0 ? _a : {}),
40545
+ });
40546
+ if (!response.ok) {
40547
+ throw Object.assign(new Error('Failed to partially update RBAC role'), {
40548
+ status: response.status,
40549
+ body: await response.text(),
40550
+ });
40551
+ }
40552
+ return response.json();
40553
+ }),
40464
40554
  invalidatesTags: ['RbacRoles'],
40465
40555
  }),
40466
40556
  deleteRbacRole: builder.mutation({
40467
- ...buildEndpointFromDmService(CoreService.coreRbacRolesDestroy),
40557
+ ...buildEndpointFromService(SERVICES.DM, async (args) => {
40558
+ const queryParams = new URLSearchParams({
40559
+ include_global_roles: 'true',
40560
+ platform_key: args.platformKey,
40561
+ });
40562
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?${queryParams.toString()}`;
40563
+ const response = await fetch(url, {
40564
+ method: 'DELETE',
40565
+ headers: OpenAPI.HEADERS,
40566
+ credentials: 'omit',
40567
+ });
40568
+ if (!response.ok) {
40569
+ throw Object.assign(new Error('Failed to delete RBAC role'), {
40570
+ status: response.status,
40571
+ body: await response.text(),
40572
+ });
40573
+ }
40574
+ }),
40468
40575
  invalidatesTags: ['RbacRoles'],
40469
40576
  }),
40470
40577
  getRbacRoleDetails: builder.query({
40471
40578
  ...buildEndpointFromService(SERVICES.DM, async (args) => {
40472
- const queryParams = new URLSearchParams({ platform_key: args.platform_key });
40473
- const queryString = queryParams.toString();
40474
- const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?${queryString}`;
40579
+ const queryParams = new URLSearchParams({
40580
+ include_global_roles: 'true',
40581
+ platform_key: args.platform_key,
40582
+ });
40583
+ const url = `${OpenAPI.BASE}/api/core/rbac/roles/${args.id}/?${queryParams.toString()}`;
40475
40584
  const response = await fetch(url, {
40476
40585
  method: 'GET',
40477
40586
  headers: OpenAPI.HEADERS,