@vforsh/argus-core 0.1.2 → 0.1.4

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 (90) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/auth/cookies.d.ts +11 -0
  3. package/dist/auth/cookies.d.ts.map +1 -0
  4. package/dist/auth/cookies.js +33 -0
  5. package/dist/auth/cookies.js.map +1 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +4 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/logs/previewStringify.d.ts +11 -0
  11. package/dist/logs/previewStringify.d.ts.map +1 -0
  12. package/dist/logs/previewStringify.js +158 -0
  13. package/dist/logs/previewStringify.js.map +1 -0
  14. package/dist/protocol/http/auth.d.ts +20 -0
  15. package/dist/protocol/http/auth.d.ts.map +1 -0
  16. package/dist/protocol/http/auth.js +2 -0
  17. package/dist/protocol/http/auth.js.map +1 -0
  18. package/dist/protocol/http/code.d.ts +59 -0
  19. package/dist/protocol/http/code.d.ts.map +1 -0
  20. package/dist/protocol/http/code.js +2 -0
  21. package/dist/protocol/http/code.js.map +1 -0
  22. package/dist/protocol/http/dom.d.ts +392 -0
  23. package/dist/protocol/http/dom.d.ts.map +1 -0
  24. package/dist/protocol/http/dom.js +2 -0
  25. package/dist/protocol/http/dom.js.map +1 -0
  26. package/dist/protocol/http/emulation.d.ts +92 -0
  27. package/dist/protocol/http/emulation.d.ts.map +1 -0
  28. package/dist/protocol/http/emulation.js +2 -0
  29. package/dist/protocol/http/emulation.js.map +1 -0
  30. package/dist/protocol/http/errors.d.ts +9 -0
  31. package/dist/protocol/http/errors.d.ts.map +1 -0
  32. package/dist/protocol/http/errors.js +2 -0
  33. package/dist/protocol/http/errors.js.map +1 -0
  34. package/dist/protocol/http/eval.d.ts +23 -0
  35. package/dist/protocol/http/eval.d.ts.map +1 -0
  36. package/dist/protocol/http/eval.js +2 -0
  37. package/dist/protocol/http/eval.js.map +1 -0
  38. package/dist/protocol/http/logs.d.ts +15 -0
  39. package/dist/protocol/http/logs.d.ts.map +1 -0
  40. package/dist/protocol/http/logs.js +2 -0
  41. package/dist/protocol/http/logs.js.map +1 -0
  42. package/dist/protocol/http/net.d.ts +29 -0
  43. package/dist/protocol/http/net.d.ts.map +1 -0
  44. package/dist/protocol/http/net.js +2 -0
  45. package/dist/protocol/http/net.js.map +1 -0
  46. package/dist/protocol/http/screenshot.d.ts +13 -0
  47. package/dist/protocol/http/screenshot.d.ts.map +1 -0
  48. package/dist/protocol/http/screenshot.js +2 -0
  49. package/dist/protocol/http/screenshot.js.map +1 -0
  50. package/dist/protocol/http/snapshot.d.ts +40 -0
  51. package/dist/protocol/http/snapshot.d.ts.map +1 -0
  52. package/dist/protocol/http/snapshot.js +2 -0
  53. package/dist/protocol/http/snapshot.js.map +1 -0
  54. package/dist/protocol/http/status.d.ts +38 -0
  55. package/dist/protocol/http/status.d.ts.map +1 -0
  56. package/dist/protocol/http/status.js +2 -0
  57. package/dist/protocol/http/status.js.map +1 -0
  58. package/dist/protocol/http/storage.d.ts +46 -0
  59. package/dist/protocol/http/storage.d.ts.map +1 -0
  60. package/dist/protocol/http/storage.js +2 -0
  61. package/dist/protocol/http/storage.js.map +1 -0
  62. package/dist/protocol/http/throttle.d.ts +48 -0
  63. package/dist/protocol/http/throttle.d.ts.map +1 -0
  64. package/dist/protocol/http/throttle.js +2 -0
  65. package/dist/protocol/http/throttle.js.map +1 -0
  66. package/dist/protocol/http/trace.d.ts +27 -0
  67. package/dist/protocol/http/trace.d.ts.map +1 -0
  68. package/dist/protocol/http/trace.js +2 -0
  69. package/dist/protocol/http/trace.js.map +1 -0
  70. package/dist/protocol/http.d.ts +14 -41
  71. package/dist/protocol/http.d.ts.map +1 -1
  72. package/dist/protocol/version.d.ts +5 -0
  73. package/dist/protocol/version.d.ts.map +1 -0
  74. package/dist/protocol/version.js +3 -0
  75. package/dist/protocol/version.js.map +1 -0
  76. package/dist/registry/lock.d.ts +7 -0
  77. package/dist/registry/lock.d.ts.map +1 -0
  78. package/dist/registry/lock.js +87 -0
  79. package/dist/registry/lock.js.map +1 -0
  80. package/dist/registry/registry.d.ts +6 -0
  81. package/dist/registry/registry.d.ts.map +1 -1
  82. package/dist/registry/registry.js +16 -0
  83. package/dist/registry/registry.js.map +1 -1
  84. package/dist/registry/types.d.ts +26 -2
  85. package/dist/registry/types.d.ts.map +1 -1
  86. package/dist/textPattern.d.ts +23 -0
  87. package/dist/textPattern.d.ts.map +1 -0
  88. package/dist/textPattern.js +48 -0
  89. package/dist/textPattern.js.map +1 -0
  90. package/package.json +7 -1
