From 9b84b4146df22850bb1da4d00eb4eaf30eb027c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Tsnobiladz=C3=A9?= Date: Wed, 1 Jan 2025 17:59:50 +0100 Subject: [PATCH] remove double encoding/decoding of query params --- examples/client-rendering/package.json | 6 +- examples/client-rendering/rescript.json | 6 + .../__generated__/RouteDeclarations.res | 36 +- ...oot__Todos__ByStatusDecodedExtra_route.res | 30 +- ...t__Todos__ByStatusDecoded__Child_route.res | 30 +- ...te__Root__Todos__ByStatusDecoded_route.res | 30 +- .../Route__Root__Todos__ByStatus_route.res | 30 +- .../Route__Root__Todos__Single_route.res | 30 +- .../Route__Root__Todos_route.res | 30 +- .../src/routes/todoRoutes.json | 6 +- .../test/UrlEncodingDecoding.test.res | 29 + .../__generated__/RouteDeclarations.res | 6 +- .../Route__Root__Todos__ByStatus_route.res | 8 +- .../Route__Root__Todos__Single_route.res | 8 +- .../Route__Root__Todos_route.res | 8 +- .../cli/RescriptRelayRouterCli.bundle.mjs | 16 +- .../cli/RescriptRelayRouterCli__Utils.res | 20 +- packages/rescript-relay-router/package.json | 3 +- packages/rescript-relay-router/rescript.json | 1 + .../test/ReactRouterModifications.test.res | 2 +- .../test/RescriptRelayRouterCli.test.res | 30 +- ...scriptRelayRouterCli__Parser_test.test.res | 2 +- .../test/RouterUtils.test.res | 2 +- .../RescriptRelayServerVitePlugin.bundle.mjs | 16 +- .../RescriptRelayVitePlugin.bundle.mjs | 16 +- packages/utils/.gitignore | 12 + packages/utils/package.json | 17 + packages/utils/rescript.json | 25 + .../test => utils/src}/Vitest.res | 0 yarn.lock | 993 +++++++++++------- 30 files changed, 926 insertions(+), 522 deletions(-) create mode 100644 examples/client-rendering/test/UrlEncodingDecoding.test.res create mode 100644 packages/utils/.gitignore create mode 100644 packages/utils/package.json create mode 100644 packages/utils/rescript.json rename packages/{rescript-relay-router/test => utils/src}/Vitest.res (100%) diff --git a/examples/client-rendering/package.json b/examples/client-rendering/package.json index 8a631c7..9bf1619 100644 --- a/examples/client-rendering/package.json +++ b/examples/client-rendering/package.json @@ -19,7 +19,7 @@ "dev:relay": "yarn build:relay --watch", "dev:rescript": "yarn build:rescript -w", "schema": "npx -y get-graphql-schema http://localhost:4000/graphql > schema.graphql", - "test": "echo 'No tests implemented for express example' || vitest run", + "test": "vitest run", "test:watch": "echo 'No tests implemented for express example' || vitest watch" }, "devDependencies": { @@ -46,9 +46,11 @@ "rollup": "^2", "rollup-plugin-visualizer": "5.5.0", "vite": "^4.4.9", - "vite-plugin-html": "3.2.0" + "vite-plugin-html": "3.2.0", + "vitest": "^2.1.8" }, "dependencies": { + "@rescript-relay-router/utils": "workspace:^", "@rescript/core": "1.5.2", "history": "^5.2.0", "jsonc-parser": "^3.0.0", diff --git a/examples/client-rendering/rescript.json b/examples/client-rendering/rescript.json index c7b6faa..04bea21 100644 --- a/examples/client-rendering/rescript.json +++ b/examples/client-rendering/rescript.json @@ -10,6 +10,11 @@ { "dir": "src", "subdirs": true + }, + { + "dir": "test", + "subdirs": true, + "type": "dev" } ], "package-specs": [ @@ -26,6 +31,7 @@ "rescript-relay-router", "@rescript/core" ], + "bs-dev-dependencies": ["@rescript-relay-router/utils"], "bsc-flags": ["-open RescriptCore"], "pinned-dependencies": ["rescript-relay-router"] } diff --git a/examples/client-rendering/src/routes/__generated__/RouteDeclarations.res b/examples/client-rendering/src/routes/__generated__/RouteDeclarations.res index d2a76b6..5b4e077 100644 --- a/examples/client-rendering/src/routes/__generated__/RouteDeclarations.res +++ b/examples/client-rendering/src/routes/__generated__/RouteDeclarations.res @@ -92,8 +92,9 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayRelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } prepareProps->unsafe_toPrepareProps } @@ -142,6 +143,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayRelayRouter.Bindings.QueryParams.getParamByKey("statuses")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.getOr("") + ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.getOr("") } , @@ -162,8 +164,9 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.getUnsafe("byStatus")->Obj.magic, - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } prepareProps->unsafe_toPrepareProps } @@ -211,6 +214,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.get("byStatus")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statuses")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.getOr("") + ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.getOr("") } , @@ -235,8 +239,9 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.getUnsafe("byStatusDecoded")->((byStatusDecodedRawAsString: string) => (byStatusDecodedRawAsString :> TodoStatusPathParam.t)), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } prepareProps->unsafe_toPrepareProps } @@ -284,6 +289,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.get("byStatusDecoded")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statuses")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.getOr("") + ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.getOr("") } , @@ -304,8 +310,9 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.getUnsafe("byStatusDecoded")->((byStatusDecodedRawAsString: string) => (byStatusDecodedRawAsString :> TodoStatusPathParam.t)), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } prepareProps->unsafe_toPrepareProps } @@ -353,6 +360,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.get("byStatusDecoded")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statuses")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.getOr("") + ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.getOr("") } , @@ -378,8 +386,9 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.getUnsafe("byStatusDecoded")->((byStatusDecodedRawAsString: string) => (byStatusDecodedRawAsString :> TodoStatusPathParam.t)), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } prepareProps->unsafe_toPrepareProps } @@ -427,6 +436,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.get("byStatusDecoded")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statuses")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.getOr("") + ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.getOr("") } , @@ -450,8 +460,9 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.getUnsafe("todoId"), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), showMore: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("showMore")->Option.flatMap(value => switch value { | "true" => Some(true) | "false" => Some(false) @@ -504,6 +515,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.get("todoId")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statuses")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.getOr("") + ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.getOr("") ++ queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("showMore")->Option.getOr("") } diff --git a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecodedExtra_route.res b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecodedExtra_route.res index 2eb201b..0fca2fa 100644 --- a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecodedExtra_route.res +++ b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecodedExtra_route.res @@ -8,6 +8,7 @@ type pathParams = { type queryParams = { statuses: option>, statusWithDefault: TodoStatus.t, + byValue: option, } module Internal = { @@ -47,8 +48,9 @@ module Internal = { location: location, byStatusDecoded: pathParams->Dict.getUnsafe("byStatusDecoded")->((byStatusDecodedRawAsString: string) => (byStatusDecodedRawAsString :> TodoStatusPathParam.t)), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -59,9 +61,11 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), - statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + + byValue: queryParams->QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -74,8 +78,9 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) - queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize->encodeURIComponent) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) + queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize) + queryParams->QueryParams.setParamOpt(~key="byValue", ~value=newParams.byValue->Option.map(byValue => byValue)) } @live @@ -107,23 +112,28 @@ let useQueryParams = (): useQueryParamsReturn => { let routePattern = "/todos/extra/:byStatusDecoded" @live -let makeLink = (~byStatusDecoded: TodoStatusPathParam.t, ~statuses: option>=?, ~statusWithDefault: option=?) => { +let makeLink = (~byStatusDecoded: TodoStatusPathParam.t, ~statuses: option>=?, ~statusWithDefault: option=?, ~byValue: option=?) => { open RelayRouter.Bindings let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } switch statusWithDefault { | None => () - | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize->encodeURIComponent) + | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize) + } + + switch byValue { + | None => () + | Some(byValue) => queryParams->QueryParams.setParam(~key="byValue", ~value=byValue) } RelayRouter.Bindings.generatePath(routePattern, Dict.fromArray([("byStatusDecoded", (byStatusDecoded :> string)->encodeURIComponent)])) ++ queryParams->QueryParams.toString } @live let makeLinkFromQueryParams = (~byStatusDecoded: TodoStatusPathParam.t, queryParams: queryParams) => { - makeLink(~byStatusDecoded, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ) + makeLink(~byStatusDecoded, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ~byValue=?queryParams.byValue, ) } @live diff --git a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded__Child_route.res b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded__Child_route.res index ebae293..424846a 100644 --- a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded__Child_route.res +++ b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded__Child_route.res @@ -8,6 +8,7 @@ type pathParams = { type queryParams = { statuses: option>, statusWithDefault: TodoStatus.t, + byValue: option, } module Internal = { @@ -47,8 +48,9 @@ module Internal = { location: location, byStatusDecoded: pathParams->Dict.getUnsafe("byStatusDecoded")->((byStatusDecodedRawAsString: string) => (byStatusDecodedRawAsString :> TodoStatusPathParam.t)), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -59,9 +61,11 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), - statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + + byValue: queryParams->QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -74,8 +78,9 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) - queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize->encodeURIComponent) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) + queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize) + queryParams->QueryParams.setParamOpt(~key="byValue", ~value=newParams.byValue->Option.map(byValue => byValue)) } @live @@ -107,23 +112,28 @@ let useQueryParams = (): useQueryParamsReturn => { let routePattern = "/todos/:byStatusDecoded" @live -let makeLink = (~byStatusDecoded: TodoStatusPathParam.t, ~statuses: option>=?, ~statusWithDefault: option=?) => { +let makeLink = (~byStatusDecoded: TodoStatusPathParam.t, ~statuses: option>=?, ~statusWithDefault: option=?, ~byValue: option=?) => { open RelayRouter.Bindings let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } switch statusWithDefault { | None => () - | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize->encodeURIComponent) + | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize) + } + + switch byValue { + | None => () + | Some(byValue) => queryParams->QueryParams.setParam(~key="byValue", ~value=byValue) } RelayRouter.Bindings.generatePath(routePattern, Dict.fromArray([("byStatusDecoded", (byStatusDecoded :> string)->encodeURIComponent)])) ++ queryParams->QueryParams.toString } @live let makeLinkFromQueryParams = (~byStatusDecoded: TodoStatusPathParam.t, queryParams: queryParams) => { - makeLink(~byStatusDecoded, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ) + makeLink(~byStatusDecoded, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ~byValue=?queryParams.byValue, ) } @live diff --git a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded_route.res b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded_route.res index b57b449..9043630 100644 --- a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded_route.res +++ b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatusDecoded_route.res @@ -8,6 +8,7 @@ type pathParams = { type queryParams = { statuses: option>, statusWithDefault: TodoStatus.t, + byValue: option, } module Internal = { @@ -55,8 +56,9 @@ module Internal = { location: location, childParams: Obj.magic(pathParams), byStatusDecoded: pathParams->Dict.getUnsafe("byStatusDecoded")->((byStatusDecodedRawAsString: string) => (byStatusDecodedRawAsString :> TodoStatusPathParam.t)), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -67,9 +69,11 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), - statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + + byValue: queryParams->QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -82,8 +86,9 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) - queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize->encodeURIComponent) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) + queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize) + queryParams->QueryParams.setParamOpt(~key="byValue", ~value=newParams.byValue->Option.map(byValue => byValue)) } @live @@ -115,23 +120,28 @@ let useQueryParams = (): useQueryParamsReturn => { let routePattern = "/todos/:byStatusDecoded" @live -let makeLink = (~byStatusDecoded: TodoStatusPathParam.t, ~statuses: option>=?, ~statusWithDefault: option=?) => { +let makeLink = (~byStatusDecoded: TodoStatusPathParam.t, ~statuses: option>=?, ~statusWithDefault: option=?, ~byValue: option=?) => { open RelayRouter.Bindings let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } switch statusWithDefault { | None => () - | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize->encodeURIComponent) + | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize) + } + + switch byValue { + | None => () + | Some(byValue) => queryParams->QueryParams.setParam(~key="byValue", ~value=byValue) } RelayRouter.Bindings.generatePath(routePattern, Dict.fromArray([("byStatusDecoded", (byStatusDecoded :> string)->encodeURIComponent)])) ++ queryParams->QueryParams.toString } @live let makeLinkFromQueryParams = (~byStatusDecoded: TodoStatusPathParam.t, queryParams: queryParams) => { - makeLink(~byStatusDecoded, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ) + makeLink(~byStatusDecoded, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ~byValue=?queryParams.byValue, ) } @live diff --git a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res index 507083a..b66e91a 100644 --- a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res +++ b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res @@ -8,6 +8,7 @@ type pathParams = { type queryParams = { statuses: option>, statusWithDefault: TodoStatus.t, + byValue: option, } module Internal = { @@ -47,8 +48,9 @@ module Internal = { location: location, byStatus: pathParams->Dict.getUnsafe("byStatus")->Obj.magic, - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -59,9 +61,11 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), - statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + + byValue: queryParams->QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -74,8 +78,9 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) - queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize->encodeURIComponent) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) + queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize) + queryParams->QueryParams.setParamOpt(~key="byValue", ~value=newParams.byValue->Option.map(byValue => byValue)) } @live @@ -107,23 +112,28 @@ let useQueryParams = (): useQueryParamsReturn => { let routePattern = "/todos/:byStatus(completed|not-completed)" @live -let makeLink = (~byStatus: [#"completed" | #"not-completed"], ~statuses: option>=?, ~statusWithDefault: option=?) => { +let makeLink = (~byStatus: [#"completed" | #"not-completed"], ~statuses: option>=?, ~statusWithDefault: option=?, ~byValue: option=?) => { open RelayRouter.Bindings let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } switch statusWithDefault { | None => () - | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize->encodeURIComponent) + | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize) + } + + switch byValue { + | None => () + | Some(byValue) => queryParams->QueryParams.setParam(~key="byValue", ~value=byValue) } RelayRouter.Bindings.generatePath(routePattern, Dict.fromArray([("byStatus", (byStatus :> string)->encodeURIComponent)])) ++ queryParams->QueryParams.toString } @live let makeLinkFromQueryParams = (~byStatus: [#"completed" | #"not-completed"], queryParams: queryParams) => { - makeLink(~byStatus, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ) + makeLink(~byStatus, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ~byValue=?queryParams.byValue, ) } @live diff --git a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__Single_route.res b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__Single_route.res index 3562d6b..4a3b88d 100644 --- a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__Single_route.res +++ b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos__Single_route.res @@ -8,6 +8,7 @@ type pathParams = { type queryParams = { statuses: option>, statusWithDefault: TodoStatus.t, + byValue: option, showMore: option, } @@ -48,8 +49,9 @@ module Internal = { location: location, todoId: pathParams->Dict.getUnsafe("todoId"), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), showMore: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("showMore")->Option.flatMap(value => switch value { | "true" => Some(true) | "false" => Some(false) @@ -65,9 +67,11 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), - statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + + byValue: queryParams->QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), showMore: queryParams->QueryParams.getParamByKey("showMore")->Option.flatMap(value => switch value { | "true" => Some(true) @@ -86,8 +90,9 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) - queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize->encodeURIComponent) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) + queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize) + queryParams->QueryParams.setParamOpt(~key="byValue", ~value=newParams.byValue->Option.map(byValue => byValue)) queryParams->QueryParams.setParamOpt(~key="showMore", ~value=newParams.showMore->Option.map(showMore => switch showMore { | true => "true" | false => "false" })) } @@ -120,17 +125,22 @@ let useQueryParams = (): useQueryParamsReturn => { let routePattern = "/todos/:todoId" @live -let makeLink = (~todoId: string, ~statuses: option>=?, ~statusWithDefault: option=?, ~showMore: option=?) => { +let makeLink = (~todoId: string, ~statuses: option>=?, ~statusWithDefault: option=?, ~byValue: option=?, ~showMore: option=?) => { open RelayRouter.Bindings let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } switch statusWithDefault { | None => () - | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize->encodeURIComponent) + | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize) + } + + switch byValue { + | None => () + | Some(byValue) => queryParams->QueryParams.setParam(~key="byValue", ~value=byValue) } switch showMore { @@ -141,7 +151,7 @@ let makeLink = (~todoId: string, ~statuses: option>=?, ~stat } @live let makeLinkFromQueryParams = (~todoId: string, queryParams: queryParams) => { - makeLink(~todoId, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ~showMore=?queryParams.showMore, ) + makeLink(~todoId, ~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ~byValue=?queryParams.byValue, ~showMore=?queryParams.showMore, ) } @live diff --git a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos_route.res b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos_route.res index e8c00e8..8f0a660 100644 --- a/examples/client-rendering/src/routes/__generated__/Route__Root__Todos_route.res +++ b/examples/client-rendering/src/routes/__generated__/Route__Root__Todos_route.res @@ -3,6 +3,7 @@ type queryParams = { statuses: option>, statusWithDefault: TodoStatus.t, + byValue: option, } module Internal = { @@ -49,8 +50,9 @@ module Internal = { location: location, childParams: Obj.magic(pathParams), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), - statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), + statusWithDefault: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + byValue: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -61,9 +63,11 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), - statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->decodeURIComponent->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + statusWithDefault: queryParams->QueryParams.getParamByKey("statusWithDefault")->Option.flatMap(value => value->TodoStatus.parse)->Option.getOr(TodoStatus.defaultValue), + + byValue: queryParams->QueryParams.getParamByKey("byValue")->Option.flatMap(value => Some(value)), } } @@ -76,8 +80,9 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) - queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize->encodeURIComponent) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) + queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=newParams.statusWithDefault->TodoStatus.serialize) + queryParams->QueryParams.setParamOpt(~key="byValue", ~value=newParams.byValue->Option.map(byValue => byValue)) } @live @@ -109,23 +114,28 @@ let useQueryParams = (): useQueryParamsReturn => { let routePattern = "/todos" @live -let makeLink = (~statuses: option>=?, ~statusWithDefault: option=?) => { +let makeLink = (~statuses: option>=?, ~statusWithDefault: option=?, ~byValue: option=?) => { open RelayRouter.Bindings let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } switch statusWithDefault { | None => () - | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize->encodeURIComponent) + | Some(statusWithDefault) => queryParams->QueryParams.setParam(~key="statusWithDefault", ~value=statusWithDefault->TodoStatus.serialize) + } + + switch byValue { + | None => () + | Some(byValue) => queryParams->QueryParams.setParam(~key="byValue", ~value=byValue) } RelayRouter.Bindings.generatePath(routePattern, Dict.fromArray([])) ++ queryParams->QueryParams.toString } @live let makeLinkFromQueryParams = (queryParams: queryParams) => { - makeLink(~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ) + makeLink(~statuses=?queryParams.statuses, ~statusWithDefault=queryParams.statusWithDefault, ~byValue=?queryParams.byValue, ) } @live diff --git a/examples/client-rendering/src/routes/todoRoutes.json b/examples/client-rendering/src/routes/todoRoutes.json index 91c62e1..431809f 100644 --- a/examples/client-rendering/src/routes/todoRoutes.json +++ b/examples/client-rendering/src/routes/todoRoutes.json @@ -1,6 +1,6 @@ [ { - "path": "todos?statuses=array&statusWithDefault=TodoStatus.t!", + "path": "todos?statuses=array&statusWithDefault=TodoStatus.t!&byValue=string", "name": "Todos", "children": [ { @@ -13,14 +13,14 @@ "name": "ByStatusDecoded", "children": [ { - "path": "", + "path": "", "name": "Child" } ] }, { "path": "extra/:byStatusDecoded:TodoStatusPathParam.t", - "name": "ByStatusDecodedExtra", + "name": "ByStatusDecodedExtra" }, { "path": ":todoId?showMore=bool", diff --git a/examples/client-rendering/test/UrlEncodingDecoding.test.res b/examples/client-rendering/test/UrlEncodingDecoding.test.res new file mode 100644 index 0000000..85167a1 --- /dev/null +++ b/examples/client-rendering/test/UrlEncodingDecoding.test.res @@ -0,0 +1,29 @@ +open RescriptRelayRouterUtils.Vitest + +describe("makeLink", () => { + test("should generate link with statuses", _t => { + let link = Routes.Root.Todos.Route.makeLink( + ~statuses=[TodoStatus.Completed, TodoStatus.NotCompleted], + ) + expect(link)->Expect.toBe("/todos?statuses=completed,not-completed") + }) + + test("should generate link without statuses", _t => { + let link = Routes.Root.Todos.Route.makeLink() + expect(link)->Expect.toBe("/todos") + }) + + test("should generate link correctly URI encoded", _t => { + let link = Routes.Root.Todos.Route.makeLink(~byValue="/incorrect value, for url") + expect(link)->Expect.toBe("/todos?byValue=%2Fincorrect%20value%2C%20for%20url") + }) +}) + +describe("parsing", () => { + test("query params are correctly decoded", _t => { + let queryParams = Routes.Root.Todos.Route.parseQueryParams( + "?byValue=%2Fincorrect%20value%2C%20for%20url", + ) + expect(queryParams.byValue->Option.getExn)->Expect.toBe("/incorrect value, for url") + }) +}) diff --git a/examples/express/src/routes/__generated__/RouteDeclarations.res b/examples/express/src/routes/__generated__/RouteDeclarations.res index bbd6ded..50806e6 100644 --- a/examples/express/src/routes/__generated__/RouteDeclarations.res +++ b/examples/express/src/routes/__generated__/RouteDeclarations.res @@ -92,7 +92,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayRelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), } prepareProps->unsafe_toPrepareProps } @@ -160,7 +160,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.getUnsafe("byStatus")->Obj.magic, - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), } prepareProps->unsafe_toPrepareProps } @@ -230,7 +230,7 @@ let make = (~prepareDisposeTimeout=5 * 60 * 1000): arrayDict.getUnsafe("todoId"), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), showMore: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("showMore")->Option.flatMap(value => switch value { | "true" => Some(true) | "false" => Some(false) diff --git a/examples/express/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res b/examples/express/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res index 295328c..a51465b 100644 --- a/examples/express/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res +++ b/examples/express/src/routes/__generated__/Route__Root__Todos__ByStatus_route.res @@ -46,7 +46,7 @@ module Internal = { location: location, byStatus: pathParams->Dict.getUnsafe("byStatus")->Obj.magic, - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), } } @@ -57,7 +57,7 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), } } @@ -70,7 +70,7 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) } @live @@ -107,7 +107,7 @@ let makeLink = (~byStatus: [#"completed" | #"notCompleted"], ~statuses: option () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } RelayRouter.Bindings.generatePath(routePattern, Dict.fromArray([("byStatus", (byStatus :> string)->encodeURIComponent)])) ++ queryParams->QueryParams.toString } diff --git a/examples/express/src/routes/__generated__/Route__Root__Todos__Single_route.res b/examples/express/src/routes/__generated__/Route__Root__Todos__Single_route.res index c0896a9..39c822a 100644 --- a/examples/express/src/routes/__generated__/Route__Root__Todos__Single_route.res +++ b/examples/express/src/routes/__generated__/Route__Root__Todos__Single_route.res @@ -47,7 +47,7 @@ module Internal = { location: location, todoId: pathParams->Dict.getUnsafe("todoId"), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), showMore: queryParams->RelayRouter.Bindings.QueryParams.getParamByKey("showMore")->Option.flatMap(value => switch value { | "true" => Some(true) | "false" => Some(false) @@ -63,7 +63,7 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), showMore: queryParams->QueryParams.getParamByKey("showMore")->Option.flatMap(value => switch value { | "true" => Some(true) @@ -82,7 +82,7 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) queryParams->QueryParams.setParamOpt(~key="showMore", ~value=newParams.showMore->Option.map(showMore => switch showMore { | true => "true" | false => "false" })) } @@ -120,7 +120,7 @@ let makeLink = (~todoId: string, ~statuses: option>=?, ~show let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } switch showMore { diff --git a/examples/express/src/routes/__generated__/Route__Root__Todos_route.res b/examples/express/src/routes/__generated__/Route__Root__Todos_route.res index 3270d08..77f9b65 100644 --- a/examples/express/src/routes/__generated__/Route__Root__Todos_route.res +++ b/examples/express/src/routes/__generated__/Route__Root__Todos_route.res @@ -47,7 +47,7 @@ module Internal = { location: location, childParams: Obj.magic(pathParams), - statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->RelayRouter.Bindings.QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), } } @@ -58,7 +58,7 @@ let parseQueryParams = (search: string): queryParams => { open RelayRouter.Bindings let queryParams = QueryParams.parse(search) { - statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->decodeURIComponent->TodoStatus.parse)), + statuses: queryParams->QueryParams.getArrayParamByKey("statuses")->Option.map(value => value->Array.filterMap(value => value->TodoStatus.parse)), } } @@ -71,7 +71,7 @@ let applyQueryParams = ( open RelayRouter__Bindings - queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize->encodeURIComponent))) + queryParams->QueryParams.setParamArrayOpt(~key="statuses", ~value=newParams.statuses->Option.map(statuses => statuses->Array.map(statuses => statuses->TodoStatus.serialize))) } @live @@ -108,7 +108,7 @@ let makeLink = (~statuses: option>=?) => { let queryParams = QueryParams.make() switch statuses { | None => () - | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize->encodeURIComponent)) + | Some(statuses) => queryParams->QueryParams.setParamArray(~key="statuses", ~value=statuses->Array.map(value => value->TodoStatus.serialize)) } RelayRouter.Bindings.generatePath(routePattern, Dict.fromArray([])) ++ queryParams->QueryParams.toString } diff --git a/packages/rescript-relay-router/cli/RescriptRelayRouterCli.bundle.mjs b/packages/rescript-relay-router/cli/RescriptRelayRouterCli.bundle.mjs index d808ba3..37f65aa 100755 --- a/packages/rescript-relay-router/cli/RescriptRelayRouterCli.bundle.mjs +++ b/packages/rescript-relay-router/cli/RescriptRelayRouterCli.bundle.mjs @@ -2155,7 +2155,7 @@ function toSerializer(queryParam, variableName) { if (typeof queryParam !== "object") { switch (queryParam) { case "String" : - return variableName + "->encodeURIComponent"; + return variableName; case "Boolean" : return "switch " + variableName + " { | true => \"true\" | false => \"false\" }"; case "Int" : @@ -2166,19 +2166,19 @@ function toSerializer(queryParam, variableName) { } } else { if (queryParam.TAG !== "Array") { - return variableName + "->" + queryParam.moduleName + ".serialize->encodeURIComponent"; + return variableName + "->" + queryParam.moduleName + ".serialize"; } var inner = queryParam._0; if (typeof inner === "object") { if (inner.TAG === "Array") { return variableName; } else { - return variableName + "->Array.map(value => value->" + inner.moduleName + ".serialize->encodeURIComponent)"; + return variableName + "->Array.map(value => value->" + inner.moduleName + ".serialize)"; } } switch (inner) { case "String" : - return variableName + "->Array.map(encodeURIComponent)"; + return variableName; case "Boolean" : return variableName + "->Array.map(bool => switch bool { | true => \"true\" | false => \"false\" })"; case "Int" : @@ -2194,7 +2194,7 @@ function toParser(queryParam, variableName) { if (typeof queryParam !== "object") { switch (queryParam) { case "String" : - return "Some(" + variableName + "->decodeURIComponent)"; + return "Some(" + variableName + ")"; case "Boolean" : return "switch " + variableName + " {\n | \"true\" => Some(true)\n | \"false\" => Some(false)\n | _ => None\n }"; case "Int" : @@ -2205,19 +2205,19 @@ function toParser(queryParam, variableName) { } } else { if (queryParam.TAG !== "Array") { - return variableName + "->decodeURIComponent->" + queryParam.moduleName + ".parse"; + return variableName + "->" + queryParam.moduleName + ".parse"; } var inner = queryParam._0; if (typeof inner === "object") { if (inner.TAG === "Array") { return variableName; } else { - return variableName + "->Array.map(value => value->decodeURIComponent->" + inner.moduleName + ".parse)"; + return variableName + "->Array.map(value => value->" + inner.moduleName + ".parse)"; } } switch (inner) { case "String" : - return variableName + "->decodeURIComponent"; + return variableName; case "Boolean" : return variableName + "->Array.map(value => switch value {\n | \"true\" => Some(true)\n | \"false\" => Some(false)\n | _ => None\n })"; case "Int" : diff --git a/packages/rescript-relay-router/cli/RescriptRelayRouterCli__Utils.res b/packages/rescript-relay-router/cli/RescriptRelayRouterCli__Utils.res index 2c35bdd..06d115d 100644 --- a/packages/rescript-relay-router/cli/RescriptRelayRouterCli__Utils.res +++ b/packages/rescript-relay-router/cli/RescriptRelayRouterCli__Utils.res @@ -81,21 +81,21 @@ module QueryParams = { // Prints a serializer for a typed/decoded query param. let toSerializer = (queryParam, ~variableName) => { switch queryParam { - | String => `${variableName}->encodeURIComponent` + | String => variableName | Boolean => `switch ${variableName} { | true => "true" | false => "false" }` | Int => `Int.toString(${variableName})` | Float => `Float.toString(${variableName})` - | CustomModule({moduleName}) => `${variableName}->${moduleName}.serialize->encodeURIComponent` + | CustomModule({moduleName}) => `${variableName}->${moduleName}.serialize` | Array(inner) => switch inner { - | Array(_) => variableName - | String => `${variableName}->Array.map(encodeURIComponent)` + | Array(_) + | String => variableName | Boolean => `${variableName}->Array.map(bool => switch bool { | true => "true" | false => "false" })` | Int => `${variableName}->Array.map(Int.toString)` | Float => `${variableName}->Array.map(Float.toString)` | CustomModule({moduleName}) => - `${variableName}->Array.map(value => value->${moduleName}.serialize->encodeURIComponent)` + `${variableName}->Array.map(value => value->${moduleName}.serialize)` } } } @@ -103,7 +103,7 @@ module QueryParams = { // Prints a parser for a typed query param. let toParser = (queryParam, ~variableName) => { switch queryParam { - | String => `Some(${variableName}->decodeURIComponent)` + | String => `Some(${variableName})` | Boolean => `switch ${variableName} { | "true" => Some(true) @@ -112,11 +112,11 @@ module QueryParams = { }` | Int => `Int.fromString(${variableName})` | Float => `Float.fromString(${variableName})` - | CustomModule({moduleName}) => `${variableName}->decodeURIComponent->${moduleName}.parse` + | CustomModule({moduleName}) => `${variableName}->${moduleName}.parse` | Array(inner) => switch inner { - | Array(_) => variableName - | String => `${variableName}->decodeURIComponent` + | Array(_) + | String => variableName | Boolean => `${variableName}->Array.map(value => switch value { | "true" => Some(true) @@ -126,7 +126,7 @@ module QueryParams = { | Int => `${variableName}->Array.map(Int.fromString)` | Float => `${variableName}->Array.map(Float.fromString)` | CustomModule({moduleName}) => - `${variableName}->Array.map(value => value->decodeURIComponent->${moduleName}.parse)` + `${variableName}->Array.map(value => value->${moduleName}.parse)` } } } diff --git a/packages/rescript-relay-router/package.json b/packages/rescript-relay-router/package.json index 8e7eb5d..c122bfa 100644 --- a/packages/rescript-relay-router/package.json +++ b/packages/rescript-relay-router/package.json @@ -57,9 +57,10 @@ "vscode-jsonrpc": "^5.0.1" }, "devDependencies": { + "@rescript-relay-router/utils": "workspace:^", "@rollup/plugin-node-resolve": "^16.0.0", "rescript": "11.1.3", "rollup": "^4.29.1", - "vitest": "^0.21.1" + "vitest": "^2.1.8" } } diff --git a/packages/rescript-relay-router/rescript.json b/packages/rescript-relay-router/rescript.json index ca7c18f..2a12150 100644 --- a/packages/rescript-relay-router/rescript.json +++ b/packages/rescript-relay-router/rescript.json @@ -34,5 +34,6 @@ ], "suffix": ".mjs", "bs-dependencies": ["@rescript/react", "rescript-relay", "@rescript/core"], + "bs-dev-dependencies": ["@rescript-relay-router/utils"], "bsc-flags": ["-open RescriptCore"] } diff --git a/packages/rescript-relay-router/test/ReactRouterModifications.test.res b/packages/rescript-relay-router/test/ReactRouterModifications.test.res index c353019..ea11799 100644 --- a/packages/rescript-relay-router/test/ReactRouterModifications.test.res +++ b/packages/rescript-relay-router/test/ReactRouterModifications.test.res @@ -1,4 +1,4 @@ -open Vitest +open RescriptRelayRouterUtils.Vitest module P = RescriptRelayRouterCli__Parser module U = RescriptRelayRouterCli__Utils diff --git a/packages/rescript-relay-router/test/RescriptRelayRouterCli.test.res b/packages/rescript-relay-router/test/RescriptRelayRouterCli.test.res index fc2c3e2..f07ac6f 100644 --- a/packages/rescript-relay-router/test/RescriptRelayRouterCli.test.res +++ b/packages/rescript-relay-router/test/RescriptRelayRouterCli.test.res @@ -1,4 +1,4 @@ -open Vitest +open RescriptRelayRouterUtils.Vitest open RescriptRelayRouterCli__Types module U = RescriptRelayRouterCli__Utils @@ -27,9 +27,7 @@ describe("Query params", () => { test("serializes query param types", _t => { open U.QueryParams - expect(String->toSerializer(~variableName="propName"))->Expect.toBe( - "propName->encodeURIComponent", - ) + expect(String->toSerializer(~variableName="propName"))->Expect.toBe("propName") expect( Boolean->toSerializer(~variableName="propName"), )->Expect.toBe(`switch propName { | true => "true" | false => "false" }`) @@ -39,12 +37,10 @@ describe("Query params", () => { CustomModule({moduleName: "SomeModule", required: false})->toSerializer( ~variableName="propName", ), - )->Expect.toBe("propName->SomeModule.serialize->encodeURIComponent") + )->Expect.toBe("propName->SomeModule.serialize") /* Arrays */ - expect(Array(String)->toSerializer(~variableName="propName"))->Expect.toBe( - "propName->Array.map(encodeURIComponent)", - ) + expect(Array(String)->toSerializer(~variableName="propName"))->Expect.toBe("propName") expect( Array(Boolean)->toSerializer(~variableName="propName"), )->Expect.toBe(`propName->Array.map(bool => switch bool { | true => "true" | false => "false" })`) @@ -58,30 +54,26 @@ describe("Query params", () => { Array(CustomModule({moduleName: "SomeModule", required: false}))->toSerializer( ~variableName="propName", ), - )->Expect.toBe("propName->Array.map(value => value->SomeModule.serialize->encodeURIComponent)") + )->Expect.toBe("propName->Array.map(value => value->SomeModule.serialize)") }) test("emits parse code for query params", _t => { open U.QueryParams - expect(String->toParser(~variableName="propName"))->Expect.toBe( - "Some(propName->decodeURIComponent)", - ) + expect(String->toParser(~variableName="propName"))->Expect.toBe("Some(propName)") expect(Int->toParser(~variableName="propName"))->Expect.toBe("Int.fromString(propName)") expect(Float->toParser(~variableName="propName"))->Expect.toBe("Float.fromString(propName)") expect( CustomModule({moduleName: "SomeModule", required: false})->toParser(~variableName="propName"), - )->Expect.toBe("propName->decodeURIComponent->SomeModule.parse") + )->Expect.toBe("propName->SomeModule.parse") expect( CustomModule({moduleName: "SomeModule", required: true})->toParser(~variableName="propName"), - )->Expect.toBe("propName->decodeURIComponent->SomeModule.parse") + )->Expect.toBe("propName->SomeModule.parse") /* Arrays */ - expect(Array(String)->toParser(~variableName="propName"))->Expect.toBe( - "propName->decodeURIComponent", - ) + expect(Array(String)->toParser(~variableName="propName"))->Expect.toBe("propName") expect(Array(Int)->toParser(~variableName="propName"))->Expect.toBe( "propName->Array.map(Int.fromString)", ) @@ -94,13 +86,13 @@ describe("Query params", () => { Array(CustomModule({moduleName: "SomeModule", required: false}))->toParser( ~variableName="propName", ), - )->Expect.toBe("propName->Array.map(value => value->decodeURIComponent->SomeModule.parse)") + )->Expect.toBe("propName->Array.map(value => value->SomeModule.parse)") // Custom module, not required expect( Array(CustomModule({moduleName: "SomeModule", required: true}))->toParser( ~variableName="propName", ), - )->Expect.toBe("propName->Array.map(value => value->decodeURIComponent->SomeModule.parse)") + )->Expect.toBe("propName->Array.map(value => value->SomeModule.parse)") }) }) diff --git a/packages/rescript-relay-router/test/RescriptRelayRouterCli__Parser_test.test.res b/packages/rescript-relay-router/test/RescriptRelayRouterCli__Parser_test.test.res index 4987825..f9b686a 100644 --- a/packages/rescript-relay-router/test/RescriptRelayRouterCli__Parser_test.test.res +++ b/packages/rescript-relay-router/test/RescriptRelayRouterCli__Parser_test.test.res @@ -1,5 +1,5 @@ open RescriptRelayRouterCli__Types -open Vitest +open RescriptRelayRouterUtils.Vitest module P = RescriptRelayRouterCli__Parser module Bindings = RescriptRelayRouterCli__Bindings diff --git a/packages/rescript-relay-router/test/RouterUtils.test.res b/packages/rescript-relay-router/test/RouterUtils.test.res index d68beb7..931cc3f 100644 --- a/packages/rescript-relay-router/test/RouterUtils.test.res +++ b/packages/rescript-relay-router/test/RouterUtils.test.res @@ -1,4 +1,4 @@ -open Vitest +open RescriptRelayRouterUtils.Vitest open RelayRouter__Utils type testCase = { diff --git a/packages/rescript-relay-router/vite-plugins/RescriptRelayServerVitePlugin.bundle.mjs b/packages/rescript-relay-router/vite-plugins/RescriptRelayServerVitePlugin.bundle.mjs index 1c18032..1a76cc9 100644 --- a/packages/rescript-relay-router/vite-plugins/RescriptRelayServerVitePlugin.bundle.mjs +++ b/packages/rescript-relay-router/vite-plugins/RescriptRelayServerVitePlugin.bundle.mjs @@ -2314,7 +2314,7 @@ function toSerializer(queryParam, variableName) { if (typeof queryParam !== "object") { switch (queryParam) { case "String" : - return variableName + "->encodeURIComponent"; + return variableName; case "Boolean" : return "switch " + variableName + " { | true => \"true\" | false => \"false\" }"; case "Int" : @@ -2325,19 +2325,19 @@ function toSerializer(queryParam, variableName) { } } else { if (queryParam.TAG !== "Array") { - return variableName + "->" + queryParam.moduleName + ".serialize->encodeURIComponent"; + return variableName + "->" + queryParam.moduleName + ".serialize"; } var inner = queryParam._0; if (typeof inner === "object") { if (inner.TAG === "Array") { return variableName; } else { - return variableName + "->Array.map(value => value->" + inner.moduleName + ".serialize->encodeURIComponent)"; + return variableName + "->Array.map(value => value->" + inner.moduleName + ".serialize)"; } } switch (inner) { case "String" : - return variableName + "->Array.map(encodeURIComponent)"; + return variableName; case "Boolean" : return variableName + "->Array.map(bool => switch bool { | true => \"true\" | false => \"false\" })"; case "Int" : @@ -2353,7 +2353,7 @@ function toParser(queryParam, variableName) { if (typeof queryParam !== "object") { switch (queryParam) { case "String" : - return "Some(" + variableName + "->decodeURIComponent)"; + return "Some(" + variableName + ")"; case "Boolean" : return "switch " + variableName + " {\n | \"true\" => Some(true)\n | \"false\" => Some(false)\n | _ => None\n }"; case "Int" : @@ -2364,19 +2364,19 @@ function toParser(queryParam, variableName) { } } else { if (queryParam.TAG !== "Array") { - return variableName + "->decodeURIComponent->" + queryParam.moduleName + ".parse"; + return variableName + "->" + queryParam.moduleName + ".parse"; } var inner = queryParam._0; if (typeof inner === "object") { if (inner.TAG === "Array") { return variableName; } else { - return variableName + "->Array.map(value => value->decodeURIComponent->" + inner.moduleName + ".parse)"; + return variableName + "->Array.map(value => value->" + inner.moduleName + ".parse)"; } } switch (inner) { case "String" : - return variableName + "->decodeURIComponent"; + return variableName; case "Boolean" : return variableName + "->Array.map(value => switch value {\n | \"true\" => Some(true)\n | \"false\" => Some(false)\n | _ => None\n })"; case "Int" : diff --git a/packages/rescript-relay-router/vite-plugins/RescriptRelayVitePlugin.bundle.mjs b/packages/rescript-relay-router/vite-plugins/RescriptRelayVitePlugin.bundle.mjs index a31578d..9310d09 100644 --- a/packages/rescript-relay-router/vite-plugins/RescriptRelayVitePlugin.bundle.mjs +++ b/packages/rescript-relay-router/vite-plugins/RescriptRelayVitePlugin.bundle.mjs @@ -2308,7 +2308,7 @@ function toSerializer(queryParam, variableName) { if (typeof queryParam !== "object") { switch (queryParam) { case "String" : - return variableName + "->encodeURIComponent"; + return variableName; case "Boolean" : return "switch " + variableName + " { | true => \"true\" | false => \"false\" }"; case "Int" : @@ -2319,19 +2319,19 @@ function toSerializer(queryParam, variableName) { } } else { if (queryParam.TAG !== "Array") { - return variableName + "->" + queryParam.moduleName + ".serialize->encodeURIComponent"; + return variableName + "->" + queryParam.moduleName + ".serialize"; } var inner = queryParam._0; if (typeof inner === "object") { if (inner.TAG === "Array") { return variableName; } else { - return variableName + "->Array.map(value => value->" + inner.moduleName + ".serialize->encodeURIComponent)"; + return variableName + "->Array.map(value => value->" + inner.moduleName + ".serialize)"; } } switch (inner) { case "String" : - return variableName + "->Array.map(encodeURIComponent)"; + return variableName; case "Boolean" : return variableName + "->Array.map(bool => switch bool { | true => \"true\" | false => \"false\" })"; case "Int" : @@ -2347,7 +2347,7 @@ function toParser(queryParam, variableName) { if (typeof queryParam !== "object") { switch (queryParam) { case "String" : - return "Some(" + variableName + "->decodeURIComponent)"; + return "Some(" + variableName + ")"; case "Boolean" : return "switch " + variableName + " {\n | \"true\" => Some(true)\n | \"false\" => Some(false)\n | _ => None\n }"; case "Int" : @@ -2358,19 +2358,19 @@ function toParser(queryParam, variableName) { } } else { if (queryParam.TAG !== "Array") { - return variableName + "->decodeURIComponent->" + queryParam.moduleName + ".parse"; + return variableName + "->" + queryParam.moduleName + ".parse"; } var inner = queryParam._0; if (typeof inner === "object") { if (inner.TAG === "Array") { return variableName; } else { - return variableName + "->Array.map(value => value->decodeURIComponent->" + inner.moduleName + ".parse)"; + return variableName + "->Array.map(value => value->" + inner.moduleName + ".parse)"; } } switch (inner) { case "String" : - return variableName + "->decodeURIComponent"; + return variableName; case "Boolean" : return variableName + "->Array.map(value => switch value {\n | \"true\" => Some(true)\n | \"false\" => Some(false)\n | _ => None\n })"; case "Int" : diff --git a/packages/utils/.gitignore b/packages/utils/.gitignore new file mode 100644 index 0000000..9c7aab2 --- /dev/null +++ b/packages/utils/.gitignore @@ -0,0 +1,12 @@ +# Ignore common system files +.DS_Store + +# Ignore node modules +node_modules + +# Ignore rescript folders +lib +.bsb.lock + +# Ignore build output +*.mjs diff --git a/packages/utils/package.json b/packages/utils/package.json new file mode 100644 index 0000000..9be0640 --- /dev/null +++ b/packages/utils/package.json @@ -0,0 +1,17 @@ +{ + "name": "@rescript-relay-router/utils", + "version": "0.0.1", + "private": true, + "engines": { + "node": ">=16" + }, + "type": "module", + "packageManager": "yarn@3.2.1", + "scripts": { + "build": "rescript" + }, + "dependencies": { + "@rescript/core": "1.5.2", + "rescript": "11.1.3" + } +} diff --git a/packages/utils/rescript.json b/packages/utils/rescript.json new file mode 100644 index 0000000..d815996 --- /dev/null +++ b/packages/utils/rescript.json @@ -0,0 +1,25 @@ +{ + "name": "@rescript-relay-router/utils", + "namespace": "rescript-relay-router-utils", + "uncurried": true, + "jsx": { + "version": 4, + "mode": "automatic" + }, + "version": "0.1.0", + "sources": [ + { + "dir": "src", + "subdirs": true + } + ], + "package-specs": [ + { + "module": "esmodule", + "in-source": true + } + ], + "suffix": ".mjs", + "bs-dependencies": ["@rescript/core"], + "bsc-flags": ["-open RescriptCore"] +} diff --git a/packages/rescript-relay-router/test/Vitest.res b/packages/utils/src/Vitest.res similarity index 100% rename from packages/rescript-relay-router/test/Vitest.res rename to packages/utils/src/Vitest.res diff --git a/yarn.lock b/yarn.lock index 611a440..e7ef414 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,6 +790,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/aix-ppc64@npm:0.21.5" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/android-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm64@npm:0.18.20" @@ -797,6 +804,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-arm64@npm:0.21.5" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/android-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm@npm:0.18.20" @@ -804,6 +818,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-arm@npm:0.21.5" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@esbuild/android-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-x64@npm:0.18.20" @@ -811,6 +832,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-x64@npm:0.21.5" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + "@esbuild/darwin-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-arm64@npm:0.18.20" @@ -818,6 +846,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/darwin-arm64@npm:0.21.5" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/darwin-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-x64@npm:0.18.20" @@ -825,6 +860,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/darwin-x64@npm:0.21.5" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@esbuild/freebsd-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-arm64@npm:0.18.20" @@ -832,6 +874,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/freebsd-arm64@npm:0.21.5" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/freebsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-x64@npm:0.18.20" @@ -839,6 +888,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/freebsd-x64@npm:0.21.5" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/linux-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm64@npm:0.18.20" @@ -846,6 +902,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-arm64@npm:0.21.5" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/linux-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm@npm:0.18.20" @@ -853,6 +916,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-arm@npm:0.21.5" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@esbuild/linux-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ia32@npm:0.18.20" @@ -860,10 +930,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.15.7": - version: 0.15.7 - resolution: "@esbuild/linux-loong64@npm:0.15.7" - conditions: os=linux & cpu=loong64 +"@esbuild/linux-ia32@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-ia32@npm:0.21.5" + conditions: os=linux & cpu=ia32 languageName: node linkType: hard @@ -874,6 +944,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-loong64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-loong64@npm:0.21.5" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + "@esbuild/linux-mips64el@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-mips64el@npm:0.18.20" @@ -881,6 +958,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-mips64el@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-mips64el@npm:0.21.5" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + "@esbuild/linux-ppc64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ppc64@npm:0.18.20" @@ -888,6 +972,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ppc64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-ppc64@npm:0.21.5" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/linux-riscv64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-riscv64@npm:0.18.20" @@ -895,6 +986,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-riscv64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-riscv64@npm:0.21.5" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + "@esbuild/linux-s390x@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-s390x@npm:0.18.20" @@ -902,6 +1000,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-s390x@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-s390x@npm:0.21.5" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + "@esbuild/linux-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-x64@npm:0.18.20" @@ -909,6 +1014,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-x64@npm:0.21.5" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + "@esbuild/netbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/netbsd-x64@npm:0.18.20" @@ -916,6 +1028,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/netbsd-x64@npm:0.21.5" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/openbsd-x64@npm:0.18.20" @@ -923,6 +1042,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/openbsd-x64@npm:0.21.5" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/sunos-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/sunos-x64@npm:0.18.20" @@ -930,6 +1056,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/sunos-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/sunos-x64@npm:0.21.5" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + "@esbuild/win32-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-arm64@npm:0.18.20" @@ -937,6 +1070,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-arm64@npm:0.21.5" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/win32-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-ia32@npm:0.18.20" @@ -944,6 +1084,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-ia32@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-ia32@npm:0.21.5" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/win32-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-x64@npm:0.18.20" @@ -951,6 +1098,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-x64@npm:0.21.5" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@gar/promisify@npm:^1.1.3": version: 1.1.3 resolution: "@gar/promisify@npm:1.1.3" @@ -990,6 +1144,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/sourcemap-codec@npm:^1.5.0": + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 05df4f2538b3b0f998ea4c1cd34574d0feba216fa5d4ccaef0187d12abf82eafe6021cec8b49f9bb4d90f2ba4582ccc581e72986a5fcf4176ae0cfeb04cf52ec + languageName: node + linkType: hard + "@jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.19 resolution: "@jridgewell/trace-mapping@npm:0.3.19" @@ -1120,6 +1281,7 @@ __metadata: resolution: "@rescript-relay-router-example/client-rendering@workspace:examples/client-rendering" dependencies: "@remix-run/web-fetch": ^4.1.3 + "@rescript-relay-router/utils": "workspace:^" "@rescript/core": 1.5.2 "@rescript/react": 0.13.0 "@vitejs/plugin-react-refresh": 1.3.6 @@ -1147,6 +1309,7 @@ __metadata: rollup-plugin-visualizer: 5.5.0 vite: ^4.4.9 vite-plugin-html: 3.2.0 + vitest: ^2.1.8 vscode-jsonrpc: ^5.0.1 languageName: unknown linkType: soft @@ -1190,6 +1353,15 @@ __metadata: languageName: unknown linkType: soft +"@rescript-relay-router/utils@workspace:^, @rescript-relay-router/utils@workspace:packages/utils": + version: 0.0.0-use.local + resolution: "@rescript-relay-router/utils@workspace:packages/utils" + dependencies: + "@rescript/core": 1.5.2 + rescript: 11.1.3 + languageName: unknown + linkType: soft + "@rescript/core@npm:1.5.2": version: 1.5.2 resolution: "@rescript/core@npm:1.5.2" @@ -1409,29 +1581,6 @@ __metadata: languageName: node linkType: hard -"@types/chai-subset@npm:^1.3.3": - version: 1.3.3 - resolution: "@types/chai-subset@npm:1.3.3" - dependencies: - "@types/chai": "*" - checksum: 4481da7345022995f5a105e6683744f7203d2c3d19cfe88d8e17274d045722948abf55e0adfd97709e0f043dade37a4d4e98cd4c660e2e8a14f23e6ecf79418f - languageName: node - linkType: hard - -"@types/chai@npm:*": - version: 4.3.0 - resolution: "@types/chai@npm:4.3.0" - checksum: 3e393e094263db65df28a0123dc13f342937c1bab6cd173eae913d593c5b9a16b555713a08c34863a1fbf079aa7222b96197c70380a5c130549d6b2f6845a989 - languageName: node - linkType: hard - -"@types/chai@npm:^4.3.3": - version: 4.3.3 - resolution: "@types/chai@npm:4.3.3" - checksum: 20cd094753e137cfc35939cae7f0ed78ecda7861e5c94704efab6979b9121a63807e9b631bdcf3a2792d6c6dba44050b13387262f9e63ebb040741c01c345f0a - languageName: node - linkType: hard - "@types/estree@npm:1.0.6, @types/estree@npm:^1.0.0": version: 1.0.6 resolution: "@types/estree@npm:1.0.6" @@ -1540,6 +1689,87 @@ __metadata: languageName: node linkType: hard +"@vitest/expect@npm:2.1.8": + version: 2.1.8 + resolution: "@vitest/expect@npm:2.1.8" + dependencies: + "@vitest/spy": 2.1.8 + "@vitest/utils": 2.1.8 + chai: ^5.1.2 + tinyrainbow: ^1.2.0 + checksum: 3e81e61dfb5222797ab5e6a70bee2d032fb382c9e7ddc4abe03114f0efbc4cc3b56fc2648e89ae26f5d9261554ea7c696b3a329c8ccea2c702cb87476e4a6842 + languageName: node + linkType: hard + +"@vitest/mocker@npm:2.1.8": + version: 2.1.8 + resolution: "@vitest/mocker@npm:2.1.8" + dependencies: + "@vitest/spy": 2.1.8 + estree-walker: ^3.0.3 + magic-string: ^0.30.12 + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + checksum: 0022d76ff78043c0788380b4e530a03690f8a89a14d1d07c4c069c8fd828a4741d2777ebc486ca0f89b2fb8cf880a7880d6891dd7cfb8cf4339f040131a8bda2 + languageName: node + linkType: hard + +"@vitest/pretty-format@npm:2.1.8, @vitest/pretty-format@npm:^2.1.8": + version: 2.1.8 + resolution: "@vitest/pretty-format@npm:2.1.8" + dependencies: + tinyrainbow: ^1.2.0 + checksum: 2214ca317a19220a5f308a4e77fe403fa091c2f006d1f5b1bd91e8fad6e167db2fdc7882e564da3518d5b2cd9dedb1e97067bb666a820519c54f1c26ac9b0c5a + languageName: node + linkType: hard + +"@vitest/runner@npm:2.1.8": + version: 2.1.8 + resolution: "@vitest/runner@npm:2.1.8" + dependencies: + "@vitest/utils": 2.1.8 + pathe: ^1.1.2 + checksum: 50625597a01fbb55e7edf303b2ce6df7a46347bf05017ce7c4b4ce491ac6d85380aa5dd80127307f2621dc4b3b4081ef8ba1f3f825335f0af812a8e4e08d4aa2 + languageName: node + linkType: hard + +"@vitest/snapshot@npm:2.1.8": + version: 2.1.8 + resolution: "@vitest/snapshot@npm:2.1.8" + dependencies: + "@vitest/pretty-format": 2.1.8 + magic-string: ^0.30.12 + pathe: ^1.1.2 + checksum: ff6a6033fe891c9b19fc33ef2518c29e8afca17c02c463b6b1f40e7e7d51867d5c0bb9b49f524b7c0889337a2c0cae7dcc864851a59a28d3a6e0488cecc45040 + languageName: node + linkType: hard + +"@vitest/spy@npm:2.1.8": + version: 2.1.8 + resolution: "@vitest/spy@npm:2.1.8" + dependencies: + tinyspy: ^3.0.2 + checksum: 0e497e7a7f3170f761c0dbdf983f13d09616b2bae7f640c216644f8d3d1f1a6b6e59aa1e6b75ca2a773355811f0ad6b9d7b6b14596d9b99378040917cada5d49 + languageName: node + linkType: hard + +"@vitest/utils@npm:2.1.8": + version: 2.1.8 + resolution: "@vitest/utils@npm:2.1.8" + dependencies: + "@vitest/pretty-format": 2.1.8 + loupe: ^3.1.2 + tinyrainbow: ^1.2.0 + checksum: 711e7998ba9785880ed416d08b478e2b881cd218d37c3d773b26477adaa6aab91758e01ac039f839175f446111118fb5aa041317b619eeeb05537e3912159eb7 + languageName: node + linkType: hard + "@web3-storage/multipart-parser@npm:^1.0.0": version: 1.0.0 resolution: "@web3-storage/multipart-parser@npm:1.0.0" @@ -1734,10 +1964,10 @@ __metadata: languageName: node linkType: hard -"assertion-error@npm:^1.1.0": - version: 1.1.0 - resolution: "assertion-error@npm:1.1.0" - checksum: fd9429d3a3d4fd61782eb3962ae76b6d08aa7383123fca0596020013b3ebd6647891a85b05ce821c47d1471ed1271f00b0545cf6a4326cf2fc91efcc3b0fbecf +"assertion-error@npm:^2.0.1": + version: 2.0.1 + resolution: "assertion-error@npm:2.0.1" + checksum: a0789dd882211b87116e81e2648ccb7f60340b34f19877dd020b39ebb4714e475eb943e14ba3e22201c221ef6645b7bfe10297e76b6ac95b48a9898c1211ce66 languageName: node linkType: hard @@ -1899,6 +2129,13 @@ __metadata: languageName: node linkType: hard +"cac@npm:^6.7.14": + version: 6.7.14 + resolution: "cac@npm:6.7.14" + checksum: 45a2496a9443abbe7f52a49b22fbe51b1905eff46e03fd5e6c98e3f85077be3f8949685a1849b1a9cd2bc3e5567dfebcf64f01ce01847baf918f1b37c839791a + languageName: node + linkType: hard + "cacache@npm:^16.1.0": version: 16.1.1 resolution: "cacache@npm:16.1.1" @@ -2006,18 +2243,16 @@ __metadata: languageName: node linkType: hard -"chai@npm:^4.3.6": - version: 4.3.6 - resolution: "chai@npm:4.3.6" +"chai@npm:^5.1.2": + version: 5.1.2 + resolution: "chai@npm:5.1.2" dependencies: - assertion-error: ^1.1.0 - check-error: ^1.0.2 - deep-eql: ^3.0.1 - get-func-name: ^2.0.0 - loupe: ^2.3.1 - pathval: ^1.1.1 - type-detect: ^4.0.5 - checksum: acff93fd537f96d4a4d62dd83810285dffcfccb5089e1bf2a1205b28ec82d93dff551368722893cf85004282df10ee68802737c33c90c5493957ed449ed7ce71 + assertion-error: ^2.0.1 + check-error: ^2.1.1 + deep-eql: ^5.0.1 + loupe: ^3.1.0 + pathval: ^2.0.0 + checksum: f2341967ab5632612548d372c27b46219adad3af35021d8cba2ae3c262f588de2c60cb3f004e6ad40e363a9cad6d20d0de51f00e7e9ac31cce17fb05d4efa316 languageName: node linkType: hard @@ -2056,10 +2291,10 @@ __metadata: languageName: node linkType: hard -"check-error@npm:^1.0.2": - version: 1.0.2 - resolution: "check-error@npm:1.0.2" - checksum: d9d106504404b8addd1ee3f63f8c0eaa7cd962a1a28eb9c519b1c4a1dc7098be38007fc0060f045ee00f075fbb7a2a4f42abcf61d68323677e11ab98dc16042e +"check-error@npm:^2.1.1": + version: 2.1.1 + resolution: "check-error@npm:2.1.1" + checksum: d785ed17b1d4a4796b6e75c765a9a290098cf52ff9728ce0756e8ffd4293d2e419dd30c67200aee34202463b474306913f2fcfaf1890641026d9fc6966fea27a languageName: node linkType: hard @@ -2466,7 +2701,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.3.3": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -2487,6 +2722,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:^4.3.7": + version: 4.4.0 + resolution: "debug@npm:4.4.0" + dependencies: + ms: ^2.1.3 + peerDependenciesMeta: + supports-color: + optional: true + checksum: fb42df878dd0e22816fc56e1fdca9da73caa85212fbe40c868b1295a6878f9101ae684f4eeef516c13acfc700f5ea07f1136954f43d4cd2d477a811144136479 + languageName: node + linkType: hard + "decamelize-keys@npm:^1.1.0": version: 1.1.0 resolution: "decamelize-keys@npm:1.1.0" @@ -2513,12 +2760,10 @@ __metadata: languageName: node linkType: hard -"deep-eql@npm:^3.0.1": - version: 3.0.1 - resolution: "deep-eql@npm:3.0.1" - dependencies: - type-detect: ^4.0.0 - checksum: 4f4c9fb79eb994fb6e81d4aa8b063adc40c00f831588aa65e20857d5d52f15fb23034a6576ecf886f7ff6222d5ae42e71e9b7d57113e0715b1df7ea1e812b125 +"deep-eql@npm:^5.0.1": + version: 5.0.2 + resolution: "deep-eql@npm:5.0.2" + checksum: 6aaaadb4c19cbce42e26b2bbe5bd92875f599d2602635dc97f0294bae48da79e89470aedee05f449e0ca8c65e9fd7e7872624d1933a1db02713d99c2ca8d1f24 languageName: node linkType: hard @@ -2825,6 +3070,13 @@ __metadata: languageName: node linkType: hard +"es-module-lexer@npm:^1.5.4": + version: 1.6.0 + resolution: "es-module-lexer@npm:1.6.0" + checksum: 4413a9aed9bf581de62b98174f3eea3f23ce2994fb6832df64bdd6504f6977da1a3b5ebd3c10f75e3c2f214dcf1a1d8b54be5e62c71b7110e6ccedbf975d2b7d + languageName: node + linkType: hard + "es-shim-unscopables@npm:^1.0.0": version: 1.0.0 resolution: "es-shim-unscopables@npm:1.0.0" @@ -2845,220 +3097,6 @@ __metadata: languageName: node linkType: hard -"esbuild-android-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-android-64@npm:0.15.7" - conditions: os=android & cpu=x64 - languageName: node - linkType: hard - -"esbuild-android-arm64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-android-arm64@npm:0.15.7" - conditions: os=android & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-darwin-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-darwin-64@npm:0.15.7" - conditions: os=darwin & cpu=x64 - languageName: node - linkType: hard - -"esbuild-darwin-arm64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-darwin-arm64@npm:0.15.7" - conditions: os=darwin & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-freebsd-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-freebsd-64@npm:0.15.7" - conditions: os=freebsd & cpu=x64 - languageName: node - linkType: hard - -"esbuild-freebsd-arm64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-freebsd-arm64@npm:0.15.7" - conditions: os=freebsd & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-linux-32@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-32@npm:0.15.7" - conditions: os=linux & cpu=ia32 - languageName: node - linkType: hard - -"esbuild-linux-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-64@npm:0.15.7" - conditions: os=linux & cpu=x64 - languageName: node - linkType: hard - -"esbuild-linux-arm64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-arm64@npm:0.15.7" - conditions: os=linux & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-linux-arm@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-arm@npm:0.15.7" - conditions: os=linux & cpu=arm - languageName: node - linkType: hard - -"esbuild-linux-mips64le@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-mips64le@npm:0.15.7" - conditions: os=linux & cpu=mips64el - languageName: node - linkType: hard - -"esbuild-linux-ppc64le@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-ppc64le@npm:0.15.7" - conditions: os=linux & cpu=ppc64 - languageName: node - linkType: hard - -"esbuild-linux-riscv64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-riscv64@npm:0.15.7" - conditions: os=linux & cpu=riscv64 - languageName: node - linkType: hard - -"esbuild-linux-s390x@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-linux-s390x@npm:0.15.7" - conditions: os=linux & cpu=s390x - languageName: node - linkType: hard - -"esbuild-netbsd-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-netbsd-64@npm:0.15.7" - conditions: os=netbsd & cpu=x64 - languageName: node - linkType: hard - -"esbuild-openbsd-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-openbsd-64@npm:0.15.7" - conditions: os=openbsd & cpu=x64 - languageName: node - linkType: hard - -"esbuild-sunos-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-sunos-64@npm:0.15.7" - conditions: os=sunos & cpu=x64 - languageName: node - linkType: hard - -"esbuild-windows-32@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-windows-32@npm:0.15.7" - conditions: os=win32 & cpu=ia32 - languageName: node - linkType: hard - -"esbuild-windows-64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-windows-64@npm:0.15.7" - conditions: os=win32 & cpu=x64 - languageName: node - linkType: hard - -"esbuild-windows-arm64@npm:0.15.7": - version: 0.15.7 - resolution: "esbuild-windows-arm64@npm:0.15.7" - conditions: os=win32 & cpu=arm64 - languageName: node - linkType: hard - -"esbuild@npm:^0.15.6": - version: 0.15.7 - resolution: "esbuild@npm:0.15.7" - dependencies: - "@esbuild/linux-loong64": 0.15.7 - esbuild-android-64: 0.15.7 - esbuild-android-arm64: 0.15.7 - esbuild-darwin-64: 0.15.7 - esbuild-darwin-arm64: 0.15.7 - esbuild-freebsd-64: 0.15.7 - esbuild-freebsd-arm64: 0.15.7 - esbuild-linux-32: 0.15.7 - esbuild-linux-64: 0.15.7 - esbuild-linux-arm: 0.15.7 - esbuild-linux-arm64: 0.15.7 - esbuild-linux-mips64le: 0.15.7 - esbuild-linux-ppc64le: 0.15.7 - esbuild-linux-riscv64: 0.15.7 - esbuild-linux-s390x: 0.15.7 - esbuild-netbsd-64: 0.15.7 - esbuild-openbsd-64: 0.15.7 - esbuild-sunos-64: 0.15.7 - esbuild-windows-32: 0.15.7 - esbuild-windows-64: 0.15.7 - esbuild-windows-arm64: 0.15.7 - dependenciesMeta: - "@esbuild/linux-loong64": - optional: true - esbuild-android-64: - optional: true - esbuild-android-arm64: - optional: true - esbuild-darwin-64: - optional: true - esbuild-darwin-arm64: - optional: true - esbuild-freebsd-64: - optional: true - esbuild-freebsd-arm64: - optional: true - esbuild-linux-32: - optional: true - esbuild-linux-64: - optional: true - esbuild-linux-arm: - optional: true - esbuild-linux-arm64: - optional: true - esbuild-linux-mips64le: - optional: true - esbuild-linux-ppc64le: - optional: true - esbuild-linux-riscv64: - optional: true - esbuild-linux-s390x: - optional: true - esbuild-netbsd-64: - optional: true - esbuild-openbsd-64: - optional: true - esbuild-sunos-64: - optional: true - esbuild-windows-32: - optional: true - esbuild-windows-64: - optional: true - esbuild-windows-arm64: - optional: true - bin: - esbuild: bin/esbuild - checksum: 54ddaa6cf96798d817861b4f68cb8d176075dc09b6e0ed511c57e5db6fd86d2c673ac2ec631ad9b11678d58ad4a77cd6b7a3853b9c6eac29b7f5c6d38e42f92e - languageName: node - linkType: hard - "esbuild@npm:^0.18.10": version: 0.18.20 resolution: "esbuild@npm:0.18.20" @@ -3136,6 +3174,86 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:^0.21.3": + version: 0.21.5 + resolution: "esbuild@npm:0.21.5" + dependencies: + "@esbuild/aix-ppc64": 0.21.5 + "@esbuild/android-arm": 0.21.5 + "@esbuild/android-arm64": 0.21.5 + "@esbuild/android-x64": 0.21.5 + "@esbuild/darwin-arm64": 0.21.5 + "@esbuild/darwin-x64": 0.21.5 + "@esbuild/freebsd-arm64": 0.21.5 + "@esbuild/freebsd-x64": 0.21.5 + "@esbuild/linux-arm": 0.21.5 + "@esbuild/linux-arm64": 0.21.5 + "@esbuild/linux-ia32": 0.21.5 + "@esbuild/linux-loong64": 0.21.5 + "@esbuild/linux-mips64el": 0.21.5 + "@esbuild/linux-ppc64": 0.21.5 + "@esbuild/linux-riscv64": 0.21.5 + "@esbuild/linux-s390x": 0.21.5 + "@esbuild/linux-x64": 0.21.5 + "@esbuild/netbsd-x64": 0.21.5 + "@esbuild/openbsd-x64": 0.21.5 + "@esbuild/sunos-x64": 0.21.5 + "@esbuild/win32-arm64": 0.21.5 + "@esbuild/win32-ia32": 0.21.5 + "@esbuild/win32-x64": 0.21.5 + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 2911c7b50b23a9df59a7d6d4cdd3a4f85855787f374dce751148dbb13305e0ce7e880dde1608c2ab7a927fc6cec3587b80995f7fc87a64b455f8b70b55fd8ec1 + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -3181,6 +3299,15 @@ __metadata: languageName: node linkType: hard +"estree-walker@npm:^3.0.3": + version: 3.0.3 + resolution: "estree-walker@npm:3.0.3" + dependencies: + "@types/estree": ^1.0.0 + checksum: a65728d5727b71de172c5df323385755a16c0fdab8234dc756c3854cfee343261ddfbb72a809a5660fac8c75d960bb3e21aa898c2d7e9b19bb298482ca58a3af + languageName: node + linkType: hard + "etag@npm:~1.8.1": version: 1.8.1 resolution: "etag@npm:1.8.1" @@ -3188,6 +3315,13 @@ __metadata: languageName: node linkType: hard +"expect-type@npm:^1.1.0": + version: 1.1.0 + resolution: "expect-type@npm:1.1.0" + checksum: 65d25ec10bca32bcf650dcfe734532acc4b7a73677c656f299a7cbed273b5c4d6a3dab11af76f452645d54a95c4ef39fc73772f2c8eb6684ba35672958d6f3b3 + languageName: node + linkType: hard + "express@npm:^4.17.2": version: 4.17.2 resolution: "express@npm:4.17.2" @@ -3461,6 +3595,16 @@ __metadata: languageName: node linkType: hard +"fsevents@npm:~2.3.3": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: latest + checksum: 11e6ea6fea15e42461fc55b4b0e4a0a3c654faa567f1877dbd353f39156f69def97a69936d1746619d656c4b93de2238bf731f6085a03a50cabf287c9d024317 + conditions: os=darwin + languageName: node + linkType: hard + "fsevents@patch:fsevents@~2.3.2#~builtin": version: 2.3.2 resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7" @@ -3470,6 +3614,15 @@ __metadata: languageName: node linkType: hard +"fsevents@patch:fsevents@~2.3.3#~builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#~builtin::version=2.3.3&hash=18f3a7" + dependencies: + node-gyp: latest + conditions: os=darwin + languageName: node + linkType: hard + "function-bind@npm:^1.1.1": version: 1.1.1 resolution: "function-bind@npm:1.1.1" @@ -3526,13 +3679,6 @@ __metadata: languageName: node linkType: hard -"get-func-name@npm:^2.0.0": - version: 2.0.0 - resolution: "get-func-name@npm:2.0.0" - checksum: 8d82e69f3e7fab9e27c547945dfe5cc0c57fc0adf08ce135dddb01081d75684a03e7a0487466f478872b341d52ac763ae49e660d01ab83741f74932085f693c3 - languageName: node - linkType: hard - "get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.0, get-intrinsic@npm:^1.1.1": version: 1.1.1 resolution: "get-intrinsic@npm:1.1.1" @@ -4517,13 +4663,6 @@ __metadata: languageName: node linkType: hard -"local-pkg@npm:^0.4.2": - version: 0.4.2 - resolution: "local-pkg@npm:0.4.2" - checksum: 22be451353c25c4411b552bf01880ebc9e995b93574b2facc7757968d888356df59199cacada14162ab53bbc9da055bb692c907b4171f008dbce45a2afc777c1 - languageName: node - linkType: hard - "locate-path@npm:^5.0.0": version: 5.0.0 resolution: "locate-path@npm:5.0.0" @@ -4567,12 +4706,10 @@ __metadata: languageName: node linkType: hard -"loupe@npm:^2.3.1": - version: 2.3.3 - resolution: "loupe@npm:2.3.3" - dependencies: - get-func-name: ^2.0.0 - checksum: 9eaf76fa5e93c30a193b5b7fbb2161ee9a4e4d385bad6d9f146f0d804f9a4157afa2ee9934d1bf66396b858368531db46bad653930fafb7dc444d9592e634088 +"loupe@npm:^3.1.0, loupe@npm:^3.1.2": + version: 3.1.2 + resolution: "loupe@npm:3.1.2" + checksum: 4a75bbe8877a1ced3603e08b1095cd6f4c987c50fe63719fdc3009029560f91e07a915e7f6eff1322bb62bfb2a2beeef06b13ccb3c12f81bda9f3674434dcab9 languageName: node linkType: hard @@ -4643,6 +4780,15 @@ __metadata: languageName: node linkType: hard +"magic-string@npm:^0.30.12": + version: 0.30.17 + resolution: "magic-string@npm:0.30.17" + dependencies: + "@jridgewell/sourcemap-codec": ^1.5.0 + checksum: f4b4ed17c5ada64f77fc98491847302ebad64894a905c417c943840c0384662118c9b37f9f68bb86add159fa4749ff6f118c4627d69a470121b46731f8debc6d + languageName: node + linkType: hard + "make-dir@npm:^3.0.0": version: 3.1.0 resolution: "make-dir@npm:3.1.0" @@ -4948,14 +5094,14 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1": +"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: aa92de608021b242401676e35cfa5aa42dd70cbdc082b916da7fb925c542173e36bce97ea3e804923fe92c0ad991434e4a38327e15a1b5b5f945d66df615ae6d languageName: node linkType: hard -"nanoid@npm:^3.1.22, nanoid@npm:^3.3.4": +"nanoid@npm:^3.1.22": version: 3.3.4 resolution: "nanoid@npm:3.3.4" bin: @@ -4973,6 +5119,15 @@ __metadata: languageName: node linkType: hard +"nanoid@npm:^3.3.7": + version: 3.3.8 + resolution: "nanoid@npm:3.3.8" + bin: + nanoid: bin/nanoid.cjs + checksum: dfe0adbc0c77e9655b550c333075f51bb28cfc7568afbf3237249904f9c86c9aaaed1f113f0fddddba75673ee31c758c30c43d4414f014a52a7a626efc5958c9 + languageName: node + linkType: hard + "negotiator@npm:0.6.2": version: 0.6.2 resolution: "negotiator@npm:0.6.2" @@ -5482,10 +5637,17 @@ __metadata: languageName: node linkType: hard -"pathval@npm:^1.1.1": - version: 1.1.1 - resolution: "pathval@npm:1.1.1" - checksum: 090e3147716647fb7fb5b4b8c8e5b55e5d0a6086d085b6cd23f3d3c01fcf0ff56fd3cc22f2f4a033bd2e46ed55d61ed8379e123b42afe7d531a2a5fc8bb556d6 +"pathe@npm:^1.1.2": + version: 1.1.2 + resolution: "pathe@npm:1.1.2" + checksum: ec5f778d9790e7b9ffc3e4c1df39a5bb1ce94657a4e3ad830c1276491ca9d79f189f47609884671db173400256b005f4955f7952f52a2aeb5834ad5fb4faf134 + languageName: node + linkType: hard + +"pathval@npm:^2.0.0": + version: 2.0.0 + resolution: "pathval@npm:2.0.0" + checksum: 682b6a6289de7990909effef7dae9aa7bb6218c0426727bccf66a35b34e7bfbc65615270c5e44e3c9557a5cb44b1b9ef47fc3cb18bce6ad3ba92bcd28467ed7d languageName: node linkType: hard @@ -5496,6 +5658,13 @@ __metadata: languageName: node linkType: hard +"picocolors@npm:^1.1.1": + version: 1.1.1 + resolution: "picocolors@npm:1.1.1" + checksum: e1cf46bf84886c79055fdfa9dcb3e4711ad259949e3565154b004b260cd356c5d54b31a1437ce9782624bf766272fe6b0154f5f0c744fb7af5d454d2b60db045 + languageName: node + linkType: hard + "picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.2, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -5542,17 +5711,6 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.16": - version: 8.4.16 - resolution: "postcss@npm:8.4.16" - dependencies: - nanoid: ^3.3.4 - picocolors: ^1.0.0 - source-map-js: ^1.0.2 - checksum: 10eee25efd77868036403858577da0cefaf2e0905feeaba5770d5438ccdddba3d01cba8063e96b8aac4c6daa0ed413dd5ae0554a433a3c4db38df1d134cffc1f - languageName: node - linkType: hard - "postcss@npm:^8.4.27": version: 8.4.27 resolution: "postcss@npm:8.4.27" @@ -5564,6 +5722,17 @@ __metadata: languageName: node linkType: hard +"postcss@npm:^8.4.43": + version: 8.4.49 + resolution: "postcss@npm:8.4.49" + dependencies: + nanoid: ^3.3.7 + picocolors: ^1.1.1 + source-map-js: ^1.2.1 + checksum: eb5d6cbdca24f50399aafa5d2bea489e4caee4c563ea1edd5a2485bc5f84e9ceef3febf170272bc83a99c31d23a316ad179213e853f34c2a7a8ffa534559d63a + languageName: node + linkType: hard + "preferred-pm@npm:^3.0.0": version: 3.0.3 resolution: "preferred-pm@npm:3.0.3" @@ -5935,6 +6104,7 @@ __metadata: version: 0.0.0-use.local resolution: "rescript-relay-router@workspace:packages/rescript-relay-router" dependencies: + "@rescript-relay-router/utils": "workspace:^" "@rescript/core": 1.5.2 "@rollup/plugin-node-resolve": ^16.0.0 chalk: ^5.0.1 @@ -5948,7 +6118,7 @@ __metadata: magic-string: ^0.26.2 rescript: 11.1.3 rollup: ^4.29.1 - vitest: ^0.21.1 + vitest: ^2.1.8 vscode-jsonrpc: ^5.0.1 peerDependencies: "@rescript/react": ">=0.13.0" @@ -6132,7 +6302,7 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^4.29.1": +"rollup@npm:^4.20.0, rollup@npm:^4.29.1": version: 4.29.1 resolution: "rollup@npm:4.29.1" dependencies: @@ -6204,20 +6374,6 @@ __metadata: languageName: node linkType: hard -"rollup@npm:~2.78.0": - version: 2.78.1 - resolution: "rollup@npm:2.78.1" - dependencies: - fsevents: ~2.3.2 - dependenciesMeta: - fsevents: - optional: true - bin: - rollup: dist/bin/rollup - checksum: 9034814383ca5bdb4bea6d499270aeb31cdb0bb884f81b0c6a1d19c63cc973f040e6ee09b7af8a7169dd231c090f4b44ef8b99c4bfdf884aceeb3dcefb8cfa14 - languageName: node - linkType: hard - "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0" @@ -6408,6 +6564,13 @@ __metadata: languageName: node linkType: hard +"siginfo@npm:^2.0.0": + version: 2.0.0 + resolution: "siginfo@npm:2.0.0" + checksum: 8aa5a98640ca09fe00d74416eca97551b3e42991614a3d1b824b115fc1401543650914f651ab1311518177e4d297e80b953f4cd4cd7ea1eabe824e8f2091de01 + languageName: node + linkType: hard + "signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.7": version: 3.0.7 resolution: "signal-exit@npm:3.0.7" @@ -6473,6 +6636,13 @@ __metadata: languageName: node linkType: hard +"source-map-js@npm:^1.2.1": + version: 1.2.1 + resolution: "source-map-js@npm:1.2.1" + checksum: 4eb0cd997cdf228bc253bcaff9340afeb706176e64868ecd20efbe6efea931465f43955612346d6b7318789e5265bdc419bc7669c1cebe3db0eb255f57efa76b + languageName: node + linkType: hard + "source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" @@ -6580,6 +6750,13 @@ __metadata: languageName: node linkType: hard +"stackback@npm:0.0.2": + version: 0.0.2 + resolution: "stackback@npm:0.0.2" + checksum: 2d4dc4e64e2db796de4a3c856d5943daccdfa3dd092e452a1ce059c81e9a9c29e0b9badba91b43ef0d5ff5c04ee62feb3bcc559a804e16faf447bac2d883aa99 + languageName: node + linkType: hard + "statuses@npm:>= 1.5.0 < 2, statuses@npm:~1.5.0": version: 1.5.0 resolution: "statuses@npm:1.5.0" @@ -6587,6 +6764,13 @@ __metadata: languageName: node linkType: hard +"std-env@npm:^3.8.0": + version: 3.8.0 + resolution: "std-env@npm:3.8.0" + checksum: ad4554485c2d09138a1d0f03944245e169510e6f5200b7d30fcdd4536e27a2a9a2fd934caff7ef58ebbe21993fa0e2b9e5b1979f431743c925305863b7ff36d5 + languageName: node + linkType: hard + "stream-transform@npm:^2.1.3": version: 2.1.3 resolution: "stream-transform@npm:2.1.3" @@ -6768,17 +6952,38 @@ __metadata: languageName: node linkType: hard -"tinypool@npm:^0.2.4": - version: 0.2.4 - resolution: "tinypool@npm:0.2.4" - checksum: f050bd36c89529a2a0d3f9c1fdbba3f317114e3ee6eb5d5ba72c51e887d45ef3ef8d8533fb2ca2eba7189d19d2231712b81b3a75e099248532f5563369929c33 +"tinybench@npm:^2.9.0": + version: 2.9.0 + resolution: "tinybench@npm:2.9.0" + checksum: 1ab00d7dfe0d1f127cbf00822bacd9024f7a50a3ecd1f354a8168e0b7d2b53a639a24414e707c27879d1adc0f5153141d51d76ebd7b4d37fe245e742e5d91fe8 + languageName: node + linkType: hard + +"tinyexec@npm:^0.3.1": + version: 0.3.2 + resolution: "tinyexec@npm:0.3.2" + checksum: bd491923020610bdeadb0d8cf5d70e7cbad5a3201620fd01048c9bf3b31ffaa75c33254e1540e13b993ce4e8187852b0b5a93057bb598e7a57afa2ca2048a35c languageName: node linkType: hard -"tinyspy@npm:^1.0.0": +"tinypool@npm:^1.0.1": version: 1.0.2 - resolution: "tinyspy@npm:1.0.2" - checksum: 32096121aa8d52bb625ad62c9314b3e4daba4ab9ac428217b12b1e1dfe9860e3c94d54a7affa279cc70dc6f10d88c6ba46b51de68896b318a06d02f05e87dcc3 + resolution: "tinypool@npm:1.0.2" + checksum: 752f23114d8fc95a9497fc812231d6d0a63728376aa11e6e8499c10423a91112e760e388887ea7854f1b16977c321f07c0eab061ec2f60f6761e58b184aac880 + languageName: node + linkType: hard + +"tinyrainbow@npm:^1.2.0": + version: 1.2.0 + resolution: "tinyrainbow@npm:1.2.0" + checksum: d1e2cb5400032c0092be00e4a3da5450bea8b4fad58bfb5d3c58ca37ff5c5e252f7fcfb9af247914854af79c46014add9d1042fe044358c305a129ed55c8be35 + languageName: node + linkType: hard + +"tinyspy@npm:^3.0.2": + version: 3.0.2 + resolution: "tinyspy@npm:3.0.2" + checksum: 5db671b2ff5cd309de650c8c4761ca945459d7204afb1776db9a04fb4efa28a75f08517a8620c01ee32a577748802231ad92f7d5b194dc003ee7f987a2a06337 languageName: node linkType: hard @@ -6872,13 +7077,6 @@ __metadata: languageName: node linkType: hard -"type-detect@npm:^4.0.0, type-detect@npm:^4.0.5": - version: 4.0.8 - resolution: "type-detect@npm:4.0.8" - checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 - languageName: node - linkType: hard - "type-fest@npm:^0.13.1": version: 0.13.1 resolution: "type-fest@npm:0.13.1" @@ -7100,6 +7298,21 @@ __metadata: languageName: node linkType: hard +"vite-node@npm:2.1.8": + version: 2.1.8 + resolution: "vite-node@npm:2.1.8" + dependencies: + cac: ^6.7.14 + debug: ^4.3.7 + es-module-lexer: ^1.5.4 + pathe: ^1.1.2 + vite: ^5.0.0 + bin: + vite-node: vite-node.mjs + checksum: 17914342d05f9ace35c1574555c59dd4116148b71a22bf330f019681d7238a2244b6c2b4a8930d03d5f78e24666d81806c68b84a8db42d7e84165cb10d1c756a + languageName: node + linkType: hard + "vite-plugin-html@npm:3.2.0": version: 3.2.0 resolution: "vite-plugin-html@npm:3.2.0" @@ -7122,51 +7335,60 @@ __metadata: languageName: node linkType: hard -"vite@npm:^2.9.12 || ^3.0.0-0": - version: 3.1.0 - resolution: "vite@npm:3.1.0" +"vite@npm:^4.4.9": + version: 4.4.9 + resolution: "vite@npm:4.4.9" dependencies: - esbuild: ^0.15.6 + esbuild: ^0.18.10 fsevents: ~2.3.2 - postcss: ^8.4.16 - resolve: ^1.22.1 - rollup: ~2.78.0 + postcss: ^8.4.27 + rollup: ^3.27.1 peerDependencies: + "@types/node": ">= 14" less: "*" + lightningcss: ^1.21.0 sass: "*" stylus: "*" + sugarss: "*" terser: ^5.4.0 dependenciesMeta: fsevents: optional: true peerDependenciesMeta: + "@types/node": + optional: true less: optional: true + lightningcss: + optional: true sass: optional: true stylus: optional: true + sugarss: + optional: true terser: optional: true bin: vite: bin/vite.js - checksum: 1a343e3d46450181f79f34ff49cca5ff59bb7472de51ea2c4a042aa076f597d27d25c49f48405e82f607af7d8c1c13a9e789402ccb1b23570132382132ec3903 + checksum: c511024ceae39c68c7dbf2ac4381ee655cd7bb62cf43867a14798bc835d3320b8fa7867a336143c30825c191c1fb4e9aa3348fce831ab617e96203080d3d2908 languageName: node linkType: hard -"vite@npm:^4.4.9": - version: 4.4.9 - resolution: "vite@npm:4.4.9" +"vite@npm:^5.0.0": + version: 5.4.11 + resolution: "vite@npm:5.4.11" dependencies: - esbuild: ^0.18.10 - fsevents: ~2.3.2 - postcss: ^8.4.27 - rollup: ^3.27.1 + esbuild: ^0.21.3 + fsevents: ~2.3.3 + postcss: ^8.4.43 + rollup: ^4.20.0 peerDependencies: - "@types/node": ">= 14" + "@types/node": ^18.0.0 || >=20.0.0 less: "*" lightningcss: ^1.21.0 sass: "*" + sass-embedded: "*" stylus: "*" sugarss: "*" terser: ^5.4.0 @@ -7182,6 +7404,8 @@ __metadata: optional: true sass: optional: true + sass-embedded: + optional: true stylus: optional: true sugarss: @@ -7190,46 +7414,57 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: c511024ceae39c68c7dbf2ac4381ee655cd7bb62cf43867a14798bc835d3320b8fa7867a336143c30825c191c1fb4e9aa3348fce831ab617e96203080d3d2908 - languageName: node - linkType: hard - -"vitest@npm:^0.21.1": - version: 0.21.1 - resolution: "vitest@npm:0.21.1" - dependencies: - "@types/chai": ^4.3.3 - "@types/chai-subset": ^1.3.3 - "@types/node": "*" - chai: ^4.3.6 - debug: ^4.3.4 - local-pkg: ^0.4.2 - tinypool: ^0.2.4 - tinyspy: ^1.0.0 - vite: ^2.9.12 || ^3.0.0-0 + checksum: 8c5b31d17487b69c40a30419dc0ade9f33360eb6893dbfa33a90980271bd74d35ae550b5cbb2a9e640f0df41ea36fd1bb4f222c98f6d02e607080f20832e69e8 + languageName: node + linkType: hard + +"vitest@npm:^2.1.8": + version: 2.1.8 + resolution: "vitest@npm:2.1.8" + dependencies: + "@vitest/expect": 2.1.8 + "@vitest/mocker": 2.1.8 + "@vitest/pretty-format": ^2.1.8 + "@vitest/runner": 2.1.8 + "@vitest/snapshot": 2.1.8 + "@vitest/spy": 2.1.8 + "@vitest/utils": 2.1.8 + chai: ^5.1.2 + debug: ^4.3.7 + expect-type: ^1.1.0 + magic-string: ^0.30.12 + pathe: ^1.1.2 + std-env: ^3.8.0 + tinybench: ^2.9.0 + tinyexec: ^0.3.1 + tinypool: ^1.0.1 + tinyrainbow: ^1.2.0 + vite: ^5.0.0 + vite-node: 2.1.8 + why-is-node-running: ^2.3.0 peerDependencies: "@edge-runtime/vm": "*" - "@vitest/browser": "*" - "@vitest/ui": "*" - c8: "*" + "@types/node": ^18.0.0 || >=20.0.0 + "@vitest/browser": 2.1.8 + "@vitest/ui": 2.1.8 happy-dom: "*" jsdom: "*" peerDependenciesMeta: "@edge-runtime/vm": optional: true + "@types/node": + optional: true "@vitest/browser": optional: true "@vitest/ui": optional: true - c8: - optional: true happy-dom: optional: true jsdom: optional: true bin: vitest: vitest.mjs - checksum: 27c8cd0a1e2443e1311b1ed236d66caad77dcea2c4b49364475688d89d6f8dba2074b1a2da8e7ca529ded15bd5314ff4b36119a0010a33d2dcd34333d4043bd5 + checksum: 2d2f69364556829123c3ff704b36dfd7a2f11cc05fad8a7caf9f0b8c74205caee92f892d4bd5b92a9c2a48267e9b0865a171b2f40fcd593d681f980c3486b299 languageName: node linkType: hard @@ -7353,6 +7588,18 @@ __metadata: languageName: node linkType: hard +"why-is-node-running@npm:^2.3.0": + version: 2.3.0 + resolution: "why-is-node-running@npm:2.3.0" + dependencies: + siginfo: ^2.0.0 + stackback: 0.0.2 + bin: + why-is-node-running: cli.js + checksum: 58ebbf406e243ace97083027f0df7ff4c2108baf2595bb29317718ef207cc7a8104e41b711ff65d6fa354f25daa8756b67f2f04931a4fd6ba9d13ae8197496fb + languageName: node + linkType: hard + "wide-align@npm:^1.1.5": version: 1.1.5 resolution: "wide-align@npm:1.1.5"