feat: bump deps; add pruneEmpty util

pull/659/head
Travis Fischer 2024-07-30 04:29:34 -05:00
rodzic 28df0f10d2
commit 8eeab0b376
3 zmienionych plików z 951 dodań i 502 usunięć

Wyświetl plik

@ -102,7 +102,7 @@
"zod-validation-error": "^3.3.0" "zod-validation-error": "^3.3.0"
}, },
"devDependencies": { "devDependencies": {
"@aws-sdk/client-sso-oidc": "^3.620.0", "@aws-sdk/client-sso-oidc": "^3.620.1",
"@browserbasehq/sdk": "^1.4.2", "@browserbasehq/sdk": "^1.4.2",
"@dexaai/dexter": "^2.1.0", "@dexaai/dexter": "^2.1.0",
"@e2b/code-interpreter": "^0.0.8", "@e2b/code-interpreter": "^0.0.8",
@ -112,11 +112,11 @@
"@nangohq/node": "^0.42.2", "@nangohq/node": "^0.42.2",
"@total-typescript/ts-reset": "^0.5.1", "@total-typescript/ts-reset": "^0.5.1",
"@types/node": "^22.0.0", "@types/node": "^22.0.0",
"ai": "^3.2.37", "ai": "^3.2.39",
"del-cli": "^5.1.0", "del-cli": "^5.1.0",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"husky": "^9.1.3", "husky": "^9.1.4",
"lint-staged": "^15.2.7", "lint-staged": "^15.2.7",
"llamaindex": "^0.5.11", "llamaindex": "^0.5.11",
"mathjs": "^13.0.3", "mathjs": "^13.0.3",
@ -182,10 +182,5 @@
"eslint --fix", "eslint --fix",
"prettier --ignore-unknown --write" "prettier --ignore-unknown --write"
] ]
},
"pnpm": {
"overrides": {
"esbuild": "~0.23.0"
}
} }
} }

Plik diff jest za duży Load Diff

Wyświetl plik

@ -89,6 +89,27 @@ export function pruneNullOrUndefinedDeep<T extends Record<string, any>>(
) as NonNullable<T> ) as NonNullable<T>
} }
export function pruneEmpty<T extends Record<string, any>>(
obj: T
): NonNullable<{ [K in keyof T]: Exclude<T[K], undefined | null> }> {
return Object.fromEntries(
Object.entries(obj).filter(([, value]) => {
if (value === undefined || value === null) return false
if (typeof value === 'string' && !value) return false
if (Array.isArray(value) && !value.length) return false
if (
typeof value === 'object' &&
!Array.isArray(value) &&
!Object.keys(value).length
) {
return false
}
return true
})
) as NonNullable<T>
}
export function getEnv(name: string): string | undefined { export function getEnv(name: string): string | undefined {
try { try {
return typeof process !== 'undefined' return typeof process !== 'undefined'