add search filter

This commit is contained in:
2025-12-18 17:12:23 -03:00
parent d95981a6eb
commit 453327982d
15 changed files with 688 additions and 247 deletions

View File

@@ -1,11 +1,12 @@
import { useSearchParams } from 'react-router' import { useSearchParams } from 'react-router'
import { ChevronRightIcon, ChevronLeftIcon } from 'lucide-react' import { ChevronRightIcon, ChevronLeftIcon } from 'lucide-react'
import { subMonths, addMonths } from 'date-fns' import { subMonths, addMonths } from 'date-fns'
import { DateTime } from 'luxon' import { DateTime as LuxonDateTime } from 'luxon'
import { Button } from '@repo/ui/components/ui/button' import { Button } from '@repo/ui/components/ui/button'
import { ButtonGroup } from '@repo/ui/components/ui/button-group' import { ButtonGroup } from '@repo/ui/components/ui/button-group'
import { Badge } from '@repo/ui/components/ui/badge' import { Badge } from '@repo/ui/components/ui/badge'
import { DateTime } from '@repo/ui/components/datetime'
import { formatDate, billingPeriod } from './util' import { formatDate, billingPeriod } from './util'
import { tz } from './data' import { tz } from './data'
@@ -16,12 +17,18 @@ type RangePeriodProps = {
billingDay: number billingDay: number
} }
const dtOptions: Intl.DateTimeFormatOptions = {
year: '2-digit',
hour: undefined,
minute: undefined
}
export function RangePeriod({ export function RangePeriod({
startDate, startDate,
endDate, endDate,
billingDay billingDay
}: RangePeriodProps) { }: RangePeriodProps) {
const today = DateTime.now().setZone(tz).toJSDate() const today = LuxonDateTime.now().setZone(tz).toJSDate()
const [, setSearchParams] = useSearchParams() const [, setSearchParams] = useSearchParams()
const prevPeriod = billingPeriod(billingDay, subMonths(startDate, 1)) const prevPeriod = billingPeriod(billingDay, subMonths(startDate, 1))
const nextPeriod = billingPeriod(billingDay, addMonths(startDate, 1)) const nextPeriod = billingPeriod(billingDay, addMonths(startDate, 1))
@@ -51,10 +58,10 @@ export function RangePeriod({
> >
<div className="gap-1 flex"> <div className="gap-1 flex">
<Badge variant="outline" className="rounded-sm px-1 font-mono"> <Badge variant="outline" className="rounded-sm px-1 font-mono">
{datetime.format(startDate)} <DateTime options={dtOptions}>{startDate}</DateTime>
</Badge> </Badge>
<Badge variant="outline" className="rounded-sm px-1 font-mono"> <Badge variant="outline" className="rounded-sm px-1 font-mono">
{datetime.format(endDate)} <DateTime options={dtOptions}>{endDate}</DateTime>
</Badge> </Badge>
</div> </div>
</Button> </Button>
@@ -78,9 +85,3 @@ export function RangePeriod({
</> </>
) )
} }
const datetime = new Intl.DateTimeFormat('pt-BR', {
day: '2-digit',
month: '2-digit',
year: '2-digit'
})

View File

@@ -1,7 +1,7 @@
import type { Route } from './+types/route' import type { Route } from './+types/route'
import Fuse from 'fuse.js' import Fuse from 'fuse.js'
import { DateTime } from 'luxon' import { DateTime as LuxonDateTime } from 'luxon'
import { Suspense, useMemo } from 'react' import { Suspense, useMemo } from 'react'
import { BanIcon } from 'lucide-react' import { BanIcon } from 'lucide-react'
import { Await, useSearchParams } from 'react-router' import { Await, useSearchParams } from 'react-router'
@@ -30,6 +30,8 @@ import {
EmptyTitle EmptyTitle
} from '@repo/ui/components/ui/empty' } from '@repo/ui/components/ui/empty'
import { Kbd } from '@repo/ui/components/ui/kbd' import { Kbd } from '@repo/ui/components/ui/kbd'
import { Currency } from '@repo/ui/components/currency'
import { DateTime } from '@repo/ui/components/datetime'
import { billingPeriod, formatDate } from './util' import { billingPeriod, formatDate } from './util'
import { RangePeriod } from './range-period' import { RangePeriod } from './range-period'
@@ -45,11 +47,15 @@ export async function loader({ context, request, params }: Route.LoaderArgs) {
url: `/orgs/${params.orgid}/subscription`, url: `/orgs/${params.orgid}/subscription`,
context, context,
request request
}).then((r) => r.json()) })
const { billing_day = 1 } = (await subscription.json()) as {
billing_day: number
}
const [startDate, endDate] = billingPeriod( const [startDate, endDate] = billingPeriod(
subscription?.billing_day || 1, billing_day,
DateTime.now().setZone(tz).toJSDate() LuxonDateTime.now().setZone(tz).toJSDate()
) )
const start = searchParams.get('start') || formatDate(startDate) const start = searchParams.get('start') || formatDate(startDate)
const end = searchParams.get('end') || formatDate(endDate) const end = searchParams.get('end') || formatDate(endDate)
@@ -61,15 +67,15 @@ export async function loader({ context, request, params }: Route.LoaderArgs) {
}).then((r) => r.json()) }).then((r) => r.json())
return { return {
subscription, billing_day,
billing, billing,
startDate: DateTime.fromISO(start, { zone: tz }).toJSDate(), startDate: LuxonDateTime.fromISO(start, { zone: tz }).toJSDate(),
endDate: DateTime.fromISO(end, { zone: tz }).toJSDate() endDate: LuxonDateTime.fromISO(end, { zone: tz }).toJSDate()
} }
} }
export default function Route({ export default function Route({
loaderData: { subscription, billing, startDate, endDate } loaderData: { billing_day, billing, startDate, endDate }
}: Route.ComponentProps) { }: Route.ComponentProps) {
const [searchParams, setSearchParams] = useSearchParams() const [searchParams, setSearchParams] = useSearchParams()
const search = searchParams.get('s') as string const search = searchParams.get('s') as string
@@ -120,7 +126,7 @@ export default function Route({
<RangePeriod <RangePeriod
startDate={startDate} startDate={startDate}
endDate={endDate} endDate={endDate}
billingDay={subscription?.billing_day || 1} billingDay={billing_day}
/> />
<Button <Button
@@ -232,9 +238,11 @@ function List({ items, search }) {
<Abbr>{created_by ? created_by.name : 'N/A'}</Abbr> <Abbr>{created_by ? created_by.name : 'N/A'}</Abbr>
</TableCell> </TableCell>
<TableCell> <TableCell>
{datetime.format(new Date(enrolled_at))} <DateTime>{enrolled_at}</DateTime>
</TableCell>
<TableCell>
<Currency>{unit_price}</Currency>
</TableCell> </TableCell>
<TableCell>{currency.format(unit_price)}</TableCell>
</TableRow> </TableRow>
) )
)} )}
@@ -268,9 +276,11 @@ function List({ items, search }) {
<Abbr>{canceled_by ? canceled_by.name : 'N/A'}</Abbr> <Abbr>{canceled_by ? canceled_by.name : 'N/A'}</Abbr>
</TableCell> </TableCell>
<TableCell> <TableCell>
{datetime.format(new Date(created_at))} <DateTime>{created_at}</DateTime>
</TableCell>
<TableCell>
<Currency>{unit_price}</Currency>
</TableCell> </TableCell>
<TableCell>{currency.format(unit_price)}</TableCell>
</TableRow> </TableRow>
) )
)} )}
@@ -284,11 +294,11 @@ function List({ items, search }) {
Total Total
</TableCell> </TableCell>
<TableCell> <TableCell>
{currency.format( <Currency>
filtered {filtered
?.filter((x) => 'course' in x) ?.filter((x) => 'course' in x)
?.reduce((acc, { unit_price }) => acc + unit_price, 0) ?.reduce((acc, { unit_price }) => acc + unit_price, 0)}
)} </Currency>
</TableCell> </TableCell>
</TableRow> </TableRow>
</TableFooter> </TableFooter>
@@ -297,18 +307,5 @@ function List({ items, search }) {
) )
} }
const currency = new Intl.NumberFormat('pt-BR', {
style: 'currency',
currency: 'BRL'
})
const datetime = new Intl.DateTimeFormat('pt-BR', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit'
})
const sortBy = (field: 'enrolled_at' | 'created_at') => (a: any, b: any) => const sortBy = (field: 'enrolled_at' | 'created_at') => (a: any, b: any) =>
new Date(a[field]).getTime() - new Date(b[field]).getTime() new Date(a[field]).getTime() - new Date(b[field]).getTime()