@@ -1,13 +1,35 @@
1
1
  /** Target matching rules for CDP selection. */
2
2
  export type WatcherMatch = {
3
- /** Exact URL match against the CDP target URL. */
3
+ /** Substring match against the CDP target URL. */
4
4
  url?: string;
5
- /** Exact title match against the CDP target title. */
5
+ /** Substring match against the CDP target title. */
6
6
  title?: string;
7
7
  /** JavaScript regex pattern (without flags) matched against the CDP target URL. */
8
8
  urlRegex?: string;
9
9
  /** JavaScript regex pattern (without flags) matched against the CDP target title. */
10
10
  titleRegex?: string;
11
+ /**
12
+ * Filter by target type (e.g., 'page', 'iframe', 'worker').
13
+ * Exact match against the Chrome target `type` field.
14
+ */
15
+ type?: string;
16
+ /**
17
+ * Match against URL origin only (protocol + host + port).
18
+ * Ignores path, query params, and hash. Useful for iframe matching
19
+ * when parent pages may include the iframe URL in query params.
20
+ */
21
+ origin?: string;
22
+ /**
23
+ * Connect to a specific target by its Chrome target ID.
24
+ * Bypasses URL/title matching entirely. Get target IDs from `argus page targets`.
25
+ */
26
+ targetId?: string;
27
+ /**
28
+ * Filter by parent target URL pattern.
29
+ * Only matches targets whose parent's URL includes this substring.
30
+ * Useful for targeting iframes within a specific parent page.
31
+ */
32
+ parent?: string;
11
33
  };
12
34
  /** Chrome CDP connection details. */
