@iblai/data-layer 1.29.1 → 1.30.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 +836 -14
- package/dist/index.esm.js +103 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +107 -13
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/memory/__tests__/api-slice.test.d.ts +1 -0
- package/dist/src/features/memory/api-slice.d.ts +748 -1
- package/dist/src/features/memory/constants.d.ts +17 -0
- package/dist/src/features/memory/types.d.ts +44 -0
- package/dist/src/features/utils.d.ts +12 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39518,8 +39518,12 @@ const buildEndpointFromAxdService = (serviceFn, options) => buildEndpointFromSer
|
|
|
39518
39518
|
* Build an endpoint from a hand-assembled URL (rather than a generated service
|
|
39519
39519
|
* method), routed through `iblFetchBaseQuery`. Defaults to the DM service.
|
|
39520
39520
|
*/
|
|
39521
|
-
const buildEndpointFromDmUrl = (buildUrl, service = exports.SERVICES.DM) => ({
|
|
39522
|
-
queryFn: async (args, api, extraOptions) => iblFetchBaseQuery({
|
|
39521
|
+
const buildEndpointFromDmUrl = (buildUrl, service = exports.SERVICES.DM, options) => ({
|
|
39522
|
+
queryFn: async (args, api, extraOptions) => iblFetchBaseQuery({
|
|
39523
|
+
url: buildUrl(args),
|
|
39524
|
+
service,
|
|
39525
|
+
returnErrorStatuses: options === null || options === void 0 ? void 0 : options.returnErrorStatuses,
|
|
39526
|
+
}, api, extraOptions),
|
|
39523
39527
|
});
|
|
39524
39528
|
/**
|
|
39525
39529
|
* Build an endpoint from a hand-assembled URL, taking its arguments in the
|
|
@@ -39583,7 +39587,6 @@ const baseQuery = (service, jsonContentType = true, contentType, skipAuth = fals
|
|
|
39583
39587
|
*/
|
|
39584
39588
|
const invokeHttpErrorHandler = (status, error) => {
|
|
39585
39589
|
const numericStatus = typeof status === 'number' ? status : parseInt(String(status), 10);
|
|
39586
|
-
console.log('[MONETIZATION error] ', { error });
|
|
39587
39590
|
if (!isNaN(numericStatus) &&
|
|
39588
39591
|
Object.prototype.hasOwnProperty.call(Config.httpErrorHandlers, numericStatus)) {
|
|
39589
39592
|
const err = error;
|
|
@@ -39631,7 +39634,7 @@ const withNonRetryableErrors = (query$1) => async (args, api, extraOptions) => {
|
|
|
39631
39634
|
return result;
|
|
39632
39635
|
};
|
|
39633
39636
|
const iblFetchBaseQuery = async (args, api, extraOptions) => {
|
|
39634
|
-
var _a, _b, _c;
|
|
39637
|
+
var _a, _b, _c, _d;
|
|
39635
39638
|
try {
|
|
39636
39639
|
const runQuery = () => {
|
|
39637
39640
|
var _a;
|
|
@@ -39652,9 +39655,21 @@ const iblFetchBaseQuery = async (args, api, extraOptions) => {
|
|
|
39652
39655
|
}
|
|
39653
39656
|
// Query completed
|
|
39654
39657
|
if (result.error) {
|
|
39655
|
-
|
|
39658
|
+
// A status the caller handles itself (e.g. a 404 for a session the
|
|
39659
|
+
// caller no longer holds): don't escalate to Sentry via console.error
|
|
39660
|
+
// and return `{ error }` instead of throwing, so the status reaches the
|
|
39661
|
+
// caller via RTK Query's normal `error` field.
|
|
39662
|
+
if ((_b = args.returnErrorStatuses) === null || _b === void 0 ? void 0 : _b.includes(result.error.status)) {
|
|
39663
|
+
console.warn('[data-layer] returning expected error:', `url=${args.url}, status=${result.error.status}`);
|
|
39664
|
+
return {
|
|
39665
|
+
error: {
|
|
39666
|
+
status: result.error.status,
|
|
39667
|
+
data: result.error.data,
|
|
39668
|
+
},
|
|
39669
|
+
};
|
|
39670
|
+
}
|
|
39656
39671
|
// Invoke registered HTTP error handlers (e.g., logout on 401)
|
|
39657
|
-
invokeHttpErrorHandler(result.error.status, (
|
|
39672
|
+
invokeHttpErrorHandler(result.error.status, (_c = result.error) === null || _c === void 0 ? void 0 : _c.data);
|
|
39658
39673
|
// For profile image upload errors, preserve the original error structure
|
|
39659
39674
|
if (args.url && args.url.includes('/profile_images/')) {
|
|
39660
39675
|
throw result.error;
|
|
@@ -39672,7 +39687,7 @@ const iblFetchBaseQuery = async (args, api, extraOptions) => {
|
|
|
39672
39687
|
// Ensure we throw a plain FetchBaseQueryError shape with enumerable fields
|
|
39673
39688
|
throw {
|
|
39674
39689
|
status: result.error.status,
|
|
39675
|
-
data: (
|
|
39690
|
+
data: (_d = result.error.data) !== null && _d !== void 0 ? _d : errorMessage,
|
|
39676
39691
|
};
|
|
39677
39692
|
}
|
|
39678
39693
|
return { data: result === null || result === void 0 ? void 0 : result.data };
|
|
@@ -42922,12 +42937,23 @@ const sessionApiSlice = react.createApi({
|
|
|
42922
42937
|
invalidatesTags: ['sessionId'],
|
|
42923
42938
|
}),
|
|
42924
42939
|
getSessionId: builder.query({
|
|
42925
|
-
|
|
42926
|
-
|
|
42940
|
+
// A 404 here means the caller holds a session id the backend no longer
|
|
42941
|
+
// recognizes (e.g. purged, or a stale localStorage cache). Return it as
|
|
42942
|
+
// `{ error }` so the chat can detect it and mint a fresh session.
|
|
42943
|
+
...buildEndpointFromDmUrl(buildSessionRetrieveUrl, exports.SERVICES.DM, {
|
|
42944
|
+
returnErrorStatuses: [404],
|
|
42945
|
+
}),
|
|
42946
|
+
// A 404 is now returned as `{ error }` rather than thrown (see above),
|
|
42947
|
+
// so RTK Query would otherwise still tag the errored cache entry and
|
|
42948
|
+
// `createSessionId`'s invalidation would refetch the dead id right
|
|
42949
|
+
// after the heal mints a new session. Only provide the tag on success.
|
|
42950
|
+
providesTags: (_result, error) => (error ? [] : ['sessionId']),
|
|
42927
42951
|
}),
|
|
42928
42952
|
getSharedSessionId: builder.query({
|
|
42929
|
-
...buildEndpointFromDmUrl(buildSharedSessionRetrieveUrl
|
|
42930
|
-
|
|
42953
|
+
...buildEndpointFromDmUrl(buildSharedSessionRetrieveUrl, exports.SERVICES.DM, {
|
|
42954
|
+
returnErrorStatuses: [404],
|
|
42955
|
+
}),
|
|
42956
|
+
providesTags: (_result, error) => (error ? [] : ['sessionId']),
|
|
42931
42957
|
}),
|
|
42932
42958
|
editSession: builder.mutation({
|
|
42933
42959
|
...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersSessionsUpdate),
|
|
@@ -45286,6 +45312,7 @@ const MEMORY_QUERY_KEYS = {
|
|
|
45286
45312
|
MEMSEARCH_MEMORY_CATEGORIES: () => ['MEMSEARCH_MEMORY_CATEGORIES'],
|
|
45287
45313
|
MEMSEARCH_PLATFORM_CONFIG: () => ['MEMSEARCH_PLATFORM_CONFIG'],
|
|
45288
45314
|
MEMSEARCH_STATUS: () => ['MEMSEARCH_STATUS'],
|
|
45315
|
+
MEMSEARCH_SHARED_MEMORIES: () => ['MEMSEARCH_SHARED_MEMORIES'],
|
|
45289
45316
|
};
|
|
45290
45317
|
const MEMSEARCH_ENDPOINTS = {
|
|
45291
45318
|
// User Memory Settings
|
|
@@ -45371,6 +45398,23 @@ const MEMSEARCH_ENDPOINTS = {
|
|
|
45371
45398
|
service: exports.SERVICES.AXD,
|
|
45372
45399
|
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/memsearch-status/`,
|
|
45373
45400
|
},
|
|
45401
|
+
// Shared Memories are the backend's "agent memories", hence the /agent-memories/ path
|
|
45402
|
+
GET_SHARED_MEMORIES: {
|
|
45403
|
+
service: exports.SERVICES.AXD,
|
|
45404
|
+
path: (org, mentorId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/agent-memories/`,
|
|
45405
|
+
},
|
|
45406
|
+
CREATE_SHARED_MEMORY: {
|
|
45407
|
+
service: exports.SERVICES.AXD,
|
|
45408
|
+
path: (org, mentorId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/agent-memories/`,
|
|
45409
|
+
},
|
|
45410
|
+
UPDATE_SHARED_MEMORY: {
|
|
45411
|
+
service: exports.SERVICES.AXD,
|
|
45412
|
+
path: (org, mentorId, memoryId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/agent-memories/${memoryId}/`,
|
|
45413
|
+
},
|
|
45414
|
+
DELETE_SHARED_MEMORY: {
|
|
45415
|
+
service: exports.SERVICES.AXD,
|
|
45416
|
+
path: (org, mentorId, memoryId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/agent-memories/${memoryId}/`,
|
|
45417
|
+
},
|
|
45374
45418
|
};
|
|
45375
45419
|
|
|
45376
45420
|
const memoryApiSlice = react.createApi({
|
|
@@ -45382,8 +45426,12 @@ const memoryApiSlice = react.createApi({
|
|
|
45382
45426
|
...MEMORY_QUERY_KEYS.MEMSEARCH_MEMORY_CATEGORIES(),
|
|
45383
45427
|
...MEMORY_QUERY_KEYS.MEMSEARCH_PLATFORM_CONFIG(),
|
|
45384
45428
|
...MEMORY_QUERY_KEYS.MEMSEARCH_STATUS(),
|
|
45429
|
+
...MEMORY_QUERY_KEYS.MEMSEARCH_SHARED_MEMORIES(),
|
|
45385
45430
|
],
|
|
45386
|
-
|
|
45431
|
+
// Callers read the failure itself: the shared-memory UI tells a 409 (duplicate)
|
|
45432
|
+
// from a 400 (too short) from a 403 by status and body. `iblFetchBaseQuery`
|
|
45433
|
+
// throws its errors, which reach `.unwrap()` and the hooks as `{}`.
|
|
45434
|
+
baseQuery: withReturnedErrors(iblFetchBaseQuery),
|
|
45387
45435
|
endpoints: (builder) => ({
|
|
45388
45436
|
// User Memory Settings
|
|
45389
45437
|
getUserMemorySettings: builder.query({
|
|
@@ -45547,9 +45595,50 @@ const memoryApiSlice = react.createApi({
|
|
|
45547
45595
|
}),
|
|
45548
45596
|
providesTags: MEMORY_QUERY_KEYS.MEMSEARCH_STATUS(),
|
|
45549
45597
|
}),
|
|
45598
|
+
// Shared Memories (the backend's "agent memories")
|
|
45599
|
+
getSharedMemories: builder.query({
|
|
45600
|
+
query: (args) => ({
|
|
45601
|
+
url: MEMSEARCH_ENDPOINTS.GET_SHARED_MEMORIES.path(args.org, args.mentorId),
|
|
45602
|
+
service: MEMSEARCH_ENDPOINTS.GET_SHARED_MEMORIES.service,
|
|
45603
|
+
params: args.params,
|
|
45604
|
+
}),
|
|
45605
|
+
providesTags: MEMORY_QUERY_KEYS.MEMSEARCH_SHARED_MEMORIES(),
|
|
45606
|
+
}),
|
|
45607
|
+
createSharedMemory: builder.mutation({
|
|
45608
|
+
query: (args) => ({
|
|
45609
|
+
url: MEMSEARCH_ENDPOINTS.CREATE_SHARED_MEMORY.path(args.org, args.mentorId),
|
|
45610
|
+
service: MEMSEARCH_ENDPOINTS.CREATE_SHARED_MEMORY.service,
|
|
45611
|
+
method: 'POST',
|
|
45612
|
+
body: { content: args.content },
|
|
45613
|
+
}),
|
|
45614
|
+
// A 409 (duplicate) is a definitive answer, not a transient failure to retry.
|
|
45615
|
+
extraOptions: { maxRetries: 0 },
|
|
45616
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_SHARED_MEMORIES(),
|
|
45617
|
+
}),
|
|
45618
|
+
updateSharedMemory: builder.mutation({
|
|
45619
|
+
query: (args) => ({
|
|
45620
|
+
url: MEMSEARCH_ENDPOINTS.UPDATE_SHARED_MEMORY.path(args.org, args.mentorId, args.memoryId),
|
|
45621
|
+
service: MEMSEARCH_ENDPOINTS.UPDATE_SHARED_MEMORY.service,
|
|
45622
|
+
method: 'PATCH',
|
|
45623
|
+
body: { content: args.content },
|
|
45624
|
+
}),
|
|
45625
|
+
// A 409 (duplicate) is a definitive answer, not a transient failure to retry.
|
|
45626
|
+
extraOptions: { maxRetries: 0 },
|
|
45627
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_SHARED_MEMORIES(),
|
|
45628
|
+
}),
|
|
45629
|
+
deleteSharedMemory: builder.mutation({
|
|
45630
|
+
query: (args) => ({
|
|
45631
|
+
url: MEMSEARCH_ENDPOINTS.DELETE_SHARED_MEMORY.path(args.org, args.mentorId, args.memoryId),
|
|
45632
|
+
service: MEMSEARCH_ENDPOINTS.DELETE_SHARED_MEMORY.service,
|
|
45633
|
+
method: 'DELETE',
|
|
45634
|
+
}),
|
|
45635
|
+
// A 404 (already gone) or 403 is a definitive answer, not a transient failure to retry.
|
|
45636
|
+
extraOptions: { maxRetries: 0 },
|
|
45637
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_SHARED_MEMORIES(),
|
|
45638
|
+
}),
|
|
45550
45639
|
}),
|
|
45551
45640
|
});
|
|
45552
|
-
const { useGetUserMemorySettingsQuery, useLazyGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useLazyGetGlobalMemoriesQuery, useCreateGlobalMemoryMutation, useUpdateGlobalMemoryMutation, useDeleteGlobalMemoryMutation, useGetMentorMemoriesQuery, useLazyGetMentorMemoriesQuery, useGetMentorMemoriesListQuery, useLazyGetMentorMemoriesListQuery, useGetAllMentorMemoriesQuery, useLazyGetAllMentorMemoriesQuery, useCreateMentorMemoryMutation, useUpdateMentorMemoryMutation, useDeleteMentorMemoryMutation, useGetMemoryCategoriesAdminQuery, useLazyGetMemoryCategoriesAdminQuery, useCreateMemoryCategoryMutation, useUpdateMemoryCategoryMutation, useDeleteMemoryCategoryMutation, useGetMemsearchConfigQuery, useLazyGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetMemsearchStatusQuery, useLazyGetMemsearchStatusQuery, } = memoryApiSlice;
|
|
45641
|
+
const { useGetUserMemorySettingsQuery, useLazyGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useLazyGetGlobalMemoriesQuery, useCreateGlobalMemoryMutation, useUpdateGlobalMemoryMutation, useDeleteGlobalMemoryMutation, useGetMentorMemoriesQuery, useLazyGetMentorMemoriesQuery, useGetMentorMemoriesListQuery, useLazyGetMentorMemoriesListQuery, useGetAllMentorMemoriesQuery, useLazyGetAllMentorMemoriesQuery, useCreateMentorMemoryMutation, useUpdateMentorMemoryMutation, useDeleteMentorMemoryMutation, useGetMemoryCategoriesAdminQuery, useLazyGetMemoryCategoriesAdminQuery, useCreateMemoryCategoryMutation, useUpdateMemoryCategoryMutation, useDeleteMemoryCategoryMutation, useGetMemsearchConfigQuery, useLazyGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetMemsearchStatusQuery, useLazyGetMemsearchStatusQuery, useGetSharedMemoriesQuery, useLazyGetSharedMemoriesQuery, useCreateSharedMemoryMutation, useUpdateSharedMemoryMutation, useDeleteSharedMemoryMutation, } = memoryApiSlice;
|
|
45553
45642
|
|
|
45554
45643
|
const MCP_REDUCER_PATH = 'mcpApiSlice';
|
|
45555
45644
|
const MCP_ENDPOINTS = {
|
|
@@ -50119,6 +50208,7 @@ exports.useCreateRedirectTokenMutation = useCreateRedirectTokenMutation;
|
|
|
50119
50208
|
exports.useCreateReportMutation = useCreateReportMutation;
|
|
50120
50209
|
exports.useCreateSessionIdMutation = useCreateSessionIdMutation;
|
|
50121
50210
|
exports.useCreateShareableLinkMutation = useCreateShareableLinkMutation;
|
|
50211
|
+
exports.useCreateSharedMemoryMutation = useCreateSharedMemoryMutation;
|
|
50122
50212
|
exports.useCreateStripeCheckoutSessionMutation = useCreateStripeCheckoutSessionMutation;
|
|
50123
50213
|
exports.useCreateStripeCustomerPortalMutation = useCreateStripeCustomerPortalMutation;
|
|
50124
50214
|
exports.useCreateStudioCourseMutation = useCreateStudioCourseMutation;
|
|
@@ -50184,6 +50274,7 @@ exports.useDeleteRbacGroupMutation = useDeleteRbacGroupMutation;
|
|
|
50184
50274
|
exports.useDeleteRbacPolicyMutation = useDeleteRbacPolicyMutation;
|
|
50185
50275
|
exports.useDeleteRbacRoleMutation = useDeleteRbacRoleMutation;
|
|
50186
50276
|
exports.useDeleteRecommendedPromptMutation = useDeleteRecommendedPromptMutation;
|
|
50277
|
+
exports.useDeleteSharedMemoryMutation = useDeleteSharedMemoryMutation;
|
|
50187
50278
|
exports.useDeleteStudioCourseMutation = useDeleteStudioCourseMutation;
|
|
50188
50279
|
exports.useDeleteSupportTicketMessageMutation = useDeleteSupportTicketMessageMutation;
|
|
50189
50280
|
exports.useDeleteSupportTicketMutation = useDeleteSupportTicketMutation;
|
|
@@ -50407,6 +50498,7 @@ exports.useGetSessionIdQuery = useGetSessionIdQuery;
|
|
|
50407
50498
|
exports.useGetSessionStatsQuery = useGetSessionStatsQuery;
|
|
50408
50499
|
exports.useGetShareableLinkPublicQuery = useGetShareableLinkPublicQuery;
|
|
50409
50500
|
exports.useGetShareableLinkQuery = useGetShareableLinkQuery;
|
|
50501
|
+
exports.useGetSharedMemoriesQuery = useGetSharedMemoriesQuery;
|
|
50410
50502
|
exports.useGetSharedSessionIdQuery = useGetSharedSessionIdQuery;
|
|
50411
50503
|
exports.useGetSkillsPointsPercentileQuery = useGetSkillsPointsPercentileQuery;
|
|
50412
50504
|
exports.useGetSpendCapStatusQuery = useGetSpendCapStatusQuery;
|
|
@@ -50641,6 +50733,7 @@ exports.useLazyGetSearchGlobalQuery = useLazyGetSearchGlobalQuery;
|
|
|
50641
50733
|
exports.useLazyGetSessionIdQuery = useLazyGetSessionIdQuery;
|
|
50642
50734
|
exports.useLazyGetShareableLinkPublicQuery = useLazyGetShareableLinkPublicQuery;
|
|
50643
50735
|
exports.useLazyGetShareableLinkQuery = useLazyGetShareableLinkQuery;
|
|
50736
|
+
exports.useLazyGetSharedMemoriesQuery = useLazyGetSharedMemoriesQuery;
|
|
50644
50737
|
exports.useLazyGetSharedSessionIdQuery = useLazyGetSharedSessionIdQuery;
|
|
50645
50738
|
exports.useLazyGetSkillsPointsPercentileQuery = useLazyGetSkillsPointsPercentileQuery;
|
|
50646
50739
|
exports.useLazyGetSpendCapStatusQuery = useLazyGetSpendCapStatusQuery;
|
|
@@ -50846,6 +50939,7 @@ exports.useUpdateRbacRoleMutation = useUpdateRbacRoleMutation;
|
|
|
50846
50939
|
exports.useUpdateRecommendedPromptMutation = useUpdateRecommendedPromptMutation;
|
|
50847
50940
|
exports.useUpdateSessionDisableChathistoryMutation = useUpdateSessionDisableChathistoryMutation;
|
|
50848
50941
|
exports.useUpdateShareableLinkMutation = useUpdateShareableLinkMutation;
|
|
50942
|
+
exports.useUpdateSharedMemoryMutation = useUpdateSharedMemoryMutation;
|
|
50849
50943
|
exports.useUpdateStudioCourseSettingsMutation = useUpdateStudioCourseSettingsMutation;
|
|
50850
50944
|
exports.useUpdateStudioXblockMutation = useUpdateStudioXblockMutation;
|
|
50851
50945
|
exports.useUpdateSupportTicketMessageMutation = useUpdateSupportTicketMessageMutation;
|