@silasfmartins/testhub 1.0.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 (296) hide show
  1. package/.github/copilot-instructions.md +520 -0
  2. package/biome.json +37 -0
  3. package/dist/index.d.ts +45 -0
  4. package/dist/index.js +169 -0
  5. package/dist/scripts/consumer-postinstall.d.ts +15 -0
  6. package/dist/scripts/consumer-postinstall.js +785 -0
  7. package/dist/scripts/generate-docs.d.ts +16 -0
  8. package/dist/scripts/generate-docs.js +1363 -0
  9. package/dist/scripts/generate-index.d.ts +2 -0
  10. package/dist/scripts/generate-index.js +314 -0
  11. package/dist/scripts/init-api.d.ts +2 -0
  12. package/dist/scripts/init-api.js +525 -0
  13. package/dist/scripts/init-banco.d.ts +2 -0
  14. package/dist/scripts/init-banco.js +347 -0
  15. package/dist/scripts/init-frontend.d.ts +2 -0
  16. package/dist/scripts/init-frontend.js +627 -0
  17. package/dist/scripts/init-mobile.d.ts +2 -0
  18. package/dist/scripts/init-mobile.js +481 -0
  19. package/dist/scripts/init-scenarios.d.ts +2 -0
  20. package/dist/scripts/init-scenarios.js +846 -0
  21. package/dist/scripts/init-ssh.d.ts +2 -0
  22. package/dist/scripts/init-ssh.js +639 -0
  23. package/dist/scripts/package-versions.d.ts +57 -0
  24. package/dist/scripts/package-versions.js +768 -0
  25. package/dist/scripts/postinstall.d.ts +1 -0
  26. package/dist/scripts/postinstall.js +527 -0
  27. package/dist/scripts/robust-build.d.ts +7 -0
  28. package/dist/scripts/robust-build.js +88 -0
  29. package/dist/scripts/setup-local-packages.d.ts +31 -0
  30. package/dist/scripts/setup-local-packages.js +237 -0
  31. package/dist/scripts/smart-override.d.ts +2 -0
  32. package/dist/scripts/smart-override.js +1360 -0
  33. package/dist/scripts/sync-configs.d.ts +27 -0
  34. package/dist/scripts/sync-configs.js +248 -0
  35. package/dist/scripts/test-biome-parse.d.ts +5 -0
  36. package/dist/scripts/test-biome-parse.js +84 -0
  37. package/dist/scripts/ultracite-setup.d.ts +4 -0
  38. package/dist/scripts/ultracite-setup.js +310 -0
  39. package/dist/scripts/update-all-init-scripts.d.ts +2 -0
  40. package/dist/scripts/update-all-init-scripts.js +52 -0
  41. package/dist/scripts/update-biome-schema.d.ts +15 -0
  42. package/dist/scripts/update-biome-schema.js +124 -0
  43. package/dist/src/AutoCoreFacade.d.ts +145 -0
  44. package/dist/src/AutoCoreFacade.js +217 -0
  45. package/dist/src/api/ApiActions.d.ts +297 -0
  46. package/dist/src/api/ApiActions.js +1905 -0
  47. package/dist/src/api/Certificate.d.ts +60 -0
  48. package/dist/src/api/Certificate.js +79 -0
  49. package/dist/src/api/JsonResponse.d.ts +116 -0
  50. package/dist/src/api/JsonResponse.js +206 -0
  51. package/dist/src/appium/DeviceFarmViewer.d.ts +79 -0
  52. package/dist/src/appium/DeviceFarmViewer.js +1083 -0
  53. package/dist/src/appium/MobileActions.d.ts +347 -0
  54. package/dist/src/appium/MobileActions.js +1632 -0
  55. package/dist/src/appium/MobileConnection.d.ts +160 -0
  56. package/dist/src/appium/MobileConnection.js +772 -0
  57. package/dist/src/config/envLoader.d.ts +123 -0
  58. package/dist/src/config/envLoader.js +361 -0
  59. package/dist/src/config/jest-safe-setup.d.ts +19 -0
  60. package/dist/src/config/jest-safe-setup.js +369 -0
  61. package/dist/src/config/timeouts.d.ts +32 -0
  62. package/dist/src/config/timeouts.js +38 -0
  63. package/dist/src/desktop/DesktopActions.d.ts +46 -0
  64. package/dist/src/desktop/DesktopActions.js +398 -0
  65. package/dist/src/desktop/DesktopConnection.d.ts +32 -0
  66. package/dist/src/desktop/DesktopConnection.js +84 -0
  67. package/dist/src/domain/entities/TestExecution.d.ts +117 -0
  68. package/dist/src/domain/entities/TestExecution.js +150 -0
  69. package/dist/src/domain/entities/TestReport.d.ts +114 -0
  70. package/dist/src/domain/entities/TestReport.js +179 -0
  71. package/dist/src/domain/repositories/ITestRepository.d.ts +196 -0
  72. package/dist/src/domain/repositories/ITestRepository.js +14 -0
  73. package/dist/src/domain/schemas/ValidationSchemas.d.ts +159 -0
  74. package/dist/src/domain/schemas/ValidationSchemas.js +181 -0
  75. package/dist/src/functions/errors/BaseError.d.ts +78 -0
  76. package/dist/src/functions/errors/BaseError.js +245 -0
  77. package/dist/src/functions/errors/ConfigurationError.d.ts +16 -0
  78. package/dist/src/functions/errors/ConfigurationError.js +48 -0
  79. package/dist/src/functions/errors/ErrorCatalog.d.ts +148 -0
  80. package/dist/src/functions/errors/ErrorCatalog.js +157 -0
  81. package/dist/src/functions/errors/GlobalErrorHandler.d.ts +101 -0
  82. package/dist/src/functions/errors/GlobalErrorHandler.js +281 -0
  83. package/dist/src/functions/errors/IntegrationError.d.ts +17 -0
  84. package/dist/src/functions/errors/IntegrationError.js +51 -0
  85. package/dist/src/functions/errors/SecurityError.d.ts +14 -0
  86. package/dist/src/functions/errors/SecurityError.js +42 -0
  87. package/dist/src/functions/errors/SystemError.d.ts +12 -0
  88. package/dist/src/functions/errors/SystemError.js +36 -0
  89. package/dist/src/functions/errors/ValidationError.d.ts +14 -0
  90. package/dist/src/functions/errors/ValidationError.js +61 -0
  91. package/dist/src/functions/errors/index.d.ts +12 -0
  92. package/dist/src/functions/errors/index.js +13 -0
  93. package/dist/src/global-setup.d.ts +1 -0
  94. package/dist/src/global-setup.js +1037 -0
  95. package/dist/src/helpers/BancoActions.d.ts +188 -0
  96. package/dist/src/helpers/BancoActions.js +581 -0
  97. package/dist/src/helpers/EnviromentHelper.d.ts +17 -0
  98. package/dist/src/helpers/EnviromentHelper.js +66 -0
  99. package/dist/src/helpers/ParallelExecutionHelper.d.ts +183 -0
  100. package/dist/src/helpers/ParallelExecutionHelper.js +375 -0
  101. package/dist/src/helpers/SyncSignal.d.ts +15 -0
  102. package/dist/src/helpers/SyncSignal.js +44 -0
  103. package/dist/src/hubdocs/CategoryDetector.d.ts +83 -0
  104. package/dist/src/hubdocs/CategoryDetector.js +401 -0
  105. package/dist/src/hubdocs/DirectStatementInterceptor.d.ts +54 -0
  106. package/dist/src/hubdocs/DirectStatementInterceptor.js +243 -0
  107. package/dist/src/hubdocs/ExecutionTracker.d.ts +107 -0
  108. package/dist/src/hubdocs/ExecutionTracker.js +702 -0
  109. package/dist/src/hubdocs/HubDocs.d.ts +395 -0
  110. package/dist/src/hubdocs/HubDocs.js +3586 -0
  111. package/dist/src/hubdocs/StatementMethodFilter.d.ts +71 -0
  112. package/dist/src/hubdocs/StatementMethodFilter.js +618 -0
  113. package/dist/src/hubdocs/StatementTracker.d.ts +417 -0
  114. package/dist/src/hubdocs/StatementTracker.js +2419 -0
  115. package/dist/src/hubdocs/SwaggerGenerator.d.ts +59 -0
  116. package/dist/src/hubdocs/SwaggerGenerator.js +405 -0
  117. package/dist/src/hubdocs/index.d.ts +9 -0
  118. package/dist/src/hubdocs/index.js +9 -0
  119. package/dist/src/hubdocs/types.d.ts +114 -0
  120. package/dist/src/hubdocs/types.js +5 -0
  121. package/dist/src/infrastructure/DependencyContainer.d.ts +142 -0
  122. package/dist/src/infrastructure/DependencyContainer.js +250 -0
  123. package/dist/src/infrastructure/adapters/AppiumAdapter.d.ts +168 -0
  124. package/dist/src/infrastructure/adapters/AppiumAdapter.js +468 -0
  125. package/dist/src/infrastructure/adapters/OracleAdapter.d.ts +150 -0
  126. package/dist/src/infrastructure/adapters/OracleAdapter.js +388 -0
  127. package/dist/src/infrastructure/adapters/PlaywrightAdapter.d.ts +192 -0
  128. package/dist/src/infrastructure/adapters/PlaywrightAdapter.js +382 -0
  129. package/dist/src/infrastructure/adapters/SSHAdapter.d.ts +141 -0
  130. package/dist/src/infrastructure/adapters/SSHAdapter.js +428 -0
  131. package/dist/src/interfaces.d.ts +501 -0
  132. package/dist/src/interfaces.js +25 -0
  133. package/dist/src/internal/fakes/__fake-actions__.d.ts +17 -0
  134. package/dist/src/internal/fakes/__fake-actions__.js +21 -0
  135. package/dist/src/internal/fakes/__forbidden__.d.ts +10 -0
  136. package/dist/src/internal/fakes/__forbidden__.js +18 -0
  137. package/dist/src/internal/fakes/__honeypot__.d.ts +15 -0
  138. package/dist/src/internal/fakes/__honeypot__.js +24 -0
  139. package/dist/src/octane/OctaneReporter.d.ts +13 -0
  140. package/dist/src/octane/OctaneReporter.js +61 -0
  141. package/dist/src/playwright/CryptoActions.d.ts +20 -0
  142. package/dist/src/playwright/CryptoActions.js +75 -0
  143. package/dist/src/playwright/EnhancedWebActions.d.ts +7 -0
  144. package/dist/src/playwright/EnhancedWebActions.js +65 -0
  145. package/dist/src/playwright/WebActions.d.ts +1599 -0
  146. package/dist/src/playwright/WebActions.js +11788 -0
  147. package/dist/src/playwright/actions/ActionTimeline.d.ts +36 -0
  148. package/dist/src/playwright/actions/ActionTimeline.js +101 -0
  149. package/dist/src/playwright/actions/RecoveryQueue.d.ts +82 -0
  150. package/dist/src/playwright/actions/RecoveryQueue.js +130 -0
  151. package/dist/src/playwright/actions/SelectorCache.d.ts +53 -0
  152. package/dist/src/playwright/actions/SelectorCache.js +96 -0
  153. package/dist/src/playwright/actions/index.d.ts +13 -0
  154. package/dist/src/playwright/actions/index.js +14 -0
  155. package/dist/src/playwright/actions/types.d.ts +147 -0
  156. package/dist/src/playwright/actions/types.js +5 -0
  157. package/dist/src/playwright/fixtures.d.ts +112 -0
  158. package/dist/src/playwright/fixtures.js +718 -0
  159. package/dist/src/playwright/network-logs-reporter.d.ts +7 -0
  160. package/dist/src/playwright/network-logs-reporter.js +66 -0
  161. package/dist/src/playwright/registerRecoveryWrappers.d.ts +1 -0
  162. package/dist/src/playwright/registerRecoveryWrappers.js +54 -0
  163. package/dist/src/security/BuildSecurity.d.ts +12 -0
  164. package/dist/src/security/BuildSecurity.js +138 -0
  165. package/dist/src/security/EulaProtection.d.ts +70 -0
  166. package/dist/src/security/EulaProtection.js +155 -0
  167. package/dist/src/security/HoneypotManager.d.ts +46 -0
  168. package/dist/src/security/HoneypotManager.js +234 -0
  169. package/dist/src/security/KeysManager.d.ts +36 -0
  170. package/dist/src/security/KeysManager.js +158 -0
  171. package/dist/src/security/ProofOfWorkIntegration.d.ts +64 -0
  172. package/dist/src/security/ProofOfWorkIntegration.js +206 -0
  173. package/dist/src/security/SecurityValidation.d.ts +21 -0
  174. package/dist/src/security/SecurityValidation.js +163 -0
  175. package/dist/src/security/SourceMapProtection.d.ts +55 -0
  176. package/dist/src/security/SourceMapProtection.js +220 -0
  177. package/dist/src/security/protector.d.ts +1 -0
  178. package/dist/src/security/protector.js +97 -0
  179. package/dist/src/ssh/SSHActions.d.ts +262 -0
  180. package/dist/src/ssh/SSHActions.js +790 -0
  181. package/dist/src/ssh/SSHClient.d.ts +99 -0
  182. package/dist/src/ssh/SSHClient.js +409 -0
  183. package/dist/src/statements/BaseStatement.d.ts +38 -0
  184. package/dist/src/statements/BaseStatement.js +78 -0
  185. package/dist/src/testContext/AuthStateManager.d.ts +93 -0
  186. package/dist/src/testContext/AuthStateManager.js +256 -0
  187. package/dist/src/testContext/CoverageManager.d.ts +198 -0
  188. package/dist/src/testContext/CoverageManager.js +917 -0
  189. package/dist/src/testContext/TestAnnotations.d.ts +476 -0
  190. package/dist/src/testContext/TestAnnotations.js +2647 -0
  191. package/dist/src/testContext/TestContext.d.ts +138 -0
  192. package/dist/src/testContext/TestContext.js +369 -0
  193. package/dist/src/testContext/UnifiedHtmlGenerator.d.ts +7 -0
  194. package/dist/src/testContext/UnifiedHtmlGenerator.js +264 -0
  195. package/dist/src/testContext/UnifiedReportManager.d.ts +211 -0
  196. package/dist/src/testContext/UnifiedReportManager.js +1206 -0
  197. package/dist/src/testhub/DynamicConfigManager.d.ts +121 -0
  198. package/dist/src/testhub/DynamicConfigManager.js +320 -0
  199. package/dist/src/testhub/SystemsManager.d.ts +119 -0
  200. package/dist/src/testhub/SystemsManager.js +365 -0
  201. package/dist/src/testhub/TestHubClient.d.ts +335 -0
  202. package/dist/src/testhub/TestHubClient.js +1215 -0
  203. package/dist/src/testhub/TestHubReporter.d.ts +62 -0
  204. package/dist/src/testhub/TestHubReporter.js +576 -0
  205. package/dist/src/testhub/TestHubVars.d.ts +116 -0
  206. package/dist/src/testhub/TestHubVars.js +273 -0
  207. package/dist/src/utils/ActionInterceptor.d.ts +59 -0
  208. package/dist/src/utils/ActionInterceptor.js +741 -0
  209. package/dist/src/utils/ArtifactsCompressor.d.ts +43 -0
  210. package/dist/src/utils/ArtifactsCompressor.js +181 -0
  211. package/dist/src/utils/AutoLogsFinal.d.ts +47 -0
  212. package/dist/src/utils/AutoLogsFinal.js +148 -0
  213. package/dist/src/utils/CodeGenSession.d.ts +114 -0
  214. package/dist/src/utils/CodeGenSession.js +264 -0
  215. package/dist/src/utils/ConfigLogger.d.ts +133 -0
  216. package/dist/src/utils/ConfigLogger.js +611 -0
  217. package/dist/src/utils/CustomReporter.d.ts +22 -0
  218. package/dist/src/utils/CustomReporter.js +352 -0
  219. package/dist/src/utils/DataStore.d.ts +171 -0
  220. package/dist/src/utils/DataStore.js +484 -0
  221. package/dist/src/utils/DatabaseInterceptor.d.ts +19 -0
  222. package/dist/src/utils/DatabaseInterceptor.js +295 -0
  223. package/dist/src/utils/DateHelper.d.ts +16 -0
  224. package/dist/src/utils/DateHelper.js +120 -0
  225. package/dist/src/utils/DateValidator.d.ts +4 -0
  226. package/dist/src/utils/DateValidator.js +51 -0
  227. package/dist/src/utils/DocumentGenerator.d.ts +35 -0
  228. package/dist/src/utils/DocumentGenerator.js +129 -0
  229. package/dist/src/utils/EvidenceCapture.d.ts +90 -0
  230. package/dist/src/utils/EvidenceCapture.js +600 -0
  231. package/dist/src/utils/EvidenceReportGenerator.d.ts +70 -0
  232. package/dist/src/utils/EvidenceReportGenerator.js +799 -0
  233. package/dist/src/utils/FrameManagementUtil.d.ts +42 -0
  234. package/dist/src/utils/FrameManagementUtil.js +75 -0
  235. package/dist/src/utils/GlobalStatementsInterceptor.d.ts +1 -0
  236. package/dist/src/utils/GlobalStatementsInterceptor.js +1 -0
  237. package/dist/src/utils/HTMLTemplate.d.ts +1 -0
  238. package/dist/src/utils/HTMLTemplate.js +1034 -0
  239. package/dist/src/utils/InterceptacaoMagica.d.ts +23 -0
  240. package/dist/src/utils/InterceptacaoMagica.js +365 -0
  241. package/dist/src/utils/LogSanitizer.d.ts +35 -0
  242. package/dist/src/utils/LogSanitizer.js +110 -0
  243. package/dist/src/utils/Logger.d.ts +65 -0
  244. package/dist/src/utils/Logger.js +284 -0
  245. package/dist/src/utils/McpLocalClient.d.ts +141 -0
  246. package/dist/src/utils/McpLocalClient.js +871 -0
  247. package/dist/src/utils/PDFEvidenceGenerator.d.ts +20 -0
  248. package/dist/src/utils/PDFEvidenceGenerator.js +156 -0
  249. package/dist/src/utils/SpecFileAnalyzer.d.ts +35 -0
  250. package/dist/src/utils/SpecFileAnalyzer.js +209 -0
  251. package/dist/src/utils/StatementInterceptor.d.ts +18 -0
  252. package/dist/src/utils/StatementInterceptor.js +87 -0
  253. package/dist/src/utils/StatementLogger.d.ts +33 -0
  254. package/dist/src/utils/StatementLogger.js +113 -0
  255. package/dist/src/utils/StatementsInterceptor.d.ts +1 -0
  256. package/dist/src/utils/StatementsInterceptor.js +1 -0
  257. package/dist/src/utils/TeamsFlushHook.d.ts +17 -0
  258. package/dist/src/utils/TeamsFlushHook.js +168 -0
  259. package/dist/src/utils/TerminalLogCapture.d.ts +158 -0
  260. package/dist/src/utils/TerminalLogCapture.js +531 -0
  261. package/dist/src/utils/TestMethodLogger.d.ts +70 -0
  262. package/dist/src/utils/TestMethodLogger.js +95 -0
  263. package/dist/src/utils/UnifiedTeardown.d.ts +4 -0
  264. package/dist/src/utils/UnifiedTeardown.js +400 -0
  265. package/dist/src/utils/XPathCatalog.d.ts +152 -0
  266. package/dist/src/utils/XPathCatalog.js +350 -0
  267. package/dist/src/utils/generators.d.ts +90 -0
  268. package/dist/src/utils/generators.js +167 -0
  269. package/dist/src/utils/testRecovery/ResilientPlaywright.d.ts +152 -0
  270. package/dist/src/utils/testRecovery/ResilientPlaywright.js +715 -0
  271. package/dist/src/utils/testRecovery/TestRecoveryClient.d.ts +801 -0
  272. package/dist/src/utils/testRecovery/TestRecoveryClient.js +1415 -0
  273. package/dist/src/utils/testRecovery/autoFixCode.d.ts +65 -0
  274. package/dist/src/utils/testRecovery/autoFixCode.js +32 -0
  275. package/dist/vitest.config.d.ts +2 -0
  276. package/dist/vitest.config.js +59 -0
  277. package/dist/wdio.conf.d.ts +1 -0
  278. package/dist/wdio.conf.js +420 -0
  279. package/package.json +137 -0
  280. package/protect-loader.mjs +643 -0
  281. package/scripts/consumer-postinstall.ts +975 -0
  282. package/scripts/generate-index.ts +343 -0
  283. package/scripts/init-api.ts +613 -0
  284. package/scripts/init-banco.ts +437 -0
  285. package/scripts/init-frontend.ts +727 -0
  286. package/scripts/init-mobile.ts +558 -0
  287. package/scripts/init-scenarios.ts +925 -0
  288. package/scripts/init-ssh.ts +734 -0
  289. package/scripts/package-versions.ts +978 -0
  290. package/scripts/postinstall.ts +605 -0
  291. package/scripts/smart-override.ts +1675 -0
  292. package/scripts/sync-configs.ts +302 -0
  293. package/scripts/ultracite-setup.ts +370 -0
  294. package/src/types/globals.d.ts +48 -0
  295. package/tsconfig.json +29 -0
  296. package/types/autocore-sync-signal.d.ts +10 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * ✅ Interface para Certificados Digitais
