@abyss-project/tools 1.2.0 → 1.4.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 (34) hide show
  1. package/.eslintrc.js +33 -33
  2. package/.prettierrc +5 -5
  3. package/README.md +32 -32
  4. package/dist/api/beam.api.d.ts +2 -1
  5. package/dist/api/beam.api.js +10 -4
  6. package/dist/api/beam.api.js.map +1 -1
  7. package/dist/api/extraction.api.d.ts +5 -5
  8. package/dist/api/extraction.api.js +21 -4
  9. package/dist/api/extraction.api.js.map +1 -1
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.js +3 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/types/enum/beam.enum.d.ts +4 -0
  14. package/dist/types/enum/beam.enum.js +6 -1
  15. package/dist/types/enum/beam.enum.js.map +1 -1
  16. package/dist/types/interface/api/requests/beam.request.d.ts +17 -0
  17. package/dist/types/interface/api/requests/extraction.request.d.ts +12 -0
  18. package/dist/types/interface/api/responses/beam.response.d.ts +23 -1
  19. package/dist/types/interface/api/responses/extraction.response.d.ts +6 -0
  20. package/dist/types/interface/models/beam.dto.d.ts +13 -1
  21. package/dist/types/interface/models/extraction.dto.d.ts +10 -1
  22. package/dist/types/interface/models/extraction.dto.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/api/beam.api.ts +29 -4
  25. package/src/api/extraction.api.ts +57 -17
  26. package/src/api/tests/beam.api.spec.ts +64 -0
  27. package/src/index.ts +9 -0
  28. package/src/types/enum/beam.enum.ts +8 -0
  29. package/src/types/interface/api/requests/beam.request.ts +31 -3
  30. package/src/types/interface/api/requests/extraction.request.ts +28 -0
  31. package/src/types/interface/api/responses/beam.response.ts +30 -1
  32. package/src/types/interface/api/responses/extraction.response.ts +19 -2
  33. package/src/types/interface/models/beam.dto.ts +20 -1
  34. package/src/types/interface/models/extraction.dto.ts +31 -6
@@ -3,7 +3,11 @@
3
3
  // ──────────────────────────────────────────────
4
4
 
5
5
  import { IResponse } from '../type-message/response';
