@brizz/sdk 0.1.2-rc.0 → 0.1.2
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/README.md +97 -90
- package/dist/index.cjs +4 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +4 -75
- package/dist/index.js.map +1 -1
- package/dist/loader.mjs +12 -1
- package/dist/preload.cjs +13 -1
- package/dist/preload.cjs.map +1 -1
- package/dist/preload.js +12 -1
- package/dist/preload.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -169,10 +169,8 @@ interface RuntimeInfo {
|
|
|
169
169
|
}
|
|
170
170
|
declare function detectRuntime(): RuntimeInfo;
|
|
171
171
|
|
|
172
|
-
declare function maybeRegisterESMLoader(): boolean;
|
|
173
|
-
|
|
174
172
|
declare namespace init {
|
|
175
173
|
export { };
|
|
176
174
|
}
|
|
177
175
|
|
|
178
|
-
export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, VercelAIInstrumentation, WithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue,
|
|
176
|
+
export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, VercelAIInstrumentation, WithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, setLogLevel };
|
package/dist/index.d.ts
CHANGED
|
@@ -169,10 +169,8 @@ interface RuntimeInfo {
|
|
|
169
169
|
}
|
|
170
170
|
declare function detectRuntime(): RuntimeInfo;
|
|
171
171
|
|
|
172
|
-
declare function maybeRegisterESMLoader(): boolean;
|
|
173
|
-
|
|
174
172
|
declare namespace init {
|
|
175
173
|
export { };
|
|
176
174
|
}
|
|
177
175
|
|
|
178
|
-
export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, VercelAIInstrumentation, WithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue,
|
|
176
|
+
export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, VercelAIInstrumentation, WithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, setLogLevel };
|
package/dist/index.js
CHANGED
|
@@ -1072,19 +1072,19 @@ var VercelAIInstrumentation = class _VercelAIInstrumentation extends Instrumenta
|
|
|
1072
1072
|
* Manual instrumentation hook for bundlers/Next.js. Applies in-place wrapping
|
|
1073
1073
|
* on the provided module namespace.
|
|
1074
1074
|
*/
|
|
1075
|
-
manuallyInstrument(
|
|
1075
|
+
manuallyInstrument(module2) {
|
|
1076
1076
|
try {
|
|
1077
|
-
const result = this._patchModuleExports(
|
|
1077
|
+
const result = this._patchModuleExports(module2);
|
|
1078
1078
|
if (result !== null) {
|
|
1079
1079
|
logger.debug("Applied manual Vercel AI instrumentation");
|
|
1080
1080
|
this._vercelAiNamespace = result;
|
|
1081
1081
|
return result;
|
|
1082
1082
|
}
|
|
1083
1083
|
logger.warn("Manual Vercel AI instrumentation received invalid module");
|
|
1084
|
-
return
|
|
1084
|
+
return module2;
|
|
1085
1085
|
} catch (error) {
|
|
1086
1086
|
logger.error(`Failed manual Vercel AI instrumentation: ${String(error)}`);
|
|
1087
|
-
return this._vercelAiNamespace ||
|
|
1087
|
+
return this._vercelAiNamespace || module2;
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
1090
|
/**
|
|
@@ -2800,76 +2800,6 @@ function detectRuntime() {
|
|
|
2800
2800
|
};
|
|
2801
2801
|
}
|
|
2802
2802
|
|
|
2803
|
-
// src/node/loader.ts
|
|
2804
|
-
import module2 from "module";
|
|
2805
|
-
import { createAddHookMessageChannel } from "import-in-the-middle";
|
|
2806
|
-
var loaderDebug = (() => {
|
|
2807
|
-
const isDebug = process.env["BRIZZ_ESM_DEBUG"] === "true" || process.env["BRIZZ_LOG_LEVEL"] === "debug";
|
|
2808
|
-
return {
|
|
2809
|
-
log: (msg, data) => {
|
|
2810
|
-
if (!isDebug) {
|
|
2811
|
-
return;
|
|
2812
|
-
}
|
|
2813
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
2814
|
-
const dataStr = data ? ` ${JSON.stringify(data)}` : "";
|
|
2815
|
-
console.log(`[${timestamp}] [ESM-LOADER] ${msg}${dataStr}`);
|
|
2816
|
-
},
|
|
2817
|
-
error: (msg, error) => {
|
|
2818
|
-
if (!isDebug) {
|
|
2819
|
-
return;
|
|
2820
|
-
}
|
|
2821
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
2822
|
-
const errorStr = error instanceof Error ? ` ${error.message}` : error ? ` ${JSON.stringify(error)}` : "";
|
|
2823
|
-
console.error(`[${timestamp}] [ESM-LOADER] ERROR: ${msg}${errorStr}`);
|
|
2824
|
-
}
|
|
2825
|
-
};
|
|
2826
|
-
})();
|
|
2827
|
-
var LOADER_REGISTERED_KEY = Symbol.for("__brizz_esm_loader_registered__");
|
|
2828
|
-
function checkLoaderAPISupport() {
|
|
2829
|
-
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
2830
|
-
if (major === void 0 || minor === void 0) {
|
|
2831
|
-
loaderDebug.log("Failed to detect Node version, assuming loader API is supported");
|
|
2832
|
-
return true;
|
|
2833
|
-
}
|
|
2834
|
-
const supported = major >= 21 || major === 20 && minor >= 6 || major === 18 && minor >= 19;
|
|
2835
|
-
loaderDebug.log("Loader API support check:", {
|
|
2836
|
-
nodeVersion: `${major}.${minor}`,
|
|
2837
|
-
supportsLoaderAPI: supported
|
|
2838
|
-
});
|
|
2839
|
-
return supported;
|
|
2840
|
-
}
|
|
2841
|
-
function maybeRegisterESMLoader() {
|
|
2842
|
-
if (globalThis[LOADER_REGISTERED_KEY] === true) {
|
|
2843
|
-
loaderDebug.log("ESM loader already registered, skipping");
|
|
2844
|
-
return false;
|
|
2845
|
-
}
|
|
2846
|
-
globalThis[LOADER_REGISTERED_KEY] = true;
|
|
2847
|
-
loaderDebug.log("Starting ESM loader registration...");
|
|
2848
|
-
if (!checkLoaderAPISupport()) {
|
|
2849
|
-
loaderDebug.log("Node.js version does not support loader API, skipping");
|
|
2850
|
-
return false;
|
|
2851
|
-
}
|
|
2852
|
-
try {
|
|
2853
|
-
loaderDebug.log("Creating MessageChannel for import-in-the-middle...");
|
|
2854
|
-
const { addHookMessagePort } = createAddHookMessageChannel();
|
|
2855
|
-
loaderDebug.log("Registering import-in-the-middle/hook.mjs...");
|
|
2856
|
-
module2.register("import-in-the-middle/hook.mjs", {
|
|
2857
|
-
data: { addHookMessagePort },
|
|
2858
|
-
transferList: [addHookMessagePort]
|
|
2859
|
-
});
|
|
2860
|
-
loaderDebug.log("ESM loader successfully registered!");
|
|
2861
|
-
return true;
|
|
2862
|
-
} catch (error) {
|
|
2863
|
-
loaderDebug.error("Failed to register ESM loader:", error);
|
|
2864
|
-
globalThis[LOADER_REGISTERED_KEY] = false;
|
|
2865
|
-
return false;
|
|
2866
|
-
}
|
|
2867
|
-
}
|
|
2868
|
-
if (globalThis[LOADER_REGISTERED_KEY] !== true) {
|
|
2869
|
-
loaderDebug.log("Loader module imported, attempting to register...");
|
|
2870
|
-
maybeRegisterESMLoader();
|
|
2871
|
-
}
|
|
2872
|
-
|
|
2873
2803
|
// src/init.ts
|
|
2874
2804
|
var init_exports = {};
|
|
2875
2805
|
export {
|
|
@@ -2890,7 +2820,6 @@ export {
|
|
|
2890
2820
|
logger,
|
|
2891
2821
|
maskAttributes,
|
|
2892
2822
|
maskValue,
|
|
2893
|
-
maybeRegisterESMLoader,
|
|
2894
2823
|
setLogLevel
|
|
2895
2824
|
};
|
|
2896
2825
|
//# sourceMappingURL=index.js.map
|