@abyss-project/probe 2.0.0 → 2.0.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.
- package/.eslintrc.js +32 -32
- package/.prettierrc +5 -5
- package/README.md +22 -22
- package/package.json +10 -15
- package/src/api/index.ts +6 -6
- package/src/api/probe-scan.api.test.ts +47 -47
- package/src/api/probe-scan.api.ts +203 -203
- package/src/api/probe-scan.application.api.test.ts +35 -35
- package/src/api/probe-scan.application.api.ts +157 -157
- package/src/api/probe-usage.api.ts +47 -47
- package/src/api/probe-usage.application.api.ts +25 -25
- package/src/api/probe-webhook.api.test.ts +17 -17
- package/src/api/probe-webhook.api.ts +119 -119
- package/src/api/probe-webhook.application.api.test.ts +18 -18
- package/src/api/probe-webhook.application.api.ts +141 -141
- package/src/constants/index.ts +1 -1
- package/src/index.ts +205 -205
- package/src/types/enum/api-error.enum.ts +33 -33
- package/src/types/enum/index.ts +2 -2
- package/src/types/enum/probe-scan.enum.ts +44 -44
- package/src/types/index.ts +2 -2
- package/src/types/interface/api/index.ts +5 -5
- package/src/types/interface/api/requests/index.ts +3 -3
- package/src/types/interface/api/requests/probe-scan.request.ts +54 -54
- package/src/types/interface/api/requests/probe-usage.request.ts +7 -7
- package/src/types/interface/api/requests/probe-webhook.request.ts +33 -33
- package/src/types/interface/api/responses/index.ts +3 -3
- package/src/types/interface/api/responses/probe-scan.response.ts +45 -45
- package/src/types/interface/api/responses/probe-usage.response.ts +25 -25
- package/src/types/interface/api/responses/probe-webhook.response.ts +24 -24
- package/src/types/interface/api/type-message/api-error.ts +7 -7
- package/src/types/interface/api/type-message/base-paginate.ts +11 -11
- package/src/types/interface/api/type-message/response.ts +6 -6
- package/src/types/interface/index.ts +2 -2
- package/src/types/interface/models/index.ts +3 -3
- package/src/types/interface/models/probe-scan.dto.ts +67 -67
- package/src/types/interface/models/probe-webhook-delivery.dto.ts +73 -73
- package/src/types/interface/models/probe-webhook.dto.ts +29 -29
- package/src/types/tests/probe.dto.test.ts +156 -156
- package/src/utils/enum.utils.ts +1 -1
- package/src/utils/error.utils.ts +30 -30
- package/src/utils/index.ts +4 -4
- package/src/utils/probe-scan-cost.utils.ts +101 -101
- package/src/utils/probe-webhook-signature.utils.ts +56 -56
- package/tsconfig.check.json +15 -15
- package/tsconfig.json +36 -36
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { ProbeScanMode, ProbeScanStatus, ProbeScanVerdict } from '../../../enum';
|
|
2
|
-
|
|
3
|
-
// Mirrors apps/api/src/api/controllers/probe-scan.controller.ts's ScanBody +
|
|
4
|
-
// HistoryQuery, and apps/api/src/api/validators/probe-scan.validator.ts's
|
|
5
|
-
// historyQuery() Joi schema (field names/optionality).
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Options accepted by `sdk.probe.scan(file, options)` — `POST /scan`. `mode`
|
|
9
|
-
* and `organizationId` travel as query params (`?mode=async&organization_id=`);
|
|
10
|
-
* `context` and `callbackUrl` travel as multipart text fields alongside the
|
|
11
|
-
* file — the sdk client handles that split, callers just pass one object.
|
|
12
|
-
*/
|
|
13
|
-
export interface IScanOptions {
|
|
14
|
-
/** sync (default — verdict returned inline) or async (queued, 202 + webhook/poll). */
|
|
15
|
-
mode?: ProbeScanMode;
|
|
16
|
-
/** Personal scope (default) or an organization the caller belongs to. */
|
|
17
|
-
organizationId?: string;
|
|
18
|
-
/** Free-form caller reference (e.g. `{ applicationFileId }`), stored verbatim. */
|
|
19
|
-
context?: Record<string, unknown>;
|
|
20
|
-
/** ASYNC-only per-request delivery override (https only). Ignored for a SYNC scan. */
|
|
21
|
-
callbackUrl?: string;
|
|
22
|
-
/** Filename reported to the server (defaults to `'file'`). Cosmetic only. */
|
|
23
|
-
filename?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Content-Type stamped on the file part when the caller passes raw bytes
|
|
26
|
-
* (`Buffer`/`Uint8Array`). Ignored when the file is already a `Blob` — a
|
|
27
|
-
* browser `File` and `fs.openAsBlob(path)` carry their own type.
|
|
28
|
-
*/
|
|
29
|
-
mimeType?: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* `GET /scan` query — all filters optional, combined with AND.
|
|
34
|
-
* `contextKey`/`contextValue` must be supplied together (business-reference
|
|
35
|
-
* search inside the free-form `context` JSONB column) — supplying one
|
|
36
|
-
* without the other is rejected by the API (400).
|
|
37
|
-
*/
|
|
38
|
-
export interface IListScansQuery {
|
|
39
|
-
organizationId?: string;
|
|
40
|
-
verdict?: ProbeScanVerdict;
|
|
41
|
-
mode?: ProbeScanMode;
|
|
42
|
-
status?: ProbeScanStatus;
|
|
43
|
-
/** Date range on `createdAt`, inclusive at both ends. */
|
|
44
|
-
from?: Date;
|
|
45
|
-
to?: Date;
|
|
46
|
-
/** Case-insensitive partial match on the original file name. */
|
|
47
|
-
fileName?: string;
|
|
48
|
-
contextKey?: string;
|
|
49
|
-
contextValue?: string;
|
|
50
|
-
/** @default 1 */
|
|
51
|
-
page?: number;
|
|
52
|
-
/** @default 20, server max 200. */
|
|
53
|
-
limit?: number;
|
|
54
|
-
}
|
|
1
|
+
import { ProbeScanMode, ProbeScanStatus, ProbeScanVerdict } from '../../../enum';
|
|
2
|
+
|
|
3
|
+
// Mirrors apps/api/src/api/controllers/probe-scan.controller.ts's ScanBody +
|
|
4
|
+
// HistoryQuery, and apps/api/src/api/validators/probe-scan.validator.ts's
|
|
5
|
+
// historyQuery() Joi schema (field names/optionality).
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Options accepted by `sdk.probe.scan(file, options)` — `POST /scan`. `mode`
|
|
9
|
+
* and `organizationId` travel as query params (`?mode=async&organization_id=`);
|
|
10
|
+
* `context` and `callbackUrl` travel as multipart text fields alongside the
|
|
11
|
+
* file — the sdk client handles that split, callers just pass one object.
|
|
12
|
+
*/
|
|
13
|
+
export interface IScanOptions {
|
|
14
|
+
/** sync (default — verdict returned inline) or async (queued, 202 + webhook/poll). */
|
|
15
|
+
mode?: ProbeScanMode;
|
|
16
|
+
/** Personal scope (default) or an organization the caller belongs to. */
|
|
17
|
+
organizationId?: string;
|
|
18
|
+
/** Free-form caller reference (e.g. `{ applicationFileId }`), stored verbatim. */
|
|
19
|
+
context?: Record<string, unknown>;
|
|
20
|
+
/** ASYNC-only per-request delivery override (https only). Ignored for a SYNC scan. */
|
|
21
|
+
callbackUrl?: string;
|
|
22
|
+
/** Filename reported to the server (defaults to `'file'`). Cosmetic only. */
|
|
23
|
+
filename?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Content-Type stamped on the file part when the caller passes raw bytes
|
|
26
|
+
* (`Buffer`/`Uint8Array`). Ignored when the file is already a `Blob` — a
|
|
27
|
+
* browser `File` and `fs.openAsBlob(path)` carry their own type.
|
|
28
|
+
*/
|
|
29
|
+
mimeType?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `GET /scan` query — all filters optional, combined with AND.
|
|
34
|
+
* `contextKey`/`contextValue` must be supplied together (business-reference
|
|
35
|
+
* search inside the free-form `context` JSONB column) — supplying one
|
|
36
|
+
* without the other is rejected by the API (400).
|
|
37
|
+
*/
|
|
38
|
+
export interface IListScansQuery {
|
|
39
|
+
organizationId?: string;
|
|
40
|
+
verdict?: ProbeScanVerdict;
|
|
41
|
+
mode?: ProbeScanMode;
|
|
42
|
+
status?: ProbeScanStatus;
|
|
43
|
+
/** Date range on `createdAt`, inclusive at both ends. */
|
|
44
|
+
from?: Date;
|
|
45
|
+
to?: Date;
|
|
46
|
+
/** Case-insensitive partial match on the original file name. */
|
|
47
|
+
fileName?: string;
|
|
48
|
+
contextKey?: string;
|
|
49
|
+
contextValue?: string;
|
|
50
|
+
/** @default 1 */
|
|
51
|
+
page?: number;
|
|
52
|
+
/** @default 20, server max 200. */
|
|
53
|
+
limit?: number;
|
|
54
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// WS5-3 (AbyssProbe UX rework) — `GET /usage` / `GET /application/:applicationId/usage`.
|
|
2
|
-
// Mirrors apps/api/src/api/validators/probe-usage.validator.ts's Joi schema.
|
|
3
|
-
|
|
4
|
-
/** `GET /usage` query — personal scope (default) or an organization. Not needed for the application variant (its scope is the `:applicationId` URL segment). */
|
|
5
|
-
export interface IProbeUsageScopeQuery {
|
|
6
|
-
organizationId?: string;
|
|
7
|
-
}
|
|
1
|
+
// WS5-3 (AbyssProbe UX rework) — `GET /usage` / `GET /application/:applicationId/usage`.
|
|
2
|
+
// Mirrors apps/api/src/api/validators/probe-usage.validator.ts's Joi schema.
|
|
3
|
+
|
|
4
|
+
/** `GET /usage` query — personal scope (default) or an organization. Not needed for the application variant (its scope is the `:applicationId` URL segment). */
|
|
5
|
+
export interface IProbeUsageScopeQuery {
|
|
6
|
+
organizationId?: string;
|
|
7
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
// Mirrors apps/api/src/api/controllers/probe-webhook.controller.ts's
|
|
2
|
-
// ScopeQuery/CreateBody/UpdateBody and probe-webhook.validator.ts's Joi
|
|
3
|
-
// schemas.
|
|
4
|
-
|
|
5
|
-
/** Shared by create/list/delete/update — personal scope (default) or an organization. */
|
|
6
|
-
export interface IProbeWebhookScopeQuery {
|
|
7
|
-
organizationId?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ICreateProbeWebhookBody {
|
|
11
|
-
/** HTTPS endpoint the verdict is POSTed to. Required, `https://` only. */
|
|
12
|
-
callbackUrl: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* `PATCH /webhook/:webhookId` body (WS5-5) — at least one field required
|
|
17
|
-
* (mirrors probe-webhook.validator.ts#updateBody's `.min(1)`); omitted
|
|
18
|
-
* fields are left unchanged.
|
|
19
|
-
*/
|
|
20
|
-
export interface IUpdateProbeWebhookBody {
|
|
21
|
-
/** HTTPS endpoint the verdict is POSTed to, `https://` only. */
|
|
22
|
-
callbackUrl?: string;
|
|
23
|
-
/** Disabled webhooks are skipped by dispatch (soft-off, not deleted). */
|
|
24
|
-
active?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** `GET /webhook/:webhookId/deliveries` query (WS5-6) — paginated. */
|
|
28
|
-
export interface IListProbeWebhookDeliveriesQuery extends IProbeWebhookScopeQuery {
|
|
29
|
-
/** @default 1 */
|
|
30
|
-
page?: number;
|
|
31
|
-
/** @default 20 */
|
|
32
|
-
limit?: number;
|
|
33
|
-
}
|
|
1
|
+
// Mirrors apps/api/src/api/controllers/probe-webhook.controller.ts's
|
|
2
|
+
// ScopeQuery/CreateBody/UpdateBody and probe-webhook.validator.ts's Joi
|
|
3
|
+
// schemas.
|
|
4
|
+
|
|
5
|
+
/** Shared by create/list/delete/update — personal scope (default) or an organization. */
|
|
6
|
+
export interface IProbeWebhookScopeQuery {
|
|
7
|
+
organizationId?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ICreateProbeWebhookBody {
|
|
11
|
+
/** HTTPS endpoint the verdict is POSTed to. Required, `https://` only. */
|
|
12
|
+
callbackUrl: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `PATCH /webhook/:webhookId` body (WS5-5) — at least one field required
|
|
17
|
+
* (mirrors probe-webhook.validator.ts#updateBody's `.min(1)`); omitted
|
|
18
|
+
* fields are left unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export interface IUpdateProbeWebhookBody {
|
|
21
|
+
/** HTTPS endpoint the verdict is POSTed to, `https://` only. */
|
|
22
|
+
callbackUrl?: string;
|
|
23
|
+
/** Disabled webhooks are skipped by dispatch (soft-off, not deleted). */
|
|
24
|
+
active?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** `GET /webhook/:webhookId/deliveries` query (WS5-6) — paginated. */
|
|
28
|
+
export interface IListProbeWebhookDeliveriesQuery extends IProbeWebhookScopeQuery {
|
|
29
|
+
/** @default 1 */
|
|
30
|
+
page?: number;
|
|
31
|
+
/** @default 20 */
|
|
32
|
+
limit?: number;
|
|
33
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './probe-scan.response';
|
|
2
|
-
export * from './probe-usage.response';
|
|
3
|
-
export * from './probe-webhook.response';
|
|
1
|
+
export * from './probe-scan.response';
|
|
2
|
+
export * from './probe-usage.response';
|
|
3
|
+
export * from './probe-webhook.response';
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { IResponse } from '../type-message/response';
|
|
2
|
-
import { BasePaginate } from '../type-message/base-paginate';
|
|
3
|
-
import { ProbeScanStatus, ProbeScanVerdict } from '../../../enum';
|
|
4
|
-
import { IProbeScanDetail, IProbeScanHistoryItem } from '../../models';
|
|
5
|
-
|
|
6
|
-
// Mirrors apps/api/src/api/controllers/probe-scan.controller.ts's local
|
|
7
|
-
// ScanSyncResponseData / ScanAsyncResponseData / GetScanResponseData /
|
|
8
|
-
// PaginateScanResponseData EXACTLY.
|
|
9
|
-
|
|
10
|
-
/** `POST /scan` (default, or explicit `?mode=sync`) — HTTP 200. */
|
|
11
|
-
export interface IScanSyncData {
|
|
12
|
-
scanId: string;
|
|
13
|
-
verdict: ProbeScanVerdict;
|
|
14
|
-
viruses: string[];
|
|
15
|
-
/**
|
|
16
|
-
* `ACCOUNT_AV_SCAN_UNITS` this scan consumed (WS5-1/2 — see
|
|
17
|
-
* `estimateProbeScanCost`). Always a number here (never null): a SYNC
|
|
18
|
-
* response is only ever sent once the scan has reached a verdict, at
|
|
19
|
-
* which point the cost is always known and already billed.
|
|
20
|
-
*/
|
|
21
|
-
costUnits: number;
|
|
22
|
-
}
|
|
23
|
-
export type IScanSyncResponse = IResponse<IScanSyncData>;
|
|
24
|
-
|
|
25
|
-
/** `POST /scan?mode=async` — HTTP 202, job queued. */
|
|
26
|
-
export interface IScanAsyncData {
|
|
27
|
-
scanId: string;
|
|
28
|
-
status: ProbeScanStatus.QUEUED;
|
|
29
|
-
}
|
|
30
|
-
export type IScanAsyncResponse = IResponse<IScanAsyncData>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* `POST /scan`'s actual response body is one or the other of the two data
|
|
34
|
-
* shapes above, discriminated by the request's own `mode` (sync -> 200 +
|
|
35
|
-
* {@link IScanSyncData}, async -> 202 + {@link IScanAsyncData}). A caller
|
|
36
|
-
* that only ever uses one mode should prefer the sdk's `scanSync`/`scanAsync`
|
|
37
|
-
* wrappers, which return the precise, non-union type.
|
|
38
|
-
*/
|
|
39
|
-
export type IScanResponse = IScanSyncResponse | IScanAsyncResponse;
|
|
40
|
-
|
|
41
|
-
/** `GET /scan/:scanId` — HTTP 200. */
|
|
42
|
-
export type IGetScanResponse = IResponse<IProbeScanDetail>;
|
|
43
|
-
|
|
44
|
-
/** `GET /scan` — HTTP 200, paginated history/search. */
|
|
45
|
-
export type IPaginateScanResponse = IResponse<BasePaginate<IProbeScanHistoryItem>>;
|
|
1
|
+
import { IResponse } from '../type-message/response';
|
|
2
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
3
|
+
import { ProbeScanStatus, ProbeScanVerdict } from '../../../enum';
|
|
4
|
+
import { IProbeScanDetail, IProbeScanHistoryItem } from '../../models';
|
|
5
|
+
|
|
6
|
+
// Mirrors apps/api/src/api/controllers/probe-scan.controller.ts's local
|
|
7
|
+
// ScanSyncResponseData / ScanAsyncResponseData / GetScanResponseData /
|
|
8
|
+
// PaginateScanResponseData EXACTLY.
|
|
9
|
+
|
|
10
|
+
/** `POST /scan` (default, or explicit `?mode=sync`) — HTTP 200. */
|
|
11
|
+
export interface IScanSyncData {
|
|
12
|
+
scanId: string;
|
|
13
|
+
verdict: ProbeScanVerdict;
|
|
14
|
+
viruses: string[];
|
|
15
|
+
/**
|
|
16
|
+
* `ACCOUNT_AV_SCAN_UNITS` this scan consumed (WS5-1/2 — see
|
|
17
|
+
* `estimateProbeScanCost`). Always a number here (never null): a SYNC
|
|
18
|
+
* response is only ever sent once the scan has reached a verdict, at
|
|
19
|
+
* which point the cost is always known and already billed.
|
|
20
|
+
*/
|
|
21
|
+
costUnits: number;
|
|
22
|
+
}
|
|
23
|
+
export type IScanSyncResponse = IResponse<IScanSyncData>;
|
|
24
|
+
|
|
25
|
+
/** `POST /scan?mode=async` — HTTP 202, job queued. */
|
|
26
|
+
export interface IScanAsyncData {
|
|
27
|
+
scanId: string;
|
|
28
|
+
status: ProbeScanStatus.QUEUED;
|
|
29
|
+
}
|
|
30
|
+
export type IScanAsyncResponse = IResponse<IScanAsyncData>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `POST /scan`'s actual response body is one or the other of the two data
|
|
34
|
+
* shapes above, discriminated by the request's own `mode` (sync -> 200 +
|
|
35
|
+
* {@link IScanSyncData}, async -> 202 + {@link IScanAsyncData}). A caller
|
|
36
|
+
* that only ever uses one mode should prefer the sdk's `scanSync`/`scanAsync`
|
|
37
|
+
* wrappers, which return the precise, non-union type.
|
|
38
|
+
*/
|
|
39
|
+
export type IScanResponse = IScanSyncResponse | IScanAsyncResponse;
|
|
40
|
+
|
|
41
|
+
/** `GET /scan/:scanId` — HTTP 200. */
|
|
42
|
+
export type IGetScanResponse = IResponse<IProbeScanDetail>;
|
|
43
|
+
|
|
44
|
+
/** `GET /scan` — HTTP 200, paginated history/search. */
|
|
45
|
+
export type IPaginateScanResponse = IResponse<BasePaginate<IProbeScanHistoryItem>>;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { IResponse } from '../type-message/response';
|
|
2
|
-
|
|
3
|
-
// WS5-3 (AbyssProbe UX rework) — mirrors
|
|
4
|
-
// apps/api/src/api/controllers/probe-usage.controller.ts's local response
|
|
5
|
-
// shape EXACTLY. Current ACCOUNT_AV_SCAN_UNITS ("tokens") consumption for the
|
|
6
|
-
// caller's scope, via the same billing check the quota gate itself uses.
|
|
7
|
-
|
|
8
|
-
export interface IProbeUsageData {
|
|
9
|
-
/** Units consumed so far in the current billing period. */
|
|
10
|
-
used: number;
|
|
11
|
-
/**
|
|
12
|
-
* Plan cap. `-1` is this codebase's established "unlimited" sentinel (see
|
|
13
|
-
* `utils/billing-emit.util.ts#UNLIMITED_EXPIRY_DAYS` server-side) — an
|
|
14
|
-
* unmetered plan tier reports `-1` here rather than `Infinity`/`null`, so
|
|
15
|
-
* treat a negative value as "no cap", never a literal negative quota.
|
|
16
|
-
*/
|
|
17
|
-
limit: number;
|
|
18
|
-
/**
|
|
19
|
-
* `limit - used`, floored at 0 — except it mirrors `limit`'s own `-1`
|
|
20
|
-
* sentinel unchanged when `limit` is unlimited (never a finite number in
|
|
21
|
-
* that case).
|
|
22
|
-
*/
|
|
23
|
-
remaining: number;
|
|
24
|
-
}
|
|
25
|
-
export type IProbeUsageResponse = IResponse<IProbeUsageData>;
|
|
1
|
+
import { IResponse } from '../type-message/response';
|
|
2
|
+
|
|
3
|
+
// WS5-3 (AbyssProbe UX rework) — mirrors
|
|
4
|
+
// apps/api/src/api/controllers/probe-usage.controller.ts's local response
|
|
5
|
+
// shape EXACTLY. Current ACCOUNT_AV_SCAN_UNITS ("tokens") consumption for the
|
|
6
|
+
// caller's scope, via the same billing check the quota gate itself uses.
|
|
7
|
+
|
|
8
|
+
export interface IProbeUsageData {
|
|
9
|
+
/** Units consumed so far in the current billing period. */
|
|
10
|
+
used: number;
|
|
11
|
+
/**
|
|
12
|
+
* Plan cap. `-1` is this codebase's established "unlimited" sentinel (see
|
|
13
|
+
* `utils/billing-emit.util.ts#UNLIMITED_EXPIRY_DAYS` server-side) — an
|
|
14
|
+
* unmetered plan tier reports `-1` here rather than `Infinity`/`null`, so
|
|
15
|
+
* treat a negative value as "no cap", never a literal negative quota.
|
|
16
|
+
*/
|
|
17
|
+
limit: number;
|
|
18
|
+
/**
|
|
19
|
+
* `limit - used`, floored at 0 — except it mirrors `limit`'s own `-1`
|
|
20
|
+
* sentinel unchanged when `limit` is unlimited (never a finite number in
|
|
21
|
+
* that case).
|
|
22
|
+
*/
|
|
23
|
+
remaining: number;
|
|
24
|
+
}
|
|
25
|
+
export type IProbeUsageResponse = IResponse<IProbeUsageData>;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { IResponse } from '../type-message/response';
|
|
2
|
-
import { BasePaginate } from '../type-message/base-paginate';
|
|
3
|
-
import { IProbeWebhook, IProbeWebhookDelivery } from '../../models';
|
|
4
|
-
|
|
5
|
-
// Mirrors apps/api/src/api/controllers/probe-webhook.controller.ts's local
|
|
6
|
-
// response shapes EXACTLY.
|
|
7
|
-
|
|
8
|
-
/** `POST /webhook` — HTTP 201. `secret` is re-displayable (WS5-7) — also returned by GET/PATCH, not just here. */
|
|
9
|
-
export type ICreateProbeWebhookResponse = IResponse<IProbeWebhook>;
|
|
10
|
-
|
|
11
|
-
/** `GET /webhook` — HTTP 200. A flat scope-filtered list, NOT paginated. `secret` included per row (WS5-7). */
|
|
12
|
-
export interface IListProbeWebhookData {
|
|
13
|
-
webhooks: IProbeWebhook[];
|
|
14
|
-
}
|
|
15
|
-
export type IListProbeWebhookResponse = IResponse<IListProbeWebhookData>;
|
|
16
|
-
|
|
17
|
-
/** `DELETE /webhook/:webhookId` — HTTP 200. */
|
|
18
|
-
export type IDeleteProbeWebhookResponse = IResponse<{ ok: true }>;
|
|
19
|
-
|
|
20
|
-
/** `PATCH /webhook/:webhookId` — HTTP 200 (WS5-5). `secret` included, same as every other webhook read. */
|
|
21
|
-
export type IUpdateProbeWebhookResponse = IResponse<IProbeWebhook>;
|
|
22
|
-
|
|
23
|
-
/** `GET /webhook/:webhookId/deliveries` — HTTP 200, paginated (WS5-6). */
|
|
24
|
-
export type IListProbeWebhookDeliveriesResponse = IResponse<BasePaginate<IProbeWebhookDelivery>>;
|
|
1
|
+
import { IResponse } from '../type-message/response';
|
|
2
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
3
|
+
import { IProbeWebhook, IProbeWebhookDelivery } from '../../models';
|
|
4
|
+
|
|
5
|
+
// Mirrors apps/api/src/api/controllers/probe-webhook.controller.ts's local
|
|
6
|
+
// response shapes EXACTLY.
|
|
7
|
+
|
|
8
|
+
/** `POST /webhook` — HTTP 201. `secret` is re-displayable (WS5-7) — also returned by GET/PATCH, not just here. */
|
|
9
|
+
export type ICreateProbeWebhookResponse = IResponse<IProbeWebhook>;
|
|
10
|
+
|
|
11
|
+
/** `GET /webhook` — HTTP 200. A flat scope-filtered list, NOT paginated. `secret` included per row (WS5-7). */
|
|
12
|
+
export interface IListProbeWebhookData {
|
|
13
|
+
webhooks: IProbeWebhook[];
|
|
14
|
+
}
|
|
15
|
+
export type IListProbeWebhookResponse = IResponse<IListProbeWebhookData>;
|
|
16
|
+
|
|
17
|
+
/** `DELETE /webhook/:webhookId` — HTTP 200. */
|
|
18
|
+
export type IDeleteProbeWebhookResponse = IResponse<{ ok: true }>;
|
|
19
|
+
|
|
20
|
+
/** `PATCH /webhook/:webhookId` — HTTP 200 (WS5-5). `secret` included, same as every other webhook read. */
|
|
21
|
+
export type IUpdateProbeWebhookResponse = IResponse<IProbeWebhook>;
|
|
22
|
+
|
|
23
|
+
/** `GET /webhook/:webhookId/deliveries` — HTTP 200, paginated (WS5-6). */
|
|
24
|
+
export type IListProbeWebhookDeliveriesResponse = IResponse<BasePaginate<IProbeWebhookDelivery>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Code, ErrorType } from '../../../enum';
|
|
2
|
-
|
|
3
|
-
export interface IApiError {
|
|
4
|
-
code: Code;
|
|
5
|
-
type: ErrorType;
|
|
6
|
-
message?: string;
|
|
7
|
-
}
|
|
1
|
+
import { Code, ErrorType } from '../../../enum';
|
|
2
|
+
|
|
3
|
+
export interface IApiError {
|
|
4
|
+
code: Code;
|
|
5
|
+
type: ErrorType;
|
|
6
|
+
message?: string;
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export interface BasePaginate<T> {
|
|
2
|
-
maxPages: number;
|
|
3
|
-
currentPage: number;
|
|
4
|
-
data: T[];
|
|
5
|
-
totalItems: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface QueryPaginate {
|
|
9
|
-
page?: number;
|
|
10
|
-
limit?: number;
|
|
11
|
-
}
|
|
1
|
+
export interface BasePaginate<T> {
|
|
2
|
+
maxPages: number;
|
|
3
|
+
currentPage: number;
|
|
4
|
+
data: T[];
|
|
5
|
+
totalItems: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface QueryPaginate {
|
|
9
|
+
page?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IApiError } from './api-error';
|
|
2
|
-
|
|
3
|
-
export interface IResponse<T> {
|
|
4
|
-
data: T;
|
|
5
|
-
error?: IApiError | Error;
|
|
6
|
-
}
|
|
1
|
+
import { IApiError } from './api-error';
|
|
2
|
+
|
|
3
|
+
export interface IResponse<T> {
|
|
4
|
+
data: T;
|
|
5
|
+
error?: IApiError | Error;
|
|
6
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './models';
|
|
2
|
-
export * from './api';
|
|
1
|
+
export * from './models';
|
|
2
|
+
export * from './api';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './probe-scan.dto';
|
|
2
|
-
export * from './probe-webhook.dto';
|
|
3
|
-
export * from './probe-webhook-delivery.dto';
|
|
1
|
+
export * from './probe-scan.dto';
|
|
2
|
+
export * from './probe-webhook.dto';
|
|
3
|
+
export * from './probe-webhook-delivery.dto';
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { ProbeScanMode, ProbeScanStatus, ProbeScanVerdict } from '../../enum';
|
|
2
|
-
|
|
3
|
-
// Mirrors apps/api/src/api/controllers/probe-scan.controller.ts's local
|
|
4
|
-
// response interfaces. AbyssProbe deliberately returns TWO different scan
|
|
5
|
-
// shapes depending on the endpoint — never the raw `probe_scans` row, and
|
|
6
|
-
// never a single one-size-fits-all model — so this file mirrors that with
|
|
7
|
-
// two distinct interfaces rather than forcing one canonical "IProbeScan".
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* `GET /scan/:scanId` shape (poll the queued -> scanning -> done/error
|
|
11
|
-
* progression). WS5-4 (AbyssProbe UX rework) widened this to full metadata
|
|
12
|
-
* parity with {@link IProbeScanHistoryItem} (fileName/fileSize/mimeType/
|
|
13
|
-
* mode/startedAt/finishedAt/costUnits) — the scanner UI's "Détails" section
|
|
14
|
-
* needs the same info whether it got there via the list or via a direct
|
|
15
|
-
* poll — still never echoing internal ownership columns (userId,
|
|
16
|
-
* organizationId, callbackUrl) — a caller polling by id already knows what
|
|
17
|
-
* it submitted.
|
|
18
|
-
*/
|
|
19
|
-
export interface IProbeScanDetail {
|
|
20
|
-
scanId: string;
|
|
21
|
-
status: ProbeScanStatus;
|
|
22
|
-
/** null until `status` is DONE. */
|
|
23
|
-
verdict: ProbeScanVerdict | null;
|
|
24
|
-
/** null until `status` is DONE; [] when DONE and clean. */
|
|
25
|
-
viruses: string[] | null;
|
|
26
|
-
/** Free-form caller reference echoed back verbatim (see IProbeScanHistoryItem#context). */
|
|
27
|
-
context: Record<string, unknown> | null;
|
|
28
|
-
fileName: string;
|
|
29
|
-
fileSize: number;
|
|
30
|
-
mimeType: string;
|
|
31
|
-
mode: ProbeScanMode;
|
|
32
|
-
/** Set the moment the engine call starts (SYNC: row-creation time; ASYNC: when a worker picks the job off the queue). */
|
|
33
|
-
startedAt: Date;
|
|
34
|
-
/** Set once the engine call returns. null while status is not DONE. */
|
|
35
|
-
finishedAt: Date | null;
|
|
36
|
-
/**
|
|
37
|
-
* `ACCOUNT_AV_SCAN_UNITS` this scan consumed (see `estimateProbeScanCost`
|
|
38
|
-
* — this package's own shared pure cost model). null until `status` is
|
|
39
|
-
* DONE; stays null forever for a scan that errors out (no verdict was ever
|
|
40
|
-
* reached, so nothing was ever billed).
|
|
41
|
-
*/
|
|
42
|
-
costUnits: number | null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* One row of `GET /scan`'s paginated history/search list. Never echoes
|
|
47
|
-
* internal ownership columns (userId, organizationId, callbackUrl) — a
|
|
48
|
-
* caller already knows their own scope from the request they made.
|
|
49
|
-
*/
|
|
50
|
-
export interface IProbeScanHistoryItem {
|
|
51
|
-
scanId: string;
|
|
52
|
-
fileName: string;
|
|
53
|
-
fileSize: number;
|
|
54
|
-
mimeType: string;
|
|
55
|
-
verdict: ProbeScanVerdict | null;
|
|
56
|
-
viruses: string[] | null;
|
|
57
|
-
mode: ProbeScanMode;
|
|
58
|
-
status: ProbeScanStatus;
|
|
59
|
-
context: Record<string, unknown> | null;
|
|
60
|
-
/** Set the moment the engine call starts (SYNC: row-creation time; ASYNC: when a worker picks the job off the queue). */
|
|
61
|
-
startedAt: Date;
|
|
62
|
-
/** Set once the engine call returns. null while status is not DONE. */
|
|
63
|
-
finishedAt: Date | null;
|
|
64
|
-
/** See {@link IProbeScanDetail#costUnits}. */
|
|
65
|
-
costUnits: number | null;
|
|
66
|
-
createdAt: Date;
|
|
67
|
-
}
|
|
1
|
+
import { ProbeScanMode, ProbeScanStatus, ProbeScanVerdict } from '../../enum';
|
|
2
|
+
|
|
3
|
+
// Mirrors apps/api/src/api/controllers/probe-scan.controller.ts's local
|
|
4
|
+
// response interfaces. AbyssProbe deliberately returns TWO different scan
|
|
5
|
+
// shapes depending on the endpoint — never the raw `probe_scans` row, and
|
|
6
|
+
// never a single one-size-fits-all model — so this file mirrors that with
|
|
7
|
+
// two distinct interfaces rather than forcing one canonical "IProbeScan".
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `GET /scan/:scanId` shape (poll the queued -> scanning -> done/error
|
|
11
|
+
* progression). WS5-4 (AbyssProbe UX rework) widened this to full metadata
|
|
12
|
+
* parity with {@link IProbeScanHistoryItem} (fileName/fileSize/mimeType/
|
|
13
|
+
* mode/startedAt/finishedAt/costUnits) — the scanner UI's "Détails" section
|
|
14
|
+
* needs the same info whether it got there via the list or via a direct
|
|
15
|
+
* poll — still never echoing internal ownership columns (userId,
|
|
16
|
+
* organizationId, callbackUrl) — a caller polling by id already knows what
|
|
17
|
+
* it submitted.
|
|
18
|
+
*/
|
|
19
|
+
export interface IProbeScanDetail {
|
|
20
|
+
scanId: string;
|
|
21
|
+
status: ProbeScanStatus;
|
|
22
|
+
/** null until `status` is DONE. */
|
|
23
|
+
verdict: ProbeScanVerdict | null;
|
|
24
|
+
/** null until `status` is DONE; [] when DONE and clean. */
|
|
25
|
+
viruses: string[] | null;
|
|
26
|
+
/** Free-form caller reference echoed back verbatim (see IProbeScanHistoryItem#context). */
|
|
27
|
+
context: Record<string, unknown> | null;
|
|
28
|
+
fileName: string;
|
|
29
|
+
fileSize: number;
|
|
30
|
+
mimeType: string;
|
|
31
|
+
mode: ProbeScanMode;
|
|
32
|
+
/** Set the moment the engine call starts (SYNC: row-creation time; ASYNC: when a worker picks the job off the queue). */
|
|
33
|
+
startedAt: Date;
|
|
34
|
+
/** Set once the engine call returns. null while status is not DONE. */
|
|
35
|
+
finishedAt: Date | null;
|
|
36
|
+
/**
|
|
37
|
+
* `ACCOUNT_AV_SCAN_UNITS` this scan consumed (see `estimateProbeScanCost`
|
|
38
|
+
* — this package's own shared pure cost model). null until `status` is
|
|
39
|
+
* DONE; stays null forever for a scan that errors out (no verdict was ever
|
|
40
|
+
* reached, so nothing was ever billed).
|
|
41
|
+
*/
|
|
42
|
+
costUnits: number | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* One row of `GET /scan`'s paginated history/search list. Never echoes
|
|
47
|
+
* internal ownership columns (userId, organizationId, callbackUrl) — a
|
|
48
|
+
* caller already knows their own scope from the request they made.
|
|
49
|
+
*/
|
|
50
|
+
export interface IProbeScanHistoryItem {
|
|
51
|
+
scanId: string;
|
|
52
|
+
fileName: string;
|
|
53
|
+
fileSize: number;
|
|
54
|
+
mimeType: string;
|
|
55
|
+
verdict: ProbeScanVerdict | null;
|
|
56
|
+
viruses: string[] | null;
|
|
57
|
+
mode: ProbeScanMode;
|
|
58
|
+
status: ProbeScanStatus;
|
|
59
|
+
context: Record<string, unknown> | null;
|
|
60
|
+
/** Set the moment the engine call starts (SYNC: row-creation time; ASYNC: when a worker picks the job off the queue). */
|
|
61
|
+
startedAt: Date;
|
|
62
|
+
/** Set once the engine call returns. null while status is not DONE. */
|
|
63
|
+
finishedAt: Date | null;
|
|
64
|
+
/** See {@link IProbeScanDetail#costUnits}. */
|
|
65
|
+
costUnits: number | null;
|
|
66
|
+
createdAt: Date;
|
|
67
|
+
}
|