@bprotsyk/aso-core 1.2.178 → 1.2.180

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.
@@ -0,0 +1,7 @@
1
+ export declare enum ICloudflareDomainStatus {
2
+ PENDING = "pending"
3
+ }
4
+ export declare enum ICloudflareDomainType {
5
+ FULL = "full",
6
+ FLEXIBLE = "flexible"
7
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICloudflareDomainType = exports.ICloudflareDomainStatus = void 0;
4
+ var ICloudflareDomainStatus;
5
+ (function (ICloudflareDomainStatus) {
6
+ ICloudflareDomainStatus["PENDING"] = "pending";
7
+ })(ICloudflareDomainStatus = exports.ICloudflareDomainStatus || (exports.ICloudflareDomainStatus = {}));
8
+ var ICloudflareDomainType;
9
+ (function (ICloudflareDomainType) {
10
+ ICloudflareDomainType["FULL"] = "full";
11
+ ICloudflareDomainType["FLEXIBLE"] = "flexible";
12
+ })(ICloudflareDomainType = exports.ICloudflareDomainType || (exports.ICloudflareDomainType = {}));
@@ -0,0 +1,85 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import { ICloudflareDomainType } from "models/cloudflare-domain";
26
+ import { Schema } from "mongoose";
27
+ export interface IDomain {
28
+ id: string;
29
+ name: string;
30
+ status: DomainStatus;
31
+ paused: boolean;
32
+ type: ICloudflareDomainType;
33
+ nameServers: string[];
34
+ originalNameServers: string[];
35
+ originalRegistrar: string | null;
36
+ originalDNSHost: string;
37
+ createdAt: number;
38
+ modifiedAt: number;
39
+ ip: string;
40
+ subdomain: string | null;
41
+ txtRecords: string;
42
+ target: IDomainTarget;
43
+ }
44
+ export declare enum DomainStatus {
45
+ PENDING = "pending",
46
+ READY = "ready"
47
+ }
48
+ export declare enum IDomainTarget {
49
+ PANEL = "panel",
50
+ KEITARO = "keitaro",
51
+ OTHER = "other"
52
+ }
53
+ export declare const Domain: import("mongoose").Model<{
54
+ nameServers: string[];
55
+ originalNameServers: string[];
56
+ txtRecords: string[];
57
+ name?: string | undefined;
58
+ type?: string | undefined;
59
+ paused?: boolean | undefined;
60
+ status?: string | undefined;
61
+ id?: string | undefined;
62
+ target?: string | undefined;
63
+ originalRegistrar?: string | undefined;
64
+ originalDNSHost?: string | undefined;
65
+ createdAt?: number | undefined;
66
+ modifiedAt?: number | undefined;
67
+ ip?: string | undefined;
68
+ subdomain?: string | undefined;
69
+ }, {}, {}, {}, Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
70
+ nameServers: string[];
71
+ originalNameServers: string[];
72
+ txtRecords: string[];
73
+ name?: string | undefined;
74
+ type?: string | undefined;
75
+ paused?: boolean | undefined;
76
+ status?: string | undefined;
77
+ id?: string | undefined;
78
+ target?: string | undefined;
79
+ originalRegistrar?: string | undefined;
80
+ originalDNSHost?: string | undefined;
81
+ createdAt?: number | undefined;
82
+ modifiedAt?: number | undefined;
83
+ ip?: string | undefined;
84
+ subdomain?: string | undefined;
85
+ }>>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Domain = exports.IDomainTarget = exports.DomainStatus = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ var DomainStatus;
6
+ (function (DomainStatus) {
7
+ DomainStatus["PENDING"] = "pending";
8
+ DomainStatus["READY"] = "ready";
9
+ })(DomainStatus = exports.DomainStatus || (exports.DomainStatus = {}));
10
+ var IDomainTarget;
11
+ (function (IDomainTarget) {
12
+ IDomainTarget["PANEL"] = "panel";
13
+ IDomainTarget["KEITARO"] = "keitaro";
14
+ IDomainTarget["OTHER"] = "other";
15
+ })(IDomainTarget = exports.IDomainTarget || (exports.IDomainTarget = {}));
16
+ const domainSchema = new mongoose_1.Schema({
17
+ id: String,
18
+ name: String,
19
+ status: String,
20
+ paused: Boolean,
21
+ type: String,
22
+ nameServers: [String],
23
+ originalNameServers: [String],
24
+ originalRegistrar: String,
25
+ originalDNSHost: String,
26
+ createdAt: Number,
27
+ modifiedAt: Number,
28
+ ip: String,
29
+ subdomain: String,
30
+ txtRecords: [String],
31
+ target: String
32
+ });
33
+ exports.Domain = (0, mongoose_1.model)('Domain', domainSchema);
@@ -10,7 +10,7 @@ declare function updateCampaign(id: number, payload: Partial<IKeitaroCampaign>):
10
10
  declare function getAllOffers(): Promise<any[]>;
11
11
  declare function getOfferByKeitaroId(id: number): Promise<any>;
12
12
  declare function updateOffer(offer: any): Promise<any>;
