effect-browserbase 0.1.0-beta.102
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/LICENSE +21 -0
- package/README.md +441 -0
- package/dist/Account.d.mts +34 -0
- package/dist/Account.mjs +41 -0
- package/dist/Account.mjs.map +1 -0
- package/dist/Acquisition-WBafHwXH.mjs +280 -0
- package/dist/Acquisition-WBafHwXH.mjs.map +1 -0
- package/dist/Agents.d.mts +156 -0
- package/dist/Agents.mjs +307 -0
- package/dist/Agents.mjs.map +1 -0
- package/dist/Allocation.d.mts +99 -0
- package/dist/Allocation.mjs +29 -0
- package/dist/Allocation.mjs.map +1 -0
- package/dist/Association-CEps4hYP.mjs +10 -0
- package/dist/Association-CEps4hYP.mjs.map +1 -0
- package/dist/Authorization-Ll5f_XNM.mjs +12 -0
- package/dist/Authorization-Ll5f_XNM.mjs.map +1 -0
- package/dist/Bootstrap-BXuzZojd.mjs +194 -0
- package/dist/Bootstrap-BXuzZojd.mjs.map +1 -0
- package/dist/Bootstrap-m7lHgj0D.d.mts +177 -0
- package/dist/Bootstrap.d.mts +2 -0
- package/dist/Bootstrap.mjs +2 -0
- package/dist/Browser-joE4Zgys.mjs +1557 -0
- package/dist/Browser-joE4Zgys.mjs.map +1 -0
- package/dist/Browser.d.mts +195 -0
- package/dist/Browser.mjs +2 -0
- package/dist/BrowserBinding-qbQA6JhH.mjs +2452 -0
- package/dist/BrowserBinding-qbQA6JhH.mjs.map +1 -0
- package/dist/BrowserBinding.d.mts +40 -0
- package/dist/BrowserBinding.mjs +2 -0
- package/dist/BrowserData-LpcAuAub.d.mts +369 -0
- package/dist/BrowserData.d.mts +2 -0
- package/dist/BrowserData.mjs +442 -0
- package/dist/BrowserData.mjs.map +1 -0
- package/dist/Capture-CZJPuD7b.mjs +532 -0
- package/dist/Capture-CZJPuD7b.mjs.map +1 -0
- package/dist/Capture-Dr5MkIJb.d.mts +125 -0
- package/dist/Capture.d.mts +2 -0
- package/dist/Capture.mjs +2 -0
- package/dist/Certificates.d.mts +35 -0
- package/dist/Certificates.mjs +90 -0
- package/dist/Certificates.mjs.map +1 -0
- package/dist/Cleanup-G2YpTCuU.d.mts +24 -0
- package/dist/Cleanup.d.mts +2 -0
- package/dist/Cleanup.mjs +48 -0
- package/dist/Cleanup.mjs.map +1 -0
- package/dist/Client-Ca0zSg1n.d.mts +53 -0
- package/dist/Client-D1_xYM9o.mjs +424 -0
- package/dist/Client-D1_xYM9o.mjs.map +1 -0
- package/dist/Client.d.mts +2 -0
- package/dist/Client.mjs +2 -0
- package/dist/ContextCoordination.d.mts +16 -0
- package/dist/ContextCoordination.mjs +67 -0
- package/dist/ContextCoordination.mjs.map +1 -0
- package/dist/ContextWriter-BrQmoXRg.mjs +187 -0
- package/dist/ContextWriter-BrQmoXRg.mjs.map +1 -0
- package/dist/Contexts.d.mts +32 -0
- package/dist/Contexts.mjs +103 -0
- package/dist/Contexts.mjs.map +1 -0
- package/dist/Deadline-CrViaogr.mjs +13 -0
- package/dist/Deadline-CrViaogr.mjs.map +1 -0
- package/dist/Downloads.d.mts +44 -0
- package/dist/Downloads.mjs +142 -0
- package/dist/Downloads.mjs.map +1 -0
- package/dist/Errors.d.mts +123 -0
- package/dist/Errors.mjs +329 -0
- package/dist/Errors.mjs.map +1 -0
- package/dist/Extensions-ClZbYb1H.mjs +237 -0
- package/dist/Extensions-ClZbYb1H.mjs.map +1 -0
- package/dist/Extensions.d.mts +44 -0
- package/dist/Extensions.mjs +2 -0
- package/dist/Functions.d.mts +227 -0
- package/dist/Functions.mjs +332 -0
- package/dist/Functions.mjs.map +1 -0
- package/dist/Images-DgscEfSf.mjs +127 -0
- package/dist/Images-DgscEfSf.mjs.map +1 -0
- package/dist/Issued-DejqoMYL.mjs +15 -0
- package/dist/Issued-DejqoMYL.mjs.map +1 -0
- package/dist/Launch-BHcAEq05.mjs +111 -0
- package/dist/Launch-BHcAEq05.mjs.map +1 -0
- package/dist/Launch-C8CfaYxb.d.mts +132 -0
- package/dist/Launch.d.mts +2 -0
- package/dist/Launch.mjs +105 -0
- package/dist/Launch.mjs.map +1 -0
- package/dist/PageControl.d.mts +16 -0
- package/dist/PageControl.mjs +36 -0
- package/dist/PageControl.mjs.map +1 -0
- package/dist/PageControlAssociation-DabEg5AR.mjs +10 -0
- package/dist/PageControlAssociation-DabEg5AR.mjs.map +1 -0
- package/dist/PageFetch.d.mts +40 -0
- package/dist/PageFetch.mjs +64 -0
- package/dist/PageFetch.mjs.map +1 -0
- package/dist/Projects.d.mts +39 -0
- package/dist/Projects.mjs +71 -0
- package/dist/Projects.mjs.map +1 -0
- package/dist/Recordings.d.mts +28 -0
- package/dist/Recordings.mjs +131 -0
- package/dist/Recordings.mjs.map +1 -0
- package/dist/References-URDAtapt.d.mts +35 -0
- package/dist/References.d.mts +2 -0
- package/dist/References.mjs +41 -0
- package/dist/References.mjs.map +1 -0
- package/dist/Replays.d.mts +28 -0
- package/dist/Replays.mjs +109 -0
- package/dist/Replays.mjs.map +1 -0
- package/dist/Resource-DBksC4zB.mjs +50 -0
- package/dist/Resource-DBksC4zB.mjs.map +1 -0
- package/dist/Search.d.mts +38 -0
- package/dist/Search.mjs +53 -0
- package/dist/Search.mjs.map +1 -0
- package/dist/SessionData-DRKcKCqw.d.mts +39 -0
- package/dist/SessionData.d.mts +2 -0
- package/dist/SessionData.mjs +55 -0
- package/dist/SessionData.mjs.map +1 -0
- package/dist/Sessions-B8E4kMxo.d.mts +68 -0
- package/dist/Sessions-CtbseWEh.mjs +244 -0
- package/dist/Sessions-CtbseWEh.mjs.map +1 -0
- package/dist/Sessions.d.mts +3 -0
- package/dist/Sessions.mjs +3 -0
- package/dist/TransferPolicy-DQ06i7SZ.mjs +25 -0
- package/dist/TransferPolicy-DQ06i7SZ.mjs.map +1 -0
- package/dist/Transfers-Czv5IZzJ.d.mts +76 -0
- package/dist/Transfers.d.mts +2 -0
- package/dist/Transfers.mjs +101 -0
- package/dist/Transfers.mjs.map +1 -0
- package/dist/Uploads.d.mts +29 -0
- package/dist/Uploads.mjs +107 -0
- package/dist/Uploads.mjs.map +1 -0
- package/dist/Webhooks.d.mts +60 -0
- package/dist/Webhooks.mjs +143 -0
- package/dist/Webhooks.mjs.map +1 -0
- package/dist/WriterFacts-osvYAsIx.d.mts +61 -0
- package/dist/index.d.mts +30 -0
- package/dist/index.mjs +30 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +163 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { AllocationAttempt } from "./References.mjs";
|
|
2
|
+
import { BrowserError } from "./Errors.mjs";
|
|
3
|
+
import { Viewport } from "./BrowserData.mjs";
|
|
4
|
+
import { LaunchRecipe } from "./Launch.mjs";
|
|
5
|
+
import { Effect, Redacted, Schema } from "effect";
|
|
6
|
+
//#region src/internal/provider/Launch.ts
|
|
7
|
+
const proxy = (rule) => rule.type === "external" ? {
|
|
8
|
+
type: rule.type,
|
|
9
|
+
server: rule.server,
|
|
10
|
+
...rule.domainPattern === void 0 ? {} : { domainPattern: rule.domainPattern },
|
|
11
|
+
...rule.username === void 0 ? {} : { username: Redacted.value(rule.username) },
|
|
12
|
+
...rule.password === void 0 ? {} : { password: Redacted.value(rule.password) }
|
|
13
|
+
} : rule.type === "none" ? {
|
|
14
|
+
type: rule.type,
|
|
15
|
+
...rule.domainPattern === void 0 ? {} : { domainPattern: rule.domainPattern }
|
|
16
|
+
} : {
|
|
17
|
+
type: rule.type,
|
|
18
|
+
...rule.domainPattern === void 0 ? {} : { domainPattern: rule.domainPattern },
|
|
19
|
+
...rule.geolocation === void 0 ? {} : { geolocation: { ...rule.geolocation } }
|
|
20
|
+
};
|
|
21
|
+
/** One validation/copy/compiler path. No legacy constructor or second default body exists. */
|
|
22
|
+
const compileLaunch = Effect.fnUntraced(function* (input, identity) {
|
|
23
|
+
const recipe = yield* Schema.decodeUnknownEffect(LaunchRecipe)(input, { onExcessProperty: "error" }).pipe(Effect.mapError(() => BrowserError.make({
|
|
24
|
+
operation: "launch",
|
|
25
|
+
reason: "configuration",
|
|
26
|
+
outcome: "undispatched"
|
|
27
|
+
})));
|
|
28
|
+
const attempt = Object.freeze(AllocationAttempt.make({
|
|
29
|
+
...identity,
|
|
30
|
+
timeoutSeconds: recipe.remoteTimeoutSeconds
|
|
31
|
+
}));
|
|
32
|
+
const settings = recipe.provider.browserSettings ?? {};
|
|
33
|
+
const fail = () => BrowserError.make({
|
|
34
|
+
operation: "launch",
|
|
35
|
+
reason: "configuration",
|
|
36
|
+
outcome: "undispatched"
|
|
37
|
+
});
|
|
38
|
+
if (recipe.context !== void 0 && recipe.context.reference.projectId !== attempt.projectId || recipe.extension !== void 0 && recipe.extension.projectId !== attempt.projectId || settings.verified === true && recipe.viewport._tag !== "ProviderManaged" || settings.os !== void 0 && settings.verified !== true) return yield* fail();
|
|
39
|
+
const viewport = recipe.viewport._tag === "Fixed" ? yield* Schema.decodeEffect(Viewport)({
|
|
40
|
+
width: recipe.viewport.width,
|
|
41
|
+
height: recipe.viewport.height
|
|
42
|
+
}).pipe(Effect.mapError(fail)) : void 0;
|
|
43
|
+
if (Array.isArray(recipe.provider.proxies)) for (const rule of recipe.provider.proxies) {
|
|
44
|
+
if (rule.type === "browserbase" && rule.geolocation?.state !== void 0 && rule.geolocation.country !== "US") return yield* fail();
|
|
45
|
+
if (rule.type === "external") {
|
|
46
|
+
if (!(yield* Effect.try({
|
|
47
|
+
try: () => {
|
|
48
|
+
const url = new URL(rule.server);
|
|
49
|
+
return ["http:", "https:"].includes(url.protocol) && !url.username && !url.password && !url.hash;
|
|
50
|
+
},
|
|
51
|
+
catch: fail
|
|
52
|
+
}))) return yield* fail();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for (const domain of settings.allowedDomains ?? []) if (!(yield* Effect.try({
|
|
56
|
+
try: () => {
|
|
57
|
+
const url = new URL(`https://${domain}/`);
|
|
58
|
+
return !domain.includes("*") && url.hostname === domain && !url.port && !url.username && !url.password;
|
|
59
|
+
},
|
|
60
|
+
catch: fail
|
|
61
|
+
}))) return yield* fail();
|
|
62
|
+
const metadata = recipe.provider.userMetadata ?? {};
|
|
63
|
+
if (Object.keys(metadata).length > 32 || Object.keys(metadata).some((key) => key === "effectAgentAttempt" || key.startsWith("browserbaseIntegration"))) return yield* fail();
|
|
64
|
+
const keepAlive = recipe.keepAlive ?? false;
|
|
65
|
+
const context = recipe.context === void 0 ? void 0 : {
|
|
66
|
+
id: recipe.context.reference.contextId,
|
|
67
|
+
persist: recipe.context.persist
|
|
68
|
+
};
|
|
69
|
+
const recordSession = settings.recordSession ?? false;
|
|
70
|
+
const body = {
|
|
71
|
+
projectId: attempt.projectId,
|
|
72
|
+
timeout: recipe.remoteTimeoutSeconds,
|
|
73
|
+
keepAlive,
|
|
74
|
+
...recipe.provider.region === void 0 ? {} : { region: recipe.provider.region },
|
|
75
|
+
proxies: Array.isArray(recipe.provider.proxies) ? recipe.provider.proxies.map(proxy) : recipe.provider.proxies ?? false,
|
|
76
|
+
...recipe.provider.proxySettings === void 0 ? {} : { proxySettings: recipe.provider.proxySettings },
|
|
77
|
+
...recipe.extension === void 0 ? {} : { extensionId: recipe.extension.extensionId },
|
|
78
|
+
browserSettings: {
|
|
79
|
+
...settings,
|
|
80
|
+
recordSession,
|
|
81
|
+
logSession: settings.logSession ?? false,
|
|
82
|
+
solveCaptchas: settings.solveCaptchas ?? false,
|
|
83
|
+
...context === void 0 ? {} : { context },
|
|
84
|
+
...viewport === void 0 ? {} : { viewport: {
|
|
85
|
+
width: viewport.width,
|
|
86
|
+
height: viewport.height
|
|
87
|
+
} }
|
|
88
|
+
},
|
|
89
|
+
userMetadata: {
|
|
90
|
+
...metadata,
|
|
91
|
+
browserbaseIntegrationAttempt: attempt.attemptId
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const encoded = yield* Effect.try({
|
|
95
|
+
try: () => JSON.stringify(body),
|
|
96
|
+
catch: fail
|
|
97
|
+
});
|
|
98
|
+
if (new TextEncoder().encode(encoded).length > 65536) return yield* fail();
|
|
99
|
+
return {
|
|
100
|
+
attempt,
|
|
101
|
+
body: yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Json))(encoded).pipe(Effect.mapError(fail)),
|
|
102
|
+
viewport,
|
|
103
|
+
keepAlive,
|
|
104
|
+
context,
|
|
105
|
+
recordSession
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
//#endregion
|
|
109
|
+
export { proxy as n, compileLaunch as t };
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=Launch-BHcAEq05.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Launch-BHcAEq05.mjs","names":[],"sources":["../src/internal/provider/Launch.ts"],"sourcesContent":["import { Effect, Redacted, Schema } from \"effect\";\n\nimport { Viewport } from \"../../BrowserData.ts\";\nimport { BrowserError } from \"../../Errors.ts\";\nimport { LaunchRecipe, type ProxyRule } from \"../../Launch.ts\";\nimport { AllocationAttempt } from \"../../References.ts\";\n\nexport interface CompiledLaunch {\n readonly attempt: AllocationAttempt;\n readonly body: Schema.Json;\n readonly viewport: Viewport | undefined;\n readonly keepAlive: boolean;\n readonly context: { readonly id: string; readonly persist: boolean } | undefined;\n readonly recordSession: boolean;\n}\n\nexport const proxy = (rule: ProxyRule): Schema.Json =>\n rule.type === \"external\"\n ? {\n type: rule.type,\n server: rule.server,\n ...(rule.domainPattern === undefined ? {} : { domainPattern: rule.domainPattern }),\n ...(rule.username === undefined ? {} : { username: Redacted.value(rule.username) }),\n ...(rule.password === undefined ? {} : { password: Redacted.value(rule.password) }),\n }\n : rule.type === \"none\"\n ? {\n type: rule.type,\n ...(rule.domainPattern === undefined ? {} : { domainPattern: rule.domainPattern }),\n }\n : {\n type: rule.type,\n ...(rule.domainPattern === undefined ? {} : { domainPattern: rule.domainPattern }),\n ...(rule.geolocation === undefined ? {} : { geolocation: { ...rule.geolocation } }),\n };\n\n/** One validation/copy/compiler path. No legacy constructor or second default body exists. */\nexport const compileLaunch = Effect.fnUntraced(function* (\n input: unknown,\n identity: Pick<AllocationAttempt, \"projectId\" | \"attemptId\" | \"requestedAtMillis\">,\n): Effect.fn.Return<CompiledLaunch, BrowserError> {\n const recipe = yield* Schema.decodeUnknownEffect(LaunchRecipe)(input, {\n onExcessProperty: \"error\",\n }).pipe(\n Effect.mapError(() =>\n BrowserError.make({ operation: \"launch\", reason: \"configuration\", outcome: \"undispatched\" }),\n ),\n );\n\n const attempt = Object.freeze(\n AllocationAttempt.make({ ...identity, timeoutSeconds: recipe.remoteTimeoutSeconds }),\n );\n\n const settings = recipe.provider.browserSettings ?? {};\n\n const fail = () =>\n BrowserError.make({ operation: \"launch\", reason: \"configuration\", outcome: \"undispatched\" });\n\n // The qualified reference is the only extension spelling, so a foreign project cannot\n // reach POST and there is no second alias whose precedence would have to be invented.\n if (\n (recipe.context !== undefined && recipe.context.reference.projectId !== attempt.projectId) ||\n (recipe.extension !== undefined && recipe.extension.projectId !== attempt.projectId) ||\n (settings.verified === true && recipe.viewport._tag !== \"ProviderManaged\") ||\n (settings.os !== undefined && settings.verified !== true)\n )\n return yield* fail();\n\n const viewport =\n recipe.viewport._tag === \"Fixed\"\n ? yield* Schema.decodeEffect(Viewport)({\n width: recipe.viewport.width,\n height: recipe.viewport.height,\n }).pipe(Effect.mapError(fail))\n : undefined;\n\n if (Array.isArray(recipe.provider.proxies)) {\n for (const rule of recipe.provider.proxies) {\n if (\n rule.type === \"browserbase\" &&\n rule.geolocation?.state !== undefined &&\n rule.geolocation.country !== \"US\"\n )\n return yield* fail();\n if (rule.type === \"external\") {\n const valid = yield* Effect.try({\n try: () => {\n const url = new URL(rule.server);\n\n return (\n [\"http:\", \"https:\"].includes(url.protocol) &&\n !url.username &&\n !url.password &&\n !url.hash\n );\n },\n catch: fail,\n });\n\n if (!valid) return yield* fail();\n }\n }\n }\n for (const domain of settings.allowedDomains ?? []) {\n const valid = yield* Effect.try({\n try: () => {\n const url = new URL(`https://${domain}/`);\n\n return (\n !domain.includes(\"*\") &&\n url.hostname === domain &&\n !url.port &&\n !url.username &&\n !url.password\n );\n },\n catch: fail,\n });\n\n if (!valid) return yield* fail();\n }\n const metadata = recipe.provider.userMetadata ?? {};\n\n if (\n Object.keys(metadata).length > 32 ||\n Object.keys(metadata).some(\n (key) => key === \"effectAgentAttempt\" || key.startsWith(\"browserbaseIntegration\"),\n )\n )\n return yield* fail();\n const keepAlive = recipe.keepAlive ?? false;\n\n const context =\n recipe.context === undefined\n ? undefined\n : { id: recipe.context.reference.contextId, persist: recipe.context.persist };\n\n const recordSession = settings.recordSession ?? false;\n\n const body = {\n projectId: attempt.projectId,\n timeout: recipe.remoteTimeoutSeconds,\n keepAlive,\n ...(recipe.provider.region === undefined ? {} : { region: recipe.provider.region }),\n proxies: Array.isArray(recipe.provider.proxies)\n ? recipe.provider.proxies.map(proxy)\n : (recipe.provider.proxies ?? false),\n ...(recipe.provider.proxySettings === undefined\n ? {}\n : { proxySettings: recipe.provider.proxySettings }),\n ...(recipe.extension === undefined ? {} : { extensionId: recipe.extension.extensionId }),\n browserSettings: {\n ...settings,\n recordSession,\n logSession: settings.logSession ?? false,\n solveCaptchas: settings.solveCaptchas ?? false,\n ...(context === undefined ? {} : { context }),\n ...(viewport === undefined\n ? {}\n : { viewport: { width: viewport.width, height: viewport.height } }),\n },\n userMetadata: { ...metadata, browserbaseIntegrationAttempt: attempt.attemptId },\n };\n\n // Own all nested values, including arrays. The admitted body never observes later caller mutation.\n const encoded = yield* Effect.try({ try: () => JSON.stringify(body), catch: fail });\n\n if (new TextEncoder().encode(encoded).length > 64 * 1024) return yield* fail();\n\n const owned = yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Json))(encoded).pipe(\n Effect.mapError(fail),\n );\n\n return { attempt, body: owned, viewport, keepAlive, context, recordSession };\n});\n"],"mappings":";;;;;;AAgBA,MAAa,SAAS,SACpB,KAAK,SAAS,aACV;CACE,MAAM,KAAK;CACX,QAAQ,KAAK;CACb,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;EAAW;EAAS;CAAc;AAC7E,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { n as ContextReference, r as ExtensionReference } from "./References-URDAtapt.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
declare namespace Launch_d_exports {
|
|
4
|
+
export { LaunchRecipe, ProviderLaunchOptions, ProxyRule, recipe };
|
|
5
|
+
}
|
|
6
|
+
declare const ProxyRule: Schema.Union<readonly [Schema.Struct<{
|
|
7
|
+
readonly type: Schema.Literal<"browserbase">;
|
|
8
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
9
|
+
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
10
|
+
readonly country: Schema.String;
|
|
11
|
+
readonly state: Schema.optionalKey<Schema.String>;
|
|
12
|
+
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
13
|
+
}>>;
|
|
14
|
+
}>, Schema.Struct<{
|
|
15
|
+
readonly type: Schema.Literal<"external">;
|
|
16
|
+
readonly server: Schema.NonEmptyString;
|
|
17
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
18
|
+
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
19
|
+
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
20
|
+
}>, Schema.Struct<{
|
|
21
|
+
readonly type: Schema.Literal<"none">;
|
|
22
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
23
|
+
}>]>;
|
|
24
|
+
type ProxyRule = typeof ProxyRule.Type;
|
|
25
|
+
/** SDK 2.20 browser subset. Names follow Browserbase; ownership-managed fields are excluded. */
|
|
26
|
+
declare const ProviderLaunchOptions: Schema.Struct<{
|
|
27
|
+
readonly region: Schema.optionalKey<Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>>;
|
|
28
|
+
readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
29
|
+
readonly type: Schema.Literal<"browserbase">;
|
|
30
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
31
|
+
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
32
|
+
readonly country: Schema.String;
|
|
33
|
+
readonly state: Schema.optionalKey<Schema.String>;
|
|
34
|
+
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
35
|
+
}>>;
|
|
36
|
+
}>, Schema.Struct<{
|
|
37
|
+
readonly type: Schema.Literal<"external">;
|
|
38
|
+
readonly server: Schema.NonEmptyString;
|
|
39
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
40
|
+
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
41
|
+
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
42
|
+
}>, Schema.Struct<{
|
|
43
|
+
readonly type: Schema.Literal<"none">;
|
|
44
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
45
|
+
}>]>>]>>;
|
|
46
|
+
readonly proxySettings: Schema.optionalKey<Schema.Struct<{
|
|
47
|
+
readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
48
|
+
}>>;
|
|
49
|
+
readonly browserSettings: Schema.optionalKey<Schema.Struct<{
|
|
50
|
+
readonly verified: Schema.optionalKey<Schema.Boolean>;
|
|
51
|
+
readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
|
|
52
|
+
readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
53
|
+
readonly blockAds: Schema.optionalKey<Schema.Boolean>;
|
|
54
|
+
readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
55
|
+
readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
56
|
+
readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
|
|
57
|
+
readonly logSession: Schema.optionalKey<Schema.Boolean>;
|
|
58
|
+
readonly recordSession: Schema.optionalKey<Schema.Boolean>;
|
|
59
|
+
readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
|
|
60
|
+
}>>;
|
|
61
|
+
readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
62
|
+
}>;
|
|
63
|
+
type ProviderLaunchOptions = typeof ProviderLaunchOptions.Type;
|
|
64
|
+
/** Connection behavior and business budgets are not provider session lifetime. */
|
|
65
|
+
declare const LaunchRecipe: Schema.Struct<{
|
|
66
|
+
readonly remoteTimeoutSeconds: Schema.Int;
|
|
67
|
+
readonly keepAlive: Schema.optionalKey<Schema.Boolean>;
|
|
68
|
+
readonly context: Schema.optionalKey<Schema.Struct<{
|
|
69
|
+
readonly reference: typeof ContextReference;
|
|
70
|
+
readonly persist: Schema.Boolean;
|
|
71
|
+
}>>;
|
|
72
|
+
/**
|
|
73
|
+
* Project-qualified selection of an already provisioned extension, never an upload. It is
|
|
74
|
+
* the only spelling: the compiler alone projects it to the provider's `extensionId`, so an
|
|
75
|
+
* unqualified identifier cannot reach the provider unchecked.
|
|
76
|
+
*/
|
|
77
|
+
readonly extension: Schema.optionalKey<typeof ExtensionReference>;
|
|
78
|
+
readonly viewport: Schema.Union<readonly [Schema.Struct<{
|
|
79
|
+
readonly _tag: Schema.Literal<"ProviderManaged">;
|
|
80
|
+
}>, Schema.Struct<{
|
|
81
|
+
readonly _tag: Schema.Literal<"Fixed">;
|
|
82
|
+
readonly width: Schema.Int;
|
|
83
|
+
readonly height: Schema.Int;
|
|
84
|
+
}>]>;
|
|
85
|
+
readonly provider: Schema.Struct<{
|
|
86
|
+
readonly region: Schema.optionalKey<Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>>;
|
|
87
|
+
readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
88
|
+
readonly type: Schema.Literal<"browserbase">;
|
|
89
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
90
|
+
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
91
|
+
readonly country: Schema.String;
|
|
92
|
+
readonly state: Schema.optionalKey<Schema.String>;
|
|
93
|
+
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
94
|
+
}>>;
|
|
95
|
+
}>, Schema.Struct<{
|
|
96
|
+
readonly type: Schema.Literal<"external">;
|
|
97
|
+
readonly server: Schema.NonEmptyString;
|
|
98
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
99
|
+
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
100
|
+
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
101
|
+
}>, Schema.Struct<{
|
|
102
|
+
readonly type: Schema.Literal<"none">;
|
|
103
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
104
|
+
}>]>>]>>;
|
|
105
|
+
readonly proxySettings: Schema.optionalKey<Schema.Struct<{
|
|
106
|
+
readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
107
|
+
}>>;
|
|
108
|
+
readonly browserSettings: Schema.optionalKey<Schema.Struct<{
|
|
109
|
+
readonly verified: Schema.optionalKey<Schema.Boolean>;
|
|
110
|
+
readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
|
|
111
|
+
readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
112
|
+
readonly blockAds: Schema.optionalKey<Schema.Boolean>;
|
|
113
|
+
readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
114
|
+
readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
115
|
+
readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
|
|
116
|
+
readonly logSession: Schema.optionalKey<Schema.Boolean>;
|
|
117
|
+
readonly recordSession: Schema.optionalKey<Schema.Boolean>;
|
|
118
|
+
readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
|
|
119
|
+
}>>;
|
|
120
|
+
readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
121
|
+
}>;
|
|
122
|
+
}>;
|
|
123
|
+
type LaunchRecipe = typeof LaunchRecipe.Type;
|
|
124
|
+
/**
|
|
125
|
+
* A recipe with the smallest reasonable choices filled in: a five-minute provider lifetime,
|
|
126
|
+
* a provider-managed viewport (which Verified requires) and no provider options. Privacy
|
|
127
|
+
* defaults are unchanged: recording, logging and captcha solving stay off unless requested.
|
|
128
|
+
*/
|
|
129
|
+
declare const recipe: (options?: Partial<LaunchRecipe>) => LaunchRecipe;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { recipe as a, ProxyRule as i, Launch_d_exports as n, ProviderLaunchOptions as r, LaunchRecipe as t };
|
|
132
|
+
//# sourceMappingURL=Launch-C8CfaYxb.d.mts.map
|
package/dist/Launch.mjs
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { ContextReference, ExtensionReference, Identifier } from "./References.mjs";
|
|
3
|
+
import { Viewport } from "./BrowserData.mjs";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
|
+
//#region src/Launch.ts
|
|
6
|
+
var Launch_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
LaunchRecipe: () => LaunchRecipe,
|
|
8
|
+
ProviderLaunchOptions: () => ProviderLaunchOptions,
|
|
9
|
+
ProxyRule: () => ProxyRule,
|
|
10
|
+
recipe: () => recipe
|
|
11
|
+
});
|
|
12
|
+
const BoundedString = Schema.NonEmptyString.check(Schema.isMaxLength(1024));
|
|
13
|
+
const ProxySecret = Schema.Redacted(Schema.String.check(Schema.isMaxLength(8192)));
|
|
14
|
+
const Geolocation = Schema.Struct({
|
|
15
|
+
country: Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/)),
|
|
16
|
+
state: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/))),
|
|
17
|
+
city: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256)))
|
|
18
|
+
});
|
|
19
|
+
const ProxyRule = Schema.Union([
|
|
20
|
+
Schema.Struct({
|
|
21
|
+
type: Schema.Literal("browserbase"),
|
|
22
|
+
domainPattern: Schema.optionalKey(BoundedString),
|
|
23
|
+
geolocation: Schema.optionalKey(Geolocation)
|
|
24
|
+
}),
|
|
25
|
+
Schema.Struct({
|
|
26
|
+
type: Schema.Literal("external"),
|
|
27
|
+
server: BoundedString,
|
|
28
|
+
domainPattern: Schema.optionalKey(BoundedString),
|
|
29
|
+
username: Schema.optionalKey(ProxySecret),
|
|
30
|
+
password: Schema.optionalKey(ProxySecret)
|
|
31
|
+
}),
|
|
32
|
+
Schema.Struct({
|
|
33
|
+
type: Schema.Literal("none"),
|
|
34
|
+
domainPattern: Schema.optionalKey(BoundedString)
|
|
35
|
+
})
|
|
36
|
+
]);
|
|
37
|
+
/** SDK 2.20 browser subset. Names follow Browserbase; ownership-managed fields are excluded. */
|
|
38
|
+
const ProviderLaunchOptions = Schema.Struct({
|
|
39
|
+
region: Schema.optionalKey(Schema.Literals([
|
|
40
|
+
"us-west-2",
|
|
41
|
+
"us-east-1",
|
|
42
|
+
"eu-central-1",
|
|
43
|
+
"ap-southeast-1"
|
|
44
|
+
])),
|
|
45
|
+
proxies: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))])),
|
|
46
|
+
proxySettings: Schema.optionalKey(Schema.Struct({ caCertificates: Schema.optionalKey(Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique())) })),
|
|
47
|
+
browserSettings: Schema.optionalKey(Schema.Struct({
|
|
48
|
+
verified: Schema.optionalKey(Schema.Boolean),
|
|
49
|
+
os: Schema.optionalKey(Schema.Literals([
|
|
50
|
+
"windows",
|
|
51
|
+
"mac",
|
|
52
|
+
"linux",
|
|
53
|
+
"mobile",
|
|
54
|
+
"tablet"
|
|
55
|
+
])),
|
|
56
|
+
allowedDomains: Schema.optionalKey(Schema.Array(BoundedString).check(Schema.isMaxLength(64), Schema.isUnique())),
|
|
57
|
+
blockAds: Schema.optionalKey(Schema.Boolean),
|
|
58
|
+
captchaImageSelector: Schema.optionalKey(BoundedString),
|
|
59
|
+
captchaInputSelector: Schema.optionalKey(BoundedString),
|
|
60
|
+
ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean),
|
|
61
|
+
logSession: Schema.optionalKey(Schema.Boolean),
|
|
62
|
+
recordSession: Schema.optionalKey(Schema.Boolean),
|
|
63
|
+
solveCaptchas: Schema.optionalKey(Schema.Boolean)
|
|
64
|
+
})),
|
|
65
|
+
userMetadata: Schema.optionalKey(Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json))
|
|
66
|
+
});
|
|
67
|
+
/** Connection behavior and business budgets are not provider session lifetime. */
|
|
68
|
+
const LaunchRecipe = Schema.Struct({
|
|
69
|
+
remoteTimeoutSeconds: Schema.Int.check(Schema.isBetween({
|
|
70
|
+
minimum: 60,
|
|
71
|
+
maximum: 21600
|
|
72
|
+
})),
|
|
73
|
+
keepAlive: Schema.optionalKey(Schema.Boolean),
|
|
74
|
+
context: Schema.optionalKey(Schema.Struct({
|
|
75
|
+
reference: ContextReference,
|
|
76
|
+
persist: Schema.Boolean
|
|
77
|
+
})),
|
|
78
|
+
/**
|
|
79
|
+
* Project-qualified selection of an already provisioned extension, never an upload. It is
|
|
80
|
+
* the only spelling: the compiler alone projects it to the provider's `extensionId`, so an
|
|
81
|
+
* unqualified identifier cannot reach the provider unchecked.
|
|
82
|
+
*/
|
|
83
|
+
extension: Schema.optionalKey(ExtensionReference),
|
|
84
|
+
viewport: Schema.Union([Schema.Struct({ _tag: Schema.Literal("ProviderManaged") }), Schema.Struct({
|
|
85
|
+
_tag: Schema.Literal("Fixed"),
|
|
86
|
+
width: Viewport.fields.width,
|
|
87
|
+
height: Viewport.fields.height
|
|
88
|
+
})]),
|
|
89
|
+
provider: ProviderLaunchOptions
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* A recipe with the smallest reasonable choices filled in: a five-minute provider lifetime,
|
|
93
|
+
* a provider-managed viewport (which Verified requires) and no provider options. Privacy
|
|
94
|
+
* defaults are unchanged: recording, logging and captcha solving stay off unless requested.
|
|
95
|
+
*/
|
|
96
|
+
const recipe = (options = {}) => ({
|
|
97
|
+
remoteTimeoutSeconds: 300,
|
|
98
|
+
viewport: { _tag: "ProviderManaged" },
|
|
99
|
+
provider: {},
|
|
100
|
+
...options
|
|
101
|
+
});
|
|
102
|
+
//#endregion
|
|
103
|
+
export { LaunchRecipe, ProviderLaunchOptions, ProxyRule, recipe, Launch_exports as t };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=Launch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Launch.mjs","names":[],"sources":["../src/Launch.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { Viewport } from \"./BrowserData.ts\";\nimport { ContextReference, ExtensionReference, Identifier } from \"./References.ts\";\n\nconst BoundedString = Schema.NonEmptyString.check(Schema.isMaxLength(1024));\nconst ProxySecret = Schema.Redacted(Schema.String.check(Schema.isMaxLength(8192)));\n\nconst Geolocation = Schema.Struct({\n country: Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/)),\n state: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/))),\n city: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256))),\n});\n\nexport const ProxyRule = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"browserbase\"),\n domainPattern: Schema.optionalKey(BoundedString),\n geolocation: Schema.optionalKey(Geolocation),\n }),\n Schema.Struct({\n type: Schema.Literal(\"external\"),\n server: BoundedString,\n domainPattern: Schema.optionalKey(BoundedString),\n username: Schema.optionalKey(ProxySecret),\n password: Schema.optionalKey(ProxySecret),\n }),\n Schema.Struct({ type: Schema.Literal(\"none\"), domainPattern: Schema.optionalKey(BoundedString) }),\n]);\n\nexport type ProxyRule = typeof ProxyRule.Type;\n\n/** SDK 2.20 browser subset. Names follow Browserbase; ownership-managed fields are excluded. */\nexport const ProviderLaunchOptions = Schema.Struct({\n region: Schema.optionalKey(\n Schema.Literals([\"us-west-2\", \"us-east-1\", \"eu-central-1\", \"ap-southeast-1\"]),\n ),\n proxies: Schema.optionalKey(\n Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))]),\n ),\n proxySettings: Schema.optionalKey(\n Schema.Struct({\n caCertificates: Schema.optionalKey(\n Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique()),\n ),\n }),\n ),\n browserSettings: Schema.optionalKey(\n Schema.Struct({\n verified: Schema.optionalKey(Schema.Boolean),\n os: Schema.optionalKey(Schema.Literals([\"windows\", \"mac\", \"linux\", \"mobile\", \"tablet\"])),\n allowedDomains: Schema.optionalKey(\n Schema.Array(BoundedString).check(Schema.isMaxLength(64), Schema.isUnique()),\n ),\n blockAds: Schema.optionalKey(Schema.Boolean),\n captchaImageSelector: Schema.optionalKey(BoundedString),\n captchaInputSelector: Schema.optionalKey(BoundedString),\n ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean),\n logSession: Schema.optionalKey(Schema.Boolean),\n recordSession: Schema.optionalKey(Schema.Boolean),\n solveCaptchas: Schema.optionalKey(Schema.Boolean),\n }),\n ),\n userMetadata: Schema.optionalKey(\n Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json),\n ),\n});\n\nexport type ProviderLaunchOptions = typeof ProviderLaunchOptions.Type;\n\n/** Connection behavior and business budgets are not provider session lifetime. */\nexport const LaunchRecipe = Schema.Struct({\n remoteTimeoutSeconds: Schema.Int.check(Schema.isBetween({ minimum: 60, maximum: 21600 })),\n keepAlive: Schema.optionalKey(Schema.Boolean),\n context: Schema.optionalKey(\n Schema.Struct({ reference: ContextReference, persist: Schema.Boolean }),\n ),\n /**\n * Project-qualified selection of an already provisioned extension, never an upload. It is\n * the only spelling: the compiler alone projects it to the provider's `extensionId`, so an\n * unqualified identifier cannot reach the provider unchecked.\n */\n extension: Schema.optionalKey(ExtensionReference),\n viewport: Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"ProviderManaged\") }),\n Schema.Struct({\n _tag: Schema.Literal(\"Fixed\"),\n width: Viewport.fields.width,\n height: Viewport.fields.height,\n }),\n ]),\n provider: ProviderLaunchOptions,\n});\n\nexport type LaunchRecipe = typeof LaunchRecipe.Type;\n\n/**\n * A recipe with the smallest reasonable choices filled in: a five-minute provider lifetime,\n * a provider-managed viewport (which Verified requires) and no provider options. Privacy\n * defaults are unchanged: recording, logging and captcha solving stay off unless requested.\n */\nexport const recipe = (options: Partial<LaunchRecipe> = {}): LaunchRecipe => ({\n remoteTimeoutSeconds: 300,\n viewport: { _tag: \"ProviderManaged\" },\n provider: {},\n ...options,\n});\n"],"mappings":";;;;;;;;;;;AAKA,MAAM,gBAAgB,OAAO,eAAe,MAAM,OAAO,YAAY,IAAI,CAAC;AAC1E,MAAM,cAAc,OAAO,SAAS,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;AAEjF,MAAM,cAAc,OAAO,OAAO;CAChC,SAAS,OAAO,OAAO,MAAM,OAAO,UAAU,YAAY,CAAC;CAC3D,OAAO,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,UAAU,YAAY,CAAC,CAAC;CAC7E,MAAM,OAAO,YAAY,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC,CAAC;AAC/E,CAAC;AAED,MAAa,YAAY,OAA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,OAAO,YAAY,OAAO,OAAO;EAC7C,eAAe,OAAO,YAAY,OAAO,OAAO;EAChD,eAAe,OAAO,YAAY,OAAO,OAAO;CAClD,CAAC,CACH;CACA,cAAc,OAAO,YACnB,OAAO,OAAO,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC,GAAG,OAAO,IAAI,CACzE;AACF,CAAC;;AAKD,MAAa,eAAe,OAAO,OAAO;CACxC,sBAAsB,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAI,SAAS;CAAM,CAAC,CAAC;CACxF,WAAW,OAAO,YAAY,OAAO,OAAO;CAC5C,SAAS,OAAO,YACd,OAAO,OAAO;EAAE,WAAW;EAAkB,SAAS,OAAO;CAAQ,CAAC,CACxE;;;;;;CAMA,WAAW,OAAO,YAAY,kBAAkB;CAChD,UAAU,OAAO,MAAM,CACrB,OAAO,OAAO,EAAE,MAAM,OAAO,QAAQ,iBAAiB,EAAE,CAAC,GACzD,OAAO,OAAO;EACZ,MAAM,OAAO,QAAQ,OAAO;EAC5B,OAAO,SAAS,OAAO;EACvB,QAAQ,SAAS,OAAO;CAC1B,CAAC,CACH,CAAC;CACD,UAAU;AACZ,CAAC;;;;;;AASD,MAAa,UAAU,UAAiC,CAAC,OAAqB;CAC5E,sBAAsB;CACtB,UAAU,EAAE,MAAM,kBAAkB;CACpC,UAAU,CAAC;CACX,GAAG;AACL"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BrowserError } from "./Errors.mjs";
|
|
2
|
+
import { D as PageSuspension, E as PageInfo, T as PageExecutionState } from "./BrowserData-LpcAuAub.mjs";
|
|
3
|
+
import { BrowserbaseSession } from "./Browser.mjs";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
declare namespace PageControl_d_exports {
|
|
6
|
+
export { PageExecutionState, PageSuspension, resume, state, suspend };
|
|
7
|
+
}
|
|
8
|
+
/** Last acknowledged state; no remote guarantee survives connection loss or external control. */
|
|
9
|
+
export declare const state: <E>(session: BrowserbaseSession<E>, page: PageInfo) => Effect.Effect<PageExecutionState, BrowserError>;
|
|
10
|
+
/** Explicit host-only hold requiring InteractiveOptions.pageControl; capture ACKs never invoke it. */
|
|
11
|
+
export declare const suspend: <E>(session: BrowserbaseSession<E>, page: PageInfo) => Effect.Effect<PageSuspension, BrowserError>;
|
|
12
|
+
/** Consumes the exact live receipt. Activation is intentional; stale receipts never replay commands. */
|
|
13
|
+
export declare const resume: <E>(session: BrowserbaseSession<E>, receipt: PageSuspension) => Effect.Effect<void, BrowserError>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PageExecutionState, PageSuspension, PageControl_d_exports as t };
|
|
16
|
+
//# sourceMappingURL=PageControl.d.mts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { BrowserError } from "./Errors.mjs";
|
|
3
|
+
import { PageExecutionState, PageInfo, PageSuspension } from "./BrowserData.mjs";
|
|
4
|
+
import { n as pageControl } from "./PageControlAssociation-DabEg5AR.mjs";
|
|
5
|
+
import { Effect, Schema } from "effect";
|
|
6
|
+
//#region src/PageControl.ts
|
|
7
|
+
var PageControl_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
PageExecutionState: () => PageExecutionState,
|
|
9
|
+
PageSuspension: () => PageSuspension,
|
|
10
|
+
resume: () => resume,
|
|
11
|
+
state: () => state,
|
|
12
|
+
suspend: () => suspend
|
|
13
|
+
});
|
|
14
|
+
const owner = (session) => Effect.suspend(() => {
|
|
15
|
+
const port = pageControl(session);
|
|
16
|
+
return port === void 0 ? Effect.fail(BrowserError.make({
|
|
17
|
+
operation: "page-control",
|
|
18
|
+
reason: "unsupported",
|
|
19
|
+
outcome: "undispatched"
|
|
20
|
+
})) : Effect.succeed(port);
|
|
21
|
+
});
|
|
22
|
+
const invalid = () => BrowserError.make({
|
|
23
|
+
operation: "page-control",
|
|
24
|
+
reason: "configuration",
|
|
25
|
+
outcome: "undispatched"
|
|
26
|
+
});
|
|
27
|
+
/** Last acknowledged state; no remote guarantee survives connection loss or external control. */
|
|
28
|
+
const state = (session, page) => Schema.decodeEffect(PageInfo)(page).pipe(Effect.mapError(invalid), Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))), Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.state(value)))));
|
|
29
|
+
/** Explicit host-only hold requiring InteractiveOptions.pageControl; capture ACKs never invoke it. */
|
|
30
|
+
const suspend = (session, page) => Schema.decodeEffect(PageInfo)(page).pipe(Effect.mapError(invalid), Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))), Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.suspend(value)))));
|
|
31
|
+
/** Consumes the exact live receipt. Activation is intentional; stale receipts never replay commands. */
|
|
32
|
+
const resume = (session, receipt) => Schema.decodeEffect(PageSuspension)(receipt).pipe(Effect.mapError(invalid), Effect.map((value) => Object.freeze(PageSuspension.make({ ...value }))), Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.resume(value)))));
|
|
33
|
+
//#endregion
|
|
34
|
+
export { PageExecutionState, PageSuspension, resume, state, suspend, PageControl_exports as t };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=PageControl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageControl.mjs","names":[],"sources":["../src/PageControl.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\";\n\nimport type { BrowserbaseSession } from \"./Browser.ts\";\nimport { type PageExecutionState, PageInfo, PageSuspension } from \"./BrowserData.ts\";\nimport { BrowserError } from \"./Errors.ts\";\nimport { pageControl } from \"./internal/browser/PageControlAssociation.ts\";\nexport { PageExecutionState, PageSuspension } from \"./BrowserData.ts\";\n\nconst owner = <E>(session: BrowserbaseSession<E>) =>\n Effect.suspend(() => {\n const port = pageControl(session);\n\n return port === undefined\n ? Effect.fail(\n BrowserError.make({\n operation: \"page-control\",\n reason: \"unsupported\",\n outcome: \"undispatched\",\n }),\n )\n : Effect.succeed(port);\n });\n\nconst invalid = () =>\n BrowserError.make({\n operation: \"page-control\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n });\n\n/** Last acknowledged state; no remote guarantee survives connection loss or external control. */\nexport const state = <E>(\n session: BrowserbaseSession<E>,\n page: PageInfo,\n): Effect.Effect<PageExecutionState, BrowserError> =>\n Schema.decodeEffect(PageInfo)(page).pipe(\n Effect.mapError(invalid),\n Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))),\n Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.state(value)))),\n );\n\n/** Explicit host-only hold requiring InteractiveOptions.pageControl; capture ACKs never invoke it. */\nexport const suspend = <E>(\n session: BrowserbaseSession<E>,\n page: PageInfo,\n): Effect.Effect<PageSuspension, BrowserError> =>\n Schema.decodeEffect(PageInfo)(page).pipe(\n Effect.mapError(invalid),\n Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))),\n Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.suspend(value)))),\n );\n\n/** Consumes the exact live receipt. Activation is intentional; stale receipts never replay commands. */\nexport const resume = <E>(\n session: BrowserbaseSession<E>,\n receipt: PageSuspension,\n): Effect.Effect<void, BrowserError> =>\n Schema.decodeEffect(PageSuspension)(receipt).pipe(\n Effect.mapError(invalid),\n Effect.map((value) => Object.freeze(PageSuspension.make({ ...value }))),\n Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.resume(value)))),\n );\n"],"mappings":";;;;;;;;;;;;;AAQA,MAAM,SAAY,YAChB,OAAO,cAAc;CACnB,MAAM,OAAO,YAAY,OAAO;CAEhC,OAAO,SAAS,KAAA,IACZ,OAAO,KACL,aAAa,KAAK;EAChB,WAAW;EACX,QAAQ;EACR,SAAS;CACX,CAAC,CACH,IACA,OAAO,QAAQ,IAAI;AACzB,CAAC;AAEH,MAAM,gBACJ,aAAa,KAAK;CAChB,WAAW;CACX,QAAQ;CACR,SAAS;AACX,CAAC;;AAGH,MAAa,SACX,SACA,SAEA,OAAO,aAAa,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAClC,OAAO,SAAS,OAAO,GACvB,OAAO,KAAK,UAAU,OAAO,OAAO,SAAS,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,GAChE,OAAO,SAAS,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,OAAO,SAAS,SAAS,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC,CAC5F;;AAGF,MAAa,WACX,SACA,SAEA,OAAO,aAAa,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAClC,OAAO,SAAS,OAAO,GACvB,OAAO,KAAK,UAAU,OAAO,OAAO,SAAS,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,GAChE,OAAO,SAAS,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,OAAO,SAAS,SAAS,KAAK,QAAQ,KAAK,CAAC,CAAC,CAAC,CAC9F;;AAGF,MAAa,UACX,SACA,YAEA,OAAO,aAAa,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,KAC3C,OAAO,SAAS,OAAO,GACvB,OAAO,KAAK,UAAU,OAAO,OAAO,eAAe,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,GACtE,OAAO,SAAS,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,OAAO,SAAS,SAAS,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,CAC7F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/internal/browser/PageControlAssociation.ts
|
|
2
|
+
const owners = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
const associatePageControl = (session, port) => {
|
|
4
|
+
owners.set(session, port);
|
|
5
|
+
};
|
|
6
|
+
const pageControl = (session) => owners.get(session);
|
|
7
|
+
//#endregion
|
|
8
|
+
export { pageControl as n, associatePageControl as t };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=PageControlAssociation-DabEg5AR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageControlAssociation-DabEg5AR.mjs","names":[],"sources":["../src/internal/browser/PageControlAssociation.ts"],"sourcesContent":["import type { Effect } from \"effect\";\n\nimport type { PageExecutionState, PageInfo, PageSuspension } from \"../../BrowserData.ts\";\nimport type { BrowserError } from \"../../Errors.ts\";\n\nexport interface PageControlPort {\n readonly state: (page: PageInfo) => Effect.Effect<PageExecutionState, BrowserError>;\n readonly suspend: (page: PageInfo) => Effect.Effect<PageSuspension, BrowserError>;\n readonly resume: (receipt: PageSuspension) => Effect.Effect<void, BrowserError>;\n}\n\nconst owners = new WeakMap<object, PageControlPort>();\n\nexport const associatePageControl = (session: object, port: PageControlPort): void => {\n owners.set(session, port);\n};\n\nexport const pageControl = (session: object): PageControlPort | undefined => owners.get(session);\n"],"mappings":";AAWA,MAAM,yBAAS,IAAI,QAAiC;AAEpD,MAAa,wBAAwB,SAAiB,SAAgC;CACpF,OAAO,IAAI,SAAS,IAAI;AAC1B;AAEA,MAAa,eAAe,YAAiD,OAAO,IAAI,OAAO"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PlatformError } from "./Errors.mjs";
|
|
2
|
+
import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
|
|
3
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
|
+
declare namespace PageFetch_d_exports {
|
|
5
|
+
export { BrowserbasePageFetch, PageFetchRequest, PageFetchResult };
|
|
6
|
+
}
|
|
7
|
+
export declare const PageFetchRequest: Schema.Struct<{
|
|
8
|
+
readonly url: Schema.NonEmptyString;
|
|
9
|
+
readonly allowRedirects: Schema.optionalKey<Schema.Boolean>;
|
|
10
|
+
readonly allowInsecureSsl: Schema.optionalKey<Schema.Boolean>;
|
|
11
|
+
readonly proxies: Schema.optionalKey<Schema.Boolean>;
|
|
12
|
+
/** `raw` by default; `json` extracts with `schema`, `markdown` converts the page. */
|
|
13
|
+
readonly format: Schema.optionalKey<Schema.Literals<readonly ["raw", "json", "markdown"]>>;
|
|
14
|
+
/** A JSON Schema describing the object to extract when `format` is `json`. */
|
|
15
|
+
readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
16
|
+
}>;
|
|
17
|
+
export type PageFetchRequest = typeof PageFetchRequest.Type;
|
|
18
|
+
declare const PageFetchResult_base: Schema.Class<PageFetchResult, Schema.Struct<{
|
|
19
|
+
readonly id: Schema.String;
|
|
20
|
+
readonly statusCode: Schema.Int;
|
|
21
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
22
|
+
readonly content: Schema.Union<readonly [Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>]>;
|
|
23
|
+
readonly contentType: Schema.String;
|
|
24
|
+
readonly encoding: Schema.String;
|
|
25
|
+
}>, {}>;
|
|
26
|
+
export declare class PageFetchResult extends PageFetchResult_base {}
|
|
27
|
+
declare const BrowserbasePageFetch_base: Context.ServiceClass<BrowserbasePageFetch, "effect-browserbase/PageFetch", {
|
|
28
|
+
readonly fetch: (request: PageFetchRequest) => Effect.Effect<PageFetchResult, PlatformError>;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Browserbase's Fetch API: one page retrieved by the provider without a browser session.
|
|
32
|
+
* Replies are bounded by the 1 MiB control-plane limit (`reason: "limit"`); each call is
|
|
33
|
+
* billed and never retried. `statusCode` is the target site's status, not the API's.
|
|
34
|
+
*/
|
|
35
|
+
export declare class BrowserbasePageFetch extends BrowserbasePageFetch_base {
|
|
36
|
+
static readonly layer: Layer.Layer<BrowserbasePageFetch, never, BrowserbaseClient>;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { PageFetch_d_exports as t };
|
|
40
|
+
//# sourceMappingURL=PageFetch.d.mts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { PlatformError } from "./Errors.mjs";
|
|
3
|
+
import { t as BrowserbaseClient } from "./Client-D1_xYM9o.mjs";
|
|
4
|
+
import { t as resource } from "./Resource-DBksC4zB.mjs";
|
|
5
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
6
|
+
//#region src/PageFetch.ts
|
|
7
|
+
var PageFetch_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
BrowserbasePageFetch: () => BrowserbasePageFetch,
|
|
9
|
+
PageFetchRequest: () => PageFetchRequest,
|
|
10
|
+
PageFetchResult: () => PageFetchResult
|
|
11
|
+
});
|
|
12
|
+
const HttpUrl = Schema.NonEmptyString.check(Schema.isMaxLength(8192), Schema.makeFilter((value) => {
|
|
13
|
+
try {
|
|
14
|
+
const url = new URL(value);
|
|
15
|
+
return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
const PageFetchRequest = Schema.Struct({
|
|
21
|
+
url: HttpUrl,
|
|
22
|
+
allowRedirects: Schema.optionalKey(Schema.Boolean),
|
|
23
|
+
allowInsecureSsl: Schema.optionalKey(Schema.Boolean),
|
|
24
|
+
proxies: Schema.optionalKey(Schema.Boolean),
|
|
25
|
+
/** `raw` by default; `json` extracts with `schema`, `markdown` converts the page. */
|
|
26
|
+
format: Schema.optionalKey(Schema.Literals([
|
|
27
|
+
"raw",
|
|
28
|
+
"json",
|
|
29
|
+
"markdown"
|
|
30
|
+
])),
|
|
31
|
+
/** A JSON Schema describing the object to extract when `format` is `json`. */
|
|
32
|
+
schema: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json))
|
|
33
|
+
});
|
|
34
|
+
var PageFetchResult = class extends Schema.Class("BrowserbasePageFetchResult")({
|
|
35
|
+
id: Schema.String.check(Schema.isMaxLength(256)),
|
|
36
|
+
statusCode: Schema.Int,
|
|
37
|
+
headers: Schema.Record(Schema.String, Schema.String),
|
|
38
|
+
content: Schema.Union([Schema.String, Schema.Json]),
|
|
39
|
+
contentType: Schema.String.check(Schema.isMaxLength(1024)),
|
|
40
|
+
encoding: Schema.String.check(Schema.isMaxLength(64))
|
|
41
|
+
}) {};
|
|
42
|
+
/**
|
|
43
|
+
* Browserbase's Fetch API: one page retrieved by the provider without a browser session.
|
|
44
|
+
* Replies are bounded by the 1 MiB control-plane limit (`reason: "limit"`); each call is
|
|
45
|
+
* billed and never retried. `statusCode` is the target site's status, not the API's.
|
|
46
|
+
*/
|
|
47
|
+
var BrowserbasePageFetch = class BrowserbasePageFetch extends Context.Service()("effect-browserbase/PageFetch") {
|
|
48
|
+
static layer = Layer.effect(BrowserbasePageFetch, Effect.gen(function* () {
|
|
49
|
+
const api = resource(yield* BrowserbaseClient, (failure) => PlatformError.make({
|
|
50
|
+
...failure,
|
|
51
|
+
service: "fetch"
|
|
52
|
+
}));
|
|
53
|
+
const fetch = Effect.fn("BrowserbasePageFetch.fetch")(function* (request) {
|
|
54
|
+
const value = yield* api.input(PageFetchRequest, request, "fetch");
|
|
55
|
+
if (value.schema !== void 0 && value.format !== "json") return yield* api.configuration("fetch");
|
|
56
|
+
return yield* api.request("POST", "/v1/fetch", PageFetchResult, "fetch", value);
|
|
57
|
+
});
|
|
58
|
+
return BrowserbasePageFetch.of({ fetch });
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { BrowserbasePageFetch, PageFetchRequest, PageFetchResult, PageFetch_exports as t };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=PageFetch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageFetch.mjs","names":[],"sources":["../src/PageFetch.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { PlatformError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\n\nconst HttpUrl = Schema.NonEmptyString.check(\n Schema.isMaxLength(8192),\n Schema.makeFilter((value) => {\n try {\n const url = new URL(value);\n\n return (\n (url.protocol === \"https:\" || url.protocol === \"http:\") && !url.username && !url.password\n );\n } catch {\n return false;\n }\n }),\n);\n\nexport const PageFetchRequest = Schema.Struct({\n url: HttpUrl,\n allowRedirects: Schema.optionalKey(Schema.Boolean),\n allowInsecureSsl: Schema.optionalKey(Schema.Boolean),\n proxies: Schema.optionalKey(Schema.Boolean),\n /** `raw` by default; `json` extracts with `schema`, `markdown` converts the page. */\n format: Schema.optionalKey(Schema.Literals([\"raw\", \"json\", \"markdown\"])),\n /** A JSON Schema describing the object to extract when `format` is `json`. */\n schema: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),\n});\n\nexport type PageFetchRequest = typeof PageFetchRequest.Type;\n\nexport class PageFetchResult extends Schema.Class<PageFetchResult>(\"BrowserbasePageFetchResult\")({\n id: Schema.String.check(Schema.isMaxLength(256)),\n statusCode: Schema.Int,\n headers: Schema.Record(Schema.String, Schema.String),\n content: Schema.Union([Schema.String, Schema.Json]),\n contentType: Schema.String.check(Schema.isMaxLength(1024)),\n encoding: Schema.String.check(Schema.isMaxLength(64)),\n}) {}\n\n/**\n * Browserbase's Fetch API: one page retrieved by the provider without a browser session.\n * Replies are bounded by the 1 MiB control-plane limit (`reason: \"limit\"`); each call is\n * billed and never retried. `statusCode` is the target site's status, not the API's.\n */\nexport class BrowserbasePageFetch extends Context.Service<\n BrowserbasePageFetch,\n {\n readonly fetch: (request: PageFetchRequest) => Effect.Effect<PageFetchResult, PlatformError>;\n }\n>()(\"effect-browserbase/PageFetch\") {\n static readonly layer: Layer.Layer<BrowserbasePageFetch, never, BrowserbaseClient> = Layer.effect(\n BrowserbasePageFetch,\n Effect.gen(function* () {\n const api = resource<PlatformError>(yield* BrowserbaseClient, (failure) =>\n PlatformError.make({ ...failure, service: \"fetch\" }),\n );\n\n const fetch = Effect.fn(\"BrowserbasePageFetch.fetch\")(function* (request: PageFetchRequest) {\n const value = yield* api.input(PageFetchRequest, request, \"fetch\");\n\n if (value.schema !== undefined && value.format !== \"json\")\n return yield* api.configuration(\"fetch\");\n\n return yield* api.request(\"POST\", \"/v1/fetch\", PageFetchResult, \"fetch\", value);\n });\n\n return BrowserbasePageFetch.of({ fetch });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;AAMA,MAAM,UAAU,OAAO,eAAe,MACpC,OAAO,YAAY,IAAI,GACvB,OAAO,YAAY,UAAU;CAC3B,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EAEzB,QACG,IAAI,aAAa,YAAY,IAAI,aAAa,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI;CAErF,QAAQ;EACN,OAAO;CACT;AACF,CAAC,CACH;AAEA,MAAa,mBAAmB,OAAO,OAAO;CAC5C,KAAK;CACL,gBAAgB,OAAO,YAAY,OAAO,OAAO;CACjD,kBAAkB,OAAO,YAAY,OAAO,OAAO;CACnD,SAAS,OAAO,YAAY,OAAO,OAAO;;CAE1C,QAAQ,OAAO,YAAY,OAAO,SAAS;EAAC;EAAO;EAAQ;CAAU,CAAC,CAAC;;CAEvE,QAAQ,OAAO,YAAY,OAAO,OAAO,OAAO,QAAQ,OAAO,IAAI,CAAC;AACtE,CAAC;AAID,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,IAAI,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;CAC/C,YAAY,OAAO;CACnB,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM;CACnD,SAAS,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,CAAC;CAClD,aAAa,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC;CACzD,UAAU,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AACtD,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,uBAAb,MAAa,6BAA6B,QAAQ,QAKhD,CAAC,CAAC,8BAA8B,CAAC,CAAC;CAClC,OAAgB,QAAqE,MAAM,OACzF,sBACA,OAAO,IAAI,aAAa;EACtB,MAAM,MAAM,SAAwB,OAAO,oBAAoB,YAC7D,cAAc,KAAK;GAAE,GAAG;GAAS,SAAS;EAAQ,CAAC,CACrD;EAEA,MAAM,QAAQ,OAAO,GAAG,4BAA4B,CAAC,CAAC,WAAW,SAA2B;GAC1F,MAAM,QAAQ,OAAO,IAAI,MAAM,kBAAkB,SAAS,OAAO;GAEjE,IAAI,MAAM,WAAW,KAAA,KAAa,MAAM,WAAW,QACjD,OAAO,OAAO,IAAI,cAAc,OAAO;GAEzC,OAAO,OAAO,IAAI,QAAQ,QAAQ,aAAa,iBAAiB,SAAS,KAAK;EAChF,CAAC;EAED,OAAO,qBAAqB,GAAG,EAAE,MAAM,CAAC;CAC1C,CAAC,CACH;AACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ProjectError } from "./Errors.mjs";
|
|
2
|
+
import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
|
|
3
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
|
+
declare namespace Projects_d_exports {
|
|
5
|
+
export { BrowserbaseProjects, ProjectMetadata, ProjectUsage };
|
|
6
|
+
}
|
|
7
|
+
declare const ProjectMetadata_base: Schema.Class<ProjectMetadata, Schema.Struct<{
|
|
8
|
+
readonly projectId: Schema.NonEmptyString;
|
|
9
|
+
readonly name: Schema.String;
|
|
10
|
+
readonly ownerId: Schema.String;
|
|
11
|
+
/** Default provider session lifetime in seconds. */
|
|
12
|
+
readonly defaultTimeout: Schema.Int;
|
|
13
|
+
/** Maximum concurrent sessions. */
|
|
14
|
+
readonly concurrency: Schema.Int;
|
|
15
|
+
readonly createdAt: Schema.String;
|
|
16
|
+
readonly updatedAt: Schema.String;
|
|
17
|
+
}>, {}>;
|
|
18
|
+
export declare class ProjectMetadata extends ProjectMetadata_base {}
|
|
19
|
+
declare const ProjectUsage_base: Schema.Class<ProjectUsage, Schema.Struct<{
|
|
20
|
+
readonly projectId: Schema.NonEmptyString;
|
|
21
|
+
readonly browserMinutes: Schema.Natural;
|
|
22
|
+
readonly proxyBytes: Schema.Natural;
|
|
23
|
+
}>, {}>;
|
|
24
|
+
export declare class ProjectUsage extends ProjectUsage_base {}
|
|
25
|
+
declare const BrowserbaseProjects_base: Context.ServiceClass<BrowserbaseProjects, "effect-browserbase/Projects", {
|
|
26
|
+
readonly list: Effect.Effect<ReadonlyArray<ProjectMetadata>, ProjectError>;
|
|
27
|
+
readonly retrieve: Effect.Effect<ProjectMetadata, ProjectError>;
|
|
28
|
+
readonly usage: Effect.Effect<ProjectUsage, ProjectError>;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Passive project inspection. `retrieve` and `usage` read the Client's own project; `list`
|
|
32
|
+
* reports every project the API key can see. Nothing here changes provider state.
|
|
33
|
+
*/
|
|
34
|
+
export declare class BrowserbaseProjects extends BrowserbaseProjects_base {
|
|
35
|
+
static readonly layer: Layer.Layer<BrowserbaseProjects, never, BrowserbaseClient>;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Projects_d_exports as t };
|
|
39
|
+
//# sourceMappingURL=Projects.d.mts.map
|