@qvac/ocr-ggml 0.0.1 → 0.1.1

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 (57) hide show
  1. package/LICENSE +179 -0
  2. package/NOTICE +63 -0
  3. package/README.md +330 -0
  4. package/addonLogging.d.ts +7 -0
  5. package/addonLogging.js +4 -0
  6. package/binding.js +21 -0
  7. package/index.d.ts +145 -0
  8. package/index.js +383 -0
  9. package/lib/error.js +80 -0
  10. package/ocr-ggml.js +121 -0
  11. package/package.json +96 -7
  12. package/prebuilds/android-arm64/qvac__ocr-ggml/libqvac-ggml-cpu-android_armv8.0_1.so +0 -0
  13. package/prebuilds/android-arm64/qvac__ocr-ggml/libqvac-ggml-cpu-android_armv8.2_1.so +0 -0
  14. package/prebuilds/android-arm64/qvac__ocr-ggml/libqvac-ggml-cpu-android_armv8.2_2.so +0 -0
  15. package/prebuilds/android-arm64/qvac__ocr-ggml/libqvac-ggml-cpu-android_armv8.6_1.so +0 -0
  16. package/prebuilds/android-arm64/qvac__ocr-ggml/libqvac-ggml-cpu-android_armv9.0_1.so +0 -0
  17. package/prebuilds/android-arm64/qvac__ocr-ggml/libqvac-ggml-cpu-android_armv9.2_1.so +0 -0
  18. package/prebuilds/android-arm64/qvac__ocr-ggml/libqvac-ggml-cpu-android_armv9.2_2.so +0 -0
  19. package/prebuilds/android-arm64/qvac__ocr-ggml.bare +0 -0
  20. package/prebuilds/darwin-arm64/qvac__ocr-ggml.bare +0 -0
  21. package/prebuilds/darwin-arm64/qvac__ocr-ggml.bare.exports +4277 -0
  22. package/prebuilds/darwin-x64/qvac__ocr-ggml.bare +0 -0
  23. package/prebuilds/darwin-x64/qvac__ocr-ggml.bare.exports +4322 -0
  24. package/prebuilds/ios-arm64/qvac__ocr-ggml.bare +0 -0
  25. package/prebuilds/ios-arm64/qvac__ocr-ggml.bare.exports +4262 -0
  26. package/prebuilds/ios-arm64-simulator/qvac__ocr-ggml.bare +0 -0
  27. package/prebuilds/ios-arm64-simulator/qvac__ocr-ggml.bare.exports +4262 -0
  28. package/prebuilds/ios-x64-simulator/qvac__ocr-ggml.bare +0 -0
  29. package/prebuilds/ios-x64-simulator/qvac__ocr-ggml.bare.exports +4311 -0
  30. package/prebuilds/linux-arm64/qvac__ocr-ggml.bare +0 -0
  31. package/prebuilds/linux-x64/qvac__ocr-ggml.bare +0 -0
  32. package/prebuilds/win32-x64/qvac__ocr-ggml.bare +0 -0
  33. package/prebuilds/win32-x64/qvac__ocr-ggml.bare.exports +0 -0
  34. package/test/integration/canvas-size.test.js +75 -0
  35. package/test/integration/doctr-basic.test.js +124 -0
  36. package/test/integration/doctr-clinical-chemistry.test.js +64 -0
  37. package/test/integration/doctr-ct-scan.test.js +66 -0
  38. package/test/integration/doctr-lab-results.test.js +65 -0
  39. package/test/integration/doctr-liver-function.test.js +67 -0
  40. package/test/integration/doctr-models.test.js +132 -0
  41. package/test/integration/doctr-param-validation.test.js +83 -0
  42. package/test/integration/error-handling.test.js +302 -0
  43. package/test/integration/full-coverage.test.js +292 -0
  44. package/test/integration/full-ocr-suite.test.js +83 -0
  45. package/test/integration/image-formats.test.js +168 -0
  46. package/test/integration/large-images.test.js +81 -0
  47. package/test/integration/lifecycle.test.js +269 -0
  48. package/test/integration/ocr-basic.test.js +70 -0
  49. package/test/integration/param-validation.test.js +86 -0
  50. package/test/integration/pipeline.test.js +61 -0
  51. package/test/integration/run-internal-ordering.test.js +75 -0
  52. package/test/integration/run-tests.sh +43 -0
  53. package/test/integration/run-with-exit.js +71 -0
  54. package/test/integration/utils.js +694 -0
  55. package/test/mobile/integration-runtime.cjs +71 -0
  56. package/test/mobile/integration.auto.cjs +102 -0
  57. package/test/mobile/test-groups.json +55 -0
