dce-reactkit 3.12.3 → 4.0.0-beta.1

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.
Files changed (71) hide show
  1. package/.vscode/settings.json +1 -3
  2. package/README.md +20 -0
  3. package/dist/cjs/index.js +156 -1792
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/types/components/ItemPicker/index.d.ts +0 -1
  6. package/dist/cjs/types/components/Modal/ModalProps.d.ts +0 -2
  7. package/dist/cjs/types/components/TabBox.d.ts +0 -1
  8. package/dist/cjs/types/index.d.ts +8 -12
  9. package/dist/cjs/types/types/ParamType.d.ts +10 -10
  10. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +1 -15
  11. package/dist/esm/index.js +157 -1785
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/types/components/ItemPicker/index.d.ts +0 -1
  14. package/dist/esm/types/components/Modal/ModalProps.d.ts +0 -2
  15. package/dist/esm/types/components/TabBox.d.ts +0 -1
  16. package/dist/esm/types/index.d.ts +8 -12
  17. package/dist/esm/types/types/ParamType.d.ts +10 -10
  18. package/dist/esm/types/types/ReactKitErrorCode.d.ts +1 -15
  19. package/dist/index.d.ts +122 -351
  20. package/genEncodedSecret.ts +84 -0
  21. package/package.json +7 -5
  22. package/rollup.config.js +2 -0
  23. package/src/components/AppWrapper.tsx +3 -1
  24. package/src/components/CheckboxButton.tsx +1 -1
  25. package/src/components/Dropdown.tsx +1 -1
  26. package/src/components/IntelliTable.tsx +1 -1
  27. package/src/components/ItemPicker/NestableItemList.tsx +0 -1
  28. package/src/components/ItemPicker/index.tsx +0 -96
  29. package/src/components/Modal/ModalProps.ts +0 -4
  30. package/src/components/Modal/index.tsx +21 -60
  31. package/src/components/RadioButton.tsx +3 -1
  32. package/src/components/TabBox.tsx +9 -27
  33. package/src/{client → helpers}/initClient.tsx +5 -1
  34. package/src/helpers/logClientEvent.tsx +3 -1
  35. package/src/helpers/visitServerEndpoint.tsx +1 -1
  36. package/src/index.ts +12 -22
  37. package/src/types/ParamType.ts +10 -10
  38. package/src/types/ReactKitErrorCode.tsx +1 -17
  39. package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +0 -41
  40. package/dist/cjs/types/helpers/genRouteHandler.d.ts +0 -76
  41. package/dist/cjs/types/helpers/getWordCount.d.ts +0 -10
  42. package/dist/cjs/types/helpers/handleError.d.ts +0 -18
  43. package/dist/cjs/types/helpers/handleSuccess.d.ts +0 -8
  44. package/dist/cjs/types/helpers/parseUserAgent.d.ts +0 -17
  45. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -24
  46. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
  47. package/dist/cjs/types/server/initLogCollection.d.ts +0 -8
  48. package/dist/cjs/types/server/initServer.d.ts +0 -42
  49. package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +0 -41
  50. package/dist/esm/types/helpers/genRouteHandler.d.ts +0 -76
  51. package/dist/esm/types/helpers/getWordCount.d.ts +0 -10
  52. package/dist/esm/types/helpers/handleError.d.ts +0 -18
  53. package/dist/esm/types/helpers/handleSuccess.d.ts +0 -8
  54. package/dist/esm/types/helpers/parseUserAgent.d.ts +0 -17
  55. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -24
  56. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
  57. package/dist/esm/types/server/initLogCollection.d.ts +0 -8
  58. package/dist/esm/types/server/initServer.d.ts +0 -42
  59. package/src/components/ItemPicker/index.test.tsx +0 -783
  60. package/src/helpers/addDBEditorEndpoints.ts +0 -128
  61. package/src/helpers/genRouteHandler.ts +0 -948
  62. package/src/helpers/getWordCount.ts +0 -26
  63. package/src/helpers/handleError.ts +0 -65
  64. package/src/helpers/handleSuccess.ts +0 -18
  65. package/src/helpers/parseUserAgent.ts +0 -108
  66. package/src/helpers/visitEndpointOnAnotherServer/index.ts +0 -93
  67. package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +0 -164
  68. package/src/server/initLogCollection.ts +0 -27
  69. package/src/server/initServer.ts +0 -287
  70. /package/dist/cjs/types/{client → helpers}/initClient.d.ts +0 -0
  71. /package/dist/esm/types/{client → helpers}/initClient.d.ts +0 -0
