@capillarytech/cap-ui-utils 3.0.20 → 3.1.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.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Central gate for the FULL_DEBUG capture feature (request-payload + screenshot
3
+ * recording) and, indirectly, for whether the devtools automation protocol is
4
+ * registered at all (see wdio.conf.ts).
5
+ *
6
+ * Capture is enabled only when FULL_DEBUG_MODE=true AND, if the optional
7
+ * DEBUG_MODULES list is provided, the current `module` is in that list.
8
+ *
9
+ * DEBUG_MODULES is a comma-separated list of module names, e.g.
10
+ * FULL_DEBUG_MODE=true DEBUG_MODULES=engage,creatives module=engage npx wdio ...
11
+ * captures only for `engage` and `creatives`. When DEBUG_MODULES is empty/unset,
12
+ * capture applies to every module (falls back to FULL_DEBUG_MODE alone).
13
+ */
14
+ class DebugMode {
15
+ /** Parse DEBUG_MODULES into a trimmed, non-empty module-name list. */
16
+ private getDebugModules(): string[] {
17
+ return (process.env.DEBUG_MODULES || '')
18
+ .split(',')
19
+ .map((m) => m.trim())
20
+ .filter(Boolean);
21
+ }
22
+
23
+ /** True when request/screenshot capture should run for the current module. */
24
+ isCaptureEnabled(): boolean {
25
+ if (process.env.FULL_DEBUG_MODE !== 'true') return false;
26
+ const modules = this.getDebugModules();
27
+ if (modules.length === 0) return true;
28
+ return modules.includes(process.env.module || '');
29
+ }
30
+ }
31
+
32
+ export default new DebugMode();
@@ -0,0 +1,15 @@
1
+ class DeletionRegistry {
2
+ private deleted = new Set<string>();
3
+
4
+ has(name: string): boolean {
5
+ return this.deleted.has(name);
6
+ }
7
+
8
+ register(name: string): void {
9
+ this.deleted.add(name);
10
+ console.log(`DeletionRegistry: registered "${name}"`);
11
+ }
12
+ }
13
+
14
+ const deletionRegistry = new DeletionRegistry();
15
+ export default deletionRegistry;