@supacloud/elysia 0.28.0 → 0.29.1

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/README.md CHANGED
@@ -9,9 +9,12 @@ is a separately authorized business command, never an assumed rollback.
9
9
  ## Compatibility and Acceptance Boundary
10
10
 
11
11
  The Elysia peer and development dependency are pinned to `2.0.0-beta.21`.
12
+ The runtime adapter pins Effect `4.0.2` and consumes its `Exit`-based
13
+ execution boundary.
12
14
  `compatibility.json` records the acceptance target: Bun 1.4.2, Elysia
13
- 2.0.0-beta.21, `typebox` 1.3.34, `exact-mirror` 1.2.6, TypeScript CLI 7.0.2
14
- and the compiler's separate TypeScript 6 semantic API 6.0.2. The matrix is a
15
+ 2.0.0-beta.21, Effect 4.0.2, `typebox` 1.3.34, `exact-mirror` 1.2.6,
16
+ TypeScript CLI 7.0.2 and the compiler's separate TypeScript 6 semantic API 6.0.2.
17
+ The matrix is a
15
18
  required target, not proof of an execution. See the dated, commit-specific
16
19
  [framework acceptance record](../../docs/framework-acceptance.md) for actual
17
20
  results. The contract-upgrade gate checks both TypeScript engines. These tests
@@ -2,6 +2,7 @@
2
2
  "bun": "1.4.2",
3
3
  "packages": {
4
4
  "elysia": "2.0.0-beta.21",
5
+ "effect": "4.0.2",
5
6
  "typescript": "7.0.2",
6
7
  "typebox": "1.3.34",
7
8
  "exact-mirror": "1.2.6",
package/dist/effect.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as Effect from "effect/Effect";
2
- import * as Exit from "effect/Exit";
1
+ import { Effect, Exit } from "effect";
3
2
  import type * as Layer from "effect/Layer";
4
3
  export interface CompiledEffectError {
5
4
  readonly tag: string;
@@ -17,6 +16,7 @@ export interface CompiledEffectDescriptor {
17
16
  }
18
17
  export interface SupaCloudEffectRuntime {
19
18
  run(program: Effect.Effect<unknown, unknown, unknown>): Promise<Exit.Exit<unknown, unknown>>;
19
+ dispose?(): Promise<void>;
20
20
  }
21
21
  export declare class EffectApplicationError extends Error {
22
22
  readonly status: number;
package/dist/index.js CHANGED
@@ -1015,12 +1015,7 @@ function createDocumentationPlugin(options = {}) {
1015
1015
  }
1016
1016
 
1017
1017
  // src/effect.ts
1018
- import * as Duration from "effect/Duration";
1019
- import * as Effect from "effect/Effect";
1020
- import * as Schedule from "effect/Schedule";
1021
- import * as Cause from "effect/Cause";
1022
- import * as Exit from "effect/Exit";
1023
- import * as Runtime from "effect/Runtime";
1018
+ import { Cause, Duration, Effect, Exit, ManagedRuntime, Schedule } from "effect";
1024
1019
 
1025
1020
  class EffectApplicationError extends Error {
1026
1021
  status;
@@ -1041,11 +1036,12 @@ function createDefaultEffectRuntime() {
1041
1036
  };
1042
1037
  }
1043
1038
  function createEffectRuntimeFromLayer(layer) {
1039
+ const managedRuntime = ManagedRuntime.make(layer);
1044
1040
  return {
1045
1041
  run(program) {
1046
- const provided = Effect.provide(layer)(program);
1047
- return Effect.runPromiseExit(provided);
1048
- }
1042
+ return managedRuntime.runPromiseExit(program);
1043
+ },
1044
+ dispose: () => managedRuntime.dispose()
1049
1045
  };
1050
1046
  }
1051
1047
  function isRecord(value) {
@@ -1063,17 +1059,7 @@ function effectErrorTag(error) {
1063
1059
  return error.constructor.name;
1064
1060
  return;
1065
1061
  }
1066
- function unwrapFiberFailure(error) {
1067
- let current = error;
1068
- const seen = new Set;
1069
- while (Runtime.isFiberFailure(current) && !seen.has(current)) {
1070
- seen.add(current);
1071
- current = Cause.squash(current[Runtime.FiberFailureCauseId]);
1072
- }
1073
- return current;
1074
- }
1075
1062
  function mapEffectFailure(error, descriptor) {
1076
- error = unwrapFiberFailure(error);
1077
1063
  const tag = effectErrorTag(error);
1078
1064
  const mapping = tag && descriptor?.errors?.find((entry) => entry.tag === tag);
1079
1065
  if (mapping) {
@@ -2907,6 +2893,11 @@ function createApplication(options) {
2907
2893
  errors.push(error);
2908
2894
  }
2909
2895
  }
2896
+ try {
2897
+ await options.effectRuntime?.dispose?.();
2898
+ } catch (error) {
2899
+ errors.push(error);
2900
+ }
2910
2901
  if (errors.length > 0) {
2911
2902
  throw new AggregateError(errors, "Application destruction failed");
2912
2903
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/elysia",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "description": "Elysia runtime adapter for SupaCloud compiled modules: application/request scopes, route registration and validation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,15 +49,15 @@
49
49
  "directory": "packages/elysia"
50
50
  },
51
51
  "dependencies": {
52
- "@supacloud/app": "0.24.0",
52
+ "@supacloud/app": "0.25.0",
53
53
  "@supacloud/contracts": "0.8.0",
54
- "effect": "3.22.1",
54
+ "effect": "4.0.2",
55
55
  "exact-mirror": "1.2.6",
56
56
  "jose": "^6.2.11",
57
57
  "typebox": "1.3.34"
58
58
  },
59
59
  "overrides": {
60
- "@supacloud/delivery": "0.8.0",
60
+ "@supacloud/delivery": "0.14.0",
61
61
  "@supacloud/contracts": "0.8.0",
62
62
  "@supacloud/commands": "0.9.1",
63
63
  "@graphql-tools/utils": "^12.0.3"
@@ -66,10 +66,10 @@
66
66
  "elysia": "2.0.0-beta.21"
67
67
  },
68
68
  "devDependencies": {
69
- "@supacloud/compiler": "0.41.0",
70
- "@supacloud/delivery": "0.8.0",
69
+ "@supacloud/compiler": "0.43.0",
70
+ "@supacloud/delivery": "0.14.0",
71
71
  "@supacloud/commands": "0.9.1",
72
- "@supacloud/db": "0.14.0",
72
+ "@supacloud/db": "0.16.0",
73
73
  "@types/bun": "^1.4.2",
74
74
  "elysia": "2.0.0-beta.21",
75
75
  "typescript": "^7.0.2"