UnENVerse 0.84.0
Local-first desktop secrets manager — TypeScript frontend
Loading...
Searching...
No Matches
filters.ts File Reference

Functions

function export getDescendantProjectIds (projectId:string)
function export buildProjectTree (projects:Project[])
function export parseSearch (q:string)
function export getFiltered ()
function dateCompare (a:string|null|undefined, b:string|null|undefined, dir:1|-1,)
 Compare two optional dates; a missing or unparsable one sorts after every real one.

Variables

import type { VaultEntry, Project } from './types'
 import { st } from './state'
export type ProjectTreeNode = Project & { children: ProjectTreeNode[]; virtual: boolean }
const SEARCH_FILTER_KEYS = ['price', 'cat', 'env']
 Search prefixes that mean "filter by this field".
const words
 return { filters, text: words.join(' ') }

Function Documentation

◆ getDescendantProjectIds()

function export getDescendantProjectIds ( projectId:string)

◆ buildProjectTree()

function export buildProjectTree ( projects:Project[])

◆ parseSearch()

function export parseSearch ( q:string)

◆ getFiltered()

function export getFiltered ( )

◆ dateCompare()

function dateCompare ( a:string|null| undefined,
b:string|null| undefined,
dir:1|- 1 )

Compare two optional dates; a missing or unparsable one sorts after every real one.

Variable Documentation

◆ type

import type { VaultEntry, Project } from './types'

◆ import

import { st } from './state'

◆ ProjectTreeNode

export type ProjectTreeNode = Project & { children: ProjectTreeNode[]; virtual: boolean }

◆ SEARCH_FILTER_KEYS

const SEARCH_FILTER_KEYS = ['price', 'cat', 'env']

Search prefixes that mean "filter by this field".

Everything else containing a colon is ordinary text.

Without the whitelist, any token with a colon became a filter: searching postgres://user produced the filter postgres="//user", which no branch in getFiltered reads, and left the text query empty — so looking for a connection string silently returned the entire vault instead of the one entry, and looked like everything matched.

◆ words

const words
Initial value:
{
const filters: Record<string, string> = {}

◆ return

return { filters, text: words.join(' ') }