@iblai/data-layer 1.27.0 → 1.29.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.d.ts +22 -1
- package/dist/index.esm.js +49 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +49 -5
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/chat-privacy/api-slice.d.ts +21 -0
- package/dist/src/features/return-base-query-errors.d.ts +25 -0
- package/dist/tests/features/chat-privacy/api-slice.test.d.ts +1 -0
- package/dist/tests/features/return-base-query-errors.test.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42256,9 +42256,52 @@ const credentialsApiSlice = react.createApi({
|
|
|
42256
42256
|
});
|
|
42257
42257
|
const { useGetCredentialsQuery, useLazyGetCredentialsQuery, useGetUserCredentialsQuery, useLazyGetUserCredentialsQuery, useCreateCallCredentialsMutation, useGetIntegrationCredentialsQuery, useLazyGetIntegrationCredentialsQuery, useCreateIntegrationCredentialMutation, useUpdateIntegrationCredentialMutation, useGetLLMCredentialsQuery, useLazyGetLLMCredentialsQuery, useCreateLLMCredentialMutation, useGetConnectedServiceAuthUrlQuery, useLazyGetConnectedServiceAuthUrlQuery, useConnectedServicesCallbackQuery, useLazyConnectedServicesCallbackQuery, useGetUsersAsAssertionsQuery, useLazyGetUsersAsAssertionsQuery, useCreateCredentialAssertionMutation, useGetCredentialsListQuery, useLazyGetCredentialsListQuery, useCreateCredentialMutation, useUpdateCredentialMutation, useDeleteCourseCredentialMutation, useGetProviderConfigQuery, useLazyGetProviderConfigQuery, useCreateProviderConfigMutation, useDeleteProviderConfigMutation, useGetExternalMappingQuery, useLazyGetExternalMappingQuery, useCreateExternalMappingMutation, useDeleteExternalMappingMutation, } = credentialsApiSlice;
|
|
42258
42258
|
|
|
42259
|
+
/**
|
|
42260
|
+
* Makes a base query that reports failures by THROWING report them by
|
|
42261
|
+
* RETURNING `{ error }` instead, which is the only form RTK Query keeps.
|
|
42262
|
+
*
|
|
42263
|
+
* `iblFetchBaseQuery` throws `{ status, data }` on any failed request. RTK
|
|
42264
|
+
* Query treats a thrown value as an unhandled exception: the thunk rejects
|
|
42265
|
+
* with `miniSerializeError(e)`, which copies only `name` / `message` /
|
|
42266
|
+
* `stack` / `code`. For a `{ status, data }` object that leaves `{}` — so
|
|
42267
|
+
* `.unwrap()` rejects with an empty object and a hook's `error` is empty too.
|
|
42268
|
+
* The HTTP status and the backend's body never reach the caller: a 403 cannot
|
|
42269
|
+
* be told from any other failure, and a 400's field messages or its
|
|
42270
|
+
* form-level `error` string cannot be shown.
|
|
42271
|
+
*
|
|
42272
|
+
* Wrap a slice's base query with this when its callers need the status or the
|
|
42273
|
+
* body, e.g. to place backend validation messages next to their fields.
|
|
42274
|
+
*
|
|
42275
|
+
* Only values that look like an RTK error (an object with a `status`) are
|
|
42276
|
+
* converted; anything else is rethrown untouched. Note that a returned error
|
|
42277
|
+
* also lets a mutation's static `invalidatesTags` run, as RTK does for any
|
|
42278
|
+
* handled error.
|
|
42279
|
+
*/
|
|
42280
|
+
function withReturnedErrors(baseQuery) {
|
|
42281
|
+
// Returned as `Query` so a slice keeps the exact argument, error and meta
|
|
42282
|
+
// types of the base query it wraps.
|
|
42283
|
+
const wrapped = async (args, api, extraOptions) => {
|
|
42284
|
+
try {
|
|
42285
|
+
return await baseQuery(args, api, extraOptions);
|
|
42286
|
+
}
|
|
42287
|
+
catch (thrown) {
|
|
42288
|
+
if (typeof thrown === 'object' && thrown !== null && 'status' in thrown) {
|
|
42289
|
+
return { error: thrown };
|
|
42290
|
+
}
|
|
42291
|
+
throw thrown;
|
|
42292
|
+
}
|
|
42293
|
+
};
|
|
42294
|
+
return wrapped;
|
|
42295
|
+
}
|
|
42296
|
+
|
|
42259
42297
|
const chatPrivacyApiSlice = react.createApi({
|
|
42260
42298
|
reducerPath: 'chatPrivacyApiSlice',
|
|
42261
|
-
|
|
42299
|
+
// Callers read the failure itself: the 403 a locked mentor answers to a
|
|
42300
|
+
// `disable-chathistory` flip carries its reason in `data.detail`, and the
|
|
42301
|
+
// 400 refusing to re-enable an orphaned session carries it under the field
|
|
42302
|
+
// name. `iblFetchBaseQuery` throws
|
|
42303
|
+
// its errors, which reach `.unwrap()` and the hooks as `{}`.
|
|
42304
|
+
baseQuery: withReturnedErrors(iblFetchBaseQuery),
|
|
42262
42305
|
tagTypes: ['TenantChatPrivacyConfig', 'UserChatPrivacySettings', 'ChatPrivacyEffective'],
|
|
42263
42306
|
endpoints: (builder) => ({
|
|
42264
42307
|
getTenantChatPrivacyConfig: builder.query({
|
|
@@ -42308,10 +42351,11 @@ const chatPrivacyApiSlice = react.createApi({
|
|
|
42308
42351
|
},
|
|
42309
42352
|
providesTags: ['ChatPrivacyEffective'],
|
|
42310
42353
|
}),
|
|
42311
|
-
//
|
|
42312
|
-
//
|
|
42313
|
-
//
|
|
42314
|
-
//
|
|
42354
|
+
// Two-way flip. `true` stops saving new messages; a session that already
|
|
42355
|
+
// has history keeps its owner (stays listed), an EMPTY one is orphaned
|
|
42356
|
+
// (backend nulls Session.student). `false` resumes history on the same
|
|
42357
|
+
// session, refused only for an orphaned session (400 for an admin, 404
|
|
42358
|
+
// for its own user — the ownership check fails first).
|
|
42315
42359
|
//
|
|
42316
42360
|
// Important — this endpoint lives under `/api/ai-mentor/…`, NOT under
|
|
42317
42361
|
// `/api/ai-account/…` like the other chat-privacy endpoints. The
|