@beignet/devtools 0.0.1 → 0.0.3

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 (60) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +2 -0
  3. package/dist/access.d.ts +20 -0
  4. package/dist/access.d.ts.map +1 -1
  5. package/dist/access.js +11 -0
  6. package/dist/access.js.map +1 -1
  7. package/dist/audit.d.ts +21 -0
  8. package/dist/audit.d.ts.map +1 -1
  9. package/dist/audit.js +6 -0
  10. package/dist/audit.js.map +1 -1
  11. package/dist/events.d.ts +19 -1
  12. package/dist/events.d.ts.map +1 -1
  13. package/dist/events.js +6 -0
  14. package/dist/events.js.map +1 -1
  15. package/dist/instrumentation.d.ts +40 -0
  16. package/dist/instrumentation.d.ts.map +1 -1
  17. package/dist/instrumentation.js +10 -0
  18. package/dist/instrumentation.js.map +1 -1
  19. package/dist/persistence.d.ts +24 -0
  20. package/dist/persistence.d.ts.map +1 -1
  21. package/dist/persistence.js +6 -0
  22. package/dist/persistence.js.map +1 -1
  23. package/dist/provider-instrumentation.d.ts +18 -0
  24. package/dist/provider-instrumentation.d.ts.map +1 -1
  25. package/dist/provider-instrumentation.js +9 -0
  26. package/dist/provider-instrumentation.js.map +1 -1
  27. package/dist/provider.d.ts +42 -0
  28. package/dist/provider.d.ts.map +1 -1
  29. package/dist/provider.js +3 -0
  30. package/dist/provider.js.map +1 -1
  31. package/dist/redaction.d.ts +9 -0
  32. package/dist/redaction.d.ts.map +1 -1
  33. package/dist/redaction.js +9 -0
  34. package/dist/redaction.js.map +1 -1
  35. package/dist/routes.d.ts +12 -0
  36. package/dist/routes.d.ts.map +1 -1
  37. package/dist/routes.js.map +1 -1
  38. package/dist/trace-context.d.ts +51 -0
  39. package/dist/trace-context.d.ts.map +1 -1
  40. package/dist/trace-context.js +18 -0
  41. package/dist/trace-context.js.map +1 -1
  42. package/dist/ui.js +12 -2
  43. package/dist/ui.js.map +1 -1
  44. package/dist/watchers.d.ts +43 -1
  45. package/dist/watchers.d.ts.map +1 -1
  46. package/dist/watchers.js +28 -0
  47. package/dist/watchers.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/access.ts +20 -0
  50. package/src/audit.ts +21 -0
  51. package/src/events.ts +25 -1
  52. package/src/instrumentation.ts +40 -0
  53. package/src/persistence.ts +24 -0
  54. package/src/provider-instrumentation.ts +20 -0
  55. package/src/provider.ts +42 -0
  56. package/src/redaction.ts +9 -0
  57. package/src/routes.ts +12 -0
  58. package/src/trace-context.ts +51 -0
  59. package/src/ui.ts +12 -2
  60. package/src/watchers.ts +58 -0
package/src/watchers.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { DevtoolsEvent } from "./events";
2
2
 
