@abyss-project/beam 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.
- package/.eslintrc.js +32 -0
- package/.prettierrc +5 -0
- package/README.md +21 -2
- package/dist/api/beam.api.d.ts +49 -0
- package/dist/api/beam.api.js +110 -0
- package/dist/api/beam.api.js.map +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +18 -0
- package/dist/api/index.js.map +1 -0
- package/dist/constants/beam.constants.d.ts +1 -0
- package/dist/constants/beam.constants.js +5 -0
- package/dist/constants/beam.constants.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +18 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +149 -0
- package/dist/index.js.map +1 -0
- package/dist/types/enum/api-error.enum.d.ts +31 -0
- package/dist/types/enum/api-error.enum.js +37 -0
- package/dist/types/enum/api-error.enum.js.map +1 -0
- package/dist/types/enum/beam.enum.d.ts +22 -0
- package/dist/types/enum/beam.enum.js +30 -0
- package/dist/types/enum/beam.enum.js.map +1 -0
- package/dist/types/enum/content-share.enum.d.ts +34 -0
- package/dist/types/enum/content-share.enum.js +42 -0
- package/dist/types/enum/content-share.enum.js.map +1 -0
- package/dist/types/enum/index.d.ts +3 -0
- package/dist/types/enum/index.js +20 -0
- package/dist/types/enum/index.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interface/api/index.d.ts +5 -0
- package/dist/types/interface/api/index.js +22 -0
- package/dist/types/interface/api/index.js.map +1 -0
- package/dist/types/interface/api/requests/beam.request.d.ts +139 -0
- package/dist/types/interface/api/requests/beam.request.js +3 -0
- package/dist/types/interface/api/requests/beam.request.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +1 -0
- package/dist/types/interface/api/requests/index.js +18 -0
- package/dist/types/interface/api/requests/index.js.map +1 -0
- package/dist/types/interface/api/responses/beam.response.d.ts +115 -0
- package/dist/types/interface/api/responses/beam.response.js +3 -0
- package/dist/types/interface/api/responses/beam.response.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +1 -0
- package/dist/types/interface/api/responses/index.js +18 -0
- package/dist/types/interface/api/responses/index.js.map +1 -0
- package/dist/types/interface/api/type-message/api-error.d.ts +6 -0
- package/dist/types/interface/api/type-message/api-error.js +3 -0
- package/dist/types/interface/api/type-message/api-error.js.map +1 -0
- package/dist/types/interface/api/type-message/base-paginate.d.ts +10 -0
- package/dist/types/interface/api/type-message/base-paginate.js +3 -0
- package/dist/types/interface/api/type-message/base-paginate.js.map +1 -0
- package/dist/types/interface/api/type-message/response.d.ts +5 -0
- package/dist/types/interface/api/type-message/response.js +3 -0
- package/dist/types/interface/api/type-message/response.js.map +1 -0
- package/dist/types/interface/index.d.ts +2 -0
- package/dist/types/interface/index.js +19 -0
- package/dist/types/interface/index.js.map +1 -0
- package/dist/types/interface/models/beam.dto.d.ts +70 -0
- package/dist/types/interface/models/beam.dto.js +3 -0
- package/dist/types/interface/models/beam.dto.js.map +1 -0
- package/dist/types/interface/models/content-share.dto.d.ts +15 -0
- package/dist/types/interface/models/content-share.dto.js +3 -0
- package/dist/types/interface/models/content-share.dto.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +5 -0
- package/dist/types/interface/models/index.js +22 -0
- package/dist/types/interface/models/index.js.map +1 -0
- package/dist/types/interface/models/organization.dto.d.ts +11 -0
- package/dist/types/interface/models/organization.dto.js +3 -0
- package/dist/types/interface/models/organization.dto.js.map +1 -0
- package/dist/types/interface/models/project.dto.d.ts +12 -0
- package/dist/types/interface/models/project.dto.js +3 -0
- package/dist/types/interface/models/project.dto.js.map +1 -0
- package/dist/types/interface/models/user.dto.d.ts +11 -0
- package/dist/types/interface/models/user.dto.js +3 -0
- package/dist/types/interface/models/user.dto.js.map +1 -0
- package/dist/utils/enum.utils.d.ts +1 -0
- package/dist/utils/enum.utils.js +3 -0
- package/dist/utils/enum.utils.js.map +1 -0
- package/dist/utils/error.utils.d.ts +15 -0
- package/dist/utils/error.utils.js +25 -0
- package/dist/utils/error.utils.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +58 -4
- package/src/api/beam.api.ts +325 -0
- package/src/api/index.ts +1 -0
- package/src/api/tests/beam.api.spec.ts +106 -0
- package/src/constants/beam.constants.ts +4 -0
- package/src/constants/index.ts +1 -0
- package/src/index.ts +167 -0
- package/src/types/enum/api-error.enum.ts +33 -0
- package/src/types/enum/beam.enum.ts +48 -0
- package/src/types/enum/content-share.enum.ts +37 -0
- package/src/types/enum/index.ts +3 -0
- package/src/types/index.ts +2 -0
- package/src/types/interface/api/index.ts +5 -0
- package/src/types/interface/api/requests/beam.request.ts +180 -0
- package/src/types/interface/api/requests/index.ts +1 -0
- package/src/types/interface/api/responses/beam.response.ts +162 -0
- package/src/types/interface/api/responses/index.ts +1 -0
- package/src/types/interface/api/type-message/api-error.ts +7 -0
- package/src/types/interface/api/type-message/base-paginate.ts +11 -0
- package/src/types/interface/api/type-message/response.ts +6 -0
- package/src/types/interface/index.ts +2 -0
- package/src/types/interface/models/beam.dto.ts +86 -0
- package/src/types/interface/models/content-share.dto.ts +20 -0
- package/src/types/interface/models/index.ts +5 -0
- package/src/types/interface/models/organization.dto.ts +21 -0
- package/src/types/interface/models/project.dto.ts +16 -0
- package/src/types/interface/models/user.dto.ts +19 -0
- package/src/types/tests/beam-management-types.spec.ts +38 -0
- package/src/types/tests/beam-share-enums.spec.ts +11 -0
- package/src/types/tests/beam.dto.spec.ts +61 -0
- package/src/types/tests/beam.request-response.spec.ts +43 -0
- package/src/utils/enum.utils.ts +1 -0
- package/src/utils/error.utils.ts +30 -0
- package/src/utils/index.ts +2 -0
- package/tsconfig.check.json +15 -0
- package/tsconfig.json +36 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export enum ShareableContentType {
|
|
2
|
+
DRAW = 'draw',
|
|
3
|
+
BOARD = 'board',
|
|
4
|
+
ATLAS = 'atlas',
|
|
5
|
+
RETROSPECTIVE = 'retrospective',
|
|
6
|
+
SHORT_LINK = 'short_link',
|
|
7
|
+
CLOUD_FILE = 'cloud_file',
|
|
8
|
+
CLOUD_FOLDER = 'cloud_folder',
|
|
9
|
+
CLOUD_GALLERY = 'cloud_gallery',
|
|
10
|
+
FORM = 'form',
|
|
11
|
+
SPOTLIGHT_PROJECT = 'spotlight_project',
|
|
12
|
+
EVENT = 'event',
|
|
13
|
+
REPORT = 'report',
|
|
14
|
+
PDF = 'pdf',
|
|
15
|
+
BEAM = 'beam',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum ShareTargetType {
|
|
19
|
+
USER = 'USER',
|
|
20
|
+
TEAM = 'TEAM',
|
|
21
|
+
ORGANIZATION = 'ORGANIZATION',
|
|
22
|
+
PROJECT = 'PROJECT',
|
|
23
|
+
LINK = 'LINK',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export enum SharePermission {
|
|
27
|
+
VIEW = 'VIEW',
|
|
28
|
+
EDIT = 'EDIT',
|
|
29
|
+
MANAGE = 'MANAGE',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum ContentShareScope {
|
|
33
|
+
ORGANIZATION = 'ORGANIZATION',
|
|
34
|
+
ORG_USER = 'ORG_USER',
|
|
35
|
+
ORG_TEAM = 'ORG_TEAM',
|
|
36
|
+
ORG_PROJECT = 'ORG_PROJECT',
|
|
37
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { ContentShareScope } from '../../../enum';
|
|
2
|
+
import { ShareTargetType, SharePermission } from '../../../enum/content-share.enum';
|
|
3
|
+
import { BeamVisibility } from '../../../enum/beam.enum';
|
|
4
|
+
import { QueryPaginate } from '../type-message/base-paginate';
|
|
5
|
+
|
|
6
|
+
export type IGetBeamParams = {
|
|
7
|
+
beamId: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type IGetBeamBySlugParams = {
|
|
11
|
+
slug: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type IPaginateBeamQuery = {
|
|
15
|
+
title?: string;
|
|
16
|
+
isActive?: boolean;
|
|
17
|
+
scope?: ContentShareScope;
|
|
18
|
+
teamId?: string;
|
|
19
|
+
projectId?: string;
|
|
20
|
+
adminView?: boolean;
|
|
21
|
+
sharedWithMe?: boolean;
|
|
22
|
+
} & QueryPaginate;
|
|
23
|
+
|
|
24
|
+
export type IPaginateProjectBeamParams = {
|
|
25
|
+
projectId: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type IPaginateOrganizationBeamParams = {
|
|
29
|
+
organizationId: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Draft-creation metadata bundle (design §4 step 1). Files are attached
|
|
33
|
+
// afterwards (B2) and the transfer is sealed at finalize (B5).
|
|
34
|
+
export type ICreateBeamBody = {
|
|
35
|
+
title?: string;
|
|
36
|
+
message?: string;
|
|
37
|
+
visibility?: BeamVisibility;
|
|
38
|
+
expiresInDays?: number;
|
|
39
|
+
password?: string;
|
|
40
|
+
maxDownloads?: number;
|
|
41
|
+
recipients?: { email: string; locale?: string }[];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Anonymous draft creation (POST /beam/public). Same metadata as the owned
|
|
45
|
+
// create. `expiresInDays` is an optional 1..7 lifetime (integer) the anonymous
|
|
46
|
+
// creator may pick; absent = the fixed 7-day anonymous TTL, and createDraft caps
|
|
47
|
+
// it at 7 days.
|
|
48
|
+
export type ICreateBeamPublicBody = {
|
|
49
|
+
title?: string;
|
|
50
|
+
message?: string;
|
|
51
|
+
visibility?: BeamVisibility;
|
|
52
|
+
password?: string;
|
|
53
|
+
expiresInDays?: number;
|
|
54
|
+
maxDownloads?: number;
|
|
55
|
+
recipients?: { email: string; locale?: string }[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export interface IAddBeamFilesParams {
|
|
59
|
+
beamId: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IAddBeamFilesBody {
|
|
63
|
+
files: { storageFileId: string }[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IImportCloudBeamFilesParams {
|
|
67
|
+
beamId: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface IImportCloudBeamFilesBody {
|
|
71
|
+
cloudFileIds: string[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface IFinalizeBeamParams {
|
|
75
|
+
beamId: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type IFinalizeBeamBody = Record<string, never>;
|
|
79
|
+
|
|
80
|
+
export type ICreateForOrganizationBeamParams = {
|
|
81
|
+
organizationId: string;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type IUpdateBeamParams = {
|
|
85
|
+
beamId: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type IUpdateBeamBody = {
|
|
89
|
+
title?: string;
|
|
90
|
+
message?: string;
|
|
91
|
+
visibility?: BeamVisibility;
|
|
92
|
+
isActive?: boolean;
|
|
93
|
+
expiresAt?: Date | null;
|
|
94
|
+
maxDownloads?: number | null;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export type IDeleteBeamParams = {
|
|
98
|
+
beamId: string;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Public serving (B3): unlock a password-protected transfer to obtain a
|
|
102
|
+
// short-lived unlock token used by the byte-serving endpoints.
|
|
103
|
+
export interface IUnlockBeamPublicParams {
|
|
104
|
+
slug: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface IUnlockBeamPublicBody {
|
|
108
|
+
password: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Management lifecycle (B4): renew/reactivate push expiresAt forward and
|
|
112
|
+
// reactivate the transfer server-side. `days` optionally requests the extension
|
|
113
|
+
// window; the API clamps it to the tier cap (7 days for anonymous transfers,
|
|
114
|
+
// the plan's BEAM_EXPIRY_MAX_DAYS for owned ones; default 7).
|
|
115
|
+
export interface IRenewBeamParams {
|
|
116
|
+
beamId: string;
|
|
117
|
+
days?: number;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface IRenewBeamBody {
|
|
121
|
+
days?: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface IReactivateBeamParams {
|
|
125
|
+
beamId: string;
|
|
126
|
+
days?: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface IReactivateBeamBody {
|
|
130
|
+
days?: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Sharing (B4): a MANAGE holder grants a content_share (BEAM content type) on the
|
|
134
|
+
// transfer. targetId is null for a LINK share, otherwise the user/team/org/project id.
|
|
135
|
+
export interface ICreateBeamShareParams {
|
|
136
|
+
beamId: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface ICreateBeamShareBody {
|
|
140
|
+
targetType: ShareTargetType;
|
|
141
|
+
targetId?: string | null;
|
|
142
|
+
permission: SharePermission;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface IListBeamSharesParams {
|
|
146
|
+
beamId: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface IRevokeBeamShareParams {
|
|
150
|
+
beamId: string;
|
|
151
|
+
shareId: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Recipients (B5): add extra recipients to a transfer (explicit add path,
|
|
155
|
+
// distinct from the recipients recorded at draft time). Capped at
|
|
156
|
+
// MAX_BEAM_RECIPIENTS on the API side.
|
|
157
|
+
export interface IAddRecipientsBeamParams {
|
|
158
|
+
beamId: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface IAddRecipientsBeamBody {
|
|
162
|
+
recipients: { email: string; locale?: string | null }[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface IListRecipientsBeamParams {
|
|
166
|
+
beamId: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Download stats (owner view): per-day series over the last `days` days plus the
|
|
170
|
+
// paginated recent-event feed (limit/offset, newest first). Defaults are applied
|
|
171
|
+
// server-side (days=30, limit=50, offset=0).
|
|
172
|
+
export interface IGetBeamStatsParams {
|
|
173
|
+
beamId: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface IGetBeamStatsQuery {
|
|
177
|
+
days?: number;
|
|
178
|
+
limit?: number;
|
|
179
|
+
offset?: number;
|
|
180
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './beam.request';
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
2
|
+
import { IResponse } from '../type-message/response';
|
|
3
|
+
import { IBeamTransfer, IBeamFile, IBeamRecipient } from '../../models/beam.dto';
|
|
4
|
+
import { IContentShare } from '../../models/content-share.dto';
|
|
5
|
+
import {
|
|
6
|
+
BeamVisibility,
|
|
7
|
+
BeamServeDenyReasonCode,
|
|
8
|
+
BeamDownloadKind,
|
|
9
|
+
BeamFileScanStatus,
|
|
10
|
+
} from '../../../enum/beam.enum';
|
|
11
|
+
|
|
12
|
+
export interface IGetBeamData {
|
|
13
|
+
beamTransfer: IBeamTransfer;
|
|
14
|
+
}
|
|
15
|
+
export type IGetBeamResponse = IResponse<IGetBeamData>;
|
|
16
|
+
|
|
17
|
+
export type IPaginateBeamResponse = IResponse<BasePaginate<IBeamTransfer>>;
|
|
18
|
+
|
|
19
|
+
export interface ICreateBeamData {
|
|
20
|
+
beamTransfer: IBeamTransfer;
|
|
21
|
+
}
|
|
22
|
+
export type ICreateBeamResponse = IResponse<ICreateBeamData>;
|
|
23
|
+
|
|
24
|
+
export interface IUpdateBeamData {
|
|
25
|
+
beamTransfer: IBeamTransfer;
|
|
26
|
+
}
|
|
27
|
+
export type IUpdateBeamResponse = IResponse<IUpdateBeamData>;
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
30
|
+
export interface IDeleteBeamData {}
|
|
31
|
+
export type IDeleteBeamResponse = IResponse<IDeleteBeamData>;
|
|
32
|
+
|
|
33
|
+
export type IAddBeamFilesResponse = IResponse<{ files: IBeamFile[] }>;
|
|
34
|
+
|
|
35
|
+
export interface IFinalizeBeamData {
|
|
36
|
+
slug: string;
|
|
37
|
+
viewUrl: string;
|
|
38
|
+
manageToken: string;
|
|
39
|
+
manageUrl: string;
|
|
40
|
+
expiresAt: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type IFinalizeBeamResponse = IResponse<IFinalizeBeamData>;
|
|
44
|
+
|
|
45
|
+
// Public serving (B3) — safe, purpose-built projection of a transfer for the
|
|
46
|
+
// browser-facing view: no owner ids, no password/manage hashes; adds
|
|
47
|
+
// hasPassword/isLocked/hasThumbnail so the front can render the locked state.
|
|
48
|
+
// `scanStatus` is the per-file AV verdict (storage-neutral — an INFECTED file
|
|
49
|
+
// is still listed and downloadable; the front renders the warning from this
|
|
50
|
+
// field, see BeamFileScanStatus).
|
|
51
|
+
export interface IBeamPublicFile {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
sizeOctet: number;
|
|
55
|
+
mimeType: string | null;
|
|
56
|
+
isImage: boolean;
|
|
57
|
+
hasThumbnail: boolean;
|
|
58
|
+
width: number | null;
|
|
59
|
+
height: number | null;
|
|
60
|
+
scanStatus: BeamFileScanStatus;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface IBeamPublicView {
|
|
64
|
+
slug: string;
|
|
65
|
+
title: string | null;
|
|
66
|
+
message: string | null;
|
|
67
|
+
visibility: BeamVisibility;
|
|
68
|
+
hasPassword: boolean;
|
|
69
|
+
isLocked: boolean;
|
|
70
|
+
expiresAt: string | null;
|
|
71
|
+
fileCount: number;
|
|
72
|
+
totalSizeOctet: number;
|
|
73
|
+
downloadCount: number;
|
|
74
|
+
files: IBeamPublicFile[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// `transfer` is null on the discovery-path denials the VIEW surfaces (404
|
|
78
|
+
// not-found / hidden, 410 expired, 403 max-downloads): the metadata projection
|
|
79
|
+
// is intentionally absent and `reason` carries the machine-readable denial code
|
|
80
|
+
// so the front renders the correct state rather than inferring it from the bare
|
|
81
|
+
// HTTP status (spec §17.1). On a 200 `transfer` is non-null (visible transfer,
|
|
82
|
+
// possibly password-locked) and `reason` is omitted.
|
|
83
|
+
export type IGetBeamPublicResponse = IResponse<{
|
|
84
|
+
transfer: IBeamPublicView | null;
|
|
85
|
+
reason?: BeamServeDenyReasonCode;
|
|
86
|
+
}>;
|
|
87
|
+
|
|
88
|
+
export interface IUnlockBeamPublicData {
|
|
89
|
+
unlockToken: string;
|
|
90
|
+
expiresIn: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type IUnlockBeamPublicResponse = IResponse<IUnlockBeamPublicData>;
|
|
94
|
+
|
|
95
|
+
// Management lifecycle (B4): renew/reactivate return the refreshed transfer.
|
|
96
|
+
export interface IRenewBeamData {
|
|
97
|
+
beamTransfer: IBeamTransfer;
|
|
98
|
+
}
|
|
99
|
+
export type IRenewBeamResponse = IResponse<IRenewBeamData>;
|
|
100
|
+
|
|
101
|
+
export interface IReactivateBeamData {
|
|
102
|
+
beamTransfer: IBeamTransfer;
|
|
103
|
+
}
|
|
104
|
+
export type IReactivateBeamResponse = IResponse<IReactivateBeamData>;
|
|
105
|
+
|
|
106
|
+
// Sharing (B4): create returns the new grant, list returns every grant, revoke
|
|
107
|
+
// returns an empty envelope (the delete cascade is server-side).
|
|
108
|
+
export interface ICreateBeamShareData {
|
|
109
|
+
contentShare: IContentShare;
|
|
110
|
+
}
|
|
111
|
+
export type ICreateBeamShareResponse = IResponse<ICreateBeamShareData>;
|
|
112
|
+
|
|
113
|
+
export interface IListBeamSharesData {
|
|
114
|
+
contentShares: IContentShare[];
|
|
115
|
+
}
|
|
116
|
+
export type IListBeamSharesResponse = IResponse<IListBeamSharesData>;
|
|
117
|
+
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
119
|
+
export interface IRevokeBeamShareData {}
|
|
120
|
+
export type IRevokeBeamShareResponse = IResponse<IRevokeBeamShareData>;
|
|
121
|
+
|
|
122
|
+
// Recipients (B5): add returns how many were enqueued vs rate-limited by the
|
|
123
|
+
// anti-abuse caps; list returns every recipient row of the transfer.
|
|
124
|
+
export interface IAddRecipientsBeamData {
|
|
125
|
+
enqueued: number;
|
|
126
|
+
rateLimited: number;
|
|
127
|
+
}
|
|
128
|
+
export type IAddRecipientsBeamResponse = IResponse<IAddRecipientsBeamData>;
|
|
129
|
+
|
|
130
|
+
export interface IListRecipientsBeamData {
|
|
131
|
+
recipients: IBeamRecipient[];
|
|
132
|
+
}
|
|
133
|
+
export type IListRecipientsBeamResponse = IResponse<IListRecipientsBeamData>;
|
|
134
|
+
|
|
135
|
+
// Download stats (owner view, MANAGE-gated): a per-day series (SQL date_trunc,
|
|
136
|
+
// UTC buckets; days with zero downloads are omitted), the paginated recent-event
|
|
137
|
+
// feed (newest first) and the denormalized transfer totals. `fileName` is null
|
|
138
|
+
// for a zip event and after the downloaded file was deleted (FK SET NULL).
|
|
139
|
+
export interface IBeamStatsDayBucket {
|
|
140
|
+
day: string; // 'YYYY-MM-DD'
|
|
141
|
+
count: number;
|
|
142
|
+
zipCount: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface IBeamStatsRecentEvent {
|
|
146
|
+
downloadedAt: string;
|
|
147
|
+
kind: BeamDownloadKind;
|
|
148
|
+
fileId: string | null;
|
|
149
|
+
fileName: string | null;
|
|
150
|
+
userId: string | null;
|
|
151
|
+
ipHash: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface IGetBeamStatsData {
|
|
155
|
+
byDay: IBeamStatsDayBucket[];
|
|
156
|
+
recent: IBeamStatsRecentEvent[];
|
|
157
|
+
totals: {
|
|
158
|
+
downloadCount: number;
|
|
159
|
+
lastDownloadedAt: string | null;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export type IGetBeamStatsResponse = IResponse<IGetBeamStatsData>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './beam.response';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { IOrganization } from './organization.dto';
|
|
2
|
+
import { IUser } from './user.dto';
|
|
3
|
+
import { IProject } from './project.dto';
|
|
4
|
+
import { BeamVisibility, BeamDownloadKind } from '../../enum/beam.enum';
|
|
5
|
+
|
|
6
|
+
export interface IBeamTransfer {
|
|
7
|
+
id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
// sha256 of the anonymous management token; the plaintext is returned once at
|
|
10
|
+
// finalize (B5) and never stored.
|
|
11
|
+
manageTokenHash: string | null;
|
|
12
|
+
userId: string | null;
|
|
13
|
+
organizationId: string | null;
|
|
14
|
+
projectId: string | null;
|
|
15
|
+
createdByUserId: string | null;
|
|
16
|
+
visibility: BeamVisibility;
|
|
17
|
+
passwordHash: string | null;
|
|
18
|
+
title: string | null;
|
|
19
|
+
message: string | null;
|
|
20
|
+
isActive: boolean;
|
|
21
|
+
expiresAt: Date | null;
|
|
22
|
+
finalizedAt: Date | null;
|
|
23
|
+
maxDownloads: number | null;
|
|
24
|
+
downloadCount: number;
|
|
25
|
+
lastDownloadedAt: Date | null;
|
|
26
|
+
totalSizeOctet: number;
|
|
27
|
+
fileCount: number;
|
|
28
|
+
createdAt?: Date;
|
|
29
|
+
updatedAt?: Date;
|
|
30
|
+
|
|
31
|
+
user?: IUser | null;
|
|
32
|
+
project?: IProject | null;
|
|
33
|
+
organization?: IOrganization | null;
|
|
34
|
+
files?: IBeamFile[];
|
|
35
|
+
recipients?: IBeamRecipient[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface IBeamFile {
|
|
39
|
+
id: string;
|
|
40
|
+
transferId: string;
|
|
41
|
+
// abyss-storage applicationFileId (PRIVATE bucket); resolved at serve time (B4).
|
|
42
|
+
storageFileId: string;
|
|
43
|
+
thumbnailStorageFileId: string | null;
|
|
44
|
+
name: string;
|
|
45
|
+
mimeType: string | null;
|
|
46
|
+
sizeOctet: number;
|
|
47
|
+
isImage: boolean;
|
|
48
|
+
width: number | null;
|
|
49
|
+
height: number | null;
|
|
50
|
+
downloadCount: number;
|
|
51
|
+
position: number;
|
|
52
|
+
createdAt?: Date;
|
|
53
|
+
|
|
54
|
+
transfer?: IBeamTransfer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface IBeamRecipient {
|
|
58
|
+
id: string;
|
|
59
|
+
transferId: string;
|
|
60
|
+
email: string;
|
|
61
|
+
locale: string | null;
|
|
62
|
+
sentAt: Date | null;
|
|
63
|
+
firstOpenedAt: Date | null;
|
|
64
|
+
createdAt?: Date;
|
|
65
|
+
|
|
66
|
+
transfer?: IBeamTransfer;
|
|
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
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShareableContentType,
|
|
3
|
+
SharePermission,
|
|
4
|
+
ShareTargetType,
|
|
5
|
+
} from '../../enum/content-share.enum';
|
|
6
|
+
|
|
7
|
+
export interface IContentShare {
|
|
8
|
+
id: string;
|
|
9
|
+
contentType: ShareableContentType;
|
|
10
|
+
contentId: string;
|
|
11
|
+
organizationId: string | null;
|
|
12
|
+
targetType: ShareTargetType;
|
|
13
|
+
targetId: string | null;
|
|
14
|
+
permission: SharePermission;
|
|
15
|
+
publicToken: string | null;
|
|
16
|
+
expiresAt: string | null;
|
|
17
|
+
createdByUserId: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IProject } from './project.dto';
|
|
2
|
+
|
|
3
|
+
export interface IOrganization {
|
|
4
|
+
id?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
// Mirror of abyss-main Organization.kind. Drives the family default-share
|
|
8
|
+
// permission (family → EDIT, else VIEW). Synced by organization.middleware.ts.
|
|
9
|
+
// Typed as a literal union that mirrors @abyss-project/main's OrganizationKind
|
|
10
|
+
// enum values 1:1 — this published SDK package intentionally does NOT depend on
|
|
11
|
+
// @abyss-project/main, so the enum is referenced by value (the api-side model
|
|
12
|
+
// and middleware narrow this to OrganizationKind, where main IS resolvable).
|
|
13
|
+
kind?: 'standard' | 'family';
|
|
14
|
+
// Last refresh of `kind` from abyss-main; drives the TTL (≤5min) sync gate.
|
|
15
|
+
kindSyncedAt?: string | null;
|
|
16
|
+
updatedAt?: Date;
|
|
17
|
+
createdAt?: Date;
|
|
18
|
+
|
|
19
|
+
// Associations
|
|
20
|
+
projects?: IProject[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IOrganization } from './organization.dto';
|
|
2
|
+
import { IUser } from './user.dto';
|
|
3
|
+
|
|
4
|
+
export interface IProject {
|
|
5
|
+
id?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
// Historical creator of the project, null once their account is deleted. NOT used for access control.
|
|
8
|
+
createdByUserId: string | null;
|
|
9
|
+
organizationId: string;
|
|
10
|
+
updatedAt?: Date;
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
|
|
13
|
+
// Associations
|
|
14
|
+
organization?: IOrganization;
|
|
15
|
+
user?: IUser;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IProject } from './project.dto';
|
|
2
|
+
|
|
3
|
+
export interface IUser {
|
|
4
|
+
id?: string;
|
|
5
|
+
isAdmin: boolean;
|
|
6
|
+
// Personal API key mirror from abyss-main (ADR-0037). The lookup hash is the
|
|
7
|
+
// non-reversible sha256 fingerprint used for local validation; revokedAt marks
|
|
8
|
+
// a mirrored key that must no longer authenticate.
|
|
9
|
+
personalApiKeyLookupHash?: string | null;
|
|
10
|
+
personalApiKeyRevokedAt?: Date | null;
|
|
11
|
+
// Set when the account was deleted in abyss-main (USER_DELETED, #199): the row stays, marked,
|
|
12
|
+
// and a session token signed before the deletion no longer authenticates.
|
|
13
|
+
accountDeletedAt?: Date | null;
|
|
14
|
+
updatedAt?: Date;
|
|
15
|
+
createdAt?: Date;
|
|
16
|
+
|
|
17
|
+
// Associations
|
|
18
|
+
projects?: IProject[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IRenewBeamParams,
|
|
3
|
+
IReactivateBeamParams,
|
|
4
|
+
ICreateBeamShareBody,
|
|
5
|
+
IRevokeBeamShareParams,
|
|
6
|
+
} from '../interface/api/requests/beam.request';
|
|
7
|
+
import type {
|
|
8
|
+
IRenewBeamResponse,
|
|
9
|
+
ICreateBeamShareResponse,
|
|
10
|
+
IListBeamSharesResponse,
|
|
11
|
+
} from '../interface/api/responses/beam.response';
|
|
12
|
+
import { ShareTargetType, SharePermission } from '../enum/content-share.enum';
|
|
13
|
+
import { BEAM_MANAGE_TOKEN_HEADER } from '../../constants/beam.constants';
|
|
14
|
+
|
|
15
|
+
describe('beam management SDK types', () => {
|
|
16
|
+
it('compiles renew/share request + response shapes', () => {
|
|
17
|
+
const renew: IRenewBeamParams = { beamId: 'b1' };
|
|
18
|
+
const reactivate: IReactivateBeamParams = { beamId: 'b1' };
|
|
19
|
+
const share: ICreateBeamShareBody = {
|
|
20
|
+
targetType: ShareTargetType.PROJECT,
|
|
21
|
+
targetId: 'p1',
|
|
22
|
+
permission: SharePermission.VIEW,
|
|
23
|
+
};
|
|
24
|
+
const revoke: IRevokeBeamShareParams = { beamId: 'b1', shareId: 's1' };
|
|
25
|
+
const renewResp: IRenewBeamResponse['data'] = { beamTransfer: {} as never };
|
|
26
|
+
const createResp: ICreateBeamShareResponse['data'] = { contentShare: {} as never };
|
|
27
|
+
const listResp: IListBeamSharesResponse['data'] = { contentShares: [] };
|
|
28
|
+
|
|
29
|
+
expect(renew.beamId).toBe('b1');
|
|
30
|
+
expect(reactivate.beamId).toBe('b1');
|
|
31
|
+
expect(share.targetType).toBe(ShareTargetType.PROJECT);
|
|
32
|
+
expect(revoke.shareId).toBe('s1');
|
|
33
|
+
expect(BEAM_MANAGE_TOKEN_HEADER).toBe('x-beam-manage-token');
|
|
34
|
+
expect(renewResp).toBeDefined();
|
|
35
|
+
expect(createResp).toBeDefined();
|
|
36
|
+
expect(listResp.contentShares).toHaveLength(0);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ShareableContentType, ShareTargetType } from '../enum/content-share.enum';
|
|
2
|
+
|
|
3
|
+
describe('tools content-share mirror — beam sharing members', () => {
|
|
4
|
+
it('exposes ShareableContentType.BEAM matching the abyss-main value', () => {
|
|
5
|
+
expect(ShareableContentType.BEAM).toBe('beam');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('exposes ShareTargetType.PROJECT so beam RESTRICTED grants can target a project', () => {
|
|
9
|
+
expect(ShareTargetType.PROJECT).toBe('PROJECT');
|
|
10
|
+
});
|
|
11
|
+
});
|