dce-reactkit 3.12.1-beta-cross-server.2 → 3.12.3
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/.vscode/settings.json +3 -1
- package/README.md +0 -20
- package/dist/cjs/index.js +356 -406
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/cjs/types/components/Modal/ModalProps.d.ts +2 -0
- package/dist/cjs/types/components/TabBox.d.ts +1 -0
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +10 -10
- package/dist/cjs/types/helpers/getWordCount.d.ts +10 -0
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +13 -15
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +6 -0
- package/dist/cjs/types/index.d.ts +2 -3
- package/dist/cjs/types/server/initServer.d.ts +0 -11
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +1 -13
- package/dist/esm/index.js +357 -406
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/esm/types/components/Modal/ModalProps.d.ts +2 -0
- package/dist/esm/types/components/TabBox.d.ts +1 -0
- package/dist/esm/types/helpers/genRouteHandler.d.ts +10 -10
- package/dist/esm/types/helpers/getWordCount.d.ts +10 -0
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +13 -15
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +6 -0
- package/dist/esm/types/index.d.ts +2 -3
- package/dist/esm/types/server/initServer.d.ts +0 -11
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +1 -13
- package/dist/index.d.ts +39 -62
- package/package.json +2 -5
- package/src/components/IntelliTable.tsx +1 -1
- package/src/components/ItemPicker/NestableItemList.tsx +1 -0
- package/src/components/ItemPicker/index.tsx +96 -0
- package/src/components/Modal/ModalProps.ts +4 -0
- package/src/components/Modal/index.tsx +59 -20
- package/src/components/TabBox.tsx +27 -9
- package/src/helpers/genRouteHandler.ts +95 -55
- package/src/helpers/getWordCount.ts +26 -0
- package/src/helpers/visitEndpointOnAnotherServer/index.ts +41 -42
- package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +5 -3
- package/src/index.ts +2 -4
- package/src/server/initServer.ts +0 -18
- package/src/types/ReactKitErrorCode.tsx +1 -13
- package/dist/cjs/types/helpers/dataSigner.d.ts +0 -38
- package/dist/cjs/types/server/initCrossServerCredentialCollection.d.ts +0 -8
- package/dist/cjs/types/types/CrossServerCredential.d.ts +0 -11
- package/dist/esm/types/helpers/dataSigner.d.ts +0 -38
- package/dist/esm/types/server/initCrossServerCredentialCollection.d.ts +0 -8
- package/dist/esm/types/types/CrossServerCredential.d.ts +0 -11
- package/genEncodedSecret.ts +0 -28
- package/src/helpers/dataSigner.ts +0 -232
- package/src/server/initCrossServerCredentialCollection.ts +0 -16
- package/src/types/CrossServerCredential.ts +0 -16
|
@@ -7,15 +7,14 @@ import LogFunction from '../types/LogFunction';
|
|
|
7
7
|
* @param opts.paramTypes map containing the types for each parameter that is
|
|
8
8
|
* included in the request (map: param name => type)
|
|
9
9
|
* @param opts.handler function that processes the request
|
|
10
|
-
* @param [opts.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* If crossServerScope is defined, this is always true
|
|
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
|
|
19
18
|
* @param [opts.unhandledErrorMessagePrefix] if included, when an error that
|
|
20
19
|
* is not of type ErrorWithCode is thrown, the client will receive an error
|
|
21
20
|
* where the error message is prefixed with this string. For example,
|
|
@@ -69,8 +68,9 @@ declare const genRouteHandler: (opts: {
|
|
|
69
68
|
}) => void;
|
|
70
69
|
logServerEvent: LogFunction;
|
|
71
70
|
}) => any;
|
|
72
|
-
crossServerScope?: string | undefined;
|
|
73
71
|
skipSessionCheck?: boolean | undefined;
|
|
72
|
+
allowedHosts?: string | string[] | undefined;
|
|
73
|
+
bannedHosts?: string | string[] | undefined;
|
|
74
74
|
unhandledErrorMessagePrefix?: string | undefined;
|
|
75
75
|
}) => (req: any, res: any, next: () => void) => Promise<undefined>;
|
|
76
76
|
export default genRouteHandler;
|
|
@@ -0,0 +1,10 @@
|
|
|
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,26 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Send a server-to-server request from this sever to another server that uses
|
|
3
|
+
* dce-reactkit [for server only]
|
|
3
4
|
* @author Gabe Abrams
|
|
4
5
|
* @param opts object containing all arguments
|
|
5
|
-
* @param opts.
|
|
6
|
-
* @param opts.path the path of the other server's endpoint
|
|
7
|
-
* @param opts.
|
|
8
|
-
* @param [opts.
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
* credential secret
|
|
12
|
-
* @param [opts.params={}] query/body parameters to include
|
|
13
|
-
* @param [opts.responseType=JSON] the response type from the other server
|
|
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
|
|
14
12
|
*/
|
|
15
13
|
declare const visitEndpointOnAnotherServer: (opts: {
|
|
16
|
-
method: 'GET' | 'POST' | 'DELETE' | 'PUT';
|
|
17
|
-
path: string;
|
|
18
14
|
host: string;
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
path: string;
|
|
16
|
+
method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
|
|
21
17
|
params?: {
|
|
22
18
|
[x: string]: any;
|
|
23
19
|
} | undefined;
|
|
24
|
-
|
|
20
|
+
headers?: {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
} | undefined;
|
|
25
23
|
}) => Promise<any>;
|
|
26
24
|
export default visitEndpointOnAnotherServer;
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* @param [opts.host] host to send request to
|
|
7
7
|
* @param [opts.method=GET] http method to use
|
|
8
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
|
|
9
12
|
* @param [opts.responseType=JSON] expected response type
|
|
10
13
|
* @returns { body, status, headers } on success
|
|
11
14
|
*/
|
|
@@ -16,6 +19,9 @@ declare const sendServerToServerRequest: (opts: {
|
|
|
16
19
|
params?: {
|
|
17
20
|
[x: string]: any;
|
|
18
21
|
} | undefined;
|
|
22
|
+
headers?: {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
} | undefined;
|
|
19
25
|
responseType?: "Text" | "JSON" | undefined;
|
|
20
26
|
}) => Promise<{
|
|
21
27
|
body: any;
|
|
@@ -54,7 +54,6 @@ import onlyKeepLetters from './helpers/onlyKeepLetters';
|
|
|
54
54
|
import parallelLimit from './helpers/parallelLimit';
|
|
55
55
|
import logClientEvent, { setClientEventMetadataPopulator } from './helpers/logClientEvent';
|
|
56
56
|
import initLogCollection from './server/initLogCollection';
|
|
57
|
-
import initCrossServerCredentialCollection from './server/initCrossServerCredentialCollection';
|
|
58
57
|
import getMonthName from './helpers/getMonthName';
|
|
59
58
|
import genCSV from './helpers/genCSV';
|
|
60
59
|
import canReviewLogs from './helpers/canReviewLogs';
|
|
@@ -80,6 +79,7 @@ import someAsync from './helpers/asyncArrayFunctions/someAsync';
|
|
|
80
79
|
import capitalize from './helpers/capitalize';
|
|
81
80
|
import shuffleArray from './helpers/shuffleArray';
|
|
82
81
|
import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
|
|
82
|
+
import getWordCount from './helpers/getWordCount';
|
|
83
83
|
import ModalButtonType from './types/ModalButtonType';
|
|
84
84
|
import ModalSize from './types/ModalSize';
|
|
85
85
|
import ModalType from './types/ModalType';
|
|
@@ -96,9 +96,8 @@ import LogMetadataType from './types/LogMetadataType';
|
|
|
96
96
|
import LogFunction from './types/LogFunction';
|
|
97
97
|
import IntelliTableColumn from './types/IntelliTableColumn';
|
|
98
98
|
import DropdownItemType from './types/DropdownItemType';
|
|
99
|
-
import CrossServerCredential from './types/CrossServerCredential';
|
|
100
99
|
import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
101
100
|
import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
|
|
102
101
|
import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
|
|
103
102
|
import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
|
|
104
|
-
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection,
|
|
103
|
+
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, visitEndpointOnAnotherServer, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
|
|
@@ -16,13 +16,6 @@ export declare const cacclGetLaunchInfo: GetLaunchInfoFunction;
|
|
|
16
16
|
* have a log collection (yet)
|
|
17
17
|
*/
|
|
18
18
|
export declare const internalGetLogCollection: () => any;
|
|
19
|
-
/**
|
|
20
|
-
* Get cross-server credential collection
|
|
21
|
-
* @author Gabe Abrams
|
|
22
|
-
* @return cross-server credential collection if one was included during launch or null
|
|
23
|
-
* if we don't have a cross-server credential collection (yet)
|
|
24
|
-
*/
|
|
25
|
-
export declare const internalGetCrossServerCredentialCollection: () => any;
|
|
26
19
|
/**
|
|
27
20
|
* Prepare dce-reactkit to run on the server
|
|
28
21
|
* @author Gabe Abrams
|
|
@@ -39,15 +32,11 @@ export declare const internalGetCrossServerCredentialCollection: () => any;
|
|
|
39
32
|
* userIds are allowed to review logs. If a dce-mango collection, only
|
|
40
33
|
* Canvas admins with entries in that collection ({ userId, ...}) are allowed
|
|
41
34
|
* to review logs
|
|
42
|
-
* @param [opts.crossServerCredentialCollection] mongo collection from dce-mango to use for
|
|
43
|
-
* storing cross-server credentials. If none is included, cross-server credentials
|
|
44
|
-
* are not supported
|
|
45
35
|
*/
|
|
46
36
|
declare const initServer: (opts: {
|
|
47
37
|
app: any;
|
|
48
38
|
getLaunchInfo: GetLaunchInfoFunction;
|
|
49
39
|
logCollection?: any;
|
|
50
40
|
logReviewAdmins?: (number[] | any);
|
|
51
|
-
crossServerCredentialCollection?: any;
|
|
52
41
|
}) => void;
|
|
53
42
|
export default initServer;
|
|
@@ -20,18 +20,6 @@ declare enum ReactKitErrorCode {
|
|
|
20
20
|
SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
|
|
21
21
|
NotConnected = "DRK14",
|
|
22
22
|
SelfSigned = "DRK15",
|
|
23
|
-
ResponseParseError = "DRK16"
|
|
24
|
-
PackUnparseable = "DRK28",
|
|
25
|
-
PackInvalidMethod = "DRK19",
|
|
26
|
-
PackInvalidPath = "DRK20",
|
|
27
|
-
PackInvalidCollection = "DRK21",
|
|
28
|
-
PackInvalidCredential = "DRK23",
|
|
29
|
-
PackInvalidScope = "DRK22",
|
|
30
|
-
PackInvalidTimestamp = "DRK24",
|
|
31
|
-
PackInvalidSignature = "DRK25",
|
|
32
|
-
PackInvalidBody = "DRK26",
|
|
33
|
-
CrossServerNoCredentialsToSignWith = "DRK27",
|
|
34
|
-
CrossServerNoPack = "DRK29",
|
|
35
|
-
CrossServerNoCredentialEncodingSalt = "DRK30"
|
|
23
|
+
ResponseParseError = "DRK16"
|
|
36
24
|
}
|
|
37
25
|
export default ReactKitErrorCode;
|