@empiricalrun/playwright-utils 0.48.0 → 0.48.2
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/CHANGELOG.md +12 -0
- package/dist/inbox-client.d.ts.map +1 -1
- package/dist/inbox-client.js +8 -5
- package/dist/webhook.js +7 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.48.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e61a717: fix: email parsing should use text and html both
|
|
8
|
+
|
|
9
|
+
## 0.48.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 376c2db: feat: prettier webhook urls
|
|
14
|
+
|
|
3
15
|
## 0.48.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-client.d.ts","sourceRoot":"","sources":["../src/inbox-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAmBF,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,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AAU,CAAC;YASR,cAAc;IAoD5B,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,YAAY;CAcrB"}
|
package/dist/inbox-client.js
CHANGED
|
@@ -88,12 +88,15 @@ class InboxClient {
|
|
|
88
88
|
}
|
|
89
89
|
extractCodes(html, text) {
|
|
90
90
|
const codes = [];
|
|
91
|
-
const content = text || html || "";
|
|
92
91
|
const codeRegex = /\b(\d{4,8})\b/g;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
for (const content of [text, html]) {
|
|
93
|
+
if (!content)
|
|
94
|
+
continue;
|
|
95
|
+
let match;
|
|
96
|
+
while ((match = codeRegex.exec(content)) !== null) {
|
|
97
|
+
if (!codes.includes(match[1])) {
|
|
98
|
+
codes.push(match[1]);
|
|
99
|
+
}
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
return codes;
|
package/dist/webhook.js
CHANGED
|
@@ -106,7 +106,7 @@ async function webhookSiteQuery(token, content) {
|
|
|
106
106
|
return webhookSiteQueryDirect(token, content);
|
|
107
107
|
}
|
|
108
108
|
// ── inbox provider ──
|
|
109
|
-
const INBOX_WORKER_URL = "https://inbox.empirical
|
|
109
|
+
const INBOX_WORKER_URL = "https://inbox.empirical.run";
|
|
110
110
|
function inboxRowToWebhookRequest(row) {
|
|
111
111
|
let headers = {};
|
|
112
112
|
try {
|
|
@@ -147,12 +147,12 @@ async function inboxGetUrl() {
|
|
|
147
147
|
});
|
|
148
148
|
const result = await apiClient.request("/api/inbox/proxy", {
|
|
149
149
|
method: "POST",
|
|
150
|
-
body: { method: "POST", path: "/api/
|
|
150
|
+
body: { method: "POST", path: "/api/hooks/token" },
|
|
151
151
|
});
|
|
152
152
|
const tokenData = result.data;
|
|
153
|
-
return `${INBOX_WORKER_URL}/
|
|
153
|
+
return `${INBOX_WORKER_URL}/hooks/${tokenData.uuid}`;
|
|
154
154
|
}
|
|
155
|
-
const response = await fetch(`${INBOX_WORKER_URL}/api/
|
|
155
|
+
const response = await fetch(`${INBOX_WORKER_URL}/api/hooks/token`, {
|
|
156
156
|
method: "POST",
|
|
157
157
|
});
|
|
158
158
|
if (!response.ok) {
|
|
@@ -160,7 +160,7 @@ async function inboxGetUrl() {
|
|
|
160
160
|
throw new Error(`inbox webhook error [${response.status} ${response.statusText}]: ${body}`);
|
|
161
161
|
}
|
|
162
162
|
const { uuid } = await response.json();
|
|
163
|
-
return `${INBOX_WORKER_URL}/
|
|
163
|
+
return `${INBOX_WORKER_URL}/hooks/${uuid}`;
|
|
164
164
|
}
|
|
165
165
|
async function inboxQuery(token, content) {
|
|
166
166
|
const terms = Array.isArray(content) ? content : [content];
|
|
@@ -180,7 +180,7 @@ async function inboxQuery(token, content) {
|
|
|
180
180
|
method: "POST",
|
|
181
181
|
body: {
|
|
182
182
|
method: "GET",
|
|
183
|
-
path: `/api/
|
|
183
|
+
path: `/api/hooks?${params.toString()}`,
|
|
184
184
|
},
|
|
185
185
|
});
|
|
186
186
|
const response = result.data;
|
|
@@ -189,7 +189,7 @@ async function inboxQuery(token, content) {
|
|
|
189
189
|
}
|
|
190
190
|
return response.data.map(inboxRowToWebhookRequest);
|
|
191
191
|
}
|
|
192
|
-
const rawResponse = await fetch(`${INBOX_WORKER_URL}/api/
|
|
192
|
+
const rawResponse = await fetch(`${INBOX_WORKER_URL}/api/hooks?${params.toString()}`);
|
|
193
193
|
if (!rawResponse.ok) {
|
|
194
194
|
const body = await rawResponse.text().catch(() => "");
|
|
195
195
|
throw new Error(`inbox webhook error [${rawResponse.status} ${rawResponse.statusText}]: ${body}`);
|