@abyss-project/main 1.0.68 → 1.0.69
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 +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/short-link.admin.api.d.ts +7 -0
- package/dist/api/short-link.admin.api.js +22 -0
- package/dist/api/short-link.api.d.ts +4 -7
- package/dist/api/short-link.api.js +8 -18
- package/dist/api/short-link.public.api.d.ts +8 -0
- package/dist/api/short-link.public.api.js +32 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/constants/short-link.constants.d.ts +8 -0
- package/dist/constants/short-link.constants.js +11 -0
- package/dist/types/enum/index.d.ts +1 -0
- package/dist/types/enum/index.js +1 -0
- package/dist/types/enum/user-agent.enum.d.ts +22 -0
- package/dist/types/enum/user-agent.enum.js +28 -0
- package/dist/types/interface/api/index.d.ts +2 -0
- package/dist/types/interface/api/index.js +2 -0
- package/dist/types/interface/api/requests/short-link.admin.request.d.ts +4 -1
- package/dist/types/interface/api/requests/short-link.public.request.d.ts +33 -0
- package/dist/types/interface/api/requests/short-link.public.request.js +2 -0
- package/dist/types/interface/api/requests/short-link.request.d.ts +7 -26
- package/dist/types/interface/api/responses/short-link.admin.response.d.ts +2 -0
- package/dist/types/interface/api/responses/short-link.public.response.d.ts +20 -0
- package/dist/types/interface/api/responses/short-link.public.response.js +2 -0
- package/dist/types/interface/api/responses/short-link.response.d.ts +4 -15
- package/dist/types/interface/models/short-link-click.model.d.ts +13 -1
- package/dist/types/interface/models/short-link.model.d.ts +16 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/string.utils.d.ts +6 -0
- package/dist/utils/string.utils.js +45 -0
- package/dist/utils/tracking.utils.d.ts +11 -0
- package/dist/utils/tracking.utils.js +60 -0
- package/package.json +1 -1
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -58,3 +58,5 @@ __exportStar(require("./atlas-page.api"), exports);
|
|
|
58
58
|
__exportStar(require("./atlas.public.api"), exports);
|
|
59
59
|
__exportStar(require("./memo.api"), exports);
|
|
60
60
|
__exportStar(require("./short-link.api"), exports);
|
|
61
|
+
__exportStar(require("./short-link.admin.api"), exports);
|
|
62
|
+
__exportStar(require("./short-link.public.api"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IPaginateShortLinkAdminQuery, IPaginateShortLinkAdminResponse, IGetShortLinkAdminParams, IGetShortLinkAdminResponse, IUpdateShortLinkAdminParams, IUpdateShortLinkAdminBody, IUpdateShortLinkAdminResponse, IDeleteShortLinkAdminParams, IDeleteShortLinkAdminResponse } from '../types';
|
|
2
|
+
export declare const shortLinkAdminApi: {
|
|
3
|
+
paginate: (query: IPaginateShortLinkAdminQuery) => Promise<IPaginateShortLinkAdminResponse>;
|
|
4
|
+
get: (params: IGetShortLinkAdminParams) => Promise<IGetShortLinkAdminResponse>;
|
|
5
|
+
update: (params: IUpdateShortLinkAdminParams, body: IUpdateShortLinkAdminBody) => Promise<IUpdateShortLinkAdminResponse>;
|
|
6
|
+
delete: (params: IDeleteShortLinkAdminParams) => Promise<IDeleteShortLinkAdminResponse>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shortLinkAdminApi = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
exports.shortLinkAdminApi = {
|
|
6
|
+
paginate: async (query) => {
|
|
7
|
+
const response = await index_1.AbyssCore.axios.get('/admin/short-link/paginate', { params: query });
|
|
8
|
+
return response.data;
|
|
9
|
+
},
|
|
10
|
+
get: async (params) => {
|
|
11
|
+
const response = await index_1.AbyssCore.axios.get(`/admin/short-link/${params.shortLinkId}`);
|
|
12
|
+
return response.data;
|
|
13
|
+
},
|
|
14
|
+
update: async (params, body) => {
|
|
15
|
+
const response = await index_1.AbyssCore.axios.put(`/admin/short-link/${params.shortLinkId}`, body);
|
|
16
|
+
return response.data;
|
|
17
|
+
},
|
|
18
|
+
delete: async (params) => {
|
|
19
|
+
const response = await index_1.AbyssCore.axios.delete(`/admin/short-link/${params.shortLinkId}`);
|
|
20
|
+
return response.data;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import type { IGetShortLinkParams, IGetShortLinkResponse,
|
|
1
|
+
import type { IGetShortLinkParams, IGetShortLinkResponse, IPaginateShortLinkQuery, IPaginateShortLinkResponse, IPaginateProjectShortLinkParams, ICreateShortLinkBody, ICreateShortLinkResponse, ICreateForProjectShortLinkParams, IUpdateShortLinkParams, IUpdateShortLinkBody, IUpdateShortLinkResponse, IDeleteShortLinkParams, IDeleteShortLinkResponse, IGetStatsShortLinkParams, IGetStatsShortLinkQuery, IGetStatsShortLinkResponse, IGetClicksShortLinkParams, IGetClicksShortLinkQuery, IGetClicksShortLinkResponse } from '../types';
|
|
2
2
|
export declare const shortLinkApi: {
|
|
3
3
|
get: (params: IGetShortLinkParams) => Promise<IGetShortLinkResponse>;
|
|
4
|
-
getBySlug: (params: IGetShortLinkBySlugParams) => Promise<IGetShortLinkBySlugResponse>;
|
|
5
|
-
validatePassword: (params: IGetShortLinkBySlugParams, body: IValidateShortLinkPasswordBody) => Promise<IValidateShortLinkPasswordResponse>;
|
|
6
4
|
paginate: (query: IPaginateShortLinkQuery) => Promise<IPaginateShortLinkResponse>;
|
|
7
|
-
|
|
8
|
-
paginateProject: (params: IPaginateProjectShortLinkParams, query: IPaginateProjectShortLinkQuery) => Promise<IPaginateShortLinkResponse>;
|
|
5
|
+
paginateProject: (params: IPaginateProjectShortLinkParams, query: IPaginateShortLinkQuery) => Promise<IPaginateShortLinkResponse>;
|
|
9
6
|
create: (body: ICreateShortLinkBody) => Promise<ICreateShortLinkResponse>;
|
|
10
|
-
createAnonymous: (body: ICreateShortLinkBody) => Promise<ICreateShortLinkResponse>;
|
|
11
7
|
createForProject: (params: ICreateForProjectShortLinkParams, body: ICreateShortLinkBody) => Promise<ICreateShortLinkResponse>;
|
|
12
8
|
update: (params: IUpdateShortLinkParams, body: IUpdateShortLinkBody) => Promise<IUpdateShortLinkResponse>;
|
|
13
9
|
delete: (params: IDeleteShortLinkParams) => Promise<IDeleteShortLinkResponse>;
|
|
14
|
-
getStats: (params:
|
|
10
|
+
getStats: (params: IGetStatsShortLinkParams, query?: IGetStatsShortLinkQuery) => Promise<IGetStatsShortLinkResponse>;
|
|
11
|
+
getClicks: (params: IGetClicksShortLinkParams, query?: IGetClicksShortLinkQuery) => Promise<IGetClicksShortLinkResponse>;
|
|
15
12
|
};
|
|
@@ -7,22 +7,10 @@ exports.shortLinkApi = {
|
|
|
7
7
|
const response = await index_1.AbyssCore.axios.get(`/short-link/${params.shortLinkId}`);
|
|
8
8
|
return response.data;
|
|
9
9
|
},
|
|
10
|
-
getBySlug: async (params) => {
|
|
11
|
-
const response = await index_1.AbyssCore.axios.get(`/short-link/slug/${params.slug}`);
|
|
12
|
-
return response.data;
|
|
13
|
-
},
|
|
14
|
-
validatePassword: async (params, body) => {
|
|
15
|
-
const response = await index_1.AbyssCore.axios.post(`/short-link/slug/${params.slug}/validate-password`, body);
|
|
16
|
-
return response.data;
|
|
17
|
-
},
|
|
18
10
|
paginate: async (query) => {
|
|
19
11
|
const response = await index_1.AbyssCore.axios.get('/short-link/paginate', { params: query });
|
|
20
12
|
return response.data;
|
|
21
13
|
},
|
|
22
|
-
paginateUser: async (query) => {
|
|
23
|
-
const response = await index_1.AbyssCore.axios.get('/short-link/user/paginate', { params: query });
|
|
24
|
-
return response.data;
|
|
25
|
-
},
|
|
26
14
|
paginateProject: async (params, query) => {
|
|
27
15
|
const response = await index_1.AbyssCore.axios.get(`/short-link/project/${params.projectId}/paginate`, {
|
|
28
16
|
params: query,
|
|
@@ -30,15 +18,11 @@ exports.shortLinkApi = {
|
|
|
30
18
|
return response.data;
|
|
31
19
|
},
|
|
32
20
|
create: async (body) => {
|
|
33
|
-
const response = await index_1.AbyssCore.axios.post('/short-link
|
|
34
|
-
return response.data;
|
|
35
|
-
},
|
|
36
|
-
createAnonymous: async (body) => {
|
|
37
|
-
const response = await index_1.AbyssCore.axios.post('/short-link/create-anonymous', body);
|
|
21
|
+
const response = await index_1.AbyssCore.axios.post('/short-link', body);
|
|
38
22
|
return response.data;
|
|
39
23
|
},
|
|
40
24
|
createForProject: async (params, body) => {
|
|
41
|
-
const response = await index_1.AbyssCore.axios.post(`/short-link/project/${params.projectId}
|
|
25
|
+
const response = await index_1.AbyssCore.axios.post(`/short-link/project/${params.projectId}`, body);
|
|
42
26
|
return response.data;
|
|
43
27
|
},
|
|
44
28
|
update: async (params, body) => {
|
|
@@ -55,4 +39,10 @@ exports.shortLinkApi = {
|
|
|
55
39
|
});
|
|
56
40
|
return response.data;
|
|
57
41
|
},
|
|
42
|
+
getClicks: async (params, query) => {
|
|
43
|
+
const response = await index_1.AbyssCore.axios.get(`/short-link/${params.shortLinkId}/clicks`, {
|
|
44
|
+
params: query,
|
|
45
|
+
});
|
|
46
|
+
return response.data;
|
|
47
|
+
},
|
|
58
48
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ICreateAnonymousShortLinkPublicBody, ICreateShortLinkPublicResponse, IGetStatsShortLinkPublicParams, IGetStatsShortLinkPublicQuery, IGetStatsShortLinkPublicResponse, IGetClicksShortLinkPublicParams, IGetClicksShortLinkPublicQuery, IGetClicksShortLinkPublicResponse, IRenewShortLinkPublicParams, IRenewShortLinkPublicResponse, IRedirectShortLinkPublicParams, IRedirectShortLinkPublicQuery, IRedirectShortLinkPublicResponse } from '../types';
|
|
2
|
+
export declare const shortLinkPublicApi: {
|
|
3
|
+
createAnonymous: (body: ICreateAnonymousShortLinkPublicBody) => Promise<ICreateShortLinkPublicResponse>;
|
|
4
|
+
redirect: (params: IRedirectShortLinkPublicParams, query?: IRedirectShortLinkPublicQuery) => Promise<IRedirectShortLinkPublicResponse>;
|
|
5
|
+
getStats: (params: IGetStatsShortLinkPublicParams, query?: IGetStatsShortLinkPublicQuery) => Promise<IGetStatsShortLinkPublicResponse>;
|
|
6
|
+
getClicks: (params: IGetClicksShortLinkPublicParams, query?: IGetClicksShortLinkPublicQuery) => Promise<IGetClicksShortLinkPublicResponse>;
|
|
7
|
+
renew: (params: IRenewShortLinkPublicParams) => Promise<IRenewShortLinkPublicResponse>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shortLinkPublicApi = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
exports.shortLinkPublicApi = {
|
|
6
|
+
createAnonymous: async (body) => {
|
|
7
|
+
const response = await index_1.AbyssCore.axios.post('/short-link/public', body);
|
|
8
|
+
return response.data;
|
|
9
|
+
},
|
|
10
|
+
redirect: async (params, query) => {
|
|
11
|
+
const response = await index_1.AbyssCore.axios.get(`/short-link/public/redirect/${params.slug}`, {
|
|
12
|
+
params: query,
|
|
13
|
+
});
|
|
14
|
+
return response.data;
|
|
15
|
+
},
|
|
16
|
+
getStats: async (params, query) => {
|
|
17
|
+
const response = await index_1.AbyssCore.axios.get(`/short-link/public/${params.shortLinkId}/stats`, {
|
|
18
|
+
params: query,
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
},
|
|
22
|
+
getClicks: async (params, query) => {
|
|
23
|
+
const response = await index_1.AbyssCore.axios.get(`/short-link/public/${params.shortLinkId}/clicks`, {
|
|
24
|
+
params: query,
|
|
25
|
+
});
|
|
26
|
+
return response.data;
|
|
27
|
+
},
|
|
28
|
+
renew: async (params) => {
|
|
29
|
+
const response = await index_1.AbyssCore.axios.post(`/short-link/public/${params.shortLinkId}/renew`);
|
|
30
|
+
return response.data;
|
|
31
|
+
},
|
|
32
|
+
};
|
package/dist/constants/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./board.constants"), exports);
|
|
18
18
|
__exportStar(require("./memo.constants"), exports);
|
|
19
|
+
__exportStar(require("./short-link.constants"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const MIN_SHORT_LINK_PAGE = 1;
|
|
2
|
+
export declare const MIN_SHORT_LINK_LIMIT = 1;
|
|
3
|
+
export declare const MAX_SHORT_LINK_LIMIT = 500;
|
|
4
|
+
export declare const MAX_SHORT_LINK_TITLE_LENGTH = 255;
|
|
5
|
+
export declare const MAX_SHORT_LINK_DESCRIPTION_LENGTH = 1000;
|
|
6
|
+
export declare const MIN_SHORT_LINK_MAX_CLICKS = 1;
|
|
7
|
+
export declare const MIN_SHORT_LINK_SLUG_LENGTH = 3;
|
|
8
|
+
export declare const MAX_SHORT_LINK_SLUG_LENGTH = 50;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_SHORT_LINK_SLUG_LENGTH = exports.MIN_SHORT_LINK_SLUG_LENGTH = exports.MIN_SHORT_LINK_MAX_CLICKS = exports.MAX_SHORT_LINK_DESCRIPTION_LENGTH = exports.MAX_SHORT_LINK_TITLE_LENGTH = exports.MAX_SHORT_LINK_LIMIT = exports.MIN_SHORT_LINK_LIMIT = exports.MIN_SHORT_LINK_PAGE = void 0;
|
|
4
|
+
exports.MIN_SHORT_LINK_PAGE = 1;
|
|
5
|
+
exports.MIN_SHORT_LINK_LIMIT = 1;
|
|
6
|
+
exports.MAX_SHORT_LINK_LIMIT = 500;
|
|
7
|
+
exports.MAX_SHORT_LINK_TITLE_LENGTH = 255;
|
|
8
|
+
exports.MAX_SHORT_LINK_DESCRIPTION_LENGTH = 1000;
|
|
9
|
+
exports.MIN_SHORT_LINK_MAX_CLICKS = 1;
|
|
10
|
+
exports.MIN_SHORT_LINK_SLUG_LENGTH = 3;
|
|
11
|
+
exports.MAX_SHORT_LINK_SLUG_LENGTH = 50;
|
package/dist/types/enum/index.js
CHANGED
|
@@ -38,3 +38,4 @@ __exportStar(require("./user-type.enum"), exports);
|
|
|
38
38
|
__exportStar(require("./onboarding-steps.enum"), exports);
|
|
39
39
|
__exportStar(require("./board-column-type.enum"), exports);
|
|
40
40
|
__exportStar(require("./board-activity.enum"), exports);
|
|
41
|
+
__exportStar(require("./user-agent.enum"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum UserAgentDevice {
|
|
2
|
+
DESKTOP = "desktop",
|
|
3
|
+
MOBILE = "mobile",
|
|
4
|
+
TABLET = "tablet",
|
|
5
|
+
UNKNOWN = "unknown"
|
|
6
|
+
}
|
|
7
|
+
export declare enum UserAgentBrowser {
|
|
8
|
+
CHROME = "Chrome",
|
|
9
|
+
FIREFOX = "Firefox",
|
|
10
|
+
SAFARI = "Safari",
|
|
11
|
+
EDGE = "Edge",
|
|
12
|
+
OPERA = "Opera",
|
|
13
|
+
UNKNOWN = "Unknown"
|
|
14
|
+
}
|
|
15
|
+
export declare enum UserAgentOS {
|
|
16
|
+
WINDOWS = "Windows",
|
|
17
|
+
MACOS = "MacOS",
|
|
18
|
+
LINUX = "Linux",
|
|
19
|
+
ANDROID = "Android",
|
|
20
|
+
IOS = "iOS",
|
|
21
|
+
UNKNOWN = "Unknown"
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserAgentOS = exports.UserAgentBrowser = exports.UserAgentDevice = void 0;
|
|
4
|
+
var UserAgentDevice;
|
|
5
|
+
(function (UserAgentDevice) {
|
|
6
|
+
UserAgentDevice["DESKTOP"] = "desktop";
|
|
7
|
+
UserAgentDevice["MOBILE"] = "mobile";
|
|
8
|
+
UserAgentDevice["TABLET"] = "tablet";
|
|
9
|
+
UserAgentDevice["UNKNOWN"] = "unknown";
|
|
10
|
+
})(UserAgentDevice || (exports.UserAgentDevice = UserAgentDevice = {}));
|
|
11
|
+
var UserAgentBrowser;
|
|
12
|
+
(function (UserAgentBrowser) {
|
|
13
|
+
UserAgentBrowser["CHROME"] = "Chrome";
|
|
14
|
+
UserAgentBrowser["FIREFOX"] = "Firefox";
|
|
15
|
+
UserAgentBrowser["SAFARI"] = "Safari";
|
|
16
|
+
UserAgentBrowser["EDGE"] = "Edge";
|
|
17
|
+
UserAgentBrowser["OPERA"] = "Opera";
|
|
18
|
+
UserAgentBrowser["UNKNOWN"] = "Unknown";
|
|
19
|
+
})(UserAgentBrowser || (exports.UserAgentBrowser = UserAgentBrowser = {}));
|
|
20
|
+
var UserAgentOS;
|
|
21
|
+
(function (UserAgentOS) {
|
|
22
|
+
UserAgentOS["WINDOWS"] = "Windows";
|
|
23
|
+
UserAgentOS["MACOS"] = "MacOS";
|
|
24
|
+
UserAgentOS["LINUX"] = "Linux";
|
|
25
|
+
UserAgentOS["ANDROID"] = "Android";
|
|
26
|
+
UserAgentOS["IOS"] = "iOS";
|
|
27
|
+
UserAgentOS["UNKNOWN"] = "Unknown";
|
|
28
|
+
})(UserAgentOS || (exports.UserAgentOS = UserAgentOS = {}));
|
|
@@ -44,6 +44,7 @@ export * from './requests/atlas-group.request';
|
|
|
44
44
|
export * from './requests/atlas.public.request';
|
|
45
45
|
export * from './requests/memo.request';
|
|
46
46
|
export * from './requests/short-link.request';
|
|
47
|
+
export * from './requests/short-link.public.request';
|
|
47
48
|
export * from './requests/short-link.admin.request';
|
|
48
49
|
export * from './responses/auth.response';
|
|
49
50
|
export * from './responses/user.response';
|
|
@@ -89,4 +90,5 @@ export * from './responses/atlas-group.response';
|
|
|
89
90
|
export * from './responses/atlas.public.response';
|
|
90
91
|
export * from './responses/memo.response';
|
|
91
92
|
export * from './responses/short-link.response';
|
|
93
|
+
export * from './responses/short-link.public.response';
|
|
92
94
|
export * from './responses/short-link.admin.response';
|
|
@@ -60,6 +60,7 @@ __exportStar(require("./requests/atlas-group.request"), exports);
|
|
|
60
60
|
__exportStar(require("./requests/atlas.public.request"), exports);
|
|
61
61
|
__exportStar(require("./requests/memo.request"), exports);
|
|
62
62
|
__exportStar(require("./requests/short-link.request"), exports);
|
|
63
|
+
__exportStar(require("./requests/short-link.public.request"), exports);
|
|
63
64
|
__exportStar(require("./requests/short-link.admin.request"), exports);
|
|
64
65
|
__exportStar(require("./responses/auth.response"), exports);
|
|
65
66
|
__exportStar(require("./responses/user.response"), exports);
|
|
@@ -105,4 +106,5 @@ __exportStar(require("./responses/atlas-group.response"), exports);
|
|
|
105
106
|
__exportStar(require("./responses/atlas.public.response"), exports);
|
|
106
107
|
__exportStar(require("./responses/memo.response"), exports);
|
|
107
108
|
__exportStar(require("./responses/short-link.response"), exports);
|
|
109
|
+
__exportStar(require("./responses/short-link.public.response"), exports);
|
|
108
110
|
__exportStar(require("./responses/short-link.admin.response"), exports);
|
|
@@ -22,5 +22,8 @@ export type IUpdateShortLinkAdminBody = {
|
|
|
22
22
|
isActive?: boolean;
|
|
23
23
|
expiresAt?: Date | null;
|
|
24
24
|
maxClicks?: number | null;
|
|
25
|
-
password?: string | null;
|
|
26
25
|
};
|
|
26
|
+
export type IGetClicksShortLinkAdminParams = {
|
|
27
|
+
shortLinkId: string;
|
|
28
|
+
};
|
|
29
|
+
export type IGetClicksShortLinkAdminQuery = QueryPaginate;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { QueryPaginate } from '../type-message/base-paginate';
|
|
2
|
+
export type ICreateAnonymousShortLinkPublicBody = {
|
|
3
|
+
originalUrl: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
};
|
|
7
|
+
export type IRedirectShortLinkPublicParams = {
|
|
8
|
+
slug: string;
|
|
9
|
+
};
|
|
10
|
+
export type IRedirectShortLinkPublicQuery = {
|
|
11
|
+
ref?: string;
|
|
12
|
+
lang?: string;
|
|
13
|
+
utmSource?: string;
|
|
14
|
+
utmMedium?: string;
|
|
15
|
+
utmCampaign?: string;
|
|
16
|
+
utmTerm?: string;
|
|
17
|
+
utmContent?: string;
|
|
18
|
+
};
|
|
19
|
+
export type IGetStatsShortLinkPublicParams = {
|
|
20
|
+
shortLinkId: string;
|
|
21
|
+
};
|
|
22
|
+
export type IGetStatsShortLinkPublicQuery = {
|
|
23
|
+
startDate?: Date;
|
|
24
|
+
endDate?: Date;
|
|
25
|
+
groupBy?: 'day' | 'week' | 'month';
|
|
26
|
+
};
|
|
27
|
+
export type IGetClicksShortLinkPublicParams = {
|
|
28
|
+
shortLinkId: string;
|
|
29
|
+
};
|
|
30
|
+
export type IGetClicksShortLinkPublicQuery = QueryPaginate;
|
|
31
|
+
export type IRenewShortLinkPublicParams = {
|
|
32
|
+
shortLinkId: string;
|
|
33
|
+
};
|
|
@@ -2,37 +2,19 @@ import { QueryPaginate } from '../type-message/base-paginate';
|
|
|
2
2
|
export type IGetShortLinkParams = {
|
|
3
3
|
shortLinkId: string;
|
|
4
4
|
};
|
|
5
|
-
export type IGetShortLinkBySlugParams = {
|
|
6
|
-
slug: string;
|
|
7
|
-
};
|
|
8
|
-
export type IValidateShortLinkPasswordBody = {
|
|
9
|
-
password: string;
|
|
10
|
-
};
|
|
11
5
|
export type IPaginateShortLinkQuery = {
|
|
12
|
-
title?: string;
|
|
13
|
-
userId?: string;
|
|
14
|
-
projectId?: string;
|
|
15
|
-
isActive?: boolean;
|
|
16
|
-
} & QueryPaginate;
|
|
17
|
-
export type IPaginateUserShortLinkQuery = {
|
|
18
6
|
title?: string;
|
|
19
7
|
isActive?: boolean;
|
|
20
8
|
} & QueryPaginate;
|
|
21
9
|
export type IPaginateProjectShortLinkParams = {
|
|
22
10
|
projectId: string;
|
|
23
11
|
};
|
|
24
|
-
export type IPaginateProjectShortLinkQuery = {
|
|
25
|
-
title?: string;
|
|
26
|
-
isActive?: boolean;
|
|
27
|
-
} & QueryPaginate;
|
|
28
12
|
export type ICreateShortLinkBody = {
|
|
29
13
|
originalUrl: string;
|
|
30
|
-
slug?: string;
|
|
31
14
|
title?: string;
|
|
32
15
|
description?: string;
|
|
33
16
|
expiresAt?: Date;
|
|
34
17
|
maxClicks?: number;
|
|
35
|
-
password?: string;
|
|
36
18
|
};
|
|
37
19
|
export type ICreateForProjectShortLinkParams = {
|
|
38
20
|
projectId: string;
|
|
@@ -42,25 +24,24 @@ export type IUpdateShortLinkParams = {
|
|
|
42
24
|
};
|
|
43
25
|
export type IUpdateShortLinkBody = {
|
|
44
26
|
originalUrl?: string;
|
|
45
|
-
slug?: string;
|
|
46
27
|
title?: string;
|
|
47
28
|
description?: string;
|
|
48
29
|
isActive?: boolean;
|
|
49
30
|
expiresAt?: Date | null;
|
|
50
31
|
maxClicks?: number | null;
|
|
51
|
-
password?: string | null;
|
|
52
32
|
};
|
|
53
33
|
export type IDeleteShortLinkParams = {
|
|
54
34
|
shortLinkId: string;
|
|
55
35
|
};
|
|
56
|
-
export type
|
|
36
|
+
export type IGetStatsShortLinkParams = {
|
|
57
37
|
shortLinkId: string;
|
|
58
38
|
};
|
|
59
|
-
export type
|
|
60
|
-
startDate?:
|
|
61
|
-
endDate?:
|
|
39
|
+
export type IGetStatsShortLinkQuery = {
|
|
40
|
+
startDate?: Date;
|
|
41
|
+
endDate?: Date;
|
|
62
42
|
groupBy?: 'day' | 'week' | 'month';
|
|
63
43
|
};
|
|
64
|
-
export type
|
|
65
|
-
|
|
44
|
+
export type IGetClicksShortLinkParams = {
|
|
45
|
+
shortLinkId: string;
|
|
66
46
|
};
|
|
47
|
+
export type IGetClicksShortLinkQuery = QueryPaginate;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BasePaginate, IResponse } from '..';
|
|
2
2
|
import { IShortLink } from '../../models/short-link.model';
|
|
3
|
+
import { IShortLinkClick } from '../../models/short-link-click.model';
|
|
3
4
|
export type IPaginateShortLinkAdminResponse = IResponse<BasePaginate<IShortLink>>;
|
|
4
5
|
export interface IGetShortLinkAdminData {
|
|
5
6
|
shortLink: IShortLink;
|
|
@@ -12,3 +13,4 @@ export interface IUpdateShortLinkAdminData {
|
|
|
12
13
|
shortLink: IShortLink;
|
|
13
14
|
}
|
|
14
15
|
export type IUpdateShortLinkAdminResponse = IResponse<IUpdateShortLinkAdminData>;
|
|
16
|
+
export type IGetClicksShortLinkAdminResponse = IResponse<BasePaginate<IShortLinkClick>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BasePaginate, IResponse } from '..';
|
|
2
|
+
import { IShortLink, IShortLinkWithStats } from '../../models/short-link.model';
|
|
3
|
+
import { IShortLinkClick } from '../../models/short-link-click.model';
|
|
4
|
+
export interface ICreateShortLinkPublicData {
|
|
5
|
+
shortLink: IShortLink;
|
|
6
|
+
}
|
|
7
|
+
export type ICreateShortLinkPublicResponse = IResponse<ICreateShortLinkPublicData>;
|
|
8
|
+
export interface IRedirectShortLinkPublicData {
|
|
9
|
+
url: string;
|
|
10
|
+
}
|
|
11
|
+
export type IRedirectShortLinkPublicResponse = IResponse<IRedirectShortLinkPublicData>;
|
|
12
|
+
export interface IGetStatsShortLinkPublicData {
|
|
13
|
+
shortLink: IShortLinkWithStats;
|
|
14
|
+
}
|
|
15
|
+
export type IGetStatsShortLinkPublicResponse = IResponse<IGetStatsShortLinkPublicData>;
|
|
16
|
+
export interface IRenewShortLinkPublicData {
|
|
17
|
+
shortLink: IShortLink;
|
|
18
|
+
}
|
|
19
|
+
export type IRenewShortLinkPublicResponse = IResponse<IRenewShortLinkPublicData>;
|
|
20
|
+
export type IGetClicksShortLinkPublicResponse = IResponse<BasePaginate<IShortLinkClick>>;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { BasePaginate, IResponse } from '..';
|
|
2
2
|
import { IShortLink, IShortLinkWithStats } from '../../models/short-link.model';
|
|
3
|
+
import { IShortLinkClick } from '../../models/short-link-click.model';
|
|
3
4
|
export interface IGetShortLinkData {
|
|
4
5
|
shortLink: IShortLink;
|
|
5
6
|
}
|
|
6
7
|
export type IGetShortLinkResponse = IResponse<IGetShortLinkData>;
|
|
7
|
-
export interface IGetShortLinkBySlugData {
|
|
8
|
-
shortLink: IShortLink;
|
|
9
|
-
requiresPassword: boolean;
|
|
10
|
-
}
|
|
11
|
-
export type IGetShortLinkBySlugResponse = IResponse<IGetShortLinkBySlugData>;
|
|
12
|
-
export interface IValidateShortLinkPasswordData {
|
|
13
|
-
valid: boolean;
|
|
14
|
-
}
|
|
15
|
-
export type IValidateShortLinkPasswordResponse = IResponse<IValidateShortLinkPasswordData>;
|
|
16
8
|
export type IPaginateShortLinkResponse = IResponse<BasePaginate<IShortLink>>;
|
|
17
9
|
export interface ICreateShortLinkData {
|
|
18
10
|
shortLink: IShortLink;
|
|
@@ -25,11 +17,8 @@ export type IUpdateShortLinkResponse = IResponse<IUpdateShortLinkData>;
|
|
|
25
17
|
export interface IDeleteShortLinkData {
|
|
26
18
|
}
|
|
27
19
|
export type IDeleteShortLinkResponse = IResponse<IDeleteShortLinkData>;
|
|
28
|
-
export interface
|
|
20
|
+
export interface IGetStatsShortLinkData {
|
|
29
21
|
shortLink: IShortLinkWithStats;
|
|
30
22
|
}
|
|
31
|
-
export type
|
|
32
|
-
export
|
|
33
|
-
url: string;
|
|
34
|
-
}
|
|
35
|
-
export type IRedirectShortLinkResponse = IResponse<IRedirectShortLinkData>;
|
|
23
|
+
export type IGetStatsShortLinkResponse = IResponse<IGetStatsShortLinkData>;
|
|
24
|
+
export type IGetClicksShortLinkResponse = IResponse<BasePaginate<IShortLinkClick>>;
|
|
@@ -6,11 +6,23 @@ export interface IShortLinkClick {
|
|
|
6
6
|
ipHash: string;
|
|
7
7
|
userAgent: string | null;
|
|
8
8
|
referer: string | null;
|
|
9
|
-
|
|
9
|
+
refererDomain: string | null;
|
|
10
|
+
countryCodeIso: string | null;
|
|
11
|
+
countryCode: string | null;
|
|
12
|
+
countryName: string | null;
|
|
13
|
+
continentCode: string | null;
|
|
10
14
|
city: string | null;
|
|
11
15
|
device: string | null;
|
|
12
16
|
browser: string | null;
|
|
13
17
|
os: string | null;
|
|
18
|
+
language: string | null;
|
|
19
|
+
utmSource: string | null;
|
|
20
|
+
utmMedium: string | null;
|
|
21
|
+
utmCampaign: string | null;
|
|
22
|
+
utmTerm: string | null;
|
|
23
|
+
utmContent: string | null;
|
|
24
|
+
isBotLikely: boolean;
|
|
25
|
+
isReturningVisitor: boolean;
|
|
14
26
|
clickedAt: Date;
|
|
15
27
|
createdAt?: Date;
|
|
16
28
|
updatedAt?: Date;
|
|
@@ -33,6 +33,7 @@ export interface IShortLinkWithStats extends IShortLink {
|
|
|
33
33
|
clicksByCountry: {
|
|
34
34
|
country: string;
|
|
35
35
|
clicks: number;
|
|
36
|
+
countryName: string;
|
|
36
37
|
}[];
|
|
37
38
|
clicksByDevice: {
|
|
38
39
|
device: string;
|
|
@@ -46,5 +47,20 @@ export interface IShortLinkWithStats extends IShortLink {
|
|
|
46
47
|
referer: string;
|
|
47
48
|
clicks: number;
|
|
48
49
|
}[];
|
|
50
|
+
clicksByUtmSource: {
|
|
51
|
+
utmSource: string;
|
|
52
|
+
clicks: number;
|
|
53
|
+
}[];
|
|
54
|
+
clicksByLanguage: {
|
|
55
|
+
language: string;
|
|
56
|
+
clicks: number;
|
|
57
|
+
}[];
|
|
58
|
+
clicksByRefererDomain: {
|
|
59
|
+
refererDomain: string;
|
|
60
|
+
clicks: number;
|
|
61
|
+
}[];
|
|
62
|
+
clicksLast24h: number;
|
|
63
|
+
returningVisitorsCount: number;
|
|
64
|
+
botClicksCount: number;
|
|
49
65
|
};
|
|
50
66
|
}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -30,3 +30,6 @@ __exportStar(require("./file.utils"), exports);
|
|
|
30
30
|
__exportStar(require("./compression.utils"), exports);
|
|
31
31
|
__exportStar(require("./shape.utils"), exports);
|
|
32
32
|
__exportStar(require("./icons.utils"), exports);
|
|
33
|
+
__exportStar(require("./string.utils"), exports);
|
|
34
|
+
__exportStar(require("./tracking.utils"), exports);
|
|
35
|
+
__exportStar(require("./duration.utils"), exports);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseUserAgent = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
function parseUserAgent(userAgent) {
|
|
6
|
+
if (!userAgent) {
|
|
7
|
+
return {
|
|
8
|
+
device: types_1.UserAgentDevice.UNKNOWN,
|
|
9
|
+
browser: types_1.UserAgentBrowser.UNKNOWN,
|
|
10
|
+
os: types_1.UserAgentOS.UNKNOWN,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const ua = userAgent.toLowerCase();
|
|
14
|
+
let device = types_1.UserAgentDevice.DESKTOP;
|
|
15
|
+
if (/(mobile|android|iphone|ipad|ipod)/i.test(ua)) {
|
|
16
|
+
device = types_1.UserAgentDevice.MOBILE;
|
|
17
|
+
}
|
|
18
|
+
else if (/(tablet|ipad)/i.test(ua)) {
|
|
19
|
+
device = types_1.UserAgentDevice.TABLET;
|
|
20
|
+
}
|
|
21
|
+
let browser = types_1.UserAgentBrowser.UNKNOWN;
|
|
22
|
+
if (ua.includes('chrome'))
|
|
23
|
+
browser = types_1.UserAgentBrowser.CHROME;
|
|
24
|
+
else if (ua.includes('firefox'))
|
|
25
|
+
browser = types_1.UserAgentBrowser.FIREFOX;
|
|
26
|
+
else if (ua.includes('safari'))
|
|
27
|
+
browser = types_1.UserAgentBrowser.SAFARI;
|
|
28
|
+
else if (ua.includes('edge'))
|
|
29
|
+
browser = types_1.UserAgentBrowser.EDGE;
|
|
30
|
+
else if (ua.includes('opera'))
|
|
31
|
+
browser = types_1.UserAgentBrowser.OPERA;
|
|
32
|
+
let os = types_1.UserAgentOS.UNKNOWN;
|
|
33
|
+
if (ua.includes('windows'))
|
|
34
|
+
os = types_1.UserAgentOS.WINDOWS;
|
|
35
|
+
else if (ua.includes('mac'))
|
|
36
|
+
os = types_1.UserAgentOS.MACOS;
|
|
37
|
+
else if (ua.includes('linux'))
|
|
38
|
+
os = types_1.UserAgentOS.LINUX;
|
|
39
|
+
else if (ua.includes('android'))
|
|
40
|
+
os = types_1.UserAgentOS.ANDROID;
|
|
41
|
+
else if (ua.includes('ios') || ua.includes('iphone') || ua.includes('ipad'))
|
|
42
|
+
os = types_1.UserAgentOS.IOS;
|
|
43
|
+
return { device, browser, os };
|
|
44
|
+
}
|
|
45
|
+
exports.parseUserAgent = parseUserAgent;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const extractDomain: (url: string | null | undefined) => string | null;
|
|
2
|
+
export declare const detectBot: (userAgent: string | null | undefined) => boolean;
|
|
3
|
+
export declare const extractUTMParams: (searchParams: URLSearchParams | string) => {
|
|
4
|
+
utmSource?: string;
|
|
5
|
+
utmMedium?: string;
|
|
6
|
+
utmCampaign?: string;
|
|
7
|
+
utmTerm?: string;
|
|
8
|
+
utmContent?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const isLocalhost: (ipAddress: string | undefined) => boolean;
|
|
11
|
+
export declare const normalizeLanguage: (language: string | null | undefined) => string | null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeLanguage = exports.isLocalhost = exports.extractUTMParams = exports.detectBot = exports.extractDomain = void 0;
|
|
4
|
+
const extractDomain = (url) => {
|
|
5
|
+
if (!url)
|
|
6
|
+
return null;
|
|
7
|
+
try {
|
|
8
|
+
const urlObj = new URL(url);
|
|
9
|
+
return urlObj.hostname;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.extractDomain = extractDomain;
|
|
16
|
+
const detectBot = (userAgent) => {
|
|
17
|
+
if (!userAgent)
|
|
18
|
+
return false;
|
|
19
|
+
const botPatterns = [
|
|
20
|
+
/bot/i,
|
|
21
|
+
/crawl/i,
|
|
22
|
+
/spider/i,
|
|
23
|
+
/curl/i,
|
|
24
|
+
/wget/i,
|
|
25
|
+
/python/i,
|
|
26
|
+
/java/i,
|
|
27
|
+
/http/i,
|
|
28
|
+
/scan/i,
|
|
29
|
+
/check/i,
|
|
30
|
+
/monitor/i,
|
|
31
|
+
/headless/i,
|
|
32
|
+
/phantom/i,
|
|
33
|
+
/selenium/i,
|
|
34
|
+
];
|
|
35
|
+
return botPatterns.some((pattern) => pattern.test(userAgent));
|
|
36
|
+
};
|
|
37
|
+
exports.detectBot = detectBot;
|
|
38
|
+
const extractUTMParams = (searchParams) => {
|
|
39
|
+
const params = typeof searchParams === 'string' ? new URLSearchParams(searchParams) : searchParams;
|
|
40
|
+
return {
|
|
41
|
+
utmSource: params.get('utm_source') || undefined,
|
|
42
|
+
utmMedium: params.get('utm_medium') || undefined,
|
|
43
|
+
utmCampaign: params.get('utm_campaign') || undefined,
|
|
44
|
+
utmTerm: params.get('utm_term') || undefined,
|
|
45
|
+
utmContent: params.get('utm_content') || undefined,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.extractUTMParams = extractUTMParams;
|
|
49
|
+
const isLocalhost = (ipAddress) => {
|
|
50
|
+
if (!ipAddress)
|
|
51
|
+
return true;
|
|
52
|
+
return ipAddress === '127.0.0.1' || ipAddress === '::1' || ipAddress.startsWith('192.168.');
|
|
53
|
+
};
|
|
54
|
+
exports.isLocalhost = isLocalhost;
|
|
55
|
+
const normalizeLanguage = (language) => {
|
|
56
|
+
if (!language)
|
|
57
|
+
return null;
|
|
58
|
+
return language.split('-')[0].toLowerCase();
|
|
59
|
+
};
|
|
60
|
+
exports.normalizeLanguage = normalizeLanguage;
|