@rasputin-ai/elysia 0.1.2

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.
@@ -0,0 +1,4 @@
1
+ export type { CaptureContext, RasputinClient, RasputinOptions } from '@rasputin-ai/core';
2
+ export type { RasputinElysia, RasputinElysiaPlugin } from './rasputin-init';
3
+ export { RasputinInit } from './rasputin-init';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzF,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ // src/rasputin-init.ts
2
+ import {
3
+ createClient,
4
+ isClientEnabled
5
+ } from "@rasputin-ai/core";
6
+ import { installGlobalHandlers } from "@rasputin-ai/node";
7
+ import { Elysia } from "elysia";
8
+
9
+ // src/sdk-meta.ts
10
+ var SDK_NAME = "@rasputin-ai/elysia";
11
+ var SDK_VERSION = "0.1.2";
12
+
13
+ // src/rasputin-init.ts
14
+ var toStatus = (status) => {
15
+ if (typeof status === "number" && Number.isFinite(status)) return status;
16
+ if (typeof status === "string") {
17
+ const parsed = Number(status);
18
+ return Number.isFinite(parsed) ? parsed : void 0;
19
+ }
20
+ return void 0;
21
+ };
22
+ var buildPlugin = (client) => new Elysia({ name: "rasputin" }).decorate("rasputin", client).onError({ as: "global" }, ({ error, request, set, route }) => {
23
+ try {
24
+ client.captureException(error, {
25
+ request: {
26
+ method: request.method,
27
+ route: route || void 0,
28
+ status: toStatus(set.status)
29
+ }
30
+ });
31
+ } catch {
32
+ }
33
+ return;
34
+ });
35
+ var RasputinInit = (options, hooks = {}) => {
36
+ try {
37
+ const {
38
+ installGlobalHandlers: installProcessHandlers = true,
39
+ fetch,
40
+ announceDeploy,
41
+ installTransportSignalHandlers
42
+ } = hooks;
43
+ const client = createClient(options, {
44
+ fetch,
45
+ announceDeploy,
46
+ installTransportSignalHandlers,
47
+ sdkVersion: SDK_VERSION,
48
+ sdkName: SDK_NAME
49
+ });
50
+ if (isClientEnabled(options) && installProcessHandlers) {
51
+ installGlobalHandlers(client);
52
+ }
53
+ return { client, plugin: buildPlugin(client) };
54
+ } catch {
55
+ const client = createClient({ ...options, enabled: false });
56
+ return { client, plugin: buildPlugin(client) };
57
+ }
58
+ };
59
+ export {
60
+ RasputinInit
61
+ };
@@ -0,0 +1,59 @@
1
+ import { type RasputinClient, type RasputinOptions } from '@rasputin-ai/core';
2
+ import { Elysia } from 'elysia';
3
+ export type RasputinElysiaPlugin = ReturnType<typeof buildPlugin>;
4
+ export type RasputinElysia = {
5
+ client: RasputinClient;
6
+ plugin: RasputinElysiaPlugin;
7
+ };
8
+ /** Test / internal seams — not part of the public init API. */
9
+ type RasputinElysiaHooks = {
10
+ fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
11
+ announceDeploy?: boolean;
12
+ installTransportSignalHandlers?: boolean;
13
+ /** Install process uncaught/rejection handlers. Default true. */
14
+ installGlobalHandlers?: boolean;
15
+ };
16
+ declare const buildPlugin: (client: RasputinClient) => Elysia<"", {
17
+ decorator: {
18
+ rasputin: RasputinClient;
19
+ };
20
+ store: {};
21
+ derive: {};
22
+ resolve: {};
23
+ }, {
24
+ typebox: {};
25
+ error: {};
26
+ }, {
27
+ schema: {};
28
+ standaloneSchema: {};
29
+ macro: {};
30
+ macroFn: {};
31
+ parser: {};
32
+ response: {};
33
+ }, {}, {
34
+ derive: {};
35
+ resolve: {};
36
+ schema: {};
37
+ standaloneSchema: {};
38
+ response: {};
39
+ }, {
40
+ derive: {};
41
+ resolve: {};
42
+ schema: {};
43
+ standaloneSchema: {};
44
+ response: {};
45
+ }>;
46
+ /**
47
+ * Boot Rasputin for Elysia: process handlers + request `onError` plugin.
48
+ *
49
+ * @example
50
+ * const { client, plugin } = RasputinInit(options);
51
+ * app.use(plugin);
52
+ * client.captureException(err); // manual capture
53
+ * await client.flush(); // serverless shutdown
54
+ *
55
+ * Never throws into the host app.
56
+ */
57
+ export declare const RasputinInit: (options: RasputinOptions, hooks?: RasputinElysiaHooks) => RasputinElysia;
58
+ export {};
59
+ //# sourceMappingURL=rasputin-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF,+DAA+D;AAC/D,KAAK,mBAAmB,GAAG;IAC1B,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,iEAAiE;IACjE,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAWF,QAAA,MAAM,WAAW,GAAI,QAAQ,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBvC,CAAC;AAEL;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACxB,SAAS,eAAe,EACxB,QAAO,mBAAwB,KAC7B,cA0BF,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Generated by packages/sdk/scripts/generate-sdk-meta.ts — do not edit. */
2
+ export declare const SDK_NAME = "@rasputin-ai/elysia";
3
+ export declare const SDK_VERSION = "0.1.2";
4
+ //# sourceMappingURL=sdk-meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-meta.d.ts","sourceRoot":"","sources":["../src/sdk-meta.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,eAAO,MAAM,QAAQ,wBAAwB,CAAC;AAC9C,eAAO,MAAM,WAAW,UAAU,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@rasputin-ai/elysia",
3
+ "version": "0.1.2",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "bun": "./src/index.ts",
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "bun ../scripts/build-package.ts .",
18
+ "prepublishOnly": "npm run build && bun ../scripts/check-lockstep-versions.ts",
19
+ "pack:check": "npm run build && npm pack --dry-run",
20
+ "typecheck": "bun ../scripts/build-package.ts ../core && bun ../scripts/build-package.ts ../node && bun ../scripts/generate-sdk-meta.ts . && bunx tsc --noEmit",
21
+ "lint": "biome check .",
22
+ "test": "bun test"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "dependencies": {
28
+ "@rasputin-ai/core": "0.1.2",
29
+ "@rasputin-ai/node": "0.1.2"
30
+ },
31
+ "peerDependencies": {
32
+ "elysia": ">=1.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@rasputin-ai/core": "workspace:*",
36
+ "@rasputin-ai/node": "workspace:*",
37
+ "@types/bun": "latest",
38
+ "@types/node": "22.13.10",
39
+ "esbuild": "0.25.12",
40
+ "elysia": "1.4.28",
41
+ "typescript": "5"
42
+ }
43
+ }