@abyss-project/tools 2.3.0 → 2.5.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.
@@ -7,8 +7,14 @@ export declare enum BeamServeDenyReasonCode {
7
7
  EXPIRED = "expired",
8
8
  FORBIDDEN_VISIBILITY = "forbidden_visibility",
9
9
  MAX_DOWNLOADS = "max_downloads",
10
- SCAN_PENDING = "scan_pending",
11
- SCAN_INFECTED = "scan_infected"
10
+ SCAN_PENDING = "scan_pending"
11
+ }
12
+ export declare enum BeamFileScanStatus {
13
+ PENDING_SCAN = "pending_scan",
14
+ CLEAN = "clean",
15
+ INFECTED = "infected",
16
+ SKIPPED = "skipped",
17
+ ERROR = "error"
12
18
  }
13
19
  export declare enum BeamDownloadKind {
14
20
  FILE = "file",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BeamDownloadKind = exports.BeamServeDenyReasonCode = exports.BeamVisibility = void 0;
3
+ exports.BeamDownloadKind = exports.BeamFileScanStatus = exports.BeamServeDenyReasonCode = exports.BeamVisibility = void 0;
4
4
  var BeamVisibility;
5
5
  (function (BeamVisibility) {
6
6
  BeamVisibility["PUBLIC"] = "PUBLIC";
@@ -13,8 +13,15 @@ var BeamServeDenyReasonCode;
13
13
  BeamServeDenyReasonCode["FORBIDDEN_VISIBILITY"] = "forbidden_visibility";
14
14
  BeamServeDenyReasonCode["MAX_DOWNLOADS"] = "max_downloads";
15
15
  BeamServeDenyReasonCode["SCAN_PENDING"] = "scan_pending";
16
- BeamServeDenyReasonCode["SCAN_INFECTED"] = "scan_infected";
17
16
  })(BeamServeDenyReasonCode || (exports.BeamServeDenyReasonCode = BeamServeDenyReasonCode = {}));
17
+ var BeamFileScanStatus;
18
+ (function (BeamFileScanStatus) {
19
+ BeamFileScanStatus["PENDING_SCAN"] = "pending_scan";
20
+ BeamFileScanStatus["CLEAN"] = "clean";
21
+ BeamFileScanStatus["INFECTED"] = "infected";
22
+ BeamFileScanStatus["SKIPPED"] = "skipped";
23
+ BeamFileScanStatus["ERROR"] = "error";
24
+ })(BeamFileScanStatus || (exports.BeamFileScanStatus = BeamFileScanStatus = {}));
18
25
  var BeamDownloadKind;
19
26
  (function (BeamDownloadKind) {
20
27
  BeamDownloadKind["FILE"] = "file";
@@ -1 +1 @@
1
- {"version":3,"file":"beam.enum.js","sourceRoot":"","sources":["../../../src/types/enum/beam.enum.ts"],"names":[],"mappings":";;;AAIA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;AAC3B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AASD,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,kDAAuB,CAAA;IACvB,8CAAmB,CAAA;IACnB,wEAA6C,CAAA;IAC7C,0DAA+B,CAAA;IAC/B,wDAA6B,CAAA;IAC7B,0DAA+B,CAAA;AACjC,CAAC,EAPW,uBAAuB,uCAAvB,uBAAuB,QAOlC;AAKD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,+BAAW,CAAA;AACb,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B"}
1
+ {"version":3,"file":"beam.enum.js","sourceRoot":"","sources":["../../../src/types/enum/beam.enum.ts"],"names":[],"mappings":";;;AAIA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;AAC3B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AASD,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,kDAAuB,CAAA;IACvB,8CAAmB,CAAA;IACnB,wEAA6C,CAAA;IAC7C,0DAA+B,CAAA;IAC/B,wDAA6B,CAAA;AAC/B,CAAC,EANW,uBAAuB,uCAAvB,uBAAuB,QAMlC;AAWD,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,mDAA6B,CAAA;IAC7B,qCAAe,CAAA;IACf,2CAAqB,CAAA;IACrB,yCAAmB,CAAA;IACnB,qCAAe,CAAA;AACjB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B;AAKD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,+BAAW,CAAA;AACb,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B"}
@@ -0,0 +1 @@
1
+ export type FileScanStatus = 'pending_scan' | 'clean' | 'infected' | 'skipped' | 'error';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=file-scan-status.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-scan-status.enum.js","sourceRoot":"","sources":["../../../src/types/enum/file-scan-status.enum.ts"],"names":[],"mappings":""}
@@ -12,3 +12,4 @@ export * from './provider-kind.enum';
12
12
  export * from './interpreter-kind.enum';
13
13
  export * from './combine-strategy.enum';
14
14
  export * from './probe-scan.enum';
15
+ export * from './file-scan-status.enum';
@@ -28,4 +28,5 @@ __exportStar(require("./provider-kind.enum"), exports);
28
28
  __exportStar(require("./interpreter-kind.enum"), exports);
29
29
  __exportStar(require("./combine-strategy.enum"), exports);
30
30
  __exportStar(require("./probe-scan.enum"), exports);
31
+ __exportStar(require("./file-scan-status.enum"), exports);
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/enum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,wDAAsC;AACtC,2DAAyC;AACzC,uDAAqC;AACrC,8CAA4B;AAC5B,uDAAqC;AACrC,uDAAqC;AACrC,kDAAgC;AAChC,4DAA0C;AAC1C,wEAAsD;AACtD,uDAAqC;AACrC,0DAAwC;AACxC,0DAAwC;AACxC,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/enum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,wDAAsC;AACtC,2DAAyC;AACzC,uDAAqC;AACrC,8CAA4B;AAC5B,uDAAqC;AACrC,uDAAqC;AACrC,kDAAgC;AAChC,4DAA0C;AAC1C,wEAAsD;AACtD,uDAAqC;AACrC,0DAAwC;AACxC,0DAAwC;AACxC,oDAAkC;AAClC,0DAAwC"}
@@ -2,7 +2,7 @@ import { BasePaginate } from '../type-message/base-paginate';
2
2
  import { IResponse } from '../type-message/response';
3
3
  import { IBeamTransfer, IBeamFile, IBeamRecipient } from '../../models/beam.dto';
4
4
  import { IContentShare } from '../../models/content-share.dto';
5
- import { BeamVisibility, BeamServeDenyReasonCode, BeamDownloadKind } from '../../../enum/beam.enum';
5
+ import { BeamVisibility, BeamServeDenyReasonCode, BeamDownloadKind, BeamFileScanStatus } from '../../../enum/beam.enum';
6
6
  export interface IGetBeamData {
7
7
  beamTransfer: IBeamTransfer;
8
8
  }
@@ -39,6 +39,7 @@ export interface IBeamPublicFile {
39
39
  hasThumbnail: boolean;
40
40
  width: number | null;
41
41
  height: number | null;
42
+ scanStatus: BeamFileScanStatus;
42
43
  }
43
44
  export interface IBeamPublicView {
44
45
  slug: string;
@@ -1,5 +1,6 @@
1
1
  import { IAtlasPage } from './atlas-page.dto';
2
2
  import { IAtlas } from './atlas.dto';
3
+ import { FileScanStatus } from '../../enum/file-scan-status.enum';
3
4
  export interface IAtlasDocument {
4
5
  id: string;
5
6
  atlasPageId: string;
@@ -12,6 +13,7 @@ export interface IAtlasDocument {
12
13
  sizeOctet: number;
13
14
  mimeType: string;
14
15
  checksum: string;
16
+ scanStatus: FileScanStatus | null;
15
17
  createdAt?: Date;
16
18
  updatedAt?: Date;
17
19
  atlasPage?: IAtlasPage;
@@ -1,5 +1,6 @@
1
1
  import { IBoardCard } from './board-card.dto';
2
2
  import { IBoard } from './board.dto';
3
+ import { FileScanStatus } from '../../enum/file-scan-status.enum';
3
4
  export interface IBoardCardDocument {
4
5
  id: string;
5
6
  boardCardId: string;
@@ -12,6 +13,7 @@ export interface IBoardCardDocument {
12
13
  checksum: string;
13
14
  mimeType: string;
14
15
  sizeOctet: number;
16
+ scanStatus: FileScanStatus | null;
15
17
  updatedAt?: Date;
16
18
  createdAt?: Date;
17
19
  boardCard: IBoardCard;
@@ -1,6 +1,7 @@
1
1
  import { ExtractionWarningCode } from '../../../types/enum/extraction-warning.enum';
2
2
  import { ExtractionFeedbackIssueType } from '../../../types/enum/extraction-feedback-issue-type.enum';
3
3
  import { DocumentType } from '../../../types/enum/document-type.enum';
4
+ import { FileScanStatus } from '../../enum/file-scan-status.enum';
4
5
  import type { IFieldValue, IExecutionManifest, IGlobalConfidence } from './extraction-plan.dto';
5
6
  export { ExtractionFeedbackIssueType };
6
7
  export type ExtractionMode = 'auto' | 'hint' | 'template';
@@ -51,6 +52,7 @@ export interface IExtractionFile {
51
52
  detectedIban: string | null;
52
53
  detectedBic: string | null;
53
54
  detectedCurrency: string | null;
55
+ scanStatus: FileScanStatus | null;
54
56
  createdAt: string;
55
57
  updatedAt: string;
56
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extraction.dto.js","sourceRoot":"","sources":["../../../../src/types/interface/models/extraction.dto.ts"],"names":[],"mappings":";;;AAKA,yFAAoF;AA4E3E,sGA5EA,+CAAqB,OA4EA;AA3E9B,iHAAsG;AAK7F,4GALA,iEAA2B,OAKA;AAoQpC,IAAY,sBAYX;AAZD,WAAY,sBAAsB;IAChC,qEAA2C,CAAA;IAC3C,+DAAqC,CAAA;IACrC,+EAAqD,CAAA;IACrD,uEAA6C,CAAA;IAC7C,6DAAmC,CAAA;IACnC,2DAAiC,CAAA;IACjC,6DAAmC,CAAA;IACnC,uEAA6C,CAAA;IAC7C,uDAA6B,CAAA;IAC7B,mEAAyC,CAAA;IACzC,6DAAmC,CAAA;AACrC,CAAC,EAZW,sBAAsB,sCAAtB,sBAAsB,QAYjC;AAEY,QAAA,yBAAyB,GACpC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAuCxC,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,4CAAa,CAAA;IACb,0CAAW,CAAA;AACb,CAAC,EAHW,2BAA2B,2CAA3B,2BAA2B,QAGtC"}
1
+ {"version":3,"file":"extraction.dto.js","sourceRoot":"","sources":["../../../../src/types/interface/models/extraction.dto.ts"],"names":[],"mappings":";;;AAKA,yFAAoF;AAwF3E,sGAxFA,+CAAqB,OAwFA;AAvF9B,iHAAsG;AAM7F,4GANA,iEAA2B,OAMA;AA+QpC,IAAY,sBAYX;AAZD,WAAY,sBAAsB;IAChC,qEAA2C,CAAA;IAC3C,+DAAqC,CAAA;IACrC,+EAAqD,CAAA;IACrD,uEAA6C,CAAA;IAC7C,6DAAmC,CAAA;IACnC,2DAAiC,CAAA;IACjC,6DAAmC,CAAA;IACnC,uEAA6C,CAAA;IAC7C,uDAA6B,CAAA;IAC7B,mEAAyC,CAAA;IACzC,6DAAmC,CAAA;AACrC,CAAC,EAZW,sBAAsB,sCAAtB,sBAAsB,QAYjC;AAEY,QAAA,yBAAyB,GACpC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAuCxC,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,4CAAa,CAAA;IACb,0CAAW,CAAA;AACb,CAAC,EAHW,2BAA2B,2CAA3B,2BAA2B,QAGtC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/tools",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "Core package to interact with Abyss-Project Tools",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,23 @@ export enum BeamServeDenyReasonCode {
20
20
  FORBIDDEN_VISIBILITY = 'forbidden_visibility',
21
21
  MAX_DOWNLOADS = 'max_downloads',
22
22
  SCAN_PENDING = 'scan_pending',
23
- SCAN_INFECTED = 'scan_infected',
23
+ }
24
+
25
+ // Per-file AV verdict surfaced on the public listing (GET /b/:slug) so the
26
+ // front can render a per-file badge — clean / "en analyse" (pending) /
27
+ // "infecté" — independently of the whole-transfer denial reason above.
28
+ // Storage-neutral: AbyssBeam serves an INFECTED file's bytes (spec decision —
29
+ // infected files stay downloadable, not blocked; the front is expected to
30
+ // warn before/at download). Mirrors the storage extension's `FileScanStatus`
31
+ // (`@abyss-project/storage`) byte-for-byte; duplicated locally because this
32
+ // package does not depend on `@abyss-project/storage` (same rationale as
33
+ // BeamServeDenyReasonCode above).
34
+ export enum BeamFileScanStatus {
35
+ PENDING_SCAN = 'pending_scan',
36
+ CLEAN = 'clean',
37
+ INFECTED = 'infected',
38
+ SKIPPED = 'skipped',
39
+ ERROR = 'error',
24
40
  }
25
41
 
26
42
  // What a beam_download_events row counted: a single-file download (/b/:slug/
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Antivirus scan verdict for a stored file, mirrored from AbyssStorage.
3
+ *
4
+ * Same vocabulary as `@abyss-project/storage`'s `FileScanStatus` enum
5
+ * (`application_files.scanStatus`): `pending_scan` | `clean` | `infected` |
6
+ * `skipped` | `error`. Intentionally re-declared here as a string union — NOT
7
+ * imported — because abyss-tools-core is standalone (does not depend on
8
+ * `@abyss-project/storage`), the same approach every other core package
9
+ * (abyss-main asset-core, abyss-banking-core, abyss-memories-core) takes for
10
+ * a mirrored external vocabulary. `BeamFileScanStatus` (beam.enum.ts) mirrors
11
+ * the SAME storage vocabulary as a real TS enum instead: that shape fits
12
+ * beam, which converts a single Map of live-read values at ONE serialization
13
+ * boundary (an explicit `Record<FileScanStatus, BeamFileScanStatus>`
14
+ * suffices there). This column is denormalized and WRITTEN from several call
15
+ * sites (webhook UPLOAD seed, webhook SCAN_RESULT update, cloud-import
16
+ * mirror, archive-upload seed) — a string union lets the backend assign a
17
+ * storage `FileScanStatus` enum value straight into it with no cast (a
18
+ * string-enum member is assignable to a matching string-literal union, but
19
+ * NOT to a distinct local enum with identical values), avoiding a repeated
20
+ * conversion Record at every one of those sites. Keep the members in sync
21
+ * with storage's enum.
22
+ *
23
+ * Storage-neutral posture (ADR-0038): this field is purely informational —
24
+ * exposed so the front can render an AbyssProbe indicator (clean / "en
25
+ * analyse" / infected). Nothing in abyss-tools purges an infected row,
26
+ * redacts a servable id, or blocks a read while pending; the front decides
27
+ * what to show (e.g. blurring a pending thumbnail).
28
+ *
29
+ * Used by BoardCardDocument, AtlasDocument and ExtractionFile (the last only
30
+ * for an archive-owned row — see ExtractionFile.scanStatus's own doc
31
+ * comment).
32
+ */
33
+ export type FileScanStatus = 'pending_scan' | 'clean' | 'infected' | 'skipped' | 'error';
@@ -12,3 +12,4 @@ export * from './provider-kind.enum';
12
12
  export * from './interpreter-kind.enum';
13
13
  export * from './combine-strategy.enum';
14
14
  export * from './probe-scan.enum';
15
+ export * from './file-scan-status.enum';
@@ -2,7 +2,12 @@ import { BasePaginate } from '../type-message/base-paginate';
2
2
  import { IResponse } from '../type-message/response';
3
3
  import { IBeamTransfer, IBeamFile, IBeamRecipient } from '../../models/beam.dto';
4
4
  import { IContentShare } from '../../models/content-share.dto';
5
- import { BeamVisibility, BeamServeDenyReasonCode, BeamDownloadKind } from '../../../enum/beam.enum';
5
+ import {
6
+ BeamVisibility,
7
+ BeamServeDenyReasonCode,
8
+ BeamDownloadKind,
9
+ BeamFileScanStatus,
10
+ } from '../../../enum/beam.enum';
6
11
 
7
12
  export interface IGetBeamData {
8
13
  beamTransfer: IBeamTransfer;
@@ -39,6 +44,9 @@ export type IFinalizeBeamResponse = IResponse<IFinalizeBeamData>;
39
44
  // Public serving (B3) — safe, purpose-built projection of a transfer for the
40
45
  // browser-facing view: no owner ids, no password/manage hashes; adds
41
46
  // hasPassword/isLocked/hasThumbnail so the front can render the locked state.
47
+ // `scanStatus` is the per-file AV verdict (storage-neutral — an INFECTED file
48
+ // is still listed and downloadable; the front renders the warning from this
49
+ // field, see BeamFileScanStatus).
42
50
  export interface IBeamPublicFile {
43
51
  id: string;
44
52
  name: string;
@@ -48,6 +56,7 @@ export interface IBeamPublicFile {
48
56
  hasThumbnail: boolean;
49
57
  width: number | null;
50
58
  height: number | null;
59
+ scanStatus: BeamFileScanStatus;
51
60
  }
52
61
 
53
62
  export interface IBeamPublicView {
@@ -1,5 +1,6 @@
1
1
  import { IAtlasPage } from './atlas-page.dto';
2
2
  import { IAtlas } from './atlas.dto';
3
+ import { FileScanStatus } from '../../enum/file-scan-status.enum';
3
4
 
4
5
  export interface IAtlasDocument {
5
6
  id: string;
@@ -13,6 +14,15 @@ export interface IAtlasDocument {
13
14
  sizeOctet: number;
14
15
  mimeType: string;
15
16
  checksum: string;
17
+ /**
18
+ * Antivirus verdict mirrored from AbyssStorage (denormalized, seeded at the
19
+ * UPLOAD webhook and updated by the SCAN_RESULT webhook — see
20
+ * storage-webhook.service.ts#handleScanResult). Null for a document
21
+ * created before this column existed. Storage-neutral (ADR-0038): purely
22
+ * informational — never redacted, never gates a read. The front renders
23
+ * the AbyssProbe indicator (and blurs a pending thumbnail) from this field.
24
+ */
25
+ scanStatus: FileScanStatus | null;
16
26
  createdAt?: Date;
17
27
  updatedAt?: Date;
18
28
 
@@ -1,5 +1,6 @@
1
1
  import { IBoardCard } from './board-card.dto';
2
2
  import { IBoard } from './board.dto';
3
+ import { FileScanStatus } from '../../enum/file-scan-status.enum';
3
4
 
4
5
  export interface IBoardCardDocument {
5
6
  id: string;
@@ -13,6 +14,15 @@ export interface IBoardCardDocument {
13
14
  checksum: string;
14
15
  mimeType: string;
15
16
  sizeOctet: number;
17
+ /**
18
+ * Antivirus verdict mirrored from AbyssStorage (denormalized, seeded at the
19
+ * UPLOAD webhook and updated by the SCAN_RESULT webhook — see
20
+ * storage-webhook.service.ts#handleScanResult). Null for a document
21
+ * created before this column existed. Storage-neutral (ADR-0038): purely
22
+ * informational — never redacted, never gates a read. The front renders
23
+ * the AbyssProbe indicator (and blurs a pending thumbnail) from this field.
24
+ */
25
+ scanStatus: FileScanStatus | null;
16
26
  updatedAt?: Date;
17
27
  createdAt?: Date;
18
28
 
@@ -6,6 +6,7 @@
6
6
  import { ExtractionWarningCode } from '../../../types/enum/extraction-warning.enum';
7
7
  import { ExtractionFeedbackIssueType } from '../../../types/enum/extraction-feedback-issue-type.enum';
8
8
  import { DocumentType } from '../../../types/enum/document-type.enum';
9
+ import { FileScanStatus } from '../../enum/file-scan-status.enum';
9
10
  import type { IFieldValue, IExecutionManifest, IGlobalConfidence } from './extraction-plan.dto';
10
11
 
11
12
  // Re-export so consumers can import ExtractionFeedbackIssueType from the DTO barrel.
@@ -74,6 +75,17 @@ export interface IExtractionFile {
74
75
  detectedIban: string | null;
75
76
  detectedBic: string | null;
76
77
  detectedCurrency: string | null;
78
+ /**
79
+ * Antivirus verdict mirrored from AbyssStorage for an ARCHIVE-OWNED file
80
+ * only (seeded at extractionFileService.upsert from the archive-upload
81
+ * response — see extraction-extract.service.ts#archivePdf — and updated by
82
+ * the SCAN_RESULT webhook, storage-webhook.service.ts#handleScanResult).
83
+ * Null for a by-reference file (AbyssExtract never requested that scan, so
84
+ * it never mirrors a verdict for it) and for rows created before this
85
+ * column existed. Storage-neutral (ADR-0038): purely informational — never
86
+ * redacted, never gates a read.
87
+ */
88
+ scanStatus: FileScanStatus | null;
77
89
  createdAt: string;
78
90
  updatedAt: string;
79
91
  }