3
+ * Compatível com a implementação Java do AutoCore
4
+ */
5
+ export interface Certificate {
6
+ /** Nome do arquivo de certificado (ex: "cert.p12") */
7
+ name: string;
8
+ /** Senha do certificado (opcional, muitos certificados não precisam) */
9
+ password?: string;
10
+ /** Caminho completo para o certificado (opcional, será resolvido automaticamente) */
11
+ path?: string;
12
+ /** Tipo de certificado: 'pfx' para .p12/.pfx, 'pem' para .crt/.pem */
13
+ type?: 'pfx' | 'pem';
14
+ /** Caminho para a chave privada (apenas para certificados PEM) */
15
+ keyPath?: string;
16
+ }
17
+ /**
18
+ * ✅ Classe utilitária para criar certificados
19
+ * Espelha a funcionalidade da classe Certificate do Java
20
+ */
21
+ export declare class CertificateBuilder {
22
+ private certificate;
23
+ constructor();
24
+ /**
25
+ * Define o nome do certificado
26
+ * @param name Nome do arquivo de certificado
27
+ */
28
+ setName(name: string): CertificateBuilder;
29
+ /**
30
+ * Define a senha do certificado
31
+ * @param password Senha do certificado
32
+ */
33
+ setPassword(password: string): CertificateBuilder;
34
+ /**
35
+ * Define o caminho completo do certificado
36
+ * @param path Caminho para o arquivo de certificado
37
+ */
38
+ setPath(path: string): CertificateBuilder;
39
+ /**
40
+ * Define o tipo de certificado
41
+ * @param type Tipo do certificado
42
+ */
43
+ setType(type: 'pfx' | 'pem'): CertificateBuilder;
44
+ /**
45
+ * Define o caminho da chave privada (para certificados PEM)
46
+ * @param keyPath Caminho para a chave privada
47
+ */
48
+ setKeyPath(keyPath: string): CertificateBuilder;
49
+ /**
50
+ * Constrói o objeto Certificate
51
+ */
52
+ build(): Certificate;
53
+ }
54
+ /**
55
+ * ✅ Função de conveniência para criar certificado (compatível com Java)
56
+ * @param name Nome do certificado
57
+ * @param password Senha do certificado (opcional)
58
+ * @returns Certificate configurado
59
+ */
60
+ export declare function createCertificate(name: string, password?: string): Certificate;
@@ -0,0 +1,79 @@
1
+ import { Logger } from '../utils/Logger.js';
2
+ /**
3
+ * ✅ Classe utilitária para criar certificados
4
+ * Espelha a funcionalidade da classe Certificate do Java
5
+ */
6
+ export class CertificateBuilder {
7
+ certificate;
8
+ constructor() {
9
+ this.certificate = {
10
+ name: '',
11
+ };
12
+ }
13
+ /**
14
+ * Define o nome do certificado
15
+ * @param name Nome do arquivo de certificado
16
+ */
17
+ setName(name) {
18
+ this.certificate.name = name;
19
+ return this;
20
+ }
21
+ /**
22
+ * Define a senha do certificado
23
+ * @param password Senha do certificado
24
+ */
25
+ setPassword(password) {
26
+ this.certificate.password = password;
27
+ return this;
28
+ }
29
+ /**
30
+ * Define o caminho completo do certificado
31
+ * @param path Caminho para o arquivo de certificado
32
+ */
33
+ setPath(path) {
34
+ this.certificate.path = path;
35
+ return this;
36
+ }
37
+ /**
38
+ * Define o tipo de certificado
39
+ * @param type Tipo do certificado
40
+ */
41
+ setType(type) {
42
+ this.certificate.type = type;
43
+ return this;
44
+ }
45
+ /**
46
+ * Define o caminho da chave privada (para certificados PEM)
47
+ * @param keyPath Caminho para a chave privada
48
+ */
49
+ setKeyPath(keyPath) {
50
+ this.certificate.keyPath = keyPath;
51
+ return this;
52
+ }
53
+ /**
54
+ * Constrói o objeto Certificate
55
+ */
56
+ build() {
57
+ if (!this.certificate.name) {
58
+ throw new Error('Nome do certificado é obrigatório');
59
+ }
60
+ return { ...this.certificate };
61
+ }
62
+ }
63
+ /**
64
+ * ✅ Função de conveniência para criar certificado (compatível com Java)
65
+ * @param name Nome do certificado
66
+ * @param password Senha do certificado (opcional)
67
+ * @returns Certificate configurado
68
+ */
69
+ export function createCertificate(name, password) {
70
+ const builder = new CertificateBuilder().setName(name);
71
+ if (password) {
72
+ builder.setPassword(password);
73
+ }
74
+ else {
75
+ Logger.info('⚠️ DEBUG: Senha não fornecida ou vazia');
76
+ }
77
+ const certificate = builder.build();
78
+ return certificate;
79
+ }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Wrapper utilitário para manipulação de respostas JSON e XML.
3
+ */
4
+ export declare class JsonResponse {
5
+ private data;
6
+ private statusCode?;
7
+ /**
8
+ * Cria uma instância de JsonResponse.
9
+ * @param data Dados da resposta (JSON ou XML em string).
10
+ */
11
+ constructor(data: unknown);
12
+ /**
13
+ * Define o status HTTP da resposta.
14
+ * @param status Código de status HTTP.
15
+ */
16
+ setStatus(status: number): void;
17
+ /**
18
+ * Obtém o status HTTP da resposta.
19
+ * @returns Código de status HTTP.
20
+ */
21
+ getStatus(): number;
22
+ /**
23
+ * Retorna um item do array como JsonResponse.
24
+ * @param index Índice do array.
25
+ * @returns Instância de JsonResponse para o item.
26
+ * @throws {Error} Se o índice não existir.
27
+ */
28
+ getFromArray(index: number): JsonResponse;
29
+ /**
30
+ * Retorna o valor de um campo de um item do array como string.
31
+ * @param index Índice do array.
32
+ * @param field Nome do campo.
33
+ * @returns Valor do campo como string.
34
+ * @throws {Error} Se o campo não existir no índice.
35
+ */
36
+ getStringFromArray(index: number, field: string): string;
37
+ /**
38
+ * Navega por um caminho aninhado nos dados.
39
+ * @param path Sequência de chaves ou índices.
40
+ * @returns Valor encontrado no caminho.
41
+ * @throws {Error} Se o caminho não existir.
42
+ */
43
+ getPath(...path: (string | number)[]): unknown;
44
+ /**
45
+ * Obtém o valor de uma chave como string.
46
+ * @param key Nome da chave.
47
+ * @returns Valor como string.
48
+ * @throws {Error} Se o campo não existir.
49
+ */
50
+ getString(key: string): string;
51
+ /**
52
+ * Obtém o valor de uma chave.
53
+ * @param key Nome da chave.
54
+ * @returns Valor da chave.
55
+ */
56
+ get(key: string): unknown;
57
+ /**
58
+ * Obtém um array de JsonResponse a partir de uma chave ou do root.
59
+ * @param key Nome da chave (opcional).
60
+ * @returns Array de JsonResponse.
61
+ * @throws {Error} Se o campo não for um array.
62
+ */
63
+ getArray(key?: string): JsonResponse[];
64
+ /**
65
+ * Obtém um objeto JsonResponse a partir de uma chave.
66
+ * @param key Nome da chave.
67
+ * @returns Instância de JsonResponse para o objeto.
68
+ * @throws {Error} Se o campo não for um objeto.
69
+ */
70
+ getObject(key: string): JsonResponse;
71
+ /**
72
+ * Retorna os dados brutos da resposta.
73
+ * @returns Dados originais.
74
+ */
75
+ raw(): unknown;
76
+ /**
77
+ * Verifica se os dados são XML.
78
+ * @returns True se for XML, false caso contrário.
79
+ */
80
+ isXml(): boolean;
81
+ /**
82
+ * Tenta navegar pelo caminho, retornando valor padrão se não encontrar.
83
+ * @param defaultValue Valor padrão.
84
+ * @param path Sequência de chaves ou índices.
85
+ * @returns Valor encontrado ou valor padrão.
86
+ */
87
+ getPathOrDefault(defaultValue: unknown, ...path: (string | number)[]): unknown;
88
+ /**
89
+ * Retorna os dados como string formatada (JSON).
90
+ * @returns String JSON formatada.
91
+ */
92
+ toString(): string;
93
+ /**
94
+ * Compara se os dados são iguais a outro JsonResponse.
95
+ * @param other Outra instância de JsonResponse.
96
+ * @returns True se forem iguais.
97
+ */
98
+ equals(other: JsonResponse): boolean;
99
+ /**
100
+ * Verifica se uma chave existe nos dados.
101
+ * @param key Nome da chave.
102
+ * @returns True se existir.
103
+ */
104
+ hasKey(key: string): boolean;
105
+ /**
106
+ * Verifica se os dados estão vazios.
107
+ * @returns True se estiver vazio.
108
+ */
109
+ isEmpty(): boolean;
110
+ /**
111
+ * Extrai XML do corpo da resposta (async).
112
+ * @returns Objeto convertido do XML.
113
+ * @throws {Error} Se os dados não forem XML.
114
+ */
115
+ extractXml(): Promise<unknown>;
116
+ }
@@ -0,0 +1,206 @@
1
+ import { parseStringPromise } from 'xml2js';
2
+ /**
3
+ * Wrapper utilitário para manipulação de respostas JSON e XML.
4
+ */
5
+ export class JsonResponse {
6
+ data;
7
+ statusCode;
8
+ /**
9
+ * Cria uma instância de JsonResponse.
10
+ * @param data Dados da resposta (JSON ou XML em string).
11
+ */
12
+ constructor(data) {
13
+ this.data = data;
14
+ }
15
+ /**
16
+ * Define o status HTTP da resposta.
17
+ * @param status Código de status HTTP.
18
+ */
19
+ setStatus(status) {
20
+ this.statusCode = status;
21
+ }
22
+ /**
23
+ * Obtém o status HTTP da resposta.
24
+ * @returns Código de status HTTP.
25
+ */
26
+ getStatus() {
27
+ return this.statusCode || 0;
28
+ }
29
+ /**
30
+ * Retorna um item do array como JsonResponse.
31
+ * @param index Índice do array.
32
+ * @returns Instância de JsonResponse para o item.
33
+ * @throws {Error} Se o índice não existir.
34
+ */
35
+ getFromArray(index) {
36
+ if (Array.isArray(this.data) && this.data[index] !== undefined) {
37
+ return new JsonResponse(this.data[index]);
38
+ }
39
+ throw new Error(`Índice ${index} não encontrado no array`);
40
+ }
41
+ /**
42
+ * Retorna o valor de um campo de um item do array como string.
43
+ * @param index Índice do array.
44
+ * @param field Nome do campo.
45
+ * @returns Valor do campo como string.
46
+ * @throws {Error} Se o campo não existir no índice.
47
+ */
48
+ getStringFromArray(index, field) {
49
+ if (Array.isArray(this.data) && this.data[index]) {
50
+ const item = this.data[index];
51
+ const value = item[field];
52
+ return value ? String(value) : '';
53
+ }
54
+ throw new Error(`Campo '${field}' não encontrado no índice ${index}`);
55
+ }
56
+ /**
57
+ * Navega por um caminho aninhado nos dados.
58
+ * @param path Sequência de chaves ou índices.
59
+ * @returns Valor encontrado no caminho.
60
+ * @throws {Error} Se o caminho não existir.
61
+ */
62
+ getPath(...path) {
63
+ let current = this.data;
64
+ for (const segment of path) {
65
+ if (current == null) {
66
+ throw new Error(`Caminho ${path.join('.')} não encontrado`);
67
+ }
68
+ if (typeof segment === 'number' && Array.isArray(current)) {
69
+ current = current[segment];
70
+ }
71
+ else if (typeof segment === 'string' && typeof current === 'object' && current !== null) {
72
+ current = current[segment];
73
+ }
74
+ else {
75
+ throw new Error(`Não foi possível navegar para ${segment} em ${path.join('.')}`);
76
+ }
77
+ }
78
+ return current;
79
+ }
80
+ /**
81
+ * Obtém o valor de uma chave como string.
82
+ * @param key Nome da chave.
83
+ * @returns Valor como string.
84
+ * @throws {Error} Se o campo não existir.
85
+ */
86
+ getString(key) {
87
+ const obj = this.data;
88
+ const value = obj[key];
89
+ if (value === undefined || value === null) {
90
+ throw new Error(`Campo '${key}' não encontrado no JSON`);
91
+ }
92
+ return String(value);
93
+ }
94
+ /**
95
+ * Obtém o valor de uma chave.
96
+ * @param key Nome da chave.
97
+ * @returns Valor da chave.
98
+ */
99
+ get(key) {
100
+ const obj = this.data;
101
+ return obj[key];
102
+ }
103
+ /**
104
+ * Obtém um array de JsonResponse a partir de uma chave ou do root.
105
+ * @param key Nome da chave (opcional).
106
+ * @returns Array de JsonResponse.
107
+ * @throws {Error} Se o campo não for um array.
108
+ */
109
+ getArray(key) {
110
+ const obj = this.data;
111
+ const targetData = key ? obj[key] : this.data;
112
+ if (!Array.isArray(targetData)) {
113
+ throw new Error(`Campo '${key || 'root'}' não é um array`);
114
+ }
115
+ return targetData.map((item) => new JsonResponse(item));
116
+ }
117
+ /**
118
+ * Obtém um objeto JsonResponse a partir de uma chave.
119
+ * @param key Nome da chave.
120
+ * @returns Instância de JsonResponse para o objeto.
121
+ * @throws {Error} Se o campo não for um objeto.
122
+ */
123
+ getObject(key) {
124
+ const obj = this.data;
125
+ const value = obj[key];
126
+ if (!value || typeof value !== 'object') {
127
+ throw new Error(`Campo '${key}' não é um objeto`);
128
+ }
129
+ return new JsonResponse(value);
130
+ }
131
+ /**
132
+ * Retorna os dados brutos da resposta.
133
+ * @returns Dados originais.
134
+ */
135
+ raw() {
136
+ return this.data;
137
+ }
138
+ /**
139
+ * Verifica se os dados são XML.
140
+ * @returns True se for XML, false caso contrário.
141
+ */
142
+ isXml() {
143
+ return typeof this.data === 'string' && this.data.trim().startsWith('<');
144
+ }
145
+ /**
146
+ * Tenta navegar pelo caminho, retornando valor padrão se não encontrar.
147
+ * @param defaultValue Valor padrão.
148
+ * @param path Sequência de chaves ou índices.
149
+ * @returns Valor encontrado ou valor padrão.
150
+ */
151
+ getPathOrDefault(defaultValue, ...path) {
152
+ try {
153
+ return this.getPath(...path);
154
+ }
155
+ catch {
156
+ return defaultValue;
157
+ }
158
+ }
159
+ /**
160
+ * Retorna os dados como string formatada (JSON).
161
+ * @returns String JSON formatada.
162
+ */
163
+ toString() {
164
+ return JSON.stringify(this.data, null, 2);
165
+ }
166
+ /**
167
+ * Compara se os dados são iguais a outro JsonResponse.
168
+ * @param other Outra instância de JsonResponse.
169
+ * @returns True se forem iguais.
170
+ */
171
+ equals(other) {
172
+ return JSON.stringify(this.data) === JSON.stringify(other.data);
173
+ }
174
+ /**
175
+ * Verifica se uma chave existe nos dados.
176
+ * @param key Nome da chave.
177
+ * @returns True se existir.
178
+ */
179
+ hasKey(key) {
180
+ return typeof this.data === 'object' && this.data !== null && key in this.data;
181
+ }
182
+ /**
183
+ * Verifica se os dados estão vazios.
184
+ * @returns True se estiver vazio.
185
+ */
186
+ isEmpty() {
187
+ if (Array.isArray(this.data)) {
188
+ return this.data.length === 0;
189
+ }
190
+ if (typeof this.data === 'object' && this.data !== null) {
191
+ return Object.keys(this.data).length === 0;
192
+ }
193
+ return this.data === null || this.data === undefined;
194
+ }
195
+ /**
196
+ * Extrai XML do corpo da resposta (async).
197
+ * @returns Objeto convertido do XML.
198
+ * @throws {Error} Se os dados não forem XML.
199
+ */
200
+ async extractXml() {
201
+ if (typeof this.data === 'string' && this.data.trim().startsWith('<')) {
202
+ return await parseStringPromise(this.data);
203
+ }
204
+ throw new Error('Dados não são XML');
205
+ }
206
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * 📱 Sistema de Visualização Integrada para DeviceFarm
3
+ * @description Integra visualização local com o DeviceFarm remoto com detecção automática de projetos consumidores
4
+ * @author AutoCore Team
5
+ * @version 2.0.0
6
+ */
7
+ /**
8
+ * 📱 DeviceFarm Viewer com suporte a projetos consumidores
9
+ */
10
+ export declare class DeviceFarmViewer {
11
+ private static isActive;
12
+ private static session;
13
+ private static stepCounter;
14
+ private static consumerProjectPath;
15
+ /**
16
+ * 🎯 Configura projeto consumidor automaticamente
17
+ */
18
+ private static setupConsumerProject;
19
+ /**
20
+ * 🔄 Sincroniza screenshots do projeto consumidor para o viewer
21
+ */
22
+ private static syncConsumerScreenshots;
23
+ /**
24
+ * 📸 Adiciona screenshot sincronizado
25
+ */
26
+ private static addScreenshotFromSync;
27
+ /**
28
+ * 🚀 Inicia o viewer integrado
29
+ */
30
+ static start(deviceId?: string): Promise<string>;
31
+ /**
32
+ * 🎨 Gera HTML integrado com DeviceFarm com dados embutidos (SEM SERVIDOR)
33
+ */
34
+ private static generateIntegratedHtml;
35
+ /**
36
+ * 📄 JavaScript para polling e atualização dinâmica
37
+ */
38
+ private static getViewerJavaScript;
39
+ /**
40
+ * 📸 Adiciona screenshot (chamado automaticamente por MobileActions)
41
+ */
42
+ static addScreenshot(filename: string, description: string): void;
43
+ /**
44
+ * 📋 Copia screenshot para pasta do viewer para exibição no HTML
45
+ */
46
+ private static copyScreenshotToViewer;
47
+ /**
48
+ * � Garante que todos os screenshots possuam dados base64 embutidos
49
+ */
50
+ private static ensureBase64ForScreenshots;
51
+ /**
52
+ * 🖼️ Converte screenshot em data URI para uso offline
53
+ */
54
+ private static loadScreenshotAsDataUri;
55
+ /**
56
+ * 🧪 Detecta MIME-Type baseado na extensão do arquivo
57
+ */
58
+ private static detectImageMimeType;
59
+ /**
60
+ * �🛑 Para o viewer
61
+ */
62
+ static stop(): Promise<void>;
63
+ /**
64
+ * 📁 Criar diretórios necessários
65
+ */
66
+ private static ensureDirectories;
67
+ /**
68
+ * 💾 Salva dados da sessão
69
+ */
70
+ private static saveSessionData;
71
+ /**
72
+ * 📄 Estado atual (para debugging)
73
+ */
74
+ static getStatus(): {
75
+ isActive: boolean;
76
+ stepCounter: number;
77
+ consumerProject: string | null;
78
+ };
79
+ }