View File

@@ -1,171 +0,0 @@
import { useBoolean, useRequest, useToggle } from 'ahooks'
import { CheckIcon, UserIcon, XIcon, AlertTriangleIcon } from 'lucide-react'
import { formatCPF } from '@brazilian-utils/brazilian-utils'
import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar'
import { Abbr } from '@repo/ui/components/abbr'
import {
InputGroup,
InputGroupAddon,
InputGroupInput
} from '@repo/ui/components/ui/input-group'
import { initials, cn } from '@repo/ui/lib/utils'
import {
Popover,
PopoverContent,
PopoverTrigger
} from '@repo/ui/components/ui/popover'
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList
} from '@repo/ui/components/ui/command'
import { Spinner } from '@repo/ui/components/ui/spinner'
import { Button } from '@repo/ui/components/ui/button'
interface AsyncComboboxProps {
value: any
title: string
placeholder?: string
onChange: (props: any) => void
onSearch: (search: string) => Promise<any[]>
error?: any
}
export function AsyncCombobox({
title,
placeholder,
value,
onSearch,
onChange,
error
}: AsyncComboboxProps) {
const [open, { set }] = useToggle()
const [searched, { setTrue }] = useBoolean()
const {
data = [],
loading,
runAsync
} = useRequest(onSearch, {
manual: true,
debounceWait: 300,
defaultParams: [''],
onSuccess: setTrue
})
return (
<Popover open={open} onOpenChange={set}>
<PopoverTrigger asChild>
<InputGroup>
<InputGroupInput
readOnly
value={value?.name || ''}
placeholder={title}
className="cursor-pointer"
autoComplete="off"
aria-invalid={!!error}
/>
<InputGroupAddon>
<UserIcon />
</InputGroupAddon>
{value && (
<InputGroupAddon align="inline-end" className="mr-0">
<Button
variant="link"
size="icon-sm"
className="cursor-pointer text-muted-foreground"
onClick={(e) => {
e.preventDefault()
onChange?.(undefined)
set(false)
}}
>
<XIcon />
</Button>
</InputGroupAddon>
)}
{loading && (
<InputGroupAddon align="inline-end">
<Spinner />
</InputGroupAddon>
)}
</InputGroup>
</PopoverTrigger>
<PopoverContent className="lg:w-84 p-0" align="start">
<Command
shouldFilter={false}
className={cn(
!searched && '**:data-[slot=command-input-wrapper]:border-b-0'
)}
>
<CommandInput
placeholder={placeholder}
autoComplete="off"
onValueChange={runAsync}
/>
{searched ? (
<CommandList>
<CommandEmpty>Nenhum resultado encontrado.</CommandEmpty>
<CommandGroup>
{data.map(({ id, name, email, cpf }) => (
<CommandItem
key={id}
value={id}
className="cursor-pointer"
disabled={!cpf}
onSelect={() => {
onChange?.({ id, name, email, cpf })
set(false)
}}
>
<div className="flex gap-2.5 items-start">
<Avatar className="size-10 hidden lg:block">
<AvatarFallback className="border">
{initials(name)}
</AvatarFallback>
</Avatar>
<ul>
<li className="font-bold">
<Abbr>{name}</Abbr>
</li>
<li className="text-muted-foreground text-sm">
<Abbr>{email}</Abbr>
</li>
{cpf ? (
<li className="text-muted-foreground text-sm">
{formatCPF(cpf)}
</li>
) : (
<li className="flex gap-1 items-center text-red-400">
<AlertTriangleIcon className="text-red-400" />
Inelegível
</li>
)}
</ul>
</div>
<CheckIcon
className={cn(
'ml-auto',
value?.id === id ? 'opacity-100' : 'opacity-0'
)}
/>
</CommandItem>
))}
</CommandGroup>
</CommandList>
) : null}
</Command>
</PopoverContent>
</Popover>
)
}

