@metamask-previews/logging-controller 9.0.0-preview-8bfa290fb → 10.0.0-preview-97d6b86c0

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 (78) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/{LoggingController-method-action-types.d.mts → LoggingController-method-action-types.d.ts} +2 -2
  3. package/dist/LoggingController-method-action-types.d.ts.map +1 -0
  4. package/dist/{LoggingController-method-action-types.mjs → LoggingController-method-action-types.js} +1 -1
  5. package/dist/LoggingController-method-action-types.js.map +1 -0
  6. package/dist/{LoggingController.d.cts → LoggingController.d.ts} +6 -6
  7. package/dist/LoggingController.d.ts.map +1 -0
  8. package/dist/{LoggingController.mjs → LoggingController.js} +7 -20
  9. package/dist/LoggingController.js.map +1 -0
  10. package/dist/index.d.ts +4 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +3 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/logTypes/{EthSignLog.d.mts → EthSignLog.d.ts} +2 -2
  15. package/dist/logTypes/EthSignLog.d.ts.map +1 -0
  16. package/dist/logTypes/{EthSignLog.mjs → EthSignLog.js} +1 -1
  17. package/dist/logTypes/EthSignLog.js.map +1 -0
  18. package/dist/logTypes/GenericLog.d.ts +6 -0
  19. package/dist/logTypes/GenericLog.d.ts.map +1 -0
  20. package/dist/logTypes/GenericLog.js +2 -0
  21. package/dist/logTypes/GenericLog.js.map +1 -0
  22. package/dist/logTypes/{LogType.d.cts → LogType.d.ts} +1 -1
  23. package/dist/logTypes/LogType.d.ts.map +1 -0
  24. package/dist/logTypes/{LogType.mjs → LogType.js} +1 -1
  25. package/dist/logTypes/LogType.js.map +1 -0
  26. package/dist/logTypes/index.d.ts +13 -0
  27. package/dist/logTypes/index.d.ts.map +1 -0
  28. package/dist/logTypes/index.js +6 -0
  29. package/dist/logTypes/index.js.map +1 -0
  30. package/package.json +15 -19
  31. package/dist/LoggingController-method-action-types.cjs +0 -7
  32. package/dist/LoggingController-method-action-types.cjs.map +0 -1
  33. package/dist/LoggingController-method-action-types.d.cts +0 -26
  34. package/dist/LoggingController-method-action-types.d.cts.map +0 -1
  35. package/dist/LoggingController-method-action-types.d.mts.map +0 -1
  36. package/dist/LoggingController-method-action-types.mjs.map +0 -1
  37. package/dist/LoggingController.cjs +0 -90
  38. package/dist/LoggingController.cjs.map +0 -1
  39. package/dist/LoggingController.d.cts.map +0 -1
  40. package/dist/LoggingController.d.mts +0 -62
  41. package/dist/LoggingController.d.mts.map +0 -1
  42. package/dist/LoggingController.mjs.map +0 -1
  43. package/dist/index.cjs +0 -19
  44. package/dist/index.cjs.map +0 -1
  45. package/dist/index.d.cts +0 -4
  46. package/dist/index.d.cts.map +0 -1
  47. package/dist/index.d.mts +0 -4
  48. package/dist/index.d.mts.map +0 -1
  49. package/dist/index.mjs +0 -3
  50. package/dist/index.mjs.map +0 -1
  51. package/dist/logTypes/EthSignLog.cjs +0 -23
  52. package/dist/logTypes/EthSignLog.cjs.map +0 -1
  53. package/dist/logTypes/EthSignLog.d.cts +0 -33
  54. package/dist/logTypes/EthSignLog.d.cts.map +0 -1
  55. package/dist/logTypes/EthSignLog.d.mts.map +0 -1
  56. package/dist/logTypes/EthSignLog.mjs.map +0 -1
  57. package/dist/logTypes/GenericLog.cjs +0 -3
  58. package/dist/logTypes/GenericLog.cjs.map +0 -1
  59. package/dist/logTypes/GenericLog.d.cts +0 -6
  60. package/dist/logTypes/GenericLog.d.cts.map +0 -1
  61. package/dist/logTypes/GenericLog.d.mts +0 -6
  62. package/dist/logTypes/GenericLog.d.mts.map +0 -1
  63. package/dist/logTypes/GenericLog.mjs +0 -2
  64. package/dist/logTypes/GenericLog.mjs.map +0 -1
  65. package/dist/logTypes/LogType.cjs +0 -14
  66. package/dist/logTypes/LogType.cjs.map +0 -1
  67. package/dist/logTypes/LogType.d.cts.map +0 -1
  68. package/dist/logTypes/LogType.d.mts +0 -10
  69. package/dist/logTypes/LogType.d.mts.map +0 -1
  70. package/dist/logTypes/LogType.mjs.map +0 -1
  71. package/dist/logTypes/index.cjs +0 -22
  72. package/dist/logTypes/index.cjs.map +0 -1
  73. package/dist/logTypes/index.d.cts +0 -13
  74. package/dist/logTypes/index.d.cts.map +0 -1
  75. package/dist/logTypes/index.d.mts +0 -13
  76. package/dist/logTypes/index.d.mts.map +0 -1
  77. package/dist/logTypes/index.mjs +0 -6
  78. package/dist/logTypes/index.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -9,7 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Changed
11
11
 
