@iblai/data-layer 1.9.3 → 1.9.5

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
@@ -40782,6 +40782,83 @@ const coreApiSlice = react.createApi({
40782
40782
  return response.json();
40783
40783
  }),
40784
40784
  }),
40785
+ // ── RBAC resource discovery (incremental resource-path builder) ──
40786
+ // Custom calls: the pinned @iblai/iblai-api client does not expose the
40787
+ // discovery endpoint yet, and list_url is a dynamic relative URL returned
40788
+ // by the discovery response rather than a fixed generated route.
40789
+ getRbacResourceDiscovery: builder.query({
40790
+ ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40791
+ // URLSearchParams escapes the slashes in `path` for us.
40792
+ const queryParams = new URLSearchParams({ path: args.path });
40793
+ if (args.platformKey)
40794
+ queryParams.set('platform_key', args.platformKey);
40795
+ const url = `${OpenAPI.BASE}/api/core/rbac/resources/?${queryParams.toString()}`;
40796
+ const response = await fetch(url, {
40797
+ method: 'GET',
40798
+ headers: OpenAPI.HEADERS,
40799
+ credentials: 'omit',
40800
+ });
40801
+ if (!response.ok) {
40802
+ throw Object.assign(new Error('Failed to fetch RBAC resource discovery'), {
40803
+ status: response.status,
40804
+ body: await response.text(),
40805
+ });
40806
+ }
40807
+ return response.json();
40808
+ }),
40809
+ }),
40810
+ getRbacResourceList: builder.query({
40811
+ ...buildEndpointFromService(exports.SERVICES.DM, async (args) => {
40812
+ var _a, _b, _c, _d, _e, _f;
40813
+ const url = new URL(`${OpenAPI.BASE}${args.listUrl}`);
40814
+ for (const [key, value] of Object.entries((_a = args.searchParams) !== null && _a !== void 0 ? _a : {})) {
40815
+ if (value !== '')
40816
+ url.searchParams.set(key, value);
40817
+ }
40818
+ const response = await fetch(url.toString(), {
40819
+ method: 'GET',
40820
+ headers: OpenAPI.HEADERS,
40821
+ credentials: 'omit',
40822
+ });
40823
+ if (!response.ok) {
40824
+ throw Object.assign(new Error('Failed to fetch RBAC resource list'), {
40825
+ status: response.status,
40826
+ body: await response.text(),
40827
+ });
40828
+ }
40829
+ const raw = await response.json();
40830
+ // The list endpoints vary per collection: bare arrays, DRF
40831
+ // envelopes ({results}), or nested ({results: {data}} / {data}).
40832
+ const rows = Array.isArray(raw)
40833
+ ? raw
40834
+ : Array.isArray(raw === null || raw === void 0 ? void 0 : raw.results)
40835
+ ? raw.results
40836
+ : Array.isArray((_b = raw === null || raw === void 0 ? void 0 : raw.results) === null || _b === void 0 ? void 0 : _b.data)
40837
+ ? raw.results.data
40838
+ : Array.isArray(raw === null || raw === void 0 ? void 0 : raw.data)
40839
+ ? raw.data
40840
+ : [];
40841
+ const pkField = (_d = (_c = args.resultFields) === null || _c === void 0 ? void 0 : _c.pk) !== null && _d !== void 0 ? _d : 'id';
40842
+ const nameField = (_f = (_e = args.resultFields) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : 'name';
40843
+ const items = rows
40844
+ .filter((row) => (row === null || row === void 0 ? void 0 : row[pkField]) !== undefined && (row === null || row === void 0 ? void 0 : row[pkField]) !== null)
40845
+ .map((row) => {
40846
+ // Some rows (e.g. platform users) have a blank name — fall back
40847
+ // to their email, then to the pk, so the picker never shows an
40848
+ // empty label.
40849
+ const rawName = row[nameField];
40850
+ const name = (typeof rawName === 'string' ? rawName.trim() : rawName) ||
40851
+ (typeof row.email === 'string' ? row.email : '') ||
40852
+ String(row[pkField]);
40853
+ return {
40854
+ pk: row[pkField],
40855
+ name: String(name),
40856
+ raw: row,
40857
+ };
40858
+ });
40859
+ return { items, raw };
40860
+ }),
40861
+ }),
40785
40862
  getRbacTeamsAccessList: builder.query({
40786
40863
  ...buildEndpointFromDmService(CoreService.coreRbacTeamsAccessList),
40787
40864
  providesTags: ['RbacTeamsAccess'],
@@ -40867,7 +40944,7 @@ const coreApiSlice = react.createApi({
40867
40944
  }),
40868
40945
  }),
40869
40946
  });