View File

@@ -13,7 +13,9 @@ import {
CheckIcon, CheckIcon,
BookIcon, BookIcon,
ArrowDownAZIcon, ArrowDownAZIcon,
ArrowDownZAIcon ArrowDownZAIcon,
AlertTriangleIcon,
UserIcon
} from 'lucide-react' } from 'lucide-react'
import { Link, useParams, useFetcher } from 'react-router' import { Link, useParams, useFetcher } from 'react-router'
import { Controller, useFieldArray, useForm } from 'react-hook-form' import { Controller, useFieldArray, useForm } from 'react-hook-form'
@@ -22,7 +24,10 @@ import { format } from 'date-fns'
import { ptBR } from 'react-day-picker/locale' import { ptBR } from 'react-day-picker/locale'
import { zodResolver } from '@hookform/resolvers/zod' import { zodResolver } from '@hookform/resolvers/zod'
import Fuse from 'fuse.js' import Fuse from 'fuse.js'
import { formatCPF } from '@brazilian-utils/brazilian-utils'
import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar'
import { Abbr } from '@repo/ui/components/abbr'
import { import {
Command, Command,
CommandEmpty, CommandEmpty,
@@ -63,13 +68,13 @@ import {
import { Label } from '@repo/ui/components/ui/label' import { Label } from '@repo/ui/components/ui/label'
import { Calendar } from '@repo/ui/components/ui/calendar' import { Calendar } from '@repo/ui/components/ui/calendar'
import { createSearch } from '@repo/util/meili' import { createSearch } from '@repo/util/meili'
import { cn } from '@repo/ui/lib/utils' import { initials, cn } from '@repo/ui/lib/utils'
import { HttpMethod, request as req } from '@repo/util/request' import { HttpMethod, request as req } from '@repo/util/request'
import { useIsMobile } from '@repo/ui/hooks/use-mobile' import { useIsMobile } from '@repo/ui/hooks/use-mobile'
import { cloudflareContext } from '@repo/auth/context' import { cloudflareContext } from '@repo/auth/context'
import { SearchFilter } from '@repo/ui/components/search-filter'
import { formSchema, type Schema, MAX_ITEMS } from './data' import { formSchema, type Schema, MAX_ITEMS } from './data'
import { AsyncCombobox } from './async-combobox'
import { redirect } from 'react-router' import { redirect } from 'react-router'
export function meta({}: Route.MetaArgs) { export function meta({}: Route.MetaArgs) {
@@ -213,13 +218,109 @@ export default function Route({
fieldState fieldState
}) => ( }) => (
<div className="grid gap-1"> <div className="grid gap-1">
<AsyncCombobox <SearchFilter
value={value} align="start"
title="Colaborador"
onChange={onChange} onChange={onChange}
onSearch={onSearch} onSearch={onSearch}
error={fieldState.error} render={({
/> id,
name,
email,
cpf,
onSelect,
onClose
}) => (
<CommandItem
key={id}
value={id}
className="cursor-pointer"
disabled={!cpf}
onSelect={() => {
onSelect()
onClose()
}}
>
<div className="flex gap-2.5 items-start">
<Avatar className="size-10 hidden lg:block">
<AvatarFallback className="border">
{initials(name)}
</AvatarFallback>
</Avatar>
<ul>
<li className="font-bold">
<Abbr>{name}</Abbr>
</li>
<li className="text-muted-foreground text-sm">
<Abbr>{email}</Abbr>
</li>
{cpf ? (
<li className="text-muted-foreground text-sm">
{formatCPF(cpf)}
</li>
) : (
<li className="flex gap-1 items-center text-red-400">
<AlertTriangleIcon className="text-red-400" />
Inelegível
</li>
)}
</ul>
</div>
<CheckIcon
className={cn(
'ml-auto',
value?.id === id
? 'opacity-100'
: 'opacity-0'
)}
/>
</CommandItem>
)}
>
{({ loading }) => (
<InputGroup>
<InputGroupInput
readOnly
value={value?.name || ''}
placeholder="Colaborador"
className="cursor-pointer"
autoComplete="off"
aria-invalid={!!fieldState.error}
/>
<InputGroupAddon>
<UserIcon />
</InputGroupAddon>
{value && (
<InputGroupAddon
align="inline-end"
className="mr-0"
>
<Button
variant="link"
size="icon-sm"
className="cursor-pointer text-muted-foreground"
onClick={(e) => {
e.preventDefault()
onChange?.(undefined)
}}
>
<XIcon />
</Button>
</InputGroupAddon>
)}
{loading && (
<InputGroupAddon align="inline-end">
<Spinner />
</InputGroupAddon>
)}
</InputGroup>
)}
</SearchFilter>
<ErrorMessage <ErrorMessage
errors={formState.errors} errors={formState.errors}
name={name} name={name}

View File

@@ -1,21 +1,36 @@
import type { Route } from './+types/route' import type { Route } from './+types/route'
import { CalendarIcon, PlusCircleIcon } from 'lucide-react' import { pick } from 'ramda'
import {
CalendarIcon,
PlusCircleIcon,
BuildingIcon,
CheckIcon
} from 'lucide-react'
import { MeiliSearchFilterBuilder } from 'meilisearch-helper' import { MeiliSearchFilterBuilder } from 'meilisearch-helper'
import { Suspense, useState } from 'react' import { Suspense, useState } from 'react'
import { Await, Outlet, useSearchParams } from 'react-router' import { Await, Outlet, useSearchParams } from 'react-router'
import { formatCNPJ } from '@brazilian-utils/brazilian-utils'
import { cloudflareContext } from '@repo/auth/context' import { cloudflareContext } from '@repo/auth/context'
import { DataTable, DataTableViewOptions } from '@repo/ui/components/data-table' import { DataTable, DataTableViewOptions } from '@repo/ui/components/data-table'
import { FacetedFilter } from '@repo/ui/components/faceted-filter' import { FacetedFilter } from '@repo/ui/components/faceted-filter'
import { RangeCalendarFilter } from '@repo/ui/components/range-calendar-filter' import { RangeCalendarFilter } from '@repo/ui/components/range-calendar-filter'
import { SearchForm } from '@repo/ui/components/search-form' import { SearchForm } from '@repo/ui/components/search-form'
import { SearchFilter } from '@repo/ui/components/search-filter'
import { Skeleton } from '@repo/ui/components/skeleton' import { Skeleton } from '@repo/ui/components/skeleton'
import { Kbd } from '@repo/ui/components/ui/kbd' import { Kbd } from '@repo/ui/components/ui/kbd'
import { ExportMenu } from '@repo/ui/components/export-menu' import { ExportMenu } from '@repo/ui/components/export-menu'
import { createSearch } from '@repo/util/meili' import { createSearch } from '@repo/util/meili'
import { headers, sortings, statuses } from '@repo/ui/routes/enrollments/data' import { headers, sortings, statuses } from '@repo/ui/routes/enrollments/data'
import { cn, initials } from '@repo/ui/lib/utils'
import { CommandItem } from '@repo/ui/components/ui/command'
import { Button } from '@repo/ui/components/ui/button'
import { Separator } from '@repo/ui/components/ui/separator'
import { Badge } from '@repo/ui/components/ui/badge'
import { Abbr } from '@repo/ui/components/abbr'
import { Spinner } from '@repo/ui/components/ui/spinner'
import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar'
import { columns, type Enrollment } from './columns' import { columns, type Enrollment } from './columns'
@@ -27,6 +42,7 @@ export async function loader({ context, request }: Route.LoaderArgs) {
const cloudflare = context.get(cloudflareContext) const cloudflare = context.get(cloudflareContext)
const { searchParams } = new URL(request.url) const { searchParams } = new URL(request.url)
const query = searchParams.get('q') || '' const query = searchParams.get('q') || ''
const org = searchParams.get('org') || ''
const from = searchParams.get('from') const from = searchParams.get('from')
const to = searchParams.get('to') const to = searchParams.get('to')
const sort = searchParams.get('sort') || 'created_at:desc' const sort = searchParams.get('sort') || 'created_at:desc'
@@ -40,6 +56,11 @@ export async function loader({ context, request }: Route.LoaderArgs) {
builder = builder.where('status', 'in', status.split(',')) builder = builder.where('status', 'in', status.split(','))
} }
if (org) {
const { id } = JSON.parse(org)
builder = builder.where('org_id', '=', id)
}
if (from && to) { if (from && to) {
const [field, from_] = from.split(':') const [field, from_] = from.split(':')
builder = builder.where(field, 'between', [from_, to]) builder = builder.where(field, 'between', [from_, to])
@@ -56,7 +77,7 @@ export async function loader({ context, request }: Route.LoaderArgs) {
}) })
return { return {
data: enrollments enrollments
} }
} }
@@ -66,11 +87,23 @@ const formatted = new Intl.DateTimeFormat('en-CA', {
day: '2-digit' day: '2-digit'
}) })
export default function Route({ loaderData: { data } }: Route.ComponentProps) { export default function Route({
loaderData: { enrollments }
}: Route.ComponentProps) {
const [searchParams, setSearchParams] = useSearchParams() const [searchParams, setSearchParams] = useSearchParams()
const [selectedRows, setSelectedRows] = useState<Enrollment[]>([]) const [selectedRows, setSelectedRows] = useState<Enrollment[]>([])
const status = searchParams.get('status') const status = searchParams.get('status')
const rangeParams = useRangeParams() const dateRange = useRangeParams()
const org = searchParams.has('org')
? JSON.parse(searchParams.get('org') || '')
: null
const onSearch = async (search: string) => {
const params = new URLSearchParams({ q: search })
const r = await fetch(`/orgs.json?${params.toString()}`)
const { hits } = (await r.json()) as { hits: any[] }
return hits
}
return ( return (
<Suspense fallback={<Skeleton />}> <Suspense fallback={<Skeleton />}>
@@ -78,7 +111,7 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
<h1 className="text-2xl font-bold tracking-tight">Matrículas</h1> <h1 className="text-2xl font-bold tracking-tight">Matrículas</h1>
</div> </div>
<Await resolve={data}> <Await resolve={enrollments}>
{({ hits, page = 1, hitsPerPage, totalHits }) => ( {({ hits, page = 1, hitsPerPage, totalHits }) => (
<DataTable <DataTable
sort={[{ id: 'created_at', desc: true }]} sort={[{ id: 'created_at', desc: true }]}
@@ -159,7 +192,7 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
<RangeCalendarFilter <RangeCalendarFilter
title="Período" title="Período"
icon={CalendarIcon} icon={CalendarIcon}
value={rangeParams} value={dateRange}
className="lg:flex-1" className="lg:flex-1"
options={Object.entries(sortings).map( options={Object.entries(sortings).map(
([value, label]) => ({ ([value, label]) => ({
@@ -190,6 +223,88 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
}) })
}} }}
/> />
<SearchFilter
align="end"
requestOptions={{
manual: !org,
defaultParams: [org?.q || '']
}}
defaultValue={org?.q || ''}
onSearch={onSearch}
onChange={(value) => {
setSearchParams((searchParams) => {
if (value) {
searchParams.set(
'org',
JSON.stringify(pick(['id', 'name', 'q'], value))
)
} else {
searchParams.delete('org')
}
return searchParams
})
}}
render={({ id, name, cnpj, onSelect }) => (
<CommandItem
key={id}
value={id}
className="cursor-pointer"
onSelect={onSelect}
>
<div className="flex gap-2.5 items-start">
<Avatar className="size-10 hidden lg:block">
<AvatarFallback className="border">
{initials(name)}
</AvatarFallback>
</Avatar>
<ul>
<li className="font-bold">
<Abbr>{name}</Abbr>
</li>
<li className="text-muted-foreground text-sm">
<Abbr>{formatCNPJ(cnpj)}</Abbr>
</li>
</ul>
</div>
<CheckIcon
className={cn(
'ml-auto',
org?.id === id ? 'opacity-100' : 'opacity-0'
)}
/>
</CommandItem>
)}
>
{({ loading }) => (
<Button
variant="outline"
size="sm"
className="cursor-pointer border-dashed h-full"
>
{loading ? <Spinner /> : <BuildingIcon />}
<span>Empresa</span>
{org?.id ? (
<>
<Separator
orientation="vertical"
className="mx-0.5 h-4"
/>
<Badge
variant="outline"
className="rounded-sm px-1 font-normal"
>
<Abbr maxLen={14}>{org.name}</Abbr>
</Badge>
</>
) : null}
</Button>
)}
</SearchFilter>
</div> </div>
<div className="lg:ml-auto flex gap-2.5"> <div className="lg:ml-auto flex gap-2.5">

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "layercake" name = "layercake"
version = "0.11.2" version = "0.11.3"
description = "Packages shared dependencies to optimize deployment and ensure consistency across functions." description = "Packages shared dependencies to optimize deployment and ensure consistency across functions."
readme = "README.md" readme = "README.md"
authors = [ authors = [
@@ -29,6 +29,7 @@ dependencies = [
"python-multipart>=0.0.20", "python-multipart>=0.0.20",
"authlib>=1.6.5", "authlib>=1.6.5",
"python-calamine>=0.5.4", "python-calamine>=0.5.4",
"cloudflare>=4.3.1",
] ]
[dependency-groups] [dependency-groups]

87
layercake/uv.lock generated
View File

@@ -20,6 +20,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/89/03/a851e84fcbb85214dc637b6378121ef9a0dd61b4c65264675d8a5c9b1ae7/antlr4_python3_runtime-4.13.2-py3-none-any.whl", hash = "sha256:fe3835eb8d33daece0e799090eda89719dbccee7aa39ef94eed3818cafa5a7e8", size = 144462, upload-time = "2024-08-03T19:00:11.134Z" }, { url = "https://files.pythonhosted.org/packages/89/03/a851e84fcbb85214dc637b6378121ef9a0dd61b4c65264675d8a5c9b1ae7/antlr4_python3_runtime-4.13.2-py3-none-any.whl", hash = "sha256:fe3835eb8d33daece0e799090eda89719dbccee7aa39ef94eed3818cafa5a7e8", size = 144462, upload-time = "2024-08-03T19:00:11.134Z" },
] ]
[[package]]
name = "anyio"
version = "4.12.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "idna" },
{ name = "typing-extensions", marker = "python_full_version < '3.13'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/16/ce/8a777047513153587e5434fd752e89334ac33e379aa3497db860eeb60377/anyio-4.12.0.tar.gz", hash = "sha256:73c693b567b0c55130c104d0b43a9baf3aa6a31fc6110116509f27bf75e21ec0", size = 228266, upload-time = "2025-11-28T23:37:38.911Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/7f/9c/36c5c37947ebfb8c7f22e0eb6e4d188ee2d53aa3880f3f2744fb894f0cb1/anyio-4.12.0-py3-none-any.whl", hash = "sha256:dad2376a628f98eeca4881fc56cd06affd18f659b17a747d3ff0307ced94b1bb", size = 113362, upload-time = "2025-11-28T23:36:57.897Z" },
]
[[package]] [[package]]
name = "arnparse" name = "arnparse"
version = "0.0.2" version = "0.0.2"
@@ -368,6 +381,23 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/2c/1a/aff8bb287a4b1400f69e09a53bd65de96aa5cee5691925b38731c67fc695/click_default_group-1.2.4-py2.py3-none-any.whl", hash = "sha256:9b60486923720e7fc61731bdb32b617039aba820e22e1c88766b1125592eaa5f", size = 4123, upload-time = "2023-08-04T07:54:56.875Z" }, { url = "https://files.pythonhosted.org/packages/2c/1a/aff8bb287a4b1400f69e09a53bd65de96aa5cee5691925b38731c67fc695/click_default_group-1.2.4-py2.py3-none-any.whl", hash = "sha256:9b60486923720e7fc61731bdb32b617039aba820e22e1c88766b1125592eaa5f", size = 4123, upload-time = "2023-08-04T07:54:56.875Z" },
] ]
[[package]]
name = "cloudflare"
version = "4.3.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "distro" },
{ name = "httpx" },
{ name = "pydantic" },
{ name = "sniffio" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/5d/48/e481c0a9b9010a5c41b5ca78ff9fbe00dc8a9a4d39da5af610a4ec49c7f7/cloudflare-4.3.1.tar.gz", hash = "sha256:b1e1c6beeb8d98f63bfe0a1cba874fc4e22e000bcc490544f956c689b3b5b258", size = 1933187, upload-time = "2025-06-16T21:43:18.716Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/3a/8f/c6c543565efd3144da4304efa5917aac06b6416a8663a6defe0e9b2b7569/cloudflare-4.3.1-py3-none-any.whl", hash = "sha256:6927135a5ee5633d6e2e1952ca0484745e933727aeeb189996d2ad9d292071c6", size = 4406465, upload-time = "2025-06-16T21:43:17.3Z" },
]
[[package]] [[package]]
name = "colorama" name = "colorama"
version = "0.4.6" version = "0.4.6"
@@ -516,6 +546,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/47/ef/4cb333825d10317a36a1154341ba37e6e9c087bac99c1990ef07ffdb376f/dictdiffer-0.9.0-py2.py3-none-any.whl", hash = "sha256:442bfc693cfcadaf46674575d2eba1c53b42f5e404218ca2c2ff549f2df56595", size = 16754, upload-time = "2021-07-22T13:24:26.783Z" }, { url = "https://files.pythonhosted.org/packages/47/ef/4cb333825d10317a36a1154341ba37e6e9c087bac99c1990ef07ffdb376f/dictdiffer-0.9.0-py2.py3-none-any.whl", hash = "sha256:442bfc693cfcadaf46674575d2eba1c53b42f5e404218ca2c2ff549f2df56595", size = 16754, upload-time = "2021-07-22T13:24:26.783Z" },
] ]
[[package]]
name = "distro"
version = "1.9.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/fc/f8/98eea607f65de6527f8a2e8885fc8015d3e6f5775df186e443e0964a11c3/distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed", size = 60722, upload-time = "2023-12-24T09:54:32.31Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" },
]
[[package]] [[package]]
name = "dnspython" name = "dnspython"
version = "2.8.0" version = "2.8.0"
@@ -608,6 +647,43 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/0a/14/933037032608787fb92e365883ad6a741c235e0ff992865ec5d904a38f1e/graphql_core-3.2.7-py3-none-any.whl", hash = "sha256:17fc8f3ca4a42913d8e24d9ac9f08deddf0a0b2483076575757f6c412ead2ec0", size = 207262, upload-time = "2025-11-01T22:30:38.912Z" }, { url = "https://files.pythonhosted.org/packages/0a/14/933037032608787fb92e365883ad6a741c235e0ff992865ec5d904a38f1e/graphql_core-3.2.7-py3-none-any.whl", hash = "sha256:17fc8f3ca4a42913d8e24d9ac9f08deddf0a0b2483076575757f6c412ead2ec0", size = 207262, upload-time = "2025-11-01T22:30:38.912Z" },
] ]
[[package]]
name = "h11"
version = "0.16.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
]
[[package]]
name = "httpcore"
version = "1.0.9"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "certifi" },
{ name = "h11" },
]
sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484, upload-time = "2025-04-24T22:06:22.219Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" },
]
[[package]]
name = "httpx"
version = "0.28.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "certifi" },
{ name = "httpcore" },
{ name = "idna" },
]
sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" },
]
[[package]] [[package]]
name = "idna" name = "idna"
version = "3.11" version = "3.11"
@@ -754,6 +830,7 @@ dependencies = [
{ name = "arnparse" }, { name = "arnparse" },
{ name = "authlib" }, { name = "authlib" },
{ name = "aws-lambda-powertools", extra = ["all"] }, { name = "aws-lambda-powertools", extra = ["all"] },
{ name = "cloudflare" },
{ name = "dictdiffer" }, { name = "dictdiffer" },
{ name = "ftfy" }, { name = "ftfy" },
{ name = "glom" }, { name = "glom" },
@@ -790,6 +867,7 @@ requires-dist = [
{ name = "arnparse", specifier = ">=0.0.2" }, { name = "arnparse", specifier = ">=0.0.2" },
{ name = "authlib", specifier = ">=1.6.5" }, { name = "authlib", specifier = ">=1.6.5" },
{ name = "aws-lambda-powertools", extras = ["all"], specifier = ">=3.23.0" }, { name = "aws-lambda-powertools", extras = ["all"], specifier = ">=3.23.0" },
{ name = "cloudflare", specifier = ">=4.3.1" },
{ name = "dictdiffer", specifier = ">=0.9.0" }, { name = "dictdiffer", specifier = ">=0.9.0" },
{ name = "ftfy", specifier = ">=6.3.1" }, { name = "ftfy", specifier = ">=6.3.1" },
{ name = "glom", specifier = ">=24.11.0" }, { name = "glom", specifier = ">=24.11.0" },
@@ -1902,6 +1980,15 @@ s3 = [
{ name = "boto3" }, { name = "boto3" },
] ]
[[package]]
name = "sniffio"
version = "1.3.1"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372, upload-time = "2024-02-25T23:20:04.057Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" },
]
[[package]] [[package]]
name = "sqlite-fts4" name = "sqlite-fts4"
version = "1.0.3" version = "1.0.3"

