@abyss-project/link 1.0.0 → 1.1.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/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/link.admin.api.d.ts +14 -0
- package/dist/api/link.admin.api.js +64 -0
- package/dist/api/link.admin.api.js.map +1 -0
- package/dist/api/link.api.d.ts +15 -0
- package/dist/api/link.api.js +69 -0
- package/dist/api/link.api.js.map +1 -0
- package/dist/api/link.public.api.d.ts +2 -0
- package/dist/api/link.public.api.js +9 -0
- package/dist/api/link.public.api.js.map +1 -0
- package/dist/constants/link.constants.d.ts +11 -0
- package/dist/constants/link.constants.js +12 -1
- package/dist/constants/link.constants.js.map +1 -1
- package/dist/index.d.ts +37 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/api-error.enum.d.ts +9 -1
- package/dist/types/enum/api-error.enum.js +8 -0
- package/dist/types/enum/api-error.enum.js.map +1 -1
- package/dist/types/enum/index.d.ts +2 -0
- package/dist/types/enum/index.js +2 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/link-share.enum.d.ts +11 -0
- package/dist/types/enum/link-share.enum.js +17 -0
- package/dist/types/enum/link-share.enum.js.map +1 -0
- package/dist/types/enum/link-stats.enum.d.ts +5 -0
- package/dist/types/enum/link-stats.enum.js +10 -0
- package/dist/types/enum/link-stats.enum.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +3 -0
- package/dist/types/interface/api/requests/index.js +3 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/link.admin.request.d.ts +69 -0
- package/dist/types/interface/api/requests/link.admin.request.js +3 -0
- package/dist/types/interface/api/requests/link.admin.request.js.map +1 -0
- package/dist/types/interface/api/requests/link.public.request.d.ts +13 -0
- package/dist/types/interface/api/requests/link.public.request.js +3 -0
- package/dist/types/interface/api/requests/link.public.request.js.map +1 -0
- package/dist/types/interface/api/requests/link.request.d.ts +74 -0
- package/dist/types/interface/api/requests/link.request.js +3 -0
- package/dist/types/interface/api/requests/link.request.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +3 -0
- package/dist/types/interface/api/responses/index.js +3 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/link.admin.response.d.ts +43 -0
- package/dist/types/interface/api/responses/link.admin.response.js +3 -0
- package/dist/types/interface/api/responses/link.admin.response.js.map +1 -0
- package/dist/types/interface/api/responses/link.public.response.d.ts +5 -0
- package/dist/types/interface/api/responses/link.public.response.js +3 -0
- package/dist/types/interface/api/responses/link.public.response.js.map +1 -0
- package/dist/types/interface/api/responses/link.response.d.ts +43 -0
- package/dist/types/interface/api/responses/link.response.js +3 -0
- package/dist/types/interface/api/responses/link.response.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +1 -0
- package/dist/types/interface/models/index.js +1 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/link-list.dto.d.ts +20 -0
- package/dist/types/interface/models/link-list.dto.js +3 -0
- package/dist/types/interface/models/link-list.dto.js.map +1 -0
- package/package.json +15 -10
- package/src/api/index.ts +3 -0
- package/src/api/link.admin.api.ts +168 -0
- package/src/api/link.api.ts +158 -0
- package/src/api/link.public.api.ts +19 -0
- package/src/constants/link.constants.ts +17 -0
- package/src/index.ts +71 -0
- package/src/tests/link-public-api.spec.ts +37 -0
- package/src/tests/link-sdk-surface.spec.ts +191 -0
- package/src/tests/sdk-surface.spec.ts +1 -1
- package/src/types/enum/api-error.enum.ts +13 -0
- package/src/types/enum/index.ts +2 -0
- package/src/types/enum/link-share.enum.ts +17 -0
- package/src/types/enum/link-stats.enum.ts +6 -0
- package/src/types/interface/api/requests/index.ts +3 -0
- package/src/types/interface/api/requests/link.admin.request.ts +104 -0
- package/src/types/interface/api/requests/link.public.request.ts +18 -0
- package/src/types/interface/api/requests/link.request.ts +100 -0
- package/src/types/interface/api/responses/index.ts +3 -0
- package/src/types/interface/api/responses/link.admin.response.ts +56 -0
- package/src/types/interface/api/responses/link.public.response.ts +7 -0
- package/src/types/interface/api/responses/link.response.ts +55 -0
- package/src/types/interface/models/index.ts +1 -0
- package/src/types/interface/models/link-list.dto.ts +28 -0
- package/src/types/tests/link-enums.spec.ts +2 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ILink, ILinkStats, ILinkVisit } from '../../models/link.dto';
|
|
2
|
+
import { ILinkCampaignStatsRow } from '../../models/link-list.dto';
|
|
3
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
4
|
+
import { IResponse } from '../type-message/response';
|
|
5
|
+
|
|
6
|
+
export type IPaginateLinkAdminData = BasePaginate<ILink>;
|
|
7
|
+
export type IPaginateLinkAdminResponse = IResponse<IPaginateLinkAdminData>;
|
|
8
|
+
|
|
9
|
+
export interface IGetLinkAdminData {
|
|
10
|
+
link: ILink;
|
|
11
|
+
}
|
|
12
|
+
export type IGetLinkAdminResponse = IResponse<IGetLinkAdminData>;
|
|
13
|
+
|
|
14
|
+
export type IGetVisitsLinkAdminData = BasePaginate<ILinkVisit>;
|
|
15
|
+
export type IGetVisitsLinkAdminResponse = IResponse<IGetVisitsLinkAdminData>;
|
|
16
|
+
|
|
17
|
+
export interface IGetCampaignStatsLinkAdminData {
|
|
18
|
+
rows: ILinkCampaignStatsRow[];
|
|
19
|
+
}
|
|
20
|
+
export type IGetCampaignStatsLinkAdminResponse = IResponse<IGetCampaignStatsLinkAdminData>;
|
|
21
|
+
|
|
22
|
+
export interface ISetProtectionLinkAdminData {
|
|
23
|
+
link: ILink;
|
|
24
|
+
}
|
|
25
|
+
export type ISetProtectionLinkAdminResponse = IResponse<ISetProtectionLinkAdminData>;
|
|
26
|
+
|
|
27
|
+
export interface IUpdateLinkAdminData {
|
|
28
|
+
link: ILink;
|
|
29
|
+
}
|
|
30
|
+
export type IUpdateLinkAdminResponse = IResponse<IUpdateLinkAdminData>;
|
|
31
|
+
|
|
32
|
+
export type IDeleteLinkAdminResponse = IResponse<Record<string, never>>;
|
|
33
|
+
|
|
34
|
+
export interface ICreateLinkAdminData {
|
|
35
|
+
link: ILink;
|
|
36
|
+
}
|
|
37
|
+
export type ICreateLinkAdminResponse = IResponse<ICreateLinkAdminData>;
|
|
38
|
+
|
|
39
|
+
export interface IGetByOriginLinkAdminData {
|
|
40
|
+
link: ILink;
|
|
41
|
+
}
|
|
42
|
+
export type IGetByOriginLinkAdminResponse = IResponse<IGetByOriginLinkAdminData>;
|
|
43
|
+
|
|
44
|
+
export interface IGetStatsByOriginLinkAdminData {
|
|
45
|
+
stats: ILinkStats;
|
|
46
|
+
}
|
|
47
|
+
export type IGetStatsByOriginLinkAdminResponse = IResponse<IGetStatsByOriginLinkAdminData>;
|
|
48
|
+
|
|
49
|
+
export type IRecordCampaignViewLinkAdminResponse = IResponse<Record<string, never>>;
|
|
50
|
+
|
|
51
|
+
export interface IListCampaignTokensLinkAdminData {
|
|
52
|
+
links: ILink[];
|
|
53
|
+
}
|
|
54
|
+
export type IListCampaignTokensLinkAdminResponse = IResponse<IListCampaignTokensLinkAdminData>;
|
|
55
|
+
|
|
56
|
+
export type IDeleteCampaignTokenLinkAdminResponse = IResponse<Record<string, never>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IResponse } from '../type-message/response';
|
|
2
|
+
|
|
3
|
+
export interface IUnlockLinkPublicData {
|
|
4
|
+
/** The destination, with the campaign parameters forwarded when the link asks for it. */
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
export type IUnlockLinkPublicResponse = IResponse<IUnlockLinkPublicData>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ILink, ILinkStats, ILinkVisit } from '../../models/link.dto';
|
|
2
|
+
import { ILinkListItem } from '../../models/link-list.dto';
|
|
3
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
4
|
+
import { IResponse } from '../type-message/response';
|
|
5
|
+
|
|
6
|
+
export interface IGetLinkData {
|
|
7
|
+
link: ILink;
|
|
8
|
+
}
|
|
9
|
+
export type IGetLinkResponse = IResponse<IGetLinkData>;
|
|
10
|
+
|
|
11
|
+
export type IPaginateLinkData = BasePaginate<ILinkListItem>;
|
|
12
|
+
export type IPaginateLinkResponse = IResponse<IPaginateLinkData>;
|
|
13
|
+
|
|
14
|
+
/** `orphan` and `unshared` are given to an organization administrator in `adminView` only. */
|
|
15
|
+
export interface ICountOrganizationLinkData {
|
|
16
|
+
total: number;
|
|
17
|
+
orphan?: number;
|
|
18
|
+
unshared?: number;
|
|
19
|
+
}
|
|
20
|
+
export type ICountOrganizationLinkResponse = IResponse<ICountOrganizationLinkData>;
|
|
21
|
+
|
|
22
|
+
export interface ICreateLinkData {
|
|
23
|
+
link: ILink;
|
|
24
|
+
}
|
|
25
|
+
export type ICreateLinkResponse = IResponse<ICreateLinkData>;
|
|
26
|
+
|
|
27
|
+
export interface IUpdateLinkData {
|
|
28
|
+
link: ILink;
|
|
29
|
+
}
|
|
30
|
+
export type IUpdateLinkResponse = IResponse<IUpdateLinkData>;
|
|
31
|
+
|
|
32
|
+
export type IDeleteLinkResponse = IResponse<Record<string, never>>;
|
|
33
|
+
|
|
34
|
+
export interface ITransferLinkData {
|
|
35
|
+
link: ILink;
|
|
36
|
+
}
|
|
37
|
+
export type ITransferLinkResponse = IResponse<ITransferLinkData>;
|
|
38
|
+
|
|
39
|
+
export interface IGetLinkStatsData {
|
|
40
|
+
stats: ILinkStats;
|
|
41
|
+
}
|
|
42
|
+
export type IGetLinkStatsResponse = IResponse<IGetLinkStatsData>;
|
|
43
|
+
|
|
44
|
+
export type IGetLinkVisitsData = BasePaginate<ILinkVisit>;
|
|
45
|
+
export type IGetLinkVisitsResponse = IResponse<IGetLinkVisitsData>;
|
|
46
|
+
|
|
47
|
+
export interface IGetByOriginLinkData {
|
|
48
|
+
link: ILink;
|
|
49
|
+
}
|
|
50
|
+
export type IGetByOriginLinkResponse = IResponse<IGetByOriginLinkData>;
|
|
51
|
+
|
|
52
|
+
export interface IGetStatsByOriginLinkData {
|
|
53
|
+
stats: ILinkStats;
|
|
54
|
+
}
|
|
55
|
+
export type IGetStatsByOriginLinkResponse = IResponse<IGetStatsByOriginLinkData>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LinkSharePermission } from '../../enum/link-share.enum';
|
|
2
|
+
import { ILink } from './link.dto';
|
|
3
|
+
|
|
4
|
+
/** A content share of a link, as abyss-main holds it (the fields the Links screen shows). */
|
|
5
|
+
export interface ILinkContentShare {
|
|
6
|
+
id: string;
|
|
7
|
+
/** `USER`, `TEAM`, `ORGANIZATION`, `PROJECT` or `PUBLIC` on abyss-main's side. */
|
|
8
|
+
targetType: string;
|
|
9
|
+
targetId: string | null;
|
|
10
|
+
permission: LinkSharePermission;
|
|
11
|
+
expiresAt: string | null;
|
|
12
|
+
createdByUserId: string | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A link of a list, with the caller's permission on it and its shares. */
|
|
16
|
+
export interface ILinkListItem extends ILink {
|
|
17
|
+
permission: LinkSharePermission;
|
|
18
|
+
shares: ILinkContentShare[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** One row of the campaign statistics of a link: human visits grouped by campaign and medium. */
|
|
22
|
+
export interface ILinkCampaignStatsRow {
|
|
23
|
+
utmCampaign: string | null;
|
|
24
|
+
utmMedium: string | null;
|
|
25
|
+
visits: number;
|
|
26
|
+
/** Sum over the days of the distinct visitors of each day (the visitor hash lives one day). */
|
|
27
|
+
uniqueVisitors: number;
|
|
28
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CAMPAIGN_TOKEN_QUERY_PARAM,
|
|
2
3
|
LINK_CAMPAIGN_TOKEN_LENGTH,
|
|
3
4
|
LINK_CAMPAIGN_TOKENS_PER_PROJECT,
|
|
4
5
|
LINK_RESOURCE_CODE_LENGTH,
|
|
@@ -41,6 +42,7 @@ describe('link limits', () => {
|
|
|
41
42
|
expect(LINK_RESOURCE_CODE_LENGTH).toBe(10);
|
|
42
43
|
expect(LINK_CAMPAIGN_TOKEN_LENGTH).toBe(12);
|
|
43
44
|
expect(LINK_CAMPAIGN_TOKENS_PER_PROJECT).toBe(50);
|
|
45
|
+
expect(CAMPAIGN_TOKEN_QUERY_PARAM).toBe('lnk');
|
|
44
46
|
expect(LINK_VISIT_RETENTION_DAYS).toBe(90);
|
|
45
47
|
});
|
|
46
48
|
});
|