nothing-browser 0.1.1 → 0.1.3
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/dist/client/index.js +24 -6
- package/dist/piggy/client/index.d.ts +3 -11
- package/dist/piggy/client/index.d.ts.map +1 -1
- package/dist/piggy/expose/index.d.ts +6 -0
- package/dist/piggy/expose/index.d.ts.map +1 -0
- package/dist/piggy/register/index.d.ts.map +1 -1
- package/dist/piggy/tabs/index.d.ts +3 -1
- package/dist/piggy/tabs/index.d.ts.map +1 -1
- package/dist/piggy.d.ts.map +1 -1
- package/dist/piggy.js +640 -501
- package/dist/register/index.js +429 -36
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- package/piggy/client/index.ts +48 -126
- package/piggy/expose/index.ts +42 -0
- package/piggy/register/index.ts +115 -40
- package/piggy/tabs/index.ts +2 -1
- package/piggy.ts +79 -11
- package/piggy/cache/memory.d.ts +0 -7
- package/piggy/cache/memory.d.ts.map +0 -1
- package/piggy/captcha/index.d.ts +0 -35
- package/piggy/client/index.d.ts +0 -79
- package/piggy/client/index.d.ts.map +0 -1
- package/piggy/dialog/index.d.ts +0 -29
- package/piggy/human/index.d.ts +0 -7
- package/piggy/human/index.d.ts.map +0 -1
- package/piggy/register/index.d.ts +0 -7
- package/piggy/register/index.d.ts.map +0 -1
- package/piggy/server/index.d.ts +0 -58
- package/piggy/server/index.d.ts.map +0 -1
package/dist/register/index.js
CHANGED
|
@@ -6824,6 +6824,9 @@ class HumanClient {
|
|
|
6824
6824
|
return this.client.send("human.click", { ...opts, tabId });
|
|
6825
6825
|
}
|
|
6826
6826
|
}
|
|
6827
|
+
function createHumanAPI(client) {
|
|
6828
|
+
return new HumanClient(client);
|
|
6829
|
+
}
|
|
6827
6830
|
|
|
6828
6831
|
// piggy/logger/index.ts
|
|
6829
6832
|
var import_ernest_logger = __toESM(require_ernest_logger(), 1);
|
|
@@ -21797,7 +21800,7 @@ function finalize(ctx, schema) {
|
|
|
21797
21800
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
21798
21801
|
} else if (ctx.target === "draft-04") {
|
|
21799
21802
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
21800
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
21803
|
+
} else if (ctx.target === "openapi-3.0") {}
|
|
21801
21804
|
if (ctx.external?.uri) {
|
|
21802
21805
|
const id = ctx.external.registry.get(schema)?.id;
|
|
21803
21806
|
if (!id)
|
|
@@ -22887,6 +22890,336 @@ async function storeRecord(storeName, data) {
|
|
|
22887
22890
|
return { stored, skipped };
|
|
22888
22891
|
}
|
|
22889
22892
|
|
|
22893
|
+
// piggy/find/index.ts
|
|
22894
|
+
class FindClient {
|
|
22895
|
+
client;
|
|
22896
|
+
constructor(client) {
|
|
22897
|
+
this.client = client;
|
|
22898
|
+
}
|
|
22899
|
+
css(selector, tabId = "default") {
|
|
22900
|
+
return this.client.send("find.css", { selector, tabId });
|
|
22901
|
+
}
|
|
22902
|
+
all(selector, tabId = "default") {
|
|
22903
|
+
return this.client.send("find.all", { selector, tabId });
|
|
22904
|
+
}
|
|
22905
|
+
first(selector, tabId = "default") {
|
|
22906
|
+
return this.client.send("find.first", { selector, tabId });
|
|
22907
|
+
}
|
|
22908
|
+
byText(text, tabId = "default") {
|
|
22909
|
+
return this.client.send("find.byText", { text, tabId });
|
|
22910
|
+
}
|
|
22911
|
+
byAttr(attr, value, tabId = "default") {
|
|
22912
|
+
return this.client.send("find.byAttr", { attr, value, tabId });
|
|
22913
|
+
}
|
|
22914
|
+
byTag(tag, tabId = "default") {
|
|
22915
|
+
return this.client.send("find.byTag", { tag, tabId });
|
|
22916
|
+
}
|
|
22917
|
+
byPlaceholder(text, tabId = "default") {
|
|
22918
|
+
return this.client.send("find.byPlaceholder", { text, tabId });
|
|
22919
|
+
}
|
|
22920
|
+
byRole(role, name, tabId = "default") {
|
|
22921
|
+
return this.client.send("find.byRole", { role, name, tabId });
|
|
22922
|
+
}
|
|
22923
|
+
children(selector, tabId = "default") {
|
|
22924
|
+
return this.client.send("find.children", { selector, tabId });
|
|
22925
|
+
}
|
|
22926
|
+
parent(selector, tabId = "default") {
|
|
22927
|
+
return this.client.send("find.parent", { selector, tabId });
|
|
22928
|
+
}
|
|
22929
|
+
closest(selector, ancestor, tabId = "default") {
|
|
22930
|
+
return this.client.send("find.closest", { selector, ancestor, tabId });
|
|
22931
|
+
}
|
|
22932
|
+
count(selector, tabId = "default") {
|
|
22933
|
+
return this.client.send("find.count", { selector, tabId });
|
|
22934
|
+
}
|
|
22935
|
+
exists(selector, tabId = "default") {
|
|
22936
|
+
return this.client.send("find.exists", { selector, tabId });
|
|
22937
|
+
}
|
|
22938
|
+
visible(selector, tabId = "default") {
|
|
22939
|
+
return this.client.send("find.visible", { selector, tabId });
|
|
22940
|
+
}
|
|
22941
|
+
enabled(selector, tabId = "default") {
|
|
22942
|
+
return this.client.send("find.enabled", { selector, tabId });
|
|
22943
|
+
}
|
|
22944
|
+
checked(selector, tabId = "default") {
|
|
22945
|
+
return this.client.send("find.checked", { selector, tabId });
|
|
22946
|
+
}
|
|
22947
|
+
}
|
|
22948
|
+
function createFindAPI(client) {
|
|
22949
|
+
return new FindClient(client);
|
|
22950
|
+
}
|
|
22951
|
+
|
|
22952
|
+
// piggy/provide/index.ts
|
|
22953
|
+
class ProvideClient {
|
|
22954
|
+
client;
|
|
22955
|
+
constructor(client) {
|
|
22956
|
+
this.client = client;
|
|
22957
|
+
}
|
|
22958
|
+
text(opts, tabId = "default") {
|
|
22959
|
+
return this.client.send("provide.text", { ...opts, tabId });
|
|
22960
|
+
}
|
|
22961
|
+
textAll(opts, tabId = "default") {
|
|
22962
|
+
return this.client.send("provide.textAll", { ...opts, tabId });
|
|
22963
|
+
}
|
|
22964
|
+
attr(opts, tabId = "default") {
|
|
22965
|
+
return this.client.send("provide.attr", { ...opts, tabId });
|
|
22966
|
+
}
|
|
22967
|
+
attrAll(opts, tabId = "default") {
|
|
22968
|
+
return this.client.send("provide.attrAll", { ...opts, tabId });
|
|
22969
|
+
}
|
|
22970
|
+
html(opts, tabId = "default") {
|
|
22971
|
+
return this.client.send("provide.html", { ...opts, tabId });
|
|
22972
|
+
}
|
|
22973
|
+
table(opts, tabId = "default") {
|
|
22974
|
+
return this.client.send("provide.table", { ...opts, tabId });
|
|
22975
|
+
}
|
|
22976
|
+
list(opts, tabId = "default") {
|
|
22977
|
+
return this.client.send("provide.list", { ...opts, tabId });
|
|
22978
|
+
}
|
|
22979
|
+
links(opts, tabId = "default") {
|
|
22980
|
+
return this.client.send("provide.links", { ...opts, tabId });
|
|
22981
|
+
}
|
|
22982
|
+
images(opts, tabId = "default") {
|
|
22983
|
+
return this.client.send("provide.images", { ...opts, tabId });
|
|
22984
|
+
}
|
|
22985
|
+
form(opts, tabId = "default") {
|
|
22986
|
+
return this.client.send("provide.form", { ...opts, tabId });
|
|
22987
|
+
}
|
|
22988
|
+
page(tabId = "default") {
|
|
22989
|
+
return this.client.send("provide.page", { tabId });
|
|
22990
|
+
}
|
|
22991
|
+
div(opts, tabId = "default") {
|
|
22992
|
+
return this.client.send("provide.div", { ...opts, tabId });
|
|
22993
|
+
}
|
|
22994
|
+
meta(tabId = "default") {
|
|
22995
|
+
return this.client.send("provide.meta", { tabId });
|
|
22996
|
+
}
|
|
22997
|
+
select(opts, tabId = "default") {
|
|
22998
|
+
return this.client.send("provide.select", { ...opts, tabId });
|
|
22999
|
+
}
|
|
23000
|
+
json(opts, tabId = "default") {
|
|
23001
|
+
return this.client.send("provide.json", { ...opts, tabId });
|
|
23002
|
+
}
|
|
23003
|
+
}
|
|
23004
|
+
function createProvideAPI(client) {
|
|
23005
|
+
return new ProvideClient(client);
|
|
23006
|
+
}
|
|
23007
|
+
|
|
23008
|
+
// piggy/session/index.ts
|
|
23009
|
+
class SessionClient {
|
|
23010
|
+
client;
|
|
23011
|
+
constructor(client) {
|
|
23012
|
+
this.client = client;
|
|
23013
|
+
}
|
|
23014
|
+
reload(tabId = "default") {
|
|
23015
|
+
return this.client.send("session.reload", { tabId });
|
|
23016
|
+
}
|
|
23017
|
+
paths() {
|
|
23018
|
+
return this.client.send("session.paths", {});
|
|
23019
|
+
}
|
|
23020
|
+
cookiesPath() {
|
|
23021
|
+
return this.client.send("session.cookies.path", {});
|
|
23022
|
+
}
|
|
23023
|
+
profilePath() {
|
|
23024
|
+
return this.client.send("session.profile.path", {});
|
|
23025
|
+
}
|
|
23026
|
+
wsPath() {
|
|
23027
|
+
return this.client.send("session.ws.path", {});
|
|
23028
|
+
}
|
|
23029
|
+
pingsPath() {
|
|
23030
|
+
return this.client.send("session.pings.path", {});
|
|
23031
|
+
}
|
|
23032
|
+
setWsSave(enabled) {
|
|
23033
|
+
return this.client.send("session.ws.save", { enabled });
|
|
23034
|
+
}
|
|
23035
|
+
setPingsSave(enabled) {
|
|
23036
|
+
return this.client.send("session.pings.save", { enabled });
|
|
23037
|
+
}
|
|
23038
|
+
async export(tabId = "default") {
|
|
23039
|
+
const raw = await this.client.send("session.export", { tabId });
|
|
23040
|
+
return typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
23041
|
+
}
|
|
23042
|
+
import(data, tabId = "default") {
|
|
23043
|
+
return this.client.send("session.import", {
|
|
23044
|
+
data: JSON.stringify(data),
|
|
23045
|
+
tabId
|
|
23046
|
+
});
|
|
23047
|
+
}
|
|
23048
|
+
setCookie(opts, tabId = "default") {
|
|
23049
|
+
return this.client.send("cookie.set", { ...opts, tabId });
|
|
23050
|
+
}
|
|
23051
|
+
deleteCookie(opts, tabId = "default") {
|
|
23052
|
+
return this.client.send("cookie.delete", { ...opts, tabId });
|
|
23053
|
+
}
|
|
23054
|
+
}
|
|
23055
|
+
function createSessionAPI(client) {
|
|
23056
|
+
return new SessionClient(client);
|
|
23057
|
+
}
|
|
23058
|
+
|
|
23059
|
+
// piggy/dialog/index.ts
|
|
23060
|
+
class DialogClient {
|
|
23061
|
+
client;
|
|
23062
|
+
constructor(client) {
|
|
23063
|
+
this.client = client;
|
|
23064
|
+
}
|
|
23065
|
+
accept(tabId = "default", text) {
|
|
23066
|
+
return this.client.send("dialog.accept", { tabId, ...text !== undefined ? { text } : {} });
|
|
23067
|
+
}
|
|
23068
|
+
dismiss(tabId = "default") {
|
|
23069
|
+
return this.client.send("dialog.dismiss", { tabId });
|
|
23070
|
+
}
|
|
23071
|
+
status(tabId = "default") {
|
|
23072
|
+
return this.client.send("dialog.status", { tabId });
|
|
23073
|
+
}
|
|
23074
|
+
setAutoAction(tabId = "default", action) {
|
|
23075
|
+
return this.client.send("dialog.onDialog", { tabId, action });
|
|
23076
|
+
}
|
|
23077
|
+
upload(selector, filePath, tabId = "default") {
|
|
23078
|
+
return this.client.send("upload", { selector, path: filePath, tabId });
|
|
23079
|
+
}
|
|
23080
|
+
onDialog(tabId, handler) {
|
|
23081
|
+
return this.client.onEvent("dialog", tabId, handler);
|
|
23082
|
+
}
|
|
23083
|
+
waitAndAccept(tabId = "default", text, timeoutMs = 30000) {
|
|
23084
|
+
return new Promise((resolve2, reject) => {
|
|
23085
|
+
const timer = setTimeout(() => {
|
|
23086
|
+
unsub();
|
|
23087
|
+
reject(new Error(`dialog.waitAndAccept: timed out after ${timeoutMs}ms`));
|
|
23088
|
+
}, timeoutMs);
|
|
23089
|
+
const unsub = this.onDialog(tabId, async (data) => {
|
|
23090
|
+
clearTimeout(timer);
|
|
23091
|
+
unsub();
|
|
23092
|
+
await this.accept(tabId, text);
|
|
23093
|
+
resolve2(data);
|
|
23094
|
+
});
|
|
23095
|
+
});
|
|
23096
|
+
}
|
|
23097
|
+
waitAndDismiss(tabId = "default", timeoutMs = 30000) {
|
|
23098
|
+
return new Promise((resolve2, reject) => {
|
|
23099
|
+
const timer = setTimeout(() => {
|
|
23100
|
+
unsub();
|
|
23101
|
+
reject(new Error(`dialog.waitAndDismiss: timed out after ${timeoutMs}ms`));
|
|
23102
|
+
}, timeoutMs);
|
|
23103
|
+
const unsub = this.onDialog(tabId, async (data) => {
|
|
23104
|
+
clearTimeout(timer);
|
|
23105
|
+
unsub();
|
|
23106
|
+
await this.dismiss(tabId);
|
|
23107
|
+
resolve2(data);
|
|
23108
|
+
});
|
|
23109
|
+
});
|
|
23110
|
+
}
|
|
23111
|
+
}
|
|
23112
|
+
|
|
23113
|
+
// piggy/iframe/index.ts
|
|
23114
|
+
class IframeClient {
|
|
23115
|
+
client;
|
|
23116
|
+
constructor(client) {
|
|
23117
|
+
this.client = client;
|
|
23118
|
+
}
|
|
23119
|
+
list(tabId = "default") {
|
|
23120
|
+
return this.client.send("iframe.list", { tabId });
|
|
23121
|
+
}
|
|
23122
|
+
evaluate(opts, tabId = "default") {
|
|
23123
|
+
return this.client.send("iframe.evaluate", { ...opts, tabId });
|
|
23124
|
+
}
|
|
23125
|
+
click(opts, tabId = "default") {
|
|
23126
|
+
return this.client.send("iframe.click", { ...opts, tabId });
|
|
23127
|
+
}
|
|
23128
|
+
type(opts, tabId = "default") {
|
|
23129
|
+
return this.client.send("iframe.type", { ...opts, tabId });
|
|
23130
|
+
}
|
|
23131
|
+
text(opts, tabId = "default") {
|
|
23132
|
+
return this.client.send("iframe.text", { ...opts, tabId });
|
|
23133
|
+
}
|
|
23134
|
+
html(opts, tabId = "default") {
|
|
23135
|
+
return this.client.send("iframe.html", { ...opts, tabId });
|
|
23136
|
+
}
|
|
23137
|
+
waitSel(opts, tabId = "default") {
|
|
23138
|
+
return this.client.send("iframe.waitSel", { ...opts, tabId });
|
|
23139
|
+
}
|
|
23140
|
+
}
|
|
23141
|
+
function createIframeAPI(client) {
|
|
23142
|
+
return new IframeClient(client);
|
|
23143
|
+
}
|
|
23144
|
+
|
|
23145
|
+
// piggy/expose/index.ts
|
|
23146
|
+
async function exposeFunction(client, fnName, handler, tabId) {
|
|
23147
|
+
await client.exposeFunction(fnName, handler, tabId);
|
|
23148
|
+
logger_default.success(`[${tabId}] exposed function: ${fnName}`);
|
|
23149
|
+
}
|
|
23150
|
+
async function unexposeFunction(client, fnName, tabId) {
|
|
23151
|
+
await client.unexposeFunction(fnName, tabId);
|
|
23152
|
+
logger_default.info(`[${tabId}] unexposed function: ${fnName}`);
|
|
23153
|
+
}
|
|
23154
|
+
async function clearExposedFunctions(client, tabId) {
|
|
23155
|
+
await client.clearExposedFunctions(tabId);
|
|
23156
|
+
logger_default.info(`[${tabId}] cleared all exposed functions`);
|
|
23157
|
+
}
|
|
23158
|
+
async function exposeAndInject(client, fnName, handler, injectionJs, tabId) {
|
|
23159
|
+
await client.exposeFunction(fnName, handler, tabId);
|
|
23160
|
+
const js = typeof injectionJs === "function" ? injectionJs(fnName) : injectionJs;
|
|
23161
|
+
await client.evaluate(js, tabId);
|
|
23162
|
+
logger_default.success(`[${tabId}] exposed and injected: ${fnName}`);
|
|
23163
|
+
}
|
|
23164
|
+
|
|
23165
|
+
// piggy/captcha/index.ts
|
|
23166
|
+
class CaptchaClient {
|
|
23167
|
+
client;
|
|
23168
|
+
constructor(client) {
|
|
23169
|
+
this.client = client;
|
|
23170
|
+
}
|
|
23171
|
+
status(tabId = "default") {
|
|
23172
|
+
return this.client.send("captcha.status", { tabId });
|
|
23173
|
+
}
|
|
23174
|
+
resolve(tabId = "default") {
|
|
23175
|
+
return this.client.send("captcha.resolve", { tabId });
|
|
23176
|
+
}
|
|
23177
|
+
pause(tabId = "default") {
|
|
23178
|
+
return this.client.send("captcha.pause", { tabId });
|
|
23179
|
+
}
|
|
23180
|
+
check(tabId = "default") {
|
|
23181
|
+
return this.client.send("captcha.check", { tabId });
|
|
23182
|
+
}
|
|
23183
|
+
setAutoRetry(enabled) {
|
|
23184
|
+
return this.client.send("captcha.autoRetry", { enabled });
|
|
23185
|
+
}
|
|
23186
|
+
blockStatus(tabId = "default") {
|
|
23187
|
+
return this.client.send("block.status", { tabId });
|
|
23188
|
+
}
|
|
23189
|
+
blockRetry(tabId = "default") {
|
|
23190
|
+
return this.client.send("block.retry", { tabId });
|
|
23191
|
+
}
|
|
23192
|
+
onCaptcha(tabId, handler) {
|
|
23193
|
+
return this.client.onEvent("captcha", tabId, handler);
|
|
23194
|
+
}
|
|
23195
|
+
onCaptchaResolved(tabId, handler) {
|
|
23196
|
+
return this.client.onEvent("captcha:resolved", tabId, handler);
|
|
23197
|
+
}
|
|
23198
|
+
onBlocked(tabId, handler) {
|
|
23199
|
+
return this.client.onEvent("blocked", tabId, handler);
|
|
23200
|
+
}
|
|
23201
|
+
onBlockRetry(tabId, handler) {
|
|
23202
|
+
return this.client.onEvent("block:retry", tabId, handler);
|
|
23203
|
+
}
|
|
23204
|
+
waitForResolution(tabId = "default", timeoutMs = 300000) {
|
|
23205
|
+
return new Promise((resolve2, reject) => {
|
|
23206
|
+
const timer = setTimeout(() => {
|
|
23207
|
+
unsub();
|
|
23208
|
+
reject(new Error(`captcha.waitForResolution: timed out after ${timeoutMs}ms`));
|
|
23209
|
+
}, timeoutMs);
|
|
23210
|
+
const unsub = this.onCaptchaResolved(tabId, () => {
|
|
23211
|
+
clearTimeout(timer);
|
|
23212
|
+
unsub();
|
|
23213
|
+
resolve2();
|
|
23214
|
+
});
|
|
23215
|
+
logger_default.warn(`[captcha] waiting for manual resolution on tab ${tabId}…`);
|
|
23216
|
+
});
|
|
23217
|
+
}
|
|
23218
|
+
}
|
|
23219
|
+
function createCaptchaAPI(client) {
|
|
23220
|
+
return new CaptchaClient(client);
|
|
23221
|
+
}
|
|
23222
|
+
|
|
22890
23223
|
// piggy/register/index.ts
|
|
22891
23224
|
var globalClient = null;
|
|
22892
23225
|
var humanMode = false;
|
|
@@ -22977,6 +23310,10 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
|
|
|
22977
23310
|
logger_default.debug(`[${name}] waitForSelector: ${selector}`);
|
|
22978
23311
|
return client.waitForSelector(selector, timeout, t2);
|
|
22979
23312
|
}),
|
|
23313
|
+
exposeFunction: (fnName, handler) => exposeFunction(client, fnName, handler, tabId).then(() => site),
|
|
23314
|
+
unexposeFunction: (fnName) => unexposeFunction(client, fnName, tabId).then(() => site),
|
|
23315
|
+
clearExposedFunctions: () => clearExposedFunctions(client, tabId).then(() => site),
|
|
23316
|
+
exposeAndInject: (fnName, handler, injectionJs) => exposeAndInject(client, fnName, handler, injectionJs, tabId).then(() => site),
|
|
22980
23317
|
waitForVisible: (selector, timeout = 30000) => withTab((t2) => client.waitForSelector(selector, timeout, t2)),
|
|
22981
23318
|
waitForResponse: (pattern, timeout = 30000) => withTab((t2) => client.waitForResponse(pattern, timeout, t2)),
|
|
22982
23319
|
addInitScript: async (js) => {
|
|
@@ -23086,6 +23423,68 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
|
|
|
23086
23423
|
css: (query) => withTab((t2) => client.searchCss(query, t2)),
|
|
23087
23424
|
id: (query) => withTab((t2) => client.searchId(query, t2))
|
|
23088
23425
|
},
|
|
23426
|
+
captcha: {
|
|
23427
|
+
status: () => withTab((t2) => createCaptchaAPI(client).status(t2)),
|
|
23428
|
+
resolve: () => withTab((t2) => createCaptchaAPI(client).resolve(t2)),
|
|
23429
|
+
pause: () => withTab((t2) => createCaptchaAPI(client).pause(t2)),
|
|
23430
|
+
check: () => withTab((t2) => createCaptchaAPI(client).check(t2)),
|
|
23431
|
+
autoRetry: (opts) => withTab((t2) => createCaptchaAPI(client).setAutoRetry(opts.enabled)),
|
|
23432
|
+
onCaptcha: (handler) => createCaptchaAPI(client).onCaptcha(tabId, handler),
|
|
23433
|
+
onResolved: (handler) => createCaptchaAPI(client).onCaptchaResolved(tabId, handler)
|
|
23434
|
+
},
|
|
23435
|
+
block: {
|
|
23436
|
+
status: () => withTab((t2) => createCaptchaAPI(client).blockStatus(t2)),
|
|
23437
|
+
retry: () => withTab((t2) => createCaptchaAPI(client).blockRetry(t2)),
|
|
23438
|
+
onBlocked: (handler) => createCaptchaAPI(client).onBlocked(tabId, handler),
|
|
23439
|
+
onRetry: (handler) => createCaptchaAPI(client).onBlockRetry(tabId, handler)
|
|
23440
|
+
},
|
|
23441
|
+
find: {
|
|
23442
|
+
css: (selector) => withTab((t2) => {
|
|
23443
|
+
console.log("[DEBUG] find.css tabId:", t2);
|
|
23444
|
+
return createFindAPI(client).css(selector, t2);
|
|
23445
|
+
}),
|
|
23446
|
+
all: (selector) => withTab((t2) => createFindAPI(client).all(selector, t2)),
|
|
23447
|
+
first: (selector) => withTab((t2) => createFindAPI(client).first(selector, t2)),
|
|
23448
|
+
byText: (text) => withTab((t2) => createFindAPI(client).byText(text, t2)),
|
|
23449
|
+
byAttr: (attr, value) => withTab((t2) => createFindAPI(client).byAttr(attr, value, t2)),
|
|
23450
|
+
byTag: (tag) => withTab((t2) => createFindAPI(client).byTag(tag, t2)),
|
|
23451
|
+
byPlaceholder: (text) => withTab((t2) => createFindAPI(client).byPlaceholder(text, t2)),
|
|
23452
|
+
byRole: (role, name2) => withTab((t2) => createFindAPI(client).byRole(role, name2, t2)),
|
|
23453
|
+
children: (selector) => withTab((t2) => createFindAPI(client).children(selector, t2)),
|
|
23454
|
+
parent: (selector) => withTab((t2) => createFindAPI(client).parent(selector, t2)),
|
|
23455
|
+
closest: (selector, ancestor) => withTab((t2) => createFindAPI(client).closest(selector, ancestor, t2)),
|
|
23456
|
+
count: (selector) => withTab((t2) => createFindAPI(client).count(selector, t2)),
|
|
23457
|
+
exists: (selector) => withTab((t2) => createFindAPI(client).exists(selector, t2)),
|
|
23458
|
+
visible: (selector) => withTab((t2) => createFindAPI(client).visible(selector, t2)),
|
|
23459
|
+
enabled: (selector) => withTab((t2) => createFindAPI(client).enabled(selector, t2)),
|
|
23460
|
+
checked: (selector) => withTab((t2) => createFindAPI(client).checked(selector, t2))
|
|
23461
|
+
},
|
|
23462
|
+
provide: {
|
|
23463
|
+
text: (opts) => withTab((t2) => createProvideAPI(client).text(opts, t2)),
|
|
23464
|
+
textAll: (opts) => withTab((t2) => createProvideAPI(client).textAll(opts, t2)),
|
|
23465
|
+
attr: (opts) => withTab((t2) => createProvideAPI(client).attr(opts, t2)),
|
|
23466
|
+
attrAll: (opts) => withTab((t2) => createProvideAPI(client).attrAll(opts, t2)),
|
|
23467
|
+
html: (opts) => withTab((t2) => createProvideAPI(client).html(opts, t2)),
|
|
23468
|
+
table: (opts) => withTab((t2) => createProvideAPI(client).table(opts, t2)),
|
|
23469
|
+
list: (opts) => withTab((t2) => createProvideAPI(client).list(opts, t2)),
|
|
23470
|
+
links: (opts) => withTab((t2) => createProvideAPI(client).links(opts, t2)),
|
|
23471
|
+
images: (opts) => withTab((t2) => createProvideAPI(client).images(opts, t2)),
|
|
23472
|
+
form: (opts) => withTab((t2) => createProvideAPI(client).form(opts, t2)),
|
|
23473
|
+
page: () => withTab((t2) => createProvideAPI(client).page(t2)),
|
|
23474
|
+
div: (opts) => withTab((t2) => createProvideAPI(client).div(opts, t2)),
|
|
23475
|
+
meta: () => withTab((t2) => createProvideAPI(client).meta(t2)),
|
|
23476
|
+
select: (opts) => withTab((t2) => createProvideAPI(client).select(opts, t2)),
|
|
23477
|
+
json: (opts) => withTab((t2) => createProvideAPI(client).json(opts, t2))
|
|
23478
|
+
},
|
|
23479
|
+
iframe: {
|
|
23480
|
+
list: () => withTab((t2) => createIframeAPI(client).list(t2)),
|
|
23481
|
+
evaluate: (opts) => withTab((t2) => createIframeAPI(client).evaluate(opts, t2)),
|
|
23482
|
+
click: (opts) => withTab((t2) => createIframeAPI(client).click(opts, t2)),
|
|
23483
|
+
type: (opts) => withTab((t2) => createIframeAPI(client).type(opts, t2)),
|
|
23484
|
+
text: (opts) => withTab((t2) => createIframeAPI(client).text(opts, t2)),
|
|
23485
|
+
html: (opts) => withTab((t2) => createIframeAPI(client).html(opts, t2)),
|
|
23486
|
+
waitSel: (opts) => withTab((t2) => createIframeAPI(client).waitSel(opts, t2))
|
|
23487
|
+
},
|
|
23089
23488
|
screenshot: async (filePath) => {
|
|
23090
23489
|
const r = await withTab((t2) => client.screenshot(filePath, t2));
|
|
23091
23490
|
logger_default.success(`[${name}] screenshot → ${filePath ?? "base64"}`);
|
|
@@ -23096,6 +23495,12 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
|
|
|
23096
23495
|
logger_default.success(`[${name}] pdf → ${filePath ?? "base64"}`);
|
|
23097
23496
|
return r;
|
|
23098
23497
|
},
|
|
23498
|
+
human: {
|
|
23499
|
+
set: (opts) => withTab((t2) => createHumanAPI(client).set(opts, t2)),
|
|
23500
|
+
get: () => withTab((t2) => createHumanAPI(client).get(t2)),
|
|
23501
|
+
type: (opts) => withTab((t2) => createHumanAPI(client).type(opts, t2)),
|
|
23502
|
+
click: (opts) => withTab((t2) => createHumanAPI(client).click(opts, t2))
|
|
23503
|
+
},
|
|
23099
23504
|
blockImages: () => withTab(async (t2) => {
|
|
23100
23505
|
await client.blockImages(t2);
|
|
23101
23506
|
logger_default.info(`[${name}] images blocked`);
|
|
@@ -23109,12 +23514,13 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
|
|
|
23109
23514
|
await withTab((t2) => client.setCookie(cookieName, value, domain, path, t2));
|
|
23110
23515
|
logger_default.info(`[${name}] cookie set: ${cookieName} @ ${domain}`);
|
|
23111
23516
|
},
|
|
23112
|
-
get: (cookieName) => withTab((t2) => client.getCookie(cookieName, t2)),
|
|
23113
|
-
delete: async (cookieName) => {
|
|
23114
|
-
|
|
23517
|
+
get: (cookieName, domain = "") => withTab((t2) => client.getCookie(cookieName, domain, t2)),
|
|
23518
|
+
delete: async (cookieName, domain) => {
|
|
23519
|
+
const d = domain ?? new URL(registeredUrl).hostname;
|
|
23520
|
+
await withTab((t2) => client.deleteCookie(cookieName, d, t2));
|
|
23115
23521
|
logger_default.info(`[${name}] cookie deleted: ${cookieName}`);
|
|
23116
23522
|
},
|
|
23117
|
-
list: () => withTab((t2) => client.listCookies(t2))
|
|
23523
|
+
list: (domain = "") => withTab((t2) => client.listCookies(domain, t2))
|
|
23118
23524
|
},
|
|
23119
23525
|
intercept: {
|
|
23120
23526
|
block: async (pattern) => {
|
|
@@ -23201,6 +23607,16 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
|
|
|
23201
23607
|
logger_default.info(`[${name}] intercept rules cleared`);
|
|
23202
23608
|
}
|
|
23203
23609
|
},
|
|
23610
|
+
dialog: {
|
|
23611
|
+
accept: (tabId2 = "default", text) => new DialogClient(client).accept(tabId2, text),
|
|
23612
|
+
dismiss: (tabId2 = "default") => new DialogClient(client).dismiss(tabId2),
|
|
23613
|
+
status: (tabId2 = "default") => new DialogClient(client).status(tabId2),
|
|
23614
|
+
setAutoAction: (tabId2 = "default", action) => new DialogClient(client).setAutoAction(tabId2, action),
|
|
23615
|
+
upload: (selector, filePath, tabId2 = "default") => new DialogClient(client).upload(selector, filePath, tabId2),
|
|
23616
|
+
onDialog: (tabId2, handler) => new DialogClient(client).onDialog(tabId2, handler),
|
|
23617
|
+
waitAndAccept: (tabId2 = "default", text, timeoutMs = 30000) => new DialogClient(client).waitAndAccept(tabId2, text, timeoutMs),
|
|
23618
|
+
waitAndDismiss: (tabId2 = "default", timeoutMs = 30000) => new DialogClient(client).waitAndDismiss(tabId2, timeoutMs)
|
|
23619
|
+
},
|
|
23204
23620
|
capture: {
|
|
23205
23621
|
start: () => withTab(async (t2) => {
|
|
23206
23622
|
await client.captureStart(t2);
|
|
@@ -23220,37 +23636,14 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
|
|
|
23220
23636
|
})
|
|
23221
23637
|
},
|
|
23222
23638
|
session: {
|
|
23223
|
-
export:
|
|
23224
|
-
|
|
23225
|
-
|
|
23226
|
-
|
|
23227
|
-
},
|
|
23228
|
-
|
|
23229
|
-
|
|
23230
|
-
|
|
23231
|
-
}
|
|
23232
|
-
},
|
|
23233
|
-
exposeFunction: async (fnName, handler) => {
|
|
23234
|
-
await client.exposeFunction(fnName, handler, tabId);
|
|
23235
|
-
logger_default.success(`[${name}] exposed function: ${fnName}`);
|
|
23236
|
-
return site;
|
|
23237
|
-
},
|
|
23238
|
-
unexposeFunction: async (fnName) => {
|
|
23239
|
-
await client.unexposeFunction(fnName, tabId);
|
|
23240
|
-
logger_default.info(`[${name}] unexposed function: ${fnName}`);
|
|
23241
|
-
return site;
|
|
23242
|
-
},
|
|
23243
|
-
clearExposedFunctions: async () => {
|
|
23244
|
-
await client.clearExposedFunctions(tabId);
|
|
23245
|
-
logger_default.info(`[${name}] cleared all exposed functions`);
|
|
23246
|
-
return site;
|
|
23247
|
-
},
|
|
23248
|
-
exposeAndInject: async (fnName, handler, injectionJs) => {
|
|
23249
|
-
await client.exposeFunction(fnName, handler, tabId);
|
|
23250
|
-
const js = typeof injectionJs === "function" ? injectionJs(fnName) : injectionJs;
|
|
23251
|
-
await withTab((t2) => client.evaluate(js, t2));
|
|
23252
|
-
logger_default.success(`[${name}] exposed and injected: ${fnName}`);
|
|
23253
|
-
return site;
|
|
23639
|
+
export: () => withTab((t2) => createSessionAPI(client).export(t2)),
|
|
23640
|
+
import: (data) => withTab((t2) => createSessionAPI(client).import(data, t2)),
|
|
23641
|
+
reload: () => withTab((t2) => createSessionAPI(client).reload(t2)),
|
|
23642
|
+
paths: () => createSessionAPI(client).paths(),
|
|
23643
|
+
cookies: { path: () => createSessionAPI(client).cookiesPath() },
|
|
23644
|
+
profile: { path: () => createSessionAPI(client).profilePath() },
|
|
23645
|
+
ws: { save: (opts) => createSessionAPI(client).setWsSave(opts.enabled) },
|
|
23646
|
+
pings: { save: (opts) => createSessionAPI(client).setPingsSave(opts.enabled) }
|
|
23254
23647
|
},
|
|
23255
23648
|
store: async (data, schemaName) => {
|
|
23256
23649
|
const target = schemaName ?? name;
|
package/dist/server/index.js
CHANGED
|
@@ -25742,7 +25742,7 @@ function finalize(ctx, schema) {
|
|
|
25742
25742
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
25743
25743
|
} else if (ctx.target === "draft-04") {
|
|
25744
25744
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
25745
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
25745
|
+
} else if (ctx.target === "openapi-3.0") {}
|
|
25746
25746
|
if (ctx.external?.uri) {
|
|
25747
25747
|
const id = ctx.external.registry.get(schema)?.id;
|
|
25748
25748
|
if (!id)
|
package/package.json
CHANGED