logixlysia 6.9.3 → 7.0.0-next.0
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/CHANGELOG.md +17 -0
- package/README.md +5 -1
- package/dist/index.d.ts +7 -10
- package/dist/index.js +6 -6
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 7.0.0-next.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- ed9eb31: Target the Elysia 2 beta (`>= 2.0.0-beta.19`).
|
|
8
|
+
|
|
9
|
+
Elysia 2 renamed every lifecycle method and kept no aliases, so this release drops support for Elysia 1.4. Elysia 1.4 users stay on the 6.x line from the `latest` tag.
|
|
10
|
+
|
|
11
|
+
- The plugin registers `setup`, `cleanup`, `request`, `afterHandle` and `error` instead of `onStart`, `onStop`, `onRequest`, `onAfterHandle` and `onError`. It reads the handler result from `context.responseValue`, because Elysia 2 removed `context.response`.
|
|
12
|
+
- The plugin promotes its hooks with `.as('plugin')` instead of `.as('scoped')`.
|
|
13
|
+
- `Logixlysia` is now `Elysia<'', 'local', LogixlysiaSingleton>`. Elysia 2 added `Scope` as the second type parameter and removed the `resolve` slot from `SingletonBase`, so `LogixlysiaSingleton` has no `resolve` slot either. `derive` now runs during `beforeHandle`, so `ctx.log` is not available in `parse` or `transform`.
|
|
14
|
+
- `plugin.wrapWs` reads `ws.store.logger` instead of `ws.data.store.logger`, because Elysia 2 merges the route context into the socket.
|
|
15
|
+
- Validation error logs read the TypeBox 1.x error shape. Failed paths come from `schemaPath`, and a missing field is listed by name from `params.requiredProperties`. The minification-safe check uses Elysia 2's `code: 'validation'`. With `logErrorPayload` on, the rejected value is logged as `error.value`, because Elysia 2 no longer puts it in the message.
|
|
16
|
+
- Peer dependencies are now `elysia >= 2.0.0-beta.19` and `typescript >= 5.7.0`.
|
|
17
|
+
|
|
18
|
+
The rest of the Logixlysia API is unchanged. In your app, rename your own lifecycle hooks, move route hooks and schema before the handler (`.get(path, hook, handler)`), and register `elysia/websocket` before using `.ws()` with `plugin.wrapWs`. The "Use Logixlysia with Elysia 2" docs page covers each step.
|
|
19
|
+
|
|
3
20
|
## 6.9.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
## `📩` Installation
|
|
8
8
|
|
|
9
|
+
This is the Elysia 2 beta line. Install it from the `next` dist-tag:
|
|
10
|
+
|
|
9
11
|
```bash
|
|
10
|
-
bun add logixlysia
|
|
12
|
+
bun add logixlysia@next elysia@next
|
|
11
13
|
```
|
|
12
14
|
|
|
15
|
+
On Elysia 1.4, install from the `latest` tag (`bun add logixlysia`), which stays on Logixlysia 6.x. [Use Logixlysia with Elysia 2](https://logixlysia.vercel.app/docs/use-with-elysia-2) lists which Logixlysia version goes with which Elysia release.
|
|
16
|
+
|
|
13
17
|
## `📝` Usage
|
|
14
18
|
|
|
15
19
|
```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -414,12 +414,10 @@ interface RequestContextStore {
|
|
|
414
414
|
peekContext: (key: ContextKey) => Readonly<Record<string, unknown>>;
|
|
415
415
|
}
|
|
416
416
|
interface WebSocketLike {
|
|
417
|
-
readonly data?: {
|
|
418
|
-
store?: {
|
|
419
|
-
logger?: Logger;
|
|
420
|
-
};
|
|
421
|
-
};
|
|
422
417
|
readonly id?: string;
|
|
418
|
+
readonly store?: {
|
|
419
|
+
logger?: Logger;
|
|
420
|
+
};
|
|
423
421
|
}
|
|
424
422
|
interface WsHandlerHooks<
|
|
425
423
|
TMessage = unknown,
|
|
@@ -520,18 +518,17 @@ interface EmptyElysiaSlot {
|
|
|
520
518
|
readonly __logixlysiaEmpty?: never;
|
|
521
519
|
}
|
|
522
520
|
/**
|
|
523
|
-
* Explicit singleton without Elysia's `SingletonBase` `Record<string, unknown>` on decorator/derive
|
|
524
|
-
* merged `Context` and WebSocket
|
|
521
|
+
* Explicit singleton without Elysia's `SingletonBase` `Record<string, unknown>` on decorator/derive so
|
|
522
|
+
* merged `Context` and WebSocket handler contexts keep precise keys after `.use(logixlysia())`.
|
|
525
523
|
*/
|
|
526
524
|
interface LogixlysiaSingleton<TFields extends object = LogFields> {
|
|
527
525
|
decorator: EmptyElysiaSlot;
|
|
528
526
|
derive: {
|
|
529
527
|
log: RequestScopedLogger<TFields>;
|
|
530
528
|
};
|
|
531
|
-
resolve: EmptyElysiaSlot;
|
|
532
529
|
store: LogixlysiaStore;
|
|
533
530
|
}
|
|
534
|
-
type Logixlysia<TFields extends object = LogFields> = Elysia<"", LogixlysiaSingleton<TFields>>;
|
|
531
|
+
type Logixlysia<TFields extends object = LogFields> = Elysia<"", "local", LogixlysiaSingleton<TFields>>;
|
|
535
532
|
type LogixlysiaPlugin<TFields extends object = LogFields> = Logixlysia<TFields> & {
|
|
536
533
|
wrapWs: ReturnType<typeof createWsHandlerWrapper>;
|
|
537
534
|
};
|
|
@@ -543,7 +540,7 @@ type LogixlysiaPlugin<TFields extends object = LogFields> = Logixlysia<TFields>
|
|
|
543
540
|
declare const createLogixlysiaPlugin: <TFields extends object = LogFields>(rawOptions?: Options) => LogixlysiaPlugin<TFields>;
|
|
544
541
|
/**
|
|
545
542
|
* Drains every transport and file sink; with `close: true` also releases
|
|
546
|
-
* them. For processes that stop without Elysia's `
|
|
543
|
+
* them. For processes that stop without Elysia's `cleanup` (workers,
|
|
547
544
|
* scripts, custom signal handlers). Safe to call more than once.
|
|
548
545
|
*/
|
|
549
546
|
declare const flushLogixlysia: (options: Options, { close }?: {
|