@mastra/auth-clerk 0.0.0-consolidate-changesets-20250904042643 → 0.0.0-feat-improve-processors-20251205191721

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +65 -2
  2. package/README.md +2 -6
  3. package/dist/index.cjs +24 -316
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +24 -316
  7. package/dist/index.js.map +1 -1
  8. package/package.json +13 -8
  9. package/dist/chunk-32EQK4OY.js +0 -974
  10. package/dist/chunk-32EQK4OY.js.map +0 -1
  11. package/dist/chunk-B2N25K77.cjs +0 -979
  12. package/dist/chunk-B2N25K77.cjs.map +0 -1
  13. package/dist/chunk-G7ML3FDV.js +0 -9
  14. package/dist/chunk-G7ML3FDV.js.map +0 -1
  15. package/dist/chunk-UYPX6MT6.cjs +0 -32
  16. package/dist/chunk-UYPX6MT6.cjs.map +0 -1
  17. package/dist/getMachineId-bsd-G4THBH3V.js +0 -23
  18. package/dist/getMachineId-bsd-G4THBH3V.js.map +0 -1
  19. package/dist/getMachineId-bsd-GQTQCD37.cjs +0 -25
  20. package/dist/getMachineId-bsd-GQTQCD37.cjs.map +0 -1
  21. package/dist/getMachineId-darwin-3P7FJFHV.js +0 -24
  22. package/dist/getMachineId-darwin-3P7FJFHV.js.map +0 -1
  23. package/dist/getMachineId-darwin-43NRSF2D.cjs +0 -26
  24. package/dist/getMachineId-darwin-43NRSF2D.cjs.map +0 -1
  25. package/dist/getMachineId-linux-H4F4I7A5.js +0 -19
  26. package/dist/getMachineId-linux-H4F4I7A5.js.map +0 -1
  27. package/dist/getMachineId-linux-TZ3NOAZ5.cjs +0 -21
  28. package/dist/getMachineId-linux-TZ3NOAZ5.cjs.map +0 -1
  29. package/dist/getMachineId-unsupported-EZLLFFYA.cjs +0 -13
  30. package/dist/getMachineId-unsupported-EZLLFFYA.cjs.map +0 -1
  31. package/dist/getMachineId-unsupported-T3AERO5R.js +0 -11
  32. package/dist/getMachineId-unsupported-T3AERO5R.js.map +0 -1
  33. package/dist/getMachineId-win-B5AEGZT7.cjs +0 -47
  34. package/dist/getMachineId-win-B5AEGZT7.cjs.map +0 -1
  35. package/dist/getMachineId-win-Z5QAASBF.js +0 -25
  36. package/dist/getMachineId-win-Z5QAASBF.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,75 @@
1
1
  # @mastra/auth-clerk
2
2
 
3
- ## 0.0.0-consolidate-changesets-20250904042643
3
+ ## 0.0.0-feat-improve-processors-20251205191721
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-feat-improve-processors-20251205191721
23
+
24
+ ## 1.0.0-beta.1
25
+
26
+ ### Patch Changes
27
+
28
+ - Allow provider to pass through options to the auth config ([#10284](https://github.com/mastra-ai/mastra/pull/10284))
29
+
30
+ - Updated dependencies [[`a0a5b4b`](https://github.com/mastra-ai/mastra/commit/a0a5b4bbebe6c701ebbadf744873aa0d5ca01371)]:
31
+ - @mastra/auth@1.0.0-beta.1
32
+
33
+ ## 1.0.0-beta.0
34
+
35
+ ### Major Changes
36
+
37
+ - Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
38
+
39
+ - Experimental auth -> auth ([#9660](https://github.com/mastra-ai/mastra/pull/9660))
40
+
41
+ - Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [[`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc)]:
46
+ - @mastra/auth@1.0.0-beta.0
47
+
48
+ ## 0.10.5
49
+
50
+ ### Patch Changes
51
+
52
+ - Update package.json and README ([#7886](https://github.com/mastra-ai/mastra/pull/7886))
53
+
54
+ - Updated dependencies []:
55
+ - @mastra/auth@0.1.3
56
+
57
+ ## 0.10.5-alpha.0
58
+
59
+ ### Patch Changes
60
+
61
+ - Update package.json and README ([#7886](https://github.com/mastra-ai/mastra/pull/7886))
62
+
63
+ - Updated dependencies []:
64
+ - @mastra/auth@0.1.3
65
+
66
+ ## 0.10.4
4
67
 
5
68
  ### Patch Changes
6
69
 
7
70
  - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
8
71
  - Updated dependencies [de3cbc6]
9
- - @mastra/auth@0.0.0-consolidate-changesets-20250904042643
72
+ - @mastra/auth@0.1.3
10
73
 
11
74
  ## 0.10.4-alpha.0
12
75
 
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
- experimental_auth: clerkAuth,
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
- // ../../packages/core/dist/chunk-R7K2QO7M.js
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-X3GXU6TZ.js
8
+ // ../../packages/core/dist/chunk-KJ2SW6VA.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 getLogs(transportId, params) {
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).getLogs(params) ?? {
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 getLogsByRunId({
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).getLogsByRunId({ runId, fromDate, toDate, logLevel, filters, page, perPage }) ?? {
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.debug(message, ...args);
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.warn(message, ...args);
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 getLogs(_transportId, _params) {
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 getLogsByRunId(_args) {
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-6GF5M4GX.js
96
+ // ../../packages/core/dist/chunk-S6URFGCZ.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 _MastraAuthProvider_decorators;
400
- var _init;
401
- var _a;
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
- if (!user.sub) {
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