13
35
  export type WatcherChrome = {
@@ -38,6 +60,8 @@ export type WatcherRecord = {
38
60
  chrome?: WatcherChrome;
39
61
  /** Whether to include ISO timestamps in formatted log output. */
40
62
  includeTimestamps?: boolean;
63
+ /** Source mode: 'cdp' (direct Chrome connection) or 'extension' (via Chrome extension). */
64
+ source?: 'cdp' | 'extension';
41
65
  };
42
66
  /** Registry schema v1. */
43
67
  export type RegistryV1 = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG;IAC1B,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,qCAAqC;AACrC,MAAM,MAAM,aAAa,GAAG;IAC3B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,6CAA6C;AAC7C,MAAM,MAAM,aAAa,GAAG;IAC3B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAA;IACV,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;A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AA;IACZ,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,2FAA2F;IAC3F,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;CAC5B,CAAA;AAED,0BAA0B;AAC1B,MAAM,MAAM,UAAU,GAAG;IACxB,oCAAoC;IACpC,OAAO,EAAE,CAAC,CAAA;IACV,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACvC,CAAA;AAED,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG;IAChC,2EAA2E;IAC3E,QAAQ,EAAE,UAAU,CAAA;IACpB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA"}
@@ -0,0 +1,23 @@
1
+ export type TextPattern = {
2
+ type: 'exact';
3
+ value: string;
4
+ } | {
5
+ type: 'regex';
6
+ regex: RegExp;
7
+ };
8
+ /**
9
+ * Parse a plain string or `/regex/flags` value into a reusable text pattern.
10
+ */
11
+ export declare const parseTextPattern: (text: string) => TextPattern;
12
+ /**
13
+ * Test whether a line matches a parsed text pattern.
14
+ */
15
+ export declare const matchesTextPattern: (line: string, pattern: TextPattern) => boolean;
16
+ /**
17
+ * Find the first match range for a parsed text pattern within a line.
18
+ */
19
+ export declare const findTextPatternMatch: (line: string, pattern: TextPattern) => {
20
+ index: number;
21
+ length: number;
22
+ } | null;
23
+ //# sourceMappingURL=textPattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textPattern.d.ts","sourceRoot":"","sources":["../src/textPattern.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAI7F;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,WAa/C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,SAAS,WAAW,KAAG,OAQvE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,EAAE,SAAS,WAAW,KAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAgB7G,CAAA"}
@@ -0,0 +1,48 @@
1
+ const REGEX_PATTERN = /^\/(.+)\/([imsu]*)$/;
2
+ /**
3
+ * Parse a plain string or `/regex/flags` value into a reusable text pattern.
4
+ */
5
+ export const parseTextPattern = (text) => {
6
+ const match = REGEX_PATTERN.exec(text);
7
+ if (!match) {
8
+ return { type: 'exact', value: text };
9
+ }
10
+ const [, pattern, flags] = match;
11
+ try {
12
+ return { type: 'regex', regex: new RegExp(pattern, flags) };
13
+ }
14
+ catch (error) {
15
+ const msg = error instanceof Error ? error.message : String(error);
16
+ throw new Error(`Invalid regex pattern "${text}": ${msg}`);
17
+ }
18
+ };
19
+ /**
20
+ * Test whether a line matches a parsed text pattern.
21
+ */
22
+ export const matchesTextPattern = (line, pattern) => {
23
+ if (pattern.type === 'exact') {
24
+ return line.includes(pattern.value);
25
+ }
26
+ const matched = pattern.regex.test(line);
27
+ pattern.regex.lastIndex = 0;
28
+ return matched;
29
+ };
30
+ /**
31
+ * Find the first match range for a parsed text pattern within a line.
32
+ */
33
+ export const findTextPatternMatch = (line, pattern) => {
34
+ if (pattern.type === 'exact') {
35
+ const index = line.indexOf(pattern.value);
36
+ return index >= 0 ? { index, length: pattern.value.length } : null;
37
+ }
38
+ const matched = pattern.regex.exec(line);
39
+ pattern.regex.lastIndex = 0;
40
+ if (!matched || matched.index < 0) {
41
+ return null;
42
+ }
43
+ return {
44
+ index: matched.index,
45
+ length: Math.max(1, matched[0]?.length ?? 0),
46
+ };
47
+ };
48
+ //# sourceMappingURL=textPattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textPattern.js","sourceRoot":"","sources":["../src/textPattern.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,qBAAqB,CAAA;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAe,EAAE;IAC7D,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IACtC,CAAC;IAED,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;IAChC,IAAI,CAAC;QACJ,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,OAAQ,EAAE,KAAK,CAAC,EAAE,CAAA;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAClE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,MAAM,GAAG,EAAE,CAAC,CAAA;IAC3D,CAAC;AACF,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,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"version": "0.1.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/vforsh/argus.git",
@@ -24,5 +24,11 @@
24
24
  "scripts": {
25
25
  "build": "tsc -b",
26
26
  "typecheck": "tsc -b --pretty false --noEmit"
27
+ },
28
+ "peerDependencies": {
29
+ "commander": "^14.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "commander": "^14.0.2"
27
33
  }
28
34
  }