40870
- const { useCreateRedirectTokenMutation, useGetPlatformInfoQuery, useGetRbacPermissionsMutation, useLazyGetPlatformInfoQuery, useUpdatePlatformInfoMutation, useUpdateUserStatusMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, useGetRbacGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useGetRbacGroupDetailsQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetRbacRolesQuery, useLazyGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, usePartialUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetDepartmentMemberCheckQuery, useLazyGetDepartmentMemberCheckQuery, useGetRbacMentorAccessListQuery, useUpdateRbacMentorAccessMutation, useGetRbacActionsDefinitionQuery, useLazyGetRbacActionsDefinitionQuery, useGetRbacTeamsAccessListQuery, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation,
40947
+ const { useCreateRedirectTokenMutation, useGetPlatformInfoQuery, useGetRbacPermissionsMutation, useLazyGetPlatformInfoQuery, useUpdatePlatformInfoMutation, useUpdateUserStatusMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, useGetRbacGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useGetRbacGroupDetailsQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetRbacRolesQuery, useLazyGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, usePartialUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetDepartmentMemberCheckQuery, useLazyGetDepartmentMemberCheckQuery, useGetRbacMentorAccessListQuery, useUpdateRbacMentorAccessMutation, useGetRbacActionsDefinitionQuery, useLazyGetRbacActionsDefinitionQuery, useGetRbacResourceDiscoveryQuery, useLazyGetRbacResourceDiscoveryQuery, useGetRbacResourceListQuery, useLazyGetRbacResourceListQuery, useGetRbacTeamsAccessListQuery, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation,
40871
40948
  // LTI Keys
40872
40949
  useGetLtiKeysQuery, useGetLtiKeyDetailQuery, useLazyGetLtiKeyDetailQuery, useCreateLtiKeyMutation, useUpdateLtiKeyMutation, useDeleteLtiKeyMutation,
40873
40950
  // LTI Agent (Mentor) Links
@@ -45474,6 +45551,391 @@ const auditLogsApiSlice = react.createApi({
45474
45551
  });
45475
45552
  const { useGetAuditLogsQuery, useLazyGetAuditLogsQuery } = auditLogsApiSlice;
45476
45553
 
45554
+ const EVALUATIONS_REDUCER_PATH = 'evaluationsApiSlice';
45555
+ const evaluationsBase = (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/evaluations`;
45556
+ const EVALUATIONS_ENDPOINTS = {
45557
+ GET_TASK: {
45558
+ service: exports.SERVICES.AXD,
45559
+ path: (org, userId, taskId) => `/api/ai-mentor/orgs/${org}/users/${userId}/tasks/${encodeURIComponent(taskId)}`,
45560
+ },
45561
+ LIST_DATASETS: {
45562
+ service: exports.SERVICES.AXD,
45563
+ path: (org, userId) => `${evaluationsBase(org, userId)}/datasets/`,
45564
+ },
45565
+ CREATE_DATASET: {
45566
+ service: exports.SERVICES.AXD,
45567
+ path: (org, userId) => `${evaluationsBase(org, userId)}/datasets/`,
45568
+ },
45569
+ GET_DATASET: {
45570
+ service: exports.SERVICES.AXD,
45571
+ path: (org, userId, datasetName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/`,
45572
+ },
45573
+ LIST_DATASET_ITEMS: {
45574
+ service: exports.SERVICES.AXD,
45575
+ path: (org, userId, datasetName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/items/`,
45576
+ },
45577
+ ADD_DATASET_ITEMS: {
45578
+ service: exports.SERVICES.AXD,
45579
+ path: (org, userId, datasetName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/items/`,
45580
+ },
45581
+ UPLOAD_DATASET_CSV: {
45582
+ service: exports.SERVICES.AXD,
45583
+ path: (org, userId, datasetName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/items/upload/`,
45584
+ },
45585
+ UPDATE_DATASET_ITEM: {
45586
+ service: exports.SERVICES.AXD,
45587
+ path: (org, userId, datasetName, itemId) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/items/${encodeURIComponent(itemId)}/`,
45588
+ },
45589
+ DELETE_DATASET_ITEM: {
45590
+ service: exports.SERVICES.AXD,
45591
+ path: (org, userId, datasetName, itemId) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/items/${encodeURIComponent(itemId)}/`,
45592
+ },
45593
+ LIST_RUNS: {
45594
+ service: exports.SERVICES.AXD,
45595
+ path: (org, userId, datasetName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/runs/`,
45596
+ },
45597
+ START_RUN: {
45598
+ service: exports.SERVICES.AXD,
45599
+ path: (org, userId, datasetName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/runs/`,
45600
+ },
45601
+ GET_RUN: {
45602
+ service: exports.SERVICES.AXD,
45603
+ path: (org, userId, datasetName, runName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}/`,
45604
+ },
45605
+ EXPORT_RUN: {
45606
+ service: exports.SERVICES.AXD,
45607
+ path: (org, userId, datasetName, runName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}/export/`,
45608
+ },
45609
+ DELETE_RUN: {
45610
+ service: exports.SERVICES.AXD,
45611
+ path: (org, userId, datasetName, runName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}/`,
45612
+ },
45613
+ EVALUATE_RUN: {
45614
+ service: exports.SERVICES.AXD,
45615
+ path: (org, userId, datasetName, runName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}/evaluate/`,
45616
+ },
45617
+ LIST_RUN_JUDGES: {
45618
+ service: exports.SERVICES.AXD,
45619
+ path: (org, userId, datasetName, runName) => `${evaluationsBase(org, userId)}/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}/evaluate/`,
45620
+ },
45621
+ LIST_JUDGES: {
45622
+ service: exports.SERVICES.AXD,
45623
+ path: (org, userId) => `${evaluationsBase(org, userId)}/judges/`,
45624
+ },
45625
+ LIST_SCORES: {
45626
+ service: exports.SERVICES.AXD,
45627
+ path: (org, userId) => `${evaluationsBase(org, userId)}/scores/`,
45628
+ },
45629
+ CREATE_SCORE: {
45630
+ service: exports.SERVICES.AXD,
45631
+ path: (org, userId) => `${evaluationsBase(org, userId)}/scores/`,
45632
+ },
45633
+ DELETE_SCORE: {
45634
+ service: exports.SERVICES.AXD,
45635
+ path: (org, userId, scoreId) => `${evaluationsBase(org, userId)}/scores/${encodeURIComponent(scoreId)}/`,
45636
+ },
45637
+ LIST_SCORE_CONFIGS: {
45638
+ service: exports.SERVICES.AXD,
45639
+ path: (org, userId) => `${evaluationsBase(org, userId)}/score-configs/`,
45640
+ },
45641
+ CREATE_SCORE_CONFIG: {
45642
+ service: exports.SERVICES.AXD,
45643
+ path: (org, userId) => `${evaluationsBase(org, userId)}/score-configs/`,
45644
+ },
45645
+ };
45646
+ const EVALUATIONS_TAGS = {
45647
+ DATASETS: 'EVAL_DATASETS',
45648
+ DATASET: 'EVAL_DATASET',
45649
+ DATASET_ITEMS: 'EVAL_DATASET_ITEMS',
45650
+ RUNS: 'EVAL_RUNS',
45651
+ RUN: 'EVAL_RUN',
45652
+ SCORES: 'EVAL_SCORES',
45653
+ SCORE_CONFIGS: 'EVAL_SCORE_CONFIGS',
45654
+ JUDGES: 'EVAL_JUDGES',
45655
+ };
45656
+
45657
+ const evaluationsApiSlice = react.createApi({
45658
+ reducerPath: EVALUATIONS_REDUCER_PATH,
45659
+ baseQuery: iblFetchBaseQuery,
45660
+ tagTypes: [
45661
+ EVALUATIONS_TAGS.DATASETS,
45662
+ EVALUATIONS_TAGS.DATASET,
45663
+ EVALUATIONS_TAGS.DATASET_ITEMS,
45664
+ EVALUATIONS_TAGS.RUNS,
45665
+ EVALUATIONS_TAGS.RUN,
45666
+ EVALUATIONS_TAGS.SCORES,
45667
+ EVALUATIONS_TAGS.SCORE_CONFIGS,
45668
+ EVALUATIONS_TAGS.JUDGES,
45669
+ ],
45670
+ endpoints: (builder) => ({
45671
+ listEvalDatasets: builder.query({
45672
+ query: ({ org, userId, page, limit, name, user_email }) => ({
45673
+ url: EVALUATIONS_ENDPOINTS.LIST_DATASETS.path(org, userId),
45674
+ service: EVALUATIONS_ENDPOINTS.LIST_DATASETS.service,
45675
+ params: { page, limit, name, user_email },
45676
+ }),
45677
+ providesTags: [EVALUATIONS_TAGS.DATASETS],
45678
+ }),
45679
+ createEvalDataset: builder.mutation({
45680
+ query: ({ org, userId, body }) => ({
45681
+ url: EVALUATIONS_ENDPOINTS.CREATE_DATASET.path(org, userId),
45682
+ service: EVALUATIONS_ENDPOINTS.CREATE_DATASET.service,
45683
+ method: 'POST',
45684
+ body,
45685
+ }),
45686
+ invalidatesTags: [EVALUATIONS_TAGS.DATASETS],
45687
+ }),
45688
+ getEvalDataset: builder.query({
45689
+ query: ({ org, userId, datasetName }) => ({
45690
+ url: EVALUATIONS_ENDPOINTS.GET_DATASET.path(org, userId, datasetName),
45691
+ service: EVALUATIONS_ENDPOINTS.GET_DATASET.service,
45692
+ }),
45693
+ providesTags: (_result, _error, { datasetName }) => [
45694
+ { type: EVALUATIONS_TAGS.DATASET, id: datasetName },
45695
+ ],
45696
+ }),
45697
+ listEvalDatasetItems: builder.query({
45698
+ query: ({ org, userId, datasetName, page, limit, include_trace }) => ({
45699
+ url: EVALUATIONS_ENDPOINTS.LIST_DATASET_ITEMS.path(org, userId, datasetName),
45700
+ service: EVALUATIONS_ENDPOINTS.LIST_DATASET_ITEMS.service,
45701
+ params: { page, limit, include_trace },
45702
+ }),
45703
+ providesTags: (_result, _error, { datasetName }) => [
45704
+ { type: EVALUATIONS_TAGS.DATASET_ITEMS, id: datasetName },
45705
+ ],
45706
+ }),
45707
+ addEvalDatasetItems: builder.mutation({
45708
+ query: ({ org, userId, datasetName, body }) => ({
45709
+ url: EVALUATIONS_ENDPOINTS.ADD_DATASET_ITEMS.path(org, userId, datasetName),
45710
+ service: EVALUATIONS_ENDPOINTS.ADD_DATASET_ITEMS.service,
45711
+ method: 'POST',
45712
+ body,
45713
+ }),
45714
+ invalidatesTags: (_result, _error, { datasetName }) => [
45715
+ { type: EVALUATIONS_TAGS.DATASET_ITEMS, id: datasetName },
45716
+ ],
45717
+ }),
45718
+ uploadEvalDatasetCsv: builder.mutation({
45719
+ query: ({ org, userId, datasetName, formData }) => ({
45720
+ url: EVALUATIONS_ENDPOINTS.UPLOAD_DATASET_CSV.path(org, userId, datasetName),
45721
+ service: EVALUATIONS_ENDPOINTS.UPLOAD_DATASET_CSV.service,
45722
+ method: 'POST',
45723
+ body: formData,
45724
+ isJson: false,
45725
+ }),
45726
+ invalidatesTags: (_result, _error, { datasetName }) => [
45727
+ { type: EVALUATIONS_TAGS.DATASET_ITEMS, id: datasetName },
45728
+ ],
45729
+ }),
45730
+ updateEvalDatasetItem: builder.mutation({
45731
+ query: ({ org, userId, datasetName, itemId, body }) => ({
45732
+ url: EVALUATIONS_ENDPOINTS.UPDATE_DATASET_ITEM.path(org, userId, datasetName, itemId),
45733
+ service: EVALUATIONS_ENDPOINTS.UPDATE_DATASET_ITEM.service,
45734
+ method: 'PUT',
45735
+ body,
45736
+ }),
45737
+ invalidatesTags: (_result, _error, { datasetName }) => [
45738
+ { type: EVALUATIONS_TAGS.DATASET_ITEMS, id: datasetName },
45739
+ ],
45740
+ }),
45741
+ deleteEvalDatasetItem: builder.mutation({
45742
+ query: ({ org, userId, datasetName, itemId }) => ({
45743
+ url: EVALUATIONS_ENDPOINTS.DELETE_DATASET_ITEM.path(org, userId, datasetName, itemId),
45744
+ service: EVALUATIONS_ENDPOINTS.DELETE_DATASET_ITEM.service,
45745
+ method: 'DELETE',
45746
+ }),
45747
+ invalidatesTags: (_result, _error, { datasetName }) => [
45748
+ { type: EVALUATIONS_TAGS.DATASET_ITEMS, id: datasetName },
45749
+ ],
45750
+ }),
45751
+ listEvalRuns: builder.query({
45752
+ query: ({ org, userId, datasetName, page, limit, user_email }) => ({
45753
+ url: EVALUATIONS_ENDPOINTS.LIST_RUNS.path(org, userId, datasetName),
45754
+ service: EVALUATIONS_ENDPOINTS.LIST_RUNS.service,
45755
+ params: { page, limit, user_email },
45756
+ }),
45757
+ providesTags: (_result, _error, { datasetName }) => [
45758
+ { type: EVALUATIONS_TAGS.RUNS, id: datasetName },
45759
+ ],
45760
+ }),
45761
+ startEvalRun: builder.mutation({
45762
+ query: ({ org, userId, datasetName, body }) => ({
45763
+ url: EVALUATIONS_ENDPOINTS.START_RUN.path(org, userId, datasetName),
45764
+ service: EVALUATIONS_ENDPOINTS.START_RUN.service,
45765
+ method: 'POST',
45766
+ body,
45767
+ }),
45768
+ invalidatesTags: (_result, _error, { datasetName }) => [
45769
+ { type: EVALUATIONS_TAGS.RUNS, id: datasetName },
45770
+ ],
45771
+ }),
45772
+ getEvalRun: builder.query({
45773
+ query: ({ org, userId, datasetName, runName }) => ({
45774
+ url: EVALUATIONS_ENDPOINTS.GET_RUN.path(org, userId, datasetName, runName),
45775
+ service: EVALUATIONS_ENDPOINTS.GET_RUN.service,
45776
+ }),
45777
+ providesTags: (_result, _error, { runName }) => [{ type: EVALUATIONS_TAGS.RUN, id: runName }],
45778
+ }),
45779
+ deleteEvalRun: builder.mutation({
45780
+ query: ({ org, userId, datasetName, runName }) => ({
45781
+ url: EVALUATIONS_ENDPOINTS.DELETE_RUN.path(org, userId, datasetName, runName),
45782
+ service: EVALUATIONS_ENDPOINTS.DELETE_RUN.service,
45783
+ method: 'DELETE',
45784
+ }),
45785
+ invalidatesTags: (_result, _error, { datasetName }) => [
45786
+ { type: EVALUATIONS_TAGS.RUNS, id: datasetName },
45787
+ ],
45788
+ }),
45789
+ exportEvalRun: builder.mutation({
45790
+ query: ({ org, userId, datasetName, runName }) => ({
45791
+ url: EVALUATIONS_ENDPOINTS.EXPORT_RUN.path(org, userId, datasetName, runName),
45792
+ service: EVALUATIONS_ENDPOINTS.EXPORT_RUN.service,
45793
+ responseHandler: (response) => response.text(),
45794
+ isJson: false,
45795
+ }),
45796
+ }),
45797
+ evaluateEvalRun: builder.mutation({
45798
+ query: ({ org, userId, datasetName, runName, body }) => ({
45799
+ url: EVALUATIONS_ENDPOINTS.EVALUATE_RUN.path(org, userId, datasetName, runName),
45800
+ service: EVALUATIONS_ENDPOINTS.EVALUATE_RUN.service,
45801
+ method: 'POST',
45802
+ body,
45803
+ }),
45804
+ invalidatesTags: (_result, _error, { runName }) => [
45805
+ { type: EVALUATIONS_TAGS.RUN, id: runName },
45806
+ EVALUATIONS_TAGS.JUDGES,
45807
+ ],
45808
+ }),
45809
+ listEvalRunJudges: builder.query({
45810
+ query: ({ org, userId, datasetName, runName, page, limit, status, user_email }) => ({
45811
+ url: EVALUATIONS_ENDPOINTS.LIST_RUN_JUDGES.path(org, userId, datasetName, runName),
45812
+ service: EVALUATIONS_ENDPOINTS.LIST_RUN_JUDGES.service,
45813
+ params: { page, limit, status, user_email },
45814
+ }),
45815
+ providesTags: [EVALUATIONS_TAGS.JUDGES],
45816
+ }),
45817
+ listEvalJudges: builder.query({
45818
+ query: ({ org, userId, page, limit, status, user_email, dataset_name }) => ({
45819
+ url: EVALUATIONS_ENDPOINTS.LIST_JUDGES.path(org, userId),
45820
+ service: EVALUATIONS_ENDPOINTS.LIST_JUDGES.service,
45821
+ params: { page, limit, status, user_email, dataset_name },
45822
+ }),
45823
+ providesTags: [EVALUATIONS_TAGS.JUDGES],
45824
+ }),
45825
+ listEvalScores: builder.query({
45826
+ query: ({ org, userId, page, limit, dataset_run_id, trace_id, name }) => ({
45827
+ url: EVALUATIONS_ENDPOINTS.LIST_SCORES.path(org, userId),
45828
+ service: EVALUATIONS_ENDPOINTS.LIST_SCORES.service,
45829
+ params: { page, limit, dataset_run_id, trace_id, name },
45830
+ }),
45831
+ providesTags: [EVALUATIONS_TAGS.SCORES],
45832
+ }),
45833
+ // Score create/delete deliberately do NOT invalidate the RUN tag: the
45834
+ // eval store ingests score writes asynchronously, so an immediate
45835
+ // refetch returns the run *without* the change and would clobber the
45836
+ // cache patches below. The run still refreshes on reopen / manual
45837
+ // Refresh, by which point the store has caught up.
45838
+ createEvalScore: builder.mutation({
45839
+ query: ({ org, userId, body }) => ({
45840
+ url: EVALUATIONS_ENDPOINTS.CREATE_SCORE.path(org, userId),
45841
+ service: EVALUATIONS_ENDPOINTS.CREATE_SCORE.service,
45842
+ method: 'POST',
45843
+ body,
45844
+ }),
45845
+ invalidatesTags: [EVALUATIONS_TAGS.SCORES],
45846
+ async onQueryStarted({ org, userId, body, datasetName, runName }, { dispatch, queryFulfilled }) {
45847
+ try {
45848
+ await queryFulfilled;
45849
+ }
45850
+ catch (_a) {
45851
+ return;
45852
+ }
45853
+ if (!datasetName || !runName)
45854
+ return;
45855
+ dispatch(evaluationsApiSlice.util.updateQueryData('getEvalRun', { org, userId, datasetName, runName }, (draft) => {
45856
+ var _a, _b, _c, _d, _e, _f;
45857
+ const item = (_a = draft.dataset_run_items) === null || _a === void 0 ? void 0 : _a.find((i) => i.trace_id === body.trace_id);
45858
+ if (!item)
45859
+ return;
45860
+ item.scores = (_b = item.scores) !== null && _b !== void 0 ? _b : [];
45861
+ item.scores.push({
45862
+ // The create endpoint returns no id (the write is queued);
45863
+ // this placeholder is replaced by the real record on the
45864
+ // next refetch once the store has ingested it.
45865
+ id: `pending-${body.trace_id}-${body.name}-${Date.now()}`,
45866
+ name: body.name,
45867
+ value: body.value,
45868
+ string_value: null,
45869
+ data_type: (_c = body.data_type) !== null && _c !== void 0 ? _c : 'NUMERIC',
45870
+ comment: (_d = body.comment) !== null && _d !== void 0 ? _d : null,
45871
+ trace_id: body.trace_id,
45872
+ observation_id: (_e = body.observation_id) !== null && _e !== void 0 ? _e : null,
45873
+ dataset_run_id: (_f = body.dataset_run_id) !== null && _f !== void 0 ? _f : null,
45874
+ created_at: new Date().toISOString(),
45875
+ });
45876
+ }));
45877
+ },
45878
+ }),
45879
+ deleteEvalScore: builder.mutation({
45880
+ query: ({ org, userId, scoreId }) => ({
45881
+ url: EVALUATIONS_ENDPOINTS.DELETE_SCORE.path(org, userId, scoreId),
45882
+ service: EVALUATIONS_ENDPOINTS.DELETE_SCORE.service,
45883
+ method: 'DELETE',
45884
+ }),
45885
+ invalidatesTags: [EVALUATIONS_TAGS.SCORES],
45886
+ async onQueryStarted({ org, userId, scoreId, datasetName, runName }, { dispatch, queryFulfilled }) {
45887
+ try {
45888
+ await queryFulfilled;
45889
+ }
45890
+ catch (_a) {
45891
+ return;
45892
+ }
45893
+ if (!datasetName || !runName)
45894
+ return;
45895
+ dispatch(evaluationsApiSlice.util.updateQueryData('getEvalRun', { org, userId, datasetName, runName }, (draft) => {
45896
+ var _a, _b;
45897
+ for (const item of (_a = draft.dataset_run_items) !== null && _a !== void 0 ? _a : []) {
45898
+ if ((_b = item.scores) === null || _b === void 0 ? void 0 : _b.some((s) => s.id === scoreId)) {
45899
+ item.scores = item.scores.filter((s) => s.id !== scoreId);
45900
+ }
45901
+ }
45902
+ }));
45903
+ },
45904
+ }),
45905
+ listEvalScoreConfigs: builder.query({
45906
+ query: ({ org, userId, page, limit }) => ({
45907
+ url: EVALUATIONS_ENDPOINTS.LIST_SCORE_CONFIGS.path(org, userId),
45908
+ service: EVALUATIONS_ENDPOINTS.LIST_SCORE_CONFIGS.service,
45909
+ params: { page, limit },
45910
+ }),
45911
+ providesTags: [EVALUATIONS_TAGS.SCORE_CONFIGS],
45912
+ }),
45913
+ getEvalTaskStatus: builder.query({
45914
+ query: ({ org, userId, taskId }) => ({
45915
+ url: EVALUATIONS_ENDPOINTS.GET_TASK.path(org, userId, taskId),
45916
+ service: EVALUATIONS_ENDPOINTS.GET_TASK.service,
45917
+ }),
45918
+ }),
45919
+ createEvalScoreConfig: builder.mutation({
45920
+ query: ({ org, userId, body }) => ({
45921
+ url: EVALUATIONS_ENDPOINTS.CREATE_SCORE_CONFIG.path(org, userId),
45922
+ service: EVALUATIONS_ENDPOINTS.CREATE_SCORE_CONFIG.service,
45923
+ method: 'POST',
45924
+ body,
45925
+ }),
45926
+ invalidatesTags: [EVALUATIONS_TAGS.SCORE_CONFIGS],
45927
+ }),
45928
+ }),
45929
+ });
45930
+ const { useListEvalDatasetsQuery, useLazyListEvalDatasetsQuery, useCreateEvalDatasetMutation, useGetEvalDatasetQuery, useListEvalDatasetItemsQuery, useLazyListEvalDatasetItemsQuery, useAddEvalDatasetItemsMutation, useUploadEvalDatasetCsvMutation, useUpdateEvalDatasetItemMutation, useDeleteEvalDatasetItemMutation, useListEvalRunsQuery, useLazyListEvalRunsQuery, useStartEvalRunMutation, useGetEvalRunQuery, useLazyGetEvalRunQuery, useDeleteEvalRunMutation, useExportEvalRunMutation, useEvaluateEvalRunMutation, useListEvalRunJudgesQuery, useLazyListEvalRunJudgesQuery, useListEvalJudgesQuery, useLazyListEvalJudgesQuery, useListEvalScoresQuery, useLazyListEvalScoresQuery, useCreateEvalScoreMutation, useDeleteEvalScoreMutation, useListEvalScoreConfigsQuery, useCreateEvalScoreConfigMutation, useGetEvalTaskStatusQuery, useLazyGetEvalTaskStatusQuery, } = evaluationsApiSlice;
45931
+
45932
+ /** Total page count derived from `count` and the requested page size. */
45933
+ function evalTotalPages(count, limit) {
45934
+ if (!count || count <= 0)
45935
+ return 0;
45936
+ return Math.ceil(count / limit);
45937
+ }
45938
+
45477
45939
  const WATCHED_GROUPS_REDUCER_PATH = 'watchedGroupsApiSlice';
45478
45940
  const WATCHED_GROUPS_QUERY_KEYS = {
45479
45941
  WATCHED_GROUPS: 'WATCHED_GROUPS',
@@ -45786,6 +46248,7 @@ const mentorReducer = {
45786
46248
  [courseMetadataApiSlice.reducerPath]: courseMetadataApiSlice.reducer,
45787
46249
  [edxSsoApiSlice.reducerPath]: edxSsoApiSlice.reducer,
45788
46250
  [clawApiSlice.reducerPath]: clawApiSlice.reducer,
46251
+ [evaluationsApiSlice.reducerPath]: evaluationsApiSlice.reducer,
45789
46252
  [watchedGroupsApiSlice.reducerPath]: watchedGroupsApiSlice.reducer,
45790
46253
  [chatPrivacyApiSlice.reducerPath]: chatPrivacyApiSlice.reducer,
45791
46254
  [skillsApiSlice.reducerPath]: skillsApiSlice.reducer,
@@ -45842,6 +46305,7 @@ const mentorMiddleware = [
45842
46305
  courseMetadataApiSlice.middleware,
45843
46306
  edxSsoApiSlice.middleware,
45844
46307
  clawApiSlice.middleware,
46308
+ evaluationsApiSlice.middleware,
45845
46309
  watchedGroupsApiSlice.middleware,
45846
46310
  chatPrivacyApiSlice.middleware,
45847
46311
  skillsApiSlice.middleware,
@@ -45970,6 +46434,9 @@ exports.DISCLAIMERS_ENDPOINTS = DISCLAIMERS_ENDPOINTS;
45970
46434
  exports.DISCLAIMERS_QUERY_KEYS = DISCLAIMERS_QUERY_KEYS;
45971
46435
  exports.DISCLAIMERS_REDUCER_PATH = DISCLAIMERS_REDUCER_PATH;
45972
46436
  exports.EDX_PROCTORING_ENDPOINTS = EDX_PROCTORING_ENDPOINTS;
46437
+ exports.EVALUATIONS_ENDPOINTS = EVALUATIONS_ENDPOINTS;
46438
+ exports.EVALUATIONS_REDUCER_PATH = EVALUATIONS_REDUCER_PATH;
46439
+ exports.EVALUATIONS_TAGS = EVALUATIONS_TAGS;
45973
46440
  exports.IblDataLayer = IblDataLayer;
45974
46441
  exports.LOGO_ENDPOINTS = LOGO_ENDPOINTS;
45975
46442
  exports.MCP_ENDPOINTS = MCP_ENDPOINTS;
@@ -46051,6 +46518,8 @@ exports.datasetsApiSlice = datasetsApiSlice;
46051
46518
  exports.disclaimersApiSlice = disclaimersApiSlice;
46052
46519
  exports.edxProctoringApiSlice = edxProctoringApiSlice;
46053
46520
  exports.edxSsoApiSlice = edxSsoApiSlice;
46521
+ exports.evalTotalPages = evalTotalPages;
46522
+ exports.evaluationsApiSlice = evaluationsApiSlice;
46054
46523
  exports.fakeBaseQueryWithLogging = fakeBaseQueryWithLogging;
46055
46524
  exports.featureTags = featureTags;
46056
46525
  exports.getNextRecentMessagesPageParam = getNextRecentMessagesPageParam;
@@ -46093,6 +46562,7 @@ exports.tenantLogoApiSlice = tenantLogoApiSlice;
46093
46562
  exports.toolsApiSlice = toolsApiSlice;
46094
46563
  exports.trainingDocumentsApiSlice = trainingDocumentsApiSlice;
46095
46564
  exports.useActivateWorkflowMutation = useActivateWorkflowMutation;
46565
+ exports.useAddEvalDatasetItemsMutation = useAddEvalDatasetItemsMutation;
46096
46566
  exports.useAddPinnedMessageMutation = useAddPinnedMessageMutation;
46097
46567
  exports.useAddTrainingDocumentMutation = useAddTrainingDocumentMutation;
46098
46568
  exports.useAddWatchedUserMutation = useAddWatchedUserMutation;
@@ -46129,6 +46599,9 @@ exports.useCreateCredentialAssertionMutation = useCreateCredentialAssertionMutat
46129
46599
  exports.useCreateCredentialMutation = useCreateCredentialMutation;
46130
46600
  exports.useCreateCustomDomainMutation = useCreateCustomDomainMutation;
46131
46601
  exports.useCreateDisclaimerMutation = useCreateDisclaimerMutation;
46602
+ exports.useCreateEvalDatasetMutation = useCreateEvalDatasetMutation;
46603
+ exports.useCreateEvalScoreConfigMutation = useCreateEvalScoreConfigMutation;
46604
+ exports.useCreateEvalScoreMutation = useCreateEvalScoreMutation;
46132
46605
  exports.useCreateExternalMappingMutation = useCreateExternalMappingMutation;
46133
46606
  exports.useCreateGlobalMemoryMutation = useCreateGlobalMemoryMutation;
46134
46607
  exports.useCreateGuestCheckoutMutation = useCreateGuestCheckoutMutation;
@@ -46184,6 +46657,9 @@ exports.useDeleteCourseCredentialMutation = useDeleteCourseCredentialMutation;
46184
46657
  exports.useDeleteCredentialMutation = useDeleteCredentialMutation;
46185
46658
  exports.useDeleteCustomDomainMutation = useDeleteCustomDomainMutation;
46186
46659
  exports.useDeleteDisclaimerMutation = useDeleteDisclaimerMutation;
46660
+ exports.useDeleteEvalDatasetItemMutation = useDeleteEvalDatasetItemMutation;
46661
+ exports.useDeleteEvalRunMutation = useDeleteEvalRunMutation;
46662
+ exports.useDeleteEvalScoreMutation = useDeleteEvalScoreMutation;
46187
46663
  exports.useDeleteExternalMappingMutation = useDeleteExternalMappingMutation;
46188
46664
  exports.useDeleteGlobalMemoryMutation = useDeleteGlobalMemoryMutation;
46189
46665
  exports.useDeleteIntegrationCredentialMutation = useDeleteIntegrationCredentialMutation;
@@ -46223,8 +46699,10 @@ exports.useEditMentorMutation = useEditMentorMutation;
46223
46699
  exports.useEditSessionMutation = useEditSessionMutation;
46224
46700
  exports.useEditTrainingDocumentMutation = useEditTrainingDocumentMutation;
46225
46701
  exports.useEnablePaywallMutation = useEnablePaywallMutation;
46702
+ exports.useEvaluateEvalRunMutation = useEvaluateEvalRunMutation;
46226
46703
  exports.useExchangeAppleTokenMutation = useExchangeAppleTokenMutation;
46227
46704
  exports.useExportChatHistoryMutation = useExportChatHistoryMutation;
46705
+ exports.useExportEvalRunMutation = useExportEvalRunMutation;
46228
46706
  exports.useForkMentorMutation = useForkMentorMutation;
46229
46707
  exports.useGetAccessTimeHeatmapQuery = useGetAccessTimeHeatmapQuery;
46230
46708
  exports.useGetAccountBillingInfoQuery = useGetAccountBillingInfoQuery;
@@ -46281,6 +46759,9 @@ exports.useGetDetailedFinancialStatsQuery = useGetDetailedFinancialStatsQuery;
46281
46759
  exports.useGetDisclaimersQuery = useGetDisclaimersQuery;
46282
46760
  exports.useGetEdxSSOTokenQuery = useGetEdxSSOTokenQuery;
46283
46761
  exports.useGetEnrollmentCourseSearchQuery = useGetEnrollmentCourseSearchQuery;
46762
+ exports.useGetEvalDatasetQuery = useGetEvalDatasetQuery;
46763
+ exports.useGetEvalRunQuery = useGetEvalRunQuery;
46764
+ exports.useGetEvalTaskStatusQuery = useGetEvalTaskStatusQuery;
46284
46765
  exports.useGetExamInfoQuery = useGetExamInfoQuery;
46285
46766
  exports.useGetExternalMappingQuery = useGetExternalMappingQuery;
46286
46767
  exports.useGetFileUploadUrlMutation = useGetFileUploadUrlMutation;
@@ -46366,6 +46847,8 @@ exports.useGetRbacMentorAccessListQuery = useGetRbacMentorAccessListQuery;
46366
46847
  exports.useGetRbacPermissionsMutation = useGetRbacPermissionsMutation;
46367
46848
  exports.useGetRbacPoliciesQuery = useGetRbacPoliciesQuery;
46368
46849
  exports.useGetRbacPolicyDetailsQuery = useGetRbacPolicyDetailsQuery;
46850
+ exports.useGetRbacResourceDiscoveryQuery = useGetRbacResourceDiscoveryQuery;
46851
+ exports.useGetRbacResourceListQuery = useGetRbacResourceListQuery;
46369
46852
  exports.useGetRbacRoleDetailsQuery = useGetRbacRoleDetailsQuery;
46370
46853
  exports.useGetRbacRolesQuery = useGetRbacRolesQuery;
46371
46854
  exports.useGetRbacTeamsAccessListQuery = useGetRbacTeamsAccessListQuery;
@@ -46500,6 +46983,8 @@ exports.useLazyGetDisclaimersQuery = useLazyGetDisclaimersQuery;
46500
46983
  exports.useLazyGetDownloadReportFromURLQuery = useLazyGetDownloadReportFromURLQuery;
46501
46984
  exports.useLazyGetEdxSSOTokenQuery = useLazyGetEdxSSOTokenQuery;
46502
46985
  exports.useLazyGetEnrollmentCourseSearchQuery = useLazyGetEnrollmentCourseSearchQuery;
46986
+ exports.useLazyGetEvalRunQuery = useLazyGetEvalRunQuery;
46987
+ exports.useLazyGetEvalTaskStatusQuery = useLazyGetEvalTaskStatusQuery;
46503
46988
  exports.useLazyGetExamInfoQuery = useLazyGetExamInfoQuery;
46504
46989
  exports.useLazyGetExternalMappingQuery = useLazyGetExternalMappingQuery;
46505
46990
  exports.useLazyGetFreeUsageCountQuery = useLazyGetFreeUsageCountQuery;
@@ -46560,6 +47045,8 @@ exports.useLazyGetPublicPlatformImageAssetFileUrlQuery = useLazyGetPublicPlatfor
46560
47045
  exports.useLazyGetPublicPlatformMembershipQuery = useLazyGetPublicPlatformMembershipQuery;
46561
47046
  exports.useLazyGetPublicPricingQuery = useLazyGetPublicPricingQuery;
46562
47047
  exports.useLazyGetRbacActionsDefinitionQuery = useLazyGetRbacActionsDefinitionQuery;
47048
+ exports.useLazyGetRbacResourceDiscoveryQuery = useLazyGetRbacResourceDiscoveryQuery;
47049
+ exports.useLazyGetRbacResourceListQuery = useLazyGetRbacResourceListQuery;
46563
47050
  exports.useLazyGetRbacRolesQuery = useLazyGetRbacRolesQuery;
46564
47051
  exports.useLazyGetRbacTeamsAccessListQuery = useLazyGetRbacTeamsAccessListQuery;
46565
47052
  exports.useLazyGetRecentMessageQuery = useLazyGetRecentMessageQuery;
@@ -46625,6 +47112,12 @@ exports.useLazyGetWorkflowQuery = useLazyGetWorkflowQuery;
46625
47112
  exports.useLazyGetWorkflowsQuery = useLazyGetWorkflowsQuery;
46626
47113
  exports.useLazyListArtifactVersionsQuery = useLazyListArtifactVersionsQuery;
46627
47114
  exports.useLazyListArtifactsQuery = useLazyListArtifactsQuery;
47115
+ exports.useLazyListEvalDatasetItemsQuery = useLazyListEvalDatasetItemsQuery;
47116
+ exports.useLazyListEvalDatasetsQuery = useLazyListEvalDatasetsQuery;
47117
+ exports.useLazyListEvalJudgesQuery = useLazyListEvalJudgesQuery;
47118
+ exports.useLazyListEvalRunJudgesQuery = useLazyListEvalRunJudgesQuery;
47119
+ exports.useLazyListEvalRunsQuery = useLazyListEvalRunsQuery;
47120
+ exports.useLazyListEvalScoresQuery = useLazyListEvalScoresQuery;
46628
47121
  exports.useLazyListItemSubscribersQuery = useLazyListItemSubscribersQuery;
46629
47122
  exports.useLazyListPaywallsQuery = useLazyListPaywallsQuery;
46630
47123
  exports.useLazyListPricesQuery = useLazyListPricesQuery;
@@ -46637,6 +47130,13 @@ exports.useLazyStarredMentorsQuery = useLazyStarredMentorsQuery;
46637
47130
  exports.useLazyStartOAuthFlowQuery = useLazyStartOAuthFlowQuery;
46638
47131
  exports.useListArtifactVersionsQuery = useListArtifactVersionsQuery;
46639
47132
  exports.useListArtifactsQuery = useListArtifactsQuery;
47133
+ exports.useListEvalDatasetItemsQuery = useListEvalDatasetItemsQuery;
47134
+ exports.useListEvalDatasetsQuery = useListEvalDatasetsQuery;
47135
+ exports.useListEvalJudgesQuery = useListEvalJudgesQuery;
47136
+ exports.useListEvalRunJudgesQuery = useListEvalRunJudgesQuery;
47137
+ exports.useListEvalRunsQuery = useListEvalRunsQuery;
47138
+ exports.useListEvalScoreConfigsQuery = useListEvalScoreConfigsQuery;
47139
+ exports.useListEvalScoresQuery = useListEvalScoresQuery;
46640
47140
  exports.useListItemSubscribersQuery = useListItemSubscribersQuery;
46641
47141
  exports.useListPaywallsQuery = useListPaywallsQuery;
46642
47142
  exports.useListPricesQuery = useListPricesQuery;
@@ -46667,6 +47167,7 @@ exports.useSetPlatformConfigurationsMutation = useSetPlatformConfigurationsMutat
46667
47167
  exports.useSetStudentMentorCreationStatusMutation = useSetStudentMentorCreationStatusMutation;
46668
47168
  exports.useStarMentorMutation = useStarMentorMutation;
46669
47169
  exports.useStarredMentorsQuery = useStarredMentorsQuery;
47170
+ exports.useStartEvalRunMutation = useStartEvalRunMutation;
46670
47171
  exports.useStartExamMutation = useStartExamMutation;
46671
47172
  exports.useStartStripeConnectOnboardingMutation = useStartStripeConnectOnboardingMutation;
46672
47173
  exports.useTestConnectivityClawInstanceMutation = useTestConnectivityClawInstanceMutation;
@@ -46689,6 +47190,7 @@ exports.useUpdateClawInstanceMutation = useUpdateClawInstanceMutation;
46689
47190
  exports.useUpdateClawMentorConfigMutation = useUpdateClawMentorConfigMutation;
46690
47191
  exports.useUpdateCredentialMutation = useUpdateCredentialMutation;
46691
47192
  exports.useUpdateDisclaimerMutation = useUpdateDisclaimerMutation;
47193
+ exports.useUpdateEvalDatasetItemMutation = useUpdateEvalDatasetItemMutation;
46692
47194
  exports.useUpdateExamAttemptMutation = useUpdateExamAttemptMutation;
46693
47195
  exports.useUpdateIntegrationCredentialMutation = useUpdateIntegrationCredentialMutation;
46694
47196
  exports.useUpdateLtiKeyMutation = useUpdateLtiKeyMutation;
@@ -46737,6 +47239,7 @@ exports.useUpdateWatcherMutation = useUpdateWatcherMutation;
46737
47239
  exports.useUpdateWorkflowMutation = useUpdateWorkflowMutation;
46738
47240
  exports.useUploadCredentialImageMutation = useUploadCredentialImageMutation;
46739
47241
  exports.useUploadDarkLogoMutation = useUploadDarkLogoMutation;
47242
+ exports.useUploadEvalDatasetCsvMutation = useUploadEvalDatasetCsvMutation;
46740
47243
  exports.useUploadLightLogoMutation = useUploadLightLogoMutation;
46741
47244
  exports.useUploadProfileImageMutation = useUploadProfileImageMutation;
46742
47245
  exports.useUsersGradesPassedQuery = useUsersGradesPassedQuery;