@abyss-project/extract 0.0.0-stage → 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 (183) hide show
  1. package/.eslintrc.js +32 -0
  2. package/.prettierrc +5 -0
  3. package/README.md +21 -2
  4. package/dist/api/extraction-plan-preset.api.d.ts +9 -0
  5. package/dist/api/extraction-plan-preset.api.js +36 -0
  6. package/dist/api/extraction-plan-preset.api.js.map +1 -0
  7. package/dist/api/extraction-plan-preset.api.test.d.ts +1 -0
  8. package/dist/api/extraction-plan-preset.api.test.js +51 -0
  9. package/dist/api/extraction-plan-preset.api.test.js.map +1 -0
  10. package/dist/api/extraction-settings.api.d.ts +4 -0
  11. package/dist/api/extraction-settings.api.js +22 -0
  12. package/dist/api/extraction-settings.api.js.map +1 -0
  13. package/dist/api/extraction.api.d.ts +76 -0
  14. package/dist/api/extraction.api.js +414 -0
  15. package/dist/api/extraction.api.js.map +1 -0
  16. package/dist/api/extraction.application.api.d.ts +4 -0
  17. package/dist/api/extraction.application.api.js +23 -0
  18. package/dist/api/extraction.application.api.js.map +1 -0
  19. package/dist/api/extraction.application.api.test.d.ts +1 -0
  20. package/dist/api/extraction.application.api.test.js +69 -0
  21. package/dist/api/extraction.application.api.test.js.map +1 -0
  22. package/dist/api/index.d.ts +4 -0
  23. package/dist/api/index.js +21 -0
  24. package/dist/api/index.js.map +1 -0
  25. package/dist/constants/extract.constants.d.ts +4 -0
  26. package/dist/constants/extract.constants.js +91 -0
  27. package/dist/constants/extract.constants.js.map +1 -0
  28. package/dist/constants/index.d.ts +1 -0
  29. package/dist/constants/index.js +18 -0
  30. package/dist/constants/index.js.map +1 -0
  31. package/dist/index.d.ts +127 -0
  32. package/dist/index.js +210 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/types/enum/api-error.enum.d.ts +31 -0
  35. package/dist/types/enum/api-error.enum.js +37 -0
  36. package/dist/types/enum/api-error.enum.js.map +1 -0
  37. package/dist/types/enum/combine-strategy.enum.d.ts +5 -0
  38. package/dist/types/enum/combine-strategy.enum.js +10 -0
  39. package/dist/types/enum/combine-strategy.enum.js.map +1 -0
  40. package/dist/types/enum/document-type.enum.d.ts +10 -0
  41. package/dist/types/enum/document-type.enum.js +15 -0
  42. package/dist/types/enum/document-type.enum.js.map +1 -0
  43. package/dist/types/enum/extract-bank.enum.d.ts +50 -0
  44. package/dist/types/enum/extract-bank.enum.js +327 -0
  45. package/dist/types/enum/extract-bank.enum.js.map +1 -0
  46. package/dist/types/enum/extract-field-format.enum.d.ts +7 -0
  47. package/dist/types/enum/extract-field-format.enum.js +12 -0
  48. package/dist/types/enum/extract-field-format.enum.js.map +1 -0
  49. package/dist/types/enum/extract-field-key.enum.d.ts +59 -0
  50. package/dist/types/enum/extract-field-key.enum.js +64 -0
  51. package/dist/types/enum/extract-field-key.enum.js.map +1 -0
  52. package/dist/types/enum/extraction-feedback-issue-type.enum.d.ts +8 -0
  53. package/dist/types/enum/extraction-feedback-issue-type.enum.js +13 -0
  54. package/dist/types/enum/extraction-feedback-issue-type.enum.js.map +1 -0
  55. package/dist/types/enum/extraction-step-status.enum.d.ts +6 -0
  56. package/dist/types/enum/extraction-step-status.enum.js +11 -0
  57. package/dist/types/enum/extraction-step-status.enum.js.map +1 -0
  58. package/dist/types/enum/extraction-warning.enum.d.ts +10 -0
  59. package/dist/types/enum/extraction-warning.enum.js +15 -0
  60. package/dist/types/enum/extraction-warning.enum.js.map +1 -0
  61. package/dist/types/enum/file-scan-status.enum.d.ts +1 -0
  62. package/dist/types/enum/file-scan-status.enum.js +3 -0
  63. package/dist/types/enum/file-scan-status.enum.js.map +1 -0
  64. package/dist/types/enum/index.d.ts +12 -0
  65. package/dist/types/enum/index.js +29 -0
  66. package/dist/types/enum/index.js.map +1 -0
  67. package/dist/types/enum/interpreter-kind.enum.d.ts +5 -0
  68. package/dist/types/enum/interpreter-kind.enum.js +10 -0
  69. package/dist/types/enum/interpreter-kind.enum.js.map +1 -0
  70. package/dist/types/enum/provider-kind.enum.d.ts +10 -0
  71. package/dist/types/enum/provider-kind.enum.js +16 -0
  72. package/dist/types/enum/provider-kind.enum.js.map +1 -0
  73. package/dist/types/index.d.ts +2 -0
  74. package/dist/types/index.js +19 -0
  75. package/dist/types/index.js.map +1 -0
  76. package/dist/types/interface/api/index.d.ts +5 -0
  77. package/dist/types/interface/api/index.js +22 -0
  78. package/dist/types/interface/api/index.js.map +1 -0
  79. package/dist/types/interface/api/requests/extraction.request.d.ts +259 -0
  80. package/dist/types/interface/api/requests/extraction.request.js +3 -0
  81. package/dist/types/interface/api/requests/extraction.request.js.map +1 -0
  82. package/dist/types/interface/api/requests/index.d.ts +1 -0
  83. package/dist/types/interface/api/requests/index.js +18 -0
  84. package/dist/types/interface/api/requests/index.js.map +1 -0
  85. package/dist/types/interface/api/responses/extraction.response.d.ts +424 -0
  86. package/dist/types/interface/api/responses/extraction.response.js +3 -0
  87. package/dist/types/interface/api/responses/extraction.response.js.map +1 -0
  88. package/dist/types/interface/api/responses/index.d.ts +1 -0
  89. package/dist/types/interface/api/responses/index.js +18 -0
  90. package/dist/types/interface/api/responses/index.js.map +1 -0
  91. package/dist/types/interface/api/type-message/api-error.d.ts +6 -0
  92. package/dist/types/interface/api/type-message/api-error.js +3 -0
  93. package/dist/types/interface/api/type-message/api-error.js.map +1 -0
  94. package/dist/types/interface/api/type-message/base-paginate.d.ts +10 -0
  95. package/dist/types/interface/api/type-message/base-paginate.js +3 -0
  96. package/dist/types/interface/api/type-message/base-paginate.js.map +1 -0
  97. package/dist/types/interface/api/type-message/response.d.ts +5 -0
  98. package/dist/types/interface/api/type-message/response.js +3 -0
  99. package/dist/types/interface/api/type-message/response.js.map +1 -0
  100. package/dist/types/interface/index.d.ts +2 -0
  101. package/dist/types/interface/index.js +19 -0
  102. package/dist/types/interface/index.js.map +1 -0
  103. package/dist/types/interface/models/extraction-fetched-provenance.dto.test.d.ts +1 -0
  104. package/dist/types/interface/models/extraction-fetched-provenance.dto.test.js +165 -0
  105. package/dist/types/interface/models/extraction-fetched-provenance.dto.test.js.map +1 -0
  106. package/dist/types/interface/models/extraction-plan.dto.d.ts +192 -0
  107. package/dist/types/interface/models/extraction-plan.dto.js +13 -0
  108. package/dist/types/interface/models/extraction-plan.dto.js.map +1 -0
  109. package/dist/types/interface/models/extraction-plan.dto.test.d.ts +1 -0
  110. package/dist/types/interface/models/extraction-plan.dto.test.js +40 -0
  111. package/dist/types/interface/models/extraction-plan.dto.test.js.map +1 -0
  112. package/dist/types/interface/models/extraction-spatial-template.dto.d.ts +37 -0
  113. package/dist/types/interface/models/extraction-spatial-template.dto.js +3 -0
  114. package/dist/types/interface/models/extraction-spatial-template.dto.js.map +1 -0
  115. package/dist/types/interface/models/extraction-spatial-template.dto.test.d.ts +1 -0
  116. package/dist/types/interface/models/extraction-spatial-template.dto.test.js +32 -0
  117. package/dist/types/interface/models/extraction-spatial-template.dto.test.js.map +1 -0
  118. package/dist/types/interface/models/extraction.dto.d.ts +255 -0
  119. package/dist/types/interface/models/extraction.dto.js +28 -0
  120. package/dist/types/interface/models/extraction.dto.js.map +1 -0
  121. package/dist/types/interface/models/index.d.ts +3 -0
  122. package/dist/types/interface/models/index.js +20 -0
  123. package/dist/types/interface/models/index.js.map +1 -0
  124. package/dist/utils/enum.utils.d.ts +1 -0
  125. package/dist/utils/enum.utils.js +3 -0
  126. package/dist/utils/enum.utils.js.map +1 -0
  127. package/dist/utils/error.utils.d.ts +15 -0
  128. package/dist/utils/error.utils.js +25 -0
  129. package/dist/utils/error.utils.js.map +1 -0
  130. package/dist/utils/extraction-webhook.utils.d.ts +6 -0
  131. package/dist/utils/extraction-webhook.utils.js +17 -0
  132. package/dist/utils/extraction-webhook.utils.js.map +1 -0
  133. package/dist/utils/index.d.ts +3 -0
  134. package/dist/utils/index.js +20 -0
  135. package/dist/utils/index.js.map +1 -0
  136. package/package.json +58 -4
  137. package/src/api/extraction-plan-preset.api.test.ts +24 -0
  138. package/src/api/extraction-plan-preset.api.ts +97 -0
  139. package/src/api/extraction-settings.api.ts +53 -0
  140. package/src/api/extraction.api.ts +1012 -0
  141. package/src/api/extraction.application.api.test.ts +55 -0
  142. package/src/api/extraction.application.api.ts +73 -0
  143. package/src/api/index.ts +4 -0
  144. package/src/constants/extract.constants.ts +109 -0
  145. package/src/constants/index.ts +1 -0
  146. package/src/index.ts +305 -0
  147. package/src/types/enum/api-error.enum.ts +33 -0
  148. package/src/types/enum/combine-strategy.enum.ts +7 -0
  149. package/src/types/enum/document-type.enum.ts +11 -0
  150. package/src/types/enum/extract-bank.enum.ts +363 -0
  151. package/src/types/enum/extract-field-format.enum.ts +16 -0
  152. package/src/types/enum/extract-field-key.enum.ts +77 -0
  153. package/src/types/enum/extraction-feedback-issue-type.enum.ts +10 -0
  154. package/src/types/enum/extraction-step-status.enum.ts +7 -0
  155. package/src/types/enum/extraction-warning.enum.ts +78 -0
  156. package/src/types/enum/file-scan-status.enum.ts +33 -0
  157. package/src/types/enum/index.ts +12 -0
  158. package/src/types/enum/interpreter-kind.enum.ts +7 -0
  159. package/src/types/enum/provider-kind.enum.ts +13 -0
  160. package/src/types/index.ts +2 -0
  161. package/src/types/interface/api/index.ts +5 -0
  162. package/src/types/interface/api/requests/extraction.request.ts +423 -0
  163. package/src/types/interface/api/requests/index.ts +1 -0
  164. package/src/types/interface/api/responses/extraction.response.ts +488 -0
  165. package/src/types/interface/api/responses/index.ts +1 -0
  166. package/src/types/interface/api/type-message/api-error.ts +7 -0
  167. package/src/types/interface/api/type-message/base-paginate.ts +11 -0
  168. package/src/types/interface/api/type-message/response.ts +6 -0
  169. package/src/types/interface/index.ts +2 -0
  170. package/src/types/interface/models/extraction-fetched-provenance.dto.test.ts +204 -0
  171. package/src/types/interface/models/extraction-plan.dto.test.ts +60 -0
  172. package/src/types/interface/models/extraction-plan.dto.ts +280 -0
  173. package/src/types/interface/models/extraction-spatial-template.dto.test.ts +48 -0
  174. package/src/types/interface/models/extraction-spatial-template.dto.ts +48 -0
  175. package/src/types/interface/models/extraction.dto.ts +399 -0
  176. package/src/types/interface/models/index.ts +3 -0
  177. package/src/types/tests/extract-bank-catalogue.spec.ts +74 -0
  178. package/src/utils/enum.utils.ts +1 -0
  179. package/src/utils/error.utils.ts +30 -0
  180. package/src/utils/extraction-webhook.utils.ts +30 -0
  181. package/src/utils/index.ts +3 -0
  182. package/tsconfig.check.json +15 -0
  183. package/tsconfig.json +36 -0
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const enum_1 = require("../../enum");
4
+ const fv = {
5
+ value: 120,
6
+ confidence: 0.95,
7
+ chosen: {
8
+ provider: enum_1.ProviderKind.TEXT,
9
+ interpreter: enum_1.InterpreterKind.ALGORITHMIC,
10
+ providerId: 'pdf-auto',
11
+ interpreterId: 'algo-v1',
12
+ },
13
+ sources: [
14
+ {
15
+ mode: {
16
+ provider: enum_1.ProviderKind.TEXT,
17
+ interpreter: enum_1.InterpreterKind.ALGORITHMIC,
18
+ providerId: 'pdf-auto',
19
+ interpreterId: 'algo-v1',
20
+ },
21
+ value: 120,
22
+ confidence: 0.95,
23
+ signals: [],
24
+ },
25
+ ],
26
+ agreement: { agreed: false, distinctValues: 1 },
27
+ signals: [],
28
+ };
29
+ const fvWithSignals = {
30
+ value: 'FR7630001007941234567890185',
31
+ confidence: 0.98,
32
+ chosen: {
33
+ provider: enum_1.ProviderKind.TEXT,
34
+ interpreter: enum_1.InterpreterKind.ALGORITHMIC,
35
+ providerId: 'pdf-auto',
36
+ interpreterId: 'algo-v1',
37
+ },
38
+ sources: [
39
+ {
40
+ mode: {
41
+ provider: enum_1.ProviderKind.TEXT,
42
+ interpreter: enum_1.InterpreterKind.ALGORITHMIC,
43
+ providerId: 'pdf-auto',
44
+ interpreterId: 'algo-v1',
45
+ },
46
+ value: 'FR7630001007941234567890185',
47
+ confidence: 0.98,
48
+ signals: [
49
+ { kind: 'format', check: 'iban_mod97', passed: true, weight: 0.2 },
50
+ { kind: 'anchor', detail: "matched near 'IBAN' label", weight: 0.1 },
51
+ ],
52
+ },
53
+ ],
54
+ agreement: { agreed: true, distinctValues: 1 },
55
+ signals: [
56
+ { kind: 'format', check: 'iban_mod97', passed: true, weight: 0.2 },
57
+ { kind: 'coherence', check: 'balance_reconciliation', passed: true, weight: 0.3 },
58
+ { kind: 'agreement', agreed: true, modes: 2, weight: 0.1 },
59
+ ],
60
+ };
61
+ void fvWithSignals;
62
+ for (const sig of fvWithSignals.signals) {
63
+ if (sig.kind === 'format' || sig.kind === 'coherence') {
64
+ const _check = sig.check;
65
+ const _passed = sig.passed;
66
+ void _check;
67
+ void _passed;
68
+ }
69
+ else if (sig.kind === 'anchor') {
70
+ const _detail = sig.detail;
71
+ void _detail;
72
+ }
73
+ else {
74
+ const _agreed = sig.agreed;
75
+ const _modes = sig.modes;
76
+ void _agreed;
77
+ void _modes;
78
+ }
79
+ }
80
+ const manifest = {
81
+ resolvedPlan: {
82
+ stages: [
83
+ { runParallel: false, passes: [{ providerId: 'pdf-auto', interpreterId: 'algo-v1' }] },
84
+ ],
85
+ combine: enum_1.CombineStrategy.MAX_CONFIDENCE,
86
+ },
87
+ combine: enum_1.CombineStrategy.MAX_CONFIDENCE,
88
+ passes: [
89
+ {
90
+ providerId: 'pdf-auto',
91
+ providerVersion: '1.0.0',
92
+ interpreterId: 'algo-v1',
93
+ interpreterVersion: '1.0.0',
94
+ },
95
+ ],
96
+ createdAt: '2026-06-28T00:00:00.000Z',
97
+ };
98
+ const globalConfidence = {
99
+ stats: {
100
+ overall: 0.95,
101
+ mean: 0.95,
102
+ highest: 0.95,
103
+ lowest: 0.95,
104
+ median: 0.95,
105
+ belowThreshold: { threshold: 0.7, count: 0 },
106
+ fieldCount: 1,
107
+ },
108
+ method: enum_1.CombineStrategy.MAX_CONFIDENCE,
109
+ aggregation: 'weighted-by-field-importance',
110
+ perPass: [
111
+ {
112
+ mode: {
113
+ provider: enum_1.ProviderKind.TEXT,
114
+ interpreter: enum_1.InterpreterKind.ALGORITHMIC,
115
+ providerId: 'pdf-auto',
116
+ interpreterId: 'algo-v1',
117
+ },
118
+ confidence: 0.95,
119
+ fieldsContributed: 1,
120
+ ocrPageCount: 0,
121
+ },
122
+ ],
123
+ lowestFields: [{ fieldKey: 'totalTtc', confidence: 0.95 }],
124
+ };
125
+ const fetched = {
126
+ fieldsJson: { totalTtc: fv },
127
+ executionManifest: manifest,
128
+ globalConfidence,
129
+ usedOcr: true,
130
+ ocrPageCount: 3,
131
+ };
132
+ void fetched;
133
+ const totalTtc = (fetched.fieldsJson ?? {}).totalTtc;
134
+ if (totalTtc) {
135
+ const _chosenId = totalTtc.chosen.interpreterId;
136
+ const _sourceCount = totalTtc.sources.length;
137
+ void _chosenId;
138
+ void _sourceCount;
139
+ }
140
+ const _legacyRead = (fetched.fieldsJson ?? {})
141
+ .totalTtc;
142
+ void _legacyRead;
143
+ const getData = {
144
+ fields: { totalTtc: fv },
145
+ executionManifest: manifest,
146
+ globalConfidence,
147
+ };
148
+ void getData;
149
+ const _usedOcr = fetched.usedOcr;
150
+ const _ocrPages = fetched.ocrPageCount;
151
+ void _usedOcr;
152
+ void _ocrPages;
153
+ if (fetched.executionManifest) {
154
+ const _createdAt = fetched.executionManifest.createdAt;
155
+ const _passCount = fetched.executionManifest.passes.length;
156
+ void _createdAt;
157
+ void _passCount;
158
+ }
159
+ if (fetched.globalConfidence) {
160
+ const _overall = fetched.globalConfidence.stats.overall;
161
+ const _agg = fetched.globalConfidence.aggregation;
162
+ void _overall;
163
+ void _agg;
164
+ }
165
+ //# sourceMappingURL=extraction-fetched-provenance.dto.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraction-fetched-provenance.dto.test.js","sourceRoot":"","sources":["../../../../src/types/interface/models/extraction-fetched-provenance.dto.test.ts"],"names":[],"mappings":";;AAMA,qCAA4E;AAM5E,MAAM,EAAE,GAAgB;IACtB,KAAK,EAAE,GAAG;IACV,UAAU,EAAE,IAAI;IAChB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E,CAAC;IACb,MAAM,SAAS,GAAW,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC;IACxD,MAAM,YAAY,GAAW,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;IACrD,KAAK,SAAS,CAAC;IACf,KAAK,YAAY,CAAC;AACpB,CAAC;AAGD,MAAM,WAAW,GAAuD,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;KAC/F,QAAQ,CAAC;AACZ,KAAK,WAAW,CAAC;AAIjB,MAAM,OAAO,GAAgC;IAC3C,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxB,iBAAiB,EAAE,QAAQ;IAC3B,gBAAgB;CACjB,CAAC;AACF,KAAK,OAAO,CAAC;AAGb,MAAM,QAAQ,GAAwB,OAAO,CAAC,OAAO,CAAC;AACtD,MAAM,SAAS,GAAuB,OAAO,CAAC,YAAY,CAAC;AAC3D,KAAK,QAAQ,CAAC;AACd,KAAK,SAAS,CAAC;AAKf,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC9B,MAAM,UAAU,GAAW,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC/D,MAAM,UAAU,GAAW,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC;IACnE,KAAK,UAAU,CAAC;IAChB,KAAK,UAAU,CAAC;AAClB,CAAC;AACD,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAW,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;IAChE,MAAM,IAAI,GAAmC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC;IAClF,KAAK,QAAQ,CAAC;IACd,KAAK,IAAI,CAAC;AACZ,CAAC"}
@@ -0,0 +1,192 @@
1
+ import { ProviderKind, CostTier } from '../../enum/provider-kind.enum';
2
+ import { InterpreterKind } from '../../enum/interpreter-kind.enum';
3
+ import { CombineStrategy } from '../../enum/combine-strategy.enum';
4
+ import { ExtractionStepStatus } from '../../enum/extraction-step-status.enum';
5
+ export { ProviderKind, CostTier, InterpreterKind, CombineStrategy, ExtractionStepStatus };
6
+ export interface IModeRef {
7
+ provider: ProviderKind;
8
+ interpreter: InterpreterKind;
9
+ providerId: string;
10
+ interpreterId: string;
11
+ }
12
+ export interface IFallbackGate {
13
+ minConfidence: number;
14
+ scope: 'global' | 'requiredFields';
15
+ }
16
+ export interface IPass {
17
+ providerId: string;
18
+ interpreterId: string;
19
+ documentType?: string;
20
+ templateId?: string;
21
+ }
22
+ export interface IStage {
23
+ passes: IPass[];
24
+ runParallel: boolean;
25
+ fallback?: IFallbackGate;
26
+ }
27
+ export interface IExtractionPlan {
28
+ stages: IStage[];
29
+ combine: CombineStrategy;
30
+ }
31
+ export type ISignal = {
32
+ kind: 'format';
33
+ check: string;
34
+ passed: boolean;
35
+ weight: number;
36
+ } | {
37
+ kind: 'coherence';
38
+ check: string;
39
+ passed: boolean;
40
+ weight: number;
41
+ } | {
42
+ kind: 'anchor';
43
+ detail: string;
44
+ weight: number;
45
+ } | {
46
+ kind: 'agreement';
47
+ agreed: boolean;
48
+ modes: number;
49
+ weight: number;
50
+ };
51
+ export interface IFieldSource {
52
+ mode: IModeRef;
53
+ value: unknown;
54
+ confidence: number;
55
+ signals: ISignal[];
56
+ }
57
+ export interface IFieldValue {
58
+ value: unknown;
59
+ confidence: number;
60
+ chosen: IModeRef;
61
+ sources: IFieldSource[];
62
+ agreement?: {
63
+ agreed: boolean;
64
+ distinctValues: number;
65
+ };
66
+ signals: ISignal[];
67
+ provenanceTruncated?: boolean;
68
+ }
69
+ export interface IFieldImportance {
70
+ fieldKey: string;
71
+ weight: number;
72
+ required: boolean;
73
+ }
74
+ export interface IConfidenceStats {
75
+ overall: number;
76
+ mean: number;
77
+ highest: number;
78
+ lowest: number;
79
+ median: number;
80
+ belowThreshold: {
81
+ threshold: number;
82
+ count: number;
83
+ };
84
+ fieldCount: number;
85
+ }
86
+ export interface IPassContribution {
87
+ mode: IModeRef;
88
+ confidence: number;
89
+ fieldsContributed: number;
90
+ ocrPageCount: number;
91
+ }
92
+ export interface IGlobalConfidence {
93
+ stats: IConfidenceStats;
94
+ method: CombineStrategy;
95
+ aggregation: 'weighted-by-field-importance';
96
+ perPass: IPassContribution[];
97
+ lowestFields: {
98
+ fieldKey: string;
99
+ confidence: number;
100
+ }[];
101
+ }
102
+ export interface IManifestPass {
103
+ providerId: string;
104
+ providerVersion: string;
105
+ interpreterId: string;
106
+ interpreterVersion: string;
107
+ templateVersionId?: string;
108
+ ocrEngine?: string;
109
+ ocrEngineVersion?: string;
110
+ ocrLangpackVersion?: string;
111
+ }
112
+ export interface IExecutionManifest {
113
+ resolvedPlan: IExtractionPlan;
114
+ combine: CombineStrategy;
115
+ passes: IManifestPass[];
116
+ createdAt: string;
117
+ }
118
+ export interface IStepIo {
119
+ slot: 'providerOutput' | 'interpreterOutput';
120
+ bytes: number;
121
+ sha256: string;
122
+ preview: string;
123
+ status: 'pending' | 'ready' | 'skipped';
124
+ applicationFileId: string | null;
125
+ }
126
+ export interface IStepTrace {
127
+ index: number;
128
+ providerId: string;
129
+ providerVersion: string;
130
+ interpreterId: string;
131
+ interpreterVersion: string;
132
+ documentType: string | null;
133
+ status: ExtractionStepStatus;
134
+ startedAtMs: number;
135
+ durationMs: number;
136
+ ocrPageCount: number;
137
+ fieldsContributed: number;
138
+ errorMessage: string | null;
139
+ io: IStepIo[];
140
+ }
141
+ export interface IExecutionTrace {
142
+ steps: IStepTrace[];
143
+ totalDurationMs: number;
144
+ artifactStatus: 'pending' | 'ready';
145
+ }
146
+ export interface IExtractionPlanPreset {
147
+ id: string;
148
+ name: string;
149
+ scope: {
150
+ kind: 'user';
151
+ userId: string;
152
+ } | {
153
+ kind: 'org';
154
+ organizationId: string;
155
+ };
156
+ plan: IExtractionPlan;
157
+ isDefault: boolean;
158
+ system: boolean;
159
+ createdAt: string;
160
+ updatedAt: string;
161
+ }
162
+ export interface IProviderMode {
163
+ id: string;
164
+ kind: ProviderKind;
165
+ label: string;
166
+ cost: CostTier;
167
+ version: string;
168
+ }
169
+ export interface IInterpreterMode {
170
+ id: string;
171
+ kind: InterpreterKind;
172
+ label: string;
173
+ cost: CostTier;
174
+ version: string;
175
+ supports: string[];
176
+ accepts: ProviderKind[];
177
+ }
178
+ export interface IExtractModesData {
179
+ providers: IProviderMode[];
180
+ interpreters: IInterpreterMode[];
181
+ }
182
+ export interface IPositionedToken {
183
+ text: string;
184
+ page: number;
185
+ bbox: {
186
+ x: number;
187
+ y: number;
188
+ w: number;
189
+ h: number;
190
+ };
191
+ conf?: number;
192
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtractionStepStatus = exports.CombineStrategy = exports.InterpreterKind = exports.CostTier = exports.ProviderKind = void 0;
4
+ const provider_kind_enum_1 = require("../../enum/provider-kind.enum");
5
+ Object.defineProperty(exports, "ProviderKind", { enumerable: true, get: function () { return provider_kind_enum_1.ProviderKind; } });
6
+ Object.defineProperty(exports, "CostTier", { enumerable: true, get: function () { return provider_kind_enum_1.CostTier; } });
7
+ const interpreter_kind_enum_1 = require("../../enum/interpreter-kind.enum");
8
+ Object.defineProperty(exports, "InterpreterKind", { enumerable: true, get: function () { return interpreter_kind_enum_1.InterpreterKind; } });
9
+ const combine_strategy_enum_1 = require("../../enum/combine-strategy.enum");
10
+ Object.defineProperty(exports, "CombineStrategy", { enumerable: true, get: function () { return combine_strategy_enum_1.CombineStrategy; } });
11
+ const extraction_step_status_enum_1 = require("../../enum/extraction-step-status.enum");
12
+ Object.defineProperty(exports, "ExtractionStepStatus", { enumerable: true, get: function () { return extraction_step_status_enum_1.ExtractionStepStatus; } });
13
+ //# sourceMappingURL=extraction-plan.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraction-plan.dto.js","sourceRoot":"","sources":["../../../../src/types/interface/models/extraction-plan.dto.ts"],"names":[],"mappings":";;;AAOA,sEAAuE;AAM9D,6FANA,iCAAY,OAMA;AAAE,yFANA,6BAAQ,OAMA;AAL/B,4EAAmE;AAKlC,gGALxB,uCAAe,OAKwB;AAJhD,4EAAmE;AAIjB,gGAJzC,uCAAe,OAIyC;AAHjE,wFAA8E;AAGX,qGAH1D,kDAAoB,OAG0D"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const enum_1 = require("../../enum");
4
+ const _pk = enum_1.ProviderKind.TEXT;
5
+ const _ik = enum_1.InterpreterKind.TEMPLATE;
6
+ const _cs = enum_1.CombineStrategy.MAX_CONFIDENCE;
7
+ void _pk;
8
+ void _ik;
9
+ void _cs;
10
+ const fv = {
11
+ value: 1,
12
+ confidence: 0.9,
13
+ chosen: {
14
+ provider: enum_1.ProviderKind.TEXT,
15
+ interpreter: enum_1.InterpreterKind.ALGORITHMIC,
16
+ providerId: 'pdf-text',
17
+ interpreterId: 'algo-v1',
18
+ },
19
+ sources: [],
20
+ signals: [],
21
+ };
22
+ const _legacy = fv;
23
+ void _legacy;
24
+ const _modes = { providers: [], interpreters: [] };
25
+ void _modes;
26
+ const _plan = {
27
+ stages: [{ runParallel: false, passes: [{ providerId: 'pdf-text', interpreterId: 'algo-v1' }] }],
28
+ combine: enum_1.CombineStrategy.MAX_CONFIDENCE,
29
+ };
30
+ void _plan;
31
+ const _tok = {
32
+ text: 'IBAN',
33
+ page: 1,
34
+ bbox: { x: 1, y: 2, w: 3, h: 4 },
35
+ conf: 95,
36
+ };
37
+ const _tokNoConf = { text: 'x', page: 2, bbox: { x: 0, y: 0, w: 1, h: 1 } };
38
+ void _tok;
39
+ void _tokNoConf;
40
+ //# sourceMappingURL=extraction-plan.dto.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraction-plan.dto.test.js","sourceRoot":"","sources":["../../../../src/types/interface/models/extraction-plan.dto.test.ts"],"names":[],"mappings":";;AAIA,qCAA4E;AAS5E,MAAM,GAAG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,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;AAC9F,KAAK,IAAI,CAAC;AACV,KAAK,UAAU,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { DocumentType } from '../../enum/document-type.enum';
2
+ export type ISpatialZoneExtractor = 'raw' | 'regex' | 'date' | 'amount' | 'iban';
3
+ export interface ISpatialZone {
4
+ fieldKey: string;
5
+ page: number;
6
+ rect: {
7
+ x: number;
8
+ y: number;
9
+ w: number;
10
+ h: number;
11
+ };
12
+ extractor: ISpatialZoneExtractor;
13
+ regex?: string;
14
+ captureGroup?: number;
15
+ amountLocale?: 'fr' | 'en';
16
+ }
17
+ export interface ISpatialTemplateConfig {
18
+ kind: 'spatial';
19
+ documentType: DocumentType;
20
+ zones: ISpatialZone[];
21
+ }
22
+ export interface IExtractionTemplateVersionDto {
23
+ id: string;
24
+ templateId: string;
25
+ version: number;
26
+ templateJson: Record<string, unknown>;
27
+ comment: string | null;
28
+ createdAt: string;
29
+ }
30
+ export interface ISpatialTemplateListItem {
31
+ id: string;
32
+ name: string;
33
+ description: string | null;
34
+ isActive: boolean;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=extraction-spatial-template.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraction-spatial-template.dto.js","sourceRoot":"","sources":["../../../../src/types/interface/models/extraction-spatial-template.dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const document_type_enum_1 = require("../../enum/document-type.enum");
4
+ const zone = {
5
+ fieldKey: 'totalTtc',
6
+ page: 1,
7
+ rect: { x: 0.6, y: 0.8, w: 0.3, h: 0.05 },
8
+ extractor: 'amount',
9
+ amountLocale: 'fr',
10
+ };
11
+ const config = {
12
+ kind: 'spatial',
13
+ documentType: document_type_enum_1.DocumentType.INVOICE,
14
+ zones: [zone],
15
+ };
16
+ const _fieldKey = config.zones[0].fieldKey;
17
+ const _kind = config.kind;
18
+ void _fieldKey;
19
+ void _kind;
20
+ const _extractors = ['raw', 'regex', 'date', 'amount', 'iban'];
21
+ void _extractors;
22
+ const v = {
23
+ id: 'v1',
24
+ templateId: 't1',
25
+ version: 1,
26
+ templateJson: { kind: 'spatial' },
27
+ comment: null,
28
+ createdAt: '2026-06-28T00:00:00.000Z',
29
+ };
30
+ const _version = v.version;
31
+ void _version;
32
+ //# sourceMappingURL=extraction-spatial-template.dto.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraction-spatial-template.dto.test.js","sourceRoot":"","sources":["../../../../src/types/interface/models/extraction-spatial-template.dto.test.ts"],"names":[],"mappings":";;AAUA,sEAA6D;AAG7D,MAAM,IAAI,GAAiB;IACzB,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IACzC,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,IAAI;CACnB,CAAC;AACF,MAAM,MAAM,GAA2B;IACrC,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,iCAAY,CAAC,OAAO;IAClC,KAAK,EAAE,CAAC,IAAI,CAAC;CACd,CAAC;AAEF,MAAM,SAAS,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnD,MAAM,KAAK,GAAc,MAAM,CAAC,IAAI,CAAC;AACrC,KAAK,SAAS,CAAC;AACf,KAAK,KAAK,CAAC;AAGX,MAAM,WAAW,GAA4B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACxF,KAAK,WAAW,CAAC;AAGjB,MAAM,CAAC,GAAkC;IACvC,EAAE,EAAE,IAAI;IACR,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IACjC,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,0BAA0B;CACtC,CAAC;AACF,MAAM,QAAQ,GAAW,CAAC,CAAC,OAAO,CAAC;AACnC,KAAK,QAAQ,CAAC"}