@rasputin-ai/elysia 0.2.0 → 0.4.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 +148 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +132 -17
- package/dist/instrument/bun.d.ts +3 -0
- package/dist/instrument/bun.d.ts.map +1 -0
- package/dist/instrument/bun.js +2 -0
- package/dist/instrument/node.d.ts +3 -0
- package/dist/instrument/node.d.ts.map +1 -0
- package/dist/instrument/node.js +2 -0
- package/dist/rasputin-init.d.ts +20 -17
- package/dist/rasputin-init.d.ts.map +1 -1
- package/dist/sdk-meta.d.ts +2 -2
- package/dist/sdk-meta.d.ts.map +1 -1
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Official Rasputin AI SDK for Elysia
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Report application errors to Rasputin.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Initialize once and register the plugin early in your app:
|
|
4
8
|
|
|
5
9
|
```ts
|
|
6
10
|
import { Elysia } from 'elysia';
|
|
@@ -8,25 +12,157 @@ import { RasputinInit } from '@rasputin-ai/elysia';
|
|
|
8
12
|
|
|
9
13
|
const { client, plugin } = RasputinInit({
|
|
10
14
|
projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY!,
|
|
15
|
+
release: process.env.RASPUTIN_RELEASE!,
|
|
11
16
|
environment: process.env.NODE_ENV ?? 'development',
|
|
12
|
-
|
|
13
|
-
moduleUrl: import.meta.url,
|
|
17
|
+
enabled: ['staging', 'production'].includes(process.env.NODE_ENV ?? 'development'),
|
|
14
18
|
});
|
|
15
19
|
|
|
16
|
-
const app = new Elysia()
|
|
20
|
+
const app = new Elysia()
|
|
21
|
+
.use(plugin) // Register Rasputin before other plugins when possible.
|
|
22
|
+
.use(otherPlugins)
|
|
23
|
+
.listen(3000);
|
|
17
24
|
```
|
|
18
25
|
|
|
19
|
-
Route errors
|
|
26
|
+
Route errors, uncaught exceptions, and unhandled rejections are reported automatically.
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
## Capture handled errors
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
```ts
|
|
31
|
+
try {
|
|
32
|
+
await processPayment();
|
|
33
|
+
} catch (error) {
|
|
34
|
+
client.captureException(error);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
24
39
|
|
|
25
40
|
| Field | Required | Description |
|
|
26
41
|
| --- | --- | --- |
|
|
27
42
|
| `projectApiKey` | yes | Project API key from the Rasputin dashboard |
|
|
28
|
-
| `environment` | yes |
|
|
29
|
-
| `release` |
|
|
30
|
-
| `enabled` | no |
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
43
|
+
| `environment` | yes | Environment such as `production`, `staging`, or `preview` |
|
|
44
|
+
| `release` | yes | Git commit SHA for the deployed version |
|
|
45
|
+
| `enabled` | no | Enables or disables the SDK; defaults to `true` |
|
|
46
|
+
| `logSuccess` | no | Prints a configuration summary when setup succeeds; defaults to `true`. Failures always log. |
|
|
47
|
+
| `moduleUrl` | no | `import.meta.url` from the initialization file; helps normalize local stack paths |
|
|
48
|
+
| `sourceRoot` | no | Git repository folder for a single-package service, such as `apps/api` |
|
|
49
|
+
| `sourceRoots` | no | Package-name to Git-folder mappings for ambiguous monorepos |
|
|
50
|
+
| `repoRoot` | no | Local filesystem display root; it does not control instrumentation or Git identity |
|
|
51
|
+
|
|
52
|
+
Rasputin normally identifies source from the nearest `package.json` and verifies it against the exact release on the server. Filesystem paths such as `/container` are never used as source identity.
|
|
53
|
+
|
|
54
|
+
For deployment checks, call:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const verification = await client.verifyConfiguration();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`verified` means every instrumented source file maps uniquely to the configured Git release. If a monorepo is ambiguous, set `sourceRoot` or `sourceRoots` using repository-relative folders, never Docker paths.
|
|
61
|
+
|
|
62
|
+
Rasputin also prints a configuration summary after the instrumentation manifest is uploaded. Set `logSuccess: false` if you do not want that banner in production logs. Mapping failures still warn.
|
|
63
|
+
|
|
64
|
+
## Shutdown
|
|
65
|
+
|
|
66
|
+
Events are sent in the background. Flush before a short-lived process exits:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
await client.flush();
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Call `await client.close()` during graceful shutdown when the process stays alive afterward.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
# Runtime recorder
|
|
77
|
+
|
|
78
|
+
Optionally attach the runtime state that led to an error — arguments, return values, and call history from the failing execution.
|
|
79
|
+
|
|
80
|
+
The Elysia plugin scopes each HTTP request as an execution automatically. For background jobs and other non-HTTP work, wrap them manually (see below).
|
|
81
|
+
|
|
82
|
+
## Automatic instrumentation
|
|
83
|
+
|
|
84
|
+
Start your process with the adapter for your runtime so Rasputin can instrument application functions as they load:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"scripts": {
|
|
89
|
+
"start:node": "node --import @rasputin-ai/elysia/instrument/node dist/app.js",
|
|
90
|
+
"start:bun": "bun --preload @rasputin-ai/elysia/instrument/bun src/app.ts"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Runtime state is retained only inside an active execution and attached when that execution throws.
|
|
96
|
+
|
|
97
|
+
## Manual capture
|
|
98
|
+
|
|
99
|
+
For background jobs, scheduled tasks, or worker iterations, define an execution:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
await client.execution.run({ kind: 'job', name: 'sync-invoices' }, async () => {
|
|
103
|
+
await syncInvoices();
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
When automatic instrumentation is unavailable, mark individual functions explicitly:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const syncInvoices = client.execution.trace(
|
|
111
|
+
'src/jobs/sync-invoices.ts:syncInvoices',
|
|
112
|
+
async () => {
|
|
113
|
+
// ...
|
|
114
|
+
},
|
|
115
|
+
);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Runtime support
|
|
119
|
+
|
|
120
|
+
| Environment | Support |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| Elysia 1.4 or newer within 1.x on Bun 1.3.x | Supported for directly loaded JavaScript and TypeScript using `instrument/bun` |
|
|
123
|
+
| Elysia 1.4 or newer within 1.x on Node.js 22.15 or newer | Supported for unbundled ESM/CJS JavaScript using `instrument/node`; Node 22 and 24 are the supported LTS lines |
|
|
124
|
+
| TypeScript compiled to multiple JavaScript files | Supported on Node; emit adjacent source maps to retain original TypeScript locations |
|
|
125
|
+
| Single-file bundles (esbuild, tsup, webpack, Vite SSR, Next.js) | Automatic instrumentation not supported |
|
|
126
|
+
| `tsx`, custom Node loader stacks, and Node's native TypeScript execution | Automatic instrumentation not supported |
|
|
127
|
+
| Deno and edge runtimes | Not supported |
|
|
128
|
+
|
|
129
|
+
Tested on Bun 1.3.13, Node.js 24.19.0, and Elysia 1.4.28. Node.js 22.15.0 is the minimum for automatic instrumentation (synchronous module hooks). Use `execution.run()` and `execution.trace()` when automatic instrumentation is not available.
|
|
130
|
+
|
|
131
|
+
## Recorder configuration
|
|
132
|
+
|
|
133
|
+
Defaults work for most apps. Customize to exclude noisy sources, redact fields, or retain less state:
|
|
134
|
+
|
|
135
|
+
| Field | Default | Description |
|
|
136
|
+
| --- | ---: | --- |
|
|
137
|
+
| `enabled` | `true` | Enables runtime-state capture |
|
|
138
|
+
| `maxEventsPerExecution` | `500` | Maximum events retained for one execution |
|
|
139
|
+
| `maxCapturedCallsPerFunction` | `3` | Detailed successful calls retained before similar calls are summarized |
|
|
140
|
+
| `maxActiveMemoryBytes` | `64 MiB` | Maximum recorder memory shared across active executions |
|
|
141
|
+
| `maxDepth` | `3` | Maximum captured value depth |
|
|
142
|
+
| `maxObjectKeys` | `30` | Maximum properties retained from one object |
|
|
143
|
+
| `maxArrayElements` | `20` | Maximum items retained from one array, map, or set |
|
|
144
|
+
| `maxStringLength` | `500` | Maximum characters retained from one string |
|
|
145
|
+
| `maxSerializedValueBytes` | `8 KiB` | Maximum retained size of one captured value |
|
|
146
|
+
| `redactKeys` | `[]` | Additional case-insensitive property names to redact |
|
|
147
|
+
| `excludeSources` | `[]` | Source globs or function-name patterns to exclude |
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
const { client, plugin } = RasputinInit({
|
|
151
|
+
// ...required options
|
|
152
|
+
executionRecorder: {
|
|
153
|
+
excludeSources: ['src/logger/**', 'packages/shared-logger/**'],
|
|
154
|
+
redactKeys: ['customerEmail'],
|
|
155
|
+
maxEventsPerExecution: 200,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Runtime state can include application data. Use `redactKeys` for sensitive fields.
|
|
161
|
+
|
|
162
|
+
## Diagnostics
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
const { recorder, transport } = client.getStats();
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Counters are local to the current process and reset on restart.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { CaptureContext, RasputinClient, RasputinOptions } from '@rasputin-ai/core';
|
|
2
|
-
export type { RasputinElysia, RasputinElysiaPlugin } from './rasputin-init';
|
|
2
|
+
export type { RasputinElysia, RasputinElysiaOptions, RasputinElysiaPlugin } from './rasputin-init';
|
|
3
3
|
export { RasputinInit } from './rasputin-init';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,49 @@ import {
|
|
|
3
3
|
createClient,
|
|
4
4
|
isClientEnabled
|
|
5
5
|
} from "@rasputin-ai/core";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createExecutionRecorder,
|
|
8
|
+
installAutomaticExecutionRuntime,
|
|
9
|
+
installGlobalHandlers,
|
|
10
|
+
scheduleInstrumentationManifestUpload
|
|
11
|
+
} from "@rasputin-ai/node";
|
|
7
12
|
import { Elysia } from "elysia";
|
|
8
13
|
|
|
9
14
|
// src/sdk-meta.ts
|
|
10
15
|
var SDK_NAME = "@rasputin-ai/elysia";
|
|
11
|
-
var SDK_VERSION = "0.
|
|
16
|
+
var SDK_VERSION = "0.4.0";
|
|
12
17
|
|
|
13
18
|
// src/rasputin-init.ts
|
|
19
|
+
var withExecution = (client, execution, installRuntime, manifest) => {
|
|
20
|
+
const uninstallRuntime = installRuntime ? installAutomaticExecutionRuntime(execution) : () => {
|
|
21
|
+
};
|
|
22
|
+
const manifestUpload = scheduleInstrumentationManifestUpload(manifest);
|
|
23
|
+
return {
|
|
24
|
+
...client,
|
|
25
|
+
execution,
|
|
26
|
+
getStats: () => ({ ...client.getStats(), recorder: execution.getStats() }),
|
|
27
|
+
verifyConfiguration: manifestUpload.verify,
|
|
28
|
+
captureException: (error, context) => {
|
|
29
|
+
const runtimeState = context?.runtimeState ?? execution.getErrorState(
|
|
30
|
+
error,
|
|
31
|
+
context?.request ? { kind: "http", request: context.request } : void 0
|
|
32
|
+
);
|
|
33
|
+
const result = client.captureException(error, { ...context, runtimeState });
|
|
34
|
+
manifestUpload.flushSoon();
|
|
35
|
+
return result;
|
|
36
|
+
},
|
|
37
|
+
flush: async (timeoutMs) => {
|
|
38
|
+
await client.flush(timeoutMs);
|
|
39
|
+
await manifestUpload.wait();
|
|
40
|
+
},
|
|
41
|
+
close: async () => {
|
|
42
|
+
uninstallRuntime();
|
|
43
|
+
manifestUpload.disconnect();
|
|
44
|
+
await client.close();
|
|
45
|
+
await manifestUpload.wait();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
14
49
|
var toStatus = (status) => {
|
|
15
50
|
if (typeof status === "number" && Number.isFinite(status)) return status;
|
|
16
51
|
if (typeof status === "string") {
|
|
@@ -19,20 +54,72 @@ var toStatus = (status) => {
|
|
|
19
54
|
}
|
|
20
55
|
return void 0;
|
|
21
56
|
};
|
|
22
|
-
var
|
|
57
|
+
var isPromiseLike = (value) => {
|
|
58
|
+
return Boolean(value) && typeof value.then === "function";
|
|
59
|
+
};
|
|
60
|
+
var finishExecution = (scope, metadata) => {
|
|
23
61
|
try {
|
|
24
|
-
|
|
25
|
-
request: {
|
|
26
|
-
method: request.method,
|
|
27
|
-
route: route || void 0,
|
|
28
|
-
status: toStatus(set.status)
|
|
29
|
-
}
|
|
30
|
-
});
|
|
62
|
+
scope.finish(metadata);
|
|
31
63
|
} catch {
|
|
32
64
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
65
|
+
};
|
|
66
|
+
var rememberExecutionError = (scope, error) => {
|
|
67
|
+
try {
|
|
68
|
+
scope.getErrorState(error);
|
|
69
|
+
} catch {
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var buildPlugin = (client, execution, recorderEnabled) => {
|
|
73
|
+
const executionBoundary = ((handler, initialRequest) => {
|
|
74
|
+
const scope = execution.createScope({
|
|
75
|
+
kind: "http",
|
|
76
|
+
request: { method: initialRequest.method }
|
|
77
|
+
});
|
|
78
|
+
return (request) => scope.run(() => {
|
|
79
|
+
try {
|
|
80
|
+
const response = handler(request);
|
|
81
|
+
if (isPromiseLike(response)) {
|
|
82
|
+
return Promise.resolve(response).then(
|
|
83
|
+
(value) => {
|
|
84
|
+
finishExecution(scope, { request: { status: value.status } });
|
|
85
|
+
return value;
|
|
86
|
+
},
|
|
87
|
+
(error) => {
|
|
88
|
+
rememberExecutionError(scope, error);
|
|
89
|
+
finishExecution(scope);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
finishExecution(scope, { request: { status: response.status } });
|
|
95
|
+
return response;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
rememberExecutionError(scope, error);
|
|
98
|
+
finishExecution(scope);
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
const plugin = new Elysia({ name: "rasputin" }).decorate("rasputin", client);
|
|
104
|
+
if (recorderEnabled) plugin.wrap(executionBoundary);
|
|
105
|
+
return plugin.onError({ as: "global" }, ({ error, request, set, route }) => {
|
|
106
|
+
const requestContext = {
|
|
107
|
+
method: request.method,
|
|
108
|
+
route: route || void 0,
|
|
109
|
+
status: toStatus(set.status)
|
|
110
|
+
};
|
|
111
|
+
try {
|
|
112
|
+
const runtimeState = execution.getErrorState(error, {
|
|
113
|
+
kind: "http",
|
|
114
|
+
request: requestContext
|
|
115
|
+
});
|
|
116
|
+
client.captureException(error, { request: requestContext, runtimeState });
|
|
117
|
+
} catch {
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
function RasputinInit(options, hooks = {}) {
|
|
36
123
|
try {
|
|
37
124
|
const {
|
|
38
125
|
installGlobalHandlers: installProcessHandlers = true,
|
|
@@ -47,15 +134,43 @@ var RasputinInit = (options, hooks = {}) => {
|
|
|
47
134
|
sdkVersion: SDK_VERSION,
|
|
48
135
|
sdkName: SDK_NAME
|
|
49
136
|
});
|
|
137
|
+
const recorderEnabled = isClientEnabled(options) && options.executionRecorder?.enabled !== false;
|
|
138
|
+
const execution = createExecutionRecorder({
|
|
139
|
+
...options.executionRecorder,
|
|
140
|
+
enabled: recorderEnabled
|
|
141
|
+
});
|
|
142
|
+
const wrappedClient = withExecution(client, execution, recorderEnabled, {
|
|
143
|
+
projectApiKey: options.projectApiKey,
|
|
144
|
+
release: options.release,
|
|
145
|
+
apiUrl: options.apiUrl,
|
|
146
|
+
fetch,
|
|
147
|
+
enabled: isClientEnabled(options),
|
|
148
|
+
sourceRoot: options.sourceRoot,
|
|
149
|
+
sourceRoots: options.sourceRoots,
|
|
150
|
+
logSuccess: options.logSuccess
|
|
151
|
+
});
|
|
50
152
|
if (isClientEnabled(options) && installProcessHandlers) {
|
|
51
|
-
installGlobalHandlers(
|
|
153
|
+
installGlobalHandlers(wrappedClient);
|
|
52
154
|
}
|
|
53
|
-
return {
|
|
155
|
+
return {
|
|
156
|
+
client: wrappedClient,
|
|
157
|
+
plugin: buildPlugin(wrappedClient, execution, recorderEnabled)
|
|
158
|
+
};
|
|
54
159
|
} catch {
|
|
55
160
|
const client = createClient({ ...options, enabled: false });
|
|
56
|
-
|
|
161
|
+
const execution = createExecutionRecorder({ enabled: false });
|
|
162
|
+
const wrappedClient = withExecution(client, execution, false, {
|
|
163
|
+
projectApiKey: options.projectApiKey,
|
|
164
|
+
release: options.release,
|
|
165
|
+
apiUrl: options.apiUrl,
|
|
166
|
+
enabled: false,
|
|
167
|
+
sourceRoot: options.sourceRoot,
|
|
168
|
+
sourceRoots: options.sourceRoots,
|
|
169
|
+
logSuccess: options.logSuccess
|
|
170
|
+
});
|
|
171
|
+
return { client: wrappedClient, plugin: buildPlugin(wrappedClient, execution, false) };
|
|
57
172
|
}
|
|
58
|
-
}
|
|
173
|
+
}
|
|
59
174
|
export {
|
|
60
175
|
RasputinInit
|
|
61
176
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/instrument/bun.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/instrument/node.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,mCAAmC,CAAC"}
|
package/dist/rasputin-init.d.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Elysia owns a reliable request/response lifecycle, so this integration creates HTTP execution
|
|
3
|
+
* boundaries automatically around the full middleware and handler chain. Framework-specific code is
|
|
4
|
+
* intentionally limited to lifecycle wiring; recording, serialization, and safety policy stay in
|
|
5
|
+
* the framework-neutral Node recorder.
|
|
6
|
+
*/
|
|
7
|
+
import { type RasputinOptions } from '@rasputin-ai/core';
|
|
8
|
+
import { type ExecutionRecorderOptions, type RasputinExecution, type RasputinNodeClient } from '@rasputin-ai/node';
|
|
2
9
|
import { Elysia } from 'elysia';
|
|
3
10
|
export type RasputinElysiaPlugin = ReturnType<typeof buildPlugin>;
|
|
4
11
|
export type RasputinElysia = {
|
|
5
|
-
client:
|
|
12
|
+
client: RasputinNodeClient;
|
|
6
13
|
plugin: RasputinElysiaPlugin;
|
|
7
14
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
announceDeploy?: boolean;
|
|
12
|
-
installTransportSignalHandlers?: boolean;
|
|
13
|
-
/** Install process uncaught/rejection handlers. Default true. */
|
|
14
|
-
installGlobalHandlers?: boolean;
|
|
15
|
+
export type RasputinElysiaOptions = RasputinOptions & {
|
|
16
|
+
/** Bounded runtime-state capture. Enabled by default; successful executions are discarded. */
|
|
17
|
+
executionRecorder?: ExecutionRecorderOptions;
|
|
15
18
|
};
|
|
16
|
-
declare const buildPlugin: (client:
|
|
19
|
+
declare const buildPlugin: (client: RasputinNodeClient, execution: RasputinExecution, recorderEnabled: boolean) => Elysia<"", {
|
|
17
20
|
decorator: {
|
|
18
|
-
rasputin:
|
|
21
|
+
rasputin: RasputinNodeClient;
|
|
19
22
|
};
|
|
20
23
|
store: {};
|
|
21
24
|
derive: {};
|
|
@@ -48,17 +51,17 @@ declare const buildPlugin: (client: RasputinClient) => Elysia<"", {
|
|
|
48
51
|
*
|
|
49
52
|
* @example
|
|
50
53
|
* const { client, plugin } = RasputinInit({
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
54
|
+
* projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY!,
|
|
55
|
+
* release: process.env.RASPUTIN_RELEASE!,
|
|
56
|
+
* environment: process.env.NODE_ENV ?? 'development',
|
|
57
|
+
* enabled: ['staging', 'production'].includes(process.env.NODE_ENV ?? 'development'),
|
|
55
58
|
* });
|
|
56
|
-
* app.use(plugin);
|
|
59
|
+
* app.use(plugin); // Chain this plugin as early as possible with .use(), before any other plugins or middleware.
|
|
57
60
|
* client.captureException(err); // manual capture
|
|
58
61
|
* await client.flush(); // serverless shutdown
|
|
59
62
|
*
|
|
60
63
|
* Never throws into the host app.
|
|
61
64
|
*/
|
|
62
|
-
export declare
|
|
65
|
+
export declare function RasputinInit(options: RasputinElysiaOptions): RasputinElysia;
|
|
63
66
|
export {};
|
|
64
67
|
//# sourceMappingURL=rasputin-init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAKN,KAAK,eAAe,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEN,KAAK,wBAAwB,EAI7B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG;IACrD,8FAA8F;IAC9F,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;CAC7C,CAAC;AA4FF,QAAA,MAAM,WAAW,GAChB,QAAQ,kBAAkB,EAC1B,WAAW,iBAAiB,EAC5B,iBAAiB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DxB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAAC"}
|
package/dist/sdk-meta.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Generated by
|
|
1
|
+
/** Generated by scripts/generate-sdk-meta.ts — do not edit. */
|
|
2
2
|
export declare const SDK_NAME = "@rasputin-ai/elysia";
|
|
3
|
-
export declare const SDK_VERSION = "0.
|
|
3
|
+
export declare const SDK_VERSION = "0.4.0";
|
|
4
4
|
//# sourceMappingURL=sdk-meta.d.ts.map
|
package/dist/sdk-meta.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-meta.d.ts","sourceRoot":"","sources":["../src/sdk-meta.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sdk-meta.d.ts","sourceRoot":"","sources":["../src/sdk-meta.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,eAAO,MAAM,QAAQ,wBAAwB,CAAC;AAC9C,eAAO,MAAM,WAAW,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rasputin-ai/elysia",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Official Rasputin AI SDK for Elysia.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"import": "./dist/index.js",
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./instrument/bun": {
|
|
13
|
+
"types": "./dist/instrument/bun.d.ts",
|
|
14
|
+
"import": "./dist/instrument/bun.js",
|
|
15
|
+
"default": "./dist/instrument/bun.js"
|
|
16
|
+
},
|
|
17
|
+
"./instrument/node": {
|
|
18
|
+
"types": "./dist/instrument/node.d.ts",
|
|
19
|
+
"import": "./dist/instrument/node.js",
|
|
20
|
+
"default": "./dist/instrument/node.js"
|
|
11
21
|
}
|
|
12
22
|
},
|
|
13
23
|
"files": [
|
|
@@ -25,11 +35,11 @@
|
|
|
25
35
|
"access": "public"
|
|
26
36
|
},
|
|
27
37
|
"dependencies": {
|
|
28
|
-
"@rasputin-ai/core": "0.
|
|
29
|
-
"@rasputin-ai/node": "0.
|
|
38
|
+
"@rasputin-ai/core": "0.4.0",
|
|
39
|
+
"@rasputin-ai/node": "0.4.0"
|
|
30
40
|
},
|
|
31
41
|
"peerDependencies": {
|
|
32
|
-
"elysia": ">=1.
|
|
42
|
+
"elysia": ">=1.4.0 <2"
|
|
33
43
|
},
|
|
34
44
|
"devDependencies": {
|
|
35
45
|
"@rasputin-ai/core": "workspace:*",
|