View File

@@ -1,33 +1,25 @@
import type { ComponentPropsWithoutRef } from 'react'
type DateTimeProps = { type DateTimeProps = {
children: string children: string | Date
options?: Intl.DateTimeFormatOptions options?: Intl.DateTimeFormatOptions
locale?: string locale?: string
} & ComponentPropsWithoutRef<'time'> }
export function DateTime({ export function DateTime({
children, children,
options, options,
locale = 'pt-BR', locale = 'pt-BR'
...props }: DateTimeProps): string {
}: DateTimeProps) {
const optionsInit: Intl.DateTimeFormatOptions = { const optionsInit: Intl.DateTimeFormatOptions = {
day: '2-digit', day: '2-digit',
month: '2-digit', month: '2-digit',
year: 'numeric', year: 'numeric'
hour: '2-digit',
minute: '2-digit'
} }
const date = children instanceof Date ? children : new Date(children)
const datetime = new Intl.DateTimeFormat(locale, { const datetime = new Intl.DateTimeFormat(locale, {
...optionsInit, ...optionsInit,
...options ...options
}) })
return ( return datetime.format(date)
<time dateTime={children} {...props}>
{datetime.format(new Date(children))}
</time>
)
} }

View File

@@ -75,7 +75,7 @@ export function RangeCalendarFilter({
<PopoverTrigger asChild> <PopoverTrigger asChild>
<Button variant="ghost" size="sm" className="cursor-pointer h-full"> <Button variant="ghost" size="sm" className="cursor-pointer h-full">
<Icon /> {title} <Icon /> {title}
{dateRange && ( {dateRange ? (
<> <>
<Separator orientation="vertical" className="mx-0.5 h-4" /> <Separator orientation="vertical" className="mx-0.5 h-4" />
<div className="gap-1 flex"> <div className="gap-1 flex">
@@ -93,11 +93,11 @@ export function RangeCalendarFilter({
</Badge> </Badge>
</div> </div>
</> </>
)} ) : null}
</Button> </Button>
</PopoverTrigger> </PopoverTrigger>
{dateRange && ( {dateRange ? (
<> <>
<Separator orientation="vertical" className="h-4" /> <Separator orientation="vertical" className="h-4" />
<DropdownMenu> <DropdownMenu>
@@ -128,7 +128,7 @@ export function RangeCalendarFilter({
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
</> </>
)} ) : null}
</div> </div>
<PopoverContent className="w-full p-0" align="start"> <PopoverContent className="w-full p-0" align="start">

View File

@@ -0,0 +1,137 @@
import {
ReactElement,
ComponentProps,
ReactNode,
useState,
useRef
} from 'react'
import { useBoolean, useRequest, useToggle } from 'ahooks'
import { cn } from '../lib/utils'
import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandList,
CommandItem
} from './ui/command'
import { Button } from './ui/button'
import { Separator } from './ui/separator'
interface SearchFilterProps<T> {
defaultValue?: string
onValueChange?: (value: string) => void
requestOptions?: object
placeholder?: string
onChange: (value: T | undefined) => void
onSearch: (search: string) => Promise<T[]>
align: 'start' | 'center' | 'end'
children: ({ loading }: { loading: boolean }) => ReactNode
render: (
item: T & {
onSelect: () => void
onClose: () => void
}
) => ReactElement<ComponentProps<typeof CommandItem>>
}
export function SearchFilter<T>({
defaultValue,
onValueChange,
placeholder,
align,
onSearch,
onChange,
children,
render,
requestOptions = {}
}: SearchFilterProps<T>) {
const inputRef = useRef<HTMLInputElement>(null)
const [open, { toggle, set }] = useToggle()
const [value, setValue] = useState(defaultValue)
const [searched, { setTrue, setFalse }] = useBoolean()
const {
data = [],
loading,
runAsync,
mutate
} = useRequest(onSearch, {
manual: true,
debounceWait: 300,
defaultParams: [''],
onSuccess: setTrue,
...requestOptions
})
return (
<Popover open={open} onOpenChange={toggle}>
<PopoverTrigger asChild>{children({ loading })}</PopoverTrigger>
<PopoverContent className="lg:w-84 p-0" align={align}>
<Command
shouldFilter={false}
className={cn(
!searched && '**:data-[slot=command-input-wrapper]:border-b-0'
)}
>
<CommandInput
ref={inputRef}
placeholder={placeholder}
autoComplete="off"
value={value}
onValueChange={async (value) => {
onValueChange?.(value)
setValue(value)
await runAsync(value)
}}
/>
{searched ? (
<CommandList>
<CommandEmpty>Nenhum resultado encontrado.</CommandEmpty>
<CommandGroup>
{data.map((item) => {
return render({
...item,
onClose: () => set(false),
onSelect: () => {
onChange?.({ ...item, q: value })
}
})
})}
</CommandGroup>
</CommandList>
) : null}
</Command>
{data.length ? (
<>
<Separator orientation="horizontal" />
<div className="p-1">
<Button
size="sm"
variant="ghost"
onClick={() => {
setValue('')
onChange?.(undefined)
setFalse()
mutate([])
if (inputRef.current) {
inputRef.current.focus()
}
}}
className="w-full cursor-pointer"
>
Limpar
</Button>
</div>
</>
) : null}
</PopoverContent>
</Popover>
)
}

View File

@@ -4,3 +4,6 @@ USER_TABLE: str = os.getenv('USER_TABLE') # type: ignore
CHUNK_SIZE = 50 CHUNK_SIZE = 50
EMAIL_SENDER = ('EDUSEG®', 'noreply@eduseg.com.br') EMAIL_SENDER = ('EDUSEG®', 'noreply@eduseg.com.br')
CLOUDFLARE_ACCOUNT_ID = '5436b62470020c04b434ad31c3e4cf4e'
CLOUDFLARE_ZONE_ID = '95c5be1f8ac60e7fd243e6dda987d758'

View File

@@ -0,0 +1,49 @@
from aws_lambda_powertools.utilities.data_classes import (
EventBridgeEvent,
event_source,
)
from aws_lambda_powertools.utilities.typing import LambdaContext
from cloudflare import Cloudflare
from layercake.dateutils import now
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
from boto3clients import dynamodb_client
from config import CLOUDFLARE_ZONE_ID, USER_TABLE
dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
cf_client = Cloudflare()
@event_source(data_class=EventBridgeEvent)
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
new_image = event.detail['new_image']
try:
custom_hostname = cf_client.custom_hostnames.create(
zone_id=CLOUDFLARE_ZONE_ID,
hostname=new_image['hostname'],
ssl={
'type': 'dv',
'method': 'http',
'settings': {
'tls_1_3': 'on',
'min_tls_version': '1.2',
},
},
)
dyn.update_item(
key=KeyPair(
pk=new_image['id'],
sk=new_image['sk'],
),
update_expr='SET hostname_id = :hostname_id, updated_at = :now',
expr_attr_values={
':hostname_id': custom_hostname.id, # type: ignore
':now': now(),
},
)
except Exception:
pass
return True

View File

@@ -26,6 +26,7 @@ Globals:
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1 POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
POWERTOOLS_LOGGER_LOG_EVENT: true POWERTOOLS_LOGGER_LOG_EVENT: true
USER_TABLE: !Ref UserTable USER_TABLE: !Ref UserTable
CLOUDFLARE_API_TOKEN: '{{resolve:ssm:/saladeaula/cloudflare_api_token}}'
Resources: Resources:
EventLog: EventLog:
@@ -265,3 +266,23 @@ Resources:
new_image: new_image:
sk: ['0'] sk: ['0']
changes: [name, email, cpf] changes: [name, email, cpf]
EventSetCustomDomainFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.set_custom_domain.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref UserTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref UserTable]
detail-type: [INSERT]
detail:
new_image:
sk: ['CUSTOM_DOMAIN']

View File

@@ -0,0 +1,22 @@
from aws_lambda_powertools.utilities.typing.lambda_context import LambdaContext
from layercake.dynamodb import DynamoDBPersistenceLayer
import events.set_custom_domain as app
def test_set_custom_domain(
seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
lambda_context: LambdaContext,
):
event = {
'detail': {
'new_image': {
'id': '5OxmMjL-ujoR5IMGegQz',
'sk': 'CUSTOM_DOMAIN',
'hostname': 'app.eduseg.com.br',
},
},
}
assert app.lambda_handler(event, lambda_context) # type: ignore

88
users-events/uv.lock generated
View File

@@ -11,6 +11,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" }, { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
] ]
[[package]]
name = "anyio"
version = "4.12.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "idna" },
]
sdist = { url = "https://files.pythonhosted.org/packages/16/ce/8a777047513153587e5434fd752e89334ac33e379aa3497db860eeb60377/anyio-4.12.0.tar.gz", hash = "sha256:73c693b567b0c55130c104d0b43a9baf3aa6a31fc6110116509f27bf75e21ec0", size = 228266, upload-time = "2025-11-28T23:37:38.911Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/7f/9c/36c5c37947ebfb8c7f22e0eb6e4d188ee2d53aa3880f3f2744fb894f0cb1/anyio-4.12.0-py3-none-any.whl", hash = "sha256:dad2376a628f98eeca4881fc56cd06affd18f659b17a747d3ff0307ced94b1bb", size = 113362, upload-time = "2025-11-28T23:36:57.897Z" },
]
[[package]] [[package]]
name = "arnparse" name = "arnparse"
version = "0.0.2" version = "0.0.2"
@@ -259,6 +271,23 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/2c/1a/aff8bb287a4b1400f69e09a53bd65de96aa5cee5691925b38731c67fc695/click_default_group-1.2.4-py2.py3-none-any.whl", hash = "sha256:9b60486923720e7fc61731bdb32b617039aba820e22e1c88766b1125592eaa5f", size = 4123, upload-time = "2023-08-04T07:54:56.875Z" }, { url = "https://files.pythonhosted.org/packages/2c/1a/aff8bb287a4b1400f69e09a53bd65de96aa5cee5691925b38731c67fc695/click_default_group-1.2.4-py2.py3-none-any.whl", hash = "sha256:9b60486923720e7fc61731bdb32b617039aba820e22e1c88766b1125592eaa5f", size = 4123, upload-time = "2023-08-04T07:54:56.875Z" },
] ]
[[package]]
name = "cloudflare"
version = "4.3.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "distro" },
{ name = "httpx" },
{ name = "pydantic" },
{ name = "sniffio" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/5d/48/e481c0a9b9010a5c41b5ca78ff9fbe00dc8a9a4d39da5af610a4ec49c7f7/cloudflare-4.3.1.tar.gz", hash = "sha256:b1e1c6beeb8d98f63bfe0a1cba874fc4e22e000bcc490544f956c689b3b5b258", size = 1933187, upload-time = "2025-06-16T21:43:18.716Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/3a/8f/c6c543565efd3144da4304efa5917aac06b6416a8663a6defe0e9b2b7569/cloudflare-4.3.1-py3-none-any.whl", hash = "sha256:6927135a5ee5633d6e2e1952ca0484745e933727aeeb189996d2ad9d292071c6", size = 4406465, upload-time = "2025-06-16T21:43:17.3Z" },
]
[[package]] [[package]]
name = "colorama" name = "colorama"
version = "0.4.6" version = "0.4.6"
@@ -341,6 +370,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/47/ef/4cb333825d10317a36a1154341ba37e6e9c087bac99c1990ef07ffdb376f/dictdiffer-0.9.0-py2.py3-none-any.whl", hash = "sha256:442bfc693cfcadaf46674575d2eba1c53b42f5e404218ca2c2ff549f2df56595", size = 16754, upload-time = "2021-07-22T13:24:26.783Z" }, { url = "https://files.pythonhosted.org/packages/47/ef/4cb333825d10317a36a1154341ba37e6e9c087bac99c1990ef07ffdb376f/dictdiffer-0.9.0-py2.py3-none-any.whl", hash = "sha256:442bfc693cfcadaf46674575d2eba1c53b42f5e404218ca2c2ff549f2df56595", size = 16754, upload-time = "2021-07-22T13:24:26.783Z" },
] ]
[[package]]
name = "distro"
version = "1.9.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/fc/f8/98eea607f65de6527f8a2e8885fc8015d3e6f5775df186e443e0964a11c3/distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed", size = 60722, upload-time = "2023-12-24T09:54:32.31Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" },
]
[[package]] [[package]]
name = "dnspython" name = "dnspython"
version = "2.7.0" version = "2.7.0"
@@ -410,6 +448,43 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/9c/a2/75fd80784ec33da8d39cf885e8811a4fbc045a90db5e336b8e345e66dbb2/glom-24.11.0-py3-none-any.whl", hash = "sha256:991db7fcb4bfa9687010aa519b7b541bbe21111e70e58fdd2d7e34bbaa2c1fbd", size = 102690, upload-time = "2024-11-02T23:17:46.468Z" }, { url = "https://files.pythonhosted.org/packages/9c/a2/75fd80784ec33da8d39cf885e8811a4fbc045a90db5e336b8e345e66dbb2/glom-24.11.0-py3-none-any.whl", hash = "sha256:991db7fcb4bfa9687010aa519b7b541bbe21111e70e58fdd2d7e34bbaa2c1fbd", size = 102690, upload-time = "2024-11-02T23:17:46.468Z" },
] ]
[[package]]
name = "h11"
version = "0.16.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
]
[[package]]
name = "httpcore"
version = "1.0.9"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "certifi" },
{ name = "h11" },
]
sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484, upload-time = "2025-04-24T22:06:22.219Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" },
]
[[package]]
name = "httpx"
version = "0.28.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "certifi" },
{ name = "httpcore" },
{ name = "idna" },
]
sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" },
]
[[package]] [[package]]
name = "idna" name = "idna"
version = "3.10" version = "3.10"
@@ -475,12 +550,13 @@ wheels = [
[[package]] [[package]]
name = "layercake" name = "layercake"
version = "0.11.2" version = "0.11.3"
source = { directory = "../layercake" } source = { directory = "../layercake" }
dependencies = [ dependencies = [
{ name = "arnparse" }, { name = "arnparse" },
{ name = "authlib" }, { name = "authlib" },
{ name = "aws-lambda-powertools", extra = ["all"] }, { name = "aws-lambda-powertools", extra = ["all"] },
{ name = "cloudflare" },
{ name = "dictdiffer" }, { name = "dictdiffer" },
{ name = "ftfy" }, { name = "ftfy" },
{ name = "glom" }, { name = "glom" },
@@ -506,6 +582,7 @@ requires-dist = [
{ name = "arnparse", specifier = ">=0.0.2" }, { name = "arnparse", specifier = ">=0.0.2" },
{ name = "authlib", specifier = ">=1.6.5" }, { name = "authlib", specifier = ">=1.6.5" },
{ name = "aws-lambda-powertools", extras = ["all"], specifier = ">=3.23.0" }, { name = "aws-lambda-powertools", extras = ["all"], specifier = ">=3.23.0" },
{ name = "cloudflare", specifier = ">=4.3.1" },
{ name = "dictdiffer", specifier = ">=0.9.0" }, { name = "dictdiffer", specifier = ">=0.9.0" },
{ name = "ftfy", specifier = ">=6.3.1" }, { name = "ftfy", specifier = ">=6.3.1" },
{ name = "glom", specifier = ">=24.11.0" }, { name = "glom", specifier = ">=24.11.0" },
@@ -1022,6 +1099,15 @@ s3 = [
{ name = "boto3" }, { name = "boto3" },
] ]
[[package]]
name = "sniffio"
version = "1.3.1"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372, upload-time = "2024-02-25T23:20:04.057Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" },
]
[[package]] [[package]]
name = "sqlite-fts4" name = "sqlite-fts4"
version = "1.0.3" version = "1.0.3"