@@ -0,0 +1,71 @@
1
+ 'use strict'
2
+
3
+ const path = require('bare-path')
4
+ const fs = require('bare-fs')
5
+ const os = require('bare-os')
6
+ const { pathToFileURL } = require('bare-url')
7
+
8
+ // ---------------------------------------------------------------------------
9
+ // Test filter – allows CI to restrict which tests actually execute.
10
+ //
11
+ // The WDIO before-hook pushes a testFilter.txt file (containing a regex
12
+ // pattern) via Appium pushFile *before* clicking "Run Automated Tests".
13
+ //
14
+ // iOS: pushed to @bundleId:documents/ → lands in global.testDir
15
+ // Android: pushed to /data/local/tmp/ → release APKs can't use
16
+ // @package/ (needs debuggable), so we use the shared tmp dir
17
+ // which is readable by all apps.
18
+ //
19
+ // Each run*Test wrapper consults __shouldRunTest(); when the test name
20
+ // doesn't match the pattern the wrapper returns a zero-count summary
21
+ // instantly – no model is loaded, no inference runs, zero resource cost.
22
+ // ---------------------------------------------------------------------------
23
+ let __filterLoaded = false
24
+ let __filterRe = null
25
+
26
+ function tryLoadFilter (filePath) {
27
+ try {
28
+ if (fs.existsSync(filePath)) {
29
+ const raw = fs.readFileSync(filePath, 'utf-8').trim()
30
+ if (raw) {
31
+ __filterRe = new RegExp(raw)
32
+ console.log('[TestFilter] loaded pattern from ' + filePath + ': ' + raw)
33
+ }
34
+ try { fs.unlinkSync(filePath) } catch (_) {}
35
+ return true
36
+ }
37
+ } catch (e) {
38
+ console.log('[TestFilter] read error at ' + filePath + ':', e.message)
39
+ }
40
+ return false
41
+ }
42
+
43
+ global.__shouldRunTest = function shouldRunTest (testName) {
44
+ if (!__filterLoaded) {
45
+ __filterLoaded = true
46
+
47
+ const dir = global.testDir
48
+ if (dir) tryLoadFilter(path.join(dir, 'testFilter.txt'))
49
+
50
+ if (!__filterRe && os.platform() === 'android') {
51
+ tryLoadFilter('/data/local/tmp/testFilter.txt')
52
+ }
53
+ }
54
+ if (!__filterRe) return true
55
+ return __filterRe.test(testName)
56
+ }
57
+
58
+ async function runIntegrationModule (relativeModulePath, options = {}) {
59
+ const modulePath = path.join(__dirname, relativeModulePath)
60
+
61
+ if (!fs.existsSync(modulePath)) {
62
+ console.warn(`[integration-runner] Missing module: ${relativeModulePath}`)
63
+ return { modulePath: 'missing', summary: { total: 0, passed: 0, failed: 0 } }
64
+ }
65
+
66
+ const moduleUrl = pathToFileURL(modulePath).href
67
+ await import(moduleUrl)
68
+ return { modulePath, summary: null }
69
+ }
70
+
71
+ global.runIntegrationModule = runIntegrationModule
@@ -0,0 +1,102 @@
1
+ 'use strict'
2
+ require('./integration-runtime.cjs')
3
+
4
+ // AUTO-GENERATED FILE. Run `npm run test:mobile:generate` to update.
5
+ // Each function mirrors a single file under test/integration/.
6
+ // Functions are invoked dynamically by the mobile test runner framework.
7
+
8
+ /* global runIntegrationModule */
9
+
10
+ /* global __shouldRunTest */
11
+
12
+ const __FILTERED = { modulePath: 'filtered', summary: { total: 0, passed: 0, failed: 0 } }
13
+
14
+ async function runCanvasSizeTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
15
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runCanvasSizeTest')) return __FILTERED
16
+ return runIntegrationModule('../integration/canvas-size.test.js', options)
17
+ }
18
+
19
+ async function runDoctrBasicTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
20
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runDoctrBasicTest')) return __FILTERED
21
+ return runIntegrationModule('../integration/doctr-basic.test.js', options)
22
+ }
23
+
24
+ async function runDoctrClinicalChemistryTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
25
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runDoctrClinicalChemistryTest')) return __FILTERED
26
+ return runIntegrationModule('../integration/doctr-clinical-chemistry.test.js', options)
27
+ }
28
+
29
+ async function runDoctrCtScanTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
30
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runDoctrCtScanTest')) return __FILTERED
31
+ return runIntegrationModule('../integration/doctr-ct-scan.test.js', options)
32
+ }
33
+
34
+ async function runDoctrLabResultsTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
35
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runDoctrLabResultsTest')) return __FILTERED
36
+ return runIntegrationModule('../integration/doctr-lab-results.test.js', options)
37
+ }
38
+
39
+ async function runDoctrLiverFunctionTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
40
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runDoctrLiverFunctionTest')) return __FILTERED
41
+ return runIntegrationModule('../integration/doctr-liver-function.test.js', options)
42
+ }
43
+
44
+ async function runDoctrModelsTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
45
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runDoctrModelsTest')) return __FILTERED
46
+ return runIntegrationModule('../integration/doctr-models.test.js', options)
47
+ }
48
+
49
+ async function runDoctrParamValidationTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
50
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runDoctrParamValidationTest')) return __FILTERED
51
+ return runIntegrationModule('../integration/doctr-param-validation.test.js', options)
52
+ }
53
+
54
+ async function runErrorHandlingTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
55
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runErrorHandlingTest')) return __FILTERED
56
+ return runIntegrationModule('../integration/error-handling.test.js', options)
57
+ }
58
+
59
+ async function runFullCoverageTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
60
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runFullCoverageTest')) return __FILTERED
61
+ return runIntegrationModule('../integration/full-coverage.test.js', options)
62
+ }
63
+
64
+ async function runFullOcrSuiteTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
65
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runFullOcrSuiteTest')) return __FILTERED
66
+ return runIntegrationModule('../integration/full-ocr-suite.test.js', options)
67
+ }
68
+
69
+ async function runImageFormatsTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
70
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runImageFormatsTest')) return __FILTERED
71
+ return runIntegrationModule('../integration/image-formats.test.js', options)
72
+ }
73
+
74
+ async function runLargeImagesTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
75
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runLargeImagesTest')) return __FILTERED
76
+ return runIntegrationModule('../integration/large-images.test.js', options)
77
+ }
78
+
79
+ async function runLifecycleTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
80
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runLifecycleTest')) return __FILTERED
81
+ return runIntegrationModule('../integration/lifecycle.test.js', options)
82
+ }
83
+
84
+ async function runOcrBasicTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
85
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runOcrBasicTest')) return __FILTERED
86
+ return runIntegrationModule('../integration/ocr-basic.test.js', options)
87
+ }
88
+
89
+ async function runParamValidationTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
90
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runParamValidationTest')) return __FILTERED
91
+ return runIntegrationModule('../integration/param-validation.test.js', options)
92
+ }
93
+
94
+ async function runPipelineTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
95
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runPipelineTest')) return __FILTERED
96
+ return runIntegrationModule('../integration/pipeline.test.js', options)
97
+ }
98
+
99
+ async function runRunInternalOrderingTest (options = {}) { // eslint-disable-line no-unused-vars -- called dynamically by the mobile test runner via string lookup
100
+ if (typeof __shouldRunTest === 'function' && !__shouldRunTest('runRunInternalOrderingTest')) return __FILTERED
101
+ return runIntegrationModule('../integration/run-internal-ordering.test.js', options)
102
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "android": {
3
+ "perf": [
4
+ "runDoctrClinicalChemistryTest",
5
+ "runDoctrCtScanTest",
6
+ "runDoctrLabResultsTest",
7
+ "runDoctrLiverFunctionTest"
8
+ ],
9
+ "regularA": [
10
+ "runDoctrBasicTest",
11
+ "runDoctrModelsTest",
12
+ "runDoctrParamValidationTest",
13
+ "runErrorHandlingTest",
14
+ "runFullCoverageTest",
15
+ "runFullOcrSuiteTest"
16
+ ],
17
+ "regularB": [
18
+ "runCanvasSizeTest",
19
+ "runImageFormatsTest",
20
+ "runLargeImagesTest",
21
+ "runLifecycleTest",
22
+ "runOcrBasicTest",
23
+ "runParamValidationTest",
24
+ "runPipelineTest",
25
+ "runRunInternalOrderingTest"
26
+ ]
27
+ },
28
+ "ios": {
29
+ "perf": [
30
+ "runDoctrClinicalChemistryTest",
31
+ "runDoctrCtScanTest",
32
+ "runDoctrLabResultsTest",
33
+ "runDoctrLiverFunctionTest"
34
+ ],
35
+ "regularA": [
36
+ "runDoctrBasicTest",
37
+ "runDoctrModelsTest",
38
+ "runDoctrParamValidationTest",
39
+ "runErrorHandlingTest",
40
+ "runFullCoverageTest",
41
+ "runFullOcrSuiteTest"
42
+ ],
43
+ "regularB": [
44
+ "runCanvasSizeTest",
45
+ "runImageFormatsTest",
46
+ "runLargeImagesTest",
47
+ "runLifecycleTest",
48
+ "runOcrBasicTest",
49
+ "runParamValidationTest",
50
+ "runPipelineTest",
51
+ "runRunInternalOrderingTest"
52
+ ]
53
+ },
54
+ "perf_report_filter": "clinical_chemistry|ct_scan_report|lab_results|liver_function_test"
55
+ }