13
- declare function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: string, groupId?: number): Promise<void>;
13
+ declare function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: string, campaignGroupId?: number, groupId?: number): Promise<void>;
14
14
  declare function createCampaign(campaignData: Partial<IKeitaroCampaign>): Promise<IKeitaroCampaign>;
15
15
  declare function getCampaignById(id: number): Promise<IKeitaroCampaign>;
16
16
  export declare function upsertStreamToCampaign(campaign: IKeitaroCampaign, stream: Partial<IKeitaroStream>): Promise<void>;
@@ -109,7 +109,7 @@ function createStreamPartialPayload(keitaroOfferId, offerName, offerId, offerGeo
109
109
  }],
110
110
  };
111
111
  }
112
- async function addOfferToKeitaro(offer, affiliateId, link, groupId) {
112
+ async function addOfferToKeitaro(offer, affiliateId, link, campaignGroupId, groupId) {
113
113
  // TODO look if offer already exists by offer.name
114
114
  let allOffers = await getAllOffers();
115
115
  let identicalOffer = allOffers.find((o) => { return o.name.includes(offer.name); });
@@ -133,7 +133,7 @@ async function addOfferToKeitaro(offer, affiliateId, link, groupId) {
133
133
  keitaroOfferId = keitaroOffer.id;
134
134
  }
135
135
  let streamPartialPayload = createStreamPartialPayload(keitaroOfferId, offer.caption, offer.name, offer.geo);
136
- await createStreamForMatchingCampaigns(streamPartialPayload, offer.name, /^(FA #|A #)/);
136
+ await createStreamForMatchingCampaigns(streamPartialPayload, offer.name, /^(FA #|A #)/, campaignGroupId);
137
137
  }
138
138
  async function createCampaign(campaignData) {
139
139
  let { data: campaign } = await http_1.default.post(`/campaigns`, campaignData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.178",
3
+ "version": "1.2.180",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,23 @@
1
+ interface ICloudflareDomain {
2
+ id: string;
3
+ name: string;
4
+ status: string;
5
+ paused: boolean;
6
+ type: string;
7
+ development_mode: number;
8
+ name_servers: string[];
9
+ original_name_servers: string[];
10
+ original_registrar: string | null;
11
+ original_dnshost: string | null;
12
+ modified_on: Date;
13
+ created_on: Date;
14
+ }
15
+
16
+ export enum ICloudflareDomainStatus {
17
+ PENDING = "pending"
18
+ }
19
+
20
+ export enum ICloudflareDomainType {
21
+ FULL = "full",
22
+ FLEXIBLE = "flexible"
23
+ }
@@ -0,0 +1,52 @@
1
+ import { ICloudflareDomainType } from "models/cloudflare-domain"
2
+ import { Schema, model } from "mongoose"
3
+
4
+ export interface IDomain {
5
+ id: string
6
+ name: string
7
+ status: DomainStatus
8
+ paused: boolean
9
+ type: ICloudflareDomainType
10
+ nameServers: string[]
11
+ originalNameServers: string[]
12
+ originalRegistrar: string | null
13
+ originalDNSHost: string
14
+ createdAt: number
15
+ modifiedAt: number
16
+
17
+ ip: string
18
+ subdomain: string | null
19
+ txtRecords: string
20
+ target: IDomainTarget
21
+ }
22
+
23
+ export enum DomainStatus {
24
+ PENDING = "pending",
25
+ READY = "ready"
26
+ }
27
+
28
+ export enum IDomainTarget {
29
+ PANEL = "panel",
30
+ KEITARO = "keitaro",
31
+ OTHER = "other"
32
+ }
33
+
34
+ const domainSchema = new Schema({
35
+ id: String,
36
+ name: String,
37
+ status: String,
38
+ paused: Boolean,
39
+ type: String,
40
+ nameServers: [String],
41
+ originalNameServers: [String],
42
+ originalRegistrar: String,
43
+ originalDNSHost: String,
44
+ createdAt: Number,
45
+ modifiedAt: Number,
46
+ ip: String,
47
+ subdomain: String,
48
+ txtRecords: [String],
49
+ target: String
50
+ });
51
+
52
+ export const Domain = model('Domain', domainSchema);
@@ -130,7 +130,7 @@ function createStreamPartialPayload(keitaroOfferId: number, offerName: string, o
130
130
  }
131
131
  }
132
132
 
133
- async function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: string, groupId?: number) {
133
+ async function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: string,campaignGroupId?: number, groupId?: number) {
134
134
  // TODO look if offer already exists by offer.name
135
135
  let allOffers = await getAllOffers()
136
136
  let identicalOffer = allOffers.find((o) => { return o.name.includes(offer.name) })
@@ -158,7 +158,7 @@ async function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: strin
158
158
 
159
159
  let streamPartialPayload = createStreamPartialPayload(keitaroOfferId, offer.caption, offer.name, offer.geo)
160
160
 
161
- await createStreamForMatchingCampaigns(streamPartialPayload, offer.name, /^(FA #|A #)/)
161
+ await createStreamForMatchingCampaigns(streamPartialPayload, offer.name, /^(FA #|A #)/, campaignGroupId)
162
162
  }
163
163
 
164
164
  async function createCampaign(campaignData: Partial<IKeitaroCampaign>): Promise<IKeitaroCampaign> {