@rasputin-ai/sveltekit 0.13.0 → 0.14.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/dist/client/options.d.ts +2 -1
- package/dist/client/options.d.ts.map +1 -1
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +53 -6
- package/dist/sdk-meta.d.ts +1 -1
- package/dist/vite/index.js +687 -383
- package/dist/vite/plugin.d.ts +2 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/vite/upload-build-artifacts.d.ts.map +1 -1
- package/dist/vite/virtual-identity.d.ts +2 -1
- package/dist/vite/virtual-identity.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/client/options.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { RasputinEnvironment } from '@rasputin-ai/core';
|
|
1
2
|
/**
|
|
2
3
|
* Public browser configuration only. The privileged project key cannot appear
|
|
3
4
|
* here, so it is structurally excluded from the client hook API.
|
|
4
5
|
*/
|
|
5
6
|
export type RasputinSvelteKitClientOptions = {
|
|
6
7
|
dsn?: string;
|
|
7
|
-
environment:
|
|
8
|
+
environment: RasputinEnvironment;
|
|
8
9
|
release: string;
|
|
9
10
|
buildId?: string;
|
|
10
11
|
enabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/client/options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/client/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,mBAAmB,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/runtime/node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/runtime/node.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAkB7D,OAAO,KAAK,EACX,aAAa,EAKb,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AA6N3D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAAC"}
|
package/dist/runtime/node.js
CHANGED
|
@@ -2,19 +2,25 @@
|
|
|
2
2
|
import {
|
|
3
3
|
copyRedactKeys,
|
|
4
4
|
createClient,
|
|
5
|
-
isClientEnabled
|
|
5
|
+
isClientEnabled,
|
|
6
|
+
resolveClientActivation
|
|
6
7
|
} from "@rasputin-ai/core";
|
|
7
8
|
import {
|
|
8
9
|
bindAdaptiveRecorder,
|
|
10
|
+
bindExecutionMetrics,
|
|
11
|
+
bindFunctionMetrics,
|
|
12
|
+
createDynamicDurationSampleBuckets,
|
|
9
13
|
inertErrorObservation,
|
|
10
14
|
installAutomaticExecutionRuntime,
|
|
11
15
|
installGlobalHandlers,
|
|
16
|
+
releaseExecutionMetricsBindings,
|
|
17
|
+
releaseFunctionMetricsBindings,
|
|
12
18
|
scheduleInstrumentationManifestUpload
|
|
13
19
|
} from "@rasputin-ai/node/internal";
|
|
14
20
|
|
|
15
21
|
// src/sdk-meta.ts
|
|
16
22
|
var SDK_NAME = "@rasputin-ai/sveltekit";
|
|
17
|
-
var SDK_VERSION = "0.
|
|
23
|
+
var SDK_VERSION = "0.14.0";
|
|
18
24
|
|
|
19
25
|
// src/runtime/node.ts
|
|
20
26
|
var inertScope = () => ({
|
|
@@ -45,7 +51,7 @@ var publicScope = (runtime, request) => {
|
|
|
45
51
|
return inertScope();
|
|
46
52
|
}
|
|
47
53
|
};
|
|
48
|
-
var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers, policy) => {
|
|
54
|
+
var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers, policy, metrics, executionMetrics) => {
|
|
49
55
|
const uninstallRuntime = installRuntime ? installAutomaticExecutionRuntime(runtime) : () => {
|
|
50
56
|
};
|
|
51
57
|
const manifestUpload = scheduleInstrumentationManifestUpload({
|
|
@@ -60,6 +66,8 @@ var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers,
|
|
|
60
66
|
manifestUpload.disconnect();
|
|
61
67
|
const startedAt = Date.now();
|
|
62
68
|
await policy?.close();
|
|
69
|
+
await releaseFunctionMetricsBindings(metrics);
|
|
70
|
+
await releaseExecutionMetricsBindings(executionMetrics);
|
|
63
71
|
await client.close();
|
|
64
72
|
await manifestUpload.wait(Math.max(0, 2e3 - (Date.now() - startedAt)));
|
|
65
73
|
};
|
|
@@ -76,10 +84,14 @@ var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers,
|
|
|
76
84
|
await client.flush(timeoutMs);
|
|
77
85
|
if (timeoutMs === void 0) {
|
|
78
86
|
await policy?.flush();
|
|
87
|
+
await metrics?.exporter.flush();
|
|
88
|
+
await executionMetrics?.exporter.flush();
|
|
79
89
|
await manifestUpload.wait();
|
|
80
90
|
return;
|
|
81
91
|
}
|
|
82
92
|
await policy?.flush(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
93
|
+
await metrics?.exporter.flush(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
94
|
+
await executionMetrics?.exporter.flush(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
83
95
|
await manifestUpload.wait(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
84
96
|
},
|
|
85
97
|
close: shutdown
|
|
@@ -90,6 +102,36 @@ var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers,
|
|
|
90
102
|
var createBoundRuntime = (options, hooks, capture) => {
|
|
91
103
|
const enabled = capture && isClientEnabled(options);
|
|
92
104
|
const recorderEnabled = enabled && options.executionRecorder?.enabled !== false;
|
|
105
|
+
const durationSampling = options.dynamicDurationSampling === true;
|
|
106
|
+
const activation = resolveClientActivation({
|
|
107
|
+
enabled: options.enabled === false || !capture ? false : options.enabled,
|
|
108
|
+
dsn: options.dsn,
|
|
109
|
+
projectApiKey: options.projectApiKey,
|
|
110
|
+
apiUrl: options.apiUrl,
|
|
111
|
+
release: options.release,
|
|
112
|
+
environment: options.environment
|
|
113
|
+
});
|
|
114
|
+
const metrics = activation.enabled ? bindFunctionMetrics({
|
|
115
|
+
options: options.functionMetrics,
|
|
116
|
+
clientEnabled: true,
|
|
117
|
+
environment: activation.environment,
|
|
118
|
+
release: activation.release,
|
|
119
|
+
ingestToken: activation.ingestToken,
|
|
120
|
+
apiUrl: activation.apiUrl,
|
|
121
|
+
fetch: hooks.fetch,
|
|
122
|
+
sampledMeasurementFormat: durationSampling
|
|
123
|
+
}) : void 0;
|
|
124
|
+
const executionMetrics = activation.enabled ? bindExecutionMetrics({
|
|
125
|
+
options: options.executionMetrics,
|
|
126
|
+
clientEnabled: true,
|
|
127
|
+
environment: activation.environment,
|
|
128
|
+
release: activation.release,
|
|
129
|
+
ingestToken: activation.ingestToken,
|
|
130
|
+
apiUrl: activation.apiUrl,
|
|
131
|
+
fetch: hooks.fetch,
|
|
132
|
+
sampledMeasurementFormat: durationSampling
|
|
133
|
+
}) : void 0;
|
|
134
|
+
const durationSampler = durationSampling && (recorderEnabled || Boolean(metrics) || Boolean(executionMetrics)) ? createDynamicDurationSampleBuckets({ nowMs: () => Date.now() }) : void 0;
|
|
93
135
|
const { runtime, policy } = bindAdaptiveRecorder({
|
|
94
136
|
executionRecorder: options.executionRecorder,
|
|
95
137
|
recorderEnabled,
|
|
@@ -102,7 +144,10 @@ var createBoundRuntime = (options, hooks, capture) => {
|
|
|
102
144
|
enabled: options.enabled === false || !capture ? false : options.enabled,
|
|
103
145
|
sdkName: SDK_NAME,
|
|
104
146
|
sdkVersion: SDK_VERSION,
|
|
105
|
-
scrubPII: options.scrubPII
|
|
147
|
+
scrubPII: options.scrubPII,
|
|
148
|
+
functionMetrics: metrics?.collector,
|
|
149
|
+
executionMetrics: executionMetrics?.collector,
|
|
150
|
+
durationSampler
|
|
106
151
|
});
|
|
107
152
|
const client = createClient(
|
|
108
153
|
{ ...options, enabled },
|
|
@@ -121,7 +166,7 @@ var createBoundRuntime = (options, hooks, capture) => {
|
|
|
121
166
|
const bound = bindClient(
|
|
122
167
|
client,
|
|
123
168
|
runtime,
|
|
124
|
-
recorderEnabled,
|
|
169
|
+
recorderEnabled || Boolean(metrics),
|
|
125
170
|
{
|
|
126
171
|
projectApiKey: options.projectApiKey,
|
|
127
172
|
release: options.release,
|
|
@@ -133,7 +178,9 @@ var createBoundRuntime = (options, hooks, capture) => {
|
|
|
133
178
|
logSuccess: options.logSuccess
|
|
134
179
|
},
|
|
135
180
|
() => uninstallHandlers(),
|
|
136
|
-
policy
|
|
181
|
+
policy,
|
|
182
|
+
metrics,
|
|
183
|
+
executionMetrics
|
|
137
184
|
);
|
|
138
185
|
if (enabled && (hooks.installGlobalHandlers ?? options.installGlobalHandlers) === true) {
|
|
139
186
|
uninstallHandlers = installGlobalHandlers(bound.client);
|
package/dist/sdk-meta.d.ts
CHANGED