kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: bump deps; add pruneEmpty util
rodzic
28df0f10d2
commit
8eeab0b376
11
package.json
11
package.json
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1421
pnpm-lock.yaml
1421
pnpm-lock.yaml
Plik diff jest za duży
Load Diff
21
src/utils.ts
21
src/utils.ts
|
@ -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'
|
||||||
|
|
Ładowanie…
Reference in New Issue