ad2app-lib 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.
Files changed (140) hide show
  1. package/README.md +37 -0
  2. package/dist/api/apiDriver.d.ts +16 -0
  3. package/dist/api/apiDriver.js +40 -0
  4. package/dist/api/apiUtils.d.ts +0 -0
  5. package/dist/api/apiUtils.js +31 -0
  6. package/dist/api/index.d.ts +2 -0
  7. package/dist/api/index.js +18 -0
  8. package/dist/api/utils.d.ts +7 -0
  9. package/dist/api/utils.js +34 -0
  10. package/dist/types/I_Agency.d.ts +9 -0
  11. package/dist/types/I_Agency.js +12 -0
  12. package/dist/types/I_Campaign.d.ts +76 -0
  13. package/dist/types/I_Campaign.js +176 -0
  14. package/dist/types/I_CampaignCollaborationMethod.d.ts +11 -0
  15. package/dist/types/I_CampaignCollaborationMethod.js +30 -0
  16. package/dist/types/I_CampaignDeadline.d.ts +29 -0
  17. package/dist/types/I_CampaignDeadline.js +80 -0
  18. package/dist/types/I_CampaignGoal.d.ts +11 -0
  19. package/dist/types/I_CampaignGoal.js +30 -0
  20. package/dist/types/I_Influencer.d.ts +37 -0
  21. package/dist/types/I_Influencer.js +87 -0
  22. package/dist/types/I_InfluencersCategories.d.ts +26 -0
  23. package/dist/types/I_InfluencersCategories.js +72 -0
  24. package/dist/types/I_InfluencersLists.d.ts +68 -0
  25. package/dist/types/I_InfluencersLists.js +95 -0
  26. package/dist/types/I_InfluencersProperties.d.ts +40 -0
  27. package/dist/types/I_InfluencersProperties.js +95 -0
  28. package/dist/types/I_Item.d.ts +11 -0
  29. package/dist/types/I_Item.js +17 -0
  30. package/dist/types/I_List.d.ts +8 -0
  31. package/dist/types/I_List.js +11 -0
  32. package/dist/types/I_Offer.d.ts +63 -0
  33. package/dist/types/I_Offer.js +79 -0
  34. package/dist/types/I_PaginatedList.d.ts +10 -0
  35. package/dist/types/I_PaginatedList.js +13 -0
  36. package/dist/types/I_Pagination.d.ts +7 -0
  37. package/dist/types/I_Pagination.js +12 -0
  38. package/dist/types/I_Queue.d.ts +25 -0
  39. package/dist/types/I_Queue.js +54 -0
  40. package/dist/types/I_Report.d.ts +11 -0
  41. package/dist/types/I_Report.js +14 -0
  42. package/dist/types/I_ResponseMessage.d.ts +6 -0
  43. package/dist/types/I_ResponseMessage.js +10 -0
  44. package/dist/types/I_SM_Platform.d.ts +4 -0
  45. package/dist/types/I_SM_Platform.js +8 -0
  46. package/dist/types/I_ScrapperLog.d.ts +15 -0
  47. package/dist/types/I_ScrapperLog.js +9 -0
  48. package/dist/types/I_Scrappers.d.ts +35 -0
  49. package/dist/types/I_Scrappers.js +11 -0
  50. package/dist/types/I_ScrappingAccount.d.ts +10 -0
  51. package/dist/types/I_ScrappingAccount.js +6 -0
  52. package/dist/types/I_ScrappingMachine.d.ts +29 -0
  53. package/dist/types/I_ScrappingMachine.js +46 -0
  54. package/dist/types/I_ScrappingMachineProcess.d.ts +22 -0
  55. package/dist/types/I_ScrappingMachineProcess.js +46 -0
  56. package/dist/types/I_ScrappingServiceMessages.d.ts +31 -0
  57. package/dist/types/I_ScrappingServiceMessages.js +2 -0
  58. package/dist/types/I_TIkTokRaports.d.ts +8 -0
  59. package/dist/types/I_TIkTokRaports.js +38 -0
  60. package/dist/types/I_Tag.d.ts +10 -0
  61. package/dist/types/I_Tag.js +12 -0
  62. package/dist/types/I_TikTokPost.d.ts +45 -0
  63. package/dist/types/I_TikTokPost.js +47 -0
  64. package/dist/types/I_TikTokReport.d.ts +11 -0
  65. package/dist/types/I_TikTokReport.js +14 -0
  66. package/dist/types/I_TikTokUser.d.ts +53 -0
  67. package/dist/types/I_TikTokUser.js +97 -0
  68. package/dist/types/I_User.d.ts +35 -0
  69. package/dist/types/I_User.js +76 -0
  70. package/dist/types/I_UserTikTokStatistic.d.ts +13 -0
  71. package/dist/types/I_UserTikTokStatistic.js +16 -0
  72. package/dist/types/T_FetchStatus.d.ts +1 -0
  73. package/dist/types/T_FetchStatus.js +2 -0
  74. package/dist/types/global.d.ts +9 -0
  75. package/dist/types/global.js +2 -0
  76. package/dist/types/index.d.ts +31 -0
  77. package/dist/types/index.js +47 -0
  78. package/dist/utils/array.d.ts +3 -0
  79. package/dist/utils/array.js +12 -0
  80. package/dist/utils/cookies.d.ts +0 -0
  81. package/dist/utils/cookies.js +13 -0
  82. package/dist/utils/date.d.ts +5 -0
  83. package/dist/utils/date.js +19 -0
  84. package/dist/utils/index.d.ts +6 -0
  85. package/dist/utils/index.js +22 -0
  86. package/dist/utils/promise.d.ts +1 -0
  87. package/dist/utils/promise.js +6 -0
  88. package/dist/utils/string.d.ts +1 -0
  89. package/dist/utils/string.js +5 -0
  90. package/dist/utils/types.d.ts +5 -0
  91. package/dist/utils/types.js +2 -0
  92. package/dist/utils/variable.d.ts +2 -0
  93. package/dist/utils/variable.js +11 -0
  94. package/index.ts +5 -0
  95. package/package.json +41 -0
  96. package/src/api/apiDriver.ts +65 -0
  97. package/src/api/index.ts +2 -0
  98. package/src/api/utils.ts +38 -0
  99. package/src/types/I_Agency.ts +16 -0
  100. package/src/types/I_Campaign.ts +171 -0
  101. package/src/types/I_CampaignCollaborationMethod.ts +20 -0
  102. package/src/types/I_CampaignDeadline.ts +65 -0
  103. package/src/types/I_CampaignGoal.ts +20 -0
  104. package/src/types/I_Influencer.ts +93 -0
  105. package/src/types/I_InfluencersCategories.ts +52 -0
  106. package/src/types/I_InfluencersLists.ts +104 -0
  107. package/src/types/I_InfluencersProperties.ts +83 -0
  108. package/src/types/I_Item.ts +19 -0
  109. package/src/types/I_List.ts +14 -0
  110. package/src/types/I_Offer.ts +105 -0
  111. package/src/types/I_PaginatedList.ts +17 -0
  112. package/src/types/I_Pagination.ts +13 -0
  113. package/src/types/I_Queue.ts +40 -0
  114. package/src/types/I_ResponseMessage.ts +11 -0
  115. package/src/types/I_SM_Platform.ts +4 -0
  116. package/src/types/I_ScrapperLog.ts +17 -0
  117. package/src/types/I_Scrappers.ts +34 -0
  118. package/src/types/I_ScrappingAccount.ts +11 -0
  119. package/src/types/I_ScrappingMachine.ts +47 -0
  120. package/src/types/I_ScrappingMachineProcess.ts +36 -0
  121. package/src/types/I_ScrappingServiceMessages.ts +38 -0
  122. package/src/types/I_TIkTokRaports.ts +20 -0
  123. package/src/types/I_Tag.ts +12 -0
  124. package/src/types/I_TikTokPost.ts +64 -0
  125. package/src/types/I_TikTokReport.ts +20 -0
  126. package/src/types/I_TikTokUser.ts +108 -0
  127. package/src/types/I_User.ts +57 -0
  128. package/src/types/I_UserTikTokStatistic.ts +25 -0
  129. package/src/types/T_FetchStatus.ts +1 -0
  130. package/src/types/global.ts +10 -0
  131. package/src/types/index.ts +31 -0
  132. package/src/utils/array.ts +15 -0
  133. package/src/utils/cookies.ts +16 -0
  134. package/src/utils/date.ts +14 -0
  135. package/src/utils/index.ts +6 -0
  136. package/src/utils/promise.ts +3 -0
  137. package/src/utils/string.ts +1 -0
  138. package/src/utils/types.ts +9 -0
  139. package/src/utils/variable.ts +7 -0
  140. package/tsconfig.json +14 -0
