@supacloud/elysia 0.18.0 → 0.19.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 +319 -0
- package/dist/command-binding.d.ts +33 -0
- package/dist/examples/fulfillment.d.ts +38 -0
- package/dist/fixtures/webhook-generated/application.d.ts +11 -1
- package/dist/http-policy-postgres.d.ts +12 -0
- package/dist/http-policy-stores.d.ts +33 -0
- package/dist/http-policy-suite.d.ts +75 -0
- package/dist/http-policy.d.ts +25 -0
- package/dist/http-response-cache.d.ts +14 -0
- package/dist/http-telemetry.d.ts +40 -0
- package/dist/index.d.ts +302 -11
- package/dist/index.js +771 -101
- package/dist/memory.d.ts +4 -3
- package/dist/schema_contract.d.ts +2 -2
- package/dist/testing.d.ts +3 -2
- package/dist/webhook-migration-example.d.ts +7 -1
- package/package.json +8 -7
package/dist/memory.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AnyElysia, Elysia } from "elysia";
|
|
1
2
|
import { type ApplicationOptions, type TrustedRequestIdentity } from "./index";
|
|
2
3
|
import { type MemoryPolicy } from "./memory_policy";
|
|
3
4
|
export interface HandleLike {
|
|
@@ -33,7 +34,7 @@ export interface MemoryStorage {
|
|
|
33
34
|
failNext(error?: Error): void;
|
|
34
35
|
setPolicy(policy?: (operation: "put" | "get" | "delete" | "list", bucket: string, key: string) => boolean): void;
|
|
35
36
|
}
|
|
36
|
-
export interface MemorySandboxOptions extends Omit<ApplicationOptions
|
|
37
|
+
export interface MemorySandboxOptions<Http extends AnyElysia = Elysia> extends Omit<ApplicationOptions<Http>, "deps" | "requestContext"> {
|
|
37
38
|
/** Stable identity used by every request unless overridden by requestContext. */
|
|
38
39
|
identity?: TrustedRequestIdentity;
|
|
39
40
|
/** Stable request id used when the request does not provide x-request-id. */
|
|
@@ -41,7 +42,7 @@ export interface MemorySandboxOptions extends Omit<ApplicationOptions, "deps" |
|
|
|
41
42
|
/** Extend the platform dependency bag without replacing memory dependencies. */
|
|
42
43
|
deps?: Record<string, unknown>;
|
|
43
44
|
/** Replace the default deterministic request context factory. */
|
|
44
|
-
requestContext?: ApplicationOptions["requestContext"];
|
|
45
|
+
requestContext?: ApplicationOptions<Http>["requestContext"];
|
|
45
46
|
/** Enable the test-only permission, receipt, transaction and audit adapters. */
|
|
46
47
|
memoryGovernance?: boolean;
|
|
47
48
|
}
|
|
@@ -65,4 +66,4 @@ export interface MemorySandbox {
|
|
|
65
66
|
* PostgreSQL or S3 emulators. They are sufficient for fast command and HTTP
|
|
66
67
|
* behavior tests while keeping production adapters replaceable.
|
|
67
68
|
*/
|
|
68
|
-
export declare function createMemorySandbox(options?: MemorySandboxOptions): MemorySandbox;
|
|
69
|
+
export declare function createMemorySandbox<const Http extends AnyElysia = Elysia>(options?: MemorySandboxOptions<Http>): MemorySandbox;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StatusMap, ElysiaCustomStatusResponse, type Cookie, type
|
|
1
|
+
import { StatusMap, ElysiaCustomStatusResponse, type Cookie, type AnyElysia, type HTTPMethod, type InputSchema, type MaybePromise, type TSchema, type UnwrapSchema } from "elysia";
|
|
2
2
|
import type { ResponseMapSelector as AppResponseMapSelector, RouteContractSchemas as AppRouteContractSchemas } from "@supacloud/app";
|
|
3
3
|
/** Response selectors are owned by @supacloud/app and re-exported by the adapter. */
|
|
4
4
|
export type ResponseMapSelector = AppResponseMapSelector;
|
|
@@ -121,7 +121,7 @@ export declare function toElysiaRouteSchema<const Schemas extends RouteContractS
|
|
|
121
121
|
*/
|
|
122
122
|
export declare function defineElysiaRoute<const Method extends HTTPMethod, const Path extends string, const Schemas extends RouteContractSchemas>(method: Method, path: Path, contract: Schemas, handler: ElysiaRouteHandler<NoInfer<Schemas>, Path>): ElysiaRouteDefinition<Method, Path, Schemas>;
|
|
123
123
|
/** Register a contract-bound route while preserving Elysia's fluent app API. */
|
|
124
|
-
export declare function registerElysiaRoute<const App extends
|
|
124
|
+
export declare function registerElysiaRoute<const App extends AnyElysia, const Method extends HTTPMethod, const Path extends string, const Schemas extends RouteContractSchemas>(app: App, route: ElysiaRouteDefinition<Method, Path, Schemas>): App;
|
|
125
125
|
export declare class SchemaContractError extends Error {
|
|
126
126
|
readonly code = "SCHEMA_CONTRACT_INVALID";
|
|
127
127
|
constructor();
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { Elysia } from "elysia";
|
|
2
1
|
/** Issue an in-process request against an Elysia app. */
|
|
3
|
-
export declare function testRequest(app:
|
|
2
|
+
export declare function testRequest(app: {
|
|
3
|
+
handle(request: Request): Response | Promise<Response>;
|
|
4
|
+
}, path: string, init?: RequestInit): Promise<Response>;
|
|
@@ -45,6 +45,12 @@ export declare function createWebhookMigrationExample(options: {
|
|
|
45
45
|
schema: {};
|
|
46
46
|
standaloneSchema: {};
|
|
47
47
|
response: {};
|
|
48
|
+
} & {
|
|
49
|
+
derive: {};
|
|
50
|
+
resolve: {};
|
|
51
|
+
schema: {};
|
|
52
|
+
standaloneSchema: {};
|
|
53
|
+
response: {};
|
|
48
54
|
}>;
|
|
49
|
-
modules: import("./fixtures/webhook-generated/application").
|
|
55
|
+
modules: import("./fixtures/webhook-generated/application").CompiledApplicationModule[];
|
|
50
56
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/elysia",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"test:conformance": "bun test src/conformance.test.ts",
|
|
30
30
|
"test:runtime-safety": "SUPACLOUD_REQUIRE_RUNTIME_SAFETY=1 bun test src/runtime-safety.test.ts",
|
|
31
31
|
"test:contract-upgrade": "bun test src/contract-upgrade.test.ts",
|
|
32
|
+
"bench:http-policy": "bun bench/http-policy.ts",
|
|
32
33
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
33
34
|
"typecheck:test": "tsc -p tsconfig.test.json --noEmit"
|
|
34
35
|
},
|
|
@@ -46,20 +47,20 @@
|
|
|
46
47
|
"directory": "packages/elysia"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"@supacloud/app": "0.
|
|
50
|
-
"@supacloud/contracts": "0.
|
|
50
|
+
"@supacloud/app": "0.17.0",
|
|
51
|
+
"@supacloud/contracts": "0.5.0",
|
|
51
52
|
"jose": "^6.2.11"
|
|
52
53
|
},
|
|
53
54
|
"overrides": {
|
|
54
|
-
"@supacloud/contracts": "0.
|
|
55
|
-
"@supacloud/commands": "0.
|
|
55
|
+
"@supacloud/contracts": "0.5.0",
|
|
56
|
+
"@supacloud/commands": "0.7.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"elysia": "^1.4.30"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@supacloud/compiler": "0.
|
|
62
|
-
"@supacloud/commands": "0.
|
|
62
|
+
"@supacloud/compiler": "0.26.0",
|
|
63
|
+
"@supacloud/commands": "0.7.0",
|
|
63
64
|
"@supacloud/db": "0.8.0",
|
|
64
65
|
"@types/bun": "^1.4.2",
|
|
65
66
|
"elysia": "^1.4.30",
|