12
+ - Bump `uuid` from `^8.3.2` to `^9.0.1` ([#10117](https://github.com/MetaMask/core/pull/10117))
13
+
14
+ ## [10.0.0]
15
+
16
+ ### Changed
17
+
18
+ - **BREAKING:** Drop CommonJS support ([#9536](https://github.com/MetaMask/core/pull/9536))
19
+ - This package is now ESM-only, but can still be used in CommonJS projects via `require(esm)` in modern Node.js versions (22+), or dynamic imports in older Node.js versions.
20
+ - **BREAKING:** Bump minimum Node.js version to 22 ([#9976](https://github.com/MetaMask/core/pull/9976))
21
+ - **BREAKING:** Bump TypeScript target to ES2022 ([#10019](https://github.com/MetaMask/core/pull/10019))
22
+ - This package now ships ES2022 code, requiring a compatible modern environment or bundler configuration to consume.
12
23
  - Bump `@metamask/utils` from `^11.11.0` to `^11.12.0` ([#10076](https://github.com/MetaMask/core/pull/10076))
24
+ - Bump `@metamask/base-controller` from `^9.1.0` to `^10.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
25
+ - Bump `@metamask/messenger` from `^2.0.0` to `^3.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
13
26
 
14
27
  ## [9.0.0]
15
28
 
@@ -236,7 +249,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
236
249
  - Initial Release
237
250
  - Add logging controller ([#1089](https://github.com/MetaMask/core.git/pull/1089))
238
251
 
239
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@9.0.0...HEAD
252
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@10.0.0...HEAD
253
+ [10.0.0]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@9.0.0...@metamask/logging-controller@10.0.0
240
254
  [9.0.0]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@8.0.2...@metamask/logging-controller@9.0.0
241
255
  [8.0.2]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@8.0.1...@metamask/logging-controller@8.0.2
242
256
  [8.0.1]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@8.0.0...@metamask/logging-controller@8.0.1
@@ -2,7 +2,7 @@
2
2
  * This file is auto generated.
3
3
  * Do not edit manually.
4
4
  */
5
- import type { LoggingController } from "./LoggingController.mjs";
5
+ import type { LoggingController } from './LoggingController.js';
6
6
  /**
7
7
  * Add log to the state.
8
8
  *
@@ -23,4 +23,4 @@ export type LoggingControllerClearAction = {
23
23
  * Union of all LoggingController action types.
24
24
  */
25
25
  export type LoggingControllerMethodActions = LoggingControllerAddAction | LoggingControllerClearAction;
26
- //# sourceMappingURL=LoggingController-method-action-types.d.mts.map
26
+ //# sourceMappingURL=LoggingController-method-action-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggingController-method-action-types.d.ts","sourceRoot":"","sources":["../src/LoggingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,0BAA0B,GAC1B,4BAA4B,CAAC"}
@@ -3,4 +3,4 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=LoggingController-method-action-types.mjs.map
6
+ //# sourceMappingURL=LoggingController-method-action-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggingController-method-action-types.js","sourceRoot":"","sources":["../src/LoggingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { LoggingController } from './LoggingController.js';\n\n/**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\nexport type LoggingControllerAddAction = {\n type: `LoggingController:add`;\n handler: LoggingController['add'];\n};\n\n/**\n * Removes all log entries.\n */\nexport type LoggingControllerClearAction = {\n type: `LoggingController:clear`;\n handler: LoggingController['clear'];\n};\n\n/**\n * Union of all LoggingController action types.\n */\nexport type LoggingControllerMethodActions =\n | LoggingControllerAddAction\n | LoggingControllerClearAction;\n"]}
@@ -1,8 +1,8 @@
1
- import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
2
- import { BaseController } from "@metamask/base-controller";
3
- import type { Messenger } from "@metamask/messenger";
4
- import type { LoggingControllerMethodActions } from "./LoggingController-method-action-types.cjs";
5
- import type { Log } from "./logTypes/index.cjs";
1
+ import type { ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
2
+ import { BaseController } from '@metamask/base-controller';
3
+ import type { Messenger } from '@metamask/messenger';
4
+ import type { LoggingControllerMethodActions } from './LoggingController-method-action-types.js';
5
+ import type { Log } from './logTypes/index.js';
6
6
  /**
7
7
  * LogEntry is the entry that will be added to the logging controller state.
8
8
  * It consists of a entry key that must be on of the Log union types, and an
@@ -59,4 +59,4 @@ export declare class LoggingController extends BaseController<typeof name, Loggi
59
59
  clear(): void;
60
60
  }
61
61
  export {};
62
- //# sourceMappingURL=LoggingController.d.cts.map
62
+ //# sourceMappingURL=LoggingController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggingController.d.ts","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACjG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE;QACJ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,IAAI,sBAAsB,CAAC;AAIjC,MAAM,MAAM,+BAA+B,GAAG,wBAAwB,CACpE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAChC,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC,MAAM,MAAM,iCAAiC,GAAG,0BAA0B,CACxE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,SAAS,CAChD,OAAO,IAAI,EACX,wBAAwB,EACxB,uBAAuB,CACxB,CAAC;AAeF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CACnD,OAAO,IAAI,EACX,sBAAsB,EACtB,0BAA0B,CAC3B;;IAGC;;;;;;;OAOG;IACH,YAAY,EACV,SAAS,EACT,KAAK,EACL,UAA4C,GAC7C,EAAE;QACD,SAAS,EAAE,0BAA0B,CAAC;QACtC,KAAK,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACxC,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,EAiBA;IAED;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG,QAiBX;IAED;;OAEG;IACH,KAAK,SAIJ;CACF"}
@@ -1,18 +1,6 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _LoggingController_expiryTime;
13
- import { BaseController } from "@metamask/base-controller";
14
- import { Duration, inMilliseconds } from "@metamask/utils";
15
- import { v4 as uuid } from "uuid";
1
+ import { BaseController } from '@metamask/base-controller';
2
+ import { Duration, inMilliseconds } from '@metamask/utils';
3
+ import { v4 as uuid } from 'uuid';
16
4
  const name = 'LoggingController';
17
5
  const MESSENGER_EXPOSED_METHODS = ['add', 'clear'];
18
6
  const metadata = {
@@ -30,6 +18,7 @@ const defaultState = {
30
18
  * Controller that manages a list of logs for signature requests.
31
19
  */
32
20
  export class LoggingController extends BaseController {
21
+ #expiryTime;
33
22
  /**
34
23
  * Creates a LoggingController instance.
35
24
  *
@@ -48,8 +37,7 @@ export class LoggingController extends BaseController {
48
37
  ...state,
49
38
  },
50
39
  });
51
- _LoggingController_expiryTime.set(this, void 0);
52
- __classPrivateFieldSet(this, _LoggingController_expiryTime, expiryTime, "f");
40
+ this.#expiryTime = expiryTime;
53
41
  this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
54
42
  }
55
43
  /**
@@ -63,7 +51,7 @@ export class LoggingController extends BaseController {
63
51
  timestamp: Date.now(),
64
52
  log,
65
53
  };
66
- const expiry = Date.now() - __classPrivateFieldGet(this, _LoggingController_expiryTime, "f");
54
+ const expiry = Date.now() - this.#expiryTime;
67
55
  this.update((state) => {
68
56
  for (const [id, entry] of Object.entries(state.logs)) {
69
57
  if (entry.timestamp < expiry) {
@@ -82,5 +70,4 @@ export class LoggingController extends BaseController {
82
70
  });
83
71
  }
84
72
  }
85
- _LoggingController_expiryTime = new WeakMap();
86
- //# sourceMappingURL=LoggingController.mjs.map
73
+ //# sourceMappingURL=LoggingController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggingController.js","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AA2BlC,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,OAAO,CAAU,CAAC;AAwB5D,MAAM,QAAQ,GAA0C;IACtD,IAAI,EAAE;QACJ,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,KAAK;QAC7B,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAItC;IACU,WAAW,CAAS;IAE7B;;;;;;;OAOG;IACH,YAAY,EACV,SAAS,EACT,KAAK,EACL,UAAU,GAAG,cAAc,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAK7C;QACC,KAAK,CAAC;YACJ,IAAI;YACJ,QAAQ;YACR,SAAS;YACT,KAAK,EAAE;gBACL,GAAG,YAAY;gBACf,GAAG,KAAK;aACT;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,4BAA4B,CACzC,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,GAAQ;QACV,MAAM,MAAM,GAAa;YACvB,EAAE,EAAE,IAAI,EAAE;YACV,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,GAAG;SACJ,CAAC;QAEF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC;QAE7C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;oBAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport { Duration, inMilliseconds } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type { LoggingControllerMethodActions } from './LoggingController-method-action-types.js';\nimport type { Log } from './logTypes/index.js';\n\n/**\n * LogEntry is the entry that will be added to the logging controller state.\n * It consists of a entry key that must be on of the Log union types, and an\n * additional id and timestamp.\n */\nexport type LogEntry = {\n id: string;\n timestamp: number;\n log: Log;\n};\n\n/**\n * Logging controller state\n *\n * @property logs - An object of logs indexed by their ids\n */\nexport type LoggingControllerState = {\n logs: {\n [id: string]: LogEntry;\n };\n};\n\nconst name = 'LoggingController';\n\nconst MESSENGER_EXPOSED_METHODS = ['add', 'clear'] as const;\n\nexport type LoggingControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerActions =\n | LoggingControllerGetStateAction\n | LoggingControllerMethodActions;\n\nexport type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerEvents = LoggingControllerStateChangeEvent;\n\nexport type LoggingControllerMessenger = Messenger<\n typeof name,\n LoggingControllerActions,\n LoggingControllerEvents\n>;\n\nconst metadata: StateMetadata<LoggingControllerState> = {\n logs: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: false,\n },\n};\n\nconst defaultState = {\n logs: {},\n};\n\n/**\n * Controller that manages a list of logs for signature requests.\n */\nexport class LoggingController extends BaseController<\n typeof name,\n LoggingControllerState,\n LoggingControllerMessenger\n> {\n readonly #expiryTime: number;\n\n /**\n * Creates a LoggingController instance.\n *\n * @param options - Constructor options\n * @param options.messenger - An instance of the Messenger\n * @param options.state - Initial state to set on this controller.\n * @param options.expiryTime - The number of milliseconds before we consider a log entry expired.\n */\n constructor({\n messenger,\n state,\n expiryTime = inMilliseconds(7, Duration.Day),\n }: {\n messenger: LoggingControllerMessenger;\n state?: Partial<LoggingControllerState>;\n expiryTime?: number;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...defaultState,\n ...state,\n },\n });\n\n this.#expiryTime = expiryTime;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\n add(log: Log) {\n const newLog: LogEntry = {\n id: uuid(),\n timestamp: Date.now(),\n log,\n };\n\n const expiry = Date.now() - this.#expiryTime;\n\n this.update((state) => {\n for (const [id, entry] of Object.entries(state.logs)) {\n if (entry.timestamp < expiry) {\n delete state.logs[id];\n }\n }\n state.logs[newLog.id] = newLog;\n });\n }\n\n /**\n * Removes all log entries.\n */\n clear() {\n this.update((state) => {\n state.logs = {};\n });\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export * from './LoggingController.js';
2
+ export type { LoggingControllerAddAction, LoggingControllerClearAction, } from './LoggingController-method-action-types.js';
3
+ export * from './logTypes/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,YAAY,EACV,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,4CAA4C,CAAC;AACpD,cAAc,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './LoggingController.js';
2
+ export * from './logTypes/index.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AAKvC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './LoggingController.js';\nexport type {\n LoggingControllerAddAction,\n LoggingControllerClearAction,\n} from './LoggingController-method-action-types.js';\nexport * from './logTypes/index.js';\n"]}
@@ -1,4 +1,4 @@
1
- import type { LogType } from "./LogType.mjs";
1
+ import type { LogType } from './LogType.js';
2
2
  /**
3
3
  * An enum of the signing method types that we are interested in logging.
4
4
  */
@@ -30,4 +30,4 @@ export type EthSignLog = {
30
30
  signingData?: any;
31
31
  };
32
32
  };
33
- //# sourceMappingURL=EthSignLog.d.mts.map
33
+ //# sourceMappingURL=EthSignLog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthSignLog.d.ts","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,oBAAY,aAAa;IACvB,YAAY,kBAAkB;IAC9B,gBAAgB,sBAAsB;IACtC,kBAAkB,yBAAyB;IAC3C,kBAAkB,yBAAyB;CAC5C;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IACzB,IAAI,EAAE;QACJ,aAAa,EAAE,aAAa,CAAC;QAC7B,KAAK,EAAE,YAAY,CAAC;QAGpB,WAAW,CAAC,EAAE,GAAG,CAAC;KACnB,CAAC;CACH,CAAC"}
@@ -17,4 +17,4 @@ export var SigningStage;
17
17
  SigningStage["Rejected"] = "rejected";
18
18
  SigningStage["Signed"] = "signed";
19
19
  })(SigningStage || (SigningStage = {}));
20
- //# sourceMappingURL=EthSignLog.mjs.map
20
+ //# sourceMappingURL=EthSignLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthSignLog.js","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,+CAA8B,CAAA;IAC9B,uDAAsC,CAAA;IACtC,4DAA2C,CAAA;IAC3C,4DAA2C,CAAA;AAC7C,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB","sourcesContent":["import type { LogType } from './LogType.js';\n\n/**\n * An enum of the signing method types that we are interested in logging.\n */\nexport enum SigningMethod {\n PersonalSign = 'personal_sign',\n EthSignTypedData = 'eth_signTypedData',\n EthSignTypedDataV3 = 'eth_signTypedData_v3',\n EthSignTypedDataV4 = 'eth_signTypedData_v4',\n}\n\n/**\n * An enum of the various stages of the signing request\n */\nexport enum SigningStage {\n Proposed = 'proposed',\n Rejected = 'rejected',\n Signed = 'signed',\n}\n\n/**\n * First special case of logging scenarios involves signing requests. In this\n * case the data provided must include the method for the signature request as\n * well as the signingData. This is intended to be used to troubleshoot and\n * investigate FLI at the user's request.\n */\nexport type EthSignLog = {\n type: LogType.EthSignLog;\n data: {\n signingMethod: SigningMethod;\n stage: SigningStage;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n signingData?: any;\n };\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import type { LogType } from './LogType.js';
2
+ export type GenericLog = {
3
+ type: LogType.GenericLog;
4
+ data: any;
5
+ };
6
+ //# sourceMappingURL=GenericLog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericLog.d.ts","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAO5C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IAGzB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GenericLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericLog.js","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogType } from './LogType.js';\n\n/*\n * The logging controller can handle any kind of log statement that may benefit\n * users and MetaMask support agents helping those users. These logs are typed\n * as generic.\n */\nexport type GenericLog = {\n type: LogType.GenericLog;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n};\n"]}
@@ -7,4 +7,4 @@ export declare enum LogType {
7
7
  GenericLog = "GenericLog",
8
8
  EthSignLog = "EthSignLog"
9
9
  }
10
- //# sourceMappingURL=LogType.d.cts.map
10
+ //# sourceMappingURL=LogType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogType.d.ts","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;CAC1B"}
@@ -8,4 +8,4 @@ export var LogType;
8
8
  LogType["GenericLog"] = "GenericLog";
9
9
  LogType["EthSignLog"] = "EthSignLog";
10
10
  })(LogType || (LogType = {}));
11
- //# sourceMappingURL=LogType.mjs.map
11
+ //# sourceMappingURL=LogType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogType.js","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,oCAAyB,CAAA;AAC3B,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB","sourcesContent":["/**\n * An enum representing the allowed types of log messages supported by this\n * controller. When adding new types of special cased log types, make sure to\n * extend this enum with the new type name.\n */\nexport enum LogType {\n GenericLog = 'GenericLog',\n EthSignLog = 'EthSignLog',\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { EthSignLog } from './EthSignLog.js';
2
+ import type { GenericLog } from './GenericLog.js';
3
+ /**
4
+ * Union of all possible log data structures.
5
+ */
6
+ export type Log = EthSignLog | GenericLog;
7
+ /**
8
+ * Export all other types from these files for usage by clients
9
+ */
10
+ export * from './EthSignLog.js';
11
+ export type * from './GenericLog.js';
12
+ export * from './LogType.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1C;;GAEG;AACH,cAAc,iBAAiB,CAAC;AAChC,mBAAmB,iBAAiB,CAAC;AACrC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Export all other types from these files for usage by clients
3
+ */
4
+ export * from './EthSignLog.js';
5
+ export * from './LogType.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,cAAc,iBAAiB,CAAC;AAEhC,cAAc,cAAc,CAAC","sourcesContent":["import type { EthSignLog } from './EthSignLog.js';\nimport type { GenericLog } from './GenericLog.js';\n\n/**\n * Union of all possible log data structures.\n */\nexport type Log = EthSignLog | GenericLog;\n\n/**\n * Export all other types from these files for usage by clients\n */\nexport * from './EthSignLog.js';\nexport type * from './GenericLog.js';\nexport * from './LogType.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/logging-controller",
3
- "version": "9.0.0-preview-8bfa290fb",
3
+ "version": "10.0.0-preview-97d6b86c0",
4
4
  "description": "Manages logging data to assist users and support staff",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -18,19 +18,12 @@
18
18
  "files": [
19
19
  "dist/"
20
20
  ],
21
+ "type": "module",
21
22
  "sideEffects": false,
22
- "main": "./dist/index.cjs",
23
- "types": "./dist/index.d.cts",
24
23
  "exports": {
25
24
  ".": {
26
- "import": {
27
- "types": "./dist/index.d.mts",
28
- "default": "./dist/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.cts",
32
- "default": "./dist/index.cjs"
33
- }
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
34
27
  },
35
28
  "./package.json": "./package.json"
36
29
  },
@@ -39,9 +32,11 @@
39
32
  "registry": "https://registry.npmjs.org/"
40
33
  },
41
34
  "scripts": {
42
- "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
43
- "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
35
+ "build": "tsc --project tsconfig.build.json",
36
+ "build:all": "tsc --build tsconfig.build.json --verbose",
37
+ "build:clean": "yarn build:only-clean && yarn build",
44
38
  "build:docs": "typedoc",
39
+ "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
45
40
  "changelog:update": "../../scripts/update-changelog.sh @metamask/logging-controller",
46
41
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/logging-controller",
47
42
  "lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts",
@@ -55,24 +50,25 @@
55
50
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
56
51
  },
57
52
  "dependencies": {
58
- "@metamask/base-controller": "^9.1.0",
59
- "@metamask/messenger": "^2.0.0",
53
+ "@metamask/base-controller": "^10.0.0",
54
+ "@metamask/messenger": "^3.0.0",
60
55
  "@metamask/utils": "^11.12.0",
61
- "uuid": "^8.3.2"
56
+ "uuid": "^9.0.1"
62
57
  },
63
58
  "devDependencies": {
64
59
  "@metamask/auto-changelog": "^6.1.0",
65
- "@ts-bridge/cli": "^0.6.4",
66
60
  "@types/jest": "^30.0.0",
61
+ "@typescript/native": "npm:typescript@^7.0.2",
67
62
  "deepmerge": "^4.2.2",
68
63
  "jest": "^30.4.2",
64
+ "rimraf": "^5.0.5",
69
65
  "ts-jest": "^29.4.11",
70
66
  "tsx": "^4.20.5",
71
67
  "typedoc": "^0.25.13",
72
68
  "typedoc-plugin-missing-exports": "^2.0.0",
73
- "typescript": "~5.3.3"
69
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
74
70
  },
75
71
  "engines": {
76
- "node": "^18.18 || >=20"
72
+ "node": "^22.14.0 || ^24"
77
73
  }
78
74
  }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file is auto generated.
4
- * Do not edit manually.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=LoggingController-method-action-types.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController-method-action-types.cjs","sourceRoot":"","sources":["../src/LoggingController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { LoggingController } from './LoggingController.js';\n\n/**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\nexport type LoggingControllerAddAction = {\n type: `LoggingController:add`;\n handler: LoggingController['add'];\n};\n\n/**\n * Removes all log entries.\n */\nexport type LoggingControllerClearAction = {\n type: `LoggingController:clear`;\n handler: LoggingController['clear'];\n};\n\n/**\n * Union of all LoggingController action types.\n */\nexport type LoggingControllerMethodActions =\n | LoggingControllerAddAction\n | LoggingControllerClearAction;\n"]}
@@ -1,26 +0,0 @@
1
- /**
2
- * This file is auto generated.
3
- * Do not edit manually.
4
- */
5
- import type { LoggingController } from "./LoggingController.cjs";
6
- /**
7
- * Add log to the state.
8
- *
9
- * @param log - Log to add to the controller
10
- */
11
- export type LoggingControllerAddAction = {
12
- type: `LoggingController:add`;
13
- handler: LoggingController['add'];
14
- };
15
- /**
16
- * Removes all log entries.
17
- */
18
- export type LoggingControllerClearAction = {
19
- type: `LoggingController:clear`;
20
- handler: LoggingController['clear'];
21
- };
22
- /**
23
- * Union of all LoggingController action types.
24
- */
25
- export type LoggingControllerMethodActions = LoggingControllerAddAction | LoggingControllerClearAction;
26
- //# sourceMappingURL=LoggingController-method-action-types.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController-method-action-types.d.cts","sourceRoot":"","sources":["../src/LoggingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA+B;AAEhE;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,0BAA0B,GAC1B,4BAA4B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController-method-action-types.d.mts","sourceRoot":"","sources":["../src/LoggingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA+B;AAEhE;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,0BAA0B,GAC1B,4BAA4B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController-method-action-types.mjs","sourceRoot":"","sources":["../src/LoggingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { LoggingController } from './LoggingController.js';\n\n/**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\nexport type LoggingControllerAddAction = {\n type: `LoggingController:add`;\n handler: LoggingController['add'];\n};\n\n/**\n * Removes all log entries.\n */\nexport type LoggingControllerClearAction = {\n type: `LoggingController:clear`;\n handler: LoggingController['clear'];\n};\n\n/**\n * Union of all LoggingController action types.\n */\nexport type LoggingControllerMethodActions =\n | LoggingControllerAddAction\n | LoggingControllerClearAction;\n"]}
@@ -1,90 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _LoggingController_expiryTime;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.LoggingController = void 0;
16
- const base_controller_1 = require("@metamask/base-controller");
17
- const utils_1 = require("@metamask/utils");
18
- const uuid_1 = require("uuid");
19
- const name = 'LoggingController';
20
- const MESSENGER_EXPOSED_METHODS = ['add', 'clear'];
21
- const metadata = {
22
- logs: {
23
- includeInStateLogs: true,
24
- persist: true,
25
- includeInDebugSnapshot: false,
26
- usedInUi: false,
27
- },
28
- };
29
- const defaultState = {
30
- logs: {},
31
- };
32
- /**
33
- * Controller that manages a list of logs for signature requests.
34
- */
35
- class LoggingController extends base_controller_1.BaseController {
36
- /**
37
- * Creates a LoggingController instance.
38
- *
39
- * @param options - Constructor options
40
- * @param options.messenger - An instance of the Messenger
41
- * @param options.state - Initial state to set on this controller.
42
- * @param options.expiryTime - The number of milliseconds before we consider a log entry expired.
43
- */
44
- constructor({ messenger, state, expiryTime = (0, utils_1.inMilliseconds)(7, utils_1.Duration.Day), }) {
45
- super({
46
- name,
47
- metadata,
48
- messenger,
49
- state: {
50
- ...defaultState,
51
- ...state,
52
- },
53
- });
54
- _LoggingController_expiryTime.set(this, void 0);
55
- __classPrivateFieldSet(this, _LoggingController_expiryTime, expiryTime, "f");
56
- this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
57
- }
58
- /**
59
- * Add log to the state.
60
- *
61
- * @param log - Log to add to the controller
62
- */
63
- add(log) {
64
- const newLog = {
65
- id: (0, uuid_1.v4)(),
66
- timestamp: Date.now(),
67
- log,
68
- };
69
- const expiry = Date.now() - __classPrivateFieldGet(this, _LoggingController_expiryTime, "f");
70
- this.update((state) => {
71
- for (const [id, entry] of Object.entries(state.logs)) {
72
- if (entry.timestamp < expiry) {
73
- delete state.logs[id];
74
- }
75
- }
76
- state.logs[newLog.id] = newLog;
77
- });
78
- }
79
- /**
80
- * Removes all log entries.
81
- */
82
- clear() {
83
- this.update((state) => {
84
- state.logs = {};
85
- });
86
- }
87
- }
88
- exports.LoggingController = LoggingController;
89
- _LoggingController_expiryTime = new WeakMap();
90
- //# sourceMappingURL=LoggingController.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController.cjs","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,+DAA2D;AAE3D,2CAA2D;AAC3D,+BAAkC;AA2BlC,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,OAAO,CAAU,CAAC;AAwB5D,MAAM,QAAQ,GAA0C;IACtD,IAAI,EAAE;QACJ,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,KAAK;QAC7B,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;GAEG;AACH,MAAa,iBAAkB,SAAQ,gCAItC;IAGC;;;;;;;OAOG;IACH,YAAY,EACV,SAAS,EACT,KAAK,EACL,UAAU,GAAG,IAAA,sBAAc,EAAC,CAAC,EAAE,gBAAQ,CAAC,GAAG,CAAC,GAK7C;QACC,KAAK,CAAC;YACJ,IAAI;YACJ,QAAQ;YACR,SAAS;YACT,KAAK,EAAE;gBACL,GAAG,YAAY;gBACf,GAAG,KAAK;aACT;SACF,CAAC,CAAC;QA3BI,gDAAoB;QA6B3B,uBAAA,IAAI,iCAAe,UAAU,MAAA,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,4BAA4B,CACzC,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,GAAQ;QACV,MAAM,MAAM,GAAa;YACvB,EAAE,EAAE,IAAA,SAAI,GAAE;YACV,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,GAAG;SACJ,CAAC;QAEF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,uBAAA,IAAI,qCAAY,CAAC;QAE7C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;oBAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1ED,8CA0EC","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport { Duration, inMilliseconds } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type { LoggingControllerMethodActions } from './LoggingController-method-action-types.js';\nimport type { Log } from './logTypes/index.js';\n\n/**\n * LogEntry is the entry that will be added to the logging controller state.\n * It consists of a entry key that must be on of the Log union types, and an\n * additional id and timestamp.\n */\nexport type LogEntry = {\n id: string;\n timestamp: number;\n log: Log;\n};\n\n/**\n * Logging controller state\n *\n * @property logs - An object of logs indexed by their ids\n */\nexport type LoggingControllerState = {\n logs: {\n [id: string]: LogEntry;\n };\n};\n\nconst name = 'LoggingController';\n\nconst MESSENGER_EXPOSED_METHODS = ['add', 'clear'] as const;\n\nexport type LoggingControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerActions =\n | LoggingControllerGetStateAction\n | LoggingControllerMethodActions;\n\nexport type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerEvents = LoggingControllerStateChangeEvent;\n\nexport type LoggingControllerMessenger = Messenger<\n typeof name,\n LoggingControllerActions,\n LoggingControllerEvents\n>;\n\nconst metadata: StateMetadata<LoggingControllerState> = {\n logs: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: false,\n },\n};\n\nconst defaultState = {\n logs: {},\n};\n\n/**\n * Controller that manages a list of logs for signature requests.\n */\nexport class LoggingController extends BaseController<\n typeof name,\n LoggingControllerState,\n LoggingControllerMessenger\n> {\n readonly #expiryTime: number;\n\n /**\n * Creates a LoggingController instance.\n *\n * @param options - Constructor options\n * @param options.messenger - An instance of the Messenger\n * @param options.state - Initial state to set on this controller.\n * @param options.expiryTime - The number of milliseconds before we consider a log entry expired.\n */\n constructor({\n messenger,\n state,\n expiryTime = inMilliseconds(7, Duration.Day),\n }: {\n messenger: LoggingControllerMessenger;\n state?: Partial<LoggingControllerState>;\n expiryTime?: number;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...defaultState,\n ...state,\n },\n });\n\n this.#expiryTime = expiryTime;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\n add(log: Log) {\n const newLog: LogEntry = {\n id: uuid(),\n timestamp: Date.now(),\n log,\n };\n\n const expiry = Date.now() - this.#expiryTime;\n\n this.update((state) => {\n for (const [id, entry] of Object.entries(state.logs)) {\n if (entry.timestamp < expiry) {\n delete state.logs[id];\n }\n }\n state.logs[newLog.id] = newLog;\n });\n }\n\n /**\n * Removes all log entries.\n */\n clear() {\n this.update((state) => {\n state.logs = {};\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController.d.cts","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAIrD,OAAO,KAAK,EAAE,8BAA8B,EAAE,oDAAmD;AACjG,OAAO,KAAK,EAAE,GAAG,EAAE,6BAA4B;AAE/C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE;QACJ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,IAAI,sBAAsB,CAAC;AAIjC,MAAM,MAAM,+BAA+B,GAAG,wBAAwB,CACpE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAChC,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC,MAAM,MAAM,iCAAiC,GAAG,0BAA0B,CACxE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,SAAS,CAChD,OAAO,IAAI,EACX,wBAAwB,EACxB,uBAAuB,CACxB,CAAC;AAeF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CACnD,OAAO,IAAI,EACX,sBAAsB,EACtB,0BAA0B,CAC3B;;IAGC;;;;;;;OAOG;gBACS,EACV,SAAS,EACT,KAAK,EACL,UAA4C,GAC7C,EAAE;QACD,SAAS,EAAE,0BAA0B,CAAC;QACtC,KAAK,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACxC,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAmBD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG;IAmBZ;;OAEG;IACH,KAAK;CAKN"}
@@ -1,62 +0,0 @@
1
- import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
2
- import { BaseController } from "@metamask/base-controller";
3
- import type { Messenger } from "@metamask/messenger";
4
- import type { LoggingControllerMethodActions } from "./LoggingController-method-action-types.mjs";
5
- import type { Log } from "./logTypes/index.mjs";
6
- /**
7
- * LogEntry is the entry that will be added to the logging controller state.
8
- * It consists of a entry key that must be on of the Log union types, and an
9
- * additional id and timestamp.
10
- */
11
- export type LogEntry = {
12
- id: string;
13
- timestamp: number;
14
- log: Log;
15
- };
16
- /**
17
- * Logging controller state
18
- *
19
- * @property logs - An object of logs indexed by their ids
20
- */
21
- export type LoggingControllerState = {
22
- logs: {
23
- [id: string]: LogEntry;
24
- };
25
- };
26
- declare const name = "LoggingController";
27
- export type LoggingControllerGetStateAction = ControllerGetStateAction<typeof name, LoggingControllerState>;
28
- export type LoggingControllerActions = LoggingControllerGetStateAction | LoggingControllerMethodActions;
29
- export type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<typeof name, LoggingControllerState>;
30
- export type LoggingControllerEvents = LoggingControllerStateChangeEvent;
31
- export type LoggingControllerMessenger = Messenger<typeof name, LoggingControllerActions, LoggingControllerEvents>;
32
- /**
33
- * Controller that manages a list of logs for signature requests.
34
- */
35
- export declare class LoggingController extends BaseController<typeof name, LoggingControllerState, LoggingControllerMessenger> {
36
- #private;
37
- /**
38
- * Creates a LoggingController instance.
39
- *
40
- * @param options - Constructor options
41
- * @param options.messenger - An instance of the Messenger
42
- * @param options.state - Initial state to set on this controller.
43
- * @param options.expiryTime - The number of milliseconds before we consider a log entry expired.
44
- */
45
- constructor({ messenger, state, expiryTime, }: {
46
- messenger: LoggingControllerMessenger;
47
- state?: Partial<LoggingControllerState>;
48
- expiryTime?: number;
49
- });
50
- /**
51
- * Add log to the state.
52
- *
53
- * @param log - Log to add to the controller
54
- */
55
- add(log: Log): void;
56
- /**
57
- * Removes all log entries.
58
- */
59
- clear(): void;
60
- }
61
- export {};
62
- //# sourceMappingURL=LoggingController.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController.d.mts","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAIrD,OAAO,KAAK,EAAE,8BAA8B,EAAE,oDAAmD;AACjG,OAAO,KAAK,EAAE,GAAG,EAAE,6BAA4B;AAE/C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE;QACJ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,IAAI,sBAAsB,CAAC;AAIjC,MAAM,MAAM,+BAA+B,GAAG,wBAAwB,CACpE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAChC,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC,MAAM,MAAM,iCAAiC,GAAG,0BAA0B,CACxE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,SAAS,CAChD,OAAO,IAAI,EACX,wBAAwB,EACxB,uBAAuB,CACxB,CAAC;AAeF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CACnD,OAAO,IAAI,EACX,sBAAsB,EACtB,0BAA0B,CAC3B;;IAGC;;;;;;;OAOG;gBACS,EACV,SAAS,EACT,KAAK,EACL,UAA4C,GAC7C,EAAE;QACD,SAAS,EAAE,0BAA0B,CAAC;QACtC,KAAK,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACxC,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAmBD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG;IAmBZ;;OAEG;IACH,KAAK;CAKN"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingController.mjs","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAE3D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,wBAAwB;AAC3D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AA2BlC,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,OAAO,CAAU,CAAC;AAwB5D,MAAM,QAAQ,GAA0C;IACtD,IAAI,EAAE;QACJ,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,KAAK;QAC7B,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAItC;IAGC;;;;;;;OAOG;IACH,YAAY,EACV,SAAS,EACT,KAAK,EACL,UAAU,GAAG,cAAc,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAK7C;QACC,KAAK,CAAC;YACJ,IAAI;YACJ,QAAQ;YACR,SAAS;YACT,KAAK,EAAE;gBACL,GAAG,YAAY;gBACf,GAAG,KAAK;aACT;SACF,CAAC,CAAC;QA3BI,gDAAoB;QA6B3B,uBAAA,IAAI,iCAAe,UAAU,MAAA,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,4BAA4B,CACzC,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,GAAQ;QACV,MAAM,MAAM,GAAa;YACvB,EAAE,EAAE,IAAI,EAAE;YACV,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,GAAG;SACJ,CAAC;QAEF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,uBAAA,IAAI,qCAAY,CAAC;QAE7C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;oBAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport { Duration, inMilliseconds } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type { LoggingControllerMethodActions } from './LoggingController-method-action-types.js';\nimport type { Log } from './logTypes/index.js';\n\n/**\n * LogEntry is the entry that will be added to the logging controller state.\n * It consists of a entry key that must be on of the Log union types, and an\n * additional id and timestamp.\n */\nexport type LogEntry = {\n id: string;\n timestamp: number;\n log: Log;\n};\n\n/**\n * Logging controller state\n *\n * @property logs - An object of logs indexed by their ids\n */\nexport type LoggingControllerState = {\n logs: {\n [id: string]: LogEntry;\n };\n};\n\nconst name = 'LoggingController';\n\nconst MESSENGER_EXPOSED_METHODS = ['add', 'clear'] as const;\n\nexport type LoggingControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerActions =\n | LoggingControllerGetStateAction\n | LoggingControllerMethodActions;\n\nexport type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerEvents = LoggingControllerStateChangeEvent;\n\nexport type LoggingControllerMessenger = Messenger<\n typeof name,\n LoggingControllerActions,\n LoggingControllerEvents\n>;\n\nconst metadata: StateMetadata<LoggingControllerState> = {\n logs: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: false,\n },\n};\n\nconst defaultState = {\n logs: {},\n};\n\n/**\n * Controller that manages a list of logs for signature requests.\n */\nexport class LoggingController extends BaseController<\n typeof name,\n LoggingControllerState,\n LoggingControllerMessenger\n> {\n readonly #expiryTime: number;\n\n /**\n * Creates a LoggingController instance.\n *\n * @param options - Constructor options\n * @param options.messenger - An instance of the Messenger\n * @param options.state - Initial state to set on this controller.\n * @param options.expiryTime - The number of milliseconds before we consider a log entry expired.\n */\n constructor({\n messenger,\n state,\n expiryTime = inMilliseconds(7, Duration.Day),\n }: {\n messenger: LoggingControllerMessenger;\n state?: Partial<LoggingControllerState>;\n expiryTime?: number;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...defaultState,\n ...state,\n },\n });\n\n this.#expiryTime = expiryTime;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\n add(log: Log) {\n const newLog: LogEntry = {\n id: uuid(),\n timestamp: Date.now(),\n log,\n };\n\n const expiry = Date.now() - this.#expiryTime;\n\n this.update((state) => {\n for (const [id, entry] of Object.entries(state.logs)) {\n if (entry.timestamp < expiry) {\n delete state.logs[id];\n }\n }\n state.logs[newLog.id] = newLog;\n });\n }\n\n /**\n * Removes all log entries.\n */\n clear() {\n this.update((state) => {\n state.logs = {};\n });\n }\n}\n"]}
package/dist/index.cjs DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./LoggingController.cjs"), exports);
18
- __exportStar(require("./logTypes/index.cjs"), exports);
19
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AAKvC,uDAAoC","sourcesContent":["export * from './LoggingController.js';\nexport type {\n LoggingControllerAddAction,\n LoggingControllerClearAction,\n} from './LoggingController-method-action-types.js';\nexport * from './logTypes/index.js';\n"]}
package/dist/index.d.cts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./LoggingController.cjs";
2
- export type { LoggingControllerAddAction, LoggingControllerClearAction, } from "./LoggingController-method-action-types.cjs";
3
- export * from "./logTypes/index.cjs";
4
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAuC;AACvC,YAAY,EACV,0BAA0B,EAC1B,4BAA4B,GAC7B,oDAAmD;AACpD,qCAAoC"}
package/dist/index.d.mts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./LoggingController.mjs";
2
- export type { LoggingControllerAddAction, LoggingControllerClearAction, } from "./LoggingController-method-action-types.mjs";
3
- export * from "./logTypes/index.mjs";
4
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAuC;AACvC,YAAY,EACV,0BAA0B,EAC1B,4BAA4B,GAC7B,oDAAmD;AACpD,qCAAoC"}
package/dist/index.mjs DELETED
@@ -1,3 +0,0 @@
1
- export * from "./LoggingController.mjs";
2
- export * from "./logTypes/index.mjs";
3
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAuC;AAKvC,qCAAoC","sourcesContent":["export * from './LoggingController.js';\nexport type {\n LoggingControllerAddAction,\n LoggingControllerClearAction,\n} from './LoggingController-method-action-types.js';\nexport * from './logTypes/index.js';\n"]}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SigningStage = exports.SigningMethod = void 0;
4
- /**
5
- * An enum of the signing method types that we are interested in logging.
6
- */
7
- var SigningMethod;
8
- (function (SigningMethod) {
9
- SigningMethod["PersonalSign"] = "personal_sign";
10
- SigningMethod["EthSignTypedData"] = "eth_signTypedData";
11
- SigningMethod["EthSignTypedDataV3"] = "eth_signTypedData_v3";
12
- SigningMethod["EthSignTypedDataV4"] = "eth_signTypedData_v4";
13
- })(SigningMethod || (exports.SigningMethod = SigningMethod = {}));
14
- /**
15
- * An enum of the various stages of the signing request
16
- */
17
- var SigningStage;
18
- (function (SigningStage) {
19
- SigningStage["Proposed"] = "proposed";
20
- SigningStage["Rejected"] = "rejected";
21
- SigningStage["Signed"] = "signed";
22
- })(SigningStage || (exports.SigningStage = SigningStage = {}));
23
- //# sourceMappingURL=EthSignLog.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthSignLog.cjs","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,+CAA8B,CAAA;IAC9B,uDAAsC,CAAA;IACtC,4DAA2C,CAAA;IAC3C,4DAA2C,CAAA;AAC7C,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB;AAED;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB","sourcesContent":["import type { LogType } from './LogType.js';\n\n/**\n * An enum of the signing method types that we are interested in logging.\n */\nexport enum SigningMethod {\n PersonalSign = 'personal_sign',\n EthSignTypedData = 'eth_signTypedData',\n EthSignTypedDataV3 = 'eth_signTypedData_v3',\n EthSignTypedDataV4 = 'eth_signTypedData_v4',\n}\n\n/**\n * An enum of the various stages of the signing request\n */\nexport enum SigningStage {\n Proposed = 'proposed',\n Rejected = 'rejected',\n Signed = 'signed',\n}\n\n/**\n * First special case of logging scenarios involves signing requests. In this\n * case the data provided must include the method for the signature request as\n * well as the signingData. This is intended to be used to troubleshoot and\n * investigate FLI at the user's request.\n */\nexport type EthSignLog = {\n type: LogType.EthSignLog;\n data: {\n signingMethod: SigningMethod;\n stage: SigningStage;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n signingData?: any;\n };\n};\n"]}
@@ -1,33 +0,0 @@
1
- import type { LogType } from "./LogType.cjs";
2
- /**
3
- * An enum of the signing method types that we are interested in logging.
4
- */
5
- export declare enum SigningMethod {
6
- PersonalSign = "personal_sign",
7
- EthSignTypedData = "eth_signTypedData",
8
- EthSignTypedDataV3 = "eth_signTypedData_v3",
9
- EthSignTypedDataV4 = "eth_signTypedData_v4"
10
- }
11
- /**
12
- * An enum of the various stages of the signing request
13
- */
14
- export declare enum SigningStage {
15
- Proposed = "proposed",
16
- Rejected = "rejected",
17
- Signed = "signed"
18
- }
19
- /**
20
- * First special case of logging scenarios involves signing requests. In this
21
- * case the data provided must include the method for the signature request as
22
- * well as the signingData. This is intended to be used to troubleshoot and
23
- * investigate FLI at the user's request.
24
- */
25
- export type EthSignLog = {
26
- type: LogType.EthSignLog;
27
- data: {
28
- signingMethod: SigningMethod;
29
- stage: SigningStage;
30
- signingData?: any;
31
- };
32
- };
33
- //# sourceMappingURL=EthSignLog.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthSignLog.d.cts","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAqB;AAE5C;;GAEG;AACH,oBAAY,aAAa;IACvB,YAAY,kBAAkB;IAC9B,gBAAgB,sBAAsB;IACtC,kBAAkB,yBAAyB;IAC3C,kBAAkB,yBAAyB;CAC5C;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IACzB,IAAI,EAAE;QACJ,aAAa,EAAE,aAAa,CAAC;QAC7B,KAAK,EAAE,YAAY,CAAC;QAGpB,WAAW,CAAC,EAAE,GAAG,CAAC;KACnB,CAAC;CACH,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthSignLog.d.mts","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAqB;AAE5C;;GAEG;AACH,oBAAY,aAAa;IACvB,YAAY,kBAAkB;IAC9B,gBAAgB,sBAAsB;IACtC,kBAAkB,yBAAyB;IAC3C,kBAAkB,yBAAyB;CAC5C;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IACzB,IAAI,EAAE;QACJ,aAAa,EAAE,aAAa,CAAC;QAC7B,KAAK,EAAE,YAAY,CAAC;QAGpB,WAAW,CAAC,EAAE,GAAG,CAAC;KACnB,CAAC;CACH,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthSignLog.mjs","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,+CAA8B,CAAA;IAC9B,uDAAsC,CAAA;IACtC,4DAA2C,CAAA;IAC3C,4DAA2C,CAAA;AAC7C,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB","sourcesContent":["import type { LogType } from './LogType.js';\n\n/**\n * An enum of the signing method types that we are interested in logging.\n */\nexport enum SigningMethod {\n PersonalSign = 'personal_sign',\n EthSignTypedData = 'eth_signTypedData',\n EthSignTypedDataV3 = 'eth_signTypedData_v3',\n EthSignTypedDataV4 = 'eth_signTypedData_v4',\n}\n\n/**\n * An enum of the various stages of the signing request\n */\nexport enum SigningStage {\n Proposed = 'proposed',\n Rejected = 'rejected',\n Signed = 'signed',\n}\n\n/**\n * First special case of logging scenarios involves signing requests. In this\n * case the data provided must include the method for the signature request as\n * well as the signingData. This is intended to be used to troubleshoot and\n * investigate FLI at the user's request.\n */\nexport type EthSignLog = {\n type: LogType.EthSignLog;\n data: {\n signingMethod: SigningMethod;\n stage: SigningStage;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n signingData?: any;\n };\n};\n"]}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=GenericLog.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenericLog.cjs","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogType } from './LogType.js';\n\n/*\n * The logging controller can handle any kind of log statement that may benefit\n * users and MetaMask support agents helping those users. These logs are typed\n * as generic.\n */\nexport type GenericLog = {\n type: LogType.GenericLog;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n};\n"]}
@@ -1,6 +0,0 @@
1
- import type { LogType } from "./LogType.cjs";
2
- export type GenericLog = {
3
- type: LogType.GenericLog;
4
- data: any;
5
- };
6
- //# sourceMappingURL=GenericLog.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenericLog.d.cts","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAqB;AAO5C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IAGzB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { LogType } from "./LogType.mjs";
2
- export type GenericLog = {
3
- type: LogType.GenericLog;
4
- data: any;
5
- };
6
- //# sourceMappingURL=GenericLog.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenericLog.d.mts","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAqB;AAO5C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IAGzB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=GenericLog.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenericLog.mjs","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogType } from './LogType.js';\n\n/*\n * The logging controller can handle any kind of log statement that may benefit\n * users and MetaMask support agents helping those users. These logs are typed\n * as generic.\n */\nexport type GenericLog = {\n type: LogType.GenericLog;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n};\n"]}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogType = void 0;
4
- /**
5
- * An enum representing the allowed types of log messages supported by this
6
- * controller. When adding new types of special cased log types, make sure to
7
- * extend this enum with the new type name.
8
- */
9
- var LogType;
10
- (function (LogType) {
11
- LogType["GenericLog"] = "GenericLog";
12
- LogType["EthSignLog"] = "EthSignLog";
13
- })(LogType || (exports.LogType = LogType = {}));
14
- //# sourceMappingURL=LogType.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogType.cjs","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,oCAAyB,CAAA;AAC3B,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB","sourcesContent":["/**\n * An enum representing the allowed types of log messages supported by this\n * controller. When adding new types of special cased log types, make sure to\n * extend this enum with the new type name.\n */\nexport enum LogType {\n GenericLog = 'GenericLog',\n EthSignLog = 'EthSignLog',\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogType.d.cts","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;CAC1B"}
@@ -1,10 +0,0 @@
1
- /**
2
- * An enum representing the allowed types of log messages supported by this
3
- * controller. When adding new types of special cased log types, make sure to
4
- * extend this enum with the new type name.
5
- */
6
- export declare enum LogType {
7
- GenericLog = "GenericLog",
8
- EthSignLog = "EthSignLog"
9
- }
10
- //# sourceMappingURL=LogType.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogType.d.mts","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;CAC1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogType.mjs","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,oCAAyB,CAAA;AAC3B,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB","sourcesContent":["/**\n * An enum representing the allowed types of log messages supported by this\n * controller. When adding new types of special cased log types, make sure to\n * extend this enum with the new type name.\n */\nexport enum LogType {\n GenericLog = 'GenericLog',\n EthSignLog = 'EthSignLog',\n}\n"]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * Export all other types from these files for usage by clients
19
- */
20
- __exportStar(require("./EthSignLog.cjs"), exports);
21
- __exportStar(require("./LogType.cjs"), exports);
22
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAQA;;GAEG;AACH,mDAAgC;AAEhC,gDAA6B","sourcesContent":["import type { EthSignLog } from './EthSignLog.js';\nimport type { GenericLog } from './GenericLog.js';\n\n/**\n * Union of all possible log data structures.\n */\nexport type Log = EthSignLog | GenericLog;\n\n/**\n * Export all other types from these files for usage by clients\n */\nexport * from './EthSignLog.js';\nexport type * from './GenericLog.js';\nexport * from './LogType.js';\n"]}
@@ -1,13 +0,0 @@
1
- import type { EthSignLog } from "./EthSignLog.cjs";
2
- import type { GenericLog } from "./GenericLog.cjs";
3
- /**
4
- * Union of all possible log data structures.
5
- */
6
- export type Log = EthSignLog | GenericLog;
7
- /**
8
- * Export all other types from these files for usage by clients
9
- */
10
- export * from "./EthSignLog.cjs";
11
- export type * from "./GenericLog.cjs";
12
- export * from "./LogType.cjs";
13
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAwB;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAwB;AAElD;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1C;;GAEG;AACH,iCAAgC;AAChC,sCAAqC;AACrC,8BAA6B"}
@@ -1,13 +0,0 @@
1
- import type { EthSignLog } from "./EthSignLog.mjs";
2
- import type { GenericLog } from "./GenericLog.mjs";
3
- /**
4
- * Union of all possible log data structures.
5
- */
6
- export type Log = EthSignLog | GenericLog;
7
- /**
8
- * Export all other types from these files for usage by clients
9
- */
10
- export * from "./EthSignLog.mjs";
11
- export type * from "./GenericLog.mjs";
12
- export * from "./LogType.mjs";
13
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAwB;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAwB;AAElD;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1C;;GAEG;AACH,iCAAgC;AAChC,sCAAqC;AACrC,8BAA6B"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Export all other types from these files for usage by clients
3
- */
4
- export * from "./EthSignLog.mjs";
5
- export * from "./LogType.mjs";
6
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,iCAAgC;AAEhC,8BAA6B","sourcesContent":["import type { EthSignLog } from './EthSignLog.js';\nimport type { GenericLog } from './GenericLog.js';\n\n/**\n * Union of all possible log data structures.\n */\nexport type Log = EthSignLog | GenericLog;\n\n/**\n * Export all other types from these files for usage by clients\n */\nexport * from './EthSignLog.js';\nexport type * from './GenericLog.js';\nexport * from './LogType.js';\n"]}