dce-reactkit 4.3.4 → 5.0.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/cjs/index.js +338 -2316
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/LogReviewer.d.ts +1 -1
- package/dist/cjs/types/helpers/logClientEvent.d.ts +1 -1
- package/dist/cjs/types/html/genErrorPage.d.ts +1 -1
- package/dist/cjs/types/index.d.ts +2 -64
- package/dist/cjs/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/esm/index.js +78 -2223
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/LogReviewer.d.ts +1 -1
- package/dist/esm/types/helpers/logClientEvent.d.ts +1 -1
- package/dist/esm/types/html/genErrorPage.d.ts +1 -1
- package/dist/esm/types/index.d.ts +2 -64
- package/dist/esm/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/index.d.ts +3 -835
- package/package.json +4 -3
- package/src/components/AppWrapper.tsx +12 -10
- package/src/components/AutoscrollToBottomContainer.tsx +5 -3
- package/src/components/CopiableBox.tsx +5 -1
- package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +2 -2
- package/src/components/ErrorBox.tsx +6 -2
- package/src/components/IntelliTable.tsx +7 -5
- package/src/components/LogReviewer.tsx +23 -21
- package/src/components/Modal/index.tsx +5 -3
- package/src/components/MultiSwitch.tsx +5 -1
- package/src/components/Shimmer.tsx +4 -2
- package/src/components/SimpleDateChooser.tsx +11 -13
- package/src/components/SimpleTimeChooser.tsx +4 -2
- package/src/helpers/canReviewLogs.test.ts +5 -3
- package/src/helpers/canReviewLogs.ts +5 -3
- package/src/helpers/initClient.tsx +8 -8
- package/src/helpers/isMobileOrTablet.tsx +2 -1
- package/src/helpers/isSelectAdmin.ts +4 -2
- package/src/helpers/logClientEvent.tsx +7 -5
- package/src/helpers/stubServerEndpoint.tsx +1 -1
- package/src/helpers/visitServerEndpoint.tsx +10 -7
- package/src/html/genErrorPage.ts +6 -4
- package/src/index.ts +105 -98
- package/src/types/IntelliTableColumn.ts +4 -1
- package/dist/cjs/types/constants/DAY_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/HOUR_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
- package/dist/cjs/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
- package/dist/cjs/types/constants/MINUTE_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/cjs/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
- package/dist/cjs/types/errors/ErrorWithCode.d.ts +0 -9
- package/dist/cjs/types/helpers/abbreviate.d.ts +0 -10
- package/dist/cjs/types/helpers/abbreviate.test.d.ts +0 -5
- package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
- package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
- package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/avg.d.ts +0 -8
- package/dist/cjs/types/helpers/avg.test.d.ts +0 -5
- package/dist/cjs/types/helpers/capitalize.d.ts +0 -7
- package/dist/cjs/types/helpers/ceilToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
- package/dist/cjs/types/helpers/cloneDeep.d.ts +0 -8
- package/dist/cjs/types/helpers/compareArraysByProp.d.ts +0 -13
- package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +0 -5
- package/dist/cjs/types/helpers/extractProp.d.ts +0 -12
- package/dist/cjs/types/helpers/extractProp.test.d.ts +0 -5
- package/dist/cjs/types/helpers/floorToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +0 -5
- package/dist/cjs/types/helpers/forceNumIntoBounds.d.ts +0 -10
- package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
- package/dist/cjs/types/helpers/genCSV.d.ts +0 -18
- package/dist/cjs/types/helpers/genCSV.test.d.ts +0 -5
- package/dist/cjs/types/helpers/genCommaList.d.ts +0 -12
- package/dist/cjs/types/helpers/genCommaList.test.d.ts +0 -1
- package/dist/cjs/types/helpers/getHumanReadableDate.d.ts +0 -8
- package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +0 -19
- package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
- package/dist/cjs/types/helpers/getMonthName.d.ts +0 -14
- package/dist/cjs/types/helpers/getMonthName.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getOrdinal.d.ts +0 -8
- package/dist/cjs/types/helpers/getOrdinal.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getPartOfDay.d.ts +0 -7
- package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +0 -21
- package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
- package/dist/cjs/types/helpers/getWordCount.d.ts +0 -10
- package/dist/cjs/types/helpers/idify.d.ts +0 -9
- package/dist/cjs/types/helpers/onlyKeepLetters.d.ts +0 -8
- package/dist/cjs/types/helpers/padDecimalZeros.d.ts +0 -10
- package/dist/cjs/types/helpers/padZerosLeft.d.ts +0 -9
- package/dist/cjs/types/helpers/parallelLimit.d.ts +0 -12
- package/dist/cjs/types/helpers/prefixWithAOrAn.d.ts +0 -10
- package/dist/cjs/types/helpers/roundToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/shuffleArray.d.ts +0 -8
- package/dist/cjs/types/helpers/startMinWait.d.ts +0 -9
- package/dist/cjs/types/helpers/stringsToHumanReadableList.d.ts +0 -10
- package/dist/cjs/types/helpers/sum.d.ts +0 -8
- package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
- package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
- package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
- package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
- package/dist/cjs/types/helpers/validators/validURL.d.ts +0 -8
- package/dist/cjs/types/helpers/validators/validateEmail.d.ts +0 -11
- package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +0 -1
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
- package/dist/cjs/types/helpers/validators/validateString.d.ts +0 -22
- package/dist/cjs/types/helpers/validators/validateString.test.d.ts +0 -1
- package/dist/cjs/types/helpers/waitMs.d.ts +0 -7
- package/dist/cjs/types/types/DayOfWeek.d.ts +0 -14
- package/dist/cjs/types/types/Log/LogMainInfo.d.ts +0 -39
- package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
- package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
- package/dist/cjs/types/types/Log/index.d.ts +0 -10
- package/dist/cjs/types/types/LogAction.d.ts +0 -29
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +0 -16
- package/dist/cjs/types/types/LogFunction.d.ts +0 -24
- package/dist/cjs/types/types/LogLevel.d.ts +0 -10
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +0 -11
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +0 -8
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +0 -8
- package/dist/cjs/types/types/LogMetadataType.d.ts +0 -13
- package/dist/cjs/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
- package/dist/cjs/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
- package/dist/cjs/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
- package/dist/cjs/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
- package/dist/cjs/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
- package/dist/cjs/types/types/LogReviewerFilterState/index.d.ts +0 -17
- package/dist/cjs/types/types/LogSource.d.ts +0 -9
- package/dist/cjs/types/types/LogType.d.ts +0 -9
- package/dist/cjs/types/types/ParamType.d.ts +0 -17
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +0 -14
- package/dist/esm/types/constants/DAY_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/HOUR_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
- package/dist/esm/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
- package/dist/esm/types/constants/MINUTE_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/esm/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
- package/dist/esm/types/errors/ErrorWithCode.d.ts +0 -9
- package/dist/esm/types/helpers/abbreviate.d.ts +0 -10
- package/dist/esm/types/helpers/abbreviate.test.d.ts +0 -5
- package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
- package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
- package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/avg.d.ts +0 -8
- package/dist/esm/types/helpers/avg.test.d.ts +0 -5
- package/dist/esm/types/helpers/capitalize.d.ts +0 -7
- package/dist/esm/types/helpers/ceilToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
- package/dist/esm/types/helpers/cloneDeep.d.ts +0 -8
- package/dist/esm/types/helpers/compareArraysByProp.d.ts +0 -13
- package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +0 -5
- package/dist/esm/types/helpers/extractProp.d.ts +0 -12
- package/dist/esm/types/helpers/extractProp.test.d.ts +0 -5
- package/dist/esm/types/helpers/floorToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +0 -5
- package/dist/esm/types/helpers/forceNumIntoBounds.d.ts +0 -10
- package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
- package/dist/esm/types/helpers/genCSV.d.ts +0 -18
- package/dist/esm/types/helpers/genCSV.test.d.ts +0 -5
- package/dist/esm/types/helpers/genCommaList.d.ts +0 -12
- package/dist/esm/types/helpers/genCommaList.test.d.ts +0 -1
- package/dist/esm/types/helpers/getHumanReadableDate.d.ts +0 -8
- package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +0 -5
- package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +0 -19
- package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
- package/dist/esm/types/helpers/getMonthName.d.ts +0 -14
- package/dist/esm/types/helpers/getMonthName.test.d.ts +0 -5
- package/dist/esm/types/helpers/getOrdinal.d.ts +0 -8
- package/dist/esm/types/helpers/getOrdinal.test.d.ts +0 -5
- package/dist/esm/types/helpers/getPartOfDay.d.ts +0 -7
- package/dist/esm/types/helpers/getPartOfDay.test.d.ts +0 -5
- package/dist/esm/types/helpers/getTimeInfoInET.d.ts +0 -21
- package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +0 -5
- package/dist/esm/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
- package/dist/esm/types/helpers/getWordCount.d.ts +0 -10
- package/dist/esm/types/helpers/idify.d.ts +0 -9
- package/dist/esm/types/helpers/onlyKeepLetters.d.ts +0 -8
- package/dist/esm/types/helpers/padDecimalZeros.d.ts +0 -10
- package/dist/esm/types/helpers/padZerosLeft.d.ts +0 -9
- package/dist/esm/types/helpers/parallelLimit.d.ts +0 -12
- package/dist/esm/types/helpers/prefixWithAOrAn.d.ts +0 -10
- package/dist/esm/types/helpers/roundToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/shuffleArray.d.ts +0 -8
- package/dist/esm/types/helpers/startMinWait.d.ts +0 -9
- package/dist/esm/types/helpers/stringsToHumanReadableList.d.ts +0 -10
- package/dist/esm/types/helpers/sum.d.ts +0 -8
- package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
- package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
- package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
- package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
- package/dist/esm/types/helpers/validators/validURL.d.ts +0 -8
- package/dist/esm/types/helpers/validators/validateEmail.d.ts +0 -11
- package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +0 -1
- package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
- package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
- package/dist/esm/types/helpers/validators/validateString.d.ts +0 -22
- package/dist/esm/types/helpers/validators/validateString.test.d.ts +0 -1
- package/dist/esm/types/helpers/waitMs.d.ts +0 -7
- package/dist/esm/types/types/DayOfWeek.d.ts +0 -14
- package/dist/esm/types/types/Log/LogMainInfo.d.ts +0 -39
- package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
- package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
- package/dist/esm/types/types/Log/index.d.ts +0 -10
- package/dist/esm/types/types/LogAction.d.ts +0 -29
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +0 -16
- package/dist/esm/types/types/LogFunction.d.ts +0 -24
- package/dist/esm/types/types/LogLevel.d.ts +0 -10
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +0 -11
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +0 -8
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +0 -8
- package/dist/esm/types/types/LogMetadataType.d.ts +0 -13
- package/dist/esm/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
- package/dist/esm/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
- package/dist/esm/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
- package/dist/esm/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
- package/dist/esm/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
- package/dist/esm/types/types/LogReviewerFilterState/index.d.ts +0 -17
- package/dist/esm/types/types/LogSource.d.ts +0 -9
- package/dist/esm/types/types/LogType.d.ts +0 -9
- package/dist/esm/types/types/ParamType.d.ts +0 -17
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +0 -14
- package/src/constants/DAY_IN_MS.ts +0 -7
- package/src/constants/HOUR_IN_MS.ts +0 -7
- package/src/constants/LOG_REVIEW_GET_LOGS_ROUTE.ts +0 -9
- package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +0 -9
- package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +0 -10
- package/src/constants/LOG_ROUTE_PATH.ts +0 -9
- package/src/constants/MINUTE_IN_MS.ts +0 -7
- package/src/constants/ROUTE_PATH_PREFIX.ts +0 -7
- package/src/constants/SELECT_ADMIN_CHECK_ROUTE.ts +0 -7
- package/src/errors/ErrorWithCode.tsx +0 -15
- package/src/helpers/abbreviate.test.ts +0 -26
- package/src/helpers/abbreviate.ts +0 -25
- package/src/helpers/asyncArrayFunctions/everyAsync.test.ts +0 -114
- package/src/helpers/asyncArrayFunctions/everyAsync.ts +0 -51
- package/src/helpers/asyncArrayFunctions/filterAsync.test.ts +0 -126
- package/src/helpers/asyncArrayFunctions/filterAsync.ts +0 -50
- package/src/helpers/asyncArrayFunctions/forEachAsync.test.ts +0 -136
- package/src/helpers/asyncArrayFunctions/forEachAsync.ts +0 -40
- package/src/helpers/asyncArrayFunctions/mapAsync.test.ts +0 -125
- package/src/helpers/asyncArrayFunctions/mapAsync.ts +0 -46
- package/src/helpers/asyncArrayFunctions/someAsync.test.ts +0 -92
- package/src/helpers/asyncArrayFunctions/someAsync.ts +0 -49
- package/src/helpers/avg.test.ts +0 -24
- package/src/helpers/avg.ts +0 -22
- package/src/helpers/capitalize.ts +0 -20
- package/src/helpers/ceilToNumDecimals.test.ts +0 -39
- package/src/helpers/ceilToNumDecimals.ts +0 -13
- package/src/helpers/cloneDeep.ts +0 -11
- package/src/helpers/compareArraysByProp.test.ts +0 -147
- package/src/helpers/compareArraysByProp.ts +0 -56
- package/src/helpers/extractProp.test.ts +0 -34
- package/src/helpers/extractProp.ts +0 -17
- package/src/helpers/floorToNumDecimals.test.ts +0 -39
- package/src/helpers/floorToNumDecimals.ts +0 -13
- package/src/helpers/forceNumIntoBounds.test.ts +0 -34
- package/src/helpers/forceNumIntoBounds.ts +0 -19
- package/src/helpers/genCSV.test.ts +0 -75
- package/src/helpers/genCSV.ts +0 -87
- package/src/helpers/genCommaList.test.ts +0 -57
- package/src/helpers/genCommaList.ts +0 -21
- package/src/helpers/getHumanReadableDate.test.ts +0 -29
- package/src/helpers/getHumanReadableDate.ts +0 -36
- package/src/helpers/getLocalTimeInfo.test.ts +0 -48
- package/src/helpers/getLocalTimeInfo.ts +0 -58
- package/src/helpers/getMonthName.test.ts +0 -79
- package/src/helpers/getMonthName.ts +0 -29
- package/src/helpers/getOrdinal.test.ts +0 -84
- package/src/helpers/getOrdinal.ts +0 -14
- package/src/helpers/getPartOfDay.test.ts +0 -56
- package/src/helpers/getPartOfDay.ts +0 -20
- package/src/helpers/getTimeInfoInET.test.ts +0 -72
- package/src/helpers/getTimeInfoInET.ts +0 -79
- package/src/helpers/getTimestampFromTimeInfoInET.ts +0 -179
- package/src/helpers/getWordCount.ts +0 -26
- package/src/helpers/idify.ts +0 -24
- package/src/helpers/onlyKeepLetters.ts +0 -11
- package/src/helpers/padDecimalZeros.tsx +0 -32
- package/src/helpers/padZerosLeft.tsx +0 -21
- package/src/helpers/parallelLimit.ts +0 -63
- package/src/helpers/prefixWithAOrAn.ts +0 -29
- package/src/helpers/roundToNumDecimals.tsx +0 -13
- package/src/helpers/shuffleArray.ts +0 -19
- package/src/helpers/startMinWait.ts +0 -33
- package/src/helpers/stringsToHumanReadableList.ts +0 -39
- package/src/helpers/sum.tsx +0 -16
- package/src/helpers/validators/ChicagoTitleCase.test.ts +0 -85
- package/src/helpers/validators/ChicagoTitleCase.ts +0 -32
- package/src/helpers/validators/findURL.test.ts +0 -83
- package/src/helpers/validators/findURL.ts +0 -43
- package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +0 -18
- package/src/helpers/validators/shared/helpers/validateRegex.ts +0 -47
- package/src/helpers/validators/shared/types/ValidationResult.ts +0 -20
- package/src/helpers/validators/validURL.test.ts +0 -90
- package/src/helpers/validators/validURL.ts +0 -18
- package/src/helpers/validators/validateEmail.test.ts +0 -110
- package/src/helpers/validators/validateEmail.ts +0 -47
- package/src/helpers/validators/validatePhoneNumber.test.ts +0 -94
- package/src/helpers/validators/validatePhoneNumber.ts +0 -49
- package/src/helpers/validators/validateString.test.ts +0 -173
- package/src/helpers/validators/validateString.ts +0 -171
- package/src/helpers/waitMs.tsx +0 -12
- package/src/types/DayOfWeek.ts +0 -15
- package/src/types/Log/LogMainInfo.ts +0 -69
- package/src/types/Log/LogSourceSpecificInfo.ts +0 -25
- package/src/types/Log/LogTypeSpecificInfo.ts +0 -33
- package/src/types/Log/index.ts +0 -17
- package/src/types/LogAction.ts +0 -52
- package/src/types/LogBuiltInMetadata.ts +0 -19
- package/src/types/LogFunction.ts +0 -46
- package/src/types/LogLevel.ts +0 -11
- package/src/types/LogMetadataContextMap.ts +0 -15
- package/src/types/LogMetadataTagMap.ts +0 -9
- package/src/types/LogMetadataTargetMap.ts +0 -9
- package/src/types/LogMetadataType.ts +0 -16
- package/src/types/LogReviewerFilterState/ActionErrorFilterState.ts +0 -24
- package/src/types/LogReviewerFilterState/AdvancedFilterState.ts +0 -36
- package/src/types/LogReviewerFilterState/ContextFilterState.ts +0 -16
- package/src/types/LogReviewerFilterState/DateFilterState.ts +0 -26
- package/src/types/LogReviewerFilterState/TagFilterState.ts +0 -9
- package/src/types/LogReviewerFilterState/index.ts +0 -24
- package/src/types/LogSource.ts +0 -12
- package/src/types/LogType.ts +0 -12
- package/src/types/ParamType.ts +0 -18
- package/src/types/ReactKitErrorCode.tsx +0 -17
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test file for the getOrdinal helper
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Import main function
|
|
7
|
-
import getOrdinal from './getOrdinal';
|
|
8
|
-
|
|
9
|
-
describe('getOrdinal', () => {
|
|
10
|
-
it('should return "th" for 0', () => {
|
|
11
|
-
const result = getOrdinal(0);
|
|
12
|
-
expect(result).toEqual('th');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should return "st" for 1', () => {
|
|
16
|
-
const result = getOrdinal(1);
|
|
17
|
-
expect(result).toEqual('st');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should return "nd" for 2', () => {
|
|
21
|
-
const result = getOrdinal(2);
|
|
22
|
-
expect(result).toEqual('nd');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should return "rd" for 3', () => {
|
|
26
|
-
const result = getOrdinal(3);
|
|
27
|
-
expect(result).toEqual('rd');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should return "th" for 4', () => {
|
|
31
|
-
const result = getOrdinal(4);
|
|
32
|
-
expect(result).toEqual('th');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should return "th" for 11', () => {
|
|
36
|
-
const result = getOrdinal(11);
|
|
37
|
-
expect(result).toEqual('th');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should return "st" for 21', () => {
|
|
41
|
-
const result = getOrdinal(21);
|
|
42
|
-
expect(result).toEqual('st');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should return "nd" for 22', () => {
|
|
46
|
-
const result = getOrdinal(22);
|
|
47
|
-
expect(result).toEqual('nd');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should return "rd" for 23', () => {
|
|
51
|
-
const result = getOrdinal(23);
|
|
52
|
-
expect(result).toEqual('rd');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should return "th" for 24', () => {
|
|
56
|
-
const result = getOrdinal(24);
|
|
57
|
-
expect(result).toEqual('th');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should return "th" for 100', () => {
|
|
61
|
-
const result = getOrdinal(100);
|
|
62
|
-
expect(result).toEqual('th');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should return "st" for 101', () => {
|
|
66
|
-
const result = getOrdinal(101);
|
|
67
|
-
expect(result).toEqual('st');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should return "nd" for 102', () => {
|
|
71
|
-
const result = getOrdinal(102);
|
|
72
|
-
expect(result).toEqual('nd');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should return "rd" for 103', () => {
|
|
76
|
-
const result = getOrdinal(103);
|
|
77
|
-
expect(result).toEqual('rd');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should return "th" for 104', () => {
|
|
81
|
-
const result = getOrdinal(104);
|
|
82
|
-
expect(result).toEqual('th');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Constants
|
|
2
|
-
const ORDINALS = ['th', 'st', 'nd', 'rd'];
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get a number's ordinal
|
|
6
|
-
* @author Gabe Abrams
|
|
7
|
-
* @param num the number being analyzed
|
|
8
|
-
* @returns ordinal
|
|
9
|
-
*/
|
|
10
|
-
const getOrdinal = (num: number): string => {
|
|
11
|
-
return (ORDINALS[(num - 20) % 10] ?? ORDINALS[num] ?? ORDINALS[0]);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default getOrdinal;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test file for the getPartOfDay helper
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import getPartOfDay from './getPartOfDay';
|
|
7
|
-
|
|
8
|
-
describe('getPartOfDay', () => {
|
|
9
|
-
it('should return "morning" if the current hour is less than 12', () => {
|
|
10
|
-
// Mock the current hour to be 9am
|
|
11
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(9);
|
|
12
|
-
|
|
13
|
-
const result = getPartOfDay();
|
|
14
|
-
expect(result).toEqual('morning');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('should return "afternoon" if the current hour is between 12 and 16 (inclusive)', () => {
|
|
18
|
-
// Mock the current hour to be 2pm
|
|
19
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(14);
|
|
20
|
-
|
|
21
|
-
const result = getPartOfDay();
|
|
22
|
-
expect(result).toEqual('afternoon');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should return "evening" if the current hour is between 17 and 24 (inclusive)', () => {
|
|
26
|
-
// Mock the current hour to be 8pm
|
|
27
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(20);
|
|
28
|
-
|
|
29
|
-
const result = getPartOfDay();
|
|
30
|
-
expect(result).toEqual('evening');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should return "evening" if the current hour is 17', () => {
|
|
34
|
-
// Mock the current hour to be 5pm
|
|
35
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(17);
|
|
36
|
-
|
|
37
|
-
const result = getPartOfDay();
|
|
38
|
-
expect(result).toEqual('evening');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should return "evening" if the current hour is 24', () => {
|
|
42
|
-
// Mock the current hour to be midnight
|
|
43
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(24);
|
|
44
|
-
|
|
45
|
-
const result = getPartOfDay();
|
|
46
|
-
expect(result).toEqual('evening');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should return "morning" if the current hour is 0', () => {
|
|
50
|
-
// Mock the current hour to be midnight
|
|
51
|
-
jest.spyOn(Date.prototype, 'getHours').mockReturnValue(0);
|
|
52
|
-
|
|
53
|
-
const result = getPartOfDay();
|
|
54
|
-
expect(result).toEqual('morning');
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the current part of day (morning, evening, etc.)
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
* @returns the part of day (morning, evening, etc.)
|
|
5
|
-
*/
|
|
6
|
-
const getPartOfDay = () => {
|
|
7
|
-
// Setup the post-it time of day
|
|
8
|
-
let partOfDay = 'day';
|
|
9
|
-
const hours = new Date().getHours();
|
|
10
|
-
if (hours < 12) {
|
|
11
|
-
partOfDay = 'morning';
|
|
12
|
-
} else if (hours >= 12 && hours <= 16) {
|
|
13
|
-
partOfDay = 'afternoon';
|
|
14
|
-
} else if (hours > 16 && hours <= 24) {
|
|
15
|
-
partOfDay = 'evening';
|
|
16
|
-
}
|
|
17
|
-
return partOfDay;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default getPartOfDay;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test file for the getTimeInfoInET helper
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Import main function
|
|
7
|
-
import getTimeInfoInET from './getTimeInfoInET';
|
|
8
|
-
|
|
9
|
-
describe('getTimeInfoInET', () => {
|
|
10
|
-
it('should return the current time info in ET if no argument is passed', () => {
|
|
11
|
-
const result = getTimeInfoInET();
|
|
12
|
-
const now = new Date();
|
|
13
|
-
const expectedTimestamp = now.getTime();
|
|
14
|
-
const expectedYear = now.getFullYear();
|
|
15
|
-
const expectedMonth = now.getMonth() + 1;
|
|
16
|
-
const expectedDay = now.getDate();
|
|
17
|
-
const expectedHour = now.getHours();
|
|
18
|
-
const expectedHour12 = expectedHour % 12 || 12;
|
|
19
|
-
const expectedMinute = now.getMinutes();
|
|
20
|
-
const expectedIsPM = expectedHour >= 12;
|
|
21
|
-
expect(result.timestamp).toBeCloseTo(expectedTimestamp, -2);
|
|
22
|
-
expect(result.year).toEqual(expectedYear);
|
|
23
|
-
expect(result.month).toEqual(expectedMonth);
|
|
24
|
-
expect(result.day).toEqual(expectedDay);
|
|
25
|
-
expect(result.hour).toEqual(expectedHour);
|
|
26
|
-
expect(result.hour12).toEqual(expectedHour12);
|
|
27
|
-
expect(result.minute).toEqual(expectedMinute);
|
|
28
|
-
expect(result.isPM).toEqual(expectedIsPM);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should return the time info in ET for a specified date', () => {
|
|
32
|
-
const date = new Date('2022-01-01T00:00:00Z');
|
|
33
|
-
const result = getTimeInfoInET(date);
|
|
34
|
-
const expectedTimestamp = date.getTime();
|
|
35
|
-
const expectedYear = 2021;
|
|
36
|
-
const expectedMonth = 12;
|
|
37
|
-
const expectedDay = 31;
|
|
38
|
-
const expectedHour = 19;
|
|
39
|
-
const expectedHour12 = 7;
|
|
40
|
-
const expectedMinute = 0;
|
|
41
|
-
const expectedIsPM = true;
|
|
42
|
-
expect(result.timestamp).toEqual(expectedTimestamp);
|
|
43
|
-
expect(result.year).toEqual(expectedYear);
|
|
44
|
-
expect(result.month).toEqual(expectedMonth);
|
|
45
|
-
expect(result.day).toEqual(expectedDay);
|
|
46
|
-
expect(result.hour).toEqual(expectedHour);
|
|
47
|
-
expect(result.hour12).toEqual(expectedHour12);
|
|
48
|
-
expect(result.minute).toEqual(expectedMinute);
|
|
49
|
-
expect(result.isPM).toEqual(expectedIsPM);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should return the time info in ET for a specified timestamp', () => {
|
|
53
|
-
const timestamp = 1640995200000; // 2022-01-01T00:00:00Z
|
|
54
|
-
const result = getTimeInfoInET(timestamp);
|
|
55
|
-
const expectedTimestamp = timestamp;
|
|
56
|
-
const expectedYear = 2021;
|
|
57
|
-
const expectedMonth = 12;
|
|
58
|
-
const expectedDay = 31;
|
|
59
|
-
const expectedHour = 19;
|
|
60
|
-
const expectedHour12 = 7;
|
|
61
|
-
const expectedMinute = 0;
|
|
62
|
-
const expectedIsPM = true;
|
|
63
|
-
expect(result.timestamp).toEqual(expectedTimestamp);
|
|
64
|
-
expect(result.year).toEqual(expectedYear);
|
|
65
|
-
expect(result.month).toEqual(expectedMonth);
|
|
66
|
-
expect(result.day).toEqual(expectedDay);
|
|
67
|
-
expect(result.hour).toEqual(expectedHour);
|
|
68
|
-
expect(result.hour12).toEqual(expectedHour12);
|
|
69
|
-
expect(result.minute).toEqual(expectedMinute);
|
|
70
|
-
expect(result.isPM).toEqual(expectedIsPM);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get current time info in US Boston Eastern Time, independent of machine
|
|
3
|
-
* timezone
|
|
4
|
-
* @author Gabe Abrams
|
|
5
|
-
* @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
|
|
6
|
-
* @returns object with timestamp (ms since epoch) and numbers
|
|
7
|
-
* corresponding to ET time values for year, month, day, hour, hour12, minute, second, isPM
|
|
8
|
-
* where hour is in 24hr time and hour12 is in 12hr time.
|
|
9
|
-
*/
|
|
10
|
-
const getTimeInfoInET = (dateOrTimestamp?: Date | number): {
|
|
11
|
-
timestamp: number,
|
|
12
|
-
year: number,
|
|
13
|
-
month: number,
|
|
14
|
-
day: number,
|
|
15
|
-
hour: number,
|
|
16
|
-
hour12: number,
|
|
17
|
-
minute: number,
|
|
18
|
-
second: number,
|
|
19
|
-
isPM: boolean,
|
|
20
|
-
} => {
|
|
21
|
-
// Create a time string
|
|
22
|
-
let d: Date;
|
|
23
|
-
if (!dateOrTimestamp) {
|
|
24
|
-
// Use now
|
|
25
|
-
d = new Date();
|
|
26
|
-
} else if (typeof dateOrTimestamp === 'number') {
|
|
27
|
-
// Convert to date
|
|
28
|
-
d = new Date(dateOrTimestamp);
|
|
29
|
-
} else {
|
|
30
|
-
// Already a date
|
|
31
|
-
d = dateOrTimestamp;
|
|
32
|
-
}
|
|
33
|
-
const str = d.toLocaleString(
|
|
34
|
-
'en-US', // Using US encoding (it's the only one installed on containers)
|
|
35
|
-
{ timeZone: 'America/New_York' }, // Force EST timezone
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
// Parse the string for the date/time info
|
|
39
|
-
const [dateStr, timeStr] = str.split(', '); // Format: MM/DD/YYYY, HH:MM:SS AM
|
|
40
|
-
const [monthStr, dayStr, yearStr] = dateStr.split('/'); // Format: MM/DD/YYYY
|
|
41
|
-
const [hourStr, minStr, ending] = timeStr.split(':'); // Format: HH:MM:SS AM
|
|
42
|
-
|
|
43
|
-
// Create all time numbers
|
|
44
|
-
const timestamp = d.getTime();
|
|
45
|
-
const year = Number.parseInt(yearStr, 10);
|
|
46
|
-
const month = Number.parseInt(monthStr, 10);
|
|
47
|
-
const day = Number.parseInt(dayStr, 10);
|
|
48
|
-
const minute = Number.parseInt(minStr, 10);
|
|
49
|
-
const second = (
|
|
50
|
-
ending.split(' ')[0]
|
|
51
|
-
? Number.parseInt(ending.split(' ')[0], 10)
|
|
52
|
-
: 0
|
|
53
|
-
);
|
|
54
|
-
const hour12 = Number.parseInt(hourStr, 10);
|
|
55
|
-
// Convert from am/pm to 24hr
|
|
56
|
-
const isAM = ending.toLowerCase().includes('am');
|
|
57
|
-
const isPM = !isAM;
|
|
58
|
-
let hour = hour12;
|
|
59
|
-
if (isPM && hour12 !== 12) {
|
|
60
|
-
hour += 12;
|
|
61
|
-
} else if (isAM && hour12 === 12) {
|
|
62
|
-
hour = 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Return
|
|
66
|
-
return {
|
|
67
|
-
timestamp,
|
|
68
|
-
year,
|
|
69
|
-
month,
|
|
70
|
-
day,
|
|
71
|
-
hour,
|
|
72
|
-
hour12,
|
|
73
|
-
isPM,
|
|
74
|
-
minute,
|
|
75
|
-
second,
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default getTimeInfoInET;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// Import shared types
|
|
2
|
-
import ErrorWithCode from '../errors/ErrorWithCode';
|
|
3
|
-
import ReactKitErrorCode from '../types/ReactKitErrorCode';
|
|
4
|
-
|
|
5
|
-
// Import shared helpers
|
|
6
|
-
import getTimeInfoInET from './getTimeInfoInET';
|
|
7
|
-
import padZerosLeft from './padZerosLeft';
|
|
8
|
-
|
|
9
|
-
/*----------------------------------------*/
|
|
10
|
-
/* --------------- Helpers -------------- */
|
|
11
|
-
/*----------------------------------------*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check if a timestamp is valid
|
|
15
|
-
* @author Gabe Abrams
|
|
16
|
-
* @author Gardenia Liu
|
|
17
|
-
* @param opts object containing all arguments
|
|
18
|
-
* @param opts.timestamp Timestamp in milliseconds since epoch
|
|
19
|
-
* @param opts.expectedYear Expected year
|
|
20
|
-
* @param opts.expectedMonth Expected month
|
|
21
|
-
* @param opts.expectedDay Expected day
|
|
22
|
-
* @param opts.expectedHour Expected hour
|
|
23
|
-
* @param opts.expectedMinute Expected minute
|
|
24
|
-
* @returns 1 if the timestamp needs to be increased, -1 if it needs to be decreased, 0 if it is valid
|
|
25
|
-
*/
|
|
26
|
-
const checkTimestamp = (
|
|
27
|
-
opts: {
|
|
28
|
-
timestamp: number,
|
|
29
|
-
expectedYear: number,
|
|
30
|
-
expectedMonth: number,
|
|
31
|
-
expectedDay: number,
|
|
32
|
-
expectedHour: number,
|
|
33
|
-
expectedMinute: number,
|
|
34
|
-
},
|
|
35
|
-
): number => {
|
|
36
|
-
const {
|
|
37
|
-
timestamp,
|
|
38
|
-
expectedYear,
|
|
39
|
-
expectedMonth,
|
|
40
|
-
expectedDay,
|
|
41
|
-
expectedHour,
|
|
42
|
-
expectedMinute,
|
|
43
|
-
} = opts;
|
|
44
|
-
|
|
45
|
-
const timeInfoInET = getTimeInfoInET(timestamp);
|
|
46
|
-
if (timeInfoInET.year < expectedYear) {
|
|
47
|
-
return 1;
|
|
48
|
-
}
|
|
49
|
-
if (timeInfoInET.year > expectedYear) {
|
|
50
|
-
return -1;
|
|
51
|
-
}
|
|
52
|
-
if (timeInfoInET.month < expectedMonth) {
|
|
53
|
-
return 1;
|
|
54
|
-
}
|
|
55
|
-
if (timeInfoInET.month > expectedMonth) {
|
|
56
|
-
return -1;
|
|
57
|
-
}
|
|
58
|
-
if (timeInfoInET.day < expectedDay) {
|
|
59
|
-
return 1;
|
|
60
|
-
}
|
|
61
|
-
if (timeInfoInET.day > expectedDay) {
|
|
62
|
-
return -1;
|
|
63
|
-
}
|
|
64
|
-
if (timeInfoInET.hour < expectedHour) {
|
|
65
|
-
return 1;
|
|
66
|
-
}
|
|
67
|
-
if (timeInfoInET.hour > expectedHour) {
|
|
68
|
-
return -1;
|
|
69
|
-
}
|
|
70
|
-
if (timeInfoInET.minute < expectedMinute) {
|
|
71
|
-
return 1;
|
|
72
|
-
}
|
|
73
|
-
if (timeInfoInET.minute > expectedMinute) {
|
|
74
|
-
return -1;
|
|
75
|
-
}
|
|
76
|
-
return 0;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/*----------------------------------------*/
|
|
80
|
-
/* ---------------- Main ---------------- */
|
|
81
|
-
/*----------------------------------------*/
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Get a timestamp (ms since epoch) from time info (year, month, day, hour, minute, etc.) in Eastern Time (ET)
|
|
85
|
-
* @author Gardenia Liu
|
|
86
|
-
* @author Gabe Abrams
|
|
87
|
-
* @param opts object containing all arguments
|
|
88
|
-
* @param opts.year Year (e.g. 2023)
|
|
89
|
-
* @param opts.month Month (1-12)
|
|
90
|
-
* @param opts.day Day of the month (1-31)
|
|
91
|
-
* @param opts.hour Hour (0-23)
|
|
92
|
-
* @param opts.minute Minute (0-59)
|
|
93
|
-
* @returns Timestamp in milliseconds since epoch
|
|
94
|
-
*/
|
|
95
|
-
const getTimestampFromTimeInfoInET = (
|
|
96
|
-
opts: {
|
|
97
|
-
year: number,
|
|
98
|
-
month: number,
|
|
99
|
-
day: number,
|
|
100
|
-
hour: number,
|
|
101
|
-
minute: number,
|
|
102
|
-
},
|
|
103
|
-
): number => {
|
|
104
|
-
// Destructure opts
|
|
105
|
-
const {
|
|
106
|
-
year,
|
|
107
|
-
month,
|
|
108
|
-
day,
|
|
109
|
-
hour,
|
|
110
|
-
minute,
|
|
111
|
-
} = opts;
|
|
112
|
-
|
|
113
|
-
// Determine if the date is in DST in Eastern Time
|
|
114
|
-
const tempDate = new Date(year, month - 1, day);
|
|
115
|
-
const janOffset = new Date(year, 0, 1).getTimezoneOffset();
|
|
116
|
-
const isDST = tempDate.getTimezoneOffset() < janOffset;
|
|
117
|
-
const etOffset = isDST ? '-04:00' : '-05:00';
|
|
118
|
-
|
|
119
|
-
// Format with leading zeroes
|
|
120
|
-
const mm = padZerosLeft(month, 2);
|
|
121
|
-
const dd = padZerosLeft(day, 2);
|
|
122
|
-
const hh = padZerosLeft(hour, 2);
|
|
123
|
-
const min = padZerosLeft(minute, 2);
|
|
124
|
-
|
|
125
|
-
// Build ET ISO string and convert to UTC timestamp
|
|
126
|
-
const etISOString = `${year}-${mm}-${dd}T${hh}:${min}:00${etOffset}`;
|
|
127
|
-
const baseTimestamp = (new Date(etISOString)).getTime();
|
|
128
|
-
let timestamp = baseTimestamp;
|
|
129
|
-
|
|
130
|
-
// Heat seek to get the right timestamp
|
|
131
|
-
const maxOffset = 24 * 60; // 24 hours in minutes
|
|
132
|
-
let currentOffset = 0; // minutes
|
|
133
|
-
const offsetIncrement = 15; // minutes
|
|
134
|
-
const offsetDirection = checkTimestamp({
|
|
135
|
-
timestamp,
|
|
136
|
-
expectedYear: year,
|
|
137
|
-
expectedMonth: month,
|
|
138
|
-
expectedDay: day,
|
|
139
|
-
expectedHour: hour,
|
|
140
|
-
expectedMinute: minute,
|
|
141
|
-
});
|
|
142
|
-
if (offsetDirection === 0) {
|
|
143
|
-
// Valid! Return the timestamp
|
|
144
|
-
return timestamp;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Heat seek
|
|
148
|
-
while (Math.abs(currentOffset) < maxOffset) {
|
|
149
|
-
// Update offset
|
|
150
|
-
currentOffset += (offsetDirection * offsetIncrement);
|
|
151
|
-
|
|
152
|
-
// Update timestamp
|
|
153
|
-
const offsetMs = currentOffset * 60 * 1000;
|
|
154
|
-
timestamp = baseTimestamp + offsetMs;
|
|
155
|
-
|
|
156
|
-
// Check timestamp again
|
|
157
|
-
const newDirection = checkTimestamp({
|
|
158
|
-
timestamp,
|
|
159
|
-
expectedYear: year,
|
|
160
|
-
expectedMonth: month,
|
|
161
|
-
expectedDay: day,
|
|
162
|
-
expectedHour: hour,
|
|
163
|
-
expectedMinute: minute,
|
|
164
|
-
});
|
|
165
|
-
if (newDirection === 0) {
|
|
166
|
-
// Valid! Return the timestamp
|
|
167
|
-
return timestamp;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Invalid. Keep looping.
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
throw new ErrorWithCode(
|
|
174
|
-
`Timestamp mismatch: expected ${year}-${mm}-${dd} ${hh}:${min}, seeked to offset ${currentOffset} minutes but could not find a valid timestamp.`,
|
|
175
|
-
ReactKitErrorCode.ETTimestampInvalid,
|
|
176
|
-
);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export default getTimestampFromTimeInfoInET;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const punctuationRegex = /[!@#$%^&*(),.?\/;:'"\-\[\]]/g;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Get number of words in string
|
|
5
|
-
* @author Gardenia Liu
|
|
6
|
-
* @author Allison Zhang
|
|
7
|
-
* @author Gabe Abrams
|
|
8
|
-
* @param text the string to check
|
|
9
|
-
* @returns number of words in the string
|
|
10
|
-
*/
|
|
11
|
-
const getWordCount = (text: string): number => {
|
|
12
|
-
const trimmedTextWithoutPunctuation = (
|
|
13
|
-
text
|
|
14
|
-
// Remove leading and trailing whitespace
|
|
15
|
-
.trim()
|
|
16
|
-
// Remove punctuation
|
|
17
|
-
.replace(punctuationRegex, '')
|
|
18
|
-
);
|
|
19
|
-
if (trimmedTextWithoutPunctuation.length === 0) {
|
|
20
|
-
return 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return trimmedTextWithoutPunctuation.split(/\s+/g).length;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default getWordCount;
|
package/src/helpers/idify.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a string to hyphenated lowercase format with no space or
|
|
3
|
-
* non-alphanumeric characters
|
|
4
|
-
* @author Gabe Abrams
|
|
5
|
-
* @param str the string to convert
|
|
6
|
-
* @returns the idified string
|
|
7
|
-
*/
|
|
8
|
-
const idify = (str: string): string => {
|
|
9
|
-
return (
|
|
10
|
-
str
|
|
11
|
-
// Trim whitespace
|
|
12
|
-
.trim()
|
|
13
|
-
// Convert to lowercase
|
|
14
|
-
.toLowerCase()
|
|
15
|
-
// Replace non-alphanumeric characters with hyphens
|
|
16
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
17
|
-
// Change multiple hyphens in a row for a single hyphen
|
|
18
|
-
.replace(/-+/g, '-')
|
|
19
|
-
// Remove hyphens at the beginning and end of the string
|
|
20
|
-
.replace(/^-+|-+$/g, '')
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default idify;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a string, only keep the letters inside it
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
* @param str the string to parse
|
|
5
|
-
* @returns only the letters inside of the string
|
|
6
|
-
*/
|
|
7
|
-
const onlyKeepLetters = (str: string): string => {
|
|
8
|
-
return str.replace(/[^a-zA-Z]+/g, '');
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default onlyKeepLetters;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pad a number's decimal with zeros on the right
|
|
3
|
-
* (e.g. 5.2 becomes 5.20 with 2 digit padding)
|
|
4
|
-
* @author Gabe Abrams
|
|
5
|
-
* @param num the number to pad
|
|
6
|
-
* @param numDigits the minimum number of digits after the decimal
|
|
7
|
-
* @returns padded number
|
|
8
|
-
*/
|
|
9
|
-
const padDecimalZeros = (num: number, numDigits: number): string => {
|
|
10
|
-
// Skip if nothing to do
|
|
11
|
-
if (numDigits < 1) {
|
|
12
|
-
return String(num);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Convert to string
|
|
16
|
-
let out = String(num);
|
|
17
|
-
|
|
18
|
-
// Add a decimal point if there isn't one
|
|
19
|
-
if (!out.includes('.')) {
|
|
20
|
-
out += '.';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Add zeros
|
|
24
|
-
while (out.split('.')[1].length < numDigits) {
|
|
25
|
-
out = `${out}0`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Return
|
|
29
|
-
return out;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default padDecimalZeros;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pad a number with zeros on the left (e.g. 5 becomes 05 with 2 digit padding)
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
* @param num the number to pad
|
|
5
|
-
* @param numDigits the minimum number of digits before the decimal
|
|
6
|
-
* @returns padded number
|
|
7
|
-
*/
|
|
8
|
-
const padZerosLeft = (num: number, numDigits: number): string => {
|
|
9
|
-
// Convert to string
|
|
10
|
-
let out = String(num);
|
|
11
|
-
|
|
12
|
-
// Add zeros
|
|
13
|
-
while (out.split('.')[0].length < numDigits) {
|
|
14
|
-
out = `0${out}`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Return
|
|
18
|
-
return out;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default padZerosLeft;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run tasks in parallel with a limit on how many tasks can execute at once.
|
|
3
|
-
* No guarantees are made about the order of task execution
|
|
4
|
-
* @author Gabe Abrams
|
|
5
|
-
* @param taskFunctions functions that start asynchronous tasks and optionally
|
|
6
|
-
* resolve with values
|
|
7
|
-
* @param [limit=no limit] maximum number of asynchronous tasks to permit to run at
|
|
8
|
-
* once
|
|
9
|
-
* @returns array of resolved values in the same order as the task functions
|
|
10
|
-
*/
|
|
11
|
-
const parallelLimit = async (
|
|
12
|
-
taskFunctions: (() => Promise<any>)[],
|
|
13
|
-
limit?: number,
|
|
14
|
-
): Promise<any[]> => {
|
|
15
|
-
const results: any[] = [];
|
|
16
|
-
|
|
17
|
-
// Wait until finished with all tasks
|
|
18
|
-
await new Promise<void>((resolve) => {
|
|
19
|
-
/* ------------- Helpers ------------ */
|
|
20
|
-
|
|
21
|
-
let nextTaskIndex = 0;
|
|
22
|
-
let numFinishedTasks = 0;
|
|
23
|
-
/**
|
|
24
|
-
* Start the next task
|
|
25
|
-
* @author Gabe Abrams
|
|
26
|
-
*/
|
|
27
|
-
const startTask = async () => {
|
|
28
|
-
const taskIndex = nextTaskIndex++;
|
|
29
|
-
|
|
30
|
-
// Get the task
|
|
31
|
-
const taskFunction = taskFunctions[taskIndex];
|
|
32
|
-
if (!taskFunction) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Execute task
|
|
37
|
-
const result = await taskFunction();
|
|
38
|
-
|
|
39
|
-
// Add results
|
|
40
|
-
results[taskIndex] = result;
|
|
41
|
-
|
|
42
|
-
// Tally and finish
|
|
43
|
-
if (++numFinishedTasks === taskFunctions.length) {
|
|
44
|
-
return resolve();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Not finished! Start another task
|
|
48
|
-
startTask();
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/* ----------- Start Tasks ---------- */
|
|
52
|
-
|
|
53
|
-
// If no limit, start all tasks. At least start 1 task
|
|
54
|
-
const numTasks = Math.max((limit || taskFunctions.length), 1);
|
|
55
|
-
for (let i = 0; i < numTasks; i++) {
|
|
56
|
-
startTask();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return results;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export default parallelLimit;
|