@osqd/bothandlerjs 0.3.0 → 0.5.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +157 -1
  2. package/README.md +1 -1
  3. package/dist/challenge/index.d.ts +18 -0
  4. package/dist/challenge/interaction.d.ts +215 -0
  5. package/dist/challenge/page.d.ts +18 -0
  6. package/dist/cli.cjs +829 -71
  7. package/dist/cli.cjs.map +1 -1
  8. package/dist/cli.js +829 -71
  9. package/dist/cli.js.map +1 -1
  10. package/dist/config.d.ts +10 -0
  11. package/dist/core.d.ts +15 -0
  12. package/dist/corpus/index.cjs +20 -0
  13. package/dist/corpus/index.cjs.map +1 -1
  14. package/dist/corpus/index.js +20 -0
  15. package/dist/corpus/index.js.map +1 -1
  16. package/dist/dashboard/client/actions.d.ts +17 -0
  17. package/dist/dashboard/client/actor.d.ts +5 -0
  18. package/dist/dashboard/client/api.d.ts +15 -0
  19. package/dist/dashboard/client/app.d.ts +37 -0
  20. package/dist/dashboard/client/bars.d.ts +4 -0
  21. package/dist/dashboard/client/boot.d.ts +5 -0
  22. package/dist/dashboard/client/charts.d.ts +25 -0
  23. package/dist/dashboard/client/css.d.ts +11 -0
  24. package/dist/dashboard/client/dom.d.ts +55 -0
  25. package/dist/dashboard/client/draft.d.ts +46 -0
  26. package/dist/dashboard/client/feed.d.ts +22 -0
  27. package/dist/dashboard/client/format.d.ts +37 -0
  28. package/dist/dashboard/client/guard.d.ts +3 -0
  29. package/dist/dashboard/client/index.d.ts +1 -0
  30. package/dist/dashboard/client/outcome.d.ts +33 -0
  31. package/dist/dashboard/client/pager.d.ts +32 -0
  32. package/dist/dashboard/client/panels.d.ts +40 -0
  33. package/dist/dashboard/client/policy.d.ts +25 -0
  34. package/dist/dashboard/client/query.d.ts +42 -0
  35. package/dist/dashboard/client/ranges.d.ts +2 -0
  36. package/dist/dashboard/client/registry.d.ts +4 -0
  37. package/dist/dashboard/client/replay.d.ts +14 -0
  38. package/dist/dashboard/client/result.d.ts +10 -0
  39. package/dist/dashboard/client/store.d.ts +128 -0
  40. package/dist/dashboard/client/stream.d.ts +14 -0
  41. package/dist/dashboard/client/tester.d.ts +1 -0
  42. package/dist/dashboard/client/types.d.ts +69 -0
  43. package/dist/dashboard/client.generated.d.ts +1 -1
  44. package/dist/dashboard/page.d.ts +25 -0
  45. package/dist/dashboard/sections.d.ts +92 -0
  46. package/dist/dashboard/types.d.ts +2 -82
  47. package/dist/detectors/crawler-verification.d.ts +34 -1
  48. package/dist/detectors/index.d.ts +4 -1
  49. package/dist/detectors/known-bots.d.ts +49 -1
  50. package/dist/element/config.d.ts +135 -0
  51. package/dist/element/index.cjs +5150 -0
  52. package/dist/element/index.cjs.map +1 -0
  53. package/dist/element/index.d.ts +137 -0
  54. package/dist/element/index.js +5131 -0
  55. package/dist/element/index.js.map +1 -0
  56. package/dist/index.cjs +820 -71
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.ts +2 -0
  59. package/dist/index.js +811 -71
  60. package/dist/index.js.map +1 -1
  61. package/dist/metrics.d.ts +27 -0
  62. package/dist/policy/index.d.ts +1 -1
  63. package/dist/policy/presets.d.ts +47 -0
  64. package/dist/state.d.ts +1 -1
  65. package/docs/challenge/index.md +1 -0
  66. package/docs/challenge/interaction.md +325 -0
  67. package/docs/course/11-the-challenge.md +36 -1
  68. package/docs/course/13-operating-it.md +20 -2
  69. package/docs/detection/signatures.md +36 -0
  70. package/docs/index.md +2 -0
  71. package/docs/operations/dashboard.md +28 -0
  72. package/docs/operations/embedding.md +348 -0
  73. package/docs/operations/index.md +1 -0
  74. package/docs/policy/presets.md +53 -0
  75. package/docs/start/choosing-a-policy.md +1 -0
  76. package/package.json +8 -3
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Closes the stream, keeping everything the page has drawn.
3
+ *
4
+ * Reconnecting resumes from where this left off: the server is told the last id seen and
5
+ * sends only what was missed, so suspending across a route change costs a reconnect rather
6
+ * than a reload.
7
+ */
8
+ export declare function suspendStream(): void;
9
+ export declare function connectStream(): void;
10
+ /**
11
+ * A first fetch, so the page has counters before the stream opens — and so a browser
12
+ * with `EventSource` blocked still shows something useful.
13
+ */
14
+ export declare function loadInitialSnapshot(): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function initTester(): void;
@@ -0,0 +1,69 @@
1
+ import type { DashboardEntry, DashboardSections, DashboardSnapshot, PolicyDocument, PolicyPreview } from "../types.js";
2
+ export type { DashboardChange, DashboardEntry, DashboardEvidence, DashboardNotice, DashboardSections, DashboardSnapshot, PolicyDocument, PolicyPreview } from "../types.js";
3
+ /** What the server stamps into the page for the client to read at start-up. */
4
+ export interface Boot {
5
+ /** The mount prefix, or `""` at the root. Every request the page makes is relative to it. */
6
+ base: string;
7
+ title: string;
8
+ allowReset: boolean;
9
+ allowEdit: boolean;
10
+ allowGuardEdit: boolean;
11
+ allowActing: boolean;
12
+ peers: ReadonlyArray<{
13
+ label: string;
14
+ href: string;
15
+ }>;
16
+ sections: Required<DashboardSections>;
17
+ links: ReadonlyArray<{
18
+ label: string;
19
+ href: string;
20
+ }>;
21
+ }
22
+ /**
23
+ * One feed entry, plus what the page knows about it that the server does not.
24
+ *
25
+ * A wrapper rather than extra fields on the entry, for two reasons. The entry is a
26
+ * copy of what the server sent and anything added to it would end up in a replay line
27
+ * or a corpus case; and `rev` has to survive being compared against a rendered row,
28
+ * which is a question about this page rather than about the request.
29
+ */
30
+ export interface Row {
31
+ entry: DashboardEntry;
32
+ /**
33
+ * Bumped whenever the entry changes, which is how the feed knows a rendered row is
34
+ * stale. A request is written twice — once when it is assessed, again when the
35
+ * decision lands — and only the second write should cost a rebuild.
36
+ */
37
+ rev: number;
38
+ /** The searchable text, built on demand and thrown away when the entry changes. */
39
+ text?: string | undefined;
40
+ }
41
+ /** The views, in the order the tab strip and the digit shortcuts use. */
42
+ export type TabName = "live" | "actors" | "stats" | "policy";
43
+ export interface Preview extends PolicyPreview {
44
+ }
45
+ export interface Policy extends PolicyDocument {
46
+ }
47
+ export interface Snapshot extends DashboardSnapshot {
48
+ }
49
+ /**
50
+ * One row of the Actors screen.
51
+ *
52
+ * Here rather than in `registry.ts`, which renders it: this is plain data, and the store
53
+ * holds a list of it. A pure module importing a type from a module that speaks DOM pulls
54
+ * that module into every program the pure one appears in — which is how a Node-side test
55
+ * of the store came to fail on `HTMLInputElement`.
56
+ */
57
+ export interface ActorRow {
58
+ key: string;
59
+ requests: number;
60
+ recentRate: number;
61
+ distinctPaths: number;
62
+ distinctUserAgents: number;
63
+ cadenceCv: number | undefined;
64
+ priorConfirmations: number;
65
+ unsolvedChallenges: number;
66
+ cleared: boolean;
67
+ firstSeen: number;
68
+ lastSeen: number;
69
+ }