-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1191 from undb-xyz/release/v0.5.8
- Loading branch information
Showing
224 changed files
with
3,885 additions
and
904 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
export default { | ||
root: true, | ||
extends: ['@undb/eslint-config'], | ||
parserOptions: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Inject } from '@nestjs/common' | ||
import { registerAs } from '@nestjs/config' | ||
|
||
export const InjectWebhookConfig = () => Inject(webhookConfig.KEY) | ||
|
||
export const webhookConfig = registerAs('webhook', () => ({ | ||
secret: process.env.UNDB_WEBHOOK_SECRET, | ||
})) |
48 changes: 48 additions & 0 deletions
48
apps/backend/src/core/table/adapters/cache-storage.factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { type ConfigType } from '@nestjs/config' | ||
import { type PinoLogger } from 'nestjs-pino' | ||
import path from 'path' | ||
import { match } from 'ts-pattern' | ||
import { createStorage } from 'unstorage' | ||
import { type cacheStorageConfig } from '../../../configs/cache-storage.config.js' | ||
|
||
export const cacheStorageFactory = async (logger: PinoLogger, config: ConfigType<typeof cacheStorageConfig>) => { | ||
const driver = await match(config) | ||
.with({ provider: 'memory' }, async () => { | ||
const lruCacheDriver = await import('unstorage/drivers/lru-cache').then((m) => m.default) | ||
return lruCacheDriver() | ||
}) | ||
.with({ provider: 'fs' }, async () => { | ||
const fsDriver = await import('unstorage/drivers/fs').then((m) => m.default) | ||
const base = path.resolve(process.cwd(), '../../.undb/cache') | ||
return fsDriver({ base }) | ||
}) | ||
.with({ provider: 'redis' }, async () => { | ||
const redisDriver = await import('unstorage/drivers/redis').then((m) => m.default) | ||
return redisDriver({ | ||
host: config.redis.host, | ||
password: config.redis.password, | ||
tls: false as any, | ||
port: config.redis.port, | ||
base: config.redis.base, | ||
ttl: config.redis.ttl, | ||
connectTimeout: 10000, | ||
}) | ||
}) | ||
.with({ provider: 'mongo' }, async () => { | ||
const mongodbDriver = await import('unstorage/drivers/mongodb').then((m) => m.default) | ||
return mongodbDriver({ | ||
connectionString: config.mongo.connectionString, | ||
databaseName: config.mongo.databaseName, | ||
collectionName: config.mongo.collectionName, | ||
}) | ||
}) | ||
.exhaustive() | ||
|
||
const storage = createStorage({ | ||
driver, | ||
}) | ||
|
||
logger.info('Initialized cache storage %s', driver?.name) | ||
|
||
return storage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.