@dynamic-labs/logger 4.98.0 → 4.99.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/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.99.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.98.0...v4.99.0) (2026-09-10)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **solana-core:** standalone sponsored ATA creation [v4 backport] ([#12366](https://github.com/dynamic-labs/dynamic-auth/issues/12366)) ([46d86c9](https://github.com/dynamic-labs/dynamic-auth/commit/46d86c9a1a04c45bf045acc5c6df792dcd4b3590))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* do not report wallets installed from a provider selection router (v4) ([#12341](https://github.com/dynamic-labs/dynamic-auth/issues/12341)) ([6b02087](https://github.com/dynamic-labs/dynamic-auth/commit/6b02087685545bb6f672eb9040316d01489c82f4))
|
|
13
|
+
* **screening:** soften the blocked-wallet copy to be provider-neutral (v4) ([#12359](https://github.com/dynamic-labs/dynamic-auth/issues/12359)) ([d6772df](https://github.com/dynamic-labs/dynamic-auth/commit/d6772dfc1419811bfbc1d9cb1db58fe12274d397))
|
|
14
|
+
* **waas:** detach the superseded WaaS client from the iframe reverse channel (v4) ([#12349](https://github.com/dynamic-labs/dynamic-auth/issues/12349)) ([393253d](https://github.com/dynamic-labs/dynamic-auth/commit/393253d9e5934e039e21b85ed6ceded760e0f225)), closes [#11766](https://github.com/dynamic-labs/dynamic-auth/issues/11766) [#12348](https://github.com/dynamic-labs/dynamic-auth/issues/12348)
|
|
15
|
+
|
|
2
16
|
## [4.98.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.97.0...v4.98.0) (2026-09-02)
|
|
3
17
|
|
|
4
18
|
|
package/package.json
CHANGED
package/src/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ var EventEmitter = require('eventemitter3');
|
|
|
8
8
|
var MetaData = require('./MetaData/MetaData.cjs');
|
|
9
9
|
var types = require('./types.cjs');
|
|
10
10
|
var createCircularReferenceReplacer = require('./utils/createCircularReferenceReplacer.cjs');
|
|
11
|
+
var createLogPayloadReplacer = require('./utils/createLogPayloadReplacer.cjs');
|
|
11
12
|
var mapLogLevel = require('./utils/mapLogLevel.cjs');
|
|
12
13
|
var processArgs = require('./utils/processArgs.cjs');
|
|
13
14
|
var getStack = require('./utils/getStack.cjs');
|
|
@@ -168,7 +169,7 @@ class Logger {
|
|
|
168
169
|
throw new Error('Environment ID not set');
|
|
169
170
|
}
|
|
170
171
|
yield fetch(`https://logs.dynamicauth.com/api/v1/${globalState.keys.environmentId}`, {
|
|
171
|
-
body: JSON.stringify(messages),
|
|
172
|
+
body: JSON.stringify(messages, createLogPayloadReplacer.createLogPayloadReplacer()),
|
|
172
173
|
headers: {
|
|
173
174
|
'Content-Type': 'application/json',
|
|
174
175
|
},
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { MetaData } from './MetaData/MetaData.js';
|
|
|
5
5
|
import { LogLevel } from './types.js';
|
|
6
6
|
export { LogLevel } from './types.js';
|
|
7
7
|
import { createCircularReferenceReplacer } from './utils/createCircularReferenceReplacer.js';
|
|
8
|
+
import { createLogPayloadReplacer } from './utils/createLogPayloadReplacer.js';
|
|
8
9
|
import { mapLogLevel } from './utils/mapLogLevel.js';
|
|
9
10
|
import { processArgs } from './utils/processArgs.js';
|
|
10
11
|
import { getStack } from './utils/getStack.js';
|
|
@@ -161,7 +162,7 @@ class Logger {
|
|
|
161
162
|
throw new Error('Environment ID not set');
|
|
162
163
|
}
|
|
163
164
|
yield fetch(`https://logs.dynamicauth.com/api/v1/${globalState.keys.environmentId}`, {
|
|
164
|
-
body: JSON.stringify(messages),
|
|
165
|
+
body: JSON.stringify(messages, createLogPayloadReplacer()),
|
|
165
166
|
headers: {
|
|
166
167
|
'Content-Type': 'application/json',
|
|
167
168
|
},
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var createCircularReferenceReplacer = require('./createCircularReferenceReplacer.cjs');
|
|
7
|
+
|
|
8
|
+
const getSerializableFields = (value) => {
|
|
9
|
+
const isRecord = typeof value === 'object' && value !== null;
|
|
10
|
+
if (isRecord) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
return {};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Returns a JSON.stringify replacer for outgoing log payloads: it skips
|
|
17
|
+
* circular references and serializes Error instances, whose own fields are not
|
|
18
|
+
* enumerable and would otherwise be sent as `{}`.
|
|
19
|
+
*
|
|
20
|
+
* Errors are shaped like CustomError.toJSON (`error` holds the message) so a
|
|
21
|
+
* plain Error and a DynamicError land on the same log attributes.
|
|
22
|
+
*/
|
|
23
|
+
const createLogPayloadReplacer = () => {
|
|
24
|
+
const skipCircularReferences = createCircularReferenceReplacer.createCircularReferenceReplacer();
|
|
25
|
+
// `JSON.stringify` walks the payload depth first, and the value it hands back
|
|
26
|
+
// to the replacer becomes the holder of that value's own keys, so the holders
|
|
27
|
+
// leading to the current key are tracked to tell an error already on the
|
|
28
|
+
// current path from one merely serialized earlier somewhere else.
|
|
29
|
+
const holders = [];
|
|
30
|
+
const errorsByHolder = new WeakMap();
|
|
31
|
+
const isOnCurrentPath = (error) => holders.some((holder) => typeof holder === 'object' &&
|
|
32
|
+
holder !== null &&
|
|
33
|
+
errorsByHolder.get(holder) === error);
|
|
34
|
+
return function (key, value) {
|
|
35
|
+
while (holders.length > 0 && holders[holders.length - 1] !== this) {
|
|
36
|
+
holders.pop();
|
|
37
|
+
}
|
|
38
|
+
// `JSON.stringify` applies `toJSON` before handing the value to a replacer,
|
|
39
|
+
// so errors are read from the holder to reach the fields they do not
|
|
40
|
+
// expose through `toJSON`.
|
|
41
|
+
const rawValue = this[key];
|
|
42
|
+
if (rawValue instanceof Error) {
|
|
43
|
+
if (isOnCurrentPath(rawValue)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const { code } = rawValue;
|
|
47
|
+
const serializedError = Object.assign(Object.assign({}, getSerializableFields(value)), { code, error: rawValue.message, name: rawValue.name, stack: rawValue.stack });
|
|
48
|
+
errorsByHolder.set(serializedError, rawValue);
|
|
49
|
+
holders.push(serializedError);
|
|
50
|
+
return serializedError;
|
|
51
|
+
}
|
|
52
|
+
const serialized = skipCircularReferences(key, value);
|
|
53
|
+
if (typeof serialized === 'object' && serialized !== null) {
|
|
54
|
+
holders.push(serialized);
|
|
55
|
+
}
|
|
56
|
+
return serialized;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.createLogPayloadReplacer = createLogPayloadReplacer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a JSON.stringify replacer for outgoing log payloads: it skips
|
|
3
|
+
* circular references and serializes Error instances, whose own fields are not
|
|
4
|
+
* enumerable and would otherwise be sent as `{}`.
|
|
5
|
+
*
|
|
6
|
+
* Errors are shaped like CustomError.toJSON (`error` holds the message) so a
|
|
7
|
+
* plain Error and a DynamicError land on the same log attributes.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createLogPayloadReplacer: () => (this: Record<string, unknown>, key: string, value: unknown) => unknown;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { createCircularReferenceReplacer } from './createCircularReferenceReplacer.js';
|
|
3
|
+
|
|
4
|
+
const getSerializableFields = (value) => {
|
|
5
|
+
const isRecord = typeof value === 'object' && value !== null;
|
|
6
|
+
if (isRecord) {
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
return {};
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Returns a JSON.stringify replacer for outgoing log payloads: it skips
|
|
13
|
+
* circular references and serializes Error instances, whose own fields are not
|
|
14
|
+
* enumerable and would otherwise be sent as `{}`.
|
|
15
|
+
*
|
|
16
|
+
* Errors are shaped like CustomError.toJSON (`error` holds the message) so a
|
|
17
|
+
* plain Error and a DynamicError land on the same log attributes.
|
|
18
|
+
*/
|
|
19
|
+
const createLogPayloadReplacer = () => {
|
|
20
|
+
const skipCircularReferences = createCircularReferenceReplacer();
|
|
21
|
+
// `JSON.stringify` walks the payload depth first, and the value it hands back
|
|
22
|
+
// to the replacer becomes the holder of that value's own keys, so the holders
|
|
23
|
+
// leading to the current key are tracked to tell an error already on the
|
|
24
|
+
// current path from one merely serialized earlier somewhere else.
|
|
25
|
+
const holders = [];
|
|
26
|
+
const errorsByHolder = new WeakMap();
|
|
27
|
+
const isOnCurrentPath = (error) => holders.some((holder) => typeof holder === 'object' &&
|
|
28
|
+
holder !== null &&
|
|
29
|
+
errorsByHolder.get(holder) === error);
|
|
30
|
+
return function (key, value) {
|
|
31
|
+
while (holders.length > 0 && holders[holders.length - 1] !== this) {
|
|
32
|
+
holders.pop();
|
|
33
|
+
}
|
|
34
|
+
// `JSON.stringify` applies `toJSON` before handing the value to a replacer,
|
|
35
|
+
// so errors are read from the holder to reach the fields they do not
|
|
36
|
+
// expose through `toJSON`.
|
|
37
|
+
const rawValue = this[key];
|
|
38
|
+
if (rawValue instanceof Error) {
|
|
39
|
+
if (isOnCurrentPath(rawValue)) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const { code } = rawValue;
|
|
43
|
+
const serializedError = Object.assign(Object.assign({}, getSerializableFields(value)), { code, error: rawValue.message, name: rawValue.name, stack: rawValue.stack });
|
|
44
|
+
errorsByHolder.set(serializedError, rawValue);
|
|
45
|
+
holders.push(serializedError);
|
|
46
|
+
return serializedError;
|
|
47
|
+
}
|
|
48
|
+
const serialized = skipCircularReferences(key, value);
|
|
49
|
+
if (typeof serialized === 'object' && serialized !== null) {
|
|
50
|
+
holders.push(serialized);
|
|
51
|
+
}
|
|
52
|
+
return serialized;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { createLogPayloadReplacer };
|