@supacloud/elysia 0.29.1 → 0.30.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/README.md CHANGED
@@ -11,7 +11,7 @@ is a separately authorized business command, never an assumed rollback.
11
11
  The Elysia peer and development dependency are pinned to `2.0.0-beta.21`.
12
12
  The runtime adapter pins Effect `4.0.2` and consumes its `Exit`-based
13
13
  execution boundary.
14
- `compatibility.json` records the acceptance target: Bun 1.4.2, Elysia
14
+ `compatibility.json` records the acceptance target: Bun 1.4.3, Elysia
15
15
  2.0.0-beta.21, Effect 4.0.2, `typebox` 1.3.34, `exact-mirror` 1.2.6,
16
16
  TypeScript CLI 7.0.2 and the compiler's separate TypeScript 6 semantic API 6.0.2.
17
17
  The matrix is a
@@ -1,10 +1,10 @@
1
1
  {
2
- "bun": "1.4.2",
2
+ "bun": "1.4.3",
3
3
  "packages": {
4
4
  "elysia": "2.0.0-beta.21",
5
5
  "effect": "4.0.2",
6
6
  "typescript": "7.0.2",
7
- "typebox": "1.3.34",
7
+ "typebox": "1.3.36",
8
8
  "exact-mirror": "1.2.6",
9
9
  "@typescript/typescript6": "6.0.2"
10
10
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Elysia, type AnyElysia, type Context, type StatusMap } from "elysia";
2
2
  import type { CommandRuntimeAudit, CommandRuntimeAuthorizer, CommandRuntimeGovernance, CommandRuntimeInvocation, CommandRuntimeMiddleware } from "@supacloud/app";
3
3
  import { PendingWorkRegistry } from "@supacloud/app/runtime";
4
- import { type CommandPreview } from "@supacloud/contracts";
4
+ import { type CommandPreview, type ErrorMetadata } from "@supacloud/contracts";
5
5
  import { type HttpPolicyRegistry } from "./http-policy";
6
6
  export { HttpPolicyConfigurationError } from "./http-policy";
7
7
  export type { HttpPolicy, HttpPolicyContext, HttpPolicyResponseContext, HttpPolicyDeclaration, HttpPolicyRegistry } from "./http-policy";
@@ -221,18 +221,21 @@ export interface ApplicationErrorOptions {
221
221
  status?: number;
222
222
  code?: string;
223
223
  details?: unknown;
224
+ metadata?: ErrorMetadata;
224
225
  }
225
226
  export interface PublicApplicationError extends Error {
226
227
  readonly expose: true;
227
228
  readonly status: number;
228
229
  readonly code: string;
229
230
  readonly details?: unknown;
231
+ readonly metadata?: ErrorMetadata;
230
232
  }
231
233
  export declare class ApplicationError extends Error implements PublicApplicationError {
232
234
  readonly expose: true;
233
235
  readonly status: number;
234
236
  readonly code: string;
235
237
  readonly details?: unknown;
238
+ readonly metadata?: ErrorMetadata;
236
239
  constructor(message: string, options?: ApplicationErrorOptions);
237
240
  }
238
241
  export type JsonResponseValidator<T> = (value: unknown) => value is T;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/index.ts
2
2
  import { Elysia as Elysia3, setupTypebox, Validator as Validator2 } from "elysia";
3
3
  import { PendingWorkRegistry as PendingWorkRegistry2, PendingWorkTimeoutError, PendingWorkCapacityError } from "@supacloud/app/runtime";
4
- import { decodeCommandPreview } from "@supacloud/contracts";
4
+ import { commandFailureMetadata as commandFailureMetadata2, decodeCommandPreview } from "@supacloud/contracts";
5
5
 
6
6
  // src/command-errors.ts
7
7
  function commandErrorCode(error) {
@@ -1125,6 +1125,7 @@ function bindCompiledCommand(options) {
1125
1125
  // src/persistent-command.ts
1126
1126
  import {
1127
1127
  CommandError,
1128
+ commandFailureMetadata,
1128
1129
  decodeCommandIdentity
1129
1130
  } from "@supacloud/contracts";
1130
1131
  function createPersistentCommandAdapter(command, options) {
@@ -1143,7 +1144,7 @@ function createPersistentCommandAdapter(command, options) {
1143
1144
  if (!(error instanceof CommandError))
1144
1145
  throw error;
1145
1146
  const status = commandErrorStatus(error.code);
1146
- throw new ApplicationError(error.code, { code: error.code, status });
1147
+ throw new ApplicationError(error.code, { code: error.code, status, metadata: commandFailureMetadata(error.code) });
1147
1148
  }
1148
1149
  }
1149
1150
  };
@@ -2024,12 +2025,14 @@ class ApplicationError extends Error {
2024
2025
  status;
2025
2026
  code;
2026
2027
  details;
2028
+ metadata;
2027
2029
  constructor(message, options = {}) {
2028
2030
  super(message);
2029
2031
  this.name = "ApplicationError";
2030
2032
  this.status = options.status ?? 500;
2031
2033
  this.code = options.code ?? "INTERNAL_ERROR";
2032
2034
  this.details = options.details;
2035
+ this.metadata = options.metadata;
2033
2036
  }
2034
2037
  }
2035
2038
  function validatedJsonResponse(validate, value, init) {
@@ -2767,7 +2770,12 @@ async function executeJob(compiled, services, job, input, requestContext, import
2767
2770
  function defaultErrorResponse(error, frameworkCode) {
2768
2771
  const protocolCode = commandErrorCode(error);
2769
2772
  if (protocolCode) {
2770
- return Response.json({ ok: false, code: protocolCode, message: protocolCode }, {
2773
+ return Response.json({
2774
+ ok: false,
2775
+ code: protocolCode,
2776
+ message: protocolCode,
2777
+ metadata: commandFailureMetadata2(protocolCode)
2778
+ }, {
2771
2779
  status: commandErrorStatus(protocolCode)
2772
2780
  });
2773
2781
  }
@@ -2776,7 +2784,8 @@ function defaultErrorResponse(error, frameworkCode) {
2776
2784
  ok: false,
2777
2785
  code: error.code,
2778
2786
  message: error.message,
2779
- ...error.details === undefined ? {} : { details: error.details }
2787
+ ...error.details === undefined ? {} : { details: error.details },
2788
+ ...error.metadata === undefined ? {} : { metadata: error.metadata }
2780
2789
  }, { status: error.status });
2781
2790
  }
2782
2791
  if (frameworkCode === "PARSE") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/elysia",
3
- "version": "0.29.1",
3
+ "version": "0.30.0",
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,28 +49,28 @@
49
49
  "directory": "packages/elysia"
50
50
  },
51
51
  "dependencies": {
52
- "@supacloud/app": "0.25.0",
53
- "@supacloud/contracts": "0.8.0",
52
+ "@supacloud/app": "0.27.0",
53
+ "@supacloud/contracts": "0.9.0",
54
54
  "effect": "4.0.2",
55
55
  "exact-mirror": "1.2.6",
56
- "jose": "^6.2.11",
57
- "typebox": "1.3.34"
56
+ "jose": "^6.2.12",
57
+ "typebox": "1.3.36"
58
58
  },
59
59
  "overrides": {
60
- "@supacloud/delivery": "0.14.0",
61
- "@supacloud/contracts": "0.8.0",
62
- "@supacloud/commands": "0.9.1",
60
+ "@supacloud/delivery": "0.18.0",
61
+ "@supacloud/contracts": "0.9.0",
62
+ "@supacloud/commands": "0.9.2",
63
63
  "@graphql-tools/utils": "^12.0.3"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "elysia": "2.0.0-beta.21"
67
67
  },
68
68
  "devDependencies": {
69
- "@supacloud/compiler": "0.43.0",
70
- "@supacloud/delivery": "0.14.0",
71
- "@supacloud/commands": "0.9.1",
72
- "@supacloud/db": "0.16.0",
73
- "@types/bun": "^1.4.2",
69
+ "@supacloud/compiler": "0.46.0",
70
+ "@supacloud/delivery": "0.18.0",
71
+ "@supacloud/commands": "0.9.2",
72
+ "@supacloud/db": "0.17.0",
73
+ "@types/bun": "^1.4.3",
74
74
  "elysia": "2.0.0-beta.21",
75
75
  "typescript": "^7.0.2"
76
76
  }