@iblai/data-layer 1.17.0 → 1.18.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 +66 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/search/__tests__/api-slice.test.d.ts +1 -0
- package/dist/src/features/search/__tests__/url.test.d.ts +1 -0
- package/dist/src/features/search/api-slice.d.ts +304 -0
- package/dist/src/features/search/constants.d.ts +15 -0
- package/dist/src/features/search/types.d.ts +81 -0
- package/dist/src/features/search/url.d.ts +10 -0
- package/dist/src/features/utils.d.ts +9 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39521,6 +39521,15 @@ const buildEndpointFromAxdService = (serviceFn, options) => buildEndpointFromSer
|
|
|
39521
39521
|
const buildEndpointFromDmUrl = (buildUrl, service = exports.SERVICES.DM) => ({
|
|
39522
39522
|
queryFn: async (args, api, extraOptions) => iblFetchBaseQuery({ url: buildUrl(args), service }, api, extraOptions),
|
|
39523
39523
|
});
|
|
39524
|
+
/**
|
|
39525
|
+
* Build an endpoint from a hand-assembled URL, taking its arguments in the
|
|
39526
|
+
* spread-array form the `*Legacy` builders use. Lets a URL-backed endpoint sit
|
|
39527
|
+
* in the same slice as generated-service ones without callers having to switch
|
|
39528
|
+
* between `hook(args)` and `hook([args])`.
|
|
39529
|
+
*/
|
|
39530
|
+
const buildEndpointFromDmUrlLegacy = (buildUrl, service = exports.SERVICES.DM) => ({
|
|
39531
|
+
queryFn: async (args, api, extraOptions) => iblFetchBaseQuery({ url: buildUrl(...args), service }, api, extraOptions),
|
|
39532
|
+
});
|
|
39524
39533
|
const isErrorObject = (data) => {
|
|
39525
39534
|
return (typeof data === 'object' &&
|
|
39526
39535
|
data !== null &&
|
|
@@ -40081,6 +40090,21 @@ const CUSTOM_AI_SEARCH_QUERY_KEYS = {
|
|
|
40081
40090
|
GET_MENTORS: () => ['GET_MENTORS'],
|
|
40082
40091
|
GET_PERSONNALIZED_MENTORS: () => ['GET_PERSONNALIZED_MENTORS'],
|
|
40083
40092
|
};
|
|
40093
|
+
/** Path of the global (non-personalized) catalog search endpoint. */
|
|
40094
|
+
const GLOBAL_SEARCH_PATH = '/api/search/global/';
|
|
40095
|
+
/**
|
|
40096
|
+
* Defaults the generated `SearchService.searchGlobalRetrieve` applies to its
|
|
40097
|
+
* own parameters. Kept here so the hand-built URL sends the same query the
|
|
40098
|
+
* generated client would, and so swapping to it later is a no-op for callers.
|
|
40099
|
+
*/
|
|
40100
|
+
const GLOBAL_SEARCH_DEFAULTS = {
|
|
40101
|
+
allowSkillSearch: false,
|
|
40102
|
+
alphabetical: false,
|
|
40103
|
+
limit: 12,
|
|
40104
|
+
orderAscending: false,
|
|
40105
|
+
returnFacet: true,
|
|
40106
|
+
returnItems: false,
|
|
40107
|
+
};
|
|
40084
40108
|
|
|
40085
40109
|
const customAiSearchApiSlice = react.createApi({
|
|
40086
40110
|
reducerPath: CUSTOM_AI_SEARCH_REDUCER_PATH,
|
|
@@ -43971,6 +43995,43 @@ const studioAuthoringApiSlice = react.createApi({
|
|
|
43971
43995
|
});
|
|
43972
43996
|
const { useCreateStudioCourseMutation, useDeleteStudioCourseMutation, useUpdateStudioCourseSettingsMutation, useCreateStudioXblockMutation, useUpdateStudioXblockMutation, useUploadStudioScormPackageMutation, useUploadStudioCourseAssetMutation, useSetStudioAdvancedSettingsMutation, useUploadStudioCourseVideoMutation, } = studioAuthoringApiSlice;
|
|
43973
43997
|
|
|
43998
|
+
/**
|
|
43999
|
+
* Append one param the way the generated client serializes it: camelCase keys
|
|
44000
|
+
* become snake_case, arrays repeat the key, and null/undefined are dropped.
|
|
44001
|
+
*/
|
|
44002
|
+
const appendParam = (params, key, value) => {
|
|
44003
|
+
if (value === undefined || value === null) {
|
|
44004
|
+
return;
|
|
44005
|
+
}
|
|
44006
|
+
if (Array.isArray(value)) {
|
|
44007
|
+
value.forEach((entry) => appendParam(params, key, entry));
|
|
44008
|
+
return;
|
|
44009
|
+
}
|
|
44010
|
+
params.append(key.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`), String(value));
|
|
44011
|
+
};
|
|
44012
|
+
/**
|
|
44013
|
+
* Build the URL for `GET /api/search/global/`.
|
|
44014
|
+
*
|
|
44015
|
+
* Hand-assembled rather than delegating to `SearchService.searchGlobalRetrieve`
|
|
44016
|
+
* because the workspace pins `@iblai/iblai-api` to a release that predates that
|
|
44017
|
+
* method (see `overrides` in pnpm-workspace.yaml). Params and defaults mirror
|
|
44018
|
+
* the generated signature so the two stay interchangeable.
|
|
44019
|
+
*/
|
|
44020
|
+
const buildGlobalSearchUrl = (args = {}) => {
|
|
44021
|
+
// Merge rather than spread so an explicitly `undefined` arg falls back to the
|
|
44022
|
+
// default, matching JS default-parameter semantics in the generated client.
|
|
44023
|
+
const merged = { ...GLOBAL_SEARCH_DEFAULTS };
|
|
44024
|
+
Object.entries(args).forEach(([key, value]) => {
|
|
44025
|
+
if (value !== undefined) {
|
|
44026
|
+
merged[key] = value;
|
|
44027
|
+
}
|
|
44028
|
+
});
|
|
44029
|
+
const params = new URLSearchParams();
|
|
44030
|
+
Object.entries(merged).forEach(([key, value]) => appendParam(params, key, value));
|
|
44031
|
+
const queryString = params.toString();
|
|
44032
|
+
return queryString ? `${GLOBAL_SEARCH_PATH}?${queryString}` : GLOBAL_SEARCH_PATH;
|
|
44033
|
+
};
|
|
44034
|
+
|
|
43974
44035
|
const searchApiSlice = react.createApi({
|
|
43975
44036
|
reducerPath: 'searchApiSlice',
|
|
43976
44037
|
baseQuery: iblFakeBaseQuery,
|
|
@@ -43981,9 +44042,12 @@ const searchApiSlice = react.createApi({
|
|
|
43981
44042
|
getCatalogSearch: builder.query({
|
|
43982
44043
|
...buildEndpointFromDmServiceLegacy(SearchService.searchCatalogRetrieve),
|
|
43983
44044
|
}),
|
|
44045
|
+
getSearchGlobal: builder.query({
|
|
44046
|
+
...buildEndpointFromDmUrlLegacy(buildGlobalSearchUrl),
|
|
44047
|
+
}),
|
|
43984
44048
|
}),
|
|
43985
44049
|
});
|
|
43986
|
-
const { useGetPersonnalizedSearchQuery, useLazyGetPersonnalizedSearchQuery, useGetCatalogSearchQuery, useLazyGetCatalogSearchQuery, } = searchApiSlice;
|
|
44050
|
+
const { useGetPersonnalizedSearchQuery, useLazyGetPersonnalizedSearchQuery, useGetCatalogSearchQuery, useLazyGetCatalogSearchQuery, useGetSearchGlobalQuery, useLazyGetSearchGlobalQuery, } = searchApiSlice;
|
|
43987
44051
|
|
|
43988
44052
|
const resolveOrgUsername = (arg) => {
|
|
43989
44053
|
if (Array.isArray(arg)) {
|
|
@@ -48629,6 +48693,8 @@ exports.EDX_PROCTORING_ENDPOINTS = EDX_PROCTORING_ENDPOINTS;
|
|
|
48629
48693
|
exports.EVALUATIONS_ENDPOINTS = EVALUATIONS_ENDPOINTS;
|
|
48630
48694
|
exports.EVALUATIONS_REDUCER_PATH = EVALUATIONS_REDUCER_PATH;
|
|
48631
48695
|
exports.EVALUATIONS_TAGS = EVALUATIONS_TAGS;
|
|
48696
|
+
exports.GLOBAL_SEARCH_DEFAULTS = GLOBAL_SEARCH_DEFAULTS;
|
|
48697
|
+
exports.GLOBAL_SEARCH_PATH = GLOBAL_SEARCH_PATH;
|
|
48632
48698
|
exports.GRADING_ENDPOINTS = GRADING_ENDPOINTS;
|
|
48633
48699
|
exports.GRADING_QUERY_KEYS = GRADING_QUERY_KEYS;
|
|
48634
48700
|
exports.GRADING_REDUCER_PATH = GRADING_REDUCER_PATH;
|
|
@@ -48707,6 +48773,7 @@ exports.auditLogsApiSlice = auditLogsApiSlice;
|
|
|
48707
48773
|
exports.authApiSlice = authApiSlice;
|
|
48708
48774
|
exports.billingApiSlice = billingApiSlice;
|
|
48709
48775
|
exports.billingCustomSlice = billingCustomSlice;
|
|
48776
|
+
exports.buildGlobalSearchUrl = buildGlobalSearchUrl;
|
|
48710
48777
|
exports.buildRecentMessagesUrl = buildRecentMessagesUrl;
|
|
48711
48778
|
exports.buildSessionRetrieveUrl = buildSessionRetrieveUrl;
|
|
48712
48779
|
exports.buildSharedSessionRetrieveUrl = buildSharedSessionRetrieveUrl;
|
|
@@ -49146,6 +49213,7 @@ exports.useGetReportedSkillsQuery = useGetReportedSkillsQuery;
|
|
|
49146
49213
|
exports.useGetReportsQuery = useGetReportsQuery;
|
|
49147
49214
|
exports.useGetResourceSearchQuery = useGetResourceSearchQuery;
|
|
49148
49215
|
exports.useGetRevenueQuery = useGetRevenueQuery;
|
|
49216
|
+
exports.useGetSearchGlobalQuery = useGetSearchGlobalQuery;
|
|
49149
49217
|
exports.useGetSessionIdQuery = useGetSessionIdQuery;
|
|
49150
49218
|
exports.useGetSessionStatsQuery = useGetSessionStatsQuery;
|
|
49151
49219
|
exports.useGetShareableLinkPublicQuery = useGetShareableLinkPublicQuery;
|
|
@@ -49374,6 +49442,7 @@ exports.useLazyGetReportedSkillsQuery = useLazyGetReportedSkillsQuery;
|
|
|
49374
49442
|
exports.useLazyGetReportsQuery = useLazyGetReportsQuery;
|
|
49375
49443
|
exports.useLazyGetResourceSearchQuery = useLazyGetResourceSearchQuery;
|
|
49376
49444
|
exports.useLazyGetRevenueQuery = useLazyGetRevenueQuery;
|
|
49445
|
+
exports.useLazyGetSearchGlobalQuery = useLazyGetSearchGlobalQuery;
|
|
49377
49446
|
exports.useLazyGetSessionIdQuery = useLazyGetSessionIdQuery;
|
|
49378
49447
|
exports.useLazyGetShareableLinkPublicQuery = useLazyGetShareableLinkPublicQuery;
|
|
49379
49448
|
exports.useLazyGetShareableLinkQuery = useLazyGetShareableLinkQuery;
|