@iblai/data-layer 1.12.4 → 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 +336 -2
- package/dist/index.esm.js +82 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +86 -2
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- 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
|
@@ -46698,17 +46698,54 @@ const { useGetWorkflowsQuery, useLazyGetWorkflowsQuery, useGetWorkflowQuery, use
|
|
|
46698
46698
|
const AUDIT_LOGS_REDUCER_PATH = 'auditLogsApiSlice';
|
|
46699
46699
|
const AUDIT_LOGS_QUERY_KEYS = {
|
|
46700
46700
|
GET_AUDIT_LOGS: () => ['AUDIT_LOGS'],
|
|
46701
|
+
GET_PLATFORM_AUDIT_LOGS: () => ['PLATFORM_AUDIT_LOGS'],
|
|
46701
46702
|
};
|
|
46702
46703
|
const AUDIT_LOGS_ENDPOINTS = {
|
|
46703
46704
|
GET_AUDIT_LOGS: {
|
|
46704
46705
|
service: exports.SERVICES.AXD,
|
|
46705
46706
|
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/mentors/audit-logs/`,
|
|
46706
46707
|
},
|
|
46708
|
+
GET_PLATFORM_AUDIT_LOGS: {
|
|
46709
|
+
service: exports.SERVICES.DM,
|
|
46710
|
+
path: (platformKey) => `/api/core/platforms/${encodeURIComponent(platformKey)}/audit-logs/`,
|
|
46711
|
+
},
|
|
46707
46712
|
};
|
|
46708
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
|
+
};
|
|
46709
46743
|
const auditLogsApiSlice = react.createApi({
|
|
46710
46744
|
reducerPath: AUDIT_LOGS_REDUCER_PATH,
|
|
46711
|
-
tagTypes: [
|
|
46745
|
+
tagTypes: [
|
|
46746
|
+
...AUDIT_LOGS_QUERY_KEYS.GET_AUDIT_LOGS(),
|
|
46747
|
+
...AUDIT_LOGS_QUERY_KEYS.GET_PLATFORM_AUDIT_LOGS(),
|
|
46748
|
+
],
|
|
46712
46749
|
baseQuery: iblFetchBaseQuery,
|
|
46713
46750
|
endpoints: (builder) => ({
|
|
46714
46751
|
getAuditLogs: builder.query({
|
|
@@ -46719,9 +46756,51 @@ const auditLogsApiSlice = react.createApi({
|
|
|
46719
46756
|
}),
|
|
46720
46757
|
providesTags: AUDIT_LOGS_QUERY_KEYS.GET_AUDIT_LOGS(),
|
|
46721
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
|
+
}),
|
|
46722
46767
|
}),
|
|
46723
46768
|
});
|
|
46724
|
-
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;
|
|
46725
46804
|
|
|
46726
46805
|
const EVALUATIONS_REDUCER_PATH = 'evaluationsApiSlice';
|
|
46727
46806
|
const evaluationsBase = (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/evaluations`;
|
|
@@ -47648,6 +47727,9 @@ exports.MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE = MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE;
|
|
|
47648
47727
|
exports.NOTIFICATIONS_CUSTOM_ENDPOINTS = NOTIFICATIONS_CUSTOM_ENDPOINTS;
|
|
47649
47728
|
exports.NOTIFICATIONS_CUSTOM_REDUCER_PATH = NOTIFICATIONS_CUSTOM_REDUCER_PATH;
|
|
47650
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;
|
|
47651
47733
|
exports.PLATFORM_CONFIGURATION_TAG = PLATFORM_CONFIGURATION_TAG;
|
|
47652
47734
|
exports.PLATFORM_CUSTOM_ENDPOINTS = PLATFORM_CUSTOM_ENDPOINTS;
|
|
47653
47735
|
exports.PLATFORM_CUSTOM_REDUCER_PATH = PLATFORM_CUSTOM_REDUCER_PATH;
|
|
@@ -48071,6 +48153,7 @@ exports.useGetPeriodicAgentsQuery = useGetPeriodicAgentsQuery;
|
|
|
48071
48153
|
exports.useGetPersonnalizedMentorsQuery = useGetPersonnalizedMentorsQuery;
|
|
48072
48154
|
exports.useGetPersonnalizedSearchQuery = useGetPersonnalizedSearchQuery;
|
|
48073
48155
|
exports.useGetPinnedMessagesQuery = useGetPinnedMessagesQuery;
|
|
48156
|
+
exports.useGetPlatformAuditLogsQuery = useGetPlatformAuditLogsQuery;
|
|
48074
48157
|
exports.useGetPlatformConfigurationsQuery = useGetPlatformConfigurationsQuery;
|
|
48075
48158
|
exports.useGetPlatformImageAssetDetailsQuery = useGetPlatformImageAssetDetailsQuery;
|
|
48076
48159
|
exports.useGetPlatformImageAssetsListQuery = useGetPlatformImageAssetsListQuery;
|
|
@@ -48298,6 +48381,7 @@ exports.useLazyGetPeriodicAgentsQuery = useLazyGetPeriodicAgentsQuery;
|
|
|
48298
48381
|
exports.useLazyGetPersonnalizedMentorsQuery = useLazyGetPersonnalizedMentorsQuery;
|
|
48299
48382
|
exports.useLazyGetPersonnalizedSearchQuery = useLazyGetPersonnalizedSearchQuery;
|
|
48300
48383
|
exports.useLazyGetPinnedMessagesQuery = useLazyGetPinnedMessagesQuery;
|
|
48384
|
+
exports.useLazyGetPlatformAuditLogsQuery = useLazyGetPlatformAuditLogsQuery;
|
|
48301
48385
|
exports.useLazyGetPlatformInfoQuery = useLazyGetPlatformInfoQuery;
|
|
48302
48386
|
exports.useLazyGetPlatformMembershipQuery = useLazyGetPlatformMembershipQuery;
|
|
48303
48387
|
exports.useLazyGetProgramCompletionQuery = useLazyGetProgramCompletionQuery;
|