effect-browserbase 0.2.0-beta.9 → 0.3.0-beta.11

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.
Files changed (155) hide show
  1. package/README.md +277 -319
  2. package/dist/Browserbase-CaPKwEY9.mjs +544 -0
  3. package/dist/Browserbase-CaPKwEY9.mjs.map +1 -0
  4. package/dist/Browserbase.d.mts +110 -0
  5. package/dist/Browserbase.mjs +3 -0
  6. package/dist/BrowserbaseClient-CtAQ2rg4.d.mts +195 -0
  7. package/dist/BrowserbaseClient.d.mts +2 -0
  8. package/dist/BrowserbaseClient.mjs +190 -0
  9. package/dist/BrowserbaseClient.mjs.map +1 -0
  10. package/dist/BrowserbaseError-D1EOrLNc.d.mts +79 -0
  11. package/dist/BrowserbaseError.d.mts +2 -0
  12. package/dist/BrowserbaseError.mjs +101 -0
  13. package/dist/BrowserbaseError.mjs.map +1 -0
  14. package/dist/ContextLease.d.mts +42 -0
  15. package/dist/ContextLease.mjs +80 -0
  16. package/dist/ContextLease.mjs.map +1 -0
  17. package/dist/index.d.mts +5 -27
  18. package/dist/index.mjs +5 -26
  19. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  20. package/dist/testing/index.d.mts +136 -0
  21. package/dist/testing/index.mjs +440 -0
  22. package/dist/testing/index.mjs.map +1 -0
  23. package/package.json +51 -121
  24. package/src/Browserbase.ts +729 -0
  25. package/src/BrowserbaseClient.ts +559 -0
  26. package/src/BrowserbaseError.ts +108 -0
  27. package/src/ContextLease.ts +118 -0
  28. package/src/index.ts +7 -0
  29. package/src/internal/captureConnection.ts +214 -0
  30. package/src/testing/BrowserbaseContract.ts +170 -0
  31. package/src/testing/TestBrowserbase.ts +509 -0
  32. package/src/testing/index.ts +7 -0
  33. package/dist/Account.d.mts +0 -32
  34. package/dist/Account.mjs +0 -36
  35. package/dist/Account.mjs.map +0 -1
  36. package/dist/Acquisition-BOABu_qJ.mjs +0 -244
  37. package/dist/Acquisition-BOABu_qJ.mjs.map +0 -1
  38. package/dist/Agents-CPaTOH_g.d.mts +0 -156
  39. package/dist/Agents.d.mts +0 -3
  40. package/dist/Agents.mjs +0 -292
  41. package/dist/Agents.mjs.map +0 -1
  42. package/dist/Allocation.d.mts +0 -97
  43. package/dist/Allocation.mjs +0 -27
  44. package/dist/Allocation.mjs.map +0 -1
  45. package/dist/Authorization-Ll5f_XNM.mjs +0 -12
  46. package/dist/Authorization-Ll5f_XNM.mjs.map +0 -1
  47. package/dist/Browser-ByrWJ0ss.mjs +0 -274
  48. package/dist/Browser-ByrWJ0ss.mjs.map +0 -1
  49. package/dist/Browser.d.mts +0 -83
  50. package/dist/Browser.mjs +0 -3
  51. package/dist/BrowserBinding.d.mts +0 -13
  52. package/dist/BrowserBinding.mjs +0 -31
  53. package/dist/BrowserBinding.mjs.map +0 -1
  54. package/dist/Certificates-D4NQmyeA.d.mts +0 -34
  55. package/dist/Certificates.d.mts +0 -3
  56. package/dist/Certificates.mjs +0 -85
  57. package/dist/Certificates.mjs.map +0 -1
  58. package/dist/Cleanup-DMTDBir8.d.mts +0 -23
  59. package/dist/Cleanup.d.mts +0 -3
  60. package/dist/Cleanup.mjs +0 -43
  61. package/dist/Cleanup.mjs.map +0 -1
  62. package/dist/Client-BEC4Q8ZS.mjs +0 -564
  63. package/dist/Client-BEC4Q8ZS.mjs.map +0 -1
  64. package/dist/Client-B_f6bBLT.d.mts +0 -52
  65. package/dist/Client.d.mts +0 -3
  66. package/dist/Client.mjs +0 -2
  67. package/dist/Connection-sxyxtwlk.mjs +0 -56
  68. package/dist/Connection-sxyxtwlk.mjs.map +0 -1
  69. package/dist/ContextCoordination.d.mts +0 -29
  70. package/dist/ContextCoordination.mjs +0 -94
  71. package/dist/ContextCoordination.mjs.map +0 -1
  72. package/dist/ContextWriter-CiEma24z.mjs +0 -204
  73. package/dist/ContextWriter-CiEma24z.mjs.map +0 -1
  74. package/dist/Contexts-DqdL7cyX.d.mts +0 -31
  75. package/dist/Contexts.d.mts +0 -3
  76. package/dist/Contexts.mjs +0 -97
  77. package/dist/Contexts.mjs.map +0 -1
  78. package/dist/Deadline-CrViaogr.mjs +0 -13
  79. package/dist/Deadline-CrViaogr.mjs.map +0 -1
  80. package/dist/Downloads-CX52GOFJ.d.mts +0 -43
  81. package/dist/Downloads.d.mts +0 -3
  82. package/dist/Downloads.mjs +0 -137
  83. package/dist/Downloads.mjs.map +0 -1
  84. package/dist/Errors.d.mts +0 -100
  85. package/dist/Errors.mjs +0 -194
  86. package/dist/Errors.mjs.map +0 -1
  87. package/dist/Extensions-BTUn9zhK.mjs +0 -231
  88. package/dist/Extensions-BTUn9zhK.mjs.map +0 -1
  89. package/dist/Extensions-DBXuVM1f.d.mts +0 -43
  90. package/dist/Extensions.d.mts +0 -3
  91. package/dist/Extensions.mjs +0 -2
  92. package/dist/Functions-CsKMMUuZ.d.mts +0 -226
  93. package/dist/Functions.d.mts +0 -3
  94. package/dist/Functions.mjs +0 -318
  95. package/dist/Functions.mjs.map +0 -1
  96. package/dist/Issued-DejqoMYL.mjs +0 -15
  97. package/dist/Issued-DejqoMYL.mjs.map +0 -1
  98. package/dist/Launch-cAdE2rrZ.mjs +0 -115
  99. package/dist/Launch-cAdE2rrZ.mjs.map +0 -1
  100. package/dist/Launch.d.mts +0 -127
  101. package/dist/Launch.mjs +0 -97
  102. package/dist/Launch.mjs.map +0 -1
  103. package/dist/PageFetch-CjAM_0DS.d.mts +0 -40
  104. package/dist/PageFetch.d.mts +0 -3
  105. package/dist/PageFetch.mjs +0 -59
  106. package/dist/PageFetch.mjs.map +0 -1
  107. package/dist/Projects-tm5bTDH0.d.mts +0 -38
  108. package/dist/Projects.d.mts +0 -3
  109. package/dist/Projects.mjs +0 -65
  110. package/dist/Projects.mjs.map +0 -1
  111. package/dist/Recordings-B9k5aODB.d.mts +0 -27
  112. package/dist/Recordings.d.mts +0 -3
  113. package/dist/Recordings.mjs +0 -144
  114. package/dist/Recordings.mjs.map +0 -1
  115. package/dist/References-DOH3Wu44.d.mts +0 -34
  116. package/dist/References.d.mts +0 -3
  117. package/dist/References.mjs +0 -33
  118. package/dist/References.mjs.map +0 -1
  119. package/dist/Replays-mV93WGtx.d.mts +0 -27
  120. package/dist/Replays.d.mts +0 -3
  121. package/dist/Replays.mjs +0 -107
  122. package/dist/Replays.mjs.map +0 -1
  123. package/dist/Resource-J7Kkk5mu.mjs +0 -54
  124. package/dist/Resource-J7Kkk5mu.mjs.map +0 -1
  125. package/dist/Search-B64e7g-h.d.mts +0 -37
  126. package/dist/Search.d.mts +0 -3
  127. package/dist/Search.mjs +0 -46
  128. package/dist/Search.mjs.map +0 -1
  129. package/dist/SessionData-5xYZDshJ.d.mts +0 -38
  130. package/dist/SessionData.d.mts +0 -3
  131. package/dist/SessionData.mjs +0 -48
  132. package/dist/SessionData.mjs.map +0 -1
  133. package/dist/Sessions-D2H5m6rF.mjs +0 -260
  134. package/dist/Sessions-D2H5m6rF.mjs.map +0 -1
  135. package/dist/Sessions-oJEUmZth.d.mts +0 -69
  136. package/dist/Sessions.d.mts +0 -4
  137. package/dist/Sessions.mjs +0 -3
  138. package/dist/Testing.d.mts +0 -119
  139. package/dist/Testing.mjs +0 -206
  140. package/dist/Testing.mjs.map +0 -1
  141. package/dist/TransferPolicy-DQ06i7SZ.mjs +0 -25
  142. package/dist/TransferPolicy-DQ06i7SZ.mjs.map +0 -1
  143. package/dist/Transfers-GVqzrDWl.d.mts +0 -89
  144. package/dist/Transfers.d.mts +0 -3
  145. package/dist/Transfers.mjs +0 -85
  146. package/dist/Transfers.mjs.map +0 -1
  147. package/dist/Uploads-C2_bACgv.d.mts +0 -28
  148. package/dist/Uploads.d.mts +0 -3
  149. package/dist/Uploads.mjs +0 -105
  150. package/dist/Uploads.mjs.map +0 -1
  151. package/dist/Webhooks-BoeRAxzG.d.mts +0 -59
  152. package/dist/Webhooks.d.mts +0 -3
  153. package/dist/Webhooks.mjs +0 -134
  154. package/dist/Webhooks.mjs.map +0 -1
  155. package/dist/WriterFacts-BBJRDZYY.d.mts +0 -54