3
+ /**
4
+ * Built-in devtools watcher names.
5
+ */
3
6
  export const BUILT_IN_DEVTOOLS_WATCHER_NAMES = [
4
7
  "requests",
5
8
  "errors",
@@ -11,26 +14,55 @@ export const BUILT_IN_DEVTOOLS_WATCHER_NAMES = [
11
14
  "db",
12
15
  "cache",
13
16
  "storage",
17
+ "uploads",
14
18
  "mail",
19
+ "notifications",
15
20
  "auth",
16
21
  "audit",
17
22
  "rateLimit",
18
23
  "custom",
19
24
  ] as const;
20
25
 
26
+ /**
27
+ * Name of a built-in devtools watcher.
28
+ */
21
29
  export type BuiltInDevtoolsWatcherName =
22
30
  (typeof BUILT_IN_DEVTOOLS_WATCHER_NAMES)[number];
23
31
 
32
+ /**
33
+ * Name of a built-in or app-defined devtools watcher.
34
+ */
24
35
  export type DevtoolsWatcherName = BuiltInDevtoolsWatcherName | (string & {});
25
36
 
37
+ /**
38
+ * Resolved devtools watcher configuration.
39
+ */
26
40
  export interface DevtoolsWatcher {
41
+ /**
42
+ * Watcher name.
43
+ */
27
44
  name: DevtoolsWatcherName;
45
+ /**
46
+ * Display label.
47
+ */
28
48
  label: string;
49
+ /**
50
+ * Display description.
51
+ */
29
52
  description?: string;
53
+ /**
54
+ * Event types this watcher owns.
55
+ */
30
56
  eventTypes: readonly DevtoolsEvent["type"][];
57
+ /**
58
+ * Whether events owned by this watcher should be stored.
59
+ */
31
60
  enabled: boolean;
32
61
  }
33
62
 
63
+ /**
64
+ * User-provided watcher override.
65
+ */
34
66
  export type DevtoolsWatcherOptions =
35
67
  | boolean
36
68
  | {
@@ -40,6 +72,9 @@ export type DevtoolsWatcherOptions =
40
72
  eventTypes?: readonly DevtoolsEvent["type"][];
41
73
  };
42
74
 
75
+ /**
76
+ * Watcher overrides keyed by built-in or custom watcher name.
77
+ */
43
78
  export type DevtoolsWatchersOptions = Partial<
44
79
  Record<BuiltInDevtoolsWatcherName, DevtoolsWatcherOptions>
45
80
  > &
@@ -117,6 +152,13 @@ const BUILT_IN_DEVTOOLS_WATCHERS = {
117
152
  eventTypes: ["custom"],
118
153
  enabled: true,
119
154
  },
155
+ uploads: {
156
+ name: "uploads",
157
+ label: "Uploads",
158
+ description: "Upload preparation, direct upload signing, and completion.",
159
+ eventTypes: ["custom"],
160
+ enabled: true,
161
+ },
120
162
  mail: {
121
163
  name: "mail",
122
164
  label: "Mail",
@@ -124,6 +166,13 @@ const BUILT_IN_DEVTOOLS_WATCHERS = {
124
166
  eventTypes: ["custom"],
125
167
  enabled: true,
126
168
  },
169
+ notifications: {
170
+ name: "notifications",
171
+ label: "Notifications",
172
+ description: "Application notification intent and channel delivery.",
173
+ eventTypes: ["custom"],
174
+ enabled: true,
175
+ },
127
176
  auth: {
128
177
  name: "auth",
129
178
  label: "Auth",
@@ -184,6 +233,9 @@ function normalizeWatcherOptions(
184
233
  };
185
234
  }
186
235
 
236
+ /**
237
+ * Resolve built-in and custom watcher configuration.
238
+ */
187
239
  export function resolveDevtoolsWatchers(
188
240
  options: DevtoolsWatchersOptions = {},
189
241
  ): DevtoolsWatcher[] {
@@ -211,6 +263,9 @@ export function resolveDevtoolsWatchers(
211
263
  return watchers;
212
264
  }
213
265
 
266
+ /**
267
+ * Check whether a watcher is enabled.
268
+ */
214
269
  export function isDevtoolsWatcherEnabled(
215
270
  watchers: readonly DevtoolsWatcher[],
216
271
  name: DevtoolsWatcherName,
@@ -218,6 +273,9 @@ export function isDevtoolsWatcherEnabled(
218
273
  return watchers.find((watcher) => watcher.name === name)?.enabled ?? true;
219
274
  }
220
275
 
276
+ /**
277
+ * Check whether an event should be stored for a watcher configuration.
278
+ */
221
279
  export function isDevtoolsEventEnabled(
222
280
  watchers: readonly DevtoolsWatcher[],
223
281
  event: DevtoolsEvent,