codeforlife 2.8.2 → 2.9.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/Countdown-DFI1RljW.js +28 -0
- package/dist/Countdown-DFI1RljW.js.map +1 -0
- package/dist/Countdown-zY3nMzmi.cjs +2 -0
- package/dist/Countdown-zY3nMzmi.cjs.map +1 -0
- package/dist/Image-D5jC9UoX.js +21 -0
- package/dist/Image-D5jC9UoX.js.map +1 -0
- package/dist/Image-mgT45r_B.cjs +2 -0
- package/dist/Image-mgT45r_B.cjs.map +1 -0
- package/dist/LinkButton-BYFkvL_O.cjs +2 -0
- package/dist/LinkButton-BYFkvL_O.cjs.map +1 -0
- package/dist/LinkButton-oK0RThqn.js +12 -0
- package/dist/LinkButton-oK0RThqn.js.map +1 -0
- package/dist/Navigate-Dq47aqC8.js +25 -0
- package/dist/Navigate-Dq47aqC8.js.map +1 -0
- package/dist/Navigate-dQocLhzN.cjs +2 -0
- package/dist/Navigate-dQocLhzN.cjs.map +1 -0
- package/dist/api/endpoints/index.cjs.js +2 -0
- package/dist/api/endpoints/index.cjs.js.map +1 -0
- package/dist/api/endpoints/index.d.ts +81 -0
- package/dist/api/endpoints/index.es.js +78 -0
- package/dist/api/endpoints/index.es.js.map +1 -0
- package/dist/api/index.cjs.js +4 -0
- package/dist/api/index.cjs.js.map +1 -0
- package/dist/api/index.d.ts +77 -0
- package/dist/api/index.es.js +541 -0
- package/dist/api/index.es.js.map +1 -0
- package/dist/api-Cbyt3rw0.js +92 -0
- package/dist/api-Cbyt3rw0.js.map +1 -0
- package/dist/api-CnMfjRk3.cjs +2 -0
- package/dist/api-CnMfjRk3.cjs.map +1 -0
- package/dist/api-Cs4Y-WeI.js +20 -0
- package/dist/api-Cs4Y-WeI.js.map +1 -0
- package/dist/api-DIgp_6Vr.cjs +2 -0
- package/dist/api-DIgp_6Vr.cjs.map +1 -0
- package/dist/api.d.ts +123 -0
- package/dist/auth-BPfUPjmM.js +237 -0
- package/dist/auth-BPfUPjmM.js.map +1 -0
- package/dist/auth-Vf1MgMci.cjs +2 -0
- package/dist/auth-Vf1MgMci.cjs.map +1 -0
- package/dist/auth.d.ts +40 -0
- package/dist/components/form/index.cjs.js +2 -0
- package/dist/components/form/index.cjs.js.map +1 -0
- package/dist/components/form/index.d.ts +86 -0
- package/dist/components/form/index.es.js +18 -0
- package/dist/components/form/index.es.js.map +1 -0
- package/dist/components/index.cjs.js +11 -0
- package/dist/components/index.cjs.js.map +1 -0
- package/dist/components/index.d.ts +90 -0
- package/dist/components/index.es.js +383 -0
- package/dist/components/index.es.js.map +1 -0
- package/dist/components/page/index.cjs.js +2 -0
- package/dist/components/page/index.cjs.js.map +1 -0
- package/dist/components/page/index.d.ts +77 -0
- package/dist/components/page/index.es.js +9 -0
- package/dist/components/page/index.es.js.map +1 -0
- package/dist/components/router/index.cjs.js +2 -0
- package/dist/components/router/index.cjs.js.map +1 -0
- package/dist/components/router/index.d.ts +78 -0
- package/dist/components/router/index.es.js +11 -0
- package/dist/components/router/index.es.js.map +1 -0
- package/dist/components/table/index.cjs.js +2 -0
- package/dist/components/table/index.cjs.js.map +1 -0
- package/dist/components/table/index.d.ts +75 -0
- package/dist/components/table/index.es.js +9 -0
- package/dist/components/table/index.es.js.map +1 -0
- package/dist/en-gb-B_rK7Jx1.js +20 -0
- package/dist/en-gb-B_rK7Jx1.js.map +1 -0
- package/dist/en-gb-CpyEkKq3.cjs +2 -0
- package/dist/en-gb-CpyEkKq3.cjs.map +1 -0
- package/dist/features/index.cjs.js +2 -0
- package/dist/features/index.cjs.js.map +1 -0
- package/dist/features/index.d.ts +76 -0
- package/dist/features/index.es.js +47 -0
- package/dist/features/index.es.js.map +1 -0
- package/dist/form.d.ts +40 -0
- package/dist/general-BPbbmkeX.cjs +2 -0
- package/dist/general-BPbbmkeX.cjs.map +1 -0
- package/dist/general-CtTJPCJn.js +58 -0
- package/dist/general-CtTJPCJn.js.map +1 -0
- package/dist/general.d.ts +53 -0
- package/dist/hooks/index.cjs.js +2 -0
- package/dist/hooks/index.cjs.js.map +1 -0
- package/dist/hooks/index.d.ts +77 -0
- package/dist/hooks/index.es.js +25 -0
- package/dist/hooks/index.es.js.map +1 -0
- package/dist/index-2W--_sNE.js +30 -0
- package/dist/index-2W--_sNE.js.map +1 -0
- package/dist/index-BUMdUVBH.cjs +5 -0
- package/dist/index-BUMdUVBH.cjs.map +1 -0
- package/dist/index-B_Zy_zwA.cjs +2 -0
- package/dist/index-B_Zy_zwA.cjs.map +1 -0
- package/dist/index-BgsynEGX.cjs +2 -0
- package/dist/index-BgsynEGX.cjs.map +1 -0
- package/dist/index-CA-ugBSa.cjs +2 -0
- package/dist/index-CA-ugBSa.cjs.map +1 -0
- package/dist/index-CNtOlJ49.js +572 -0
- package/dist/index-CNtOlJ49.js.map +1 -0
- package/dist/index-DkM_cG3a.js +237 -0
- package/dist/index-DkM_cG3a.js.map +1 -0
- package/dist/index-Dqp7dpn3.js +1111 -0
- package/dist/index-Dqp7dpn3.js.map +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.es.js +7 -0
- package/dist/index.es.js.map +1 -0
- package/dist/jsx-runtime-CeSfJrVB.cjs +31 -0
- package/dist/jsx-runtime-CeSfJrVB.cjs.map +1 -0
- package/dist/jsx-runtime-Dpn_P65e.js +634 -0
- package/dist/jsx-runtime-Dpn_P65e.js.map +1 -0
- package/dist/middlewares/index.cjs.js +2 -0
- package/dist/middlewares/index.cjs.js.map +1 -0
- package/dist/middlewares/index.d.ts +73 -0
- package/dist/middlewares/index.es.js +10 -0
- package/dist/middlewares/index.es.js.map +1 -0
- package/dist/palette-CE2mKYse.cjs +2 -0
- package/dist/palette-CE2mKYse.cjs.map +1 -0
- package/dist/palette-C_L0akN_.js +43 -0
- package/dist/palette-C_L0akN_.js.map +1 -0
- package/dist/router.d.ts +48 -0
- package/dist/rtk-query.modern-CjetfYPg.js +3038 -0
- package/dist/rtk-query.modern-CjetfYPg.js.map +1 -0
- package/dist/rtk-query.modern-PBCErCqb.cjs +15 -0
- package/dist/rtk-query.modern-PBCErCqb.cjs.map +1 -0
- package/dist/schema.d.ts +89 -0
- package/dist/schemas-BZbJpkD5.cjs +2 -0
- package/dist/schemas-BZbJpkD5.cjs.map +1 -0
- package/dist/schemas-DlOtf2vf.js +162 -0
- package/dist/schemas-DlOtf2vf.js.map +1 -0
- package/dist/server.cjs.js +6 -0
- package/dist/server.cjs.js.map +1 -0
- package/dist/server.d.ts +129 -0
- package/dist/server.es.js +127 -0
- package/dist/server.es.js.map +1 -0
- package/dist/session-CE2U7oL1.cjs +2 -0
- package/dist/session-CE2U7oL1.cjs.map +1 -0
- package/dist/session-CacrgFSv.cjs +2 -0
- package/dist/session-CacrgFSv.cjs.map +1 -0
- package/dist/session-D312kYKk.js +32 -0
- package/dist/session-D312kYKk.js.map +1 -0
- package/dist/session-oI-Ht2C8.js +30 -0
- package/dist/session-oI-Ht2C8.js.map +1 -0
- package/dist/settings/index.cjs.js +2 -0
- package/dist/settings/index.cjs.js.map +1 -0
- package/dist/settings/index.d.ts +76 -0
- package/dist/settings/index.es.js +17 -0
- package/dist/settings/index.es.js.map +1 -0
- package/dist/slices/index.cjs.js +2 -0
- package/dist/slices/index.cjs.js.map +1 -0
- package/dist/slices/index.d.ts +74 -0
- package/dist/slices/index.es.js +6 -0
- package/dist/slices/index.es.js.map +1 -0
- package/dist/store.d.ts +17 -0
- package/dist/style.css +1 -0
- package/dist/test.d.ts +75 -0
- package/dist/theme/components/index.cjs.js +2 -0
- package/dist/theme/components/index.cjs.js.map +1 -0
- package/dist/theme/components/index.d.ts +75 -0
- package/dist/theme/components/index.es.js +6 -0
- package/dist/theme/components/index.es.js.map +1 -0
- package/dist/theme/index.cjs.js +2 -0
- package/dist/theme/index.cjs.js.map +1 -0
- package/dist/theme/index.d.ts +79 -0
- package/dist/theme/index.es.js +222 -0
- package/dist/theme/index.es.js.map +1 -0
- package/dist/theme.d.ts +19 -0
- package/dist/urls-DtHr1d3H.js +14 -0
- package/dist/urls-DtHr1d3H.js.map +1 -0
- package/dist/urls-MaVXL_C2.cjs +2 -0
- package/dist/urls-MaVXL_C2.cjs.map +1 -0
- package/dist/utils/api.cjs.js +2 -0
- package/dist/utils/api.cjs.js.map +1 -0
- package/dist/utils/api.d.ts +144 -0
- package/dist/utils/api.es.js +16 -0
- package/dist/utils/api.es.js.map +1 -0
- package/dist/utils/auth.cjs.js +2 -0
- package/dist/utils/auth.cjs.js.map +1 -0
- package/dist/utils/auth.d.ts +100 -0
- package/dist/utils/auth.es.js +117 -0
- package/dist/utils/auth.es.js.map +1 -0
- package/dist/utils/form.cjs.js +2 -0
- package/dist/utils/form.cjs.js.map +1 -0
- package/dist/utils/form.d.ts +97 -0
- package/dist/utils/form.es.js +76 -0
- package/dist/utils/form.es.js.map +1 -0
- package/dist/utils/general.cjs.js +2 -0
- package/dist/utils/general.cjs.js.map +1 -0
- package/dist/utils/general.d.ts +102 -0
- package/{src/utils/general.ts → dist/utils/general.es.js} +87 -165
- package/dist/utils/general.es.js.map +1 -0
- package/dist/utils/router.cjs.js +2 -0
- package/dist/utils/router.cjs.js.map +1 -0
- package/dist/utils/router.d.ts +91 -0
- package/dist/utils/router.es.js +33 -0
- package/dist/utils/router.es.js.map +1 -0
- package/dist/utils/schema.cjs.js +2 -0
- package/dist/utils/schema.cjs.js.map +1 -0
- package/dist/utils/schema.d.ts +115 -0
- package/dist/utils/schema.es.js +123 -0
- package/dist/utils/schema.es.js.map +1 -0
- package/dist/utils/store.cjs.js +2 -0
- package/dist/utils/store.cjs.js.map +1 -0
- package/dist/utils/store.d.ts +82 -0
- package/dist/utils/store.es.js +20 -0
- package/dist/utils/store.es.js.map +1 -0
- package/dist/utils/test.cjs.js +2 -0
- package/dist/utils/test.cjs.js.map +1 -0
- package/dist/utils/test.d.ts +125 -0
- package/dist/utils/test.es.js +60 -0
- package/dist/utils/test.es.js.map +1 -0
- package/dist/utils/theme.cjs.js +2 -0
- package/dist/utils/theme.cjs.js.map +1 -0
- package/dist/utils/theme.d.ts +83 -0
- package/dist/utils/theme.es.js +12 -0
- package/dist/utils/theme.es.js.map +1 -0
- package/dist/utils/window.cjs.js +2 -0
- package/dist/utils/window.cjs.js.map +1 -0
- package/dist/utils/window.d.ts +74 -0
- package/dist/utils/window.es.js +11 -0
- package/dist/utils/window.es.js.map +1 -0
- package/dist/window.d.ts +5 -0
- package/package.json +142 -37
- package/.github/workflows/main.yml +0 -55
- package/.prettierignore +0 -1
- package/CHANGELOG.md +0 -2020
- package/CONTRIBUTING.md +0 -3
- package/eslint.config.js +0 -17
- package/src/api/createApi.ts +0 -91
- package/src/api/endpoints/authFactor.ts +0 -31
- package/src/api/endpoints/index.ts +0 -9
- package/src/api/endpoints/klass.ts +0 -87
- package/src/api/endpoints/school.ts +0 -34
- package/src/api/endpoints/session.ts +0 -47
- package/src/api/endpoints/user.ts +0 -70
- package/src/api/index.ts +0 -5
- package/src/api/models.ts +0 -145
- package/src/api/schemas.ts +0 -243
- package/src/api/tagTypes.ts +0 -12
- package/src/api/urls.ts +0 -13
- package/src/components/App.css +0 -38
- package/src/components/App.tsx +0 -152
- package/src/components/ClickableTooltip.tsx +0 -43
- package/src/components/CopyIconButton.test.tsx +0 -16
- package/src/components/CopyIconButton.tsx +0 -27
- package/src/components/Countdown.tsx +0 -42
- package/src/components/DownloadFileButton.tsx +0 -55
- package/src/components/ElevatedAppBar.tsx +0 -41
- package/src/components/Image.tsx +0 -41
- package/src/components/InputFileButton.tsx +0 -27
- package/src/components/ItemizedList.tsx +0 -61
- package/src/components/OrderedGrid.tsx +0 -92
- package/src/components/ScrollIntoViewLink.tsx +0 -22
- package/src/components/SyncError.tsx +0 -14
- package/src/components/TablePagination.tsx +0 -142
- package/src/components/YouTubeVideo.tsx +0 -26
- package/src/components/form/ApiAutocompleteField.tsx +0 -187
- package/src/components/form/AutocompleteField.tsx +0 -135
- package/src/components/form/CheckboxField.tsx +0 -86
- package/src/components/form/CountryField.tsx +0 -75
- package/src/components/form/DatePickerField.tsx +0 -126
- package/src/components/form/EmailField.tsx +0 -38
- package/src/components/form/FirstNameField.tsx +0 -40
- package/src/components/form/Form.tsx +0 -165
- package/src/components/form/OtpField.tsx +0 -28
- package/src/components/form/PasswordField.tsx +0 -71
- package/src/components/form/RepeatField.tsx +0 -123
- package/src/components/form/SubmitButton.tsx +0 -57
- package/src/components/form/TextField.tsx +0 -150
- package/src/components/form/UkCountyField.tsx +0 -68
- package/src/components/form/index.tsx +0 -35
- package/src/components/index.ts +0 -28
- package/src/components/page/Banner.tsx +0 -95
- package/src/components/page/Notification.tsx +0 -71
- package/src/components/page/Page.tsx +0 -73
- package/src/components/page/Section.tsx +0 -21
- package/src/components/page/TabBar.tsx +0 -131
- package/src/components/page/index.ts +0 -10
- package/src/components/router/Link.tsx +0 -23
- package/src/components/router/LinkButton.tsx +0 -22
- package/src/components/router/LinkIconButton.tsx +0 -22
- package/src/components/router/LinkListItem.tsx +0 -22
- package/src/components/router/LinkTab.tsx +0 -22
- package/src/components/router/Navigate.tsx +0 -33
- package/src/components/router/index.tsx +0 -9
- package/src/components/table/CellStack.tsx +0 -19
- package/src/components/table/Table.tsx +0 -55
- package/src/components/table/index.tsx +0 -8
- package/src/features/InactiveDialog.tsx +0 -40
- package/src/features/ScreenTimeDialog.tsx +0 -30
- package/src/features/index.ts +0 -4
- package/src/fonts/ttf/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/src/fonts/ttf/SpaceGrotesk-VariableFont_wght.ttf +0 -0
- package/src/hooks/api.tsx +0 -39
- package/src/hooks/auth.tsx +0 -397
- package/src/hooks/form.tsx +0 -11
- package/src/hooks/general.tsx +0 -110
- package/src/hooks/index.ts +0 -5
- package/src/hooks/router.tsx +0 -168
- package/src/images/svg/brain.svg +0 -1
- package/src/index.ts +0 -2
- package/src/middlewares/index.ts +0 -1
- package/src/middlewares/session.ts +0 -21
- package/src/scripts/freshDesk.js +0 -473
- package/src/scripts/index.ts +0 -1
- package/src/server.js +0 -187
- package/src/settings/custom.ts +0 -22
- package/src/settings/index.ts +0 -7
- package/src/settings/vite.ts +0 -26
- package/src/setupTests.ts +0 -2
- package/src/slices/createSlice.ts +0 -8
- package/src/slices/index.ts +0 -2
- package/src/slices/session.ts +0 -32
- package/src/theme/ThemedBox.tsx +0 -265
- package/src/theme/colors.ts +0 -57
- package/src/theme/components/MuiAccordion.tsx +0 -13
- package/src/theme/components/MuiAutocomplete.tsx +0 -11
- package/src/theme/components/MuiButton.ts +0 -70
- package/src/theme/components/MuiCardActions.tsx +0 -12
- package/src/theme/components/MuiCheckbox.ts +0 -12
- package/src/theme/components/MuiContainer.ts +0 -19
- package/src/theme/components/MuiDialog.tsx +0 -16
- package/src/theme/components/MuiFormControlLabel.ts +0 -18
- package/src/theme/components/MuiFormHelperText.ts +0 -12
- package/src/theme/components/MuiGrid2.ts +0 -16
- package/src/theme/components/MuiInputBase.ts +0 -14
- package/src/theme/components/MuiLink.ts +0 -41
- package/src/theme/components/MuiList.ts +0 -12
- package/src/theme/components/MuiListItemText.ts +0 -18
- package/src/theme/components/MuiMenu.ts +0 -14
- package/src/theme/components/MuiMenuItem.ts +0 -15
- package/src/theme/components/MuiSelect.ts +0 -16
- package/src/theme/components/MuiTab.ts +0 -29
- package/src/theme/components/MuiTable.ts +0 -29
- package/src/theme/components/MuiTableBody.ts +0 -15
- package/src/theme/components/MuiTableHead.ts +0 -26
- package/src/theme/components/MuiTabs.ts +0 -26
- package/src/theme/components/MuiTextField.ts +0 -86
- package/src/theme/components/MuiToolbar.ts +0 -11
- package/src/theme/components/MuiTypography.ts +0 -12
- package/src/theme/components/_components.ts +0 -95
- package/src/theme/components/index.ts +0 -57
- package/src/theme/index.ts +0 -25
- package/src/theme/palette.ts +0 -98
- package/src/theme/spacing.ts +0 -8
- package/src/theme/typography.ts +0 -101
- package/src/utils/api.test.ts +0 -19
- package/src/utils/api.tsx +0 -339
- package/src/utils/auth.ts +0 -78
- package/src/utils/form.test.ts +0 -50
- package/src/utils/form.ts +0 -193
- package/src/utils/general.test.ts +0 -55
- package/src/utils/router.test.ts +0 -156
- package/src/utils/router.ts +0 -67
- package/src/utils/schema.ts +0 -290
- package/src/utils/store.ts +0 -31
- package/src/utils/test.tsx +0 -82
- package/src/utils/theme.tsx +0 -83
- package/src/utils/window.ts +0 -11
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.app.json +0 -4
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -4
- package/types/fixes.d.ts +0 -18
- package/vite.config.ts +0 -23
package/src/utils/auth.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import Cookies from "js-cookie"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
CSRF_COOKIE_NAME,
|
|
5
|
-
SESSION_COOKIE_NAME,
|
|
6
|
-
SESSION_METADATA_COOKIE_NAME,
|
|
7
|
-
} from "../settings"
|
|
8
|
-
import { generateSecureRandomString } from "./general"
|
|
9
|
-
|
|
10
|
-
export function logout() {
|
|
11
|
-
Cookies.remove(SESSION_COOKIE_NAME)
|
|
12
|
-
Cookies.remove(SESSION_METADATA_COOKIE_NAME)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// https://docs.djangoproject.com/en/3.2/ref/csrf/
|
|
16
|
-
export function getCsrfCookie() {
|
|
17
|
-
return Cookies.get(CSRF_COOKIE_NAME)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function makeOAuth2StorageKey(provider: string, key: string) {
|
|
21
|
-
return `oauth2.${provider}.${key}`
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const OAUTH2_CODE_CHALLENGE_METHODS = ["S256"] as const
|
|
25
|
-
|
|
26
|
-
export type OAuth2CodeChallengeMethods =
|
|
27
|
-
(typeof OAUTH2_CODE_CHALLENGE_METHODS)[number]
|
|
28
|
-
|
|
29
|
-
export const OAUTH2_CODE_CHALLENGE_LENGTHS = [
|
|
30
|
-
43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
|
|
31
|
-
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
|
|
32
|
-
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
|
|
33
|
-
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
|
|
34
|
-
115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
|
|
35
|
-
] as const
|
|
36
|
-
|
|
37
|
-
export type OAuth2CodeChallengeLengths =
|
|
38
|
-
(typeof OAUTH2_CODE_CHALLENGE_LENGTHS)[number]
|
|
39
|
-
|
|
40
|
-
export type OAuth2RequestCodeUrlSearchParams = {
|
|
41
|
-
client_id: string
|
|
42
|
-
redirect_uri: string
|
|
43
|
-
scope: string
|
|
44
|
-
response_type: string
|
|
45
|
-
access_type: string
|
|
46
|
-
prompt?: string
|
|
47
|
-
state: string
|
|
48
|
-
code_challenge: string
|
|
49
|
-
code_challenge_method: string
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type OAuth2ReceiveCodeUrlSearchParams = {
|
|
53
|
-
code: string
|
|
54
|
-
state: string
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type OAuth2CodeChallenge = {
|
|
58
|
-
verifier: string
|
|
59
|
-
challenge: string
|
|
60
|
-
method: OAuth2CodeChallengeMethods
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export async function generateOAuth2CodeChallenge(
|
|
64
|
-
length: OAuth2CodeChallengeLengths,
|
|
65
|
-
): Promise<OAuth2CodeChallenge> {
|
|
66
|
-
const verifier = generateSecureRandomString(length)
|
|
67
|
-
const data = new TextEncoder().encode(verifier)
|
|
68
|
-
const digest = await window.crypto.subtle.digest("SHA-256", data)
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
verifier,
|
|
72
|
-
challenge: btoa(String.fromCharCode(...new Uint8Array(digest)))
|
|
73
|
-
.replace(/\+/g, "-")
|
|
74
|
-
.replace(/\//g, "_")
|
|
75
|
-
.replace(/=+$/, ""),
|
|
76
|
-
method: "S256",
|
|
77
|
-
}
|
|
78
|
-
}
|
package/src/utils/form.test.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { getCleanNames, getDirty, isDirty } from "./form"
|
|
2
|
-
|
|
3
|
-
const VALUES = {
|
|
4
|
-
name: { first: "Peter", last: "Parker" },
|
|
5
|
-
}
|
|
6
|
-
const INITIAL_VALUES: typeof VALUES = {
|
|
7
|
-
name: { first: "Peter", last: "Robbins" },
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// isDirty
|
|
11
|
-
|
|
12
|
-
test("value is dirty", () => {
|
|
13
|
-
const value = isDirty(VALUES, INITIAL_VALUES, "name.last")
|
|
14
|
-
|
|
15
|
-
expect(value).toBe(true)
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
test("value is clean", () => {
|
|
19
|
-
const value = isDirty(VALUES, INITIAL_VALUES, "name.first")
|
|
20
|
-
|
|
21
|
-
expect(value).toBe(false)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
// getDirty
|
|
25
|
-
|
|
26
|
-
test("get dirty values", () => {
|
|
27
|
-
const dirty = getDirty(VALUES, INITIAL_VALUES)
|
|
28
|
-
|
|
29
|
-
expect(dirty).toMatchObject({ "name.first": false, "name.last": true })
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
test("get subset of dirty values", () => {
|
|
33
|
-
const dirty = getDirty(VALUES, INITIAL_VALUES, ["name.first"])
|
|
34
|
-
|
|
35
|
-
expect(dirty).toMatchObject({ "name.first": false })
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
// getCleanNames
|
|
39
|
-
|
|
40
|
-
test("get clean names", () => {
|
|
41
|
-
const cleanNames = getCleanNames(VALUES, INITIAL_VALUES)
|
|
42
|
-
|
|
43
|
-
expect(cleanNames).toMatchObject(["name.first"])
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
test("get subset of clean names", () => {
|
|
47
|
-
const cleanNames = getCleanNames(VALUES, INITIAL_VALUES, ["name.last"])
|
|
48
|
-
|
|
49
|
-
expect(cleanNames).toMatchObject([])
|
|
50
|
-
})
|
package/src/utils/form.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import type { FieldValidator, FormikHelpers } from "formik"
|
|
2
|
-
import { type Schema, type ValidateOptions, ValidationError } from "yup"
|
|
3
|
-
import type { TypedMutationTrigger } from "@reduxjs/toolkit/query/react"
|
|
4
|
-
|
|
5
|
-
import { excludeKeyPaths, getKeyPaths, getNestedProperty } from "./general"
|
|
6
|
-
|
|
7
|
-
export type FormValues = Record<string, any>
|
|
8
|
-
|
|
9
|
-
export function isFormError(error: unknown): boolean {
|
|
10
|
-
return (
|
|
11
|
-
typeof error === "object" &&
|
|
12
|
-
error !== null &&
|
|
13
|
-
"status" in error &&
|
|
14
|
-
error.status === 400 &&
|
|
15
|
-
"data" in error &&
|
|
16
|
-
typeof error.data === "object" &&
|
|
17
|
-
error.data !== null
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function setFormErrors(
|
|
22
|
-
error: unknown,
|
|
23
|
-
setErrors: (errors: object) => void,
|
|
24
|
-
): void {
|
|
25
|
-
if (!isFormError(error)) throw error
|
|
26
|
-
|
|
27
|
-
const data = Object.fromEntries(
|
|
28
|
-
Object.entries((error as { data: object }).data).map(([field, errors]) => {
|
|
29
|
-
if (Array.isArray(errors)) errors = errors.join(". ")
|
|
30
|
-
return [field, errors]
|
|
31
|
-
}),
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
setErrors(data)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type SubmitFormOptions<
|
|
38
|
-
Values extends FormValues,
|
|
39
|
-
QueryArg extends FormValues,
|
|
40
|
-
ResultType,
|
|
41
|
-
> = Partial<{
|
|
42
|
-
exclude: string[]
|
|
43
|
-
include: string[]
|
|
44
|
-
onlyDirtyValues: boolean
|
|
45
|
-
then: (
|
|
46
|
-
result: ResultType,
|
|
47
|
-
values: Values,
|
|
48
|
-
helpers: FormikHelpers<Values>,
|
|
49
|
-
) => void
|
|
50
|
-
catch: (
|
|
51
|
-
error: unknown,
|
|
52
|
-
values: Values,
|
|
53
|
-
helpers: FormikHelpers<Values>,
|
|
54
|
-
) => void
|
|
55
|
-
finally: (values: Values, helpers: FormikHelpers<Values>) => void
|
|
56
|
-
}> &
|
|
57
|
-
(Values extends QueryArg
|
|
58
|
-
? { clean?: (values: Values) => QueryArg }
|
|
59
|
-
: { clean: (values: Values) => QueryArg })
|
|
60
|
-
|
|
61
|
-
export type SubmitFormHandler<Values extends FormValues> = (
|
|
62
|
-
values: Values,
|
|
63
|
-
helpers: FormikHelpers<Values>,
|
|
64
|
-
) => void | Promise<any>
|
|
65
|
-
|
|
66
|
-
export function submitForm<
|
|
67
|
-
Values extends QueryArg,
|
|
68
|
-
QueryArg extends FormValues,
|
|
69
|
-
ResultType,
|
|
70
|
-
>(
|
|
71
|
-
trigger: TypedMutationTrigger<ResultType, QueryArg, any>,
|
|
72
|
-
initialValues: Values,
|
|
73
|
-
options?: SubmitFormOptions<Values, QueryArg, ResultType>,
|
|
74
|
-
): SubmitFormHandler<Values>
|
|
75
|
-
|
|
76
|
-
export function submitForm<
|
|
77
|
-
Values extends FormValues,
|
|
78
|
-
QueryArg extends FormValues,
|
|
79
|
-
ResultType,
|
|
80
|
-
>(
|
|
81
|
-
trigger: TypedMutationTrigger<ResultType, QueryArg, any>,
|
|
82
|
-
initialValues: Values,
|
|
83
|
-
options: SubmitFormOptions<Values, QueryArg, ResultType>,
|
|
84
|
-
): SubmitFormHandler<Values>
|
|
85
|
-
|
|
86
|
-
export function submitForm<
|
|
87
|
-
Values extends FormValues,
|
|
88
|
-
QueryArg extends FormValues,
|
|
89
|
-
ResultType,
|
|
90
|
-
>(
|
|
91
|
-
trigger: TypedMutationTrigger<ResultType, QueryArg, any>,
|
|
92
|
-
initialValues: Values,
|
|
93
|
-
options?: SubmitFormOptions<Values, QueryArg, ResultType>,
|
|
94
|
-
): SubmitFormHandler<Values> {
|
|
95
|
-
const {
|
|
96
|
-
include,
|
|
97
|
-
onlyDirtyValues = false,
|
|
98
|
-
then,
|
|
99
|
-
catch: _catch,
|
|
100
|
-
finally: _finally,
|
|
101
|
-
} = options || {}
|
|
102
|
-
let { exclude = [] } = options || {}
|
|
103
|
-
|
|
104
|
-
return (values, helpers) => {
|
|
105
|
-
let arg =
|
|
106
|
-
options && options.clean
|
|
107
|
-
? options.clean(values as QueryArg & FormValues)
|
|
108
|
-
: (values as unknown as QueryArg)
|
|
109
|
-
|
|
110
|
-
if (onlyDirtyValues) {
|
|
111
|
-
exclude = [
|
|
112
|
-
...exclude,
|
|
113
|
-
...getCleanNames(values, initialValues).filter(
|
|
114
|
-
cleanName => !exclude.includes(cleanName),
|
|
115
|
-
),
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (include) exclude = exclude.filter(name => !include.includes(name))
|
|
120
|
-
|
|
121
|
-
if (exclude.length) arg = excludeKeyPaths(arg, exclude) as QueryArg
|
|
122
|
-
|
|
123
|
-
trigger(arg)
|
|
124
|
-
.unwrap()
|
|
125
|
-
.then(result => {
|
|
126
|
-
if (then) then(result, values, helpers)
|
|
127
|
-
})
|
|
128
|
-
.catch(error => {
|
|
129
|
-
if (_catch) _catch(error, values, helpers)
|
|
130
|
-
setFormErrors(error, helpers.setErrors)
|
|
131
|
-
})
|
|
132
|
-
.finally(() => {
|
|
133
|
-
if (_finally) _finally(values, helpers)
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function schemaToFieldValidator(
|
|
139
|
-
schema: Schema,
|
|
140
|
-
options?: ValidateOptions,
|
|
141
|
-
): FieldValidator {
|
|
142
|
-
return async value => {
|
|
143
|
-
try {
|
|
144
|
-
await schema.validate(value, options)
|
|
145
|
-
} catch (error) {
|
|
146
|
-
if (error instanceof ValidationError) {
|
|
147
|
-
return error.errors.join(". ")
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
throw error
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Checking if individual fields are dirty is not currently supported.
|
|
156
|
-
// https://github.com/jaredpalmer/formik/issues/1421
|
|
157
|
-
export function getDirty<Values extends FormValues>(
|
|
158
|
-
values: Values,
|
|
159
|
-
initialValues: Values,
|
|
160
|
-
names?: string[],
|
|
161
|
-
): Record<string, boolean> {
|
|
162
|
-
if (!names) names = getKeyPaths(values)
|
|
163
|
-
|
|
164
|
-
return Object.fromEntries(
|
|
165
|
-
names.map(name => [name, isDirty(values, initialValues, name)]),
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export function isDirty<Values extends FormValues>(
|
|
170
|
-
values: Values,
|
|
171
|
-
initialValues: Values,
|
|
172
|
-
name: string,
|
|
173
|
-
): boolean {
|
|
174
|
-
const value: unknown = getNestedProperty(values, name)
|
|
175
|
-
const initialValue: unknown = getNestedProperty(initialValues, name)
|
|
176
|
-
|
|
177
|
-
return value !== initialValue
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export function getCleanNames<Values extends FormValues>(
|
|
181
|
-
values: Values,
|
|
182
|
-
initialValues: Values,
|
|
183
|
-
names?: string[],
|
|
184
|
-
): string[] {
|
|
185
|
-
return Object.entries(getDirty(values, initialValues, names))
|
|
186
|
-
.filter(
|
|
187
|
-
([
|
|
188
|
-
_, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
189
|
-
isDirty,
|
|
190
|
-
]) => !isDirty,
|
|
191
|
-
)
|
|
192
|
-
.map(([name]) => name)
|
|
193
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
excludeKeyPaths,
|
|
3
|
-
getKeyPaths,
|
|
4
|
-
getNestedProperty,
|
|
5
|
-
withKeyPaths,
|
|
6
|
-
} from "./general"
|
|
7
|
-
|
|
8
|
-
// getNestedProperty
|
|
9
|
-
|
|
10
|
-
const PERSON = { father: { father: { name: "John" } } }
|
|
11
|
-
|
|
12
|
-
test("get a nested property with dot notation", () => {
|
|
13
|
-
const name = getNestedProperty(PERSON, "father.father.name") as string
|
|
14
|
-
|
|
15
|
-
expect(name).toEqual("John")
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
test("get a nested property with string array", () => {
|
|
19
|
-
const name = getNestedProperty(PERSON, ["father", "father", "name"]) as string
|
|
20
|
-
|
|
21
|
-
expect(name).toEqual("John")
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
test("get a nested property that doesn't exist", () => {
|
|
25
|
-
const name = getNestedProperty(PERSON, "mother.mother.name") as undefined
|
|
26
|
-
|
|
27
|
-
expect(name).toBeUndefined()
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
// withKeyPaths
|
|
31
|
-
|
|
32
|
-
test("set the paths of nested keys", () => {
|
|
33
|
-
const obj = withKeyPaths({ a: 1, b: { c: 2, d: { e: 3 } } })
|
|
34
|
-
|
|
35
|
-
expect(obj).toMatchObject({ a: 1, b: { "b.c": 2, "b.d": { "b.d.e": 3 } } })
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
// getKeyPaths
|
|
39
|
-
|
|
40
|
-
test("get the paths of nested keys", () => {
|
|
41
|
-
const keyPaths = getKeyPaths({ a: 1, b: { c: 2, d: { e: 3 } } })
|
|
42
|
-
|
|
43
|
-
expect(keyPaths).toMatchObject(["a", "b", "b.c", "b.d", "b.d.e"])
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
// excludeKeyPaths
|
|
47
|
-
|
|
48
|
-
test("exclude nested keys by their path", () => {
|
|
49
|
-
const obj = excludeKeyPaths({ a: 1, b: { c: 2, d: { e: 3 } } }, [
|
|
50
|
-
"b.c",
|
|
51
|
-
"b.d.e",
|
|
52
|
-
]) as object
|
|
53
|
-
|
|
54
|
-
expect(obj).toMatchObject({ a: 1, b: { d: {} } })
|
|
55
|
-
})
|
package/src/utils/router.test.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { type Parameters, type Path, path as p } from "./router"
|
|
2
|
-
|
|
3
|
-
const m = <SubMatches extends Record<string, Path>>(
|
|
4
|
-
_: string,
|
|
5
|
-
__: string | Parameters,
|
|
6
|
-
subMatches: SubMatches = {} as SubMatches,
|
|
7
|
-
) => ({ _, __, ...subMatches })
|
|
8
|
-
|
|
9
|
-
function testPaths({
|
|
10
|
-
name,
|
|
11
|
-
paths,
|
|
12
|
-
match,
|
|
13
|
-
}: {
|
|
14
|
-
name: string
|
|
15
|
-
paths: Path
|
|
16
|
-
match: Path
|
|
17
|
-
}) {
|
|
18
|
-
test(name, () => {
|
|
19
|
-
expect(paths).toMatchObject(match)
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
testPaths({
|
|
24
|
-
name: "no nested paths",
|
|
25
|
-
paths: p(""),
|
|
26
|
-
match: m("/", ""),
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
testPaths({
|
|
30
|
-
name: "nested paths",
|
|
31
|
-
paths: p("", {
|
|
32
|
-
a: p("/a", {
|
|
33
|
-
b: p("/b"),
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
match: m("/", "", {
|
|
37
|
-
a: m("/a", "/a"),
|
|
38
|
-
}),
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
testPaths({
|
|
42
|
-
name: "one param",
|
|
43
|
-
paths: p("", {
|
|
44
|
-
person: p("/person", {
|
|
45
|
-
name: p("/:name", {
|
|
46
|
-
sam: p({ name: "samantha" }),
|
|
47
|
-
}),
|
|
48
|
-
}),
|
|
49
|
-
}),
|
|
50
|
-
match: m("/", "", {
|
|
51
|
-
person: m("/person", "/person", {
|
|
52
|
-
name: m("/person/:name", "/:name", {
|
|
53
|
-
sam: m("/person/samantha", { name: "samantha" }),
|
|
54
|
-
}),
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
testPaths({
|
|
60
|
-
name: "multiple params",
|
|
61
|
-
paths: p("", {
|
|
62
|
-
hero: p("/hero", {
|
|
63
|
-
firstAndLastName: p("/:firstName/:lastName", {
|
|
64
|
-
spiderMan: p(
|
|
65
|
-
{ firstName: "peter", lastName: "parker" },
|
|
66
|
-
{
|
|
67
|
-
mainVillain: p("/green-goblin"),
|
|
68
|
-
},
|
|
69
|
-
),
|
|
70
|
-
}),
|
|
71
|
-
}),
|
|
72
|
-
}),
|
|
73
|
-
match: m("/", "", {
|
|
74
|
-
hero: m("/hero", "/hero", {
|
|
75
|
-
firstAndLastName: m(
|
|
76
|
-
"/hero/:firstName/:lastName",
|
|
77
|
-
"/:firstName/:lastName",
|
|
78
|
-
{
|
|
79
|
-
spiderMan: m(
|
|
80
|
-
"/hero/peter/parker",
|
|
81
|
-
{ firstName: "peter", lastName: "parker" },
|
|
82
|
-
{
|
|
83
|
-
mainVillain: m(
|
|
84
|
-
"/hero/peter/parker/green-goblin",
|
|
85
|
-
"/green-goblin",
|
|
86
|
-
),
|
|
87
|
-
},
|
|
88
|
-
),
|
|
89
|
-
},
|
|
90
|
-
),
|
|
91
|
-
}),
|
|
92
|
-
}),
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
testPaths({
|
|
96
|
-
name: "nested params",
|
|
97
|
-
paths: p("", {
|
|
98
|
-
hero: p("/hero", {
|
|
99
|
-
firstName: p("/:firstName", {
|
|
100
|
-
spiderMan: p({ firstName: "peter" }),
|
|
101
|
-
lastName: p("/:lastName?", {
|
|
102
|
-
superMan: p(
|
|
103
|
-
{ firstName: "clark" },
|
|
104
|
-
{
|
|
105
|
-
superMan: p({ lastName: "kent" }),
|
|
106
|
-
},
|
|
107
|
-
),
|
|
108
|
-
}),
|
|
109
|
-
batMan: p(
|
|
110
|
-
{ firstName: "bruce" },
|
|
111
|
-
{
|
|
112
|
-
lastName: p("/:lastName", {
|
|
113
|
-
batMan: p(
|
|
114
|
-
{ lastName: "wayne" },
|
|
115
|
-
{
|
|
116
|
-
mainVillain: p("/joker"),
|
|
117
|
-
},
|
|
118
|
-
),
|
|
119
|
-
}),
|
|
120
|
-
},
|
|
121
|
-
),
|
|
122
|
-
}),
|
|
123
|
-
}),
|
|
124
|
-
}),
|
|
125
|
-
match: m("/", "", {
|
|
126
|
-
hero: m("/hero", "/hero", {
|
|
127
|
-
firstName: m("/hero/:firstName", "/:firstName", {
|
|
128
|
-
spiderMan: m("/hero/peter", { firstName: "peter" }),
|
|
129
|
-
lastName: m("/hero/:firstName/:lastName?", "/:lastName?", {
|
|
130
|
-
superMan: m(
|
|
131
|
-
"/hero/clark",
|
|
132
|
-
{ firstName: "clark" },
|
|
133
|
-
{
|
|
134
|
-
superMan: m("/hero/clark/kent", { lastName: "kent" }),
|
|
135
|
-
},
|
|
136
|
-
),
|
|
137
|
-
}),
|
|
138
|
-
batMan: m(
|
|
139
|
-
"/hero/bruce",
|
|
140
|
-
{ firstName: "bruce" },
|
|
141
|
-
{
|
|
142
|
-
lastName: m("/hero/bruce/:lastName", "/:lastName", {
|
|
143
|
-
batMan: m(
|
|
144
|
-
"/hero/bruce/wayne",
|
|
145
|
-
{ lastName: "wayne" },
|
|
146
|
-
{
|
|
147
|
-
mainVillain: m("/hero/bruce/wayne/joker", "/joker"),
|
|
148
|
-
},
|
|
149
|
-
),
|
|
150
|
-
}),
|
|
151
|
-
},
|
|
152
|
-
),
|
|
153
|
-
}),
|
|
154
|
-
}),
|
|
155
|
-
}),
|
|
156
|
-
})
|
package/src/utils/router.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type To,
|
|
3
|
-
type LinkProps as _LinkProps,
|
|
4
|
-
generatePath,
|
|
5
|
-
} from "react-router-dom"
|
|
6
|
-
|
|
7
|
-
import { type PageState } from "../components/page/Page"
|
|
8
|
-
|
|
9
|
-
export type LinkProps<
|
|
10
|
-
Override extends "delta" | "to",
|
|
11
|
-
State extends Record<string, any> = Record<string, any>,
|
|
12
|
-
> = Omit<_LinkProps, "to" | "state"> &
|
|
13
|
-
(Override extends "delta"
|
|
14
|
-
? { to: number }
|
|
15
|
-
: { to: To; state?: State & Partial<PageState> })
|
|
16
|
-
|
|
17
|
-
export type ReadOnly<T> = {
|
|
18
|
-
readonly [P in keyof T]: T[P]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type Parameters = Record<string, string>
|
|
22
|
-
|
|
23
|
-
export interface Path {
|
|
24
|
-
_: string
|
|
25
|
-
__: string | Parameters
|
|
26
|
-
[subpath: string]: string | Path | Parameters
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function path<Subpaths extends Record<string, Path>>(
|
|
30
|
-
_: string | Parameters,
|
|
31
|
-
subpaths: Subpaths = {} as Subpaths,
|
|
32
|
-
): Path & Subpaths {
|
|
33
|
-
function updatePath(path: Path, root: boolean, params?: Parameters) {
|
|
34
|
-
if (typeof path.__ === "object") {
|
|
35
|
-
params = params ? { ...params, ...path.__ } : path.__
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const _path = typeof _ === "string" && params ? generatePath(_, params) : _
|
|
39
|
-
|
|
40
|
-
Object.entries(path).forEach(([key, subpath]) => {
|
|
41
|
-
if (key !== "__") {
|
|
42
|
-
subpath = subpath as string | Path
|
|
43
|
-
if (typeof subpath === "string") {
|
|
44
|
-
if (typeof _path === "string" && (!root || key !== "_")) {
|
|
45
|
-
let __path = _path + subpath
|
|
46
|
-
if (__path.endsWith("/")) __path = __path.slice(0, -1)
|
|
47
|
-
path[key] = __path
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
updatePath(subpath, false, params)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const path = { ...subpaths, _: typeof _ === "string" ? _ : "", __: _ }
|
|
57
|
-
if (_ === "") {
|
|
58
|
-
path._ = "/"
|
|
59
|
-
} else {
|
|
60
|
-
updatePath(path, true)
|
|
61
|
-
}
|
|
62
|
-
return path
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function getParam(path: Path, key: string) {
|
|
66
|
-
return (path.__ as Parameters)[key]
|
|
67
|
-
}
|