@mastra/auth-clerk 0.0.0-consolidate-changesets-20250904042643 → 0.0.0-elated-armadillo-be37a1-20251219210627
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/CHANGELOG.md +76 -2
- package/README.md +2 -6
- package/dist/index.cjs +24 -316
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -316
- package/dist/index.js.map +1 -1
- package/package.json +13 -8
- package/dist/chunk-32EQK4OY.js +0 -974
- package/dist/chunk-32EQK4OY.js.map +0 -1
- package/dist/chunk-B2N25K77.cjs +0 -979
- package/dist/chunk-B2N25K77.cjs.map +0 -1
- package/dist/chunk-G7ML3FDV.js +0 -9
- package/dist/chunk-G7ML3FDV.js.map +0 -1
- package/dist/chunk-UYPX6MT6.cjs +0 -32
- package/dist/chunk-UYPX6MT6.cjs.map +0 -1
- package/dist/getMachineId-bsd-G4THBH3V.js +0 -23
- package/dist/getMachineId-bsd-G4THBH3V.js.map +0 -1
- package/dist/getMachineId-bsd-GQTQCD37.cjs +0 -25
- package/dist/getMachineId-bsd-GQTQCD37.cjs.map +0 -1
- package/dist/getMachineId-darwin-3P7FJFHV.js +0 -24
- package/dist/getMachineId-darwin-3P7FJFHV.js.map +0 -1
- package/dist/getMachineId-darwin-43NRSF2D.cjs +0 -26
- package/dist/getMachineId-darwin-43NRSF2D.cjs.map +0 -1
- package/dist/getMachineId-linux-H4F4I7A5.js +0 -19
- package/dist/getMachineId-linux-H4F4I7A5.js.map +0 -1
- package/dist/getMachineId-linux-TZ3NOAZ5.cjs +0 -21
- package/dist/getMachineId-linux-TZ3NOAZ5.cjs.map +0 -1
- package/dist/getMachineId-unsupported-EZLLFFYA.cjs +0 -13
- package/dist/getMachineId-unsupported-EZLLFFYA.cjs.map +0 -1
- package/dist/getMachineId-unsupported-T3AERO5R.js +0 -11
- package/dist/getMachineId-unsupported-T3AERO5R.js.map +0 -1
- package/dist/getMachineId-win-B5AEGZT7.cjs +0 -47
- package/dist/getMachineId-win-B5AEGZT7.cjs.map +0 -1
- package/dist/getMachineId-win-Z5QAASBF.js +0 -25
- package/dist/getMachineId-win-Z5QAASBF.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,86 @@
|
|
|
1
1
|
# @mastra/auth-clerk
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-elated-armadillo-be37a1-20251219210627
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
8
|
+
|
|
9
|
+
- Experimental auth -> auth ([#9660](https://github.com/mastra-ai/mastra/pull/9660))
|
|
10
|
+
|
|
11
|
+
- Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- remove organization requirement from default authorization ([#10551](https://github.com/mastra-ai/mastra/pull/10551))
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Allow provider to pass through options to the auth config ([#10284](https://github.com/mastra-ai/mastra/pull/10284))
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`a0a5b4b`](https://github.com/mastra-ai/mastra/commit/a0a5b4bbebe6c701ebbadf744873aa0d5ca01371), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc)]:
|
|
22
|
+
- @mastra/auth@0.0.0-elated-armadillo-be37a1-20251219210627
|
|
23
|
+
|
|
24
|
+
## 1.0.0-beta.2
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- remove organization requirement from default authorization ([#10551](https://github.com/mastra-ai/mastra/pull/10551))
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies:
|
|
33
|
+
- @mastra/auth@1.0.0-beta.1
|
|
34
|
+
|
|
35
|
+
## 1.0.0-beta.1
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Allow provider to pass through options to the auth config ([#10284](https://github.com/mastra-ai/mastra/pull/10284))
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [[`a0a5b4b`](https://github.com/mastra-ai/mastra/commit/a0a5b4bbebe6c701ebbadf744873aa0d5ca01371)]:
|
|
42
|
+
- @mastra/auth@1.0.0-beta.1
|
|
43
|
+
|
|
44
|
+
## 1.0.0-beta.0
|
|
45
|
+
|
|
46
|
+
### Major Changes
|
|
47
|
+
|
|
48
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
49
|
+
|
|
50
|
+
- Experimental auth -> auth ([#9660](https://github.com/mastra-ai/mastra/pull/9660))
|
|
51
|
+
|
|
52
|
+
- Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [[`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc)]:
|
|
57
|
+
- @mastra/auth@1.0.0-beta.0
|
|
58
|
+
|
|
59
|
+
## 0.10.5
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Update package.json and README ([#7886](https://github.com/mastra-ai/mastra/pull/7886))
|
|
64
|
+
|
|
65
|
+
- Updated dependencies []:
|
|
66
|
+
- @mastra/auth@0.1.3
|
|
67
|
+
|
|
68
|
+
## 0.10.5-alpha.0
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Update package.json and README ([#7886](https://github.com/mastra-ai/mastra/pull/7886))
|
|
73
|
+
|
|
74
|
+
- Updated dependencies []:
|
|
75
|
+
- @mastra/auth@0.1.3
|
|
76
|
+
|
|
77
|
+
## 0.10.4
|
|
4
78
|
|
|
5
79
|
### Patch Changes
|
|
6
80
|
|
|
7
81
|
- de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
|
|
8
82
|
- Updated dependencies [de3cbc6]
|
|
9
|
-
- @mastra/auth@0.
|
|
83
|
+
- @mastra/auth@0.1.3
|
|
10
84
|
|
|
11
85
|
## 0.10.4-alpha.0
|
|
12
86
|
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ pnpm add @mastra/auth-clerk
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import { Mastra } from '@mastra/core';
|
|
18
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
19
19
|
import { MastraAuthClerk } from '@mastra/auth-clerk';
|
|
20
20
|
|
|
21
21
|
// Initialize the Clerk auth provider
|
|
@@ -32,7 +32,7 @@ const clerkAuth = new MastraAuthClerk();
|
|
|
32
32
|
const mastra = new Mastra({
|
|
33
33
|
...
|
|
34
34
|
server: {
|
|
35
|
-
|
|
35
|
+
auth: clerkAuth,
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
```
|
|
@@ -73,7 +73,3 @@ Verifies a JWT token and returns the associated user if valid.
|
|
|
73
73
|
### `authorizeUser(user: ClerkUser): Promise<boolean>`
|
|
74
74
|
|
|
75
75
|
Checks if a user is authorized by verifying their organization membership.
|
|
76
|
-
|
|
77
|
-
## License
|
|
78
|
-
|
|
79
|
-
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -1,217 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkB2N25K77_cjs = require('./chunk-B2N25K77.cjs');
|
|
4
3
|
var backend = require('@clerk/backend');
|
|
5
4
|
var auth = require('@mastra/auth');
|
|
6
5
|
|
|
7
|
-
//
|
|
8
|
-
function hasActiveTelemetry(tracerName = "default-tracer") {
|
|
9
|
-
try {
|
|
10
|
-
return !!chunkB2N25K77_cjs.trace.getTracer(tracerName);
|
|
11
|
-
} catch {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function getBaggageValues(ctx) {
|
|
16
|
-
const currentBaggage = chunkB2N25K77_cjs.propagation.getBaggage(ctx);
|
|
17
|
-
const requestId = currentBaggage?.getEntry("http.request_id")?.value;
|
|
18
|
-
const componentName = currentBaggage?.getEntry("componentName")?.value;
|
|
19
|
-
const runId = currentBaggage?.getEntry("runId")?.value;
|
|
20
|
-
const threadId = currentBaggage?.getEntry("threadId")?.value;
|
|
21
|
-
const resourceId = currentBaggage?.getEntry("resourceId")?.value;
|
|
22
|
-
return {
|
|
23
|
-
requestId,
|
|
24
|
-
componentName,
|
|
25
|
-
runId,
|
|
26
|
-
threadId,
|
|
27
|
-
resourceId
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function isStreamingResult(result, methodName) {
|
|
31
|
-
if (methodName === "stream" || methodName === "streamVNext") {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
if (result && typeof result === "object" && result !== null) {
|
|
35
|
-
const obj = result;
|
|
36
|
-
return "textStream" in obj || "objectStream" in obj || "usagePromise" in obj || "finishReasonPromise" in obj;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
function enhanceStreamingArgumentsWithTelemetry(args, span, spanName, methodName) {
|
|
41
|
-
if (methodName === "stream" || methodName === "streamVNext") {
|
|
42
|
-
const enhancedArgs = [...args];
|
|
43
|
-
const streamOptions = enhancedArgs.length > 1 && enhancedArgs[1] || {};
|
|
44
|
-
const enhancedStreamOptions = { ...streamOptions };
|
|
45
|
-
const originalOnFinish = enhancedStreamOptions.onFinish;
|
|
46
|
-
enhancedStreamOptions.onFinish = async (finishData) => {
|
|
47
|
-
try {
|
|
48
|
-
const telemetryData = {
|
|
49
|
-
text: finishData.text,
|
|
50
|
-
usage: finishData.usage,
|
|
51
|
-
finishReason: finishData.finishReason,
|
|
52
|
-
toolCalls: finishData.toolCalls,
|
|
53
|
-
toolResults: finishData.toolResults,
|
|
54
|
-
warnings: finishData.warnings,
|
|
55
|
-
...finishData.object !== void 0 && { object: finishData.object }
|
|
56
|
-
};
|
|
57
|
-
span.setAttribute(`${spanName}.result`, JSON.stringify(telemetryData));
|
|
58
|
-
span.setStatus({ code: chunkB2N25K77_cjs.SpanStatusCode.OK });
|
|
59
|
-
span.end();
|
|
60
|
-
} catch (error) {
|
|
61
|
-
debugger;
|
|
62
|
-
console.warn("Telemetry capture failed:", error);
|
|
63
|
-
span.setAttribute(`${spanName}.result`, "[Telemetry Capture Error]");
|
|
64
|
-
span.setStatus({ code: chunkB2N25K77_cjs.SpanStatusCode.ERROR });
|
|
65
|
-
span.end();
|
|
66
|
-
}
|
|
67
|
-
if (originalOnFinish) {
|
|
68
|
-
return await originalOnFinish(finishData);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
enhancedStreamOptions.onFinish.__hasOriginalOnFinish = !!originalOnFinish;
|
|
72
|
-
enhancedArgs[1] = enhancedStreamOptions;
|
|
73
|
-
span.__mastraStreamingSpan = true;
|
|
74
|
-
return enhancedArgs;
|
|
75
|
-
}
|
|
76
|
-
return args;
|
|
77
|
-
}
|
|
78
|
-
function withSpan(options) {
|
|
79
|
-
return function(_target, propertyKey, descriptor) {
|
|
80
|
-
if (!descriptor || typeof descriptor === "number") return;
|
|
81
|
-
const originalMethod = descriptor.value;
|
|
82
|
-
const methodName = String(propertyKey);
|
|
83
|
-
descriptor.value = function(...args) {
|
|
84
|
-
if (options?.skipIfNoTelemetry && !hasActiveTelemetry(options?.tracerName)) {
|
|
85
|
-
return originalMethod.apply(this, args);
|
|
86
|
-
}
|
|
87
|
-
const tracer = chunkB2N25K77_cjs.trace.getTracer(options?.tracerName ?? "default-tracer");
|
|
88
|
-
let spanName;
|
|
89
|
-
let spanKind;
|
|
90
|
-
if (typeof options === "string") {
|
|
91
|
-
spanName = options;
|
|
92
|
-
} else if (options) {
|
|
93
|
-
spanName = options.spanName || methodName;
|
|
94
|
-
spanKind = options.spanKind;
|
|
95
|
-
} else {
|
|
96
|
-
spanName = methodName;
|
|
97
|
-
}
|
|
98
|
-
const span = tracer.startSpan(spanName, { kind: spanKind });
|
|
99
|
-
let ctx = chunkB2N25K77_cjs.trace.setSpan(chunkB2N25K77_cjs.context.active(), span);
|
|
100
|
-
args.forEach((arg, index) => {
|
|
101
|
-
try {
|
|
102
|
-
span.setAttribute(`${spanName}.argument.${index}`, JSON.stringify(arg));
|
|
103
|
-
} catch {
|
|
104
|
-
span.setAttribute(`${spanName}.argument.${index}`, "[Not Serializable]");
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
const { requestId, componentName, runId, threadId, resourceId } = getBaggageValues(ctx);
|
|
108
|
-
if (requestId) {
|
|
109
|
-
span.setAttribute("http.request_id", requestId);
|
|
110
|
-
}
|
|
111
|
-
if (threadId) {
|
|
112
|
-
span.setAttribute("threadId", threadId);
|
|
113
|
-
}
|
|
114
|
-
if (resourceId) {
|
|
115
|
-
span.setAttribute("resourceId", resourceId);
|
|
116
|
-
}
|
|
117
|
-
if (componentName) {
|
|
118
|
-
span.setAttribute("componentName", componentName);
|
|
119
|
-
span.setAttribute("runId", runId);
|
|
120
|
-
} else if (this && typeof this === "object" && "name" in this) {
|
|
121
|
-
const contextObj = this;
|
|
122
|
-
span.setAttribute("componentName", contextObj.name);
|
|
123
|
-
if (contextObj.runId) {
|
|
124
|
-
span.setAttribute("runId", contextObj.runId);
|
|
125
|
-
}
|
|
126
|
-
ctx = chunkB2N25K77_cjs.propagation.setBaggage(
|
|
127
|
-
ctx,
|
|
128
|
-
chunkB2N25K77_cjs.propagation.createBaggage({
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
componentName: { value: this.name },
|
|
131
|
-
// @ts-ignore
|
|
132
|
-
runId: { value: this.runId },
|
|
133
|
-
// @ts-ignore
|
|
134
|
-
"http.request_id": { value: requestId },
|
|
135
|
-
// @ts-ignore
|
|
136
|
-
threadId: { value: threadId },
|
|
137
|
-
// @ts-ignore
|
|
138
|
-
resourceId: { value: resourceId }
|
|
139
|
-
})
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
let result;
|
|
143
|
-
try {
|
|
144
|
-
const enhancedArgs = isStreamingResult(result, methodName) ? enhanceStreamingArgumentsWithTelemetry(args, span, spanName, methodName) : args;
|
|
145
|
-
result = chunkB2N25K77_cjs.context.with(ctx, () => originalMethod.apply(this, enhancedArgs));
|
|
146
|
-
if (result instanceof Promise) {
|
|
147
|
-
return result.then((resolvedValue) => {
|
|
148
|
-
if (isStreamingResult(resolvedValue, methodName)) {
|
|
149
|
-
return resolvedValue;
|
|
150
|
-
} else {
|
|
151
|
-
try {
|
|
152
|
-
span.setAttribute(`${spanName}.result`, JSON.stringify(resolvedValue));
|
|
153
|
-
} catch {
|
|
154
|
-
span.setAttribute(`${spanName}.result`, "[Not Serializable]");
|
|
155
|
-
}
|
|
156
|
-
return resolvedValue;
|
|
157
|
-
}
|
|
158
|
-
}).finally(() => {
|
|
159
|
-
if (!span.__mastraStreamingSpan) {
|
|
160
|
-
span.end();
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
if (!isStreamingResult(result, methodName)) {
|
|
165
|
-
try {
|
|
166
|
-
span.setAttribute(`${spanName}.result`, JSON.stringify(result));
|
|
167
|
-
} catch {
|
|
168
|
-
span.setAttribute(`${spanName}.result`, "[Not Serializable]");
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return result;
|
|
172
|
-
} catch (error) {
|
|
173
|
-
span.setStatus({
|
|
174
|
-
code: chunkB2N25K77_cjs.SpanStatusCode.ERROR,
|
|
175
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
176
|
-
});
|
|
177
|
-
if (error instanceof Error) {
|
|
178
|
-
span.recordException(error);
|
|
179
|
-
}
|
|
180
|
-
throw error;
|
|
181
|
-
} finally {
|
|
182
|
-
if (!(result instanceof Promise) && !isStreamingResult(result, methodName)) {
|
|
183
|
-
span.end();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
return descriptor;
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function InstrumentClass(options) {
|
|
191
|
-
return function(target) {
|
|
192
|
-
const methods = Object.getOwnPropertyNames(target.prototype);
|
|
193
|
-
methods.forEach((method) => {
|
|
194
|
-
if (options?.excludeMethods?.includes(method) || method === "constructor") return;
|
|
195
|
-
if (options?.methodFilter && !options.methodFilter(method)) return;
|
|
196
|
-
const descriptor = Object.getOwnPropertyDescriptor(target.prototype, method);
|
|
197
|
-
if (descriptor && typeof descriptor.value === "function") {
|
|
198
|
-
Object.defineProperty(
|
|
199
|
-
target.prototype,
|
|
200
|
-
method,
|
|
201
|
-
withSpan({
|
|
202
|
-
spanName: options?.prefix ? `${options.prefix}.${method}` : method,
|
|
203
|
-
skipIfNoTelemetry: true,
|
|
204
|
-
spanKind: options?.spanKind || chunkB2N25K77_cjs.SpanKind.INTERNAL,
|
|
205
|
-
tracerName: options?.tracerName
|
|
206
|
-
})(target, method, descriptor)
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
return target;
|
|
211
|
-
};
|
|
212
|
-
}
|
|
6
|
+
// src/index.ts
|
|
213
7
|
|
|
214
|
-
// ../../packages/core/dist/chunk-
|
|
8
|
+
// ../../packages/core/dist/chunk-NRUZYMHE.js
|
|
215
9
|
var RegisteredLogger = {
|
|
216
10
|
LLM: "LLM"};
|
|
217
11
|
var LogLevel = {
|
|
@@ -233,11 +27,11 @@ var MastraLogger = class {
|
|
|
233
27
|
}
|
|
234
28
|
trackException(_error) {
|
|
235
29
|
}
|
|
236
|
-
async
|
|
30
|
+
async listLogs(transportId, params) {
|
|
237
31
|
if (!transportId || !this.transports.has(transportId)) {
|
|
238
32
|
return { logs: [], total: 0, page: params?.page ?? 1, perPage: params?.perPage ?? 100, hasMore: false };
|
|
239
33
|
}
|
|
240
|
-
return this.transports.get(transportId).
|
|
34
|
+
return this.transports.get(transportId).listLogs(params) ?? {
|
|
241
35
|
logs: [],
|
|
242
36
|
total: 0,
|
|
243
37
|
page: params?.page ?? 1,
|
|
@@ -245,7 +39,7 @@ var MastraLogger = class {
|
|
|
245
39
|
hasMore: false
|
|
246
40
|
};
|
|
247
41
|
}
|
|
248
|
-
async
|
|
42
|
+
async listLogsByRunId({
|
|
249
43
|
transportId,
|
|
250
44
|
runId,
|
|
251
45
|
fromDate,
|
|
@@ -258,7 +52,7 @@ var MastraLogger = class {
|
|
|
258
52
|
if (!transportId || !this.transports.has(transportId) || !runId) {
|
|
259
53
|
return { logs: [], total: 0, page: page ?? 1, perPage: perPage ?? 100, hasMore: false };
|
|
260
54
|
}
|
|
261
|
-
return this.transports.get(transportId).
|
|
55
|
+
return this.transports.get(transportId).listLogsByRunId({ runId, fromDate, toDate, logLevel, filters, page, perPage }) ?? {
|
|
262
56
|
logs: [],
|
|
263
57
|
total: 0,
|
|
264
58
|
page: page ?? 1,
|
|
@@ -273,7 +67,7 @@ var ConsoleLogger = class extends MastraLogger {
|
|
|
273
67
|
}
|
|
274
68
|
debug(message, ...args) {
|
|
275
69
|
if (this.level === LogLevel.DEBUG) {
|
|
276
|
-
console.
|
|
70
|
+
console.info(message, ...args);
|
|
277
71
|
}
|
|
278
72
|
}
|
|
279
73
|
info(message, ...args) {
|
|
@@ -283,7 +77,7 @@ var ConsoleLogger = class extends MastraLogger {
|
|
|
283
77
|
}
|
|
284
78
|
warn(message, ...args) {
|
|
285
79
|
if (this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) {
|
|
286
|
-
console.
|
|
80
|
+
console.info(message, ...args);
|
|
287
81
|
}
|
|
288
82
|
}
|
|
289
83
|
error(message, ...args) {
|
|
@@ -291,20 +85,19 @@ var ConsoleLogger = class extends MastraLogger {
|
|
|
291
85
|
console.error(message, ...args);
|
|
292
86
|
}
|
|
293
87
|
}
|
|
294
|
-
async
|
|
88
|
+
async listLogs(_transportId, _params) {
|
|
295
89
|
return { logs: [], total: 0, page: _params?.page ?? 1, perPage: _params?.perPage ?? 100, hasMore: false };
|
|
296
90
|
}
|
|
297
|
-
async
|
|
91
|
+
async listLogsByRunId(_args) {
|
|
298
92
|
return { logs: [], total: 0, page: _args.page ?? 1, perPage: _args.perPage ?? 100, hasMore: false };
|
|
299
93
|
}
|
|
300
94
|
};
|
|
301
95
|
|
|
302
|
-
// ../../packages/core/dist/chunk-
|
|
96
|
+
// ../../packages/core/dist/chunk-LSHPJWM5.js
|
|
303
97
|
var MastraBase = class {
|
|
304
98
|
component = RegisteredLogger.LLM;
|
|
305
99
|
logger;
|
|
306
100
|
name;
|
|
307
|
-
telemetry;
|
|
308
101
|
constructor({ component, name }) {
|
|
309
102
|
this.component = component || RegisteredLogger.LLM;
|
|
310
103
|
this.name = name;
|
|
@@ -320,111 +113,32 @@ var MastraBase = class {
|
|
|
320
113
|
this.logger.debug(`Logger updated [component=${this.component}] [name=${this.name}]`);
|
|
321
114
|
}
|
|
322
115
|
}
|
|
323
|
-
/**
|
|
324
|
-
* Set the telemetry for the
|
|
325
|
-
* @param telemetry
|
|
326
|
-
*/
|
|
327
|
-
__setTelemetry(telemetry) {
|
|
328
|
-
this.telemetry = telemetry;
|
|
329
|
-
if (this.component !== RegisteredLogger.LLM) {
|
|
330
|
-
this.logger.debug(`Telemetry updated [component=${this.component}] [name=${this.telemetry.name}]`);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Get the telemetry on the vector
|
|
335
|
-
* @returns telemetry
|
|
336
|
-
*/
|
|
337
|
-
__getTelemetry() {
|
|
338
|
-
return this.telemetry;
|
|
339
|
-
}
|
|
340
|
-
/*
|
|
341
|
-
get experimental_telemetry config
|
|
342
|
-
*/
|
|
343
|
-
get experimental_telemetry() {
|
|
344
|
-
return this.telemetry ? {
|
|
345
|
-
// tracer: this.telemetry.tracer,
|
|
346
|
-
tracer: this.telemetry.getBaggageTracer(),
|
|
347
|
-
isEnabled: !!this.telemetry.tracer
|
|
348
|
-
} : void 0;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
// ../../packages/core/dist/chunk-3HXBPDKN.js
|
|
353
|
-
var __create = Object.create;
|
|
354
|
-
var __defProp = Object.defineProperty;
|
|
355
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
356
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
357
|
-
var __typeError = (msg) => {
|
|
358
|
-
throw TypeError(msg);
|
|
359
|
-
};
|
|
360
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
361
|
-
enumerable: true,
|
|
362
|
-
configurable: true,
|
|
363
|
-
writable: true,
|
|
364
|
-
value
|
|
365
|
-
}) : obj[key] = value;
|
|
366
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
367
|
-
value,
|
|
368
|
-
configurable: true
|
|
369
|
-
});
|
|
370
|
-
var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
|
|
371
|
-
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
372
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
373
|
-
var __decoratorContext = (kind, name, done, metadata, fns) => ({
|
|
374
|
-
kind: __decoratorStrings[kind],
|
|
375
|
-
name,
|
|
376
|
-
metadata,
|
|
377
|
-
addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null))
|
|
378
|
-
});
|
|
379
|
-
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
380
|
-
var __runInitializers = (array, flags, self, value) => {
|
|
381
|
-
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) fns[i].call(self) ;
|
|
382
|
-
return value;
|
|
383
|
-
};
|
|
384
|
-
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
385
|
-
var it, done, ctx, k = flags & 7, p = false;
|
|
386
|
-
var j = 0;
|
|
387
|
-
var extraInitializers = array[j] || (array[j] = []);
|
|
388
|
-
var desc = k && ((target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(target , name));
|
|
389
|
-
__name(target, name);
|
|
390
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
391
|
-
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
392
|
-
it = (0, decorators[i])(target, ctx), done._ = 1;
|
|
393
|
-
__expectFn(it) && (target = it);
|
|
394
|
-
}
|
|
395
|
-
return __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
396
116
|
};
|
|
397
117
|
|
|
398
118
|
// ../../packages/core/dist/server/index.js
|
|
399
|
-
var
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
_MastraAuthProvider_decorators = [InstrumentClass({
|
|
403
|
-
prefix: "auth",
|
|
404
|
-
excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
|
|
405
|
-
})];
|
|
406
|
-
var MastraAuthProvider = class extends (_a = MastraBase) {
|
|
119
|
+
var MastraAuthProvider = class extends MastraBase {
|
|
120
|
+
protected;
|
|
121
|
+
public;
|
|
407
122
|
constructor(options) {
|
|
408
|
-
super({
|
|
409
|
-
component: "AUTH",
|
|
410
|
-
name: options?.name
|
|
411
|
-
});
|
|
123
|
+
super({ component: "AUTH", name: options?.name });
|
|
412
124
|
if (options?.authorizeUser) {
|
|
413
125
|
this.authorizeUser = options.authorizeUser.bind(this);
|
|
414
126
|
}
|
|
127
|
+
this.protected = options?.protected;
|
|
128
|
+
this.public = options?.public;
|
|
415
129
|
}
|
|
416
130
|
registerOptions(opts) {
|
|
417
131
|
if (opts?.authorizeUser) {
|
|
418
132
|
this.authorizeUser = opts.authorizeUser.bind(this);
|
|
419
133
|
}
|
|
134
|
+
if (opts?.protected) {
|
|
135
|
+
this.protected = opts.protected;
|
|
136
|
+
}
|
|
137
|
+
if (opts?.public) {
|
|
138
|
+
this.public = opts.public;
|
|
139
|
+
}
|
|
420
140
|
}
|
|
421
141
|
};
|
|
422
|
-
MastraAuthProvider = /* @__PURE__ */ ((_) => {
|
|
423
|
-
_init = __decoratorStart(_a);
|
|
424
|
-
MastraAuthProvider = __decorateElement(_init, 0, "MastraAuthProvider", _MastraAuthProvider_decorators, MastraAuthProvider);
|
|
425
|
-
__runInitializers(_init, 1, MastraAuthProvider);
|
|
426
|
-
return MastraAuthProvider;
|
|
427
|
-
})();
|
|
428
142
|
|
|
429
143
|
// src/index.ts
|
|
430
144
|
var MastraAuthClerk = class extends MastraAuthProvider {
|
|
@@ -452,13 +166,7 @@ var MastraAuthClerk = class extends MastraAuthProvider {
|
|
|
452
166
|
return user;
|
|
453
167
|
}
|
|
454
168
|
async authorizeUser(user) {
|
|
455
|
-
|
|
456
|
-
return false;
|
|
457
|
-
}
|
|
458
|
-
const orgs = await this.clerk.users.getOrganizationMembershipList({
|
|
459
|
-
userId: user.sub
|
|
460
|
-
});
|
|
461
|
-
return orgs.data.length > 0;
|
|
169
|
+
return !!user.sub;
|
|
462
170
|
}
|
|
463
171
|
};
|
|
464
172
|
|