@xapp/stentor-service-boberdoo 1.80.3 → 1.80.4
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/lib/BoberdooIntegration.d.ts +20 -4
- package/lib/BoberdooIntegration.js +79 -36
- package/lib/BoberdooIntegration.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +75 -25
- package/package.json +5 -3
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import { CrmResponse, ExternalLead } from "stentor-models";
|
|
2
2
|
import { BoberdooExtras, BoberdooLeadPayload, BoberdooResponse, BoberdooServiceProps } from "./models";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Posting endpoint for PCM Growth's LeadPortal/Boberdoo install. Exported
|
|
5
|
+
* so callers can opt in explicitly via `BoberdooServiceProps.apiEndpoint`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PCM_GROWTH_LEADPORTAL_ENDPOINT = "https://pcmgrowth.leadportal.com/apiJSON.php";
|
|
8
|
+
/**
|
|
9
|
+
* BoberdooIntegration posts leads to a LeadPortal/Boberdoo lead distribution
|
|
10
|
+
* platform using the `pingPostLead` action in full mode.
|
|
5
11
|
*
|
|
6
|
-
* @see https://
|
|
12
|
+
* @see https://pcmgrowth.leadportal.com/new_api/index.php?action=detail&func=pingPostLead&TYPE=33
|
|
7
13
|
*/
|
|
8
14
|
export declare class BoberdooIntegration {
|
|
9
15
|
private props;
|
|
10
16
|
private apiEndpoint;
|
|
11
17
|
constructor(props: BoberdooServiceProps);
|
|
12
18
|
/**
|
|
13
|
-
* Posts a lead to
|
|
19
|
+
* Posts a lead to the partner.
|
|
20
|
+
*
|
|
21
|
+
* Returns a `CrmResponse`:
|
|
22
|
+
* - `status: "Success"` covers both `Matched` (lead created and sold)
|
|
23
|
+
* and `Unmatched` (lead created, no buyer). The raw partner status
|
|
24
|
+
* is surfaced in `message` so callers can distinguish the two.
|
|
25
|
+
* - `refId` is populated with the partner's `lead_id` when present.
|
|
26
|
+
* - `status: "Failure"` indicates a rejected post (partner returned
|
|
27
|
+
* `Error`, network failure, or unparseable body). `message` carries
|
|
28
|
+
* the partner's error string when available.
|
|
14
29
|
*
|
|
15
30
|
* @param externalLead - The lead data from the contact capture handler
|
|
16
31
|
* @param extras - Optional extra fields including TrustedForm cert URL and UTM params
|
|
17
32
|
*/
|
|
18
33
|
send(externalLead: ExternalLead, extras?: BoberdooExtras): Promise<CrmResponse>;
|
|
19
34
|
/**
|
|
20
|
-
* Posts the lead payload to
|
|
35
|
+
* Posts the lead payload to the partner. Wraps the payload in a
|
|
36
|
+
* `{ Request: ... }` envelope as required by the JSON endpoint.
|
|
21
37
|
*/
|
|
22
38
|
protected post(payload: BoberdooLeadPayload): Promise<BoberdooResponse>;
|
|
23
39
|
}
|
|
@@ -12,23 +12,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BoberdooIntegration = void 0;
|
|
15
|
+
exports.BoberdooIntegration = exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = void 0;
|
|
16
16
|
/*! Copyright (c) 2026, XAPP AI */
|
|
17
17
|
const stentor_logger_1 = require("stentor-logger");
|
|
18
18
|
const axios_1 = __importDefault(require("axios"));
|
|
19
|
-
const DEFAULT_API_ENDPOINT = "https://www.boberdoo.com/index.php";
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
20
|
+
* Posting endpoint for PCM Growth's LeadPortal/Boberdoo install. Exported
|
|
21
|
+
* so callers can opt in explicitly via `BoberdooServiceProps.apiEndpoint`.
|
|
22
|
+
*/
|
|
23
|
+
exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = "https://pcmgrowth.leadportal.com/apiJSON.php";
|
|
24
|
+
// Partner-provided zip that routes the lead to a test partner so test
|
|
25
|
+
// posts come back Matched without billing a real buyer.
|
|
26
|
+
const TEST_ZIP = "99999";
|
|
27
|
+
/**
|
|
28
|
+
* BoberdooIntegration posts leads to a LeadPortal/Boberdoo lead distribution
|
|
29
|
+
* platform using the `pingPostLead` action in full mode.
|
|
22
30
|
*
|
|
23
|
-
* @see https://
|
|
31
|
+
* @see https://pcmgrowth.leadportal.com/new_api/index.php?action=detail&func=pingPostLead&TYPE=33
|
|
24
32
|
*/
|
|
25
33
|
class BoberdooIntegration {
|
|
26
34
|
constructor(props) {
|
|
27
35
|
this.props = props;
|
|
28
|
-
this.apiEndpoint = props.apiEndpoint
|
|
36
|
+
this.apiEndpoint = props.apiEndpoint;
|
|
29
37
|
}
|
|
30
38
|
/**
|
|
31
|
-
* Posts a lead to
|
|
39
|
+
* Posts a lead to the partner.
|
|
40
|
+
*
|
|
41
|
+
* Returns a `CrmResponse`:
|
|
42
|
+
* - `status: "Success"` covers both `Matched` (lead created and sold)
|
|
43
|
+
* and `Unmatched` (lead created, no buyer). The raw partner status
|
|
44
|
+
* is surfaced in `message` so callers can distinguish the two.
|
|
45
|
+
* - `refId` is populated with the partner's `lead_id` when present.
|
|
46
|
+
* - `status: "Failure"` indicates a rejected post (partner returned
|
|
47
|
+
* `Error`, network failure, or unparseable body). `message` carries
|
|
48
|
+
* the partner's error string when available.
|
|
32
49
|
*
|
|
33
50
|
* @param externalLead - The lead data from the contact capture handler
|
|
34
51
|
* @param extras - Optional extra fields including TrustedForm cert URL and UTM params
|
|
@@ -58,36 +75,59 @@ class BoberdooIntegration {
|
|
|
58
75
|
resolvedLastName = parts.slice(1).join(" ") || undefined;
|
|
59
76
|
}
|
|
60
77
|
const payload = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
78
|
+
Format: "JSON",
|
|
79
|
+
Key: this.props.apiKey,
|
|
80
|
+
API_Action: "pingPostLead",
|
|
81
|
+
Mode: "full",
|
|
82
|
+
TYPE: this.props.leadType,
|
|
83
|
+
SRC: this.props.src,
|
|
84
|
+
Landing_Page: this.props.landingPage
|
|
64
85
|
};
|
|
65
|
-
if (this.props.testMode) {
|
|
66
|
-
payload.lp_test = "test";
|
|
67
|
-
}
|
|
68
86
|
if (resolvedFirstName)
|
|
69
|
-
payload.
|
|
87
|
+
payload.First_Name = resolvedFirstName;
|
|
70
88
|
if (resolvedLastName)
|
|
71
|
-
payload.
|
|
89
|
+
payload.Last_Name = resolvedLastName;
|
|
72
90
|
if (phone)
|
|
73
|
-
payload.
|
|
91
|
+
payload.Primary_Phone = phone;
|
|
74
92
|
if (email)
|
|
75
|
-
payload.
|
|
93
|
+
payload.Email = email;
|
|
76
94
|
if (address)
|
|
77
|
-
payload.
|
|
95
|
+
payload.Address = address;
|
|
78
96
|
if (city)
|
|
79
|
-
payload.
|
|
97
|
+
payload.City = city;
|
|
80
98
|
if (state)
|
|
81
|
-
payload.
|
|
99
|
+
payload.State = state;
|
|
82
100
|
if (zip)
|
|
83
|
-
payload.
|
|
84
|
-
// Include TrustedForm cert URL if present — Boberdoo has native TrustedForm support
|
|
101
|
+
payload.Zip = zip;
|
|
85
102
|
if (extras === null || extras === void 0 ? void 0 : extras.xxTrustedFormCertUrl) {
|
|
86
|
-
payload.
|
|
103
|
+
payload.Trusted_Form_URL = extras.xxTrustedFormCertUrl;
|
|
104
|
+
}
|
|
105
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_source)
|
|
106
|
+
payload.utm_source = extras.utm_source;
|
|
107
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_campaign)
|
|
108
|
+
payload.utm_campaign = extras.utm_campaign;
|
|
109
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_medium)
|
|
110
|
+
payload.utm_medium = extras.utm_medium;
|
|
111
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_content)
|
|
112
|
+
payload.utm_content = extras.utm_content;
|
|
113
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_term)
|
|
114
|
+
payload.utm_term = extras.utm_term;
|
|
115
|
+
if (this.props.testMode) {
|
|
116
|
+
payload.Test_Lead = "1";
|
|
117
|
+
// Support directive: in test mode override the zip to TEST_ZIP
|
|
118
|
+
// so the lead is guaranteed to route to the partner's test
|
|
119
|
+
// buyer and come back Matched.
|
|
120
|
+
payload.Zip = TEST_ZIP;
|
|
87
121
|
}
|
|
88
122
|
const boberdooResponse = yield this.post(payload);
|
|
89
123
|
if (boberdooResponse.status === "Success") {
|
|
90
124
|
crmResponse.status = "Success";
|
|
125
|
+
if (boberdooResponse.rawStatus) {
|
|
126
|
+
crmResponse.message = boberdooResponse.rawStatus;
|
|
127
|
+
}
|
|
128
|
+
if (boberdooResponse.leadId) {
|
|
129
|
+
crmResponse.refId = boberdooResponse.leadId;
|
|
130
|
+
}
|
|
91
131
|
}
|
|
92
132
|
else {
|
|
93
133
|
crmResponse.message = boberdooResponse.error || "Boberdoo returned a failure response";
|
|
@@ -101,37 +141,40 @@ class BoberdooIntegration {
|
|
|
101
141
|
});
|
|
102
142
|
}
|
|
103
143
|
/**
|
|
104
|
-
* Posts the lead payload to
|
|
144
|
+
* Posts the lead payload to the partner. Wraps the payload in a
|
|
145
|
+
* `{ Request: ... }` envelope as required by the JSON endpoint.
|
|
105
146
|
*/
|
|
106
147
|
post(payload) {
|
|
107
148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
149
|
const boberdooResponse = {
|
|
109
150
|
status: "Failure"
|
|
110
151
|
};
|
|
111
|
-
const body = new URLSearchParams();
|
|
112
|
-
for (const [key, value] of Object.entries(payload)) {
|
|
113
|
-
if (value !== undefined) {
|
|
114
|
-
body.append(key, value);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
152
|
const config = {
|
|
118
153
|
method: "post",
|
|
119
154
|
url: this.apiEndpoint,
|
|
120
|
-
params: { type: "post" },
|
|
121
155
|
headers: {
|
|
122
|
-
"Content-Type": "application/
|
|
156
|
+
"Content-Type": "application/json"
|
|
123
157
|
},
|
|
124
|
-
data:
|
|
158
|
+
data: { Request: payload }
|
|
125
159
|
};
|
|
126
160
|
try {
|
|
127
161
|
const response = yield (0, axios_1.default)(config);
|
|
128
|
-
const
|
|
129
|
-
|
|
162
|
+
const body = response.data;
|
|
163
|
+
const inner = body === null || body === void 0 ? void 0 : body.response;
|
|
164
|
+
const rawStatus = inner === null || inner === void 0 ? void 0 : inner.status;
|
|
165
|
+
boberdooResponse.data = response.data;
|
|
166
|
+
if (rawStatus === "Matched" || rawStatus === "Unmatched") {
|
|
130
167
|
boberdooResponse.status = "Success";
|
|
131
|
-
boberdooResponse.
|
|
168
|
+
boberdooResponse.rawStatus = rawStatus;
|
|
169
|
+
boberdooResponse.leadId = inner === null || inner === void 0 ? void 0 : inner.lead_id;
|
|
170
|
+
boberdooResponse.price = inner === null || inner === void 0 ? void 0 : inner.price;
|
|
171
|
+
}
|
|
172
|
+
else if (rawStatus === "Error") {
|
|
173
|
+
boberdooResponse.rawStatus = "Error";
|
|
174
|
+
boberdooResponse.error = (inner === null || inner === void 0 ? void 0 : inner.error) || "Boberdoo returned Error status";
|
|
132
175
|
}
|
|
133
176
|
else {
|
|
134
|
-
boberdooResponse.error = (
|
|
177
|
+
boberdooResponse.error = (inner === null || inner === void 0 ? void 0 : inner.error) || `Unexpected response from Boberdoo: ${JSON.stringify(response.data)}`;
|
|
135
178
|
}
|
|
136
179
|
}
|
|
137
180
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoberdooIntegration.js","sourceRoot":"","sources":["../src/BoberdooIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mDAAqC;AAErC,kDAAkD;AAIlD,MAAM,
|
|
1
|
+
{"version":3,"file":"BoberdooIntegration.js","sourceRoot":"","sources":["../src/BoberdooIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mDAAqC;AAErC,kDAAkD;AAIlD;;;GAGG;AACU,QAA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AC;gBACnH,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC;gBACnD,gBAAgB,CAAC,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC9E,CAAC;YAED,OAAO,gBAAgB,CAAC;QAC5B,CAAC;KAAA;CACJ;AA5JD,kDA4JC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -14,9 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.BoberdooIntegration = void 0;
|
|
17
|
+
exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = exports.BoberdooIntegration = void 0;
|
|
18
18
|
/*! Copyright (c) 2026, XAPP AI */
|
|
19
19
|
var BoberdooIntegration_1 = require("./BoberdooIntegration");
|
|
20
20
|
Object.defineProperty(exports, "BoberdooIntegration", { enumerable: true, get: function () { return BoberdooIntegration_1.BoberdooIntegration; } });
|
|
21
|
+
Object.defineProperty(exports, "PCM_GROWTH_LEADPORTAL_ENDPOINT", { enumerable: true, get: function () { return BoberdooIntegration_1.PCM_GROWTH_LEADPORTAL_ENDPOINT; } });
|
|
21
22
|
__exportStar(require("./models"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,6DAA4F;AAAnF,0HAAA,mBAAmB,OAAA;AAAE,qIAAA,8BAA8B,OAAA;AAC5D,2CAAyB"}
|
package/lib/models.d.ts
CHANGED
|
@@ -1,48 +1,98 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
2
|
export interface BoberdooServiceProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* API key issued by the partner. Sent as `Key` in the request body.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
apiKey: string;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Numeric lead type / vertical ID for the partner (`TYPE` in the request).
|
|
9
|
+
* For PCM Growth Home Improvement this is "33".
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
leadType: string;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* Source identifier assigned by the partner (`SRC`).
|
|
14
|
+
* For our integration this is "Xapp".
|
|
13
15
|
*/
|
|
14
|
-
|
|
16
|
+
src: string;
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
18
|
+
* URL of the page where the lead was captured (`Landing_Page`).
|
|
19
|
+
* Required for post.
|
|
20
|
+
*/
|
|
21
|
+
landingPage: string;
|
|
22
|
+
/**
|
|
23
|
+
* Posting endpoint for the partner's Boberdoo install. Required so
|
|
24
|
+
* each integration must explicitly opt in to the partner it posts
|
|
25
|
+
* to — no shared-package default. For PCM Growth, use the exported
|
|
26
|
+
* `PCM_GROWTH_LEADPORTAL_ENDPOINT` constant.
|
|
27
|
+
*/
|
|
28
|
+
apiEndpoint: string;
|
|
29
|
+
/**
|
|
30
|
+
* When true the integration sends `Test_Lead=1` and forces `Zip=99999`
|
|
31
|
+
* so the partner routes the lead to their test partner instead of
|
|
32
|
+
* billing a real one.
|
|
17
33
|
*/
|
|
18
34
|
testMode?: boolean;
|
|
19
35
|
}
|
|
20
36
|
/**
|
|
21
|
-
* The lead payload sent to
|
|
37
|
+
* The lead payload sent to the partner. Field names are case-sensitive
|
|
38
|
+
* PascalCase per the LeadPortal/Boberdoo spec.
|
|
22
39
|
*/
|
|
23
40
|
export interface BoberdooLeadPayload {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
Format: "JSON";
|
|
42
|
+
Key: string;
|
|
43
|
+
API_Action: "pingPostLead";
|
|
44
|
+
Mode: "full";
|
|
45
|
+
TYPE: string;
|
|
46
|
+
SRC: string;
|
|
47
|
+
Landing_Page: string;
|
|
48
|
+
Test_Lead?: "1";
|
|
49
|
+
First_Name?: string;
|
|
50
|
+
Last_Name?: string;
|
|
51
|
+
Primary_Phone?: string;
|
|
52
|
+
Email?: string;
|
|
53
|
+
Address?: string;
|
|
54
|
+
City?: string;
|
|
55
|
+
State?: string;
|
|
56
|
+
Zip?: string;
|
|
57
|
+
Trusted_Form_URL?: string;
|
|
58
|
+
LeadiD_Token?: string;
|
|
59
|
+
IP_Address?: string;
|
|
60
|
+
User_Agent?: string;
|
|
61
|
+
Unique_Identifier?: string;
|
|
62
|
+
TCPA_Language?: string;
|
|
63
|
+
Sub_ID?: string;
|
|
64
|
+
Pub_ID?: string;
|
|
65
|
+
utm_source?: string;
|
|
66
|
+
utm_campaign?: string;
|
|
67
|
+
utm_medium?: string;
|
|
68
|
+
utm_content?: string;
|
|
69
|
+
utm_term?: string;
|
|
70
|
+
Comments?: string;
|
|
40
71
|
[key: string]: string | undefined;
|
|
41
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Raw response status returned by the partner. In `Mode=full` the API
|
|
75
|
+
* may return Matched (created + sold), Unmatched (created, no buyer),
|
|
76
|
+
* or Error. The spec PDF claims only Success/Error but the live API
|
|
77
|
+
* returns Matched/Unmatched in practice.
|
|
78
|
+
*/
|
|
79
|
+
export type BoberdooResponseStatus = "Matched" | "Unmatched" | "Error";
|
|
42
80
|
export interface BoberdooResponse {
|
|
43
81
|
status: "Success" | "Failure";
|
|
44
82
|
/**
|
|
45
|
-
* The raw
|
|
83
|
+
* The raw status string from the partner.
|
|
84
|
+
*/
|
|
85
|
+
rawStatus?: BoberdooResponseStatus;
|
|
86
|
+
/**
|
|
87
|
+
* Lead ID returned by the partner on Matched/Unmatched responses.
|
|
88
|
+
*/
|
|
89
|
+
leadId?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Price returned on Matched responses when the partner is on dynamic pricing.
|
|
92
|
+
*/
|
|
93
|
+
price?: string;
|
|
94
|
+
/**
|
|
95
|
+
* The raw response body from the partner.
|
|
46
96
|
*/
|
|
47
97
|
data?: Record<string, unknown>;
|
|
48
98
|
error?: string;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.80.
|
|
7
|
+
"version": "1.80.4",
|
|
8
8
|
"description": "Service to integrate with Boberdoo lead distribution",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@xapp/config": "0.3.0",
|
|
21
21
|
"axios-mock-adapter": "2.1.0",
|
|
22
22
|
"chai": "4.5.0",
|
|
23
|
+
"dotenv": "17.4.2",
|
|
23
24
|
"mocha": "11.7.5",
|
|
24
25
|
"sinon": "21.0.0",
|
|
25
26
|
"stentor-logger": "1.72.3",
|
|
@@ -34,10 +35,11 @@
|
|
|
34
35
|
"scripts": {
|
|
35
36
|
"build": "tsc -d true -p .",
|
|
36
37
|
"clean": "rm -rf ./lib/*",
|
|
37
|
-
"test": "mocha --recursive --timeout 9000 -r ts-node/register \"./src/**/__test__/*.test.ts\""
|
|
38
|
+
"test": "mocha --recursive --timeout 9000 -r ts-node/register \"./src/**/__test__/*.test.ts\"",
|
|
39
|
+
"test:f": "mocha --recursive --timeout 30000 -r ts-node/register \"./src/**/*.ftest.ts\""
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
42
|
"axios": "1.16.0"
|
|
41
43
|
},
|
|
42
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f16be6cb5c9682d2ec84867102b8d6071ca08378"
|
|
43
45
|
}
|