@@ -0,0 +1,104 @@
1
+ import { IsString, IsNotEmpty, IsOptional, IsNumber } from "class-validator";
2
+ import { I_Influencer } from "./I_Influencer";
3
+ import { I_PaginatedList } from "./I_PaginatedList";
4
+ import { I_Pagination } from "./I_Pagination";
5
+
6
+ export class I_InfluencersList {
7
+ name: string;
8
+ id: number;
9
+ influencers: I_PaginatedList<I_Influencer>;
10
+ unassignedInfluencers?: I_PaginatedList<I_Influencer>;
11
+
12
+ constructor(data?: Partial<I_InfluencersList>) {
13
+ this.id = data?.id;
14
+ this.name = data?.name || "";
15
+ this.influencers = data?.influencers || { ...new I_PaginatedList() };
16
+ this.unassignedInfluencers = data?.unassignedInfluencers || {
17
+ ...new I_PaginatedList(),
18
+ };
19
+ }
20
+ }
21
+
22
+ export class I_InfluencersListSearchParams {
23
+ @IsOptional()
24
+ @IsString()
25
+ name: string;
26
+ }
27
+
28
+ export class I_GetInfluencersListDTO {
29
+ @IsString()
30
+ @IsOptional()
31
+ id?: number;
32
+
33
+ @IsString()
34
+ @IsOptional()
35
+ campaignId?: string;
36
+ }
37
+
38
+ export class I_InfluencersListCreateDTO {
39
+ @IsString()
40
+ @IsNotEmpty()
41
+ name: string;
42
+ }
43
+
44
+ export class I_InfluencersListRemoveDTO {
45
+ name: string;
46
+
47
+ @IsNotEmpty()
48
+ id: number;
49
+ }
50
+
51
+ export class I_InfluencersListAssignDTO {
52
+ influencersIds: number[];
53
+ assignedPagination?: I_Pagination;
54
+ unassignedPagination?: I_Pagination;
55
+ listId?: number;
56
+ }
57
+
58
+ export class I_InfluencersListUnassignResult {
59
+ payload: {
60
+ data: {
61
+ influencers: { pagination: I_Pagination };
62
+ };
63
+ };
64
+ }
65
+
66
+ export class I_InfluencersListAssignResult {
67
+ payload: {
68
+ data: {
69
+ influencers: { pagination: I_Pagination };
70
+ };
71
+ };
72
+ }
73
+
74
+ export class I_InfluencersListUnassignDTO {
75
+ influencersIds: string[];
76
+ assignedPagination?: I_Pagination;
77
+ unassignedPagination?: I_Pagination;
78
+ listId?: number;
79
+ }
80
+
81
+ export class I_InfluencersListForCampaign extends I_InfluencersList {
82
+ ad_mean_views: number;
83
+ mean_views: number;
84
+
85
+ constructor(data?: Partial<I_InfluencersListForCampaign>) {
86
+ super(data);
87
+ this.ad_mean_views = data?.ad_mean_views ?? 0;
88
+ this.mean_views = data?.mean_views ?? 0;
89
+ }
90
+ }
91
+
92
+ export class I_InfluencersListForCampaignGenerateDTO {
93
+ ad_mean_views_from?: number;
94
+ ad_mean_views_to?: number;
95
+ influencers?: I_Influencer[];
96
+ }
97
+
98
+ export class I_FindInfluncersUnassignedToList {
99
+ @IsNotEmpty()
100
+ listId: number;
101
+
102
+ @IsString()
103
+ handle: string;
104
+ }
@@ -0,0 +1,83 @@
1
+ import { IsNotEmpty } from "class-validator";
2
+ import { I_Influencer } from "./I_Influencer";
3
+
4
+ export class I_InfluencerProperty {
5
+ propertyKey: I_InfluencerPropertyKey;
6
+ propertyValue: I_InfluencerPropertyValue;
7
+ id: string;
8
+
9
+ constructor(data?: Partial<I_InfluencerProperty>) {
10
+ this.id = data?.id;
11
+ this.propertyKey = data?.propertyKey || null;
12
+ this.propertyValue = data?.propertyValue || null;
13
+ }
14
+ }
15
+
16
+ export class I_InfluencerPropertyKey {
17
+ name: string;
18
+ key: string;
19
+ values: I_InfluencerPropertyValue[];
20
+
21
+ constructor(data?: Partial<I_InfluencerPropertyKey>) {
22
+ this.name = data?.name;
23
+ this.key = data?.key || "";
24
+ this.values = data?.values || [];
25
+ }
26
+ }
27
+
28
+ export class I_InfluencerPropertyValue {
29
+ id: string;
30
+ value: string;
31
+
32
+ constructor(data?: Partial<I_InfluencerPropertyValue>) {
33
+ this.id = data?.id;
34
+ this.value = data?.value || "";
35
+ }
36
+ }
37
+
38
+ export class I_FindInfluencersPropertiesKeysDTO {
39
+ name: string;
40
+ }
41
+
42
+ export class I_GetInfluencersPropertyDTO {
43
+ @IsNotEmpty()
44
+ key: string;
45
+ }
46
+
47
+ export class I_CreateInfluencerPropertyKeyDTO {
48
+ @IsNotEmpty()
49
+ key: string;
50
+
51
+ @IsNotEmpty()
52
+ name: string;
53
+ }
54
+
55
+ export class I_GetInfluencerPropertiesDTO {
56
+ @IsNotEmpty()
57
+ influencerId: string;
58
+ }
59
+
60
+ export class I_CreateInfluencerPropertyValueDTO {
61
+ @IsNotEmpty()
62
+ key: string;
63
+
64
+ @IsNotEmpty()
65
+ value: string;
66
+ }
67
+
68
+ export class I_AssignPropertyToInfluencerDTO {
69
+ @IsNotEmpty()
70
+ influencerId: string;
71
+
72
+ @IsNotEmpty()
73
+ key: string;
74
+
75
+ @IsNotEmpty()
76
+ value: string;
77
+
78
+ constructor(data: Partial<I_AssignPropertyToInfluencerDTO>) {
79
+ this.influencerId = data?.influencerId;
80
+ this.key = data?.key;
81
+ this.value = data?.value;
82
+ }
83
+ }
@@ -0,0 +1,19 @@
1
+ import { I_ResponseMessage } from './I_ResponseMessage';
2
+ import { T_FetchStatus } from './T_FetchStatus';
3
+
4
+ export class I_Item<T> implements I_ResponseMessage {
5
+ data: T;
6
+ status: T_FetchStatus;
7
+ message?: string;
8
+
9
+ constructor(data?: Partial<I_Item<T>>) {
10
+ this.data = data?.data || null;
11
+ this.status = data?.status || 'succeeded';
12
+ this.message = data?.message || '';
13
+ }
14
+ }
15
+
16
+ export const itemIsLoading = (item: I_Item<any>) => item.status === 'loading';
17
+ export const itemIsResolving = (item: I_Item<any>) =>
18
+ item.status === 'initial' || item.status === 'loading';
19
+ export const itemFailed = (item: I_Item<any>) => item.status === 'failed';
@@ -0,0 +1,14 @@
1
+ import { I_ResponseMessage } from './I_ResponseMessage';
2
+ import { T_FetchStatus } from './T_FetchStatus';
3
+
4
+ export class I_List<T> implements I_ResponseMessage {
5
+ items: T[];
6
+ status: T_FetchStatus;
7
+ message?: string;
8
+
9
+ constructor(data?: Partial<I_List<T>>) {
10
+ this.items = data?.items || [];
11
+ this.status = data?.status || 'succeeded';
12
+ this.message = data?.message || '';
13
+ }
14
+ }
@@ -0,0 +1,105 @@
1
+ import { IsOptional } from "class-validator";
2
+ import { I_Agency } from "./I_Agency";
3
+ import { I_Campaign } from "./I_Campaign";
4
+ import { I_Influencer } from "./I_Influencer";
5
+
6
+ export class I_Offer {
7
+ id?: string;
8
+ agency?: I_Agency;
9
+ influencer: I_Influencer;
10
+ price?: number;
11
+ status?: I_OfferStatus;
12
+ action?: OfferActions;
13
+
14
+ constructor(data?: I_Offer) {
15
+ this.agency = data?.agency ?? null;
16
+ this.influencer = data?.influencer ?? null;
17
+ this.id = data?.id ?? null;
18
+ this.price = data?.price ?? null;
19
+ this.status = data?.status ?? null;
20
+ this.action = data?.action ?? null;
21
+ }
22
+ }
23
+
24
+ export type OfferActions =
25
+ | "create"
26
+ | "delete"
27
+ | "confirm"
28
+ | "reject"
29
+ | "negotiate"
30
+ | "accept";
31
+
32
+ export enum I_OfferStatus {
33
+ DRAFT = "draft",
34
+ SENT = "sent",
35
+ DELETED = "deleted",
36
+ ACCEPTED = "accepted",
37
+ REJECTED = "rejected",
38
+ INFLUENCER_NEGOTIATED = "influencerNegotiated",
39
+ AGENCY_NEGOTIATED = "agencyNegotiated",
40
+ CONFIRMED = "confirmed",
41
+ ALTERNATIVE_SUGGESTED = "alternativeSuggested",
42
+ }
43
+
44
+ export declare class I_OfferGetDTO {
45
+ campaignId: string;
46
+ constructor(data?: Partial<I_SendOfferDTO>);
47
+ }
48
+
49
+ export class I_GetOffersDTO {
50
+ @IsOptional()
51
+ campaignId?: string;
52
+
53
+ @IsOptional()
54
+ influencerId?: string;
55
+ }
56
+
57
+ export declare class I_OfferRemoveDTO {
58
+ id: number;
59
+ constructor(data?: Partial<I_SendOfferDTO>);
60
+ }
61
+ export declare class I_OfferEditDTO {
62
+ id: number;
63
+ price: number;
64
+ constructor(data?: Partial<I_SendOfferDTO>);
65
+ }
66
+
67
+ export class I_SendOfferDTO {
68
+ price: number;
69
+ offerId: I_Offer["id"];
70
+ constructor(data?: Partial<I_SendOfferDTO>) {
71
+ this.price = data?.price ?? null;
72
+ this.offerId = data?.offerId ?? null;
73
+ }
74
+ }
75
+
76
+ export class I_CreateDraftOfferDTO {
77
+ influencerId: I_Influencer["id"];
78
+ campaignId: I_Campaign["id"];
79
+
80
+ constructor(data: I_CreateDraftOfferDTO) {
81
+ this.influencerId = data.influencerId;
82
+ this.campaignId = data.campaignId;
83
+ }
84
+ }
85
+
86
+ export class I_RejectOfferDTO {
87
+ offerId: I_Offer["id"];
88
+ constructor(data?: Partial<I_RejectOfferDTO>) {
89
+ this.offerId = data?.offerId ?? null;
90
+ }
91
+ }
92
+
93
+ export class I_AcceptOfferDTO {
94
+ offerId: I_Offer["id"];
95
+ constructor(data?: Partial<I_AcceptOfferDTO>) {
96
+ this.offerId = data?.offerId ?? null;
97
+ }
98
+ }
99
+
100
+ export class I_ConfirmOfferDTO {
101
+ offerId: I_Offer["id"];
102
+ constructor(data?: Partial<I_ConfirmOfferDTO>) {
103
+ this.offerId = data?.offerId ?? null;
104
+ }
105
+ }
@@ -0,0 +1,17 @@
1
+ import { I_Pagination } from './I_Pagination';
2
+ import { I_ResponseMessage } from './I_ResponseMessage';
3
+ import { T_FetchStatus } from './T_FetchStatus';
4
+
5
+ export class I_PaginatedList<T> implements I_ResponseMessage {
6
+ items: T[];
7
+ pagination: I_Pagination;
8
+ status: T_FetchStatus;
9
+ message?: string;
10
+
11
+ constructor(data?: Partial<I_PaginatedList<T>>) {
12
+ this.items = data?.items || [];
13
+ this.pagination = data?.pagination || { ...new I_Pagination() };
14
+ this.status = data?.status || 'succeeded';
15
+ this.message = data?.message || '';
16
+ }
17
+ }
@@ -0,0 +1,13 @@
1
+ export class I_Pagination {
2
+ perPage: number;
3
+ page: number;
4
+ skip: number;
5
+ total: number;
6
+
7
+ constructor(data?: Partial<I_Pagination>) {
8
+ this.perPage = Number(data?.perPage) || 10;
9
+ this.page = Number(data?.page) || 1;
10
+ this.skip = this.page * this.perPage - this.perPage;
11
+ this.total = data?.total || 0;
12
+ }
13
+ }
@@ -0,0 +1,40 @@
1
+ import { IsNotEmpty } from "class-validator";
2
+
3
+ export enum QueueItemTypes {
4
+ TIKTOK_POST,
5
+ TIKTOK_USER,
6
+ }
7
+
8
+ export class I_QueueItem {
9
+ id: string;
10
+ influencer_handle: string;
11
+ priority: number;
12
+ state: number;
13
+ type: QueueItemTypes;
14
+ from: Date;
15
+ to: Date;
16
+ }
17
+
18
+ export class I_UpdateQueueItemPriorityDTO {
19
+ @IsNotEmpty()
20
+ id: string;
21
+
22
+ @IsNotEmpty()
23
+ priority: number;
24
+ }
25
+
26
+ export class I_QueueItemCreateDTO {
27
+ @IsNotEmpty()
28
+ tikTokUserHandle: string;
29
+
30
+ @IsNotEmpty()
31
+ priority: number;
32
+ }
33
+
34
+ export class I_CreateTikTokHashtagQueueItemDTO {
35
+ @IsNotEmpty()
36
+ hashtagId: string;
37
+
38
+ @IsNotEmpty()
39
+ priority: number;
40
+ }
@@ -0,0 +1,11 @@
1
+ import { T_FetchStatus } from './T_FetchStatus';
2
+
3
+ export class I_ResponseMessage {
4
+ status: T_FetchStatus;
5
+ message?: string;
6
+
7
+ constructor(data?: Partial<I_ResponseMessage>) {
8
+ this.status = data?.status || 'initial';
9
+ this.message = data?.message || '';
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ export enum SMPlatform {
2
+ TIKTOK = "tiktok",
3
+ INSTAGRAM = "instagram",
4
+ }
@@ -0,0 +1,17 @@
1
+ import { SMPlatform } from "./I_SM_Platform";
2
+
3
+ export class I_ScrapperLog {
4
+ handle: string;
5
+ platform: SMPlatform;
6
+ postsScrappedQuantity: number;
7
+ postsPlannedToScrapQuantity: number;
8
+ existingPostsFoundQuantity: number;
9
+ from: Date;
10
+ to: Date;
11
+ canScrapFurther: boolean;
12
+ createdAt: Date;
13
+ }
14
+
15
+ export class I_FindScrapperLogsDTO {
16
+ handle: string;
17
+ }
@@ -0,0 +1,34 @@
1
+ import { Timespan } from "./global";
2
+ import { I_ScrappingAccount } from "./I_ScrappingAccount";
3
+ import { I_ScrappingMachine } from "./I_ScrappingMachine";
4
+
5
+ export enum ScrapType {
6
+ TT_USERS,
7
+ TT_POSTS,
8
+ CONFIGURE,
9
+ TT_USERS_LOCAL,
10
+ TT_POSTS_BY_HASHTAG,
11
+ }
12
+
13
+ export type TikTokPostsScrapperArgs = [
14
+ influencer: { handle: string },
15
+ job: {
16
+ queueItemId: string;
17
+ scrappingMachine: I_ScrappingMachine;
18
+ },
19
+ {
20
+ timespan: Timespan;
21
+ scrappingAccounts: I_ScrappingAccount[];
22
+ }
23
+ ];
24
+
25
+ export type TikTokHashtagScrapperArgs = [
26
+ hashtag: { hashtag: string },
27
+ job: {
28
+ queueItemId: string;
29
+ scrappingMachine: I_ScrappingMachine;
30
+ },
31
+ {
32
+ scrappingAccounts: I_ScrappingAccount[];
33
+ }
34
+ ];
@@ -0,0 +1,11 @@
1
+ import { SMPlatform } from "./I_SM_Platform";
2
+
3
+ export class I_ScrappingAccount {
4
+ id: string;
5
+ login: string;
6
+ password: string;
7
+ banned: boolean;
8
+ platform: SMPlatform;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ }
@@ -0,0 +1,47 @@
1
+ import { IsNotEmpty } from "class-validator";
2
+ import { I_ScrappingMachineProcess } from "./I_ScrappingMachineProcess";
3
+ import { getNumberOrUndefined } from "../utils";
4
+
5
+ export enum ScrappingMachineState {
6
+ BUSY = "busy",
7
+ PAUSED = "paused",
8
+ IDLE = "idle",
9
+ }
10
+
11
+ export class I_ScrappingMachine {
12
+ id: string;
13
+ state: ScrappingMachineState;
14
+ tikTokUserLocal: number;
15
+ tikTokPosts: number;
16
+ tikTokUsersFromFollowers: number;
17
+ tikTokPostsByTags: number;
18
+ processes: I_ScrappingMachineProcess[];
19
+ activeJob: string;
20
+ createdAt: Date;
21
+ updatedAt: Date;
22
+ }
23
+
24
+ export class I_ChangeScrappingMachineConfigurationDTO {
25
+ constructor(data: Partial<I_ChangeScrappingMachineConfigurationDTO>) {
26
+ if (!data) return;
27
+ this.scrappingMachine = data.scrappingMachine;
28
+ this.tikTokUserLocal = getNumberOrUndefined(data.tikTokUserLocal);
29
+ this.tikTokPosts = getNumberOrUndefined(data.tikTokPosts);
30
+ this.tikTokUsersFromFollowers = getNumberOrUndefined(
31
+ data.tikTokUsersFromFollowers
32
+ );
33
+ this.tikTokPostsByTags = getNumberOrUndefined(data.tikTokPostsByTags);
34
+ }
35
+
36
+ @IsNotEmpty()
37
+ scrappingMachine: I_ScrappingMachine;
38
+ tikTokUserLocal?: number;
39
+ tikTokPosts?: number;
40
+ tikTokUsersFromFollowers?: number;
41
+ tikTokPostsByTags?: number;
42
+ }
43
+
44
+ export class T_GetScrappingMachineDTO {
45
+ @IsNotEmpty()
46
+ scrappingMachine: I_ScrappingMachine;
47
+ }
@@ -0,0 +1,36 @@
1
+ import { IsNotEmpty } from "class-validator";
2
+ import { ScrapType } from "./I_Scrappers";
3
+ import { I_ScrappingMachine } from "./I_ScrappingMachine";
4
+
5
+ export class I_ScrappingMachineProcess {
6
+ id: string;
7
+ jobId: string;
8
+ processType: ScrapType;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ }
12
+
13
+ export class I_CreateScrappingMachineProcessDTO {
14
+ jobId: string;
15
+
16
+ @IsNotEmpty()
17
+ scrappingMachine: I_ScrappingMachine;
18
+
19
+ processType: number;
20
+ }
21
+
22
+ export class I_DeleteScrappingMachineProcessDTO {
23
+ @IsNotEmpty()
24
+ jobId: string;
25
+
26
+ @IsNotEmpty()
27
+ processType: number;
28
+ }
29
+
30
+ export class I_UpdateScrappingMachineProcessDTO {
31
+ @IsNotEmpty()
32
+ jobId: string;
33
+
34
+ @IsNotEmpty()
35
+ processType: number;
36
+ }
@@ -0,0 +1,38 @@
1
+ import { I_TikTokPost } from "./I_TikTokPost";
2
+ import { I_TikTokUser } from "./I_TikTokUser";
3
+
4
+ export type T_OnStartMessageInput = {
5
+ queueItemId: string;
6
+ };
7
+
8
+ export type T_OnTikTokScrappingFinishMessageInput = {
9
+ queueItemId: string;
10
+ handle: string;
11
+ postsScrappedQuantity: number;
12
+ postsPlannedToScrapQuantity: number;
13
+ existingPostsFoundQuantity: number;
14
+ firstPost: I_TikTokPost;
15
+ lastPost: I_TikTokPost;
16
+ noMorePosts: boolean;
17
+ };
18
+
19
+ export type T_OnTikTokPostsScrappingStartMessageInput = {
20
+ queueItemId: string;
21
+ };
22
+
23
+ export type T_ProcessScrappedTikTokUserMessageInput = {
24
+ tikTokUser: I_TikTokUser;
25
+ };
26
+
27
+ export type T_ProcessScrappedTikTokPostMessageInput = {
28
+ tikTokUser: I_TikTokUser;
29
+ tikTokPost: I_TikTokPost;
30
+ };
31
+
32
+ export type T_ProcessScrappedTikTokPostCommentsMessageInput = {
33
+ tikTokPost: I_TikTokPost;
34
+ };
35
+
36
+ export type T_OnTikTokPostsByHashtagScrappingFinishMessageInput = {
37
+ queueItemId: string;
38
+ };
@@ -0,0 +1,20 @@
1
+ import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
2
+
3
+ export class I_GetPDFTikTokRaportDTO {
4
+ @IsString()
5
+ html: string;
6
+ }
7
+
8
+ export class I_TikTokRaportGetCustomReportDataDTO {
9
+ @IsNotEmpty()
10
+ @IsString()
11
+ category: string;
12
+
13
+ @IsOptional()
14
+ @IsString()
15
+ propertyKey?: string;
16
+
17
+ @IsOptional()
18
+ @IsString()
19
+ propertyValue?: string;
20
+ }
@@ -0,0 +1,12 @@
1
+ export class I_Tag {
2
+ id: string;
3
+ tag: string;
4
+ }
5
+
6
+ export class I_TagSearchDTO {
7
+ tag: string;
8
+ }
9
+
10
+ export class I_GetTagDTO {
11
+ tagId: number;
12
+ }