@mastra/auth-cloud 1.2.4-alpha.0 → 1.2.5-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/fga.d.ts +11 -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/client.d.ts.map +1 -1
- package/dist/error.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/pkce/error.d.ts.map +1 -1
- package/dist/rbac/rbac-provider.d.ts.map +1 -1
- package/package.json +7 -8
- package/CHANGELOG.md +0 -209
- package/dist/_types/@internal_auth/dist/_types/@internal_core/dist/index-S1lgaKO7.d.ts +0 -218
package/dist/index.js
CHANGED
|
@@ -693,6 +693,46 @@ function getRequestHeader(request, name) {
|
|
|
693
693
|
}
|
|
694
694
|
//#endregion
|
|
695
695
|
//#region ../../packages/_internal-core/dist/logger/index.js
|
|
696
|
+
/**
|
|
697
|
+
* Export a tracked exception through the adapter sink, mirroring the
|
|
698
|
+
* DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`
|
|
699
|
+
* when present on a MastraError-like value). Never throws into the caller.
|
|
700
|
+
*/
|
|
701
|
+
function exportTrackedException(ctx, error, metadata) {
|
|
702
|
+
if (!ctx?.options.export) return;
|
|
703
|
+
try {
|
|
704
|
+
const mastraError = error;
|
|
705
|
+
ctx.getLogSink()?.error(error.message, {
|
|
706
|
+
...mastraError.id !== void 0 ? { errorId: mastraError.id } : {},
|
|
707
|
+
...mastraError.domain !== void 0 ? { domain: mastraError.domain } : {},
|
|
708
|
+
...mastraError.category !== void 0 ? { category: mastraError.category } : {},
|
|
709
|
+
...mastraError.details !== void 0 ? { details: mastraError.details } : {},
|
|
710
|
+
...error.cause instanceof Error ? { cause: error.cause.message } : {},
|
|
711
|
+
...metadata
|
|
712
|
+
});
|
|
713
|
+
} catch {}
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Adapt IMastraLogger's variadic args into the structured `data` payload of
|
|
717
|
+
* an exported log record. Extracts the first plain object as data,
|
|
718
|
+
* serializes an Error arg, and collects remaining primitives under `args`
|
|
719
|
+
* so the derived record preserves all context from the native call.
|
|
720
|
+
*/
|
|
721
|
+
function buildLogRecordData(args) {
|
|
722
|
+
const objectData = args.find((arg) => arg !== null && typeof arg === "object" && !Array.isArray(arg) && !(arg instanceof Error));
|
|
723
|
+
const errorArg = args.find((arg) => arg instanceof Error);
|
|
724
|
+
const extraArgs = args.filter((arg) => arg !== objectData && arg !== errorArg);
|
|
725
|
+
if (!objectData && !errorArg && extraArgs.length === 0) return void 0;
|
|
726
|
+
return {
|
|
727
|
+
...objectData ?? {},
|
|
728
|
+
...errorArg ? { error: {
|
|
729
|
+
name: errorArg.name,
|
|
730
|
+
message: errorArg.message,
|
|
731
|
+
stack: errorArg.stack
|
|
732
|
+
} } : {},
|
|
733
|
+
...extraArgs.length > 0 ? { args: extraArgs } : {}
|
|
734
|
+
};
|
|
735
|
+
}
|
|
696
736
|
const RegisteredLogger = {
|
|
697
737
|
AGENT: "AGENT",
|
|
698
738
|
OBSERVABILITY: "OBSERVABILITY",
|
|
@@ -779,19 +819,56 @@ var MastraLogger = class {
|
|
|
779
819
|
var ConsoleLogger = class ConsoleLogger extends MastraLogger {
|
|
780
820
|
component;
|
|
781
821
|
filter;
|
|
822
|
+
#adapterContext;
|
|
782
823
|
constructor(options = {}) {
|
|
783
824
|
super(options);
|
|
784
825
|
this.component = options.component;
|
|
785
826
|
this.filter = options.filter;
|
|
786
827
|
}
|
|
828
|
+
/**
|
|
829
|
+
* Adapter hook (see `AdaptableLogger`): enables native trace correlation
|
|
830
|
+
* (trace_id/span_id appended to console output) and observability export
|
|
831
|
+
* derived from the same record. Called by Mastra during setup.
|
|
832
|
+
*/
|
|
833
|
+
__attachObservability(ctx) {
|
|
834
|
+
this.#adapterContext = ctx;
|
|
835
|
+
}
|
|
787
836
|
child(componentOrBindings) {
|
|
788
837
|
const component = typeof componentOrBindings === "string" ? componentOrBindings : componentOrBindings?.component ?? this.component;
|
|
789
|
-
|
|
838
|
+
const child = new ConsoleLogger({
|
|
790
839
|
name: this.name,
|
|
791
840
|
level: this.level,
|
|
792
841
|
component,
|
|
793
842
|
filter: this.filter
|
|
794
843
|
});
|
|
844
|
+
if (this.#adapterContext) child.__attachObservability(this.#adapterContext);
|
|
845
|
+
return child;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Native-record correlation: when a span is active, append the trace
|
|
849
|
+
* fields object to the console args so every destination sees them.
|
|
850
|
+
*/
|
|
851
|
+
#correlate(args) {
|
|
852
|
+
const ctx = this.#adapterContext;
|
|
853
|
+
if (!ctx?.options.correlation) return args;
|
|
854
|
+
try {
|
|
855
|
+
const fields = ctx.resolveTraceFields();
|
|
856
|
+
return fields ? [...args, fields] : args;
|
|
857
|
+
} catch {
|
|
858
|
+
return args;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Export the record derived from the same native call to observability.
|
|
863
|
+
* Mirrors DualLogger semantics: export is independent of the console
|
|
864
|
+
* level filter, and never throws into the caller.
|
|
865
|
+
*/
|
|
866
|
+
#export(level, message, args) {
|
|
867
|
+
const ctx = this.#adapterContext;
|
|
868
|
+
if (!ctx?.options.export) return;
|
|
869
|
+
try {
|
|
870
|
+
ctx.getLogSink()?.[level](message, buildLogRecordData(args));
|
|
871
|
+
} catch {}
|
|
795
872
|
}
|
|
796
873
|
shouldLog(level, message, args) {
|
|
797
874
|
if (!this.filter) return true;
|
|
@@ -811,16 +888,23 @@ var ConsoleLogger = class ConsoleLogger extends MastraLogger {
|
|
|
811
888
|
return this.component ? `[${this.component}] ` : "";
|
|
812
889
|
}
|
|
813
890
|
debug(message, ...args) {
|
|
814
|
-
if (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...args);
|
|
891
|
+
if (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
892
|
+
this.#export("debug", message, args);
|
|
815
893
|
}
|
|
816
894
|
info(message, ...args) {
|
|
817
|
-
if ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...args);
|
|
895
|
+
if ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));
|
|
896
|
+
this.#export("info", message, args);
|
|
818
897
|
}
|
|
819
898
|
warn(message, ...args) {
|
|
820
|
-
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);
|
|
899
|
+
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));
|
|
900
|
+
this.#export("warn", message, args);
|
|
821
901
|
}
|
|
822
902
|
error(message, ...args) {
|
|
823
|
-
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);
|
|
903
|
+
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));
|
|
904
|
+
this.#export("error", message, args);
|
|
905
|
+
}
|
|
906
|
+
trackException(error, metadata) {
|
|
907
|
+
exportTrackedException(this.#adapterContext, error, metadata);
|
|
824
908
|
}
|
|
825
909
|
async listLogs(_transportId, _params) {
|
|
826
910
|
return {
|