@@ -1,115 +0,0 @@
1
- import { AllocationAttempt } from "./References.mjs";
2
- import { LaunchRecipe } from "./Launch.mjs";
3
- import { Effect, Redacted, Schema } from "effect";
4
- import { Viewport } from "effect-browser/browser-data";
5
- import { BrowserError, Reasons } from "effect-browser/errors";
6
- //#region src/internal/List.ts
7
- /**
8
- * `Array.isArray` narrows to `any[]`, which erases a readonly array's element type. This keeps
9
- * the same runtime check and the declared element type.
10
- */
11
- const isList = (value) => Array.isArray(value);
12
- //#endregion
13
- //#region src/internal/provider/Launch.ts
14
- const proxy = (rule) => rule.type === "external" ? {
15
- type: rule.type,
16
- server: rule.server,
17
- ...rule.domainPattern === void 0 ? {} : { domainPattern: rule.domainPattern },
18
- ...rule.username === void 0 ? {} : { username: Redacted.value(rule.username) },
19
- ...rule.password === void 0 ? {} : { password: Redacted.value(rule.password) }
20
- } : rule.type === "none" ? {
21
- type: rule.type,
22
- ...rule.domainPattern === void 0 ? {} : { domainPattern: rule.domainPattern }
23
- } : {
24
- type: rule.type,
25
- ...rule.domainPattern === void 0 ? {} : { domainPattern: rule.domainPattern },
26
- ...rule.geolocation === void 0 ? {} : { geolocation: { ...rule.geolocation } }
27
- };
28
- /** One validation/copy/compiler path. No legacy constructor or second default body exists. */
29
- const compileLaunch = Effect.fnUntraced(function* (input, identity) {
30
- const recipe = yield* Schema.decodeUnknownEffect(LaunchRecipe)(input, { onExcessProperty: "error" }).pipe(Effect.mapError(() => BrowserError.make({
31
- operation: "launch",
32
- reason: Reasons.Configuration.make({}),
33
- outcome: "undispatched"
34
- })));
35
- const attempt = Object.freeze(AllocationAttempt.make({
36
- ...identity,
37
- timeoutSeconds: recipe.remoteTimeoutSeconds
38
- }));
39
- const settings = recipe.provider.browserSettings ?? {};
40
- const fail = () => BrowserError.make({
41
- operation: "launch",
42
- reason: Reasons.Configuration.make({}),
43
- outcome: "undispatched"
44
- });
45
- 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();
46
- const viewport = recipe.viewport._tag === "Fixed" ? yield* Schema.decodeEffect(Viewport)({
47
- width: recipe.viewport.width,
48
- height: recipe.viewport.height
49
- }).pipe(Effect.mapError(fail)) : void 0;
50
- if (isList(recipe.provider.proxies)) for (const rule of recipe.provider.proxies) {
51
- if (rule.type === "browserbase" && rule.geolocation?.state !== void 0 && rule.geolocation.country !== "US") return yield* fail();
52
- if (rule.type === "external") {
53
- if (!(yield* Effect.try({
54
- try: () => {
55
- const url = new URL(rule.server);
56
- return ["http:", "https:"].includes(url.protocol) && !url.username && !url.password && !url.hash;
57
- },
58
- catch: fail
59
- }))) return yield* fail();
60
- }
61
- }
62
- for (const domain of settings.allowedDomains ?? []) if (!(yield* Effect.try({
63
- try: () => {
64
- const url = new URL(`https://${domain}/`);
65
- return !domain.includes("*") && url.hostname === domain && !url.port && !url.username && !url.password;
66
- },
67
- catch: fail
68
- }))) return yield* fail();
69
- const metadata = recipe.provider.userMetadata ?? {};
70
- if (Object.keys(metadata).length > 32 || Object.keys(metadata).some((key) => key === "effectAgentAttempt" || key.startsWith("browserbaseIntegration"))) return yield* fail();
71
- const keepAlive = recipe.keepAlive ?? false;
72
- const context = recipe.context === void 0 ? void 0 : {
73
- id: recipe.context.reference.contextId,
74
- persist: recipe.context.persist
75
- };
76
- const recordSession = settings.recordSession ?? false;
77
- const body = {
78
- projectId: attempt.projectId,
79
- timeout: recipe.remoteTimeoutSeconds,
80
- keepAlive,
81
- ...recipe.provider.region === void 0 ? {} : { region: recipe.provider.region },
82
- proxies: isList(recipe.provider.proxies) ? recipe.provider.proxies.map(proxy) : recipe.provider.proxies ?? false,
83
- ...recipe.provider.proxySettings === void 0 ? {} : { proxySettings: recipe.provider.proxySettings },
84
- ...recipe.extension === void 0 ? {} : { extensionId: recipe.extension.extensionId },
85
- browserSettings: {
86
- ...settings,
87
- recordSession,
88
- logSession: settings.logSession ?? false,
89
- solveCaptchas: settings.solveCaptchas ?? false,
90
- ...context === void 0 ? {} : { context },
91
- ...viewport === void 0 ? {} : { viewport: {
92
- width: viewport.width,
93
- height: viewport.height
94
- } }
95
- },
96
- userMetadata: {
97
- ...metadata,
98
- browserbaseIntegrationAttempt: attempt.attemptId
99
- }
100
- };
101
- const encoded = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown))(body).pipe(Effect.mapError(fail));
102
- if (new TextEncoder().encode(encoded).length > 65536) return yield* fail();
103
- return {
104
- attempt,
105
- body: yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Json))(encoded).pipe(Effect.mapError(fail)),
106
- viewport,
107
- keepAlive,
108
- context,
109
- recordSession
110
- };
111
- });
112
- //#endregion
113
- export { proxy as n, isList as r, compileLaunch as t };
114
-
115
- //# sourceMappingURL=Launch-cAdE2rrZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Launch-cAdE2rrZ.mjs","names":[],"sources":["../src/internal/List.ts","../src/internal/provider/Launch.ts"],"sourcesContent":["/**\n * `Array.isArray` narrows to `any[]`, which erases a readonly array's element type. This keeps\n * the same runtime check and the declared element type.\n */\nexport const isList = <T>(value: T): value is Extract<T, ReadonlyArray<unknown>> =>\n Array.isArray(value);\n","import { Effect, Redacted, Schema } from \"effect\";\nimport { Viewport } from \"effect-browser/browser-data\";\nimport { BrowserError, Reasons } from \"effect-browser/errors\";\n\nimport { LaunchRecipe, type ProxyRule } from \"../../Launch.ts\";\nimport { AllocationAttempt } from \"../../References.ts\";\nimport { isList } from \"../List.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({\n operation: \"launch\",\n reason: Reasons.Configuration.make({}),\n outcome: \"undispatched\",\n }),\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({\n operation: \"launch\",\n reason: Reasons.Configuration.make({}),\n outcome: \"undispatched\",\n });\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 (isList(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: isList(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* Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown))(body).pipe(\n Effect.mapError(fail),\n );\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":";;;;;;;;;;AAIA,MAAa,UAAa,UACxB,MAAM,QAAQ,KAAK;;;ACYrB,MAAa,SAAS,SACpB,KAAK,SAAS,aACV;CACE,MAAM,KAAK;CACX,QAAQ,KAAK;CACb,GAAI,KAAK,kBAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAe,KAAK,cAAc;CAChF,GAAI,KAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,SAAS,MAAM,KAAK,QAAQ,EAAE;CACjF,GAAI,KAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,SAAS,MAAM,KAAK,QAAQ,EAAE;AACnF,IACA,KAAK,SAAS,SACZ;CACE,MAAM,KAAK;CACX,GAAI,KAAK,kBAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAe,KAAK,cAAc;AAClF,IACA;CACE,MAAM,KAAK;CACX,GAAI,KAAK,kBAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAe,KAAK,cAAc;CAChF,GAAI,KAAK,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,KAAK,YAAY,EAAE;AACnF;;AAGR,MAAa,gBAAgB,OAAO,WAAW,WAC7C,OACA,UACgD;CAChD,MAAM,SAAS,OAAO,OAAO,oBAAoB,YAAY,CAAC,CAAC,OAAO,EACpE,kBAAkB,QACpB,CAAC,CAAC,CAAC,KACD,OAA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Y,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;GAC3C,GAAI,aAAa,KAAA,IACb,CAAC,IACD,EAAE,UAAU;IAAE,OAAO,SAAS;IAAO,QAAQ,SAAS;GAAO,EAAE;EACrE;EACA,cAAc;GAAE,GAAG;GAAU,+BAA+B,QAAQ;EAAU;CAChF;CAGA,MAAM,UAAU,OAAO,OAAO,aAAa,OAAO,eAAe,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KACtF,OAAO,SAAS,IAAI,CACtB;CAEA,IAAI,IAAI,YAAY,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,SAAS,OAAW,OAAO,OAAO,KAAK;CAM7E,OAAO;EAAE;EAAS,MAAM,OAJH,OAAO,aAAa,OAAO,eAAe,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KACpF,OAAO,SAAS,IAAI,CACtB;EAE+B;EAAU;EAAW;EAAS;CAAc;AAC7E,CAAC"}
package/dist/Launch.d.mts DELETED
@@ -1,127 +0,0 @@
1
- import { n as ContextReference, r as ExtensionReference } from "./References-DOH3Wu44.mjs";
2
- import { Schema } from "effect";
3
- //#region src/Launch.d.ts
4
- export declare const ProxyRule: Schema.Union<readonly [Schema.Struct<{
5
- readonly type: Schema.Literal<"browserbase">;
6
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
7
- readonly geolocation: Schema.optionalKey<Schema.Struct<{
8
- readonly country: Schema.String;
9
- readonly state: Schema.optionalKey<Schema.String>;
10
- readonly city: Schema.optionalKey<Schema.NonEmptyString>;
11
- }>>;
12
- }>, Schema.Struct<{
13
- readonly type: Schema.Literal<"external">;
14
- readonly server: Schema.NonEmptyString;
15
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
16
- readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
17
- readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
18
- }>, Schema.Struct<{
19
- readonly type: Schema.Literal<"none">;
20
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
21
- }>]>;
22
- export type ProxyRule = typeof ProxyRule.Type;
23
- /** SDK 2.20 browser subset. Names follow Browserbase; ownership-managed fields are excluded. */
24
- export declare const ProviderLaunchOptions: Schema.Struct<{
25
- readonly region: Schema.optionalKey<Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>>;
26
- readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
27
- readonly type: Schema.Literal<"browserbase">;
28
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
29
- readonly geolocation: Schema.optionalKey<Schema.Struct<{
30
- readonly country: Schema.String;
31
- readonly state: Schema.optionalKey<Schema.String>;
32
- readonly city: Schema.optionalKey<Schema.NonEmptyString>;
33
- }>>;
34
- }>, Schema.Struct<{
35
- readonly type: Schema.Literal<"external">;
36
- readonly server: Schema.NonEmptyString;
37
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
38
- readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
39
- readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
40
- }>, Schema.Struct<{
41
- readonly type: Schema.Literal<"none">;
42
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
43
- }>]>>]>>;
44
- readonly proxySettings: Schema.optionalKey<Schema.Struct<{
45
- readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
46
- }>>;
47
- readonly browserSettings: Schema.optionalKey<Schema.Struct<{
48
- readonly verified: Schema.optionalKey<Schema.Boolean>;
49
- readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
50
- readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
51
- readonly blockAds: Schema.optionalKey<Schema.Boolean>;
52
- readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
53
- readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
54
- readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
55
- readonly logSession: Schema.optionalKey<Schema.Boolean>;
56
- readonly recordSession: Schema.optionalKey<Schema.Boolean>;
57
- readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
58
- }>>;
59
- readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
60
- }>;
61
- export type ProviderLaunchOptions = typeof ProviderLaunchOptions.Type;
62
- /** Connection behavior and business budgets are not provider session lifetime. */
63
- export declare const LaunchRecipe: Schema.Struct<{
64
- readonly remoteTimeoutSeconds: Schema.Int;
65
- readonly keepAlive: Schema.optionalKey<Schema.Boolean>;
66
- readonly context: Schema.optionalKey<Schema.Struct<{
67
- readonly reference: typeof ContextReference;
68
- readonly persist: Schema.Boolean;
69
- }>>;
70
- /**
71
- * Project-qualified selection of an already provisioned extension, never an upload. It is
72
- * the only spelling: the compiler alone projects it to the provider's `extensionId`, so an
73
- * unqualified identifier cannot reach the provider unchecked.
74
- */
75
- readonly extension: Schema.optionalKey<typeof ExtensionReference>;
76
- readonly viewport: Schema.Union<readonly [Schema.TaggedStruct<"ProviderManaged", {}>, Schema.TaggedStruct<"Fixed", {
77
- readonly width: Schema.Int;
78
- readonly height: Schema.Int;
79
- }>]>;
80
- readonly provider: Schema.Struct<{
81
- readonly region: Schema.optionalKey<Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>>;
82
- readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
83
- readonly type: Schema.Literal<"browserbase">;
84
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
85
- readonly geolocation: Schema.optionalKey<Schema.Struct<{
86
- readonly country: Schema.String;
87
- readonly state: Schema.optionalKey<Schema.String>;
88
- readonly city: Schema.optionalKey<Schema.NonEmptyString>;
89
- }>>;
90
- }>, Schema.Struct<{
91
- readonly type: Schema.Literal<"external">;
92
- readonly server: Schema.NonEmptyString;
93
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
94
- readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
95
- readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
96
- }>, Schema.Struct<{
97
- readonly type: Schema.Literal<"none">;
98
- readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
99
- }>]>>]>>;
100
- readonly proxySettings: Schema.optionalKey<Schema.Struct<{
101
- readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
102
- }>>;
103
- readonly browserSettings: Schema.optionalKey<Schema.Struct<{
104
- readonly verified: Schema.optionalKey<Schema.Boolean>;
105
- readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
106
- readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
107
- readonly blockAds: Schema.optionalKey<Schema.Boolean>;
108
- readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
109
- readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
110
- readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
111
- readonly logSession: Schema.optionalKey<Schema.Boolean>;
112
- readonly recordSession: Schema.optionalKey<Schema.Boolean>;
113
- readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
114
- }>>;
115
- readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
116
- }>;
117
- }>;
118
- export type LaunchRecipe = typeof LaunchRecipe.Type;
119
- /**
120
- * A recipe with the smallest reasonable choices filled in: a five-minute provider lifetime,
121
- * a provider-managed viewport (which Verified requires) and no provider options. Privacy
122
- * defaults are unchanged: recording, logging and captcha solving stay off unless requested.
123
- */
124
- export declare const recipe: (options?: Partial<LaunchRecipe>) => LaunchRecipe;
125
- //#endregion
126
- export {};
127
- //# sourceMappingURL=Launch.d.mts.map
package/dist/Launch.mjs DELETED
@@ -1,97 +0,0 @@
1
- import { ContextReference, ExtensionReference, Identifier as Identifier$1 } from "./References.mjs";
2
- import { Schema } from "effect";
3
- import { Viewport } from "effect-browser/browser-data";
4
- //#region src/Launch.ts
5
- const BoundedString = Schema.NonEmptyString.check(Schema.isMaxLength(1024));
6
- const ProxySecret = Schema.Redacted(Schema.String.check(Schema.isMaxLength(8192)));
7
- const Geolocation = Schema.Struct({
8
- country: Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/)),
9
- state: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/))),
10
- city: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256)))
11
- });
12
- const ProxyRule = Schema.Union([
13
- Schema.Struct({
14
- type: Schema.Literal("browserbase"),
15
- domainPattern: Schema.optionalKey(BoundedString),
16
- geolocation: Schema.optionalKey(Geolocation)
17
- }),
18
- Schema.Struct({
19
- type: Schema.Literal("external"),
20
- server: BoundedString,
21
- domainPattern: Schema.optionalKey(BoundedString),
22
- username: Schema.optionalKey(ProxySecret),
23
- password: Schema.optionalKey(ProxySecret)
24
- }),
25
- Schema.Struct({
26
- type: Schema.Literal("none"),
27
- domainPattern: Schema.optionalKey(BoundedString)
28
- })
29
- ]);
30
- /** SDK 2.20 browser subset. Names follow Browserbase; ownership-managed fields are excluded. */
31
- const ProviderLaunchOptions = Schema.Struct({
32
- region: Schema.optionalKey(Schema.Literals([
33
- "us-west-2",
34
- "us-east-1",
35
- "eu-central-1",
36
- "ap-southeast-1"
37
- ])),
38
- proxies: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))])),
39
- proxySettings: Schema.optionalKey(Schema.Struct({ caCertificates: Schema.optionalKey(Schema.Array(Identifier$1).check(Schema.isMaxLength(64), Schema.isUnique())) })),
40
- browserSettings: Schema.optionalKey(Schema.Struct({
41
- verified: Schema.optionalKey(Schema.Boolean),
42
- os: Schema.optionalKey(Schema.Literals([
43
- "windows",
44
- "mac",
45
- "linux",
46
- "mobile",
47
- "tablet"
48
- ])),
49
- allowedDomains: Schema.optionalKey(Schema.Array(BoundedString).check(Schema.isMaxLength(64), Schema.isUnique())),
50
- blockAds: Schema.optionalKey(Schema.Boolean),
51
- captchaImageSelector: Schema.optionalKey(BoundedString),
52
- captchaInputSelector: Schema.optionalKey(BoundedString),
53
- ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean),
54
- logSession: Schema.optionalKey(Schema.Boolean),
55
- recordSession: Schema.optionalKey(Schema.Boolean),
56
- solveCaptchas: Schema.optionalKey(Schema.Boolean)
57
- })),
58
- userMetadata: Schema.optionalKey(Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json))
59
- });
60
- /** Connection behavior and business budgets are not provider session lifetime. */
61
- const LaunchRecipe = Schema.Struct({
62
- remoteTimeoutSeconds: Schema.Int.check(Schema.isBetween({
63
- minimum: 60,
64
- maximum: 21600
65
- })),
66
- keepAlive: Schema.optionalKey(Schema.Boolean),
67
- context: Schema.optionalKey(Schema.Struct({
68
- reference: ContextReference,
69
- persist: Schema.Boolean
70
- })),
71
- /**
72
- * Project-qualified selection of an already provisioned extension, never an upload. It is
73
- * the only spelling: the compiler alone projects it to the provider's `extensionId`, so an
74
- * unqualified identifier cannot reach the provider unchecked.
75
- */
76
- extension: Schema.optionalKey(ExtensionReference),
77
- viewport: Schema.Union([Schema.TaggedStruct("ProviderManaged", {}), Schema.TaggedStruct("Fixed", {
78
- width: Viewport.fields.width,
79
- height: Viewport.fields.height
80
- })]),
81
- provider: ProviderLaunchOptions
82
- });
83
- /**
84
- * A recipe with the smallest reasonable choices filled in: a five-minute provider lifetime,
85
- * a provider-managed viewport (which Verified requires) and no provider options. Privacy
86
- * defaults are unchanged: recording, logging and captcha solving stay off unless requested.
87
- */
88
- const recipe = (options = {}) => ({
89
- remoteTimeoutSeconds: 300,
90
- viewport: { _tag: "ProviderManaged" },
91
- provider: {},
92
- ...options
93
- });
94
- //#endregion
95
- export { LaunchRecipe, ProviderLaunchOptions, ProxyRule, recipe };
96
-
97
- //# sourceMappingURL=Launch.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Launch.mjs","names":["Identifier"],"sources":["../src/Launch.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { Viewport } from \"effect-browser/browser-data\";\n\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.TaggedStruct(\"ProviderManaged\", {}),\n Schema.TaggedStruct(\"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,OAAO,MAAM;CACpC,OAAO,OAAO;EACZ,MAAM,OAAO,QAAQ,aAAa;EAClC,eAAe,OAAO,YAAY,aAAa;EAC/C,aAAa,OAAO,YAAY,WAAW;CAC7C,CAAC;CACD,OAAO,OAAO;EACZ,MAAM,OAAO,QAAQ,UAAU;EAC/B,QAAQ;EACR,eAAe,OAAO,YAAY,aAAa;EAC/C,UAAU,OAAO,YAAY,WAAW;EACxC,UAAU,OAAO,YAAY,WAAW;CAC1C,CAAC;CACD,OAAO,OAAO;EAAE,MAAM,OAAO,QAAQ,MAAM;EAAG,eAAe,OAAO,YAAY,aAAa;CAAE,CAAC;AAClG,CAAC;;AAKD,MAAa,wBAAwB,OAAO,OAAO;CACjD,QAAQ,OAAO,YACb,OAAO,SAAS;EAAC;EAAa;EAAa;EAAgB;CAAgB,CAAC,CAC9E;CACA,SAAS,OAAO,YACd,OAAO,MAAM,CAAC,OAAO,SAAS,OAAO,MAAM,SAAS,CAAC,CA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EAC3B,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"}
@@ -1,40 +0,0 @@
1
- import { PlatformError } from "./Errors.mjs";
2
- import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
3
- import { Context, Effect, Layer, Schema } from "effect";
4
- //#region src/PageFetch.d.ts
5
- declare const PageFetchRequest: Schema.Struct<{
6
- readonly url: Schema.NonEmptyString;
7
- readonly allowRedirects: Schema.optionalKey<Schema.Boolean>;
8
- readonly allowInsecureSsl: Schema.optionalKey<Schema.Boolean>;
9
- readonly proxies: Schema.optionalKey<Schema.Boolean>;
10
- /** `raw` by default; `json` extracts with `schema`, `markdown` converts the page. */
11
- readonly format: Schema.optionalKey<Schema.Literals<readonly ["raw", "json", "markdown"]>>;
12
- /** A JSON Schema describing the object to extract when `format` is `json`. */
13
- readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
14
- }>;
15
- type PageFetchRequest = typeof PageFetchRequest.Type;
16
- declare const PageFetchResult_base: Schema.Class<PageFetchResult, Schema.Struct<{
17
- readonly id: Schema.String;
18
- readonly statusCode: Schema.Int;
19
- readonly headers: Schema.$Record<Schema.String, Schema.String>;
20
- readonly content: Schema.Union<readonly [Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>]>;
21
- readonly contentType: Schema.String;
22
- readonly encoding: Schema.String;
23
- }>, {}>;
24
- declare class PageFetchResult extends PageFetchResult_base {}
25
- declare const BrowserbasePageFetch_base: Context.ServiceClass<BrowserbasePageFetch, "effect-browserbase/PageFetch", {
26
- readonly fetch: (request: PageFetchRequest) => Effect.Effect<PageFetchResult, PlatformError>;
27
- }>;
28
- /**
29
- * Browserbase's Fetch API: one page retrieved by the provider without a browser session.
30
- * Replies are bounded by the 1 MiB control-plane limit (`reason: "limit"`); the POST is
31
- * never retried. Billing of each outcome is provider-owned. `statusCode` is the target
32
- * site's status, not the API's.
33
- */
34
- declare class BrowserbasePageFetch extends BrowserbasePageFetch_base {
35
- static readonly layer: Layer.Layer<BrowserbasePageFetch, never, BrowserbaseClient>;
36
- }
37
- //#endregion
38
- export { PageFetchRequest as n, PageFetchResult as r, BrowserbasePageFetch as t };
39
- export {};
40
- //# sourceMappingURL=PageFetch-CjAM_0DS.d.mts.map
@@ -1,3 +0,0 @@
1
- import { n as PageFetchRequest, r as PageFetchResult, t as BrowserbasePageFetch } from "./PageFetch-CjAM_0DS.mjs";
2
- export { BrowserbasePageFetch, PageFetchRequest, PageFetchResult };
3
- export {};
@@ -1,59 +0,0 @@
1
- import { PlatformError } from "./Errors.mjs";
2
- import { r as span, t as BrowserbaseClient } from "./Client-BEC4Q8ZS.mjs";
3
- import { t as resource } from "./Resource-J7Kkk5mu.mjs";
4
- import { Context, Effect, Layer, Schema } from "effect";
5
- //#region src/PageFetch.ts
6
- const HttpUrl = Schema.NonEmptyString.check(Schema.isMaxLength(8192), Schema.makeFilter((value) => {
7
- try {
8
- const url = new URL(value);
9
- return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password;
10
- } catch {
11
- return false;
12
- }
13
- }));
14
- const PageFetchRequest = Schema.Struct({
15
- url: HttpUrl,
16
- allowRedirects: Schema.optionalKey(Schema.Boolean),
17
- allowInsecureSsl: Schema.optionalKey(Schema.Boolean),
18
- proxies: Schema.optionalKey(Schema.Boolean),
19
- /** `raw` by default; `json` extracts with `schema`, `markdown` converts the page. */
20
- format: Schema.optionalKey(Schema.Literals([
21
- "raw",
22
- "json",
23
- "markdown"
24
- ])),
25
- /** A JSON Schema describing the object to extract when `format` is `json`. */
26
- schema: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json))
27
- });
28
- var PageFetchResult = class extends Schema.Class("BrowserbasePageFetchResult")({
29
- id: Schema.String.check(Schema.isMaxLength(256)),
30
- statusCode: Schema.Int,
31
- headers: Schema.Record(Schema.String, Schema.String),
32
- content: Schema.Union([Schema.String, Schema.Json]),
33
- contentType: Schema.String.check(Schema.isMaxLength(1024)),
34
- encoding: Schema.String.check(Schema.isMaxLength(64))
35
- }) {};
36
- /**
37
- * Browserbase's Fetch API: one page retrieved by the provider without a browser session.
38
- * Replies are bounded by the 1 MiB control-plane limit (`reason: "limit"`); the POST is
39
- * never retried. Billing of each outcome is provider-owned. `statusCode` is the target
40
- * site's status, not the API's.
41
- */
42
- var BrowserbasePageFetch = class BrowserbasePageFetch extends Context.Service()("effect-browserbase/PageFetch") {
43
- static layer = Layer.effect(BrowserbasePageFetch, Effect.gen(function* () {
44
- const api = resource(yield* BrowserbaseClient, (failure) => PlatformError.make({
45
- ...failure,
46
- service: "fetch"
47
- }));
48
- const fetch = Effect.fnUntraced(function* (request) {
49
- const value = yield* api.input(PageFetchRequest, request, "fetch");
50
- if (value.schema !== void 0 && value.format !== "json") return yield* api.configuration("fetch");
51
- return yield* api.request("POST", "/v1/fetch", PageFetchResult, "fetch", value);
52
- }, span("BrowserbasePageFetch.fetch"));
53
- return BrowserbasePageFetch.of({ fetch });
54
- }));
55
- };
56
- //#endregion
57
- export { BrowserbasePageFetch, PageFetchRequest, PageFetchResult };
58
-
59
- //# sourceMappingURL=PageFetch.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageFetch.mjs","names":["Trace.span"],"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\";\nimport * as Trace from \"./internal/Trace.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\"`); the POST is\n * never retried. Billing of each outcome is provider-owned. `statusCode` is the target\n * 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.fnUntraced(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 }, Trace.span(\"BrowserbasePageFetch.fetch\"));\n\n return BrowserbasePageFetch.of({ fetch });\n }),\n );\n}\n"],"mappings":";;;;;AAOA,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;;;;;;;AAQJ,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,WAAW,WAAW,SAA2B;GACpE,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,GAAGA,KAAW,4BAA4B,CAAC;EAE3C,OAAO,qBAAqB,GAAG,EAAE,MAAM,CAAC;CAC1C,CAAC,CACH;AACF"}
@@ -1,38 +0,0 @@
1
- import { ProjectError } from "./Errors.mjs";
2
- import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
3
- import { Context, Effect, Layer, Schema } from "effect";
4
- //#region src/Projects.d.ts
5
- declare const ProjectMetadata_base: Schema.Class<ProjectMetadata, Schema.Struct<{
6
- readonly projectId: Schema.NonEmptyString;
7
- readonly name: Schema.String;
8
- readonly ownerId: Schema.String;
9
- /** Default provider session lifetime in seconds. */
10
- readonly defaultTimeout: Schema.Int;
11
- /** Maximum concurrent sessions. */
12
- readonly concurrency: Schema.Int;
13
- readonly createdAt: Schema.String;
14
- readonly updatedAt: Schema.String;
15
- }>, {}>;
16
- declare class ProjectMetadata extends ProjectMetadata_base {}
17
- declare const ProjectUsage_base: Schema.Class<ProjectUsage, Schema.Struct<{
18
- readonly projectId: Schema.NonEmptyString;
19
- readonly browserMinutes: Schema.Natural;
20
- readonly proxyBytes: Schema.Natural;
21
- }>, {}>;
22
- declare class ProjectUsage extends ProjectUsage_base {}
23
- declare const BrowserbaseProjects_base: Context.ServiceClass<BrowserbaseProjects, "effect-browserbase/Projects", {
24
- readonly list: Effect.Effect<ReadonlyArray<ProjectMetadata>, ProjectError>;
25
- readonly retrieve: Effect.Effect<ProjectMetadata, ProjectError>;
26
- readonly usage: Effect.Effect<ProjectUsage, ProjectError>;
27
- }>;
28
- /**
29
- * Passive project inspection. `retrieve` and `usage` read the Client's own project; `list`
30
- * reports every project the API key can see. Nothing here changes provider state.
31
- */
32
- declare class BrowserbaseProjects extends BrowserbaseProjects_base {
33
- static readonly layer: Layer.Layer<BrowserbaseProjects, never, BrowserbaseClient>;
34
- }
35
- //#endregion
36
- export { ProjectMetadata as n, ProjectUsage as r, BrowserbaseProjects as t };
37
- export {};
38
- //# sourceMappingURL=Projects-tm5bTDH0.d.mts.map
@@ -1,3 +0,0 @@
1
- import { n as ProjectMetadata, r as ProjectUsage, t as BrowserbaseProjects } from "./Projects-tm5bTDH0.mjs";
2
- export { BrowserbaseProjects, ProjectMetadata, ProjectUsage };
3
- export {};
package/dist/Projects.mjs DELETED
@@ -1,65 +0,0 @@
1
- import { Identifier } from "./References.mjs";
2
- import { ProjectError } from "./Errors.mjs";
3
- import { r as span, t as BrowserbaseClient } from "./Client-BEC4Q8ZS.mjs";
4
- import { t as resource } from "./Resource-J7Kkk5mu.mjs";
5
- import { Context, Effect, Layer, Schema } from "effect";
6
- //#region src/Projects.ts
7
- const Timestamp = Schema.String.check(Schema.isMaxLength(64));
8
- var ProjectMetadata = class extends Schema.Class("BrowserbaseProjectMetadata")({
9
- projectId: Identifier,
10
- name: Schema.String.check(Schema.isMaxLength(1024)),
11
- ownerId: Schema.String.check(Schema.isMaxLength(256)),
12
- /** Default provider session lifetime in seconds. */
13
- defaultTimeout: Schema.Int,
14
- /** Maximum concurrent sessions. */
15
- concurrency: Schema.Int,
16
- createdAt: Timestamp,
17
- updatedAt: Timestamp
18
- }) {};
19
- var ProjectUsage = class extends Schema.Class("BrowserbaseProjectUsage")({
20
- projectId: Identifier,
21
- browserMinutes: Schema.Natural,
22
- proxyBytes: Schema.Natural
23
- }) {};
24
- const ProviderProject = Schema.Struct({
25
- id: Identifier,
26
- name: ProjectMetadata.fields.name,
27
- ownerId: ProjectMetadata.fields.ownerId,
28
- defaultTimeout: Schema.Int,
29
- concurrency: Schema.Int,
30
- createdAt: Timestamp,
31
- updatedAt: Timestamp
32
- });
33
- const project = ({ id, ...rest }) => ProjectMetadata.make({
34
- projectId: id,
35
- ...rest
36
- });
37
- /**
38
- * Passive project inspection. `retrieve` and `usage` read the Client's own project; `list`
39
- * reports every project the API key can see. Nothing here changes provider state.
40
- */
41
- var BrowserbaseProjects = class BrowserbaseProjects extends Context.Service()("effect-browserbase/Projects") {
42
- static layer = Layer.effect(BrowserbaseProjects, Effect.gen(function* () {
43
- const client = yield* BrowserbaseClient;
44
- const api = resource(client, (failure) => ProjectError.make(failure));
45
- const own = `/v1/projects/${api.segment(client.projectId)}`;
46
- const list = api.request("GET", "/v1/projects", Schema.Array(ProviderProject).check(Schema.isMaxLength(1024)), "project-list").pipe(Effect.map((rows) => rows.map(project)), span("BrowserbaseProjects.list"));
47
- const retrieve = api.request("GET", own, ProviderProject, "project-retrieve").pipe(Effect.flatMap((value) => value.id === client.projectId ? Effect.succeed(project(value)) : Effect.fail(api.malformed("project-retrieve", false))), span("BrowserbaseProjects.retrieve"));
48
- const usage = api.request("GET", `${own}/usage`, Schema.Struct({
49
- browserMinutes: Schema.Natural,
50
- proxyBytes: Schema.Natural
51
- }), "project-usage").pipe(Effect.map((value) => ProjectUsage.make({
52
- projectId: client.projectId,
53
- ...value
54
- })), span("BrowserbaseProjects.usage"));
55
- return BrowserbaseProjects.of({
56
- list,
57
- retrieve,
58
- usage
59
- });
60
- }));
61
- };
62
- //#endregion
63
- export { BrowserbaseProjects, ProjectMetadata, ProjectUsage };
64
-
65
- //# sourceMappingURL=Projects.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Projects.mjs","names":["Trace.span"],"sources":["../src/Projects.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { ProjectError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport * as Trace from \"./internal/Trace.ts\";\nimport { Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\nexport class ProjectMetadata extends Schema.Class<ProjectMetadata>(\"BrowserbaseProjectMetadata\")({\n projectId: Identifier,\n name: Schema.String.check(Schema.isMaxLength(1024)),\n ownerId: Schema.String.check(Schema.isMaxLength(256)),\n /** Default provider session lifetime in seconds. */\n defaultTimeout: Schema.Int,\n /** Maximum concurrent sessions. */\n concurrency: Schema.Int,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\nexport class ProjectUsage extends Schema.Class<ProjectUsage>(\"BrowserbaseProjectUsage\")({\n projectId: Identifier,\n browserMinutes: Schema.Natural,\n proxyBytes: Schema.Natural,\n}) {}\n\nconst ProviderProject = Schema.Struct({\n id: Identifier,\n name: ProjectMetadata.fields.name,\n ownerId: ProjectMetadata.fields.ownerId,\n defaultTimeout: Schema.Int,\n concurrency: Schema.Int,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n});\n\nconst project = ({ id, ...rest }: typeof ProviderProject.Type) =>\n ProjectMetadata.make({ projectId: id, ...rest });\n\n/**\n * Passive project inspection. `retrieve` and `usage` read the Client's own project; `list`\n * reports every project the API key can see. Nothing here changes provider state.\n */\nexport class BrowserbaseProjects extends Context.Service<\n BrowserbaseProjects,\n {\n readonly list: Effect.Effect<ReadonlyArray<ProjectMetadata>, ProjectError>;\n readonly retrieve: Effect.Effect<ProjectMetadata, ProjectError>;\n readonly usage: Effect.Effect<ProjectUsage, ProjectError>;\n }\n>()(\"effect-browserbase/Projects\") {\n static readonly layer: Layer.Layer<BrowserbaseProjects, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseProjects,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const api = resource<ProjectError>(client, (failure) => ProjectError.make(failure));\n const own = `/v1/projects/${api.segment(client.projectId)}`;\n\n const list = api\n .request(\n \"GET\",\n \"/v1/projects\",\n Schema.Array(ProviderProject).check(Schema.isMaxLength(1024)),\n \"project-list\",\n )\n .pipe(\n Effect.map((rows) => rows.map(project)),\n Trace.span(\"BrowserbaseProjects.list\"),\n );\n\n const retrieve = api.request(\"GET\", own, ProviderProject, \"project-retrieve\").pipe(\n Effect.flatMap((value) =>\n value.id === client.projectId\n ? Effect.succeed(project(value))\n : Effect.fail(api.malformed(\"project-retrieve\", false)),\n ),\n Trace.span(\"BrowserbaseProjects.retrieve\"),\n );\n\n const usage = api\n .request(\n \"GET\",\n `${own}/usage`,\n Schema.Struct({ browserMinutes: Schema.Natural, proxyBytes: Schema.Natural }),\n \"project-usage\",\n )\n .pipe(\n Effect.map((value) => ProjectUsage.make({ projectId: client.projectId, ...value })),\n Trace.span(\"BrowserbaseProjects.usage\"),\n );\n\n return BrowserbaseProjects.of({ list, retrieve, usage });\n }),\n );\n}\n"],"mappings":";;;;;;AAQA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAE5D,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,WAAW;CACX,MAAM,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC;CAClD,SAAS,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;;CAEpD,gBAAgB,OAAO;;CAEvB,aAAa,OAAO;CACpB,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,eAAb,cAAkC,OAAO,MAAoB,yBAAyB,CAAC,CAAC;CACtF,WAAW;CACX,gBAAgB,OAAO;CACvB,YAAY,OAAO;AACrB,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,kBAAkB,OAAO,OAAO;CACpC,IAAI;CACJ,MAAM,gBAAgB,OAAO;CAC7B,SAAS,gBAAgB,OAAO;CAChC,gBAAgB,OAAO;CACvB,aAAa,OAAO;CACpB,WAAW;CACX,WAAW;AACb,CAAC;AAED,MAAM,WAAW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