@rasputin-ai/elysia 0.6.1 → 0.6.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.
- package/dist/index.js +54 -31
- package/dist/rasputin-init.d.ts.map +1 -1
- package/dist/sdk-meta.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// src/rasputin-init.ts
|
|
2
2
|
import {
|
|
3
3
|
createClient,
|
|
4
|
-
isClientEnabled
|
|
4
|
+
isClientEnabled,
|
|
5
|
+
parseDsn,
|
|
6
|
+
resolveEndpointUrls,
|
|
7
|
+
scheduleAnnounceDeploy
|
|
5
8
|
} from "@rasputin-ai/core";
|
|
6
9
|
import {
|
|
7
10
|
createExecutionRecorder,
|
|
@@ -13,7 +16,7 @@ import { Elysia } from "elysia";
|
|
|
13
16
|
|
|
14
17
|
// src/sdk-meta.ts
|
|
15
18
|
var SDK_NAME = "@rasputin-ai/elysia";
|
|
16
|
-
var SDK_VERSION = "0.6.
|
|
19
|
+
var SDK_VERSION = "0.6.2";
|
|
17
20
|
|
|
18
21
|
// src/rasputin-init.ts
|
|
19
22
|
var publicExecution = (runtime) => ({
|
|
@@ -32,35 +35,41 @@ var withExecution = (client, runtime, installRuntime, manifest, uninstallHandler
|
|
|
32
35
|
}) => {
|
|
33
36
|
const uninstallRuntime = installRuntime ? installAutomaticExecutionRuntime(runtime) : () => {
|
|
34
37
|
};
|
|
35
|
-
const manifestUpload = scheduleInstrumentationManifestUpload(
|
|
38
|
+
const manifestUpload = scheduleInstrumentationManifestUpload({
|
|
39
|
+
...manifest,
|
|
40
|
+
deferStart: true
|
|
41
|
+
});
|
|
36
42
|
const execution = publicExecution(runtime);
|
|
37
43
|
return {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
client: {
|
|
45
|
+
...client,
|
|
46
|
+
execution,
|
|
47
|
+
getStats: () => ({ ...client.getStats(), recorder: execution.getStats() }),
|
|
48
|
+
verifyConfiguration: manifestUpload.verify,
|
|
49
|
+
captureException: (error, context) => {
|
|
50
|
+
const result = client.captureException(error, context);
|
|
51
|
+
manifestUpload.flushSoon();
|
|
52
|
+
return result;
|
|
53
|
+
},
|
|
54
|
+
flush: async (timeoutMs) => {
|
|
55
|
+
const startedAt = Date.now();
|
|
56
|
+
await client.flush(timeoutMs);
|
|
57
|
+
if (timeoutMs === void 0) {
|
|
58
|
+
await manifestUpload.wait();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
await manifestUpload.wait(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
62
|
+
},
|
|
63
|
+
close: async () => {
|
|
64
|
+
uninstallHandlers();
|
|
65
|
+
uninstallRuntime();
|
|
66
|
+
manifestUpload.disconnect();
|
|
67
|
+
const startedAt = Date.now();
|
|
68
|
+
await client.close();
|
|
69
|
+
await manifestUpload.wait(Math.max(0, 2e3 - (Date.now() - startedAt)));
|
|
53
70
|
}
|
|
54
|
-
await manifestUpload.wait(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
55
71
|
},
|
|
56
|
-
|
|
57
|
-
uninstallHandlers();
|
|
58
|
-
uninstallRuntime();
|
|
59
|
-
manifestUpload.disconnect();
|
|
60
|
-
const startedAt = Date.now();
|
|
61
|
-
await client.close();
|
|
62
|
-
await manifestUpload.wait(Math.max(0, 2e3 - (Date.now() - startedAt)));
|
|
63
|
-
}
|
|
72
|
+
startManifestUpload: manifestUpload.start
|
|
64
73
|
};
|
|
65
74
|
};
|
|
66
75
|
var toStatus = (status) => {
|
|
@@ -152,7 +161,7 @@ function RasputinInit(options, hooks = {}) {
|
|
|
152
161
|
});
|
|
153
162
|
const client = createClient(options, {
|
|
154
163
|
fetch,
|
|
155
|
-
announceDeploy,
|
|
164
|
+
announceDeploy: false,
|
|
156
165
|
installTransportSignalHandlers,
|
|
157
166
|
sdkVersion: SDK_VERSION,
|
|
158
167
|
sdkName: SDK_NAME,
|
|
@@ -163,7 +172,7 @@ function RasputinInit(options, hooks = {}) {
|
|
|
163
172
|
});
|
|
164
173
|
let uninstallHandlers = () => {
|
|
165
174
|
};
|
|
166
|
-
const wrappedClient = withExecution(
|
|
175
|
+
const { client: wrappedClient, startManifestUpload } = withExecution(
|
|
167
176
|
client,
|
|
168
177
|
runtime,
|
|
169
178
|
recorderEnabled,
|
|
@@ -182,14 +191,28 @@ function RasputinInit(options, hooks = {}) {
|
|
|
182
191
|
if (enabled && installProcessHandlers) {
|
|
183
192
|
uninstallHandlers = installGlobalHandlers(wrappedClient);
|
|
184
193
|
}
|
|
194
|
+
const plugin = buildPlugin(wrappedClient, runtime, recorderEnabled).onStart(() => {
|
|
195
|
+
startManifestUpload();
|
|
196
|
+
if (!enabled || announceDeploy === false) return;
|
|
197
|
+
const parsed = parseDsn(options.dsn);
|
|
198
|
+
const apiUrl = typeof options.apiUrl === "string" && options.apiUrl.trim() ? options.apiUrl.trim() : parsed?.apiUrl;
|
|
199
|
+
if (!apiUrl) return;
|
|
200
|
+
scheduleAnnounceDeploy({
|
|
201
|
+
deployUrl: resolveEndpointUrls(apiUrl).deployUrl,
|
|
202
|
+
projectApiKey: options.projectApiKey,
|
|
203
|
+
environment: options.environment,
|
|
204
|
+
release: options.release,
|
|
205
|
+
fetch
|
|
206
|
+
});
|
|
207
|
+
});
|
|
185
208
|
return {
|
|
186
209
|
client: wrappedClient,
|
|
187
|
-
plugin
|
|
210
|
+
plugin
|
|
188
211
|
};
|
|
189
212
|
} catch {
|
|
190
213
|
const client = createClient({ ...options, enabled: false });
|
|
191
214
|
const runtime = createExecutionRecorder({ enabled: false });
|
|
192
|
-
const wrappedClient = withExecution(client, runtime, false, {
|
|
215
|
+
const { client: wrappedClient } = withExecution(client, runtime, false, {
|
|
193
216
|
projectApiKey: options.projectApiKey,
|
|
194
217
|
release: options.release,
|
|
195
218
|
apiUrl: options.apiUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAMN,KAAK,eAAe,EAGpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,wBAAwB,EAExB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,iFAAiF;AACjF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG;IAC5B,8EAA8E;IAC9E,MAAM,EAAE,kBAAkB,CAAC;IAC3B,2EAA2E;IAC3E,MAAM,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG;IACrD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;IAC7C;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;CACzC,CAAC;AAqHF,QAAA,MAAM,WAAW,GAChB,QAAQ,kBAAkB,EAC1B,WAAW,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,EACjD,iBAAiB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDxB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAAC"}
|
package/dist/sdk-meta.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rasputin-ai/elysia",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Official Rasputin AI SDK for Elysia.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@rasputin-ai/core": "0.6.
|
|
39
|
-
"@rasputin-ai/node": "0.6.
|
|
38
|
+
"@rasputin-ai/core": "0.6.2",
|
|
39
|
+
"@rasputin-ai/node": "0.6.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"elysia": ">=1.4.0 <2"
|