@iblai/data-layer 1.12.3 → 1.12.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.d.ts +643 -41
- package/dist/index.esm.js +125 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +132 -4
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/agent-skills/api-slice.d.ts +304 -40
- package/dist/src/features/agent-skills/constants.d.ts +2 -0
- package/dist/src/features/audit-logs/__tests__/api-slice.test.d.ts +1 -0
- package/dist/src/features/audit-logs/__tests__/types.test.d.ts +1 -0
- package/dist/src/features/audit-logs/api-slice.d.ts +265 -1
- package/dist/src/features/audit-logs/constants.d.ts +5 -0
- package/dist/src/features/audit-logs/types.d.ts +63 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45179,6 +45179,8 @@ useGetClawInstancesQuery, useLazyGetClawInstancesQuery, useGetClawInstanceQuery,
|
|
|
45179
45179
|
useGetAgentConfigQuery, useLazyGetAgentConfigQuery, useUpdateAgentConfigMutation, } = clawApiSlice;
|
|
45180
45180
|
|
|
45181
45181
|
const AGENT_SKILLS_REDUCER_PATH = 'agentSkillsApiSlice';
|
|
45182
|
+
/** Default page size for the chat `/` picker's lazy-loaded skills list. */
|
|
45183
|
+
const MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE = 20;
|
|
45182
45184
|
const AGENT_SKILLS_TAG_TYPES = [
|
|
45183
45185
|
'AgentSkills',
|
|
45184
45186
|
'AgentSkillResources',
|
|
@@ -45265,6 +45267,8 @@ const agentSkillsApiSlice = react.createApi({
|
|
|
45265
45267
|
tagTypes: [...AGENT_SKILLS_TAG_TYPES],
|
|
45266
45268
|
endpoints: (builder) => ({
|
|
45267
45269
|
// ── Agent Skills (platform-level) ─────────────────────────────────────
|
|
45270
|
+
// Returns the paginated envelope so list UIs can page on `count`;
|
|
45271
|
+
// bare-array responses are normalized into a single-page envelope.
|
|
45268
45272
|
getAgentSkills: builder.query({
|
|
45269
45273
|
query: (args) => ({
|
|
45270
45274
|
url: AGENT_SKILLS_ENDPOINTS.GET_AGENT_SKILLS.path(args.org),
|
|
@@ -45276,7 +45280,9 @@ const agentSkillsApiSlice = react.createApi({
|
|
|
45276
45280
|
...(args.offset !== undefined && { offset: args.offset }),
|
|
45277
45281
|
},
|
|
45278
45282
|
}),
|
|
45279
|
-
transformResponse: (response) =>
|
|
45283
|
+
transformResponse: (response) => Array.isArray(response)
|
|
45284
|
+
? { count: response.length, next: null, previous: null, results: response }
|
|
45285
|
+
: response,
|
|
45280
45286
|
providesTags: ['AgentSkills'],
|
|
45281
45287
|
}),
|
|
45282
45288
|
getAgentSkill: builder.query({
|
|
@@ -45441,6 +45447,41 @@ const agentSkillsApiSlice = react.createApi({
|
|
|
45441
45447
|
{ type: 'MentorSkillAssignments', id: args.mentorUniqueId },
|
|
45442
45448
|
],
|
|
45443
45449
|
}),
|
|
45450
|
+
// Same resource as getMentorSkillAssignments, but cached as ONE growing
|
|
45451
|
+
// entry per (org, mentor) for lazy loading (chat `/` picker): increasing
|
|
45452
|
+
// `offset` appends deduped rows; `offset: 0` (or an invalidation refetch)
|
|
45453
|
+
// replaces the list.
|
|
45454
|
+
getMentorSkillAssignmentsInfinite: builder.query({
|
|
45455
|
+
query: (args) => {
|
|
45456
|
+
var _a, _b;
|
|
45457
|
+
return ({
|
|
45458
|
+
url: AGENT_SKILLS_ENDPOINTS.GET_MENTOR_SKILL_ASSIGNMENTS.path(args.org, args.mentorUniqueId),
|
|
45459
|
+
service: AGENT_SKILLS_ENDPOINTS.GET_MENTOR_SKILL_ASSIGNMENTS.service,
|
|
45460
|
+
params: {
|
|
45461
|
+
...(args.enabled !== undefined && { enabled: args.enabled }),
|
|
45462
|
+
limit: (_a = args.limit) !== null && _a !== void 0 ? _a : MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE,
|
|
45463
|
+
offset: (_b = args.offset) !== null && _b !== void 0 ? _b : 0,
|
|
45464
|
+
},
|
|
45465
|
+
});
|
|
45466
|
+
},
|
|
45467
|
+
transformResponse: (response) => Array.isArray(response)
|
|
45468
|
+
? { count: response.length, next: null, previous: null, results: response }
|
|
45469
|
+
: response,
|
|
45470
|
+
serializeQueryArgs: ({ queryArgs, endpointName }) => `${endpointName}(${queryArgs.org}:${queryArgs.mentorUniqueId})`,
|
|
45471
|
+
merge: (currentCache, newData, { arg }) => {
|
|
45472
|
+
if (!arg.offset)
|
|
45473
|
+
return newData;
|
|
45474
|
+
const seen = new Set(currentCache.results.map((row) => row.id));
|
|
45475
|
+
currentCache.count = newData.count;
|
|
45476
|
+
currentCache.next = newData.next;
|
|
45477
|
+
currentCache.previous = newData.previous;
|
|
45478
|
+
currentCache.results.push(...newData.results.filter((row) => !seen.has(row.id)));
|
|
45479
|
+
},
|
|
45480
|
+
forceRefetch: ({ currentArg, previousArg }) => (currentArg === null || currentArg === void 0 ? void 0 : currentArg.offset) !== (previousArg === null || previousArg === void 0 ? void 0 : previousArg.offset) || (currentArg === null || currentArg === void 0 ? void 0 : currentArg.limit) !== (previousArg === null || previousArg === void 0 ? void 0 : previousArg.limit),
|
|
45481
|
+
providesTags: (_result, _error, args) => [
|
|
45482
|
+
{ type: 'MentorSkillAssignments', id: args.mentorUniqueId },
|
|
45483
|
+
],
|
|
45484
|
+
}),
|
|
45444
45485
|
getMentorSkillAssignment: builder.query({
|
|
45445
45486
|
query: (args) => ({
|
|
45446
45487
|
url: AGENT_SKILLS_ENDPOINTS.GET_MENTOR_SKILL_ASSIGNMENT.path(args.org, args.mentorUniqueId, args.assignmentPk),
|
|
@@ -45495,7 +45536,7 @@ useGetAgentSkillsQuery, useLazyGetAgentSkillsQuery, useGetAgentSkillQuery, useCr
|
|
|
45495
45536
|
// Agent Skill Resources
|
|
45496
45537
|
useGetAgentSkillResourcesQuery, useLazyGetAgentSkillResourcesQuery, useGetAgentSkillResourceQuery, useCreateAgentSkillResourceMutation, useUpdateAgentSkillResourceMutation, useUploadAgentSkillResourceAssetMutation, useDeleteAgentSkillResourceMutation,
|
|
45497
45538
|
// Mentor Skill Assignments
|
|
45498
|
-
useGetMentorSkillAssignmentsQuery, useLazyGetMentorSkillAssignmentsQuery, useGetMentorSkillAssignmentQuery, useCreateMentorSkillAssignmentMutation, useUpdateMentorSkillAssignmentMutation, useDeleteMentorSkillAssignmentMutation, } = agentSkillsApiSlice;
|
|
45539
|
+
useGetMentorSkillAssignmentsQuery, useLazyGetMentorSkillAssignmentsQuery, useGetMentorSkillAssignmentsInfiniteQuery, useLazyGetMentorSkillAssignmentsInfiniteQuery, useGetMentorSkillAssignmentQuery, useCreateMentorSkillAssignmentMutation, useUpdateMentorSkillAssignmentMutation, useDeleteMentorSkillAssignmentMutation, } = agentSkillsApiSlice;
|
|
45499
45540
|
|
|
45500
45541
|
/**
|
|
45501
45542
|
* Template slugs that resolve to the "base-agent" mentor type on the backend
|
|
@@ -46657,17 +46698,54 @@ const { useGetWorkflowsQuery, useLazyGetWorkflowsQuery, useGetWorkflowQuery, use
|
|
|
46657
46698
|
const AUDIT_LOGS_REDUCER_PATH = 'auditLogsApiSlice';
|
|
46658
46699
|
const AUDIT_LOGS_QUERY_KEYS = {
|
|
46659
46700
|
GET_AUDIT_LOGS: () => ['AUDIT_LOGS'],
|
|
46701
|
+
GET_PLATFORM_AUDIT_LOGS: () => ['PLATFORM_AUDIT_LOGS'],
|
|
46660
46702
|
};
|
|
46661
46703
|
const AUDIT_LOGS_ENDPOINTS = {
|
|
46662
46704
|
GET_AUDIT_LOGS: {
|
|
46663
46705
|
service: exports.SERVICES.AXD,
|
|
46664
46706
|
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/mentors/audit-logs/`,
|
|
46665
46707
|
},
|
|
46708
|
+
GET_PLATFORM_AUDIT_LOGS: {
|
|
46709
|
+
service: exports.SERVICES.DM,
|
|
46710
|
+
path: (platformKey) => `/api/core/platforms/${encodeURIComponent(platformKey)}/audit-logs/`,
|
|
46711
|
+
},
|
|
46666
46712
|
};
|
|
46667
46713
|
|
|
46714
|
+
/**
|
|
46715
|
+
* The only query params the platform audit endpoint accepts. Anything else a
|
|
46716
|
+
* caller puts on `params` — `platform_key` above all — is dropped rather than
|
|
46717
|
+
* forwarded: tenant isolation rests on the path segment, and a smuggled scope
|
|
46718
|
+
* override must never reach the query string.
|
|
46719
|
+
*/
|
|
46720
|
+
const ALLOWED_PLATFORM_AUDIT_PARAMS = [
|
|
46721
|
+
'event_type',
|
|
46722
|
+
'action',
|
|
46723
|
+
'actor_username',
|
|
46724
|
+
'actor_email',
|
|
46725
|
+
'from_date',
|
|
46726
|
+
'to_date',
|
|
46727
|
+
'limit',
|
|
46728
|
+
'offset',
|
|
46729
|
+
];
|
|
46730
|
+
const pickAllowedParams = (params) => {
|
|
46731
|
+
if (!params)
|
|
46732
|
+
return params;
|
|
46733
|
+
const safeParams = {};
|
|
46734
|
+
for (const key of ALLOWED_PLATFORM_AUDIT_PARAMS) {
|
|
46735
|
+
const value = params[key];
|
|
46736
|
+
if (value !== undefined) {
|
|
46737
|
+
// Each key maps to its own value type; the loop erases that pairing.
|
|
46738
|
+
safeParams[key] = value;
|
|
46739
|
+
}
|
|
46740
|
+
}
|
|
46741
|
+
return safeParams;
|
|
46742
|
+
};
|
|
46668
46743
|
const auditLogsApiSlice = react.createApi({
|
|
46669
46744
|
reducerPath: AUDIT_LOGS_REDUCER_PATH,
|
|
46670
|
-
tagTypes: [
|
|
46745
|
+
tagTypes: [
|
|
46746
|
+
...AUDIT_LOGS_QUERY_KEYS.GET_AUDIT_LOGS(),
|
|
46747
|
+
...AUDIT_LOGS_QUERY_KEYS.GET_PLATFORM_AUDIT_LOGS(),
|
|
46748
|
+
],
|
|
46671
46749
|
baseQuery: iblFetchBaseQuery,
|
|
46672
46750
|
endpoints: (builder) => ({
|
|
46673
46751
|
getAuditLogs: builder.query({
|
|
@@ -46678,9 +46756,51 @@ const auditLogsApiSlice = react.createApi({
|
|
|
46678
46756
|
}),
|
|
46679
46757
|
providesTags: AUDIT_LOGS_QUERY_KEYS.GET_AUDIT_LOGS(),
|
|
46680
46758
|
}),
|
|
46759
|
+
getPlatformAuditLogs: builder.query({
|
|
46760
|
+
query: (args) => ({
|
|
46761
|
+
url: AUDIT_LOGS_ENDPOINTS.GET_PLATFORM_AUDIT_LOGS.path(args.platformKey),
|
|
46762
|
+
service: AUDIT_LOGS_ENDPOINTS.GET_PLATFORM_AUDIT_LOGS.service,
|
|
46763
|
+
params: pickAllowedParams(args.params),
|
|
46764
|
+
}),
|
|
46765
|
+
providesTags: AUDIT_LOGS_QUERY_KEYS.GET_PLATFORM_AUDIT_LOGS(),
|
|
46766
|
+
}),
|
|
46681
46767
|
}),
|
|
46682
46768
|
});
|
|
46683
|
-
const { useGetAuditLogsQuery, useLazyGetAuditLogsQuery } = auditLogsApiSlice;
|
|
46769
|
+
const { useGetAuditLogsQuery, useLazyGetAuditLogsQuery, useGetPlatformAuditLogsQuery, useLazyGetPlatformAuditLogsQuery, } = auditLogsApiSlice;
|
|
46770
|
+
|
|
46771
|
+
/* -------------------------------------------------------------------------
|
|
46772
|
+
* Platform-scoped audit trail
|
|
46773
|
+
*
|
|
46774
|
+
* `/api/core/platforms/<platform_key>/audit-logs/` merges two kinds of entry
|
|
46775
|
+
* into one stream, told apart by `event_type`:
|
|
46776
|
+
* - `event_type === null` → an automatic CRUD/model change. Read
|
|
46777
|
+
* `resource_type` / `resource_id` / `resource_repr` and the `changes` diff.
|
|
46778
|
+
* - `event_type !== null` → a manually recorded security/activity event.
|
|
46779
|
+
* Read the `event_type` label and the `metadata` payload.
|
|
46780
|
+
* Everything else (`action`, `actor_*`, `timestamp`, `remote_addr`) is shared.
|
|
46781
|
+
* ---------------------------------------------------------------------- */
|
|
46782
|
+
/** Manual event categories the backend records. `null` means a CRUD entry. */
|
|
46783
|
+
const PLATFORM_AUDIT_EVENT_TYPES = [
|
|
46784
|
+
'login',
|
|
46785
|
+
'logout',
|
|
46786
|
+
'login_failed',
|
|
46787
|
+
'password_change',
|
|
46788
|
+
'export',
|
|
46789
|
+
'download_file',
|
|
46790
|
+
'api_call',
|
|
46791
|
+
'view_student_record',
|
|
46792
|
+
'change_grade',
|
|
46793
|
+
'admin_action',
|
|
46794
|
+
];
|
|
46795
|
+
/** Integer codes the `action` query param accepts. */
|
|
46796
|
+
const PLATFORM_AUDIT_ACTION_CODES = {
|
|
46797
|
+
create: 0,
|
|
46798
|
+
update: 1,
|
|
46799
|
+
delete: 2,
|
|
46800
|
+
access: 3,
|
|
46801
|
+
};
|
|
46802
|
+
/** Backend caps `limit` at 1000 and defaults to 100 when it is omitted. */
|
|
46803
|
+
const PLATFORM_AUDIT_LOGS_MAX_LIMIT = 1000;
|
|
46684
46804
|
|
|
46685
46805
|
const EVALUATIONS_REDUCER_PATH = 'evaluationsApiSlice';
|
|
46686
46806
|
const evaluationsBase = (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/evaluations`;
|
|
@@ -47603,9 +47723,13 @@ exports.MENTORS_REDUCER_PATH = MENTORS_REDUCER_PATH;
|
|
|
47603
47723
|
exports.MENTOR_CUSTOM_ENDPOINTS = MENTOR_CUSTOM_ENDPOINTS;
|
|
47604
47724
|
exports.MENTOR_CUSTOM_REDUCER_PATH = MENTOR_CUSTOM_REDUCER_PATH;
|
|
47605
47725
|
exports.MENTOR_ENDPOINTS = MENTOR_ENDPOINTS;
|
|
47726
|
+
exports.MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE = MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE;
|
|
47606
47727
|
exports.NOTIFICATIONS_CUSTOM_ENDPOINTS = NOTIFICATIONS_CUSTOM_ENDPOINTS;
|
|
47607
47728
|
exports.NOTIFICATIONS_CUSTOM_REDUCER_PATH = NOTIFICATIONS_CUSTOM_REDUCER_PATH;
|
|
47608
47729
|
exports.NOTIFICATIONS_CUSTOM_TAGS = NOTIFICATIONS_CUSTOM_TAGS;
|
|
47730
|
+
exports.PLATFORM_AUDIT_ACTION_CODES = PLATFORM_AUDIT_ACTION_CODES;
|
|
47731
|
+
exports.PLATFORM_AUDIT_EVENT_TYPES = PLATFORM_AUDIT_EVENT_TYPES;
|
|
47732
|
+
exports.PLATFORM_AUDIT_LOGS_MAX_LIMIT = PLATFORM_AUDIT_LOGS_MAX_LIMIT;
|
|
47609
47733
|
exports.PLATFORM_CONFIGURATION_TAG = PLATFORM_CONFIGURATION_TAG;
|
|
47610
47734
|
exports.PLATFORM_CUSTOM_ENDPOINTS = PLATFORM_CUSTOM_ENDPOINTS;
|
|
47611
47735
|
exports.PLATFORM_CUSTOM_REDUCER_PATH = PLATFORM_CUSTOM_REDUCER_PATH;
|
|
@@ -48002,6 +48126,7 @@ exports.useGetMentorMemoriesQuery = useGetMentorMemoriesQuery;
|
|
|
48002
48126
|
exports.useGetMentorPublicSettingsQuery = useGetMentorPublicSettingsQuery;
|
|
48003
48127
|
exports.useGetMentorSettingsQuery = useGetMentorSettingsQuery;
|
|
48004
48128
|
exports.useGetMentorSkillAssignmentQuery = useGetMentorSkillAssignmentQuery;
|
|
48129
|
+
exports.useGetMentorSkillAssignmentsInfiniteQuery = useGetMentorSkillAssignmentsInfiniteQuery;
|
|
48005
48130
|
exports.useGetMentorSkillAssignmentsQuery = useGetMentorSkillAssignmentsQuery;
|
|
48006
48131
|
exports.useGetMentorSummariesQuery = useGetMentorSummariesQuery;
|
|
48007
48132
|
exports.useGetMentorsQuery = useGetMentorsQuery;
|
|
@@ -48028,6 +48153,7 @@ exports.useGetPeriodicAgentsQuery = useGetPeriodicAgentsQuery;
|
|
|
48028
48153
|
exports.useGetPersonnalizedMentorsQuery = useGetPersonnalizedMentorsQuery;
|
|
48029
48154
|
exports.useGetPersonnalizedSearchQuery = useGetPersonnalizedSearchQuery;
|
|
48030
48155
|
exports.useGetPinnedMessagesQuery = useGetPinnedMessagesQuery;
|
|
48156
|
+
exports.useGetPlatformAuditLogsQuery = useGetPlatformAuditLogsQuery;
|
|
48031
48157
|
exports.useGetPlatformConfigurationsQuery = useGetPlatformConfigurationsQuery;
|
|
48032
48158
|
exports.useGetPlatformImageAssetDetailsQuery = useGetPlatformImageAssetDetailsQuery;
|
|
48033
48159
|
exports.useGetPlatformImageAssetsListQuery = useGetPlatformImageAssetsListQuery;
|
|
@@ -48231,6 +48357,7 @@ exports.useLazyGetMentorMemoriesListQuery = useLazyGetMentorMemoriesListQuery;
|
|
|
48231
48357
|
exports.useLazyGetMentorMemoriesQuery = useLazyGetMentorMemoriesQuery;
|
|
48232
48358
|
exports.useLazyGetMentorPublicSettingsQuery = useLazyGetMentorPublicSettingsQuery;
|
|
48233
48359
|
exports.useLazyGetMentorSettingsQuery = useLazyGetMentorSettingsQuery;
|
|
48360
|
+
exports.useLazyGetMentorSkillAssignmentsInfiniteQuery = useLazyGetMentorSkillAssignmentsInfiniteQuery;
|
|
48234
48361
|
exports.useLazyGetMentorSkillAssignmentsQuery = useLazyGetMentorSkillAssignmentsQuery;
|
|
48235
48362
|
exports.useLazyGetMentorSummariesQuery = useLazyGetMentorSummariesQuery;
|
|
48236
48363
|
exports.useLazyGetMentorsQuery = useLazyGetMentorsQuery;
|
|
@@ -48254,6 +48381,7 @@ exports.useLazyGetPeriodicAgentsQuery = useLazyGetPeriodicAgentsQuery;
|
|
|
48254
48381
|
exports.useLazyGetPersonnalizedMentorsQuery = useLazyGetPersonnalizedMentorsQuery;
|
|
48255
48382
|
exports.useLazyGetPersonnalizedSearchQuery = useLazyGetPersonnalizedSearchQuery;
|
|
48256
48383
|
exports.useLazyGetPinnedMessagesQuery = useLazyGetPinnedMessagesQuery;
|
|
48384
|
+
exports.useLazyGetPlatformAuditLogsQuery = useLazyGetPlatformAuditLogsQuery;
|
|
48257
48385
|
exports.useLazyGetPlatformInfoQuery = useLazyGetPlatformInfoQuery;
|
|
48258
48386
|
exports.useLazyGetPlatformMembershipQuery = useLazyGetPlatformMembershipQuery;
|
|
48259
48387
|
exports.useLazyGetProgramCompletionQuery = useLazyGetProgramCompletionQuery;
|