Skip to content

Commit

Permalink
Merge branch 'dev' into IN-831-edit-organization-page
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Dec 4, 2023
2 parents 6ab5d23 + 982970c commit 2924d07
Show file tree
Hide file tree
Showing 25 changed files with 51 additions and 38 deletions.
2 changes: 2 additions & 0 deletions InReach.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@
},
"files.exclude": {
".next/": true,
".trace/": true,
".turbo/": true,
".vercel/": true,
"*.tsbuildinfo": true,
"**/.DS_Store": true,
"**/.git": true,
Expand Down
9 changes: 5 additions & 4 deletions apps/app/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ const nextConfig = {
reactStrictMode: true,
swcMinify: true,
transpilePackages: [
// '@weareinreach/analytics',
'@weareinreach/analytics',
'@weareinreach/api',
'@weareinreach/auth',
// '@weareinreach/crowdin',
'@weareinreach/config',
'@weareinreach/crowdin',
'@weareinreach/db',
// '@weareinreach/env',
'@weareinreach/env',
'@weareinreach/ui',
// '@weareinreach/util',
'@weareinreach/util',
],
compiler: {
...(isVercelProd ? { removeConsole: { exclude: ['error'] } } : {}),
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { type inferRouterInputs, type inferRouterOutputs } from '@trpc/server'
import { devtoolsLink } from 'trpc-client-devtools-link'

import { type AppRouter } from '@weareinreach/api'
import { transformer } from '@weareinreach/api/lib/transformer'
import { getEnv } from '@weareinreach/env'
import { transformer } from '@weareinreach/util/transformer'
// import { createLoggerInstance } from '@weareinreach/util/logger'

// const log = createLoggerInstance('tRPC')
Expand Down
1 change: 0 additions & 1 deletion packages/api/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ export * from './milliseconds'
export * from './nanoIdUrl'
export * from './permissions'
export * from './prismaErrorCodes'
export * from './transformer'
export * from './trpc'
// codegen:end
4 changes: 2 additions & 2 deletions packages/api/lib/initTRPC.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { initTRPC } from '@trpc/server'
import superjson from 'superjson'
import { type TRPCPanelMeta } from 'trpc-panel'
import { ZodError } from 'zod'

import { type Permission } from '@weareinreach/db/generated/permission'
import { transformer } from '@weareinreach/util/transformer'

import { type Context } from './context'

Expand All @@ -15,7 +15,7 @@ export const t = initTRPC
.context<Context>()
.meta<Meta>()
.create({
transformer: superjson,
transformer,
errorFormatter({ shape, error }) {
return {
...shape,
Expand Down
4 changes: 0 additions & 4 deletions packages/api/lib/transformer.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"luxon": "3.4.4",
"nanoid": "5.0.4",
"slugify": "1.6.6",
"superjson": "2.2.1",
"tiny-invariant": "1.3.1",
"zod": "3.22.4"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import superjson from 'superjson'
import { type SuperJSONResult } from 'superjson/dist/types'
import { z } from 'zod'

import { prisma } from '@weareinreach/db'
import { superjson, type SuperJSONResult } from '@weareinreach/util/transformer'
import { type TRPCHandlerParams } from '~api/types/handler'

import { type TGetIntlCrisisSchema } from './query.getIntlCrisis.schema'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import superjson from 'superjson'
import { type SuperJSONResult } from 'superjson/dist/types'

import { prisma } from '@weareinreach/db'
import { accessInstructions } from '@weareinreach/db/zod_util/attributeSupplement'
import { superjson, type SuperJSONResult } from '@weareinreach/util/transformer'
import { isPublic } from '~api/schemas/selects/common'
import { type TRPCHandlerParams } from '~api/types/handler'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mapObjectVals from 'just-map-values'

import { prisma } from '@weareinreach/db'
import { transformer } from '~api/lib/transformer'
import { transformer } from '@weareinreach/util/transformer'
import { globalSelect, globalWhere } from '~api/selects/global'
import { type TRPCHandlerParams } from '~api/types/handler'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { prisma } from '@weareinreach/db'
import { transformer } from '~api/lib/transformer'
import { transformer } from '@weareinreach/util/transformer'
import { globalSelect } from '~api/selects/global'
import { type TRPCHandlerParams } from '~api/types/handler'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import superjson from 'superjson'

import { prisma } from '@weareinreach/db'
import { getEnv } from '@weareinreach/env'
import { superjson } from '@weareinreach/util/transformer'

export const updateInactiveCountryEdgeConfig = async () => {
const active = await prisma.country.findMany({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import superjson from 'superjson'
import { type SuperJSONResult } from 'superjson/dist/types'
import { z } from 'zod'

import { superjson, type SuperJSONResult } from '@weareinreach/util/transformer'

const isURL = (string: string) => z.string().url().safeParse(string).success

const email = z.object({
Expand Down
2 changes: 1 addition & 1 deletion packages/api/schemas/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import superjson from 'superjson'
import { z } from 'zod'

import {
Expand All @@ -7,6 +6,7 @@ import {
JsonInputOrNull,
JsonNullValueInputSchema,
} from '@weareinreach/db/zod_util'
import { superjson } from '@weareinreach/util/transformer'
import { nanoUrlRegex } from '~api/lib/nanoIdUrl'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/api/trpc/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { type inferRouterInputs, type inferRouterOutputs } from '@trpc/server'
import { devtoolsLink } from 'trpc-client-devtools-link'

import { getEnv } from '@weareinreach/env'
import { transformer } from '@weareinreach/util/transformer'

import { transformer } from '../lib/transformer'
import { type AppRouter } from '../router'

const getBaseUrl = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/trpc/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { type GetServerSidePropsContext, type NextApiRequest, type NextApiRespon

import { getServerSession } from '@weareinreach/auth/next-auth/get-session'
import { type Session } from '@weareinreach/auth/next-auth/types'
import { transformer } from '@weareinreach/util/transformer'
import { createContextInner } from '~api/lib/context'
import { transformer } from '~api/lib/transformer'
import { appRouter } from '~api/router'

interface SSRContext {
Expand Down
3 changes: 1 addition & 2 deletions packages/db/lib/superjsonMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Prisma } from '@prisma/client'
import superjson from 'superjson'
import { type SuperJSONResult } from 'superjson/dist/types'
import { z } from 'zod'

import { createLoggerInstance } from '@weareinreach/util/logger'
import { superjson, type SuperJSONResult } from '@weareinreach/util/transformer'

import { NullableJsonValue } from './zod'

Expand Down
3 changes: 2 additions & 1 deletion packages/db/zod_util/prismaJson.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import superjson from 'superjson'
import { z } from 'zod'

import { superjson } from '@weareinreach/util/transformer'

import { type Prisma } from '..'

export const InputJsonValue: z.ZodType<Prisma.InputJsonValue> = z.union([
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/.storybook/decorators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { StrictMode, useEffect, useState } from 'react'
import { I18nextProvider } from 'react-i18next'
import { devtoolsLink } from 'trpc-client-devtools-link'

import { transformer } from '@weareinreach/api/lib/transformer'
import { transformer } from '@weareinreach/util/transformer'
import { BodyGrid } from '~ui/layouts/BodyGrid'
import { type StorybookTRPC, trpc } from '~ui/lib/trpcClient'
import { GoogleMapsProvider } from '~ui/providers/GoogleMaps'
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/components/sections/ServicesInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Card, createStyles, Group, rem, Skeleton, Stack, Text } from '@mantine/
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'

import { transformer } from '@weareinreach/api/lib/transformer'
import { transformer } from '@weareinreach/util/transformer'
import { Badge, BadgeGroup } from '~ui/components/core/Badge'
import { useCustomVariant, useScreenSize } from '~ui/hooks'
import { Icon } from '~ui/icon'
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/getTrpcMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path'
import querystring from 'querystring'

import { type ApiInput, type ApiOutput } from '@weareinreach/api'
import { transformer } from '@weareinreach/api/lib/transformer'
import { transformer } from '@weareinreach/util/transformer'

import { getBaseUrl } from './trpcClient'
import { type ErrorInput, jsonRpcErrorResponse, jsonRpcSuccessResponse } from './trpcResponse'
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/trpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { createTRPCReact } from '@trpc/react-query'
import { devtoolsLink } from 'trpc-client-devtools-link'

import { type AppRouter } from '@weareinreach/api'
import { transformer } from '@weareinreach/api/lib/transformer'
import { getEnv } from '@weareinreach/env'
import { transformer } from '@weareinreach/util/transformer'

export const getBaseUrl = () => {
if (typeof window !== 'undefined') return '' // browser should use relative url
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/trpcResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import prettyBytes from 'pretty-bytes'

import { type ApiInput, type ApiOutput } from '@weareinreach/api'
import { getHTTPStatusCodeFromError, TRPC_ERROR_CODES_BY_KEY } from '@weareinreach/api/errorTypes'
import { type SuperJSONResult, transformer } from '@weareinreach/api/lib/transformer'
import { type SuperJSONResult, transformer } from '@weareinreach/util/transformer'

const byteSize = (str: string) => Buffer.from(str).byteLength
export type RpcResponse<Data> = RpcSuccessResponse<Data> | RpcErrorResponse
Expand Down
23 changes: 23 additions & 0 deletions packages/util/transformer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { DateTime, Interval } from 'luxon'
import superjson from 'superjson'

superjson.registerCustom<DateTime, string>(
{
isApplicable: DateTime.isDateTime,
serialize: (v) => v.toJSON() ?? '',
deserialize: (v) => DateTime.fromISO(v),
},
'LuxonDateTime'
)
superjson.registerCustom(
{
isApplicable: Interval.isInterval,
serialize: (v) => v.toISO() ?? '',
deserialize: (v) => Interval.fromISO(v),
},
'LuxonInterval'
)

export { type SuperJSONResult } from 'superjson/dist/types'
export const transformer = superjson
export { superjson }
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2924d07

Please sign in to comment.