@iblai/data-layer 1.30.3 → 1.32.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 +412 -2
- package/dist/index.esm.js +39 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +42 -1
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/chat/api-slice.d.ts +22 -0
- package/dist/src/features/platform/api-slice.d.ts +355 -1
- package/dist/src/features/platform/types.d.ts +32 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39950,6 +39950,17 @@ const buildRecentMessagesUrl = (args, pageParam) => {
|
|
|
39950
39950
|
appendChatFilterParams(params, args);
|
|
39951
39951
|
return `/api/ai-mentor/orgs/${args.org}/users/${args.userId}/recent-messages/?${params.toString()}`;
|
|
39952
39952
|
};
|
|
39953
|
+
/**
|
|
39954
|
+
* The session id of the first recent-messages row, or `null` when there is
|
|
39955
|
+
* none. Assumes the endpoint lists newest first (not yet confirmed by the
|
|
39956
|
+
* backend) — this is the one place to change if that, or the source, changes.
|
|
39957
|
+
*/
|
|
39958
|
+
const latestSessionIdFrom = (body) => {
|
|
39959
|
+
var _a;
|
|
39960
|
+
const rows = Array.isArray(body) ? body : body === null || body === void 0 ? void 0 : body.results;
|
|
39961
|
+
const sessionId = (_a = rows === null || rows === void 0 ? void 0 : rows[0]) === null || _a === void 0 ? void 0 : _a.session_id;
|
|
39962
|
+
return typeof sessionId === 'string' && sessionId ? sessionId : null;
|
|
39963
|
+
};
|
|
39953
39964
|
/**
|
|
39954
39965
|
* Build the user-wide pin-message list URL. Never carries `session_id` (the
|
|
39955
39966
|
* endpoint does not accept it); `mentor`/`search` are appended only when non-empty.
|
|
@@ -40033,6 +40044,19 @@ const chatApiSlice = react.createApi({
|
|
|
40033
40044
|
}),
|
|
40034
40045
|
}),
|
|
40035
40046
|
});
|
|
40047
|
+
/**
|
|
40048
|
+
* The user's latest session with an agent, read from page 0 of the same
|
|
40049
|
+
* `getRecentMessages` entry the chat-history sidebar subscribes to (`search: ''`
|
|
40050
|
+
* is its idle search box), so an agent open costs one request, not two.
|
|
40051
|
+
* `forceRefetch` in seconds is the time since `openedAt`: an entry fulfilled
|
|
40052
|
+
* before this open is refetched (another device may have started a chat since),
|
|
40053
|
+
* one fulfilled after it is reused, and one in flight is joined — RTK never
|
|
40054
|
+
* starts a second request for a pending entry.
|
|
40055
|
+
*/
|
|
40056
|
+
const fetchLatestMentorSessionId = ({ org, userId, mentor }, openedAt) => async (dispatch) => {
|
|
40057
|
+
const data = await dispatch(chatApiSlice.endpoints.getRecentMessages.initiate({ org, userId, mentor, search: '' }, { forceRefetch: Math.max((Date.now() - openedAt) / 1000, 0.001), subscribe: false })).unwrap();
|
|
40058
|
+
return latestSessionIdFrom(data.pages[0]);
|
|
40059
|
+
};
|
|
40036
40060
|
const { useLazyGetPinnedMessagesQuery, useUnPinMessageMutation, useDeleteMessageMutation, useGetPinnedMessagesQuery, useAddPinnedMessageMutation, useGetVectorDocumentsQuery, useLazyGetVectorDocumentsQuery, useGetRecentMessageQuery, useLazyGetRecentMessageQuery, useGetRecentMessagesInfiniteQuery, useUpdateMessageFeedbackMutation, useAudioToTextMutation, } = chatApiSlice;
|
|
40037
40061
|
|
|
40038
40062
|
const chatCustomApiSlice = react.createApi({
|
|
@@ -40676,11 +40700,24 @@ const platformApiSlice = react.createApi({
|
|
|
40676
40700
|
'platform_user_groups',
|
|
40677
40701
|
'platform_application_forms',
|
|
40678
40702
|
'platform_applications',
|
|
40703
|
+
'user_platforms',
|
|
40679
40704
|
],
|
|
40680
40705
|
endpoints: (builder) => ({
|
|
40681
40706
|
usersGradesPassed: builder.query({
|
|
40682
40707
|
...buildEndpointFromDmService(AiAnalyticsService.platformOrgsCoursesUsersGradesPassedRetrieve),
|
|
40683
40708
|
}),
|
|
40709
|
+
/**
|
|
40710
|
+
* The platforms a user is linked to. Each link carries `is_default`, so the
|
|
40711
|
+
* caller's default platform can be read from this list without a second
|
|
40712
|
+
* call to `/api/core/users/platforms/default/`.
|
|
40713
|
+
*
|
|
40714
|
+
* The pinned client's `UserPlatformLink` predates that field, hence the
|
|
40715
|
+
* cast to the local type.
|
|
40716
|
+
*/
|
|
40717
|
+
userPlatforms: builder.query({
|
|
40718
|
+
...buildEndpointFromDmService(async (args) => CoreService.coreUsersPlatformsList(args)),
|
|
40719
|
+
providesTags: ['user_platforms'],
|
|
40720
|
+
}),
|
|
40684
40721
|
platformUsers: builder.query({
|
|
40685
40722
|
...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
|
|
40686
40723
|
// Convert all args to strings for URLSearchParams
|
|
@@ -41018,7 +41055,7 @@ const platformApiSlice = react.createApi({
|
|
|
41018
41055
|
}),
|
|
41019
41056
|
});
|
|
41020
41057
|
const platformApiReducer = platformApiSlice.reducer;
|
|
41021
|
-
const { useUsersGradesPassedQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, usePlatformUserGroupsQuery, usePlatformInvitationsQuery, usePlatformUsersQuery, useInviteUserMutation, useUpdatePlatformUserRoleWithPoliciesMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetPlatformUserGroupDetailsQuery, useGetApplicationStatusQuery, useLazyGetApplicationStatusQuery, useGetApplicationFormQuery, useLazyGetApplicationFormQuery, useCreateApplicationDraftMutation, useUpdateApplicationMutation, useSubmitApplicationMutation, useUploadApplicationAttachmentMutation, useDeleteApplicationAttachmentMutation, useGetApplicationFormsQuery, useLazyGetApplicationFormsQuery, useGetApplicationFormDetailQuery, useLazyGetApplicationFormDetailQuery, useCreateApplicationFormMutation, useUpdateApplicationFormMutation, useGetApplicationsPipelineQuery, useLazyGetApplicationsPipelineQuery, useGetApplicationsPipelineStatsQuery, useListOwnApplicationsQuery, useLazyListOwnApplicationsQuery, useRenewApplicationMutation, useWithdrawApplicationMutation, useGetApplicationAdminDetailQuery, useLazyGetApplicationAdminDetailQuery, useTransitionApplicationMutation, useCreateApplicationWaiverMutation, useDeleteApplicationWaiverMutation, useSubmitApplicationOverrideMutation, useGetApplicationNotesQuery, useCreateApplicationNoteMutation, useUpdateApplicationNoteMutation, useDeleteApplicationNoteMutation, useLazyGetApplicationAttachmentFileQuery, useGetApplicationBlocksQuery, useDeleteApplicationBlockMutation, useGetApplicationPlacementsQuery, useCreateApplicationPlacementsMutation, useUpdateApplicationPlacementMutation, useGetApplicationCourseAssignmentsQuery, useCreateApplicationCourseAssignmentsMutation, useDeleteApplicationCourseAssignmentMutation, useInviteApplicationCandidateMutation, useLinkApplicationCandidateMutation, } = platformApiSlice;
|
|
41058
|
+
const { useUsersGradesPassedQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, usePlatformUserGroupsQuery, usePlatformInvitationsQuery, usePlatformUsersQuery, useInviteUserMutation, useUpdatePlatformUserRoleWithPoliciesMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetPlatformUserGroupDetailsQuery, useGetApplicationStatusQuery, useLazyGetApplicationStatusQuery, useGetApplicationFormQuery, useLazyGetApplicationFormQuery, useCreateApplicationDraftMutation, useUpdateApplicationMutation, useSubmitApplicationMutation, useUploadApplicationAttachmentMutation, useDeleteApplicationAttachmentMutation, useGetApplicationFormsQuery, useLazyGetApplicationFormsQuery, useGetApplicationFormDetailQuery, useLazyGetApplicationFormDetailQuery, useCreateApplicationFormMutation, useUpdateApplicationFormMutation, useGetApplicationsPipelineQuery, useLazyGetApplicationsPipelineQuery, useGetApplicationsPipelineStatsQuery, useListOwnApplicationsQuery, useLazyListOwnApplicationsQuery, useRenewApplicationMutation, useWithdrawApplicationMutation, useGetApplicationAdminDetailQuery, useLazyGetApplicationAdminDetailQuery, useTransitionApplicationMutation, useCreateApplicationWaiverMutation, useDeleteApplicationWaiverMutation, useSubmitApplicationOverrideMutation, useGetApplicationNotesQuery, useCreateApplicationNoteMutation, useUpdateApplicationNoteMutation, useDeleteApplicationNoteMutation, useLazyGetApplicationAttachmentFileQuery, useGetApplicationBlocksQuery, useDeleteApplicationBlockMutation, useGetApplicationPlacementsQuery, useCreateApplicationPlacementsMutation, useUpdateApplicationPlacementMutation, useGetApplicationCourseAssignmentsQuery, useCreateApplicationCourseAssignmentsMutation, useDeleteApplicationCourseAssignmentMutation, useInviteApplicationCandidateMutation, useLinkApplicationCandidateMutation, useUserPlatformsQuery, useLazyUserPlatformsQuery, } = platformApiSlice;
|
|
41022
41059
|
|
|
41023
41060
|
const USERS_ENDPOINTS = {
|
|
41024
41061
|
GET_USER_METADATA: {
|
|
@@ -50051,6 +50088,7 @@ exports.evaluationsApiSlice = evaluationsApiSlice;
|
|
|
50051
50088
|
exports.extractBoundMentorIds = extractBoundMentorIds;
|
|
50052
50089
|
exports.fakeBaseQueryWithLogging = fakeBaseQueryWithLogging;
|
|
50053
50090
|
exports.featureTags = featureTags;
|
|
50091
|
+
exports.fetchLatestMentorSessionId = fetchLatestMentorSessionId;
|
|
50054
50092
|
exports.fetchLearnerCompletion = fetchLearnerCompletion;
|
|
50055
50093
|
exports.fetchUserLlmUsage = fetchUserLlmUsage;
|
|
50056
50094
|
exports.filterCourseUserRoles = filterCourseUserRoles;
|
|
@@ -50080,6 +50118,7 @@ exports.isSpendCapExceededErrorBody = isSpendCapExceededErrorBody;
|
|
|
50080
50118
|
exports.isUserLlmUsageEmpty = isUserLlmUsageEmpty;
|
|
50081
50119
|
exports.isValidHostPort = isValidHostPort;
|
|
50082
50120
|
exports.isVirtualMachineEgressNetworked = isVirtualMachineEgressNetworked;
|
|
50121
|
+
exports.latestSessionIdFrom = latestSessionIdFrom;
|
|
50083
50122
|
exports.llmsApiSlice = llmsApiSlice;
|
|
50084
50123
|
exports.mcpApiSlice = mcpApiSlice;
|
|
50085
50124
|
exports.memoryApiSlice = memoryApiSlice;
|
|
@@ -50823,6 +50862,7 @@ exports.useLazyRefreshJwtTokenQuery = useLazyRefreshJwtTokenQuery;
|
|
|
50823
50862
|
exports.useLazySeedMentorsQuery = useLazySeedMentorsQuery;
|
|
50824
50863
|
exports.useLazyStarredMentorsQuery = useLazyStarredMentorsQuery;
|
|
50825
50864
|
exports.useLazyStartOAuthFlowQuery = useLazyStartOAuthFlowQuery;
|
|
50865
|
+
exports.useLazyUserPlatformsQuery = useLazyUserPlatformsQuery;
|
|
50826
50866
|
exports.useLinkApplicationCandidateMutation = useLinkApplicationCandidateMutation;
|
|
50827
50867
|
exports.useListAgentSpendCapsQuery = useListAgentSpendCapsQuery;
|
|
50828
50868
|
exports.useListAgentUserSpendCapsQuery = useListAgentUserSpendCapsQuery;
|
|
@@ -50988,6 +51028,7 @@ exports.useUserLlmUsageMetrics = useUserLlmUsageMetrics;
|
|
|
50988
51028
|
exports.useUserLlmUsageObservations = useUserLlmUsageObservations;
|
|
50989
51029
|
exports.useUserLlmUsageSummary = useUserLlmUsageSummary;
|
|
50990
51030
|
exports.useUserLlmUsageTraces = useUserLlmUsageTraces;
|
|
51031
|
+
exports.useUserPlatformsQuery = useUserPlatformsQuery;
|
|
50991
51032
|
exports.useUsersGradesPassedQuery = useUsersGradesPassedQuery;
|
|
50992
51033
|
exports.useValidateWorkflowMutation = useValidateWorkflowMutation;
|
|
50993
51034
|
exports.useWithdrawApplicationMutation = useWithdrawApplicationMutation;
|