@iblai/data-layer 1.34.0 → 1.35.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 +211 -53
- package/dist/index.esm.js +352 -105
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +352 -105
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/config.d.ts +8 -0
- package/dist/src/constants.d.ts +17 -1
- package/dist/src/features/course-metadata/__tests__/api-slice.test.d.ts +1 -0
- package/dist/src/features/course-metadata/api-slice.d.ts +162 -108
- package/dist/src/features/retirement/__tests__/api-slice.test.d.ts +1 -0
- package/dist/src/features/search/types.d.ts +2 -0
- package/dist/src/features/studio-authoring/__tests__/course-key.test.d.ts +1 -0
- package/dist/src/features/studio-authoring/api-slice.d.ts +12 -4
- package/dist/src/features/studio-authoring/constants.d.ts +4 -0
- package/dist/src/features/studio-authoring/course-key.d.ts +16 -0
- package/dist/src/features/studio-authoring/types.d.ts +12 -2
- package/dist/src/features/tenant/__tests__/api-slice.test.d.ts +1 -0
- package/dist/src/features/tenant/api-slice.d.ts +66 -21
- package/dist/src/features/tenant/constants.d.ts +1 -1
- package/dist/src/features/user/__tests__/roles-mapping.test.d.ts +1 -0
- package/dist/src/features/user/__tests__/user-metadata.test.d.ts +1 -0
- package/dist/src/features/user/api-slice.d.ts +15 -13
- package/dist/src/features/user/constants.d.ts +11 -1
- package/dist/src/features/user/roles-mapping.d.ts +9 -0
- package/dist/src/features/user/types.d.ts +26 -11
- package/dist/src/features/utils.d.ts +12 -0
- package/dist/src/utils/index.d.ts +4 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { StudioAdvancedSettings, StudioAssetUploadResponse, StudioCourseCreateRequest, StudioCourseCreateResponse, StudioCourseSettingsRequest, StudioVideoUploadResponse, StudioXblockCreateRequest, StudioXblockResponse } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Studio (Open edX CMS) course-authoring endpoints.
|
|
4
|
-
*
|
|
5
|
-
* Studio
|
|
3
|
+
* Studio (Open edX CMS) course-authoring endpoints. Course creation and video
|
|
4
|
+
* upload reach Studio through DM's edX proxy when `Config.edxProxyEnabled`;
|
|
5
|
+
* the rest hit the Studio host (`Config.studioUrl`) with cookie-session auth +
|
|
6
|
+
* CSRF token, mirroring how Studio's own frontend talks to it.
|
|
6
7
|
*/
|
|
7
8
|
export declare const studioAuthoringApiSlice: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, {
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Create the course (or library) shell. Returns `course_key`.
|
|
11
|
+
*
|
|
12
|
+
* A course goes to the course-creator endpoint, which needs `number` and
|
|
13
|
+
* `run` (generated from the display name when absent) and answers with the
|
|
14
|
+
* root block locator; `course_key` is derived from it. A library still uses
|
|
15
|
+
* the plugin's manage endpoint on the Studio host.
|
|
16
|
+
*/
|
|
9
17
|
createStudioCourse: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
10
18
|
courseData: StudioCourseCreateRequest;
|
|
11
19
|
contentType?: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StudioCourseCreateRequest } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A course number derived from the display name: letters, digits and single
|
|
4
|
+
* hyphens, at most 30 characters, `COURSE` when nothing usable is left.
|
|
5
|
+
*/
|
|
6
|
+
export declare const courseNumberFromDisplayName: (displayName: string) => string;
|
|
7
|
+
/** A run like `2026_a1B`: the year plus a short random suffix, as Studio's own generator makes them. */
|
|
8
|
+
export declare const generateCourseRun: (now?: Date) => string;
|
|
9
|
+
/**
|
|
10
|
+
* The course-creator endpoint needs `number` and `run`, which the old plugin
|
|
11
|
+
* endpoint generated itself; fill them in when the caller only gave `org` and
|
|
12
|
+
* `display_name`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const withCourseNumberAndRun: (courseData: StudioCourseCreateRequest) => StudioCourseCreateRequest;
|
|
15
|
+
/** `block-v1:ORG+NUM+RUN+type@course+block@course` → `course-v1:ORG+NUM+RUN`. */
|
|
16
|
+
export declare const courseKeyFromLocator: (locator: string) => string | undefined;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Payload for creating a course (or library) shell in Studio. For a course,
|
|
3
|
+
* `number` and `run` are generated from the display name when omitted.
|
|
4
|
+
*/
|
|
2
5
|
export interface StudioCourseCreateRequest {
|
|
3
6
|
org: string;
|
|
4
7
|
display_name: string;
|
|
8
|
+
number?: string;
|
|
9
|
+
run?: string;
|
|
5
10
|
[key: string]: unknown;
|
|
6
11
|
}
|
|
7
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Response of a course or library creation. The course-creator endpoint answers
|
|
14
|
+
* with `course_parent_locator`; `course_key` is derived from it so callers can
|
|
15
|
+
* keep reading that.
|
|
16
|
+
*/
|
|
8
17
|
export interface StudioCourseCreateResponse {
|
|
9
18
|
course_key?: string;
|
|
19
|
+
course_parent_locator?: string;
|
|
10
20
|
library_key?: string;
|
|
11
21
|
url?: string;
|
|
12
22
|
[key: string]: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,7 +13,10 @@ export declare const tenantApiSlice: import("@reduxjs/toolkit/query").Api<import
|
|
|
13
13
|
}], import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
14
14
|
attempt?: number;
|
|
15
15
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, import("@iblai/iblai-api").PlatformPublicMetadata, "tenantApiSlice", any>;
|
|
16
|
-
|
|
16
|
+
/** The platforms the signed-in user is linked to. `username` defaults to the stored user. */
|
|
17
|
+
getUserTenants: import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
18
|
+
username?: string;
|
|
19
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
17
20
|
attempt?: number;
|
|
18
21
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>;
|
|
19
22
|
}, "tenantApiSlice", string, typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/dist/query/react").reactHooksModuleName>;
|
|
@@ -377,7 +380,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
377
380
|
isError: false;
|
|
378
381
|
}, "isUninitialized"> & {
|
|
379
382
|
isUninitialized: true;
|
|
380
|
-
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
383
|
+
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
384
|
+
username?: string;
|
|
385
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
381
386
|
attempt?: number;
|
|
382
387
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
383
388
|
currentData?: Tenant[] | undefined;
|
|
@@ -394,7 +399,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
394
399
|
isSuccess: true;
|
|
395
400
|
isFetching: true;
|
|
396
401
|
error: undefined;
|
|
397
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
402
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
403
|
+
username?: string;
|
|
404
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
398
405
|
attempt?: number;
|
|
399
406
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
400
407
|
currentData?: Tenant[] | undefined;
|
|
@@ -407,7 +414,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
407
414
|
isSuccess: true;
|
|
408
415
|
isFetching: false;
|
|
409
416
|
error: undefined;
|
|
410
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
417
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
418
|
+
username?: string;
|
|
419
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
411
420
|
attempt?: number;
|
|
412
421
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
413
422
|
currentData?: Tenant[] | undefined;
|
|
@@ -418,7 +427,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
418
427
|
isError: false;
|
|
419
428
|
}, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
|
|
420
429
|
isError: true;
|
|
421
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
430
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
431
|
+
username?: string;
|
|
432
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
422
433
|
attempt?: number;
|
|
423
434
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
424
435
|
currentData?: Tenant[] | undefined;
|
|
@@ -429,7 +440,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
429
440
|
isError: false;
|
|
430
441
|
}, "error">>)>> & {
|
|
431
442
|
status: import("@reduxjs/toolkit/query").QueryStatus;
|
|
432
|
-
}>(arg: void |
|
|
443
|
+
}>(arg: void | {
|
|
444
|
+
username?: string;
|
|
445
|
+
} | typeof import("@reduxjs/toolkit/query").skipToken, options?: (import("@reduxjs/toolkit/query").SubscriptionOptions & {
|
|
433
446
|
skip?: boolean;
|
|
434
447
|
refetchOnMountOrArgChange?: boolean | number;
|
|
435
448
|
} & {
|
|
@@ -452,7 +465,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
452
465
|
isError: false;
|
|
453
466
|
}, "isUninitialized"> & {
|
|
454
467
|
isUninitialized: true;
|
|
455
|
-
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
468
|
+
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
469
|
+
username?: string;
|
|
470
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
456
471
|
attempt?: number;
|
|
457
472
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
458
473
|
currentData?: Tenant[] | undefined;
|
|
@@ -469,7 +484,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
469
484
|
isSuccess: true;
|
|
470
485
|
isFetching: true;
|
|
471
486
|
error: undefined;
|
|
472
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
487
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
488
|
+
username?: string;
|
|
489
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
473
490
|
attempt?: number;
|
|
474
491
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
475
492
|
currentData?: Tenant[] | undefined;
|
|
@@ -482,7 +499,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
482
499
|
isSuccess: true;
|
|
483
500
|
isFetching: false;
|
|
484
501
|
error: undefined;
|
|
485
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
502
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
503
|
+
username?: string;
|
|
504
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
486
505
|
attempt?: number;
|
|
487
506
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
488
507
|
currentData?: Tenant[] | undefined;
|
|
@@ -493,7 +512,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
493
512
|
isError: false;
|
|
494
513
|
}, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
|
|
495
514
|
isError: true;
|
|
496
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
515
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
516
|
+
username?: string;
|
|
517
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
497
518
|
attempt?: number;
|
|
498
519
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
499
520
|
currentData?: Tenant[] | undefined;
|
|
@@ -506,7 +527,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
506
527
|
status: import("@reduxjs/toolkit/query").QueryStatus;
|
|
507
528
|
}) => R) | undefined;
|
|
508
529
|
}) | undefined) => [R][R extends any ? 0 : never] & {
|
|
509
|
-
refetch: () => import("@reduxjs/toolkit/query").QueryActionCreatorResult<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
530
|
+
refetch: () => import("@reduxjs/toolkit/query").QueryActionCreatorResult<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
531
|
+
username?: string;
|
|
532
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
510
533
|
attempt?: number;
|
|
511
534
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>>;
|
|
512
535
|
}, useLazyGetUserTenantsQuery: <R extends Record<string, any> = import("@reduxjs/toolkit/query").TSHelpersId<(Omit<{
|
|
@@ -527,7 +550,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
527
550
|
isError: false;
|
|
528
551
|
}, "isUninitialized"> & {
|
|
529
552
|
isUninitialized: true;
|
|
530
|
-
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
553
|
+
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
554
|
+
username?: string;
|
|
555
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
531
556
|
attempt?: number;
|
|
532
557
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
533
558
|
currentData?: Tenant[] | undefined;
|
|
@@ -544,7 +569,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
544
569
|
isSuccess: true;
|
|
545
570
|
isFetching: true;
|
|
546
571
|
error: undefined;
|
|
547
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
572
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
573
|
+
username?: string;
|
|
574
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
548
575
|
attempt?: number;
|
|
549
576
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
550
577
|
currentData?: Tenant[] | undefined;
|
|
@@ -557,7 +584,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
557
584
|
isSuccess: true;
|
|
558
585
|
isFetching: false;
|
|
559
586
|
error: undefined;
|
|
560
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
587
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
588
|
+
username?: string;
|
|
589
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
561
590
|
attempt?: number;
|
|
562
591
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
563
592
|
currentData?: Tenant[] | undefined;
|
|
@@ -568,7 +597,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
568
597
|
isError: false;
|
|
569
598
|
}, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
|
|
570
599
|
isError: true;
|
|
571
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
600
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
601
|
+
username?: string;
|
|
602
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
572
603
|
attempt?: number;
|
|
573
604
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
574
605
|
currentData?: Tenant[] | undefined;
|
|
@@ -599,7 +630,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
599
630
|
isError: false;
|
|
600
631
|
}, "isUninitialized"> & {
|
|
601
632
|
isUninitialized: true;
|
|
602
|
-
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
633
|
+
}) | import("@reduxjs/toolkit/query").TSHelpersOverride<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
634
|
+
username?: string;
|
|
635
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
603
636
|
attempt?: number;
|
|
604
637
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
605
638
|
currentData?: Tenant[] | undefined;
|
|
@@ -616,7 +649,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
616
649
|
isSuccess: true;
|
|
617
650
|
isFetching: true;
|
|
618
651
|
error: undefined;
|
|
619
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
652
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
653
|
+
username?: string;
|
|
654
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
620
655
|
attempt?: number;
|
|
621
656
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
622
657
|
currentData?: Tenant[] | undefined;
|
|
@@ -629,7 +664,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
629
664
|
isSuccess: true;
|
|
630
665
|
isFetching: false;
|
|
631
666
|
error: undefined;
|
|
632
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
667
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
668
|
+
username?: string;
|
|
669
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
633
670
|
attempt?: number;
|
|
634
671
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
635
672
|
currentData?: Tenant[] | undefined;
|
|
@@ -640,7 +677,9 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
640
677
|
isError: false;
|
|
641
678
|
}, "data" | "fulfilledTimeStamp" | "currentData">>) | ({
|
|
642
679
|
isError: true;
|
|
643
|
-
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void
|
|
680
|
+
} & Required<Pick<import("@reduxjs/toolkit/query").QuerySubState<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
681
|
+
username?: string;
|
|
682
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
644
683
|
attempt?: number;
|
|
645
684
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>> & {
|
|
646
685
|
currentData?: Tenant[] | undefined;
|
|
@@ -652,12 +691,18 @@ export declare const useGetTenantMetadataQuery: <R extends Record<string, any> =
|
|
|
652
691
|
}, "error">>)>> & {
|
|
653
692
|
status: import("@reduxjs/toolkit/query").QueryStatus;
|
|
654
693
|
}) => R) | undefined;
|
|
655
|
-
}, "skip">) | undefined) => [(arg: void
|
|
694
|
+
}, "skip">) | undefined) => [(arg: void | {
|
|
695
|
+
username?: string;
|
|
696
|
+
}, preferCacheValue?: boolean) => import("@reduxjs/toolkit/query").QueryActionCreatorResult<import("@reduxjs/toolkit/query").QueryDefinition<void | {
|
|
697
|
+
username?: string;
|
|
698
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, unknown, unknown, {
|
|
656
699
|
attempt?: number;
|
|
657
700
|
} & import("@reduxjs/toolkit/query").RetryOptions, {}>, string, Tenant[], "tenantApiSlice", unknown>>, [R][R extends any ? 0 : never] & {
|
|
658
701
|
reset: () => void;
|
|
659
702
|
}, {
|
|
660
|
-
lastArg: void
|
|
703
|
+
lastArg: void | {
|
|
704
|
+
username?: string;
|
|
705
|
+
};
|
|
661
706
|
}], useUpdateTenantMetadataMutation: <R extends Record<string, any> = ({
|
|
662
707
|
requestId?: undefined;
|
|
663
708
|
status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import type { UserProfile, GetUserMetadataArgs, ResetPasswordArgs, UpdateUserRoleRequest, UpdateUserAccountRequest, UploadProfileImageResponse, RemoveProfileImageResponse, UserPlatformMetadata, GetUserPlatformMetadataArgs, UpdateUserPlatformMetadataArgs, UserRole, GetUserRolesArgs, UserProfileSummary, GetUserProfileSummaryArgs } from './types';
|
|
1
|
+
import type { UserProfile, GetUserMetadataArgs, ResetPasswordArgs, UpdateUserRoleRequest, UpdatePlatformAdminRequest, UpdateUserAccountRequest, UploadProfileImageResponse, RemoveProfileImageResponse, UserPlatformMetadata, GetUserPlatformMetadataArgs, UpdateUserPlatformMetadataArgs, UserRole, GetUserRolesArgs, UserProfileSummary, GetUserProfileSummaryArgs } from './types';
|
|
2
2
|
export declare const userApiSlice: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, {
|
|
3
3
|
getUserMetadata: import("@reduxjs/toolkit/query").QueryDefinition<GetUserMetadataArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, UserProfile, "userApiSlice", unknown>;
|
|
4
4
|
updateUserMetadata: import("@reduxjs/toolkit/query").MutationDefinition<UserProfile, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, unknown, "userApiSlice", unknown>;
|
|
5
5
|
updateUserAccount: import("@reduxjs/toolkit/query").MutationDefinition<UpdateUserAccountRequest, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, unknown, "userApiSlice", unknown>;
|
|
6
6
|
resetPassword: import("@reduxjs/toolkit/query").MutationDefinition<ResetPasswordArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, void, "userApiSlice", unknown>;
|
|
7
|
-
updateUserRole: import("@reduxjs/toolkit/query").MutationDefinition<UpdateUserRoleRequest, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, unknown, "userApiSlice", unknown>;
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
8
|
+
* Make a user a platform admin, or demote them. Takes the DM platform-link
|
|
9
|
+
* shape (`user_id`, `platform_key`, `is_admin`); DM syncs the edX org role.
|
|
10
|
+
* The legacy `{ username, org, role, active }` shape still writes the edX
|
|
11
|
+
* role directly and is deprecated.
|
|
12
|
+
*/
|
|
13
|
+
updateUserRole: import("@reduxjs/toolkit/query").MutationDefinition<UpdateUserRoleRequest | UpdatePlatformAdminRequest, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, unknown, "userApiSlice", unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* The signed-in user's course access roles (`course-staff`,
|
|
16
|
+
* `course-instructor`, ...) plus a global `staff` row when they are edX
|
|
17
|
+
* staff, from the edX enrollment roles API through DM's proxy. A user with
|
|
18
|
+
* no roles returns `[]`. Org-wide roles are not listed here: DM holds them
|
|
19
|
+
* on the user's platform link.
|
|
18
20
|
*/
|
|
19
21
|
getUserRoles: import("@reduxjs/toolkit/query").QueryDefinition<GetUserRolesArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, UserRole[], "userApiSlice", unknown>;
|
|
20
22
|
getUserMetadataEdx: import("@reduxjs/toolkit/query").QueryDefinition<GetUserMetadataArgs, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, Partial<UserProfile>, "userApiSlice", unknown>;
|
|
@@ -941,8 +943,8 @@ export declare const useGetUserMetadataQuery: <R extends Record<string, any> = i
|
|
|
941
943
|
isError: true;
|
|
942
944
|
})) => R) | undefined;
|
|
943
945
|
fixedCacheKey?: string;
|
|
944
|
-
} | undefined) => readonly [(arg: UpdateUserRoleRequest) => import("@reduxjs/toolkit/query").MutationActionCreatorResult<import("@reduxjs/toolkit/query").MutationDefinition<UpdateUserRoleRequest, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, unknown, "userApiSlice", unknown>>, import("@reduxjs/toolkit/query").TSHelpersNoInfer<R> & {
|
|
945
|
-
originalArgs?: UpdateUserRoleRequest | undefined;
|
|
946
|
+
} | undefined) => readonly [(arg: UpdateUserRoleRequest | UpdatePlatformAdminRequest) => import("@reduxjs/toolkit/query").MutationActionCreatorResult<import("@reduxjs/toolkit/query").MutationDefinition<UpdateUserRoleRequest | UpdatePlatformAdminRequest, import("@reduxjs/toolkit/query").BaseQueryFn<import("../utils").CustomQueryArgs, unknown, import("../utils").ExtendedFetchBaseQueryError, Record<string, unknown>, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, string, unknown, "userApiSlice", unknown>>, import("@reduxjs/toolkit/query").TSHelpersNoInfer<R> & {
|
|
947
|
+
originalArgs?: UpdateUserRoleRequest | UpdatePlatformAdminRequest | undefined;
|
|
946
948
|
reset: () => void;
|
|
947
949
|
}], useGetUserRolesQuery: <R extends Record<string, any> = import("@reduxjs/toolkit/query").TSHelpersId<(Omit<{
|
|
948
950
|
status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
|
|
@@ -4,6 +4,10 @@ export declare const USERS_ENDPOINTS: {
|
|
|
4
4
|
service: SERVICES;
|
|
5
5
|
path: () => string;
|
|
6
6
|
};
|
|
7
|
+
UPDATE_USER_METADATA: {
|
|
8
|
+
service: SERVICES;
|
|
9
|
+
path: () => string;
|
|
10
|
+
};
|
|
7
11
|
RESET_PASSWORD: {
|
|
8
12
|
service: SERVICES;
|
|
9
13
|
path: () => string;
|
|
@@ -12,9 +16,13 @@ export declare const USERS_ENDPOINTS: {
|
|
|
12
16
|
service: SERVICES;
|
|
13
17
|
path: () => string;
|
|
14
18
|
};
|
|
19
|
+
/** @deprecated The edX role write behind the legacy `{ username, org, role, active }` shape. */
|
|
20
|
+
UPDATE_USER_ROLES_EDX: {
|
|
21
|
+
service: SERVICES;
|
|
22
|
+
path: () => string;
|
|
23
|
+
};
|
|
15
24
|
GET_USER_ROLES: {
|
|
16
25
|
service: SERVICES;
|
|
17
|
-
lmsService: SERVICES;
|
|
18
26
|
path: () => string;
|
|
19
27
|
};
|
|
20
28
|
UPLOAD_PROFILE_IMAGE: {
|
|
@@ -44,11 +52,13 @@ export declare const USERS_ENDPOINTS: {
|
|
|
44
52
|
};
|
|
45
53
|
export declare const USERS_QUERY_KEYS: {
|
|
46
54
|
GET_USER_METADATA: () => string[];
|
|
55
|
+
UPDATE_USER_METADATA: () => string[];
|
|
47
56
|
GET_USER_PLATFORM_METADATA: () => string[];
|
|
48
57
|
GET_USER_METADATA_EDX: () => string[];
|
|
49
58
|
GET_USER_PROFILE_SUMMARY: () => string[];
|
|
50
59
|
RESET_PASSWORD: () => string[];
|
|
51
60
|
UPDATE_USER_ROLES: () => string[];
|
|
61
|
+
UPDATE_USER_ROLES_EDX: () => string[];
|
|
52
62
|
GET_USER_ROLES: () => string[];
|
|
53
63
|
UPLOAD_PROFILE_IMAGE: () => string[];
|
|
54
64
|
EDX_UPDATE_USER_METADATA: () => string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EdxUserRolesResponse, UserRole } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Maps the edX enrollment roles API (`GET /api/enrollment/v1/roles/`) onto the
|
|
4
|
+
* `UserRole[]` shape the plugin listing returned: course rows become
|
|
5
|
+
* `course-<role>`, org rows `org-<role>`, and the global `is_staff` flag a
|
|
6
|
+
* `staff` row. The edX API only lists `CourseAccessRole` rows, so org-wide
|
|
7
|
+
* roles granted on the DM side (platform admin / staff) are not included.
|
|
8
|
+
*/
|
|
9
|
+
export declare const mapEdxUserRoles: (response: EdxUserRolesResponse | null | undefined) => UserRole[];
|
|
@@ -134,12 +134,22 @@ export interface UpdateUserAccountRequest {
|
|
|
134
134
|
enable_sidebar_ai_mentor_display?: boolean;
|
|
135
135
|
enable_skills_leaderboard_display?: boolean;
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated The edX role write. Use {@link UpdatePlatformAdminRequest}: DM
|
|
139
|
+
* sets the platform-admin flag and syncs the edX org role itself.
|
|
140
|
+
*/
|
|
137
141
|
export type UpdateUserRoleRequest = {
|
|
138
142
|
active: boolean;
|
|
139
143
|
org: string;
|
|
140
144
|
role: string;
|
|
141
145
|
username: string;
|
|
142
146
|
};
|
|
147
|
+
/** Platform-admin flag on a user's platform link (`POST /api/core/users/platforms/`). */
|
|
148
|
+
export type UpdatePlatformAdminRequest = {
|
|
149
|
+
user_id: number;
|
|
150
|
+
platform_key: string;
|
|
151
|
+
is_admin: boolean;
|
|
152
|
+
};
|
|
143
153
|
export interface UploadProfileImageResponse {
|
|
144
154
|
profile_image_url: string;
|
|
145
155
|
}
|
|
@@ -193,21 +203,26 @@ export interface UserRole {
|
|
|
193
203
|
/** Scope a {@link UserRole} applies to, derived from its `org`/`course` fields. */
|
|
194
204
|
export type UserRoleScope = 'global' | 'org' | 'course';
|
|
195
205
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* Non-staff users may only look up their own roles; requesting another user's
|
|
200
|
-
* roles yields 404.
|
|
206
|
+
* Args for the role listing. The edX enrollment roles API behind it only ever
|
|
207
|
+
* answers for the signed-in user, so the identifiers are accepted for
|
|
208
|
+
* compatibility with the plugin endpoint it replaced and are not sent.
|
|
201
209
|
*/
|
|
202
210
|
export interface GetUserRolesArgs {
|
|
211
|
+
/** @deprecated The listing is always the caller's own roles. */
|
|
203
212
|
username?: string;
|
|
213
|
+
/** @deprecated The listing is always the caller's own roles. */
|
|
204
214
|
email?: string;
|
|
205
|
-
/**
|
|
215
|
+
/** @deprecated The listing is always the caller's own roles. */
|
|
206
216
|
userId?: number;
|
|
207
|
-
/**
|
|
208
|
-
* Query the deprecated LMS host instead of CMS/Studio. Only needed on
|
|
209
|
-
* deployments without a reachable Studio host; course-creation roles are not
|
|
210
|
-
* fully resolvable there.
|
|
211
|
-
*/
|
|
217
|
+
/** @deprecated The listing comes from the LMS (through DM's proxy) on every deployment. */
|
|
212
218
|
useLms?: boolean;
|
|
213
219
|
}
|
|
220
|
+
/** `GET /api/enrollment/v1/roles/`: the caller's course access roles and global staff flag. */
|
|
221
|
+
export interface EdxUserRolesResponse {
|
|
222
|
+
roles: {
|
|
223
|
+
role: string;
|
|
224
|
+
org: string;
|
|
225
|
+
course_id: string;
|
|
226
|
+
}[];
|
|
227
|
+
is_staff: boolean;
|
|
228
|
+
}
|
|
@@ -5,10 +5,22 @@ type CustomError = {
|
|
|
5
5
|
status: number;
|
|
6
6
|
error: string | object;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* True when `service` is `LMS` or `STUDIO` and `Config.edxProxyEnabled` sends
|
|
10
|
+
* it through DM's edX proxy with the DM token.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isEdxProxied: (service: SERVICES) => boolean;
|
|
8
13
|
/**
|
|
9
14
|
* Get the service URL based on the provided service type.
|
|
10
15
|
*/
|
|
11
16
|
export declare const getServiceUrl: (service: SERVICES) => string;
|
|
17
|
+
/**
|
|
18
|
+
* The signed-in user's username from storage (`userData.user_nicename`), or
|
|
19
|
+
* null. DM's user endpoints take `username=<self>` explicitly where the edX
|
|
20
|
+
* ones inferred the caller from the JWT, so the endpoints that moved to DM
|
|
21
|
+
* read it from here when the caller does not pass one.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getStoredUsername: () => Promise<string | null>;
|
|
12
24
|
/**
|
|
13
25
|
* Read a cookie value by name. Returns null outside the browser or when the
|
|
14
26
|
* cookie is absent. Used for Studio's CSRF token (`csrftoken`).
|
|
@@ -3,4 +3,7 @@ export declare const initializeDataLayer: (dmUrl: string, lmsUrl: string, legacy
|
|
|
3
3
|
status: number;
|
|
4
4
|
data?: unknown;
|
|
5
5
|
message?: string;
|
|
6
|
-
}) => void>, studioUrl?: string, refreshAuthToken?: () => Promise<boolean
|
|
6
|
+
}) => void>, studioUrl?: string, refreshAuthToken?: () => Promise<boolean>, options?: {
|
|
7
|
+
/** Send LMS/Studio calls through DM's edX proxy; see `Config.edxProxyEnabled`. */
|
|
8
|
+
edxProxy?: boolean;
|
|
9
|
+
}) => void;
|