@@ -1,41 +0,0 @@
1
- import express from 'express';
2
- /**
3
- * Interface for a collection in the database
4
- * @author Yuen Ler Chow
5
- */
6
- type DCEMangoCollection = {
7
- /**
8
- * Find all items in the collection that match the filter query
9
- * @param filterQuery query for the filter
10
- * @returns list of items that match the filter query
11
- */
12
- find: (filterQuery: any) => Promise<any[]>;
13
- /**
14
- * Insert an item into the collection
15
- * @param item the item to insert
16
- */
17
- insert: (item: any) => Promise<void>;
18
- /**
19
- * Delete an item in the collection
20
- * @param id the id of the item to delete
21
- */
22
- delete: (filterQuery: {
23
- id: string;
24
- }) => Promise<void>;
25
- };
26
- /**
27
- * Add all routes for the DBEditor
28
- * @author Yuen Ler Chow
29
- * @param opts object containing all arguments
30
- * @param opts.app express app to add routes too
31
- * @param opts.collectionName the name of the collection
32
- * @param opts.adminsOnly true if the endpoint is for admins only
33
- * @param opts.collection dce-mango db collection
34
- */
35
- declare const addDBEditorEndpoints: (opts: {
36
- app: express.Application;
37
- collectionName: string;
38
- adminsOnly: boolean;
39
- collection: DCEMangoCollection;
40
- }) => void;
41
- export default addDBEditorEndpoints;
@@ -1,76 +0,0 @@
1
- import ParamType from '../types/ParamType';
2
- import LogFunction from '../types/LogFunction';
3
- /**
4
- * Generate an express API route handler
5
- * @author Gabe Abrams
6
- * @param opts object containing all arguments
7
- * @param opts.paramTypes map containing the types for each parameter that is
8
- * included in the request (map: param name => type)
9
- * @param opts.handler function that processes the request
10
- * @param [opts.skipSessionCheck] if true, skip the session check (allow users
11
- * to not be logged in and launched via LTI)
12
- * @param [opts.allowedHosts] if included, only allow requests from these hosts
13
- * (start a hostname with a "*" to only check the end of the hostname)
14
- * you can include just one string instead of an array
15
- * @param [opts.bannedHosts] if included, do not allow requests from these hosts
16
- * (start a hostname with a "*" to only check the end of the hostname)
17
- * you can include just one string instead of an array
18
- * @param [opts.unhandledErrorMessagePrefix] if included, when an error that
19
- * is not of type ErrorWithCode is thrown, the client will receive an error
20
- * where the error message is prefixed with this string. For example,
21
- * if unhandledErrorMessagePrefix is
22
- * 'While saving progress, we encountered an error:'
23
- * and the error is 'progressInfo is not an object',
24
- * the client will receive an error with the message
25
- * 'While saving progress, we encountered an error: progressInfo is not an object'
26
- * @returns express route handler that takes the following arguments:
27
- * params (map: param name => value),
28
- * req (express request object),
29
- * next (express next function),
30
- * send (a function that sends a string to the client),
31
- * redirect (takes a url and redirects the user to that url),
32
- * renderErrorPage (shows a static error page to the user),
33
- * renderInfoPage (shows a static info page to the user),
34
- * renderCustomHTML (renders custom html and sends it to the user),
35
- * and returns the value to send to the client as a JSON API response, or
36
- * calls next() or redirect(...) or send(...) or renderErrorPage(...).
37
- * Note: params also has userId, userFirstName,
38
- * userLastName, userEmail, userAvatarURL, isLearner, isTTM, isAdmin,
39
- * and any other variables that
40
- * are directly added to the session, if the user does have a session.
41
- */
42
- declare const genRouteHandler: (opts: {
43
- paramTypes?: {
44
- [k: string]: ParamType;
45
- } | undefined;
46
- handler: (opts: {
47
- params: {
48
- [k: string]: any;
49
- };
50
- req: any;
51
- next: () => void;
52
- redirect: (pathOrURL: string) => void;
53
- send: (text: string, status?: number) => void;
54
- renderErrorPage: (opts?: {
55
- title?: string;
56
- description?: string;
57
- code?: string;
58
- pageTitle?: string;
59
- status?: number;
60
- }) => void;
61
- renderInfoPage: (opts: {
62
- title: string;
63
- body: string;
64
- }) => void;
65
- renderCustomHTML: (opts: {
66
- html: string;
67
- status?: number;
68
- }) => void;
69
- logServerEvent: LogFunction;
70
- }) => any;
71
- skipSessionCheck?: boolean | undefined;
72
- allowedHosts?: string | string[] | undefined;
73
- bannedHosts?: string | string[] | undefined;
74
- unhandledErrorMessagePrefix?: string | undefined;
75
- }) => (req: any, res: any, next: () => void) => Promise<undefined>;
76
- export default genRouteHandler;
@@ -1,10 +0,0 @@
1
- /**
2
- * Get number of words in string
3
- * @author Gardenia Liu
4
- * @author Allison Zhang
5
- * @author Gabe Abrams
6
- * @param text the string to check
7
- * @returns number of words in the string
8
- */
9
- declare const getWordCount: (text: string) => number;
10
- export default getWordCount;
@@ -1,18 +0,0 @@
1
- /**
2
- * Handle an error and respond to the client
3
- * @author Gabe Abrams
4
- * @param res express response
5
- * @param error error info
6
- * @param opts.err the error to send to the client
7
- * or the error message
8
- * @param [opts.code] an error code (only used if err.code is not
9
- * included)
10
- * @param [opts.status=500] the https status code to use
11
- * defined)
12
- */
13
- declare const handleError: (res: any, error: ({
14
- message: any;
15
- code?: string;
16
- status?: number;
17
- } | Error | string | any)) => undefined;
18
- export default handleError;
@@ -1,8 +0,0 @@
1
- /**
2
- * Send successful API response
3
- * @author Gabe Abrams
4
- * @param res express response
5
- * @param body the body of the response to send to the client
6
- */
7
- declare const handleSuccess: (res: any, body: any) => undefined;
8
- export default handleSuccess;
@@ -1,17 +0,0 @@
1
- /**
2
- * Perform a rudimentary parsing of the user's browser agent string
3
- * @author Gabe Abrams
4
- * @param userAgent the user's browser agent
5
- * @returns user info
6
- */
7
- declare const parseUserAgent: (userAgent: string) => {
8
- browser: {
9
- name: string;
10
- version: string;
11
- };
12
- device: {
13
- isMobile: boolean;
14
- os: string;
15
- };
16
- };
17
- export default parseUserAgent;
@@ -1,24 +0,0 @@
1
- /**
2
- * Send a server-to-server request from this sever to another server that uses
3
- * dce-reactkit [for server only]
4
- * @author Gabe Abrams
5
- * @param opts object containing all arguments
6
- * @param opts.host - the host of the other server
7
- * @param opts.path - the path of the other server's endpoint
8
- * @param [opts.method=GET] - the method of the endpoint
9
- * @param [opts.params] - query/body parameters to include
10
- * @param [opts.headers] - headers to include
11
- * @returns response from server
12
- */
13
- declare const visitEndpointOnAnotherServer: (opts: {
14
- host: string;
15
- path: string;
16
- method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
17
- params?: {
18
- [x: string]: any;
19
- } | undefined;
20
- headers?: {
21
- [x: string]: any;
22
- } | undefined;
23
- }) => Promise<any>;
24
- export default visitEndpointOnAnotherServer;
@@ -1,33 +0,0 @@
1
- /**
2
- * Sends and retries an http request
3
- * @author Gabriel Abrams
4
- * @param opts object containing all arguments
5
- * @param opts.path path to send request to
6
- * @param [opts.host] host to send request to
7
- * @param [opts.method=GET] http method to use
8
- * @param [opts.params] body/data to include in the request
9
- * @param [opts.headers] headers to include in the request
10
- * @param [opts.sendCrossDomainCredentials=true if in development mode] if true,
11
- * send cross-domain credentials even if not in dev mode
12
- * @param [opts.responseType=JSON] expected response type
13
- * @returns { body, status, headers } on success
14
- */
15
- declare const sendServerToServerRequest: (opts: {
16
- path: string;
17
- host?: string | undefined;
18
- method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
19
- params?: {
20
- [x: string]: any;
21
- } | undefined;
22
- headers?: {
23
- [x: string]: any;
24
- } | undefined;
25
- responseType?: "Text" | "JSON" | undefined;
26
- }) => Promise<{
27
- body: any;
28
- status: number;
29
- headers: {
30
- [x: string]: any;
31
- };
32
- }>;
33
- export default sendServerToServerRequest;
@@ -1,8 +0,0 @@
1
- /**
2
- * Initialize a log collection given the dce-mango Collection class
3
- * @author Gabe Abrams
4
- * @param Collection the Collection class from dce-mango
5
- * @returns initialized logCollection
6
- */
7
- declare const initLogCollection: (Collection: any) => any;
8
- export default initLogCollection;
@@ -1,42 +0,0 @@
1
- type GetLaunchInfoFunction = (req: any) => {
2
- launched: boolean;
3
- launchInfo?: any;
4
- };
5
- /**
6
- * Get launch info via CACCL
7
- * @author Gabe Abrams
8
- * @param req express request object
9
- * @returns object { launched, launchInfo }
10
- */
11
- export declare const cacclGetLaunchInfo: GetLaunchInfoFunction;
12
- /**
13
- * Get log collection
14
- * @author Gabe Abrams
15
- * @returns log collection if one was included during launch or null if we don't
16
- * have a log collection (yet)
17
- */
18
- export declare const internalGetLogCollection: () => any;
19
- /**
20
- * Prepare dce-reactkit to run on the server
21
- * @author Gabe Abrams
22
- * @param opts object containing all arguments
23
- * @param opts.app express app from inside of the postprocessor function that
24
- * we will add routes to
25
- * @param opts.getLaunchInfo CACCL LTI's get launch info function
26
- * @param [opts.logCollection] mongo collection from dce-mango to use for
27
- * storing logs. If none is included, logs are written to the console
28
- * @param [opts.logReviewAdmins=all] info on which admins can review
29
- * logs from the client. If not included, all Canvas admins are allowed to
30
- * review logs. If null, no Canvas admins are allowed to review logs.
31
- * If an array of Canvas userIds (numbers), only Canvas admins with those
32
- * userIds are allowed to review logs. If a dce-mango collection, only
33
- * Canvas admins with entries in that collection ({ userId, ...}) are allowed
34
- * to review logs
35
- */
36
- declare const initServer: (opts: {
37
- app: any;
38
- getLaunchInfo: GetLaunchInfoFunction;
39
- logCollection?: any;
40
- logReviewAdmins?: (number[] | any);
41
- }) => void;
42
- export default initServer;
@@ -1,41 +0,0 @@
1
- import express from 'express';
2
- /**
3
- * Interface for a collection in the database
4
- * @author Yuen Ler Chow
5
- */
6
- type DCEMangoCollection = {
7
- /**
8
- * Find all items in the collection that match the filter query
9
- * @param filterQuery query for the filter
10
- * @returns list of items that match the filter query
11
- */
12
- find: (filterQuery: any) => Promise<any[]>;
13
- /**
14
- * Insert an item into the collection
15
- * @param item the item to insert
16
- */
17
- insert: (item: any) => Promise<void>;
18
- /**
19
- * Delete an item in the collection
20
- * @param id the id of the item to delete
21
- */
22
- delete: (filterQuery: {
23
- id: string;
24
- }) => Promise<void>;
25
- };
26
- /**
27
- * Add all routes for the DBEditor
28
- * @author Yuen Ler Chow
29
- * @param opts object containing all arguments
30
- * @param opts.app express app to add routes too
31
- * @param opts.collectionName the name of the collection
32
- * @param opts.adminsOnly true if the endpoint is for admins only
33
- * @param opts.collection dce-mango db collection
34
- */
35
- declare const addDBEditorEndpoints: (opts: {
36
- app: express.Application;
37
- collectionName: string;
38
- adminsOnly: boolean;
39
- collection: DCEMangoCollection;
40
- }) => void;
41
- export default addDBEditorEndpoints;
@@ -1,76 +0,0 @@
1
- import ParamType from '../types/ParamType';
2
- import LogFunction from '../types/LogFunction';
3
- /**
4
- * Generate an express API route handler
5
- * @author Gabe Abrams
6
- * @param opts object containing all arguments
7
- * @param opts.paramTypes map containing the types for each parameter that is
8
- * included in the request (map: param name => type)
9
- * @param opts.handler function that processes the request
10
- * @param [opts.skipSessionCheck] if true, skip the session check (allow users
11
- * to not be logged in and launched via LTI)
12
- * @param [opts.allowedHosts] if included, only allow requests from these hosts
13
- * (start a hostname with a "*" to only check the end of the hostname)
14
- * you can include just one string instead of an array
15
- * @param [opts.bannedHosts] if included, do not allow requests from these hosts
16
- * (start a hostname with a "*" to only check the end of the hostname)
17
- * you can include just one string instead of an array
18
- * @param [opts.unhandledErrorMessagePrefix] if included, when an error that
19
- * is not of type ErrorWithCode is thrown, the client will receive an error
20
- * where the error message is prefixed with this string. For example,
21
- * if unhandledErrorMessagePrefix is
22
- * 'While saving progress, we encountered an error:'
23
- * and the error is 'progressInfo is not an object',
24
- * the client will receive an error with the message
25
- * 'While saving progress, we encountered an error: progressInfo is not an object'
26
- * @returns express route handler that takes the following arguments:
27
- * params (map: param name => value),
28
- * req (express request object),
29
- * next (express next function),
30
- * send (a function that sends a string to the client),
31
- * redirect (takes a url and redirects the user to that url),
32
- * renderErrorPage (shows a static error page to the user),
33
- * renderInfoPage (shows a static info page to the user),
34
- * renderCustomHTML (renders custom html and sends it to the user),
35
- * and returns the value to send to the client as a JSON API response, or
36
- * calls next() or redirect(...) or send(...) or renderErrorPage(...).
37
- * Note: params also has userId, userFirstName,
38
- * userLastName, userEmail, userAvatarURL, isLearner, isTTM, isAdmin,
39
- * and any other variables that
40
- * are directly added to the session, if the user does have a session.
41
- */
42
- declare const genRouteHandler: (opts: {
43
- paramTypes?: {
44
- [k: string]: ParamType;
45
- } | undefined;
46
- handler: (opts: {
47
- params: {
48
- [k: string]: any;
49
- };
50
- req: any;
51
- next: () => void;
52
- redirect: (pathOrURL: string) => void;
53
- send: (text: string, status?: number) => void;
54
- renderErrorPage: (opts?: {
55
- title?: string;
56
- description?: string;
57
- code?: string;
58
- pageTitle?: string;
59
- status?: number;
60
- }) => void;
61
- renderInfoPage: (opts: {
62
- title: string;
63
- body: string;
64
- }) => void;
65
- renderCustomHTML: (opts: {
66
- html: string;
67
- status?: number;
68
- }) => void;
69
- logServerEvent: LogFunction;
70
- }) => any;
71
- skipSessionCheck?: boolean | undefined;
72
- allowedHosts?: string | string[] | undefined;
73
- bannedHosts?: string | string[] | undefined;
74
- unhandledErrorMessagePrefix?: string | undefined;
75
- }) => (req: any, res: any, next: () => void) => Promise<undefined>;
76
- export default genRouteHandler;
@@ -1,10 +0,0 @@
1
- /**
2
- * Get number of words in string
3
- * @author Gardenia Liu
4
- * @author Allison Zhang
5
- * @author Gabe Abrams
6
- * @param text the string to check
7
- * @returns number of words in the string
8
- */
9
- declare const getWordCount: (text: string) => number;
10
- export default getWordCount;
@@ -1,18 +0,0 @@
1
- /**
2
- * Handle an error and respond to the client
3
- * @author Gabe Abrams
4
- * @param res express response
5
- * @param error error info
6
- * @param opts.err the error to send to the client
7
- * or the error message
8
- * @param [opts.code] an error code (only used if err.code is not
9
- * included)
10
- * @param [opts.status=500] the https status code to use
11
- * defined)
12
- */
13
- declare const handleError: (res: any, error: ({
14
- message: any;
15
- code?: string;
16
- status?: number;
17
- } | Error | string | any)) => undefined;
18
- export default handleError;
@@ -1,8 +0,0 @@
1
- /**
2
- * Send successful API response
3
- * @author Gabe Abrams
4
- * @param res express response
5
- * @param body the body of the response to send to the client
6
- */
7
- declare const handleSuccess: (res: any, body: any) => undefined;
8
- export default handleSuccess;
@@ -1,17 +0,0 @@
1
- /**
2
- * Perform a rudimentary parsing of the user's browser agent string
3
- * @author Gabe Abrams
4
- * @param userAgent the user's browser agent
5
- * @returns user info
6
- */
7
- declare const parseUserAgent: (userAgent: string) => {
8
- browser: {
9
- name: string;
10
- version: string;
11
- };
12
- device: {
13
- isMobile: boolean;
14
- os: string;
15
- };
16
- };
17
- export default parseUserAgent;
@@ -1,24 +0,0 @@
1
- /**
2
- * Send a server-to-server request from this sever to another server that uses
3
- * dce-reactkit [for server only]
4
- * @author Gabe Abrams
5
- * @param opts object containing all arguments
6
- * @param opts.host - the host of the other server
7
- * @param opts.path - the path of the other server's endpoint
8
- * @param [opts.method=GET] - the method of the endpoint
9
- * @param [opts.params] - query/body parameters to include
10
- * @param [opts.headers] - headers to include
11
- * @returns response from server
12
- */
13
- declare const visitEndpointOnAnotherServer: (opts: {
14
- host: string;
15
- path: string;
16
- method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
17
- params?: {
18
- [x: string]: any;
19
- } | undefined;
20
- headers?: {
21
- [x: string]: any;
22
- } | undefined;
23
- }) => Promise<any>;
24
- export default visitEndpointOnAnotherServer;
@@ -1,33 +0,0 @@
1
- /**
2
- * Sends and retries an http request
3
- * @author Gabriel Abrams
4
- * @param opts object containing all arguments
5
- * @param opts.path path to send request to
6
- * @param [opts.host] host to send request to
7
- * @param [opts.method=GET] http method to use
8
- * @param [opts.params] body/data to include in the request
9
- * @param [opts.headers] headers to include in the request
10
- * @param [opts.sendCrossDomainCredentials=true if in development mode] if true,
11
- * send cross-domain credentials even if not in dev mode
12
- * @param [opts.responseType=JSON] expected response type
13
- * @returns { body, status, headers } on success
14
- */
15
- declare const sendServerToServerRequest: (opts: {
16
- path: string;
17
- host?: string | undefined;
18
- method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
19
- params?: {
20
- [x: string]: any;
21
- } | undefined;
22
- headers?: {
23
- [x: string]: any;
24
- } | undefined;
25
- responseType?: "Text" | "JSON" | undefined;
26
- }) => Promise<{
27
- body: any;
28
- status: number;
29
- headers: {
30
- [x: string]: any;
31
- };
32
- }>;
33
- export default sendServerToServerRequest;
@@ -1,8 +0,0 @@
1
- /**
2
- * Initialize a log collection given the dce-mango Collection class
3
- * @author Gabe Abrams
4
- * @param Collection the Collection class from dce-mango
5
- * @returns initialized logCollection
6
- */
7
- declare const initLogCollection: (Collection: any) => any;
8
- export default initLogCollection;
@@ -1,42 +0,0 @@
1
- type GetLaunchInfoFunction = (req: any) => {
2
- launched: boolean;
3
- launchInfo?: any;
4
- };
5
- /**
6
- * Get launch info via CACCL
7
- * @author Gabe Abrams
8
- * @param req express request object
9
- * @returns object { launched, launchInfo }
10
- */
11
- export declare const cacclGetLaunchInfo: GetLaunchInfoFunction;
12
- /**
13
- * Get log collection
14
- * @author Gabe Abrams
15
- * @returns log collection if one was included during launch or null if we don't
16
- * have a log collection (yet)
17
- */
18
- export declare const internalGetLogCollection: () => any;
19
- /**
20
- * Prepare dce-reactkit to run on the server
21
- * @author Gabe Abrams
22
- * @param opts object containing all arguments
23
- * @param opts.app express app from inside of the postprocessor function that
24
- * we will add routes to
25
- * @param opts.getLaunchInfo CACCL LTI's get launch info function
26
- * @param [opts.logCollection] mongo collection from dce-mango to use for
27
- * storing logs. If none is included, logs are written to the console
28
- * @param [opts.logReviewAdmins=all] info on which admins can review
29
- * logs from the client. If not included, all Canvas admins are allowed to
30
- * review logs. If null, no Canvas admins are allowed to review logs.
31
- * If an array of Canvas userIds (numbers), only Canvas admins with those
32
- * userIds are allowed to review logs. If a dce-mango collection, only
33
- * Canvas admins with entries in that collection ({ userId, ...}) are allowed
34
- * to review logs
35
- */
36
- declare const initServer: (opts: {
37
- app: any;
38
- getLaunchInfo: GetLaunchInfoFunction;
39
- logCollection?: any;
40
- logReviewAdmins?: (number[] | any);
41
- }) => void;
42
- export default initServer;