@empiricalrun/playwright-utils 0.48.3 → 0.48.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/CHANGELOG.md +6 -0
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +19 -44
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/dist/webhook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,GAAG,cAAc,CAAC;AAyQhD,wBAAsB,aAAa,CACjC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAO,GACnE,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GACzB,OAAO,CAAC,cAAc,EAAE,CAAC,CAO3B"}
|
package/dist/webhook.js
CHANGED
|
@@ -141,26 +141,15 @@ function inboxRowToWebhookRequest(row) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
async function inboxGetUrl() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const result = await apiClient.request("/api/inbox/proxy", {
|
|
149
|
-
method: "POST",
|
|
150
|
-
body: { method: "POST", path: "/api/hooks/token" },
|
|
151
|
-
});
|
|
152
|
-
const tokenData = result.data;
|
|
153
|
-
return `${INBOX_WORKER_URL}/hooks/${tokenData.uuid}`;
|
|
154
|
-
}
|
|
155
|
-
const response = await fetch(`${INBOX_WORKER_URL}/api/hooks/token`, {
|
|
144
|
+
const apiClient = new dashboard_client_1.DashboardAPIClient({
|
|
145
|
+
authType: "project-api-key",
|
|
146
|
+
});
|
|
147
|
+
const result = await apiClient.request("/api/inbox/proxy", {
|
|
156
148
|
method: "POST",
|
|
149
|
+
body: { method: "POST", path: "/api/hooks/token" },
|
|
157
150
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
throw new Error(`inbox webhook error [${response.status} ${response.statusText}]: ${body}`);
|
|
161
|
-
}
|
|
162
|
-
const { uuid } = await response.json();
|
|
163
|
-
return `${INBOX_WORKER_URL}/hooks/${uuid}`;
|
|
151
|
+
const tokenData = result.data;
|
|
152
|
+
return `${INBOX_WORKER_URL}/hooks/${tokenData.uuid}`;
|
|
164
153
|
}
|
|
165
154
|
async function inboxQuery(token, content) {
|
|
166
155
|
const terms = Array.isArray(content) ? content : [content];
|
|
@@ -172,35 +161,21 @@ async function inboxQuery(token, content) {
|
|
|
172
161
|
for (const t of terms) {
|
|
173
162
|
params.append("content", t);
|
|
174
163
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
authType: "project-api-key",
|
|
178
|
-
});
|
|
179
|
-
const result = await apiClient.request("/api/inbox/proxy", {
|
|
180
|
-
method: "POST",
|
|
181
|
-
body: {
|
|
182
|
-
method: "GET",
|
|
183
|
-
path: `/api/hooks?${params.toString()}`,
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
const response = result.data;
|
|
187
|
-
if (!response || !Array.isArray(response.data)) {
|
|
188
|
-
return [];
|
|
189
|
-
}
|
|
190
|
-
return response.data.map(inboxRowToWebhookRequest);
|
|
191
|
-
}
|
|
192
|
-
const rawResponse = await fetch(`${INBOX_WORKER_URL}/api/hooks?${params.toString()}`);
|
|
193
|
-
if (!rawResponse.ok) {
|
|
194
|
-
const body = await rawResponse.text().catch(() => "");
|
|
195
|
-
throw new Error(`inbox webhook error [${rawResponse.status} ${rawResponse.statusText}]: ${body}`);
|
|
196
|
-
}
|
|
197
|
-
const json = await rawResponse.json().catch((e) => {
|
|
198
|
-
throw new Error(`inbox webhook returned invalid JSON: ${String(e)}`);
|
|
164
|
+
const apiClient = new dashboard_client_1.DashboardAPIClient({
|
|
165
|
+
authType: "project-api-key",
|
|
199
166
|
});
|
|
200
|
-
|
|
167
|
+
const result = await apiClient.request("/api/inbox/proxy", {
|
|
168
|
+
method: "POST",
|
|
169
|
+
body: {
|
|
170
|
+
method: "GET",
|
|
171
|
+
path: `/api/hooks?${params.toString()}`,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
const response = result.data;
|
|
175
|
+
if (!response || !Array.isArray(response.data)) {
|
|
201
176
|
return [];
|
|
202
177
|
}
|
|
203
|
-
return
|
|
178
|
+
return response.data.map(inboxRowToWebhookRequest);
|
|
204
179
|
}
|
|
205
180
|
// ── public API ──
|
|
206
181
|
function extractToken(webhookUrl) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
45
|
"ts-morph": "^23.0.0",
|
|
46
|
+
"@empiricalrun/cua": "^0.3.0",
|
|
46
47
|
"@empiricalrun/dashboard-client": "^0.3.0",
|
|
47
|
-
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
48
48
|
"@empiricalrun/llm": "^0.26.0",
|
|
49
|
-
"@empiricalrun/
|
|
50
|
-
"@empiricalrun/
|
|
49
|
+
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
50
|
+
"@empiricalrun/reporter": "^0.28.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"dev": "tsc --build --watch",
|