@strav/kernel 0.1.0 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cache/helpers.ts +1 -1
- package/src/config/index.ts +1 -1
- package/src/core/application.ts +2 -2
- package/src/encryption/helpers.ts +1 -1
- package/src/exceptions/exception_handler.ts +1 -1
- package/src/exceptions/helpers.ts +1 -1
- package/src/helpers/compose.ts +3 -3
package/package.json
CHANGED
package/src/cache/helpers.ts
CHANGED
|
@@ -10,7 +10,7 @@ function prefixed(key: string): string {
|
|
|
10
10
|
* All methods delegate to `CacheManager.store` with the configured prefix.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
* import { cache } from '@
|
|
13
|
+
* import { cache } from '@strav/kernel/cache'
|
|
14
14
|
*
|
|
15
15
|
* const user = await cache.remember(`user:${id}`, 300, () => User.find(id))
|
|
16
16
|
* await cache.forget(`user:${id}`)
|
package/src/config/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as Configuration } from './configuration'
|
|
1
|
+
export { default as Configuration } from './configuration.ts'
|
|
2
2
|
export type { ConfigData, ConfigurationLoader } from './types'
|
package/src/core/application.ts
CHANGED
|
@@ -13,8 +13,8 @@ const SHUTDOWN_TIMEOUT = 30_000
|
|
|
13
13
|
* graceful shutdown on SIGINT / SIGTERM.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* import { app } from '@
|
|
17
|
-
* import { ConfigProvider, DatabaseProvider, AuthProvider } from '@
|
|
16
|
+
* import { app } from '@strav/kernel/core'
|
|
17
|
+
* import { ConfigProvider, DatabaseProvider, AuthProvider } from '@strav/kernel/providers'
|
|
18
18
|
*
|
|
19
19
|
* app
|
|
20
20
|
* .useProviders([
|
|
@@ -7,7 +7,7 @@ import EncryptionManager from './encryption_manager.ts'
|
|
|
7
7
|
* Password hashing uses argon2id via Bun.password (no key needed).
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* import { encrypt } from '@
|
|
10
|
+
* import { encrypt } from '@strav/kernel/encryption'
|
|
11
11
|
*
|
|
12
12
|
* // Encrypt & decrypt strings
|
|
13
13
|
* const encrypted = encrypt.encrypt('sensitive data')
|
|
@@ -23,7 +23,7 @@ export type ReportFn = (error: Error, ctx?: RequestContext) => void
|
|
|
23
23
|
* Register with the router to catch all unhandled exceptions:
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
|
-
* import { ExceptionHandler } from '@
|
|
26
|
+
* import { ExceptionHandler } from '@strav/kernel/exceptions'
|
|
27
27
|
*
|
|
28
28
|
* const handler = new ExceptionHandler(config.get('app.env') === 'local')
|
|
29
29
|
* handler.report((error, ctx) => logger.error(error.message, { path: ctx?.path }))
|
|
@@ -5,7 +5,7 @@ import { HttpException, ValidationError } from './http_exception.ts'
|
|
|
5
5
|
* as a JSON error response.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* import { abort } from '@
|
|
8
|
+
* import { abort } from '@strav/kernel/exceptions'
|
|
9
9
|
*
|
|
10
10
|
* const project = await Project.find(id)
|
|
11
11
|
* if (!project) abort(404, 'Project not found')
|
package/src/helpers/compose.ts
CHANGED
|
@@ -29,9 +29,9 @@ interface MixinFunction<In, Out> {
|
|
|
29
29
|
* for up to 8 mixins.
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
|
-
* import { compose } from '@
|
|
33
|
-
* import { BaseModel } from '@
|
|
34
|
-
* import { billable } from '@
|
|
32
|
+
* import { compose } from '@strav/kernel/helpers'
|
|
33
|
+
* import { BaseModel } from '@strav/database/orm'
|
|
34
|
+
* import { billable } from '@strav/stripe'
|
|
35
35
|
*
|
|
36
36
|
* // Without compose (nested):
|
|
37
37
|
* class User extends billable(softDeletes(BaseModel)) { }
|