6
- import type { IExtractionPlanPreset, IExtractModesData, IFieldValue } from '../../models/extraction-plan.dto';
6
+ import type {
7
+ IExtractionPlanPreset,
8
+ IExtractModesData,
9
+ IFieldValue,
10
+ } from '../../models/extraction-plan.dto';
7
11
  import {
8
12
  IExtractionBankVersion,
9
13
  IExtraction,
@@ -134,7 +138,11 @@ export interface IDiffExtractionsData {
134
138
  same: number;
135
139
  added: IExtractionTransaction[];
136
140
  removed: IExtractionTransaction[];
137
- changed: Array<{ before: IExtractionTransaction; after: IExtractionTransaction; fields: string[] }>;
141
+ changed: Array<{
142
+ before: IExtractionTransaction;
143
+ after: IExtractionTransaction;
144
+ fields: string[];
145
+ }>;
138
146
  summary: { leftCount: number; rightCount: number; sumDeltaCents: number };
139
147
  }
140
148
  export type IDiffExtractionsResponse = IResponse<IDiffExtractionsData>;
@@ -180,6 +188,15 @@ export type IGetTemplateResponse = IResponse<IGetTemplateData>;
180
188
 
181
189
  export type IListTemplateVersionsResponse = IResponse<IExtractionTemplateVersion[]>;
182
190
 
191
+ /** Presigned download reference for a version's witness PDF. */
192
+ export interface IGetTemplateWitnessUrlData {
193
+ /** Presigned DOWNLOAD URL (time-limited). */
194
+ url: string;
195
+ filename: string | null;
196
+ size_bytes: number | null;
197
+ }
198
+ export type IGetTemplateWitnessUrlResponse = IResponse<IGetTemplateWitnessUrlData>;
199
+
183
200
  // Deferred wire-schema rename — must match server SCHEMA constant in
184
201
  // extraction-template-portability.service.ts; rename together in the server/main batch.
185
202
  export interface IExtractionTemplateCollection {
@@ -1,7 +1,7 @@
1
1
  import { IOrganization } from './organization.dto';
2
2
  import { IUser } from './user.dto';
3
3
  import { IProject } from './project.dto';
4
- import { BeamVisibility } from '../../enum/beam.enum';
4
+ import { BeamVisibility, BeamDownloadKind } from '../../enum/beam.enum';
5
5
 
6
6
  export interface IBeamTransfer {
7
7
  id: string;
@@ -65,3 +65,22 @@ export interface IBeamRecipient {
65
65
 
66
66
  transfer?: IBeamTransfer;
67
67
  }
68
+
69
+ // One download-history event (B-phase download history). Written on the counted
70
+ // download paths only (/file + /zip); fileId is null for a zip and after the
71
+ // downloaded file was deleted (FK SET NULL). ipHash is the sha256 of the client
72
+ // IP — the raw IP is never stored. userId is the optionally-resolved bearer of
73
+ // the public serve request (null for anonymous downloads).
74
+ export interface IBeamDownloadEvent {
75
+ id: string;
76
+ transferId: string;
77
+ fileId: string | null;
78
+ kind: BeamDownloadKind;
79
+ ipHash: string;
80
+ userId: string | null;
81
+ downloadedAt: Date;
82
+ createdAt?: Date;
83
+
84
+ transfer?: IBeamTransfer;
85
+ file?: IBeamFile | null;
86
+ }
@@ -5,11 +5,8 @@
5
5
 
6
6
  import { ExtractionWarningCode } from '../../../types/enum/extraction-warning.enum';
7
7
  import { ExtractionFeedbackIssueType } from '../../../types/enum/extraction-feedback-issue-type.enum';
8
- import type {
9
- IFieldValue,
10
- IExecutionManifest,
11
- IGlobalConfidence,
12
- } from './extraction-plan.dto';
8
+ import { DocumentType } from '../../../types/enum/document-type.enum';
9
+ import type { IFieldValue, IExecutionManifest, IGlobalConfidence } from './extraction-plan.dto';
13
10
 
14
11
  // Re-export so consumers can import ExtractionFeedbackIssueType from the DTO barrel.
15
12
  export { ExtractionFeedbackIssueType };
@@ -159,10 +156,28 @@ export interface IExtraction {
159
156
 
160
157
  export interface IExtractionTemplate {
161
158
  id: string;
162
- userId: string;
159
+ /** Personal scope owner — null when the template is org/project-scoped. */
160
+ userId: string | null;
161
+ /** Owning organization — null for personal templates. */
162
+ organizationId: string | null;
163
+ /** Owning project — null for personal and org-wide templates. */
164
+ projectId: string | null;
165
+ /** Author inside an org/project scope — null for personal templates. */
166
+ createdByUserId: string | null;
163
167
  name: string;
164
168
  description: string | null;
169
+ /**
170
+ * Kind of document the template targets (DocumentType). Null when the
171
+ * template declares no type. Authoritative — spatial templates also embed
172
+ * `templateJson.documentType`, but this column is the source of truth.
173
+ */
174
+ documentType: DocumentType | null;
165
175
  isActive: boolean;
176
+ /**
177
+ * Stamped (fire-and-forget) whenever an extraction run resolves the
178
+ * template. Null until first use.
179
+ */
180
+ lastUsedAt: string | null;
166
181
  createdAt: string;
167
182
  updatedAt: string;
168
183
  }
@@ -206,6 +221,16 @@ export interface IExtractionTemplateVersion {
206
221
  version: number;
207
222
  templateJson: Record<string, unknown>;
208
223
  comment: string | null;
224
+ /**
225
+ * Witness (sample) PDF reference in the dedicated /rcb-witness bucket.
226
+ * Null when the version carries no witness. Retrieve a download URL via
227
+ * `sdk.extract.templates.getWitnessUrl`.
228
+ */
229
+ witnessFileId: string | null;
230
+ /** Witness byte size (billed to the owner's storage pool). */
231
+ witnessSizeBytes: number | null;
232
+ /** Original witness filename. */
233
+ witnessFilename: string | null;
209
234
  createdAt: string;
210
235
  }
211
236