@mastra/auth-okta 0.2.1 → 0.2.2-alpha.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/_types/@internal_auth/dist/_types/@internal_core/dist/base/index.d.ts +1 -1
- package/dist/_types/@internal_auth/dist/_types/@internal_core/dist/index-Biaf3BmX.d.ts +319 -0
- package/dist/_types/@internal_auth/dist/ee/interfaces/permissions.generated.d.ts +220 -220
- package/dist/auth-provider.d.ts.map +1 -1
- package/dist/index.cjs +89 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +89 -5
- package/dist/index.js.map +1 -1
- package/dist/rbac-provider.d.ts.map +1 -1
- package/package.json +6 -7
- package/CHANGELOG.md +0 -221
- package/dist/_types/@internal_auth/dist/_types/@internal_core/dist/index-S1lgaKO7.d.ts +0 -218
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-provider.d.ts","sourceRoot":"","sources":["../src/auth-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,iBAAiB,EACjB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAoFlE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cACX,SAAQ,kBAAkB,CAAC,QAAQ,CACnC,YAAW,YAAY,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC;IAErF,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,M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GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAejF;IAED;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAExC;IAED;;OAEG;IACH,oBAAoB,IAAI,cAAc,CAKrC;IAMK,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CASxF;IAEK,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAEjE;IAEK,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtD;IAEK,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAEhE;IAED,uBAAuB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAExD;IAED,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE3D;IAED,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAI/C;IAED;;OAEG;IACH,OAAO,CAAC,WAAW;IASnB;;OAEG;IACH,SAAS,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,WAAW,IAAI,MAAM,CAEpB;IAED;;OAEG;IACH,cAAc,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,SAAS,IAAI,MAAM,CAElB;CACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -337,6 +337,46 @@ function getRequestHeader(request, name) {
|
|
|
337
337
|
}
|
|
338
338
|
//#endregion
|
|
339
339
|
//#region ../../packages/_internal-core/dist/logger/index.js
|
|
340
|
+
/**
|
|
341
|
+
* Export a tracked exception through the adapter sink, mirroring the
|
|
342
|
+
* DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`
|
|
343
|
+
* when present on a MastraError-like value). Never throws into the caller.
|
|
344
|
+
*/
|
|
345
|
+
function exportTrackedException(ctx, error, metadata) {
|
|
346
|
+
if (!ctx?.options.export) return;
|
|
347
|
+
try {
|
|
348
|
+
const mastraError = error;
|
|
349
|
+
ctx.getLogSink()?.error(error.message, {
|
|
350
|
+
...mastraError.id !== void 0 ? { errorId: mastraError.id } : {},
|
|
351
|
+
...mastraError.domain !== void 0 ? { domain: mastraError.domain } : {},
|
|
352
|
+
...mastraError.category !== void 0 ? { category: mastraError.category } : {},
|
|
353
|
+
...mastraError.details !== void 0 ? { details: mastraError.details } : {},
|
|
354
|
+
...error.cause instanceof Error ? { cause: error.cause.message } : {},
|
|
355
|
+
...metadata
|
|
356
|
+
});
|
|
357
|
+
} catch {}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Adapt IMastraLogger's variadic args into the structured `data` payload of
|
|
361
|
+
* an exported log record. Extracts the first plain object as data,
|
|
362
|
+
* serializes an Error arg, and collects remaining primitives under `args`
|
|
363
|
+
* so the derived record preserves all context from the native call.
|
|
364
|
+
*/
|
|
365
|
+
function buildLogRecordData(args) {
|
|
366
|
+
const objectData = args.find((arg) => arg !== null && typeof arg === "object" && !Array.isArray(arg) && !(arg instanceof Error));
|
|
367
|
+
const errorArg = args.find((arg) => arg instanceof Error);
|
|
368
|
+
const extraArgs = args.filter((arg) => arg !== objectData && arg !== errorArg);
|
|
369
|
+
if (!objectData && !errorArg && extraArgs.length === 0) return void 0;
|
|
370
|
+
return {
|
|
371
|
+
...objectData ?? {},
|
|
372
|
+
...errorArg ? { error: {
|
|
373
|
+
name: errorArg.name,
|
|
374
|
+
message: errorArg.message,
|
|
375
|
+
stack: errorArg.stack
|
|
376
|
+
} } : {},
|
|
377
|
+
...extraArgs.length > 0 ? { args: extraArgs } : {}
|
|
378
|
+
};
|
|
379
|
+
}
|
|
340
380
|
const RegisteredLogger = {
|
|
341
381
|
AGENT: "AGENT",
|
|
342
382
|
OBSERVABILITY: "OBSERVABILITY",
|
|
@@ -423,19 +463,56 @@ var MastraLogger = class {
|
|
|
423
463
|
var ConsoleLogger = class ConsoleLogger extends MastraLogger {
|
|
424
464
|
component;
|
|
425
465
|
filter;
|
|
466
|
+
#adapterContext;
|
|
426
467
|
constructor(options = {}) {
|
|
427
468
|
super(options);
|
|
428
469
|
this.component = options.component;
|
|
429
470
|
this.filter = options.filter;
|
|
430
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Adapter hook (see `AdaptableLogger`): enables native trace correlation
|
|
474
|
+
* (trace_id/span_id appended to console output) and observability export
|
|
475
|
+
* derived from the same record. Called by Mastra during setup.
|
|
476
|
+
*/
|
|
477
|
+
__attachObservability(ctx) {
|
|
478
|
+
this.#adapterContext = ctx;
|
|
479
|
+
}
|
|
431
480
|
child(componentOrBindings) {
|
|
432
481
|
const component = typeof componentOrBindings === "string" ? componentOrBindings : componentOrBindings?.component ?? this.component;
|
|
433
|
-
|
|
482
|
+
const child = new ConsoleLogger({
|
|
434
483
|
name: this.name,
|
|
435
484
|
level: this.level,
|
|
436
485
|
component,
|
|
437
486
|
filter: this.filter
|
|
438
487
|
});
|
|
488
|
+
if (this.#adapterContext) child.__attachObservability(this.#adapterContext);
|
|
489
|
+
return child;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Native-record correlation: when a span is active, append the trace
|
|
493
|
+
* fields object to the console args so every destination sees them.
|
|
494
|
+
*/
|
|
495
|
+
#correlate(args) {
|
|
496
|
+
const ctx = this.#adapterContext;
|
|
497
|
+
if (!ctx?.options.correlation) return args;
|
|
498
|
+
try {
|
|
499
|
+
const fields = ctx.resolveTraceFields();
|
|
500
|
+
return fields ? [...args, fields] : args;
|
|
501
|
+
} catch {
|
|
502
|
+
return args;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Export the record derived from the same native call to observability.
|
|
507
|
+
* Mirrors DualLogger semantics: export is independent of the console
|
|
508
|
+
* level filter, and never throws into the caller.
|
|
509
|
+
*/
|
|
510
|
+
#export(level, message, args) {
|
|
511
|
+
const ctx = this.#adapterContext;
|
|
512
|
+
if (!ctx?.options.export) return;
|
|
513
|
+
try {
|
|
514
|
+
ctx.getLogSink()?.[level](message, buildLogRecordData(args));
|
|
515
|
+
} catch {}
|
|
439
516
|
}
|
|
440
517
|
shouldLog(level, message, args) {
|
|
441
518
|
if (!this.filter) return true;
|
|
@@ -455,16 +532,23 @@ var ConsoleLogger = class ConsoleLogger extends MastraLogger {
|
|
|
455
532
|
return this.component ? `[${this.component}] ` : "";
|
|
456
533
|
}
|
|
457
534
|
debug(message, ...args) {
|
|
458
|
-
if (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...args);
|
|
535
|
+
if (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
536
|
+
this.#export("debug", message, args);
|
|
459
537
|
}
|
|
460
538
|
info(message, ...args) {
|
|
461
|
-
if ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...args);
|
|
539
|
+
if ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
540
|
+
this.#export("info", message, args);
|
|
462
541
|
}
|
|
463
542
|
warn(message, ...args) {
|
|
464
|
-
if ((this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.WARN, message, args)) console.warn(`${this.prefix()}${message}`, ...args);
|
|
543
|
+
if ((this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.WARN, message, args)) console.warn(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
544
|
+
this.#export("warn", message, args);
|
|
465
545
|
}
|
|
466
546
|
error(message, ...args) {
|
|
467
|
-
if ((this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.ERROR, message, args)) console.error(`${this.prefix()}${message}`, ...args);
|
|
547
|
+
if ((this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.ERROR, message, args)) console.error(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
548
|
+
this.#export("error", message, args);
|
|
549
|
+
}
|
|
550
|
+
trackException(error, metadata) {
|
|
551
|
+
exportTrackedException(this.#adapterContext, error, metadata);
|
|
468
552
|
}
|
|
469
553
|
async listLogs(_transportId, _params) {
|
|
470
554
|
return {
|